material 3.8.2 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/README.md +3 -3
  2. package/dist/components/bottom-app-bar/bottom-app-bar.d.ts +6 -0
  3. package/dist/components/bottom-app-bar/constants.d.ts +16 -3
  4. package/dist/components/bottom-app-bar/types.d.ts +71 -10
  5. package/dist/components/bottom-sheet/config.js +1 -1
  6. package/dist/components/bottom-sheet/features/structure.js +10 -2
  7. package/dist/components/bottom-sheet/types.d.ts +2 -0
  8. package/dist/components/button-group/button-group.js +1 -1
  9. package/dist/components/checkbox/config.js +3 -2
  10. package/dist/components/checkbox/types.d.ts +5 -0
  11. package/dist/components/datepicker/config.js +1 -1
  12. package/dist/components/datepicker/datepicker.js +12 -3
  13. package/dist/components/datepicker/render.js +2 -2
  14. package/dist/components/datepicker/types.d.ts +4 -0
  15. package/dist/components/index.d.ts +2 -1
  16. package/dist/components/index.js +1 -1
  17. package/dist/components/list/features/listbox.d.ts +16 -0
  18. package/dist/components/list/features/listbox.js +230 -0
  19. package/dist/components/list/index.d.ts +2 -0
  20. package/dist/components/list/index.js +1 -0
  21. package/dist/components/menu/config.js +2 -2
  22. package/dist/components/menu/constants.d.ts +4 -4
  23. package/dist/components/menu/constants.js +1 -1
  24. package/dist/components/menu/features/controller.js +12 -1
  25. package/dist/components/menu/features/position.js +15 -8
  26. package/dist/components/menu/features/submenu.js +3 -0
  27. package/dist/components/menu/types.d.ts +8 -1
  28. package/dist/components/radios/config.js +1 -0
  29. package/dist/components/radios/radio.js +2 -0
  30. package/dist/components/radios/types.d.ts +2 -0
  31. package/dist/components/search/features/input.js +6 -1
  32. package/dist/components/search/features/structure.js +3 -1
  33. package/dist/components/side-sheet/config.js +1 -1
  34. package/dist/components/side-sheet/features/structure.js +10 -2
  35. package/dist/components/side-sheet/types.d.ts +2 -0
  36. package/dist/components/slider/config.js +3 -2
  37. package/dist/components/slider/types.d.ts +5 -0
  38. package/dist/components/split-button/config.js +1 -1
  39. package/dist/components/switch/config.js +3 -2
  40. package/dist/components/switch/types.d.ts +5 -0
  41. package/dist/components/tabs/config.js +1 -0
  42. package/dist/components/tabs/tab.js +11 -5
  43. package/dist/components/tabs/types.d.ts +5 -1
  44. package/dist/components/text-field/config.js +7 -2
  45. package/dist/components/text-field/types.d.ts +5 -0
  46. package/dist/components/timepicker/api.js +7 -8
  47. package/dist/components/timepicker/config.js +1 -1
  48. package/dist/components/timepicker/render.js +22 -5
  49. package/dist/components/timepicker/timepicker.js +0 -1
  50. package/dist/components/timepicker/types.d.ts +4 -0
  51. package/dist/components/toolbar/config.js +1 -0
  52. package/dist/components/toolbar/constants.d.ts +4 -1
  53. package/dist/components/toolbar/constants.js +3 -0
  54. package/dist/components/toolbar/toolbar.js +18 -3
  55. package/dist/components/toolbar/types.d.ts +6 -2
  56. package/dist/core/config/component.d.ts +5 -515
  57. package/dist/core/config/control-label.js +5 -0
  58. package/dist/elements/bottom-app-bar.d.ts +19 -2
  59. package/dist/elements/bottom-sheet.js +3 -2
  60. package/dist/elements/css/badge.js +2 -2
  61. package/dist/elements/css/bottom-app-bar.js +2 -2
  62. package/dist/elements/css/bottom-sheet.js +2 -2
  63. package/dist/elements/css/button-group.js +2 -2
  64. package/dist/elements/css/button.css +1 -1
  65. package/dist/elements/css/button.js +2 -2
  66. package/dist/elements/css/card.js +2 -2
  67. package/dist/elements/css/carousel.js +2 -2
  68. package/dist/elements/css/checkbox.js +2 -2
  69. package/dist/elements/css/chips.js +2 -2
  70. package/dist/elements/css/datepicker.js +2 -2
  71. package/dist/elements/css/dialog.js +2 -2
  72. package/dist/elements/css/divider.js +2 -2
  73. package/dist/elements/css/drawer.js +2 -2
  74. package/dist/elements/css/extended-fab.js +2 -2
  75. package/dist/elements/css/fab-menu.js +2 -2
  76. package/dist/elements/css/fab.js +2 -2
  77. package/dist/elements/css/icon-button.js +2 -2
  78. package/dist/elements/css/list.css +1 -1
  79. package/dist/elements/css/list.js +2 -2
  80. package/dist/elements/css/loading-indicator.js +2 -2
  81. package/dist/elements/css/menu.css +1 -1
  82. package/dist/elements/css/menu.js +2 -2
  83. package/dist/elements/css/navigation-bar.js +2 -2
  84. package/dist/elements/css/navigation-rail.js +2 -2
  85. package/dist/elements/css/progress.js +2 -2
  86. package/dist/elements/css/radios.js +2 -2
  87. package/dist/elements/css/ripple.js +2 -2
  88. package/dist/elements/css/search.js +2 -2
  89. package/dist/elements/css/select.js +2 -2
  90. package/dist/elements/css/side-sheet.js +2 -2
  91. package/dist/elements/css/slider.js +2 -2
  92. package/dist/elements/css/snackbar.js +2 -2
  93. package/dist/elements/css/split-button.js +2 -2
  94. package/dist/elements/css/switch.js +2 -2
  95. package/dist/elements/css/tabs.js +2 -2
  96. package/dist/elements/css/text-field.js +2 -2
  97. package/dist/elements/css/timepicker.js +2 -2
  98. package/dist/elements/css/toolbar.css +1 -1
  99. package/dist/elements/css/toolbar.js +2 -2
  100. package/dist/elements/css/tooltip.js +2 -2
  101. package/dist/elements/css/top-app-bar.js +2 -2
  102. package/dist/elements/datepicker.d.ts +5 -0
  103. package/dist/elements/datepicker.js +1 -0
  104. package/dist/elements/index.d.ts +26 -323
  105. package/dist/elements/menu.js +17 -3
  106. package/dist/elements/preupgrade/badge.css +1 -1
  107. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  108. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  109. package/dist/elements/preupgrade/button-group.css +1 -1
  110. package/dist/elements/preupgrade/button.css +1 -1
  111. package/dist/elements/preupgrade/card.css +1 -1
  112. package/dist/elements/preupgrade/carousel.css +1 -1
  113. package/dist/elements/preupgrade/checkbox.css +1 -1
  114. package/dist/elements/preupgrade/chips.css +1 -1
  115. package/dist/elements/preupgrade/datepicker.css +1 -1
  116. package/dist/elements/preupgrade/dialog.css +1 -1
  117. package/dist/elements/preupgrade/divider.css +1 -1
  118. package/dist/elements/preupgrade/drawer.css +1 -1
  119. package/dist/elements/preupgrade/extended-fab.css +1 -1
  120. package/dist/elements/preupgrade/fab-menu.css +1 -1
  121. package/dist/elements/preupgrade/fab.css +1 -1
  122. package/dist/elements/preupgrade/icon-button.css +1 -1
  123. package/dist/elements/preupgrade/list.css +1 -1
  124. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  125. package/dist/elements/preupgrade/menu.css +1 -1
  126. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  127. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  128. package/dist/elements/preupgrade/progress.css +1 -1
  129. package/dist/elements/preupgrade/radios.css +1 -1
  130. package/dist/elements/preupgrade/search.css +1 -1
  131. package/dist/elements/preupgrade/select.css +1 -1
  132. package/dist/elements/preupgrade/side-sheet.css +1 -1
  133. package/dist/elements/preupgrade/slider.css +1 -1
  134. package/dist/elements/preupgrade/snackbar.css +1 -1
  135. package/dist/elements/preupgrade/split-button.css +1 -1
  136. package/dist/elements/preupgrade/switch.css +1 -1
  137. package/dist/elements/preupgrade/tabs.css +1 -1
  138. package/dist/elements/preupgrade/text-field.css +1 -1
  139. package/dist/elements/preupgrade/timepicker.css +1 -1
  140. package/dist/elements/preupgrade/toolbar.css +1 -1
  141. package/dist/elements/preupgrade/tooltip.css +1 -1
  142. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  143. package/dist/elements/preupgrade.css +1 -1
  144. package/dist/elements/preupgrade.js +2 -3
  145. package/dist/elements/radios.d.ts +1 -0
  146. package/dist/elements/radios.js +5 -1
  147. package/dist/elements/search.js +19 -3
  148. package/dist/elements/sheet.js +16 -6
  149. package/dist/elements/side-sheet.d.ts +3 -0
  150. package/dist/elements/side-sheet.js +5 -3
  151. package/dist/elements/styles.js +39 -0
  152. package/dist/elements/switch.d.ts +4 -0
  153. package/dist/elements/switch.js +1 -0
  154. package/dist/elements/tabs.d.ts +5 -0
  155. package/dist/elements/tabs.js +6 -0
  156. package/dist/elements/timepicker.d.ts +5 -0
  157. package/dist/elements/timepicker.js +1 -0
  158. package/dist/elements/toolbar.d.ts +9 -1
  159. package/dist/elements/toolbar.js +13 -1
  160. package/dist/react/bottom-app-bar.d.ts +1 -0
  161. package/dist/react/jsx.d.ts +1 -0
  162. package/dist/solid/bottom-app-bar.d.ts +1 -0
  163. package/dist/solid/jsx.d.ts +31 -27
  164. package/dist/styles/badge.css +1 -1
  165. package/dist/styles/base-lite.css +1 -1
  166. package/dist/styles/base.css +1 -1
  167. package/dist/styles/bottom-app-bar.css +1 -1
  168. package/dist/styles/bottom-sheet.css +1 -1
  169. package/dist/styles/button-group.css +1 -1
  170. package/dist/styles/button.css +2 -2
  171. package/dist/styles/card.css +1 -1
  172. package/dist/styles/carousel.css +1 -1
  173. package/dist/styles/checkbox.css +1 -1
  174. package/dist/styles/chips.css +1 -1
  175. package/dist/styles/contrast.css +1 -1
  176. package/dist/styles/datepicker.css +1 -1
  177. package/dist/styles/dialog.css +1 -1
  178. package/dist/styles/divider.css +1 -1
  179. package/dist/styles/drawer.css +1 -1
  180. package/dist/styles/extended-fab.css +1 -1
  181. package/dist/styles/fab-menu.css +1 -1
  182. package/dist/styles/fab.css +1 -1
  183. package/dist/styles/icon-button.css +1 -1
  184. package/dist/styles/list.css +2 -2
  185. package/dist/styles/loading-indicator.css +1 -1
  186. package/dist/styles/menu.css +2 -2
  187. package/dist/styles/navigation-bar.css +1 -1
  188. package/dist/styles/navigation-rail.css +1 -1
  189. package/dist/styles/progress.css +1 -1
  190. package/dist/styles/radios.css +1 -1
  191. package/dist/styles/search.css +1 -1
  192. package/dist/styles/select.css +1 -1
  193. package/dist/styles/side-sheet.css +1 -1
  194. package/dist/styles/slider.css +1 -1
  195. package/dist/styles/snackbar.css +1 -1
  196. package/dist/styles/split-button.css +1 -1
  197. package/dist/styles/switch.css +1 -1
  198. package/dist/styles/tabs.css +1 -1
  199. package/dist/styles/text-field.css +1 -1
  200. package/dist/styles/timepicker.css +1 -1
  201. package/dist/styles/toolbar.css +2 -2
  202. package/dist/styles/tooltip.css +1 -1
  203. package/dist/styles/top-app-bar.css +1 -1
  204. package/dist/styles/typography.css +1 -1
  205. package/dist/styles/utilities.css +1 -1
  206. package/dist/styles.css +2 -2
  207. package/dist/svelte/BottomAppBar.svelte.d.ts +1 -0
  208. package/dist/theme/2025.d.ts +3 -0
  209. package/dist/theme/2025.js +2 -0
  210. package/dist/theme/index.js +65 -17
  211. package/dist/theme/spec2025.d.ts +56 -0
  212. package/dist/theme/spec2025.js +37 -0
  213. package/dist/theme/vendor/dynamiccolor/color_spec_2025.js +846 -0
  214. package/dist/theme/vendor/dynamiccolor/dynamic_color.d.ts +7 -0
  215. package/dist/theme/vendor/dynamiccolor/dynamic_color.js +9 -5
  216. package/dist/theme/vendor/dynamiccolor/dynamic_scheme.d.ts +12 -0
  217. package/dist/theme/vendor/dynamiccolor/dynamic_scheme.js +13 -9
  218. package/dist/theme/vendor/dynamiccolor/spec_2025.js +263 -0
  219. package/dist/theme/vendor/dynamiccolor/spec_extensions.js +70 -0
  220. package/dist/theme/vendor/palettes/tonal_palette.d.ts +23 -0
  221. package/dist/themes/autumn-contrast.css +1 -1
  222. package/dist/themes/autumn.css +1 -1
  223. package/dist/themes/baseline-contrast.css +1 -1
  224. package/dist/themes/baseline.css +1 -1
  225. package/dist/themes/brownbeige-contrast.css +1 -1
  226. package/dist/themes/brownbeige.css +1 -1
  227. package/dist/themes/content-contrast.css +1 -1
  228. package/dist/themes/content.css +1 -1
  229. package/dist/themes/desert-contrast.css +1 -1
  230. package/dist/themes/desert.css +1 -1
  231. package/dist/themes/expressive-contrast.css +1 -1
  232. package/dist/themes/expressive.css +1 -1
  233. package/dist/themes/fidelity-contrast.css +1 -1
  234. package/dist/themes/fidelity.css +1 -1
  235. package/dist/themes/forest-contrast.css +1 -1
  236. package/dist/themes/forest.css +1 -1
  237. package/dist/themes/fruit-salad-contrast.css +1 -1
  238. package/dist/themes/fruit-salad.css +1 -1
  239. package/dist/themes/highcontrast-contrast.css +1 -1
  240. package/dist/themes/highcontrast.css +1 -1
  241. package/dist/themes/monochrome-contrast.css +1 -1
  242. package/dist/themes/monochrome.css +1 -1
  243. package/dist/themes/neutral-contrast.css +1 -1
  244. package/dist/themes/neutral.css +1 -1
  245. package/dist/themes/ocean-contrast.css +1 -1
  246. package/dist/themes/ocean.css +1 -1
  247. package/dist/themes/rainbow-contrast.css +1 -1
  248. package/dist/themes/rainbow.css +1 -1
  249. package/dist/themes/sageivory-contrast.css +1 -1
  250. package/dist/themes/sageivory.css +1 -1
  251. package/dist/themes/spring-contrast.css +1 -1
  252. package/dist/themes/spring.css +1 -1
  253. package/dist/themes/summer-contrast.css +1 -1
  254. package/dist/themes/summer.css +1 -1
  255. package/dist/themes/sunset-contrast.css +1 -1
  256. package/dist/themes/sunset.css +1 -1
  257. package/dist/themes/tealcaramel-contrast.css +1 -1
  258. package/dist/themes/tealcaramel.css +1 -1
  259. package/dist/themes/vibrant-contrast.css +1 -1
  260. package/dist/themes/vibrant.css +1 -1
  261. package/dist/vue/bottom-app-bar.d.ts +1 -0
  262. package/package.json +8 -3
  263. package/src/styles/components/_button.scss +19 -0
  264. package/src/styles/components/_list.scss +35 -1
  265. package/src/styles/components/_menu.scss +64 -46
  266. package/src/styles/components/_toolbar.scss +19 -2
  267. package/dist/elements/css/badge.d.ts +0 -1
  268. package/dist/elements/css/bottom-app-bar.d.ts +0 -1
  269. package/dist/elements/css/bottom-sheet.d.ts +0 -1
  270. package/dist/elements/css/button-group.d.ts +0 -1
  271. package/dist/elements/css/button.d.ts +0 -1
  272. package/dist/elements/css/card.d.ts +0 -1
  273. package/dist/elements/css/carousel.d.ts +0 -1
  274. package/dist/elements/css/checkbox.d.ts +0 -1
  275. package/dist/elements/css/chips.d.ts +0 -1
  276. package/dist/elements/css/datepicker.d.ts +0 -1
  277. package/dist/elements/css/dialog.d.ts +0 -1
  278. package/dist/elements/css/divider.d.ts +0 -1
  279. package/dist/elements/css/drawer.d.ts +0 -1
  280. package/dist/elements/css/extended-fab.d.ts +0 -1
  281. package/dist/elements/css/fab-menu.d.ts +0 -1
  282. package/dist/elements/css/fab.d.ts +0 -1
  283. package/dist/elements/css/icon-button.d.ts +0 -1
  284. package/dist/elements/css/list.d.ts +0 -1
  285. package/dist/elements/css/loading-indicator.d.ts +0 -1
  286. package/dist/elements/css/menu.d.ts +0 -1
  287. package/dist/elements/css/navigation-bar.d.ts +0 -1
  288. package/dist/elements/css/navigation-rail.d.ts +0 -1
  289. package/dist/elements/css/progress.d.ts +0 -1
  290. package/dist/elements/css/radios.d.ts +0 -1
  291. package/dist/elements/css/ripple.d.ts +0 -1
  292. package/dist/elements/css/search.d.ts +0 -1
  293. package/dist/elements/css/select.d.ts +0 -1
  294. package/dist/elements/css/side-sheet.d.ts +0 -1
  295. package/dist/elements/css/slider.d.ts +0 -1
  296. package/dist/elements/css/snackbar.d.ts +0 -1
  297. package/dist/elements/css/split-button.d.ts +0 -1
  298. package/dist/elements/css/switch.d.ts +0 -1
  299. package/dist/elements/css/tabs.d.ts +0 -1
  300. package/dist/elements/css/text-field.d.ts +0 -1
  301. package/dist/elements/css/timepicker.d.ts +0 -1
  302. package/dist/elements/css/toolbar.d.ts +0 -1
  303. package/dist/elements/css/tooltip.d.ts +0 -1
  304. package/dist/elements/css/top-app-bar.d.ts +0 -1
  305. package/dist/styles/badge.d.ts +0 -1
  306. package/dist/styles/base-lite.d.ts +0 -1
  307. package/dist/styles/base.d.ts +0 -1
  308. package/dist/styles/bottom-app-bar.d.ts +0 -1
  309. package/dist/styles/bottom-sheet.d.ts +0 -1
  310. package/dist/styles/button-group.d.ts +0 -1
  311. package/dist/styles/button.d.ts +0 -1
  312. package/dist/styles/card.d.ts +0 -1
  313. package/dist/styles/carousel.d.ts +0 -1
  314. package/dist/styles/checkbox.d.ts +0 -1
  315. package/dist/styles/chips.d.ts +0 -1
  316. package/dist/styles/contrast.d.ts +0 -1
  317. package/dist/styles/datepicker.d.ts +0 -1
  318. package/dist/styles/dialog.d.ts +0 -1
  319. package/dist/styles/divider.d.ts +0 -1
  320. package/dist/styles/drawer.d.ts +0 -1
  321. package/dist/styles/extended-fab.d.ts +0 -1
  322. package/dist/styles/fab-menu.d.ts +0 -1
  323. package/dist/styles/fab.d.ts +0 -1
  324. package/dist/styles/icon-button.d.ts +0 -1
  325. package/dist/styles/list.d.ts +0 -1
  326. package/dist/styles/loading-indicator.d.ts +0 -1
  327. package/dist/styles/menu.d.ts +0 -1
  328. package/dist/styles/navigation-bar.d.ts +0 -1
  329. package/dist/styles/navigation-rail.d.ts +0 -1
  330. package/dist/styles/progress.d.ts +0 -1
  331. package/dist/styles/radios.d.ts +0 -1
  332. package/dist/styles/search.d.ts +0 -1
  333. package/dist/styles/select.d.ts +0 -1
  334. package/dist/styles/side-sheet.d.ts +0 -1
  335. package/dist/styles/slider.d.ts +0 -1
  336. package/dist/styles/snackbar.d.ts +0 -1
  337. package/dist/styles/split-button.d.ts +0 -1
  338. package/dist/styles/switch.d.ts +0 -1
  339. package/dist/styles/tabs.d.ts +0 -1
  340. package/dist/styles/text-field.d.ts +0 -1
  341. package/dist/styles/timepicker.d.ts +0 -1
  342. package/dist/styles/toolbar.d.ts +0 -1
  343. package/dist/styles/tooltip.d.ts +0 -1
  344. package/dist/styles/top-app-bar.d.ts +0 -1
  345. package/dist/styles/typography.d.ts +0 -1
  346. package/dist/styles/utilities.d.ts +0 -1
  347. package/dist/theme/roles.js +0 -68
  348. package/dist/theme/vendor/scheme/scheme_content.js +0 -30
  349. package/dist/theme/vendor/scheme/scheme_expressive.js +0 -30
  350. package/dist/theme/vendor/scheme/scheme_fidelity.js +0 -30
  351. package/dist/theme/vendor/scheme/scheme_monochrome.js +0 -30
  352. package/dist/theme/vendor/scheme/scheme_neutral.js +0 -30
  353. package/dist/theme/vendor/scheme/scheme_tonal_spot.js +0 -30
  354. package/dist/theme/vendor/scheme/scheme_vibrant.js +0 -30
