@fluentui/web-components 2.5.5 → 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 (59) hide show
  1. package/CHANGELOG.json +46 -1
  2. package/CHANGELOG.md +20 -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/focus.d.ts +13 -0
  12. package/dist/dts/styles/index.d.ts +1 -0
  13. package/dist/dts/styles/patterns/button.styles.d.ts +12 -6
  14. package/dist/dts/styles/patterns/input.styles.d.ts +13 -5
  15. package/dist/dts/text-area/index.d.ts +2 -18
  16. package/dist/dts/text-area/text-area.stories.d.ts +1 -17
  17. package/dist/dts/text-area/text-area.styles.d.ts +1 -2
  18. package/dist/dts/text-field/index.d.ts +2 -18
  19. package/dist/dts/text-field/text-field.stories.d.ts +1 -17
  20. package/dist/dts/text-field/text-field.styles.d.ts +1 -2
  21. package/dist/esm/accordion/accordion-item/accordion-item.styles.js +8 -10
  22. package/dist/esm/anchor/anchor.styles.js +3 -10
  23. package/dist/esm/breadcrumb-item/breadcrumb-item.styles.js +6 -10
  24. package/dist/esm/button/button.styles.js +14 -39
  25. package/dist/esm/checkbox/checkbox.styles.js +4 -8
  26. package/dist/esm/combobox/combobox.stories.js +7 -2
  27. package/dist/esm/combobox/combobox.styles.js +22 -23
  28. package/dist/esm/data-grid/data-grid-cell.styles.js +6 -9
  29. package/dist/esm/flipper/flipper.styles.js +5 -6
  30. package/dist/esm/listbox/listbox.styles.js +3 -4
  31. package/dist/esm/listbox-option/listbox-option.styles.js +9 -6
  32. package/dist/esm/menu/menu.styles.js +1 -1
  33. package/dist/esm/menu-item/menu-item.styles.js +5 -9
  34. package/dist/esm/number-field/number-field.styles.js +5 -16
  35. package/dist/esm/progress/progress/progress.styles.js +0 -1
  36. package/dist/esm/progress/progress-ring/progress-ring.styles.js +0 -1
  37. package/dist/esm/radio/radio.styles.js +4 -9
  38. package/dist/esm/search/search.styles.js +8 -11
  39. package/dist/esm/select/select.stories.js +2 -2
  40. package/dist/esm/select/select.styles.js +37 -110
  41. package/dist/esm/styles/focus.js +21 -0
  42. package/dist/esm/styles/index.js +1 -0
  43. package/dist/esm/styles/patterns/button.styles.js +194 -161
  44. package/dist/esm/styles/patterns/input.styles.js +113 -102
  45. package/dist/esm/switch/switch.styles.js +5 -17
  46. package/dist/esm/tabs/tab/tab.styles.js +4 -6
  47. package/dist/esm/text-area/text-area.stories.js +2 -2
  48. package/dist/esm/text-area/text-area.styles.js +5 -11
  49. package/dist/esm/text-field/text-field.styles.js +5 -11
  50. package/dist/esm/toolbar/toolbar.styles.js +4 -3
  51. package/dist/esm/tree-item/tree-item.styles.js +4 -14
  52. package/dist/esm/tree-view/tree-view.styles.js +0 -4
  53. package/dist/fluent-web-components.api.json +179 -397
  54. package/dist/web-components.d.ts +54 -90
  55. package/dist/web-components.js +158 -132
  56. package/dist/web-components.min.js +137 -156
  57. package/docs/api-report.md +44 -99
  58. package/karma.conf.js +3 -8
  59. package/package.json +27 -40
@@ -4,72 +4,34 @@ import { SystemColors } from '@microsoft/fast-web-utilities';
4
4
  import { elevationShadowFlyout } from '../styles/elevation';
5
5
  import { heightNumber } from '../styles/size';
6
6
  import { appearanceBehavior } from '../utilities/behaviors';
7
- import { bodyFont, controlCornerRadius, designUnit, disabledOpacity, fillColor, focusStrokeOuter, layerCornerRadius, neutralFillActive, neutralFillHover, neutralFillRest, neutralFillSecondaryActive, neutralFillSecondaryHover, neutralFillSecondaryRest, neutralFillStealthActive, neutralFillStealthHover, neutralFillStealthRest, neutralForegroundRest, neutralStrokeControlActive, neutralStrokeControlHover, neutralStrokeControlRest, strokeWidth, } from '../design-tokens';
7
+ import { bodyFont, controlCornerRadius, designUnit, disabledOpacity, fillColor, layerCornerRadius, neutralForegroundRest, strokeWidth, } from '../design-tokens';
8
8
  import { typeRampBase } from '../styles/patterns/type-ramp';
