@vonage/vivid 5.24.0 → 5.27.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 (777) hide show
  1. package/README.md +1 -1
  2. package/accordion/index.cjs +1 -1
  3. package/accordion/index.js +8 -8
  4. package/accordion-item/index.cjs +1 -1
  5. package/action-group/index.cjs +3 -3
  6. package/action-group/index.js +10 -5
  7. package/alert/index.cjs +7 -7
  8. package/alert/index.js +47 -35
  9. package/audio-player/index.cjs +18 -18
  10. package/audio-player/index.js +15 -11
  11. package/avatar/index.cjs +10 -10
  12. package/avatar/index.js +29 -19
  13. package/badge/index.cjs +1 -1
  14. package/banner/index.cjs +5 -5
  15. package/banner/index.js +33 -27
  16. package/breadcrumb/index.cjs +1 -1
  17. package/breadcrumb/index.js +5 -1
  18. package/breadcrumb-item/index.cjs +9 -5
  19. package/breadcrumb-item/index.js +15 -10
  20. package/bundled/affix.cjs +3 -3
  21. package/bundled/affix.js +2 -2
  22. package/bundled/anchored.cjs +2 -2
  23. package/bundled/anchored.js +13 -1
  24. package/bundled/aria-binding-directive.cjs +1 -1
  25. package/bundled/aria-binding-directive.js +2 -2
  26. package/bundled/aria.cjs +1 -1
  27. package/bundled/base-color-picker.cjs +2 -2
  28. package/bundled/base-color-picker.js +1 -1
  29. package/bundled/base-progress.cjs +1 -1
  30. package/bundled/breadcrumb-item.cjs +1 -1
  31. package/bundled/button.cjs +1 -1
  32. package/bundled/calendar-event.cjs +1 -1
  33. package/bundled/calendar-event.js +17 -4
  34. package/bundled/calendar-picker.template.cjs +5 -5
  35. package/bundled/calendar-picker.template.js +53 -55
  36. package/bundled/char-count.cjs +2 -2
  37. package/bundled/children.cjs +1 -1
  38. package/bundled/children.js +1 -1
  39. package/bundled/class-names.cjs +1 -1
  40. package/bundled/component-enum.cjs +1 -0
  41. package/bundled/component-enum.js +9 -0
  42. package/bundled/data-grid.options.cjs +1 -1
  43. package/bundled/data-grid.options.js +7 -6
  44. package/bundled/decorate.cjs +1 -1
  45. package/bundled/decorate.js +1 -1
  46. package/bundled/definition.cjs +1 -1
  47. package/bundled/definition10.cjs +10 -19
  48. package/bundled/definition10.js +23 -71
  49. package/bundled/definition11.cjs +74 -10
  50. package/bundled/definition11.js +194 -23
  51. package/bundled/definition12.cjs +18 -70
  52. package/bundled/definition12.js +48 -185
  53. package/bundled/definition13.cjs +5 -22
  54. package/bundled/definition13.js +9 -58
  55. package/bundled/definition14.cjs +1 -5
  56. package/bundled/definition14.js +9 -9
  57. package/bundled/definition15.cjs +6 -6
  58. package/bundled/definition15.js +19 -18
  59. package/bundled/definition16.cjs +3 -3
  60. package/bundled/definition16.js +23 -17
  61. package/bundled/definition17.cjs +7 -7
  62. package/bundled/definition17.js +22 -109
  63. package/bundled/definition18.cjs +3 -3
  64. package/bundled/definition18.js +9 -31
  65. package/bundled/definition19.cjs +21 -21
  66. package/bundled/definition19.js +68 -62
  67. package/bundled/definition2.cjs +13 -1
  68. package/bundled/definition2.js +22 -185
  69. package/bundled/definition20.cjs +3 -3
  70. package/bundled/definition20.js +6 -7
  71. package/bundled/definition21.cjs +9 -9
  72. package/bundled/definition21.js +25 -25
  73. package/bundled/definition22.cjs +5 -5
  74. package/bundled/definition22.js +27 -27
  75. package/bundled/definition23.cjs +3 -3
  76. package/bundled/definition23.js +26 -8
  77. package/bundled/definition24.cjs +4 -4
  78. package/bundled/definition24.js +4 -3
  79. package/bundled/definition25.cjs +7 -7
  80. package/bundled/definition25.js +37 -28
  81. package/bundled/definition3.cjs +25 -12
  82. package/bundled/definition3.js +83 -44
  83. package/bundled/definition4.cjs +29 -25
  84. package/bundled/definition4.js +50 -88
  85. package/bundled/definition5.cjs +28 -29
  86. package/bundled/definition5.js +143 -45
  87. package/bundled/definition6.cjs +6 -29
  88. package/bundled/definition6.js +20 -129
  89. package/bundled/definition7.cjs +14 -6
  90. package/bundled/definition7.js +159 -20
  91. package/bundled/definition8.cjs +22 -14
  92. package/bundled/definition8.js +88 -144
  93. package/bundled/definition9.cjs +20 -16
  94. package/bundled/definition9.js +59 -62
  95. package/bundled/delegates-aria.cjs +1 -1
  96. package/bundled/delegates-aria.js +3 -2
  97. package/bundled/dialog.cjs +1 -1
  98. package/bundled/dialog.js +1 -1
  99. package/bundled/divider.cjs +1 -1
  100. package/bundled/divider.js +9 -9
  101. package/bundled/dom.cjs +1 -1
  102. package/bundled/enums.cjs +1 -1
  103. package/bundled/extractOptions.cjs +1 -1
  104. package/bundled/extractOptions.js +2 -2
  105. package/bundled/feedback-message.cjs +8 -0
  106. package/bundled/feedback-message.js +41 -0
  107. package/bundled/floating-ui.dom.cjs +1 -1
  108. package/bundled/floating-ui.dom.js +163 -197
  109. package/bundled/form-associated.cjs +1 -1
  110. package/bundled/form-associated.js +3 -4
  111. package/bundled/form-element.cjs +1 -1
  112. package/bundled/host-semantics.cjs +1 -1
  113. package/bundled/icon.cjs +1 -0
  114. package/bundled/icon.js +34 -0
  115. package/bundled/kbd-shortcut.cjs +1 -1
  116. package/bundled/key-codes.cjs +1 -1
  117. package/bundled/linkable.cjs +2 -2
  118. package/bundled/listbox.cjs +1 -1
  119. package/bundled/listbox.js +8 -7
  120. package/bundled/localized.cjs +1 -1
  121. package/bundled/localized.js +33 -32
  122. package/bundled/mixins.cjs +9 -16
  123. package/bundled/mixins.js +23 -56
  124. package/bundled/numberConverter.cjs +2 -2
  125. package/bundled/numberConverter.js +1 -1
  126. package/bundled/numbers.cjs +1 -1
  127. package/bundled/optgroup.cjs +1 -0
  128. package/bundled/optgroup.js +27 -0
  129. package/bundled/option.cjs +1 -0
  130. package/bundled/option.js +95 -0
  131. package/bundled/picker-field.template.cjs +2 -2
  132. package/bundled/picker-field.template.js +8 -8
  133. package/bundled/platform.cjs +1 -1
  134. package/bundled/playbackRates.cjs +1 -1
  135. package/bundled/ref.cjs +1 -1
  136. package/bundled/ref.js +1 -1
  137. package/bundled/render-in-light-dom.cjs +1 -1
  138. package/bundled/render-in-light-dom.js +1 -1
  139. package/bundled/repeat.cjs +1 -1
  140. package/bundled/repeat.js +16 -15
  141. package/bundled/scrollIntoView.cjs +1 -1
  142. package/bundled/scrollIntoView.js +1 -3
  143. package/bundled/single-date-picker.cjs +1 -1
  144. package/bundled/single-value-picker.cjs +1 -1
  145. package/bundled/single-value-picker.js +1 -1
  146. package/bundled/slider.template.cjs +12 -12
  147. package/bundled/slider.template.js +209 -32
  148. package/bundled/slottable-request.cjs +3 -3
  149. package/bundled/slottable-request.js +26 -17
  150. package/bundled/slotted.cjs +1 -1
  151. package/bundled/slotted.js +1 -1
  152. package/bundled/text-field.cjs +1 -1
  153. package/bundled/text-field.js +1 -1
  154. package/bundled/time-selection-picker.template.cjs +4 -4
  155. package/bundled/time-selection-picker.template.js +10 -7
  156. package/bundled/trapped-focus.cjs +1 -1
  157. package/bundled/utils.cjs +1 -1
  158. package/bundled/vivid-element.cjs +3 -3
  159. package/bundled/vivid-element.js +397 -358
  160. package/bundled/when.cjs +1 -1
  161. package/bundled/when.js +1 -1
  162. package/bundled/with-contextual-help.cjs +1 -1
  163. package/bundled/with-contextual-help.js +1 -1
  164. package/bundled/with-error-text.cjs +1 -1
  165. package/bundled/with-success-text.cjs +1 -1
  166. package/button/index.cjs +1 -1
  167. package/button/index.js +1 -1
  168. package/calendar/index.cjs +1 -1
  169. package/calendar/index.js +7 -7
  170. package/calendar-event/index.cjs +2 -2
  171. package/calendar-event/index.js +10 -8
  172. package/card/index.cjs +24 -22
  173. package/card/index.js +14 -8
  174. package/checkbox/index.cjs +1 -1
  175. package/color-picker/index.cjs +13 -13
  176. package/color-picker/index.js +22 -19
  177. package/combobox/index.cjs +9 -9
  178. package/combobox/index.js +46 -42
  179. package/contextual-help/index.cjs +1 -1
  180. package/contextual-help/index.js +1 -1
  181. package/country/index.cjs +1 -1
  182. package/country-group/index.cjs +1 -1
  183. package/country-group/index.js +8 -4
  184. package/custom-elements.json +4208 -3828
  185. package/data-grid/index.cjs +28 -28
  186. package/data-grid/index.js +92 -98
  187. package/date-picker/index.cjs +1 -1
  188. package/date-picker/index.js +10 -6
  189. package/date-range-picker/index.cjs +1 -1
  190. package/date-range-picker/index.js +13 -9
  191. package/date-time-picker/index.cjs +1 -1
  192. package/date-time-picker/index.js +11 -7
  193. package/dial-pad/index.cjs +24 -23
  194. package/dial-pad/index.js +17 -11
  195. package/dialog/index.cjs +14 -14
  196. package/dialog/index.js +12 -8
  197. package/divider/index.cjs +1 -1
  198. package/elevation/definition.cjs +1 -0
  199. package/elevation/definition.js +2 -2
  200. package/elevation/index.cjs +1 -1
  201. package/elevation/index.js +1 -1
  202. package/empty-state/index.cjs +4 -4
  203. package/empty-state/index.js +20 -7
  204. package/fab/index.cjs +3 -3
  205. package/fab/index.js +14 -6
  206. package/file-picker/index.cjs +11 -13
  207. package/file-picker/index.js +28 -24
  208. package/flag/index.cjs +1 -1
  209. package/flag/index.js +7 -3
  210. package/form-field/definition.cjs +5 -0
  211. package/form-field/definition.js +2 -0
  212. package/form-field/index.cjs +29 -0
  213. package/form-field/index.js +57 -0
  214. package/header/definition.cjs +1 -1
  215. package/header/definition.js +1 -1
  216. package/header/index.cjs +1 -1
  217. package/header/index.js +9 -5
  218. package/icon/definition.cjs +2 -1
  219. package/icon/definition.js +2 -1
  220. package/icon/index.cjs +1 -1
  221. package/icon/index.js +1 -1
  222. package/index.cjs +166 -154
  223. package/index.js +48 -42
  224. package/kbd-key/definition.cjs +1 -1
  225. package/kbd-key/definition.js +1 -1
  226. package/kbd-key/index.cjs +3 -3
  227. package/kbd-key/index.js +22 -13
  228. package/kbd-shortcut/definition.cjs +1 -1
  229. package/kbd-shortcut/definition.js +1 -1
  230. package/kbd-shortcut/index.cjs +1 -1
  231. package/kbd-shortcut/index.js +6 -6
  232. package/layout/definition.cjs +1 -1
  233. package/layout/definition.js +1 -1
  234. package/layout/index.cjs +1 -1
  235. package/layout/index.js +7 -3
  236. package/lib/accordion-item/accordion-item.d.ts +12 -6
  237. package/lib/action-group/action-group.d.ts +10 -5
  238. package/lib/alert/alert.d.ts +15 -18
  239. package/lib/avatar/avatar.d.ts +16 -7
  240. package/lib/badge/badge.d.ts +17 -7
  241. package/lib/banner/banner.d.ts +18 -20
  242. package/lib/button/button.d.ts +25 -16
  243. package/lib/calendar-event/calendar-event.d.ts +14 -7
  244. package/lib/checkbox/checkbox.d.ts +31 -28
  245. package/lib/combobox/combobox.d.ts +38 -33
  246. package/lib/components.d.ts +2 -0
  247. package/lib/data-grid/data-grid.options.d.ts +6 -1
  248. package/lib/dial-pad/dial-pad.d.ts +0 -1
  249. package/lib/dial-pad/locale.d.ts +1 -0
  250. package/lib/divider/divider.d.ts +9 -6
  251. package/lib/elevation/definition.d.ts +2 -0
  252. package/lib/empty-state/empty-state.d.ts +7 -2
  253. package/lib/fab/fab.d.ts +3 -2
  254. package/lib/form-field/definition.d.ts +4 -0
  255. package/lib/form-field/form-field.d.ts +6 -0
  256. package/lib/form-field/form-field.template.d.ts +3 -0
  257. package/lib/kbd-key/kbd-key.d.ts +7 -2
  258. package/lib/listbox/definition.d.ts +3 -0
  259. package/lib/listbox/listbox.d.ts +1303 -0
  260. package/lib/listbox/listbox.template.d.ts +3 -0
  261. package/lib/menu/menu.d.ts +0 -1
  262. package/lib/menu-item/menu-item.d.ts +17 -14
  263. package/lib/nav-disclosure/nav-disclosure.d.ts +18 -11
  264. package/lib/nav-item/nav-item.d.ts +19 -12
  265. package/lib/note/note.d.ts +10 -6
  266. package/lib/number-field/number-field.d.ts +45 -41
  267. package/lib/option/option.d.ts +13 -10
  268. package/lib/popup/definition.d.ts +2 -0
  269. package/lib/progress/progress.d.ts +10 -5
  270. package/lib/progress-ring/progress-ring.d.ts +9 -5
  271. package/lib/radio/radio.d.ts +18 -15
  272. package/lib/range-slider/range-slider.d.ts +19 -15
  273. package/lib/rich-text-editor/rich-text-editor.d.ts +9 -5
  274. package/lib/rich-text-editor/rte/features/base.d.ts +1 -0
  275. package/lib/rich-text-editor/rte/utils/default-textblock.d.ts +2 -2
  276. package/lib/rich-text-editor/rte/utils/ui.d.ts +2 -1
  277. package/lib/searchable-select/option-tag.d.ts +12 -7
  278. package/lib/searchable-select/searchable-select.d.ts +7 -2
  279. package/lib/select/select.d.ts +45 -40
  280. package/lib/selectable-box/selectable-box.d.ts +9 -5
  281. package/lib/slider/slider.d.ts +18 -14
  282. package/lib/split-button/split-button.d.ts +24 -15
  283. package/lib/status/status.d.ts +10 -7
  284. package/lib/switch/switch.d.ts +13 -9
  285. package/lib/tab/tab.d.ts +19 -14
  286. package/lib/tabs/tabs.d.ts +6 -3
  287. package/lib/tag/tag.d.ts +24 -15
  288. package/lib/tag-name-map.d.ts +3 -1
  289. package/lib/text-field/text-field.d.ts +47 -41
  290. package/lib/toggletip/toggletip.d.ts +1 -0
  291. package/lib/tooltip/tooltip.d.ts +1 -0
  292. package/lib/video-player/__tests__/video-fixtures.d.ts +3 -0
  293. package/listbox/definition.cjs +5 -0
  294. package/listbox/definition.js +2 -0
  295. package/listbox/index.cjs +13 -0
  296. package/listbox/index.js +554 -0
  297. package/locales/de-DE.cjs +34 -33
  298. package/locales/de-DE.js +34 -33
  299. package/locales/en-GB.cjs +34 -33
  300. package/locales/en-GB.js +34 -33
  301. package/locales/ja-JP.cjs +35 -33
  302. package/locales/ja-JP.js +35 -33
  303. package/locales/zh-CN.cjs +34 -33
  304. package/locales/zh-CN.js +34 -33
  305. package/menu/index.cjs +1 -1
  306. package/menu-item/index.cjs +1 -1
  307. package/nav/definition.cjs +1 -1
  308. package/nav/definition.js +1 -1
  309. package/nav/index.cjs +1 -1
  310. package/nav/index.js +6 -4
  311. package/nav-disclosure/definition.cjs +1 -1
  312. package/nav-disclosure/definition.js +1 -1
  313. package/nav-disclosure/index.cjs +5 -5
  314. package/nav-disclosure/index.js +15 -9
  315. package/nav-item/definition.cjs +1 -1
  316. package/nav-item/definition.js +1 -1
  317. package/nav-item/index.cjs +2 -2
  318. package/nav-item/index.js +15 -10
  319. package/note/definition.cjs +1 -1
  320. package/note/definition.js +1 -1
  321. package/note/index.cjs +6 -4
  322. package/note/index.js +22 -9
  323. package/number-field/definition.cjs +1 -1
  324. package/number-field/definition.js +1 -1
  325. package/number-field/index.cjs +11 -11
  326. package/number-field/index.js +41 -36
  327. package/optgroup/definition.cjs +2 -1
  328. package/optgroup/definition.js +2 -1
  329. package/optgroup/index.cjs +1 -1
  330. package/option/definition.cjs +2 -1
  331. package/option/definition.js +2 -1
  332. package/option/index.cjs +1 -1
  333. package/package.json +32 -38
  334. package/pagination/definition.cjs +1 -1
  335. package/pagination/definition.js +1 -1
  336. package/pagination/index.cjs +1 -1
  337. package/pagination/index.js +9 -9
  338. package/platform-switch/definition.cjs +1 -1
  339. package/platform-switch/definition.js +1 -1
  340. package/platform-switch/index.cjs +1 -1
  341. package/platform-switch/index.js +6 -2
  342. package/popover/definition.cjs +1 -1
  343. package/popover/definition.js +1 -1
  344. package/popover/index.cjs +5 -5
  345. package/popover/index.js +46 -37
  346. package/popup/definition.cjs +1 -0
  347. package/popup/definition.js +2 -2
  348. package/popup/index.cjs +1 -1
  349. package/popup/index.js +1 -1
  350. package/progress/definition.cjs +1 -1
  351. package/progress/definition.js +1 -1
  352. package/progress/index.cjs +7 -7
  353. package/progress/index.js +21 -11
  354. package/progress-ring/index.cjs +1 -1
  355. package/progress-ring/index.js +1 -1
  356. package/radio/definition.cjs +1 -1
  357. package/radio/definition.js +1 -1
  358. package/radio/index.cjs +1 -1
  359. package/radio-group/definition.cjs +1 -1
  360. package/radio-group/definition.js +1 -1
  361. package/radio-group/index.cjs +2 -2
  362. package/radio-group/index.js +14 -9
  363. package/range-slider/definition.cjs +1 -1
  364. package/range-slider/definition.js +1 -1
  365. package/range-slider/index.cjs +8 -8
  366. package/range-slider/index.js +31 -32
  367. package/rich-text-editor/definition.cjs +1 -1
  368. package/rich-text-editor/definition.js +1 -1
  369. package/rich-text-editor/index.cjs +17 -14
  370. package/rich-text-editor/index.js +1955 -1721
  371. package/rich-text-view/definition.cjs +1 -1
  372. package/rich-text-view/definition.js +1 -1
  373. package/rich-text-view/index.cjs +1 -1
  374. package/rich-text-view/index.js +6 -4
  375. package/searchable-select/definition.cjs +1 -1
  376. package/searchable-select/definition.js +1 -1
  377. package/searchable-select/index.cjs +26 -26
  378. package/searchable-select/index.js +97 -90
  379. package/select/definition.cjs +1 -1
  380. package/select/definition.js +1 -1
  381. package/select/index.cjs +1 -1
  382. package/selectable-box/definition.cjs +1 -1
  383. package/selectable-box/definition.js +1 -1
  384. package/selectable-box/index.cjs +8 -8
  385. package/selectable-box/index.js +24 -20
  386. package/shared/listbox/commands.d.ts +17 -0
  387. package/shared/listbox/move.d.ts +6 -0
  388. package/shared/listbox/options.d.ts +12 -0
  389. package/shared/listbox/selection.d.ts +28 -0
  390. package/shared/listbox/state.d.ts +26 -0
  391. package/shared/listbox/typeahead.d.ts +8 -0
  392. package/shared/listbox/with-options-filter.d.ts +440 -0
  393. package/shared/listbox/with-options.d.ts +862 -0
  394. package/shared/patterns/anchored.d.ts +2 -0
  395. package/shared/styles/appearance.d.ts +2 -0
  396. package/shared/styles/connotation.d.ts +2 -0
  397. package/shared/styles/connotationOverrides.d.ts +1 -0
  398. package/shared/utils/component-enum.d.ts +7 -0
  399. package/side-drawer/definition.cjs +1 -1
  400. package/side-drawer/definition.js +1 -1
  401. package/side-drawer/index.cjs +1 -1
  402. package/side-drawer/index.js +10 -7
  403. package/simple-color-picker/definition.cjs +1 -1
  404. package/simple-color-picker/definition.js +1 -1
  405. package/simple-color-picker/index.cjs +6 -6
  406. package/simple-color-picker/index.js +22 -21
  407. package/slider/definition.cjs +2 -1
  408. package/slider/definition.js +2 -1
  409. package/slider/index.cjs +1 -1
  410. package/slider/index.js +1 -1
  411. package/split-button/definition.cjs +1 -1
  412. package/split-button/definition.js +1 -1
  413. package/split-button/index.cjs +9 -7
  414. package/split-button/index.js +58 -37
  415. package/status/definition.cjs +1 -1
  416. package/status/definition.js +1 -1
  417. package/status/index.cjs +5 -5
  418. package/status/index.js +22 -13
  419. package/switch/definition.cjs +1 -1
  420. package/switch/definition.js +1 -1
  421. package/switch/index.cjs +3 -3
  422. package/switch/index.js +22 -11
  423. package/tab/definition.cjs +1 -1
  424. package/tab/definition.js +1 -1
  425. package/tab/index.cjs +1 -1
  426. package/tab/index.js +1 -1
  427. package/tab-panel/definition.cjs +1 -1
  428. package/tab-panel/definition.js +1 -1
  429. package/tab-panel/index.cjs +1 -1
  430. package/tab-panel/index.js +1 -1
  431. package/table/definition.cjs +1 -1
  432. package/table/definition.js +1 -1
  433. package/table/index.cjs +16 -14
  434. package/table/index.js +14 -11
  435. package/tabs/definition.cjs +1 -1
  436. package/tabs/definition.js +1 -1
  437. package/tabs/index.cjs +4 -4
  438. package/tabs/index.js +32 -30
  439. package/tag/definition.cjs +1 -1
  440. package/tag/definition.js +1 -1
  441. package/tag/index.cjs +11 -11
  442. package/tag/index.js +31 -14
  443. package/tag-group/definition.cjs +1 -1
  444. package/tag-group/definition.js +1 -1
  445. package/tag-group/index.cjs +1 -1
  446. package/tag-group/index.js +6 -4
  447. package/text-area/definition.cjs +1 -1
  448. package/text-area/definition.js +1 -1
  449. package/text-area/index.cjs +5 -5
  450. package/text-area/index.js +18 -15
  451. package/text-field/index.cjs +1 -1
  452. package/text-field/index.js +1 -1
  453. package/time-picker/definition.cjs +1 -1
  454. package/time-picker/definition.js +1 -1
  455. package/time-picker/index.cjs +1 -1
  456. package/time-picker/index.js +9 -6
  457. package/toggletip/index.cjs +1 -1
  458. package/toggletip/index.js +1 -1
  459. package/tooltip/index.cjs +1 -1
  460. package/tooltip/index.js +1 -1
  461. package/tree-item/definition.cjs +1 -1
  462. package/tree-item/definition.js +1 -1
  463. package/tree-item/index.cjs +1 -1
  464. package/tree-item/index.js +1 -1
  465. package/tree-view/definition.cjs +1 -1
  466. package/tree-view/definition.js +1 -1
  467. package/tree-view/index.cjs +1 -1
  468. package/tree-view/index.js +7 -5
  469. package/unbundled/affix.cjs +2 -3
  470. package/unbundled/affix.js +1 -1
  471. package/unbundled/anchored.cjs +39 -1
  472. package/unbundled/anchored.js +28 -1
  473. package/unbundled/aria-binding-directive.cjs +2 -2
  474. package/unbundled/aria-binding-directive.js +2 -1
  475. package/unbundled/base-color-picker.cjs +0 -1
  476. package/unbundled/base-progress.cjs +1 -2
  477. package/unbundled/base-progress.js +1 -1
  478. package/unbundled/breadcrumb-item.cjs +0 -1
  479. package/unbundled/button.cjs +2 -3
  480. package/unbundled/button.js +2 -2
  481. package/unbundled/calendar-event.cjs +29 -1
  482. package/unbundled/calendar-event.js +18 -1
  483. package/unbundled/calendar-picker.template.cjs +109 -91
  484. package/unbundled/calendar-picker.template.js +109 -90
  485. package/unbundled/char-count.cjs +0 -1
  486. package/unbundled/component-enum.cjs +18 -0
  487. package/unbundled/component-enum.js +13 -0
  488. package/unbundled/data-grid.options.cjs +8 -0
  489. package/unbundled/data-grid.options.js +3 -1
  490. package/unbundled/decorate.cjs +1 -1
  491. package/unbundled/decorate.js +1 -1
  492. package/unbundled/definition.cjs +3 -67
  493. package/unbundled/definition.js +5 -62
  494. package/unbundled/definition10.cjs +2 -343
  495. package/unbundled/definition10.js +4 -338
  496. package/unbundled/definition11.cjs +10 -10
  497. package/unbundled/definition11.js +9 -8
  498. package/unbundled/definition12.cjs +7 -6
  499. package/unbundled/definition12.js +8 -6
  500. package/unbundled/definition13.cjs +2 -2
  501. package/unbundled/definition13.js +2 -1
  502. package/unbundled/definition14.cjs +13 -4
  503. package/unbundled/definition14.js +13 -3
  504. package/unbundled/definition15.cjs +26 -5
  505. package/unbundled/definition15.js +26 -4
  506. package/unbundled/definition16.cjs +20 -14
  507. package/unbundled/definition16.js +20 -13
  508. package/unbundled/definition17.cjs +9 -5
  509. package/unbundled/definition17.js +9 -4
  510. package/unbundled/definition18.cjs +4 -3
  511. package/unbundled/definition18.js +4 -2
  512. package/unbundled/definition19.cjs +2 -3
  513. package/unbundled/definition19.js +9 -8
  514. package/unbundled/definition2.cjs +15 -5
  515. package/unbundled/definition2.js +16 -5
  516. package/unbundled/definition20.cjs +1 -2
  517. package/unbundled/definition20.js +7 -6
  518. package/unbundled/definition21.cjs +6 -4
  519. package/unbundled/definition21.js +6 -3
  520. package/unbundled/definition22.cjs +0 -1
  521. package/unbundled/definition23.cjs +14 -7
  522. package/unbundled/definition23.js +13 -5
  523. package/unbundled/definition24.cjs +10 -8
  524. package/unbundled/definition24.js +11 -8
  525. package/unbundled/definition25.cjs +4 -4
  526. package/unbundled/definition25.js +4 -3
  527. package/unbundled/definition26.cjs +13 -8
  528. package/unbundled/definition26.js +12 -6
  529. package/unbundled/definition27.cjs +41 -7
  530. package/unbundled/definition27.js +42 -7
  531. package/unbundled/definition28.cjs +7 -6
  532. package/unbundled/definition28.js +6 -4
  533. package/unbundled/definition29.cjs +5 -169
  534. package/unbundled/definition29.js +11 -162
  535. package/unbundled/definition3.cjs +5 -6
  536. package/unbundled/definition3.js +5 -5
  537. package/unbundled/definition30.cjs +2 -64
  538. package/unbundled/definition30.js +5 -54
  539. package/unbundled/definition31.cjs +20 -16
  540. package/unbundled/definition31.js +19 -14
  541. package/unbundled/definition32.cjs +2 -2
  542. package/unbundled/definition32.js +2 -1
  543. package/unbundled/definition33.cjs +0 -1
  544. package/unbundled/definition34.cjs +0 -1
  545. package/unbundled/definition35.cjs +41 -52
  546. package/unbundled/definition35.js +42 -52
  547. package/unbundled/definition36.cjs +2 -3
  548. package/unbundled/definition36.js +9 -8
  549. package/unbundled/definition37.cjs +1 -2
  550. package/unbundled/definition37.js +1 -1
  551. package/unbundled/definition38.cjs +0 -1
  552. package/unbundled/definition39.cjs +1 -2
  553. package/unbundled/definition39.js +1 -1
  554. package/unbundled/definition4.cjs +4 -3
  555. package/unbundled/definition4.js +11 -6
  556. package/unbundled/definition40.cjs +9 -6
  557. package/unbundled/definition40.js +9 -5
  558. package/unbundled/definition41.cjs +11 -7
  559. package/unbundled/definition41.js +11 -6
  560. package/unbundled/definition42.cjs +16 -7
  561. package/unbundled/definition42.js +16 -6
  562. package/unbundled/definition43.cjs +7 -3
  563. package/unbundled/definition43.js +7 -2
  564. package/unbundled/definition44.cjs +15 -13
  565. package/unbundled/definition44.js +14 -11
  566. package/unbundled/definition45.cjs +73 -52
  567. package/unbundled/definition45.js +69 -47
  568. package/unbundled/definition46.cjs +53 -46
  569. package/unbundled/definition46.js +49 -41
  570. package/unbundled/definition47.cjs +40 -165
  571. package/unbundled/definition47.js +36 -160
  572. package/unbundled/definition48.cjs +177 -32
  573. package/unbundled/definition48.js +174 -22
  574. package/unbundled/definition49.cjs +30 -90
  575. package/unbundled/definition49.js +27 -86
  576. package/unbundled/definition5.cjs +9 -3
  577. package/unbundled/definition5.js +15 -7
  578. package/unbundled/definition50.cjs +617 -48
  579. package/unbundled/definition50.js +615 -47
  580. package/unbundled/definition51.cjs +93 -22
  581. package/unbundled/definition51.js +91 -16
  582. package/unbundled/definition52.cjs +52 -33
  583. package/unbundled/definition52.js +49 -29
  584. package/unbundled/definition53.cjs +22 -324
  585. package/unbundled/definition53.js +18 -319
  586. package/unbundled/definition54.cjs +44 -213
  587. package/unbundled/definition54.js +40 -208
  588. package/unbundled/definition55.cjs +321 -42
  589. package/unbundled/definition55.js +317 -37
  590. package/unbundled/definition56.cjs +199 -254
  591. package/unbundled/definition56.js +193 -247
  592. package/unbundled/definition57.cjs +45 -54
  593. package/unbundled/definition57.js +42 -49
  594. package/unbundled/definition58.cjs +271 -134
  595. package/unbundled/definition58.js +269 -128
  596. package/unbundled/definition59.cjs +59 -246
  597. package/unbundled/definition59.js +58 -244
  598. package/unbundled/definition6.cjs +22 -7
  599. package/unbundled/definition6.js +22 -6
  600. package/unbundled/definition60.cjs +129 -445
  601. package/unbundled/definition60.js +127 -442
  602. package/unbundled/definition61.cjs +230 -3746
  603. package/unbundled/definition61.js +224 -3576
  604. package/unbundled/definition62.cjs +428 -742
  605. package/unbundled/definition62.js +426 -739
  606. package/unbundled/definition63.cjs +3776 -103
  607. package/unbundled/definition63.js +3607 -97
  608. package/unbundled/definition64.cjs +693 -906
  609. package/unbundled/definition64.js +685 -894
  610. package/unbundled/definition65.cjs +104 -109
  611. package/unbundled/definition65.js +100 -104
  612. package/unbundled/definition66.cjs +1004 -66
  613. package/unbundled/definition66.js +1003 -58
  614. package/unbundled/definition67.cjs +107 -156
  615. package/unbundled/definition67.js +103 -151
  616. package/unbundled/definition68.cjs +71 -123
  617. package/unbundled/definition68.js +67 -118
  618. package/unbundled/definition69.cjs +163 -52
  619. package/unbundled/definition69.js +159 -47
  620. package/unbundled/definition7.cjs +0 -1
  621. package/unbundled/definition7.js +10 -4
  622. package/unbundled/definition70.cjs +146 -76
  623. package/unbundled/definition70.js +145 -71
  624. package/unbundled/definition71.cjs +66 -22
  625. package/unbundled/definition71.js +63 -15
  626. package/unbundled/definition72.cjs +88 -76
  627. package/unbundled/definition72.js +85 -72
  628. package/unbundled/definition73.cjs +20 -306
  629. package/unbundled/definition73.js +16 -229
  630. package/unbundled/definition74.cjs +77 -316
  631. package/unbundled/definition74.js +76 -307
  632. package/unbundled/definition75.cjs +310 -31
  633. package/unbundled/definition75.js +233 -24
  634. package/unbundled/definition76.cjs +316 -110
  635. package/unbundled/definition76.js +307 -106
  636. package/unbundled/definition77.cjs +26 -251
  637. package/unbundled/definition77.js +22 -246
  638. package/unbundled/definition78.cjs +147 -27
  639. package/unbundled/definition78.js +139 -25
  640. package/unbundled/definition79.cjs +230 -117
  641. package/unbundled/definition79.js +227 -107
  642. package/unbundled/definition8.cjs +17 -10
  643. package/unbundled/definition8.js +17 -9
  644. package/unbundled/definition80.cjs +28 -203
  645. package/unbundled/definition80.js +26 -193
  646. package/unbundled/definition81.cjs +125 -477
  647. package/unbundled/definition81.js +118 -473
  648. package/unbundled/definition82.cjs +220 -0
  649. package/unbundled/definition82.js +203 -0
  650. package/unbundled/definition83.cjs +517 -0
  651. package/unbundled/definition83.js +498 -0
  652. package/unbundled/definition9.cjs +4 -3
  653. package/unbundled/definition9.js +4 -2
  654. package/unbundled/delegates-aria.cjs +4 -2
  655. package/unbundled/delegates-aria.js +4 -2
  656. package/unbundled/divider.cjs +8 -3
  657. package/unbundled/divider.js +3 -3
  658. package/unbundled/en-US.cjs +34 -33
  659. package/unbundled/en-US.js +34 -33
  660. package/unbundled/extractOptions.cjs +5 -5
  661. package/unbundled/extractOptions.js +2 -2
  662. package/unbundled/feedback-message.cjs +59 -0
  663. package/unbundled/feedback-message.js +48 -0
  664. package/unbundled/form-associated.cjs +1 -4
  665. package/unbundled/form-associated.js +1 -3
  666. package/unbundled/form-element.cjs +0 -1
  667. package/unbundled/icon.cjs +66 -0
  668. package/unbundled/icon.js +61 -0
  669. package/unbundled/kbd-shortcut.cjs +0 -1
  670. package/unbundled/linkable.cjs +1 -2
  671. package/unbundled/linkable.js +1 -1
  672. package/unbundled/listbox.cjs +8 -5
  673. package/unbundled/listbox.js +7 -3
  674. package/unbundled/localized.cjs +0 -1
  675. package/unbundled/mixins.cjs +3 -53
  676. package/unbundled/mixins.js +3 -46
  677. package/unbundled/numberConverter.cjs +8 -3
  678. package/unbundled/numberConverter.js +8 -3
  679. package/unbundled/optgroup.cjs +65 -0
  680. package/unbundled/optgroup.js +54 -0
  681. package/unbundled/option.cjs +183 -0
  682. package/unbundled/option.js +166 -0
  683. package/unbundled/picker-field.template.cjs +1 -2
  684. package/unbundled/picker-field.template.js +1 -1
  685. package/unbundled/randomId.cjs +0 -1
  686. package/unbundled/{chunk.cjs → rolldown-runtime.cjs} +1 -1
  687. package/unbundled/scrollIntoView.cjs +0 -1
  688. package/unbundled/scrollIntoView.js +0 -1
  689. package/unbundled/slider.template.cjs +340 -2
  690. package/unbundled/slider.template.js +338 -5
  691. package/unbundled/text-field.cjs +1 -1
  692. package/unbundled/text-field.js +1 -1
  693. package/unbundled/time-selection-picker.template.cjs +3 -4
  694. package/unbundled/time-selection-picker.template.js +3 -3
  695. package/unbundled/vivid-element.cjs +63 -4
  696. package/unbundled/vivid-element.js +63 -3
  697. package/unbundled/with-contextual-help.cjs +0 -1
  698. package/unbundled/with-error-text.cjs +0 -1
  699. package/unbundled/with-success-text.cjs +0 -1
  700. package/video-player/definition.cjs +1 -1
  701. package/video-player/definition.js +1 -1
  702. package/video-player/index.cjs +31 -31
  703. package/video-player/index.js +2094 -2085
  704. package/visually-hidden/index.cjs +1 -1
  705. package/vivid.api.json +807 -1341
  706. package/lib/action-group/variations.browser-spec.d.ts +0 -1
  707. package/lib/alert/variations.browser-spec.d.ts +0 -1
  708. package/lib/audio-player/variations.browser-spec.d.ts +0 -1
  709. package/lib/avatar/variations.browser-spec.d.ts +0 -1
  710. package/lib/badge/variations.browser-spec.d.ts +0 -1
  711. package/lib/banner/variations.browser-spec.d.ts +0 -1
  712. package/lib/breadcrumb-item/variations.browser-spec.d.ts +0 -1
  713. package/lib/button/variations.browser-spec.d.ts +0 -1
  714. package/lib/calendar/variations.browser-spec.d.ts +0 -1
  715. package/lib/calendar-event/variations.browser-spec.d.ts +0 -1
  716. package/lib/card/variations.browser-spec.d.ts +0 -1
  717. package/lib/checkbox/variations.browser-spec.d.ts +0 -1
  718. package/lib/color-picker/variations.browser-spec.d.ts +0 -1
  719. package/lib/combobox/variations.browser-spec.d.ts +0 -1
  720. package/lib/contextual-help/variations.browser-spec.d.ts +0 -1
  721. package/lib/country/variations.browser-spec.d.ts +0 -1
  722. package/lib/data-grid/variations.browser-spec.d.ts +0 -1
  723. package/lib/date-picker/variations.browser-spec.d.ts +0 -1
  724. package/lib/date-range-picker/variations.browser-spec.d.ts +0 -1
  725. package/lib/date-time-picker/variations.browser-spec.d.ts +0 -1
  726. package/lib/dial-pad/variations.browser-spec.d.ts +0 -1
  727. package/lib/dialog/variations.browser-spec.d.ts +0 -1
  728. package/lib/divider/variations.browser-spec.d.ts +0 -1
  729. package/lib/empty-state/variations.browser-spec.d.ts +0 -1
  730. package/lib/fab/variations.browser-spec.d.ts +0 -1
  731. package/lib/file-picker/variations.browser-spec.d.ts +0 -1
  732. package/lib/flag/variations.browser-spec.d.ts +0 -1
  733. package/lib/header/variations.browser-spec.d.ts +0 -1
  734. package/lib/icon/variations.browser-spec.d.ts +0 -1
  735. package/lib/kbd-key/variations.browser-spec.d.ts +0 -1
  736. package/lib/kbd-shortcut/variations.browser-spec.d.ts +0 -1
  737. package/lib/layout/variations.browser-spec.d.ts +0 -1
  738. package/lib/menu/variations.browser-spec.d.ts +0 -1
  739. package/lib/menu-item/variations.browser-spec.d.ts +0 -1
  740. package/lib/nav/variations.browser-spec.d.ts +0 -1
  741. package/lib/nav-disclosure/variations.browser-spec.d.ts +0 -1
  742. package/lib/nav-item/variations.browser-spec.d.ts +0 -1
  743. package/lib/note/variations.browser-spec.d.ts +0 -1
  744. package/lib/number-field/variations.browser-spec.d.ts +0 -1
  745. package/lib/optgroup/variations.browser-spec.d.ts +0 -1
  746. package/lib/option/variations.browser-spec.d.ts +0 -1
  747. package/lib/pagination/variations.browser-spec.d.ts +0 -1
  748. package/lib/popover/variations.browser-spec.d.ts +0 -1
  749. package/lib/progress/variations.browser-spec.d.ts +0 -1
  750. package/lib/progress-ring/variations.browser-spec.d.ts +0 -1
  751. package/lib/radio/variations.browser-spec.d.ts +0 -1
  752. package/lib/radio-group/variations.browser-spec.d.ts +0 -1
  753. package/lib/range-slider/variations.browser-spec.d.ts +0 -1
  754. package/lib/rich-text-editor/variations.browser-spec.d.ts +0 -1
  755. package/lib/rich-text-view/variations.browser-spec.d.ts +0 -1
  756. package/lib/searchable-select/variations.browser-spec.d.ts +0 -1
  757. package/lib/select/variations.browser-spec.d.ts +0 -1
  758. package/lib/selectable-box/variations.browser-spec.d.ts +0 -1
  759. package/lib/side-drawer/variations.browser-spec.d.ts +0 -1
  760. package/lib/simple-color-picker/variations.browser-spec.d.ts +0 -1
  761. package/lib/slider/variations.browser-spec.d.ts +0 -1
  762. package/lib/split-button/variations.browser-spec.d.ts +0 -1
  763. package/lib/status/variations.browser-spec.d.ts +0 -1
  764. package/lib/switch/variations.browser-spec.d.ts +0 -1
  765. package/lib/table/variations.browser-spec.d.ts +0 -1
  766. package/lib/tabs/variations.browser-spec.d.ts +0 -1
  767. package/lib/tag/variations.browser-spec.d.ts +0 -1
  768. package/lib/text-area/variations.browser-spec.d.ts +0 -1
  769. package/lib/text-field/variations.browser-spec.d.ts +0 -1
  770. package/lib/time-picker/variations.browser-spec.d.ts +0 -1
  771. package/lib/toggletip/variations.browser-spec.d.ts +0 -1
  772. package/lib/tooltip/variations.browser-spec.d.ts +0 -1
  773. package/lib/tree-item/variations.browser-spec.d.ts +0 -1
  774. package/lib/video-player/variations.browser-spec.d.ts +0 -1
  775. /package/lib/{accordion-item/variations.browser-spec.d.ts → form-field/index.d.ts} +0 -0
  776. /package/lib/{accordion/variations.browser-spec.d.ts → listbox/index.d.ts} +0 -0
  777. /package/unbundled/{chunk.js → rolldown-runtime.js} +0 -0
