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
@@ -5,6 +5,48 @@ import { BaseComponent, ElementComponent } from "../../core/compose/index.js";
5
5
  * @param config
6
6
  */
7
7
  declare const createDivider: (config?: DividerConfig) => DividerComponent;
8
+ /** Configuration options for divider components Controls the appearance, orientation, and behavior of Material Design 3 dividers. */
9
+ interface DividerConfig {
10
+ /** CSS class prefix (defaults to 'mtrl') */
11
+ prefix?: string;
12
+ /** CSS class to add to the divider Additional classes for custom styling needs. */
13
+ class?: string | string[];
14
+ /**
15
+ * Orientation of the divider
16
+ * @default 'horizontal'
17
+ */
18
+ orientation?: 'horizontal' | 'vertical';
19
+ /**
20
+ * Variant of the divider Controls how the divider is inset within its container: - 'full-width': Spans the entire width/height (default) - 'inset': Adds space at the start (left for horizontal, top for vertical) - 'middle-inset': Adds space at both start and end Most commonly used in lists to align dividers with text content.
21
+ * @default 'full-width'
22
+ */
23
+ variant?: 'full-width' | 'inset' | 'middle-inset';
24
+ /**
25
+ * 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
27
+ */
28
+ insetStart?: number;
29
+ /**
30
+ * 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'
32
+ */
33
+ insetEnd?: number;
34
+ /** Color of the divider Sets a custom color for the divider. */
35
+ color?: string;
36
+ /**
37
+ * Thickness of the divider in pixels Controls the thickness (height for horizontal, width for vertical) of the divider.
38
+ * @default 1
39
+ */
40
+ thickness?: number;
41
+ /** Used internally for component composition */
42
+ componentName?: string;
43
+ }
44
+
45
+
46
+ declare const defaultConfig: Partial<DividerConfig>;
47
+
48
+
49
+ declare const createBaseConfig: (config?: DividerConfig) => DividerConfig;
8
50
 
9
51
  /** The three slices of a divider, one per enhancer in features.ts. */
