@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,1128 +1,921 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index.cjs');
4
- const definition$1 = require('./definition11.cjs');
5
- const definition = require('./definition64.cjs');
6
- const definition$2 = require('./definition27.cjs');
3
+ const definition = require('./definition63.cjs');
4
+ const definition$3 = require('./definition27.cjs');
5
+ const definition$1 = require('./definition35.cjs');
6
+ const defineVividComponent = require('./defineVividComponent.cjs');
7
+ const listbox$1 = require('./listbox2.cjs');
7
8
  const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
8
- const scrollIntoView = require('./scrollIntoView.cjs');
9
- const formAssociated = require('./form-associated.cjs');
10
- const affix = require('./affix.cjs');
11
- const formElements = require('./form-elements.cjs');
12
- const localized = require('./localized.cjs');
13
9
  const listbox = require('./listbox.cjs');
14
- const applyMixins = require('./apply-mixins.cjs');
15
- const when = require('./when.cjs');
10
+ const formAssociated = require('./form-associated2.cjs');
11
+ const numbers = require('./numbers.cjs');
12
+ const strings = require('./strings.cjs');
13
+ const keyCodes = require('./key-codes.cjs');
14
+ const formElements = require('./form-elements.cjs');
15
+ const affix = require('./affix.cjs');
16
+ const definition$2 = require('./definition11.cjs');
17
+ const index = require('./index.cjs');
16
18
  const ref = require('./ref.cjs');
19
+ const when = require('./when.cjs');
17
20
  const slotted = require('./slotted.cjs');
18
- const repeat = require('./repeat.cjs');
19
21
  const classNames = require('./class-names.cjs');
20
- const icon = require('./icon.cjs');
21
22
 
22
- const styles = ".chevron{display:flex;flex-shrink:0;font:var(--vvd-typography-base-extended);transform:rotate(0);transition:transform .2s}:host([aria-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{display:inline-block;inline-size:300px;--_low-ink-color: var(--vvd-color-neutral-600)}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.control-wrapper{display:flex;flex-direction:column;gap:4px}.label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.fieldset{--_connotation-color-primary: var(--vvd-searchable-select-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-searchable-select-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-searchable-select-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-searchable-select-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-faint: var(--vvd-searchable-select-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-searchable-select-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-searchable-select-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-searchable-select-accent-fierce, var(--vvd-color-neutral-700))}.fieldset{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.fieldset.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.fieldset:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.fieldset:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.fieldset:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.fieldset:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.fieldset:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.fieldset:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.fieldset:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.fieldset{display:flex;align-items:center;justify-content:space-between;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:8px;padding-block:8px;padding-inline:16px;transition:box-shadow .2s,background-color .2s}.fieldset:focus-within{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}:host(:not([shape=pill])) .fieldset{border-radius:8px}:host([shape=pill]) .fieldset{border-radius:24px}.popup-wrapper{position:relative}.content-area{display:flex;overflow:hidden;flex:1;flex-direction:column;gap:8px;min-block-size:24px}.tag-row{display:flex;gap:8px;inline-size:100%}.tag-row.contains-only-input:not(:focus-within){display:contents}.tag-wrapper{overflow:hidden}.tag{max-inline-size:100%}input{box-sizing:border-box;flex:1;border:none;background:none;block-size:24px;font:var(--vvd-typography-base);max-inline-size:100%;min-inline-size:100px;outline:none}.contains-only-input input:not(:focus){position:absolute;block-size:0;inline-size:0;min-inline-size:0;opacity:0;pointer-events:none}.listbox{display:flex;flex-direction:column;padding:4px;gap:2px;max-block-size:var(--searchable-select-height, 408px);overflow-y:auto}.empty-message{display:flex;align-items:center;justify-content:center;color:var(--vvd-color-neutral-300);min-block-size:40px;text-align:center}::part(popup-base){inline-size:max-content;min-inline-size:100%}slot[name=icon]{font-size:20px}.visually-hidden{position:absolute;overflow:hidden;width:1px;height:1px;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}";
23
+ const styles = ".chevron{display:flex;flex-shrink:0;font:var(--vvd-typography-base-extended);transform:rotate(0);transition:transform .2s}:host([aria-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{display:inline-flex;flex-direction:column;gap:4px;--_low-ink-color: var(--vvd-color-neutral-600);--focus-stroke-gap-color: transparent}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);contain:inline-size;font:var(--vvd-typography-base)}.control{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.control.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.control:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.control:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.control:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.control:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.control:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.control:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.control{--_connotation-color-primary: var(--vvd-select-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-select-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-select-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-select-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-faint: var(--vvd-select-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-select-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-select-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-select-accent-fierce, var(--vvd-color-neutral-700))}.control{border-radius:var(--_select-control-border-radius);block-size:var(--_select-block-size);padding-inline:var(--_select-padding-inline)}.control{--_select-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_select-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_select-padding-inline: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;display:flex;align-items:center;justify-content:space-between;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:8px;transition:box-shadow .2s,background-color .2s}.control.size-condensed{--_select-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_select-block-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_select-padding-inline: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) }.control-wrapper{position:relative}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.control:not(.shape-pill){--_select-control-border-radius: 8px}.control.shape-pill{--_select-control-border-radius: 24px}:host(:focus-visible) .control{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}.listbox{display:flex;max-height:var(--select-height, 408px);flex-direction:column;padding:4px;gap:2px;overflow-y:auto}:host([multiple]:focus-visible) .listbox{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));border-radius:8px}.selected-value{display:flex;overflow:hidden;flex-grow:1;align-items:center;column-gap:12px;white-space:nowrap}.selected-value .text{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis}.control.shows-placeholder .selected-value .text{color:var(--vvd-color-neutral-600)}.selected-value slot[name=icon]{flex:0 0 var(--_select-icon-size);font-size:var(--_select-icon-size);line-height:1}.control.has-meta .selected-value{padding-inline-end:8px}.feedback-wrapper{display:contents}::part(popup-base){inline-size:max-content;min-inline-size:var(--_select-fixed-width, 100%)}:host([multiple]) ::part(popup-base){position:static}";
23
24
 
