@vonage/vivid 4.13.0 → 4.14.1

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 (512) hide show
  1. package/custom-elements.json +3088 -1610
  2. package/elevation/index.cjs +1 -1
  3. package/elevation/index.js +1 -1
  4. package/index.cjs +70 -136
  5. package/index.d.ts +0 -1
  6. package/index.js +60 -62
  7. package/lib/accordion/accordion.d.ts +2 -2
  8. package/lib/accordion/accordion.template.d.ts +1 -2
  9. package/lib/accordion/definition.d.ts +1 -1
  10. package/lib/accordion-item/accordion-item.d.ts +2 -2
  11. package/lib/accordion-item/accordion-item.template.d.ts +2 -3
  12. package/lib/accordion-item/definition.d.ts +1 -1
  13. package/lib/action-group/action-group.d.ts +2 -2
  14. package/lib/action-group/action-group.template.d.ts +1 -3
  15. package/lib/action-group/definition.d.ts +1 -1
  16. package/lib/alert/alert.d.ts +2 -2
  17. package/lib/alert/alert.template.d.ts +2 -3
  18. package/lib/alert/definition.d.ts +1 -1
  19. package/lib/audio-player/audio-player.d.ts +2 -2
  20. package/lib/audio-player/audio-player.template.d.ts +2 -3
  21. package/lib/audio-player/definition.d.ts +1 -3
  22. package/lib/avatar/avatar.d.ts +2 -2
  23. package/lib/avatar/avatar.template.d.ts +2 -3
  24. package/lib/avatar/definition.d.ts +1 -1
  25. package/lib/badge/badge.d.ts +2 -2
  26. package/lib/badge/badge.template.d.ts +2 -3
  27. package/lib/badge/definition.d.ts +1 -3
  28. package/lib/banner/banner.d.ts +2 -2
  29. package/lib/banner/banner.template.d.ts +2 -3
  30. package/lib/banner/definition.d.ts +1 -1
  31. package/lib/breadcrumb/breadcrumb.d.ts +2 -2
  32. package/lib/breadcrumb/breadcrumb.template.d.ts +3 -4
  33. package/lib/breadcrumb/definition.d.ts +1 -1
  34. package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
  35. package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +2 -3
  36. package/lib/breadcrumb-item/definition.d.ts +1 -1
  37. package/lib/button/button.d.ts +2 -2
  38. package/lib/button/button.template.d.ts +2 -4
  39. package/lib/button/definition.d.ts +1 -1
  40. package/lib/calendar/calendar.d.ts +2 -2
  41. package/lib/calendar/calendar.template.d.ts +1 -3
  42. package/lib/calendar/definition.d.ts +1 -1
  43. package/lib/calendar-event/calendar-event.d.ts +2 -2
  44. package/lib/calendar-event/calendar-event.template.d.ts +1 -3
  45. package/lib/calendar-event/definition.d.ts +1 -1
  46. package/lib/card/card.d.ts +2 -2
  47. package/lib/card/card.template.d.ts +2 -3
  48. package/lib/card/definition.d.ts +1 -1
  49. package/lib/checkbox/checkbox.form-associated.d.ts +3 -2
  50. package/lib/checkbox/checkbox.template.d.ts +2 -3
  51. package/lib/checkbox/definition.d.ts +1 -1
  52. package/lib/combobox/combobox.d.ts +17 -2
  53. package/lib/combobox/combobox.options.d.ts +7 -0
  54. package/lib/combobox/combobox.template.d.ts +2 -3
  55. package/lib/combobox/definition.d.ts +1 -2
  56. package/lib/data-grid/data-grid-cell.d.ts +16 -13
  57. package/lib/data-grid/data-grid-cell.template.d.ts +2 -3
  58. package/lib/data-grid/data-grid-row.d.ts +19 -2
  59. package/lib/data-grid/data-grid-row.template.d.ts +2 -2
  60. package/lib/data-grid/data-grid.d.ts +45 -4
  61. package/lib/data-grid/data-grid.template.d.ts +2 -2
  62. package/lib/data-grid/definition.d.ts +1 -6
  63. package/lib/date-picker/definition.d.ts +1 -3
  64. package/lib/date-range-picker/definition.d.ts +1 -3
  65. package/lib/dial-pad/definition.d.ts +1 -3
  66. package/lib/dial-pad/dial-pad.d.ts +2 -2
  67. package/lib/dial-pad/dial-pad.template.d.ts +2 -3
  68. package/lib/dialog/definition.d.ts +1 -1
  69. package/lib/dialog/dialog.d.ts +2 -2
  70. package/lib/dialog/dialog.template.d.ts +2 -3
  71. package/lib/divider/definition.d.ts +1 -1
  72. package/lib/divider/divider.d.ts +2 -2
  73. package/lib/divider/divider.template.d.ts +1 -3
  74. package/lib/elevation/definition.d.ts +1 -1
  75. package/lib/elevation/elevation.d.ts +3 -2
  76. package/lib/elevation/elevation.template.d.ts +1 -3
  77. package/lib/empty-state/definition.d.ts +1 -3
  78. package/lib/empty-state/empty-state.d.ts +2 -2
  79. package/lib/empty-state/empty-state.template.d.ts +2 -3
  80. package/lib/fab/definition.d.ts +1 -3
  81. package/lib/fab/fab.template.d.ts +2 -3
  82. package/lib/file-picker/definition.d.ts +1 -3
  83. package/lib/file-picker/file-picker.form-associated.d.ts +3 -2
  84. package/lib/file-picker/file-picker.template.d.ts +2 -3
  85. package/lib/header/definition.d.ts +1 -3
  86. package/lib/header/header.d.ts +2 -2
  87. package/lib/header/header.template.d.ts +2 -3
  88. package/lib/icon/definition.d.ts +1 -3
  89. package/lib/icon/icon.d.ts +2 -2
  90. package/lib/icon/icon.template.d.ts +1 -3
  91. package/lib/layout/definition.d.ts +1 -3
  92. package/lib/layout/layout.d.ts +2 -2
  93. package/lib/layout/layout.template.d.ts +1 -3
  94. package/lib/listbox/definition.d.ts +1 -3
  95. package/lib/listbox/listbox.template.d.ts +1 -3
  96. package/lib/menu/definition.d.ts +1 -11
  97. package/lib/menu/menu.d.ts +2 -2
  98. package/lib/menu/menu.template.d.ts +3 -3
  99. package/lib/menu-item/definition.d.ts +1 -3
  100. package/lib/menu-item/menu-item.d.ts +2 -2
  101. package/lib/menu-item/menu-item.template.d.ts +2 -3
  102. package/lib/nav/definition.d.ts +1 -3
  103. package/lib/nav/nav.d.ts +2 -2
  104. package/lib/nav/nav.template.d.ts +1 -3
  105. package/lib/nav-disclosure/definition.d.ts +1 -3
  106. package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
  107. package/lib/nav-disclosure/nav-disclosure.template.d.ts +2 -3
  108. package/lib/nav-item/definition.d.ts +1 -3
  109. package/lib/nav-item/nav-item.template.d.ts +2 -3
  110. package/lib/note/definition.d.ts +1 -3
  111. package/lib/note/note.d.ts +2 -2
  112. package/lib/note/note.template.d.ts +2 -3
  113. package/lib/number-field/definition.d.ts +1 -4
  114. package/lib/number-field/number-field.form-associated.d.ts +3 -2
  115. package/lib/number-field/number-field.template.d.ts +2 -3
  116. package/lib/option/definition.d.ts +1 -3
  117. package/lib/option/option.d.ts +3 -2
  118. package/lib/option/option.template.d.ts +2 -3
  119. package/lib/pagination/definition.d.ts +1 -3
  120. package/lib/pagination/pagination.d.ts +2 -2
  121. package/lib/pagination/pagination.template.d.ts +2 -3
  122. package/lib/popup/definition.d.ts +1 -3
  123. package/lib/popup/popup.template.d.ts +2 -3
  124. package/lib/progress/definition.d.ts +1 -3
  125. package/lib/progress/progress.d.ts +1 -1
  126. package/lib/progress/progress.template.d.ts +1 -4
  127. package/lib/progress-ring/definition.d.ts +1 -3
  128. package/lib/progress-ring/progress-ring.d.ts +1 -1
  129. package/lib/progress-ring/progress-ring.template.d.ts +1 -3
  130. package/lib/radio/definition.d.ts +1 -3
  131. package/lib/radio/radio.form-associated.d.ts +5 -2
  132. package/lib/radio/radio.template.d.ts +1 -3
  133. package/lib/radio-group/definition.d.ts +1 -11
  134. package/lib/radio-group/radio-group.d.ts +2 -2
  135. package/lib/radio-group/radio-group.template.d.ts +2 -3
  136. package/lib/range-slider/definition.d.ts +1 -3
  137. package/lib/range-slider/range-slider.form-associated.d.ts +3 -2
  138. package/lib/range-slider/range-slider.template.d.ts +2 -3
  139. package/lib/searchable-select/definition.d.ts +1 -4
  140. package/lib/searchable-select/option-tag.template.d.ts +2 -3
  141. package/lib/searchable-select/searchable-select.form-associated.d.ts +3 -2
  142. package/lib/searchable-select/searchable-select.template.d.ts +2 -3
  143. package/lib/select/definition.d.ts +1 -3
  144. package/lib/select/select.d.ts +14 -4
  145. package/lib/select/select.form-associated.d.ts +11 -0
  146. package/lib/select/select.template.d.ts +2 -3
  147. package/lib/selectable-box/definition.d.ts +1 -3
  148. package/lib/selectable-box/selectable-box.d.ts +2 -2
  149. package/lib/selectable-box/selectable-box.template.d.ts +2 -3
  150. package/lib/side-drawer/definition.d.ts +1 -3
  151. package/lib/side-drawer/side-drawer.d.ts +2 -2
  152. package/lib/side-drawer/side-drawer.template.d.ts +1 -3
  153. package/lib/slider/definition.d.ts +1 -3
  154. package/lib/slider/slider.form-associated.d.ts +3 -2
  155. package/lib/slider/slider.template.d.ts +3 -4
  156. package/lib/split-button/definition.d.ts +1 -1
  157. package/lib/split-button/split-button.d.ts +2 -2
  158. package/lib/split-button/split-button.template.d.ts +2 -3
  159. package/lib/switch/definition.d.ts +1 -3
  160. package/lib/switch/switch.form-associated.d.ts +3 -2
  161. package/lib/switch/switch.template.d.ts +1 -3
  162. package/lib/tab/definition.d.ts +1 -3
  163. package/lib/tab/tab.d.ts +2 -2
  164. package/lib/tab/tab.template.d.ts +2 -2
  165. package/lib/tab-panel/definition.d.ts +1 -3
  166. package/lib/tab-panel/tab-panel.d.ts +2 -2
  167. package/lib/tab-panel/tab-panel.template.d.ts +1 -1
  168. package/lib/tabs/definition.d.ts +1 -3
  169. package/lib/tabs/tabs.d.ts +3 -7
  170. package/lib/tabs/tabs.template.d.ts +1 -1
  171. package/lib/tag/definition.d.ts +1 -4
  172. package/lib/tag/tag.d.ts +2 -2
  173. package/lib/tag/tag.template.d.ts +2 -3
  174. package/lib/tag-group/definition.d.ts +1 -3
  175. package/lib/tag-group/tag-group.d.ts +2 -2
  176. package/lib/tag-group/tag-group.template.d.ts +1 -3
  177. package/lib/text-anchor/definition.d.ts +1 -3
  178. package/lib/text-anchor/text-anchor.d.ts +4 -3
  179. package/lib/text-anchor/text-anchor.template.d.ts +2 -3
  180. package/lib/text-area/definition.d.ts +1 -3
  181. package/lib/text-area/text-area.d.ts +1 -1
  182. package/lib/text-area/{text-field.form-associated.d.ts → text-area.form-associated.d.ts} +3 -2
  183. package/lib/text-area/text-area.template.d.ts +2 -3
  184. package/lib/text-field/definition.d.ts +1 -3
  185. package/lib/text-field/text-field.form-associated.d.ts +3 -2
  186. package/lib/text-field/text-field.template.d.ts +2 -3
  187. package/lib/time-picker/definition.d.ts +1 -3
  188. package/lib/time-picker/time-picker.form-associated.d.ts +3 -2
  189. package/lib/time-picker/time-picker.template.d.ts +2 -2
  190. package/lib/toggletip/definition.d.ts +1 -3
  191. package/lib/toggletip/toggletip.d.ts +2 -2
  192. package/lib/toggletip/toggletip.template.d.ts +2 -3
  193. package/lib/tooltip/definition.d.ts +1 -3
  194. package/lib/tooltip/tooltip.d.ts +2 -2
  195. package/lib/tooltip/tooltip.template.d.ts +2 -3
  196. package/lib/tree-item/definition.d.ts +1 -3
  197. package/lib/tree-item/tree-item.d.ts +11 -2
  198. package/lib/tree-item/tree-item.template.d.ts +3 -3
  199. package/lib/tree-view/definition.d.ts +1 -3
  200. package/lib/tree-view/tree-view.d.ts +16 -2
  201. package/lib/tree-view/tree-view.template.d.ts +1 -1
  202. package/lib/video-player/definition.d.ts +1 -3
  203. package/lib/video-player/video-player.d.ts +2 -2
  204. package/lib/video-player/video-player.template.d.ts +1 -3
  205. package/listbox/index.cjs +37 -39
  206. package/listbox/index.js +37 -39
  207. package/menu/index.cjs +1 -1
  208. package/menu/index.js +1 -1
  209. package/nav/index.cjs +1 -1
  210. package/nav/index.js +1 -1
  211. package/nav-disclosure/index.cjs +1 -1
  212. package/nav-disclosure/index.js +1 -1
  213. package/nav-item/index.cjs +1 -1
  214. package/nav-item/index.js +1 -1
  215. package/note/index.cjs +1 -1
  216. package/note/index.js +1 -1
  217. package/number-field/index.cjs +1 -1
  218. package/number-field/index.js +1 -1
  219. package/option/index.cjs +1 -1
  220. package/option/index.js +1 -1
  221. package/package.json +1 -1
  222. package/pagination/index.cjs +1 -1
  223. package/pagination/index.js +1 -1
  224. package/popup/index.cjs +1 -1
  225. package/popup/index.js +1 -1
  226. package/progress/index.cjs +1 -1
  227. package/progress/index.js +1 -1
  228. package/progress-ring/index.cjs +1 -1
  229. package/progress-ring/index.js +1 -1
  230. package/radio/index.cjs +1 -1
  231. package/radio/index.js +1 -1
  232. package/radio-group/index.cjs +1 -1
  233. package/radio-group/index.js +1 -1
  234. package/range-slider/index.cjs +1 -1
  235. package/range-slider/index.js +1 -1
  236. package/searchable-select/index.cjs +1 -1
  237. package/searchable-select/index.js +1 -1
  238. package/select/index.cjs +1 -1
  239. package/select/index.js +1 -1
  240. package/selectable-box/index.cjs +1 -1
  241. package/selectable-box/index.js +1 -1
  242. package/shared/affix.cjs +10 -10
  243. package/shared/affix.js +2 -2
  244. package/shared/anchor.cjs +59 -0
  245. package/shared/anchor.js +57 -0
  246. package/shared/anchored.cjs +6 -6
  247. package/shared/anchored.js +2 -2
  248. package/shared/apply-mixins.cjs +15 -17
  249. package/shared/apply-mixins.js +15 -17
  250. package/shared/apply-mixins2.cjs +25 -0
  251. package/shared/apply-mixins2.js +23 -0
  252. package/shared/applyMixinsWithObservables.cjs +4 -4
  253. package/shared/applyMixinsWithObservables.js +2 -2
  254. package/shared/aria-global.cjs +86 -67
  255. package/shared/aria-global.js +86 -67
  256. package/shared/aria-global2.cjs +68 -86
  257. package/shared/aria-global2.js +68 -86
  258. package/shared/base-progress.cjs +69 -63
  259. package/shared/base-progress.js +69 -63
  260. package/shared/breadcrumb-item.cjs +6 -58
  261. package/shared/breadcrumb-item.js +3 -55
  262. package/shared/button.cjs +177 -0
  263. package/shared/button.js +175 -0
  264. package/shared/calendar-event.cjs +9 -9
  265. package/shared/calendar-event.js +2 -2
  266. package/shared/children.cjs +2 -2
  267. package/shared/children.js +1 -1
  268. package/shared/date-picker/date-picker-base.form-associated.d.ts +3 -2
  269. package/shared/date-picker/date-picker-base.template.d.ts +2 -3
  270. package/shared/definition.cjs +25 -24
  271. package/shared/definition.js +16 -14
  272. package/shared/definition10.cjs +14 -12
  273. package/shared/definition10.js +14 -11
  274. package/shared/definition11.cjs +52 -248
  275. package/shared/definition11.js +24 -218
  276. package/shared/definition12.cjs +18 -14
  277. package/shared/definition12.js +17 -12
  278. package/shared/definition13.cjs +19 -19
  279. package/shared/definition13.js +10 -9
  280. package/shared/definition14.cjs +35 -38
  281. package/shared/definition14.js +15 -17
  282. package/shared/definition15.cjs +27 -26
  283. package/shared/definition15.js +16 -14
  284. package/shared/definition16.cjs +480 -612
  285. package/shared/definition16.js +473 -604
  286. package/shared/definition17.cjs +933 -1113
  287. package/shared/definition17.js +911 -1090
  288. package/shared/definition18.cjs +16 -20
  289. package/shared/definition18.js +19 -22
  290. package/shared/definition19.cjs +26 -30
  291. package/shared/definition19.js +21 -24
  292. package/shared/definition2.cjs +19 -22
  293. package/shared/definition2.js +20 -22
  294. package/shared/definition20.cjs +50 -52
  295. package/shared/definition20.js +34 -35
  296. package/shared/definition21.cjs +43 -47
  297. package/shared/definition21.js +19 -22
  298. package/shared/definition22.cjs +15 -13
  299. package/shared/definition22.js +14 -11
  300. package/shared/definition23.cjs +21 -20
  301. package/shared/definition23.js +14 -12
  302. package/shared/definition24.cjs +21 -173
  303. package/shared/definition24.js +18 -169
  304. package/shared/definition25.cjs +26 -28
  305. package/shared/definition25.js +18 -19
  306. package/shared/definition26.cjs +16 -14
  307. package/shared/definition26.js +14 -11
  308. package/shared/definition27.cjs +264 -12
  309. package/shared/definition27.js +261 -10
  310. package/shared/definition28.cjs +19 -17
  311. package/shared/definition28.js +15 -12
  312. package/shared/definition29.cjs +142 -68
  313. package/shared/definition29.js +101 -29
  314. package/shared/definition3.cjs +20 -16
  315. package/shared/definition3.js +16 -11
  316. package/shared/definition30.cjs +98 -76
  317. package/shared/definition30.js +97 -74
  318. package/shared/definition31.cjs +24 -97
  319. package/shared/definition31.js +25 -97
  320. package/shared/definition32.cjs +9 -25
  321. package/shared/definition32.js +8 -23
  322. package/shared/definition33.cjs +52 -14
  323. package/shared/definition33.js +51 -12
  324. package/shared/definition34.cjs +639 -34
  325. package/shared/definition34.js +636 -30
  326. package/shared/definition35.cjs +203 -596
  327. package/shared/definition35.js +197 -591
  328. package/shared/definition36.cjs +197 -233
  329. package/shared/definition36.js +192 -226
  330. package/shared/definition37.cjs +79 -206
  331. package/shared/definition37.js +75 -202
  332. package/shared/definition38.cjs +50 -56
  333. package/shared/definition38.js +48 -52
  334. package/shared/definition39.cjs +259 -56
  335. package/shared/definition39.js +258 -54
  336. package/shared/definition4.cjs +32 -35
  337. package/shared/definition4.js +19 -21
  338. package/shared/definition40.cjs +156 -225
  339. package/shared/definition40.js +152 -221
  340. package/shared/definition41.cjs +626 -36
  341. package/shared/definition41.js +625 -34
  342. package/shared/definition42.cjs +974 -487
  343. package/shared/definition42.js +971 -482
  344. package/shared/definition43.cjs +725 -932
  345. package/shared/definition43.js +713 -918
  346. package/shared/definition44.cjs +115 -734
  347. package/shared/definition44.js +113 -731
  348. package/shared/definition45.cjs +92 -116
  349. package/shared/definition45.js +92 -115
  350. package/shared/definition46.cjs +468 -89
  351. package/shared/definition46.js +465 -86
  352. package/shared/definition47.cjs +118 -470
  353. package/shared/definition47.js +115 -465
  354. package/shared/definition48.cjs +113 -120
  355. package/shared/definition48.js +111 -117
  356. package/shared/definition49.cjs +16 -134
  357. package/shared/definition49.js +15 -132
  358. package/shared/definition5.cjs +47 -49
  359. package/shared/definition5.js +18 -19
  360. package/shared/definition50.cjs +111 -15
  361. package/shared/definition50.js +109 -12
  362. package/shared/definition51.cjs +862 -84
  363. package/shared/definition51.js +858 -79
  364. package/shared/definition52.cjs +30 -873
  365. package/shared/definition52.js +28 -870
  366. package/shared/definition53.cjs +125 -28
  367. package/shared/definition53.js +123 -25
  368. package/shared/definition54.cjs +267 -107
  369. package/shared/definition54.js +261 -100
  370. package/shared/definition55.cjs +63 -278
  371. package/shared/definition55.js +61 -275
  372. package/shared/definition56.cjs +867 -76
  373. package/shared/definition56.js +866 -74
  374. package/shared/definition57.cjs +107 -826
  375. package/shared/definition57.js +105 -823
  376. package/shared/definition58.cjs +73 -100
  377. package/shared/definition58.js +69 -95
  378. package/shared/definition59.cjs +180 -106
  379. package/shared/definition59.js +174 -101
  380. package/shared/definition6.cjs +22 -21
  381. package/shared/definition6.js +14 -12
  382. package/shared/definition60.cjs +272 -70
  383. package/shared/definition60.js +272 -69
  384. package/shared/definition61.cjs +66154 -271
  385. package/shared/definition61.js +66153 -269
  386. package/shared/definition62.cjs +38 -66173
  387. package/shared/definition62.js +35 -66170
  388. package/shared/definition63.cjs +2153 -27
  389. package/shared/definition63.js +2150 -25
  390. package/shared/definition7.cjs +18 -15
  391. package/shared/definition7.js +13 -10
  392. package/shared/definition8.cjs +25 -27
  393. package/shared/definition8.js +16 -17
  394. package/shared/definition9.cjs +21 -21
  395. package/shared/definition9.js +18 -17
  396. package/shared/design-system/createRegisterFunction.d.ts +2 -0
  397. package/shared/design-system/defineVividComponent.d.ts +15 -0
  398. package/shared/{localization.js → direction.js} +11 -11
  399. package/shared/dom.cjs +0 -13
  400. package/shared/dom.js +1 -13
  401. package/shared/form-associated.cjs +422 -457
  402. package/shared/form-associated.js +422 -457
  403. package/shared/form-associated2.cjs +383 -0
  404. package/shared/form-associated2.js +381 -0
  405. package/shared/form-elements.cjs +15 -42
  406. package/shared/form-elements.js +2 -29
  407. package/shared/foundation/anchor/anchor.d.ts +1 -0
  408. package/shared/foundation/button/button.d.ts +3 -2
  409. package/shared/foundation/button/button.template.d.ts +2 -4
  410. package/shared/foundation/form-associated/form-associated.d.ts +51 -0
  411. package/shared/foundation/listbox/listbox.d.ts +22 -0
  412. package/shared/foundation/progress/base-progress.d.ts +9 -0
  413. package/shared/foundation/utilities/apply-mixins.d.ts +1 -0
  414. package/shared/foundation/vivid-element/vivid-element.d.ts +3 -0
  415. package/shared/index.cjs +7 -5097
  416. package/shared/index.js +7 -5079
  417. package/shared/key-codes.cjs +10 -0
  418. package/shared/key-codes.js +6 -1
  419. package/shared/key-codes2.cjs +1463 -6
  420. package/shared/key-codes2.js +1461 -4
  421. package/shared/listbox.cjs +427 -1195
  422. package/shared/listbox.js +411 -1176
  423. package/shared/listbox2.cjs +1267 -0
  424. package/shared/listbox2.js +1264 -0
  425. package/shared/localized.cjs +2 -2
  426. package/shared/localized.js +1 -1
  427. package/shared/numbers.cjs +12 -0
  428. package/shared/numbers.js +12 -1
  429. package/shared/patterns/affix.d.ts +2 -2
  430. package/shared/patterns/chevron.d.ts +2 -2
  431. package/shared/patterns/form-elements/form-elements.d.ts +2 -2
  432. package/shared/presentationDate.cjs +49 -49
  433. package/shared/presentationDate.js +6 -6
  434. package/shared/ref.cjs +2 -2
  435. package/shared/ref.js +1 -1
  436. package/shared/repeat.cjs +22 -22
  437. package/shared/repeat.js +1 -1
  438. package/shared/slider.template.cjs +5 -5
  439. package/shared/slider.template.js +2 -2
  440. package/shared/slotted.cjs +4 -4
  441. package/shared/slotted.js +1 -1
  442. package/shared/strings.cjs +0 -26
  443. package/shared/strings.js +1 -25
  444. package/shared/strings2.cjs +37 -0
  445. package/shared/strings2.js +33 -0
  446. package/shared/text-anchor.cjs +7 -89
  447. package/shared/text-anchor.js +4 -86
  448. package/shared/text-anchor.template.cjs +2 -2
  449. package/shared/text-anchor.template.js +1 -1
  450. package/shared/text-field2.cjs +28 -28
  451. package/shared/text-field2.js +5 -5
  452. package/shared/vivid-element.cjs +2616 -0
  453. package/shared/vivid-element.js +2595 -0
  454. package/side-drawer/index.cjs +1 -1
  455. package/side-drawer/index.js +1 -1
  456. package/slider/index.cjs +1 -1
  457. package/slider/index.js +1 -1
  458. package/split-button/index.cjs +1 -1
  459. package/split-button/index.js +1 -1
  460. package/styles/core/all.css +40 -1
  461. package/styles/core/theme.css +40 -1
  462. package/styles/core/typography.css +1 -1
  463. package/styles/tokens/theme-dark.css +25 -4
  464. package/styles/tokens/theme-light.css +25 -4
  465. package/styles/tokens/vivid-2-compat.css +1 -1
  466. package/switch/index.cjs +1 -1
  467. package/switch/index.js +1 -1
  468. package/tab/index.cjs +1 -1
  469. package/tab/index.js +1 -1
  470. package/tab-panel/index.cjs +1 -1
  471. package/tab-panel/index.js +1 -1
  472. package/tabs/index.cjs +1 -1
  473. package/tabs/index.js +1 -1
  474. package/tag/index.cjs +1 -1
  475. package/tag/index.js +1 -1
  476. package/tag-group/index.cjs +1 -1
  477. package/tag-group/index.js +1 -1
  478. package/text-anchor/index.cjs +10 -7
  479. package/text-anchor/index.js +10 -7
  480. package/text-area/index.cjs +1 -1
  481. package/text-area/index.js +1 -1
  482. package/text-field/index.cjs +1 -1
  483. package/text-field/index.js +1 -1
  484. package/time-picker/index.cjs +1 -1
  485. package/time-picker/index.js +1 -1
  486. package/toggletip/index.cjs +1 -1
  487. package/toggletip/index.js +1 -1
  488. package/tooltip/index.cjs +1 -1
  489. package/tooltip/index.js +1 -1
  490. package/tree-item/index.cjs +1 -1
  491. package/tree-item/index.js +1 -1
  492. package/tree-view/index.cjs +1 -1
  493. package/tree-view/index.js +1 -1
  494. package/video-player/index.cjs +1 -1
  495. package/video-player/index.js +1 -1
  496. package/vivid.api.json +2846 -7860
  497. package/shared/definition64.cjs +0 -2175
  498. package/shared/definition64.js +0 -2170
  499. package/shared/design-system/index.d.ts +0 -3
  500. package/shared/icon.cjs +0 -261
  501. package/shared/icon.js +0 -258
  502. package/shared/index2.cjs +0 -11
  503. package/shared/index2.js +0 -9
  504. package/shared/radio.cjs +0 -126
  505. package/shared/radio.js +0 -124
  506. package/shared/select.options.cjs +0 -12
  507. package/shared/select.options.js +0 -10
  508. package/shared/start-end.cjs +0 -52
  509. package/shared/start-end.js +0 -50
  510. package/shared/tree-item.cjs +0 -154
  511. package/shared/tree-item.js +0 -151
  512. package/shared/{localization.cjs → direction.cjs} +9 -9
