import * as React from 'react' import type { StoryFn, Meta } from '@storybook/react-webpack5' import { Toolbar, ToolbarButtonEmpty, ToolbarSectionLeft, ToolbarSectionRight, } from '..' import { Board, Filter } from '@planview/pv-icons' import { ListItem } from '@planview/pv-uikit' import type { ToolbarItemProps } from '.' import { ToolbarItem, ToolbarItemView, ToolbarItemCollapsedView } from '.' export default { title: 'pv-toolbar/Generic/ToolbarItem', tags: ['autodocs'], component: ToolbarItem, argTypes: { onHit: { action: 'hit button', table: { disable: true } }, }, parameters: { controls: { disabled: true, hideNoControlsWarning: true }, docs: { description: { component: ` Generic component to use for custom components in Toolbar. ### Anatomy: \`\`\`typescript > {/*----- The representation of the component when NOT collapsed into more menu ---*/} {/*----- The representation of the component when collapsed into the more menu. Optional ---*/} \`\`\` ### Usage: \`\`\`typescript import { ToolbarItem, ToolbarItemView, ToolbarItemCollapsedView } from '@planview/pv-toolbar' > {( ref, { toolbarItemProps: { focused: _focused, ...toolbarItemProps }, disabled, } ) => ( )} onHit('hit custom button tablet portrait')} label="tablet portrait" /> \`\`\` `, }, }, }, } satisfies Meta void }> type StoryToolbarItem = React.ComponentProps & { onHit: (msg: string) => void } export const Default: StoryFn = ({ onHit }) => ( onHit('filter')} icon={} tooltip="Filter" aria-label="Filter" /> > {( ref, { toolbarItemProps: { focused: _focused, ...toolbarItemProps }, disabled, } ) => ( )} onHit('hit custom button phone')} label="phone (this should never be shown" /> > {( ref, { showLabels, toolbarItemProps: { focused: _focused, ...toolbarItemProps }, disabled, } ) => ( )} onHit('hit custom button tablet portrait') } label="tablet portrait" /> > {( ref, { showLabels, toolbarItemProps: { focused: _focused, ...toolbarItemProps }, disabled, } ) => ( )} onHit('hit custom button desktop')} label="desktop" /> ) Default.storyName = 'ToolbarItem' export const NoCollapsedItem: StoryFn = ({ onHit }) => ( > {( ref, { toolbarItemProps: { focused: _focused, ...toolbarItemProps }, disabled, } ) => ( )} > {( ref, { showLabels, toolbarItemProps: { focused: _focused, ...toolbarItemProps }, disabled, } ) => ( )} > {( ref, { showLabels, toolbarItemProps: { focused: _focused, ...toolbarItemProps }, disabled, } ) => ( )} )