@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
@@ -269,20 +269,32 @@ export class OverlayController implements ReactiveController {
269
269
  // After a press outside, focus belongs where the person pressed, not back on the opener.
270
270
  const lightDismissed = this.requestedReason === 'light-dismiss';
271
271
  this.requestedReason = null;
272
- if (
272
+ const returnTo =
273
273
  !lightDismissed &&
274
274
  (this.options.restoreFocus?.() ?? true) &&
275
275
  this.returnFocusTo?.isConnected &&
276
276
  this.focusIsInside()
277
- ) {
278
- this.returnFocusTo.focus();
279
- }
277
+ ? this.returnFocusTo
278
+ : null;
280
279
  this.returnFocusTo = null;
280
+ returnTo?.focus();
281
281
 
282
282
  const surface = this.options.surface();
283
283
  if (!surface) return;
284
- if (immediately) {
284
+ // A modal dialog keeps the page inert until it closes, so focus cannot return while it
285
+ // plays its exit animation: return it again once the dialog is gone.
286
+ const hide = () => {
285
287
  this.hideSurface(surface);
288
+ if (
289
+ returnTo?.isConnected &&
290
+ deepActiveElement() !== returnTo &&
291
+ this.focusIsInside()
292
+ ) {
293
+ returnTo.focus();
294
+ }
295
+ };
296
+ if (immediately) {
297
+ hide();
286
298
  return;
287
299
  }
288
300
  // Leave the top layer once exit animations finish, unless the overlay reopened meanwhile.
@@ -291,15 +303,13 @@ export class OverlayController implements ReactiveController {
291
303
  .filter((element): element is Element => !!element)
292
304
  .flatMap(element => element.getAnimations({ subtree: true }));
293
305
  if (animations.length === 0) {
294
- this.hideSurface(surface);
306
+ hide();
295
307
  return;
296
308
  }
297
309
  Promise.all(animations.map(animation => animation.finished))
298
310
  .catch(() => undefined)
299
311
  .then(() => {
300
- if (generation === this.exitGeneration && !this.shown) {
301
- this.hideSurface(surface);
302
- }
312
+ if (generation === this.exitGeneration && !this.shown) hide();
303
313
  });
304
314
  }
305
315
 
@@ -546,7 +546,8 @@
546
546
  gap: 2px;
547
547
  opacity: 0;
548
548
  pointer-events: none;
549
- transition: opacity 0.12s ease;
549
+ transition: opacity var(--motion-spring-fast-effects-duration)
550
+ var(--motion-spring-fast-effects-easing);
550
551
 
551
552
  &.visible {
552
553
  opacity: 1;
@@ -19,8 +19,10 @@
19
19
  );
20
20
  overflow: hidden; // clip children to border-radius
21
21
  transition:
22
- background-color var(--duration-medium1) var(--easing-standard),
23
- border-color var(--duration-medium1) var(--easing-standard);
22
+ background-color var(--motion-spring-fast-effects-duration)
23
+ var(--motion-spring-fast-effects-easing),
24
+ border-color var(--motion-spring-fast-effects-duration)
25
+ var(--motion-spring-fast-effects-easing);
24
26
 
25
27
  // ─── Header ────────────────────────────────────────────────────────────────
26
28
  // Row of [button: title + description] [actions] [toggle icon]. The button stays `position: static`
@@ -63,7 +65,8 @@
63
65
  inset: 0;
64
66
  background-color: var(--color-on-surface);
65
67
  opacity: 0;
66
- transition: opacity var(--duration-short4) var(--easing-standard);
68
+ transition: opacity var(--motion-spring-fast-effects-duration)
69
+ var(--motion-spring-fast-effects-easing);
67
70
  }
68
71
 
69
72
  &:not(:disabled):hover::before {
@@ -130,7 +133,8 @@
130
133
  --icon-size: 1.5rem;
131
134
  --icon-color: var(--color-on-surface-variant);
132
135
  flex-shrink: 0;
133
- transition: transform var(--duration-medium1) var(--easing-standard);
136
+ transition: transform var(--motion-spring-default-spatial-duration)
137
+ var(--motion-spring-default-spatial-easing);
134
138
  }
135
139
 
136
140
  // ─── Expandable Content ─────────────────────────────────────────────────────
@@ -138,8 +142,8 @@
138
142
  .panel-content {
139
143
  display: grid;
140
144
  grid-template-rows: 0fr;
141
- transition: grid-template-rows var(--duration-medium1)
142
- var(--easing-standard);
145
+ transition: grid-template-rows var(--motion-spring-default-spatial-duration)
146
+ var(--motion-spring-default-spatial-easing);
143
147
  }
144
148
 
145
149
  .content-inner {
@@ -28,7 +28,8 @@
28
28
  background-color: var(--_app-bar-container-color);
29
29
  pointer-events: none;
30
30
  z-index: 0;
31
- transition: background-color 200ms ease;
31
+ transition: background-color var(--motion-spring-fast-effects-duration)
32
+ var(--motion-spring-fast-effects-easing);
32
33
  }
33
34
 
34
35
  /* ---- Row layout ---- */
@@ -140,8 +140,8 @@
140
140
  --navigation-drawer-width: 100%;
141
141
 
142
142
  &[open] {
143
- animation: app-shell-slide-in var(--duration-medium2, 300ms)
144
- var(--easing-emphasized-decelerate, ease-out);
143
+ animation: app-shell-slide-in var(--motion-spring-slow-effects-duration)
144
+ var(--motion-spring-slow-effects-easing);
145
145
  }
146
146
 
147
147
  &:dir(rtl)[open] {
@@ -10,8 +10,10 @@
10
10
  --bottom-sheet-shape: var(--shape-corner-extra-large, 28px);
11
11
  --bottom-sheet-max-height: 90dvh;
12
12
  --bottom-sheet-handle-color: var(--color-on-surface-variant, #49454f);
13
- --bottom-sheet-transition-duration: var(--duration-medium2, 300ms);
14
- --bottom-sheet-transition-easing: var(--easing-standard, cubic-bezier(0.2, 0, 0, 1));
13
+ // M3 Expressive: the sheet slides on the slow effects spring. It is critically damped, because an
14
+ // overshoot would open a gap at the edge the sheet is attached to.
15
+ --bottom-sheet-transition-duration: var(--motion-spring-slow-effects-duration, 300ms);
16
+ --bottom-sheet-transition-easing: var(--motion-spring-slow-effects-easing, cubic-bezier(0.2, 0, 0, 1));
15
17
  }
16
18
 
17
19
  /* The native dialog: reset its UA box; the scrim and the sheet are drawn inside it. */
@@ -25,8 +25,10 @@
25
25
  text-decoration: none;
26
26
  border-radius: var(--border-radius-050);
27
27
  transition:
28
- color 0.2s ease,
29
- text-decoration 0.2s ease;
28
+ color var(--motion-spring-fast-effects-duration)
29
+ var(--motion-spring-fast-effects-easing),
30
+ text-decoration var(--motion-spring-fast-effects-duration)
31
+ var(--motion-spring-fast-effects-easing);
30
32
 
31
33
  &:hover {
32
34
  color: var(--color-primary);
@@ -12,21 +12,23 @@
12
12
  display: inline-flex;
13
13
  min-height: var(--button-height);
14
14
 
15
- --_button-container-shape-start-start: var(
16
- --button-container-shape-start-start,
17
- var(--button-container-shape)
15
+ // Corners are capped at half the height, so "full" resolves to a real radius
16
+ // and morphs smoothly to and from the square shapes instead of jumping.
17
+ --_button-container-shape-start-start: min(
18
+ var(--button-container-shape-start-start, var(--button-container-shape)),
19
+ var(--button-height, 19998px) / 2
18
20
  );
19
- --_button-container-shape-start-end: var(
20
- --button-container-shape-start-end,
21
- var(--button-container-shape)
21
+ --_button-container-shape-start-end: min(
22
+ var(--button-container-shape-start-end, var(--button-container-shape)),
23
+ var(--button-height, 19998px) / 2
22
24
  );
23
- --_button-container-shape-end-start: var(
24
- --button-container-shape-end-start,
25
- var(--button-container-shape)
25
+ --_button-container-shape-end-start: min(
26
+ var(--button-container-shape-end-start, var(--button-container-shape)),
27
+ var(--button-height, 19998px) / 2
26
28
  );
27
- --_button-container-shape-end-end: var(
28
- --button-container-shape-end-end,
29
- var(--button-container-shape)
29
+ --_button-container-shape-end-end: min(
30
+ var(--button-container-shape-end-end, var(--button-container-shape)),
31
+ var(--button-height, 19998px) / 2
30
32
  );
31
33
  --_button-container-shape-variant: var(
32
34
  --button-container-shape-variant
@@ -1,12 +1,33 @@
1
1
  @use '../../../scss/mixin';
2
2
 
3
3
  // Mixin for the shared transition logic
4
+ // Size and shape move on the fast spatial spring (with a little overshoot);
5
+ // opacity uses the effects spring, which never overshoots.
4
6
  @mixin button-transition {
5
7
  transition-property:
6
- inset, width, height, transform, opacity, border-start-start-radius,
7
- border-start-end-radius, border-end-start-radius, border-end-end-radius;
8
- transition-duration: 200ms;
9
- transition-timing-function: var(--easing-standard);
8
+ inset, width, height, transform, border-start-start-radius,
9
+ border-start-end-radius, border-end-start-radius, border-end-end-radius,
10
+ opacity;
11
+ transition-duration:
12
+ var(--motion-spring-fast-spatial-duration),
13
+ var(--motion-spring-fast-spatial-duration),
14
+ var(--motion-spring-fast-spatial-duration),
15
+ var(--motion-spring-fast-spatial-duration),
16
+ var(--motion-spring-fast-spatial-duration),
17
+ var(--motion-spring-fast-spatial-duration),
18
+ var(--motion-spring-fast-spatial-duration),
19
+ var(--motion-spring-fast-spatial-duration),
20
+ var(--motion-spring-fast-effects-duration);
21
+ transition-timing-function:
22
+ var(--motion-spring-fast-spatial-easing),
23
+ var(--motion-spring-fast-spatial-easing),
24
+ var(--motion-spring-fast-spatial-easing),
25
+ var(--motion-spring-fast-spatial-easing),
26
+ var(--motion-spring-fast-spatial-easing),
27
+ var(--motion-spring-fast-spatial-easing),
28
+ var(--motion-spring-fast-spatial-easing),
29
+ var(--motion-spring-fast-spatial-easing),
30
+ var(--motion-spring-fast-effects-easing);
10
31
  will-change: inset, transform, opacity;
11
32
  }
12
33
 
@@ -150,7 +171,8 @@
150
171
 
151
172
  .elevation {
152
173
  pointer-events: none;
153
- transition-duration: 280ms;
174
+ transition-duration: var(--motion-spring-default-effects-duration);
175
+ transition-timing-function: var(--motion-spring-default-effects-easing);
154
176
  --elevation-container-shape-start-start: var(
155
177
  --_button-container-shape-start-start,
156
178
  var(--_button-container-shape)
@@ -10,6 +10,12 @@ $border-width: 0.0625rem;
10
10
  gap: var(--button-group-spacing, var(--_button-group-spacing));
11
11
  }
12
12
 
13
+ // Press feedback: the widths set while a button is pressed move on the fast spatial spring.
14
+ slot::slotted(*) {
15
+ transition: width var(--motion-spring-fast-spatial-duration)
16
+ var(--motion-spring-fast-spatial-easing);
17
+ }
18
+
13
19
  // Size-specific rules (can be overridden by variant rules below)
14
20
  :host([size='xs']) {
15
21
  --_button-group-spacing: var(--spacing-200);
@@ -4,6 +4,18 @@ import styles from './button-group.scss';
4
4
  import { Button, ButtonColor } from '../button/button.js';
5
5
  import { IconButton } from '../icon-button/icon-button.js';
6
6
 
7
+ /** How much a pressed button widens, as a fraction of its width. */
8
+ const PRESS_GROWTH = 0.15;
9
+
10
+ /** Longer than the fast spatial spring takes to settle. */
11
+ const SETTLE_MS = 450;
12
+
13
+ function prefersReducedMotion(): boolean {
14
+ return (
15
+ window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false
16
+ );
17
+ }
18
+
7
19
  /**
8
20
  * @label Button Group
9
21
  * @tag wc-button-group
@@ -17,6 +29,8 @@ import { IconButton } from '../icon-button/icon-button.js';
17
29
  * <code>variant</code> when set, to every button, overriding what the buttons set themselves.</p>
18
30
  * <p>By default the buttons sit with a small gap between them. With <code>connected</code> they sit
19
31
  * 2px apart with rounded outer corners, for a set such as bold, italic and underline toggles.</p>
32
+ * <p>Pressing a button widens it while its neighbours make room, on a spring (not with reduced
33
+ * motion).</p>
20
34
  * <p>The group is layout only: it adds no group role, keyboard handling or selection, so each
21
35
  * button keeps its own focus stop and toggle state. For choosing one or several options from a
22
36
  * set use <code>wc-segmented-button-group</code>.</p>
@@ -82,6 +96,97 @@ class ButtonGroup extends LitElement {
82
96
  this._syncButtonProperties();
83
97
  }
84
98
 
99
+ // ── Press feedback (M3 Expressive) ─────────────────────────────────
100
+ // While a button is pressed it widens by PRESS_GROWTH of its width and its neighbours give up
101
+ // the same room, so the group keeps its overall width. Widths are set from a <style> in the
102
+ // shadow root (`::slotted(:nth-child(n))`), so the buttons' own attributes stay untouched.
103
+
104
+ private _pressStyle?: HTMLStyleElement;
105
+
106
+ /** Widths at rest, measured on press and kept until the release has settled. */
107
+ private _restWidths?: Map<HTMLElement, number>;
108
+
109
+ private _settleTimer?: ReturnType<typeof setTimeout>;
110
+
111
+ override connectedCallback() {
112
+ super.connectedCallback();
113
+ this.addEventListener('pointerdown', this._onPointerDown);
114
+ }
115
+
116
+ override disconnectedCallback() {
117
+ super.disconnectedCallback();
118
+ this.removeEventListener('pointerdown', this._onPointerDown);
119
+ this._removeReleaseListeners();
120
+ clearTimeout(this._settleTimer);
121
+ }
122
+
123
+ private _onPointerDown = (event: PointerEvent) => {
124
+ if (event.button !== 0 || prefersReducedMotion()) return;
125
+ const children = this._getSlottedElements();
126
+ if (children.length < 2) return;
127
+ const path = event.composedPath();
128
+ const pressed = children.find(child => path.includes(child));
129
+ if (!pressed || pressed.hasAttribute('disabled')) return;
130
+
131
+ clearTimeout(this._settleTimer);
132
+ if (!this._restWidths) {
133
+ this._restWidths = new Map(
134
+ children.map(child => [child, child.getBoundingClientRect().width]),
135
+ );
136
+ }
137
+ const rest = this._restWidths;
138
+ // Pin every button at its rest width first, so the change to the pressed widths animates.
139
+ this._applyWidths(rest);
140
+
141
+ const index = children.indexOf(pressed);
142
+ const neighbours = [children[index - 1], children[index + 1]].filter(
143
+ (child): child is HTMLElement =>
144
+ !!child && !child.hasAttribute('disabled'),
145
+ );
146
+ if (neighbours.length === 0) return;
147
+ const growth = (rest.get(pressed) ?? 0) * PRESS_GROWTH;
148
+ const target = new Map(rest);
149
+ target.set(pressed, (rest.get(pressed) ?? 0) + growth);
150
+ neighbours.forEach(child =>
151
+ target.set(child, (rest.get(child) ?? 0) - growth / neighbours.length),
152
+ );
153
+ requestAnimationFrame(() => this._applyWidths(target));
154
+
155
+ window.addEventListener('pointerup', this._onRelease);
156
+ window.addEventListener('pointercancel', this._onRelease);
157
+ };
158
+
159
+ private _onRelease = () => {
160
+ this._removeReleaseListeners();
161
+ const rest = this._restWidths;
162
+ if (!rest) return;
163
+ this._applyWidths(rest);
164
+ // Once the spring has settled, hand the widths back to the layout.
165
+ this._settleTimer = setTimeout(() => {
166
+ this._restWidths = undefined;
167
+ if (this._pressStyle) this._pressStyle.textContent = '';
168
+ }, SETTLE_MS);
169
+ };
170
+
171
+ private _removeReleaseListeners() {
172
+ window.removeEventListener('pointerup', this._onRelease);
173
+ window.removeEventListener('pointercancel', this._onRelease);
174
+ }
175
+
176
+ private _applyWidths(widths: Map<HTMLElement, number>) {
177
+ if (!this._pressStyle) {
178
+ this._pressStyle = document.createElement('style');
179
+ this.shadowRoot?.append(this._pressStyle);
180
+ }
181
+ const all = Array.from(this.children);
182
+ this._pressStyle.textContent = Array.from(widths)
183
+ .map(
184
+ ([child, width]) =>
185
+ `::slotted(:nth-child(${all.indexOf(child) + 1})) { width: ${width.toFixed(2)}px; min-width: 0; }`,
186
+ )
187
+ .join('\n');
188
+ }
189
+
85
190
  private _getSlottedElements(): HTMLElement[] {
86
191
  const slot = this.shadowRoot?.querySelector('slot');
87
192
  return (slot?.assignedElements({ flatten: true }) ?? []) as HTMLElement[];
@@ -1,6 +1,7 @@
1
1
  /* Small FAB: 40×40dp, shape-corner-medium */
2
2
  :host([size='sm']) {
3
3
  --fab-container-shape: var(--shape-corner-medium);
4
+ --fab-container-pressed-shape: var(--shape-corner-small);
4
5
  --fab-container-size: 2.5rem;
5
6
  --_button-icon-size: 1.5rem;
6
7
  --fab-extended-min-width: 4rem;
@@ -26,6 +27,7 @@
26
27
  /* Large FAB: 96×96dp, shape-corner-extra-large */
27
28
  :host([size='lg']) {
28
29
  --fab-container-shape: var(--shape-corner-extra-large);
30
+ --fab-container-pressed-shape: var(--shape-corner-large);
29
31
  --fab-container-size: 6rem;
30
32
  --_button-icon-size: 2.25rem;
31
33
  --fab-extended-min-width: 6rem;
@@ -2,17 +2,26 @@
2
2
 
3
3
  @include mixin.base-styles;
4
4
 
5
+ // The corners morph on the fast spatial spring when the FAB is pressed.
6
+ @mixin spring-shape {
7
+ transition: border-radius var(--motion-spring-fast-spatial-duration)
8
+ var(--motion-spring-fast-spatial-easing);
9
+ }
10
+
5
11
  :host {
6
12
  position: relative;
7
13
  display: inline-flex;
8
14
 
9
15
  --fab-container-shape: var(--shape-corner-large);
16
+ --fab-container-pressed-shape: var(--shape-corner-medium);
10
17
  --fab-container-elevation-level: 3;
11
18
 
12
- --_button-container-shape-start-start: var(--fab-container-shape);
13
- --_button-container-shape-start-end: var(--fab-container-shape);
14
- --_button-container-shape-end-start: var(--fab-container-shape);
15
- --_button-container-shape-end-end: var(--fab-container-shape);
19
+ --_fab-shape: var(--fab-container-shape);
20
+
21
+ --_button-container-shape-start-start: var(--_fab-shape);
22
+ --_button-container-shape-start-end: var(--_fab-shape);
23
+ --_button-container-shape-end-start: var(--_fab-shape);
24
+ --_button-container-shape-end-end: var(--_fab-shape);
16
25
  --_button-container-shape-variant: var(--fab-container-shape-variant);
17
26
  }
18
27
 
@@ -45,7 +54,8 @@
45
54
  justify-content: center;
46
55
  width: var(--fab-container-size);
47
56
  height: var(--fab-container-size);
48
- border-radius: var(--fab-container-shape);
57
+ border-radius: var(--_fab-shape);
58
+ @include spring-shape;
49
59
  font-family: var(--font-family-sans) !important;
50
60
  z-index: 0;
51
61
 
@@ -80,7 +90,8 @@
80
90
  width: auto;
81
91
  min-width: var(--fab-extended-min-width);
82
92
  padding: 0 1rem;
83
- border-radius: var(--fab-container-shape);
93
+ border-radius: var(--_fab-shape);
94
+ @include spring-shape;
84
95
  }
85
96
 
86
97
  /*
@@ -88,14 +99,15 @@
88
99
  */
89
100
  .focus-ring {
90
101
  z-index: 2;
91
- --focus-ring-container-shape-start-start: var(--fab-container-shape);
92
- --focus-ring-container-shape-start-end: var(--fab-container-shape);
93
- --focus-ring-container-shape-end-start: var(--fab-container-shape);
94
- --focus-ring-container-shape-end-end: var(--fab-container-shape);
102
+ --focus-ring-container-shape-start-start: var(--_fab-shape);
103
+ --focus-ring-container-shape-start-end: var(--_fab-shape);
104
+ --focus-ring-container-shape-end-start: var(--_fab-shape);
105
+ --focus-ring-container-shape-end-end: var(--_fab-shape);
95
106
  }
96
107
 
97
108
  .ripple {
98
- border-radius: var(--fab-container-shape);
109
+ border-radius: var(--_fab-shape);
110
+ @include spring-shape;
99
111
  --ripple-state-opacity: var(--_button-container-state-opacity, 0);
100
112
  --ripple-pressed-color: var(--_button-label-text-color);
101
113
  }
@@ -106,7 +118,8 @@
106
118
  inset: 0;
107
119
  background-color: var(--_button-container-color);
108
120
  opacity: var(--_button-container-opacity, 1);
109
- border-radius: var(--fab-container-shape);
121
+ border-radius: var(--_fab-shape);
122
+ @include spring-shape;
110
123
  pointer-events: none;
111
124
  }
112
125
 
@@ -115,11 +128,12 @@
115
128
  --_button-container-elevation-level,
116
129
  var(--fab-container-elevation-level)
117
130
  );
118
- transition-duration: 280ms;
119
- --elevation-container-shape-start-start: var(--fab-container-shape);
120
- --elevation-container-shape-start-end: var(--fab-container-shape);
121
- --elevation-container-shape-end-start: var(--fab-container-shape);
122
- --elevation-container-shape-end-end: var(--fab-container-shape);
131
+ transition-duration: var(--motion-spring-default-effects-duration);
132
+ transition-timing-function: var(--motion-spring-default-effects-easing);
133
+ --elevation-container-shape-start-start: var(--_fab-shape);
134
+ --elevation-container-shape-start-end: var(--_fab-shape);
135
+ --elevation-container-shape-end-start: var(--_fab-shape);
136
+ --elevation-container-shape-end-end: var(--_fab-shape);
123
137
  }
124
138
 
125
139
  /* State management */
@@ -129,6 +143,7 @@
129
143
  }
130
144
 
131
145
  :host(:active):not([disabled]) {
146
+ --_fab-shape: var(--fab-container-pressed-shape);
132
147
  --_button-container-elevation-level: 3;
133
148
  --_button-container-state-opacity: 0.12;
134
149
  }
@@ -39,6 +39,7 @@ import { ARIAMixinStrict } from '@/__internal/aria/aria.js';
39
39
  * @cssprop --fab-container-color: Background color of the FAB container.
40
40
  * @cssprop --fab-label-text-color: Text and icon color of the FAB label.
41
41
  * @cssprop --fab-container-shape: Corner radius of the FAB. Defaults to var(--shape-corner-large).
42
+ * @cssprop --fab-container-pressed-shape: Corner radius while the FAB is pressed. The corners morph to it on a spring.
42
43
  * @cssprop --fab-container-elevation-level: Elevation level of the FAB. Defaults to 3.
43
44
  *
44
45
  * @fires {MouseEvent} click - Dispatched when the FAB is clicked. Not dispatched while `loading`, `soft-disabled` or `skeleton`.
@@ -67,7 +67,7 @@
67
67
  align-items: center;
68
68
  justify-content: center;
69
69
  color: var(--color-on-surface);
70
- transition: background 200ms ease;
70
+ transition: background var(--motion-spring-fast-effects-duration) var(--motion-spring-fast-effects-easing);
71
71
 
72
72
  &:hover {
73
73
  background: var(--color-primary-90);
@@ -309,7 +309,7 @@
309
309
  background: var(--calendar-event-bg-color);
310
310
  border-inline-start: 0.25rem solid var(--calendar-event-border-color);
311
311
  border-radius: var(--shape-corner-extra-small);
312
- transition: background 150ms ease;
312
+ transition: background var(--motion-spring-fast-effects-duration) var(--motion-spring-fast-effects-easing);
313
313
 
314
314
  .event-title {
315
315
  padding: 0.25rem 0.375rem;
@@ -441,7 +441,7 @@
441
441
  border-radius: var(--shape-corner-full);
442
442
  background: currentColor;
443
443
  opacity: 0;
444
- transition: opacity 150ms ease;
444
+ transition: opacity var(--motion-spring-fast-effects-duration) var(--motion-spring-fast-effects-easing);
445
445
  }
446
446
  }
447
447
 
@@ -124,7 +124,7 @@
124
124
  color: inherit;
125
125
  font: inherit;
126
126
  cursor: pointer;
127
- transition: background 200ms ease;
127
+ transition: background var(--motion-spring-fast-effects-duration) var(--motion-spring-fast-effects-easing);
128
128
 
129
129
  &:hover {
130
130
  background: var(--color-surface-container-highest);
@@ -204,7 +204,7 @@
204
204
  border-inline-start: 0.25rem solid var(--calendar-event-border-color);
205
205
  border-radius: var(--shape-corner-extra-small);
206
206
  color: var(--calendar-event-text-color);
207
- transition: background 150ms ease;
207
+ transition: background var(--motion-spring-fast-effects-duration) var(--motion-spring-fast-effects-easing);
208
208
 
209
209
  &.clickable {
210
210
  &:hover {
@@ -301,7 +301,7 @@
301
301
  border-radius: var(--shape-corner-full);
302
302
  background: currentColor;
303
303
  opacity: 0;
304
- transition: opacity 150ms ease;
304
+ transition: opacity var(--motion-spring-fast-effects-duration) var(--motion-spring-fast-effects-easing);
305
305
  }
306
306
  }
307
307
 
@@ -273,7 +273,8 @@
273
273
  wc-icon {
274
274
  --icon-size: 1.25rem;
275
275
  font-size: 1.25rem;
276
- transition: transform var(--duration-short4, 200ms) ease;
276
+ transition: transform var(--motion-spring-fast-spatial-duration)
277
+ var(--motion-spring-fast-spatial-easing);
277
278
  }
278
279
 
279
280
  &[aria-expanded='true'] wc-icon {
@@ -399,7 +400,8 @@
399
400
  font-size: 0.75rem;
400
401
  color: var(--calendar-timeline-event-text-color);
401
402
  white-space: nowrap;
402
- transition: background 150ms ease;
403
+ transition: background var(--motion-spring-fast-effects-duration)
404
+ var(--motion-spring-fast-effects-easing);
403
405
  container-type: inline-size;
404
406
 
405
407
  .event-title {
@@ -505,7 +507,8 @@
505
507
  border-radius: var(--shape-corner-full);
506
508
  background: currentColor;
507
509
  opacity: 0;
508
- transition: opacity 150ms ease;
510
+ transition: opacity var(--motion-spring-fast-effects-duration)
511
+ var(--motion-spring-fast-effects-easing);
509
512
  }
510
513
  }
511
514
 
@@ -121,7 +121,8 @@
121
121
 
122
122
  .elevation {
123
123
  --elevation-level: var(--_container-elevation-level);
124
- transition-duration: 280ms;
124
+ transition-duration: var(--motion-spring-default-effects-duration);
125
+ transition-timing-function: var(--motion-spring-default-effects-easing);
125
126
  --elevation-container-shape-start-start: var(--_container-shape-start-start);
126
127
  --elevation-container-shape-start-end: var(--_container-shape-start-end);
127
128
  --elevation-container-shape-end-start: var(--_container-shape-end-start);