@mcp-b/web-components 0.2.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 (366) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +49 -0
  3. package/dist/accordion-B1Q3kuP_.d.ts +373 -0
  4. package/dist/accordion-item-DvPfhpm8.js +307 -0
  5. package/dist/accordion-item-bPRIahNn.d.ts +63 -0
  6. package/dist/accordion-zDr-Br4V.js +483 -0
  7. package/dist/action-bar-CYsjmhwP.d.ts +29 -0
  8. package/dist/action-bar-CjN_UcnP.js +56 -0
  9. package/dist/alert-dialog-4CnO3Nb5.d.ts +60 -0
  10. package/dist/alert-dialog-D25Oi_TS.js +126 -0
  11. package/dist/avatar-Bje_KpZo.d.ts +141 -0
  12. package/dist/avatar-CRP0kW3x.js +224 -0
  13. package/dist/badge-Ct95U4UO.js +301 -0
  14. package/dist/badge-D1DNQrWn.d.ts +106 -0
  15. package/dist/breadcrumb-BxZ-nQE5.d.ts +365 -0
  16. package/dist/breadcrumb-item-BC454oQe.d.ts +59 -0
  17. package/dist/breadcrumb-item-P5pdq_gE.js +151 -0
  18. package/dist/breadcrumb-uURhiqWJ.js +384 -0
  19. package/dist/button-5k_aL_gD.js +802 -0
  20. package/dist/button-BQofnUt4.d.ts +354 -0
  21. package/dist/button-group-BydvJTQy.js +197 -0
  22. package/dist/button-group-COodHeuB.d.ts +155 -0
  23. package/dist/callout-B8zTf8Go.js +188 -0
  24. package/dist/callout-DFwPao36.d.ts +103 -0
  25. package/dist/card-BYDzdMAU.d.ts +177 -0
  26. package/dist/card-DIg1-X2G.js +332 -0
  27. package/dist/carousel-Bktu7wrD.js +843 -0
  28. package/dist/carousel-DQITCtEY.d.ts +423 -0
  29. package/dist/carousel-item-B5-X31Ha.js +79 -0
  30. package/dist/carousel-item-BB3jL2tk.d.ts +34 -0
  31. package/dist/cdn/loader.js +530 -0
  32. package/dist/checkbox-D6r7PVPj.js +641 -0
  33. package/dist/checkbox-DoFcDEKB.d.ts +354 -0
  34. package/dist/checkbox-group-CLvNAO_F.js +201 -0
  35. package/dist/checkbox-group-Cnh8rAn4.d.ts +152 -0
  36. package/dist/color-input-Bky89xg_.d.ts +470 -0
  37. package/dist/color-input-DPIxi9wR.js +894 -0
  38. package/dist/color-picker-adwOmtRl.js +1240 -0
  39. package/dist/color-picker-wQw8bPsq.d.ts +360 -0
  40. package/dist/combobox-B6al50UG.js +1693 -0
  41. package/dist/combobox-item-D2H1CMxC.d.ts +714 -0
  42. package/dist/combobox-item-yM6tDrGG.js +225 -0
  43. package/dist/comparison-B1-nMwmp.d.ts +134 -0
  44. package/dist/comparison-CyqKrCN-.js +435 -0
  45. package/dist/components/accordion/accordion.d.ts +2 -0
  46. package/dist/components/accordion/accordion.js +2 -0
  47. package/dist/components/accordion-item/accordion-item.d.ts +2 -0
  48. package/dist/components/accordion-item/accordion-item.js +2 -0
  49. package/dist/components/action-bar/action-bar.d.ts +2 -0
  50. package/dist/components/action-bar/action-bar.js +2 -0
  51. package/dist/components/alert-dialog/alert-dialog.d.ts +2 -0
  52. package/dist/components/alert-dialog/alert-dialog.js +2 -0
  53. package/dist/components/avatar/avatar.d.ts +2 -0
  54. package/dist/components/avatar/avatar.js +2 -0
  55. package/dist/components/badge/badge.d.ts +2 -0
  56. package/dist/components/badge/badge.js +2 -0
  57. package/dist/components/breadcrumb/breadcrumb.d.ts +2 -0
  58. package/dist/components/breadcrumb/breadcrumb.js +2 -0
  59. package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +2 -0
  60. package/dist/components/breadcrumb-item/breadcrumb-item.js +2 -0
  61. package/dist/components/button/button.d.ts +2 -0
  62. package/dist/components/button/button.js +2 -0
  63. package/dist/components/button-group/button-group.d.ts +2 -0
  64. package/dist/components/button-group/button-group.js +2 -0
  65. package/dist/components/callout/callout.d.ts +2 -0
  66. package/dist/components/callout/callout.js +2 -0
  67. package/dist/components/card/card.d.ts +2 -0
  68. package/dist/components/card/card.js +2 -0
  69. package/dist/components/carousel/carousel.d.ts +2 -0
  70. package/dist/components/carousel/carousel.js +2 -0
  71. package/dist/components/carousel-item/carousel-item.d.ts +2 -0
  72. package/dist/components/carousel-item/carousel-item.js +2 -0
  73. package/dist/components/checkbox/checkbox.d.ts +2 -0
  74. package/dist/components/checkbox/checkbox.js +2 -0
  75. package/dist/components/checkbox-group/checkbox-group.d.ts +2 -0
  76. package/dist/components/checkbox-group/checkbox-group.js +2 -0
  77. package/dist/components/color-input/color-input.d.ts +2 -0
  78. package/dist/components/color-input/color-input.js +2 -0
  79. package/dist/components/color-picker/color-picker.d.ts +2 -0
  80. package/dist/components/color-picker/color-picker.js +2 -0
  81. package/dist/components/combobox/combobox.d.ts +2 -0
  82. package/dist/components/combobox/combobox.js +2 -0
  83. package/dist/components/combobox-item/combobox-item.d.ts +2 -0
  84. package/dist/components/combobox-item/combobox-item.js +2 -0
  85. package/dist/components/comparison/comparison.d.ts +2 -0
  86. package/dist/components/comparison/comparison.js +2 -0
  87. package/dist/components/copy/copy.d.ts +2 -0
  88. package/dist/components/copy/copy.js +291 -0
  89. package/dist/components/data-table/data-table.d.ts +2 -0
  90. package/dist/components/data-table/data-table.js +2 -0
  91. package/dist/components/date/date.d.ts +2 -0
  92. package/dist/components/date/date.js +2 -0
  93. package/dist/components/dialog/dialog.d.ts +2 -0
  94. package/dist/components/dialog/dialog.js +2 -0
  95. package/dist/components/divider/divider.d.ts +2 -0
  96. package/dist/components/divider/divider.js +2 -0
  97. package/dist/components/dropdown/dropdown.d.ts +2 -0
  98. package/dist/components/dropdown/dropdown.js +2 -0
  99. package/dist/components/dropdown-item/dropdown-item.d.ts +2 -0
  100. package/dist/components/dropdown-item/dropdown-item.js +2 -0
  101. package/dist/components/empty-result/empty-result.d.ts +2 -0
  102. package/dist/components/empty-result/empty-result.js +2 -0
  103. package/dist/components/empty-state/empty-state.d.ts +2 -0
  104. package/dist/components/empty-state/empty-state.js +2 -0
  105. package/dist/components/expander/expander.d.ts +2 -0
  106. package/dist/components/expander/expander.js +2 -0
  107. package/dist/components/field/field.d.ts +2 -0
  108. package/dist/components/field/field.js +2 -0
  109. package/dist/components/file-input/file-input.d.ts +2 -0
  110. package/dist/components/file-input/file-input.js +2 -0
  111. package/dist/components/filter-bar/filter-bar.d.ts +2 -0
  112. package/dist/components/filter-bar/filter-bar.js +2 -0
  113. package/dist/components/form-section/form-section.d.ts +2 -0
  114. package/dist/components/form-section/form-section.js +2 -0
  115. package/dist/components/icon/icon.d.ts +2 -0
  116. package/dist/components/icon/icon.js +2 -0
  117. package/dist/components/include/include.d.ts +2 -0
  118. package/dist/components/include/include.js +2 -0
  119. package/dist/components/index.d.ts +85 -0
  120. package/dist/components/index.js +86 -0
  121. package/dist/components/infinite-scroller/infinite-scroller.d.ts +2 -0
  122. package/dist/components/infinite-scroller/infinite-scroller.js +2 -0
  123. package/dist/components/intersection-observer/intersection-observer.d.ts +2 -0
  124. package/dist/components/intersection-observer/intersection-observer.js +2 -0
  125. package/dist/components/listbox/listbox.d.ts +2 -0
  126. package/dist/components/listbox/listbox.js +2 -0
  127. package/dist/components/listbox-item/listbox-item.d.ts +2 -0
  128. package/dist/components/listbox-item/listbox-item.js +2 -0
  129. package/dist/components/lorem-ipsum/lorem-ipsum.d.ts +2 -0
  130. package/dist/components/lorem-ipsum/lorem-ipsum.js +2 -0
  131. package/dist/components/meter/meter.d.ts +2 -0
  132. package/dist/components/meter/meter.js +2 -0
  133. package/dist/components/metric/metric.d.ts +2 -0
  134. package/dist/components/metric/metric.js +2 -0
  135. package/dist/components/metric-grid/metric-grid.d.ts +2 -0
  136. package/dist/components/metric-grid/metric-grid.js +2 -0
  137. package/dist/components/mutation-observer/mutation-observer.d.ts +2 -0
  138. package/dist/components/mutation-observer/mutation-observer.js +2 -0
  139. package/dist/components/navicon/navicon.d.ts +2 -0
  140. package/dist/components/navicon/navicon.js +2 -0
  141. package/dist/components/number/number.d.ts +2 -0
  142. package/dist/components/number/number.js +2 -0
  143. package/dist/components/number-field/number-field.d.ts +2 -0
  144. package/dist/components/number-field/number-field.js +2 -0
  145. package/dist/components/pagination/pagination.d.ts +2 -0
  146. package/dist/components/pagination/pagination.js +2 -0
  147. package/dist/components/popover/popover.d.ts +2 -0
  148. package/dist/components/popover/popover.js +2 -0
  149. package/dist/components/preview-card/preview-card.d.ts +2 -0
  150. package/dist/components/preview-card/preview-card.js +2 -0
  151. package/dist/components/progress/progress.d.ts +2 -0
  152. package/dist/components/progress/progress.js +2 -0
  153. package/dist/components/radio/radio.d.ts +2 -0
  154. package/dist/components/radio/radio.js +2 -0
  155. package/dist/components/radio-item/radio-item.d.ts +2 -0
  156. package/dist/components/radio-item/radio-item.js +2 -0
  157. package/dist/components/random-content/random-content.d.ts +2 -0
  158. package/dist/components/random-content/random-content.js +2 -0
  159. package/dist/components/rating/rating.d.ts +2 -0
  160. package/dist/components/rating/rating.js +2 -0
  161. package/dist/components/resize-observer/resize-observer.d.ts +2 -0
  162. package/dist/components/resize-observer/resize-observer.js +2 -0
  163. package/dist/components/scroll-area/scroll-area.d.ts +2 -0
  164. package/dist/components/scroll-area/scroll-area.js +2 -0
  165. package/dist/components/scroller/scroller.d.ts +2 -0
  166. package/dist/components/scroller/scroller.js +2 -0
  167. package/dist/components/search-list/search-list.d.ts +2 -0
  168. package/dist/components/search-list/search-list.js +2 -0
  169. package/dist/components/select/select.d.ts +2 -0
  170. package/dist/components/select/select.js +2 -0
  171. package/dist/components/selection-summary/selection-summary.d.ts +2 -0
  172. package/dist/components/selection-summary/selection-summary.js +2 -0
  173. package/dist/components/share/share.d.ts +2 -0
  174. package/dist/components/share/share.js +2 -0
  175. package/dist/components/slide-activator/slide-activator.d.ts +2 -0
  176. package/dist/components/slide-activator/slide-activator.js +2 -0
  177. package/dist/components/slider/slider.d.ts +2 -0
  178. package/dist/components/slider/slider.js +2 -0
  179. package/dist/components/sparkline/sparkline.d.ts +2 -0
  180. package/dist/components/sparkline/sparkline.js +2 -0
  181. package/dist/components/spinner/spinner.d.ts +2 -0
  182. package/dist/components/spinner/spinner.js +2 -0
  183. package/dist/components/splitter/splitter.d.ts +2 -0
  184. package/dist/components/splitter/splitter.js +2 -0
  185. package/dist/components/switch/switch.d.ts +2 -0
  186. package/dist/components/switch/switch.js +2 -0
  187. package/dist/components/tab/tab.d.ts +2 -0
  188. package/dist/components/tab/tab.js +2 -0
  189. package/dist/components/tab-list/tab-list.d.ts +2 -0
  190. package/dist/components/tab-list/tab-list.js +2 -0
  191. package/dist/components/tab-panel/tab-panel.d.ts +2 -0
  192. package/dist/components/tab-panel/tab-panel.js +2 -0
  193. package/dist/components/text-area/text-area.d.ts +2 -0
  194. package/dist/components/text-area/text-area.js +2 -0
  195. package/dist/components/text-field/text-field.d.ts +2 -0
  196. package/dist/components/text-field/text-field.js +2 -0
  197. package/dist/components/text-mask/text-mask.d.ts +2 -0
  198. package/dist/components/text-mask/text-mask.js +2 -0
  199. package/dist/components/timed-content/timed-content.d.ts +2 -0
  200. package/dist/components/timed-content/timed-content.js +2 -0
  201. package/dist/components/toast/toast.d.ts +2 -0
  202. package/dist/components/toast/toast.js +2 -0
  203. package/dist/components/toast-item/toast-item.d.ts +2 -0
  204. package/dist/components/toast-item/toast-item.js +2 -0
  205. package/dist/components/toggle-icon/toggle-icon.d.ts +2 -0
  206. package/dist/components/toggle-icon/toggle-icon.js +2 -0
  207. package/dist/components/toggle-tag/toggle-tag.d.ts +2 -0
  208. package/dist/components/toggle-tag/toggle-tag.js +2 -0
  209. package/dist/components/toolbar/toolbar.d.ts +2 -0
  210. package/dist/components/toolbar/toolbar.js +2 -0
  211. package/dist/components/tooltip/tooltip.d.ts +2 -0
  212. package/dist/components/tooltip/tooltip.js +2 -0
  213. package/dist/components/transition-group/transition-group.d.ts +2 -0
  214. package/dist/components/transition-group/transition-group.js +2 -0
  215. package/dist/components/zoomable-frame/zoomable-frame.d.ts +2 -0
  216. package/dist/components/zoomable-frame/zoomable-frame.js +2 -0
  217. package/dist/copy-CvC9vaGw.d.ts +206 -0
  218. package/dist/copy.styles-DWGvGNTP.js +100 -0
  219. package/dist/data-table-CITa8DSn.js +247 -0
  220. package/dist/data-table-DL5RhE0d.d.ts +89 -0
  221. package/dist/date-CJPmOdi9.js +146 -0
  222. package/dist/date-DtaTBM71.d.ts +142 -0
  223. package/dist/decorate-DcF3lt7P.js +9 -0
  224. package/dist/dialog-Cx46HMaZ.js +983 -0
  225. package/dist/dialog-N-v0woIy.d.ts +414 -0
  226. package/dist/divider-9vNsfHW8.js +169 -0
  227. package/dist/divider-DWuAxcXv.d.ts +79 -0
  228. package/dist/docs/custom-elements.json +29301 -0
  229. package/dist/dropdown-BXSKpVX9.js +1123 -0
  230. package/dist/dropdown-Bo00Vlr5.d.ts +537 -0
  231. package/dist/dropdown-item-_lIs-Tfd.d.ts +111 -0
  232. package/dist/dropdown-item-i77cRuN6.js +504 -0
  233. package/dist/empty-result-B2ln1yFL.js +65 -0
  234. package/dist/empty-result-B54x_Ab2.d.ts +31 -0
  235. package/dist/empty-state-BLWjtKUo.js +186 -0
  236. package/dist/empty-state-SGKjpwp3.d.ts +117 -0
  237. package/dist/expander-BUev0BmM.d.ts +174 -0
  238. package/dist/expander-Bwvxj6Oa.js +342 -0
  239. package/dist/field-BEyS909F.js +163 -0
  240. package/dist/field-ITx0jVw-.d.ts +69 -0
  241. package/dist/file-input-BEumLJjg.js +841 -0
  242. package/dist/file-input-D2D6YC0B.d.ts +378 -0
  243. package/dist/filter-bar-Bj2QzEn9.d.ts +35 -0
  244. package/dist/filter-bar-Dcs67aXo.js +66 -0
  245. package/dist/form-section-BchPetkj.js +83 -0
  246. package/dist/form-section-xFBTBULQ.d.ts +34 -0
  247. package/dist/icon-BPVkNsY4.js +165 -0
  248. package/dist/icon-Ci9CPZJV.d.ts +72 -0
  249. package/dist/icon-library-D_if7p2h.d.ts +2 -0
  250. package/dist/include-CQHVVtNs.d.ts +103 -0
  251. package/dist/include-qNUh_6kT.js +155 -0
  252. package/dist/index.d.ts +89 -0
  253. package/dist/index.js +92 -0
  254. package/dist/infinite-scroller-BmmtnWNt.js +285 -0
  255. package/dist/infinite-scroller-CuUEAlB9.d.ts +174 -0
  256. package/dist/intersection-observer-B6TciOAQ.js +503 -0
  257. package/dist/intersection-observer-B7nmP7Zz.d.ts +418 -0
  258. package/dist/listbox-C3XXRWGX.js +1257 -0
  259. package/dist/listbox-DD4ujIJe.d.ts +682 -0
  260. package/dist/listbox-item-CwD9s3VY.js +135 -0
  261. package/dist/listbox-item-DQEJWp4Z.d.ts +53 -0
  262. package/dist/localize-322EtXNX.d.ts +66 -0
  263. package/dist/lorem-ipsum-B2x3V-v8.js +198 -0
  264. package/dist/lorem-ipsum-CR82CSuJ.d.ts +130 -0
  265. package/dist/meter-BC7uaJWf.d.ts +73 -0
  266. package/dist/meter-BIDyjwFp.js +155 -0
  267. package/dist/metric-CjlLq_VA.d.ts +36 -0
  268. package/dist/metric-DbuOcDp_.js +86 -0
  269. package/dist/metric-grid-C2Pb0Zl3.js +37 -0
  270. package/dist/metric-grid-C5Xbb1_0.d.ts +27 -0
  271. package/dist/mutation-observer-BmrZ-GER.d.ts +326 -0
  272. package/dist/mutation-observer-DS8EBuOp.js +388 -0
  273. package/dist/navicon-Dic5Qjzb.d.ts +159 -0
  274. package/dist/navicon-_yMHY27-.js +486 -0
  275. package/dist/number-BNtNXNF3.js +162 -0
  276. package/dist/number-BwbnErlB.d.ts +143 -0
  277. package/dist/number-field-BQHB7UYo.js +726 -0
  278. package/dist/number-field-odk4lKXM.d.ts +422 -0
  279. package/dist/pagination-6z2qcf3U.d.ts +322 -0
  280. package/dist/pagination-DuKPuzdb.js +679 -0
  281. package/dist/popover-D0sxTU6o.d.ts +259 -0
  282. package/dist/popover-DJBrJ0za.js +556 -0
  283. package/dist/preview-card-C7H1FPfd.js +287 -0
  284. package/dist/preview-card-DitOCZTD.d.ts +86 -0
  285. package/dist/progress-Db0_axHQ.d.ts +181 -0
  286. package/dist/progress-DzVk260j.js +494 -0
  287. package/dist/radio-BtDG9xJM.js +658 -0
  288. package/dist/radio-CieMa4zU.d.ts +460 -0
  289. package/dist/radio-item-DIrUStAX.js +264 -0
  290. package/dist/radio-item-Xq2U3cMu.d.ts +69 -0
  291. package/dist/random-content-BhSeJFKz.d.ts +380 -0
  292. package/dist/random-content-BwiirXdG.js +450 -0
  293. package/dist/rating-4xNsWumY.d.ts +369 -0
  294. package/dist/rating-C1BcJDIO.js +722 -0
  295. package/dist/resize-observer-BseSbVWP.d.ts +187 -0
  296. package/dist/resize-observer-DcrLhddo.js +236 -0
  297. package/dist/scroll-area-COc1857S.js +127 -0
  298. package/dist/scroll-area-CVYDf5qY.d.ts +61 -0
  299. package/dist/scroller-LYgBVyfY.js +590 -0
  300. package/dist/scroller-bB2rGs7b.d.ts +374 -0
  301. package/dist/search-list-Clmrg8EV.js +884 -0
  302. package/dist/search-list-n0GYO7rh.d.ts +777 -0
  303. package/dist/select-CkZK2jJn.d.ts +506 -0
  304. package/dist/select-DLIaRnA4.js +690 -0
  305. package/dist/selection-summary-BVnNJ8Lw.js +48 -0
  306. package/dist/selection-summary-DmFkGyZI.d.ts +34 -0
  307. package/dist/share-DPlqP2dc.d.ts +162 -0
  308. package/dist/share-bsgXZCl7.js +250 -0
  309. package/dist/sigvelo.d.ts +5 -0
  310. package/dist/sigvelo.js +5 -0
  311. package/dist/sigvelo.loader.d.ts +3 -0
  312. package/dist/sigvelo.loader.js +102 -0
  313. package/dist/slide-activator-D7bBz69E.d.ts +429 -0
  314. package/dist/slide-activator-DlxQt9R9.js +798 -0
  315. package/dist/slider-B0FVsV1o.d.ts +921 -0
  316. package/dist/slider-B90Il7x3.js +1744 -0
  317. package/dist/sparkline-CcpTaJ_Z.js +358 -0
  318. package/dist/sparkline-DlCIt81-.d.ts +235 -0
  319. package/dist/spinner-C04Dmc0H.js +188 -0
  320. package/dist/spinner-CZ19x_dC.d.ts +99 -0
  321. package/dist/splitter-DBDJAzsp.d.ts +325 -0
  322. package/dist/splitter-MnD4In9H.js +638 -0
  323. package/dist/switch-CPaEKbog.js +581 -0
  324. package/dist/switch-Cief9M59.d.ts +248 -0
  325. package/dist/tab-BcqYGsuW.d.ts +44 -0
  326. package/dist/tab-C-FtuNmh.js +102 -0
  327. package/dist/tab-list-B_Ye_Oj9.js +691 -0
  328. package/dist/tab-list-DDvS8qHr.d.ts +450 -0
  329. package/dist/tab-panel-BaBl6eep.js +60 -0
  330. package/dist/tab-panel-BzSJlSfd.d.ts +38 -0
  331. package/dist/text-area-B_mjCE9W.d.ts +327 -0
  332. package/dist/text-area-Czixaz-_.js +556 -0
  333. package/dist/text-field-BClWMp6q.d.ts +424 -0
  334. package/dist/text-field-inpJfp0A.js +687 -0
  335. package/dist/text-mask-CNKVKSFp.d.ts +336 -0
  336. package/dist/text-mask-DDEurj90.js +370 -0
  337. package/dist/themes/sigvelo.css +10 -0
  338. package/dist/themes/utilities.css +9 -0
  339. package/dist/timed-content-D2mGFamc.d.ts +181 -0
  340. package/dist/timed-content-pvEP4l5V.js +226 -0
  341. package/dist/toast-BnZaIg6Z.js +636 -0
  342. package/dist/toast-cEBVK9NQ.d.ts +487 -0
  343. package/dist/toast-item-BPpJT6vD.d.ts +159 -0
  344. package/dist/toast-item-IS8IFUEg.js +372 -0
  345. package/dist/toggle-icon-4oLDeEt4.js +752 -0
  346. package/dist/toggle-icon-DlwMMWZL.d.ts +359 -0
  347. package/dist/toggle-tag-1sfTFJtg.js +434 -0
  348. package/dist/toggle-tag-IVvMGT4R.d.ts +245 -0
  349. package/dist/toolbar-CABq0ZL1.d.ts +122 -0
  350. package/dist/toolbar-CEZ0-F-X.js +196 -0
  351. package/dist/tooltip-DbyoPFNe.js +521 -0
  352. package/dist/tooltip-ahFthek8.d.ts +192 -0
  353. package/dist/transition-group-3hnAnwSd.js +801 -0
  354. package/dist/transition-group-DD_CjSNC.d.ts +608 -0
  355. package/dist/translations/en.d.ts +6 -0
  356. package/dist/translations/en.js +75 -0
  357. package/dist/translations/es.d.ts +6 -0
  358. package/dist/translations/es.js +75 -0
  359. package/dist/types/custom-element-jsx.d.ts +13723 -0
  360. package/dist/utilities/icon-library.d.ts +3 -0
  361. package/dist/utilities/icon-library.js +93 -0
  362. package/dist/utilities/localize.d.ts +2 -0
  363. package/dist/utilities/localize.js +6 -0
  364. package/dist/zoomable-frame-Cldvj5sE.js +398 -0
  365. package/dist/zoomable-frame-r6S6587z.d.ts +162 -0
  366. package/package.json +83 -0