@@ -1,1019 +1,810 @@
1
- import { d as createRegisterFunction, t as VividElement, u as defineVividComponent } from "./vivid-element.js";
2
- import { r as Icon, t as iconDefinition } from "./definition.js";
1
+ import { d as createRegisterFunction, u as defineVividComponent } from "./vivid-element.js";
2
+ import { t as iconDefinition } from "./definition.js";
3
3
  import { t as __decorate } from "./decorate.js";
4
4
  import { a as affixIconTemplateFactory, i as IconWrapper, n as AffixIconWithTrailing } from "./affix.js";
5
- import { n as delegateAria, t as DelegatesAria } from "./delegates-aria.js";
6
- import { r as ProgressRing, t as progressRingDefinition } from "./definition5.js";
5
+ import { t as componentEnum } from "./component-enum.js";
7
6
  import { n as FormAssociated } from "./form-associated.js";
8
7
  import { t as Localized } from "./localized.js";
9
8
  import { i as Button, r as chevronTemplateFactory, t as buttonDefinition } from "./definition6.js";
9
+ import { t as handleEscapeKeyAndStopPropogation } from "./dialog.js";
10
10
  import { i as Popup, t as popupDefinition } from "./definition9.js";
11
- import { t as Divider } from "./divider.js";
12
- import { r as feedbackMessageDefinition, t as WithFeedback } from "./mixins.js";
11
+ import { n as applyHostSemantics, t as HostSemantics } from "./host-semantics.js";
12
+ import { n as feedbackMessageDefinition } from "./feedback-message.js";
13
13
  import { t as FormElement } from "./form-element.js";
