material 3.13.1 → 3.14.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 (173) hide show
  1. package/README.md +28 -1
  2. package/dist/components/badge/index.d.ts +6 -6
  3. package/dist/components/bottom-app-bar-toolbar/index.d.ts +8 -0
  4. package/dist/components/bottom-app-bar-toolbar/index.js +66 -0
  5. package/dist/components/bottom-app-bar-toolbar/structure.js +18 -0
  6. package/dist/components/bottom-sheet/index.d.ts +6 -6
  7. package/dist/components/button/features/progress.js +6 -9
  8. package/dist/components/button-group/index.d.ts +6 -6
  9. package/dist/components/card/index.d.ts +29 -29
  10. package/dist/components/checkbox/index.d.ts +6 -6
  11. package/dist/components/chips/chip/chip.js +6 -4
  12. package/dist/components/chips/index.d.ts +18 -18
  13. package/dist/components/datepicker/index.d.ts +6 -6
  14. package/dist/components/dialog/features.js +9 -24
  15. package/dist/components/dialog/index.d.ts +6 -6
  16. package/dist/components/divider/index.d.ts +42 -42
  17. package/dist/components/fab/index.d.ts +6 -6
  18. package/dist/components/fab-menu/fab-menu.js +5 -6
  19. package/dist/components/fab-menu/index.d.ts +7 -0
  20. package/dist/components/list/index.d.ts +16 -16
  21. package/dist/components/listbox/index.d.ts +100 -0
  22. package/dist/components/listbox/index.js +1 -0
  23. package/dist/components/listbox/listbox.js +633 -0
  24. package/dist/components/loading-indicator/index.d.ts +32 -32
  25. package/dist/components/navigation-bar/index.d.ts +3 -3
  26. package/dist/components/navigation-rail/index.d.ts +3 -3
  27. package/dist/components/progress/features/canvas.js +7 -13
  28. package/dist/components/radios/index.d.ts +6 -6
  29. package/dist/components/switch/index.d.ts +6 -6
  30. package/dist/components/tabs/index.d.ts +97 -97
  31. package/dist/components/text-field/index.d.ts +51 -51
  32. package/dist/components/tooltip/index.d.ts +6 -6
  33. package/dist/core/canvas/index.d.ts +77 -77
  34. package/dist/core/compose/index.d.ts +365 -365
  35. package/dist/core/dom/index.d.ts +117 -117
  36. package/dist/core/icons/index.d.ts +5 -5
  37. package/dist/core/shapes/index.d.ts +51 -51
  38. package/dist/core/state/index.d.ts +26 -26
  39. package/dist/core/utils/index.d.ts +8 -8
  40. package/dist/elements/index.d.ts +2109 -2109
  41. package/dist/elements/preupgrade/badge.css +1 -1
  42. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  43. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  44. package/dist/elements/preupgrade/button-group.css +1 -1
  45. package/dist/elements/preupgrade/button.css +1 -1
  46. package/dist/elements/preupgrade/card.css +1 -1
  47. package/dist/elements/preupgrade/carousel.css +1 -1
  48. package/dist/elements/preupgrade/checkbox.css +1 -1
  49. package/dist/elements/preupgrade/chips.css +1 -1
  50. package/dist/elements/preupgrade/datepicker.css +1 -1
  51. package/dist/elements/preupgrade/dialog.css +1 -1
  52. package/dist/elements/preupgrade/divider.css +1 -1
  53. package/dist/elements/preupgrade/drawer.css +1 -1
  54. package/dist/elements/preupgrade/extended-fab.css +1 -1
  55. package/dist/elements/preupgrade/fab-menu.css +1 -1
  56. package/dist/elements/preupgrade/fab.css +1 -1
  57. package/dist/elements/preupgrade/icon-button.css +1 -1
  58. package/dist/elements/preupgrade/list.css +1 -1
  59. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  60. package/dist/elements/preupgrade/menu.css +1 -1
  61. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  62. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  63. package/dist/elements/preupgrade/progress.css +1 -1
  64. package/dist/elements/preupgrade/radios.css +1 -1
  65. package/dist/elements/preupgrade/search.css +1 -1
  66. package/dist/elements/preupgrade/select.css +1 -1
  67. package/dist/elements/preupgrade/side-sheet.css +1 -1
  68. package/dist/elements/preupgrade/slider.css +1 -1
  69. package/dist/elements/preupgrade/snackbar.css +1 -1
  70. package/dist/elements/preupgrade/split-button.css +1 -1
  71. package/dist/elements/preupgrade/switch.css +1 -1
  72. package/dist/elements/preupgrade/tabs.css +1 -1
  73. package/dist/elements/preupgrade/text-field.css +1 -1
  74. package/dist/elements/preupgrade/timepicker.css +1 -1
  75. package/dist/elements/preupgrade/toolbar.css +1 -1
  76. package/dist/elements/preupgrade/tooltip.css +1 -1
  77. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  78. package/dist/elements/preupgrade.css +1 -1
  79. package/dist/react/index.d.ts +47 -47
  80. package/dist/solid/index.d.ts +47 -47
  81. package/dist/styles/badge.css +1 -1
  82. package/dist/styles/base-elements.css +1 -1
  83. package/dist/styles/base-lite.css +1 -1
  84. package/dist/styles/base.css +1 -1
  85. package/dist/styles/bottom-app-bar-toolbar.css +2 -0
  86. package/dist/styles/bottom-app-bar-toolbar.js +2 -0
  87. package/dist/styles/bottom-app-bar.css +1 -1
  88. package/dist/styles/bottom-sheet.css +1 -1
  89. package/dist/styles/button-filled-small-round.css +1 -1
  90. package/dist/styles/button-group.css +1 -1
  91. package/dist/styles/button.css +1 -1
  92. package/dist/styles/card.css +1 -1
  93. package/dist/styles/carousel.css +1 -1
  94. package/dist/styles/checkbox.css +1 -1
  95. package/dist/styles/chips.css +1 -1
  96. package/dist/styles/contrast.css +1 -1
  97. package/dist/styles/datepicker.css +1 -1
  98. package/dist/styles/dialog.css +1 -1
  99. package/dist/styles/divider.css +1 -1
  100. package/dist/styles/drawer.css +1 -1
  101. package/dist/styles/extended-fab.css +1 -1
  102. package/dist/styles/fab-menu.css +1 -1
  103. package/dist/styles/fab.css +1 -1
  104. package/dist/styles/icon-button.css +1 -1
  105. package/dist/styles/list.css +1 -1
  106. package/dist/styles/listbox.css +2 -0
  107. package/dist/styles/listbox.js +2 -0
  108. package/dist/styles/loading-indicator.css +1 -1
  109. package/dist/styles/menu.css +1 -1
  110. package/dist/styles/navigation-bar.css +1 -1
  111. package/dist/styles/navigation-rail.css +1 -1
  112. package/dist/styles/progress.css +1 -1
  113. package/dist/styles/radios.css +1 -1
  114. package/dist/styles/search.css +1 -1
  115. package/dist/styles/select.css +1 -1
  116. package/dist/styles/side-sheet.css +1 -1
  117. package/dist/styles/slider.css +1 -1
  118. package/dist/styles/snackbar.css +1 -1
  119. package/dist/styles/split-button.css +1 -1
  120. package/dist/styles/switch.css +1 -1
  121. package/dist/styles/tabs.css +1 -1
  122. package/dist/styles/text-field.css +1 -1
  123. package/dist/styles/timepicker.css +1 -1
  124. package/dist/styles/toolbar.css +1 -1
  125. package/dist/styles/tooltip.css +1 -1
  126. package/dist/styles/top-app-bar.css +1 -1
  127. package/dist/styles/typography.css +1 -1
  128. package/dist/styles/utilities.css +1 -1
  129. package/dist/styles.css +1 -1
  130. package/dist/themes/autumn-contrast.css +1 -1
  131. package/dist/themes/autumn.css +1 -1
  132. package/dist/themes/baseline-contrast.css +1 -1
  133. package/dist/themes/baseline.css +1 -1
  134. package/dist/themes/brownbeige-contrast.css +1 -1
  135. package/dist/themes/brownbeige.css +1 -1
  136. package/dist/themes/content-contrast.css +1 -1
  137. package/dist/themes/content.css +1 -1
  138. package/dist/themes/desert-contrast.css +1 -1
  139. package/dist/themes/desert.css +1 -1
  140. package/dist/themes/expressive-contrast.css +1 -1
  141. package/dist/themes/expressive.css +1 -1
  142. package/dist/themes/fidelity-contrast.css +1 -1
  143. package/dist/themes/fidelity.css +1 -1
  144. package/dist/themes/forest-contrast.css +1 -1
  145. package/dist/themes/forest.css +1 -1
  146. package/dist/themes/fruit-salad-contrast.css +1 -1
  147. package/dist/themes/fruit-salad.css +1 -1
  148. package/dist/themes/highcontrast-contrast.css +1 -1
  149. package/dist/themes/highcontrast.css +1 -1
  150. package/dist/themes/monochrome-contrast.css +1 -1
  151. package/dist/themes/monochrome.css +1 -1
  152. package/dist/themes/neutral-contrast.css +1 -1
  153. package/dist/themes/neutral.css +1 -1
  154. package/dist/themes/ocean-contrast.css +1 -1
  155. package/dist/themes/ocean.css +1 -1
  156. package/dist/themes/rainbow-contrast.css +1 -1
  157. package/dist/themes/rainbow.css +1 -1
  158. package/dist/themes/sageivory-contrast.css +1 -1
  159. package/dist/themes/sageivory.css +1 -1
  160. package/dist/themes/spring-contrast.css +1 -1
  161. package/dist/themes/spring.css +1 -1
  162. package/dist/themes/summer-contrast.css +1 -1
  163. package/dist/themes/summer.css +1 -1
  164. package/dist/themes/sunset-contrast.css +1 -1
  165. package/dist/themes/sunset.css +1 -1
  166. package/dist/themes/tealcaramel-contrast.css +1 -1
  167. package/dist/themes/tealcaramel.css +1 -1
  168. package/dist/themes/vibrant-contrast.css +1 -1
  169. package/dist/themes/vibrant.css +1 -1
  170. package/dist/tokens/catalogue.json +3 -3
  171. package/dist/vue/index.d.ts +74 -74
  172. package/package.json +19 -1
  173. package/src/styles/components/_listbox.scss +95 -0
