@redvars/peacock 4.7.0 → 4.8.1

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 (300) 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 +7 -6
  34. package/dist/checkbox.js.map +1 -1
  35. package/dist/chip.js +34 -8
  36. package/dist/chip.js.map +1 -1
  37. package/dist/circular-progress.js +46 -15
  38. package/dist/circular-progress.js.map +1 -1
  39. package/dist/code-highlighter.js +1 -1
  40. package/dist/color-picker.js +1 -1
  41. package/dist/command-palette.js +2 -2
  42. package/dist/comment-composer.js +5 -5
  43. package/dist/condition-builder.js +1 -1
  44. package/dist/{condition-group-base-NcvOY-Zv.js → condition-group-base-DS76sprm.js} +2 -2
  45. package/dist/{condition-group-base-NcvOY-Zv.js.map → condition-group-base-DS76sprm.js.map} +1 -1
  46. package/dist/confirm-dialog.js +2 -2
  47. package/dist/custom-elements-jsdocs.json +302 -10
  48. package/dist/custom-elements.json +1209 -16
  49. package/dist/date-picker.js +51 -1
  50. package/dist/date-picker.js.map +1 -1
  51. package/dist/dependency-map.js +2 -2
  52. package/dist/{diagram-hv7hCgzx.js → diagram-DFO-X7yq.js} +2 -2
  53. package/dist/{diagram-hv7hCgzx.js.map → diagram-DFO-X7yq.js.map} +1 -1
  54. package/dist/diagram.js +1 -1
  55. package/dist/discussion.js +3 -3
  56. package/dist/{document-editor-CZBlz3ai.js → document-editor-W4pXGCEL.js} +19 -7
  57. package/dist/document-editor-W4pXGCEL.js.map +1 -0
  58. package/dist/document-editor.js +3 -3
  59. package/dist/dropdown-button.js +1 -1
  60. package/dist/erd.js +4 -4
  61. package/dist/fab-menu-item.js +189 -0
  62. package/dist/fab-menu-item.js.map +1 -0
  63. package/dist/fab-menu.js +329 -0
  64. package/dist/fab-menu.js.map +1 -0
  65. package/dist/fab.js +28 -17
  66. package/dist/fab.js.map +1 -1
  67. package/dist/field.js +1 -1
  68. package/dist/file-upload.js +1 -1
  69. package/dist/flow.js +1 -1
  70. package/dist/haptics-CAaQ2E-9.js +29 -0
  71. package/dist/haptics-CAaQ2E-9.js.map +1 -0
  72. package/dist/hover-card.js +5 -3
  73. package/dist/hover-card.js.map +1 -1
  74. package/dist/html-editor.js +4 -4
  75. package/dist/icon-button.js +26 -25
  76. package/dist/icon-button.js.map +1 -1
  77. package/dist/{index-DK3fREuj.js → index-BBxpsqx8.js} +4 -4
  78. package/dist/{index-DK3fREuj.js.map → index-BBxpsqx8.js.map} +1 -1
  79. package/dist/{index-CTEt3LtO.js → index-CDtKB0In.js} +4 -4
  80. package/dist/{index-CTEt3LtO.js.map → index-CDtKB0In.js.map} +1 -1
  81. package/dist/{index-Bag4vtx-.js → index-Tb0ky27z.js} +3 -3
  82. package/dist/{index-Bag4vtx-.js.map → index-Tb0ky27z.js.map} +1 -1
  83. package/dist/index.js +17 -13
  84. package/dist/index.js.map +1 -1
  85. package/dist/{indicator-navigation-item-BG0TrdDE.js → indicator-navigation-item-aZsm-RpR.js} +17 -5
  86. package/dist/{indicator-navigation-item-BG0TrdDE.js.map → indicator-navigation-item-aZsm-RpR.js.map} +1 -1
  87. package/dist/inline-edit.js +1 -1
  88. package/dist/json-viewer.js +1 -1
  89. package/dist/linear-progress.js +51 -4
  90. package/dist/linear-progress.js.map +1 -1
  91. package/dist/link-button.js +26 -25
  92. package/dist/link-button.js.map +1 -1
  93. package/dist/loader-full.js +10 -6
  94. package/dist/loader-full.js.map +1 -1
  95. package/dist/loader.js +19 -6
  96. package/dist/loader.js.map +1 -1
  97. package/dist/loading-indicator.js +301 -0
  98. package/dist/loading-indicator.js.map +1 -0
  99. package/dist/markdown-editor.js +4 -4
  100. package/dist/mention-input.js +1 -1
  101. package/dist/menu.js +8 -6
  102. package/dist/menu.js.map +1 -1
  103. package/dist/{modal-Dds0rXAG.js → modal-ClWCCbxD.js} +7 -5
  104. package/dist/{modal-Dds0rXAG.js.map → modal-ClWCCbxD.js.map} +1 -1
  105. package/dist/modal.js +14 -3
  106. package/dist/modal.js.map +1 -1
  107. package/dist/navigation-bar-item.js +1 -1
  108. package/dist/navigation-bar.js +1 -1
  109. package/dist/navigation-drawer-group.js +1 -1
  110. package/dist/navigation-drawer.js +1 -1
  111. package/dist/navigation-rail-item.js +1 -1
  112. package/dist/navigation-rail.js +1 -1
  113. package/dist/notification-center.js +1 -1
  114. package/dist/number-counter.js +1 -1
  115. package/dist/{overlay-controller-BOk-kfil.js → overlay-controller-iVaiUqos.js} +20 -10
  116. package/dist/{overlay-controller-BOk-kfil.js.map → overlay-controller-iVaiUqos.js.map} +1 -1
  117. package/dist/pagination.js +1 -1
  118. package/dist/popover-content.js +4 -2
  119. package/dist/popover-content.js.map +1 -1
  120. package/dist/popover.js +1 -1
  121. package/dist/{progress-base-BhJK__VP.js → progress-base-BeLu9-Tq.js} +13 -1
  122. package/dist/progress-base-BeLu9-Tq.js.map +1 -0
  123. package/dist/prompt-input.js +5 -5
  124. package/dist/radio.js +6 -4
  125. package/dist/radio.js.map +1 -1
  126. package/dist/resizable-panels.js +1 -1
  127. package/dist/{rich-text-input-base-SrsPvc-j.js → rich-text-input-base-BCmnkpuV.js} +2 -2
  128. package/dist/{rich-text-input-base-SrsPvc-j.js.map → rich-text-input-base-BCmnkpuV.js.map} +1 -1
  129. package/dist/scroll-area.js +1 -1
  130. package/dist/search.js +1 -1
  131. package/dist/segmented-button.js +7 -2
  132. package/dist/segmented-button.js.map +1 -1
  133. package/dist/select.js +1 -1
  134. package/dist/side-sheet.js +3 -3
  135. package/dist/site-header.js +3 -3
  136. package/dist/site-nav-menu.js +1 -1
  137. package/dist/{slash-controller-DwL0nkqv.js → slash-controller-BFhzSjiR.js} +2 -2
  138. package/dist/{slash-controller-DwL0nkqv.js.map → slash-controller-BFhzSjiR.js.map} +1 -1
  139. package/dist/slider.js +169 -69
  140. package/dist/slider.js.map +1 -1
  141. package/dist/snackbar.js +2 -2
  142. package/dist/sparkline.js +2 -2
  143. package/dist/split-button.js +1 -1
  144. package/dist/src/__internal/utils/haptics.d.ts +7 -0
  145. package/dist/src/button/button-group/button-group.d.ts +12 -0
  146. package/dist/src/button/fab/fab.d.ts +1 -0
  147. package/dist/src/carousel/carousel.d.ts +22 -0
  148. package/dist/src/chip/chip/chip.d.ts +4 -0
  149. package/dist/src/date-picker/date-picker.d.ts +6 -1
  150. package/dist/src/document-editor/document-editor.d.ts +2 -0
  151. package/dist/src/fab-menu/fab-menu-item.d.ts +30 -0
  152. package/dist/src/fab-menu/fab-menu.d.ts +64 -0
  153. package/dist/src/fab-menu/index.d.ts +2 -0
  154. package/dist/src/index.d.ts +3 -0
  155. package/dist/src/loading-indicator/index.d.ts +1 -0
  156. package/dist/src/loading-indicator/loading-indicator.d.ts +44 -0
  157. package/dist/src/loading-indicator/shapes.d.ts +29 -0
  158. package/dist/src/modal/modal.d.ts +4 -0
  159. package/dist/src/progress/circular-progress/circular-progress.d.ts +3 -1
  160. package/dist/src/progress/linear-progress/linear-progress.d.ts +2 -1
  161. package/dist/src/progress/progress-base.d.ts +7 -0
  162. package/dist/src/slider/slider.d.ts +23 -3
  163. package/dist/src/toolbar/toolbar.d.ts +20 -0
  164. package/dist/step.js +1 -1
  165. package/dist/switch.js +7 -3
  166. package/dist/switch.js.map +1 -1
  167. package/dist/tab-group.js +13 -2
  168. package/dist/tab-group.js.map +1 -1
  169. package/dist/tab-panel.js +26 -0
  170. package/dist/tab-panel.js.map +1 -1
  171. package/dist/tab.js +23 -5
  172. package/dist/tab.js.map +1 -1
  173. package/dist/table.js +4 -4
  174. package/dist/tag.js +2 -1
  175. package/dist/tag.js.map +1 -1
  176. package/dist/test/button-group-press.test.d.ts +1 -0
  177. package/dist/test/fab-menu.test.d.ts +1 -0
  178. package/dist/test/haptics.test.d.ts +1 -0
  179. package/dist/test/loading-indicator.test.d.ts +1 -0
  180. package/dist/{toggle-base-DP3PSXbf.js → toggle-base-CVO9YntI.js} +3 -1
  181. package/dist/toggle-base-CVO9YntI.js.map +1 -0
  182. package/dist/toolbar.js +102 -0
  183. package/dist/toolbar.js.map +1 -1
  184. package/dist/tooltip.js +5 -2
  185. package/dist/tooltip.js.map +1 -1
  186. package/dist/tour.js +3 -3
  187. package/dist/tree-chart.js +3 -3
  188. package/dist/tree-item.js +1 -1
  189. package/dist/tsconfig.tsbuildinfo +1 -1
  190. package/dist/{video-DgtGGvrk.js → video-DSQ07o3h.js} +2 -2
  191. package/dist/{video-DgtGGvrk.js.map → video-DSQ07o3h.js.map} +1 -1
  192. package/dist/video.js +1 -1
  193. package/dist/workflow.js +5 -5
  194. package/package.json +1 -1
  195. package/scss/tokens.css +364 -0
  196. package/src/__internal/chart/chart-base.scss +4 -2
  197. package/src/__internal/controllers/overlay-controller.ts +19 -9
  198. package/src/__internal/rich-text/editor-chrome.scss +2 -1
  199. package/src/__internal/toggle-base.ts +2 -0
  200. package/src/__internal/utils/haptics.ts +32 -0
  201. package/src/accordion/accordion-item.scss +10 -6
  202. package/src/app-bar/app-bar.scss +2 -1
  203. package/src/app-shell/app-shell.scss +2 -2
  204. package/src/bottom-sheet/bottom-sheet.scss +4 -2
  205. package/src/breadcrumb/breadcrumb-item/breadcrumb-item.scss +4 -2
  206. package/src/button/button/button-base.scss +14 -12
  207. package/src/button/button/button-layers.scss +27 -5
  208. package/src/button/button-group/button-group.scss +6 -0
  209. package/src/button/button-group/button-group.ts +105 -0
  210. package/src/button/fab/fab-sizes.scss +2 -0
  211. package/src/button/fab/fab.scss +32 -17
  212. package/src/button/fab/fab.ts +1 -0
  213. package/src/calendar/calendar-column-view.scss +3 -3
  214. package/src/calendar/calendar-month-view.scss +3 -3
  215. package/src/calendar-timeline/calendar-timeline.scss +6 -3
  216. package/src/card/card.scss +2 -1
  217. package/src/carousel/carousel.scss +71 -2
  218. package/src/carousel/carousel.ts +159 -7
  219. package/src/chart-pie/chart-pie.scss +4 -2
  220. package/src/checkbox/checkbox.scss +13 -7
  221. package/src/chip/chip/chip.scss +41 -8
  222. package/src/chip/chip/chip.ts +4 -0
  223. package/src/chip/tag/tag.scss +2 -1
  224. package/src/code-highlighter/code-highlighter.scss +2 -1
  225. package/src/color-picker/color-picker.scss +1 -1
  226. package/src/comment-composer/comment-composer.scss +2 -1
  227. package/src/components.manifest.json +21 -0
  228. package/src/condition-builder/condition-group-base.scss +1 -1
  229. package/src/date-picker/date-picker.scss +27 -0
  230. package/src/date-picker/date-picker.ts +27 -1
  231. package/src/dependency-map/dependency-map.scss +4 -2
  232. package/src/diagram/diagram.scss +2 -1
  233. package/src/document-editor/document-editor.scss +1 -1
  234. package/src/document-editor/document-editor.ts +17 -0
  235. package/src/dropdown-button/dropdown-button.scss +2 -1
  236. package/src/erd/erd.scss +8 -4
  237. package/src/fab-menu/fab-menu-item.scss +99 -0
  238. package/src/fab-menu/fab-menu-item.ts +58 -0
  239. package/src/fab-menu/fab-menu.scss +119 -0
  240. package/src/fab-menu/fab-menu.ts +195 -0
  241. package/src/fab-menu/index.ts +2 -0
  242. package/src/field/field.scss +1 -1
  243. package/src/file-upload/file-upload.scss +2 -2
  244. package/src/hover-card/hover-card.scss +9 -2
  245. package/src/index.ts +3 -0
  246. package/src/inline-edit/inline-edit.scss +2 -2
  247. package/src/json-viewer/json-viewer.scss +2 -1
  248. package/src/loader.ts +12 -0
  249. package/src/loading-indicator/index.ts +1 -0
  250. package/src/loading-indicator/loading-indicator.scss +52 -0
  251. package/src/loading-indicator/loading-indicator.ts +164 -0
  252. package/src/loading-indicator/shapes.ts +104 -0
  253. package/src/menu/menu/menu.scss +10 -6
  254. package/src/modal/modal.scss +8 -4
  255. package/src/modal/modal.ts +14 -1
  256. package/src/navigation-drawer/navigation-drawer-group.scss +2 -2
  257. package/src/navigation-drawer/navigation-drawer.scss +3 -2
  258. package/src/navigation-rail/navigation-rail-item.scss +27 -5
  259. package/src/number-counter/number-counter.scss +1 -1
  260. package/src/pagination/pagination.scss +2 -1
  261. package/src/popover/popover-content.scss +7 -2
  262. package/src/progress/circular-progress/circular-progress.scss +3 -2
  263. package/src/progress/circular-progress/circular-progress.ts +43 -12
  264. package/src/progress/linear-progress/linear-progress.scss +70 -2
  265. package/src/progress/linear-progress/linear-progress.ts +4 -1
  266. package/src/progress/progress-base.ts +11 -0
  267. package/src/prompt-input/prompt-input.scss +2 -1
  268. package/src/radio/radio.scss +8 -4
  269. package/src/radio/radio.ts +2 -0
  270. package/src/resizable-panels/resizable-panels.scss +2 -1
  271. package/src/scroll-area/scroll-area.scss +2 -1
  272. package/src/search/search.scss +2 -1
  273. package/src/segmented-button/segmented-button.scss +8 -3
  274. package/src/select/select.scss +2 -1
  275. package/src/side-sheet/side-sheet.scss +4 -2
  276. package/src/site-header/site-header.scss +4 -4
  277. package/src/site-header/site-nav-menu.scss +2 -2
  278. package/src/slider/slider.scss +127 -64
  279. package/src/slider/slider.ts +80 -10
  280. package/src/snackbar/snackbar.scss +5 -2
  281. package/src/sparkline/sparkline.scss +6 -3
  282. package/src/split-button/split-button.scss +4 -2
  283. package/src/stepper/step.scss +2 -1
  284. package/src/switch/switch.scss +21 -2
  285. package/src/table/table.scss +8 -4
  286. package/src/tabs/tab-group.ts +12 -2
  287. package/src/tabs/tab-panel.scss +31 -0
  288. package/src/tabs/tab.scss +28 -17
  289. package/src/toolbar/toolbar-colors.scss +11 -0
  290. package/src/toolbar/toolbar.scss +28 -0
  291. package/src/toolbar/toolbar.ts +74 -1
  292. package/src/tooltip/tooltip.scss +9 -3
  293. package/src/tour/tour.scss +2 -2
  294. package/src/tree/tree-item.scss +2 -1
  295. package/src/tree-chart/tree-chart.scss +3 -3
  296. package/src/video/video.scss +2 -1
  297. package/src/workflow/workflow.scss +5 -5
  298. package/dist/document-editor-CZBlz3ai.js.map +0 -1
  299. package/dist/progress-base-BhJK__VP.js.map +0 -1
  300. package/dist/toggle-base-DP3PSXbf.js.map +0 -1