14
14
  import { t as WithErrorText } from "./with-error-text.js";
15
15
  import { t as WithSuccessText } from "./with-success-text.js";
16
+ import { n as WithLightDOMFeedback } from "./mixins.js";
16
17
  import { t as WithContextualHelp } from "./with-contextual-help.js";
17
- import { i as isListboxOption, r as ListboxOption, t as listboxOptionDefinition } from "./definition29.js";
18
- import { i as isOptgroup, t as optgroupDefinition } from "./definition30.js";
19
- import { t as extractOptions } from "./extractOptions.js";
20
- import { t as dividerDefinition } from "./definition36.js";
21
- import { t as scrollIntoView } from "./scrollIntoView.js";
22
- import { Observable, Updates, attr, html, nullableNumberConverter, observable, ref, repeat, slotted, when } from "@microsoft/fast-element";
23
- import { classNames } from "@microsoft/fast-web-utilities";
24
- //#region src/lib/searchable-select/searchable-select.scss?inline
25
- var searchable_select_default = ".label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}.chevron{font:var(--vvd-typography-base-extended);flex-shrink:0;display:flex;transform:rotate(0)}@media (prefers-reduced-motion:no-preference){.chevron{transition:transform .2s}}:host([data-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:not(.disabled) .chevron{cursor:pointer}.disabled .chevron{color:var(--_low-ink-color);cursor:not-allowed}:host(:focus-visible){outline:none}:host{--_low-ink-color:var(--vvd-color-neutral-600);inline-size:300px;display:inline-block}:host([disabled]){--_low-ink-color:var(--vvd-color-neutral-400);cursor:not-allowed}.control-wrapper{flex-direction:column;gap:4px;display:flex}.label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.selection-count{color:var(--_low-ink-color);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));--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-canvas);--_appearance-color-outline:var(--vvd-color-neutral-500)}.fieldset.appearance-ghost{--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}@media (hover:hover){.fieldset: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(--vvd-color-neutral-700)}.fieldset: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.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(--vvd-color-neutral-700)}.fieldset.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:disabled{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:var(--vvd-color-neutral-100);--_appearance-color-outline:var(--vvd-color-neutral-300)}.fieldset:disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.fieldset.disabled{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:var(--vvd-color-neutral-100);--_appearance-color-outline:var(--vvd-color-neutral-300)}.fieldset.disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.fieldset.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.readonly:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.fieldset.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.error:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notset;--_appearance-color-fill:var(--vvd-color-alert-50);--_appearance-color-outline:transparent}.fieldset.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.success:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notset;--_appearance-color-fill:var(--vvd-color-success-50);--_appearance-color-outline:transparent}.fieldset{--_searchable-select-block-size:24px;--_searchable-select-padding-block:8px;--_searchable-select-padding-inline:16px;--_searchable-select-icon-size:20px;--_searchable-select-border-radius:8px;--_searchable-select-gap:8px;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);justify-content:space-between;align-items:center;gap:var(--_searchable-select-gap);padding-block:var(--_searchable-select-padding-block);padding-inline:var(--_searchable-select-padding-inline);transition:box-shadow .2s,background-color .2s;display:flex}.fieldset.size-condensed{--_searchable-select-block-size:20px;--_searchable-select-padding-block:6px;--_searchable-select-padding-inline:12px;--_searchable-select-gap:6px}.fieldset.size-condensed:not(.shape-pill){--_searchable-select-border-radius:4px}@supports selector(:has(*)){.fieldset:not(.has-highlighted-option):has(input:focus){box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent}}@supports not selector(:has(*)){.fieldset:not(.has-highlighted-option):focus-within{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent}}:host(:not([shape=pill])) .fieldset{border-radius:var(--_searchable-select-border-radius)}:host([shape=pill]) .fieldset{border-radius:24px}.popup-wrapper{position:relative}.content-area{gap:var(--_searchable-select-gap);min-block-size:var(--_searchable-select-block-size);flex-direction:column;flex:1;display:flex;overflow:hidden}.tag-row{gap:var(--_searchable-select-gap);inline-size:100%;display:flex}.tag-row.contains-only-input:not(:focus-within){display:contents}.tag-wrapper{overflow:hidden}.tag{max-inline-size:100%}input{box-sizing:border-box;block-size:var(--_searchable-select-block-size);font:var(--vvd-typography-base);background:0 0;border:none;outline:none;flex:1;min-inline-size:min(100px,40%);max-inline-size:100%}.contains-only-input input:not(:focus){opacity:0;pointer-events:none;block-size:0;inline-size:0;min-inline-size:0;position:absolute}.listbox{max-block-size:var(--searchable-select-height,408px);--_suppressable-focus-shadow:none;--_suppressable-focus-outline:none;--_suppressable-focus-outline-offset:0;flex-direction:column;gap:2px;padding:4px;display:flex;overflow-y:auto}.empty-message{color:var(--vvd-color-neutral-300);font:var(--vvd-typography-base);text-align:center;justify-content:center;align-items:center;min-block-size:40px;display:flex}::part(popup-base){inline-size:max-content;min-inline-size:var(--_searchable-select-fixed-width,100%)}slot[name=icon]{font-size:var(--_searchable-select-icon-size)}.visually-hidden{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.divider{margin-block:10px;margin-inline:12px}";
18
+ import { t as ListboxOption } from "./option.js";
19
+ import { t as listboxOptionDefinition } from "./definition29.js";
20
+ import { t as optgroupDefinition } from "./definition30.js";
21
+ import { t as Listbox } from "./listbox.js";
22
+ import { Observable, Updates, attr, html, observable, ref, slotted, volatile, when } from "@microsoft/fast-element";
23
+ import { classNames, inRange, keyArrowDown, keyArrowUp, keyEnd, keyEnter, keyEscape, keyHome, keySpace, keyTab, uniqueId } from "@microsoft/fast-web-utilities";
24
+ //#region src/lib/select/select.scss?inline
25
+ var select_default = ".label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}.chevron{font:var(--vvd-typography-base-extended);flex-shrink:0;display:flex;transform:rotate(0)}@media (prefers-reduced-motion:no-preference){.chevron{transition:transform .2s}}:host([data-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{--_low-ink-color:var(--vvd-color-neutral-600);--focus-stroke-gap-color:transparent;flex-direction:column;gap:4px;display:inline-flex}:host([disabled]){--_low-ink-color:var(--vvd-color-neutral-600);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.control{border-radius:var(--_select-control-border-radius);block-size:var(--_select-block-size);padding-inline:var(--_select-padding-inline);--_select-icon-size:calc(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(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);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);justify-content:space-between;align-items:center;gap:8px;transition:box-shadow .2s,background-color .2s;display:flex}.control.size-condensed{--_select-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_select-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_select-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2)}.control.size-condensed:not(.shape-pill){--_select-control-border-radius:4px}.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}.listbox{max-height:var(--select-height,408px);flex-direction:column;gap:2px;padding:4px;display:flex;overflow-y:auto}:host([multiple]:focus-visible) .listbox{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));border-radius:8px}.selected-value{white-space:nowrap;flex-grow:1;align-items:center;column-gap:12px;display:flex;overflow:hidden}.selected-value .text{text-overflow:ellipsis;max-inline-size:100%;overflow:hidden}.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}@supports selector(:has(*)){:host(:focus-within) .control:not(.has-activedescendant,:has(.clear-button:focus)){--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){:host(:focus-within) .control:not(.has-activedescendant){--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}:host(:not(:focus-visible)){--_suppressable-focus-shadow:none;--_suppressable-focus-outline:none;--_suppressable-focus-outline-offset:0}:host([multiple]) .clear-button{margin-inline-start:auto}:host([multiple][clearable]) .label-wrapper{min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16))}";
26
26
  //#endregion
