mtrl 0.8.0 → 0.9.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 (253) 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/content.js +5 -2
  16. package/dist/components/card/features.d.ts +2 -1
  17. package/dist/components/card/types.d.ts +5 -4
  18. package/dist/components/carousel/config.d.ts +2 -2
  19. package/dist/components/carousel/features/slides.js +3 -2
  20. package/dist/components/checkbox/config.d.ts +2 -2
  21. package/dist/components/checkbox/types.d.ts +15 -16
  22. package/dist/components/chips/api.d.ts +6 -6
  23. package/dist/components/chips/chip/api.d.ts +2 -2
  24. package/dist/components/chips/chip/config.d.ts +6 -7
  25. package/dist/components/chips/config.d.ts +2 -2
  26. package/dist/components/chips/features/dom.js +0 -1
  27. package/dist/components/chips/types.d.ts +12 -1
  28. package/dist/components/datepicker/api.d.ts +5 -2
  29. package/dist/components/datepicker/config.d.ts +16 -13
  30. package/dist/components/datepicker/datepicker.js +10 -4
  31. package/dist/components/datepicker/render.d.ts +14 -6
  32. package/dist/components/datepicker/render.js +1 -1
  33. package/dist/components/datepicker/types.d.ts +51 -3
  34. package/dist/components/dialog/api.d.ts +1 -1
  35. package/dist/components/dialog/config.d.ts +3 -4
  36. package/dist/components/dialog/config.js +1 -1
  37. package/dist/components/dialog/features.js +1 -1
  38. package/dist/components/dialog/types.d.ts +1 -1
  39. package/dist/components/divider/features.js +2 -0
  40. package/dist/components/drawer/api.d.ts +3 -3
  41. package/dist/components/drawer/config.d.ts +2 -2
  42. package/dist/components/drawer/drawer.d.ts +1 -1
  43. package/dist/components/drawer/features/headline.d.ts +12 -2
  44. package/dist/components/drawer/features/items.d.ts +17 -3
  45. package/dist/components/drawer/features/state.d.ts +14 -2
  46. package/dist/components/extended-fab/api.d.ts +12 -4
  47. package/dist/components/extended-fab/api.js +12 -0
  48. package/dist/components/extended-fab/config.d.ts +10 -10
  49. package/dist/components/extended-fab/types.d.ts +4 -2
  50. package/dist/components/fab/api.d.ts +9 -2
  51. package/dist/components/fab/api.js +12 -0
  52. package/dist/components/fab/config.d.ts +8 -8
  53. package/dist/components/fab/types.d.ts +2 -1
  54. package/dist/components/icon-button/config.d.ts +2 -2
  55. package/dist/components/icon-button/features/toggle.d.ts +1 -5
  56. package/dist/components/icon-button/types.d.ts +6 -0
  57. package/dist/components/list/api.d.ts +18 -18
  58. package/dist/components/list/config.d.ts +6 -3
  59. package/dist/components/list/config.js +6 -7
  60. package/dist/components/list/features/renderer.js +2 -2
  61. package/dist/components/list/list.d.ts +20 -1
  62. package/dist/components/list/types.d.ts +32 -32
  63. package/dist/components/loading-indicator/config.d.ts +2 -2
  64. package/dist/components/loading-indicator/types.d.ts +3 -1
  65. package/dist/components/menu/api.d.ts +6 -5
  66. package/dist/components/menu/config.d.ts +2 -2
  67. package/dist/components/menu/features/keyboard.d.ts +19 -9
  68. package/dist/components/menu/types.d.ts +25 -9
  69. package/dist/components/navigation/config.d.ts +2 -2
  70. package/dist/components/navigation/features/controller.d.ts +1 -3
  71. package/dist/components/navigation/features/items.d.ts +1 -2
  72. package/dist/components/navigation/system/core.d.ts +6 -6
  73. package/dist/components/navigation/system/events.d.ts +3 -3
  74. package/dist/components/navigation/system/mobile.d.ts +6 -6
  75. package/dist/components/navigation/system/state.d.ts +3 -3
  76. package/dist/components/navigation/system/types.d.ts +43 -11
  77. package/dist/components/navigation/types.d.ts +15 -6
  78. package/dist/components/navigation-rail/navigation-rail.js +2 -1
  79. package/dist/components/progress/api.js +0 -1
  80. package/dist/components/progress/config.d.ts +2 -2
  81. package/dist/components/progress/features/canvas.d.ts +14 -5
  82. package/dist/components/progress/features/state.d.ts +1 -2
  83. package/dist/components/progress/types.d.ts +1 -1
  84. package/dist/components/radios/config.d.ts +2 -2
  85. package/dist/components/search/api.js +4 -4
  86. package/dist/components/search/config.d.ts +2 -2
  87. package/dist/components/search/features/suggestions.d.ts +1 -3
  88. package/dist/components/search/features/suggestions.js +16 -15
  89. package/dist/components/search/search.js +1 -1
  90. package/dist/components/segmented-button/config.d.ts +1 -5
  91. package/dist/components/segmented-button/config.js +1 -1
  92. package/dist/components/select/api.d.ts +2 -2
  93. package/dist/components/select/features.d.ts +2 -2
  94. package/dist/components/select/features.js +2 -1
  95. package/dist/components/select/types.d.ts +38 -21
  96. package/dist/components/side-sheet/config.d.ts +2 -2
  97. package/dist/components/slider/api.d.ts +6 -6
  98. package/dist/components/slider/config.d.ts +2 -2
  99. package/dist/components/slider/types.d.ts +2 -2
  100. package/dist/components/snackbar/config.d.ts +2 -2
  101. package/dist/components/snackbar/features.d.ts +3 -3
  102. package/dist/components/snackbar/position.d.ts +1 -1
  103. package/dist/components/snackbar/types.d.ts +5 -6
  104. package/dist/components/split-button/api.js +1 -3
  105. package/dist/components/split-button/config.d.ts +2 -2
  106. package/dist/components/split-button/features/buttons.d.ts +3 -2
  107. package/dist/components/split-button/features/menu.d.ts +3 -2
  108. package/dist/components/split-button/types.d.ts +13 -2
  109. package/dist/components/switch/config.d.ts +2 -2
  110. package/dist/components/switch/types.d.ts +0 -1
  111. package/dist/components/tabs/api.d.ts +8 -5
  112. package/dist/components/tabs/config.d.ts +9 -1
  113. package/dist/components/tabs/features.d.ts +7 -11
  114. package/dist/components/tabs/features.js +2 -1
  115. package/dist/components/tabs/indicator.js +4 -2
  116. package/dist/components/tabs/responsive.js +2 -1
  117. package/dist/components/tabs/tab-api.d.ts +11 -5
  118. package/dist/components/tabs/tab-api.js +1 -1
  119. package/dist/components/tabs/tab.js +9 -1
  120. package/dist/components/tabs/types.d.ts +9 -2
  121. package/dist/components/tabs/utils.d.ts +14 -3
  122. package/dist/components/textfield/api.d.ts +1 -1
  123. package/dist/components/textfield/config.d.ts +2 -2
  124. package/dist/components/textfield/features/error.d.ts +1 -2
  125. package/dist/components/textfield/features/leading-icon.d.ts +1 -2
  126. package/dist/components/textfield/features/prefix-text.d.ts +1 -2
  127. package/dist/components/textfield/features/suffix-text.d.ts +1 -2
  128. package/dist/components/textfield/features/supporting-text.d.ts +1 -2
  129. package/dist/components/textfield/features/trailing-icon.d.ts +1 -2
  130. package/dist/components/textfield/types.d.ts +0 -2
  131. package/dist/components/timepicker/api.d.ts +5 -4
  132. package/dist/components/timepicker/config.d.ts +14 -11
  133. package/dist/components/tooltip/config.d.ts +2 -2
  134. package/dist/components/tooltip/tooltip.d.ts +1 -1
  135. package/dist/core/compose/base.d.ts +2 -2
  136. package/dist/core/compose/base.js +1 -1
  137. package/dist/core/compose/component.d.ts +13 -4
  138. package/dist/core/compose/component.js +1 -1
  139. package/dist/core/compose/features/badge.d.ts +3 -4
  140. package/dist/core/compose/features/badge.js +1 -1
  141. package/dist/core/compose/features/checkable.d.ts +3 -4
  142. package/dist/core/compose/features/debounce.d.ts +2 -3
  143. package/dist/core/compose/features/disabled.d.ts +1 -2
  144. package/dist/core/compose/features/events.d.ts +4 -3
  145. package/dist/core/compose/features/icon.d.ts +1 -5
  146. package/dist/core/compose/features/input.d.ts +2 -3
  147. package/dist/core/compose/features/lifecycle.d.ts +2 -2
  148. package/dist/core/compose/features/lifecycle.js +3 -3
  149. package/dist/core/compose/features/position.d.ts +1 -2
  150. package/dist/core/compose/features/ripple.d.ts +1 -2
  151. package/dist/core/compose/features/size.d.ts +1 -2
  152. package/dist/core/compose/features/style.d.ts +1 -2
  153. package/dist/core/compose/features/text.d.ts +1 -5
  154. package/dist/core/compose/features/textinput.d.ts +2 -3
  155. package/dist/core/compose/features/textlabel.d.ts +1 -2
  156. package/dist/core/compose/features/throttle.d.ts +1 -2
  157. package/dist/core/compose/features/track.d.ts +0 -1
  158. package/dist/core/compose/features/variant.d.ts +1 -2
  159. package/dist/core/compose/index.d.ts +1 -1
  160. package/dist/core/compose/pipe.d.ts +43 -3
  161. package/dist/core/compose/pipe.js +6 -2
  162. package/dist/core/compose/utils/type-guards.d.ts +4 -4
  163. package/dist/core/compose/utils/type-guards.js +1 -1
  164. package/dist/core/config/component.d.ts +12 -9
  165. package/dist/core/config/global.d.ts +12 -8
  166. package/dist/core/config.d.ts +1 -1
  167. package/dist/core/dom/attributes.d.ts +6 -6
  168. package/dist/core/dom/attributes.js +8 -5
  169. package/dist/core/dom/create.d.ts +27 -10
  170. package/dist/core/dom/create.js +5 -26
  171. package/dist/core/dom/utils.d.ts +1 -1
  172. package/dist/core/dom/utils.js +4 -1
  173. package/dist/core/state/emitter.d.ts +2 -2
  174. package/dist/core/state/events.d.ts +3 -3
  175. package/dist/core/state/lifecycle.d.ts +0 -1
  176. package/dist/core/state/store.d.ts +3 -3
  177. package/dist/core/utils/index.d.ts +1 -0
  178. package/dist/core/utils/index.js +1 -0
  179. package/dist/core/utils/object.d.ts +2 -2
  180. package/dist/core/utils/performance.d.ts +3 -3
  181. package/dist/core/utils/url.d.ts +20 -0
  182. package/dist/core/utils/url.js +0 -0
  183. package/dist/core/utils/validate.d.ts +6 -6
  184. package/dist/core/utils/validate.js +13 -12
  185. package/dist/index.cjs +0 -0
  186. package/dist/package.json +1 -1
  187. package/dist/styles/badge.css +2 -2
  188. package/dist/styles/base.css +2 -2
  189. package/dist/styles/bottom-app-bar.css +2 -2
  190. package/dist/styles/bottom-sheet.css +2 -2
  191. package/dist/styles/button-group.css +2 -2
  192. package/dist/styles/button.css +2 -2
  193. package/dist/styles/card.css +2 -2
  194. package/dist/styles/carousel.css +2 -2
  195. package/dist/styles/checkbox.css +2 -2
  196. package/dist/styles/chips.css +2 -2
  197. package/dist/styles/dialog.css +2 -2
  198. package/dist/styles/divider.css +2 -2
  199. package/dist/styles/drawer.css +2 -2
  200. package/dist/styles/extended-fab.css +2 -2
  201. package/dist/styles/fab.css +2 -2
  202. package/dist/styles/icon-button.css +2 -2
  203. package/dist/styles/list.css +2 -2
  204. package/dist/styles/loading-indicator.css +2 -2
  205. package/dist/styles/menu.css +2 -2
  206. package/dist/styles/navigation-rail.css +2 -2
  207. package/dist/styles/navigation.css +2 -2
  208. package/dist/styles/progress.css +2 -2
  209. package/dist/styles/radios.css +2 -2
  210. package/dist/styles/search.css +2 -2
  211. package/dist/styles/segmented-button.css +2 -2
  212. package/dist/styles/select.css +2 -2
  213. package/dist/styles/side-sheet.css +2 -2
  214. package/dist/styles/slider.css +2 -2
  215. package/dist/styles/snackbar.css +2 -2
  216. package/dist/styles/split-button.css +2 -2
  217. package/dist/styles/switch.css +2 -2
  218. package/dist/styles/tabs.css +2 -2
  219. package/dist/styles/textfield.css +2 -2
  220. package/dist/styles/timepicker.css +2 -2
  221. package/dist/styles/tooltip.css +2 -0
  222. package/dist/styles/tooltip.d.ts +1 -0
  223. package/dist/styles/tooltip.js +2 -0
  224. package/dist/styles/top-app-bar.css +2 -2
  225. package/dist/styles/utilities.css +2 -2
  226. package/dist/styles.css +2 -2
  227. package/dist/themes/autumn.css +1 -1
  228. package/dist/themes/baseline.css +1 -1
  229. package/dist/themes/brownbeige.css +1 -1
  230. package/dist/themes/browngreen.css +1 -1
  231. package/dist/themes/desert.css +1 -1
  232. package/dist/themes/forest.css +1 -1
  233. package/dist/themes/highcontrast.css +1 -1
  234. package/dist/themes/legacy.css +1 -1
  235. package/dist/themes/material.css +1 -1
  236. package/dist/themes/ocean.css +1 -1
  237. package/dist/themes/sageivory.css +1 -1
  238. package/dist/themes/spring.css +1 -1
  239. package/dist/themes/summer.css +1 -1
  240. package/dist/themes/sunset.css +1 -1
  241. package/dist/themes/tealcaramel.css +1 -1
  242. package/dist/themes/winter.css +1 -1
  243. package/package.json +2 -2
  244. package/src/styles/abstract/_mixins.scss +5 -1
  245. package/src/styles/components/_checkbox.scss +27 -7
  246. package/src/styles/components/_chips.scss +13 -13
  247. package/src/styles/components/_datepicker.scss +5 -5
  248. package/src/styles/components/_dialog.scss +2 -2
  249. package/src/styles/components/_radios.scss +30 -30
  250. package/src/styles/components/_switch.scss +36 -26
  251. package/src/styles/components/_tabs.scss +59 -58
  252. package/src/styles/components/_timepicker.scss +3 -3
  253. package/src/styles/main.scss +1 -0
