import type { Meta, StoryObj } from '@storybook/react-vite'; import { IconPlus } from '@tabler/icons-react'; import { type ComponentMatrixCellProps, Story } from './_internal/Story'; import { Button, type ButtonProps } from './Button'; const meta = { component: Button, parameters: { layout: 'fullscreen', }, title: 'components/Button', } satisfies Meta; export default meta; type ButtonVariant = NonNullable; type StoryDefinition = StoryObj; const STATE_COLUMNS: { key: string; label: string; props: Partial; }[] = [ { key: 'default', label: 'Default', props: {} }, { key: 'hover', label: 'Hover', props: { className: 'pseudo-hover' } }, { key: 'focus', label: 'Focus', props: { className: 'pseudo-focus-visible' }, }, { key: 'active', label: 'Active', props: { className: 'pseudo-active' } }, { key: 'disabled', label: 'Disabled', props: { disabled: true } }, { key: 'loading', label: 'Loading', props: { loading: true } }, ]; const STATE_PROPS = Object.fromEntries( STATE_COLUMNS.map((state) => [state.key, state.props]), ) as Record>; const VARIANT_ROWS: { key: ButtonVariant; label: string; }[] = [ { key: 'default', label: 'Default' }, { key: 'secondary', label: 'Secondary' }, { key: 'destructive', label: 'Destructive' }, { key: 'destructive-outline', label: 'Destructive outline' }, { key: 'outline', label: 'Outline' }, { key: 'ghost', label: 'Ghost' }, { key: 'link', label: 'Link' }, ]; const SIZE_COLUMNS = [ { description: 'h-7', key: 'xs', label: 'Extra small' }, { description: 'h-8', key: 'sm', label: 'Small' }, { description: 'h-8', key: 'md', label: 'Medium' }, { description: 'h-9', key: 'lg', label: 'Large' }, { description: 'h-10', key: 'xl', label: 'Extra large' }, ]; const CONTENT_ROWS = [ { key: 'text', label: 'Text' }, { key: 'with-icon', label: 'Icon and text' }, { description: 'Use size="icon" with aria-label', key: 'icon', label: 'Icon only', }, ]; type ButtonSize = NonNullable; function ButtonContentCell({ column, row }: ComponentMatrixCellProps) { const variant = column.key as ButtonVariant; if (row.key === 'icon') { return ( ); } return ( ); } function ButtonSizeCell({ column, row }: ComponentMatrixCellProps) { const size = column.key as ButtonSize; if (row.key === 'icon') { return ( ); } return ( ); } function ButtonStateCell({ column, row }: ComponentMatrixCellProps) { return ( ); } export const All: StoryDefinition = { render: () => ( ), };