@@ -1,39 +1,48 @@
1
- import { F as FoundationElement, o as observable, a as attr, n as nullableNumberConverter, h as html, r as registerFactory } from './index.js';
2
- import { P as Popup, a as PlacementStrategy, p as popupRegistries } from './definition64.js';
3
- import { b as keyHome, a as keyEnd, d as keyArrowUp, e as keyArrowLeft, c as keyArrowDown, f as keyArrowRight } from './key-codes.js';
1
+ import { B as Button, c as chevronTemplateFactory, b as buttonDefinition } from './definition11.js';
2
+ import { P as Popup, p as popupDefinition } from './definition63.js';
3
+ import { I as Icon, i as iconDefinition } from './definition27.js';
4
+ import { V as VividElement, O as Observable, D as DOM, a as attr, n as nullableNumberConverter, o as observable, h as html, f as createRegisterFunction, d as defineVividComponent } from './vivid-element.js';
5
+ import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
6
+ import { s as scrollIntoView } from './scrollIntoView.js';
4
7
  import { F as FormAssociated } from './form-associated.js';
5
- import { i as inverseLerp, l as lerp, r as roundToStepValue, g as getMarkersTemplate } from './slider.template.js';
6
- import { O as Orientation } from './aria.js';
7
- import { a as applyMixins } from './apply-mixins.js';
8
+ import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
8
9
  import { L as Localized } from './localized.js';
