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