@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webtides/element-library",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A set of web components built with @webtides/element-js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"types": "./types/all.d.ts",
|
|
16
16
|
"default": "./all.js"
|
|
17
17
|
},
|
|
18
|
+
"./catalog": {
|
|
19
|
+
"types": "./catalog.d.ts",
|
|
20
|
+
"default": "./catalog.js"
|
|
21
|
+
},
|
|
18
22
|
"./*": {
|
|
19
23
|
"types": "./types/src/components/*/*.d.ts",
|
|
20
24
|
"default": "./src/components/*/*.js"
|
|
@@ -24,6 +28,7 @@
|
|
|
24
28
|
"default": "./src/components/*/*.define.js"
|
|
25
29
|
},
|
|
26
30
|
"./themes/*.css": "./src/themes/*.css",
|
|
31
|
+
"./styles/*.css": "./src/styles/*.css",
|
|
27
32
|
"./custom-elements.json": "./custom-elements.json",
|
|
28
33
|
"./web-types.json": "./web-types.json",
|
|
29
34
|
"./package.json": "./package.json"
|
|
@@ -40,9 +45,14 @@
|
|
|
40
45
|
"!src/components/**/*.stories.js",
|
|
41
46
|
"!src/components/**/*.test.*.js",
|
|
42
47
|
"src/utils/**/*.js",
|
|
48
|
+
"src/styles/**/*.js",
|
|
49
|
+
"!src/styles/**/*.test.*.js",
|
|
50
|
+
"src/styles/*.css",
|
|
43
51
|
"src/themes/*.css",
|
|
44
52
|
"types/**/*.d.ts",
|
|
45
53
|
"all.js",
|
|
54
|
+
"catalog.js",
|
|
55
|
+
"catalog.d.ts",
|
|
46
56
|
"index.js",
|
|
47
57
|
"custom-elements.json",
|
|
48
58
|
"web-types.json",
|
|
@@ -70,8 +80,9 @@
|
|
|
70
80
|
"node": ">=20.19.0"
|
|
71
81
|
},
|
|
72
82
|
"dependencies": {
|
|
83
|
+
"@floating-ui/dom": "^1.8.0",
|
|
73
84
|
"@glidejs/glide": "~3.6.2",
|
|
74
|
-
"@webtides/element-js": "^1.
|
|
85
|
+
"@webtides/element-js": "^1.3.1",
|
|
75
86
|
"lozad": "^1.16.0"
|
|
76
87
|
},
|
|
77
88
|
"devDependencies": {
|
|
@@ -82,49 +93,50 @@
|
|
|
82
93
|
"@storybook/addon-vitest": "^10.4.1",
|
|
83
94
|
"@storybook/web-components": "^10.4.1",
|
|
84
95
|
"@storybook/web-components-vite": "^10.4.1",
|
|
85
|
-
"@vitest/browser": "
|
|
86
|
-
"@vitest/
|
|
87
|
-
"@vitest/
|
|
88
|
-
"@
|
|
96
|
+
"@vitest/browser-playwright": "5.1.0",
|
|
97
|
+
"@vitest/coverage-istanbul": "5.1.0",
|
|
98
|
+
"@vitest/ui": "5.1.0",
|
|
99
|
+
"@webtides/element-js-ssr-renderer": "^0.4.0",
|
|
89
100
|
"axe-core": "^4.12.0",
|
|
90
101
|
"custom-element-jet-brains-integration": "^1.7.0",
|
|
91
|
-
"eslint": "^10.4.1",
|
|
92
|
-
"eslint-config-prettier": "^10.1.8",
|
|
93
|
-
"eslint-plugin-import": "^2.32.0",
|
|
94
|
-
"eslint-plugin-prettier": "^5.5.6",
|
|
95
|
-
"eslint-plugin-storybook": "^10.4.1",
|
|
96
|
-
"globals": "^17.6.0",
|
|
97
102
|
"husky": "^9.1.7",
|
|
98
103
|
"lint-staged": "^17.0.7",
|
|
99
104
|
"lit": "^3.3.3",
|
|
100
105
|
"playwright": "^1.60.0",
|
|
101
|
-
"prettier": "^3.
|
|
106
|
+
"prettier": "^3.9.10",
|
|
102
107
|
"storybook": "^10.4.1",
|
|
103
|
-
"typescript": "^
|
|
104
|
-
"vite": "
|
|
105
|
-
"
|
|
108
|
+
"typescript": "^7.0.2",
|
|
109
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.5.1",
|
|
110
|
+
"vite-plus": "1.5.1",
|
|
111
|
+
"vitest": "5.1.0"
|
|
106
112
|
},
|
|
107
113
|
"scripts": {
|
|
108
114
|
"dev": "storybook dev -p 3000 --no-open",
|
|
109
|
-
"lint": "
|
|
110
|
-
"test": "
|
|
111
|
-
"test:coverage": "
|
|
112
|
-
"test:watch": "
|
|
113
|
-
"test:ui": "
|
|
115
|
+
"lint": "vp lint",
|
|
116
|
+
"test": "vp test run",
|
|
117
|
+
"test:coverage": "vp test run --coverage",
|
|
118
|
+
"test:watch": "vp test",
|
|
119
|
+
"test:ui": "vp test --ui",
|
|
114
120
|
"build-storybook": "storybook build",
|
|
115
121
|
"analyze": "cem analyze --config custom-elements-manifest.config.mjs --outdir .",
|
|
116
122
|
"analyze:watch": "cem analyze --config custom-elements-manifest.config.mjs --outdir . --watch",
|
|
117
123
|
"build:types": "tsc -p tsconfig.json",
|
|
118
|
-
"
|
|
124
|
+
"gen:catalog": "npx -y @webtides/element-js-ssr-renderer catalog --manifest custom-elements.json -o catalog.js && vp fmt catalog.js",
|
|
125
|
+
"test:catalog": "npm run gen:catalog && node test/catalog.smoke.mjs && tsc -p test/tsconfig.catalog.json",
|
|
126
|
+
"prepack": "npm run analyze && npm run build:types && npm run gen:catalog",
|
|
119
127
|
"prepare": "husky && npm run analyze && npm run build:types"
|
|
120
128
|
},
|
|
121
129
|
"lint-staged": {
|
|
122
130
|
"*.js": [
|
|
123
|
-
"
|
|
124
|
-
"
|
|
131
|
+
"vp lint --fix",
|
|
132
|
+
"vp fmt"
|
|
125
133
|
],
|
|
126
134
|
"*.{yaml,yml,md,json}": [
|
|
127
|
-
"
|
|
135
|
+
"vp fmt"
|
|
128
136
|
]
|
|
137
|
+
},
|
|
138
|
+
"overrides": {
|
|
139
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.5.1",
|
|
140
|
+
"vitest": "5.1.0"
|
|
129
141
|
}
|
|
130
142
|
}
|
|
@@ -12,6 +12,16 @@ 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
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- On a touch screen (`@media (any-pointer: coarse)`) the header is at least `--el-touch-target` high. With the default and the sketchy theme it already was; with the high-contrast theme it was 46 px with a target of 48 px. Unchanged on a fine pointer and without the token.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- `collapse()` no longer throws `Cannot read properties of undefined (reading 'style')` when the accordion is removed from the DOM before its two animation frames have run (for example a closed accordion that is connected and removed again right away). The content node is now captured up front instead of being read from `$refs` inside the frames, which element-js clears on disconnect.
|
|
24
|
+
|
|
15
25
|
## [0.1.0] - 2026-06-03
|
|
16
26
|
|
|
17
27
|
### Added
|
|
@@ -76,21 +76,24 @@ export default class Accordion extends TemplateElement {
|
|
|
76
76
|
* @returns {void}
|
|
77
77
|
*/
|
|
78
78
|
collapse() {
|
|
79
|
-
|
|
79
|
+
// Hold on to the node: the frames below can run after the element was
|
|
80
|
+
// disconnected, and element-js clears `$refs` on disconnect.
|
|
81
|
+
const content = this.$refs.content;
|
|
82
|
+
const contentHeight = content.scrollHeight;
|
|
80
83
|
|
|
81
|
-
const elementTransition =
|
|
82
|
-
|
|
84
|
+
const elementTransition = content.style.transition;
|
|
85
|
+
content.style.transition = '';
|
|
83
86
|
|
|
84
87
|
requestAnimationFrame(() => {
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
content.style.height = contentHeight + 'px';
|
|
89
|
+
content.style.transition = elementTransition;
|
|
87
90
|
|
|
88
91
|
requestAnimationFrame(() => {
|
|
89
|
-
|
|
92
|
+
content.style.height = 0 + 'px';
|
|
90
93
|
});
|
|
91
94
|
});
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
content.setAttribute('data-collapsed', 'true');
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
/**
|
|
@@ -63,6 +63,8 @@ import '@webtides/element-library/accordion/define';
|
|
|
63
63
|
|
|
64
64
|
This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-bg`, `--el-color-border`, `--el-radius-md`, `--el-space-3`, `--el-duration-md`). Skin it by setting these via a theme — see the Storybook _Docs / Theming_ page.
|
|
65
65
|
|
|
66
|
+
On a touch screen (`@media (any-pointer: coarse)`) the header is at least `--el-touch-target` high. Without that token, and on a fine pointer, the sizes stay as they are.
|
|
67
|
+
|
|
66
68
|
#### Slots
|
|
67
69
|
|
|
68
70
|
| Name | Description |
|
|
@@ -27,6 +27,14 @@ export default css`
|
|
|
27
27
|
border-bottom-color: var(--el-color-border, transparent);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/* Touch screens: the header is at least --el-touch-target high. Its padding grows around one
|
|
31
|
+
line of text, so the header stays centered. Without the token the sizes stay as they are. */
|
|
32
|
+
@media (any-pointer: coarse) {
|
|
33
|
+
[part~='title'] {
|
|
34
|
+
padding-block: max(var(--el-space-3, 0px), calc((var(--el-touch-target, 0px) - 1lh) / 2));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
.icon {
|
|
31
39
|
display: flex;
|
|
32
40
|
flex-shrink: 0;
|
|
@@ -10,11 +10,31 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
10
10
|
Uncomment headings as needed.
|
|
11
11
|
-->
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.3.0] - 2026-11-17
|
|
16
|
+
|
|
14
17
|
<!-- ### Added -->
|
|
15
|
-
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- BREAKING: the field renders into the page, as every other field, and no longer into a shadow root. The slots `plus` and `minus` and all CSS parts are gone. The signs of the buttons are CSS strings now, `--el-amount-field-plus` and `--el-amount-field-minus`, and a stylesheet selects the elements of the field in the page: `el-amount-field .stepper`, `.step`, `.plus`, `.minus`, `input`, `label`, `.help-message` and `.error-message`. The readme has the table for the move. The look is the same in every theme. ([#105](https://github.com/webtides/element-library/issues/105))
|
|
22
|
+
- The buttons have an accessible name, `plusLabel` (`Increase`) and `minusLabel` (`Decrease`). It was their sign, `+` and `-`. ([#105](https://github.com/webtides/element-library/issues/105))
|
|
23
|
+
- On a touch screen (`@media (any-pointer: coarse)`) the plus and minus buttons are at least `--el-touch-target` wide, and the input is as high as the buttons. With the default theme the buttons were 33 and 29 px wide and the input 34 px high. The height of the buttons follows the token on every pointer, as before. Unchanged on a fine pointer and without the token.
|
|
24
|
+
- The `label` is rendered: a `<label>` above the stepper that names the number input. Before, the field took the attribute and showed nothing, and the input had no accessible name (axe `label`). ([#94](https://github.com/webtides/element-library/issues/94))
|
|
25
|
+
- The label, the help message, the stepper and the error message stack in a column with a gap of `--el-space-1`, as in every field. The field is a flex container for that (`display: flex`; it was `inline`), and the `hidden` attribute hides it as before. With a theme, a field without messages measures what it did. Without a theme the label is 4 px above the stepper; it had no gap there. ([#131](https://github.com/webtides/element-library/issues/131))
|
|
26
|
+
|
|
16
27
|
<!-- ### Removed -->
|
|
17
|
-
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- The field takes part in a native `<form>`. Its value is submitted under its `name`, a `disabled` field is left out, a `<fieldset disabled>` disables it, and `form.reset()` brings back the value it was rendered with. Before, the input was in a shadow root and belonged to no form: nothing was submitted. In server-rendered markup the input is there with its name and value, so a form that is submitted before the script has run has the rendered value. ([#105](https://github.com/webtides/element-library/issues/105))
|
|
32
|
+
- A bound that is not set leaves its attribute out of the input. Before, `max="false"` was written to it. ([#105](https://github.com/webtides/element-library/issues/105))
|
|
33
|
+
- The buttons of a `disabled` field are disabled with its input. Before, they changed the value of a disabled field, took the focus and looked enabled. ([#156](https://github.com/webtides/element-library/issues/156))
|
|
34
|
+
- The stepper of a disabled field fades as a whole (`opacity: 0.55`, as the control of every other field) and has the cursor `not-allowed`, by the `disabled` of the field and by a `<fieldset disabled>` around it. Before, the number of a disabled field looked like the one of an enabled field. A button at its bound in an enabled field fades alone, as before. ([#158](https://github.com/webtides/element-library/issues/158))
|
|
35
|
+
- The stepper shows the keyboard focus on each of its parts: a ring inside of the button or the input that has it, `--el-focus-ring-width` wide in `--el-color-focus-ring`, and 2 px in the colour of the text without a theme. Before, the input showed nothing, and the stepper cut off the ring of the browser around a button. At rest the field looks as before. ([#157](https://github.com/webtides/element-library/issues/157))
|
|
36
|
+
- The `helpMessage` and the `errorMessage` are rendered. The field took both and showed neither, and the `aria-describedby` of its input named an element that did not exist. The help message stands between the label and the stepper. The error message is shown below the stepper while the field is touched and not valid, as an alert (`role="alert"`). The input names the help message in `aria-describedby`, and the error message while it is shown. Both have the look of the messages of every field: `--el-font-size-sm`, the muted and the danger colour of the theme, the colour of the text without one. ([#131](https://github.com/webtides/element-library/issues/131))
|
|
37
|
+
- The input says whether the field is valid (`aria-invalid`). Before, the error message reached a screen reader and the state of the control did not, while the control of `el-input-field` and of `el-select-field` has said it all along. ([#134](https://github.com/webtides/element-library/issues/134))
|
|
18
38
|
|
|
19
39
|
## [0.1.0] - 2026-06-03
|
|
20
40
|
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineElement, html } from '@webtides/element-js';
|
|
2
2
|
import FormField from '../form-field/form-field.js';
|
|
3
3
|
import style from './amount-field.style.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Numeric amount stepper input. Renders a readonly `<input type="number">` flanked by
|
|
7
7
|
* increment (`+`) and decrement (`-`) buttons, with optional `min` and `max` bounds.
|
|
8
|
-
* Extends `FormField`
|
|
8
|
+
* Extends `FormField`: the `label` is rendered above the stepper and names the input, the help
|
|
9
|
+
* message between the two, and the error message below the stepper while the field is touched and
|
|
10
|
+
* not valid. The input names both messages in `aria-describedby`.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
12
|
+
* The field renders into the page, as every field does. Its input belongs to the form around it and
|
|
13
|
+
* is submitted with it, under the `name` of the field.
|
|
11
14
|
*
|
|
12
|
-
* @
|
|
13
|
-
* @slot minus - Replaces the default `-` glyph in the decrement button.
|
|
15
|
+
* @element el-amount-field
|
|
14
16
|
*
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
17
|
-
* @csspart plus - Applied to the increment button (in addition to `button`).
|
|
18
|
-
* @csspart minus - Applied to the decrement button (in addition to `button`).
|
|
19
|
-
* @csspart input - The numeric input element.
|
|
17
|
+
* @cssprop [--el-amount-field-plus='+'] - The sign of the increment button, a CSS string.
|
|
18
|
+
* @cssprop [--el-amount-field-minus='-'] - The sign of the decrement button, a CSS string.
|
|
20
19
|
*
|
|
21
20
|
* @property {string} name - Form name for the underlying `<input>` element.
|
|
22
21
|
* @property {number} value - Current numeric value of the field.
|
|
@@ -24,10 +23,20 @@ import style from './amount-field.style.js';
|
|
|
24
23
|
* above.
|
|
25
24
|
* @property {number | false} min - Lower bound. Set to `false` to leave the value unbounded
|
|
26
25
|
* below.
|
|
26
|
+
* @property {string} plusLabel - The accessible name of the increment button. Default
|
|
27
|
+
* `'Increase'`.
|
|
28
|
+
* @property {string} minusLabel - The accessible name of the decrement button. Default
|
|
29
|
+
* `'Decrease'`.
|
|
27
30
|
*/
|
|
28
31
|
export default class AmountField extends FormField {
|
|
29
|
-
constructor() {
|
|
30
|
-
super({
|
|
32
|
+
constructor(options) {
|
|
33
|
+
super({
|
|
34
|
+
styles: [style],
|
|
35
|
+
...options,
|
|
36
|
+
// The value of this field is a number, so the attribute is parsed, as element-js does
|
|
37
|
+
// for any other. The form field takes its value as text.
|
|
38
|
+
propertyOptions: { value: {}, ...options?.propertyOptions },
|
|
39
|
+
});
|
|
31
40
|
}
|
|
32
41
|
|
|
33
42
|
properties() {
|
|
@@ -37,6 +46,8 @@ export default class AmountField extends FormField {
|
|
|
37
46
|
value: 1,
|
|
38
47
|
max: false,
|
|
39
48
|
min: 0,
|
|
49
|
+
plusLabel: 'Increase',
|
|
50
|
+
minusLabel: 'Decrease',
|
|
40
51
|
};
|
|
41
52
|
}
|
|
42
53
|
|
|
@@ -58,29 +69,45 @@ export default class AmountField extends FormField {
|
|
|
58
69
|
};
|
|
59
70
|
}
|
|
60
71
|
|
|
61
|
-
|
|
72
|
+
/**
|
|
73
|
+
* The stepper: the two buttons around the input. The buttons are of the type `button`, a button
|
|
74
|
+
* without a type submits the form it is in. Their signs are drawn by the stylesheet, so each
|
|
75
|
+
* has its name as a label.
|
|
76
|
+
*
|
|
77
|
+
* A bound that is not set leaves its attribute out of the input. A button is disabled at its
|
|
78
|
+
* bound, and both are with the field.
|
|
79
|
+
*/
|
|
80
|
+
fieldTemplate() {
|
|
62
81
|
return html`
|
|
63
|
-
<div
|
|
64
|
-
<button
|
|
65
|
-
|
|
66
|
-
|
|
82
|
+
<div class="stepper">
|
|
83
|
+
<button
|
|
84
|
+
ref="plus"
|
|
85
|
+
type="button"
|
|
86
|
+
class="step plus"
|
|
87
|
+
aria-label="${this.plusLabel}"
|
|
88
|
+
?disabled="${this.disabled || (this.max !== false && this.value >= this.max)}"
|
|
89
|
+
></button>
|
|
67
90
|
<input
|
|
68
91
|
ref="input"
|
|
69
|
-
part="input"
|
|
70
92
|
type="number"
|
|
71
|
-
readonly
|
|
72
|
-
id="
|
|
93
|
+
readonly
|
|
94
|
+
id="${this._idOf('input')}"
|
|
73
95
|
name="${this.name}"
|
|
74
96
|
?required="${this.required}"
|
|
75
97
|
?disabled="${this.disabled}"
|
|
76
98
|
value="${this.value}"
|
|
77
|
-
max="${this.max}"
|
|
78
|
-
min="${this.min}"
|
|
79
|
-
aria-describedby="${this.
|
|
99
|
+
max="${this.max === false ? null : this.max}"
|
|
100
|
+
min="${this.min === false ? null : this.min}"
|
|
101
|
+
aria-describedby="${this._describedBy()}"
|
|
102
|
+
aria-invalid="${this.valid ? 'false' : 'true'}"
|
|
80
103
|
/>
|
|
81
|
-
<button
|
|
82
|
-
|
|
83
|
-
|
|
104
|
+
<button
|
|
105
|
+
ref="minus"
|
|
106
|
+
type="button"
|
|
107
|
+
class="step minus"
|
|
108
|
+
aria-label="${this.minusLabel}"
|
|
109
|
+
?disabled="${this.disabled || (this.min !== false && this.value <= this.min)}"
|
|
110
|
+
></button>
|
|
84
111
|
</div>
|
|
85
112
|
`;
|
|
86
113
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# AmountField
|
|
2
2
|
|
|
3
|
-
`amount-field` is a numeric amount stepper input. It renders a readonly `<input type="number">` flanked by increment (`+`) and decrement (`-`) buttons, with optional `min` and `max` bounds. It extends the base `FormField` component and
|
|
3
|
+
`amount-field` is a numeric amount stepper input. It renders a readonly `<input type="number">` flanked by increment (`+`) and decrement (`-`) buttons, with optional `min` and `max` bounds. It extends the base `FormField` component: the `label` is rendered above the stepper and names the input, the `helpMessage` between the two, and the `errorMessage` below the stepper while the field is not valid.
|
|
4
|
+
|
|
5
|
+
The field renders into the page, as every field does. Its input belongs to the form around it, see [In a form](#in-a-form).
|
|
4
6
|
|
|
5
7
|
## How to use
|
|
6
8
|
|
|
@@ -24,15 +26,19 @@ import '@webtides/element-library/amount-field/define';
|
|
|
24
26
|
|
|
25
27
|
#### Properties/Attributes
|
|
26
28
|
|
|
27
|
-
| Name
|
|
28
|
-
|
|
|
29
|
-
| `name`
|
|
30
|
-
| `value`
|
|
31
|
-
| `min`
|
|
32
|
-
| `max`
|
|
29
|
+
| Name | Type | Default | Description |
|
|
30
|
+
| ------------ | ----------------- | ------------ | --------------------------------------------------------------- |
|
|
31
|
+
| `name` | `string` | `'amount'` | Form name for the underlying `<input>` element. |
|
|
32
|
+
| `value` | `number` | `1` | Current numeric value of the field. |
|
|
33
|
+
| `min` | `number \| false` | `0` | Lower bound. Set to `false` to leave the value unbounded below. |
|
|
34
|
+
| `max` | `number \| false` | `false` | Upper bound. Set to `false` to leave the value unbounded above. |
|
|
35
|
+
| `plusLabel` | `string` | `'Increase'` | The accessible name of the increment button. |
|
|
36
|
+
| `minusLabel` | `string` | `'Decrease'` | The accessible name of the decrement button. |
|
|
33
37
|
|
|
34
38
|
Inherits the remaining form properties (`required`, `disabled`, `label`, `helpMessage`, `errorMessage`, `valid`, `touched`, …) from [`FormField`](../form-field/form-field.readme.md).
|
|
35
39
|
|
|
40
|
+
The stepper keeps the value between `min` and `max`, and the field checks nothing else. A page that finds the amount wrong sets `valid="false"`, and the field shows its `errorMessage`. The field has a value from the start and is `touched` with it, so that is all it takes.
|
|
41
|
+
|
|
36
42
|
#### Methods
|
|
37
43
|
|
|
38
44
|
_Inherits methods from the `FormField` component._
|
|
@@ -45,21 +51,77 @@ _Inherits methods from the `FormField` component._
|
|
|
45
51
|
|
|
46
52
|
#### Slots
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
| ------- | ------------------------------------------------------- |
|
|
50
|
-
| `plus` | Replaces the default `+` glyph in the increment button. |
|
|
51
|
-
| `minus` | Replaces the default `-` glyph in the decrement button. |
|
|
54
|
+
_None._ The field renders into the page.
|
|
52
55
|
|
|
53
|
-
#### CSS
|
|
56
|
+
#### CSS Custom Properties
|
|
54
57
|
|
|
55
|
-
| Name
|
|
56
|
-
|
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `plus` | Applied to the increment button (in addition to `button`). |
|
|
60
|
-
| `minus` | Applied to the decrement button (in addition to `button`). |
|
|
61
|
-
| `input` | The numeric input element. |
|
|
58
|
+
| Name | Default | Description |
|
|
59
|
+
| ------------------------- | ------- | ----------------------------------------------- |
|
|
60
|
+
| `--el-amount-field-plus` | `'+'` | The sign of the increment button, a CSS string. |
|
|
61
|
+
| `--el-amount-field-minus` | `'-'` | The sign of the decrement button, a CSS string. |
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
```css
|
|
64
|
+
el-amount-field {
|
|
65
|
+
--el-amount-field-plus: '▲';
|
|
66
|
+
--el-amount-field-minus: '▼';
|
|
67
|
+
}
|
|
68
|
+
```
|
|
64
69
|
|
|
65
70
|
This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-bg`, `--el-color-border`, `--el-radius-md`, `--el-touch-target`). Skin it by setting these via a theme — see the Storybook _Docs / Theming_ page.
|
|
71
|
+
|
|
72
|
+
The label, the help message, the stepper and the error message stack in a column, and the texts have the look they have in every field: see [Layout](../form-field/form-field.readme.md#layout) in the readme of `form-field`.
|
|
73
|
+
|
|
74
|
+
#### Styling
|
|
75
|
+
|
|
76
|
+
The elements of the field are in the page, where a stylesheet selects them:
|
|
77
|
+
|
|
78
|
+
| Selector | Element |
|
|
79
|
+
| --------------------------------- | -------------------------------------------------------------------- |
|
|
80
|
+
| `el-amount-field label` | The label above the stepper. Only rendered when `label` is set. |
|
|
81
|
+
| `el-amount-field .help-message` | The help message, between the label and the stepper. |
|
|
82
|
+
| `el-amount-field .error-message` | The error message below the stepper, while it is shown. |
|
|
83
|
+
| `el-amount-field .stepper` | The container around the input and the two buttons, with the border. |
|
|
84
|
+
| `el-amount-field .step` | Both buttons. |
|
|
85
|
+
| `el-amount-field .plus`, `.minus` | The increment and the decrement button. |
|
|
86
|
+
| `el-amount-field input` | The numeric input. |
|
|
87
|
+
|
|
88
|
+
The sign of a button is its `::before`. The stepper is styled by the field itself and not by `styles/native.css`: its input has no border of its own.
|
|
89
|
+
|
|
90
|
+
The buttons are at least `--el-touch-target` high on every pointer. On a touch screen (`@media (any-pointer: coarse)`) they are at least that wide as well, and the input is as high as the buttons.
|
|
91
|
+
|
|
92
|
+
The stepper of a disabled field fades as a whole (`opacity: 0.55`, as the control of every other field) and has the cursor `not-allowed`: by the `disabled` of the field, and by a `<fieldset disabled>` around it. In an enabled field a button at its bound fades alone.
|
|
93
|
+
|
|
94
|
+
## In a form
|
|
95
|
+
|
|
96
|
+
The input of the field is a control of the form around it, like the control of every other field.
|
|
97
|
+
|
|
98
|
+
- The value is submitted under the `name`: the one the field was rendered with, one that plus and minus have changed, and one that a script sets.
|
|
99
|
+
- A `disabled` field is left out, and its buttons are disabled with its input. A `<fieldset disabled>` around the field does the same.
|
|
100
|
+
- `form.reset()` brings back the value the field was rendered with. See [Reset](../form-field/form-field.readme.md#reset).
|
|
101
|
+
- The buttons are of the type `button`: they do not submit the form.
|
|
102
|
+
- In server-rendered markup the input is there with its name and its value, so a form that is submitted before the script has run has the rendered value. The buttons need the script.
|
|
103
|
+
|
|
104
|
+
## Migrating from the shadow root
|
|
105
|
+
|
|
106
|
+
Before, the field rendered into a shadow root, where its input belonged to no form.
|
|
107
|
+
|
|
108
|
+
| Before | Now |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| `<span slot="plus">` / `<span slot="minus">` | `--el-amount-field-plus` / `--el-amount-field-minus`, or a rule for `.plus::before` / `.minus::before` |
|
|
111
|
+
| `::part(label)`, `::part(help-message)`, `::part(error-message)` | `el-amount-field label`, `.help-message`, `.error-message` |
|
|
112
|
+
| `::part(wrapper)` | `el-amount-field .stepper` |
|
|
113
|
+
| `::part(button)`, `::part(plus)`, `::part(minus)` | `el-amount-field .step`, `.plus`, `.minus` |
|
|
114
|
+
| `::part(input)` | `el-amount-field input` |
|
|
115
|
+
| `el.shadowRoot.querySelector(…)` | `el.querySelector(…)` |
|
|
116
|
+
|
|
117
|
+
The buttons have a name now (`plusLabel`, `minusLabel`); it was their sign.
|
|
118
|
+
|
|
119
|
+
## Accessibility
|
|
120
|
+
|
|
121
|
+
- The input is named by the label.
|
|
122
|
+
- The buttons are named by `plusLabel` and `minusLabel`. Their signs are drawn by the stylesheet and are no part of the name.
|
|
123
|
+
- The input names the help message in `aria-describedby`, and the error message while that is shown: a screen reader reads both when the input gets focus.
|
|
124
|
+
- The input says whether the field is valid (`aria-invalid`).
|
|
125
|
+
- The error message is an alert (`role="alert"`): a screen reader announces it when it appears.
|
|
126
|
+
- The Tab key stops at the plus button, at the input and at the minus button. The part that has the keyboard focus shows it inside of itself, where the stepper does not cut it off: a ring of `--el-focus-ring-width` in `--el-color-focus-ring`, and of 2 px in the colour of the text without a theme.
|
|
127
|
+
- A button at its bound is disabled, and both are while the field is `disabled`: they change nothing then, and the Tab key passes the field.
|