@vonage/vivid 5.23.1 → 5.24.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 (406) hide show
  1. package/accordion/index.cjs +1 -1
  2. package/accordion/index.js +1 -1
  3. package/accordion-item/index.cjs +1 -1
  4. package/accordion-item/index.js +1 -1
  5. package/audio-player/index.cjs +2 -2
  6. package/audio-player/index.js +3 -3
  7. package/badge/index.cjs +1 -1
  8. package/badge/index.js +1 -1
  9. package/bundled/definition15.cjs +8 -7
  10. package/bundled/definition15.js +26 -24
  11. package/bundled/definition17.cjs +2 -2
  12. package/bundled/definition17.js +2 -2
  13. package/bundled/definition18.cjs +12 -83
  14. package/bundled/definition18.js +35 -419
  15. package/bundled/definition19.cjs +87 -7
  16. package/bundled/definition19.js +432 -16
  17. package/bundled/definition20.cjs +7 -37
  18. package/bundled/definition20.js +17 -172
  19. package/bundled/definition21.cjs +35 -27
  20. package/bundled/definition21.js +154 -154
  21. package/bundled/definition22.cjs +29 -6
  22. package/bundled/definition22.js +172 -20
  23. package/bundled/definition23.cjs +6 -12
  24. package/bundled/definition23.js +17 -32
  25. package/bundled/definition24.cjs +12 -39
  26. package/bundled/definition24.js +32 -67
  27. package/bundled/definition25.cjs +44 -0
  28. package/bundled/definition25.js +77 -0
  29. package/bundled/extractOptions.cjs +1 -0
  30. package/bundled/extractOptions.js +11 -0
  31. package/bundled/listbox.cjs +1 -1
  32. package/bundled/listbox.js +24 -11
  33. package/bundled/render-in-light-dom.cjs +1 -1
  34. package/bundled/render-in-light-dom.js +16 -19
  35. package/bundled/vivid-element.cjs +1 -1
  36. package/bundled/vivid-element.js +9 -1
  37. package/combobox/definition.cjs +1 -1
  38. package/combobox/definition.js +1 -1
  39. package/combobox/index.cjs +7 -7
  40. package/combobox/index.js +29 -21
  41. package/country/definition.cjs +1 -1
  42. package/country/definition.js +1 -1
  43. package/country/index.cjs +1 -1
  44. package/country/index.js +1 -1
  45. package/country-group/definition.cjs +1 -1
  46. package/country-group/definition.js +1 -1
  47. package/country-group/index.cjs +1 -1
  48. package/country-group/index.js +2 -2
  49. package/custom-elements.json +3102 -2842
  50. package/data-grid/definition.cjs +1 -1
  51. package/data-grid/definition.js +1 -1
  52. package/data-grid/index.cjs +4 -4
  53. package/data-grid/index.js +5 -5
  54. package/date-picker/definition.cjs +1 -1
  55. package/date-picker/definition.js +1 -1
  56. package/date-picker/index.cjs +1 -1
  57. package/date-picker/index.js +1 -1
  58. package/date-range-picker/definition.cjs +1 -1
  59. package/date-range-picker/definition.js +1 -1
  60. package/date-range-picker/index.cjs +1 -1
  61. package/date-range-picker/index.js +1 -1
  62. package/date-time-picker/definition.cjs +1 -1
  63. package/date-time-picker/definition.js +1 -1
  64. package/date-time-picker/index.cjs +1 -1
  65. package/date-time-picker/index.js +1 -1
  66. package/dial-pad/definition.cjs +1 -1
  67. package/dial-pad/definition.js +1 -1
  68. package/dial-pad/index.cjs +24 -24
  69. package/dial-pad/index.js +120 -51
  70. package/dialog/definition.cjs +1 -1
  71. package/dialog/definition.js +1 -1
  72. package/divider/definition.cjs +1 -1
  73. package/divider/definition.js +1 -1
  74. package/divider/index.cjs +1 -1
  75. package/divider/index.js +1 -1
  76. package/empty-state/definition.cjs +1 -1
  77. package/empty-state/definition.js +1 -1
  78. package/fab/definition.cjs +1 -1
  79. package/fab/definition.js +1 -1
  80. package/file-picker/definition.cjs +1 -1
  81. package/file-picker/definition.js +1 -1
  82. package/flag/definition.cjs +1 -1
  83. package/flag/definition.js +1 -1
  84. package/header/definition.cjs +1 -1
  85. package/header/definition.js +1 -1
  86. package/header/index.cjs +3 -3
  87. package/header/index.js +3 -3
  88. package/index.cjs +200 -196
  89. package/index.js +53 -52
  90. package/kbd-key/definition.cjs +1 -1
  91. package/kbd-key/definition.js +1 -1
  92. package/kbd-shortcut/definition.cjs +1 -1
  93. package/kbd-shortcut/definition.js +1 -1
  94. package/layout/definition.cjs +1 -1
  95. package/layout/definition.js +1 -1
  96. package/lib/accordion-item/accordion-item.d.ts +2 -1
  97. package/lib/action-group/action-group.d.ts +1 -1
  98. package/lib/alert/alert.d.ts +2 -2
  99. package/lib/audio-player/audio-player.d.ts +1 -1
  100. package/lib/avatar/avatar.d.ts +1 -1
  101. package/lib/badge/badge.d.ts +1 -1
  102. package/lib/banner/banner.d.ts +3 -3
  103. package/lib/breadcrumb/breadcrumb.d.ts +1 -1
  104. package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
  105. package/lib/button/button.d.ts +3 -3
  106. package/lib/calendar-event/calendar-event.d.ts +1 -1
  107. package/lib/card/card.d.ts +1 -1
  108. package/lib/checkbox/checkbox.d.ts +6 -6
  109. package/lib/color-picker/color-picker.d.ts +7 -7
  110. package/lib/combobox/combobox.d.ts +7 -7
  111. package/lib/components.d.ts +1 -0
  112. package/lib/country-group/country-group.d.ts +2 -2
  113. package/lib/data-grid/data-grid-cell.d.ts +4 -3
  114. package/lib/data-grid/data-grid-row.d.ts +3 -2
  115. package/lib/data-grid/data-grid.options.d.ts +5 -0
  116. package/lib/date-picker/date-picker.d.ts +8 -8
  117. package/lib/date-range-picker/date-range-picker.d.ts +4 -4
  118. package/lib/date-time-picker/date-time-picker.d.ts +8 -8
  119. package/lib/dial-pad/dial-pad.d.ts +2 -1
  120. package/lib/dialog/dialog.d.ts +2 -2
  121. package/lib/divider/divider.d.ts +1 -1
  122. package/lib/fab/fab.d.ts +1 -1
  123. package/lib/file-picker/file-picker.d.ts +7 -7
  124. package/lib/header/header.d.ts +1 -1
  125. package/lib/menu/menu.d.ts +2 -2
  126. package/lib/menu-item/menu-item.d.ts +3 -3
  127. package/lib/nav/nav.d.ts +1 -1
  128. package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
  129. package/lib/nav-item/nav-item.d.ts +2 -2
  130. package/lib/note/note.d.ts +1 -1
  131. package/lib/number-field/number-field.d.ts +9 -9
  132. package/lib/optgroup/definition.d.ts +3 -0
  133. package/lib/optgroup/index.d.ts +1 -0
  134. package/lib/optgroup/optgroup.d.ts +430 -0
  135. package/lib/optgroup/optgroup.template.d.ts +2 -0
  136. package/lib/optgroup/variations.browser-spec.d.ts +1 -0
  137. package/lib/option/option.d.ts +2 -2
  138. package/lib/pagination/pagination.d.ts +1 -1
  139. package/lib/popover/popover.d.ts +2 -2
  140. package/lib/progress/progress.d.ts +1 -1
  141. package/lib/progress-ring/progress-ring.d.ts +1 -1
  142. package/lib/radio/radio.d.ts +3 -3
  143. package/lib/radio-group/radio-group.d.ts +1 -1
  144. package/lib/range-slider/range-slider.d.ts +3 -3
  145. package/lib/rich-text-editor/rich-text-editor.d.ts +1 -1
  146. package/lib/searchable-select/option-tag.d.ts +1 -1
  147. package/lib/searchable-select/searchable-select.d.ts +47 -47
  148. package/lib/select/select.d.ts +9 -9
  149. package/lib/selectable-box/selectable-box.d.ts +1 -1
  150. package/lib/simple-color-picker/simple-color-picker.d.ts +2 -2
  151. package/lib/slider/slider.d.ts +3 -3
  152. package/lib/split-button/split-button.d.ts +3 -3
  153. package/lib/status/status.d.ts +1 -1
  154. package/lib/switch/switch.d.ts +2 -2
  155. package/lib/tab/tab.d.ts +3 -3
  156. package/lib/tab-panel/tab-panel.d.ts +1 -1
  157. package/lib/table/table-cell.d.ts +1 -1
  158. package/lib/table/table-header-cell.d.ts +1 -1
  159. package/lib/table/table-row.d.ts +1 -1
  160. package/lib/table/table-sorting-button.d.ts +1 -1
  161. package/lib/tag/tag.d.ts +3 -3
  162. package/lib/tag-group/tag-group.d.ts +1 -1
  163. package/lib/tag-name-map.d.ts +2 -1
  164. package/lib/text-area/text-area.d.ts +8 -8
  165. package/lib/text-field/text-field.d.ts +9 -9
  166. package/lib/time-picker/time-picker.d.ts +4 -4
  167. package/lib/toggletip/toggletip.d.ts +2 -2
  168. package/lib/tooltip/tooltip.d.ts +2 -2
  169. package/lib/tree-item/tree-item.d.ts +2 -2
  170. package/lib/tree-view/tree-view.d.ts +1 -1
  171. package/lib/video-player/video-player.d.ts +1 -1
  172. package/menu/index.cjs +1 -1
  173. package/menu/index.js +1 -1
  174. package/menu-item/index.cjs +1 -1
  175. package/menu-item/index.js +1 -1
  176. package/nav/definition.cjs +1 -1
  177. package/nav/definition.js +1 -1
  178. package/nav-disclosure/definition.cjs +1 -1
  179. package/nav-disclosure/definition.js +1 -1
  180. package/nav-item/definition.cjs +1 -1
  181. package/nav-item/definition.js +1 -1
  182. package/note/definition.cjs +1 -1
  183. package/note/definition.js +1 -1
  184. package/number-field/definition.cjs +1 -1
  185. package/number-field/definition.js +1 -1
  186. package/number-field/index.cjs +1 -1
  187. package/number-field/index.js +1 -1
  188. package/optgroup/definition.cjs +5 -0
  189. package/optgroup/definition.js +2 -0
  190. package/optgroup/index.cjs +1 -0
  191. package/optgroup/index.js +4 -0
  192. package/package.json +6 -6
  193. package/pagination/definition.cjs +1 -1
  194. package/pagination/definition.js +1 -1
  195. package/platform-switch/definition.cjs +1 -1
  196. package/platform-switch/definition.js +1 -1
  197. package/popover/definition.cjs +1 -1
  198. package/popover/definition.js +1 -1
  199. package/progress/definition.cjs +1 -1
  200. package/progress/definition.js +1 -1
  201. package/radio/definition.cjs +1 -1
  202. package/radio/definition.js +1 -1
  203. package/radio-group/definition.cjs +1 -1
  204. package/radio-group/definition.js +1 -1
  205. package/range-slider/definition.cjs +1 -1
  206. package/range-slider/definition.js +1 -1
  207. package/rich-text-editor/definition.cjs +1 -1
  208. package/rich-text-editor/definition.js +1 -1
  209. package/rich-text-editor/index.cjs +1 -1
  210. package/rich-text-editor/index.js +4 -4
  211. package/rich-text-view/definition.cjs +1 -1
  212. package/rich-text-view/definition.js +1 -1
  213. package/searchable-select/definition.cjs +1 -1
  214. package/searchable-select/definition.js +1 -1
  215. package/searchable-select/index.cjs +19 -19
  216. package/searchable-select/index.js +60 -45
  217. package/select/definition.cjs +1 -1
  218. package/select/definition.js +1 -1
  219. package/select/index.cjs +1 -1
  220. package/select/index.js +1 -1
  221. package/selectable-box/definition.cjs +1 -1
  222. package/selectable-box/definition.js +1 -1
  223. package/shared/aria/delegates-aria.d.ts +1 -1
  224. package/shared/aria/host-semantics.d.ts +1 -1
  225. package/shared/color-picker/base-color-picker.d.ts +1 -1
  226. package/shared/feedback/feedback-message.d.ts +1 -1
  227. package/shared/feedback/mixins.d.ts +2 -2
  228. package/shared/foundation/button/button.d.ts +2 -2
  229. package/shared/foundation/form-associated/form-associated.d.ts +2 -2
  230. package/shared/foundation/listbox/extractOptions.d.ts +2 -0
  231. package/shared/foundation/listbox/listbox.d.ts +2 -0
  232. package/shared/patterns/affix.d.ts +2 -2
  233. package/shared/patterns/anchored.d.ts +2 -2
  234. package/shared/patterns/char-count/char-count.d.ts +1 -1
  235. package/shared/patterns/form-elements/form-element.d.ts +1 -1
  236. package/shared/patterns/form-elements/with-contextual-help.d.ts +1 -1
  237. package/shared/patterns/form-elements/with-error-text.d.ts +1 -1
  238. package/shared/patterns/form-elements/with-success-text.d.ts +1 -1
  239. package/shared/patterns/kbd-shortcut.d.ts +1 -1
  240. package/shared/patterns/linkable.d.ts +1 -1
  241. package/shared/patterns/localized.d.ts +2 -2
  242. package/shared/patterns/trapped-focus.d.ts +1 -1
  243. package/shared/picker-field/mixins/calendar-picker.d.ts +2 -2
  244. package/shared/picker-field/mixins/calendar-picker.template.d.ts +2 -2
  245. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +1 -1
  246. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +2 -2
  247. package/shared/picker-field/mixins/single-date-picker.d.ts +2 -2
  248. package/shared/picker-field/mixins/single-value-picker.d.ts +2 -2
  249. package/shared/picker-field/mixins/time-selection-picker.d.ts +2 -2
  250. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +4 -4
  251. package/shared/picker-field/picker-field.d.ts +7 -7
  252. package/side-drawer/definition.cjs +1 -1
  253. package/side-drawer/definition.js +1 -1
  254. package/simple-color-picker/definition.cjs +1 -1
  255. package/simple-color-picker/definition.js +1 -1
  256. package/split-button/definition.cjs +1 -1
  257. package/split-button/definition.js +1 -1
  258. package/split-button/index.cjs +1 -0
  259. package/split-button/index.js +1 -0
  260. package/status/definition.cjs +1 -1
  261. package/status/definition.js +1 -1
  262. package/switch/definition.cjs +1 -1
  263. package/switch/definition.js +1 -1
  264. package/switch/index.cjs +6 -5
  265. package/switch/index.js +16 -14
  266. package/tab/definition.cjs +1 -1
  267. package/tab/definition.js +1 -1
  268. package/tab-panel/definition.cjs +1 -1
  269. package/tab-panel/definition.js +1 -1
  270. package/table/definition.cjs +1 -1
  271. package/table/definition.js +1 -1
  272. package/tabs/definition.cjs +1 -1
  273. package/tabs/definition.js +1 -1
  274. package/tag/definition.cjs +1 -1
  275. package/tag/definition.js +1 -1
  276. package/tag-group/definition.cjs +1 -1
  277. package/tag-group/definition.js +1 -1
  278. package/text-area/definition.cjs +1 -1
  279. package/text-area/definition.js +1 -1
  280. package/time-picker/definition.cjs +1 -1
  281. package/time-picker/definition.js +1 -1
  282. package/tree-item/definition.cjs +1 -1
  283. package/tree-item/definition.js +1 -1
  284. package/tree-view/definition.cjs +1 -1
  285. package/tree-view/definition.js +1 -1
  286. package/unbundled/definition13.cjs +1 -1
  287. package/unbundled/definition13.js +1 -1
  288. package/unbundled/definition2.cjs +9 -3
  289. package/unbundled/definition2.js +9 -3
  290. package/unbundled/definition23.cjs +1 -0
  291. package/unbundled/definition23.js +2 -1
  292. package/unbundled/definition29.cjs +2 -2
  293. package/unbundled/definition29.js +2 -2
  294. package/unbundled/definition30.cjs +65 -484
  295. package/unbundled/definition30.js +57 -482
  296. package/unbundled/definition31.cjs +501 -39
  297. package/unbundled/definition31.js +499 -37
  298. package/unbundled/definition32.cjs +38 -239
  299. package/unbundled/definition32.js +35 -236
  300. package/unbundled/definition33.cjs +236 -74
  301. package/unbundled/definition33.js +233 -71
  302. package/unbundled/definition34.cjs +74 -1968
  303. package/unbundled/definition34.js +70 -1940
  304. package/unbundled/definition35.cjs +1992 -26
  305. package/unbundled/definition35.js +1964 -27
  306. package/unbundled/definition36.cjs +26 -111
  307. package/unbundled/definition36.js +23 -103
  308. package/unbundled/definition37.cjs +53 -294
  309. package/unbundled/definition37.js +50 -291
  310. package/unbundled/definition38.cjs +282 -132
  311. package/unbundled/definition38.js +279 -129
  312. package/unbundled/definition39.cjs +165 -339
  313. package/unbundled/definition39.js +163 -337
  314. package/unbundled/definition40.cjs +394 -228
  315. package/unbundled/definition40.js +391 -225
  316. package/unbundled/definition41.cjs +263 -46
  317. package/unbundled/definition41.js +258 -41
  318. package/unbundled/definition42.cjs +47 -67
  319. package/unbundled/definition42.js +45 -65
  320. package/unbundled/definition43.cjs +56 -383
  321. package/unbundled/definition43.js +55 -382
  322. package/unbundled/definition44.cjs +386 -44
  323. package/unbundled/definition44.js +382 -40
  324. package/unbundled/definition45.cjs +53 -45
  325. package/unbundled/definition45.js +49 -41
  326. package/unbundled/definition46.cjs +40 -164
  327. package/unbundled/definition46.js +36 -160
  328. package/unbundled/definition47.cjs +171 -31
  329. package/unbundled/definition47.js +168 -22
  330. package/unbundled/definition48.cjs +30 -89
  331. package/unbundled/definition48.js +22 -87
  332. package/unbundled/definition49.cjs +70 -33
  333. package/unbundled/definition49.js +67 -30
  334. package/unbundled/definition50.cjs +54 -23
  335. package/unbundled/definition50.js +52 -18
  336. package/unbundled/definition51.cjs +23 -39
  337. package/unbundled/definition51.js +17 -36
  338. package/unbundled/definition52.cjs +29 -314
  339. package/unbundled/definition52.js +27 -312
  340. package/unbundled/definition53.cjs +301 -195
  341. package/unbundled/definition53.js +297 -191
  342. package/unbundled/definition54.cjs +210 -40
  343. package/unbundled/definition54.js +206 -36
  344. package/unbundled/definition55.cjs +42 -266
  345. package/unbundled/definition55.js +38 -262
  346. package/unbundled/definition56.cjs +266 -50
  347. package/unbundled/definition56.js +263 -46
  348. package/unbundled/definition57.cjs +48 -146
  349. package/unbundled/definition57.js +47 -143
  350. package/unbundled/definition58.cjs +127 -225
  351. package/unbundled/definition58.js +122 -223
  352. package/unbundled/definition59.cjs +199 -418
  353. package/unbundled/definition59.js +196 -415
  354. package/unbundled/definition60.cjs +441 -3738
  355. package/unbundled/definition60.js +431 -3565
  356. package/unbundled/definition61.cjs +3712 -728
  357. package/unbundled/definition61.js +3538 -717
  358. package/unbundled/definition62.cjs +769 -97
  359. package/unbundled/definition62.js +766 -94
  360. package/unbundled/definition63.cjs +100 -981
  361. package/unbundled/definition63.js +98 -976
  362. package/unbundled/definition64.cjs +988 -93
  363. package/unbundled/definition64.js +982 -90
  364. package/unbundled/definition65.cjs +109 -73
  365. package/unbundled/definition65.js +105 -63
  366. package/unbundled/definition66.cjs +69 -155
  367. package/unbundled/definition66.js +60 -152
  368. package/unbundled/definition67.cjs +154 -118
  369. package/unbundled/definition67.js +151 -115
  370. package/unbundled/definition68.cjs +124 -49
  371. package/unbundled/definition68.js +120 -45
  372. package/unbundled/definition69.cjs +51 -84
  373. package/unbundled/definition69.js +50 -80
  374. package/unbundled/definition70.cjs +91 -19
  375. package/unbundled/definition70.js +86 -14
  376. package/unbundled/definition71.cjs +20 -87
  377. package/unbundled/definition71.js +14 -84
  378. package/unbundled/definition72.cjs +76 -294
  379. package/unbundled/definition72.js +71 -217
  380. package/unbundled/definition73.cjs +288 -311
  381. package/unbundled/definition73.js +218 -306
  382. package/unbundled/definition74.cjs +326 -26
  383. package/unbundled/definition74.js +317 -23
  384. package/unbundled/definition75.cjs +27 -122
  385. package/unbundled/definition75.js +22 -118
  386. package/unbundled/definition76.cjs +103 -232
  387. package/unbundled/definition76.js +99 -228
  388. package/unbundled/definition77.cjs +259 -26
  389. package/unbundled/definition77.js +249 -23
  390. package/unbundled/definition78.cjs +29 -148
  391. package/unbundled/definition78.js +27 -133
  392. package/unbundled/definition79.cjs +117 -173
  393. package/unbundled/definition79.js +108 -169
  394. package/unbundled/definition80.cjs +181 -477
  395. package/unbundled/definition80.js +176 -471
  396. package/unbundled/definition81.cjs +517 -0
  397. package/unbundled/definition81.js +497 -0
  398. package/unbundled/extractOptions.cjs +21 -0
  399. package/unbundled/extractOptions.js +16 -0
  400. package/unbundled/listbox.cjs +23 -6
  401. package/unbundled/listbox.js +23 -6
  402. package/unbundled/vivid-element.cjs +10 -1
  403. package/unbundled/vivid-element.js +10 -1
  404. package/video-player/definition.cjs +1 -1
  405. package/video-player/definition.js +1 -1
  406. package/vivid.api.json +194 -0
