mtrl 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/dist/components/badge/config.d.ts +2 -2
  2. package/dist/components/bottom-sheet/bottom-sheet.js +1 -1
  3. package/dist/components/bottom-sheet/config.d.ts +2 -2
  4. package/dist/components/bottom-sheet/features/drag.d.ts +2 -2
  5. package/dist/components/bottom-sheet/features/drag.js +1 -1
  6. package/dist/components/button/api.d.ts +3 -3
  7. package/dist/components/button/button.d.ts +1 -1
  8. package/dist/components/button/config.d.ts +2 -2
  9. package/dist/components/button/features/progress.d.ts +17 -5
  10. package/dist/components/button-group/config.d.ts +20 -0
  11. package/dist/components/card/api.d.ts +10 -1
  12. package/dist/components/card/api.js +6 -1
  13. package/dist/components/card/card.js +1 -1
  14. package/dist/components/card/config.d.ts +15 -9
  15. package/dist/components/card/features.d.ts +2 -1
  16. package/dist/components/card/types.d.ts +5 -4
  17. package/dist/components/carousel/config.d.ts +2 -2
  18. package/dist/components/checkbox/config.d.ts +2 -2
  19. package/dist/components/checkbox/types.d.ts +15 -16
  20. package/dist/components/chips/api.d.ts +6 -6
  21. package/dist/components/chips/chip/api.d.ts +2 -2
  22. package/dist/components/chips/chip/config.d.ts +6 -7
  23. package/dist/components/chips/config.d.ts +2 -2
  24. package/dist/components/chips/features/dom.js +0 -1
  25. package/dist/components/chips/types.d.ts +12 -1
  26. package/dist/components/datepicker/api.d.ts +5 -2
  27. package/dist/components/datepicker/config.d.ts +16 -13
  28. package/dist/components/datepicker/datepicker.js +10 -4
  29. package/dist/components/datepicker/render.d.ts +14 -6
  30. package/dist/components/datepicker/render.js +1 -1
  31. package/dist/components/datepicker/types.d.ts +51 -3
  32. package/dist/components/dialog/api.d.ts +1 -1
  33. package/dist/components/dialog/config.d.ts +3 -4
  34. package/dist/components/dialog/config.js +1 -1
  35. package/dist/components/dialog/features.js +1 -1
  36. package/dist/components/dialog/types.d.ts +1 -1
  37. package/dist/components/divider/features.js +2 -0
  38. package/dist/components/drawer/api.d.ts +3 -3
  39. package/dist/components/drawer/config.d.ts +2 -2
  40. package/dist/components/drawer/drawer.d.ts +1 -1
  41. package/dist/components/drawer/features/headline.d.ts +12 -2
  42. package/dist/components/drawer/features/items.d.ts +17 -3
  43. package/dist/components/drawer/features/state.d.ts +14 -2
  44. package/dist/components/extended-fab/api.d.ts +12 -4
  45. package/dist/components/extended-fab/api.js +12 -0
  46. package/dist/components/extended-fab/config.d.ts +10 -10
  47. package/dist/components/extended-fab/types.d.ts +4 -2
  48. package/dist/components/fab/api.d.ts +9 -2
  49. package/dist/components/fab/api.js +12 -0
  50. package/dist/components/fab/config.d.ts +8 -8
  51. package/dist/components/fab/types.d.ts +2 -1
  52. package/dist/components/icon-button/config.d.ts +2 -2
  53. package/dist/components/icon-button/features/toggle.d.ts +1 -5
  54. package/dist/components/icon-button/types.d.ts +6 -0
  55. package/dist/components/list/api.d.ts +18 -18
  56. package/dist/components/list/config.d.ts +6 -3
  57. package/dist/components/list/config.js +6 -7
  58. package/dist/components/list/features/renderer.js +2 -2
  59. package/dist/components/list/list.d.ts +20 -1
  60. package/dist/components/list/types.d.ts +32 -32
  61. package/dist/components/loading-indicator/config.d.ts +2 -2
  62. package/dist/components/loading-indicator/types.d.ts +3 -1
  63. package/dist/components/menu/api.d.ts +6 -5
  64. package/dist/components/menu/config.d.ts +2 -2
  65. package/dist/components/menu/features/keyboard.d.ts +19 -9
  66. package/dist/components/menu/types.d.ts +25 -9
  67. package/dist/components/navigation/config.d.ts +2 -2
  68. package/dist/components/navigation/features/controller.d.ts +1 -3
  69. package/dist/components/navigation/features/items.d.ts +1 -2
  70. package/dist/components/navigation/system/core.d.ts +6 -6
  71. package/dist/components/navigation/system/events.d.ts +3 -3
  72. package/dist/components/navigation/system/mobile.d.ts +6 -6
  73. package/dist/components/navigation/system/state.d.ts +3 -3
  74. package/dist/components/navigation/system/types.d.ts +43 -11
  75. package/dist/components/navigation/types.d.ts +15 -6
  76. package/dist/components/progress/api.js +0 -1
  77. package/dist/components/progress/config.d.ts +2 -2
  78. package/dist/components/progress/features/canvas.d.ts +14 -5
  79. package/dist/components/progress/features/state.d.ts +1 -2
  80. package/dist/components/progress/types.d.ts +1 -1
  81. package/dist/components/radios/config.d.ts +2 -2
  82. package/dist/components/search/api.js +4 -4
  83. package/dist/components/search/config.d.ts +2 -2
  84. package/dist/components/search/features/suggestions.d.ts +1 -3
  85. package/dist/components/search/features/suggestions.js +5 -5
  86. package/dist/components/search/search.js +1 -1
  87. package/dist/components/segmented-button/config.d.ts +1 -5
  88. package/dist/components/segmented-button/config.js +1 -1
  89. package/dist/components/select/api.d.ts +2 -2
  90. package/dist/components/select/features.d.ts +2 -2
  91. package/dist/components/select/features.js +2 -1
  92. package/dist/components/select/types.d.ts +38 -21
  93. package/dist/components/side-sheet/config.d.ts +2 -2
  94. package/dist/components/slider/api.d.ts +6 -6
  95. package/dist/components/slider/config.d.ts +2 -2
  96. package/dist/components/slider/types.d.ts +2 -2
  97. package/dist/components/snackbar/config.d.ts +2 -2
  98. package/dist/components/snackbar/features.d.ts +3 -3
  99. package/dist/components/snackbar/position.d.ts +1 -1
  100. package/dist/components/snackbar/types.d.ts +5 -6
  101. package/dist/components/split-button/api.js +1 -3
  102. package/dist/components/split-button/config.d.ts +2 -2
  103. package/dist/components/split-button/features/buttons.d.ts +3 -2
  104. package/dist/components/split-button/features/menu.d.ts +3 -2
  105. package/dist/components/split-button/types.d.ts +13 -2
  106. package/dist/components/switch/config.d.ts +2 -2
  107. package/dist/components/switch/types.d.ts +0 -1
  108. package/dist/components/tabs/api.d.ts +8 -5
  109. package/dist/components/tabs/config.d.ts +9 -1
  110. package/dist/components/tabs/features.d.ts +7 -11
  111. package/dist/components/tabs/features.js +2 -1
  112. package/dist/components/tabs/indicator.js +4 -2
  113. package/dist/components/tabs/responsive.js +2 -1
  114. package/dist/components/tabs/tab-api.d.ts +11 -5
  115. package/dist/components/tabs/tab-api.js +1 -1
  116. package/dist/components/tabs/tab.js +9 -1
  117. package/dist/components/tabs/types.d.ts +9 -2
  118. package/dist/components/tabs/utils.d.ts +14 -3
  119. package/dist/components/textfield/api.d.ts +1 -1
  120. package/dist/components/textfield/config.d.ts +2 -2
  121. package/dist/components/textfield/features/error.d.ts +1 -2
  122. package/dist/components/textfield/features/leading-icon.d.ts +1 -2
  123. package/dist/components/textfield/features/prefix-text.d.ts +1 -2
  124. package/dist/components/textfield/features/suffix-text.d.ts +1 -2
  125. package/dist/components/textfield/features/supporting-text.d.ts +1 -2
  126. package/dist/components/textfield/features/trailing-icon.d.ts +1 -2
  127. package/dist/components/textfield/types.d.ts +0 -2
  128. package/dist/components/timepicker/api.d.ts +5 -4
  129. package/dist/components/timepicker/config.d.ts +14 -11
  130. package/dist/components/tooltip/config.d.ts +2 -2
  131. package/dist/components/tooltip/tooltip.d.ts +1 -1
  132. package/dist/core/compose/base.d.ts +2 -2
  133. package/dist/core/compose/base.js +1 -1
  134. package/dist/core/compose/component.d.ts +13 -4
  135. package/dist/core/compose/component.js +1 -1
  136. package/dist/core/compose/features/badge.d.ts +3 -4
  137. package/dist/core/compose/features/badge.js +1 -1
  138. package/dist/core/compose/features/checkable.d.ts +3 -4
  139. package/dist/core/compose/features/debounce.d.ts +2 -3
  140. package/dist/core/compose/features/disabled.d.ts +1 -2
  141. package/dist/core/compose/features/events.d.ts +4 -3
  142. package/dist/core/compose/features/icon.d.ts +1 -5
  143. package/dist/core/compose/features/input.d.ts +2 -3
  144. package/dist/core/compose/features/lifecycle.d.ts +2 -2
  145. package/dist/core/compose/features/lifecycle.js +3 -3
  146. package/dist/core/compose/features/position.d.ts +1 -2
  147. package/dist/core/compose/features/ripple.d.ts +1 -2
  148. package/dist/core/compose/features/size.d.ts +1 -2
  149. package/dist/core/compose/features/style.d.ts +1 -2
  150. package/dist/core/compose/features/text.d.ts +1 -5
  151. package/dist/core/compose/features/textinput.d.ts +2 -3
  152. package/dist/core/compose/features/textlabel.d.ts +1 -2
  153. package/dist/core/compose/features/throttle.d.ts +1 -2
  154. package/dist/core/compose/features/track.d.ts +0 -1
  155. package/dist/core/compose/features/variant.d.ts +1 -2
  156. package/dist/core/compose/index.d.ts +1 -1
  157. package/dist/core/compose/pipe.d.ts +43 -3
  158. package/dist/core/compose/pipe.js +6 -2
  159. package/dist/core/compose/utils/type-guards.d.ts +4 -4
  160. package/dist/core/compose/utils/type-guards.js +1 -1
  161. package/dist/core/config/component.d.ts +12 -9
  162. package/dist/core/config/global.d.ts +12 -8
  163. package/dist/core/config.d.ts +1 -1
  164. package/dist/core/dom/attributes.d.ts +6 -6
  165. package/dist/core/dom/attributes.js +3 -2
  166. package/dist/core/dom/create.d.ts +27 -10
  167. package/dist/core/dom/create.js +0 -24
  168. package/dist/core/dom/utils.d.ts +1 -1
  169. package/dist/core/state/emitter.d.ts +2 -2
  170. package/dist/core/state/events.d.ts +3 -3
  171. package/dist/core/state/lifecycle.d.ts +0 -1
  172. package/dist/core/state/store.d.ts +3 -3
  173. package/dist/core/utils/object.d.ts +2 -2
  174. package/dist/core/utils/performance.d.ts +3 -3
  175. package/dist/core/utils/validate.d.ts +6 -6
  176. package/dist/core/utils/validate.js +13 -12
  177. package/dist/index.cjs +12 -12
  178. package/dist/package.json +1 -1
  179. package/dist/styles/badge.css +2 -2
  180. package/dist/styles/base.css +2 -2
  181. package/dist/styles/bottom-app-bar.css +2 -2
  182. package/dist/styles/bottom-sheet.css +2 -2
  183. package/dist/styles/button-group.css +2 -2
  184. package/dist/styles/button.css +2 -2
  185. package/dist/styles/card.css +2 -2
  186. package/dist/styles/carousel.css +2 -2
  187. package/dist/styles/checkbox.css +2 -2
  188. package/dist/styles/chips.css +2 -2
  189. package/dist/styles/dialog.css +2 -2
  190. package/dist/styles/divider.css +2 -2
  191. package/dist/styles/drawer.css +2 -2
  192. package/dist/styles/extended-fab.css +2 -2
  193. package/dist/styles/fab.css +2 -2
  194. package/dist/styles/icon-button.css +2 -2
  195. package/dist/styles/list.css +2 -2
  196. package/dist/styles/loading-indicator.css +2 -2
  197. package/dist/styles/menu.css +2 -2
  198. package/dist/styles/navigation-rail.css +2 -2
  199. package/dist/styles/navigation.css +2 -2
  200. package/dist/styles/progress.css +2 -2
  201. package/dist/styles/radios.css +2 -2
  202. package/dist/styles/search.css +2 -2
  203. package/dist/styles/segmented-button.css +2 -2
  204. package/dist/styles/select.css +2 -2
  205. package/dist/styles/side-sheet.css +2 -2
  206. package/dist/styles/slider.css +2 -2
  207. package/dist/styles/snackbar.css +2 -2
  208. package/dist/styles/split-button.css +2 -2
  209. package/dist/styles/switch.css +2 -2
  210. package/dist/styles/tabs.css +2 -2
  211. package/dist/styles/textfield.css +2 -2
  212. package/dist/styles/timepicker.css +2 -2
  213. package/dist/styles/tooltip.css +2 -0
  214. package/dist/styles/tooltip.d.ts +1 -0
  215. package/dist/styles/tooltip.js +2 -0
  216. package/dist/styles/top-app-bar.css +2 -2
  217. package/dist/styles/utilities.css +2 -2
  218. package/dist/styles.css +2 -2
  219. package/dist/themes/autumn.css +1 -1
  220. package/dist/themes/baseline.css +1 -1
  221. package/dist/themes/brownbeige.css +1 -1
  222. package/dist/themes/browngreen.css +1 -1
  223. package/dist/themes/desert.css +1 -1
  224. package/dist/themes/forest.css +1 -1
  225. package/dist/themes/highcontrast.css +1 -1
  226. package/dist/themes/legacy.css +1 -1
  227. package/dist/themes/material.css +1 -1
  228. package/dist/themes/ocean.css +1 -1
  229. package/dist/themes/sageivory.css +1 -1
  230. package/dist/themes/spring.css +1 -1
  231. package/dist/themes/summer.css +1 -1
  232. package/dist/themes/sunset.css +1 -1
  233. package/dist/themes/tealcaramel.css +1 -1
  234. package/dist/themes/winter.css +1 -1
  235. package/package.json +2 -2
  236. package/src/styles/abstract/_mixins.scss +5 -1
  237. package/src/styles/components/_checkbox.scss +27 -7
  238. package/src/styles/components/_chips.scss +13 -13
  239. package/src/styles/components/_datepicker.scss +5 -5
  240. package/src/styles/components/_dialog.scss +2 -2
  241. package/src/styles/components/_radios.scss +30 -30
  242. package/src/styles/components/_switch.scss +36 -26
  243. package/src/styles/components/_tabs.scss +59 -58
  244. package/src/styles/components/_timepicker.scss +3 -3
  245. package/src/styles/main.scss +1 -0