27
- //#region src/lib/searchable-select/option-tag.scss?inline
28
- var option_tag_default = ":host{display:block}.base.connotation-cta{--_connotation-color-contrast:var(--vvd-option-tag-cta-contrast,var(--vvd-color-cta-800))}.base:not(.connotation-cta){--_connotation-color-contrast:var(--vvd-option-tag-accent-contrast,var(--vvd-color-neutral-800))}.base{--_option-tag-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16));box-sizing:border-box;background-color:var(--fill-color);block-size:var(--_option-tag-block-size);box-shadow:inset 0 0 0 1px var(--outline-color);color:var(--text-color);font:var(--vvd-typography-base-bold);user-select:none;align-items:center;column-gap:8px;max-inline-size:100%;padding-inline:8px;display:flex;position:relative}.base.size-condensed{--_option-tag-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 20));padding-inline:4px}.base:not(.disabled){--text-color:var(--_connotation-color-contrast);--fill-color:var(--_connotation-color-soft);--outline-color:transparent}@supports (background-color:color-mix(in srgb, black 50%, white)){.base:not(.disabled){--fill-color:color-mix(in sRGB, var(--_connotation-color-contrast), transparent 87.5%)}}.base.disabled{--text-color:var(--vvd-color-neutral-300);--fill-color:var(--vvd-color-neutral-200);--outline-color:transparent}@supports (background-color:color-mix(in srgb, black 50%, white)){.base.disabled{--fill-color:color-mix(in sRGB, var(--vvd-color-neutral-800), transparent 87.5%)}}.base:not(.shape-pill){border-radius:4px}.base.shape-pill{border-radius:16px}.label{text-overflow:ellipsis;white-space:nowrap;max-inline-size:100%;overflow:hidden}slot[name=icon]{font-size:calc(var(--_option-tag-block-size) / 1.5);line-height:1}.icon-placeholder{inline-size:calc(var(--_option-tag-block-size) / 1.5)}.remove-button{border-radius:inherit;cursor:pointer;outline:none;align-items:center;display:flex}.disabled .remove-button{pointer-events:none}.remove-button:focus-visible:before{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));z-index:1;border-radius:inherit;content:\"\";pointer-events:none;display:block;position:absolute;inset:0}";
29
- //#endregion
30
- //#region src/lib/searchable-select/searchable-select.ts
31
- var TagGapPx = 8;
32
- var InputMinWidthPx = 100;
33
- var PageSize = 10;
34
- var isFormAssociatedTryingToSetFormValue = (value) => typeof value === "string";
27
+ //#region src/lib/select/select.ts
28
+ var selectAppearance = componentEnum(["fieldset", "ghost"], "fieldset");
35
29
  /**
36
30
  * @public
37
- * @component searchable-select
38
- * @slot - Holds the available options.
39
- * @slot icon - The preferred way to add an icon to the control.
40
- * @slot meta - Slot to add meta content to the control.
41
- * @slot helper-text - Describes how to use the component. Alternative to the `helper-text` attribute.
42
- * @slot no-options - Message that appears when no options are available.
43
- * @slot no-matches - Message that appears when no options match the search query.
44
- * @slot loading-options - Message that appears there are no options to display and the component is in a loading state.
45
- * @event {CustomEvent<undefined>} input - Fired when the selected options change
46
- * @event {CustomEvent<undefined>} search-text-change - Fired when the search text changes
47
- * @event {CustomEvent<undefined>} change - Fired when the selected options change
31
+ * @component select
32
+ * @slot - Default slot.
33
+ * @slot icon - The preferred way to add an icon to the select control.
34
+ * @slot meta - Slot to add meta content to the select control.
35
+ * @slot helper-text - Describes how to use the select. Alternative to the `helper-text` attribute.
36
+ * @event {CustomEvent<undefined>} input - Fires a custom 'input' event when the value updates
37
+ * @event {CustomEvent<HTMLElement>} change - Fires a custom 'change' event when the value updates
48
38
  * @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
49
- * @vueModel values values input,@lazy:change `event.currentTarget.values`
50
39
  * @testAction selectOptionByValue selectOptionByValue
51
40
  * @testAction selectOptionByText selectOptionByText
52
- * @testQuery values values
53
- * @testQuery selectedOptions selectedOptionsText
54
41
  */
55
- var SearchableSelect = class extends WithContextualHelp(WithFeedback(WithErrorText(WithSuccessText(FormElement(DelegatesAria(AffixIconWithTrailing(Localized(FormAssociated(VividElement))))))))) {
42
+ var Select = class extends WithLightDOMFeedback(WithContextualHelp(WithErrorText(WithSuccessText(Localized(FormElement(HostSemantics(AffixIconWithTrailing(FormAssociated(Listbox))))))))) {
56
43
  constructor(..._args) {
57
44
  super(..._args);
58
- this.fixedDropdown = false;
45
+ this.proxy = document.createElement("select");
46
+ this.activeIndex = -1;
47
+ this.rangeStartIndex = -1;
59
48
  this.open = false;
60
- this.multiple = false;
61
- this.externalTags = false;
62
- this.maxLines = null;
63
- this.values = [];
64
- this.initialValues = [];
65
- this._currentSearchText = null;
66
- this._areOptionsInitialized = false;
67
- this.#slottedOptionsChangeHandler = { handleChange: (source, _) => {
68
- if (source.selected && !this.values.includes(source.value)) this.values = [...this.values, source.value];
69
- else if (!source.selected && this.values.includes(source.value)) this.values = this.values.filter((option) => option !== source.value);
70
- } };
71
- this.#clonedTagIcons = /* @__PURE__ */ new Map();
72
- this._filteredOptions = [];
73
- this._filteredEnabledOptions = [];
74
- this.loading = false;
75
- this._highlightedOptionIndex = null;
76
- this._numElidedTags = 0;
77
- this._tagRows = [];
78
- this._lastTagRow = [];
49
+ this.listboxId = uniqueId("listbox-");
50
+ this.maxHeight = 0;
51
+ this.fixedDropdown = false;
52
+ this._feedbackWrapper = null;
53
+ this._isResetting = false;
79
54
  this.clearable = false;
80
- this.maxSelected = null;
81
- this._slottedDisabledOptions = [];
82
- this.enableSelectAll = false;
83
- this.proxy = document.createElement("input");
84
- this.setFormValue = (value, state) => {
85
- if (isFormAssociatedTryingToSetFormValue(value)) return;
86
- super.setFormValue(value, state);
87
- };
88
- this._changeDescription = "";
89
- this.#resizeObserver = new ResizeObserver(() => {
90
- this.#updateTagLayout();
91
- });
92
- this.#onOptgroupChange = () => {
93
- /* v8 ignore else */
94
- if (this._slottedElements) this._slottedElementsChanged();
95
- };
96
- }
97
- /** @internal */
98
- openChanged() {
99
- if (!this.open) this.#transitionHighlightedOptionTo(null);
55
+ this._isClearButtonFocused = false;
56
+ }
57
+ /**
58
+ * Returns the last checked option.
59
+ *
60
+ * @internal
61
+ */
62
+ get activeOption() {
63
+ return this.options[this.activeIndex];
64
+ }
65
+ /**
66
+ * Returns the list of checked options.
67
+ *
68
+ * @internal
69
+ */
70
+ get checkedOptions() {
71
+ return this.options.filter((o) => o.checked);
72
+ }
73
+ /**
74
+ * Returns the index of the first selected option.
75
+ *
76
+ * @internal
77
+ */
78
+ get firstSelectedOptionIndex() {
79
+ return this.options.indexOf(this.firstSelectedOption);
80
+ }
81
+ /**
82
+ * Updates the `ariaActiveDescendant` property when the active index changes.
83
+ *
84
+ * @internal
85
+ */
86
+ activeIndexChanged(_, next) {
87
+ this._activeDescendant = this.options[next]?.id ?? "";
88
+ this.focusAndScrollOptionIntoView();
89
+ }
90
+ /**
91
+ * Toggles the checked state for the currently active option.
92
+ *
93
+ * @remarks
94
+ * Multiple-selection mode only.
95
+ *
96
+ * @internal
97
+ */
98
+ checkActiveIndex() {
99
+ const activeItem = this.activeOption;
100
+ /* v8 ignore else -- @preserve */
101
+ if (activeItem) activeItem.checked = true;
102
+ }
103
+ /**
104
+ * Sets the active index to the first option and marks it as checked.
105
+ *
106
+ * @remarks
107
+ * Multi-selection mode only.
108
+ *
109
+ * @param preserveChecked - mark all options unchecked before changing the active index
110
+ *
111
+ * @internal
112
+ */
113
+ checkFirstOption(preserveChecked) {
114
+ const firstSelectableIndex = this.getNextSelectableIndex(0);
115
+ if (firstSelectableIndex === -1) return;
116
+ if (preserveChecked) {
117
+ if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
118
+ this.options.forEach((o, i) => {
119
+ o.checked = inRange(i, firstSelectableIndex, this.rangeStartIndex + 1) && !o.disabled;
120
+ });
121
+ } else this.uncheckAllOptions();
122
+ this.activeIndex = firstSelectableIndex;
123
+ this.checkActiveIndex();
124
+ }
125
+ /**
126
+ * Decrements the active index and sets the matching option as checked.
127
+ *
128
+ * @remarks
129
+ * Multi-selection mode only.
130
+ *
131
+ * @param preserveChecked - mark all options unchecked before changing the active index
132
+ *
133
+ * @internal
134
+ */
135
+ checkLastOption(preserveChecked) {
136
+ const lastSelectableIndex = this.getPreviousSelectableIndex(this.length - 1);
137
+ if (lastSelectableIndex === -1) return;
138
+ if (preserveChecked) {
139
+ if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
140
+ this.options.forEach((o, i) => {
141
+ o.checked = inRange(i, this.rangeStartIndex, lastSelectableIndex + 1) && !o.disabled;
142
+ });
143
+ } else this.uncheckAllOptions();
144
+ this.activeIndex = lastSelectableIndex;
145
+ this.checkActiveIndex();
146
+ }
147
+ /**
148
+ * Increments the active index and marks the matching option as checked.
149
+ *
150
+ * @remarks
151
+ * Multiple-selection mode only.
152
+ *
153
+ * @param preserveChecked - mark all options unchecked before changing the active index
154
+ *
155
+ * @internal
156
+ */
157
+ checkNextOption(preserveChecked) {
158
+ const nextIndex = this.getNextSelectableIndex(this.activeIndex + 1);
159
+ if (nextIndex === -1) return;
160
+ if (preserveChecked) {
161
+ if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
162
+ this.options.forEach((o, i) => {
163
+ o.checked = inRange(i, this.rangeStartIndex, nextIndex + 1) && !o.disabled;
164
+ });
165
+ } else this.uncheckAllOptions();
166
+ this.activeIndex = nextIndex;
167
+ this.checkActiveIndex();
168
+ }
169
+ /**
170
+ * Decrements the active index and marks the matching option as checked.
171
+ *
172
+ * @remarks
173
+ * Multiple-selection mode only.
174
+ *
175
+ * @param preserveChecked - mark all options unchecked before changing the active index
176
+ *
177
+ * @internal
178
+ */
179
+ checkPreviousOption(preserveChecked) {
180
+ const previousIndex = this.getPreviousSelectableIndex(this.activeIndex - 1);
181
+ if (previousIndex === -1) return;
182
+ if (preserveChecked) {
183
+ if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
184
+ if (this.checkedOptions.length === 1) this.rangeStartIndex += 1;
185
+ this.options.forEach((o, i) => {
186
+ o.checked = inRange(i, previousIndex, this.rangeStartIndex + 1) && !o.disabled;
187
+ });
188
+ } else this.uncheckAllOptions();
189
+ this.activeIndex = previousIndex;
190
+ this.checkActiveIndex();
191
+ }
192
+ /** @internal */
193
+ focusAndScrollOptionIntoView() {
194
+ super.focusAndScrollOptionIntoView(this.activeOption);
195
+ }
196
+ /**
197
+ * In multiple-selection mode:
198
+ * If any options are selected, the first selected option is checked when
199
+ * the listbox receives focus. If no options are selected, the first
200
+ * selectable option is checked.
201
+ *
202
+ * @internal
203
+ */
204
+ focusinHandler(e) {
205
+ if (!this.multiple) {
206
+ super.focusinHandler(e);
207
+ return;
208
+ }
209
+ /* v8 ignore else -- @preserve */
210
+ if (!this.shouldSkipFocus && e.target === e.currentTarget) {
211
+ this.uncheckAllOptions();
212
+ if (this.activeIndex === -1) this.activeIndex = this.firstSelectedOptionIndex !== -1 ? this.firstSelectedOptionIndex : 0;
213
+ this.checkActiveIndex();
214
+ this.setSelectedOptions();
215
+ this.focusAndScrollOptionIntoView();
216
+ }
217
+ this.shouldSkipFocus = false;
100
218
  }
