@fluentui/web-components 2.5.6 → 2.5.7

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 (37) hide show
  1. package/CHANGELOG.json +31 -1
  2. package/CHANGELOG.md +11 -2
  3. package/dist/dts/combobox/combobox.stories.d.ts +5 -0
  4. package/dist/dts/custom-elements.d.ts +3 -35
  5. package/dist/dts/number-field/index.d.ts +1 -1
  6. package/dist/dts/number-field/number-field.styles.d.ts +1 -2
  7. package/dist/dts/search/index.d.ts +1 -1
  8. package/dist/dts/search/search.styles.d.ts +2 -3
  9. package/dist/dts/select/index.d.ts +1 -1
  10. package/dist/dts/select/select.styles.d.ts +11 -3
  11. package/dist/dts/styles/patterns/button.styles.d.ts +12 -6
  12. package/dist/dts/styles/patterns/input.styles.d.ts +13 -5
  13. package/dist/dts/text-area/index.d.ts +2 -18
  14. package/dist/dts/text-area/text-area.stories.d.ts +1 -17
  15. package/dist/dts/text-area/text-area.styles.d.ts +1 -2
  16. package/dist/dts/text-field/index.d.ts +2 -18
  17. package/dist/dts/text-field/text-field.stories.d.ts +1 -17
  18. package/dist/dts/text-field/text-field.styles.d.ts +1 -2
  19. package/dist/esm/anchor/anchor.styles.js +3 -10
  20. package/dist/esm/button/button.styles.js +14 -39
  21. package/dist/esm/combobox/combobox.stories.js +7 -2
  22. package/dist/esm/combobox/combobox.styles.js +22 -32
  23. package/dist/esm/number-field/number-field.styles.js +5 -16
  24. package/dist/esm/search/search.styles.js +8 -11
  25. package/dist/esm/select/select.stories.js +2 -2
  26. package/dist/esm/select/select.styles.js +35 -100
  27. package/dist/esm/styles/patterns/button.styles.js +190 -149
  28. package/dist/esm/styles/patterns/input.styles.js +112 -93
  29. package/dist/esm/text-area/text-area.styles.js +5 -11
  30. package/dist/esm/text-field/text-field.styles.js +5 -11
  31. package/dist/fluent-web-components.api.json +127 -397
  32. package/dist/web-components.d.ts +39 -90
  33. package/dist/web-components.js +99 -100
  34. package/dist/web-components.min.js +93 -123
  35. package/docs/api-report.md +38 -99
  36. package/karma.conf.js +3 -8
  37. package/package.json +27 -40