@@ -146,7 +146,8 @@ export class DatePicker extends LitElement {
146
146
  }
147
147
  }
148
148
 
149
- protected override updated() {
149
+ protected override updated(changed: Map<PropertyKey, unknown>) {
150
+ this.slideMonths(changed);
150
151
  if (this.focusAfterRender) {
151
152
  this.focusAfterRender = false;
152
153
  this.focusActive();
@@ -267,6 +268,31 @@ export class DatePicker extends LitElement {
267
268
  }
268
269
  }
269
270
 
271
+ /**
272
+ * M3 Expressive: when the shown month changes in the day view, the new month slides in from the
273
+ * side it comes from (`data-enter` on `.months`), like a tab panel.
274
+ */
275
+ private slideMonths(changed: Map<PropertyKey, unknown>) {
276
+ if (this.view !== 'day' || changed.has('view')) return;
277
+ if (!changed.has('viewYear') && !changed.has('viewMonth')) return;
278
+ const oldYear = changed.has('viewYear')
279
+ ? (changed.get('viewYear') as number | undefined)
280
+ : this.viewYear;
281
+ const oldMonth = changed.has('viewMonth')
282
+ ? (changed.get('viewMonth') as number | undefined)
283
+ : this.viewMonth;
284
+ if (!oldYear || !oldMonth) return;
285
+ const before = oldYear * 12 + oldMonth;
286
+ const now = this.viewYear * 12 + this.viewMonth;
287
+ if (before === now) return;
288
+ const months = this.renderRoot.querySelector<HTMLElement>('.months');
289
+ if (!months) return;
290
+ // Restart the animation when months change faster than it plays.
291
+ months.removeAttribute('data-enter');
292
+ months.getBoundingClientRect();
293
+ months.dataset.enter = now > before ? 'end' : 'start';
294
+ }
295
+
270
296
  private cycleView() {
271
297
  const next: Record<View, View> = {
272
298
  day: 'month',
@@ -141,7 +141,8 @@
141
141
  .dm-edge {
142
142
  --_edge: var(--dependency-map-edge-color);
143
143
 
144
- transition: opacity 200ms ease;
144
+ transition: opacity var(--motion-spring-fast-effects-duration)
145
+ var(--motion-spring-fast-effects-easing);
145
146
 
146
147
  &.is-warning {
147
148
  --_edge: var(--color-warning);
@@ -224,7 +225,8 @@
224
225
  transition:
225
226
  box-shadow 150ms ease,
226
227
  border-color 150ms ease,
227
- opacity 200ms ease;
228
+ opacity var(--motion-spring-fast-effects-duration)
229
+ var(--motion-spring-fast-effects-easing);
228
230
 
229
231
  &:hover {
230
232
  border-color: var(--color-outline);
@@ -136,7 +136,8 @@
136
136
  stroke-linecap: round;
137
137
  stroke-linejoin: round;
138
138
  pointer-events: none;
139
- transition: stroke-width 150ms ease;
139
+ transition: stroke-width var(--motion-spring-fast-effects-duration)
140
+ var(--motion-spring-fast-effects-easing);
140
141
 
141
142
  &.variant-dashed {
142
143
  stroke-dasharray: 6 6;
@@ -185,7 +185,7 @@
185
185
  border-radius: var(--shape-corner-medium);
186
186
  background: var(--color-surface);
187
187
  box-shadow: var(--elevation-level1);
188
- transition: top 0.15s ease;
188
+ transition: top var(--motion-spring-fast-spatial-duration) var(--motion-spring-fast-spatial-easing);
189
189
  }
190
190
 
191
191
  ::slotted([data-active]) {
@@ -388,6 +388,9 @@ export class DocumentEditor extends LitElement implements RichTextMentionHost {
388
388
 
389
389
  private _paginateFrame?: number;
390
390
 
391
+ /** A click below a page break is smooth-scrolling the caret into view. */
392
+ private _revealingCaret = false;
393
+
391
394
  private _changed = false;
392
395
 
393
396
  private _resizeObserver?: ResizeObserver;
@@ -981,6 +984,11 @@ export class DocumentEditor extends LitElement implements RichTextMentionHost {
981
984
  canvas.scrollTop = scroll.top * scroll.ratio;
982
985
  canvas.scrollLeft = scroll.left * scroll.ratio;
983
986
  }
987
+ // Setting scrollTop cancelled a caret reveal still scrolling: run it again at the new scale.
988
+ if (this._revealingCaret) {
989
+ this._revealingCaret = false;
990
+ requestAnimationFrame(() => this._revealCaret());
991
+ }
984
992
  this._scheduleCommentLayout();
985
993
  }
986
994
 
@@ -1087,6 +1095,15 @@ export class DocumentEditor extends LitElement implements RichTextMentionHost {
1087
1095
  const reduce = window.matchMedia?.(
1088
1096
  '(prefers-reduced-motion: reduce)',
1089
1097
  ).matches;
1098
+ // A zoom change while the smooth scroll runs resets scrollTop; it reveals the caret again.
1099
+ this._revealingCaret = true;
1100
+ canvas.addEventListener(
1101
+ 'scrollend',
1102
+ () => {
1103
+ this._revealingCaret = false;
1104
+ },
1105
+ { once: true },
1106
+ );
1090
1107
  canvas.scrollBy({
1091
1108
  top: caret.top - view.top - room,
1092
1109
  behavior: reduce ? 'auto' : 'smooth',
@@ -14,7 +14,8 @@
14
14
  }
15
15
 
16
16
  .dropdown-icon {
17
- transition: transform 200ms ease;
17
+ transition: transform var(--motion-spring-fast-spatial-duration)
18
+ var(--motion-spring-fast-spatial-easing);
18
19
  }
19
20
 
20
21
  .trigger-button.active .dropdown-icon {
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,195 @@
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
+ import { haptic } from '../__internal/utils/haptics.js';
8
+
9
+ let fabMenuCount = 0;
10
+
11
+ /**
12
+ * @label FAB Menu
13
+ * @tag wc-fab-menu
14
+ * @rawTag fab-menu
15
+ * @summary A floating action button that opens into a short list of related actions.
16
+ * @overview
17
+ * <p>The M3 Expressive FAB menu. Put two to six <code>wc-fab-menu-item</code> elements inside.
18
+ * Pressing the FAB morphs it into a round close button and springs the items in, nearest first.
19
+ * Choosing an item, pressing Escape or clicking outside closes the menu.</p>
20
+ * <p><code>icon</code> sets the FAB's icon (<code>add</code> by default) and <code>label</code> its
21
+ * accessible name. <code>color</code> picks the color set: <code>primary</code> (default),
22
+ * <code>secondary</code> or <code>tertiary</code>. Items line up at the end of the FAB, or at its
23
+ * start with <code>align="start"</code>.</p>
24
+ * <p>The FAB is a button with <code>aria-expanded</code>. When the menu opens from the keyboard,
25
+ * focus moves to the first item; closing returns it to the FAB.</p>
26
+ * @tags controls
27
+ *
28
+ * @fires {CustomEvent<{open: boolean}>} toggle - Dispatched when the menu opens or closes.
29
+ *
30
+ * @example
31
+ * ```html
32
+ * <wc-fab-menu label="Create">
33
+ * <wc-fab-menu-item icon="edit">Note</wc-fab-menu-item>
34
+ * <wc-fab-menu-item icon="checklist">List</wc-fab-menu-item>
35
+ * <wc-fab-menu-item icon="image">Image</wc-fab-menu-item>
36
+ * </wc-fab-menu>
37
+ * ```
38
+ */
39
+ export class FabMenu extends LitElement {
40
+ static styles = [styles];
41
+
42
+ static Item = FabMenuItem;
43
+
44
+ /** Whether the menu is open. */
45
+ @property({ type: Boolean, reflect: true }) open = false;
46
+
47
+ /** Icon of the closed FAB. */
48
+ @property({ type: String }) icon = 'add';
49
+
50
+ /** Accessible name of the FAB. Defaults to "Open menu". */
51
+ @property({ type: String }) label?: string;
52
+
53
+ /** Color set of the FAB and the items. */
54
+ @property({ type: String, reflect: true }) color:
55
+ | 'primary'
56
+ | 'secondary'
57
+ | 'tertiary' = 'primary';
58
+
59
+ /** Which edge the items line up with. */
60
+ @property({ type: String, reflect: true }) align: 'start' | 'end' = 'end';
61
+
62
+ @query('.fab') private _fab?: HTMLButtonElement;
63
+
64
+ private readonly _i18n = new I18nController(this);
65
+
66
+ private readonly _listId = `wc-fab-menu-${(fabMenuCount += 1)}`;
67
+
68
+ /** Whether the last open came from the keyboard, so focus moves into the list. */
69
+ private _openedByKeyboard = false;
70
+
71
+ override disconnectedCallback() {
72
+ super.disconnectedCallback();
73
+ document.removeEventListener('pointerdown', this._onOutside, true);
74
+ }
75
+
76
+ /** Opens the menu. */
77
+ show() {
78
+ this._setOpen(true);
79
+ }
80
+
81
+ /** Closes the menu. */
82
+ hide() {
83
+ this._setOpen(false);
84
+ }
85
+
86
+ private _items(): FabMenuItem[] {
87
+ return Array.from(this.children).filter(
88
+ (el): el is FabMenuItem => el instanceof FabMenuItem,
89
+ );
90
+ }
91
+
92
+ private _setOpen(open: boolean) {
93
+ if (this.open === open) return;
94
+ this.open = open;
95
+ if (open) haptic('confirm');
96
+ this.dispatchEvent(
97
+ new CustomEvent('toggle', {
98
+ detail: { open },
99
+ bubbles: true,
100
+ composed: true,
101
+ }),
102
+ );
103
+ }
104
+
105
+ protected override updated(changed: Map<string, unknown>) {
106
+ if (changed.has('open') || changed.has('color')) this._syncItems();
107
+ if (!changed.has('open')) return;
108
+ if (this.open) {
109
+ document.addEventListener('pointerdown', this._onOutside, true);
110
+ if (this._openedByKeyboard) {
111
+ this._items()
112
+ .find(item => !item.disabled)
113
+ ?.focus();
114
+ }
115
+ } else {
116
+ document.removeEventListener('pointerdown', this._onOutside, true);
117
+ if (changed.get('open') && this.matches(':focus-within')) {
118
+ this._fab?.focus();
119
+ }
120
+ }
121
+ }
122
+
123
+ /** Tells each item whether it is shown, its stagger delay, and the color set. */
124
+ private _syncItems() {
125
+ const items = this._items();
126
+ items.forEach((item, index) => {
127
+ Object.assign(item, { shown: this.open, color: this.color });
128
+ // The item nearest the FAB (the last one) moves first.
129
+ item.style.setProperty(
130
+ '--_fab-menu-delay',
131
+ `${(items.length - 1 - index) * 30}ms`,
132
+ );
133
+ });
134
+ }
135
+
136
+ private _onOutside = (event: PointerEvent) => {
137
+ if (!event.composedPath().includes(this)) this.hide();
138
+ };
139
+
140
+ private _onFabClick(event: MouseEvent) {
141
+ // A click with no pointer position came from the keyboard (Enter or Space).
142
+ this._openedByKeyboard = event.detail === 0;
143
+ this._setOpen(!this.open);
144
+ }
145
+
146
+ private _onKeyDown(event: KeyboardEvent) {
147
+ if (event.key === 'Escape' && this.open) {
148
+ event.stopPropagation();
149
+ this.hide();
150
+ this._fab?.focus();
151
+ }
152
+ }
153
+
154
+ private _onItemClick(event: Event) {
155
+ const item = event
156
+ .composedPath()
157
+ .find((el): el is FabMenuItem => el instanceof FabMenuItem);
158
+ if (item && !item.disabled) this.hide();
159
+ }
160
+
161
+ override render() {
162
+ const name = this.label || this._i18n.t('openMenu');
163
+ // Clicks on the group bubble up from the items' own buttons, which handle the keyboard.
164
+ /* eslint-disable lit-a11y/click-events-have-key-events */
165
+ return html`
166
+ <div
167
+ class=${classMap({ 'fab-menu': true, open: this.open })}
168
+ @keydown=${this._onKeyDown}
169
+ >
170
+ <div
171
+ class="items"
172
+ id=${this._listId}
173
+ role="group"
174
+ aria-label=${name}
175
+ ?inert=${!this.open}
176
+ @click=${this._onItemClick}
177
+ >
178
+ <slot @slotchange=${this._syncItems}></slot>
179
+ </div>
180
+ <button
181
+ class="fab"
182
+ type="button"
183
+ aria-label=${this.open ? this._i18n.t('close') : name}
184
+ aria-expanded=${this.open ? 'true' : 'false'}
185
+ aria-controls=${this._listId}
186
+ @click=${this._onFabClick}
187
+ >
188
+ <wc-icon class="icon icon-open" name=${this.icon}></wc-icon>
189
+ <wc-icon class="icon icon-close" name="close"></wc-icon>
190
+ </button>
191
+ </div>
192
+ `;
193
+ /* eslint-enable lit-a11y/click-events-have-key-events */
194
+ }
195
+ }
@@ -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;