package/README.md CHANGED
@@ -94,11 +94,11 @@ What a bundler keeps, minified and gzipped (kB is 1,000 bytes), measured from th
94
94
  | `createButton` from `material`, with code splitting: the initial chunks (the progress indicator loads on demand) | 7.6 kB |
95
95
  | `createButton`, without code splitting (the progress indicator included) | 13.9 kB |
96
96
  | `createButton`, `createTextField` and `createCheckbox`, without code splitting | 20.4 kB |
97
- | Everything the root exports (`export * from 'material'`), without code splitting | 127.3 kB |
97
+ | Everything the root exports (`export * from 'material'`), without code splitting | 129.3 kB |
98
98
  | `material/styles/base` | 3.0 kB |
99
99
  | `material/styles/base-lite` | 1.6 kB |
100
- | `material/styles/base` and `material/styles/button` | 5.2 kB |
101
- | `material/styles`, the full stylesheet | 58.9 kB |
100
+ | `material/styles/base` and `material/styles/button` | 5.3 kB |
101
+ | `material/styles`, the full stylesheet | 59.2 kB |
102
102
  <!-- /sizes -->
103
103
 
104
104
  `material` publishes ESM only, so bundlers drop what you do not import. Each component's page on [md3.io/components](https://md3.io/components/) gives its size.