9
- export const selectFilledStyles = (context, definition) => css `
10
- :host {
11
- background: ${neutralFillSecondaryRest};
12
- border-color: transparent;
13
- }
14
-
15
- :host(:not([disabled]):not([open]):hover) {
16
- background: ${neutralFillSecondaryHover};
17
- border-color: transparent;
18
- }
19
-
20
- :host(:not([disabled]):not([open]):active) {
21
- background: ${neutralFillSecondaryActive};
22
- border-color: transparent;
23
- }
24
- `.withBehaviors(forcedColorsStylesheetBehavior(css `
25
- :host(:not([disabled]):not([open]):hover) {
26
- background: transparent;
27
- }
28
- :host(:not([disabled]):not([open]):hover),
29
- :host(:not([disabled]):not([open]):active) {
30
- border-color: ${SystemColors.Highlight};
31
- }
32
- :host(:${focusVisible}) {
33
- forced-color-adjust: none;
34
- background: transparent;
35
- border-color: ${SystemColors.Highlight};
36
- box-shadow: 0 0 0 1px inset ${SystemColors.Highlight};
37
- }
38
- `));
39
- export const selectStealthStyles = (context, definition) => css `
40
- :host {
41
- background: ${neutralFillStealthRest};
42
- border-color: transparent;
43
- }
44
-
45
- :host(:not([disabled]):not([open]):hover) {
46
- background: ${neutralFillStealthHover};
47
- border-color: transparent;
48
- }
49
-
50
- :host(:not([disabled]):not([open]):active) {
51
- background: ${neutralFillStealthActive};
52
- border-color: transparent;
53
- }
54
- `;
55
- export const selectStyles = (context, definition) => css `
56
- ${display('inline-flex')} :host {
57
- background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
58
- border-box ${neutralStrokeControlRest};
59
- border: calc(${strokeWidth} * 1px) solid transparent;
9
+ import { focusTreatmentBase } from '../styles/focus';
10
+ import { inputFilledStyles, inputForcedColorStyles, NeutralButtonStyles, StealthButtonStyles } from '../styles';
11
+ const logicalControlSelector = '.control';
12
+ const interactivitySelector = ':not([disabled]):not([open])';
13
+ const nonInteractivitySelector = '[disabled]';
14
+ /**
15
+ * The base styles for a select and combobox, without `appearance` visual differences.
16
+ *
17
+ * @internal
18
+ */
19
+ export const baseSelectStyles = (context, definition) => css `
20
+ ${display('inline-flex')}
21
+
22
+ :host {
60
23
  border-radius: calc(${controlCornerRadius} * 1px);
61
24
  box-sizing: border-box;
62
25
  color: ${neutralForegroundRest};
63
26
  fill: currentcolor;
64
27
  font-family: ${bodyFont};
65
- height: calc(${heightNumber} * 1px);
66
28
  position: relative;
67
29
  user-select: none;
68
30
  min-width: 250px;
69
31
  vertical-align: top;
70
32
  }
71
33
 
