@redvars/peacock 4.7.0 → 4.8.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 (277) hide show
  1. package/dist/accordion-item.js +4 -4
  2. package/dist/app-bar.js +1 -1
  3. package/dist/app-shell.js +2 -2
  4. package/dist/assets/styles.css +1 -1
  5. package/dist/assets/styles.css.map +1 -1
  6. package/dist/assets/theme.d.ts +2 -0
  7. package/dist/assets/theme.js +49 -29
  8. package/dist/assets/tokens.css +1 -1
  9. package/dist/assets/tokens.css.map +1 -1
  10. package/dist/bottom-sheet.js +3 -3
  11. package/dist/breadcrumb-item.js +1 -1
  12. package/dist/button-group.js +79 -0
  13. package/dist/button-group.js.map +1 -1
  14. package/dist/button.js +26 -25
  15. package/dist/button.js.map +1 -1
  16. package/dist/calendar-column-view.js +3 -3
  17. package/dist/calendar-month-view.js +3 -3
  18. package/dist/calendar-timeline.js +3 -3
  19. package/dist/card.js +2 -1
  20. package/dist/card.js.map +1 -1
  21. package/dist/carousel.js +182 -7
  22. package/dist/carousel.js.map +1 -1
  23. package/dist/{cartesian-chart-C8qKDXo8.js → cartesian-chart-UW1CYKRS.js} +2 -2
  24. package/dist/{cartesian-chart-C8qKDXo8.js.map → cartesian-chart-UW1CYKRS.js.map} +1 -1
  25. package/dist/cb-group.js +1 -1
  26. package/dist/chart-area.js +2 -2
  27. package/dist/chart-bar.js +2 -2
  28. package/dist/{chart-base-BpQMZZsw.js → chart-base-D5ujPGcl.js} +3 -3
  29. package/dist/{chart-base-BpQMZZsw.js.map → chart-base-D5ujPGcl.js.map} +1 -1
  30. package/dist/chart-doughnut.js +1 -1
  31. package/dist/chart-line.js +2 -2
  32. package/dist/chart-pie.js +2 -2
  33. package/dist/checkbox.js +5 -5
  34. package/dist/chip.js +34 -8
  35. package/dist/chip.js.map +1 -1
  36. package/dist/circular-progress.js +46 -15
  37. package/dist/circular-progress.js.map +1 -1
  38. package/dist/code-highlighter.js +1 -1
  39. package/dist/color-picker.js +1 -1
  40. package/dist/command-palette.js +2 -2
  41. package/dist/comment-composer.js +5 -5
  42. package/dist/condition-builder.js +1 -1
  43. package/dist/{condition-group-base-NcvOY-Zv.js → condition-group-base-DS76sprm.js} +2 -2
  44. package/dist/{condition-group-base-NcvOY-Zv.js.map → condition-group-base-DS76sprm.js.map} +1 -1
  45. package/dist/confirm-dialog.js +2 -2
  46. package/dist/custom-elements-jsdocs.json +302 -10
  47. package/dist/custom-elements.json +1128 -16
  48. package/dist/dependency-map.js +2 -2
  49. package/dist/{diagram-hv7hCgzx.js → diagram-DFO-X7yq.js} +2 -2
  50. package/dist/{diagram-hv7hCgzx.js.map → diagram-DFO-X7yq.js.map} +1 -1
  51. package/dist/diagram.js +1 -1
  52. package/dist/discussion.js +3 -3
  53. package/dist/{document-editor-CZBlz3ai.js → document-editor-CSS-wACs.js} +7 -7
  54. package/dist/{document-editor-CZBlz3ai.js.map → document-editor-CSS-wACs.js.map} +1 -1
  55. package/dist/document-editor.js +3 -3
  56. package/dist/dropdown-button.js +1 -1
  57. package/dist/erd.js +4 -4
  58. package/dist/fab-menu-item.js +189 -0
  59. package/dist/fab-menu-item.js.map +1 -0
  60. package/dist/fab-menu.js +326 -0
  61. package/dist/fab-menu.js.map +1 -0
  62. package/dist/fab.js +28 -17
  63. package/dist/fab.js.map +1 -1
  64. package/dist/field.js +1 -1
  65. package/dist/file-upload.js +1 -1
  66. package/dist/flow.js +1 -1
  67. package/dist/hover-card.js +5 -3
  68. package/dist/hover-card.js.map +1 -1
  69. package/dist/html-editor.js +4 -4
  70. package/dist/icon-button.js +26 -25
  71. package/dist/icon-button.js.map +1 -1
  72. package/dist/{index-DK3fREuj.js → index-BBxpsqx8.js} +4 -4
  73. package/dist/{index-DK3fREuj.js.map → index-BBxpsqx8.js.map} +1 -1
  74. package/dist/{index-CTEt3LtO.js → index-CDtKB0In.js} +4 -4
  75. package/dist/{index-CTEt3LtO.js.map → index-CDtKB0In.js.map} +1 -1
  76. package/dist/{index-Bag4vtx-.js → index-Tb0ky27z.js} +3 -3
  77. package/dist/{index-Bag4vtx-.js.map → index-Tb0ky27z.js.map} +1 -1
  78. package/dist/index.js +15 -12
  79. package/dist/index.js.map +1 -1
  80. package/dist/{indicator-navigation-item-BG0TrdDE.js → indicator-navigation-item-aZsm-RpR.js} +17 -5
  81. package/dist/{indicator-navigation-item-BG0TrdDE.js.map → indicator-navigation-item-aZsm-RpR.js.map} +1 -1
  82. package/dist/inline-edit.js +1 -1
  83. package/dist/json-viewer.js +1 -1
  84. package/dist/linear-progress.js +51 -4
  85. package/dist/linear-progress.js.map +1 -1
  86. package/dist/link-button.js +26 -25
  87. package/dist/link-button.js.map +1 -1
  88. package/dist/loader-full.js +8 -5
  89. package/dist/loader-full.js.map +1 -1
  90. package/dist/loader.js +17 -5
  91. package/dist/loader.js.map +1 -1
  92. package/dist/loading-indicator.js +301 -0
  93. package/dist/loading-indicator.js.map +1 -0
  94. package/dist/markdown-editor.js +4 -4
  95. package/dist/mention-input.js +1 -1
  96. package/dist/menu.js +8 -6
  97. package/dist/menu.js.map +1 -1
  98. package/dist/{modal-Dds0rXAG.js → modal-ClWCCbxD.js} +7 -5
  99. package/dist/{modal-Dds0rXAG.js.map → modal-ClWCCbxD.js.map} +1 -1
  100. package/dist/modal.js +2 -2
  101. package/dist/navigation-bar-item.js +1 -1
  102. package/dist/navigation-bar.js +1 -1
  103. package/dist/navigation-drawer-group.js +1 -1
  104. package/dist/navigation-drawer.js +1 -1
  105. package/dist/navigation-rail-item.js +1 -1
  106. package/dist/navigation-rail.js +1 -1
  107. package/dist/notification-center.js +1 -1
  108. package/dist/number-counter.js +1 -1
  109. package/dist/{overlay-controller-BOk-kfil.js → overlay-controller-iVaiUqos.js} +20 -10
  110. package/dist/{overlay-controller-BOk-kfil.js.map → overlay-controller-iVaiUqos.js.map} +1 -1
  111. package/dist/pagination.js +1 -1
  112. package/dist/popover-content.js +4 -2
  113. package/dist/popover-content.js.map +1 -1
  114. package/dist/popover.js +1 -1
  115. package/dist/{progress-base-BhJK__VP.js → progress-base-BeLu9-Tq.js} +13 -1
  116. package/dist/progress-base-BeLu9-Tq.js.map +1 -0
  117. package/dist/prompt-input.js +5 -5
  118. package/dist/radio.js +3 -3
  119. package/dist/resizable-panels.js +1 -1
  120. package/dist/{rich-text-input-base-SrsPvc-j.js → rich-text-input-base-BCmnkpuV.js} +2 -2
  121. package/dist/{rich-text-input-base-SrsPvc-j.js.map → rich-text-input-base-BCmnkpuV.js.map} +1 -1
  122. package/dist/scroll-area.js +1 -1
  123. package/dist/search.js +1 -1
  124. package/dist/segmented-button.js +7 -2
  125. package/dist/segmented-button.js.map +1 -1
  126. package/dist/select.js +1 -1
  127. package/dist/side-sheet.js +3 -3
  128. package/dist/site-header.js +3 -3
  129. package/dist/site-nav-menu.js +1 -1
  130. package/dist/{slash-controller-DwL0nkqv.js → slash-controller-BFhzSjiR.js} +2 -2
  131. package/dist/{slash-controller-DwL0nkqv.js.map → slash-controller-BFhzSjiR.js.map} +1 -1
  132. package/dist/slider.js +163 -68
  133. package/dist/slider.js.map +1 -1
  134. package/dist/snackbar.js +2 -2
  135. package/dist/sparkline.js +2 -2
  136. package/dist/split-button.js +1 -1
  137. package/dist/src/button/button-group/button-group.d.ts +12 -0
  138. package/dist/src/button/fab/fab.d.ts +1 -0
  139. package/dist/src/carousel/carousel.d.ts +22 -0
  140. package/dist/src/chip/chip/chip.d.ts +4 -0
  141. package/dist/src/fab-menu/fab-menu-item.d.ts +30 -0
  142. package/dist/src/fab-menu/fab-menu.d.ts +64 -0
  143. package/dist/src/fab-menu/index.d.ts +2 -0
  144. package/dist/src/index.d.ts +3 -0
  145. package/dist/src/loading-indicator/index.d.ts +1 -0
  146. package/dist/src/loading-indicator/loading-indicator.d.ts +44 -0
  147. package/dist/src/loading-indicator/shapes.d.ts +29 -0
  148. package/dist/src/progress/circular-progress/circular-progress.d.ts +3 -1
  149. package/dist/src/progress/linear-progress/linear-progress.d.ts +2 -1
  150. package/dist/src/progress/progress-base.d.ts +7 -0
  151. package/dist/src/slider/slider.d.ts +23 -3
  152. package/dist/src/toolbar/toolbar.d.ts +20 -0
  153. package/dist/step.js +1 -1
  154. package/dist/switch.js +5 -2
  155. package/dist/switch.js.map +1 -1
  156. package/dist/tab-group.js +13 -2
  157. package/dist/tab-group.js.map +1 -1
  158. package/dist/tab-panel.js +26 -0
  159. package/dist/tab-panel.js.map +1 -1
  160. package/dist/tab.js +23 -5
  161. package/dist/tab.js.map +1 -1
  162. package/dist/table.js +4 -4
  163. package/dist/tag.js +2 -1
  164. package/dist/tag.js.map +1 -1
  165. package/dist/test/button-group-press.test.d.ts +1 -0
  166. package/dist/test/fab-menu.test.d.ts +1 -0
  167. package/dist/test/loading-indicator.test.d.ts +1 -0
  168. package/dist/toolbar.js +102 -0
  169. package/dist/toolbar.js.map +1 -1
  170. package/dist/tooltip.js +5 -2
  171. package/dist/tooltip.js.map +1 -1
  172. package/dist/tour.js +3 -3
  173. package/dist/tree-chart.js +3 -3
  174. package/dist/tree-item.js +1 -1
  175. package/dist/tsconfig.tsbuildinfo +1 -1
  176. package/dist/{video-DgtGGvrk.js → video-DSQ07o3h.js} +2 -2
  177. package/dist/{video-DgtGGvrk.js.map → video-DSQ07o3h.js.map} +1 -1
  178. package/dist/video.js +1 -1
  179. package/dist/workflow.js +5 -5
  180. package/package.json +1 -1
  181. package/scss/tokens.css +364 -0
  182. package/src/__internal/chart/chart-base.scss +4 -2
  183. package/src/__internal/controllers/overlay-controller.ts +19 -9
  184. package/src/__internal/rich-text/editor-chrome.scss +2 -1
  185. package/src/accordion/accordion-item.scss +10 -6
  186. package/src/app-bar/app-bar.scss +2 -1
  187. package/src/app-shell/app-shell.scss +2 -2
  188. package/src/bottom-sheet/bottom-sheet.scss +4 -2
  189. package/src/breadcrumb/breadcrumb-item/breadcrumb-item.scss +4 -2
  190. package/src/button/button/button-base.scss +14 -12
  191. package/src/button/button/button-layers.scss +27 -5
  192. package/src/button/button-group/button-group.scss +6 -0
  193. package/src/button/button-group/button-group.ts +105 -0
  194. package/src/button/fab/fab-sizes.scss +2 -0
  195. package/src/button/fab/fab.scss +32 -17
  196. package/src/button/fab/fab.ts +1 -0
  197. package/src/calendar/calendar-column-view.scss +3 -3
  198. package/src/calendar/calendar-month-view.scss +3 -3
  199. package/src/calendar-timeline/calendar-timeline.scss +6 -3
  200. package/src/card/card.scss +2 -1
  201. package/src/carousel/carousel.scss +71 -2
  202. package/src/carousel/carousel.ts +159 -7
  203. package/src/chart-pie/chart-pie.scss +4 -2
  204. package/src/checkbox/checkbox.scss +13 -7
  205. package/src/chip/chip/chip.scss +41 -8
  206. package/src/chip/chip/chip.ts +4 -0
  207. package/src/chip/tag/tag.scss +2 -1
  208. package/src/code-highlighter/code-highlighter.scss +2 -1
  209. package/src/color-picker/color-picker.scss +1 -1
  210. package/src/comment-composer/comment-composer.scss +2 -1
  211. package/src/components.manifest.json +21 -0
  212. package/src/condition-builder/condition-group-base.scss +1 -1
  213. package/src/dependency-map/dependency-map.scss +4 -2
  214. package/src/diagram/diagram.scss +2 -1
  215. package/src/document-editor/document-editor.scss +1 -1
  216. package/src/dropdown-button/dropdown-button.scss +2 -1
  217. package/src/erd/erd.scss +8 -4
  218. package/src/fab-menu/fab-menu-item.scss +99 -0
  219. package/src/fab-menu/fab-menu-item.ts +58 -0
  220. package/src/fab-menu/fab-menu.scss +119 -0
  221. package/src/fab-menu/fab-menu.ts +193 -0
  222. package/src/fab-menu/index.ts +2 -0
  223. package/src/field/field.scss +1 -1
  224. package/src/file-upload/file-upload.scss +2 -2
  225. package/src/hover-card/hover-card.scss +9 -2
  226. package/src/index.ts +3 -0
  227. package/src/inline-edit/inline-edit.scss +2 -2
  228. package/src/json-viewer/json-viewer.scss +2 -1
  229. package/src/loader.ts +12 -0
  230. package/src/loading-indicator/index.ts +1 -0
  231. package/src/loading-indicator/loading-indicator.scss +52 -0
  232. package/src/loading-indicator/loading-indicator.ts +164 -0
  233. package/src/loading-indicator/shapes.ts +104 -0
  234. package/src/menu/menu/menu.scss +10 -6
  235. package/src/modal/modal.scss +8 -4
  236. package/src/navigation-drawer/navigation-drawer-group.scss +2 -2
  237. package/src/navigation-drawer/navigation-drawer.scss +3 -2
  238. package/src/navigation-rail/navigation-rail-item.scss +27 -5
  239. package/src/number-counter/number-counter.scss +1 -1
  240. package/src/pagination/pagination.scss +2 -1
  241. package/src/popover/popover-content.scss +7 -2
  242. package/src/progress/circular-progress/circular-progress.scss +3 -2
  243. package/src/progress/circular-progress/circular-progress.ts +43 -12
  244. package/src/progress/linear-progress/linear-progress.scss +70 -2
  245. package/src/progress/linear-progress/linear-progress.ts +4 -1
  246. package/src/progress/progress-base.ts +11 -0
  247. package/src/prompt-input/prompt-input.scss +2 -1
  248. package/src/radio/radio.scss +8 -4
  249. package/src/resizable-panels/resizable-panels.scss +2 -1
  250. package/src/scroll-area/scroll-area.scss +2 -1
  251. package/src/search/search.scss +2 -1
  252. package/src/segmented-button/segmented-button.scss +8 -3
  253. package/src/select/select.scss +2 -1
  254. package/src/side-sheet/side-sheet.scss +4 -2
  255. package/src/site-header/site-header.scss +4 -4
  256. package/src/site-header/site-nav-menu.scss +2 -2
  257. package/src/slider/slider.scss +127 -64
  258. package/src/slider/slider.ts +74 -9
  259. package/src/snackbar/snackbar.scss +5 -2
  260. package/src/sparkline/sparkline.scss +6 -3
  261. package/src/split-button/split-button.scss +4 -2
  262. package/src/stepper/step.scss +2 -1
  263. package/src/switch/switch.scss +21 -2
  264. package/src/table/table.scss +8 -4
  265. package/src/tabs/tab-group.ts +12 -2
  266. package/src/tabs/tab-panel.scss +31 -0
  267. package/src/tabs/tab.scss +28 -17
  268. package/src/toolbar/toolbar-colors.scss +11 -0
  269. package/src/toolbar/toolbar.scss +28 -0
  270. package/src/toolbar/toolbar.ts +74 -1
  271. package/src/tooltip/tooltip.scss +9 -3
  272. package/src/tour/tour.scss +2 -2
  273. package/src/tree/tree-item.scss +2 -1
  274. package/src/tree-chart/tree-chart.scss +3 -3
  275. package/src/video/video.scss +2 -1
  276. package/src/workflow/workflow.scss +5 -5
  277. package/dist/progress-base-BhJK__VP.js.map +0 -1
