material 3.15.0 → 3.15.2

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 (174) hide show
  1. package/README.md +2 -2
  2. package/dist/components/bottom-sheet/features/state.js +27 -0
  3. package/dist/components/card/index.d.ts +35 -35
  4. package/dist/components/dialog/features.js +4 -0
  5. package/dist/components/divider/features.js +6 -3
  6. package/dist/components/divider/index.d.ts +8 -8
  7. package/dist/components/drawer/index.d.ts +6 -6
  8. package/dist/components/fab-menu/index.d.ts +6 -6
  9. package/dist/components/list/index.d.ts +6 -6
  10. package/dist/components/listbox/index.d.ts +6 -6
  11. package/dist/components/loading-indicator/index.d.ts +6 -6
  12. package/dist/components/menu/features/controller.js +19 -20
  13. package/dist/components/snackbar/api.js +3 -0
  14. package/dist/components/snackbar/index.d.ts +9 -9
  15. package/dist/components/tabs/index.d.ts +90 -90
  16. package/dist/components/text-field/index.d.ts +6 -6
  17. package/dist/components/tooltip/api.js +51 -7
  18. package/dist/core/canvas/index.d.ts +22 -22
  19. package/dist/core/compose/index.d.ts +478 -478
  20. package/dist/core/dom/index.d.ts +47 -47
  21. package/dist/core/shapes/index.d.ts +61 -61
  22. package/dist/core/theme/index.d.ts +6 -6
  23. package/dist/core/utils/index.d.ts +27 -27
  24. package/dist/elements/css/badge.css +1 -1
  25. package/dist/elements/css/bottom-app-bar.css +1 -1
  26. package/dist/elements/css/navigation-bar.css +1 -1
  27. package/dist/elements/css/side-sheet.css +1 -1
  28. package/dist/elements/css/text-field.css +1 -1
  29. package/dist/elements/css/toolbar.css +1 -1
  30. package/dist/elements/css/tooltip.css +1 -1
  31. package/dist/elements/css/top-app-bar.css +1 -1
  32. package/dist/elements/index.d.ts +2226 -2226
  33. package/dist/elements/preupgrade/badge.css +2 -2
  34. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  35. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  36. package/dist/elements/preupgrade/button-group.css +1 -1
  37. package/dist/elements/preupgrade/button.css +1 -1
  38. package/dist/elements/preupgrade/card.css +1 -1
  39. package/dist/elements/preupgrade/carousel.css +1 -1
  40. package/dist/elements/preupgrade/checkbox.css +1 -1
  41. package/dist/elements/preupgrade/chips.css +1 -1
  42. package/dist/elements/preupgrade/datepicker.css +1 -1
  43. package/dist/elements/preupgrade/dialog.css +1 -1
  44. package/dist/elements/preupgrade/divider.css +1 -1
  45. package/dist/elements/preupgrade/drawer.css +1 -1
  46. package/dist/elements/preupgrade/extended-fab.css +1 -1
  47. package/dist/elements/preupgrade/fab-menu.css +1 -1
  48. package/dist/elements/preupgrade/fab.css +1 -1
  49. package/dist/elements/preupgrade/icon-button.css +1 -1
  50. package/dist/elements/preupgrade/list.css +1 -1
  51. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  52. package/dist/elements/preupgrade/menu.css +1 -1
  53. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  54. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  55. package/dist/elements/preupgrade/progress.css +1 -1
  56. package/dist/elements/preupgrade/radios.css +1 -1
  57. package/dist/elements/preupgrade/search.css +1 -1
  58. package/dist/elements/preupgrade/select.css +1 -1
  59. package/dist/elements/preupgrade/side-sheet.css +1 -1
  60. package/dist/elements/preupgrade/slider.css +1 -1
  61. package/dist/elements/preupgrade/snackbar.css +1 -1
  62. package/dist/elements/preupgrade/split-button.css +1 -1
  63. package/dist/elements/preupgrade/switch.css +1 -1
  64. package/dist/elements/preupgrade/tabs.css +1 -1
  65. package/dist/elements/preupgrade/text-field.css +1 -1
  66. package/dist/elements/preupgrade/timepicker.css +1 -1
  67. package/dist/elements/preupgrade/toolbar.css +1 -1
  68. package/dist/elements/preupgrade/tooltip.css +1 -1
  69. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  70. package/dist/elements/preupgrade.css +2 -2
  71. package/dist/elements/styles.js +9 -9
  72. package/dist/elements/top-app-bar.js +11 -1
  73. package/dist/react/index.d.ts +50 -50
  74. package/dist/solid/index.d.ts +50 -50
  75. package/dist/styles/badge.css +2 -2
  76. package/dist/styles/base-elements.css +1 -1
  77. package/dist/styles/base-lite.css +1 -1
  78. package/dist/styles/base.css +1 -1
  79. package/dist/styles/bottom-app-bar-toolbar.css +2 -2
  80. package/dist/styles/bottom-app-bar.css +2 -2
  81. package/dist/styles/bottom-sheet.css +1 -1
  82. package/dist/styles/button-filled-small-round.css +1 -1
  83. package/dist/styles/button-group.css +1 -1
  84. package/dist/styles/button.css +1 -1
  85. package/dist/styles/card.css +1 -1
  86. package/dist/styles/carousel.css +1 -1
  87. package/dist/styles/checkbox.css +1 -1
  88. package/dist/styles/chips.css +1 -1
  89. package/dist/styles/contrast.css +1 -1
  90. package/dist/styles/datepicker.css +1 -1
  91. package/dist/styles/dialog.css +1 -1
  92. package/dist/styles/divider.css +1 -1
  93. package/dist/styles/drawer.css +1 -1
  94. package/dist/styles/extended-fab.css +1 -1
  95. package/dist/styles/fab-menu.css +1 -1
  96. package/dist/styles/fab.css +1 -1
  97. package/dist/styles/icon-button.css +1 -1
  98. package/dist/styles/list.css +1 -1
  99. package/dist/styles/listbox.css +1 -1
  100. package/dist/styles/loading-indicator.css +1 -1
  101. package/dist/styles/menu.css +1 -1
  102. package/dist/styles/navigation-bar.css +2 -2
  103. package/dist/styles/navigation-rail.css +1 -1
  104. package/dist/styles/progress.css +1 -1
  105. package/dist/styles/radios.css +1 -1
  106. package/dist/styles/search.css +1 -1
  107. package/dist/styles/select.css +1 -1
  108. package/dist/styles/side-sheet.css +2 -2
  109. package/dist/styles/slider.css +1 -1
  110. package/dist/styles/snackbar.css +1 -1
  111. package/dist/styles/split-button.css +1 -1
  112. package/dist/styles/switch.css +1 -1
  113. package/dist/styles/tabs.css +1 -1
  114. package/dist/styles/text-field.css +2 -2
  115. package/dist/styles/timepicker.css +1 -1
  116. package/dist/styles/toolbar.css +2 -2
  117. package/dist/styles/tooltip.css +2 -2
  118. package/dist/styles/top-app-bar.css +2 -2
  119. package/dist/styles/typography.css +1 -1
  120. package/dist/styles/utilities.css +1 -1
  121. package/dist/styles.css +2 -2
  122. package/dist/themes/autumn-contrast.css +1 -1
  123. package/dist/themes/autumn.css +1 -1
  124. package/dist/themes/baseline-contrast.css +1 -1
  125. package/dist/themes/baseline.css +1 -1
  126. package/dist/themes/brownbeige-contrast.css +1 -1
  127. package/dist/themes/brownbeige.css +1 -1
  128. package/dist/themes/content-contrast.css +1 -1
  129. package/dist/themes/content.css +1 -1
  130. package/dist/themes/desert-contrast.css +1 -1
  131. package/dist/themes/desert.css +1 -1
  132. package/dist/themes/expressive-contrast.css +1 -1
  133. package/dist/themes/expressive.css +1 -1
  134. package/dist/themes/fidelity-contrast.css +1 -1
  135. package/dist/themes/fidelity.css +1 -1
  136. package/dist/themes/forest-contrast.css +1 -1
  137. package/dist/themes/forest.css +1 -1
  138. package/dist/themes/fruit-salad-contrast.css +1 -1
  139. package/dist/themes/fruit-salad.css +1 -1
  140. package/dist/themes/highcontrast-contrast.css +1 -1
  141. package/dist/themes/highcontrast.css +1 -1
  142. package/dist/themes/monochrome-contrast.css +1 -1
  143. package/dist/themes/monochrome.css +1 -1
  144. package/dist/themes/neutral-contrast.css +1 -1
  145. package/dist/themes/neutral.css +1 -1
  146. package/dist/themes/ocean-contrast.css +1 -1
  147. package/dist/themes/ocean.css +1 -1
  148. package/dist/themes/rainbow-contrast.css +1 -1
  149. package/dist/themes/rainbow.css +1 -1
  150. package/dist/themes/sageivory-contrast.css +1 -1
  151. package/dist/themes/sageivory.css +1 -1
  152. package/dist/themes/spring-contrast.css +1 -1
  153. package/dist/themes/spring.css +1 -1
  154. package/dist/themes/summer-contrast.css +1 -1
  155. package/dist/themes/summer.css +1 -1
  156. package/dist/themes/sunset-contrast.css +1 -1
  157. package/dist/themes/sunset.css +1 -1
  158. package/dist/themes/tealcaramel-contrast.css +1 -1
  159. package/dist/themes/tealcaramel.css +1 -1
  160. package/dist/themes/vibrant-contrast.css +1 -1
  161. package/dist/themes/vibrant.css +1 -1
  162. package/dist/tokens/catalogue.json +3 -3
  163. package/dist/vue/index.d.ts +50 -50
  164. package/package.json +1 -1
  165. package/src/styles/base/_plain-slot-button.scss +67 -0
  166. package/src/styles/components/_badge.scss +1 -3
  167. package/src/styles/components/_bottom-app-bar.scss +6 -0
  168. package/src/styles/components/_navigation-bar.scss +1 -2
  169. package/src/styles/components/_side-sheet.scss +6 -0
  170. package/src/styles/components/_text-field.scss +8 -0
  171. package/src/styles/components/_toolbar.scss +1 -0
  172. package/src/styles/components/_tooltip.scss +5 -2
  173. package/src/styles/components/_top-app-bar.scss +21 -12
  174. package/src/styles/elements/_badge.scss +5 -3
