@vonage/vivid 5.17.0 → 5.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 (459) hide show
  1. package/accordion/definition.cjs +6 -6
  2. package/accordion/definition.js +1 -1
  3. package/accordion/index.cjs +1 -1
  4. package/accordion/index.js +2 -2
  5. package/accordion-item/definition.cjs +5 -5
  6. package/accordion-item/definition.js +1 -1
  7. package/accordion-item/index.cjs +1 -1
  8. package/accordion-item/index.js +2 -2
  9. package/alert/definition.cjs +5 -5
  10. package/alert/definition.js +1 -1
  11. package/alert/index.cjs +2 -2
  12. package/alert/index.js +6 -5
  13. package/audio-player/definition.cjs +5 -5
  14. package/audio-player/definition.js +1 -1
  15. package/audio-player/index.cjs +1 -1
  16. package/audio-player/index.js +2 -1
  17. package/avatar/definition.cjs +5 -5
  18. package/avatar/definition.js +1 -1
  19. package/avatar/index.cjs +3 -3
  20. package/avatar/index.js +6 -5
  21. package/badge/definition.cjs +5 -5
  22. package/badge/definition.js +1 -1
  23. package/badge/index.cjs +1 -4
  24. package/badge/index.js +4 -20
  25. package/banner/definition.cjs +5 -5
  26. package/banner/definition.js +1 -1
  27. package/banner/index.cjs +2 -2
  28. package/banner/index.js +5 -4
  29. package/breadcrumb-item/definition.cjs +4 -4
  30. package/breadcrumb-item/definition.js +1 -1
  31. package/breadcrumb-item/index.cjs +1 -1
  32. package/breadcrumb-item/index.js +1 -0
  33. package/bundled/affix.cjs +1 -1
  34. package/bundled/affix.js +5 -5
  35. package/bundled/definition11.cjs +2 -2
  36. package/bundled/definition11.js +5 -5
  37. package/bundled/definition12.cjs +3 -3
  38. package/bundled/definition12.js +5 -5
  39. package/bundled/definition13.cjs +2 -2
  40. package/bundled/definition13.js +4 -4
  41. package/bundled/definition15.cjs +3 -3
  42. package/bundled/definition15.js +7 -7
  43. package/bundled/definition17.cjs +3 -3
  44. package/bundled/definition17.js +8 -8
  45. package/bundled/definition18.cjs +2 -2
  46. package/bundled/definition18.js +6 -6
  47. package/bundled/definition2.cjs +3 -14
  48. package/bundled/definition2.js +15 -48
  49. package/bundled/definition20.cjs +5 -5
  50. package/bundled/definition20.js +8 -8
  51. package/bundled/definition22.cjs +4 -39
  52. package/bundled/definition22.js +18 -70
  53. package/bundled/definition23.cjs +12 -0
  54. package/bundled/definition23.js +37 -0
  55. package/bundled/definition24.cjs +39 -0
  56. package/bundled/definition24.js +72 -0
  57. package/bundled/definition3.cjs +1 -1
  58. package/bundled/definition3.js +9 -6
  59. package/bundled/definition4.cjs +2 -2
  60. package/bundled/definition4.js +5 -5
  61. package/bundled/definition6.cjs +11 -11
  62. package/bundled/definition6.js +45 -29
  63. package/bundled/localized.cjs +1 -1
  64. package/bundled/localized.js +1 -0
  65. package/bundled/mixins.cjs +4 -4
  66. package/bundled/mixins.js +7 -7
  67. package/bundled/numberConverter.cjs +12 -0
  68. package/bundled/numberConverter.js +38 -0
  69. package/bundled/picker-field.template.cjs +2 -1
  70. package/bundled/picker-field.template.js +2 -1
  71. package/bundled/utils.cjs +1 -0
  72. package/bundled/utils.js +1420 -0
  73. package/bundled/vivid-element.cjs +1 -1
  74. package/bundled/vivid-element.js +1 -1
  75. package/button/definition.cjs +5 -5
  76. package/button/definition.js +1 -1
  77. package/button/index.cjs +1 -1
  78. package/button/index.js +1 -1
  79. package/card/definition.cjs +5 -5
  80. package/card/definition.js +1 -1
  81. package/card/index.cjs +4 -4
  82. package/card/index.js +7 -6
  83. package/checkbox/definition.cjs +5 -5
  84. package/checkbox/definition.js +1 -1
  85. package/checkbox/index.cjs +1 -1
  86. package/checkbox/index.js +1 -1
  87. package/color-picker/definition.cjs +5 -5
  88. package/color-picker/definition.js +1 -1
  89. package/color-picker/index.cjs +7 -7
  90. package/color-picker/index.js +55 -54
  91. package/combobox/definition.cjs +5 -5
  92. package/combobox/definition.js +1 -1
  93. package/combobox/index.cjs +2 -2
  94. package/combobox/index.js +8 -7
  95. package/contextual-help/definition.cjs +5 -5
  96. package/contextual-help/definition.js +1 -1
  97. package/contextual-help/index.cjs +1 -1
  98. package/contextual-help/index.js +1 -1
  99. package/country/definition.cjs +5 -5
  100. package/country/definition.js +1 -1
  101. package/country/index.cjs +1 -12
  102. package/country/index.js +4 -1216
  103. package/country-group/definition.cjs +6 -0
  104. package/country-group/definition.js +3 -0
  105. package/country-group/index.cjs +43 -0
  106. package/country-group/index.js +166 -0
  107. package/custom-elements.json +1112 -450
  108. package/data-grid/definition.cjs +9 -9
  109. package/data-grid/definition.js +2 -2
  110. package/data-grid/index.cjs +4 -4
  111. package/data-grid/index.js +47 -46
  112. package/date-picker/definition.cjs +5 -5
  113. package/date-picker/definition.js +2 -2
  114. package/date-picker/index.cjs +1 -1
  115. package/date-picker/index.js +1 -1
  116. package/date-range-picker/definition.cjs +5 -5
  117. package/date-range-picker/definition.js +2 -2
  118. package/date-range-picker/index.cjs +1 -1
  119. package/date-range-picker/index.js +1 -1
  120. package/date-time-picker/definition.cjs +5 -5
  121. package/date-time-picker/definition.js +2 -2
  122. package/date-time-picker/index.cjs +1 -1
  123. package/date-time-picker/index.js +1 -1
  124. package/dial-pad/definition.cjs +5 -5
  125. package/dial-pad/definition.js +2 -2
  126. package/dial-pad/index.cjs +4 -4
  127. package/dial-pad/index.js +9 -8
  128. package/dialog/definition.cjs +5 -5
  129. package/dialog/definition.js +2 -2
  130. package/dialog/index.cjs +4 -4
  131. package/dialog/index.js +12 -11
  132. package/divider/definition.cjs +1 -1
  133. package/divider/definition.js +1 -1
  134. package/empty-state/definition.cjs +5 -5
  135. package/empty-state/definition.js +2 -2
  136. package/empty-state/index.cjs +2 -2
  137. package/empty-state/index.js +6 -5
  138. package/fab/definition.cjs +5 -5
  139. package/fab/definition.js +2 -2
  140. package/fab/index.cjs +2 -2
  141. package/fab/index.js +5 -4
  142. package/file-picker/definition.cjs +5 -5
  143. package/file-picker/definition.js +2 -2
  144. package/file-picker/index.cjs +6 -6
  145. package/file-picker/index.js +9 -8
  146. package/flag/definition.cjs +6 -0
  147. package/flag/definition.js +3 -0
  148. package/flag/index.cjs +10 -0
  149. package/flag/index.js +61 -0
  150. package/header/definition.cjs +1 -1
  151. package/header/definition.js +1 -1
  152. package/icon/definition.cjs +1 -0
  153. package/icon/definition.js +1 -0
  154. package/icon/index.cjs +1 -1
  155. package/icon/index.js +1 -0
  156. package/index.cjs +183 -174
  157. package/index.js +48 -45
  158. package/layout/definition.cjs +1 -1
  159. package/layout/definition.js +1 -1
  160. package/lib/button/button.d.ts +1 -0
  161. package/lib/components.d.ts +2 -0
  162. package/lib/country/countries-data.d.ts +1 -0
  163. package/lib/country/{country-code-to-flag-icon.d.ts → utils.d.ts} +0 -3
  164. package/lib/country-group/country-group.d.ts +829 -0
  165. package/lib/country-group/country-group.template.d.ts +3 -0
  166. package/lib/country-group/definition.d.ts +3 -0
  167. package/lib/country-group/index.d.ts +1 -0
  168. package/lib/country-group/locale.d.ts +3 -0
  169. package/lib/date-picker/date-picker.d.ts +4 -0
  170. package/lib/date-range-picker/date-range-picker.d.ts +2 -0
  171. package/lib/date-time-picker/date-time-picker.d.ts +4 -0
  172. package/lib/flag/definition.d.ts +3 -0
  173. package/lib/flag/flag.d.ts +8 -0
  174. package/lib/flag/flag.template.d.ts +3 -0
  175. package/lib/flag/index.d.ts +1 -0
  176. package/lib/icon/icon.d.ts +1 -2
  177. package/lib/searchable-select/option-tag.d.ts +3 -1
  178. package/lib/searchable-select/searchable-select.d.ts +3 -1
  179. package/lib/tag-name-map.d.ts +2 -1
  180. package/lib/time-picker/time-picker.d.ts +2 -0
  181. package/locales/de-DE.cjs +1 -0
  182. package/locales/de-DE.js +1 -0
  183. package/locales/en-GB.cjs +1 -0
  184. package/locales/en-GB.js +1 -0
  185. package/locales/en-US.cjs +1 -0
  186. package/locales/en-US.js +1 -0
  187. package/locales/ja-JP.cjs +1 -0
  188. package/locales/ja-JP.js +1 -0
  189. package/locales/zh-CN.cjs +1 -0
  190. package/locales/zh-CN.js +1 -0
  191. package/menu/definition.cjs +5 -5
  192. package/menu/definition.js +1 -1
  193. package/menu/index.cjs +1 -1
  194. package/menu/index.js +1 -1
  195. package/menu-item/definition.cjs +6 -6
  196. package/menu-item/definition.js +1 -1
  197. package/menu-item/index.cjs +1 -1
  198. package/menu-item/index.js +1 -1
  199. package/nav/definition.cjs +1 -1
  200. package/nav/definition.js +1 -1
  201. package/nav-disclosure/definition.cjs +5 -5
  202. package/nav-disclosure/definition.js +2 -2
  203. package/nav-disclosure/index.cjs +2 -2
  204. package/nav-disclosure/index.js +6 -5
  205. package/nav-item/definition.cjs +5 -5
  206. package/nav-item/definition.js +2 -2
  207. package/nav-item/index.cjs +2 -2
  208. package/nav-item/index.js +5 -4
  209. package/note/definition.cjs +5 -5
  210. package/note/definition.js +2 -2
  211. package/note/index.cjs +2 -2
  212. package/note/index.js +5 -4
  213. package/number-field/definition.cjs +5 -5
  214. package/number-field/definition.js +2 -2
  215. package/number-field/index.cjs +2 -2
  216. package/number-field/index.js +6 -5
  217. package/option/definition.cjs +5 -5
  218. package/option/definition.js +1 -1
  219. package/option/index.cjs +1 -1
  220. package/option/index.js +1 -1
  221. package/package.json +4 -4
  222. package/pagination/definition.cjs +5 -5
  223. package/pagination/definition.js +2 -2
  224. package/pagination/index.cjs +1 -1
  225. package/pagination/index.js +1 -1
  226. package/popover/definition.cjs +5 -5
  227. package/popover/definition.js +2 -2
  228. package/popover/index.cjs +4 -4
  229. package/popover/index.js +7 -6
  230. package/popup/definition.cjs +4 -4
  231. package/popup/definition.js +1 -1
  232. package/popup/index.cjs +1 -1
  233. package/popup/index.js +1 -1
  234. package/progress/definition.cjs +1 -1
  235. package/progress/definition.js +1 -1
  236. package/radio/definition.cjs +1 -1
  237. package/radio/definition.js +1 -1
  238. package/radio-group/definition.cjs +5 -5
  239. package/radio-group/definition.js +2 -2
  240. package/radio-group/index.cjs +1 -1
  241. package/radio-group/index.js +1 -1
  242. package/range-slider/definition.cjs +5 -5
  243. package/range-slider/definition.js +2 -2
  244. package/range-slider/index.cjs +1 -1
  245. package/range-slider/index.js +22 -19
  246. package/rich-text-editor/definition.cjs +32 -32
  247. package/rich-text-editor/definition.js +2 -2
  248. package/rich-text-editor/index.cjs +1 -1
  249. package/rich-text-editor/index.js +2 -2
  250. package/rich-text-view/definition.cjs +1 -1
  251. package/rich-text-view/definition.js +1 -1
  252. package/searchable-select/definition.cjs +4 -4
  253. package/searchable-select/definition.js +2 -2
  254. package/searchable-select/index.cjs +6 -4
  255. package/searchable-select/index.js +76 -73
  256. package/select/definition.cjs +5 -5
  257. package/select/definition.js +2 -2
  258. package/select/index.cjs +1 -1
  259. package/select/index.js +1 -1
  260. package/selectable-box/definition.cjs +5 -5
  261. package/selectable-box/definition.js +2 -2
  262. package/selectable-box/index.cjs +1 -1
  263. package/selectable-box/index.js +1 -1
  264. package/shared/icon/utils.d.ts +1 -0
  265. package/shared/localization/Locale.d.ts +2 -0
  266. package/shared/picker-field/mixins/calendar-picker.d.ts +1 -0
  267. package/shared/picker-field/mixins/calendar-picker.template.d.ts +1 -0
  268. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1 -0
  269. package/shared/picker-field/mixins/single-date-picker.d.ts +1 -0
  270. package/shared/picker-field/mixins/single-value-picker.d.ts +1 -0
  271. package/shared/picker-field/mixins/time-selection-picker.d.ts +1 -0
  272. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +2 -0
  273. package/shared/picker-field/picker-field.d.ts +2 -0
  274. package/side-drawer/definition.cjs +1 -1
  275. package/side-drawer/definition.js +1 -1
  276. package/simple-color-picker/definition.cjs +5 -5
  277. package/simple-color-picker/definition.js +2 -2
  278. package/simple-color-picker/index.cjs +2 -2
  279. package/simple-color-picker/index.js +6 -5
  280. package/slider/definition.cjs +5 -5
  281. package/slider/definition.js +1 -1
  282. package/slider/index.cjs +1 -1
  283. package/slider/index.js +1 -1
  284. package/split-button/definition.cjs +5 -5
  285. package/split-button/definition.js +2 -2
  286. package/split-button/index.cjs +2 -2
  287. package/split-button/index.js +7 -6
  288. package/status/definition.cjs +5 -5
  289. package/status/definition.js +2 -2
  290. package/status/index.cjs +2 -2
  291. package/status/index.js +5 -4
  292. package/switch/definition.cjs +5 -5
  293. package/switch/definition.js +2 -2
  294. package/switch/index.cjs +2 -2
  295. package/switch/index.js +6 -5
  296. package/tab/definition.cjs +5 -5
  297. package/tab/definition.js +2 -2
  298. package/tab/index.cjs +1 -1
  299. package/tab/index.js +1 -1
  300. package/tab-panel/definition.cjs +1 -1
  301. package/tab-panel/definition.js +1 -1
  302. package/table/definition.cjs +17 -17
  303. package/table/definition.js +2 -2
  304. package/table/index.cjs +3 -3
  305. package/table/index.js +6 -5
  306. package/tabs/definition.cjs +6 -6
  307. package/tabs/definition.js +2 -2
  308. package/tabs/index.cjs +1 -1
  309. package/tabs/index.js +1 -1
  310. package/tag/definition.cjs +5 -5
  311. package/tag/definition.js +2 -2
  312. package/tag/index.cjs +4 -4
  313. package/tag/index.js +6 -5
  314. package/tag-group/definition.cjs +1 -1
  315. package/tag-group/definition.js +1 -1
  316. package/text-area/definition.cjs +5 -5
  317. package/text-area/definition.js +2 -2
  318. package/text-area/index.cjs +1 -1
  319. package/text-area/index.js +1 -1
  320. package/text-field/definition.cjs +5 -5
  321. package/text-field/definition.js +1 -1
  322. package/text-field/index.cjs +1 -1
  323. package/text-field/index.js +1 -1
  324. package/time-picker/definition.cjs +4 -4
  325. package/time-picker/definition.js +2 -2
  326. package/time-picker/index.cjs +1 -1
  327. package/time-picker/index.js +1 -1
  328. package/toggletip/definition.cjs +5 -5
  329. package/toggletip/definition.js +1 -1
  330. package/toggletip/index.cjs +1 -1
  331. package/toggletip/index.js +1 -1
  332. package/tooltip/definition.cjs +5 -5
  333. package/tooltip/definition.js +1 -1
  334. package/tooltip/index.cjs +1 -1
  335. package/tooltip/index.js +1 -1
  336. package/tree-item/definition.cjs +5 -5
  337. package/tree-item/definition.js +2 -2
  338. package/tree-item/index.cjs +1 -1
  339. package/tree-item/index.js +1 -1
  340. package/tree-view/definition.cjs +5 -5
  341. package/tree-view/definition.js +2 -2
  342. package/tree-view/index.cjs +1 -1
  343. package/tree-view/index.js +1 -1
  344. package/unbundled/definition11.cjs +6 -0
  345. package/unbundled/definition11.js +6 -0
  346. package/unbundled/definition14.cjs +1 -0
  347. package/unbundled/definition14.js +1 -0
  348. package/unbundled/definition2.cjs +5 -75
  349. package/unbundled/definition2.js +1 -71
  350. package/unbundled/definition28.cjs +1 -0
  351. package/unbundled/definition28.js +1 -0
  352. package/unbundled/definition31.cjs +2 -1189
  353. package/unbundled/definition31.js +1 -1188
  354. package/unbundled/definition32.cjs +207 -1835
  355. package/unbundled/definition32.js +203 -1807
  356. package/unbundled/definition33.cjs +83 -311
  357. package/unbundled/definition33.js +79 -235
  358. package/unbundled/definition34.cjs +1887 -25
  359. package/unbundled/definition34.js +1857 -24
  360. package/unbundled/definition35.cjs +315 -121
  361. package/unbundled/definition35.js +236 -114
  362. package/unbundled/definition36.cjs +25 -405
  363. package/unbundled/definition36.js +22 -397
  364. package/unbundled/definition37.cjs +47 -142
  365. package/unbundled/definition37.js +44 -139
  366. package/unbundled/definition38.cjs +345 -330
  367. package/unbundled/definition38.js +343 -328
  368. package/unbundled/definition39.cjs +183 -235
  369. package/unbundled/definition39.js +181 -233
  370. package/unbundled/definition40.cjs +377 -47
  371. package/unbundled/definition40.js +372 -42
  372. package/unbundled/definition41.cjs +256 -57
  373. package/unbundled/definition41.js +255 -56
  374. package/unbundled/definition42.cjs +45 -432
  375. package/unbundled/definition42.js +41 -428
  376. package/unbundled/definition43.cjs +63 -49
  377. package/unbundled/definition43.js +61 -47
  378. package/unbundled/definition44.cjs +438 -30
  379. package/unbundled/definition44.js +434 -25
  380. package/unbundled/definition45.cjs +46 -84
  381. package/unbundled/definition45.js +43 -81
  382. package/unbundled/definition46.cjs +29 -54
  383. package/unbundled/definition46.js +24 -50
  384. package/unbundled/definition47.cjs +93 -21
  385. package/unbundled/definition47.js +91 -16
  386. package/unbundled/definition48.cjs +49 -33
  387. package/unbundled/definition48.js +46 -30
  388. package/unbundled/definition49.cjs +22 -347
  389. package/unbundled/definition49.js +16 -344
  390. package/unbundled/definition50.cjs +34 -211
  391. package/unbundled/definition50.js +30 -207
  392. package/unbundled/definition51.cjs +282 -242
  393. package/unbundled/definition51.js +275 -235
  394. package/unbundled/definition52.cjs +211 -51
  395. package/unbundled/definition52.js +209 -48
  396. package/unbundled/definition53.cjs +275 -131
  397. package/unbundled/definition53.js +272 -127
  398. package/unbundled/definition54.cjs +50 -261
  399. package/unbundled/definition54.js +48 -260
  400. package/unbundled/definition55.cjs +126 -443
  401. package/unbundled/definition55.js +123 -441
  402. package/unbundled/definition56.cjs +234 -3596
  403. package/unbundled/definition56.js +229 -3428
  404. package/unbundled/definition57.cjs +407 -728
  405. package/unbundled/definition57.js +405 -726
  406. package/unbundled/definition58.cjs +3618 -106
  407. package/unbundled/definition58.js +3449 -100
  408. package/unbundled/definition59.cjs +624 -868
  409. package/unbundled/definition59.js +619 -863
  410. package/unbundled/definition60.cjs +106 -108
  411. package/unbundled/definition60.js +102 -104
  412. package/unbundled/definition61.cjs +1040 -71
  413. package/unbundled/definition61.js +1035 -65
  414. package/unbundled/definition62.cjs +105 -169
  415. package/unbundled/definition62.js +101 -165
  416. package/unbundled/definition63.cjs +70 -113
  417. package/unbundled/definition63.js +65 -109
  418. package/unbundled/definition64.cjs +181 -53
  419. package/unbundled/definition64.js +178 -50
  420. package/unbundled/definition65.cjs +109 -76
  421. package/unbundled/definition65.js +109 -75
  422. package/unbundled/definition66.cjs +58 -21
  423. package/unbundled/definition66.js +55 -15
  424. package/unbundled/definition67.cjs +81 -74
  425. package/unbundled/definition67.js +79 -73
  426. package/unbundled/definition68.cjs +19 -344
  427. package/unbundled/definition68.js +14 -335
  428. package/unbundled/definition69.cjs +88 -26
  429. package/unbundled/definition69.js +85 -22
  430. package/unbundled/definition7.cjs +18 -3
  431. package/unbundled/definition7.js +18 -3
  432. package/unbundled/definition70.cjs +330 -111
  433. package/unbundled/definition70.js +320 -108
  434. package/unbundled/definition71.cjs +26 -271
  435. package/unbundled/definition71.js +21 -267
  436. package/unbundled/definition72.cjs +134 -27
  437. package/unbundled/definition72.js +125 -25
  438. package/unbundled/definition73.cjs +245 -113
  439. package/unbundled/definition73.js +242 -104
  440. package/unbundled/definition74.cjs +28 -212
  441. package/unbundled/definition74.js +26 -202
  442. package/unbundled/definition75.cjs +117 -479
  443. package/unbundled/definition75.js +109 -475
  444. package/unbundled/definition76.cjs +232 -0
  445. package/unbundled/definition76.js +213 -0
  446. package/unbundled/definition77.cjs +533 -0
  447. package/unbundled/definition77.js +513 -0
  448. package/unbundled/numberConverter.cjs +91 -0
  449. package/unbundled/numberConverter.js +74 -0
  450. package/unbundled/picker-field.template.cjs +2 -0
  451. package/unbundled/picker-field.template.js +2 -0
  452. package/unbundled/utils.cjs +1439 -0
  453. package/unbundled/utils.js +1428 -0
  454. package/unbundled/vivid-element.cjs +1 -1
  455. package/unbundled/vivid-element.js +1 -1
  456. package/video-player/definition.cjs +1 -1
  457. package/video-player/definition.js +1 -1
  458. package/vivid.api.json +513 -0
  459. /package/{lib/icon/icon.placeholder.d.ts → shared/icon/icon-placeholder.d.ts} +0 -0
