@vonage/vivid 3.26.0 → 3.28.2

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 (381) hide show
  1. package/README.md +4 -1
  2. package/accordion/index.js +0 -2
  3. package/accordion-item/index.js +0 -2
  4. package/alert/index.js +0 -2
  5. package/avatar/index.js +0 -2
  6. package/badge/index.js +0 -2
  7. package/banner/index.js +0 -2
  8. package/breadcrumb-item/index.js +0 -2
  9. package/button/index.js +0 -2
  10. package/calendar/index.js +0 -1
  11. package/calendar-event/index.js +0 -2
  12. package/card/index.js +0 -2
  13. package/checkbox/index.js +0 -2
  14. package/combobox/index.js +0 -3
  15. package/custom-elements.json +440 -51
  16. package/data-grid/index.js +1 -5
  17. package/dialog/index.js +0 -2
  18. package/empty-state/index.js +0 -2
  19. package/fab/index.js +0 -2
  20. package/file-picker/index.js +24 -0
  21. package/header/index.js +1 -1
  22. package/icon/index.js +0 -2
  23. package/index.d.ts +3 -3
  24. package/index.js +31 -35
  25. package/layout/index.js +1 -1
  26. package/lib/accordion/accordion.d.ts +5 -5
  27. package/lib/accordion/accordion.template.d.ts +3 -3
  28. package/lib/accordion/definition.d.ts +2 -2
  29. package/lib/accordion/index.d.ts +1 -1
  30. package/lib/accordion-item/accordion-item.d.ts +12 -12
  31. package/lib/accordion-item/accordion-item.template.d.ts +4 -4
  32. package/lib/accordion-item/definition.d.ts +1 -1
  33. package/lib/accordion-item/index.d.ts +1 -1
  34. package/lib/action-group/action-group.d.ts +11 -11
  35. package/lib/action-group/action-group.template.d.ts +4 -4
  36. package/lib/action-group/definition.d.ts +2 -2
  37. package/lib/action-group/index.d.ts +1 -1
  38. package/lib/alert/alert.d.ts +22 -22
  39. package/lib/alert/alert.template.d.ts +4 -4
  40. package/lib/alert/definition.d.ts +2 -2
  41. package/lib/alert/index.d.ts +1 -1
  42. package/lib/avatar/avatar.d.ts +14 -14
  43. package/lib/avatar/avatar.template.d.ts +4 -4
  44. package/lib/avatar/definition.d.ts +2 -2
  45. package/lib/avatar/index.d.ts +1 -1
  46. package/lib/badge/badge.d.ts +14 -14
  47. package/lib/badge/badge.template.d.ts +4 -4
  48. package/lib/badge/definition.d.ts +4 -4
  49. package/lib/badge/index.d.ts +1 -1
  50. package/lib/banner/banner.d.ts +20 -20
  51. package/lib/banner/banner.template.d.ts +4 -4
  52. package/lib/banner/definition.d.ts +2 -2
  53. package/lib/banner/index.d.ts +1 -1
  54. package/lib/breadcrumb/breadcrumb.d.ts +3 -3
  55. package/lib/breadcrumb/breadcrumb.template.d.ts +4 -4
  56. package/lib/breadcrumb/definition.d.ts +1 -1
  57. package/lib/breadcrumb/index.d.ts +1 -1
  58. package/lib/breadcrumb-item/breadcrumb-item.d.ts +5 -5
  59. package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +4 -4
  60. package/lib/breadcrumb-item/definition.d.ts +1 -1
  61. package/lib/breadcrumb-item/index.d.ts +1 -1
  62. package/lib/button/button.d.ts +18 -18
  63. package/lib/button/button.template.d.ts +4 -4
  64. package/lib/button/definition.d.ts +2 -2
  65. package/lib/button/index.d.ts +1 -1
  66. package/lib/calendar/calendar.d.ts +13 -13
  67. package/lib/calendar/calendar.template.d.ts +4 -4
  68. package/lib/calendar/definition.d.ts +1 -1
  69. package/lib/calendar/helpers/calendar.date-functions.d.ts +2 -2
  70. package/lib/calendar/helpers/calendar.event-context.d.ts +6 -6
  71. package/lib/calendar/helpers/calendar.keyboard-interactions.d.ts +9 -9
  72. package/lib/calendar/index.d.ts +1 -1
  73. package/lib/calendar-event/calendar-event.d.ts +13 -13
  74. package/lib/calendar-event/calendar-event.template.d.ts +4 -4
  75. package/lib/calendar-event/definition.d.ts +2 -2
  76. package/lib/calendar-event/index.d.ts +1 -1
  77. package/lib/card/card.d.ts +10 -10
  78. package/lib/card/card.template.d.ts +4 -4
  79. package/lib/card/definition.d.ts +1 -1
  80. package/lib/card/index.d.ts +1 -1
  81. package/lib/checkbox/checkbox.d.ts +10 -11
  82. package/lib/checkbox/checkbox.template.d.ts +4 -4
  83. package/lib/checkbox/definition.d.ts +1 -1
  84. package/lib/checkbox/index.d.ts +1 -1
  85. package/lib/combobox/combobox.d.ts +12 -13
  86. package/lib/combobox/combobox.template.d.ts +4 -4
  87. package/lib/combobox/definition.d.ts +3 -4
  88. package/lib/combobox/index.d.ts +1 -1
  89. package/lib/components.d.ts +52 -52
  90. package/lib/data-grid/data-grid-cell.d.ts +22 -22
  91. package/lib/data-grid/data-grid-cell.template.d.ts +4 -4
  92. package/lib/data-grid/data-grid-row.d.ts +4 -4
  93. package/lib/data-grid/data-grid-row.template.d.ts +3 -3
  94. package/lib/data-grid/data-grid.d.ts +20 -20
  95. package/lib/data-grid/data-grid.options.d.ts +38 -38
  96. package/lib/data-grid/data-grid.template.d.ts +3 -3
  97. package/lib/data-grid/definition.d.ts +6 -6
  98. package/lib/data-grid/index.d.ts +1 -1
  99. package/lib/dialog/definition.d.ts +2 -2
  100. package/lib/dialog/dialog.d.ts +26 -26
  101. package/lib/dialog/dialog.template.d.ts +4 -4
  102. package/lib/dialog/index.d.ts +1 -1
  103. package/lib/divider/definition.d.ts +1 -1
  104. package/lib/divider/divider.d.ts +3 -3
  105. package/lib/divider/divider.template.d.ts +4 -4
  106. package/lib/divider/index.d.ts +1 -1
  107. package/lib/elevation/definition.d.ts +1 -1
  108. package/lib/elevation/elevation.d.ts +5 -5
  109. package/lib/elevation/elevation.template.d.ts +4 -4
  110. package/lib/elevation/index.d.ts +1 -1
  111. package/lib/empty-state/definition.d.ts +3 -3
  112. package/lib/empty-state/empty-state.d.ts +5 -5
  113. package/lib/empty-state/empty-state.template.d.ts +4 -4
  114. package/lib/empty-state/index.d.ts +1 -1
  115. package/lib/enums.d.ts +60 -60
  116. package/lib/fab/definition.d.ts +4 -4
  117. package/lib/fab/fab.d.ts +12 -12
  118. package/lib/fab/fab.template.d.ts +4 -4
  119. package/lib/fab/index.d.ts +1 -1
  120. package/lib/file-picker/definition.d.ts +3 -0
  121. package/lib/file-picker/file-picker.d.ts +22 -0
  122. package/lib/file-picker/file-picker.template.d.ts +4 -0
  123. package/lib/file-picker/index.d.ts +1 -0
  124. package/lib/focus/definition.d.ts +3 -3
  125. package/lib/focus/focus.d.ts +3 -3
  126. package/lib/focus/focus.template.d.ts +4 -4
  127. package/lib/focus/index.d.ts +1 -1
  128. package/lib/header/definition.d.ts +3 -3
  129. package/lib/header/header.d.ts +5 -5
  130. package/lib/header/header.template.d.ts +4 -4
  131. package/lib/header/index.d.ts +1 -1
  132. package/lib/icon/definition.d.ts +4 -4
  133. package/lib/icon/icon.d.ts +12 -12
  134. package/lib/icon/icon.placeholder.d.ts +1 -1
  135. package/lib/icon/icon.template.d.ts +4 -4
  136. package/lib/icon/index.d.ts +1 -1
  137. package/lib/layout/definition.d.ts +4 -4
  138. package/lib/layout/index.d.ts +1 -1
  139. package/lib/layout/layout.d.ts +17 -17
  140. package/lib/layout/layout.template.d.ts +4 -4
  141. package/lib/listbox/definition.d.ts +4 -4
  142. package/lib/listbox/index.d.ts +1 -1
  143. package/lib/listbox/listbox.d.ts +6 -6
  144. package/lib/listbox/listbox.template.d.ts +4 -4
  145. package/lib/menu/definition.d.ts +12 -12
  146. package/lib/menu/index.d.ts +1 -1
  147. package/lib/menu/menu.d.ts +16 -14
  148. package/lib/menu/menu.template.d.ts +3 -3
  149. package/lib/menu-item/definition.d.ts +3 -3
  150. package/lib/menu-item/index.d.ts +1 -1
  151. package/lib/menu-item/menu-item.d.ts +14 -14
  152. package/lib/menu-item/menu-item.template.d.ts +4 -4
  153. package/lib/nav/definition.d.ts +3 -3
  154. package/lib/nav/index.d.ts +1 -1
  155. package/lib/nav/nav.d.ts +3 -3
  156. package/lib/nav/nav.template.d.ts +4 -4
  157. package/lib/nav-disclosure/definition.d.ts +3 -3
  158. package/lib/nav-disclosure/index.d.ts +1 -1
  159. package/lib/nav-disclosure/nav-disclosure.d.ts +10 -10
  160. package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -4
  161. package/lib/nav-item/definition.d.ts +3 -3
  162. package/lib/nav-item/index.d.ts +1 -1
  163. package/lib/nav-item/nav-item.d.ts +7 -7
  164. package/lib/nav-item/nav-item.template.d.ts +4 -4
  165. package/lib/note/definition.d.ts +4 -4
  166. package/lib/note/index.d.ts +1 -1
  167. package/lib/note/note.d.ts +10 -10
  168. package/lib/note/note.template.d.ts +4 -4
  169. package/lib/number-field/definition.d.ts +5 -5
  170. package/lib/number-field/index.d.ts +1 -1
  171. package/lib/number-field/number-field.d.ts +13 -13
  172. package/lib/number-field/number-field.template.d.ts +4 -4
  173. package/lib/option/definition.d.ts +3 -3
  174. package/lib/option/index.d.ts +1 -1
  175. package/lib/option/option.d.ts +12 -12
  176. package/lib/option/option.template.d.ts +4 -4
  177. package/lib/pagination/definition.d.ts +3 -3
  178. package/lib/pagination/index.d.ts +1 -1
  179. package/lib/pagination/pagination.d.ts +18 -18
  180. package/lib/pagination/pagination.template.d.ts +4 -4
  181. package/lib/popup/definition.d.ts +5 -5
  182. package/lib/popup/index.d.ts +1 -1
  183. package/lib/popup/popup.d.ts +21 -21
  184. package/lib/popup/popup.template.d.ts +4 -4
  185. package/lib/progress/definition.d.ts +4 -4
  186. package/lib/progress/index.d.ts +1 -1
  187. package/lib/progress/progress.d.ts +9 -9
  188. package/lib/progress/progress.template.d.ts +5 -5
  189. package/lib/progress-ring/definition.d.ts +4 -4
  190. package/lib/progress-ring/index.d.ts +1 -1
  191. package/lib/progress-ring/progress-ring.d.ts +7 -7
  192. package/lib/progress-ring/progress-ring.template.d.ts +4 -4
  193. package/lib/radio/definition.d.ts +3 -3
  194. package/lib/radio/index.d.ts +1 -1
  195. package/lib/radio/radio.d.ts +7 -7
  196. package/lib/radio/radio.template.d.ts +4 -4
  197. package/lib/radio-group/definition.d.ts +11 -11
  198. package/lib/radio-group/index.d.ts +1 -1
  199. package/lib/radio-group/radio-group.d.ts +4 -4
  200. package/lib/radio-group/radio-group.template.d.ts +4 -4
  201. package/lib/select/definition.d.ts +4 -4
  202. package/lib/select/index.d.ts +1 -1
  203. package/lib/select/select.d.ts +17 -18
  204. package/lib/select/select.template.d.ts +4 -4
  205. package/lib/side-drawer/definition.d.ts +3 -3
  206. package/lib/side-drawer/index.d.ts +1 -1
  207. package/lib/side-drawer/side-drawer.d.ts +9 -9
  208. package/lib/side-drawer/side-drawer.template.d.ts +4 -4
  209. package/lib/slider/definition.d.ts +3 -3
  210. package/lib/slider/index.d.ts +1 -1
  211. package/lib/slider/slider.d.ts +4 -4
  212. package/lib/slider/slider.template.d.ts +4 -4
  213. package/lib/switch/definition.d.ts +4 -4
  214. package/lib/switch/index.d.ts +1 -1
  215. package/lib/switch/switch.d.ts +7 -7
  216. package/lib/switch/switch.template.d.ts +4 -4
  217. package/lib/tab/definition.d.ts +4 -4
  218. package/lib/tab/index.d.ts +1 -1
  219. package/lib/tab/tab.d.ts +14 -14
  220. package/lib/tab/tab.template.d.ts +3 -3
  221. package/lib/tab-panel/definition.d.ts +3 -3
  222. package/lib/tab-panel/index.d.ts +1 -1
  223. package/lib/tab-panel/tab-panel.d.ts +3 -3
  224. package/lib/tab-panel/tab-panel.template.d.ts +2 -2
  225. package/lib/tabs/definition.d.ts +3 -3
  226. package/lib/tabs/index.d.ts +1 -1
  227. package/lib/tabs/tabs.d.ts +15 -15
  228. package/lib/tabs/tabs.template.d.ts +2 -2
  229. package/lib/tag/definition.d.ts +4 -4
  230. package/lib/tag/index.d.ts +1 -1
  231. package/lib/tag/tag.d.ts +22 -22
  232. package/lib/tag/tag.template.d.ts +4 -4
  233. package/lib/tag-group/definition.d.ts +3 -3
  234. package/lib/tag-group/index.d.ts +1 -1
  235. package/lib/tag-group/tag-group.d.ts +3 -3
  236. package/lib/tag-group/tag-group.template.d.ts +4 -4
  237. package/lib/text-anchor/definition.d.ts +3 -3
  238. package/lib/text-anchor/index.d.ts +1 -1
  239. package/lib/text-anchor/text-anchor.d.ts +7 -7
  240. package/lib/text-anchor/text-anchor.template.d.ts +4 -4
  241. package/lib/text-area/definition.d.ts +4 -4
  242. package/lib/text-area/index.d.ts +1 -1
  243. package/lib/text-area/text-area.d.ts +8 -9
  244. package/lib/text-area/text-area.template.d.ts +4 -4
  245. package/lib/text-field/definition.d.ts +4 -4
  246. package/lib/text-field/index.d.ts +1 -1
  247. package/lib/text-field/text-field.d.ts +13 -14
  248. package/lib/text-field/text-field.template.d.ts +4 -4
  249. package/lib/toggletip/definition.d.ts +3 -3
  250. package/lib/toggletip/index.d.ts +1 -1
  251. package/lib/toggletip/toggletip.d.ts +15 -15
  252. package/lib/toggletip/toggletip.template.d.ts +4 -4
  253. package/lib/tooltip/definition.d.ts +3 -3
  254. package/lib/tooltip/index.d.ts +1 -1
  255. package/lib/tooltip/tooltip.d.ts +14 -14
  256. package/lib/tooltip/tooltip.template.d.ts +4 -4
  257. package/lib/tree-item/definition.d.ts +3 -3
  258. package/lib/tree-item/index.d.ts +1 -1
  259. package/lib/tree-item/tree-item.d.ts +7 -7
  260. package/lib/tree-item/tree-item.template.d.ts +4 -4
  261. package/lib/tree-view/definition.d.ts +3 -3
  262. package/lib/tree-view/index.d.ts +1 -1
  263. package/lib/tree-view/tree-view.d.ts +3 -3
  264. package/lib/tree-view/tree-view.template.d.ts +2 -2
  265. package/listbox/index.js +17 -21
  266. package/menu/index.js +2 -5
  267. package/menu-item/index.js +1 -4
  268. package/nav/index.js +1 -1
  269. package/nav-disclosure/index.js +1 -3
  270. package/nav-item/index.js +1 -3
  271. package/note/index.js +1 -3
  272. package/number-field/index.js +1 -4
  273. package/option/index.js +0 -2
  274. package/package.json +10 -8
  275. package/pagination/index.js +2 -6
  276. package/popup/index.js +0 -3
  277. package/progress/index.js +1 -1
  278. package/radio/index.js +1 -1
  279. package/radio-group/index.js +3 -3
  280. package/select/index.js +1 -4
  281. package/shared/affix.js +2 -5
  282. package/shared/anchor.js +2 -1
  283. package/shared/apply-mixins.js +1 -1
  284. package/shared/definition.js +7 -9
  285. package/shared/definition10.js +13 -17
  286. package/shared/definition11.js +6 -9
  287. package/shared/definition12.js +16 -18
  288. package/shared/definition13.js +6 -8
  289. package/shared/definition14.js +7 -12
  290. package/shared/definition15.js +43 -52
  291. package/shared/definition16.js +8 -71
  292. package/shared/definition17.js +36 -45
  293. package/shared/definition18.js +19 -24
  294. package/shared/definition19.js +45 -49
  295. package/shared/definition2.js +24 -28
  296. package/shared/definition20.js +390 -281
  297. package/shared/definition21.js +12 -16
  298. package/shared/definition22.js +82 -168
  299. package/shared/definition23.js +35 -41
  300. package/shared/definition24.js +6 -8
  301. package/shared/definition25.js +10 -14
  302. package/shared/definition26.js +40 -42
  303. package/shared/definition27.js +2285 -48
  304. package/shared/definition28.js +46 -38
  305. package/shared/definition29.js +38 -370
  306. package/shared/definition3.js +5 -9
  307. package/shared/definition30.js +348 -302
  308. package/shared/definition31.js +365 -14
  309. package/shared/definition32.js +12 -71
  310. package/shared/definition33.js +63 -26
  311. package/shared/definition34.js +24 -40
  312. package/shared/definition35.js +32 -436
  313. package/shared/definition36.js +428 -217
  314. package/shared/definition37.js +175 -77
  315. package/shared/definition38.js +50 -34
  316. package/shared/definition39.js +36 -430
  317. package/shared/definition4.js +3 -5
  318. package/shared/definition40.js +358 -589
  319. package/shared/definition41.js +644 -75
  320. package/shared/definition42.js +70 -587
  321. package/shared/definition43.js +503 -84
  322. package/shared/definition44.js +124 -52
  323. package/shared/definition45.js +57 -19
  324. package/shared/definition46.js +17 -487
  325. package/shared/definition47.js +477 -102
  326. package/shared/definition48.js +109 -19
  327. package/shared/definition49.js +17 -276
  328. package/shared/definition5.js +7 -8
  329. package/shared/definition50.js +253 -101
  330. package/shared/definition51.js +114 -629
  331. package/shared/definition52.js +92 -85
  332. package/shared/definition53.js +112 -70
  333. package/shared/definition54.js +65 -294
  334. package/shared/definition55.js +303 -0
  335. package/shared/definition6.js +17 -23
  336. package/shared/definition7.js +44 -47
  337. package/shared/definition8.js +3 -5
  338. package/shared/definition9.js +13 -17
  339. package/shared/design-system/index.d.ts +3 -3
  340. package/shared/focus2.js +1 -3
  341. package/shared/form-associated.js +1 -1
  342. package/shared/form-elements.js +16 -20
  343. package/shared/icon.js +2 -1171
  344. package/shared/index.js +41 -1549
  345. package/shared/listbox.js +1 -1
  346. package/shared/patterns/affix.d.ts +9 -9
  347. package/shared/patterns/focus.d.ts +3 -3
  348. package/shared/patterns/form-elements/form-elements.d.ts +57 -57
  349. package/shared/patterns/form-elements/index.d.ts +1 -1
  350. package/shared/patterns/index.d.ts +3 -3
  351. package/shared/repeat.js +1 -1
  352. package/shared/text-anchor.template.js +38 -40
  353. package/shared/text-field.js +1 -1
  354. package/shared/text-field2.js +1 -1
  355. package/shared/when.js +19 -5
  356. package/side-drawer/index.js +1 -1
  357. package/slider/index.js +1 -4
  358. package/styles/core/all.css +1 -1
  359. package/styles/core/theme.css +1 -1
  360. package/styles/core/typography.css +1 -1
  361. package/styles/tokens/theme-dark.css +17 -17
  362. package/styles/tokens/theme-light.css +17 -17
  363. package/switch/index.js +1 -3
  364. package/tab/index.js +1 -3
  365. package/tab-panel/index.js +1 -1
  366. package/tabs/index.js +3 -5
  367. package/tag/index.js +1 -3
  368. package/tag-group/index.js +1 -1
  369. package/text-anchor/index.js +0 -2
  370. package/text-area/index.js +1 -3
  371. package/text-field/index.js +1 -3
  372. package/toggletip/index.js +1 -5
  373. package/tooltip/index.js +1 -4
  374. package/tree-item/index.js +2 -4
  375. package/tree-view/index.js +1 -1
  376. package/vivid.api.json +210 -848
  377. package/shared/es.object.assign.js +0 -68
  378. package/shared/es.regexp.to-string.js +0 -61
  379. package/shared/es.string.includes.js +0 -83
  380. package/shared/string-trim.js +0 -40
  381. package/shared/to-string.js +0 -51
