@vonage/vivid 4.12.1 → 4.14.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 (523) hide show
  1. package/custom-elements.json +7489 -4858
  2. package/elevation/index.cjs +1 -1
  3. package/elevation/index.js +1 -1
  4. package/index.cjs +70 -136
  5. package/index.d.ts +0 -1
  6. package/index.js +60 -62
  7. package/lib/accordion/accordion.d.ts +2 -2
  8. package/lib/accordion/accordion.template.d.ts +1 -2
  9. package/lib/accordion/definition.d.ts +1 -1
  10. package/lib/accordion-item/accordion-item.d.ts +2 -2
  11. package/lib/accordion-item/accordion-item.template.d.ts +2 -3
  12. package/lib/accordion-item/definition.d.ts +1 -1
  13. package/lib/action-group/action-group.d.ts +2 -2
  14. package/lib/action-group/action-group.template.d.ts +1 -3
  15. package/lib/action-group/definition.d.ts +1 -1
  16. package/lib/alert/alert.d.ts +2 -2
  17. package/lib/alert/alert.template.d.ts +2 -3
  18. package/lib/alert/definition.d.ts +1 -1
  19. package/lib/audio-player/audio-player.d.ts +2 -2
  20. package/lib/audio-player/audio-player.template.d.ts +2 -3
  21. package/lib/audio-player/definition.d.ts +1 -3
  22. package/lib/avatar/avatar.d.ts +2 -2
  23. package/lib/avatar/avatar.template.d.ts +2 -3
  24. package/lib/avatar/definition.d.ts +1 -1
  25. package/lib/badge/badge.d.ts +2 -2
  26. package/lib/badge/badge.template.d.ts +2 -3
  27. package/lib/badge/definition.d.ts +1 -3
  28. package/lib/banner/banner.d.ts +2 -2
  29. package/lib/banner/banner.template.d.ts +2 -3
  30. package/lib/banner/definition.d.ts +1 -1
  31. package/lib/breadcrumb/breadcrumb.d.ts +2 -2
  32. package/lib/breadcrumb/breadcrumb.template.d.ts +3 -4
  33. package/lib/breadcrumb/definition.d.ts +1 -1
  34. package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
  35. package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +2 -3
  36. package/lib/breadcrumb-item/definition.d.ts +1 -1
  37. package/lib/button/button.d.ts +2 -2
  38. package/lib/button/button.template.d.ts +2 -4
  39. package/lib/button/definition.d.ts +1 -1
  40. package/lib/calendar/calendar.d.ts +2 -2
  41. package/lib/calendar/calendar.template.d.ts +1 -3
  42. package/lib/calendar/definition.d.ts +1 -1
  43. package/lib/calendar-event/calendar-event.d.ts +2 -2
  44. package/lib/calendar-event/calendar-event.template.d.ts +1 -3
  45. package/lib/calendar-event/definition.d.ts +1 -1
  46. package/lib/card/card.d.ts +2 -2
  47. package/lib/card/card.template.d.ts +2 -3
  48. package/lib/card/definition.d.ts +1 -1
  49. package/lib/checkbox/checkbox.form-associated.d.ts +3 -2
  50. package/lib/checkbox/checkbox.template.d.ts +2 -3
  51. package/lib/checkbox/definition.d.ts +1 -1
  52. package/lib/combobox/combobox.d.ts +17 -2
  53. package/lib/combobox/combobox.options.d.ts +7 -0
  54. package/lib/combobox/combobox.template.d.ts +2 -3
  55. package/lib/combobox/definition.d.ts +1 -2
  56. package/lib/data-grid/data-grid-cell.d.ts +16 -13
  57. package/lib/data-grid/data-grid-cell.template.d.ts +2 -3
  58. package/lib/data-grid/data-grid-row.d.ts +19 -2
  59. package/lib/data-grid/data-grid-row.template.d.ts +2 -2
  60. package/lib/data-grid/data-grid.d.ts +45 -4
  61. package/lib/data-grid/data-grid.template.d.ts +2 -2
  62. package/lib/data-grid/definition.d.ts +1 -6
  63. package/lib/date-picker/definition.d.ts +1 -3
  64. package/lib/date-range-picker/definition.d.ts +1 -3
  65. package/lib/dial-pad/definition.d.ts +1 -3
  66. package/lib/dial-pad/dial-pad.d.ts +2 -2
  67. package/lib/dial-pad/dial-pad.template.d.ts +2 -3
  68. package/lib/dialog/definition.d.ts +1 -1
  69. package/lib/dialog/dialog.d.ts +2 -2
  70. package/lib/dialog/dialog.template.d.ts +2 -3
  71. package/lib/divider/definition.d.ts +1 -1
  72. package/lib/divider/divider.d.ts +2 -2
  73. package/lib/divider/divider.template.d.ts +1 -3
  74. package/lib/elevation/definition.d.ts +1 -1
  75. package/lib/elevation/elevation.d.ts +2 -2
  76. package/lib/elevation/elevation.template.d.ts +1 -3
  77. package/lib/empty-state/definition.d.ts +1 -3
  78. package/lib/empty-state/empty-state.d.ts +2 -2
  79. package/lib/empty-state/empty-state.template.d.ts +2 -3
  80. package/lib/fab/definition.d.ts +1 -3
  81. package/lib/fab/fab.template.d.ts +2 -3
  82. package/lib/file-picker/definition.d.ts +1 -3
  83. package/lib/file-picker/file-picker.d.ts +6 -0
  84. package/lib/file-picker/file-picker.form-associated.d.ts +3 -2
  85. package/lib/file-picker/file-picker.template.d.ts +2 -3
  86. package/lib/header/definition.d.ts +1 -3
  87. package/lib/header/header.d.ts +2 -2
  88. package/lib/header/header.template.d.ts +2 -3
  89. package/lib/icon/definition.d.ts +1 -3
  90. package/lib/icon/icon.d.ts +2 -2
  91. package/lib/icon/icon.template.d.ts +1 -3
  92. package/lib/layout/definition.d.ts +1 -3
  93. package/lib/layout/layout.d.ts +2 -2
  94. package/lib/layout/layout.template.d.ts +1 -3
  95. package/lib/listbox/definition.d.ts +1 -3
  96. package/lib/listbox/listbox.template.d.ts +1 -3
  97. package/lib/menu/definition.d.ts +1 -11
  98. package/lib/menu/menu.d.ts +16 -3
  99. package/lib/menu/menu.template.d.ts +3 -3
  100. package/lib/menu-item/definition.d.ts +1 -3
  101. package/lib/menu-item/menu-item.d.ts +10 -2
  102. package/lib/menu-item/menu-item.template.d.ts +2 -3
  103. package/lib/nav/definition.d.ts +1 -3
  104. package/lib/nav/nav.d.ts +2 -2
  105. package/lib/nav/nav.template.d.ts +1 -3
  106. package/lib/nav-disclosure/definition.d.ts +1 -3
  107. package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
  108. package/lib/nav-disclosure/nav-disclosure.template.d.ts +2 -3
  109. package/lib/nav-item/definition.d.ts +1 -3
  110. package/lib/nav-item/nav-item.template.d.ts +2 -3
  111. package/lib/note/definition.d.ts +1 -3
  112. package/lib/note/note.d.ts +2 -2
  113. package/lib/note/note.template.d.ts +2 -3
  114. package/lib/number-field/definition.d.ts +1 -4
  115. package/lib/number-field/number-field.form-associated.d.ts +3 -2
  116. package/lib/number-field/number-field.template.d.ts +2 -3
  117. package/lib/option/definition.d.ts +1 -3
  118. package/lib/option/option.d.ts +28 -7
  119. package/lib/option/option.template.d.ts +2 -3
  120. package/lib/pagination/definition.d.ts +1 -3
  121. package/lib/pagination/pagination.d.ts +2 -2
  122. package/lib/pagination/pagination.template.d.ts +2 -3
  123. package/lib/popup/definition.d.ts +1 -3
  124. package/lib/popup/popup.template.d.ts +2 -3
  125. package/lib/progress/definition.d.ts +1 -3
  126. package/lib/progress/progress.d.ts +1 -1
  127. package/lib/progress/progress.template.d.ts +1 -4
  128. package/lib/progress-ring/definition.d.ts +1 -3
  129. package/lib/progress-ring/progress-ring.d.ts +1 -1
  130. package/lib/progress-ring/progress-ring.template.d.ts +1 -3
  131. package/lib/radio/definition.d.ts +1 -3
  132. package/lib/radio/radio.form-associated.d.ts +3 -2
  133. package/lib/radio/radio.template.d.ts +1 -3
  134. package/lib/radio-group/definition.d.ts +1 -11
  135. package/lib/radio-group/radio-group.d.ts +2 -2
  136. package/lib/radio-group/radio-group.template.d.ts +2 -3
  137. package/lib/range-slider/definition.d.ts +1 -3
  138. package/lib/range-slider/range-slider.form-associated.d.ts +3 -2
  139. package/lib/range-slider/range-slider.template.d.ts +2 -3
  140. package/lib/searchable-select/definition.d.ts +1 -4
  141. package/lib/searchable-select/option-tag.template.d.ts +2 -3
  142. package/lib/searchable-select/searchable-select.form-associated.d.ts +3 -2
  143. package/lib/searchable-select/searchable-select.template.d.ts +2 -3
  144. package/lib/select/definition.d.ts +1 -3
  145. package/lib/select/select.d.ts +14 -4
  146. package/lib/select/select.form-associated.d.ts +11 -0
  147. package/lib/select/select.template.d.ts +2 -3
  148. package/lib/selectable-box/definition.d.ts +1 -3
  149. package/lib/selectable-box/selectable-box.d.ts +2 -2
  150. package/lib/selectable-box/selectable-box.template.d.ts +2 -3
  151. package/lib/side-drawer/definition.d.ts +1 -3
  152. package/lib/side-drawer/side-drawer.d.ts +2 -2
  153. package/lib/side-drawer/side-drawer.template.d.ts +1 -3
  154. package/lib/slider/definition.d.ts +1 -3
  155. package/lib/slider/slider.form-associated.d.ts +3 -2
  156. package/lib/slider/slider.template.d.ts +3 -4
  157. package/lib/split-button/definition.d.ts +1 -1
  158. package/lib/split-button/split-button.d.ts +2 -2
  159. package/lib/split-button/split-button.template.d.ts +2 -3
  160. package/lib/switch/definition.d.ts +1 -3
  161. package/lib/switch/switch.d.ts +5 -2
  162. package/lib/switch/switch.form-associated.d.ts +11 -0
  163. package/lib/switch/switch.template.d.ts +1 -3
  164. package/lib/tab/definition.d.ts +1 -3
  165. package/lib/tab/tab.d.ts +2 -2
  166. package/lib/tab/tab.template.d.ts +2 -2
  167. package/lib/tab-panel/definition.d.ts +1 -3
  168. package/lib/tab-panel/tab-panel.d.ts +2 -2
  169. package/lib/tab-panel/tab-panel.template.d.ts +1 -1
  170. package/lib/tabs/definition.d.ts +1 -3
  171. package/lib/tabs/tabs.d.ts +6 -4
  172. package/lib/tabs/tabs.template.d.ts +1 -1
  173. package/lib/tag/definition.d.ts +1 -4
  174. package/lib/tag/tag.d.ts +2 -2
  175. package/lib/tag/tag.template.d.ts +2 -3
  176. package/lib/tag-group/definition.d.ts +1 -3
  177. package/lib/tag-group/tag-group.d.ts +2 -2
  178. package/lib/tag-group/tag-group.template.d.ts +1 -3
  179. package/lib/text-anchor/definition.d.ts +1 -3
  180. package/lib/text-anchor/text-anchor.d.ts +4 -3
  181. package/lib/text-anchor/text-anchor.template.d.ts +2 -3
  182. package/lib/text-area/definition.d.ts +1 -3
  183. package/lib/text-area/text-area.d.ts +25 -3
  184. package/lib/text-area/text-area.form-associated.d.ts +11 -0
  185. package/lib/text-area/text-area.template.d.ts +2 -3
  186. package/lib/text-field/definition.d.ts +1 -3
  187. package/lib/text-field/text-field.d.ts +28 -3
  188. package/lib/text-field/text-field.form-associated.d.ts +11 -0
  189. package/lib/text-field/text-field.template.d.ts +2 -3
  190. package/lib/time-picker/definition.d.ts +1 -3
  191. package/lib/time-picker/time-picker.form-associated.d.ts +3 -2
  192. package/lib/time-picker/time-picker.template.d.ts +2 -2
  193. package/lib/toggletip/definition.d.ts +1 -3
  194. package/lib/toggletip/toggletip.d.ts +2 -2
  195. package/lib/toggletip/toggletip.template.d.ts +2 -3
  196. package/lib/tooltip/definition.d.ts +1 -3
  197. package/lib/tooltip/tooltip.d.ts +2 -2
  198. package/lib/tooltip/tooltip.template.d.ts +2 -3
  199. package/lib/tree-item/definition.d.ts +1 -3
  200. package/lib/tree-item/tree-item.d.ts +11 -2
  201. package/lib/tree-item/tree-item.template.d.ts +3 -3
  202. package/lib/tree-view/definition.d.ts +1 -3
  203. package/lib/tree-view/tree-view.d.ts +16 -2
  204. package/lib/tree-view/tree-view.template.d.ts +1 -1
  205. package/lib/video-player/definition.d.ts +1 -3
  206. package/lib/video-player/video-player.d.ts +2 -2
  207. package/lib/video-player/video-player.template.d.ts +1 -3
  208. package/listbox/index.cjs +37 -39
  209. package/listbox/index.js +37 -39
  210. package/menu/index.cjs +1 -1
  211. package/menu/index.js +1 -1
  212. package/nav/index.cjs +1 -1
  213. package/nav/index.js +1 -1
  214. package/nav-disclosure/index.cjs +1 -1
  215. package/nav-disclosure/index.js +1 -1
  216. package/nav-item/index.cjs +1 -1
  217. package/nav-item/index.js +1 -1
  218. package/note/index.cjs +1 -1
  219. package/note/index.js +1 -1
  220. package/number-field/index.cjs +1 -1
  221. package/number-field/index.js +1 -1
  222. package/option/index.cjs +1 -1
  223. package/option/index.js +1 -1
  224. package/package.json +1 -1
  225. package/pagination/index.cjs +1 -1
  226. package/pagination/index.js +1 -1
  227. package/popup/index.cjs +1 -1
  228. package/popup/index.js +1 -1
  229. package/progress/index.cjs +1 -1
  230. package/progress/index.js +1 -1
  231. package/progress-ring/index.cjs +1 -1
  232. package/progress-ring/index.js +1 -1
  233. package/radio/index.cjs +1 -1
  234. package/radio/index.js +1 -1
  235. package/radio-group/index.cjs +1 -1
  236. package/radio-group/index.js +1 -1
  237. package/range-slider/index.cjs +1 -1
  238. package/range-slider/index.js +1 -1
  239. package/searchable-select/index.cjs +1 -1
  240. package/searchable-select/index.js +1 -1
  241. package/select/index.cjs +1 -1
  242. package/select/index.js +1 -1
  243. package/selectable-box/index.cjs +1 -1
  244. package/selectable-box/index.js +1 -1
  245. package/shared/affix.cjs +10 -10
  246. package/shared/affix.js +2 -2
  247. package/shared/anchor.cjs +59 -0
  248. package/shared/anchor.js +57 -0
  249. package/shared/anchored.cjs +6 -6
  250. package/shared/anchored.js +2 -2
  251. package/shared/apply-mixins.cjs +15 -17
  252. package/shared/apply-mixins.js +15 -17
  253. package/shared/apply-mixins2.cjs +25 -0
  254. package/shared/apply-mixins2.js +23 -0
  255. package/shared/applyMixinsWithObservables.cjs +4 -4
  256. package/shared/applyMixinsWithObservables.js +2 -2
  257. package/shared/aria-global.cjs +86 -67
  258. package/shared/aria-global.js +86 -67
  259. package/shared/aria-global2.cjs +68 -86
  260. package/shared/aria-global2.js +68 -86
  261. package/shared/base-progress.cjs +70 -63
  262. package/shared/base-progress.js +69 -62
  263. package/shared/breadcrumb-item.cjs +7 -58
  264. package/shared/breadcrumb-item.js +4 -55
  265. package/shared/button.cjs +178 -0
  266. package/shared/button.js +176 -0
  267. package/shared/calendar-event.cjs +10 -9
  268. package/shared/calendar-event.js +3 -2
  269. package/shared/children.cjs +2 -2
  270. package/shared/children.js +1 -1
  271. package/shared/date-picker/date-picker-base.form-associated.d.ts +3 -2
  272. package/shared/date-picker/date-picker-base.template.d.ts +2 -3
  273. package/shared/defineVividComponent.cjs +2612 -0
  274. package/shared/defineVividComponent.js +2592 -0
  275. package/shared/definition.cjs +26 -24
  276. package/shared/definition.js +17 -14
  277. package/shared/definition10.cjs +15 -12
  278. package/shared/definition10.js +15 -11
  279. package/shared/definition11.cjs +53 -249
  280. package/shared/definition11.js +25 -219
  281. package/shared/definition12.cjs +18 -14
  282. package/shared/definition12.js +17 -12
  283. package/shared/definition13.cjs +20 -19
  284. package/shared/definition13.js +11 -9
  285. package/shared/definition14.cjs +36 -38
  286. package/shared/definition14.js +16 -17
  287. package/shared/definition15.cjs +28 -26
  288. package/shared/definition15.js +17 -14
  289. package/shared/definition16.cjs +478 -611
  290. package/shared/definition16.js +471 -603
  291. package/shared/definition17.cjs +934 -1113
  292. package/shared/definition17.js +913 -1091
  293. package/shared/definition18.cjs +16 -20
  294. package/shared/definition18.js +19 -22
  295. package/shared/definition19.cjs +26 -30
  296. package/shared/definition19.js +21 -24
  297. package/shared/definition2.cjs +20 -22
  298. package/shared/definition2.js +21 -22
  299. package/shared/definition20.cjs +53 -53
  300. package/shared/definition20.js +36 -35
  301. package/shared/definition21.cjs +43 -46
  302. package/shared/definition21.js +19 -21
  303. package/shared/definition22.cjs +16 -13
  304. package/shared/definition22.js +15 -11
  305. package/shared/definition23.cjs +22 -20
  306. package/shared/definition23.js +15 -12
  307. package/shared/definition24.cjs +20 -172
  308. package/shared/definition24.js +17 -168
  309. package/shared/definition25.cjs +48 -28
  310. package/shared/definition25.js +43 -22
  311. package/shared/definition26.cjs +17 -14
  312. package/shared/definition26.js +15 -11
  313. package/shared/definition27.cjs +265 -12
  314. package/shared/definition27.js +262 -10
  315. package/shared/definition28.cjs +19 -16
  316. package/shared/definition28.js +15 -11
  317. package/shared/definition29.cjs +478 -604
  318. package/shared/definition29.js +450 -578
  319. package/shared/definition3.cjs +21 -16
  320. package/shared/definition3.js +17 -11
  321. package/shared/definition30.cjs +100 -75
  322. package/shared/definition30.js +99 -73
  323. package/shared/definition31.cjs +24 -97
  324. package/shared/definition31.js +25 -97
  325. package/shared/definition32.cjs +10 -25
  326. package/shared/definition32.js +9 -23
  327. package/shared/definition33.cjs +53 -14
  328. package/shared/definition33.js +52 -12
  329. package/shared/definition34.cjs +641 -34
  330. package/shared/definition34.js +638 -30
  331. package/shared/definition35.cjs +205 -377
  332. package/shared/definition35.js +200 -373
  333. package/shared/definition36.cjs +204 -104
  334. package/shared/definition36.js +199 -97
  335. package/shared/definition37.cjs +79 -206
  336. package/shared/definition37.js +75 -202
  337. package/shared/definition38.cjs +50 -56
  338. package/shared/definition38.js +48 -52
  339. package/shared/definition39.cjs +260 -56
  340. package/shared/definition39.js +259 -54
  341. package/shared/definition4.cjs +33 -35
  342. package/shared/definition4.js +20 -21
  343. package/shared/definition40.cjs +112 -229
  344. package/shared/definition40.js +109 -226
  345. package/shared/definition41.cjs +627 -36
  346. package/shared/definition41.js +626 -34
  347. package/shared/definition42.cjs +975 -487
  348. package/shared/definition42.js +972 -482
  349. package/shared/definition43.cjs +725 -932
  350. package/shared/definition43.js +713 -918
  351. package/shared/definition44.cjs +116 -734
  352. package/shared/definition44.js +114 -731
  353. package/shared/definition45.cjs +93 -116
  354. package/shared/definition45.js +93 -115
  355. package/shared/definition46.cjs +469 -89
  356. package/shared/definition46.js +466 -86
  357. package/shared/definition47.cjs +119 -479
  358. package/shared/definition47.js +116 -474
  359. package/shared/definition48.cjs +114 -120
  360. package/shared/definition48.js +112 -117
  361. package/shared/definition49.cjs +18 -160
  362. package/shared/definition49.js +16 -157
  363. package/shared/definition5.cjs +48 -49
  364. package/shared/definition5.js +19 -19
  365. package/shared/definition50.cjs +112 -15
  366. package/shared/definition50.js +110 -12
  367. package/shared/definition51.cjs +847 -84
  368. package/shared/definition51.js +843 -79
  369. package/shared/definition52.cjs +31 -859
  370. package/shared/definition52.js +29 -856
  371. package/shared/definition53.cjs +126 -28
  372. package/shared/definition53.js +124 -25
  373. package/shared/definition54.cjs +268 -107
  374. package/shared/definition54.js +262 -100
  375. package/shared/definition55.cjs +63 -298
  376. package/shared/definition55.js +61 -295
  377. package/shared/definition56.cjs +799 -311
  378. package/shared/definition56.js +795 -306
  379. package/shared/definition57.cjs +108 -825
  380. package/shared/definition57.js +106 -822
  381. package/shared/definition58.cjs +74 -100
  382. package/shared/definition58.js +70 -95
  383. package/shared/definition59.cjs +181 -106
  384. package/shared/definition59.js +175 -101
  385. package/shared/definition6.cjs +23 -21
  386. package/shared/definition6.js +15 -12
  387. package/shared/definition60.cjs +273 -70
  388. package/shared/definition60.js +273 -69
  389. package/shared/definition61.cjs +66157 -271
  390. package/shared/definition61.js +66156 -269
  391. package/shared/definition62.cjs +36 -66174
  392. package/shared/definition62.js +33 -66171
  393. package/shared/definition63.cjs +2154 -27
  394. package/shared/definition63.js +2151 -25
  395. package/shared/definition7.cjs +19 -15
  396. package/shared/definition7.js +14 -10
  397. package/shared/definition8.cjs +26 -27
  398. package/shared/definition8.js +17 -17
  399. package/shared/definition9.cjs +21 -21
  400. package/shared/definition9.js +18 -17
  401. package/shared/design-system/createRegisterFunction.d.ts +2 -0
  402. package/shared/design-system/defineVividComponent.d.ts +15 -0
  403. package/shared/direction.cjs +10 -1
  404. package/shared/direction.js +10 -1
  405. package/shared/dom.cjs +0 -13
  406. package/shared/dom.js +1 -13
  407. package/shared/form-associated.cjs +422 -457
  408. package/shared/form-associated.js +422 -457
  409. package/shared/form-associated2.cjs +383 -0
  410. package/shared/form-associated2.js +381 -0
  411. package/shared/form-elements.cjs +15 -42
  412. package/shared/form-elements.js +2 -29
  413. package/shared/foundation/anchor/anchor.d.ts +1 -0
  414. package/shared/foundation/button/button.d.ts +3 -2
  415. package/shared/foundation/button/button.template.d.ts +2 -4
  416. package/shared/foundation/form-associated/form-associated.d.ts +51 -0
  417. package/shared/foundation/listbox/listbox.d.ts +22 -0
  418. package/shared/foundation/progress/base-progress.d.ts +9 -0
  419. package/shared/foundation/utilities/apply-mixins.d.ts +1 -0
  420. package/shared/foundation/vivid-element/vivid-element.d.ts +3 -0
  421. package/shared/foundation-element.cjs +1417 -0
  422. package/shared/foundation-element.js +1414 -0
  423. package/shared/index.cjs +7 -5097
  424. package/shared/index.js +7 -5079
  425. package/shared/key-codes.cjs +10 -0
  426. package/shared/key-codes.js +6 -1
  427. package/shared/key-codes2.cjs +50 -6
  428. package/shared/key-codes2.js +50 -4
  429. package/shared/listbox.cjs +409 -981
  430. package/shared/listbox.js +410 -979
  431. package/shared/listbox2.cjs +1268 -0
  432. package/shared/listbox2.js +1265 -0
  433. package/shared/localized.cjs +2 -2
  434. package/shared/localized.js +1 -1
  435. package/shared/numbers.cjs +12 -0
  436. package/shared/numbers.js +12 -1
  437. package/shared/patterns/affix.d.ts +2 -2
  438. package/shared/patterns/chevron.d.ts +2 -2
  439. package/shared/patterns/form-elements/form-elements.d.ts +2 -2
  440. package/shared/presentationDate.cjs +56 -55
  441. package/shared/presentationDate.js +8 -7
  442. package/shared/ref.cjs +2 -2
  443. package/shared/ref.js +1 -1
  444. package/shared/repeat.cjs +22 -22
  445. package/shared/repeat.js +1 -1
  446. package/shared/slider.template.cjs +5 -5
  447. package/shared/slider.template.js +2 -2
  448. package/shared/slotted.cjs +4 -4
  449. package/shared/slotted.js +1 -1
  450. package/shared/strings.cjs +0 -26
  451. package/shared/strings.js +1 -25
  452. package/shared/strings2.cjs +37 -0
  453. package/shared/strings2.js +33 -0
  454. package/shared/text-anchor.cjs +8 -89
  455. package/shared/text-anchor.js +5 -86
  456. package/shared/text-anchor.template.cjs +2 -2
  457. package/shared/text-anchor.template.js +1 -1
  458. package/shared/text-field2.cjs +539 -194
  459. package/shared/text-field2.js +539 -194
  460. package/shared/vivid-element.cjs +8 -0
  461. package/shared/vivid-element.js +6 -0
  462. package/side-drawer/index.cjs +1 -1
  463. package/side-drawer/index.js +1 -1
  464. package/slider/index.cjs +1 -1
  465. package/slider/index.js +1 -1
  466. package/split-button/index.cjs +1 -1
  467. package/split-button/index.js +1 -1
  468. package/styles/core/all.css +21 -1
  469. package/styles/core/theme.css +21 -1
  470. package/styles/core/typography.css +1 -1
  471. package/styles/tokens/theme-dark.css +4 -4
  472. package/styles/tokens/theme-light.css +4 -4
  473. package/styles/tokens/vivid-2-compat.css +1 -1
  474. package/switch/index.cjs +1 -1
  475. package/switch/index.js +1 -1
  476. package/tab/index.cjs +1 -1
  477. package/tab/index.js +1 -1
  478. package/tab-panel/index.cjs +1 -1
  479. package/tab-panel/index.js +1 -1
  480. package/tabs/index.cjs +1 -1
  481. package/tabs/index.js +1 -1
  482. package/tag/index.cjs +1 -1
  483. package/tag/index.js +1 -1
  484. package/tag-group/index.cjs +1 -1
  485. package/tag-group/index.js +1 -1
  486. package/text-anchor/index.cjs +10 -7
  487. package/text-anchor/index.js +10 -7
  488. package/text-area/index.cjs +1 -1
  489. package/text-area/index.js +1 -1
  490. package/text-field/index.cjs +1 -1
  491. package/text-field/index.js +1 -1
  492. package/time-picker/index.cjs +1 -1
  493. package/time-picker/index.js +1 -1
  494. package/toggletip/index.cjs +1 -1
  495. package/toggletip/index.js +1 -1
  496. package/tooltip/index.cjs +1 -1
  497. package/tooltip/index.js +1 -1
  498. package/tree-item/index.cjs +1 -1
  499. package/tree-item/index.js +1 -1
  500. package/tree-view/index.cjs +1 -1
  501. package/tree-view/index.js +1 -1
  502. package/video-player/index.cjs +1 -1
  503. package/video-player/index.js +1 -1
  504. package/vivid.api.json +2848 -7818
  505. package/shared/Reflector.cjs +0 -71
  506. package/shared/Reflector.js +0 -69
  507. package/shared/definition64.cjs +0 -2164
  508. package/shared/definition64.js +0 -2159
  509. package/shared/design-system/index.d.ts +0 -3
  510. package/shared/icon.cjs +0 -261
  511. package/shared/icon.js +0 -258
  512. package/shared/index2.cjs +0 -11
  513. package/shared/index2.js +0 -9
  514. package/shared/listbox-option.cjs +0 -204
  515. package/shared/listbox-option.js +0 -201
  516. package/shared/radio.cjs +0 -126
  517. package/shared/radio.js +0 -124
  518. package/shared/select.options.cjs +0 -12
  519. package/shared/select.options.js +0 -10
  520. package/shared/start-end.cjs +0 -52
  521. package/shared/start-end.js +0 -50
  522. package/shared/tree-item.cjs +0 -154
  523. package/shared/tree-item.js +0 -151
