import { useState } from 'react'; import { Combobox, ComboboxContent, ComboboxControl, type ComboboxItem } from '../../src'; export default { component: Combobox, title: 'Tests rendering', }; const simpleItems = [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Cherry', value: 'cherry' }, ]; const groupedItems = [ { label: 'Fruits', options: [ { label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }, { label: 'Cherry', value: 'cherry' }, ] }, { label: 'Vegetables', options: [ { label: 'Carrot', value: 'carrot' }, { label: 'Broccoli', value: 'broccoli' }, { label: 'Spinach', value: 'spinach' } ] } ]; export const Controlled = () => { const [values, setValues] = useState([]); return ( setValues(value) } value={ values }> ); }; export const CustomOptionRenderer = () => { type MyData = { description?: string, } const items = [ { label: 'Dog', value: 'dog', customRendererData: { description: 'My dog is stupid' }}, { label: 'Cat', value: 'cat', customRendererData: { description: 'All cats are awesome' }}, { label: 'Hamster', value: 'hamster', customRendererData: { description: 'Where is my hamster?' }}, { label: 'Parrot', value: 'parrot', customRendererData: { description: 'Repeat repeat repeat' }}, { label: 'Spider', value: 'spider', customRendererData: { description: 'Spider? Where?' }}, { label: 'Goldfish', value: 'goldfish', customRendererData: { description: 'Cool a new aquarium' }}, ]; return ( ) => (
{ item.label } { item.customRendererData?.description }
)} items={ items }>
); }; export const Default = () => ( ); export const DefaultValue = () => ( ); export const DefaultValueMultiple = () => ( ); export const Disabled = () => ( ); export const Empty = () => ( ); export const Group = () => ( ); export const Readonly = () => ( );