material 3.7.3 → 3.8.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 (440) hide show
  1. package/NOTICE +223 -0
  2. package/README.md +6 -4
  3. package/dist/components/badge/badge.d.ts +4 -0
  4. package/dist/components/badge/constants.d.ts +4 -0
  5. package/dist/components/badge/index.d.ts +1 -0
  6. package/dist/components/badge/types.d.ts +102 -0
  7. package/dist/components/bottom-app-bar/bottom-app-bar.d.ts +4 -0
  8. package/dist/components/bottom-app-bar/constants.d.ts +3 -0
  9. package/dist/components/bottom-app-bar/types.d.ts +42 -0
  10. package/dist/components/bottom-sheet/bottom-sheet.d.ts +4 -0
  11. package/dist/components/bottom-sheet/constants.d.ts +9 -0
  12. package/dist/components/bottom-sheet/types.d.ts +52 -0
  13. package/dist/components/button/button.d.ts +4 -0
  14. package/dist/components/button/constants.d.ts +20 -0
  15. package/dist/components/button/index.d.ts +1 -0
  16. package/dist/components/button/types.d.ts +190 -0
  17. package/dist/components/button-group/button-group.d.ts +4 -0
  18. package/dist/components/button-group/constants.d.ts +54 -0
  19. package/dist/components/button-group/index.d.ts +1 -0
  20. package/dist/components/button-group/types.d.ts +125 -0
  21. package/dist/components/card/card.d.ts +4 -0
  22. package/dist/components/card/constants.d.ts +11 -0
  23. package/dist/components/card/content.d.ts +16 -0
  24. package/dist/components/card/index.d.ts +2 -0
  25. package/dist/components/card/types.d.ts +123 -0
  26. package/dist/components/carousel/carousel.d.ts +1 -0
  27. package/dist/components/carousel/constants.d.ts +10 -0
  28. package/dist/components/carousel/types.d.ts +16 -0
  29. package/dist/components/checkbox/checkbox.d.ts +5 -0
  30. package/dist/components/checkbox/constants.d.ts +13 -0
  31. package/dist/components/checkbox/index.d.ts +2 -0
  32. package/dist/components/checkbox/types.d.ts +94 -0
  33. package/dist/components/chips/chips.d.ts +4 -0
  34. package/dist/components/chips/constants.d.ts +1 -0
  35. package/dist/components/chips/factories.d.ts +4 -0
  36. package/dist/components/chips/types.d.ts +140 -0
  37. package/dist/components/datepicker/constants.d.ts +38 -0
  38. package/dist/components/datepicker/datepicker.d.ts +2 -0
  39. package/dist/components/datepicker/types.d.ts +139 -0
  40. package/dist/components/dialog/constants.d.ts +45 -0
  41. package/dist/components/dialog/dialog.d.ts +5 -0
  42. package/dist/components/dialog/index.d.ts +1 -0
  43. package/dist/components/dialog/types.d.ts +196 -0
  44. package/dist/components/divider/config.d.ts +30 -0
  45. package/dist/components/divider/constants.d.ts +15 -0
  46. package/dist/components/divider/divider.d.ts +4 -0
  47. package/dist/components/divider/types.d.ts +27 -0
  48. package/dist/components/drawer/constants.d.ts +39 -0
  49. package/dist/components/drawer/drawer.d.ts +4 -0
  50. package/dist/components/drawer/index.d.ts +1 -0
  51. package/dist/components/drawer/types.d.ts +109 -0
  52. package/dist/components/extended-fab/constants.d.ts +32 -0
  53. package/dist/components/extended-fab/extended-fab.d.ts +4 -0
  54. package/dist/components/extended-fab/types.d.ts +126 -0
  55. package/dist/components/fab/constants.d.ts +26 -0
  56. package/dist/components/fab/fab.d.ts +4 -0
  57. package/dist/components/fab/types.d.ts +103 -0
  58. package/dist/components/fab-menu/constants.d.ts +9 -0
  59. package/dist/components/fab-menu/fab-menu.d.ts +4 -0
  60. package/dist/components/fab-menu/types.d.ts +41 -0
  61. package/dist/components/icon-button/constants.d.ts +34 -0
  62. package/dist/components/icon-button/icon-button.d.ts +4 -0
  63. package/dist/components/icon-button/types.d.ts +157 -0
  64. package/dist/components/index.d.ts +1 -0
  65. package/dist/components/list/constants.d.ts +30 -0
  66. package/dist/components/list/index.d.ts +1 -0
  67. package/dist/components/list/list.d.ts +4 -0
  68. package/dist/components/list/types.d.ts +110 -0
  69. package/dist/components/loading-indicator/constants.d.ts +16 -0
  70. package/dist/components/loading-indicator/features/renderer.d.ts +13 -0
  71. package/dist/components/loading-indicator/loading-indicator.d.ts +4 -0
  72. package/dist/components/loading-indicator/types.d.ts +21 -0
  73. package/dist/components/menu/constants.d.ts +51 -0
  74. package/dist/components/menu/features/controller.js +1 -1
  75. package/dist/components/menu/features/keyboard.js +8 -3
  76. package/dist/components/menu/features/opener.js +2 -16
  77. package/dist/components/menu/index.d.ts +2 -0
  78. package/dist/components/menu/inner.d.ts +2 -0
  79. package/dist/components/menu/menu.d.ts +4 -0
  80. package/dist/components/menu/on-demand.d.ts +9 -0
  81. package/dist/components/menu/types.d.ts +185 -1
  82. package/dist/components/navigation-bar/navigation-bar.d.ts +1 -0
  83. package/dist/components/navigation-bar/types.d.ts +12 -0
  84. package/dist/components/navigation-rail/constants.d.ts +2 -0
  85. package/dist/components/navigation-rail/navigation-rail.d.ts +1 -0
  86. package/dist/components/navigation-rail/types.d.ts +18 -0
  87. package/dist/components/progress/constants.d.ts +37 -0
  88. package/dist/components/progress/progress.d.ts +4 -0
  89. package/dist/components/progress/types.d.ts +136 -0
  90. package/dist/components/radios/constants.d.ts +14 -0
  91. package/dist/components/radios/radios.d.ts +4 -0
  92. package/dist/components/radios/types.d.ts +89 -0
  93. package/dist/components/search/constants.d.ts +34 -0
  94. package/dist/components/search/search.d.ts +4 -0
  95. package/dist/components/search/types.d.ts +109 -0
  96. package/dist/components/select/constants.d.ts +46 -0
  97. package/dist/components/select/features.js +9 -1
  98. package/dist/components/select/index.d.ts +2 -0
  99. package/dist/components/select/select.d.ts +4 -0
  100. package/dist/components/select/types.d.ts +95 -0
  101. package/dist/components/side-sheet/constants.d.ts +9 -0
  102. package/dist/components/side-sheet/side-sheet.d.ts +4 -0
  103. package/dist/components/side-sheet/types.d.ts +51 -0
  104. package/dist/components/slider/constants.d.ts +62 -0
  105. package/dist/components/slider/slider.d.ts +4 -0
  106. package/dist/components/slider/types.d.ts +78 -0
  107. package/dist/components/snackbar/constants.d.ts +37 -0
  108. package/dist/components/snackbar/snackbar.d.ts +5 -0
  109. package/dist/components/snackbar/types.d.ts +67 -0
  110. package/dist/components/split-button/api.js +13 -3
  111. package/dist/components/split-button/constants.d.ts +13 -0
  112. package/dist/components/split-button/split-button.d.ts +4 -0
  113. package/dist/components/split-button/types.d.ts +50 -0
  114. package/dist/components/switch/constants.d.ts +34 -0
  115. package/dist/components/switch/switch.d.ts +4 -0
  116. package/dist/components/switch/types.d.ts +55 -0
  117. package/dist/components/tabs/constants.d.ts +49 -0
  118. package/dist/components/tabs/indicator.d.ts +22 -0
  119. package/dist/components/tabs/responsive.d.ts +17 -0
  120. package/dist/components/tabs/tab.d.ts +5 -0
  121. package/dist/components/tabs/tabs.d.ts +4 -0
  122. package/dist/components/tabs/types.d.ts +170 -0
  123. package/dist/components/tabs/utils.d.ts +24 -0
  124. package/dist/components/text-field/constants.d.ts +61 -0
  125. package/dist/components/text-field/features/trailing-icon.d.ts +25 -0
  126. package/dist/components/text-field/text-field.d.ts +4 -0
  127. package/dist/components/text-field/types.d.ts +84 -0
  128. package/dist/components/timepicker/constants.d.ts +61 -0
  129. package/dist/components/timepicker/types.d.ts +145 -0
  130. package/dist/components/toolbar/constants.d.ts +8 -0
  131. package/dist/components/toolbar/toolbar.d.ts +4 -0
  132. package/dist/components/toolbar/types.d.ts +75 -0
  133. package/dist/components/tooltip/constants.d.ts +43 -0
  134. package/dist/components/tooltip/tooltip.d.ts +4 -0
  135. package/dist/components/tooltip/types.d.ts +78 -0
  136. package/dist/components/top-app-bar/constants.d.ts +29 -0
  137. package/dist/components/top-app-bar/top-app-bar.d.ts +4 -0
  138. package/dist/components/top-app-bar/types.d.ts +55 -0
  139. package/dist/core/canvas/animation.d.ts +6 -0
  140. package/dist/core/canvas/drawing.d.ts +47 -0
  141. package/dist/core/canvas/index.d.ts +1 -0
  142. package/dist/core/canvas/resize.d.ts +7 -0
  143. package/dist/core/canvas/utils.d.ts +39 -0
  144. package/dist/core/compose/base.d.ts +9 -0
  145. package/dist/core/compose/cleanup.d.ts +2 -0
  146. package/dist/core/compose/component.d.ts +13 -0
  147. package/dist/core/compose/features/badge.d.ts +10 -0
  148. package/dist/core/compose/features/checkable.d.ts +13 -0
  149. package/dist/core/compose/features/debounce.d.ts +19 -0
  150. package/dist/core/compose/features/disabled.d.ts +11 -0
  151. package/dist/core/compose/features/events.d.ts +19 -0
  152. package/dist/core/compose/features/icon.d.ts +20 -0
  153. package/dist/core/compose/features/input.d.ts +31 -0
  154. package/dist/core/compose/features/lifecycle.d.ts +16 -0
  155. package/dist/core/compose/features/position.d.ts +13 -0
  156. package/dist/core/compose/features/ripple.d.ts +17 -0
  157. package/dist/core/compose/features/size.d.ts +5 -0
  158. package/dist/core/compose/features/style.d.ts +5 -0
  159. package/dist/core/compose/features/text.d.ts +20 -0
  160. package/dist/core/compose/features/textinput.d.ts +39 -0
  161. package/dist/core/compose/features/textlabel.d.ts +18 -0
  162. package/dist/core/compose/features/throttle.d.ts +18 -0
  163. package/dist/core/compose/features/track.d.ts +12 -0
  164. package/dist/core/compose/features/variant.d.ts +5 -0
  165. package/dist/core/compose/features/withEvents.d.ts +12 -0
  166. package/dist/core/compose/pipe.d.ts +12 -0
  167. package/dist/core/compose/utils/type-guards.d.ts +5 -0
  168. package/dist/core/config/component.d.ts +17 -0
  169. package/dist/core/config/global.d.ts +15 -0
  170. package/dist/core/config.d.ts +34 -0
  171. package/dist/core/dom/attributes.d.ts +25 -0
  172. package/dist/core/dom/classes.d.ts +24 -0
  173. package/dist/core/dom/create.d.ts +47 -0
  174. package/dist/core/dom/events.d.ts +26 -0
  175. package/dist/core/dom/focus.d.ts +11 -0
  176. package/dist/core/dom/html.d.ts +6 -0
  177. package/dist/core/dom/layer.d.ts +36 -0
  178. package/dist/core/dom/roving.d.ts +7 -0
  179. package/dist/core/navigation/destinations.d.ts +10 -0
  180. package/dist/core/shapes/cubic.d.ts +8 -0
  181. package/dist/core/shapes/material.d.ts +45 -0
  182. package/dist/core/shapes/polygon.d.ts +11 -0
  183. package/dist/core/state/emitter.d.ts +19 -0
  184. package/dist/core/state/events.d.ts +17 -0
  185. package/dist/core/state/store.d.ts +40 -0
  186. package/dist/core/theme/shape.d.ts +3 -0
  187. package/dist/core/theme/tokens.d.ts +6 -0
  188. package/dist/core/utils/background.d.ts +7 -0
  189. package/dist/core/utils/color.d.ts +5 -0
  190. package/dist/core/utils/index.d.ts +9 -0
  191. package/dist/core/utils/mobile.d.ts +10 -0
  192. package/dist/core/utils/object.d.ts +9 -0
  193. package/dist/core/utils/performance.d.ts +20 -0
  194. package/dist/core/utils/theme.d.ts +8 -0
  195. package/dist/core/utils/url.d.ts +3 -0
  196. package/dist/elements/adapter.d.ts +24 -0
  197. package/dist/elements/badge.d.ts +4 -0
  198. package/dist/elements/bottom-app-bar.d.ts +4 -0
  199. package/dist/elements/bottom-sheet.d.ts +6 -0
  200. package/dist/elements/button-group.d.ts +8 -0
  201. package/dist/elements/button.d.ts +5 -0
  202. package/dist/elements/card.d.ts +4 -0
  203. package/dist/elements/carousel.d.ts +5 -0
  204. package/dist/elements/checkbox.d.ts +4 -0
  205. package/dist/elements/chips.d.ts +9 -0
  206. package/dist/elements/css/menu.css +1 -1
  207. package/dist/elements/css/menu.js +1 -1
  208. package/dist/elements/datepicker.d.ts +6 -0
  209. package/dist/elements/define.d.ts +48 -0
  210. package/dist/elements/dialog.d.ts +5 -0
  211. package/dist/elements/divider.d.ts +4 -0
  212. package/dist/elements/drawer.d.ts +6 -0
  213. package/dist/elements/extended-fab.d.ts +6 -0
  214. package/dist/elements/fab-menu.d.ts +10 -0
  215. package/dist/elements/fab.d.ts +6 -0
  216. package/dist/elements/icon-button.d.ts +6 -0
  217. package/dist/elements/index.d.ts +4 -0
  218. package/dist/elements/list.d.ts +8 -0
  219. package/dist/elements/loading-indicator.d.ts +4 -0
  220. package/dist/elements/menu.d.ts +12 -0
  221. package/dist/elements/navigation-bar.d.ts +6 -0
  222. package/dist/elements/navigation-rail.d.ts +10 -0
  223. package/dist/elements/preupgrade/badge.css +1 -1
  224. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  225. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  226. package/dist/elements/preupgrade/button-group.css +1 -1
  227. package/dist/elements/preupgrade/button.css +1 -1
  228. package/dist/elements/preupgrade/card.css +1 -1
  229. package/dist/elements/preupgrade/carousel.css +1 -1
  230. package/dist/elements/preupgrade/checkbox.css +1 -1
  231. package/dist/elements/preupgrade/chips.css +1 -1
  232. package/dist/elements/preupgrade/datepicker.css +1 -1
  233. package/dist/elements/preupgrade/dialog.css +1 -1
  234. package/dist/elements/preupgrade/divider.css +1 -1
  235. package/dist/elements/preupgrade/drawer.css +1 -1
  236. package/dist/elements/preupgrade/extended-fab.css +1 -1
  237. package/dist/elements/preupgrade/fab-menu.css +1 -1
  238. package/dist/elements/preupgrade/fab.css +1 -1
  239. package/dist/elements/preupgrade/icon-button.css +1 -1
  240. package/dist/elements/preupgrade/list.css +1 -1
  241. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  242. package/dist/elements/preupgrade/menu.css +1 -1
  243. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  244. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  245. package/dist/elements/preupgrade/progress.css +1 -1
  246. package/dist/elements/preupgrade/radios.css +1 -1
  247. package/dist/elements/preupgrade/search.css +1 -1
  248. package/dist/elements/preupgrade/select.css +1 -1
  249. package/dist/elements/preupgrade/side-sheet.css +1 -1
  250. package/dist/elements/preupgrade/slider.css +1 -1
  251. package/dist/elements/preupgrade/snackbar.css +1 -1
  252. package/dist/elements/preupgrade/split-button.css +1 -1
  253. package/dist/elements/preupgrade/switch.css +1 -1
  254. package/dist/elements/preupgrade/tabs.css +1 -1
  255. package/dist/elements/preupgrade/text-field.css +1 -1
  256. package/dist/elements/preupgrade/timepicker.css +1 -1
  257. package/dist/elements/preupgrade/toolbar.css +1 -1
  258. package/dist/elements/preupgrade/tooltip.css +1 -1
  259. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  260. package/dist/elements/preupgrade.css +1 -1
  261. package/dist/elements/progress.d.ts +4 -0
  262. package/dist/elements/radios.d.ts +5 -0
  263. package/dist/elements/search.d.ts +15 -0
  264. package/dist/elements/select.d.ts +6 -0
  265. package/dist/elements/side-sheet.d.ts +5 -0
  266. package/dist/elements/slider.d.ts +7 -0
  267. package/dist/elements/snackbar.d.ts +4 -0
  268. package/dist/elements/split-button.d.ts +8 -0
  269. package/dist/elements/styles.d.ts +11 -0
  270. package/dist/elements/switch.d.ts +5 -0
  271. package/dist/elements/tabs.d.ts +6 -0
  272. package/dist/elements/text-field.d.ts +9 -0
  273. package/dist/elements/timepicker.d.ts +9 -0
  274. package/dist/elements/toolbar.d.ts +4 -0
  275. package/dist/elements/tooltip.d.ts +4 -0
  276. package/dist/elements/top-app-bar.d.ts +4 -0
  277. package/dist/index.d.ts +1 -0
  278. package/dist/react/create.d.ts +15 -0
  279. package/dist/react/index.d.ts +1 -0
  280. package/dist/react/jsx.d.ts +3 -0
  281. package/dist/solid/create.d.ts +16 -0
  282. package/dist/solid/index.d.ts +1 -0
  283. package/dist/solid/jsx.d.ts +4 -0
  284. package/dist/ssr/index.d.ts +3 -0
  285. package/dist/ssr/solid.d.ts +1 -0
  286. package/dist/ssr/svelte.d.ts +1 -0
  287. package/dist/ssr/vue.d.ts +1 -0
  288. package/dist/styles/badge.css +1 -1
  289. package/dist/styles/base-lite.css +2 -2
  290. package/dist/styles/base.css +2 -2
  291. package/dist/styles/bottom-app-bar.css +1 -1
  292. package/dist/styles/bottom-sheet.css +1 -1
  293. package/dist/styles/button-group.css +1 -1
  294. package/dist/styles/button.css +1 -1
  295. package/dist/styles/card.css +1 -1
  296. package/dist/styles/carousel.css +1 -1
  297. package/dist/styles/checkbox.css +1 -1
  298. package/dist/styles/chips.css +1 -1
  299. package/dist/styles/contrast.css +2 -2
  300. package/dist/styles/datepicker.css +1 -1
  301. package/dist/styles/dialog.css +1 -1
  302. package/dist/styles/divider.css +1 -1
  303. package/dist/styles/drawer.css +1 -1
  304. package/dist/styles/extended-fab.css +1 -1
  305. package/dist/styles/fab-menu.css +1 -1
  306. package/dist/styles/fab.css +1 -1
  307. package/dist/styles/icon-button.css +1 -1
  308. package/dist/styles/list.css +1 -1
  309. package/dist/styles/loading-indicator.css +1 -1
  310. package/dist/styles/menu.css +2 -2
  311. package/dist/styles/navigation-bar.css +1 -1
  312. package/dist/styles/navigation-rail.css +1 -1
  313. package/dist/styles/progress.css +1 -1
  314. package/dist/styles/radios.css +1 -1
  315. package/dist/styles/search.css +1 -1
  316. package/dist/styles/select.css +1 -1
  317. package/dist/styles/side-sheet.css +1 -1
  318. package/dist/styles/slider.css +1 -1
  319. package/dist/styles/snackbar.css +1 -1
  320. package/dist/styles/split-button.css +1 -1
  321. package/dist/styles/switch.css +1 -1
  322. package/dist/styles/tabs.css +1 -1
  323. package/dist/styles/text-field.css +1 -1
  324. package/dist/styles/timepicker.css +1 -1
  325. package/dist/styles/toolbar.css +1 -1
  326. package/dist/styles/tooltip.css +1 -1
  327. package/dist/styles/top-app-bar.css +1 -1
  328. package/dist/styles/typography.css +1 -1
  329. package/dist/styles/utilities.css +1 -1
  330. package/dist/styles.css +2 -2
  331. package/dist/svelte/runtime.d.ts +21 -0
  332. package/dist/theme/image.d.ts +4 -0
  333. package/dist/theme/image.js +5 -0
  334. package/dist/theme/index.d.ts +43 -0
  335. package/dist/theme/index.js +32 -0
  336. package/dist/theme/roles.js +68 -0
  337. package/dist/theme/variants.d.ts +15 -0
  338. package/dist/theme/variants.js +17 -0
  339. package/dist/theme/vendor/contrast/contrast.js +72 -0
  340. package/dist/theme/vendor/dislike/dislike_analyzer.js +31 -0
  341. package/dist/theme/vendor/dynamiccolor/color_spec_2021.d.ts +64 -0
  342. package/dist/theme/vendor/dynamiccolor/color_spec_2021.js +663 -0
  343. package/dist/theme/vendor/dynamiccolor/contrast_curve.js +42 -0
  344. package/dist/theme/vendor/dynamiccolor/dynamic_color.d.ts +63 -0
  345. package/dist/theme/vendor/dynamiccolor/dynamic_color.js +264 -0
  346. package/dist/theme/vendor/dynamiccolor/dynamic_scheme.d.ts +100 -0
  347. package/dist/theme/vendor/dynamiccolor/dynamic_scheme.js +418 -0
  348. package/dist/theme/vendor/dynamiccolor/material_dynamic_colors.d.ts +125 -0
  349. package/dist/theme/vendor/dynamiccolor/material_dynamic_colors.js +311 -0
  350. package/dist/theme/vendor/dynamiccolor/tone_delta_pair.js +27 -0
  351. package/dist/theme/vendor/dynamiccolor/variant.js +28 -0
  352. package/dist/theme/vendor/hct/cam16.js +249 -0
  353. package/dist/theme/vendor/hct/hct.d.ts +32 -0
  354. package/dist/theme/vendor/hct/hct.js +86 -0
  355. package/dist/theme/vendor/hct/hct_solver.js +390 -0
  356. package/dist/theme/vendor/hct/viewing_conditions.js +73 -0
  357. package/dist/theme/vendor/palettes/tonal_palette.js +114 -0
  358. package/dist/theme/vendor/quantize/lab_point_provider.js +31 -0
  359. package/dist/theme/vendor/quantize/quantizer_celebi.js +25 -0
  360. package/dist/theme/vendor/quantize/quantizer_map.js +31 -0
  361. package/dist/theme/vendor/quantize/quantizer_wsmeans.js +178 -0
  362. package/dist/theme/vendor/quantize/quantizer_wu.js +342 -0
  363. package/dist/theme/vendor/scheme/scheme_content.js +30 -0
  364. package/dist/theme/vendor/scheme/scheme_expressive.js +30 -0
  365. package/dist/theme/vendor/scheme/scheme_fidelity.js +30 -0
  366. package/dist/theme/vendor/scheme/scheme_monochrome.js +30 -0
  367. package/dist/theme/vendor/scheme/scheme_neutral.js +30 -0
  368. package/dist/theme/vendor/scheme/scheme_tonal_spot.js +30 -0
  369. package/dist/theme/vendor/scheme/scheme_vibrant.js +30 -0
  370. package/dist/theme/vendor/score/score.js +100 -0
  371. package/dist/theme/vendor/temperature/temperature_cache.js +198 -0
  372. package/dist/theme/vendor/utils/color_utils.js +173 -0
  373. package/dist/theme/vendor/utils/image_utils.js +72 -0
  374. package/dist/theme/vendor/utils/math_utils.js +75 -0
  375. package/dist/theme/vendor/utils/string_utils.js +61 -0
  376. package/dist/themes/autumn-contrast.css +2 -2
  377. package/dist/themes/autumn.css +2 -2
  378. package/dist/themes/baseline-contrast.css +2 -2
  379. package/dist/themes/baseline.css +2 -2
  380. package/dist/themes/brownbeige-contrast.css +2 -2
  381. package/dist/themes/brownbeige.css +2 -2
  382. package/dist/themes/content-contrast.css +2 -2
  383. package/dist/themes/content.css +2 -2
  384. package/dist/themes/desert-contrast.css +2 -2
  385. package/dist/themes/desert.css +2 -2
  386. package/dist/themes/expressive-contrast.css +2 -2
  387. package/dist/themes/expressive.css +2 -2
  388. package/dist/themes/fidelity-contrast.css +2 -2
  389. package/dist/themes/fidelity.css +2 -2
  390. package/dist/themes/forest-contrast.css +2 -2
  391. package/dist/themes/forest.css +2 -2
  392. package/dist/themes/fruit-salad-contrast.css +2 -2
  393. package/dist/themes/fruit-salad.css +2 -2
  394. package/dist/themes/highcontrast-contrast.css +2 -2
  395. package/dist/themes/highcontrast.css +2 -2
  396. package/dist/themes/monochrome-contrast.css +2 -2
  397. package/dist/themes/monochrome.css +2 -2
  398. package/dist/themes/neutral-contrast.css +2 -2
  399. package/dist/themes/neutral.css +2 -2
  400. package/dist/themes/ocean-contrast.css +2 -2
  401. package/dist/themes/ocean.css +2 -2
  402. package/dist/themes/rainbow-contrast.css +2 -2
  403. package/dist/themes/rainbow.css +2 -2
  404. package/dist/themes/sageivory-contrast.css +2 -2
  405. package/dist/themes/sageivory.css +2 -2
  406. package/dist/themes/spring-contrast.css +2 -2
  407. package/dist/themes/spring.css +2 -2
  408. package/dist/themes/summer-contrast.css +2 -2
  409. package/dist/themes/summer.css +2 -2
  410. package/dist/themes/sunset-contrast.css +2 -2
  411. package/dist/themes/sunset.css +2 -2
  412. package/dist/themes/tealcaramel-contrast.css +2 -2
  413. package/dist/themes/tealcaramel.css +2 -2
  414. package/dist/themes/vibrant-contrast.css +2 -2
  415. package/dist/themes/vibrant.css +2 -2
  416. package/dist/vue/create.d.ts +18 -0
  417. package/dist/vue/index.d.ts +1 -0
  418. package/package.json +14 -1
  419. package/src/styles/components/_menu.scss +14 -1
  420. package/src/styles/themes/_autumn.scss +20 -2
  421. package/src/styles/themes/_base-theme.scss +34 -24
  422. package/src/styles/themes/_baseline.scss +18 -0
  423. package/src/styles/themes/_brownbeige.scss +30 -2
  424. package/src/styles/themes/_content.scss +30 -2
  425. package/src/styles/themes/_desert.scss +30 -2
  426. package/src/styles/themes/_expressive.scss +30 -2
  427. package/src/styles/themes/_fidelity.scss +30 -2
  428. package/src/styles/themes/_forest.scss +20 -2
  429. package/src/styles/themes/_fruit-salad.scss +30 -2
  430. package/src/styles/themes/_highcontrast.scss +21 -2
  431. package/src/styles/themes/_monochrome.scss +30 -2
  432. package/src/styles/themes/_neutral.scss +30 -2
  433. package/src/styles/themes/_ocean.scss +20 -2
  434. package/src/styles/themes/_rainbow.scss +30 -2
  435. package/src/styles/themes/_sageivory.scss +30 -2
  436. package/src/styles/themes/_spring.scss +20 -2
  437. package/src/styles/themes/_summer.scss +30 -2
  438. package/src/styles/themes/_sunset.scss +20 -2
  439. package/src/styles/themes/_tealcaramel.scss +30 -2
  440. package/src/styles/themes/_vibrant.scss +30 -2
