@webtides/element-library 0.2.0 → 0.3.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/CHANGELOG.md +384 -3
- package/README.md +61 -41
- package/all.js +28 -0
- package/catalog.d.ts +14 -0
- package/catalog.js +55 -27
- package/custom-elements.json +16604 -3420
- package/package.json +35 -28
- package/src/components/accordion/accordion.changelog.md +10 -0
- package/src/components/accordion/accordion.js +10 -7
- package/src/components/accordion/accordion.readme.md +2 -0
- package/src/components/accordion/accordion.style.js +8 -0
- package/src/components/amount-field/amount-field.changelog.md +23 -3
- package/src/components/amount-field/amount-field.js +53 -26
- package/src/components/amount-field/amount-field.readme.md +82 -20
- package/src/components/amount-field/amount-field.style.js +111 -47
- package/src/components/avatar/avatar.changelog.md +23 -0
- package/src/components/avatar/avatar.define.js +3 -0
- package/src/components/avatar/avatar.js +115 -0
- package/src/components/avatar/avatar.readme.md +132 -0
- package/src/components/avatar/avatar.style.js +67 -0
- package/src/components/badge/badge.changelog.md +23 -0
- package/src/components/badge/badge.define.js +3 -0
- package/src/components/badge/badge.js +59 -0
- package/src/components/badge/badge.readme.md +109 -0
- package/src/components/badge/badge.style.js +63 -0
- package/src/components/breadcrumb/breadcrumb.changelog.md +22 -0
- package/src/components/breadcrumb/breadcrumb.define.js +3 -0
- package/src/components/breadcrumb/breadcrumb.js +47 -0
- package/src/components/breadcrumb/breadcrumb.readme.md +108 -0
- package/src/components/breadcrumb/breadcrumb.style.js +20 -0
- package/src/components/breadcrumb-item/breadcrumb-item.changelog.md +23 -0
- package/src/components/breadcrumb-item/breadcrumb-item.define.js +3 -0
- package/src/components/breadcrumb-item/breadcrumb-item.js +82 -0
- package/src/components/breadcrumb-item/breadcrumb-item.readme.md +106 -0
- package/src/components/breadcrumb-item/breadcrumb-item.style.js +92 -0
- package/src/components/button/button.changelog.md +34 -1
- package/src/components/button/button.js +285 -29
- package/src/components/button/button.readme.md +130 -10
- package/src/components/button/button.style.js +99 -120
- package/src/components/button-group/button-group.changelog.md +24 -0
- package/src/components/button-group/button-group.define.js +3 -0
- package/src/components/button-group/button-group.js +53 -0
- package/src/components/button-group/button-group.readme.md +114 -0
- package/src/components/button-group/button-group.style.js +41 -0
- package/src/components/card/card.changelog.md +23 -0
- package/src/components/card/card.define.js +3 -0
- package/src/components/card/card.js +73 -0
- package/src/components/card/card.readme.md +136 -0
- package/src/components/card/card.style.js +99 -0
- package/src/components/carousel/carousel.changelog.md +20 -0
- package/src/components/carousel/carousel.js +89 -40
- package/src/components/carousel/carousel.readme.md +39 -6
- package/src/components/carousel/carousel.style.js +21 -77
- package/src/components/carousel/glide/components/ShadowAnchors.js +3 -1
- package/src/components/carousel/glide/components/ShadowClones.js +21 -24
- package/src/components/carousel/glide/components/ShadowGaps.js +2 -2
- package/src/components/carousel/glide/components/ShadowHtml.js +22 -3
- package/src/components/checkbox-field/checkbox-field.changelog.md +19 -0
- package/src/components/checkbox-field/checkbox-field.js +25 -10
- package/src/components/checkbox-field/checkbox-field.readme.md +17 -4
- package/src/components/checkbox-field/checkbox-field.style.js +15 -3
- package/src/components/checkbox-group-field/checkbox-group-field.changelog.md +25 -0
- package/src/components/checkbox-group-field/checkbox-group-field.define.js +3 -0
- package/src/components/checkbox-group-field/checkbox-group-field.js +217 -0
- package/src/components/checkbox-group-field/checkbox-group-field.readme.md +95 -0
- package/src/components/checkbox-group-field/checkbox-group-field.style.js +62 -0
- package/src/components/color-field/color-field.changelog.md +24 -0
- package/src/components/color-field/color-field.define.js +3 -0
- package/src/components/color-field/color-field.js +184 -0
- package/src/components/color-field/color-field.readme.md +95 -0
- package/src/components/color-field/color-field.style.js +39 -0
- package/src/components/combobox-field/combobox-field.changelog.md +23 -0
- package/src/components/combobox-field/combobox-field.define.js +3 -0
- package/src/components/combobox-field/combobox-field.js +97 -0
- package/src/components/combobox-field/combobox-field.readme.md +93 -0
- package/src/components/combobox-field/combobox-field.style.js +56 -0
- package/src/components/copy-button/copy-button.changelog.md +24 -0
- package/src/components/copy-button/copy-button.define.js +3 -0
- package/src/components/copy-button/copy-button.events.js +4 -0
- package/src/components/copy-button/copy-button.js +237 -0
- package/src/components/copy-button/copy-button.readme.md +134 -0
- package/src/components/copy-button/copy-button.style.js +109 -0
- package/src/components/date-field/date-field.changelog.md +24 -0
- package/src/components/date-field/date-field.define.js +3 -0
- package/src/components/date-field/date-field.js +119 -0
- package/src/components/date-field/date-field.readme.md +110 -0
- package/src/components/date-field/date-field.style.js +53 -0
- package/src/components/dialog/dialog.changelog.md +16 -1
- package/src/components/dialog/dialog.js +252 -57
- package/src/components/dialog/dialog.readme.md +36 -4
- package/src/components/dialog/dialog.style.js +9 -109
- package/src/components/divider/divider.changelog.md +23 -0
- package/src/components/divider/divider.define.js +3 -0
- package/src/components/divider/divider.js +48 -0
- package/src/components/divider/divider.readme.md +101 -0
- package/src/components/divider/divider.style.js +50 -0
- package/src/components/drawer/drawer.changelog.md +25 -0
- package/src/components/drawer/drawer.define.js +3 -0
- package/src/components/drawer/drawer.events.js +8 -0
- package/src/components/drawer/drawer.js +80 -0
- package/src/components/drawer/drawer.readme.md +194 -0
- package/src/components/drawer/drawer.style.js +83 -0
- package/src/components/dropdown/dropdown.js +9 -7
- package/src/components/empty-state/empty-state.changelog.md +22 -0
- package/src/components/empty-state/empty-state.define.js +3 -0
- package/src/components/empty-state/empty-state.js +55 -0
- package/src/components/empty-state/empty-state.readme.md +114 -0
- package/src/components/empty-state/empty-state.style.js +60 -0
- package/src/components/file-field/file-field.changelog.md +24 -0
- package/src/components/file-field/file-field.define.js +3 -0
- package/src/components/file-field/file-field.js +205 -0
- package/src/components/file-field/file-field.readme.md +103 -0
- package/src/components/file-field/file-field.style.js +28 -0
- package/src/components/form-field/form-field.changelog.md +25 -0
- package/src/components/form-field/form-field.js +212 -15
- package/src/components/form-field/form-field.readme.md +82 -18
- package/src/components/form-field/form-field.style.js +6 -24
- package/src/components/input-field/input-field.changelog.md +24 -0
- package/src/components/input-field/input-field.js +82 -6
- package/src/components/input-field/input-field.readme.md +34 -5
- package/src/components/input-field/input-field.style.js +32 -13
- package/src/components/notification/notification.changelog.md +21 -1
- package/src/components/notification/notification.js +80 -74
- package/src/components/notification/notification.readme.md +54 -13
- package/src/components/notification/notification.style.js +37 -22
- package/src/components/otp-field/otp-field.changelog.md +23 -0
- package/src/components/otp-field/otp-field.define.js +3 -0
- package/src/components/otp-field/otp-field.events.js +3 -0
- package/src/components/otp-field/otp-field.js +172 -0
- package/src/components/otp-field/otp-field.readme.md +111 -0
- package/src/components/otp-field/otp-field.style.js +53 -0
- package/src/components/pagination/pagination.changelog.md +30 -0
- package/src/components/pagination/pagination.define.js +3 -0
- package/src/components/pagination/pagination.events.js +3 -0
- package/src/components/pagination/pagination.js +282 -0
- package/src/components/pagination/pagination.readme.md +167 -0
- package/src/components/pagination/pagination.style.js +162 -0
- package/src/components/password-field/password-field.changelog.md +24 -0
- package/src/components/password-field/password-field.js +7 -1
- package/src/components/password-field/password-field.readme.md +15 -6
- package/src/components/password-field/password-field.style.js +36 -13
- package/src/components/popover/popover.changelog.md +24 -0
- package/src/components/popover/popover.define.js +3 -0
- package/src/components/popover/popover.events.js +4 -0
- package/src/components/popover/popover.js +255 -0
- package/src/components/popover/popover.readme.md +132 -0
- package/src/components/popover/popover.style.js +41 -0
- package/src/components/progress-bar/progress-bar.changelog.md +23 -0
- package/src/components/progress-bar/progress-bar.define.js +3 -0
- package/src/components/progress-bar/progress-bar.js +80 -0
- package/src/components/progress-bar/progress-bar.readme.md +110 -0
- package/src/components/progress-bar/progress-bar.style.js +93 -0
- package/src/components/progress-ring/progress-ring.changelog.md +23 -0
- package/src/components/progress-ring/progress-ring.define.js +3 -0
- package/src/components/progress-ring/progress-ring.js +83 -0
- package/src/components/progress-ring/progress-ring.readme.md +115 -0
- package/src/components/progress-ring/progress-ring.style.js +85 -0
- package/src/components/radio-field/radio-field.changelog.md +16 -0
- package/src/components/radio-field/radio-field.js +34 -11
- package/src/components/radio-field/radio-field.readme.md +13 -8
- package/src/components/radio-field/radio-field.style.js +17 -65
- package/src/components/range-field/range-field.changelog.md +24 -0
- package/src/components/range-field/range-field.define.js +3 -0
- package/src/components/range-field/range-field.js +167 -0
- package/src/components/range-field/range-field.readme.md +87 -0
- package/src/components/range-field/range-field.style.js +41 -0
- package/src/components/rating-field/rating-field.changelog.md +24 -0
- package/src/components/rating-field/rating-field.define.js +3 -0
- package/src/components/rating-field/rating-field.js +195 -0
- package/src/components/rating-field/rating-field.readme.md +82 -0
- package/src/components/rating-field/rating-field.style.js +79 -0
- package/src/components/select-field/select-field.changelog.md +17 -0
- package/src/components/select-field/select-field.js +100 -8
- package/src/components/select-field/select-field.readme.md +32 -6
- package/src/components/select-field/select-field.style.js +19 -9
- package/src/components/skeleton/skeleton.changelog.md +22 -0
- package/src/components/skeleton/skeleton.define.js +3 -0
- package/src/components/skeleton/skeleton.js +49 -0
- package/src/components/skeleton/skeleton.readme.md +115 -0
- package/src/components/skeleton/skeleton.style.js +79 -0
- package/src/components/slider/slider.changelog.md +15 -0
- package/src/components/slider/slider.js +37 -5
- package/src/components/slider/slider.readme.md +28 -6
- package/src/components/slider/slider.style.js +7 -71
- package/src/components/spinner/spinner.changelog.md +22 -0
- package/src/components/spinner/spinner.define.js +3 -0
- package/src/components/spinner/spinner.js +48 -0
- package/src/components/spinner/spinner.readme.md +98 -0
- package/src/components/spinner/spinner.style.js +44 -0
- package/src/components/switch-field/switch-field.changelog.md +16 -0
- package/src/components/switch-field/switch-field.js +17 -9
- package/src/components/switch-field/switch-field.readme.md +11 -4
- package/src/components/switch-field/switch-field.style.js +13 -13
- package/src/components/tab-group/tab-group.changelog.md +19 -0
- package/src/components/tab-group/tab-group.js +122 -10
- package/src/components/tab-group/tab-group.readme.md +25 -4
- package/src/components/tab-link/tab-link.changelog.md +16 -0
- package/src/components/tab-link/tab-link.js +51 -8
- package/src/components/tab-link/tab-link.readme.md +14 -8
- package/src/components/tab-link/tab-link.style.js +13 -0
- package/src/components/tab-panel/tab-panel.changelog.md +8 -2
- package/src/components/tab-panel/tab-panel.js +7 -3
- package/src/components/tab-panel/tab-panel.readme.md +7 -5
- package/src/components/tag/tag.changelog.md +24 -0
- package/src/components/tag/tag.define.js +3 -0
- package/src/components/tag/tag.events.js +3 -0
- package/src/components/tag/tag.js +116 -0
- package/src/components/tag/tag.readme.md +119 -0
- package/src/components/tag/tag.style.js +101 -0
- package/src/components/tag-field/tag-field.changelog.md +25 -0
- package/src/components/tag-field/tag-field.define.js +3 -0
- package/src/components/tag-field/tag-field.js +359 -0
- package/src/components/tag-field/tag-field.readme.md +113 -0
- package/src/components/tag-field/tag-field.style.js +62 -0
- package/src/components/textarea-field/textarea-field.changelog.md +28 -4
- package/src/components/textarea-field/textarea-field.js +68 -14
- package/src/components/textarea-field/textarea-field.readme.md +45 -9
- package/src/components/textarea-field/textarea-field.style.js +45 -2
- package/src/components/toast/toast.changelog.md +24 -0
- package/src/components/toast/toast.define.js +3 -0
- package/src/components/toast/toast.js +193 -0
- package/src/components/toast/toast.readme.md +189 -0
- package/src/components/toast/toast.style.js +74 -0
- package/src/components/tooltip/tooltip.changelog.md +24 -0
- package/src/components/tooltip/tooltip.define.js +3 -0
- package/src/components/tooltip/tooltip.events.js +4 -0
- package/src/components/tooltip/tooltip.js +377 -0
- package/src/components/tooltip/tooltip.readme.md +172 -0
- package/src/components/tooltip/tooltip.style.js +107 -0
- package/src/components/transition-classes/transition-classes.js +6 -6
- package/src/styles/appearance.style.js +42 -0
- package/src/styles/arrow.style.js +65 -0
- package/src/styles/choice-group.style.js +94 -0
- package/src/styles/form-control.style.js +79 -0
- package/src/styles/host.style.js +55 -0
- package/src/styles/layers.css +31 -0
- package/src/styles/modal.style.js +146 -0
- package/src/styles/native.css +275 -0
- package/src/styles/size.style.js +48 -0
- package/src/styles/slide-controls.style.js +225 -0
- package/src/styles/utilities.css +30 -0
- package/src/styles/variants.style.js +78 -0
- package/src/themes/default.css +86 -142
- package/src/themes/high-contrast.css +72 -129
- package/src/themes/sketchy.css +95 -175
- package/src/utils/floating.js +71 -0
- package/src/utils/focus.js +18 -0
- package/src/utils/progress.js +25 -0
- package/src/utils/slots.js +21 -0
- package/src/utils/text-entry-attributes.js +51 -0
- package/types/all.d.ts +54 -1
- package/types/index.d.ts +1 -0
- package/types/src/components/accordion/accordion.d.ts +6 -4
- package/types/src/components/accordion/accordion.events.d.ts +3 -3
- package/types/src/components/accordion-group/accordion-group.d.ts +4 -3
- package/types/src/components/amount-field/amount-field.d.ts +30 -16
- package/types/src/components/avatar/avatar.d.ts +57 -0
- package/types/src/components/avatar/avatar.define.d.ts +1 -0
- package/types/src/components/avatar/avatar.style.d.ts +2 -0
- package/types/src/components/badge/badge.d.ts +32 -0
- package/types/src/components/badge/badge.define.d.ts +1 -0
- package/types/src/components/badge/badge.style.d.ts +2 -0
- package/types/src/components/breadcrumb/breadcrumb.d.ts +27 -0
- package/types/src/components/breadcrumb/breadcrumb.define.d.ts +1 -0
- package/types/src/components/breadcrumb/breadcrumb.style.d.ts +2 -0
- package/types/src/components/breadcrumb-item/breadcrumb-item.d.ts +38 -0
- package/types/src/components/breadcrumb-item/breadcrumb-item.define.d.ts +1 -0
- package/types/src/components/breadcrumb-item/breadcrumb-item.style.d.ts +2 -0
- package/types/src/components/button/button.d.ts +129 -14
- package/types/src/components/button-group/button-group.d.ts +28 -0
- package/types/src/components/button-group/button-group.define.d.ts +1 -0
- package/types/src/components/button-group/button-group.style.d.ts +2 -0
- package/types/src/components/card/card.d.ts +40 -0
- package/types/src/components/card/card.define.d.ts +1 -0
- package/types/src/components/card/card.style.d.ts +2 -0
- package/types/src/components/carousel/carousel.d.ts +22 -8
- package/types/src/components/carousel/carousel.events.d.ts +3 -3
- package/types/src/components/carousel/glide/components/ShadowAnchors.d.ts +1 -1
- package/types/src/components/carousel/glide/components/ShadowClones.d.ts +8 -1
- package/types/src/components/carousel/glide/components/ShadowGaps.d.ts +1 -1
- package/types/src/components/carousel/glide/components/ShadowHtml.d.ts +1 -1
- package/types/src/components/carousel/glide/components/glide-html.d.ts +1 -1
- package/types/src/components/checkbox-field/checkbox-field.d.ts +22 -15
- package/types/src/components/checkbox-group-field/checkbox-group-field.d.ts +100 -0
- package/types/src/components/checkbox-group-field/checkbox-group-field.define.d.ts +1 -0
- package/types/src/components/checkbox-group-field/checkbox-group-field.style.d.ts +2 -0
- package/types/src/components/color-field/color-field.d.ts +102 -0
- package/types/src/components/color-field/color-field.define.d.ts +1 -0
- package/types/src/components/color-field/color-field.style.d.ts +2 -0
- package/types/src/components/combobox-field/combobox-field.d.ts +84 -0
- package/types/src/components/combobox-field/combobox-field.define.d.ts +1 -0
- package/types/src/components/combobox-field/combobox-field.style.d.ts +2 -0
- package/types/src/components/copy-button/copy-button.d.ts +93 -0
- package/types/src/components/copy-button/copy-button.define.d.ts +1 -0
- package/types/src/components/copy-button/copy-button.events.d.ts +5 -0
- package/types/src/components/copy-button/copy-button.style.d.ts +2 -0
- package/types/src/components/date-field/date-field.d.ts +102 -0
- package/types/src/components/date-field/date-field.define.d.ts +1 -0
- package/types/src/components/date-field/date-field.style.d.ts +2 -0
- package/types/src/components/dialog/dialog.d.ts +101 -19
- package/types/src/components/dialog/dialog.events.d.ts +8 -8
- package/types/src/components/divider/divider.d.ts +27 -0
- package/types/src/components/divider/divider.define.d.ts +1 -0
- package/types/src/components/divider/divider.style.d.ts +2 -0
- package/types/src/components/drawer/drawer.d.ts +70 -0
- package/types/src/components/drawer/drawer.define.d.ts +1 -0
- package/types/src/components/drawer/drawer.events.d.ts +9 -0
- package/types/src/components/drawer/drawer.style.d.ts +2 -0
- package/types/src/components/dropdown/dropdown.d.ts +5 -3
- package/types/src/components/empty-state/empty-state.d.ts +29 -0
- package/types/src/components/empty-state/empty-state.define.d.ts +1 -0
- package/types/src/components/empty-state/empty-state.style.d.ts +2 -0
- package/types/src/components/file-field/file-field.d.ts +115 -0
- package/types/src/components/file-field/file-field.define.d.ts +1 -0
- package/types/src/components/file-field/file-field.style.d.ts +2 -0
- package/types/src/components/form-field/form-field.d.ts +129 -14
- package/types/src/components/form-field/form-field.events.d.ts +4 -4
- package/types/src/components/input-field/input-field.d.ts +52 -5
- package/types/src/components/lazy-src/lazy-src.d.ts +7 -5
- package/types/src/components/lazy-src/lazy-src.events.d.ts +5 -5
- package/types/src/components/notification/notification.d.ts +18 -18
- package/types/src/components/notification/notification.events.d.ts +6 -6
- package/types/src/components/otp-field/otp-field.d.ts +130 -0
- package/types/src/components/otp-field/otp-field.define.d.ts +1 -0
- package/types/src/components/otp-field/otp-field.events.d.ts +4 -0
- package/types/src/components/otp-field/otp-field.style.d.ts +2 -0
- package/types/src/components/pagination/pagination.d.ts +117 -0
- package/types/src/components/pagination/pagination.define.d.ts +1 -0
- package/types/src/components/pagination/pagination.events.d.ts +4 -0
- package/types/src/components/pagination/pagination.style.d.ts +2 -0
- package/types/src/components/password-field/password-field.d.ts +29 -12
- package/types/src/components/popover/popover.d.ts +123 -0
- package/types/src/components/popover/popover.define.d.ts +1 -0
- package/types/src/components/popover/popover.events.d.ts +5 -0
- package/types/src/components/popover/popover.style.d.ts +2 -0
- package/types/src/components/progress-bar/progress-bar.d.ts +35 -0
- package/types/src/components/progress-bar/progress-bar.define.d.ts +1 -0
- package/types/src/components/progress-bar/progress-bar.style.d.ts +2 -0
- package/types/src/components/progress-ring/progress-ring.d.ts +40 -0
- package/types/src/components/progress-ring/progress-ring.define.d.ts +1 -0
- package/types/src/components/progress-ring/progress-ring.style.d.ts +2 -0
- package/types/src/components/radio-field/radio-field.d.ts +21 -9
- package/types/src/components/range-field/range-field.d.ts +94 -0
- package/types/src/components/range-field/range-field.define.d.ts +1 -0
- package/types/src/components/range-field/range-field.style.d.ts +2 -0
- package/types/src/components/rating-field/rating-field.d.ts +96 -0
- package/types/src/components/rating-field/rating-field.define.d.ts +1 -0
- package/types/src/components/rating-field/rating-field.style.d.ts +2 -0
- package/types/src/components/scroll-to/scroll-to.d.ts +3 -2
- package/types/src/components/scroll-to-top/scroll-to-top.d.ts +4 -2
- package/types/src/components/select-field/select-field.d.ts +55 -5
- package/types/src/components/skeleton/skeleton.d.ts +29 -0
- package/types/src/components/skeleton/skeleton.define.d.ts +1 -0
- package/types/src/components/skeleton/skeleton.style.d.ts +2 -0
- package/types/src/components/slider/slider.d.ts +14 -8
- package/types/src/components/slider/slider.events.d.ts +4 -4
- package/types/src/components/spinner/spinner.d.ts +28 -0
- package/types/src/components/spinner/spinner.define.d.ts +1 -0
- package/types/src/components/spinner/spinner.style.d.ts +2 -0
- package/types/src/components/sticky/sticky.d.ts +4 -2
- package/types/src/components/svg-use/svg-use.d.ts +4 -2
- package/types/src/components/switch-field/switch-field.d.ts +17 -15
- package/types/src/components/tab-group/tab-group.d.ts +44 -3
- package/types/src/components/tab-link/tab-link.d.ts +33 -10
- package/types/src/components/tab-panel/tab-panel.d.ts +8 -5
- package/types/src/components/tag/tag.d.ts +53 -0
- package/types/src/components/tag/tag.define.d.ts +1 -0
- package/types/src/components/tag/tag.events.d.ts +4 -0
- package/types/src/components/tag/tag.style.d.ts +2 -0
- package/types/src/components/tag-field/tag-field.d.ts +178 -0
- package/types/src/components/tag-field/tag-field.define.d.ts +1 -0
- package/types/src/components/tag-field/tag-field.style.d.ts +2 -0
- package/types/src/components/textarea-field/textarea-field.d.ts +44 -4
- package/types/src/components/toast/toast.d.ts +110 -0
- package/types/src/components/toast/toast.define.d.ts +1 -0
- package/types/src/components/toast/toast.style.d.ts +2 -0
- package/types/src/components/tooltip/tooltip.d.ts +161 -0
- package/types/src/components/tooltip/tooltip.define.d.ts +1 -0
- package/types/src/components/tooltip/tooltip.events.d.ts +5 -0
- package/types/src/components/tooltip/tooltip.style.d.ts +2 -0
- package/types/src/components/transition-classes/transition-classes.d.ts +9 -8
- package/types/src/styles/appearance.style.d.ts +18 -0
- package/types/src/styles/arrow.style.d.ts +15 -0
- package/types/src/styles/choice-group.style.d.ts +23 -0
- package/types/src/styles/form-control.style.d.ts +26 -0
- package/types/src/styles/host.style.d.ts +24 -0
- package/types/src/styles/modal.style.d.ts +20 -0
- package/types/src/styles/size.style.d.ts +20 -0
- package/types/src/styles/slide-controls.style.d.ts +20 -0
- package/types/src/styles/variants.style.d.ts +32 -0
- package/types/src/utils/body-scroll.d.ts +12 -2
- package/types/src/utils/floating.d.ts +36 -0
- package/types/src/utils/focus.d.ts +16 -0
- package/types/src/utils/progress.d.ts +19 -0
- package/types/src/utils/slots.d.ts +19 -0
- package/types/src/utils/text-entry-attributes.d.ts +18 -0
- package/types/src/utils/transitions.d.ts +2 -2
- package/web-types.json +6590 -1584
|
@@ -35,9 +35,9 @@ Inherits all of `form-field`'s properties (`name`, `value`, `required`, `disable
|
|
|
35
35
|
|
|
36
36
|
#### Events
|
|
37
37
|
|
|
38
|
-
| Name | Detail | Description
|
|
39
|
-
| -------------- | -------------------- |
|
|
40
|
-
| `input-change` | `string` (the value) | Fired when the on/off state changes. |
|
|
38
|
+
| Name | Detail | Description |
|
|
39
|
+
| -------------- | -------------------- | ----------------------------------------------------------- |
|
|
40
|
+
| `input-change` | `string` (the value) | Fired when the on/off state changes, once for every change. |
|
|
41
41
|
|
|
42
42
|
#### CSS States
|
|
43
43
|
|
|
@@ -50,9 +50,16 @@ Inherits all of `form-field`'s properties (`name`, `value`, `required`, `disable
|
|
|
50
50
|
|
|
51
51
|
#### CSS Custom Properties
|
|
52
52
|
|
|
53
|
-
Headless by default; reads the library's `--el-*` design tokens (`--el-color-accent`, `--el-color-border`, `--el-color-bg`, `--el-space-2`, `--el-border-width`, `--el-focus-ring-width`, `--el-duration-md`, `--el-ease`, `--el-color-fg-muted`, `--el-color-danger`). Skin it via a theme — see the Storybook _Docs / Theming_ page.
|
|
53
|
+
Headless by default; reads the library's `--el-*` design tokens (`--el-color-accent`, `--el-color-border`, `--el-color-bg`, `--el-space-2`, `--el-border-width`, `--el-focus-ring-width`, `--el-duration-md`, `--el-ease`, `--el-color-fg`, `--el-color-fg-muted`, `--el-color-danger`, `--el-font-size-sm`). Skin it via a theme — see the Storybook _Docs / Theming_ page.
|
|
54
|
+
|
|
55
|
+
The switch with its label, the help message and the error message stack in a column, in that order, and the texts have the look they have in every field: see [Layout](../form-field/form-field.readme.md#layout) in the readme of `form-field`.
|
|
56
|
+
|
|
57
|
+
On a touch screen (`@media (any-pointer: coarse)`) the label, which is the hit area of the switch, is at least `--el-touch-target` wide and high. Without that token, and on a fine pointer, the sizes stay as they are.
|
|
54
58
|
|
|
55
59
|
## Accessibility
|
|
56
60
|
|
|
57
61
|
- The native control is a `<input type="checkbox" role="switch">`, so it is announced as a switch with an on/off state and is keyboard-operable (Space toggles).
|
|
58
62
|
- The native input stays in the accessibility tree and focusable; it is only hidden visually, with keyboard focus reflected onto the custom track via `:focus-visible`.
|
|
63
|
+
- The switch names its help message in `aria-describedby`: a screen reader reads it when the switch gets focus.
|
|
64
|
+
- The switch says whether the field is valid (`aria-invalid`).
|
|
65
|
+
- The error message is an alert (`role="alert"`) and part of the `aria-describedby` of the switch while it is shown: a screen reader announces it when it appears and reads it again when the switch gets focus.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import hostStyle from '../../styles/host.style.js';
|
|
2
|
+
import formControlStyle from '../../styles/form-control.style.js';
|
|
3
|
+
|
|
1
4
|
const css = String.raw;
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
const style = css`
|
|
4
7
|
el-switch-field {
|
|
5
|
-
display: block;
|
|
6
|
-
|
|
7
8
|
.field > label {
|
|
8
9
|
display: inline-flex;
|
|
9
10
|
align-items: center;
|
|
@@ -83,16 +84,15 @@ export default css`
|
|
|
83
84
|
opacity: 0.5;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
.error-message {
|
|
95
|
-
color: var(--el-color-danger, inherit);
|
|
87
|
+
/* Touch screens: the label is the hit area and at least --el-touch-target in both
|
|
88
|
+
directions. Without the token the sizes stay as they are. */
|
|
89
|
+
@media (any-pointer: coarse) {
|
|
90
|
+
.field > label {
|
|
91
|
+
min-width: var(--el-touch-target, auto);
|
|
92
|
+
min-height: var(--el-touch-target, auto);
|
|
93
|
+
}
|
|
96
94
|
}
|
|
97
95
|
}
|
|
98
96
|
`;
|
|
97
|
+
|
|
98
|
+
export default [hostStyle('el-switch-field'), formControlStyle('el-switch-field'), style].join('\n');
|
|
@@ -12,6 +12,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
12
12
|
|
|
13
13
|
## Unreleased
|
|
14
14
|
|
|
15
|
+
## [0.3.0] - 2026-11-17
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Keyboard support: the arrow keys move to the next and the previous link and select it, Home and End go to the first and the last one. Disabled links are skipped, and the arrow keys wrap around. Before, a tab could only be changed with a click. ([#97](https://github.com/webtides/element-library/issues/97))
|
|
20
|
+
- `orientation` (`'horizontal'` by default, or `'vertical'`): which arrow keys move between the links, left and right or up and down. ([#97](https://github.com/webtides/element-library/issues/97))
|
|
21
|
+
- The group tells assistive technology what its parts are: the selected link has `aria-selected="true"` and is the only link in the tab order (roving `tabindex`), every panel is labelled by its link (`aria-labelledby`; a link without an `id` gets one), and the element around the links gets `role="tablist"` and `aria-orientation`, unless the page gave it another role. ([#97](https://github.com/webtides/element-library/issues/97))
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Put the links into an element of their own (for example a `<div>`), so that the group can make it the `tablist`. Links that are direct children of the group still work, with the keyboard too, but have no `tablist` around them, which axe reports (`aria-required-parent`). The group cannot be the list itself, because it holds the panels as well. ([#97](https://github.com/webtides/element-library/issues/97))
|
|
26
|
+
- The group no longer sets the `active` state on its links; it sets `aria-selected`, and `el-tab-link` takes its state from that. Nothing changes for `el-tab-link`. An element of your own that is used as a link (`link-selector`) no longer gets `:state(active)` from the group: style it with `[aria-selected='true']`. Before, such an element had to be an element-js element, any other made the group throw; now any element can be a link. ([#99](https://github.com/webtides/element-library/issues/99))
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- The group no longer throws when it connects before `el-tab-link` is defined (`TypeError: Cannot read properties of undefined (reading 'states')`), and the first selection reaches the links all the same. That order comes up with lazy definition, where each tag is loaded by itself. The group only writes attributes and styles now, which a link or a panel takes whether its tag is defined or not. ([#99](https://github.com/webtides/element-library/issues/99))
|
|
31
|
+
- With no `selected` and panels that are not defined yet, the first panel is selected. The group read the `name` property, which a panel only has once it is defined, so every panel stayed hidden; it reads the attribute now. ([#99](https://github.com/webtides/element-library/issues/99))
|
|
32
|
+
- Links and panels that are added to the group later are taken in: they get their states, a new panel is labelled by its link, and a group that had no panel at first selects the first one that comes. Before, the group looked for its parts once, when it connected. ([#99](https://github.com/webtides/element-library/issues/99))
|
|
33
|
+
|
|
15
34
|
## [0.1.0] - 2026-06-03
|
|
16
35
|
|
|
17
36
|
### Changed
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
import { StyledElement, defineElement } from '@webtides/element-js';
|
|
2
2
|
import style from './tab-group.style.js';
|
|
3
3
|
|
|
4
|
+
let tabLinkIds = 0;
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Container that pairs `<el-tab-link>` children with `<el-tab-panel>` children and shows
|
|
6
8
|
* one panel at a time. Listens for `tab-select` events bubbled from `<el-tab-link>` and
|
|
7
9
|
* mirrors the active selection onto the `selected` attribute (reflected).
|
|
8
10
|
*
|
|
11
|
+
* The group wires the tabs for assistive technology and the keyboard: the selected link has
|
|
12
|
+
* `aria-selected="true"` and is the only one in the tab order, every panel is labelled by its
|
|
13
|
+
* link, and the arrow keys, Home and End move between the links that are not disabled and select
|
|
14
|
+
* the one they land on. The element around the links becomes the `tablist`, so put the links
|
|
15
|
+
* into an element of their own.
|
|
16
|
+
*
|
|
17
|
+
* The links and panels need not be defined, or be there, when the group connects: it marks the
|
|
18
|
+
* selection with attributes and styles, and takes in parts that are added later.
|
|
19
|
+
*
|
|
9
20
|
* @element el-tab-group
|
|
10
21
|
*
|
|
11
22
|
* @slot - Default slot containing `<el-tab-link>` and `<el-tab-panel>` children.
|
|
12
23
|
*
|
|
13
24
|
* @property {string | undefined} selected - Name of the currently selected tab. Matches a
|
|
14
25
|
* `<el-tab-panel>`'s `name`. Reflected to the `selected` attribute.
|
|
26
|
+
* @property {'horizontal' | 'vertical'} orientation - Direction of the links: the left and right
|
|
27
|
+
* arrow keys move between them, or the up and down keys when `'vertical'`. Default
|
|
28
|
+
* `'horizontal'`.
|
|
15
29
|
* @property {string} linkSelector - Selector used to find tab link children.
|
|
16
30
|
* @property {string} panelSelector - Selector used to find tab panel children.
|
|
17
31
|
*/
|
|
@@ -20,6 +34,8 @@ export default class TabGroup extends StyledElement {
|
|
|
20
34
|
tabLinks = [];
|
|
21
35
|
/** @private */
|
|
22
36
|
tabPanels = [];
|
|
37
|
+
/** @private */
|
|
38
|
+
_tabsObserver = null;
|
|
23
39
|
|
|
24
40
|
constructor() {
|
|
25
41
|
super({ styles: [style], propertyOptions: { selected: { reflect: true } } });
|
|
@@ -28,6 +44,7 @@ export default class TabGroup extends StyledElement {
|
|
|
28
44
|
properties() {
|
|
29
45
|
return {
|
|
30
46
|
selected: undefined,
|
|
47
|
+
orientation: 'horizontal',
|
|
31
48
|
linkSelector: 'el-tab-link',
|
|
32
49
|
panelSelector: 'el-tab-panel',
|
|
33
50
|
};
|
|
@@ -38,22 +55,51 @@ export default class TabGroup extends StyledElement {
|
|
|
38
55
|
selected: () => {
|
|
39
56
|
this.updateSelection();
|
|
40
57
|
},
|
|
58
|
+
orientation: () => {
|
|
59
|
+
this._syncTabList();
|
|
60
|
+
},
|
|
41
61
|
};
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
connected() {
|
|
65
|
+
this._syncTabs();
|
|
66
|
+
|
|
67
|
+
// Links and panels that come later: added by the page or a framework, or not parsed yet
|
|
68
|
+
// when the group connected.
|
|
69
|
+
this._tabsObserver = new MutationObserver(() => {
|
|
70
|
+
const same = (now, before) => now.length === before.length && [...now].every((n, i) => n === before[i]);
|
|
71
|
+
if (same(this.queryTabLinks(), this.tabLinks) && same(this.queryTabPanels(), this.tabPanels)) return;
|
|
72
|
+
this._syncTabs();
|
|
73
|
+
});
|
|
74
|
+
this._tabsObserver.observe(this, { childList: true, subtree: true });
|
|
75
|
+
|
|
76
|
+
// this.setAttribute('cloak', 'false');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
disconnected() {
|
|
80
|
+
this._tabsObserver?.disconnect();
|
|
81
|
+
this._tabsObserver = null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Finds the links and panels and brings them in line with the selection. Everything the group
|
|
86
|
+
* tells them is an attribute or a style, so it reaches a link or a panel whose tag is not
|
|
87
|
+
* defined yet as well.
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
_syncTabs() {
|
|
45
91
|
this.tabLinks = this.queryTabLinks();
|
|
46
92
|
this.tabPanels = this.queryTabPanels();
|
|
47
93
|
|
|
48
94
|
// select first tab if none was selected declarative
|
|
49
95
|
if (!this.selected && this.tabPanels.length > 0) {
|
|
50
96
|
const firstPanel = this.tabPanels[0];
|
|
51
|
-
|
|
97
|
+
// The attribute is there before the panel is defined, the property is not.
|
|
98
|
+
this.selectTab(firstPanel.getAttribute('name') ?? firstPanel.name);
|
|
52
99
|
}
|
|
53
100
|
|
|
54
101
|
this.updateSelection();
|
|
55
|
-
|
|
56
|
-
// this.setAttribute('cloak', 'false');
|
|
102
|
+
this._syncTabList();
|
|
57
103
|
}
|
|
58
104
|
|
|
59
105
|
events() {
|
|
@@ -63,6 +109,9 @@ export default class TabGroup extends StyledElement {
|
|
|
63
109
|
const { selected } = event.detail;
|
|
64
110
|
this.selected = selected;
|
|
65
111
|
},
|
|
112
|
+
keydown: (event) => {
|
|
113
|
+
this._onKeydown(event);
|
|
114
|
+
},
|
|
66
115
|
},
|
|
67
116
|
};
|
|
68
117
|
}
|
|
@@ -78,21 +127,84 @@ export default class TabGroup extends StyledElement {
|
|
|
78
127
|
|
|
79
128
|
/** @private */
|
|
80
129
|
updateSelection() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
130
|
+
const tabLinks = [...this.tabLinks];
|
|
131
|
+
// The one link in the tab order: the selected one, or the first that can be used.
|
|
132
|
+
const tabStop =
|
|
133
|
+
tabLinks.find((tabLink) => tabLink.getAttribute('for') === this.selected) ??
|
|
134
|
+
tabLinks.find((tabLink) => !tabLink.hasAttribute('disabled'));
|
|
135
|
+
|
|
136
|
+
for (const tabLink of tabLinks) {
|
|
137
|
+
const isSelected = tabLink.getAttribute('for') === this.selected;
|
|
138
|
+
// An el-tab-link shows its `active` state from this attribute.
|
|
139
|
+
tabLink.setAttribute('aria-selected', isSelected ? 'true' : 'false');
|
|
140
|
+
tabLink.setAttribute('tabindex', tabLink === tabStop ? '0' : '-1');
|
|
88
141
|
}
|
|
89
142
|
|
|
90
143
|
for (const tabPanel of this.tabPanels) {
|
|
91
144
|
const panelName = tabPanel.getAttribute('name');
|
|
92
145
|
tabPanel.style['display'] = panelName === this.selected ? 'block' : 'none';
|
|
146
|
+
|
|
147
|
+
const tabLink = tabLinks.find((link) => link.getAttribute('for') === panelName);
|
|
148
|
+
if (tabLink) {
|
|
149
|
+
if (!tabLink.id) tabLink.id = `el-tab-link-${++tabLinkIds}`;
|
|
150
|
+
tabPanel.setAttribute('aria-labelledby', tabLink.id);
|
|
151
|
+
}
|
|
93
152
|
}
|
|
94
153
|
}
|
|
95
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Makes the element around the links the `tablist` and tells it the orientation. Links that
|
|
157
|
+
* are direct children of the group have no such element: the group cannot be the list itself,
|
|
158
|
+
* because it holds the panels as well.
|
|
159
|
+
* @private
|
|
160
|
+
*/
|
|
161
|
+
_syncTabList() {
|
|
162
|
+
const tabLinks = [...this.tabLinks];
|
|
163
|
+
const tabList = tabLinks[0]?.parentElement;
|
|
164
|
+
if (!tabList || tabList === this || tabLinks.some((tabLink) => tabLink.parentElement !== tabList)) return;
|
|
165
|
+
|
|
166
|
+
if (!tabList.hasAttribute('role')) tabList.setAttribute('role', 'tablist');
|
|
167
|
+
if (tabList.getAttribute('role') === 'tablist') tabList.setAttribute('aria-orientation', this.orientation);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The arrow keys of the orientation, Home and End move the focus to another link and select
|
|
172
|
+
* it. Disabled links are skipped, and the arrow keys wrap around.
|
|
173
|
+
* @private
|
|
174
|
+
* @param {KeyboardEvent} event
|
|
175
|
+
*/
|
|
176
|
+
_onKeydown(event) {
|
|
177
|
+
const current = event.target.closest(this.linkSelector);
|
|
178
|
+
if (!current || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
179
|
+
|
|
180
|
+
const tabLinks = [...this.queryTabLinks()];
|
|
181
|
+
const enabled = tabLinks.filter((tabLink) => !tabLink.hasAttribute('disabled'));
|
|
182
|
+
if (enabled.length === 0) return;
|
|
183
|
+
|
|
184
|
+
const step = (direction) => {
|
|
185
|
+
let index = tabLinks.indexOf(current);
|
|
186
|
+
do {
|
|
187
|
+
index = (index + direction + tabLinks.length) % tabLinks.length;
|
|
188
|
+
} while (tabLinks[index].hasAttribute('disabled'));
|
|
189
|
+
return tabLinks[index];
|
|
190
|
+
};
|
|
191
|
+
const [previousKey, nextKey] =
|
|
192
|
+
this.orientation === 'vertical' ? ['ArrowUp', 'ArrowDown'] : ['ArrowLeft', 'ArrowRight'];
|
|
193
|
+
const targets = {
|
|
194
|
+
[previousKey]: () => step(-1),
|
|
195
|
+
[nextKey]: () => step(1),
|
|
196
|
+
Home: () => enabled[0],
|
|
197
|
+
End: () => enabled[enabled.length - 1],
|
|
198
|
+
};
|
|
199
|
+
if (!Object.hasOwn(targets, event.key)) return;
|
|
200
|
+
|
|
201
|
+
// The arrow keys, Home and End would scroll the page.
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
const target = targets[event.key]();
|
|
204
|
+
target.focus();
|
|
205
|
+
target.click();
|
|
206
|
+
}
|
|
207
|
+
|
|
96
208
|
/** @private */
|
|
97
209
|
queryTabLinks() {
|
|
98
210
|
return this.querySelectorAll(this.linkSelector);
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
`tab-group` is a container that pairs `<el-tab-link>` children with `<el-tab-panel>` children and shows one panel at a time. It listens for `tab-select` events bubbled from `<el-tab-link>` and mirrors the active selection onto the `selected` attribute (reflected). When no tab is selected declaratively, the first panel is shown.
|
|
4
4
|
|
|
5
|
+
The group also wires the tabs for the keyboard and for screen readers, see [Accessibility](#accessibility). For that, the links belong into an element of their own, as in the example below: the group makes it the `tablist`.
|
|
6
|
+
|
|
5
7
|
## How to use
|
|
6
8
|
|
|
7
9
|
#### Install
|
|
@@ -18,10 +20,12 @@ import '@webtides/element-library/tab-group/define';
|
|
|
18
20
|
|
|
19
21
|
```html
|
|
20
22
|
<el-tab-group selected="general">
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
<div>
|
|
24
|
+
<el-tab-link for="general">General</el-tab-link>
|
|
25
|
+
<el-tab-link for="custom">Custom</el-tab-link>
|
|
26
|
+
<el-tab-link for="advanced">Advanced</el-tab-link>
|
|
27
|
+
<el-tab-link for="disabled" disabled>Disabled</el-tab-link>
|
|
28
|
+
</div>
|
|
25
29
|
|
|
26
30
|
<el-tab-panel name="general">This is the general tab panel.</el-tab-panel>
|
|
27
31
|
<el-tab-panel name="custom">This is the custom tab panel.</el-tab-panel>
|
|
@@ -37,6 +41,7 @@ import '@webtides/element-library/tab-group/define';
|
|
|
37
41
|
| Name | Type | Default | Description |
|
|
38
42
|
| --- | --- | --- | --- |
|
|
39
43
|
| `selected` | `string \| undefined` | `undefined` | Name of the currently selected tab. Matches an `<el-tab-panel>`'s `name`. Reflected to the `selected` attribute. |
|
|
44
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Direction of the links: the left and right arrow keys move between them, or the up and down keys when `'vertical'`. |
|
|
40
45
|
| `linkSelector` | `string` | `'el-tab-link'` | Selector used to find tab link children. |
|
|
41
46
|
| `panelSelector` | `string` | `'el-tab-panel'` | Selector used to find tab panel children. |
|
|
42
47
|
|
|
@@ -59,3 +64,19 @@ _None_
|
|
|
59
64
|
| Name | Description |
|
|
60
65
|
| ----------- | -------------------------------------------------- |
|
|
61
66
|
| _(default)_ | The `<el-tab-link>` and `<el-tab-panel>` children. |
|
|
67
|
+
|
|
68
|
+
## Lazy definition and parts that come later
|
|
69
|
+
|
|
70
|
+
The group does not need its links and panels to be defined, or to be there, when it starts.
|
|
71
|
+
|
|
72
|
+
- `el-tab-group`, `el-tab-link` and `el-tab-panel` can be defined in any order, for example each by itself when a loader finds its tag on the page. The group marks the selection with attributes and styles, which reach a link or a panel before its tag is defined; `el-tab-link` shows its `active` state from `aria-selected` as soon as it is defined.
|
|
73
|
+
- Links and panels that are added to the group later are taken in. A group that has no panel at first selects the first one that comes, unless `selected` is set.
|
|
74
|
+
- An element of your own that is used as a link (`link-selector`) gets `aria-selected` and `tabindex` from the group as well. The `active` state is set by `el-tab-link` only; style another element with `[aria-selected='true']`.
|
|
75
|
+
|
|
76
|
+
## Accessibility
|
|
77
|
+
|
|
78
|
+
- The element around the links gets `role="tablist"` and `aria-orientation`, unless the page gave it another role. Links that are direct children of the group have no such element; the group cannot be the list itself, because it holds the panels as well. Their keys and states work all the same, but a `tab` outside a `tablist` is not valid ARIA, and axe reports it (`aria-required-parent`).
|
|
79
|
+
- The selected link has `aria-selected="true"` and is the only link in the tab order (`tabindex="0"`, the others `-1`). The Tab key enters the links at the selected one and leaves them for the panel.
|
|
80
|
+
- The arrow keys move to the next and the previous link and select it: left and right, or up and down with `orientation="vertical"`. They wrap around at the ends. Home and End go to the first and the last link. Disabled links are skipped.
|
|
81
|
+
- Enter and Space select the focused link.
|
|
82
|
+
- Every panel is labelled by its link (`aria-labelledby`). A link without an `id` gets one.
|
|
@@ -12,6 +12,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
12
12
|
|
|
13
13
|
## Unreleased
|
|
14
14
|
|
|
15
|
+
## [0.3.0] - 2026-11-17
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- The link is a tab: it has `role="tab"`, and Enter and Space select it like a click does. In an `el-tab-group` it carries `aria-selected`, and only the selected link is in the tab order. Before, it had no role and reacted to a click only. A role the page sets itself is kept. ([#97](https://github.com/webtides/element-library/issues/97))
|
|
20
|
+
- A focus ring from the library's tokens (`--el-focus-ring-width`, `--el-color-focus-ring`, `--el-focus-ring-offset`) while the link has the keyboard focus. ([#97](https://github.com/webtides/element-library/issues/97))
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- On a touch screen (`@media (any-pointer: coarse)`) the tab is at least `--el-touch-target` wide and high (36 px high with the default theme before). Unchanged on a fine pointer and without the token.
|
|
25
|
+
- The link sets its `active` state itself, while it has `aria-selected="true"`. Before, the `el-tab-group` set the state from outside, which failed when the link was not defined yet. In a group nothing changes: the group keeps `aria-selected` up to date. A link outside a group is active while the page sets `aria-selected="true"` on it. ([#99](https://github.com/webtides/element-library/issues/99))
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- A disabled link is exposed as disabled: the element sets `aria-disabled="true"` on itself while it has the `disabled` attribute. Before, it was only greyed out, and axe counted the reduced contrast as a failure. ([#94](https://github.com/webtides/element-library/issues/94))
|
|
30
|
+
|
|
15
31
|
## [0.1.0] - 2026-06-03
|
|
16
32
|
|
|
17
33
|
### Changed
|
|
@@ -2,29 +2,65 @@ import { StyledElement, defineElement } from '@webtides/element-js';
|
|
|
2
2
|
import style from './tab-link.style.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* `detail.selected` set to its `for` attribute when clicked
|
|
7
|
-
* inside `<el-tab-group
|
|
5
|
+
* The tab of a `<el-tab-panel>` (`role="tab"`). Dispatches a bubbling `tab-select` event with
|
|
6
|
+
* `detail.selected` set to its `for` attribute when it is clicked or when Enter or Space is
|
|
7
|
+
* pressed on it (unless `disabled`). Used inside `<el-tab-group>`, which marks the selected
|
|
8
|
+
* link (`aria-selected`), keeps it in the tab order and moves between the links with the arrow keys.
|
|
8
9
|
*
|
|
9
10
|
* @element el-tab-link
|
|
10
11
|
*
|
|
11
|
-
* @fires {CustomEvent<{ selected: string }>} tab-select - Fired on click
|
|
12
|
-
* is the `for` value, used by `<el-tab-group>` to activate the matching
|
|
13
|
-
* and crosses shadow boundaries.
|
|
12
|
+
* @fires {CustomEvent<{ selected: string }>} tab-select - Fired on click and on Enter or Space.
|
|
13
|
+
* `detail.selected` is the `for` value, used by `<el-tab-group>` to activate the matching
|
|
14
|
+
* panel. Bubbles and crosses shadow boundaries.
|
|
14
15
|
*
|
|
15
16
|
* @slot - Default slot for the tab label content.
|
|
16
17
|
*
|
|
17
|
-
* @cssstate active - Set
|
|
18
|
-
*
|
|
18
|
+
* @cssstate active - Set while the link is selected (`aria-selected="true"`), which the parent
|
|
19
|
+
* `<el-tab-group>` keeps up to date. Style with `el-tab-link:state(active) { … }`.
|
|
19
20
|
*
|
|
20
21
|
* @property {string | undefined} for - Name of the panel this link activates (matches a
|
|
21
22
|
* `<el-tab-panel>`'s `name`).
|
|
23
|
+
* @attribute {boolean} disabled - When present, the link does not dispatch `tab-select` on click
|
|
24
|
+
* and is exposed as disabled (`aria-disabled="true"`).
|
|
25
|
+
* @attribute {'true'|'false'} aria-selected - Whether the link is the selected one. The parent
|
|
26
|
+
* `<el-tab-group>` writes it, and the `active` state follows it.
|
|
22
27
|
*/
|
|
23
28
|
export default class TabLink extends StyledElement {
|
|
29
|
+
static observedAttributes = ['disabled', 'aria-selected'];
|
|
30
|
+
|
|
24
31
|
constructor() {
|
|
25
32
|
super({ styles: [style] });
|
|
26
33
|
}
|
|
27
34
|
|
|
35
|
+
attributeChangedCallback() {
|
|
36
|
+
this._syncDisabled();
|
|
37
|
+
this._syncActive();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
connected() {
|
|
41
|
+
if (!this.hasAttribute('role')) this.setAttribute('role', 'tab');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Tells assistive technology what the `disabled` attribute says.
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
_syncDisabled() {
|
|
49
|
+
if (this.hasAttribute('disabled')) this.setAttribute('aria-disabled', 'true');
|
|
50
|
+
else this.removeAttribute('aria-disabled');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The `active` state follows `aria-selected`. The group only writes the attribute, which it
|
|
55
|
+
* can do before this element is defined: the browser reports the attributes that are already
|
|
56
|
+
* there when it upgrades the element.
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
_syncActive() {
|
|
60
|
+
if (this.getAttribute('aria-selected') === 'true') this._internals.states.add('active');
|
|
61
|
+
else this._internals.states.delete('active');
|
|
62
|
+
}
|
|
63
|
+
|
|
28
64
|
properties() {
|
|
29
65
|
return {
|
|
30
66
|
for: undefined,
|
|
@@ -40,6 +76,13 @@ export default class TabLink extends StyledElement {
|
|
|
40
76
|
if (this.hasAttribute('disabled')) return;
|
|
41
77
|
this.dispatch('tab-select', { selected: this.for });
|
|
42
78
|
},
|
|
79
|
+
keydown: (event) => {
|
|
80
|
+
// Keys pressed on something inside the link belong to that element.
|
|
81
|
+
if (event.target !== this || (event.key !== 'Enter' && event.key !== ' ')) return;
|
|
82
|
+
// Space would scroll the page.
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
this.click();
|
|
85
|
+
},
|
|
43
86
|
},
|
|
44
87
|
};
|
|
45
88
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabLink
|
|
2
2
|
|
|
3
|
-
`tab-link` is
|
|
3
|
+
`tab-link` is the tab of a `<el-tab-panel>` (`role="tab"`). It dispatches a bubbling `tab-select` event with `detail.selected` set to its `for` attribute when it is clicked or when Enter or Space is pressed on it (unless `disabled`). It is used inside a `<el-tab-group>`, which marks the selected link, keeps it in the tab order and moves between the links with the arrow keys; see the [Accessibility section of `tab-group`](../tab-group/tab-group.readme.md#accessibility).
|
|
4
4
|
|
|
5
5
|
## How to use
|
|
6
6
|
|
|
@@ -18,10 +18,12 @@ import '@webtides/element-library/tab-link/define';
|
|
|
18
18
|
|
|
19
19
|
```html
|
|
20
20
|
<el-tab-group selected="general">
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
<div>
|
|
22
|
+
<el-tab-link for="general">General</el-tab-link>
|
|
23
|
+
<el-tab-link for="custom">Custom</el-tab-link>
|
|
24
|
+
<el-tab-link for="advanced">Advanced</el-tab-link>
|
|
25
|
+
<el-tab-link for="disabled" disabled>Disabled</el-tab-link>
|
|
26
|
+
</div>
|
|
25
27
|
|
|
26
28
|
<el-tab-panel name="general">This is the general tab panel.</el-tab-panel>
|
|
27
29
|
<el-tab-panel name="custom">This is the custom tab panel.</el-tab-panel>
|
|
@@ -37,7 +39,7 @@ import '@webtides/element-library/tab-link/define';
|
|
|
37
39
|
| Name | Type | Default | Description |
|
|
38
40
|
| --- | --- | --- | --- |
|
|
39
41
|
| `for` | `string \| undefined` | `undefined` | Name of the panel this link activates (matches an `<el-tab-panel>`'s `name`). |
|
|
40
|
-
| `disabled` | `boolean` | `false` | When present, the link does not dispatch `tab-select` on click. |
|
|
42
|
+
| `disabled` | `boolean` | `false` | When present, the link does not dispatch `tab-select` on click and is exposed as disabled (`aria-disabled="true"`). |
|
|
41
43
|
|
|
42
44
|
#### Methods
|
|
43
45
|
|
|
@@ -47,17 +49,21 @@ _None_
|
|
|
47
49
|
|
|
48
50
|
| Name | Detail | Description |
|
|
49
51
|
| --- | --- | --- |
|
|
50
|
-
| `tab-select` | `{ selected: string }` | Fired on click. `detail.selected` is the `for` value, used by `<el-tab-group>` to activate the matching panel. Bubbles and crosses shadow boundaries. |
|
|
52
|
+
| `tab-select` | `{ selected: string }` | Fired on click and on Enter or Space. `detail.selected` is the `for` value, used by `<el-tab-group>` to activate the matching panel. Bubbles and crosses shadow boundaries. |
|
|
51
53
|
|
|
52
54
|
#### CSS Custom Properties
|
|
53
55
|
|
|
54
56
|
This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-accent`, `--el-color-fg`, `--el-border-width`). Skin it by setting these via a theme — see the Storybook _Docs / Theming_ page.
|
|
55
57
|
|
|
58
|
+
On a touch screen (`@media (any-pointer: coarse)`) the tab is at least `--el-touch-target` wide and high. Without that token, and on a fine pointer, the sizes stay as they are.
|
|
59
|
+
|
|
60
|
+
A link that has the keyboard focus shows the focus ring of the library (`--el-focus-ring-width`, `--el-color-focus-ring`, `--el-focus-ring-offset`).
|
|
61
|
+
|
|
56
62
|
#### CSS States
|
|
57
63
|
|
|
58
64
|
| Name | Description |
|
|
59
65
|
| --- | --- |
|
|
60
|
-
| `active` | Set
|
|
66
|
+
| `active` | Set while the link is selected (`aria-selected="true"`), which the parent `<el-tab-group>` keeps up to date. Style with `el-tab-link:state(active) { … }`. |
|
|
61
67
|
|
|
62
68
|
#### Slots
|
|
63
69
|
|
|
@@ -18,6 +18,11 @@ export default css`
|
|
|
18
18
|
color: var(--el-color-fg, inherit);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
&:focus-visible {
|
|
22
|
+
outline: var(--el-focus-ring-width, 2px) solid var(--el-color-focus-ring, currentColor);
|
|
23
|
+
outline-offset: var(--el-focus-ring-offset, 2px);
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
&:state(active) {
|
|
22
27
|
color: var(--el-color-fg, inherit);
|
|
23
28
|
background: var(--el-color-bg-muted, transparent);
|
|
@@ -28,5 +33,13 @@ export default css`
|
|
|
28
33
|
opacity: 0.5;
|
|
29
34
|
cursor: not-allowed;
|
|
30
35
|
}
|
|
36
|
+
|
|
37
|
+
/* Touch screens: the tab is at least --el-touch-target in both directions. The block
|
|
38
|
+
padding grows around one line of text, so the label stays centered; the minimum width
|
|
39
|
+
leaves out the inline padding, which comes on top. Without the token the sizes stay as they are. */
|
|
40
|
+
@media (any-pointer: coarse) {
|
|
41
|
+
min-width: calc(var(--el-touch-target, 0px) - 2 * var(--el-space-3, 0px));
|
|
42
|
+
padding-block: max(var(--el-space-2, 0px), calc((var(--el-touch-target, 0px) - 1lh) / 2));
|
|
43
|
+
}
|
|
31
44
|
}
|
|
32
45
|
`;
|
|
@@ -10,8 +10,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
10
10
|
Uncomment headings as needed.
|
|
11
11
|
-->
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.3.0] - 2026-11-17
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- The panel has `role="tabpanel"`, and its `el-tab-group` labels it by its link (`aria-labelledby`). A role the page sets itself is kept. ([#97](https://github.com/webtides/element-library/issues/97))
|
|
20
|
+
|
|
15
21
|
<!-- ### Changed -->
|
|
16
22
|
<!-- ### Removed -->
|
|
17
23
|
<!-- ### Fixed -->
|
|
@@ -2,9 +2,9 @@ import { StyledElement, defineElement } from '@webtides/element-js';
|
|
|
2
2
|
import style from './tab-panel.style.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Content panel paired with an `<el-tab-link>` by `name
|
|
6
|
-
* parent `<el-tab-group>`, which toggles `display: block / none` based on the
|
|
7
|
-
* selection.
|
|
5
|
+
* Content panel paired with an `<el-tab-link>` by `name` (`role="tabpanel"`). Visibility is
|
|
6
|
+
* driven by the parent `<el-tab-group>`, which toggles `display: block / none` based on the
|
|
7
|
+
* active selection and labels the panel by its link (`aria-labelledby`).
|
|
8
8
|
*
|
|
9
9
|
* @element el-tab-panel
|
|
10
10
|
*
|
|
@@ -23,6 +23,10 @@ export default class TabPanel extends StyledElement {
|
|
|
23
23
|
name: undefined,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
connected() {
|
|
28
|
+
if (!this.hasAttribute('role')) this.setAttribute('role', 'tabpanel');
|
|
29
|
+
}
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
export function define() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabPanel
|
|
2
2
|
|
|
3
|
-
`tab-panel` contains the content associated with a tab. It is paired with an `<el-tab-link>` by `name`, and its visibility is driven by the parent `<el-tab-group>`, which toggles `display: block / none` based on the active selection.
|
|
3
|
+
`tab-panel` contains the content associated with a tab (`role="tabpanel"`). It is paired with an `<el-tab-link>` by `name`, and its visibility is driven by the parent `<el-tab-group>`, which toggles `display: block / none` based on the active selection and labels the panel by its link (`aria-labelledby`).
|
|
4
4
|
|
|
5
5
|
## How to use
|
|
6
6
|
|
|
@@ -18,10 +18,12 @@ import '@webtides/element-library/tab-panel/define';
|
|
|
18
18
|
|
|
19
19
|
```html
|
|
20
20
|
<el-tab-group selected="general">
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
<div>
|
|
22
|
+
<el-tab-link for="general">General</el-tab-link>
|
|
23
|
+
<el-tab-link for="custom">Custom</el-tab-link>
|
|
24
|
+
<el-tab-link for="advanced">Advanced</el-tab-link>
|
|
25
|
+
<el-tab-link for="disabled" disabled>Disabled</el-tab-link>
|
|
26
|
+
</div>
|
|
25
27
|
|
|
26
28
|
<el-tab-panel name="general">This is the general tab panel.</el-tab-panel>
|
|
27
29
|
<el-tab-panel name="custom">This is the custom tab panel.</el-tab-panel>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
When your PR touches this component, add an entry under Unreleased and
|
|
9
|
+
mirror it (prefixed with the component name) in root CHANGELOG.md.
|
|
10
|
+
Uncomment headings as needed.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.3.0] - 2026-11-17
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Initial `el-tag`: a label for one of several things that belong to something, a keyword or a filter that is set. ([#75](https://github.com/webtides/element-library/issues/75))
|
|
20
|
+
- `variant` (`neutral`, `brand`, `success`, `warning`, `danger`), `appearance` (`filled`, `outlined`, `plain`) and `size` (`small`, `medium`, `large`), the library's shared vocabulary, all reflected to attributes of the same name. A tag is 0.7 times as high as a control of the same size, so that it fits into a field.
|
|
21
|
+
- `pill` for fully rounded ends.
|
|
22
|
+
- `removable` renders a remove button that fires `tag-remove`. The tag does not remove itself; the page decides what removing means. The button is a native button in the tab order, named with `remove-label` ("Remove" by default) and the text of the tag: "Remove TypeScript".
|
|
23
|
+
- On a touch screen (`@media (any-pointer: coarse)`) the remove button is at least `--el-touch-target` wide and high.
|
|
24
|
+
- A tag is never wider than the place it stands in: a text that does not fit is cut off with an ellipsis.
|