package/README.md CHANGED
@@ -138,11 +138,11 @@ What a bundler keeps, minified and gzipped (kB is 1,000 bytes), measured from th
138
138
  | `createButton` from `material`, with code splitting: the initial chunks (the progress indicator loads on demand) | 7.5 kB |
139
139
  | `createButton`, without code splitting (the progress indicator included) | 13.9 kB |
140
140
  | `createButton`, `createTextField` and `createCheckbox`, without code splitting | 20.3 kB |
141
- | Everything the root exports (`export * from 'material'`), without code splitting | 131.3 kB |
141
+ | Everything the root exports (`export * from 'material'`), without code splitting | 131.7 kB |
142
142
  | `material/styles/base` | 3.1 kB |
143
143
  | `material/styles/base-lite` | 1.7 kB |
144
144
  | `material/styles/base` and `material/styles/button` | 5.4 kB |
145
- | `material/styles`, the full stylesheet | 59.7 kB |
145
+ | `material/styles`, the full stylesheet | 60.1 kB |
146
146
  <!-- /sizes -->
147
147
 
148
148
  `material` publishes ESM only, so bundlers drop what you do not import. Each component's page on [md3.io/components](https://md3.io/components/) gives its size.
@@ -39,12 +39,30 @@ const open = next !== BOTTOM_SHEET_STATES.HIDDEN;
39
39
  element.setAttribute("aria-hidden", open ? "false" : "true");