@@ -1,64 +1,117 @@
1
1
  import type { EventCallback } from "../../core/state/emitter.js";
2
2
  import type { ButtonComponent } from "../button/types.js";
3
3
  import type { IconButtonComponent } from "../icon-button/types.js";
4
+ /** Where the snackbar sits along the bottom edge */
4
5
  export type SnackbarPosition = 'center' | 'start' | 'end';
6
+ /** Duration presets: 4 s, 10 s, or until dismissed */
5
7
  export type SnackbarDurationPreset = 'short' | 'long' | 'indefinite';
8
+ /** A preset or a number of milliseconds (0 for indefinite) */
6
9
  export type SnackbarDuration = SnackbarDurationPreset | number;
10
+ /** Available snackbar queue behaviors */
7
11
  export type SnackbarQueueBehavior = 'queue' | 'replace';
12
+ /** Snackbar visibility states */
8
13
  export type SnackbarState = 'visible' | 'queued' | 'hidden';
14
+ /** Why a snackbar closed */
9
15
  export type SnackbarCloseReason = 'timeout' | 'action' | 'close-button' | 'escape' | 'api' | 'queue';
16
+ /** Available snackbar event types */
10
17
  export type SnackbarEventType = 'open' | 'close' | 'action' | 'dismiss';
18
+ /** Snackbar event data */
11
19
  export interface SnackbarEvent {
20
+ /** The snackbar component that triggered the event */
12
21
  snackbar: SnackbarComponent;
22
+ /** Why the snackbar closed (`close` and `dismiss` events) */
13
23
  reason?: SnackbarCloseReason;
24
+ /** Original DOM event if there was one */
14
25
  originalEvent: Event | null;
15
26
  }
