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