@webtides/element-library 0.2.0 → 0.3.1
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 +399 -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 +16676 -3457
- 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 +44 -1
- package/src/components/button/button.js +338 -29
- package/src/components/button/button.readme.md +138 -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 +25 -0
- package/src/components/checkbox-field/checkbox-field.js +32 -11
- 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 +22 -0
- package/src/components/switch-field/switch-field.js +24 -10
- 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 +158 -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
|
@@ -18,7 +18,14 @@ const DEFAULT_OPTIONS = {
|
|
|
18
18
|
/**
|
|
19
19
|
* Carousel/slider component backed by Glide.js. Direct children of the host element are
|
|
20
20
|
* treated as slides; the component renders Glide's controls (navigation arrows and bullet
|
|
21
|
-
* pager) inside the shadow DOM around them.
|
|
21
|
+
* pager) inside the shadow DOM around them. A bullet is a button named by `dotLabel` and the
|
|
22
|
+
* number of its slide, and `aria-pressed` marks the one of the slide that shows.
|
|
23
|
+
*
|
|
24
|
+
* The children of the element stay what the page wrote. The copies of the first and the last
|
|
25
|
+
* slides that Glide needs for looping are kept in the shadow root, so a framework can hydrate
|
|
26
|
+
* server-rendered slides. Rules of the page's style sheets reach those copies as far as they
|
|
27
|
+
* select them without an ancestor outside the carousel (a class on the slide does, `el-carousel >
|
|
28
|
+
* .slide` does not).
|
|
22
29
|
*
|
|
23
30
|
* @element el-carousel
|
|
24
31
|
*
|
|
@@ -26,9 +33,11 @@ const DEFAULT_OPTIONS = {
|
|
|
26
33
|
* `detail` is the new active slide index.
|
|
27
34
|
*
|
|
28
35
|
* @slot - Default slot. Direct children become slides (unless they have a `slot`
|
|
29
|
-
* attribute
|
|
30
|
-
* @slot arrow-left - Content of the "previous" navigation button.
|
|
31
|
-
*
|
|
36
|
+
* attribute).
|
|
37
|
+
* @slot arrow-left - Content of the "previous" navigation button; it names the button. Left
|
|
38
|
+
* empty, the button shows an arrow head and is named "Previous slide" for screen readers.
|
|
39
|
+
* @slot arrow-right - Content of the "next" navigation button; it names the button. Left empty,
|
|
40
|
+
* the button shows an arrow head and is named "Next slide" for screen readers.
|
|
32
41
|
*
|
|
33
42
|
* @csspart track - The Glide track wrapper.
|
|
34
43
|
* @csspart slides - The slides container.
|
|
@@ -47,6 +56,8 @@ const DEFAULT_OPTIONS = {
|
|
|
47
56
|
* plain list (useful for SSR or feature-flagging the carousel off).
|
|
48
57
|
* @property {string} slidePrefix - Prefix used when generating per-slide identifiers.
|
|
49
58
|
* @property {boolean} bullets - Whether to render the bullet pager.
|
|
59
|
+
* @property {string} dotLabel - Accessible label of a bullet, followed by the number of its slide
|
|
60
|
+
* (`'Go to slide 2'`). Default `'Go to slide'`.
|
|
50
61
|
* @property {boolean} arrows - Whether to render the previous/next navigation arrows.
|
|
51
62
|
*/
|
|
52
63
|
export default class Carousel extends TemplateElement {
|
|
@@ -81,6 +92,7 @@ export default class Carousel extends TemplateElement {
|
|
|
81
92
|
disabled: false,
|
|
82
93
|
slidePrefix: 'slide',
|
|
83
94
|
bullets: true,
|
|
95
|
+
dotLabel: 'Go to slide',
|
|
84
96
|
arrows: true,
|
|
85
97
|
};
|
|
86
98
|
}
|
|
@@ -105,9 +117,7 @@ export default class Carousel extends TemplateElement {
|
|
|
105
117
|
|
|
106
118
|
/** @private */
|
|
107
119
|
getUniqueChildren() {
|
|
108
|
-
return Array.from(this.children).filter(
|
|
109
|
-
(item) => !item.classList.contains('glide__slide--clone') && !item.hasAttribute('slot'),
|
|
110
|
-
);
|
|
120
|
+
return Array.from(this.children).filter((item) => !item.hasAttribute('slot'));
|
|
111
121
|
}
|
|
112
122
|
|
|
113
123
|
/** @private */
|
|
@@ -156,11 +166,10 @@ export default class Carousel extends TemplateElement {
|
|
|
156
166
|
updateBulletClasses() {
|
|
157
167
|
const bullets = Array.from(this.getRoot().querySelectorAll('.glide__bullet'));
|
|
158
168
|
bullets.forEach((bullet, index) => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
169
|
+
const selected = index === this.#glide.index;
|
|
170
|
+
bullet.part.toggle('selected-dot', selected);
|
|
171
|
+
// What the part says to the eye, for assistive technology.
|
|
172
|
+
bullet.setAttribute('aria-pressed', String(selected));
|
|
164
173
|
});
|
|
165
174
|
}
|
|
166
175
|
|
|
@@ -168,7 +177,17 @@ export default class Carousel extends TemplateElement {
|
|
|
168
177
|
renderBullets() {
|
|
169
178
|
let bullets = [];
|
|
170
179
|
for (let i = 0; i < this.#uniqueChildren.length; i++) {
|
|
171
|
-
|
|
180
|
+
// A button: the keyboard reaches it, and Enter and Space are the click Glide listens for.
|
|
181
|
+
bullets.push(html`
|
|
182
|
+
<button
|
|
183
|
+
type="button"
|
|
184
|
+
part="dot"
|
|
185
|
+
class="glide__bullet"
|
|
186
|
+
data-glide-dir="=${i}"
|
|
187
|
+
aria-label="${this.dotLabel} ${i + 1}"
|
|
188
|
+
aria-pressed="false"
|
|
189
|
+
></button>
|
|
190
|
+
`);
|
|
172
191
|
}
|
|
173
192
|
return bullets;
|
|
174
193
|
}
|
|
@@ -193,33 +212,63 @@ export default class Carousel extends TemplateElement {
|
|
|
193
212
|
${this._options.shadowRender ? html` <slot></slot> ` : this.renderSlides()}
|
|
194
213
|
</div>
|
|
195
214
|
</div>
|
|
196
|
-
${
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
215
|
+
${
|
|
216
|
+
this.arrows
|
|
217
|
+
? html`
|
|
218
|
+
<div part="arrows" class="glide__arrows" data-glide-el="controls">
|
|
219
|
+
<button
|
|
220
|
+
part="arrow arrow-left"
|
|
221
|
+
class="glide__arrow glide__arrow--left"
|
|
222
|
+
data-glide-dir="<"
|
|
223
|
+
>
|
|
224
|
+
<slot name="arrow-left">
|
|
225
|
+
<svg
|
|
226
|
+
viewBox="0 0 24 24"
|
|
227
|
+
fill="none"
|
|
228
|
+
stroke="currentColor"
|
|
229
|
+
stroke-width="2"
|
|
230
|
+
stroke-linecap="round"
|
|
231
|
+
stroke-linejoin="round"
|
|
232
|
+
aria-hidden="true"
|
|
233
|
+
>
|
|
234
|
+
<polyline points="15 18 9 12 15 6"></polyline>
|
|
235
|
+
</svg>
|
|
236
|
+
<span class="visually-hidden">Previous slide</span>
|
|
237
|
+
</slot>
|
|
238
|
+
</button>
|
|
239
|
+
<button
|
|
240
|
+
part="arrow arrow-right"
|
|
241
|
+
class="glide__arrow glide__arrow--right"
|
|
242
|
+
data-glide-dir=">"
|
|
243
|
+
>
|
|
244
|
+
<slot name="arrow-right">
|
|
245
|
+
<svg
|
|
246
|
+
viewBox="0 0 24 24"
|
|
247
|
+
fill="none"
|
|
248
|
+
stroke="currentColor"
|
|
249
|
+
stroke-width="2"
|
|
250
|
+
stroke-linecap="round"
|
|
251
|
+
stroke-linejoin="round"
|
|
252
|
+
aria-hidden="true"
|
|
253
|
+
>
|
|
254
|
+
<polyline points="9 18 15 12 9 6"></polyline>
|
|
255
|
+
</svg>
|
|
256
|
+
<span class="visually-hidden">Next slide</span>
|
|
257
|
+
</slot>
|
|
258
|
+
</button>
|
|
259
|
+
</div>
|
|
260
|
+
`
|
|
261
|
+
: ''
|
|
262
|
+
}
|
|
263
|
+
${
|
|
264
|
+
this.bullets
|
|
265
|
+
? html`
|
|
266
|
+
<div part="dots" class="glide__bullets" data-glide-el="controls[nav]">
|
|
267
|
+
${this.renderBullets()}
|
|
268
|
+
</div>
|
|
269
|
+
`
|
|
270
|
+
: ''
|
|
271
|
+
}
|
|
223
272
|
</div>
|
|
224
273
|
`;
|
|
225
274
|
}
|
|
@@ -35,6 +35,7 @@ import '@webtides/element-library/carousel/define';
|
|
|
35
35
|
| `disabled` | `boolean` | `false` | When `true`, Glide is not mounted and slides render as a plain list (useful for SSR or feature-flagging the carousel off). |
|
|
36
36
|
| `slidePrefix` | `string` | `'slide'` | Prefix used when generating per-slide identifiers. |
|
|
37
37
|
| `bullets` | `boolean` | `true` | Whether to render the bullet pager. |
|
|
38
|
+
| `dotLabel` | `string` | `'Go to slide'` | Accessible label of a bullet, followed by the number of its slide (`'Go to slide 2'`). Set it as `dot-label`. |
|
|
38
39
|
| `arrows` | `boolean` | `true` | Whether to render the previous/next navigation arrows. |
|
|
39
40
|
|
|
40
41
|
#### Methods
|
|
@@ -53,11 +54,11 @@ import '@webtides/element-library/carousel/define';
|
|
|
53
54
|
|
|
54
55
|
#### Slots
|
|
55
56
|
|
|
56
|
-
| Name
|
|
57
|
-
|
|
|
58
|
-
| _(default)_
|
|
59
|
-
| `arrow-left`
|
|
60
|
-
| `arrow-right` | Content of the "next" navigation button.
|
|
57
|
+
| Name | Description |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| _(default)_ | Direct children become slides (unless they have a `slot` attribute). |
|
|
60
|
+
| `arrow-left` | Content of the "previous" navigation button; it names the button. Left empty, the button shows an arrow head and is named "Previous slide" for screen readers. |
|
|
61
|
+
| `arrow-right` | Content of the "next" navigation button; it names the button. Left empty, the button shows an arrow head and is named "Next slide" for screen readers. |
|
|
61
62
|
|
|
62
63
|
#### CSS Parts
|
|
63
64
|
|
|
@@ -75,4 +76,36 @@ import '@webtides/element-library/carousel/define';
|
|
|
75
76
|
|
|
76
77
|
#### CSS Custom Properties
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
The arrows and the bullets have the look and the place of the shared style of the library, the same as in `el-slider`, and read the `--el-*` design tokens:
|
|
80
|
+
|
|
81
|
+
- **Arrows**: buttons on the track, in the middle of its height, `--el-space-2` in from its two sides. A square of `--el-control-height` with the surface `--el-color-bg`, the text colour `--el-color-fg`, a border of `--el-border-width` in `--el-color-border` and the radius `--el-radius-md`. Without a theme the surface and the text colour are the ones of the browser for the colour scheme (`Canvas`, `CanvasText`). The keyboard focus shows as a ring inside of the arrow (`--el-focus-ring-width`, `--el-color-focus-ring`, the text colour of the arrow without that token): around it, the ring would lie on the slide. An arrow that leads nowhere keeps its surface, and its sign fades.
|
|
82
|
+
- **Bullets**: a row under the track, in the middle, so that no bullet lies on a slide. A bullet is a ring of 10 px in `--el-color-fg-muted`, the one of the slide that shows a disc in `--el-color-accent`; without a theme both have the text colour of the page. A click counts in a square of 24 px around a bullet, and the bullets are that far apart. The keyboard focus of a bullet shows as a ring around it.
|
|
83
|
+
|
|
84
|
+
On a touch screen (`@media (any-pointer: coarse)`) the arrows are at least `--el-touch-target` wide and high. The bullets keep their size: each gets a hit area of `--el-touch-target` around it, the bullets move apart by as much, and their row wraps when it gets wider than the carousel. Without that token, and on a fine pointer, the sizes stay as they are.
|
|
85
|
+
|
|
86
|
+
A page reaches every one of them with `::part()`. Bullets that lie on the slides, over pictures for example, take one rule. Their colours are then for the page to choose, which knows what its slides show:
|
|
87
|
+
|
|
88
|
+
```css
|
|
89
|
+
el-carousel::part(dots) {
|
|
90
|
+
grid-area: 1 / 1;
|
|
91
|
+
align-self: end;
|
|
92
|
+
z-index: 1;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Accessibility
|
|
97
|
+
|
|
98
|
+
- The arrows are buttons named "Previous slide" and "Next slide", or by what is in their slots.
|
|
99
|
+
- Each bullet is a button named by `dot-label` and the number of its slide; `aria-pressed` marks the bullet of the slide that shows. Enter and Space go to the slide of the bullet that has the focus.
|
|
100
|
+
|
|
101
|
+
## Looping, and server-rendered slides
|
|
102
|
+
|
|
103
|
+
To loop, Glide shows copies of the first and the last slides beyond the two ends. The carousel keeps these copies in its shadow root. The children of the element stay exactly what the page wrote, so a framework can hydrate a server-rendered carousel whose slides come from a loop (`{#each}` in Svelte), also when the element has started before the framework does.
|
|
104
|
+
|
|
105
|
+
The copies are outside the page's DOM, which matters for their styles:
|
|
106
|
+
|
|
107
|
+
- A rule of the page's style sheets styles a copy when it selects the slide without an ancestor outside the carousel: a class on the slide (`.slide`, utility classes) or on something inside it works, `el-carousel > div` or `.gallery .slide` does not. Inherited values such as the text color and the font, and custom properties, reach the copies either way.
|
|
108
|
+
- The carousel hands the style sheets of the document to its shadow root (`adoptGlobalStyles` of element-js). Sheets that are added after the page has loaded are only picked up with `globalThis.elementJsConfig = { observeGlobalStyles: true }`.
|
|
109
|
+
- An `id` or a form control inside a slide exists once more in each copy, in the shadow root, where it does not clash with the page.
|
|
110
|
+
|
|
111
|
+
A carousel with `options='{"type": "slider"}'` does not loop and has no copies.
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import slideControlsStyle from '../../styles/slide-controls.style.js';
|
|
2
|
+
|
|
1
3
|
const css = String.raw;
|
|
2
4
|
|
|
3
|
-
// Glide's core
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
|
|
5
|
+
// Glide's core CSS is inlined here rather than `@import`-ed, because element-js applies component
|
|
6
|
+
// styles as constructed/adopted stylesheets, where `@import` is not allowed. Sourced from
|
|
7
|
+
// @glidejs/glide@3.6.x dist/css/glide.core.css. The theme of Glide is not here: the arrows and the
|
|
8
|
+
// bullets have the look and the place of the shared module, as the ones of the slider.
|
|
9
|
+
const style = css`
|
|
7
10
|
:host {
|
|
8
11
|
display: block;
|
|
9
12
|
}
|
|
@@ -58,79 +61,16 @@ export default css`
|
|
|
58
61
|
-webkit-tap-highlight-color: transparent;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
/*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
border: 2px solid rgba(255, 255, 255, 0.5);
|
|
72
|
-
border-radius: 4px;
|
|
73
|
-
box-shadow: 0 0.25em 0.5em 0 rgba(0, 0, 0, 0.1);
|
|
74
|
-
text-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.1);
|
|
75
|
-
opacity: 1;
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
transition:
|
|
78
|
-
opacity 150ms ease,
|
|
79
|
-
border 300ms ease-in-out;
|
|
80
|
-
transform: translateY(-50%);
|
|
81
|
-
line-height: 1;
|
|
82
|
-
}
|
|
83
|
-
.glide__arrow:focus {
|
|
84
|
-
outline: none;
|
|
85
|
-
}
|
|
86
|
-
.glide__arrow:hover {
|
|
87
|
-
border-color: white;
|
|
88
|
-
}
|
|
89
|
-
.glide__arrow--left {
|
|
90
|
-
left: 2em;
|
|
91
|
-
}
|
|
92
|
-
.glide__arrow--right {
|
|
93
|
-
right: 2em;
|
|
94
|
-
}
|
|
95
|
-
.glide__arrow--disabled {
|
|
96
|
-
opacity: 0.33;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/* --- Glide theme: bullets --- */
|
|
100
|
-
.glide__bullets {
|
|
101
|
-
position: absolute;
|
|
102
|
-
z-index: 2;
|
|
103
|
-
bottom: 2em;
|
|
104
|
-
left: 50%;
|
|
105
|
-
display: inline-flex;
|
|
106
|
-
list-style: none;
|
|
107
|
-
transform: translateX(-50%);
|
|
108
|
-
}
|
|
109
|
-
.glide__bullet {
|
|
110
|
-
background-color: rgba(255, 255, 255, 0.5);
|
|
111
|
-
width: 13px;
|
|
112
|
-
height: 13px;
|
|
113
|
-
padding: 0;
|
|
114
|
-
border-radius: 50%;
|
|
115
|
-
border: 2px solid transparent;
|
|
116
|
-
transition: all 300ms ease-in-out;
|
|
117
|
-
cursor: pointer;
|
|
118
|
-
line-height: 0;
|
|
119
|
-
box-shadow: 0 0.25em 0.5em 0 rgba(0, 0, 0, 0.1);
|
|
120
|
-
margin: 0 0.25em;
|
|
121
|
-
}
|
|
122
|
-
.glide__bullet:focus {
|
|
123
|
-
outline: none;
|
|
124
|
-
}
|
|
125
|
-
.glide__bullet:hover,
|
|
126
|
-
.glide__bullet:focus {
|
|
127
|
-
border: 2px solid white;
|
|
128
|
-
background-color: rgba(255, 255, 255, 0.5);
|
|
129
|
-
}
|
|
130
|
-
/* Active bullet. The component marks it with the selected-dot part (Glide's Controls
|
|
131
|
-
component, which would add .glide__bullet--active, is not mounted). */
|
|
132
|
-
.glide__bullet[part~='selected-dot'] {
|
|
133
|
-
background-color: white;
|
|
64
|
+
/* The clones Glide needs for looping are copies of slides, kept in this shadow root. They get
|
|
65
|
+
what the slides get, and :where() lets a rule of the page win, as it does for a slide. */
|
|
66
|
+
:where(.glide__slide--clone) {
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
flex-shrink: 0;
|
|
70
|
+
white-space: normal;
|
|
71
|
+
user-select: none;
|
|
72
|
+
-webkit-touch-callout: none;
|
|
73
|
+
-webkit-tap-highlight-color: transparent;
|
|
134
74
|
}
|
|
135
75
|
|
|
136
76
|
.glide--swipeable {
|
|
@@ -140,3 +80,7 @@ export default css`
|
|
|
140
80
|
cursor: grabbing;
|
|
141
81
|
}
|
|
142
82
|
`;
|
|
83
|
+
|
|
84
|
+
// Glide marks an arrow that leads nowhere with a class and leaves the button enabled: a carousel of
|
|
85
|
+
// the type slider at its first and at its last slide.
|
|
86
|
+
export default [slideControlsStyle('.glide', '.glide__track', '.glide__arrow--disabled'), style].join('\n');
|
|
@@ -4,7 +4,9 @@ export default function (Glide, Components, Events) {
|
|
|
4
4
|
const glideAnchors = GlideAnchorComponent(Glide, Components, Events);
|
|
5
5
|
|
|
6
6
|
glideAnchors.mount = function () {
|
|
7
|
-
|
|
7
|
+
// The links of the slides are in the light DOM, those of the clones in the shadow root.
|
|
8
|
+
const { host, wrapper } = Components.Html;
|
|
9
|
+
this._a = [...host.querySelectorAll('a'), ...wrapper.querySelectorAll('a')];
|
|
8
10
|
this.bind();
|
|
9
11
|
};
|
|
10
12
|
|
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
import GlideClonesComponent from '@glidejs/glide/src/components/clones';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Glide's clones of the first and the last slides, which a carousel needs to loop.
|
|
5
|
+
*
|
|
6
|
+
* They live in the shadow root, before and after the slot of the slides, and not among the
|
|
7
|
+
* children of the element. Those belong to the page: a framework that hydrates server-rendered
|
|
8
|
+
* slides finds nodes it did not render otherwise.
|
|
9
|
+
*/
|
|
3
10
|
export default function (Glide, Components, Events) {
|
|
4
11
|
const glideClones = GlideClonesComponent(Glide, Components, Events);
|
|
5
12
|
|
|
6
13
|
glideClones.append = () => {
|
|
7
|
-
const wrapper = Components.Html
|
|
14
|
+
const { wrapper } = Components.Html;
|
|
15
|
+
const { items } = glideClones;
|
|
8
16
|
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
const half = Math.floor(items.length / 2);
|
|
18
|
+
const before = items.slice(0, half).reverse();
|
|
19
|
+
const after = items.slice(half * -1).reverse();
|
|
20
|
+
const width = `${Components.Sizes.slideWidth}px`;
|
|
11
21
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let width = `${Components.Sizes.slideWidth}px`;
|
|
22
|
+
// The slot stays between them, so the slides of the page render in the middle.
|
|
23
|
+
wrapper.prepend(...before);
|
|
24
|
+
wrapper.append(...after);
|
|
16
25
|
|
|
17
|
-
for (
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
for (let i = 0; i < prepend.length; i++) {
|
|
22
|
-
wrapper.insertBefore(prepend[i], slides[0]);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
for (let i = 0; i < items.length; i++) {
|
|
26
|
-
items[i].style.width = width;
|
|
26
|
+
for (const clone of items) {
|
|
27
|
+
clone.style.width = width;
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
|
-
glideClones.remove = () => {
|
|
30
|
-
const wrapper = Components.Html.host;
|
|
31
|
-
let { items } = glideClones;
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} catch (e) {}
|
|
31
|
+
glideClones.remove = () => {
|
|
32
|
+
for (const clone of glideClones.items) {
|
|
33
|
+
clone.remove();
|
|
37
34
|
}
|
|
38
35
|
};
|
|
39
36
|
|
|
@@ -12,7 +12,7 @@ export default function (Glide, Components, Events) {
|
|
|
12
12
|
Events.on(
|
|
13
13
|
['build.after', 'update'],
|
|
14
14
|
throttle(() => {
|
|
15
|
-
Gaps.apply(Components.Html.
|
|
15
|
+
Gaps.apply(Components.Html.rendered);
|
|
16
16
|
}, 30),
|
|
17
17
|
);
|
|
18
18
|
|
|
@@ -21,7 +21,7 @@ export default function (Glide, Components, Events) {
|
|
|
21
21
|
* - on destroying to bring markup to its inital state
|
|
22
22
|
*/
|
|
23
23
|
Events.on('destroy', () => {
|
|
24
|
-
Gaps.remove(Components.Html.
|
|
24
|
+
Gaps.remove(Components.Html.rendered);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
return Gaps;
|
|
@@ -19,13 +19,32 @@ export default function (Glide, Components, Events) {
|
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
+
define(glideHtml, 'rendered', {
|
|
23
|
+
/**
|
|
24
|
+
* The slides and their clones in the order they render: the wrapper in the shadow root holds
|
|
25
|
+
* the clones around the slot, the slides of the page come in at the slot.
|
|
26
|
+
*
|
|
27
|
+
* @return {Element[]}
|
|
28
|
+
*/
|
|
29
|
+
get() {
|
|
30
|
+
return Array.from(glideHtml.wrapper.children).flatMap((child) =>
|
|
31
|
+
child.localName === 'slot' ? glideHtml.slides : [child],
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
22
36
|
glideHtml.mount = function () {
|
|
23
37
|
this.root = Glide.selector;
|
|
24
38
|
this.track = this.root.querySelector(TRACK_SELECTOR);
|
|
39
|
+
this.collectSlides();
|
|
40
|
+
};
|
|
25
41
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The slides are the children of the host, without what the page put into a named slot (the
|
|
44
|
+
* content of the arrows). The wrapper, where Glide looks for them, is in the shadow root.
|
|
45
|
+
*/
|
|
46
|
+
glideHtml.collectSlides = function () {
|
|
47
|
+
this.slides = Array.from(this.host.children).filter((slide) => !slide.hasAttribute('slot'));
|
|
29
48
|
};
|
|
30
49
|
|
|
31
50
|
return glideHtml;
|
|
@@ -12,6 +12,31 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
12
12
|
|
|
13
13
|
## Unreleased
|
|
14
14
|
|
|
15
|
+
## [0.3.1] - 2026-11-17
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- `checked` set from outside moves the checkbox, also after the user has pressed it. The field wrote the `checked` attribute of its native input alone, which is the default of the control: after a press the control no longer follows it. `field.checked = false`, or the `checked` attribute, took the check mark away, while the native checkbox stayed checked and the form went on submitting the value. The field now writes the property of the input as well, before it dispatches `input-change`. ([#185](https://github.com/webtides/element-library/issues/185))
|
|
20
|
+
|
|
21
|
+
## [0.3.0] - 2026-11-17
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- On a touch screen (`@media (any-pointer: coarse)`) the label, which is the hit area of the checkbox, is at least `--el-touch-target` wide and high. Before, it was as high as its line of text. Unchanged on a fine pointer and without the token.
|
|
26
|
+
- The help message, the checkbox with its label and the error message stack in a column with a gap of `--el-space-1` (4 px without a theme; they had no gap). The messages are set in `--el-font-size-sm` (14 px without a theme; they had the size of the text), and the help message has the muted colour of the theme (`--el-color-fg-muted`), as in every field now; without a theme it keeps the colour of the text. A help message without a text takes no room. ([#130](https://github.com/webtides/element-library/issues/130))
|
|
27
|
+
- The help message stands below the checkbox and its label, and the error message below the help message. It was the first thing of the field, above the label it explains. What a screen reader reads is unchanged: the checkbox names both messages in `aria-describedby`. ([#132](https://github.com/webtides/element-library/issues/132))
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- The error message is an alert (`role="alert"`), so a screen reader announces it the moment it appears. ([#94](https://github.com/webtides/element-library/issues/94))
|
|
32
|
+
- The checkbox names its help message and its error message. Its `aria-describedby` pointed at the checkbox itself, so a screen reader read neither message when the checkbox got focus; the error message was only announced the moment it appeared. It now names the help message, and the error message while that is shown, as the other fields do. ([#129](https://github.com/webtides/element-library/issues/129))
|
|
33
|
+
- The error message has the danger colour of the theme (`--el-color-danger`). It had the colour of the text and read like a help message, while the messages of an `el-input-field` on the same form were red. Without a theme it keeps the colour of the text, which is what every field does now. ([#128](https://github.com/webtides/element-library/issues/128))
|
|
34
|
+
- The `hidden` attribute hides the field. The field sets a `display` of its own, which won over the attribute. ([#130](https://github.com/webtides/element-library/issues/130))
|
|
35
|
+
- The checkbox says whether the field is valid (`aria-invalid`). Before, the error message reached a screen reader and the state of the control did not, while the control of `el-input-field` and of `el-select-field` has said it all along. ([#134](https://github.com/webtides/element-library/issues/134))
|
|
36
|
+
- A second field with the same `name` on the page is described by its own messages. Their ids are made per field, not from the name (BREAKING for a page that names `<name>-help-message` itself). See `form-field`. ([#133](https://github.com/webtides/element-library/issues/133))
|
|
37
|
+
- The accessible name of the checkbox is its label alone. It started with the check mark of the box ("✓ I agree to the terms"), checked or not: the box is inside the label, and while the checkbox is not checked its mark is hidden from the eye only. The box is now hidden from assistive technology (`aria-hidden`); the checkbox itself says whether it is checked. ([#135](https://github.com/webtides/element-library/issues/135))
|
|
38
|
+
- A click is reported once. `input-change` was fired three times for the first click on a checkbox without a `value`, and twice for every other click: by the handler of the form field, by the watcher of `value`, which took over the value of the control, and by the watcher of `checked`. The watcher of `checked` alone reports now, once for every change of the checked state, by the user or by a script, with the value of the control as before. A `value` that a script sets is no change of the checked state and is no longer reported. ([#148](https://github.com/webtides/element-library/issues/148))
|
|
39
|
+
|
|
15
40
|
## [0.1.0] - 2026-06-03
|
|
16
41
|
|
|
17
42
|
### Added
|
|
@@ -19,9 +19,6 @@ import style from './checkbox-field.style.js';
|
|
|
19
19
|
* attribute.
|
|
20
20
|
*/
|
|
21
21
|
export default class CheckboxField extends FormField {
|
|
22
|
-
/** @private */
|
|
23
|
-
uuid = Math.random().toString(36).substr(2, 5);
|
|
24
|
-
|
|
25
22
|
constructor(options) {
|
|
26
23
|
super({ shadowRender: false, styles: [style], ...options });
|
|
27
24
|
}
|
|
@@ -38,14 +35,28 @@ export default class CheckboxField extends FormField {
|
|
|
38
35
|
this.syncValidationStates();
|
|
39
36
|
}
|
|
40
37
|
|
|
38
|
+
/** @private */
|
|
39
|
+
_stateForReset() {
|
|
40
|
+
return { ...super._stateForReset(), checked: this.checked };
|
|
41
|
+
}
|
|
42
|
+
|
|
41
43
|
watch() {
|
|
42
44
|
return {
|
|
43
45
|
...super.watch(),
|
|
46
|
+
// The value of a checkbox is what the form submits while it is checked. What the user
|
|
47
|
+
// changes is `checked`, and its watcher reports that: once for every change.
|
|
48
|
+
value: () => {},
|
|
44
49
|
checked: (checked) => {
|
|
45
50
|
this.setAttribute('checked', checked ? 'true' : 'false');
|
|
46
51
|
if (checked) this._internals.states.add('checked');
|
|
47
52
|
else this._internals.states.delete('checked');
|
|
48
|
-
|
|
53
|
+
// The `checked` attribute the template writes is only the default of the control:
|
|
54
|
+
// once the user has pressed it, the browser no longer follows the attribute. So a
|
|
55
|
+
// state from outside is written to the control as well, before the event says
|
|
56
|
+
// that it has changed.
|
|
57
|
+
const input = this.$refs.input;
|
|
58
|
+
if (input.checked !== !!checked) input.checked = !!checked;
|
|
59
|
+
this.dispatch(FormFieldEvents.INPUT_CHANGE, input.value);
|
|
49
60
|
},
|
|
50
61
|
};
|
|
51
62
|
}
|
|
@@ -62,14 +73,21 @@ export default class CheckboxField extends FormField {
|
|
|
62
73
|
}
|
|
63
74
|
|
|
64
75
|
/**
|
|
65
|
-
* The checkbox
|
|
66
|
-
*
|
|
67
|
-
* @returns {null}
|
|
76
|
+
* The checkbox has its label next to the box, in the row of the control (see `fieldTemplate`),
|
|
77
|
+
* and none in front of it. The help message explains that label, so it comes after the row.
|
|
68
78
|
*/
|
|
69
|
-
|
|
70
|
-
return
|
|
79
|
+
template() {
|
|
80
|
+
return html`
|
|
81
|
+
<div class="field ${this.classes().field}">${this.fieldTemplate()}</div>
|
|
82
|
+
${this.helpTemplate()} ${this.errorTemplate()}
|
|
83
|
+
`;
|
|
71
84
|
}
|
|
72
85
|
|
|
86
|
+
/**
|
|
87
|
+
* The box with its check mark is inside the label, in front of the text. It is hidden from
|
|
88
|
+
* assistive technology: the checkbox itself says whether it is checked, and the mark would be
|
|
89
|
+
* part of its name, checked or not.
|
|
90
|
+
*/
|
|
73
91
|
fieldTemplate() {
|
|
74
92
|
const classes = { 'is-checked': !!this.checked };
|
|
75
93
|
return html`
|
|
@@ -78,14 +96,17 @@ export default class CheckboxField extends FormField {
|
|
|
78
96
|
ref="input"
|
|
79
97
|
type="checkbox"
|
|
80
98
|
id="checkbox-${this.uuid}"
|
|
81
|
-
aria-describedby="
|
|
99
|
+
aria-describedby="${this._describedBy()}"
|
|
100
|
+
aria-invalid="${this.valid ? 'false' : 'true'}"
|
|
82
101
|
value="${this.value}"
|
|
83
102
|
name="${this.name}"
|
|
84
103
|
?disabled="${this.disabled}"
|
|
85
104
|
?checked="${this.checked}"
|
|
86
105
|
?required="${this.required}"
|
|
87
106
|
/>
|
|
88
|
-
<div class="checked-indicator ${classMap(classes)}"
|
|
107
|
+
<div class="checked-indicator ${classMap(classes)}" aria-hidden="true">
|
|
108
|
+
${this.selectedIndicatorTemplate()}
|
|
109
|
+
</div>
|
|
89
110
|
<div class="label">${this.label ? unsafeHTML(this.label) : ''}</div>
|
|
90
111
|
</label>
|
|
91
112
|
`;
|