101
- /** @internal */
102
- valuesChanged() {
103
- if (!this._areOptionsInitialized) return;
104
- if (!this.multiple && this.values.length > 1) {
105
- this.values = [this.values[0]];
219
+ /** Sets an option as selected and gives it focus. */
220
+ setSelectedOptions() {
221
+ if (!this.multiple) {
222
+ super.setSelectedOptions();
106
223
  return;
107
224
  }
108
- if (this.values.some((value) => !this.#isValidValue(value))) {
109
- this.values = this.values.filter((value) => this.#isValidValue(value));
225
+ /* v8 ignore else -- @preserve */
226
+ if (this.$fastController.isConnected && this.options) {
227
+ this.selectedOptions = this.options.filter((o) => o.selected);
228
+ this.focusAndScrollOptionIntoView();
229
+ }
230
+ }
231
+ /**
232
+ * Toggles the selected state of the provided options. If any provided items
233
+ * are in an unselected state, all items are set to selected. If every
234
+ * provided item is selected, they are all unselected.
235
+ *
236
+ * @internal
237
+ */
238
+ toggleSelectedForAllCheckedOptions() {
239
+ const enabledCheckedOptions = this.checkedOptions.filter((o) => !o.disabled);
240
+ const force = !enabledCheckedOptions.every((o) => o.selected);
241
+ enabledCheckedOptions.forEach((o) => o.selected = force);
242
+ this.selectedIndex = this.options.indexOf(enabledCheckedOptions[enabledCheckedOptions.length - 1]);
243
+ this.setSelectedOptions();
244
+ this.updateValue(true);
245
+ }
246
+ /** @internal */
247
+ typeaheadBufferChanged(prev, next) {
248
+ if (!this.multiple) {
249
+ super.typeaheadBufferChanged(prev, next);
110
250
  return;
111
251
  }
112
- this.value = this.values.length ? this.values[0] : "";
113
- this.#updateSelectionLimit();
114
- this.#updateSelectedOnSlottedOptions();
115
- if (this.$fastController.isConnected) this.#updateTagLayout();
116
- this.#updateFormValue();
117
- }
118
- #updateValuesThroughUserInteraction(newValues) {
119
- this.values = newValues;
120
- this.$emit("change", void 0, { bubbles: false });
121
- this.$emit("input", void 0, { bubbles: false });
122
- }
123
- #updateValuesWhileMaintainingOrder(newValues) {
124
- const oldSet = new Set(this.values);
125
- const newSet = new Set(newValues);
126
- this.values = [...this.values].filter((v) => newSet.has(v)).concat([...newValues].filter((v) => !oldSet.has(v)));
252
+ /* v8 ignore if -- @preserve */
253
+ if (this.$fastController.isConnected) {
254
+ const typeaheadMatches = this.getTypeaheadMatches();
255
+ const activeIndex = this.options.indexOf(typeaheadMatches[0]);
256
+ if (activeIndex > -1) {
257
+ this.activeIndex = activeIndex;
258
+ this.uncheckAllOptions();
259
+ this.checkActiveIndex();
260
+ }
261
+ this.typeaheadExpired = false;
262
+ }
127
263
  }
128
- /** @internal */
129
- initialValuesChanged() {
130
- if (!this.dirtyValue) {
131
- this.values = this.initialValues;
132
- this.dirtyValue = false;
264
+ /**
265
+ * Unchecks all options.
266
+ *
267
+ * @remarks
268
+ * Multiple-selection mode only.
269
+ *
270
+ * @param preserveChecked - reset the rangeStartIndex
271
+ *
272
+ * @internal
273
+ */
274
+ uncheckAllOptions(preserveChecked = false) {
275
+ this.options.forEach((o) => o.checked = false);
276
+ /* v8 ignore else -- @preserve */
277
+ if (!preserveChecked) this.rangeStartIndex = -1;
278
+ }
279
+ /**
280
+ * Sets focus when the open property changes.
281
+ *
282
+ * @internal
283
+ */
284
+ openChanged(prev, next) {
285
+ if (!this.collapsible) return;
286
+ if (this.open) {
287
+ this.focusAndScrollOptionIntoView();
288
+ this.indexWhenOpened = this.selectedIndex;
289
+ Updates.enqueue(() => this.focus());
290
+ return;
133
291
  }
292
+ const didClose = prev && !next;
293
+ const selectionChangedWhileOpen = this.indexWhenOpened !== this.selectedIndex;
294
+ if (didClose && selectionChangedWhileOpen) this.updateValue(true);
134
295
  }
135
- #isValidValue(value) {
136
- return this._slottedOptions.some((option) => option.value === value);
296
+ /**
297
+ * The component is collapsible when in single-selection mode.
298
+ *
299
+ * @internal
300
+ */
301
+ get collapsible() {
302
+ return !this.multiple;
137
303
  }
138
304
  /** @internal */
139
305
  valueChanged(prev, next) {
306
+ const nextSelectedIndex = this.options.findIndex((el) => el.value === next);
307
+ const validNextSelectedIndex = this._validSelectedIndex(nextSelectedIndex);
308
+ const nextValue = this.options[validNextSelectedIndex]?.value ?? "";
309
+ if (this.selectedIndex !== validNextSelectedIndex) this.selectedIndex = validNextSelectedIndex;
310
+ if (next !== nextValue) return;
140
311
  super.valueChanged(prev, next);
141
- if (!this._areOptionsInitialized) return;
142
- const isValidValue = this._slottedOptions.some((option) => option.value === next);
143
- if (this.values[0] !== next) this.values = isValidValue ? [next] : [];
144
- }
145
- get selectedIndex() {
146
- if (this.values.length) return this._slottedOptions.findIndex((option) => option.value === this.values[0]);
147
- else return -1;
148
- }
149
- set selectedIndex(index) {
150
- this.value = this._slottedOptions[index]?.value ?? "";
151
- }
152
- get options() {
153
- return [...this._slottedOptions];
154
- }
155
- get selectedOptions() {
156
- return this._slottedOptions.filter((option) => this.values.includes(option.value));
157
- }
158
- /** @internal */
159
- _currentSearchTextChanged() {
160
- this.#updateFilteredOptions();
161
- this.$emit("search-text-change", void 0, {
162
- bubbles: false,
163
- composed: false
164
- });
165
- }
166
- /** Read-only property containing the current search text. */
167
- get searchText() {
168
- return this._currentSearchText ?? "";
169
- }
170
- /** @internal */
171
- get _inputValue() {
172
- return this._currentSearchText ?? (!this.multiple && this.value !== "" ? this.#textForValue(this.value) ?? "" : "");
173
- }
174
- /** @internal */
175
- _onInputInput(event) {
176
- this._currentSearchText = event.target.value;
177
- }
178
- /** @internal */
179
- _onInputFocus(_) {
180
- this.#updateFilteredOptions();
181
- }
182
- /** @internal */
183
- _onInputBlur(_) {
184
- this.open = false;
185
- this._currentSearchText = null;
186
- this._changeDescription = "";
187
- }
188
- /** @internal */
189
- _onInputKeydown(e) {
190
- if (e.ctrlKey || e.shiftKey) return true;
191
- switch (e.key) {
192
- case "Enter":
193
- this.#selectHighlightedOption();
194
- if (this._inputValue === "") this.open = !this.open;
195
- return false;
196
- case "Escape":
197
- this.open = false;
198
- break;
199
- case "Home":
200
- if (!this.open) {
201
- this.open = true;
202
- break;
203
- }
204
- this.#highlightFirstOption();
205
- return false;
206
- case "End":
207
- if (!this.open) {
208
- this.open = true;
209
- break;
210
- }
211
- this.#highlightLastOption();
212
- return false;
213
- case "PageUp":
214
- if (!this.open) {
215
- this.open = true;
216
- break;
217
- }
218
- this.#highlightPrevPage();
219
- return false;
220
- case "PageDown":
221
- if (!this.open) {
222
- this.open = true;
223
- break;
224
- }
225
- this.#highlightNextPage();
226
- return false;
227
- case "ArrowUp":
228
- if (!this.open) {
229
- this.open = true;
230
- break;
231
- }
232
- this.#highlightPreviousOption();
233
- return false;
234
- case "ArrowDown":
235
- if (!this.open) {
236
- this.open = true;
237
- break;
238
- }
239
- this.#highlightNextOption();
240
- return false;
241
- case "ArrowLeft":
242
- if (this.multiple && this._inputValue === "" && this.values.length && !this.externalTags) {
243
- this.#moveTagFocusTo(this.#nextTagIndexLeft(this.values.length));
244
- return false;
245
- }
246
- return true;
247
- case "Backspace":
248
- if (this.multiple && this._inputValue === "" && this.values.length) {
249
- this._onTagRemoved(this.values[this.values.length - 1]);
250
- return false;
251
- }
252
- return true;
253
- default:
254
- /* v8 ignore next -- @preserve */
255
- if (!this.open) this.open = true;
256
- return true;
312
+ this.updateDisplayValue();
313
+ }
314
+ /**
315
+ * Sets the value and display value to match the first selected option.
316
+ *
317
+ * @param shouldEmit - if true, the input and change events will be emitted
318
+ *
319
+ * @internal
320
+ */
321
+ updateValue(shouldEmit) {
322
+ if (this.$fastController.isConnected) this.value = this.firstSelectedOption?.value ?? "";
323
+ if (shouldEmit) {
324
+ this.$emit("input");
325
+ this.$emit("change", this, {
326
+ bubbles: true,
327
+ composed: void 0
328
+ });
257
329
  }
258
- return true;
259
330
  }
260
- /** @internal */
261
- _slottedElementsChanged() {
262
- this._slottedOptions = extractOptions(this._slottedElements);
331
+ /**
332
+ * Updates the proxy value when the selected index changes.
333
+ *
334
+ * @param prev - the previous selected index
335
+ * @param next - the next selected index
336
+ *
337
+ * @internal
338
+ */
339
+ selectedIndexChanged(prev, next) {
340
+ super.selectedIndexChanged(prev, next);
341
+ this.updateValue();
342
+ }
343
+ /**
344
+ * Handle opening and closing the listbox when the select is clicked.
345
+ *
346
+ * @param e - the mouse event
347
+ * @internal
348
+ */
349
+ clickHandler(e) {
350
+ if (this.disabled || this._isFromContextualHelp(e)) return;
351
+ const clickedOption = e.target.closest(`option,[role=option],[data-vvd-component=option]`);
352
+ if (clickedOption && clickedOption.disabled) return;
353
+ if (this.multiple) {
354
+ this.uncheckAllOptions();
355
+ this.activeIndex = this.options.indexOf(clickedOption);
356
+ this.checkActiveIndex();
357
+ this.toggleSelectedForAllCheckedOptions();
358
+ } else super.clickHandler(e);
359
+ if (this.collapsible) this.open = !this.open;
360
+ return true;
263
361
  }
264
- /** @internal */
265
- _slottedOptionsChanged(oldValue, newValue) {
266
- const hasSlottedOptions = Boolean(this.querySelectorAll(`:not([slot])`).length);
267
- if (!newValue.length && hasSlottedOptions) return;
268
- this._areOptionsInitialized = true;
269
- if (oldValue) {
270
- this._slottedDisabledOptions = [];
271
- for (const option of oldValue) Observable.getNotifier(option).unsubscribe(this.#slottedOptionsChangeHandler, "selected");
362
+ /**
363
+ * Handles focus state when the element or its children lose focus.
364
+ *
365
+ * @param e - The focus event
366
+ * @internal
367
+ */
368
+ focusoutHandler(e) {
369
+ if (this.multiple) this.uncheckAllOptions();
370
+ if (!this.open) return true;
371
+ const focusTarget = e.relatedTarget;
372
+ if (this.isSameNode(focusTarget)) {
373
+ this.focus();
374
+ return;
272
375
  }
273
376
  /* v8 ignore else -- @preserve */
274
- if (newValue) for (const option of newValue) {
275
- option._displayCheckmark = true;
276
- Observable.getNotifier(option).subscribe(this.#slottedOptionsChangeHandler, "selected");
277
- }
278
- const values = [];
279
- for (const option of this._slottedOptions) {
280
- if (option.selected || option.value === this.value || this.values.includes(option.value)) values.push(option.value);
281
- if (option.disabled) this._slottedDisabledOptions.push(option);
282
- }
283
- this.#updateValuesWhileMaintainingOrder(values);
284
- this.#updateFilteredOptions();
285
- this.#updateSelectionLimit();
286
- }
287
- #slottedOptionsChangeHandler;
288
- #updateSelectedOnSlottedOptions() {
289
- for (const option of this._slottedOptions) {
290
- option.selected = this.values.includes(option.value);
291
- this.#updateClonedTagIconOfOption(option);
292
- }
293
- }
294
- #handleOptionInteraction(option) {
295
- const value = option.value;
296
- let newValues;
297
- let shouldClearSearchText = false;
298
- const isSelection = !this.values.includes(value);
299
- if (this.multiple) {
300
- if (isSelection) newValues = [...this.values, value];
301
- else newValues = this.values.filter((option) => option !== value);
302
- shouldClearSearchText = true;
303
- } else {
304
- if (isSelection) {
305
- newValues = [value];
306
- shouldClearSearchText = true;
307
- } else newValues = [];
377
+ if (!this.options.includes(focusTarget)) {
308
378
  this.open = false;
379
+ if (this.indexWhenOpened !== this.selectedIndex) this.updateValue(true);
309
380
  }
310
- this.#updateValuesThroughUserInteraction(newValues);
311
- const optionMessage = isSelection ? this.locale.searchableSelect.optionSelectedMessage(option._getAccessibleName()) : this.locale.searchableSelect.optionDeselectedMessage(option._getAccessibleName());
312
- const maxSelectedMessage = this.multiple && this.maxSelected && this.maxSelected >= 1 ? this.locale.searchableSelect.maxSelectedMessage(this.values.length, this.maxSelected) : "";
313
- this._changeDescription = `${optionMessage} ${maxSelectedMessage}`;
314
- if (shouldClearSearchText) this._currentSearchText = null;
315
- }
316
- #clonedTagIcons;
317
- #tagIconOfOption(option) {
318
- return option.querySelector("[slot=\"tag-icon\"]");
319
- }
320
- /** @internal */
321
- _tagIconSlotName(value) {
322
- return `_tag-icon-${this.values.indexOf(value)}`;
323
- }
324
- #updateClonedTagIconOfOption(option) {
325
- if (option.selected && this.#tagIconOfOption(option)) {
326
- let clone = this.#clonedTagIcons.get(option);
327
- /* v8 ignore else -- @preserve */
328
- if (!clone) {
329
- clone = this.#tagIconOfOption(option).cloneNode(true);
330
- this.#clonedTagIcons.set(option, clone);
331
- }
332
- clone.slot = this._tagIconSlotName(option.value);
333
- this.appendChild(clone);
334
- } else {
335
- const clone = this.#clonedTagIcons.get(option);
336
- if (clone) {
337
- clone.remove();
338
- this.#clonedTagIcons.delete(option);
339
- }
340
- }
341
- }
342
- /** @internal */
343
- optionFilterChanged() {
344
- this.#updateFilteredOptions();
345
381
  }
346
- /** @internal */
347
- loadingChanged(_oldValue, newValue) {
348
- this._changeDescription = this.locale.searchableSelect.loadingOptionsMessage;
349
- if (_oldValue && !newValue) this._changeDescription = "";
350
- }
351
- #updateFilteredOptions() {
352
- const newFilteredOptions = [];
353
- const optionFilter = this.optionFilter ?? ((option, searchText) => option.text.toLowerCase().includes(searchText.toLowerCase()));
354
- for (const option of this._slottedOptions ?? []) {
355
- option._vvdSearchText = this.searchText;
356
- const matches = !this.searchText || optionFilter(option, this.searchText);
357
- option._isNotMatching = !matches;
358
- if (!option.hidden && matches) newFilteredOptions.push(option);
359
- }
360
- /* v8 ignore next -- _slottedElements not yet set if filtering is triggered before slot initialises */
361
- for (const el of this._slottedElements ?? []) if (isOptgroup(el)) {
362
- const hasVisibleOption = Array.from(el.children).some((child) => isListboxOption(child) && !child._isNotMatching && !child.hidden);
363
- el.style.display = hasVisibleOption ? "" : "none";
364
- }
365
- this.#transitionHighlightedOptionTo(null);
366
- this._filteredOptions = newFilteredOptions;
367
- const enabled = newFilteredOptions.filter((o) => !o.disabled);
368
- if (this._selectAllOption) this._filteredEnabledOptions = [this._selectAllOption, ...enabled];
369
- else this._filteredEnabledOptions = enabled;
370
- }
371
- #transitionHighlightedOptionTo(index) {
372
- if (typeof this._highlightedOptionIndex === "number") {
373
- const prevOption = this._filteredEnabledOptions[this._highlightedOptionIndex];
374
- prevOption._highlighted = false;
375
- }
376
- if (typeof index === "number") if (!this._filteredEnabledOptions.length) index = null;
377
- else index = Math.max(0, Math.min(this._filteredEnabledOptions.length - 1, index));
378
- this._highlightedOptionIndex = index;
379
- if (typeof this._highlightedOptionIndex === "number") {
380
- const highlightedOption = this._filteredEnabledOptions[this._highlightedOptionIndex];
381
- highlightedOption._highlighted = true;
382
- scrollIntoView(highlightedOption, this._listbox, "nearest");
383
- this._changeDescription = this.locale.searchableSelect.optionFocusedMessage(highlightedOption._getAccessibleName(), this._highlightedOptionIndex + 1, this._filteredEnabledOptions.length, highlightedOption.selected);
384
- }
382
+ /**
383
+ * Updates the value when an option's value changes.
384
+ *
385
+ * @param source - the source object
386
+ * @param propertyName - the property to evaluate
387
+ *
388
+ * @internal
389
+ */
390
+ handleChange(source, propertyName) {
391
+ super.handleChange(source, propertyName);
392
+ if (propertyName === "value") this.updateValue();
393
+ }
394
+ /**
395
+ * Prevents focus when a scrollbar is clicked.
396
+ *
397
+ * @param e - the mouse event object
398
+ *
399
+ * @internal
400
+ */
401
+ mousedownHandler(e) {
402
+ if (e.offsetX >= 0 && e.offsetX <= this.listbox.scrollWidth) return super.mousedownHandler(e);
403
+ return this.collapsible;
404
+ }
405
+ /** @internal */
406
+ multipleChanged(_, next) {
407
+ this.options.forEach((o) => {
408
+ o.checked = next ? false : void 0;
409
+ });
410
+ this.setSelectedOptions();
411
+ /* v8 ignore if -- @preserve */
412
+ if (this.proxy) this.proxy.multiple = next;
413
+ }
414
+ /**
415
+ * Updates the selectedness of each option when the list of selected options changes.
416
+ *
417
+ * @param prev - the previous list of selected options
418
+ * @param next - the current list of selected options
419
+ *
420
+ * @internal
421
+ */
422
+ selectedOptionsChanged(prev, next) {
423
+ super.selectedOptionsChanged(prev, next);
424
+ this.options.forEach((o, i) => {
425
+ const proxyOption = this.proxy.options.item(i);
426
+ if (proxyOption) proxyOption.selected = o.selected;
427
+ });
385
428
  }
386
- #selectHighlightedOption() {
387
- if (this._highlightedOptionIndex === null) return;
388
- const highlightedOption = this._filteredEnabledOptions[this._highlightedOptionIndex];
389
- if (highlightedOption.getAttribute("data-select-all") !== null) {
390
- this._toggleSelectAll();
391
- return;
429
+ /**
430
+ * Resets and fills the proxy to match the component's options.
431
+ *
432
+ * @internal
433
+ */
434
+ setProxyOptions() {
435
+ /* v8 ignore else -- @preserve */
436
+ if (this.proxy instanceof HTMLSelectElement && this.options) {
437
+ this.proxy.length = 0;
438
+ this.options.forEach((option) => {
439
+ const proxyOption = option.proxy || (option instanceof HTMLOptionElement ? option.cloneNode() : null);
440
+ if (proxyOption) this.proxy.options.add(proxyOption);
441
+ });
392
442
  }
393
- this.#handleOptionInteraction(highlightedOption);
394
- }
395
- #highlightFirstOption() {
396
- this.#transitionHighlightedOptionTo(0);
397
- }
398
- #highlightLastOption() {
399
- this.#transitionHighlightedOptionTo(this._filteredEnabledOptions.length - 1);
400
- }
401
- #highlightPrevPage() {
402
- this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - PageSize);
403
- }
404
- #highlightNextPage() {
405
- this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? -1) + PageSize);
406
- }
407
- #highlightPreviousOption() {
408
- this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - 1);
409
- }
410
- #highlightNextOption() {
411
- this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? -1) + 1);
412
- }
413
- /** @internal */
414
- _tagLabelForValue(value) {
415
- return this._slottedOptions.find((option) => option.value === value).label;
416
443
  }
