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