9
- import { l as limit } from './numbers.js';
10
- import { f as formElements } from './form-elements.js';
11
- import { r as ref } from './ref.js';
10
+ import { F as FormElementSuccessText, a as FormElementHelperText, e as errorText, f as formElements, g as getFeedbackTemplate } from './form-elements.js';
11
+ import { a as Listbox } from './listbox2.js';
12
+ import { a as applyMixins } from './apply-mixins.js';
13
+ import { F as FoundationElement } from './key-codes2.js';
12
14
  import { w as when } from './when.js';
15
+ import { r as ref } from './ref.js';
16
+ import { s as slotted } from './slotted.js';
17
+ import { r as repeat } from './repeat.js';
13
18
  import { c as classNames } from './class-names.js';
14
19
 
15
- const styles = ":host{display:inline-block}:host(:not([orientation=vertical])){inline-size:100%}:host([orientation=vertical]){block-size:100%;min-block-size:calc(var(--_thumb-interaction-indicator-size) * 5)}:host([disabled]){cursor:not-allowed}.control.connotation-cta{--_connotation-color-primary: var(--vvd-slider-cta-primary, var(--vvd-color-cta-500))}.control:not(.connotation-cta){--_connotation-color-primary: var(--vvd-slider-accent-primary, var(--vvd-color-canvas-text))}.control{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}.control{--_thumb-size: 12px;--_thumb-interaction-indicator-size: 36px;--_track-start-inset-inline-start: 0;--_track-start-inset-block-start: 0;cursor:pointer;outline:none;user-select:none}.control .positioning-region{position:relative}.control .track{position:absolute;border-radius:4px;background:var(--_track-background-color)}.control .track-start{position:absolute;border-radius:inherit;background:var(--_track-start-background-color);block-size:100%;inset-inline-start:var(--_track-start-inset-inline-start)}.control.horizontal{block-size:var(--_thumb-interaction-indicator-size);inline-size:calc(100% - var(--_thumb-size));margin-inline-start:calc(var(--_thumb-size) / 2);min-inline-size:var(--_thumb-size)}.control.horizontal .track{top:calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);right:0;left:0;block-size:2px}:host([markers]) .control.horizontal .track-start{--_track-start-inset-inline-start: 1px;border-bottom-left-radius:0;border-top-left-radius:0}.control.horizontal .track .mark{position:absolute;block-size:6px;inline-size:100%;inset-block-start:-2px;inset-inline-start:0}.control.vertical{margin-top:calc(var(--_thumb-interaction-indicator-size) / 2);block-size:calc(100% - var(--_thumb-interaction-indicator-size));inline-size:var(--_thumb-interaction-indicator-size);min-block-size:var(--_thumb-interaction-indicator-size)}.control.vertical .positioning-region{block-size:100%}.control.vertical .track{left:calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);block-size:100%;inline-size:2px}.control.vertical .track .mark{position:absolute;block-size:100%;inline-size:6px;inset-block-start:0;inset-inline-start:-2px}.control.vertical .track-start{block-size:auto;inline-size:100%;inset-block-start:var(--_track-start-inset-block-start)}:host([markers]) .control.vertical .track-start{--_track-start-inset-block-start: 1px;border-radius:0}.control.disabled{--_track-background-color: var(--vvd-color-neutral-100);--_track-start-background-color: var(--vvd-color-neutral-300);pointer-events:none}.control:not(.disabled){--_track-background-color: var(--vvd-color-neutral-300);--_track-start-background-color: var(--_appearance-color-fill)}.control:not(.disabled) .mark{color:var(--vvd-color-neutral-950)}.control.disabled .mark{color:var(--_track-start-background-color)}.thumb-container{position:absolute;border-radius:50%;block-size:var(--_thumb-interaction-indicator-size);cursor:inherit;inline-size:var(--_thumb-interaction-indicator-size);outline:none;touch-action:none}.thumb-container.focus-visible{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;--_thumb-interaction-indicator-alpha: .05;border-radius:50%}.control.horizontal .thumb-container{transform:translate(calc(var(--_thumb-interaction-indicator-size) / 2))}.control.vertical .thumb-container{transform:translateY(calc(var(--_thumb-interaction-indicator-size) / 2))}.control:not(.disabled) .thumb-container:hover{--_thumb-interaction-indicator-alpha: .12}.control:not(.disabled) .thumb-container:active{--_thumb-interaction-indicator-alpha: .25}.thumb-container:before{position:absolute;display:block;border-radius:inherit;background-color:var(--_track-start-background-color);block-size:var(--_thumb-interaction-indicator-size);content:\"\";inline-size:var(--_thumb-interaction-indicator-size);opacity:var(--_thumb-interaction-indicator-alpha, 0);transition:opacity .2s ease-out 0s}.thumb-container:after{position:absolute;display:block;border-radius:inherit;background-color:var(--_track-start-background-color);block-size:var(--_thumb-size);content:\"\";inline-size:var(--_thumb-size);inset:calc((var(--_thumb-interaction-indicator-size) - var(--_thumb-size)) / 2)}.popup{pointer-events:none}.tooltip{width:auto;padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold)}.control{--_track-start-inset-inline-start: auto;--_track-start-inset-block-start: auto}:host([markers]) .control.horizontal .track-start,:host([markers]) .control.vertical .track-start{--_track-start-inset-inline-start: auto;--_track-start-inset-block-start: auto}";
20
+ const styles = ".chevron{display:flex;flex-shrink:0;font:var(--vvd-typography-base-extended);transform:rotate(0);transition:transform .2s}:host([aria-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{display:inline-block;inline-size:300px;--_low-ink-color: var(--vvd-color-neutral-600)}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.control-wrapper{display:flex;flex-direction:column;gap:4px}.label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.fieldset{--_connotation-color-primary: var(--vvd-searchable-select-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-searchable-select-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-searchable-select-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-searchable-select-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-faint: var(--vvd-searchable-select-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-searchable-select-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-searchable-select-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-searchable-select-accent-fierce, var(--vvd-color-neutral-700))}.fieldset{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.fieldset.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.fieldset:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.fieldset:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.fieldset:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.fieldset:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.fieldset:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.fieldset:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.fieldset:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.fieldset{display:flex;align-items:center;justify-content:space-between;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:8px;padding-block:8px;padding-inline:16px;transition:box-shadow .2s,background-color .2s}.fieldset:focus-within{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}:host(:not([shape=pill])) .fieldset{border-radius:8px}:host([shape=pill]) .fieldset{border-radius:24px}.popup-wrapper{position:relative}.content-area{display:flex;overflow:hidden;flex:1;flex-direction:column;gap:8px;min-block-size:24px}.tag-row{display:flex;gap:8px;inline-size:100%}.tag-row.contains-only-input:not(:focus-within){display:contents}.tag-wrapper{overflow:hidden}.tag{max-inline-size:100%}input{box-sizing:border-box;flex:1;border:none;background:none;block-size:24px;font:var(--vvd-typography-base);max-inline-size:100%;min-inline-size:100px;outline:none}.contains-only-input input:not(:focus){position:absolute;block-size:0;inline-size:0;min-inline-size:0;opacity:0;pointer-events:none}.listbox{display:flex;flex-direction:column;padding:4px;gap:2px;max-block-size:var(--searchable-select-height, 408px);overflow-y:auto}.empty-message{display:flex;align-items:center;justify-content:center;color:var(--vvd-color-neutral-300);min-block-size:40px;text-align:center}::part(popup-base){inline-size:max-content;min-inline-size:100%}slot[name=icon]{font-size:20px}.visually-hidden{position:absolute;overflow:hidden;width:1px;height:1px;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}";
21
+
22
+ const optionTagStyles = ".base{--_connotation-color-contrast: var(--vvd-option-tag-accent-contrast, var(--vvd-color-neutral-800))}.base{position:relative;display:inline-flex;box-sizing:border-box;align-items:center;background-color:var(--fill-color);block-size:calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2)));box-shadow:inset 0 0 0 1px var(--outline-color);color:var(--text-color);column-gap:8px;font:var(--vvd-typography-base-bold);max-inline-size:100%;padding-inline:8px;user-select:none;vertical-align:middle}.base:not(.disabled){--text-color: var(--_connotation-color-contrast);--fill-color: color-mix( in srgb, var(--_connotation-color-contrast), transparent 87.5% );--outline-color: transparent}.base.disabled{--text-color: var(--vvd-color-neutral-300);--fill-color: color-mix( in srgb, var(--vvd-color-neutral-800), transparent 87.5% );--outline-color: transparent}.base:not(.shape-pill){border-radius:4px}.base.shape-pill{border-radius:16px}.label{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis;white-space:nowrap}slot[name=icon]{font-size:calc(calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2))) / 1.5);line-height:1}.icon-placeholder{inline-size:calc(calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2))) / 1.5)}.remove-button{display:flex;align-items:center;border-radius:inherit;cursor:pointer;outline:none}.disabled .remove-button{pointer-events:none}.remove-button:focus-visible:before{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));position:absolute;z-index:1;display:block;border-radius:inherit;content:\"\";inset:0;pointer-events:none}";
16
23
 
