import SimpleCheckboxGroup, { SimpleCheckboxGroupProps } from '@/components/SimpleCheckboxGroup'; import { useArgs } from '@storybook/preview-api'; import { Meta, StoryObj } from '@storybook/react'; import { useState } from 'react'; const meta: Meta = { title: 'SimpleCheckboxGroup', component: SimpleCheckboxGroup, tags: ['autodocs'], }; export default meta; type Story = StoryObj; export const Default: Story = { args: { name: 'taxClasses', options: [ { label: 'Standard Rate', value: 'standard' }, { label: 'Reduced Rate', value: 'reduced' }, { label: 'Zero Rate', value: 'zero' }, ], defaultValue: ['reduced'], }, render: () => { const [args] = useArgs(); const [selected, setSelected] = useState>([]); return ( <> setSelected(checkedList)} />

Current Value: {selected.join(', ')}

); }, }; export const WithLabel: Story = { args: { label: 'Choose tax classes', helpText: 'You can choose as many as class you want to attach with the country.', name: 'taxClasses', options: [ { label: 'Standard Rate', value: 'standard' }, { label: 'Reduced Rate', value: 'reduced' }, { label: 'Zero Rate', value: 'zero' }, ], }, render: () => { const [args] = useArgs(); const [selected, setSelected] = useState>([]); return ( <> setSelected(checkedList)} />

Current Value: {selected.join(', ')}

); }, }; export const WithLabelAndError: Story = { args: { label: 'Choose tax classes', helpText: 'You can choose as many as class you want to attach with the country.', name: 'taxClasses', options: [ { label: 'Standard Rate', value: 'standard' }, { label: 'Reduced Rate', value: 'reduced' }, { label: 'Zero Rate', value: 'zero' }, ], errors: ['You must choose at least one from the above list.'], }, render: () => { const [args] = useArgs(); const [selected, setSelected] = useState>([]); return ( <> setSelected(checkedList)} />

Current Value: {selected.join(', ')}

); }, };