@@ -1,4 +1,4 @@
1
- import { TabComponent } from "./types.js";
1
+ import { TabComponent, TabButton } from "./types.js";
2
2
  import type { BadgeComponent } from "../badge/index.js";
3
3
  /**
4
4
  * API options for a Tab component
@@ -15,7 +15,7 @@ interface ApiOptions {
15
15
  destroy: () => void;
16
16
  };
17
17
  /** The button component (optional) */
18
- button?: any;
18
+ button?: TabButton;
19
19
  }
20
20
  /**
21
21
  * Component with required elements and methods
@@ -24,15 +24,21 @@ interface ComponentWithElements {
24
24
  /** The DOM element */
25
25
  element: HTMLElement;
26
26
  /** The button component (optional) */
27
- button?: any;
27
+ button?: TabButton;
28
28
  /** The badge component (optional) */
29
29
  badge?: BadgeComponent;
30
30
  /** Class name helper */
31
31
  getClass: (name: string) => string;
32
32
  /** Component configuration */
33
- config: Record<string, any>;
33
+ config: {
34
+ prefix?: string;
35
+ };
36
+ /** Event subscription, kept on the returned tab */
37
+ on: TabComponent['on'];
38
+ /** Event unsubscription, kept on the returned tab */
39
+ off: TabComponent['off'];
34
40
  /** Event emitter (optional) */
