import * as React from 'react';
import type { Meta } from '@storybook/react';
import { TextControl } from '@tesseract-design/web-base';
import { MaskedTextInput as Component, MaskedTextInputProps as Props } from '.';

const meta: Meta<typeof Component> = {
	component: Component,
	argTypes: {
		label: {
			control: { type: 'text' },
		},
		hint: {
			control: { type: 'text' },
		},
		variant: {
			control: {
				type: 'select',
			},
			options: TextControl.AVAILABLE_VARIANTS,
		},
		size: {
			control: {
				type: 'select',
			},
			options: TextControl.AVAILABLE_SIZES,
		},
		autoComplete: {
			table: {
				disable: true,
			},
		},
		length: {
			control: {
				type: 'number',
			},
		},
		onChange: {
			table: {
				disable: true,
			},
			action: 'changed',
		},
	},
	args: {
		...(Component.defaultProps ?? {}),
		label: Component.displayName,
	},
};

export const MaskedTextInput = (args: Omit<Props, 'ref'>) => (
	<Component
		{...args}
	/>
);

export default meta;