27
+ /** What each snackbar event hands its handler. */
16
28
  export interface SnackbarEvents {
29
+ /** The snackbar is on screen */
17
30
  open: (event: SnackbarEvent) => void;
31
+ /** The snackbar is leaving; the event carries the reason */
18
32
  close: (event: SnackbarEvent) => void;
33
+ /** The action button was clicked */
19
34
  action: (event: SnackbarEvent) => void;
35
+ /** Fired with `close`; the queue listens to it */
20
36
  dismiss: (event: SnackbarEvent) => void;
21
37
  }
38
+ /** Configuration options for the snackbar component */
22
39
  export interface SnackbarConfig {
40
+ /** Text message to display; up to two lines */
23
41
  message: string;
42
+ /** Label of the single text-button action, if any */
24
43
  action?: string;
44
+ /** Adds a close icon button */
25
45
  dismissible?: boolean;
46
+ /** Accessible name of the close icon (default "Dismiss") */
26
47
  closeLabel?: string;
48
+ /** How long the snackbar stays: `'short'` (4 s), `'long'` (10 s), `'indefinite'`, or milliseconds (0 for indefinite). */
27
49
  duration?: SnackbarDuration;
50
+ /** Position of the snackbar along the bottom edge */
28
51
  position?: SnackbarPosition;
52
+ /** How this snackbar interacts with the queue when shown. */
29
53
  queueBehavior?: SnackbarQueueBehavior;
54
+ /** `"top"` shows the snackbar in the browser's top layer as a `popover="manual"` element: above every z-index, modal dialogs included, at its usual place in viewport coordinates. */
30
55
  layer?: 'top';
56
+ /** Action button callback function */
31
57
  onAction?: (event: SnackbarEvent) => void;
58
+ /** Callback function when the snackbar opens */
32
59
  onOpen?: (event: SnackbarEvent) => void;
60
+ /** Callback function when the snackbar closes */
33
61
  onClose?: (event: SnackbarEvent) => void;
62
+ /** Additional CSS classes */
34
63
  class?: string;
64
+ /** Component prefix for CSS classes */
35
65
  prefix?: string;
66
+ /** Component name for CSS classes */
36
67
  componentName?: string;
68
+ /** Event handlers for snackbar events */
37
69
  on?: {
38
70
  [key in SnackbarEventType]?: (event: SnackbarEvent) => void;
39
71
  };
40
72
  }