@@ -1,6 +1,12 @@
1
1
  import { BottomAppBarComponent, BottomAppBarConfig } from "./types.js";
2
2
  /**
3
3
  * Creates a bottom app bar component
4
+ * @deprecated Material Design 3 Expressive replaces the bottom app bar with
5
+ * the docked toolbar. Use createToolbar with
6
+ * { variant: 'docked', placement: 'bottom' } from material/components/toolbar
7
+ * instead. A centred FAB, adding a FAB after creation, a custom
8
+ * transitionDuration and a custom tag are not yet available on the docked
9
+ * toolbar. Removal is parked until Material Design v4.
4
10
  * @param config
5
11
  */
6
12
  export declare const createBottomAppBar: (config?: BottomAppBarConfig) => BottomAppBarComponent;
@@ -1,11 +1,24 @@
1
- /** FAB position constants for Bottom App Bar */
1
+ /**
2
+ * FAB position constants for Bottom App Bar
3
+ * @deprecated Material Design 3 Expressive replaces the bottom app bar with
4
+ * the docked toolbar. Use the toolbar's fabPosition: 'start' or 'end'. A
5
+ * centred FAB is not yet available on the docked toolbar.
6
+ */
2
7
  export declare const FAB_POSITIONS: {
3
8
  readonly CENTER: "center";
4
9
  readonly END: "end";
5
10
  };
