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