17
- class _RangeSlider extends FoundationElement {
24
+ class _SearchableSelect extends VividElement {
18
25
  }
19
- class FormAssociatedRangeSlider extends FormAssociated(_RangeSlider) {
26
+ class FormAssociatedSearchableSelect extends FormAssociated(
27
+ _SearchableSelect
28
+ ) {
20
29
  constructor() {
21
30
  super(...arguments);
22
31
  this.proxy = document.createElement("input");
23
32
  }
24
33
  }
25
34
 
26
- var __defProp = Object.defineProperty;
35
+ var __defProp$1 = Object.defineProperty;
27
36
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
28
37
  var __typeError = (msg) => {
29
38
  throw TypeError(msg);
30
39
  };
31
- var __decorateClass = (decorators, target, key, kind) => {
40
+ var __decorateClass$1 = (decorators, target, key, kind) => {
32
41
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
33
42
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
34
43
  if (decorator = decorators[i])
35
44
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
36
- if (kind && result) __defProp(target, key, result);
45
+ if (kind && result) __defProp$1(target, key, result);
37
46
  return result;
38
47
  };
39
48
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
@@ -41,595 +50,1075 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
41
50
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
42
51
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
43
52
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
44
- var _isInternalValueUpdate, _RangeSlider_instances, updateValues_fn, applyStep_fn, updateFormValue_fn, thumbs_get, thumbConstraints_get, getThumbId_fn, getThumbIdFromEvent_fn, updateThumbPositions_fn, thumbTrackEndOffset_fn, calculateValueFromMouseEvent_fn, roundToNearestStep_fn, _isNonVisibleFocus, focusThumbNonVisibly_fn, registerThumbListeners_fn, unregisterThumbListeners_fn, _onThumbFocus, _onThumbBlur, _onMouseOver, _onMouseOut, _onThumbMousedown, _onThumbKeydown, registerDragHandlers_fn, unregisterDragListeners_fn, _onDragMove, _onDragEnd;
45
- const Direction = {
46
- Increment: 1,
47
- Decrement: -1
48
- };
49
- let RangeSlider = class extends FormAssociatedRangeSlider {
53
+ var _SearchableSelect_instances, updateValuesThroughUserInteraction_fn, updateValuesWhileMaintainingOrder_fn, isValidValue_fn, _slottedOptionsChangeHandler, updateSelectedOnSlottedOptions_fn, handleOptionInteraction_fn, _clonedTagIcons, tagIconOfOption_fn, updateClonedTagIconOfOption_fn, _suppressFilter, updateFilteredOptions_fn, transitionHighlightedOptionTo_fn, selectHighlightedOption_fn, highlightFirstOption_fn, highlightLastOption_fn, highlightPrevPage_fn, highlightNextPage_fn, highlightPreviousOption_fn, highlightNextOption_fn, textForValue_fn, measureTagWidth_fn, updateTagLayout_fn, moveTagFocusTo_fn, nextTagIndexLeft_fn, nextTagIndexRight_fn, nextTagIndexForRemoved_fn, determineInitialValues_fn, updateFormValue_fn, _resizeObserver;
54
+ const TagGapPx = 8;
55
+ const InputMinWidthPx = 100;
56
+ const PageSize = 10;
57
+ const isFormAssociatedTryingToSetFormValue = (value) => typeof value === "string";
58
+ let SearchableSelect = class extends FormAssociatedSearchableSelect {
50
59
  constructor() {
51
60
  super(...arguments);
52
- __privateAdd(this, _RangeSlider_instances);
53
- // --- Start & end values ---
54
- __privateAdd(this, _isInternalValueUpdate, false);
55
- this.start = "";
56
- this.end = "";
57
- this.min = 0;
58
- this.max = 10;
59
- this.step = 1;
60
- this.orientation = Orientation.horizontal;
61
- this.ariaStartLabel = null;
62
- this.ariaEndLabel = null;
63
- this.markers = false;
64
- this.pin = false;
65
- this.valueTextFormatter = (value) => parseFloat(value).toLocaleString(this.locale.lang);
66
- // --- Thumbs ---
67
- /**
68
- * @internal
69
- */
70
- this._trackEl = null;
71
- /**
72
- * @internal
73
- */
74
- this._startThumbEl = null;
61
+ __privateAdd(this, _SearchableSelect_instances);
62
+ this.fixedDropdown = false;
63
+ this.open = false;
64
+ this.multiple = false;
65
+ this.externalTags = false;
66
+ this.maxLines = null;
67
+ this.values = [];
68
+ this.initialValues = [];
69
+ this._inputValue = "";
70
+ // --- Slotted options ---
75
71
  /**
76
72
  * @internal
77
73
  */
78
- this._endThumbEl = null;
79
- this._draggingThumb = false;
80
- this._visiblyFocusedThumb = null;
81
- this._hoveredThumb = null;
82
- this._startThumbCss = "";
83
- this._endThumbCss = "";
84
- this._selectedRangeCss = "";
85
- __privateAdd(this, _isNonVisibleFocus, false);
86
- __privateAdd(this, _onThumbFocus, (e) => {
87
- if (!__privateGet(this, _isNonVisibleFocus)) {
88
- this._visiblyFocusedThumb = __privateMethod(this, _RangeSlider_instances, getThumbIdFromEvent_fn).call(this, e);
89
- }
90
- });
91
- __privateAdd(this, _onThumbBlur, () => {
92
- this._visiblyFocusedThumb = null;
93
- });
94
- __privateAdd(this, _onMouseOver, (e) => {
95
- this._hoveredThumb = __privateMethod(this, _RangeSlider_instances, getThumbIdFromEvent_fn).call(this, e);
96
- });
97
- __privateAdd(this, _onMouseOut, () => {
98
- this._hoveredThumb = null;
99
- });
100
- __privateAdd(this, _onThumbMousedown, (event) => {
101
- if (this.disabled || event.defaultPrevented) {
102
- return;
103
- }
104
- let target = event.target;
105
- if (target === this._endThumbEl && this.startAsNumber === this.max && this.endAsNumber === this.max) {
106
- target = this._startThumbEl;
107
- }
108
- __privateMethod(this, _RangeSlider_instances, focusThumbNonVisibly_fn).call(this, target);
109
- this._draggingThumb = __privateMethod(this, _RangeSlider_instances, getThumbId_fn).call(this, target);
110
- __privateMethod(this, _RangeSlider_instances, registerDragHandlers_fn).call(this);
111
- });
112
- __privateAdd(this, _onThumbKeydown, (e) => {
113
- const thumb = __privateMethod(this, _RangeSlider_instances, getThumbIdFromEvent_fn).call(this, e);
114
- this._visiblyFocusedThumb = thumb;
115
- if (e.key === keyHome) {
116
- e.preventDefault();
117
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, { [thumb]: `${__privateGet(this, _RangeSlider_instances, thumbConstraints_get)[thumb].min}` });
118
- } else if (e.key === keyEnd) {
119
- e.preventDefault();
120
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, { [thumb]: `${__privateGet(this, _RangeSlider_instances, thumbConstraints_get)[thumb].max}` });
121
- } else if (!e.shiftKey) {
122
- switch (e.key) {
123
- case keyArrowRight:
124
- case keyArrowDown:
125
- e.preventDefault();
126
- __privateMethod(this, _RangeSlider_instances, applyStep_fn).call(this, thumb, Direction.Increment);
127
- break;
128
- case keyArrowLeft:
129
- case keyArrowUp:
130
- e.preventDefault();
131
- __privateMethod(this, _RangeSlider_instances, applyStep_fn).call(this, thumb, Direction.Decrement);
132
- break;
74
+ this._areOptionsInitialized = false;
75
+ __privateAdd(this, _slottedOptionsChangeHandler, {
76
+ handleChange: (source, _) => {
77
+ if (source.selected && !this.values.includes(source.value)) {
78
+ this.values = [...this.values, source.value];
79
+ } else if (!source.selected && this.values.includes(source.value)) {
80
+ this.values = this.values.filter((option) => option !== source.value);
133
81
  }
134
82
  }
135
83
  });
136
- __privateAdd(this, _onDragMove, (e) => {
137
- if (this.disabled || e.defaultPrevented || !this._draggingThumb) {
84
+ // --- Option tag icons ---
85
+ __privateAdd(this, _clonedTagIcons, /* @__PURE__ */ new Map());
86
+ this._filteredOptions = [];
87
+ this._filteredEnabledOptions = [];
88
+ __privateAdd(this, _suppressFilter, false);
89
+ this._highlightedOptionIndex = null;
90
+ this._numElidedTags = 0;
91
+ this._tagRows = [];
92
+ this._lastTagRow = [];
93
+ this.clearable = false;
94
+ this.setFormValue = (value, state) => {
95
+ if (isFormAssociatedTryingToSetFormValue(value)) {
138
96
  return;
139
97
  }
140
- const sourceEvent = "TouchEvent" in window && e instanceof TouchEvent ? e.touches[0] : e;
141
- const value = __privateMethod(this, _RangeSlider_instances, calculateValueFromMouseEvent_fn).call(this, sourceEvent);
142
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, {
143
- [this._draggingThumb]: `${__privateMethod(this, _RangeSlider_instances, roundToNearestStep_fn).call(this, this._draggingThumb, value)}`
144
- });
145
- });
146
- __privateAdd(this, _onDragEnd, () => {
147
- this._draggingThumb = false;
148
- __privateMethod(this, _RangeSlider_instances, unregisterDragListeners_fn).call(this);
149
- });
98
+ super.setFormValue(value, state);
99
+ };
100
+ this._changeDescription = "";
101
+ // --- Core ---
102
+ __privateAdd(this, _resizeObserver, new ResizeObserver(() => {
103
+ __privateMethod(this, _SearchableSelect_instances, updateTagLayout_fn).call(this);
104
+ }));
150
105
  }
151
106
  /**
152
107
  * @internal
153
108
  */
154
- startChanged() {
155
- this.currentStart = this.start;
156
- if (!__privateGet(this, _isInternalValueUpdate)) {
157
- this.dirtyValue = true;
158
- __privateMethod(this, _RangeSlider_instances, updateFormValue_fn).call(this);
109
+ openChanged() {
110
+ if (!this.open) {
111
+ __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, null);
112
+ }
113
+ }
114
+ /**
115
+ * @internal
116
+ */
117
+ valuesChanged() {
118
+ if (!this._areOptionsInitialized) {
119
+ return;
120
+ }
121
+ if (!this.multiple && this.values.length > 1) {
122
+ this.values = [this.values[0]];
123
+ return;
124
+ }
125
+ if (this.values.some((value) => !__privateMethod(this, _SearchableSelect_instances, isValidValue_fn).call(this, value))) {
126
+ this.values = this.values.filter((value) => __privateMethod(this, _SearchableSelect_instances, isValidValue_fn).call(this, value));
127
+ return;
159
128
  }
129
+ if (!this.multiple) {
130
+ if (this.values.length) {
131
+ __privateSet(this, _suppressFilter, true);
132
+ this._inputValue = __privateMethod(this, _SearchableSelect_instances, textForValue_fn).call(this, this.values[0]);
133
+ } else {
134
+ this._inputValue = "";
135
+ }
136
+ }
137
+ this.value = this.values.length ? this.values[0] : "";
138
+ __privateMethod(this, _SearchableSelect_instances, updateSelectedOnSlottedOptions_fn).call(this);
160
139
  if (this.$fastController.isConnected) {
161
- __privateMethod(this, _RangeSlider_instances, updateThumbPositions_fn).call(this);
140
+ __privateMethod(this, _SearchableSelect_instances, updateTagLayout_fn).call(this);
162
141
  }
142
+ __privateMethod(this, _SearchableSelect_instances, updateFormValue_fn).call(this);
163
143
  }
164
144
  /**
165
145
  * @internal
166
146
  */
167
- initialStartChanged(_, newValue) {
168
- if (newValue && !this.dirtyValue) {
169
- this.start = newValue;
147
+ initialValuesChanged() {
148
+ if (!this.dirtyValue) {
149
+ this.values = this.initialValues;
170
150
  this.dirtyValue = false;
171
151
  }
172
152
  }
173
153
  /**
174
154
  * @internal
175
155
  */
176
- currentStartChanged() {
177
- this.start = this.currentStart;
156
+ valueChanged(prev, next) {
157
+ super.valueChanged(prev, next);
158
+ if (!this._areOptionsInitialized) {
159
+ return;
160
+ }
161
+ const isValidValue = this._slottedOptions.some(
162
+ (option) => option.value === next
163
+ );
164
+ if (this.values[0] !== next) {
165
+ this.values = isValidValue ? [next] : [];
166
+ }
167
+ }
168
+ get selectedIndex() {
169
+ if (this.values.length) {
170
+ return this._slottedOptions.findIndex(
171
+ (option) => option.value === this.values[0]
172
+ );
173
+ } else {
174
+ return -1;
175
+ }
176
+ }
177
+ set selectedIndex(index) {
178
+ this.value = this._slottedOptions[index]?.value ?? "";
179
+ }
180
+ get options() {
181
+ return [...this._slottedOptions];
182
+ }
183
+ get selectedOptions() {
184
+ return this._slottedOptions.filter(
185
+ (option) => this.values.includes(option.value)
186
+ );
178
187
  }
179
188
  /**
180
- * The start property, typed as a number.
181
- *
182
- * @public
189
+ * @internal
183
190
  */
184
- get startAsNumber() {
185
- return parseFloat(this.start);
191
+ _inputValueChanged() {
192
+ __privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
186
193
  }
187
- set startAsNumber(next) {
188
- this.start = next.toString();
194
+ /**
195
+ * @internal
196
+ */
197
+ _onInputInput(event) {
198
+ __privateSet(this, _suppressFilter, false);
199
+ this._inputValue = event.target.value;
189
200
  }
190
201
  /**
191
202
  * @internal
192
203
  */
193
- endChanged() {
194
- this.currentEnd = this.end;
195
- if (!__privateGet(this, _isInternalValueUpdate)) {
196
- this.dirtyValue = true;
197
- __privateMethod(this, _RangeSlider_instances, updateFormValue_fn).call(this);
204
+ _onInputFocus(_) {
205
+ __privateSet(this, _suppressFilter, true);
206
+ __privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
207
+ this.open = true;
208
+ }
209
+ /**
210
+ * @internal
211
+ */
212
+ _onInputBlur(_) {
213
+ this.open = false;
214
+ if (this.multiple) {
215
+ this._inputValue = "";
216
+ } else {
217
+ if (this.values.length === 0) {
218
+ this._inputValue = "";
219
+ } else {
220
+ this._inputValue = __privateMethod(this, _SearchableSelect_instances, textForValue_fn).call(this, this.values[0]);
221
+ }
198
222
  }
199
- if (this.$fastController.isConnected) {
200
- __privateMethod(this, _RangeSlider_instances, updateThumbPositions_fn).call(this);
223
+ this._changeDescription = "";
224
+ }
225
+ /**
226
+ * @internal
227
+ */
228
+ _onInputKeydown(e) {
229
+ if (e.ctrlKey || e.shiftKey) {
230
+ return true;
201
231
  }
232
+ switch (e.key) {
233
+ case "Enter":
234
+ __privateMethod(this, _SearchableSelect_instances, selectHighlightedOption_fn).call(this);
235
+ return false;
236
+ case "Escape":
237
+ this.open = false;
238
+ break;
239
+ case "Home":
240
+ if (!this.open) {
241
+ this.open = true;
242
+ break;
243
+ }
244
+ __privateMethod(this, _SearchableSelect_instances, highlightFirstOption_fn).call(this);
245
+ return false;
246
+ case "End":
247
+ if (!this.open) {
248
+ this.open = true;
249
+ break;
250
+ }
251
+ __privateMethod(this, _SearchableSelect_instances, highlightLastOption_fn).call(this);
252
+ return false;
253
+ case "PageUp":
254
+ if (!this.open) {
255
+ this.open = true;
256
+ break;
257
+ }
258
+ __privateMethod(this, _SearchableSelect_instances, highlightPrevPage_fn).call(this);
259
+ return false;
260
+ case "PageDown":
261
+ if (!this.open) {
262
+ this.open = true;
263
+ break;
264
+ }
265
+ __privateMethod(this, _SearchableSelect_instances, highlightNextPage_fn).call(this);
266
+ return false;
267
+ case "ArrowUp":
268
+ if (!this.open) {
269
+ this.open = true;
270
+ break;
271
+ }
272
+ __privateMethod(this, _SearchableSelect_instances, highlightPreviousOption_fn).call(this);
273
+ return false;
274
+ case "ArrowDown":
275
+ if (!this.open) {
276
+ this.open = true;
277
+ break;
278
+ }
279
+ __privateMethod(this, _SearchableSelect_instances, highlightNextOption_fn).call(this);
280
+ return false;
281
+ case "ArrowLeft":
282
+ if (this.multiple && this._inputValue === "" && this.values.length && !this.externalTags) {
283
+ __privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, this.values.length));
284
+ return false;
285
+ }
286
+ return true;
287
+ case "Backspace":
288
+ if (this.multiple && this._inputValue === "" && this.values.length) {
289
+ this._onTagRemoved(this.values[this.values.length - 1]);
290
+ return false;
291
+ }
292
+ return true;
293
+ default:
294
+ if (!this.open) {
295
+ this.open = true;
296
+ }
297
+ return true;
298
+ }
299
+ return true;
202
300
  }
203
301
  /**
204
302
  * @internal
205
303
  */
206
- initialEndChanged(_, newValue) {
207
- if (newValue && !this.dirtyValue) {
208
- this.end = newValue;
209
- this.dirtyValue = false;
304
+ _slottedOptionsChanged(oldValue, newValue) {
305
+ const hasSlottedOptions = Boolean(
306
+ this.querySelectorAll(`:not([slot])`).length
307
+ );
308
+ if (!newValue.length && hasSlottedOptions) {
309
+ return;
310
+ }
311
+ this._areOptionsInitialized = true;
312
+ if (oldValue) {
313
+ for (const option of oldValue) {
314
+ const notifier = Observable.getNotifier(option);
315
+ notifier.unsubscribe(__privateGet(this, _slottedOptionsChangeHandler), "selected");
316
+ }
317
+ }
318
+ if (newValue) {
319
+ for (const option of newValue) {
320
+ option._displayCheckmark = true;
321
+ const notifier = Observable.getNotifier(option);
322
+ notifier.subscribe(__privateGet(this, _slottedOptionsChangeHandler), "selected");
323
+ }
324
+ }
325
+ const values = [];
326
+ for (const option of this._slottedOptions) {
327
+ if (option.selected || option.value === this.value || this.values.includes(option.value)) {
328
+ values.push(option.value);
329
+ }
210
330
  }
331
+ __privateMethod(this, _SearchableSelect_instances, updateValuesWhileMaintainingOrder_fn).call(this, values);
332
+ __privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
211
333
  }
212
334
  /**
213
335
  * @internal
214
336
  */
215
- currentEndChanged() {
216
- this.end = this.currentEnd;
337
+ _tagIconSlotName(value) {
338
+ return `_tag-icon-${this.values.indexOf(value)}`;
217
339
  }
340
+ // --- Tags ---
218
341
  /**
219
- * The end property, typed as a number.
220
- *
221
- * @public
342
+ * @internal
222
343
  */
223
- get endAsNumber() {
224
- return parseFloat(this.end);
344
+ _tagLabelForValue(value) {
345
+ const option = this._slottedOptions.find(
346
+ (option2) => option2.value === value
347
+ );
348
+ return option.label;
225
349
  }
226
- set endAsNumber(next) {
227
- this.end = next.toString();
350
+ /**
351
+ * @internal
352
+ */
353
+ _isTagDisabled(value) {
354
+ const option = this._slottedOptions.find(
355
+ (option2) => option2.value === value
356
+ );
357
+ return this.disabled || option.disabled;
228
358
  }
229
359
  /**
230
360
  * @internal
231
361
  */
232
- orientationChanged() {
233
- if (this.$fastController.isConnected) {
234
- __privateMethod(this, _RangeSlider_instances, updateThumbPositions_fn).call(this);
362
+ _onTagRemoved(value) {
363
+ __privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, this.values.filter((option) => option !== value));
364
+ __privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
365
+ }
366
+ /**
367
+ * @internal
368
+ */
369
+ _onTagKeydown(event) {
370
+ const tagIndex = parseInt(event.target.dataset.index);
371
+ switch (event.key) {
372
+ case "Backspace":
373
+ case "Delete":
374
+ case "Enter":
375
+ case " ": {
376
+ this._onTagRemoved(this.values[tagIndex]);
377
+ DOM.processUpdates();
378
+ __privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexForRemoved_fn).call(this, tagIndex));
379
+ break;
380
+ }
381
+ case "ArrowLeft":
382
+ __privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, tagIndex) ?? tagIndex);
383
+ break;
384
+ case "ArrowRight":
385
+ __privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexRight_fn).call(this, tagIndex));
386
+ break;
235
387
  }
388
+ return true;
389
+ }
390
+ /**
391
+ * @internal
392
+ */
393
+ _onListboxClick(e) {
394
+ if (this.disabled) {
395
+ return;
396
+ }
397
+ const capturedOption = e.target.closest(
398
+ `option,[role=option]`
399
+ );
400
+ if (capturedOption && !capturedOption.disabled) {
401
+ __privateMethod(this, _SearchableSelect_instances, handleOptionInteraction_fn).call(this, capturedOption);
402
+ }
403
+ }
404
+ /**
405
+ * @internal
406
+ */
407
+ get _shouldShowClearButton() {
408
+ return this.clearable && this.values.length > 0;
409
+ }
410
+ /**
411
+ * @internal
412
+ */
413
+ _onClearButtonClick() {
414
+ __privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, this.selectedOptions.filter((option) => option.disabled).map((option) => option.value));
236
415
  }
237
- // --- Form handling ---
238
416
  /**
239
417
  * @internal
240
418
  */
241
419
  nameChanged(previous, next) {
242
420
  super.nameChanged(previous, next);
243
- __privateMethod(this, _RangeSlider_instances, updateFormValue_fn).call(this);
421
+ __privateMethod(this, _SearchableSelect_instances, updateFormValue_fn).call(this);
244
422
  }
423
+ /**
424
+ * @internal
425
+ */
245
426
  formResetCallback() {
246
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, {
247
- start: this.initialStart ?? this.min.toString(),
248
- end: this.initialEnd ?? this.max.toString()
249
- });
250
427
  super.formResetCallback();
428
+ __privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, __privateMethod(this, _SearchableSelect_instances, determineInitialValues_fn).call(this));
251
429
  }
252
430
  /**
253
431
  * @internal
254
432
  */
255
- _isThumbPopupOpen(thumb) {
256
- return this._visiblyFocusedThumb === thumb || this._hoveredThumb === thumb || this._draggingThumb === thumb;
433
+ _onFieldsetClick(e) {
434
+ if (this.disabled) {
435
+ return;
436
+ }
437
+ if (!e.defaultPrevented) {
438
+ this._input.focus();
439
+ this.open = true;
440
+ }
257
441
  }
258
- // --- Lifecycle ---
259
442
  connectedCallback() {
260
443
  super.connectedCallback();
261
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, {
262
- start: this.start || this.initialStart || this.min.toString(),
263
- end: this.end || this.initialEnd || this.max.toString()
264
- }, false);
265
- __privateMethod(this, _RangeSlider_instances, registerThumbListeners_fn).call(this);
266
- __privateMethod(this, _RangeSlider_instances, updateThumbPositions_fn).call(this);
444
+ if (!this.values.length) {
445
+ this.values = __privateMethod(this, _SearchableSelect_instances, determineInitialValues_fn).call(this);
446
+ }
447
+ __privateGet(this, _resizeObserver).observe(this._contentArea);
267
448
  }
268
449
  disconnectedCallback() {
269
450
  super.disconnectedCallback();
270
- __privateMethod(this, _RangeSlider_instances, unregisterThumbListeners_fn).call(this);
271
- __privateMethod(this, _RangeSlider_instances, unregisterDragListeners_fn).call(this);
451
+ __privateGet(this, _resizeObserver).disconnect();
272
452
  }
273
453
  /**
274
454
  * @internal
275
455
  */
276
- _onMouseDown(e) {
277
- if (this.disabled || this._draggingThumb) {
278
- return;
456
+ validate() {
457
+ super.validate(this._input ?? void 0);
458
+ }
459
+ };
460
+ _SearchableSelect_instances = new WeakSet();
461
+ updateValuesThroughUserInteraction_fn = function(newValues) {
462
+ this.values = newValues;
463
+ this.$emit("change", void 0, {
464
+ bubbles: false
465
+ });
466
+ this.$emit("input", void 0, {
467
+ bubbles: false
468
+ });
469
+ };
470
+ updateValuesWhileMaintainingOrder_fn = function(newValues) {
471
+ const oldSet = new Set(this.values);
472
+ const newSet = new Set(newValues);
473
+ this.values = [...this.values].filter((v) => newSet.has(v)).concat([...newValues].filter((v) => !oldSet.has(v)));
474
+ };
475
+ isValidValue_fn = function(value) {
476
+ return this._slottedOptions.some((option) => option.value === value);
477
+ };
478
+ _slottedOptionsChangeHandler = new WeakMap();
479
+ updateSelectedOnSlottedOptions_fn = function() {
480
+ for (const option of this._slottedOptions) {
481
+ option.selected = this.values.includes(option.value);
482
+ __privateMethod(this, _SearchableSelect_instances, updateClonedTagIconOfOption_fn).call(this, option);
483
+ }
484
+ };
485
+ handleOptionInteraction_fn = function(option) {
486
+ const value = option.value;
487
+ let newValues;
488
+ const isSelection = !this.values.includes(value);
489
+ if (this.multiple) {
490
+ if (isSelection) {
491
+ newValues = [...this.values, value];
492
+ } else {
493
+ newValues = this.values.filter((option2) => option2 !== value);
494
+ }
495
+ this._inputValue = "";
496
+ } else {
497
+ if (isSelection) {
498
+ newValues = [value];
499
+ this._inputValue = option.text;
500
+ } else {
501
+ newValues = [];
502
+ }
503
+ this.open = false;
504
+ }
505
+ this._changeDescription = isSelection ? this.locale.searchableSelect.optionSelectedMessage(option.text) : this.locale.searchableSelect.optionDeselectedMessage(option.text);
506
+ __privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, newValues);
507
+ };
508
+ _clonedTagIcons = new WeakMap();
509
+ tagIconOfOption_fn = function(option) {
510
+ return option.querySelector('[slot="tag-icon"]');
511
+ };
512
+ updateClonedTagIconOfOption_fn = function(option) {
513
+ if (option.selected && __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, option)) {
514
+ let clone = __privateGet(this, _clonedTagIcons).get(option);
515
+ if (!clone) {
516
+ clone = __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, option).cloneNode(true);
517
+ __privateGet(this, _clonedTagIcons).set(option, clone);
518
+ }
519
+ clone.slot = this._tagIconSlotName(option.value);
520
+ this.appendChild(clone);
521
+ } else {
522
+ const clone = __privateGet(this, _clonedTagIcons).get(option);
523
+ if (clone) {
524
+ clone.remove();
525
+ __privateGet(this, _clonedTagIcons).delete(option);
526
+ }
527
+ }
528
+ };
529
+ _suppressFilter = new WeakMap();
530
+ updateFilteredOptions_fn = function() {
531
+ const newFilteredOptions = [];
532
+ for (const option of this._slottedOptions ?? []) {
533
+ if (__privateGet(this, _suppressFilter) || this._inputValue === "") {
534
+ option.hidden = false;
535
+ option._matchedRange = null;
536
+ } else {
537
+ const matchIndex = option.text.toLowerCase().indexOf(this._inputValue.toLowerCase());
538
+ const matchedRange = matchIndex === -1 ? null : { from: matchIndex, to: matchIndex + this._inputValue.length };
539
+ option.hidden = !matchedRange;
540
+ option._matchedRange = matchedRange;
541
+ }
542
+ if (!option.hidden) {
543
+ newFilteredOptions.push(option);
279
544
  }
280
- const value = __privateMethod(this, _RangeSlider_instances, calculateValueFromMouseEvent_fn).call(this, e);
281
- const startDistance = Math.abs(value - Number(this.start));
282
- const endDistance = Math.abs(value - Number(this.end));
283
- const thumb = startDistance < endDistance || startDistance === endDistance && value < Number(this.start) ? "start" : "end";
284
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, {
285
- [thumb]: `${__privateMethod(this, _RangeSlider_instances, roundToNearestStep_fn).call(this, thumb, value)}`
286
- });
287
- this._draggingThumb = thumb;
288
- __privateMethod(this, _RangeSlider_instances, focusThumbNonVisibly_fn).call(this, __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb]);
289
- __privateMethod(this, _RangeSlider_instances, registerDragHandlers_fn).call(this);
290
545
  }
546
+ __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, null);
547
+ this._filteredOptions = newFilteredOptions;
548
+ this._filteredEnabledOptions = newFilteredOptions.filter(
549
+ (option) => !option.disabled
550
+ );
291
551
  };
292
- _isInternalValueUpdate = new WeakMap();
293
- _RangeSlider_instances = new WeakSet();
294
- updateValues_fn = function({ start, end }, emitEvents = true) {
295
- if (start === this.start) {
296
- start = void 0;
552
+ transitionHighlightedOptionTo_fn = function(index) {
553
+ if (typeof this._highlightedOptionIndex === "number") {
554
+ this._filteredEnabledOptions[this._highlightedOptionIndex]._highlighted = false;
297
555
  }
298
- if (end === this.end) {
299
- end = void 0;
556
+ if (typeof index === "number") {
557
+ if (!this._filteredEnabledOptions.length) {
558
+ index = null;
559
+ } else {
560
+ index = Math.max(
561
+ 0,
562
+ Math.min(this._filteredEnabledOptions.length - 1, index)
563
+ );
564
+ }
300
565
  }
301
- if (start === void 0 && end === void 0) {
566
+ this._highlightedOptionIndex = index;
567
+ if (typeof this._highlightedOptionIndex === "number") {
568
+ const highlightedOption = this._filteredEnabledOptions[this._highlightedOptionIndex];
569
+ highlightedOption._highlighted = true;
570
+ scrollIntoView(highlightedOption, this._listbox, "nearest");
571
+ this._changeDescription = this.locale.searchableSelect.optionFocusedMessage(
572
+ highlightedOption.text,
573
+ this._highlightedOptionIndex + 1,
574
+ this._filteredEnabledOptions.length
575
+ );
576
+ }
577
+ };
578
+ selectHighlightedOption_fn = function() {
579
+ if (this._highlightedOptionIndex === null) {
302
580
  return;
303
581
  }
304
- __privateSet(this, _isInternalValueUpdate, true);
305
- if (start !== void 0) {
306
- this.start = start;
582
+ __privateMethod(this, _SearchableSelect_instances, handleOptionInteraction_fn).call(this, this._filteredEnabledOptions[this._highlightedOptionIndex]);
583
+ };
584
+ highlightFirstOption_fn = function() {
585
+ __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, 0);
586
+ };
587
+ highlightLastOption_fn = function() {
588
+ __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, this._filteredEnabledOptions.length - 1);
589
+ };
590
+ highlightPrevPage_fn = function() {
591
+ __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - PageSize);
592
+ };
593
+ highlightNextPage_fn = function() {
594
+ __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? -1) + PageSize);
595
+ };
596
+ highlightPreviousOption_fn = function() {
597
+ __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - 1);
598
+ };
599
+ highlightNextOption_fn = function() {
600
+ __privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? -1) + 1);
601
+ };
602
+ textForValue_fn = function(value) {
603
+ const option = this._slottedOptions.find(
604
+ (option2) => option2.value === value
605
+ );
606
+ return option.text;
607
+ };
608
+ /**
609
+ * @internal
610
+ */
611
+ measureTagWidth_fn = function(label, removable, hasIcon) {
612
+ const tag = document.createElement(this._optionTagTagName);
613
+ tag.label = label;
614
+ tag.removable = removable;
615
+ tag.style.cssText = "position: absolute; visibility: hidden;";
616
+ tag.hasIconPlaceholder = hasIcon;
617
+ this.shadowRoot.appendChild(tag);
618
+ const width = tag.getBoundingClientRect().width;
619
+ tag.remove();
620
+ return width;
621
+ };
622
+ updateTagLayout_fn = function() {
623
+ if (!this.multiple) {
624
+ this._numElidedTags = 0;
625
+ this._tagRows = [];
626
+ this._lastTagRow = [];
627
+ return;
307
628
  }
308
- if (end !== void 0) {
309
- this.end = end;
629
+ if (this.externalTags) {
630
+ this._numElidedTags = this.values.length;
631
+ this._tagRows = [];
632
+ this._lastTagRow = [];
633
+ return;
310
634
  }
311
- __privateSet(this, _isInternalValueUpdate, false);
312
- if (emitEvents) {
313
- if (start !== void 0) {
314
- this.$emit("input:start");
635
+ const rowWidth = this._contentArea.getBoundingClientRect().width;
636
+ const rows = [[]];
637
+ let currentRowIndex = 0;
638
+ let currentRowWidth = InputMinWidthPx;
639
+ let i;
640
+ for (i = this.values.length - 1; i >= 0; i--) {
641
+ const isLastRow = this.maxLines && currentRowIndex === this.maxLines - 1;
642
+ const tagWidth = __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, this._tagLabelForValue(this.values[i]), true, __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, this.selectedOptions[i]) !== null);
643
+ const entry = {
644
+ value: this.values[i],
645
+ width: tagWidth
646
+ };
647
+ let elidedTagCounterWidth = 0;
648
+ if (isLastRow) {
649
+ const numElidedTags = i;
650
+ if (numElidedTags) {
651
+ elidedTagCounterWidth = TagGapPx + __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, numElidedTags.toString(), false, false);
652
+ }
315
653
  }
316
- if (end !== void 0) {
317
- this.$emit("input:end");
654
+ const totalWidthNeeded = currentRowWidth + TagGapPx + tagWidth + elidedTagCounterWidth;
655
+ if (totalWidthNeeded > rowWidth) {
656
+ if (isLastRow) {
657
+ if (i === this.values.length - 1) {
658
+ rows[currentRowIndex].unshift(entry);
659
+ currentRowWidth += TagGapPx + tagWidth;
660
+ } else {
661
+ break;
662
+ }
663
+ } else {
664
+ rows.push([]);
665
+ currentRowIndex++;
666
+ rows[currentRowIndex].unshift(entry);
667
+ currentRowWidth = tagWidth;
668
+ }
669
+ continue;
670
+ }
671
+ rows[currentRowIndex].unshift(entry);
672
+ currentRowWidth += TagGapPx + tagWidth;
673
+ }
674
+ this._numElidedTags = i + 1;
675
+ rows.reverse();
676
+ for (let i2 = 0; i2 < rows.length - 1; i2++) {
677
+ let lineWidth = rows[i2].map((e) => e.width).reduce((a, b) => a + b, 0) + (rows[i2].length - 1) * TagGapPx;
678
+ if (i2 === 0 && this._numElidedTags) {
679
+ lineWidth += TagGapPx + __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, this._numElidedTags.toString(), false, false);
680
+ }
681
+ while (rows[i2 + 1].length && lineWidth + TagGapPx + rows[i2 + 1][0].width <= rowWidth) {
682
+ const nextTag = rows[i2 + 1].shift();
683
+ rows[i2].push(nextTag);
684
+ lineWidth += TagGapPx + nextTag.width;
318
685
  }
319
- this.$emit("input");
320
- this.$emit("change");
321
- this.dirtyValue = true;
322
686
  }
323
- __privateMethod(this, _RangeSlider_instances, updateFormValue_fn).call(this);
687
+ const rowValues = rows.map((line) => line.map((entry) => entry.value));
688
+ this._tagRows = rowValues.slice(0, -1);
689
+ this._lastTagRow = rowValues.slice(-1)[0];
324
690
  };
325
- applyStep_fn = function(thumb, direction) {
326
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, {
327
- [thumb]: __privateMethod(this, _RangeSlider_instances, roundToNearestStep_fn).call(this, thumb, Number(this[thumb]) + direction * this.step).toString()
328
- });
691
+ moveTagFocusTo_fn = function(index) {
692
+ if (index === null) {
693
+ this._input.focus();
694
+ } else {
695
+ this.shadowRoot.querySelector(`[data-index="${index}"]`)?.focus();
696
+ }
697
+ };
698
+ nextTagIndexLeft_fn = function(index) {
699
+ if (!this.values.length) {
700
+ return null;
701
+ }
702
+ for (let i = index - 1; i >= 0; i--) {
703
+ if (!this._isTagDisabled(this.values[i])) {
704
+ return i;
705
+ }
706
+ }
707
+ return null;
708
+ };
709
+ nextTagIndexRight_fn = function(index) {
710
+ if (!this.values.length) {
711
+ return null;
712
+ }
713
+ for (let i = index + 1; i < this.values.length; i++) {
714
+ if (!this._isTagDisabled(this.values[i])) {
715
+ return i;
716
+ }
717
+ }
718
+ return null;
719
+ };
720
+ nextTagIndexForRemoved_fn = function(index) {
721
+ return __privateMethod(this, _SearchableSelect_instances, nextTagIndexRight_fn).call(this, index - 1) ?? __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, index);
722
+ };
723
+ // --- Form handling ---
724
+ determineInitialValues_fn = function() {
725
+ return this.initialValues.length ? this.initialValues : this.initialValue ? [this.initialValue] : [];
329
726
  };
330
727
  updateFormValue_fn = function() {
331
728
  if (!this.name) {
332
729
  this.setFormValue(null);
333
730
  } else {
334
731
  const formData = new FormData();
335
- formData.append(this.name, this.start);
336
- formData.append(this.name, this.end);
732
+ for (const value of this.values) {
733
+ formData.append(this.name, value);
734
+ }
337
735
  this.setFormValue(formData);
338
736
  }
339
737
  };
340
- thumbs_get = function() {
341
- return {
342
- start: this._startThumbEl,
343
- end: this._endThumbEl
344
- };
345
- };
346
- thumbConstraints_get = function() {
347
- return {
348
- start: { min: this.min, max: this.endAsNumber },
349
- end: { min: this.startAsNumber, max: this.max }
350
- };
351
- };
352
- getThumbId_fn = function(thumb) {
353
- return thumb === this._startThumbEl ? "start" : "end";
354
- };
355
- getThumbIdFromEvent_fn = function(e) {
356
- return __privateMethod(this, _RangeSlider_instances, getThumbId_fn).call(this, e.target);
357
- };
358
- updateThumbPositions_fn = function() {
359
- const startOffsetPct = __privateMethod(this, _RangeSlider_instances, thumbTrackEndOffset_fn).call(this, this.startAsNumber);
360
- const endOffsetPct = __privateMethod(this, _RangeSlider_instances, thumbTrackEndOffset_fn).call(this, this.endAsNumber);
361
- const [dirProp, dimProp] = this.orientation === Orientation.horizontal ? ["right", "width"] : ["bottom", "height"];
362
- const transition = `transition: ${this._draggingThumb ? "none" : "all 0.2s ease"};`;
363
- this._startThumbCss = `${dirProp}: ${startOffsetPct}%; ${transition}`;
364
- this._endThumbCss = `${dirProp}: ${endOffsetPct}%; ${transition}`;
365
- this._selectedRangeCss = `${dirProp}: ${endOffsetPct}%; ${dimProp}: ${startOffsetPct - endOffsetPct}%; ${transition}`;
366
- };
367
- thumbTrackEndOffset_fn = function(value) {
368
- return (1 - inverseLerp(this.min, this.max, value)) * 100;
369
- };
370
- calculateValueFromMouseEvent_fn = function(e) {
371
- const trackClientRect = this._trackEl.getBoundingClientRect();
372
- const [minPos, maxPos, valuePos] = this.orientation === Orientation.horizontal ? [
373
- this._trackEl.clientLeft,
374
- this._trackEl.clientWidth,
375
- e.pageX - document.documentElement.scrollLeft - this.getBoundingClientRect().left
376
- ] : [
377
- trackClientRect.top,
378
- trackClientRect.bottom,
379
- e.pageY - document.documentElement.scrollTop
380
- ];
381
- return lerp(this.min, this.max, inverseLerp(minPos, maxPos, valuePos));
382
- };
383
- roundToNearestStep_fn = function(thumb, value) {
384
- return limit(
385
- __privateGet(this, _RangeSlider_instances, thumbConstraints_get)[thumb].min,
386
- __privateGet(this, _RangeSlider_instances, thumbConstraints_get)[thumb].max,
387
- roundToStepValue(value - this.min, this.step) + this.min
388
- );
738
+ _resizeObserver = new WeakMap();
739
+ __decorateClass$1([
740
+ attr
741
+ ], SearchableSelect.prototype, "appearance", 2);
742
+ __decorateClass$1([
743
+ attr
744
+ ], SearchableSelect.prototype, "shape", 2);
745
+ __decorateClass$1([
746
+ attr({ mode: "boolean", attribute: "fixed-dropdown" })
747
+ ], SearchableSelect.prototype, "fixedDropdown", 2);
748
+ __decorateClass$1([
749
+ attr
750
+ ], SearchableSelect.prototype, "placeholder", 2);
751
+ __decorateClass$1([
752
+ attr({ mode: "boolean" })
753
+ ], SearchableSelect.prototype, "open", 2);
754
+ __decorateClass$1([
755
+ attr({ mode: "boolean" })
756
+ ], SearchableSelect.prototype, "multiple", 2);
757
+ __decorateClass$1([
758
+ attr({ attribute: "external-tags", mode: "boolean" })
759
+ ], SearchableSelect.prototype, "externalTags", 2);
760
+ __decorateClass$1([
761
+ attr({ attribute: "max-lines", converter: nullableNumberConverter })
762
+ ], SearchableSelect.prototype, "maxLines", 2);
763
+ __decorateClass$1([
764
+ observable
765
+ ], SearchableSelect.prototype, "values", 2);
766
+ __decorateClass$1([
767
+ observable
768
+ ], SearchableSelect.prototype, "initialValues", 2);
769
+ __decorateClass$1([
770
+ observable
771
+ ], SearchableSelect.prototype, "_input", 2);
772
+ __decorateClass$1([
773
+ observable
774
+ ], SearchableSelect.prototype, "_inputValue", 2);
775
+ __decorateClass$1([
776
+ observable
777
+ ], SearchableSelect.prototype, "_slottedOptions", 2);
778
+ __decorateClass$1([
779
+ observable
780
+ ], SearchableSelect.prototype, "_filteredOptions", 2);
781
+ __decorateClass$1([
782
+ observable
783
+ ], SearchableSelect.prototype, "_filteredEnabledOptions", 2);
784
+ __decorateClass$1([
785
+ observable
786
+ ], SearchableSelect.prototype, "_highlightedOptionIndex", 2);
787
+ __decorateClass$1([
788
+ observable
789
+ ], SearchableSelect.prototype, "_contentArea", 2);
790
+ __decorateClass$1([
791
+ observable
792
+ ], SearchableSelect.prototype, "_numElidedTags", 2);
793
+ __decorateClass$1([
794
+ observable
795
+ ], SearchableSelect.prototype, "_tagRows", 2);
796
+ __decorateClass$1([
797
+ observable
798
+ ], SearchableSelect.prototype, "_lastTagRow", 2);
799
+ __decorateClass$1([
800
+ observable
801
+ ], SearchableSelect.prototype, "_listbox", 2);
802
+ __decorateClass$1([
803
+ attr({ mode: "boolean" })
804
+ ], SearchableSelect.prototype, "clearable", 2);
805
+ __decorateClass$1([
806
+ observable
807
+ ], SearchableSelect.prototype, "_changeDescription", 2);
808
+ __decorateClass$1([
809
+ observable
810
+ ], SearchableSelect.prototype, "_anchor", 2);
811
+ SearchableSelect = __decorateClass$1([
812
+ errorText,
813
+ formElements
814
+ ], SearchableSelect);
815
+ applyMixinsWithObservables(
816
+ SearchableSelect,
817
+ AffixIconWithTrailing,
818
+ FormElementHelperText,
819
+ FormElementSuccessText,
820
+ Localized
821
+ );
822
+
823
+ var __defProp = Object.defineProperty;
824
+ var __decorateClass = (decorators, target, key, kind) => {
825
+ var result = void 0 ;
826
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
827
+ if (decorator = decorators[i])
828
+ result = (decorator(target, key, result) ) || result;
829
+ if (result) __defProp(target, key, result);
830
+ return result;
389
831
  };
390
- _isNonVisibleFocus = new WeakMap();
391
- focusThumbNonVisibly_fn = function(thumb) {
392
- __privateSet(this, _isNonVisibleFocus, true);
393
- thumb.focus();
394
- __privateSet(this, _isNonVisibleFocus, false);
395
- };
396
- // --- Event handling ---
397
- registerThumbListeners_fn = function() {
398
- for (const thumb of ["start", "end"]) {
399
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener("keydown", __privateGet(this, _onThumbKeydown));
400
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener(
401
- "mousedown",
402
- __privateGet(this, _onThumbMousedown),
403
- { passive: true }
404
- );
405
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener(
406
- "touchstart",
407
- __privateGet(this, _onThumbMousedown),
408
- { passive: true }
409
- );
410
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener("mouseover", __privateGet(this, _onMouseOver), {
411
- passive: true
412
- });
413
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener("mouseout", __privateGet(this, _onMouseOut), {
414
- passive: true
832
+ class OptionTag extends FoundationElement {
833
+ constructor() {
834
+ super(...arguments);
835
+ this.removable = false;
836
+ this.disabled = false;
837
+ this.hasIconPlaceholder = false;
838
+ }
839
+ _onClickRemove() {
840
+ this.$emit("remove", void 0, {
841
+ bubbles: false
415
842
  });
416
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener("focus", __privateGet(this, _onThumbFocus));
417
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener("blur", __privateGet(this, _onThumbBlur));
418
843
  }
419
- };
420
- unregisterThumbListeners_fn = function() {
421
- for (const thumb of ["start", "end"]) {
422
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener("keydown", __privateGet(this, _onThumbKeydown));
423
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener(
424
- "mousedown",
425
- __privateGet(this, _onThumbMousedown)
426
- );
427
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener(
428
- "touchstart",
429
- __privateGet(this, _onThumbMousedown)
430
- );
431
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener("mouseover", __privateGet(this, _onMouseOver));
432
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener("mouseout", __privateGet(this, _onMouseOut));
433
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener("focus", __privateGet(this, _onThumbFocus));
434
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener("blur", __privateGet(this, _onThumbBlur));
435
- }
436
- };
437
- _onThumbFocus = new WeakMap();
438
- _onThumbBlur = new WeakMap();
439
- _onMouseOver = new WeakMap();
440
- _onMouseOut = new WeakMap();
441
- _onThumbMousedown = new WeakMap();
442
- _onThumbKeydown = new WeakMap();
443
- registerDragHandlers_fn = function() {
444
- window.addEventListener("mousemove", __privateGet(this, _onDragMove), { passive: true });
445
- window.addEventListener("touchmove", __privateGet(this, _onDragMove), { passive: true });
446
- window.addEventListener("mouseup", __privateGet(this, _onDragEnd));
447
- window.addEventListener("touchend", __privateGet(this, _onDragEnd));
448
- window.document.addEventListener("mouseleave", __privateGet(this, _onDragEnd));
449
- };
450
- unregisterDragListeners_fn = function() {
451
- window.removeEventListener("mouseup", __privateGet(this, _onDragEnd));
452
- window.document.removeEventListener("mouseleave", __privateGet(this, _onDragEnd));
453
- window.removeEventListener("mousemove", __privateGet(this, _onDragMove));
454
- window.removeEventListener("touchmove", __privateGet(this, _onDragMove));
455
- window.removeEventListener("touchend", __privateGet(this, _onDragEnd));
456
- };
457
- _onDragMove = new WeakMap();
458
- _onDragEnd = new WeakMap();
459
- __decorateClass([
460
- observable
461
- ], RangeSlider.prototype, "start", 2);
462
- __decorateClass([
463
- attr({ mode: "fromView", attribute: "start" })
464
- ], RangeSlider.prototype, "initialStart", 2);
465
- __decorateClass([
466
- attr({ attribute: "current-start" })
467
- ], RangeSlider.prototype, "currentStart", 2);
468
- __decorateClass([
469
- observable
470
- ], RangeSlider.prototype, "end", 2);
471
- __decorateClass([
472
- attr({ mode: "fromView", attribute: "end" })
473
- ], RangeSlider.prototype, "initialEnd", 2);
474
- __decorateClass([
475
- attr({ attribute: "current-end" })
476
- ], RangeSlider.prototype, "currentEnd", 2);
477
- __decorateClass([
478
- attr({ converter: nullableNumberConverter })
479
- ], RangeSlider.prototype, "min", 2);
480
- __decorateClass([
481
- attr({ converter: nullableNumberConverter })
482
- ], RangeSlider.prototype, "max", 2);
483
- __decorateClass([
484
- attr({ converter: nullableNumberConverter })
485
- ], RangeSlider.prototype, "step", 2);
844
+ }
486
845
  __decorateClass([
487
846
  attr
488
- ], RangeSlider.prototype, "orientation", 2);
489
- __decorateClass([
490
- attr({ attribute: "aria-start-label" })
491
- ], RangeSlider.prototype, "ariaStartLabel", 2);
492
- __decorateClass([
493
- attr({ attribute: "aria-end-label" })
494
- ], RangeSlider.prototype, "ariaEndLabel", 2);
495
- __decorateClass([
496
- attr({ mode: "boolean" })
497
- ], RangeSlider.prototype, "markers", 2);
847
+ ], OptionTag.prototype, "shape");
498
848
  __decorateClass([
499
849
  attr
500
- ], RangeSlider.prototype, "connotation", 2);
850
+ ], OptionTag.prototype, "label");
501
851
  __decorateClass([
502
852
  attr({ mode: "boolean" })
503
- ], RangeSlider.prototype, "pin", 2);
853
+ ], OptionTag.prototype, "removable");
504
854
  __decorateClass([
505
- observable
506
- ], RangeSlider.prototype, "valueTextFormatter", 2);
507
- __decorateClass([
508
- observable
509
- ], RangeSlider.prototype, "_draggingThumb", 2);
510
- __decorateClass([
511
- observable
512
- ], RangeSlider.prototype, "_visiblyFocusedThumb", 2);
513
- __decorateClass([
514
- observable
515
- ], RangeSlider.prototype, "_hoveredThumb", 2);
516
- __decorateClass([
517
- observable
518
- ], RangeSlider.prototype, "_startThumbCss", 2);
519
- __decorateClass([
520
- observable
521
- ], RangeSlider.prototype, "_endThumbCss", 2);
855
+ attr({ mode: "boolean" })
856
+ ], OptionTag.prototype, "disabled");
522
857
  __decorateClass([
523
858
  observable
524
- ], RangeSlider.prototype, "_selectedRangeCss", 2);
525
- RangeSlider = __decorateClass([
526
- formElements
527
- ], RangeSlider);
528
- applyMixins(RangeSlider, Localized);
859
+ ], OptionTag.prototype, "hasIconPlaceholder");
860
+ applyMixins(OptionTag, Localized);
529
861
 
