import * as React from 'react' import type { StoryObj, Meta } from '@storybook/react-webpack5' import { Combobox } from '.' import { Comment } from '@planview/pv-icons' /** * Implementation combines [Form Field specification](https://design.planview.com/components/forms/form-field) * with [Combobox specification](https://design.planview.com/components/forms/combobox). * * `import { Combobox } from '@planview/pv-form'` * * _Note: The form combobox extends the `Combobox` from `@planview/pv-uikit`, to see more examples of component capabilities, see the [ui-kit docs](/docs/pv-uikit-combobox--docs)_ * */ export default { title: 'pv-form/Components/Combobox', tags: ['autodocs'], component: Combobox, args: { label: 'Select language', options: [ { label: 'English', value: 'en' }, { label: 'Swedish', value: 'se' }, { label: 'Danish', value: 'da' }, { label: 'Norwegian', value: 'no' }, { label: 'German', value: 'de' }, { label: 'Dutch', value: 'nl' }, ], }, argTypes: { multiSelectable: { control: false, }, error: { control: { type: 'text' }, }, }, parameters: { badges: ['intl'], }, } satisfies Meta type Story = StoryObj export const Default: Story = {} export const MultiSelectable: Story = { args: { defaultValue: [{ label: 'Dutch', value: 'nl' }], multiSelectable: true, }, } export const WithError: Story = { args: { error: 'This language is not supported', value: { label: 'Dutch', value: 'nl' }, }, } export const WithWarning: Story = { args: { warning: 'This language may not be supported', value: { label: 'Dutch', value: 'nl' }, }, } export const WithIcon: Story = { args: { label: 'Sample label', icon: , }, } export const WithAsterisk: Story = { args: { label: 'Field is required', withAsterisk: true, defaultValue: { label: 'English', value: 'en' }, }, } export const WithoutAsteriskAndNotClearable: Story = { args: { label: 'Pick your language', clearable: false, defaultValue: { label: 'English', value: 'en' }, }, } export const WithAsteriskAndNotClearable: Story = { args: { label: 'Pick your language', withAsterisk: true, clearable: false, }, } export const WithAsteriskAndIcon: Story = { args: { label: { text: 'Field is required with icon', required: true, requiredTooltip: 'This is required', iconTooltip: 'You may want to provide additional information using this mechanism', }, }, } export const Disabled: Story = { args: { disabled: true, value: { label: 'English', value: 'en' }, }, } export const ReadOnly: Story = { args: { readOnly: true, value: { label: 'English', value: 'en' }, }, }