@fluentui/web-components 1.6.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +103 -1
- package/CHANGELOG.md +40 -2
- package/dist/dts/calendar/calendar.stories.d.ts +86 -0
- package/dist/dts/calendar/calendar.styles.d.ts +7 -0
- package/dist/dts/calendar/index.d.ts +18 -0
- package/dist/dts/color/palette.d.ts +43 -1
- package/dist/dts/color/recipes/contrast-and-delta-swatch-set.d.ts +11 -0
- package/dist/dts/color/recipes/contrast-swatch.d.ts +12 -0
- package/dist/dts/color/recipes/delta-swatch-set.d.ts +36 -0
- package/dist/dts/color/recipes/{neutral-divider.d.ts → delta-swatch.d.ts} +3 -2
- package/dist/dts/color/recipes/focus-stroke.d.ts +2 -2
- package/dist/dts/color/recipes/foreground-on-accent.d.ts +6 -0
- package/dist/dts/color/recipes/gradient-shadow-stroke.d.ts +7 -0
- package/dist/dts/color/recipes/gradient-swatch.d.ts +36 -0
- package/dist/dts/color/recipes/neutral-layer-1.d.ts +4 -0
- package/dist/dts/color/recipes/neutral-layer-2.d.ts +1 -5
- package/dist/dts/color/recipes/neutral-layer-3.d.ts +1 -1
- package/dist/dts/color/recipes/neutral-layer-4.d.ts +1 -1
- package/dist/dts/color/recipes/neutral-layer-floating.d.ts +1 -1
- package/dist/dts/color/recipes/underline-stroke.d.ts +7 -0
- package/dist/dts/color/swatch.d.ts +7 -0
- package/dist/dts/color/utilities/base-layer-luminance.d.ts +2 -2
- package/dist/dts/combobox/index.d.ts +1 -2
- package/dist/dts/custom-elements.d.ts +4 -2
- package/dist/dts/data-grid/data-grid-row.styles.d.ts +1 -1
- package/dist/dts/data-grid/index.d.ts +1 -1
- package/dist/dts/design-system-provider/index.d.ts +14 -29
- package/dist/dts/design-tokens.d.ts +198 -82
- package/dist/dts/menu/index.d.ts +11 -6
- package/dist/dts/menu/menu.stories.d.ts +1 -1
- package/dist/dts/select/index.d.ts +1 -1
- package/dist/dts/select/select.stories.d.ts +8 -0
- package/dist/dts/select/select.styles.d.ts +1 -0
- package/dist/dts/skeleton/skeleton.stories.d.ts +1 -0
- package/dist/dts/styles/elevation.d.ts +44 -5
- package/dist/dts/styles/patterns/button.styles.d.ts +7 -6
- package/dist/dts/styles/patterns/index.d.ts +1 -1
- package/dist/dts/styles/patterns/input.styles.d.ts +22 -0
- package/dist/dts/text-area/text-area.stories.d.ts +1 -1
- package/dist/dts/tree-view/tree-view.stories.d.ts +0 -5
- package/dist/esm/accordion/accordion-item/accordion-item.styles.js +54 -17
- package/dist/esm/accordion/accordion-item/index.js +4 -22
- package/dist/esm/accordion/accordion.styles.js +4 -4
- package/dist/esm/anchor/anchor.stories.js +2 -2
- package/dist/esm/anchor/anchor.styles.js +8 -2
- package/dist/esm/badge/badge.styles.js +10 -2
- package/dist/esm/breadcrumb-item/breadcrumb-item.styles.js +44 -53
- package/dist/esm/breadcrumb-item/index.js +2 -4
- package/dist/esm/button/button.stories.js +1 -1
- package/dist/esm/button/button.styles.js +21 -71
- package/dist/esm/calendar/calendar.stories.js +115 -0
- package/dist/esm/calendar/calendar.styles.js +133 -0
- package/dist/esm/calendar/index.js +31 -0
- package/dist/esm/card/card.stories.js +14 -0
- package/dist/esm/card/card.styles.js +23 -32
- package/dist/esm/card/index.js +1 -1
- package/dist/esm/checkbox/checkbox.styles.js +58 -51
- package/dist/esm/checkbox/index.js +5 -13
- package/dist/esm/color/palette.js +174 -12
- package/dist/esm/color/recipes/contrast-and-delta-swatch-set.js +28 -0
- package/dist/esm/color/recipes/contrast-swatch.js +12 -0
- package/dist/esm/color/recipes/delta-swatch-set.js +53 -0
- package/dist/esm/color/recipes/{neutral-divider.js → delta-swatch.js} +3 -2
- package/dist/esm/color/recipes/focus-stroke.js +4 -3
- package/dist/esm/color/recipes/foreground-on-accent.js +14 -0
- package/dist/esm/color/recipes/gradient-shadow-stroke.js +54 -0
- package/dist/esm/color/recipes/gradient-swatch.js +36 -0
- package/dist/esm/color/recipes/neutral-layer-1.js +7 -1
- package/dist/esm/color/recipes/neutral-layer-2.js +3 -9
- package/dist/esm/color/recipes/neutral-layer-3.js +3 -3
- package/dist/esm/color/recipes/neutral-layer-4.js +3 -3
- package/dist/esm/color/recipes/neutral-layer-floating.js +3 -4
- package/dist/esm/color/recipes/underline-stroke.js +31 -0
- package/dist/esm/color/swatch.js +22 -2
- package/dist/esm/color/utilities/base-layer-luminance.js +2 -2
- package/dist/esm/combobox/combobox.stories.js +1 -0
- package/dist/esm/combobox/index.js +6 -9
- package/dist/esm/custom-elements.js +3 -1
- package/dist/esm/data-grid/data-grid-cell.styles.js +4 -4
- package/dist/esm/data-grid/data-grid-row.styles.js +3 -3
- package/dist/esm/design-system-provider/design-system-provider.vscode.definition.json +17 -9
- package/dist/esm/design-system-provider/index.js +24 -39
- package/dist/esm/design-tokens.js +303 -217
- package/dist/esm/dialog/dialog.styles.js +2 -3
- package/dist/esm/divider/divider.styles.js +1 -2
- package/dist/esm/flipper/flipper.styles.js +28 -65
- package/dist/esm/flipper/index.js +4 -8
- package/dist/esm/listbox/listbox.styles.js +8 -29
- package/dist/esm/listbox-option/listbox-option.styles.js +52 -35
- package/dist/esm/menu/index.js +16 -6
- package/dist/esm/menu/menu.stories.js +16 -2
- package/dist/esm/menu/menu.styles.js +38 -27
- package/dist/esm/menu-item/index.js +6 -33
- package/dist/esm/menu-item/menu-item.stories.js +1 -1
- package/dist/esm/menu-item/menu-item.styles.js +58 -84
- package/dist/esm/number-field/index.js +7 -3
- package/dist/esm/number-field/number-field.styles.js +30 -175
- package/dist/esm/progress/progress/index.js +1 -1
- package/dist/esm/progress/progress/progress.styles.js +13 -18
- package/dist/esm/progress/progress-ring/progress-ring.styles.js +65 -69
- package/dist/esm/radio/index.js +3 -1
- package/dist/esm/radio/radio.stories.js +3 -2
- package/dist/esm/radio/radio.styles.js +52 -42
- package/dist/esm/radio-group/radio-group.styles.js +0 -2
- package/dist/esm/select/index.js +6 -9
- package/dist/esm/select/select.stories.js +10 -2
- package/dist/esm/select/select.styles.js +100 -124
- package/dist/esm/select/select.vscode.definition.json +3 -0
- package/dist/esm/skeleton/skeleton.stories.js +3 -2
- package/dist/esm/skeleton/skeleton.styles.js +11 -6
- package/dist/esm/slider/slider.styles.js +54 -14
- package/dist/esm/slider-label/slider-label.styles.js +5 -6
- package/dist/esm/styles/direction.js +1 -1
- package/dist/esm/styles/elevation.js +54 -5
- package/dist/esm/styles/patterns/button.styles.js +274 -294
- package/dist/esm/styles/patterns/index.js +1 -1
- package/dist/esm/styles/patterns/input.styles.js +218 -0
- package/dist/esm/switch/index.js +3 -1
- package/dist/esm/switch/switch.stories.js +3 -3
- package/dist/esm/switch/switch.styles.js +79 -60
- package/dist/esm/tabs/tab/tab.styles.js +11 -14
- package/dist/esm/tabs/tabs.styles.js +9 -8
- package/dist/esm/text-area/text-area.stories.js +2 -2
- package/dist/esm/text-area/text-area.styles.js +16 -96
- package/dist/esm/text-field/text-field.stories.js +1 -1
- package/dist/esm/text-field/text-field.styles.js +16 -144
- package/dist/esm/toolbar/index.js +1 -0
- package/dist/esm/toolbar/toolbar.styles.js +56 -56
- package/dist/esm/tooltip/index.js +2 -4
- package/dist/esm/tooltip/tooltip.styles.js +14 -14
- package/dist/esm/tree-item/index.js +2 -8
- package/dist/esm/tree-item/tree-item.styles.js +45 -80
- package/dist/esm/tree-view/tree-view.stories.js +23 -11
- package/dist/fluent-web-components.api.json +4900 -2353
- package/dist/web-components.d.ts +397 -100
- package/dist/web-components.js +2240 -2175
- package/dist/web-components.min.js +158 -128
- package/docs/api-report.md +338 -80
- package/package.json +2 -5
- package/public/switches.ts +13 -14
- package/dist/dts/color/recipes/accent-fill.d.ts +0 -7
- package/dist/dts/color/recipes/accent-foreground.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-contrast.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-input.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-inverse.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-layer.d.ts +0 -6
- package/dist/dts/color/recipes/neutral-fill-stealth.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill.d.ts +0 -14
- package/dist/dts/color/recipes/neutral-foreground-hint.d.ts +0 -10
- package/dist/dts/color/recipes/neutral-foreground.d.ts +0 -6
- package/dist/dts/color/recipes/neutral-layer-card-container.d.ts +0 -6
- package/dist/dts/color/recipes/neutral-stroke-strong.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-stroke.d.ts +0 -7
- package/dist/dts/styles/patterns/input.d.ts +0 -4
- package/dist/dts/utilities/math.d.ts +0 -24
- package/dist/esm/color/recipes/accent-fill.js +0 -18
- package/dist/esm/color/recipes/accent-foreground.js +0 -31
- package/dist/esm/color/recipes/neutral-fill-contrast.js +0 -26
- package/dist/esm/color/recipes/neutral-fill-input.js +0 -14
- package/dist/esm/color/recipes/neutral-fill-inverse.js +0 -26
- package/dist/esm/color/recipes/neutral-fill-layer.js +0 -7
- package/dist/esm/color/recipes/neutral-fill-stealth.js +0 -14
- package/dist/esm/color/recipes/neutral-fill.js +0 -21
- package/dist/esm/color/recipes/neutral-foreground-hint.js +0 -10
- package/dist/esm/color/recipes/neutral-foreground.js +0 -6
- package/dist/esm/color/recipes/neutral-layer-card-container.js +0 -9
- package/dist/esm/color/recipes/neutral-stroke-strong.js +0 -15
- package/dist/esm/color/recipes/neutral-stroke.js +0 -18
- package/dist/esm/styles/patterns/input.js +0 -31
- package/dist/esm/utilities/math.js +0 -49
|
@@ -1,33 +1,65 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { disabledCursor, display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
|
|
3
3
|
import { SystemColors } from '@microsoft/fast-web-utilities';
|
|
4
|
-
import {
|
|
4
|
+
import { elevationShadowFlyout } from '../styles/elevation';
|
|
5
5
|
import { heightNumber } from '../styles/size';
|
|
6
6
|
import { appearanceBehavior } from '../utilities/behaviors';
|
|
7
|
-
import {
|
|
7
|
+
import { bodyFont, controlCornerRadius, designUnit, disabledOpacity, fillColor, focusStrokeOuter, layerCornerRadius, neutralFillActive, neutralFillHover, neutralFillRest, neutralFillSecondaryActive, neutralFillSecondaryHover, neutralFillSecondaryRest, neutralFillStealthActive, neutralFillStealthHover, neutralFillStealthRest, neutralForegroundRest, neutralStrokeControlActive, neutralStrokeControlHover, neutralStrokeControlRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
|
|
8
8
|
export const selectFilledStyles = (context, definition) => css `
|
|
9
|
-
:host
|
|
10
|
-
background: ${
|
|
9
|
+
:host {
|
|
10
|
+
background: ${neutralFillSecondaryRest};
|
|
11
11
|
border-color: transparent;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
:host([
|
|
15
|
-
background: ${
|
|
14
|
+
:host(:not([disabled]):not([open]):hover) {
|
|
15
|
+
background: ${neutralFillSecondaryHover};
|
|
16
16
|
border-color: transparent;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
:host([
|
|
20
|
-
|
|
19
|
+
:host(:not([disabled]):not([open]):active) {
|
|
20
|
+
background: ${neutralFillSecondaryActive};
|
|
21
|
+
border-color: transparent;
|
|
22
|
+
}
|
|
23
|
+
`.withBehaviors(forcedColorsStylesheetBehavior(css `
|
|
24
|
+
:host(:not([disabled]):not([open]):hover) {
|
|
25
|
+
background: transparent;
|
|
26
|
+
}
|
|
27
|
+
:host(:not([disabled]):not([open]):hover),
|
|
28
|
+
:host(:not([disabled]):not([open]):active) {
|
|
29
|
+
border-color: ${SystemColors.Highlight};
|
|
30
|
+
}
|
|
31
|
+
:host(:${focusVisible}) {
|
|
32
|
+
forced-color-adjust: none;
|
|
33
|
+
background: transparent;
|
|
34
|
+
border-color: ${SystemColors.Highlight};
|
|
35
|
+
box-shadow: 0 0 0 1px inset ${SystemColors.Highlight};
|
|
36
|
+
}
|
|
37
|
+
`));
|
|
38
|
+
export const selectStealthStyles = (context, definition) => css `
|
|
39
|
+
:host {
|
|
40
|
+
background: ${neutralFillStealthRest};
|
|
41
|
+
border-color: transparent;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host(:not([disabled]):not([open]):hover) {
|
|
45
|
+
background: ${neutralFillStealthHover};
|
|
46
|
+
border-color: transparent;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:host(:not([disabled]):not([open]):active) {
|
|
50
|
+
background: ${neutralFillStealthActive};
|
|
51
|
+
border-color: transparent;
|
|
21
52
|
}
|
|
22
53
|
`;
|
|
23
54
|
export const selectStyles = (context, definition) => css `
|
|
24
55
|
${display('inline-flex')} :host {
|
|
25
|
-
|
|
26
|
-
|
|
56
|
+
background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
|
|
57
|
+
border-box ${neutralStrokeControlRest};
|
|
58
|
+
border: calc(${strokeWidth} * 1px) solid transparent;
|
|
27
59
|
border-radius: calc(${controlCornerRadius} * 1px);
|
|
28
|
-
border: calc(${strokeWidth} * 1px) solid ${neutralStrokeRest};
|
|
29
60
|
box-sizing: border-box;
|
|
30
61
|
color: ${neutralForegroundRest};
|
|
62
|
+
fill: currentcolor;
|
|
31
63
|
font-family: ${bodyFont};
|
|
32
64
|
height: calc(${heightNumber} * 1px);
|
|
33
65
|
position: relative;
|
|
@@ -36,28 +68,29 @@ export const selectStyles = (context, definition) => css `
|
|
|
36
68
|
vertical-align: top;
|
|
37
69
|
}
|
|
38
70
|
|
|
39
|
-
.listbox {
|
|
40
|
-
${
|
|
41
|
-
background: ${
|
|
42
|
-
border-radius: calc(${
|
|
71
|
+
:host .listbox {
|
|
72
|
+
box-shadow: ${elevationShadowFlyout};
|
|
73
|
+
background: ${fillColor};
|
|
74
|
+
border-radius: calc(${layerCornerRadius} * 1px);
|
|
43
75
|
box-sizing: border-box;
|
|
44
76
|
display: inline-flex;
|
|
45
77
|
flex-direction: column;
|
|
46
78
|
left: 0;
|
|
47
79
|
max-height: calc(var(--max-height) - (${heightNumber} * 1px));
|
|
48
|
-
padding: calc(${designUnit} * 1px) 0;
|
|
80
|
+
padding: calc((${designUnit} - ${strokeWidth} ) * 1px) 0;
|
|
49
81
|
overflow-y: auto;
|
|
50
82
|
position: absolute;
|
|
51
83
|
width: 100%;
|
|
52
84
|
z-index: 1;
|
|
53
85
|
margin: 1px 0;
|
|
86
|
+
border: calc(${strokeWidth} * 1px) solid transparent;
|
|
54
87
|
}
|
|
55
88
|
|
|
56
|
-
.listbox[hidden] {
|
|
89
|
+
:host .listbox[hidden] {
|
|
57
90
|
display: none;
|
|
58
91
|
}
|
|
59
92
|
|
|
60
|
-
.control {
|
|
93
|
+
:host .control {
|
|
61
94
|
align-items: center;
|
|
62
95
|
box-sizing: border-box;
|
|
63
96
|
cursor: pointer;
|
|
@@ -70,13 +103,14 @@ export const selectStyles = (context, definition) => css `
|
|
|
70
103
|
width: 100%;
|
|
71
104
|
}
|
|
72
105
|
|
|
73
|
-
:host(:not([disabled]):hover) {
|
|
74
|
-
background: ${
|
|
75
|
-
|
|
106
|
+
:host(:not([disabled]):not([open]):hover) {
|
|
107
|
+
background: padding-box linear-gradient(${neutralFillHover}, ${neutralFillHover}),
|
|
108
|
+
border-box ${neutralStrokeControlHover};
|
|
76
109
|
}
|
|
77
110
|
|
|
78
|
-
:host(:
|
|
79
|
-
|
|
111
|
+
:host(:not([disabled]):not([open]):active) {
|
|
112
|
+
background: padding-box linear-gradient(${neutralFillActive}, ${neutralFillActive}),
|
|
113
|
+
border-box ${neutralStrokeControlActive};
|
|
80
114
|
}
|
|
81
115
|
|
|
82
116
|
:host(:${focusVisible}) {
|
|
@@ -85,19 +119,6 @@ export const selectStyles = (context, definition) => css `
|
|
|
85
119
|
box-shadow: 0 0 0 1px inset ${focusStrokeOuter};
|
|
86
120
|
}
|
|
87
121
|
|
|
88
|
-
:host([open]:${focusVisible}) {
|
|
89
|
-
border-color: ${neutralStrokeRest};
|
|
90
|
-
outline: none;
|
|
91
|
-
box-shadow: none;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
:host(:${focusVisible}) ::slotted([aria-selected="true"][role="option"]:not([disabled])) {
|
|
95
|
-
box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) inset ${focusStrokeInner};
|
|
96
|
-
border-color: ${focusStrokeOuter};
|
|
97
|
-
background: ${accentFillFocus};
|
|
98
|
-
color: ${foregroundOnAccentFocus};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
122
|
:host([disabled]) {
|
|
102
123
|
cursor: ${disabledCursor};
|
|
103
124
|
opacity: ${disabledOpacity};
|
|
@@ -108,36 +129,12 @@ export const selectStyles = (context, definition) => css `
|
|
|
108
129
|
user-select: none;
|
|
109
130
|
}
|
|
110
131
|
|
|
111
|
-
:host([disabled]:hover) {
|
|
112
|
-
background: ${neutralFillStealthRest};
|
|
113
|
-
color: ${neutralForegroundRest};
|
|
114
|
-
fill: currentcolor;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
:host(:not([disabled])) .control:active {
|
|
118
|
-
background: ${neutralFillInputActive};
|
|
119
|
-
border-color: ${neutralStrokeActive};
|
|
120
|
-
border-radius: calc(${controlCornerRadius} * 1px);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
132
|
:host([open][position='above']) .listbox {
|
|
124
|
-
|
|
125
|
-
border-bottom-right-radius: 0;
|
|
133
|
+
bottom: calc((${heightNumber} + ${designUnit} * 2) * 1px);
|
|
126
134
|
}
|
|
127
135
|
|
|
128
136
|
:host([open][position='below']) .listbox {
|
|
129
|
-
|
|
130
|
-
border-top-right-radius: 0;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
:host([open][position='above']) .listbox {
|
|
134
|
-
border-bottom: 0;
|
|
135
|
-
bottom: calc(${heightNumber} * 1px);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
:host([open][position='below']) .listbox {
|
|
139
|
-
border-top: 0;
|
|
140
|
-
top: calc(${heightNumber} * 1px);
|
|
137
|
+
top: calc((${heightNumber} + ${designUnit} * 2) * 1px);
|
|
141
138
|
}
|
|
142
139
|
|
|
143
140
|
.selected-value {
|
|
@@ -159,79 +156,58 @@ export const selectStyles = (context, definition) => css `
|
|
|
159
156
|
:host([open]) slot[name='listbox'] {
|
|
160
157
|
display: flex;
|
|
161
158
|
position: absolute;
|
|
162
|
-
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.start {
|
|
162
|
+
margin-inline-end: 11px;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
.end {
|
|
166
|
-
margin-inline-start:
|
|
166
|
+
margin-inline-start: 11px;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
.start,
|
|
170
170
|
.end,
|
|
171
171
|
.indicator,
|
|
172
|
-
.select-indicator,
|
|
173
172
|
::slotted(svg) {
|
|
174
|
-
|
|
175
|
-
fill: currentcolor;
|
|
176
|
-
height: 1em;
|
|
177
|
-
min-height: calc(${designUnit} * 4px);
|
|
178
|
-
min-width: calc(${designUnit} * 4px);
|
|
179
|
-
width: 1em;
|
|
173
|
+
display: flex;
|
|
180
174
|
}
|
|
181
175
|
|
|
182
176
|
::slotted([role='option']) {
|
|
183
177
|
flex: 0 0 auto;
|
|
184
178
|
}
|
|
185
|
-
`.withBehaviors(appearanceBehavior('filled', selectFilledStyles(context, definition)), forcedColorsStylesheetBehavior(css `
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
:
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
:host(:${focusVisible}) ::slotted([aria-selected="true"][role="option"]:not([disabled])) {
|
|
223
|
-
background: ${SystemColors.Highlight};
|
|
224
|
-
border-color: ${SystemColors.ButtonText};
|
|
225
|
-
box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) inset ${SystemColors.HighlightText};
|
|
226
|
-
color: ${SystemColors.HighlightText};
|
|
227
|
-
fill: currentcolor;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
::slotted([role='option']:not([aria-selected='true']):not([disabled]):hover) {
|
|
231
|
-
forced-color-adjust: none;
|
|
232
|
-
color: ${SystemColors.ButtonText};
|
|
233
|
-
background: ${SystemColors.ButtonFace};
|
|
234
|
-
border-color: ${SystemColors.Highlight};
|
|
235
|
-
box-shadow: none;
|
|
236
|
-
}
|
|
237
|
-
`));
|
|
179
|
+
`.withBehaviors(appearanceBehavior('filled', selectFilledStyles(context, definition)), appearanceBehavior('stealth', selectStealthStyles(context, definition)), forcedColorsStylesheetBehavior(css `
|
|
180
|
+
:host {
|
|
181
|
+
background: ${SystemColors.ButtonFace};
|
|
182
|
+
color: ${SystemColors.ButtonText};
|
|
183
|
+
}
|
|
184
|
+
:host(:not([disabled]):not([open]):hover) {
|
|
185
|
+
background: transparent;
|
|
186
|
+
}
|
|
187
|
+
:host(:not([disabled]):hover) {
|
|
188
|
+
border-color: ${SystemColors.Highlight};
|
|
189
|
+
}
|
|
190
|
+
:host(:${focusVisible}) {
|
|
191
|
+
forced-color-adjust: none;
|
|
192
|
+
border-color: ${SystemColors.Highlight};
|
|
193
|
+
box-shadow: 0 0 0 1px inset ${SystemColors.Highlight};
|
|
194
|
+
}
|
|
195
|
+
:host([open]) .listbox {
|
|
196
|
+
background: ${SystemColors.ButtonFace};
|
|
197
|
+
border-color: ${SystemColors.CanvasText};
|
|
198
|
+
}
|
|
199
|
+
.start, .end, .indicator, ::slotted(svg) {
|
|
200
|
+
fill: ${SystemColors.FieldText};
|
|
201
|
+
}
|
|
202
|
+
:host([disabled]) {
|
|
203
|
+
border-color: ${SystemColors.GrayText};
|
|
204
|
+
color: ${SystemColors.GrayText};
|
|
205
|
+
opacity: 1;
|
|
206
|
+
}
|
|
207
|
+
:host([disabled]) .start,
|
|
208
|
+
:host([disabled]) .end,
|
|
209
|
+
:host([disabled]) .indicator,
|
|
210
|
+
:host([disabled]) ::slotted(svg) {
|
|
211
|
+
fill: ${SystemColors.GrayText};
|
|
212
|
+
}
|
|
213
|
+
`));
|
|
@@ -4,6 +4,7 @@ export default {
|
|
|
4
4
|
component: fluentSkeleton,
|
|
5
5
|
argTypes: {
|
|
6
6
|
shape: {
|
|
7
|
+
defaultValue: 'rect',
|
|
7
8
|
options: ['circle', 'rect'],
|
|
8
9
|
control: { type: 'radio' },
|
|
9
10
|
},
|
|
@@ -16,7 +17,7 @@ const SkeletonTemplate = ({ shape, shimmer }) => `
|
|
|
16
17
|
<fluent-skeleton
|
|
17
18
|
${shape ? `shape="${shape}"` : ''}
|
|
18
19
|
${shimmer ? 'shimmer' : ''}
|
|
19
|
-
style="
|
|
20
|
+
style="margin-top: 10px; height: 50px; width: 50px"
|
|
20
21
|
></fluent-skeleton>
|
|
21
22
|
`;
|
|
22
23
|
export const Skeleton = SkeletonTemplate.bind({});
|
|
@@ -25,7 +26,7 @@ Skeleton.args = {
|
|
|
25
26
|
shimmer: false,
|
|
26
27
|
};
|
|
27
28
|
const example = `
|
|
28
|
-
<fluent-skeleton style="
|
|
29
|
+
<fluent-skeleton style="height: 50px; width: 50px" shape="rect"></fluent-skeleton>
|
|
29
30
|
`;
|
|
30
31
|
Skeleton.parameters = {
|
|
31
32
|
docs: {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
|
-
import { display } from '@microsoft/fast-foundation';
|
|
3
|
-
import {
|
|
2
|
+
import { display, forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation';
|
|
3
|
+
import { SystemColors } from "@microsoft/fast-web-utilities";
|
|
4
|
+
import { controlCornerRadius, neutralFillSecondaryHover, neutralFillSecondaryRest } from '../design-tokens';
|
|
4
5
|
export const skeletonStyles = (context, definition) => css `
|
|
5
6
|
${display('block')} :host {
|
|
6
|
-
--skeleton-fill-default:
|
|
7
|
+
--skeleton-fill-default: ${neutralFillSecondaryRest};
|
|
7
8
|
overflow: hidden;
|
|
8
9
|
width: 100%;
|
|
9
10
|
position: relative;
|
|
@@ -11,7 +12,7 @@ export const skeletonStyles = (context, definition) => css `
|
|
|
11
12
|
--skeleton-animation-gradient-default: linear-gradient(
|
|
12
13
|
270deg,
|
|
13
14
|
var(--skeleton-fill, var(--skeleton-fill-default)) 0%,
|
|
14
|
-
|
|
15
|
+
${neutralFillSecondaryHover} 51%,
|
|
15
16
|
var(--skeleton-fill, var(--skeleton-fill-default)) 100%
|
|
16
17
|
);
|
|
17
18
|
--skeleton-animation-timing-default: ease-in-out;
|
|
@@ -45,7 +46,7 @@ export const skeletonStyles = (context, definition) => css `
|
|
|
45
46
|
background-image: var(--skeleton-animation-gradient, var(--skeleton-animation-gradient-default));
|
|
46
47
|
background-size: 0px 0px / 90% 100%;
|
|
47
48
|
background-repeat: no-repeat;
|
|
48
|
-
background-color: var(--skeleton-animation-fill, ${
|
|
49
|
+
background-color: var(--skeleton-animation-fill, ${neutralFillSecondaryRest});
|
|
49
50
|
animation: shimmer 2s infinite;
|
|
50
51
|
animation-timing-function: var(--skeleton-animation-timing, var(--skeleton-timing-default));
|
|
51
52
|
animation-direction: normal;
|
|
@@ -69,4 +70,8 @@ export const skeletonStyles = (context, definition) => css `
|
|
|
69
70
|
transform: translateX(100%);
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
`.withBehaviors(forcedColorsStylesheetBehavior(css `
|
|
74
|
+
:host{
|
|
75
|
+
background-color: ${SystemColors.CanvasText};
|
|
76
|
+
}
|
|
77
|
+
`));
|
|
@@ -2,16 +2,15 @@ import { css } from '@microsoft/fast-element';
|
|
|
2
2
|
import { SystemColors } from '@microsoft/fast-web-utilities';
|
|
3
3
|
import { disabledCursor, display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
|
|
4
4
|
import { heightNumber } from '../styles';
|
|
5
|
-
import { controlCornerRadius, designUnit, disabledOpacity, fillColor, focusStrokeOuter,
|
|
5
|
+
import { accentFillActive, accentFillHover, accentFillRest, controlCornerRadius, designUnit, disabledOpacity, fillColor, focusStrokeOuter, neutralFillRest, neutralFillStrongRest, neutralStrokeControlActive, neutralStrokeControlHover, neutralStrokeControlRest, neutralStrokeStrongRest, strokeWidth, } from '../design-tokens';
|
|
6
6
|
export const sliderStyles = (context, definition) => css `
|
|
7
7
|
${display('inline-grid')} :host {
|
|
8
|
-
--thumb-size: calc(${heightNumber} *
|
|
8
|
+
--thumb-size: calc((${heightNumber} / 2) + ${designUnit} + (${strokeWidth} * 2));
|
|
9
9
|
--thumb-translate: calc(var(--thumb-size) * -0.5 + var(--track-width) / 2);
|
|
10
10
|
--track-overhang: calc((${designUnit} / 2) * -1);
|
|
11
11
|
--track-width: ${designUnit};
|
|
12
12
|
align-items: center;
|
|
13
13
|
width: 100%;
|
|
14
|
-
margin: calc(${designUnit} * 1px) 0;
|
|
15
14
|
user-select: none;
|
|
16
15
|
box-sizing: border-box;
|
|
17
16
|
border-radius: calc(${controlCornerRadius} * 1px);
|
|
@@ -41,19 +40,47 @@ export const sliderStyles = (context, definition) => css `
|
|
|
41
40
|
transition: all 0.2s ease;
|
|
42
41
|
}
|
|
43
42
|
.thumb-cursor {
|
|
43
|
+
display: flex;
|
|
44
|
+
position: relative;
|
|
44
45
|
border: none;
|
|
45
46
|
width: calc(var(--thumb-size) * 1px);
|
|
46
47
|
height: calc(var(--thumb-size) * 1px);
|
|
47
|
-
background: ${
|
|
48
|
+
background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
|
|
49
|
+
border-box ${neutralStrokeControlRest};
|
|
50
|
+
border: calc(${strokeWidth} * 1px) solid transparent;
|
|
51
|
+
border-radius: 50%;
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
}
|
|
54
|
+
.thumb-cursor::after {
|
|
55
|
+
content: '';
|
|
56
|
+
display: block;
|
|
48
57
|
border-radius: 50%;
|
|
58
|
+
width: 100%;
|
|
59
|
+
margin: 4px;
|
|
60
|
+
background: ${accentFillRest};
|
|
61
|
+
}
|
|
62
|
+
:host(:not(.disabled)) .thumb-cursor:hover::after {
|
|
63
|
+
background: ${accentFillHover};
|
|
64
|
+
margin: 3px;
|
|
49
65
|
}
|
|
50
|
-
.thumb-cursor:
|
|
51
|
-
background: ${
|
|
52
|
-
|
|
66
|
+
:host(:not(.disabled)) .thumb-cursor:active::after {
|
|
67
|
+
background: ${accentFillActive};
|
|
68
|
+
margin: 5px;
|
|
53
69
|
}
|
|
54
|
-
.thumb-cursor:
|
|
55
|
-
background: ${
|
|
56
|
-
|
|
70
|
+
:host(:not(.disabled)) .thumb-cursor:hover {
|
|
71
|
+
background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
|
|
72
|
+
border-box ${neutralStrokeControlHover};
|
|
73
|
+
}
|
|
74
|
+
:host(:not(.disabled)) .thumb-cursor:active {
|
|
75
|
+
background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
|
|
76
|
+
border-box ${neutralStrokeControlActive};
|
|
77
|
+
}
|
|
78
|
+
.track-start {
|
|
79
|
+
background: ${accentFillRest};
|
|
80
|
+
position: absolute;
|
|
81
|
+
height: 100%;
|
|
82
|
+
left: 0;
|
|
83
|
+
border-radius: calc(${controlCornerRadius} * 1px);
|
|
57
84
|
}
|
|
58
85
|
:host(.horizontal) .thumb-container {
|
|
59
86
|
transform: translateX(calc(var(--thumb-size) * 0.5px)) translateY(calc(var(--thumb-translate) * 1px));
|
|
@@ -77,7 +104,10 @@ export const sliderStyles = (context, definition) => css `
|
|
|
77
104
|
height: 100%;
|
|
78
105
|
}
|
|
79
106
|
.track {
|
|
80
|
-
background: ${
|
|
107
|
+
background: ${neutralFillStrongRest};
|
|
108
|
+
border: 1px solid ${neutralStrokeStrongRest};
|
|
109
|
+
border-radius: 2px;
|
|
110
|
+
box-sizing: border-box;
|
|
81
111
|
position: absolute;
|
|
82
112
|
}
|
|
83
113
|
:host(.vertical) {
|
|
@@ -85,6 +115,11 @@ export const sliderStyles = (context, definition) => css `
|
|
|
85
115
|
min-height: calc(${designUnit} * 60px);
|
|
86
116
|
min-width: calc(${designUnit} * 20px);
|
|
87
117
|
}
|
|
118
|
+
:host(.vertical) .track-start {
|
|
119
|
+
height: auto;
|
|
120
|
+
width: 100%;
|
|
121
|
+
top: 0;
|
|
122
|
+
}
|
|
88
123
|
:host(.disabled),
|
|
89
124
|
:host(.readonly) {
|
|
90
125
|
cursor: ${disabledCursor};
|
|
@@ -98,18 +133,23 @@ export const sliderStyles = (context, definition) => css `
|
|
|
98
133
|
border-color: ${SystemColors.FieldText};
|
|
99
134
|
background: ${SystemColors.FieldText};
|
|
100
135
|
}
|
|
101
|
-
.thumb-cursor:hover,
|
|
102
|
-
.thumb-cursor:active {
|
|
136
|
+
:host(:not(.disabled)) .thumb-cursor:hover,
|
|
137
|
+
:host(:not(.disabled)) .thumb-cursor:active {
|
|
103
138
|
background: ${SystemColors.Highlight};
|
|
104
139
|
}
|
|
105
140
|
.track {
|
|
106
141
|
forced-color-adjust: none;
|
|
107
142
|
background: ${SystemColors.FieldText};
|
|
108
143
|
}
|
|
144
|
+
.thumb-cursor::after,
|
|
145
|
+
:host(:not(.disabled)) .thumb-cursor:hover::after,
|
|
146
|
+
:host(:not(.disabled)) .thumb-cursor:active::after {
|
|
147
|
+
background: ${SystemColors.Field};
|
|
148
|
+
}
|
|
109
149
|
:host(:${focusVisible}) .thumb-cursor {
|
|
110
150
|
background: ${SystemColors.Highlight};
|
|
111
151
|
border-color: ${SystemColors.Highlight};
|
|
112
|
-
box-shadow: 0 0 0
|
|
152
|
+
box-shadow: 0 0 0 1px ${SystemColors.Field}, 0 0 0 3px ${SystemColors.FieldText};
|
|
113
153
|
}
|
|
114
154
|
:host(.disabled) {
|
|
115
155
|
opacity: 1;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { SystemColors } from '@microsoft/fast-web-utilities';
|
|
3
3
|
import { display, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
|
|
4
|
-
import {
|
|
5
|
-
import { bodyFont, designUnit, disabledOpacity, neutralStrokeRest } from '../design-tokens';
|
|
4
|
+
import { bodyFont, designUnit, disabledOpacity, neutralStrokeStrongRest, strokeWidth } from '../design-tokens';
|
|
6
5
|
export const sliderLabelStyles = (context, definition) => css `
|
|
7
6
|
${display('block')} :host {
|
|
8
7
|
font-family: ${bodyFont};
|
|
@@ -14,7 +13,7 @@ export const sliderLabelStyles = (context, definition) => css `
|
|
|
14
13
|
:host(.horizontal) {
|
|
15
14
|
align-self: start;
|
|
16
15
|
grid-row: 2;
|
|
17
|
-
margin-top: -
|
|
16
|
+
margin-top: -4px;
|
|
18
17
|
}
|
|
19
18
|
:host(.vertical) {
|
|
20
19
|
justify-self: start;
|
|
@@ -43,9 +42,9 @@ export const sliderLabelStyles = (context, definition) => css `
|
|
|
43
42
|
margin: 2px 0;
|
|
44
43
|
}
|
|
45
44
|
.mark {
|
|
46
|
-
width: calc(
|
|
47
|
-
height: calc(${
|
|
48
|
-
background: ${
|
|
45
|
+
width: calc(${strokeWidth} * 1px);
|
|
46
|
+
height: calc(${designUnit} * 1px);
|
|
47
|
+
background: ${neutralStrokeStrongRest};
|
|
49
48
|
justify-self: center;
|
|
50
49
|
}
|
|
51
50
|
:host(.vertical) .mark {
|
|
@@ -57,7 +57,7 @@ class DirectionalStyleSheetBehaviorSubscription {
|
|
|
57
57
|
this.attached = null;
|
|
58
58
|
}
|
|
59
59
|
handleChange({ target, token }) {
|
|
60
|
-
this.attach(token.getValueFor(
|
|
60
|
+
this.attach(token.getValueFor(this.source));
|
|
61
61
|
}
|
|
62
62
|
attach(direction) {
|
|
63
63
|
if (this.attached !== this[direction]) {
|
|
@@ -1,25 +1,74 @@
|
|
|
1
|
+
import { DesignToken } from '@microsoft/fast-foundation';
|
|
1
2
|
/**
|
|
2
3
|
* Define shadow algorithms.
|
|
3
4
|
*
|
|
4
5
|
* TODO: The --background-luminance will need to be derived from JavaScript. For now
|
|
5
6
|
* this is hard-coded to a 1, the relative luminance of pure white.
|
|
6
7
|
* https://github.com/microsoft/fast/issues/2778
|
|
8
|
+
* opacity was `calc(.11 * (2 - var(--background-luminance, 1)))`
|
|
7
9
|
*
|
|
8
10
|
* @internal
|
|
9
|
-
* @deprecated
|
|
11
|
+
* @deprecated Use elevationShadow design token
|
|
10
12
|
*/
|
|
11
|
-
export const ambientShadow = '0 0
|
|
13
|
+
export const ambientShadow = '0 0 2px rgba(0, 0, 0, 0.14)';
|
|
12
14
|
/**
|
|
13
15
|
* @internal
|
|
14
|
-
* @deprecated
|
|
16
|
+
* @deprecated Use elevationShadow design token
|
|
15
17
|
*/
|
|
16
|
-
export const directionalShadow = '0 calc(var(--elevation) * 0.
|
|
18
|
+
export const directionalShadow = '0 calc(var(--elevation) * 0.5px) calc((var(--elevation) * 1px)) rgba(0, 0, 0, 0.2)';
|
|
17
19
|
/**
|
|
18
20
|
* Applies the box-shadow CSS rule set to the elevation formula.
|
|
19
21
|
* Control this formula with the --elevation CSS Custom Property
|
|
20
22
|
* by setting --elevation to a number.
|
|
21
23
|
*
|
|
22
24
|
* @public
|
|
23
|
-
* @deprecated
|
|
25
|
+
* @deprecated Use elevationShadow design token
|
|
24
26
|
*/
|
|
25
27
|
export const elevation = `box-shadow: ${ambientShadow}, ${directionalShadow};`;
|
|
28
|
+
/**
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export const elevationShadowRecipe = DesignToken.create({
|
|
32
|
+
name: 'elevation-shadow',
|
|
33
|
+
cssCustomPropertyName: null,
|
|
34
|
+
}).withDefault({
|
|
35
|
+
evaluate: (element, size, reference) => {
|
|
36
|
+
let ambientOpacity = 0.12;
|
|
37
|
+
let directionalOpacity = 0.14;
|
|
38
|
+
if (size > 16) {
|
|
39
|
+
ambientOpacity = 0.2;
|
|
40
|
+
directionalOpacity = 0.24;
|
|
41
|
+
}
|
|
42
|
+
const ambient = `0 0 2px rgba(0, 0, 0, ${ambientOpacity})`;
|
|
43
|
+
const directional = `0 calc(${size} * 0.5px) calc((${size} * 1px)) rgba(0, 0, 0, ${directionalOpacity})`;
|
|
44
|
+
return `${ambient}, ${directional}`;
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
/** @public */
|
|
48
|
+
export const elevationShadowCardRestSize = DesignToken.create('elevation-shadow-card-rest-size').withDefault(4);
|
|
49
|
+
/** @public */
|
|
50
|
+
export const elevationShadowCardHoverSize = DesignToken.create('elevation-shadow-card-hover-size').withDefault(8);
|
|
51
|
+
/** @public */
|
|
52
|
+
export const elevationShadowCardActiveSize = DesignToken.create('elevation-shadow-card-active-size').withDefault(0);
|
|
53
|
+
/** @public */
|
|
54
|
+
export const elevationShadowCardFocusSize = DesignToken.create('elevation-shadow-card-focus-size').withDefault(8);
|
|
55
|
+
/** @public */
|
|
56
|
+
export const elevationShadowCardRest = DesignToken.create('elevation-shadow-card-rest').withDefault((element) => elevationShadowRecipe.getValueFor(element).evaluate(element, elevationShadowCardRestSize.getValueFor(element)));
|
|
57
|
+
/** @public */
|
|
58
|
+
export const elevationShadowCardHover = DesignToken.create('elevation-shadow-card-hover').withDefault((element) => elevationShadowRecipe.getValueFor(element).evaluate(element, elevationShadowCardHoverSize.getValueFor(element)));
|
|
59
|
+
/** @public */
|
|
60
|
+
export const elevationShadowCardActive = DesignToken.create('elevation-shadow-card-active').withDefault((element) => elevationShadowRecipe.getValueFor(element).evaluate(element, elevationShadowCardActiveSize.getValueFor(element)));
|
|
61
|
+
/** @public */
|
|
62
|
+
export const elevationShadowCardFocus = DesignToken.create('elevation-shadow-card-focus').withDefault((element) => elevationShadowRecipe.getValueFor(element).evaluate(element, elevationShadowCardFocusSize.getValueFor(element)));
|
|
63
|
+
/** @public */
|
|
64
|
+
export const elevationShadowTooltipSize = DesignToken.create('elevation-shadow-tooltip-size').withDefault(16);
|
|
65
|
+
/** @public */
|
|
66
|
+
export const elevationShadowTooltip = DesignToken.create('elevation-shadow-tooltip').withDefault((element) => elevationShadowRecipe.getValueFor(element).evaluate(element, elevationShadowTooltipSize.getValueFor(element)));
|
|
67
|
+
/** @public */
|
|
68
|
+
export const elevationShadowFlyoutSize = DesignToken.create('elevation-shadow-flyout-size').withDefault(32);
|
|
69
|
+
/** @public */
|
|
70
|
+
export const elevationShadowFlyout = DesignToken.create('elevation-shadow-flyout').withDefault((element) => elevationShadowRecipe.getValueFor(element).evaluate(element, elevationShadowFlyoutSize.getValueFor(element)));
|
|
71
|
+
/** @public */
|
|
72
|
+
export const elevationShadowDialogSize = DesignToken.create('elevation-shadow-dialog-size').withDefault(128);
|
|
73
|
+
/** @public */
|
|
74
|
+
export const elevationShadowDialog = DesignToken.create('elevation-shadow-dialog').withDefault((element) => elevationShadowRecipe.getValueFor(element).evaluate(element, elevationShadowDialogSize.getValueFor(element)));
|