@@ -1,123 +1,795 @@
1
- import { d as createRegisterFunction, t as VividElement, u as defineVividComponent } from "./vivid-element.js";
1
+ import { d as createRegisterFunction, u as defineVividComponent } from "./vivid-element.js";
2
+ import { t as iconDefinition } from "./definition.js";
2
3
  import { t as __decorate } from "./decorate.js";
3
- import { c as impl, n as removeSymbol, s as sortedContributions, t as dispatchSlottableRequest } from "./slottable-request.js";
4
- import { ElementStyles, html, observable, ref } from "@microsoft/fast-element";
5
- import { DOMSerializer, Mark, Node } from "prosemirror-model";
6
- //#region src/lib/rich-text-view/rich-text-view.scss?inline
7
- var rich_text_view_default = ":host{display:contents}.content{overflow-wrap:break-word;white-space:break-spaces;display:contents}";
4
+ import { a as affixIconTemplateFactory, i as IconWrapper, n as AffixIconWithTrailing } from "./affix.js";
5
+ import { n as FormAssociated } from "./form-associated.js";
6
+ import { t as Localized } from "./localized.js";
7
+ import { i as Button, r as chevronTemplateFactory, t as buttonDefinition } from "./definition6.js";
8
+ import { t as handleEscapeKeyAndStopPropogation } from "./dialog.js";
9
+ import { i as Popup, t as popupDefinition } from "./definition9.js";
10
+ import { n as applyHostSemantics, t as HostSemantics } from "./host-semantics.js";
11
+ import { n as WithLightDOMFeedback, r as feedbackMessageDefinition } from "./mixins.js";
12
+ import { t as FormElement } from "./form-element.js";
13
+ import { t as WithErrorText } from "./with-error-text.js";
14
+ import { t as WithSuccessText } from "./with-success-text.js";
15
+ import { t as WithContextualHelp } from "./with-contextual-help.js";
16
+ import { r as ListboxOption, t as listboxOptionDefinition } from "./definition29.js";
17
+ import { t as optgroupDefinition } from "./definition30.js";
18
+ import { t as Listbox } from "./listbox.js";
19
+ import { Observable, Updates, attr, html, observable, ref, slotted, volatile, when } from "@microsoft/fast-element";
20
+ import { classNames, inRange, keyArrowDown, keyArrowUp, keyEnd, keyEnter, keyEscape, keyHome, keySpace, keyTab, uniqueId } from "@microsoft/fast-web-utilities";
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;display:flex;transform:rotate(0)}@media (prefers-reduced-motion:no-preference){.chevron{transition:transform .2s}}:host([data-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{--_low-ink-color:var(--vvd-color-neutral-600);--focus-stroke-gap-color:transparent;flex-direction:column;gap:4px;display:inline-flex}:host([disabled]){--_low-ink-color:var(--vvd-color-neutral-600);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.control{--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-canvas);--_appearance-color-outline:var(--vvd-color-neutral-500)}.control.appearance-ghost{--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}@media (hover:hover){.control:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-canvas);--_appearance-color-outline:var(--vvd-color-neutral-700)}.control:hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:transparent}}.control.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-canvas);--_appearance-color-outline:var(--vvd-color-neutral-700)}.control.hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:transparent}.control:disabled{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:var(--vvd-color-neutral-100);--_appearance-color-outline:var(--vvd-color-neutral-300)}.control:disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.disabled{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:var(--vvd-color-neutral-100);--_appearance-color-outline:var(--vvd-color-neutral-300)}.control.disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.readonly:where(:not(.disabled,:disabled)){--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-neutral-200);--_appearance-color-outline:var(--vvd-color-neutral-400)}.control.readonly:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.error:where(:not(.disabled,:disabled)){--_appearance-color-text:notset;--_appearance-color-fill:var(--vvd-color-alert-50);--_appearance-color-outline:var(--vvd-color-alert-500)}.control.error:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notset;--_appearance-color-fill:var(--vvd-color-alert-50);--_appearance-color-outline:transparent}.control.success:where(:not(.disabled,:disabled)){--_appearance-color-text:notset;--_appearance-color-fill:var(--vvd-color-success-50);--_appearance-color-outline:var(--vvd-color-success-500)}.control.success:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notset;--_appearance-color-fill:var(--vvd-color-success-50);--_appearance-color-outline:transparent}.control{--_connotation-color-primary:var(--vvd-select-accent-primary,var(--vvd-color-canvas-text));--_connotation-color-primary-text:var(--vvd-select-accent-primary-text,var(--vvd-color-canvas));--_connotation-color-primary-increment:var(--vvd-select-accent-primary-increment,var(--vvd-color-neutral-800));--_connotation-color-intermediate:var(--vvd-select-accent-intermediate,var(--vvd-color-neutral-500));--_connotation-color-faint:var(--vvd-select-accent-faint,var(--vvd-color-neutral-50));--_connotation-color-soft:var(--vvd-select-accent-soft,var(--vvd-color-neutral-100));--_connotation-color-firm:var(--vvd-select-accent-firm,var(--vvd-color-canvas-text));--_connotation-color-fierce:var(--vvd-select-accent-fierce,var(--vvd-color-neutral-700));border-radius:var(--_select-control-border-radius);block-size:var(--_select-block-size);padding-inline:var(--_select-padding-inline);--_select-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);--_select-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_select-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);justify-content:space-between;align-items:center;gap:8px;transition:box-shadow .2s,background-color .2s;display:flex}.control.size-condensed{--_select-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_select-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_select-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2)}.control.size-condensed:not(.shape-pill){--_select-control-border-radius:4px}.control-wrapper{position:relative}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.control:not(.shape-pill){--_select-control-border-radius:8px}.control.shape-pill{--_select-control-border-radius:24px}.listbox{max-height:var(--select-height,408px);flex-direction:column;gap:2px;padding:4px;display:flex;overflow-y:auto}:host([multiple]:focus-visible) .listbox{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));border-radius:8px}.selected-value{white-space:nowrap;flex-grow:1;align-items:center;column-gap:12px;display:flex;overflow:hidden}.selected-value .text{text-overflow:ellipsis;max-inline-size:100%;overflow:hidden}.control.shows-placeholder .selected-value .text{color:var(--vvd-color-neutral-600)}.selected-value slot[name=icon]{flex:0 0 var(--_select-icon-size);font-size:var(--_select-icon-size);line-height:1}.control.has-meta .selected-value{padding-inline-end:8px}.feedback-wrapper{display:contents}::part(popup-base){inline-size:max-content;min-inline-size:var(--_select-fixed-width,100%)}:host([multiple]) ::part(popup-base){position:static}@supports selector(:has(*)){:host(:focus-within) .control:not(.has-activedescendant,:has(.clear-button:focus)){--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){:host(:focus-within) .control:not(.has-activedescendant){--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}:host([multiple]),:host(:not(:focus-visible)){--_suppressable-focus-shadow:none;--_suppressable-focus-outline:none;--_suppressable-focus-outline-offset:0}:host([multiple]) .clear-button{margin-inline-start:auto}:host([multiple][clearable]) .label-wrapper{min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16))}";
8
23
  //#endregion