@@ -1,819 +1,498 @@
1
- import { o as defineVividComponent, s as createRegisterFunction } from "./vivid-element.js";
2
- import { t as iconDefinition } from "./definition2.js";
1
+ import { o as defineVividComponent, s as createRegisterFunction, t as VividElement } from "./vivid-element.js";
3
2
  import { t as __decorate } from "./decorate.js";
4
- import { a as affixIconTemplateFactory, i as IconWrapper, n as AffixIconWithTrailing } from "./affix.js";
5
3
  import { n as FormAssociated } from "./form-associated.js";
6
4
  import { t as FormElement } from "./form-element.js";
7
- import { t as WithSuccessText } from "./with-success-text.js";
8
- import { t as WithErrorText } from "./with-error-text.js";
9
- import { t as WithContextualHelp } from "./with-contextual-help.js";
10
5
  import { t as Localized } from "./localized.js";
11
- import { i as Button, r as chevronTemplateFactory, t as buttonDefinition } from "./definition7.js";
12
- import { t as handleEscapeKeyAndStopPropogation } from "./dialog.js";
13
- import { i as Popup, t as popupDefinition } from "./definition10.js";
14
- import { n as applyHostSemantics, t as HostSemantics } from "./host-semantics.js";
15
- import { a as feedbackMessageDefinition, n as WithLightDOMFeedback } from "./mixins.js";
16
- import { r as ListboxOption, t as listboxOptionDefinition } from "./definition29.js";
17
- import { t as Listbox } from "./listbox.js";
18
- import { Observable, Updates, attr, html, observable, ref, slotted, volatile, when } from "@microsoft/fast-element";
19
- import { classNames, inRange, keyArrowDown, keyArrowUp, keyEnd, keyEnter, keyEscape, keyHome, keySpace, keyTab, uniqueId } from "@microsoft/fast-web-utilities";
20
- //#region src/lib/select/select.scss?inline
21
- var select_default = ".label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}.chevron{font:var(--vvd-typography-base-extended);flex-shrink:0;transition:transform .2s;display:flex;transform:rotate(0)}:host([data-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{--_low-ink-color:var(--vvd-color-neutral-600);--focus-stroke-gap-color:transparent;flex-direction:column;gap:4px;display:inline-flex}:host([disabled]){--_low-ink-color:var(--vvd-color-neutral-400);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.control{--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-canvas);--_appearance-color-outline:var(--vvd-color-neutral-500)}.control.appearance-ghost{--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}@media (hover:hover){.control:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-canvas);--_appearance-color-outline:var(--vvd-color-neutral-700)}.control:hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:transparent}}.control.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-canvas);--_appearance-color-outline:var(--vvd-color-neutral-700)}.control.hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:transparent}.control:disabled{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:var(--vvd-color-neutral-100);--_appearance-color-outline:var(--vvd-color-neutral-300)}.control:disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.disabled{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:var(--vvd-color-neutral-100);--_appearance-color-outline:var(--vvd-color-neutral-300)}.control.disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.readonly:where(:not(.disabled,:disabled)){--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-neutral-200);--_appearance-color-outline:var(--vvd-color-neutral-400)}.control.readonly:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.error:where(:not(.disabled,:disabled)){--_appearance-color-text:notSet;--_appearance-color-fill:var(--vvd-color-alert-50);--_appearance-color-outline:var(--vvd-color-alert-500)}.control.error:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notSet;--_appearance-color-fill:var(--vvd-color-alert-50);--_appearance-color-outline:transparent}.control.success:where(:not(.disabled,:disabled)){--_appearance-color-text:notSet;--_appearance-color-fill:var(--vvd-color-success-50);--_appearance-color-outline:var(--vvd-color-success-500)}.control.success:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notSet;--_appearance-color-fill:var(--vvd-color-success-50);--_appearance-color-outline:transparent}.control{--_connotation-color-primary:var(--vvd-select-accent-primary,var(--vvd-color-canvas-text));--_connotation-color-primary-text:var(--vvd-select-accent-primary-text,var(--vvd-color-canvas));--_connotation-color-primary-increment:var(--vvd-select-accent-primary-increment,var(--vvd-color-neutral-800));--_connotation-color-intermediate:var(--vvd-select-accent-intermediate,var(--vvd-color-neutral-500));--_connotation-color-faint:var(--vvd-select-accent-faint,var(--vvd-color-neutral-50));--_connotation-color-soft:var(--vvd-select-accent-soft,var(--vvd-color-neutral-100));--_connotation-color-firm:var(--vvd-select-accent-firm,var(--vvd-color-canvas-text));--_connotation-color-fierce:var(--vvd-select-accent-fierce,var(--vvd-color-neutral-700));border-radius:var(--_select-control-border-radius);block-size:var(--_select-block-size);padding-inline:var(--_select-padding-inline);--_select-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);--_select-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_select-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);justify-content:space-between;align-items:center;gap:8px;transition:box-shadow .2s,background-color .2s;display:flex}.control.size-condensed{--_select-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_select-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_select-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2)}.control.size-condensed:not(.shape-pill){--_select-control-border-radius:4px}.control-wrapper{position:relative}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.control:not(.shape-pill){--_select-control-border-radius:8px}.control.shape-pill{--_select-control-border-radius:24px}.listbox{max-height:var(--select-height,408px);flex-direction:column;gap:2px;padding:4px;display:flex;overflow-y:auto}:host([multiple]:focus-visible) .listbox{box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));border-radius:8px}.selected-value{white-space:nowrap;flex-grow:1;align-items:center;column-gap:12px;display:flex;overflow:hidden}.selected-value .text{text-overflow:ellipsis;max-inline-size:100%;overflow:hidden}.control.shows-placeholder .selected-value .text{color:var(--vvd-color-neutral-600)}.selected-value slot[name=icon]{flex:0 0 var(--_select-icon-size);font-size:var(--_select-icon-size);line-height:1}.control.has-meta .selected-value{padding-inline-end:8px}.feedback-wrapper{display:contents}::part(popup-base){inline-size:max-content;min-inline-size:var(--_select-fixed-width,100%)}:host([multiple]) ::part(popup-base){position:static}@supports selector(:has(*)){:host(:focus-within) .control:not(.has-activedescendant,:has(.clear-button:focus)){--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){:host(:focus-within) .control:not(.has-activedescendant){--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}:host(:not([multiple]):focus-visible) ::slotted([data-vvd-component=option][current-selected]){box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent;border-radius:8px}:host([multiple]) .clear-button{margin-inline-start:auto}:host([multiple][clearable]) .label-wrapper{min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16))}";
6
+ import { i as Popup, r as PlacementStrategy, t as popupDefinition } from "./definition10.js";
7
+ import { n as keyArrowRight$1, t as keyArrowLeft$1 } from "./key-codes.js";
8
+ import { a as defaultToOneConverter, i as lerp, n as getMarkersTemplate, o as roundToStepValue, r as inverseLerp } from "./slider.template.js";
9
+ import { attr, html, nullableNumberConverter, observable, ref, when } from "@microsoft/fast-element";
10
+ import { Orientation, classNames, keyArrowDown, keyArrowUp, keyEnd, keyHome, limit } from "@microsoft/fast-web-utilities";
11
+ //#region src/lib/range-slider/range-slider.scss?inline
12
+ var range_slider_default = ":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;--_thumb-size:12px;--_thumb-interaction-indicator-size:36px;--_track-start-inset-inline-start:0;--_track-start-inset-block-start:0;cursor:pointer;user-select:none;outline:none}.control .positioning-region{position:relative}.control .track{background:var(--_track-background-color);border-radius:4px;position:absolute}.control .track-start{border-radius:inherit;background:var(--_track-start-background-color);block-size:100%;position:absolute;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));min-inline-size:var(--_thumb-size);margin-inline-start:calc(var(--_thumb-size) / 2)}.control.horizontal .track{top:calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);block-size:2px;left:0;right:0}:host([markers]) .control.horizontal .track-start{--_track-start-inset-inline-start:1px;border-top-left-radius:0;border-bottom-left-radius:0}.control.horizontal .track .mark{block-size:6px;inline-size:100%;position:absolute;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{block-size:100%;inline-size:6px;position:absolute;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{block-size:var(--_thumb-interaction-indicator-size);cursor:inherit;inline-size:var(--_thumb-interaction-indicator-size);touch-action:none;border-radius:50%;outline:none;position:absolute}.thumb-container.focus-visible{box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent;--_thumb-interaction-indicator-alpha:.05;border-radius:50%}.control.horizontal .thumb-container{transform:translateX(calc(var(--_thumb-interaction-indicator-size) / 2))}.control.vertical .thumb-container{transform:translateY(calc(var(--_thumb-interaction-indicator-size) / 2))}@media (hover:hover){.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{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;display:block;position:absolute}.thumb-container:after{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);display:block;position:absolute}.popup{pointer-events:none}.tooltip{width:auto;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);padding:8px 12px}:host([internal-part]) .thumb-container{opacity:0;transition:opacity .2s}:host([internal-part]) .control.horizontal .track{block-size:4px;top:16px;overflow:hidden}:host([internal-part]) .control:focus .thumb-container{opacity:1}@media (hover:hover){:host([internal-part]) .control:hover .thumb-container{opacity:1}}.control,:host([markers]) .control.horizontal .track-start,:host([markers]) .control.vertical .track-start{--_track-start-inset-inline-start:auto;--_track-start-inset-block-start:auto}";
22
13
  //#endregion