73
+ /** Snackbar component public API interface */
41
74
  export interface SnackbarComponent {
75
+ /** The root element of the snackbar */
42
76
  element: HTMLElement;
77
+ /** Current state of the snackbar: `queued` between `show()` and its turn on screen, behind another snackbar; `visible` while it is shown. */
43
78
  state: SnackbarState;
79
+ /** The action button element (if present) */
44
80
  actionButton?: HTMLElement;
81
+ /** The close icon button element (if present) */
45
82
  closeButton?: HTMLElement;
83
+ /** Timer for auto-dismissal */
46
84
  timer?: SnackbarTimer;
85
+ /** Displays the snackbar, through the queue. */
47
86
  show: () => SnackbarComponent;
87
+ /** Hides the snackbar. */
48
88
  hide: () => SnackbarComponent;
89
+ /** Whether the snackbar is on screen: true only while `state` is `visible` */
49
90
  isOpen: () => boolean;
91
+ /** Sets the message text */
50
92
  setMessage: (message: string) => SnackbarComponent;
93
+ /** Gets the message text */
51
94
  getMessage: () => string;
95
+ /** Sets the action button text */
52
96
  setAction: (text: string) => SnackbarComponent;
97
+ /** Gets the action button text */
53
98
  getAction: () => string;
99
+ /** Sets the display duration: a preset or milliseconds (0 for indefinite) */
54
100
  setDuration: (duration: SnackbarDuration) => SnackbarComponent;
101
+ /** Gets the display duration in milliseconds (0 for indefinite) */
55
102
  getDuration: () => number;
103
+ /** Sets the snackbar position */
56
104
  setPosition: (position: SnackbarPosition) => SnackbarComponent;
105
+ /** Gets the snackbar position */
57
106
  getPosition: () => SnackbarPosition;
107
+ /** Adds event listener */
58
108
  on: <K extends keyof SnackbarEvents>(event: K, handler: SnackbarEvents[K]) => SnackbarComponent;
109
+ /** Removes event listener */
59
110
  off: <K extends keyof SnackbarEvents>(event: K, handler: SnackbarEvents[K]) => SnackbarComponent;
111
+ /** Destroys the snackbar component and cleans up resources */
60
112
  destroy: () => void;
61
113
  }
