import type { Meta, StoryObj } from '@storybook/react-webpack5'; import { useState } from 'react'; import { createSandboxStory, globalScope, } from '../../../.storybook/components/sandbox/SandboxEditor'; import Radio, { type RadioProps } from '..'; import AvatarView from '../../AvatarView'; import { Flag } from '@wise/art'; import { fn } from 'storybook/test'; const meta: Meta = { component: Radio, title: 'Forms/Radio', argTypes: { disabled: { control: 'boolean' }, }, }; export default meta; export const Sandbox = createSandboxStory({ code: `const App = () => { const [selected, setSelected] = React.useState('option1'); return ( <> setSelected('option1')} /> setSelected('option2')} /> ); };`, scope: globalScope, }); export const Basic: StoryObj = { render: (args) => { return ; }, args: { checked: false, disabled: false, label: 'Without Avatar', name: 'name', secondary: 'This is secondary text', id: 'radioGroup1', value: 'option1', }, }; export const Variants: StoryObj = { render: () => { const [selectedValue, setSelectedValue] = useState('option1'); return ( <>
setSelectedValue('option1')} />
} value="option2" checked={selectedValue === 'option2'} onChange={() => setSelectedValue('option2')} />
); }, };