@@ -1,22 +1,34 @@
1
- import { F as FoundationElement, _ as __decorate, a as attr, o as observable, b as __metadata, h as html, r as registerFactory } from './index.js';
2
- import { i as iconRegistries } from './definition3.js';
1
+ import { F as FoundationElement, _ as __decorate, a as attr, o as observable, n as nullableNumberConverter, b as __metadata, h as html, r as registerFactory } from './index.js';
3
2
  import { f as focusRegistries } from './definition4.js';
4
- import { C as CheckableFormAssociated } from './form-associated.js';
5
- import { e as keySpace, d as keyEnter } from './key-codes.js';
6
- import './affix.js';
3
+ import { D as Direction, g as getDirection } from './direction.js';
4
+ import { l as limit$1 } from './numbers.js';
5
+ import { F as FormAssociated } from './form-associated.js';
6
+ import { O as Orientation } from './aria.js';
7
+ import { a as keyHome, k as keyEnd, b as keyArrowDown, i as keyArrowLeft, c as keyArrowUp, h as keyArrowRight } from './key-codes.js';
7
8
  import { f as focusTemplateFactory } from './focus2.js';
8
- import './form-elements.js';
9
- import { w as when } from './when.js';
9
+ import { r as ref } from './ref.js';
10
+ import { O as Orientation$1 } from './aria2.js';
10
11
  import { c as classNames } from './class-names.js';