114
+ /** The component as it passes through the enhancers */
62
115
  export interface BaseComponent {
63
116
  element: HTMLElement;
64
117
  emit?: (event: string, data?: unknown) => void;
@@ -82,32 +135,46 @@ export interface BaseComponent {
82
135
  closeButton?: HTMLElement;
83
136
  timer?: SnackbarTimer;
84
137
  }
138
+ /** Timer interface for snackbar auto-dismissal */
85
139
  export interface SnackbarTimer {
140
+ /** Starts the countdown from the full duration */
86
141
  start: () => void;
142
+ /** Cancels the countdown */
87
143
  stop: () => void;
144
+ /** Sets the auto-dismiss duration in milliseconds (0 for none) */
88
145
  setDuration: (duration: number) => void;
146
+ /** Gets the current auto-dismiss duration in milliseconds */
89
147
  getDuration: () => number;
90
148
  }
149
+ /** Interface for snackbars managed by the queue */
91
150
  export interface QueuedSnackbar {
92
151
  _show: () => void;
152
+ /** Visually dismisses the snackbar without advancing the queue */
93
153
  _hide?: () => void;
154
+ /** The snackbar's own element, so the queue can tell whether it is still on screen */
94
155
  element?: HTMLElement;
95
156
  on: (event: string, handler: () => void) => void;
96
157
  off: (event: string, handler: () => void) => void;
97
158
  }
159
+ /** Options controlling how a snackbar is added to the queue */
98
160
  export interface SnackbarQueueAddOptions {
161
+ /** Behavior to apply when adding this snackbar (defaults to `'queue'`) */
99
162
  behavior?: SnackbarQueueBehavior;
100
163
  }
164
+ /** Interface for the snackbar queue manager */
101
165
  export interface SnackbarQueue {
102
166
  add: (snackbar: QueuedSnackbar, options?: SnackbarQueueAddOptions) => void;
103
167
  clear: () => void;
168
+ /** Takes a snackbar out of the queue: a waiting one, or the one on screen when it is destroyed */
104
169
  remove: (snackbar: QueuedSnackbar) => void;
105
170
  getLength: () => number;
106
171
  }
172
+ /** API options for enhancing a snackbar with API methods */
107
173
  export interface ApiOptions {
108
174
  lifecycle: {
109
175
  destroy: () => void;
110
176
  };
111
177
  queue: SnackbarQueue;
178
+ /** The resolved configuration */
112
179
  config: SnackbarConfig;
113
180
  }
@@ -17,7 +17,7 @@ originalEvent: null,
17
17
  ...extra,
18
18
  });