@@ -6,10 +6,14 @@ import { accentFillActive, accentFillHover, accentFillRest, accentForegroundActi
6
6
  import { typeRampBase } from '../../styles/patterns/type-ramp';
7
7
  import { focusTreatmentBase, focusTreatmentTight } from '../focus';
8
8
  /**
9
+ * The base styles for button controls, without `appearance` visual differences.
10
+ *
9
11
  * @internal
10
12
  */
11
- export const baseButtonStyles = (context, definition, interactivitySelector = '', nonInteractivitySelector = '') => css `
12
- ${display('inline-flex')} :host {
13
+ export const baseButtonStyles = (context, definition, interactivitySelector, nonInteractivitySelector = '[disabled]') => css `
14
+ ${display('inline-flex')}
15
+
16
+ :host {
13
17
  position: relative;
14
18
  box-sizing: border-box;
15
19
  ${typeRampBase}
@@ -18,12 +22,9 @@ export const baseButtonStyles = (context, definition, interactivitySelector = ''
18
22
  color: ${neutralForegroundRest};
19
23
  border-radius: calc(${controlCornerRadius} * 1px);
20
24
  fill: currentcolor;
21
- cursor: pointer;
22
25
  }
23
26
 
24
- :host .control {
25
- background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
26
- border-box ${neutralStrokeControlRest};
27
+ .control {
27
28
  border: calc(${strokeWidth} * 1px) solid transparent;
28
29
  flex-grow: 1;
29
30
  box-sizing: border-box;
@@ -37,7 +38,6 @@ export const baseButtonStyles = (context, definition, interactivitySelector = ''
37
38
  color: inherit;
38
39
  border-radius: inherit;
39
40
  fill: inherit;
40
- cursor: inherit;
41
41
  font-family: inherit;
42
42
  }
43
43
 
@@ -52,24 +52,10 @@ export const baseButtonStyles = (context, definition, interactivitySelector = ''
52
52
  line-height: 0;
53
53
  }
54
54
 
55
- :host .control${interactivitySelector}:hover {
56
- background: padding-box linear-gradient(${neutralFillHover}, ${neutralFillHover}),
57
- border-box ${neutralStrokeControlHover};
58
- }
59
-
60
- :host .control${interactivitySelector}:active {
61
- background: padding-box linear-gradient(${neutralFillActive}, ${neutralFillActive}),
62
- border-box ${neutralStrokeControlActive};
63
- }
64
-
65
- :host .control:${focusVisible} {
55
+ .control:${focusVisible} {
66
56
  ${focusTreatmentBase}
67
57
  }
68
58
 
69
- :host .control${nonInteractivitySelector} {
70
- background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}), border-box ${neutralStrokeRest};
71
- }
72
-
73
59
  .control::-moz-focus-inner {
74
60
  border: 0;
75
61
  }
@@ -91,114 +77,138 @@ export const baseButtonStyles = (context, definition, interactivitySelector = ''
91
77
  .end {
92
78
  margin-inline-start: 11px;
93
79
  }
80
+ `;
81
+ /**
82
+ * @internal
83
+ */
84
+ export const NeutralButtonStyles = (context, definition, interactivitySelector, nonInteractivitySelector = '[disabled]') => css `
85
+ .control {
86
+ background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
87
+ border-box ${neutralStrokeControlRest};
88
+ }
89
+
90
+ :host(${interactivitySelector}:hover) .control {
91
+ background: padding-box linear-gradient(${neutralFillHover}, ${neutralFillHover}),
92
+ border-box ${neutralStrokeControlHover};
93
+ }
94
+
95
+ :host(${interactivitySelector}:active) .control {
96
+ background: padding-box linear-gradient(${neutralFillActive}, ${neutralFillActive}),
97
+ border-box ${neutralStrokeControlActive};
98
+ }
99
+
100
+ :host(${nonInteractivitySelector}) .control {
101
+ background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
102
+ border-box ${neutralStrokeRest};
103
+ }
94
104
  `.withBehaviors(forcedColorsStylesheetBehavior(css `
95
- :host .control {
105
+ .control {
96
106
  background: ${SystemColors.ButtonFace};
97
107
  border-color: ${SystemColors.ButtonText};
98
108
  color: ${SystemColors.ButtonText};
99
- fill: currentcolor;
100
109
  }
101
- :host(:not([disabled])) .control:hover,
102
- :host .control${interactivitySelector}:hover,
103
- .control${interactivitySelector}:hover {
110
+
111
+ :host(${interactivitySelector}:hover) .control,
112
+ :host(${interactivitySelector}:active) .control {
104
113
  forced-color-adjust: none;
105
- background: ${SystemColors.Highlight};
106
- color: ${SystemColors.HighlightText};
114
+ background: ${SystemColors.HighlightText};
115
+ border-color: ${SystemColors.Highlight};
116
+ color: ${SystemColors.Highlight};
107
117
  }
108
- .control:${focusVisible},
109
- :host .control:${focusVisible},
110
- :host(:${focusVisible}) .control {
111
- forced-color-adjust: none;
112
- background: ${SystemColors.ButtonFace};
113
- outline-color: ${SystemColors.Highlight};
118
+
119
+ :host(${nonInteractivitySelector}) .control {
120
+ background: transparent;
121
+ border-color: ${SystemColors.GrayText};
122
+ color: ${SystemColors.GrayText};
123
+ }
124
+
125
+ .control:${focusVisible} {
126
+ outline-color: ${SystemColors.CanvasText};
114
127
  }
128
+
115
129
  :host([href]) .control {
116
- background: ${SystemColors.ButtonFace};
130
+ background: transparent;
117
131
  border-color: ${SystemColors.LinkText};
118
132
  color: ${SystemColors.LinkText};
119
- fill: currentcolor;
120
- }
121
- :host([href]) .control:hover,
122
- :host(.neutral[href]) .control:hover {
123
- background: ${SystemColors.LinkText};
124
- border-color: ${SystemColors.LinkText} !important;
125
- color: ${SystemColors.HighlightText};
126
- fill: currentcolor;
127
133
  }
128
- :host([href]) .control:${focusVisible}{
129
- forced-color-adjust: none;
130
- outline-color: ${SystemColors.LinkText};
134
+
135
+ :host([href]:hover) .control,
136
+ :host([href]:active) .control {
137
+ background: transparent;
138
+ border-color: ${SystemColors.CanvasText};
139
+ color: ${SystemColors.CanvasText};
131
140
  }
132
141
  `));
133
142
  /**
134
143
  * @internal
135
144
  */
136
- export const AccentButtonStyles = (context, definition, interactivitySelector = '', nonInteractivitySelector = '') => css `
137
- :host .control {
145
+ export const AccentButtonStyles = (context, definition, interactivitySelector, nonInteractivitySelector = '[disabled]') => css `
146
+ .control {
138
147
  background: padding-box linear-gradient(${accentFillRest}, ${accentFillRest}),
139
148
  border-box ${accentStrokeControlRest};
140
149
  color: ${foregroundOnAccentRest};
141
150
  }
142
151
 
143
- :host .control${interactivitySelector}:hover {
152
+ :host(${interactivitySelector}:hover) .control {
144
153
  background: padding-box linear-gradient(${accentFillHover}, ${accentFillHover}),
145
154
  border-box ${accentStrokeControlHover};
146
155
  color: ${foregroundOnAccentHover};
147
156
  }
148
157
 
149
- :host .control${interactivitySelector}:active {
158
+ :host(${interactivitySelector}:active) .control {
150
159
  background: padding-box linear-gradient(${accentFillActive}, ${accentFillActive}),
151
160
  border-box ${accentStrokeControlActive};
152
161
  color: ${foregroundOnAccentActive};
153
162
  }
154
163
 
155
- :host .control:${focusVisible} {
156
- ${focusTreatmentBase}
157
- box-shadow: 0 0 0 calc(((${focusStrokeWidth} + ${strokeWidth}) - ${strokeWidth}) * 1px) ${focusStrokeInner} inset !important;
164
+ :host(${nonInteractivitySelector}) .control {
165
+ background: ${accentFillRest};
158
166
  }
159
167
 
160
- :host .control${nonInteractivitySelector} {
161
- background: ${accentFillRest};
168
+ .control:${focusVisible} {
169
+ box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) ${focusStrokeInner} inset !important;
162
170
  }
163
171
  `.withBehaviors(forcedColorsStylesheetBehavior(css `
164
- :host .control {
172
+ .control {
165
173
  forced-color-adjust: none;
166
174
  background: ${SystemColors.Highlight};
167
175
  color: ${SystemColors.HighlightText};
168
176
  }
169
- :host .control${interactivitySelector}:hover,
170
- :host .control${interactivitySelector}:active {
177
+
178
+ :host(${interactivitySelector}:hover) .control,
179
+ :host(${interactivitySelector}:active) .control {
171
180
  background: ${SystemColors.HighlightText};
172
181
  border-color: ${SystemColors.Highlight};
173
182
  color: ${SystemColors.Highlight};
174
183
  }
175
- :host .control:${focusVisible} {
176
- background: ${SystemColors.Highlight};
177
- outline-color: ${SystemColors.Highlight};
178
- box-shadow: 0 0 0 calc(((${focusStrokeWidth} + ${strokeWidth}) - ${strokeWidth}) * 1px) ${SystemColors.HighlightText} inset !important;
184
+
185
+ :host(${nonInteractivitySelector}) .control {
186
+ background: transparent;
187
+ border-color: ${SystemColors.GrayText};
188
+ color: ${SystemColors.GrayText};
189
+ }
190
+
191
+ .control:${focusVisible} {
192
+ outline-color: ${SystemColors.CanvasText};
193
+ box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) ${SystemColors.HighlightText} inset !important;
179
194
  }
195
+
180
196
  :host([href]) .control {
181
197
  background: ${SystemColors.LinkText};
182
198
  color: ${SystemColors.HighlightText};
183
199
  }
184
- :host([href]) .control:hover {
200
+
201
+ :host([href]:hover) .control,
202
+ :host([href]:active) .control {
185
203
  background: ${SystemColors.ButtonFace};
186
204
  border-color: ${SystemColors.LinkText};
187
205
  color: ${SystemColors.LinkText};
188
- fill: currentcolor;
189
- }
190
- :host([href]) .control:${focusVisible} {
191
- background: ${SystemColors.LinkText};
192
- outline-color: ${SystemColors.LinkText};
193
- box-shadow: 0 0 0 calc(((${focusStrokeWidth} + ${strokeWidth}) - ${strokeWidth}) * 1px) ${SystemColors.HighlightText} inset !important;
194
- color: ${SystemColors.HighlightText};
195
- fill: currentcolor;
196
206
  }
197
207
  `));
198
208
  /**
199
209
  * @internal
200
210
  */
201
- export const HypertextStyles = (context, definition, interactivitySelector = '', nonInteractivitySelector = '') => css `
211
+ export const HypertextStyles = (context, definition, interactivitySelector, nonInteractivitySelector = '[disabled]') => css `
202
212
  :host {
203
213
  height: auto;
204
214
  font-family: inherit;
@@ -207,180 +217,211 @@ export const HypertextStyles = (context, definition, interactivitySelector = '',
207
217
  min-width: 0;
208
218
  }
209
219
 
210
- :host .control {
220
+ .control {
211
221
  display: inline;
212
222
  padding: 0;
213
- background: transparent;
214
223
  border: none;
215
224
  box-shadow: none;
216
225
  line-height: 1;
217
- text-decoration: underline 1px;
218
- }
219
-
220
- :host .control:not([href]) {
221
- background: transparent;
222
226
  }
223
227
 
224
- :host .control${interactivitySelector} {
225
- background: transparent;
228
+ :host(${interactivitySelector}) .control {
226
229
  color: ${accentForegroundRest};
230
+ text-decoration: underline 1px;
227
231
  }
228
232
 
229
- :host .control${interactivitySelector}:hover {
230
- background: transparent;
233
+ :host(${interactivitySelector}:hover) .control {
231
234
  color: ${accentForegroundHover};
232
235
  text-decoration: none;
233
236
  }
234
237
 
235
- :host .control${interactivitySelector}:active {
236
- background: transparent;
238
+ :host(${interactivitySelector}:active) .control {
237
239
  color: ${accentForegroundActive};
238
240
  text-decoration: none;
239
241
  }
240
242
 
241
- :host .control:${focusVisible} {
243
+ .control:${focusVisible} {
242
244
  ${focusTreatmentTight}
243
245
  }
244
-
245
- :host .control${nonInteractivitySelector} {
246
- background: transparent;
247
- }
248
246
  `.withBehaviors(forcedColorsStylesheetBehavior(css `
249
- :host .control${interactivitySelector}:hover {
250
- color: ${SystemColors.Highlight};
251
- fill: currentcolor;
252
- }
253
- :host .control:${focusVisible} {
254
- color: ${SystemColors.LinkText};
255
- }
247
+ :host(${interactivitySelector}) .control {
248
+ color: ${SystemColors.LinkText};
249
+ }
250
+
251
+ :host(${interactivitySelector}:hover) .control,
252
+ :host(${interactivitySelector}:active) .control {
253
+ color: ${SystemColors.CanvasText};
254
+ }
255
+
256
+ .control:${focusVisible} {
257
+ outline-color: ${SystemColors.CanvasText};
258
+ }
256
259
  `));
257
260
  /**
258
261
  * @internal
259
262
  */
260
- export const LightweightButtonStyles = (context, definition, interactivitySelector = '', nonInteractivitySelector = '') => css `
263
+ export const LightweightButtonStyles = (context, definition, interactivitySelector, nonInteractivitySelector = '[disabled]') => css `
261
264
  :host {
262
265
  color: ${accentForegroundRest};
263
266
  }
264
267
 
265
- :host .control {
268
+ .control {
266
269
  background: ${neutralFillStealthRest};
267
270
  }
268
271
 
269
- :host .control${interactivitySelector}:hover {
272
+ :host(${interactivitySelector}:hover) .control {
270
273
  background: ${neutralFillStealthHover};
271
274
  color: ${accentForegroundHover};
272
275
  }
273
276
 
274
- :host .control${interactivitySelector}:active {
277
+ :host(${interactivitySelector}:active) .control {
275
278
  background: ${neutralFillStealthActive};
276
279
  color: ${accentForegroundActive};
277
280
  }
278
281
 
279
- :host .control${nonInteractivitySelector} {
282
+ :host(${nonInteractivitySelector}) .control {
280
283
  background: ${neutralFillStealthRest};
281
284
  }
282
285
  `.withBehaviors(forcedColorsStylesheetBehavior(css `
283
- :host .control {
284
- border-color: ${SystemColors.ButtonFace};
286
+ :host {
285
287
  color: ${SystemColors.ButtonText};
286
288
  }
287
- :host .control${interactivitySelector}:hover,
288
- :host .control${interactivitySelector}:active,
289
- :host .control:${focusVisible} {
290
- border-color: ${SystemColors.Highlight};
291
- background: ${SystemColors.Highlight};
292
- color: ${SystemColors.HighlightText};
289
+
290
+ .control {
291
+ forced-color-adjust: none;
292
+ background: transparent;
293
+ }
294
+
295
+ :host(${interactivitySelector}:hover) .control,
296
+ :host(${interactivitySelector}:active) .control {
297
+ background: transparent;
298
+ border-color: ${SystemColors.ButtonText};
299
+ color: ${SystemColors.ButtonText};
293
300
  }
301
+
302
+ :host(${nonInteractivitySelector}) .control {
303
+ background: transparent;
304
+ color: ${SystemColors.GrayText};
305
+ }
306
+
307
+ .control:${focusVisible} {
308
+ outline-color: ${SystemColors.CanvasText};
309
+ }
310
+
294
311
  :host([href]) .control {
295
- border-color: ${SystemColors.ButtonFace};
296
312
  color: ${SystemColors.LinkText};
297
313
  }
298
- :host([href]) .control:hover,
299
- :host([href]) .control:${focusVisible} {
300
- background: ${SystemColors.ButtonFace};
314
+
315
+ :host([href]:hover) .control,
316
+ :host([href]:active) .control {
317
+ border-color: ${SystemColors.LinkText};
301
318
  color: ${SystemColors.LinkText};
302
319
  }
303
320
  `));
304
321
  /**
305
322
  * @internal
306
323
  */
307
- export const OutlineButtonStyles = (context, definition, interactivitySelector = '', nonInteractivitySelector = '') => css `
308
- :host .control {
324
+ export const OutlineButtonStyles = (context, definition, interactivitySelector, nonInteractivitySelector = '[disabled]') => css `
325
+ .control {
309
326
  background: transparent !important;
310
327
  border-color: ${neutralStrokeRest};
311
328
  }
312
329
 
313
- :host .control${interactivitySelector}:hover {
330
+ :host(${interactivitySelector}:hover) .control {
314
331
  border-color: ${neutralStrokeHover};
315
332
  }
316
333
 
317
- :host .control${interactivitySelector}:active {
334
+ :host(${interactivitySelector}:active) .control {
318
335
  border-color: ${neutralStrokeActive};
319
336
  }
320
337
 
321
- :host .control${nonInteractivitySelector} {
338
+ :host(${nonInteractivitySelector}) .control {
322
339
  background: transparent !important;
323
340
  border-color: ${neutralStrokeRest};
324
341
  }
325
342
  `.withBehaviors(forcedColorsStylesheetBehavior(css `
326
- :host .control${nonInteractivitySelector} {
343
+ .control {
327
344
  border-color: ${SystemColors.ButtonText};
345
+ color: ${SystemColors.ButtonText};
328
346
  }
329
- :host .control${interactivitySelector}:hover {
347
+
348
+ :host(${interactivitySelector}:hover) .control,
349
+ :host(${interactivitySelector}:active) .control {
350
+ background: ${SystemColors.HighlightText};
330
351
  border-color: ${SystemColors.Highlight};
331
- color: ${SystemColors.ButtonText};
352
+ color: ${SystemColors.Highlight};
332
353
  }
333
- :host([href]) {
334
- border-color: ${SystemColors.LinkText};
354
+
355
+ :host(${nonInteractivitySelector}) .control {
356
+ border-color: ${SystemColors.GrayText};
357
+ color: ${SystemColors.GrayText};
335
358
  }
336
- :host([href]) .control:hover {
337
- outline-color: ${SystemColors.LinkText};
359
+
360
+ .control:${focusVisible} {
361
+ outline-color: ${SystemColors.CanvasText};
362
+ }
363
+
364
+ :host([href]) .control {
365
+ border-color: ${SystemColors.LinkText};
338
366
  color: ${SystemColors.LinkText};
339
367
  }
368
+
369
+ :host([href]:hover) .control,
370
+ :host([href]:active) .control {
371
+ border-color: ${SystemColors.CanvasText};
372
+ color: ${SystemColors.CanvasText};
373
+ }
340
374
  `));
341
375
  /**
342
376
  * @internal
343
377
  */
344
- export const StealthButtonStyles = (context, definition, interactivitySelector = '', nonInteractivitySelector = '') => css `
345
- :host .control {
378
+ export const StealthButtonStyles = (context, definition, interactivitySelector, nonInteractivitySelector = '[disabled]') => css `
379
+ .control {
346
380
  background: ${neutralFillStealthRest};
347
381
  }
348
382
 
349
- :host .control${interactivitySelector}:hover {
383
+ :host(${interactivitySelector}:hover) .control {
350
384
  background: ${neutralFillStealthHover};
351
385
  }
352
386
 
353
- :host .control${interactivitySelector}:active {
387
+ :host(${interactivitySelector}:active) .control {
354
388
  background: ${neutralFillStealthActive};
355
389
  }
356
390
 
357
- :host .control${nonInteractivitySelector} {
391
+ :host(${nonInteractivitySelector}) .control {
358
392
  background: ${neutralFillStealthRest};
359
393
  }
360
394
  `.withBehaviors(forcedColorsStylesheetBehavior(css `
361
- :host .control {
362
- background: ${SystemColors.ButtonFace};
363
- border-color: ${SystemColors.ButtonFace};
395
+ .control {
396
+ forced-color-adjust: none;
397
+ background: transparent;
364
398
  color: ${SystemColors.ButtonText};
365
- fill: currentcolor;
366
399
  }
367
- :host .control${interactivitySelector}:hover,
368
- :host .control${interactivitySelector}:active,
369
- :host .control:${focusVisible} {
370
- background: ${SystemColors.Highlight};
371
- border-color: ${SystemColors.Highlight};
372
- color: ${SystemColors.HighlightText};
373
- fill: currentcolor;
400
+
401
+ :host(${interactivitySelector}:hover) .control,
402
+ :host(${interactivitySelector}:active) .control {
403
+ background: transparent;
404
+ border-color: ${SystemColors.ButtonText};
405
+ color: ${SystemColors.ButtonText};
374
406
  }
407
+
408
+ :host(${nonInteractivitySelector}) .control {
409
+ background: transparent;
410
+ color: ${SystemColors.GrayText};
411
+ }
412
+
413
+ .control:${focusVisible} {
414
+ outline-color: ${SystemColors.CanvasText};
415
+ }
416
+
375
417
  :host([href]) .control {
376
- border-color: ${SystemColors.ButtonFace};
377
418
  color: ${SystemColors.LinkText};
378
419
  }
379
- :host([href]) .control:hover,
380
- :host([href]) .control:${focusVisible} {
381
- background: ${SystemColors.LinkText};
420
+
421
+ :host([href]:hover) .control,
422
+ :host([href]:active) .control {
423
+ background: transparent;
382
424
  border-color: ${SystemColors.LinkText};
383
- color: ${SystemColors.HighlightText};
384
- fill: currentcolor;
425
+ color: ${SystemColors.LinkText};
385
426
  }
386
427
  `));