Skip to content

Commit 2b7a389

Browse files
chrisdholtRob Eisenberg
and
Rob Eisenberg
committed
vNext: update components to extend FoundationElement (#4570)
* support foundation element on accordion and accordion item * update anchor to use foundation element * update AnchoredRegion to extend FoundationElement * update Badge to extend FoundationElement * update breadcrumb and breadcrumb item to extend FoundationElement * update Button to extend FoundationElement * update checkbox to extend from FoundationElement * update Dialog to extend FoundationElement * update disclosure to extend FoundationElement * update divider to extend FoundationElement * update Flipper to extend FoundationElement * update horizontal scroll to extend FoundationElement * update Listbox and ListboxOption to extend FoundationElement * update combobox to extend FoundationElement * update select to extend combobox and update tests * fix listbox option styles and export * update tests (wip) * update Menu and MenuItem to extend FoundationElement * update number field to extend FoundationElement * update base name values * fix: prevent the mixin helper from copying over constructor properties * feat: fixture ergonomic improvements for foundation elements * test: fix Anchor and associated unit tests based on new system * remove incorrect tagFor usage * update radio and radiogroup * update skeleton * update slider and slider label * update switch * update tabs et all to use FoundationElement * update text area and text field to use foundation el * Update tooltip to use FoundationElement * update tests and tree item and view * remove website from lerna packages in favor of npm registry to prevent breaking changes for the time being * update progress and progress ring to use Foundation element * fixing the tests * feat: enable fixtures to handle N foundation elements and custom system * fixing tests! * Change files * fix errors in fast-website * update typings for explorer * update naming convention to lowercase fast * update imports for sites * Change files * update template names to lowercase * update style casing and apply updates to component registries * update tsdoc links for templates Co-authored-by: Rob Eisenberg <[email protected]>
1 parent aa7485c commit 2b7a389

File tree

208 files changed

+3346
-2753
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+3346
-2753
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "major",
3+
"comment": "update components to extend FoundationElement",
4+
"packageName": "@microsoft/fast-components",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "major",
3+
"comment": "update components to extend FoundationElement",
4+
"packageName": "@microsoft/fast-foundation",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "update fast-tooling references to web components",
4+
"packageName": "@microsoft/fast-tooling-react",
5+
"email": "[email protected]",
6+
"dependentChangeType": "none"
7+
}

