import * as React from 'react'; import { SizeWidget, defaultSizeActionsInfo } from './SizeWidget'; import type { Meta, StoryObj } from '@storybook/react-vite'; import { Form } from 'react-aria-components'; import { Button } from '../Button/Button.quanta'; const meta = { title: 'Quanta/SizeWidget', component: SizeWidget, parameters: { layout: 'centered', backgrounds: { disable: true }, }, tags: ['autodocs'], argTypes: {}, args: {}, } satisfies Meta; export default meta; type Story = StoryObj; export const Default: Story = { args: { label: 'Content Size', description: 'Choose the size of your content', name: 'size', }, }; export const AllOptions: Story = { args: { label: 'All Size Options', description: 'Complete set of size options', name: 'all-size', }, }; export const FilteredActions: Story = { args: { label: 'Filtered Size Options', description: 'Only small and large size options', actions: ['s', 'l'], name: 'filtered-size', }, }; export const WithoutLabel: Story = { args: { actions: ['s', 'm', 'l'], name: 'no-label', }, }; export const WithDefault: Story = { args: { name: 'with-default', defaultValue: 'm', }, }; const ControlledExample = () => { const [value, setValue] = React.useState('m'); return (
setValue(size)} />
Current value: {value}
); }; export const Controlled: StoryObj = { render: ControlledExample, parameters: { docs: { description: { story: 'Controlled SizeWidget example with external state management', }, }, }, }; const customActionsInfo = { ...defaultSizeActionsInfo, xs: ['XS', 'Extra Small'] as [string, string], xl: ['XL', 'Extra Large'] as [string, string], }; export const CustomActions: Story = { args: { label: 'Custom Size Options', description: 'Example with custom actions and info mapping', actions: ['xs', 's', 'm', 'l', 'xl'], actionsInfoMap: customActionsInfo, name: 'custom-size', }, }; const FormExample = () => { const [selectedValue, setSelectedValue] = React.useState(''); return (
Selected value: {selectedValue}
); }; export const FormIntegration: StoryObj = { render: FormExample, }; export const Disabled: Story = { args: { label: 'Content Size', description: 'This widget is disabled', name: 'disabled-size', isDisabled: true, }, };