23
- //#region src/lib/select/select.ts
14
+ //#region src/lib/range-slider/range-slider.ts
15
+ var Direction$1 = {
16
+ Increment: 1,
17
+ Decrement: -1
18
+ };
24
19
  /**
20
+ * Base class for range-slider
21
+ *
22
+ * @component range-slider
25
23
  * @public
26
- * @component select
27
- * @slot - Default slot.
28
- * @slot icon - The preferred way to add an icon to the select control.
29
- * @slot meta - Slot to add meta content to the select control.
30
- * @slot helper-text - Describes how to use the select. Alternative to the `helper-text` attribute.
31
- * @event {CustomEvent<undefined>} input - Fires a custom 'input' event when the value updates
32
- * @event {CustomEvent<HTMLElement>} change - Fires a custom 'change' event when the value updates
33
- * @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
34
- * @testAction selectOptionByValue selectOptionByValue
35
- * @testAction selectOptionByText selectOptionByText
24
+ * @event {CustomEvent<undefined>} input:start - Event emitted when the start value changes
25
+ * @event {CustomEvent<undefined>} input:end - Event emitted when the end value changes
26
+ * @event {CustomEvent<undefined>} input - Event emitted when either the start or end value changes.
27
+ * @event {CustomEvent<undefined>} change - Event emitted when either the start or end value changes.
28
+ * @vueModel start start input:start `event.currentTarget.start`
29
+ * @vueModel end end input:end `event.currentTarget.end`
30
+ * @vueModel startAsNumber startAsNumber input:start `event.currentTarget.startAsNumber`
31
+ * @vueModel endAsNumber endAsNumber input:end `event.currentTarget.endAsNumber`
32
+ * @testSelector byLabel byLabel
33
+ * @testAction slideStartTo slideTo #track #startThumb
34
+ * @testAction slideEndTo slideTo #track #endThumb
35
+ * @testQuery range rangeAsNumber
36
+ * @testRef track shadow .control
37
+ * @testRef startThumb shadow #start-thumb
38
+ * @testRef endThumb shadow #end-thumb
36
39
  */
