import { useEffect, useState } from 'react' import { type Meta, type StoryFn, type StoryObj } from '@storybook/react' import { Radio, RadioGroup } from './RadioGroup' import { type RadioGroupProps } from './RadioGroup.types' enum Theme { System = 'System', Light = 'Light', Dark = 'Dark', } const meta: Meta = { component: RadioGroup, argTypes: { direction: { control: { type: 'radio', }, options: ['vertical', 'horizontal'], }, }, } const Template: StoryFn> = ({ value: valueProp, ...props }) => { const [value, setValue] = useState(() => valueProp) useEffect( function watchValueToChange() { setValue(valueProp) }, [valueProp] ) return ( {Theme.System} {Theme.Light} {Theme.Dark} ) } export const Primary: StoryObj> = { render: Template, args: { value: Theme.System, disabled: false, required: false, direction: 'vertical', spacing: 0, }, } export default meta