35
- emit?: (event: string, data: any) => any;
41
+ emit?: (event: string, data?: unknown) => unknown;
36
42
  }
37
43
  /**
38
44
  * Enhances a tab component with API methods
@@ -78,7 +78,7 @@ export const withTabAPI = ({ disabled, lifecycle, button }) => (component) => {
78
78
  setBadge(content) {
79
79
  if (!component.badge) {
80
80
  const badgeConfig = {
81
- content,
81
+ label: content,
82
82
  standalone: false,
83
83
  target: component.element,
84
84
  prefix: component.config.prefix
@@ -45,6 +45,14 @@ export const createTab = (config = {}) => {
45
45
  ...baseComponent,
46
46
  button,
47
47
  element: button.element,
48
+ on(event, handler) {
49
+ baseComponent.on(event, handler);
50
+ return this;
51
+ },
52
+ off(event, handler) {
53
+ baseComponent.off(event, handler);
54
+ return this;
55
+ },
48
56
  badge: null,
49
57
  getValue() {
50
58
  return button.getValue();
@@ -103,7 +111,7 @@ export const createTab = (config = {}) => {
103
111
  setBadge(content) {
104
112
  if (!this.badge) {
105
113
  const badgeConfig = {
106
- content,
114
+ label: content,
107
115
  standalone: false,
108
116
  target: this.element,
109
117
  prefix: baseConfig.prefix,
@@ -1,4 +1,9 @@
1
1
  import type { BadgeComponent } from "../badge/index.js";
2
+ import type { ButtonComponent } from "../button/types.js";
3
+ /**
4
+ * Button methods the tab delegates to; each one is checked before use
5
+ */
6
+ export type TabButton = Partial<Pick<ButtonComponent, 'getValue' | 'setValue' | 'getText' | 'setText' | 'getIcon' | 'setIcon'>>;
2
7
  import { TabIndicator } from "./indicator.js";