37
- var Select = class extends WithLightDOMFeedback(WithContextualHelp(WithErrorText(WithSuccessText(Localized(FormElement(HostSemantics(AffixIconWithTrailing(FormAssociated(Listbox))))))))) {
40
+ var RangeSlider = class extends Localized(FormElement(FormAssociated(VividElement))) {
38
41
  constructor(..._args) {
39
42
  super(..._args);
40
- this.proxy = document.createElement("select");
41
- this.activeIndex = -1;
42
- this.rangeStartIndex = -1;
43
- this.open = false;
44
- this.listboxId = uniqueId("listbox-");
45
- this.maxHeight = 0;
46
- this.fixedDropdown = false;
47
- this._feedbackWrapper = null;
48
- this._isResetting = false;
49
- this.clearable = false;
50
- this._isClearButtonFocused = false;
51
- }
52
- /**
53
- * Returns the last checked option.
54
- *
55
- * @internal
56
- */
57
- get activeOption() {
58
- return this.options[this.activeIndex];
59
- }
60
- /**
61
- * Returns the list of checked options.
62
- *
63
- * @internal
64
- */
65
- get checkedOptions() {
66
- return this.options.filter((o) => o.checked);
67
- }
68
- /**
69
- * Returns the index of the first selected option.
70
- *
71
- * @internal
72
- */
73
- get firstSelectedOptionIndex() {
74
- return this.options.indexOf(this.firstSelectedOption);
75
- }
76
- /**
77
- * Updates the `ariaActiveDescendant` property when the active index changes.
78
- *
79
- * @internal
80
- */
81
- activeIndexChanged(_, next) {
82
- this._activeDescendant = this.options[next]?.id ?? "";
83
- this.focusAndScrollOptionIntoView();
84
- }
85
- /**
86
- * Toggles the checked state for the currently active option.
87
- *
88
- * @remarks
89
- * Multiple-selection mode only.
90
- *
91
- * @internal
92
- */
93
- checkActiveIndex() {
94
- const activeItem = this.activeOption;
95
- /* v8 ignore else -- @preserve */
96
- if (activeItem) activeItem.checked = true;
97
- }
98
- /**
99
- * Sets the active index to the first option and marks it as checked.
100
- *
101
- * @remarks
102
- * Multi-selection mode only.
103
- *
104
- * @param preserveChecked - mark all options unchecked before changing the active index
105
- *
106
- * @internal
107
- */
108
- checkFirstOption(preserveChecked) {
109
- const firstSelectableIndex = this.getNextSelectableIndex(0);
110
- if (firstSelectableIndex === -1) return;
111
- if (preserveChecked) {
112
- if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
113
- this.options.forEach((o, i) => {
114
- o.checked = inRange(i, firstSelectableIndex, this.rangeStartIndex + 1) && !o.disabled;
115
- });
116
- } else this.uncheckAllOptions();
117
- this.activeIndex = firstSelectableIndex;
118
- this.checkActiveIndex();
119
- }
120
- /**
121
- * Decrements the active index and sets the matching option as checked.
122
- *
123
- * @remarks
124
- * Multi-selection mode only.
125
- *
126
- * @param preserveChecked - mark all options unchecked before changing the active index
127
- *
128
- * @internal
129
- */
130
- checkLastOption(preserveChecked) {
131
- const lastSelectableIndex = this.getPreviousSelectableIndex(this.length - 1);
132
- if (lastSelectableIndex === -1) return;
133
- if (preserveChecked) {
134
- if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
135
- this.options.forEach((o, i) => {
136
- o.checked = inRange(i, this.rangeStartIndex, lastSelectableIndex + 1) && !o.disabled;
137
- });
138
- } else this.uncheckAllOptions();
139
- this.activeIndex = lastSelectableIndex;
140
- this.checkActiveIndex();
141
- }
142
- /**
143
- * Increments the active index and marks the matching option as checked.
144
- *
145
- * @remarks
146
- * Multiple-selection mode only.
147
- *
148
- * @param preserveChecked - mark all options unchecked before changing the active index
149
- *
150
- * @internal
151
- */
152
- checkNextOption(preserveChecked) {
153
- const nextIndex = this.getNextSelectableIndex(this.activeIndex + 1);
154
- if (nextIndex === -1) return;
155
- if (preserveChecked) {
156
- if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
157
- this.options.forEach((o, i) => {
158
- o.checked = inRange(i, this.rangeStartIndex, nextIndex + 1) && !o.disabled;
159
- });
160
- } else this.uncheckAllOptions();
161
- this.activeIndex = nextIndex;
162
- this.checkActiveIndex();
163
- }
164
- /**
165
- * Decrements the active index and marks the matching option as checked.
166
- *
167
- * @remarks
168
- * Multiple-selection mode only.
169
- *
170
- * @param preserveChecked - mark all options unchecked before changing the active index
171
- *
172
- * @internal
173
- */
174
- checkPreviousOption(preserveChecked) {
175
- const previousIndex = this.getPreviousSelectableIndex(this.activeIndex - 1);
176
- if (previousIndex === -1) return;
177
- if (preserveChecked) {
178
- if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
179
- if (this.checkedOptions.length === 1) this.rangeStartIndex += 1;
180
- this.options.forEach((o, i) => {
181
- o.checked = inRange(i, previousIndex, this.rangeStartIndex + 1) && !o.disabled;
182
- });
183
- } else this.uncheckAllOptions();
184
- this.activeIndex = previousIndex;
185
- this.checkActiveIndex();
43
+ this.start = "";
44
+ this.end = "";
45
+ this.min = 0;
46
+ this.max = 10;
47
+ this.step = 1;
48
+ this.orientation = Orientation.horizontal;
49
+ this.ariaStartLabel = null;
50
+ this.ariaEndLabel = null;
51
+ this.markers = false;
52
+ this.pin = false;
53
+ this.valueTextFormatter = (value) => parseFloat(value).toLocaleString(this.locale.lang);
54
+ this.proxy = document.createElement("input");
55
+ this._trackEl = null;
56
+ this._startThumbEl = null;
57
+ this._endThumbEl = null;
58
+ this._draggingThumb = false;
59
+ this._visiblyFocusedThumb = null;
60
+ this._hoveredThumb = null;
61
+ this._startThumbCss = "";
62
+ this._endThumbCss = "";
63
+ this._selectedRangeCss = "";
64
+ }
65
+ #isInternalValueUpdate = false;
66
+ /**
67
+ * @internal
68
+ */
69
+ startChanged() {
70
+ this.currentStart = this.start;
71
+ if (!this.#isInternalValueUpdate) {
72
+ this.dirtyValue = true;
73
+ this.#updateFormValue();
74
+ }
75
+ if (this.$fastController.isConnected) this.#updateThumbPositions();
186
76
  }
187
77
  /**
188
78
  * @internal
189
79
  */
190
- focusAndScrollOptionIntoView() {
191
- super.focusAndScrollOptionIntoView(this.activeOption);
80
+ initialStartChanged(_, newValue) {
81
+ if (newValue && !this.dirtyValue) {
82
+ this.start = newValue;
83
+ this.dirtyValue = false;
84
+ }
192
85
  }
193
86
  /**
194
- * In multiple-selection mode:
195
- * If any options are selected, the first selected option is checked when
196
- * the listbox receives focus. If no options are selected, the first
197
- * selectable option is checked.
198
- *
199
87
  * @internal
200
88
  */
201
- focusinHandler(e) {
202
- if (!this.multiple) return super.focusinHandler(e);
203
- /* v8 ignore else -- @preserve */
204
- if (!this.shouldSkipFocus && e.target === e.currentTarget) {
205
- this.uncheckAllOptions();
206
- if (this.activeIndex === -1) this.activeIndex = this.firstSelectedOptionIndex !== -1 ? this.firstSelectedOptionIndex : 0;
207
- this.checkActiveIndex();
208
- this.setSelectedOptions();
209
- this.focusAndScrollOptionIntoView();
210
- }
211
- this.shouldSkipFocus = false;
89
+ currentStartChanged() {
90
+ this.start = this.currentStart;
212
91
  }
213
92
  /**
214
- * Sets an option as selected and gives it focus.
93
+ * The start property, typed as a number.
215
94
  *
216
95
  * @public
217
96
  */
218
- setSelectedOptions() {
219
- if (!this.multiple) {
220
- super.setSelectedOptions();
221
- return;
222
- }
223
- /* v8 ignore else -- @preserve */
224
- if (this.$fastController.isConnected && this.options) {
225
- this.selectedOptions = this.options.filter((o) => o.selected);
226
- this.focusAndScrollOptionIntoView();
227
- }
97
+ get startAsNumber() {
98
+ return parseFloat(this.start);
228
99
  }
229
- /**
230
- * Toggles the selected state of the provided options. If any provided items
231
- * are in an unselected state, all items are set to selected. If every
232
- * provided item is selected, they are all unselected.
233
- *
234
- * @internal
235
- */
236
- toggleSelectedForAllCheckedOptions() {
237
- const enabledCheckedOptions = this.checkedOptions.filter((o) => !o.disabled);
238
- const force = !enabledCheckedOptions.every((o) => o.selected);
239
- enabledCheckedOptions.forEach((o) => o.selected = force);
240
- this.selectedIndex = this.options.indexOf(enabledCheckedOptions[enabledCheckedOptions.length - 1]);
241
- this.setSelectedOptions();
242
- this.updateValue(true);
100
+ set startAsNumber(next) {
101
+ this.start = next.toString();
243
102
  }
244
103
  /**
245
104
  * @internal
246
105
  */
247
- typeaheadBufferChanged(prev, next) {
248
- if (!this.multiple) {
249
- super.typeaheadBufferChanged(prev, next);
250
- return;
251
- }
252
- /* v8 ignore if -- @preserve */
253
- if (this.$fastController.isConnected) {
254
- const typeaheadMatches = this.getTypeaheadMatches();
255
- const activeIndex = this.options.indexOf(typeaheadMatches[0]);
256
- if (activeIndex > -1) {
257
- this.activeIndex = activeIndex;
258
- this.uncheckAllOptions();
259
- this.checkActiveIndex();
260
- }
261
- this.typeaheadExpired = false;
106
+ endChanged() {
107
+ this.currentEnd = this.end;
108
+ if (!this.#isInternalValueUpdate) {
109
+ this.dirtyValue = true;
110
+ this.#updateFormValue();
262
111
  }
112
+ if (this.$fastController.isConnected) this.#updateThumbPositions();
263
113
  }
264
114
  /**
265
- * Unchecks all options.
266
- *
267
- * @remarks
268
- * Multiple-selection mode only.
269
- *
270
- * @param preserveChecked - reset the rangeStartIndex
271
- *
272
115
  * @internal
273
116
  */
274
- uncheckAllOptions(preserveChecked = false) {
275
- this.options.forEach((o) => o.checked = false);
276
- /* v8 ignore else -- @preserve */
277
- if (!preserveChecked) this.rangeStartIndex = -1;
278
- }
279
- /**
280
- * Sets focus when the open property changes.
281
- *
282
- * @internal
283
- */
284
- openChanged(prev, next) {
285
- if (!this.collapsible) return;
286
- if (this.open) {
287
- this.focusAndScrollOptionIntoView();
288
- this.indexWhenOpened = this.selectedIndex;
289
- Updates.enqueue(() => this.focus());
290
- return;
117
+ initialEndChanged(_, newValue) {
118
+ if (newValue && !this.dirtyValue) {
119
+ this.end = newValue;
120
+ this.dirtyValue = false;
291
121
  }
292
- const didClose = prev === true && next === false;
293
- const selectionChangedWhileOpen = this.indexWhenOpened !== this.selectedIndex;
294
- if (didClose && selectionChangedWhileOpen) this.updateValue(true);
295
- }
296
- /**
297
- * The component is collapsible when in single-selection mode.
298
- *
299
- * @internal
300
- */
301
- get collapsible() {
302
- return !this.multiple;
303
122
  }
304
123
  /**
305
124
  * @internal
306
125
  */
307
- valueChanged(prev, next) {
308
- const nextSelectedIndex = this.options.findIndex((el) => el.value === next);
309
- const validNextSelectedIndex = this._validSelectedIndex(nextSelectedIndex);
310
- const nextValue = this.options[validNextSelectedIndex]?.value ?? "";
311
- if (this.selectedIndex !== validNextSelectedIndex) this.selectedIndex = validNextSelectedIndex;
312
- if (next !== nextValue) return;
313
- super.valueChanged(prev, next);
314
- this.updateDisplayValue();
126
+ currentEndChanged() {
127
+ this.end = this.currentEnd;
315
128
  }
316
129
  /**
317
- * Sets the value and display value to match the first selected option.
318
- *
319
- * @param shouldEmit - if true, the input and change events will be emitted
130
+ * The end property, typed as a number.
320
131
  *
321
- * @internal
132
+ * @public
322
133
  */
323
- updateValue(shouldEmit) {
324
- if (this.$fastController.isConnected) this.value = this.firstSelectedOption?.value ?? "";
325
- if (shouldEmit) {
134
+ get endAsNumber() {
135
+ return parseFloat(this.end);
136
+ }
137
+ set endAsNumber(next) {
138
+ this.end = next.toString();
139
+ }
140
+ #updateValues({ start, end }, emitEvents = true) {
141
+ if (start === this.start) start = void 0;
142
+ if (end === this.end) end = void 0;
143
+ if (start === void 0 && end === void 0) return;
144
+ this.#isInternalValueUpdate = true;
145
+ if (start !== void 0) this.start = start;
146
+ if (end !== void 0) this.end = end;
147
+ this.#isInternalValueUpdate = false;
148
+ if (emitEvents) {
149
+ if (start !== void 0) this.$emit("input:start");
150
+ if (end !== void 0) this.$emit("input:end");
326
151
  this.$emit("input");
327
- this.$emit("change", this, {
328
- bubbles: true,
329
- composed: void 0
330
- });
152
+ this.$emit("change");
153
+ this.dirtyValue = true;
331
154
  }
155
+ this.#updateFormValue();
332
156
  }
333
- /**
334
- * Updates the proxy value when the selected index changes.
335
- *
336
- * @param prev - the previous selected index
337
- * @param next - the next selected index
338
- *
339
- * @internal
340
- */
341
- selectedIndexChanged(prev, next) {
342
- super.selectedIndexChanged(prev, next);
343
- this.updateValue();
157
+ #applyStep(thumb, direction) {
158
+ this.#updateValues({ [thumb]: this.#roundToNearestStep(thumb, Number(this[thumb]) + direction * this.step).toString() });
344
159
  }
345
160
  /**
346
- * Handle opening and closing the listbox when the select is clicked.
347
- *
348
- * @param e - the mouse event
349
161
  * @internal
350
162
  */
351
- clickHandler(e) {
352
- if (this.disabled || this._isFromContextualHelp(e)) return;
353
- const clickedOption = e.target.closest(`option,[role=option],[data-vvd-component=option]`);
354
- if (clickedOption && clickedOption.disabled) return;
355
- if (this.multiple) {
356
- this.uncheckAllOptions();
357
- this.activeIndex = this.options.indexOf(clickedOption);
358
- this.checkActiveIndex();
359
- this.toggleSelectedForAllCheckedOptions();
360
- } else super.clickHandler(e);
361
- if (this.collapsible) this.open = !this.open;
362
- return true;
163
+ orientationChanged() {
164
+ if (this.$fastController.isConnected) this.#updateThumbPositions();
363
165
  }
364
166
  /**
365
- * Handles focus state when the element or its children lose focus.
366
- *
367
- * @param e - The focus event
368
167
  * @internal
369
168
  */
370
- focusoutHandler(e) {
371
- if (this.multiple) this.uncheckAllOptions();
372
- if (!this.open) return true;
373
- const focusTarget = e.relatedTarget;
374
- if (this.isSameNode(focusTarget)) {
375
- this.focus();
376
- return;
377
- }
378
- /* v8 ignore else -- @preserve */
379
- if (!this.options.includes(focusTarget)) {
380
- this.open = false;
381
- if (this.indexWhenOpened !== this.selectedIndex) this.updateValue(true);
169
+ nameChanged(previous, next) {
170
+ super.nameChanged(previous, next);
171
+ this.#updateFormValue();
172
+ }
173
+ #updateFormValue() {
174
+ if (!this.name) this.setFormValue(null);
175
+ else {
176
+ const formData = new FormData();
177
+ formData.append(this.name, this.start);
178
+ formData.append(this.name, this.end);
179
+ this.setFormValue(formData);
382
180
  }
383
181
  }
384
- /**
385
- * Updates the value when an option's value changes.
386
- *
387
- * @param source - the source object
388
- * @param propertyName - the property to evaluate
389
- *
390
- * @internal
391
- */
392
- handleChange(source, propertyName) {
393
- super.handleChange(source, propertyName);
394
- if (propertyName === "value") this.updateValue();
182
+ formResetCallback() {
183
+ this.#updateValues({
184
+ start: this.initialStart ?? this.min.toString(),
185
+ end: this.initialEnd ?? this.max.toString()
186
+ });
187
+ super.formResetCallback();
188
+ }
189
+ get #thumbs() {
190
+ return {
191
+ start: this._startThumbEl,
192
+ end: this._endThumbEl
193
+ };
194
+ }
195
+ get #thumbConstraints() {
196
+ return {
197
+ start: {
198
+ min: this.min,
199
+ max: this.endAsNumber
200
+ },
201
+ end: {
202
+ min: this.startAsNumber,
203
+ max: this.max
204
+ }
205
+ };
395
206
  }
396
- /**
397
- * Prevents focus when a scrollbar is clicked.
398
- *
399
- * @param e - the mouse event object
400
- *
401
- * @internal
402
- */
403
- mousedownHandler(e) {
404
- if (e.offsetX >= 0 && e.offsetX <= this.listbox.scrollWidth) return super.mousedownHandler(e);
405
- return this.collapsible;
207
+ #getThumbId(thumb) {
208
+ return thumb === this._startThumbEl ? "start" : "end";
406
209
  }
407
- /**
408
- * @internal
409
- */
410
- multipleChanged(_, next) {
411
- this.options.forEach((o) => {
412
- o.checked = next ? false : void 0;
413
- });
414
- this.setSelectedOptions();
415
- /* v8 ignore if -- @preserve */
416
- if (this.proxy) this.proxy.multiple = next;
210
+ #getThumbIdFromEvent(e) {
211
+ return this.#getThumbId(e.target);
417
212
  }
418
- /**
419
- * Updates the selectedness of each option when the list of selected options changes.
420
- *
421
- * @param prev - the previous list of selected options
422
- * @param next - the current list of selected options
423
- *
424
- * @internal
425
- */
426
- selectedOptionsChanged(prev, next) {
427
- super.selectedOptionsChanged(prev, next);
428
- this.options.forEach((o, i) => {
429
- const proxyOption = this.proxy.options.item(i);
430
- if (proxyOption) proxyOption.selected = o.selected;
431
- });
213
+ #updateThumbPositions() {
214
+ const startOffsetPct = this.#thumbTrackEndOffset(this.startAsNumber);
215
+ const endOffsetPct = this.#thumbTrackEndOffset(this.endAsNumber);
216
+ const [dirProp, dimProp] = this.orientation === Orientation.horizontal ? ["right", "width"] : ["bottom", "height"];
217
+ const transition = `transition: ${this._draggingThumb ? "none" : "all 0.2s ease"};`;
218
+ this._startThumbCss = `${dirProp}: ${startOffsetPct}%; ${transition}`;
219
+ this._endThumbCss = `${dirProp}: ${endOffsetPct}%; ${transition}`;
220
+ this._selectedRangeCss = `${dirProp}: ${endOffsetPct}%; ${dimProp}: ${startOffsetPct - endOffsetPct}%; ${transition}`;
432
221
  }
433
- /**
434
- * Resets and fills the proxy to match the component's options.
435
- *
436
- * @internal
437
- */
438
- setProxyOptions() {
439
- /* v8 ignore else -- @preserve */
440
- if (this.proxy instanceof HTMLSelectElement && this.options) {
441
- this.proxy.length = 0;
442
- this.options.forEach((option) => {
443
- const proxyOption = option.proxy || (option instanceof HTMLOptionElement ? option.cloneNode() : null);
444
- if (proxyOption) this.proxy.options.add(proxyOption);
445
- });
446
- }
222
+ #thumbTrackEndOffset(value) {
223
+ return (1 - inverseLerp(this.min, this.max, value)) * 100;
447
224
  }
448
- /**
449
- * Handles keydown actions when the select is in multiple selection mode.
450
- *
451
- * @internal
452
- */
453
- multipleKeydownHandler(e) {
454
- if (this.disabled) return;
455
- const { key, shiftKey } = e;
456
- this.shouldSkipFocus = false;
457
- switch (key) {
458
- case keyHome:
459
- this.checkFirstOption(shiftKey);
460
- return;
461
- case keyArrowDown:
462
- this.checkNextOption(shiftKey);
463
- return;
464
- case keyArrowUp:
465
- this.checkPreviousOption(shiftKey);
466
- return;
467
- case keyEnd:
468
- this.checkLastOption(shiftKey);
469
- return;
470
- case keyTab:
471
- this.focusAndScrollOptionIntoView();
472
- return;
473
- case keyEscape:
474
- this.uncheckAllOptions();
475
- this.checkActiveIndex();
476
- return;
477
- case keySpace:
478
- e.preventDefault();
479
- /* v8 ignore else -- @preserve */
480
- if (this.typeaheadExpired) {
481
- this.toggleSelectedForAllCheckedOptions();
482
- return;
483
- }
484
- default:
485
- /* v8 ignore else -- @preserve */
486
- if (key.length === 1) this.handleTypeAhead(`${key}`);
487
- return;
488
- }
225
+ #calculateValueFromMouseEvent(e) {
226
+ const trackClientRect = this._trackEl.getBoundingClientRect();
227
+ const [minPos, maxPos, valuePos] = this.orientation === Orientation.horizontal ? [
228
+ this._trackEl.clientLeft,
229
+ this._trackEl.clientWidth,
230
+ e.pageX - document.documentElement.scrollLeft - this.getBoundingClientRect().left
231
+ ] : [
232
+ trackClientRect.top,
233
+ trackClientRect.bottom,
234
+ e.pageY - document.documentElement.scrollTop
235
+ ];
236
+ return lerp(this.min, this.max, inverseLerp(minPos, maxPos, valuePos));
237
+ }
238
+ #roundToNearestStep(thumb, value) {
239
+ return limit(this.#thumbConstraints[thumb].min, this.#thumbConstraints[thumb].max, roundToStepValue(value - this.min, this.step) + this.min);
240
+ }
241
+ #isNonVisibleFocus = false;
242
+ #focusThumbNonVisibly(thumb) {
243
+ this.#isNonVisibleFocus = true;
244
+ thumb.focus();
245
+ this.#isNonVisibleFocus = false;
489
246
  }
490
247
  /**
491
- * Handle keyboard interaction for the select.
492
- *
493
- * @param e - the keyboard event
494
248
  * @internal
495
249
  */
496
- keydownHandler(e) {
497
- const selectedIndexBefore = this.selectedIndex;
498
- if (this.multiple) this.multipleKeydownHandler(e);
499
- else super.keydownHandler(e);
500
- switch (e.key) {
501
- case keySpace:
502
- e.preventDefault();
503
- if (this.collapsible && this.typeaheadExpired) this.open = !this.open;
504
- break;
505
- case keyHome:
506
- case keyEnd:
507
- e.preventDefault();
508
- break;
509
- case keyEnter:
510
- e.preventDefault();
511
- this.open = !this.open;
512
- break;
513
- case keyEscape:
514
- if (this.collapsible && this.open) {
515
- e.preventDefault();
516
- this.open = false;
517
- }
518
- break;
519
- case keyTab:
520
- if (this.collapsible && this.open) {
521
- e.preventDefault();
522
- this.open = false;
523
- }
524
- return true;
525
- }
526
- if (this.collapsible && !this.open && this.selectedIndex !== selectedIndexBefore) this.updateValue(true);
527
- return !(e.key === keyArrowDown || e.key === keyArrowUp);
250
+ _isThumbPopupOpen(thumb) {
251
+ return this._visiblyFocusedThumb === thumb || this._hoveredThumb === thumb || this._draggingThumb === thumb;
528
252
  }
529
253
  connectedCallback() {
530
254
  super.connectedCallback();
531
- this.addEventListener("focusout", this.focusoutHandler);
532
- this.addEventListener("contentchange", this.updateDisplayValue);
255
+ this.#updateValues({
256
+ start: this.start || this.initialStart || this.min.toString(),
257
+ end: this.end || this.initialEnd || this.max.toString()
258
+ }, false);
259
+ this.#registerThumbListeners();
260
+ this.#updateThumbPositions();
261
+ document.addEventListener("visibilitychange", this.#onVisibilityChange);
533
262
  }
534
263
  disconnectedCallback() {
535
- this.removeEventListener("focusout", this.focusoutHandler);
536
- this.removeEventListener("contentchange", this.updateDisplayValue);
537
264
  super.disconnectedCallback();
538
- }
539
- /**
540
- *
541
- * @internal
542
- */
543
- updateDisplayValue() {
544
- if (this.collapsible) Observable.notify(this, "displayValue");
545
- }
546
- get displayValue() {
547
- Observable.track(this, "displayValue");
548
- return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
549
- }
550
- _newDefaultSelectedIndex(prev, next, currentSelectIndex) {
551
- const defaultSelectedIndex = super._newDefaultSelectedIndex(prev, next, currentSelectIndex);
552
- if (defaultSelectedIndex === null && currentSelectIndex === -1 && !this.placeholder) {
553
- const firstSelectableIndex = this.getNextSelectableIndex(0);
554
- if (firstSelectableIndex !== -1) return firstSelectableIndex;
265
+ this.#unregisterThumbListeners();
266
+ this.#unregisterDragListeners();
267
+ document.removeEventListener("visibilitychange", this.#onVisibilityChange);
268
+ }
269
+ #registerThumbListeners() {
270
+ for (const thumb of ["start", "end"]) {
271
+ this.#thumbs[thumb].addEventListener("keydown", this.#onThumbKeydown);
272
+ this.#thumbs[thumb].addEventListener("mousedown", this.#onThumbMousedown, { passive: true });
273
+ this.#thumbs[thumb].addEventListener("touchstart", this.#onThumbMousedown, { passive: true });
274
+ this.#thumbs[thumb].addEventListener("mouseover", this.#onMouseOver, { passive: true });
275
+ this.#thumbs[thumb].addEventListener("mouseout", this.#onMouseOut, { passive: true });
276
+ this.#thumbs[thumb].addEventListener("focus", this.#onThumbFocus);
277
+ this.#thumbs[thumb].addEventListener("blur", this.#onThumbBlur);
555
278
  }
556
- return defaultSelectedIndex;
557
- }
558
- _isDefaultSelected(option) {
559
- return super._isDefaultSelected(option) || option.value === this.initialValue || !this._isResetting && option.value === this.value;
560
279
  }
561
- slottedOptionsChanged(prev, next) {
562
- this.options.forEach((o) => {
563
- Observable.getNotifier(o).unsubscribe(this, "value");
564
- });
565
- super.slottedOptionsChanged(prev, next);
566
- this.options.forEach((o) => {
567
- Observable.getNotifier(o).subscribe(this, "value");
568
- });
569
- this.setProxyOptions();
570
- this.updateValue();
571
- const scale = this.getAttribute("scale") || this.scale;
572
- next.forEach((element) => {
573
- if (scale) {
574
- element.setAttribute("scale", scale);
575
- element.scale = scale;
576
- }
577
- });
578
- this.proxy.value = this.value;
579
- this.validate();
580
- }
581
- formResetCallback() {
582
- this.setProxyOptions();
583
- this._isResetting = true;
584
- this.selectedIndex = this._newDefaultSelectedIndex([], this.options, -1) ?? -1;
585
- this._isResetting = false;
586
- }
587
- /**
588
- * @internal
589
- */
590
- get _shouldShowClearButton() {
591
- if (!this.clearable) return false;
592
- if (this.multiple) return this.selectedOptions?.length > 0;
593
- return this.value !== "";
594
- }
595
- /**
596
- * @internal
597
- */
598
- _onClearButtonFocus() {
599
- this._isClearButtonFocused = true;
600
- this.activeIndex = -1;
601
- this.uncheckAllOptions();
602
- }
603
- /**
604
- * @internal
605
- */
606
- _onClearButtonBlur() {
607
- this._isClearButtonFocused = false;
608
- }
609
- /**
610
- * @internal
611
- */
612
- get _shouldShowLabelWrapper() {
613
- return Boolean(this.label || this._hasContextualHelp || this.multiple && this._shouldShowClearButton);
280
+ #unregisterThumbListeners() {
281
+ for (const thumb of ["start", "end"]) {
282
+ this.#thumbs[thumb].removeEventListener("keydown", this.#onThumbKeydown);
283
+ this.#thumbs[thumb].removeEventListener("mousedown", this.#onThumbMousedown);
284
+ this.#thumbs[thumb].removeEventListener("touchstart", this.#onThumbMousedown);
285
+ this.#thumbs[thumb].removeEventListener("mouseover", this.#onMouseOver);
286
+ this.#thumbs[thumb].removeEventListener("mouseout", this.#onMouseOut);
287
+ this.#thumbs[thumb].removeEventListener("focus", this.#onThumbFocus);
288
+ this.#thumbs[thumb].removeEventListener("blur", this.#onThumbBlur);
289
+ }
614
290
  }
615
291
  /**
616
292
  * @internal
617
293
  */
618
- _onClearButtonClick() {
619
- if (this.multiple) this.selectedOptions?.forEach((o) => {
620
- /* v8 ignore else -- @preserve */
621
- if (!o.disabled) o.selected = false;
622
- });
623
- else this.selectedIndex = -1;
624
- this.updateValue(true);
294
+ _onMouseDown(e) {
295
+ if (this.disabled || this._draggingThumb) return;
296
+ const value = this.#calculateValueFromMouseEvent(e);
297
+ const startDistance = Math.abs(value - Number(this.start));
298
+ const endDistance = Math.abs(value - Number(this.end));
299
+ const thumb = startDistance < endDistance || startDistance === endDistance && value < Number(this.start) ? "start" : "end";
300
+ this.#updateValues({ [thumb]: `${this.#roundToNearestStep(thumb, value)}` });
301
+ this._draggingThumb = thumb;
302
+ this.#focusThumbNonVisibly(this.#thumbs[thumb]);
303
+ this.#registerDragHandlers();
625
304
  }
305
+ #onThumbFocus = (e) => {
306
+ if (!this.#isNonVisibleFocus) this._visiblyFocusedThumb = this.#getThumbIdFromEvent(e);
307
+ this.#isNonVisibleFocus = false;
308
+ };
309
+ #onThumbBlur = () => {
310
+ this._visiblyFocusedThumb = null;
311
+ };
312
+ #onVisibilityChange = () => {
313
+ if (document.hidden && (this.shadowRoot.activeElement === this._startThumbEl || this.shadowRoot.activeElement === this._endThumbEl)) this.#isNonVisibleFocus = true;
314
+ };
315
+ #onMouseOver = (e) => {
316
+ this._hoveredThumb = this.#getThumbIdFromEvent(e);
317
+ };
318
+ #onMouseOut = () => {
319
+ this._hoveredThumb = null;
320
+ };
321
+ #onThumbMousedown = (event) => {
322
+ if (this.disabled || event.defaultPrevented) return;
323
+ let target = event.target;
324
+ if (target === this._endThumbEl && this.startAsNumber === this.max && this.endAsNumber === this.max) target = this._startThumbEl;
325
+ this.#focusThumbNonVisibly(target);
326
+ this._draggingThumb = this.#getThumbId(target);
327
+ this.#registerDragHandlers();
328
+ };
329
+ #onThumbKeydown = (e) => {
330
+ const thumb = this.#getThumbIdFromEvent(e);
331
+ this._visiblyFocusedThumb = thumb;
332
+ if (e.key === keyHome) {
333
+ e.preventDefault();
334
+ this.#updateValues({ [thumb]: `${this.#thumbConstraints[thumb].min}` });
335
+ } else if (e.key === keyEnd) {
336
+ e.preventDefault();
337
+ this.#updateValues({ [thumb]: `${this.#thumbConstraints[thumb].max}` });
338
+ } else {
339
+ if (e.shiftKey) return;
340
+ switch (e.key) {
341
+ case keyArrowRight$1:
342
+ case keyArrowDown:
343
+ e.preventDefault();
344
+ this.#applyStep(thumb, Direction$1.Increment);
345
+ break;
346
+ case keyArrowLeft$1:
347
+ case keyArrowUp:
348
+ e.preventDefault();
349
+ this.#applyStep(thumb, Direction$1.Decrement);
350
+ break;
351
+ }
352
+ }
353
+ };
354
+ #registerDragHandlers() {
355
+ window.addEventListener("mousemove", this.#onDragMove, { passive: true });
356
+ window.addEventListener("touchmove", this.#onDragMove, { passive: true });
357
+ window.addEventListener("mouseup", this.#onDragEnd);
358
+ window.addEventListener("touchend", this.#onDragEnd);
359
+ window.document.addEventListener("mouseleave", this.#onDragEnd);
360
+ }
361
+ #unregisterDragListeners() {
362
+ window.removeEventListener("mouseup", this.#onDragEnd);
363
+ window.document.removeEventListener("mouseleave", this.#onDragEnd);
364
+ window.removeEventListener("mousemove", this.#onDragMove);
365
+ window.removeEventListener("touchmove", this.#onDragMove);
366
+ window.removeEventListener("touchend", this.#onDragEnd);
367
+ }
368
+ #onDragMove = (e) => {
369
+ if (this.disabled || e.defaultPrevented || !this._draggingThumb) return;
370
+ const sourceEvent = "TouchEvent" in window && e instanceof TouchEvent ? e.touches[0] : e;
371
+ const value = this.#calculateValueFromMouseEvent(sourceEvent);
372
+ this.#updateValues({ [this._draggingThumb]: `${this.#roundToNearestStep(this._draggingThumb, value)}` });
373
+ };
374
+ #onDragEnd = () => {
375
+ this._draggingThumb = false;
376
+ this.#unregisterDragListeners();
377
+ };
626
378
  };
627
- __decorate([observable], Select.prototype, "activeIndex", void 0);
628
- __decorate([attr({ mode: "boolean" })], Select.prototype, "multiple", void 0);
379
+ __decorate([observable], RangeSlider.prototype, "start", void 0);
629
380
  __decorate([attr({
630
- attribute: "open",
631
- mode: "boolean"
632
- })], Select.prototype, "open", void 0);
633
- __decorate([volatile], Select.prototype, "collapsible", null);
634
- __decorate([observable], Select.prototype, "control", void 0);
635
- __decorate([observable], Select.prototype, "maxHeight", void 0);
636
- __decorate([observable], Select.prototype, "_anchor", void 0);
637
- __decorate([attr()], Select.prototype, "scale", void 0);
638
- __decorate([attr], Select.prototype, "appearance", void 0);
639
- __decorate([attr], Select.prototype, "shape", void 0);
381
+ mode: "fromView",
382
+ attribute: "start"
383
+ })], RangeSlider.prototype, "initialStart", void 0);
384
+ __decorate([attr({ attribute: "current-start" })], RangeSlider.prototype, "currentStart", void 0);
385
+ __decorate([observable], RangeSlider.prototype, "end", void 0);
640
386
  __decorate([attr({
641
- mode: "boolean",
642
- attribute: "fixed-dropdown"
643
- })], Select.prototype, "fixedDropdown", void 0);
644
- __decorate([attr], Select.prototype, "placeholder", void 0);
645
- __decorate([observable], Select.prototype, "_feedbackWrapper", void 0);
646
- __decorate([observable], Select.prototype, "metaSlottedContent", void 0);
647
- __decorate([attr({ mode: "boolean" })], Select.prototype, "clearable", void 0);
648
- __decorate([observable], Select.prototype, "_isClearButtonFocused", void 0);
387
+ mode: "fromView",
388
+ attribute: "end"
389
+ })], RangeSlider.prototype, "initialEnd", void 0);
390
+ __decorate([attr({ attribute: "current-end" })], RangeSlider.prototype, "currentEnd", void 0);
391
+ __decorate([attr({ converter: nullableNumberConverter })], RangeSlider.prototype, "min", void 0);
392
+ __decorate([attr({ converter: nullableNumberConverter })], RangeSlider.prototype, "max", void 0);
393
+ __decorate([attr({ converter: defaultToOneConverter })], RangeSlider.prototype, "step", void 0);
394
+ __decorate([attr], RangeSlider.prototype, "orientation", void 0);
395
+ __decorate([attr({ attribute: "aria-start-label" })], RangeSlider.prototype, "ariaStartLabel", void 0);
396
+ __decorate([attr({ attribute: "aria-end-label" })], RangeSlider.prototype, "ariaEndLabel", void 0);
397
+ __decorate([attr({ mode: "boolean" })], RangeSlider.prototype, "markers", void 0);
398
+ __decorate([attr], RangeSlider.prototype, "connotation", void 0);
399
+ __decorate([attr({ mode: "boolean" })], RangeSlider.prototype, "pin", void 0);
400
+ __decorate([observable], RangeSlider.prototype, "valueTextFormatter", void 0);
401
+ __decorate([observable], RangeSlider.prototype, "_draggingThumb", void 0);
402
+ __decorate([observable], RangeSlider.prototype, "_visiblyFocusedThumb", void 0);
403
+ __decorate([observable], RangeSlider.prototype, "_hoveredThumb", void 0);
404
+ __decorate([observable], RangeSlider.prototype, "_startThumbCss", void 0);
405
+ __decorate([observable], RangeSlider.prototype, "_endThumbCss", void 0);
406
+ __decorate([observable], RangeSlider.prototype, "_selectedRangeCss", void 0);
649
407
  //#endregion
650
- //#region src/lib/select/select.template.ts
651
- var getStateClasses = ({ shape, disabled, appearance, metaSlottedContent, errorValidationMessage, successText, placeholder, value, scale, _activeDescendant, open }) => classNames(["has-activedescendant", Boolean(_activeDescendant) && open], ["disabled", disabled], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ["has-meta", Boolean(metaSlottedContent?.length)], ["error", Boolean(errorValidationMessage)], ["success", !!successText], ["shows-placeholder", Boolean(placeholder) && !value], [`size-${scale}`, Boolean(scale)]);
652
- function renderLabel() {
653
- return html` <label
654
- for="${(x) => x.multiple ? null : "control"}"
655
- class="label"
656
- id="label"
657
- >
658
- ${(x) => x.label}
659
- </label>`;
660
- }
661
- function renderPlaceholder(context) {
662
- const optionTag = context.tagFor(ListboxOption);
663
- return html`
664
- <${optionTag} text="${(x) => x.placeholder}" hidden disabled>
665
- </${optionTag}>`;
666
- }
667
- function renderClearButton(context) {
668
- const buttonTag = context.tagFor(Button);
669
- return html`
670
- <${buttonTag}
671
- aria-label="${(x) => x.locale.select.clearButtonLabel}"
672
- aria-hidden="${(x) => x._isClearButtonFocused ? "false" : "true"}"
673
- @click="${(x, c) => {
674
- x._onClearButtonClick();
675
- c.event.stopPropagation();
676
- }}"
677
- @mousedown="${() => false}"
678
- @keydown="${(x, c) => {
679
- /* v8 ignore next -- @preserve */
680
- if (c.event.key === "Tab") x._onClearButtonBlur();
681
- c.event.stopPropagation();
682
- return true;
683
- }}"
684
- @focusin="${(x, c) => {
685
- c.event.stopPropagation();
686
- x._onClearButtonFocus();
687
- }}"
688
- @focusout="${(x) => x._onClearButtonBlur()}"
689
- ?disabled="${(x) => x.disabled}"
690
- :shape="${(x) => x.shape}"
691
- size="super-condensed"
692
- icon="close-line"
693
- appearance="ghost-light"
694
- class="clear-button"
695
- tabindex="0"
696
- ></${buttonTag}>
697
- `;
698
- }
699
- function selectValue(context) {
700
- const affixIconTemplate = affixIconTemplateFactory(context);
701
- const chevronTemplate = chevronTemplateFactory(context);
702
- return html` <div
703
- class="control ${getStateClasses}"
704
- ${ref("_anchor")}
705
- id="control"
706
- ?disabled="${(x) => x.disabled}"
707
- >
708
- <div class="selected-value">
709
- ${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
710
- <span class="text">${(x) => x.displayValue}</span>
711
- <slot name="meta" ${slotted("metaSlottedContent")}></slot>
712
- </div>
713
- ${when((x) => x._shouldShowClearButton, renderClearButton(context))}
714
- ${chevronTemplate}
715
- </div>`;
716
- }
717
- function setFixedDropdownVarWidth(x) {
718
- return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
719
- }
720
- /**
721
- * @param context - element definition context
722
- */
723
- function renderControl(context) {
408
+ //#region src/lib/range-slider/range-slider.template.ts
409
+ var getClasses = ({ disabled, connotation }) => classNames("control", ["disabled", Boolean(disabled)], [`connotation-${connotation}`, Boolean(connotation)]);
410
+ var getThumbClassesFor = (thumb) => ({ _visiblyFocusedThumb }) => classNames("thumb-container", ["focus-visible", _visiblyFocusedThumb === thumb]);
411
+ var RangeSliderTemplate = (context) => {
724
412
  const popupTag = context.tagFor(Popup);
725
- return html`
726
- <div class="label-wrapper" ?hidden=${(x) => !x._shouldShowLabelWrapper}>
727
- ${when((x) => x.label, renderLabel())}
728
- ${when((x) => x.multiple && x._shouldShowClearButton, renderClearButton(context))}
729
- <slot name="contextual-help" ${slotted("_contextualHelpSlottedContent")}></slot>
730
- </div>
731
- <div class="control-wrapper">
732
- ${when((x) => !x.multiple, selectValue(context))}
733
- <${popupTag} class="popup"
734
- style="${setFixedDropdownVarWidth}"
735
- ?open="${(x) => x.collapsible ? x.open : true}"
736
- :anchor="${(x) => x._anchor}"
737
- placement="bottom-start"
738
- strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
739
- <div class="listbox"
740
- id="${(x) => x.listboxId}"
741
- role="listbox"
742
- aria-multiselectable="${(x) => x.multiple}"
743
- aria-label="${(x) => x.multiple && !x.label && x.ariaLabel ? x.ariaLabel : null}"
744
- aria-labelledby="${(x) => x.multiple && x.label ? "label" : null}"
745
- ?disabled="${(x) => x.disabled}"
746
- ?hidden="${(x) => x.collapsible ? !x.open : false}"
747
- ${ref("listbox")}>
748
- ${when((x) => x.placeholder, renderPlaceholder(context))}
749
- <slot
750
- ${slotted({
751
- filter: Listbox.slottedOptionFilter,
752
- flatten: true,
753
- property: "slottedOptions"
754
- })}>
755
- </slot>
756
- </div>
757
- </${popupTag}>
758
- </div>
759
- `;
760
- }
761
- /**
762
- * Ignore events that originate from feedback, e.g. a click on link
763
- */
764
- function ifNotFromFeedback(handler) {
765
- return (x, c) => {
766
- if (!c.event.composedPath().includes(x._feedbackWrapper)) return handler(x, c.event);
767
- return true;
768
- };
769
- }
770
- var SelectTemplate = (context) => {
771
- return html`
772
- <template
773
- ${applyHostSemantics({
774
- role: "combobox",
775
- ariaLabel: (x) => x.ariaLabel ?? x.label,
776
- ariaHasPopup: (x) => x.collapsible ? "listbox" : "false",
777
- ariaExpanded: (x) => x.open,
778
- ariaDisabled: (x) => x.disabled
779
- })}
780
- aria-controls="${(x) => x.listboxId}"
781
- aria-activedescendant="${(x) => x.open ? x._activeDescendant : null}"
782
- aria-describedby="${(x) => x._feedbackDescribedBy}"
783
- tabindex="${(x) => !x.disabled ? "0" : null}"
784
- @click="${ifNotFromFeedback((x, e) => x.clickHandler(e))}"
785
- @focusin="${ifNotFromFeedback((x, e) => x.focusinHandler(e))}"
786
- @focusout="${ifNotFromFeedback((x, e) => x.focusoutHandler(e))}"
787
- @keydown="${ifNotFromFeedback((x, e) => {
788
- x.open && handleEscapeKeyAndStopPropogation(e);
789
- return x.keydownHandler(e);
790
- })}"
791
- @mousedown="${ifNotFromFeedback((x, e) => x.mousedownHandler(e))}"
792
- >
793
- ${renderControl(context)}
794
- <div class="feedback-wrapper" ${ref("_feedbackWrapper")}>
795
- ${(x) => x._getFeedbackTemplate(context)}
413
+ return html` <template
414
+ @mousedown="${(x, c) => x._onMouseDown(c.event)}"
415
+ >
416
+ <div class="${getClasses} ${(x) => x.orientation}">
417
+ <div class="positioning-region">
418
+ <div ${ref("_trackEl")} class="track">
419
+ <div class="track-start" style="${(x) => x._selectedRangeCss}"></div>
420
+ ${when((x) => x.markers, html`${(x) => getMarkersTemplate(x.orientation === Orientation.horizontal, Math.floor((x.max - x.min) / x.step))}`)}
421
+ </div>
422
+ <div
423
+ id="start-thumb"
424
+ ${ref("_startThumbEl")}
425
+ class="${getThumbClassesFor("start")}"
426
+ style="${(x) => x._startThumbCss}"
427
+ role="slider"
428
+ tabindex="${(x) => x.disabled ? null : 0}"
429
+ aria-label="${(x) => x.ariaStartLabel || x.locale.rangeSlider.startThumbLabel}"
430
+ aria-valuetext="${(x) => x.valueTextFormatter(x.start)}"
431
+ aria-valuenow="${(x) => x.start}"
432
+ aria-valuemin="${(x) => x.min}"
433
+ aria-valuemax="${(x) => x.end}"
434
+ aria-disabled="${(x) => x.disabled}"
435
+ aria-orientation="${(x) => x.orientation}"
436
+ ></div>
437
+ ${when((x) => x.pin, html`<${popupTag}
438
+ class="popup"
439
+ arrow
440
+ alternate
441
+ :anchor="${(x) => x._startThumbEl}"
442
+ :open=${(x) => x._isThumbPopupOpen("start")}
443
+ :placementStrategy=${(x) => x.orientation === Orientation.horizontal ? PlacementStrategy.AutoPlacementHorizontal : PlacementStrategy.AutoPlacementVertical}
444
+ animation-frame
445
+ exportparts="vvd-theme-alternate"
446
+ aria-hidden="true"
447
+ >
448
+ <div class="tooltip">${(x) => x.valueTextFormatter(x.start)}</div>
449
+ </${popupTag}>`)}
450
+ <div
451
+ id="end-thumb"
452
+ ${ref("_endThumbEl")}
453
+ class="${getThumbClassesFor("end")}"
454
+ style="${(x) => x._endThumbCss}"
455
+ role="slider"
456
+ tabindex="${(x) => x.disabled ? null : 0}"
457
+ aria-label="${(x) => x.ariaEndLabel || x.locale.rangeSlider.endThumbLabel}"
458
+ aria-valuetext="${(x) => x.valueTextFormatter(x.end)}"
459
+ aria-valuenow="${(x) => x.end}"
460
+ aria-valuemin="${(x) => x.start}"
461
+ aria-valuemax="${(x) => x.max}"
462
+ aria-disabled="${(x) => x.disabled}"
463
+ aria-orientation="${(x) => x.orientation}"
464
+ ></div>
465
+ ${when((x) => x.pin, html`<${popupTag}
466
+ class="popup"
467
+ arrow
468
+ alternate
469
+ :anchor="${(x) => x._endThumbEl}"
470
+ :open=${(x) => x._isThumbPopupOpen("end")}
471
+ :placementStrategy=${(x) => x.orientation === Orientation.horizontal ? PlacementStrategy.AutoPlacementHorizontal : PlacementStrategy.AutoPlacementVertical}
472
+ animation-frame
473
+ exportparts="vvd-theme-alternate"
474
+ aria-hidden="true"
475
+ >
476
+ <div class="tooltip">${(x) => x.valueTextFormatter(x.end)}</div>
477
+ </${popupTag}>`)}
796
478
  </div>
797
- </template>
798
- `;
479
+ </div>
480
+ </template>`;
799
481
  };
800
482
  //#endregion
801
- //#region src/lib/select/definition.ts
483
+ //#region src/lib/range-slider/definition.ts
802
484
  /**
803
485
  * @internal
804
486
  */
805
- var selectDefinition = defineVividComponent("select", Select, SelectTemplate, [
806
- popupDefinition,
807
- iconDefinition,
808
- listboxOptionDefinition,
809
- buttonDefinition,
810
- feedbackMessageDefinition
811
- ], { styles: select_default });
487
+ var rangeSliderDefinition = defineVividComponent("range-slider", RangeSlider, RangeSliderTemplate, [popupDefinition], {
488
+ styles: range_slider_default,
489
+ shadowOptions: { delegatesFocus: true }
490
+ });
812
491
  /**
813
- * Registers the select elements with the design system.
492
+ * Registers the range-slider element with the design system.
814
493
  *
815
494
  * @param prefix - the prefix to use for the component name
816
495
  */
817
- var registerSelect = createRegisterFunction(selectDefinition);
496
+ var registerRangeSlider = createRegisterFunction(rangeSliderDefinition);
818
497
  //#endregion
819
- export { selectDefinition as n, Select as r, registerSelect as t };
498
+ export { registerRangeSlider as n, RangeSlider as r, rangeSliderDefinition as t };