@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,1693 @@
|
|
|
1
|
+
import { Localize } from "./utilities/localize.js";
|
|
2
|
+
import "./icon-BPVkNsY4.js";
|
|
3
|
+
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
4
|
+
import "./combobox-item-yM6tDrGG.js";
|
|
5
|
+
import { css, html } from "lit";
|
|
6
|
+
import { property, query, state } from "lit/decorators.js";
|
|
7
|
+
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
8
|
+
import { SigveloFormControlElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
9
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
10
|
+
import { animateWithClass } from "@mcp-b/wc-support/utilities/animate";
|
|
11
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
12
|
+
import { SigveloBeforeCloseEvent, SigveloBeforeOpenEvent, SigveloCloseEvent, SigveloOpenEvent } from "@mcp-b/wc-support/events/open-close";
|
|
13
|
+
import { SigveloBlurEvent, SigveloChangeEvent, SigveloFocusEvent, SigveloInputEvent } from "@mcp-b/wc-support/events/form";
|
|
14
|
+
import formControlStyles from "@mcp-b/wc-support/styles/form-control.styles";
|
|
15
|
+
import { autoUpdate, computePosition, flip, offset, shift, size } from "@floating-ui/dom";
|
|
16
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
17
|
+
//#region src/components/combobox/combobox.styles.ts
|
|
18
|
+
var combobox_styles_default = css`
|
|
19
|
+
:host {
|
|
20
|
+
--text-box-min-width: 12ch;
|
|
21
|
+
--show-duration: var(--sigvelo-motion-duration-interaction);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Visual box base styles */
|
|
25
|
+
#visual-box {
|
|
26
|
+
display: flex;
|
|
27
|
+
position: relative;
|
|
28
|
+
align-items: center;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
padding: 0 0.75em;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
gap: 0.5em;
|
|
33
|
+
font: inherit;
|
|
34
|
+
cursor: text;
|
|
35
|
+
|
|
36
|
+
/* Collapse padding when a tag is present and there's no start content */
|
|
37
|
+
&:has(.tag):not(.has-start) {
|
|
38
|
+
padding-inline-start: 0.25em;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Appearance styles */
|
|
42
|
+
&.normal {
|
|
43
|
+
border: var(--sigvelo-border-style) var(--sigvelo-border-width)
|
|
44
|
+
var(--sigvelo-color-neutral-border-muted);
|
|
45
|
+
border-radius: var(--sigvelo-radius-md);
|
|
46
|
+
background-color: var(--sigvelo-color-surface);
|
|
47
|
+
color: var(--sigvelo-color-text);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&.filled {
|
|
51
|
+
border: var(--sigvelo-border-style) var(--sigvelo-border-width)
|
|
52
|
+
var(--sigvelo-color-neutral-bg-subtle);
|
|
53
|
+
border-radius: var(--sigvelo-radius-md);
|
|
54
|
+
background-color: var(--sigvelo-color-neutral-bg-subtle);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.unstyled {
|
|
58
|
+
padding: 0;
|
|
59
|
+
border: none;
|
|
60
|
+
background: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Disabled state */
|
|
64
|
+
#visual-box.disabled {
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
opacity: 0.5;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Pill modifier */
|
|
70
|
+
&.pill {
|
|
71
|
+
padding: 0 1.25em;
|
|
72
|
+
border-radius: 1.4em; /* fake a pill shape so when it wraps, tags still fit */
|
|
73
|
+
|
|
74
|
+
.tag {
|
|
75
|
+
border-radius: var(--sigvelo-radius-full);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Sizes */
|
|
80
|
+
&.xs {
|
|
81
|
+
min-height: calc(var(--sigvelo-control-height-xs) - 0.5em);
|
|
82
|
+
padding-block: 0.25em;
|
|
83
|
+
font-size: var(--sigvelo-control-text-xs);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&.sm {
|
|
87
|
+
min-height: calc(var(--sigvelo-control-height-sm) - 0.5em);
|
|
88
|
+
padding-block: 0.25em;
|
|
89
|
+
font-size: var(--sigvelo-control-text-sm);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&.md {
|
|
93
|
+
min-height: calc(var(--sigvelo-control-height-md));
|
|
94
|
+
padding-block: 0.25em;
|
|
95
|
+
font-size: var(--sigvelo-control-text-md);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&.lg {
|
|
99
|
+
min-height: calc(var(--sigvelo-control-height-lg) - 0.5em);
|
|
100
|
+
padding-block: 0.25em;
|
|
101
|
+
font-size: var(--sigvelo-control-text-lg);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.xl {
|
|
105
|
+
min-height: calc(var(--sigvelo-control-height-xl) - 0.5em);
|
|
106
|
+
padding-block: 0.25em;
|
|
107
|
+
font-size: var(--sigvelo-control-text-xl);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* Focus styles */
|
|
112
|
+
:not(:host([variant="unstyled"])) #visual-box:has(#text-box:focus-visible) {
|
|
113
|
+
outline: var(--sigvelo-border-style) calc(var(--sigvelo-border-width) + 1px)
|
|
114
|
+
var(--sigvelo-color-focus);
|
|
115
|
+
outline-offset: calc(-1 * var(--sigvelo-border-width));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Input area - single flex container for all content */
|
|
119
|
+
#input-area {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex: 1 1 0;
|
|
122
|
+
flex-wrap: wrap;
|
|
123
|
+
align-items: center;
|
|
124
|
+
min-width: 0;
|
|
125
|
+
gap: 0.25em;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* Individual tags */
|
|
129
|
+
.tag {
|
|
130
|
+
display: inline-flex;
|
|
131
|
+
flex: 0 0 auto;
|
|
132
|
+
align-items: center;
|
|
133
|
+
min-width: 0; /* Allow tags to shrink */
|
|
134
|
+
max-width: 100%;
|
|
135
|
+
padding: 0.25em 0.5em;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
gap: 0.25em;
|
|
138
|
+
border-radius: var(--sigvelo-radius-sm);
|
|
139
|
+
background-color: var(--sigvelo-color-neutral-bg-subtle);
|
|
140
|
+
color: var(--sigvelo-color-neutral-text-on-subtle);
|
|
141
|
+
line-height: 1.2;
|
|
142
|
+
text-overflow: ellipsis;
|
|
143
|
+
white-space: nowrap;
|
|
144
|
+
user-select: none;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.tag-remove {
|
|
148
|
+
display: inline-flex;
|
|
149
|
+
flex: 0 0 auto;
|
|
150
|
+
align-items: center;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
width: 1.25em;
|
|
153
|
+
height: 1.25em;
|
|
154
|
+
margin: 0;
|
|
155
|
+
margin-inline-start: 0.125em;
|
|
156
|
+
margin-inline-end: -0.125em;
|
|
157
|
+
padding: 0;
|
|
158
|
+
border: none;
|
|
159
|
+
border-radius: var(--sigvelo-radius-sm);
|
|
160
|
+
background: transparent;
|
|
161
|
+
color: var(--sigvelo-color-text-muted);
|
|
162
|
+
font-size: inherit;
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
transition: var(--sigvelo-motion-duration-interaction) translate ease;
|
|
165
|
+
|
|
166
|
+
sigvelo-icon {
|
|
167
|
+
stroke-width: 0.1667em;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.tag-remove:active {
|
|
172
|
+
translate: 0 var(--sigvelo-motion-distance-xs);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
#visual-box.filled .tag {
|
|
176
|
+
background-color: var(--sigvelo-color-neutral-bg-muted);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Text input - base styles */
|
|
180
|
+
#text-box {
|
|
181
|
+
appearance: none;
|
|
182
|
+
flex: 1 1 auto;
|
|
183
|
+
width: 100%;
|
|
184
|
+
min-width: 0;
|
|
185
|
+
margin: 0;
|
|
186
|
+
border: none;
|
|
187
|
+
background: none;
|
|
188
|
+
color: var(--sigvelo-color-text);
|
|
189
|
+
font: inherit;
|
|
190
|
+
cursor: inherit;
|
|
191
|
+
|
|
192
|
+
&:focus {
|
|
193
|
+
outline: none;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&::placeholder {
|
|
197
|
+
color: var(--sigvelo-control-placeholder-color);
|
|
198
|
+
user-select: none;
|
|
199
|
+
-webkit-user-select: none;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
#visual-box.xs {
|
|
204
|
+
.tag,
|
|
205
|
+
#text-box {
|
|
206
|
+
height: calc(var(--sigvelo-control-height-xs) - (2 * var(--sigvelo-border-width)) - 0.5em);
|
|
207
|
+
min-height: 0;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
#visual-box.sm {
|
|
212
|
+
.tag,
|
|
213
|
+
#text-box {
|
|
214
|
+
height: calc(var(--sigvelo-control-height-sm) - (2 * var(--sigvelo-border-width)) - 0.5em);
|
|
215
|
+
min-height: 0;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
#visual-box.md {
|
|
220
|
+
.tag,
|
|
221
|
+
#text-box {
|
|
222
|
+
height: calc(var(--sigvelo-control-height-md) - (2 * var(--sigvelo-border-width)) - 0.5em);
|
|
223
|
+
min-height: 0;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
#visual-box.lg {
|
|
228
|
+
.tag,
|
|
229
|
+
#text-box {
|
|
230
|
+
height: calc(var(--sigvelo-control-height-lg) - (2 * var(--sigvelo-border-width)) - 0.5em);
|
|
231
|
+
min-height: 0;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
#visual-box.xl {
|
|
235
|
+
.tag,
|
|
236
|
+
#text-box {
|
|
237
|
+
height: calc(var(--sigvelo-control-height-xl) - (2 * var(--sigvelo-border-width)) - 0.5em);
|
|
238
|
+
min-height: 0;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
#visual-box:has(.tag) #text-box {
|
|
243
|
+
margin-inline: 0.5em;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* Multiple select mode - dynamic width with constraints */
|
|
247
|
+
#visual-box.multiple #text-box {
|
|
248
|
+
flex: 1 1 var(--text-box-min-width);
|
|
249
|
+
width: auto;
|
|
250
|
+
min-width: var(--text-box-min-width);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* When tags wrap to multiple lines, let input take full width of new line */
|
|
254
|
+
#visual-box.multiple #text-box:first-child,
|
|
255
|
+
#visual-box.multiple #text-box:only-child {
|
|
256
|
+
flex: 1 1 100%;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* RTL support for clear button */
|
|
260
|
+
:host(:dir(rtl)) #visual-box.has-clear {
|
|
261
|
+
padding-inline-start: 2.5em;
|
|
262
|
+
padding-inline-end: 0.75em;
|
|
263
|
+
|
|
264
|
+
#clear-button {
|
|
265
|
+
right: auto;
|
|
266
|
+
left: 0.25em;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* Clear button styles */
|
|
271
|
+
.text-box-button {
|
|
272
|
+
display: flex;
|
|
273
|
+
flex: 0 0 auto;
|
|
274
|
+
align-items: center;
|
|
275
|
+
align-self: stretch;
|
|
276
|
+
justify-content: center;
|
|
277
|
+
margin: 0;
|
|
278
|
+
padding: 0;
|
|
279
|
+
padding-inline: 0.25em;
|
|
280
|
+
border: none;
|
|
281
|
+
background: none;
|
|
282
|
+
color: var(--sigvelo-color-text-muted);
|
|
283
|
+
font: inherit;
|
|
284
|
+
font-size: 1.25em;
|
|
285
|
+
cursor: pointer;
|
|
286
|
+
transition: var(--sigvelo-motion-duration-interaction) translate ease;
|
|
287
|
+
|
|
288
|
+
&:active {
|
|
289
|
+
translate: 0 1px;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* Start and end slot styles */
|
|
294
|
+
slot[name="start"]::slotted(*),
|
|
295
|
+
slot[name="end"]::slotted(*) {
|
|
296
|
+
color: var(--sigvelo-color-text-muted) !important;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
slot[name="start"]::slotted(sigvelo-icon),
|
|
300
|
+
slot[name="end"]::slotted(sigvelo-icon) {
|
|
301
|
+
font-size: 1.25em !important;
|
|
302
|
+
pointer-events: none;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
slot[name="start"]::slotted(svg),
|
|
306
|
+
slot[name="end"]::slotted(svg) {
|
|
307
|
+
width: 1.25em;
|
|
308
|
+
height: 1.25em;
|
|
309
|
+
pointer-events: none;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
#chevron {
|
|
313
|
+
flex: 0 0 auto;
|
|
314
|
+
font-size: 1.25em;
|
|
315
|
+
pointer-events: none;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* Dropdown styles */
|
|
319
|
+
#dropdown {
|
|
320
|
+
display: flex;
|
|
321
|
+
z-index: 10;
|
|
322
|
+
position: absolute;
|
|
323
|
+
top: 0;
|
|
324
|
+
left: 0;
|
|
325
|
+
flex-direction: column;
|
|
326
|
+
width: max-content;
|
|
327
|
+
margin: 0;
|
|
328
|
+
padding: 0.25em;
|
|
329
|
+
overflow-y: auto;
|
|
330
|
+
border: var(--sigvelo-border-style) var(--sigvelo-border-width)
|
|
331
|
+
var(--sigvelo-color-neutral-border-muted);
|
|
332
|
+
border-radius: var(--sigvelo-radius-md);
|
|
333
|
+
background-color: var(--sigvelo-color-surface);
|
|
334
|
+
box-shadow: var(--sigvelo-elevation-floating);
|
|
335
|
+
|
|
336
|
+
/* Popover API overrides */
|
|
337
|
+
&[popover] {
|
|
338
|
+
margin: 0;
|
|
339
|
+
inset: auto;
|
|
340
|
+
padding: 0.25em;
|
|
341
|
+
border-radius: var(--sigvelo-radius-md);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
&.show {
|
|
345
|
+
animation: show var(--show-duration) ease;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
&.hide {
|
|
349
|
+
animation: show var(--show-duration) ease reverse;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/* Placement origins */
|
|
354
|
+
:host([data-placement^="top"]) #dropdown {
|
|
355
|
+
transform-origin: bottom;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
:host([data-placement^="bottom"]) #dropdown {
|
|
359
|
+
transform-origin: top;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
:host([data-placement="bottom-start"]) #dropdown {
|
|
363
|
+
transform-origin: top left;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
:host([data-placement="bottom-end"]) #dropdown {
|
|
367
|
+
transform-origin: top right;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
:host([data-placement="top-start"]) #dropdown {
|
|
371
|
+
transform-origin: bottom left;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
:host([data-placement="top-end"]) #dropdown {
|
|
375
|
+
transform-origin: bottom right;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/* Hide items when filtered out */
|
|
379
|
+
::slotted(sigvelo-combobox-item[hidden]) {
|
|
380
|
+
display: none !important;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
@keyframes show {
|
|
384
|
+
from {
|
|
385
|
+
scale: 0.9;
|
|
386
|
+
opacity: 0;
|
|
387
|
+
}
|
|
388
|
+
to {
|
|
389
|
+
scale: 1;
|
|
390
|
+
opacity: 1;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
`;
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region src/components/combobox/combobox.ts
|
|
396
|
+
/**
|
|
397
|
+
* <sigvelo-combobox>
|
|
398
|
+
*
|
|
399
|
+
* @summary Allows users to select from a list of options with type-ahead search.
|
|
400
|
+
* @tag sigvelo-combobox
|
|
401
|
+
* @documentation https://design-system.sigvelo.com/docs/components/combobox
|
|
402
|
+
* @status stable
|
|
403
|
+
* @since 1.0
|
|
404
|
+
*
|
|
405
|
+
* @dependency sigvelo-icon
|
|
406
|
+
* @dependency sigvelo-combobox-item
|
|
407
|
+
*
|
|
408
|
+
* @slot - One or more `<sigvelo-combobox-item>` elements to show as options.
|
|
409
|
+
* @slot label - The combobox's label. For plain-text labels, use the `label` attribute instead.
|
|
410
|
+
* @slot description - The combobox's description. For plain-text descriptions, use the `description` attribute instead.
|
|
411
|
+
* @slot start - An icon or similar element to place before the input. Works great with `<sigvelo-icon>`.
|
|
412
|
+
* @slot end - An icon or similar element to place after the input. Works great with `<sigvelo-icon>`.
|
|
413
|
+
*
|
|
414
|
+
* @event sigvelo-blur - Emitted when the combobox loses focus.
|
|
415
|
+
* @event sigvelo-change - Emitted when the user commits changes to the combobox's value.
|
|
416
|
+
* @event sigvelo-focus - Emitted when the combobox receives focus.
|
|
417
|
+
* @event sigvelo-input - Emitted when the combobox receives input.
|
|
418
|
+
* @event sigvelo-before-open - Emitted when the dropdown is instructed to open but before it is shown.
|
|
419
|
+
* @event sigvelo-open - Emitted when the dropdown opens.
|
|
420
|
+
* @event sigvelo-before-close - Emitted when the dropdown is instructed to close but before it is hidden.
|
|
421
|
+
* @event sigvelo-close - Emitted when the dropdown closes.
|
|
422
|
+
*
|
|
423
|
+
* @csspart label - The element that contains the combobox's label.
|
|
424
|
+
* @csspart description - The element that contains the combobox's description.
|
|
425
|
+
* @csspart visual-box - The element that wraps the internal text box.
|
|
426
|
+
* @csspart input-area - The wrapper surrounding tags and the internal text box.
|
|
427
|
+
* @csspart tag - Individual tag elements.
|
|
428
|
+
* @csspart tag-remove - The remove button for tags.
|
|
429
|
+
* @csspart text-box - The internal text box, an `<input>` element.
|
|
430
|
+
* @csspart chevron - The chevron icon, a `<sigvelo-icon>` element.
|
|
431
|
+
* @csspart chevron__svg - The chevron icon's `<svg>` part.
|
|
432
|
+
* @csspart clear-button - The clear button.
|
|
433
|
+
* @csspart dropdown - The dropdown container.
|
|
434
|
+
*
|
|
435
|
+
* @cssstate open - Applied when the dropdown is open.
|
|
436
|
+
* @cssstate disabled - Applied when the combobox is disabled.
|
|
437
|
+
* @cssstate focused - Applied when the combobox has focus.
|
|
438
|
+
* @cssstate blank - Applied when the combobox has no value.
|
|
439
|
+
* @cssstate user-valid - Applied when valid after user interaction.
|
|
440
|
+
* @cssstate user-invalid - Applied when invalid after user interaction.
|
|
441
|
+
*
|
|
442
|
+
* @cssproperty [--text-box-min-width=12ch] - The minimum width of the input field when shown next to tags. Only
|
|
443
|
+
* available in `multiple` mode.
|
|
444
|
+
* @cssproperty [--show-duration=50ms] - The duration of the show/hide animation for the dropdown.
|
|
445
|
+
*
|
|
446
|
+
* @example Default
|
|
447
|
+
* Comboboxes implement the ARIA APG combobox pattern for roles and keyboard navigation, with enhanced screen reader announcements via ARIA live regions for improved context while navigating options.
|
|
448
|
+
*
|
|
449
|
+
* ```html
|
|
450
|
+
* <sigvelo-combobox
|
|
451
|
+
* label="Select a cat breed"
|
|
452
|
+
* description="Type to search or select from the list"
|
|
453
|
+
* placeholder="Search breeds"
|
|
454
|
+
* with-clear
|
|
455
|
+
* >
|
|
456
|
+
* <sigvelo-combobox-item value="persian">Persian</sigvelo-combobox-item>
|
|
457
|
+
* <sigvelo-combobox-item value="siamese">Siamese</sigvelo-combobox-item>
|
|
458
|
+
* <sigvelo-combobox-item value="tabby">Tabby</sigvelo-combobox-item>
|
|
459
|
+
* <sigvelo-combobox-item value="ragdoll">Ragdoll</sigvelo-combobox-item>
|
|
460
|
+
* <sigvelo-combobox-item value="bengal">Bengal</sigvelo-combobox-item>
|
|
461
|
+
* <sigvelo-combobox-item value="sphynx">Sphynx</sigvelo-combobox-item>
|
|
462
|
+
* <sigvelo-combobox-item value="calico">Calico</sigvelo-combobox-item>
|
|
463
|
+
* <sigvelo-combobox-item value="russian">Russian Blue</sigvelo-combobox-item>
|
|
464
|
+
* </sigvelo-combobox>
|
|
465
|
+
* ```
|
|
466
|
+
*
|
|
467
|
+
* @example Labels and descriptions
|
|
468
|
+
* You can use the `label` and `description` attributes to provide plain text labels and descriptions for the combobox. If you want to provide HTML, use the `label` and `description` slots instead.
|
|
469
|
+
*
|
|
470
|
+
* ```html
|
|
471
|
+
* <sigvelo-combobox placeholder="Type to search">
|
|
472
|
+
* <span slot="label">Choose your <strong>purrfect</strong> companion</span>
|
|
473
|
+
* <span slot="description">
|
|
474
|
+
* Browse our available cats or <a href="https://example.com/" target="_blank">schedule a visit</a>.
|
|
475
|
+
* </span>
|
|
476
|
+
* <sigvelo-combobox-item value="luna">Luna (Tabby, 2 years)</sigvelo-combobox-item>
|
|
477
|
+
* <sigvelo-combobox-item value="milo">Milo (Orange, 1 year)</sigvelo-combobox-item>
|
|
478
|
+
* <sigvelo-combobox-item value="bella">Bella (Calico, 3 years)</sigvelo-combobox-item>
|
|
479
|
+
* </sigvelo-combobox>
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* @example Providing options
|
|
483
|
+
* Create combobox options by adding `<sigvelo-combobox-item>` elements inside the combobox. Each item should have a `value` attribute that will be submitted with the form. If no value is provided, the text content is used.
|
|
484
|
+
*
|
|
485
|
+
* ```html
|
|
486
|
+
* <sigvelo-combobox label="Cat personalities" placeholder="Search personalities">
|
|
487
|
+
* <sigvelo-combobox-item value="playful">Playful and Energetic</sigvelo-combobox-item>
|
|
488
|
+
* <sigvelo-combobox-item value="cuddly">Cuddly Lap Cat</sigvelo-combobox-item>
|
|
489
|
+
* <sigvelo-combobox-item value="independent">Independent Spirit</sigvelo-combobox-item>
|
|
490
|
+
* <sigvelo-combobox-item value="social">Social Butterfly</sigvelo-combobox-item>
|
|
491
|
+
* <sigvelo-combobox-item value="curious">Curious Explorer</sigvelo-combobox-item>
|
|
492
|
+
* </sigvelo-combobox>
|
|
493
|
+
* ```
|
|
494
|
+
*
|
|
495
|
+
* Combobox items can have structured content with icons and details.
|
|
496
|
+
*
|
|
497
|
+
* ```html
|
|
498
|
+
* <sigvelo-combobox label="Adoption status" placeholder="Filter by status" id="combobox__structured">
|
|
499
|
+
* <sigvelo-combobox-item value="available">
|
|
500
|
+
* <sigvelo-icon slot="icon" name="circle-check" color="success"></sigvelo-icon>
|
|
501
|
+
* <span>Available Now</span>
|
|
502
|
+
* <span slot="details">Ready for adoption</span>
|
|
503
|
+
* </sigvelo-combobox-item>
|
|
504
|
+
* <sigvelo-combobox-item value="pending">
|
|
505
|
+
* <sigvelo-icon slot="icon" name="clock" color="informative"></sigvelo-icon>
|
|
506
|
+
* <span>Adoption Pending</span>
|
|
507
|
+
* <span slot="details">Application in review</span>
|
|
508
|
+
* </sigvelo-combobox-item>
|
|
509
|
+
* <sigvelo-combobox-item value="medical">
|
|
510
|
+
* <sigvelo-icon slot="icon" name="heart" color="critical"></sigvelo-icon>
|
|
511
|
+
* <span>Medical Hold</span>
|
|
512
|
+
* <span slot="details">Recovering from treatment</span>
|
|
513
|
+
* </sigvelo-combobox-item>
|
|
514
|
+
* <sigvelo-combobox-item value="foster">
|
|
515
|
+
* <sigvelo-icon slot="icon" name="home" color="primary"></sigvelo-icon>
|
|
516
|
+
* <span>Foster Only</span>
|
|
517
|
+
* <span slot="details">Temporary care needed</span>
|
|
518
|
+
* </sigvelo-combobox-item>
|
|
519
|
+
* </sigvelo-combobox>
|
|
520
|
+
*
|
|
521
|
+
* <style>
|
|
522
|
+
* #combobox__structured {
|
|
523
|
+
* sigvelo-combobox-item {
|
|
524
|
+
* padding-block: 0.75rem;
|
|
525
|
+
* }
|
|
526
|
+
* }
|
|
527
|
+
* </style>
|
|
528
|
+
* ```
|
|
529
|
+
*
|
|
530
|
+
* **Warning:** Avoid placing interactive elements such as buttons and links inside the combobox item, as this will hinder accessibility and can lead to unexpected behaviors.
|
|
531
|
+
*
|
|
532
|
+
* @example Providing an initial value
|
|
533
|
+
* Add the `selected` attribute to the combobox item you want to select initially. When using `multiple`, you can apply `selected` to more than one option.
|
|
534
|
+
*
|
|
535
|
+
* ```html
|
|
536
|
+
* <sigvelo-combobox label="Preferred feeding time" placeholder="Select a time">
|
|
537
|
+
* <sigvelo-combobox-item value="morning">Morning (6-9 AM)</sigvelo-combobox-item>
|
|
538
|
+
* <sigvelo-combobox-item value="noon" selected>Noon (11 AM-1 PM)</sigvelo-combobox-item>
|
|
539
|
+
* <sigvelo-combobox-item value="evening">Evening (5-7 PM)</sigvelo-combobox-item>
|
|
540
|
+
* <sigvelo-combobox-item value="night">Night (8-10 PM)</sigvelo-combobox-item>
|
|
541
|
+
* </sigvelo-combobox>
|
|
542
|
+
* ```
|
|
543
|
+
*
|
|
544
|
+
* @example Getting and setting the value
|
|
545
|
+
* The combobox's value can be accessed and modified through JavaScript. For single selection, use the `value` property. For multiple selection, `value` will be an array.
|
|
546
|
+
*
|
|
547
|
+
* ```js
|
|
548
|
+
* // Single selection
|
|
549
|
+
* const combobox = document.querySelector('sigvelo-combobox');
|
|
550
|
+
* console.log(combobox.value); // "persian"
|
|
551
|
+
* combobox.value = 'siamese';
|
|
552
|
+
*
|
|
553
|
+
* // Multiple selection
|
|
554
|
+
* const multiCombobox = document.querySelector('sigvelo-combobox[multiple]');
|
|
555
|
+
* console.log(multiCombobox.value); // ["persian", "siamese"]
|
|
556
|
+
* multiCombobox.value = ['bengal', 'ragdoll'];
|
|
557
|
+
* ```
|
|
558
|
+
*
|
|
559
|
+
* @example Adding a clear button
|
|
560
|
+
* Add the `with-clear` attribute to show a clear button when the combobox has a value. This allows users to quickly clear their selection.
|
|
561
|
+
*
|
|
562
|
+
* ```html
|
|
563
|
+
* <sigvelo-combobox
|
|
564
|
+
* label="With clear button"
|
|
565
|
+
* placeholder="Select and then clear"
|
|
566
|
+
* with-clear
|
|
567
|
+
* >
|
|
568
|
+
* <sigvelo-combobox-item value="yes" selected>Yes, I want treats!</sigvelo-combobox-item>
|
|
569
|
+
* <sigvelo-combobox-item value="no">No treats needed</sigvelo-combobox-item>
|
|
570
|
+
* <sigvelo-combobox-item value="maybe">Maybe later</sigvelo-combobox-item>
|
|
571
|
+
* </sigvelo-combobox>
|
|
572
|
+
* ```
|
|
573
|
+
*
|
|
574
|
+
* @example Multiple selection
|
|
575
|
+
* Use the `multiple` attribute to enable multi-selection mode. Selected items appear as tags in the input area. Users can remove tags by clicking the × button or pressing Backspace.
|
|
576
|
+
*
|
|
577
|
+
* ```html
|
|
578
|
+
* <sigvelo-combobox
|
|
579
|
+
* label="Cat behaviors"
|
|
580
|
+
* description="Select all behaviors your cat exhibits"
|
|
581
|
+
* placeholder="Search behaviors"
|
|
582
|
+
* multiple
|
|
583
|
+
* with-clear
|
|
584
|
+
* >
|
|
585
|
+
* <sigvelo-combobox-item value="purring" selected>Purring</sigvelo-combobox-item>
|
|
586
|
+
* <sigvelo-combobox-item value="kneading">Kneading (Making Biscuits)</sigvelo-combobox-item>
|
|
587
|
+
* <sigvelo-combobox-item value="chirping" selected>Chirping at Birds</sigvelo-combobox-item>
|
|
588
|
+
* <sigvelo-combobox-item value="head-bunting">Head Bunting</sigvelo-combobox-item>
|
|
589
|
+
* <sigvelo-combobox-item value="slow-blinking">Slow Blinking</sigvelo-combobox-item>
|
|
590
|
+
* <sigvelo-combobox-item value="zoomies">Midnight Zoomies</sigvelo-combobox-item>
|
|
591
|
+
* <sigvelo-combobox-item value="bringing-gifts">Bringing "Gifts"</sigvelo-combobox-item>
|
|
592
|
+
* <sigvelo-combobox-item value="chattering">Teeth Chattering</sigvelo-combobox-item>
|
|
593
|
+
* </sigvelo-combobox>
|
|
594
|
+
* ```
|
|
595
|
+
*
|
|
596
|
+
* **Note:** In multiple mode, the dropdown stays open after selecting an item, allowing users to quickly select multiple options. Press Escape or click outside to close the dropdown.
|
|
597
|
+
*
|
|
598
|
+
* @example Start and end content
|
|
599
|
+
* Use the `start` and `end` slots to add presentational icons or text. Avoid interactive elements such as buttons, links, etc. Works well with `<sigvelo-icon>` and `<svg>` elements.
|
|
600
|
+
*
|
|
601
|
+
* ```html
|
|
602
|
+
* <sigvelo-combobox name="breed" label="Cat breed" with-clear>
|
|
603
|
+
* <sigvelo-icon slot="start" name="cat"></sigvelo-icon>
|
|
604
|
+
* <sigvelo-combobox-item value="persian">Persian</sigvelo-combobox-item>
|
|
605
|
+
* <sigvelo-combobox-item value="siamese">Siamese</sigvelo-combobox-item>
|
|
606
|
+
* <sigvelo-combobox-item value="tabby">Tabby</sigvelo-combobox-item>
|
|
607
|
+
* <sigvelo-combobox-item value="ragdoll">Ragdoll</sigvelo-combobox-item>
|
|
608
|
+
* </sigvelo-combobox>
|
|
609
|
+
*
|
|
610
|
+
* <br>
|
|
611
|
+
*
|
|
612
|
+
* <sigvelo-combobox name="toy" label="Cat toy" placeholder="Choose a toy" with-clear>
|
|
613
|
+
* <sigvelo-icon slot="end" name="gift"></sigvelo-icon>
|
|
614
|
+
* <sigvelo-combobox-item value="feather-wand">Feather Wand</sigvelo-combobox-item>
|
|
615
|
+
* <sigvelo-combobox-item value="laser-pointer">Laser Pointer</sigvelo-combobox-item>
|
|
616
|
+
* <sigvelo-combobox-item value="catnip-mouse">Catnip Mouse</sigvelo-combobox-item>
|
|
617
|
+
* <sigvelo-combobox-item value="puzzle-feeder">Puzzle Feeder</sigvelo-combobox-item>
|
|
618
|
+
* </sigvelo-combobox>
|
|
619
|
+
*
|
|
620
|
+
* <br>
|
|
621
|
+
*
|
|
622
|
+
* <sigvelo-combobox name="vet-visit" label="Visit type" multiple with-clear>
|
|
623
|
+
* <sigvelo-icon slot="start" name="cat"></sigvelo-icon>
|
|
624
|
+
* <sigvelo-icon slot="end" name="clipboard-heart"></sigvelo-icon>
|
|
625
|
+
* <sigvelo-combobox-item value="checkup">Annual Checkup</sigvelo-combobox-item>
|
|
626
|
+
* <sigvelo-combobox-item value="vaccination">Vaccination</sigvelo-combobox-item>
|
|
627
|
+
* <sigvelo-combobox-item value="dental">Dental Cleaning</sigvelo-combobox-item>
|
|
628
|
+
* <sigvelo-combobox-item value="grooming">Grooming</sigvelo-combobox-item>
|
|
629
|
+
* </sigvelo-combobox>
|
|
630
|
+
* ```
|
|
631
|
+
*
|
|
632
|
+
* @example Filled and unstyled comboboxes
|
|
633
|
+
* Use the `variant` attribute to change the visual style of the combobox. Options are `normal` (default), `filled`, and `unstyled`.
|
|
634
|
+
*
|
|
635
|
+
* ```html
|
|
636
|
+
* <sigvelo-combobox
|
|
637
|
+
* label="Normal appearance"
|
|
638
|
+
* variant="normal"
|
|
639
|
+
* placeholder="Select one"
|
|
640
|
+
* >
|
|
641
|
+
* <sigvelo-combobox-item value="1">Fluffy</sigvelo-combobox-item>
|
|
642
|
+
* <sigvelo-combobox-item value="2">Sleek</sigvelo-combobox-item>
|
|
643
|
+
* <sigvelo-combobox-item value="3">Short-haired</sigvelo-combobox-item>
|
|
644
|
+
* </sigvelo-combobox>
|
|
645
|
+
*
|
|
646
|
+
* <br>
|
|
647
|
+
*
|
|
648
|
+
* <sigvelo-combobox
|
|
649
|
+
* label="Filled appearance"
|
|
650
|
+
* variant="filled"
|
|
651
|
+
* placeholder="Select one"
|
|
652
|
+
* >
|
|
653
|
+
* <sigvelo-combobox-item value="1">Fluffy</sigvelo-combobox-item>
|
|
654
|
+
* <sigvelo-combobox-item value="2">Sleek</sigvelo-combobox-item>
|
|
655
|
+
* <sigvelo-combobox-item value="3">Short-haired</sigvelo-combobox-item>
|
|
656
|
+
* </sigvelo-combobox>
|
|
657
|
+
*
|
|
658
|
+
* <br>
|
|
659
|
+
*
|
|
660
|
+
* <sigvelo-combobox
|
|
661
|
+
* label="Unstyled appearance"
|
|
662
|
+
* variant="unstyled"
|
|
663
|
+
* placeholder="Select one"
|
|
664
|
+
* >
|
|
665
|
+
* <sigvelo-combobox-item value="1">Fluffy</sigvelo-combobox-item>
|
|
666
|
+
* <sigvelo-combobox-item value="2">Sleek</sigvelo-combobox-item>
|
|
667
|
+
* <sigvelo-combobox-item value="3">Short-haired</sigvelo-combobox-item>
|
|
668
|
+
* </sigvelo-combobox>
|
|
669
|
+
* ```
|
|
670
|
+
*
|
|
671
|
+
* @example Pill-shaped comboboxes
|
|
672
|
+
* Add the `pill` attribute to give the combobox rounded edges.
|
|
673
|
+
*
|
|
674
|
+
* ```html
|
|
675
|
+
* <sigvelo-combobox
|
|
676
|
+
* label="Cat's favorite treat"
|
|
677
|
+
* placeholder="Choose a treat"
|
|
678
|
+
* pill
|
|
679
|
+
* with-clear
|
|
680
|
+
* >
|
|
681
|
+
* <sigvelo-combobox-item value="salmon">Salmon Bites</sigvelo-combobox-item>
|
|
682
|
+
* <sigvelo-combobox-item value="chicken">Chicken Strips</sigvelo-combobox-item>
|
|
683
|
+
* <sigvelo-combobox-item value="tuna">Tuna Flakes</sigvelo-combobox-item>
|
|
684
|
+
* <sigvelo-combobox-item value="catnip">Catnip Cookies</sigvelo-combobox-item>
|
|
685
|
+
* <sigvelo-combobox-item value="cheese">Cheese Cubes</sigvelo-combobox-item>
|
|
686
|
+
* </sigvelo-combobox>
|
|
687
|
+
* ```
|
|
688
|
+
*
|
|
689
|
+
* When using `multiple`, tags become pill-shaped and the combobox will curve to wrap around them.
|
|
690
|
+
*
|
|
691
|
+
* ```html
|
|
692
|
+
* <sigvelo-combobox
|
|
693
|
+
* label="Cat's daily activities"
|
|
694
|
+
* description="Select all that apply"
|
|
695
|
+
* placeholder="What does your cat enjoy?"
|
|
696
|
+
* pill
|
|
697
|
+
* multiple
|
|
698
|
+
* with-clear
|
|
699
|
+
* >
|
|
700
|
+
* <sigvelo-combobox-item value="window-watching" selected>Bird Watching</sigvelo-combobox-item>
|
|
701
|
+
* <sigvelo-combobox-item value="sunbathing" selected>Sunbathing</sigvelo-combobox-item>
|
|
702
|
+
* <sigvelo-combobox-item value="toy-hunting" selected>Toy Hunting</sigvelo-combobox-item>
|
|
703
|
+
* <sigvelo-combobox-item value="box-sitting" selected>Box Sitting</sigvelo-combobox-item>
|
|
704
|
+
* <sigvelo-combobox-item value="treat-begging" selected>Treat Begging</sigvelo-combobox-item>
|
|
705
|
+
* <sigvelo-combobox-item value="midnight-racing" selected>Midnight Racing</sigvelo-combobox-item>
|
|
706
|
+
* <sigvelo-combobox-item value="lap-napping" selected>Lap Napping</sigvelo-combobox-item>
|
|
707
|
+
* </sigvelo-combobox>
|
|
708
|
+
* ```
|
|
709
|
+
*
|
|
710
|
+
* @example Changing the size
|
|
711
|
+
* Use the `size` attribute to change the combobox's size. Available sizes are `xs`, `sm`, `md` (default), `lg`, and `xl`.
|
|
712
|
+
*
|
|
713
|
+
* ```html
|
|
714
|
+
* <sigvelo-select label="Select a size" value="xs" style="max-width: 18rem; margin-block-end: 2rem;">
|
|
715
|
+
* <option value="xs">Extra small</option>
|
|
716
|
+
* <option value="sm">Small</option>
|
|
717
|
+
* <option value="md">Medium</option>
|
|
718
|
+
* <option value="lg">Large</option>
|
|
719
|
+
* <option value="xl">Extra large</option>
|
|
720
|
+
* </sigvelo-select>
|
|
721
|
+
*
|
|
722
|
+
* <sigvelo-combobox
|
|
723
|
+
* size="xs"
|
|
724
|
+
* label="Cat coat pattern"
|
|
725
|
+
* description="Size changes dynamically based on selection above"
|
|
726
|
+
* placeholder="Search patterns"
|
|
727
|
+
* id="combobox__size"
|
|
728
|
+
* with-clear
|
|
729
|
+
* >
|
|
730
|
+
* <sigvelo-combobox-item value="solid">Solid Color</sigvelo-combobox-item>
|
|
731
|
+
* <sigvelo-combobox-item value="tabby">Tabby Stripes</sigvelo-combobox-item>
|
|
732
|
+
* <sigvelo-combobox-item value="calico">Calico</sigvelo-combobox-item>
|
|
733
|
+
* <sigvelo-combobox-item value="tortoiseshell">Tortoiseshell</sigvelo-combobox-item>
|
|
734
|
+
* <sigvelo-combobox-item value="tuxedo">Tuxedo</sigvelo-combobox-item>
|
|
735
|
+
* <sigvelo-combobox-item value="pointed">Pointed (Siamese)</sigvelo-combobox-item>
|
|
736
|
+
* </sigvelo-combobox>
|
|
737
|
+
*
|
|
738
|
+
* <script>
|
|
739
|
+
* const combobox = document.getElementById('combobox__size');
|
|
740
|
+
* const select = combobox.previousElementSibling;
|
|
741
|
+
*
|
|
742
|
+
* select.addEventListener('sigvelo-change', () => {
|
|
743
|
+
* combobox.size = select.value;
|
|
744
|
+
* });
|
|
745
|
+
* <\/script>
|
|
746
|
+
* ```
|
|
747
|
+
*
|
|
748
|
+
* @example Disabling the combobox
|
|
749
|
+
* Add the `disabled` attribute to disable the entire combobox.
|
|
750
|
+
*
|
|
751
|
+
* ```html
|
|
752
|
+
* <sigvelo-combobox
|
|
753
|
+
* label="Grooming services"
|
|
754
|
+
* description="Currently unavailable"
|
|
755
|
+
* placeholder="Service selection disabled"
|
|
756
|
+
* disabled
|
|
757
|
+
* >
|
|
758
|
+
* <sigvelo-combobox-item value="bath">Bath & Blow-dry</sigvelo-combobox-item>
|
|
759
|
+
* <sigvelo-combobox-item value="trim" selected>Nail Trim</sigvelo-combobox-item>
|
|
760
|
+
* <sigvelo-combobox-item value="full">Full Grooming</sigvelo-combobox-item>
|
|
761
|
+
* </sigvelo-combobox>
|
|
762
|
+
* ```
|
|
763
|
+
*
|
|
764
|
+
* @example Disabling items
|
|
765
|
+
* Add the `disabled` attribute to individual combobox items to make them non-selectable. Disabled items will still appear in search results but cannot be selected.
|
|
766
|
+
*
|
|
767
|
+
* ```html
|
|
768
|
+
* <sigvelo-combobox label="Veterinary services" placeholder="Select service">
|
|
769
|
+
* <sigvelo-combobox-item value="checkup">Annual Checkup</sigvelo-combobox-item>
|
|
770
|
+
* <sigvelo-combobox-item value="vaccination">Vaccination</sigvelo-combobox-item>
|
|
771
|
+
* <sigvelo-combobox-item value="spay-neuter" disabled>Spay/Neuter (Fully booked)</sigvelo-combobox-item>
|
|
772
|
+
* <sigvelo-combobox-item value="dental">Dental Cleaning</sigvelo-combobox-item>
|
|
773
|
+
* <sigvelo-combobox-item value="emergency" disabled>Emergency Care (Call first)</sigvelo-combobox-item>
|
|
774
|
+
* </sigvelo-combobox>
|
|
775
|
+
* ```
|
|
776
|
+
*
|
|
777
|
+
* @example Showing labels on the side
|
|
778
|
+
* With the `sigvelo-side-label` utility, you can show labels on the side instead of on top of the combobox. You can control the width of the label by setting the `--label-width` custom property.
|
|
779
|
+
*
|
|
780
|
+
* ```html
|
|
781
|
+
* <sigvelo-combobox
|
|
782
|
+
* class="sigvelo-side-label"
|
|
783
|
+
* style="--label-width: 12ch;"
|
|
784
|
+
* name="age"
|
|
785
|
+
* label="Cat's age"
|
|
786
|
+
* description="How old is your cat?"
|
|
787
|
+
* placeholder="Select age range"
|
|
788
|
+
* >
|
|
789
|
+
* <sigvelo-combobox-item value="kitten">Kitten (0-1 year)</sigvelo-combobox-item>
|
|
790
|
+
* <sigvelo-combobox-item value="young">Young (1-3 years)</sigvelo-combobox-item>
|
|
791
|
+
* <sigvelo-combobox-item value="adult">Adult (3-7 years)</sigvelo-combobox-item>
|
|
792
|
+
* <sigvelo-combobox-item value="senior">Senior (7+ years)</sigvelo-combobox-item>
|
|
793
|
+
* </sigvelo-combobox>
|
|
794
|
+
* <br>
|
|
795
|
+
* <sigvelo-combobox
|
|
796
|
+
* class="sigvelo-side-label"
|
|
797
|
+
* style="--label-width: 12ch;"
|
|
798
|
+
* name="activity"
|
|
799
|
+
* label="Activity level"
|
|
800
|
+
* description="How active is your cat?"
|
|
801
|
+
* placeholder="Select activity"
|
|
802
|
+
* >
|
|
803
|
+
* <sigvelo-combobox-item value="low">Couch Potato</sigvelo-combobox-item>
|
|
804
|
+
* <sigvelo-combobox-item value="moderate">Moderately Active</sigvelo-combobox-item>
|
|
805
|
+
* <sigvelo-combobox-item value="high">Very Energetic</sigvelo-combobox-item>
|
|
806
|
+
* </sigvelo-combobox>
|
|
807
|
+
* ```
|
|
808
|
+
*
|
|
809
|
+
* @example Validation
|
|
810
|
+
* The `required` attribute can be used to enable validation using the Constraint Validation API.
|
|
811
|
+
*
|
|
812
|
+
* ```html
|
|
813
|
+
* <form action="about:blank" method="get" target="_blank">
|
|
814
|
+
* <sigvelo-combobox
|
|
815
|
+
* name="emergency-contact"
|
|
816
|
+
* label="Emergency vet contact"
|
|
817
|
+
* placeholder="Select a veterinarian"
|
|
818
|
+
* required
|
|
819
|
+
* >
|
|
820
|
+
* <sigvelo-combobox-item value="dr-smith">Dr. Smith - City Animal Hospital</sigvelo-combobox-item>
|
|
821
|
+
* <sigvelo-combobox-item value="dr-jones">Dr. Jones - Pet Emergency Center</sigvelo-combobox-item>
|
|
822
|
+
* <sigvelo-combobox-item value="dr-brown">Dr. Brown - 24/7 Pet Care</sigvelo-combobox-item>
|
|
823
|
+
* </sigvelo-combobox>
|
|
824
|
+
* <br>
|
|
825
|
+
* <sigvelo-button type="submit" color="primary">Submit</sigvelo-button>
|
|
826
|
+
* <sigvelo-button type="reset">Reset</sigvelo-button>
|
|
827
|
+
* </form>
|
|
828
|
+
* ```
|
|
829
|
+
*
|
|
830
|
+
* @example Using custom validation
|
|
831
|
+
* Use the `setCustomValidity()` method to make the combobox invalid and show a custom error message on submit. This will override all other validation parameters. To clear the error, call the method with an empty string.
|
|
832
|
+
*
|
|
833
|
+
* ```html
|
|
834
|
+
* <form action="about:blank" method="get" target="_blank" id="combobox__custom-validation">
|
|
835
|
+
* <sigvelo-combobox
|
|
836
|
+
* name="special-diet"
|
|
837
|
+
* label="Special dietary needs"
|
|
838
|
+
* description="This field demonstrates custom validation"
|
|
839
|
+
* placeholder="Select diet"
|
|
840
|
+
* >
|
|
841
|
+
* <sigvelo-combobox-item value="regular">Regular Diet</sigvelo-combobox-item>
|
|
842
|
+
* <sigvelo-combobox-item value="grain-free">Grain-Free</sigvelo-combobox-item>
|
|
843
|
+
* <sigvelo-combobox-item value="prescription">Prescription Diet</sigvelo-combobox-item>
|
|
844
|
+
* </sigvelo-combobox>
|
|
845
|
+
* <br>
|
|
846
|
+
* <sigvelo-button type="submit" color="primary">Submit</sigvelo-button>
|
|
847
|
+
* </form>
|
|
848
|
+
*
|
|
849
|
+
* <script type="module">
|
|
850
|
+
* import { allDefined } from '/dist/sigvelo.js';
|
|
851
|
+
*
|
|
852
|
+
* await allDefined();
|
|
853
|
+
*
|
|
854
|
+
* const form = document.getElementById('combobox__custom-validation');
|
|
855
|
+
* const combobox = form.querySelector('sigvelo-combobox');
|
|
856
|
+
*
|
|
857
|
+
* combobox.setCustomValidity('Please consult with your vet first!');
|
|
858
|
+
*
|
|
859
|
+
* // Clear validation after user selects an option
|
|
860
|
+
* combobox.addEventListener('sigvelo-change', () => {
|
|
861
|
+
* combobox.setCustomValidity('');
|
|
862
|
+
* });
|
|
863
|
+
* <\/script>
|
|
864
|
+
* ```
|
|
865
|
+
*
|
|
866
|
+
* @example Styling validation
|
|
867
|
+
* You can style valid and invalid comboboxes using the `:valid` and `:invalid` pseudo classes.
|
|
868
|
+
*
|
|
869
|
+
* ```html
|
|
870
|
+
* <form action="about:blank" method="get" target="_blank" class="combobox__validation-pseudo">
|
|
871
|
+
* <sigvelo-combobox
|
|
872
|
+
* name="chip-id"
|
|
873
|
+
* label="Microchip ID"
|
|
874
|
+
* description="Required for registration"
|
|
875
|
+
* placeholder="Enter or select chip ID"
|
|
876
|
+
* required
|
|
877
|
+
* >
|
|
878
|
+
* <sigvelo-combobox-item value="chip-12345">CHIP-12345</sigvelo-combobox-item>
|
|
879
|
+
* <sigvelo-combobox-item value="chip-67890">CHIP-67890</sigvelo-combobox-item>
|
|
880
|
+
* <sigvelo-combobox-item value="chip-24680">CHIP-24680</sigvelo-combobox-item>
|
|
881
|
+
* </sigvelo-combobox>
|
|
882
|
+
* <br>
|
|
883
|
+
* <sigvelo-button type="submit" color="primary">Submit</sigvelo-button>
|
|
884
|
+
* <sigvelo-button type="reset">Reset</sigvelo-button>
|
|
885
|
+
* </form>
|
|
886
|
+
*
|
|
887
|
+
* <style>
|
|
888
|
+
* .combobox__validation-pseudo {
|
|
889
|
+
* sigvelo-combobox:valid {
|
|
890
|
+
* outline: solid 2px var(--sigvelo-color-success-border);
|
|
891
|
+
* outline-offset: .5rem;
|
|
892
|
+
* }
|
|
893
|
+
*
|
|
894
|
+
* sigvelo-combobox:invalid {
|
|
895
|
+
* outline: solid 2px var(--sigvelo-color-danger-border);
|
|
896
|
+
* outline-offset: .5rem;
|
|
897
|
+
* }
|
|
898
|
+
* }
|
|
899
|
+
* </style>
|
|
900
|
+
* ```
|
|
901
|
+
*
|
|
902
|
+
* However, these selectors will match even before the user has had a chance to interact with 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.
|
|
903
|
+
*
|
|
904
|
+
* ```html
|
|
905
|
+
* <form action="about:blank" method="get" target="_blank" class="combobox__validation-custom">
|
|
906
|
+
* <sigvelo-combobox
|
|
907
|
+
* name="insurance"
|
|
908
|
+
* label="Pet insurance provider"
|
|
909
|
+
* description="Select your insurance company"
|
|
910
|
+
* placeholder="Search providers"
|
|
911
|
+
* required
|
|
912
|
+
* >
|
|
913
|
+
* <sigvelo-combobox-item value="pawguard-plus">PawGuard Plus</sigvelo-combobox-item>
|
|
914
|
+
* <sigvelo-combobox-item value="furry-shield">Furry Shield</sigvelo-combobox-item>
|
|
915
|
+
* <sigvelo-combobox-item value="petcare-prime">PetCare Prime</sigvelo-combobox-item>
|
|
916
|
+
* <sigvelo-combobox-item value="whiskers-wellness">Whiskers Wellness</sigvelo-combobox-item>
|
|
917
|
+
* </sigvelo-combobox>
|
|
918
|
+
* <br>
|
|
919
|
+
* <sigvelo-button type="submit" color="primary">Submit</sigvelo-button>
|
|
920
|
+
* <sigvelo-button type="reset">Reset</sigvelo-button>
|
|
921
|
+
* </form>
|
|
922
|
+
*
|
|
923
|
+
* <style>
|
|
924
|
+
* .combobox__validation-custom {
|
|
925
|
+
* sigvelo-combobox:state(user-valid) {
|
|
926
|
+
* outline: solid 2px var(--sigvelo-color-success-border);
|
|
927
|
+
* outline-offset: .5rem;
|
|
928
|
+
* }
|
|
929
|
+
*
|
|
930
|
+
* sigvelo-combobox:state(user-invalid) {
|
|
931
|
+
* outline: solid 2px var(--sigvelo-color-danger-border);
|
|
932
|
+
* outline-offset: .5rem;
|
|
933
|
+
* }
|
|
934
|
+
* }
|
|
935
|
+
* </style>
|
|
936
|
+
* ```
|
|
937
|
+
*/
|
|
938
|
+
var SigveloCombobox = class extends SigveloFormControlElement {
|
|
939
|
+
constructor(..._args) {
|
|
940
|
+
super(..._args);
|
|
941
|
+
this.optionIdCounter = 0;
|
|
942
|
+
this.localize = new Localize(this);
|
|
943
|
+
this.open = false;
|
|
944
|
+
this.inputValue = "";
|
|
945
|
+
this.activeItem = null;
|
|
946
|
+
this.selectedItems = [];
|
|
947
|
+
this.filteredItems = [];
|
|
948
|
+
this.inputWidth = "auto";
|
|
949
|
+
this.isInvalid = false;
|
|
950
|
+
this.hadUserInteraction = false;
|
|
951
|
+
this.wasSubmitted = false;
|
|
952
|
+
this.liveAnnouncement = "";
|
|
953
|
+
this.value = "";
|
|
954
|
+
this.disabled = false;
|
|
955
|
+
this.required = false;
|
|
956
|
+
this.multiple = false;
|
|
957
|
+
this.withClear = false;
|
|
958
|
+
this.variant = "normal";
|
|
959
|
+
this.size = "md";
|
|
960
|
+
this.pill = false;
|
|
961
|
+
this.placement = "bottom-start";
|
|
962
|
+
this.distance = 0;
|
|
963
|
+
this.offset = 0;
|
|
964
|
+
this.handleInput = () => {
|
|
965
|
+
this.inputValue = this.textBox.value;
|
|
966
|
+
this.filterItems(this.inputValue);
|
|
967
|
+
if (!this.open && this.inputValue && this.filteredItems.length > 0) this.open = true;
|
|
968
|
+
if (!this.multiple) {
|
|
969
|
+
const matchingItem = this.findMatchingItem(this.inputValue);
|
|
970
|
+
if (matchingItem && !matchingItem.disabled) {
|
|
971
|
+
this.selectedItems.forEach((i) => i.selected = false);
|
|
972
|
+
matchingItem.selected = true;
|
|
973
|
+
this.selectedItems = [matchingItem];
|
|
974
|
+
this.value = matchingItem.value || matchingItem.textContent || "";
|
|
975
|
+
this.updateFormValue();
|
|
976
|
+
} else if (this.selectedItems.length > 0) {
|
|
977
|
+
this.selectedItems[0].selected = false;
|
|
978
|
+
this.selectedItems = [];
|
|
979
|
+
this.value = "";
|
|
980
|
+
this.updateFormValue();
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
this.dispatchEvent(new SigveloInputEvent());
|
|
984
|
+
};
|
|
985
|
+
this.handleFocus = () => {
|
|
986
|
+
this.customStates.set("focused", true);
|
|
987
|
+
this.dispatchEvent(new SigveloFocusEvent());
|
|
988
|
+
if (!this.open && this.filteredItems.length > 0) this.open = true;
|
|
989
|
+
};
|
|
990
|
+
this.handleInputClick = (event) => {
|
|
991
|
+
event.stopPropagation();
|
|
992
|
+
if (this.customStates.has("focused") && this.filteredItems.length > 0 && !this.open) this.open = true;
|
|
993
|
+
};
|
|
994
|
+
this.handleBlur = (event) => {
|
|
995
|
+
this.customStates.set("focused", false);
|
|
996
|
+
const relatedTarget = event.relatedTarget;
|
|
997
|
+
if (!(relatedTarget && (this.contains(relatedTarget) || this.dropdown?.contains(relatedTarget)))) {
|
|
998
|
+
this.clearInvalidInput();
|
|
999
|
+
this.open = false;
|
|
1000
|
+
}
|
|
1001
|
+
this.dispatchEvent(new SigveloBlurEvent());
|
|
1002
|
+
};
|
|
1003
|
+
this.handleKeyDown = (event) => {
|
|
1004
|
+
if (this.disabled) return;
|
|
1005
|
+
if (event.key === "Backspace" && !this.inputValue && this.multiple && this.selectedItems.length > 0) {
|
|
1006
|
+
const lastItem = this.selectedItems[this.selectedItems.length - 1];
|
|
1007
|
+
this.deselectItem(lastItem);
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
if (!this.open && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
|
|
1011
|
+
event.preventDefault();
|
|
1012
|
+
this.open = true;
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
if (!this.open) return;
|
|
1016
|
+
switch (event.key) {
|
|
1017
|
+
case "ArrowDown":
|
|
1018
|
+
event.preventDefault();
|
|
1019
|
+
this.navigateItems(1);
|
|
1020
|
+
break;
|
|
1021
|
+
case "ArrowUp":
|
|
1022
|
+
event.preventDefault();
|
|
1023
|
+
this.navigateItems(-1);
|
|
1024
|
+
break;
|
|
1025
|
+
case "Enter":
|
|
1026
|
+
event.preventDefault();
|
|
1027
|
+
if (this.activeItem) this.selectItem(this.activeItem);
|
|
1028
|
+
break;
|
|
1029
|
+
case "Escape":
|
|
1030
|
+
event.preventDefault();
|
|
1031
|
+
this.open = false;
|
|
1032
|
+
break;
|
|
1033
|
+
case "Home":
|
|
1034
|
+
event.preventDefault();
|
|
1035
|
+
if (this.filteredItems.length > 0) this.setActiveItem(this.filteredItems[0], true);
|
|
1036
|
+
break;
|
|
1037
|
+
case "End":
|
|
1038
|
+
event.preventDefault();
|
|
1039
|
+
if (this.filteredItems.length > 0) this.setActiveItem(this.filteredItems[this.filteredItems.length - 1], true);
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
1043
|
+
this.handleDocumentClick = (event) => {
|
|
1044
|
+
const path = event.composedPath();
|
|
1045
|
+
const visualBox = this.shadowRoot?.querySelector("#visual-box");
|
|
1046
|
+
const dropdown = this.dropdown;
|
|
1047
|
+
if (!path.includes(visualBox) && !path.includes(dropdown)) this.open = false;
|
|
1048
|
+
};
|
|
1049
|
+
this.handleDocumentKeyDown = (event) => {
|
|
1050
|
+
if (event.key === "Escape") this.open = false;
|
|
1051
|
+
};
|
|
1052
|
+
this.handleVisualBoxClick = (event) => {
|
|
1053
|
+
if (this.disabled) return;
|
|
1054
|
+
const target = event.target;
|
|
1055
|
+
if (target.closest("#clear-button") || target.closest(".tag-remove")) return;
|
|
1056
|
+
event.stopPropagation();
|
|
1057
|
+
if (this.customStates.has("focused")) this.open = !this.open;
|
|
1058
|
+
this.textBox.focus();
|
|
1059
|
+
};
|
|
1060
|
+
this.handleClear = () => {
|
|
1061
|
+
this.value = this.multiple ? [] : "";
|
|
1062
|
+
this.selectedItems.forEach((item) => item.selected = false);
|
|
1063
|
+
this.selectedItems = [];
|
|
1064
|
+
this.inputValue = "";
|
|
1065
|
+
this.filterItems("");
|
|
1066
|
+
this.updateFormValue();
|
|
1067
|
+
this.hadUserInteraction = true;
|
|
1068
|
+
this.dispatchEvent(new SigveloInputEvent());
|
|
1069
|
+
this.dispatchEvent(new InputEvent("input", {
|
|
1070
|
+
bubbles: true,
|
|
1071
|
+
composed: true,
|
|
1072
|
+
cancelable: false
|
|
1073
|
+
}));
|
|
1074
|
+
this.dispatchEvent(new SigveloChangeEvent());
|
|
1075
|
+
this.textBox.focus();
|
|
1076
|
+
};
|
|
1077
|
+
this.handleSlotChange = () => {
|
|
1078
|
+
this.updateItems();
|
|
1079
|
+
};
|
|
1080
|
+
this.handleItemClick = (event) => {
|
|
1081
|
+
const item = event.target.closest("sigvelo-combobox-item");
|
|
1082
|
+
if (item && !item.disabled) this.selectItem(item);
|
|
1083
|
+
};
|
|
1084
|
+
this.handleItemPointerMove = (event) => {
|
|
1085
|
+
const hoveredItem = event.target.closest("sigvelo-combobox-item");
|
|
1086
|
+
if (!hoveredItem || this.disabled) return;
|
|
1087
|
+
if (hoveredItem !== this.activeItem) {
|
|
1088
|
+
if (this.activeItem) {
|
|
1089
|
+
this.activeItem.active = false;
|
|
1090
|
+
this.activeItem.removeAttribute("data-keyboard-nav");
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
this.handleHostInvalid = () => {
|
|
1095
|
+
this.wasSubmitted = true;
|
|
1096
|
+
};
|
|
1097
|
+
}
|
|
1098
|
+
static {
|
|
1099
|
+
this.formAssociated = true;
|
|
1100
|
+
}
|
|
1101
|
+
static {
|
|
1102
|
+
this.observeSlots = true;
|
|
1103
|
+
}
|
|
1104
|
+
static {
|
|
1105
|
+
this.styles = [
|
|
1106
|
+
hostStyles,
|
|
1107
|
+
formControlStyles,
|
|
1108
|
+
combobox_styles_default
|
|
1109
|
+
];
|
|
1110
|
+
}
|
|
1111
|
+
get focusableAnchor() {
|
|
1112
|
+
return this.textBox;
|
|
1113
|
+
}
|
|
1114
|
+
connectedCallback() {
|
|
1115
|
+
super.connectedCallback();
|
|
1116
|
+
this.addEventListener("invalid", this.handleHostInvalid);
|
|
1117
|
+
}
|
|
1118
|
+
disconnectedCallback() {
|
|
1119
|
+
super.disconnectedCallback();
|
|
1120
|
+
this.removeEventListener("invalid", this.handleHostInvalid);
|
|
1121
|
+
this.cleanup?.();
|
|
1122
|
+
this.clearAnnouncementTimers();
|
|
1123
|
+
}
|
|
1124
|
+
firstUpdated() {
|
|
1125
|
+
this.updateItems();
|
|
1126
|
+
this.updateFormValue();
|
|
1127
|
+
this.updateInputWidth();
|
|
1128
|
+
}
|
|
1129
|
+
updated(changedProperties) {
|
|
1130
|
+
this.updateValidity();
|
|
1131
|
+
if (changedProperties.has("open")) {
|
|
1132
|
+
this.customStates.set("open", this.open);
|
|
1133
|
+
if (this.open) this.showDropdown();
|
|
1134
|
+
else this.hideDropdown();
|
|
1135
|
+
}
|
|
1136
|
+
if (changedProperties.has("value")) {
|
|
1137
|
+
this.syncSelectedItems();
|
|
1138
|
+
this.updateFormValue();
|
|
1139
|
+
this.customStates.set("blank", this.isBlank());
|
|
1140
|
+
}
|
|
1141
|
+
if (changedProperties.has("disabled")) this.customStates.set("disabled", this.disabled);
|
|
1142
|
+
if (this.hadUserInteraction || this.wasSubmitted) {
|
|
1143
|
+
this.customStates.set("user-invalid", this.isInvalid);
|
|
1144
|
+
this.customStates.set("user-valid", !this.isInvalid);
|
|
1145
|
+
} else {
|
|
1146
|
+
this.customStates.set("user-invalid", false);
|
|
1147
|
+
this.customStates.set("user-valid", false);
|
|
1148
|
+
}
|
|
1149
|
+
if (changedProperties.has("multiple")) {
|
|
1150
|
+
this.value = this.multiple ? [] : "";
|
|
1151
|
+
this.selectedItems = [];
|
|
1152
|
+
this.inputValue = "";
|
|
1153
|
+
}
|
|
1154
|
+
if (changedProperties.has("inputValue")) this.updateInputWidth();
|
|
1155
|
+
}
|
|
1156
|
+
formDisabledCallback(disabled) {
|
|
1157
|
+
this.disabled = disabled;
|
|
1158
|
+
}
|
|
1159
|
+
formResetCallback() {
|
|
1160
|
+
const initiallySelectedItems = this.getItems(true).filter((item) => item.hasAttribute("selected"));
|
|
1161
|
+
this.getItems(true).forEach((item) => {
|
|
1162
|
+
item.selected = initiallySelectedItems.includes(item);
|
|
1163
|
+
});
|
|
1164
|
+
if (this.multiple) {
|
|
1165
|
+
this.value = initiallySelectedItems.map((item) => item.value || item.textContent || "");
|
|
1166
|
+
this.selectedItems = initiallySelectedItems;
|
|
1167
|
+
} else {
|
|
1168
|
+
this.value = initiallySelectedItems.length > 0 ? initiallySelectedItems[0].value || initiallySelectedItems[0].textContent || "" : "";
|
|
1169
|
+
this.selectedItems = initiallySelectedItems.length > 0 ? [initiallySelectedItems[0]] : [];
|
|
1170
|
+
this.inputValue = initiallySelectedItems.length > 0 ? initiallySelectedItems[0].getLabelText() : "";
|
|
1171
|
+
}
|
|
1172
|
+
this.hadUserInteraction = false;
|
|
1173
|
+
this.wasSubmitted = false;
|
|
1174
|
+
this.isInvalid = false;
|
|
1175
|
+
this.updateFormValue();
|
|
1176
|
+
}
|
|
1177
|
+
/** Gets all <sigvelo-combobox-item> elements that aren't disabled (by default). */
|
|
1178
|
+
getItems(includeDisabled = false) {
|
|
1179
|
+
const items = [...this.querySelectorAll("sigvelo-combobox-item")];
|
|
1180
|
+
return includeDisabled ? items : items.filter((item) => !item.disabled);
|
|
1181
|
+
}
|
|
1182
|
+
updateItems() {
|
|
1183
|
+
const items = this.getItems(true);
|
|
1184
|
+
items.forEach((item) => {
|
|
1185
|
+
if (!item.id) item.id = `sigvelo-combobox-option-${this.optionIdCounter++}`;
|
|
1186
|
+
item.combobox = this;
|
|
1187
|
+
});
|
|
1188
|
+
this.filteredItems = this.getItems();
|
|
1189
|
+
if (!this.value || Array.isArray(this.value) && this.value.length === 0) {
|
|
1190
|
+
const selectedItems = items.filter((item) => item.hasAttribute("selected"));
|
|
1191
|
+
if (selectedItems.length > 0) {
|
|
1192
|
+
if (this.multiple) {
|
|
1193
|
+
this.value = selectedItems.map((item) => item.value || item.textContent || "");
|
|
1194
|
+
this.selectedItems = selectedItems;
|
|
1195
|
+
} else {
|
|
1196
|
+
this.value = selectedItems[0].value || selectedItems[0].textContent || "";
|
|
1197
|
+
this.selectedItems = [selectedItems[0]];
|
|
1198
|
+
}
|
|
1199
|
+
selectedItems.forEach((item) => item.selected = true);
|
|
1200
|
+
}
|
|
1201
|
+
} else this.syncSelectedItems();
|
|
1202
|
+
}
|
|
1203
|
+
syncSelectedItems() {
|
|
1204
|
+
const items = this.getItems(true);
|
|
1205
|
+
const values = Array.isArray(this.value) ? this.value : [this.value].filter(Boolean);
|
|
1206
|
+
const existingSelectedMap = new Map(this.selectedItems.map((item) => [item.value || item.textContent || "", item]));
|
|
1207
|
+
const newSelectedItems = [];
|
|
1208
|
+
values.forEach((value) => {
|
|
1209
|
+
if (existingSelectedMap.has(value)) {
|
|
1210
|
+
const item = existingSelectedMap.get(value);
|
|
1211
|
+
if (items.includes(item)) newSelectedItems.push(item);
|
|
1212
|
+
} else {
|
|
1213
|
+
const item = items.find((i) => (i.value || i.textContent || "") === value);
|
|
1214
|
+
if (item) newSelectedItems.push(item);
|
|
1215
|
+
}
|
|
1216
|
+
});
|
|
1217
|
+
items.forEach((item) => {
|
|
1218
|
+
const itemValue = item.value || item.textContent || "";
|
|
1219
|
+
item.selected = values.includes(itemValue);
|
|
1220
|
+
});
|
|
1221
|
+
this.selectedItems = newSelectedItems;
|
|
1222
|
+
if (!this.multiple && this.selectedItems.length > 0) this.inputValue = this.selectedItems[0].getLabelText();
|
|
1223
|
+
}
|
|
1224
|
+
findMatchingItem(searchQuery) {
|
|
1225
|
+
return this.getItems(true).find((item) => item.getLabelText().toLowerCase() === searchQuery.trim().toLowerCase());
|
|
1226
|
+
}
|
|
1227
|
+
filterItems(searchQuery, preserveActiveItem = false) {
|
|
1228
|
+
const items = this.getItems();
|
|
1229
|
+
const currentActiveItem = preserveActiveItem ? this.activeItem : null;
|
|
1230
|
+
if (!searchQuery) {
|
|
1231
|
+
this.filteredItems = items;
|
|
1232
|
+
items.forEach((item) => item.hidden = false);
|
|
1233
|
+
if (this.filteredItems.length > 0 && this.customStates.has("focused")) {
|
|
1234
|
+
this.open = true;
|
|
1235
|
+
this.announceFilterResults(this.filteredItems.length);
|
|
1236
|
+
}
|
|
1237
|
+
} else {
|
|
1238
|
+
const lowerQuery = searchQuery.toLowerCase();
|
|
1239
|
+
this.filteredItems = [];
|
|
1240
|
+
items.forEach((item) => {
|
|
1241
|
+
const matches = item.getLabelText().toLowerCase().includes(lowerQuery);
|
|
1242
|
+
item.hidden = !matches;
|
|
1243
|
+
if (matches) this.filteredItems.push(item);
|
|
1244
|
+
});
|
|
1245
|
+
this.announceFilterResults(this.filteredItems.length);
|
|
1246
|
+
}
|
|
1247
|
+
if (this.filteredItems.length === 0 && this.open) this.open = false;
|
|
1248
|
+
else if (this.filteredItems.length > 0 && this.open) if (preserveActiveItem && currentActiveItem && this.filteredItems.includes(currentActiveItem)) this.setActiveItem(currentActiveItem);
|
|
1249
|
+
else this.setActiveItem(this.filteredItems[0]);
|
|
1250
|
+
}
|
|
1251
|
+
setActiveItem(item, isKeyboard = false) {
|
|
1252
|
+
if (this.activeItem) {
|
|
1253
|
+
this.activeItem.active = false;
|
|
1254
|
+
this.activeItem.removeAttribute("data-keyboard-nav");
|
|
1255
|
+
}
|
|
1256
|
+
this.activeItem = item;
|
|
1257
|
+
if (item) {
|
|
1258
|
+
item.active = true;
|
|
1259
|
+
if (isKeyboard) item.setAttribute("data-keyboard-nav", "");
|
|
1260
|
+
item.scrollIntoView({ block: "nearest" });
|
|
1261
|
+
this.announceOption(item);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
navigateItems(direction) {
|
|
1265
|
+
if (this.filteredItems.length === 0) return;
|
|
1266
|
+
if (!this.activeItem) {
|
|
1267
|
+
if (direction > 0) this.setActiveItem(this.filteredItems[0], true);
|
|
1268
|
+
else this.setActiveItem(this.filteredItems[this.filteredItems.length - 1], true);
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1271
|
+
let index = this.filteredItems.indexOf(this.activeItem);
|
|
1272
|
+
index += direction;
|
|
1273
|
+
if (index < 0) index = this.filteredItems.length - 1;
|
|
1274
|
+
else if (index >= this.filteredItems.length) index = 0;
|
|
1275
|
+
this.setActiveItem(this.filteredItems[index], true);
|
|
1276
|
+
}
|
|
1277
|
+
clearInvalidInput() {
|
|
1278
|
+
if (!this.inputValue.trim()) return;
|
|
1279
|
+
const matchingItem = this.findMatchingItem(this.inputValue);
|
|
1280
|
+
if (!matchingItem || matchingItem.disabled) {
|
|
1281
|
+
if (!this.multiple) this.inputValue = this.selectedItems.length > 0 ? this.selectedItems[0].getLabelText() : "";
|
|
1282
|
+
else this.inputValue = "";
|
|
1283
|
+
this.filterItems("");
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
selectItem(item) {
|
|
1288
|
+
if (item.disabled) return;
|
|
1289
|
+
if (this.multiple) {
|
|
1290
|
+
if (item.selected) this.deselectItem(item);
|
|
1291
|
+
else {
|
|
1292
|
+
item.selected = true;
|
|
1293
|
+
this.selectedItems.push(item);
|
|
1294
|
+
const values = this.selectedItems.map((i) => i.value || i.textContent || "");
|
|
1295
|
+
this.value = values;
|
|
1296
|
+
this.inputValue = "";
|
|
1297
|
+
this.setActiveItem(item);
|
|
1298
|
+
this.filterItems("", true);
|
|
1299
|
+
this.announceChange(this.localize.term("itemAdded", item.textContent || ""));
|
|
1300
|
+
}
|
|
1301
|
+
this.textBox.focus();
|
|
1302
|
+
} else {
|
|
1303
|
+
this.selectedItems.forEach((i) => i.selected = false);
|
|
1304
|
+
item.selected = true;
|
|
1305
|
+
this.selectedItems = [item];
|
|
1306
|
+
this.value = item.value || item.textContent || "";
|
|
1307
|
+
this.inputValue = item.getLabelText();
|
|
1308
|
+
this.open = false;
|
|
1309
|
+
this.announceChange(this.localize.term("itemSelected", item.textContent || ""));
|
|
1310
|
+
}
|
|
1311
|
+
this.hadUserInteraction = true;
|
|
1312
|
+
this.updateFormValue();
|
|
1313
|
+
this.dispatchEvent(new SigveloChangeEvent());
|
|
1314
|
+
this.dispatchEvent(new Event("change", {
|
|
1315
|
+
bubbles: true,
|
|
1316
|
+
composed: true
|
|
1317
|
+
}));
|
|
1318
|
+
}
|
|
1319
|
+
deselectItem(item) {
|
|
1320
|
+
item.selected = false;
|
|
1321
|
+
const index = this.selectedItems.indexOf(item);
|
|
1322
|
+
if (index > -1) this.selectedItems.splice(index, 1);
|
|
1323
|
+
if (this.multiple) {
|
|
1324
|
+
const values = this.selectedItems.map((i) => i.value || i.textContent || "");
|
|
1325
|
+
this.value = values;
|
|
1326
|
+
this.announceChange(this.localize.term("itemRemoved", item.textContent || ""));
|
|
1327
|
+
} else {
|
|
1328
|
+
this.value = "";
|
|
1329
|
+
this.inputValue = "";
|
|
1330
|
+
}
|
|
1331
|
+
this.updateFormValue();
|
|
1332
|
+
this.dispatchEvent(new SigveloChangeEvent());
|
|
1333
|
+
this.dispatchEvent(new Event("change", {
|
|
1334
|
+
bubbles: true,
|
|
1335
|
+
composed: true
|
|
1336
|
+
}));
|
|
1337
|
+
}
|
|
1338
|
+
removeTag(item, event) {
|
|
1339
|
+
event.stopPropagation();
|
|
1340
|
+
this.deselectItem(item);
|
|
1341
|
+
this.textBox.focus();
|
|
1342
|
+
this.filterItems(this.inputValue);
|
|
1343
|
+
}
|
|
1344
|
+
clearAnnouncementTimers() {
|
|
1345
|
+
if (this.liveRegionTimeoutId) {
|
|
1346
|
+
clearTimeout(this.liveRegionTimeoutId);
|
|
1347
|
+
this.liveRegionTimeoutId = void 0;
|
|
1348
|
+
}
|
|
1349
|
+
if (this.navigationDebounceId) {
|
|
1350
|
+
clearTimeout(this.navigationDebounceId);
|
|
1351
|
+
this.navigationDebounceId = void 0;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
announceChange(message) {
|
|
1355
|
+
requestAnimationFrame(() => {
|
|
1356
|
+
this.liveAnnouncement = "";
|
|
1357
|
+
requestAnimationFrame(() => {
|
|
1358
|
+
this.liveAnnouncement = message;
|
|
1359
|
+
});
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
announceOption(item) {
|
|
1363
|
+
this.clearAnnouncementTimers();
|
|
1364
|
+
const position = this.filteredItems.indexOf(item) + 1;
|
|
1365
|
+
const total = this.filteredItems.length;
|
|
1366
|
+
let announcement = `${item.textContent}`;
|
|
1367
|
+
if (total > 0) announcement += `, ${this.localize.term("numberOfTotal", position, total)}`;
|
|
1368
|
+
if (item.selected) announcement += `, ${this.localize.term("selected")}`;
|
|
1369
|
+
if (item.disabled) announcement += `, ${this.localize.term("disabled")}`;
|
|
1370
|
+
this.navigationDebounceId = setTimeout(() => {
|
|
1371
|
+
this.liveAnnouncement = "";
|
|
1372
|
+
requestAnimationFrame(() => {
|
|
1373
|
+
this.liveAnnouncement = announcement;
|
|
1374
|
+
});
|
|
1375
|
+
}, 75);
|
|
1376
|
+
}
|
|
1377
|
+
announceFilterResults(count) {
|
|
1378
|
+
if (this.liveRegionTimeoutId) clearTimeout(this.liveRegionTimeoutId);
|
|
1379
|
+
const announcement = count === 0 ? this.localize.term("noResultsFound") : this.localize.term("resultsAvailable", count);
|
|
1380
|
+
requestAnimationFrame(() => {
|
|
1381
|
+
this.liveAnnouncement = "";
|
|
1382
|
+
requestAnimationFrame(() => {
|
|
1383
|
+
this.liveAnnouncement = announcement;
|
|
1384
|
+
});
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
async showDropdown() {
|
|
1388
|
+
if (!this.dropdown) return;
|
|
1389
|
+
const beforeOpenEvent = new SigveloBeforeOpenEvent();
|
|
1390
|
+
this.dispatchEvent(beforeOpenEvent);
|
|
1391
|
+
if (beforeOpenEvent.defaultPrevented) {
|
|
1392
|
+
this.open = false;
|
|
1393
|
+
return;
|
|
1394
|
+
}
|
|
1395
|
+
this.dispatchEvent(new SigveloOpenEvent());
|
|
1396
|
+
this.dropdown.hidden = false;
|
|
1397
|
+
this.dropdown.showPopover();
|
|
1398
|
+
document.addEventListener("click", this.handleDocumentClick);
|
|
1399
|
+
document.addEventListener("keydown", this.handleDocumentKeyDown);
|
|
1400
|
+
this.cleanup = autoUpdate(this.textBox, this.dropdown, () => this.positionDropdown());
|
|
1401
|
+
await animateWithClass(this.dropdown, "show");
|
|
1402
|
+
if (this.filteredItems.length > 0) this.setActiveItem(this.filteredItems[0], false);
|
|
1403
|
+
}
|
|
1404
|
+
async hideDropdown() {
|
|
1405
|
+
if (!this.dropdown || this.dropdown.hidden) return;
|
|
1406
|
+
const beforeCloseEvent = new SigveloBeforeCloseEvent({ source: this });
|
|
1407
|
+
this.dispatchEvent(beforeCloseEvent);
|
|
1408
|
+
if (beforeCloseEvent.defaultPrevented) {
|
|
1409
|
+
this.open = true;
|
|
1410
|
+
return;
|
|
1411
|
+
}
|
|
1412
|
+
document.removeEventListener("click", this.handleDocumentClick);
|
|
1413
|
+
document.removeEventListener("keydown", this.handleDocumentKeyDown);
|
|
1414
|
+
await animateWithClass(this.dropdown, "hide");
|
|
1415
|
+
this.dropdown.hidden = true;
|
|
1416
|
+
this.dropdown.hidePopover();
|
|
1417
|
+
this.cleanup?.();
|
|
1418
|
+
if (this.activeItem) this.activeItem.removeAttribute("data-keyboard-nav");
|
|
1419
|
+
this.dispatchEvent(new SigveloCloseEvent());
|
|
1420
|
+
}
|
|
1421
|
+
async positionDropdown() {
|
|
1422
|
+
const visualBox = this.shadowRoot?.querySelector("#visual-box");
|
|
1423
|
+
if (!visualBox) return;
|
|
1424
|
+
computePosition(visualBox, this.dropdown, {
|
|
1425
|
+
placement: this.placement,
|
|
1426
|
+
middleware: [
|
|
1427
|
+
offset({
|
|
1428
|
+
mainAxis: this.distance,
|
|
1429
|
+
crossAxis: this.offset
|
|
1430
|
+
}),
|
|
1431
|
+
flip(),
|
|
1432
|
+
shift(),
|
|
1433
|
+
size({
|
|
1434
|
+
apply: ({ availableWidth, availableHeight, elements }) => {
|
|
1435
|
+
const referenceWidth = elements.reference.getBoundingClientRect().width;
|
|
1436
|
+
Object.assign(this.dropdown.style, {
|
|
1437
|
+
minWidth: `${referenceWidth}px`,
|
|
1438
|
+
maxWidth: `${Math.min(400, availableWidth)}px`,
|
|
1439
|
+
maxHeight: `${Math.min(300, availableHeight)}px`
|
|
1440
|
+
});
|
|
1441
|
+
},
|
|
1442
|
+
padding: 8
|
|
1443
|
+
})
|
|
1444
|
+
]
|
|
1445
|
+
}).then(({ x, y, placement }) => {
|
|
1446
|
+
this.setAttribute("data-placement", placement);
|
|
1447
|
+
Object.assign(this.dropdown.style, {
|
|
1448
|
+
left: `${x}px`,
|
|
1449
|
+
top: `${y}px`
|
|
1450
|
+
});
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
isBlank() {
|
|
1454
|
+
if (this.multiple) return !this.value || Array.isArray(this.value) && this.value.length === 0;
|
|
1455
|
+
return !this.value;
|
|
1456
|
+
}
|
|
1457
|
+
updateFormValue() {
|
|
1458
|
+
if (this.multiple && Array.isArray(this.value)) {
|
|
1459
|
+
const formData = new FormData();
|
|
1460
|
+
this.value.forEach((val) => {
|
|
1461
|
+
formData.append(this.name || "", String(val));
|
|
1462
|
+
});
|
|
1463
|
+
this.internals.setFormValue(formData);
|
|
1464
|
+
} else this.internals.setFormValue(String(this.value || ""));
|
|
1465
|
+
}
|
|
1466
|
+
async updateValidity() {
|
|
1467
|
+
await this.updateComplete;
|
|
1468
|
+
let flags = { valueMissing: this.required && this.isBlank() };
|
|
1469
|
+
const customError = this.getCustomValidity();
|
|
1470
|
+
if (customError) flags.customError = true;
|
|
1471
|
+
this.isInvalid = Object.values(flags).some(Boolean);
|
|
1472
|
+
const message = customError || (flags.valueMissing ? this.localize.term("pleaseSelectAnOption") : "");
|
|
1473
|
+
this.internals.setValidity(flags, message, this.focusableAnchor);
|
|
1474
|
+
}
|
|
1475
|
+
updateInputWidth() {
|
|
1476
|
+
if (!this.multiple) {
|
|
1477
|
+
this.inputWidth = "auto";
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
const text = this.inputValue || this.placeholder || "";
|
|
1481
|
+
const chars = Math.max(8, Math.min(text.length + 2, 50));
|
|
1482
|
+
this.inputWidth = `${chars}ch`;
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* A custom function for rendering tag content. By default, this function returns the item's full `textContent`. You
|
|
1486
|
+
* can override it to customize the content that gets rendered in tags in `multiple` mode.
|
|
1487
|
+
*/
|
|
1488
|
+
getTagContent(item) {
|
|
1489
|
+
return html`${item.textContent}`;
|
|
1490
|
+
}
|
|
1491
|
+
/** Sets focus to the combobox. */
|
|
1492
|
+
focus() {
|
|
1493
|
+
this.textBox?.focus();
|
|
1494
|
+
}
|
|
1495
|
+
/** Removes focus from the combobox. */
|
|
1496
|
+
blur() {
|
|
1497
|
+
this.textBox?.blur();
|
|
1498
|
+
}
|
|
1499
|
+
render() {
|
|
1500
|
+
const hasLabel = this.label || this.slotsWithContent.has("label");
|
|
1501
|
+
const hasDescription = this.description || this.slotsWithContent.has("description");
|
|
1502
|
+
const hasStart = this.slotsWithContent.has("start");
|
|
1503
|
+
const hasEnd = this.slotsWithContent.has("end");
|
|
1504
|
+
const inputStyles = { width: this.multiple ? this.inputWidth : void 0 };
|
|
1505
|
+
const comboboxDescription = [];
|
|
1506
|
+
if (hasDescription) comboboxDescription.push("description");
|
|
1507
|
+
comboboxDescription.push("combobox-instructions");
|
|
1508
|
+
const ariaDescribedBy = comboboxDescription.join(" ");
|
|
1509
|
+
return html`
|
|
1510
|
+
<label id="label" part="label" for="text-box" class=${classMap({ vh: !hasLabel })}>
|
|
1511
|
+
<slot name="label">${this.label}</slot>
|
|
1512
|
+
</label>
|
|
1513
|
+
|
|
1514
|
+
<div id="description" part="description" class=${classMap({ vh: !hasDescription })}>
|
|
1515
|
+
<slot name="description">${this.description}</slot>
|
|
1516
|
+
</div>
|
|
1517
|
+
|
|
1518
|
+
<!-- Screen reader instructions -->
|
|
1519
|
+
<div id="combobox-instructions" class="vh">
|
|
1520
|
+
${this.localize.term("useArrowKeysToNavigateEnterToSelect")}
|
|
1521
|
+
${this.multiple ? this.localize.term("multipleSelectionsAllowed") : ""}
|
|
1522
|
+
</div>
|
|
1523
|
+
|
|
1524
|
+
<div
|
|
1525
|
+
id="visual-box"
|
|
1526
|
+
part="visual-box"
|
|
1527
|
+
class=${classMap({
|
|
1528
|
+
normal: this.variant === "normal",
|
|
1529
|
+
filled: this.variant === "filled",
|
|
1530
|
+
unstyled: this.variant === "unstyled",
|
|
1531
|
+
xs: this.size === "xs",
|
|
1532
|
+
sm: this.size === "sm",
|
|
1533
|
+
md: this.size === "md",
|
|
1534
|
+
lg: this.size === "lg",
|
|
1535
|
+
xl: this.size === "xl",
|
|
1536
|
+
pill: this.pill,
|
|
1537
|
+
disabled: this.disabled,
|
|
1538
|
+
multiple: this.multiple,
|
|
1539
|
+
"has-clear": this.withClear && !this.isBlank() && !this.disabled,
|
|
1540
|
+
"has-start": hasStart,
|
|
1541
|
+
"has-end": hasEnd
|
|
1542
|
+
})}
|
|
1543
|
+
@click=${this.handleVisualBoxClick}
|
|
1544
|
+
>
|
|
1545
|
+
<slot name="start"></slot>
|
|
1546
|
+
|
|
1547
|
+
<div id="input-area" part="input-area">
|
|
1548
|
+
${this.multiple ? this.selectedItems.map((item) => html`
|
|
1549
|
+
<span
|
|
1550
|
+
part="tag"
|
|
1551
|
+
class="tag"
|
|
1552
|
+
@pointerdown=${(event) => event.preventDefault()}
|
|
1553
|
+
>
|
|
1554
|
+
${this.getTagContent(item)}
|
|
1555
|
+
<button
|
|
1556
|
+
part="tag-remove"
|
|
1557
|
+
class="tag-remove"
|
|
1558
|
+
type="button"
|
|
1559
|
+
tabindex="-1"
|
|
1560
|
+
aria-label="${this.localize.term("removeItem", item.textContent || "")}"
|
|
1561
|
+
@click=${(event) => this.removeTag(item, event)}
|
|
1562
|
+
>
|
|
1563
|
+
<sigvelo-icon library="system" name="x"></sigvelo-icon>
|
|
1564
|
+
</button>
|
|
1565
|
+
</span>
|
|
1566
|
+
`) : ""}
|
|
1567
|
+
|
|
1568
|
+
<input
|
|
1569
|
+
id="text-box"
|
|
1570
|
+
part="text-box"
|
|
1571
|
+
type="text"
|
|
1572
|
+
role="combobox"
|
|
1573
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
1574
|
+
aria-autocomplete="list"
|
|
1575
|
+
aria-haspopup="listbox"
|
|
1576
|
+
aria-controls="dropdown"
|
|
1577
|
+
aria-describedby=${ariaDescribedBy}
|
|
1578
|
+
aria-invalid=${this.isInvalid ? "true" : "false"}
|
|
1579
|
+
?disabled=${this.disabled}
|
|
1580
|
+
?required=${this.required}
|
|
1581
|
+
placeholder=${ifDefined(this.placeholder)}
|
|
1582
|
+
.value=${this.inputValue}
|
|
1583
|
+
autocomplete="off"
|
|
1584
|
+
style=${styleMap(inputStyles)}
|
|
1585
|
+
@input=${this.handleInput}
|
|
1586
|
+
@focus=${this.handleFocus}
|
|
1587
|
+
@blur=${this.handleBlur}
|
|
1588
|
+
@keydown=${this.handleKeyDown}
|
|
1589
|
+
@click=${this.handleInputClick}
|
|
1590
|
+
/>
|
|
1591
|
+
</div>
|
|
1592
|
+
|
|
1593
|
+
${this.withClear && !this.isBlank() && !this.disabled ? html`
|
|
1594
|
+
<button
|
|
1595
|
+
id="clear-button"
|
|
1596
|
+
part="clear-button"
|
|
1597
|
+
class="text-box-button"
|
|
1598
|
+
type="button"
|
|
1599
|
+
tabindex="-1"
|
|
1600
|
+
aria-label="${this.localize.term("clearEntry")}"
|
|
1601
|
+
@click=${this.handleClear}
|
|
1602
|
+
>
|
|
1603
|
+
<sigvelo-icon library="system" name="circle-x"></sigvelo-icon>
|
|
1604
|
+
</button>
|
|
1605
|
+
` : ""}
|
|
1606
|
+
|
|
1607
|
+
<slot name="end"></slot>
|
|
1608
|
+
|
|
1609
|
+
<sigvelo-icon
|
|
1610
|
+
id="chevron"
|
|
1611
|
+
part="chevron"
|
|
1612
|
+
exportparts="svg:chevron__svg"
|
|
1613
|
+
library="system"
|
|
1614
|
+
name="selector"
|
|
1615
|
+
></sigvelo-icon>
|
|
1616
|
+
</div>
|
|
1617
|
+
|
|
1618
|
+
<div
|
|
1619
|
+
id="dropdown"
|
|
1620
|
+
part="dropdown"
|
|
1621
|
+
role="listbox"
|
|
1622
|
+
aria-label="${this.label}"
|
|
1623
|
+
aria-multiselectable="${this.multiple ? "true" : "false"}"
|
|
1624
|
+
popover="manual"
|
|
1625
|
+
hidden
|
|
1626
|
+
@click=${this.handleItemClick}
|
|
1627
|
+
@pointerdown=${(event) => event.preventDefault()}
|
|
1628
|
+
@pointermove=${this.handleItemPointerMove}
|
|
1629
|
+
>
|
|
1630
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
1631
|
+
</div>
|
|
1632
|
+
|
|
1633
|
+
<div
|
|
1634
|
+
id="live-region"
|
|
1635
|
+
class="vh"
|
|
1636
|
+
role="status"
|
|
1637
|
+
aria-live="polite"
|
|
1638
|
+
aria-atomic="true"
|
|
1639
|
+
aria-relevant="additions text"
|
|
1640
|
+
>
|
|
1641
|
+
${this.liveAnnouncement}
|
|
1642
|
+
</div>
|
|
1643
|
+
`;
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
__decorate([query("#dropdown")], SigveloCombobox.prototype, "dropdown", void 0);
|
|
1647
|
+
__decorate([query("#text-box")], SigveloCombobox.prototype, "textBox", void 0);
|
|
1648
|
+
__decorate([state()], SigveloCombobox.prototype, "open", void 0);
|
|
1649
|
+
__decorate([state()], SigveloCombobox.prototype, "inputValue", void 0);
|
|
1650
|
+
__decorate([state()], SigveloCombobox.prototype, "activeItem", void 0);
|
|
1651
|
+
__decorate([state()], SigveloCombobox.prototype, "selectedItems", void 0);
|
|
1652
|
+
__decorate([state()], SigveloCombobox.prototype, "filteredItems", void 0);
|
|
1653
|
+
__decorate([state()], SigveloCombobox.prototype, "inputWidth", void 0);
|
|
1654
|
+
__decorate([state()], SigveloCombobox.prototype, "isInvalid", void 0);
|
|
1655
|
+
__decorate([state()], SigveloCombobox.prototype, "hadUserInteraction", void 0);
|
|
1656
|
+
__decorate([state()], SigveloCombobox.prototype, "wasSubmitted", void 0);
|
|
1657
|
+
__decorate([state()], SigveloCombobox.prototype, "liveAnnouncement", void 0);
|
|
1658
|
+
__decorate([property()], SigveloCombobox.prototype, "label", void 0);
|
|
1659
|
+
__decorate([property()], SigveloCombobox.prototype, "description", void 0);
|
|
1660
|
+
__decorate([property({ reflect: true })], SigveloCombobox.prototype, "name", void 0);
|
|
1661
|
+
__decorate([property()], SigveloCombobox.prototype, "value", void 0);
|
|
1662
|
+
__decorate([property()], SigveloCombobox.prototype, "placeholder", void 0);
|
|
1663
|
+
__decorate([property({
|
|
1664
|
+
type: Boolean,
|
|
1665
|
+
reflect: true
|
|
1666
|
+
})], SigveloCombobox.prototype, "disabled", void 0);
|
|
1667
|
+
__decorate([property({
|
|
1668
|
+
type: Boolean,
|
|
1669
|
+
reflect: true
|
|
1670
|
+
})], SigveloCombobox.prototype, "required", void 0);
|
|
1671
|
+
__decorate([property({
|
|
1672
|
+
type: Boolean,
|
|
1673
|
+
reflect: true
|
|
1674
|
+
})], SigveloCombobox.prototype, "multiple", void 0);
|
|
1675
|
+
__decorate([property({
|
|
1676
|
+
attribute: "with-clear",
|
|
1677
|
+
type: Boolean,
|
|
1678
|
+
reflect: true
|
|
1679
|
+
})], SigveloCombobox.prototype, "withClear", void 0);
|
|
1680
|
+
__decorate([property({ reflect: true })], SigveloCombobox.prototype, "variant", void 0);
|
|
1681
|
+
__decorate([property({ reflect: true })], SigveloCombobox.prototype, "size", void 0);
|
|
1682
|
+
__decorate([property({
|
|
1683
|
+
type: Boolean,
|
|
1684
|
+
reflect: true
|
|
1685
|
+
})], SigveloCombobox.prototype, "pill", void 0);
|
|
1686
|
+
__decorate([property()], SigveloCombobox.prototype, "placement", void 0);
|
|
1687
|
+
__decorate([property({ type: Number })], SigveloCombobox.prototype, "distance", void 0);
|
|
1688
|
+
__decorate([property({ type: Number })], SigveloCombobox.prototype, "offset", void 0);
|
|
1689
|
+
__decorate([property()], SigveloCombobox.prototype, "form", void 0);
|
|
1690
|
+
SigveloCombobox.disableWarning?.("change-in-update");
|
|
1691
|
+
customElements.define("sigvelo-combobox", SigveloCombobox);
|
|
1692
|
+
//#endregion
|
|
1693
|
+
export { SigveloCombobox as t };
|