24
- const optionTagStyles = ".base{--_connotation-color-contrast: var(--vvd-option-tag-accent-contrast, var(--vvd-color-neutral-800))}.base{position:relative;display:inline-flex;box-sizing:border-box;align-items:center;background-color:var(--fill-color);block-size:calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2)));box-shadow:inset 0 0 0 1px var(--outline-color);color:var(--text-color);column-gap:8px;font:var(--vvd-typography-base-bold);max-inline-size:100%;padding-inline:8px;user-select:none;vertical-align:middle}.base:not(.disabled){--text-color: var(--_connotation-color-contrast);--fill-color: color-mix( in srgb, var(--_connotation-color-contrast), transparent 87.5% );--outline-color: transparent}.base.disabled{--text-color: var(--vvd-color-neutral-300);--fill-color: color-mix( in srgb, var(--vvd-color-neutral-800), transparent 87.5% );--outline-color: transparent}.base:not(.shape-pill){border-radius:4px}.base.shape-pill{border-radius:16px}.label{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis;white-space:nowrap}slot[name=icon]{font-size:calc(calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2))) / 1.5);line-height:1}.icon-placeholder{inline-size:calc(calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2))) / 1.5)}.remove-button{display:flex;align-items:center;border-radius:inherit;cursor:pointer;outline:none}.disabled .remove-button{pointer-events:none}.remove-button:focus-visible:before{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));position:absolute;z-index:1;display:block;border-radius:inherit;content:\"\";inset:0;pointer-events:none}";
25
-
26
- class _SearchableSelect extends index.FoundationElement {
25
+ class _Select extends listbox.Listbox {
27
26
  }
28
- class FormAssociatedSearchableSelect extends formAssociated.FormAssociated(
29
- _SearchableSelect
30
- ) {
27
+ class FormAssociatedSelect extends formAssociated.FormAssociated(_Select) {
31
28
  constructor() {
32
29
  super(...arguments);
33
- this.proxy = document.createElement("input");
30
+ this.proxy = document.createElement("select");
34
31
  }
35
32
  }
36
33
 
37
- var __defProp$1 = Object.defineProperty;
34
+ var __defProp = Object.defineProperty;
38
35
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
39
- var __typeError = (msg) => {
40
- throw TypeError(msg);
41
- };
42
- var __decorateClass$1 = (decorators, target, key, kind) => {
36
+ var __decorateClass = (decorators, target, key, kind) => {
43
37
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
44
38
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
45
39
  if (decorator = decorators[i])
46
40
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
47
- if (kind && result) __defProp$1(target, key, result);
41
+ if (kind && result) __defProp(target, key, result);
48
42
  return result;
49
43
  };
50
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
51
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
52
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
53
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
54
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
55
- var _SearchableSelect_instances, updateValuesThroughUserInteraction_fn, updateValuesWhileMaintainingOrder_fn, isValidValue_fn, _slottedOptionsChangeHandler, updateSelectedOnSlottedOptions_fn, handleOptionInteraction_fn, _clonedTagIcons, tagIconOfOption_fn, updateClonedTagIconOfOption_fn, _suppressFilter, updateFilteredOptions_fn, transitionHighlightedOptionTo_fn, selectHighlightedOption_fn, highlightFirstOption_fn, highlightLastOption_fn, highlightPrevPage_fn, highlightNextPage_fn, highlightPreviousOption_fn, highlightNextOption_fn, textForValue_fn, measureTagWidth_fn, updateTagLayout_fn, moveTagFocusTo_fn, nextTagIndexLeft_fn, nextTagIndexRight_fn, nextTagIndexForRemoved_fn, determineInitialValues_fn, updateFormValue_fn, _resizeObserver;
56
- const TagGapPx = 8;
57
- const InputMinWidthPx = 100;
58
- const PageSize = 10;
59
- const isFormAssociatedTryingToSetFormValue = (value) => typeof value === "string";
60
- let SearchableSelect = class extends FormAssociatedSearchableSelect {
44
+ let Select = class extends FormAssociatedSelect {
61
45
  constructor() {
62
46
  super(...arguments);
63
- __privateAdd(this, _SearchableSelect_instances);
64
- this.fixedDropdown = false;
47
+ this.activeIndex = -1;
48
+ /**
49
+ * The start index when checking a range of options.
50
+ *
51
+ * @internal
52
+ */
53
+ this.rangeStartIndex = -1;
65
54
  this.open = false;
66
- this.multiple = false;
67
- this.externalTags = false;
68
- this.maxLines = null;
69
- this.values = [];
70
- this.initialValues = [];
71
- this._inputValue = "";
72
- // --- Slotted options ---
73
55
  /**
56
+ * The unique id for the internal listbox element.
57
+ *
74
58
  * @internal
75
59
  */
76
- this._areOptionsInitialized = false;
77
- __privateAdd(this, _slottedOptionsChangeHandler, {
78
- handleChange: (source, _) => {
79
- if (source.selected && !this.values.includes(source.value)) {
80
- this.values = [...this.values, source.value];
81
- } else if (!source.selected && this.values.includes(source.value)) {
82
- this.values = this.values.filter((option) => option !== source.value);
83
- }
84
- }
85
- });
86
- // --- Option tag icons ---
87
- __privateAdd(this, _clonedTagIcons, /* @__PURE__ */ new Map());
88
- this._filteredOptions = [];
89
- this._filteredEnabledOptions = [];
90
- __privateAdd(this, _suppressFilter, false);
91
- this._highlightedOptionIndex = null;
92
- this._numElidedTags = 0;
93
- this._tagRows = [];
94
- this._lastTagRow = [];
95
- this.clearable = false;
96
- this.setFormValue = (value, state) => {
97
- if (isFormAssociatedTryingToSetFormValue(value)) {
98
- return;
99
- }
100
- super.setFormValue(value, state);
101
- };
102
- this._changeDescription = "";
103
- // --- Core ---
104
- __privateAdd(this, _resizeObserver, new ResizeObserver(() => {
105
- __privateMethod(this, _SearchableSelect_instances, updateTagLayout_fn).call(this);
106
- }));
60
+ this.listboxId = strings.uniqueId("listbox-");
61
+ this.maxHeight = 0;
62
+ this.fixedDropdown = false;
63
+ this.placeholderOption = null;
64
+ this._feedbackWrapper = null;
107
65
  }
108
66
  /**
67
+ * Returns the last checked option.
68
+ *
109
69
  * @internal
110
70
  */
111
- openChanged() {
112
- if (!this.open) {
113
- __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, null);
114
- }
71
+ get activeOption() {
72
+ return this.options[this.activeIndex];
115
73
  }
116
74
  /**
75
+ * Returns the list of checked options.
76
+ *
117
77
  * @internal
118
78
  */
119
- valuesChanged() {
120
- if (!this._areOptionsInitialized) {
121
- return;
122
- }
123
- if (!this.multiple && this.values.length > 1) {
124
- this.values = [this.values[0]];
125
- return;
126
- }
127
- if (this.values.some((value) => !__privateMethod(this, _SearchableSelect_instances, isValidValue_fn).call(this, value))) {
128
- this.values = this.values.filter((value) => __privateMethod(this, _SearchableSelect_instances, isValidValue_fn).call(this, value));
129
- return;
130
- }
131
- if (!this.multiple) {
132
- if (this.values.length) {
133
- __privateSet(this, _suppressFilter, true);
134
- this._inputValue = __privateMethod(this, _SearchableSelect_instances, textForValue_fn).call(this, this.values[0]);
135
- } else {
136
- this._inputValue = "";
137
- }
138
- }
139
- this.value = this.values.length ? this.values[0] : "";
140
- __privateMethod(this, _SearchableSelect_instances, updateSelectedOnSlottedOptions_fn).call(this);
141
- if (this.$fastController.isConnected) {
142
- __privateMethod(this, _SearchableSelect_instances, updateTagLayout_fn).call(this);
143
- }
144
- __privateMethod(this, _SearchableSelect_instances, updateFormValue_fn).call(this);
79
+ get checkedOptions() {
80
+ return this.options.filter((o) => o.checked);
145
81
  }
146
82
  /**
83
+ * Returns the index of the first selected option.
84
+ *
147
85
  * @internal
148
86
  */
149
- initialValuesChanged() {
150
- if (!this.dirtyValue) {
151
- this.values = this.initialValues;
152
- this.dirtyValue = false;
153
- }
87
+ get firstSelectedOptionIndex() {
88
+ return this.options.indexOf(this.firstSelectedOption);
154
89
  }
155
90
  /**
91
+ * Updates the `ariaActiveDescendant` property when the active index changes.
92
+ *
156
93
  * @internal
157
94
  */
158
- valueChanged(prev, next) {
159
- super.valueChanged(prev, next);
160
- if (!this._areOptionsInitialized) {
161
- return;
162
- }
163
- const isValidValue = this._slottedOptions.some(
164
- (option) => option.value === next
165
- );
166
- if (this.values[0] !== next) {
167
- this.values = isValidValue ? [next] : [];
95
+ activeIndexChanged(_, next) {
96
+ this.ariaActiveDescendant = this.options[next]?.id ?? "";
97
+ this.focusAndScrollOptionIntoView();
98
+ }
99
+ /**
100
+ * Toggles the checked state for the currently active option.
101
+ *
102
+ * @remarks
103
+ * Multiple-selection mode only.
104
+ *
105
+ * @internal
106
+ */
107
+ checkActiveIndex() {
108
+ const activeItem = this.activeOption;
109
+ if (activeItem) {
110
+ activeItem.checked = true;
168
111
  }
169
112
  }
170
- get selectedIndex() {
171
- if (this.values.length) {
172
- return this._slottedOptions.findIndex(
173
- (option) => option.value === this.values[0]
174
- );
113
+ /**
114
+ * Sets the active index to the first option and marks it as checked.
115
+ *
116
+ * @remarks
117
+ * Multi-selection mode only.
118
+ *
119
+ * @param preserveChecked - mark all options unchecked before changing the active index
120
+ *
121
+ * @internal
122
+ */
123
+ checkFirstOption(preserveChecked) {
124
+ if (preserveChecked) {
125
+ if (this.rangeStartIndex === -1) {
126
+ this.rangeStartIndex = this.activeIndex + 1;
127
+ }
128
+ this.options.forEach((o, i) => {
129
+ o.checked = numbers.inRange(i, this.rangeStartIndex);
130
+ });
175
131
  } else {
176
- return -1;
132
+ this.uncheckAllOptions();
177
133
  }
134
+ this.activeIndex = 0;
135
+ this.checkActiveIndex();
178
136
  }
179
- set selectedIndex(index) {
180
- this.value = this._slottedOptions[index]?.value ?? "";
181
- }
182
- get options() {
183
- return [...this._slottedOptions];
184
- }
185
- get selectedOptions() {
186
- return this._slottedOptions.filter(
187
- (option) => this.values.includes(option.value)
188
- );
137
+ /**
138
+ * Decrements the active index and sets the matching option as checked.
139
+ *
140
+ * @remarks
141
+ * Multi-selection mode only.
142
+ *
143
+ * @param preserveChecked - mark all options unchecked before changing the active index
144
+ *
145
+ * @internal
146
+ */
147
+ checkLastOption(preserveChecked) {
148
+ if (preserveChecked) {
149
+ if (this.rangeStartIndex === -1) {
150
+ this.rangeStartIndex = this.activeIndex;
151
+ }
152
+ this.options.forEach((o, i) => {
153
+ o.checked = numbers.inRange(i, this.rangeStartIndex, this.options.length);
154
+ });
155
+ } else {
156
+ this.uncheckAllOptions();
157
+ }
158
+ this.activeIndex = this.options.length - 1;
159
+ this.checkActiveIndex();
189
160
  }
190
161
  /**
162
+ * Increments the active index and marks the matching option as checked.
163
+ *
164
+ * @remarks
165
+ * Multiple-selection mode only.
166
+ *
167
+ * @param preserveChecked - mark all options unchecked before changing the active index
168
+ *
191
169
  * @internal
192
170
  */
193
- _inputValueChanged() {
194
- __privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
171
+ checkNextOption(preserveChecked) {
172
+ if (preserveChecked) {
173
+ if (this.rangeStartIndex === -1) {
174
+ this.rangeStartIndex = this.activeIndex;
175
+ }
176
+ this.options.forEach((o, i) => {
177
+ o.checked = numbers.inRange(i, this.rangeStartIndex, this.activeIndex + 1);
178
+ });
179
+ } else {
180
+ this.uncheckAllOptions();
181
+ }
182
+ this.activeIndex += this.activeIndex < this.options.length - 1 ? 1 : 0;
183
+ this.checkActiveIndex();
195
184
  }
196
185
  /**
186
+ * Decrements the active index and marks the matching option as checked.
187
+ *
188
+ * @remarks
189
+ * Multiple-selection mode only.
190
+ *
191
+ * @param preserveChecked - mark all options unchecked before changing the active index
192
+ *
197
193
  * @internal
198
194
  */
199
- _onInputInput(event) {
200
- __privateSet(this, _suppressFilter, false);
201
- this._inputValue = event.target.value;
195
+ checkPreviousOption(preserveChecked) {
196
+ if (preserveChecked) {
197
+ if (this.rangeStartIndex === -1) {
198
+ this.rangeStartIndex = this.activeIndex;
199
+ }
200
+ if (this.checkedOptions.length === 1) {
201
+ this.rangeStartIndex += 1;
202
+ }
203
+ this.options.forEach((o, i) => {
204
+ o.checked = numbers.inRange(i, this.activeIndex, this.rangeStartIndex);
205
+ });
206
+ } else {
207
+ this.uncheckAllOptions();
208
+ }
209
+ this.activeIndex -= this.activeIndex > 0 ? 1 : 0;
210
+ this.checkActiveIndex();
202
211
  }
203
212
  /**
204
213
  * @internal
205
214
  */
206
- _onInputFocus(_) {
207
- __privateSet(this, _suppressFilter, true);
208
- __privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
209
- this.open = true;
215
+ focusAndScrollOptionIntoView() {
216
+ super.focusAndScrollOptionIntoView(this.activeOption);
210
217
  }
211
218
  /**
219
+ * In multiple-selection mode:
220
+ * If any options are selected, the first selected option is checked when
221
+ * the listbox receives focus. If no options are selected, the first
222
+ * selectable option is checked.
223
+ *
212
224
  * @internal
213
225
  */
214
- _onInputBlur(_) {
215
- this.open = false;
216
- if (this.multiple) {
217
- this._inputValue = "";
218
- } else {
219
- if (this.values.length === 0) {
220
- this._inputValue = "";
221
- } else {
222
- this._inputValue = __privateMethod(this, _SearchableSelect_instances, textForValue_fn).call(this, this.values[0]);
226
+ focusinHandler(e) {
227
+ if (!this.multiple) {
228
+ return super.focusinHandler(e);
229
+ }
230
+ if (!this.shouldSkipFocus && e.target === e.currentTarget) {
231
+ this.uncheckAllOptions();
232
+ if (this.activeIndex === -1) {
233
+ this.activeIndex = this.firstSelectedOptionIndex !== -1 ? this.firstSelectedOptionIndex : 0;
223
234
  }
235
+ this.checkActiveIndex();
236
+ this.setSelectedOptions();
237
+ this.focusAndScrollOptionIntoView();
224
238
  }
225
- this._changeDescription = "";
239
+ this.shouldSkipFocus = false;
226
240
  }
227
241
  /**
228
- * @internal
242
+ * Sets an option as selected and gives it focus.
243
+ *
244
+ * @public
229
245
  */
230
- _onInputKeydown(e) {
231
- if (e.ctrlKey || e.shiftKey) {
232
- return true;
246
+ setSelectedOptions() {
247
+ if (!this.multiple) {
248
+ super.setSelectedOptions();
249
+ return;
233
250
  }
234
- switch (e.key) {
235
- case "Enter":
236
- __privateMethod(this, _SearchableSelect_instances, selectHighlightedOption_fn).call(this);
237
- return false;
238
- case "Escape":
239
- this.open = false;
240
- break;
241
- case "Home":
242
- if (!this.open) {
243
- this.open = true;
244
- break;
245
- }
246
- __privateMethod(this, _SearchableSelect_instances, highlightFirstOption_fn).call(this);
247
- return false;
248
- case "End":
249
- if (!this.open) {
250
- this.open = true;
251
- break;
252
- }
253
- __privateMethod(this, _SearchableSelect_instances, highlightLastOption_fn).call(this);
254
- return false;
255
- case "PageUp":
256
- if (!this.open) {
257
- this.open = true;
258
- break;
259
- }
260
- __privateMethod(this, _SearchableSelect_instances, highlightPrevPage_fn).call(this);
261
- return false;
262
- case "PageDown":
263
- if (!this.open) {
264
- this.open = true;
265
- break;
266
- }
267
- __privateMethod(this, _SearchableSelect_instances, highlightNextPage_fn).call(this);
268
- return false;
269
- case "ArrowUp":
270
- if (!this.open) {
271
- this.open = true;
272
- break;
273
- }
274
- __privateMethod(this, _SearchableSelect_instances, highlightPreviousOption_fn).call(this);
275
- return false;
276
- case "ArrowDown":
277
- if (!this.open) {
278
- this.open = true;
279
- break;
280
- }
281
- __privateMethod(this, _SearchableSelect_instances, highlightNextOption_fn).call(this);
282
- return false;
283
- case "ArrowLeft":
284
- if (this.multiple && this._inputValue === "" && this.values.length && !this.externalTags) {
285
- __privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, this.values.length));
286
- return false;
287
- }
288
- return true;
289
- case "Backspace":
290
- if (this.multiple && this._inputValue === "" && this.values.length) {
291
- this._onTagRemoved(this.values[this.values.length - 1]);
292
- return false;
293
- }
294
- return true;
295
- default:
296
- if (!this.open) {
297
- this.open = true;
298
- }
299
- return true;
251
+ if (this.$fastController.isConnected && this.options) {
252
+ this.selectedOptions = this.options.filter((o) => o.selected);
253
+ this.focusAndScrollOptionIntoView();
300
254
  }
301
- return true;
302
255
  }
303
256
  /**
257
+ * Toggles the selected state of the provided options. If any provided items
258
+ * are in an unselected state, all items are set to selected. If every
259
+ * provided item is selected, they are all unselected.
260
+ *
304
261
  * @internal
305
262
  */
306
- _slottedOptionsChanged(oldValue, newValue) {
307
- const hasSlottedOptions = Boolean(
308
- this.querySelectorAll(`:not([slot])`).length
263
+ toggleSelectedForAllCheckedOptions() {
264
+ const enabledCheckedOptions = this.checkedOptions.filter(
265
+ (o) => !o.disabled
266
+ );
267
+ const force = !enabledCheckedOptions.every((o) => o.selected);
268
+ enabledCheckedOptions.forEach((o) => o.selected = force);
269
+ this.selectedIndex = this.options.indexOf(
270
+ enabledCheckedOptions[enabledCheckedOptions.length - 1]
309
271
  );
310
- if (!newValue.length && hasSlottedOptions) {
272
+ this.setSelectedOptions();
273
+ this.updateValue(true);
274
+ }
275
+ /**
276
+ * @internal
277
+ */
278
+ typeaheadBufferChanged(prev, next) {
279
+ if (!this.multiple) {
280
+ super.typeaheadBufferChanged(prev, next);
311
281
  return;
312
282
  }
313
- this._areOptionsInitialized = true;
314
- if (oldValue) {
315
- for (const option of oldValue) {
316
- const notifier = index.Observable.getNotifier(option);
317
- notifier.unsubscribe(__privateGet(this, _slottedOptionsChangeHandler), "selected");
318
- }
319
- }
320
- if (newValue) {
321
- for (const option of newValue) {
322
- option._displayCheckmark = true;
323
- const notifier = index.Observable.getNotifier(option);
324
- notifier.subscribe(__privateGet(this, _slottedOptionsChangeHandler), "selected");
325
- }
326
- }
327
- const values = [];
328
- for (const option of this._slottedOptions) {
329
- if (option.selected || option.value === this.value || this.values.includes(option.value)) {
330
- values.push(option.value);
283
+ if (this.$fastController.isConnected) {
284
+ const typeaheadMatches = this.getTypeaheadMatches();
285
+ const activeIndex = this.options.indexOf(typeaheadMatches[0]);
286
+ if (activeIndex > -1) {
287
+ this.activeIndex = activeIndex;
288
+ this.uncheckAllOptions();
289
+ this.checkActiveIndex();
331
290
  }
291
+ this.typeaheadExpired = false;
332
292
  }
333
- __privateMethod(this, _SearchableSelect_instances, updateValuesWhileMaintainingOrder_fn).call(this, values);
334
- __privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
335
293
  }
336
294
  /**
295
+ * Unchecks all options.
296
+ *
297
+ * @remarks
298
+ * Multiple-selection mode only.
299
+ *
300
+ * @param preserveChecked - reset the rangeStartIndex
301
+ *
337
302
  * @internal
338
303
  */
339
- _tagIconSlotName(value) {
340
- return `_tag-icon-${this.values.indexOf(value)}`;
304
+ uncheckAllOptions(preserveChecked = false) {
305
+ this.options.forEach((o) => o.checked = false);
306
+ if (!preserveChecked) {
307
+ this.rangeStartIndex = -1;
308
+ }
341
309
  }
342
- // --- Tags ---
343
310
  /**
311
+ * Sets focus and synchronizes ARIA attributes when the open property changes.
312
+ *
344
313
  * @internal
345
314
  */
346
- _tagLabelForValue(value) {
347
- const option = this._slottedOptions.find(
348
- (option2) => option2.value === value
349
- );
350
- return option.label;
315
+ openChanged(prev, next) {
316
+ if (!this.collapsible) {
317
+ return;
318
+ }
319
+ if (this.open) {
320
+ this.ariaControls = this.listboxId;
321
+ this.ariaExpanded = "true";
322
+ this.focusAndScrollOptionIntoView();
323
+ this.indexWhenOpened = this.selectedIndex;
324
+ defineVividComponent.DOM.queueUpdate(() => this.focus());
325
+ return;
326
+ }
327
+ const didClose = prev === true && next === false;
328
+ const selectionChangedWhileOpen = this.indexWhenOpened !== this.selectedIndex;
329
+ if (didClose && selectionChangedWhileOpen) {
330
+ this.updateValue(true);
331
+ }
332
+ this.ariaControls = "";
333
+ this.ariaExpanded = "false";
334
+ }
335
+ get collapsible() {
336
+ return !this.multiple;
337
+ }
338
+ /**
339
+ * The value property.
340
+ *
341
+ * @public
342
+ */
343
+ get value() {
344
+ defineVividComponent.Observable.track(this, "value");
345
+ return this._value;
346
+ }
347
+ set value(next) {
348
+ const prev = `${this._value}`;
349
+ if (this._options.length) {
350
+ const selectedIndex = this._options.findIndex((el) => el.value === next);
351
+ const prevSelectedValue = this._options[this.selectedIndex]?.value ?? null;
352
+ const nextSelectedValue = this._options[selectedIndex]?.value ?? null;
353
+ if (selectedIndex === -1 || prevSelectedValue !== nextSelectedValue) {
354
+ next = "";
355
+ this.selectedIndex = selectedIndex;
356
+ }
357
+ next = this.firstSelectedOption?.value ?? next;
358
+ }
359
+ if (prev !== next) {
360
+ this._value = next;
361
+ super.valueChanged(prev, next);
362
+ defineVividComponent.Observable.notify(this, "value");
363
+ this.updateDisplayValue();
364
+ }
351
365
  }
352
366
  /**
367
+ * Sets the value and display value to match the first selected option.
368
+ *
369
+ * @param shouldEmit - if true, the input and change events will be emitted
370
+ *
353
371
  * @internal
354
372
  */
355
- _isTagDisabled(value) {
356
- const option = this._slottedOptions.find(
357
- (option2) => option2.value === value
358
- );
359
- return this.disabled || option.disabled;
373
+ updateValue(shouldEmit) {
374
+ if (this.$fastController.isConnected) {
375
+ this.value = this.firstSelectedOption?.value ?? "";
376
+ }
377
+ if (shouldEmit) {
378
+ this.$emit("input");
379
+ this.$emit("change", this, {
380
+ bubbles: true,
381
+ composed: void 0
382
+ });
383
+ }
360
384
  }
361
385
  /**
386
+ * Updates the proxy value when the selected index changes.
387
+ *
388
+ * @param prev - the previous selected index
389
+ * @param next - the next selected index
390
+ *
362
391
  * @internal
363
392
  */
364
- _onTagRemoved(value) {
365
- __privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, this.values.filter((option) => option !== value));
366
- __privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
393
+ selectedIndexChanged(prev, next) {
394
+ super.selectedIndexChanged(prev, next);
395
+ this.updateValue();
367
396
  }
368
397
  /**
398
+ * Synchronize the `aria-disabled` property when the `disabled` property changes.
399
+ *
400
+ * @param prev - The previous disabled value
401
+ * @param next - The next disabled value
402
+ *
369
403
  * @internal
370
404
  */
371
- _onTagKeydown(event) {
372
- const tagIndex = parseInt(event.target.dataset.index);
373
- switch (event.key) {
374
- case "Backspace":
375
- case "Delete":
376
- case "Enter":
377
- case " ": {
378
- this._onTagRemoved(this.values[tagIndex]);
379
- index.DOM.processUpdates();
380
- __privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexForRemoved_fn).call(this, tagIndex));
381
- break;
382
- }
383
- case "ArrowLeft":
384
- __privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, tagIndex) ?? tagIndex);
385
- break;
386
- case "ArrowRight":
387
- __privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexRight_fn).call(this, tagIndex));
388
- break;
405
+ disabledChanged(prev, next) {
406
+ if (super.disabledChanged) {
407
+ super.disabledChanged(prev, next);
389
408
  }
390
- return true;
409
+ this.ariaDisabled = this.disabled ? "true" : "false";
391
410
  }
392
411
  /**
412
+ * Handle opening and closing the listbox when the select is clicked.
413
+ *
414
+ * @param e - the mouse event
393
415
  * @internal
394
416
  */
395
- _onListboxClick(e) {
417
+ clickHandler(e) {
396
418
  if (this.disabled) {
397
419
  return;
398
420
  }
399
- const capturedOption = e.target.closest(
421
+ const clickedOption = e.target.closest(
400
422
  `option,[role=option]`
401
423
  );
402
- if (capturedOption && !capturedOption.disabled) {
403
- __privateMethod(this, _SearchableSelect_instances, handleOptionInteraction_fn).call(this, capturedOption);
424
+ if (clickedOption && clickedOption.disabled) {
425
+ return;
426
+ }
427
+ if (this.multiple) {
428
+ this.uncheckAllOptions();
429
+ this.activeIndex = this.options.indexOf(clickedOption);
430
+ this.checkActiveIndex();
431
+ this.toggleSelectedForAllCheckedOptions();
432
+ } else {
433
+ super.clickHandler(e);
434
+ }
435
+ if (this.collapsible) {
436
+ this.open = !this.open;
404
437
  }
438
+ return true;
405
439
  }
406
440
  /**
441
+ * Handles focus state when the element or its children lose focus.
442
+ *
443
+ * @param e - The focus event
407
444
  * @internal
408
445
  */
409
- get _shouldShowClearButton() {
410
- return this.clearable && this.values.length > 0;
446
+ focusoutHandler(e) {
447
+ if (this.multiple) {
448
+ this.uncheckAllOptions();
449
+ }
450
+ if (!this.open) {
451
+ return true;
452
+ }
453
+ const focusTarget = e.relatedTarget;
454
+ if (this.isSameNode(focusTarget)) {
455
+ this.focus();
456
+ return;
457
+ }
458
+ if (!this.options.includes(focusTarget)) {
459
+ this.open = false;
460
+ if (this.indexWhenOpened !== this.selectedIndex) {
461
+ this.updateValue(true);
462
+ }
463
+ }
411
464
  }
412
465
  /**
466
+ * Updates the value when an option's value changes.
467
+ *
468
+ * @param source - the source object
469
+ * @param propertyName - the property to evaluate
470
+ *
413
471
  * @internal
414
472
  */
415
- _onClearButtonClick() {
416
- __privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, this.selectedOptions.filter((option) => option.disabled).map((option) => option.value));
473
+ handleChange(source, propertyName) {
474
+ super.handleChange(source, propertyName);
475
+ if (propertyName === "value") {
476
+ this.updateValue();
477
+ }
417
478
  }
418
479
  /**
480
+ * Prevents focus when a scrollbar is clicked.
481
+ *
482
+ * @param e - the mouse event object
483
+ *
419
484
  * @internal
420
485
  */
421
- nameChanged(previous, next) {
422
- super.nameChanged(previous, next);
423
- __privateMethod(this, _SearchableSelect_instances, updateFormValue_fn).call(this);
486
+ mousedownHandler(e) {
487
+ if (e.offsetX >= 0 && e.offsetX <= this.listbox.scrollWidth) {
488
+ return super.mousedownHandler(e);
489
+ }
490
+ return this.collapsible;
491
+ }
492
+ multipleChanged(prev, next) {
493
+ super.multipleChanged(prev, next);
494
+ this.options.forEach((o) => {
495
+ o.checked = next ? false : void 0;
496
+ });
497
+ this.setSelectedOptions();
498
+ if (this.proxy) {
499
+ this.proxy.multiple = next;
500
+ }
424
501
  }
425
502
  /**
503
+ * Updates the selectedness of each option when the list of selected options changes.
504
+ *
505
+ * @param prev - the previous list of selected options
506
+ * @param next - the current list of selected options
507
+ *
426
508
  * @internal
427
509
  */
428
- formResetCallback() {
429
- super.formResetCallback();
430
- __privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, __privateMethod(this, _SearchableSelect_instances, determineInitialValues_fn).call(this));
510
+ selectedOptionsChanged(prev, next) {
511
+ super.selectedOptionsChanged(prev, next);
512
+ this.options.forEach((o, i) => {
513
+ const proxyOption = this.proxy.options.item(i);
514
+ if (proxyOption) {
515
+ proxyOption.selected = o.selected;
516
+ }
517
+ });
518
+ }
519
+ /**
520
+ * Resets and fills the proxy to match the component's options.
521
+ *
522
+ * @internal
523
+ */
524
+ setProxyOptions() {
525
+ if (this.proxy instanceof HTMLSelectElement && this.options) {
526
+ this.proxy.options.length = 0;
527
+ this.options.forEach((option) => {
528
+ const proxyOption = option.proxy || (option instanceof HTMLOptionElement ? option.cloneNode() : null);
529
+ if (proxyOption) {
530
+ this.proxy.options.add(proxyOption);
531
+ }
532
+ });
533
+ }
431
534
  }
432
535
  /**
536
+ * Handles keydown actions when the select is in multiple selection mode.
537
+ *
433
538
  * @internal
434
539
  */
435
- _onFieldsetClick(e) {
540
+ multipleKeydownHandler(e) {
436
541
  if (this.disabled) {
437
542
  return;
438
543
  }
439
- if (!e.defaultPrevented) {
440
- this._input.focus();
441
- this.open = true;
544
+ const { key, shiftKey } = e;
545
+ this.shouldSkipFocus = false;
546
+ switch (key) {
547
+ case keyCodes.keyHome: {
548
+ this.checkFirstOption(shiftKey);
549
+ return;
550
+ }
551
+ case keyCodes.keyArrowDown: {
552
+ this.checkNextOption(shiftKey);
553
+ return;
554
+ }
555
+ case keyCodes.keyArrowUp: {
556
+ this.checkPreviousOption(shiftKey);
557
+ return;
558
+ }
559
+ case keyCodes.keyEnd: {
560
+ this.checkLastOption(shiftKey);
561
+ return;
562
+ }
563
+ case keyCodes.keyTab: {
564
+ this.focusAndScrollOptionIntoView();
565
+ return;
566
+ }
567
+ case keyCodes.keyEscape: {
568
+ this.uncheckAllOptions();
569
+ this.checkActiveIndex();
570
+ return;
571
+ }
572
+ case keyCodes.keySpace: {
573
+ e.preventDefault();
574
+ if (this.typeaheadExpired) {
575
+ this.toggleSelectedForAllCheckedOptions();
576
+ return;
577
+ }
578
+ }
579
+ default: {
580
+ if (key.length === 1) {
581
+ this.handleTypeAhead(`${key}`);
582
+ }
583
+ return;
584
+ }
585
+ }
586
+ }
587
+ /**
588
+ * Handle keyboard interaction for the select.
589
+ *
590
+ * @param e - the keyboard event
591
+ * @internal
592
+ */
593
+ keydownHandler(e) {
594
+ const selectedIndexBefore = this.selectedIndex;
595
+ if (this.multiple) {
596
+ this.multipleKeydownHandler(e);
597
+ } else {
598
+ super.keydownHandler(e);
599
+ }
600
+ const key = e.key;
601
+ switch (key) {
602
+ case keyCodes.keySpace: {
603
+ e.preventDefault();
604
+ if (this.collapsible && this.typeaheadExpired) {
605
+ this.open = !this.open;
606
+ }
607
+ break;
608
+ }
609
+ case keyCodes.keyHome:
610
+ case keyCodes.keyEnd: {
611
+ e.preventDefault();
612
+ break;
613
+ }
614
+ case keyCodes.keyEnter: {
615
+ e.preventDefault();
616
+ this.open = !this.open;
617
+ break;
618
+ }
619
+ case keyCodes.keyEscape: {
620
+ if (this.collapsible && this.open) {
621
+ e.preventDefault();
622
+ this.open = false;
623
+ }
624
+ break;
625
+ }
626
+ case keyCodes.keyTab: {
627
+ if (this.collapsible && this.open) {
628
+ e.preventDefault();
629
+ this.open = false;
630
+ }
631
+ return true;
632
+ }
633
+ }
634
+ if (this.collapsible && !this.open && this.selectedIndex !== selectedIndexBefore) {
635
+ this.updateValue(true);
442
636
  }
637
+ return !(e.key === keyCodes.keyArrowDown || e.key === keyCodes.keyArrowUp);
443
638
  }
444
639
  connectedCallback() {
445
640
  super.connectedCallback();
446
- if (!this.values.length) {
447
- this.values = __privateMethod(this, _SearchableSelect_instances, determineInitialValues_fn).call(this);
448
- }
449
- __privateGet(this, _resizeObserver).observe(this._contentArea);
641
+ this.addEventListener("focusout", this.focusoutHandler);
642
+ this.addEventListener("contentchange", this.updateDisplayValue);
450
643
  }
451
644
  disconnectedCallback() {
645
+ this.removeEventListener("focusout", this.focusoutHandler);
646
+ this.removeEventListener("contentchange", this.updateDisplayValue);
452
647
  super.disconnectedCallback();
453
- __privateGet(this, _resizeObserver).disconnect();
454
648
  }
455
649
  /**
650
+ *
456
651
  * @internal
457
652
  */
458
- validate() {
459
- super.validate(this._input ?? void 0);
460
- }
461
- };
462
- _SearchableSelect_instances = new WeakSet();
463
- updateValuesThroughUserInteraction_fn = function(newValues) {
464
- this.values = newValues;
465
- this.$emit("change", void 0, {
466
- bubbles: false
467
- });
468
- this.$emit("input", void 0, {
469
- bubbles: false
470
- });
471
- };
472
- updateValuesWhileMaintainingOrder_fn = function(newValues) {
473
- const oldSet = new Set(this.values);
474
- const newSet = new Set(newValues);
475
- this.values = [...this.values].filter((v) => newSet.has(v)).concat([...newValues].filter((v) => !oldSet.has(v)));
476
- };
477
- isValidValue_fn = function(value) {
478
- return this._slottedOptions.some((option) => option.value === value);
479
- };
480
- _slottedOptionsChangeHandler = new WeakMap();
481
- updateSelectedOnSlottedOptions_fn = function() {
482
- for (const option of this._slottedOptions) {
483
- option.selected = this.values.includes(option.value);
484
- __privateMethod(this, _SearchableSelect_instances, updateClonedTagIconOfOption_fn).call(this, option);
485
- }
486
- };
487
- handleOptionInteraction_fn = function(option) {
488
- const value = option.value;
489
- let newValues;
490
- const isSelection = !this.values.includes(value);
491
- if (this.multiple) {
492
- if (isSelection) {
493
- newValues = [...this.values, value];
494
- } else {
495
- newValues = this.values.filter((option2) => option2 !== value);
653
+ updateDisplayValue() {
654
+ if (this.collapsible) {
655
+ defineVividComponent.Observable.notify(this, "displayValue");
496
656
  }
497
- this._inputValue = "";
498
- } else {
499
- if (isSelection) {
500
- newValues = [value];
501
- this._inputValue = option.text;
502
- } else {
503
- newValues = [];
504
- }
505
- this.open = false;
506
657
  }
507
- this._changeDescription = isSelection ? this.locale.searchableSelect.optionSelectedMessage(option.text) : this.locale.searchableSelect.optionDeselectedMessage(option.text);
508
- __privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, newValues);
509
- };
510
- _clonedTagIcons = new WeakMap();
511
- tagIconOfOption_fn = function(option) {
512
- return option.querySelector('[slot="tag-icon"]');
513
- };
514
- updateClonedTagIconOfOption_fn = function(option) {
515
- if (option.selected && __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, option)) {
516
- let clone = __privateGet(this, _clonedTagIcons).get(option);
517
- if (!clone) {
518
- clone = __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, option).cloneNode(true);
519
- __privateGet(this, _clonedTagIcons).set(option, clone);
520
- }
521
- clone.slot = this._tagIconSlotName(option.value);
522
- this.appendChild(clone);
523
- } else {
524
- const clone = __privateGet(this, _clonedTagIcons).get(option);
525
- if (clone) {
526
- clone.remove();
527
- __privateGet(this, _clonedTagIcons).delete(option);
528
- }
529
- }
530
- };
531
- _suppressFilter = new WeakMap();
532
- updateFilteredOptions_fn = function() {
533
- const newFilteredOptions = [];
534
- for (const option of this._slottedOptions ?? []) {
535
- if (__privateGet(this, _suppressFilter) || this._inputValue === "") {
536
- option.hidden = false;
537
- option._matchedRange = null;
538
- } else {
539
- const matchIndex = option.text.toLowerCase().indexOf(this._inputValue.toLowerCase());
540
- const matchedRange = matchIndex === -1 ? null : { from: matchIndex, to: matchIndex + this._inputValue.length };
541
- option.hidden = !matchedRange;
542
- option._matchedRange = matchedRange;
543
- }
544
- if (!option.hidden) {
545
- newFilteredOptions.push(option);
658
+ labelChanged() {
659
+ if (!this.ariaLabel) {
660
+ this.ariaLabel = this.label;
546
661
  }
547
662
  }
548
- __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, null);
549
- this._filteredOptions = newFilteredOptions;
550
- this._filteredEnabledOptions = newFilteredOptions.filter(
551
- (option) => !option.disabled
552
- );
553
- };
554
- transitionHighlightedOptionTo_fn = function(index) {
555
- if (typeof this._highlightedOptionIndex === "number") {
556
- this._filteredEnabledOptions[this._highlightedOptionIndex]._highlighted = false;
557
- }
558
- if (typeof index === "number") {
559
- if (!this._filteredEnabledOptions.length) {
560
- index = null;
561
- } else {
562
- index = Math.max(
563
- 0,
564
- Math.min(this._filteredEnabledOptions.length - 1, index)
565
- );
566
- }
663
+ get displayValue() {
664
+ defineVividComponent.Observable.track(this, "displayValue");
665
+ return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
567
666
  }
568
- this._highlightedOptionIndex = index;
569
- if (typeof this._highlightedOptionIndex === "number") {
570
- const highlightedOption = this._filteredEnabledOptions[this._highlightedOptionIndex];
571
- highlightedOption._highlighted = true;
572
- scrollIntoView.scrollIntoView(highlightedOption, this._listbox, "nearest");
573
- this._changeDescription = this.locale.searchableSelect.optionFocusedMessage(
574
- highlightedOption.text,
575
- this._highlightedOptionIndex + 1,
576
- this._filteredEnabledOptions.length
667
+ setDefaultSelectedOption() {
668
+ const options = Array.from(this.children).filter(
669
+ listbox$1.Listbox.slottedOptionFilter
577
670
  );
578
- }
579
- };
580
- selectHighlightedOption_fn = function() {
581
- if (this._highlightedOptionIndex === null) {
582
- return;
583
- }
584
- __privateMethod(this, _SearchableSelect_instances, handleOptionInteraction_fn).call(this, this._filteredEnabledOptions[this._highlightedOptionIndex]);
585
- };
586
- highlightFirstOption_fn = function() {
587
- __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, 0);
588
- };
589
- highlightLastOption_fn = function() {
590
- __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, this._filteredEnabledOptions.length - 1);
591
- };
592
- highlightPrevPage_fn = function() {
593
- __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - PageSize);
594
- };
595
- highlightNextPage_fn = function() {
596
- __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? -1) + PageSize);
597
- };
598
- highlightPreviousOption_fn = function() {
599
- __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - 1);
600
- };
601
- highlightNextOption_fn = function() {
602
- __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? -1) + 1);
603
- };
604
- textForValue_fn = function(value) {
605
- const option = this._slottedOptions.find(
606
- (option2) => option2.value === value
607
- );
608
- return option.text;
609
- };
610
- /**
611
- * @internal
612
- */
613
- measureTagWidth_fn = function(label, removable, hasIcon) {
614
- const tag = document.createElement(this._optionTagTagName);
615
- tag.label = label;
616
- tag.removable = removable;
617
- tag.style.cssText = "position: absolute; visibility: hidden;";
618
- tag.hasIconPlaceholder = hasIcon;
619
- this.shadowRoot.appendChild(tag);
620
- const width = tag.getBoundingClientRect().width;
621
- tag.remove();
622
- return width;
623
- };
624
- updateTagLayout_fn = function() {
625
- if (!this.multiple) {
626
- this._numElidedTags = 0;
627
- this._tagRows = [];
628
- this._lastTagRow = [];
629
- return;
630
- }
631
- if (this.externalTags) {
632
- this._numElidedTags = this.values.length;
633
- this._tagRows = [];
634
- this._lastTagRow = [];
635
- return;
636
- }
637
- const rowWidth = this._contentArea.getBoundingClientRect().width;
638
- const rows = [[]];
639
- let currentRowIndex = 0;
640
- let currentRowWidth = InputMinWidthPx;
641
- let i;
642
- for (i = this.values.length - 1; i >= 0; i--) {
643
- const isLastRow = this.maxLines && currentRowIndex === this.maxLines - 1;
644
- const tagWidth = __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, this._tagLabelForValue(this.values[i]), true, __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, this.selectedOptions[i]) !== null);
645
- const entry = {
646
- value: this.values[i],
647
- width: tagWidth
648
- };
649
- let elidedTagCounterWidth = 0;
650
- if (isLastRow) {
651
- const numElidedTags = i;
652
- if (numElidedTags) {
653
- elidedTagCounterWidth = TagGapPx + __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, numElidedTags.toString(), false, false);
654
- }
655
- }
656
- const totalWidthNeeded = currentRowWidth + TagGapPx + tagWidth + elidedTagCounterWidth;
657
- if (totalWidthNeeded > rowWidth) {
658
- if (isLastRow) {
659
- if (i === this.values.length - 1) {
660
- rows[currentRowIndex].unshift(entry);
661
- currentRowWidth += TagGapPx + tagWidth;
662
- } else {
663
- break;
664
- }
665
- } else {
666
- rows.push([]);
667
- currentRowIndex++;
668
- rows[currentRowIndex].unshift(entry);
669
- currentRowWidth = tagWidth;
670
- }
671
- continue;
672
- }
673
- rows[currentRowIndex].unshift(entry);
674
- currentRowWidth += TagGapPx + tagWidth;
675
- }
676
- this._numElidedTags = i + 1;
677
- rows.reverse();
678
- for (let i2 = 0; i2 < rows.length - 1; i2++) {
679
- let lineWidth = rows[i2].map((e) => e.width).reduce((a, b) => a + b, 0) + (rows[i2].length - 1) * TagGapPx;
680
- if (i2 === 0 && this._numElidedTags) {
681
- lineWidth += TagGapPx + __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, this._numElidedTags.toString(), false, false);
682
- }
683
- while (rows[i2 + 1].length && lineWidth + TagGapPx + rows[i2 + 1][0].width <= rowWidth) {
684
- const nextTag = rows[i2 + 1].shift();
685
- rows[i2].push(nextTag);
686
- lineWidth += TagGapPx + nextTag.width;
671
+ const selectedIndex = options.findIndex(
672
+ (el) => el.hasAttribute("selected") || el.selected || el.value === this.value
673
+ );
674
+ if (selectedIndex === -1 && !this.placeholderOption) {
675
+ this.selectedIndex = 0;
676
+ return;
687
677
  }
688
- }
689
- const rowValues = rows.map((line) => line.map((entry) => entry.value));
690
- this._tagRows = rowValues.slice(0, -1);
691
- this._lastTagRow = rowValues.slice(-1)[0];
692
- };
693
- moveTagFocusTo_fn = function(index) {
694
- if (index === null) {
695
- this._input.focus();
696
- } else {
697
- this.shadowRoot.querySelector(`[data-index="${index}"]`)?.focus();
698
- }
699
- };
700
- nextTagIndexLeft_fn = function(index) {
701
- if (!this.values.length) {
702
- return null;
703
- }
704
- for (let i = index - 1; i >= 0; i--) {
705
- if (!this._isTagDisabled(this.values[i])) {
706
- return i;
678
+ if (selectedIndex !== -1 || this.placeholder !== "") {
679
+ this.selectedIndex = selectedIndex;
680
+ return;
707
681
  }
708
682
  }
709
- return null;
710
- };
711
- nextTagIndexRight_fn = function(index) {
712
- if (!this.values.length) {
713
- return null;
683
+ /*
684
+ * @internal
685
+ */
686
+ slottedOptionsChanged(prev, next) {
687
+ this.options.forEach((o) => {
688
+ const notifier = defineVividComponent.Observable.getNotifier(o);
689
+ notifier.unsubscribe(this, "value");
690
+ });
691
+ super.slottedOptionsChanged(prev, next);
692
+ this.options.forEach((o) => {
693
+ const notifier = defineVividComponent.Observable.getNotifier(o);
694
+ notifier.subscribe(this, "value");
695
+ });
696
+ this.setProxyOptions();
697
+ this.updateValue();
698
+ const scale = this.getAttribute("scale") || this.scale;
699
+ next.forEach((element) => {
700
+ if (scale) {
701
+ element.setAttribute("scale", scale);
702
+ element.scale = scale;
703
+ }
704
+ });
705
+ this.proxy.value = this.value;
706
+ this.validate();
714
707
  }
715
- for (let i = index + 1; i < this.values.length; i++) {
716
- if (!this._isTagDisabled(this.values[i])) {
717
- return i;
708
+ formResetCallback() {
709
+ this.setProxyOptions();
710
+ super.setDefaultSelectedOption();
711
+ if (this.selectedIndex === -1) {
712
+ this.selectedIndex = 0;
718
713
  }
719
- }
720
- return null;
721
- };
722
- nextTagIndexForRemoved_fn = function(index) {
723
- return __privateMethod(this, _SearchableSelect_instances, nextTagIndexRight_fn).call(this, index - 1) ?? __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, index);
724
- };
725
- // --- Form handling ---
726
- determineInitialValues_fn = function() {
727
- return this.initialValues.length ? this.initialValues : this.initialValue ? [this.initialValue] : [];
728
- };
729
- updateFormValue_fn = function() {
730
- if (!this.name) {
731
- this.setFormValue(null);
732
- } else {
733
- const formData = new FormData();
734
- for (const value of this.values) {
735
- formData.append(this.name, value);
714
+ if (this.placeholder) {
715
+ this.selectedIndex = -1;
736
716
  }
737
- this.setFormValue(formData);
738
717
  }
739
718
  };
740
- _resizeObserver = new WeakMap();
741
- __decorateClass$1([
742
- index.attr
743
- ], SearchableSelect.prototype, "appearance", 2);
744
- __decorateClass$1([
745
- index.attr
746
- ], SearchableSelect.prototype, "shape", 2);
747
- __decorateClass$1([
748
- index.attr({ mode: "boolean", attribute: "fixed-dropdown" })
749
- ], SearchableSelect.prototype, "fixedDropdown", 2);
750
- __decorateClass$1([
751
- index.attr
752
- ], SearchableSelect.prototype, "placeholder", 2);
753
- __decorateClass$1([
754
- index.attr({ mode: "boolean" })
755
- ], SearchableSelect.prototype, "open", 2);
756
- __decorateClass$1([
757
- index.attr({ mode: "boolean" })
758
- ], SearchableSelect.prototype, "multiple", 2);
759
- __decorateClass$1([
760
- index.attr({ attribute: "external-tags", mode: "boolean" })
761
- ], SearchableSelect.prototype, "externalTags", 2);
762
- __decorateClass$1([
763
- index.attr({ attribute: "max-lines", converter: index.nullableNumberConverter })
764
- ], SearchableSelect.prototype, "maxLines", 2);
765
- __decorateClass$1([
766
- index.observable
767
- ], SearchableSelect.prototype, "values", 2);
768
- __decorateClass$1([
769
- index.observable
770
- ], SearchableSelect.prototype, "initialValues", 2);
771
- __decorateClass$1([
772
- index.observable
773
- ], SearchableSelect.prototype, "_input", 2);
774
- __decorateClass$1([
775
- index.observable
776
- ], SearchableSelect.prototype, "_inputValue", 2);
777
- __decorateClass$1([
778
- index.observable
779
- ], SearchableSelect.prototype, "_slottedOptions", 2);
780
- __decorateClass$1([
781
- index.observable
782
- ], SearchableSelect.prototype, "_filteredOptions", 2);
783
- __decorateClass$1([
784
- index.observable
785
- ], SearchableSelect.prototype, "_filteredEnabledOptions", 2);
786
- __decorateClass$1([
787
- index.observable
788
- ], SearchableSelect.prototype, "_highlightedOptionIndex", 2);
789
- __decorateClass$1([
790
- index.observable
791
- ], SearchableSelect.prototype, "_contentArea", 2);
792
- __decorateClass$1([
793
- index.observable
794
- ], SearchableSelect.prototype, "_numElidedTags", 2);
795
- __decorateClass$1([
796
- index.observable
797
- ], SearchableSelect.prototype, "_tagRows", 2);
798
- __decorateClass$1([
799
- index.observable
800
- ], SearchableSelect.prototype, "_lastTagRow", 2);
801
- __decorateClass$1([
802
- index.observable
803
- ], SearchableSelect.prototype, "_listbox", 2);
804
- __decorateClass$1([
805
- index.attr({ mode: "boolean" })
806
- ], SearchableSelect.prototype, "clearable", 2);
807
- __decorateClass$1([
808
- index.observable
809
- ], SearchableSelect.prototype, "_changeDescription", 2);
810
- __decorateClass$1([
811
- index.observable
812
- ], SearchableSelect.prototype, "_anchor", 2);
813
- SearchableSelect = __decorateClass$1([
719
+ __decorateClass([
720
+ defineVividComponent.observable
721
+ ], Select.prototype, "activeIndex", 2);
722
+ // @ts-expect-error Type is incorrectly non-optional
723
+ __decorateClass([
724
+ defineVividComponent.attr({ mode: "boolean" })
725
+ ], Select.prototype, "multiple", 2);
726
+ __decorateClass([
727
+ defineVividComponent.attr({ attribute: "open", mode: "boolean" })
728
+ ], Select.prototype, "open", 2);
729
+ __decorateClass([
730
+ defineVividComponent.volatile
731
+ ], Select.prototype, "collapsible", 1);
732
+ __decorateClass([
733
+ defineVividComponent.observable
734
+ ], Select.prototype, "control", 2);
735
+ __decorateClass([
736
+ defineVividComponent.observable
737
+ ], Select.prototype, "maxHeight", 2);
738
+ __decorateClass([
739
+ defineVividComponent.observable
740
+ ], Select.prototype, "_anchor", 2);
741
+ __decorateClass([
742
+ defineVividComponent.attr()
743
+ ], Select.prototype, "scale", 2);
744
+ __decorateClass([
745
+ defineVividComponent.attr
746
+ ], Select.prototype, "appearance", 2);
747
+ __decorateClass([
748
+ defineVividComponent.attr
749
+ ], Select.prototype, "shape", 2);
750
+ __decorateClass([
751
+ defineVividComponent.attr({ mode: "boolean", attribute: "fixed-dropdown" })
752
+ ], Select.prototype, "fixedDropdown", 2);
753
+ __decorateClass([
754
+ defineVividComponent.attr
755
+ ], Select.prototype, "placeholder", 2);
756
+ __decorateClass([
757
+ defineVividComponent.observable
758
+ ], Select.prototype, "placeholderOption", 2);
759
+ __decorateClass([
760
+ defineVividComponent.observable
761
+ ], Select.prototype, "_feedbackWrapper", 2);
762
+ __decorateClass([
763
+ defineVividComponent.observable
764
+ ], Select.prototype, "metaSlottedContent", 2);
765
+ Select = __decorateClass([
814
766
  formElements.errorText,
815
767
  formElements.formElements
816
- ], SearchableSelect);
768
+ ], Select);
769
+ class DelegatesARIASelect {
770
+ }
771
+ // @ts-expect-error Type is incorrectly non-optional
772
+ __decorateClass([
773
+ defineVividComponent.observable
774
+ ], DelegatesARIASelect.prototype, "ariaControls", 2);
817
775
  applyMixinsWithObservables.applyMixinsWithObservables(
818
- SearchableSelect,
776
+ Select,
819
777
  affix.AffixIconWithTrailing,
820
778
  formElements.FormElementHelperText,
821
779
  formElements.FormElementSuccessText,
822
- localized.Localized
780
+ DelegatesARIASelect
823
781
  );
824
782
 
825
- var __defProp = Object.defineProperty;
826
- var __decorateClass = (decorators, target, key, kind) => {
827
- var result = void 0 ;
828
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
829
- if (decorator = decorators[i])
830
- result = (decorator(target, key, result) ) || result;
831
- if (result) __defProp(target, key, result);
832
- return result;
833
- };
834
- class OptionTag extends index.FoundationElement {
835
- constructor() {
836
- super(...arguments);
837
- this.removable = false;
838
- this.disabled = false;
839
- this.hasIconPlaceholder = false;
840
- }
841
- _onClickRemove() {
842
- this.$emit("remove", void 0, {
843
- bubbles: false
844
- });
845
- }
846
- }
847
- __decorateClass([
848
- index.attr
849
- ], OptionTag.prototype, "shape");
850
- __decorateClass([
851
- index.attr
852
- ], OptionTag.prototype, "label");
853
- __decorateClass([
854
- index.attr({ mode: "boolean" })
855
- ], OptionTag.prototype, "removable");
856
- __decorateClass([
857
- index.attr({ mode: "boolean" })
858
- ], OptionTag.prototype, "disabled");
859
- __decorateClass([
860
- index.observable
861
- ], OptionTag.prototype, "hasIconPlaceholder");
862
- applyMixins.applyMixins(OptionTag, localized.Localized);
863
-
864
- const getStateClasses = (x) => classNames.classNames(
865
- ["disabled", x.disabled],
866
- [`appearance-${x.appearance}`, Boolean(x.appearance)],
867
- [`shape-${x.shape}`, Boolean(x.shape)],
868
- ["error", Boolean(x.errorValidationMessage)],
869
- ["success", !!x.successText]
783
+ const getStateClasses = ({
784
+ shape,
785
+ disabled,
786
+ appearance,
787
+ metaSlottedContent,
788
+ errorValidationMessage,
789
+ successText,
790
+ placeholder,
791
+ value,
792
+ scale
793
+ }) => classNames.classNames(
794
+ ["disabled", disabled],
795
+ [`appearance-${appearance}`, Boolean(appearance)],
796
+ [`shape-${shape}`, Boolean(shape)],
797
+ ["has-meta", Boolean(metaSlottedContent?.length)],
798
+ ["error", Boolean(errorValidationMessage)],
799
+ ["success", !!successText],
800
+ ["has-meta", Boolean(metaSlottedContent?.length)],
801
+ ["shows-placeholder", Boolean(placeholder) && !value],
802
+ [`size-${scale}`, Boolean(scale)]
870
803
  );
871
804
  function renderLabel() {
872
- return index.html`
873
- <label for="control" class="label" id="label"> ${(x) => x.label} </label>
874
- `;
805
+ return defineVividComponent.html` <label for="control" class="label" id="label">
806
+ ${(x) => x.label}
807
+ </label>`;
875
808
  }
876
- const tagTemplateFactory = (context, getComponent) => {
877
- const optionTagTag = context.tagFor(OptionTag);
878
- return index.html`
879
- <div class="tag-wrapper">
880
- <${optionTagTag}
881
- class="tag"
882
- tabindex="-1"
883
- data-index="${(x, c) => getComponent(c).values.indexOf(x)}"
884
- removable
885
- :label="${(x, c) => getComponent(c)._tagLabelForValue(x)}"
886
- :shape="${(_, c) => getComponent(c).shape}"
887
- ?disabled="${(x, c) => getComponent(c)._isTagDisabled(x)}"
888
- @remove="${(x, c) => getComponent(c)._onTagRemoved(x)}"
889
- @keydown="${(_, c) => getComponent(c)._onTagKeydown(c.event)}"
890
- @mousedown="${() => false}">
891
- <slot slot="icon" name="${(x, c) => getComponent(c)._tagIconSlotName(x)}"></slot>
892
- </${optionTagTag}>
893
- </div>
894
- `;
895
- };
896
- const elidedTagTemplateFactory = (context, getComponent) => {
897
- const optionTagTag = context.tagFor(OptionTag);
898
- return index.html`
899
- <${optionTagTag}
900
- class="tag"
901
- tabindex="-1"
902
- :label="${(x, c) => getComponent(x, c)._numElidedTags.toString()}"
903
- :shape="${(x, c) => getComponent(x, c).shape}"
904
- ?disabled="${(x, c) => getComponent(x, c).disabled}"
905
- @mousedown="${() => false}">
906
- </${optionTagTag}>
907
- `;
908
- };
909
- function renderFieldset(context) {
910
- const buttonTag = context.tagFor(definition$1.Button);
809
+ function renderPlaceholder(context) {
810
+ const optionTag = context.tagFor(definition$1.ListboxOption);
811
+ return defineVividComponent.html`
812
+ <${optionTag} ${ref.ref("placeholderOption")}
813
+ text="${(x) => x.placeholder}" hidden disabled>
814
+ </${optionTag}>`;
815
+ }
816
+ function selectValue(context) {
911
817
  const affixIconTemplate = affix.affixIconTemplateFactory(context);
912
- const chevronTemplate = definition$1.chevronTemplateFactory(context);
913
- const tagTemplate = tagTemplateFactory(context, (c) => c.parent);
914
- const nestedTagTemplate = tagTemplateFactory(
915
- context,
916
- (c) => c.parentContext.parent
917
- );
918
- const elidedTagTemplate = elidedTagTemplateFactory(context, (x, _) => x);
919
- const nestedElidedTagTemplate = elidedTagTemplateFactory(
920
- context,
921
- (_, c) => c.parent
922
- );
923
- return index.html`
924
- <div
925
- class="fieldset ${getStateClasses}"
926
- @click="${(x, c) => x._onFieldsetClick(c.event)}"
927
- ${ref.ref("_anchor")}
928
- >
818
+ const chevronTemplate = definition$2.chevronTemplateFactory(context);
819
+ return defineVividComponent.html` <div
820
+ class="control ${getStateClasses}"
821
+ ${ref.ref("_anchor")}
822
+ id="control"
823
+ ?disabled="${(x) => x.disabled}"
824
+ >
825
+ <div class="selected-value">
929
826
  ${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)}
930
- <div class="content-area" ${ref.ref("_contentArea")}>
931
- ${repeat.repeat(
932
- (x) => x._tagRows,
933
- index.html`
934
- <div class="tag-row">
935
- ${when.when(
936
- (_, c) => c.isFirst && c.parent._numElidedTags,
937
- nestedElidedTagTemplate
938
- )}
939
- ${repeat.repeat((x) => x, nestedTagTemplate)}
940
- </div>
941
- `,
942
- { positioning: true }
943
- )}
944
- <div
945
- class="tag-row ${(x) => classNames.classNames([
946
- "contains-only-input",
947
- x._tagRows.length > 0 && x._lastTagRow.length === 0
948
- ])}"
949
- >
950
- ${when.when(
951
- (x) => x._tagRows.length === 0 && x._numElidedTags,
952
- elidedTagTemplate
953
- )}
954
- ${repeat.repeat((x) => x._lastTagRow, tagTemplate)}
955
- <input
956
- id="control"
957
- class="control"
958
- autofocus
959
- autocomplete="off"
960
- aria-autocomplete="list"
961
- aria-expanded="${(x) => x.open}"
962
- aria-haspopup="listbox"
963
- aria-controls="listbox"
964
- placeholder="${(x) => x.multiple && x.values.length ? "" : x.placeholder}"
965
- role="combobox"
966
- type="text"
967
- ?disabled="${(x) => x.disabled}"
968
- :value="${(x) => x._inputValue}"
969
- @input="${(x, c) => x._onInputInput(c.event)}"
970
- @focus="${(x, c) => x._onInputFocus(c.event)}"
971
- @blur="${(x, c) => x._onInputBlur(c.event)}"
972
- @keydown="${(x, c) => x._onInputKeydown(c.event)}"
973
- ${ref.ref("_input")}
974
- />
975
- </div>
976
- </div>
977
- <slot name="meta"></slot>
978
- ${when.when(
979
- (x) => x._shouldShowClearButton,
980
- index.html`<${buttonTag}
981
- aria-label="${(x) => x.locale.searchableSelect.clearButtonLabel}"
982
- @click="${(x) => x._onClearButtonClick()}"
983
- @mousedown="${() => false}"
984
- ?disabled="${(x) => x.disabled}"
985
- :shape="${(x) => x.shape}"
986
- size="super-condensed"
987
- icon="close-line"
988
- appearance="ghost-light"
989
- tabindex="-1"
990
- ></${buttonTag}>`
991
- )}
992
- ${chevronTemplate}
827
+ <span class="text">${(x) => x.displayValue}</span>
828
+ <slot name="meta" ${slotted.slotted("metaSlottedContent")}></slot>
993
829
  </div>
994
- `;
830
+ ${chevronTemplate}
831
+ </div>`;
832
+ }
833
+ function setFixedDropdownVarWidth(x) {
834
+ return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
995
835
  }
996
836
  function renderControl(context) {
997
837
  const popupTag = context.tagFor(definition.Popup);
998
- return index.html`
999
- ${when.when((x) => x.label, renderLabel())}
1000
- <span aria-live="assertive" aria-relevant="text" class="visually-hidden">
1001
- ${(x) => x._changeDescription}
1002
- </span>
1003
- <div>
1004
- ${renderFieldset(context)}
1005
- <div class="popup-wrapper">
1006
- <${popupTag}
838
+ return defineVividComponent.html`
839
+ ${when.when((x) => x.label, renderLabel())}
840
+ <div class="control-wrapper">
841
+ ${when.when((x) => !x.multiple, selectValue(context))}
842
+ <${popupTag} class="popup"
843
+ style="${setFixedDropdownVarWidth}"
844
+ ?open="${(x) => x.collapsible ? x.open : true}"
1007
845
  :anchor="${(x) => x._anchor}"
1008
- :open="${(x) => x.open}"
1009
- class="popup"
1010
846
  placement="bottom-start"
1011
- strategy="${(x) => x.fixedDropdown ? "fixed" : "absolute"}">
1012
- <div
1013
- class="listbox"
847
+ strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
848
+ <div class="listbox"
849
+ id="${(x) => x.listboxId}"
1014
850
  role="listbox"
1015
- aria-multiselectable="${(x) => x.multiple}"
1016
- aria-required="${(x) => x.required}"
1017
- ${ref.ref("_listbox")}
1018
- @click="${(x, c) => x._onListboxClick(c.event)}"
1019
- @mousedown="${() => false}"
1020
- >
851
+ ?disabled="${(x) => x.disabled}"
852
+ ?hidden="${(x) => x.collapsible ? !x.open : false}"
853
+ ${ref.ref("listbox")}>
854
+ ${when.when((x) => x.placeholder, renderPlaceholder(context))}
1021
855
  <slot
1022
856
  ${slotted.slotted({
1023
- filter: listbox.Listbox.slottedOptionFilter,
857
+ filter: listbox$1.Listbox.slottedOptionFilter,
1024
858
  flatten: true,
1025
- property: "_slottedOptions"
859
+ property: "slottedOptions"
1026
860
  })}>
1027
861
  </slot>
1028
- ${when.when(
1029
- (x) => x._filteredOptions.length === 0,
1030
- index.html`<div class="empty-message">
1031
- ${when.when(
1032
- (x) => x._inputValue === "",
1033
- index.html`<slot name="no-options">
1034
- ${(x) => x.locale.searchableSelect.noOptionsMessage}
1035
- </slot>`
1036
- )}
1037
- ${when.when(
1038
- (x) => x._inputValue !== "",
1039
- index.html`<slot name="no-matches">
1040
- ${(x) => x.locale.searchableSelect.noMatchesMessage}
1041
- </slot>`
1042
- )}
1043
- </div>`
1044
- )}
1045
- </div>
862
+ </div>
1046
863
  </${popupTag}>
1047
864
  </div>
1048
- </div>
1049
- `;
865
+ `;
1050
866
  }
1051
- const SearchableSelectTemplate = (context) => {
1052
- const optionTagTag = context.tagFor(OptionTag);
1053
- return index.html`
1054
- <template :_optionTagTagName="${() => optionTagTag}">
1055
- <div class="control-wrapper">
1056
- ${renderControl(context)} ${formElements.getFeedbackTemplate(context)}
867
+ function ifNotFromFeedback(handler) {
868
+ return (x, c) => {
869
+ if (!c.event.composedPath().includes(x._feedbackWrapper)) {
870
+ return handler(x, c.event);
871
+ }
872
+ return true;
873
+ };
874
+ }
875
+ const SelectTemplate = (context) => {
876
+ return defineVividComponent.html`
877
+ <template
878
+ class="base"
879
+ aria-label="${(x) => x.ariaLabel}"
880
+ aria-activedescendant="${(x) => x.ariaActiveDescendant}"
881
+ aria-controls="${(x) => x.ariaControls}"
882
+ aria-disabled="${(x) => x.ariaDisabled}"
883
+ aria-expanded="${(x) => x.ariaExpanded}"
884
+ aria-haspopup="${(x) => x.collapsible ? "listbox" : null}"
885
+ aria-multiselectable="${(x) => x.ariaMultiSelectable}"
886
+ role="combobox"
887
+ tabindex="${(x) => !x.disabled ? "0" : null}"
888
+ @click="${ifNotFromFeedback((x, e) => x.clickHandler(e))}"
889
+ @focusin="${ifNotFromFeedback((x, e) => x.focusinHandler(e))}"
890
+ @focusout="${ifNotFromFeedback(
891
+ (x, e) => x.focusoutHandler(e)
892
+ )}"
893
+ @keydown="${ifNotFromFeedback((x, e) => {
894
+ x.open && index.handleEscapeKeyAndStopPropogation(e);
895
+ return x.keydownHandler(e);
896
+ })}"
897
+ @mousedown="${ifNotFromFeedback(
898
+ (x, e) => x.mousedownHandler(e)
899
+ )}"
900
+ >
901
+ ${renderControl(context)}
902
+ <div class="feedback-wrapper" ${ref.ref("_feedbackWrapper")}>
903
+ ${formElements.getFeedbackTemplate(context)}
1057
904
  </div>
1058
905
  </template>
1059
906
  `;
1060
907
  };
1061
908
 
1062
- const getClasses = ({ shape, disabled, removable }) => classNames.classNames(
1063
- "base",
1064
- ["disabled", disabled],
1065
- ["removable", removable],
1066
- [`shape-${shape}`, Boolean(shape)]
1067
- );
1068
- function renderRemoveButton(iconTag) {
1069
- return index.html`
1070
- <span
1071
- class="remove-button"
1072
- aria-label="${(x) => x.locale.searchableSelect.removeTagButtonLabel(x.label)}"
1073
- role="button"
1074
- tabindex="${(x) => x.disabled ? null : 0}"
1075
- @click="${(x) => x._onClickRemove()}"
1076
- >
1077
- <${iconTag} name="close-line"></${iconTag}>
1078
- </span>
1079
- `;
1080
- }
1081
- const optionTagTemplate = (context) => {
1082
- const iconTag = context.tagFor(icon.Icon);
1083
- return index.html`<span class="${getClasses}" aria-disabled="${(x) => x.disabled}">
1084
- <slot name="icon" aria-hidden="true">
1085
- ${when.when(
1086
- (x) => x.hasIconPlaceholder,
1087
- index.html`<div class="icon-placeholder"></div>`
1088
- )}
1089
- </slot>
1090
- ${when.when(
1091
- (x) => x.label,
1092
- (x) => index.html`<span class="label">${x.label}</span>`
1093
- )}
1094
- ${when.when((x) => x.removable, renderRemoveButton(iconTag))}
1095
- </span>`;
1096
- };
1097
-
1098
- const optionTagDefinition = OptionTag.compose({
1099
- baseName: "option-tag",
1100
- template: optionTagTemplate,
1101
- styles: [optionTagStyles],
1102
- shadowOptions: {
1103
- delegatesFocus: true
1104
- }
1105
- });
1106
- const searchableSelectDefinition = SearchableSelect.compose({
1107
- baseName: "searchable-select",
1108
- template: SearchableSelectTemplate,
1109
- styles: [styles],
1110
- shadowOptions: {
1111
- delegatesFocus: true
909
+ const selectDefinition = defineVividComponent.defineVividComponent(
910
+ "select",
911
+ Select,
912
+ SelectTemplate,
913
+ [definition.popupDefinition, definition$3.iconDefinition, definition$1.listboxOptionDefinition],
914
+ {
915
+ styles
1112
916
  }
1113
- });
1114
- const searchableSelectRegistries = [
1115
- ...definition$1.buttonRegistries,
1116
- ...definition.popupRegistries,
1117
- ...definition$2.iconRegistries,
1118
- optionTagDefinition(),
1119
- searchableSelectDefinition()
1120
- ];
1121
- const registerSearchableSelect = index.registerFactory(
1122
- searchableSelectRegistries
1123
917
  );
918
+ const registerSelect = defineVividComponent.createRegisterFunction(selectDefinition);
1124
919
 
1125
- exports.optionTagDefinition = optionTagDefinition;
1126
- exports.registerSearchableSelect = registerSearchableSelect;
1127
- exports.searchableSelectDefinition = searchableSelectDefinition;
1128
- exports.searchableSelectRegistries = searchableSelectRegistries;
920
+ exports.registerSelect = registerSelect;
921
+ exports.selectDefinition = selectDefinition;