package/README.md CHANGED
@@ -66,6 +66,31 @@ Import `material/styles/button` for any other variant, size or shape. This inclu
66
66
 
67
67
  Every component comes three ways: a factory, a custom element and a framework component. Each has a page with a playground on [md3.io/components](https://md3.io/components/).
68
68
 
69
+ ## Bottom app bar compatibility entry
70
+
71
+ The experimental `material/components/bottom-app-bar-toolbar` factory keeps the legacy bottom app bar API with docked-toolbar styling. Import its stylesheet explicitly, including on pages using the full stylesheet:
72
+
73
+ ```typescript
74
+ import createBottomAppBarToolbar from 'material/components/bottom-app-bar-toolbar';
75
+ import 'material/styles/base';
76
+ import 'material/styles/bottom-app-bar-toolbar';
77
+
78
+ const save = document.createElement('button');
79
+ save.type = 'button';
80
+ save.textContent = 'Save';
81
+ const bar = createBottomAppBarToolbar({ autoHide: true });
82
+ bar.addAction(save);
83
+ document.body.append(bar.element);
84
+ ```
85
+
86
+ Use it when a factory screen needs legacy chaining, native Tab order, live action containers, a centred or late-added FAB, or custom transition duration. It is absent from the root export and has no element, framework adapter or SSR registration.
87
+
88
+ For new screens, use the docked toolbar from `material/components/toolbar`. The legacy `createBottomAppBar` is deprecated in 3.x but remains available with its existing behaviour. See the [migration note](https://github.com/floor/material/blob/main/MIGRATING.md#bottom-app-bar-in-3x).
89
+
90
+ The [implementation measurements](https://github.com/floor/material#measured-entry-cost) record 4,386 B gzip for the compatibility JavaScript graph versus 4,248 B for the legacy graph. A standalone styled Vite page needs 11,157 B initially versus 7,358 B, with no deferred bytes; caller-owned controls, fonts, external icons and HTML are outside those costs.
91
+
92
+ That snapshot added 1,655 B compressed, 7,158 B unpacked and five package files. Root and existing default payloads were byte-identical; the entry provides no root or default-bundle saving.
93
+
69
94
  ## Web components
70
95
 
71
96
  A page imports the base stylesheet and the elements' CSS once, then registers the elements with `defineAll()`. After that `<m-button>` and the rest are HTML, in plain pages, server templates and any framework.
@@ -87,7 +112,9 @@ The framework components render the elements, load their CSS and register each o
87
112
 
88
113
  `renderElement` from `material/ssr` renders an element to declarative shadow DOM. Each framework has a bridge, such as `material/ssr/react`, that makes its components emit the same roots and hydrate.
89
114
 
90
- Node and Bun are supported; worker and edge runtimes are not supported in `material` 3.0.0. Guide: [md3.io/docs/server-rendering](https://md3.io/docs/server-rendering/).
115
+ Node and Bun use the server entries. Under the `workerd` and `worker` export conditions, the SSR entry and its four bridges select those same server entries ahead of browser; enabling `worker` selects server code even for a client worker. Browser-only builds keep the safe-to-import stub, whose retained `renderElement` call throws "material/ssr is server-only".
116
+
117
+ Wrangler selects `workerd`. For Vite webworker SSR, set `ssr.target: "webworker"` and `ssr.noExternal: ["material"]`; also set `ssr.resolve.conditions: ["workerd", "worker", "browser"]` so default webworker browser conditions do not select the stub. CI checks the packed package and four framework renders in pinned workerd without Node compatibility. Guide: [md3.io/docs/server-rendering](https://md3.io/docs/server-rendering/).
91
118
 
92
119
  ## Themes
93
120
 
@@ -1,5 +1,11 @@
1
1
  import { ElementComponent } from "../../core/compose/component.js";
2
2
 
3
+ /**
4
+ * Creates a new Badge component following Material Design 3 guidelines.
5
+ * @param config
6
+ */
7
+ declare const createBadge: (config?: BadgeConfig) => BadgeComponent;
8
+
3
9
  /** Badge variant types - determines the badge size and appearance */
4
10
  type BadgeVariant = 'small' | 'large';
5
11
 
@@ -157,11 +163,5 @@ interface BadgeComponent {
157
163
  */
158
164
  off: (event: string, handler: Function) => BadgeComponent;
159
165
  }
160
-
161
- /**
162
- * Creates a new Badge component following Material Design 3 guidelines.
163
- * @param config
164
- */
165
- declare const createBadge: (config?: BadgeConfig) => BadgeComponent;
166
166
  export type { BadgeColor, BadgeComponent, BadgeConfig, BadgePosition, BadgeVariant };
167
167
  export { createBadge, createBadge as default };
@@ -0,0 +1,8 @@
1
+ import type { BottomAppBarConfig, BottomAppBarComponent } from "../bottom-app-bar/index.js";
2
+ export type { BottomAppBarConfig as BottomAppBarToolbarConfig, BottomAppBarComponent as BottomAppBarToolbarComponent } from "../bottom-app-bar/index.js";
3
+ /**
4
+ * Self-contained opt-in bottom app bar with docked styling and legacy policy.
5
+ * @param config
6
+ */
7
+ export declare function createBottomAppBarToolbar(config?: BottomAppBarConfig): BottomAppBarComponent;
8
+ export default createBottomAppBarToolbar;
@@ -0,0 +1,66 @@
1
+ import { processClassNames } from "../../core/config/component.js";
2
+ import { getCleanup } from "../../core/compose/cleanup.js";
3
+ import { PREFIX } from "../../core/config.js";
4
+ import { createConfig } from "../bottom-app-bar/config.js";
5
+ import { createToolbarStructure, createToolbarFab } from "./structure.js";
6
+ export function createBottomAppBarToolbar(config = {}) {
7
+ const settings = createConfig(config);
8
+ const block = `${PREFIX}-bottom-app-bar`;
9
+ const { component, bar } = createToolbarStructure(settings, {
10
+ tag: settings.tag,
11
+ componentName: "bottom-app-bar",
12
+ className: [
13
+ `${PREFIX}-toolbar`, `${PREFIX}-toolbar--docked`, `${PREFIX}-toolbar--bottom`, `${PREFIX}-toolbar--standard`,
14
+ `${block}-toolbar`,
15
+ settings.hasFab ? `${block}--with-fab` : "",
16
+ settings.fabPosition === "center" ? `${block}--fab-center` : "",
17
+ processClassNames(settings.className || ""),
18
+ ].filter(Boolean),
19
+ attributes: { role: "toolbar", "aria-label": "Bottom app bar" },
20
+ interactive: true,
21
+ }, `${PREFIX}-toolbar__bar ${block}__actions`, {});
22
+ const root = component.element;
23
+ const fab = createToolbarFab(root, `${PREFIX}-toolbar__fab ${block}__fab-container`);
24
+ const resources = getCleanup(component);
25
+ let visible = true;
26
+ let previous = window.scrollY;
27
+ const setVisible = (next) => {
28
+ root.classList.toggle(`${block}--hidden`, !next);
29
+ const changed = visible !== next;
30
+ visible = next;
31
+ if (changed)
32
+ settings.onVisibilityChange?.(next);
33
+ };
34
+ const api = {
35
+ ...component,
36
+ addClass(...classes) { component.addClass(...classes); return this; },
37
+ addAction(action) { bar.appendChild(action); return this; },
38
+ addFab(element) {
39
+ fab.replaceChildren(element);
40
+ root.classList.add(`${block}--with-fab`);
41
+ return this;
42
+ },
43
+ getActionsContainer() { return bar; },
44
+ show() { setVisible(true); return this; },
45
+ hide() { setVisible(false); return this; },
46
+ isVisible() { return visible; },
47
+ destroy() { component.lifecycle.destroy(); },
48
+ };
49
+ if (settings.autoHide) {
50
+ const scroll = () => {
51
+ const current = window.scrollY;
52
+ if (current > previous + 10 && visible)
53
+ api.hide();
54
+ else if (current < previous - 10 && !visible)
55
+ api.show();
56
+ previous = current;
57
+ };
58
+ window.addEventListener("scroll", scroll, { passive: true });
59
+ resources.add(() => window.removeEventListener("scroll", scroll));
60
+ }
61
+ if (settings.autoHide && settings.transitionDuration) {
62
+ root.style.transition = `transform ${settings.transitionDuration}ms ease-in-out`;
63
+ }
64
+ return api;
65
+ }
66
+ export default createBottomAppBarToolbar;
@@ -0,0 +1,18 @@
1
+ import { pipe } from "../../core/compose/pipe.js";
2
+ import { createBase, withElement } from "../../core/compose/component.js";
3
+ import { withEvents, withLifecycle } from "../../core/compose/features/index.js";
4
+ export function createToolbarStructure(settings, options, barClass, attributes) {
5
+ const component = pipe(createBase, withEvents(), withElement(options), withLifecycle())(settings);
6
+ const bar = document.createElement("div");
7
+ bar.className = barClass;
8
+ for (const [name, value] of Object.entries(attributes))
9
+ bar.setAttribute(name, value);
10
+ component.element.appendChild(bar);
11
+ return { component, bar };
12
+ }
13
+ export function createToolbarFab(root, className, before = null) {
14
+ const fab = document.createElement("div");
15
+ fab.className = className;
16
+ root.insertBefore(fab, before);
17
+ return fab;
18
+ }
@@ -1,5 +1,11 @@
1
1
  import { BOTTOM_SHEET_STATES, BOTTOM_SHEET_VARIANTS } from "./constants.js";
2
2
 
3
+ /**
4
+ * Creates a bottom sheet: a surface anchored to the bottom edge holding content secondary to the page.
5
+ * @param config
6
+ */
7
+ declare const createBottomSheet: (config?: BottomSheetConfig) => BottomSheetComponent;
8
+
3
9
  /** Standard or modal */
4
10
  type BottomSheetVariant = (typeof BOTTOM_SHEET_VARIANTS)[keyof typeof BOTTOM_SHEET_VARIANTS];
5
11
 
@@ -104,11 +110,5 @@ interface BottomSheetComponent {
104
110
  /** Prefixes a class name, for styling hooks */
105
111
  getClass: (name: string) => string;
106
112
  }
107
-
108
- /**
109
- * Creates a bottom sheet: a surface anchored to the bottom edge holding content secondary to the page.
110
- * @param config
111
- */
112
- declare const createBottomSheet: (config?: BottomSheetConfig) => BottomSheetComponent;
113
113
  export type { BottomSheetComponent, BottomSheetConfig, BottomSheetEventHandlers, BottomSheetState, BottomSheetStateEvent, BottomSheetVariant };
114
114
  export { createBottomSheet, createBottomSheet as default };
@@ -8,10 +8,10 @@ if (!config.progress && !config.loading) {
8
8
  return component;
9
9
  }
10
10
  const { on, ...restConfig } = (typeof config.progress === "object" ? config.progress : {});
11
- const progressEventHandlers = on ?? {};
12
11
  const progressConfig = {
13
12
  variant: "circular", size: 20, thickness: 2, indeterminate: true,
14
13
  ...restConfig,
14
+ minSize: 20,
15
15
  };
16
16
  let progress = null;
17
17
  let progressPromise = null;
@@ -30,15 +30,14 @@ return progress;
30
30
  if (!progressPromise) {
31
31
  progressPromise = createProgressLazy(progressConfig).then((p) => {
32
32
  progress = p;
33
- addClass(progress.element, component.getClass("button__progress"));
34
- progress.element.style.display = "none";
35
- for (const event of Object.keys(progressEventHandlers)) {
36
- const handler = progressEventHandlers[event];
33
+ addClass(p.element, component.getClass("button__progress"));
34
+ p.element.style.display = "none";
35
+ for (const [event, handler] of Object.entries(on ?? {})) {
37
36
  if (handler)
38
37
  p.on(event, handler);
39
38
  }
40
- component.progress = progress;
41
- return progress;
39
+ component.progress = p;
40
+ return p;
42
41
  });
43
42
  }
44
43
  return progressPromise;
@@ -52,7 +51,6 @@ return component.element.firstChild;
52
51
  };
53
52
  const showProgress = async () => {
54
53
  const p = await ensureProgress();
55
- if (p.element) {
56
54
  if (!component.element.contains(p.element)) {
57
55
  const insertPoint = getProgressInsertionPoint();
58
56
  if (insertPoint) {
@@ -68,7 +66,6 @@ const iconElement = component.element.querySelector(`.${component.getClass("butt
68
66
  if (iconElement instanceof HTMLElement) {
69
67
  iconElement.style.display = "none";
70
68
  }
71
- }
72
69
  return component;
73
70
  };
74
71
  component.showProgress = showProgress;
@@ -1,5 +1,11 @@
1
1
  import type { ButtonComponent, ButtonConfig } from "../button/types.js";
2
2
 
3
+ /**
4
+ * Creates a new Button Group component The Button Group component provides a container for grouping related action buttons.
5
+ * @param config
6
+ */
7
+ declare const createButtonGroup: (config?: ButtonGroupConfig) => ButtonGroupComponent;
8
+
3
9
  /** Button group orientation */
4
10
  type ButtonGroupOrientation = "horizontal" | "vertical";
5
11
 
@@ -239,12 +245,6 @@ interface ButtonGroupComponent {
239
245
  /** Destroys the component and cleans up resources */
240
246
  destroy: () => void;
241
247
  }
242
-
243
- /**
244
- * Creates a new Button Group component The Button Group component provides a container for grouping related action buttons.
245
- * @param config
246
- */
247
- declare const createButtonGroup: (config?: ButtonGroupConfig) => ButtonGroupComponent;
248
248
  export type { ButtonGroupChangeEvent, ButtonGroupComponent, ButtonGroupConfig, ButtonGroupDensity, ButtonGroupEvent, ButtonGroupEventType, ButtonGroupItemConfig, ButtonGroupKind, ButtonGroupOrientation, ButtonGroupSelection, ButtonGroupVariant };
249
249
  export { createButtonGroup, createButtonGroup as default };
250
250
  export { BUTTON_GROUP_CLASSES, BUTTON_GROUP_DEFAULTS, BUTTON_GROUP_DENSITY, BUTTON_GROUP_EVENTS, BUTTON_GROUP_ORIENTATIONS, BUTTON_GROUP_VARIANTS } from "./constants.js";
@@ -2,35 +2,6 @@ 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
- declare const CARD_CONTENT_PADDING = true;
6
-
7
- /**
8
- * Creates a card content component
9
- * @param config
10
- */
11
- declare const createCardContent: (config?: CardContentConfig) => HTMLElement;
12
-
13
- /**
14
- * Creates a card header component
15
- * @param config
16
- */
17
- declare const createCardHeader: (config?: CardHeaderConfig) => HTMLElement;
18
-
19
- /**
20
- * Creates a card actions component
21
- * @param config
22
- */
23
- declare const createCardActions: (config?: CardActionsConfig) => HTMLElement;
24
-
25
-
26
- 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]";
27
-
28
- /**
29
- * Creates a card media component
30
- * @param config
31
- */
32
- declare const createCardMedia: (config?: CardMediaConfig) => HTMLElement;
33
-
34
5
  /** Card variant types following Material Design 3 guidelines. */
35
6
  type CardVariant = 'elevated' | 'filled' | 'outlined';
36
7
 
@@ -322,6 +293,35 @@ declare module "../../core/config/global" {
322
293
  }
323
294
  }
324
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
325
  /**
326
326
  * Creates a new Card component following Material Design 3 principles.
327
327
  * @param config
@@ -1,6 +1,12 @@
1
1
  import type { EventCallback } from "../../core/state/emitter.js";
2
2
  import type { TouchEvents } from "../../core/utils/mobile.js";
3
3
 
4
+ /**
5
+ * Creates a new Checkbox component with the specified configuration.
6
+ * @param config
7
+ */
8
+ declare const createCheckbox: (config?: CheckboxConfig) => CheckboxComponent;
9
+
4
10
  /** Checkbox label position types - controls where the label appears */
5
11
  type CheckboxLabelPosition = "start" | "end";
6
12
 
@@ -206,12 +212,6 @@ declare module "../../core/config/global" {
206
212
  checkbox?: Partial<CheckboxConfig>;
207
213
  }
208
214
  }
209
-
210
- /**
211
- * Creates a new Checkbox component with the specified configuration.
212
- * @param config
213
- */
214
- declare const createCheckbox: (config?: CheckboxConfig) => CheckboxComponent;
215
215
  export type { CheckboxChangePayload, CheckboxComponent, CheckboxConfig, CheckboxEvents, CheckboxLabelPosition };
216
216
  export { createCheckbox, createCheckbox as default };
217
217
  export { CHECKBOX_CLASSES, CHECKBOX_LABEL_POSITION, CHECKBOX_STATES } from "./constants.js";
@@ -5,11 +5,13 @@ import { withEvents, withLifecycle } from "../../../core/compose/features/index.
5
5
  import { createRipple } from "../../../core/compose/features/ripple.js";
6
6
  import { createComponentConfig, createElementConfig } from "../../../core/config/component.js";
7
7
  import { setHTML } from "../../../core/dom/html.js";
8
+ import { getIcon } from "../../../core/icons/registry.js";
8
9
  const CHECK = '<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"/></svg>';
9
10
  const DROP_DOWN = '<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M7 10l5 5 5-5z"/></svg>';
10
11
  const CLOSE = '<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>';
11
12
  const createChip = (config = {}) => {
12
13
  const options = createComponentConfig({ type: "filter", ripple: true }, config, "chip");
14
+ const closeGlyph = getIcon("close", CLOSE);
13
15
  const type = options.type ?? "filter";
14
16
  const selectable = type === "filter" || type === "input";
15
17
  const elementConfig = createElementConfig(options, { tag: "div" });
@@ -57,7 +59,7 @@ if (type === "input") {
57
59
  remove = document.createElement("button");
58
60
  remove.type = "button";
59
61
  remove.className = base.getClass("chip__remove");
60
- setHTML(remove, trailingIcon || CLOSE);
62
+ setHTML(remove, trailingIcon || closeGlyph);
61
63
  root.append(remove);
62
64
  root.setAttribute("role", "group");
63
65
  }
@@ -70,7 +72,7 @@ if (options.trailingMenu) {
70
72
  trailingAction.setAttribute("aria-haspopup", "menu");
71
73
  trailingAction.setAttribute("aria-expanded", "false");
72
74
  }
73
- setHTML(trailingAction, trailingIcon || (options.trailingMenu ? DROP_DOWN : CLOSE));
75
+ setHTML(trailingAction, trailingIcon || (options.trailingMenu ? DROP_DOWN : closeGlyph));
74
76
  root.append(trailingAction);
75
77
  root.setAttribute("role", "group");
76
78
  }
@@ -162,9 +164,9 @@ setLeadingIcon,
162
164
  setTrailingIcon(icon) {
163
165
  trailingIcon = type === "suggestion" ? "" : icon;
164
166
  if (trailingAction)
165
- setHTML(trailingAction, trailingIcon || (options.trailingMenu ? DROP_DOWN : CLOSE));
167
+ setHTML(trailingAction, trailingIcon || (options.trailingMenu ? DROP_DOWN : closeGlyph));
166
168
  else
167
- setHTML(remove ?? trailing, trailingIcon || (remove ? CLOSE : ""));
169
+ setHTML(remove ?? trailing, trailingIcon || (remove ? closeGlyph : ""));
168
170
  render();
169
171
  return api;
170
172
  },
@@ -1,6 +1,24 @@
1
1
  import type { ForwardedEventPayload } from "../../core/dom/index.js";
2
2
  import type { EventCallback } from "../../core/state/emitter.js";
3
3
 
4
+ /**
5
+ * Creates a chips container for grouping related chips Chips follows a clear architectural pattern: 1.
6
+ * @param config
7
+ */
8
+ declare const createChips: (config?: ChipsConfig) => ChipsComponent;
9
+
10
+ /** Action chip; flat and outlined by default. */
11
+ declare const createAssistChip: (config: AssistChipConfig) => ChipComponent;
12
+
13
+ /** Toggleable filter; selected chips show a checkmark. */
14
+ declare const createFilterChip: (config: FilterChipConfig) => ChipComponent;
15
+
16
+ /** Selectable input token with an optional independent removal action. */
17
+ declare const createInputChip: (config: InputChipConfig) => ChipComponent;
18
+
19
+ /** Suggested action; flat and outlined by default. */
20
+ declare const createSuggestionChip: (config: SuggestionChipConfig) => ChipComponent;
21
+
4
22
  type ChipType = "assist" | "filter" | "input" | "suggestion";
5
23
 
6
24
  /** Shared chip options. */
@@ -321,23 +339,5 @@ declare module "../../core/config/global" {
321
339
  chip?: Partial<ChipConfig>;
322
340
  }
323
341
  }
324
-
325
- /** Action chip; flat and outlined by default. */
326
- declare const createAssistChip: (config: AssistChipConfig) => ChipComponent;
327
-
328
- /** Toggleable filter; selected chips show a checkmark. */
329
- declare const createFilterChip: (config: FilterChipConfig) => ChipComponent;
330
-
331
- /** Selectable input token with an optional independent removal action. */
332
- declare const createInputChip: (config: InputChipConfig) => ChipComponent;
333
-
334
- /** Suggested action; flat and outlined by default. */
335
- declare const createSuggestionChip: (config: SuggestionChipConfig) => ChipComponent;
336
-
337
- /**
338
- * Creates a chips container for grouping related chips Chips follows a clear architectural pattern: 1.
339
- * @param config
340
- */
341
- declare const createChips: (config?: ChipsConfig) => ChipsComponent;
342
342
  export type { AssistChipConfig, ChipChangePayload, ChipComponent, ChipConfig, ChipEvents, ChipType, ChipsAddEvent, ChipsChangeEvent, ChipsComponent, ChipsConfig, ChipsEvents, ChipsRemoveEvent, FilterChipConfig, InputChipConfig, SuggestionChipConfig };
343
343
  export { createAssistChip, createChips, createChips as default, createFilterChip, createInputChip, createSuggestionChip };
@@ -1,6 +1,12 @@
1
1
  import type { ForwardedEventPayload } from "../../core/dom/index.js";
2
2
  import type { NormalizedEvent } from "../../core/utils/mobile.js";
3
3
 
4
+ /** M3 calendar/input modes share a draft; modal acceptance is the commit boundary. */
5
+ /** The value's type follows a literal selectionMode: `'range'` makes it a pair, the default a date. */
6
+ declare const createDatePicker: <M extends string = "single">(config?: DatePickerConfig & {
7
+ selectionMode?: M;
8
+ }) => DatePickerComponent<DatePickerValueOf<M>>;
9
+
4
10
  /** Value returned by the API, including complete ranges and empty selections. */
5
11
  type DatePickerValue = Date | [
6
12
  Date,
@@ -303,11 +309,5 @@ interface DatePickerState {
303
309
  listStart?: Date;
304
310
  listLength?: number;
305
311
  }
306
-
307
- /** M3 calendar/input modes share a draft; modal acceptance is the commit boundary. */
308
- /** The value's type follows a literal selectionMode: `'range'` makes it a pair, the default a date. */
309
- declare const createDatePicker: <M extends string = "single">(config?: DatePickerConfig & {
310
- selectionMode?: M;
311
- }) => DatePickerComponent<DatePickerValueOf<M>>;
312
312
  export type { CalendarAPI, DatePickerChangePayload, DatePickerComponent, DatePickerConfig, DatePickerEvents, DatePickerInput, DatePickerSelectionMode, DatePickerSwipePayload, DatePickerTapPayload, DatePickerValue, DatePickerValueOf, DatePickerVariant, DatePickerView, DatePickerVisibilityPayload };
313
313
  export { createDatePicker, createDatePicker as default };
@@ -1,6 +1,7 @@
1
1
  import createButton from "../button/index.js";
2
2
  import { addClass, removeClass } from "../../core/dom/classes.js";
3
3
  import { setHTML } from "../../core/dom/html.js";
4
+ import { getIcon } from "../../core/icons/registry.js";
4
5
  import { deepActiveElement, tabStops, wrapTab } from "../../core/dom/focus.js";
5
6
  import { hideFromTopLayer, onModalEscape, onTopLayerClose, showInTopLayer } from "../../core/dom/layer.js";
6
7
  const DIALOG_EVENTS = {
@@ -45,18 +46,16 @@ if (showCloseButton) {
45
46
  const closeButton = document.createElement("button");
46
47
  closeButton.classList.add(component.getClass("dialog__header-close"));
47
48
  closeButton.setAttribute("aria-label", "Close dialog");
48
- setHTML(closeButton, `
49
+ setHTML(closeButton, getIcon("close", `
49
50
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
50
51
  <line x1="18" y1="6" x2="6" y2="18"></line>
51
52
  <line x1="6" y1="6" x2="18" y2="18"></line>
52
53
  </svg>
53
- `);
54
+ `));
54
55
  closeButton.addEventListener("click", (e) => {
55
56
  e.preventDefault();
56
57
  e.stopPropagation();
57
- if (component && component.emit) {
58
58
  component.emit("dialog:close", { source: "closeButton" });
59
- }
60
59
  });
61
60
  header.appendChild(closeButton);
62
61
  }
@@ -209,10 +208,8 @@ console.error("Error in onClick handler:", err);
209
208
  }
210
209
  }
211
210
  if (shouldClose) {
212
- if (component && component.emit) {
213
211
  component.emit("dialog:close", { source: "button", text });
214
212
  }
215
- }
216
213
  });
217
214
  if (autofocus) {
218
215
  button.element.setAttribute("autofocus", "true");
@@ -516,11 +513,9 @@ cleanupEvents();
516
513
  unscopeScrim();
517
514
  },
518
515
  };
519
- if (component && component.on) {
520
516
  component.on("dialog:close", () => {
521
517
  visibility.close();
522
518
  });
523
- }
524
519
  if (top) {
525
520
  onTopLayerClose(component.element, () => visibility.close(true));
526
521
  }
@@ -555,7 +550,7 @@ titleElement.textContent = title;
555
550
  },
556
551
  getTitle() {
557
552
  const titleElement = headerElement.querySelector(`.${component.getClass("dialog__header-title")}`);
558
- return titleElement ? titleElement.textContent || "" : "";
553
+ return titleElement?.textContent || "";
559
554
  },
560
555
  setSubtitle(subtitle) {
561
556
  let subtitleElement = headerElement.querySelector(`.${component.getClass("dialog__header-subtitle")}`);
@@ -572,7 +567,7 @@ subtitleElement.textContent = subtitle;
572
567
  },
573
568
  getSubtitle() {
574
569
  const subtitleElement = headerElement.querySelector(`.${component.getClass("dialog__header-subtitle")}`);
575
- return subtitleElement ? subtitleElement.textContent || "" : "";
570
+ return subtitleElement?.textContent || "";
576
571
  },
577
572
  setContent(content) {
578
573
  setHTML(contentElement, content);
@@ -616,21 +611,13 @@ component.structure.footer = footer;
616
611
  addButton(footer, button, component, getComponent);
617
612
  },
618
613
  removeButton(indexOrText) {
619
- if (typeof indexOrText === "number") {
620
- if (indexOrText >= 0 && indexOrText < buttonRecords.length) {
621
- const button = buttonRecords[indexOrText];
622
- button.instance.destroy();
623
- buttonRecords.splice(indexOrText, 1);
624
- }
625
- }
626
- else {
627
- const index = buttonRecords.findIndex((button) => button.config.text === indexOrText);
628
- if (index !== -1) {
614
+ const numeric = typeof indexOrText === "number";
615
+ const index = numeric ? indexOrText : buttonRecords.findIndex((button) => button.config.text === indexOrText);
616
+ if (numeric ? index >= 0 && index < buttonRecords.length : index !== -1) {
629
617
  const button = buttonRecords[index];
630
618
  button.instance.destroy();
631
619
  buttonRecords.splice(index, 1);
632
620
  }
633
- }
634
621
  if (buttonRecords.length === 0 && component.structure.footer) {
635
622
  component.element.removeChild(component.structure.footer);
636
623
  component.structure.footer = null;
@@ -643,11 +630,9 @@ setFooterAlignment(alignment) {
643
630
  const footer = component.structure.footer;
644
631
  if (!footer)
645
632
  return;
646
- const ALL_ALIGNMENTS = ["right", "left", "center", "space-between"];
633
+ const ALL_ALIGNMENTS = ["left", "center", "space-between"];
647
634
  ALL_ALIGNMENTS.forEach((align) => {
648
- if (align !== "right") {
649
635
  removeClass(footer, `${component.getClass("dialog__footer")}--${align}`);
650
- }
651
636
  });
652
637
  if (alignment !== "right") {
653
638
  addClass(footer, `${component.getClass("dialog__footer")}--${alignment}`);
@@ -1,6 +1,12 @@
1
1
  import type { EventCallback } from "../../core/state/emitter.js";
2
2
  import type { ButtonComponent } from "../button/types.js";
3
3
 
4
+ /**
5
+ * Creates a new Dialog component with the specified configuration.
6
+ * @param config
7
+ */
8
+ declare const createDialog: (config?: DialogConfig) => DialogComponent;
9
+
4
10
  /** Dialog size types - determines the width and height of the dialog */
5
11
  type DialogSize = 'small' | 'medium' | 'large' | 'fullwidth' | 'fullscreen';
6
12
 
@@ -323,11 +329,5 @@ declare module "../../core/config/global" {
323
329
  dialog?: Partial<DialogConfig>;
324
330
  }
325
331
  }
326
-
327
- /**
328
- * Creates a new Dialog component with the specified configuration.
329
- * @param config
330
- */
331
- declare const createDialog: (config?: DialogConfig) => DialogComponent;
332
332
  export type { DialogAnimation, DialogButton, DialogComponent, DialogConfig, DialogConfirmOptions, DialogEvent, DialogEventType, DialogFooterAlignment, DialogSize };
333
333
  export { createDialog, createDialog as default };