40
40
  element.style.pointerEvents = open ? "" : "none";
41
41
  };
42
+ const fullHeight = `${root}--full-height`;
43
+ const syncFullHeight = () => {
44
+ const box = structure.container;
45
+ element.classList.toggle(fullHeight, state === BOTTOM_SHEET_STATES.EXPANDED && box.offsetHeight > 0 && box.offsetTop < 1);
46
+ };
47
+ const placeContent = structure.setContent;
48
+ structure.setContent = (next) => {
49
+ placeContent(next);
50
+ syncFullHeight();
51
+ };
52
+ const boxObserver = typeof ResizeObserver === "function"
53
+ ? new ResizeObserver(() => {
54
+ if (state === BOTTOM_SHEET_STATES.EXPANDED)
55
+ syncFullHeight();
56
+ })
57
+ : null;
58
+ boxObserver?.observe(structure.container);
42
59
  const setState = (next) => {
43
60
  if (next === state)
44
61
  return;
45
62
  const previous = state;
46
63
  state = next;
47
64
  applyState(next);
65
+ syncFullHeight();
48
66
  component.emit(BOTTOM_SHEET_EVENTS.STATE_CHANGE, { state: next, previous });
49
67
  };
50
68
  const handleKeydown = (event) => {
@@ -95,8 +113,15 @@ previouslyFocused = null;
95
113
  component.emit(BOTTOM_SHEET_EVENTS.CLOSE);
96
114
  }
97
115
  applyState(state);
116
+ syncFullHeight();
98
117
  if (state !== BOTTOM_SHEET_STATES.HIDDEN)
99
118
  onStack(true);