package/src/erd/erd.scss CHANGED
@@ -77,7 +77,8 @@
77
77
  .erd-relation {
78
78
  --_line: var(--erd-relation-color);
79
79
 
80
- transition: opacity 150ms ease;
80
+ transition: opacity var(--motion-spring-fast-effects-duration)
81
+ var(--motion-spring-fast-effects-easing);
81
82
 
82
83
  &.is-lit,
83
84
  &.is-selected {
@@ -169,7 +170,8 @@
169
170
  transition:
170
171
  box-shadow 150ms ease,
171
172
  border-color 150ms ease,
172
- opacity 150ms ease;
173
+ opacity var(--motion-spring-fast-effects-duration)
174
+ var(--motion-spring-fast-effects-easing);
173
175
 
174
176
  &:hover {
175
177
  border-color: var(--color-outline);
@@ -413,7 +415,8 @@
413
415
 
414
416
  .erd-remove {
415
417
  opacity: 0;
416
- transition: opacity 120ms ease;
418
+ transition: opacity var(--motion-spring-fast-effects-duration)
419
+ var(--motion-spring-fast-effects-easing);
417
420
 
418
421
  .erd-row:hover &,
419
422
  &:focus-within {
@@ -436,7 +439,8 @@
436
439
  cursor: crosshair;
437
440
  opacity: 0;
438
441
  transition:
439
- opacity 120ms ease,
442
+ opacity var(--motion-spring-fast-effects-duration)
443
+ var(--motion-spring-fast-effects-easing),
440
444
  transform 120ms ease;
441
445
 
442
446
  .erd-row:hover &,
@@ -0,0 +1,99 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: inline-flex;
7
+ --_item-color: var(--color-primary-container);
8
+ --_item-text-color: var(--color-on-primary-container);
9
+ --_fab-menu-delay: 0ms;
10
+
11
+ // Hidden until the menu opens; springs up towards the FAB as it appears.
12
+ opacity: 0;
13
+ transform: translateY(1rem) scale(0.8);
14
+ transform-origin: 100% 100%;
15
+ pointer-events: none;
16
+ transition:
17
+ opacity var(--motion-spring-fast-effects-duration)
18
+ var(--motion-spring-fast-effects-easing),
19
+ transform var(--motion-spring-fast-spatial-duration)
20
+ var(--motion-spring-fast-spatial-easing);
21
+ }
22
+
23
+ :host([shown]) {
24
+ opacity: 1;
25
+ transform: none;
26
+ pointer-events: auto;
27
+ transition-delay: var(--_fab-menu-delay);
28
+ }
29
+
30
+ :host([color='secondary']) {
31
+ --_item-color: var(--color-secondary-container);
32
+ --_item-text-color: var(--color-on-secondary-container);
33
+ }
34
+
35
+ :host([color='tertiary']) {
36
+ --_item-color: var(--color-tertiary-container);
37
+ --_item-text-color: var(--color-on-tertiary-container);
38
+ }
39
+
40
+ .item {
41
+ @include mixin.reset-button-styles;
42
+ position: relative;
43
+ display: inline-flex;
44
+ align-items: center;
45
+ gap: var(--spacing-100);
46
+ height: 3.5rem;
47
+ padding-inline: var(--spacing-300);
48
+ border-radius: var(--shape-corner-full);
49
+ background-color: var(--_item-color);
50
+ color: var(--_item-text-color);
51
+ cursor: pointer;
52
+ @include mixin.get-typography(title-medium);
53
+ transition: border-radius var(--motion-spring-fast-spatial-duration)
54
+ var(--motion-spring-fast-spatial-easing);
55
+
56
+ &::after {
57
+ content: '';
58
+ position: absolute;
59
+ inset: 0;
60
+ border-radius: inherit;
61
+ background-color: currentColor;
62
+ opacity: 0;
63
+ transition: opacity var(--motion-spring-fast-effects-duration)
64
+ var(--motion-spring-fast-effects-easing);
65
+ }
66
+
67
+ &:hover::after {
68
+ opacity: 0.08;
69
+ }
70
+
71
+ &:active {
72
+ border-radius: var(--shape-corner-large);
73
+ }
74
+
75
+ &:active::after {
76
+ opacity: 0.12;
77
+ }
78
+
79
+ &:focus-visible {
80
+ outline: 3px solid var(--color-secondary);
81
+ outline-offset: 2px;
82
+ }
83
+
84
+ &:disabled {
85
+ cursor: not-allowed;
86
+ opacity: 0.38;
87
+ }
88
+
89
+ .icon {
90
+ --icon-size: 1.5rem;
91
+ --icon-color: currentColor;
92
+ }
93
+ }
94
+
95
+ @media (forced-colors: active) {
96
+ .item {
97
+ border: 1px solid ButtonText;
98
+ }
99
+ }
@@ -0,0 +1,58 @@
1
+ import { html, LitElement } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import styles from './fab-menu-item.scss';
4
+
5
+ /**
6
+ * @label FAB Menu Item
7
+ * @tag wc-fab-menu-item
8
+ * @rawTag fab-menu-item
9
+ * @summary One action in a `wc-fab-menu`: a pill with an icon and a label.
10
+ * @overview
11
+ * <p>Use inside <code>wc-fab-menu</code>. The default slot holds the label and <code>icon</code>
12
+ * names the leading icon. Listen for <code>click</code> to run the action; the menu closes
13
+ * itself.</p>
14
+ * @tags controls
15
+ *
16
+ * @example
17
+ * ```html
18
+ * <wc-fab-menu-item icon="edit">Note</wc-fab-menu-item>
19
+ * ```
20
+ */
21
+ export class FabMenuItem extends LitElement {
22
+ static styles = [styles];
23
+
24
+ /** @nocollapse */ // eslint-disable-next-line
25
+ static override shadowRootOptions: ShadowRootInit = {
26
+ ...LitElement.shadowRootOptions,
27
+ delegatesFocus: true,
28
+ };
29
+
30
+ /** Name of the leading icon. */
31
+ @property({ type: String }) icon?: string;
32
+
33
+ /** Disables the item. */
34
+ @property({ type: Boolean, reflect: true }) disabled = false;
35
+
36
+ /** Set by the menu: whether the item is shown. */
37
+ @property({ type: Boolean, reflect: true }) shown = false;
38
+
39
+ /** Set by the menu: its color set. */
40
+ @property({ type: String, reflect: true }) color:
41
+ | 'primary'
42
+ | 'secondary'
43
+ | 'tertiary' = 'primary';
44
+
45
+ override render() {
46
+ return html`<button
47
+ class="item"
48
+ type="button"
49
+ ?disabled=${this.disabled}
50
+ tabindex=${this.shown ? 0 : -1}
51
+ >
52
+ ${this.icon
53
+ ? html`<wc-icon class="icon" name=${this.icon}></wc-icon>`
54
+ : ''}
55
+ <span class="label"><slot></slot></span>
56
+ </button>`;
57
+ }
58
+ }
@@ -0,0 +1,119 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: inline-block;
7
+ --_fab-container-color: var(--color-primary-container);
8
+ --_fab-icon-color: var(--color-on-primary-container);
9
+ --_fab-open-color: var(--color-primary);
10
+ --_fab-open-icon-color: var(--color-on-primary);
11
+ }
12
+
13
+ :host([color='secondary']) {
14
+ --_fab-container-color: var(--color-secondary-container);
15
+ --_fab-icon-color: var(--color-on-secondary-container);
16
+ --_fab-open-color: var(--color-secondary);
17
+ --_fab-open-icon-color: var(--color-on-secondary);
18
+ }
19
+
20
+ :host([color='tertiary']) {
21
+ --_fab-container-color: var(--color-tertiary-container);
22
+ --_fab-icon-color: var(--color-on-tertiary-container);
23
+ --_fab-open-color: var(--color-tertiary);
24
+ --_fab-open-icon-color: var(--color-on-tertiary);
25
+ }
26
+
27
+ .fab-menu {
28
+ display: flex;
29
+ flex-direction: column;
30
+ align-items: flex-end;
31
+ gap: var(--spacing-100);
32
+ }
33
+
34
+ :host([align='start']) .fab-menu {
35
+ align-items: flex-start;
36
+ }
37
+
38
+ .items {
39
+ display: flex;
40
+ flex-direction: column;
41
+ align-items: inherit;
42
+ gap: var(--spacing-050);
43
+ }
44
+
45
+ // Closed: an ordinary FAB. Open: it shrinks into a round close button.
46
+ .fab {
47
+ @include mixin.reset-button-styles;
48
+ position: relative;
49
+ display: inline-flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ width: 3.5rem;
53
+ height: 3.5rem;
54
+ margin-inline: 0;
55
+ border-radius: var(--shape-corner-large);
56
+ background-color: var(--_fab-container-color);
57
+ box-shadow: var(--elevation-level3);
58
+ cursor: pointer;
59
+ transition:
60
+ width var(--motion-spring-fast-spatial-duration)
61
+ var(--motion-spring-fast-spatial-easing),
62
+ height var(--motion-spring-fast-spatial-duration)
63
+ var(--motion-spring-fast-spatial-easing),
64
+ margin var(--motion-spring-fast-spatial-duration)
65
+ var(--motion-spring-fast-spatial-easing),
66
+ border-radius var(--motion-spring-fast-spatial-duration)
67
+ var(--motion-spring-fast-spatial-easing),
68
+ background-color var(--motion-spring-fast-effects-duration)
69
+ var(--motion-spring-fast-effects-easing);
70
+
71
+ &:focus-visible {
72
+ outline: 3px solid var(--color-secondary);
73
+ outline-offset: 2px;
74
+ }
75
+
76
+ .icon {
77
+ position: absolute;
78
+ --icon-size: 1.5rem;
79
+ transition:
80
+ opacity var(--motion-spring-fast-effects-duration)
81
+ var(--motion-spring-fast-effects-easing),
82
+ rotate var(--motion-spring-default-spatial-duration)
83
+ var(--motion-spring-default-spatial-easing);
84
+ }
85
+
86
+ .icon-open {
87
+ --icon-color: var(--_fab-icon-color);
88
+ }
89
+
90
+ .icon-close {
91
+ --icon-color: var(--_fab-open-icon-color);
92
+ --icon-size: 1.25rem;
93
+ opacity: 0;
94
+ rotate: -90deg;
95
+ }
96
+ }
97
+
98
+ .fab-menu.open .fab {
99
+ width: 3.5rem;
100
+ height: 3.5rem;
101
+ border-radius: var(--shape-corner-full);
102
+ background-color: var(--_fab-open-color);
103
+
104
+ .icon-open {
105
+ opacity: 0;
106
+ rotate: 90deg;
107
+ }
108
+
109
+ .icon-close {
110
+ opacity: 1;
111
+ rotate: 0deg;
112
+ }
113
+ }
114
+
115
+ @media (forced-colors: active) {
116
+ .fab {
117
+ border: 1px solid ButtonText;
118
+ }
119
+ }
@@ -0,0 +1,193 @@
1
+ import { html, LitElement } from 'lit';
2
+ import { property, query } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import styles from './fab-menu.scss';
5
+ import { I18nController } from '@/__internal/i18n/i18n-controller.js';
6
+ import { FabMenuItem } from './fab-menu-item.js';
7
+
8
+ let fabMenuCount = 0;
9
+
10
+ /**
11
+ * @label FAB Menu
12
+ * @tag wc-fab-menu
13
+ * @rawTag fab-menu
14
+ * @summary A floating action button that opens into a short list of related actions.
15
+ * @overview
16
+ * <p>The M3 Expressive FAB menu. Put two to six <code>wc-fab-menu-item</code> elements inside.
17
+ * Pressing the FAB morphs it into a round close button and springs the items in, nearest first.
18
+ * Choosing an item, pressing Escape or clicking outside closes the menu.</p>
19
+ * <p><code>icon</code> sets the FAB's icon (<code>add</code> by default) and <code>label</code> its
20
+ * accessible name. <code>color</code> picks the color set: <code>primary</code> (default),
21
+ * <code>secondary</code> or <code>tertiary</code>. Items line up at the end of the FAB, or at its
22
+ * start with <code>align="start"</code>.</p>
23
+ * <p>The FAB is a button with <code>aria-expanded</code>. When the menu opens from the keyboard,
24
+ * focus moves to the first item; closing returns it to the FAB.</p>
25
+ * @tags controls
26
+ *
27
+ * @fires {CustomEvent<{open: boolean}>} toggle - Dispatched when the menu opens or closes.
28
+ *
29
+ * @example
30
+ * ```html
31
+ * <wc-fab-menu label="Create">
32
+ * <wc-fab-menu-item icon="edit">Note</wc-fab-menu-item>
33
+ * <wc-fab-menu-item icon="checklist">List</wc-fab-menu-item>
34
+ * <wc-fab-menu-item icon="image">Image</wc-fab-menu-item>
35
+ * </wc-fab-menu>
36
+ * ```
37
+ */
38
+ export class FabMenu extends LitElement {
39
+ static styles = [styles];
40
+
41
+ static Item = FabMenuItem;
42
+
43
+ /** Whether the menu is open. */
44
+ @property({ type: Boolean, reflect: true }) open = false;
45
+
46
+ /** Icon of the closed FAB. */
47
+ @property({ type: String }) icon = 'add';
48
+
49
+ /** Accessible name of the FAB. Defaults to "Open menu". */
50
+ @property({ type: String }) label?: string;
51
+
52
+ /** Color set of the FAB and the items. */
53
+ @property({ type: String, reflect: true }) color:
54
+ | 'primary'
55
+ | 'secondary'
56
+ | 'tertiary' = 'primary';
57
+
58
+ /** Which edge the items line up with. */
59
+ @property({ type: String, reflect: true }) align: 'start' | 'end' = 'end';
60
+
61
+ @query('.fab') private _fab?: HTMLButtonElement;
62
+
63
+ private readonly _i18n = new I18nController(this);
64
+
65
+ private readonly _listId = `wc-fab-menu-${(fabMenuCount += 1)}`;
66
+
67
+ /** Whether the last open came from the keyboard, so focus moves into the list. */
68
+ private _openedByKeyboard = false;
69
+
70
+ override disconnectedCallback() {
71
+ super.disconnectedCallback();
72
+ document.removeEventListener('pointerdown', this._onOutside, true);
73
+ }
74
+
75
+ /** Opens the menu. */
76
+ show() {
77
+ this._setOpen(true);
78
+ }
79
+
80
+ /** Closes the menu. */
81
+ hide() {
82
+ this._setOpen(false);
83
+ }
84
+
85
+ private _items(): FabMenuItem[] {
86
+ return Array.from(this.children).filter(
87
+ (el): el is FabMenuItem => el instanceof FabMenuItem,
88
+ );
89
+ }
90
+
91
+ private _setOpen(open: boolean) {
92
+ if (this.open === open) return;
93
+ this.open = open;
94
+ this.dispatchEvent(
95
+ new CustomEvent('toggle', {
96
+ detail: { open },
97
+ bubbles: true,
98
+ composed: true,
99
+ }),
100
+ );
101
+ }
102
+
103
+ protected override updated(changed: Map<string, unknown>) {
104
+ if (changed.has('open') || changed.has('color')) this._syncItems();
105
+ if (!changed.has('open')) return;
106
+ if (this.open) {
107
+ document.addEventListener('pointerdown', this._onOutside, true);
108
+ if (this._openedByKeyboard) {
109
+ this._items()
110
+ .find(item => !item.disabled)
111
+ ?.focus();
112
+ }
113
+ } else {
114
+ document.removeEventListener('pointerdown', this._onOutside, true);
115
+ if (changed.get('open') && this.matches(':focus-within')) {
116
+ this._fab?.focus();
117
+ }
118
+ }
119
+ }
120
+
121
+ /** Tells each item whether it is shown, its stagger delay, and the color set. */
122
+ private _syncItems() {
123
+ const items = this._items();
124
+ items.forEach((item, index) => {
125
+ Object.assign(item, { shown: this.open, color: this.color });
126
+ // The item nearest the FAB (the last one) moves first.
127
+ item.style.setProperty(
128
+ '--_fab-menu-delay',
129
+ `${(items.length - 1 - index) * 30}ms`,
130
+ );
131
+ });
132
+ }
133
+
134
+ private _onOutside = (event: PointerEvent) => {
135
+ if (!event.composedPath().includes(this)) this.hide();
136
+ };
137
+
138
+ private _onFabClick(event: MouseEvent) {
139
+ // A click with no pointer position came from the keyboard (Enter or Space).
140
+ this._openedByKeyboard = event.detail === 0;
141
+ this._setOpen(!this.open);
142
+ }
143
+
144
+ private _onKeyDown(event: KeyboardEvent) {
145
+ if (event.key === 'Escape' && this.open) {
146
+ event.stopPropagation();
147
+ this.hide();
148
+ this._fab?.focus();
149
+ }
150
+ }
151
+
152
+ private _onItemClick(event: Event) {
153
+ const item = event
154
+ .composedPath()
155
+ .find((el): el is FabMenuItem => el instanceof FabMenuItem);
156
+ if (item && !item.disabled) this.hide();
157
+ }
158
+
159
+ override render() {
160
+ const name = this.label || this._i18n.t('openMenu');
161
+ // Clicks on the group bubble up from the items' own buttons, which handle the keyboard.
162
+ /* eslint-disable lit-a11y/click-events-have-key-events */
163
+ return html`
164
+ <div
165
+ class=${classMap({ 'fab-menu': true, open: this.open })}
166
+ @keydown=${this._onKeyDown}
167
+ >
168
+ <div
169
+ class="items"
170
+ id=${this._listId}
171
+ role="group"
172
+ aria-label=${name}
173
+ ?inert=${!this.open}
174
+ @click=${this._onItemClick}
175
+ >
176
+ <slot @slotchange=${this._syncItems}></slot>
177
+ </div>
178
+ <button
179
+ class="fab"
180
+ type="button"
181
+ aria-label=${this.open ? this._i18n.t('close') : name}
182
+ aria-expanded=${this.open ? 'true' : 'false'}
183
+ aria-controls=${this._listId}
184
+ @click=${this._onFabClick}
185
+ >
186
+ <wc-icon class="icon icon-open" name=${this.icon}></wc-icon>
187
+ <wc-icon class="icon icon-close" name="close"></wc-icon>
188
+ </button>
189
+ </div>
190
+ `;
191
+ /* eslint-enable lit-a11y/click-events-have-key-events */
192
+ }
193
+ }
@@ -0,0 +1,2 @@
1
+ export { FabMenu } from './fab-menu.js';
2
+ export { FabMenuItem } from './fab-menu-item.js';
@@ -229,7 +229,7 @@
229
229
  --_container-color: var(--field-container-color, transparent);
230
230
  --_outline-width: var(--field-outline-width, 0.0625rem);
231
231
  --_label-text-color: var(--field-label-text-color, var(--color-on-surface-variant));
232
- --_label-motion: var(--duration-short3, 150ms) var(--easing-emphasized, cubic-bezier(0.2, 0, 0, 1));
232
+ --_label-motion: var(--motion-spring-fast-spatial-duration) var(--motion-spring-fast-spatial-easing);
233
233
  // The notch starts 12px in and pads the label by 4px each side, so the floating label lines
234
234
  // up with the text at 16px. It is never narrower than the start corners.
235
235
  --_notch-start: max(
@@ -88,8 +88,8 @@
88
88
  cursor: pointer;
89
89
  outline: none;
90
90
  transition:
91
- background-color 0.15s,
92
- border-color 0.15s;
91
+ background-color var(--motion-spring-fast-effects-duration) var(--motion-spring-fast-effects-easing),
92
+ border-color var(--motion-spring-fast-effects-duration) var(--motion-spring-fast-effects-easing);
93
93
 
94
94
  @include mixin.get-typography-not-important(body-medium);
95
95
 
@@ -20,8 +20,8 @@
20
20
  */
21
21
  --hover-card-width: 20rem;
22
22
 
23
- --_hover-card-duration: var(--duration-short2, 0.1s);
24
- --_hover-card-easing: var(--easing-standard, ease-in-out);
23
+ --_hover-card-duration: var(--motion-spring-fast-effects-duration, 0.1s);
24
+ --_hover-card-easing: var(--motion-spring-fast-effects-easing, ease-in-out);
25
25
  }
26
26
 
27
27
  .card {
@@ -58,6 +58,13 @@
58
58
  .card:popover-open {
59
59
  opacity: 1;
60
60
  transform: none;
61
+ // M3 Expressive: it grows open on the default spatial spring and fades out without overshoot.
62
+ transition-duration: var(--_hover-card-duration),
63
+ var(--motion-spring-default-spatial-duration, 0.1s), var(--_hover-card-duration),
64
+ var(--_hover-card-duration);
65
+ transition-timing-function: var(--_hover-card-easing),
66
+ var(--motion-spring-default-spatial-easing, ease-out), var(--_hover-card-easing),
67
+ var(--_hover-card-easing);
61
68
 
62
69
  @starting-style {
63
70
  opacity: 0;
package/src/index.ts CHANGED
@@ -11,6 +11,8 @@ export { default as ButtonGroup } from './button/button-group/button-group.js';
11
11
  export { SegmentedButton } from './segmented-button/segmented-button.js';
12
12
  export { SegmentedButtonGroup } from './segmented-button/segmented-button-group.js';
13
13
  export { SplitButton } from './split-button/split-button.js';
14
+ export { FabMenu } from './fab-menu/fab-menu.js';
15
+ export { FabMenuItem } from './fab-menu/fab-menu-item.js';
14
16
  export { DropdownButton } from './dropdown-button/dropdown-button.js';
15
17
  export { Divider } from './divider/divider.js';
16
18
  export { Elevation } from './elevation/elevation.js';
@@ -30,6 +32,7 @@ export { NotificationManager } from './notification-manager/notification-manager
30
32
  export { Tag } from './chip/tag/tag.js';
31
33
  export { LinearProgress } from './progress/linear-progress/linear-progress.js';
32
34
  export { CircularProgress } from './progress/circular-progress/circular-progress.js';
35
+ export { LoadingIndicator } from './loading-indicator/loading-indicator.js';
33
36
  export { Skeleton } from './skeleton/skeleton.js';
34
37
  export { Field } from './field/field.js';
35
38
  export { Input } from './input/input.js';
@@ -42,8 +42,8 @@
42
42
 
43
43
  .editable .text {
44
44
  cursor: text;
45
- transition: background-color var(--duration-short2, 100ms)
46
- var(--easing-standard, ease);
45
+ transition: background-color var(--motion-spring-fast-effects-duration)
46
+ var(--motion-spring-fast-effects-easing);
47
47
 
48
48
  &:hover {
49
49
  background-color: var(--_hover-color);
@@ -101,7 +101,8 @@
101
101
  }
102
102
 
103
103
  .expander-icon {
104
- transition: transform var(--duration-short4) var(--easing-standard);
104
+ transition: transform var(--motion-spring-fast-spatial-duration)
105
+ var(--motion-spring-fast-spatial-easing);
105
106
  }
106
107
 
107
108
  // The collapsed arrow points to the end side: mirrored in right-to-left.
package/src/loader.ts CHANGED
@@ -13,6 +13,8 @@ import ButtonGroup from '@/button/button-group/button-group.js';
13
13
  import { SegmentedButton } from '@/segmented-button/segmented-button.js';
14
14
  import { SegmentedButtonGroup } from '@/segmented-button/segmented-button-group.js';
15
15
  import { SplitButton } from '@/split-button/split-button.js';
16
+ import { FabMenu } from '@/fab-menu/fab-menu.js';
17
+ import { FabMenuItem } from '@/fab-menu/fab-menu-item.js';
16
18
  import { DropdownButton } from '@/dropdown-button/dropdown-button.js';
17
19
  import { Divider } from '@/divider/divider.js';
18
20
  import { Elevation } from '@/elevation/elevation.js';
@@ -33,6 +35,7 @@ import { NotificationManager } from '@/notification-manager/notification-manager
33
35
  import { Tag } from '@/chip/tag/tag.js';
34
36
  import { LinearProgress } from '@/progress/linear-progress/linear-progress.js';
35
37
  import { CircularProgress } from '@/progress/circular-progress/circular-progress.js';
38
+ import { LoadingIndicator } from '@/loading-indicator/loading-indicator.js';
36
39
  import { Skeleton } from '@/skeleton/skeleton.js';
37
40
  import { Field } from '@/field/field.js';
38
41
  import { Input } from '@/input/input.js';
@@ -214,6 +217,12 @@ const loaderConfig: LoaderConfig = {
214
217
  'wc-split-button': {
215
218
  CustomElementClass: SplitButton,
216
219
  },
220
+ 'wc-fab-menu': {
221
+ CustomElementClass: FabMenu,
222
+ },
223
+ 'wc-fab-menu-item': {
224
+ CustomElementClass: FabMenuItem,
225
+ },
217
226
  'wc-dropdown-button': {
218
227
  CustomElementClass: DropdownButton,
219
228
  },
@@ -277,6 +286,9 @@ const loaderConfig: LoaderConfig = {
277
286
  'wc-circular-progress': {
278
287
  CustomElementClass: CircularProgress,
279
288
  },
289
+ 'wc-loading-indicator': {
290
+ CustomElementClass: LoadingIndicator,
291
+ },
280
292
  'wc-skeleton': {
281
293
  CustomElementClass: Skeleton,
282
294
  },
@@ -0,0 +1 @@
1
+ export { LoadingIndicator } from './loading-indicator.js';