From 257fefa28c5da5c7809ba8d39fe291085f438527 Mon Sep 17 00:00:00 2001 From: Jeff Smith <37851214+eljefe223@users.noreply.github.com> Date: Fri, 27 Sep 2024 17:32:30 -0700 Subject: [PATCH] fix: stories tabs to toggle button (#32938) --- .../accordion-item/accordion-item.stories.ts | 2 +- .../anchor-button/anchor-button.stories.ts | 2 +- .../src/avatar/avatar.stories.ts | 2 +- .../web-components/src/badge/badge.stories.ts | 2 +- .../src/button/button.stories.ts | 2 +- .../src/checkbox/checkbox.stories.ts | 2 +- .../compound-button.stories.ts | 2 +- .../counter-badge/counter-badge.stories.ts | 2 +- .../src/dialog-body/dialog-body.stories.ts | 2 +- .../src/dialog/dialog.stories.ts | 8 +- .../src/divider/divider.stories.ts | 2 +- .../src/drawer/drawer.stories.ts | 2 +- .../web-components/src/field/field.stories.ts | 2 +- .../web-components/src/helpers.stories.ts | 7 +- .../web-components/src/image/image.stories.ts | 2 +- .../web-components/src/label/label.stories.ts | 2 +- .../web-components/src/link/link.stories.ts | 2 +- .../src/menu-button/menu-button.stories.ts | 2 +- .../src/menu-list/menu-list.stories.ts | 2 +- .../web-components/src/menu/menu.stories.ts | 2 +- .../src/message-bar/message-bar.stories.ts | 2 +- .../src/progress-bar/progress-bar.stories.ts | 2 +- .../src/radio-group/radio-group.stories.ts | 2 +- .../web-components/src/radio/radio.stories.ts | 2 +- .../rating-display/rating-display.stories.ts | 2 +- .../src/slider/slider.stories.ts | 2 +- .../src/spinner/spinner.stories.ts | 2 +- .../src/switch/switch.stories.ts | 2 +- .../src/tablist/tablist.stories.ts | 317 +++++-------- .../web-components/src/tabs/tabs.stories.ts | 125 ++--- .../src/text-input/text-input.spec.ts | 2 +- .../src/text-input/text-input.stories.ts | 411 ++++++++-------- .../web-components/src/text/text.stories.ts | 313 +++++++------ .../src/textarea/textarea.stories.ts | 439 ++++++++++-------- .../toggle-button/toggle-button.stories.ts | 256 ++++++---- 35 files changed, 1042 insertions(+), 888 deletions(-) diff --git a/packages/web-components/src/accordion-item/accordion-item.stories.ts b/packages/web-components/src/accordion-item/accordion-item.stories.ts index 7c0b47a37ebb42..c8a88557a70dfb 100644 --- a/packages/web-components/src/accordion-item/accordion-item.stories.ts +++ b/packages/web-components/src/accordion-item/accordion-item.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { AccordionItem as FluentAccordionItem } from './accordion-item.js'; import { AccordionItemMarkerPosition, AccordionItemSize } from './accordion-item.options.js'; diff --git a/packages/web-components/src/anchor-button/anchor-button.stories.ts b/packages/web-components/src/anchor-button/anchor-button.stories.ts index 6ac3fbfc1f93bc..58a05b08ed6c59 100644 --- a/packages/web-components/src/anchor-button/anchor-button.stories.ts +++ b/packages/web-components/src/anchor-button/anchor-button.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { AnchorButton as FluentAnchorButton } from './anchor-button.js'; import { AnchorButtonAppearance, AnchorButtonShape, AnchorButtonSize, AnchorTarget } from './anchor-button.options.js'; diff --git a/packages/web-components/src/avatar/avatar.stories.ts b/packages/web-components/src/avatar/avatar.stories.ts index 1eac4803864b38..20f842e677c4b8 100644 --- a/packages/web-components/src/avatar/avatar.stories.ts +++ b/packages/web-components/src/avatar/avatar.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Avatar as FluentAvatar } from './avatar.js'; import { AvatarActive, AvatarAppearance, AvatarColor, AvatarShape, AvatarSize } from './avatar.options.js'; diff --git a/packages/web-components/src/badge/badge.stories.ts b/packages/web-components/src/badge/badge.stories.ts index b6a7917ecababa..f9a1a27b7c4ba0 100644 --- a/packages/web-components/src/badge/badge.stories.ts +++ b/packages/web-components/src/badge/badge.stories.ts @@ -1,5 +1,5 @@ import { html, when } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Badge as FluentBadge } from './badge.js'; import { BadgeAppearance, BadgeColor, BadgeShape, BadgeSize } from './badge.options.js'; diff --git a/packages/web-components/src/button/button.stories.ts b/packages/web-components/src/button/button.stories.ts index 39ab625e116f56..9b18ae1a84852a 100644 --- a/packages/web-components/src/button/button.stories.ts +++ b/packages/web-components/src/button/button.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Button as FluentButton } from './button.js'; import { ButtonAppearance, ButtonShape, ButtonSize, ButtonType } from './button.options.js'; diff --git a/packages/web-components/src/checkbox/checkbox.stories.ts b/packages/web-components/src/checkbox/checkbox.stories.ts index 86b989cb504957..f17debf1415376 100644 --- a/packages/web-components/src/checkbox/checkbox.stories.ts +++ b/packages/web-components/src/checkbox/checkbox.stories.ts @@ -1,7 +1,7 @@ import { html, repeat } from '@microsoft/fast-element'; import { uniqueId } from '@microsoft/fast-web-utilities'; import { LabelPosition, ValidationFlags } from '../field/field.options.js'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import { Checkbox as FluentCheckbox } from './checkbox.js'; import { CheckboxShape, CheckboxSize } from './checkbox.options.js'; diff --git a/packages/web-components/src/compound-button/compound-button.stories.ts b/packages/web-components/src/compound-button/compound-button.stories.ts index 212ef9451c7009..c45f87c77a8191 100644 --- a/packages/web-components/src/compound-button/compound-button.stories.ts +++ b/packages/web-components/src/compound-button/compound-button.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { CompoundButton as FluentCompoundButton } from './compound-button.js'; import { CompoundButtonAppearance, CompoundButtonShape, CompoundButtonSize } from './compound-button.options.js'; diff --git a/packages/web-components/src/counter-badge/counter-badge.stories.ts b/packages/web-components/src/counter-badge/counter-badge.stories.ts index 906cef28b8c7b5..136ce5892d3165 100644 --- a/packages/web-components/src/counter-badge/counter-badge.stories.ts +++ b/packages/web-components/src/counter-badge/counter-badge.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { CounterBadge as FluentCounterBadge } from './counter-badge.js'; import { CounterBadgeAppearance, diff --git a/packages/web-components/src/dialog-body/dialog-body.stories.ts b/packages/web-components/src/dialog-body/dialog-body.stories.ts index d17e4ed835bb87..ef5d8a17cd8a70 100644 --- a/packages/web-components/src/dialog-body/dialog-body.stories.ts +++ b/packages/web-components/src/dialog-body/dialog-body.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { DialogBody as FluentDialogBody } from './dialog-body.js'; type Story = StoryObj; diff --git a/packages/web-components/src/dialog/dialog.stories.ts b/packages/web-components/src/dialog/dialog.stories.ts index cbf899b1055d51..a4fb81470c6620 100644 --- a/packages/web-components/src/dialog/dialog.stories.ts +++ b/packages/web-components/src/dialog/dialog.stories.ts @@ -1,12 +1,6 @@ import { css, html, ref } from '@microsoft/fast-element'; import type { DialogBody as FluentDialogBody } from '../dialog-body/dialog-body.js'; -import { - generateImage, - type NewMeta as Meta, - renderComponent, - type StoryArgs, - type StoryObj, -} from '../helpers.stories.js'; +import { generateImage, Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import { definition } from './dialog.definition.js'; import type { Dialog as FluentDialog } from './dialog.js'; import { DialogType } from './dialog.options.js'; diff --git a/packages/web-components/src/divider/divider.stories.ts b/packages/web-components/src/divider/divider.stories.ts index 16950f3e37c4ae..068e70e6aed386 100644 --- a/packages/web-components/src/divider/divider.stories.ts +++ b/packages/web-components/src/divider/divider.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Divider as FluentDivider } from './divider.js'; import { DividerAlignContent, DividerAppearance, DividerOrientation, DividerRole } from './divider.options.js'; diff --git a/packages/web-components/src/drawer/drawer.stories.ts b/packages/web-components/src/drawer/drawer.stories.ts index f64215830d0fc6..260e400e8907d8 100644 --- a/packages/web-components/src/drawer/drawer.stories.ts +++ b/packages/web-components/src/drawer/drawer.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Drawer as FluentDrawer } from './drawer.js'; import { DrawerPosition, DrawerSize, DrawerType } from './drawer.options.js'; diff --git a/packages/web-components/src/field/field.stories.ts b/packages/web-components/src/field/field.stories.ts index 446deff8d06d26..09450667706438 100644 --- a/packages/web-components/src/field/field.stories.ts +++ b/packages/web-components/src/field/field.stories.ts @@ -1,6 +1,6 @@ import { html, repeat } from '@microsoft/fast-element'; import { uniqueId } from '@microsoft/fast-web-utilities'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import { colorStatusDangerForeground1, colorStatusSuccessBackground3 } from '../theme/design-tokens.js'; import type { TextInput as FluentTextInput } from '../text-input/text-input.js'; import type { Field as FluentField } from './field.js'; diff --git a/packages/web-components/src/helpers.stories.ts b/packages/web-components/src/helpers.stories.ts index de802329b5f054..c885723594b95d 100644 --- a/packages/web-components/src/helpers.stories.ts +++ b/packages/web-components/src/helpers.stories.ts @@ -24,11 +24,6 @@ export declare interface FASTComponentsRenderer extends Renderer { storyResult: string | Node | DocumentFragment | ElementViewTemplate; } -/** - * Metadata to configure the stories for a component. - */ -export declare type NewMeta = ComponentAnnotations>; - /** * A helper that returns a function to bind a Storybook story to a ViewTemplate. */ @@ -40,7 +35,7 @@ export type FASTFramework = Renderer & { /** * Metadata to configure the stories for a component. */ -export type Meta = ComponentAnnotations>; +export declare type Meta = ComponentAnnotations>; /** * Story object that represents a CSFv3 component example. diff --git a/packages/web-components/src/image/image.stories.ts b/packages/web-components/src/image/image.stories.ts index b7d9c2fd9d1f4f..b6e1586bedf1dd 100644 --- a/packages/web-components/src/image/image.stories.ts +++ b/packages/web-components/src/image/image.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Image as FluentImage } from './image.js'; import { ImageFit, ImageShape } from './image.options.js'; diff --git a/packages/web-components/src/label/label.stories.ts b/packages/web-components/src/label/label.stories.ts index be4744735fd24f..a08c6b1a21f416 100644 --- a/packages/web-components/src/label/label.stories.ts +++ b/packages/web-components/src/label/label.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Label as FluentLabel } from './label.js'; import { LabelSize, LabelWeight } from './label.options.js'; diff --git a/packages/web-components/src/link/link.stories.ts b/packages/web-components/src/link/link.stories.ts index 1d408d52e0a05c..e1a6902bb50e0a 100644 --- a/packages/web-components/src/link/link.stories.ts +++ b/packages/web-components/src/link/link.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import { AnchorTarget } from '../anchor-button/anchor-button.options.js'; import type { Link as FluentLink } from './link.js'; import { LinkAppearance } from './link.options.js'; diff --git a/packages/web-components/src/menu-button/menu-button.stories.ts b/packages/web-components/src/menu-button/menu-button.stories.ts index 6361977a396d5c..0b2a9c87bf47d9 100644 --- a/packages/web-components/src/menu-button/menu-button.stories.ts +++ b/packages/web-components/src/menu-button/menu-button.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { MenuButton as FluentMenuButton } from './menu-button.js'; import { MenuButtonAppearance, MenuButtonShape, MenuButtonSize } from './menu-button.options.js'; diff --git a/packages/web-components/src/menu-list/menu-list.stories.ts b/packages/web-components/src/menu-list/menu-list.stories.ts index 425db6c5a82499..2a43ed5aa3260e 100644 --- a/packages/web-components/src/menu-list/menu-list.stories.ts +++ b/packages/web-components/src/menu-list/menu-list.stories.ts @@ -1,5 +1,5 @@ import { html, repeat } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import { type MenuItem as FluentMenuItem, MenuItemRole } from '../menu-item/menu-item.js'; import type { MenuList as FluentMenuList } from './menu-list.js'; diff --git a/packages/web-components/src/menu/menu.stories.ts b/packages/web-components/src/menu/menu.stories.ts index 3aaf3fe813c622..85d68262adb084 100644 --- a/packages/web-components/src/menu/menu.stories.ts +++ b/packages/web-components/src/menu/menu.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Menu as FluentMenu } from './menu.js'; type Story = StoryObj; diff --git a/packages/web-components/src/message-bar/message-bar.stories.ts b/packages/web-components/src/message-bar/message-bar.stories.ts index 66e30be20f5a08..b198bcfd661096 100644 --- a/packages/web-components/src/message-bar/message-bar.stories.ts +++ b/packages/web-components/src/message-bar/message-bar.stories.ts @@ -1,5 +1,5 @@ import { html, repeat } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import { MessageBar as FluentMessageBar } from './message-bar.js'; import { MessageBarIntent, MessageBarLayout, MessageBarShape } from './message-bar.options.js'; import './define'; diff --git a/packages/web-components/src/progress-bar/progress-bar.stories.ts b/packages/web-components/src/progress-bar/progress-bar.stories.ts index 19234246bb56d3..818efb31bdb36f 100644 --- a/packages/web-components/src/progress-bar/progress-bar.stories.ts +++ b/packages/web-components/src/progress-bar/progress-bar.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { ProgressBar as FluentProgressBar } from './progress-bar.js'; import { ProgressBarShape, ProgressBarThickness, ProgressBarValidationState } from './progress-bar.options.js'; diff --git a/packages/web-components/src/radio-group/radio-group.stories.ts b/packages/web-components/src/radio-group/radio-group.stories.ts index 980aaafac65285..a6f7b1d876810e 100644 --- a/packages/web-components/src/radio-group/radio-group.stories.ts +++ b/packages/web-components/src/radio-group/radio-group.stories.ts @@ -1,6 +1,6 @@ import { html, ref, repeat } from '@microsoft/fast-element'; import type { Field as FluentField } from '../field/field.js'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import { ValidationFlags } from '../field/field.options.js'; import type { RadioGroup as FluentRadioGroup } from './radio-group.js'; import { RadioGroupOrientation } from './radio-group.options.js'; diff --git a/packages/web-components/src/radio/radio.stories.ts b/packages/web-components/src/radio/radio.stories.ts index 37142d88206b2e..f71842259faaec 100644 --- a/packages/web-components/src/radio/radio.stories.ts +++ b/packages/web-components/src/radio/radio.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Radio as FluentRadio } from './radio.js'; type Story = StoryObj; diff --git a/packages/web-components/src/rating-display/rating-display.stories.ts b/packages/web-components/src/rating-display/rating-display.stories.ts index 0c069f3aa67245..5ac7976f77d8f5 100644 --- a/packages/web-components/src/rating-display/rating-display.stories.ts +++ b/packages/web-components/src/rating-display/rating-display.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { RatingDisplay as FluentRatingDisplay } from './rating-display.js'; import { RatingDisplayColor, RatingDisplaySize } from './rating-display.options.js'; diff --git a/packages/web-components/src/slider/slider.stories.ts b/packages/web-components/src/slider/slider.stories.ts index 08b7677ae341e3..bd807a032ae0de 100644 --- a/packages/web-components/src/slider/slider.stories.ts +++ b/packages/web-components/src/slider/slider.stories.ts @@ -1,5 +1,5 @@ import { html } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import { SliderOrientation as SliderSetOrientation, SliderSize as SliderSetSize } from './slider.options.js'; import type { Slider as FluentSlider } from './slider.js'; diff --git a/packages/web-components/src/spinner/spinner.stories.ts b/packages/web-components/src/spinner/spinner.stories.ts index 82e306ccd9a3b0..522c4bcb2842e4 100644 --- a/packages/web-components/src/spinner/spinner.stories.ts +++ b/packages/web-components/src/spinner/spinner.stories.ts @@ -1,5 +1,5 @@ import { html, repeat } from '@microsoft/fast-element'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import { SpinnerAppearance, SpinnerSize } from './spinner.options.js'; import { Spinner as FluentSpinner } from './spinner.js'; diff --git a/packages/web-components/src/switch/switch.stories.ts b/packages/web-components/src/switch/switch.stories.ts index 6447149588e2ae..97a8ee1e477ce7 100644 --- a/packages/web-components/src/switch/switch.stories.ts +++ b/packages/web-components/src/switch/switch.stories.ts @@ -1,6 +1,6 @@ import { html, repeat } from '@microsoft/fast-element'; import { LabelPosition, ValidationFlags } from '../field/field.options.js'; -import { type NewMeta as Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Switch as FluentSwitch } from './switch.js'; type Story = StoryObj; diff --git a/packages/web-components/src/tablist/tablist.stories.ts b/packages/web-components/src/tablist/tablist.stories.ts index b9f88e44bf9353..4c19127f834db9 100644 --- a/packages/web-components/src/tablist/tablist.stories.ts +++ b/packages/web-components/src/tablist/tablist.stories.ts @@ -1,211 +1,150 @@ -import { html } from '@microsoft/fast-element'; -import type { Args, Meta } from '@storybook/html'; -import { renderComponent } from '../helpers.stories.js'; +import { html, ref } from '@microsoft/fast-element'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Tablist as FluentTablist } from './tablist.js'; import { TablistAppearance as TablistAppearanceValues, TablistOrientation, TablistSize } from './tablist.options.js'; -type TablistStoryArgs = Args & FluentTablist; -type TablistStoryMeta = Meta; +type Story = StoryObj; -const tabIds = ['first-tab', 'second-tab', 'third-tab', 'fourth-tab']; - -function changeTab() { - const tablist = document.querySelector('fluent-tablist') as FluentTablist; - const panelPlaceholder = document.querySelector('#panel-placeholder')!; - // there's a million ways to do this, but this is the simplest - panelPlaceholder.innerHTML = ` -
- Tab changed to ${tablist.activeid} -
`; -} - -const tabsDefault = html` - -
+const storyTemplate = html>` +
x.orientation} - appearance=${x => x.appearance} - ?disabled=${x => x.disabled} - size=${x => x.size} - activeid=${x => x.activeid} - @change="${() => changeTab()}" + orientation="${story => story.orientation}" + appearance="${story => story.appearance}" + ?disabled="${story => story.disabled}" + size="${story => story.size}" + activeid="${story => story.activeid}" + @change="${(x, c) => { + x.panel.textContent = `Panel changed to ${(c.event.target as FluentTablist).activetab?.textContent}`; + }}" + ${ref('tablist')} > - First Tab - Second Tab - Third Tab - Fourth Tab + First Tab + Second Tab + Third Tab + Fourth Tab - -
+
`; -export const TablistDefault = renderComponent(tabsDefault).bind({}); -const tabsHorizontal = html` - - First Tab - Second Tab - Third Tab - Fourth Tab - -`; -export const TablistHorizontal = renderComponent(tabsHorizontal).bind({}); +export default { + title: 'Components/Tablist', + render: renderComponent(storyTemplate), + argTypes: { + activeid: { + control: 'text', + description: 'The id of the active tab', + name: 'active-id', + table: { category: 'attributes', type: { summary: 'string' } }, + }, + disabled: { + control: 'boolean', + description: 'Disables the tablist', + name: 'disabled', + table: { category: 'attributes', type: { summary: 'boolean' } }, + }, + orientation: { + control: 'select', + description: 'The orientation of the tablist.', + mapping: { '': null, ...TablistOrientation }, + options: ['', ...Object.values(TablistOrientation)], + table: { + category: 'attributes', + type: { summary: Object.values(TablistOrientation).join('|') }, + }, + }, + appearance: { + control: 'select', + description: 'The appearance of the tablist.', + mapping: { '': null, ...TablistAppearanceValues }, + options: ['', ...Object.values(TablistAppearanceValues)], + table: { + category: 'attributes', + type: { summary: Object.values(TablistAppearanceValues).join('|') }, + }, + }, + size: { + control: 'select', + description: 'The size of the tablist.', + mapping: { '': null, ...TablistSize }, + options: ['', ...Object.values(TablistSize)], + table: { + category: 'attributes', + type: { summary: Object.values(TablistSize).join('|') }, + }, + }, + }, +} as Meta; -const tabsVertical = html` - - First Tab - Second Tab - Third Tab - Fourth Tab - -`; -export const TablistVertical = renderComponent(tabsVertical).bind({}); +export const Default: Story = {}; -const tabsAppearance = html` - - First Tab - Second Tab - Third Tab - Fourth Tab - - - First Tab - Second Tab - Third Tab - Fourth Tab - -`; -export const TablistAppearance = renderComponent(tabsAppearance).bind({}); +export const VerticalOrientation: Story = { + args: { + orientation: TablistOrientation.vertical, + }, + decorators: [ + Story => { + const story = Story() as HTMLDivElement; + story.style.flexDirection = 'row'; + return story; + }, + ], +}; -const tabsDisabledTablist = html` - - First Tab - Second Tab - Third Tab - Fourth Tab - - - First Tab - Second Tab - Third Tab - Fourth Tab - -`; -export const TablistDisabled = renderComponent(tabsDisabledTablist).bind({}); +export const Disabled: Story = { + args: { + disabled: true, + }, +}; -const tabsSizeSmall = html` - - First Tab - Second Tab - Third Tab - Fourth Tab - -
- - First Tab - Second Tab - Third Tab - Fourth Tab - -`; -export const TablistSizeSmall = renderComponent(tabsSizeSmall).bind({}); +export const ActiveId: Story = { + args: { + activeid: 'third-tab', + }, +}; -const tabsSizeMedium = html` - - First Tab - Second Tab - Third Tab - Fourth Tab - -
- - First Tab - Second Tab - Third Tab - Fourth Tab - -`; -export const TablistSizeMedium = renderComponent(tabsSizeMedium).bind({}); +export const SubtleAppearance: Story = { + args: { + appearance: 'subtle', + }, +}; -const tabsSizeLarge = html` - - First Tab - Second Tab - Third Tab - Fourth Tab - -
- - First Tab - Second Tab - Third Tab - Fourth Tab - -`; -export const TablistSizeLarge = renderComponent(tabsSizeLarge).bind({}); +export const SmallSize: Story = { + args: { + size: 'small', + }, +}; -const rtl = html` -
- - First Tab - Second Tab - Third Tab - Fourth Tab - -
- - First Tab - Second Tab - Third Tab - Fourth Tab - -
-`; -export const RTL = renderComponent(rtl).bind({}); +export const LargeSize: Story = { + args: { + size: 'small', + }, +}; -export default { - title: 'Components/Tablist', +export const SmallSizeVerticalOrientation: Story = { args: { - appearance: 'transparent', - disabled: false, - orientation: 'horizontal', - size: 'medium', + orientation: TablistOrientation.vertical, + size: 'small', }, - argTypes: { - appearance: { - options: Object.values(TablistAppearanceValues), - defaultValue: TablistAppearanceValues.transparent, - control: { - type: 'select', - }, - }, - activeid: { - options: tabIds, - defaultValue: tabIds[0], - control: { type: 'select' }, - }, - disabled: { - options: [true, false], - defaultValue: false, - control: { type: 'select' }, - }, - size: { - options: Object.values(TablistSize), - defaultValue: TablistSize.medium, - control: { type: 'select' }, - }, - orientation: { - options: Object.values(TablistOrientation), - defaultValue: TablistOrientation.horizontal, - control: { type: 'select' }, + decorators: [ + Story => { + const story = Story() as HTMLDivElement; + story.style.flexDirection = 'row'; + return story; }, + ], +}; + +export const LargeSizeVerticalOrientation: Story = { + args: { + orientation: TablistOrientation.vertical, + size: 'large', }, -} as TablistStoryMeta; + decorators: [ + Story => { + const story = Story() as HTMLDivElement; + story.style.flexDirection = 'row'; + return story; + }, + ], +}; diff --git a/packages/web-components/src/tabs/tabs.stories.ts b/packages/web-components/src/tabs/tabs.stories.ts index 30c639e0d63f23..17d9d1d30a06ef 100644 --- a/packages/web-components/src/tabs/tabs.stories.ts +++ b/packages/web-components/src/tabs/tabs.stories.ts @@ -1,15 +1,13 @@ import { html } from '@microsoft/fast-element'; -import type { Args, Meta } from '@storybook/html'; -import { renderComponent } from '../helpers.stories.js'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import type { Tabs as FluentTabs } from './tabs.js'; import { TabsAppearance as TabsAppearanceValues, TabsOrientation, TabsSize } from './tabs.options.js'; -type TabsStoryArgs = Args & FluentTabs; -type TabsStoryMeta = Meta; +type Story = StoryObj; const tabIds = ['first-tab', 'second-tab', 'third-tab', 'fourth-tab']; -const tabsDefault = html` +const tabsDefault = html>` x.orientation} appearance=${x => x.appearance} @@ -28,9 +26,57 @@ const tabsDefault = html` Tab Four Content `; -export const TabsDefault = renderComponent(tabsDefault).bind({}); -const tabsHorizontal = html` +export default { + title: 'Components/Tabs', + render: renderComponent(tabsDefault), + argTypes: { + appearance: { + control: 'select', + description: 'Indicates the styled appearance of the tabs.', + mapping: { '': null, ...TabsAppearanceValues }, + options: ['', ...Object.values(TabsAppearanceValues)], + table: { + category: 'attributes', + type: { summary: Object.values(TabsAppearanceValues).join('|') }, + }, + }, + activeid: { + options: tabIds, + defaultValue: tabIds[0], + control: { type: 'select' }, + }, + disabled: { + control: 'boolean', + description: 'Sets the tabs disabled state.', + table: { category: 'attributes', type: { summary: 'boolean' } }, + }, + size: { + control: 'select', + description: 'Indicates the size of the tabs.', + mapping: { '': null, ...TabsSize }, + options: ['', ...Object.values(TabsSize)], + table: { + category: 'attributes', + type: { summary: Object.values(TabsSize).join('|') }, + }, + }, + orientation: { + control: 'select', + description: 'Indicates the orientation of the tabs.', + mapping: { '': null, ...TabsOrientation }, + options: ['', ...Object.values(TabsOrientation)], + table: { + category: 'attributes', + type: { summary: Object.values(TabsOrientation).join('|') }, + }, + }, + }, +} as Meta; + +export const TabsDefault: Story = {}; + +const tabsHorizontal = html>` First Tab Second Tab @@ -43,9 +89,9 @@ const tabsHorizontal = html` `; -export const TabsHorizontal = renderComponent(tabsHorizontal).bind({}); +export const TabsHorizontal: Story = { render: renderComponent(tabsHorizontal) }; -const tabsVertical = html` +const tabsVertical = html>` First Tab Second Tab @@ -58,9 +104,9 @@ const tabsVertical = html` `; -export const TabsVertical = renderComponent(tabsVertical).bind({}); +export const TabsVertical: Story = { render: renderComponent(tabsVertical) }; -const tabsAppearance = html` +const tabsAppearance = html>` First Tab Second Tab @@ -84,9 +130,9 @@ const tabsAppearance = html` `; -export const TabsAppearance = renderComponent(tabsAppearance).bind({}); +export const TabsAppearance: Story = { render: renderComponent(tabsAppearance) }; -const tabsDisabledTabs = html` +const tabsDisabledTabs = html>` First Tab Second Tab @@ -111,9 +157,9 @@ const tabsDisabledTabs = html` `; -export const TabsDisabled = renderComponent(tabsDisabledTabs).bind({}); +export const TabsDisabled: Story = { render: renderComponent(tabsDisabledTabs) }; -const tabsSizeSmall = html` +const tabsSizeSmall = html>` First Tab Second Tab @@ -137,9 +183,9 @@ const tabsSizeSmall = html` `; -export const TabsSizeSmall = renderComponent(tabsSizeSmall).bind({}); +export const TabsSizeSmall: Story = { render: renderComponent(tabsSizeSmall) }; -const tabsSizeMedium = html` +const tabsSizeMedium = html>` First Tab Second Tab @@ -163,9 +209,9 @@ const tabsSizeMedium = html` `; -export const TabsSizeMedium = renderComponent(tabsSizeMedium).bind({}); +export const TabsSizeMedium: Story = { render: renderComponent(tabsSizeMedium) }; -const tabsSizeLarge = html` +const tabsSizeLarge = html>` First Tab Second Tab @@ -189,43 +235,4 @@ const tabsSizeLarge = html` `; -export const TabsSizeLarge = renderComponent(tabsSizeLarge).bind({}); - -export default { - title: 'Components/Tabs', - args: { - appearance: 'transparent', - disabled: false, - orientation: 'horizontal', - size: 'medium', - }, - argTypes: { - appearance: { - options: Object.values(TabsAppearanceValues), - defaultValue: TabsAppearanceValues.transparent, - control: { - type: 'select', - }, - }, - activeid: { - options: tabIds, - defaultValue: tabIds[0], - control: { type: 'select' }, - }, - disabled: { - options: [true, false], - defaultValue: false, - control: { type: 'select' }, - }, - size: { - options: Object.values(TabsSize), - defaultValue: TabsSize.medium, - control: { type: 'select' }, - }, - orientation: { - options: Object.values(TabsOrientation), - defaultValue: TabsOrientation.horizontal, - control: { type: 'select' }, - }, - }, -} as TabsStoryMeta; +export const TabsSizeLarge: Story = { render: renderComponent(tabsSizeLarge) }; diff --git a/packages/web-components/src/text-input/text-input.spec.ts b/packages/web-components/src/text-input/text-input.spec.ts index 45da21d5ee193e..f16fa96736308c 100644 --- a/packages/web-components/src/text-input/text-input.spec.ts +++ b/packages/web-components/src/text-input/text-input.spec.ts @@ -5,7 +5,7 @@ import { ImplicitSubmissionBlockingTypes } from './text-input.options.js'; test.describe('TextInput', () => { test.beforeEach(async ({ page }) => { - await page.goto(fixtureURL('components-textinput--text-input')); + await page.goto(fixtureURL('components-textinput--default')); await page.waitForFunction(() => customElements.whenDefined('fluent-text-input')); }); diff --git a/packages/web-components/src/text-input/text-input.stories.ts b/packages/web-components/src/text-input/text-input.stories.ts index 3e7b3237b807b9..8ec4050f721553 100644 --- a/packages/web-components/src/text-input/text-input.stories.ts +++ b/packages/web-components/src/text-input/text-input.stories.ts @@ -1,282 +1,301 @@ -import { html } from '@microsoft/fast-element'; -import type { Meta, Story, StoryArgs } from '../helpers.stories.js'; -import { renderComponent } from '../helpers.stories.js'; +import { html, ref } from '@microsoft/fast-element'; +import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js'; import { colorNeutralBackgroundInverted, colorNeutralForegroundInverted2 } from '../theme/design-tokens.js'; import type { TextInput as FluentTextInput } from './text-input.js'; import { TextInputAppearance, TextInputControlSize, TextInputType } from './text-input.options.js'; -const Person20Regular = html>` - -`; +type Story = StoryObj; -const storyTemplate = html>` -
- -
+ + +`); + +const storyTemplate = html>` + + ${story => story.startSlottedContent?.()} ${story => story.slottedContent?.()} + ${story => story.endSlottedContent?.()} + `; export default { title: 'Components/TextInput', + render: renderComponent(storyTemplate), argTypes: { appearance: { - description: 'Sets the visual appearance of the control', + description: 'Indicates the styled appearance of the input.', + control: 'select', + options: ['', ...Object.values(TextInputAppearance)], + mapping: { '': null, ...TextInputAppearance }, table: { - defaultValue: { summary: `${TextInputAppearance.outline}` }, + category: 'attributes', + type: { + summary: Object.values(TextInputAppearance).join('|'), + }, }, - control: 'select', - options: Object.values(TextInputAppearance), }, autocomplete: { - description: "Indicates the element's autocomplete state.", control: 'text', + table: { category: 'attributes' }, + description: "Indicates the element's autocomplete state.", + type: 'string', }, autofocus: { - description: 'Indicates that this element should get focus after the page finishes loading.', control: 'boolean', + table: { category: 'attributes' }, + description: 'Indicates that this element should get focus after the page finishes loading.', + type: 'boolean', }, controlSize: { - description: 'Sets the size of the control', + description: 'Indicates the size of the input.', + control: 'select', + options: ['', ...Object.values(TextInputControlSize)], + mapping: { '': null, ...TextInputControlSize }, table: { - defaultValue: { summary: `${TextInputControlSize.medium}` }, + category: 'attributes', + type: { + summary: Object.values(TextInputControlSize).join('|'), + }, }, - control: 'select', - options: Object.values(TextInputControlSize), }, dirname: { - description: 'Sets the directionality of the element to be submitted with form data.', control: 'text', + table: { category: 'attributes' }, + description: 'Sets the directionality of the element to be submitted with form data.', + type: 'string', }, disabled: { description: 'Sets the disabled state', table: { + category: 'attributes', defaultValue: { summary: 'false' }, }, control: 'boolean', + type: 'boolean', }, form: { - description: 'The id of a form to associate the element to.', control: 'text', + table: { category: 'attributes' }, + description: 'The id of a form to associate the element to.', + type: 'string', }, list: { - description: 'The id of a datalist element that provides a list of suggested values.', control: 'text', + table: { category: 'attributes' }, + description: 'The id of a datalist element that provides a list of suggested values.', + type: 'string', }, maxlength: { - description: 'Sets the maximum number of characters allowed in the input', control: 'number', + table: { category: 'attributes' }, + description: 'Sets the maximum number of characters allowed in the input', + type: 'number', }, minlength: { - description: 'Sets the minimum number of characters allowed in the input', control: 'number', + table: { category: 'attributes' }, + description: 'Sets the minimum number of characters allowed in the input', + type: 'number', }, multiple: { - description: 'Indicates whether the user can enter multiple values.', control: 'boolean', + table: { category: 'attributes' }, + description: 'Indicates whether the user can enter multiple values.', + type: 'boolean', }, name: { - description: 'Sets the name of the input', control: 'text', + table: { category: 'attributes' }, + description: 'Sets the name of the input', + type: 'string', }, pattern: { - description: 'Sets the regular expression pattern that the input’s value is checked against.', control: 'text', + table: { category: 'attributes' }, + description: 'Sets the regular expression pattern that the input’s value is checked against.', + type: 'string', }, placeholder: { - description: 'Sets the placeholder text', control: 'text', + table: { category: 'attributes' }, + description: 'Sets the placeholder text', + type: 'string', }, readOnly: { + control: 'boolean', + table: { category: 'attributes' }, description: 'Sets the readonly state', + type: 'boolean', + }, + required: { control: 'boolean', + table: { + category: 'attributes', + defaultValue: { summary: 'false' }, + }, + description: 'Sets the required state', + type: 'boolean', }, - storyContent: { table: { disable: true } }, type: { description: 'Sets the input type', + control: 'select', + options: ['', ...Object.values(TextInputType)], + mapping: { '': null, ...TextInputType }, table: { + category: 'attributes', defaultValue: { summary: `${TextInputType.text}` }, + type: { + summary: Object.values(TextInputType).join('|'), + }, }, - options: Object.values(TextInputType), - control: 'select', }, value: { - description: 'The initial value of the input.', control: 'text', + table: { category: 'attributes' }, + description: 'The initial value of the input.', + type: 'string', + }, + slottedContent: { + name: '', + description: 'The default slot. Content in this slot is used as the `