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
@@ -1,25 +1,6 @@
1
1
  import type { BadgeComponent as Badge } from "../../components/badge/index.js";
2
2
  import { EventCallback } from "../state/emitter.js";
3
3
  import { BaseComponent, ElementComponent } from "./component.js";
4
-
5
- /** Interface for components with lifecycle */
6
- interface ComponentWithLifecycle extends ElementComponent {
7
- lifecycle: {
8
- destroy: () => void;
9
- [key: string]: unknown;
10
- };
11
- }
12
-
13
- /** Interface for components with emit method */
14
- interface ComponentWithEmit extends ElementComponent {
15
- emit: (event: string, data: unknown) => unknown;
16
- }
17
-
18
- /** Type guard to check if component has lifecycle */
19
- declare function hasLifecycle(component: object): component is ComponentWithLifecycle;
20
-
21
- /** Type guard to check if component has emit method */
22
- declare function hasEmit(component: object): component is ComponentWithEmit;
23
4
  /**
24
5
  * Performs left-to-right function composition.
25
6
  * @param fns
@@ -117,6 +98,25 @@ declare function compose<T>(...fns: Array<(arg: T) => T>): (x: T) => T;
117
98
  * @param transformers
118
99
  */
119
100
  declare const transform: <T, C = Record<string, unknown>>(...transformers: Array<(obj: T, context: C) => Partial<T>>) => (obj: T, context?: C) => T;
101
+
102
+ /** Interface for components with lifecycle */
103
+ interface ComponentWithLifecycle extends ElementComponent {
104
+ lifecycle: {
105
+ destroy: () => void;
106
+ [key: string]: unknown;
107
+ };
108
+ }
109
+
110
+ /** Interface for components with emit method */
111
+ interface ComponentWithEmit extends ElementComponent {
112
+ emit: (event: string, data: unknown) => unknown;
113
+ }
114
+
115
+ /** Type guard to check if component has lifecycle */
116
+ declare function hasLifecycle(component: object): component is ComponentWithLifecycle;
117
+
118
+ /** Type guard to check if component has emit method */
119
+ declare function hasEmit(component: object): component is ComponentWithEmit;
120
120
  /** Configuration for component creation */