@@ -0,0 +1,1744 @@
1
+ import { Localize } from "./utilities/localize.js";
2
+ import { t as __decorate } from "./decorate-DcF3lt7P.js";
3
+ import "./tooltip-DbyoPFNe.js";
4
+ import { css, html } from "lit";
5
+ import { property, query, state } from "lit/decorators.js";
6
+ import hostStyles from "@mcp-b/wc-support/styles/host.styles";
7
+ import { SigveloFormControlElement } from "@mcp-b/wc-support/base/sigvelo-element";
8
+ import { classMap } from "lit/directives/class-map.js";
9
+ import { SigveloBlurEvent, SigveloChangeEvent, SigveloFocusEvent, SigveloInputEvent } from "@mcp-b/wc-support/events/form";
10
+ import formControlStyles from "@mcp-b/wc-support/styles/form-control.styles";
11
+ import { DraggableElement } from "@mcp-b/wc-support/utilities/drag";
12
+ import { clamp } from "@mcp-b/wc-support/utilities/math";
13
+ //#region src/components/slider/slider.styles.ts
14
+ var slider_styles_default = css`
15
+ :host {
16
+ --track-size: 0.5em;
17
+ --thumb-width: 1.4em;
18
+ --thumb-height: 1.4em;
19
+ --marker-width: 0.1875em;
20
+ --marker-height: 0.1875em;
21
+ }
22
+
23
+ :host([orientation="vertical"]) {
24
+ width: auto;
25
+ }
26
+
27
+ #label:has(~ .vertical) {
28
+ display: block;
29
+ order: 2;
30
+ max-width: none;
31
+ text-align: center;
32
+ }
33
+
34
+ #description:has(~ .vertical) {
35
+ order: 3;
36
+ text-align: center;
37
+ }
38
+
39
+ #slider {
40
+ touch-action: none;
41
+
42
+ /* Orientation */
43
+ &.horizontal {
44
+ margin-block-start: 0.5em;
45
+ }
46
+
47
+ &.vertical {
48
+ margin-block-end: 0.5em;
49
+ }
50
+
51
+ &:focus {
52
+ outline: none;
53
+ }
54
+
55
+ &:focus-visible:not(.disabled) #thumb,
56
+ &:focus-visible:not(.disabled) #thumb-min,
57
+ &:focus-visible:not(.disabled) #thumb-max {
58
+ outline: var(--sigvelo-focus-ring);
59
+ /* intentionally no offset due to border */
60
+ }
61
+ }
62
+
63
+ #track {
64
+ position: relative;
65
+ border-radius: var(--sigvelo-radius-full);
66
+ background: var(--sigvelo-color-neutral-bg-muted);
67
+ isolation: isolate;
68
+ }
69
+
70
+ /* Orientation */
71
+ .horizontal #track {
72
+ height: var(--track-size);
73
+ }
74
+
75
+ .vertical #track {
76
+ order: 1;
77
+ width: var(--track-size);
78
+ height: 200px;
79
+ }
80
+
81
+ /* Disabled */
82
+ .disabled #track {
83
+ cursor: not-allowed;
84
+ opacity: 0.5;
85
+ }
86
+
87
+ /* Indicator */
88
+ #indicator {
89
+ position: absolute;
90
+ border-radius: inherit;
91
+ background-color: var(--sigvelo-color-primary-bg);
92
+
93
+ &:dir(ltr) {
94
+ right: calc(100% - max(var(--start), var(--end)));
95
+ left: min(var(--start), var(--end));
96
+ }
97
+
98
+ &:dir(rtl) {
99
+ right: min(var(--start), var(--end));
100
+ left: calc(100% - max(var(--start), var(--end)));
101
+ }
102
+ }
103
+
104
+ .horizontal #indicator {
105
+ top: 0;
106
+ height: 100%;
107
+ }
108
+
109
+ .vertical #indicator {
110
+ top: calc(100% - var(--end));
111
+ bottom: var(--start);
112
+ left: 0;
113
+ width: 100%;
114
+ }
115
+
116
+ /* Thumbs */
117
+ #thumb,
118
+ #thumb-min,
119
+ #thumb-max {
120
+ z-index: 3;
121
+ position: absolute;
122
+ width: var(--thumb-width);
123
+ height: var(--thumb-height);
124
+ border: solid 0.125em var(--sigvelo-color-canvas);
125
+ border-radius: var(--sigvelo-radius-circle);
126
+ background-color: var(--sigvelo-color-primary-bg);
127
+ cursor: pointer;
128
+ }
129
+
130
+ .disabled #thumb,
131
+ .disabled #thumb-min,
132
+ .disabled #thumb-max {
133
+ cursor: inherit;
134
+ }
135
+
136
+ .horizontal #thumb,
137
+ .horizontal #thumb-min,
138
+ .horizontal #thumb-max {
139
+ top: calc(50% - var(--thumb-height) / 2);
140
+
141
+ &:dir(ltr) {
142
+ right: auto;
143
+ left: calc(var(--position) - var(--thumb-width) / 2);
144
+ }
145
+
146
+ &:dir(rtl) {
147
+ right: calc(var(--position) - var(--thumb-width) / 2);
148
+ left: auto;
149
+ }
150
+ }
151
+
152
+ .vertical #thumb,
153
+ .vertical #thumb-min,
154
+ .vertical #thumb-max {
155
+ bottom: calc(var(--position) - var(--thumb-height) / 2);
156
+ left: calc(50% - var(--thumb-width) / 2);
157
+ }
158
+
159
+ /* Range-specific thumb styles */
160
+ #thumb-min:focus-visible,
161
+ #thumb-max:focus-visible {
162
+ z-index: 4; /* Ensure focused thumb appears on top */
163
+ outline: var(--sigvelo-focus-ring);
164
+ /* intentionally no offset due to border */
165
+ }
166
+
167
+ /* Markers */
168
+ #markers {
169
+ pointer-events: none;
170
+ }
171
+
172
+ .marker {
173
+ z-index: 2;
174
+ position: absolute;
175
+ width: var(--marker-width);
176
+ height: var(--marker-height);
177
+ border-radius: var(--sigvelo-radius-circle);
178
+ background-color: light-dark(white, black);
179
+ }
180
+
181
+ .marker:first-of-type,
182
+ .marker:last-of-type {
183
+ display: none;
184
+ }
185
+
186
+ .horizontal .marker {
187
+ top: calc(50% - var(--marker-height) / 2);
188
+ left: calc(var(--position) - var(--marker-width) / 2);
189
+ }
190
+
191
+ .vertical .marker {
192
+ top: calc(var(--position) - var(--marker-height) / 2);
193
+ left: calc(50% - var(--marker-width) / 2);
194
+ }
195
+
196
+ /* Marker labels */
197
+ #references {
198
+ position: relative;
199
+
200
+ slot {
201
+ display: flex;
202
+ justify-content: space-between;
203
+ height: 100%;
204
+ }
205
+
206
+ ::slotted(*) {
207
+ color: var(--sigvelo-color-text-muted);
208
+ font-size: 0.875em;
209
+ line-height: 1;
210
+ }
211
+ }
212
+
213
+ .horizontal {
214
+ #references {
215
+ margin-block-start: 0.5em;
216
+ }
217
+ }
218
+
219
+ .vertical {
220
+ display: flex;
221
+ margin-inline: auto;
222
+
223
+ #track {
224
+ order: 1;
225
+ }
226
+
227
+ #references {
228
+ order: 2;
229
+ width: min-content;
230
+ margin-inline-start: 0.75em;
231
+
232
+ slot {
233
+ flex-direction: column;
234
+ }
235
+ }
236
+ }
237
+
238
+ .vertical #references slot {
239
+ flex-direction: column;
240
+ }
241
+ `;
242
+ //#endregion
243
+ //#region src/components/slider/slider.ts
244
+ /**
245
+ * <sigvelo-slider>
246
+ *
247
+ * @summary Allows users to select numeric values within a given range by moving a thumb along a track.
248
+ * @tag sigvelo-slider
249
+ * @documentation https://design-system.sigvelo.com/docs/components/slider
250
+ * @status stable
251
+ * @since 1.0
252
+ *
253
+ * @dependency sigvelo-tooltip
254
+ *
255
+ * @slot label - The slider's label. For plain-text labels, you can use the `label` attribute instead.
256
+ * @slot description - The slider's description. For plain-text descriptions, you can use the `description` attribute
257
+ * instead.
258
+ * @slot reference - One or more reference labels to show visually below the slider.
259
+ *
260
+ * @event sigvelo-blur - Emitted when the slider loses focus. This event does not bubble.
261
+ * @event sigvelo-change - Emitted when the user commits changes to the slider's value.
262
+ * @event sigvelo-focus - Emitted when the slider receives focus. This event does not bubble.
263
+ * @event sigvelo-input - Emitted when the slider receives input.
264
+ *
265
+ * @csspart label - The element that contains the sliders's label.
266
+ * @csspart description - The element that contains the slider's description.
267
+ * @csspart slider - The focusable element with `role="slider"`. Contains the track and reference slot.
268
+ * @csspart track - The slider's track.
269
+ * @csspart indicator - The colored indicator that shows from the start of the slider to the current value.
270
+ * @csspart markers - The container that holds all the markers when `with-markers` is used.
271
+ * @csspart marker - The individual markers that are shown when `with-markers` is used.
272
+ * @csspart references - The container that holds references that get slotted in.
273
+ * @csspart thumb - The slider's thumb.
274
+ * @csspart thumb-min - The min value thumb in a range slider.
275
+ * @csspart thumb-max - The max value thumb in a range slider.
276
+ * @csspart tooltip - The tooltip, a `<sigvelo-tooltip>` element.
277
+ * @csspart tooltip__tooltip - The tooltip's `tooltip` part.
278
+ * @csspart tooltip__content - The tooltip's `content` part.
279
+ * @csspart tooltip__arrow - The tooltip's `arrow` part.
280
+ *
281
+ * @cssstate disabled - Applied when the slider is disabled.
282
+ * @cssstate dragging - Applied when the slider is being dragged.
283
+ * @cssstate focused - Applied when the slider has focus.
284
+ * @cssstate user-valid - Applied when the slider is valid and the user has sufficiently interacted with it.
285
+ * @cssstate user-invalid - Applied when the slider is invalid and the user has sufficiently interacted with it.
286
+ *
287
+ * @cssproperty [--track-size=0.75em] - The height or width of the slider's track.
288
+ * @cssproperty [--marker-width=0.1875em] - The width of each individual marker.
289
+ * @cssproperty [--marker-height=0.1875em] - The height of each individual marker.
290
+ * @cssproperty [--thumb-width=1.25em] - The width of the thumb.
291
+ * @cssproperty [--thumb-height=1.25em] - The height of the thumb.
292
+ *
293
+ * @example Default
294
+ * ```html
295
+ * <sigvelo-slider
296
+ * label="Number of cats"
297
+ * description="Limit six per household"
298
+ * name="value"
299
+ * value="3"
300
+ * min="0"
301
+ * max="6"
302
+ * with-markers
303
+ * with-tooltip
304
+ * >
305
+ * <span slot="reference">Less</span>
306
+ * <span slot="reference">More</span>
307
+ * </sigvelo-slider>
308
+ * ```
309
+ *
310
+ * @example Showing tooltips
311
+ * Add the `with-tooltip` attribute to show a tooltip when the slider has focus or is dragged.
312
+ *
313
+ * ```html
314
+ * <sigvelo-slider
315
+ * label="Quality"
316
+ * name="quality"
317
+ * min="0"
318
+ * max="100"
319
+ * value="50"
320
+ * with-tooltip
321
+ * ></sigvelo-slider>
322
+ * ```
323
+ *
324
+ * @example Setting min, max, and step
325
+ * Use the `min` and `max` attributes to set a minimum and maximum value for the slider. Use the `step` attribute to change the granularity the value must adhere to.
326
+ *
327
+ * ```html
328
+ * <sigvelo-slider
329
+ * label="Between zero and one"
330
+ * min="0"
331
+ * max="1"
332
+ * step="0.1"
333
+ * value="0.5"
334
+ * with-tooltip
335
+ * ></sigvelo-slider>
336
+ * ```
337
+ *
338
+ * @example Showing markers
339
+ * Add the `with-markers` attribute to show visual markers at each step. Markers work best with sliders that have shorter ranges.
340
+ *
341
+ * ```html
342
+ * <sigvelo-slider
343
+ * label="Size"
344
+ * name="size"
345
+ * min="0"
346
+ * max="8"
347
+ * value="4"
348
+ * with-markers
349
+ * ></sigvelo-slider>
350
+ * ```
351
+ *
352
+ * @example Adding references
353
+ * Use the `reference` slot to add visual references below the slider. By default, references are positioned with `space-between`, making it easy to align them with starting, ending, and center markers.
354
+ *
355
+ * ```html
356
+ * <sigvelo-slider
357
+ * label="Speed"
358
+ * name="speed"
359
+ * min="1"
360
+ * max="5"
361
+ * value="3"
362
+ * with-markers
363
+ * >
364
+ * <span slot="reference">Slow</span>
365
+ * <span slot="reference">Medium</span>
366
+ * <span slot="reference">Fast</span>
367
+ * </sigvelo-slider>
368
+ * ```
369
+ *
370
+ * **Note:** If you want to show a reference next to a specific marker, you can add `position: absolute` to it and set the `left`, `right`, `top`, or `bottom` property to a percentage that corresponds to the marker's position.
371
+ *
372
+ * @example Formatting the value
373
+ * You can format the value that gets shown in tooltips and/or announced by screen readers with the `valueFormatter` property. Using JavaScript, set the property to a function that accepts a numeric value and returns a string. The `Intl.FormatNumber API` can be really useful here.
374
+ *
375
+ * ```html
376
+ * <!-- Percent -->
377
+ * <sigvelo-slider
378
+ * id="slider__percent"
379
+ * label="Percentage"
380
+ * name="percentage"
381
+ * value="0.5"
382
+ * min="0"
383
+ * max="1"
384
+ * step=".01"
385
+ * with-tooltip
386
+ * ></sigvelo-slider><br>
387
+ *
388
+ * <script>
389
+ * const slider = document.getElementById('slider__percent');
390
+ * const formatter = new Intl.NumberFormat('en-US', { style: 'percent' });
391
+ *
392
+ * customElements.whenDefined('sigvelo-slider').then(() => {
393
+ * slider.valueFormatter = value => formatter.format(value);
394
+ * });
395
+ * <\/script>
396
+ *
397
+ * <!-- Duration -->
398
+ * <sigvelo-slider
399
+ * id="slider__duration"
400
+ * label="Duration"
401
+ * name="duration"
402
+ * value="12"
403
+ * min="0"
404
+ * max="24"
405
+ * with-tooltip
406
+ * ></sigvelo-slider><br>
407
+ *
408
+ * <script>
409
+ * const slider = document.getElementById('slider__duration');
410
+ * const formatter = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'hour', unitDisplay: 'long' });
411
+ *
412
+ * customElements.whenDefined('sigvelo-slider').then(() => {
413
+ * slider.valueFormatter = value => formatter.format(value);
414
+ * });
415
+ * <\/script>
416
+ *
417
+ * <!-- Angle -->
418
+ * <sigvelo-slider
419
+ * id="slider__angle"
420
+ * label="Angle"
421
+ * name="angle"
422
+ * min="0"
423
+ * max="360"
424
+ * value="180"
425
+ * with-tooltip
426
+ * ></sigvelo-slider><br>
427
+ *
428
+ * <script>
429
+ * const slider = document.getElementById('slider__angle');
430
+ * const formatter = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'degree', unitDisplay: 'narrow' });
431
+ *
432
+ * customElements.whenDefined('sigvelo-slider').then(() => {
433
+ * slider.valueFormatter = value => formatter.format(value);
434
+ * });
435
+ * <\/script>
436
+ *
437
+ * <!-- Currency -->
438
+ * <sigvelo-slider
439
+ * id="slider__currency"
440
+ * label="Currency"
441
+ * name="currency"
442
+ * min="0"
443
+ * max="100"
444
+ * value="50"
445
+ * with-tooltip
446
+ * ></sigvelo-slider>
447
+ *
448
+ * <script>
449
+ * const slider = document.getElementById('slider__currency');
450
+ * const formatter = new Intl.NumberFormat('en-US', {
451
+ * style: 'currency',
452
+ * currency: 'USD',
453
+ * currencyDisplay: 'symbol',
454
+ * maximumFractionDigits: 0
455
+ * });
456
+ *
457
+ * customElements.whenDefined('sigvelo-slider').then(() => {
458
+ * slider.valueFormatter = value => formatter.format(value);
459
+ * });
460
+ * <\/script>
461
+ * ```
462
+ *
463
+ * @example Range selection
464
+ * Set `value` to a two-number array to create a slider with two thumbs for selecting a range of values.
465
+ *
466
+ * ```html
467
+ * <sigvelo-slider
468
+ * label="Price Range"
469
+ * description="Select minimum and maximum price"
470
+ * name="price"
471
+ * min="0"
472
+ * max="100"
473
+ * with-tooltip
474
+ * id="slider__range"
475
+ * >
476
+ * <span slot="reference">$0</span>
477
+ * <span slot="reference">$50</span>
478
+ * <span slot="reference">$100</span>
479
+ * </sigvelo-slider>
480
+ *
481
+ * <script>
482
+ * const slider = document.getElementById('slider__range');
483
+ * const formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 });
484
+ *
485
+ * customElements.whenDefined('sigvelo-slider').then(() => {
486
+ * slider.value = [20, 80];
487
+ * slider.valueFormatter = value => formatter.format(value);
488
+ * });
489
+ * <\/script>
490
+ * ```
491
+ *
492
+ * For range sliders, the two entries in `value` represent the current thumb positions. When the form is submitted, both values will be included as separate entries with the same name.
493
+ *
494
+ * ```ts
495
+ * const slider = document.querySelector('sigvelo-slider');
496
+ *
497
+ * // Get the current values
498
+ * console.log(`Min value: ${slider.value[0]}, Max value: ${slider.value[1]}`);
499
+ *
500
+ * // Set the values programmatically
501
+ * slider.value = [30, 70];
502
+ * ```
503
+ *
504
+ * @example Changing the orientation
505
+ * To make a vertical slider, set the `orientation` attribute to `vertical`. Vertical sliders are centered and will span 100% of the available space by default.
506
+ *
507
+ * ```html
508
+ * <div style="display: flex; gap: 1rem;">
509
+ * <sigvelo-slider
510
+ * orientation="vertical"
511
+ * label="Volume"
512
+ * name="volume"
513
+ * value="65"
514
+ * style="width: 80px"
515
+ * ></sigvelo-slider>
516
+ *
517
+ * <sigvelo-slider
518
+ * orientation="vertical"
519
+ * label="Bass"
520
+ * name="bass"
521
+ * value="50"
522
+ * style="width: 80px"
523
+ * ></sigvelo-slider>
524
+ *
525
+ * <sigvelo-slider
526
+ * orientation="vertical"
527
+ * label="Treble"
528
+ * name="treble"
529
+ * value="40"
530
+ * style="width: 80px"
531
+ * ></sigvelo-slider>
532
+ * </div>
533
+ * ```
534
+ *
535
+ * Range sliders can also be vertical.
536
+ *
537
+ * ```html
538
+ * <div style="height: 300px; display: flex; align-items: center; gap: 2rem;">
539
+ * <sigvelo-slider
540
+ * label="Temperature Range"
541
+ * orientation="vertical"
542
+ * min="0"
543
+ * max="100"
544
+ * with-tooltip
545
+ * tooltip-placement="right"
546
+ * id="slider__vertical-range"
547
+ * >
548
+ * </sigvelo-slider>
549
+ * </div>
550
+ *
551
+ * <script>
552
+ * const slider = document.getElementById('slider__vertical-range');
553
+ * slider.value = [30, 70];
554
+ * slider.valueFormatter = value => {
555
+ * return new Intl.NumberFormat('en', {
556
+ * style: 'unit',
557
+ * unit: 'fahrenheit',
558
+ * unitDisplay: 'short',
559
+ * minimumFractionDigits: 0,
560
+ * maximumFractionDigits: 1
561
+ * }).format(value);
562
+ * };
563
+ * <\/script>
564
+ * ```
565
+ *
566
+ * @example Changing the size
567
+ * Use the `size` attribute to change the slider's size.
568
+ *
569
+ * ```html
570
+ * <sigvelo-slider size="xs" value="50" label="Extra small"></sigvelo-slider><br>
571
+ * <sigvelo-slider size="sm" value="50" label="Small"></sigvelo-slider><br>
572
+ * <sigvelo-slider size="md" value="50" label="Medium"></sigvelo-slider><br>
573
+ * <sigvelo-slider size="lg" value="50" label="Large"></sigvelo-slider><br>
574
+ * <sigvelo-slider size="xl" value="50" label="Extra large"></sigvelo-slider>
575
+ * ```
576
+ *
577
+ * @example Changing the indicator's offset
578
+ * To make the selection more obvious, a filled indicator representing the current value is drawn from the minimum value of the slider. To change the offset from which the indicator is drawn, set the `indicator-offset` attribute to another value along the slider.
579
+ *
580
+ * ```html
581
+ * <sigvelo-slider
582
+ * label="Cat playfulness"
583
+ * description="Energy level during playtime"
584
+ * name="value"
585
+ * value="0"
586
+ * min="-5"
587
+ * max="5"
588
+ * indicator-offset="0"
589
+ * with-markers
590
+ * with-tooltip
591
+ * >
592
+ * <span slot="reference">Lazy</span>
593
+ * <span slot="reference">Zoomies</span>
594
+ * </sigvelo-slider>
595
+ * ```
596
+ *
597
+ * @example Disabling
598
+ * Use the `disabled` attribute to disable the slider.
599
+ *
600
+ * ```html
601
+ * <sigvelo-slider label="Disabled" value="50" disabled></sigvelo-slider>
602
+ * ```
603
+ *
604
+ * @example Using custom validation
605
+ * Sliders don't have built-in validation attributes like many other form controls. However, you can Use the `setCustomValidity()` method to make the slider invalid and show a custom error message on submit. To clear the error, remove the attribute or set it to an empty string.
606
+ *
607
+ * ```html
608
+ * <form action="about:blank" method="get" target="_blank" id="slider__custom-validation">
609
+ * <sigvelo-slider
610
+ * name="value"
611
+ * label="Select a value"
612
+ * description="This field will be invalid until custom validation is removed"
613
+ * ></sigvelo-slider>
614
+ * <br>
615
+ * <sigvelo-button type="submit" color="primary">Submit</sigvelo-button>
616
+ * </form>
617
+ *
618
+ * <script type="module">
619
+ * import { allDefined } from '/dist/sigvelo.js';
620
+ *
621
+ * await allDefined();
622
+ *
623
+ * const form = document.getElementById('slider__custom-validation');
624
+ * const slider = form.querySelector('sigvelo-slider');
625
+ *
626
+ * slider.setCustomValidity('Not so fast, bubba!');
627
+ * <\/script>
628
+ * ```
629
+ *
630
+ * @example Styling validation
631
+ * You can style valid and invalid sliders using the `:valid` and `:invalid` pseudo classes.
632
+ *
633
+ * ```html
634
+ * <form action="about:blank" method="get" target="_blank" class="slider__validation-pseudo">
635
+ * <sigvelo-slider
636
+ * name="value"
637
+ * label="Select a value"
638
+ * min="0"
639
+ * max="5"
640
+ * value="0"
641
+ * with-markers
642
+ * with-tooltip
643
+ * ></sigvelo-slider>
644
+ * <br>
645
+ * <sigvelo-button type="submit" color="primary">Submit</sigvelo-button>
646
+ * <sigvelo-button type="reset">Reset</sigvelo-button>
647
+ * </form>
648
+ *
649
+ * <style>
650
+ * .slider__validation-pseudo {
651
+ * sigvelo-slider:valid {
652
+ * outline: solid 2px var(--sigvelo-color-success-border);
653
+ * outline-offset: 1rem;
654
+ * }
655
+ *
656
+ * sigvelo-slider:invalid {
657
+ * outline: solid 2px var(--sigvelo-color-danger-border);
658
+ * outline-offset: 1rem;
659
+ * }
660
+ * }
661
+ * </style>
662
+ *
663
+ * <script type="module">
664
+ * import { allDefined } from '/dist/sigvelo.js';
665
+ *
666
+ * await allDefined();
667
+ *
668
+ * const form = document.querySelector('.slider__validation-pseudo');
669
+ * const slider = form.querySelector('sigvelo-slider');
670
+ * const validationMessage = 'Select a number greater than zero';
671
+ *
672
+ * slider.setCustomValidity(validationMessage);
673
+ *
674
+ * async function updateValidity() {
675
+ * await slider.updateComplete;
676
+ * slider.setCustomValidity(slider.value > 0 ? '' : validationMessage);
677
+ * }
678
+ *
679
+ * slider.addEventListener('sigvelo-input', updateValidity);
680
+ * form.addEventListener('reset', updateValidity);
681
+ * <\/script>
682
+ * ```
683
+ *
684
+ * However, these selectors will match even before the user has had a chance to fill out the form. More often than not, you'll want to use the `user-valid` and `user-invalid` custom states instead. This way, validation styles are only shown _after_ the user interacts with the form control or when the form is submitted.
685
+ *
686
+ * ```html
687
+ * <form action="about:blank" method="get" target="_blank" class="slider__validation-custom">
688
+ * <sigvelo-slider
689
+ * name="value"
690
+ * label="Select a value"
691
+ * min="0"
692
+ * max="5"
693
+ * value="0"
694
+ * with-markers
695
+ * with-tooltip
696
+ * ></sigvelo-slider>
697
+ * <br>
698
+ * <sigvelo-button type="submit" color="primary">Submit</sigvelo-button>
699
+ * <sigvelo-button type="reset">Reset</sigvelo-button>
700
+ * </form>
701
+ *
702
+ * <style>
703
+ * .slider__validation-custom {
704
+ * sigvelo-slider:state(user-valid) {
705
+ * outline: solid 2px var(--sigvelo-color-success-border);
706
+ * outline-offset: 1rem;
707
+ * }
708
+ *
709
+ * sigvelo-slider:state(user-invalid) {
710
+ * outline: solid 2px var(--sigvelo-color-danger-border);
711
+ * outline-offset: 1rem;
712
+ * }
713
+ * }
714
+ * </style>
715
+ *
716
+ * <script type="module">
717
+ * import { allDefined } from '/dist/sigvelo.js';
718
+ *
719
+ * await allDefined();
720
+ *
721
+ * const form = document.querySelector('.slider__validation-custom');
722
+ * const slider = form.querySelector('sigvelo-slider');
723
+ * const validationMessage = 'Select a number greater than zero';
724
+ *
725
+ * slider.setCustomValidity(validationMessage);
726
+ *
727
+ * async function updateValidity() {
728
+ * await slider.updateComplete;
729
+ * slider.setCustomValidity(slider.value > 0 ? '' : validationMessage);
730
+ * }
731
+ *
732
+ * slider.addEventListener('sigvelo-input', updateValidity);
733
+ * form.addEventListener('reset', updateValidity);
734
+ * <\/script>
735
+ * ```
736
+ *
737
+ * @example Styling sliders
738
+ * Sliders come with a simple, minimal appearance. Feel free to customize them with your own styles.
739
+ *
740
+ * ```html
741
+ * <div style="display: flex; gap: 2rem;">
742
+ * <div class="slider__touch">
743
+ * <sigvelo-slider
744
+ * label="Brightness"
745
+ * orientation="vertical"
746
+ * name="value"
747
+ * min="0"
748
+ * max="1"
749
+ * step=".01"
750
+ * value="0.6"
751
+ * >
752
+ * </sigvelo-slider>
753
+ * <sigvelo-icon name="sun"></sigvelo-icon>
754
+ * </div>
755
+ *
756
+ * <div class="slider__touch">
757
+ * <sigvelo-slider
758
+ * label="Volume"
759
+ * orientation="vertical"
760
+ * name="value"
761
+ * min="0"
762
+ * max="1"
763
+ * step=".01"
764
+ * value="0.4"
765
+ * ></sigvelo-slider>
766
+ * <sigvelo-icon name="volume"></sigvelo-icon>
767
+ * </div>
768
+ * </div>
769
+ *
770
+ * <style>
771
+ * .slider__touch {
772
+ * position: relative;
773
+ * max-width: fit-content;
774
+ *
775
+ * sigvelo-slider {
776
+ * --track-size: 4rem;
777
+ * max-width: fit-content;
778
+ *
779
+ * &::part(track) {
780
+ * background-color: var(--sigvelo-color-neutral-bg-subtle);
781
+ * box-shadow: inset 0 1px 2px color-mix(in oklab, var(--sigvelo-color-neutral-bg-subtle), black 5%);
782
+ * cursor: pointer;
783
+ * overflow: hidden;
784
+ * }
785
+ *
786
+ * &::part(indicator) {
787
+ * background-color: #22c55e;
788
+ * border-radius: 0;
789
+ * }
790
+ *
791
+ * &::part(thumb) {
792
+ * opacity: 0;
793
+ * }
794
+ *
795
+ * &::part(tooltip__arrow) {
796
+ * display: none;
797
+ * }
798
+ *
799
+ * &::part(tooltip__content) {
800
+ * background-color: var(--sigvelo-color-neutral-bg-stronger);
801
+ * border: none;
802
+ * color: var(--sigvelo-color-primary-text-on-strong);
803
+ * }
804
+ *
805
+ * &::part(slider):focus-visible {
806
+ * outline: var(--sigvelo-focus-ring);
807
+ * outline-offset: var(--sigvelo-focus-offset);
808
+ * }
809
+ * }
810
+ *
811
+ * sigvelo-icon {
812
+ * position: absolute;
813
+ * bottom: 3.5rem;
814
+ * left: calc(50% - 1rem);
815
+ * font-size: 2rem;
816
+ * color: light-dark(black, white);
817
+ * pointer-events: none;
818
+ * }
819
+ * }
820
+ * </style>
821
+ * ```
822
+ *
823
+ * ```html
824
+ * <sigvelo-slider
825
+ * id="slider__color"
826
+ * label="Color"
827
+ * name="color"
828
+ * min="0"
829
+ * max="359"
830
+ * with-tooltip
831
+ * style="--hue: hsl(0deg 100% 50%);"
832
+ * ></sigvelo-slider>
833
+ *
834
+ * <br>
835
+ *
836
+ * <sigvelo-slider
837
+ * id="slider__opacity"
838
+ * label="Opacity"
839
+ * name="opacity"
840
+ * min="0"
841
+ * max="1"
842
+ * step=".01"
843
+ * with-tooltip
844
+ * style="--opacity: 0%;"
845
+ * ></sigvelo-slider>
846
+ *
847
+ * <style>
848
+ * #slider__color,
849
+ * #slider__opacity {
850
+ * --track-size: 1.25em;
851
+ * --thumb-width: 1.5em;
852
+ * --thumb-height: 1.5em;
853
+ *
854
+ * &::part(track) {
855
+ * box-shadow: inset 0 0 0 0.0625em color-mix(in oklab, black, transparent 90%);
856
+ * border-radius: var(--sigvelo-radius-md);
857
+ * }
858
+ *
859
+ * &::part(thumb) {
860
+ * border: solid 0.0625em rgb(0 0 0 / 33%);
861
+ * border-radius: var(--sigvelo-radius-circle);
862
+ * transition: 100ms scale ease;
863
+ * }
864
+ *
865
+ * &:state(dragging)::part(thumb),
866
+ * &::part(thumb):focus-visible {
867
+ * scale: 1.25;
868
+ * }
869
+ *
870
+ * &::part(thumb)::after {
871
+ * content: '';
872
+ * position: absolute;
873
+ * top: 0;
874
+ * left: 0;
875
+ * width: 100%;
876
+ * height: 100%;
877
+ * border-radius: inherit;
878
+ * border: solid 0.125em white;
879
+ * box-shadow: inset 0 0 0 0.0625em rgb(0 0 0 / 33%);
880
+ * }
881
+ * }
882
+ *
883
+ * #slider__color {
884
+ * &::part(track) {
885
+ * background-image:
886
+ * linear-gradient(
887
+ * to right,
888
+ * rgb(255, 0, 0) 0%,
889
+ * rgb(255, 255, 0) 17%,
890
+ * rgb(0, 255, 0) 33%,
891
+ * rgb(0, 255, 255) 50%,
892
+ * rgb(0, 0, 255) 67%,
893
+ * rgb(255, 0, 255) 83%,
894
+ * rgb(255, 0, 0) 100%
895
+ * );
896
+ * }
897
+ *
898
+ * &::part(indicator) {
899
+ * display: none;
900
+ * }
901
+ *
902
+ * &::part(thumb) {
903
+ * background-color: var(--hue);
904
+ * }
905
+ * }
906
+ *
907
+ * #slider__opacity {
908
+ * &::part(track) {
909
+ * background-color: transparent;
910
+ * background-size: 0.5em 0.5em;
911
+ * background-position:
912
+ * 0 0,
913
+ * 0 0,
914
+ * -0.25em -0.25em,
915
+ * 0.25em 0.25em;
916
+ * background-image: linear-gradient(45deg, var(--sigvelo-color-neutral-bg-muted) 25%, transparent 25%),
917
+ * linear-gradient(45deg, transparent 75%, var(--sigvelo-color-neutral-bg-muted) 75%),
918
+ * linear-gradient(45deg, transparent 75%, var(--sigvelo-color-neutral-bg-muted) 75%),
919
+ * linear-gradient(45deg, var(--sigvelo-color-neutral-bg-muted) 25%, transparent 25%);
920
+ * }
921
+ *
922
+ * &::part(indicator) {
923
+ * width: 100% !important;
924
+ * background-color: transparent;
925
+ * background-image: linear-gradient(to right, #0000 0%, #000f 100%);
926
+ * }
927
+ *
928
+ * &::part(thumb) {
929
+ * background-color: color-mix(in oklab, white, black var(--opacity));
930
+ * }
931
+ * }
932
+ * </style>
933
+ *
934
+ * <script>
935
+ * const colorSlider = document.getElementById('slider__color');
936
+ * const opacitySlider = document.getElementById('slider__opacity');
937
+ * const degreeFormatter = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'degree', unitDisplay: 'narrow' });
938
+ * const percentFormatter = new Intl.NumberFormat('en-US', { style: 'percent' });
939
+ *
940
+ * customElements.whenDefined('sigvelo-slider').then(() => {
941
+ * // Set formatters for screen readers
942
+ * colorSlider.valueFormatter = value => degreeFormatter.format(value);
943
+ * opacitySlider.valueFormatter = value => percentFormatter.format(value);
944
+ *
945
+ * // Set the color slider's thumb color when the value changes
946
+ * colorSlider.addEventListener('input', () => {
947
+ * colorSlider.style.setProperty('--hue', `hsl(${colorSlider.value}deg 100% 50%)`);
948
+ * });
949
+ *
950
+ * // Set the opacity slider's thumb color when the value changes
951
+ * opacitySlider.addEventListener('input', () => {
952
+ * opacitySlider.style.setProperty('--opacity', `${opacitySlider.value * 100}%`);
953
+ * });
954
+ * });
955
+ * <\/script>
956
+ * ```
957
+ *
958
+ * ```html
959
+ * <sigvelo-slider
960
+ * id="slider__repeat"
961
+ * label="Key repeat rate"
962
+ * name="repeat"
963
+ * value="5"
964
+ * min="0"
965
+ * max="7"
966
+ * with-markers
967
+ * >
968
+ * <span slot="reference">Off</span>
969
+ * <span slot="reference" class="repeat-slow">Slow</span>
970
+ * <span slot="reference">Fast</span>
971
+ * </sigvelo-slider>
972
+ *
973
+ * <style>
974
+ * #slider__repeat {
975
+ * --thumb-width: 0.75em;
976
+ * --thumb-height: 1.5em;
977
+ * --marker-height: 0.5em;
978
+ *
979
+ * &::part(track) {
980
+ * height: 1em;
981
+ * background: none;
982
+ * }
983
+ *
984
+ * &::part(track)::after {
985
+ * content: '';
986
+ * position: absolute;
987
+ * top: calc(50% - .125em);
988
+ * left: 0;
989
+ * width: 100%;
990
+ * height: .25em;
991
+ * background-color: var(--sigvelo-color-neutral-bg-muted);
992
+ * }
993
+ *
994
+ * &::part(indicator) {
995
+ * display: none;
996
+ * }
997
+ *
998
+ * &::part(thumb) {
999
+ * border-radius: 0.25em;
1000
+ * border: none;
1001
+ * background-color: var(--sigvelo-color-neutral-bg-strong);
1002
+ * }
1003
+ *
1004
+ * &::part(marker) {
1005
+ * display: initial;
1006
+ * border-radius: 0.125em;
1007
+ * background-color: var(--sigvelo-color-neutral-bg);
1008
+ * }
1009
+ *
1010
+ * .repeat-slow {
1011
+ * position: absolute;
1012
+ *
1013
+ * &:dir(ltr) {
1014
+ * left: 14%;
1015
+ * }
1016
+ *
1017
+ * &:dir(rtl) {
1018
+ * right: 14%;
1019
+ * }
1020
+ * }
1021
+ * }
1022
+ * </style>
1023
+ * ```
1024
+ */
1025
+ var SigveloSlider = class extends SigveloFormControlElement {
1026
+ constructor(..._args) {
1027
+ super(..._args);
1028
+ this.draggableThumbMin = null;
1029
+ this.draggableThumbMax = null;
1030
+ this.localize = new Localize(this);
1031
+ this.activeThumb = null;
1032
+ this.lastTrackPosition = null;
1033
+ this.defaultValue = 0;
1034
+ this.isInvalid = false;
1035
+ this.hadUserInteraction = false;
1036
+ this.wasSubmitted = false;
1037
+ this.value = 0;
1038
+ this.disabled = false;
1039
+ this.readonly = false;
1040
+ this.orientation = "horizontal";
1041
+ this.size = "md";
1042
+ this.min = 0;
1043
+ this.max = 100;
1044
+ this.step = 1;
1045
+ this.tooltipDistance = 8;
1046
+ this.tooltipPlacement = "top";
1047
+ this.withMarkers = false;
1048
+ this.withTooltip = false;
1049
+ }
1050
+ static {
1051
+ this.formAssociated = true;
1052
+ }
1053
+ static {
1054
+ this.observeSlots = true;
1055
+ }
1056
+ static {
1057
+ this.styles = [
1058
+ hostStyles,
1059
+ formControlStyles,
1060
+ slider_styles_default
1061
+ ];
1062
+ }
1063
+ get focusableAnchor() {
1064
+ return this.isRange ? this.thumbMin || this.slider : this.slider;
1065
+ }
1066
+ /** Get if this is a range slider */
1067
+ get isRange() {
1068
+ return Array.isArray(this.value);
1069
+ }
1070
+ get singleValue() {
1071
+ return typeof this.value === "number" ? this.value : this.value[0] ?? this.min;
1072
+ }
1073
+ set singleValue(value) {
1074
+ this.value = value;
1075
+ }
1076
+ get rangeStart() {
1077
+ return Array.isArray(this.value) ? this.value[0] ?? this.min : this.min;
1078
+ }
1079
+ set rangeStart(value) {
1080
+ this.value = [value, this.rangeEnd];
1081
+ }
1082
+ get rangeEnd() {
1083
+ return Array.isArray(this.value) ? this.value[1] ?? this.value[0] ?? this.max : this.max;
1084
+ }
1085
+ set rangeEnd(value) {
1086
+ this.value = [this.rangeStart, value];
1087
+ }
1088
+ connectedCallback() {
1089
+ super.connectedCallback();
1090
+ this.addEventListener("invalid", this.handleHostInvalid);
1091
+ }
1092
+ disconnectedCallback() {
1093
+ super.disconnectedCallback();
1094
+ this.removeEventListener("invalid", this.handleHostInvalid);
1095
+ this.stopDragging();
1096
+ }
1097
+ firstUpdated() {
1098
+ this.defaultValue = Array.isArray(this.value) ? [...this.value] : this.value;
1099
+ this.setupDragging();
1100
+ }
1101
+ stopDragging() {
1102
+ this.draggableTrack?.stop();
1103
+ this.draggableThumbMin?.stop();
1104
+ this.draggableThumbMax?.stop();
1105
+ this.draggableTrack = void 0;
1106
+ this.draggableThumbMin = null;
1107
+ this.draggableThumbMax = null;
1108
+ }
1109
+ setupDragging() {
1110
+ this.stopDragging();
1111
+ if (this.isRange) {
1112
+ this.draggableThumbMin = new DraggableElement(this.thumbMin, {
1113
+ start: () => {
1114
+ this.activeThumb = "min";
1115
+ this.trackBoundingClientRect = this.track.getBoundingClientRect();
1116
+ this.valueWhenDraggingStarted = this.rangeStart;
1117
+ this.customStates.set("dragging", true);
1118
+ this.showRangeTooltips();
1119
+ },
1120
+ move: (x, y) => {
1121
+ this.setThumbValueFromCoordinates(x, y, "min");
1122
+ },
1123
+ stop: () => {
1124
+ if (this.rangeStart !== this.valueWhenDraggingStarted) {
1125
+ this.dispatchEvent(new SigveloChangeEvent());
1126
+ this.dispatchEvent(new Event("change", {
1127
+ bubbles: true,
1128
+ composed: true
1129
+ }));
1130
+ this.hadUserInteraction = true;
1131
+ }
1132
+ this.hideRangeTooltips();
1133
+ this.customStates.set("dragging", false);
1134
+ this.valueWhenDraggingStarted = void 0;
1135
+ this.activeThumb = null;
1136
+ this.lastTrackPosition = null;
1137
+ }
1138
+ });
1139
+ this.draggableThumbMax = new DraggableElement(this.thumbMax, {
1140
+ start: () => {
1141
+ this.activeThumb = "max";
1142
+ this.trackBoundingClientRect = this.track.getBoundingClientRect();
1143
+ this.valueWhenDraggingStarted = this.rangeEnd;
1144
+ this.customStates.set("dragging", true);
1145
+ this.showRangeTooltips();
1146
+ },
1147
+ move: (x, y) => {
1148
+ this.setThumbValueFromCoordinates(x, y, "max");
1149
+ },
1150
+ stop: () => {
1151
+ if (this.rangeEnd !== this.valueWhenDraggingStarted) {
1152
+ this.dispatchEvent(new SigveloChangeEvent());
1153
+ this.dispatchEvent(new Event("change", {
1154
+ bubbles: true,
1155
+ composed: true
1156
+ }));
1157
+ this.hadUserInteraction = true;
1158
+ }
1159
+ this.hideRangeTooltips();
1160
+ this.customStates.set("dragging", false);
1161
+ this.valueWhenDraggingStarted = void 0;
1162
+ this.activeThumb = null;
1163
+ }
1164
+ });
1165
+ this.draggableTrack = new DraggableElement(this.track, {
1166
+ start: (x, y) => {
1167
+ this.trackBoundingClientRect = this.track.getBoundingClientRect();
1168
+ if (this.activeThumb) this.valueWhenDraggingStarted = this.activeThumb === "min" ? this.rangeStart : this.rangeEnd;
1169
+ else {
1170
+ const value = this.getValueFromCoordinates(x, y);
1171
+ const minDistance = Math.abs(value - this.rangeStart);
1172
+ const maxDistance = Math.abs(value - this.rangeEnd);
1173
+ if (minDistance === maxDistance) if (value > this.rangeEnd) this.activeThumb = "max";
1174
+ else if (value < this.rangeStart) this.activeThumb = "min";
1175
+ else {
1176
+ const isRtl = this.localize.dir() === "rtl";
1177
+ const isVertical = this.orientation === "vertical";
1178
+ const position = isVertical ? y : x;
1179
+ const previousPosition = this.lastTrackPosition || position;
1180
+ this.lastTrackPosition = position;
1181
+ const movingForward = position > previousPosition !== isRtl && !isVertical || position < previousPosition && isVertical;
1182
+ this.activeThumb = movingForward ? "max" : "min";
1183
+ }
1184
+ else this.activeThumb = minDistance <= maxDistance ? "min" : "max";
1185
+ this.valueWhenDraggingStarted = this.activeThumb === "min" ? this.rangeStart : this.rangeEnd;
1186
+ }
1187
+ this.customStates.set("dragging", true);
1188
+ this.setThumbValueFromCoordinates(x, y, this.activeThumb);
1189
+ this.showRangeTooltips();
1190
+ },
1191
+ move: (x, y) => {
1192
+ if (this.activeThumb) this.setThumbValueFromCoordinates(x, y, this.activeThumb);
1193
+ },
1194
+ stop: () => {
1195
+ if (this.activeThumb) {
1196
+ if ((this.activeThumb === "min" ? this.rangeStart : this.rangeEnd) !== this.valueWhenDraggingStarted) {
1197
+ this.dispatchEvent(new SigveloChangeEvent());
1198
+ this.dispatchEvent(new Event("change", {
1199
+ bubbles: true,
1200
+ composed: true
1201
+ }));
1202
+ this.hadUserInteraction = true;
1203
+ }
1204
+ }
1205
+ this.hideRangeTooltips();
1206
+ this.customStates.set("dragging", false);
1207
+ this.valueWhenDraggingStarted = void 0;
1208
+ this.activeThumb = null;
1209
+ }
1210
+ });
1211
+ } else this.draggableTrack = new DraggableElement(this.slider, {
1212
+ start: (x, y) => {
1213
+ this.trackBoundingClientRect = this.track.getBoundingClientRect();
1214
+ this.valueWhenDraggingStarted = this.singleValue;
1215
+ this.customStates.set("dragging", true);
1216
+ this.setValueFromCoordinates(x, y);
1217
+ this.showTooltip();
1218
+ },
1219
+ move: (x, y) => {
1220
+ this.setValueFromCoordinates(x, y);
1221
+ },
1222
+ stop: () => {
1223
+ if (this.singleValue !== this.valueWhenDraggingStarted) {
1224
+ this.dispatchEvent(new SigveloChangeEvent());
1225
+ this.dispatchEvent(new Event("change", {
1226
+ bubbles: true,
1227
+ composed: true
1228
+ }));
1229
+ this.hadUserInteraction = true;
1230
+ }
1231
+ this.hideTooltip();
1232
+ this.customStates.set("dragging", false);
1233
+ this.valueWhenDraggingStarted = void 0;
1234
+ }
1235
+ });
1236
+ const enabled = !(this.disabled || this.readonly);
1237
+ this.draggableTrack?.toggle(enabled);
1238
+ this.draggableThumbMin?.toggle(enabled);
1239
+ this.draggableThumbMax?.toggle(enabled);
1240
+ }
1241
+ updated(changedProperties) {
1242
+ this.updateValidity();
1243
+ if (changedProperties.has("value")) {
1244
+ this.tooltip?.reposition();
1245
+ this.tooltipMin?.reposition();
1246
+ this.tooltipMax?.reposition();
1247
+ const previousValue = changedProperties.get("value");
1248
+ if (previousValue !== void 0 && Array.isArray(previousValue) !== this.isRange) this.setupDragging();
1249
+ }
1250
+ if (changedProperties.has("value") || changedProperties.has("min") || changedProperties.has("max")) if (this.isRange) {
1251
+ const start = clamp(this.rangeStart, this.min, this.max);
1252
+ const end = clamp(this.rangeEnd, start, this.max);
1253
+ if (start !== this.rangeStart || end !== this.rangeEnd) this.value = [start, end];
1254
+ else this.updateFormValue();
1255
+ } else {
1256
+ const value = clamp(this.singleValue, this.min, this.max);
1257
+ if (value !== this.singleValue) this.singleValue = value;
1258
+ else this.internals.setFormValue(String(value));
1259
+ }
1260
+ if (changedProperties.has("disabled")) this.customStates.set("disabled", this.disabled);
1261
+ if (changedProperties.has("disabled") || changedProperties.has("readonly")) {
1262
+ const enabled = !(this.disabled || this.readonly);
1263
+ if (this.isRange) {
1264
+ if (this.draggableThumbMin) this.draggableThumbMin.toggle(enabled);
1265
+ if (this.draggableThumbMax) this.draggableThumbMax.toggle(enabled);
1266
+ }
1267
+ if (this.draggableTrack) this.draggableTrack.toggle(enabled);
1268
+ }
1269
+ if (this.hadUserInteraction || this.wasSubmitted) {
1270
+ this.customStates.set("user-invalid", this.isInvalid);
1271
+ this.customStates.set("user-valid", !this.isInvalid);
1272
+ } else {
1273
+ this.customStates.set("user-invalid", false);
1274
+ this.customStates.set("user-valid", false);
1275
+ }
1276
+ }
1277
+ /** @internal Called when a containing fieldset is disabled. */
1278
+ formDisabledCallback(isDisabled) {
1279
+ this.disabled = isDisabled;
1280
+ }
1281
+ /** @internal Called when the form is reset. */
1282
+ formResetCallback() {
1283
+ this.value = Array.isArray(this.defaultValue) ? [...this.defaultValue] : this.defaultValue;
1284
+ this.isInvalid = false;
1285
+ this.hadUserInteraction = false;
1286
+ this.wasSubmitted = false;
1287
+ }
1288
+ /** Clamps a number to min/max while ensuring it's a valid step interval. */
1289
+ clampAndRoundToStep(value) {
1290
+ const stepPrecision = (String(this.step).split(".")[1] || "").replace(/0+$/g, "").length;
1291
+ value = Math.round(value / this.step) * this.step;
1292
+ value = clamp(value, this.min, this.max);
1293
+ return parseFloat(value.toFixed(stepPrecision));
1294
+ }
1295
+ /** Given a value, returns its percentage within a range of min/max. */
1296
+ getPercentageFromValue(value) {
1297
+ return (value - this.min) / (this.max - this.min) * 100;
1298
+ }
1299
+ /** Converts coordinates to slider value */
1300
+ getValueFromCoordinates(x, y) {
1301
+ const isRtl = this.localize.dir() === "rtl";
1302
+ const isVertical = this.orientation === "vertical";
1303
+ const { top, right, bottom, left, height, width } = this.trackBoundingClientRect;
1304
+ const pointerPosition = isVertical ? y : x;
1305
+ const sliderCoords = isVertical ? {
1306
+ start: top,
1307
+ end: bottom,
1308
+ size: height
1309
+ } : {
1310
+ start: left,
1311
+ end: right,
1312
+ size: width
1313
+ };
1314
+ const percentage = (isVertical ? sliderCoords.end - pointerPosition : isRtl ? sliderCoords.end - pointerPosition : pointerPosition - sliderCoords.start) / sliderCoords.size;
1315
+ return this.clampAndRoundToStep(this.min + (this.max - this.min) * percentage);
1316
+ }
1317
+ handleBlur() {
1318
+ if (this.isRange) requestAnimationFrame(() => {
1319
+ const focusedElement = this.shadowRoot?.activeElement;
1320
+ if (!(focusedElement === this.thumbMin || focusedElement === this.thumbMax)) this.hideRangeTooltips();
1321
+ });
1322
+ else this.hideTooltip();
1323
+ this.customStates.set("focused", false);
1324
+ this.dispatchEvent(new SigveloBlurEvent());
1325
+ }
1326
+ handleFocus(event) {
1327
+ const target = event.target;
1328
+ if (this.isRange) {
1329
+ if (target === this.thumbMin) this.activeThumb = "min";
1330
+ else if (target === this.thumbMax) this.activeThumb = "max";
1331
+ this.showRangeTooltips();
1332
+ } else this.showTooltip();
1333
+ this.customStates.set("focused", true);
1334
+ this.dispatchEvent(new SigveloFocusEvent());
1335
+ }
1336
+ handleHostInvalid() {
1337
+ this.wasSubmitted = true;
1338
+ }
1339
+ handleKeyDown(event) {
1340
+ const isRtl = this.localize.dir() === "rtl";
1341
+ const target = event.target;
1342
+ if (this.disabled || this.readonly) return;
1343
+ if (this.isRange) {
1344
+ if (target === this.thumbMin) this.activeThumb = "min";
1345
+ else if (target === this.thumbMax) this.activeThumb = "max";
1346
+ if (!this.activeThumb) return;
1347
+ }
1348
+ const current = this.isRange ? this.activeThumb === "min" ? this.rangeStart : this.rangeEnd : this.singleValue;
1349
+ let newValue = current;
1350
+ switch (event.key) {
1351
+ case "ArrowUp":
1352
+ case isRtl ? "ArrowLeft" : "ArrowRight":
1353
+ event.preventDefault();
1354
+ newValue = this.clampAndRoundToStep(current + this.step);
1355
+ break;
1356
+ case "ArrowDown":
1357
+ case isRtl ? "ArrowRight" : "ArrowLeft":
1358
+ event.preventDefault();
1359
+ newValue = this.clampAndRoundToStep(current - this.step);
1360
+ break;
1361
+ case "Home":
1362
+ event.preventDefault();
1363
+ newValue = this.isRange && this.activeThumb === "min" ? this.min : this.isRange ? this.rangeStart : this.min;
1364
+ break;
1365
+ case "End":
1366
+ event.preventDefault();
1367
+ newValue = this.isRange && this.activeThumb === "max" ? this.max : this.isRange ? this.rangeEnd : this.max;
1368
+ break;
1369
+ case "PageUp":
1370
+ event.preventDefault();
1371
+ const stepUp = Math.max(current + (this.max - this.min) / 10, current + this.step);
1372
+ newValue = this.clampAndRoundToStep(stepUp);
1373
+ break;
1374
+ case "PageDown":
1375
+ event.preventDefault();
1376
+ const stepDown = Math.min(current - (this.max - this.min) / 10, current - this.step);
1377
+ newValue = this.clampAndRoundToStep(stepDown);
1378
+ break;
1379
+ case "Enter":
1380
+ if (this.internals.form) {
1381
+ const submitter = [...this.internals.form.elements].find((el) => {
1382
+ return ["button", "input"].includes(el.localName) && el.type === "submit";
1383
+ });
1384
+ this.internals.form.requestSubmit(submitter);
1385
+ }
1386
+ return;
1387
+ }
1388
+ if (newValue === current) return;
1389
+ if (this.isRange) {
1390
+ if (this.activeThumb === "min") if (newValue > this.rangeEnd) this.value = [newValue, newValue];
1391
+ else this.rangeStart = Math.max(this.min, newValue);
1392
+ else if (newValue < this.rangeStart) this.value = [newValue, newValue];
1393
+ else this.rangeEnd = Math.min(this.max, newValue);
1394
+ this.updateFormValue();
1395
+ } else this.singleValue = clamp(newValue, this.min, this.max);
1396
+ this.dispatchEvent(new SigveloInputEvent());
1397
+ this.dispatchEvent(new SigveloChangeEvent());
1398
+ this.dispatchEvent(new InputEvent("input", {
1399
+ bubbles: true,
1400
+ composed: true
1401
+ }));
1402
+ this.dispatchEvent(new Event("change", {
1403
+ bubbles: true,
1404
+ composed: true
1405
+ }));
1406
+ this.hadUserInteraction = true;
1407
+ }
1408
+ handleLabelPointerDown(event) {
1409
+ event.preventDefault();
1410
+ if (!this.disabled) if (this.isRange) this.thumbMin?.focus();
1411
+ else this.slider.focus();
1412
+ }
1413
+ setValueFromCoordinates(x, y) {
1414
+ const oldValue = this.singleValue;
1415
+ this.singleValue = this.getValueFromCoordinates(x, y);
1416
+ if (this.singleValue !== oldValue) {
1417
+ this.dispatchEvent(new SigveloInputEvent());
1418
+ this.dispatchEvent(new InputEvent("input"));
1419
+ }
1420
+ }
1421
+ setThumbValueFromCoordinates(x, y, thumb) {
1422
+ const value = this.getValueFromCoordinates(x, y);
1423
+ const oldValue = thumb === "min" ? this.rangeStart : this.rangeEnd;
1424
+ if (thumb === "min") if (value > this.rangeEnd) this.value = [value, value];
1425
+ else this.rangeStart = Math.max(this.min, value);
1426
+ else if (value < this.rangeStart) this.value = [value, value];
1427
+ else this.rangeEnd = Math.min(this.max, value);
1428
+ if (oldValue !== (thumb === "min" ? this.rangeStart : this.rangeEnd)) {
1429
+ this.dispatchEvent(new SigveloInputEvent());
1430
+ this.dispatchEvent(new InputEvent("input"));
1431
+ this.updateFormValue();
1432
+ }
1433
+ }
1434
+ showTooltip() {
1435
+ if (this.withTooltip && this.tooltip) this.tooltip.open = true;
1436
+ }
1437
+ hideTooltip() {
1438
+ if (this.withTooltip && this.tooltip) this.tooltip.open = false;
1439
+ }
1440
+ showRangeTooltips() {
1441
+ if (!this.withTooltip) return;
1442
+ if (this.activeThumb === "min") {
1443
+ this.tooltipMin.open = true;
1444
+ this.tooltipMax.open = false;
1445
+ } else if (this.activeThumb === "max") {
1446
+ this.tooltipMax.open = true;
1447
+ this.tooltipMin.open = false;
1448
+ }
1449
+ }
1450
+ hideRangeTooltips() {
1451
+ if (!this.withTooltip) return;
1452
+ this.tooltipMin.open = false;
1453
+ this.tooltipMax.open = false;
1454
+ }
1455
+ /** Updates the form value submission for range sliders */
1456
+ updateFormValue() {
1457
+ if (this.isRange) {
1458
+ const formData = new FormData();
1459
+ formData.append(this.name || "", String(this.rangeStart));
1460
+ formData.append(this.name || "", String(this.rangeEnd));
1461
+ this.internals.setFormValue(formData);
1462
+ }
1463
+ }
1464
+ /** Sets the form control's validity */
1465
+ async updateValidity() {
1466
+ await this.updateComplete;
1467
+ const hasCustomValidity = this.getCustomValidity().length > 0;
1468
+ const validationMessage = this.getCustomValidity();
1469
+ const flags = {
1470
+ badInput: false,
1471
+ customError: hasCustomValidity,
1472
+ patternMismatch: false,
1473
+ rangeOverflow: false,
1474
+ rangeUnderflow: false,
1475
+ stepMismatch: false,
1476
+ tooLong: false,
1477
+ tooShort: false,
1478
+ typeMismatch: false,
1479
+ valueMissing: false
1480
+ };
1481
+ this.isInvalid = hasCustomValidity;
1482
+ this.internals.setValidity(flags, validationMessage, this.focusableAnchor);
1483
+ }
1484
+ /** Sets focus to the slider. */
1485
+ focus() {
1486
+ if (this.isRange) this.thumbMin?.focus();
1487
+ else this.slider.focus();
1488
+ }
1489
+ /** Removes focus from the slider. */
1490
+ blur() {
1491
+ if (this.isRange) {
1492
+ if (document.activeElement === this.thumbMin) this.thumbMin.blur();
1493
+ else if (document.activeElement === this.thumbMax) this.thumbMax.blur();
1494
+ } else this.slider.blur();
1495
+ }
1496
+ /**
1497
+ * Decreases the slider's value by `step`. This is a programmatic change, so `input` and `change` events will not be
1498
+ * emitted when this is called.
1499
+ */
1500
+ stepDown() {
1501
+ if (this.isRange) {
1502
+ const newValue = this.clampAndRoundToStep(this.rangeStart - this.step);
1503
+ this.rangeStart = clamp(newValue, this.min, this.rangeEnd);
1504
+ this.updateFormValue();
1505
+ } else {
1506
+ const newValue = this.clampAndRoundToStep(this.singleValue - this.step);
1507
+ this.singleValue = newValue;
1508
+ }
1509
+ }
1510
+ /**
1511
+ * Increases the slider's value by `step`. This is a programmatic change, so `input` and `change` events will not be
1512
+ * emitted when this is called.
1513
+ */
1514
+ stepUp() {
1515
+ if (this.isRange) {
1516
+ const newValue = this.clampAndRoundToStep(this.rangeEnd + this.step);
1517
+ this.rangeEnd = clamp(newValue, this.rangeStart, this.max);
1518
+ this.updateFormValue();
1519
+ } else {
1520
+ const newValue = this.clampAndRoundToStep(this.singleValue + this.step);
1521
+ this.singleValue = newValue;
1522
+ }
1523
+ }
1524
+ render() {
1525
+ const hasLabel = this.label || this.slotsWithContent.has("label");
1526
+ const hasDescription = this.description || this.slotsWithContent.has("description");
1527
+ const sliderClasses = classMap({
1528
+ xs: this.size === "xs",
1529
+ sm: this.size === "sm",
1530
+ md: this.size === "md",
1531
+ lg: this.size === "lg",
1532
+ xl: this.size === "xl",
1533
+ horizontal: this.orientation === "horizontal",
1534
+ vertical: this.orientation === "vertical",
1535
+ disabled: this.disabled
1536
+ });
1537
+ const markers = [];
1538
+ if (this.withMarkers) for (let i = this.min; i <= this.max; i += this.step) markers.push(this.getPercentageFromValue(i));
1539
+ const labelAndDescription = html`
1540
+ <label
1541
+ id="label"
1542
+ part="label"
1543
+ for=${this.isRange ? "thumb-min" : "text-box"}
1544
+ class=${classMap({ vh: !hasLabel })}
1545
+ @pointerdown=${this.handleLabelPointerDown}
1546
+ >
1547
+ <slot name="label">${this.label}</slot>
1548
+ </label>
1549
+
1550
+ <div id="description" part="description" class=${classMap({ vh: !hasDescription })}>
1551
+ <slot name="description">${this.description}</slot>
1552
+ </div>
1553
+ `;
1554
+ const markersTemplate = this.withMarkers ? html`
1555
+ <div id="markers" part="markers">
1556
+ ${markers.map((marker) => html`<span part="marker" class="marker" style="--position: ${marker}%"></span>`)}
1557
+ </div>
1558
+ ` : "";
1559
+ const referencesTemplate = this.whenSlotted("reference", html`
1560
+ <div id="references" part="references" aria-hidden="true">
1561
+ <slot name="reference"></slot>
1562
+ </div>
1563
+ `);
1564
+ const createTooltip = (thumbId, value) => this.withTooltip ? html`
1565
+ <sigvelo-tooltip
1566
+ id=${`tooltip${thumbId !== "thumb" ? "-" + thumbId : ""}`}
1567
+ part="tooltip"
1568
+ exportparts="
1569
+ tooltip:tooltip__tooltip,
1570
+ content:tooltip__content,
1571
+ arrow:tooltip__arrow
1572
+ "
1573
+ distance=${this.tooltipDistance}
1574
+ placement=${this.tooltipPlacement}
1575
+ for=${thumbId}
1576
+ activation="manual"
1577
+ dir=${this.localize.dir()}
1578
+ aria-label=${typeof this.valueFormatter === "function" ? this.valueFormatter(value) : String(value)}
1579
+ >
1580
+ <span aria-hidden="true">
1581
+ ${typeof this.valueFormatter === "function" ? this.valueFormatter(value) : this.localize.number(value)}
1582
+ </span>
1583
+ </sigvelo-tooltip>
1584
+ ` : "";
1585
+ if (this.isRange) {
1586
+ const minThumbPosition = clamp(this.getPercentageFromValue(this.rangeStart), 0, 100);
1587
+ const maxThumbPosition = clamp(this.getPercentageFromValue(this.rangeEnd), 0, 100);
1588
+ return html`
1589
+ ${labelAndDescription}
1590
+
1591
+ <div id="slider" part="slider" class=${sliderClasses}>
1592
+ <div id="track" part="track">
1593
+ <div
1594
+ id="indicator"
1595
+ part="indicator"
1596
+ style="--start: ${Math.min(minThumbPosition, maxThumbPosition)}%; --end: ${Math.max(minThumbPosition, maxThumbPosition)}%"
1597
+ ></div>
1598
+
1599
+ ${markersTemplate}
1600
+
1601
+ <span
1602
+ id="thumb-min"
1603
+ part="thumb thumb-min"
1604
+ style="--position: ${minThumbPosition}%"
1605
+ role="slider"
1606
+ aria-valuemin=${this.min}
1607
+ aria-valuenow=${this.rangeStart}
1608
+ aria-valuetext=${typeof this.valueFormatter === "function" ? this.valueFormatter(this.rangeStart) : this.localize.number(this.rangeStart)}
1609
+ aria-valuemax=${this.rangeEnd}
1610
+ aria-label="${this.label ? `${this.label} (minimum value)` : "Minimum value"}"
1611
+ aria-describedby="description"
1612
+ aria-orientation=${this.orientation}
1613
+ aria-disabled=${this.disabled ? "true" : "false"}
1614
+ aria-readonly=${this.readonly ? "true" : "false"}
1615
+ tabindex=${this.disabled ? -1 : 0}
1616
+ @blur=${this.handleBlur}
1617
+ @focus=${this.handleFocus}
1618
+ @keydown=${this.handleKeyDown}
1619
+ ></span>
1620
+
1621
+ <span
1622
+ id="thumb-max"
1623
+ part="thumb thumb-max"
1624
+ style="--position: ${maxThumbPosition}%"
1625
+ role="slider"
1626
+ aria-valuemin=${this.rangeStart}
1627
+ aria-valuenow=${this.rangeEnd}
1628
+ aria-valuetext=${typeof this.valueFormatter === "function" ? this.valueFormatter(this.rangeEnd) : this.localize.number(this.rangeEnd)}
1629
+ aria-valuemax=${this.max}
1630
+ aria-label="${this.label ? `${this.label} (maximum value)` : "Maximum value"}"
1631
+ aria-describedby="description"
1632
+ aria-orientation=${this.orientation}
1633
+ aria-disabled=${this.disabled ? "true" : "false"}
1634
+ aria-readonly=${this.readonly ? "true" : "false"}
1635
+ tabindex=${this.disabled ? -1 : 0}
1636
+ @blur=${this.handleBlur}
1637
+ @focus=${this.handleFocus}
1638
+ @keydown=${this.handleKeyDown}
1639
+ ></span>
1640
+ </div>
1641
+
1642
+ ${referencesTemplate}
1643
+ </div>
1644
+
1645
+ ${createTooltip("thumb-min", this.rangeStart)} ${createTooltip("thumb-max", this.rangeEnd)}
1646
+ `;
1647
+ } else {
1648
+ const thumbPosition = clamp(this.getPercentageFromValue(this.singleValue), 0, 100);
1649
+ const indicatorOffsetPosition = clamp(this.getPercentageFromValue(typeof this.indicatorOffset === "number" ? this.indicatorOffset : this.min), 0, 100);
1650
+ return html`
1651
+ ${labelAndDescription}
1652
+
1653
+ <div
1654
+ id="slider"
1655
+ part="slider"
1656
+ class=${sliderClasses}
1657
+ role="slider"
1658
+ aria-disabled=${this.disabled ? "true" : "false"}
1659
+ aria-readonly=${this.readonly ? "true" : "false"}
1660
+ aria-orientation=${this.orientation}
1661
+ aria-valuemin=${this.min}
1662
+ aria-valuenow=${this.singleValue}
1663
+ aria-valuetext=${typeof this.valueFormatter === "function" ? this.valueFormatter(this.singleValue) : this.localize.number(this.singleValue)}
1664
+ aria-valuemax=${this.max}
1665
+ aria-labelledby="label"
1666
+ aria-describedby="description"
1667
+ tabindex=${this.disabled ? -1 : 0}
1668
+ @blur=${this.handleBlur}
1669
+ @focus=${this.handleFocus}
1670
+ @keydown=${this.handleKeyDown}
1671
+ >
1672
+ <div id="track" part="track">
1673
+ <div
1674
+ id="indicator"
1675
+ part="indicator"
1676
+ style="--start: ${indicatorOffsetPosition}%; --end: ${thumbPosition}%"
1677
+ ></div>
1678
+
1679
+ ${markersTemplate}
1680
+ <span id="thumb" part="thumb" style="--position: ${thumbPosition}%"></span>
1681
+ </div>
1682
+
1683
+ ${referencesTemplate}
1684
+ </div>
1685
+
1686
+ ${createTooltip("thumb", this.singleValue)}
1687
+ `;
1688
+ }
1689
+ }
1690
+ };
1691
+ __decorate([query("#slider")], SigveloSlider.prototype, "slider", void 0);
1692
+ __decorate([query("#thumb")], SigveloSlider.prototype, "thumb", void 0);
1693
+ __decorate([query("#thumb-min")], SigveloSlider.prototype, "thumbMin", void 0);
1694
+ __decorate([query("#thumb-max")], SigveloSlider.prototype, "thumbMax", void 0);
1695
+ __decorate([query("#track")], SigveloSlider.prototype, "track", void 0);
1696
+ __decorate([query("#tooltip")], SigveloSlider.prototype, "tooltip", void 0);
1697
+ __decorate([query("#tooltip-thumb-min")], SigveloSlider.prototype, "tooltipMin", void 0);
1698
+ __decorate([query("#tooltip-thumb-max")], SigveloSlider.prototype, "tooltipMax", void 0);
1699
+ __decorate([state()], SigveloSlider.prototype, "isInvalid", void 0);
1700
+ __decorate([state()], SigveloSlider.prototype, "hadUserInteraction", void 0);
1701
+ __decorate([state()], SigveloSlider.prototype, "wasSubmitted", void 0);
1702
+ __decorate([property()], SigveloSlider.prototype, "label", void 0);
1703
+ __decorate([property()], SigveloSlider.prototype, "description", void 0);
1704
+ __decorate([property({ reflect: true })], SigveloSlider.prototype, "name", void 0);
1705
+ __decorate([property({ type: Number })], SigveloSlider.prototype, "value", void 0);
1706
+ __decorate([property({
1707
+ type: Boolean,
1708
+ reflect: true
1709
+ })], SigveloSlider.prototype, "disabled", void 0);
1710
+ __decorate([property({
1711
+ type: Boolean,
1712
+ reflect: true
1713
+ })], SigveloSlider.prototype, "readonly", void 0);
1714
+ __decorate([property({ reflect: true })], SigveloSlider.prototype, "orientation", void 0);
1715
+ __decorate([property({ reflect: true })], SigveloSlider.prototype, "size", void 0);
1716
+ __decorate([property({
1717
+ attribute: "indicator-offset",
1718
+ type: Number
1719
+ })], SigveloSlider.prototype, "indicatorOffset", void 0);
1720
+ __decorate([property()], SigveloSlider.prototype, "form", void 0);
1721
+ __decorate([property({ type: Number })], SigveloSlider.prototype, "min", void 0);
1722
+ __decorate([property({ type: Number })], SigveloSlider.prototype, "max", void 0);
1723
+ __decorate([property({ type: Number })], SigveloSlider.prototype, "step", void 0);
1724
+ __decorate([property({ type: Boolean })], SigveloSlider.prototype, "autofocus", void 0);
1725
+ __decorate([property({
1726
+ attribute: "tooltip-distance",
1727
+ type: Number
1728
+ })], SigveloSlider.prototype, "tooltipDistance", void 0);
1729
+ __decorate([property({
1730
+ attribute: "tooltip-placement",
1731
+ reflect: true
1732
+ })], SigveloSlider.prototype, "tooltipPlacement", void 0);
1733
+ __decorate([property({
1734
+ attribute: "with-markers",
1735
+ type: Boolean
1736
+ })], SigveloSlider.prototype, "withMarkers", void 0);
1737
+ __decorate([property({
1738
+ attribute: "with-tooltip",
1739
+ type: Boolean
1740
+ })], SigveloSlider.prototype, "withTooltip", void 0);
1741
+ __decorate([property({ attribute: false })], SigveloSlider.prototype, "valueFormatter", void 0);
1742
+ customElements.define("sigvelo-slider", SigveloSlider);
1743
+ //#endregion
1744
+ export { SigveloSlider as t };