72
- :host .listbox {
34
+ .listbox {
73
35
  box-shadow: ${elevationShadowFlyout};
74
36
  background: ${fillColor};
75
37
  border-radius: calc(${layerCornerRadius} * 1px);
@@ -78,7 +40,7 @@ export const selectStyles = (context, definition) => css `
78
40
  flex-direction: column;
79
41
  left: 0;
80
42
  max-height: calc(var(--max-height) - (${heightNumber} * 1px));
81
- padding: calc((${designUnit} - ${strokeWidth} ) * 1px) 0;
43
+ padding: calc((${designUnit} - ${strokeWidth} ) * 1px);
82
44
  overflow-y: auto;
83
45
  position: absolute;
84
46
  width: 100%;
@@ -87,11 +49,14 @@ export const selectStyles = (context, definition) => css `
87
49
  border: calc(${strokeWidth} * 1px) solid transparent;
88
50
  }
89
51
 
90
- :host .listbox[hidden] {
52
+ .listbox[hidden] {
91
53
  display: none;
92
54
  }
93
55
 
94
- :host .control {
56
+ .control {
57
+ border: calc(${strokeWidth} * 1px) solid transparent;
58
+ border-radius: calc(${controlCornerRadius} * 1px);
59
+ height: calc(${heightNumber} * 1px);
95
60
  align-items: center;
96
61
  box-sizing: border-box;
97
62
  cursor: pointer;
@@ -102,29 +67,13 @@ export const selectStyles = (context, definition) => css `
102
67
  width: 100%;
103
68
  }
104
69
 
105
- :host(:not([disabled]):not([open]):hover) {
106
- background: padding-box linear-gradient(${neutralFillHover}, ${neutralFillHover}),
107
- border-box ${neutralStrokeControlHover};
108
- }
109
-
110
- :host(:not([disabled]):not([open]):active) {
111
- background: padding-box linear-gradient(${neutralFillActive}, ${neutralFillActive}),
112
- border-box ${neutralStrokeControlActive};
113
- }
114
-
115
70
  :host(:${focusVisible}) {
116
- border-color: ${focusStrokeOuter};
117
- outline: none;
118
- box-shadow: 0 0 0 1px inset ${focusStrokeOuter};
119
- }
120
-
121
- :host([disabled]) {
122
- cursor: ${disabledCursor};
123
- opacity: ${disabledOpacity};
71
+ ${focusTreatmentBase}
124
72
  }
125
73
 
126
74
  :host([disabled]) .control {
127
75
  cursor: ${disabledCursor};
76
+ opacity: ${disabledOpacity};
128
77
  user-select: none;
129
78
  }
130
79
 
@@ -175,38 +124,16 @@ export const selectStyles = (context, definition) => css `
175
124
  ::slotted([role='option']) {
176
125
  flex: 0 0 auto;
177
126
  }
178
- `.withBehaviors(appearanceBehavior('filled', selectFilledStyles(context, definition)), appearanceBehavior('stealth', selectStealthStyles(context, definition)), forcedColorsStylesheetBehavior(css `
179
- :host {
180
- background: ${SystemColors.ButtonFace};
181
- color: ${SystemColors.ButtonText};
182
- }
183
- :host(:not([disabled]):not([open]):hover) {
184
- background: transparent;
185
- }
186
- :host(:not([disabled]):hover) {
187
- border-color: ${SystemColors.Highlight};
188
- }
189
- :host(:${focusVisible}) {
190
- forced-color-adjust: none;
191
- border-color: ${SystemColors.Highlight};
192
- box-shadow: 0 0 0 1px inset ${SystemColors.Highlight};
193
- }
194
- :host([open]) .listbox {
195
- background: ${SystemColors.ButtonFace};
196
- border-color: ${SystemColors.CanvasText};
197
- }
198
- .start, .end, .indicator, ::slotted(svg) {
199
- fill: ${SystemColors.FieldText};
200
- }
201
- :host([disabled]) {
202
- border-color: ${SystemColors.GrayText};
203
- color: ${SystemColors.GrayText};
204
- opacity: 1;
205
- }
206
- :host([disabled]) .start,
207
- :host([disabled]) .end,
208
- :host([disabled]) .indicator,
209
- :host([disabled]) ::slotted(svg) {
210
- fill: ${SystemColors.GrayText};
211
- }
212
- `));
127
+ `;
128
+ /**
129
+ * @internal
130
+ */
131
+ export const baseSelectForcedColorStyles = (context, definition) => css `
132
+ :host([open]) .listbox {
133
+ background: ${SystemColors.ButtonFace};
134
+ border-color: ${SystemColors.CanvasText};
135
+ }
136
+ `;
137
+ export const selectStyles = (context, definition) => baseSelectStyles(context, definition)
138
+ .withBehaviors(appearanceBehavior('outline', NeutralButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)), appearanceBehavior('filled', inputFilledStyles(context, definition, logicalControlSelector, interactivitySelector)
139
+ .withBehaviors(forcedColorsStylesheetBehavior(inputForcedColorStyles(context, definition, logicalControlSelector, interactivitySelector)))), appearanceBehavior('stealth', StealthButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)), forcedColorsStylesheetBehavior(baseSelectForcedColorStyles(context, definition)));
@@ -0,0 +1,21 @@
1
+ import { cssPartial } from '@microsoft/fast-element';
2
+ import { focusStrokeOuter, focusStrokeWidth, strokeWidth } from '../design-tokens';
3
+ /**
4
+ * Partial CSS for the focus treatment for most typical sized components like Button, Menu Item, etc.
5
+ *
6
+ * @public
7
+ */
8
+ export const focusTreatmentBase = cssPartial `
9
+ outline: calc(${focusStrokeWidth} * 1px) solid ${focusStrokeOuter};
10
+ outline-offset: calc(${focusStrokeWidth} * -1px);
11
+ `;
12
+ /**
13
+ * Partial CSS for the focus treatment for tighter components with spacing constraints, like Checkbox
14
+ * and Radio, or plain text like Hypertext appearance Anchor or Breadcrumb Item.
15
+ *
16
+ * @public
17
+ */
18
+ export const focusTreatmentTight = cssPartial `
19
+ outline: calc(${focusStrokeWidth} * 1px) solid ${focusStrokeOuter};
20
+ outline-offset: calc(${strokeWidth} * 1px);
21
+ `;
@@ -1,4 +1,5 @@
1
1
  export * from './direction';
2
2
  export * from './elevation';
3
+ export * from './focus';
3
4
  export * from './patterns/';
4
5
  export * from './size';