6
- /** Default transition duration for show/hide animations */
11
+ /**
12
+ * Default transition duration for show/hide animations
13
+ * @deprecated The docked toolbar transitions with the motion tokens; a custom
14
+ * transition duration is not yet available on the docked toolbar.
15
+ */
7
16
  export declare const DEFAULT_TRANSITION_DURATION = 300;
8
- /** CSS class names used in the bottom app bar component */
17
+ /**
18
+ * CSS class names used in the bottom app bar component
19
+ * @deprecated The docked toolbar applies its own classes; style it with its
20
+ * parts (toolbar, bar, fab, overflow) instead.
21
+ */
9
22
  export declare const BOTTOM_APP_BAR_CLASSES: {
10
23
  readonly ROOT: "bottom-app-bar";
11
24
  readonly ACTIONS: "bottom-app-bar__actions";
@@ -1,63 +1,124 @@
1
1
  import { ElementComponent } from "../../core/compose/index.js";
2
- /** FAB position type for Bottom App Bar */
2
+ /**
3
+ * FAB position type for Bottom App Bar
4
+ * @deprecated Material Design 3 Expressive replaces the bottom app bar with
5
+ * the docked toolbar. Use the toolbar's fabPosition: 'start' or 'end'. A
6
+ * centred FAB is not yet available on the docked toolbar.
7
+ */
3
8
  export type FabPosition = 'center' | 'end';
4
- /** Configuration options for Bottom App Bar component */
9
+ /**
10
+ * Configuration options for Bottom App Bar component
11
+ * @deprecated Material Design 3 Expressive replaces the bottom app bar with
12
+ * the docked toolbar. Use ToolbarConfig with
13
+ * { variant: 'docked', placement: 'bottom' }; each option here names its
14
+ * toolbar replacement. A centred FAB, adding a FAB after creation, a custom
15
+ * transition duration and a custom tag are not yet available on the docked
16
+ * toolbar. Removal is parked until Material Design v4.
17
+ */
5
18
  export interface BottomAppBarConfig {
6
19
  /**
7
20
  * Element to use for the container
8
21
  * @default 'div'
22
+ * @deprecated The docked toolbar renders a div; a custom tag is not yet
23
+ * available on the docked toolbar.
9
24
  */
10
25
  tag?: string;
11
26
  /**
12
27
  * Whether to show FAB in the bottom bar
13
28
  * @default false
29
+ * @deprecated Pass the FAB as fab to createToolbar, or use slot="fab" on
30
+ * m-toolbar.
14
31
  */
15
32
  hasFab?: boolean;
16
33
  /**
17
34
  * FAB position in bottom bar
18
35
  * @default 'end'
36
+ * @deprecated Use the toolbar's fabPosition: 'start' or 'end'. A centred
37
+ * FAB ('center') is not yet available on the docked toolbar.
19
38
  */
20
39
  fabPosition?: FabPosition;
21
- /** Additional CSS classes to apply */
40
+ /**
41
+ * Additional CSS classes to apply
42
+ * @deprecated Use the toolbar's class option; the classes it applies are
43
+ * its own.
44
+ */
22
45
  class?: string;
23
46
  /**
24
47
  * Whether to enable auto-hide on scroll
25
48
  * @default false
49
+ * @deprecated Use scrollBehavior: 'exit' on createToolbar. Its threshold is
50
+ * set with scrollThreshold (default 40; the bottom app bar used 10), and a
51
+ * hidden toolbar is also inert.
26
52
  */
27
53
  autoHide?: boolean;
28
54
  /**
29
55
  * Transition duration for show/hide in ms
30
56
  * @default 300
57
+ * @deprecated The docked toolbar transitions with the motion tokens; a
58
+ * custom transition duration is not yet available on the docked toolbar.
31
59
  */
32
60
  transitionDuration?: number;
33
- /** Called with the new visibility when it changes. */
61
+ /**
62
+ * Called with the new visibility when it changes.
63
+ * @deprecated Listen for the toolbar's show and hide events with
64
+ * toolbar.on('show', handler) and toolbar.on('hide', handler).
65
+ */
34
66
  onVisibilityChange?: (visible: boolean) => void;
35
67
  /**
36
68
  * Component prefix for class names
37
69
  * @default 'mtrl'
70
+ * @deprecated Never took effect: the prefix is fixed at build time. The
71
+ * docked toolbar has no per-instance prefix option either.
38
72
  */
39
73
  prefix?: string;
40
- /** Component name for class generation */
74
+ /**
75
+ * Component name for class generation
76
+ * @deprecated Never took effect: the component name is fixed per component.
77
+ * The docked toolbar's name is fixed too.
78
+ */
41
79
  componentName?: string;
42
80
  }
43
- /** Bottom App Bar component interface */
81
+ /**
82
+ * Bottom App Bar component interface
83
+ * @deprecated Material Design 3 Expressive replaces the bottom app bar with
84
+ * the docked toolbar. Use ToolbarComponent from createToolbar with
85
+ * { variant: 'docked', placement: 'bottom' }; each method names its toolbar
86
+ * replacement. Removal is parked until Material Design v4.
87
+ */
44
88
  export interface BottomAppBarComponent extends ElementComponent {
45
89
  /**
46
90
  * Adds an action button to the bottom bar
47
91
  * @param button
92
+ * @deprecated Use toolbar.add(item), which returns the item's element.
48
93
  */
49
94
  addAction(button: HTMLElement): this;
50
95
  /**
51
96
  * Adds a floating action button to the bottom bar
52
97
  * @param fab
98
+ * @deprecated Pass fab to createToolbar's config. Adding a FAB after
99
+ * creation is not yet available on the docked toolbar.
53
100
  */
54
101
  addFab(fab: HTMLElement): this;
55
- /** Shows the bottom bar */
102
+ /**
103
+ * Shows the bottom bar
104
+ * @deprecated Use toolbar.show().
105
+ */
56
106
  show(): this;
57
- /** Hides the bottom bar */
107
+ /**
108
+ * Hides the bottom bar
109
+ * @deprecated Use toolbar.hide(), which also takes the toolbar out of the
110
+ * focus order with inert.
111
+ */
58
112
  hide(): this;
59
- /** Checks if the bottom bar is visible */
113
+ /**
114
+ * Checks if the bottom bar is visible
115
+ * @deprecated Use toolbar.isVisible().
116
+ */
60
117
  isVisible: () => boolean;
61
- /** Get the actions container element */
118
+ /**
119
+ * Get the actions container element
120
+ * @deprecated Use toolbar.bar (the element with the toolbar role) or
121
+ * toolbar.getItems().
122
+ */
62
123
  getActionsContainer: () => HTMLElement;
63
124
  }
@@ -17,7 +17,7 @@ merged.layer = undefined;
17
17
  }