530
- const getClasses = ({ disabled, connotation }) => classNames(
531
- "control",
532
- ["disabled", Boolean(disabled)],
533
- [`connotation-${connotation}`, Boolean(connotation)]
862
+ const getStateClasses = (x) => classNames(
863
+ ["disabled", x.disabled],
864
+ [`appearance-${x.appearance}`, Boolean(x.appearance)],
865
+ [`shape-${x.shape}`, Boolean(x.shape)],
866
+ ["error", Boolean(x.errorValidationMessage)],
867
+ ["success", !!x.successText]
534
868
  );
535
- const getThumbClassesFor = (thumb) => ({ _visiblyFocusedThumb }) => classNames("thumb-container", [
536
- "focus-visible",
537
- _visiblyFocusedThumb === thumb
538
- ]);
539
- const RangeSliderTemplate = (context) => {
540
- const popupTag = context.tagFor(Popup);
541
- return html` <template
542
- @mousedown="${(x, c) => x._onMouseDown(c.event)}"
543
- >
544
- <div class="${getClasses} ${(x) => x.orientation}">
545
- <div class="positioning-region">
546
- <div ${ref("_trackEl")} class="track">
547
- <div class="track-start" style="${(x) => x._selectedRangeCss}"></div>
548
- ${when(
549
- (x) => x.markers,
550
- html`${(x) => getMarkersTemplate(
551
- x.orientation === Orientation.horizontal,
552
- Math.floor((x.max - x.min) / x.step)
553
- )}`
869
+ function renderLabel() {
870
+ return html`
871
+ <label for="control" class="label" id="label"> ${(x) => x.label} </label>
872
+ `;
873
+ }
874
+ const tagTemplateFactory = (context, getComponent) => {
875
+ const optionTagTag = context.tagFor(OptionTag);
876
+ return html`
877
+ <div class="tag-wrapper">
878
+ <${optionTagTag}
879
+ class="tag"
880
+ tabindex="-1"
881
+ data-index="${(x, c) => getComponent(c).values.indexOf(x)}"
882
+ removable
883
+ :label="${(x, c) => getComponent(c)._tagLabelForValue(x)}"
884
+ :shape="${(_, c) => getComponent(c).shape}"
885
+ ?disabled="${(x, c) => getComponent(c)._isTagDisabled(x)}"
886
+ @remove="${(x, c) => getComponent(c)._onTagRemoved(x)}"
887
+ @keydown="${(_, c) => getComponent(c)._onTagKeydown(c.event)}"
888
+ @mousedown="${() => false}">
889
+ <slot slot="icon" name="${(x, c) => getComponent(c)._tagIconSlotName(x)}"></slot>
890
+ </${optionTagTag}>
891
+ </div>
892
+ `;
893
+ };
894
+ const elidedTagTemplateFactory = (context, getComponent) => {
895
+ const optionTagTag = context.tagFor(OptionTag);
896
+ return html`
897
+ <${optionTagTag}
898
+ class="tag"
899
+ tabindex="-1"
900
+ :label="${(x, c) => getComponent(x, c)._numElidedTags.toString()}"
901
+ :shape="${(x, c) => getComponent(x, c).shape}"
902
+ ?disabled="${(x, c) => getComponent(x, c).disabled}"
903
+ @mousedown="${() => false}">
904
+ </${optionTagTag}>
905
+ `;
906
+ };
907
+ function renderFieldset(context) {
908
+ const buttonTag = context.tagFor(Button);
909
+ const affixIconTemplate = affixIconTemplateFactory(context);
910
+ const chevronTemplate = chevronTemplateFactory(context);
911
+ const tagTemplate = tagTemplateFactory(context, (c) => c.parent);
912
+ const nestedTagTemplate = tagTemplateFactory(
913
+ context,
914
+ (c) => c.parentContext.parent
915
+ );
916
+ const elidedTagTemplate = elidedTagTemplateFactory(context, (x, _) => x);
917
+ const nestedElidedTagTemplate = elidedTagTemplateFactory(
918
+ context,
919
+ (_, c) => c.parent
920
+ );
921
+ return html`
922
+ <div
923
+ class="fieldset ${getStateClasses}"
924
+ @click="${(x, c) => x._onFieldsetClick(c.event)}"
925
+ ${ref("_anchor")}
926
+ >
927
+ ${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
928
+ <div class="content-area" ${ref("_contentArea")}>
929
+ ${repeat(
930
+ (x) => x._tagRows,
931
+ html`
932
+ <div class="tag-row">
933
+ ${when(
934
+ (_, c) => c.isFirst && c.parent._numElidedTags,
935
+ nestedElidedTagTemplate
936
+ )}
937
+ ${repeat((x) => x, nestedTagTemplate)}
938
+ </div>
939
+ `,
940
+ { positioning: true }
554
941
  )}
555
- </div>
556
942
  <div
557
- ${ref("_startThumbEl")}
558
- class="${getThumbClassesFor("start")}"
559
- style="${(x) => x._startThumbCss}"
560
- role="slider"
561
- tabindex="${(x) => x.disabled ? null : 0}"
562
- aria-label="${(x) => x.ariaStartLabel || x.locale.rangeSlider.startThumbLabel}"
563
- aria-valuetext="${(x) => x.valueTextFormatter(x.start)}"
564
- aria-valuenow="${(x) => x.start}"
565
- aria-valuemin="${(x) => x.min}"
566
- aria-valuemax="${(x) => x.end}"
567
- aria-disabled="${(x) => x.disabled}"
568
- aria-orientation="${(x) => x.orientation}"
569
- ></div>
570
- ${when(
571
- (x) => x.pin,
572
- html`<${popupTag}
573
- class="popup"
574
- arrow
575
- alternate
576
- :anchor="${(x) => x._startThumbEl}"
577
- :open=${(x) => x._isThumbPopupOpen("start")}
578
- :placementStrategy=${(x) => x.orientation === Orientation.horizontal ? PlacementStrategy.AutoPlacementHorizontal : PlacementStrategy.AutoPlacementVertical}
579
- animation-frame
580
- exportparts="vvd-theme-alternate"
581
- aria-hidden="true"
943
+ class="tag-row ${(x) => classNames([
944
+ "contains-only-input",
945
+ x._tagRows.length > 0 && x._lastTagRow.length === 0
946
+ ])}"
582
947
  >
583
- <div class="tooltip">${(x) => x.valueTextFormatter(x.start)}</div>
584
- </${popupTag}>`
948
+ ${when(
949
+ (x) => x._tagRows.length === 0 && x._numElidedTags,
950
+ elidedTagTemplate
585
951
  )}
586
- <div
587
- ${ref("_endThumbEl")}
588
- class="${getThumbClassesFor("end")}"
589
- style="${(x) => x._endThumbCss}"
590
- role="slider"
591
- tabindex="${(x) => x.disabled ? null : 0}"
592
- aria-label="${(x) => x.ariaEndLabel || x.locale.rangeSlider.endThumbLabel}"
593
- aria-valuetext="${(x) => x.valueTextFormatter(x.end)}"
594
- aria-valuenow="${(x) => x.end}"
595
- aria-valuemin="${(x) => x.start}"
596
- aria-valuemax="${(x) => x.max}"
597
- aria-disabled="${(x) => x.disabled}"
598
- aria-orientation="${(x) => x.orientation}"
599
- ></div>
600
- ${when(
601
- (x) => x.pin,
602
- html`<${popupTag}
952
+ ${repeat((x) => x._lastTagRow, tagTemplate)}
953
+ <input
954
+ id="control"
955
+ class="control"
956
+ autofocus
957
+ autocomplete="off"
958
+ aria-autocomplete="list"
959
+ aria-expanded="${(x) => x.open}"
960
+ aria-haspopup="listbox"
961
+ aria-controls="listbox"
962
+ placeholder="${(x) => x.multiple && x.values.length ? "" : x.placeholder}"
963
+ role="combobox"
964
+ type="text"
965
+ ?disabled="${(x) => x.disabled}"
966
+ :value="${(x) => x._inputValue}"
967
+ @input="${(x, c) => x._onInputInput(c.event)}"
968
+ @focus="${(x, c) => x._onInputFocus(c.event)}"
969
+ @blur="${(x, c) => x._onInputBlur(c.event)}"
970
+ @keydown="${(x, c) => x._onInputKeydown(c.event)}"
971
+ ${ref("_input")}
972
+ />
973
+ </div>
974
+ </div>
975
+ <slot name="meta"></slot>
976
+ ${when(
977
+ (x) => x._shouldShowClearButton,
978
+ html`<${buttonTag}
979
+ aria-label="${(x) => x.locale.searchableSelect.clearButtonLabel}"
980
+ @click="${(x) => x._onClearButtonClick()}"
981
+ @mousedown="${() => false}"
982
+ ?disabled="${(x) => x.disabled}"
983
+ :shape="${(x) => x.shape}"
984
+ size="super-condensed"
985
+ icon="close-line"
986
+ appearance="ghost-light"
987
+ tabindex="-1"
988
+ ></${buttonTag}>`
989
+ )}
990
+ ${chevronTemplate}
991
+ </div>
992
+ `;
993
+ }
994
+ function renderControl(context) {
995
+ const popupTag = context.tagFor(Popup);
996
+ return html`
997
+ ${when((x) => x.label, renderLabel())}
998
+ <span aria-live="assertive" aria-relevant="text" class="visually-hidden">
999
+ ${(x) => x._changeDescription}
1000
+ </span>
1001
+ <div>
1002
+ ${renderFieldset(context)}
1003
+ <div class="popup-wrapper">
1004
+ <${popupTag}
1005
+ :anchor="${(x) => x._anchor}"
1006
+ :open="${(x) => x.open}"
603
1007
  class="popup"
604
- arrow
605
- alternate
606
- :anchor="${(x) => x._endThumbEl}"
607
- :open=${(x) => x._isThumbPopupOpen("end")}
608
- :placementStrategy=${(x) => x.orientation === Orientation.horizontal ? PlacementStrategy.AutoPlacementHorizontal : PlacementStrategy.AutoPlacementVertical}
609
- animation-frame
610
- exportparts="vvd-theme-alternate"
611
- aria-hidden="true"
612
- >
613
- <div class="tooltip">${(x) => x.valueTextFormatter(x.end)}</div>
614
- </${popupTag}>`
1008
+ placement="bottom-start"
1009
+ strategy="${(x) => x.fixedDropdown ? "fixed" : "absolute"}">
1010
+ <div
1011
+ class="listbox"
1012
+ role="listbox"
1013
+ aria-multiselectable="${(x) => x.multiple}"
1014
+ aria-required="${(x) => x.required}"
1015
+ ${ref("_listbox")}
1016
+ @click="${(x, c) => x._onListboxClick(c.event)}"
1017
+ @mousedown="${() => false}"
1018
+ >
1019
+ <slot
1020
+ ${slotted({
1021
+ filter: Listbox.slottedOptionFilter,
1022
+ flatten: true,
1023
+ property: "_slottedOptions"
1024
+ })}>
1025
+ </slot>
1026
+ ${when(
1027
+ (x) => x._filteredOptions.length === 0,
1028
+ html`<div class="empty-message">
1029
+ ${when(
1030
+ (x) => x._inputValue === "",
1031
+ html`<slot name="no-options">
1032
+ ${(x) => x.locale.searchableSelect.noOptionsMessage}
1033
+ </slot>`
1034
+ )}
1035
+ ${when(
1036
+ (x) => x._inputValue !== "",
1037
+ html`<slot name="no-matches">
1038
+ ${(x) => x.locale.searchableSelect.noMatchesMessage}
1039
+ </slot>`
1040
+ )}
1041
+ </div>`
615
1042
  )}
1043
+ </div>
1044
+ </${popupTag}>
616
1045
  </div>
617
1046
  </div>
618
- </template>`;
1047
+ `;
1048
+ }
1049
+ const SearchableSelectTemplate = (context) => {
1050
+ const optionTagTag = context.tagFor(OptionTag);
1051
+ return html`
1052
+ <template :_optionTagTagName="${() => optionTagTag}">
1053
+ <div class="control-wrapper">
1054
+ ${renderControl(context)} ${getFeedbackTemplate(context)}
1055
+ </div>
1056
+ </template>
1057
+ `;
619
1058
  };
620
1059
 
621
- const rangeSliderDefinition = RangeSlider.compose({
622
- baseName: "range-slider",
623
- template: RangeSliderTemplate,
624
- styles,
625
- shadowOptions: {
626
- delegatesFocus: true
627
- }
628
- });
629
- const rangeSliderRegistries = [
630
- ...popupRegistries,
631
- rangeSliderDefinition()
632
- ];
633
- const registerRangeSlider = registerFactory(rangeSliderRegistries);
1060
+ const getClasses = ({ shape, disabled, removable }) => classNames(
1061
+ "base",
1062
+ ["disabled", disabled],
1063
+ ["removable", removable],
1064
+ [`shape-${shape}`, Boolean(shape)]
1065
+ );
1066
+ function renderRemoveButton(iconTag) {
1067
+ return html`
1068
+ <span
1069
+ class="remove-button"
1070
+ aria-label="${(x) => x.locale.searchableSelect.removeTagButtonLabel(x.label)}"
1071
+ role="button"
1072
+ tabindex="${(x) => x.disabled ? null : 0}"
1073
+ @click="${(x) => x._onClickRemove()}"
1074
+ >
1075
+ <${iconTag} name="close-line"></${iconTag}>
1076
+ </span>
1077
+ `;
1078
+ }
1079
+ const optionTagTemplate = (context) => {
1080
+ const iconTag = context.tagFor(Icon);
1081
+ return html`<span class="${getClasses}" aria-disabled="${(x) => x.disabled}">
1082
+ <slot name="icon" aria-hidden="true">
1083
+ ${when(
1084
+ (x) => x.hasIconPlaceholder,
1085
+ html`<div class="icon-placeholder"></div>`
1086
+ )}
1087
+ </slot>
1088
+ ${when(
1089
+ (x) => x.label,
1090
+ (x) => html`<span class="label">${x.label}</span>`
1091
+ )}
1092
+ ${when((x) => x.removable, renderRemoveButton(iconTag))}
1093
+ </span>`;
1094
+ };
1095
+
1096
+ const optionTagDefinition = defineVividComponent(
1097
+ "option-tag",
1098
+ OptionTag,
1099
+ optionTagTemplate,
1100
+ [iconDefinition],
1101
+ {
1102
+ styles: [optionTagStyles],
1103
+ shadowOptions: {
1104
+ delegatesFocus: true
1105
+ }
1106
+ }
1107
+ );
1108
+ const searchableSelectDefinition = defineVividComponent(
1109
+ "searchable-select",
1110
+ SearchableSelect,
1111
+ SearchableSelectTemplate,
1112
+ [buttonDefinition, popupDefinition, iconDefinition, optionTagDefinition],
1113
+ {
1114
+ styles,
1115
+ shadowOptions: {
1116
+ delegatesFocus: true
1117
+ }
1118
+ }
1119
+ );
1120
+ const registerSearchableSelect = createRegisterFunction(
1121
+ searchableSelectDefinition
1122
+ );
634
1123
 
635
- export { rangeSliderRegistries as a, registerRangeSlider as b, rangeSliderDefinition as r };
1124
+ export { registerSearchableSelect as r };