// spell-checker:ignore comboboxtree import type { StoryObj, Meta } from '@storybook/react-webpack5' import { ComboboxTree } from '.' import type { ComboboxTreeOption } from '@planview/pv-uikit' import { Activity } from '@planview/pv-icons' import React from 'react' const DEFAULT_OPTIONS: ComboboxTreeOption[] = [ { label: 'Inbox', value: '1' }, { label: 'Backlog', value: '2', children: [ { label: 'Activities', value: '2-1' }, { label: 'Design', value: '2-2' }, { label: 'Development', value: '2-3' }, ], }, { label: 'Up next', value: '3', children: [ { label: 'Activities', value: '3-1' }, { label: 'Design', value: '3-2' }, { label: 'Development', value: '3-3' }, ], }, { label: 'Working', value: '4', children: [ { label: 'Design', value: '4-1', children: [ { label: 'Working', value: '4-1-1' }, { label: 'Needs review with a really long label that will most likely ellipse', value: '4-1-2', }, { label: 'Reviewing', value: '4-1-3' }, { label: 'Finalizing', value: '4-1-4' }, ], }, { label: 'Development', value: '4-2', children: [ { label: 'Working', value: '4-2-1' }, { label: 'Needs review', value: '4-2-2' }, { label: 'Reviewing', value: '4-2-3' }, { label: 'Finalizing', value: '4-2-4' }, ], }, ], }, { label: 'Finished', value: '5', children: [ { label: 'Activities', value: '5-1' }, { label: 'Finished as planned', value: '5-2' }, { label: 'Discarded requests / ideas', value: '5-3' }, { label: 'Discussed / No immediate action', value: '5-4' }, ], }, ] /** * Implementation combines [Form Field specification](https://design.planview.com/components/forms/form-field) * with [ComboboxTree specification](https://design.planview.com/components/forms/combobox-tree). * * `import { ComboboxTree } from '@planview/pv-form'` * * _Note: The form combobox extends the `ComboboxTree` from `@planview/pv-uikit`, to see more examples of component capabilities, see the [ui-kit docs](/docs/pv-uikit-comboboxtree--docs)_ * */ export default { title: 'pv-form/Components/ComboboxTree', tags: ['autodocs'], component: ComboboxTree, args: { label: 'Select lane', options: DEFAULT_OPTIONS, }, argTypes: { multiSelectable: { control: false, }, error: { control: { type: 'text' }, }, options: { control: false, }, }, parameters: { badges: ['intl'], }, } satisfies Meta type Story = StoryObj export const Default: Story = {} export const MultiSelectable: Story = { args: { defaultValue: [{ label: 'Reviewing', value: '4-1-3' }], multiSelectable: true, }, } export const WithError: Story = { args: { error: 'This lane is full', value: { label: 'Reviewing', value: '4-1-3' }, }, } export const WithWarning: Story = { args: { warning: 'This lane may not be correct', value: { label: 'Reviewing', value: '4-1-3' }, }, } export const WithIcon: Story = { args: { icon: , label: 'Sample label', }, } export const WithAsterisk: Story = { args: { label: 'Field is required', withAsterisk: true, defaultValue: { label: 'Reviewing', value: '4-1-3' }, }, } export const WithoutAsteriskAndNotClearable: Story = { args: { label: 'Pick your lane', clearable: false, defaultValue: { label: 'Reviewing', value: '4-1-3' }, }, } export const WithAsteriskAndNotClearable: Story = { args: { label: 'Pick your lane', 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: 'Reviewing', value: '4-1-3' }, }, } export const ReadOnly: Story = { args: { readOnly: true, value: { label: 'Reviewing', value: '4-1-3' }, }, }