>`
x.expanded}">
- ${x => x.detail}
+ ${x => x.storyContent}
`;
export default {
title: "Disclosure",
args: {
- summary: "More about Flash",
- detail: html`
- ⚡️
-
- Created by writer Gardner Fox and artist Harry Lampert, the original Flash
- first appeared in Flash Comics #1 (cover date January 1940/release month
- November 1939). Nicknamed the "Scarlet Speedster", all incarnations of the
- Flash possess "super speed", which includes the ability to run, move, and
- think extremely fast, use superhuman reflexes, and seemingly violate
- certain laws of physics.
-
- `,
+ expanded: false,
},
argTypes: {
- expanded: { control: { type: "boolean" } },
+ expanded: { control: "boolean" },
+ storyContent: { table: { disable: true } },
+ summary: { control: "text" },
},
-} as DisclosureStoryMeta;
+} as Meta;
-export const Disclosure = (args: DisclosureStoryArgs) => {
- const storyFragment = new DocumentFragment();
- storyTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
+export const Disclosure: Story = renderComponent(storyTemplate).bind({});
+Disclosure.args = {
+ storyContent: html`
+ ⚡️
+
+ Created by writer Gardner Fox and artist Harry Lampert, the original Flash
+ first appeared in Flash Comics #1 (cover date January 1940/release month
+ November 1939). Nicknamed the "Scarlet Speedster", all incarnations of the
+ Flash possess "super speed", which includes the ability to run, move, and
+ think extremely fast, use superhuman reflexes, and seemingly violate certain
+ laws of physics.
+
+ `,
+ summary: "More about Flash",
};
diff --git a/packages/web-components/fast-foundation/src/divider/stories/divider.stories.ts b/packages/web-components/fast-foundation/src/divider/stories/divider.stories.ts
index 34d677351f2..668b3571e93 100644
--- a/packages/web-components/fast-foundation/src/divider/stories/divider.stories.ts
+++ b/packages/web-components/fast-foundation/src/divider/stories/divider.stories.ts
@@ -1,13 +1,11 @@
import { html } from "@microsoft/fast-element";
import { Orientation } from "@microsoft/fast-web-utilities";
-import type { Args, Meta } from "@storybook/html";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTDivider } from "../divider.js";
import { DividerRole } from "../divider.options.js";
-type DividerStoryArgs = Args & FASTDivider;
-type DividerStoryMeta = Meta;
-
-const componentTemplate = html`
+export const storyTemplate = html>`
`
export default {
title: "Divider",
+ excludeStories: ["storyTemplate"],
argTypes: {
- orientation: {
- options: Object.values(Orientation),
- control: { type: "select" },
- },
- role: {
- options: Object.values(DividerRole),
- control: { type: "select" },
- },
+ orientation: { control: "radio", options: Object.values(Orientation) },
+ role: { control: "select", options: Object.values(DividerRole) },
},
-} as DividerStoryMeta;
-
-export const Divider = (args: DividerStoryArgs) => {
- const storyFragment = new DocumentFragment();
- componentTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
-};
-
-export const DividerPresentation = Divider.bind({});
-DividerPresentation.storyName = "Divider (presentation role)";
-DividerPresentation.args = {
- role: DividerRole.presentation,
-};
+} as Meta;
-export const DividerVertical = Divider.bind({});
-DividerVertical.args = {
- orientation: Orientation.vertical,
-};
+export const Divider: Story = renderComponent(storyTemplate).bind({});
diff --git a/packages/web-components/fast-foundation/src/flipper/stories/flipper.stories.ts b/packages/web-components/fast-foundation/src/flipper/stories/flipper.stories.ts
index 1efe444cb73..a96a6657bc3 100644
--- a/packages/web-components/fast-foundation/src/flipper/stories/flipper.stories.ts
+++ b/packages/web-components/fast-foundation/src/flipper/stories/flipper.stories.ts
@@ -1,60 +1,28 @@
-import { html, repeat } from "@microsoft/fast-element";
-import type { Args, Meta } from "@storybook/html";
+import { html } from "@microsoft/fast-element";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTFlipper } from "../flipper.js";
import { FlipperDirection } from "../flipper.options.js";
-type FlipperStoryArgs = Args & FASTFlipper;
-type FlipperStoryMeta = Meta;
-
-const componentTemplate = html`
+const storyTemplate = html>`
x.disabled}"
+ :hiddenFromAT="${x => x.hiddenFromAT}"
+ direction="${x => x.direction}"
>
`;
export default {
title: "Flipper",
+ args: {
+ disabled: false,
+ hiddenFromAT: true,
+ },
argTypes: {
- direction: {
- options: Object.values(FlipperDirection),
- control: { type: "select" },
- },
- disabled: {
- control: { type: "boolean" },
- },
+ direction: { control: "select", options: Object.values(FlipperDirection) },
+ disabled: { control: "boolean" },
+ hiddenFromAT: { control: "boolean" },
},
-} as FlipperStoryMeta;
-
-export const Flipper = (args: FlipperStoryArgs) => {
- const storyFragment = new DocumentFragment();
- componentTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
-};
-
-export const FlipperPrevious = Flipper.bind({});
-FlipperPrevious.storyName = "Previous Flipper";
-FlipperPrevious.args = {
- direction: FlipperDirection.previous,
-};
-
-export const FlipperDisabled = (args: FlipperStoryArgs) => {
- const storyFragment = new DocumentFragment();
-
- html`
- ${repeat(x => x.items, componentTemplate)}
- `.render(args, storyFragment);
+} as Meta;
- return storyFragment;
-};
-FlipperDisabled.storyName = "Disabled Flippers";
-FlipperDisabled.args = {
- items: [
- { direction: FlipperDirection.previous, disabled: true },
- { direction: FlipperDirection.next, disabled: true },
- ],
- direction: FlipperDirection.previous,
-};
-FlipperDisabled.argTypes = {
- items: { table: { disable: true } },
-};
+export const Flipper: Story = renderComponent(storyTemplate).bind({});
diff --git a/packages/web-components/fast-foundation/src/horizontal-scroll/README.md b/packages/web-components/fast-foundation/src/horizontal-scroll/README.md
index 3d061328c08..435ae8f6366 100644
--- a/packages/web-components/fast-foundation/src/horizontal-scroll/README.md
+++ b/packages/web-components/fast-foundation/src/horizontal-scroll/README.md
@@ -129,6 +129,17 @@ export const myHorizontalScroll = HorizontalScroll.compose
+
+
+
### class: `FASTHorizontalScroll`
#### Superclass
@@ -139,18 +150,18 @@ export const myHorizontalScroll = HorizontalScroll.compose;
-
-const componentTemplate = html`
-
- ${repeat(
- x => x.items,
- html`
- ${x => x}
- `,
- {
- positioning: true,
- }
- )}
+const storyTemplate = html>`
+
+ ${x => x.storyContent}
`;
export default {
title: "Horizontal Scroll",
args: {
- items: new Array(16).fill(html`
- A button
- `),
+ flippersHiddenFromAT: false,
+ storyContent: html`
+ ${repeat(x => x.storyItems, cardStoryTemplate)}
+ `,
+ storyItems: new Array(16).fill(null).map((_, i) => ({
+ storyContent: html`
+ Card ${i + 1}
+ button
+ `,
+ })),
},
argTypes: {
- items: { table: { disable: true } },
+ duration: { control: "text" },
+ flippersHiddenFromAT: { control: "boolean" },
+ easing: { control: "text", options: Object.values(ScrollEasing) },
+ speed: { control: { type: "number", min: 0 } },
+ storyContent: { table: { disable: true } },
+ storyItems: { table: { disable: true } },
+ view: { control: "radio", options: Object.values(HorizontalScrollView) },
},
decorators: [
Story => {
const renderedStory = Story() as FASTHorizontalScroll;
- const styles = document.createElement("style");
- styles.innerHTML = /* css */ `
- fast-card {
- width: 120px;
- height: 200px;
+ renderedStory.$fastController.addStyles(css`
+ ::slotted(fast-card) {
color: var(--neutral-foreground-rest);
+ height: 200px;
+ width: 120px;
}
- fast-horizontal-scroll {
+ :host {
max-width: 620px;
margin: 20px;
}
-
- .right-gradient {
- --scroll-fade-next: var(--fill-color);
- }
-
- .both-gradient {
- --scroll-fade-next: var(--fill-color);
- --scroll-fade-previous: var(--fill-color);
- }
-
- .top-align {
- --scroll-align: flex-start;
- }
-
- .bottom-align {
- --scroll-align: flex-end;
- }
-
- .full-width,
- .full-width fast-card {
- width: 600px;
- height: 300px;
- }
- .window-resize {
- max-width: unset;
- }
- `;
-
- renderedStory.append(styles);
+ `);
return renderedStory;
},
],
-} as HorizontalScrollStoryMeta;
+} as Meta;
-export const HorizontalScroll = (args: HorizontalScrollStoryArgs) => {
- const storyFragment = new DocumentFragment();
- componentTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
-};
+export const HorizontalScroll: Story = renderComponent(
+ storyTemplate
+).bind({});
diff --git a/packages/web-components/fast-foundation/src/listbox-option/listbox-option.ts b/packages/web-components/fast-foundation/src/listbox-option/listbox-option.ts
index aa2ad20368e..891cb5f198d 100644
--- a/packages/web-components/fast-foundation/src/listbox-option/listbox-option.ts
+++ b/packages/web-components/fast-foundation/src/listbox-option/listbox-option.ts
@@ -282,7 +282,7 @@ export class DelegatesARIAListboxOption {
* HTML Attribute: `aria-posinset`
*/
@observable
- ariaPosInSet: string | null;
+ public ariaPosInSet: string | null;
/**
* See {@link https://www.w3.org/TR/wai-aria-1.2/#option} for more information.
@@ -291,7 +291,7 @@ export class DelegatesARIAListboxOption {
* HTML Attribute: `aria-selected`
*/
@observable
- ariaSelected: "true" | "false" | string | null;
+ public ariaSelected: "true" | "false" | string | null;
/**
* See {@link https://www.w3.org/TR/wai-aria-1.2/#option} for more information.
@@ -300,7 +300,7 @@ export class DelegatesARIAListboxOption {
* HTML Attribute: `aria-setsize`
*/
@observable
- ariaSetSize: string | null;
+ public ariaSetSize: string | null;
}
/**
diff --git a/packages/web-components/fast-foundation/src/listbox-option/stories/listbox-option.register.ts b/packages/web-components/fast-foundation/src/listbox-option/stories/listbox-option.register.ts
index c1dc7d1529b..433c455ba63 100644
--- a/packages/web-components/fast-foundation/src/listbox-option/stories/listbox-option.register.ts
+++ b/packages/web-components/fast-foundation/src/listbox-option/stories/listbox-option.register.ts
@@ -27,6 +27,10 @@ const styles = css`
white-space: nowrap;
}
+ :host([hidden]) {
+ display: none;
+ }
+
:host(:focus-visible) {
background: var(--accent-fill-focus);
border-color: var(--focus-stroke-outer);
diff --git a/packages/web-components/fast-foundation/src/listbox-option/stories/listbox-option.stories.ts b/packages/web-components/fast-foundation/src/listbox-option/stories/listbox-option.stories.ts
index 31ebf7f3114..aa1851e45e3 100644
--- a/packages/web-components/fast-foundation/src/listbox-option/stories/listbox-option.stories.ts
+++ b/packages/web-components/fast-foundation/src/listbox-option/stories/listbox-option.stories.ts
@@ -1,79 +1,40 @@
-import { html, repeat } from "@microsoft/fast-element";
-import type { Args, Meta } from "@storybook/html";
+import { html } from "@microsoft/fast-element";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTListboxOption } from "../listbox-option.js";
-type ListboxOptionStoryArgs = Args & FASTListboxOption;
-type ListboxOptionStoryMeta = Meta;
-
-const storyTemplate = html`
+export const storyTemplate = html>`
x.disabled}"
?selected="${x => x.selected}"
- :checked="${x => x.checked}"
value="${x => x.value}"
>
- ${x => x.text}
+ ${x => x.storyContent}
`;
export default {
- title: "Listbox/Listbox Option",
+ title: "Listbox Option",
+ excludeStories: ["storyTemplate"],
args: {
- text: "Listbox option",
+ selected: false,
+ disabled: false,
+ storyContent: "Listbox option",
value: "listbox-value",
},
argTypes: {
- selected: {
- control: {
- type: "boolean",
- },
- },
+ disabled: { control: "boolean" },
+ items: { table: { disable: true } },
+ selected: { control: "boolean" },
+ value: { control: "text" },
+ ariaChecked: { control: "text" },
+ ariaPosInSet: { control: "text" },
+ ariaSelected: { control: "text" },
+ ariaSetSize: { control: "text" },
+ storyContent: { table: { disable: true } },
},
-} as ListboxOptionStoryMeta;
-
-export const ListboxOption = (args: ListboxOptionStoryArgs) => {
- const storyFragment = new DocumentFragment();
- storyTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
-};
-
-export const ListboxOptionSelected = ListboxOption.bind({});
-ListboxOptionSelected.storyName = "Selected Listbox Option";
-ListboxOptionSelected.args = {
- selected: true,
-};
-
-export const ListboxOptionDisabled = (args: ListboxOptionStoryArgs) => {
- const disabledStoryTemplate = html`
- ${repeat(x => x.items, storyTemplate)}
- `;
+} as Meta;
- const storyFragment = new DocumentFragment();
- disabledStoryTemplate.render(args, storyFragment);
- return storyFragment;
-};
-ListboxOptionDisabled.storyName = "Disabled Listbox Option";
-ListboxOptionDisabled.args = {
- items: [
- {
- disabled: true,
- text: "disabled (unselected)",
- },
- {
- disabled: true,
- text: "disabled (selected)",
- },
- {
- checked: false,
- disabled: true,
- selected: true,
- text: "disabled (unselected, checked)",
- },
- {
- checked: true,
- disabled: true,
- selected: true,
- text: "disabled (selected, checked)",
- },
- ],
-};
+export const ListboxOption: Story = renderComponent(
+ storyTemplate
+).bind({});
diff --git a/packages/web-components/fast-foundation/src/listbox/stories/listbox.register.ts b/packages/web-components/fast-foundation/src/listbox/stories/listbox.register.ts
index 23d82201e9c..b5a1e2d791b 100644
--- a/packages/web-components/fast-foundation/src/listbox/stories/listbox.register.ts
+++ b/packages/web-components/fast-foundation/src/listbox/stories/listbox.register.ts
@@ -14,6 +14,10 @@ const styles = css`
padding: calc(var(--design-unit) * 1px) 0;
}
+ :host([hidden]) {
+ display: none !important;
+ }
+
:host(:focus-within:not([disabled])) {
border-color: var(--focus-stroke-outer);
box-shadow: 0 0 0 calc((var(--focus-stroke-width) - var(--stroke-width)) * 1px)
diff --git a/packages/web-components/fast-foundation/src/listbox/stories/listbox.stories.ts b/packages/web-components/fast-foundation/src/listbox/stories/listbox.stories.ts
index c0c6709a1a2..4eb1201a7d3 100644
--- a/packages/web-components/fast-foundation/src/listbox/stories/listbox.stories.ts
+++ b/packages/web-components/fast-foundation/src/listbox/stories/listbox.stories.ts
@@ -1,77 +1,57 @@
import { html, repeat } from "@microsoft/fast-element";
-import type { Args, Meta } from "@storybook/html";
+import { storyTemplate as listboxOptionStoryTemplate } from "../../listbox-option/stories/listbox-option.stories.js";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTListboxElement } from "../listbox.element.js";
-type ListboxStoryArgs = Args & FASTListboxElement;
-type ListboxStoryMeta = Meta;
-
-const storyTemplate = html`
+const storyTemplate = html>`
x.multiple}"
size="${x => x.size}"
?disabled="${x => x.disabled}"
>
- ${repeat(
- x => x.items,
- html`
- x.selected}">${x => x.text}
- `
- )}
+ ${x => x.storyContent}
`;
export default {
title: "Listbox",
args: {
- items: [
- { text: "William Hartnell" },
- { text: "Patrick Troughton" },
- { text: "Jon Pertwee" },
- { text: "Tom Baker" },
- { text: "Peter Davidson" },
- { text: "Colin Baker" },
- { text: "Sylvester McCoy" },
- { text: "Paul McGann" },
- { text: "Christopher Eccleston" },
- { text: "David Tenant" },
- { text: "Matt Smith" },
- { text: "Peter Capaldi" },
- { text: "Jodie Whittaker" },
+ disabled: false,
+ multiple: false,
+ storyContent: html>`
+ ${repeat(x => x.storyItems, listboxOptionStoryTemplate)}
+ `,
+ storyItems: [
+ { storyContent: "William Hartnell" },
+ { storyContent: "Patrick Troughton" },
+ { storyContent: "Jon Pertwee" },
+ { storyContent: "Tom Baker" },
+ { storyContent: "Peter Davidson" },
+ { storyContent: "Colin Baker" },
+ { storyContent: "Sylvester McCoy" },
+ { storyContent: "Paul McGann" },
+ { storyContent: "Christopher Eccleston" },
+ { storyContent: "David Tenant" },
+ { storyContent: "Matt Smith" },
+ { storyContent: "Peter Capaldi" },
+ { storyContent: "Jodie Whittaker" },
+ { storyContent: "Ncuti Gatwa" },
],
},
argTypes: {
- disabled: {
- control: {
- type: "boolean",
- },
- },
- items: {
- table: {
- disable: true,
- },
- },
- size: {
- control: {
- type: "number",
- },
- },
+ disabled: { control: "boolean" },
+ multiple: { control: "boolean" },
+ size: { control: "number" },
+ storyContent: { table: { disable: true } },
+ storyItems: { table: { disable: true } },
},
-} as ListboxStoryMeta;
+} as Meta;
-export const Listbox = (args: ListboxStoryArgs) => {
- const storyFragment = new DocumentFragment();
- storyTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
-};
+export const Listbox: Story = renderComponent(storyTemplate).bind({});
-export const ListboxMultiple = Listbox.bind({});
+export const ListboxMultiple: Story = Listbox.bind({});
ListboxMultiple.storyName = "Listbox in multiple-selection mode";
ListboxMultiple.args = {
multiple: true,
};
-
-export const ListboxDisabled = Listbox.bind({});
-ListboxDisabled.storyName = "Disabled Listbox";
-ListboxDisabled.args = {
- disabled: true,
-};
diff --git a/packages/web-components/fast-foundation/src/menu-item/stories/menu-item.register.ts b/packages/web-components/fast-foundation/src/menu-item/stories/menu-item.register.ts
index 91fbcb5d538..d4207aca432 100644
--- a/packages/web-components/fast-foundation/src/menu-item/stories/menu-item.register.ts
+++ b/packages/web-components/fast-foundation/src/menu-item/stories/menu-item.register.ts
@@ -4,7 +4,7 @@ import { menuItemTemplate } from "../menu-item.template.js";
const styles = css`
:host([hidden]) {
- display: none;
+ display: none !important;
}
:host {
diff --git a/packages/web-components/fast-foundation/src/menu-item/stories/menu-item.stories.ts b/packages/web-components/fast-foundation/src/menu-item/stories/menu-item.stories.ts
index 1f99036243d..f7ef082652d 100644
--- a/packages/web-components/fast-foundation/src/menu-item/stories/menu-item.stories.ts
+++ b/packages/web-components/fast-foundation/src/menu-item/stories/menu-item.stories.ts
@@ -1,128 +1,123 @@
import { css, html, repeat } from "@microsoft/fast-element";
-import type { Args, Meta } from "@storybook/html";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTMenuItem } from "../menu-item.js";
import { MenuItemRole } from "../menu-item.options.js";
-type MenuItemStoryArgs = Args & FASTMenuItem;
-type MenuItemStoryMeta = Meta;
-
-const componentTemplate = html`
+export const storyTemplate = html>`
x.expanded}"
?checked="${x => x.checked}"
?disabled="${x => x.disabled}"
+ id="${x => x.id}"
role="${x => x.role}"
>
- ${x => x.content}
+ ${x => x.storyContent}
`;
export default {
- title: "Menu/Menu Item",
+ title: "Menu Item",
+ excludeStories: ["storyTemplate"],
args: {
- content: "Menu Item",
+ checked: false,
+ disabled: false,
+ expanded: false,
},
argTypes: {
- checked: { control: { type: "boolean" } },
- disabled: { control: { type: "boolean" } },
- expanded: { control: { type: "boolean" } },
- role: { options: Object.values(MenuItemRole), control: { type: "select" } },
+ checked: { control: "boolean", if: { arg: "role", neq: MenuItemRole.menuitem } },
+ disabled: { control: "boolean" },
+ expanded: { control: "boolean" },
+ role: { control: "select", options: Object.values(MenuItemRole) },
},
-} as MenuItemStoryMeta;
+} as Meta;
-export const MenuItem = (args: MenuItemStoryArgs) => {
- const storyFragment = new DocumentFragment();
- componentTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
+export const MenuItem: Story = renderComponent(storyTemplate).bind({});
+MenuItem.args = {
+ storyContent: "Menu Item",
};
-export const WithSlottedStart = MenuItem.bind({});
-WithSlottedStart.args = {
- content: html`
+export const MenuItemWithSlottedStart: Story = MenuItem.bind({});
+MenuItemWithSlottedStart.args = {
+ storyContent: html`
Menu item with slotted start icon
`,
};
-export const WithSlottedEnd = MenuItem.bind({});
-WithSlottedEnd.args = {
- content: html`
+export const MenuItemWithSlottedEnd: Story = MenuItem.bind({});
+MenuItemWithSlottedEnd.args = {
+ storyContent: html`
Menu item with slotted end icon
`,
};
-export const MenuItemCheckbox = (args: MenuItemStoryArgs) => {
- const menuItemCheckboxTemplate = html`
- ${repeat(x => x.items, componentTemplate)}
- `;
- const storyFragment = new DocumentFragment();
- menuItemCheckboxTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
-};
+export const MenuItemCheckbox: Story = renderComponent(
+ html>`
+ ${repeat(x => x.items, storyTemplate)}
+ `
+).bind({});
MenuItemCheckbox.args = {
items: [
{
- content: "Menu item checkbox (unchecked)",
role: MenuItemRole.menuitemcheckbox,
+ storyContent: "Menu item checkbox (unchecked)",
},
{
- content: "Menu item checkbox (checked)",
- role: MenuItemRole.menuitemcheckbox,
checked: true,
+ role: MenuItemRole.menuitemcheckbox,
+ storyContent: "Menu item checkbox (checked)",
},
{
- content: "Menu item checkbox (unchecked, disabled)",
- role: MenuItemRole.menuitemcheckbox,
checked: false,
disabled: true,
+ role: MenuItemRole.menuitemcheckbox,
+ storyContent: "Menu item checkbox (unchecked, disabled)",
},
{
- content: "Menu item checkbox (checked, disabled)",
- role: MenuItemRole.menuitemcheckbox,
- disabled: true,
checked: true,
+ disabled: true,
+ role: MenuItemRole.menuitemcheckbox,
+ storyContent: "Menu item checkbox (checked, disabled)",
},
],
};
-export const MenuItemRadio = (args: MenuItemStoryArgs) => {
- const MenuItemRadioTemplate = html`
- ${repeat(x => x.items, componentTemplate)}
- `;
- const storyFragment = new DocumentFragment();
- MenuItemRadioTemplate.render(args, storyFragment);
- return storyFragment;
-};
+export const MenuItemRadio: Story = renderComponent(
+ html>`
+ ${repeat(x => x.items, storyTemplate)}
+ `
+).bind({});
MenuItemRadio.args = {
items: [
{
- content: "Menu item radio (unchecked)",
role: MenuItemRole.menuitemradio,
+ storyContent: "Menu item radio (unchecked)",
},
{
- content: "Menu item radio (checked)",
- role: MenuItemRole.menuitemradio,
checked: true,
+ role: MenuItemRole.menuitemradio,
+ storyContent: "Menu item radio (checked)",
},
{
- content: "Menu item radio (unchecked, disabled)",
- role: MenuItemRole.menuitemradio,
checked: false,
disabled: true,
+ role: MenuItemRole.menuitemradio,
+ storyContent: "Menu item radio (unchecked, disabled)",
},
{
- content: "Menu item radio (checked, disabled)",
- role: MenuItemRole.menuitemradio,
- disabled: true,
checked: true,
+ disabled: true,
+ role: MenuItemRole.menuitemradio,
+ storyContent: "Menu item radio (checked, disabled)",
},
],
};
-export const MenuItemExpanded: MenuItemStoryMeta = MenuItem.bind({});
+export const MenuItemExpanded: Story = MenuItem.bind({});
MenuItemExpanded.args = {
- content: html`
+ storyContent: html`
Expanded
submenu slot
`,
diff --git a/packages/web-components/fast-foundation/src/menu/stories/menu.stories.ts b/packages/web-components/fast-foundation/src/menu/stories/menu.stories.ts
index 18b3e47a3b2..ceeb8c7b287 100644
--- a/packages/web-components/fast-foundation/src/menu/stories/menu.stories.ts
+++ b/packages/web-components/fast-foundation/src/menu/stories/menu.stories.ts
@@ -1,109 +1,169 @@
-import { html } from "@microsoft/fast-element";
-import type { Args, Meta } from "@storybook/html";
+import { html, repeat } from "@microsoft/fast-element";
+import { storyTemplate as dividerStoryTemplate } from "../../divider/stories/divider.stories.js";
+import type { FASTMenuItem } from "../../menu-item/menu-item.js";
+import { storyTemplate as menuItemStoryTemplate } from "../../menu-item/stories/menu-item.stories.js";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTMenu } from "../menu.js";
-type MenuStoryArgs = Args & FASTMenu;
-type MenuStoryMeta = Meta;
+const storyTemplate = html>`
+ ${x => x.storyContent}
+`;
-const storyTemplate = html`
- ${x => x.content}
+const storyContentTemplate = html`
+ ${repeat(
+ x => x.storyItems,
+ html>`
+ ${x => x.template ?? menuItemStoryTemplate}
+ `
+ )}
`;
export default {
title: "Menu",
args: {
- content: html`
- Menu item 1
- Menu item 2
- Menu item 3
- `,
+ storyContent: storyContentTemplate,
+ storyItems: [
+ { storyContent: "Menu Item 1" },
+ { storyContent: "Menu Item 2" },
+ { storyContent: "Menu Item 3" },
+ ],
},
argTypes: {
- content: { table: { disable: true } },
+ storyContent: { table: { disable: true } },
},
-} as MenuStoryMeta;
+} as Meta;
-export const Menu = (args: MenuStoryArgs) => {
- const storyFragment = new DocumentFragment();
- storyTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
+export const Menu: Story = renderComponent(storyTemplate).bind({});
+Menu.args = {
+ storyContent: html`
+ ${repeat(
+ x => x.storyItems,
+ html>`
+ ${x => x.template ?? menuItemStoryTemplate}
+ `
+ )}
+ `,
};
-export const MenuWithDivider = Menu.bind({});
+export const MenuWithDivider: Story = Menu.bind({});
MenuWithDivider.args = {
- content: html`
- Menu item 1
- Menu item 2
-
- Menu item 3
- Menu item 4
- `,
+ storyItems: [
+ { storyContent: "Menu Item 1" },
+ { storyContent: "Menu Item 2" },
+ { template: dividerStoryTemplate },
+ { storyContent: "Menu Item 3" },
+ { storyContent: "Menu Item 4" },
+ ],
};
-export const MenuWithFormControls = Menu.bind({});
+export const MenuWithFormControls: Story = Menu.bind({});
MenuWithFormControls.args = {
- content: html`
- Menu item 1
- Menu item 2
-
- Checkbox 1
- Checkbox 2
-
- Radio 1.1
- Radio 1.2
-
- Radio 2.1
- Radio 2.2
- `,
+ storyItems: [
+ { storyContent: "Menu Item 1" },
+ { storyContent: "Menu Item 2" },
+ { template: dividerStoryTemplate },
+ { storyContent: "Checkbox 1", role: "menuitemcheckbox" },
+ { storyContent: "Checkbox 2", role: "menuitemcheckbox" },
+ { template: dividerStoryTemplate },
+ { storyContent: "Radio 1.1", role: "menuitemradio" },
+ { storyContent: "Radio 1.2", role: "menuitemradio" },
+ { template: dividerStoryTemplate },
+ { storyContent: "Radio 2.1", role: "menuitemradio" },
+ { storyContent: "Radio 2.2", role: "menuitemradio" },
+ ],
};
-export const MenuWithNestedItems = Menu.bind({});
+export const MenuWithNestedItems: Story = Menu.bind({});
MenuWithNestedItems.args = {
- content: html`
-
- Menu item 1
-
- Menu item 1.1
- Menu item 1.2
- Menu item 1.3
-
-
-
- Menu item 2
-
- Menu item 2.1
- Menu item 2.2
- Menu item 2.3
-
-
-
- Menu item 3
-
- Menu item 3.1
- Menu item 3.2
- Menu item 3.3
-
-
- `,
+ storyItems: [
+ {
+ storyContent: html`
+ Menu Item 1 ${repeat(x => x.storyItems, storyTemplate)}
+ `,
+ storyItems: [
+ {
+ slot: "submenu",
+ storyContent: storyContentTemplate,
+ storyItems: [
+ { storyContent: "Menu Item 1.1" },
+ { storyContent: "Menu Item 1.2" },
+ { storyContent: "Menu Item 1.3" },
+ ],
+ },
+ ],
+ },
+ {
+ storyContent: html`
+ Menu Item 2 ${repeat(x => x.storyItems, storyTemplate)}
+ `,
+ storyItems: [
+ {
+ slot: "submenu",
+ storyContent: storyContentTemplate,
+ storyItems: [
+ {
+ storyContent: html`
+ Menu Item 2.1 ${repeat(x => x.storyItems, storyTemplate)}
+ `,
+ storyItems: [
+ {
+ slot: "submenu",
+ storyContent: storyContentTemplate,
+ storyItems: [
+ { storyContent: "Menu Item 2.1.1" },
+ { storyContent: "Menu Item 2.1.2" },
+ { storyContent: "Menu Item 2.1.3" },
+ ],
+ },
+ ],
+ },
+ { storyContent: "Menu Item 2.2" },
+ { storyContent: "Menu Item 2.3" },
+ ],
+ },
+ ],
+ },
+ {
+ storyContent: html`
+ Menu Item 3 ${repeat(x => x.storyItems, storyTemplate)}
+ `,
+ storyItems: [
+ {
+ slot: "submenu",
+ storyContent: storyContentTemplate,
+ storyItems: [
+ { storyContent: "Menu Item 3.1" },
+ { storyContent: "Menu Item 3.2" },
+ { storyContent: "Menu Item 3.3" },
+ ],
+ },
+ ],
+ },
+ ],
};
-export const WithIcons = Menu.bind({});
-WithIcons.args = {
- content: html`
-
-
-
- Menu item 1
-
-
-
-
- Menu item 2
-
-
-
-
- Menu item 3
-
- `,
+export const MenuWithItemsWithIcons: Story = Menu.bind({});
+MenuWithItemsWithIcons.args = {
+ storyItems: [
+ {
+ storyContent: html`
+
+ Slotted start icon
+ `,
+ },
+ {
+ storyContent: html`
+
+ Slotted end icon
+ `,
+ },
+ {
+ storyContent: html`
+
+
+ Slotted start and end icons
+ `,
+ },
+ ],
};
diff --git a/packages/web-components/fast-foundation/src/number-field/stories/number-field.stories.ts b/packages/web-components/fast-foundation/src/number-field/stories/number-field.stories.ts
index 49e1df3c266..48422cf64ef 100644
--- a/packages/web-components/fast-foundation/src/number-field/stories/number-field.stories.ts
+++ b/packages/web-components/fast-foundation/src/number-field/stories/number-field.stories.ts
@@ -1,17 +1,17 @@
import { html } from "@microsoft/fast-element";
-import type { Args, Meta } from "@storybook/html";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTNumberField } from "../number-field.js";
-type NumberFieldStoryArgs = Args & FASTNumberField;
-type NumberFieldStoryMeta = Meta;
-
-const componentTemplate = html`
+const storyTemplate = html>`
x.readOnly}"
+ ?required="${x => x.required}"
?autofocus="${x => x.autofocus}"
?disabled="${x => x.disabled}"
?hide-step="${x => x.hideStep}"
+ :list="${x => x.list}"
+ step="${x => x.step}"
max="${x => x.max}"
maxlength="${x => x.maxlength}"
min="${x => x.min}"
@@ -19,37 +19,86 @@ const componentTemplate = html`
placeholder="${x => x.placeholder}"
size="${x => x.size}"
value="${x => x.value}"
+ :ariaAtomic="${x => x.ariaAtomic}"
+ :ariaBusy="${x => x.ariaBusy}"
+ :ariaControls="${x => x.ariaControls}"
+ :ariaCurrent="${x => x.ariaCurrent}"
+ :ariaDescribedby="${x => x.ariaDescribedby}"
+ :ariaDetails="${x => x.ariaDetails}"
+ :ariaDisabled="${x => x.ariaDisabled}"
+ :ariaErrormessage="${x => x.ariaErrormessage}"
+ :ariaFlowto="${x => x.ariaFlowto}"
+ :ariaHaspopup="${x => x.ariaHaspopup}"
+ :ariaHidden="${x => x.ariaHidden}"
+ :ariaInvalid="${x => x.ariaInvalid}"
+ :ariaKeyshortcuts="${x => x.ariaKeyshortcuts}"
+ :ariaLabel="${x => x.ariaLabel}"
+ :ariaLabelledby="${x => x.ariaLabelledby}"
+ :ariaLive="${x => x.ariaLive}"
+ :ariaOwns="${x => x.ariaOwns}"
+ :ariaRelevant="${x => x.ariaRelevant}"
+ :ariaRoledescription="${x => x.ariaRoledescription}"
>
- ${x => x.label}
+ ${x => x.storyContent}
`;
export default {
title: "Number Field",
args: {
- label: "Number Field",
- placeholder: "number",
+ readOnly: false,
+ required: false,
+ autofocus: false,
+ disabled: false,
+ hideStep: false,
+ storyContent: "Number Field",
},
argTypes: {
- autofocus: { control: { type: "boolean" } },
- label: { control: { type: "text" } },
- disabled: { control: { type: "boolean" } },
- hideStep: { control: { type: "boolean " } },
- list: { control: { type: "text" } },
- max: { control: { type: "number" } },
- maxlength: { control: { type: "number" } },
- min: { control: { type: "number" } },
- minlength: { control: { type: "number" } },
- placeholder: { control: { type: "text" } },
- readOnly: { control: { type: "boolean" } },
- required: { control: { type: "boolean" } },
- size: { control: { type: "number" } },
- value: { control: { type: "number" } },
+ autofocus: { control: "boolean" },
+ disabled: { control: "boolean" },
+ hideStep: { control: "boolean" },
+ step: { control: "number" },
+ list: { control: "text" },
+ max: { control: "number" },
+ maxlength: { control: "number" },
+ min: { control: "number" },
+ minlength: { control: "number" },
+ placeholder: { control: "text" },
+ readOnly: { control: "boolean" },
+ required: { control: "boolean" },
+ size: { control: "number" },
+ value: { control: "number" },
+ valueAsNumber: { control: "number" },
+ ariaAtomic: { control: "text" },
+ ariaBusy: { control: "text" },
+ ariaControls: { control: "text" },
+ ariaCurrent: { control: "text" },
+ ariaDescribedby: { control: "text" },
+ ariaDetails: { control: "text" },
+ ariaDisabled: { control: "text" },
+ ariaErrormessage: { control: "text" },
+ ariaFlowto: { control: "text" },
+ ariaHaspopup: { control: "text" },
+ ariaHidden: { control: "text" },
+ ariaInvalid: { control: "text" },
+ ariaKeyshortcuts: { control: "text" },
+ ariaLabel: { control: "text" },
+ ariaLabelledby: { control: "text" },
+ ariaLive: { control: "text" },
+ ariaOwns: { control: "text" },
+ ariaRelevant: { control: "text" },
+ ariaRoledescription: { control: "text" },
+ storyContent: { table: { disable: true } },
},
-} as NumberFieldStoryMeta;
+} as Meta;
+
+export const NumberField: Story = renderComponent(storyTemplate).bind(
+ {}
+);
-export const NumberField = (args: NumberFieldStoryArgs) => {
- const storyFragment = new DocumentFragment();
- componentTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
-};
+export const NumberFieldInForm: Story = renderComponent(html`
+
+`).bind({});
diff --git a/packages/web-components/fast-foundation/src/picker/README.md b/packages/web-components/fast-foundation/src/picker/README.md
index 60ffbab81d1..0be5da500c9 100644
--- a/packages/web-components/fast-foundation/src/picker/README.md
+++ b/packages/web-components/fast-foundation/src/picker/README.md
@@ -169,6 +169,16 @@ export class FASTTextField extends TextField {}
+### Variables
+
+| Name | Description | Type |
+| --------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
+| `MenuPlacement` | vertical positioning values for an anchored region | `{ bottom: "bottom", bottomFill: "bottom-fill", tallest: "tallest", tallestFill: "tallest-fill", top: "top", topFill: "top-fill", }` |
+
+
+
+
+
### class: `FASTPicker`
#### Superclass
@@ -192,7 +202,7 @@ export class FASTTextField extends TextField {}
| `label` | public | `string` | | Applied to the aria-label attribute of the input element | |
| `labelledBy` | public | `string` | | Applied to the aria-labelledby attribute of the input element | |
| `placeholder` | public | `string` | | Applied to the placeholder attribute of the input element | |
-| `menuPlacement` | public | `menuConfigs` | `"bottom-fill"` | Controls menu placement | |
+| `menuPlacement` | public | `MenuPlacement` | | Controls menu placement | |
| `showLoading` | public | `boolean` | `false` | Whether to display a loading state if the menu is opened. | |
| `listItemTemplate` | public | `ViewTemplate` | | Template used to generate selected items. This is used in a repeat directive. | |
| `defaultListItemTemplate` | public | `ViewTemplate or undefined` | | Default template to use for selected items (usually specified in the component template). This is used in a repeat directive. | |
diff --git a/packages/web-components/fast-foundation/src/picker/index.ts b/packages/web-components/fast-foundation/src/picker/index.ts
index a0663d95289..815c5233273 100644
--- a/packages/web-components/fast-foundation/src/picker/index.ts
+++ b/packages/web-components/fast-foundation/src/picker/index.ts
@@ -1,10 +1,11 @@
-export * from "./picker.template.js";
-export * from "./picker.js";
-export * from "./picker-menu.template.js";
-export * from "./picker-menu.js";
-export * from "./picker-menu-option.template.js";
-export * from "./picker-menu-option.js";
-export * from "./picker-list.template.js";
-export * from "./picker-list.js";
-export * from "./picker-list-item.template.js";
export * from "./picker-list-item.js";
+export * from "./picker-list-item.template.js";
+export * from "./picker-list.js";
+export * from "./picker-list.template.js";
+export * from "./picker-menu-option.js";
+export * from "./picker-menu-option.template.js";
+export * from "./picker-menu.js";
+export * from "./picker-menu.template.js";
+export * from "./picker.js";
+export * from "./picker.options.js";
+export * from "./picker.template.js";
diff --git a/packages/web-components/fast-foundation/src/picker/picker.options.ts b/packages/web-components/fast-foundation/src/picker/picker.options.ts
new file mode 100644
index 00000000000..aa4cb403419
--- /dev/null
+++ b/packages/web-components/fast-foundation/src/picker/picker.options.ts
@@ -0,0 +1,18 @@
+/**
+ * vertical positioning values for an anchored region
+ * @beta
+ */
+export const MenuPlacement = {
+ bottom: "bottom",
+ bottomFill: "bottom-fill",
+ tallest: "tallest",
+ tallestFill: "tallest-fill",
+ top: "top",
+ topFill: "top-fill",
+} as const;
+
+/**
+ * Type for vertical positioning values for an anchored region
+ * @beta
+ */
+export type MenuPlacement = typeof MenuPlacement[keyof typeof MenuPlacement];
diff --git a/packages/web-components/fast-foundation/src/picker/picker.ts b/packages/web-components/fast-foundation/src/picker/picker.ts
index f013fc65a27..801462e2430 100644
--- a/packages/web-components/fast-foundation/src/picker/picker.ts
+++ b/packages/web-components/fast-foundation/src/picker/picker.ts
@@ -31,11 +31,12 @@ import {
FlyoutPosTop,
FlyoutPosTopFill,
} from "../anchored-region/index.js";
-import type { FASTPickerMenu } from "./picker-menu.js";
-import { FASTPickerMenuOption } from "./picker-menu-option.js";
import { FASTPickerListItem } from "./picker-list-item.js";
-import { FormAssociatedPicker } from "./picker.form-associated.js";
import type { FASTPickerList } from "./picker-list.js";
+import { FASTPickerMenuOption } from "./picker-menu-option.js";
+import type { FASTPickerMenu } from "./picker-menu.js";
+import { FormAssociatedPicker } from "./picker.form-associated.js";
+import { MenuPlacement } from "./picker.options.js";
const pickerInputTemplate: ViewTemplate = html`
`
/>
`;
-/**
- * Defines the vertical positioning options for an anchored region
- *
- * @beta
- */
-export type menuConfigs =
- | "bottom"
- | "bottom-fill"
- | "tallest"
- | "tallest-fill"
- | "top"
- | "top-fill";
-
/**
* A Picker Custom HTML Element. This is an early "alpha" version of the component.
* Developers should expect the api to evolve, breaking changes are possible.
@@ -193,7 +181,7 @@ export class FASTPicker extends FormAssociatedPicker {
* HTML Attribute: menu-placement
*/
@attr({ attribute: "menu-placement" })
- public menuPlacement: menuConfigs = "bottom-fill";
+ public menuPlacement: MenuPlacement = MenuPlacement.bottomFill;
protected menuPlacementChanged(): void {
if (this.$fastController.isConnected) {
this.updateMenuConfig();
diff --git a/packages/web-components/fast-foundation/src/picker/stories/picker.stories.ts b/packages/web-components/fast-foundation/src/picker/stories/picker.stories.ts
index 786bd9a3c1a..bc132c4b1e7 100644
--- a/packages/web-components/fast-foundation/src/picker/stories/picker.stories.ts
+++ b/packages/web-components/fast-foundation/src/picker/stories/picker.stories.ts
@@ -1,16 +1,15 @@
import { html } from "@microsoft/fast-element";
-import type { Args, Meta } from "@storybook/html";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTPicker } from "../picker.js";
+import { MenuPlacement } from "../picker.options.js";
-type PickerArgs = Args & FASTPicker;
-type PickerMeta = Meta;
-
-const storyTemplate = html`
+const storyTemplate = html>`
x.filterSelected}"
+ ?filter-query="${x => x.filterQuery}"
max-selected="${x => x.maxSelected}"
no-suggestions-text="${x => x.noSuggestionsText}"
suggestions-available-text="${x => x.suggestionsAvailableText}"
@@ -25,40 +24,31 @@ const storyTemplate = html`
export default {
title: "Picker",
args: {
- selection: "apple",
- options: "apple, orange, banana, mango, strawberry, raspberry, blueberry",
- placeholder: "Choose fruit",
- noSuggestionsText: "No such fruit",
- suggestionsAvailableText: "Found some fruit",
- loadingText: "Loading",
- label: "Fruit picker",
+ // TODO: These are always true https://github.com/microsoft/fast/issues/6311
+ filterQuery: true,
+ filterSelected: true,
},
argTypes: {
- filterSelected: { control: { type: "boolean" } },
- filterQuery: { control: { type: "boolean" } },
- maxSelected: { control: { type: "number" } },
- noSuggestionsText: { control: { type: "text" } },
- suggestionsAvailableText: { control: { type: "text" } },
- loadingText: { control: { type: "text" } },
- label: { control: { type: "text" } },
- labelledBy: { control: { type: "text" } },
- placeholder: { control: { type: "text" } },
- menuPlacement: {
- options: [
- "bottom",
- "bottom-fill",
- "tallest",
- "tallest-fill",
- "top",
- "top-fill",
- ],
- control: { type: "select" },
- },
+ filterQuery: { control: "boolean" },
+ filterSelected: { control: "boolean" },
+ label: { control: "text" },
+ labelledBy: { control: "text" },
+ loadingText: { control: "text" },
+ maxSelected: { control: "number" },
+ menuPlacement: { control: "select", options: Object.values(MenuPlacement) },
+ noSuggestionsText: { control: "text" },
+ placeholder: { control: "text" },
+ suggestionsAvailableText: { control: "text" },
},
-} as PickerMeta;
+} as Meta;
-export const Picker = (args: PickerArgs) => {
- const storyFragment = new DocumentFragment();
- storyTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
+export const Picker: Story = renderComponent(storyTemplate).bind({});
+Picker.args = {
+ label: "Fruit picker",
+ loadingText: "Loading",
+ noSuggestionsText: "No such fruit",
+ options: "apple, orange, banana, mango, strawberry, raspberry, blueberry",
+ placeholder: "Choose fruit",
+ selection: "apple",
+ suggestionsAvailableText: "Found some fruit",
};
diff --git a/packages/web-components/fast-foundation/src/progress-ring/stories/progress-ring.stories.ts b/packages/web-components/fast-foundation/src/progress-ring/stories/progress-ring.stories.ts
index 80cebad0dad..312d182dfd4 100644
--- a/packages/web-components/fast-foundation/src/progress-ring/stories/progress-ring.stories.ts
+++ b/packages/web-components/fast-foundation/src/progress-ring/stories/progress-ring.stories.ts
@@ -1,43 +1,36 @@
import { html } from "@microsoft/fast-element";
-import type { Args, Meta } from "@storybook/html";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTProgressRing } from "../progress-ring.js";
-type ProgressRingStoryArgs = Args & FASTProgressRing;
-type ProgressRingStoryMeta = Meta;
-
-const componentTemplate = html`
+const storyTemplate = html>`
x.paused}"
max="${x => x.max}"
min="${x => x.min}"
value="${x => x.value}"
- >
+ >
+ ${x => x.storyContent}
+
`;
export default {
title: "Progress/Progress Ring",
args: {
- min: 0,
- max: 100,
+ paused: false,
+ indeterminate: false,
value: 75,
},
argTypes: {
- paused: { control: { type: "boolean" } },
+ indeterminate: { control: "boolean" },
+ min: { control: "number" },
+ max: { control: "number" },
+ paused: { control: "boolean" },
+ storyContent: { table: { disable: true } },
+ value: { control: "number", if: { arg: "indeterminate", truthy: false } },
},
-} as ProgressRingStoryMeta;
-
-export const ProgressRing = (args: ProgressRingStoryArgs) => {
- const storyFragment = new DocumentFragment();
- componentTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
-};
-
-export const ProgressRingIndeterminate = ProgressRing.bind({});
-ProgressRingIndeterminate.args = {
- value: null,
-};
+} as Meta;
-export const ProgressRingPaused = ProgressRing.bind({});
-ProgressRingPaused.args = {
- paused: true,
-};
+export const ProgressRing: Story = renderComponent(storyTemplate).bind(
+ {}
+);
diff --git a/packages/web-components/fast-foundation/src/progress/base-progress.ts b/packages/web-components/fast-foundation/src/progress/base-progress.ts
index efc56e7c00d..52cd0760eb5 100644
--- a/packages/web-components/fast-foundation/src/progress/base-progress.ts
+++ b/packages/web-components/fast-foundation/src/progress/base-progress.ts
@@ -19,9 +19,7 @@ export class FASTBaseProgress extends FASTElement {
@attr({ converter: nullableNumberConverter })
public value: number | null;
protected valueChanged(): void {
- if (this.$fastController.isConnected) {
- this.updatePercentComplete();
- }
+ this.updatePercentComplete();
}
/**
diff --git a/packages/web-components/fast-foundation/src/progress/stories/progress.stories.ts b/packages/web-components/fast-foundation/src/progress/stories/progress.stories.ts
index e22e1bd854d..e512fa8b5d1 100644
--- a/packages/web-components/fast-foundation/src/progress/stories/progress.stories.ts
+++ b/packages/web-components/fast-foundation/src/progress/stories/progress.stories.ts
@@ -1,43 +1,34 @@
import { html } from "@microsoft/fast-element";
-import type { Args, Meta } from "@storybook/html";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTProgress } from "../progress.js";
-type ProgressStoryArgs = Args & FASTProgress;
-type ProgressStoryMeta = Meta;
-
-const componentTemplate = html`
+const storyTemplate = html>`
x.paused}"
max="${x => x.max}"
min="${x => x.min}"
value="${x => x.value}"
- >
+ >
+ ${x => x.storyContent}
+
`;
export default {
title: "Progress",
args: {
- min: 0,
- max: 100,
+ paused: false,
+ indeterminate: false,
value: 75,
},
argTypes: {
- paused: { control: { type: "boolean" } },
+ indeterminate: { control: "boolean" },
+ min: { control: "number" },
+ max: { control: "number" },
+ paused: { control: "boolean" },
+ storyContent: { table: { disable: true } },
+ value: { control: "number", if: { arg: "indeterminate", truthy: false } },
},
-} as ProgressStoryMeta;
-
-export const Progress = (args: ProgressStoryArgs) => {
- const storyFragment = new DocumentFragment();
- componentTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
-};
-
-export const ProgressIndeterminate = Progress.bind({});
-ProgressIndeterminate.args = {
- value: null,
-};
+} as Meta;
-export const ProgressPaused = Progress.bind({});
-ProgressPaused.args = {
- paused: true,
-};
+export const Progress: Story = renderComponent(storyTemplate).bind({});
diff --git a/packages/web-components/fast-foundation/src/radio-group/stories/radio-group.stories.ts b/packages/web-components/fast-foundation/src/radio-group/stories/radio-group.stories.ts
index 57b660212e6..af383aa5f4b 100644
--- a/packages/web-components/fast-foundation/src/radio-group/stories/radio-group.stories.ts
+++ b/packages/web-components/fast-foundation/src/radio-group/stories/radio-group.stories.ts
@@ -1,66 +1,67 @@
-import { html, repeat, when } from "@microsoft/fast-element";
+import { html, repeat } from "@microsoft/fast-element";
import { Orientation } from "@microsoft/fast-web-utilities";
-import type { Args, Meta } from "@storybook/html";
+import { storyTemplate as radioStoryTemplate } from "../../radio/stories/radio.stories.js";
+import type { Meta, Story, StoryArgs } from "../../__test__/helpers.js";
+import { renderComponent } from "../../__test__/helpers.js";
import type { FASTRadioGroup } from "../radio-group.js";
-type RadioGroupStoryArgs = Args & FASTRadioGroup;
-type RadioGroupStoryMeta = Meta;
-
-const storyTemplate = html`
-
- ${when(
- x => x.label,
- html`
-
- `
- )}
- ${repeat(
- x => x.items,
- html`
-
- ${x => x.label}
-
- `
- )}
+const storyTemplate = html>`
+ x.disabled}"
+ ?readonly="${x => x.readOnly}"
+ name="${x => x.name}"
+ orientation="${x => x.orientation}"
+ value="${x => x.value}"
+ >
+ ${x => x.storyContent}
`;
export default {
- title: "Radio/Radio Group",
+ title: "Radio Group",
args: {
- label: "Fruits",
+ disabled: false,
name: "fruits",
- items: [
- { value: "apples", label: "Apples" },
- { value: "bananas", label: "Bananas" },
- { value: "blueberries", label: "Blueberries" },
- { value: "grapefruit", label: "Grapefruit" },
- { value: "kiwi", label: "Kiwi" },
- { value: "mango", label: "Mango" },
- { value: "oranges", label: "Oranges" },
- { value: "pineapple", label: "Pineapple" },
- { value: "strawberries", label: "Strawberries" },
+ readOnly: false,
+ storyContent: html>`
+
+ ${repeat(x => x.storyItems, radioStoryTemplate)}
+ `,
+ storyItems: [
+ { storyContent: "Apples", value: "apples" },
+ { storyContent: "Bananas", value: "bananas" },
+ { storyContent: "Blueberries", value: "blueberries" },
+ { storyContent: "Grapefruit", value: "grapefruit" },
+ { storyContent: "Kiwi", value: "kiwi" },
+ { storyContent: "Mango", value: "mango" },
+ { storyContent: "Oranges", value: "oranges" },
+ { storyContent: "Pineapple", value: "pineapple" },
+ { storyContent: "Strawberries", value: "strawberries" },
],
},
argTypes: {
- orientation: {
- options: Object.values(Orientation),
- control: {
- type: "select",
- },
- },
+ disabled: { control: "boolean" },
+ name: { control: "text" },
+ orientation: { control: "radio", options: Object.values(Orientation) },
+ readOnly: { control: "boolean" },
+ storyContent: { table: { disable: true } },
+ storyItems: { control: "object" },
+ value: { control: "text" },
},
-} as RadioGroupStoryMeta;
+} as Meta;
-export const RadioGroup = (args: RadioGroupStoryArgs) => {
- const storyFragment = new DocumentFragment();
- storyTemplate.render(args, storyFragment);
- return storyFragment.firstElementChild;
-};
+export const RadioGroup: Story