18
18
  return merged;
19
19
  };
20
- export const getElementConfig = (config) => createElementConfig({ ...config, title: undefined }, {
20
+ export const getElementConfig = (config) => createElementConfig({ ...config, title: undefined, ariaLabel: undefined }, {
21
21
  tag: config.layer === "top" ? "dialog" : "div",
22
22
  className: [config.class].filter(Boolean),
23
23
  attributes: {
@@ -12,11 +12,15 @@ scrim = document.createElement("div");
12
12
  scrim.className = getClass(BOTTOM_SHEET_CLASSES.SCRIM);
13
13
  element.appendChild(scrim);
14
14
  }
15
+ const isTopDialog = element.localName === "dialog";
15
16
  const container = document.createElement("div");
16
17
  container.className = getClass(BOTTOM_SHEET_CLASSES.CONTAINER);
18
+ if (!isTopDialog) {
17
19
  container.setAttribute("role", isModal ? "dialog" : "region");
18
20
  if (isModal)
19
21
  container.setAttribute("aria-modal", "true");
22
+ }
23
+ const surface = isTopDialog ? element : container;
20
24
  container.tabIndex = -1;
21
25
  if (config.maxWidth) {
22
26
  container.style.maxWidth = `${config.maxWidth}px`;
@@ -42,10 +46,13 @@ title.textContent = config.title;
42
46
  title.id = `${getClass(BOTTOM_SHEET_CLASSES.TITLE)}-${Math.random()
43
47
  .toString(36)
44
48
  .slice(2, 9)}`;
45
- container.setAttribute("aria-labelledby", title.id);
49
+ surface.setAttribute("aria-labelledby", title.id);
46
50
  header.appendChild(title);
47
51
  container.appendChild(header);
48
52
  }
53
+ else if (config.ariaLabel) {
54
+ surface.setAttribute("aria-label", config.ariaLabel);
55
+ }
49
56
  const content = document.createElement("div");
50
57
  content.className = getClass(BOTTOM_SHEET_CLASSES.CONTENT);
51
58
  if (config.content instanceof HTMLElement) {
@@ -85,7 +92,8 @@ title.textContent = next;
85
92
  title.id = `${getClass(BOTTOM_SHEET_CLASSES.TITLE)}-${Math.random()
86
93
  .toString(36)
87
94
  .slice(2, 9)}`;
88
- container.setAttribute("aria-labelledby", title.id);
95
+ surface.removeAttribute("aria-label");
96
+ surface.setAttribute("aria-labelledby", title.id);
89
97
  header.appendChild(title);
90
98
  container.insertBefore(header, content);
91
99
  },
@@ -27,6 +27,8 @@ export interface BottomSheetConfig {
27
27
  variant?: BottomSheetVariant;
28
28
  /** Headline shown above the content. */
29
29
  title?: string;
30
+ /** Accessible label for assistive technology when no visible `title` headline is provided. */
31
+ ariaLabel?: string;
30
32
  /** Body of the sheet, as markup or an element */
31
33
  content?: string | HTMLElement;
32
34
  /**
@@ -159,7 +159,7 @@ const selectable = selection !== 'none';
159
159
  const button = (buttonConfig.text === undefined && buttonConfig.icon
160
160
  ? createIconButton({
161
161
  ...resolvedConfig,
162
- ariaLabel: buttonConfig.ariaLabel,
162
+ ariaLabel: buttonConfig.ariaLabel ?? buttonConfig.value,
163
163
  toggle: selectable,
164
164
  toggleOnClick: false,
165
165
  selectedIcon: buttonConfig.selectedIcon,
@@ -1,14 +1,15 @@
1
+ import { controlLabelConfig } from "../../core/config/control-label.js";
1
2
  import { createComponentConfig, createElementConfig, } from "../../core/config/component.js";
2
3
  export const defaultConfig = {
3
4
  labelPosition: "end",
4
5
  enterToggles: false,
5
6
  };
6
7
  export const createBaseConfig = (config = {}) => createComponentConfig(defaultConfig, config, "checkbox");
7
- export const getElementConfig = (config) => createElementConfig(config, {
8
+ export const getElementConfig = (config) => controlLabelConfig(createElementConfig(config, {
8
9
  tag: "div",
9
10
  className: config.class,
10
11
  interactive: true,
11
- });
12
+ }), config.controlLabelOnly);
12
13
  const SVG = "http://www.w3.org/2000/svg";
13
14
  const checkIcons = new WeakMap();
14
15
  const createCheckIcon = (doc) => {
@@ -42,6 +42,11 @@ export interface CheckboxConfig {
42
42
  error?: boolean;
43
43
  /** Accessible name when there is no visible label */
44
44
  ariaLabel?: string;
45
+ /**
46
+ * Put ariaLabel only on the input/handle, omitting the generated wrapper label.
47
+ * @default false
48
+ */
49
+ controlLabelOnly?: boolean;
45
50
  /** Whether Enter toggles as Space does. */
46
51
  enterToggles?: boolean;
47
52
  /** Additional CSS classes to apply to the checkbox */
@@ -5,7 +5,7 @@ variant: "docked", initialView: "day", selectionMode: "single",
5
5
  dateFormat: DEFAULT_DATE_FORMAT, animate: true, closeOnSelect: false,
6
6
  };
7
7
  export const createBaseConfig = (config = {}) => createComponentConfig(defaultConfig, config, "datepicker");
8
- export const getContainerConfig = (config) => createElementConfig(config, {
8
+ export const getContainerConfig = (config) => createElementConfig({ ...config, ariaLabel: undefined }, {
9
9
  tag: "div", forwardEvents: { keydown: true, click: true }, interactive: true,
10
10
  });
11
11
  export default defaultConfig;
@@ -85,10 +85,18 @@ if (settings.animate)
85
85
  dialog.classList.add(base.getClass("datepicker--animate"));
86
86
  if (state.selectionMode === "range")
87
87
  dialog.classList.add(base.getClass("datepicker--range"));
88
- if (modal)
88
+ const nameDialog = () => {
89
+ const name = settings.ariaLabel?.trim();
90
+ if (name || !modal) {
91
+ dialog.removeAttribute("aria-labelledby");
92
+ dialog.setAttribute("aria-label", name || state.label);
93
+ }
94
+ else {
95
+ dialog.removeAttribute("aria-label");
89
96
  dialog.setAttribute("aria-labelledby", `${id}-title`);
90
- else
91
- dialog.setAttribute("aria-label", state.label);
97
+ }
98
+ };
99
+ nameDialog();
92
100
  const announcement = createElement({ tag: "div", className: cls("sr-only"), attributes: { "aria-live": "polite", "aria-atomic": "true" } });
93
101
  field.append(input, trigger);
94
102
  base.element.append(label, field, help, error, dialog);
@@ -627,6 +635,7 @@ syncInput();
627
635
  return api;
628
636
  }, checkValidity, reportValidity,
629
637
  setSupportingText(text) { help.textContent = text || state.dateFormat; return api; },
638
+ setAriaLabel(label) { settings.ariaLabel = label; nameDialog(); return api; },
630
639
  clear() { clearValue(false); return api; },
631
640
  enable() { setDisabled(false); return api; }, disable() { setDisabled(true); return api; },
632
641
  setMinDate(value) {
@@ -32,7 +32,7 @@ if (list && !item.isCurrentMonth) {
32
32
  row.append(make("div", "cell", undefined, { role: "gridcell" }));
33
33
  continue;
34
34
  }
35
- const cell = make("div", "cell", undefined, { role: "gridcell", "aria-selected": String(selected || inRange) });
35
+ const cell = make("div", "cell");
36
36
  if (inRange)
37
37
  cell.classList.add(cls("cell--range"));
38
38
  if (item.isCurrentMonth && state.selectedDate && isSameDay(item.date, state.selectedDate))
@@ -42,7 +42,7 @@ cell.classList.add(cls("cell--range-end"));
42
42
  const special = state.specialDates.find(special => { const date = parseDate(special.date); return date && isSameDay(date, item.date); });
43
43
  const day = make("button", "day", String(item.day), {
44
44
  type: "button", "data-date": formatDate(item.date, "YYYY-MM-DD"), "aria-label": item.date.toLocaleDateString("en-US", { weekday: "long", year: "numeric", month: "long", day: "numeric" }),
45
- "aria-pressed": String(selected), disabled: !state.isAllowed(item.date), tabindex: current && item === focus ? "0" : "-1",
45
+ role: "gridcell", "aria-selected": String(selected || inRange), disabled: !state.isAllowed(item.date), tabindex: current && item === focus ? "0" : "-1",
46
46
  });
47
47
  if (!state.isAllowed(item.date))
48
48
  day.classList.add(cls("day--disabled"));
@@ -115,6 +115,8 @@ export interface DatePickerConfig {
115
115
  dateFormat?: string;
116
116
  /** Label text for the datepicker */
117
117
  label?: string;
118
+ /** Accessible name of the calendar dialog; defaults to the visible label. */
119
+ ariaLabel?: string;
118
120
  /** Placeholder text for the input field */
119
121
  placeholder?: string;
120
122
  /** Additional CSS classes to add to the datepicker */
@@ -238,6 +240,8 @@ export interface DatePickerComponent<V = DatePickerValue> {
238
240
  reportValidity: () => boolean;
239
241
  /** The supporting text; empty or null shows the date format */
240
242
  setSupportingText: (text: string | null) => DatePickerComponent<V>;
243
+ /** Names the calendar dialog; empty restores its visible label. */
244
+ setAriaLabel: (label: string) => DatePickerComponent<V>;
241
245
  /** Gets the formatted date string based on the selected date(s) */
242
246
  getFormattedValue: () => string;
243
247
  /** Clears the selected date(s). */
@@ -17,7 +17,8 @@ export { default as createFab } from "./fab/index.js";
17
17
  export { default as createFabMenu } from "./fab-menu/index.js";
18
18
  export { default as createExtendedFab } from "./extended-fab/index.js";
19
19
  export { default as createIconButton } from "./icon-button/index.js";
20
- export { default as createList } from "./list/index.js";
20
+ export { default as createList, withSingleSelectListbox } from "./list/index.js";
21
+ export type { SingleSelectListboxOptions } from "./list/index.js";
21
22
  export { default as createMenu } from "./menu/index.js";
22
23
  export { default as createNavigationBar } from "./navigation-bar/index.js";
23
24
  export type { NavigationBarConfig, NavigationBarComponent, NavigationBarItemConfig, NavigationBarItemLayout, NavigationBarSelectEvent, NavigationBarEvents } from "./navigation-bar/types.js";
@@ -16,7 +16,7 @@ export { default as createFab } from "./fab/index.js";
16
16
  export { default as createFabMenu } from "./fab-menu/index.js";
17
17
  export { default as createExtendedFab } from "./extended-fab/index.js";
18
18
  export { default as createIconButton } from "./icon-button/index.js";
19
- export { default as createList } from "./list/index.js";
19
+ export { default as createList, withSingleSelectListbox } from "./list/index.js";
20
20
  export { default as createMenu } from "./menu/index.js";
21
21
  export { default as createNavigationBar } from "./navigation-bar/index.js";
22
22
  export { default as createNavigationRail } from "./navigation-rail/index.js";
@@ -0,0 +1,16 @@
1
+ import type { ListComponent, ListItem } from "../types.js";
2
+ /** Options for {@link withSingleSelectListbox}. */
3
+ export interface SingleSelectListboxOptions {
4
+ /**
5
+ * Where the visual-only radio indicator sits: before the row's content (`"leading"`, the default) or after it (`"trailing"`).
6
+ * @default "leading"
7
+ */
8
+ indicator?: "leading" | "trailing";
9
+ }
10
+ /**
11
+ * Turns a created list into a single-select listbox (`role="listbox"` with `role="option"` rows, `aria-selected`, a visual-only radio, one tab stop).
12
+ * @param component
13
+ * @param options
14
+ */
15
+ export declare const withSingleSelectListbox: (component: ListComponent<ListItem>, options?: SingleSelectListboxOptions) => ListComponent<ListItem>;
16
+ export default withSingleSelectListbox;
@@ -0,0 +1,230 @@
1
+ import { LIST_EVENTS } from "../constants.js";
2
+ import { getCleanup } from "../../../core/compose/cleanup.js";
3
+ import { itemLabel } from "./anatomy.js";
4
+ const INTERACTIVE = 'button,input,select,textarea,a[href],[role=button],[role=switch],[role=checkbox],[data-list-control],[tabindex]:not([tabindex="-1"])';
5
+ export const withSingleSelectListbox = (component, options = {}) => {
6
+ const host = component;
7
+ const list = host.list;
8
+ const getClass = host.getClass;
9
+ if (!list || !getClass) {
10
+ throw new Error("[mtrl:list] needs a created list");
11
+ }
12
+ if (host.config?.multiSelect || host.config?.trackSelection === false) {
13
+ throw new Error("[mtrl:list] needs multiSelect off and trackSelection on");
14
+ }
15
+ const resources = getCleanup(host);
16
+ const indicator = options.indicator === "trailing" ? "trailing" : "leading";
17
+ const rowName = getClass("list__item");
18
+ const headlineName = getClass("list__headline");
19
+ const radio = getClass("list__radio");
20
+ let buffer = "";
21
+ let timer;
22
+ let activeId;
23
+ let focusWithin = false;
24
+ let restore = false;
25
+ const rows = () => list.getRows();
26
+ const enabled = () => rows().filter((row) => !row.item.disabled);
27
+ const isSelected = (id) => component.isItemSelected(id);
28
+ const rowOf = (event) => {
29
+ if (!(event.target instanceof Element))
30
+ return;
31
+ const element = event.target.closest(`.${rowName}`);
32
+ return rows().find((row) => row.element === element);
33
+ };
34
+ const label = (row) => (row.element.querySelector(`.${headlineName}`)?.textContent ?? itemLabel(row.item)).trim().toLowerCase();
35
+ const focusRow = (row) => row.element.focus();
36
+ const sync = () => {
37
+ const all = enabled();
38
+ const stop = all.find((row) => isSelected(row.id)) ?? all[0];
39
+ for (const row of rows()) {
40
+ row.element.setAttribute("aria-selected", String(isSelected(row.id)));
41
+ row.element.tabIndex = row === stop ? 0 : -1;
42
+ }
43
+ };
44
+ const press = (row, originalEvent) => {
45
+ if (row.item.disabled) {
46
+ originalEvent.preventDefault();
47
+ return;
48
+ }
49
+ focusRow(row);
50
+ if (isSelected(row.id))
51
+ return;
52
+ const payload = {
53
+ item: row.item,
54
+ value: row.id,
55
+ element: row.element,
56
+ originalEvent,
57
+ component: api,
58
+ defaultPrevented: false,
59
+ preventDefault() {
60
+ this.defaultPrevented = true;
61
+ },
62
+ };
63
+ host.emit?.(LIST_EVENTS.SELECT, payload);
64
+ if (payload.defaultPrevented)
65
+ return;
66
+ component.setSelection([row.id]);
67
+ sync();
68
+ };
69
+ const typeahead = (all, current, key) => {
70
+ if (timer !== undefined)
71
+ clearTimeout(timer);
72
+ buffer += key.toLowerCase();
73
+ timer = setTimeout(() => {
74
+ buffer = "";
75
+ timer = undefined;
76
+ }, 500);
77
+ const repeated = /^(.)\1*$/.test(buffer);
78
+ const needle = repeated ? buffer[0] : buffer;
79
+ const from = repeated ? current + 1 : Math.max(current, 0);
80
+ for (let step = 0; step < all.length; step += 1) {
81
+ const candidate = all[(from + step + all.length) % all.length];
82
+ if (label(candidate).startsWith(needle)) {
83
+ focusRow(candidate);
84
+ return;
85
+ }
86
+ }
87
+ };
88
+ const onClick = (event) => {
89
+ if (event.defaultPrevented)
90
+ return;
91
+ const row = rowOf(event);
92
+ if (!row)
93
+ return;
94
+ event.stopPropagation();
95
+ press(row, event);
96
+ };
97
+ const onKeydown = (event) => {
98
+ if (event.defaultPrevented || event.key === "Tab")
99
+ return;
100
+ const row = rowOf(event);
101
+ if (!row)
102
+ return;
103
+ const all = enabled();
104
+ const current = all.indexOf(row);
105
+ const go = (index) => {
106
+ event.preventDefault();
107
+ event.stopPropagation();
108
+ focusRow(all[index]);
109
+ };
110
+ const step = { ArrowDown: 1, ArrowRight: 1, ArrowUp: -1, ArrowLeft: -1 }[event.key];
111
+ if (step !== undefined) {
112
+ return go(current < 0 ? (step > 0 ? 0 : all.length - 1) : (current + step + all.length) % all.length);
113
+ }
114
+ if (event.key === "Home")
115
+ return go(0);
116
+ if (event.key === "End")
117
+ return go(all.length - 1);
118
+ if (event.key === "Enter" || (event.key === " " && !buffer)) {
119
+ event.preventDefault();
120
+ event.stopPropagation();
121
+ press(row, event);
122
+ return;
123
+ }
124
+ if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
125
+ event.preventDefault();
126
+ event.stopPropagation();
127
+ typeahead(all, current, event.key);
128
+ }
129
+ };
130
+ const onFocusIn = (event) => {
131
+ focusWithin = true;
132
+ const row = rowOf(event);
133
+ if (!row)
134
+ return;
135
+ activeId = row.id;
136
+ for (const other of rows())
137
+ other.element.tabIndex = other === row ? 0 : -1;
138
+ };
139
+ const onFocusOut = (event) => {
140
+ const next = event.relatedTarget;
141
+ if (next instanceof Node && component.element.contains(next))
142
+ return;
143
+ focusWithin = false;
144
+ sync();
145
+ if (event.target instanceof Node && !component.element.contains(event.target))
146
+ restore = true;
147
+ };
148
+ const transform = () => {
149
+ component.element.setAttribute("role", "listbox");
150
+ for (const row of rows()) {
151
+ const { element, item } = row;
152
+ if ([item.leading, item.trailing].some((slot) => slot && (slot.type === "control" || slot.type === "custom"))) {
153
+ throw new Error("[mtrl:list] options cannot contain secondary controls");
154
+ }
155
+ if (item[indicator]) {
156
+ throw new Error(`[mtrl:list] indicator "${indicator}" collides with the ${indicator} slot`);
157
+ }
158
+ const action = row.action;
159
+ const labelledby = action?.getAttribute("aria-labelledby") ?? element.querySelector(`.${headlineName}`)?.id;
160
+ const describedby = action?.getAttribute("aria-describedby");
161
+ const name = action?.getAttribute("aria-label") ?? itemLabel(item);
162
+ element.setAttribute(labelledby ? "aria-labelledby" : "aria-label", labelledby ?? (name || element.textContent || "Option"));
163
+ if (describedby)
164
+ element.setAttribute("aria-describedby", describedby);
165
+ element.setAttribute("role", "option");
166
+ if (!element.querySelector(`.${radio}`)) {
167
+ const span = document.createElement("span");
168
+ span.className = radio;
169
+ span.setAttribute("aria-hidden", "true");
170
+ if (indicator === "leading")
171
+ element.prepend(span);
172
+ else
173
+ element.append(span);
174
+ }
175
+ action?.remove();
176
+ if (row.action === action)
177
+ row.action = undefined;
178
+ if (element.querySelector(INTERACTIVE)) {
179
+ throw new Error("[mtrl:list] options cannot contain interactive descendants");
180
+ }
181
+ }
182
+ sync();
183
+ if ((focusWithin || restore) && activeId)
184
+ rows().find((row) => row.id === activeId)?.element.focus();
185
+ restore = false;
186
+ };
187
+ const api = {
188
+ ...component,
189
+ async refresh() {
190
+ await component.refresh();
191
+ return api;
192
+ },
193
+ selectItem(id) {
194
+ component.setSelection([id]);
195
+ sync();
196
+ return api;
197
+ },
198
+ deselectItem(id) {
199
+ component.deselectItem(id);
200
+ sync();
201
+ return api;
202
+ },
203
+ clearSelection() {
204
+ component.clearSelection();
205
+ sync();
206
+ return api;
207
+ },
208
+ setSelection(ids) {
209
+ component.setSelection(ids.slice(0, 1));
210
+ sync();
211
+ return api;
212
+ },
213
+ };
214
+ component.element.addEventListener("click", onClick, true);
215
+ component.element.addEventListener("keydown", onKeydown);
216
+ component.element.addEventListener("focusin", onFocusIn);
217
+ component.element.addEventListener("focusout", onFocusOut);
218
+ resources.add(() => {
219
+ component.element.removeEventListener("click", onClick, true);
220
+ component.element.removeEventListener("keydown", onKeydown);
221
+ component.element.removeEventListener("focusin", onFocusIn);
222
+ component.element.removeEventListener("focusout", onFocusOut);
223
+ if (timer !== undefined)
224
+ clearTimeout(timer);
225
+ });
226
+ resources.add(list.onRender(transform));
227
+ transform();
228
+ return api;
229
+ };
230
+ export default withSingleSelectListbox;
@@ -1,4 +1,6 @@
1
1
  /** Material list anatomy for static data. */
2
2
  export { default, default as createList } from "./list.js";
3
+ export { default as withSingleSelectListbox } from "./features/listbox.js";
4
+ export type { SingleSelectListboxOptions } from "./features/listbox.js";
3
5
  export { LIST_DEFAULTS, LIST_VARIANTS, LIST_TYPES, LIST_SELECTION_MODES, LIST_EVENTS, LIST_SCROLL_POSITIONS, LIST_CLASSES, } from "./constants.js";
4
6
  export type { ListConfig, ListVariant, ListItem, ListSlot, ListComponent, SelectEvent, LoadEvent, } from "./types.js";
@@ -1,2 +1,3 @@
1
1
  export { default, default as createList } from "./list.js";
2
+ export { default as withSingleSelectListbox } from "./features/listbox.js";
2
3
  export { LIST_DEFAULTS, LIST_VARIANTS, LIST_TYPES, LIST_SELECTION_MODES, LIST_EVENTS, LIST_SCROLL_POSITIONS, LIST_CLASSES, } from "./constants.js";