@vonage/vivid 4.13.0 → 4.14.0

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