@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.
Files changed (170) hide show
  1. package/CHANGELOG.json +103 -1
  2. package/CHANGELOG.md +40 -2
  3. package/dist/dts/calendar/calendar.stories.d.ts +86 -0
  4. package/dist/dts/calendar/calendar.styles.d.ts +7 -0
  5. package/dist/dts/calendar/index.d.ts +18 -0
  6. package/dist/dts/color/palette.d.ts +43 -1
  7. package/dist/dts/color/recipes/contrast-and-delta-swatch-set.d.ts +11 -0
  8. package/dist/dts/color/recipes/contrast-swatch.d.ts +12 -0
  9. package/dist/dts/color/recipes/delta-swatch-set.d.ts +36 -0
  10. package/dist/dts/color/recipes/{neutral-divider.d.ts → delta-swatch.d.ts} +3 -2
  11. package/dist/dts/color/recipes/focus-stroke.d.ts +2 -2
  12. package/dist/dts/color/recipes/foreground-on-accent.d.ts +6 -0
  13. package/dist/dts/color/recipes/gradient-shadow-stroke.d.ts +7 -0
  14. package/dist/dts/color/recipes/gradient-swatch.d.ts +36 -0
  15. package/dist/dts/color/recipes/neutral-layer-1.d.ts +4 -0
  16. package/dist/dts/color/recipes/neutral-layer-2.d.ts +1 -5
  17. package/dist/dts/color/recipes/neutral-layer-3.d.ts +1 -1
  18. package/dist/dts/color/recipes/neutral-layer-4.d.ts +1 -1
  19. package/dist/dts/color/recipes/neutral-layer-floating.d.ts +1 -1
  20. package/dist/dts/color/recipes/underline-stroke.d.ts +7 -0
  21. package/dist/dts/color/swatch.d.ts +7 -0
  22. package/dist/dts/color/utilities/base-layer-luminance.d.ts +2 -2
  23. package/dist/dts/combobox/index.d.ts +1 -2
  24. package/dist/dts/custom-elements.d.ts +4 -2
  25. package/dist/dts/data-grid/data-grid-row.styles.d.ts +1 -1
  26. package/dist/dts/data-grid/index.d.ts +1 -1
  27. package/dist/dts/design-system-provider/index.d.ts +14 -29
  28. package/dist/dts/design-tokens.d.ts +198 -82
  29. package/dist/dts/menu/index.d.ts +11 -6
  30. package/dist/dts/menu/menu.stories.d.ts +1 -1
  31. package/dist/dts/select/index.d.ts +1 -1
  32. package/dist/dts/select/select.stories.d.ts +8 -0
  33. package/dist/dts/select/select.styles.d.ts +1 -0
  34. package/dist/dts/skeleton/skeleton.stories.d.ts +1 -0
  35. package/dist/dts/styles/elevation.d.ts +44 -5
  36. package/dist/dts/styles/patterns/button.styles.d.ts +7 -6
  37. package/dist/dts/styles/patterns/index.d.ts +1 -1
  38. package/dist/dts/styles/patterns/input.styles.d.ts +22 -0
  39. package/dist/dts/text-area/text-area.stories.d.ts +1 -1
  40. package/dist/dts/tree-view/tree-view.stories.d.ts +0 -5
  41. package/dist/esm/accordion/accordion-item/accordion-item.styles.js +54 -17
  42. package/dist/esm/accordion/accordion-item/index.js +4 -22
  43. package/dist/esm/accordion/accordion.styles.js +4 -4
  44. package/dist/esm/anchor/anchor.stories.js +2 -2
  45. package/dist/esm/anchor/anchor.styles.js +8 -2
  46. package/dist/esm/badge/badge.styles.js +10 -2
  47. package/dist/esm/breadcrumb-item/breadcrumb-item.styles.js +44 -53
  48. package/dist/esm/breadcrumb-item/index.js +2 -4
  49. package/dist/esm/button/button.stories.js +1 -1
  50. package/dist/esm/button/button.styles.js +21 -71
  51. package/dist/esm/calendar/calendar.stories.js +115 -0
  52. package/dist/esm/calendar/calendar.styles.js +133 -0
  53. package/dist/esm/calendar/index.js +31 -0
  54. package/dist/esm/card/card.stories.js +14 -0
  55. package/dist/esm/card/card.styles.js +23 -32
  56. package/dist/esm/card/index.js +1 -1
  57. package/dist/esm/checkbox/checkbox.styles.js +58 -51
  58. package/dist/esm/checkbox/index.js +5 -13
  59. package/dist/esm/color/palette.js +174 -12
  60. package/dist/esm/color/recipes/contrast-and-delta-swatch-set.js +28 -0
  61. package/dist/esm/color/recipes/contrast-swatch.js +12 -0
  62. package/dist/esm/color/recipes/delta-swatch-set.js +53 -0
  63. package/dist/esm/color/recipes/{neutral-divider.js → delta-swatch.js} +3 -2
  64. package/dist/esm/color/recipes/focus-stroke.js +4 -3
  65. package/dist/esm/color/recipes/foreground-on-accent.js +14 -0
  66. package/dist/esm/color/recipes/gradient-shadow-stroke.js +54 -0
  67. package/dist/esm/color/recipes/gradient-swatch.js +36 -0
  68. package/dist/esm/color/recipes/neutral-layer-1.js +7 -1
  69. package/dist/esm/color/recipes/neutral-layer-2.js +3 -9
  70. package/dist/esm/color/recipes/neutral-layer-3.js +3 -3
  71. package/dist/esm/color/recipes/neutral-layer-4.js +3 -3
  72. package/dist/esm/color/recipes/neutral-layer-floating.js +3 -4
  73. package/dist/esm/color/recipes/underline-stroke.js +31 -0
  74. package/dist/esm/color/swatch.js +22 -2
  75. package/dist/esm/color/utilities/base-layer-luminance.js +2 -2
  76. package/dist/esm/combobox/combobox.stories.js +1 -0
  77. package/dist/esm/combobox/index.js +6 -9
  78. package/dist/esm/custom-elements.js +3 -1
  79. package/dist/esm/data-grid/data-grid-cell.styles.js +4 -4
  80. package/dist/esm/data-grid/data-grid-row.styles.js +3 -3
  81. package/dist/esm/design-system-provider/design-system-provider.vscode.definition.json +17 -9
  82. package/dist/esm/design-system-provider/index.js +24 -39
  83. package/dist/esm/design-tokens.js +303 -217
  84. package/dist/esm/dialog/dialog.styles.js +2 -3
  85. package/dist/esm/divider/divider.styles.js +1 -2
  86. package/dist/esm/flipper/flipper.styles.js +28 -65
  87. package/dist/esm/flipper/index.js +4 -8
  88. package/dist/esm/listbox/listbox.styles.js +8 -29
  89. package/dist/esm/listbox-option/listbox-option.styles.js +52 -35
  90. package/dist/esm/menu/index.js +16 -6
  91. package/dist/esm/menu/menu.stories.js +16 -2
  92. package/dist/esm/menu/menu.styles.js +38 -27
  93. package/dist/esm/menu-item/index.js +6 -33
  94. package/dist/esm/menu-item/menu-item.stories.js +1 -1
  95. package/dist/esm/menu-item/menu-item.styles.js +58 -84
  96. package/dist/esm/number-field/index.js +7 -3
  97. package/dist/esm/number-field/number-field.styles.js +30 -175
  98. package/dist/esm/progress/progress/index.js +1 -1
  99. package/dist/esm/progress/progress/progress.styles.js +13 -18
  100. package/dist/esm/progress/progress-ring/progress-ring.styles.js +65 -69
  101. package/dist/esm/radio/index.js +3 -1
  102. package/dist/esm/radio/radio.stories.js +3 -2
  103. package/dist/esm/radio/radio.styles.js +52 -42
  104. package/dist/esm/radio-group/radio-group.styles.js +0 -2
  105. package/dist/esm/select/index.js +6 -9
  106. package/dist/esm/select/select.stories.js +10 -2
  107. package/dist/esm/select/select.styles.js +100 -124
  108. package/dist/esm/select/select.vscode.definition.json +3 -0
  109. package/dist/esm/skeleton/skeleton.stories.js +3 -2
  110. package/dist/esm/skeleton/skeleton.styles.js +11 -6
  111. package/dist/esm/slider/slider.styles.js +54 -14
  112. package/dist/esm/slider-label/slider-label.styles.js +5 -6
  113. package/dist/esm/styles/direction.js +1 -1
  114. package/dist/esm/styles/elevation.js +54 -5
  115. package/dist/esm/styles/patterns/button.styles.js +274 -294
  116. package/dist/esm/styles/patterns/index.js +1 -1
  117. package/dist/esm/styles/patterns/input.styles.js +218 -0
  118. package/dist/esm/switch/index.js +3 -1
  119. package/dist/esm/switch/switch.stories.js +3 -3
  120. package/dist/esm/switch/switch.styles.js +79 -60
  121. package/dist/esm/tabs/tab/tab.styles.js +11 -14
  122. package/dist/esm/tabs/tabs.styles.js +9 -8
  123. package/dist/esm/text-area/text-area.stories.js +2 -2
  124. package/dist/esm/text-area/text-area.styles.js +16 -96
  125. package/dist/esm/text-field/text-field.stories.js +1 -1
  126. package/dist/esm/text-field/text-field.styles.js +16 -144
  127. package/dist/esm/toolbar/index.js +1 -0
  128. package/dist/esm/toolbar/toolbar.styles.js +56 -56
  129. package/dist/esm/tooltip/index.js +2 -4
  130. package/dist/esm/tooltip/tooltip.styles.js +14 -14
  131. package/dist/esm/tree-item/index.js +2 -8
  132. package/dist/esm/tree-item/tree-item.styles.js +45 -80
  133. package/dist/esm/tree-view/tree-view.stories.js +23 -11
  134. package/dist/fluent-web-components.api.json +4900 -2353
  135. package/dist/web-components.d.ts +397 -100
  136. package/dist/web-components.js +2240 -2175
  137. package/dist/web-components.min.js +158 -128
  138. package/docs/api-report.md +338 -80
  139. package/package.json +2 -5
  140. package/public/switches.ts +13 -14
  141. package/dist/dts/color/recipes/accent-fill.d.ts +0 -7
  142. package/dist/dts/color/recipes/accent-foreground.d.ts +0 -7
  143. package/dist/dts/color/recipes/neutral-fill-contrast.d.ts +0 -7
  144. package/dist/dts/color/recipes/neutral-fill-input.d.ts +0 -7
  145. package/dist/dts/color/recipes/neutral-fill-inverse.d.ts +0 -7
  146. package/dist/dts/color/recipes/neutral-fill-layer.d.ts +0 -6
  147. package/dist/dts/color/recipes/neutral-fill-stealth.d.ts +0 -7
  148. package/dist/dts/color/recipes/neutral-fill.d.ts +0 -14
  149. package/dist/dts/color/recipes/neutral-foreground-hint.d.ts +0 -10
  150. package/dist/dts/color/recipes/neutral-foreground.d.ts +0 -6
  151. package/dist/dts/color/recipes/neutral-layer-card-container.d.ts +0 -6
  152. package/dist/dts/color/recipes/neutral-stroke-strong.d.ts +0 -7
  153. package/dist/dts/color/recipes/neutral-stroke.d.ts +0 -7
  154. package/dist/dts/styles/patterns/input.d.ts +0 -4
  155. package/dist/dts/utilities/math.d.ts +0 -24
  156. package/dist/esm/color/recipes/accent-fill.js +0 -18
  157. package/dist/esm/color/recipes/accent-foreground.js +0 -31
  158. package/dist/esm/color/recipes/neutral-fill-contrast.js +0 -26
  159. package/dist/esm/color/recipes/neutral-fill-input.js +0 -14
  160. package/dist/esm/color/recipes/neutral-fill-inverse.js +0 -26
  161. package/dist/esm/color/recipes/neutral-fill-layer.js +0 -7
  162. package/dist/esm/color/recipes/neutral-fill-stealth.js +0 -14
  163. package/dist/esm/color/recipes/neutral-fill.js +0 -21
  164. package/dist/esm/color/recipes/neutral-foreground-hint.js +0 -10
  165. package/dist/esm/color/recipes/neutral-foreground.js +0 -6
  166. package/dist/esm/color/recipes/neutral-layer-card-container.js +0 -9
  167. package/dist/esm/color/recipes/neutral-stroke-strong.js +0 -15
  168. package/dist/esm/color/recipes/neutral-stroke.js +0 -18
  169. package/dist/esm/styles/patterns/input.js +0 -31
  170. 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 { elevation } from '../styles/elevation';
