@webtides/element-library 0.1.2 → 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 +390 -3
- package/README.md +61 -41
- package/all.js +28 -0
- package/catalog.d.ts +14 -0
- package/catalog.js +63 -0
- package/custom-elements.json +16604 -3420
- package/package.json +37 -25
- 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
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const css = String.raw;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A native `<dialog>` as a modal surface with a header, a body and a footer, which `el-dialog` and
|
|
5
|
+
* `el-drawer` both are. The module has what the two share:
|
|
6
|
+
*
|
|
7
|
+
* - the paint of the surface from the tokens: background, text colour, shadow
|
|
8
|
+
* - the backdrop (`--el-dialog-overlay-background`)
|
|
9
|
+
* - the way from closed to shown: the component adds the class `showing` to the dialog, and the
|
|
10
|
+
* opacity and the transform of the dialog go to their resting values in `--el-duration-md`
|
|
11
|
+
* - the parts: `header`, `title`, `header-actions`, `close-button`, `body`, `footer`
|
|
12
|
+
*
|
|
13
|
+
* The component adds where the surface is and how large, its border and its corners, and what it
|
|
14
|
+
* looks like before it is shown: an opacity, a transform or both, on the selector `dialog`. Those
|
|
15
|
+
* are different properties from the ones set here, so the order of the two stylesheets does not
|
|
16
|
+
* decide anything.
|
|
17
|
+
*
|
|
18
|
+
* The module takes no host: a dialog with slots needs a shadow root, and the host of one is
|
|
19
|
+
* `:host`.
|
|
20
|
+
* @returns {string}
|
|
21
|
+
*/
|
|
22
|
+
export default function modalStyle() {
|
|
23
|
+
return css`
|
|
24
|
+
:host {
|
|
25
|
+
display: contents;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* The native <dialog> is the top-layer surface (the "panel"). It is headless by default —
|
|
30
|
+
* every visual token falls back to a null-ish value so an unthemed surface imposes nothing.
|
|
31
|
+
*/
|
|
32
|
+
dialog {
|
|
33
|
+
padding: 0;
|
|
34
|
+
background: var(--el-color-bg, transparent);
|
|
35
|
+
color: var(--el-color-fg, inherit);
|
|
36
|
+
box-shadow: var(--el-shadow-lg, none);
|
|
37
|
+
transition:
|
|
38
|
+
opacity var(--el-duration-md, 0s) var(--el-ease, ease),
|
|
39
|
+
transform var(--el-duration-md, 0s) var(--el-ease, ease);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Lay the box out only while open so the UA's \`dialog:not([open]) { display: none }\` still hides it. */
|
|
43
|
+
dialog[open] {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
dialog.showing {
|
|
49
|
+
opacity: 1;
|
|
50
|
+
transform: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
dialog::backdrop {
|
|
54
|
+
background: var(--el-dialog-overlay-background, transparent);
|
|
55
|
+
opacity: 0;
|
|
56
|
+
transition: opacity var(--el-duration-md, 0s) var(--el-ease, ease);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
dialog.showing::backdrop {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[part~='header'] {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
gap: var(--el-space-2, 0.5rem);
|
|
67
|
+
padding: var(--el-space-4, 1rem);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[part~='title'] {
|
|
71
|
+
flex: 1 1 auto;
|
|
72
|
+
margin: 0;
|
|
73
|
+
font-size: var(--el-font-size-lg, 1.125rem);
|
|
74
|
+
font-weight: var(--el-font-weight-semibold, 600);
|
|
75
|
+
line-height: 1.2;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[part~='header-actions'] {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex: 0 0 auto;
|
|
81
|
+
align-items: center;
|
|
82
|
+
gap: var(--el-space-2, 0.5rem);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[part~='close-button'] {
|
|
86
|
+
display: inline-flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
padding: 0;
|
|
90
|
+
border: none;
|
|
91
|
+
border-radius: var(--el-radius-md, 0);
|
|
92
|
+
background: transparent;
|
|
93
|
+
color: inherit;
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
line-height: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
[part~='close-button'] svg {
|
|
99
|
+
width: 1.25rem;
|
|
100
|
+
height: 1.25rem;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Touch screens: the close button is at least --el-touch-target, the icon keeps its size.
|
|
104
|
+
Without the token the sizes stay as they are. */
|
|
105
|
+
@media (any-pointer: coarse) {
|
|
106
|
+
[part~='close-button'] {
|
|
107
|
+
min-width: var(--el-touch-target, auto);
|
|
108
|
+
min-height: var(--el-touch-target, auto);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[part~='body'] {
|
|
113
|
+
flex: 1 1 auto;
|
|
114
|
+
overflow: auto;
|
|
115
|
+
padding: var(--el-space-4, 1rem);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Header present: let the header own the top padding so the body doesn't double it. */
|
|
119
|
+
[part~='header'] + [part~='body'] {
|
|
120
|
+
padding-top: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
[part~='footer'] {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex: 0 0 auto;
|
|
126
|
+
justify-content: flex-end;
|
|
127
|
+
gap: var(--el-space-2, 0.5rem);
|
|
128
|
+
padding: var(--el-space-4, 1rem);
|
|
129
|
+
padding-top: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* The footer is left out when nothing is slotted into it. The component sets the class:
|
|
133
|
+
the footer always has its slot as a child, and a stylesheet cannot ask a slot whether
|
|
134
|
+
it is empty in every browser yet. */
|
|
135
|
+
[part~='footer'].is-empty {
|
|
136
|
+
display: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@media (prefers-reduced-motion: reduce) {
|
|
140
|
+
dialog,
|
|
141
|
+
dialog::backdrop {
|
|
142
|
+
transition-duration: 0s;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @webtides/element-library — the native controls of the fields
|
|
3
|
+
*
|
|
4
|
+
* Opt-in stylesheet that gives the native control of a field the look of the
|
|
5
|
+
* design tokens: border, radius, padding, colours, focus ring. It reaches the
|
|
6
|
+
* input of el-input-field, el-password-field, el-otp-field, el-combobox-field,
|
|
7
|
+
* el-date-field and el-tag-field, the textarea of el-textarea-field, the
|
|
8
|
+
* select of el-select-field, the file input of el-file-field, the colour input
|
|
9
|
+
* of el-color-field and the range of el-range-field. Import it together with a
|
|
10
|
+
* theme, which sets the tokens:
|
|
11
|
+
*
|
|
12
|
+
* import '@webtides/element-library/themes/default.css';
|
|
13
|
+
* import '@webtides/element-library/styles/native.css';
|
|
14
|
+
*
|
|
15
|
+
* Without this file a control keeps the look of the browser, with or without
|
|
16
|
+
* a theme: the library stays headless. Native controls of the page that are
|
|
17
|
+
* not in a field are never touched.
|
|
18
|
+
*
|
|
19
|
+
* The rules are in no cascade layer, on purpose. A page often has a reset
|
|
20
|
+
* that is in none (Tailwind 3, a classic reset.css), and a rule in a layer
|
|
21
|
+
* loses against it whatever its selector: the controls would lose their
|
|
22
|
+
* border and padding again. Outside a layer, the tag of the field in front of
|
|
23
|
+
* the control is enough to win over a reset.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* A field with a `size` sets the --_el-size-* properties; a field without one
|
|
28
|
+
* has the medium size.
|
|
29
|
+
*/
|
|
30
|
+
el-input-field input,
|
|
31
|
+
el-password-field input,
|
|
32
|
+
el-otp-field input,
|
|
33
|
+
el-combobox-field input,
|
|
34
|
+
el-date-field input,
|
|
35
|
+
el-tag-field input,
|
|
36
|
+
el-file-field input,
|
|
37
|
+
el-textarea-field textarea,
|
|
38
|
+
el-select-field select {
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
width: 100%;
|
|
41
|
+
border: var(--el-border-width) solid var(--el-color-border);
|
|
42
|
+
border-radius: var(--el-radius-md);
|
|
43
|
+
padding: var(--_el-size-padding-block, var(--el-space-2)) var(--el-space-3);
|
|
44
|
+
background: var(--el-color-bg);
|
|
45
|
+
color: var(--el-color-fg);
|
|
46
|
+
font-family: var(--el-font-family);
|
|
47
|
+
font-size: var(--_el-size-font-size, var(--el-font-size-md));
|
|
48
|
+
line-height: var(--el-line-height);
|
|
49
|
+
transition:
|
|
50
|
+
border-color var(--el-duration-md) var(--el-ease),
|
|
51
|
+
box-shadow var(--el-duration-md) var(--el-ease);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
el-input-field input,
|
|
55
|
+
el-password-field input,
|
|
56
|
+
el-otp-field input,
|
|
57
|
+
el-combobox-field input,
|
|
58
|
+
el-date-field input,
|
|
59
|
+
el-tag-field input,
|
|
60
|
+
el-file-field input,
|
|
61
|
+
el-select-field select {
|
|
62
|
+
min-height: calc(var(--el-control-height) * var(--_el-size-scale, 1));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* Touch screens: no control is lower than --el-touch-target. The fields have
|
|
67
|
+
* the same rule in their own stylesheets, with the same weight as the one
|
|
68
|
+
* above. Stated here as well, the result is the same whichever of the two
|
|
69
|
+
* stylesheets comes later in the page.
|
|
70
|
+
*/
|
|
71
|
+
@media (any-pointer: coarse) {
|
|
72
|
+
el-input-field input,
|
|
73
|
+
el-password-field input,
|
|
74
|
+
el-otp-field input,
|
|
75
|
+
el-combobox-field input,
|
|
76
|
+
el-date-field input,
|
|
77
|
+
el-tag-field input,
|
|
78
|
+
el-file-field input,
|
|
79
|
+
el-select-field select {
|
|
80
|
+
min-height: max(calc(var(--el-control-height) * var(--_el-size-scale, 1)), var(--el-touch-target, 0px));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
el-input-field input:focus,
|
|
85
|
+
el-password-field input:focus,
|
|
86
|
+
el-otp-field input:focus,
|
|
87
|
+
el-combobox-field input:focus,
|
|
88
|
+
el-date-field input:focus,
|
|
89
|
+
el-tag-field input:focus,
|
|
90
|
+
el-file-field input:focus,
|
|
91
|
+
el-color-field input:focus-visible,
|
|
92
|
+
el-textarea-field textarea:focus,
|
|
93
|
+
el-select-field select:focus {
|
|
94
|
+
outline: none;
|
|
95
|
+
border-color: var(--el-color-focus-ring);
|
|
96
|
+
box-shadow:
|
|
97
|
+
0 0 0 var(--el-focus-ring-offset) var(--el-color-bg),
|
|
98
|
+
0 0 0 calc(var(--el-focus-ring-offset) + var(--el-focus-ring-width)) var(--el-color-focus-ring);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
el-input-field:state(invalid) input,
|
|
102
|
+
el-password-field:state(invalid) input,
|
|
103
|
+
el-otp-field:state(invalid) input,
|
|
104
|
+
el-combobox-field:state(invalid) input,
|
|
105
|
+
el-date-field:state(invalid) input,
|
|
106
|
+
el-tag-field:state(invalid) input,
|
|
107
|
+
el-file-field:state(invalid) input,
|
|
108
|
+
el-color-field:state(invalid) input,
|
|
109
|
+
el-textarea-field:state(invalid) textarea,
|
|
110
|
+
el-select-field:state(invalid) select {
|
|
111
|
+
border-color: var(--el-color-danger);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/*
|
|
115
|
+
* A control that is disabled fades, as a button of the library does that is
|
|
116
|
+
* disabled, and has the cursor of one. The colours above take away what the
|
|
117
|
+
* browser does for the state (a grey surface, a lighter text), and an opacity
|
|
118
|
+
* shows it in every theme and in both schemes, without a token of its own. The
|
|
119
|
+
* chevron of a select is beside the select and fades with it.
|
|
120
|
+
*/
|
|
121
|
+
el-input-field input:disabled,
|
|
122
|
+
el-password-field input:disabled,
|
|
123
|
+
el-otp-field input:disabled,
|
|
124
|
+
el-combobox-field input:disabled,
|
|
125
|
+
el-date-field input:disabled,
|
|
126
|
+
el-tag-field input:disabled,
|
|
127
|
+
el-file-field input:disabled,
|
|
128
|
+
el-color-field input:disabled,
|
|
129
|
+
el-textarea-field textarea:disabled,
|
|
130
|
+
el-select-field select:disabled,
|
|
131
|
+
el-select-field select:disabled ~ .dropdown-indicator {
|
|
132
|
+
opacity: 0.55;
|
|
133
|
+
cursor: not-allowed;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/*
|
|
137
|
+
* The parts of a date (day, month, year) stand in a wrapper that has a padding
|
|
138
|
+
* of its own above and below. Without it the control is as high as an input
|
|
139
|
+
* for text beside it.
|
|
140
|
+
*/
|
|
141
|
+
el-date-field input::-webkit-datetime-edit-fields-wrapper {
|
|
142
|
+
padding-block: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/*
|
|
146
|
+
* The button of a file input, in front of the name of the file. It is a plain
|
|
147
|
+
* surface in the muted background of the theme and as high as a line of text,
|
|
148
|
+
* so the control is as high as an input beside it.
|
|
149
|
+
*/
|
|
150
|
+
el-file-field input::file-selector-button {
|
|
151
|
+
margin: 0 var(--el-space-3) 0 0;
|
|
152
|
+
border: 0;
|
|
153
|
+
border-radius: var(--el-radius-sm);
|
|
154
|
+
padding: 0 var(--el-space-2);
|
|
155
|
+
background: var(--el-color-bg-muted);
|
|
156
|
+
color: var(--el-color-fg);
|
|
157
|
+
font: inherit;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
el-file-field input:enabled::file-selector-button {
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* The button has a cursor of its own from the browser, so it is told the one of its input. */
|
|
165
|
+
el-file-field input:disabled::file-selector-button {
|
|
166
|
+
cursor: not-allowed;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/*
|
|
170
|
+
* A colour input is a well that shows its colour. It has the border and the
|
|
171
|
+
* radius of the other controls, and the colour fills it up to a narrow rim.
|
|
172
|
+
*
|
|
173
|
+
* It has no text that gives it a height. So it is told the height an input of
|
|
174
|
+
* its size has: a line of text with the padding and the border of an input,
|
|
175
|
+
* and the height of a control at least. It is half again as wide.
|
|
176
|
+
*
|
|
177
|
+
* It shows the focus ring for the keyboard only: a click opens the picker, as
|
|
178
|
+
* a click on a button does.
|
|
179
|
+
*/
|
|
180
|
+
el-color-field input {
|
|
181
|
+
--_el-color-height: max(
|
|
182
|
+
calc(var(--el-control-height) * var(--_el-size-scale, 1)),
|
|
183
|
+
calc(1lh + 2 * var(--_el-size-padding-block, var(--el-space-2)) + 2 * var(--el-border-width))
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
box-sizing: border-box;
|
|
187
|
+
flex: none;
|
|
188
|
+
width: calc(var(--_el-color-height) * 1.5);
|
|
189
|
+
height: var(--_el-color-height);
|
|
190
|
+
border: var(--el-border-width) solid var(--el-color-border);
|
|
191
|
+
border-radius: var(--el-radius-md);
|
|
192
|
+
padding: var(--el-space-1);
|
|
193
|
+
background: var(--el-color-bg);
|
|
194
|
+
font-size: var(--_el-size-font-size, var(--el-font-size-md));
|
|
195
|
+
line-height: var(--el-line-height);
|
|
196
|
+
transition:
|
|
197
|
+
border-color var(--el-duration-md) var(--el-ease),
|
|
198
|
+
box-shadow var(--el-duration-md) var(--el-ease);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
el-color-field input:enabled {
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* One rule for each engine: a selector a browser does not know takes the whole rule with it. */
|
|
206
|
+
el-color-field input::-webkit-color-swatch-wrapper {
|
|
207
|
+
padding: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
el-color-field input::-webkit-color-swatch {
|
|
211
|
+
border: 0;
|
|
212
|
+
border-radius: var(--el-radius-sm);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
el-color-field input::-moz-color-swatch {
|
|
216
|
+
border: 0;
|
|
217
|
+
border-radius: var(--el-radius-sm);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/*
|
|
221
|
+
* A range has no border and no padding to decorate. It is as wide as its
|
|
222
|
+
* field and has the accent colour of the theme, on the track and the thumb the
|
|
223
|
+
* browser draws.
|
|
224
|
+
*/
|
|
225
|
+
el-range-field input {
|
|
226
|
+
flex: 1;
|
|
227
|
+
width: 100%;
|
|
228
|
+
min-width: 0;
|
|
229
|
+
margin: 0;
|
|
230
|
+
accent-color: var(--el-color-accent);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
el-range-field input:focus-visible {
|
|
234
|
+
outline: var(--el-focus-ring-width) solid var(--el-color-focus-ring);
|
|
235
|
+
outline-offset: var(--el-focus-ring-offset);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* The browser draws a range that is disabled in grey. It gets the cursor of the other controls. */
|
|
239
|
+
el-range-field input:disabled {
|
|
240
|
+
cursor: not-allowed;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/*
|
|
244
|
+
* A select paints a chevron of its own, and el-select-field renders one of its
|
|
245
|
+
* own, hidden as long as the select has the look of the browser. Here the
|
|
246
|
+
* native one goes and the field shows its own inside the select, so a
|
|
247
|
+
* decorated select has a single chevron that follows the tokens.
|
|
248
|
+
*
|
|
249
|
+
* The field shows its chevron through a property, not through a rule here: a
|
|
250
|
+
* rule would have the same weight as the rule of the field that hides it, and
|
|
251
|
+
* the later of the two would win.
|
|
252
|
+
*/
|
|
253
|
+
el-select-field {
|
|
254
|
+
--_el-select-indicator-display: flex;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
el-select-field .field {
|
|
258
|
+
position: relative;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
el-select-field select {
|
|
262
|
+
appearance: none;
|
|
263
|
+
-webkit-appearance: none;
|
|
264
|
+
padding-right: calc(var(--el-space-3) * 2 + var(--el-space-2));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
el-select-field .dropdown-indicator {
|
|
268
|
+
align-items: center;
|
|
269
|
+
pointer-events: none;
|
|
270
|
+
position: absolute;
|
|
271
|
+
right: var(--el-space-3);
|
|
272
|
+
top: 50%;
|
|
273
|
+
transform: translateY(-50%);
|
|
274
|
+
color: var(--el-select-indicator-color, var(--el-color-fg-muted));
|
|
275
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { hostSelector } from './host.style.js';
|
|
2
|
+
|
|
3
|
+
const css = String.raw;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The sizes of a control: `small`, `medium` (the default) and `large`, chosen with the `size`
|
|
7
|
+
* attribute of the host. The component declares `size` as a reflected property, so that a size
|
|
8
|
+
* set from a script reaches the attribute.
|
|
9
|
+
*
|
|
10
|
+
* The module resolves the size to properties on the host, and the stylesheet that paints the
|
|
11
|
+
* control applies them. They are internal (`--_el-`), not tokens for a theme:
|
|
12
|
+
*
|
|
13
|
+
* - `--_el-size-scale`: the factor for the height, 0.8 for small and 1.25 for large
|
|
14
|
+
* - `--_el-size-height`: the height of the control, `--el-control-height` times that factor
|
|
15
|
+
* - `--_el-size-padding-block`, `--_el-size-padding-inline`: from the spacing scale
|
|
16
|
+
* - `--_el-size-font-size`: from `--el-font-size-sm` and `--el-font-size-md`
|
|
17
|
+
*
|
|
18
|
+
* Without a theme they fall back to fixed values, so a sized control keeps its proportions. A
|
|
19
|
+
* control that has no size without a theme, a native input for example, takes the factor and
|
|
20
|
+
* multiplies it with a fallback of its own.
|
|
21
|
+
* @param {string} [host] - `':host'` (the default), or the tag of a component without a shadow root.
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
export default function sizeStyle(host = ':host') {
|
|
25
|
+
return css`
|
|
26
|
+
${hostSelector(host)} {
|
|
27
|
+
--_el-size-scale: 1;
|
|
28
|
+
--_el-size-height: calc(var(--el-control-height, 2.5rem) * var(--_el-size-scale));
|
|
29
|
+
--_el-size-padding-block: var(--el-space-2, 0.5em);
|
|
30
|
+
--_el-size-padding-inline: var(--el-space-4, 1em);
|
|
31
|
+
--_el-size-font-size: var(--el-font-size-md, 1rem);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
${hostSelector(host, "[size='small']")} {
|
|
35
|
+
--_el-size-scale: 0.8;
|
|
36
|
+
--_el-size-padding-block: var(--el-space-1, 0.25em);
|
|
37
|
+
--_el-size-padding-inline: var(--el-space-3, 0.75em);
|
|
38
|
+
--_el-size-font-size: var(--el-font-size-sm, 0.875rem);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
${hostSelector(host, "[size='large']")} {
|
|
42
|
+
--_el-size-scale: 1.25;
|
|
43
|
+
--_el-size-padding-block: var(--el-space-3, 0.75em);
|
|
44
|
+
--_el-size-padding-inline: var(--el-space-5, 1.5em);
|
|
45
|
+
--_el-size-font-size: calc(var(--el-font-size-md, 1rem) * 1.125);
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
const css = String.raw;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The controls of a component that shows a part of its content at a time (carousel, slider): an
|
|
5
|
+
* arrow at each side of the track, and under the track a dot for every stop.
|
|
6
|
+
*
|
|
7
|
+
* The component marks the elements with parts, and the module selects them by those: `arrows`
|
|
8
|
+
* around two `arrow`, and `dots` around a `dot` for every stop, with `selected-dot` on the one of
|
|
9
|
+
* the stop that shows. An arrow that cannot be used is `:disabled`, or what the third argument
|
|
10
|
+
* selects. A text for screen readers only has the class `visually-hidden`.
|
|
11
|
+
*
|
|
12
|
+
* Nothing says what a slide shows, so no colour of a control can be told to stand out from it. The
|
|
13
|
+
* dots are in a row of their own under the track for that reason, on the page. The arrows lie on
|
|
14
|
+
* the track and have a surface of their own.
|
|
15
|
+
* @param {string} container - Selector of the element that has the track, the arrows and the dots
|
|
16
|
+
* as its children: `':host'`, or an element in the shadow root.
|
|
17
|
+
* @param {string} track - Selector of the track, the child that shows the slides.
|
|
18
|
+
* @param {string} [disabledArrow] - Selector of an arrow that cannot be used, beside `:disabled`:
|
|
19
|
+
* the part `arrow-disabled` by default, or what a library that drives the component marks it with.
|
|
20
|
+
* @returns {string}
|
|
21
|
+
*/
|
|
22
|
+
export default function slideControlsStyle(container, track, disabledArrow = "[part~='arrow-disabled']") {
|
|
23
|
+
const disabled = `[part~='arrow']:is(:disabled, ${disabledArrow})`;
|
|
24
|
+
|
|
25
|
+
return css`
|
|
26
|
+
/* One column and two rows: the track with the arrows on it, and the dots. What is stacked
|
|
27
|
+
in here stays in here, whatever the page stacks around the component. */
|
|
28
|
+
${container} {
|
|
29
|
+
display: grid;
|
|
30
|
+
grid-template-columns: minmax(0, 1fr);
|
|
31
|
+
isolation: isolate;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
${track},
|
|
35
|
+
[part~='arrows'] {
|
|
36
|
+
grid-area: 1 / 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[part~='dots'] {
|
|
40
|
+
grid-area: 2 / 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* ── Arrows ───────────────────────────────────────────────────────────── */
|
|
44
|
+
|
|
45
|
+
/* On the track, in the middle of its height and at its two sides. The layer lets a click
|
|
46
|
+
and a swipe through to the slides, the arrows take theirs. */
|
|
47
|
+
[part~='arrows'] {
|
|
48
|
+
position: relative;
|
|
49
|
+
z-index: 1;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
padding-inline: var(--el-space-2, 0.5rem);
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* A square of the control height, which grows in width with a text of the page. Without a
|
|
58
|
+
theme it has the surface and the text colour of the browser for the colour scheme: an
|
|
59
|
+
arrow without a surface would be a sign in the text colour of the page on a slide. */
|
|
60
|
+
[part~='arrow'] {
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
min-width: var(--el-control-height, 2.5rem);
|
|
66
|
+
min-height: var(--el-control-height, 2.5rem);
|
|
67
|
+
margin: 0;
|
|
68
|
+
padding: 0 var(--el-space-2, 0.5rem);
|
|
69
|
+
border: var(--el-border-width, 1px) solid var(--el-color-border, currentColor);
|
|
70
|
+
border-radius: var(--el-radius-md, 4px);
|
|
71
|
+
background: var(--el-color-bg, Canvas);
|
|
72
|
+
color: var(--el-color-fg, CanvasText);
|
|
73
|
+
font-family: var(--el-font-family, inherit);
|
|
74
|
+
font-size: var(--el-font-size-md, 1rem);
|
|
75
|
+
line-height: 1;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
pointer-events: auto;
|
|
78
|
+
user-select: none;
|
|
79
|
+
transition: filter var(--el-duration-md, 0s) var(--el-ease, linear);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Hover styles only where the pointer can hover: a touch screen keeps :hover on the arrow
|
|
83
|
+
after a tap. Pressed is one step darker, and the only feedback a touch screen gets. */
|
|
84
|
+
@media (hover: hover) {
|
|
85
|
+
[part~='arrow']:hover {
|
|
86
|
+
filter: brightness(0.95);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
[part~='arrow']:active {
|
|
91
|
+
filter: brightness(0.88);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* The ring is inside of the arrow, on its own surface: around it, it would lie on the
|
|
95
|
+
slide, where nothing says that it can be seen. */
|
|
96
|
+
[part~='arrow']:focus-visible {
|
|
97
|
+
outline: var(--el-focus-ring-width, 2px) solid var(--el-color-focus-ring, currentColor);
|
|
98
|
+
outline-offset: calc(-1 * (var(--el-focus-ring-width, 2px) + var(--el-border-width, 1px)));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* An arrow that leads nowhere keeps its surface, and its sign fades. An arrow that fades as
|
|
102
|
+
a whole, as a disabled el-button does, would let the slide under it show through. */
|
|
103
|
+
${disabled} {
|
|
104
|
+
color: color-mix(in srgb, var(--el-color-fg, CanvasText) 40%, transparent);
|
|
105
|
+
cursor: not-allowed;
|
|
106
|
+
filter: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Where the user forces colours, a mixed colour is replaced by the one of an enabled
|
|
110
|
+
button. The grey of the system says what the fading said. */
|
|
111
|
+
@media (forced-colors: active) {
|
|
112
|
+
${disabled} {
|
|
113
|
+
border-color: GrayText;
|
|
114
|
+
color: GrayText;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* The arrow heads that are there without a content of the page. They point with the reading
|
|
119
|
+
direction: the arrow back is at the right in a text that runs from right to left. */
|
|
120
|
+
[part~='arrow'] slot > svg {
|
|
121
|
+
width: 1.25em;
|
|
122
|
+
height: 1.25em;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host(:dir(rtl)) [part~='arrow'] slot > svg {
|
|
126
|
+
transform: scaleX(-1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* The name of an arrow whose slot is empty: read by screen readers, not shown. */
|
|
130
|
+
.visually-hidden {
|
|
131
|
+
position: absolute;
|
|
132
|
+
width: 1px;
|
|
133
|
+
height: 1px;
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
clip-path: inset(50%);
|
|
136
|
+
white-space: nowrap;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* ── Dots ─────────────────────────────────────────────────────────────── */
|
|
140
|
+
|
|
141
|
+
/* A row in the middle, which breaks into a second one where it does not fit. A dot is
|
|
142
|
+
small, and what takes its click is a square around it (--_el-dot-target). The dots are
|
|
143
|
+
that far apart and the row is that high, so no square lies on another one or on the
|
|
144
|
+
track. */
|
|
145
|
+
[part~='dots'] {
|
|
146
|
+
--_el-dot-size: 0.625rem;
|
|
147
|
+
--_el-dot-target: 1.5rem;
|
|
148
|
+
--_el-dot-space: calc(var(--_el-dot-target) - var(--_el-dot-size));
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-wrap: wrap;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
gap: var(--_el-dot-space);
|
|
153
|
+
margin: 0;
|
|
154
|
+
padding: calc(var(--_el-dot-space) / 2);
|
|
155
|
+
list-style: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* A ring, and a disc for the stop that shows: the two differ in their shape, not only in
|
|
159
|
+
their colour. Both are made of the border, which keeps a colour where the user forces
|
|
160
|
+
colours; a fill would not. */
|
|
161
|
+
[part~='dot'] {
|
|
162
|
+
position: relative;
|
|
163
|
+
flex: none;
|
|
164
|
+
box-sizing: border-box;
|
|
165
|
+
width: var(--_el-dot-size);
|
|
166
|
+
height: var(--_el-dot-size);
|
|
167
|
+
margin: 0;
|
|
168
|
+
padding: 0;
|
|
169
|
+
border: 2px solid var(--el-color-fg-muted, currentColor);
|
|
170
|
+
border-radius: 50%;
|
|
171
|
+
background: transparent;
|
|
172
|
+
/* The text colour of the page, also where the dot is a button: without a theme it is
|
|
173
|
+
the colour of the ring, of the disc and of the focus ring. */
|
|
174
|
+
color: inherit;
|
|
175
|
+
font-size: inherit;
|
|
176
|
+
line-height: 0;
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
transition:
|
|
179
|
+
border-color var(--el-duration-md, 0s) var(--el-ease, linear),
|
|
180
|
+
border-width var(--el-duration-md, 0s) var(--el-ease, linear);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
[part~='dot']::before {
|
|
184
|
+
content: '';
|
|
185
|
+
position: absolute;
|
|
186
|
+
top: 50%;
|
|
187
|
+
left: 50%;
|
|
188
|
+
width: var(--_el-dot-target);
|
|
189
|
+
height: var(--_el-dot-target);
|
|
190
|
+
transform: translate(-50%, -50%);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@media (hover: hover) {
|
|
194
|
+
[part~='dot']:hover {
|
|
195
|
+
border-color: var(--el-color-accent, currentColor);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
[part~='selected-dot'] {
|
|
200
|
+
border-width: calc(var(--_el-dot-size) / 2);
|
|
201
|
+
border-color: var(--el-color-accent, currentColor);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* The dots are on the page, so their ring is around them, as the one of every control. */
|
|
205
|
+
[part~='dot']:focus-visible {
|
|
206
|
+
outline: var(--el-focus-ring-width, 2px) solid var(--el-color-focus-ring, currentColor);
|
|
207
|
+
outline-offset: var(--el-focus-ring-offset, 2px);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* ── Touch screens ────────────────────────────────────────────────────── */
|
|
211
|
+
|
|
212
|
+
/* An arrow and the square around a dot are at least --el-touch-target. The dot keeps its
|
|
213
|
+
size, and the dots move apart. Without the token the sizes stay as they are. */
|
|
214
|
+
@media (any-pointer: coarse) {
|
|
215
|
+
[part~='arrow'] {
|
|
216
|
+
min-width: max(var(--el-control-height, 2.5rem), var(--el-touch-target, 0px));
|
|
217
|
+
min-height: max(var(--el-control-height, 2.5rem), var(--el-touch-target, 0px));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
[part~='dots'] {
|
|
221
|
+
--_el-dot-target: max(1.5rem, var(--el-touch-target, 0px));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
`;
|
|
225
|
+
}
|