import * as React from 'react'; import { WidthWidget, defaultActionsInfo } from './WidthWidget'; import type { Meta, StoryObj } from '@storybook/react-vite'; import { Form } from 'react-aria-components'; import { Button } from '../Button/Button.quanta'; import { ImageIcon } from '../../components/icons/ImageIcon'; const meta = { title: 'Quanta/WidthWidget', component: WidthWidget, parameters: { layout: 'centered', backgrounds: { disable: true }, }, tags: ['autodocs'], argTypes: {}, args: {}, } satisfies Meta; export default meta; type Story = StoryObj; export const Default: Story = { args: { label: 'Block Width', description: 'Choose the width of your content block', name: 'width', }, }; export const AllOptions: Story = { args: { label: 'All Width Options', description: 'Complete set of width options', name: 'all-width', }, }; export const FilteredActions: Story = { args: { label: 'Filtered Width Options', description: 'Only narrow and full width options', name: 'filtered-width', }, }; export const WithoutLabel: Story = { args: { name: 'no-label', }, }; export const WithDefault: Story = { args: { name: 'with-default', defaultValue: 'default', }, }; const ControlledExample = () => { const [value, setValue] = React.useState('default'); return (
setValue(width)} />
Current value: {value}
); }; export const Controlled: StoryObj = { render: ControlledExample, parameters: { docs: { description: { story: 'Controlled WidthWidget example with external state management', }, }, }, }; const customActionsInfo = { ...defaultActionsInfo, custom: [ImageIcon, 'Custom Width'] as [React.ComponentType, string], }; export const CustomActions: Story = { args: { label: 'Custom Width Options', description: 'Example with custom actions and info mapping', actionsInfoMap: customActionsInfo, name: 'custom-width', }, }; const FormExample = () => { const [selectedValue, setSelectedValue] = React.useState(''); return (
Selected value: {selectedValue}
); }; export const FormIntegration: StoryObj = { render: FormExample, };