9
- //#region src/lib/rich-text-view/rich-text-view.ts
24
+ //#region src/lib/select/select.ts
10
25
  /**
11
26
  * @public
12
- * @component rich-text-view
13
- * @dynamicSlot `@vonage/vivid#RteChildSlotProps` child - Used for custom rendered children.
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
34
+ * @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
35
+ * @testAction selectOptionByValue selectOptionByValue
36
+ * @testAction selectOptionByText selectOptionByText
14
37
  */
15
- var RichTextView = class extends VividElement {
38
+ var Select = class extends WithLightDOMFeedback(WithContextualHelp(WithErrorText(WithSuccessText(Localized(FormElement(HostSemantics(AffixIconWithTrailing(FormAssociated(Listbox))))))))) {
16
39
  constructor(..._args) {
17
40
  super(..._args);
18
- this._slotCounter = 0;
19
- this._slottedChildren = /* @__PURE__ */ new Set();
20
- this._slotRequests = /* @__PURE__ */ new Set();
21
- this._contentElement = null;
41
+ this.proxy = document.createElement("select");
42
+ this.activeIndex = -1;
43
+ this.rangeStartIndex = -1;
44
+ this.open = false;
45
+ this.listboxId = uniqueId("listbox-");
46
+ this.maxHeight = 0;
47
+ this.fixedDropdown = false;
48
+ this._feedbackWrapper = null;
49
+ this._isResetting = false;
50
+ this.clearable = false;
51
+ this._isClearButtonFocused = false;
52
+ }
53
+ /**
54
+ * Returns the last checked option.
55
+ *
56
+ * @internal
57
+ */
58
+ get activeOption() {
59
+ return this.options[this.activeIndex];
60
+ }
61
+ /**
62
+ * Returns the list of checked options.
63
+ *
64
+ * @internal
65
+ */
66
+ get checkedOptions() {
67
+ return this.options.filter((o) => o.checked);
68
+ }
69
+ /**
70
+ * Returns the index of the first selected option.
71
+ *
72
+ * @internal
73
+ */
74
+ get firstSelectedOptionIndex() {
75
+ return this.options.indexOf(this.firstSelectedOption);
76
+ }
77
+ /**
78
+ * Updates the `ariaActiveDescendant` property when the active index changes.
79
+ *
80
+ * @internal
81
+ */
82
+ activeIndexChanged(_, next) {
83
+ this._activeDescendant = this.options[next]?.id ?? "";
84
+ this.focusAndScrollOptionIntoView();
85
+ }
86
+ /**
87
+ * Toggles the checked state for the currently active option.
88
+ *
89
+ * @remarks
90
+ * Multiple-selection mode only.
91
+ *
92
+ * @internal
93
+ */
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 = 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 = 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 = 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 = inRange(i, previousIndex, this.rangeStartIndex + 1) && !o.disabled;
183
+ });
184
+ } else this.uncheckAllOptions();
185
+ this.activeIndex = previousIndex;
186
+ this.checkActiveIndex();
187
+ }
188
+ /** @internal */
189
+ focusAndScrollOptionIntoView() {
190
+ super.focusAndScrollOptionIntoView(this.activeOption);
191
+ }
192
+ /**
193
+ * In multiple-selection mode:
194
+ * If any options are selected, the first selected option is checked when
195
+ * the listbox receives focus. If no options are selected, the first
196
+ * selectable option is checked.
197
+ *
198
+ * @internal
199
+ */
200
+ focusinHandler(e) {
201
+ if (!this.multiple) {
202
+ super.focusinHandler(e);
203
+ return;
204
+ }
205
+ /* v8 ignore else -- @preserve */
206
+ if (!this.shouldSkipFocus && e.target === e.currentTarget) {
207
+ this.uncheckAllOptions();
208
+ if (this.activeIndex === -1) this.activeIndex = this.firstSelectedOptionIndex !== -1 ? this.firstSelectedOptionIndex : 0;
209
+ this.checkActiveIndex();
210
+ this.setSelectedOptions();
211
+ this.focusAndScrollOptionIntoView();
212
+ }
213
+ this.shouldSkipFocus = false;
214
+ }
215
+ /** Sets an option as selected and gives it focus. */
216
+ setSelectedOptions() {
217
+ if (!this.multiple) {
218
+ super.setSelectedOptions();
219
+ return;
220
+ }
221
+ /* v8 ignore else -- @preserve */
222
+ if (this.$fastController.isConnected && this.options) {
223
+ this.selectedOptions = this.options.filter((o) => o.selected);
224
+ this.focusAndScrollOptionIntoView();
225
+ }
226
+ }
227
+ /**
228
+ * Toggles the selected state of the provided options. If any provided items
229
+ * are in an unselected state, all items are set to selected. If every
230
+ * provided item is selected, they are all unselected.
231
+ *
232
+ * @internal
233
+ */
234
+ toggleSelectedForAllCheckedOptions() {
235
+ const enabledCheckedOptions = this.checkedOptions.filter((o) => !o.disabled);
236
+ const force = !enabledCheckedOptions.every((o) => o.selected);
237
+ enabledCheckedOptions.forEach((o) => o.selected = force);
238
+ this.selectedIndex = this.options.indexOf(enabledCheckedOptions[enabledCheckedOptions.length - 1]);
239
+ this.setSelectedOptions();
240
+ this.updateValue(true);
22
241
  }
