diff --git a/packages/web-components/fast-components-msft/src/accordion/accordion-item/accordion-item.styles.ts b/packages/web-components/fast-components-msft/src/accordion/accordion-item/accordion-item.styles.ts index 4ace01f827f..3e82ff7bf22 100644 --- a/packages/web-components/fast-components-msft/src/accordion/accordion-item/accordion-item.styles.ts +++ b/packages/web-components/fast-components-msft/src/accordion/accordion-item/accordion-item.styles.ts @@ -4,14 +4,15 @@ import { focusVisible, forcedColorsStylesheetBehavior, } from "@microsoft/fast-foundation"; +import { SystemColors } from "@microsoft/fast-web-utilities"; import { neutralDividerRestBehavior, neutralFocusBehavior, neutralForegroundActiveBehavior, neutralForegroundFocusBehavior, + neutralForegroundHoverBehavior, neutralForegroundRestBehavior, } from "../../styles/"; -import { SystemColors } from "@microsoft/fast-web-utilities"; import { heightNumber } from "../../styles/size"; export const AccordionItemStyles = css` @@ -21,7 +22,9 @@ export const AccordionItemStyles = css` flex-direction: column; font-size: var(--type-ramp-minus-1-font-size); line-height: var(--type-ramp-minus-1-line-height); - border-bottom: calc(var(--outline-width) * 1px) solid var(--neutral-divider-rest); + border-bottom: calc(var(--outline-width) * 1px) solid ${ + neutralDividerRestBehavior.var + }; } .region { @@ -46,16 +49,16 @@ export const AccordionItemStyles = css` padding: 0 calc((6 + (var(--design-unit) * 2 * var(--density))) * 1px); text-align: left; height: calc(${heightNumber} * 1px); - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; cursor: pointer; } .button:hover { - color: var(--neutral-foreground-hover); + color: ${neutralForegroundHoverBehavior.var}; } .button:active { - color: var(--neutral-foreground-active); + color: ${neutralForegroundActiveBehavior.var}; } .button::before { @@ -71,9 +74,9 @@ export const AccordionItemStyles = css` .button:${focusVisible}::before { outline: none; - border: calc(var(--outline-width) * 1px) solid var(--neutral-focus); + border: calc(var(--outline-width) * 1px) solid ${neutralFocusBehavior.var}; box-shadow: 0 0 0 calc((var(--focus-outline-width) - var(--outline-width)) * 1px) - var(--neutral-focus); + ${neutralFocusBehavior.var}; } :host(.expanded) .region { @@ -125,6 +128,7 @@ export const AccordionItemStyles = css` neutralForegroundActiveBehavior, neutralForegroundFocusBehavior, neutralForegroundRestBehavior, + neutralForegroundHoverBehavior, neutralFocusBehavior, forcedColorsStylesheetBehavior( css` diff --git a/packages/web-components/fast-components-msft/src/accordion/accordion.styles.ts b/packages/web-components/fast-components-msft/src/accordion/accordion.styles.ts index 9b4b1748ad5..bb38dcf488b 100644 --- a/packages/web-components/fast-components-msft/src/accordion/accordion.styles.ts +++ b/packages/web-components/fast-components-msft/src/accordion/accordion.styles.ts @@ -13,8 +13,9 @@ export const AccordionStyles = css` font-family: var(--body-font); font-size: var(--type-ramp-minus-1-font-size); line-height: var(--type-ramp-minus-1-line-height); - color: var(--neutral-foreground-rest); - border-top: calc(var(--outline-width) * 1px) solid var(--neutral-divider-rest); + color: ${neutralForegroundRestBehavior.var}; + border-top: calc(var(--outline-width) * 1px) solid + ${neutralDividerRestBehavior.var}; } `.withBehaviors( accentFillRestBehavior, diff --git a/packages/web-components/fast-components-msft/src/badge/badge.styles.ts b/packages/web-components/fast-components-msft/src/badge/badge.styles.ts index 540d422214b..d3beca1dc40 100644 --- a/packages/web-components/fast-components-msft/src/badge/badge.styles.ts +++ b/packages/web-components/fast-components-msft/src/badge/badge.styles.ts @@ -22,18 +22,18 @@ export const BadgeStyles = css` :host(.lightweight) { background: transparent; - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; font-weight: 600; } :host(.accent) { - background: var(--accent-fill-rest); - color: var(--accent-foreground-cut-rest); + background: ${accentFillRestBehavior.var}; + color: ${accentForegroundCutRestBehavior.var}; } :host(.neutral) { - background: var(--neutral-fill-rest); - color: var(--neutral-foreground-rest); + background: ${neutralFillRestBehavior.var}; + color: ${neutralForegroundRestBehavior.var}; } `.withBehaviors( accentFillRestBehavior, diff --git a/packages/web-components/fast-components-msft/src/card/card.styles.ts b/packages/web-components/fast-components-msft/src/card/card.styles.ts index 20fed905a73..cd8e0bad1b4 100644 --- a/packages/web-components/fast-components-msft/src/card/card.styles.ts +++ b/packages/web-components/fast-components-msft/src/card/card.styles.ts @@ -1,7 +1,7 @@ import { css } from "@microsoft/fast-element"; import { display } from "@microsoft/fast-foundation"; import { elevation } from "../styles"; - +import { neutralLayerCardBehavior } from "../styles/index"; export const CardStyles = css` ${display("block")} :host { --elevation: 4; @@ -10,9 +10,9 @@ export const CardStyles = css` height: var(--card-height, 100%); width: var(--card-width, 100%); box-sizing: border-box; - background: var(--neutral-layer-card); + background: ${neutralLayerCardBehavior.var}; border-radius: calc(var(--elevated-corner-radius) * 1px); ${elevation}; border: calc(var(--outline-width) * 1px) solid transparent; } -`; +`.withBehaviors(neutralLayerCardBehavior); diff --git a/packages/web-components/fast-components-msft/src/checkbox/checkbox.styles.ts b/packages/web-components/fast-components-msft/src/checkbox/checkbox.styles.ts index e5f0546be7a..c3b4a644c8f 100644 --- a/packages/web-components/fast-components-msft/src/checkbox/checkbox.styles.ts +++ b/packages/web-components/fast-components-msft/src/checkbox/checkbox.styles.ts @@ -37,8 +37,8 @@ export const CheckboxStyles = css` height: calc((${heightNumber} / 2 + var(--design-unit)) * 1px); box-sizing: border-box; border-radius: calc(var(--corner-radius) * 1px); - border: calc(var(--outline-width) * 1px) solid var(--neutral-outline-rest); - background: var(--neutral-fill-input-rest); + border: calc(var(--outline-width) * 1px) solid ${neutralOutlineRestBehavior.var}; + background: ${neutralFillInputRestBehavior.var}; outline: none; cursor: pointer; } @@ -50,7 +50,7 @@ export const CheckboxStyles = css` .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); @@ -64,14 +64,14 @@ export const CheckboxStyles = css` width: 100%; height: 100%; display: block; - fill: var(--neutral-foreground-rest); + fill: ${neutralForegroundRestBehavior.var}; opacity: 0; pointer-events: none; } .indeterminate-indicator { border-radius: calc(var(--corner-radius) * 1px); - background: var(--neutral-foreground-rest); + background: ${neutralForegroundRestBehavior.var}; position: absolute; top: 25%; right: 25%; @@ -81,18 +81,20 @@ export const CheckboxStyles = css` } :host(:enabled) .control:hover { - background: var(--neutral-fill-input-hover); - border-color: var(--neutral-outline-hover); + background: ${neutralFillInputHoverBehavior.var}; + border-color: ${neutralOutlineHoverBehavior.var}; } :host(:enabled) .control:active { - background: var(--neutral-fill-input-active); - border-color: var(--neutral-outline-active); + background: ${neutralFillInputActiveBehavior.var}; + border-color: ${neutralOutlineActiveBehavior.var}; } :host(:${focusVisible}) .control { - box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px var(--neutral-focus); - border-color: var(--neutral-focus); + box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px ${ + neutralFocusBehavior.var + }; + border-color: ${neutralFocusBehavior.var}; } :host(.disabled) .label, diff --git a/packages/web-components/fast-components-msft/src/divider/divider.styles.ts b/packages/web-components/fast-components-msft/src/divider/divider.styles.ts index 17948e1d11e..b81fe3905f2 100644 --- a/packages/web-components/fast-components-msft/src/divider/divider.styles.ts +++ b/packages/web-components/fast-components-msft/src/divider/divider.styles.ts @@ -8,6 +8,7 @@ export const DividerStyles = css` height: 0; margin: calc(var(--design-unit) * 1px) 0; border: none; - border-top: calc(var(--outline-width) * 1px) solid var(--neutral-divider-rest); + border-top: calc(var(--outline-width) * 1px) solid + ${neutralDividerRestBehavior.var}; } `.withBehaviors(neutralDividerRestBehavior); diff --git a/packages/web-components/fast-components-msft/src/flipper/flipper.styles.ts b/packages/web-components/fast-components-msft/src/flipper/flipper.styles.ts index 0753bf04fe9..d1aaa34a7b5 100644 --- a/packages/web-components/fast-components-msft/src/flipper/flipper.styles.ts +++ b/packages/web-components/fast-components-msft/src/flipper/flipper.styles.ts @@ -26,8 +26,8 @@ export const FlipperStyles = css` align-items: center; margin: 0; position: relative; - fill: var(--neutral-foreground-rest); - color: var(--neutral-foreground-rest); + fill: ${neutralForegroundRestBehavior.var}; + color: ${neutralForegroundRestBehavior.var}; background: transparent; border: none; outline: none; @@ -37,8 +37,8 @@ export const FlipperStyles = css` :host::before { content: ""; opacity: 0.8; - background: var(--neutral-fill-stealth-rest); - border: calc(var(--outline-width) * 1px) solid var(--neutral-outline-rest); + background: ${neutralFillStealthRestBehavior.var}; + border: calc(var(--outline-width) * 1px) solid ${neutralOutlineRestBehavior.var}; border-radius: 50%; position: absolute; top: 0; @@ -64,8 +64,8 @@ export const FlipperStyles = css` } :host(:hover)::before { - background: var(--neutral-fill-stealth-hover); - border-color: var(--neutral-outline-hover); + background: ${neutralFillStealthHoverBehavior.var}; + border-color: ${neutralOutlineHoverBehavior.var}; } :host(:${focusVisible}) { @@ -73,13 +73,13 @@ export const FlipperStyles = css` } :host(:${focusVisible})::before { - 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(:active)::before { - background: var(--neutral-fill-stealth-active); - border-color: var(--neutral-outline-active); + background: ${neutralFillStealthActiveBehavior.var}; + border-color: ${neutralOutlineActiveBehavior.var}; } :host::-moz-focus-inner { diff --git a/packages/web-components/fast-components-msft/src/progress/progress-ring/progress-ring.styles.ts b/packages/web-components/fast-components-msft/src/progress/progress-ring/progress-ring.styles.ts index 420d16baaab..365d9ebbcc4 100644 --- a/packages/web-components/fast-components-msft/src/progress/progress-ring/progress-ring.styles.ts +++ b/packages/web-components/fast-components-msft/src/progress/progress-ring/progress-ring.styles.ts @@ -23,13 +23,13 @@ export const ProgressRingStyles = css` } .background { - stroke: var(--neutral-fill-rest); + stroke: ${neutralFillRestBehavior.var}; fill: none; stroke-width: 2px; } .determinate { - stroke: var(--accent-fill-rest); + stroke: ${accentFillRestBehavior.var}; fill: none; stroke-width: 2px; stroke-linecap: round; @@ -39,7 +39,7 @@ export const ProgressRingStyles = css` } .indeterminate-indicator-1 { - stroke: var(--accent-fill-rest); + stroke: ${accentFillRestBehavior.var}; fill: none; stroke-width: 2px; stroke-linecap: round; @@ -51,11 +51,11 @@ export const ProgressRingStyles = css` :host(.paused) .indeterminate-indicator-1 { animation-play-state: paused; - stroke: var(--neutral-fill-rest); + stroke: ${neutralFillRestBehavior.var}; } :host(.paused) .determinate { - stroke: var(--neutral-foreground-hint); + stroke: ${neutralForegroundHintBehavior.var}; } @keyframes spin-infinite { diff --git a/packages/web-components/fast-components-msft/src/progress/progress/progress.styles.ts b/packages/web-components/fast-components-msft/src/progress/progress/progress.styles.ts index 5769f80049f..5030c9bd39a 100644 --- a/packages/web-components/fast-components-msft/src/progress/progress/progress.styles.ts +++ b/packages/web-components/fast-components-msft/src/progress/progress/progress.styles.ts @@ -16,7 +16,7 @@ export const ProgressStyles = css` } .progress { - background-color: var(--neutral-fill-rest); + background-color: ${neutralFillRestBehavior.var}; border-radius: calc(var(--design-unit) * 1px); width: 100%; height: 100%; @@ -26,7 +26,7 @@ export const ProgressStyles = css` } .determinate { - background-color: var(--accent-fill-rest); + background-color: ${accentFillRestBehavior.var}; border-radius: calc(var(--design-unit) * 1px); height: 100%; transition: all 0.2s ease-in-out; @@ -46,7 +46,7 @@ export const ProgressStyles = css` position: absolute; opacity: 0; height: 100%; - background-color: var(--accent-fill-rest); + background-color: ${accentFillRestBehavior.var}; border-radius: calc(var(--design-unit) * 1px); animation-timing-function: cubic-bezier(0.4, 0.0, 0.6, 1.0); width: 40%; @@ -57,7 +57,7 @@ export const ProgressStyles = css` position: absolute; opacity: 0; height: 100%; - background-color: var(--accent-fill-rest); + background-color: ${accentFillRestBehavior.var}; border-radius: calc(var(--design-unit) * 1px); animation-timing-function: cubic-bezier(0.4, 0.0, 0.6, 1.0); width: 60%; @@ -66,11 +66,11 @@ export const ProgressStyles = css` :host(.paused) .indeterminate-indicator-1, :host(.paused) .indeterminate-indicator-2 { animation-play-state: paused; - background-color: var(--neutral-fill-rest); + background-color: ${neutralFillRestBehavior.var}; } :host(.paused) .determinate { - background-color: var(--neutral-foreground-hint); + background-color: ${neutralForegroundHintBehavior.var}; } @keyframes indeterminate-1 { diff --git a/packages/web-components/fast-components-msft/src/radio/radio.styles.ts b/packages/web-components/fast-components-msft/src/radio/radio.styles.ts index 9e13d46ff2e..eca96a24cad 100644 --- a/packages/web-components/fast-components-msft/src/radio/radio.styles.ts +++ b/packages/web-components/fast-components-msft/src/radio/radio.styles.ts @@ -9,6 +9,7 @@ import { import { heightNumber, neutralFillActiveBehavior, + neutralFillInputActiveBehavior, neutralFillInputHoverBehavior, neutralFillInputRestBehavior, neutralFocusBehavior, @@ -41,8 +42,8 @@ export const RadioStyles = css` height: calc(var(--input-size) * 1px); box-sizing: border-box; border-radius: 50%; - border: calc(var(--outline-width) * 1px) solid var(--neutral-outline-rest); - background: var(--neutral-fill-input-rest); + border: calc(var(--outline-width) * 1px) solid ${neutralOutlineRestBehavior.var}; + background: ${neutralFillInputRestBehavior.var}; outline: none; cursor: pointer; } @@ -54,7 +55,7 @@ export const RadioStyles = css` .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); @@ -73,25 +74,27 @@ export const RadioStyles = css` border-radius: 50%; display: inline-block; flex-shrink: 0; - background: var(--neutral-foreground-rest); - fill: var(--neutral-foreground-rest); + background: ${neutralForegroundRestBehavior.var}; + fill: ${neutralForegroundRestBehavior.var}; opacity: 0; pointer-events: none; } :host(:enabled) .control:hover{ - background: var(--neutral-fill-input-hover); - border-color: var(--neutral-outline-hover); + background: ${neutralFillInputHoverBehavior.var}; + border-color: ${neutralOutlineHoverBehavior.var}; } :host(:enabled) .control:active { - background: var(--neutral-fill-input-active); - border-color: var(--neutral-outline-active); + background: ${neutralFillInputActiveBehavior.var}; + border-color: ${neutralOutlineActiveBehavior.var}; } :host(:${focusVisible}) .control { - box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px var(--neutral-focus); - border-color: var(--neutral-focus); + box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px ${ + neutralFocusBehavior.var + }; + border-color: ${neutralFocusBehavior.var}; } :host(.disabled) .label, @@ -117,6 +120,7 @@ export const RadioStyles = css` neutralOutlineActiveBehavior, neutralOutlineHoverBehavior, neutralOutlineRestBehavior, + neutralFillInputActiveBehavior, forcedColorsStylesheetBehavior( css` .control { diff --git a/packages/web-components/fast-components-msft/src/slider-label/slider-label.styles.ts b/packages/web-components/fast-components-msft/src/slider-label/slider-label.styles.ts index 77f17de094e..9809941bfdc 100644 --- a/packages/web-components/fast-components-msft/src/slider-label/slider-label.styles.ts +++ b/packages/web-components/fast-components-msft/src/slider-label/slider-label.styles.ts @@ -45,7 +45,7 @@ export const SliderLabelStyles = css` .mark { width: calc((var(--design-unit) / 2) * 1px); height: calc(${heightNumber} * 0.25 * 1px); - background: var(--neutral-outline-rest); + background: ${neutralOutlineRestBehavior.var}; justify-self: center; } :host(.vertical) .mark { diff --git a/packages/web-components/fast-components-msft/src/slider/slider.styles.ts b/packages/web-components/fast-components-msft/src/slider/slider.styles.ts index bcea4b97615..31e960ce743 100644 --- a/packages/web-components/fast-components-msft/src/slider/slider.styles.ts +++ b/packages/web-components/fast-components-msft/src/slider/slider.styles.ts @@ -48,7 +48,9 @@ export const SliderStyles = css` grid-template-columns: calc(var(--thumb-size) * 1px) 1fr; } :host(:${focusVisible}) .thumb-cursor { - box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px var(--neutral-focus); + box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px ${ + neutralFocusBehavior.var + }; } .thumb-container { position: absolute; @@ -60,15 +62,15 @@ export const SliderStyles = css` border: none; width: calc(var(--thumb-size) * 1px); height: calc(var(--thumb-size) * 1px); - background: var(--neutral-foreground-rest); + background: ${neutralForegroundRestBehavior.var}; border-radius: 50%; } .thumb-cursor:hover { - background: var(--neutral-foreground-hover); - border-color: var(--neutral-outline-hover); + background: ${neutralForegroundHoverBehavior.var}; + border-color: ${neutralOutlineHoverBehavior.var}; } .thumb-cursor:active { - background: var(--neutral-foreground-active); + background: ${neutralForegroundActiveBehavior.var}; } :host(.horizontal) .thumb-container { transform: translateX(calc(var(--thumb-translate) * 1px)); @@ -95,7 +97,7 @@ export const SliderStyles = css` height: 100%; } .track { - background: var(--neutral-outline-rest); + background: ${neutralOutlineRestBehavior.var}; position: absolute; } :host(.vertical) { diff --git a/packages/web-components/fast-components-msft/src/styles/patterns/button.ts b/packages/web-components/fast-components-msft/src/styles/patterns/button.ts index 7681d517128..9ef592d9e83 100644 --- a/packages/web-components/fast-components-msft/src/styles/patterns/button.ts +++ b/packages/web-components/fast-components-msft/src/styles/patterns/button.ts @@ -1,6 +1,24 @@ import { css } from "@microsoft/fast-element"; import { display, focusVisible } from "@microsoft/fast-foundation"; import { heightNumber } from "../size"; +import { + accentFillActiveBehavior, + accentFillHoverBehavior, + accentFillRestBehavior, + accentForegroundActiveBehavior, + accentForegroundCutRestBehavior, + accentForegroundHoverBehavior, + accentForegroundRestBehavior, + neutralFillActiveBehavior, + neutralFillHoverBehavior, + neutralFillRestBehavior, + neutralFillStealthActiveBehavior, + neutralFillStealthHoverBehavior, + neutralFillStealthRestBehavior, + neutralFocusBehavior, + neutralFocusInnerAccentBehavior, + neutralForegroundRestBehavior, +} from "../index"; export const BaseButtonStyles = css` ${display("inline-block")} :host { @@ -16,7 +34,7 @@ export const BaseButtonStyles = css` display: inline-flex; justify-content: center; align-items: center; - padding: 0 calc((6 + (var(--design-unit) * 2 * var(--density))) * 1px); + padding: 0 calc((10 + (var(--design-unit) * 2 * var(--density))) * 1px); height: calc(${heightNumber} * 1px); min-width: calc(${heightNumber} * 1px); white-space: nowrap; @@ -24,23 +42,25 @@ export const BaseButtonStyles = css` text-decoration: none; cursor: pointer; border-radius: calc(var(--corner-radius) * 1px); - background-color: var(--neutral-fill-rest); - color: var(--neutral-foreground-rest); - fill: var(--neutral-foreground-rest); + background-color: ${neutralFillRestBehavior.var}; + color: ${neutralForegroundRestBehavior.var}; + fill: ${neutralForegroundRestBehavior.var}; border: calc(var(--outline-width) * 1px) solid transparent; } .control:hover { - background-color: var(--neutral-fill-hover); + background-color: ${neutralFillHoverBehavior.var}; } .control:active { - background-color: var(--neutral-fill-active); + background-color: ${neutralFillActiveBehavior.var}; } .control:${focusVisible} { - border: calc(var(--outline-width) * 1px) solid var(--neutral-focus); - box-shadow: 0 0 0 calc((var(--focus-outline-width) - var(--outline-width)) * 1px) var(--neutral-focus); + border: calc(var(--outline-width) * 1px) solid ${neutralFocusBehavior.var}; + box-shadow: 0 0 0 calc((var(--focus-outline-width) - var(--outline-width)) * 1px) ${ + neutralFocusBehavior.var + }; } .control::-moz-focus-inner { @@ -68,26 +88,37 @@ export const BaseButtonStyles = css` .end { margin-inline-start: 11px; } -`; +`.withBehaviors( + neutralFillRestBehavior, + neutralForegroundRestBehavior, + neutralFillHoverBehavior, + neutralFillActiveBehavior +); export const AccentButtonStyles = css` :host(.accent) .control { - background: var(--accent-fill-rest); - color: var(--accent-foreground-cut-rest); + background: ${accentFillRestBehavior.var}; + color: ${accentForegroundCutRestBehavior.var}; } :host(.accent) .control:hover { - background: var(--accent-fill-hover); + background: ${accentFillHoverBehavior.var}; } :host(.accent) .control:active { - background: var(--accent-fill-active); + background: ${accentFillActiveBehavior.var}${accentFillActiveBehavior.var}; } :host(.accent) .control:${focusVisible} { - box-shadow: 0 0 0 calc(var(--focus-outline-width) * 1px) inset var(--neutral-focus-inner-accent); + box-shadow: 0 0 0 calc(var(--focus-outline-width) * 1px) inset ${neutralFocusInnerAccentBehavior.var}; } -`; +`.withBehaviors( + accentFillRestBehavior, + accentForegroundCutRestBehavior, + accentFillHoverBehavior, + accentFillActiveBehavior, + neutralFocusInnerAccentBehavior +); export const HypertextStyles = css` :host(.hypertext) .control { @@ -97,31 +128,31 @@ export const HypertextStyles = css` box-shadow: none; border-radius: 0; } - :host a.control:not(:link) { background-color: transparent; cursor: default; } - :host(.hypertext) .control:link, :host(.hypertext) .control:visited { background: transparent; - color: var(--accent-foreground-rest); - border-bottom: calc(var(--outline-width) * 1px) solid var(--accent-foreground-rest); + color: ${accentForegroundRestBehavior.var}; + border-bottom: calc(var(--outline-width) * 1px) solid ${accentForegroundRestBehavior.var}; } - :host(.hypertext) .control:hover { - border-bottom-color: var(--accent-foreground-hover); + border-bottom-color: ${accentForegroundHoverBehavior.var}; } - :host(.hypertext) .control:active { - border-bottom-color: var(--accent-foreground-active); + border-bottom-color: ${accentForegroundActiveBehavior.var}; } - :host(.hypertext) .control:${focusVisible} { - border-bottom: calc(var(--focus-outline-width) * 1px) solid var(--neutral-focus); + border-bottom: calc(var(--focus-outline-width) * 1px) solid ${neutralFocusBehavior.var}; } -`; +`.withBehaviors( + accentForegroundRestBehavior, + accentForegroundHoverBehavior, + accentForegroundActiveBehavior, + neutralFocusBehavior +); export const LightweightButtonStyles = css` :host(.lightweight) .control { @@ -130,15 +161,15 @@ export const LightweightButtonStyles = css` box-shadow: none; border-radius: 0; background: transparent; - color: var(--accent-foreground-rest); + color: ${accentForegroundRestBehavior.var}; } :host(.lightweight) .control:hover { - color: var(--accent-foreground-hover); + color: ${accentForegroundHoverBehavior.var}; } :host(.lightweight) .control:active { - color: var(--accent-foreground-active); + color: ${accentForegroundActiveBehavior.var}; } :host(.lightweight) .content { @@ -155,44 +186,64 @@ export const LightweightButtonStyles = css` } :host(.lightweight) .control:hover .content::before { - background: var(--accent-foreground-hover); + background: ${accentForegroundHoverBehavior.var}; } :host(.lightweight) .control:active .content::before { - background: var(--accent-foreground-active); + background: ${accentForegroundActiveBehavior.var}; } :host(.lightweight) .control:${focusVisible} .content::before { - background: var(--neutral-foreground-rest); + background: ${neutralForegroundRestBehavior.var}; height: calc(var(--focus-outline-width) * 1px); } -`; +`.withBehaviors( + accentForegroundRestBehavior, + accentForegroundHoverBehavior, + accentForegroundActiveBehavior, + accentForegroundHoverBehavior, + neutralForegroundRestBehavior +); export const OutlineButtonStyles = css` :host(.outline) .control { background: transparent; - border-color: var(--neutral-outline-rest); + border-color: ${accentFillRestBehavior.var}; } :host(.outline) .control:hover { - border-color: var(--neutral-outline-hover); + border-color: ${accentFillHoverBehavior.var}; } :host(.outline) .control:active { - border-color: var(--neutral-outline-active); + border-color: ${accentFillActiveBehavior.var}; + } + + :host(.outline) .control:${focusVisible} { + border: calc(var(--outline-width) * 1px) solid ${neutralFocusBehavior.var}); + box-shadow: 0 0 0 calc((var(--focus-outline-width) - var(--outline-width)) * 1px) ${neutralFocusBehavior.var}; } -`; +`.withBehaviors( + accentFillRestBehavior, + accentFillHoverBehavior, + accentFillActiveBehavior, + neutralFocusBehavior +); export const StealthButtonStyles = css` :host(.stealth) .control { - background: var(--neutral-fill-stealth-rest); + background: ${neutralFillStealthRestBehavior.var}; } :host(.stealth) .control:hover { - background: var(--neutral-fill-stealth-hover); + background: ${neutralFillStealthHoverBehavior.var}; } :host(.stealth) .control:active { - background: var(--neutral-fill-stealth-active); + background: ${neutralFillStealthActiveBehavior.var}; } -`; +`.withBehaviors( + neutralFillStealthRestBehavior, + neutralFillStealthHoverBehavior, + neutralFillStealthActiveBehavior +); diff --git a/packages/web-components/fast-components-msft/src/switch/switch.styles.ts b/packages/web-components/fast-components-msft/src/switch/switch.styles.ts index f44057a123e..88c1c9a3a23 100644 --- a/packages/web-components/fast-components-msft/src/switch/switch.styles.ts +++ b/packages/web-components/fast-components-msft/src/switch/switch.styles.ts @@ -57,25 +57,27 @@ export const SwitchStyles = css` box-sizing: border-box; width: calc(((${heightNumber} / 2) + var(--design-unit)) * 2px); height: calc(((${heightNumber} / 2) + var(--design-unit)) * 1px); - background: var(--neutral-fill-input-rest); + background: ${neutralFillInputRestBehavior.var}; border-radius: calc(${heightNumber} * 1px); - border: calc(var(--outline-width) * 1px) solid var(--neutral-outline-rest); + border: calc(var(--outline-width) * 1px) solid ${neutralOutlineRestBehavior.var}; } :host(:enabled) .switch:hover { - background: var(--neutral-fill-input-hover); - border-color: var(--neutral-outline-hover); + background: ${neutralFillInputHoverBehavior.var}; + border-color: ${neutralOutlineHoverBehavior.var}; cursor: pointer; } :host(:enabled) .switch:active { - background: var(--neutral-fill-input-active); - border-color: var(--neutral-outline-active); + background: ${neutralFillInputActiveBehavior.var}; + border-color: ${neutralOutlineActiveBehavior.var}; } :host(:${focusVisible}) .switch { - box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px var(--neutral-focus); - border-color: var(--neutral-focus); + box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px ${ + neutralFocusBehavior.var + }; + border-color: ${neutralFocusBehavior.var}; } .checked-indicator { @@ -84,13 +86,13 @@ export const SwitchStyles = css` width: calc((${heightNumber} - (var(--design-unit) * 5.5)) * 1px); top: calc(var(--design-unit) * 1px); left: calc(var(--design-unit) * 1px); - background: var(--neutral-foreground-rest); + background: ${neutralForegroundRestBehavior.var}; border-radius: 50%; transition: all 0.2s ease-in-out; } .status-message { - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; cursor: pointer; font-size: var(--type-ramp-base-font-size); line-height: var(--type-ramp-base-line-height); @@ -102,7 +104,7 @@ export const SwitchStyles = css` } .label { - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; font-size: var(--type-ramp-base-font-size); line-height: var(--type-ramp-base-line-height); } @@ -115,23 +117,25 @@ export const SwitchStyles = css` :host(.checked) .checked-indicator { left: calc((((${heightNumber} / 2) + var(--design-unit)) + var(--design-unit)) * 1px); - background: var(--accent-foreground-cut-rest); + background: ${accentForegroundCutRestBehavior.var}; } :host(.checked) .switch { - background: var(--accent-fill-rest); + background: ${accentFillRestBehavior.var}; } :host(.checked:enabled) .switch:hover { - background: var(--accent-fill-hover); + background: ${accentFillHoverBehavior.var}; } :host(.checked:enabled) .switch:active { - background: var(--accent-fill-active); + background: ${accentFillActiveBehavior.var}; } :host(.checked:${focusVisible}:enabled) .switch { - box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px var(--neutral-focus); + box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px ${ + neutralFocusBehavior.var + }; border-color: transparent; } diff --git a/packages/web-components/fast-components-msft/src/tabs/tab/tab.styles.ts b/packages/web-components/fast-components-msft/src/tabs/tab/tab.styles.ts index c1b9cec0580..d79115095c8 100644 --- a/packages/web-components/fast-components-msft/src/tabs/tab/tab.styles.ts +++ b/packages/web-components/fast-components-msft/src/tabs/tab/tab.styles.ts @@ -25,7 +25,7 @@ export const TabStyles = css` line-height: 18px; height: calc(${heightNumber} * 1px); padding: 0 calc((6 + (var(--design-unit) * 2 * var(--density))) * 1px); - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; border-radius: calc(var(--corner-radius) * 1px); border: calc(var(--outline-width) * 1px) solid transparent; align-items: center; @@ -38,18 +38,18 @@ export const TabStyles = css` } :host(:hover) { - color: var(--neutral-foreground-hover); + color: ${neutralForegroundHoverBehavior.var}; } :host(:active) { - color: var(--neutral-foreground-active); + color: ${neutralForegroundActiveBehavior.var}; } :host(:${focusVisible}) { outline: none; - border: calc(var(--outline-width) * 1px) solid var(--neutral-focus); + border: calc(var(--outline-width) * 1px) solid ${neutralFocusBehavior.var}; box-shadow: 0 0 0 calc((var(--focus-outline-width) - var(--outline-width)) * 1px) - var(--neutral-focus); + ${neutralFocusBehavior.var}; } :host(:focus) { @@ -66,11 +66,11 @@ export const TabStyles = css` } :host(.vertical:hover) { - color: var(--neutral-foreground-hover); + color: ${neutralForegroundHoverBehavior.var}; } :host(.vertical:active) { - color: var(--neutral-foreground-active); + color: ${neutralForegroundActiveBehavior.var}; } :host(.vertical:hover[aria-selected="true"]) { diff --git a/packages/web-components/fast-components-msft/src/tabs/tabs.styles.ts b/packages/web-components/fast-components-msft/src/tabs/tabs.styles.ts index 837eb37ca6e..36579fe0b8c 100644 --- a/packages/web-components/fast-components-msft/src/tabs/tabs.styles.ts +++ b/packages/web-components/fast-components-msft/src/tabs/tabs.styles.ts @@ -9,7 +9,7 @@ export const TabsStyles = css` font-family: var(--body-font); font-size: var(--type-ramp-base-font-size); line-height: var(--type-ramp-base-line-height); - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; grid-template-columns: auto 1fr auto; grid-template-rows: auto 1fr; } @@ -38,7 +38,7 @@ export const TabsStyles = css` height: 3px; border-radius: calc(var(--corner-radius) * 1px); justify-self: center; - background: var(--accent-fill-rest); + background: ${accentFillRestBehavior.var}; } .activeIndicatorTransition { @@ -86,7 +86,7 @@ export const TabsStyles = css` height: 20px; border-radius: calc(var(--corner-radius) * 1px); align-self: center; - background: var(--accent-fill-rest); + background: ${accentFillRestBehavior.var}; } :host(.vertical) .activeIndicatorTransition { diff --git a/packages/web-components/fast-components-msft/src/text-area/text-area.styles.ts b/packages/web-components/fast-components-msft/src/text-area/text-area.styles.ts index 19840937e11..0730061bee6 100644 --- a/packages/web-components/fast-components-msft/src/text-area/text-area.styles.ts +++ b/packages/web-components/fast-components-msft/src/text-area/text-area.styles.ts @@ -27,10 +27,10 @@ export const TextAreaStyles = css` .control { box-sizing: border-box; position: relative; - color: var(--neutral-foreground-rest); - background: var(--neutral-fill-input-rest); + color: ${neutralForegroundRestBehavior.var}; + background: ${neutralFillInputRestBehavior.var}; 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}; height: calc(${heightNumber} * 2px); font: inherit; font-size: var(--type-ramp-base-font-size); @@ -41,8 +41,8 @@ export const TextAreaStyles = css` } .control:hover:enabled { - background: var(--neutral-fill-input-hover); - border-color: var(--neutral-outline-hover); + background: ${neutralFillInputHoverBehavior.var}; + border-color: ${neutralOutlineHoverBehavior.var}; } .control:hover, @@ -53,17 +53,17 @@ export const TextAreaStyles = css` } :host(:focus-within) .control { - border-color: var(--neutral-focus); - box-shadow: 0 0 0 1px var(--neutral-focus) inset; + border-color: ${neutralFocusBehavior.var}; + box-shadow: 0 0 0 1px ${neutralFocusBehavior.var} inset; } :host(.filled) .control { - background: var(--neutral-fill-rest); + background: ${neutralFillRestBehavior.var}; border-color: transparent; } :host(.filled:hover:not([disabled])) .control { - background: var(--neutral-fill-hover); + background: ${neutralFillHoverBehavior.var}; border-color: transparent; } @@ -86,7 +86,7 @@ export const TextAreaStyles = css` .label { display: block; - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; cursor: pointer; $font-size: var(--type-ramp-base-font-size); line-height: var(--type-ramp-base-line-height); diff --git a/packages/web-components/fast-components-msft/src/text-field/text-field.styles.ts b/packages/web-components/fast-components-msft/src/text-field/text-field.styles.ts index 70544695f6c..a86ba44796a 100644 --- a/packages/web-components/fast-components-msft/src/text-field/text-field.styles.ts +++ b/packages/web-components/fast-components-msft/src/text-field/text-field.styles.ts @@ -30,10 +30,10 @@ export const TextFieldStyles = css` position: relative; display: flex; flex-direction: row; - color: var(--neutral-foreground-rest); - background: var(--neutral-fill-input-rest); + color: ${neutralForegroundRestBehavior.var}; + background: ${neutralFillInputRestBehavior.var}; 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}; height: calc(${heightNumber} * 1px); } @@ -46,7 +46,7 @@ export const TextFieldStyles = css` margin-bottom: auto; border: none; padding: 0 calc(var(--design-unit) * 2px + 1px); - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; font-size: var(--type-ramp-base-font-size); line-height: var(--type-ramp-base-line-height); } @@ -65,7 +65,7 @@ export const TextFieldStyles = css` .label { display: block; - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; cursor: pointer; font-size: var(--type-ramp-base-font-size); line-height: var(--type-ramp-base-line-height); @@ -80,7 +80,7 @@ export const TextFieldStyles = css` } width: 16px; height: 16px; margin: auto; - fill: var(--neutral-foreground-rest); + fill: ${neutralForegroundRestBehavior.var}; } .before-content { @@ -92,22 +92,22 @@ export const TextFieldStyles = css` } :host(:hover:not(.disabled)) .root { - background: var(--neutral-fill-input-hover); - border-color: var(--neutral-outline-hover); + background: ${neutralFillInputHoverBehavior.var}; + border-color: ${neutralOutlineHoverBehavior.var}; } :host(:focus-within:not(.disabled)) .root { - border-color: var(--neutral-focus); - box-shadow: 0 0 0 1px var(--neutral-focus) inset; + border-color: ${neutralFocusBehavior.var}; + box-shadow: 0 0 0 1px ${neutralFocusBehavior.var} inset; } :host(.filled) .root { - background: var(--neutral-fill-rest); + background: ${neutralFillRestBehavior.var}; border-color: transparent; } :host(.filled:hover:not(.disabled)) .root { - background: var(--neutral-fill-hover); + background: ${neutralFillHoverBehavior.var}; border-color: transparent; } diff --git a/packages/web-components/fast-components/docs/guide/color.doc.md b/packages/web-components/fast-components/docs/guide/color.doc.md index eac61892413..f5559e09127 100644 --- a/packages/web-components/fast-components/docs/guide/color.doc.md +++ b/packages/web-components/fast-components/docs/guide/color.doc.md @@ -85,7 +85,7 @@ import { neutralFillRestBehavior } from "@microsoft/fast-components"; const styles = css` :host { - background: var(--neutral-fill-rest); + background: ${neutralFillRestBehavior.var}; } `.withBehaviors( neutralFillRestBehavior diff --git a/packages/web-components/fast-components/src/accordion/accordion-item/accordion-item.styles.ts b/packages/web-components/fast-components/src/accordion/accordion-item/accordion-item.styles.ts index 371c03ea72b..4d804029e2f 100644 --- a/packages/web-components/fast-components/src/accordion/accordion-item/accordion-item.styles.ts +++ b/packages/web-components/fast-components/src/accordion/accordion-item/accordion-item.styles.ts @@ -4,14 +4,15 @@ import { focusVisible, forcedColorsStylesheetBehavior, } from "@microsoft/fast-foundation"; +import { SystemColors } from "@microsoft/fast-web-utilities"; import { neutralDividerRestBehavior, neutralFocusBehavior, neutralForegroundActiveBehavior, neutralForegroundFocusBehavior, + neutralForegroundHoverBehavior, neutralForegroundRestBehavior, } from "../../styles/recipes"; -import { SystemColors } from "@microsoft/fast-web-utilities"; import { heightNumber } from "../../styles/size"; export const AccordionItemStyles = css` @@ -46,16 +47,16 @@ export const AccordionItemStyles = css` padding: 0 calc((6 + (var(--design-unit) * 2 * var(--density))) * 1px); text-align: left; height: calc(${heightNumber} * 1px); - color: var(--neutral-foreground-rest); + color: ${neutralForegroundRestBehavior.var}; cursor: pointer; } .button:hover { - color: var(--neutral-foreground-hover); + color: ${neutralForegroundHoverBehavior.var}; } .button:active { - color: var(--neutral-foreground-active); + color: ${neutralForegroundActiveBehavior.var}; } .button::before { @@ -71,9 +72,9 @@ export const AccordionItemStyles = css` .button:${focusVisible}::before { outline: none; - border: calc(var(--outline-width) * 1px) solid var(--neutral-focus); + border: calc(var(--outline-width) * 1px) solid ${neutralFocusBehavior.var}; box-shadow: 0 0 0 calc((var(--focus-outline-width) - var(--outline-width)) * 1px) - var(--neutral-focus); + ${neutralFocusBehavior.var}; } :host(.expanded) .region { @@ -124,6 +125,7 @@ export const AccordionItemStyles = css` neutralDividerRestBehavior, neutralForegroundActiveBehavior, neutralForegroundFocusBehavior, + neutralForegroundHoverBehavior, neutralForegroundRestBehavior, neutralFocusBehavior, forcedColorsStylesheetBehavior( diff --git a/packages/web-components/fast-components/src/accordion/accordion.styles.ts b/packages/web-components/fast-components/src/accordion/accordion.styles.ts index 2b03070c2e1..2529f9ec9dc 100644 --- a/packages/web-components/fast-components/src/accordion/accordion.styles.ts +++ b/packages/web-components/fast-components/src/accordion/accordion.styles.ts @@ -1,7 +1,6 @@ import { css } from "@microsoft/fast-element"; import { display } from "@microsoft/fast-foundation"; import { - accentFillRestBehavior, neutralDividerRestBehavior, neutralForegroundRestBehavior, } from "../styles/recipes"; @@ -13,11 +12,8 @@ export const AccordionStyles = css` font-family: var(--body-font); font-size: var(--type-ramp-minus-1-font-size); line-height: var(--type-ramp-minus-1-line-height); - color: var(--neutral-foreground-rest); - border-top: calc(var(--outline-width) * 1px) solid var(--neutral-divider-rest); + color: ${neutralForegroundRestBehavior.var}; + border-top: calc(var(--outline-width) * 1px) solid + ${neutralDividerRestBehavior.var}; } -`.withBehaviors( - accentFillRestBehavior, - neutralDividerRestBehavior, - neutralForegroundRestBehavior -); +`.withBehaviors(neutralDividerRestBehavior, neutralForegroundRestBehavior); diff --git a/packages/web-components/fast-components/src/accordion/fixtures/base.html b/packages/web-components/fast-components/src/accordion/fixtures/base.html index 3b85ca61cad..f7f6eac0017 100644 --- a/packages/web-components/fast-components/src/accordion/fixtures/base.html +++ b/packages/web-components/fast-components/src/accordion/fixtures/base.html @@ -1,7 +1,7 @@