417
- /** @internal */
418
- _tagConnotationForValue(value) {
419
- return this._slottedOptions.find((option) => option.value === value).tagConnotation;
420
- }
421
- /** @internal */
422
- _isTagDisabled(value) {
423
- const option = this._slottedOptions.find((option) => option.value === value);
424
- return this.disabled || option.disabled;
425
- }
426
- #textForValue(value) {
427
- return (this._slottedOptions?.find((option) => option.value === value))?.label;
428
- }
429
- /** @internal */
430
- #measureTagWidth(label, removable, hasIcon) {
431
- const tag = document.createElement(this._optionTagTagName);
432
- tag.label = label;
433
- tag.removable = removable;
434
- tag.style.cssText = "position: absolute; visibility: hidden;";
435
- tag.hasIconPlaceholder = hasIcon;
436
- this.shadowRoot.appendChild(tag);
437
- const width = tag.getBoundingClientRect().width;
438
- tag.remove();
439
- return width;
440
- }
441
- #updateTagLayout() {
442
- if (!this.multiple) {
443
- this._numElidedTags = 0;
444
- this._tagRows = [];
445
- this._lastTagRow = [];
446
- return;
447
- }
448
- if (this.externalTags) {
449
- this._numElidedTags = this.values.length;
450
- this._tagRows = [];
451
- this._lastTagRow = [];
452
- return;
453
- }
454
- const rowWidth = this._contentArea.getBoundingClientRect().width;
455
- const rows = [[]];
456
- let currentRowIndex = 0;
457
- let currentRowWidth = InputMinWidthPx;
458
- let i;
459
- for (i = this.values.length - 1; i >= 0; i--) {
460
- const isLastRow = this.maxLines && currentRowIndex === this.maxLines - 1;
461
- const tagWidth = this.#measureTagWidth(this._tagLabelForValue(this.values[i]), true, this.#tagIconOfOption(this.selectedOptions[i]) !== null);
462
- const entry = {
463
- value: this.values[i],
464
- width: tagWidth
465
- };
466
- let elidedTagCounterWidth = 0;
467
- if (isLastRow) {
468
- const numElidedTags = i;
469
- if (numElidedTags) elidedTagCounterWidth = TagGapPx + this.#measureTagWidth(numElidedTags.toString(), false, false);
470
- }
471
- if (currentRowWidth + TagGapPx + tagWidth + elidedTagCounterWidth > rowWidth) {
472
- if (isLastRow) if (i === this.values.length - 1) {
473
- rows[currentRowIndex].unshift(entry);
474
- currentRowWidth += TagGapPx + tagWidth;
475
- } else break;
476
- else {
477
- rows.push([]);
478
- currentRowIndex++;
479
- rows[currentRowIndex].unshift(entry);
480
- currentRowWidth = tagWidth;
444
+ /**
445
+ * Handles keydown actions when the select is in multiple selection mode.
446
+ *
447
+ * @internal
448
+ */
449
+ multipleKeydownHandler(e) {
450
+ if (this.disabled) return;
451
+ const { key, shiftKey } = e;
452
+ this.shouldSkipFocus = false;
453
+ switch (key) {
454
+ case keyHome:
455
+ this.checkFirstOption(shiftKey);
456
+ return;
457
+ case keyArrowDown:
458
+ this.checkNextOption(shiftKey);
459
+ return;
460
+ case keyArrowUp:
461
+ this.checkPreviousOption(shiftKey);
462
+ return;
463
+ case keyEnd:
464
+ this.checkLastOption(shiftKey);
465
+ return;
466
+ case keyTab:
467
+ this.focusAndScrollOptionIntoView();
468
+ return;
469
+ case keyEscape:
470
+ this.uncheckAllOptions();
471
+ this.checkActiveIndex();
472
+ return;
473
+ case keySpace:
474
+ e.preventDefault();
475
+ /* v8 ignore else -- @preserve */
476
+ if (this.typeaheadExpired) {
477
+ this.toggleSelectedForAllCheckedOptions();
478
+ return;
481
479
  }
482
- continue;
483
- }
484
- rows[currentRowIndex].unshift(entry);
485
- currentRowWidth += TagGapPx + tagWidth;
486
- }
487
- this._numElidedTags = i + 1;
488
- rows.reverse();
489
- for (let i = 0; i < rows.length - 1; i++) {
490
- let lineWidth = rows[i].map((e) => e.width).reduce((a, b) => a + b, 0) + (rows[i].length - 1) * TagGapPx;
491
- if (i === 0 && this._numElidedTags) lineWidth += TagGapPx + this.#measureTagWidth(this._numElidedTags.toString(), false, false);
492
- while (rows[i + 1].length && lineWidth + TagGapPx + rows[i + 1][0].width <= rowWidth) {
493
- const nextTag = rows[i + 1].shift();
494
- rows[i].push(nextTag);
495
- lineWidth += TagGapPx + nextTag.width;
496
- }
480
+ default:
481
+ /* v8 ignore else -- @preserve */
482
+ if (key.length === 1) this.handleTypeAhead(key);
483
+ return;
497
484
  }
498
- const rowValues = rows.map((line) => line.map((entry) => entry.value));
499
- this._tagRows = rowValues.slice(0, -1);
500
- this._lastTagRow = rowValues.slice(-1)[0];
501
- }
502
- /** @internal */
503
- _onTagRemoved(value) {
504
- this.#updateValuesThroughUserInteraction(this.values.filter((option) => option !== value));
505
- this.#updateFilteredOptions();
506
485
  }
507
- /** @internal */
508
- _onTagKeydown(event) {
509
- const tagIndex = parseInt(event.target.dataset.index);
510
- switch (event.key) {
511
- case "Backspace":
512
- case "Delete":
513
- case "Enter":
514
- case " ":
515
- this._onTagRemoved(this.values[tagIndex]);
516
- Updates.process();
517
- this.#moveTagFocusTo(this.#nextTagIndexForRemoved(tagIndex));
486
+ /**
487
+ * Handle keyboard interaction for the select.
488
+ *
489
+ * @param e - the keyboard event
490
+ * @internal
491
+ */
492
+ keydownHandler(e) {
493
+ const selectedIndexBefore = this.selectedIndex;
494
+ if (this.multiple) this.multipleKeydownHandler(e);
495
+ else super.keydownHandler(e);
496
+ switch (e.key) {
497
+ case keySpace:
498
+ e.preventDefault();
499
+ if (this.collapsible && this.typeaheadExpired) this.open = !this.open;
518
500
  break;
519
- case "ArrowLeft":
520
- this.#moveTagFocusTo(this.#nextTagIndexLeft(tagIndex) ?? tagIndex);
501
+ case keyHome:
502
+ case keyEnd:
503
+ e.preventDefault();
521
504
  break;
522
- case "ArrowRight":
523
- this.#moveTagFocusTo(this.#nextTagIndexRight(tagIndex));
505
+ case keyEnter:
506
+ e.preventDefault();
507
+ this.open = !this.open;
524
508
  break;
509
+ case keyEscape:
510
+ if (this.collapsible && this.open) {
511
+ e.preventDefault();
512
+ this.open = false;
513
+ }
514
+ break;
515
+ case keyTab:
516
+ if (this.collapsible && this.open) this.open = false;
517
+ return true;
525
518
  }
526
- return true;
527
- }
528
- #moveTagFocusTo(index) {
529
- if (index === null) this._input.focus();
530
- else this.shadowRoot.querySelector(`[data-index="${index}"]`)?.focus();
531
- }
532
- #nextTagIndexLeft(index) {
533
- if (!this.values.length) return null;
534
- for (let i = index - 1; i >= 0; i--) if (!this._isTagDisabled(this.values[i])) return i;
535
- return null;
536
- }
537
- #nextTagIndexRight(index) {
538
- if (!this.values.length) return null;
539
- for (let i = index + 1; i < this.values.length; i++) if (!this._isTagDisabled(this.values[i])) return i;
540
- return null;
541
- }
542
- #nextTagIndexForRemoved(index) {
543
- return this.#nextTagIndexRight(index - 1) ?? this.#nextTagIndexLeft(index);
544
- }
545
- /** @internal */
546
- _onListboxClick(e) {
547
- if (this.disabled) return;
548
- const capturedOption = e.target.closest(`option,[role=option],[data-vvd-component=option]`);
549
- if (capturedOption?.getAttribute("data-select-all") !== null) {
550
- this._toggleSelectAll();
551
- return;
552
- }
553
- if (capturedOption && !capturedOption.disabled) this.#handleOptionInteraction(capturedOption);
554
- }
555
- /** @internal */
556
- get _shouldShowClearButton() {
557
- return this.clearable && this.values.length > 0;
558
- }
559
- /** @internal */
560
- _onClearButtonClick() {
561
- this.#updateValuesThroughUserInteraction(this.selectedOptions.filter((option) => option.disabled).map((option) => option.value));
562
- }
563
- /** @internal */
564
- maxSelectedChanged() {
565
- this.#updateSelectionLimit();
566
- }
567
- #updateSelectionLimit() {
568
- if (!this.multiple || !this._slottedOptions || typeof this.maxSelected !== "number" || this.maxSelected <= 0) return;
569
- const options = this._slottedOptions.filter((option) => !this._slottedDisabledOptions.includes(option));
570
- if (this.values.length >= this.maxSelected) {
571
- const unselectedOptions = options.filter((option) => !this.selectedOptions.includes(option));
572
- for (const option of unselectedOptions) option.disabled = true;
573
- } else for (const option of options) option.disabled = false;
519
+ if (this.collapsible && !this.open && this.selectedIndex !== selectedIndexBefore) this.updateValue(true);
520
+ return !(e.key === keyArrowDown || e.key === keyArrowUp);
574
521
  }