11
12
 
12
- class _Switch extends FoundationElement {
13
+ /**
14
+ * Converts a pixel coordinate on the track to a percent of the track's range
15
+ */
16
+ function convertPixelToPercent(pixelPos, minPosition, maxPosition, direction) {
17
+ let pct = limit$1(0, 1, (pixelPos - minPosition) / (maxPosition - minPosition));
18
+ if (direction === Direction.rtl) {
19
+ pct = 1 - pct;
20
+ }
21
+ return pct;
22
+ }
23
+
24
+ class _Slider extends FoundationElement {
13
25
  }
14
26
  /**
15
- * A form-associated base class for the {@link @microsoft/fast-foundation#(Switch:class)} component.
27
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(Slider:class)} component.
16
28
  *
17
29
  * @internal
18
30
  */
19
- class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
31
+ class FormAssociatedSlider extends FormAssociated(_Slider) {
20
32
  constructor() {
21
33
  super(...arguments);
22
34
  this.proxy = document.createElement("input");
@@ -24,124 +36,531 @@ class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
24
36
  }
25
37
 
26
38
  /**
27
- * A Switch Custom HTML Element.
28
- * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#switch | ARIA switch }.
39
+ * The selection modes of a {@link @microsoft/fast-foundation#(Slider:class)}.
40
+ * @public
41
+ */
42
+ const SliderMode = {
43
+ singleValue: "single-value",
44
+ };
45
+ /**
46
+ * A Slider Custom HTML Element.
47
+ * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#slider | ARIA slider }.
29
48
  *
30
- * @slot - The deafult slot for the label
31
- * @slot checked-message - The message when in a checked state
32
- * @slot unchecked-message - The message when in an unchecked state
33
- * @csspart label - The label
34
- * @csspart switch - The element representing the switch, which wraps the indicator
35
- * @csspart status-message - The wrapper for the status messages
36
- * @csspart checked-message - The checked message
37
- * @csspart unchecked-message - The unchecked message
38
- * @fires change - Emits a custom change event when the checked state changes
49
+ * @slot track - The track of the slider
50
+ * @slot track-start - The track-start visual indicator
51
+ * @slot thumb - The slider thumb
52
+ * @slot - The default slot for labels
53
+ * @csspart positioning-region - The region used to position the elements of the slider
54
+ * @csspart track-container - The region containing the track elements
55
+ * @csspart track-start - The element wrapping the track start slot
56
+ * @csspart thumb-container - The thumb container element which is programatically positioned
57
+ * @fires change - Fires a custom 'change' event when the slider value changes
39
58
  *
40
59
  * @public
41
60
  */
42
- class Switch$1 extends FormAssociatedSwitch {
61
+ class Slider$1 extends FormAssociatedSlider {
43
62
  constructor() {
44
- super();
63
+ super(...arguments);
45
64
  /**
46
- * The element's value to be included in form submission when checked.
47
- * Default to "on" to reach parity with input[type="checkbox"]
48
- *
49
65
  * @internal
50
66
  */
51
- this.initialValue = "on";
67
+ this.direction = Direction.ltr;
52
68
  /**
53
69
  * @internal
54
70
  */
71
+ this.isDragging = false;
72
+ /**
73
+ * @internal
74
+ */
75
+ this.trackWidth = 0;
76
+ /**
77
+ * @internal
78
+ */
79
+ this.trackMinWidth = 0;
80
+ /**
81
+ * @internal
82
+ */
83
+ this.trackHeight = 0;
84
+ /**
85
+ * @internal
86
+ */
87
+ this.trackLeft = 0;
88
+ /**
89
+ * @internal
90
+ */
91
+ this.trackMinHeight = 0;
92
+ /**
93
+ * Custom function that generates a string for the component's "aria-valuetext" attribute based on the current value.
94
+ *
95
+ * @public
96
+ */
97
+ this.valueTextFormatter = () => null;
98
+ /**
99
+ * The minimum allowed value.
100
+ *
101
+ * @defaultValue - 0
102
+ * @public
103
+ * @remarks
104
+ * HTML Attribute: min
105
+ */
106
+ this.min = 0; // Map to proxy element.
107
+ /**
108
+ * The maximum allowed value.
109
+ *
110
+ * @defaultValue - 10
111
+ * @public
112
+ * @remarks
113
+ * HTML Attribute: max
114
+ */
115
+ this.max = 10; // Map to proxy element.
116
+ /**
117
+ * Value to increment or decrement via arrow keys, mouse click or drag.
118
+ *
119
+ * @public
120
+ * @remarks
121
+ * HTML Attribute: step
122
+ */
123
+ this.step = 1; // Map to proxy element.
124
+ /**
125
+ * The orientation of the slider.
126
+ *
127
+ * @public
128
+ * @remarks
129
+ * HTML Attribute: orientation
130
+ */
131
+ this.orientation = Orientation.horizontal;
132
+ /**
133
+ * The selection mode.
134
+ *
135
+ * @public
136
+ * @remarks
137
+ * HTML Attribute: mode
138
+ */
139
+ this.mode = SliderMode.singleValue;
55
140
  this.keypressHandler = (e) => {
56
141
  if (this.readOnly) {
57
142
  return;
58
143
  }
59
- switch (e.key) {
60
- case keyEnter:
61
- case keySpace:
62
- this.checked = !this.checked;
63
- break;
144
+ if (e.key === keyHome) {
145
+ e.preventDefault();
146
+ this.value = `${this.min}`;
147
+ }
148
+ else if (e.key === keyEnd) {
149
+ e.preventDefault();
150
+ this.value = `${this.max}`;
151
+ }
152
+ else if (!e.shiftKey) {
153
+ switch (e.key) {
154
+ case keyArrowRight:
155
+ case keyArrowUp:
156
+ e.preventDefault();
157
+ this.increment();
158
+ break;
159
+ case keyArrowLeft:
160
+ case keyArrowDown:
161
+ e.preventDefault();
162
+ this.decrement();
163
+ break;
164
+ }
165
+ }
166
+ };
167
+ this.setupTrackConstraints = () => {
168
+ const clientRect = this.track.getBoundingClientRect();
169
+ this.trackWidth = this.track.clientWidth;
170
+ this.trackMinWidth = this.track.clientLeft;
171
+ this.trackHeight = clientRect.bottom;
172
+ this.trackMinHeight = clientRect.top;
173
+ this.trackLeft = this.getBoundingClientRect().left;
174
+ if (this.trackWidth === 0) {
175
+ this.trackWidth = 1;
176
+ }
177
+ };
178
+ this.setupListeners = (remove = false) => {
179
+ const eventAction = `${remove ? "remove" : "add"}EventListener`;
180
+ this[eventAction]("keydown", this.keypressHandler);
181
+ this[eventAction]("mousedown", this.handleMouseDown);
182
+ this.thumb[eventAction]("mousedown", this.handleThumbMouseDown, {
183
+ passive: true,
184
+ });
185
+ this.thumb[eventAction]("touchstart", this.handleThumbMouseDown, {
186
+ passive: true,
187
+ });
188
+ // removes handlers attached by mousedown handlers
189
+ if (remove) {
190
+ this.handleMouseDown(null);
191
+ this.handleThumbMouseDown(null);
64
192
  }
65
193
  };
66
194
  /**
67
195
  * @internal
68
196
  */
69
- this.clickHandler = (e) => {
70
- if (!this.disabled && !this.readOnly) {
71
- this.checked = !this.checked;
197
+ this.initialValue = "";
198
+ /**
199
+ * Handle mouse moves during a thumb drag operation
200
+ * If the event handler is null it removes the events
201
+ */
202
+ this.handleThumbMouseDown = (event) => {
203
+ if (event) {
204
+ if (this.readOnly || this.disabled || event.defaultPrevented) {
205
+ return;
206
+ }
207
+ event.target.focus();
72
208
  }
209
+ const eventAction = `${event !== null ? "add" : "remove"}EventListener`;
210
+ window[eventAction]("mouseup", this.handleWindowMouseUp);
211
+ window[eventAction]("mousemove", this.handleMouseMove, { passive: true });
212
+ window[eventAction]("touchmove", this.handleMouseMove, { passive: true });
213
+ window[eventAction]("touchend", this.handleWindowMouseUp);
214
+ this.isDragging = event !== null;
215
+ };
216
+ /**
217
+ * Handle mouse moves during a thumb drag operation
218
+ */
219
+ this.handleMouseMove = (e) => {
220
+ if (this.readOnly || this.disabled || e.defaultPrevented) {
221
+ return;
222
+ }
223
+ // update the value based on current position
224
+ const sourceEvent = window.TouchEvent && e instanceof TouchEvent
225
+ ? e.touches[0]
226
+ : e;
227
+ const eventValue = this.orientation === Orientation.horizontal
228
+ ? sourceEvent.pageX - document.documentElement.scrollLeft - this.trackLeft
229
+ : sourceEvent.pageY - document.documentElement.scrollTop;
230
+ this.value = `${this.calculateNewValue(eventValue)}`;
231
+ };
232
+ this.calculateNewValue = (rawValue) => {
233
+ // update the value based on current position
234
+ const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.horizontal
235
+ ? this.trackMinWidth
236
+ : this.trackMinHeight, this.orientation === Orientation.horizontal
237
+ ? this.trackWidth
238
+ : this.trackHeight, this.direction);
239
+ const newValue = (this.max - this.min) * newPosition + this.min;
240
+ return this.convertToConstrainedValue(newValue);
241
+ };
242
+ /**
243
+ * Handle a window mouse up during a drag operation
244
+ */
245
+ this.handleWindowMouseUp = (event) => {
246
+ this.stopDragging();
247
+ };
248
+ this.stopDragging = () => {
249
+ this.isDragging = false;
250
+ this.handleMouseDown(null);
251
+ this.handleThumbMouseDown(null);
252
+ };
253
+ /**
254
+ *
255
+ * @param e - MouseEvent or null. If there is no event handler it will remove the events
256
+ */
257
+ this.handleMouseDown = (e) => {
258
+ const eventAction = `${e !== null ? "add" : "remove"}EventListener`;
259
+ if (e === null || (!this.disabled && !this.readOnly)) {
260
+ window[eventAction]("mouseup", this.handleWindowMouseUp);
261
+ window.document[eventAction]("mouseleave", this.handleWindowMouseUp);
262
+ window[eventAction]("mousemove", this.handleMouseMove);
263
+ if (e) {
264
+ e.preventDefault();
265
+ this.setupTrackConstraints();
266
+ e.target.focus();
267
+ const controlValue = this.orientation === Orientation.horizontal
268
+ ? e.pageX - document.documentElement.scrollLeft - this.trackLeft
269
+ : e.pageY - document.documentElement.scrollTop;
270
+ this.value = `${this.calculateNewValue(controlValue)}`;
271
+ }
272
+ }
273
+ };
274
+ this.convertToConstrainedValue = (value) => {
275
+ if (isNaN(value)) {
276
+ value = this.min;
277
+ }
278
+ /**
279
+ * The following logic intends to overcome the issue with math in JavaScript with regards to floating point numbers.
280
+ * This is needed as the `step` may be an integer but could also be a float. To accomplish this the step is assumed to be a float
281
+ * and is converted to an integer by determining the number of decimal places it represent, multiplying it until it is an
282
+ * integer and then dividing it to get back to the correct number.
283
+ */
284
+ let constrainedValue = value - this.min;
285
+ const roundedConstrainedValue = Math.round(constrainedValue / this.step);
286
+ const remainderValue = constrainedValue -
287
+ (roundedConstrainedValue * (this.stepMultiplier * this.step)) /
288
+ this.stepMultiplier;
289
+ constrainedValue =
290
+ remainderValue >= Number(this.step) / 2
291
+ ? constrainedValue - remainderValue + Number(this.step)
292
+ : constrainedValue - remainderValue;
293
+ return constrainedValue + this.min;
73
294
  };
74
- this.proxy.setAttribute("type", "checkbox");
75
295
  }
76
296
  readOnlyChanged() {
77
297
  if (this.proxy instanceof HTMLInputElement) {
78
298
  this.proxy.readOnly = this.readOnly;
79
299
  }
80
- this.readOnly
81
- ? this.classList.add("readonly")
82
- : this.classList.remove("readonly");
300
+ }
301
+ /**
302
+ * The value property, typed as a number.
303
+ *
304
+ * @public
305
+ */
306
+ get valueAsNumber() {
307
+ return parseFloat(super.value);
308
+ }
309
+ set valueAsNumber(next) {
310
+ this.value = next.toString();
83
311
  }
84
312
  /**
85
313
  * @internal
86
314
  */
87
- checkedChanged(prev, next) {
88
- super.checkedChanged(prev, next);
89
- /**
90
- * @deprecated - this behavior already exists in the template and should not exist in the class.
91
- */
92
- this.checked ? this.classList.add("checked") : this.classList.remove("checked");
315
+ valueChanged(previous, next) {
316
+ super.valueChanged(previous, next);
317
+ if (this.$fastController.isConnected) {
318
+ this.setThumbPositionForOrientation(this.direction);
319
+ }
320
+ this.$emit("change");
321
+ }
322
+ minChanged() {
323
+ if (this.proxy instanceof HTMLInputElement) {
324
+ this.proxy.min = `${this.min}`;
325
+ }
326
+ this.validate();
327
+ }
328
+ maxChanged() {
329
+ if (this.proxy instanceof HTMLInputElement) {
330
+ this.proxy.max = `${this.max}`;
331
+ }
332
+ this.validate();
333
+ }
334
+ stepChanged() {
335
+ if (this.proxy instanceof HTMLInputElement) {
336
+ this.proxy.step = `${this.step}`;
337
+ }
338
+ this.updateStepMultiplier();
339
+ this.validate();
340
+ }
341
+ orientationChanged() {
342
+ if (this.$fastController.isConnected) {
343
+ this.setThumbPositionForOrientation(this.direction);
344
+ }
345
+ }
346
+ /**
347
+ * @internal
348
+ */
349
+ connectedCallback() {
350
+ super.connectedCallback();
351
+ this.proxy.setAttribute("type", "range");
352
+ this.direction = getDirection(this);
353
+ this.updateStepMultiplier();
354
+ this.setupTrackConstraints();
355
+ this.setupListeners();
356
+ this.setupDefaultValue();
357
+ this.setThumbPositionForOrientation(this.direction);
358
+ }
359
+ /**
360
+ * @internal
361
+ */
362
+ disconnectedCallback() {
363
+ this.setupListeners(true);
364
+ }
365
+ /**
366
+ * Increment the value by the step
367
+ *
368
+ * @public
369
+ */
370
+ increment() {
371
+ const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical
372
+ ? Number(this.value) + Number(this.step)
373
+ : Number(this.value) - Number(this.step);
374
+ const incrementedVal = this.convertToConstrainedValue(newVal);
375
+ const incrementedValString = incrementedVal < Number(this.max) ? `${incrementedVal}` : `${this.max}`;
376
+ this.value = incrementedValString;
377
+ }
378
+ /**
379
+ * Decrement the value by the step
380
+ *
381
+ * @public
382
+ */
383
+ decrement() {
384
+ const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical
385
+ ? Number(this.value) - Number(this.step)
386
+ : Number(this.value) + Number(this.step);
387
+ const decrementedVal = this.convertToConstrainedValue(newVal);
388
+ const decrementedValString = decrementedVal > Number(this.min) ? `${decrementedVal}` : `${this.min}`;
389
+ this.value = decrementedValString;
390
+ }
391
+ /**
392
+ * Places the thumb based on the current value
393
+ *
394
+ * @public
395
+ * @param direction - writing mode
396
+ */
397
+ setThumbPositionForOrientation(direction) {
398
+ const newPct = convertPixelToPercent(Number(this.value), Number(this.min), Number(this.max), direction);
399
+ const percentage = (1 - newPct) * 100;
400
+ if (this.orientation === Orientation.horizontal) {
401
+ this.position = this.isDragging
402
+ ? `right: ${percentage}%; transition: none;`
403
+ : `right: ${percentage}%; transition: all 0.2s ease;`;
404
+ }
405
+ else {
406
+ this.position = this.isDragging
407
+ ? `bottom: ${percentage}%; transition: none;`
408
+ : `bottom: ${percentage}%; transition: all 0.2s ease;`;
409
+ }
410
+ }
411
+ /**
412
+ * Update the step multiplier used to ensure rounding errors from steps that
413
+ * are not whole numbers
414
+ */
415
+ updateStepMultiplier() {
416
+ const stepString = this.step + "";
417
+ const decimalPlacesOfStep = !!(this.step % 1)
418
+ ? stepString.length - stepString.indexOf(".") - 1
419
+ : 0;
420
+ this.stepMultiplier = Math.pow(10, decimalPlacesOfStep);
421
+ }
422
+ get midpoint() {
423
+ return `${this.convertToConstrainedValue((this.max + this.min) / 2)}`;
424
+ }
425
+ setupDefaultValue() {
426
+ if (typeof this.value === "string") {
427
+ if (this.value.length === 0) {
428
+ this.initialValue = this.midpoint;
429
+ }
430
+ else {
431
+ const value = parseFloat(this.value);
432
+ if (!Number.isNaN(value) && (value < this.min || value > this.max)) {
433
+ this.value = this.midpoint;
434
+ }
435
+ }
436
+ }
93
437
  }
94
438
  }
95
439
  __decorate([
96
440
  attr({ attribute: "readonly", mode: "boolean" })
97
- ], Switch$1.prototype, "readOnly", void 0);
441
+ ], Slider$1.prototype, "readOnly", void 0);
442
+ __decorate([
443
+ observable
444
+ ], Slider$1.prototype, "direction", void 0);
445
+ __decorate([
446
+ observable
447
+ ], Slider$1.prototype, "isDragging", void 0);
448
+ __decorate([
449
+ observable
450
+ ], Slider$1.prototype, "position", void 0);
451
+ __decorate([
452
+ observable
453
+ ], Slider$1.prototype, "trackWidth", void 0);
454
+ __decorate([
455
+ observable
456
+ ], Slider$1.prototype, "trackMinWidth", void 0);
457
+ __decorate([
458
+ observable
459
+ ], Slider$1.prototype, "trackHeight", void 0);
460
+ __decorate([
461
+ observable
462
+ ], Slider$1.prototype, "trackLeft", void 0);
463
+ __decorate([
464
+ observable
465
+ ], Slider$1.prototype, "trackMinHeight", void 0);
98
466
  __decorate([
99
467
  observable
100
- ], Switch$1.prototype, "defaultSlottedNodes", void 0);
468
+ ], Slider$1.prototype, "valueTextFormatter", void 0);
469
+ __decorate([
470
+ attr({ converter: nullableNumberConverter })
471
+ ], Slider$1.prototype, "min", void 0);
472
+ __decorate([
473
+ attr({ converter: nullableNumberConverter })
474
+ ], Slider$1.prototype, "max", void 0);
475
+ __decorate([
476
+ attr({ converter: nullableNumberConverter })
477
+ ], Slider$1.prototype, "step", void 0);
478
+ __decorate([
479
+ attr
480
+ ], Slider$1.prototype, "orientation", void 0);
481
+ __decorate([
482
+ attr
483
+ ], Slider$1.prototype, "mode", void 0);
484
+
485
+ /**
486
+ * This method keeps a given value within the bounds of a min and max value. If the value
487
+ * is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
488
+ * the maximum will be returned. Otherwise, the value is returned un-changed.
489
+ */
490
+ /**
491
+ * Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
492
+ * If value is greater than max, max will be returned.
493
+ */
494
+ function limit(min, max, value) {
495
+ return Math.min(Math.max(value, min), max);
496
+ }
101
497
 
102
- var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 25 Jul 2023 07:38:24 GMT\n */\n.control {\n display: inline-flex;\n gap: 8px;\n}\n.control.connotation-cta {\n /* @cssprop [--vvd-switch-cta-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-cta-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-switch-cta-primary, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-switch-cta-primary-increment=var(--vvd-color-cta-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-cta-primary-increment, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-switch-cta-backdrop=var(--vvd-color-cta-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-cta-backdrop, var(--vvd-color-cta-50));\n /* @cssprop [--vvd-switch-cta-firm=var(--vvd-color-cta-600)] */\n --_connotation-color-firm: var(--vvd-switch-cta-firm, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-switch-cta-intermediate=var(--vvd-color-cta-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-cta-intermediate, var(--vvd-color-cta-500));\n}\n.control.connotation-alert {\n /* @cssprop [--vvd-switch-alert-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-alert-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-switch-alert-primary, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-switch-alert-primary-increment=var(--vvd-color-alert-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-alert-primary-increment, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-switch-alert-backdrop=var(--vvd-color-alert-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-alert-backdrop, var(--vvd-color-alert-50));\n /* @cssprop [--vvd-switch-alert-firm=var(--vvd-color-alert-600)] */\n --_connotation-color-firm: var(--vvd-switch-alert-firm, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-switch-alert-intermediate=var(--vvd-color-alert-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-alert-intermediate, var(--vvd-color-alert-500));\n}\n.control.connotation-success {\n /* @cssprop [--vvd-switch-success-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-success-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-switch-success-primary, var(--vvd-color-success-500));\n /* @cssprop [--vvd-switch-success-primary-increment=var(--vvd-color-success-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-success-primary-increment, var(--vvd-color-success-600));\n /* @cssprop [--vvd-switch-success-backdrop=var(--vvd-color-success-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-success-backdrop, var(--vvd-color-success-50));\n /* @cssprop [--vvd-switch-success-firm=var(--vvd-color-success-600)] */\n --_connotation-color-firm: var(--vvd-switch-success-firm, var(--vvd-color-success-600));\n /* @cssprop [--vvd-switch-success-intermediate=var(--vvd-color-success-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-success-intermediate, var(--vvd-color-success-500));\n}\n.control:not(.connotation-cta, .connotation-alert, .connotation-success) {\n /* @cssprop [--vvd-switch-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-switch-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-switch-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-switch-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-switch-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-switch-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-switch-accent-firm, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-switch-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-accent-intermediate, var(--vvd-color-neutral-500));\n}\n.control {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.control.appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.control:where(:disabled, .disabled).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: transparent;\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: transparent;\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .control {\n user-select: none;\n }\n}\n.control:not(.disabled) {\n cursor: pointer;\n}\n.control.disabled {\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.switch {\n --_switch-inline-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) * 1.8);\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n border-radius: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / .5);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n inline-size: var(--_switch-inline-size);\n transition: all 0.2s ease-in-out 0s;\n}\n\n.checked-indicator {\n --_switch-checked-indicator-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / 1.6667);\n --_switch-gutter: calc(var(--_switch-checked-indicator-size) / 3);\n block-size: var(--_switch-checked-indicator-size);\n border-radius: inherit;\n inline-size: var(--_switch-checked-indicator-size);\n margin-inline-start: auto;\n transition: all 0.2s ease-in-out 0s;\n}\n.control.appearance-filled .checked-indicator {\n background-color: var(--vvd-color-neutral-100);\n}\n.control:not(.appearance-filled) .checked-indicator {\n background-color: var(--_appearance-color-outline);\n}\n.control:not(.checked) .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-inline-size) + var(--_switch-checked-indicator-size) + var(--_switch-gutter)));\n}\n.control.checked .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-gutter)));\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n cursor: pointer;\n font: var(--vvd-typography-base);\n}\n\n.focus-indicator {\n --focus-inset: -4px;\n --focus-stroke-gap-color: transparent;\n border-radius: 14px;\n}\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}";
498
+ var css_248z = ":host {\n display: inline-block;\n width: 100%;\n}\n\n:host([orientation=vertical]) {\n height: 100%;\n min-height: calc(var(--_thumb-interaction-indicator-size) * 5);\n}\n\n.control {\n --_thumb-size: 12px;\n --_thumb-interaction-indicator-size: 36px;\n height: var(--_thumb-interaction-indicator-size);\n cursor: pointer;\n outline: none;\n user-select: none;\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n.control .positioning-region {\n position: relative;\n}\n.control .track {\n position: absolute;\n background: var(--_track-background-color);\n border-radius: 4px;\n}\n.control .track .track-start {\n position: absolute;\n left: 0;\n height: 100%;\n background: var(--_track-start-background-color);\n border-radius: 4px;\n}\n.control .thumb-container {\n position: absolute;\n width: var(--_thumb-interaction-indicator-size);\n height: var(--_thumb-interaction-indicator-size);\n cursor: inherit;\n touch-action: none;\n}\n.control .thumb-container::before {\n position: absolute;\n display: block;\n width: var(--_thumb-interaction-indicator-size);\n height: var(--_thumb-interaction-indicator-size);\n background-color: var(--_track-start-background-color);\n border-radius: 50%;\n content: \"\";\n opacity: var(--_thumb-interaction-indicator-alpha, 0);\n transition: opacity 0.2s ease-out 0s;\n}\n.control .thumb-container::after {\n position: absolute;\n display: block;\n width: var(--_thumb-size);\n height: var(--_thumb-size);\n background-color: var(--_track-start-background-color);\n border-radius: 50%;\n content: \"\";\n inset: calc((var(--_thumb-interaction-indicator-size) - var(--_thumb-size)) / 2);\n}\n.control[aria-orientation=horizontal] {\n width: calc(100% - var(--_thumb-size));\n min-width: var(--_thumb-size);\n margin-left: calc(var(--_thumb-size) / 2);\n}\n.control[aria-orientation=horizontal] .track {\n top: calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);\n right: 0;\n left: 0;\n height: 2px;\n}\n.control[aria-orientation=horizontal] .track .mark {\n width: 100%;\n height: 4px;\n}\n.control[aria-orientation=horizontal] .thumb-container {\n transform: translateX(calc(var(--_thumb-interaction-indicator-size) / 2));\n}\n.control[aria-orientation=vertical] {\n height: calc(100% - var(--_thumb-interaction-indicator-size));\n min-height: var(--_thumb-interaction-indicator-size);\n margin-top: calc(var(--_thumb-interaction-indicator-size) / 2);\n}\n.control[aria-orientation=vertical] .positioning-region {\n height: 100%;\n}\n.control[aria-orientation=vertical] .track {\n left: calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);\n width: 2px;\n height: 100%;\n}\n.control[aria-orientation=vertical] .track .mark {\n width: 4px;\n height: 100%;\n}\n.control[aria-orientation=vertical] .track-start {\n top: 0;\n width: 100%;\n height: auto;\n}\n.control[aria-orientation=vertical] .thumb-container {\n transform: translateY(calc(var(--_thumb-interaction-indicator-size) / 2));\n}\n.control.disabled {\n --_track-background-color: var(--vvd-color-neutral-100);\n --_track-start-background-color: var(--vvd-color-neutral-500);\n cursor: not-allowed;\n pointer-events: none;\n}\n.control:not(.disabled) {\n --_track-background-color: var(--vvd-color-neutral-300);\n --_track-start-background-color: var(--vvd-color-canvas-text);\n}\n.control:not(.disabled) .thumb-container:hover {\n --_thumb-interaction-indicator-alpha: 0.12;\n}\n.control:not(.disabled) .thumb-container:active {\n --_thumb-interaction-indicator-alpha: 0.25;\n}\n\n.focus-indicator {\n --focus-inset: -3px;\n --focus-stroke-gap-color: transparent;\n border-radius: 50%;\n}\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}";
103
499
 
104
- class Switch extends Switch$1 {}
105
- __decorate([attr, __metadata("design:type", String)], Switch.prototype, "label", void 0);
106
- __decorate([attr, __metadata("design:type", String)], Switch.prototype, "connotation", void 0);
500
+ class Slider extends Slider$1 {
501
+ constructor() {
502
+ super(...arguments);
503
+ this.markers = false;
504
+ }
505
+ valueChanged(previous, next) {
506
+ if (this.$fastController.isConnected) {
507
+ const nextAsNumber = parseFloat(next);
508
+ const value = limit(this.min, this.max, this['convertToConstrainedValue'](nextAsNumber)).toString();
509
+ if (value !== next) {
510
+ this.value = value;
511
+ return;
512
+ }
513
+ super.valueChanged(previous, value);
514
+ }
515
+ }
516
+ }
517
+ __decorate([attr({
518
+ mode: 'boolean'
519
+ }), __metadata("design:type", Object)], Slider.prototype, "markers", void 0);
107
520
 
108
- let _2 = t => t,
109
- _t,
110
- _t2;
111
- const getClasses = _ => classNames('control', ['appearance-filled', _.checked && !_.disabled && !_.readOnly], ['checked', _.checked], ['disabled', _.disabled], ['readonly', _.readOnly], [`connotation-${_.connotation}`, Boolean(_.checked) && Boolean(_.connotation)]);
112
- const SwitchTemplate = context => {
521
+ const getClasses = ({
522
+ disabled
523
+ }) => classNames('control', ['disabled', Boolean(disabled)]);
524
+ const getMarkersTemplate = (isHorizontal, numMarkers) => {
525
+ const placeholder = isHorizontal ? ['right', 'center', '', '100% repeat-x'] : ['bottom', 'top', '100%', 'repeat-y'];
526
+ return html`
527
+ <div class="mark" style="
528
+ background: linear-gradient(to ${placeholder[0]}, currentcolor 3px, transparent 0px)
529
+ 0px ${placeholder[1]} / ${placeholder[2]} calc((100% - 3px) / ${numMarkers}) ${placeholder[3]}
530
+ "></div>`;
531
+ };
532
+ const SliderTemplate = context => {
113
533
  const focusTemplate = focusTemplateFactory(context);
114
- return html(_t || (_t = _2`
115
- <div
116
- class="${0}"
117
- role="switch"
118
- aria-checked="${0}"
119
- aria-disabled="${0}"
120
- aria-readonly="${0}"
121
- tabindex="${0}"
122
- @keypress="${0}"
123
- @click="${0}"
124
- >
125
- <div class="switch">
126
- <span class="checked-indicator"></span>
127
- ${0}
534
+ return html`
535
+ <div
536
+ role="slider"
537
+ tabindex="${x => x.disabled ? null : 0}"
538
+ aria-valuetext="${x => x.valueTextFormatter(x.value)}"
539
+ aria-valuenow="${x => x.value}"
540
+ aria-valuemin="${x => x.min}"
541
+ aria-valuemax="${x => x.max}"
542
+ aria-disabled="${x => x.disabled ? true : void 0}"
543
+ aria-orientation="${x => x.orientation}"
544
+ class="${getClasses} ${x => x.orientation}"
545
+ >
546
+ <div class="positioning-region">
547
+ <div ${ref('track')} class="track">
548
+ <div class="track-start" style="${x => x.position}"></div>
549
+ ${x => x.markers ? getMarkersTemplate(x.orientation === Orientation$1.horizontal, Math.floor((x.max - x.min) / x.step)) : void 0}
550
+ </div>
551
+ <div ${ref('thumb')} class="thumb-container" style="${x => x.position}">
552
+ ${() => focusTemplate}
128
553
  </div>
129
- ${0}
130
554
  </div>
131
- `), getClasses, x => x.checked, x => x.disabled, x => x.readOnly, x => x.disabled ? null : 0, (x, c) => x.keypressHandler(c.event), (x, c) => x.clickHandler(c.event), () => focusTemplate, when(x => x.label, html(_t2 || (_t2 = _2`<div class="label">
132
- ${0}
133
- </div>`), x => x.label)));
555
+ </div>`;
134
556
  };
135
557
 
136
- const switchDefinition = Switch.compose({
137
- baseName: 'switch',
138
- template: SwitchTemplate,
139
- styles: css_248z,
140
- shadowOptions: {
141
- delegatesFocus: true
142
- }
558
+ const sliderDefinition = Slider.compose({
559
+ baseName: 'slider',
560
+ template: SliderTemplate,
561
+ styles: css_248z
143
562
  });
144
- const switchRegistries = [switchDefinition(), ...iconRegistries, ...focusRegistries];
145
- const registerSwitch = registerFactory(switchRegistries);
563
+ const sliderRegistries = [sliderDefinition(), ...focusRegistries];
564
+ const registerSlider = registerFactory(sliderRegistries);
146
565
 
147
- export { switchRegistries as a, registerSwitch as r, switchDefinition as s };
566
+ export { sliderRegistries as a, registerSlider as r, sliderDefinition as s };