import type { Meta, StoryObj } from '@storybook/react' import { useState } from 'react' import { Typography } from '../Typography' import { RadioGroup, RadioGroupItem } from './RadioGroup' const meta: Meta = { title: 'Form/RadioGroup', component: RadioGroup, parameters: { layout: 'centered', }, argTypes: { onValueChange: { action: 'value changed' }, }, args: { onValueChange: undefined, }, } export default meta type Story = StoryObj export const Default: Story = { render: (args: any) => ( Option One Option Two Option Three ), } export const Disabled: Story = { args: { defaultValue: 'option-one', }, render: (args: any) => ( Option One (Disabled checked) Option Two Option Three (Disabled) ), } export const WithError: Story = { args: { defaultValue: 'option-one', }, render: (args: any) => ( Option One (Error Checked) Option Two (Error Unchecked) Option Three ), } export const WithGroupError: Story = { args: { defaultValue: undefined, error: 'Please select an option', }, render: (args: any) => ( Option One Option Two Option Three ), } export const WithItemErrorMessage: Story = { args: { defaultValue: 'option-one', }, render: (args: any) => ( Option One Option Two Option Three ), } export const Controlled = ({ initialValue }: { initialValue?: string }) => { const [value, setValue] = useState(initialValue || 'option-one') return (
Option One Option Two Option Three Selected value: {value}
) }