@fluentui/web-components 2.5.6 → 2.5.8

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 +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/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 +148 -135
  34. package/dist/web-components.min.js +203 -233
  35. package/docs/api-report.md +38 -99
  36. package/karma.conf.js +3 -8
  37. package/package.json +29 -42
@@ -1,20 +1,15 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
- import { SystemColors } from "@microsoft/fast-web-utilities";
4
- import { inputFilledForcedColorStyles, inputFilledStyles, inputForcedColorStyles, inputStateStyles, inputStyles, } from '../styles/index';
3
+ import { baseInputStyles, inputFilledStyles, inputForcedColorStyles, inputOutlineStyles, inputStateStyles, } from '../styles/index';
5
4
  import { appearanceBehavior } from '../utilities/behaviors';
6
5
  import { designUnit } from '../design-tokens';
7
- export const numberFieldFilledStyles = (context, definition) => css `
8
- ${inputFilledStyles(context, definition, '.root')}
9
- `.withBehaviors(forcedColorsStylesheetBehavior(css `
10
- ${inputFilledForcedColorStyles(context, definition, '.root')}
11
- `));
6
+ const logicalControlSelector = '.root';
12
7
  export const numberFieldStyles = (context, definition) => css `
13
8
  ${display('inline-block')}
14
9
 
15
- ${inputStyles(context, definition, '.root')}
10
+ ${baseInputStyles(context, definition, logicalControlSelector)}
16
11
 
17
- ${inputStateStyles(context, definition, '.root')}
12
+ ${inputStateStyles(context, definition, logicalControlSelector)}
18
13
 
19
14
  .root {
20
15
  display: flex;
@@ -73,10 +68,4 @@ export const numberFieldStyles = (context, definition) => css `
73
68
  .step-up {
74
69
  padding-top: 3px;
75
70
  }