3
8
  /**
4
9
  * Available tabs variants
@@ -245,6 +250,8 @@ export interface TextAPI {
245
250
  export interface TabComponent {
246
251
  /** The tab's DOM element */
247
252
  element: HTMLElement;
253
+ /** The button the tab is built on */
254
+ button?: TabButton;
248
255
  /** The tab's badge component (if any) */
249
256
  badge?: BadgeComponent;
250
257
  /** Gets a class name with the component's prefix */
@@ -374,7 +381,7 @@ export interface TabsComponent {
374
381
  * @param data - Event data
375
382
  * @returns Tabs component for chaining
376
383
  */
377
- emit?: (event: string, data: any) => TabsComponent;
384
+ emit?: (event: string, data: unknown) => TabsComponent;
378
385
  /**
379
386
  * Destroys the tabs component and all tabs
380
387
  */
@@ -382,7 +389,7 @@ export interface TabsComponent {
382
389
  /**
383
390
  * Tab click event handler
384
391
  */
385
- handleTabClick: (event: any, tab: TabComponent) => void;
392
+ handleTabClick: (event: unknown, tab: TabComponent) => void;
386
393
  /**
387
394
  * Scroll container for scrollable tabs
388
395
  */
@@ -1,17 +1,28 @@
1
1
  import { TabComponent } from "./types.js";
2
+ /**
3
+ * Tabs members read by these helpers; each one is checked before use
4
+ */
5
+ interface TabsHost {
6
+ element?: HTMLElement;
7
+ tabs?: TabComponent[];
8
+ getTabs?: () => TabComponent[];
9
+ getActiveTab?: () => TabComponent | null;
10
+ setActiveTab?: (tabOrValue: TabComponent | string) => unknown;
11
+ }
2
12
  /**
3
13
  * Gets the active tab from a component
4
14
  * @param component - Component with tabs
5
15
  * @returns Active tab or null
6
16
  */
7
- export declare function getActiveTab(component: any): TabComponent | null;
17
+ export declare function getActiveTab(component: TabsHost): TabComponent | null;
8
18
  /**
9
19
  * Updates tab panels based on active tab
10
20
  * @param component - Component with tabs
11
21
  */
12
- export declare function updateTabPanels(component: any): void;
22
+ export declare function updateTabPanels(component: TabsHost): void;
13
23
  /**
14
24
  * Sets up keyboard navigation for tabs
15
25
  * @param component - Tabs component
16
26
  */
17
- export declare function setupKeyboardNavigation(component: any): void;
27
+ export declare function setupKeyboardNavigation(component: TabsHost): void;
28
+ export {};
@@ -9,7 +9,7 @@ type ComponentWithDensity = BaseComponent & {
9
9
  };
10
10
  updateElementPositions?: () => void;
11
11
  schedulePositionUpdate?: () => void;
12
- setError?: (error: boolean, message?: string) => any;
12
+ setError?: (error: boolean, message?: string) => void;
13
13
  isError?: () => boolean;
14
14
  };
15
15
  /**
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: TextfieldConfig) => TextfieldCo
17
17
  export declare const getElementConfig: (config: TextfieldConfig) => {
18
18
  tag: string;
19
19
  componentName: string;
20
- attributes: Record<string, any>;
20
+ attributes: Record<string, unknown>;
21
21
  className: string[];
22
22
  rawClass: string | string[];
23
23
  id: string;
@@ -33,7 +33,7 @@ export declare const getElementConfig: (config: TextfieldConfig) => {
33
33
  ariaHidden: boolean;
34
34
  html: string;
35
35
  text: string;
36
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
36
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
37
37
  interactive: boolean;
38
38
  };
39
39
  /**
@@ -15,7 +15,6 @@ export interface ErrorConfig {
15
15
  * Component name
16
16
  */
17
17
  componentName?: string;
18
- [key: string]: any;
19
18
  }
