import type { Meta, StoryObj } from '@storybook/nextjs' import { useState } from 'react' import Chip, { type Item } from '.' const ITEMS: Item[] = [ { value: 'all', name: 'All items' }, { value: 'active', name: 'Active' }, { value: 'archived', name: 'Archived' }, { value: 'draft', name: 'Drafts' }, ] const meta = { title: 'Base/Data Entry/Chip', component: Chip, parameters: { docs: { description: { component: 'Filter chip with dropdown panel and optional left icon. Commonly used for status pickers in toolbars.', }, }, }, tags: ['autodocs'], args: { items: ITEMS, value: 'all', // eslint-disable-next-line no-empty-function onSelect: () => {}, // eslint-disable-next-line no-empty-function onClear: () => {}, }, } satisfies Meta export default meta type Story = StoryObj const ChipDemo = (props: React.ComponentProps) => { const [selection, setSelection] = useState(props.value) return (
setSelection(item.value)} onClear={() => setSelection('all')} />
Current value: {selection}
) } export const Playground: Story = { render: args => , parameters: { docs: { source: { language: 'tsx', code: ` const [selection, setSelection] = useState('all') setSelection(item.value)} onClear={() => setSelection('all')} /> `.trim(), }, }, }, } export const WithoutLeftIcon: Story = { args: { showLeftIcon: false, // eslint-disable-next-line no-empty-function onSelect: () => {}, // eslint-disable-next-line no-empty-function onClear: () => {}, }, render: args => ( ), parameters: { docs: { source: { language: 'tsx', code: ` `.trim(), }, }, }, }