23
242
  /** @internal */
24
- viewChanged(oldView, newView) {
25
- if (oldView) this._removeStyles();
26
- if (newView) this._addStyles(newView);
27
- this._updateView();
28
- }
29
- _addStyles(view) {
30
- const config = view[impl].config[impl];
31
- this._styles = new ElementStyles(sortedContributions(config.features.flatMap((f) => f.getStyles())));
32
- this._styles.addStylesTo(this.shadowRoot);
33
- }
34
- _removeStyles() {
35
- if (this._styles) {
36
- this._styles.removeStylesFrom(this.shadowRoot);
37
- this._styles = void 0;
243
+ typeaheadBufferChanged(prev, next) {
244
+ if (!this.multiple) {
245
+ super.typeaheadBufferChanged(prev, next);
246
+ return;
247
+ }
248
+ /* v8 ignore if -- @preserve */
249
+ if (this.$fastController.isConnected) {
250
+ const typeaheadMatches = this.getTypeaheadMatches();
251
+ const activeIndex = this.options.indexOf(typeaheadMatches[0]);
252
+ if (activeIndex > -1) {
253
+ this.activeIndex = activeIndex;
254
+ this.uncheckAllOptions();
255
+ this.checkActiveIndex();
256
+ }
257
+ this.typeaheadExpired = false;
38
258
  }
39
259
  }
40
- _cleanupLightDom() {
41
- for (const el of this._slottedChildren) this.removeChild(el);
42
- for (const slotName of this._slotRequests) dispatchSlottableRequest(this, "child", slotName, removeSymbol);
43
- this._slottedChildren.clear();
44
- this._slotRequests.clear();
45
- this._slotCounter = 0;
46
- }
47
- _updateView() {
48
- if (!this._contentElement) return;
49
- this._contentElement.innerHTML = "";
50
- this._cleanupLightDom();
51
- if (this.view) this._contentElement.appendChild(this._renderView(this.view));
52
- }
53
- _renderView(rteView) {
54
- const ctx = rteView[impl];
55
- if (rteView.type === "node" && rteView.node.type === "doc") rteView = rteView.children;
56
- if (rteView.type === "fragment") {
57
- const frag = document.createDocumentFragment();
58
- for (const child of rteView.content) frag.appendChild(this._renderView(child));
59
- return frag;
260
+ /**
261
+ * Unchecks all options.
262
+ *
263
+ * @remarks
264
+ * Multiple-selection mode only.
265
+ *
266
+ * @param preserveChecked - reset the rangeStartIndex
267
+ *
268
+ * @internal
269
+ */
270
+ uncheckAllOptions(preserveChecked = false) {
271
+ this.options.forEach((o) => o.checked = false);
272
+ /* v8 ignore else -- @preserve */
273
+ if (!preserveChecked) this.rangeStartIndex = -1;
274
+ }
275
+ /**
276
+ * Sets focus when the open property changes.
277
+ *
278
+ * @internal
279
+ */
280
+ openChanged(prev, next) {
281
+ if (!this.collapsible) return;
282
+ if (this.open) {
283
+ this.focusAndScrollOptionIntoView();
284
+ this.indexWhenOpened = this.selectedIndex;
285
+ Updates.enqueue(() => this.focus());
286
+ return;
60
287
  }
61
- const customRenderedView = ctx.options.renderChildView?.(rteView) ?? false;
62
- if (customRenderedView) return this._handleCustomRender(rteView, customRenderedView);
63
- else return this._renderDefault(rteView);
64
- }
65
- _handleCustomRender(rteView, customResult) {
66
- const slotName = `child-view-${this._slotCounter++}`;
67
- const slot = document.createElement("slot");
68
- slot.setAttribute("name", slotName);
69
- if (customResult === true) {
70
- this._slotRequests.add(slotName);
71
- dispatchSlottableRequest(this, "child", slotName, { view: rteView });
72
- } else {
73
- const { dom, contentDom = dom } = customResult;
74
- const nestedView = document.createElement(this.tagName);
75
- nestedView.view = rteView.children;
76
- contentDom.appendChild(nestedView);
77
- dom.setAttribute("slot", slotName);
78
- this.appendChild(dom);
79
- this._slottedChildren.add(dom);
288
+ const didClose = prev && !next;
289
+ const selectionChangedWhileOpen = this.indexWhenOpened !== this.selectedIndex;
290
+ if (didClose && selectionChangedWhileOpen) this.updateValue(true);
291
+ }
292
+ /**
293
+ * The component is collapsible when in single-selection mode.
294
+ *
295
+ * @internal
296
+ */
297
+ get collapsible() {
298
+ return !this.multiple;
299
+ }
300
+ /** @internal */
301
+ valueChanged(prev, next) {
302
+ const nextSelectedIndex = this.options.findIndex((el) => el.value === next);
303
+ const validNextSelectedIndex = this._validSelectedIndex(nextSelectedIndex);
304
+ const nextValue = this.options[validNextSelectedIndex]?.value ?? "";
305
+ if (this.selectedIndex !== validNextSelectedIndex) this.selectedIndex = validNextSelectedIndex;
306
+ if (next !== nextValue) return;
307
+ super.valueChanged(prev, next);
308
+ this.updateDisplayValue();
309
+ }
310
+ /**
311
+ * Sets the value and display value to match the first selected option.
312
+ *
313
+ * @param shouldEmit - if true, the input and change events will be emitted
314
+ *
315
+ * @internal
316
+ */
317
+ updateValue(shouldEmit) {
318
+ if (this.$fastController.isConnected) this.value = this.firstSelectedOption?.value ?? "";
319
+ if (shouldEmit) {
320
+ this.$emit("input");
321
+ this.$emit("change", this, {
322
+ bubbles: true,
323
+ composed: void 0
324
+ });
80
325
  }
81
- return slot;
82
- }
83
- _renderDefault(view) {
84
- const schema = view[impl].config[impl].schema;
85
- if (view.type === "node" && view.node.type === "text") return document.createTextNode(view.node.text);
86
- const item = view.type === "node" ? view.node : view.mark;
87
- const pmItem = view.type === "node" ? Node.fromJSON(schema, item) : Mark.fromJSON(schema, item);
88
- const spec = pmItem instanceof Node ? pmItem.type.spec.toDOM(pmItem) : pmItem.type.spec.toDOM(pmItem, true);
89
- const { dom, contentDOM = dom } = DOMSerializer.renderSpec(document, spec);
90
- const childrenRendered = this._renderView(view.children);
91
- contentDOM.appendChild(childrenRendered);
92
- return dom;
326
+ }
327
+ /**
328
+ * Updates the proxy value when the selected index changes.
329
+ *
330
+ * @param prev - the previous selected index
331
+ * @param next - the next selected index
332
+ *
333
+ * @internal
334
+ */
335
+ selectedIndexChanged(prev, next) {
336
+ super.selectedIndexChanged(prev, next);
337
+ this.updateValue();
338
+ }
339
+ /**
340
+ * Handle opening and closing the listbox when the select is clicked.
341
+ *
342
+ * @param e - the mouse event
343
+ * @internal
344
+ */
345
+ clickHandler(e) {
346
+ if (this.disabled || this._isFromContextualHelp(e)) return;
347
+ const clickedOption = e.target.closest(`option,[role=option],[data-vvd-component=option]`);
348
+ if (clickedOption && clickedOption.disabled) return;
349
+ if (this.multiple) {
350
+ this.uncheckAllOptions();
351
+ this.activeIndex = this.options.indexOf(clickedOption);
352
+ this.checkActiveIndex();
353
+ this.toggleSelectedForAllCheckedOptions();
354
+ } else super.clickHandler(e);
355
+ if (this.collapsible) this.open = !this.open;
356
+ return true;
357
+ }
358
+ /**
359
+ * Handles focus state when the element or its children lose focus.
360
+ *
361
+ * @param e - The focus event
362
+ * @internal
363
+ */
364
+ focusoutHandler(e) {
365
+ if (this.multiple) this.uncheckAllOptions();
366
+ if (!this.open) return true;
367
+ const focusTarget = e.relatedTarget;
368
+ if (this.isSameNode(focusTarget)) {
369
+ this.focus();
370
+ return;
371
+ }
372
+ /* v8 ignore else -- @preserve */
373
+ if (!this.options.includes(focusTarget)) {
374
+ this.open = false;
375
+ if (this.indexWhenOpened !== this.selectedIndex) this.updateValue(true);
376
+ }
377
+ }
378
+ /**
379
+ * Updates the value when an option's value changes.
380
+ *
381
+ * @param source - the source object
382
+ * @param propertyName - the property to evaluate
383
+ *
384
+ * @internal
385
+ */
386
+ handleChange(source, propertyName) {
387
+ super.handleChange(source, propertyName);
388
+ if (propertyName === "value") this.updateValue();
389
+ }
390
+ /**
391
+ * Prevents focus when a scrollbar is clicked.
392
+ *
393
+ * @param e - the mouse event object
394
+ *
395
+ * @internal
396
+ */
397
+ mousedownHandler(e) {
398
+ if (e.offsetX >= 0 && e.offsetX <= this.listbox.scrollWidth) return super.mousedownHandler(e);
399
+ return this.collapsible;
93
400
  }
94
401
  /** @internal */
402
+ multipleChanged(_, next) {
403
+ this.options.forEach((o) => {
404
+ o.checked = next ? false : void 0;
405
+ });
406
+ this.setSelectedOptions();
407
+ /* v8 ignore if -- @preserve */
408
+ if (this.proxy) this.proxy.multiple = next;
409
+ }
410
+ /**
411
+ * Updates the selectedness of each option when the list of selected options changes.
412
+ *
413
+ * @param prev - the previous list of selected options
414
+ * @param next - the current list of selected options
415
+ *
416
+ * @internal
417
+ */
418
+ selectedOptionsChanged(prev, next) {
419
+ super.selectedOptionsChanged(prev, next);
420
+ this.options.forEach((o, i) => {
421
+ const proxyOption = this.proxy.options.item(i);
422
+ if (proxyOption) proxyOption.selected = o.selected;
423
+ });
424
+ }
425
+ /**
426
+ * Resets and fills the proxy to match the component's options.
427
+ *
428
+ * @internal
429
+ */
430
+ setProxyOptions() {
431
+ /* v8 ignore else -- @preserve */
432
+ if (this.proxy instanceof HTMLSelectElement && this.options) {
433
+ this.proxy.length = 0;
434
+ this.options.forEach((option) => {
435
+ const proxyOption = option.proxy || (option instanceof HTMLOptionElement ? option.cloneNode() : null);
436
+ if (proxyOption) this.proxy.options.add(proxyOption);
437
+ });
438
+ }
439
+ }
440
+ /**
441
+ * Handles keydown actions when the select is in multiple selection mode.
442
+ *
443
+ * @internal
444
+ */
445
+ multipleKeydownHandler(e) {
446
+ if (this.disabled) return;
447
+ const { key, shiftKey } = e;
448
+ this.shouldSkipFocus = false;
449
+ switch (key) {
450
+ case keyHome:
451
+ this.checkFirstOption(shiftKey);
452
+ return;
453
+ case keyArrowDown:
454
+ this.checkNextOption(shiftKey);
455
+ return;
456
+ case keyArrowUp:
457
+ this.checkPreviousOption(shiftKey);
458
+ return;
459
+ case keyEnd:
460
+ this.checkLastOption(shiftKey);
461
+ return;
462
+ case keyTab:
463
+ this.focusAndScrollOptionIntoView();
464
+ return;
465
+ case keyEscape:
466
+ this.uncheckAllOptions();
467
+ this.checkActiveIndex();
468
+ return;
469
+ case keySpace:
470
+ e.preventDefault();
471
+ /* v8 ignore else -- @preserve */
472
+ if (this.typeaheadExpired) {
473
+ this.toggleSelectedForAllCheckedOptions();
474
+ return;
475
+ }
476
+ default:
477
+ /* v8 ignore else -- @preserve */
478
+ if (key.length === 1) this.handleTypeAhead(key);
479
+ return;
480
+ }
481
+ }
482
+ /**
483
+ * Handle keyboard interaction for the select.
484
+ *
485
+ * @param e - the keyboard event
486
+ * @internal
487
+ */
488
+ keydownHandler(e) {
489
+ const selectedIndexBefore = this.selectedIndex;
490
+ if (this.multiple) this.multipleKeydownHandler(e);
491
+ else super.keydownHandler(e);
492
+ switch (e.key) {
493
+ case keySpace:
494
+ e.preventDefault();
495
+ if (this.collapsible && this.typeaheadExpired) this.open = !this.open;
496
+ break;
497
+ case keyHome:
498
+ case keyEnd:
499
+ e.preventDefault();
500
+ break;
501
+ case keyEnter:
502
+ e.preventDefault();
503
+ this.open = !this.open;
504
+ break;
505
+ case keyEscape:
506
+ if (this.collapsible && this.open) {
507
+ e.preventDefault();
508
+ this.open = false;
509
+ }
510
+ break;
511
+ case keyTab:
512
+ if (this.collapsible && this.open) {
513
+ e.preventDefault();
514
+ this.open = false;
515
+ }
516
+ return true;
517
+ }
518
+ if (this.collapsible && !this.open && this.selectedIndex !== selectedIndexBefore) this.updateValue(true);
519
+ return !(e.key === keyArrowDown || e.key === keyArrowUp);
520
+ }
95
521
  connectedCallback() {
96
522
  super.connectedCallback();
97
- this._updateView();
523
+ this.addEventListener("focusout", this.focusoutHandler);
524
+ this.addEventListener("contentchange", this.updateDisplayValue);
98
525
  }
99
- /** @internal */
100
526
  disconnectedCallback() {
527
+ this.removeEventListener("focusout", this.focusoutHandler);
528
+ this.removeEventListener("contentchange", this.updateDisplayValue);
101
529
  super.disconnectedCallback();
102
- this._removeStyles();
103
- this._cleanupLightDom();
530
+ }
531
+ /** @internal */
532
+ updateDisplayValue() {
533
+ if (this.collapsible) Observable.notify(this, "displayValue");
534
+ }
535
+ get displayValue() {
536
+ Observable.track(this, "displayValue");
537
+ return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
538
+ }
539
+ _newDefaultSelectedIndex(prev, next, currentSelectIndex) {
540
+ const defaultSelectedIndex = super._newDefaultSelectedIndex(prev, next, currentSelectIndex);
541
+ if (defaultSelectedIndex === null && currentSelectIndex === -1 && !this.placeholder) {
542
+ const firstSelectableIndex = this.getNextSelectableIndex(0);
543
+ if (firstSelectableIndex !== -1) return firstSelectableIndex;
544
+ }
545
+ return defaultSelectedIndex;
546
+ }
547
+ _isDefaultSelected(option) {
548
+ return super._isDefaultSelected(option) || option.value === this.initialValue || !this._isResetting && option.value === this.value;
549
+ }
550
+ slottedOptionsChanged(prev, next) {
551
+ this.options.forEach((o) => {
552
+ Observable.getNotifier(o).unsubscribe(this, "value");
553
+ });
554
+ super.slottedOptionsChanged(prev, next);
555
+ this.options.forEach((o) => {
556
+ Observable.getNotifier(o).subscribe(this, "value");
557
+ });
558
+ this.setProxyOptions();
559
+ this.updateValue();
560
+ const scale = this.getAttribute("scale") || this.scale;
561
+ next.forEach((element) => {
562
+ if (scale) {
563
+ element.setAttribute("scale", scale);
564
+ element.scale = scale;
565
+ }
566
+ });
567
+ this.proxy.value = this.value;
568
+ this.validate();
569
+ }
570
+ formResetCallback() {
571
+ this.setProxyOptions();
572
+ this._isResetting = true;
573
+ this.selectedIndex = this._newDefaultSelectedIndex([], this.options, -1) ?? -1;
574
+ this._isResetting = false;
575
+ }
576
+ /** @internal */
577
+ get _shouldShowClearButton() {
578
+ if (!this.clearable) return false;
579
+ if (this.multiple) return this.selectedOptions?.length > 0;
580
+ return this.value !== "";
581
+ }
582
+ /** @internal */
583
+ _onClearButtonFocus() {
584
+ this._isClearButtonFocused = true;
585
+ this.activeIndex = -1;
586
+ this.uncheckAllOptions();
587
+ }
588
+ /** @internal */
589
+ _onClearButtonBlur() {
590
+ this._isClearButtonFocused = false;
591
+ }
592
+ /** @internal */
593
+ get _shouldShowLabelWrapper() {
594
+ return Boolean(this.label || this._hasContextualHelp || this.multiple && this._shouldShowClearButton);
595
+ }
596
+ /** @internal */
597
+ _onClearButtonClick() {
598
+ if (this.multiple) this.selectedOptions.forEach((o) => {
599
+ /* v8 ignore else -- @preserve */
600
+ if (!o.disabled) o.selected = false;
601
+ });
602
+ else this.selectedIndex = -1;
603
+ this.updateValue(true);
104
604
  }
105
605
  };
106
- __decorate([observable], RichTextView.prototype, "view", void 0);
606
+ __decorate([observable], Select.prototype, "activeIndex", void 0);
607
+ __decorate([attr({ mode: "boolean" })], Select.prototype, "multiple", void 0);
608
+ __decorate([attr({
609
+ attribute: "open",
610
+ mode: "boolean"
611
+ })], Select.prototype, "open", void 0);
612
+ __decorate([volatile], Select.prototype, "collapsible", null);
613
+ __decorate([observable], Select.prototype, "control", void 0);
614
+ __decorate([observable], Select.prototype, "maxHeight", void 0);
615
+ __decorate([observable], Select.prototype, "_anchor", void 0);
616
+ __decorate([attr()], Select.prototype, "scale", void 0);
617
+ __decorate([attr], Select.prototype, "appearance", void 0);
618
+ __decorate([attr], Select.prototype, "shape", void 0);
619
+ __decorate([attr({
620
+ mode: "boolean",
621
+ attribute: "fixed-dropdown"
622
+ })], Select.prototype, "fixedDropdown", void 0);
623
+ __decorate([attr], Select.prototype, "placeholder", void 0);
624
+ __decorate([observable], Select.prototype, "_feedbackWrapper", void 0);
625
+ __decorate([observable], Select.prototype, "metaSlottedContent", void 0);
626
+ __decorate([attr({ mode: "boolean" })], Select.prototype, "clearable", void 0);
627
+ __decorate([observable], Select.prototype, "_isClearButtonFocused", void 0);
107
628
  //#endregion
108
- //#region src/lib/rich-text-view/rich-text-view.template.ts
109
- var RichTextViewTemplate = () => html`<div class="content rich-text" ${ref("_contentElement")}></div>`;
629
+ //#region src/lib/select/select.template.ts
630
+ function renderLabel() {
631
+ return html` <label
632
+ for="${(x) => x.multiple ? null : "control"}"
633
+ class="label"
634
+ id="label"
635
+ >
636
+ ${(x) => x.label}
637
+ </label>`;
638
+ }
639
+ function renderPlaceholder(context) {
640
+ const optionTag = context.tagFor(ListboxOption);
641
+ return html`
642
+ <${optionTag} text="${(x) => x.placeholder}" hidden disabled>
643
+ </${optionTag}>`;
644
+ }
645
+ function renderClearButton(context) {
646
+ const buttonTag = context.tagFor(Button);
647
+ return html`
648
+ <${buttonTag}
649
+ aria-label="${(x) => x.locale.select.clearButtonLabel}"
650
+ aria-hidden="${(x) => x._isClearButtonFocused ? "false" : "true"}"
651
+ @click="${(x, c) => {
652
+ x._onClearButtonClick();
653
+ c.event.stopPropagation();
654
+ }}"
655
+ @mousedown="${() => false}"
656
+ @keydown="${(x, c) => {
657
+ /* v8 ignore next -- @preserve */
658
+ if (c.event.key === "Tab") x._onClearButtonBlur();
659
+ c.event.stopPropagation();
660
+ return true;
661
+ }}"
662
+ @focusin="${(x, c) => {
663
+ c.event.stopPropagation();
664
+ x._onClearButtonFocus();
665
+ }}"
666
+ @focusout="${(x) => x._onClearButtonBlur()}"
667
+ ?disabled="${(x) => x.disabled}"
668
+ :shape="${(x) => x.shape}"
669
+ size="super-condensed"
670
+ icon="close-line"
671
+ appearance="ghost-light"
672
+ class="clear-button"
673
+ tabindex="0"
674
+ ></${buttonTag}>
675
+ `;
676
+ }
677
+ function selectValue(context) {
678
+ const affixIconTemplate = affixIconTemplateFactory(context);
679
+ const chevronTemplate = chevronTemplateFactory(context);
680
+ return html` <div
681
+ class="control ${(x) => classNames(["has-activedescendant", Boolean(x._activeDescendant) && x.open], ["disabled", x.disabled], [`appearance-${x.appearance}`, Boolean(x.appearance)], [`shape-${x.shape}`, Boolean(x.shape)], ["has-meta", Boolean(x.metaSlottedContent?.length)], ["error", Boolean(x.errorValidationMessage)], ["success", !!x.successText], ["shows-placeholder", Boolean(x.placeholder) && !x.value], [`size-${x.scale}`, Boolean(x.scale)])}"
682
+ ${ref("_anchor")}
683
+ id="control"
684
+ ?disabled="${(x) => x.disabled}"
685
+ >
686
+ <div class="selected-value">
687
+ ${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
688
+ <span class="text">${(x) => x.displayValue}</span>
689
+ <slot name="meta" ${slotted("metaSlottedContent")}></slot>
690
+ </div>
691
+ ${when((x) => x._shouldShowClearButton, renderClearButton(context))}
692
+ ${chevronTemplate}
693
+ </div>`;
694
+ }
695
+ function setFixedDropdownVarWidth(x) {
696
+ return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
697
+ }
698
+ /** @param context - element definition context */
699
+ function renderControl(context) {
700
+ const popupTag = context.tagFor(Popup);
701
+ return html`
702
+ <div class="label-wrapper" ?hidden=${(x) => !x._shouldShowLabelWrapper}>
703
+ ${when((x) => x.label, renderLabel())}
704
+ ${when((x) => x.multiple && x._shouldShowClearButton, renderClearButton(context))}
705
+ <slot name="contextual-help" ${slotted("_contextualHelpSlottedContent")}></slot>
706
+ </div>
707
+ <div class="control-wrapper">
708
+ ${when((x) => !x.multiple, selectValue(context))}
709
+ <${popupTag} class="popup"
710
+ style="${setFixedDropdownVarWidth}"
711
+ ?open="${(x) => x.collapsible ? x.open : true}"
712
+ :anchor="${(x) => x._anchor}"
713
+ placement="bottom-start"
714
+ strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
715
+ <div class="listbox"
716
+ id="${(x) => x.listboxId}"
717
+ role="listbox"
718
+ aria-multiselectable="${(x) => x.multiple}"
719
+ aria-label="${(x) => x.multiple && !x.label && x.ariaLabel ? x.ariaLabel : null}"
720
+ aria-labelledby="${(x) => x.multiple && x.label ? "label" : null}"
721
+ ?disabled="${(x) => x.disabled}"
722
+ ?hidden="${(x) => x.collapsible ? !x.open : false}"
723
+ ${ref("listbox")}>
724
+ ${when((x) => x.placeholder, renderPlaceholder(context))}
725
+ <slot
726
+ ${slotted({
727
+ filter: Listbox.slottedOptionFilter,
728
+ flatten: true,
729
+ property: "slottedOptions"
730
+ })}>
731
+ </slot>
732
+ </div>
733
+ </${popupTag}>
734
+ </div>
735
+ `;
736
+ }
737
+ /** Ignore events that originate from feedback, e.g. a click on link */
738
+ function ifNotFromFeedback(handler) {
739
+ return (x, c) => {
740
+ if (!c.event.composedPath().includes(x._feedbackWrapper)) {
741
+ handler(x, c.event);
742
+ return;
743
+ }
744
+ return true;
745
+ };
746
+ }
747
+ var SelectTemplate = (context) => {
748
+ return html`
749
+ <template
750
+ ${applyHostSemantics({
751
+ role: "combobox",
752
+ ariaLabel: (x) => x.ariaLabel ?? x.label,
753
+ ariaHasPopup: (x) => x.collapsible ? "listbox" : "false",
754
+ ariaExpanded: (x) => x.open,
755
+ ariaDisabled: (x) => x.disabled
756
+ })}
757
+ aria-controls="${(x) => x.listboxId}"
758
+ aria-activedescendant="${(x) => x.open ? x._activeDescendant : null}"
759
+ aria-describedby="${(x) => x._feedbackDescribedBy}"
760
+ tabindex="${(x) => !x.disabled ? "0" : null}"
761
+ @click="${ifNotFromFeedback((x, e) => x.clickHandler(e))}"
762
+ @focusin="${ifNotFromFeedback((x, e) => x.focusinHandler(e))}"
763
+ @focusout="${ifNotFromFeedback((x, e) => x.focusoutHandler(e))}"
764
+ @keydown="${ifNotFromFeedback((x, e) => {
765
+ if (x.open) handleEscapeKeyAndStopPropogation(e);
766
+ return x.keydownHandler(e);
767
+ })}"
768
+ @mousedown="${ifNotFromFeedback((x, e) => x.mousedownHandler(e))}"
769
+ >
770
+ ${renderControl(context)}
771
+ <div class="feedback-wrapper" ${ref("_feedbackWrapper")}>
772
+ ${(x) => x._getFeedbackTemplate(context)}
773
+ </div>
774
+ </template>
775
+ `;
776
+ };
110
777
  //#endregion
111
- //#region src/lib/rich-text-view/definition.ts
112
- var richTextViewDefinition = defineVividComponent("rich-text-view", RichTextView, RichTextViewTemplate, [], {
113
- styles: rich_text_view_default,
114
- shadowOptions: { delegatesFocus: true }
115
- });
778
+ //#region src/lib/select/definition.ts
779
+ /** @internal */
780
+ var selectDefinition = defineVividComponent("select", Select, SelectTemplate, [
781
+ popupDefinition,
782
+ iconDefinition,
783
+ listboxOptionDefinition,
784
+ optgroupDefinition,
785
+ buttonDefinition,
786
+ feedbackMessageDefinition
787
+ ], { styles: select_default });
116
788
  /**
117
- * Registers the rich-text-view element with the design system.
789
+ * Registers the select elements with the design system.
118
790
  *
119
791
  * @param prefix - the prefix to use for the component name
120
792
  */
121
- var registerRichTextView = createRegisterFunction(richTextViewDefinition);
793
+ var registerSelect = createRegisterFunction(selectDefinition);
122
794
  //#endregion
123
- export { richTextViewDefinition as n, RichTextView as r, registerRichTextView as t };
795
+ export { selectDefinition as n, Select as r, registerSelect as t };