20
19
  /**
21
20
  * Component with supporting text capabilities (if available)
@@ -50,5 +49,5 @@ export interface ErrorComponent extends BaseComponent {
50
49
  * @param config - Configuration with error settings
51
50
  * @returns Function that enhances a component with error state
52
51
  */
53
- export declare const withError: <T extends ErrorConfig>(config: T) => <C extends ComponentWithSupportingText>(component: C) => C & ErrorComponent;
52
+ export declare const withError: <T extends ErrorConfig & object>(config: T) => <C extends ComponentWithSupportingText>(component: C) => C & ErrorComponent;
54
53
  export {};
@@ -24,7 +24,6 @@ export interface LeadingIconConfig {
24
24
  * Component name
25
25
  */
26
26
  componentName?: string;
27
- [key: string]: any;
28
27
  }
29
28
  /**
30
29
  * Component with leading icon capabilities
@@ -51,5 +50,5 @@ export interface LeadingIconComponent extends BaseComponent {
51
50
  * @param config - Configuration with leading icon settings
52
51
  * @returns Function that enhances a component with leading icon
53
52
  */
54
- export declare const withLeadingIcon: <T extends LeadingIconConfig>(config: T) => <C extends InputElementComponent>(component: C) => C & LeadingIconComponent;
53
+ export declare const withLeadingIcon: <T extends LeadingIconConfig & object>(config: T) => <C extends InputElementComponent>(component: C) => C & Partial<LeadingIconComponent>;
55
54
  export {};
@@ -23,7 +23,6 @@ export interface PrefixTextConfig {
23
23
  * Component name
24
24
  */
25
25
  componentName?: string;
26
- [key: string]: any;
27
26
  }
28
27
  /**
29
28
  * Component with prefix text capabilities
@@ -50,5 +49,5 @@ export interface PrefixTextComponent extends BaseComponent {
50
49
  * @param config - Configuration with prefix text settings
51
50
  * @returns Function that enhances a component with prefix text
52
51
  */
53
- export declare const withPrefixText: <T extends PrefixTextConfig>(config: T) => <C extends LifecycleElementComponent>(component: C) => C & PrefixTextComponent;
52
+ export declare const withPrefixText: <T extends PrefixTextConfig & object>(config: T) => <C extends LifecycleElementComponent>(component: C) => C & Partial<PrefixTextComponent>;
54
53
  export {};
@@ -23,7 +23,6 @@ export interface SuffixTextConfig {
23
23
  * Component name
24
24
  */
25
25
  componentName?: string;
26
- [key: string]: any;
27
26
  }
28
27
  /**
29
28
  * Component with suffix text capabilities
@@ -50,5 +49,5 @@ export interface SuffixTextComponent extends BaseComponent {
50
49
  * @param config - Configuration with suffix text settings
51
50
  * @returns Function that enhances a component with suffix text
52
51
  */
53
- export declare const withSuffixText: <T extends SuffixTextConfig>(config: T) => <C extends LifecycleElementComponent>(component: C) => C & SuffixTextComponent;
52
+ export declare const withSuffixText: <T extends SuffixTextConfig & object>(config: T) => <C extends LifecycleElementComponent>(component: C) => C & Partial<SuffixTextComponent>;
54
53
  export {};
@@ -27,7 +27,6 @@ export interface SupportingTextConfig {
27
27
  * Component name
28
28
  */
29
29
  componentName?: string;
30
- [key: string]: any;
31
30
  }
32
31
  /**
33
32
  * Component with supporting text capabilities
@@ -55,5 +54,5 @@ export interface SupportingTextComponent extends BaseComponent {
55
54
  * @param config - Configuration with supporting text settings
56
55
  * @returns Function that enhances a component with supporting text
57
56
  */
58
- export declare const withSupportingText: <T extends SupportingTextConfig>(config: T) => <C extends LifecycleElementComponent>(component: C) => C & SupportingTextComponent;
57
+ export declare const withSupportingText: <T extends SupportingTextConfig & object>(config: T) => <C extends LifecycleElementComponent>(component: C) => C & SupportingTextComponent;
59
58
  export {};
@@ -24,7 +24,6 @@ export interface TrailingIconConfig {
24
24
  * Component name
25
25
  */
26
26
  componentName?: string;
27
- [key: string]: any;
28
27
  }
29
28
  /**
30
29
  * Component with trailing icon capabilities
@@ -51,5 +50,5 @@ export interface TrailingIconComponent extends BaseComponent {
51
50
  * @param config - Configuration with trailing icon settings
52
51
  * @returns Function that enhances a component with trailing icon
53
52
  */
54
- export declare const withTrailingIcon: <T extends TrailingIconConfig>(config: T) => <C extends InputElementComponent>(component: C) => C & TrailingIconComponent;
53
+ export declare const withTrailingIcon: <T extends TrailingIconConfig & object>(config: T) => <C extends InputElementComponent>(component: C) => C & Partial<TrailingIconComponent>;
55
54
  export {};