575
- /** @internal */
576
- get _hasSelectionCount() {
577
- return this.multiple && this.maxSelected && this.maxSelected >= 1;
522
+ connectedCallback() {
523
+ super.connectedCallback();
524
+ this.addEventListener("focusout", this.focusoutHandler);
525
+ this.addEventListener("contentchange", this.updateDisplayValue);
578
526
  }
579
- /** @internal */
580
- get _selectableOptions() {
581
- return this._slottedOptions?.filter((o) => !this._slottedDisabledOptions.includes(o) && !o.disabled) ?? [];
527
+ disconnectedCallback() {
528
+ this.removeEventListener("focusout", this.focusoutHandler);
529
+ this.removeEventListener("contentchange", this.updateDisplayValue);
530
+ super.disconnectedCallback();
582
531
  }
583
532
  /** @internal */
584
- get _selectAllLabel() {
585
- return this._isAllSelected ? this.deselectAllText ?? this.locale.searchableSelect.deselectAllLabel : this.selectAllText ?? this.locale.searchableSelect.selectAllLabel;
533
+ updateDisplayValue() {
534
+ if (this.collapsible) Observable.notify(this, "displayValue");
586
535
  }
587
- /** @internal */
588
- get _isAllSelected() {
589
- const selectedValues = this.values;
590
- if (!this.multiple || !this._slottedOptions) return false;
591
- const selectable = this._selectableOptions;
592
- if (selectable.length === 0) return false;
593
- const selected = new Set(selectedValues);
594
- return selectable.every((o) => selected.has(o.value));
536
+ get displayValue() {
537
+ Observable.track(this, "displayValue");
538
+ return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
595
539
  }
596
- /** @internal */
597
- _toggleSelectAll() {
598
- const selectableValues = this._selectableOptions.map((o) => o.value);
599
- if (this._isAllSelected) {
600
- const updatedValues = this.values.filter((v) => !selectableValues.includes(v));
601
- this.#updateValuesThroughUserInteraction(updatedValues);
602
- this._changeDescription = this.locale.searchableSelect.deselectedAllMessage;
603
- return;
540
+ _newDefaultSelectedIndex(prev, next, currentSelectIndex) {
541
+ const defaultSelectedIndex = super._newDefaultSelectedIndex(prev, next, currentSelectIndex);
542
+ if (defaultSelectedIndex === null && currentSelectIndex === -1 && !this.placeholder) {
543
+ const firstSelectableIndex = this.getNextSelectableIndex(0);
544
+ if (firstSelectableIndex !== -1) return firstSelectableIndex;
604
545
  }
605
- const missingValues = selectableValues.filter((v) => !this.values.includes(v));
606
- const updatedValues = [...this.values, ...missingValues];
607
- this.#updateValuesThroughUserInteraction(updatedValues);
608
- this._changeDescription = this.locale.searchableSelect.selectedAllMessage;
546
+ return defaultSelectedIndex;
609
547
  }
610
- #determineInitialValues() {
611
- return this.initialValues.length ? this.initialValues : this.initialValue ? [this.initialValue] : [];
548
+ _isDefaultSelected(option) {
549
+ return super._isDefaultSelected(option) || option.value === this.initialValue || !this._isResetting && option.value === this.value;
612
550
  }
613
- /** @internal */
614
- nameChanged(previous, next) {
615
- super.nameChanged(previous, next);
616
- this.#updateFormValue();
617
- }
618
- #updateFormValue() {
619
- if (!this.name) this.setFormValue(null);
620
- else {
621
- const formData = new FormData();
622
- for (const value of this.values) formData.append(this.name, value);
623
- this.setFormValue(formData);
624
- }
551
+ slottedOptionsChanged(prev, next) {
552
+ this.options.forEach((o) => {
553
+ Observable.getNotifier(o).unsubscribe(this, "value");
554
+ });
555
+ super.slottedOptionsChanged(prev, next);
556
+ this.options.forEach((o) => {
557
+ Observable.getNotifier(o).subscribe(this, "value");
558
+ });
559
+ this.setProxyOptions();
560
+ this.updateValue();
561
+ const scale = this.getAttribute("scale") || this.scale;
562
+ next.forEach((element) => {
563
+ if (scale) {
564
+ element.setAttribute("scale", scale);
565
+ element.scale = scale;
566
+ }
567
+ });
568
+ this.proxy.value = this.value;
569
+ this.validate();
625
570
  }
626
- /** @internal */
627
571
  formResetCallback() {
628
- super.formResetCallback();
629
- this.#updateValuesThroughUserInteraction(this.#determineInitialValues());
572
+ this.setProxyOptions();
573
+ this._isResetting = true;
574
+ this.selectedIndex = this._newDefaultSelectedIndex([], this.options, -1) ?? -1;
575
+ this._isResetting = false;
630
576
  }
631
- #resizeObserver;
632
577
  /** @internal */
633
- _onFieldsetClick(e) {
634
- if (this.disabled) return;
635
- if (!e.defaultPrevented) {
636
- this._input.focus();
637
- this.open = true;
638
- }
578
+ get _shouldShowClearButton() {
579
+ if (!this.clearable) return false;
580
+ if (this.multiple) return this.selectedOptions?.length > 0;
581
+ return this.value !== "";
639
582
  }
640
583
  /** @internal */
641
- _onChevronClick() {
642
- if (this.open) {
643
- this.open = false;
644
- return false;
645
- }
646
- return true;
647
- }
648
- connectedCallback() {
649
- super.connectedCallback();
650
- if (!this.values.length) this.values = this.#determineInitialValues();
651
- this.#resizeObserver.observe(this._contentArea);
652
- this.addEventListener("optgroup-change", this.#onOptgroupChange);
653
- }
654
- disconnectedCallback() {
655
- super.disconnectedCallback();
656
- this.removeEventListener("optgroup-change", this.#onOptgroupChange);
657
- this.#resizeObserver.disconnect();
584
+ _onClearButtonFocus() {
585
+ this._isClearButtonFocused = true;
586
+ this.activeIndex = -1;
587
+ this.uncheckAllOptions();
658
588
  }
659
- #onOptgroupChange;
660
589
  /** @internal */
661
- validate() {
662
- super.validate(this._input ?? void 0);
590
+ _onClearButtonBlur() {
591
+ this._isClearButtonFocused = false;
663
592
  }
664
593
  /** @internal */
665
- focus(options) {
666
- this._input?.focus(options);
594
+ get _shouldShowLabelWrapper() {
595
+ return Boolean(this.label || this._hasContextualHelp || this.multiple && this._shouldShowClearButton);
667
596
  }
668
597
  /** @internal */
669
- _onMouseDown(event) {
670
- const originalTarget = event.composedPath()[0];
671
- if (!event.defaultPrevented && originalTarget !== this._input && !this._isFromContextualHelp(event)) {
672
- this._input.focus();
673
- return false;
674
- }
675
- return true;
598
+ _onClearButtonClick() {
599
+ if (this.multiple) this.selectedOptions.forEach((o) => {
600
+ /* v8 ignore else -- @preserve */
601
+ if (!o.disabled) o.selected = false;
602
+ });
603
+ else this.selectedIndex = -1;
604
+ this.updateValue(true);
676
605
  }
677
606
  };
678
- __decorate([attr], SearchableSelect.prototype, "appearance", void 0);
679
- __decorate([attr], SearchableSelect.prototype, "shape", void 0);
680
- __decorate([attr()], SearchableSelect.prototype, "scale", void 0);
607
+ __decorate([observable], Select.prototype, "activeIndex", void 0);
608
+ __decorate([attr({ mode: "boolean" })], Select.prototype, "multiple", void 0);
681
609
  __decorate([attr({
682
- mode: "boolean",
683
- attribute: "fixed-dropdown"
684
- })], SearchableSelect.prototype, "fixedDropdown", void 0);
685
- __decorate([attr], SearchableSelect.prototype, "placeholder", void 0);
686
- __decorate([attr({ mode: "boolean" })], SearchableSelect.prototype, "open", void 0);
687
- __decorate([attr({ mode: "boolean" })], SearchableSelect.prototype, "multiple", void 0);
688
- __decorate([attr({
689
- attribute: "external-tags",
610
+ attribute: "open",
690
611
  mode: "boolean"
691
- })], SearchableSelect.prototype, "externalTags", void 0);
692
- __decorate([attr({
693
- attribute: "max-lines",
694
- converter: nullableNumberConverter
695
- })], SearchableSelect.prototype, "maxLines", void 0);
696
- __decorate([observable], SearchableSelect.prototype, "values", void 0);
697
- __decorate([observable], SearchableSelect.prototype, "initialValues", void 0);
698
- __decorate([observable], SearchableSelect.prototype, "_input", void 0);
699
- __decorate([observable], SearchableSelect.prototype, "_currentSearchText", void 0);
700
- __decorate([observable], SearchableSelect.prototype, "_slottedElements", void 0);
701
- __decorate([observable], SearchableSelect.prototype, "_slottedOptions", void 0);
702
- __decorate([observable], SearchableSelect.prototype, "optionFilter", void 0);
703
- __decorate([observable], SearchableSelect.prototype, "_filteredOptions", void 0);
704
- __decorate([observable], SearchableSelect.prototype, "_filteredEnabledOptions", void 0);
705
- __decorate([attr({ mode: "boolean" })], SearchableSelect.prototype, "loading", void 0);
706
- __decorate([observable], SearchableSelect.prototype, "_highlightedOptionIndex", void 0);
707
- __decorate([observable], SearchableSelect.prototype, "_contentArea", void 0);
708
- __decorate([observable], SearchableSelect.prototype, "_numElidedTags", void 0);
709
- __decorate([observable], SearchableSelect.prototype, "_tagRows", void 0);
710
- __decorate([observable], SearchableSelect.prototype, "_lastTagRow", void 0);
711
- __decorate([observable], SearchableSelect.prototype, "_listbox", void 0);
712
- __decorate([attr({ mode: "boolean" })], SearchableSelect.prototype, "clearable", void 0);
612
+ })], Select.prototype, "open", void 0);
613
+ __decorate([volatile], Select.prototype, "collapsible", null);
614
+ __decorate([observable], Select.prototype, "control", void 0);
615
+ __decorate([observable], Select.prototype, "maxHeight", void 0);
616
+ __decorate([observable], Select.prototype, "_anchor", void 0);
617
+ __decorate([attr()], Select.prototype, "scale", void 0);
618
+ __decorate([attr], Select.prototype, "appearance", void 0);
619
+ __decorate([attr], Select.prototype, "shape", void 0);
713
620
  __decorate([attr({
714
- attribute: "max-selected",
715
- converter: nullableNumberConverter
716
- })], SearchableSelect.prototype, "maxSelected", void 0);
717
- __decorate([observable], SearchableSelect.prototype, "_slottedDisabledOptions", void 0);
718
- __decorate([attr({
719
- attribute: "enable-select-all",
720
- mode: "boolean"
721
- })], SearchableSelect.prototype, "enableSelectAll", void 0);
722
- __decorate([attr({ attribute: "select-all-text" })], SearchableSelect.prototype, "selectAllText", void 0);
723
- __decorate([attr({ attribute: "deselect-all-text" })], SearchableSelect.prototype, "deselectAllText", void 0);
724
- __decorate([observable], SearchableSelect.prototype, "_selectAllOption", void 0);
725
- __decorate([observable], SearchableSelect.prototype, "_changeDescription", void 0);
726
- __decorate([observable], SearchableSelect.prototype, "_anchor", void 0);
727
- //#endregion
728
- //#region src/lib/searchable-select/option-tag.ts
729
- var OptionTag = class extends Localized(VividElement) {
730
- constructor(..._args) {
731
- super(..._args);
732
- this.removable = false;
733
- this.disabled = false;
734
- this.hasIconPlaceholder = false;
735
- }
736
- /** @internal */
737
- _onClickRemove() {
738
- this.$emit("remove", void 0, { bubbles: false });
739
- }
740
- };
741
- __decorate([attr], OptionTag.prototype, "shape", void 0);
742
- __decorate([observable], OptionTag.prototype, "connotation", void 0);
743
- __decorate([attr], OptionTag.prototype, "label", void 0);
744
- __decorate([attr({ mode: "boolean" })], OptionTag.prototype, "removable", void 0);
745
- __decorate([attr({ mode: "boolean" })], OptionTag.prototype, "disabled", void 0);
746
- __decorate([observable], OptionTag.prototype, "hasIconPlaceholder", void 0);
747
- __decorate([attr()], OptionTag.prototype, "scale", void 0);
621
+ mode: "boolean",
622
+ attribute: "fixed-dropdown"
623
+ })], Select.prototype, "fixedDropdown", void 0);
624
+ __decorate([attr], Select.prototype, "placeholder", void 0);
625
+ __decorate([observable], Select.prototype, "_feedbackWrapper", void 0);
626
+ __decorate([observable], Select.prototype, "metaSlottedContent", void 0);
627
+ __decorate([attr({ mode: "boolean" })], Select.prototype, "clearable", void 0);
628
+ __decorate([observable], Select.prototype, "_isClearButtonFocused", void 0);
748
629
  //#endregion
749
- //#region src/lib/searchable-select/searchable-select.template.ts
630
+ //#region src/lib/select/select.template.ts
750
631
  function renderLabel() {
751
- return html`
752
- <label for="control" class="label" id="label"> ${(x) => x.label} </label>
753
- `;
632
+ return html` <label
633
+ for="${(x) => x.multiple ? null : "control"}"
634
+ class="label"
635
+ id="label"
636
+ >
637
+ ${(x) => x.label}
638
+ </label>`;
754
639
  }
755
- function renderSelectionCount() {
640
+ function renderPlaceholder(context) {
641
+ const optionTag = context.tagFor(ListboxOption);
756
642
  return html`
757
- <span
758
- id="selection-count"
759
- class="selection-count"
760
- aria-label="${(x) => x.locale.searchableSelect.maxSelectedMessage(x.values.length, x.maxSelected)}"
761
- >(${(x) => `${x.values.length}/${x.maxSelected}`})</span
762
- >
763
- `;
643
+ <${optionTag} text="${(x) => x.placeholder}" hidden disabled>
644
+ </${optionTag}>`;
764
645
  }
765
- var tagTemplateFactory = (context, getComponent) => {
766
- const optionTagTag = context.tagFor(OptionTag);
767
- return html`
768
- <div class="tag-wrapper">
769
- <${optionTagTag}
770
- class="tag"
771
- tabindex="-1"
772
- data-index="${(x, c) => getComponent(c).values.indexOf(x)}"
773
- removable
774
- :label="${(x, c) => getComponent(c)._tagLabelForValue(x)}"
775
- :shape="${(_, c) => getComponent(c).shape}"
776
- :connotation="${(x, c) => getComponent(c)._tagConnotationForValue(x)}"
777
- :scale="${(_, c) => getComponent(c).scale}"
778
- ?disabled="${(x, c) => getComponent(c)._isTagDisabled(x)}"
779
- @remove="${(x, c) => getComponent(c)._onTagRemoved(x)}"
780
- @keydown="${(_, c) => getComponent(c)._onTagKeydown(c.event)}"
781
- @mousedown="${() => false}">
782
- <slot slot="icon" name="${(x, c) => getComponent(c)._tagIconSlotName(x)}"></slot>
783
- </${optionTagTag}>
784
- </div>
785
- `;
786
- };
787
- var elidedTagTemplateFactory = (context, getComponent) => {
788
- const optionTagTag = context.tagFor(OptionTag);
789
- return html`
790
- <${optionTagTag}
791
- class="tag"
792
- tabindex="-1"
793
- :label="${(x, c) => getComponent(x, c)._numElidedTags.toString()}"
794
- :shape="${(x, c) => getComponent(x, c).shape}"
795
- :scale="${(x, c) => getComponent(x, c).scale}"
796
- ?disabled="${(x, c) => getComponent(x, c).disabled}"
797
- @mousedown="${() => false}">
798
- </${optionTagTag}>
799
- `;
800
- };
801
- function renderFieldset(context) {
646
+ function renderClearButton(context) {
802
647
  const buttonTag = context.tagFor(Button);
803
- const progressRingTag = context.tagFor(ProgressRing);
804
- const affixIconTemplate = affixIconTemplateFactory(context);
805
- const chevronTemplate = chevronTemplateFactory(context);
806
- const tagTemplate = tagTemplateFactory(context, (c) => c.parent);
807
- const nestedTagTemplate = tagTemplateFactory(context, (c) => c.parentContext.parent);
808
- const elidedTagTemplate = elidedTagTemplateFactory(context, (x, _) => x);
809
- const nestedElidedTagTemplate = elidedTagTemplateFactory(context, (_, c) => c.parent);
810
648
  return html`
811
- <div
812
- class="fieldset ${(x) => classNames(["disabled", x.disabled], [`appearance-${x.appearance}`, Boolean(x.appearance)], [`shape-${x.shape}`, Boolean(x.shape)], [`size-${x.scale}`, Boolean(x.scale)], ["error", Boolean(x.errorValidationMessage)], ["success", !!x.successText], ["has-highlighted-option", x._highlightedOptionIndex !== null])}"
813
- @click="${(x, c) => x._onFieldsetClick(c.event)}"
814
- ${ref("_anchor")}
815
- >
816
- ${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
817
- <div class="content-area" ${ref("_contentArea")}>
818
- ${repeat((x) => x._tagRows, html`
819
- <div class="tag-row">
820
- ${when((_, c) => c.isFirst && c.parent._numElidedTags, nestedElidedTagTemplate)}
821
- ${repeat((x) => x, nestedTagTemplate)}
822
- </div>
823
- `, { positioning: true })}
824
- <div
825
- class="tag-row ${(x) => classNames(["contains-only-input", x._tagRows.length > 0 && x._lastTagRow.length === 0])}"
826
- >
827
- ${when((x) => x._tagRows.length === 0 && x._numElidedTags, elidedTagTemplate)}
828
- ${repeat((x) => x._lastTagRow, tagTemplate)}
829
- <input
830
- id="control"
831
- class="control"
832
- autocomplete="off"
833
- ${delegateAria({
834
- role: "combobox",
835
- ariaAutoComplete: "list",
836
- ariaHasPopup: "listbox",
837
- ariaExpanded: (x) => x.open,
838
- ariaControls: "listbox",
839
- ariaDescribedBy: (x) => `${x._feedbackDescribedBy} ${x.multiple && x.maxSelected && x.maxSelected >= 1 ? "selection-count" : null}`
840
- })}
841
- placeholder="${(x) => x.multiple && x.values.length ? "" : x.placeholder}"
842
- type="text"
843
- ?disabled="${(x) => x.disabled}"
844
- :value="${(x) => x._inputValue}"
845
- @input="${(x, c) => {
846
- x._onInputInput(c.event);
649
+ <${buttonTag}
650
+ aria-label="${(x) => x.locale.select.clearButtonLabel}"
651
+ aria-hidden="${(x) => x._isClearButtonFocused ? "false" : "true"}"
652
+ @click="${(x, c) => {
653
+ x._onClearButtonClick();
847
654
  c.event.stopPropagation();
848
655
  }}"
849
- @change="${(_, c) => {
656
+ @mousedown="${() => false}"
657
+ @keydown="${(x, c) => {
658
+ /* v8 ignore next -- @preserve */
659
+ if (c.event.key === "Tab") x._onClearButtonBlur();
850
660
  c.event.stopPropagation();
661
+ return true;
851
662
  }}"
852
- @focus="${(x, c) => x._onInputFocus(c.event)}"
853
- @blur="${(x, c) => x._onInputBlur(c.event)}"
854
- @keydown="${(x, c) => x._onInputKeydown(c.event)}"
855
- ${ref("_input")}
856
- />
857
- </div>
858
- </div>
859
- <slot name="meta"></slot>
860
- ${when((x) => x._shouldShowClearButton, html`<${buttonTag}
861
- aria-label="${(x) => x.locale.searchableSelect.clearButtonLabel}"
862
- @click="${(x) => x._onClearButtonClick()}"
863
- @mousedown="${() => false}"
864
- ?disabled="${(x) => x.disabled}"
865
- :shape="${(x) => x.shape}"
866
- size="super-condensed"
867
- icon="close-line"
868
- appearance="ghost-light"
869
- tabindex="0"
870
- ></${buttonTag}>`)}
871
- <div @mousedown="${() => false}" @click="${(x) => x._onChevronClick()}">
872
- ${when((x) => x.loading, html`<${progressRingTag} indeterminate size="-6" aria-hidden="true"></${progressRingTag}>`)}
873
- ${when((x) => !x.loading, chevronTemplate)}
874
- </div>
875
- </div>
663
+ @focusin="${(x, c) => {
664
+ c.event.stopPropagation();
665
+ x._onClearButtonFocus();
666
+ }}"
667
+ @focusout="${(x) => x._onClearButtonBlur()}"
668
+ ?disabled="${(x) => x.disabled}"
669
+ :shape="${(x) => x.shape}"
670
+ size="super-condensed"
671
+ icon="close-line"
672
+ appearance="ghost-light"
673
+ class="clear-button"
674
+ tabindex="0"
675
+ ></${buttonTag}>
876
676
  `;
877
677
  }
878
- function setFixedDropdownVarWidth(x) {
879
- return x.open && x.fixedDropdown ? `--_searchable-select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
678
+ function selectValue(context) {
679
+ const affixIconTemplate = affixIconTemplateFactory(context);
680
+ const chevronTemplate = chevronTemplateFactory(context);
681
+ return html` <div
682
+ class="control ${(x) => classNames(["has-activedescendant", Boolean(x._activeDescendant) && x.open], ["disabled", x.disabled], "connotation-accent", `appearance-${selectAppearance.parse(x.appearance)}`, "with-idle", "with-hover", "with-disabled", "with-readonly", "with-error", "with-success", [`shape-${x.shape}`, Boolean(x.shape)], ["has-meta", Boolean(x.metaSlottedContent?.length)], ["error", Boolean(x.errorValidationMessage)], ["success", !!x.successText], ["shows-placeholder", Boolean(x.placeholder) && !x.value], [`size-${x.scale}`, Boolean(x.scale)])}"
683
+ ${ref("_anchor")}
684
+ id="control"
685
+ ?disabled="${(x) => x.disabled}"
686
+ >
687
+ <div class="selected-value">
688
+ ${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
689
+ <span class="text">${(x) => x.displayValue}</span>
690
+ <slot name="meta" ${slotted("metaSlottedContent")}></slot>
691
+ </div>
692
+ ${when((x) => x._shouldShowClearButton, renderClearButton(context))}
693
+ ${chevronTemplate}
694
+ </div>`;
880
695
  }
881
- function renderSelectAll(context) {
882
- const optionTag = context.tagFor(ListboxOption);
883
- const dividerTag = context.tagFor(Divider);
884
- return html`
885
- <${optionTag}
886
- data-select-all
887
- tabindex="-1"
888
- :text="${(x) => x._selectAllLabel}"
889
- :selected="${(x) => x._isAllSelected}"
890
- :_displayCheckmark="${() => true}"
891
- ?disabled="${(x) => x._selectableOptions.length === 0}"
892
- ${ref("_selectAllOption")}>
893
- </${optionTag}>
894
- <${dividerTag} class="divider"></${dividerTag}>
895
- `;
696
+ function setFixedDropdownVarWidth(x) {
697
+ return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
896
698
  }
699
+ /** @param context - element definition context */
897
700
  function renderControl(context) {
898
701
  const popupTag = context.tagFor(Popup);
899
702
  return html`
900
- <div class="label-wrapper" ?hidden=${(x) => !x.label && !x._hasContextualHelp && !x._hasSelectionCount}>
901
- ${when((x) => x.label || x._hasSelectionCount, html`
902
- <div>
903
- ${when((x) => x.label, renderLabel())}
904
- ${when((x) => x._hasSelectionCount, renderSelectionCount())}
905
- </div>
906
- `)}
907
- <slot name="contextual-help" ${slotted("_contextualHelpSlottedContent")}></slot>
908
- </div>
909
- <span aria-live="assertive" aria-relevant="text" class="visually-hidden">
910
- ${(x) => x._changeDescription}
911
- </span>
912
- <div>
913
- ${renderFieldset(context)}
914
- <div class="popup-wrapper">
915
- <${popupTag}
703
+ <div class="label-wrapper" ?hidden=${(x) => !x._shouldShowLabelWrapper}>
704
+ ${when((x) => x.label, renderLabel())}
705
+ ${when((x) => x.multiple && x._shouldShowClearButton, renderClearButton(context))}
706
+ <slot name="contextual-help" ${slotted("_contextualHelpSlottedContent")}></slot>
707
+ </div>
708
+ <div class="control-wrapper">
709
+ ${when((x) => !x.multiple, selectValue(context))}
710
+ <${popupTag} class="popup"
711
+ style="${setFixedDropdownVarWidth}"
712
+ ?open="${(x) => x.collapsible ? x.open : true}"
916
713
  :anchor="${(x) => x._anchor}"
917
- :open="${(x) => x.open}"
918
- class="popup"
919
714
  placement="bottom-start"
920
- style="${setFixedDropdownVarWidth}"
921
- strategy="${(x) => x.fixedDropdown ? "fixed" : "absolute"}">
922
- <div
923
- class="listbox"
715
+ strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
716
+ <div class="listbox"
717
+ id="${(x) => x.listboxId}"
924
718
  role="listbox"
925
719
  aria-multiselectable="${(x) => x.multiple}"
926
- aria-required="${(x) => x.required}"
927
- ${ref("_listbox")}
928
- @click="${(x, c) => x._onListboxClick(c.event)}"
929
- @mousedown="${() => false}"
930
- >
931
- ${when((x) => x.enableSelectAll && x.multiple && !x.maxSelected, renderSelectAll(context))}
720
+ aria-label="${(x) => x.multiple && !x.label && x.ariaLabel ? x.ariaLabel : null}"
721
+ aria-labelledby="${(x) => x.multiple && x.label ? "label" : null}"
722
+ ?disabled="${(x) => x.disabled}"
723
+ ?hidden="${(x) => x.collapsible ? !x.open : false}"
724
+ ${ref("listbox")}>
725
+ ${when((x) => x.placeholder, renderPlaceholder(context))}
932
726
  <slot
933
727
  ${slotted({
934
- filter: ((n) => isListboxOption(n) || isOptgroup(n)),
728
+ filter: Listbox.slottedOptionFilter,
935
729
  flatten: true,
936
- property: "_slottedElements"
730
+ property: "slottedOptions"
937
731
  })}>
938
732
  </slot>
939
- ${when((x) => x._filteredOptions.length === 0, html`<div class="empty-message">
940
- ${when((x) => x.loading, html`<slot name="loading-options">
941
- ${(x) => x.locale.searchableSelect.loadingOptionsMessage}
942
- </slot>`)}
943
- ${when((x) => !x.loading && x.searchText === "", html`<slot name="no-options">
944
- ${(x) => x.locale.searchableSelect.noOptionsMessage}
945
- </slot>`)}
946
- ${when((x) => !x.loading && x.searchText !== "", html`<slot name="no-matches">
947
- ${(x) => x.locale.searchableSelect.noMatchesMessage}
948
- </slot>`)}
949
- </div>`)}
950
- </div>
733
+ </div>
951
734
  </${popupTag}>
952
735
  </div>
953
- </div>
954
- `;
736
+ `;
737
+ }
738
+ /** Ignore events that originate from feedback, e.g. a click on link */
739
+ function ifNotFromFeedback(handler) {
740
+ return (x, c) => {
741
+ if (!c.event.composedPath().includes(x._feedbackWrapper)) {
742
+ handler(x, c.event);
743
+ return;
744
+ }
745
+ return true;
746
+ };
955
747
  }
956
- var SearchableSelectTemplate = (context) => {
957
- const optionTagName = context.tagFor(OptionTag, true);
748
+ /**
749
+ * As `ifNotFromFeedback`, but forwards the handler's return value.
750
+ *
751
+ * FAST prevents an event's default action unless the binding returns exactly
752
+ * `true`, so handlers that need to opt out of that — e.g. keydown, where
753
+ * preventing the default action on Tab would trap focus on the select — must
754
+ * have their result passed through rather than discarded.
755
+ */
756
+ function ifNotFromFeedbackPreservingDefault(handler) {
757
+ return (x, c) => {
758
+ if (!c.event.composedPath().includes(x._feedbackWrapper)) return handler(x, c.event);
759
+ return true;
760
+ };
761
+ }
762
+ var SelectTemplate = (context) => {
958
763
  return html`
959
764
  <template
960
- :_optionTagTagName="${() => optionTagName}"
961
- @mousedown="${(x, c) => x._onMouseDown(c.event)}"
765
+ ${applyHostSemantics({
766
+ role: "combobox",
767
+ ariaLabel: (x) => x.ariaLabel ?? x.label,
768
+ ariaHasPopup: (x) => x.collapsible ? "listbox" : "false",
769
+ ariaExpanded: (x) => x.open,
770
+ ariaDisabled: (x) => x.disabled
771
+ })}
772
+ aria-controls="${(x) => x.listboxId}"
773
+ aria-activedescendant="${(x) => x.open ? x._activeDescendant : null}"
774
+ aria-describedby="${(x) => x._feedbackDescribedBy}"
775
+ tabindex="${(x) => !x.disabled ? "0" : null}"
776
+ @click="${ifNotFromFeedback((x, e) => x.clickHandler(e))}"
777
+ @focusin="${ifNotFromFeedback((x, e) => x.focusinHandler(e))}"
778
+ @focusout="${ifNotFromFeedback((x, e) => x.focusoutHandler(e))}"
779
+ @keydown="${ifNotFromFeedbackPreservingDefault((x, e) => {
780
+ if (x.open) handleEscapeKeyAndStopPropogation(e);
781
+ return x.keydownHandler(e);
782
+ })}"
783
+ @mousedown="${ifNotFromFeedback((x, e) => x.mousedownHandler(e))}"
962
784
  >
