From 7317b4169dd48febba5f8758228cd69eae1bedc5 Mon Sep 17 00:00:00 2001 From: Chris Holt Date: Tue, 16 Jun 2020 19:53:08 -0700 Subject: [PATCH] chore: fix broken ui in fast-website, various content fixes, update to use new color vars (#3324) * fix regression where buttons went full width on section headers * update cstyles to use behavior vars and fix card regression due to inheritance * add aria-labels for content * update api docs --- sites/fast-website/package.json | 6 +- .../card-section/card-section.styles.ts | 2 +- .../color-swatch/color-swatch.styles.ts | 15 +- .../color-swatch/color-swatch.template.ts | 2 +- .../components/color-swatch/color-swatch.ts | 2 +- .../content-placement-container.styles.ts | 16 +- .../content-placement.styles.ts | 1 + .../fast-frame/fast-frame.styles.ts | 30 +- .../fast-frame/fast-frame.template.ts | 14 +- .../feature-card/feature-card.styles.ts | 3 +- .../components/feature-card/feature-card.ts | 4 +- .../navigation/navigation.styles.ts | 2 +- .../section-header/section-header.styles.ts | 3 +- .../side-navigation/side-navigation.styles.ts | 6 +- sites/fast-website/src/public/index.html | 4 +- sites/website/docusaurus.config.js | 3 +- sites/website/package.json | 6 +- .../src/docs/api/fast-foundation.api.json | 2362 ++++++++++++++--- yarn.lock | 5 - 19 files changed, 2100 insertions(+), 386 deletions(-) diff --git a/sites/fast-website/package.json b/sites/fast-website/package.json index ab4af1b7a5f..107eb63cc03 100644 --- a/sites/fast-website/package.json +++ b/sites/fast-website/package.json @@ -6,10 +6,10 @@ "private": true, "license": "MIT", "devDependencies": { - "@microsoft/fast-element": "^0.10.2", - "@microsoft/fast-foundation": "^1.1.2", + "@microsoft/fast-element": "^0.11.0", + "@microsoft/fast-foundation": "^1.2.0", "@microsoft/fast-web-utilities": "^4.5.1", - "@microsoft/fast-components": "^1.1.2", + "@microsoft/fast-components": "^1.2.0", "babel-core": "^6.26.3", "babel-loader": "^8.1.0", "babel-preset-env": "^1.7.0", diff --git a/sites/fast-website/src/app/components/card-section/card-section.styles.ts b/sites/fast-website/src/app/components/card-section/card-section.styles.ts index 1022a5d4748..ff4e80f4477 100644 --- a/sites/fast-website/src/app/components/card-section/card-section.styles.ts +++ b/sites/fast-website/src/app/components/card-section/card-section.styles.ts @@ -27,7 +27,7 @@ export const CardSectionStyles = css` :host ::slotted(site-feature-card:focus-within) { cursor: pointer; color: currentColor; - background-color: var(--neutral-fill-hover); + background-color: ${neutralFillHoverBehavior.var}; filter: saturate(1); } `.withBehaviors(neutralFillHoverBehavior); diff --git a/sites/fast-website/src/app/components/color-swatch/color-swatch.styles.ts b/sites/fast-website/src/app/components/color-swatch/color-swatch.styles.ts index bf709104251..04840eb9d9d 100644 --- a/sites/fast-website/src/app/components/color-swatch/color-swatch.styles.ts +++ b/sites/fast-website/src/app/components/color-swatch/color-swatch.styles.ts @@ -2,6 +2,7 @@ import { css } from "@microsoft/fast-element"; import { neutralFillInputHoverBehavior, neutralFillInputRestBehavior, + neutralFocusBehavior, neutralOutlineHoverBehavior, neutralOutlineRestBehavior, } from "@microsoft/fast-components"; @@ -38,18 +39,18 @@ ${display("inline-flex")} :host { height: calc(var(--input-size) * 1px); box-sizing: border-box; border-radius: calc(var(--corner-radius) * 1px); - border: calc(var(--outline-width) * 1px) solid var(--neutral-outline-rest); + border: calc(var(--outline-width) * 1px) solid ${neutralOutlineRestBehavior.var}; outline: none; cursor: pointer; } -.label__hidden { +.label-hidden { display: none; } .label { font-family: var(--body-font); - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; ${ /* Need to discuss with Brian how HorizontalSpacingNumber can work. https://github.com/microsoft/fast-dna/issues/2766 */ "" } padding-inline-start: calc(var(--design-unit) * 2px + 2px); @@ -69,18 +70,18 @@ ${display("inline-flex")} :host { border-radius: calc(var(--corner-radius) * 1px); display: inline-block; flex-shrink: 0; - border: 1px solid var(--neutral-foreground-rest); + border: 1px solid ${neutralForegroundRestBehavior.var}; opacity: 0; pointer-events: none; } .control:hover { - border-color: var(--neutral-outline-hover); + border-color: ${neutralOutlineHoverBehavior.var}; } :host(:${focusVisible}) .control { - box-shadow: 0 0 0 1px var(--neutral-focus) inset; - border-color: var(--neutral-focus); + box-shadow: 0 0 0 1px ${neutralFocusBehavior.var} inset; + border-color: ${neutralFocusBehavior.var}; } :host(.disabled) .label, diff --git a/sites/fast-website/src/app/components/color-swatch/color-swatch.template.ts b/sites/fast-website/src/app/components/color-swatch/color-swatch.template.ts index f54067a5777..87f0f2e05c5 100644 --- a/sites/fast-website/src/app/components/color-swatch/color-swatch.template.ts +++ b/sites/fast-website/src/app/components/color-swatch/color-swatch.template.ts @@ -23,7 +23,7 @@ export const ColorSwatchTemplate = html` class="${x => x.defaultSlottedNodes && x.defaultSlottedNodes.length ? "label" - : "label label__hidden"}" + : "label label-hidden"}" > diff --git a/sites/fast-website/src/app/components/color-swatch/color-swatch.ts b/sites/fast-website/src/app/components/color-swatch/color-swatch.ts index b6b0e17adc0..3b8f6709a79 100644 --- a/sites/fast-website/src/app/components/color-swatch/color-swatch.ts +++ b/sites/fast-website/src/app/components/color-swatch/color-swatch.ts @@ -1,4 +1,4 @@ -import { attr, observable } from "@microsoft/fast-element"; +import { attr, observable, FASTElement } from "@microsoft/fast-element"; import { FASTRadio } from "@microsoft/fast-components"; export class ColorSwatch extends FASTRadio { diff --git a/sites/fast-website/src/app/components/content-placement-container/content-placement-container.styles.ts b/sites/fast-website/src/app/components/content-placement-container/content-placement-container.styles.ts index 7029a1b51d6..3c3d38971ed 100644 --- a/sites/fast-website/src/app/components/content-placement-container/content-placement-container.styles.ts +++ b/sites/fast-website/src/app/components/content-placement-container/content-placement-container.styles.ts @@ -47,7 +47,7 @@ export const ContentPlacementContainerStyles = css` :host([section="feature"]) site-feature-card:hover :first-child::before, :host([section="feature"]) site-feature-card:focus-within :first-child::before { - color: var(--accent-foreground-rest); + color: ${accentForegroundRestBehavior.var}; } /* end */ @@ -60,7 +60,7 @@ export const ContentPlacementContainerStyles = css` :host([section="community"]:focus-within) site-content-placement, :host([section="community"]:hover) site-content-placement ::part(content), :host([section="community"]:focus-within) site-content-placement ::part(content) { - color: var(--neutral-foreground-hint); + color: ${neutralForegroundHintBehavior.var}; } :host([section="feature"]:hover) site-feature-card, @@ -70,8 +70,8 @@ export const ContentPlacementContainerStyles = css` :host([section="feature"]) site-feature-card:hover, :host([section="feature"]) site-feature-card:focus-within { - color: var(--neutral-foreground-rest); - background: var(--neutral-fill-focus); + color: ${neutralForegroundRestBehavior.var}; + background: ${neutralFillFocusBehavior.var}; cursor: pointer; filter: saturate(1); } @@ -80,7 +80,7 @@ export const ContentPlacementContainerStyles = css` :host([section="community"]) site-content-placement:focus-within { --elevation: 4; cursor: pointer; - background: var(--neutral-fill-focus); + background: ${neutralFillFocusBehavior.var}; border-radius: calc(var(--corner-radius) * 1px); color: currentColor; ${elevation} @@ -88,13 +88,13 @@ export const ContentPlacementContainerStyles = css` :host([section="community"]) site-content-placement:hover ::part(content), :host([section="community"]) site-content-placement:focus-within ::part(content) { - color: var(--accent-foreground-rest); + color: ${accentForegroundRestBehavior.var}; } /* end */ .headerSubscript { - color: var(--neutral-foreground-hint); + color: ${neutralForegroundHintBehavior.var}; font-size: var(--type-ramp-minus-1-font-size); } @@ -133,7 +133,7 @@ export const ContentPlacementContainerStyles = css` justify-content: space-between; } :host([section="feature"]) site-feature-card :first-child::before { - color: var(--accent-foreground-rest); + color: ${accentForegroundRestBehavior.var}; } } `.withBehaviors( diff --git a/sites/fast-website/src/app/components/content-placement/content-placement.styles.ts b/sites/fast-website/src/app/components/content-placement/content-placement.styles.ts index 540a252411d..8bb3298fb20 100644 --- a/sites/fast-website/src/app/components/content-placement/content-placement.styles.ts +++ b/sites/fast-website/src/app/components/content-placement/content-placement.styles.ts @@ -48,6 +48,7 @@ export const ContentPlacementStyles = css` fast-card ::slotted([slot="action"]) { margin-top: calc(var(--design-unit) * 2px); + align-self: start; } fast-card:hover .contentPlacement_icon, diff --git a/sites/fast-website/src/app/components/fast-frame/fast-frame.styles.ts b/sites/fast-website/src/app/components/fast-frame/fast-frame.styles.ts index bd424399bf9..91796999448 100644 --- a/sites/fast-website/src/app/components/fast-frame/fast-frame.styles.ts +++ b/sites/fast-website/src/app/components/fast-frame/fast-frame.styles.ts @@ -14,7 +14,7 @@ export const FastFrameStyles = css` ${display("block")} :host { flex-direction: column; font-family: var(--body-font); - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; box-sizing: border-box; text-align: center; width: 100%; @@ -44,7 +44,7 @@ export const FastFrameStyles = css` flex-direction: column; width: 100%; text-align: start; - background: var(--neutral-fill-card-rest); + background: ${neutralFillCardRestBehavior.var}; padding: calc(var(--gutter) * 2px); } @@ -70,7 +70,7 @@ export const FastFrameStyles = css` .content h1 { font-size: var(--type-ramp-minus-1-font-size); line-height: var(--type-ramp-base-line-height); - color: var(--neutral-foreground-hint); + color: ${neutralForegroundHintBehavior.var}; margin: 0; margin-bottom: 15px; font-weight: bold; @@ -78,7 +78,7 @@ export const FastFrameStyles = css` } .content-heading-highlight { - color: var(--accent-foreground-rest); + color: ${accentForegroundRestBehavior.var}; } .content h2 { @@ -94,7 +94,7 @@ export const FastFrameStyles = css` grid-gap: calc(var(--gutter) * 2px); grid-template-columns: auto 300px; padding: calc(var(--gutter) * 2px); - background: var(--neutral-fill-card-rest); + background: ${neutralFillCardRestBehavior.var}; position: relative; border-radius: 0 calc(var(--corner-radius) * 1px) calc(var(--corner-radius) * 1px) 0; } @@ -112,7 +112,7 @@ export const FastFrameStyles = css` flex-direction: column; padding: calc(var(--gutter) * 1px); text-align: start; - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; } .badge { @@ -150,7 +150,7 @@ export const FastFrameStyles = css` display: grid; grid-template-columns: auto 1fr; text-align: start; - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; } .checkbox { @@ -183,7 +183,7 @@ export const FastFrameStyles = css` .sample-control-icon { width: 21px; height: 21px; - background-color: var(--accent-fill-rest); + background-color: ${accentFillRestBehavior.var}; border-radius: calc(var(--corner-radius) * 1px); } @@ -235,8 +235,8 @@ export const FastFrameStyles = css` } fast-badge { - --badge-fill-primary: var(--accent-fill-rest); - --badge-color-primary: var(--neutral-foreground-rest); + --badge-fill-primary: ${accentFillRestBehavior.var}; + --badge-color-primary: ${neutralForegroundRestBehavior.var}; } fast-slider { @@ -244,7 +244,7 @@ export const FastFrameStyles = css` } fast-tab-panel { - background: var(--neutral-fill-card-rest); + background: ${neutralFillCardRestBehavior.var}; height: 100%; } @@ -264,7 +264,7 @@ export const FastFrameStyles = css` fast-slider-label { font-size: var(--type-ramp-minus-2-font-size); - color: var(--neutral-foreground-hint); + color: ${neutralForegroundHintBehavior.var}; } @media screen and (max-width: 1330px) { @@ -301,7 +301,7 @@ export const FastFrameStyles = css` border-radius: calc(var(--corner-radius) * 1px); } - .preview__expanded { + .preview-expanded { transition: right .5s ease-in-out; right: -10%; } @@ -317,7 +317,7 @@ export const FastFrameStyles = css` visibility: visible; } - .tab-panel__expanded { + .tab-panel-expanded { opacity: 0; transition: opacity .5s ease-in-out; } @@ -335,7 +335,7 @@ export const FastFrameStyles = css` border-radius: calc(var(--corner-radius) * 1px); } - .preview__expanded { + .preview-expanded { right: -5%; } diff --git a/sites/fast-website/src/app/components/fast-frame/fast-frame.template.ts b/sites/fast-website/src/app/components/fast-frame/fast-frame.template.ts index 3ad4b9f3760..e86583ec1ba 100644 --- a/sites/fast-website/src/app/components/fast-frame/fast-frame.template.ts +++ b/sites/fast-website/src/app/components/fast-frame/fast-frame.template.ts @@ -20,7 +20,7 @@ export const FastFrameTemplate = html` ${SwatchesIcon} ${ScreenIcon} + x.expanded ? "tab-panel-expanded" : ""}">

Fast Frame Dark Mode

Pre-built for both light and dark modes

@@ -42,7 +42,7 @@ export const FastFrameTemplate = html`
+ x.expanded ? "tab-panel-expanded" : ""}">

Fast Frame Colors

Pre-existing color you can customize

@@ -124,7 +124,7 @@ export const FastFrameTemplate = html`
+ x.expanded ? "tab-panel-expanded" : ""}">

