forked from microsoft/fast
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add toolbar component (microsoft#4535)
* update tabbable * add key constants * add toolbar component to fast-foundation * add toolbar component to fast-components * set fast-combobox to delegate focus * add toolbar component definition * allow other keypresses to pass through radio components * allow foundation toolbar to handle foundation radio group interactions Co-authored-by: Chris Holt <chhol@microsoft.com>
- Loading branch information
1 parent
2682c27
commit c7db517
Showing
33 changed files
with
1,120 additions
and
73 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@microsoft-fast-components-8e1ee184-ecaf-4ab2-b356-b8c1a63d7c76.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "add toolbar component", | ||
"packageName": "@microsoft/fast-components", | ||
"email": "john.kreitlow@microsoft.com", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@microsoft-fast-foundation-5320083e-f688-42d5-90d5-2ce89e139936.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "add toolbar component", | ||
"packageName": "@microsoft/fast-foundation", | ||
"email": "john.kreitlow@microsoft.com", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@microsoft-fast-web-utilities-dcd289ed-20f4-4ef6-add6-8873c64c3a65.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "add key string constants", | ||
"packageName": "@microsoft/fast-web-utilities", | ||
"email": "john.kreitlow@microsoft.com", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/web-components/fast-components/src/toolbar/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# fast-toolbar | ||
|
||
An implementation of a [toolbar](https://w3c.github.io/aria-practices/#toolbar) as a web-component. | ||
|
||
For more information view the [component specification](../../../fast-foundation/src/toolbar/toolbar.spec.md). |
163 changes: 163 additions & 0 deletions
163
packages/web-components/fast-components/src/toolbar/fixtures/base.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> | ||
<defs> | ||
<symbol id="icon" viewBox="0 0 16 16"> | ||
<path | ||
d="M6.5 7.7h-1v-1h1v1zm4.1 0h-1v-1h1v1zm4.1-1v2.1h-1v2.6l-.1.6-.3.5c-.1.1-.3.3-.5.3l-.6.1H10l-3.5 3v-3H3.9l-.6-.1-.5-.3c-.1-.1-.3-.3-.3-.5l-.1-.6V8.8h-1V6.7h1V5.2l.1-.6.3-.5c.1-.1.3-.3.5-.3l.6-.1h3.6V1.9a.8.8 0 01-.4-.4L7 1V.6l.2-.3.3-.2L8 0l.4.1.3.2.3.3V1l-.1.5-.4.4v1.7h3.6l.6.1.5.3c.1.1.3.3.3.5l.1.6v1.5h1.1zm-2.1-1.5l-.2-.4-.4-.2H3.9l-.4.2-.1.4v6.2l.2.4.4.2h3.6v1.8L9.7 12h2.5l.4-.2.2-.4V5.2zM5.8 8.9l1 .7 1.2.2a5 5 0 001.2-.2l1-.7.7.7c-.4.4-.8.7-1.4.9-.5.2-1 .3-1.6.3s-1.1-.1-1.6-.3A3 3 0 015 9.6l.8-.7z" | ||
/> | ||
</symbol> | ||
</defs> | ||
</svg> | ||
|
||
<h1>Toolbar</h1> | ||
|
||
<h2>Default</h2> | ||
<fast-toolbar> | ||
<button>Button</button> | ||
<select> | ||
<option>Option 1</option> | ||
<option>Second option</option> | ||
<option>Option 3</option> | ||
</select> | ||
<label for="check-1"> | ||
<input type="checkbox" name="checkbox" id="check-1" /> | ||
Checkbox 1 | ||
</label> | ||
<label for="check-2"> | ||
<input type="checkbox" name="checkbox" id="check-2" /> | ||
Checkbox 2 | ||
</label> | ||
<label for="check-3"> | ||
<input type="checkbox" name="checkbox" id="check-3" /> | ||
Checkbox 3 | ||
</label> | ||
<input type="text" name="text" id="text-input" /> | ||
</fast-toolbar> | ||
|
||
<h2>Toolbar with slotted label</h2> | ||
<fast-toolbar id="toolbar-slotted-label"> | ||
<label slot="label">Slotted label</label> | ||
<button>One</button> | ||
<button>Two</button> | ||
<button>Three</button> | ||
</fast-toolbar> | ||
|
||
<h2>Toolbar with external label</h2> | ||
<label id="toolbar-label" for="toolbar-external-label">External label</label> | ||
<fast-toolbar id="toolbar-external-label" aria-labelledby="toolbar-label"> | ||
<button>One</button> | ||
<button>Two</button> | ||
<button>Three</button> | ||
</fast-toolbar> | ||
|
||
<h2>Toolbar with invisible label</h2> | ||
<fast-toolbar id="toolbar-invisible-label" aria-label="Invisible label"> | ||
<button>One</button> | ||
<button>Two</button> | ||
<button>Three</button> | ||
</fast-toolbar> | ||
|
||
<h2>Vertical orientation</h2> | ||
<fast-toolbar id="toolbar-vertical-orientation" orientation="vertical"> | ||
<button>One</button> | ||
<button>Two</button> | ||
<button>Three</button> | ||
</fast-toolbar> | ||
|
||
<h2>FAST components</h2> | ||
<fast-toolbar id="toolbar-fast-components"> | ||
<fast-button>Button</fast-button> | ||
<fast-radio-group> | ||
<fast-radio checked>One</fast-radio> | ||
<fast-radio>Two</fast-radio> | ||
<fast-radio>Three</fast-radio> | ||
</fast-radio-group> | ||
<fast-combobox> | ||
<fast-option>Please Please Me</fast-option> | ||
<fast-option>With The Beatles</fast-option> | ||
<fast-option>A Hard Day's Night</fast-option> | ||
<fast-option>Beatles for Sale</fast-option> | ||
<fast-option>Help!</fast-option> | ||
<fast-option>Rubber Soul</fast-option> | ||
<fast-option>Revolver</fast-option> | ||
<fast-option>Sgt. Pepper's Lonely Hearts Club Band</fast-option> | ||
<fast-option>Magical Mystery Tour</fast-option> | ||
<fast-option>The Beatles</fast-option> | ||
<fast-option>Yellow Submarine</fast-option> | ||
<fast-option>Abbey Road</fast-option> | ||
<fast-option>Let It Be</fast-option> | ||
</fast-combobox> | ||
<fast-button>Button</fast-button> | ||
<fast-select> | ||
<fast-option>Option 1</fast-option> | ||
<fast-option>Second option</fast-option> | ||
<fast-option>Option 3</fast-option> | ||
</fast-select> | ||
<fast-checkbox>Checkbox</fast-checkbox> | ||
</fast-toolbar> | ||
|
||
<h2>Disabled Elements</h2> | ||
<fast-toolbar id="toolbar-first-disabled" orientation="vertical"> | ||
<fast-checkbox disabled>One</fast-checkbox> | ||
<fast-checkbox>Two</fast-checkbox> | ||
<fast-checkbox>Three</fast-checkbox> | ||
</fast-toolbar> | ||
|
||
<fast-toolbar id="toolbar-second-disabled" orientation="vertical"> | ||
<fast-checkbox>One</fast-checkbox> | ||
<fast-checkbox disabled>Two</fast-checkbox> | ||
<fast-checkbox>Three</fast-checkbox> | ||
</fast-toolbar> | ||
|
||
<fast-toolbar id="toolbar-last-disabled" orientation="vertical"> | ||
<fast-checkbox>One</fast-checkbox> | ||
<fast-checkbox>Two</fast-checkbox> | ||
<fast-checkbox disabled>Three</fast-checkbox> | ||
</fast-toolbar> | ||
|
||
<fast-toolbar id="toolbar-last-two-disabled" orientation="vertical"> | ||
<fast-checkbox>One</fast-checkbox> | ||
<fast-checkbox disabled>Two</fast-checkbox> | ||
<fast-checkbox disabled>Three</fast-checkbox> | ||
</fast-toolbar> | ||
|
||
<fast-toolbar id="toolbar-first-last-disabled" orientation="vertical"> | ||
<fast-checkbox disabled>One</fast-checkbox> | ||
<fast-checkbox>Two</fast-checkbox> | ||
<fast-checkbox disabled>Three</fast-checkbox> | ||
</fast-toolbar> | ||
|
||
<fast-toolbar id="toolbar-first-two-disabled" orientation="vertical"> | ||
<fast-checkbox disabled>One</fast-checkbox> | ||
<fast-checkbox disabled>Two</fast-checkbox> | ||
<fast-checkbox>Three</fast-checkbox> | ||
</fast-toolbar> | ||
|
||
<fast-toolbar id="toolbar-disabled-all" orientation="vertical"> | ||
<fast-checkbox disabled>One</fast-checkbox> | ||
<fast-checkbox disabled>Two</fast-checkbox> | ||
<fast-checkbox disabled>Three</fast-checkbox> | ||
</fast-toolbar> | ||
|
||
<h2>RTL Mode</h2> | ||
<fast-toolbar id="toolbar-rtl" dir="rtl"> | ||
<fast-checkbox>One</fast-checkbox> | ||
<fast-checkbox>Two</fast-checkbox> | ||
<fast-checkbox>Three</fast-checkbox> | ||
</fast-toolbar> | ||
|
||
<fast-toolbar id="toolbar-rtl-vertical" dir="rtl" orientation="vertical"> | ||
<fast-checkbox>One</fast-checkbox> | ||
<fast-checkbox>Two</fast-checkbox> | ||
<fast-checkbox>Three</fast-checkbox> | ||
</fast-toolbar> | ||
|
||
<h2>Start/End Slots</h2> | ||
<fast-toolbar id="toolbar-start-end-slots"> | ||
<svg slot="start"><use href="#icon" /></svg> | ||
<svg slot="end"><use href="#icon" /></svg> | ||
</fast-toolbar> | ||
|
||
<fast-toolbar id="toolbar-start-end-slots-vertical" orientation="vertical"> | ||
<svg slot="start"><use href="#icon" /></svg> | ||
<svg slot="end"><use href="#icon" /></svg> | ||
</fast-toolbar> |
28 changes: 28 additions & 0 deletions
28
packages/web-components/fast-components/src/toolbar/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { customElement } from "@microsoft/fast-element"; | ||
import { Toolbar, ToolbarTemplate } from "@microsoft/fast-foundation"; | ||
import { ToolbarStyles } from "./toolbar.styles"; | ||
|
||
/** | ||
* The FAST toolbar Custom Element. Implements {@link @microsoft/fast-foundation#Toolbar}, | ||
* {@link @microsoft/fast-foundation#ToolbarTemplate} | ||
* | ||
* @public | ||
* @remarks | ||
* HTML Element: `<fast-toolbar>` | ||
* | ||
*/ | ||
@customElement({ | ||
name: "fast-toolbar", | ||
template: ToolbarTemplate, | ||
styles: ToolbarStyles, | ||
shadowOptions: { | ||
delegatesFocus: true, | ||
}, | ||
}) | ||
export class FASTToolbar extends Toolbar {} | ||
|
||
/** | ||
* Styles for Toolbar. | ||
* @public | ||
*/ | ||
export { ToolbarStyles }; |
8 changes: 8 additions & 0 deletions
8
packages/web-components/fast-components/src/toolbar/scenarios/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<template title="Default"> | ||
<fast-toolbar> | ||
<label slot="label">Toolbar</label> | ||
<fast-checkbox>Checkbox</fast-checkbox> | ||
<fast-checkbox>Checkbox</fast-checkbox> | ||
<fast-checkbox>Checkbox</fast-checkbox> | ||
</fast-toolbar> | ||
</template> |
4 changes: 4 additions & 0 deletions
4
packages/web-components/fast-components/src/toolbar/toolbar.open-ui.definition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "Toolbar", | ||
"url": "https://fast.design/docs/components/toolbar" | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/web-components/fast-components/src/toolbar/toolbar.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import "./index"; | ||
import "../button"; | ||
import "../select"; | ||
import ToolbarTemplate from "./fixtures/base.html"; | ||
|
||
export default { | ||
title: "Toolbar", | ||
}; | ||
|
||
export const Toolbar = () => ToolbarTemplate; |
Oops, something went wrong.