119
+ const onResize = () => {
120
+ if (state === BOTTOM_SHEET_STATES.EXPANDED)
121
+ syncFullHeight();
122
+ };
123
+ const view = element.ownerDocument.defaultView;
124
+ view?.addEventListener("resize", onResize);
100
125
  let stopCloses = null;
101
126
  if (top) {
102
127
  element.addEventListener("click", handleScrimClick);
@@ -121,6 +146,8 @@ isOpen: () => state !== BOTTOM_SHEET_STATES.HIDDEN,
121
146
  getState: () => state,
122
147
  setState,
123
148
  release: () => {
149
+ boxObserver?.disconnect();
150
+ view?.removeEventListener("resize", onResize);
124
151
  document.removeEventListener("keydown", handleKeydown);
125
152
  structure.scrim?.removeEventListener("click", handleScrimClick);
126
153
  element.removeEventListener("click", handleScrimClick);
@@ -2,6 +2,41 @@ import type { ForwardedEventPayload } from "../../core/dom/index.js";
2
2
  import type { TouchEvents } from "../../core/utils/mobile.js";
3
3
  import type { ButtonConfig as BaseButtonConfig } from "../button/types.js";
4
4
 
5
+ /**
6
+ * Creates a new Card component following Material Design 3 principles.
7
+ * @param config
8
+ */
9
+ declare const createCard: (config?: CardConfig) => CardComponent;
10
+
11
+ declare const CARD_CONTENT_PADDING = true;
12
+
13
+ /**
14
+ * Creates a card content component
15
+ * @param config
16
+ */
17
+ declare const createCardContent: (config?: CardContentConfig) => HTMLElement;
18
+
19
+ /**
20
+ * Creates a card header component
21
+ * @param config
22
+ */
23
+ declare const createCardHeader: (config?: CardHeaderConfig) => HTMLElement;
24
+
25
+ /**
26
+ * Creates a card actions component
27
+ * @param config
28
+ */
29
+ declare const createCardActions: (config?: CardActionsConfig) => HTMLElement;
30
+
31
+
32
+ declare const NESTED_ACTION_SELECTOR = "button,a[href],input,select,textarea,m-button,m-icon-button,[role=button],[role=link],slot[name=actions],slot[name=header-action]";
33
+
34
+ /**
35
+ * Creates a card media component
36
+ * @param config
37
+ */
38
+ declare const createCardMedia: (config?: CardMediaConfig) => HTMLElement;
39
+
5
40
  /** Card variant types following Material Design 3 guidelines. */
6
41
  type CardVariant = 'elevated' | 'filled' | 'outlined';
7
42
 
@@ -292,40 +327,5 @@ declare module "../../core/config/global" {
292
327
  card?: Partial<CardConfig>;
293
328
  }
294
329
  }
295
-
296
- declare const CARD_CONTENT_PADDING = true;
297
-
298
- /**
299
- * Creates a card content component
300
- * @param config
301
- */
302
- declare const createCardContent: (config?: CardContentConfig) => HTMLElement;
303
-
304
- /**
305
- * Creates a card header component
306
- * @param config
307
- */
308
- declare const createCardHeader: (config?: CardHeaderConfig) => HTMLElement;
309
-
310
- /**
311
- * Creates a card actions component
312
- * @param config
313
- */
314
- declare const createCardActions: (config?: CardActionsConfig) => HTMLElement;
315
-
316
-
317
- declare const NESTED_ACTION_SELECTOR = "button,a[href],input,select,textarea,m-button,m-icon-button,[role=button],[role=link],slot[name=actions],slot[name=header-action]";
318
-
319
- /**
320
- * Creates a card media component
321
- * @param config
322
- */
323
- declare const createCardMedia: (config?: CardMediaConfig) => HTMLElement;
324
-
325
- /**
326
- * Creates a new Card component following Material Design 3 principles.
327
- * @param config
328
- */
329
- declare const createCard: (config?: CardConfig) => CardComponent;
330
330
  export type { CardActionsConfig, CardAriaAttributes, CardComponent, CardConfig, CardContentConfig, CardElevationLevel, CardEvents, CardHeaderConfig, CardMediaConfig, CardVariant };
331
331
  export { createCard, createCard as default, createCardActions, createCardContent, createCardHeader, createCardMedia };
@@ -93,6 +93,7 @@ const footer = Array.isArray(config.buttons) && config.buttons.length > 0
93
93
  ? createFooter()
94
94
  : null;
95
95
  addClass(component.element, component.getClass("dialog"));
96
+ component.element.inert = true;
96
97
  if (config.title) {
97
98
  component.element.setAttribute("aria-labelledby", titleId);
98
99
  }
@@ -426,6 +427,7 @@ const dialogVisibleClass = `${component.getClass("dialog")}--visible`;
426
427
  const overlayVisibleClass = `${component.getClass("dialog__overlay")}--visible`;
427
428
  scopeScrim();
428
429
  if (isOpen) {
430
+ component.element.inert = false;
429
431
  if (top)
430
432
  showModal();
431
433
  addClass(component.overlay, overlayVisibleClass);
@@ -441,6 +443,7 @@ previouslyFocusedElement = deepActiveElement();
441
443
  if (ask(DIALOG_EVENTS.BEFORE_OPEN))
442
444
  return;
443
445
  opened = true;
446
+ component.element.inert = false;
444
447
  clearTimeout(afterCloseTimer);
445
448
  afterOpenWaiting = false;
446
449
  focusPending = false;
@@ -485,6 +488,7 @@ return;
485
488
  stopOpen();
486
489
  removeClass(component.element, dialogVisibleClass);
487
490
  removeClass(component.overlay, overlayVisibleClass);
491
+ component.element.inert = true;
488
492
  if (top)
489
493
  hideFromTopLayer(component.element);
490
494
  releaseFocus();
@@ -21,14 +21,17 @@ const cross = horizontal ? 'height' : 'width';
21
21
  const main = horizontal ? 'width' : 'height';
22
22
  style[cross] = `${thickness}px`;
23
23
  style[main] = '100%';
24
- if (variant !== 'full-width') {
25
- const insetStart = config.insetStart !== undefined ? config.insetStart : DEFAULT_INSET;
24
+ const explicit = config.insetStart !== undefined || config.insetEnd !== undefined;
25
+ if (variant !== 'full-width' || explicit) {
26
+ const insetStart = config.insetStart !== undefined
27
+ ? config.insetStart
28
+ : (variant === 'full-width' ? 0 : DEFAULT_INSET);
26
29
  const insetEnd = config.insetEnd !== undefined
27
30
  ? config.insetEnd
28
31
  : (variant === 'middle-inset' ? DEFAULT_INSET : 0);
29
32
  style[horizontal ? 'marginInlineStart' : 'marginBlockStart'] = `${insetStart}px`;
30
33
  style[horizontal ? 'marginInlineEnd' : 'marginBlockEnd'] = `${insetEnd}px`;
31
- style[main] = 'auto';
34
+ style[main] = `calc(100% - ${insetStart + insetEnd}px)`;
32
35
  }
33
36
  };
34
37
  export const withOrientation = (config) => (component) => {
@@ -1,10 +1,4 @@
1
1
  import { BaseComponent, ElementComponent } from "../../core/compose/index.js";
2
-
3
- /**
4
- * Creates a new Divider component with the specified configuration.
5
- * @param config
6
- */
7
- declare const createDivider: (config?: DividerConfig) => DividerComponent;
8
2
  /** Configuration options for divider components Controls the appearance, orientation, and behavior of Material Design 3 dividers. */
9
3
  interface DividerConfig {
10
4
  /** CSS class prefix (defaults to 'mtrl') */
@@ -23,12 +17,12 @@ interface DividerConfig {
23
17
  variant?: 'full-width' | 'inset' | 'middle-inset';
24
18
  /**
25
19
  * Custom inset value (left margin for horizontal, top margin for vertical) Overrides the default inset spacing at the start of the divider.
26
- * @default 16 for 'inset' and 'middle-inset' variants
20
+ * @default 16 for 'inset' and 'middle-inset' variants, 0 for full-width
27
21
  */
28
22
  insetStart?: number;
29
23
  /**
30
24
  * Custom inset end value (right margin for horizontal, bottom margin for vertical) Overrides the default inset spacing at the end of the divider.
31
- * @default 0 for 'inset', 16 for 'middle-inset'
25
+ * @default 0 for 'inset' and full-width, 16 for 'middle-inset'
32
26
  */
33
27
  insetEnd?: number;
34
28
  /** Color of the divider Sets a custom color for the divider. */
@@ -48,6 +42,12 @@ declare const defaultConfig: Partial<DividerConfig>;
48
42
 
49
43
  declare const createBaseConfig: (config?: DividerConfig) => DividerConfig;
50
44
 
45
+ /**
46
+ * Creates a new Divider component with the specified configuration.
47
+ * @param config
48
+ */
49
+ declare const createDivider: (config?: DividerConfig) => DividerComponent;
50
+
51
51
  /** The three slices of a divider, one per enhancer in features.ts. */
52
52
  interface DividerOrientation {
53
53
  /** Gets current orientation of the divider */
@@ -1,6 +1,12 @@
1
1
  import { BaseComponentConfig } from "../../core/config/component.js";
2
2
  import type { ForwardedEventPayload } from "../../core/dom/index.js";
3
3
 
4
+ /**
5
+ * Creates a new Drawer component with the specified configuration.
6
+ * @param config
7
+ */
8
+ declare const createDrawer: (config?: DrawerConfig) => DrawerComponent;
9
+
4
10
  /** Drawer variant type — controls layout behavior */
5
11
  type DrawerVariant = "standard" | "modal";
6
12
 
@@ -186,11 +192,5 @@ interface DrawerComponent {
186
192
  destroy: () => void;
187
193
  };
188
194
  }
189
-
190
- /**
191
- * Creates a new Drawer component with the specified configuration.
192
- * @param config
193
- */
194
- declare const createDrawer: (config?: DrawerConfig) => DrawerComponent;
195
195
  export type { DrawerComponent, DrawerConfig, DrawerEvents, DrawerItemConfig, DrawerPosition, DrawerSelectEvent, DrawerVariant };
196
196
  export { createDrawer, createDrawer as default };
@@ -2,6 +2,12 @@ import type { ElementComponent } from "../../core/compose/index.js";
2
2
  import type { BaseComponentConfig } from "../../core/config/component.js";
3
3
  import type { FabMenuColor, FabMenuPlacement, FabMenuPresentation, FabMenuSize } from "./constants.js";
4
4
 
5
+ /**
6
+ * Creates a FAB menu: M3 Expressive's FAB that opens a list of related actions.
7
+ * @param config
8
+ */
9
+ declare const createFabMenu: (config: FabMenuConfig) => FabMenuComponent;
10
+
5
11
  /** An action of the menu */
6
12
  interface FabMenuItem {
7
13
  /** Identifies the item in `select` */
@@ -101,12 +107,6 @@ declare module "../../core/config/global" {
101
107
  "fab-menu"?: Partial<FabMenuConfig>;
102
108
  }
103
109
  }
104
-
105
- /**
106
- * Creates a FAB menu: M3 Expressive's FAB that opens a list of related actions.
107
- * @param config
108
- */
109
- declare const createFabMenu: (config: FabMenuConfig) => FabMenuComponent;
110
110
  export type { FabMenuComponent, FabMenuConfig, FabMenuEvents, FabMenuItem, FabMenuMenu };
111
111
  export { createFabMenu, createFabMenu as default };
112
112
  export type { FabMenuColor, FabMenuPlacement, FabMenuPresentation, FabMenuSize } from "./constants.js";
@@ -16,6 +16,12 @@ interface SingleSelectListboxOptions {
16
16
  */
17
17
  declare const withSingleSelectListbox: (component: ListComponent<ListItem>, options?: SingleSelectListboxOptions) => ListComponent<ListItem>;
18
18
 
19
+ /**
20
+ * Creates a new List component The List component provides a simple way to render static arrays of data with Material item anatomy and built-in selection capabilities.
21
+ * @param config
22
+ */
23
+ declare const createList: (config?: Partial<ListConfig<ListItem>>) => ListComponent<ListItem>;
24
+
19
25
  /** List variant types following Material Design 3 guidelines. */
20
26
  type ListVariant = 'standard' | 'segmented';
21
27
 
@@ -288,12 +294,6 @@ interface ListEvents<T = unknown> {
288
294
  scroll: (event: ForwardedEventPayload<Event, HTMLElement>) => void;
289
295
  keydown: (event: ForwardedEventPayload<KeyboardEvent, HTMLElement>) => void;
290
296
  }
291
-
292
- /**
293
- * Creates a new List component The List component provides a simple way to render static arrays of data with Material item anatomy and built-in selection capabilities.
294
- * @param config
295
- */
296
- declare const createList: (config?: Partial<ListConfig<ListItem>>) => ListComponent<ListItem>;
297
297
  export type { ListComponent, ListConfig, ListItem, ListSlot, ListVariant, LoadEvent, SelectEvent, SingleSelectListboxOptions };
298
298
  export { createList, createList as default, withSingleSelectListbox };
299
299
  export { LIST_CLASSES, LIST_DEFAULTS, LIST_EVENTS, LIST_SCROLL_POSITIONS, LIST_SELECTION_MODES, LIST_TYPES, LIST_VARIANTS } from "./constants.js";
@@ -1,3 +1,9 @@
1
+
2
+ /**
3
+ * Creates a listbox handle on a dedicated control.
4
+ * @param config
5
+ */
6
+ declare function createListbox<T = unknown>(config: ListboxConfig<T>): ListboxComponent<T>;
1
7
  /** The lean selection popup's public types. */
2
8
  /** One option of a listbox. */
3
9
  interface ListboxOption<T = unknown> {
@@ -90,11 +96,5 @@ interface ListboxComponent<T = unknown> {
90
96
  /** Idempotent and terminal. */
91
97
  destroy: () => void;
92
98
  }
93
-
94
- /**
95
- * Creates a listbox handle on a dedicated control.
96
- * @param config
97
- */
98
- declare function createListbox<T = unknown>(config: ListboxConfig<T>): ListboxComponent<T>;
99
99
  export type { ListboxChangeDetail, ListboxComponent, ListboxConfig, ListboxEventDetail, ListboxEventHandlers, ListboxEvents, ListboxOption };
100
100
  export { createListbox, createListbox as default };
@@ -1,11 +1,5 @@
1
1
  import { MaterialShapeName, RadialProfile } from "../../core/shapes/index.js";
2
2
 
3
- /**
4
- * Creates a loading indicator: the Material 3 expressive shape morph for waits under about five seconds.
5
- * @param config
6
- */
7
- declare const createLoadingIndicator: (config?: LoadingIndicatorConfig) => LoadingIndicatorComponent;
8
-
9
3
 
10
4
  interface Frame {
11
5
 
@@ -32,6 +26,12 @@ interface Renderer {
32
26
 
33
27
  declare const withRenderer: (config: LoadingIndicatorConfig) => (component: BaseComponent) => BaseComponent;
34
28
 
29
+ /**
30
+ * Creates a loading indicator: the Material 3 expressive shape morph for waits under about five seconds.
31
+ * @param config
32
+ */
33
+ declare const createLoadingIndicator: (config?: LoadingIndicatorConfig) => LoadingIndicatorComponent;
34
+
35
35
  /** Configuration options for the loading indicator */
36
36
  interface LoadingIndicatorConfig {
37
37
  /** Width and height in pixels, 24 to 240 (default 48) */
@@ -30,6 +30,8 @@ selectedItemId: null,
30
30
  activeItemIndex: -1,
31
31
  component,
32
32
  };
33
+ const itemRole = () => (state.selectedItemId ? "menuitemradio" : "menuitem");
34
+ const checkedAttribute = listbox ? "aria-selected" : "aria-checked";
33
35
  const eventHelpers = {
34
36
  triggerEvent(eventName, data = {}, originalEvent) {
35
37
  const eventData = {
@@ -51,7 +53,7 @@ const opener = getOpenerElement();
51
53
  if (opener)
52
54
  component.position?.positionMenu(opener);
53
55
  };
54
- const createMenuItem = (item, index) => {
56
+ const createMenuItem = (item, index, role = itemRole()) => {
55
57
  const itemElement = document.createElement("li");
56
58
  const itemClass = `${component.getClass("menu__item")}`;
57
59
  itemElement.className = itemClass;
@@ -60,7 +62,7 @@ itemElement.setAttribute("role", "option");
60
62
  itemElement.id = `${optionIdPrefix}-option-${index}`;
61
63
  }
62
64
  else {
63
- itemElement.setAttribute("role", "menuitem");
65
+ itemElement.setAttribute("role", item.hasSubmenu ? "menuitem" : role);
64
66
  itemElement.setAttribute("tabindex", "-1");
65
67
  }
66
68
  itemElement.setAttribute("data-id", item.id);
@@ -72,12 +74,14 @@ itemElement.setAttribute("aria-disabled", "true");
72
74
  else {
73
75
  itemElement.setAttribute("aria-disabled", "false");
74
76
  }
77
+ if (listbox || (role === "menuitemradio" && !item.hasSubmenu)) {
75
78
  if (state.selectedItemId && item.id === state.selectedItemId) {
76
79
  itemElement.classList.add(`${itemClass}--selected`);
77
- itemElement.setAttribute("aria-selected", "true");
80
+ itemElement.setAttribute(checkedAttribute, "true");
81
+ }
82
+ else {
83
+ itemElement.setAttribute(checkedAttribute, "false");
78
84
  }
79
- else if (listbox) {
80
- itemElement.setAttribute("aria-selected", "false");
81
85
  }
82
86
  if (item.hasSubmenu) {
83
87
  itemElement.classList.add(`${itemClass}--submenu`);
@@ -231,24 +235,19 @@ closeMenu(e, true);
231
235
  }
232
236
  };
233
237
  const updateSelectedState = (itemId) => {
234
- if (!component.element)
235
- return;
238
+ state.selectedItemId = itemId;
236
239
  const menuItems = component.element.querySelectorAll(`.${component.getClass("menu__item")}`);
237
240
  menuItems.forEach((item) => {
238
- const currentItemId = item.getAttribute("data-id");
239
- if (currentItemId === itemId) {
240
- item.classList.add(`${component.getClass("menu__item--selected")}`);
241
- item.setAttribute("aria-selected", "true");
242
- }
243
- else {
244
- item.classList.remove(`${component.getClass("menu__item--selected")}`);
245
- if (listbox)
246
- item.setAttribute("aria-selected", "false");
241
+ const opens = item.hasAttribute("aria-haspopup");
242
+ const selected = !opens && item.getAttribute("data-id") === itemId;
243
+ item.classList.toggle(`${component.getClass("menu__item--selected")}`, selected);
244
+ if (!listbox)
245
+ item.setAttribute("role", opens ? "menuitem" : itemRole());
246
+ if (listbox || (itemId && !opens))
247
+ item.setAttribute(checkedAttribute, String(selected));
247
248
  else
248
- item.removeAttribute("aria-selected");
249
- }
249
+ item.removeAttribute(checkedAttribute);
250
250
  });
251
- state.selectedItemId = itemId;
252
251
  };
253
252
  const registryEntry = {
254
253
  close: (event) => closeMenu(event, false),
@@ -448,7 +447,7 @@ else if ("type" in item && item.type === "divider") {
448
447
  element = createDivider(item, index);
449
448
  }
450
449
  else {
451
- element = createMenuItem(item, index);
450
+ element = createMenuItem(item, index, "menuitem");
452
451
  }
453
452
  container.appendChild(element);
454
453
  if (onItemCreated) {
@@ -10,6 +10,7 @@ throw new Error('Snackbar queue is required');
10
10
  const element = component.element;
11
11
  const prefix = config.prefix || 'mtrl';
12
12
  const cls = (name) => `${prefix}-${name}`;
13
+ element.inert = true;
13
14
  let entry = null;
14
15
  let previouslyFocused = null;
15
16
  let removal = null;
@@ -98,12 +99,14 @@ if (active && element.contains(active) && previouslyFocused instanceof HTMLEleme
98
99
  previouslyFocused.focus();
99
100
  }
100
101
  element.classList.remove(cls(SNACKBAR_CLASSES.VISIBLE));
102
+ element.inert = true;
101
103
  scheduleRemoval();
102
104
  emit('close', { reason, originalEvent });
103
105
  emit('dismiss', { reason, originalEvent });
104
106
  };
105
107
  const open = () => {
106
108
  api.state = 'visible';
109
+ element.inert = false;
107
110
  cancelRemoval();
108
111
  previouslyFocused = deepActiveElement();
109
112
  if (topLayer) {
@@ -2,6 +2,15 @@ import type { EventCallback } from "../../core/state/emitter.js";
2
2
  import type { ButtonComponent } from "../button/types.js";
3
3
  import type { IconButtonComponent } from "../icon-button/types.js";
4
4
 
5
+ /**
6
+ * Creates a new Snackbar component
7
+ * @param config
8
+ */
9
+ declare const createSnackbar: (config: SnackbarConfig) => SnackbarComponent;
10
+
11
+ /** Dismisses the snackbar on screen and drops the ones still waiting. */
12
+ declare const clearSnackbars: () => void;
13
+
5
14
  /** Where the snackbar sits along the bottom edge */
6
15
  type SnackbarPosition = 'center' | 'start' | 'end';
7
16
 
@@ -201,15 +210,6 @@ interface ApiOptions {
201
210
 
202
211
  config: SnackbarConfig;
203
212
  }
204
-
205
- /**
206
- * Creates a new Snackbar component
207
- * @param config
208
- */
209
- declare const createSnackbar: (config: SnackbarConfig) => SnackbarComponent;
210
-
211
- /** Dismisses the snackbar on screen and drops the ones still waiting. */
212
- declare const clearSnackbars: () => void;
213
213
  export type { SnackbarCloseReason, SnackbarComponent, SnackbarConfig, SnackbarDuration, SnackbarEvent, SnackbarEvents, SnackbarPosition, SnackbarQueueBehavior };
214
214
  export { clearSnackbars, createSnackbar, createSnackbar as default };
215
215
  export { SNACKBAR_CLOSE_REASONS, SNACKBAR_DURATIONS, SNACKBAR_POSITIONS, SNACKBAR_QUEUE_BEHAVIORS } from "./constants.js";