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
@@ -29,7 +29,7 @@ export declare const createBaseConfig: (config?: BadgeConfig) => BadgeConfig;
29
29
  export declare const getElementConfig: (config: BadgeConfig) => {
30
30
  tag: string;
31
31
  componentName: string;
32
- attributes: Record<string, any>;
32
+ attributes: Record<string, unknown>;
33
33
  className: string[];
34
34
  rawClass: string | string[];
35
35
  id: string;
@@ -45,7 +45,7 @@ export declare const getElementConfig: (config: BadgeConfig) => {
45
45
  ariaHidden: boolean;
46
46
  html: string;
47
47
  text: string;
48
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
48
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
49
49
  interactive: boolean;
50
50
  };
51
51
  /**
@@ -6,7 +6,7 @@ import { withAPI, applyEventHandlers } from "./api.js";
6
6
  import { createBaseConfig, getElementConfig } from "./config.js";
7
7
  const createBottomSheet = (config = {}) => {
8
8
  const baseConfig = createBaseConfig(config);
9
- const component = pipe(createBase, withEvents(), withElement(getElementConfig(baseConfig)), withStructure(baseConfig), withState(baseConfig), withDrag(baseConfig), withLifecycle())(baseConfig);
9
+ const component = pipe(createBase, withEvents(), withElement(getElementConfig(baseConfig)), withStructure(baseConfig), withState(baseConfig), withDrag(), withLifecycle())(baseConfig);
10
10
  applyEventHandlers(component, baseConfig.on);
11
11
  return withAPI({
12
12
  state: component.state,
@@ -13,7 +13,7 @@ export declare const createBaseConfig: (config?: BottomSheetConfig) => BottomShe
13
13
  export declare const getElementConfig: (config: BottomSheetConfig) => {
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: BottomSheetConfig) => {
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
  };
@@ -1,4 +1,4 @@
1
- import { BottomSheetConfig, BottomSheetState } from "../types.js";
1
+ import { BottomSheetState } from "../types.js";
2
2
  interface DragComponent {
3
3
  getClass: (name: string) => string;
4
4
  emit: (event: string, data?: unknown) => unknown;
@@ -20,7 +20,7 @@ interface DragComponent {
20
20
  * does the same however short it was, so a quick flick works without having to
21
21
  * cover the distance.
22
22
  */
23
- export declare const withDrag: (config: BottomSheetConfig) => <C extends DragComponent>(component: C) => (C & {
23
+ export declare const withDrag: () => <C extends DragComponent>(component: C) => (C & {
24
24
  drag: {
25
25
  release: () => void;
26
26
  };
@@ -1,5 +1,5 @@
1
1
  import { BOTTOM_SHEET_DEFAULTS, BOTTOM_SHEET_EVENTS, BOTTOM_SHEET_STATES, } from "../constants.js";
2
- export const withDrag = (config) => (component) => {
2
+ export const withDrag = () => (component) => {
3
3
  const { structure, state } = component;
4
4
  const handle = structure.handle;
5
5
  if (!handle)
@@ -34,9 +34,9 @@ interface ComponentWithElements {
34
34
  };
35
35
  getClass: (name: string) => string;
36
36
  componentName?: string;
37
- on?: (event: string, handler: Function) => ComponentWithElements;
38
- off?: (event: string, handler: Function) => ComponentWithElements;
39
- addClass?: (...classes: string[]) => ComponentWithElements;
37
+ on?: (event: string, handler: Function) => unknown;
38
+ off?: (event: string, handler: Function) => unknown;
39
+ addClass?: (...classes: string[]) => unknown;
40
40
  toggle?: {
41
41
  setSelected: (selected: boolean) => void;
42
42
  isSelected: () => boolean;
@@ -61,5 +61,5 @@ import { ButtonConfig } from "./types.js";
61
61
  *
62
62
  * @category Components
63
63
  */
64
- declare const createButton: (config?: ButtonConfig) => any;
64
+ declare const createButton: (config?: ButtonConfig) => import("./types.js").ButtonComponent;
65
65
  export default createButton;
@@ -30,7 +30,7 @@ export declare const createBaseConfig: (config?: ButtonConfig) => ButtonConfig;
30
30
  export declare const getElementConfig: (config: ButtonConfig) => {
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: ButtonConfig) => {
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
  /**
@@ -1,20 +1,32 @@
1
1
  import type { ProgressComponent } from "../../progress/types.js";
2
- import { ButtonConfig } from "../types.js";
2
+ import { ButtonConfig, IconAPI } from "../types.js";
3
3
  /**
4
4
  * Component with progress capabilities
5
5
  */
6
6
  interface ProgressEnhancedComponent {
7
7
  element: HTMLElement;
8
- icon?: any;
8
+ icon?: IconAPI;
9
9
  getClass: (name: string) => string;
10
10
  progress?: ProgressComponent;
11
11
  disabled?: {
12
12
  enable: () => void;
13
13
  disable: () => void;
14
14
  };
15
- setText?: (text: string) => any;
15
+ lifecycle?: {
16
+ destroy: () => void;
17
+ };
18
+ setText?: (text: string) => unknown;
16
19
  getText?: () => string;
17
- [key: string]: any;
20
+ showProgress?: () => Promise<ProgressEnhancedComponent>;
21
+ showProgressSync?: () => ProgressEnhancedComponent;
22
+ hideProgress?: () => Promise<ProgressEnhancedComponent>;
23
+ hideProgressSync?: () => ProgressEnhancedComponent;
24
+ setProgress?: (value: number) => Promise<ProgressEnhancedComponent>;
25
+ setProgressSync?: (value: number) => ProgressEnhancedComponent;
26
+ setIndeterminate?: (indeterminate: boolean) => Promise<ProgressEnhancedComponent>;
27
+ setIndeterminateSync?: (indeterminate: boolean) => ProgressEnhancedComponent;
28
+ setLoading?: (loading: boolean, text?: string) => Promise<ProgressEnhancedComponent>;
29
+ setLoadingSync?: (loading: boolean, text?: string) => ProgressEnhancedComponent;
18
30
  }
19
31
  /**
20
32
  * Adds progress functionality to a button component
@@ -22,5 +34,5 @@ interface ProgressEnhancedComponent {
22
34
  * @param config - Button configuration with progress options
23
35
  * @returns Component enhancer function
24
36
  */
25
- export declare const withProgress: (config: ButtonConfig) => (component: ProgressEnhancedComponent) => ProgressEnhancedComponent;
37
+ export declare const withProgress: (config: ButtonConfig) => <C extends ProgressEnhancedComponent>(component: C) => C;
26
38
  export {};
@@ -69,6 +69,26 @@ export declare const getButtonConfig: (buttonConfig: ButtonGroupConfig["buttons"
69
69
  value?: string;
70
70
  selectedIcon?: string;
71
71
  selected?: boolean;
72
+ name?: string;
73
+ title?: string;
74
+ tabIndex?: number;
75
+ style?: string | Partial<CSSStyleDeclaration>;
76
+ data?: Record<string, string>;
77
+ role?: string;
78
+ ariaDescribedBy?: string;
79
+ ariaLabelledBy?: string;
80
+ ariaHidden?: boolean;
81
+ className?: string | string[];
82
+ rawClass?: string | string[];
83
+ progress?: import("../index.js").ProgressConfig | boolean;
84
+ toggle?: boolean;
85
+ componentName?: string;
86
+ type?: "button" | "submit" | "reset";
87
+ iconSize?: string;
88
+ prefix?: string;
89
+ showProgress?: boolean;
90
+ toggleOnClick?: boolean;
91
+ parent?: HTMLElement | string | null;
72
92
  };
73
93
  /**
74
94
  * Maps variant name to button variant
@@ -8,4 +8,13 @@ import { BaseComponent, CardComponent, ApiOptions } from "./types.js";
8
8
  * @returns {Function} Higher-order function that adds API methods to component
9
9
  * @category Components
10
10
  */
11
- export declare const withAPI: ({ lifecycle }: ApiOptions) => (component: BaseComponent) => CardComponent;
11
+ /**
12
+ * The card as the pipe hands it over: the API sets `config` from the options,
13
+ * and addClass returns the card itself once the API wraps it
14
+ * @internal
15
+ */
16
+ type ComponentWithElements = Omit<BaseComponent, 'config' | 'addClass'> & {
17
+ addClass: (...classes: string[]) => unknown;
18
+ };
19
+ export declare const withAPI: ({ lifecycle, config }: ApiOptions) => (component: ComponentWithElements) => CardComponent;
20
+ export {};
@@ -1,6 +1,7 @@
1
- export const withAPI = ({ lifecycle }) => (component) => ({
1
+ export const withAPI = ({ lifecycle, config }) => (component) => ({
2
2
  ...component,
3
3
  element: component.element,
4
+ config,
4
5
  addContent(contentElement) {
5
6
  if (contentElement && contentElement.classList.contains(`${component.getClass('card')}-content`)) {
6
7
  component.element.appendChild(contentElement);
@@ -68,6 +69,10 @@ export const withAPI = ({ lifecycle }) => (component) => ({
68
69
  component.element.focus();
69
70
  return this;
70
71
  },
72
+ addClass(...classes) {
73
+ component.addClass(...classes);
74
+ return this;
75
+ },
71
76
  destroy() {
72
77
  lifecycle.destroy();
73
78
  }
@@ -8,7 +8,7 @@ const createCard = (config = {}) => {
8
8
  const processedConfig = processInlineConfig(config);
9
9
  const baseConfig = createBaseConfig(processedConfig);
10
10
  try {
11
- const card = pipe(createBase, withEvents(), withElement(getElementConfig(baseConfig)), withVariant(baseConfig), baseConfig.clickable ? withRipple(baseConfig) : (c) => c, withLifecycle(), withInteractiveBehavior, withElevation, comp => withAPI(getApiConfig(comp))(comp))(baseConfig);
11
+ const card = pipe(createBase, withEvents(), withElement(getElementConfig(baseConfig)), withVariant(baseConfig), baseConfig.clickable ? withRipple(baseConfig) : (c) => c, withLifecycle(), withInteractiveBehavior, withElevation, comp => withAPI({ ...getApiConfig(comp), config: baseConfig })(comp))(baseConfig);
12
12
  applyInlineConfiguration(card, processedConfig);
13
13
  return card;
14
14
  }
@@ -1,4 +1,6 @@
1
- import { CardComponent, CardSchema, BaseComponent } from "./types.js";
1
+ import type { ElementComponent } from "../../core/compose/component.js";
2
+ import type { EventComponent } from "../../core/compose/features/index.js";
3
+ import { CardComponent, CardComponentConfig, CardSchema } from "./types.js";
2
4
  /**
3
5
  * Default configuration for the Card component.
4
6
  * These values are used when no configuration is provided.
@@ -42,7 +44,7 @@ export declare const applyInlineConfiguration: (card: CardComponent, config: Car
42
44
  * @category Components
43
45
  *
44
46
  */
45
- export declare const createBaseConfig: (config?: CardSchema) => CardSchema;
47
+ export declare const createBaseConfig: (config?: CardSchema) => CardComponentConfig;
46
48
  /**
47
49
  * Generates element configuration for the Card component.
48
50
  * Sets up DOM attributes, accessibility features, and event forwarding
@@ -56,7 +58,7 @@ export declare const createBaseConfig: (config?: CardSchema) => CardSchema;
56
58
  export declare const getElementConfig: (config: CardSchema) => {
57
59
  tag: string;
58
60
  componentName: string;
59
- attributes: Record<string, any>;
61
+ attributes: Record<string, unknown>;
60
62
  className: string[];
61
63
  rawClass: string | string[];
62
64
  id: string;
@@ -72,7 +74,7 @@ export declare const getElementConfig: (config: CardSchema) => {
72
74
  ariaHidden: boolean;
73
75
  html: string;
74
76
  text: string;
75
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
77
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
76
78
  interactive: boolean;
77
79
  };
78
80
  /**
@@ -84,9 +86,13 @@ export declare const getElementConfig: (config: CardSchema) => {
84
86
  * @category Components
85
87
  *
86
88
  */
87
- export declare const getApiConfig: (comp: any) => {
89
+ export declare const getApiConfig: (comp: {
90
+ lifecycle?: {
91
+ destroy?: () => void;
92
+ };
93
+ }) => {
88
94
  lifecycle: {
89
- destroy: () => any;
95
+ destroy: () => void;
90
96
  };
91
97
  };
92
98
  /**
@@ -107,10 +113,10 @@ export declare const CARD_ELEVATION_LEVELS: {
107
113
  * guidelines. Implements mouse, keyboard, and touch interactions with appropriate
108
114
  * visual feedback and accessibility support.
109
115
  *
110
- * @param {BaseComponent} comp - Card component
111
- * @returns {BaseComponent} Enhanced card component
116
+ * @param {ElementComponent} comp - Card component
117
+ * @returns {ElementComponent} Enhanced card component
112
118
  * @category Components
113
119
  *
114
120
  */
115
- export declare const withInteractiveBehavior: (comp: BaseComponent) => BaseComponent;
121
+ export declare const withInteractiveBehavior: <C extends ElementComponent & EventComponent>(comp: C) => C;
116
122
  export default defaultConfig;
@@ -2,6 +2,7 @@ import { PREFIX } from "../../core/config.js";
2
2
  import { pipe } from "../../core/compose/index.js";
3
3
  import { createBase, withElement } from "../../core/compose/component.js";
4
4
  import { createElement } from "../../core/dom/create.js";
5
+ import { safeUrl } from "../../core/utils/url.js";
5
6
  export const CARD_CONTENT_PADDING = true;
6
7
  export const createCardContent = (config = {}) => {
7
8
  const baseConfig = {
@@ -26,7 +27,9 @@ export const createCardContent = (config = {}) => {
26
27
  content.element.innerHTML = config.html;
27
28
  }
28
29
  else if (config.text) {
29
- content.element.innerHTML = `<p>${config.text}</p>`;
30
+ const paragraph = document.createElement("p");
31
+ paragraph.textContent = config.text;
32
+ content.element.appendChild(paragraph);
30
33
  }
31
34
  if (Array.isArray(config.children)) {
32
35
  config.children.forEach(child => {
@@ -178,7 +181,7 @@ export const createCardMedia = (config = {}) => {
178
181
  }
179
182
  else if (config.src) {
180
183
  const img = document.createElement('img');
181
- img.src = config.src;
184
+ img.src = safeUrl(config.src);
182
185
  img.className = `${PREFIX}-card-media-img`;
183
186
  img.alt = config.alt || '';
184
187
  if (!config.alt) {
@@ -1,3 +1,4 @@
1
+ import type { ElementComponent } from "../../core/compose/component.js";
1
2
  import { BaseComponent, CardComponent, LoadingFeature, ExpandableFeature, SwipeableFeature } from "./types.js";
2
3
  interface LoadingConfig {
3
4
  initialState?: boolean;
@@ -73,7 +74,7 @@ export declare const withLoading: (config?: LoadingConfig) => (component: BaseCo
73
74
  * )(baseConfig);
74
75
  * ```
75
76
  */
76
- export declare const withElevation: (component: BaseComponent) => BaseComponent;
77
+ export declare const withElevation: <C extends ElementComponent>(component: C) => C;
77
78
  /**
78
79
  * Higher-order function to add expandable behavior to a card.
79
80
  * Creates a collapsible section with proper accessibility attributes and
@@ -1,3 +1,4 @@
1
+ import type { ButtonConfig as BaseButtonConfig } from "../button/types.js";
1
2
  /**
2
3
  * Card variant types following Material Design 3 guidelines.
3
4
  * - elevated: Card with shadow elevation (default)
@@ -22,15 +23,13 @@ export type CardElevationLevel = 0 | 1 | 2 | 4;
22
23
  * @interface ButtonConfig
23
24
  * @category Components
24
25
  */
25
- export interface ButtonConfig {
26
+ export interface ButtonConfig extends Omit<BaseButtonConfig, "variant"> {
26
27
  /** Button text content */
27
28
  text?: string;
28
29
  /** Button variant (text, outlined, filled, etc.) */
29
30
  variant?: string;
30
31
  /** Button icon HTML content */
31
32
  icon?: string;
32
- /** Additional button properties passed to button component */
33
- [key: string]: any;
34
33
  }
35
34
  /**
36
35
  * Card configuration interface defining all possible card options.
@@ -218,7 +217,7 @@ export interface BaseComponent {
218
217
  /** Add CSS class(es) */
219
218
  addClass: (...classes: string[]) => BaseComponent;
220
219
  /** Emit an event */
221
- emit?: (event: string, data?: any) => void;
220
+ emit?: (event: string, data?: unknown) => void;
222
221
  /** Component configuration */
223
222
  config: CardComponentConfig;
224
223
  /** Touch state for touch interactions */
@@ -468,4 +467,6 @@ export interface ApiOptions {
468
467
  /** Destroy callback */
469
468
  destroy: () => void;
470
469
  };
470
+ /** The resolved configuration the card was created from */
471
+ config: CardComponentConfig;
471
472
  }
@@ -6,7 +6,7 @@ export declare const createBaseConfig: (config?: CarouselConfig) => CarouselConf
6
6
  export declare const getElementConfig: (config: CarouselConfig) => {
7
7
  tag: string;
8
8
  componentName: string;
9
- attributes: Record<string, any>;
9
+ attributes: Record<string, unknown>;
10
10
  className: string[];
11
11
  rawClass: string | string[];
12
12
  id: string;
@@ -22,6 +22,6 @@ export declare const getElementConfig: (config: CarouselConfig) => {
22
22
  ariaHidden: boolean;
23
23
  html: string;
24
24
  text: string;
25
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
25
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
26
26
  interactive: boolean;
27
27
  };
@@ -1,3 +1,4 @@
1
+ import { safeUrl } from "../../../core/utils/url.js";
1
2
  export const withSlides = (config) => (component) => {
2
3
  const prefix = component.getClass("carousel");
3
4
  const scroller = document.createElement("div");
@@ -29,7 +30,7 @@ export const withSlides = (config) => (component) => {
29
30
  if (slide.image) {
30
31
  const img = document.createElement("img");
31
32
  img.className = `${prefix}__image`;
32
- img.src = slide.image;
33
+ img.src = safeUrl(slide.image);
33
34
  img.alt = slide.alt ?? slide.title ?? "";
34
35
  img.draggable = false;
35
36
  el.appendChild(img);
@@ -54,7 +55,7 @@ export const withSlides = (config) => (component) => {
54
55
  button.className = `${prefix}__button`;
55
56
  button.textContent = slide.buttonText;
56
57
  if (slide.buttonUrl)
57
- button.href = slide.buttonUrl;
58
+ button.href = safeUrl(slide.buttonUrl);
58
59
  content.appendChild(button);
59
60
  }
60
61
  el.appendChild(content);
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: CheckboxConfig) => CheckboxConf
17
17
  export declare const getElementConfig: (config: CheckboxConfig) => {
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: CheckboxConfig) => {
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
  /**
@@ -206,16 +206,16 @@ export interface CheckboxComponent {
206
206
  */
207
207
  export interface ApiOptions {
208
208
  disabled: {
209
- enable: () => any;
210
- disable: () => any;
209
+ enable: () => void;
210
+ disable: () => void;
211
211
  };
212
212
  lifecycle: {
213
213
  destroy: () => void;
214
214
  };
215
215
  checkable: {
216
- check: () => any;
217
- uncheck: () => any;
218
- toggle: () => any;
216
+ check: () => void;
217
+ uncheck: () => void;
218
+ toggle: () => void;
219
219
  isChecked: () => boolean;
220
220
  };
221
221
  }
@@ -228,26 +228,25 @@ export interface BaseComponent {
228
228
  element: HTMLElement;
229
229
  input?: HTMLInputElement;
230
230
  getValue?: () => string;
231
- setValue?: (value: string) => any;
232
- setIndeterminate?: (state: boolean) => any;
231
+ setValue?: (value: string) => void;
232
+ setIndeterminate?: (state: boolean) => void;
233
233
  text?: {
234
- setText: (content: string) => any;
234
+ setText: (content: string) => void;
235
235
  getText: () => string;
236
236
  };
237
- on?: (event: string, handler: Function) => any;
238
- off?: (event: string, handler: Function) => any;
237
+ on?: (event: string, handler: Function) => this;
238
+ off?: (event: string, handler: Function) => this;
239
239
  disabled?: {
240
- enable: () => any;
241
- disable: () => any;
240
+ enable: () => void;
241
+ disable: () => void;
242
242
  };
243
243
  lifecycle?: {
244
244
  destroy: () => void;
245
245
  };
246
246
  checkable?: {
247
- check: () => any;
248
- uncheck: () => any;
249
- toggle: () => any;
247
+ check: () => void;
248
+ uncheck: () => void;
249
+ toggle: () => void;
250
250
  isChecked: () => boolean;
251
251
  };
252
- [key: string]: any;
253
252
  }
@@ -1,4 +1,4 @@
1
- import { ChipsComponent, ChipComponent } from "./types.js";
1
+ import { ChipsComponent, ChipComponent, ChipConfig } from "./types.js";
2
2
  /**
3
3
  * API options interface - structured by feature area
4
4
  */
@@ -7,7 +7,7 @@ interface ApiOptions {
7
7
  multiSelect: boolean;
8
8
  };
9
9
  chips: {
10
- addChip: (chipConfig: any) => ChipComponent;
10
+ addChip: (chipConfig: ChipConfig) => ChipComponent;
11
11
  removeChip: (chipOrIndex: ChipComponent | number) => void;
12
12
  getChips: () => ChipComponent[];
13
13
  getSelectedChips: () => ChipComponent[];
@@ -17,15 +17,15 @@ interface ApiOptions {
17
17
  scrollToChip: (chipOrIndex: ChipComponent | number) => void;
18
18
  };
19
19
  layout: {
20
- setScrollable: (isScrollable: boolean) => any;
20
+ setScrollable: (isScrollable: boolean) => void;
21
21
  isScrollable: () => boolean;
22
- setVertical: (isVertical: boolean) => any;
22
+ setVertical: (isVertical: boolean) => void;
23
23
  isVertical: () => boolean;
24
24
  };
25
25
  label: {
26
- setText: (text: string) => any;
26
+ setText: (text: string) => void;
27
27
  getText: () => string;
28
- setPosition: (position: "start" | "end") => any;
28
+ setPosition: (position: "start" | "end") => void;
29
29
  getPosition: () => string;
30
30
  };
31
31
  keyboard: {
@@ -2,12 +2,12 @@ import { ApiOptions, ChipComponent } from "./types.js";
2
2
  interface ComponentWithElements {
3
3
  element: HTMLElement;
4
4
  text?: {
5
- setText: (content: string) => any;
5
+ setText: (content: string) => void;
6
6
  getText: () => string;
7
7
  getElement: () => HTMLElement | null;
8
8
  };
9
9
  icon?: {
10
- setIcon: (html: string) => any;
10
+ setIcon: (html: string) => void;
11
11
  getIcon: () => string;
12
12
  getElement: () => HTMLElement | null;
13
13
  };
@@ -6,13 +6,12 @@ import { ChipConfig } from "../types.js";
6
6
  interface BaseComponent {
7
7
  element: HTMLElement;
8
8
  disabled?: {
9
- enable: () => any;
10
- disable: () => any;
9
+ enable: () => void;
10
+ disable: () => void;
11
11
  };
12
12
  lifecycle?: {
13
13
  destroy: () => void;
14
14
  };
15
- [key: string]: any;
16
15
  }
17
16
  /**
18
17
  * Default configuration for the Chip component
@@ -32,7 +31,7 @@ export declare const createBaseConfig: (config?: ChipConfig) => ChipConfig;
32
31
  export declare const getElementConfig: (config: ChipConfig) => {
33
32
  tag: string;
34
33
  componentName: string;
35
- attributes: Record<string, any>;
34
+ attributes: Record<string, unknown>;
36
35
  className: string[];
37
36
  rawClass: string | string[];
38
37
  id: string;
@@ -48,7 +47,7 @@ export declare const getElementConfig: (config: ChipConfig) => {
48
47
  ariaHidden: boolean;
49
48
  html: string;
50
49
  text: string;
51
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
50
+ forwardEvents: Record<string, import("../../../core/dom/create.js").EventCondition>;
52
51
  interactive: boolean;
53
52
  };
54
53
  /**
@@ -58,8 +57,8 @@ export declare const getElementConfig: (config: ChipConfig) => {
58
57
  */
59
58
  export declare const getApiConfig: (comp: BaseComponent) => {
60
59
  disabled: {
61
- enable: () => any;
62
- disable: () => any;
60
+ enable: () => void;
61
+ disable: () => void;
63
62
  };
64
63
  lifecycle: {
65
64
  destroy: () => void;
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: ChipsConfig) => ChipsConfig;
17
17
  export declare const getElementConfig: (config: ChipsConfig) => {
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: ChipsConfig) => {
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
  /**
@@ -2,7 +2,6 @@ import { createElement } from "../../../core/dom/create.js";
2
2
  export const withDom = (config) => (component) => {
3
3
  const getClass = (className) => component.getClass(className);
4
4
  const hasLabel = config.label && config.label.trim().length > 0;
5
- const labelPosition = config.labelPosition || "start";
6
5
  let label;
7
6
  if (hasLabel) {
8
7
  label = createElement({
@@ -176,7 +176,7 @@ export interface ChipsConfig {
176
176
  * Schema definition for the component structure
177
177
  * @internal
178
178
  */
179
- schema?: any;
179
+ schema?: unknown;
180
180
  /**
181
181
  * Event handlers for component events
182
182
  */
@@ -338,6 +338,17 @@ export interface ChipsComponent {
338
338
  * @returns Array of selected chip values
339
339
  */
340
340
  getSelectedValues: () => (string | null)[];
341
+ /**
342
+ * Gets the current value - form field compatibility
343
+ * @returns The first selected value (or null) in single-select mode, the selected values in multi-select mode
344
+ */
345
+ getValue: () => string | string[] | null;
346
+ /**
347
+ * Sets the value by selecting chips by value, without a change event - form field compatibility
348
+ * @param values - Value or array of values to select; null, undefined or empty clears the selection
349
+ * @returns The chips instance for chaining
350
+ */
351
+ setValue: (values: string | string[] | null | undefined) => ChipsComponent;
341
352
  /**
342
353
  * Selects chips by their values
343
354
  * @param values - Value or array of values to select