packages/tooling/fast-tooling-react/src/form/custom-controls/control.css.utilities.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
/** @jsx h */ /* Note: Set the JSX pragma to the wrapped version of createElement */
22
import h from "../../utilities/web-components/pragma"; /* Note: Import wrapped createElement. */
3-
4-
import React from "react";
5-
import {
6-
RenderRefControlConfig,
7-
RenderSelectControlConfig,
8-
} from "./control.css.utilities.props";
93
import {
104
FASTCheckbox,
115
FASTNumberField,
@@ -14,6 +8,12 @@ import {
148
FASTTextField,
159
} from "@microsoft/fast-components";
1610
import { FASTColorPicker } from "@microsoft/fast-tooling/dist/esm/web-components";
11+
import React from "react";
12+
import {
13+
RenderRefControlConfig,
14+
RenderSelectControlConfig,
15+
} from "./control.css.utilities.props";
16+
1717
/**
1818
* Ensure tree-shaking doesn't remove these components from the bundle.
1919
*/

packages/web-components/fast-components/docs/api-report.md

Lines changed: 578 additions & 213 deletions
Large diffs are not rendered by default.

packages/web-components/fast-components/src/accordion-item/accordion-item.styles.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import {
1616
} from "../styles/recipes";
1717
import { heightNumber } from "../styles/size";
1818

19-
export const AccordionItemStyles = css`
19+
export const accordionItemStyles = (context, definition) =>
20+
css`
2021
${display("flex")} :host {
2122
box-sizing: border-box;
2223
font-family: var(--body-font);
@@ -130,19 +131,19 @@ export const AccordionItemStyles = css`
130131
z-index: 2;
131132
}
132133
`.withBehaviors(
133-
accentFillRestBehavior,
134-
neutralDividerRestBehavior,
135-
neutralForegroundActiveBehavior,
136-
neutralForegroundFocusBehavior,
137-
neutralForegroundHoverBehavior,
138-
neutralForegroundRestBehavior,
139-
neutralFocusBehavior,
140-
forcedColorsStylesheetBehavior(
141-
css`
134+
accentFillRestBehavior,
135+
neutralDividerRestBehavior,
136+
neutralForegroundActiveBehavior,
137+
neutralForegroundFocusBehavior,
138+
neutralForegroundHoverBehavior,
139+
neutralForegroundRestBehavior,
140+
neutralFocusBehavior,
141+
forcedColorsStylesheetBehavior(
142+
css`
142143
.button:${focusVisible}::before {
143144
border-color: ${SystemColors.Highlight};
144145
box-shadow: 0 0 0 calc((var(--focus-outline-width) - var(--outline-width)) * 1px) ${SystemColors.Highlight};
145146
}
146147
`
147-
)
148-
);
148+
)
149+
);

packages/web-components/fast-components/src/accordion-item/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
import { customElement } from "@microsoft/fast-element";
21
import {
32
AccordionItem,
4-
AccordionItemTemplate as template,
3+
accordionItemTemplate as template,
54
} from "@microsoft/fast-foundation";
6-
import { AccordionItemStyles as styles } from "./accordion-item.styles";
5+
import { accordionItemStyles as styles } from "./accordion-item.styles";
76

87
/**
98
* The FAST Accordion Item Element. Implements {@link @microsoft/fast-foundation#AccordionItem},
10-
* {@link @microsoft/fast-foundation#AccordionItemTemplate}
9+
* {@link @microsoft/fast-foundation#accordionItemTemplate}
1110
*
1211
*
1312
* @public
1413
* @remarks
1514
* HTML Element: \<fast-accordion-item\>
1615
*/
17-
@customElement({
18-
name: "fast-accordion-item",
16+
export const fastAccordionItem = AccordionItem.compose({
17+
baseName: "accordion-item",
1918
template,
2019
styles,
21-
})
22-
export class FASTAccordionItem extends AccordionItem {}
20+
});
2321

2422
/**
2523
* Styles for AccordionItem

packages/web-components/fast-components/src/accordion/accordion.styles.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ import {
55
neutralForegroundRestBehavior,
66
} from "../styles/recipes";
77

8-
export const AccordionStyles = css`
9-
${display("flex")} :host {
10-
box-sizing: border-box;
11-
flex-direction: column;
12-
font-family: var(--body-font);
13-
font-size: var(--type-ramp-minus-1-font-size);
14-
line-height: var(--type-ramp-minus-1-line-height);
15-
color: ${neutralForegroundRestBehavior.var};
16-
border-top: calc(var(--outline-width) * 1px) solid
17-
${neutralDividerRestBehavior.var};
18-
}
19-
`.withBehaviors(neutralDividerRestBehavior, neutralForegroundRestBehavior);
8+
export const accordionStyles = (context, definition) =>
9+
css`
10+
${display("flex")} :host {
11+
box-sizing: border-box;
12+
flex-direction: column;
13+
font-family: var(--body-font);
14+
font-size: var(--type-ramp-minus-1-font-size);
15+
line-height: var(--type-ramp-minus-1-line-height);
16+
color: ${neutralForegroundRestBehavior.var};
17+
border-top: calc(var(--outline-width) * 1px) solid
18+
${neutralDividerRestBehavior.var};
19+
}
20+
`.withBehaviors(neutralDividerRestBehavior, neutralForegroundRestBehavior);

packages/web-components/fast-components/src/accordion/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
import { customElement } from "@microsoft/fast-element";
2-
import { Accordion, AccordionTemplate as template } from "@microsoft/fast-foundation";
3-
import { AccordionStyles as styles } from "./accordion.styles";
1+
import { Accordion, accordionTemplate as template } from "@microsoft/fast-foundation";
2+
import { accordionStyles as styles } from "./accordion.styles";
43

54
export * from "../accordion-item/index";
65

76
/**
87
* The FAST Accordion Element. Implements {@link @microsoft/fast-foundation#Accordion},
9-
* {@link @microsoft/fast-foundation#AccordionTemplate}
8+
* {@link @microsoft/fast-foundation#accordionTemplate}
109
*
1110
*
1211
* @public
1312
* @remarks
1413
* HTML Element: \<fast-accordion\>
1514
*/
16-
@customElement({
17-
name: "fast-accordion",
15+
export const fastAccordion = Accordion.compose({
16+
baseName: "accordion",
1817
template,
1918
styles,
20-
})
21-
export class FASTAccordion extends Accordion {}
19+
});
2220

2321
/**
2422
* Styles for Accordion

packages/web-components/fast-components/src/anchor/anchor.styles.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ import {
99
} from "../styles/index";
1010
import { appearanceBehavior } from "../utilities/behaviors";
1111

12-
export const AnchorStyles = css`
13-
${BaseButtonStyles}
14-
`.withBehaviors(
15-
appearanceBehavior("accent", AccentButtonStyles),
16-
appearanceBehavior("hypertext", HypertextStyles),
17-
appearanceBehavior("lightweight", LightweightButtonStyles),
18-
appearanceBehavior("outline", OutlineButtonStyles),
19-
appearanceBehavior("stealth", StealthButtonStyles)
20-
);
12+
export const anchorStyles = (context, definition) =>
13+
css`
14+
${BaseButtonStyles}
15+
`.withBehaviors(
16+
appearanceBehavior("accent", AccentButtonStyles),
17+
appearanceBehavior("hypertext", HypertextStyles),
18+
appearanceBehavior("lightweight", LightweightButtonStyles),
19+
appearanceBehavior("outline", OutlineButtonStyles),
20+
appearanceBehavior("stealth", StealthButtonStyles)
21+
);

packages/web-components/fast-components/src/anchor/index.ts

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { attr, customElement } from "@microsoft/fast-element";
2-
import { Anchor, AnchorTemplate as template } from "@microsoft/fast-foundation";
1+
import { attr } from "@microsoft/fast-element";
2+
import {
3+
Anchor as FoundationAnchor,
4+
anchorTemplate as template,
5+
} from "@microsoft/fast-foundation";
36
import { ButtonAppearance } from "../button";
4-
import { AnchorStyles as styles } from "./anchor.styles";
7+
import { anchorStyles as styles } from "./anchor.styles";
58

69
/**
710
* Types of anchor appearance.
@@ -10,25 +13,10 @@ import { AnchorStyles as styles } from "./anchor.styles";
1013
export type AnchorAppearance = ButtonAppearance | "hypertext";
1114

1215
/**
13-
* The FAST Anchor Element. Implements {@link @microsoft/fast-foundation#Anchor},
14-
* {@link @microsoft/fast-foundation#AnchorTemplate}
15-
*
16-
*
17-
* @public
18-
* @remarks
19-
* HTML Element: \<fast-anchor\>
20-
*
21-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/delegatesFocus | delegatesFocus}
16+
* The FAST components version of Anchor
17+
* @internal
2218
*/
23-
@customElement({
24-
name: "fast-anchor",
25-
template,
26-
styles,
27-
shadowOptions: {
28-
delegatesFocus: true,
29-
},
30-
})
31-
export class FASTAnchor extends Anchor {
19+
export class Anchor extends FoundationAnchor {
3220
/**
3321
* The appearance the anchor should have.
3422
*
@@ -79,3 +67,23 @@ export class FASTAnchor extends Anchor {
7967
* @public
8068
*/
8169
export const AnchorStyles = styles;
70+
71+
/**
72+
* The FAST Anchor Element. Implements {@link @microsoft/fast-foundation#Anchor},
73+
* {@link @microsoft/fast-foundation#anchorTemplate}
74+
*
75+
*
76+
* @public
77+
* @remarks
78+
* HTML Element: \<fast-anchor\>
79+
*
80+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/delegatesFocus | delegatesFocus}
81+
*/
82+
export const fastAnchor = Anchor.compose({
83+
baseName: "anchor",
84+
template,
85+
styles,
86+
shadowOptions: {
87+
delegatesFocus: true,
88+
},
89+
});

packages/web-components/fast-components/src/anchored-region/anchored-region.stories.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Direction, RtlScrollConverter } from "@microsoft/fast-web-utilities";
22
import addons from "@storybook/addons";
33
import { STORY_RENDERED } from "@storybook/core-events";
4+
import { AnchoredRegion as FoundationAnchoredRegion } from "@microsoft/fast-foundation";
45
import AnchoredRegionTemplate from "./fixtures/base.html";
5-
import type { FASTAnchoredRegion } from "./index";
66
import "./index";
77

88
let scalingViewportPreviousXValue: number = 250;
@@ -67,14 +67,14 @@ addons.getChannel().addListener(STORY_RENDERED, (name: string) => {
6767

6868
const regionScalingUpdate = document.getElementById(
6969
"region-scaling-update"
70-
) as FASTAnchoredRegion;
70+
) as FoundationAnchoredRegion;
7171
document
7272
.getElementById("viewport-scaling-update")!
7373
.addEventListener("scroll", () => regionScalingUpdate.update());
7474

7575
const regionScalingOffset = document.getElementById(
7676
"region-scaling-offset"
77-
) as FASTAnchoredRegion;
77+
) as FoundationAnchoredRegion;
7878
document
7979
.getElementById("viewport-scaling-offset")
8080
?.addEventListener("scroll", (e: MouseEvent) => {

packages/web-components/fast-components/src/anchored-region/anchored-region.styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { css } from "@microsoft/fast-element";
22

3-
export const AnchoredRegionStyles = css`
3+
export const anchoredRegionStyles = (context, definition) => css`
44
:host {
55
contain: layout;
66
display: block;

packages/web-components/fast-components/src/anchored-region/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
import { customElement } from "@microsoft/fast-element";
21
import {
32
AnchoredRegion,
4-
AnchoredRegionTemplate as template,
3+
anchoredRegionTemplate as template,
54
} from "@microsoft/fast-foundation";
6-
import { AnchoredRegionStyles as styles } from "./anchored-region.styles";
5+
import { anchoredRegionStyles as styles } from "./anchored-region.styles";
76

87
/**
98
* The FAST AnchoredRegion Element. Implements {@link @microsoft/fast-foundation#AnchoredRegion},
10-
* {@link @microsoft/fast-foundation#AnchoredRegionTemplate}
9+
* {@link @microsoft/fast-foundation#anchoredRegionTemplate}
1110
*
1211
*
1312
* @beta
1413
* @remarks
1514
* HTML Element: \<fast-anchored-region\>
1615
*/
17-
@customElement({
18-
name: "fast-anchored-region",
16+
export const fastAnchoredRegion = AnchoredRegion.compose({
17+
baseName: "anchored-region",
1918
template,
2019
styles,
21-
})
22-
export class FASTAnchoredRegion extends AnchoredRegion {}
20+
});
2321

2422
/**
2523
* Styles for AnchoredRegion

packages/web-components/fast-components/src/badge/badge.styles.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { css } from "@microsoft/fast-element";
22
import { display } from "@microsoft/fast-foundation";
33
import { accentForegroundRestBehavior, heightNumber } from "../styles/index";
44

5-
export const BadgeStyles = css`
5+
export const badgeStyles = (context, definition) =>
6+
css`
67
${display("inline-block")} :host {
78
box-sizing: border-box;
89
font-family: var(--body-font);

packages/web-components/fast-components/src/badge/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
import { customElement } from "@microsoft/fast-element";
2-
import { Badge, BadgeTemplate as template } from "@microsoft/fast-foundation";
3-
import { BadgeStyles as styles } from "./badge.styles";
1+
import { Badge, badgeTemplate as template } from "@microsoft/fast-foundation";
2+
import { badgeStyles as styles } from "./badge.styles";
43

54
/**
65
* The FAST Badge Element. Implements {@link @microsoft/fast-foundation#Badge},
7-
* {@link @microsoft/fast-foundation#BadgeTemplate}
6+
* {@link @microsoft/fast-foundation#badgeTemplate}
87
*
98
*
109
* @public
1110
* @remarks
1211
* HTML Element: \<fast-badge\>
1312
*/
14-
@customElement({
15-
name: "fast-badge",
13+
export const fastBadge = Badge.compose({
14+
baseName: "badge",
1615
template,
1716
styles,
18-
})
19-
export class FASTBadge extends Badge {}
17+
});
2018

2119
/**
2220
* Styles for Badge

0 commit comments

Comments
 (0)