@@ -1,8 +1,8 @@
1
1
  import { SEARCH_CLASSES, SEARCH_KEYS, SEARCH_ICONS } from "../constants.js";
2
2
  import { createElement } from "../../../core/dom/create.js";
3
- export const withSuggestions = (config) => (component) => {
3
+ export const withSuggestions = () => (component) => {
4
4
  let highlightedIndex = -1;
5
- let currentSuggestions = [];
5
+ const currentSuggestions = [];
6
6
  const getClass = (className) => {
7
7
  return component.getClass ? component.getClass(className) : className;
8
8
  };
@@ -14,16 +14,17 @@ export const withSuggestions = (config) => (component) => {
14
14
  };
15
15
  const highlightMatch = (text, query) => {
16
16
  if (!query)
17
- return text;
18
- const lowerText = text.toLowerCase();
19
- const lowerQuery = query.toLowerCase();
20
- const matchIndex = lowerText.indexOf(lowerQuery);
17
+ return [document.createTextNode(text)];
18
+ const matchIndex = text.toLowerCase().indexOf(query.toLowerCase());
21
19
  if (matchIndex === -1)
22
- return text;
23
- const beforeMatch = text.slice(0, matchIndex);
24
- const match = text.slice(matchIndex, matchIndex + query.length);
25
- const afterMatch = text.slice(matchIndex + query.length);
26
- return `${beforeMatch}<strong>${match}</strong>${afterMatch}`;
20
+ return [document.createTextNode(text)];
21
+ const strong = document.createElement("strong");
22
+ strong.textContent = text.slice(matchIndex, matchIndex + query.length);
23
+ return [
24
+ document.createTextNode(text.slice(0, matchIndex)),
25
+ strong,
26
+ document.createTextNode(text.slice(matchIndex + query.length)),
27
+ ];
27
28
  };
28
29
  const createSuggestionItem = (suggestion, index, query) => {
29
30
  const isHighlighted = index === highlightedIndex;
@@ -43,7 +44,7 @@ export const withSuggestions = (config) => (component) => {
43
44
  },
44
45
  });
45
46
  if (suggestion.icon) {
46
- const iconElement = createElement({
47
+ createElement({
47
48
  tag: "span",
48
49
  className: getClass(SEARCH_CLASSES.SUGGESTION_ICON),
49
50
  container: item,
@@ -51,19 +52,19 @@ export const withSuggestions = (config) => (component) => {
51
52
  });
52
53
  }
53
54
  else {
54
- const iconElement = createElement({
55
+ createElement({
55
56
  tag: "span",
56
57
  className: getClass(SEARCH_CLASSES.SUGGESTION_ICON),
57
58
  container: item,
58
59
  html: SEARCH_ICONS.HISTORY,
59
60
  });
60
61
  }
61
- const textElement = createElement({
62
+ const label = createElement({
62
63
  tag: "span",
63
64
  className: getClass(SEARCH_CLASSES.SUGGESTION_TEXT),
64
65
  container: item,
65
- html: highlightMatch(suggestion.text, query),
66
66
  });
67
+ label.append(...highlightMatch(suggestion.text, query));
67
68
  return item;
68
69
  };
69
70
  const createDivider = () => {
@@ -7,7 +7,7 @@ import { createBaseConfig, getElementConfig, getApiConfig } from "./config.js";
7
7
  const createSearch = (config = {}) => {
8
8
  const baseConfig = createBaseConfig(config);
9
9
  try {
10
- const component = pipe(createBase, withEvents(), withElement(getElementConfig(baseConfig)), withStructure(baseConfig), withStates(baseConfig), withInput(baseConfig), withSuggestions(baseConfig), withLifecycle())(baseConfig);
10
+ const component = pipe(createBase, withEvents(), withElement(getElementConfig(baseConfig)), withStructure(baseConfig), withStates(baseConfig), withInput(baseConfig), withSuggestions(), withLifecycle())(baseConfig);
11
11
  const apiOptions = getApiConfig(component);
12
12
  const search = withAPI(apiOptions)(component);
13
13
  if (baseConfig.on && typeof search.on === "function") {
@@ -3,11 +3,7 @@ import { SegmentedButtonConfig, SelectionMode } from "./types.js";
3
3
  * Default configuration values for segmented buttons
4
4
  * @internal
5
5
  */
6
- export declare const DEFAULT_CONFIG: {
7
- mode: "single";
8
- ripple: true;
9
- density: "default";
10
- };
6
+ export declare const DEFAULT_CONFIG: SegmentedButtonConfig;
11
7
  /**
12
8
  * Creates the base configuration for Segmented Button component
13
9
  * @param {SegmentedButtonConfig} config - User provided configuration
@@ -2,7 +2,7 @@ import { createComponentConfig } from "../../core/config/component.js";
2
2
  import { SelectionMode, Density } from "./types.js";
3
3
  import { SEGMENTED_BUTTON_DEFAULTS } from "./constants.js";
4
4
  export const DEFAULT_CONFIG = {
5
- mode: SEGMENTED_BUTTON_DEFAULTS.MODE,
5
+ mode: SelectionMode.SINGLE,
6
6
  ripple: SEGMENTED_BUTTON_DEFAULTS.RIPPLE,
7
7
  density: SEGMENTED_BUTTON_DEFAULTS.DENSITY,
8
8
  };
@@ -1,8 +1,8 @@
1
- import { SelectComponent, ApiOptions } from "./types.js";
1
+ import { SelectComponent, ApiOptions, BaseComponent } from "./types.js";
2
2
  /**
3
3
  * Enhances a select component with API methods
4
4
  * @param options - API configuration options
5
5
  * @returns Higher-order function that adds API methods to component
6
6
  * @internal
7
7
  */
8
- export declare const withAPI: (options: ApiOptions) => (component: any) => SelectComponent;
8
+ export declare const withAPI: (options: ApiOptions) => (component: BaseComponent) => SelectComponent;
@@ -4,10 +4,10 @@ import { SelectConfig, BaseComponent } from "./types.js";
4
4
  * @param config - Select configuration
5
5
  * @returns Function that enhances a component with textfield functionality
6
6
  */
7
- export declare const withTextfield: (config: SelectConfig) => (component: BaseComponent) => BaseComponent;
7
+ export declare const withTextfield: (config: SelectConfig) => <C extends object>(component: C) => C & Required<Pick<BaseComponent, "element" | "textfield">>;
8
8
  /**
9
9
  * Creates a menu for the select component
10
10
  * @param config - Select configuration
11
11
  * @returns Function that enhances a component with menu functionality
12
12
  */
13
- export declare const withMenu: (config: SelectConfig) => (component: BaseComponent) => BaseComponent;
13
+ export declare const withMenu: (config: SelectConfig) => <C extends BaseComponent>(component: C) => C & Pick<BaseComponent, "menu" | "select">;
@@ -54,6 +54,7 @@ export const withTextfield = (config) => (component) => {
54
54
  textfield,
55
55
  };
56
56
  };
57
+ const isSelectOption = (value) => typeof value === "object" && value !== null && "id" in value && "text" in value;
57
58
  const processMenuItems = (options) => {
58
59
  return options.map((option) => {
59
60
  if ("type" in option && option.type === "divider") {
@@ -106,7 +107,7 @@ export const withMenu = (config) => (component) => {
106
107
  return;
107
108
  }
108
109
  const option = event.item.data;
109
- if (!option || !("id" in option) || !("text" in option)) {
110
+ if (!isSelectOption(option)) {
110
111
  console.warn("Invalid menu selection: missing required data properties");
111
112
  return;
112
113
  }
@@ -1,4 +1,5 @@
1
- import type { MenuColor, MenuVariant } from "../menu/types.js";
1
+ import type { MenuColor, MenuComponent, MenuVariant } from "../menu/types.js";
2
+ import type { TextfieldComponent } from "../textfield/types.js";
2
3
  /**
3
4
  * Available Select variants
4
5
  */
@@ -42,7 +43,7 @@ export interface SelectOption {
42
43
  /**
43
44
  * Additional data associated with the option
44
45
  */
45
- data?: any;
46
+ data?: unknown;
46
47
  }
47
48
  /**
48
49
  * Configuration interface for the Select component
@@ -153,11 +154,11 @@ export interface SelectComponent {
153
154
  /**
154
155
  * The textfield component
155
156
  */
156
- textfield: any;
157
+ textfield: TextfieldComponent;
157
158
  /**
158
159
  * The menu component
159
160
  */
160
- menu: any;
161
+ menu: MenuComponent;
161
162
  /**
162
163
  * Gets the select's current value (selected option id)
163
164
  */
@@ -312,45 +313,61 @@ export interface SelectEvents {
312
313
  export interface ApiOptions {
313
314
  select: {
314
315
  getValue: () => string | null;
315
- setValue: (value: string | null | undefined) => any;
316
- clear: () => any;
316
+ setValue: (value: string | null | undefined) => void;
317
+ clear: () => void;
317
318
  getText: () => string;
318
319
  getSelectedOption: () => SelectOption | null;
319
320
  getOptions: () => SelectOption[];
320
- setOptions: (options: SelectOption[]) => any;
321
- open: () => any;
322
- close: () => any;
321
+ setOptions: (options: SelectOption[]) => void;
322
+ open: () => void;
323
+ close: () => void;
323
324
  isOpen: () => boolean;
324
325
  };
325
326
  events?: {
326
- on: <T extends string>(event: T, handler: (event: any) => void) => any;
327
- off: <T extends string>(event: T, handler: (event: any) => void) => any;
327
+ on: <T extends keyof SelectEvents>(event: T, handler: SelectEvents[T]) => void;
328
+ off: <T extends keyof SelectEvents>(event: T, handler: SelectEvents[T]) => void;
328
329
  };
329
330
  disabled: {
330
- enable: () => any;
331
- disable: () => any;
331
+ enable: () => void;
332
+ disable: () => void;
332
333
  };
333
334
  lifecycle: {
334
335
  destroy: () => void;
335
336
  };
336
337
  }
338
+ /**
339
+ * Select controller added by the menu feature
340
+ * @internal
341
+ */
342
+ export interface SelectController {
343
+ getValue: () => string | null;
344
+ setValue: (value: string | null | undefined) => BaseComponent;
345
+ clear: () => BaseComponent;
346
+ getText: () => string;
347
+ getSelectedOption: () => SelectOption | null;
348
+ getOptions: () => SelectOption[];
349
+ setOptions: (options: SelectOption[]) => BaseComponent;
350
+ open: (event?: Event, interactionType?: "mouse" | "keyboard") => BaseComponent;
351
+ close: (event?: Event) => BaseComponent;
352
+ isOpen: () => boolean;
353
+ }
337
354
  /**
338
355
  * Base component interface
339
356
  * @internal
340
357
  */
341
358
  export interface BaseComponent {
342
359
  element: HTMLElement;
343
- textfield?: any;
344
- menu?: any;
345
- on?: (event: string, handler: Function) => any;
346
- off?: (event: string, handler: Function) => any;
347
- emit?: (event: string, data: any) => void;
360
+ textfield?: TextfieldComponent;
361
+ menu?: MenuComponent;
362
+ select?: SelectController;
363
+ on?: (event: string, handler: Function) => void;
364
+ off?: (event: string, handler: Function) => void;
365
+ emit?: (event: string, data?: unknown) => void;
348
366
  disabled?: {
349
- enable: () => any;
350
- disable: () => any;
367
+ enable: () => void;
368
+ disable: () => void;
351
369
  };
352
370
  lifecycle?: {
353
371
  destroy: () => void;
354
372
  };
355
- [key: string]: any;
356
373
  }
@@ -13,7 +13,7 @@ export declare const createBaseConfig: (config?: SideSheetConfig) => SideSheetCo
13
13
  export declare const getElementConfig: (config: SideSheetConfig) => {
14
14
  tag: string;
15
15
  componentName: string;
16
- attributes: Record<string, any>;
16
+ attributes: Record<string, unknown>;
17
17
  className: string[];
18
18
  rawClass: string | string[];
19
19
  id: string;
@@ -29,6 +29,6 @@ export declare const getElementConfig: (config: SideSheetConfig) => {
29
29
  ariaHidden: boolean;
30
30
  html: string;
31
31
  text: string;
32
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
32
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
33
33
  interactive: boolean;
34
34
  };
@@ -5,17 +5,17 @@ import { SliderSize } from "./constants.js";
5
5
  */
6
6
  interface ApiOptions {
7
7
  slider: {
8
- setValue: (value: number, triggerEvent?: boolean) => any;
8
+ setValue: (value: number, triggerEvent?: boolean) => unknown;
9
9
  getValue: () => number;
10
- setSecondValue: (value: number, triggerEvent?: boolean) => any;
10
+ setSecondValue: (value: number, triggerEvent?: boolean) => unknown;
11
11
  getSecondValue: () => number | null;
12
- setMin: (min: number) => any;
12
+ setMin: (min: number) => unknown;
13
13
  getMin: () => number;
14
- setMax: (max: number) => any;
14
+ setMax: (max: number) => unknown;
15
15
  getMax: () => number;
16
- setStep: (step: number) => any;
16
+ setStep: (step: number) => unknown;
17
17
  getStep: () => number;
18
- regenerateTicks: () => any;
18
+ regenerateTicks: () => unknown;
19
19
  };
20
20
  disabled: {
21
21
  enable: () => void;
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: SliderConfig) => SliderConfig;
17
17
  export declare const getElementConfig: (config: SliderConfig) => {
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: SliderConfig) => {
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
  /**
@@ -65,7 +65,7 @@ export interface SliderConfig extends BaseComponentConfig {
65
65
  /** CSS class prefix */
66
66
  prefix?: string;
67
67
  /** Component schema */
68
- schema?: any;
68
+ schema?: object;
69
69
  }
70
70
  /**
71
71
  * Slider event data
@@ -73,7 +73,7 @@ export interface SliderConfig extends BaseComponentConfig {
73
73
  */
74
74
  export interface SliderEvent {
75
75
  /** The slider component that triggered the event */
76
- slider: any;
76
+ slider: SliderComponent;
77
77
  /** Current slider value */
78
78
  value: number;
79
79
  /** Secondary value (for range sliders) */
@@ -30,7 +30,7 @@ export declare const durationToMs: (duration: SnackbarDuration | undefined, hasA
30
30
  export declare const getElementConfig: (config: SnackbarConfig) => {
31
31
  tag: string;
32
32
  componentName: string;
33
- attributes: Record<string, any>;
33
+ attributes: Record<string, unknown>;
34
34
  className: string[];
35
35
  rawClass: string | string[];
36
36
  id: string;
@@ -46,7 +46,7 @@ export declare const getElementConfig: (config: SnackbarConfig) => {
46
46
  ariaHidden: boolean;
47
47
  html: string;
48
48
  text: string;
49
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
49
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
50
50
  interactive: boolean;
51
51
  };
52
52
  /**
@@ -6,7 +6,7 @@ import { BaseComponent, SnackbarConfig } from "./types.js";
6
6
  * @param {SnackbarConfig} config - Component configuration
7
7
  * @returns {Function} Higher-order function that adds the action button
8
8
  */
9
- export declare const withActionButton: (config: SnackbarConfig) => (component: BaseComponent) => BaseComponent;
9
+ export declare const withActionButton: (config: SnackbarConfig) => <C extends BaseComponent>(component: C) => C & Pick<BaseComponent, "action" | "actionButton">;
10
10
  /**
11
11
  * Adds the optional close affordance: a standard icon button (40dp, 24dp
12
12
  * icon; `SnackbarTokens.IconSize`), coloured inverse-on-surface by the
@@ -14,7 +14,7 @@ export declare const withActionButton: (config: SnackbarConfig) => (component: B
14
14
  * @param {SnackbarConfig} config - Component configuration
15
15
  * @returns {Function} Higher-order function that adds the close button
16
16
  */
17
- export declare const withCloseButton: (config: SnackbarConfig) => (component: BaseComponent) => BaseComponent;
17
+ export declare const withCloseButton: (config: SnackbarConfig) => <C extends BaseComponent>(component: C) => C & Pick<BaseComponent, "close" | "closeButton">;
18
18
  /**
19
19
  * Adds the auto-dismiss timer. It emits `timeout` when the duration runs out
20
20
  * and holds while the pointer is over the snackbar or focus is inside it:
@@ -23,4 +23,4 @@ export declare const withCloseButton: (config: SnackbarConfig) => (component: Ba
23
23
  * @param {SnackbarConfig} config - Component configuration
24
24
  * @returns {Function} Higher-order function that adds timer features
25
25
  */
26
- export declare const withDismissTimer: (config: SnackbarConfig) => (component: BaseComponent) => BaseComponent;
26
+ export declare const withDismissTimer: (config: SnackbarConfig) => <C extends BaseComponent>(component: C) => C & Required<Pick<BaseComponent, "timer">>;
@@ -12,5 +12,5 @@ interface PositionConfig {
12
12
  * @param {PositionConfig} config - Position configuration
13
13
  * @returns {Function} Higher-order function that adds position features
14
14
  */
15
- export declare const withPosition: (config: PositionConfig) => (component: BaseComponent) => BaseComponent;
15
+ export declare const withPosition: (config: PositionConfig) => <C extends BaseComponent>(component: C) => C & Required<Pick<BaseComponent, "position">>;
16
16
  export {};
@@ -134,27 +134,26 @@ export interface SnackbarComponent {
134
134
  */
135
135
  export interface BaseComponent {
136
136
  element: HTMLElement;
137
- emit?: (event: string, data?: any) => void;
138
- on?: (event: string, handler: (...args: any[]) => void) => any;
139
- off?: (event: string, handler: (...args: any[]) => void) => any;
137
+ emit?: (event: string, data?: unknown) => void;
138
+ on?: (event: string, handler: Function) => unknown;
139
+ off?: (event: string, handler: Function) => unknown;
140
140
  getClass?: (name: string) => string;
141
141
  lifecycle?: {
142
142
  destroy?: () => void;
143
143
  };
144
144
  text?: {
145
- setText: (text: string) => any;
145
+ setText: (text: string) => unknown;
146
146
  getText: () => string;
147
147
  };
148
148
  position?: {
149
149
  getPosition: () => SnackbarPosition;
150
- setPosition: (position: SnackbarPosition) => any;
150
+ setPosition: (position: SnackbarPosition) => unknown;
151
151
  };
152
152
  action?: ButtonComponent;
153
153
  actionButton?: HTMLElement;
154
154
  close?: IconButtonComponent;
155
155
  closeButton?: HTMLElement;
156
156
  timer?: SnackbarTimer;
157
- [key: string]: any;
158
157
  }
159
158
  /**
160
159
  * Timer interface for snackbar auto-dismissal
@@ -2,9 +2,7 @@ import { SPLIT_BUTTON_CLASSES, SPLIT_BUTTON_EVENTS } from "./constants.js";
2
2
  export const withAPI = ({ config, lifecycle }) => (component) => {
3
3
  const element = component.element;
4
4
  const prefix = config.prefix || "mtrl";
5
- const leading = component.leading;
6
- const trailing = component.trailing;
7
- const menu = component.menu;
5
+ const { leading, trailing, menu } = component;
8
6
  const expandedClass = `${prefix}-${SPLIT_BUTTON_CLASSES.EXPANDED}`;
9
7
  let expanded = false;
10
8
  if (menu)
@@ -18,7 +18,7 @@ export declare const createBaseConfig: (config?: SplitButtonConfig) => SplitButt
18
18
  export declare const getElementConfig: (config: SplitButtonConfig) => {
19
19
  tag: string;
20
20
  componentName: string;
21
- attributes: Record<string, any>;
21
+ attributes: Record<string, unknown>;
22
22
  className: string[];
23
23
  rawClass: string | string[];
24
24
  id: string;
@@ -34,7 +34,7 @@ export declare const getElementConfig: (config: SplitButtonConfig) => {
34
34
  ariaHidden: boolean;
35
35
  html: string;
36
36
  text: string;
37
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
37
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
38
38
  interactive: boolean;
39
39
  };
40
40
  export default defaultConfig;
@@ -1,7 +1,8 @@
1
- import { BaseComponent, SplitButtonConfig } from "../types.js";
1
+ import type { ElementComponent } from "../../../core/compose/component.js";
2
+ import { ButtonsFeature, SplitButtonConfig } from "../types.js";
2
3
  /**
3
4
  * Adds the leading and trailing buttons
4
5
  * @param {SplitButtonConfig} config - Component configuration
5
6
  * @returns {Function} Higher-order function that adds both buttons
6
7
  */
7
- export declare const withButtons: (config: SplitButtonConfig) => (component: BaseComponent) => BaseComponent;
8
+ export declare const withButtons: (config: SplitButtonConfig) => <C extends ElementComponent>(component: C) => C & ButtonsFeature;
@@ -1,7 +1,8 @@
1
- import { BaseComponent, SplitButtonConfig } from "../types.js";
1
+ import type { ElementComponent } from "../../../core/compose/component.js";
2
+ import { ButtonsFeature, MenuFeature, SplitButtonConfig } from "../types.js";
2
3
  /**
3
4
  * Adds a menu anchored to the trailing button
4
5
  * @param {SplitButtonConfig} config - Component configuration
5
6
  * @returns {Function} Higher-order function that adds the menu
6
7
  */
7
- export declare const withMenu: (config: SplitButtonConfig) => (component: BaseComponent) => BaseComponent;
8
+ export declare const withMenu: (config: SplitButtonConfig) => <C extends ElementComponent & ButtonsFeature>(component: C) => C & MenuFeature;
@@ -1,4 +1,5 @@
1
1
  import type { MenuContent, MenuComponent } from "../menu/types.js";
2
+ import type { ButtonComponent } from "../button/types.js";
2
3
  /** Visual style, the same set the button offers */
3
4
  export type SplitButtonVariant = "filled" | "tonal" | "outlined" | "elevated";
4
5
  /** Size, matching the button and icon button scale */
@@ -102,8 +103,19 @@ export interface SplitButtonComponent {
102
103
  /** Takes the component off the page and releases what it holds */
103
104
  destroy: () => void;
104
105
  }
106
+ /** What withButtons adds */
107
+ export interface ButtonsFeature {
108
+ leading: ButtonComponent;
109
+ trailing: ButtonComponent;
110
+ leadingElement: HTMLElement;
111
+ trailingElement: HTMLElement;
112
+ }
113
+ /** What withMenu adds: the menu, when the component was given items */
114
+ export interface MenuFeature {
115
+ menu?: MenuComponent;
116
+ }
105
117
  /** The component as it passes through the enhancers */
106
- export interface BaseComponent {
118
+ export interface BaseComponent extends ButtonsFeature, MenuFeature {
107
119
  element: HTMLElement;
108
120
  emit?: (event: string, data?: unknown) => void;
109
121
  on?: (event: string, handler: (...args: unknown[]) => void) => unknown;
@@ -112,5 +124,4 @@ export interface BaseComponent {
112
124
  lifecycle?: {
113
125
  destroy?: () => void;
114
126
  };
115
- [key: string]: unknown;
116
127
  }
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: SwitchConfig) => SwitchConfig;
17
17
  export declare const getElementConfig: (config: SwitchConfig) => {
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: SwitchConfig) => {
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
  /**
@@ -136,5 +136,4 @@ export interface BaseComponent {
136
136
  supportingTextElement?: HTMLElement | null;
137
137
  setSupportingText?: (text: string, isError?: boolean) => void;
138
138
  removeSupportingText?: () => void;
139
- [key: string]: unknown;
140
139
  }
@@ -25,13 +25,16 @@ interface ComponentWithElements {
25
25
  /** Class name helper */
26
26
  getClass: (name: string) => string;
27
27
  /** Event subscription (optional) */
28
- on?: (event: string, handler: Function) => any;
28
+ on?: (event: string, handler: Function) => unknown;
29
29
  /** Event unsubscription (optional) */
30
- off?: (event: string, handler: Function) => any;
31
- /** Event emission (optional) */
32
- emit?: (event: string, data: any) => any;
30
+ off?: (event: string, handler: Function) => unknown;
31
+ /** Event emission (optional); returns `this`, the tabs component once spread */
32
+ emit?: TabsComponent['emit'];
33
33
  /** Component configuration */
34
- config: Record<string, any>;
34
+ config: {
35
+ prefix?: string;
36
+ variant?: string;
37
+ };
35
38
  }
36
39
  /**
37
40
  * Enhances a tabs component with API methods
@@ -12,7 +12,15 @@ export declare const defaultTabsConfig: {
12
12
  showDivider: true;
13
13
  componentName: string;
14
14
  };
15
- export declare const createTabsConfig: (config?: {}) => import("../../core/config/component.js").BaseComponentConfig;
15
+ export declare const createTabsConfig: (config?: {}) => {
16
+ variant: "primary";
17
+ scrollable: true;
18
+ showDivider: true;
19
+ componentName: string;
20
+ } & {
21
+ componentName: string;
22
+ prefix: string;
23
+ };
16
24
  /**
17
25
  * Creates the base configuration for a Tab
18
26
  * @param {TabConfig} config - User provided configuration
@@ -4,10 +4,10 @@ interface ComponentBase {
4
4
  element: HTMLElement;
5
5
  getClass: (name: string) => string;
6
6
  scrollContainer?: HTMLElement;
7
- emit?: (event: string, data: any) => any;
7
+ emit?: (event: string, data?: unknown) => unknown;
8
8
  destroy?: () => void;
9
9
  tabs?: TabComponent[];
10
- handleTabClick?: (event: any, tab: TabComponent) => void;
10
+ handleTabClick?: (event: unknown, tab: TabComponent) => void;
11
11
  variant?: string;
12
12
  }
13
13
  /**
@@ -20,8 +20,6 @@ export interface TabsManagementConfig {
20
20
  variant?: string;
21
21
  /** Component prefix */
22
22
  prefix?: string;
23
- /** Other configuration properties */
24
- [key: string]: any;
25
23
  }
26
24
  /**
27
25
  * Component with tabs management capabilities
@@ -43,15 +41,13 @@ export interface TabsManagementComponent {
43
41
  * @param {TabsManagementConfig} config - Tabs configuration
44
42
  * @returns {Function} Component enhancer with tabs management
45
43
  */
46
- export declare const withTabsManagement: <T extends TabsManagementConfig>(config: T) => <C extends ComponentBase>(component: C) => C & TabsManagementComponent;
44
+ export declare const withTabsManagement: <T extends TabsManagementConfig & object>(config: T) => <C extends ComponentBase>(component: C) => C & TabsManagementComponent;
47
45
  /**
48
46
  * Configuration for scrollable feature
49
47
  */
50
48
  export interface ScrollableConfig {
51
49
  /** Whether tabs are scrollable horizontally */
52
50
  scrollable?: boolean;
53
- /** Other configuration properties */
54
- [key: string]: any;
55
51
  }
56
52
  /**
57
53
  * Component with scrollable capabilities
@@ -65,28 +61,28 @@ export interface ScrollableComponent {
65
61
  * @param {ScrollableConfig} config - Scrollable configuration
66
62
  * @returns {Function} Component enhancer with scrollable container
67
63
  */
68
- export declare const withScrollable: <T extends ScrollableConfig>(config: T) => <C extends ComponentBase>(component: C) => C & ScrollableComponent;
64
+ export declare const withScrollable: <T extends ScrollableConfig & object>(config: T) => <C extends ComponentBase>(component: C) => C & ScrollableComponent;
69
65
  /**
70
66
  * Configuration for divider feature
71
67
  */
72
68
  export interface DividerConfig {
73
69
  /** Whether to show a divider below the tabs */
74
70
  showDivider?: boolean;
75
- /** Other configuration properties */
76
- [key: string]: any;
77
71
  }
78
72
  /**
79
73
  * Adds a divider to a component
80
74
  * @param {DividerConfig} config - Divider configuration
81
75
  * @returns {Function} Component enhancer with divider
82
76
  */
83
- export declare const withDivider: <T extends DividerConfig>(config: T) => <C extends ComponentBase>(component: C) => C;
77
+ export declare const withDivider: <T extends DividerConfig & object>(config: T) => <C extends ComponentBase>(component: C) => C;
84
78
  /**
85
79
  * Configuration for indicator feature
86
80
  */
87
81
  export interface IndicatorFeatureConfig {
88
82
  /** Component prefix */
89
83
  prefix?: string;
84
+ /** Tabs variant passed to the indicator */
85
+ variant?: string;
90
86
  /** Width strategy for the indicator */
91
87
  widthStrategy?: "fixed" | "dynamic" | "content";
92
88
  /** Height of the indicator in pixels */