@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
|
@@ -35,10 +35,17 @@ import '@webtides/element-library/input-field/define';
|
|
|
35
35
|
| Name | Type | Default | Description |
|
|
36
36
|
| --- | --- | --- | --- |
|
|
37
37
|
| `name` | `string` | `''` | The name attribute for the input field, used for form submission and identification |
|
|
38
|
-
| `value` | `string` | `null` | The current value of the input field |
|
|
39
|
-
| `type` | `string` | `'text'` | The type of input field (e.g., 'text', 'email', 'password', 'tel', 'url', etc.) |
|
|
38
|
+
| `value` | `string` | `null` | The current value of the input field. A field without one keeps `null` while its control is empty |
|
|
39
|
+
| `type` | `string` | `'text'` | The type of input field (e.g., 'text', 'email', 'password', 'tel', 'url', etc.). For a date or a time use `el-date-field`, which has `min`, `max` and `step`. |
|
|
40
|
+
| `size` | `string` | `'medium'` | `small`, `medium` or `large`: the height, the padding and the font size of the control. Reflected. Shows once `styles/native.css` decorates the control. |
|
|
40
41
|
| `placeholder` | `string` | `''` | Placeholder text displayed when the input is empty |
|
|
41
42
|
| `pattern` | `string\|boolean` | `false` | Regular expression pattern for input validation. If false, allows any input |
|
|
43
|
+
| `autocomplete` | `string` | `null` | Passed on to the control as `autocomplete` (e.g. `email`, `current-password`, `one-time-code`) |
|
|
44
|
+
| `inputmode` | `string` | `null` | Passed on as `inputmode`: the on-screen keyboard to show (e.g. `numeric`, `email`) |
|
|
45
|
+
| `enterkeyhint` | `string` | `null` | Passed on as `enterkeyhint`: the label of the enter key on an on-screen keyboard (e.g. `next`, `send`) |
|
|
46
|
+
| `autocapitalize` | `string` | `null` | Passed on as `autocapitalize` (e.g. `none`, `sentences`) |
|
|
47
|
+
| `autocorrect` | `string` | `null` | Passed on as `autocorrect` (`on` or `off`) |
|
|
48
|
+
| `spellcheck` | `boolean` | `null` | Passed on as `spellcheck` (`true` or `false`) |
|
|
42
49
|
| `required` | `boolean` | `false` | Whether the field is required for form submission |
|
|
43
50
|
| `disabled` | `boolean` | `false` | Whether the field is disabled and cannot be interacted with |
|
|
44
51
|
| `label` | `string` | `''` | Label text displayed above the input field |
|
|
@@ -52,7 +59,7 @@ import '@webtides/element-library/input-field/define';
|
|
|
52
59
|
|
|
53
60
|
| Name | Parameters | Description |
|
|
54
61
|
| --- | --- | --- |
|
|
55
|
-
| `clearInput()` | None | Clears the input value, focuses the field, and resets the touched state |
|
|
62
|
+
| `clearInput()` | None | Clears the input value, focuses the field, and resets the touched state. `value` and `valid` follow, and `input-change` reports the empty value |
|
|
56
63
|
| `onFocus()` | None | Internal method called when input receives focus, updates validation state |
|
|
57
64
|
| `onBlur()` | None | Internal method called when input loses focus, marks field as touched and updates validation |
|
|
58
65
|
| `onChange()` | None | Internal method called when input value changes, updates value and validation state |
|
|
@@ -65,19 +72,41 @@ import '@webtides/element-library/input-field/define';
|
|
|
65
72
|
|
|
66
73
|
#### CSS Custom Properties
|
|
67
74
|
|
|
68
|
-
This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-success`, `--el-color-danger`, `--el-font-size-sm`, `--el-space-2`), on top of the
|
|
75
|
+
This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-success`, `--el-color-danger`, `--el-font-size-sm`, `--el-space-2`), on top of the layout it shares with every field. Skin it by setting these via a theme — see the Storybook _Docs / Theming_ page.
|
|
76
|
+
|
|
77
|
+
The label, the help message, the control and the error message stack in a column, and the texts have one look in every field: see [Layout](../form-field/form-field.readme.md#layout) in the readme of `form-field`.
|
|
78
|
+
|
|
79
|
+
The control itself (border, radius, padding, focus ring) is decorated by `styles/native.css`, which you import beside the theme; without it the control keeps the look of the browser. The `size` changes that decorated control: a small one is 0.8 times `--el-control-height` high, a large one 1.25 times.
|
|
80
|
+
|
|
81
|
+
On a touch screen (`@media (any-pointer: coarse)`) the input is at least `--el-touch-target` high, and the clear cross of an invalid field at least that wide and high. The mark beside the input takes that width while the field is valid too, so the input keeps its width when the validity changes. Without that token, and on a fine pointer, the sizes stay as they are.
|
|
69
82
|
|
|
70
83
|
#### Slots
|
|
71
84
|
|
|
72
85
|
_None_ - The component generates its own input element internally
|
|
73
86
|
|
|
87
|
+
## Keyboard and autofill hints
|
|
88
|
+
|
|
89
|
+
`autocomplete`, `inputmode`, `enterkeyhint`, `autocapitalize`, `autocorrect` and `spellcheck` are passed on to the native control, in server-rendered markup as well. One that is not set is left out on the control.
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<el-input-field
|
|
93
|
+
name="code"
|
|
94
|
+
label="Code"
|
|
95
|
+
autocomplete="one-time-code"
|
|
96
|
+
inputmode="numeric"
|
|
97
|
+
enterkeyhint="done"
|
|
98
|
+
></el-input-field>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Removing one of these attributes later leaves it empty (`autocomplete=""`) on the element and on the control, if it was there when the element started: element-js writes a removed attribute back empty. An empty value has the meaning of the default: on for `spellcheck` and `autocorrect`, the browser's own choice for the other four.
|
|
102
|
+
|
|
74
103
|
## Accessibility
|
|
75
104
|
|
|
76
105
|
- Includes proper ARIA attributes (`aria-describedby`, `aria-invalid`, `aria-errormessage`)
|
|
77
106
|
- Links labels to inputs via `for` attribute
|
|
78
107
|
- Supports screen reader only labels
|
|
79
108
|
- Visual validity indicators (✓ for valid, × for invalid)
|
|
80
|
-
-
|
|
109
|
+
- The error message is an alert (`role="alert"`) and part of the `aria-describedby` of the input while it is shown: a screen reader announces it when it appears and reads it again when the input gets focus
|
|
81
110
|
|
|
82
111
|
## Validation
|
|
83
112
|
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
+
import hostStyle from '../../styles/host.style.js';
|
|
2
|
+
import formControlStyle from '../../styles/form-control.style.js';
|
|
3
|
+
import sizeStyle from '../../styles/size.style.js';
|
|
4
|
+
|
|
1
5
|
const css = String.raw;
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
const style = css`
|
|
4
8
|
el-input-field {
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
gap: var(--el-space-1, 4px);
|
|
8
|
-
|
|
9
9
|
.field {
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
gap: var(--el-space-2, 8px);
|
|
13
|
-
|
|
14
10
|
.validity {
|
|
15
11
|
.valid {
|
|
16
12
|
color: var(--el-color-success, green);
|
|
@@ -22,12 +18,35 @@ export default css`
|
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
/* Touch screens: the control and the clear cross are at least --el-touch-target, whatever
|
|
22
|
+
the size of the field. The mark beside the input keeps that width in both states, so the
|
|
23
|
+
input does not jump when the validity changes. Without the token the sizes stay as they
|
|
24
|
+
are. */
|
|
25
|
+
@media (any-pointer: coarse) {
|
|
26
|
+
input {
|
|
27
|
+
min-height: max(
|
|
28
|
+
calc(var(--el-control-height, 0px) * var(--_el-size-scale, 1)),
|
|
29
|
+
var(--el-touch-target, 0px)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
.validity,
|
|
34
|
+
[data-clear-input] {
|
|
35
|
+
display: grid;
|
|
36
|
+
place-items: center;
|
|
37
|
+
min-width: var(--el-touch-target, auto);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[data-clear-input] {
|
|
41
|
+
min-height: var(--el-touch-target, auto);
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
44
|
}
|
|
33
45
|
`;
|
|
46
|
+
|
|
47
|
+
export default [
|
|
48
|
+
hostStyle('el-input-field'),
|
|
49
|
+
formControlStyle('el-input-field'),
|
|
50
|
+
sizeStyle('el-input-field'),
|
|
51
|
+
style,
|
|
52
|
+
].join('\n');
|
|
@@ -12,6 +12,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
12
12
|
|
|
13
13
|
## Unreleased
|
|
14
14
|
|
|
15
|
+
## [0.3.0] - 2026-11-17
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `close-label` (`closeLabel`): the accessible label of the close button, as on `el-dialog`. Default `'Close'`. Before, the label was fixed, so a screen reader announced the button in English on a page in another language. ([#98](https://github.com/webtides/element-library/issues/98))
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- BREAKING: `variant` speaks the library's shared vocabulary: `neutral` (the default), `brand`, `success`, `warning` and `danger`, as `el-button`, `el-tag` and `el-badge` do. `primary` is `brand` now and `default` is `neutral`; the old values are not mapped, a notification that still uses one of them is painted neutral. Before, `variant="brand"` showed no accent, on a notification and on the toast that `toast('Saved.', { variant: 'brand' })` shows. The colours come from the shared variants module: the stripe has the border colour of the variant, the icon its text colour. `variant` is reflected to the attribute, and the panel in the shadow root no longer has a class for the variant (`notification--success`). ([#119](https://github.com/webtides/element-library/issues/119))
|
|
24
|
+
- BREAKING: the look of the old `neutral`, with the stripe and the icon in `--el-color-fg-muted`, is gone. `neutral` now is what `default` was: the stripe in `--el-color-border`. Its icon has the colour of the text (`--el-color-fg`); in the border colour it could hardly be seen (1.5 to 1 against the panel in the default theme). ([#119](https://github.com/webtides/element-library/issues/119))
|
|
25
|
+
- The icon of a `warning` notification is the warning colour mixed half and half with the colour of the text, as the text of a warning is everywhere else in the library. The plain warning colour is a light one in both schemes and was hard to see on a light panel. The stripe keeps the plain colour. ([#119](https://github.com/webtides/element-library/issues/119))
|
|
26
|
+
- BREAKING: `toast()` is gone, and with it the stack the method built at the top right of the page. `el-toast` shows a notification as a toast: `toast(note)` from `@webtides/element-library/toast` takes the place of `note.toast()`. It shows the notification as it is, in the region of the page, which has a place at every edge, a limit for the toasts that show at once, and lies in the top layer above dialogs. It returns the notification, not a promise: `notification-after-show` tells when it is shown. A page that styled `.el-toast-stack` sets `placement` and `--el-toast-inset` on `el-toast` instead. ([#118](https://github.com/webtides/element-library/issues/118))
|
|
27
|
+
- A notification that is already open when it is first rendered in the browser now appears without the enter transition, the same way a server-rendered one does. Opening it later (`show()`, setting `open`) still animates.
|
|
28
|
+
- On a touch screen (`@media (any-pointer: coarse)`) the close button is at least `--el-touch-target` wide and high (18 × 18 px before). Its icon keeps its size, and a one-line notification grows with the button. Unchanged on a fine pointer and without the token.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- A server-rendered open notification (Declarative Shadow DOM) is visible before its JavaScript runs, and stays visible without JavaScript. It used to be transparent until `connected()` added the `showing` class, and then faded in. A server-rendered closed notification no longer reserves its height before the element is connected. Until the element is connected the resting state follows the `open` attribute; afterwards `show()` / `hide()` animate as before.
|
|
33
|
+
- The default variant icon is drawn again when the element is rendered in the browser (a toast, or a notification a framework creates after load). The icon shapes were a template nested inside the `<svg>`, which put them into the HTML namespace on client render, so the icon was an empty box; server-rendered notifications were not affected. Each variant now renders one complete `<svg>` template.
|
|
34
|
+
|
|
15
35
|
## [0.1.2] - 2026-06-04
|
|
16
36
|
|
|
17
37
|
### Fixed
|
|
@@ -22,7 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
22
42
|
|
|
23
43
|
### Added
|
|
24
44
|
|
|
25
|
-
- Initial release of `el-notification` — an alert/notification that can be shown inline or as a transient toast (`toast()` floats it into a shared top-right stack).
|
|
45
|
+
- Initial release of `el-notification` — an alert/notification that can be shown inline or as a transient toast (`toast()` floats it into a shared top-right stack).
|
|
26
46
|
- Semantic `variant` (`default` / `primary` / `success` / `neutral` / `warning` / `danger`) with per-variant accent + default icon, optional `closable` close button, and optional auto-dismiss (`duration`, default `Infinity`) that pauses while the pointer/focus is inside.
|
|
27
47
|
- `show()` / `hide()` (promise-returning) and `toast()` methods; `notification-show` / `-after-show` / `-hide` / `-after-hide` events; `open` reflected attribute + custom state.
|
|
28
48
|
- The host is exposed as an ARIA live region — `role="alert"` (assertive) for `danger` / `warning`, `role="status"` (polite) otherwise — so toasts are announced when they appear.
|
|
@@ -4,37 +4,15 @@ import Events from './notification.events.js';
|
|
|
4
4
|
import { afterTransition, nextFrame } from '../../utils/transitions.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!toastStack) {
|
|
14
|
-
toastStack = document.createElement('div');
|
|
15
|
-
toastStack.className = 'el-toast-stack';
|
|
16
|
-
Object.assign(toastStack.style, {
|
|
17
|
-
position: 'fixed',
|
|
18
|
-
top: '1rem',
|
|
19
|
-
insetInlineEnd: '1rem',
|
|
20
|
-
zIndex: '9999',
|
|
21
|
-
display: 'flex',
|
|
22
|
-
flexDirection: 'column',
|
|
23
|
-
gap: '0.5rem',
|
|
24
|
-
pointerEvents: 'none',
|
|
25
|
-
});
|
|
26
|
-
document.body.append(toastStack);
|
|
27
|
-
}
|
|
28
|
-
return toastStack;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* A notification / alert that can be shown inline or as a transient toast. Built for both feedback
|
|
33
|
-
* after an action and inline status messages. Semantic variants, an optional close button, and
|
|
34
|
-
* optional auto-dismiss. API modelled on Shoelace's `<sl-alert>`.
|
|
7
|
+
* A notification / alert: feedback after an action, or a status message in the page. Semantic
|
|
8
|
+
* variants, an optional close button, and optional auto-dismiss. It is shown where it stands;
|
|
9
|
+
* `el-toast` shows it as a toast, at an edge of the viewport.
|
|
10
|
+
*
|
|
11
|
+
* The `variant` speaks the library's shared vocabulary for colours, as `el-button` does: the
|
|
12
|
+
* stripe at the start of the panel has the border colour of the variant, the icon its text colour.
|
|
35
13
|
*
|
|
36
14
|
* The host is exposed as an ARIA live region — `role="alert"` (assertive) for `danger` / `warning`
|
|
37
|
-
* variants, `role="status"` (polite) otherwise — so
|
|
15
|
+
* variants, `role="status"` (polite) otherwise — so it is announced when it appears.
|
|
38
16
|
*
|
|
39
17
|
* @element el-notification
|
|
40
18
|
*
|
|
@@ -55,28 +33,35 @@ function getToastStack() {
|
|
|
55
33
|
* @cssstate open - Set while the notification is shown.
|
|
56
34
|
*
|
|
57
35
|
* @property {boolean} open - Whether the notification is shown. Reflected to the `open` attribute.
|
|
58
|
-
* @property {'
|
|
59
|
-
*
|
|
36
|
+
* @property {'neutral'|'brand'|'success'|'warning'|'danger'} variant - Semantic variant, which
|
|
37
|
+
* picks the colours and the icon. Default `'neutral'`. Reflected to the `variant` attribute.
|
|
60
38
|
* @property {boolean} closable - Whether to render a close button. Default `false`.
|
|
39
|
+
* @property {string} closeLabel - Accessible label for the close button. Default `'Close'`.
|
|
61
40
|
* @property {number} duration - Auto-dismiss delay in milliseconds; `Infinity` (default) never
|
|
62
41
|
* auto-dismisses. The countdown pauses while the pointer or focus is inside the notification.
|
|
63
42
|
*/
|
|
64
43
|
export default class Notification extends TemplateElement {
|
|
65
44
|
constructor() {
|
|
66
|
-
super({
|
|
45
|
+
super({
|
|
46
|
+
shadowRender: true,
|
|
47
|
+
styles: [style],
|
|
48
|
+
// The shared variants module selects the host by the `variant` attribute.
|
|
49
|
+
propertyOptions: { open: { reflect: true }, variant: { reflect: true } },
|
|
50
|
+
});
|
|
67
51
|
}
|
|
68
52
|
|
|
69
53
|
properties() {
|
|
70
54
|
return {
|
|
71
55
|
open: false,
|
|
72
|
-
variant: '
|
|
56
|
+
variant: 'neutral',
|
|
73
57
|
closable: false,
|
|
58
|
+
closeLabel: 'Close',
|
|
74
59
|
duration: Infinity,
|
|
75
60
|
};
|
|
76
61
|
}
|
|
77
62
|
|
|
78
63
|
connected() {
|
|
79
|
-
// Expose the host as a live region so
|
|
64
|
+
// Expose the host as a live region so it is announced. Assertive for danger/warning.
|
|
80
65
|
const assertive = this.variant === 'danger' || this.variant === 'warning';
|
|
81
66
|
this.setAttribute('role', assertive ? 'alert' : 'status');
|
|
82
67
|
this.setAttribute('aria-live', assertive ? 'assertive' : 'polite');
|
|
@@ -109,7 +94,7 @@ export default class Notification extends TemplateElement {
|
|
|
109
94
|
click: () => this.hide(),
|
|
110
95
|
},
|
|
111
96
|
"[part~='base']": {
|
|
112
|
-
// Pause the auto-dismiss countdown while the user is interacting with
|
|
97
|
+
// Pause the auto-dismiss countdown while the user is interacting with it.
|
|
113
98
|
mouseenter: () => clearTimeout(this._autoHideTimer),
|
|
114
99
|
mouseleave: () => this._startAutoHide(),
|
|
115
100
|
focusin: () => clearTimeout(this._autoHideTimer),
|
|
@@ -140,15 +125,6 @@ export default class Notification extends TemplateElement {
|
|
|
140
125
|
return done;
|
|
141
126
|
}
|
|
142
127
|
|
|
143
|
-
/**
|
|
144
|
-
* Moves the notification into the shared top-right toast stack and shows it.
|
|
145
|
-
* @returns {Promise<void>} Resolves after the open transition has finished.
|
|
146
|
-
*/
|
|
147
|
-
toast() {
|
|
148
|
-
getToastStack().append(this);
|
|
149
|
-
return this.show();
|
|
150
|
-
}
|
|
151
|
-
|
|
152
128
|
/** @private */
|
|
153
129
|
async _applyOpen() {
|
|
154
130
|
const base = this.$refs.base;
|
|
@@ -181,7 +157,6 @@ export default class Notification extends TemplateElement {
|
|
|
181
157
|
|
|
182
158
|
this._internals.states.delete('open');
|
|
183
159
|
this.dispatch(Events.AFTER_HIDE);
|
|
184
|
-
this._removeFromToastStack();
|
|
185
160
|
}
|
|
186
161
|
|
|
187
162
|
/** @private */
|
|
@@ -192,17 +167,6 @@ export default class Notification extends TemplateElement {
|
|
|
192
167
|
}
|
|
193
168
|
}
|
|
194
169
|
|
|
195
|
-
/** @private */
|
|
196
|
-
_removeFromToastStack() {
|
|
197
|
-
if (toastStack && this.parentElement === toastStack) {
|
|
198
|
-
this.remove();
|
|
199
|
-
if (toastStack.childElementCount === 0) {
|
|
200
|
-
toastStack.remove();
|
|
201
|
-
toastStack = null;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
170
|
/** @private */
|
|
207
171
|
_once(name) {
|
|
208
172
|
return new Promise((resolve) => this.addEventListener(name, () => resolve(), { once: true }));
|
|
@@ -211,7 +175,7 @@ export default class Notification extends TemplateElement {
|
|
|
211
175
|
/** @private */
|
|
212
176
|
closeButtonTemplate() {
|
|
213
177
|
return html`
|
|
214
|
-
<button part="close-button" type="button" class="close-button" aria-label="
|
|
178
|
+
<button part="close-button" type="button" class="close-button" aria-label="${this.closeLabel}" data-close>
|
|
215
179
|
<svg
|
|
216
180
|
viewBox="0 0 24 24"
|
|
217
181
|
fill="none"
|
|
@@ -231,7 +195,7 @@ export default class Notification extends TemplateElement {
|
|
|
231
195
|
template() {
|
|
232
196
|
return html`
|
|
233
197
|
<div part="base" ref="base">
|
|
234
|
-
<div part="panel" class="panel
|
|
198
|
+
<div part="panel" class="panel">
|
|
235
199
|
<span part="icon" class="icon"><slot name="icon">${this.variantIconTemplate()}</slot></span>
|
|
236
200
|
<div part="message" class="message"><slot></slot></div>
|
|
237
201
|
${this.closable ? this.closeButtonTemplate() : ''}
|
|
@@ -242,21 +206,61 @@ export default class Notification extends TemplateElement {
|
|
|
242
206
|
|
|
243
207
|
/** @private */
|
|
244
208
|
variantIconTemplate() {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
<
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
209
|
+
// Every variant is one complete <svg> template. A template result nested inside the <svg> is
|
|
210
|
+
// parsed on its own, which puts its children into the HTML namespace when the element renders
|
|
211
|
+
// in the browser, so nothing would be drawn.
|
|
212
|
+
if (this.variant === 'success') {
|
|
213
|
+
return html`
|
|
214
|
+
<svg
|
|
215
|
+
viewBox="0 0 24 24"
|
|
216
|
+
fill="none"
|
|
217
|
+
stroke="currentColor"
|
|
218
|
+
stroke-width="2"
|
|
219
|
+
stroke-linecap="round"
|
|
220
|
+
stroke-linejoin="round"
|
|
221
|
+
aria-hidden="true"
|
|
222
|
+
>
|
|
223
|
+
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
|
|
224
|
+
<polyline points="22 4 12 14.01 9 11.01"></polyline>
|
|
225
|
+
</svg>
|
|
226
|
+
`;
|
|
227
|
+
}
|
|
228
|
+
if (this.variant === 'danger') {
|
|
229
|
+
return html`
|
|
230
|
+
<svg
|
|
231
|
+
viewBox="0 0 24 24"
|
|
232
|
+
fill="none"
|
|
233
|
+
stroke="currentColor"
|
|
234
|
+
stroke-width="2"
|
|
235
|
+
stroke-linecap="round"
|
|
236
|
+
stroke-linejoin="round"
|
|
237
|
+
aria-hidden="true"
|
|
238
|
+
>
|
|
239
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
240
|
+
<line x1="12" y1="8" x2="12" y2="12"></line>
|
|
241
|
+
<line x1="12" y1="16" x2="12.01" y2="16"></line>
|
|
242
|
+
</svg>
|
|
243
|
+
`;
|
|
244
|
+
}
|
|
245
|
+
if (this.variant === 'warning') {
|
|
246
|
+
return html`
|
|
247
|
+
<svg
|
|
248
|
+
viewBox="0 0 24 24"
|
|
249
|
+
fill="none"
|
|
250
|
+
stroke="currentColor"
|
|
251
|
+
stroke-width="2"
|
|
252
|
+
stroke-linecap="round"
|
|
253
|
+
stroke-linejoin="round"
|
|
254
|
+
aria-hidden="true"
|
|
255
|
+
>
|
|
256
|
+
<path
|
|
257
|
+
d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"
|
|
258
|
+
></path>
|
|
259
|
+
<line x1="12" y1="9" x2="12" y2="13"></line>
|
|
260
|
+
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
|
261
|
+
</svg>
|
|
262
|
+
`;
|
|
263
|
+
}
|
|
260
264
|
return html`
|
|
261
265
|
<svg
|
|
262
266
|
viewBox="0 0 24 24"
|
|
@@ -267,7 +271,9 @@ export default class Notification extends TemplateElement {
|
|
|
267
271
|
stroke-linejoin="round"
|
|
268
272
|
aria-hidden="true"
|
|
269
273
|
>
|
|
270
|
-
|
|
274
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
275
|
+
<line x1="12" y1="16" x2="12" y2="12"></line>
|
|
276
|
+
<line x1="12" y1="8" x2="12.01" y2="8"></line>
|
|
271
277
|
</svg>
|
|
272
278
|
`;
|
|
273
279
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Notification
|
|
2
2
|
|
|
3
|
-
`notification` is an alert / notification that
|
|
3
|
+
`notification` is an alert / notification that is shown **inline**, or as a transient **toast** by [`el-toast`](../toast/toast.readme.md). It carries a semantic variant, a leading icon, an optional close button and optional auto-dismiss. The host is exposed as an ARIA live region, so toasts are announced when they appear.
|
|
4
4
|
|
|
5
5
|
It is headless-leaning by default: colors come from the `--el-*` tokens, with system-color fallbacks (`Canvas` / `CanvasText`) so an unthemed floating toast is still readable.
|
|
6
6
|
|
|
@@ -26,15 +26,43 @@ import '@webtides/element-library/notification/define';
|
|
|
26
26
|
|
|
27
27
|
#### As a toast
|
|
28
28
|
|
|
29
|
+
The region `el-toast` shows a notification as a toast: at an edge of the viewport, in a stack, above everything of the page. Its function takes a text, or a notification of your own:
|
|
30
|
+
|
|
29
31
|
```js
|
|
32
|
+
import { toast } from '@webtides/element-library/toast';
|
|
33
|
+
|
|
34
|
+
toast('Saved to your library.', { variant: 'success', duration: 3000 });
|
|
35
|
+
|
|
30
36
|
const note = document.createElement('el-notification');
|
|
31
37
|
note.variant = 'success';
|
|
32
|
-
note.
|
|
33
|
-
note
|
|
34
|
-
note.textContent = 'Saved to your library.';
|
|
35
|
-
note.toast(); // floats it into the shared top-right stack and shows it
|
|
38
|
+
note.innerHTML = '<svg slot="icon" …></svg>Saved to your library.';
|
|
39
|
+
toast(note);
|
|
36
40
|
```
|
|
37
41
|
|
|
42
|
+
#### Variants
|
|
43
|
+
|
|
44
|
+
The `variant` is the one of the library's shared vocabulary, as on `el-button`, `el-tag` and `el-badge`: `neutral` (the default), `brand`, `success`, `warning` and `danger`. So the word that paints a button also paints the toast that reports what the button did.
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<el-notification variant="brand" open="true">A new version is available.</el-notification>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The stripe at the start of the panel has the border colour of the variant, the icon its text colour:
|
|
51
|
+
|
|
52
|
+
| Variant | Stripe | Icon |
|
|
53
|
+
| --------- | -------------------- | ----------------------------------------- |
|
|
54
|
+
| `neutral` | `--el-color-border` | `--el-color-fg` |
|
|
55
|
+
| `brand` | `--el-color-accent` | `--el-color-accent` |
|
|
56
|
+
| `success` | `--el-color-success` | `--el-color-success` |
|
|
57
|
+
| `warning` | `--el-color-warning` | `--el-color-warning`, mixed with the text |
|
|
58
|
+
| `danger` | `--el-color-danger` | `--el-color-danger` |
|
|
59
|
+
|
|
60
|
+
`success`, `warning` and `danger` have an icon of their own, the others the same one. `warning` and `danger` are announced at once (`role="alert"`), the others when the screen reader is idle (`role="status"`).
|
|
61
|
+
|
|
62
|
+
#### Server-rendered
|
|
63
|
+
|
|
64
|
+
An open notification rendered on the server (Declarative Shadow DOM) is visible before its JavaScript loads, and without JavaScript. Until the element is connected, its visibility follows the `open` attribute; from then on `show()` / `hide()` animate as usual. A notification that is open from its first render appears without the enter transition.
|
|
65
|
+
|
|
38
66
|
## API
|
|
39
67
|
|
|
40
68
|
#### Properties/Attributes
|
|
@@ -42,17 +70,17 @@ note.toast(); // floats it into the shared top-right stack and shows it
|
|
|
42
70
|
| Name | Type | Default | Description |
|
|
43
71
|
| --- | --- | --- | --- |
|
|
44
72
|
| `open` | `boolean` | `false` | Whether the notification is shown. Reflected to the `open` attribute. |
|
|
45
|
-
| `variant` | `'
|
|
73
|
+
| `variant` | `'neutral' \| 'brand' \| 'success' \| 'warning' \| 'danger'` | `'neutral'` | Semantic variant: the colour of the stripe and of the icon, and the icon. Reflected to the `variant` attribute. |
|
|
46
74
|
| `closable` | `boolean` | `false` | Whether to render a close button. |
|
|
75
|
+
| `close-label` | `string` | `'Close'` | Accessible label for the close button. |
|
|
47
76
|
| `duration` | `number` | `Infinity` | Auto-dismiss delay in ms. Pauses while pointer/focus is inside. |
|
|
48
77
|
|
|
49
78
|
#### Methods
|
|
50
79
|
|
|
51
|
-
| Name
|
|
52
|
-
|
|
|
53
|
-
| `show()`
|
|
54
|
-
| `hide()`
|
|
55
|
-
| `toast()` | `Promise<void>` | Moves it into the shared top-right toast stack and shows it. |
|
|
80
|
+
| Name | Returns | Description |
|
|
81
|
+
| -------- | --------------- | ------------------------------------------------------------ |
|
|
82
|
+
| `show()` | `Promise<void>` | Shows the notification; resolves after the open transition. |
|
|
83
|
+
| `hide()` | `Promise<void>` | Hides the notification; resolves after the close transition. |
|
|
56
84
|
|
|
57
85
|
#### Events
|
|
58
86
|
|
|
@@ -88,11 +116,24 @@ note.toast(); // floats it into the shared top-right stack and shows it
|
|
|
88
116
|
|
|
89
117
|
#### CSS Custom Properties
|
|
90
118
|
|
|
91
|
-
Reads `--el-color-bg` / `--el-color-fg`, `--el-color-border`, the variant colors (`--el-color-accent` / `--el-color-success` / `--el-color-
|
|
119
|
+
Reads `--el-color-bg` / `--el-color-fg`, `--el-color-border`, the variant colors (`--el-color-accent` / `--el-color-success` / `--el-color-warning` / `--el-color-danger`), `--el-radius-md`, `--el-shadow-lg`, `--el-space-*`, `--el-duration-md` and `--el-ease`. See the Storybook _Docs / Theming_ page.
|
|
120
|
+
|
|
121
|
+
On a touch screen (`@media (any-pointer: coarse)`) the close button is at least `--el-touch-target` wide and high. Its icon keeps its size. Without that token, and on a fine pointer, the sizes stay as they are.
|
|
92
122
|
|
|
93
123
|
## Accessibility
|
|
94
124
|
|
|
95
125
|
- The host is a live region: `role="alert"` + `aria-live="assertive"` for `danger` / `warning`, `role="status"` + `aria-live="polite"` otherwise — so a toast is announced when it appears.
|
|
96
126
|
- The auto-dismiss countdown pauses while the pointer or keyboard focus is inside the notification, so it can't disappear out from under someone reading or interacting with it.
|
|
97
|
-
- The close button is a real `<button>` with an accessible name.
|
|
127
|
+
- The close button is a real `<button>` with an accessible name, "Close" by default. Set `close-label` to translate it.
|
|
98
128
|
- The transition collapses under `prefers-reduced-motion: reduce`.
|
|
129
|
+
|
|
130
|
+
## Migrating from the six variants
|
|
131
|
+
|
|
132
|
+
Before, the notification had six variants of its own. The old values are not mapped; a notification that still uses one of them is painted neutral.
|
|
133
|
+
|
|
134
|
+
| Before | Now |
|
|
135
|
+
| ---------------------------------------------- | --------------------------------------------------------------- |
|
|
136
|
+
| `variant="default"` (or none) | `variant="neutral"` (or none) |
|
|
137
|
+
| `variant="primary"` | `variant="brand"` |
|
|
138
|
+
| `variant="success"`, `"warning"`, `"danger"` | unchanged |
|
|
139
|
+
| `variant="neutral"` (stripe in the muted text) | no successor: `neutral` has the stripe in the border colour now |
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import variantsStyle from '../../styles/variants.style.js';
|
|
2
|
+
|
|
1
3
|
const css = String.raw;
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
const style = css`
|
|
4
6
|
:host {
|
|
5
7
|
display: block;
|
|
6
8
|
pointer-events: auto;
|
|
@@ -28,6 +30,23 @@ export default css`
|
|
|
28
30
|
display: none;
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
/*
|
|
34
|
+
* Before the element is connected: server-rendered markup (Declarative Shadow DOM) is already on
|
|
35
|
+
* the page, but connected() has not run yet, or never will without JavaScript, so nothing has set
|
|
36
|
+
* "showing" / "is-hidden". Until then the resting state comes from the open attribute: an open
|
|
37
|
+
* notification is visible, a closed one takes no space. element-js adds the "connected" state
|
|
38
|
+
* right after connected(), which hands control back to the classes above without a transition.
|
|
39
|
+
*/
|
|
40
|
+
:host(:not(:state(connected))[open]:not([open='false'])) [part~='base'] {
|
|
41
|
+
opacity: 1;
|
|
42
|
+
transform: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host(:not(:state(connected)):not([open])) [part~='base'],
|
|
46
|
+
:host(:not(:state(connected))[open='false']) [part~='base'] {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
31
50
|
.panel {
|
|
32
51
|
display: flex;
|
|
33
52
|
align-items: flex-start;
|
|
@@ -38,36 +57,21 @@ export default css`
|
|
|
38
57
|
background: var(--el-color-bg, Canvas);
|
|
39
58
|
color: var(--el-color-fg, CanvasText);
|
|
40
59
|
border: var(--el-border-width, 1px) solid var(--el-color-border, currentColor);
|
|
41
|
-
|
|
60
|
+
/* The stripe that carries the variant: its border colour, from the variants module. For
|
|
61
|
+
neutral that is the border of the theme. */
|
|
62
|
+
border-inline-start: 4px solid var(--_el-variant-border);
|
|
42
63
|
border-radius: var(--el-radius-md, 0);
|
|
43
64
|
box-shadow: var(--el-shadow-lg, none);
|
|
44
65
|
min-width: 18rem;
|
|
45
66
|
max-width: 28rem;
|
|
46
67
|
}
|
|
47
68
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
.notification--primary {
|
|
52
|
-
--variant-color: var(--el-color-accent, currentColor);
|
|
53
|
-
}
|
|
54
|
-
.notification--success {
|
|
55
|
-
--variant-color: var(--el-color-success, currentColor);
|
|
56
|
-
}
|
|
57
|
-
.notification--neutral {
|
|
58
|
-
--variant-color: var(--el-color-fg-muted, currentColor);
|
|
59
|
-
}
|
|
60
|
-
.notification--warning {
|
|
61
|
-
--variant-color: var(--el-color-warning, #f59e0b);
|
|
62
|
-
}
|
|
63
|
-
.notification--danger {
|
|
64
|
-
--variant-color: var(--el-color-danger, currentColor);
|
|
65
|
-
}
|
|
66
|
-
|
|
69
|
+
/* The icon stands on the background of the panel and has the text colour of the variant: the
|
|
70
|
+
colour of the text for neutral, and a warning colour that is mixed with it to be seen. */
|
|
67
71
|
[part~='icon'] {
|
|
68
72
|
display: inline-flex;
|
|
69
73
|
flex: none;
|
|
70
|
-
color: var(--variant-
|
|
74
|
+
color: var(--_el-variant-text);
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
[part~='icon'] svg {
|
|
@@ -105,9 +109,20 @@ export default css`
|
|
|
105
109
|
height: 1.1rem;
|
|
106
110
|
}
|
|
107
111
|
|
|
112
|
+
/* Touch screens: the close button is at least --el-touch-target, the icon keeps its size.
|
|
113
|
+
Without the token the sizes stay as they are. */
|
|
114
|
+
@media (any-pointer: coarse) {
|
|
115
|
+
.close-button {
|
|
116
|
+
min-width: var(--el-touch-target, auto);
|
|
117
|
+
min-height: var(--el-touch-target, auto);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
108
121
|
@media (prefers-reduced-motion: reduce) {
|
|
109
122
|
[part~='base'] {
|
|
110
123
|
transition-duration: 0s;
|
|
111
124
|
}
|
|
112
125
|
}
|
|
113
126
|
`;
|
|
127
|
+
|
|
128
|
+
export default [variantsStyle(), style].join('\n');
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
When your PR touches this component, add an entry under Unreleased and
|
|
9
|
+
mirror it (prefixed with the component name) in root CHANGELOG.md.
|
|
10
|
+
Uncomment headings as needed.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.3.0] - 2026-11-17
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Initial `el-otp-field`: an `el-input-field` for a one-time code, the short code of a second factor. One native `<input>` for the whole code, so the code from an SMS, a paste, a password manager and a screen reader work on one control. ([#141](https://github.com/webtides/element-library/issues/141))
|
|
20
|
+
- `length` is the number of characters of the code (`6` by default). Without further attributes the control has `autocomplete="one-time-code"`, `inputmode="numeric"` and a pattern of `length` digits; each of them can be set to something else, a pattern for a code with letters for example.
|
|
21
|
+
- Spaces and hyphens are taken out of what is typed, pasted or filled in, and the code is cut at `length`: a pasted `123 456` is `123456`. A code that is full takes no further key, as an input with `maxlength` does. Nothing else is filtered; a code that does not fit the pattern is not valid.
|
|
22
|
+
- `input-complete` is fired once when the user has entered a code of full length that is valid, with the code as its detail, and again after the code was changed and completed again. It is not fired for a value a script sets.
|
|
23
|
+
- With `styles/native.css` the control has the look and the three sizes of the input of `el-input-field`.
|