@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,5 +1,5 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { elevation } from '../styles';
2
+ import { elevationShadowDialog } from '../styles';
3
3
  import { fillColor, layerCornerRadius, strokeWidth } from '../design-tokens';
4
4
  export const dialogStyles = (context, definition) => css `
5
5
  :host([hidden]) {
@@ -7,7 +7,6 @@ export const dialogStyles = (context, definition) => css `
7
7
  }
8
8
 
9
9
  :host {
10
- --elevation: 14;
11
10
  --dialog-height: 480px;
12
11
  --dialog-width: 640px;
13
12
  display: block;
@@ -35,7 +34,7 @@ export const dialogStyles = (context, definition) => css `
35
34
  }
36
35
 
37
36
  .control {
38
- ${elevation}
37
+ box-shadow: ${elevationShadowDialog};
39
38
  margin-top: auto;
40
39
  margin-bottom: auto;
41
40
  border-radius: calc(${layerCornerRadius} * 1px);
@@ -1,11 +1,10 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
- import { designUnit, neutralStrokeDividerRest, strokeWidth } from '../design-tokens';
3
+ import { neutralStrokeDividerRest, strokeWidth } from '../design-tokens';
4
4
  export const dividerStyles = (context, definition) => css `
5
5
  ${display('block')} :host {
6
6
  box-sizing: content-box;
7
7
  height: 0;
8
- margin: calc(${designUnit} * 1px) 0;
9
8
  border: none;
10
9
  border-top: calc(${strokeWidth} * 1px) solid ${neutralStrokeDividerRest};
11
10
  }
@@ -2,120 +2,83 @@ 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
4
  import { heightNumber } from '../styles';
5
- import { disabledOpacity, focusStrokeOuter, neutralFillStealthActive, neutralFillStealthHover, neutralFillStealthRest, neutralForegroundRest, neutralStrokeActive, neutralStrokeHover, neutralStrokeRest, strokeWidth, } from '../design-tokens';
5
+ import { controlCornerRadius, designUnit, disabledOpacity, focusStrokeOuter, focusStrokeWidth, neutralFillRest, neutralFillStrongActive, neutralFillStrongHover, neutralFillStrongRest, neutralStrokeControlRest, } from '../design-tokens';
6
6
  export const flipperStyles = (context, definition) => css `
7
7
  ${display('inline-flex')} :host {
8
- width: calc(${heightNumber} * 1px);
9
- height: calc(${heightNumber} * 1px);
8
+ height: calc((${heightNumber} + ${designUnit}) * 1px);
10
9
  justify-content: center;
11
10
  align-items: center;
12
- margin: 0;
13
- position: relative;
14
11
  fill: currentcolor;
15
- color: ${neutralForegroundRest};
16
- background: transparent;
17
- border: none;
12
+ color: ${neutralFillStrongRest};
13
+ background: padding-box linear-gradient(${neutralFillRest}, ${neutralFillRest}),
14
+ border-box ${neutralStrokeControlRest};
15
+ box-sizing: border-box;
16
+ border: calc(${focusStrokeWidth} * 1px) solid transparent;
17
+ border-radius: calc(${controlCornerRadius} * 1px);
18
18
  outline: none;
19
19
  padding: 0;
20
20
  }
21
21
 
22
- :host::before {
23
- content: '';
24
- opacity: 0.8;
25
- background: ${neutralFillStealthRest};
26
- border: calc(${strokeWidth} * 1px) solid ${neutralStrokeRest};
27
- border-radius: 50%;
28
- position: absolute;
29
- top: 0;
30
- right: 0;
31
- left: 0;
32
- bottom: 0;
33
- transition: all 0.1s ease-in-out;
22
+ :host(.disabled) {
23
+ opacity: ${disabledOpacity};
24
+ cursor: ${disabledCursor};
34
25
  }
35
26
 
36
27
  .next,
37
28
  .previous {
38
- position: relative;
39
- ${
40
- /* Glyph size and margin-left is temporary -
41
- replace when adaptive typography is figured out */ ''} width: 16px;
42
- height: 16px;
29
+ display: flex;
43
30
  }
44
31
 
45
- :host(.disabled) {
46
- opacity: ${disabledOpacity};
47
- cursor: ${disabledCursor};
48
- }
49
-
50
- :host(:hover) {
32
+ :host(:not(.disabled):hover) {
51
33
  cursor: pointer;
52
34
  }
53
35
 
54
- :host(:hover)::before {
55
- background: ${neutralFillStealthHover};
56
- border-color: ${neutralStrokeHover};
36
+ :host(:not(.disabled):hover) {
37
+ color: ${neutralFillStrongHover};
57
38
  }
58
39
 
59
- :host(:${focusVisible}) {
60
- outline: none;
40
+ :host(:not(.disabled):active) {
41
+ color: ${neutralFillStrongActive};
61
42
  }
62
43
 
63
- :host(:${focusVisible})::before {
64
- box-shadow: 0 0 0 1px ${focusStrokeOuter} inset;
44
+ :host(:${focusVisible}) {
65
45
  border-color: ${focusStrokeOuter};
66
46
  }
67
47
 
68
- :host(:active)::before {
69
- background: ${neutralFillStealthActive};
70
- border-color: ${neutralStrokeActive};
71
- }
72
-
73
48
  :host::-moz-focus-inner {
74
49
  border: 0;
75
50
  }
76
51
  `.withBehaviors(forcedColorsStylesheetBehavior(css `
77
52
  :host {
78
- background: ${SystemColors.Canvas};
53
+ background: ${SystemColors.ButtonFace};
54
+ border-color: ${SystemColors.ButtonText};
79
55
  }
80
56
  :host .next,
81
57
  :host .previous {
82
58
  color: ${SystemColors.ButtonText};
83
59
  fill: currentcolor;
84
60
  }
85
- :host::before {
86
- background: ${SystemColors.Canvas};
87
- border-color: ${SystemColors.ButtonText};
88
- }
89
- :host(:hover)::before {
90
- forced-color-adjust: none;
61
+ :host(:not(.disabled):hover) {
91
62
  background: ${SystemColors.Highlight};
92
- border-color: ${SystemColors.ButtonText};
93
- opacity: 1;
94
63
  }
95
- :host(:hover) .next,
96
- :host(:hover) .previous {
97
- forced-color-adjust: none;
64
+ :host(:not(.disabled):hover) .next,
65
+ :host(:not(.disabled):hover) .previous {
98
66
  color: ${SystemColors.HighlightText};
99
67
  fill: currentcolor;
100
68
  }
101
69
  :host(.disabled) {
102
70
  opacity: 1;
103
71
  }
104
- :host(.disabled)::before,
105
- :host(.disabled:hover)::before,
72
+ :host(.disabled),
106
73
  :host(.disabled) .next,
107
- :host(.disabled) .previous,
108
- :host(.disabled:hover) .next,
109
- :host(.disabled:hover) .previous {
110
- forced-color-adjust: none;
111
- background: ${SystemColors.Canvas};
74
+ :host(.disabled) .previous {
112
75
  border-color: ${SystemColors.GrayText};
113
76
  color: ${SystemColors.GrayText};
114
- fill: ${SystemColors.GrayText};
77
+ fill: currentcolor;
115
78
  }
116
- :host(:${focusVisible})::before {
79
+ :host(:${focusVisible}) {
117
80
  forced-color-adjust: none;
118
81
  border-color: ${SystemColors.Highlight};
119
- box-shadow: 0 0 0 2px ${SystemColors.Field}, 0 0 0 4px ${SystemColors.FieldText};
82
+ box-shadow: 0 0 0 2px ${SystemColors.ButtonFace}, 0 0 0 4px ${SystemColors.ButtonText};
120
83
  }
121
84
  `));
@@ -14,17 +14,13 @@ export const fluentFlipper = Flipper.compose({
14
14
  template,
15
15
  styles,
16
16
  next: `
17
- <svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
18
- <path
19
- d="M4.023 15.273L11.29 8 4.023.727l.704-.704L12.71 8l-7.984 7.977-.704-.704z"
20
- />
17
+ <svg width="16" height="16" xmlns="http://www.w3.org/2000/svg">
18
+ <path d="M7.57 11.84A1 1 0 016 11.02V4.98a1 1 0 011.57-.82l3.79 2.62c.85.59.85 1.85 0 2.44l-3.79 2.62z"/>
21
19
  </svg>
22
20
  `,
23
21
  previous: `
24
- <svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
25
- <path
26
- d="M11.273 15.977L3.29 8 11.273.023l.704.704L4.71 8l7.266 7.273-.704.704z"
27
- />
22
+ <svg width="16" height="16" xmlns="http://www.w3.org/2000/svg">
23
+ <path d="M9.43 11.84a1 1 0 001.57-.82V4.98a1 1 0 00-1.57-.82L5.64 6.78c-.85.59-.85 1.85 0 2.44l3.79 2.62z"/>
28
24
  </svg>
29
25
  `,
30
26
  });
@@ -1,43 +1,22 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
- import { SystemColors } from '@microsoft/fast-web-utilities';
4
- import { controlCornerRadius, designUnit, focusStrokeOuter, focusStrokeWidth, neutralLayerFloating, neutralStrokeRest, strokeWidth, } from '../design-tokens';
2
+ import { display, ListboxOption } from '@microsoft/fast-foundation';
3
+ import { controlCornerRadius, designUnit, focusStrokeOuter, neutralStrokeRest, strokeWidth, } from '../design-tokens';
5
4
  export const listboxStyles = (context, definition) => css `
6
5
  ${display('inline-flex')} :host {
7
- background: ${neutralLayerFloating};
8
6
  border: calc(${strokeWidth} * 1px) solid ${neutralStrokeRest};
9
7
  border-radius: calc(${controlCornerRadius} * 1px);
10
8
  box-sizing: border-box;
11
9
  flex-direction: column;
12
10
  padding: calc(${designUnit} * 1px) 0;
11
+ outline: none;
12
+ }
13
+
14
+ ::slotted(${context.tagFor(ListboxOption)}) {
15
+ margin: 0 calc(${designUnit} * 1px);
13
16
  }
14
17
 
15
18
  :host(:focus-within:not([disabled])) {
16
19
  border-color: ${focusStrokeOuter};
17
20
  box-shadow: 0 0 0 1px ${focusStrokeOuter} inset;
18
21
  }
19
- `.withBehaviors(forcedColorsStylesheetBehavior(css `
20
- :host(:${focusVisible}) ::slotted([aria-selected="true"][role="option"]) {
21
- background: ${SystemColors.Highlight};
22
- border-color: ${SystemColors.ButtonText};
23
- box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) inset ${SystemColors.HighlightText};
24
- color: ${SystemColors.HighlightText};
25
- fill: currentcolor;
26
- }
27
-
28
- :host(:${focusVisible}) ::slotted([aria-selected="true"][role="option"]) {
29
- background: ${SystemColors.Highlight};
30
- border-color: ${SystemColors.ButtonText};
31
- box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) inset ${SystemColors.HighlightText};
32
- color: ${SystemColors.HighlightText};
33
- fill: currentcolor;
34
- }
35
-
36
- ::slotted([role='option']:not([aria-selected='true']):not([disabled]):hover) {
37
- forced-color-adjust: none;
38
- color: ${SystemColors.ButtonText};
39
- background: ${SystemColors.ButtonFace};
40
- border-color: ${SystemColors.Highlight};
41
- box-shadow: none;
42
- }
43
- `));
22
+ `;
@@ -2,10 +2,12 @@ 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
4
  import { heightNumber } from '../styles/size';
5
- import { accentFillActive, accentFillFocus, accentFillHover, accentFillRest, bodyFont, controlCornerRadius, designUnit, disabledOpacity, focusStrokeInner, focusStrokeOuter, focusStrokeWidth, foregroundOnAccentActive, foregroundOnAccentFocus, foregroundOnAccentHover, foregroundOnAccentRest, neutralFillActive, neutralFillHover, neutralForegroundRest, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
5
+ import { accentFillRest, bodyFont, controlCornerRadius, designUnit, disabledOpacity, focusStrokeOuter, focusStrokeWidth, neutralFillSecondaryActive, neutralFillSecondaryHover, neutralFillSecondaryRest, neutralFillStealthActive, neutralFillStealthFocus, neutralFillStealthHover, neutralFillStealthRest, neutralForegroundRest, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
6
6
  export const optionStyles = (context, definition) => css `
7
7
  ${display('inline-flex')} :host {
8
+ position: relative;
8
9
  font-family: ${bodyFont};
10
+ background: ${neutralFillStealthRest};
9
11
  border-radius: calc(${controlCornerRadius} * 1px);
10
12
  border: calc(${focusStrokeWidth} * 1px) solid transparent;
11
13
  box-sizing: border-box;
@@ -15,7 +17,6 @@ export const optionStyles = (context, definition) => css `
15
17
  font-size: ${typeRampBaseFontSize};
16
18
  height: calc(${heightNumber} * 1px);
17
19
  line-height: ${typeRampBaseLineHeight};
18
- margin: 0 calc(${designUnit} * 1px);
19
20
  outline: none;
20
21
  overflow: hidden;
21
22
  align-items: center;
@@ -24,36 +25,58 @@ export const optionStyles = (context, definition) => css `
24
25
  white-space: nowrap;
25
26
  }
26
27
 
28
+ :host::before {
29
+ content: '';
30
+ display: block;
31
+ position: absolute;
32
+ left: 0;
33
+ top: calc((${heightNumber} / 4) - ${focusStrokeWidth} * 1px);
34
+ width: 3px;
35
+ height: calc((${heightNumber} / 2) * 1px);
36
+ background: transparent;
37
+ border-radius: calc(${controlCornerRadius} * 1px);
38
+ }
39
+
40
+ :host(:not([disabled]):hover) {
41
+ background: ${neutralFillStealthHover};
42
+ }
43
+
44
+ :host(:not([disabled]):active) {
45
+ background: ${neutralFillStealthActive};
46
+ }
47
+
48
+ :host(:not([disabled]):active)::before {
49
+ background: ${accentFillRest};
50
+ height: calc(((${heightNumber} / 2) - 6) * 1px);
51
+ }
52
+
53
+ :host([aria-selected='true'])::before {
54
+ background: ${accentFillRest};
55
+ }
56
+
27
57
  :host(:${focusVisible}) {
28
- box-shadow: 0 0 0 calc(${focusStrokeWidth} * 1px) inset ${focusStrokeInner};
29
58
  border-color: ${focusStrokeOuter};
30
- background: ${accentFillFocus};
31
- color: ${foregroundOnAccentFocus};
59
+ background: ${neutralFillStealthFocus};
32
60
  }
33
61
 
34
62
  :host([aria-selected='true']) {
35
- background: ${accentFillRest};
36
- color: ${foregroundOnAccentRest};
63
+ background: ${neutralFillSecondaryRest};
37
64
  }
38
65
 
39
- :host(:hover) {
40
- background: ${accentFillHover};
41
- color: ${foregroundOnAccentHover};
66
+ :host(:not([disabled])[aria-selected='true']:hover) {
67
+ background: ${neutralFillSecondaryHover};
42
68
  }
43
69
 
44
- :host(:active) {
45
- background: ${accentFillActive};
46
- color: ${foregroundOnAccentActive};
70
+ :host(:not([disabled])[aria-selected='true']:active) {
71
+ background: ${neutralFillSecondaryActive};
47
72
  }
48
73
 
49
- :host(:not([aria-selected='true']):hover) {
50
- background: ${neutralFillHover};
51
- color: ${neutralForegroundRest};
74
+ :host(:not([disabled]):not([aria-selected='true']):hover) {
75
+ background: ${neutralFillStealthHover};
52
76
  }
53
77
 
54
- :host(:not([aria-selected='true']):active) {
55
- background: ${neutralFillActive};
56
- color: ${neutralForegroundRest};
78
+ :host(:not([disabled]):not([aria-selected='true']):active) {
79
+ background: ${neutralFillStealthActive};
57
80
  }
58
81
 
59
82
  :host([disabled]) {
@@ -61,10 +84,6 @@ export const optionStyles = (context, definition) => css `
61
84
  opacity: ${disabledOpacity};
62
85
  }
63
86
 
64
- :host([disabled]:hover) {
65
- background-color: inherit;
66
- }
67
-
68
87
  .content {
69
88
  grid-column-start: 2;
70
89
  justify-self: start;
@@ -78,12 +97,6 @@ export const optionStyles = (context, definition) => css `
78
97
  display: flex;
79
98
  }
80
99
 
81
- ::slotted(svg) {
82
- ${ /* Glyph size and margin-left is temporary - replace when adaptive typography is figured out */''}
83
- height: calc(${designUnit} * 4px);
84
- width: calc(${designUnit} * 4px);
85
- }
86
-
87
100
  ::slotted([slot='end']) {
88
101
  margin-inline-start: 1ch;
89
102
  }
@@ -93,17 +106,21 @@ export const optionStyles = (context, definition) => css `
93
106
  }
94
107
  `.withBehaviors(forcedColorsStylesheetBehavior(css `
95
108
  :host {
96
- border-color: transparent;
109
+ background: ${SystemColors.ButtonFace};
110
+ border-color: ${SystemColors.ButtonFace};
97
111
  color: ${SystemColors.ButtonText};
98
- forced-color-adjust: none;
99
112
  }
100
-
101
- :host(:not([aria-selected='true']):hover),
102
- :host([aria-selected='true']) {
113
+ :host(:not([disabled]):not([aria-selected="true"]):hover),
114
+ :host(:not([disabled])[aria-selected="true"]:hover),
115
+ :host([aria-selected="true"]) {
116
+ forced-color-adjust: none;
103
117
  background: ${SystemColors.Highlight};
104
118
  color: ${SystemColors.HighlightText};
105
119
  }
106
-
120
+ :host(:not([disabled]):active)::before,
121
+ :host([aria-selected='true'])::before {
122
+ background: ${SystemColors.HighlightText};
123
+ }
107
124
  :host([disabled]),
108
125
  :host([disabled]:not([aria-selected='true']):hover) {
109
126
  background: ${SystemColors.Canvas};
@@ -1,5 +1,19 @@
1
- import { Menu, menuTemplate as template } from '@microsoft/fast-foundation';
1
+ import { Menu as FoundationMenu, menuTemplate as template } from '@microsoft/fast-foundation';
2
+ import { fillColor, neutralLayerFloating } from '../design-tokens';
2
3
  import { menuStyles as styles } from './menu.styles';
4
+ /**
5
+ * The Fluent menu class
6
+ * @public
7
+ */
8
+ export class Menu extends FoundationMenu {
9
+ /**
10
+ * @internal
11
+ */
12
+ connectedCallback() {
13
+ super.connectedCallback();
14
+ fillColor.setValueFor(this, neutralLayerFloating);
15
+ }
16
+ }
3
17
  /**
4
18
  * The Fluent Menu Element. Implements {@link @microsoft/fast-foundation#Menu},
5
19
  * {@link @microsoft/fast-foundation#menuTemplate}
@@ -11,6 +25,7 @@ import { menuStyles as styles } from './menu.styles';
11
25
  */
12
26
  export const fluentMenu = Menu.compose({
13
27
  baseName: 'menu',
28
+ baseClass: FoundationMenu,
14
29
  template,
15
30
  styles,
16
31
  });
@@ -19,8 +34,3 @@ export const fluentMenu = Menu.compose({
19
34
  * @public
20
35
  */
21
36
  export const menuStyles = styles;
22
- /**
23
- * Base class for Menu
24
- * @public
25
- */
26
- export { Menu };
@@ -6,7 +6,14 @@ export default {
6
6
  const MenuTemplate = () => `
7
7
  <fluent-menu>
8
8
  <fluent-menu-item>Menu item 1</fluent-menu-item>
9
- <fluent-menu-item>Menu item 2</fluent-menu-item>
9
+ <fluent-menu-item>
10
+ Menu item 2
11
+ <fluent-menu>
12
+ <fluent-menu-item>Nested Menu item 2.1</fluent-menu-item>
13
+ <fluent-menu-item>Nested Menu item 2.2</fluent-menu-item>
14
+ <fluent-menu-item>Nested Menu item 2.3</fluent-menu-item>
15
+ </fluent-menu>
16
+ </fluent-menu-item>
10
17
  <fluent-menu-item disabled="true">Menu item 3</fluent-menu-item>
11
18
  <fluent-menu-item>
12
19
  Menu item 4
@@ -18,7 +25,14 @@ export const Menu = MenuTemplate.bind({});
18
25
  const example = `
19
26
  <fluent-menu>
20
27
  <fluent-menu-item>Menu item 1</fluent-menu-item>
21
- <fluent-menu-item>Menu item 2</fluent-menu-item>
28
+ <fluent-menu-item>
29
+ Menu item 2
30
+ <fluent-menu>
31
+ <fluent-menu-item>Nested Menu item 2.1</fluent-menu-item>
32
+ <fluent-menu-item>Nested Menu item 2.2</fluent-menu-item>
33
+ <fluent-menu-item>Nested Menu item 2.3</fluent-menu-item>
34
+ </fluent-menu>
35
+ </fluent-menu-item>
22
36
  <fluent-menu-item disabled="true">Menu item 3</fluent-menu-item>
23
37
  <fluent-menu-item>
24
38
  Menu item 4
@@ -1,31 +1,42 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { display } from '@microsoft/fast-foundation';
3
- import { elevation } from '../styles/index';
4
- import { controlCornerRadius, designUnit, layerCornerRadius, neutralLayerFloating, neutralStrokeDividerRest, strokeWidth, } from '../design-tokens';
2
+ import { display, Divider, forcedColorsStylesheetBehavior, MenuItem } from '@microsoft/fast-foundation';
3
+ import { SystemColors } from "@microsoft/fast-web-utilities";
4
+ import { elevationShadowFlyout } from '../styles/index';
5
+ import { designUnit, layerCornerRadius, neutralLayerFloating, neutralStrokeDividerRest, strokeWidth, } from '../design-tokens';
5
6
  export const menuStyles = (context, definition) => css `
6
- ${display('block')} :host {
7
- --elevation: 11;
8
- background: ${neutralLayerFloating};
9
- border: calc(${strokeWidth} * 1px) solid transparent;
10
- border-radius: ${layerCornerRadius};
11
- ${elevation}
12
- margin: 0;
13
- border-radius: calc(${controlCornerRadius} * 1px);
14
- padding: calc(${designUnit} * 1px) 0;
15
- max-width: 368px;
16
- min-width: 64px;
17
- }
7
+ ${display('block')} :host {
8
+ background: ${neutralLayerFloating};
9
+ border: calc(${strokeWidth} * 1px) solid transparent;
10
+ border-radius: calc(${layerCornerRadius} * 1px);
11
+ box-shadow: ${elevationShadowFlyout};
12
+ padding: calc(${designUnit} * 1px) 0;
13
+ max-width: 368px;
14
+ min-width: 64px;
15
+ }
18
16
 
19
- :host([slot='submenu']) {
20
- width: max-content;
21
- margin: 0 calc(${designUnit} * 1px);
22
- }
17
+ :host([slot='submenu']) {
18
+ width: max-content;
19
+ margin: 0 calc(${designUnit} * 2px);
20
+ }
23
21
 
24
- ::slotted(hr) {
25
- box-sizing: content-box;
26
- height: 0;
27
- margin: 0;
28
- border: none;
29
- border-top: calc(${strokeWidth} * 1px) solid ${neutralStrokeDividerRest};
30
- }
31
- `;
22
+ ::slotted(${context.tagFor(MenuItem)}) {
23
+ margin: 0 calc(${designUnit} * 1px);
24
+ }
25
+
26
+ ::slotted(${context.tagFor(Divider)}) {
27
+ margin: calc(${designUnit} * 1px) 0;
28
+ }
29
+
30
+ ::slotted(hr) {
31
+ box-sizing: content-box;
32
+ height: 0;
33
+ margin: calc(${designUnit} * 1px) 0;
34
+ border: none;
35
+ border-top: calc(${strokeWidth} * 1px) solid ${neutralStrokeDividerRest};
36
+ }
37
+ `.withBehaviors(forcedColorsStylesheetBehavior(css `
38
+ :host([slot='submenu']) {
39
+ background: ${SystemColors.Canvas};
40
+ border-color: ${SystemColors.CanvasText};
41
+ }
42
+ `));
@@ -14,45 +14,18 @@ export const fluentMenuItem = MenuItem.compose({
14
14
  template,
15
15
  styles,
16
16
  checkboxIndicator: `
17
- <svg
18
- aria-hidden="true"
19
- part="checkbox-indicator"
20
- class="checkbox-indicator"
21
- viewBox="0 0 20 20"
22
- xmlns="http://www.w3.org/2000/svg"
23
- >
24
- <path
25
- fill-rule="evenodd"
26
- clip-rule="evenodd"
27
- d="M8.143 12.6697L15.235 4.5L16.8 5.90363L8.23812 15.7667L3.80005 11.2556L5.27591 9.7555L8.143 12.6697Z"
28
- />
17
+ <svg width="16" height="16" xmlns="http://www.w3.org/2000/svg">
18
+ <path d="M13.86 3.66a.5.5 0 01-.02.7l-7.93 7.48a.6.6 0 01-.84-.02L2.4 9.1a.5.5 0 01.72-.7l2.4 2.44 7.65-7.2a.5.5 0 01.7.02z"/>
29
19
  </svg>
30
20
  `,
31
21
  expandCollapseGlyph: `
32
- <svg
33
- viewBox="0 0 16 16"
34
- xmlns="http://www.w3.org/2000/svg"
35
- class="expand-collapse-glyph"
36
- part="expand-collapse-glyph"
37
- >
38
- <path
39
- d="M5.00001 12.3263C5.00124 12.5147 5.05566 12.699 5.15699 12.8578C5.25831 13.0167 5.40243 13.1437 5.57273 13.2242C5.74304 13.3047 5.9326 13.3354 6.11959 13.3128C6.30659 13.2902 6.4834 13.2152 6.62967 13.0965L10.8988 8.83532C11.0739 8.69473 11.2153 8.51658 11.3124 8.31402C11.4096 8.11146 11.46 7.88966 11.46 7.66499C11.46 7.44033 11.4096 7.21853 11.3124 7.01597C11.2153 6.81341 11.0739 6.63526 10.8988 6.49467L6.62967 2.22347C6.48274 2.10422 6.30501 2.02912 6.11712 2.00691C5.92923 1.9847 5.73889 2.01628 5.56823 2.09799C5.39757 2.17969 5.25358 2.30817 5.153 2.46849C5.05241 2.62882 4.99936 2.8144 5.00001 3.00369V12.3263Z"
40
- />
22
+ <svg width="16" height="16" xmlns="http://www.w3.org/2000/svg">
23
+ <path d="M5.65 3.15a.5.5 0 000 .7L9.79 8l-4.14 4.15a.5.5 0 00.7.7l4.5-4.5a.5.5 0 000-.7l-4.5-4.5a.5.5 0 00-.7 0z"/>
41
24
  </svg>
42
25
  `,
43
26
  radioIndicator: `
44
- <svg
45
- aria-hidden="true"
46
- part="radio-indicator"
47
- class="radio-indicator"
48
- viewBox="0 0 20 20"
49
- xmlns="http://www.w3.org/2000/svg"
50
- >
51
- <path
52
- fill-rule="evenodd"
53
- clip-rule="evenodd"
54
- d="M8.143 12.6697L15.235 4.5L16.8 5.90363L8.23812 15.7667L3.80005 11.2556L5.27591 9.7555L8.143 12.6697Z"
55
- />
27
+ <svg width="16" height="16" xmlns="http://www.w3.org/2000/svg">
28
+ <circle cx="8" cy="8" r="2"/>
56
29
  </svg>
57
30
  `,
58
31
  });
@@ -13,7 +13,7 @@ export default {
13
13
  };
14
14
  const MenuItemTemplate = ({ checked, disabled }) => `
15
15
  <fluent-menu-item
16
- ${checked ? `checked="${checked}"` : ''}
16
+ ${checked ? 'checked role="menuitemcheckbox"' : ''}
17
17
  ${disabled ? 'disabled' : ''}
18
18
  >Menu item 1</fluent-menu-item>
19
19
  `;