@webtides/element-library 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +384 -3
- package/README.md +61 -41
- package/all.js +28 -0
- package/catalog.d.ts +14 -0
- package/catalog.js +55 -27
- package/custom-elements.json +16604 -3420
- package/package.json +35 -28
- package/src/components/accordion/accordion.changelog.md +10 -0
- package/src/components/accordion/accordion.js +10 -7
- package/src/components/accordion/accordion.readme.md +2 -0
- package/src/components/accordion/accordion.style.js +8 -0
- package/src/components/amount-field/amount-field.changelog.md +23 -3
- package/src/components/amount-field/amount-field.js +53 -26
- package/src/components/amount-field/amount-field.readme.md +82 -20
- package/src/components/amount-field/amount-field.style.js +111 -47
- package/src/components/avatar/avatar.changelog.md +23 -0
- package/src/components/avatar/avatar.define.js +3 -0
- package/src/components/avatar/avatar.js +115 -0
- package/src/components/avatar/avatar.readme.md +132 -0
- package/src/components/avatar/avatar.style.js +67 -0
- package/src/components/badge/badge.changelog.md +23 -0
- package/src/components/badge/badge.define.js +3 -0
- package/src/components/badge/badge.js +59 -0
- package/src/components/badge/badge.readme.md +109 -0
- package/src/components/badge/badge.style.js +63 -0
- package/src/components/breadcrumb/breadcrumb.changelog.md +22 -0
- package/src/components/breadcrumb/breadcrumb.define.js +3 -0
- package/src/components/breadcrumb/breadcrumb.js +47 -0
- package/src/components/breadcrumb/breadcrumb.readme.md +108 -0
- package/src/components/breadcrumb/breadcrumb.style.js +20 -0
- package/src/components/breadcrumb-item/breadcrumb-item.changelog.md +23 -0
- package/src/components/breadcrumb-item/breadcrumb-item.define.js +3 -0
- package/src/components/breadcrumb-item/breadcrumb-item.js +82 -0
- package/src/components/breadcrumb-item/breadcrumb-item.readme.md +106 -0
- package/src/components/breadcrumb-item/breadcrumb-item.style.js +92 -0
- package/src/components/button/button.changelog.md +34 -1
- package/src/components/button/button.js +285 -29
- package/src/components/button/button.readme.md +130 -10
- package/src/components/button/button.style.js +99 -120
- package/src/components/button-group/button-group.changelog.md +24 -0
- package/src/components/button-group/button-group.define.js +3 -0
- package/src/components/button-group/button-group.js +53 -0
- package/src/components/button-group/button-group.readme.md +114 -0
- package/src/components/button-group/button-group.style.js +41 -0
- package/src/components/card/card.changelog.md +23 -0
- package/src/components/card/card.define.js +3 -0
- package/src/components/card/card.js +73 -0
- package/src/components/card/card.readme.md +136 -0
- package/src/components/card/card.style.js +99 -0
- package/src/components/carousel/carousel.changelog.md +20 -0
- package/src/components/carousel/carousel.js +89 -40
- package/src/components/carousel/carousel.readme.md +39 -6
- package/src/components/carousel/carousel.style.js +21 -77
- package/src/components/carousel/glide/components/ShadowAnchors.js +3 -1
- package/src/components/carousel/glide/components/ShadowClones.js +21 -24
- package/src/components/carousel/glide/components/ShadowGaps.js +2 -2
- package/src/components/carousel/glide/components/ShadowHtml.js +22 -3
- package/src/components/checkbox-field/checkbox-field.changelog.md +19 -0
- package/src/components/checkbox-field/checkbox-field.js +25 -10
- package/src/components/checkbox-field/checkbox-field.readme.md +17 -4
- package/src/components/checkbox-field/checkbox-field.style.js +15 -3
- package/src/components/checkbox-group-field/checkbox-group-field.changelog.md +25 -0
- package/src/components/checkbox-group-field/checkbox-group-field.define.js +3 -0
- package/src/components/checkbox-group-field/checkbox-group-field.js +217 -0
- package/src/components/checkbox-group-field/checkbox-group-field.readme.md +95 -0
- package/src/components/checkbox-group-field/checkbox-group-field.style.js +62 -0
- package/src/components/color-field/color-field.changelog.md +24 -0
- package/src/components/color-field/color-field.define.js +3 -0
- package/src/components/color-field/color-field.js +184 -0
- package/src/components/color-field/color-field.readme.md +95 -0
- package/src/components/color-field/color-field.style.js +39 -0
- package/src/components/combobox-field/combobox-field.changelog.md +23 -0
- package/src/components/combobox-field/combobox-field.define.js +3 -0
- package/src/components/combobox-field/combobox-field.js +97 -0
- package/src/components/combobox-field/combobox-field.readme.md +93 -0
- package/src/components/combobox-field/combobox-field.style.js +56 -0
- package/src/components/copy-button/copy-button.changelog.md +24 -0
- package/src/components/copy-button/copy-button.define.js +3 -0
- package/src/components/copy-button/copy-button.events.js +4 -0
- package/src/components/copy-button/copy-button.js +237 -0
- package/src/components/copy-button/copy-button.readme.md +134 -0
- package/src/components/copy-button/copy-button.style.js +109 -0
- package/src/components/date-field/date-field.changelog.md +24 -0
- package/src/components/date-field/date-field.define.js +3 -0
- package/src/components/date-field/date-field.js +119 -0
- package/src/components/date-field/date-field.readme.md +110 -0
- package/src/components/date-field/date-field.style.js +53 -0
- package/src/components/dialog/dialog.changelog.md +16 -1
- package/src/components/dialog/dialog.js +252 -57
- package/src/components/dialog/dialog.readme.md +36 -4
- package/src/components/dialog/dialog.style.js +9 -109
- package/src/components/divider/divider.changelog.md +23 -0
- package/src/components/divider/divider.define.js +3 -0
- package/src/components/divider/divider.js +48 -0
- package/src/components/divider/divider.readme.md +101 -0
- package/src/components/divider/divider.style.js +50 -0
- package/src/components/drawer/drawer.changelog.md +25 -0
- package/src/components/drawer/drawer.define.js +3 -0
- package/src/components/drawer/drawer.events.js +8 -0
- package/src/components/drawer/drawer.js +80 -0
- package/src/components/drawer/drawer.readme.md +194 -0
- package/src/components/drawer/drawer.style.js +83 -0
- package/src/components/dropdown/dropdown.js +9 -7
- package/src/components/empty-state/empty-state.changelog.md +22 -0
- package/src/components/empty-state/empty-state.define.js +3 -0
- package/src/components/empty-state/empty-state.js +55 -0
- package/src/components/empty-state/empty-state.readme.md +114 -0
- package/src/components/empty-state/empty-state.style.js +60 -0
- package/src/components/file-field/file-field.changelog.md +24 -0
- package/src/components/file-field/file-field.define.js +3 -0
- package/src/components/file-field/file-field.js +205 -0
- package/src/components/file-field/file-field.readme.md +103 -0
- package/src/components/file-field/file-field.style.js +28 -0
- package/src/components/form-field/form-field.changelog.md +25 -0
- package/src/components/form-field/form-field.js +212 -15
- package/src/components/form-field/form-field.readme.md +82 -18
- package/src/components/form-field/form-field.style.js +6 -24
- package/src/components/input-field/input-field.changelog.md +24 -0
- package/src/components/input-field/input-field.js +82 -6
- package/src/components/input-field/input-field.readme.md +34 -5
- package/src/components/input-field/input-field.style.js +32 -13
- package/src/components/notification/notification.changelog.md +21 -1
- package/src/components/notification/notification.js +80 -74
- package/src/components/notification/notification.readme.md +54 -13
- package/src/components/notification/notification.style.js +37 -22
- package/src/components/otp-field/otp-field.changelog.md +23 -0
- package/src/components/otp-field/otp-field.define.js +3 -0
- package/src/components/otp-field/otp-field.events.js +3 -0
- package/src/components/otp-field/otp-field.js +172 -0
- package/src/components/otp-field/otp-field.readme.md +111 -0
- package/src/components/otp-field/otp-field.style.js +53 -0
- package/src/components/pagination/pagination.changelog.md +30 -0
- package/src/components/pagination/pagination.define.js +3 -0
- package/src/components/pagination/pagination.events.js +3 -0
- package/src/components/pagination/pagination.js +282 -0
- package/src/components/pagination/pagination.readme.md +167 -0
- package/src/components/pagination/pagination.style.js +162 -0
- package/src/components/password-field/password-field.changelog.md +24 -0
- package/src/components/password-field/password-field.js +7 -1
- package/src/components/password-field/password-field.readme.md +15 -6
- package/src/components/password-field/password-field.style.js +36 -13
- package/src/components/popover/popover.changelog.md +24 -0
- package/src/components/popover/popover.define.js +3 -0
- package/src/components/popover/popover.events.js +4 -0
- package/src/components/popover/popover.js +255 -0
- package/src/components/popover/popover.readme.md +132 -0
- package/src/components/popover/popover.style.js +41 -0
- package/src/components/progress-bar/progress-bar.changelog.md +23 -0
- package/src/components/progress-bar/progress-bar.define.js +3 -0
- package/src/components/progress-bar/progress-bar.js +80 -0
- package/src/components/progress-bar/progress-bar.readme.md +110 -0
- package/src/components/progress-bar/progress-bar.style.js +93 -0
- package/src/components/progress-ring/progress-ring.changelog.md +23 -0
- package/src/components/progress-ring/progress-ring.define.js +3 -0
- package/src/components/progress-ring/progress-ring.js +83 -0
- package/src/components/progress-ring/progress-ring.readme.md +115 -0
- package/src/components/progress-ring/progress-ring.style.js +85 -0
- package/src/components/radio-field/radio-field.changelog.md +16 -0
- package/src/components/radio-field/radio-field.js +34 -11
- package/src/components/radio-field/radio-field.readme.md +13 -8
- package/src/components/radio-field/radio-field.style.js +17 -65
- package/src/components/range-field/range-field.changelog.md +24 -0
- package/src/components/range-field/range-field.define.js +3 -0
- package/src/components/range-field/range-field.js +167 -0
- package/src/components/range-field/range-field.readme.md +87 -0
- package/src/components/range-field/range-field.style.js +41 -0
- package/src/components/rating-field/rating-field.changelog.md +24 -0
- package/src/components/rating-field/rating-field.define.js +3 -0
- package/src/components/rating-field/rating-field.js +195 -0
- package/src/components/rating-field/rating-field.readme.md +82 -0
- package/src/components/rating-field/rating-field.style.js +79 -0
- package/src/components/select-field/select-field.changelog.md +17 -0
- package/src/components/select-field/select-field.js +100 -8
- package/src/components/select-field/select-field.readme.md +32 -6
- package/src/components/select-field/select-field.style.js +19 -9
- package/src/components/skeleton/skeleton.changelog.md +22 -0
- package/src/components/skeleton/skeleton.define.js +3 -0
- package/src/components/skeleton/skeleton.js +49 -0
- package/src/components/skeleton/skeleton.readme.md +115 -0
- package/src/components/skeleton/skeleton.style.js +79 -0
- package/src/components/slider/slider.changelog.md +15 -0
- package/src/components/slider/slider.js +37 -5
- package/src/components/slider/slider.readme.md +28 -6
- package/src/components/slider/slider.style.js +7 -71
- package/src/components/spinner/spinner.changelog.md +22 -0
- package/src/components/spinner/spinner.define.js +3 -0
- package/src/components/spinner/spinner.js +48 -0
- package/src/components/spinner/spinner.readme.md +98 -0
- package/src/components/spinner/spinner.style.js +44 -0
- package/src/components/switch-field/switch-field.changelog.md +16 -0
- package/src/components/switch-field/switch-field.js +17 -9
- package/src/components/switch-field/switch-field.readme.md +11 -4
- package/src/components/switch-field/switch-field.style.js +13 -13
- package/src/components/tab-group/tab-group.changelog.md +19 -0
- package/src/components/tab-group/tab-group.js +122 -10
- package/src/components/tab-group/tab-group.readme.md +25 -4
- package/src/components/tab-link/tab-link.changelog.md +16 -0
- package/src/components/tab-link/tab-link.js +51 -8
- package/src/components/tab-link/tab-link.readme.md +14 -8
- package/src/components/tab-link/tab-link.style.js +13 -0
- package/src/components/tab-panel/tab-panel.changelog.md +8 -2
- package/src/components/tab-panel/tab-panel.js +7 -3
- package/src/components/tab-panel/tab-panel.readme.md +7 -5
- package/src/components/tag/tag.changelog.md +24 -0
- package/src/components/tag/tag.define.js +3 -0
- package/src/components/tag/tag.events.js +3 -0
- package/src/components/tag/tag.js +116 -0
- package/src/components/tag/tag.readme.md +119 -0
- package/src/components/tag/tag.style.js +101 -0
- package/src/components/tag-field/tag-field.changelog.md +25 -0
- package/src/components/tag-field/tag-field.define.js +3 -0
- package/src/components/tag-field/tag-field.js +359 -0
- package/src/components/tag-field/tag-field.readme.md +113 -0
- package/src/components/tag-field/tag-field.style.js +62 -0
- package/src/components/textarea-field/textarea-field.changelog.md +28 -4
- package/src/components/textarea-field/textarea-field.js +68 -14
- package/src/components/textarea-field/textarea-field.readme.md +45 -9
- package/src/components/textarea-field/textarea-field.style.js +45 -2
- package/src/components/toast/toast.changelog.md +24 -0
- package/src/components/toast/toast.define.js +3 -0
- package/src/components/toast/toast.js +193 -0
- package/src/components/toast/toast.readme.md +189 -0
- package/src/components/toast/toast.style.js +74 -0
- package/src/components/tooltip/tooltip.changelog.md +24 -0
- package/src/components/tooltip/tooltip.define.js +3 -0
- package/src/components/tooltip/tooltip.events.js +4 -0
- package/src/components/tooltip/tooltip.js +377 -0
- package/src/components/tooltip/tooltip.readme.md +172 -0
- package/src/components/tooltip/tooltip.style.js +107 -0
- package/src/components/transition-classes/transition-classes.js +6 -6
- package/src/styles/appearance.style.js +42 -0
- package/src/styles/arrow.style.js +65 -0
- package/src/styles/choice-group.style.js +94 -0
- package/src/styles/form-control.style.js +79 -0
- package/src/styles/host.style.js +55 -0
- package/src/styles/layers.css +31 -0
- package/src/styles/modal.style.js +146 -0
- package/src/styles/native.css +275 -0
- package/src/styles/size.style.js +48 -0
- package/src/styles/slide-controls.style.js +225 -0
- package/src/styles/utilities.css +30 -0
- package/src/styles/variants.style.js +78 -0
- package/src/themes/default.css +86 -142
- package/src/themes/high-contrast.css +72 -129
- package/src/themes/sketchy.css +95 -175
- package/src/utils/floating.js +71 -0
- package/src/utils/focus.js +18 -0
- package/src/utils/progress.js +25 -0
- package/src/utils/slots.js +21 -0
- package/src/utils/text-entry-attributes.js +51 -0
- package/types/all.d.ts +54 -1
- package/types/index.d.ts +1 -0
- package/types/src/components/accordion/accordion.d.ts +6 -4
- package/types/src/components/accordion/accordion.events.d.ts +3 -3
- package/types/src/components/accordion-group/accordion-group.d.ts +4 -3
- package/types/src/components/amount-field/amount-field.d.ts +30 -16
- package/types/src/components/avatar/avatar.d.ts +57 -0
- package/types/src/components/avatar/avatar.define.d.ts +1 -0
- package/types/src/components/avatar/avatar.style.d.ts +2 -0
- package/types/src/components/badge/badge.d.ts +32 -0
- package/types/src/components/badge/badge.define.d.ts +1 -0
- package/types/src/components/badge/badge.style.d.ts +2 -0
- package/types/src/components/breadcrumb/breadcrumb.d.ts +27 -0
- package/types/src/components/breadcrumb/breadcrumb.define.d.ts +1 -0
- package/types/src/components/breadcrumb/breadcrumb.style.d.ts +2 -0
- package/types/src/components/breadcrumb-item/breadcrumb-item.d.ts +38 -0
- package/types/src/components/breadcrumb-item/breadcrumb-item.define.d.ts +1 -0
- package/types/src/components/breadcrumb-item/breadcrumb-item.style.d.ts +2 -0
- package/types/src/components/button/button.d.ts +129 -14
- package/types/src/components/button-group/button-group.d.ts +28 -0
- package/types/src/components/button-group/button-group.define.d.ts +1 -0
- package/types/src/components/button-group/button-group.style.d.ts +2 -0
- package/types/src/components/card/card.d.ts +40 -0
- package/types/src/components/card/card.define.d.ts +1 -0
- package/types/src/components/card/card.style.d.ts +2 -0
- package/types/src/components/carousel/carousel.d.ts +22 -8
- package/types/src/components/carousel/carousel.events.d.ts +3 -3
- package/types/src/components/carousel/glide/components/ShadowAnchors.d.ts +1 -1
- package/types/src/components/carousel/glide/components/ShadowClones.d.ts +8 -1
- package/types/src/components/carousel/glide/components/ShadowGaps.d.ts +1 -1
- package/types/src/components/carousel/glide/components/ShadowHtml.d.ts +1 -1
- package/types/src/components/carousel/glide/components/glide-html.d.ts +1 -1
- package/types/src/components/checkbox-field/checkbox-field.d.ts +22 -15
- package/types/src/components/checkbox-group-field/checkbox-group-field.d.ts +100 -0
- package/types/src/components/checkbox-group-field/checkbox-group-field.define.d.ts +1 -0
- package/types/src/components/checkbox-group-field/checkbox-group-field.style.d.ts +2 -0
- package/types/src/components/color-field/color-field.d.ts +102 -0
- package/types/src/components/color-field/color-field.define.d.ts +1 -0
- package/types/src/components/color-field/color-field.style.d.ts +2 -0
- package/types/src/components/combobox-field/combobox-field.d.ts +84 -0
- package/types/src/components/combobox-field/combobox-field.define.d.ts +1 -0
- package/types/src/components/combobox-field/combobox-field.style.d.ts +2 -0
- package/types/src/components/copy-button/copy-button.d.ts +93 -0
- package/types/src/components/copy-button/copy-button.define.d.ts +1 -0
- package/types/src/components/copy-button/copy-button.events.d.ts +5 -0
- package/types/src/components/copy-button/copy-button.style.d.ts +2 -0
- package/types/src/components/date-field/date-field.d.ts +102 -0
- package/types/src/components/date-field/date-field.define.d.ts +1 -0
- package/types/src/components/date-field/date-field.style.d.ts +2 -0
- package/types/src/components/dialog/dialog.d.ts +101 -19
- package/types/src/components/dialog/dialog.events.d.ts +8 -8
- package/types/src/components/divider/divider.d.ts +27 -0
- package/types/src/components/divider/divider.define.d.ts +1 -0
- package/types/src/components/divider/divider.style.d.ts +2 -0
- package/types/src/components/drawer/drawer.d.ts +70 -0
- package/types/src/components/drawer/drawer.define.d.ts +1 -0
- package/types/src/components/drawer/drawer.events.d.ts +9 -0
- package/types/src/components/drawer/drawer.style.d.ts +2 -0
- package/types/src/components/dropdown/dropdown.d.ts +5 -3
- package/types/src/components/empty-state/empty-state.d.ts +29 -0
- package/types/src/components/empty-state/empty-state.define.d.ts +1 -0
- package/types/src/components/empty-state/empty-state.style.d.ts +2 -0
- package/types/src/components/file-field/file-field.d.ts +115 -0
- package/types/src/components/file-field/file-field.define.d.ts +1 -0
- package/types/src/components/file-field/file-field.style.d.ts +2 -0
- package/types/src/components/form-field/form-field.d.ts +129 -14
- package/types/src/components/form-field/form-field.events.d.ts +4 -4
- package/types/src/components/input-field/input-field.d.ts +52 -5
- package/types/src/components/lazy-src/lazy-src.d.ts +7 -5
- package/types/src/components/lazy-src/lazy-src.events.d.ts +5 -5
- package/types/src/components/notification/notification.d.ts +18 -18
- package/types/src/components/notification/notification.events.d.ts +6 -6
- package/types/src/components/otp-field/otp-field.d.ts +130 -0
- package/types/src/components/otp-field/otp-field.define.d.ts +1 -0
- package/types/src/components/otp-field/otp-field.events.d.ts +4 -0
- package/types/src/components/otp-field/otp-field.style.d.ts +2 -0
- package/types/src/components/pagination/pagination.d.ts +117 -0
- package/types/src/components/pagination/pagination.define.d.ts +1 -0
- package/types/src/components/pagination/pagination.events.d.ts +4 -0
- package/types/src/components/pagination/pagination.style.d.ts +2 -0
- package/types/src/components/password-field/password-field.d.ts +29 -12
- package/types/src/components/popover/popover.d.ts +123 -0
- package/types/src/components/popover/popover.define.d.ts +1 -0
- package/types/src/components/popover/popover.events.d.ts +5 -0
- package/types/src/components/popover/popover.style.d.ts +2 -0
- package/types/src/components/progress-bar/progress-bar.d.ts +35 -0
- package/types/src/components/progress-bar/progress-bar.define.d.ts +1 -0
- package/types/src/components/progress-bar/progress-bar.style.d.ts +2 -0
- package/types/src/components/progress-ring/progress-ring.d.ts +40 -0
- package/types/src/components/progress-ring/progress-ring.define.d.ts +1 -0
- package/types/src/components/progress-ring/progress-ring.style.d.ts +2 -0
- package/types/src/components/radio-field/radio-field.d.ts +21 -9
- package/types/src/components/range-field/range-field.d.ts +94 -0
- package/types/src/components/range-field/range-field.define.d.ts +1 -0
- package/types/src/components/range-field/range-field.style.d.ts +2 -0
- package/types/src/components/rating-field/rating-field.d.ts +96 -0
- package/types/src/components/rating-field/rating-field.define.d.ts +1 -0
- package/types/src/components/rating-field/rating-field.style.d.ts +2 -0
- package/types/src/components/scroll-to/scroll-to.d.ts +3 -2
- package/types/src/components/scroll-to-top/scroll-to-top.d.ts +4 -2
- package/types/src/components/select-field/select-field.d.ts +55 -5
- package/types/src/components/skeleton/skeleton.d.ts +29 -0
- package/types/src/components/skeleton/skeleton.define.d.ts +1 -0
- package/types/src/components/skeleton/skeleton.style.d.ts +2 -0
- package/types/src/components/slider/slider.d.ts +14 -8
- package/types/src/components/slider/slider.events.d.ts +4 -4
- package/types/src/components/spinner/spinner.d.ts +28 -0
- package/types/src/components/spinner/spinner.define.d.ts +1 -0
- package/types/src/components/spinner/spinner.style.d.ts +2 -0
- package/types/src/components/sticky/sticky.d.ts +4 -2
- package/types/src/components/svg-use/svg-use.d.ts +4 -2
- package/types/src/components/switch-field/switch-field.d.ts +17 -15
- package/types/src/components/tab-group/tab-group.d.ts +44 -3
- package/types/src/components/tab-link/tab-link.d.ts +33 -10
- package/types/src/components/tab-panel/tab-panel.d.ts +8 -5
- package/types/src/components/tag/tag.d.ts +53 -0
- package/types/src/components/tag/tag.define.d.ts +1 -0
- package/types/src/components/tag/tag.events.d.ts +4 -0
- package/types/src/components/tag/tag.style.d.ts +2 -0
- package/types/src/components/tag-field/tag-field.d.ts +178 -0
- package/types/src/components/tag-field/tag-field.define.d.ts +1 -0
- package/types/src/components/tag-field/tag-field.style.d.ts +2 -0
- package/types/src/components/textarea-field/textarea-field.d.ts +44 -4
- package/types/src/components/toast/toast.d.ts +110 -0
- package/types/src/components/toast/toast.define.d.ts +1 -0
- package/types/src/components/toast/toast.style.d.ts +2 -0
- package/types/src/components/tooltip/tooltip.d.ts +161 -0
- package/types/src/components/tooltip/tooltip.define.d.ts +1 -0
- package/types/src/components/tooltip/tooltip.events.d.ts +5 -0
- package/types/src/components/tooltip/tooltip.style.d.ts +2 -0
- package/types/src/components/transition-classes/transition-classes.d.ts +9 -8
- package/types/src/styles/appearance.style.d.ts +18 -0
- package/types/src/styles/arrow.style.d.ts +15 -0
- package/types/src/styles/choice-group.style.d.ts +23 -0
- package/types/src/styles/form-control.style.d.ts +26 -0
- package/types/src/styles/host.style.d.ts +24 -0
- package/types/src/styles/modal.style.d.ts +20 -0
- package/types/src/styles/size.style.d.ts +20 -0
- package/types/src/styles/slide-controls.style.d.ts +20 -0
- package/types/src/styles/variants.style.d.ts +32 -0
- package/types/src/utils/body-scroll.d.ts +12 -2
- package/types/src/utils/floating.d.ts +36 -0
- package/types/src/utils/focus.d.ts +16 -0
- package/types/src/utils/progress.d.ts +19 -0
- package/types/src/utils/slots.d.ts +19 -0
- package/types/src/utils/text-entry-attributes.d.ts +18 -0
- package/types/src/utils/transitions.d.ts +2 -2
- package/web-types.json +6590 -1584
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { html, defineElement, optionalAttribute } from '@webtides/element-js';
|
|
2
|
+
import FormField from '../form-field/form-field.js';
|
|
3
|
+
import { define as defineTag } from '../tag/tag.js';
|
|
4
|
+
import { focusLeft } from '../../utils/focus.js';
|
|
5
|
+
import style from './tag-field.style.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* What the bubble of the browser says when a required field has no entry and no `errorMessage`.
|
|
9
|
+
* The browser has no text of its own for it: the input is not what is required, the list is.
|
|
10
|
+
*/
|
|
11
|
+
const REQUIRED_MESSAGE = 'Add at least one entry.';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A list of short texts the user writes: keywords, skills, recipients. A text input that turns
|
|
15
|
+
* what is entered into entries, each an `el-tag` with a remove button, and submits them under one
|
|
16
|
+
* name. Extends `FormField` and inherits its label / help / error / required surface.
|
|
17
|
+
*
|
|
18
|
+
* Enter adds the text of the input as an entry, and so does a comma, typed or pasted. Text that is
|
|
19
|
+
* still in the input when its form is submitted becomes an entry as well.
|
|
20
|
+
*
|
|
21
|
+
* @element el-tag-field
|
|
22
|
+
*
|
|
23
|
+
* @fires {CustomEvent<string[]>} input-change - Fired when the entries change. `detail` is the
|
|
24
|
+
* list of the entries. Bubbles.
|
|
25
|
+
*
|
|
26
|
+
* @cssstate touched - Set once the user has left the field, or the browser has refused a submit
|
|
27
|
+
* because of it. Inherits `valid` and `invalid` from `FormField`.
|
|
28
|
+
*
|
|
29
|
+
* @property {string[]} value - The entries, in the order they were added. As an attribute it is
|
|
30
|
+
* JSON: `value='["TypeScript", "Svelte"]'`.
|
|
31
|
+
* @property {boolean} required - Whether the list needs at least one entry.
|
|
32
|
+
* @property {'small'|'medium'|'large'} size - Size of the input and of the tags. Default
|
|
33
|
+
* `'medium'`. Reflected to the `size` attribute. On the input it shows once the control is
|
|
34
|
+
* decorated (`styles/native.css`).
|
|
35
|
+
* @property {string} placeholder - Placeholder text shown while the input is empty.
|
|
36
|
+
* @property {string} removeLabel - The word the remove button of an entry is named with, in front
|
|
37
|
+
* of the entry: "Remove TypeScript". Default `'Remove'`.
|
|
38
|
+
* @property {string} addedLabel - What a screen reader hears in front of an entry that was added:
|
|
39
|
+
* "Added TypeScript". Default `'Added'`.
|
|
40
|
+
* @property {string} removedLabel - What a screen reader hears in front of an entry that was
|
|
41
|
+
* removed: "Removed TypeScript". Default `'Removed'`.
|
|
42
|
+
* @property {string} status - What the field last told a screen reader. Set by the field.
|
|
43
|
+
*/
|
|
44
|
+
export default class TagField extends FormField {
|
|
45
|
+
/**
|
|
46
|
+
* Where the field listens for the submit of its form, see `afterUpdate()`.
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
_submitRoot = undefined;
|
|
50
|
+
|
|
51
|
+
constructor(options) {
|
|
52
|
+
super({
|
|
53
|
+
shadowRender: false,
|
|
54
|
+
styles: [style],
|
|
55
|
+
...options,
|
|
56
|
+
// The value of this field is a list, so the attribute is parsed, as element-js does for
|
|
57
|
+
// any other. The size module selects the host by the `size` attribute.
|
|
58
|
+
propertyOptions: { value: {}, size: { reflect: true }, ...options?.propertyOptions },
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
properties() {
|
|
63
|
+
return {
|
|
64
|
+
...super.properties(),
|
|
65
|
+
value: [],
|
|
66
|
+
size: 'medium',
|
|
67
|
+
placeholder: '',
|
|
68
|
+
removeLabel: 'Remove',
|
|
69
|
+
addedLabel: 'Added',
|
|
70
|
+
removedLabel: 'Removed',
|
|
71
|
+
status: '',
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* As an input field, a required field without an entry is not marked as not valid before the
|
|
77
|
+
* user has been in it: `styles/native.css` paints the border of such an input in the danger
|
|
78
|
+
* colour. An error the page renders the field with (`valid="false"`) shows from the start.
|
|
79
|
+
*/
|
|
80
|
+
connected() {
|
|
81
|
+
// The entries are rendered as el-tag, also where the page has registered the field alone.
|
|
82
|
+
defineTag();
|
|
83
|
+
super.connected();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
afterUpdate() {
|
|
87
|
+
this._syncControl();
|
|
88
|
+
super.afterUpdate();
|
|
89
|
+
|
|
90
|
+
// `submit` passes the root of its tree on the way to the form, the document or a shadow
|
|
91
|
+
// root: there the field hears it before every listener of the page on the form.
|
|
92
|
+
if (!this._submitRoot) {
|
|
93
|
+
this._submitRoot = this.getRootNode();
|
|
94
|
+
this._submitRoot.addEventListener('submit', this._onFormSubmit, true);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
disconnected() {
|
|
99
|
+
super.disconnected();
|
|
100
|
+
this._submitRoot?.removeEventListener('submit', this._onFormSubmit, true);
|
|
101
|
+
this._submitRoot = undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The form of the field is being submitted. Text that is still in the input becomes an entry:
|
|
106
|
+
* nothing that was typed is lost on the way to the submit button.
|
|
107
|
+
*
|
|
108
|
+
* Not earlier, when the user leaves the field. A new entry makes the field higher, and what is
|
|
109
|
+
* below it moves: the submit button would move away under the pointer that is pressing it, and
|
|
110
|
+
* the click would be lost.
|
|
111
|
+
*
|
|
112
|
+
* The form data is put together right after this event, and a listener of the page can read it
|
|
113
|
+
* in the same event. The hidden input of every entry has to be there by then, and element-js
|
|
114
|
+
* renders a frame after a change: so the field is rendered here and now, also for an entry that
|
|
115
|
+
* was added or removed a moment ago.
|
|
116
|
+
* @private
|
|
117
|
+
* @param {SubmitEvent} event
|
|
118
|
+
*/
|
|
119
|
+
_onFormSubmit = (event) => {
|
|
120
|
+
const control = this.$refs.input;
|
|
121
|
+
if (!control || event.target !== control.form || this.disabled) return;
|
|
122
|
+
this._addFromInput();
|
|
123
|
+
this.update();
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
events() {
|
|
127
|
+
return {
|
|
128
|
+
'[ref=input]': {
|
|
129
|
+
keydown: (event) => this._onKeydown(event),
|
|
130
|
+
input: (event) => this._onInput(event),
|
|
131
|
+
focus: () => this.onFocus(),
|
|
132
|
+
invalid: (event) => this._onInvalid(event.target),
|
|
133
|
+
},
|
|
134
|
+
// On the field itself: the remove buttons are in the shadow roots of the tags, and what
|
|
135
|
+
// comes out of them arrives here.
|
|
136
|
+
this: {
|
|
137
|
+
focusout: (event) => this._onFocusOut(event),
|
|
138
|
+
'tag-remove': (event) => this._onRemove(event),
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
onFocus() {
|
|
144
|
+
this.valid = this._computeValid();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
onBlur() {
|
|
148
|
+
this.touched = true;
|
|
149
|
+
this.valid = this._computeValid();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Enter adds the text of the input and does not submit the form. In the empty input it is left
|
|
154
|
+
* to the browser, which submits the form, as in any text input.
|
|
155
|
+
* @private
|
|
156
|
+
* @param {KeyboardEvent} event
|
|
157
|
+
*/
|
|
158
|
+
_onKeydown(event) {
|
|
159
|
+
if (event.key !== 'Enter' || event.isComposing) return;
|
|
160
|
+
if (this.$refs.input.value.trim() === '') return;
|
|
161
|
+
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
this._addFromInput();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* A comma ends an entry. What is pasted or dropped is a list of entries, all of it. A comma
|
|
168
|
+
* that is typed ends the entry in front of it, and what follows is the start of the next one.
|
|
169
|
+
* The input is read and not the key: an on-screen keyboard does not say which key it was.
|
|
170
|
+
*
|
|
171
|
+
* Text in the input counts for a required field, see `_computeValid()`.
|
|
172
|
+
* @private
|
|
173
|
+
* @param {InputEvent} event
|
|
174
|
+
*/
|
|
175
|
+
_onInput(event) {
|
|
176
|
+
const control = this.$refs.input;
|
|
177
|
+
|
|
178
|
+
if (control.value.includes(',')) {
|
|
179
|
+
const parts = control.value.split(',');
|
|
180
|
+
const pasted = ['insertFromPaste', 'insertFromDrop'].includes(event.inputType);
|
|
181
|
+
control.value = pasted ? '' : parts.pop().trimStart();
|
|
182
|
+
this._add(parts);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
this.valid = this._computeValid();
|
|
186
|
+
this._syncControl();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The focus has left an element of the field. Once it has left the field, the field is touched.
|
|
191
|
+
* @private
|
|
192
|
+
* @param {FocusEvent} event
|
|
193
|
+
*/
|
|
194
|
+
_onFocusOut(event) {
|
|
195
|
+
if (focusLeft(this, event)) this.onBlur();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* The remove button of an entry was activated. The entry goes, and the focus with it: to the
|
|
200
|
+
* entry that takes its place, or to the input after the last one was removed.
|
|
201
|
+
* @private
|
|
202
|
+
* @param {Event} event
|
|
203
|
+
*/
|
|
204
|
+
_onRemove(event) {
|
|
205
|
+
const tag = event.target;
|
|
206
|
+
const index = Number(tag.dataset?.index);
|
|
207
|
+
const values = this._values();
|
|
208
|
+
if (!(index >= 0 && index < values.length)) return;
|
|
209
|
+
|
|
210
|
+
const hadFocus = tag.matches(':focus-within');
|
|
211
|
+
const [removed] = values.splice(index, 1);
|
|
212
|
+
this.value = values;
|
|
213
|
+
this.valid = this._computeValid();
|
|
214
|
+
this._syncControl();
|
|
215
|
+
this.status = `${this.removedLabel} ${removed}`;
|
|
216
|
+
|
|
217
|
+
if (!hadFocus) return;
|
|
218
|
+
this.requestUpdate().then(() => {
|
|
219
|
+
const tags = this.querySelectorAll('el-tag');
|
|
220
|
+
const next = tags[Math.min(index, tags.length - 1)];
|
|
221
|
+
const target = next?.shadowRoot?.querySelector('[part="remove-button"]') ?? this.$refs.input;
|
|
222
|
+
target?.focus();
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Makes an entry of the text of the input, and empties the input.
|
|
228
|
+
* @private
|
|
229
|
+
* @returns {boolean} Whether there was an entry to add.
|
|
230
|
+
*/
|
|
231
|
+
_addFromInput() {
|
|
232
|
+
const control = this.$refs.input;
|
|
233
|
+
if (!control) return false;
|
|
234
|
+
const text = control.value;
|
|
235
|
+
control.value = '';
|
|
236
|
+
return this._add([text]);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Adds entries to the list: trimmed, and neither an empty one nor one the list already has.
|
|
241
|
+
* @private
|
|
242
|
+
* @param {string[]} texts
|
|
243
|
+
* @returns {boolean} Whether there was an entry to add.
|
|
244
|
+
*/
|
|
245
|
+
_add(texts) {
|
|
246
|
+
const values = this._values();
|
|
247
|
+
const added = [];
|
|
248
|
+
for (const text of texts) {
|
|
249
|
+
const entry = String(text).trim();
|
|
250
|
+
if (entry === '' || values.includes(entry) || added.includes(entry)) continue;
|
|
251
|
+
added.push(entry);
|
|
252
|
+
}
|
|
253
|
+
if (added.length === 0) return false;
|
|
254
|
+
|
|
255
|
+
this.value = [...values, ...added];
|
|
256
|
+
this.valid = this._computeValid();
|
|
257
|
+
this._syncControl();
|
|
258
|
+
this.status = `${this.addedLabel} ${added.join(', ')}`;
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* The entries as a list of texts. An attribute that is no JSON list gives a single text.
|
|
264
|
+
* @private
|
|
265
|
+
* @returns {string[]}
|
|
266
|
+
*/
|
|
267
|
+
_values() {
|
|
268
|
+
if (this.value == null || this.value === '') return [];
|
|
269
|
+
return (Array.isArray(this.value) ? this.value : [this.value]).map(String);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Whether the field currently passes validation: required means at least one entry. Text in
|
|
274
|
+
* the input counts as one: it becomes an entry when the form is submitted.
|
|
275
|
+
* @private
|
|
276
|
+
*/
|
|
277
|
+
_computeValid() {
|
|
278
|
+
if (!this.required) return true;
|
|
279
|
+
return this._values().length > 0 || (this.$refs?.input?.value ?? '').trim() !== '';
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* A native input knows no "at least one entry": it is empty most of the time, with or without
|
|
284
|
+
* entries. So the input carries that for the field, as a validity of its own: the browser then
|
|
285
|
+
* refuses to submit the form, focuses the input and shows its bubble there, as it does for every
|
|
286
|
+
* other field that is required and empty.
|
|
287
|
+
*
|
|
288
|
+
* After every render, and at once when the list changes: the form can be submitted before the
|
|
289
|
+
* next render.
|
|
290
|
+
* @private
|
|
291
|
+
*/
|
|
292
|
+
_syncControl() {
|
|
293
|
+
const message = this._computeValid() ? '' : this.errorMessage || REQUIRED_MESSAGE;
|
|
294
|
+
this.$refs.input?.setCustomValidity(message);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* The input, the entries, what a screen reader is told, and one hidden input for every entry:
|
|
299
|
+
* these are what the form submits, also before the script has run for a list the server
|
|
300
|
+
* rendered.
|
|
301
|
+
* @private
|
|
302
|
+
*/
|
|
303
|
+
fieldTemplate() {
|
|
304
|
+
const values = this._values();
|
|
305
|
+
|
|
306
|
+
return html`
|
|
307
|
+
<input
|
|
308
|
+
ref="input"
|
|
309
|
+
type="text"
|
|
310
|
+
id="${this._idOf('input')}"
|
|
311
|
+
placeholder="${this.placeholder}"
|
|
312
|
+
enterkeyhint="enter"
|
|
313
|
+
?disabled="${this.disabled}"
|
|
314
|
+
${optionalAttribute(!!this.required, 'aria-required', 'true')}
|
|
315
|
+
aria-describedby="${this._describedBy()}"
|
|
316
|
+
aria-invalid="${this.valid ? 'false' : 'true'}"
|
|
317
|
+
aria-errormessage="${this._idOf('error-message')}"
|
|
318
|
+
/>
|
|
319
|
+
${this.tagsTemplate(values)}
|
|
320
|
+
<span class="status" role="status">${this.status}</span>
|
|
321
|
+
${values.map(
|
|
322
|
+
(value) =>
|
|
323
|
+
html`<input type="hidden" name="${this.name}" value="${value}" ?disabled="${this.disabled}" />`,
|
|
324
|
+
)}
|
|
325
|
+
`;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* The entries, as a list that has the name of the field. A field that is disabled has no
|
|
330
|
+
* remove buttons.
|
|
331
|
+
* @private
|
|
332
|
+
* @param {string[]} values
|
|
333
|
+
*/
|
|
334
|
+
tagsTemplate(values) {
|
|
335
|
+
if (values.length === 0) return null;
|
|
336
|
+
|
|
337
|
+
return html`
|
|
338
|
+
<ul class="tags" role="list" ${optionalAttribute(!!this.label, 'aria-label', this.label)}>
|
|
339
|
+
${values.map(
|
|
340
|
+
(value, index) => html`
|
|
341
|
+
<li>
|
|
342
|
+
<el-tag
|
|
343
|
+
size="${this.size}"
|
|
344
|
+
removable="${this.disabled ? 'false' : 'true'}"
|
|
345
|
+
remove-label="${this.removeLabel}"
|
|
346
|
+
data-index="${index}"
|
|
347
|
+
>${value}</el-tag
|
|
348
|
+
>
|
|
349
|
+
</li>
|
|
350
|
+
`,
|
|
351
|
+
)}
|
|
352
|
+
</ul>
|
|
353
|
+
`;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export function define() {
|
|
358
|
+
defineElement('el-tag-field', TagField);
|
|
359
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# TagField
|
|
2
|
+
|
|
3
|
+
`tag-field` takes a list of short texts the user writes: keywords of an article, skills in a profile, recipients of an invitation. It is a text input that turns what is entered into entries, each an [`el-tag`](../tag/tag.readme.md) with a remove button, and submits them under one name. It extends `form-field`, inheriting the label, help text, error message, `required` and touched-state handling.
|
|
4
|
+
|
|
5
|
+
For a list the page knows, use `el-checkbox-group-field`.
|
|
6
|
+
|
|
7
|
+
It is headless by default: the input keeps the look of the browser. `styles/native.css` gives it the look of the input of `el-input-field`. The tags bring their look along.
|
|
8
|
+
|
|
9
|
+
## How to use
|
|
10
|
+
|
|
11
|
+
#### Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm i --save @webtides/element-library
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
#### Use
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import '@webtides/element-library/tag-field/define';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<el-tag-field name="skills" label="Skills" value='["TypeScript", "Svelte"]'></el-tag-field>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The field registers `el-tag` itself.
|
|
28
|
+
|
|
29
|
+
#### Adding and removing
|
|
30
|
+
|
|
31
|
+
- **Enter** adds the text of the input as an entry. In a form it does not submit the form then; Enter in the empty input does, as in any text input.
|
|
32
|
+
- **A comma** ends an entry, typed or pasted: a pasted `news, offers, events` is three entries.
|
|
33
|
+
- **The remove button** of a tag takes its entry away. The focus goes to the entry that takes its place, or to the input after the last one.
|
|
34
|
+
|
|
35
|
+
An entry is trimmed. An empty one and one the list already has are not added.
|
|
36
|
+
|
|
37
|
+
#### Text that is still in the input
|
|
38
|
+
|
|
39
|
+
Text that is in the input when the form is submitted becomes an entry with the submit: nothing that was typed is lost on the way to the submit button. For a required field that text counts as an entry.
|
|
40
|
+
|
|
41
|
+
It does not become an entry earlier, when the user leaves the field. A new entry makes the field higher, and the submit button below it would move away under the pointer that is pressing it.
|
|
42
|
+
|
|
43
|
+
Outside of a form, text in the input is no entry until Enter or a comma.
|
|
44
|
+
|
|
45
|
+
#### The value
|
|
46
|
+
|
|
47
|
+
`value` is the list of the entries, in the order they were added. As an attribute it is JSON, from a script it is an array:
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
field.value = ['TypeScript', 'Svelte'];
|
|
51
|
+
field.addEventListener('input-change', (event) => {
|
|
52
|
+
event.detail; // ['TypeScript', 'Svelte', 'CSS']
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
In a form every entry is submitted under the `name`, by a hidden input: `formData.getAll('skills')`. A list the server rendered is submitted also before the script has run.
|
|
57
|
+
|
|
58
|
+
## API
|
|
59
|
+
|
|
60
|
+
#### Properties/Attributes
|
|
61
|
+
|
|
62
|
+
Inherits all of `form-field`'s properties (`name`, `value`, `required`, `disabled`, `label`, `labelScreenReaderOnly`, `errorMessage`, `helpMessage`, `valid`, `touched`) and adds:
|
|
63
|
+
|
|
64
|
+
| Name | Type | Default | Description |
|
|
65
|
+
| --- | --- | --- | --- |
|
|
66
|
+
| `value` | `string[]` | `[]` | The entries, in the order they were added. |
|
|
67
|
+
| `size` | `'small' \| 'medium' \| 'large'` | `'medium'` | Size of the input and of the tags. Reflected to the `size` attribute. |
|
|
68
|
+
| `placeholder` | `string` | `''` | Placeholder text shown while the input is empty. |
|
|
69
|
+
| `removeLabel` | `string` | `'Remove'` | The word the remove button of an entry is named with, in front of the entry: "Remove TypeScript". |
|
|
70
|
+
| `addedLabel` | `string` | `'Added'` | What a screen reader hears in front of an entry that was added: "Added TypeScript". |
|
|
71
|
+
| `removedLabel` | `string` | `'Removed'` | What a screen reader hears in front of an entry that was removed: "Removed TypeScript". |
|
|
72
|
+
| `status` | `string` | `''` | What the field last told a screen reader. Set by the field. |
|
|
73
|
+
|
|
74
|
+
`required` means at least one entry. The browser has no text for that in its bubble: it shows the `errorMessage` of the field, and "Add at least one entry." without one. As an `el-input-field`, the field is not marked as not valid before the user has been in it.
|
|
75
|
+
|
|
76
|
+
#### Events
|
|
77
|
+
|
|
78
|
+
| Name | Detail | Description |
|
|
79
|
+
| -------------- | --------------------- | --------------------------------------------------------------- |
|
|
80
|
+
| `input-change` | `string[]` (the list) | Fired when the entries change: added, removed, set by a script. |
|
|
81
|
+
|
|
82
|
+
#### CSS States
|
|
83
|
+
|
|
84
|
+
| Name | Description |
|
|
85
|
+
| --------- | ----------------------------------------------------------------------------------------------- |
|
|
86
|
+
| `touched` | Set once the user has left the field. Moving from the input to a remove button does not set it. |
|
|
87
|
+
| `valid` | Set while the field passes validation. |
|
|
88
|
+
| `invalid` | Set while the field fails validation (`required` with no entry and no text in the input). |
|
|
89
|
+
|
|
90
|
+
#### CSS Custom Properties
|
|
91
|
+
|
|
92
|
+
Headless by default. The texts read the tokens every field reads (`--el-color-fg`, `--el-color-fg-muted`, `--el-color-danger`, `--el-font-size-sm`, `--el-space-1`, `--el-space-2`). With `styles/native.css` the input has the border, the radius, the padding, the colours, the focus ring and the three sizes of the input of `el-input-field`.
|
|
93
|
+
|
|
94
|
+
The entries are `el-tag` in the size of the field, with the neutral variant. Style them as any tag, through their parts:
|
|
95
|
+
|
|
96
|
+
```css
|
|
97
|
+
el-tag-field el-tag::part(base) {
|
|
98
|
+
border-radius: 999px;
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
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`. The entries stand below the input, in rows that wrap with a gap of `--el-space-1`. An entry that is longer than the field is cut off, its remove button stays.
|
|
103
|
+
|
|
104
|
+
On a touch screen (`@media (any-pointer: coarse)`) the input and the remove button of every tag are at least `--el-touch-target` high. Without that token, and on a fine pointer, the sizes stay as they are.
|
|
105
|
+
|
|
106
|
+
## Accessibility
|
|
107
|
+
|
|
108
|
+
- The input is a native text input, named by the label (`<label for>`). It names the help message in `aria-describedby`, and the error message while that is shown, and says whether it is valid (`aria-invalid`) and required (`aria-required`).
|
|
109
|
+
- The entries are a list with the name of the field, after the input in the document: Tab goes from the input to every remove button, and on.
|
|
110
|
+
- Every remove button is named with its entry: "Remove TypeScript". Set `removeLabel` to the word of your language.
|
|
111
|
+
- A screen reader does not see an entry appear or go, so the field says it in a live region (`role="status"`): "Added TypeScript", "Removed TypeScript". Set `addedLabel` and `removedLabel` to the words of your language.
|
|
112
|
+
- Say in the help message how an entry is added: Enter, or a comma.
|
|
113
|
+
- Validation messages surface only once the field is `touched`. The error message is an alert (`role="alert"`): a screen reader announces it when it appears.
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
|
|
5
|
+
const css = String.raw;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The input keeps the look of the browser, as the control of every field does: `styles/native.css`
|
|
9
|
+
* decorates it. The entries are `el-tag` and bring their look along.
|
|
10
|
+
*/
|
|
11
|
+
const style = css`
|
|
12
|
+
el-tag-field {
|
|
13
|
+
/* The row of the control is the input and, below it, the entries: they wrap. */
|
|
14
|
+
.field {
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.tags {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex: 1 1 100%;
|
|
21
|
+
flex-wrap: wrap;
|
|
22
|
+
gap: var(--el-space-1, 4px);
|
|
23
|
+
min-width: 0;
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
list-style: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* An entry that is longer than the field is cut off by its tag. */
|
|
30
|
+
.tags li {
|
|
31
|
+
display: flex;
|
|
32
|
+
min-width: 0;
|
|
33
|
+
max-width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* What a screen reader is told: off the screen, and still there for it. */
|
|
37
|
+
.status {
|
|
38
|
+
position: absolute;
|
|
39
|
+
width: 1px;
|
|
40
|
+
height: 1px;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
clip-path: inset(50%);
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Touch screens: the input is at least --el-touch-target high, whatever the size of the
|
|
47
|
+
field. The remove button of a tag has that size from the tag. Without the token the sizes
|
|
48
|
+
stay as they are. */
|
|
49
|
+
@media (any-pointer: coarse) {
|
|
50
|
+
input {
|
|
51
|
+
min-height: max(
|
|
52
|
+
calc(var(--el-control-height, 0px) * var(--_el-size-scale, 1)),
|
|
53
|
+
var(--el-touch-target, 0px)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
export default [hostStyle('el-tag-field'), formControlStyle('el-tag-field'), sizeStyle('el-tag-field'), style].join(
|
|
61
|
+
'\n',
|
|
62
|
+
);
|
|
@@ -10,11 +10,35 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
10
10
|
Uncomment headings as needed.
|
|
11
11
|
-->
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.3.0] - 2026-11-17
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `autocomplete`, `inputmode`, `enterkeyhint`, `autocapitalize`, `autocorrect` and `spellcheck` are passed on to the native `<textarea>`, in server-rendered markup and on every render. Set them as attributes or properties on the element; one that is not set is left out on the `<textarea>`. Before, the field dropped them.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- On a touch screen (`@media (any-pointer: coarse)`) the textarea is at least `--el-touch-target` high, which matters for `rows="1"`, and the clear cross of an invalid field at least that wide and high (9 × 18 px before). Unchanged on a fine pointer and without the token.
|
|
24
|
+
- The label, the help message, the textarea and the error message stack in a column with a gap of `--el-space-1` (4 px without a theme), as in `el-input-field`. Before, the label and the help message shared a line. The messages are set in `--el-font-size-sm` (14 px without a theme; they had the size of the text), the help message has the muted colour of the theme (`--el-color-fg-muted`) and the label its text colour (`--el-color-fg`); without a theme they keep the colour of the text. A help message without a text takes no room. ([#130](https://github.com/webtides/element-library/issues/130))
|
|
25
|
+
|
|
16
26
|
<!-- ### Removed -->
|
|
17
|
-
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- A server-rendered `el-textarea-field` shows its value before its JavaScript runs, and without JavaScript. The value is now rendered as the content of the `<textarea>`; before, it was written as a `value` attribute, which a textarea does not have, so the field stayed empty and submitting the form sent an empty text. Known limit: a line break at the very start of the value is missing until the element has started, because the HTML parser drops a line break that directly follows `<textarea>`.
|
|
31
|
+
- A re-render no longer overwrites text typed since the last change the field has seen. Before, every render wrote `value` back into the control: a required field renders right after it gets the focus, and text that arrived then was gone. ([#100](https://github.com/webtides/element-library/issues/100))
|
|
32
|
+
- `value` follows the textarea on every `input`. Text that arrives without a key going up is the value of the field at once and is reported with `input-change`: a paste with the mouse, dictation, a suggestion of an on-screen keyboard, a script that fills the field. Before, the field read the textarea on `keyup` and `change` only: it did not know such text until the field was left, and a required field counted as not valid for that long. ([#100](https://github.com/webtides/element-library/issues/100))
|
|
33
|
+
- The mark of a touched field (✓ or ✗) stands beside the textarea, at its top, and has the colours it has beside an input (`--el-color-success`, `--el-color-danger`). Before, it was a line of its own below the textarea: the field grew by that line when it was left for the first time, and what came after it moved down. A click on a button below the field was lost that way, when the button moved away between the press and the release. A textarea that is as wide as the field gets narrower by the mark and the gap. On a touch screen the mark has the width of `--el-touch-target` in both states, so the textarea keeps its width when the validity changes. ([#101](https://github.com/webtides/element-library/issues/101))
|
|
34
|
+
- `aria-describedby` on the textarea now names the help message. It pointed at `<name>-help`, an id that does not exist.
|
|
35
|
+
- The error message is announced by screen readers: it is an alert (`role="alert"`), and the textarea names it in `aria-describedby` while it is shown. Before, nothing connected the message with the textarea. ([#94](https://github.com/webtides/element-library/issues/94))
|
|
36
|
+
- The cross of a field that is not valid empties `value` as well, reports it with `input-change`, and `valid` follows the empty textarea. Before, only the textarea was emptied. See `form-field`. ([#115](https://github.com/webtides/element-library/issues/115))
|
|
37
|
+
- The error message has the danger colour of the theme (`--el-color-danger`). It had the colour of the text and read like a help message, while the messages of an `el-input-field` on the same form were red. Without a theme it keeps the colour of the text, which is what every field does now. ([#128](https://github.com/webtides/element-library/issues/128))
|
|
38
|
+
- The `hidden` attribute hides the field. The field sets a `display` of its own, which won over the attribute. ([#130](https://github.com/webtides/element-library/issues/130))
|
|
39
|
+
- The textarea 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))
|
|
40
|
+
- A second field with the same `name` on the page keeps its own label and its own messages. The ids of the textarea and of the messages are made per field, not from the name (BREAKING for a page that names `input-<name>` or `<name>-help-message` itself). See `form-field`. ([#133](https://github.com/webtides/element-library/issues/133))
|
|
41
|
+
- A textarea of one row with the look of the browser is as high after it was left as before in a page with high lines. The mark beside it (✓ or ✗) made the field grow by 3 px at a line height of 1.5. See `form-field`. ([#116](https://github.com/webtides/element-library/issues/116))
|
|
18
42
|
|
|
19
43
|
## [0.1.0] - 2026-06-03
|
|
20
44
|
|