-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Foundation: Update Badge and Breadcrumb templates (#6797)
- Loading branch information
Showing
19 changed files
with
173 additions
and
38 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@microsoft-fast-foundation-775d9d2b-f1b0-48d0-a75a-83f738bd0ea8.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": "prerelease", | ||
"comment": "Update Badge and Breadcrumb templates (https://github.com/microsoft/fast/pull/6797)", | ||
"packageName": "@microsoft/fast-foundation", | ||
"email": "[email protected]", | ||
"dependentChangeType": "prerelease" | ||
} |
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
15 changes: 10 additions & 5 deletions
15
packages/web-components/fast-foundation/src/badge/badge.template.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 |
---|---|---|
@@ -1,14 +1,19 @@ | ||
import { ElementViewTemplate, html } from "@microsoft/fast-element"; | ||
import type { FASTBadge } from "./badge.js"; | ||
import { endSlotTemplate, startSlotTemplate } from "../patterns/index.js"; | ||
import type { BadgeOptions, FASTBadge } from "./badge.js"; | ||
|
||
/** | ||
* The template for the {@link @microsoft/fast-foundation#FASTBadge} component. | ||
* The template for the {@link @microsoft/fast-foundation#(FASTBadge:class)} component. | ||
* @public | ||
*/ | ||
export function badgeTemplate<T extends FASTBadge>(): ElementViewTemplate<T> { | ||
export function badgeTemplate<T extends FASTBadge>( | ||
options: BadgeOptions = {} | ||
): ElementViewTemplate<T> { | ||
return html<T>` | ||
<div class="control" part="control"> | ||
${startSlotTemplate(options)} | ||
<span class="content" part="content"> | ||
<slot></slot> | ||
</div> | ||
</span> | ||
${endSlotTemplate(options)} | ||
`; | ||
} |
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 |
---|---|---|
@@ -1,10 +1,30 @@ | ||
import { FASTElement } from "@microsoft/fast-element"; | ||
import { StartEnd } from "../patterns/start-end.js"; | ||
import type { StartEndOptions } from "../patterns/start-end.js"; | ||
import { applyMixins } from "../utilities/apply-mixins.js"; | ||
|
||
/** | ||
* Badge configuration options | ||
* @public | ||
*/ | ||
export type BadgeOptions = StartEndOptions; | ||
|
||
/** | ||
* A Badge Custom HTML Element. | ||
* @slot start - Content which can be provided before the default slot | ||
* @slot end - Content which can be provided after the default slot | ||
* @slot - The default slot for the badge | ||
* @csspart control - The element representing the badge, which wraps the default slot | ||
* @csspart content - The element wrapping the default slot | ||
* | ||
* @public | ||
*/ | ||
export class FASTBadge extends FASTElement {} | ||
|
||
/** | ||
* Mark internal because exporting class and interface of the same name | ||
* confuses API documenter. | ||
* TODO: https://github.com/microsoft/fast/issues/3317 | ||
* @internal | ||
*/ | ||
export interface FASTBadge extends StartEnd {} | ||
applyMixins(FASTBadge, StartEnd); |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { badgeTemplate } from "./badge.template.js"; | ||
export { FASTBadge } from "./badge.js"; | ||
export { BadgeOptions, FASTBadge } from "./badge.js"; |
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
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
15 changes: 10 additions & 5 deletions
15
packages/web-components/fast-foundation/src/breadcrumb/breadcrumb.template.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 |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import { elements, ElementViewTemplate, html, slotted } from "@microsoft/fast-element"; | ||
import type { FASTBreadcrumb } from "./breadcrumb.js"; | ||
import { endSlotTemplate, startSlotTemplate } from "../patterns/index.js"; | ||
import type { BreadcrumbOptions, FASTBreadcrumb } from "./breadcrumb.js"; | ||
|
||
/** | ||
* The template for the {@link @microsoft/fast-foundation#FASTBreadcrumb} component. | ||
* The template for the {@link @microsoft/fast-foundation#(FASTBreadcrumb:class)} component. | ||
* @public | ||
*/ | ||
export function breadcrumbTemplate<T extends FASTBreadcrumb>(): ElementViewTemplate<T> { | ||
export function breadcrumbTemplate<T extends FASTBreadcrumb>( | ||
options: BreadcrumbOptions = {} | ||
): ElementViewTemplate<T> { | ||
return html<T>` | ||
<template role="navigation"> | ||
<div role="list" class="list" part="list"> | ||
${startSlotTemplate(options)} | ||
<span role="list" class="list" part="list"> | ||
<slot | ||
${slotted({ property: "slottedBreadcrumbItems", filter: elements() })} | ||
></slot> | ||
</div> | ||
</span> | ||
${endSlotTemplate(options)} | ||
</template> | ||
`; | ||
} |
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
2 changes: 1 addition & 1 deletion
2
packages/web-components/fast-foundation/src/breadcrumb/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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { breadcrumbTemplate } from "./breadcrumb.template.js"; | ||
export { FASTBreadcrumb } from "./breadcrumb.js"; | ||
export { BreadcrumbOptions, FASTBreadcrumb } from "./breadcrumb.js"; |
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
Oops, something went wrong.