@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,802 @@
|
|
|
1
|
+
import "./icon-BPVkNsY4.js";
|
|
2
|
+
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
3
|
+
import "./spinner-C04Dmc0H.js";
|
|
4
|
+
import { css } from "lit";
|
|
5
|
+
import { property } 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 { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
+
import { html as html$1, literal } from "lit/static-html.js";
|
|
11
|
+
import { SigveloBlurEvent, SigveloFocusEvent } from "@mcp-b/wc-support/events/form";
|
|
12
|
+
import { LongPress } from "@mcp-b/wc-support/utilities/long-press";
|
|
13
|
+
//#region src/components/button/button.styles.ts
|
|
14
|
+
var button_styles_default = css`
|
|
15
|
+
:host {
|
|
16
|
+
display: inline-block;
|
|
17
|
+
position: relative;
|
|
18
|
+
width: auto;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#button {
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
appearance: none;
|
|
25
|
+
position: relative;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
width: 100%;
|
|
29
|
+
gap: 0.4em;
|
|
30
|
+
border: none;
|
|
31
|
+
border-radius: var(--sigvelo-radius-md);
|
|
32
|
+
background: none;
|
|
33
|
+
font: inherit;
|
|
34
|
+
font-weight: var(--sigvelo-font-weight-semibold);
|
|
35
|
+
text-decoration: none;
|
|
36
|
+
vertical-align: middle;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
cursor: inherit;
|
|
39
|
+
touch-action: manipulation;
|
|
40
|
+
transition:
|
|
41
|
+
var(--sigvelo-motion-duration-interaction) color ease,
|
|
42
|
+
var(--sigvelo-motion-duration-interaction) border-color ease,
|
|
43
|
+
var(--sigvelo-motion-duration-interaction) background-color ease,
|
|
44
|
+
var(--sigvelo-motion-duration-interaction) translate ease;
|
|
45
|
+
user-select: none;
|
|
46
|
+
-webkit-user-select: none;
|
|
47
|
+
|
|
48
|
+
&:active:not(.disabled) {
|
|
49
|
+
translate: 0 var(--sigvelo-motion-distance-xs);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&:focus {
|
|
53
|
+
outline: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:focus-visible {
|
|
57
|
+
outline: var(--sigvelo-focus-ring);
|
|
58
|
+
outline-offset: var(--sigvelo-focus-offset);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Sizes */
|
|
62
|
+
&.xs {
|
|
63
|
+
min-height: var(--sigvelo-control-height-xs);
|
|
64
|
+
padding-inline: 0.85em;
|
|
65
|
+
font-size: var(--sigvelo-control-text-xs);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&.sm {
|
|
69
|
+
min-height: var(--sigvelo-control-height-sm);
|
|
70
|
+
padding-inline: 1em;
|
|
71
|
+
font-size: var(--sigvelo-control-text-sm);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.md {
|
|
75
|
+
min-height: var(--sigvelo-control-height-md);
|
|
76
|
+
padding-inline: 1.25em;
|
|
77
|
+
font-size: var(--sigvelo-control-text-md);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.lg {
|
|
81
|
+
min-height: var(--sigvelo-control-height-lg);
|
|
82
|
+
padding-inline: 1.33em;
|
|
83
|
+
font-size: var(--sigvelo-control-text-lg);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&.xl {
|
|
87
|
+
min-height: var(--sigvelo-control-height-xl);
|
|
88
|
+
padding-inline: 1.5em;
|
|
89
|
+
font-size: var(--sigvelo-control-text-xl);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Normal buttons */
|
|
93
|
+
&.normal {
|
|
94
|
+
/* Neutral */
|
|
95
|
+
&.neutral {
|
|
96
|
+
background-color: var(--sigvelo-color-neutral-bg-subtle);
|
|
97
|
+
color: var(--sigvelo-color-neutral-text-on-subtle);
|
|
98
|
+
|
|
99
|
+
@media (hover: hover) {
|
|
100
|
+
&:hover:not(.disabled, [aria-pressed="true"]) {
|
|
101
|
+
background-color: color-mix(in oklab, var(--sigvelo-color-neutral-bg-subtle), black 5%);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&[aria-pressed="true"] {
|
|
106
|
+
background-color: color-mix(
|
|
107
|
+
in oklab,
|
|
108
|
+
var(--sigvelo-color-neutral-bg-subtle),
|
|
109
|
+
light-dark(black, white) 7.5%
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Primary */
|
|
115
|
+
&.primary {
|
|
116
|
+
background-color: var(--sigvelo-color-primary-bg);
|
|
117
|
+
color: var(--sigvelo-color-primary-text-on-bg);
|
|
118
|
+
|
|
119
|
+
@media (hover: hover) {
|
|
120
|
+
&:hover:not(.disabled, [aria-pressed="true"]) {
|
|
121
|
+
background-color: color-mix(in oklab, var(--sigvelo-color-primary-bg), black 5%);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&[aria-pressed="true"] {
|
|
126
|
+
background-color: color-mix(
|
|
127
|
+
in oklab,
|
|
128
|
+
var(--sigvelo-color-primary-bg),
|
|
129
|
+
light-dark(black, white) 7.5%
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Destructive */
|
|
135
|
+
&.destructive {
|
|
136
|
+
background-color: var(--sigvelo-color-danger-bg);
|
|
137
|
+
color: var(--sigvelo-color-danger-text-on-bg);
|
|
138
|
+
|
|
139
|
+
@media (hover: hover) {
|
|
140
|
+
&:hover:not(.disabled, [aria-pressed="true"]) {
|
|
141
|
+
background-color: color-mix(in oklab, var(--sigvelo-color-danger-bg), black 5%);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&[aria-pressed="true"] {
|
|
146
|
+
background-color: color-mix(
|
|
147
|
+
in oklab,
|
|
148
|
+
var(--sigvelo-color-danger-bg),
|
|
149
|
+
light-dark(black, white) 7.5%
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* Outline buttons */
|
|
156
|
+
&.outline.neutral {
|
|
157
|
+
border: var(--sigvelo-border-style) var(--sigvelo-border-width)
|
|
158
|
+
var(--sigvelo-color-neutral-bg);
|
|
159
|
+
background: transparent;
|
|
160
|
+
color: var(--sigvelo-color-neutral-text);
|
|
161
|
+
|
|
162
|
+
@media (hover: hover) {
|
|
163
|
+
&:hover:not(.disabled, [aria-pressed="true"]) {
|
|
164
|
+
background: color-mix(in oklab, transparent, var(--sigvelo-color-neutral-bg) 7.5%);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&.outline.primary {
|
|
170
|
+
border: var(--sigvelo-border-style) var(--sigvelo-border-width)
|
|
171
|
+
var(--sigvelo-color-primary-bg);
|
|
172
|
+
background: transparent;
|
|
173
|
+
color: var(--sigvelo-color-primary-text);
|
|
174
|
+
|
|
175
|
+
@media (hover: hover) {
|
|
176
|
+
&:hover:not(.disabled, [aria-pressed="true"]) {
|
|
177
|
+
background: color-mix(in oklab, transparent, var(--sigvelo-color-primary-bg) 7.5%);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&.outline.destructive {
|
|
183
|
+
border: var(--sigvelo-border-style) var(--sigvelo-border-width) var(--sigvelo-color-danger-bg);
|
|
184
|
+
background: transparent;
|
|
185
|
+
color: var(--sigvelo-color-danger-text);
|
|
186
|
+
|
|
187
|
+
@media (hover: hover) {
|
|
188
|
+
&:hover:not(.disabled, [aria-pressed="true"]) {
|
|
189
|
+
background: color-mix(in oklab, transparent, var(--sigvelo-color-danger-bg) 7.5%);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* Ghost buttons */
|
|
195
|
+
&.ghost {
|
|
196
|
+
background: none;
|
|
197
|
+
color: var(--sigvelo-color-neutral-text-on-subtle);
|
|
198
|
+
|
|
199
|
+
@media (hover: hover) {
|
|
200
|
+
&:hover:not(.disabled, [aria-pressed="true"]) {
|
|
201
|
+
background-color: color-mix(in oklab, transparent, var(--sigvelo-color-text) 5%);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&[aria-pressed="true"] {
|
|
206
|
+
background-color: color-mix(in oklab, transparent, var(--sigvelo-color-text) 5%);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* Raised surface buttons */
|
|
211
|
+
&.surface {
|
|
212
|
+
background-color: var(--sigvelo-color-surface-raised);
|
|
213
|
+
color: var(--sigvelo-color-text);
|
|
214
|
+
box-shadow: var(--sigvelo-elevation-raised);
|
|
215
|
+
|
|
216
|
+
@media (hover: hover) {
|
|
217
|
+
&:hover:not(.disabled, :active) {
|
|
218
|
+
background-color: var(--sigvelo-color-neutral-bg-subtle);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* Link buttons */
|
|
224
|
+
&.link {
|
|
225
|
+
background: transparent;
|
|
226
|
+
border-color: transparent;
|
|
227
|
+
color: var(--sigvelo-color-primary-text);
|
|
228
|
+
text-underline-offset: 4px;
|
|
229
|
+
|
|
230
|
+
&:hover:not(.disabled) {
|
|
231
|
+
text-decoration: underline;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* Icon buttons */
|
|
236
|
+
&.icon {
|
|
237
|
+
padding-inline: 0.75em;
|
|
238
|
+
|
|
239
|
+
&.xs {
|
|
240
|
+
padding-inline: 0.525em;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
&.sm {
|
|
244
|
+
padding-inline: 0.65em;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
&.lg {
|
|
248
|
+
padding-inline: 0.675em;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&.xl {
|
|
252
|
+
padding-inline: 0.55em;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/* Pills */
|
|
257
|
+
&.pill {
|
|
258
|
+
border-radius: var(--sigvelo-radius-full);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/* Toggle button indicators */
|
|
262
|
+
#toggle-indicator {
|
|
263
|
+
position: absolute;
|
|
264
|
+
bottom: 0.25em;
|
|
265
|
+
left: calc(50% - 0.5em);
|
|
266
|
+
width: 1em;
|
|
267
|
+
height: 0.25em;
|
|
268
|
+
border-radius: var(--sigvelo-radius-full);
|
|
269
|
+
background-color: currentColor;
|
|
270
|
+
opacity: 0.15;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
&[aria-pressed="true"] #toggle-indicator {
|
|
274
|
+
opacity: 1;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* Disabled */
|
|
278
|
+
&.disabled:not(.loading) {
|
|
279
|
+
cursor: not-allowed;
|
|
280
|
+
opacity: 0.5;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* Loading */
|
|
284
|
+
&.loading {
|
|
285
|
+
cursor: not-allowed;
|
|
286
|
+
|
|
287
|
+
#label {
|
|
288
|
+
visibility: hidden;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
#spinner {
|
|
293
|
+
--indicator-color: currentColor;
|
|
294
|
+
--track-color: color-mix(in oklab, currentColor, transparent 75%);
|
|
295
|
+
position: absolute;
|
|
296
|
+
top: calc(50% - 0.5em);
|
|
297
|
+
left: calc(50% - 0.5em);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
#caret {
|
|
301
|
+
font-size: 1.25em;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/* Visually hidden label */
|
|
305
|
+
slot[name="label"] {
|
|
306
|
+
display: inline;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* Grouped buttons */
|
|
311
|
+
:host([data-button-group-middle]) #button {
|
|
312
|
+
border-radius: 0;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
:host([data-button-group-horizontal][data-button-group-first]:not([data-button-group-last]))
|
|
316
|
+
#button {
|
|
317
|
+
border-start-end-radius: 0;
|
|
318
|
+
border-end-end-radius: 0;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
:host([data-button-group-horizontal][data-button-group-last]:not([data-button-group-first]))
|
|
322
|
+
#button {
|
|
323
|
+
border-start-start-radius: 0;
|
|
324
|
+
border-end-start-radius: 0;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
:host([data-button-group-vertical][data-button-group-first]:not([data-button-group-last]))
|
|
328
|
+
#button {
|
|
329
|
+
border-end-start-radius: 0;
|
|
330
|
+
border-end-end-radius: 0;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
:host([data-button-group-vertical][data-button-group-last]:not([data-button-group-first]))
|
|
334
|
+
#button {
|
|
335
|
+
border-start-start-radius: 0;
|
|
336
|
+
border-start-end-radius: 0;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
:host([variant="outline"][data-button-group-middle]),
|
|
340
|
+
:host([variant="outline"][data-button-group-last]) {
|
|
341
|
+
margin-inline-start: calc(var(--sigvelo-border-width) * -2);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/* Icons */
|
|
345
|
+
::slotted(sigvelo-icon) {
|
|
346
|
+
font-size: 1.25em;
|
|
347
|
+
stroke-width: 1.75px;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
::slotted(svg) {
|
|
351
|
+
width: 1.25em;
|
|
352
|
+
height: 1.25em;
|
|
353
|
+
}
|
|
354
|
+
`;
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region src/components/button/button.ts
|
|
357
|
+
/**
|
|
358
|
+
* <sigvelo-button>
|
|
359
|
+
*
|
|
360
|
+
* @summary Allows users to navigate, submit forms, and perform other actions.
|
|
361
|
+
* @tag sigvelo-button
|
|
362
|
+
* @documentation https://design-system.sigvelo.com/docs/components/button
|
|
363
|
+
* @status stable
|
|
364
|
+
* @since 1.0
|
|
365
|
+
*
|
|
366
|
+
* @dependency sigvelo-icon
|
|
367
|
+
* @dependency sigvelo-spinner
|
|
368
|
+
*
|
|
369
|
+
* @slot - The button's label.
|
|
370
|
+
* @slot start - An icon or similar element to place before the label. Works great with `<sigvelo-icon>`.
|
|
371
|
+
* @slot end - An icon or similar element to place after the label. Works great with `<sigvelo-icon>`.
|
|
372
|
+
*
|
|
373
|
+
* @event sigvelo-blur - Emitted when the button loses focus. This event does not bubble.
|
|
374
|
+
* @event sigvelo-long-press - Emitted when the button is pressed and held by tapping or with the mouse. You can look at
|
|
375
|
+
* `event.detail.originalEvent.type` to see the type of event that initiated the long press.
|
|
376
|
+
* @event sigvelo-focus - Emitted when the button receives focus. This event does not bubble.
|
|
377
|
+
*
|
|
378
|
+
* @csspart button - The internal `<button>` element. Other than `width`, this is where most custom styles should be
|
|
379
|
+
* applied.
|
|
380
|
+
* @csspart caret - The caret icon, a `<sigvelo-icon>` element. Only present with the `with-caret` attribute.
|
|
381
|
+
* @csspart caret__svg - The caret icon's `<svg>` part.
|
|
382
|
+
* @csspart spinner - The loading indicator, a `<sigvelo-spinner>` element. Only present with the `loading` attribute.
|
|
383
|
+
* @csspart toggle-indicator - When the button is a toggle button, this is the indicator that shows the current state.
|
|
384
|
+
|
|
385
|
+
* @cssstate disabled - Applied when the button is disabled.
|
|
386
|
+
* @cssstate focused - Applied when the button has focus.
|
|
387
|
+
* @cssstate loading - Applied when a toggle button is loading.
|
|
388
|
+
* @cssstate toggled - Applied when a toggle button is activated.
|
|
389
|
+
*
|
|
390
|
+
* @example Variants
|
|
391
|
+
* Set the `color` attribute to `neutral`, `primary`, or `destructive` to change the button's color.
|
|
392
|
+
*
|
|
393
|
+
* ```html
|
|
394
|
+
* <sigvelo-button color="neutral">
|
|
395
|
+
* Neutral
|
|
396
|
+
* </sigvelo-button>
|
|
397
|
+
*
|
|
398
|
+
* <sigvelo-button color="primary">
|
|
399
|
+
* Primary
|
|
400
|
+
* </sigvelo-button>
|
|
401
|
+
*
|
|
402
|
+
* <sigvelo-button color="destructive">
|
|
403
|
+
* Destructive
|
|
404
|
+
* </sigvelo-button>
|
|
405
|
+
* ```
|
|
406
|
+
*
|
|
407
|
+
* **Note:** There is no `success` button by design. Use the `primary` color for success actions.
|
|
408
|
+
*
|
|
409
|
+
* @example Start & end icons
|
|
410
|
+
* Use the `start` and `end` slots to add icons. For best results, use a `<sigvelo-icon>` or an `<svg>` element.
|
|
411
|
+
*
|
|
412
|
+
* ```html
|
|
413
|
+
* <sigvelo-button>
|
|
414
|
+
* <sigvelo-icon slot="start" name="settings"></sigvelo-icon>
|
|
415
|
+
* Settings
|
|
416
|
+
* </sigvelo-button>
|
|
417
|
+
*
|
|
418
|
+
* <sigvelo-button>
|
|
419
|
+
* Favorite
|
|
420
|
+
* <sigvelo-icon slot="end" name="heart"></sigvelo-icon>
|
|
421
|
+
* </sigvelo-button>
|
|
422
|
+
*
|
|
423
|
+
* <sigvelo-button>
|
|
424
|
+
* <sigvelo-icon slot="start" name="link"></sigvelo-icon>
|
|
425
|
+
* Open
|
|
426
|
+
* <sigvelo-icon slot="end" name="external-link"></sigvelo-icon>
|
|
427
|
+
* </sigvelo-button>
|
|
428
|
+
* ```
|
|
429
|
+
*
|
|
430
|
+
* @example Link buttons
|
|
431
|
+
* Any button can be rendered as a link by setting the `href` attribute. This is useful to allow buttons to act as navigation. When `href` is present, other link options such as `download`, `rel`, and `target` also become available.
|
|
432
|
+
*
|
|
433
|
+
* ```html
|
|
434
|
+
* <sigvelo-button href="https://example.com/" target="_blank" rel="noreferrer noopener">
|
|
435
|
+
* I'm secretly a link
|
|
436
|
+
* </sigvelo-button>
|
|
437
|
+
*
|
|
438
|
+
* <sigvelo-button href="/assets/images/logo-light.svg" download>
|
|
439
|
+
* Download the logo
|
|
440
|
+
* </sigvelo-button>
|
|
441
|
+
* ```
|
|
442
|
+
*
|
|
443
|
+
* **Note:** Because link buttons become anchors, they cannot be used with `disabled` or `loading`.
|
|
444
|
+
*
|
|
445
|
+
* @example Changing the width
|
|
446
|
+
* To change a button's width, use the CSS `width` property.
|
|
447
|
+
*
|
|
448
|
+
* ```html
|
|
449
|
+
* <sigvelo-button style="width: 100%">
|
|
450
|
+
* I'm much longer now
|
|
451
|
+
* </sigvelo-button>
|
|
452
|
+
* ```
|
|
453
|
+
*
|
|
454
|
+
* @example Changing the size
|
|
455
|
+
* Use the `size` attribute to change the button's size. Available sizes include `xs`, `sm`, `md`, `lg`, and `xl`, with the default being `sm`.
|
|
456
|
+
*
|
|
457
|
+
* ```html
|
|
458
|
+
* <sigvelo-button size="xs">Extra small</sigvelo-button>
|
|
459
|
+
* <sigvelo-button size="sm">Small</sigvelo-button>
|
|
460
|
+
* <sigvelo-button size="md">Medium</sigvelo-button>
|
|
461
|
+
* <sigvelo-button size="lg">Large</sigvelo-button>
|
|
462
|
+
* <sigvelo-button size="xl">Extra large</sigvelo-button>
|
|
463
|
+
* ```
|
|
464
|
+
*
|
|
465
|
+
* @example Outline buttons
|
|
466
|
+
* Set the `variant` attribute to `outline` to draw outlined buttons.
|
|
467
|
+
*
|
|
468
|
+
* ```html
|
|
469
|
+
* <sigvelo-button variant="outline" color="neutral">
|
|
470
|
+
* Neutral
|
|
471
|
+
* </sigvelo-button>
|
|
472
|
+
*
|
|
473
|
+
* <sigvelo-button variant="outline" color="primary">
|
|
474
|
+
* Primary
|
|
475
|
+
* </sigvelo-button>
|
|
476
|
+
*
|
|
477
|
+
* <sigvelo-button variant="outline" color="destructive">
|
|
478
|
+
* Destructive
|
|
479
|
+
* </sigvelo-button>
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* Set `variant="surface"` for a raised neutral action surface.
|
|
483
|
+
*
|
|
484
|
+
* ```html
|
|
485
|
+
* <sigvelo-button variant="surface">Open details</sigvelo-button>
|
|
486
|
+
* ```
|
|
487
|
+
*
|
|
488
|
+
* @example Text buttons
|
|
489
|
+
* Set the `variant` attribute to `ghost` to draw ghost buttons. Ghost buttons share the same size and padding as normal buttons, but don't have a background.
|
|
490
|
+
*
|
|
491
|
+
* ```html
|
|
492
|
+
* <sigvelo-button variant="ghost">
|
|
493
|
+
* I'm text
|
|
494
|
+
* </sigvelo-button>
|
|
495
|
+
* ```
|
|
496
|
+
*
|
|
497
|
+
* @example Pill-shaped buttons
|
|
498
|
+
* Buttons can be rendered with pill-shaped edges by adding the `pill` attribute.
|
|
499
|
+
*
|
|
500
|
+
* ```html
|
|
501
|
+
* <sigvelo-button pill color="neutral">
|
|
502
|
+
* Neutral
|
|
503
|
+
* </sigvelo-button>
|
|
504
|
+
*
|
|
505
|
+
* <sigvelo-button pill color="primary">
|
|
506
|
+
* Primary
|
|
507
|
+
* </sigvelo-button>
|
|
508
|
+
*
|
|
509
|
+
* <sigvelo-button pill color="destructive">
|
|
510
|
+
* Destructive
|
|
511
|
+
* </sigvelo-button>
|
|
512
|
+
* ```
|
|
513
|
+
*
|
|
514
|
+
* @example Icon buttons
|
|
515
|
+
* To create an icon button, place an icon into the button's default slot and set the `icon-label` attribute to an appropriate label. The label won't be visible, but it will be available to assistive devices.
|
|
516
|
+
*
|
|
517
|
+
* ```html
|
|
518
|
+
* <sigvelo-button icon-label="Accept" color="primary">
|
|
519
|
+
* <sigvelo-icon name="check"></sigvelo-icon>
|
|
520
|
+
* </sigvelo-button>
|
|
521
|
+
*
|
|
522
|
+
* <sigvelo-button icon-label="Reload">
|
|
523
|
+
* <sigvelo-icon name="refresh"></sigvelo-icon>
|
|
524
|
+
* </sigvelo-button>
|
|
525
|
+
*
|
|
526
|
+
* <sigvelo-button icon-label="Delete" color="destructive">
|
|
527
|
+
* <sigvelo-icon name="trash"></sigvelo-icon>
|
|
528
|
+
* </sigvelo-button>
|
|
529
|
+
*
|
|
530
|
+
* <sigvelo-button icon-label="Close" variant="ghost">
|
|
531
|
+
* <sigvelo-icon name="x"></sigvelo-icon>
|
|
532
|
+
* </sigvelo-button>
|
|
533
|
+
* ```
|
|
534
|
+
*
|
|
535
|
+
* @example Toggle buttons
|
|
536
|
+
* Create a toggle button by adding the `toggle="off"` attribute. To make it active by default, use `toggle="on"` instead. An indicator is shown to make it obvious when the toggle is selected.
|
|
537
|
+
*
|
|
538
|
+
* ```html
|
|
539
|
+
* <sigvelo-button color="neutral" toggle="off" icon-label="Filter">
|
|
540
|
+
* <sigvelo-icon name="filter"></sigvelo-icon>
|
|
541
|
+
* </sigvelo-button>
|
|
542
|
+
*
|
|
543
|
+
* <sigvelo-button color="primary" toggle="off" icon-label="Alarm">
|
|
544
|
+
* <sigvelo-icon name="bell"></sigvelo-icon>
|
|
545
|
+
* </sigvelo-button>
|
|
546
|
+
*
|
|
547
|
+
* <sigvelo-button color="destructive" toggle="off" icon-label="Record">
|
|
548
|
+
* <sigvelo-icon name="microphone"></sigvelo-icon>
|
|
549
|
+
* </sigvelo-button>
|
|
550
|
+
*
|
|
551
|
+
* <sigvelo-button variant="ghost" toggle="off" icon-label="Mute">
|
|
552
|
+
* <sigvelo-icon name="volume-3"></sigvelo-icon>
|
|
553
|
+
* </sigvelo-button>
|
|
554
|
+
* ```
|
|
555
|
+
*
|
|
556
|
+
* **Warning:** Toggle buttons cannot be used with link buttons or submit buttons.
|
|
557
|
+
*
|
|
558
|
+
* @example Loading buttons
|
|
559
|
+
* To show the button in a loading state, add the `loading` attribute. When a button is loading, it is effectively disabled and `click` events will not be emitted.
|
|
560
|
+
*
|
|
561
|
+
* ```html
|
|
562
|
+
* <sigvelo-button loading>
|
|
563
|
+
* I'm loading
|
|
564
|
+
* </sigvelo-button>
|
|
565
|
+
* ```
|
|
566
|
+
*
|
|
567
|
+
* @example Disabling
|
|
568
|
+
* To disable a button, add the `disabled` attribute. When a button is disabled, the `click` event will not be emitted.
|
|
569
|
+
*
|
|
570
|
+
* ```html
|
|
571
|
+
* <sigvelo-button disabled>Regular button</sigvelo-button>
|
|
572
|
+
* <sigvelo-button href="https://example.com/" disabled>Link button</sigvelo-button>
|
|
573
|
+
* ```
|
|
574
|
+
*
|
|
575
|
+
* @example Adding a dropdown caret
|
|
576
|
+
* A caret can be shown to indicate the button opens a dropdown menu by adding the `with-caret` attribute.
|
|
577
|
+
*
|
|
578
|
+
* ```html
|
|
579
|
+
* <sigvelo-button with-caret>Dropdown</sigvelo-button>
|
|
580
|
+
* ```
|
|
581
|
+
*
|
|
582
|
+
* @example Listening for long press
|
|
583
|
+
* You can detect long presses by listening to the `sigvelo-long-press` event. The event is dispatched when the button is clicked or tapped and held for 700 milliseconds.
|
|
584
|
+
*
|
|
585
|
+
* You can determine if the initiating event was a click (`pointer`) or tap (`touch`) by looking at `event.detail.type`. You can also look at `event.detail.originalEvent` to get the coordinates and other details.
|
|
586
|
+
*
|
|
587
|
+
* ```html
|
|
588
|
+
* <sigvelo-button id="button__long-press">Press and hold</sigvelo-button>
|
|
589
|
+
*
|
|
590
|
+
* <script>
|
|
591
|
+
* const button = document.getElementById('button__long-press');
|
|
592
|
+
*
|
|
593
|
+
* button.addEventListener('sigvelo-long-press', async event => {
|
|
594
|
+
* // Log the coordinates and the type of event that initiated the
|
|
595
|
+
* // long press, i.e. pointer (mouse) or touch (tap)
|
|
596
|
+
* const type = event.detail.type;
|
|
597
|
+
* const { clientX, clientY } = event.detail.originalEvent;
|
|
598
|
+
*
|
|
599
|
+
* console.log(`${type} at ${parseInt(clientX)}×${parseInt(clientY)}`);
|
|
600
|
+
*
|
|
601
|
+
* // Animate the button
|
|
602
|
+
* button.animate([
|
|
603
|
+
* { scale: 1, offset: 0 },
|
|
604
|
+
* { scale: 1.2, offset: 0.1 },
|
|
605
|
+
* { scale: 1, offset: 1 }
|
|
606
|
+
* ], {
|
|
607
|
+
* duration: 500,
|
|
608
|
+
* easing: 'linear'
|
|
609
|
+
* });
|
|
610
|
+
* });
|
|
611
|
+
* <\/script>
|
|
612
|
+
* ```
|
|
613
|
+
*/
|
|
614
|
+
var SigveloButton = class extends SigveloFormControlElement {
|
|
615
|
+
constructor(..._args) {
|
|
616
|
+
super(..._args);
|
|
617
|
+
this.variant = "normal";
|
|
618
|
+
this.color = "primary";
|
|
619
|
+
this.disabled = false;
|
|
620
|
+
this.loading = false;
|
|
621
|
+
this.size = "sm";
|
|
622
|
+
this.pill = false;
|
|
623
|
+
this.type = "button";
|
|
624
|
+
this.value = "";
|
|
625
|
+
this.withCaret = false;
|
|
626
|
+
}
|
|
627
|
+
static {
|
|
628
|
+
this.formAssociated = true;
|
|
629
|
+
}
|
|
630
|
+
static {
|
|
631
|
+
this.shadowRootOptions = {
|
|
632
|
+
...SigveloFormControlElement.shadowRootOptions,
|
|
633
|
+
delegatesFocus: true
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
static {
|
|
637
|
+
this.styles = [hostStyles, button_styles_default];
|
|
638
|
+
}
|
|
639
|
+
get focusableAnchor() {
|
|
640
|
+
return this.shadowRoot.querySelector("button");
|
|
641
|
+
}
|
|
642
|
+
firstUpdated() {
|
|
643
|
+
const button = this.shadowRoot.getElementById("button");
|
|
644
|
+
this.longPress = new LongPress(button, { eventName: "sigvelo-long-press" });
|
|
645
|
+
this.longPress.start();
|
|
646
|
+
}
|
|
647
|
+
updated(changedProperties) {
|
|
648
|
+
if (changedProperties.has("disabled")) this.customStates.set("disabled", this.disabled);
|
|
649
|
+
if (changedProperties.has("loading")) this.customStates.set("loading", this.loading);
|
|
650
|
+
}
|
|
651
|
+
handleBlur() {
|
|
652
|
+
this.customStates.set("focused", false);
|
|
653
|
+
this.dispatchEvent(new SigveloBlurEvent());
|
|
654
|
+
}
|
|
655
|
+
handleFocus() {
|
|
656
|
+
this.customStates.set("focused", true);
|
|
657
|
+
this.dispatchEvent(new SigveloFocusEvent());
|
|
658
|
+
}
|
|
659
|
+
handleClick(event) {
|
|
660
|
+
if (this.disabled || this.loading) {
|
|
661
|
+
event.preventDefault();
|
|
662
|
+
event.stopImmediatePropagation();
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
if (this.toggle !== void 0) {
|
|
666
|
+
this.toggle = this.toggle === "on" ? "off" : "on";
|
|
667
|
+
this.customStates.set("toggled", this.toggle === "on");
|
|
668
|
+
}
|
|
669
|
+
if (this.type === "reset" && this.internals.form) {
|
|
670
|
+
this.internals.form.reset();
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
if (this.type === "submit" && this.internals.form) {
|
|
674
|
+
const submitter = document.createElement("button");
|
|
675
|
+
submitter.style.position = "absolute";
|
|
676
|
+
submitter.style.width = "1px";
|
|
677
|
+
submitter.style.height = "1px";
|
|
678
|
+
submitter.style.overflow = "hidden";
|
|
679
|
+
submitter.style.whiteSpace = "nowrap";
|
|
680
|
+
submitter.style.clipPath = "inset(50%)";
|
|
681
|
+
submitter.type = "submit";
|
|
682
|
+
if (this.name) submitter.name = this.name;
|
|
683
|
+
if (this.value) submitter.value = this.value;
|
|
684
|
+
[
|
|
685
|
+
"formaction",
|
|
686
|
+
"formenctype",
|
|
687
|
+
"formmethod",
|
|
688
|
+
"formnovalidate",
|
|
689
|
+
"formtarget"
|
|
690
|
+
].forEach((attr) => {
|
|
691
|
+
if (this.hasAttribute(attr)) submitter.setAttribute(attr, this.getAttribute(attr) ?? "");
|
|
692
|
+
});
|
|
693
|
+
this.internals.form.append(submitter);
|
|
694
|
+
requestAnimationFrame(() => {
|
|
695
|
+
submitter.click();
|
|
696
|
+
submitter.remove();
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
render() {
|
|
701
|
+
const isLink = typeof this.href === "string";
|
|
702
|
+
const isDisabled = this.disabled || !isLink && this.loading;
|
|
703
|
+
const isLoading = !isLink && this.loading;
|
|
704
|
+
const isSubmit = this.type === "submit";
|
|
705
|
+
const isToggle = this.toggle !== void 0 && !isLink && !isSubmit;
|
|
706
|
+
const tag = isLink ? literal`a` : literal`button`;
|
|
707
|
+
return html$1`
|
|
708
|
+
<${tag}
|
|
709
|
+
id="button"
|
|
710
|
+
part="button"
|
|
711
|
+
class=${classMap({
|
|
712
|
+
neutral: this.color === "neutral",
|
|
713
|
+
primary: this.color === "primary",
|
|
714
|
+
destructive: this.color === "destructive",
|
|
715
|
+
normal: this.variant === "normal",
|
|
716
|
+
surface: this.variant === "surface",
|
|
717
|
+
outline: this.variant === "outline",
|
|
718
|
+
ghost: this.variant === "ghost",
|
|
719
|
+
link: this.variant === "link",
|
|
720
|
+
xs: this.size === "xs",
|
|
721
|
+
sm: this.size === "sm",
|
|
722
|
+
md: this.size === "md",
|
|
723
|
+
lg: this.size === "lg",
|
|
724
|
+
xl: this.size === "xl",
|
|
725
|
+
pill: this.pill,
|
|
726
|
+
icon: this.iconLabel?.length > 0,
|
|
727
|
+
disabled: isDisabled,
|
|
728
|
+
loading: isLoading
|
|
729
|
+
})}
|
|
730
|
+
type=${ifDefined(isLink ? void 0 : this.type)}
|
|
731
|
+
?disabled=${ifDefined(isLink ? void 0 : this.disabled)}
|
|
732
|
+
value=${ifDefined(isLink ? void 0 : this.value)}
|
|
733
|
+
href=${ifDefined(isLink && !this.disabled ? this.href : void 0)}
|
|
734
|
+
target=${ifDefined(isLink ? this.target : void 0)}
|
|
735
|
+
download=${ifDefined(isLink ? this.download : void 0)}
|
|
736
|
+
rel=${ifDefined(isLink && this.rel ? this.rel : void 0)}
|
|
737
|
+
aria-label=${ifDefined(this.iconLabel ? this.iconLabel : void 0)}
|
|
738
|
+
aria-pressed=${ifDefined(isToggle ? this.toggle === "on" ? "true" : "false" : void 0)}
|
|
739
|
+
@blur=${this.handleBlur}
|
|
740
|
+
@focus=${this.handleFocus}
|
|
741
|
+
@click=${this.handleClick}
|
|
742
|
+
>
|
|
743
|
+
${isLoading ? html$1` <sigvelo-spinner id="spinner" part="spinner"></sigvelo-spinner> ` : ""}
|
|
744
|
+
<slot name="start"></slot>
|
|
745
|
+
<slot id="label" part="label"></slot>
|
|
746
|
+
<slot name="end"></slot>
|
|
747
|
+
${this.withCaret ? html$1`
|
|
748
|
+
<sigvelo-icon
|
|
749
|
+
id="caret"
|
|
750
|
+
part="caret"
|
|
751
|
+
exportparts="svg:caret__svg"
|
|
752
|
+
slot="end"
|
|
753
|
+
name="chevron-down"
|
|
754
|
+
library="system"
|
|
755
|
+
></sigvelo-icon>
|
|
756
|
+
` : ""}
|
|
757
|
+
${isToggle ? html$1` <span part="toggle-indicator" id="toggle-indicator"></span> ` : ""}
|
|
758
|
+
</${tag}>
|
|
759
|
+
`;
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
__decorate([property({ reflect: true })], SigveloButton.prototype, "variant", void 0);
|
|
763
|
+
__decorate([property({ reflect: true })], SigveloButton.prototype, "color", void 0);
|
|
764
|
+
__decorate([property({
|
|
765
|
+
type: Boolean,
|
|
766
|
+
reflect: true
|
|
767
|
+
})], SigveloButton.prototype, "disabled", void 0);
|
|
768
|
+
__decorate([property({
|
|
769
|
+
type: Boolean,
|
|
770
|
+
reflect: true
|
|
771
|
+
})], SigveloButton.prototype, "loading", void 0);
|
|
772
|
+
__decorate([property({ reflect: true })], SigveloButton.prototype, "toggle", void 0);
|
|
773
|
+
__decorate([property({ reflect: true })], SigveloButton.prototype, "size", void 0);
|
|
774
|
+
__decorate([property({ attribute: "icon-label" })], SigveloButton.prototype, "iconLabel", void 0);
|
|
775
|
+
__decorate([property({
|
|
776
|
+
type: Boolean,
|
|
777
|
+
reflect: true
|
|
778
|
+
})], SigveloButton.prototype, "pill", void 0);
|
|
779
|
+
__decorate([property()], SigveloButton.prototype, "type", void 0);
|
|
780
|
+
__decorate([property({ reflect: true })], SigveloButton.prototype, "name", void 0);
|
|
781
|
+
__decorate([property()], SigveloButton.prototype, "value", void 0);
|
|
782
|
+
__decorate([property({
|
|
783
|
+
attribute: "with-caret",
|
|
784
|
+
type: Boolean,
|
|
785
|
+
reflect: true
|
|
786
|
+
})], SigveloButton.prototype, "withCaret", void 0);
|
|
787
|
+
__decorate([property()], SigveloButton.prototype, "href", void 0);
|
|
788
|
+
__decorate([property()], SigveloButton.prototype, "target", void 0);
|
|
789
|
+
__decorate([property()], SigveloButton.prototype, "rel", void 0);
|
|
790
|
+
__decorate([property()], SigveloButton.prototype, "download", void 0);
|
|
791
|
+
__decorate([property()], SigveloButton.prototype, "form", void 0);
|
|
792
|
+
__decorate([property({ attribute: "formaction" })], SigveloButton.prototype, "formAction", void 0);
|
|
793
|
+
__decorate([property({ attribute: "formenctype" })], SigveloButton.prototype, "formEnctype", void 0);
|
|
794
|
+
__decorate([property({ attribute: "formmethod" })], SigveloButton.prototype, "formMethod", void 0);
|
|
795
|
+
__decorate([property({
|
|
796
|
+
attribute: "formnovalidate",
|
|
797
|
+
type: Boolean
|
|
798
|
+
})], SigveloButton.prototype, "formNoValidate", void 0);
|
|
799
|
+
__decorate([property({ attribute: "formtarget" })], SigveloButton.prototype, "formTarget", void 0);
|
|
800
|
+
customElements.define("sigvelo-button", SigveloButton);
|
|
801
|
+
//#endregion
|
|
802
|
+
export { SigveloButton as t };
|