@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
@@ -1,9 +1,10 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { DesignToken, disabledCursor, focusVisible, } from '@microsoft/fast-foundation';
2
+ import { DesignToken, disabledCursor, } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from '@microsoft/fast-web-utilities';
4
- import { accentFillRest, controlCornerRadius, disabledOpacity, focusStrokeWidth, neutralFillInputFocus, neutralFillInputHover, neutralFillInputRecipe, neutralFillInputRest, neutralFillSecondaryHover, neutralFillSecondaryRecipe, neutralFillSecondaryRest, neutralForegroundHintRecipe, neutralForegroundRest, neutralStrokeInputHover, neutralStrokeInputRest, neutralStrokeRest, strokeWidth, } from '../../design-tokens';
4
+ import { accentFillRest, controlCornerRadius, disabledOpacity, focusStrokeWidth, neutralFillInputFocus, neutralFillInputHover, neutralFillInputRecipe, neutralFillInputRest, neutralFillSecondaryFocus, neutralFillSecondaryHover, neutralFillSecondaryRecipe, neutralFillSecondaryRest, neutralForegroundHintRecipe, neutralForegroundRest, neutralStrokeInputHover, neutralStrokeInputRest, neutralStrokeRest, strokeWidth, } from '../../design-tokens';
5
5
  import { typeRampBase } from '../patterns/type-ramp';
6
6
  import { heightNumber } from '../size';