963
- <div class="control-wrapper">
964
- ${renderControl(context)} ${(x) => x._getFeedbackTemplate(context)}
785
+ ${renderControl(context)}
786
+ <div class="feedback-wrapper" ${ref("_feedbackWrapper")}>
787
+ ${(x) => x._getFeedbackTemplate(context)}
965
788
  </div>
966
789
  </template>
967
790
  `;
968
791
  };
969
792
  //#endregion
970
- //#region src/lib/searchable-select/option-tag.template.ts
971
- function renderRemoveButton(iconTag) {
972
- return html`
973
- <span
974
- class="remove-button"
975
- aria-label="${(x) => x.locale.searchableSelect.removeTagButtonLabel(x.label)}"
976
- role="button"
977
- tabindex="${(x) => x.disabled ? null : 0}"
978
- @click="${(x) => x._onClickRemove()}"
979
- >
980
- <${iconTag} name="close-line"></${iconTag}>
981
- </span>
982
- `;
983
- }
984
- var optionTagTemplate = (context) => {
985
- const iconTag = context.tagFor(Icon);
986
- return html`<span
987
- class="${(x) => classNames("base", ["disabled", x.disabled], ["removable", x.removable], [`shape-${x.shape}`, Boolean(x.shape)], [`connotation-${x.connotation}`, Boolean(x.connotation)], [`size-${x.scale}`, Boolean(x.scale)])}"
988
- aria-disabled="${(x) => x.disabled}"
989
- >
990
- <slot name="icon" aria-hidden="true">
991
- ${when((x) => x.hasIconPlaceholder, html`<div class="icon-placeholder"></div>`)}
992
- </slot>
993
- ${when((x) => x.label, (x) => html`<span class="label">${x.label}</span>`)}
994
- ${when((x) => x.removable, renderRemoveButton(iconTag))}
995
- </span>`;
996
- };
793
+ //#region src/lib/select/definition.ts
997
794
  /** @internal */
998
- var searchableSelectDefinition = defineVividComponent("searchable-select", SearchableSelect, SearchableSelectTemplate, [
999
- buttonDefinition,
795
+ var selectDefinition = defineVividComponent("select", Select, SelectTemplate, [
1000
796
  popupDefinition,
1001
797
  iconDefinition,
1002
- defineVividComponent("option-tag", OptionTag, optionTagTemplate, [iconDefinition], {
1003
- styles: [option_tag_default],
1004
- shadowOptions: { delegatesFocus: true }
1005
- }),
1006
- progressRingDefinition,
1007
- feedbackMessageDefinition,
1008
798
  listboxOptionDefinition,
1009
799
  optgroupDefinition,
1010
- dividerDefinition
1011
- ], { styles: searchable_select_default });
800
+ buttonDefinition,
801
+ feedbackMessageDefinition
802
+ ], { styles: select_default });
1012
803
  /**
1013
- * Registers the searchable-select element with the design system.
804
+ * Registers the select elements with the design system.
1014
805
  *
1015
806
  * @param prefix - the prefix to use for the component name
1016
807
  */
1017
- var registerSearchableSelect = createRegisterFunction(searchableSelectDefinition);
808
+ var registerSelect = createRegisterFunction(selectDefinition);
1018
809
  //#endregion
1019
- export { searchableSelectDefinition as n, SearchableSelect as r, registerSearchableSelect as t };
810
+ export { selectDefinition as n, Select as r, registerSelect as t };