@@ -188,7 +188,6 @@ export interface BaseComponent {
188
188
  config?: {
189
189
  prefix?: string;
190
190
  componentName?: string;
191
- [key: string]: string | number | boolean | undefined;
192
191
  };
193
192
  getValue?: () => string;
194
193
  setValue?: (value: string) => void;
@@ -227,5 +226,4 @@ export interface BaseComponent {
227
226
  errorState?: boolean;
228
227
  setError?: (error: boolean, message?: string) => void;
229
228
  isError?: () => boolean;
230
- [key: string]: unknown;
231
229
  }
@@ -1,9 +1,10 @@
1
1
  import { TimePickerComponent, TimePickerConfig, TimeValue } from "./types.js";
2
+ import type { ElementComponent } from "../../core/compose/component.js";
2
3
  interface ApiOptions {
3
4
  events: {
4
- on: (event: string, handler: Function) => any;
5
- off: (event: string, handler: Function) => any;
6
- emit: (event: string, data?: any) => any;
5
+ on: (event: string, handler: Function) => void;
6
+ off: (event: string, handler: Function) => void;
7
+ emit: (event: string, data?: unknown) => void;
7
8
  };
8
9
  lifecycle: {
9
10
  destroy: () => void;
@@ -20,5 +21,5 @@ interface ApiOptions {
20
21
  * @param options - API options with events and lifecycle methods
21
22
  * @returns TimePicker component API
22
23
  */
23
- export declare const createTimePickerAPI: (baseComponent: any, modalElement: HTMLElement, dialogElement: HTMLElement, timeValue: TimeValue, config: TimePickerConfig, options: ApiOptions) => TimePickerComponent;
24
+ export declare const createTimePickerAPI: (baseComponent: ElementComponent, modalElement: HTMLElement, dialogElement: HTMLElement, timeValue: TimeValue, config: TimePickerConfig, options: ApiOptions) => TimePickerComponent;
24
25
  export {};
@@ -1,3 +1,6 @@
1
+ import type { EventCallback } from "../../core/state/emitter.js";
2
+ import type { EventComponent } from "../../core/compose/features/events.js";
3
+ import type { LifecycleComponent } from "../../core/compose/features/lifecycle.js";
1
4
  import { TimePickerConfig } from "./types.js";
2
5
  /**
3
6
  * Default configuration for the TimePicker component
@@ -17,7 +20,7 @@ export declare const createBaseConfig: (config?: TimePickerConfig) => TimePicker
17
20
  export declare const getContainerConfig: (config: TimePickerConfig) => {
18
21
  tag: string;
19
22
  componentName: string;
20
- attributes: Record<string, any>;
23
+ attributes: Record<string, unknown>;
21
24
  className: string[];
22
25
  rawClass: string | string[];
23
26
  id: string;
@@ -33,7 +36,7 @@ export declare const getContainerConfig: (config: TimePickerConfig) => {
33
36
  ariaHidden: boolean;
34
37
  html: string;
35
38
  text: string;
36
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
39
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
37
40
  interactive: boolean;
38
41
  };
39
42
  /**
@@ -44,7 +47,7 @@ export declare const getContainerConfig: (config: TimePickerConfig) => {
44
47
  export declare const getModalConfig: (config: TimePickerConfig) => {
45
48
  tag: string;
46
49
  componentName: string;
47
- attributes: Record<string, any>;
50
+ attributes: Record<string, unknown>;
48
51
  className: string[];
49
52
  rawClass: string | string[];
50
53
  id: string;
@@ -60,7 +63,7 @@ export declare const getModalConfig: (config: TimePickerConfig) => {
60
63
  ariaHidden: boolean;
61
64
  html: string;
62
65
  text: string;
63
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
66
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
64
67
  interactive: boolean;
65
68
  };
66
69
  /**
@@ -71,7 +74,7 @@ export declare const getModalConfig: (config: TimePickerConfig) => {
71
74
  export declare const getDialogConfig: (config: TimePickerConfig) => {
72
75
  tag: string;
73
76
  componentName: string;
74
- attributes: Record<string, any>;
77
+ attributes: Record<string, unknown>;
75
78
  className: string[];
76
79
  rawClass: string | string[];
77
80
  id: string;
@@ -87,7 +90,7 @@ export declare const getDialogConfig: (config: TimePickerConfig) => {
87
90
  ariaHidden: boolean;
88
91
  html: string;
89
92
  text: string;
90
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
93
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
91
94
  interactive: boolean;
92
95
  };
93
96
  /**
@@ -95,14 +98,14 @@ export declare const getDialogConfig: (config: TimePickerConfig) => {
95
98
  * @param {Object} comp - Component with events and lifecycle features
96
99
  * @returns {Object} API configuration object
97
100
  */
98
- export declare const getApiConfig: (comp: any) => {
101
+ export declare const getApiConfig: (comp: EventComponent & LifecycleComponent) => {
99
102
  events: {
100
- on: (event: string, handler: Function) => any;
101
- off: (event: string, handler: Function) => any;
102
- emit: (event: string, data?: any) => any;
103
+ on: (event: string, handler: EventCallback) => EventComponent;
104
+ off: (event: string, handler: EventCallback) => EventComponent;
105
+ emit: (event: string, data?: unknown) => EventComponent;
103
106
  };
104
107
  lifecycle: {
105
- destroy: () => any;
108
+ destroy: () => void;
106
109
  };
107
110
  };
108
111
  export default defaultConfig;
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: TooltipConfig) => TooltipConfig
17
17
  export declare const getElementConfig: (config: TooltipConfig) => {
18
18
  tag: string;
19
19
  componentName: string;
20
- attributes: Record<string, any>;
20
+ attributes: Record<string, unknown>;
21
21
  className: string[];
22
22
  rawClass: string | string[];
23
23
  id: string;
@@ -33,7 +33,7 @@ export declare const getElementConfig: (config: TooltipConfig) => {
33
33
  ariaHidden: boolean;
34
34
  html: string;
35
35
  text: string;
36
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
36
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
37
37
  interactive: boolean;
38
38
  };
39
39
  /**
@@ -4,5 +4,5 @@ import { TooltipConfig } from "./types.js";
4
4
  * @param {TooltipConfig} config - Tooltip configuration object
5
5
  * @returns {TooltipComponent} Tooltip component instance
6
6
  */
7
- declare const createTooltip: (config?: TooltipConfig) => any;
7
+ declare const createTooltip: (config?: TooltipConfig) => import("./types.js").TooltipComponent;
8
8
  export default createTooltip;
@@ -2,7 +2,7 @@
2
2
  * Configuration for component creation
3
3
  */
4
4
  export interface ComponentConfig {
5
- [key: string]: any;
5
+ [key: string]: unknown;
6
6
  }
7
7
  /**
8
8
  * Basic component interface
@@ -28,4 +28,4 @@ export interface Component {
28
28
  * @param config - Component configuration
29
29
  * @returns Basic component structure
30
30
  */
31
- export declare const createComponent: (config?: ComponentConfig) => Component;
31
+ export declare const createComponent: (config?: object) => Component;
@@ -1,6 +1,6 @@
1
1
  export const createComponent = (config = {}) => ({
2
2
  element: null,
3
- config,
3
+ config: config,
4
4
  setup() {
5
5
  return this;
6
6
  }
@@ -3,6 +3,7 @@
3
3
  * @description Core utilities for component composition and creation with built-in mobile support
4
4
  */
5
5
  import { type CleanupScope } from "./cleanup.js";
6
+ import { EventCondition } from "../dom/create.js";
6
7
  /**
7
8
  * Touch state interface to track touch interactions
8
9
  */
@@ -15,12 +16,20 @@ export interface TouchState {
15
16
  isTouching: boolean;
16
17
  activeTarget: EventTarget | null;
17
18
  }
19
+ /**
20
+ * Config keys the base component and withElement read
21
+ */
22
+ export interface BaseConfig {
23
+ componentName?: string;
24
+ prefix?: string;
25
+ parent?: HTMLElement | string;
26
+ }
18
27
  /**
19
28
  * Base component interface with prefix utilities
20
29
  */
21
30
  export interface BaseComponent {
22
31
  resources?: CleanupScope;
23
- config: Record<string, any>;
32
+ config: BaseConfig & Record<string, unknown>;
24
33
  componentName?: string;
25
34
  getClass: (name: string) => string;
26
35
  getModifierClass: (base: string, modifier: string) => string;
@@ -42,7 +51,7 @@ export interface ElementComponent extends BaseComponent {
42
51
  export interface WithElementOptions {
43
52
  tag?: string;
44
53
  componentName?: string;
45
- attributes?: Record<string, any>;
54
+ attributes?: Record<string, unknown>;
46
55
  className?: string | string[];
47
56
  id?: string;
48
57
  name?: string;
@@ -55,7 +64,7 @@ export interface WithElementOptions {
55
64
  ariaDescribedBy?: string;
56
65
  ariaLabelledBy?: string;
57
66
  ariaHidden?: boolean;
58
- forwardEvents?: Record<string, boolean | ((component: any, event: Event) => boolean)>;
67
+ forwardEvents?: Record<string, EventCondition>;
59
68
  interactive?: boolean;
60
69
  parent?: HTMLElement | string;
61
70
  }
@@ -66,7 +75,7 @@ export interface WithElementOptions {
66
75
  * @param {Object} config - Component configuration
67
76
  * @returns {BaseComponent} Base component with prefix utilities
68
77
  */
69
- export declare const createBase: (config?: Record<string, any>) => BaseComponent;
78
+ export declare const createBase: (config?: BaseConfig & object) => BaseComponent;
70
79
  /**
71
80
  * Higher-order function that adds a DOM element to a component
72
81
  * @param {WithElementOptions} options - Element creation options
@@ -9,7 +9,7 @@ const withPrefix = (prefix) => ({
9
9
  getElementClass,
10
10
  });
11
11
  export const createBase = (config = {}) => ({
12
- config,
12
+ config: config,
13
13
  componentName: config.componentName,
14
14
  ...withPrefix(config.prefix || "mtrl"),
15
15
  touchState: {
@@ -1,4 +1,5 @@
1
1
  import { BaseComponent, ElementComponent } from "../component.js";
2
+ import type { BadgeComponent as Badge } from "../../../components/badge/types.js";
2
3
  /**
3
4
  * Configuration for badge feature
4
5
  */
@@ -16,13 +17,11 @@ export interface BadgeConfig {
16
17
  size?: string;
17
18
  position?: string;
18
19
  max?: number;
19
- [key: string]: any;
20
20
  };
21
21
  /**
22
22
  * CSS class prefix
23
23
  */
24
24
  prefix?: string;
25
- [key: string]: any;
26
25
  }
27
26
  /**
28
27
  * Component with badge capabilities
@@ -31,7 +30,7 @@ export interface BadgeComponent extends BaseComponent {
31
30
  /**
32
31
  * Badge component instance
33
32
  */
34
- badge?: any;
33
+ badge?: Badge;
35
34
  }
36
35
  /**
37
36
  * Adds badge functionality to a component
@@ -40,4 +39,4 @@ export interface BadgeComponent extends BaseComponent {
40
39
  * @param {BadgeConfig} config - Badge configuration
41
40
  * @returns {Function} Component enhancer with badge functionality
42
41
  */
43
- export declare const withBadge: <T extends BadgeConfig>(config: T) => <C extends ElementComponent>(component: C) => C & BadgeComponent;
42
+ export declare const withBadge: <T extends BadgeConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C & BadgeComponent;
@@ -5,7 +5,7 @@ export const withBadge = (config) => (component) => {
5
5
  return component;
6
6
  }
7
7
  const badgeConfig = {
8
- content: config.badge,
8
+ label: config.badge,
9
9
  standalone: false,
10
10
  target: component.element,
11
11
  ...config.badgeConfig || {},
@@ -4,7 +4,6 @@ import { BaseComponent } from "../component.js";
4
4
  */
5
5
  export interface CheckableConfig {
6
6
  checked?: boolean;
7
- [key: string]: any;
8
7
  }
9
8
  /**
10
9
  * Component with input element
@@ -12,8 +11,8 @@ export interface CheckableConfig {
12
11
  export interface InputComponent extends BaseComponent {
13
12
  element: HTMLElement;
14
13
  input: HTMLInputElement;
15
- emit?: (event: string, data: unknown) => InputComponent;
16
- on?: (event: string, handler: Function) => InputComponent;
14
+ emit?: (event: string, data: unknown) => unknown;
15
+ on?: (event: string, handler: Function) => unknown;
17
16
  }
18
17
  /**
19
18
  * Checkable state manager interface
@@ -56,4 +55,4 @@ export interface CheckableComponent extends BaseComponent {
56
55
  * @param config - Checkable configuration
57
56
  * @returns Function that enhances a component with checkable functionality
58
57
  */
59
- export declare const withCheckable: <T extends CheckableConfig>(config?: T) => <C extends InputComponent>(component: C) => C & CheckableComponent;
58
+ export declare const withCheckable: <T extends CheckableConfig & object>(config?: T) => <C extends InputComponent>(component: C) => C & CheckableComponent;
@@ -9,7 +9,7 @@ import { BaseComponent, ElementComponent } from "../component.js";
9
9
  export interface ComponentWithLifecycle extends ElementComponent {
10
10
  lifecycle: {
11
11
  destroy: () => void;
12
- [key: string]: any;
12
+ [key: string]: unknown;
13
13
  };
14
14
  }
15
15
  /**
@@ -27,7 +27,6 @@ export interface DebounceConfig {
27
27
  maxWait?: number;
28
28
  };
29
29
  }>;
30
- [key: string]: any;
31
30
  }
32
31
  /**
33
32
  * Component with debounced event capabilities
@@ -80,5 +79,5 @@ export interface DebounceComponent extends BaseComponent {
80
79
  * )(config);
81
80
  * ```
82
81
  */
83
- export declare const withDebounce: (config?: DebounceConfig) => <C extends ElementComponent>(component: C) => C & DebounceComponent;
82
+ export declare const withDebounce: <T extends DebounceConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & DebounceComponent;
84
83
  export default withDebounce;
@@ -5,7 +5,6 @@ import { BaseComponent, ElementComponent } from "../component.js";
5
5
  export interface DisabledConfig {
6
6
  disabled?: boolean;
7
7
  componentName?: string;
8
- [key: string]: any;
9
8
  }
10
9
  /**
11
10
  * Disabled state manager interface
@@ -44,4 +43,4 @@ export interface DisabledComponent extends BaseComponent {
44
43
  * @param config - Configuration object
45
44
  * @returns Function that enhances a component with disabled state management
46
45
  */
47
- export declare const withDisabled: <T extends DisabledConfig>(config: T) => <C extends ElementComponent>(component: C) => C & DisabledComponent;
46
+ export declare const withDisabled: <T extends DisabledConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C & DisabledComponent;
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @module core/compose/features
3
3
  */
4
+ import { EventCallback } from "../../state/emitter.js";
4
5
  import { BaseComponent } from "../component.js";
5
6
  /**
6
7
  * Component with event capabilities
@@ -12,21 +13,21 @@ export interface EventComponent extends BaseComponent {
12
13
  * @param handler - Event handler
13
14
  * @returns Component instance for chaining
14
15
  */
15
- on(event: string, handler: (...args: any[]) => void): EventComponent;
16
+ on(event: string, handler: EventCallback): EventComponent;
16
17
  /**
17
18
  * Unsubscribe from an event
18
19
  * @param event - Event name
19
20
  * @param handler - Event handler
20
21
  * @returns Component instance for chaining
21
22
  */
22
- off(event: string, handler: (...args: any[]) => void): EventComponent;
23
+ off(event: string, handler: EventCallback): EventComponent;
23
24
  /**
24
25
  * Emit an event
25
26
  * @param event - Event name
26
27
  * @param data - Event data
27
28
  * @returns Component instance for chaining
28
29
  */
29
- emit(event: string, data?: any): EventComponent;
30
+ emit(event: string, data?: unknown): EventComponent;
30
31
  }
31
32
  /**
32
33
  * Adds event handling capabilities to a component