7
+ import { focusTreatmentBase } from '../focus';
7
8
  const placeholderRest = DesignToken.create('input-placeholder-rest').withDefault((target) => {
8
9
  const baseRecipe = neutralFillInputRecipe.getValueFor(target);
9
10
  const hintRecipe = neutralForegroundHintRecipe.getValueFor(target);
@@ -25,24 +26,23 @@ const filledPlaceholderHover = DesignToken.create('input-filled-placeholder-hove
25
26
  return hintRecipe.evaluate(target, baseRecipe.evaluate(target).hover);
26
27
  });
27
28
  /**
29
+ * The base styles for input controls, without `appearance` visual differences.
30
+ *
28
31
  * @internal
29
32
  */
30
- export const inputStyles = (context, definition, rootSelector) => css `
33
+ export const baseInputStyles = (context, definition, logicalControlSelector) => css `
31
34
  :host {
32
35
  ${typeRampBase}
33
36
  color: ${neutralForegroundRest};
34
37
  fill: currentcolor;
35
- outline: none;
36
38
  user-select: none;
37
39
  position: relative;
38
40
  }
39
41
 
40
- ${rootSelector} {
42
+ ${logicalControlSelector} {
41
43
  box-sizing: border-box;
42
44
  position: relative;
43
45
  color: inherit;
44
- background: padding-box linear-gradient(${neutralFillInputRest}, ${neutralFillInputRest}),
45
- border-box ${neutralStrokeInputRest};
46
46
  border: calc(${strokeWidth} * 1px) solid transparent;
47
47
  border-radius: calc(${controlCornerRadius} * 1px);
48
48
  height: calc(${heightNumber} * 1px);
@@ -53,12 +53,6 @@ export const inputStyles = (context, definition, rootSelector) => css `
53
53
 
54
54
  .control {
55
55
  width: 100%;
56
- }
57
-
58
- .control:hover,
59
- .control:${focusVisible},
60
- .control:disabled,
61
- .control:active {
62
56
  outline: none;
63
57
  }
64
58
 
@@ -75,25 +69,9 @@ export const inputStyles = (context, definition, rootSelector) => css `
75
69
  visibility: hidden;
76
70
  }
77
71
 
78
- :host(:hover:not([disabled]):not(:focus-within)) ${rootSelector} {
79
- background: padding-box linear-gradient(${neutralFillInputHover}, ${neutralFillInputHover}),
80
- border-box ${neutralStrokeInputHover};
81
- }
82
-
83
- :host(:not([disabled]):focus-within) ${rootSelector} {
84
- background: padding-box linear-gradient(${neutralFillInputFocus}, ${neutralFillInputFocus}),
85
- border-box ${neutralStrokeInputRest};
86
- }
87
-
88
- .control::placeholder {
89
- color: ${placeholderRest};
90
- }
91
-
92
- :host(:hover:not([disabled]):not(:focus-within)) .control::placeholder {
93
- color: ${placeholderHover};
94
- }
95
-
96
- :host([disabled]) ${rootSelector}, :host([readonly]) ${rootSelector}, :host([disabled]) .label,
72
+ :host([disabled]) ${logicalControlSelector},
73
+ :host([readonly]) ${logicalControlSelector},
74
+ :host([disabled]) .label,
97
75
  :host([readonly]) .label,
98
76
  :host([disabled]) .control,
99
77
  :host([readonly]) .control {
@@ -103,114 +81,147 @@ export const inputStyles = (context, definition, rootSelector) => css `
103
81
  :host([disabled]) {
104
82
  opacity: ${disabledOpacity};
105
83
  }
106
-
107
- :host([disabled]) ${rootSelector} {
108
- background: padding-box linear-gradient(${neutralFillInputRest}, ${neutralFillInputRest}),
109
- border-box ${neutralStrokeRest};
84
+ `;
85
+ /**
86
+ * The styles for active and focus interactions for input controls.
87
+ *
88
+ * @internal
89
+ */
90
+ export const inputStateStyles = (context, definition, logicalControlSelector) => css `
91
+ @media (forced-colors: none) {
92
+ :host(:not([disabled]):active)::after {
93
+ left: 50%;
94
+ width: 40%;
95
+ transform: translateX(-50%);
96
+ border-bottom-left-radius: 0;
97
+ border-bottom-right-radius: 0;
98
+ }
99
+
100
+ :host(:not([disabled]):focus-within)::after {
101
+ left: 0;
102
+ width: 100%;
103
+ transform: none;
104
+ }
105
+
106
+ :host(:not([disabled]):active)::after,
107
+ :host(:not([disabled]):focus-within:not(:active))::after {
108
+ content: '';
109
+ position: absolute;
110
+ height: calc(${focusStrokeWidth} * 1px);
111
+ bottom: 0;
112
+ border-bottom: calc(${focusStrokeWidth} * 1px) solid ${accentFillRest};
113
+ border-bottom-left-radius: calc(${controlCornerRadius} * 1px);
114
+ border-bottom-right-radius: calc(${controlCornerRadius} * 1px);
115
+ z-index: 2;
116
+ transition: all 300ms cubic-bezier(0.1, 0.9, 0.2, 1);
117
+ }
110
118
  }
111
119
  `;
112
120
  /**
121
+ * The visual styles for inputs with `appearance='outline'`.
122
+ *
113
123
  * @internal
114
124
  */
115
- export const inputStateStyles = (context, definition, rootSelector) => css `
116
- :host(:not([disabled]):active)::after {
117
- left: 50%;
118
- width: 40%;
119
- transform: translateX(-50%);
120
- border-bottom-left-radius: 0;
121
- border-bottom-right-radius: 0;
125
+ export const inputOutlineStyles = (context, definition, logicalControlSelector, interactivitySelector = ':not([disabled]):not(:focus-within)') => css `
126
+ ${logicalControlSelector} {
127
+ background: padding-box linear-gradient(${neutralFillInputRest}, ${neutralFillInputRest}),
128
+ border-box ${neutralStrokeInputRest};
122
129
  }
123
130
 
124
- :host(:not([disabled]):focus-within)::after {
125
- left: 0;
126
- width: 100%;
127
- transform: none;
131
+ :host(${interactivitySelector}:hover) ${logicalControlSelector} {
132
+ background: padding-box linear-gradient(${neutralFillInputHover}, ${neutralFillInputHover}),
133
+ border-box ${neutralStrokeInputHover};
134
+ }
135
+
136
+ :host(:not([disabled]):focus-within) ${logicalControlSelector} {
137
+ background: padding-box linear-gradient(${neutralFillInputFocus}, ${neutralFillInputFocus}),
138
+ border-box ${neutralStrokeInputRest};
139
+ }
140
+
141
+ :host([disabled]) ${logicalControlSelector} {
142
+ background: padding-box linear-gradient(${neutralFillInputRest}, ${neutralFillInputRest}),
143
+ border-box ${neutralStrokeRest};
144
+ }
145
+
146
+ .control::placeholder {
147
+ color: ${placeholderRest};
128
148
  }
129
149
 
130
- :host(:not([disabled]):active)::after,
131
- :host(:not([disabled]):focus-within:not(:active))::after {
132
- content: '';
133
- position: absolute;
134
- height: calc(${focusStrokeWidth} * 1px);
135
- bottom: 0;
136
- border-bottom: calc(${focusStrokeWidth} * 1px) solid ${accentFillRest};
137
- border-bottom-left-radius: calc(${controlCornerRadius} * 1px);
138
- border-bottom-right-radius: calc(${controlCornerRadius} * 1px);
139
- z-index: 2;
140
- transition: all 300ms cubic-bezier(0.1, 0.9, 0.2, 1);
150
+ :host(${interactivitySelector}:hover) .control::placeholder {
151
+ color: ${placeholderHover};
141
152
  }
142
153
  `;
143
154
  /**
155
+ * The visual styles for inputs with `appearance='filled'`.
156
+ *
144
157
  * @internal
145
158
  */
146
- export const inputFilledStyles = (context, definition, rootSelector) => css `
147
- :host ${rootSelector} {
159
+ export const inputFilledStyles = (context, definition, logicalControlSelector, interactivitySelector = ':not([disabled]):not(:focus-within)') => css `
160
+ ${logicalControlSelector} {
148
161
  background: ${neutralFillSecondaryRest};
149
- border-color: transparent;
150
162
  }
151
163
 
152
- :host(:hover:not([disabled]):not(:focus-within)) ${rootSelector} {
164
+ :host(${interactivitySelector}:hover) ${logicalControlSelector} {
153
165
  background: ${neutralFillSecondaryHover};
154
- border-color: transparent;
166
+ }
167
+
168
+ :host(:not([disabled]):focus-within) ${logicalControlSelector} {
169
+ background: ${neutralFillSecondaryFocus};
170
+ }
171
+
172
+ :host([disabled]) ${logicalControlSelector} {
173
+ background: ${neutralFillSecondaryRest};
155
174
  }
156
175
 
157
176
  .control::placeholder {
158
177
  color: ${filledPlaceholderRest};
159
178
  }
160
179
 
161
- :host(:hover:not([disabled]):not(:focus-within)) .control::placeholder {
180
+ :host(${interactivitySelector}:hover) .control::placeholder {
162
181
  color: ${filledPlaceholderHover};
163
182
  }
164
-
165
- :host(:focus-within:not([disabled])) ${rootSelector} {
166
- border-color: transparent;
167
- box-shadow: none;
168
- }
169
183
  `;
170
184
  /**
171
185
  * @internal
172
186
  */
173
- export const inputForcedColorStyles = (context, definition, rootSelector) => css `
174
- :host ${rootSelector} {
175
- background: ${SystemColors.Field};
176
- border-color: ${SystemColors.FieldText};
187
+ export const inputForcedColorStyles = (context, definition, logicalControlSelector, interactivitySelector = ':not([disabled]):not(:focus-within)') => css `
188
+ :host {
189
+ color: ${SystemColors.ButtonText};
177
190
  }
178
- :host(:hover:not([disabled]):not(:focus-within)) ${rootSelector} {
191
+
192
+ ${logicalControlSelector} {
193
+ background: ${SystemColors.ButtonFace};
194
+ border-color: ${SystemColors.ButtonText};
195
+ }
196
+
197
+ :host(${interactivitySelector}:hover) ${logicalControlSelector},
198
+ :host(:not([disabled]):focus-within) ${logicalControlSelector} {
179
199
  border-color: ${SystemColors.Highlight};
180
200
  }
181
- :host(:not([disabled]):active)::after,
182
- :host(:not([disabled]):focus-within:not(:active))::after {
183
- border-bottom-color: ${SystemColors.Highlight};
201
+
202
+ :host([disabled]) ${logicalControlSelector} {
203
+ opacity: 1;
204
+ background: ${SystemColors.ButtonFace};
205
+ border-color: ${SystemColors.GrayText};
184
206
  }
207
+
208
+ .control::placeholder,
209
+ :host(${interactivitySelector}:hover) .control::placeholder {
210
+ color: ${SystemColors.CanvasText};
211
+ }
212
+
213
+ :host(:not([disabled]):focus) ${logicalControlSelector} {
214
+ ${focusTreatmentBase}
215
+ outline-color: ${SystemColors.Highlight};
216
+ }
217
+
185
218
  :host([disabled]) {
186
219
  opacity: 1;
220
+ color: ${SystemColors.GrayText};
187
221
  }
188
- :host([disabled]) ${rootSelector} {
189
- border-color: ${SystemColors.GrayText};
190
- }
222
+
191
223
  :host([disabled]) ::placeholder,
192
- :host([disabled]) ::-webkit-input-placeholder,
193
- :host([disabled]) .label {
224
+ :host([disabled]) ::-webkit-input-placeholder {
194
225
  color: ${SystemColors.GrayText};
195
- fill: currentcolor;
196
- }
197
- `;
198
- /**
199
- * @internal
200
- */
201
- export const inputFilledForcedColorStyles = (context, definition, rootSelector) => css `
202
- :host ${rootSelector},
203
- :host(:hover:not([disabled])) ${rootSelector},
204
- :host(:active:not([disabled])) ${rootSelector},
205
- :host(:focus-within:not([disabled])) ${rootSelector} {
206
- background: ${SystemColors.Field};
207
- border-color: ${SystemColors.FieldText};
208
- }
209
- :host(:not([disabled]):active)::after,
210
- :host(:not([disabled]):focus-within:not(:active))::after {
211
- border-bottom-color: ${SystemColors.Highlight};
212
- }
213
- :host([disabled]) ${rootSelector} {
214
- border-color: ${SystemColors.GrayText};
215
226
  }
216
227
  `;
@@ -2,8 +2,9 @@ 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 { DirectionalStyleSheetBehavior, heightNumber } from '../styles';
5
- import { accentFillActive, accentFillHover, accentFillRest, bodyFont, designUnit, disabledOpacity, fillColor, focusStrokeOuter, foregroundOnAccentActive, foregroundOnAccentHover, foregroundOnAccentRest, neutralFillInputAltActive, neutralFillInputAltFocus, neutralFillInputAltHover, neutralFillInputAltRest, neutralForegroundRest, neutralStrokeStrongActive, neutralStrokeStrongHover, neutralStrokeStrongRest, strokeWidth, } from '../design-tokens';
5
+ import { accentFillActive, accentFillHover, accentFillRest, bodyFont, designUnit, disabledOpacity, foregroundOnAccentActive, foregroundOnAccentHover, foregroundOnAccentRest, neutralFillInputAltActive, neutralFillInputAltFocus, neutralFillInputAltHover, neutralFillInputAltRest, neutralForegroundRest, neutralStrokeStrongActive, neutralStrokeStrongHover, neutralStrokeStrongRest, strokeWidth, } from '../design-tokens';
6
6
  import { typeRampBase } from '../styles/patterns/type-ramp';
7
+ import { focusTreatmentTight } from '../styles/focus';
7
8
  export const switchStyles = (context, definition) => css `
8
9
  :host([hidden]) {
9
10
  display: none;
@@ -35,7 +36,6 @@ export const switchStyles = (context, definition) => css `
35
36
 
36
37
  .switch {
37
38
  position: relative;
38
- outline: none;
39
39
  box-sizing: border-box;
40
40
  width: calc(((${heightNumber} / 2) + ${designUnit}) * 2px);
41
41
  height: calc(((${heightNumber} / 2) + ${designUnit}) * 1px);
@@ -56,9 +56,8 @@ export const switchStyles = (context, definition) => css `
56
56
  }
57
57
 
58
58
  :host(:${focusVisible}) .switch {
59
- box-shadow: 0 0 0 1px ${fillColor}, 0 0 0 3px ${focusStrokeOuter};
59
+ ${focusTreatmentTight}
60
60
  background: ${neutralFillInputAltFocus};
61
- border-color: ${focusStrokeOuter};
62
61
  }
63
62
 
64
63
  :host(.checked) .switch {
@@ -132,11 +131,6 @@ export const switchStyles = (context, definition) => css `
132
131
  fill: ${foregroundOnAccentActive};
133
132
  }
134
133
 
135
- :host(.checked:${focusVisible}:not(.disabled)) .switch {
136
- box-shadow: 0 0 0 1px ${fillColor}, 0 0 0 3px ${focusStrokeOuter};
137
- border-color: transparent;
138
- }
139
-
140
134
  .unchecked-message {
141
135
  display: block;
142
136
  }
@@ -197,15 +191,9 @@ export const switchStyles = (context, definition) => css `
197
191
  }
198
192
  :host(:${focusVisible}) .switch {
199
193
  forced-color-adjust: none;
200
- background: ${SystemColors.Field};
194
+ background: ${SystemColors.Field};
201
195
  border-color: ${SystemColors.Highlight};
202
- box-shadow: 0 0 0 1px ${SystemColors.Highlight}, 0 0 0 3px ${SystemColors.FieldText};
203
- }
204
- :host(.checked:${focusVisible}:not(.disabled)) .switch {
205
- forced-color-adjust: none;
206
- background: ${SystemColors.Highlight};
207
- box-shadow: 0 0 0 1px ${SystemColors.Field}, 0 0 0 3px ${SystemColors.FieldText};
208
- border-color: ${SystemColors.Field};
196
+ outline-color: ${SystemColors.FieldText};
209
197
  }
210
198
  :host(.disabled) {
211
199
  opacity: 1;
@@ -2,8 +2,9 @@ import { css } from '@microsoft/fast-element';
2
2
  import { SystemColors } from '@microsoft/fast-web-utilities';
3
3
  import { display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
4
4
  import { heightNumber } from '../../styles';
5
- import { controlCornerRadius, density, designUnit, focusStrokeOuter, focusStrokeWidth, neutralForegroundRest, strokeWidth, } from '../../design-tokens';
5
+ import { controlCornerRadius, density, designUnit, neutralForegroundRest, strokeWidth, } from '../../design-tokens';
6
6
  import { typeRampBase } from '../../styles/patterns/type-ramp';
7
+ import { focusTreatmentBase } from '../../styles/focus';
7
8
  export const tabStyles = (context, definition) => css `
8
9
  ${display('inline-flex')} :host {
9
10
  box-sizing: border-box;
@@ -17,7 +18,6 @@ export const tabStyles = (context, definition) => css `
17
18
  justify-content: center;
18
19
  grid-row: 1 / 3;
19
20
  cursor: pointer;
20
- outline: none;
21
21
  }
22
22
 
23
23
  :host([aria-selected='true']) {
@@ -30,8 +30,7 @@ export const tabStyles = (context, definition) => css `
30
30
  }
31
31
 
32
32
  :host(:${focusVisible}) {
33
- border-color: ${focusStrokeOuter};
34
- box-shadow: 0 0 0 calc((${focusStrokeWidth} - ${strokeWidth}) * 1px) ${focusStrokeOuter} inset;
33
+ ${focusTreatmentBase}
35
34
  }
36
35
 
37
36
  :host(.vertical) {
@@ -71,7 +70,6 @@ export const tabStyles = (context, definition) => css `
71
70
  }
72
71
  :host(:${focusVisible}) {
73
72
  background: transparent;
74
- border-color: ${SystemColors.ButtonText};
75
- box-shadow: none;
73
+ outline-color: ${SystemColors.ButtonText};
76
74
  }
77
75
  `));
@@ -4,8 +4,8 @@ export default {
4
4
  component: fluentTextArea,
5
5
  argTypes: {
6
6
  appearance: {
7
- defaultValue: 'outlined',
8
- options: ['filled', 'outlined'],
7
+ defaultValue: 'outline',
8
+ options: ['filled', 'outline'],
9
9
  control: { type: 'radio' },
10
10
  },
11
11
  autoFocus: {
@@ -1,19 +1,15 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { 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 { designUnit } from '../design-tokens';
6
- export const textAreaFilledStyles = (context, definition) => css `
7
- ${inputFilledStyles(context, definition, '.control')}
8
- `.withBehaviors(forcedColorsStylesheetBehavior(css `
9
- ${inputFilledForcedColorStyles(context, definition, '.control')}
10
- `));
6
+ const logicalControlSelector = '.control';
11
7
  export const textAreaStyles = (context, definition) => css `
12
8
  ${display('inline-flex')}
13
9
 
14
- ${inputStyles(context, definition, '.control')}
10
+ ${baseInputStyles(context, definition, logicalControlSelector)}
15
11
 
16
- ${inputStateStyles(context, definition, '.control')}
12
+ ${inputStateStyles(context, definition, logicalControlSelector)}
17
13
 
18
14
  :host {
19
15
  flex-direction: column;
@@ -40,6 +36,4 @@ export const textAreaStyles = (context, definition) => css `
40
36
  :host(.resize-vertical) .control {
41
37
  resize: vertical;
42
38
  }
43
- `.withBehaviors(appearanceBehavior('filled', textAreaFilledStyles(context, definition)), forcedColorsStylesheetBehavior(css `
44
- ${inputForcedColorStyles(context, definition, '.control')}
45
- `));
39
+ `.withBehaviors(appearanceBehavior('outline', inputOutlineStyles(context, definition, logicalControlSelector)), appearanceBehavior('filled', inputFilledStyles(context, definition, logicalControlSelector)), forcedColorsStylesheetBehavior(inputForcedColorStyles(context, definition, logicalControlSelector)));
@@ -1,19 +1,15 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
- import { inputFilledForcedColorStyles, inputFilledStyles, inputForcedColorStyles, inputStateStyles, inputStyles, } from '../styles';
3
+ import { baseInputStyles, inputFilledStyles, inputForcedColorStyles, inputOutlineStyles, inputStateStyles, } from '../styles';
4
4
  import { appearanceBehavior } from '../utilities/behaviors';
5
5
  import { designUnit } from '../design-tokens';
6
- export const textFieldFilledStyles = (context, definition) => css `
7
- ${inputFilledStyles(context, definition, '.root')}
8
- `.withBehaviors(forcedColorsStylesheetBehavior(css `
9
- ${inputFilledForcedColorStyles(context, definition, '.root')}
10
- `));
6
+ const logicalControlSelector = '.root';
11
7
  export const textFieldStyles = (context, definition) => css `
12
8
  ${display('inline-block')}
13
9
 
14
- ${inputStyles(context, definition, '.root')}
10
+ ${baseInputStyles(context, definition, logicalControlSelector)}
15
11
 
16
- ${inputStateStyles(context, definition, '.root')}
12
+ ${inputStateStyles(context, definition, logicalControlSelector)}
17
13
 
18
14
  .root {
19
15
  display: flex;
@@ -49,6 +45,4 @@ export const textFieldStyles = (context, definition) => css `
49
45
  display: flex;
50
46
  margin-inline-end: 11px;
51
47
  }
52
- `.withBehaviors(appearanceBehavior('filled', textFieldFilledStyles(context, definition)), forcedColorsStylesheetBehavior(css `
53
- ${inputForcedColorStyles(context, definition, '.root')}
54
- `));
48
+ `.withBehaviors(appearanceBehavior('outline', inputOutlineStyles(context, definition, logicalControlSelector)), appearanceBehavior('filled', inputFilledStyles(context, definition, logicalControlSelector)), forcedColorsStylesheetBehavior(inputForcedColorStyles(context, definition, logicalControlSelector)));
@@ -1,7 +1,8 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from '@microsoft/fast-web-utilities';
4
- import { designUnit, fillColor, focusStrokeWidth, neutralStrokeFocus, strokeWidth } from '../design-tokens';
4
+ import { designUnit, fillColor } from '../design-tokens';
5
+ import { focusTreatmentBase } from '../styles/focus';
5
6
  export const toolbarStyles = (context, definition) => css `
6
7
  ${display('inline-flex')} :host {
7
8
  --toolbar-item-gap: calc(${designUnit} * 1px);
@@ -13,7 +14,7 @@ export const toolbarStyles = (context, definition) => css `
13
14
  }
14
15
 
15
16
  :host(${focusVisible}) {
16
- outline: calc(${strokeWidth} * 1px) solid ${neutralStrokeFocus};
17
+ ${focusTreatmentBase}
17
18
  }
18
19
 
19
20
  .positioning-region {
@@ -65,7 +66,7 @@ export const toolbarStyles = (context, definition) => css `
65
66
  }
66
67
  `.withBehaviors(forcedColorsStylesheetBehavior(css `
67
68
  :host(:${focusVisible}) {
68
- box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) ${SystemColors.Highlight};
69
+ outline-color: ${SystemColors.Highlight};
69
70
  color: ${SystemColors.ButtonText};
70
71
  forced-color-adjust: none;
71
72
  }
@@ -2,8 +2,9 @@ import { css, cssPartial } from '@microsoft/fast-element';
2
2
  import { DesignToken, disabledCursor, display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from '@microsoft/fast-web-utilities';
4
4
  import { DirectionalStyleSheetBehavior, heightNumber } from '../styles/index';
5
- import { accentFillRest, baseHeightMultiplier, bodyFont, controlCornerRadius, density, designUnit, disabledOpacity, focusStrokeOuter, focusStrokeWidth, neutralFillSecondaryRecipe, neutralFillSecondaryRest, neutralFillStealthActive, neutralFillStealthHover, neutralFillStealthRecipe, neutralFillStealthRest, neutralForegroundRest, strokeWidth, } from '../design-tokens';
5
+ import { accentFillRest, baseHeightMultiplier, bodyFont, controlCornerRadius, density, designUnit, disabledOpacity, focusStrokeWidth, neutralFillSecondaryRecipe, neutralFillSecondaryRest, neutralFillStealthActive, neutralFillStealthHover, neutralFillStealthRecipe, neutralFillStealthRest, neutralForegroundRest, strokeWidth, } from '../design-tokens';
6
6
  import { typeRampBase } from '../styles/patterns/type-ramp';
7
+ import { focusTreatmentBase } from '../styles/focus';
7
8
  const ltr = css `
8
9
  .expand-collapse-button svg {
9
10
  transform: rotate(0deg);
@@ -55,14 +56,6 @@ export const treeItemStyles = (context, definition) => css `
55
56
  --tree-item-nested-width: 0;
56
57
  }
57
58
 
58
- :host(:focus) > .positioning-region {
59
- outline: none;
60
- }
61
-
62
- :host(:focus) .content-region {
63
- outline: none;
64
- }
65
-
66
59
  .positioning-region {
67
60
  display: flex;
68
61
  position: relative;
@@ -74,8 +67,7 @@ export const treeItemStyles = (context, definition) => css `
74
67
  }
75
68
 
76
69
  :host(:${focusVisible}) .positioning-region {
77
- border-color: ${focusStrokeOuter};
78
- box-shadow: 0 0 0 calc((${focusStrokeWidth} - ${strokeWidth}) * 1px) ${focusStrokeOuter} inset;
70
+ ${focusTreatmentBase}
79
71
  }
80
72
 
81
73
  .positioning-region::before {
@@ -114,7 +106,6 @@ export const treeItemStyles = (context, definition) => css `
114
106
  background: none;
115
107
  border: none;
116
108
  border-radius: calc(${controlCornerRadius} * 1px);
117
- outline: none;
118
109
  ${
119
110
  /* Width and Height should be based off calc(glyph-size-number + (design-unit * 4) * 1px) -
120
111
  update when density story is figured out */ ''} width: calc((${expandCollapseButtonSize} + (${designUnit} * 2)) * 1px);
@@ -220,8 +211,7 @@ export const treeItemStyles = (context, definition) => css `
220
211
  }
221
212
  :host(:${focusVisible}) .positioning-region {
222
213
  forced-color-adjust: none;
223
- border-color: ${SystemColors.ButtonText};
224
- box-shadow: 0 0 0 2px inset ${SystemColors.ButtonFace};
214
+ outline-color: ${SystemColors.ButtonFace};
225
215
  }
226
216
  :host([disabled]),
227
217
  :host([disabled]) .content-region,
@@ -11,8 +11,4 @@ export const treeViewStyles = (context, definition) => css `
11
11
  min-width: fit-content;
12
12
  font-size: 0;
13
13
  }
14
-
15
- :host:focus-visible {
16
- outline: none;
17
- }
18
14
  `;