121
121
  interface ComponentConfig {
122
122
  [key: string]: unknown;
@@ -138,118 +138,62 @@ interface Component {
138
138
  */
139
139
  declare const createComponent: (config?: object) => Component;
140
140
 
141
-
142
- interface ComponentManagers {
143
- events?: {
144
- destroy: () => void;
145
- };
146
- text?: {
147
- getElement: () => HTMLElement | null;
148
- };
149
- icon?: {
150
- getElement: () => HTMLElement | null;
151
- };
152
- [key: string]: unknown;
141
+ /** Input configuration options */
142
+ interface InputConfig {
143
+ /** Input name attribute */
144
+ name?: string;
145
+ /** Initial checked state */
146
+ checked?: boolean;
147
+ /** Whether input is required */
148
+ required?: boolean;
149
+ /** Whether input is disabled */
150
+ disabled?: boolean;
151
+ /** Input value attribute */
152
+ value?: string;
153
+ /** Accessibility label text */
154
+ label?: string | Node;
155
+ /** Alternative accessibility label */
156
+ ariaLabel?: string;
157
+ /** Component name for classes */
158
+ componentName?: string;
159
+ /**
160
+ * Whether Enter toggles the input as Space does
161
+ * @default true
162
+ */
163
+ enterToggles?: boolean;
153
164
  }
154
165
 
155
- /** Lifecycle methods interface */
156
- interface Lifecycle {
166
+ /** What withInput adds to a component. */
167
+ interface InputFeature {
168
+ /** Input element */
169
+ input: HTMLInputElement;
170
+ /** Gets the checked state: the `value` a `change` carries */
171
+ getValue: () => boolean;
157
172
  /**
158
- * Registers a handler for mount event
159
- * @param handler
173
+ * Checks or unchecks the input.
174
+ * @param value
160
175
  */
161
- onMount: (handler: () => void) => () => void;
176
+ setValue(value: boolean): this;
177
+ /** Gets the input's `value` attribute: the string a form submits while checked */
178
+ getValueAttribute: () => string;
162
179
  /**
163
- * Registers a handler for unmount event
164
- * @param handler
165
- */
166
- onUnmount: (handler: () => void) => () => void;
167
- /** Mounts the component */
168
- mount: () => void;
169
- /** Unmounts the component */
170
- unmount: () => void;
171
- /** Checks if component is mounted */
172
- isMounted: () => boolean;
173
- /** Destroys the component */
174
- destroy: () => void;
175
- }
176
-
177
- /** Component with lifecycle capabilities */
178
- interface LifecycleComponent extends BaseComponent {
179
- lifecycle: Lifecycle;
180
- }
181
-
182
- /** Adds lifecycle management to a component */
183
- declare const withLifecycle: () => <T extends BaseComponent & Partial<Pick<ElementComponent, "element" | "destroy">>>(component: T) => T & LifecycleComponent;
184
-
185
- /** Configuration for style feature */
186
- interface StyleConfig {
187
- variant?: string;
188
- size?: string;
189
- }
190
-
191
- /**
192
- * Adds style classes to a component based on configuration
193
- * @param config
180
+ * Sets the input's `value` attribute.
181
+ * @param value
194
182
  */
195
- declare const withStyle: <T extends StyleConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C;
196
-
197
- /** Configuration for track feature */
198
- interface TrackConfig {
199
- /** CSS class prefix */
200
- prefix: string;
201
- /** Component name for class generation */
202
- componentName: string;
203
- /** Custom icon HTML or 'none' */
204
- icon?: string;
205
- /** Icon HTML shown in the unselected handle, which then grows to 24dp: M3's "icon on selected and unselected switch" configuration. */
206
- unselectedIcon?: string;
207
- /** When true, the thumb graphic is `aria-hidden`. */
208
- controlLabelOnly?: boolean;
183
+ setValueAttribute(value: string): this;
184
+ /** Event emission method if available */
185
+ emit?(event: string, data: unknown): this;
209
186
  }
210
187
 
211
- /** Component with track and thumb elements */
212
- interface TrackComponent extends BaseComponent {
213
- /** Track element */
214
- track: HTMLElement;
215
- /** Thumb element */
216
- thumb: HTMLElement;
188
+ /** Component with input element and related methods */
189
+ interface InputComponent extends ElementComponent, InputFeature {
217
190
  }
218
191
 
219
192
  /**
220
- * Adds track and thumb elements to a component
193
+ * Creates an input element and adds it to a component Handles both input creation and event emission for state changes `change` carries `{ checked, value, valueAttribute, nativeEvent }`: `value` is the checked boolean, as the checkbox and the switch report it, and `valueAttribute` the input's string value.
221
194
  * @param config
222
195
  */
223
- declare const withTrack: <T extends TrackConfig>(config: T) => <C extends ElementComponent>(component: C) => C & TrackComponent;
224
-
225
- /** Event manager interface */
226
- interface EnhancedEventManager {
227
- /** Add an event listener */
228
- on: (event: string, handler: Function) => EnhancedEventManager;
229
- /** Remove an event listener */
230
- off: (event: string, handler: Function) => EnhancedEventManager;
231
- /** Add multiple event listeners at once */
232
- addListeners: (listeners: Record<string, Function>) => EnhancedEventManager;
233
- /** Remove multiple event listeners at once */
234
- removeListeners: (listeners: Record<string, Function>) => EnhancedEventManager;
235
- /** One-time event handler */
236
- once: (event: string, handler: Function) => EnhancedEventManager;
237
- /** Clean up all event listeners */
238
- destroy: () => void;
239
- }
240
-
241
- /** Component with enhanced event capabilities */
242
- interface EnhancedEventComponent extends BaseComponent {
243
- events: EnhancedEventManager;
244
- on(event: string, handler: Function): this;
245
- off(event: string, handler: Function): this;
246
- }
247
-
248
- /**
249
- * Adds enhanced event handling capabilities to a component
250
- * @param target
251
- */
252
- declare const withEnhancedEvents: (target?: HTMLElement) => <C extends ElementComponent>(component: C) => C & EnhancedEventComponent;
196
+ declare const withInput: <T extends InputConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & InputFeature;
253
197
 
254
198
  /** Configuration for text input feature */
255
199
  interface TextInputConfig {
@@ -324,91 +268,161 @@ interface TextInputComponent extends ElementComponent, TextInputFeature {
324
268
  */
325
269
  declare const withTextInput: <T extends TextInputConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & TextInputFeature;
326
270
 
327
- /** Configuration for throttled event handlers */
328
- interface ThrottleConfig {
329
- /** Event handlers with throttle settings */
330
- throttledEvents?: Record<string, {
331
- handler: (event: Event) => void;
332
- wait: number;
333
- options?: {
334
- leading?: boolean;
335
- trailing?: boolean;
336
- };
337
- }>;
271
+ /** Event manager interface */
272
+ interface EnhancedEventManager {
273
+ /** Add an event listener */
274
+ on: (event: string, handler: Function) => EnhancedEventManager;
275
+ /** Remove an event listener */
276
+ off: (event: string, handler: Function) => EnhancedEventManager;
277
+ /** Add multiple event listeners at once */
278
+ addListeners: (listeners: Record<string, Function>) => EnhancedEventManager;
279
+ /** Remove multiple event listeners at once */
280
+ removeListeners: (listeners: Record<string, Function>) => EnhancedEventManager;
281
+ /** One-time event handler */
282
+ once: (event: string, handler: Function) => EnhancedEventManager;
283
+ /** Clean up all event listeners */
284
+ destroy: () => void;
338
285
  }
339
286
 
340
- /** Component with throttled event capabilities */
341
- interface ThrottleComponent extends BaseComponent {
287
+ /** Component with enhanced event capabilities */
288
+ interface EnhancedEventComponent extends BaseComponent {
289
+ events: EnhancedEventManager;
290
+ on(event: string, handler: Function): this;
291
+ off(event: string, handler: Function): this;
292
+ }
293
+
294
+ /**
295
+ * Adds enhanced event handling capabilities to a component
296
+ * @param target
297
+ */
298
+ declare const withEnhancedEvents: (target?: HTMLElement) => <C extends ElementComponent>(component: C) => C & EnhancedEventComponent;
299
+
300
+ /** A component's events, by name: each one's handler. */
301
+ type EventMap<E> = {
302
+ [K in keyof E]: EventCallback;
303
+ };
304
+
305
+ /** The map of a component that does not name its events. */
306
+ type AnyEvents = Record<string, EventCallback>;
307
+
308
+ /** Component with event capabilities */
309
+ interface EventComponent<E extends EventMap<E> = AnyEvents> extends BaseComponent {
342
310
  /**
343
- * Adds a throttled event listener
311
+ * Subscribe to an event
344
312
  * @param event
345
313
  * @param handler
346
- * @param wait
347
- * @param options
348
314
  */
349
- addThrottledEvent: (event: string, handler: (event: Event) => void, wait: number, options?: {
350
- leading?: boolean;
351
- trailing?: boolean;
352
- }) => ThrottleComponent;
315
+ on<K extends keyof E & string>(event: K, handler: E[K]): this;
353
316
  /**
354
- * Removes a throttled event listener
317
+ * Unsubscribe from an event
355
318
  * @param event
319
+ * @param handler
356
320
  */
357
- removeThrottledEvent: (event: string) => ThrottleComponent;
358
- }
359
-
360
- /**
361
- * Adds throttled event handling capabilities to a component
362
- * @param config
321
+ off<K extends keyof E & string>(event: K, handler: E[K]): this;
322
+ /**
323
+ * Emit an event
324
+ * @param event
325
+ * @param data
363
326
  */
364
- declare const withThrottle: <T extends ThrottleConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & ThrottleComponent;
327
+ emit(event: string, data?: unknown): this;
328
+ }
365
329
 
330
+ /** Adds event handling capabilities to a component Returns event system ready to use immediately `withEvents<Events>()` names the component's events: `on` and `off` then check each name and its handler's payload. */
331
+ declare const withEvents: <E extends EventMap<E> = AnyEvents>() => <T extends BaseComponent>(component: T) => T & EventComponent<E>;
366
332
 
367
- interface ComponentWithLifecycle_1 extends ElementComponent {
368
- lifecycle: {
369
- destroy: () => void;
370
- [key: string]: unknown;
371
- };
333
+ /** Configuration for checkable feature */
334
+ interface CheckableConfig {
335
+ checked?: boolean;
372
336
  }
373
337
 
374
- /** Configuration for debounced event handlers */
375
- interface DebounceConfig {
376
- /** Event handlers with debounce settings */
377
- debouncedEvents?: Record<string, {
378
- handler: (event: Event) => void;
379
- wait: number;
380
- options?: {
381
- leading?: boolean;
382
- maxWait?: number;
383
- };
384
- }>;
338
+ /** Component with input element */
339
+ interface InputComponent_1 extends BaseComponent {
340
+ element: HTMLElement;
341
+ input: HTMLInputElement;
342
+ emit?: (event: string, data: unknown) => unknown;
343
+ /** This feature only subscribes to change and does not read its payload. */
344
+ on?: (event: "change", handler: () => void) => unknown;
385
345
  }
386
346
 
387
- /** Component with debounced event capabilities */
388
- interface DebounceComponent extends BaseComponent {
389
- /**
390
- * Adds a debounced event listener
391
- * @param event
392
- * @param handler
393
- * @param wait
394
- * @param options
347
+ /** Checkable state manager interface */
348
+ interface CheckableManager {
349
+ /** Sets the checked state to true. */
350
+ check: () => CheckableManager;
351
+ /** Sets the checked state to false. */
352
+ uncheck: () => CheckableManager;
353
+ /** Toggles the current checked state. */
354
+ toggle: () => CheckableManager;
355
+ /** Gets the current checked state */
356
+ isChecked: () => boolean;
357
+ }
358
+
359
+ /** Component with checkable capabilities */
360
+ interface CheckableComponent extends BaseComponent {
361
+ checkable: CheckableManager;
362
+ }
363
+
364
+ /**
365
+ * Adds checked state management to a component with an input
366
+ * @param config
395
367
  */
396
- addDebouncedEvent: (event: string, handler: (event: Event) => void, wait: number, options?: {
397
- leading?: boolean;
398
- maxWait?: number;
399
- }) => DebounceComponent;
400
- /**
401
- * Removes a debounced event listener
402
- * @param event
368
+ declare const withCheckable: <T extends CheckableConfig & object>(config?: T) => <C extends InputComponent_1>(component: C) => C & CheckableComponent;
369
+
370
+ /** Configuration for track feature */
371
+ interface TrackConfig {
372
+ /** CSS class prefix */
373
+ prefix: string;
374
+ /** Component name for class generation */
375
+ componentName: string;
376
+ /** Custom icon HTML or 'none' */
377
+ icon?: string;
378
+ /** Icon HTML shown in the unselected handle, which then grows to 24dp: M3's "icon on selected and unselected switch" configuration. */
379
+ unselectedIcon?: string;
380
+ /** When true, the thumb graphic is `aria-hidden`. */
381
+ controlLabelOnly?: boolean;
382
+ }
383
+
384
+ /** Component with track and thumb elements */
385
+ interface TrackComponent extends BaseComponent {
386
+ /** Track element */
387
+ track: HTMLElement;
388
+ /** Thumb element */
389
+ thumb: HTMLElement;
390
+ }
391
+
392
+ /**
393
+ * Adds track and thumb elements to a component
394
+ * @param config
403
395
  */
404
- removeDebouncedEvent: (event: string) => DebounceComponent;
396
+ declare const withTrack: <T extends TrackConfig>(config: T) => <C extends ElementComponent>(component: C) => C & TrackComponent;
397
+
398
+ /** Configuration for disabled feature */
399
+ interface DisabledConfig {
400
+ disabled?: boolean;
401
+ componentName?: string;
402
+ }
403
+
404
+ /** Disabled state manager interface */
405
+ interface DisabledManager {
406
+ /** Enables the component */
407
+ enable(): DisabledManager;
408
+ /** Disables the component */
409
+ disable(): DisabledManager;
410
+ /** Toggles the disabled state */
411
+ toggle(): DisabledManager;
412
+ /** Checks if the component is disabled */
413
+ isDisabled(): boolean;
414
+ }
415
+
416
+ /** Component with disabled state capabilities */
417
+ interface DisabledComponent extends BaseComponent {
418
+ disabled: DisabledManager;
405
419
  }
406
420
 
407
421
  /**
408
- * Adds debounced event handling capabilities to a component
422
+ * Adds disabled state management to a component
409
423
  * @param config
410
424
  */
411
- declare const withDebounce: <T extends DebounceConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & DebounceComponent;
425
+ declare const withDisabled: <T extends DisabledConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C & DisabledComponent;
412
426
 
413
427
  /** Configuration for text label feature */
414
428
  interface TextLabelConfig {
@@ -447,172 +461,64 @@ interface LabelComponent extends BaseComponent {
447
461
  */
448
462
  declare const withTextLabel: <T extends TextLabelConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & LabelComponent;
449
463
 
450
- /** Configuration for size feature */
451
- interface SizeConfig {
464
+ /** Configuration for style feature */
465
+ interface StyleConfig {
466
+ variant?: string;
452
467
  size?: string;
453
- prefix?: string;
454
- componentName?: string;
455
468
  }
456
469
 
457
470
  /**
458
- * Adds a size class to a component
459
- * @param config
460
- */
461
- declare const withSize: <T extends SizeConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C;
462
-
463
- /** Ripple configuration interface */
464
- interface RippleConfig {
465
- /** How long, in milliseconds, a released wave lingers before it is removed */
466
- duration?: number;
467
- }
468
-
469
- /** Ripple controller interface */
470
- interface RippleController {
471
- /**
472
- * Mounts ripple effect to an element
473
- * @param element
474
- */
475
- mount: (element: HTMLElement) => void;
476
- /**
477
- * Unmounts ripple effect from an element
478
- * @param element
479
- */
480
- unmount: (element: HTMLElement) => void;
481
- }
482
-
483
- /** Configuration for ripple feature */
484
- interface RippleFeatureConfig {
485
- ripple?: boolean;
486
- rippleConfig?: RippleConfig;
487
- }
488
-
489
- /** Component with ripple capabilities */
490
- interface RippleComponent extends BaseComponent {
491
- ripple: RippleController;
492
- }
493
-
494
- declare const createRipple: (config?: RippleConfig) => RippleController;
495
-
496
- /**
497
- * Adds ripple effect functionality to a component
471
+ * Adds style classes to a component based on configuration
498
472
  * @param config
499
473
  */
500
- declare const withRipple: <T extends RippleFeatureConfig & object>(config: T) => <C extends ElementComponent & Partial<LifecycleComponent>>(component: C) => C & RippleComponent;
474
+ declare const withStyle: <T extends StyleConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C;
501
475
 
502
476
 
503
- interface BadgeConfig {
504
-
505
- badge?: string | number;
506
-
507
- badgeConfig?: {
508
- variant?: string;
509
- color?: string;
510
- size?: string;
511
- position?: string;
512
- max?: number;
477
+ interface ComponentWithLifecycle_1 extends ElementComponent {
478
+ lifecycle: {
479
+ destroy: () => void;
480
+ [key: string]: unknown;
513
481
  };
514
-
515
- prefix?: string;
516
482
  }
517
483
 
518
-
519
- interface BadgeComponent extends BaseComponent {
520
-
521
- badge?: Badge;
484
+ /** Configuration for debounced event handlers */
485
+ interface DebounceConfig {
486
+ /** Event handlers with debounce settings */
487
+ debouncedEvents?: Record<string, {
488
+ handler: (event: Event) => void;
489
+ wait: number;
490
+ options?: {
491
+ leading?: boolean;
492
+ maxWait?: number;
493
+ };
494
+ }>;
522
495
  }
523
496
 
524
-
525
- declare const withBadge: <T extends BadgeConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C & BadgeComponent;
526
-
527
- /** A component's events, by name: each one's handler. */
528
- type EventMap<E> = {
529
- [K in keyof E]: EventCallback;
530
- };
531
-
532
- /** The map of a component that does not name its events. */
533
- type AnyEvents = Record<string, EventCallback>;
534
-
535
- /** Component with event capabilities */
536
- interface EventComponent<E extends EventMap<E> = AnyEvents> extends BaseComponent {
537
- /**
538
- * Subscribe to an event
539
- * @param event
540
- * @param handler
541
- */
542
- on<K extends keyof E & string>(event: K, handler: E[K]): this;
497
+ /** Component with debounced event capabilities */
498
+ interface DebounceComponent extends BaseComponent {
543
499
  /**
544
- * Unsubscribe from an event
500
+ * Adds a debounced event listener
545
501
  * @param event
546
502
  * @param handler
503
+ * @param wait
504
+ * @param options
547
505
  */
548
- off<K extends keyof E & string>(event: K, handler: E[K]): this;
506
+ addDebouncedEvent: (event: string, handler: (event: Event) => void, wait: number, options?: {
507
+ leading?: boolean;
508
+ maxWait?: number;
509
+ }) => DebounceComponent;
549
510
  /**
550
- * Emit an event
511
+ * Removes a debounced event listener
551
512
  * @param event
552
- * @param data
553
- */
554
- emit(event: string, data?: unknown): this;
555
- }
556
-
557
- /** Adds event handling capabilities to a component Returns event system ready to use immediately `withEvents<Events>()` names the component's events: `on` and `off` then check each name and its handler's payload. */
558
- declare const withEvents: <E extends EventMap<E> = AnyEvents>() => <T extends BaseComponent>(component: T) => T & EventComponent<E>;
559
-
560
- /** Input configuration options */
561
- interface InputConfig {
562
- /** Input name attribute */
563
- name?: string;
564
- /** Initial checked state */
565
- checked?: boolean;
566
- /** Whether input is required */
567
- required?: boolean;
568
- /** Whether input is disabled */
569
- disabled?: boolean;
570
- /** Input value attribute */
571
- value?: string;
572
- /** Accessibility label text */
573
- label?: string | Node;
574
- /** Alternative accessibility label */
575
- ariaLabel?: string;
576
- /** Component name for classes */
577
- componentName?: string;
578
- /**
579
- * Whether Enter toggles the input as Space does
580
- * @default true
581
- */
582
- enterToggles?: boolean;
583
- }
584
-
585
- /** What withInput adds to a component. */
586
- interface InputFeature {
587
- /** Input element */
588
- input: HTMLInputElement;
589
- /** Gets the checked state: the `value` a `change` carries */
590
- getValue: () => boolean;
591
- /**
592
- * Checks or unchecks the input.
593
- * @param value
594
513
  */
595
- setValue(value: boolean): this;
596
- /** Gets the input's `value` attribute: the string a form submits while checked */
597
- getValueAttribute: () => string;
598
- /**
599
- * Sets the input's `value` attribute.
600
- * @param value
601
- */
602
- setValueAttribute(value: string): this;
603
- /** Event emission method if available */
604
- emit?(event: string, data: unknown): this;
605
- }
606
-
607
- /** Component with input element and related methods */
608
- interface InputComponent extends ElementComponent, InputFeature {
514
+ removeDebouncedEvent: (event: string) => DebounceComponent;
609
515
  }
610
516
 
611
517
  /**
612
- * Creates an input element and adds it to a component Handles both input creation and event emission for state changes `change` carries `{ checked, value, valueAttribute, nativeEvent }`: `value` is the checked boolean, as the checkbox and the switch report it, and `valueAttribute` the input's string value.
518
+ * Adds debounced event handling capabilities to a component
613
519
  * @param config
614
520
  */
615
- declare const withInput: <T extends InputConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & InputFeature;
521
+ declare const withDebounce: <T extends DebounceConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & DebounceComponent;
616
522
 
617
523
 
618
524
  declare enum POSITIONS {
@@ -667,71 +573,165 @@ interface VariantConfig {
667
573
  */
668
574
  declare const withVariant: <T extends VariantConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C;
669
575
 
670
- /** Configuration for disabled feature */
671
- interface DisabledConfig {
672
- disabled?: boolean;
673
- componentName?: string;
576
+
577
+ interface BadgeConfig {
578
+
579
+ badge?: string | number;
580
+
581
+ badgeConfig?: {
582
+ variant?: string;
583
+ color?: string;
584
+ size?: string;
585
+ position?: string;
586
+ max?: number;
587
+ };
588
+
589
+ prefix?: string;
674
590
  }
675
591
 
676
- /** Disabled state manager interface */
677
- interface DisabledManager {
678
- /** Enables the component */
679
- enable(): DisabledManager;
680
- /** Disables the component */
681
- disable(): DisabledManager;
682
- /** Toggles the disabled state */
683
- toggle(): DisabledManager;
684
- /** Checks if the component is disabled */
685
- isDisabled(): boolean;
592
+
593
+ interface BadgeComponent extends BaseComponent {
594
+
595
+ badge?: Badge;
686
596
  }
687
597
 
688
- /** Component with disabled state capabilities */
689
- interface DisabledComponent extends BaseComponent {
690
- disabled: DisabledManager;
598
+
599
+ declare const withBadge: <T extends BadgeConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C & BadgeComponent;
600
+
601
+ /** Configuration for throttled event handlers */
602
+ interface ThrottleConfig {
603
+ /** Event handlers with throttle settings */
604
+ throttledEvents?: Record<string, {
605
+ handler: (event: Event) => void;
606
+ wait: number;
607
+ options?: {
608
+ leading?: boolean;
609
+ trailing?: boolean;
610
+ };
611
+ }>;
612
+ }
613
+
614
+ /** Component with throttled event capabilities */
615
+ interface ThrottleComponent extends BaseComponent {
616
+ /**
617
+ * Adds a throttled event listener
618
+ * @param event
619
+ * @param handler
620
+ * @param wait
621
+ * @param options
622
+ */
623
+ addThrottledEvent: (event: string, handler: (event: Event) => void, wait: number, options?: {
624
+ leading?: boolean;
625
+ trailing?: boolean;
626
+ }) => ThrottleComponent;
627
+ /**
628
+ * Removes a throttled event listener
629
+ * @param event
630
+ */
631
+ removeThrottledEvent: (event: string) => ThrottleComponent;
691
632
  }
692
633
 
693
634
  /**
694
- * Adds disabled state management to a component
635
+ * Adds throttled event handling capabilities to a component
695
636
  * @param config
696
637
  */
697
- declare const withDisabled: <T extends DisabledConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C & DisabledComponent;
638
+ declare const withThrottle: <T extends ThrottleConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & ThrottleComponent;
698
639
 
699
- /** Configuration for checkable feature */
700
- interface CheckableConfig {
701
- checked?: boolean;
640
+ /** Configuration for size feature */
641
+ interface SizeConfig {
642
+ size?: string;
643
+ prefix?: string;
644
+ componentName?: string;
702
645
  }
703
646
 
704
- /** Component with input element */
705
- interface InputComponent_1 extends BaseComponent {
706
- element: HTMLElement;
707
- input: HTMLInputElement;
708
- emit?: (event: string, data: unknown) => unknown;
709
- /** This feature only subscribes to change and does not read its payload. */
710
- on?: (event: "change", handler: () => void) => unknown;
647
+ /**
648
+ * Adds a size class to a component
649
+ * @param config
650
+ */
651
+ declare const withSize: <T extends SizeConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C;
652
+
653
+ /** Ripple configuration interface */
654
+ interface RippleConfig {
655
+ /** How long, in milliseconds, a released wave lingers before it is removed */
656
+ duration?: number;
711
657
  }
712
658
 
713
- /** Checkable state manager interface */
714
- interface CheckableManager {
715
- /** Sets the checked state to true. */
716
- check: () => CheckableManager;
717
- /** Sets the checked state to false. */
718
- uncheck: () => CheckableManager;
719
- /** Toggles the current checked state. */
720
- toggle: () => CheckableManager;
721
- /** Gets the current checked state */
722
- isChecked: () => boolean;
659
+ /** Ripple controller interface */
660
+ interface RippleController {
661
+ /**
662
+ * Mounts ripple effect to an element
663
+ * @param element
664
+ */
665
+ mount: (element: HTMLElement) => void;
666
+ /**
667
+ * Unmounts ripple effect from an element
668
+ * @param element
669
+ */
670
+ unmount: (element: HTMLElement) => void;
723
671
  }
724
672
 
725
- /** Component with checkable capabilities */
726
- interface CheckableComponent extends BaseComponent {
727
- checkable: CheckableManager;
673
+ /** Configuration for ripple feature */
674
+ interface RippleFeatureConfig {
675
+ ripple?: boolean;
676
+ rippleConfig?: RippleConfig;
728
677
  }
729
678
 
679
+ /** Component with ripple capabilities */
680
+ interface RippleComponent extends BaseComponent {
681
+ ripple: RippleController;
682
+ }
683
+
684
+ declare const createRipple: (config?: RippleConfig) => RippleController;
685
+
730
686
  /**
731
- * Adds checked state management to a component with an input
687
+ * Adds ripple effect functionality to a component
732
688
  * @param config
733
689
  */
734
- declare const withCheckable: <T extends CheckableConfig & object>(config?: T) => <C extends InputComponent_1>(component: C) => C & CheckableComponent;
690
+ declare const withRipple: <T extends RippleFeatureConfig & object>(config: T) => <C extends ElementComponent & Partial<LifecycleComponent>>(component: C) => C & RippleComponent;
691
+
692
+
693
+ interface ComponentManagers {
694
+ events?: {
695
+ destroy: () => void;
696
+ };
697
+ text?: {
698
+ getElement: () => HTMLElement | null;
699
+ };
700
+ icon?: {
701
+ getElement: () => HTMLElement | null;
702
+ };
703
+ [key: string]: unknown;
704
+ }
705
+
706
+ /** Lifecycle methods interface */
707
+ interface Lifecycle {
708
+ /**
709
+ * Registers a handler for mount event
710
+ * @param handler
711
+ */
712
+ onMount: (handler: () => void) => () => void;
713
+ /**
714
+ * Registers a handler for unmount event
715
+ * @param handler
716
+ */
717
+ onUnmount: (handler: () => void) => () => void;
718
+ /** Mounts the component */
719
+ mount: () => void;
720
+ /** Unmounts the component */
721
+ unmount: () => void;
722
+ /** Checks if component is mounted */
723
+ isMounted: () => boolean;
724
+ /** Destroys the component */
725
+ destroy: () => void;
726
+ }
727
+
728
+ /** Component with lifecycle capabilities */
729
+ interface LifecycleComponent extends BaseComponent {
730
+ lifecycle: Lifecycle;
731
+ }
732
+
733
+ /** Adds lifecycle management to a component */
734
+ declare const withLifecycle: () => <T extends BaseComponent & Partial<Pick<ElementComponent, "element" | "destroy">>>(component: T) => T & LifecycleComponent;
735
735
  export type { CheckableComponent, CheckableManager, Component, ComponentWithEmit, ComponentWithLifecycle, DebounceComponent, DebounceConfig, DisabledComponent, DisabledManager, EnhancedEventComponent, EventComponent, InputComponent, LabelComponent, LabelManager, Lifecycle, LifecycleComponent, RippleComponent, TextInputComponent, ThrottleComponent, ThrottleConfig, TrackComponent };
736
736
  export { compose, createComponent, hasEmit, hasLifecycle, pipe, transform, withCheckable, withDebounce, withDisabled, withEnhancedEvents, withEvents, withInput, withLifecycle, withPosition, withRipple, withSize, withStyle, withTextInput, withTextLabel, withThrottle, withTrack, withVariant };
737
737
  export type { BaseComponent, BaseConfig, ElementComponent, TouchState, WithElementOptions } from "./component.js";