package/shared/listbox.js CHANGED
@@ -1,10 +1,10 @@
1
- import { e as keyArrowLeft, f as keyArrowRight } from './key-codes.js';
2
- import { F as FoundationElement, O as Observable, _ as __decorate, a as attr, o as observable, D as DOM, n as nullableNumberConverter } from './index.js';
3
- import { i as isListboxOption } from './listbox-option.js';
1
+ import { i as isListboxOption } from './definition35.js';
2
+ import { V as VividElement } from './vivid-element.js';
3
+ import { a as keySpace, b as keyEscape, k as keyEnter, c as keyTab, d as keyEnd, e as keyArrowUp, f as keyArrowDown, g as keyHome } from './key-codes.js';
4
+ import { u as uniqueId } from './strings.js';
5
+ import { O as Observable, a as attr, o as observable } from './defineVividComponent.js';
6
+ import { a as applyMixins } from './apply-mixins2.js';
4
7
  import { A as ARIAGlobalStatesAndProperties } from './aria-global.js';
5
- import { a as applyMixins } from './apply-mixins.js';
6
- import { a as keySpace, b as keyEscape, k as keyEnter, c as keyTab, d as keyEnd, e as keyArrowUp, f as keyArrowDown, g as keyHome } from './key-codes2.js';
7
- import { u as uniqueId, i as inRange } from './strings.js';
8
8
 
