import type { Meta, StoryObj } from '@storybook/react'; import { action } from 'storybook/actions'; import React, { type ChangeEvent, useState } from 'react'; import { RadioGroup } from '../RadioGroup'; import { RadioField } from '../../RadioField'; import { SnapshotContainer } from '../../../test-utils/SnapshotsContainer'; const meta: Meta = { title: 'Form/RadioGroup', component: RadioGroup, }; export default meta; type Story = StoryObj; type Option = { value: string; label: string; isDisabled?: boolean; }; const options: Option[] = [ { value: 'daily', label: 'Daily' }, { value: 'weekly', label: 'Weekly' }, { value: 'yearly', label: 'Yearly' }, ]; export const Default: Story = { args: { name: 'row', }, render: (args) => { const [selectedValue, setSelectedValue] = useState(null); const handleChange = (event: ChangeEvent) => { action('onChange')(event); setSelectedValue(event.target.value); }; return ( {options.map((props) => ( ))} ); }, }; export const DirectionColumn: Story = { args: { name: 'column', direction: 'column', }, render: Default.render, }; export const Snapshot: Story = { parameters: { chromatic: { disableSnapshot: false }, }, render: () => ( ), };