import * as React from 'react';
import type { Meta } from '@storybook/react';
import { RadioTickBox as Component, RadioTickBoxProps as Props } from '.';

const LENGTH = 3 as const;

const meta: Meta<typeof Component> = {
	component: Component,
	argTypes: {
		subtext: {
			control: { type: 'text' },
		},
		onChange: {
			table: {
				disable: true,
			},
			action: 'changed',
		},
	},
	args: {
		...(Component.defaultProps ?? {}),
	},
};

export const RadioTickBox = (args: Omit<Props, 'ref'>) => (
	<>
		{Array.from({ length: LENGTH }).map((_, i) => (
			<Component
				{...args}
				key={i}
				name={Component.displayName}
				value={i + 1}
			>
				{Component.displayName} {i + 1}
			</Component>
		))}
	</>
);

export default meta;
