@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.
- package/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/accordion-B1Q3kuP_.d.ts +373 -0
- package/dist/accordion-item-DvPfhpm8.js +307 -0
- package/dist/accordion-item-bPRIahNn.d.ts +63 -0
- package/dist/accordion-zDr-Br4V.js +483 -0
- package/dist/action-bar-CYsjmhwP.d.ts +29 -0
- package/dist/action-bar-CjN_UcnP.js +56 -0
- package/dist/alert-dialog-4CnO3Nb5.d.ts +60 -0
- package/dist/alert-dialog-D25Oi_TS.js +126 -0
- package/dist/avatar-Bje_KpZo.d.ts +141 -0
- package/dist/avatar-CRP0kW3x.js +224 -0
- package/dist/badge-Ct95U4UO.js +301 -0
- package/dist/badge-D1DNQrWn.d.ts +106 -0
- package/dist/breadcrumb-BxZ-nQE5.d.ts +365 -0
- package/dist/breadcrumb-item-BC454oQe.d.ts +59 -0
- package/dist/breadcrumb-item-P5pdq_gE.js +151 -0
- package/dist/breadcrumb-uURhiqWJ.js +384 -0
- package/dist/button-5k_aL_gD.js +802 -0
- package/dist/button-BQofnUt4.d.ts +354 -0
- package/dist/button-group-BydvJTQy.js +197 -0
- package/dist/button-group-COodHeuB.d.ts +155 -0
- package/dist/callout-B8zTf8Go.js +188 -0
- package/dist/callout-DFwPao36.d.ts +103 -0
- package/dist/card-BYDzdMAU.d.ts +177 -0
- package/dist/card-DIg1-X2G.js +332 -0
- package/dist/carousel-Bktu7wrD.js +843 -0
- package/dist/carousel-DQITCtEY.d.ts +423 -0
- package/dist/carousel-item-B5-X31Ha.js +79 -0
- package/dist/carousel-item-BB3jL2tk.d.ts +34 -0
- package/dist/cdn/loader.js +530 -0
- package/dist/checkbox-D6r7PVPj.js +641 -0
- package/dist/checkbox-DoFcDEKB.d.ts +354 -0
- package/dist/checkbox-group-CLvNAO_F.js +201 -0
- package/dist/checkbox-group-Cnh8rAn4.d.ts +152 -0
- package/dist/color-input-Bky89xg_.d.ts +470 -0
- package/dist/color-input-DPIxi9wR.js +894 -0
- package/dist/color-picker-adwOmtRl.js +1240 -0
- package/dist/color-picker-wQw8bPsq.d.ts +360 -0
- package/dist/combobox-B6al50UG.js +1693 -0
- package/dist/combobox-item-D2H1CMxC.d.ts +714 -0
- package/dist/combobox-item-yM6tDrGG.js +225 -0
- package/dist/comparison-B1-nMwmp.d.ts +134 -0
- package/dist/comparison-CyqKrCN-.js +435 -0
- package/dist/components/accordion/accordion.d.ts +2 -0
- package/dist/components/accordion/accordion.js +2 -0
- package/dist/components/accordion-item/accordion-item.d.ts +2 -0
- package/dist/components/accordion-item/accordion-item.js +2 -0
- package/dist/components/action-bar/action-bar.d.ts +2 -0
- package/dist/components/action-bar/action-bar.js +2 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +2 -0
- package/dist/components/alert-dialog/alert-dialog.js +2 -0
- package/dist/components/avatar/avatar.d.ts +2 -0
- package/dist/components/avatar/avatar.js +2 -0
- package/dist/components/badge/badge.d.ts +2 -0
- package/dist/components/badge/badge.js +2 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +2 -0
- package/dist/components/breadcrumb/breadcrumb.js +2 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +2 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.js +2 -0
- package/dist/components/button/button.d.ts +2 -0
- package/dist/components/button/button.js +2 -0
- package/dist/components/button-group/button-group.d.ts +2 -0
- package/dist/components/button-group/button-group.js +2 -0
- package/dist/components/callout/callout.d.ts +2 -0
- package/dist/components/callout/callout.js +2 -0
- package/dist/components/card/card.d.ts +2 -0
- package/dist/components/card/card.js +2 -0
- package/dist/components/carousel/carousel.d.ts +2 -0
- package/dist/components/carousel/carousel.js +2 -0
- package/dist/components/carousel-item/carousel-item.d.ts +2 -0
- package/dist/components/carousel-item/carousel-item.js +2 -0
- package/dist/components/checkbox/checkbox.d.ts +2 -0
- package/dist/components/checkbox/checkbox.js +2 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +2 -0
- package/dist/components/checkbox-group/checkbox-group.js +2 -0
- package/dist/components/color-input/color-input.d.ts +2 -0
- package/dist/components/color-input/color-input.js +2 -0
- package/dist/components/color-picker/color-picker.d.ts +2 -0
- package/dist/components/color-picker/color-picker.js +2 -0
- package/dist/components/combobox/combobox.d.ts +2 -0
- package/dist/components/combobox/combobox.js +2 -0
- package/dist/components/combobox-item/combobox-item.d.ts +2 -0
- package/dist/components/combobox-item/combobox-item.js +2 -0
- package/dist/components/comparison/comparison.d.ts +2 -0
- package/dist/components/comparison/comparison.js +2 -0
- package/dist/components/copy/copy.d.ts +2 -0
- package/dist/components/copy/copy.js +291 -0
- package/dist/components/data-table/data-table.d.ts +2 -0
- package/dist/components/data-table/data-table.js +2 -0
- package/dist/components/date/date.d.ts +2 -0
- package/dist/components/date/date.js +2 -0
- package/dist/components/dialog/dialog.d.ts +2 -0
- package/dist/components/dialog/dialog.js +2 -0
- package/dist/components/divider/divider.d.ts +2 -0
- package/dist/components/divider/divider.js +2 -0
- package/dist/components/dropdown/dropdown.d.ts +2 -0
- package/dist/components/dropdown/dropdown.js +2 -0
- package/dist/components/dropdown-item/dropdown-item.d.ts +2 -0
- package/dist/components/dropdown-item/dropdown-item.js +2 -0
- package/dist/components/empty-result/empty-result.d.ts +2 -0
- package/dist/components/empty-result/empty-result.js +2 -0
- package/dist/components/empty-state/empty-state.d.ts +2 -0
- package/dist/components/empty-state/empty-state.js +2 -0
- package/dist/components/expander/expander.d.ts +2 -0
- package/dist/components/expander/expander.js +2 -0
- package/dist/components/field/field.d.ts +2 -0
- package/dist/components/field/field.js +2 -0
- package/dist/components/file-input/file-input.d.ts +2 -0
- package/dist/components/file-input/file-input.js +2 -0
- package/dist/components/filter-bar/filter-bar.d.ts +2 -0
- package/dist/components/filter-bar/filter-bar.js +2 -0
- package/dist/components/form-section/form-section.d.ts +2 -0
- package/dist/components/form-section/form-section.js +2 -0
- package/dist/components/icon/icon.d.ts +2 -0
- package/dist/components/icon/icon.js +2 -0
- package/dist/components/include/include.d.ts +2 -0
- package/dist/components/include/include.js +2 -0
- package/dist/components/index.d.ts +85 -0
- package/dist/components/index.js +86 -0
- package/dist/components/infinite-scroller/infinite-scroller.d.ts +2 -0
- package/dist/components/infinite-scroller/infinite-scroller.js +2 -0
- package/dist/components/intersection-observer/intersection-observer.d.ts +2 -0
- package/dist/components/intersection-observer/intersection-observer.js +2 -0
- package/dist/components/listbox/listbox.d.ts +2 -0
- package/dist/components/listbox/listbox.js +2 -0
- package/dist/components/listbox-item/listbox-item.d.ts +2 -0
- package/dist/components/listbox-item/listbox-item.js +2 -0
- package/dist/components/lorem-ipsum/lorem-ipsum.d.ts +2 -0
- package/dist/components/lorem-ipsum/lorem-ipsum.js +2 -0
- package/dist/components/meter/meter.d.ts +2 -0
- package/dist/components/meter/meter.js +2 -0
- package/dist/components/metric/metric.d.ts +2 -0
- package/dist/components/metric/metric.js +2 -0
- package/dist/components/metric-grid/metric-grid.d.ts +2 -0
- package/dist/components/metric-grid/metric-grid.js +2 -0
- package/dist/components/mutation-observer/mutation-observer.d.ts +2 -0
- package/dist/components/mutation-observer/mutation-observer.js +2 -0
- package/dist/components/navicon/navicon.d.ts +2 -0
- package/dist/components/navicon/navicon.js +2 -0
- package/dist/components/number/number.d.ts +2 -0
- package/dist/components/number/number.js +2 -0
- package/dist/components/number-field/number-field.d.ts +2 -0
- package/dist/components/number-field/number-field.js +2 -0
- package/dist/components/pagination/pagination.d.ts +2 -0
- package/dist/components/pagination/pagination.js +2 -0
- package/dist/components/popover/popover.d.ts +2 -0
- package/dist/components/popover/popover.js +2 -0
- package/dist/components/preview-card/preview-card.d.ts +2 -0
- package/dist/components/preview-card/preview-card.js +2 -0
- package/dist/components/progress/progress.d.ts +2 -0
- package/dist/components/progress/progress.js +2 -0
- package/dist/components/radio/radio.d.ts +2 -0
- package/dist/components/radio/radio.js +2 -0
- package/dist/components/radio-item/radio-item.d.ts +2 -0
- package/dist/components/radio-item/radio-item.js +2 -0
- package/dist/components/random-content/random-content.d.ts +2 -0
- package/dist/components/random-content/random-content.js +2 -0
- package/dist/components/rating/rating.d.ts +2 -0
- package/dist/components/rating/rating.js +2 -0
- package/dist/components/resize-observer/resize-observer.d.ts +2 -0
- package/dist/components/resize-observer/resize-observer.js +2 -0
- package/dist/components/scroll-area/scroll-area.d.ts +2 -0
- package/dist/components/scroll-area/scroll-area.js +2 -0
- package/dist/components/scroller/scroller.d.ts +2 -0
- package/dist/components/scroller/scroller.js +2 -0
- package/dist/components/search-list/search-list.d.ts +2 -0
- package/dist/components/search-list/search-list.js +2 -0
- package/dist/components/select/select.d.ts +2 -0
- package/dist/components/select/select.js +2 -0
- package/dist/components/selection-summary/selection-summary.d.ts +2 -0
- package/dist/components/selection-summary/selection-summary.js +2 -0
- package/dist/components/share/share.d.ts +2 -0
- package/dist/components/share/share.js +2 -0
- package/dist/components/slide-activator/slide-activator.d.ts +2 -0
- package/dist/components/slide-activator/slide-activator.js +2 -0
- package/dist/components/slider/slider.d.ts +2 -0
- package/dist/components/slider/slider.js +2 -0
- package/dist/components/sparkline/sparkline.d.ts +2 -0
- package/dist/components/sparkline/sparkline.js +2 -0
- package/dist/components/spinner/spinner.d.ts +2 -0
- package/dist/components/spinner/spinner.js +2 -0
- package/dist/components/splitter/splitter.d.ts +2 -0
- package/dist/components/splitter/splitter.js +2 -0
- package/dist/components/switch/switch.d.ts +2 -0
- package/dist/components/switch/switch.js +2 -0
- package/dist/components/tab/tab.d.ts +2 -0
- package/dist/components/tab/tab.js +2 -0
- package/dist/components/tab-list/tab-list.d.ts +2 -0
- package/dist/components/tab-list/tab-list.js +2 -0
- package/dist/components/tab-panel/tab-panel.d.ts +2 -0
- package/dist/components/tab-panel/tab-panel.js +2 -0
- package/dist/components/text-area/text-area.d.ts +2 -0
- package/dist/components/text-area/text-area.js +2 -0
- package/dist/components/text-field/text-field.d.ts +2 -0
- package/dist/components/text-field/text-field.js +2 -0
- package/dist/components/text-mask/text-mask.d.ts +2 -0
- package/dist/components/text-mask/text-mask.js +2 -0
- package/dist/components/timed-content/timed-content.d.ts +2 -0
- package/dist/components/timed-content/timed-content.js +2 -0
- package/dist/components/toast/toast.d.ts +2 -0
- package/dist/components/toast/toast.js +2 -0
- package/dist/components/toast-item/toast-item.d.ts +2 -0
- package/dist/components/toast-item/toast-item.js +2 -0
- package/dist/components/toggle-icon/toggle-icon.d.ts +2 -0
- package/dist/components/toggle-icon/toggle-icon.js +2 -0
- package/dist/components/toggle-tag/toggle-tag.d.ts +2 -0
- package/dist/components/toggle-tag/toggle-tag.js +2 -0
- package/dist/components/toolbar/toolbar.d.ts +2 -0
- package/dist/components/toolbar/toolbar.js +2 -0
- package/dist/components/tooltip/tooltip.d.ts +2 -0
- package/dist/components/tooltip/tooltip.js +2 -0
- package/dist/components/transition-group/transition-group.d.ts +2 -0
- package/dist/components/transition-group/transition-group.js +2 -0
- package/dist/components/zoomable-frame/zoomable-frame.d.ts +2 -0
- package/dist/components/zoomable-frame/zoomable-frame.js +2 -0
- package/dist/copy-CvC9vaGw.d.ts +206 -0
- package/dist/copy.styles-DWGvGNTP.js +100 -0
- package/dist/data-table-CITa8DSn.js +247 -0
- package/dist/data-table-DL5RhE0d.d.ts +89 -0
- package/dist/date-CJPmOdi9.js +146 -0
- package/dist/date-DtaTBM71.d.ts +142 -0
- package/dist/decorate-DcF3lt7P.js +9 -0
- package/dist/dialog-Cx46HMaZ.js +983 -0
- package/dist/dialog-N-v0woIy.d.ts +414 -0
- package/dist/divider-9vNsfHW8.js +169 -0
- package/dist/divider-DWuAxcXv.d.ts +79 -0
- package/dist/docs/custom-elements.json +29301 -0
- package/dist/dropdown-BXSKpVX9.js +1123 -0
- package/dist/dropdown-Bo00Vlr5.d.ts +537 -0
- package/dist/dropdown-item-_lIs-Tfd.d.ts +111 -0
- package/dist/dropdown-item-i77cRuN6.js +504 -0
- package/dist/empty-result-B2ln1yFL.js +65 -0
- package/dist/empty-result-B54x_Ab2.d.ts +31 -0
- package/dist/empty-state-BLWjtKUo.js +186 -0
- package/dist/empty-state-SGKjpwp3.d.ts +117 -0
- package/dist/expander-BUev0BmM.d.ts +174 -0
- package/dist/expander-Bwvxj6Oa.js +342 -0
- package/dist/field-BEyS909F.js +163 -0
- package/dist/field-ITx0jVw-.d.ts +69 -0
- package/dist/file-input-BEumLJjg.js +841 -0
- package/dist/file-input-D2D6YC0B.d.ts +378 -0
- package/dist/filter-bar-Bj2QzEn9.d.ts +35 -0
- package/dist/filter-bar-Dcs67aXo.js +66 -0
- package/dist/form-section-BchPetkj.js +83 -0
- package/dist/form-section-xFBTBULQ.d.ts +34 -0
- package/dist/icon-BPVkNsY4.js +165 -0
- package/dist/icon-Ci9CPZJV.d.ts +72 -0
- package/dist/icon-library-D_if7p2h.d.ts +2 -0
- package/dist/include-CQHVVtNs.d.ts +103 -0
- package/dist/include-qNUh_6kT.js +155 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +92 -0
- package/dist/infinite-scroller-BmmtnWNt.js +285 -0
- package/dist/infinite-scroller-CuUEAlB9.d.ts +174 -0
- package/dist/intersection-observer-B6TciOAQ.js +503 -0
- package/dist/intersection-observer-B7nmP7Zz.d.ts +418 -0
- package/dist/listbox-C3XXRWGX.js +1257 -0
- package/dist/listbox-DD4ujIJe.d.ts +682 -0
- package/dist/listbox-item-CwD9s3VY.js +135 -0
- package/dist/listbox-item-DQEJWp4Z.d.ts +53 -0
- package/dist/localize-322EtXNX.d.ts +66 -0
- package/dist/lorem-ipsum-B2x3V-v8.js +198 -0
- package/dist/lorem-ipsum-CR82CSuJ.d.ts +130 -0
- package/dist/meter-BC7uaJWf.d.ts +73 -0
- package/dist/meter-BIDyjwFp.js +155 -0
- package/dist/metric-CjlLq_VA.d.ts +36 -0
- package/dist/metric-DbuOcDp_.js +86 -0
- package/dist/metric-grid-C2Pb0Zl3.js +37 -0
- package/dist/metric-grid-C5Xbb1_0.d.ts +27 -0
- package/dist/mutation-observer-BmrZ-GER.d.ts +326 -0
- package/dist/mutation-observer-DS8EBuOp.js +388 -0
- package/dist/navicon-Dic5Qjzb.d.ts +159 -0
- package/dist/navicon-_yMHY27-.js +486 -0
- package/dist/number-BNtNXNF3.js +162 -0
- package/dist/number-BwbnErlB.d.ts +143 -0
- package/dist/number-field-BQHB7UYo.js +726 -0
- package/dist/number-field-odk4lKXM.d.ts +422 -0
- package/dist/pagination-6z2qcf3U.d.ts +322 -0
- package/dist/pagination-DuKPuzdb.js +679 -0
- package/dist/popover-D0sxTU6o.d.ts +259 -0
- package/dist/popover-DJBrJ0za.js +556 -0
- package/dist/preview-card-C7H1FPfd.js +287 -0
- package/dist/preview-card-DitOCZTD.d.ts +86 -0
- package/dist/progress-Db0_axHQ.d.ts +181 -0
- package/dist/progress-DzVk260j.js +494 -0
- package/dist/radio-BtDG9xJM.js +658 -0
- package/dist/radio-CieMa4zU.d.ts +460 -0
- package/dist/radio-item-DIrUStAX.js +264 -0
- package/dist/radio-item-Xq2U3cMu.d.ts +69 -0
- package/dist/random-content-BhSeJFKz.d.ts +380 -0
- package/dist/random-content-BwiirXdG.js +450 -0
- package/dist/rating-4xNsWumY.d.ts +369 -0
- package/dist/rating-C1BcJDIO.js +722 -0
- package/dist/resize-observer-BseSbVWP.d.ts +187 -0
- package/dist/resize-observer-DcrLhddo.js +236 -0
- package/dist/scroll-area-COc1857S.js +127 -0
- package/dist/scroll-area-CVYDf5qY.d.ts +61 -0
- package/dist/scroller-LYgBVyfY.js +590 -0
- package/dist/scroller-bB2rGs7b.d.ts +374 -0
- package/dist/search-list-Clmrg8EV.js +884 -0
- package/dist/search-list-n0GYO7rh.d.ts +777 -0
- package/dist/select-CkZK2jJn.d.ts +506 -0
- package/dist/select-DLIaRnA4.js +690 -0
- package/dist/selection-summary-BVnNJ8Lw.js +48 -0
- package/dist/selection-summary-DmFkGyZI.d.ts +34 -0
- package/dist/share-DPlqP2dc.d.ts +162 -0
- package/dist/share-bsgXZCl7.js +250 -0
- package/dist/sigvelo.d.ts +5 -0
- package/dist/sigvelo.js +5 -0
- package/dist/sigvelo.loader.d.ts +3 -0
- package/dist/sigvelo.loader.js +102 -0
- package/dist/slide-activator-D7bBz69E.d.ts +429 -0
- package/dist/slide-activator-DlxQt9R9.js +798 -0
- package/dist/slider-B0FVsV1o.d.ts +921 -0
- package/dist/slider-B90Il7x3.js +1744 -0
- package/dist/sparkline-CcpTaJ_Z.js +358 -0
- package/dist/sparkline-DlCIt81-.d.ts +235 -0
- package/dist/spinner-C04Dmc0H.js +188 -0
- package/dist/spinner-CZ19x_dC.d.ts +99 -0
- package/dist/splitter-DBDJAzsp.d.ts +325 -0
- package/dist/splitter-MnD4In9H.js +638 -0
- package/dist/switch-CPaEKbog.js +581 -0
- package/dist/switch-Cief9M59.d.ts +248 -0
- package/dist/tab-BcqYGsuW.d.ts +44 -0
- package/dist/tab-C-FtuNmh.js +102 -0
- package/dist/tab-list-B_Ye_Oj9.js +691 -0
- package/dist/tab-list-DDvS8qHr.d.ts +450 -0
- package/dist/tab-panel-BaBl6eep.js +60 -0
- package/dist/tab-panel-BzSJlSfd.d.ts +38 -0
- package/dist/text-area-B_mjCE9W.d.ts +327 -0
- package/dist/text-area-Czixaz-_.js +556 -0
- package/dist/text-field-BClWMp6q.d.ts +424 -0
- package/dist/text-field-inpJfp0A.js +687 -0
- package/dist/text-mask-CNKVKSFp.d.ts +336 -0
- package/dist/text-mask-DDEurj90.js +370 -0
- package/dist/themes/sigvelo.css +10 -0
- package/dist/themes/utilities.css +9 -0
- package/dist/timed-content-D2mGFamc.d.ts +181 -0
- package/dist/timed-content-pvEP4l5V.js +226 -0
- package/dist/toast-BnZaIg6Z.js +636 -0
- package/dist/toast-cEBVK9NQ.d.ts +487 -0
- package/dist/toast-item-BPpJT6vD.d.ts +159 -0
- package/dist/toast-item-IS8IFUEg.js +372 -0
- package/dist/toggle-icon-4oLDeEt4.js +752 -0
- package/dist/toggle-icon-DlwMMWZL.d.ts +359 -0
- package/dist/toggle-tag-1sfTFJtg.js +434 -0
- package/dist/toggle-tag-IVvMGT4R.d.ts +245 -0
- package/dist/toolbar-CABq0ZL1.d.ts +122 -0
- package/dist/toolbar-CEZ0-F-X.js +196 -0
- package/dist/tooltip-DbyoPFNe.js +521 -0
- package/dist/tooltip-ahFthek8.d.ts +192 -0
- package/dist/transition-group-3hnAnwSd.js +801 -0
- package/dist/transition-group-DD_CjSNC.d.ts +608 -0
- package/dist/translations/en.d.ts +6 -0
- package/dist/translations/en.js +75 -0
- package/dist/translations/es.d.ts +6 -0
- package/dist/translations/es.js +75 -0
- package/dist/types/custom-element-jsx.d.ts +13723 -0
- package/dist/utilities/icon-library.d.ts +3 -0
- package/dist/utilities/icon-library.js +93 -0
- package/dist/utilities/localize.d.ts +2 -0
- package/dist/utilities/localize.js +6 -0
- package/dist/zoomable-frame-Cldvj5sE.js +398 -0
- package/dist/zoomable-frame-r6S6587z.d.ts +162 -0
- package/package.json +83 -0
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
import { t as SigveloTooltip } from "./tooltip-ahFthek8.js";
|
|
2
|
+
import { CSSResultGroup, PropertyValues } from "lit";
|
|
3
|
+
import { SigveloFormControlElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
4
|
+
|
|
5
|
+
//#region src/components/slider/slider.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* <sigvelo-slider>
|
|
8
|
+
*
|
|
9
|
+
* @summary Allows users to select numeric values within a given range by moving a thumb along a track.
|
|
10
|
+
* @tag sigvelo-slider
|
|
11
|
+
* @documentation https://design-system.sigvelo.com/docs/components/slider
|
|
12
|
+
* @status stable
|
|
13
|
+
* @since 1.0
|
|
14
|
+
*
|
|
15
|
+
* @dependency sigvelo-tooltip
|
|
16
|
+
*
|
|
17
|
+
* @slot label - The slider's label. For plain-text labels, you can use the `label` attribute instead.
|
|
18
|
+
* @slot description - The slider's description. For plain-text descriptions, you can use the `description` attribute
|
|
19
|
+
* instead.
|
|
20
|
+
* @slot reference - One or more reference labels to show visually below the slider.
|
|
21
|
+
*
|
|
22
|
+
* @event sigvelo-blur - Emitted when the slider loses focus. This event does not bubble.
|
|
23
|
+
* @event sigvelo-change - Emitted when the user commits changes to the slider's value.
|
|
24
|
+
* @event sigvelo-focus - Emitted when the slider receives focus. This event does not bubble.
|
|
25
|
+
* @event sigvelo-input - Emitted when the slider receives input.
|
|
26
|
+
*
|
|
27
|
+
* @csspart label - The element that contains the sliders's label.
|
|
28
|
+
* @csspart description - The element that contains the slider's description.
|
|
29
|
+
* @csspart slider - The focusable element with `role="slider"`. Contains the track and reference slot.
|
|
30
|
+
* @csspart track - The slider's track.
|
|
31
|
+
* @csspart indicator - The colored indicator that shows from the start of the slider to the current value.
|
|
32
|
+
* @csspart markers - The container that holds all the markers when `with-markers` is used.
|
|
33
|
+
* @csspart marker - The individual markers that are shown when `with-markers` is used.
|
|
34
|
+
* @csspart references - The container that holds references that get slotted in.
|
|
35
|
+
* @csspart thumb - The slider's thumb.
|
|
36
|
+
* @csspart thumb-min - The min value thumb in a range slider.
|
|
37
|
+
* @csspart thumb-max - The max value thumb in a range slider.
|
|
38
|
+
* @csspart tooltip - The tooltip, a `<sigvelo-tooltip>` element.
|
|
39
|
+
* @csspart tooltip__tooltip - The tooltip's `tooltip` part.
|
|
40
|
+
* @csspart tooltip__content - The tooltip's `content` part.
|
|
41
|
+
* @csspart tooltip__arrow - The tooltip's `arrow` part.
|
|
42
|
+
*
|
|
43
|
+
* @cssstate disabled - Applied when the slider is disabled.
|
|
44
|
+
* @cssstate dragging - Applied when the slider is being dragged.
|
|
45
|
+
* @cssstate focused - Applied when the slider has focus.
|
|
46
|
+
* @cssstate user-valid - Applied when the slider is valid and the user has sufficiently interacted with it.
|
|
47
|
+
* @cssstate user-invalid - Applied when the slider is invalid and the user has sufficiently interacted with it.
|
|
48
|
+
*
|
|
49
|
+
* @cssproperty [--track-size=0.75em] - The height or width of the slider's track.
|
|
50
|
+
* @cssproperty [--marker-width=0.1875em] - The width of each individual marker.
|
|
51
|
+
* @cssproperty [--marker-height=0.1875em] - The height of each individual marker.
|
|
52
|
+
* @cssproperty [--thumb-width=1.25em] - The width of the thumb.
|
|
53
|
+
* @cssproperty [--thumb-height=1.25em] - The height of the thumb.
|
|
54
|
+
*
|
|
55
|
+
* @example Default
|
|
56
|
+
* ```html
|
|
57
|
+
* <sigvelo-slider
|
|
58
|
+
* label="Number of cats"
|
|
59
|
+
* description="Limit six per household"
|
|
60
|
+
* name="value"
|
|
61
|
+
* value="3"
|
|
62
|
+
* min="0"
|
|
63
|
+
* max="6"
|
|
64
|
+
* with-markers
|
|
65
|
+
* with-tooltip
|
|
66
|
+
* >
|
|
67
|
+
* <span slot="reference">Less</span>
|
|
68
|
+
* <span slot="reference">More</span>
|
|
69
|
+
* </sigvelo-slider>
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example Showing tooltips
|
|
73
|
+
* Add the `with-tooltip` attribute to show a tooltip when the slider has focus or is dragged.
|
|
74
|
+
*
|
|
75
|
+
* ```html
|
|
76
|
+
* <sigvelo-slider
|
|
77
|
+
* label="Quality"
|
|
78
|
+
* name="quality"
|
|
79
|
+
* min="0"
|
|
80
|
+
* max="100"
|
|
81
|
+
* value="50"
|
|
82
|
+
* with-tooltip
|
|
83
|
+
* ></sigvelo-slider>
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @example Setting min, max, and step
|
|
87
|
+
* 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.
|
|
88
|
+
*
|
|
89
|
+
* ```html
|
|
90
|
+
* <sigvelo-slider
|
|
91
|
+
* label="Between zero and one"
|
|
92
|
+
* min="0"
|
|
93
|
+
* max="1"
|
|
94
|
+
* step="0.1"
|
|
95
|
+
* value="0.5"
|
|
96
|
+
* with-tooltip
|
|
97
|
+
* ></sigvelo-slider>
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example Showing markers
|
|
101
|
+
* Add the `with-markers` attribute to show visual markers at each step. Markers work best with sliders that have shorter ranges.
|
|
102
|
+
*
|
|
103
|
+
* ```html
|
|
104
|
+
* <sigvelo-slider
|
|
105
|
+
* label="Size"
|
|
106
|
+
* name="size"
|
|
107
|
+
* min="0"
|
|
108
|
+
* max="8"
|
|
109
|
+
* value="4"
|
|
110
|
+
* with-markers
|
|
111
|
+
* ></sigvelo-slider>
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @example Adding references
|
|
115
|
+
* 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.
|
|
116
|
+
*
|
|
117
|
+
* ```html
|
|
118
|
+
* <sigvelo-slider
|
|
119
|
+
* label="Speed"
|
|
120
|
+
* name="speed"
|
|
121
|
+
* min="1"
|
|
122
|
+
* max="5"
|
|
123
|
+
* value="3"
|
|
124
|
+
* with-markers
|
|
125
|
+
* >
|
|
126
|
+
* <span slot="reference">Slow</span>
|
|
127
|
+
* <span slot="reference">Medium</span>
|
|
128
|
+
* <span slot="reference">Fast</span>
|
|
129
|
+
* </sigvelo-slider>
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* **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.
|
|
133
|
+
*
|
|
134
|
+
* @example Formatting the value
|
|
135
|
+
* 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.
|
|
136
|
+
*
|
|
137
|
+
* ```html
|
|
138
|
+
* <!-- Percent -->
|
|
139
|
+
* <sigvelo-slider
|
|
140
|
+
* id="slider__percent"
|
|
141
|
+
* label="Percentage"
|
|
142
|
+
* name="percentage"
|
|
143
|
+
* value="0.5"
|
|
144
|
+
* min="0"
|
|
145
|
+
* max="1"
|
|
146
|
+
* step=".01"
|
|
147
|
+
* with-tooltip
|
|
148
|
+
* ></sigvelo-slider><br>
|
|
149
|
+
*
|
|
150
|
+
* <script>
|
|
151
|
+
* const slider = document.getElementById('slider__percent');
|
|
152
|
+
* const formatter = new Intl.NumberFormat('en-US', { style: 'percent' });
|
|
153
|
+
*
|
|
154
|
+
* customElements.whenDefined('sigvelo-slider').then(() => {
|
|
155
|
+
* slider.valueFormatter = value => formatter.format(value);
|
|
156
|
+
* });
|
|
157
|
+
* </script>
|
|
158
|
+
*
|
|
159
|
+
* <!-- Duration -->
|
|
160
|
+
* <sigvelo-slider
|
|
161
|
+
* id="slider__duration"
|
|
162
|
+
* label="Duration"
|
|
163
|
+
* name="duration"
|
|
164
|
+
* value="12"
|
|
165
|
+
* min="0"
|
|
166
|
+
* max="24"
|
|
167
|
+
* with-tooltip
|
|
168
|
+
* ></sigvelo-slider><br>
|
|
169
|
+
*
|
|
170
|
+
* <script>
|
|
171
|
+
* const slider = document.getElementById('slider__duration');
|
|
172
|
+
* const formatter = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'hour', unitDisplay: 'long' });
|
|
173
|
+
*
|
|
174
|
+
* customElements.whenDefined('sigvelo-slider').then(() => {
|
|
175
|
+
* slider.valueFormatter = value => formatter.format(value);
|
|
176
|
+
* });
|
|
177
|
+
* </script>
|
|
178
|
+
*
|
|
179
|
+
* <!-- Angle -->
|
|
180
|
+
* <sigvelo-slider
|
|
181
|
+
* id="slider__angle"
|
|
182
|
+
* label="Angle"
|
|
183
|
+
* name="angle"
|
|
184
|
+
* min="0"
|
|
185
|
+
* max="360"
|
|
186
|
+
* value="180"
|
|
187
|
+
* with-tooltip
|
|
188
|
+
* ></sigvelo-slider><br>
|
|
189
|
+
*
|
|
190
|
+
* <script>
|
|
191
|
+
* const slider = document.getElementById('slider__angle');
|
|
192
|
+
* const formatter = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'degree', unitDisplay: 'narrow' });
|
|
193
|
+
*
|
|
194
|
+
* customElements.whenDefined('sigvelo-slider').then(() => {
|
|
195
|
+
* slider.valueFormatter = value => formatter.format(value);
|
|
196
|
+
* });
|
|
197
|
+
* </script>
|
|
198
|
+
*
|
|
199
|
+
* <!-- Currency -->
|
|
200
|
+
* <sigvelo-slider
|
|
201
|
+
* id="slider__currency"
|
|
202
|
+
* label="Currency"
|
|
203
|
+
* name="currency"
|
|
204
|
+
* min="0"
|
|
205
|
+
* max="100"
|
|
206
|
+
* value="50"
|
|
207
|
+
* with-tooltip
|
|
208
|
+
* ></sigvelo-slider>
|
|
209
|
+
*
|
|
210
|
+
* <script>
|
|
211
|
+
* const slider = document.getElementById('slider__currency');
|
|
212
|
+
* const formatter = new Intl.NumberFormat('en-US', {
|
|
213
|
+
* style: 'currency',
|
|
214
|
+
* currency: 'USD',
|
|
215
|
+
* currencyDisplay: 'symbol',
|
|
216
|
+
* maximumFractionDigits: 0
|
|
217
|
+
* });
|
|
218
|
+
*
|
|
219
|
+
* customElements.whenDefined('sigvelo-slider').then(() => {
|
|
220
|
+
* slider.valueFormatter = value => formatter.format(value);
|
|
221
|
+
* });
|
|
222
|
+
* </script>
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* @example Range selection
|
|
226
|
+
* Set `value` to a two-number array to create a slider with two thumbs for selecting a range of values.
|
|
227
|
+
*
|
|
228
|
+
* ```html
|
|
229
|
+
* <sigvelo-slider
|
|
230
|
+
* label="Price Range"
|
|
231
|
+
* description="Select minimum and maximum price"
|
|
232
|
+
* name="price"
|
|
233
|
+
* min="0"
|
|
234
|
+
* max="100"
|
|
235
|
+
* with-tooltip
|
|
236
|
+
* id="slider__range"
|
|
237
|
+
* >
|
|
238
|
+
* <span slot="reference">$0</span>
|
|
239
|
+
* <span slot="reference">$50</span>
|
|
240
|
+
* <span slot="reference">$100</span>
|
|
241
|
+
* </sigvelo-slider>
|
|
242
|
+
*
|
|
243
|
+
* <script>
|
|
244
|
+
* const slider = document.getElementById('slider__range');
|
|
245
|
+
* const formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 });
|
|
246
|
+
*
|
|
247
|
+
* customElements.whenDefined('sigvelo-slider').then(() => {
|
|
248
|
+
* slider.value = [20, 80];
|
|
249
|
+
* slider.valueFormatter = value => formatter.format(value);
|
|
250
|
+
* });
|
|
251
|
+
* </script>
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* 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.
|
|
255
|
+
*
|
|
256
|
+
* ```ts
|
|
257
|
+
* const slider = document.querySelector('sigvelo-slider');
|
|
258
|
+
*
|
|
259
|
+
* // Get the current values
|
|
260
|
+
* console.log(`Min value: ${slider.value[0]}, Max value: ${slider.value[1]}`);
|
|
261
|
+
*
|
|
262
|
+
* // Set the values programmatically
|
|
263
|
+
* slider.value = [30, 70];
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* @example Changing the orientation
|
|
267
|
+
* 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.
|
|
268
|
+
*
|
|
269
|
+
* ```html
|
|
270
|
+
* <div style="display: flex; gap: 1rem;">
|
|
271
|
+
* <sigvelo-slider
|
|
272
|
+
* orientation="vertical"
|
|
273
|
+
* label="Volume"
|
|
274
|
+
* name="volume"
|
|
275
|
+
* value="65"
|
|
276
|
+
* style="width: 80px"
|
|
277
|
+
* ></sigvelo-slider>
|
|
278
|
+
*
|
|
279
|
+
* <sigvelo-slider
|
|
280
|
+
* orientation="vertical"
|
|
281
|
+
* label="Bass"
|
|
282
|
+
* name="bass"
|
|
283
|
+
* value="50"
|
|
284
|
+
* style="width: 80px"
|
|
285
|
+
* ></sigvelo-slider>
|
|
286
|
+
*
|
|
287
|
+
* <sigvelo-slider
|
|
288
|
+
* orientation="vertical"
|
|
289
|
+
* label="Treble"
|
|
290
|
+
* name="treble"
|
|
291
|
+
* value="40"
|
|
292
|
+
* style="width: 80px"
|
|
293
|
+
* ></sigvelo-slider>
|
|
294
|
+
* </div>
|
|
295
|
+
* ```
|
|
296
|
+
*
|
|
297
|
+
* Range sliders can also be vertical.
|
|
298
|
+
*
|
|
299
|
+
* ```html
|
|
300
|
+
* <div style="height: 300px; display: flex; align-items: center; gap: 2rem;">
|
|
301
|
+
* <sigvelo-slider
|
|
302
|
+
* label="Temperature Range"
|
|
303
|
+
* orientation="vertical"
|
|
304
|
+
* min="0"
|
|
305
|
+
* max="100"
|
|
306
|
+
* with-tooltip
|
|
307
|
+
* tooltip-placement="right"
|
|
308
|
+
* id="slider__vertical-range"
|
|
309
|
+
* >
|
|
310
|
+
* </sigvelo-slider>
|
|
311
|
+
* </div>
|
|
312
|
+
*
|
|
313
|
+
* <script>
|
|
314
|
+
* const slider = document.getElementById('slider__vertical-range');
|
|
315
|
+
* slider.value = [30, 70];
|
|
316
|
+
* slider.valueFormatter = value => {
|
|
317
|
+
* return new Intl.NumberFormat('en', {
|
|
318
|
+
* style: 'unit',
|
|
319
|
+
* unit: 'fahrenheit',
|
|
320
|
+
* unitDisplay: 'short',
|
|
321
|
+
* minimumFractionDigits: 0,
|
|
322
|
+
* maximumFractionDigits: 1
|
|
323
|
+
* }).format(value);
|
|
324
|
+
* };
|
|
325
|
+
* </script>
|
|
326
|
+
* ```
|
|
327
|
+
*
|
|
328
|
+
* @example Changing the size
|
|
329
|
+
* Use the `size` attribute to change the slider's size.
|
|
330
|
+
*
|
|
331
|
+
* ```html
|
|
332
|
+
* <sigvelo-slider size="xs" value="50" label="Extra small"></sigvelo-slider><br>
|
|
333
|
+
* <sigvelo-slider size="sm" value="50" label="Small"></sigvelo-slider><br>
|
|
334
|
+
* <sigvelo-slider size="md" value="50" label="Medium"></sigvelo-slider><br>
|
|
335
|
+
* <sigvelo-slider size="lg" value="50" label="Large"></sigvelo-slider><br>
|
|
336
|
+
* <sigvelo-slider size="xl" value="50" label="Extra large"></sigvelo-slider>
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* @example Changing the indicator's offset
|
|
340
|
+
* 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.
|
|
341
|
+
*
|
|
342
|
+
* ```html
|
|
343
|
+
* <sigvelo-slider
|
|
344
|
+
* label="Cat playfulness"
|
|
345
|
+
* description="Energy level during playtime"
|
|
346
|
+
* name="value"
|
|
347
|
+
* value="0"
|
|
348
|
+
* min="-5"
|
|
349
|
+
* max="5"
|
|
350
|
+
* indicator-offset="0"
|
|
351
|
+
* with-markers
|
|
352
|
+
* with-tooltip
|
|
353
|
+
* >
|
|
354
|
+
* <span slot="reference">Lazy</span>
|
|
355
|
+
* <span slot="reference">Zoomies</span>
|
|
356
|
+
* </sigvelo-slider>
|
|
357
|
+
* ```
|
|
358
|
+
*
|
|
359
|
+
* @example Disabling
|
|
360
|
+
* Use the `disabled` attribute to disable the slider.
|
|
361
|
+
*
|
|
362
|
+
* ```html
|
|
363
|
+
* <sigvelo-slider label="Disabled" value="50" disabled></sigvelo-slider>
|
|
364
|
+
* ```
|
|
365
|
+
*
|
|
366
|
+
* @example Using custom validation
|
|
367
|
+
* 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.
|
|
368
|
+
*
|
|
369
|
+
* ```html
|
|
370
|
+
* <form action="about:blank" method="get" target="_blank" id="slider__custom-validation">
|
|
371
|
+
* <sigvelo-slider
|
|
372
|
+
* name="value"
|
|
373
|
+
* label="Select a value"
|
|
374
|
+
* description="This field will be invalid until custom validation is removed"
|
|
375
|
+
* ></sigvelo-slider>
|
|
376
|
+
* <br>
|
|
377
|
+
* <sigvelo-button type="submit" color="primary">Submit</sigvelo-button>
|
|
378
|
+
* </form>
|
|
379
|
+
*
|
|
380
|
+
* <script type="module">
|
|
381
|
+
* import { allDefined } from '/dist/sigvelo.js';
|
|
382
|
+
*
|
|
383
|
+
* await allDefined();
|
|
384
|
+
*
|
|
385
|
+
* const form = document.getElementById('slider__custom-validation');
|
|
386
|
+
* const slider = form.querySelector('sigvelo-slider');
|
|
387
|
+
*
|
|
388
|
+
* slider.setCustomValidity('Not so fast, bubba!');
|
|
389
|
+
* </script>
|
|
390
|
+
* ```
|
|
391
|
+
*
|
|
392
|
+
* @example Styling validation
|
|
393
|
+
* You can style valid and invalid sliders using the `:valid` and `:invalid` pseudo classes.
|
|
394
|
+
*
|
|
395
|
+
* ```html
|
|
396
|
+
* <form action="about:blank" method="get" target="_blank" class="slider__validation-pseudo">
|
|
397
|
+
* <sigvelo-slider
|
|
398
|
+
* name="value"
|
|
399
|
+
* label="Select a value"
|
|
400
|
+
* min="0"
|
|
401
|
+
* max="5"
|
|
402
|
+
* value="0"
|
|
403
|
+
* with-markers
|
|
404
|
+
* with-tooltip
|
|
405
|
+
* ></sigvelo-slider>
|
|
406
|
+
* <br>
|
|
407
|
+
* <sigvelo-button type="submit" color="primary">Submit</sigvelo-button>
|
|
408
|
+
* <sigvelo-button type="reset">Reset</sigvelo-button>
|
|
409
|
+
* </form>
|
|
410
|
+
*
|
|
411
|
+
* <style>
|
|
412
|
+
* .slider__validation-pseudo {
|
|
413
|
+
* sigvelo-slider:valid {
|
|
414
|
+
* outline: solid 2px var(--sigvelo-color-success-border);
|
|
415
|
+
* outline-offset: 1rem;
|
|
416
|
+
* }
|
|
417
|
+
*
|
|
418
|
+
* sigvelo-slider:invalid {
|
|
419
|
+
* outline: solid 2px var(--sigvelo-color-danger-border);
|
|
420
|
+
* outline-offset: 1rem;
|
|
421
|
+
* }
|
|
422
|
+
* }
|
|
423
|
+
* </style>
|
|
424
|
+
*
|
|
425
|
+
* <script type="module">
|
|
426
|
+
* import { allDefined } from '/dist/sigvelo.js';
|
|
427
|
+
*
|
|
428
|
+
* await allDefined();
|
|
429
|
+
*
|
|
430
|
+
* const form = document.querySelector('.slider__validation-pseudo');
|
|
431
|
+
* const slider = form.querySelector('sigvelo-slider');
|
|
432
|
+
* const validationMessage = 'Select a number greater than zero';
|
|
433
|
+
*
|
|
434
|
+
* slider.setCustomValidity(validationMessage);
|
|
435
|
+
*
|
|
436
|
+
* async function updateValidity() {
|
|
437
|
+
* await slider.updateComplete;
|
|
438
|
+
* slider.setCustomValidity(slider.value > 0 ? '' : validationMessage);
|
|
439
|
+
* }
|
|
440
|
+
*
|
|
441
|
+
* slider.addEventListener('sigvelo-input', updateValidity);
|
|
442
|
+
* form.addEventListener('reset', updateValidity);
|
|
443
|
+
* </script>
|
|
444
|
+
* ```
|
|
445
|
+
*
|
|
446
|
+
* 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.
|
|
447
|
+
*
|
|
448
|
+
* ```html
|
|
449
|
+
* <form action="about:blank" method="get" target="_blank" class="slider__validation-custom">
|
|
450
|
+
* <sigvelo-slider
|
|
451
|
+
* name="value"
|
|
452
|
+
* label="Select a value"
|
|
453
|
+
* min="0"
|
|
454
|
+
* max="5"
|
|
455
|
+
* value="0"
|
|
456
|
+
* with-markers
|
|
457
|
+
* with-tooltip
|
|
458
|
+
* ></sigvelo-slider>
|
|
459
|
+
* <br>
|
|
460
|
+
* <sigvelo-button type="submit" color="primary">Submit</sigvelo-button>
|
|
461
|
+
* <sigvelo-button type="reset">Reset</sigvelo-button>
|
|
462
|
+
* </form>
|
|
463
|
+
*
|
|
464
|
+
* <style>
|
|
465
|
+
* .slider__validation-custom {
|
|
466
|
+
* sigvelo-slider:state(user-valid) {
|
|
467
|
+
* outline: solid 2px var(--sigvelo-color-success-border);
|
|
468
|
+
* outline-offset: 1rem;
|
|
469
|
+
* }
|
|
470
|
+
*
|
|
471
|
+
* sigvelo-slider:state(user-invalid) {
|
|
472
|
+
* outline: solid 2px var(--sigvelo-color-danger-border);
|
|
473
|
+
* outline-offset: 1rem;
|
|
474
|
+
* }
|
|
475
|
+
* }
|
|
476
|
+
* </style>
|
|
477
|
+
*
|
|
478
|
+
* <script type="module">
|
|
479
|
+
* import { allDefined } from '/dist/sigvelo.js';
|
|
480
|
+
*
|
|
481
|
+
* await allDefined();
|
|
482
|
+
*
|
|
483
|
+
* const form = document.querySelector('.slider__validation-custom');
|
|
484
|
+
* const slider = form.querySelector('sigvelo-slider');
|
|
485
|
+
* const validationMessage = 'Select a number greater than zero';
|
|
486
|
+
*
|
|
487
|
+
* slider.setCustomValidity(validationMessage);
|
|
488
|
+
*
|
|
489
|
+
* async function updateValidity() {
|
|
490
|
+
* await slider.updateComplete;
|
|
491
|
+
* slider.setCustomValidity(slider.value > 0 ? '' : validationMessage);
|
|
492
|
+
* }
|
|
493
|
+
*
|
|
494
|
+
* slider.addEventListener('sigvelo-input', updateValidity);
|
|
495
|
+
* form.addEventListener('reset', updateValidity);
|
|
496
|
+
* </script>
|
|
497
|
+
* ```
|
|
498
|
+
*
|
|
499
|
+
* @example Styling sliders
|
|
500
|
+
* Sliders come with a simple, minimal appearance. Feel free to customize them with your own styles.
|
|
501
|
+
*
|
|
502
|
+
* ```html
|
|
503
|
+
* <div style="display: flex; gap: 2rem;">
|
|
504
|
+
* <div class="slider__touch">
|
|
505
|
+
* <sigvelo-slider
|
|
506
|
+
* label="Brightness"
|
|
507
|
+
* orientation="vertical"
|
|
508
|
+
* name="value"
|
|
509
|
+
* min="0"
|
|
510
|
+
* max="1"
|
|
511
|
+
* step=".01"
|
|
512
|
+
* value="0.6"
|
|
513
|
+
* >
|
|
514
|
+
* </sigvelo-slider>
|
|
515
|
+
* <sigvelo-icon name="sun"></sigvelo-icon>
|
|
516
|
+
* </div>
|
|
517
|
+
*
|
|
518
|
+
* <div class="slider__touch">
|
|
519
|
+
* <sigvelo-slider
|
|
520
|
+
* label="Volume"
|
|
521
|
+
* orientation="vertical"
|
|
522
|
+
* name="value"
|
|
523
|
+
* min="0"
|
|
524
|
+
* max="1"
|
|
525
|
+
* step=".01"
|
|
526
|
+
* value="0.4"
|
|
527
|
+
* ></sigvelo-slider>
|
|
528
|
+
* <sigvelo-icon name="volume"></sigvelo-icon>
|
|
529
|
+
* </div>
|
|
530
|
+
* </div>
|
|
531
|
+
*
|
|
532
|
+
* <style>
|
|
533
|
+
* .slider__touch {
|
|
534
|
+
* position: relative;
|
|
535
|
+
* max-width: fit-content;
|
|
536
|
+
*
|
|
537
|
+
* sigvelo-slider {
|
|
538
|
+
* --track-size: 4rem;
|
|
539
|
+
* max-width: fit-content;
|
|
540
|
+
*
|
|
541
|
+
* &::part(track) {
|
|
542
|
+
* background-color: var(--sigvelo-color-neutral-bg-subtle);
|
|
543
|
+
* box-shadow: inset 0 1px 2px color-mix(in oklab, var(--sigvelo-color-neutral-bg-subtle), black 5%);
|
|
544
|
+
* cursor: pointer;
|
|
545
|
+
* overflow: hidden;
|
|
546
|
+
* }
|
|
547
|
+
*
|
|
548
|
+
* &::part(indicator) {
|
|
549
|
+
* background-color: #22c55e;
|
|
550
|
+
* border-radius: 0;
|
|
551
|
+
* }
|
|
552
|
+
*
|
|
553
|
+
* &::part(thumb) {
|
|
554
|
+
* opacity: 0;
|
|
555
|
+
* }
|
|
556
|
+
*
|
|
557
|
+
* &::part(tooltip__arrow) {
|
|
558
|
+
* display: none;
|
|
559
|
+
* }
|
|
560
|
+
*
|
|
561
|
+
* &::part(tooltip__content) {
|
|
562
|
+
* background-color: var(--sigvelo-color-neutral-bg-stronger);
|
|
563
|
+
* border: none;
|
|
564
|
+
* color: var(--sigvelo-color-primary-text-on-strong);
|
|
565
|
+
* }
|
|
566
|
+
*
|
|
567
|
+
* &::part(slider):focus-visible {
|
|
568
|
+
* outline: var(--sigvelo-focus-ring);
|
|
569
|
+
* outline-offset: var(--sigvelo-focus-offset);
|
|
570
|
+
* }
|
|
571
|
+
* }
|
|
572
|
+
*
|
|
573
|
+
* sigvelo-icon {
|
|
574
|
+
* position: absolute;
|
|
575
|
+
* bottom: 3.5rem;
|
|
576
|
+
* left: calc(50% - 1rem);
|
|
577
|
+
* font-size: 2rem;
|
|
578
|
+
* color: light-dark(black, white);
|
|
579
|
+
* pointer-events: none;
|
|
580
|
+
* }
|
|
581
|
+
* }
|
|
582
|
+
* </style>
|
|
583
|
+
* ```
|
|
584
|
+
*
|
|
585
|
+
* ```html
|
|
586
|
+
* <sigvelo-slider
|
|
587
|
+
* id="slider__color"
|
|
588
|
+
* label="Color"
|
|
589
|
+
* name="color"
|
|
590
|
+
* min="0"
|
|
591
|
+
* max="359"
|
|
592
|
+
* with-tooltip
|
|
593
|
+
* style="--hue: hsl(0deg 100% 50%);"
|
|
594
|
+
* ></sigvelo-slider>
|
|
595
|
+
*
|
|
596
|
+
* <br>
|
|
597
|
+
*
|
|
598
|
+
* <sigvelo-slider
|
|
599
|
+
* id="slider__opacity"
|
|
600
|
+
* label="Opacity"
|
|
601
|
+
* name="opacity"
|
|
602
|
+
* min="0"
|
|
603
|
+
* max="1"
|
|
604
|
+
* step=".01"
|
|
605
|
+
* with-tooltip
|
|
606
|
+
* style="--opacity: 0%;"
|
|
607
|
+
* ></sigvelo-slider>
|
|
608
|
+
*
|
|
609
|
+
* <style>
|
|
610
|
+
* #slider__color,
|
|
611
|
+
* #slider__opacity {
|
|
612
|
+
* --track-size: 1.25em;
|
|
613
|
+
* --thumb-width: 1.5em;
|
|
614
|
+
* --thumb-height: 1.5em;
|
|
615
|
+
*
|
|
616
|
+
* &::part(track) {
|
|
617
|
+
* box-shadow: inset 0 0 0 0.0625em color-mix(in oklab, black, transparent 90%);
|
|
618
|
+
* border-radius: var(--sigvelo-radius-md);
|
|
619
|
+
* }
|
|
620
|
+
*
|
|
621
|
+
* &::part(thumb) {
|
|
622
|
+
* border: solid 0.0625em rgb(0 0 0 / 33%);
|
|
623
|
+
* border-radius: var(--sigvelo-radius-circle);
|
|
624
|
+
* transition: 100ms scale ease;
|
|
625
|
+
* }
|
|
626
|
+
*
|
|
627
|
+
* &:state(dragging)::part(thumb),
|
|
628
|
+
* &::part(thumb):focus-visible {
|
|
629
|
+
* scale: 1.25;
|
|
630
|
+
* }
|
|
631
|
+
*
|
|
632
|
+
* &::part(thumb)::after {
|
|
633
|
+
* content: '';
|
|
634
|
+
* position: absolute;
|
|
635
|
+
* top: 0;
|
|
636
|
+
* left: 0;
|
|
637
|
+
* width: 100%;
|
|
638
|
+
* height: 100%;
|
|
639
|
+
* border-radius: inherit;
|
|
640
|
+
* border: solid 0.125em white;
|
|
641
|
+
* box-shadow: inset 0 0 0 0.0625em rgb(0 0 0 / 33%);
|
|
642
|
+
* }
|
|
643
|
+
* }
|
|
644
|
+
*
|
|
645
|
+
* #slider__color {
|
|
646
|
+
* &::part(track) {
|
|
647
|
+
* background-image:
|
|
648
|
+
* linear-gradient(
|
|
649
|
+
* to right,
|
|
650
|
+
* rgb(255, 0, 0) 0%,
|
|
651
|
+
* rgb(255, 255, 0) 17%,
|
|
652
|
+
* rgb(0, 255, 0) 33%,
|
|
653
|
+
* rgb(0, 255, 255) 50%,
|
|
654
|
+
* rgb(0, 0, 255) 67%,
|
|
655
|
+
* rgb(255, 0, 255) 83%,
|
|
656
|
+
* rgb(255, 0, 0) 100%
|
|
657
|
+
* );
|
|
658
|
+
* }
|
|
659
|
+
*
|
|
660
|
+
* &::part(indicator) {
|
|
661
|
+
* display: none;
|
|
662
|
+
* }
|
|
663
|
+
*
|
|
664
|
+
* &::part(thumb) {
|
|
665
|
+
* background-color: var(--hue);
|
|
666
|
+
* }
|
|
667
|
+
* }
|
|
668
|
+
*
|
|
669
|
+
* #slider__opacity {
|
|
670
|
+
* &::part(track) {
|
|
671
|
+
* background-color: transparent;
|
|
672
|
+
* background-size: 0.5em 0.5em;
|
|
673
|
+
* background-position:
|
|
674
|
+
* 0 0,
|
|
675
|
+
* 0 0,
|
|
676
|
+
* -0.25em -0.25em,
|
|
677
|
+
* 0.25em 0.25em;
|
|
678
|
+
* background-image: linear-gradient(45deg, var(--sigvelo-color-neutral-bg-muted) 25%, transparent 25%),
|
|
679
|
+
* linear-gradient(45deg, transparent 75%, var(--sigvelo-color-neutral-bg-muted) 75%),
|
|
680
|
+
* linear-gradient(45deg, transparent 75%, var(--sigvelo-color-neutral-bg-muted) 75%),
|
|
681
|
+
* linear-gradient(45deg, var(--sigvelo-color-neutral-bg-muted) 25%, transparent 25%);
|
|
682
|
+
* }
|
|
683
|
+
*
|
|
684
|
+
* &::part(indicator) {
|
|
685
|
+
* width: 100% !important;
|
|
686
|
+
* background-color: transparent;
|
|
687
|
+
* background-image: linear-gradient(to right, #0000 0%, #000f 100%);
|
|
688
|
+
* }
|
|
689
|
+
*
|
|
690
|
+
* &::part(thumb) {
|
|
691
|
+
* background-color: color-mix(in oklab, white, black var(--opacity));
|
|
692
|
+
* }
|
|
693
|
+
* }
|
|
694
|
+
* </style>
|
|
695
|
+
*
|
|
696
|
+
* <script>
|
|
697
|
+
* const colorSlider = document.getElementById('slider__color');
|
|
698
|
+
* const opacitySlider = document.getElementById('slider__opacity');
|
|
699
|
+
* const degreeFormatter = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'degree', unitDisplay: 'narrow' });
|
|
700
|
+
* const percentFormatter = new Intl.NumberFormat('en-US', { style: 'percent' });
|
|
701
|
+
*
|
|
702
|
+
* customElements.whenDefined('sigvelo-slider').then(() => {
|
|
703
|
+
* // Set formatters for screen readers
|
|
704
|
+
* colorSlider.valueFormatter = value => degreeFormatter.format(value);
|
|
705
|
+
* opacitySlider.valueFormatter = value => percentFormatter.format(value);
|
|
706
|
+
*
|
|
707
|
+
* // Set the color slider's thumb color when the value changes
|
|
708
|
+
* colorSlider.addEventListener('input', () => {
|
|
709
|
+
* colorSlider.style.setProperty('--hue', `hsl(${colorSlider.value}deg 100% 50%)`);
|
|
710
|
+
* });
|
|
711
|
+
*
|
|
712
|
+
* // Set the opacity slider's thumb color when the value changes
|
|
713
|
+
* opacitySlider.addEventListener('input', () => {
|
|
714
|
+
* opacitySlider.style.setProperty('--opacity', `${opacitySlider.value * 100}%`);
|
|
715
|
+
* });
|
|
716
|
+
* });
|
|
717
|
+
* </script>
|
|
718
|
+
* ```
|
|
719
|
+
*
|
|
720
|
+
* ```html
|
|
721
|
+
* <sigvelo-slider
|
|
722
|
+
* id="slider__repeat"
|
|
723
|
+
* label="Key repeat rate"
|
|
724
|
+
* name="repeat"
|
|
725
|
+
* value="5"
|
|
726
|
+
* min="0"
|
|
727
|
+
* max="7"
|
|
728
|
+
* with-markers
|
|
729
|
+
* >
|
|
730
|
+
* <span slot="reference">Off</span>
|
|
731
|
+
* <span slot="reference" class="repeat-slow">Slow</span>
|
|
732
|
+
* <span slot="reference">Fast</span>
|
|
733
|
+
* </sigvelo-slider>
|
|
734
|
+
*
|
|
735
|
+
* <style>
|
|
736
|
+
* #slider__repeat {
|
|
737
|
+
* --thumb-width: 0.75em;
|
|
738
|
+
* --thumb-height: 1.5em;
|
|
739
|
+
* --marker-height: 0.5em;
|
|
740
|
+
*
|
|
741
|
+
* &::part(track) {
|
|
742
|
+
* height: 1em;
|
|
743
|
+
* background: none;
|
|
744
|
+
* }
|
|
745
|
+
*
|
|
746
|
+
* &::part(track)::after {
|
|
747
|
+
* content: '';
|
|
748
|
+
* position: absolute;
|
|
749
|
+
* top: calc(50% - .125em);
|
|
750
|
+
* left: 0;
|
|
751
|
+
* width: 100%;
|
|
752
|
+
* height: .25em;
|
|
753
|
+
* background-color: var(--sigvelo-color-neutral-bg-muted);
|
|
754
|
+
* }
|
|
755
|
+
*
|
|
756
|
+
* &::part(indicator) {
|
|
757
|
+
* display: none;
|
|
758
|
+
* }
|
|
759
|
+
*
|
|
760
|
+
* &::part(thumb) {
|
|
761
|
+
* border-radius: 0.25em;
|
|
762
|
+
* border: none;
|
|
763
|
+
* background-color: var(--sigvelo-color-neutral-bg-strong);
|
|
764
|
+
* }
|
|
765
|
+
*
|
|
766
|
+
* &::part(marker) {
|
|
767
|
+
* display: initial;
|
|
768
|
+
* border-radius: 0.125em;
|
|
769
|
+
* background-color: var(--sigvelo-color-neutral-bg);
|
|
770
|
+
* }
|
|
771
|
+
*
|
|
772
|
+
* .repeat-slow {
|
|
773
|
+
* position: absolute;
|
|
774
|
+
*
|
|
775
|
+
* &:dir(ltr) {
|
|
776
|
+
* left: 14%;
|
|
777
|
+
* }
|
|
778
|
+
*
|
|
779
|
+
* &:dir(rtl) {
|
|
780
|
+
* right: 14%;
|
|
781
|
+
* }
|
|
782
|
+
* }
|
|
783
|
+
* }
|
|
784
|
+
* </style>
|
|
785
|
+
* ```
|
|
786
|
+
*/
|
|
787
|
+
declare class SigveloSlider extends SigveloFormControlElement {
|
|
788
|
+
static formAssociated: boolean;
|
|
789
|
+
static observeSlots: boolean;
|
|
790
|
+
static styles: CSSResultGroup;
|
|
791
|
+
private draggableTrack?;
|
|
792
|
+
private draggableThumbMin;
|
|
793
|
+
private draggableThumbMax;
|
|
794
|
+
private localize;
|
|
795
|
+
private trackBoundingClientRect;
|
|
796
|
+
private valueWhenDraggingStarted;
|
|
797
|
+
private activeThumb;
|
|
798
|
+
private lastTrackPosition;
|
|
799
|
+
private defaultValue;
|
|
800
|
+
protected get focusableAnchor(): HTMLElement;
|
|
801
|
+
slider: HTMLElement;
|
|
802
|
+
thumb: HTMLElement;
|
|
803
|
+
thumbMin: HTMLElement;
|
|
804
|
+
thumbMax: HTMLElement;
|
|
805
|
+
track: HTMLElement;
|
|
806
|
+
tooltip: SigveloTooltip;
|
|
807
|
+
tooltipMin: SigveloTooltip;
|
|
808
|
+
tooltipMax: SigveloTooltip;
|
|
809
|
+
isInvalid: boolean;
|
|
810
|
+
hadUserInteraction: boolean;
|
|
811
|
+
wasSubmitted: boolean;
|
|
812
|
+
/**
|
|
813
|
+
* The slider's label. If you need to provide HTML in the label, use the `label` slot instead.
|
|
814
|
+
*/
|
|
815
|
+
label: string;
|
|
816
|
+
/**
|
|
817
|
+
* The slider's description. If you need to provide HTML in the description, use the `description` slot instead.
|
|
818
|
+
*/
|
|
819
|
+
description: string;
|
|
820
|
+
/** The name of the slider. This will be submitted with the form as a name/value pair. */
|
|
821
|
+
name: string;
|
|
822
|
+
/** The slider's value. Pass a two-number array to render a range slider. */
|
|
823
|
+
value: number | readonly number[];
|
|
824
|
+
/** Get if this is a range slider */
|
|
825
|
+
get isRange(): boolean;
|
|
826
|
+
private get singleValue();
|
|
827
|
+
private set singleValue(value);
|
|
828
|
+
private get rangeStart();
|
|
829
|
+
private set rangeStart(value);
|
|
830
|
+
private get rangeEnd();
|
|
831
|
+
private set rangeEnd(value);
|
|
832
|
+
/** Disables the slider. */
|
|
833
|
+
disabled: boolean;
|
|
834
|
+
/** Makes the slider a read-only field. */
|
|
835
|
+
readonly: boolean;
|
|
836
|
+
/** The orientation of the slider. */
|
|
837
|
+
orientation: "horizontal" | "vertical";
|
|
838
|
+
/** The slider's size. */
|
|
839
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
840
|
+
/** The starting value from which to draw the slider's fill, which is based on its current value. */
|
|
841
|
+
indicatorOffset: number;
|
|
842
|
+
/**
|
|
843
|
+
* The form to associate this control with. If omitted, the closest containing `<form>` will be used. The value of
|
|
844
|
+
* this attribute must be an ID of a form in the same document or shadow root.
|
|
845
|
+
*/
|
|
846
|
+
form: string;
|
|
847
|
+
/** The minimum value allowed. */
|
|
848
|
+
min: number;
|
|
849
|
+
/** The maximum value allowed. */
|
|
850
|
+
max: number;
|
|
851
|
+
/** The granularity the value must adhere to when incrementing and decrementing. */
|
|
852
|
+
step: number;
|
|
853
|
+
/** Tells the browser to focus the slider when the page loads or a dialog is shown. */
|
|
854
|
+
autofocus: boolean;
|
|
855
|
+
/** The distance of the tooltip from the slider's thumb. */
|
|
856
|
+
tooltipDistance: number;
|
|
857
|
+
/** The placement of the tooltip in reference to the slider's thumb. */
|
|
858
|
+
tooltipPlacement: "top" | "right" | "bottom" | "left";
|
|
859
|
+
/** Draws markers at each step along the slider. */
|
|
860
|
+
withMarkers: boolean;
|
|
861
|
+
/** Draws a tooltip above the thumb when the control has focus or is dragged. */
|
|
862
|
+
withTooltip: boolean;
|
|
863
|
+
/**
|
|
864
|
+
* A custom formatting function to apply to the value. This will be shown in the tooltip and announced by screen
|
|
865
|
+
* readers. Must be set with JavaScript. Property only.
|
|
866
|
+
*/
|
|
867
|
+
valueFormatter: (value: number) => string;
|
|
868
|
+
connectedCallback(): void;
|
|
869
|
+
disconnectedCallback(): void;
|
|
870
|
+
firstUpdated(): void;
|
|
871
|
+
private stopDragging;
|
|
872
|
+
private setupDragging;
|
|
873
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
874
|
+
/** @internal Called when a containing fieldset is disabled. */
|
|
875
|
+
formDisabledCallback(isDisabled: boolean): void;
|
|
876
|
+
/** @internal Called when the form is reset. */
|
|
877
|
+
formResetCallback(): void;
|
|
878
|
+
/** Clamps a number to min/max while ensuring it's a valid step interval. */
|
|
879
|
+
private clampAndRoundToStep;
|
|
880
|
+
/** Given a value, returns its percentage within a range of min/max. */
|
|
881
|
+
private getPercentageFromValue;
|
|
882
|
+
/** Converts coordinates to slider value */
|
|
883
|
+
private getValueFromCoordinates;
|
|
884
|
+
private handleBlur;
|
|
885
|
+
private handleFocus;
|
|
886
|
+
private handleHostInvalid;
|
|
887
|
+
private handleKeyDown;
|
|
888
|
+
private handleLabelPointerDown;
|
|
889
|
+
private setValueFromCoordinates;
|
|
890
|
+
private setThumbValueFromCoordinates;
|
|
891
|
+
private showTooltip;
|
|
892
|
+
private hideTooltip;
|
|
893
|
+
private showRangeTooltips;
|
|
894
|
+
private hideRangeTooltips;
|
|
895
|
+
/** Updates the form value submission for range sliders */
|
|
896
|
+
private updateFormValue;
|
|
897
|
+
/** Sets the form control's validity */
|
|
898
|
+
private updateValidity;
|
|
899
|
+
/** Sets focus to the slider. */
|
|
900
|
+
focus(): void;
|
|
901
|
+
/** Removes focus from the slider. */
|
|
902
|
+
blur(): void;
|
|
903
|
+
/**
|
|
904
|
+
* Decreases the slider's value by `step`. This is a programmatic change, so `input` and `change` events will not be
|
|
905
|
+
* emitted when this is called.
|
|
906
|
+
*/
|
|
907
|
+
stepDown(): void;
|
|
908
|
+
/**
|
|
909
|
+
* Increases the slider's value by `step`. This is a programmatic change, so `input` and `change` events will not be
|
|
910
|
+
* emitted when this is called.
|
|
911
|
+
*/
|
|
912
|
+
stepUp(): void;
|
|
913
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
914
|
+
}
|
|
915
|
+
declare global {
|
|
916
|
+
interface HTMLElementTagNameMap {
|
|
917
|
+
"sigvelo-slider": SigveloSlider;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
//#endregion
|
|
921
|
+
export { SigveloSlider as t };
|