Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various style fixes #19418

Merged
merged 7 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix various style bugs and design token uses",
"packageName": "@fluentui/web-components",
"email": "corylaviska@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,94 +38,93 @@ export const optionStyles: (
) => ElementStyles = (context: ElementDefinitionContext, definition: FoundationElementDefinition) =>
css`
${display('inline-flex')} :host {
font-family: ${bodyFont};
border-radius: calc(${controlCornerRadius} * 1px);
border: calc(${focusStrokeWidth} * 1px) solid transparent;
box-sizing: border-box;
color: ${neutralForegroundRest};
cursor: pointer;
fill: currentcolor;
font-size: ${typeRampBaseFontSize};
height: calc(${heightNumber} * 1px);
line-height: ${typeRampBaseLineHeight};
margin: 0 calc(${designUnit} * 1px);
outline: none;
overflow: hidden;
align-items: center;
padding: 0 calc(${designUnit} * 2.25px);
user-select: none;
white-space: nowrap;
font-family: ${bodyFont};
border-radius: calc(${controlCornerRadius} * 1px);
border: calc(${focusStrokeWidth} * 1px) solid transparent;
box-sizing: border-box;
color: ${neutralForegroundRest};
cursor: pointer;
fill: currentcolor;
font-size: ${typeRampBaseFontSize};
height: calc(${heightNumber} * 1px);
line-height: ${typeRampBaseLineHeight};
margin: 0 calc(${designUnit} * 1px);
outline: none;
overflow: hidden;
align-items: center;
padding: 0 calc(${designUnit} * 2.25px);
user-select: none;
white-space: nowrap;
}

:host(:${focusVisible}) {
box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) inset ${focusStrokeInner};
border-color: ${focusStrokeOuter};
background: ${accentFillFocus};
color: ${foregroundOnAccentFocus};
box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) inset ${focusStrokeInner};
border-color: ${focusStrokeOuter};
background: ${accentFillFocus};
color: ${foregroundOnAccentFocus};
}

:host([aria-selected="true"]) {
background: ${accentFillRest};
color: ${foregroundOnAccentRest};
:host([aria-selected='true']) {
background: ${accentFillRest};
color: ${foregroundOnAccentRest};
}

:host(:hover) {
background: ${accentFillHover};
color: ${foregroundOnAccentHover};
}

:host(:active) {
background: ${accentFillActive};
color: ${foregroundOnAccentActive};
background: ${accentFillActive};
color: ${foregroundOnAccentActive};
}

:host(:not([aria-selected="true"]):hover) {
background: ${neutralFillHover};
color: ${neutralForegroundRest}};
:host(:not([aria-selected='true']):hover) {
background: ${neutralFillHover};
color: ${neutralForegroundRest};
}

:host(:not([aria-selected="true"]):active) {
background: ${neutralFillActive};
color: ${neutralForegroundRest}};
:host(:not([aria-selected='true']):active) {
background: ${neutralFillActive};
color: ${neutralForegroundRest};
}

:host([disabled]) {
cursor: ${disabledCursor};
opacity: ${disabledOpacity};
cursor: ${disabledCursor};
opacity: ${disabledOpacity};
}

:host([disabled]:hover) {
background-color: inherit;
background-color: inherit;
}

.content {
grid-column-start: 2;
justify-self: start;
overflow: hidden;
text-overflow: ellipsis;
grid-column-start: 2;
justify-self: start;
overflow: hidden;
text-overflow: ellipsis;
}

.start,
.end,
::slotted(svg) {
display: flex;
display: flex;
}

::slotted(svg) {
${/* Glyph size and margin-left is temporary - replace when adaptive typography is figured out */ ''}
height: calc(${designUnit} * 4px);
width: calc(${designUnit} * 4px);
${/* Glyph size and margin-left is temporary - replace when adaptive typography is figured out */ ''}
height: calc(${designUnit} * 4px);
width: calc(${designUnit} * 4px);
}

::slotted([slot="end"]) {
margin-inline-start: 1ch;
::slotted([slot='end']) {
margin-inline-start: 1ch;
}

::slotted([slot="start"]) {
margin-inline-end: 1ch;
::slotted([slot='start']) {
margin-inline-end: 1ch;
}

`.withBehaviors(
`.withBehaviors(
forcedColorsStylesheetBehavior(
css`
:host {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const progressStyles: (context: ElementDefinitionContext, definition: Pro
:host(.paused) .indeterminate-indicator-1,
:host(.paused) .indeterminate-indicator-2 {
animation-play-state: paused;
background-color: $[neutralFillRest};
background-color: ${neutralFillRest};
}

:host(.paused) .determinate {
Expand Down
9 changes: 6 additions & 3 deletions packages/web-components/src/radio/radio.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '@microsoft/fast-foundation';
import { heightNumber } from '../styles';
import {
bodyFont,
designUnit,
disabledOpacity,
fillColor,
Expand All @@ -22,6 +23,8 @@ import {
neutralStrokeHover,
neutralStrokeRest,
strokeWidth,
typeRampBaseFontSize,
typeRampBaseLineHeight,
} from '../design-tokens';

export const radioStyles: (context: ElementDefinitionContext, definition: RadioOptions) => ElementStyles = (
Expand Down Expand Up @@ -63,15 +66,15 @@ export const radioStyles: (context: ElementDefinitionContext, definition: RadioO
}

.label {
font-family: var(--body-font);
font-family: ${bodyFont};
color: ${neutralForegroundRest};
${
/* Need to discuss with Brian how HorizontalSpacingNumber can work. https://github.com/microsoft/fast/issues/2766 */ ''
} padding-inline-start: calc(${designUnit} * 2px + 2px);
margin-inline-end: calc(${designUnit} * 2px + 2px);
cursor: pointer;
font-size: var(--type-ramp-base-font-size);
line-height: var(--type-ramp-base-line-height);
font-size: ${typeRampBaseFontSize};
line-height: ${typeRampBaseLineHeight};
}

.control,
Expand Down
5 changes: 3 additions & 2 deletions packages/web-components/src/select/select.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
disabledOpacity,
focusStrokeInner,
focusStrokeOuter,
focusStrokeWidth,
foregroundOnAccentFocus,
neutralFillHover,
neutralFillInputActive,
Expand Down Expand Up @@ -128,7 +129,7 @@ export const selectStyles = (context, definition) =>
}

:host(:${focusVisible}) ::slotted([aria-selected="true"][role="option"]:not([disabled])) {
box-shadow: 0 0 0 calc(var(--focus-outline-width) * 1px) inset ${focusStrokeInner};
box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) inset ${focusStrokeInner};
border-color: ${focusStrokeOuter};
background: ${accentFillFocus};
color: ${foregroundOnAccentFocus};
Expand Down Expand Up @@ -261,7 +262,7 @@ export const selectStyles = (context, definition) =>
:host(:${focusVisible}) ::slotted([aria-selected="true"][role="option"]:not([disabled])) {
background: ${SystemColors.Highlight};
border-color: ${SystemColors.ButtonText};
box-shadow: 0 0 0 calc(var(--focus-outline-width) * 1px) inset ${SystemColors.HighlightText};
box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) inset ${SystemColors.HighlightText};
color: ${SystemColors.HighlightText};
fill: currentcolor;
}
Expand Down
9 changes: 6 additions & 3 deletions packages/web-components/src/text-area/text-area.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { SystemColors } from '@microsoft/fast-web-utilities';
import { fillStateStyles, heightNumber } from '../styles';
import { appearanceBehavior } from '../utilities/behaviors';
import {
bodyFont,
controlCornerRadius,
designUnit,
disabledOpacity,
focusStrokeOuter,
neutralFillHover,
neutralFillInputHover,
Expand Down Expand Up @@ -64,7 +67,7 @@ export const textAreaFilledStyles: (
export const textAreaStyles = (context, definition) =>
css`
${display('inline-flex')} :host {
font-family: var(--body-font);
font-family: ${bodyFont};
outline: none;
user-select: none;
position: relative;
Expand All @@ -77,7 +80,7 @@ export const textAreaStyles = (context, definition) =>
position: relative;
color: ${neutralForegroundRest};
background: ${neutralFillInputRest};
border-radius: calc(var(--corner-radius) * 1px);
border-radius: calc(${controlCornerRadius} * 1px);
border: calc(${strokeWidth} * 1px) solid ${neutralStrokeRest};
height: calc(${heightNumber} * 2px);
font: inherit;
Expand Down Expand Up @@ -138,7 +141,7 @@ export const textAreaStyles = (context, definition) =>
cursor: ${disabledCursor};
}
:host([disabled]) {
opacity: var(--disabled-opacity);
opacity: ${disabledOpacity};
}
`.withBehaviors(
appearanceBehavior('filled', textAreaFilledStyles(context, definition)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { appearanceBehavior } from '../utilities/behaviors';
import {
bodyFont,
controlCornerRadius,
designUnit,
disabledOpacity,
focusStrokeOuter,
neutralFillHover,
Expand Down Expand Up @@ -105,7 +106,7 @@ export const textFieldStyles = (context, definition) =>
margin-top: auto;
margin-bottom: auto;
border: none;
padding: 0 calc(var(--design-unit) * 2px + 1px);
padding: 0 calc(${designUnit} * 2px + 1px);
color: ${neutralForegroundRest};
font-family: inherit;
font-size: ${typeRampBaseFontSize};
Expand Down
5 changes: 3 additions & 2 deletions packages/web-components/src/tree-item/tree-item.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
designUnit,
disabledOpacity,
focusStrokeOuter,
focusStrokeWidth,
neutralFillRecipe,
neutralFillRest,
neutralFillStealthActive,
Expand All @@ -40,7 +41,7 @@ const ltr = css`
left: var(--expand-collapse-button-nested-width, calc(${heightNumber} * -1px));
}
:host([selected])::after {
left: calc(var(--focus-outline-width) * 1px);
left: calc(${focusStrokeWidth} * 1px);
}
:host([expanded]) > .positioning-region .expand-collapse-glyph {
transform: rotate(45deg);
Expand All @@ -55,7 +56,7 @@ const rtl = css`
right: var(--expand-collapse-button-nested-width, calc(${heightNumber} * -1px));
}
:host([selected])::after {
right: calc(var(--focus-outline-width) * 1px);
right: calc(${focusStrokeWidth} * 1px);
}
:host([expanded]) > .positioning-region .expand-collapse-glyph {
transform: rotate(135deg);
Expand Down