19
19
  };
20
- const setExpanded = (next, originalEvent = null) => {
20
+ const setExpanded = (next, originalEvent = null, interactionType) => {
21
21
  if (expanded === next)
22
22
  return;
23
23
  expanded = next;
@@ -25,7 +25,7 @@ element.classList.toggle(expandedClass, expanded);
25
25
  trailing.element.setAttribute("aria-expanded", String(expanded));
26
26
  if (menu) {
27
27
  if (expanded)
28
- menu.open(originalEvent ?? undefined);
28
+ menu.open(originalEvent ?? undefined, interactionType);
29
29
  else
30
30
  menu.close(originalEvent ?? undefined);
31
31
  }
@@ -97,6 +97,7 @@ return this;
97
97
  },
98
98
  destroy() {
99
99
  destroyed = true;
100
+ trailing.element.removeEventListener("keydown", handleTrailingKeydown);
100
101
  menu?.destroy?.();
101
102
  leading.destroy();
102
103
  trailing.destroy();
@@ -107,9 +108,18 @@ lifecycle.destroy();
107
108
  leading.on("click", ({ originalEvent: event }) => {
108
109
  emit(SPLIT_BUTTON_EVENTS.CLICK, { originalEvent: event });
109
110
  });
111
+ const interactionOf = (event) => event instanceof MouseEvent && event.detail === 0 ? "keyboard" : "mouse";
110
112
  trailing.on("click", ({ originalEvent: event }) => {
111
- setExpanded(!expanded, event);
113
+ setExpanded(!expanded, event, interactionOf(event));
112
114
  });
115
+ const handleTrailingKeydown = (event) => {
116
+ if (event.key !== "ArrowDown" && event.key !== "ArrowUp")
117
+ return;
118
+ event.preventDefault();
119
+ if (!expanded)
120
+ setExpanded(true, event, "keyboard");
121
+ };
122
+ trailing.element.addEventListener("keydown", handleTrailingKeydown);
113
123
  const wire = (menu) => {
114
124
  trailing.element.setAttribute("aria-haspopup", "menu");
115
125
  menu.on?.("close", () => {
@@ -1,9 +1,11 @@
1
+ /** Visual styles, the same set the button offers */
1
2
  export declare const SPLIT_BUTTON_VARIANTS: {
2
3
  readonly FILLED: "filled";
3
4
  readonly TONAL: "tonal";
4
5
  readonly OUTLINED: "outlined";
5
6
  readonly ELEVATED: "elevated";
6
7
  };
8
+ /** Sizes, matching the button and icon button scale */
7
9
  export declare const SPLIT_BUTTON_SIZES: {
8
10
  readonly XS: "xs";
9
11
  readonly S: "s";
@@ -11,19 +13,29 @@ export declare const SPLIT_BUTTON_SIZES: {
11
13
  readonly L: "l";
12
14
  readonly XL: "xl";
13
15
  };
16
+ /** Events the component emits */
14
17
  export declare const SPLIT_BUTTON_EVENTS: {
18
+ /** The leading button was activated */
15
19
  readonly CLICK: "click";
20
+ /** The trailing button opened whatever it opens */
16
21
  readonly EXPAND: "expand";
22
+ /** The trailing button closed it */
17
23
  readonly COLLAPSE: "collapse";
24
+ /** Either of the two, carrying the new state */
18
25
  readonly CHANGE: "change";
26
+ /** A menu item was chosen, when the component owns a menu */
19
27
  readonly SELECT: "select";
20
28
  };
29
+ /** Defaults */
21
30
  export declare const SPLIT_BUTTON_DEFAULTS: {
22
31
  readonly VARIANT: "filled";
23
32
  readonly SIZE: "s";
33
+ /** Accessible name of the trailing button when none is given */
24
34
  readonly TRAILING_LABEL: "More options";
35
+ /** How far the menu sits from the button (M3 split button guidelines) */
25
36
  readonly MENU_OFFSET: 4;
26
37
  };
38
+ /** CSS class names, without the prefix */
27
39
  export declare const SPLIT_BUTTON_CLASSES: {
28
40
  readonly ROOT: "split-button";
29
41
  readonly LEADING: "split-button__leading";
@@ -31,4 +43,5 @@ export declare const SPLIT_BUTTON_CLASSES: {
31
43
  readonly CHEVRON: "split-button__chevron";
32
44
  readonly EXPANDED: "split-button--expanded";
33
45
  };
46
+ /** The trailing button's icon. */
34
47
  export declare const SPLIT_BUTTON_CHEVRON: string;
@@ -1,3 +1,7 @@
1
1
  import { SplitButtonConfig, SplitButtonComponent } from "./types.js";
2
+ /**
3
+ * Creates a split button: one action beside a button that opens more choices.
4
+ * @param config
5
+ */
2
6
  declare const createSplitButton: (config?: SplitButtonConfig) => SplitButtonComponent;
3
7
  export default createSplitButton;
@@ -1,62 +1,112 @@
1
1
  import type { MenuContent } from "../menu/types.js";
2
2
  import type { MenuOwner } from "../menu/inner.js";
3
3
  import type { ButtonComponent } from "../button/types.js";
4
+ /** Visual style, the same set the button offers */
4
5
  export type SplitButtonVariant = "filled" | "tonal" | "outlined" | "elevated";
6
+ /** Size, matching the button and icon button scale */
5
7
  export type SplitButtonSize = "xs" | "s" | "m" | "l" | "xl";
8
+ /** Events the component emits */
6
9
  export type SplitButtonEventType = "click" | "expand" | "collapse" | "change" | "select";
10
+ /** What an event handler receives */
7
11
  export interface SplitButtonEvent {
12
+ /** The component that emitted it */
8
13
  splitButton: SplitButtonComponent;
14
+ /** Whether the trailing button is showing its menu */
9
15
  expanded: boolean;
16
+ /** The DOM event behind it, when there was one */
10
17
  originalEvent: Event | null;
18
+ /** The chosen item, on a `select` event */
11
19
  item?: MenuContent;
20
+ /** The chosen item's `id`, on a `select` event: the `value` of the `<m-split-button>` element's `select` */
12
21
  value?: string | null;
13
22
  }
23
+ /** Configuration for the split button */
14
24
  export interface SplitButtonConfig {
25
+ /** Label of the leading button */
15
26
  text?: string;
27
+ /** `"top"` renders the menu next to the trailing button, in its tree (a shadow root included), and shows it in the browser's top layer. */
16
28
  layer?: "top";
29
+ /** Icon of the leading button. */
17
30
  icon?: string;
31
+ /** Visual style, shared by both buttons */
18
32
  variant?: SplitButtonVariant;
33
+ /** Size of both buttons */
19
34
  size?: SplitButtonSize;
35
+ /** Whether both buttons are disabled */
20
36
  disabled?: boolean;
37
+ /**
38
+ * Accessible name of the trailing button.
39
+ * @default 'More options'
40
+ */
21
41
  trailingLabel?: string;
42
+ /** Accessible name of the leading button, when its label is not enough */
22
43
  ariaLabel?: string;
44
+ /** Accessible name of the whole group */
23
45
  groupLabel?: string;
46
+ /** What the leading button does */
24
47
  onClick?: (event: SplitButtonEvent) => void;
48
+ /** Menu items for the trailing button to open. */
25
49
  items?: MenuContent[];
50
+ /** Called with the chosen item when the component owns the menu */
26
51
  onSelect?: (event: SplitButtonEvent) => void;
52
+ /** Additional CSS classes */
27
53
  class?: string;
54
+ /** Component prefix for CSS class names */
28
55
  prefix?: string;
56
+ /** Component name for CSS class names */
29
57
  componentName?: string;
58
+ /** Event handlers */
30
59
  on?: {
31
60
  [key in SplitButtonEventType]?: (event: SplitButtonEvent) => void;
32
61
  };
33
62
  }
63
+ /** The split button's public API */
34
64
  export interface SplitButtonComponent {
65
+ /** The element holding both buttons */
35
66
  element: HTMLElement;
67
+ /** The leading button's element */
36
68
  leadingElement: HTMLButtonElement;
69
+ /** The trailing button's element */
37
70
  trailingElement: HTMLButtonElement;
71
+ /** Sets the leading button's label */
38
72
  setText: (text: string) => SplitButtonComponent;
73
+ /** The leading button's label */
39
74
  getText: () => string;
75
+ /** Sets the leading button's icon */
40
76
  setIcon: (icon: string) => SplitButtonComponent;
77
+ /** Replaces the menu's items. */
41
78
  setItems: (items: MenuContent[]) => SplitButtonComponent;
79
+ /** The menu's items; empty while the split button has no menu */
42
80
  getItems: () => MenuContent[];
81
+ /** Opens whatever the trailing button opens. */
43
82
  expand: () => SplitButtonComponent;
83
+ /** Closes it. */
44
84
  collapse: () => SplitButtonComponent;
85
+ /** Whether it is open */
45
86
  isExpanded: () => boolean;
87
+ /** Disables both buttons */
46
88
  disable: () => SplitButtonComponent;
89
+ /** Enables both buttons */
47
90
  enable: () => SplitButtonComponent;
91
+ /** Whether both buttons are disabled */
48
92
  isDisabled: () => boolean;
93
+ /** Adds an event listener */
49
94
  on: (event: SplitButtonEventType, handler: (event: SplitButtonEvent) => void) => SplitButtonComponent;
95
+ /** Removes an event listener */
50
96
  off: (event: SplitButtonEventType, handler: (event: SplitButtonEvent) => void) => SplitButtonComponent;
97
+ /** Takes the component off the page and releases what it holds */
51
98
  destroy: () => void;
52
99
  }
100
+ /** What withButtons adds */
53
101
  export interface ButtonsFeature {
54
102
  leading: ButtonComponent;
55
103
  trailing: ButtonComponent;
56
104
  leadingElement: HTMLElement;
57
105
  trailingElement: HTMLElement;
58
106
  }
107
+ /** What withMenu adds: the menu, when the component was given items */
59
108
  export type MenuFeature = MenuOwner;
109
+ /** The component as it passes through the enhancers */
60
110
  export interface BaseComponent extends ButtonsFeature, MenuFeature {
61
111
  element: HTMLElement;
62
112
  emit?: (event: string, data?: unknown) => void;
@@ -1,39 +1,73 @@
1
+ /** Switch label position options */
1
2
  export declare const SWITCH_LABEL_POSITIONS: {
3
+ /** Label positioned before the switch (left in LTR layouts) */
2
4
  readonly START: "start";
5
+ /** Label positioned after the switch (right in LTR layouts) */
3
6
  readonly END: "end";
4
7
  };
8
+ /** Switch states */
5
9
  export declare const SWITCH_STATES: {
10
+ /** Switch is checked/on */
6
11
  readonly CHECKED: "checked";
12
+ /** Switch is unchecked/off */
7
13
  readonly UNCHECKED: "unchecked";
14
+ /** Switch is disabled */
8
15
  readonly DISABLED: "disabled";
16
+ /** Switch is enabled */
9
17
  readonly ENABLED: "enabled";
10
18
  };
19
+ /** Switch events */
11
20
  export declare const SWITCH_EVENTS: {
21
+ /** Emitted when the checked state changes. */
12
22
  readonly CHANGE: "change";
23
+ /** The switch received focus. */
13
24
  readonly FOCUS: "focus";
25
+ /** The switch lost focus. */
14
26
  readonly BLUR: "blur";
15
27
  };
28
+ /** Default configuration values for switch */
16
29
  export declare const SWITCH_DEFAULTS: {
30
+ /** Default checked state */
17
31
  readonly CHECKED: false;
32
+ /** Default disabled state */
18
33
  readonly DISABLED: false;
34
+ /** Default required state */
19
35
  readonly REQUIRED: false;
36
+ /** Default label position: the label leads and the switch trails, as in M3 settings rows */
20
37
  readonly LABEL_POSITION: "start";
38
+ /** Default input value */
21
39
  readonly VALUE: "on";
22
40
  };
41
+ /** CSS class names used by the switch component */
23
42
  export declare const SWITCH_CLASSES: {
43
+ /** Root element class */
24
44
  readonly ROOT: "switch";
45
+ /** Container element class */
25
46
  readonly CONTAINER: "switch__container";
47
+ /** Content wrapper class */
26
48
  readonly CONTENT: "switch__content";
49
+ /** Label element class */
27
50
  readonly LABEL: "switch__label";
51
+ /** Input element class */
28
52
  readonly INPUT: "switch__input";
53
+ /** Track element class */
29
54
  readonly TRACK: "switch__track";
55
+ /** Thumb element class */
30
56
  readonly THUMB: "switch__thumb";
57
+ /** Label at start position class */
31
58
  readonly LABEL_START: "switch--label-start";
59
+ /** Label at end position class */
32
60
  readonly LABEL_END: "switch--label-end";
61
+ /** Checked state class */
33
62
  readonly CHECKED: "switch--checked";
63
+ /** Disabled state class */
34
64
  readonly DISABLED: "switch--disabled";
65
+ /** Error state class */
35
66
  readonly ERROR: "switch--error";
67
+ /** Helper/supporting text class */
36
68
  readonly HELPER: "switch__helper";
69
+ /** Error helper text class */
37
70
  readonly HELPER_ERROR: "switch__helper--error";
71
+ /** Focus state class */
38
72
  readonly FOCUSED: "switch--focused";
39
73
  };
@@ -1,3 +1,7 @@
1
1
  import { SwitchConfig, SwitchComponent } from "./types.js";
2
+ /**
3
+ * Creates a new Switch component
4
+ * @param config
5
+ */
2
6
  declare const createSwitch: (config?: SwitchConfig) => SwitchComponent;
3
7
  export default createSwitch;
@@ -1,61 +1,113 @@
1
1
  import type { TouchEvents } from "../../core/utils/mobile.js";
2
2
  import type { EventCallback } from "../../core/state/emitter.js";
3
3
  export type SwitchPosition = "center" | "start" | "end";
4
+ /** Switch label position types */
4
5
  export type SwitchLabelPosition = "start" | "end";
6
+ /** Configuration interface for the Switch component */
5
7
  export interface SwitchConfig {
8
+ /** Input name attribute */
6
9
  name?: string;
10
+ /** Initial checked state */
7
11
  checked?: boolean;
12
+ /** Whether input is required */
8
13
  required?: boolean;
14
+ /** Whether switch is disabled */
9
15
  disabled?: boolean;
16
+ /** Input value attribute */
10
17
  value?: string;
18
+ /** Label text, or a node placed inside the label (the web component passes a `<slot>`) */
11
19
  label?: string | Node;
20
+ /** Supporting text content */
12
21
  supportingText?: string;
22
+ /** Whether supporting text indicates an error */
13
23
  error?: boolean;
24
+ /** Additional CSS classes */
14
25
  class?: string;
26
+ /** ARIA label for accessibility */
15
27
  ariaLabel?: string;
28
+ /** Prefix for class names */
16
29
  prefix?: string;
30
+ /** Component name */
17
31
  componentName?: string;
32
+ /** Icon HTML in the selected handle; 'none' for no icon. */
18
33
  icon?: string;
34
+ /** Icon HTML in the unselected handle, which then grows to 24dp (M3's icons on both states). */
19
35
  unselectedIcon?: string;
36
+ /**
37
+ * Which side of the switch the label sits on
38
+ * @default 'start'
39
+ */
20
40
  labelPosition?: SwitchLabelPosition;
41
+ /** Index signature for additional properties */
21
42
  [key: string]: unknown;
22
43
  }
44
+ /** A checked-state change from native input activation. */
23
45
  export interface SwitchChangePayload {
46
+ /** The new checked state. */
24
47
  checked: boolean;
48
+ /** The checked model value, matching getValue() at dispatch. */
25
49
  value: boolean;
50
+ /** The input's HTML value attribute, used for native form submission. */
26
51
  valueAttribute: string;
52
+ /** The original native change event, when supplied by the emitter. */
27
53
  nativeEvent?: Event;
28
54
  }
55
+ /** Emitter events: change, and the input's focus and blur. */
29
56
  export interface SwitchEvents extends TouchEvents {
30
57
  change: (payload: SwitchChangePayload) => void;
31
58
  focus: (event: FocusEvent) => void;
32
59
  blur: (event: FocusEvent) => void;
33
60
  }
61
+ /** Switch component interface */
34
62
  export interface SwitchComponent {
63
+ /** The root element of the switch */
35
64
  element: HTMLElement;
65
+ /** The input element */
36
66
  input: HTMLInputElement;
67
+ /** Gets the switch's checked state (boolean) for form compatibility */
37
68
  getValue: () => boolean;
69
+ /** Sets the switch's checked state */
38
70
  setValue: (value: boolean | string) => SwitchComponent;
71
+ /** Gets the HTML value attribute (rarely needed) */
39
72
  getValueAttribute: () => string;
73
+ /** Sets the HTML value attribute (rarely needed) */
40
74
  setValueAttribute: (value: string) => SwitchComponent;
75
+ /** Checks/activates the switch */
41
76
  check: () => SwitchComponent;
77
+ /** Unchecks/deactivates the switch */
42
78
  uncheck: () => SwitchComponent;
79
+ /** Toggles the switch's checked state */
43
80
  toggle: () => SwitchComponent;
81
+ /** Returns whether the switch is checked */
44
82
  isChecked: () => boolean;
83
+ /** Sets the switch's label text */
45
84
  setLabel: (text: string) => SwitchComponent;
85
+ /** Gets the switch's label text */
46
86
  getLabel: () => string;
87
+ /** Supporting text element */
47
88
  supportingTextElement: HTMLElement | null;
89
+ /** Sets supporting text content */
48
90
  setSupportingText: (text: string, isError?: boolean) => SwitchComponent;
91
+ /** Removes supporting text */
49
92
  removeSupportingText: () => SwitchComponent;
93
+ /** Puts the switch in or out of the error state: its class and aria-invalid */
50
94
  setError: (error: boolean) => SwitchComponent;
95
+ /** Whether the switch is in the error state */
51
96
  isError: () => boolean;
97
+ /** Subscribes to checked-state changes; native input events use input.addEventListener. */
52
98
  on: <K extends keyof SwitchEvents>(event: K, handler: SwitchEvents[K]) => SwitchComponent;
99
+ /** Removes event listener */
53
100
  off: <K extends keyof SwitchEvents>(event: K, handler: SwitchEvents[K]) => SwitchComponent;
101
+ /** Enables the switch */
54
102
  enable: () => SwitchComponent;
103
+ /** Disables the switch */
55
104
  disable: () => SwitchComponent;
105
+ /** Whether the switch is disabled */
56
106
  isDisabled: () => boolean;
107
+ /** Destroys the switch component and cleans up resources */
57
108
  destroy: () => void;
58
109
  }
110
+ /** API options interface */
59
111
  export interface ApiOptions {
60
112
  disabled: {
61
113
  enable: () => void;
@@ -72,6 +124,7 @@ export interface ApiOptions {
72
124
  isChecked: () => boolean;
73
125
  };
74
126
  }
127
+ /** Base component interface */
75
128
  export interface BaseComponent {
76
129
  element: HTMLElement;
77
130
  input?: HTMLInputElement;
@@ -103,7 +156,9 @@ export interface BaseComponent {
103
156
  setError?: (error: boolean) => void;
104
157
  isError?: () => boolean;
105
158
  }
159
+ /** Component as it reaches the API step of the pipeline. */
106
160
  export type ApiComponent = BaseComponent & Required<Pick<BaseComponent, "checkable" | "disabled" | "lifecycle">>;
161
+ /** Registers SwitchConfig with the global defaults map, so `setComponentDefaults("switch", ...)` is typed without core importing anything from this component. */
107
162
  declare module "../../core/config/global" {
108
163
  interface ComponentConfigMap {
109
164
  switch?: Partial<SwitchConfig>;