10
52
  interface DividerOrientation {
@@ -51,47 +93,5 @@ interface DividerStyle {
51
93
  /** Divider component interface Represents a Material Design 3 divider that separates content into distinct sections. */
52
94
  interface DividerComponent extends BaseComponent, ElementComponent, DividerOrientation, DividerInset, DividerStyle {
53
95
  }
54
- /** Configuration options for divider components Controls the appearance, orientation, and behavior of Material Design 3 dividers. */
55
- interface DividerConfig {
56
- /** CSS class prefix (defaults to 'mtrl') */
57
- prefix?: string;
58
- /** CSS class to add to the divider Additional classes for custom styling needs. */
59
- class?: string | string[];
60
- /**
61
- * Orientation of the divider
62
- * @default 'horizontal'
63
- */
64
- orientation?: 'horizontal' | 'vertical';
65
- /**
66
- * Variant of the divider Controls how the divider is inset within its container: - 'full-width': Spans the entire width/height (default) - 'inset': Adds space at the start (left for horizontal, top for vertical) - 'middle-inset': Adds space at both start and end Most commonly used in lists to align dividers with text content.
67
- * @default 'full-width'
68
- */
69
- variant?: 'full-width' | 'inset' | 'middle-inset';
70
- /**
71
- * Custom inset value (left margin for horizontal, top margin for vertical) Overrides the default inset spacing at the start of the divider.
72
- * @default 16 for 'inset' and 'middle-inset' variants
73
- */
74
- insetStart?: number;
75
- /**
76
- * Custom inset end value (right margin for horizontal, bottom margin for vertical) Overrides the default inset spacing at the end of the divider.
77
- * @default 0 for 'inset', 16 for 'middle-inset'
78
- */
79
- insetEnd?: number;
80
- /** Color of the divider Sets a custom color for the divider. */
81
- color?: string;
82
- /**
83
- * Thickness of the divider in pixels Controls the thickness (height for horizontal, width for vertical) of the divider.
84
- * @default 1
85
- */
86
- thickness?: number;
87
- /** Used internally for component composition */
88
- componentName?: string;
89
- }
90
-
91
-
92
- declare const defaultConfig: Partial<DividerConfig>;
93
-
94
-
95
- declare const createBaseConfig: (config?: DividerConfig) => DividerConfig;
96
96
  export type { DividerComponent, DividerConfig };
97
97
  export { createDivider, createDivider as default };
@@ -2,6 +2,12 @@ import type { IconManager } from "../../core/compose/features/icon.js";
2
2
  import type { ForwardedEventPayload } from "../../core/dom/create.js";
3
3
  import type { TouchEvents } from "../../core/utils/mobile.js";
4
4
 
5
+ /**
6
+ * Creates a new Floating Action Button (FAB) component Floating Action Buttons (FABs) represent the primary action in an application.
7
+ * @param config
8
+ */
9
+ declare const createFab: (config: FabConfig) => FabComponent;
10
+
5
11
  /** FAB variants following Material Design 3 guidelines Material Design 3 offers different color variants for the FAB to match visual hierarchy and application color schemes. */
6
12
  type FabVariant = "primary-container" | "secondary-container" | "tertiary-container" | "primary" | "secondary" | "tertiary";
7
13
 
@@ -173,11 +179,5 @@ interface FabComponent {
173
179
  */
174
180
  addClass: (...classes: string[]) => FabComponent;
175
181
  }
176
-
177
- /**
178
- * Creates a new Floating Action Button (FAB) component Floating Action Buttons (FABs) represent the primary action in an application.
179
- * @param config
180
- */
181
- declare const createFab: (config: FabConfig) => FabComponent;
182
182
  export type { FabComponent, FabConfig, FabEvents, FabPlacement, FabPosition, FabSize, FabVariant };
183
183
  export { createFab, createFab as default };
@@ -5,6 +5,7 @@ import { withEvents, withLifecycle } from "../../core/compose/features/index.js"
5
5
  import { getCleanup } from "../../core/compose/cleanup.js";
6
6
  import { PREFIX } from "../../core/config.js";
7
7
  import { setHTML } from "../../core/dom/html.js";
8
+ import { getIcon } from "../../core/icons/registry.js";
8
9
  import { warnDev } from "../../core/utils/warn.js";
9
10
  import createFab from "../fab/index.js";
10
11
  import { createConfig, CLOSE_ICON } from "./config.js";
@@ -49,7 +50,7 @@ button.setAttribute("aria-controls", `${id}-list`);
49
50
  const closeIcon = document.createElement("span");
50
51
  closeIcon.className = `${block}__close`;
51
52
  closeIcon.setAttribute("aria-hidden", "true");
52
- setHTML(closeIcon, settings.closeIcon || CLOSE_ICON);
53
+ setHTML(closeIcon, settings.closeIcon || getIcon("close", CLOSE_ICON));
53
54
  button.appendChild(closeIcon);
54
55
  root.appendChild(button);
55
56
  const list = document.createElement("div");
@@ -224,7 +225,8 @@ menu.close();
224
225
  else
225
226
  setOpened(false);
226
227
  };
227
- button.addEventListener("click", (event) => (opened ? close() : open(event)));
228
+ const toggle = (event) => opened ? close() : open(event);
229
+ button.addEventListener("click", toggle);
228
230
  button.addEventListener("keydown", (event) => {
229
231
  if (!opened || presentation !== "list")
230
232
  return;
@@ -299,10 +301,7 @@ close();
299
301
  return this;
300
302
  },
301
303
  toggle(event) {
302
- if (opened)
303
- close();
304
- else
305
- open(event);
304
+ toggle(event);
306
305
  return this;
307
306
  },
308
307
  isOpen() {
@@ -95,6 +95,13 @@ interface FabMenuComponent extends ElementComponent {
95
95
  destroy(): void;
96
96
  }
97
97
 
98
+ /** Registers FabMenuConfig with the global defaults map, so `setComponentDefaults("fab-menu", ...)` is typed without core importing anything from this component. */
99
+ declare module "../../core/config/global" {
100
+ interface ComponentConfigMap {
101
+ "fab-menu"?: Partial<FabMenuConfig>;
102
+ }
103
+ }
104
+
98
105
  /**
99
106
  * Creates a FAB menu: M3 Expressive's FAB that opens a list of related actions.
100
107
  * @param config
@@ -1,10 +1,20 @@
1
1
  import type { ForwardedEventPayload } from "../../core/dom/index.js";
2
2
 
3
+ /** Options for {@link withSingleSelectListbox}. */
4
+ interface SingleSelectListboxOptions {
5
+ /**
6
+ * Where the visual-only radio indicator sits: before the row's content (`"leading"`, the default) or after it (`"trailing"`).
7
+ * @default "leading"
8
+ */
9
+ indicator?: "leading" | "trailing";
10
+ }
11
+
3
12
  /**
4
- * 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.
5
- * @param config
13
+ * Turns a created list into a single-select listbox (`role="listbox"` with `role="option"` rows, `aria-selected`, a visual-only radio, one tab stop).
14
+ * @param component
15
+ * @param options
6
16
  */
7
- declare const createList: (config?: Partial<ListConfig<ListItem>>) => ListComponent<ListItem>;
17
+ declare const withSingleSelectListbox: (component: ListComponent<ListItem>, options?: SingleSelectListboxOptions) => ListComponent<ListItem>;
8
18
 
9
19
  /** List variant types following Material Design 3 guidelines. */
10
20
  type ListVariant = 'standard' | 'segmented';
@@ -279,21 +289,11 @@ interface ListEvents<T = unknown> {
279
289
  keydown: (event: ForwardedEventPayload<KeyboardEvent, HTMLElement>) => void;
280
290
  }
281
291
 
282
- /** Options for {@link withSingleSelectListbox}. */
283
- interface SingleSelectListboxOptions {
284
- /**
285
- * Where the visual-only radio indicator sits: before the row's content (`"leading"`, the default) or after it (`"trailing"`).
286
- * @default "leading"
287
- */
288
- indicator?: "leading" | "trailing";
289
- }
290
-
291
292
  /**
292
- * Turns a created list into a single-select listbox (`role="listbox"` with `role="option"` rows, `aria-selected`, a visual-only radio, one tab stop).
293
- * @param component
294
- * @param options
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
295
  */
296
- declare const withSingleSelectListbox: (component: ListComponent<ListItem>, options?: SingleSelectListboxOptions) => ListComponent<ListItem>;
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";
@@ -0,0 +1,100 @@
1
+ /** The lean selection popup's public types. */
2
+ /** One option of a listbox. */
3
+ interface ListboxOption<T = unknown> {
4
+ /** The value the option commits. */
5
+ id: string;
6
+ /** The row's text, set as `textContent` -- never HTML. */
7
+ text: string;
8
+ /** A disabled option is shown and read, but navigation and activation skip it. */
9
+ disabled?: boolean;
10
+ /** Returned to the application with the option; never rendered. */
11
+ data?: T;
12
+ }
13
+
14
+ /** What the `open` and `close` events carry. */
15
+ interface ListboxEventDetail<T = unknown> {
16
+ /** The listbox that emitted the event. */
17
+ listbox: ListboxComponent<T>;
18
+ /** The event that caused it, when there was one. */
19
+ originalEvent?: Event;
20
+ }
21
+
22
+ /** What the `change` event carries: the value a user choice committed. */
23
+ interface ListboxChangeDetail<T = unknown> extends ListboxEventDetail<T> {
24
+ /** The committed option's id. */
25
+ value: string;
26
+ /** The value before this choice. */
27
+ previousValue: string | null;
28
+ /** The committed option, as a snapshot. */
29
+ option: ListboxOption<T>;
30
+ }
31
+
32
+ /** The listbox's typed events, by name. */
33
+ interface ListboxEvents<T = unknown> {
34
+ open: ListboxEventDetail<T>;
35
+ change: ListboxChangeDetail<T>;
36
+ close: ListboxEventDetail<T>;
37
+ }
38
+
39
+ /** The handler each typed event takes, by event name. */
40
+ type ListboxEventHandlers<T = unknown> = {
41
+ [K in keyof ListboxEvents<T>]: (detail: ListboxEvents<T>[K]) => void;
42
+ };
43
+
44
+ /** Configuration for `createListbox`. */
45
+ interface ListboxConfig<T = unknown> {
46
+ /** The dedicated value control. */
47
+ control: HTMLDivElement;
48
+ /** The nonempty accessible name, distinct from the value text. */
49
+ ariaLabel: string;
50
+ /** The options, in display order. */
51
+ options: readonly ListboxOption<T>[];
52
+ /** The initial selected option's id, or `null` for none. */
53
+ value?: string | null;
54
+ /** The control's text while no option is selected. */
55
+ placeholder?: string;
56
+ /** A disabled control stays in the tab order but cannot open or change. */
57
+ disabled?: boolean;
58
+ /** Event handlers, installed before the first interaction. */
59
+ on?: Partial<ListboxEventHandlers<T>>;
60
+ }
61
+
62
+ /** The handle `createListbox` returns. */
63
+ interface ListboxComponent<T = unknown> {
64
+ /** The popup root (`role="listbox"`), stable until `destroy()`. */
65
+ element: HTMLElement;
66
+ /** Opens the popup, focusing the control. */
67
+ open: (event?: Event) => ListboxComponent<T>;
68
+ /** Closes the popup without committing. */
69
+ close: (event?: Event) => ListboxComponent<T>;
70
+ /** Opens a closed popup, closes an open one. */
71
+ toggle: (event?: Event) => ListboxComponent<T>;
72
+ /** Whether the popup is showing. */
73
+ isOpen: () => boolean;
74
+ /** The committed option's id, or `null`. */
75
+ getValue: () => string | null;
76
+ /** Selects an option by id, or clears the selection with `null`. */
77
+ setValue: (value: string | null) => ListboxComponent<T>;
78
+ /** The options, as snapshots: mutating them cannot bypass rendering. */
79
+ getOptions: () => ListboxOption<T>[];
80
+ /** Replaces the options, validating all of them before changing anything. */
81
+ setOptions: (options: readonly ListboxOption<T>[]) => ListboxComponent<T>;
82
+ /** Disables or enables the control; disabling closes without committing. */
83
+ setDisabled: (disabled: boolean) => ListboxComponent<T>;
84
+ /** Whether the control is disabled. */
85
+ isDisabled: () => boolean;
86
+ /** Subscribes to an event. */
87
+ on: <K extends keyof ListboxEvents<T>>(type: K, handler: (detail: ListboxEvents<T>[K]) => void) => ListboxComponent<T>;
88
+ /** Removes the exact subscription. */
89
+ off: <K extends keyof ListboxEvents<T>>(type: K, handler: (detail: ListboxEvents<T>[K]) => void) => ListboxComponent<T>;
90
+ /** Idempotent and terminal. */
91
+ destroy: () => void;
92
+ }
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
+ export type { ListboxChangeDetail, ListboxComponent, ListboxConfig, ListboxEventDetail, ListboxEventHandlers, ListboxEvents, ListboxOption };
100
+ export { createListbox, createListbox as default };
@@ -0,0 +1 @@
1
+ export { default, default as createListbox } from "./listbox.js";