Fast Frame Styles

Adjust style settings on the fly

@@ -182,7 +182,7 @@ export const FastFrameTemplate = html`
+ x.expanded ? "tab-panel-expanded" : ""}">

Fast Frame Density

Quickly change and modify your layout

@@ -268,7 +268,7 @@ export const FastFrameTemplate = html` Label
- ${ShareIcon} - ${ContextIcon}
diff --git a/sites/fast-website/src/app/components/feature-card/feature-card.styles.ts b/sites/fast-website/src/app/components/feature-card/feature-card.styles.ts index 838a8ce3891..3e5c4d706b4 100644 --- a/sites/fast-website/src/app/components/feature-card/feature-card.styles.ts +++ b/sites/fast-website/src/app/components/feature-card/feature-card.styles.ts @@ -1,5 +1,4 @@ import { css } from "@microsoft/fast-element"; -import { neutralForegroundRestBehavior } from "@microsoft/fast-components"; import { display } from "@microsoft/fast-foundation"; export const FeatureCardStyles = css` @@ -69,4 +68,4 @@ export const FeatureCardStyles = css` max-width: 600px; } } -`.withBehaviors(neutralForegroundRestBehavior); +`; diff --git a/sites/fast-website/src/app/components/feature-card/feature-card.ts b/sites/fast-website/src/app/components/feature-card/feature-card.ts index 96243c635d5..a2c4d214781 100644 --- a/sites/fast-website/src/app/components/feature-card/feature-card.ts +++ b/sites/fast-website/src/app/components/feature-card/feature-card.ts @@ -1,3 +1,3 @@ -import { FASTCard as Card } from "@microsoft/fast-components"; +import { FASTElement } from "@microsoft/fast-element"; -export class FeatureCard extends Card {} +export class FeatureCard extends FASTElement {} diff --git a/sites/fast-website/src/app/components/navigation/navigation.styles.ts b/sites/fast-website/src/app/components/navigation/navigation.styles.ts index 370099e8eb0..0ae51a6a41c 100644 --- a/sites/fast-website/src/app/components/navigation/navigation.styles.ts +++ b/sites/fast-website/src/app/components/navigation/navigation.styles.ts @@ -6,7 +6,7 @@ export const NavigationStyles = css` ${display("grid")} :host { grid-template-columns: auto 1fr auto; font-family: var(--body-font); - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; box-sizing: border-box; width: 100%; } diff --git a/sites/fast-website/src/app/components/section-header/section-header.styles.ts b/sites/fast-website/src/app/components/section-header/section-header.styles.ts index a2dfa21175c..8c06de1870f 100755 --- a/sites/fast-website/src/app/components/section-header/section-header.styles.ts +++ b/sites/fast-website/src/app/components/section-header/section-header.styles.ts @@ -4,9 +4,10 @@ import { css } from "@microsoft/fast-element"; export const SectionHeaderStyles = css` ${display("flex")} :host { + align-items: center; flex-direction: column; font-family: var(--body-font); - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; box-sizing: border-box; text-align: center; } diff --git a/sites/fast-website/src/app/components/side-navigation/side-navigation.styles.ts b/sites/fast-website/src/app/components/side-navigation/side-navigation.styles.ts index af679c21382..78dd9df4fdc 100644 --- a/sites/fast-website/src/app/components/side-navigation/side-navigation.styles.ts +++ b/sites/fast-website/src/app/components/side-navigation/side-navigation.styles.ts @@ -36,19 +36,19 @@ export const SideNavigationStyles = css` .scroll-indicator { height: var(--design-unit-large); width: calc(var(--design-unit) * 1px); - background-color: var(--neutral-foreground-rest); + background-color: ${neutralForegroundRestBehavior.var}; border-radius: calc(var(--corner-radius) * 1px); margin: 0 var(--design-unit-large); } a:hover .scroll-indicator { height: var(--engaged-height); - background-color: var(--accent-foreground-hover); + background-color: ${accentForegroundHoverBehavior.var}; } .scroll-indicator-active { height: var(--engaged-height); - background-color: var(--accent-foreground-active); + background-color: ${accentForegroundActiveBehavior.var}; } `.withBehaviors( accentForegroundActiveBehavior, diff --git a/sites/fast-website/src/public/index.html b/sites/fast-website/src/public/index.html index c9d0bf8fb9a..e9aac217729 100644 --- a/sites/fast-website/src/public/index.html +++ b/sites/fast-website/src/public/index.html @@ -15,7 +15,7 @@
- -