4
+ import { elevationShadowFlyout } from '../styles/elevation';
5
5
  import { heightNumber } from '../styles/size';
6
6
  import { appearanceBehavior } from '../utilities/behaviors';
7
- import { accentFillFocus, bodyFont, controlCornerRadius, designUnit, disabledOpacity, focusStrokeInner, focusStrokeOuter, focusStrokeWidth, foregroundOnAccentFocus, neutralFillHover, neutralFillInputActive, neutralFillInputHover, neutralFillInputRest, neutralFillRest, neutralFillStealthRest, neutralForegroundRest, neutralLayerFloating, neutralStrokeActive, neutralStrokeHover, neutralStrokeRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
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([appearance='filled']) {
10
- background: ${neutralFillRest};
9
+ :host {
10
+ background: ${neutralFillSecondaryRest};
11
11
  border-color: transparent;
12
12
  }
13
13
 
14
- :host([appearance='filled']:hover:not([disabled])) {
15
- background: ${neutralFillHover};
14
+ :host(:not([disabled]):not([open]):hover) {
15
+ background: ${neutralFillSecondaryHover};
16
16
  border-color: transparent;
17
17
  }
18
18
 
19
- :host([appearance="filled"]:${focusVisible}) {
20
- border-color: ${focusStrokeOuter};
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
- --elevation: 14;
26
- background: ${neutralFillInputRest};
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
- ${elevation}
41
- background: ${neutralLayerFloating};
42
- border-radius: calc(${controlCornerRadius} * 1px);
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: ${neutralFillInputHover};
75
- border-color: ${neutralStrokeHover};
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(:focus) {
79
- outline: none;
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
- border-bottom-left-radius: 0;
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
- border-top-left-radius: 0;
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
- ${elevation}
159
+ }
160
+
161
+ .start {
162
+ margin-inline-end: 11px;
163
163
  }
164
164
 
165
165
  .end {
166
- margin-inline-start: auto;
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
- ${`` /* Glyph size is temporary - replace when glyph-size var is added */}
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
- :host([disabled]) {
187
- border-color: ${SystemColors.GrayText};
188
- background-color: ${SystemColors.ButtonFace};
189
- color: ${SystemColors.GrayText};
190
- opacity: 1;
191
- forced-color-adjust: none;
192
- }
193
-
194
- :host([disabled]:hover) {
195
- background: ${SystemColors.ButtonFace};
196
- }
197
-
198
- :host([disabled]) .control {
199
- color: ${SystemColors.GrayText};
200
- border-color: ${SystemColors.GrayText};
201
- }
202
-
203
- :host(:not([disabled]):hover) {
204
- background: ${SystemColors.ButtonFace};
205
- border-color: ${SystemColors.Highlight};
206
- }
207
-
208
- :host(:${focusVisible}) {
209
- forced-color-adjust: none;
210
- background: ${SystemColors.ButtonFace};
211
- border-color: ${SystemColors.Highlight};
212
- box-shadow: 0 0 0 1px inset ${SystemColors.Highlight};
213
- color: ${SystemColors.ButtonText};
214
- fill: currentcolor;
215
- }
216
-
217
- :host([open]) .listbox {
218
- background: ${SystemColors.ButtonFace};
219
- border: 1px solid ${SystemColors.ButtonText};
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
+ `));
@@ -17,6 +17,9 @@
17
17
  },
18
18
  {
19
19
  "name": "outline"
20
+ },
21
+ {
22
+ "name": "stealth"
20
23
  }
21
24
  ],
22
25
  "default": "outline",
@@ -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="border-radius: 4px; margin-top: 10px; height: 10px" width: 100px"
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="border-radius: 4px; margin-top: 10px; height: 10px" shape="rect"></fluent-skeleton>
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 { controlCornerRadius, neutralFillRest } from '../design-tokens';
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: #e1dfdd;
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
- #f3f2f1 51.13%,
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, ${neutralFillRest});
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, neutralForegroundRest, neutralStrokeActive, neutralStrokeHover, neutralStrokeRest, } from '../design-tokens';
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} * 0.5);
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: ${neutralForegroundRest};
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:hover {
51
- background: ${neutralForegroundRest};
52
- border-color: ${neutralStrokeHover};
66
+ :host(:not(.disabled)) .thumb-cursor:active::after {
67
+ background: ${accentFillActive};
68
+ margin: 5px;
53
69
  }
54
- .thumb-cursor:active {
55
- background: ${neutralForegroundRest};
56
- border-color: ${neutralStrokeActive};
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: ${neutralStrokeRest};
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 2px ${SystemColors.Field}, 0 0 0 4px ${SystemColors.FieldText};
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 { heightNumber } from '../styles';
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: -2px;
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((${designUnit} / 2) * 1px);
47
- height: calc(${heightNumber} * 0.25 * 1px);
48
- background: ${neutralStrokeRest};
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(target));
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 Will be replaced
11
+ * @deprecated Use elevationShadow design token
10
12
  */
11
- export const ambientShadow = '0 0 calc((var(--elevation) * 0.225px) + 2px) rgba(0, 0, 0, calc(.11 * (2 - var(--background-luminance, 1))))';
13
+ export const ambientShadow = '0 0 2px rgba(0, 0, 0, 0.14)';
12
14
  /**
13
15
  * @internal
14
- * @deprecated Will be replaced
16
+ * @deprecated Use elevationShadow design token
15
17
  */
16
- export const directionalShadow = '0 calc(var(--elevation) * 0.4px) calc((var(--elevation) * 0.9px)) rgba(0, 0, 0, calc(.13 * (2 - var(--background-luminance, 1))))';
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 Will be replaced
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)));