76
- `.withBehaviors(appearanceBehavior('filled', numberFieldFilledStyles(context, definition)), forcedColorsStylesheetBehavior(css `
77
- ${inputForcedColorStyles(context, definition, '.root')}
78
- .step-up,
79
- .step-down {
80
- fill: ${SystemColors.FieldText};
81
- }
82
- `));
71
+ `.withBehaviors(appearanceBehavior('outline', inputOutlineStyles(context, definition, logicalControlSelector)), appearanceBehavior('filled', inputFilledStyles(context, definition, logicalControlSelector)), forcedColorsStylesheetBehavior(inputForcedColorStyles(context, definition, logicalControlSelector)));
@@ -1,9 +1,10 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { Button, DesignToken, display, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
- import { heightNumber, inputFilledForcedColorStyles, inputFilledStyles, inputForcedColorStyles, inputStateStyles, inputStyles, } from '../styles';
3
+ import { baseInputStyles, heightNumber, inputFilledStyles, inputForcedColorStyles, inputOutlineStyles, inputStateStyles, } from '../styles';
4
4
  import { appearanceBehavior } from '../utilities/behaviors';
5
5
  import { controlCornerRadius, density, designUnit, neutralFillInputRecipe, neutralFillStealthRecipe, neutralForegroundRest } from '../design-tokens';
6
6
  import { typeRampBase } from '../styles/patterns/type-ramp';
7
+ const logicalControlSelector = '.root';
7
8
  const clearButtonHover = DesignToken.create("clear-button-hover").withDefault((target) => {
8
9
  const buttonRecipe = neutralFillStealthRecipe.getValueFor(target);
9
10
  const inputRecipe = neutralFillInputRecipe.getValueFor(target);
@@ -14,15 +15,13 @@ const clearButtonActive = DesignToken.create("clear-button-active").withDefault(
14
15
  const inputRecipe = neutralFillInputRecipe.getValueFor(target);
15
16
  return buttonRecipe.evaluate(target, inputRecipe.evaluate(target).focus).active;
16
17
  });
17
- export const searchFilledStyles = (context, definition) => css `
18
- ${inputFilledStyles(context, definition, '.root')}
19
- `.withBehaviors(forcedColorsStylesheetBehavior(css `
20
- ${inputFilledForcedColorStyles(context, definition, '.root')}
21
- `));
22
18
  export const searchStyles = (context, definition) => css `
23
19
  ${display('inline-block')}
24
- ${inputStyles(context, definition, '.root')}
25
- ${inputStateStyles(context, definition, '.root')}
20
+
21
+ ${baseInputStyles(context, definition, logicalControlSelector)}
22
+
23
+ ${inputStateStyles(context, definition, logicalControlSelector)}
24
+
26
25
  .root {
27
26
  display: flex;
28
27
  flex-direction: row;
@@ -102,6 +101,4 @@ export const searchStyles = (context, definition) => css `
102
101
  ::slotted(${context.tagFor(Button)}) {
103
102
  margin-inline-end: 1px;
104
103
  }
105
- `.withBehaviors(appearanceBehavior('filled', searchFilledStyles(context, definition)), forcedColorsStylesheetBehavior(css `
106
- ${inputForcedColorStyles(context, definition, '.root')}
107
- `));
104
+ `.withBehaviors(appearanceBehavior('outline', inputOutlineStyles(context, definition, logicalControlSelector)), appearanceBehavior('filled', inputFilledStyles(context, definition, logicalControlSelector)), forcedColorsStylesheetBehavior(inputForcedColorStyles(context, definition, logicalControlSelector)));
@@ -5,9 +5,9 @@ export default {
5
5
  component: fluentSelect,
6
6
  argTypes: {
7
7
  appearance: {
8
- options: ['filled', 'outlined', 'stealth'],
8
+ options: ['filled', 'outline', 'stealth'],
9
9
  control: { type: 'radio' },
10
- defaultValue: 'outlined',
10
+ defaultValue: 'outline',
11
11
  },
12
12
  disabled: {
13
13
  control: { type: 'boolean' },
@@ -4,67 +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, 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
9
  import { focusTreatmentBase } from '../styles/focus';
10
- export const selectFilledStyles = (context, definition) => css `
11
- :host {
12
- background: ${neutralFillSecondaryRest};
13
- border-color: transparent;
14
- }
15
-
16
- :host(:not([disabled]):not([open]):hover) {
17
- background: ${neutralFillSecondaryHover};
18
- border-color: transparent;
19
- }
20
-
21
- :host(:not([disabled]):not([open]):active) {
22
- background: ${neutralFillSecondaryActive};
23
- border-color: transparent;
24
- }
25
- `.withBehaviors(forcedColorsStylesheetBehavior(css `
26
- :host(:not([disabled]):not([open]):hover) {
27
- background: transparent;
28
- }
29
- :host(:not([disabled]):not([open]):hover),
30
- :host(:not([disabled]):not([open]):active) {
31
- border-color: ${SystemColors.Highlight};
32
- }
33
- `));
34
- export const selectStealthStyles = (context, definition) => css `
35
- :host {
36
- background: ${neutralFillStealthRest};
37
- border-color: transparent;
38
- }
39
-
40
- :host(:not([disabled]):not([open]):hover) {
41
- background: ${neutralFillStealthHover};
42
- border-color: transparent;
43
- }
44
-
45
- :host(:not([disabled]):not([open]):active) {
46
- background: ${neutralFillStealthActive};
47
- border-color: transparent;
48
- }
49
- `;
50
- export const selectStyles = (context, definition) => css `
51
- ${display('inline-flex')} :host {
52
- background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
53
- border-box ${neutralStrokeControlRest};
54
- border: calc(${strokeWidth} * 1px) solid transparent;
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 {
55
23
  border-radius: calc(${controlCornerRadius} * 1px);
56
24
  box-sizing: border-box;
57
25
  color: ${neutralForegroundRest};
58
26
  fill: currentcolor;
59
27
  font-family: ${bodyFont};
60
- height: calc(${heightNumber} * 1px);
61
28
  position: relative;
62
29
  user-select: none;
63
30
  min-width: 250px;
64
31
  vertical-align: top;
65
32
  }
66
33
 
67
- :host .listbox {
34
+ .listbox {
68
35
  box-shadow: ${elevationShadowFlyout};
69
36
  background: ${fillColor};
70
37
  border-radius: calc(${layerCornerRadius} * 1px);
@@ -73,7 +40,7 @@ export const selectStyles = (context, definition) => css `
73
40
  flex-direction: column;
74
41
  left: 0;
75
42
  max-height: calc(var(--max-height) - (${heightNumber} * 1px));
76
- padding: calc((${designUnit} - ${strokeWidth} ) * 1px) 0;
43
+ padding: calc((${designUnit} - ${strokeWidth} ) * 1px);
77
44
  overflow-y: auto;
78
45
  position: absolute;
79
46
  width: 100%;
@@ -82,11 +49,14 @@ export const selectStyles = (context, definition) => css `
82
49
  border: calc(${strokeWidth} * 1px) solid transparent;
83
50
  }
84
51
 
85
- :host .listbox[hidden] {
52
+ .listbox[hidden] {
86
53
  display: none;
87
54
  }
88
55
 
89
- :host .control {
56
+ .control {
57
+ border: calc(${strokeWidth} * 1px) solid transparent;
58
+ border-radius: calc(${controlCornerRadius} * 1px);
59
+ height: calc(${heightNumber} * 1px);
90
60
  align-items: center;
91
61
  box-sizing: border-box;
92
62
  cursor: pointer;
@@ -97,27 +67,13 @@ export const selectStyles = (context, definition) => css `
97
67
  width: 100%;
98
68
  }
99
69
 
100
- :host(:not([disabled]):not([open]):hover) {
101
- background: padding-box linear-gradient(${neutralFillHover}, ${neutralFillHover}),
102
- border-box ${neutralStrokeControlHover};
103
- }
104
-
105
- :host(:not([disabled]):not([open]):active) {
106
- background: padding-box linear-gradient(${neutralFillActive}, ${neutralFillActive}),
107
- border-box ${neutralStrokeControlActive};
108
- }
109
-
110
70
  :host(:${focusVisible}) {
111
71
  ${focusTreatmentBase}
112
72
  }
113
73
 
114
- :host([disabled]) {
115
- cursor: ${disabledCursor};
116
- opacity: ${disabledOpacity};
117
- }
118
-
119
74
  :host([disabled]) .control {
120
75
  cursor: ${disabledCursor};
76
+ opacity: ${disabledOpacity};
121
77
  user-select: none;
122
78
  }
123
79
 
@@ -168,37 +124,16 @@ export const selectStyles = (context, definition) => css `
168
124
  ::slotted([role='option']) {
169
125
  flex: 0 0 auto;
170
126
  }
171
- `.withBehaviors(appearanceBehavior('filled', selectFilledStyles(context, definition)), appearanceBehavior('stealth', selectStealthStyles(context, definition)), forcedColorsStylesheetBehavior(css `
172
- :host {
173
- background: ${SystemColors.ButtonFace};
174
- color: ${SystemColors.ButtonText};
175
- }
176
- :host(:not([disabled]):not([open]):hover) {
177
- background: transparent;
178
- }
179
- :host(:not([disabled]):hover) {
180
- border-color: ${SystemColors.Highlight};
181
- }
182
- :host(:${focusVisible}) {
183
- forced-color-adjust: none;
184
- outline-color: ${SystemColors.Highlight};
185
- }
186
- :host([open]) .listbox {
187
- background: ${SystemColors.ButtonFace};
188
- border-color: ${SystemColors.CanvasText};
189
- }
190
- .start, .end, .indicator, ::slotted(svg) {
191
- fill: ${SystemColors.FieldText};
192
- }
193
- :host([disabled]) {
194
- border-color: ${SystemColors.GrayText};
195
- color: ${SystemColors.GrayText};
196
- opacity: 1;
197
- }
198
- :host([disabled]) .start,
199
- :host([disabled]) .end,
200
- :host([disabled]) .indicator,
201
- :host([disabled]) ::slotted(svg) {
202
- fill: ${SystemColors.GrayText};
203
- }
204
- `));
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)));