diff --git a/packages/storybook/.storybook/preview.js b/packages/storybook/.storybook/preview.js index 99b228ab50..c9a45a56b8 100644 --- a/packages/storybook/.storybook/preview.js +++ b/packages/storybook/.storybook/preview.js @@ -105,5 +105,5 @@ configureActions({ depth: 1 }); -// Update the GUID on this line to trigger a turbosnap full rebuild: 354fdf0e-bdb4-4dd9-a6e4-21bf71c6efe6 +// Update the GUID on this line to trigger a turbosnap full rebuild: 354fdf0e-bdb4-4dd9-a6e5-21bf71c6efe6 // See https://www.chromatic.com/docs/turbosnap/#full-rebuilds diff --git a/packages/storybook/src/nimble/anchor-button/anchor-button.mdx b/packages/storybook/src/nimble/anchor-button/anchor-button.mdx index f1ec05a3ee..761ee20c88 100644 --- a/packages/storybook/src/nimble/anchor-button/anchor-button.mdx +++ b/packages/storybook/src/nimble/anchor-button/anchor-button.mdx @@ -29,6 +29,10 @@ If you want a button that triggers an action or event, use the +### Target Configuration + + + ## Styling @@ -37,10 +41,6 @@ If you want a button that triggers an action or event, use the - ## Accessibility diff --git a/packages/storybook/src/nimble/anchor-tabs/anchor-tabs.mdx b/packages/storybook/src/nimble/anchor-tabs/anchor-tabs.mdx index 9af6d97042..094d566c08 100644 --- a/packages/storybook/src/nimble/anchor-tabs/anchor-tabs.mdx +++ b/packages/storybook/src/nimble/anchor-tabs/anchor-tabs.mdx @@ -31,6 +31,10 @@ Use the child element to add new tabs to the +#### Target Configuration + + + ### Tabs Toolbar Use the child element to add a toolbar next to the tabs. @@ -44,10 +48,6 @@ Use the child element to add a toolbar next to the {/* ## Examples */} -## Target Configuration - - - ## Angular Usage In an Angular application, it is common to integrate with the router by setting `nimbleRouterLink` (rather than `href`) diff --git a/packages/storybook/src/nimble/anchor/anchor.mdx b/packages/storybook/src/nimble/anchor/anchor.mdx index 401187de3d..bdc1be6ad8 100644 --- a/packages/storybook/src/nimble/anchor/anchor.mdx +++ b/packages/storybook/src/nimble/anchor/anchor.mdx @@ -16,6 +16,10 @@ Per [W3C](https://www.w3.org/WAI/ARIA/apg/patterns/link/), an anchor/link widget +### Target Configuration + + + {/* ## Styling */} {/* ## Usage */} @@ -25,7 +29,3 @@ Per [W3C](https://www.w3.org/WAI/ARIA/apg/patterns/link/), an anchor/link widget {/* ## Accessibility */} {/* ## Resources */} - -## Target Configuration - - diff --git a/packages/storybook/src/nimble/banner/banner.mdx b/packages/storybook/src/nimble/banner/banner.mdx index 6939d6a9c8..dc39d877e6 100644 --- a/packages/storybook/src/nimble/banner/banner.mdx +++ b/packages/storybook/src/nimble/banner/banner.mdx @@ -1,5 +1,6 @@ import { Canvas, Meta, Controls, Title } from '@storybook/blocks'; import { NimbleBanner } from './banner.react'; +import ComponentApisLink from '../../docs/component-apis-link.mdx'; import { bannerGapSize } from '../../../../nimble-components/src/theme-provider/design-tokens'; import * as bannerStories from './banner.stories'; @@ -14,7 +15,11 @@ location. Multiple banners may be stacked vertically in order of age, with the n should be spaced apart using the {bannerGapSize.cssCustomProperty} design token. + +## API + + {/* ## Styling */} diff --git a/packages/storybook/src/nimble/breadcrumb/breadcrumb.mdx b/packages/storybook/src/nimble/breadcrumb/breadcrumb.mdx index e4be7375c9..0505a15cb6 100644 --- a/packages/storybook/src/nimble/breadcrumb/breadcrumb.mdx +++ b/packages/storybook/src/nimble/breadcrumb/breadcrumb.mdx @@ -1,6 +1,8 @@ import { Canvas, Meta, Stories, Controls, Title } from '@storybook/blocks'; import { NimbleBreadcrumb } from './breadcrumb.react'; import * as breadcrumbStories from './breadcrumb.stories'; +import ComponentApisLink from '../../docs/component-apis-link.mdx'; +import TargetDocs from '../patterns/anchor/target-docs.mdx'; @@ -12,8 +14,20 @@ See the [nimble-angular Readme](https://github.com/ni/nimble/blob/main/packages/ for information on using this component in Angular with RouterLink directives. <Canvas of={breadcrumbStories._standardBreadcrumb} /> + +## API + <Controls of={breadcrumbStories._standardBreadcrumb} /> -<Stories of={breadcrumbStories} /> +<ComponentApisLink /> + +### Breadcrumb Item + +<Canvas of={breadcrumbStories.breadcrumbItem} /> +<Controls of={breadcrumbStories.breadcrumbItem} /> + +#### Target Configuration + +<TargetDocs /> {/* ## Styling */} diff --git a/packages/storybook/src/nimble/breadcrumb/breadcrumb.stories.ts b/packages/storybook/src/nimble/breadcrumb/breadcrumb.stories.ts index 7b69c36000..510a7ba34b 100644 --- a/packages/storybook/src/nimble/breadcrumb/breadcrumb.stories.ts +++ b/packages/storybook/src/nimble/breadcrumb/breadcrumb.stories.ts @@ -1,35 +1,41 @@ -import type { Meta, StoryObj } from '@storybook/html'; +import type { HtmlRenderer, Meta, StoryObj } from '@storybook/html'; +import { withActions } from '@storybook/addon-actions/decorator'; import { html, repeat } from '@microsoft/fast-element'; import { breadcrumbItemTag } from '../../../../nimble-components/src/breadcrumb-item'; import { breadcrumbTag } from '../../../../nimble-components/src/breadcrumb'; import { BreadcrumbAppearance } from '../../../../nimble-components/src/breadcrumb/types'; -import { createUserSelectedThemeStory } from '../../utilities/storybook'; +import { apiCategory, appearanceDescription, createUserSelectedThemeStory } from '../../utilities/storybook'; +import { hrefDescription } from '../patterns/anchor/anchor-docs'; interface BreadcrumbArgs { options: ItemArgs[]; appearance: keyof typeof BreadcrumbAppearance; - allowNavigation: boolean; } interface ItemArgs { href?: string; - target?: string; label: string; } interface BreadcrumbItemArgs extends ItemArgs { - allowNavigation: boolean; + click: undefined; } const metadata: Meta<BreadcrumbArgs> = { title: 'Components/Breadcrumb', + decorators: [withActions<HtmlRenderer>], parameters: { - actions: {} + actions: { + handles: ['click'] + } } }; export default metadata; +const defaultHrefDescription = hrefDescription({ componentName: 'breadcrumb item', includeDisable: false }); +const itemHrefDescription = `${defaultHrefDescription} If the last breadcrumb item represents the current page it should have no \`href\` set.`; + export const _standardBreadcrumb: StoryObj<BreadcrumbArgs> = { // prettier-ignore render: createUserSelectedThemeStory(html` @@ -39,8 +45,6 @@ export const _standardBreadcrumb: StoryObj<BreadcrumbArgs> = { ${repeat(x => x.options, html<ItemArgs, BreadcrumbArgs>` <${breadcrumbItemTag} href="${x => x.href}" - target="${x => x.target}" - @click="${(_x, c) => c.parent.allowNavigation}" > ${x => x.label} </${breadcrumbItemTag}> @@ -51,14 +55,18 @@ export const _standardBreadcrumb: StoryObj<BreadcrumbArgs> = { name: 'Standard Breadcrumb', argTypes: { options: { + name: 'default', description: - 'Nest one or more `<nimble-breadcrumb-item />`s inside `<nimble-breadcrumb />`. Each can optionally set `href`, `target`, etc. ' - + 'With a standard breadcrumb containing multiple items, the last breadcrumb represents the current page (with no `href` specified, ' - + 'rendering with a bold font).' + `The \`${breadcrumbItemTag}\` elements that populate this breadcrumb. + +With a standard breadcrumb containing multiple items, the last breadcrumb represents the current page.`, + table: { category: apiCategory.slots } }, appearance: { options: Object.keys(BreadcrumbAppearance), - control: { type: 'radio' } + description: appearanceDescription({ componentName: 'breadcrumb' }), + control: { type: 'radio' }, + table: { category: apiCategory.attributes } } }, args: { @@ -75,8 +83,7 @@ export const _standardBreadcrumb: StoryObj<BreadcrumbArgs> = { label: 'Current (No Link)' } ], - appearance: 'default', - allowNavigation: false + appearance: 'default' } }; @@ -85,28 +92,30 @@ export const breadcrumbItem: StoryObj<BreadcrumbItemArgs> = { <${breadcrumbTag}> <${breadcrumbItemTag} href="${x => x.href}" - target="${x => x.target}" - @click="${x => x.allowNavigation}" > - Breadcrumb Item + ${x => x.label} </${breadcrumbItemTag}> </${breadcrumbTag}> `), argTypes: { href: { - description: - '(Optional) The URL that this breadcrumb item/ link points to. Generally, the last breadcrumb item ' - + 'representing the current page has no `href` set.' + description: itemHrefDescription, + table: { category: apiCategory.attributes } }, - target: { - description: - '(Optional) Where to display the linked URL (destination browsing context): `_self`, `_blank`, etc.', - type: 'string' + label: { + name: 'default', + description: 'The text content of the breadcrumb item.', + type: 'string', + table: { category: apiCategory.slots } + }, + click: { + description: 'Event emitted when the user activates the breadcrumb item link, for example by clicking on it or pressing Enter while focused.', + control: false, + table: { category: apiCategory.events } } }, args: { href: 'http://www.ni.com', label: 'Breadcrumb Item', - allowNavigation: false } }; diff --git a/packages/storybook/src/nimble/button/button.stories.ts b/packages/storybook/src/nimble/button/button.stories.ts index b706797ab7..14697396a9 100644 --- a/packages/storybook/src/nimble/button/button.stories.ts +++ b/packages/storybook/src/nimble/button/button.stories.ts @@ -74,7 +74,7 @@ const metadata: Meta<ButtonArgs> = { }, click: { description: - 'Fires when the button is activated by either keyboard or mouse.', + 'Event emitted when the button is activated by either keyboard or mouse.', table: { category: apiCategory.events }, control: false } diff --git a/packages/storybook/src/nimble/card-button/card-button.stories.ts b/packages/storybook/src/nimble/card-button/card-button.stories.ts index e78da078da..ce2cd1b33d 100644 --- a/packages/storybook/src/nimble/card-button/card-button.stories.ts +++ b/packages/storybook/src/nimble/card-button/card-button.stories.ts @@ -72,7 +72,7 @@ const metadata: Meta<CardButtonArgs> = { }, click: { description: - 'Fires when the card button is activated by either keyboard or mouse.', + 'Event emitted when the card button is activated by either keyboard or mouse.', table: { category: apiCategory.events }, control: false } diff --git a/packages/storybook/src/nimble/dialog/dialog.mdx b/packages/storybook/src/nimble/dialog/dialog.mdx index aa90633baa..742da58de3 100644 --- a/packages/storybook/src/nimble/dialog/dialog.mdx +++ b/packages/storybook/src/nimble/dialog/dialog.mdx @@ -1,15 +1,18 @@ import { Canvas, Meta, Controls, Title } from '@storybook/blocks'; import * as dialogStories from './dialog.stories'; +import ComponentApisLink from '../../docs/component-apis-link.mdx'; <Meta of={dialogStories} /> <Title of={dialogStories} /> A modal dialog that appears centered on top of all other windows, blocking other interaction until dismissed. -By default, the first focusable control gets focus when the dialog is opened. To focus a specific element instead, set the `autofocus` attribute on that element. - <Canvas of={dialogStories.dialog} /> + +## API + <Controls of={dialogStories.dialog} /> +<ComponentApisLink /> ## Styling @@ -38,7 +41,9 @@ nimble-dialog::part(control) { } ``` -{/* ## Usage */} +## Usage + +By default, the first focusable control gets focus when the dialog is opened. To focus a specific element instead, set the `autofocus` attribute on that element. {/* ## Examples */} diff --git a/packages/storybook/src/nimble/dialog/dialog.stories.ts b/packages/storybook/src/nimble/dialog/dialog.stories.ts index c25f53b72e..3de2033b38 100644 --- a/packages/storybook/src/nimble/dialog/dialog.stories.ts +++ b/packages/storybook/src/nimble/dialog/dialog.stories.ts @@ -4,6 +4,8 @@ import { TextField, textFieldTag } from '../../../../nimble-components/src/text- import { buttonTag } from '../../../../nimble-components/src/button'; import { checkboxTag } from '../../../../nimble-components/src/checkbox'; import { + bodyFont, + bodyFontColor, dialogLargeHeight, dialogLargeMaxHeight, dialogLargeWidth, @@ -12,8 +14,8 @@ import { dialogSmallWidth } from '../../../../nimble-components/src/theme-provider/design-tokens'; import { Dialog, dialogTag, UserDismissed } from '../../../../nimble-components/src/dialog'; -import { DialogSizeOptions, ExampleContentType } from '../../../../nimble-components/src/dialog/tests/types'; -import { createUserSelectedThemeStory } from '../../utilities/storybook'; +import { DialogSizeOptions, ExampleContentType, ExampleFooterContentType } from './types'; +import { apiCategory, createUserSelectedThemeStory, preventDismissDescription } from '../../utilities/storybook'; import { loremIpsum } from '../../utilities/lorem-ipsum'; interface DialogArgs { @@ -21,9 +23,9 @@ interface DialogArgs { subtitle: string; headerHidden: boolean; footerHidden: boolean; - includeFooterButtons: boolean; preventDismiss: boolean; content: ExampleContentType; + footer: ExampleFooterContentType; size: DialogSizeOptions; show: undefined; close: undefined; @@ -55,7 +57,7 @@ const longContent = html` const content = { [ExampleContentType.shortContent]: shortContent, - [ExampleContentType.longContent]: longContent + [ExampleContentType.longContent]: longContent, } as const; const sizeDescription = ` @@ -94,6 +96,10 @@ const metadata: Meta<DialogArgs> = { max-height:${maxHeights[x.size]}; `} } + span[slot="footer"] { + font: var(${bodyFont.cssCustomProperty}); + color: var(${bodyFontColor.cssCustomProperty}); + } </style> <${dialogTag} ${ref('dialogRef')} @@ -106,7 +112,7 @@ const metadata: Meta<DialogArgs> = { ${x => content[x.content]} ${when( - x => x.includeFooterButtons, + x => x.footer === ExampleFooterContentType.buttons, html<DialogArgs>` <${buttonTag} @click="${x => x.dialogRef.close('Back pressed')}" @@ -130,6 +136,9 @@ const metadata: Meta<DialogArgs> = { > Continue </${buttonTag}> + `, + html<DialogArgs>` + <span slot="footer">${x => (x.preventDismiss ? 'Refresh the page to close the dialog.' : 'Press Esc to close the dialog.')}</span> ` )} </${dialogTag}> @@ -147,43 +156,66 @@ const metadata: Meta<DialogArgs> = { `), argTypes: { preventDismiss: { - name: 'prevent-dismiss' + name: 'prevent-dismiss', + description: preventDismissDescription({ componentName: 'dialog' }), + table: { category: apiCategory.attributes } }, title: { description: - 'Primary text that is displayed in the header when `header-hidden` is not set. Dialogs should **always include a title** even when `header-hidden` is set. The title is used to provide an accessible name to assistive technologies regardless of the value of `header-hidden`.<br><br>The title should be specified using an `inline` element, such as a `<span>`.' + 'Primary text that is displayed in the header when `header-hidden` is not set. Dialogs should **always include a title** even when `header-hidden` is set. The title is used to provide an accessible name to assistive technologies regardless of the value of `header-hidden`.<br><br>The title should be specified using an `inline` element, such as a `<span>`.', + table: { category: apiCategory.slots } }, subtitle: { description: - 'Secondary text that is displayed in the header when `header-hidden` is not set. If a dialog has an appropriate value to set for the subtitle, it should be included even when `header-hidden` is set. If the subtitle is set, it is used with the title to provide an accessible name to assistive technologies regardless of the value of `header-hidden`.<br><br>The subtitle should be specified using an `inline` element, such as a `<span>`.' + 'Secondary text that is displayed in the header when `header-hidden` is not set. If a dialog has an appropriate value to set for the subtitle, it should be included even when `header-hidden` is set. If the subtitle is set, it is used with the title to provide an accessible name to assistive technologies regardless of the value of `header-hidden`.<br><br>The subtitle should be specified using an `inline` element, such as a `<span>`.', + table: { category: apiCategory.slots } }, headerHidden: { name: 'header-hidden', description: - 'Setting `header-hidden` hides the title and subtitle of the dialog and allows the main content of the dialog to fill the space that would otherwise be reserved for the header. A title (and optionally a subtitle) should still be provided when `header-hidden` is set to ensure the dialog has a label that can be used by assistive technologies.' + 'Setting `header-hidden` hides the title and subtitle of the dialog and allows the main content of the dialog to fill the space that would otherwise be reserved for the header. A title (and optionally a subtitle) should still be provided when `header-hidden` is set to ensure the dialog has a label that can be used by assistive technologies.', + table: { category: apiCategory.attributes } + }, footerHidden: { name: 'footer-hidden', description: - 'Setting `footer-hidden` hides the footer of the dialog and any content that has been slotted within it. Setting `footer-hidden` also allows the main content of the dialog to fill the space that would otherwise be reserved for the footer.' - }, - includeFooterButtons: { - name: 'Include footer buttons' + 'Setting `footer-hidden` hides the footer of the dialog and any content that has been slotted within it. Setting `footer-hidden` also allows the main content of the dialog to fill the space that would otherwise be reserved for the footer.', + table: { category: apiCategory.attributes } }, content: { + name: 'default', options: [ ExampleContentType.shortContent, - ExampleContentType.longContent + ExampleContentType.longContent, ], control: { type: 'radio', labels: { [ExampleContentType.shortContent]: 'Short content', - [ExampleContentType.longContent]: 'Long content' + [ExampleContentType.longContent]: 'Long content', } - } + }, + description: 'The dialog content, which can be arbitrary HTML.', + table: { category: apiCategory.slots } + }, + footer: { + options: [ + ExampleFooterContentType.text, + ExampleFooterContentType.buttons, + ], + control: { + type: 'radio', + labels: { + [ExampleFooterContentType.text]: 'Text', + [ExampleFooterContentType.buttons]: 'Buttons', + } + }, + description: 'Content like buttons which appear at the bottom of the dialog.', + table: { category: apiCategory.slots } }, size: { + name: 'Dialog sizing', description: sizeDescription, options: [ DialogSizeOptions.smallGrowable, @@ -195,17 +227,20 @@ const metadata: Meta<DialogArgs> = { [DialogSizeOptions.smallGrowable]: 'Small growable', [DialogSizeOptions.largeFixed]: 'Large fixed' } - } + }, + table: { category: apiCategory.styles } }, show: { name: 'show()', description: - 'Call this member function to open the dialog. It returns a `Promise` that is resolved when the dialog is closed. The resolved value is either the reason passed to `close(...)` or the symbol `UserDismissed` if the dialog was dismissed via the ESC key.' + 'Call this member function to open the dialog. It returns a `Promise` that is resolved when the dialog is closed. The resolved value is either the reason passed to `close(...)` or the symbol `UserDismissed` if the dialog was dismissed via the `Esc` key.', + table: { category: apiCategory.methods } }, close: { name: 'close(reason)', description: - 'Call this member function to close the dialog. It takes an optional `reason` value which can be any type. This value is returned from `show()` via a `Promise`' + 'Call this member function to close the dialog. It takes an optional `reason` value which can be any type. This value is returned from `show()` via a `Promise`.', + table: { category: apiCategory.methods } }, openAndHandleResult: { table: { @@ -218,14 +253,14 @@ const metadata: Meta<DialogArgs> = { subtitle: 'Dialog subtitle', headerHidden: false, footerHidden: false, - includeFooterButtons: true, preventDismiss: false, content: ExampleContentType.shortContent, + footer: ExampleFooterContentType.buttons, size: DialogSizeOptions.smallGrowable, openAndHandleResult: (dialogRef, textFieldRef) => { void (async () => { const reason = await dialogRef.show(); - textFieldRef.value = reason === UserDismissed ? 'ESC pressed' : reason; + textFieldRef.value = reason === UserDismissed ? 'Esc pressed' : reason; })(); } } diff --git a/packages/nimble-components/src/dialog/tests/types.ts b/packages/storybook/src/nimble/dialog/types.ts similarity index 66% rename from packages/nimble-components/src/dialog/tests/types.ts rename to packages/storybook/src/nimble/dialog/types.ts index 7c5787c420..853f20fec3 100644 --- a/packages/nimble-components/src/dialog/tests/types.ts +++ b/packages/storybook/src/nimble/dialog/types.ts @@ -5,6 +5,13 @@ export const ExampleContentType = { export type ExampleContentType = (typeof ExampleContentType)[keyof typeof ExampleContentType]; +export const ExampleFooterContentType = { + text: 'text', + buttons: 'buttons' +} as const; +export type ExampleFooterContentType = + (typeof ExampleFooterContentType)[keyof typeof ExampleFooterContentType]; + export const DialogSizeOptions = { smallGrowable: 'Small growable', largeFixed: 'Large growable' diff --git a/packages/storybook/src/nimble/drawer/drawer.mdx b/packages/storybook/src/nimble/drawer/drawer.mdx index 47694b8bda..0dd9fd2f3d 100644 --- a/packages/storybook/src/nimble/drawer/drawer.mdx +++ b/packages/storybook/src/nimble/drawer/drawer.mdx @@ -1,5 +1,6 @@ import { Canvas, Meta, Controls, Title } from '@storybook/blocks'; import * as drawerStories from './drawer.stories'; +import ComponentApisLink from '../../docs/component-apis-link.mdx'; <Meta of={drawerStories} /> <Title of={drawerStories} /> @@ -7,7 +8,11 @@ import * as drawerStories from './drawer.stories'; Specialized dialog designed to slide in from either side of the page. Typically used for a configuration pane. <Canvas of={drawerStories.drawer} /> + +## API + <Controls of={drawerStories.drawer} /> +<ComponentApisLink /> {/* ## Styling */} diff --git a/packages/storybook/src/nimble/drawer/drawer.stories.ts b/packages/storybook/src/nimble/drawer/drawer.stories.ts index e3b6c34a5d..e2ccddec8c 100644 --- a/packages/storybook/src/nimble/drawer/drawer.stories.ts +++ b/packages/storybook/src/nimble/drawer/drawer.stories.ts @@ -19,8 +19,10 @@ import { DrawerLocation } from '../../../../nimble-components/src/drawer/types'; import { DrawerWidthOptions, ExampleContentType } from '../../../../nimble-components/src/drawer/tests/types'; import { + apiCategory, createUserSelectedThemeStory, - overrideWarning + overrideWarning, + preventDismissDescription } from '../../utilities/storybook'; interface DrawerArgs { @@ -149,12 +151,14 @@ const metadata: Meta<DrawerArgs> = { argTypes: { location: { options: [DrawerLocation.left, DrawerLocation.right], - control: { type: 'radio' } + control: { type: 'radio' }, + description: 'The side of the screen from which the drawer will slide in', + table: { category: apiCategory.attributes } }, preventDismiss: { name: 'prevent-dismiss', - description: - 'A boolean attribute to configure whether or not the drawer is dismissible via the `Esc` key, or any other dismiss action that is supported in the future' + description: preventDismissDescription({ componentName: 'drawer' }), + table: { category: apiCategory.attributes } }, content: { options: [ @@ -169,9 +173,12 @@ const metadata: Meta<DrawerArgs> = { [ExampleContentType.headerContentFooter]: 'Header/Content/Footer Example' } - } + }, + description: 'The drawer content, which can be arbitrary HTML.', + table: { category: apiCategory.slots } }, width: { + name: 'Drawer width', description: widthDescription, options: [ DrawerWidthOptions.default, @@ -189,17 +196,20 @@ const metadata: Meta<DrawerArgs> = { [DrawerWidthOptions.medium500]: 'Medium - 500px', [DrawerWidthOptions.fitContent]: 'fit-content' } - } + }, + table: { category: apiCategory.styles } }, show: { name: 'show()', description: - 'Call this member function to open the drawer. It returns a `Promise` that is resolved when the drawer is closed. The resolved value is either the reason passed to `close(...)` or the symbol `UserDismissed` if the drawer was dismissed via the `Esc` key.' + 'Call this member function to open the drawer. It returns a `Promise` that is resolved when the drawer is closed. The resolved value is either the reason passed to `close(...)` or the symbol `UserDismissed` if the drawer was dismissed via the `Esc` key.', + table: { category: apiCategory.methods } }, close: { name: 'close(reason)', description: - 'Call this member function to close the drawer. It takes an optional `reason` value which can be any type. This value is returned from `show()` via a `Promise`' + 'Call this member function to close the drawer. It takes an optional `reason` value which can be any type. This value is returned from `show()` via a `Promise`.', + table: { category: apiCategory.methods } }, drawerRef: { table: { diff --git a/packages/storybook/src/nimble/icon-base/icons.mdx b/packages/storybook/src/nimble/icon-base/icons.mdx index ec28df3efc..175b42e5a9 100644 --- a/packages/storybook/src/nimble/icon-base/icons.mdx +++ b/packages/storybook/src/nimble/icon-base/icons.mdx @@ -1,6 +1,7 @@ import { Meta, Controls, Canvas, Title } from '@storybook/blocks'; import * as iconsStories from './icons.stories'; import { iconAddTag } from '../../../../nimble-components/src/icons/add'; +import ComponentApisLink from '../../docs/component-apis-link.mdx'; <Meta of={iconsStories} /> <Title of={iconsStories} /> @@ -8,7 +9,11 @@ import { iconAddTag } from '../../../../nimble-components/src/icons/add'; Nimble icons can be slotted into other components or used independently. Each icon is available as a custom element. For example, <Tag name={iconAddTag} openClose/>. <Canvas of={iconsStories.icons} /> + +## API + <Controls of={iconsStories.icons} /> +<ComponentApisLink /> {/* ## Styling */} diff --git a/packages/storybook/src/nimble/icon-base/icons.stories.ts b/packages/storybook/src/nimble/icon-base/icons.stories.ts index 05276e8f0a..63fe551a8e 100644 --- a/packages/storybook/src/nimble/icon-base/icons.stories.ts +++ b/packages/storybook/src/nimble/icon-base/icons.stories.ts @@ -13,6 +13,7 @@ import { tableColumnTextTag } from '../../../../nimble-components/src/table-colu import { IconSeverity } from '../../../../nimble-components/src/icon-base/types'; import { iconMetadata } from '../../../../nimble-components/src/icon-base/tests/icon-metadata'; import { + apiCategory, createUserSelectedThemeStory, fastParameters, overrideWarning @@ -71,7 +72,8 @@ export const icons: StoryObj<IconArgs> = { severity: { options: Object.keys(IconSeverity), control: { type: 'radio' }, - description: severityDescription + description: severityDescription, + table: { category: apiCategory.attributes } }, tableRef: { table: { diff --git a/packages/storybook/src/nimble/menu-button/menu-button.stories.ts b/packages/storybook/src/nimble/menu-button/menu-button.stories.ts index 1a28c1ab5a..fcfa2ea269 100644 --- a/packages/storybook/src/nimble/menu-button/menu-button.stories.ts +++ b/packages/storybook/src/nimble/menu-button/menu-button.stories.ts @@ -111,13 +111,13 @@ const metadata: Meta<MenuButtonArgs> = { table: { category: apiCategory.attributes } }, toggle: { - description: 'Fires after the menu button is toggled.', + description: 'Event emitted after the menu button is toggled.', table: { category: apiCategory.events }, control: false }, beforetoggle: { description: - 'Fires before the menu button is toggled. This can be used to populate the menu before it is opened.', + 'Event emitted before the menu button is toggled. This can be used to populate the menu before it is opened.', table: { category: apiCategory.events }, control: false } diff --git a/packages/storybook/src/nimble/menu/menu.mdx b/packages/storybook/src/nimble/menu/menu.mdx index 6fef9cb4c1..1533ec2ca3 100644 --- a/packages/storybook/src/nimble/menu/menu.mdx +++ b/packages/storybook/src/nimble/menu/menu.mdx @@ -38,7 +38,7 @@ Use the <Tag name={anchorMenuItemTag} /> child element to navigate to a URL when <Canvas of={menuStories.anchorMenuItem} /> <Controls of={menuStories.anchorMenuItem} /> -#### Anchor Menu Item Target Configuration +#### Target Configuration <TargetDocs /> diff --git a/packages/storybook/src/nimble/menu/menu.stories.ts b/packages/storybook/src/nimble/menu/menu.stories.ts index e4ad39ead2..c6a0c5a351 100644 --- a/packages/storybook/src/nimble/menu/menu.stories.ts +++ b/packages/storybook/src/nimble/menu/menu.stories.ts @@ -175,7 +175,7 @@ export const menuItem: StoryObj<MenuItemArgs> = { table: { category: apiCategory.attributes } }, change: { - description: 'Fires after the menu item is selected.', + description: 'Event emitted after the menu item is selected.', table: { category: apiCategory.events }, control: false } diff --git a/packages/storybook/src/nimble/rich-text-mention/users/rich-text-mention-users.stories.ts b/packages/storybook/src/nimble/rich-text-mention/users/rich-text-mention-users.stories.ts index 9dea4564c4..cdd19d725c 100644 --- a/packages/storybook/src/nimble/rich-text-mention/users/rich-text-mention-users.stories.ts +++ b/packages/storybook/src/nimble/rich-text-mention/users/rich-text-mention-users.stories.ts @@ -25,15 +25,15 @@ The object's type is \`RichTextMentionValidity\`, and it contains the following - \`missingDisplayNameValue\`: \`true\` when a mapping has no \`display-name\` value `; -const mentionUpdateEventDescription = `For the editor, This event will be fired on following action: +const mentionUpdateEventDescription = `For the editor, This event will be emitted on following action: - Whenever the \`@\` character is entered into the editor - When the user types any character after \`@\` into the editor -This fires with the \`eventData\` containing the current text that is added after the \`@\` character and before the current position of the +This emits with the \`eventData\` containing the current text that is added after the \`@\` character and before the current position of the text cursor. -For the viewer, this event will never be fired. +For the viewer, this event will never be emitted. `; const metadata: Meta = { diff --git a/packages/storybook/src/nimble/rich-text/editor/rich-text-editor.stories.ts b/packages/storybook/src/nimble/rich-text/editor/rich-text-editor.stories.ts index fddcd9ad87..f94d7dcf60 100644 --- a/packages/storybook/src/nimble/rich-text/editor/rich-text-editor.stories.ts +++ b/packages/storybook/src/nimble/rich-text/editor/rich-text-editor.stories.ts @@ -202,7 +202,7 @@ const metadata: Meta<RichTextEditorArgs> = { input: { name: 'input', description: - 'This event is fired when there is a change in the content of the editor.', + 'Event emitted when there is a change in the content of the editor.', control: false }, validity: { diff --git a/packages/storybook/src/nimble/spinner/spinner.mdx b/packages/storybook/src/nimble/spinner/spinner.mdx index ff5ef89734..629b1be1fb 100644 --- a/packages/storybook/src/nimble/spinner/spinner.mdx +++ b/packages/storybook/src/nimble/spinner/spinner.mdx @@ -1,5 +1,6 @@ import { Canvas, Meta, Controls, Title } from '@storybook/blocks'; import * as spinnerStories from './spinner.stories'; +import ComponentApisLink from '../../docs/component-apis-link.mdx'; import { spinnerTag } from '../../../../nimble-components/src/spinner'; <Meta of={spinnerStories} /> @@ -9,13 +10,16 @@ import { spinnerTag } from '../../../../nimble-components/src/spinner'; particular region of a page to represent loading progress, or an ongoing operation, of an indeterminate / unknown duration. - It has 3 sizes (64px, 32px, and 16px) and 2 appearance types (default and - accent). - <Canvas of={spinnerStories.spinner} /> + +## API + <Controls of={spinnerStories.spinner} /> +<ComponentApisLink /> + +## Styling -## Sizing +### Sizing The 64px spinner is a less commonly used size reserved for large negative empty space. Only one 64px spinner should be used on a single screen at one time. @@ -25,7 +29,7 @@ The 16px spinner is the most compact option for tight spaces such as grid cells Multiple 16px spinners can be used on a single screen at one time. -## Styling / Theme +### Appearances Use the `default` appearance and Color theme for UIs with a strong background color. Do not use the `accent` appearance with the Color theme. diff --git a/packages/storybook/src/nimble/spinner/spinner.stories.ts b/packages/storybook/src/nimble/spinner/spinner.stories.ts index 6b07a709ac..a97a346e9f 100644 --- a/packages/storybook/src/nimble/spinner/spinner.stories.ts +++ b/packages/storybook/src/nimble/spinner/spinner.stories.ts @@ -13,7 +13,7 @@ import { spinnerTag } from '../../../../nimble-components/src/spinner'; import { SpinnerAppearance } from '../../../../nimble-components/src/spinner/types'; import { isChromatic } from '../../utilities/isChromatic'; -import { createUserSelectedThemeStory } from '../../utilities/storybook'; +import { apiCategory, createUserSelectedThemeStory } from '../../utilities/storybook'; const spinnerSize = { small: null, @@ -31,6 +31,7 @@ const metadata: Meta<SpinnerArgs> = { parameters: {}, argTypes: { size: { + name: 'Spinner sizing', description: '<p>Size of the spinner component.</p><details><summary>Usage details</summary>To customize its size, set its CSS ' + '<span style="font-family: monospace;">height</span> to a design token, and its width will automatically match its height. Each size will also require minimum pixel margins.<br/><ul>' @@ -53,7 +54,7 @@ const metadata: Meta<SpinnerArgs> = { Requires 64px minimum margins. </li></ul></details>`, options: Object.keys(spinnerSize), - table: { defaultValue: { summary: 'Small (16x16)' } }, + table: { category: apiCategory.styles }, control: { type: 'radio', labels: { @@ -81,7 +82,8 @@ const metadata: Meta<SpinnerArgs> = { + `<li>For appearance \`accent\`:<br/> Use for promoting NI branding and adding a splash of color in a monochromatic setting. Common places to use is home screens, licensing, dialogs and any instances where there will not be a conflict with green representing status.<br/> The green version is not intended to represent “Good” or “Success”. - </li></ul></details>` + </li></ul></details>`, + table: { category: apiCategory.attributes } } }, // Disable animation in Chromatic because it intermittently causes shapshot differences diff --git a/packages/storybook/src/nimble/table-column/anchor/table-column-anchor.mdx b/packages/storybook/src/nimble/table-column/anchor/table-column-anchor.mdx index bc4a08c8e1..114aada9ff 100644 --- a/packages/storybook/src/nimble/table-column/anchor/table-column-anchor.mdx +++ b/packages/storybook/src/nimble/table-column/anchor/table-column-anchor.mdx @@ -10,8 +10,15 @@ import { tableTag } from '../../../../../nimble-components/src/table'; The <Tag name={tableColumnAnchorTag}/> column is used to display string fields as links or text in the <Tag name={tableTag}/>. If a row provides an href for a link, that cell will display a link, otherwise it will display plain text. <Canvas of={tableColumnAnchorStories.anchorColumn} /> + +## API + <Controls of={tableColumnAnchorStories.anchorColumn} /> +### Target Configuration + +<TargetDocs /> + ## Usage ### Best Practices @@ -22,10 +29,6 @@ The <Tag name={tableColumnAnchorTag}/> column is used to display string fields a - If a label is not available or known for a url, the url itself may be explicitly provided for the label to ensure each distinct url has a distinct label. As grouping is done by label value, this prevents unrelated URLs from being grouped together. - For records without a url, the label may also be omitted. All omitted labels should consistently use `null`, `undefined`, or empty string but not a combination of those values. -### Target Configuration - -<TargetDocs /> - ### Angular Usage In an Angular app, you can configure a callback to intercept clicks so that you may invoke the router to perform the navigation instead of the default handler: diff --git a/packages/storybook/src/nimble/tabs/tabs.stories.ts b/packages/storybook/src/nimble/tabs/tabs.stories.ts index d665191de2..0f438969c7 100644 --- a/packages/storybook/src/nimble/tabs/tabs.stories.ts +++ b/packages/storybook/src/nimble/tabs/tabs.stories.ts @@ -66,7 +66,7 @@ export const tabs: StoryObj<TabsArgs> = { table: { category: apiCategory.slots } }, change: { - description: 'Fires when the active tab is changed', + description: 'Event emitted when the active tab is changed', control: false, table: { category: apiCategory.events } } diff --git a/packages/storybook/src/nimble/theme-provider/theme-provider.mdx b/packages/storybook/src/nimble/theme-provider/theme-provider.mdx index 4161adc422..f45539697c 100644 --- a/packages/storybook/src/nimble/theme-provider/theme-provider.mdx +++ b/packages/storybook/src/nimble/theme-provider/theme-provider.mdx @@ -1,5 +1,6 @@ import { Controls, Canvas, Meta, Title } from '@storybook/blocks'; import { themeProvider } from './theme-provider.stories'; +import ComponentApisLink from '../../docs/component-apis-link.mdx'; <Meta title="Tokens/Theme Provider" /> <Title>Theme Provider @@ -7,4 +8,8 @@ import { themeProvider } from './theme-provider.stories'; The theme provider element allows configuring certain token values for the contained HTML tree. + +## API + + diff --git a/packages/storybook/src/nimble/theme-provider/theme-provider.stories.ts b/packages/storybook/src/nimble/theme-provider/theme-provider.stories.ts index 336817b0e5..8e80c0bcd1 100644 --- a/packages/storybook/src/nimble/theme-provider/theme-provider.stories.ts +++ b/packages/storybook/src/nimble/theme-provider/theme-provider.stories.ts @@ -9,7 +9,7 @@ import { type SharedTableArgs, sharedTableArgs } from '../table-column/base/table-column-stories-utils'; -import { createUserSelectedThemeStory } from '../../utilities/storybook'; +import { apiCategory, createUserSelectedThemeStory } from '../../utilities/storybook'; const simpleData = [ { @@ -88,7 +88,8 @@ export const themeProvider: StoryObj = { summary: '"light"' }, options: Object.keys(Theme), - control: { type: 'radio' } + control: { type: 'radio' }, + table: { category: apiCategory.attributes } }, lang: { description: langDescription, @@ -97,7 +98,8 @@ export const themeProvider: StoryObj = { '`lang` of the document element if set, otherwise "en-US".' }, options: ['en-US', 'fr-FR', 'de-DE'], - control: { type: 'radio' } + control: { type: 'radio' }, + table: { category: apiCategory.attributes } }, direction: { description: @@ -106,7 +108,8 @@ export const themeProvider: StoryObj = { summary: '"ltr"' }, options: Object.keys(Direction), - control: { type: 'radio' } + control: { type: 'radio' }, + table: { category: apiCategory.attributes } } }, args: { diff --git a/packages/storybook/src/nimble/toggle-button/toggle-button.stories.ts b/packages/storybook/src/nimble/toggle-button/toggle-button.stories.ts index 64ca61d926..27d39ca540 100644 --- a/packages/storybook/src/nimble/toggle-button/toggle-button.stories.ts +++ b/packages/storybook/src/nimble/toggle-button/toggle-button.stories.ts @@ -82,7 +82,7 @@ const metadata: Meta = { table: { category: apiCategory.slots } }, change: { - description: 'Fires when the toggle button is pressed via mouse or keyboard.', + description: 'Event emitted when the toggle button is pressed via mouse or keyboard.', table: { category: apiCategory.events }, control: false } diff --git a/packages/storybook/src/nimble/toolbar/toolbar.mdx b/packages/storybook/src/nimble/toolbar/toolbar.mdx index b42fa79ccc..3d05edaadf 100644 --- a/packages/storybook/src/nimble/toolbar/toolbar.mdx +++ b/packages/storybook/src/nimble/toolbar/toolbar.mdx @@ -1,6 +1,7 @@ -import { Canvas, Meta, Title } from '@storybook/blocks'; +import { Canvas, Controls, Meta, Title } from '@storybook/blocks'; import { NimbleToolbar } from './toolbar.react'; import * as toolbarStories from './toolbar.stories'; +import ComponentApisLink from '../../docs/component-apis-link.mdx'; @@ -22,6 +23,11 @@ nimble-toolbar::part(positioning-region) { <Canvas of={toolbarStories.toolbar} /> +## API + +<Controls of={toolbarStories.toolbar} /> + + {/* ## Styling */} {/* ## Usage */} diff --git a/packages/storybook/src/nimble/toolbar/toolbar.stories.ts b/packages/storybook/src/nimble/toolbar/toolbar.stories.ts index 5957d921e3..639593cc88 100644 --- a/packages/storybook/src/nimble/toolbar/toolbar.stories.ts +++ b/packages/storybook/src/nimble/toolbar/toolbar.stories.ts @@ -7,9 +7,14 @@ import { iconFilterTag } from '../../../../nimble-components/src/icons/filter'; import { iconPencilTag } from '../../../../nimble-components/src/icons/pencil'; import { iconTrashTag } from '../../../../nimble-components/src/icons/trash'; import { toolbarTag } from '../../../../nimble-components/src/toolbar'; -import { createUserSelectedThemeStory } from '../../utilities/storybook'; +import { apiCategory, createUserSelectedThemeStory } from '../../utilities/storybook'; -const metadata: Meta = { +interface ToolbarArgs { + start: undefined; + end: undefined; +} + +const metadata: Meta<ToolbarArgs> = { title: 'Components/Toolbar', parameters: {}, // prettier-ignore @@ -37,7 +42,19 @@ const metadata: Meta = { Filter </${buttonTag}> </${toolbarTag}> - `) + `), + argTypes: { + start: { + description: 'Content which will be positioned at the start of the toolbar.', + control: false, + table: { category: apiCategory.slots } + }, + end: { + description: 'Content which will be positioned at the end of the toolbar.', + control: false, + table: { category: apiCategory.slots } + }, + } }; export default metadata; diff --git a/packages/storybook/src/nimble/tree-view/tree-view.mdx b/packages/storybook/src/nimble/tree-view/tree-view.mdx index c2ae905d1f..8b6865d83b 100644 --- a/packages/storybook/src/nimble/tree-view/tree-view.mdx +++ b/packages/storybook/src/nimble/tree-view/tree-view.mdx @@ -1,6 +1,7 @@ import { Controls, Canvas, Meta, Title } from '@storybook/blocks'; import TargetDocs from '../patterns/anchor/target-docs.mdx'; import * as treeViewStories from './tree-view.stories'; +import ComponentApisLink from '../../docs/component-apis-link.mdx'; import { treeViewTag } from '../../../../nimble-components/src/tree-view'; import { treeItemTag } from '../../../../nimble-components/src/tree-item'; import { anchorTreeItemTag } from '../../../../nimble-components/src/anchor-tree-item'; @@ -17,26 +18,37 @@ expanded to reveal the contents of the folder, which may be files, folders, or b The <Tag name={treeViewTag}/> supports standard <Tag name={treeItemTag}/> and <Tag name={anchorTreeItemTag}/>, which navigate to a url upon activation. Both types of tree items support icons as slotted content. +<Canvas of={treeViewStories.multipleTreeItems} /> + +## API + +<Controls of={treeViewStories.multipleTreeItems} /> +<ComponentApisLink /> + +### Tree Item + +Use a <Tag name={treeItemTag} /> child element if you want a tree item that calls a callback, has a value, and/or has child items. + <Canvas of={treeViewStories.treeItem} /> <Controls of={treeViewStories.treeItem} /> -{/* ## Styling */} +### Anchor Tree Item -{/* ## Usage */} +Use a <Tag name={anchorTreeItemTag} /> child element to navigate to a URL when the item is activated. -{/* ## Examples */} +<Canvas of={treeViewStories.anchorTreeItem} /> +<Controls of={treeViewStories.anchorTreeItem} /> -### Child Elements +#### Anchor Tree Item Target Configuration -- <Tag name={treeItemTag} /> - Use a this child element if you want a tree item - that calls a callback, has a value, and/or has child items. -- <Tag name={anchorTreeItemTag} /> - Use this child element to navigate to a URL - when the item is activated. +<TargetDocs /> -## Accessibility +{/* ## Styling */} -### Anchor Tree Item Target Configuration +{/* ## Usage */} -<TargetDocs /> +{/* ## Examples */} + +{/* ## Accessibility */} {/* ## Resources */} diff --git a/packages/storybook/src/nimble/tree-view/tree-view.stories.ts b/packages/storybook/src/nimble/tree-view/tree-view.stories.ts index 6f99966b78..e12ef8e9b3 100644 --- a/packages/storybook/src/nimble/tree-view/tree-view.stories.ts +++ b/packages/storybook/src/nimble/tree-view/tree-view.stories.ts @@ -7,12 +7,14 @@ import { treeItemTag } from '../../../../nimble-components/src/tree-item'; import { anchorTreeItemTag } from '../../../../nimble-components/src/anchor-tree-item'; import { treeViewTag } from '../../../../nimble-components/src/tree-view'; import { TreeViewSelectionMode } from '../../../../nimble-components/src/tree-view/types'; -import { createUserSelectedThemeStory } from '../../utilities/storybook'; +import { apiCategory, createUserSelectedThemeStory, disabledDescription, iconDescription, textContentDescription } from '../../utilities/storybook'; import { hrefDescription } from '../patterns/anchor/anchor-docs'; interface TreeArgs { selectionMode: TreeViewSelectionMode; options: ItemArgs[]; + expandedChange: undefined; + selectedChange: undefined; } interface ItemArgs { @@ -33,9 +35,9 @@ interface AnchorItemArgs { } const selectionModeDescription = ` -<li>All: all items in the tree are selectable through user interaction</li> -<li>Leaves only: only the leaf items in the tree are selectable through user interaction</li> -<li>None: no items in the tree are selectable through user interaction</li> +<li>all: All items in the tree are selectable through user interaction</li> +<li>leaves-only: Only the leaf items in the tree are selectable through user interaction</li> +<li>none: No items in the tree are selectable through user interaction</li> <br> Note: Changing the selection mode does not affect which items can be selected programmatically. `; @@ -47,11 +49,6 @@ const metadata: Meta<TreeArgs> = { actions: { handles: ['expanded-change', 'selected-change'] } - }, - argTypes: { - selectionMode: { - description: selectionModeDescription - } } }; @@ -66,10 +63,32 @@ export const treeItem: StoryObj<ItemArgs> = { } }, argTypes: { + label: { + name: 'default', + description: `${textContentDescription({ componentName: 'tree item' })} Tree items can also contain child tree items to establish hierarchy.`, + table: { category: apiCategory.slots } + }, + value: { + description: 'A value for this tree item that can be used to identify the item when handling tree events.', + table: { category: apiCategory.attributes } + }, + disabled: { + description: disabledDescription({ componentName: 'tree item' }), + table: { category: apiCategory.attributes } + }, icon: { - description: - 'When including an icon, set `slot="start"` on the icon to ensure proper styling.' - } + name: 'start', + description: iconDescription, + table: { category: apiCategory.slots } + }, + selected: { + description: 'Whether this item is selected.', + table: { category: apiCategory.attributes } + }, + expanded: { + description: 'Whether this item is expanded.', + table: { category: apiCategory.attributes } + }, }, // prettier-ignore render: createUserSelectedThemeStory(html` @@ -97,22 +116,34 @@ export const anchorTreeItem: StoryObj<AnchorItemArgs> = { parameters: { docs: { description: { - story: 'Use a `nimble-anchor-tree-item` to navigate to a URL from a `nimble-tree-view`. If you want a tree item that can have a value and/or child items, use a `nimble-tree-item` instead.' + story: `Use a \`${anchorTreeItemTag}\` to navigate to a URL from a \`${treeViewTag}\`. If you want a tree item that can have a value and/or child items, use a \`${treeItemTag}\` instead.` } } }, argTypes: { - icon: { - description: - 'When including an icon, set `slot="start"` on the icon to ensure proper styling.' + label: { + name: 'default', + description: textContentDescription({ componentName: 'anchor tree item' }), + table: { category: apiCategory.slots } + }, + href: { + description: hrefDescription({ componentName: 'anchor tree item', includeDisable: false }), + table: { category: apiCategory.attributes } + }, + disabled: { + description: disabledDescription({ componentName: 'tree item' }), + table: { category: apiCategory.attributes } }, selected: { description: - 'Cannot be selected interactively, as click/Enter causes navigation.' + 'Set this attribute programmatically to render the item as selected. It cannot be selected interactively, as click/Enter causes navigation.', + table: { category: apiCategory.attributes } + }, + icon: { + name: 'start', + description: iconDescription, + table: { category: apiCategory.slots } }, - href: { - description: hrefDescription({ componentName: 'anchor tree item', includeDisable: false }) - } }, // prettier-ignore render: createUserSelectedThemeStory(html` @@ -135,9 +166,29 @@ export const anchorTreeItem: StoryObj<AnchorItemArgs> = { export const multipleTreeItems: StoryObj<TreeArgs> = { argTypes: { selectionMode: { + name: 'selection-mode', options: Object.values(TreeViewSelectionMode), - control: { type: 'radio' } - } + control: { type: 'radio' }, + description: selectionModeDescription, + table: { category: apiCategory.attributes } + + }, + options: { + name: 'default', + description: + `One or more \`${treeItemTag}\` or \`${anchorTreeItemTag}\` elements which populate the tree. Nest items to establish tree hierarchy.`, + table: { category: apiCategory.slots } + }, + expandedChange: { + name: 'expanded-change', + description: 'Event emitted when an item is expanded or collapsed.', + table: { category: apiCategory.events } + }, + selectedChange: { + name: 'selected-change', + description: 'Event emitted when an item is selected or deselected.', + table: { category: apiCategory.events } + }, }, // prettier-ignore render: createUserSelectedThemeStory(html` diff --git a/packages/storybook/src/nimble/wafer-map/wafer-map.stories.ts b/packages/storybook/src/nimble/wafer-map/wafer-map.stories.ts index b0cedf6337..19d8ce2670 100644 --- a/packages/storybook/src/nimble/wafer-map/wafer-map.stories.ts +++ b/packages/storybook/src/nimble/wafer-map/wafer-map.stories.ts @@ -382,7 +382,7 @@ const metadata: Meta<WaferMapArgs> = { dieHover: { name: 'die-hover', description: - 'The event is fired whenever the mouse enters or leaves a die. In the event data, `detail.currentDie` will be set to the `WaferMapDie` element of the `dies` array that is being hovered or `undefined` if the mouse is leaving a die.' + 'Event emitted whenever the mouse enters or leaves a die. In the event data, `detail.currentDie` will be set to the `WaferMapDie` element of the `dies` array that is being hovered or `undefined` if the mouse is leaving a die.' }, validity: { description: `Readonly object of boolean values that represents the validity states that the wafer map's configuration can be in. diff --git a/packages/storybook/src/utilities/storybook.ts b/packages/storybook/src/utilities/storybook.ts index 5e94feaff8..733b14a251 100644 --- a/packages/storybook/src/utilities/storybook.ts +++ b/packages/storybook/src/utilities/storybook.ts @@ -169,7 +169,8 @@ export const apiCategory = { localizableLabels: 'Localizable Labels', methods: 'Methods', nonAttributeProperties: 'Properties', - slots: 'Slots' + slots: 'Slots', + styles: 'Styles' } as const; export const appearanceDescription = (options: { componentName: string }): string => `This attribute affects the appearance of the ${options.componentName}.`; @@ -184,3 +185,5 @@ export const errorVisibleDescription = 'When set to `true`, the `error-text` mes export const dropdownPositionDescription = (options: { componentName: string }): string => `Controls the position of the dropdown relative to the ${options.componentName}.`; export const optionsDescription = `The \`${listOptionTag}\` items for the user to select from.`; + +export const preventDismissDescription = (options: { componentName: string }): string => `Prevents the \`Esc\` key from closing the ${options.componentName}.`;