9
9
  /**
10
10
  * Returns the index of the last element in the array where predicate is true, and -1 otherwise.
@@ -22,1043 +22,474 @@ function findLastIndex(array, predicate) {
22
22
  return -1;
23
23
  }
24
24
 
25
- /**
26
- * A Listbox Custom HTML Element.
27
- * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#listbox | ARIA listbox }.
28
- *
29
- * @slot - The default slot for the listbox options
30
- *
31
- * @public
32
- */
33
- let Listbox$1 = class Listbox extends FoundationElement {
34
- constructor() {
35
- super(...arguments);
36
- /**
37
- * The internal unfiltered list of selectable options.
38
- *
39
- * @internal
40
- */
41
- this._options = [];
42
- /**
43
- * The index of the selected option.
44
- *
45
- * @public
46
- */
47
- this.selectedIndex = -1;
48
- /**
49
- * A collection of the selected options.
50
- *
51
- * @public
52
- */
53
- this.selectedOptions = [];
54
- /**
55
- * A standard `click` event creates a `focus` event before firing, so a
56
- * `mousedown` event is used to skip that initial focus.
57
- *
58
- * @internal
59
- */
60
- this.shouldSkipFocus = false;
61
- /**
62
- * The current typeahead buffer string.
63
- *
64
- * @internal
65
- */
66
- this.typeaheadBuffer = "";
67
- /**
68
- * Flag for the typeahead timeout expiration.
69
- *
70
- * @internal
71
- */
72
- this.typeaheadExpired = true;
73
- /**
74
- * The timeout ID for the typeahead handler.
75
- *
76
- * @internal
77
- */
78
- this.typeaheadTimeout = -1;
79
- }
25
+ var __defProp = Object.defineProperty;
26
+ var __decorateClass = (decorators, target, key, kind) => {
27
+ var result = void 0 ;
28
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
29
+ if (decorator = decorators[i])
30
+ result = (decorator(target, key, result) ) || result;
31
+ if (result) __defProp(target, key, result);
32
+ return result;
33
+ };
34
+ const _Listbox = class _Listbox extends VividElement {
35
+ constructor() {
36
+ super(...arguments);
80
37
  /**
81
- * The first selected option.
38
+ * The internal unfiltered list of selectable options.
82
39
  *
83
40
  * @internal
84
41
  */
85
- get firstSelectedOption() {
86
- var _a;
87
- return (_a = this.selectedOptions[0]) !== null && _a !== void 0 ? _a : null;
88
- }
42
+ this._options = [];
43
+ this.selectedIndex = -1;
44
+ this.selectedOptions = [];
89
45
  /**
90
- * Returns true if there is one or more selectable option.
46
+ * A standard `click` event creates a `focus` event before firing, so a
47
+ * `mousedown` event is used to skip that initial focus.
91
48
  *
92
49
  * @internal
93
50
  */
94
- get hasSelectableOptions() {
95
- return this.options.length > 0 && !this.options.every(o => o.disabled);
96
- }
97
- /**
98
- * The number of options.
99
- *
100
- * @public
101
- */
102
- get length() {
103
- var _a, _b;
104
- return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
105
- }
106
- /**
107
- * The list of options.
108
- *
109
- * @public
110
- */
111
- get options() {
112
- Observable.track(this, "options");
113
- return this._options;
114
- }
115
- set options(value) {
116
- this._options = value;
117
- Observable.notify(this, "options");
118
- }
51
+ this.shouldSkipFocus = false;
52
+ this.typeaheadBuffer = "";
119
53
  /**
120
54
  * Flag for the typeahead timeout expiration.
121
55
  *
122
- * @deprecated use `Listbox.typeaheadExpired`
123
- * @internal
124
- */
125
- get typeAheadExpired() {
126
- return this.typeaheadExpired;
127
- }
128
- set typeAheadExpired(value) {
129
- this.typeaheadExpired = value;
130
- }
131
- /**
132
- * Handle click events for listbox options.
133
- *
134
- * @internal
135
- */
136
- clickHandler(e) {
137
- const captured = e.target.closest(`option,[role=option]`);
138
- if (captured && !captured.disabled) {
139
- this.selectedIndex = this.options.indexOf(captured);
140
- return true;
141
- }
142
- }
143
- /**
144
- * Ensures that the provided option is focused and scrolled into view.
145
- *
146
- * @param optionToFocus - The option to focus
147
- * @internal
148
- */
149
- focusAndScrollOptionIntoView(optionToFocus = this.firstSelectedOption) {
150
- // To ensure that the browser handles both `focus()` and `scrollIntoView()`, the
151
- // timing here needs to guarantee that they happen on different frames. Since this
152
- // function is typically called from the `openChanged` observer, `DOM.queueUpdate`
153
- // causes the calls to be grouped into the same frame. To prevent this,
154
- // `requestAnimationFrame` is used instead of `DOM.queueUpdate`.
155
- if (this.contains(document.activeElement) && optionToFocus !== null) {
156
- optionToFocus.focus();
157
- requestAnimationFrame(() => {
158
- optionToFocus.scrollIntoView({ block: "nearest" });
159
- });
160
- }
161
- }
162
- /**
163
- * Handles `focusin` actions for the component. When the component receives focus,
164
- * the list of selected options is refreshed and the first selected option is scrolled
165
- * into view.
166
- *
167
- * @internal
168
- */
169
- focusinHandler(e) {
170
- if (!this.shouldSkipFocus && e.target === e.currentTarget) {
171
- this.setSelectedOptions();
172
- this.focusAndScrollOptionIntoView();
173
- }
174
- this.shouldSkipFocus = false;
175
- }
176
- /**
177
- * Returns the options which match the current typeahead buffer.
178
- *
179
- * @internal
180
- */
181
- getTypeaheadMatches() {
182
- const pattern = this.typeaheadBuffer.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
183
- const re = new RegExp(`^${pattern}`, "gi");
184
- return this.options.filter((o) => o.text.trim().match(re));
185
- }
186
- /**
187
- * Determines the index of the next option which is selectable, if any.
188
- *
189
- * @param prev - the previous selected index
190
- * @param next - the next index to select
191
- *
192
- * @internal
193
- */
194
- getSelectableIndex(prev = this.selectedIndex, next) {
195
- const direction = prev > next ? -1 : prev < next ? 1 : 0;
196
- const potentialDirection = prev + direction;
197
- let nextSelectableOption = null;
198
- switch (direction) {
199
- case -1: {
200
- nextSelectableOption = this.options.reduceRight((nextSelectableOption, thisOption, index) => !nextSelectableOption &&
201
- !thisOption.disabled &&
202
- index < potentialDirection
203
- ? thisOption
204
- : nextSelectableOption, nextSelectableOption);
205
- break;
206
- }
207
- case 1: {
208
- nextSelectableOption = this.options.reduce((nextSelectableOption, thisOption, index) => !nextSelectableOption &&
209
- !thisOption.disabled &&
210
- index > potentialDirection
211
- ? thisOption
212
- : nextSelectableOption, nextSelectableOption);
213
- break;
214
- }
215
- }
216
- return this.options.indexOf(nextSelectableOption);
217
- }
218
- /**
219
- * Handles external changes to child options.
220
- *
221
- * @param source - the source object
222
- * @param propertyName - the property
223
- *
224
- * @internal
225
- */
226
- handleChange(source, propertyName) {
227
- switch (propertyName) {
228
- case "selected": {
229
- if (Listbox.slottedOptionFilter(source)) {
230
- this.selectedIndex = this.options.indexOf(source);
231
- }
232
- this.setSelectedOptions();
233
- break;
234
- }
235
- }
236
- }
237
- /**
238
- * Moves focus to an option whose label matches characters typed by the user.
239
- * Consecutive keystrokes are batched into a buffer of search text used
240
- * to match against the set of options. If `TYPE_AHEAD_TIMEOUT_MS` passes
241
- * between consecutive keystrokes, the search restarts.
242
- *
243
- * @param key - the key to be evaluated
244
- *
245
- * @internal
246
- */
247
- handleTypeAhead(key) {
248
- if (this.typeaheadTimeout) {
249
- window.clearTimeout(this.typeaheadTimeout);
250
- }
251
- this.typeaheadTimeout = window.setTimeout(() => (this.typeaheadExpired = true), Listbox.TYPE_AHEAD_TIMEOUT_MS);
252
- if (key.length > 1) {
253
- return;
254
- }
255
- this.typeaheadBuffer = `${this.typeaheadExpired ? "" : this.typeaheadBuffer}${key}`;
256
- }
257
- /**
258
- * Handles `keydown` actions for listbox navigation and typeahead.
259
- *
260
- * @internal
261
- */
262
- keydownHandler(e) {
263
- if (this.disabled) {
264
- return true;
265
- }
266
- this.shouldSkipFocus = false;
267
- const key = e.key;
268
- switch (key) {
269
- // Select the first available option
270
- case keyHome: {
271
- if (!e.shiftKey) {
272
- e.preventDefault();
273
- this.selectFirstOption();
274
- }
275
- break;
276
- }
277
- // Select the next selectable option
278
- case keyArrowDown: {
279
- if (!e.shiftKey) {
280
- e.preventDefault();
281
- this.selectNextOption();
282
- }
283
- break;
284
- }
285
- // Select the previous selectable option
286
- case keyArrowUp: {
287
- if (!e.shiftKey) {
288
- e.preventDefault();
289
- this.selectPreviousOption();
290
- }
291
- break;
292
- }
293
- // Select the last available option
294
- case keyEnd: {
295
- e.preventDefault();
296
- this.selectLastOption();
297
- break;
298
- }
299
- case keyTab: {
300
- this.focusAndScrollOptionIntoView();
301
- return true;
302
- }
303
- case keyEnter:
304
- case keyEscape: {
305
- return true;
306
- }
307
- case keySpace: {
308
- if (this.typeaheadExpired) {
309
- return true;
310
- }
311
- }
312
- // Send key to Typeahead handler
313
- default: {
314
- if (key.length === 1) {
315
- this.handleTypeAhead(`${key}`);
316
- }
317
- return true;
318
- }
319
- }
320
- }
321
- /**
322
- * Prevents `focusin` events from firing before `click` events when the
323
- * element is unfocused.
324
- *
325
- * @internal
326
- */
327
- mousedownHandler(e) {
328
- this.shouldSkipFocus = !this.contains(document.activeElement);
329
- return true;
330
- }
331
- /**
332
- * Switches between single-selection and multi-selection mode.
333
- *
334
- * @param prev - the previous value of the `multiple` attribute
335
- * @param next - the next value of the `multiple` attribute
336
- *
337
- * @internal
338
- */
339
- multipleChanged(prev, next) {
340
- this.ariaMultiSelectable = next ? "true" : null;
341
- }
342
- /**
343
- * Updates the list of selected options when the `selectedIndex` changes.
344
- *
345
- * @param prev - the previous selected index value
346
- * @param next - the current selected index value
347
- *
348
- * @internal
349
- */
350
- selectedIndexChanged(prev, next) {
351
- var _a;
352
- if (!this.hasSelectableOptions) {
353
- this.selectedIndex = -1;
354
- return;
355
- }
356
- if (((_a = this.options[this.selectedIndex]) === null || _a === void 0 ? void 0 : _a.disabled) && typeof prev === "number") {
357
- const selectableIndex = this.getSelectableIndex(prev, next);
358
- const newNext = selectableIndex > -1 ? selectableIndex : prev;
359
- this.selectedIndex = newNext;
360
- if (next === newNext) {
361
- this.selectedIndexChanged(next, newNext);
362
- }
363
- return;
364
- }
365
- this.setSelectedOptions();
366
- }
367
- /**
368
- * Updates the selectedness of each option when the list of selected options changes.
369
- *
370
- * @param prev - the previous list of selected options
371
- * @param next - the current list of selected options
372
- *
373
56
  * @internal
374
57
  */
375
- selectedOptionsChanged(prev, next) {
376
- var _a;
377
- const filteredNext = next.filter(Listbox.slottedOptionFilter);
378
- (_a = this.options) === null || _a === void 0 ? void 0 : _a.forEach(o => {
379
- const notifier = Observable.getNotifier(o);
380
- notifier.unsubscribe(this, "selected");
381
- o.selected = filteredNext.includes(o);
382
- notifier.subscribe(this, "selected");
383
- });
384
- }
385
- /**
386
- * Moves focus to the first selectable option.
387
- *
388
- * @public
389
- */
390
- selectFirstOption() {
391
- var _a, _b;
392
- if (!this.disabled) {
393
- this.selectedIndex = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.findIndex(o => !o.disabled)) !== null && _b !== void 0 ? _b : -1;
394
- }
395
- }
396
- /**
397
- * Moves focus to the last selectable option.
398
- *
399
- * @internal
400
- */
401
- selectLastOption() {
402
- if (!this.disabled) {
403
- this.selectedIndex = findLastIndex(this.options, o => !o.disabled);
404
- }
405
- }
58
+ this.typeaheadExpired = true;
406
59
  /**
407
- * Moves focus to the next selectable option.
60
+ * The timeout ID for the typeahead handler.
408
61
  *
409
62
  * @internal
410
63
  */
411
- selectNextOption() {
412
- if (!this.disabled && this.selectedIndex < this.options.length - 1) {
413
- this.selectedIndex += 1;
414
- }
415
- }
416
- /**
417
- * Moves focus to the previous selectable option.
418
- *
419
- * @internal
420
- */
421
- selectPreviousOption() {
422
- if (!this.disabled && this.selectedIndex > 0) {
423
- this.selectedIndex = this.selectedIndex - 1;
424
- }
425
- }
426
- /**
427
- * Updates the selected index to match the first selected option.
428
- *
429
- * @internal
430
- */
431
- setDefaultSelectedOption() {
432
- var _a, _b;
433
- this.selectedIndex = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.findIndex(el => el.defaultSelected)) !== null && _b !== void 0 ? _b : -1;
434
- }
64
+ this.typeaheadTimeout = -1;
65
+ }
66
+ /**
67
+ * The first selected option.
68
+ *
69
+ * @internal
70
+ */
71
+ get firstSelectedOption() {
72
+ return this.selectedOptions[0] ?? null;
73
+ }
74
+ /**
75
+ * Returns true if there is one or more selectable option.
76
+ *
77
+ * @internal
78
+ */
79
+ get hasSelectableOptions() {
80
+ return this.options.length > 0 && !this.options.every((o) => o.disabled);
81
+ }
82
+ /**
83
+ * The number of options.
84
+ *
85
+ * @public
86
+ */
87
+ get length() {
88
+ return this.options.length;
89
+ }
90
+ /**
91
+ * The list of options.
92
+ *
93
+ * @public
94
+ */
95
+ get options() {
96
+ Observable.track(this, "options");
97
+ return this._options;
98
+ }
99
+ set options(value) {
100
+ this._options = value;
101
+ Observable.notify(this, "options");
102
+ }
103
+ static {
435
104
  /**
436
- * Sets an option as selected and gives it focus.
105
+ * A static filter to include only selectable options.
437
106
  *
107
+ * @param n - element to filter
438
108
  * @public
439
109
  */
440
- setSelectedOptions() {
441
- var _a, _b, _c;
442
- if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) {
443
- this.selectedOptions = [this.options[this.selectedIndex]];
444
- this.ariaActiveDescendant = (_c = (_b = this.firstSelectedOption) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : "";
445
- this.focusAndScrollOptionIntoView();
446
- }
447
- }
448
- /**
449
- * Updates the list of options and resets the selected option when the slotted option content changes.
450
- *
451
- * @param prev - the previous list of slotted options
452
- * @param next - the current list of slotted options
453
- *
454
- * @internal
455
- */
456
- slottedOptionsChanged(prev, next) {
457
- this.options = next.reduce((options, item) => {
458
- if (isListboxOption(item)) {
459
- options.push(item);
460
- }
461
- return options;
462
- }, []);
463
- const setSize = `${this.options.length}`;
464
- this.options.forEach((option, index) => {
465
- if (!option.id) {
466
- option.id = uniqueId("option-");
467
- }
468
- option.ariaPosInSet = `${index + 1}`;
469
- option.ariaSetSize = setSize;
470
- });
471
- if (this.$fastController.isConnected) {
472
- this.setSelectedOptions();
473
- this.setDefaultSelectedOption();
474
- }
475
- }
476
- /**
477
- * Updates the filtered list of options when the typeahead buffer changes.
478
- *
479
- * @param prev - the previous typeahead buffer value
480
- * @param next - the current typeahead buffer value
481
- *
482
- * @internal
483
- */
484
- typeaheadBufferChanged(prev, next) {
485
- if (this.$fastController.isConnected) {
486
- const typeaheadMatches = this.getTypeaheadMatches();
487
- if (typeaheadMatches.length) {
488
- const selectedIndex = this.options.indexOf(typeaheadMatches[0]);
489
- if (selectedIndex > -1) {
490
- this.selectedIndex = selectedIndex;
491
- }
492
- }
493
- this.typeaheadExpired = false;
494
- }
495
- }
496
- };
497
- /**
498
- * A static filter to include only selectable options.
499
- *
500
- * @param n - element to filter
501
- * @public
502
- */
503
- Listbox$1.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden;
504
- /**
505
- * Typeahead timeout in milliseconds.
506
- *
507
- * @internal
508
- */
509
- Listbox$1.TYPE_AHEAD_TIMEOUT_MS = 1000;
510
- __decorate([
511
- attr({ mode: "boolean" })
512
- ], Listbox$1.prototype, "disabled", void 0);
513
- __decorate([
514
- observable
515
- ], Listbox$1.prototype, "selectedIndex", void 0);
516
- __decorate([
517
- observable
518
- ], Listbox$1.prototype, "selectedOptions", void 0);
519
- __decorate([
520
- observable
521
- ], Listbox$1.prototype, "slottedOptions", void 0);
522
- __decorate([
523
- observable
524
- ], Listbox$1.prototype, "typeaheadBuffer", void 0);
525
- /**
526
- * Includes ARIA states and properties relating to the ARIA listbox role
527
- *
528
- * @public
529
- */
530
- class DelegatesARIAListbox {
531
- }
532
- __decorate([
533
- observable
534
- ], DelegatesARIAListbox.prototype, "ariaActiveDescendant", void 0);
535
- __decorate([
536
- observable
537
- ], DelegatesARIAListbox.prototype, "ariaDisabled", void 0);
538
- __decorate([
539
- observable
540
- ], DelegatesARIAListbox.prototype, "ariaExpanded", void 0);
541
- __decorate([
542
- observable
543
- ], DelegatesARIAListbox.prototype, "ariaMultiSelectable", void 0);
544
- applyMixins(DelegatesARIAListbox, ARIAGlobalStatesAndProperties);
545
- applyMixins(Listbox$1, DelegatesARIAListbox);
546
-
547
- /**
548
- * A Listbox Custom HTML Element.
549
- * Implements the {@link https://w3c.github.io/aria/#listbox | ARIA listbox }.
550
- *
551
- * @public
552
- */
553
- class ListboxElement extends Listbox$1 {
554
- constructor() {
555
- super(...arguments);
556
- /**
557
- * The index of the most recently checked option.
558
- *
559
- * @internal
560
- * @remarks
561
- * Multiple-selection mode only.
562
- */
563
- this.activeIndex = -1;
564
- /**
565
- * The start index when checking a range of options.
566
- *
567
- * @internal
568
- */
569
- this.rangeStartIndex = -1;
570
- }
571
- /**
572
- * Returns the last checked option.
573
- *
574
- * @internal
575
- */
576
- get activeOption() {
577
- return this.options[this.activeIndex];
578
- }
579
- /**
580
- * Returns the list of checked options.
581
- *
582
- * @internal
583
- */
584
- get checkedOptions() {
585
- var _a;
586
- return (_a = this.options) === null || _a === void 0 ? void 0 : _a.filter(o => o.checked);
587
- }
588
- /**
589
- * Returns the index of the first selected option.
590
- *
591
- * @internal
592
- */
593
- get firstSelectedOptionIndex() {
594
- return this.options.indexOf(this.firstSelectedOption);
595
- }
596
- /**
597
- * Updates the `ariaActiveDescendant` property when the active index changes.
598
- *
599
- * @param prev - the previous active index
600
- * @param next - the next active index
601
- *
602
- * @internal
603
- */
604
- activeIndexChanged(prev, next) {
605
- var _a, _b;
606
- this.ariaActiveDescendant = (_b = (_a = this.options[next]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : "";
607
- this.focusAndScrollOptionIntoView();
608
- }
609
- /**
610
- * Toggles the checked state for the currently active option.
611
- *
612
- * @remarks
613
- * Multiple-selection mode only.
614
- *
615
- * @internal
616
- */
617
- checkActiveIndex() {
618
- if (!this.multiple) {
619
- return;
620
- }
621
- const activeItem = this.activeOption;
622
- if (activeItem) {
623
- activeItem.checked = true;
624
- }
625
- }
626
- /**
627
- * Sets the active index to the first option and marks it as checked.
628
- *
629
- * @remarks
630
- * Multi-selection mode only.
631
- *
632
- * @param preserveChecked - mark all options unchecked before changing the active index
633
- *
634
- * @internal
635
- */
636
- checkFirstOption(preserveChecked = false) {
637
- if (preserveChecked) {
638
- if (this.rangeStartIndex === -1) {
639
- this.rangeStartIndex = this.activeIndex + 1;
640
- }
641
- this.options.forEach((o, i) => {
642
- o.checked = inRange(i, this.rangeStartIndex);
643
- });
644
- }
645
- else {
646
- this.uncheckAllOptions();
647
- }
648
- this.activeIndex = 0;
649
- this.checkActiveIndex();
650
- }
651
- /**
652
- * Decrements the active index and sets the matching option as checked.
653
- *
654
- * @remarks
655
- * Multi-selection mode only.
656
- *
657
- * @param preserveChecked - mark all options unchecked before changing the active index
658
- *
659
- * @internal
660
- */
661
- checkLastOption(preserveChecked = false) {
662
- if (preserveChecked) {
663
- if (this.rangeStartIndex === -1) {
664
- this.rangeStartIndex = this.activeIndex;
665
- }
666
- this.options.forEach((o, i) => {
667
- o.checked = inRange(i, this.rangeStartIndex, this.options.length);
668
- });
669
- }
670
- else {
671
- this.uncheckAllOptions();
672
- }
673
- this.activeIndex = this.options.length - 1;
674
- this.checkActiveIndex();
675
- }
676
- /**
677
- * @override
678
- * @internal
679
- */
680
- connectedCallback() {
681
- super.connectedCallback();
682
- this.addEventListener("focusout", this.focusoutHandler);
683
- }
684
- /**
685
- * @override
686
- * @internal
687
- */
688
- disconnectedCallback() {
689
- this.removeEventListener("focusout", this.focusoutHandler);
690
- super.disconnectedCallback();
691
- }
692
- /**
693
- * Increments the active index and marks the matching option as checked.
694
- *
695
- * @remarks
696
- * Multiple-selection mode only.
697
- *
698
- * @param preserveChecked - mark all options unchecked before changing the active index
699
- *
700
- * @internal
701
- */
702
- checkNextOption(preserveChecked = false) {
703
- if (preserveChecked) {
704
- if (this.rangeStartIndex === -1) {
705
- this.rangeStartIndex = this.activeIndex;
706
- }
707
- this.options.forEach((o, i) => {
708
- o.checked = inRange(i, this.rangeStartIndex, this.activeIndex + 1);
709
- });
710
- }
711
- else {
712
- this.uncheckAllOptions();
713
- }
714
- this.activeIndex += this.activeIndex < this.options.length - 1 ? 1 : 0;
715
- this.checkActiveIndex();
716
- }
717
- /**
718
- * Decrements the active index and marks the matching option as checked.
719
- *
720
- * @remarks
721
- * Multiple-selection mode only.
722
- *
723
- * @param preserveChecked - mark all options unchecked before changing the active index
724
- *
725
- * @internal
726
- */
727
- checkPreviousOption(preserveChecked = false) {
728
- if (preserveChecked) {
729
- if (this.rangeStartIndex === -1) {
730
- this.rangeStartIndex = this.activeIndex;
731
- }
732
- if (this.checkedOptions.length === 1) {
733
- this.rangeStartIndex += 1;
734
- }
735
- this.options.forEach((o, i) => {
736
- o.checked = inRange(i, this.activeIndex, this.rangeStartIndex);
737
- });
738
- }
739
- else {
740
- this.uncheckAllOptions();
741
- }
742
- this.activeIndex -= this.activeIndex > 0 ? 1 : 0;
743
- this.checkActiveIndex();
744
- }
745
- /**
746
- * Handles click events for listbox options.
747
- *
748
- * @param e - the event object
749
- *
750
- * @override
751
- * @internal
752
- */
753
- clickHandler(e) {
754
- var _a;
755
- if (!this.multiple) {
756
- return super.clickHandler(e);
757
- }
758
- const captured = (_a = e.target) === null || _a === void 0 ? void 0 : _a.closest(`[role=option]`);
759
- if (!captured || captured.disabled) {
760
- return;
761
- }
762
- this.uncheckAllOptions();
763
- this.activeIndex = this.options.indexOf(captured);
764
- this.checkActiveIndex();
765
- this.toggleSelectedForAllCheckedOptions();
766
- return true;
767
- }
768
- /**
769
- * @override
770
- * @internal
771
- */
772
- focusAndScrollOptionIntoView() {
773
- super.focusAndScrollOptionIntoView(this.activeOption);
774
- }
775
- /**
776
- * In multiple-selection mode:
777
- * If any options are selected, the first selected option is checked when
778
- * the listbox receives focus. If no options are selected, the first
779
- * selectable option is checked.
780
- *
781
- * @override
782
- * @internal
783
- */
784
- focusinHandler(e) {
785
- if (!this.multiple) {
786
- return super.focusinHandler(e);
787
- }
788
- if (!this.shouldSkipFocus && e.target === e.currentTarget) {
789
- this.uncheckAllOptions();
790
- if (this.activeIndex === -1) {
791
- this.activeIndex =
792
- this.firstSelectedOptionIndex !== -1
793
- ? this.firstSelectedOptionIndex
794
- : 0;
795
- }
796
- this.checkActiveIndex();
797
- this.setSelectedOptions();
798
- this.focusAndScrollOptionIntoView();
799
- }
800
- this.shouldSkipFocus = false;
801
- }
802
- /**
803
- * Unchecks all options when the listbox loses focus.
804
- *
805
- * @internal
806
- */
807
- focusoutHandler(e) {
808
- if (this.multiple) {
809
- this.uncheckAllOptions();
810
- }
811
- }
110
+ this.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden;
111
+ }
112
+ static {
812
113
  /**
813
- * Handles keydown actions for listbox navigation and typeahead
114
+ * Typeahead timeout in milliseconds.
814
115
  *
815
- * @override
816
116
  * @internal
817
117
  */
818
- keydownHandler(e) {
819
- if (!this.multiple) {
820
- return super.keydownHandler(e);
821
- }
822
- if (this.disabled) {
823
- return true;
824
- }
825
- const { key, shiftKey } = e;
826
- this.shouldSkipFocus = false;
827
- switch (key) {
828
- // Select the first available option
829
- case keyHome: {
830
- this.checkFirstOption(shiftKey);
831
- return;
832
- }
833
- // Select the next selectable option
834
- case keyArrowDown: {
835
- this.checkNextOption(shiftKey);
836
- return;
837
- }
838
- // Select the previous selectable option
839
- case keyArrowUp: {
840
- this.checkPreviousOption(shiftKey);
841
- return;
842
- }
843
- // Select the last available option
844
- case keyEnd: {
845
- this.checkLastOption(shiftKey);
846
- return;
847
- }
848
- case keyTab: {
849
- this.focusAndScrollOptionIntoView();
850
- return true;
851
- }
852
- case keyEscape: {
853
- this.uncheckAllOptions();
854
- this.checkActiveIndex();
855
- return true;
856
- }
857
- case keySpace: {
858
- e.preventDefault();
859
- if (this.typeAheadExpired) {
860
- this.toggleSelectedForAllCheckedOptions();
861
- return;
862
- }
863
- }
864
- // Send key to Typeahead handler
865
- default: {
866
- if (key.length === 1) {
867
- this.handleTypeAhead(`${key}`);
868
- }
869
- return true;
870
- }
871
- }
118
+ this.TYPE_AHEAD_TIMEOUT_MS = 1e3;
119
+ }
120
+ /**
121
+ * Handle click events for listbox options.
122
+ *
123
+ * @internal
124
+ */
125
+ clickHandler(e) {
126
+ const captured = e.target.closest(
127
+ `option,[role=option]`
128
+ );
129
+ if (captured && !captured.disabled) {
130
+ this.selectedIndex = this.options.indexOf(captured);
131
+ return true;
872
132
  }
873
- /**
874
- * Prevents `focusin` events from firing before `click` events when the
875
- * element is unfocused.
876
- *
877
- * @override
878
- * @internal
879
- */
880
- mousedownHandler(e) {
881
- if (e.offsetX >= 0 && e.offsetX <= this.scrollWidth) {
882
- return super.mousedownHandler(e);
883
- }
133
+ }
134
+ /**
135
+ * Ensures that the provided option is focused and scrolled into view.
136
+ *
137
+ * @param optionToFocus - The option to focus
138
+ * @internal
139
+ */
140
+ focusAndScrollOptionIntoView(optionToFocus = this.firstSelectedOption) {
141
+ if (this.contains(document.activeElement) && optionToFocus !== null) {
142
+ optionToFocus.focus();
143
+ requestAnimationFrame(() => {
144
+ optionToFocus.scrollIntoView({ block: "nearest" });
145
+ });
884
146
  }
885
- /**
886
- * Switches between single-selection and multi-selection mode.
887
- *
888
- * @internal
889
- */
890
- multipleChanged(prev, next) {
891
- var _a;
892
- this.ariaMultiSelectable = next ? "true" : null;
893
- (_a = this.options) === null || _a === void 0 ? void 0 : _a.forEach(o => {
894
- o.checked = next ? false : undefined;
895
- });
896
- this.setSelectedOptions();
147
+ }
148
+ /**
149
+ * Handles `focusin` actions for the component. When the component receives focus,
150
+ * the list of selected options is refreshed and the first selected option is scrolled
151
+ * into view.
152
+ *
153
+ * @internal
154
+ */
155
+ focusinHandler(e) {
156
+ if (!this.shouldSkipFocus && e.target === e.currentTarget) {
157
+ this.setSelectedOptions();
158
+ this.focusAndScrollOptionIntoView();
897
159
  }
898
- /**
899
- * Sets an option as selected and gives it focus.
900
- *
901
- * @override
902
- * @public
903
- */
904
- setSelectedOptions() {
905
- if (!this.multiple) {
906
- super.setSelectedOptions();
907
- return;
908
- }
909
- if (this.$fastController.isConnected && this.options) {
910
- this.selectedOptions = this.options.filter(o => o.selected);
911
- this.focusAndScrollOptionIntoView();
912
- }
160
+ this.shouldSkipFocus = false;
161
+ }
162
+ /**
163
+ * Returns the options which match the current typeahead buffer.
164
+ *
165
+ * @internal
166
+ */
167
+ getTypeaheadMatches() {
168
+ const pattern = this.typeaheadBuffer.replace(
169
+ /[.*+\-?^${}()|[\]\\]/g,
170
+ "\\$&"
171
+ );
172
+ const re = new RegExp(`^${pattern}`, "gi");
173
+ return this.options.filter((o) => o.text.trim().match(re));
174
+ }
175
+ /**
176
+ * Determines the index of the next option which is selectable, if any.
177
+ *
178
+ * @param prev - the previous selected index
179
+ * @param next - the next index to select
180
+ *
181
+ * @internal
182
+ */
183
+ getSelectableIndex(prev, next) {
184
+ const direction = prev > next ? -1 : 1;
185
+ const potentialDirection = prev + direction;
186
+ let nextSelectableOption = null;
187
+ switch (direction) {
188
+ case -1: {
189
+ nextSelectableOption = this.options.reduceRight(
190
+ (nextSelectableOption2, thisOption, index) => !nextSelectableOption2 && !thisOption.disabled && index < potentialDirection ? thisOption : nextSelectableOption2,
191
+ nextSelectableOption
192
+ );
193
+ break;
194
+ }
195
+ case 1: {
196
+ nextSelectableOption = this.options.reduce(
197
+ (nextSelectableOption2, thisOption, index) => !nextSelectableOption2 && !thisOption.disabled && index > potentialDirection ? thisOption : nextSelectableOption2,
198
+ nextSelectableOption
199
+ );
200
+ break;
201
+ }
913
202
  }
914
- /**
915
- * Ensures the size is a positive integer when the property is updated.
916
- *
917
- * @param prev - the previous size value
918
- * @param next - the current size value
919
- *
920
- * @internal
921
- */
922
- sizeChanged(prev, next) {
923
- var _a;
924
- const size = Math.max(0, parseInt((_a = next === null || next === void 0 ? void 0 : next.toFixed()) !== null && _a !== void 0 ? _a : "", 10));
925
- if (size !== next) {
926
- DOM.queueUpdate(() => {
927
- this.size = size;
928
- });
203
+ return this.options.indexOf(nextSelectableOption);
204
+ }
205
+ /**
206
+ * Handles external changes to child options.
207
+ *
208
+ * @param source - the source object
209
+ * @param propertyName - the property
210
+ *
211
+ * @internal
212
+ */
213
+ handleChange(source, propertyName) {
214
+ switch (propertyName) {
215
+ case "selected": {
216
+ if (_Listbox.slottedOptionFilter(source)) {
217
+ this.selectedIndex = this.options.indexOf(source);
929
218
  }
930
- }
931
- /**
932
- * Toggles the selected state of the provided options. If any provided items
933
- * are in an unselected state, all items are set to selected. If every
934
- * provided item is selected, they are all unselected.
935
- *
936
- * @internal
937
- */
938
- toggleSelectedForAllCheckedOptions() {
939
- const enabledCheckedOptions = this.checkedOptions.filter(o => !o.disabled);
940
- const force = !enabledCheckedOptions.every(o => o.selected);
941
- enabledCheckedOptions.forEach(o => (o.selected = force));
942
- this.selectedIndex = this.options.indexOf(enabledCheckedOptions[enabledCheckedOptions.length - 1]);
943
219
  this.setSelectedOptions();
944
- }
945
- /**
946
- * @override
947
- * @internal
948
- */
949
- typeaheadBufferChanged(prev, next) {
950
- if (!this.multiple) {
951
- super.typeaheadBufferChanged(prev, next);
952
- return;
953
- }
954
- if (this.$fastController.isConnected) {
955
- const typeaheadMatches = this.getTypeaheadMatches();
956
- const activeIndex = this.options.indexOf(typeaheadMatches[0]);
957
- if (activeIndex > -1) {
958
- this.activeIndex = activeIndex;
959
- this.uncheckAllOptions();
960
- this.checkActiveIndex();
961
- }
962
- this.typeAheadExpired = false;
963
- }
964
- }
965
- /**
966
- * Unchecks all options.
967
- *
968
- * @remarks
969
- * Multiple-selection mode only.
970
- *
971
- * @param preserveChecked - reset the rangeStartIndex
972
- *
973
- * @internal
974
- */
975
- uncheckAllOptions(preserveChecked = false) {
976
- this.options.forEach(o => (o.checked = this.multiple ? false : undefined));
977
- if (!preserveChecked) {
978
- this.rangeStartIndex = -1;
979
- }
980
- }
981
- }
982
- __decorate([
983
- observable
984
- ], ListboxElement.prototype, "activeIndex", void 0);
985
- __decorate([
986
- attr({ mode: "boolean" })
987
- ], ListboxElement.prototype, "multiple", void 0);
988
- __decorate([
989
- attr({ converter: nullableNumberConverter })
990
- ], ListboxElement.prototype, "size", void 0);
991
-
992
- var __defProp = Object.defineProperty;
993
- var __decorateClass = (decorators, target, key, kind) => {
994
- var result = void 0 ;
995
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
996
- if (decorator = decorators[i])
997
- result = (decorator(target, key, result) ) || result;
998
- if (result) __defProp(target, key, result);
999
- return result;
1000
- };
1001
- class Listbox extends ListboxElement {
1002
- orientationChanged() {
1003
- if (this.orientation === "horizontal") {
1004
- this.addEventListener("keydown", this.#horizontalKeydownHandler);
1005
- } else {
1006
- this.removeEventListener("keydown", this.#horizontalKeydownHandler);
220
+ break;
221
+ }
1007
222
  }
1008
223
  }
1009
224
  /**
1010
- * Handles `keydown` actions for horizontal listbox navigation and typeahead.
225
+ * Moves focus to an option whose label matches characters typed by the user.
226
+ * Consecutive keystrokes are batched into a buffer of search text used
227
+ * to match against the set of options. If `TYPE_AHEAD_TIMEOUT_MS` passes
228
+ * between consecutive keystrokes, the search restarts.
229
+ *
230
+ * @param key - the key to be evaluated
1011
231
  *
1012
232
  * @internal
1013
233
  */
1014
- #horizontalKeydownHandler(e) {
234
+ handleTypeAhead(key) {
235
+ if (this.typeaheadTimeout) {
236
+ window.clearTimeout(this.typeaheadTimeout);
237
+ }
238
+ this.typeaheadTimeout = window.setTimeout(
239
+ () => this.typeaheadExpired = true,
240
+ _Listbox.TYPE_AHEAD_TIMEOUT_MS
241
+ );
242
+ this.typeaheadBuffer = `${this.typeaheadExpired ? "" : this.typeaheadBuffer}${key}`;
243
+ }
244
+ /**
245
+ * Handles `keydown` actions for listbox navigation and typeahead.
246
+ *
247
+ * @internal
248
+ */
249
+ keydownHandler(e) {
1015
250
  if (this.disabled) {
1016
251
  return true;
1017
252
  }
253
+ this.shouldSkipFocus = false;
1018
254
  const key = e.key;
1019
255
  switch (key) {
1020
- case keyArrowRight: {
256
+ case keyHome: {
257
+ if (!e.shiftKey) {
258
+ e.preventDefault();
259
+ this.selectFirstOption();
260
+ }
261
+ break;
262
+ }
263
+ case keyArrowDown: {
1021
264
  if (!e.shiftKey) {
1022
265
  e.preventDefault();
1023
266
  this.selectNextOption();
1024
267
  }
1025
268
  break;
1026
269
  }
1027
- case keyArrowLeft: {
270
+ case keyArrowUp: {
1028
271
  if (!e.shiftKey) {
1029
272
  e.preventDefault();
1030
273
  this.selectPreviousOption();
1031
274
  }
1032
275
  break;
1033
276
  }
277
+ case keyEnd: {
278
+ e.preventDefault();
279
+ this.selectLastOption();
280
+ break;
281
+ }
282
+ case keyTab: {
283
+ this.focusAndScrollOptionIntoView();
284
+ return true;
285
+ }
286
+ case keyEnter:
287
+ case keyEscape:
288
+ return true;
289
+ case keySpace:
290
+ if (this.typeaheadExpired) {
291
+ return true;
292
+ }
293
+ default: {
294
+ if (key.length === 1) {
295
+ this.handleTypeAhead(`${key}`);
296
+ }
297
+ return true;
298
+ }
1034
299
  }
1035
300
  }
1036
- slottedOptionsChanged(prev, next) {
1037
- super.slottedOptionsChanged(prev, next);
1038
- this.#disableSlottedChildren();
301
+ /**
302
+ * Prevents `focusin` events from firing before `click` events when the
303
+ * element is unfocused.
304
+ *
305
+ * @internal
306
+ */
307
+ mousedownHandler(_) {
308
+ this.shouldSkipFocus = !this.contains(document.activeElement);
309
+ return true;
310
+ }
311
+ /**
312
+ * Switches between single-selection and multi-selection mode.
313
+ *
314
+ * @internal
315
+ */
316
+ multipleChanged(_, next) {
317
+ this.ariaMultiSelectable = next ? "true" : null;
1039
318
  }
1040
- attributeChangedCallback(name, oldValue, newValue) {
1041
- super.attributeChangedCallback(name, oldValue, newValue);
1042
- if (name === "disabled") {
1043
- this.#disableSlottedChildren();
319
+ /**
320
+ * Updates the list of selected options when the `selectedIndex` changes.
321
+ *
322
+ * @param prev - the previous selected index value
323
+ * @param next - the current selected index value
324
+ *
325
+ * @internal
326
+ */
327
+ selectedIndexChanged(prev, next) {
328
+ if (!this.hasSelectableOptions) {
329
+ this.selectedIndex = -1;
330
+ return;
331
+ }
332
+ if (this.options[this.selectedIndex]?.disabled && typeof prev === "number") {
333
+ const selectableIndex = this.getSelectableIndex(prev, next);
334
+ const newNext = selectableIndex > -1 ? selectableIndex : prev;
335
+ this.selectedIndex = newNext;
336
+ return;
337
+ }
338
+ this.setSelectedOptions();
339
+ }
340
+ /**
341
+ * Updates the selectedness of each option when the list of selected options changes.
342
+ *
343
+ * @internal
344
+ */
345
+ selectedOptionsChanged(_, next) {
346
+ const filteredNext = next.filter(_Listbox.slottedOptionFilter);
347
+ this.options.forEach((o) => {
348
+ const notifier = Observable.getNotifier(o);
349
+ notifier.unsubscribe(this, "selected");
350
+ o.selected = filteredNext.includes(o);
351
+ notifier.subscribe(this, "selected");
352
+ });
353
+ }
354
+ /**
355
+ * Moves focus to the first selectable option.
356
+ *
357
+ * @public
358
+ */
359
+ selectFirstOption() {
360
+ if (!this.disabled) {
361
+ this.selectedIndex = this.options.findIndex((o) => !o.disabled);
362
+ }
363
+ }
364
+ /**
365
+ * Moves focus to the last selectable option.
366
+ *
367
+ * @internal
368
+ */
369
+ selectLastOption() {
370
+ if (!this.disabled) {
371
+ this.selectedIndex = findLastIndex(this.options, (o) => !o.disabled);
372
+ }
373
+ }
374
+ /**
375
+ * Moves focus to the next selectable option.
376
+ *
377
+ * @internal
378
+ */
379
+ selectNextOption() {
380
+ if (!this.disabled && this.selectedIndex < this.options.length - 1) {
381
+ this.selectedIndex += 1;
1044
382
  }
1045
383
  }
1046
- #disableSlottedChildren() {
1047
- this.options.forEach((optionElement) => {
1048
- if (!optionElement.disabled) {
1049
- optionElement.disabled = this.disabled;
384
+ /**
385
+ * Moves focus to the previous selectable option.
386
+ *
387
+ * @internal
388
+ */
389
+ selectPreviousOption() {
390
+ if (!this.disabled && this.selectedIndex > 0) {
391
+ this.selectedIndex = this.selectedIndex - 1;
392
+ }
393
+ }
394
+ /**
395
+ * Updates the selected index to match the first selected option.
396
+ *
397
+ * @internal
398
+ */
399
+ setDefaultSelectedOption() {
400
+ this.selectedIndex = this.options.findIndex((el) => el.defaultSelected);
401
+ }
402
+ /**
403
+ * Sets an option as selected and gives it focus.
404
+ *
405
+ * @public
406
+ */
407
+ setSelectedOptions() {
408
+ if (this.options.length) {
409
+ this.selectedOptions = [this.options[this.selectedIndex]];
410
+ this.ariaActiveDescendant = this.firstSelectedOption?.id ?? "";
411
+ this.focusAndScrollOptionIntoView();
412
+ }
413
+ }
414
+ /**
415
+ * Updates the list of options and resets the selected option when the slotted option content changes.
416
+ *
417
+ * @internal
418
+ */
419
+ slottedOptionsChanged(_, next) {
420
+ this.options = next.reduce((options, item) => {
421
+ if (isListboxOption(item)) {
422
+ options.push(item);
1050
423
  }
424
+ return options;
425
+ }, []);
426
+ const setSize = `${this.options.length}`;
427
+ this.options.forEach((option, index) => {
428
+ if (!option.id) {
429
+ option.id = uniqueId("option-");
430
+ }
431
+ option.ariaPosInSet = `${index + 1}`;
432
+ option.ariaSetSize = setSize;
1051
433
  });
434
+ if (this.$fastController.isConnected) {
435
+ this.setSelectedOptions();
436
+ this.setDefaultSelectedOption();
437
+ }
1052
438
  }
439
+ /**
440
+ * Updates the filtered list of options when the typeahead buffer changes.
441
+ *
442
+ * @internal
443
+ */
444
+ typeaheadBufferChanged(_prev, _next) {
445
+ if (this.$fastController.isConnected) {
446
+ const typeaheadMatches = this.getTypeaheadMatches();
447
+ if (typeaheadMatches.length) {
448
+ const selectedIndex = this.options.indexOf(typeaheadMatches[0]);
449
+ if (selectedIndex > -1) {
450
+ this.selectedIndex = selectedIndex;
451
+ }
452
+ }
453
+ this.typeaheadExpired = false;
454
+ }
455
+ }
456
+ };
457
+ // @ts-expect-error Type is incorrectly non-optional
458
+ __decorateClass([
459
+ attr({ mode: "boolean" })
460
+ ], _Listbox.prototype, "disabled");
461
+ __decorateClass([
462
+ observable
463
+ ], _Listbox.prototype, "selectedIndex");
464
+ __decorateClass([
465
+ observable
466
+ ], _Listbox.prototype, "selectedOptions");
467
+ __decorateClass([
468
+ observable
469
+ ], _Listbox.prototype, "slottedOptions");
470
+ __decorateClass([
471
+ observable
472
+ ], _Listbox.prototype, "typeaheadBuffer");
473
+ let Listbox = _Listbox;
474
+ class DelegatesARIAListbox {
1053
475
  }
476
+ // @ts-expect-error Type is incorrectly non-optional
477
+ __decorateClass([
478
+ observable
479
+ ], DelegatesARIAListbox.prototype, "ariaActiveDescendant");
480
+ // @ts-expect-error Type is incorrectly non-optional
1054
481
  __decorateClass([
1055
- attr
1056
- ], Listbox.prototype, "appearance");
482
+ observable
483
+ ], DelegatesARIAListbox.prototype, "ariaDisabled");
484
+ // @ts-expect-error Type is incorrectly non-optional
1057
485
  __decorateClass([
1058
- attr
1059
- ], Listbox.prototype, "orientation");
486
+ observable
487
+ ], DelegatesARIAListbox.prototype, "ariaExpanded");
488
+ // @ts-expect-error Type is incorrectly non-optional
1060
489
  __decorateClass([
1061
- attr
1062
- ], Listbox.prototype, "shape");
490
+ observable
491
+ ], DelegatesARIAListbox.prototype, "ariaMultiSelectable");
492
+ applyMixins(DelegatesARIAListbox, ARIAGlobalStatesAndProperties);
493
+ applyMixins(Listbox, DelegatesARIAListbox);
1063
494
 
1064
- export { DelegatesARIAListbox as D, ListboxElement as L, Listbox as a, Listbox$1 as b };
495
+ export { Listbox as L };