@webtides/element-library 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +399 -3
- package/README.md +61 -41
- package/all.js +28 -0
- package/catalog.d.ts +14 -0
- package/catalog.js +55 -27
- package/custom-elements.json +16676 -3457
- package/package.json +35 -28
- package/src/components/accordion/accordion.changelog.md +10 -0
- package/src/components/accordion/accordion.js +10 -7
- package/src/components/accordion/accordion.readme.md +2 -0
- package/src/components/accordion/accordion.style.js +8 -0
- package/src/components/amount-field/amount-field.changelog.md +23 -3
- package/src/components/amount-field/amount-field.js +53 -26
- package/src/components/amount-field/amount-field.readme.md +82 -20
- package/src/components/amount-field/amount-field.style.js +111 -47
- package/src/components/avatar/avatar.changelog.md +23 -0
- package/src/components/avatar/avatar.define.js +3 -0
- package/src/components/avatar/avatar.js +115 -0
- package/src/components/avatar/avatar.readme.md +132 -0
- package/src/components/avatar/avatar.style.js +67 -0
- package/src/components/badge/badge.changelog.md +23 -0
- package/src/components/badge/badge.define.js +3 -0
- package/src/components/badge/badge.js +59 -0
- package/src/components/badge/badge.readme.md +109 -0
- package/src/components/badge/badge.style.js +63 -0
- package/src/components/breadcrumb/breadcrumb.changelog.md +22 -0
- package/src/components/breadcrumb/breadcrumb.define.js +3 -0
- package/src/components/breadcrumb/breadcrumb.js +47 -0
- package/src/components/breadcrumb/breadcrumb.readme.md +108 -0
- package/src/components/breadcrumb/breadcrumb.style.js +20 -0
- package/src/components/breadcrumb-item/breadcrumb-item.changelog.md +23 -0
- package/src/components/breadcrumb-item/breadcrumb-item.define.js +3 -0
- package/src/components/breadcrumb-item/breadcrumb-item.js +82 -0
- package/src/components/breadcrumb-item/breadcrumb-item.readme.md +106 -0
- package/src/components/breadcrumb-item/breadcrumb-item.style.js +92 -0
- package/src/components/button/button.changelog.md +44 -1
- package/src/components/button/button.js +338 -29
- package/src/components/button/button.readme.md +138 -10
- package/src/components/button/button.style.js +99 -120
- package/src/components/button-group/button-group.changelog.md +24 -0
- package/src/components/button-group/button-group.define.js +3 -0
- package/src/components/button-group/button-group.js +53 -0
- package/src/components/button-group/button-group.readme.md +114 -0
- package/src/components/button-group/button-group.style.js +41 -0
- package/src/components/card/card.changelog.md +23 -0
- package/src/components/card/card.define.js +3 -0
- package/src/components/card/card.js +73 -0
- package/src/components/card/card.readme.md +136 -0
- package/src/components/card/card.style.js +99 -0
- package/src/components/carousel/carousel.changelog.md +20 -0
- package/src/components/carousel/carousel.js +89 -40
- package/src/components/carousel/carousel.readme.md +39 -6
- package/src/components/carousel/carousel.style.js +21 -77
- package/src/components/carousel/glide/components/ShadowAnchors.js +3 -1
- package/src/components/carousel/glide/components/ShadowClones.js +21 -24
- package/src/components/carousel/glide/components/ShadowGaps.js +2 -2
- package/src/components/carousel/glide/components/ShadowHtml.js +22 -3
- package/src/components/checkbox-field/checkbox-field.changelog.md +25 -0
- package/src/components/checkbox-field/checkbox-field.js +32 -11
- package/src/components/checkbox-field/checkbox-field.readme.md +17 -4
- package/src/components/checkbox-field/checkbox-field.style.js +15 -3
- package/src/components/checkbox-group-field/checkbox-group-field.changelog.md +25 -0
- package/src/components/checkbox-group-field/checkbox-group-field.define.js +3 -0
- package/src/components/checkbox-group-field/checkbox-group-field.js +217 -0
- package/src/components/checkbox-group-field/checkbox-group-field.readme.md +95 -0
- package/src/components/checkbox-group-field/checkbox-group-field.style.js +62 -0
- package/src/components/color-field/color-field.changelog.md +24 -0
- package/src/components/color-field/color-field.define.js +3 -0
- package/src/components/color-field/color-field.js +184 -0
- package/src/components/color-field/color-field.readme.md +95 -0
- package/src/components/color-field/color-field.style.js +39 -0
- package/src/components/combobox-field/combobox-field.changelog.md +23 -0
- package/src/components/combobox-field/combobox-field.define.js +3 -0
- package/src/components/combobox-field/combobox-field.js +97 -0
- package/src/components/combobox-field/combobox-field.readme.md +93 -0
- package/src/components/combobox-field/combobox-field.style.js +56 -0
- package/src/components/copy-button/copy-button.changelog.md +24 -0
- package/src/components/copy-button/copy-button.define.js +3 -0
- package/src/components/copy-button/copy-button.events.js +4 -0
- package/src/components/copy-button/copy-button.js +237 -0
- package/src/components/copy-button/copy-button.readme.md +134 -0
- package/src/components/copy-button/copy-button.style.js +109 -0
- package/src/components/date-field/date-field.changelog.md +24 -0
- package/src/components/date-field/date-field.define.js +3 -0
- package/src/components/date-field/date-field.js +119 -0
- package/src/components/date-field/date-field.readme.md +110 -0
- package/src/components/date-field/date-field.style.js +53 -0
- package/src/components/dialog/dialog.changelog.md +16 -1
- package/src/components/dialog/dialog.js +252 -57
- package/src/components/dialog/dialog.readme.md +36 -4
- package/src/components/dialog/dialog.style.js +9 -109
- package/src/components/divider/divider.changelog.md +23 -0
- package/src/components/divider/divider.define.js +3 -0
- package/src/components/divider/divider.js +48 -0
- package/src/components/divider/divider.readme.md +101 -0
- package/src/components/divider/divider.style.js +50 -0
- package/src/components/drawer/drawer.changelog.md +25 -0
- package/src/components/drawer/drawer.define.js +3 -0
- package/src/components/drawer/drawer.events.js +8 -0
- package/src/components/drawer/drawer.js +80 -0
- package/src/components/drawer/drawer.readme.md +194 -0
- package/src/components/drawer/drawer.style.js +83 -0
- package/src/components/dropdown/dropdown.js +9 -7
- package/src/components/empty-state/empty-state.changelog.md +22 -0
- package/src/components/empty-state/empty-state.define.js +3 -0
- package/src/components/empty-state/empty-state.js +55 -0
- package/src/components/empty-state/empty-state.readme.md +114 -0
- package/src/components/empty-state/empty-state.style.js +60 -0
- package/src/components/file-field/file-field.changelog.md +24 -0
- package/src/components/file-field/file-field.define.js +3 -0
- package/src/components/file-field/file-field.js +205 -0
- package/src/components/file-field/file-field.readme.md +103 -0
- package/src/components/file-field/file-field.style.js +28 -0
- package/src/components/form-field/form-field.changelog.md +25 -0
- package/src/components/form-field/form-field.js +212 -15
- package/src/components/form-field/form-field.readme.md +82 -18
- package/src/components/form-field/form-field.style.js +6 -24
- package/src/components/input-field/input-field.changelog.md +24 -0
- package/src/components/input-field/input-field.js +82 -6
- package/src/components/input-field/input-field.readme.md +34 -5
- package/src/components/input-field/input-field.style.js +32 -13
- package/src/components/notification/notification.changelog.md +21 -1
- package/src/components/notification/notification.js +80 -74
- package/src/components/notification/notification.readme.md +54 -13
- package/src/components/notification/notification.style.js +37 -22
- package/src/components/otp-field/otp-field.changelog.md +23 -0
- package/src/components/otp-field/otp-field.define.js +3 -0
- package/src/components/otp-field/otp-field.events.js +3 -0
- package/src/components/otp-field/otp-field.js +172 -0
- package/src/components/otp-field/otp-field.readme.md +111 -0
- package/src/components/otp-field/otp-field.style.js +53 -0
- package/src/components/pagination/pagination.changelog.md +30 -0
- package/src/components/pagination/pagination.define.js +3 -0
- package/src/components/pagination/pagination.events.js +3 -0
- package/src/components/pagination/pagination.js +282 -0
- package/src/components/pagination/pagination.readme.md +167 -0
- package/src/components/pagination/pagination.style.js +162 -0
- package/src/components/password-field/password-field.changelog.md +24 -0
- package/src/components/password-field/password-field.js +7 -1
- package/src/components/password-field/password-field.readme.md +15 -6
- package/src/components/password-field/password-field.style.js +36 -13
- package/src/components/popover/popover.changelog.md +24 -0
- package/src/components/popover/popover.define.js +3 -0
- package/src/components/popover/popover.events.js +4 -0
- package/src/components/popover/popover.js +255 -0
- package/src/components/popover/popover.readme.md +132 -0
- package/src/components/popover/popover.style.js +41 -0
- package/src/components/progress-bar/progress-bar.changelog.md +23 -0
- package/src/components/progress-bar/progress-bar.define.js +3 -0
- package/src/components/progress-bar/progress-bar.js +80 -0
- package/src/components/progress-bar/progress-bar.readme.md +110 -0
- package/src/components/progress-bar/progress-bar.style.js +93 -0
- package/src/components/progress-ring/progress-ring.changelog.md +23 -0
- package/src/components/progress-ring/progress-ring.define.js +3 -0
- package/src/components/progress-ring/progress-ring.js +83 -0
- package/src/components/progress-ring/progress-ring.readme.md +115 -0
- package/src/components/progress-ring/progress-ring.style.js +85 -0
- package/src/components/radio-field/radio-field.changelog.md +16 -0
- package/src/components/radio-field/radio-field.js +34 -11
- package/src/components/radio-field/radio-field.readme.md +13 -8
- package/src/components/radio-field/radio-field.style.js +17 -65
- package/src/components/range-field/range-field.changelog.md +24 -0
- package/src/components/range-field/range-field.define.js +3 -0
- package/src/components/range-field/range-field.js +167 -0
- package/src/components/range-field/range-field.readme.md +87 -0
- package/src/components/range-field/range-field.style.js +41 -0
- package/src/components/rating-field/rating-field.changelog.md +24 -0
- package/src/components/rating-field/rating-field.define.js +3 -0
- package/src/components/rating-field/rating-field.js +195 -0
- package/src/components/rating-field/rating-field.readme.md +82 -0
- package/src/components/rating-field/rating-field.style.js +79 -0
- package/src/components/select-field/select-field.changelog.md +17 -0
- package/src/components/select-field/select-field.js +100 -8
- package/src/components/select-field/select-field.readme.md +32 -6
- package/src/components/select-field/select-field.style.js +19 -9
- package/src/components/skeleton/skeleton.changelog.md +22 -0
- package/src/components/skeleton/skeleton.define.js +3 -0
- package/src/components/skeleton/skeleton.js +49 -0
- package/src/components/skeleton/skeleton.readme.md +115 -0
- package/src/components/skeleton/skeleton.style.js +79 -0
- package/src/components/slider/slider.changelog.md +15 -0
- package/src/components/slider/slider.js +37 -5
- package/src/components/slider/slider.readme.md +28 -6
- package/src/components/slider/slider.style.js +7 -71
- package/src/components/spinner/spinner.changelog.md +22 -0
- package/src/components/spinner/spinner.define.js +3 -0
- package/src/components/spinner/spinner.js +48 -0
- package/src/components/spinner/spinner.readme.md +98 -0
- package/src/components/spinner/spinner.style.js +44 -0
- package/src/components/switch-field/switch-field.changelog.md +22 -0
- package/src/components/switch-field/switch-field.js +24 -10
- package/src/components/switch-field/switch-field.readme.md +11 -4
- package/src/components/switch-field/switch-field.style.js +13 -13
- package/src/components/tab-group/tab-group.changelog.md +19 -0
- package/src/components/tab-group/tab-group.js +122 -10
- package/src/components/tab-group/tab-group.readme.md +25 -4
- package/src/components/tab-link/tab-link.changelog.md +16 -0
- package/src/components/tab-link/tab-link.js +51 -8
- package/src/components/tab-link/tab-link.readme.md +14 -8
- package/src/components/tab-link/tab-link.style.js +13 -0
- package/src/components/tab-panel/tab-panel.changelog.md +8 -2
- package/src/components/tab-panel/tab-panel.js +7 -3
- package/src/components/tab-panel/tab-panel.readme.md +7 -5
- package/src/components/tag/tag.changelog.md +24 -0
- package/src/components/tag/tag.define.js +3 -0
- package/src/components/tag/tag.events.js +3 -0
- package/src/components/tag/tag.js +116 -0
- package/src/components/tag/tag.readme.md +119 -0
- package/src/components/tag/tag.style.js +101 -0
- package/src/components/tag-field/tag-field.changelog.md +25 -0
- package/src/components/tag-field/tag-field.define.js +3 -0
- package/src/components/tag-field/tag-field.js +359 -0
- package/src/components/tag-field/tag-field.readme.md +113 -0
- package/src/components/tag-field/tag-field.style.js +62 -0
- package/src/components/textarea-field/textarea-field.changelog.md +28 -4
- package/src/components/textarea-field/textarea-field.js +68 -14
- package/src/components/textarea-field/textarea-field.readme.md +45 -9
- package/src/components/textarea-field/textarea-field.style.js +45 -2
- package/src/components/toast/toast.changelog.md +24 -0
- package/src/components/toast/toast.define.js +3 -0
- package/src/components/toast/toast.js +193 -0
- package/src/components/toast/toast.readme.md +189 -0
- package/src/components/toast/toast.style.js +74 -0
- package/src/components/tooltip/tooltip.changelog.md +24 -0
- package/src/components/tooltip/tooltip.define.js +3 -0
- package/src/components/tooltip/tooltip.events.js +4 -0
- package/src/components/tooltip/tooltip.js +377 -0
- package/src/components/tooltip/tooltip.readme.md +172 -0
- package/src/components/tooltip/tooltip.style.js +107 -0
- package/src/components/transition-classes/transition-classes.js +6 -6
- package/src/styles/appearance.style.js +42 -0
- package/src/styles/arrow.style.js +65 -0
- package/src/styles/choice-group.style.js +94 -0
- package/src/styles/form-control.style.js +79 -0
- package/src/styles/host.style.js +55 -0
- package/src/styles/layers.css +31 -0
- package/src/styles/modal.style.js +146 -0
- package/src/styles/native.css +275 -0
- package/src/styles/size.style.js +48 -0
- package/src/styles/slide-controls.style.js +225 -0
- package/src/styles/utilities.css +30 -0
- package/src/styles/variants.style.js +78 -0
- package/src/themes/default.css +86 -142
- package/src/themes/high-contrast.css +72 -129
- package/src/themes/sketchy.css +95 -175
- package/src/utils/floating.js +71 -0
- package/src/utils/focus.js +18 -0
- package/src/utils/progress.js +25 -0
- package/src/utils/slots.js +21 -0
- package/src/utils/text-entry-attributes.js +51 -0
- package/types/all.d.ts +54 -1
- package/types/index.d.ts +1 -0
- package/types/src/components/accordion/accordion.d.ts +6 -4
- package/types/src/components/accordion/accordion.events.d.ts +3 -3
- package/types/src/components/accordion-group/accordion-group.d.ts +4 -3
- package/types/src/components/amount-field/amount-field.d.ts +30 -16
- package/types/src/components/avatar/avatar.d.ts +57 -0
- package/types/src/components/avatar/avatar.define.d.ts +1 -0
- package/types/src/components/avatar/avatar.style.d.ts +2 -0
- package/types/src/components/badge/badge.d.ts +32 -0
- package/types/src/components/badge/badge.define.d.ts +1 -0
- package/types/src/components/badge/badge.style.d.ts +2 -0
- package/types/src/components/breadcrumb/breadcrumb.d.ts +27 -0
- package/types/src/components/breadcrumb/breadcrumb.define.d.ts +1 -0
- package/types/src/components/breadcrumb/breadcrumb.style.d.ts +2 -0
- package/types/src/components/breadcrumb-item/breadcrumb-item.d.ts +38 -0
- package/types/src/components/breadcrumb-item/breadcrumb-item.define.d.ts +1 -0
- package/types/src/components/breadcrumb-item/breadcrumb-item.style.d.ts +2 -0
- package/types/src/components/button/button.d.ts +158 -14
- package/types/src/components/button-group/button-group.d.ts +28 -0
- package/types/src/components/button-group/button-group.define.d.ts +1 -0
- package/types/src/components/button-group/button-group.style.d.ts +2 -0
- package/types/src/components/card/card.d.ts +40 -0
- package/types/src/components/card/card.define.d.ts +1 -0
- package/types/src/components/card/card.style.d.ts +2 -0
- package/types/src/components/carousel/carousel.d.ts +22 -8
- package/types/src/components/carousel/carousel.events.d.ts +3 -3
- package/types/src/components/carousel/glide/components/ShadowAnchors.d.ts +1 -1
- package/types/src/components/carousel/glide/components/ShadowClones.d.ts +8 -1
- package/types/src/components/carousel/glide/components/ShadowGaps.d.ts +1 -1
- package/types/src/components/carousel/glide/components/ShadowHtml.d.ts +1 -1
- package/types/src/components/carousel/glide/components/glide-html.d.ts +1 -1
- package/types/src/components/checkbox-field/checkbox-field.d.ts +22 -15
- package/types/src/components/checkbox-group-field/checkbox-group-field.d.ts +100 -0
- package/types/src/components/checkbox-group-field/checkbox-group-field.define.d.ts +1 -0
- package/types/src/components/checkbox-group-field/checkbox-group-field.style.d.ts +2 -0
- package/types/src/components/color-field/color-field.d.ts +102 -0
- package/types/src/components/color-field/color-field.define.d.ts +1 -0
- package/types/src/components/color-field/color-field.style.d.ts +2 -0
- package/types/src/components/combobox-field/combobox-field.d.ts +84 -0
- package/types/src/components/combobox-field/combobox-field.define.d.ts +1 -0
- package/types/src/components/combobox-field/combobox-field.style.d.ts +2 -0
- package/types/src/components/copy-button/copy-button.d.ts +93 -0
- package/types/src/components/copy-button/copy-button.define.d.ts +1 -0
- package/types/src/components/copy-button/copy-button.events.d.ts +5 -0
- package/types/src/components/copy-button/copy-button.style.d.ts +2 -0
- package/types/src/components/date-field/date-field.d.ts +102 -0
- package/types/src/components/date-field/date-field.define.d.ts +1 -0
- package/types/src/components/date-field/date-field.style.d.ts +2 -0
- package/types/src/components/dialog/dialog.d.ts +101 -19
- package/types/src/components/dialog/dialog.events.d.ts +8 -8
- package/types/src/components/divider/divider.d.ts +27 -0
- package/types/src/components/divider/divider.define.d.ts +1 -0
- package/types/src/components/divider/divider.style.d.ts +2 -0
- package/types/src/components/drawer/drawer.d.ts +70 -0
- package/types/src/components/drawer/drawer.define.d.ts +1 -0
- package/types/src/components/drawer/drawer.events.d.ts +9 -0
- package/types/src/components/drawer/drawer.style.d.ts +2 -0
- package/types/src/components/dropdown/dropdown.d.ts +5 -3
- package/types/src/components/empty-state/empty-state.d.ts +29 -0
- package/types/src/components/empty-state/empty-state.define.d.ts +1 -0
- package/types/src/components/empty-state/empty-state.style.d.ts +2 -0
- package/types/src/components/file-field/file-field.d.ts +115 -0
- package/types/src/components/file-field/file-field.define.d.ts +1 -0
- package/types/src/components/file-field/file-field.style.d.ts +2 -0
- package/types/src/components/form-field/form-field.d.ts +129 -14
- package/types/src/components/form-field/form-field.events.d.ts +4 -4
- package/types/src/components/input-field/input-field.d.ts +52 -5
- package/types/src/components/lazy-src/lazy-src.d.ts +7 -5
- package/types/src/components/lazy-src/lazy-src.events.d.ts +5 -5
- package/types/src/components/notification/notification.d.ts +18 -18
- package/types/src/components/notification/notification.events.d.ts +6 -6
- package/types/src/components/otp-field/otp-field.d.ts +130 -0
- package/types/src/components/otp-field/otp-field.define.d.ts +1 -0
- package/types/src/components/otp-field/otp-field.events.d.ts +4 -0
- package/types/src/components/otp-field/otp-field.style.d.ts +2 -0
- package/types/src/components/pagination/pagination.d.ts +117 -0
- package/types/src/components/pagination/pagination.define.d.ts +1 -0
- package/types/src/components/pagination/pagination.events.d.ts +4 -0
- package/types/src/components/pagination/pagination.style.d.ts +2 -0
- package/types/src/components/password-field/password-field.d.ts +29 -12
- package/types/src/components/popover/popover.d.ts +123 -0
- package/types/src/components/popover/popover.define.d.ts +1 -0
- package/types/src/components/popover/popover.events.d.ts +5 -0
- package/types/src/components/popover/popover.style.d.ts +2 -0
- package/types/src/components/progress-bar/progress-bar.d.ts +35 -0
- package/types/src/components/progress-bar/progress-bar.define.d.ts +1 -0
- package/types/src/components/progress-bar/progress-bar.style.d.ts +2 -0
- package/types/src/components/progress-ring/progress-ring.d.ts +40 -0
- package/types/src/components/progress-ring/progress-ring.define.d.ts +1 -0
- package/types/src/components/progress-ring/progress-ring.style.d.ts +2 -0
- package/types/src/components/radio-field/radio-field.d.ts +21 -9
- package/types/src/components/range-field/range-field.d.ts +94 -0
- package/types/src/components/range-field/range-field.define.d.ts +1 -0
- package/types/src/components/range-field/range-field.style.d.ts +2 -0
- package/types/src/components/rating-field/rating-field.d.ts +96 -0
- package/types/src/components/rating-field/rating-field.define.d.ts +1 -0
- package/types/src/components/rating-field/rating-field.style.d.ts +2 -0
- package/types/src/components/scroll-to/scroll-to.d.ts +3 -2
- package/types/src/components/scroll-to-top/scroll-to-top.d.ts +4 -2
- package/types/src/components/select-field/select-field.d.ts +55 -5
- package/types/src/components/skeleton/skeleton.d.ts +29 -0
- package/types/src/components/skeleton/skeleton.define.d.ts +1 -0
- package/types/src/components/skeleton/skeleton.style.d.ts +2 -0
- package/types/src/components/slider/slider.d.ts +14 -8
- package/types/src/components/slider/slider.events.d.ts +4 -4
- package/types/src/components/spinner/spinner.d.ts +28 -0
- package/types/src/components/spinner/spinner.define.d.ts +1 -0
- package/types/src/components/spinner/spinner.style.d.ts +2 -0
- package/types/src/components/sticky/sticky.d.ts +4 -2
- package/types/src/components/svg-use/svg-use.d.ts +4 -2
- package/types/src/components/switch-field/switch-field.d.ts +17 -15
- package/types/src/components/tab-group/tab-group.d.ts +44 -3
- package/types/src/components/tab-link/tab-link.d.ts +33 -10
- package/types/src/components/tab-panel/tab-panel.d.ts +8 -5
- package/types/src/components/tag/tag.d.ts +53 -0
- package/types/src/components/tag/tag.define.d.ts +1 -0
- package/types/src/components/tag/tag.events.d.ts +4 -0
- package/types/src/components/tag/tag.style.d.ts +2 -0
- package/types/src/components/tag-field/tag-field.d.ts +178 -0
- package/types/src/components/tag-field/tag-field.define.d.ts +1 -0
- package/types/src/components/tag-field/tag-field.style.d.ts +2 -0
- package/types/src/components/textarea-field/textarea-field.d.ts +44 -4
- package/types/src/components/toast/toast.d.ts +110 -0
- package/types/src/components/toast/toast.define.d.ts +1 -0
- package/types/src/components/toast/toast.style.d.ts +2 -0
- package/types/src/components/tooltip/tooltip.d.ts +161 -0
- package/types/src/components/tooltip/tooltip.define.d.ts +1 -0
- package/types/src/components/tooltip/tooltip.events.d.ts +5 -0
- package/types/src/components/tooltip/tooltip.style.d.ts +2 -0
- package/types/src/components/transition-classes/transition-classes.d.ts +9 -8
- package/types/src/styles/appearance.style.d.ts +18 -0
- package/types/src/styles/arrow.style.d.ts +15 -0
- package/types/src/styles/choice-group.style.d.ts +23 -0
- package/types/src/styles/form-control.style.d.ts +26 -0
- package/types/src/styles/host.style.d.ts +24 -0
- package/types/src/styles/modal.style.d.ts +20 -0
- package/types/src/styles/size.style.d.ts +20 -0
- package/types/src/styles/slide-controls.style.d.ts +20 -0
- package/types/src/styles/variants.style.d.ts +32 -0
- package/types/src/utils/body-scroll.d.ts +12 -2
- package/types/src/utils/floating.d.ts +36 -0
- package/types/src/utils/focus.d.ts +16 -0
- package/types/src/utils/progress.d.ts +19 -0
- package/types/src/utils/slots.d.ts +19 -0
- package/types/src/utils/text-entry-attributes.d.ts +18 -0
- package/types/src/utils/transitions.d.ts +2 -2
- package/web-types.json +6590 -1584
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { TemplateElement } from '@webtides/element-js';
|
|
2
|
+
import FormFieldEvents from './form-field.events.js';
|
|
2
3
|
/**
|
|
3
4
|
* Base class for form input components. Provides label, help text, error message,
|
|
4
5
|
* validation and touched-state plumbing. Intended to be extended (`InputField`,
|
|
@@ -10,9 +11,9 @@ export function define(): void;
|
|
|
10
11
|
* @fires {CustomEvent<string>} input-change - Fired when the field's `value` changes.
|
|
11
12
|
* `detail` is the new value. Bubbles.
|
|
12
13
|
*
|
|
13
|
-
* @cssstate touched - Set on the host once the user has focused and blurred the field
|
|
14
|
-
* Inherited by all subclasses (`InputField`,
|
|
15
|
-
* `AmountField`, `SelectField`).
|
|
14
|
+
* @cssstate touched - Set on the host once the user has focused and blurred the field, or the
|
|
15
|
+
* browser has refused a submit because of it. Inherited by all subclasses (`InputField`,
|
|
16
|
+
* `CheckboxField`, `TextareaField`, `AmountField`, `SelectField`).
|
|
16
17
|
* @cssstate valid - Set on the host while the field currently passes validation.
|
|
17
18
|
* @cssstate invalid - Set on the host while the field currently fails validation.
|
|
18
19
|
*
|
|
@@ -25,15 +26,59 @@ export function define(): void;
|
|
|
25
26
|
* still announced to screen readers (via an `sr-only` class).
|
|
26
27
|
* @property {string} errorMessage - Error message displayed when the field is invalid and has
|
|
27
28
|
* been touched.
|
|
28
|
-
* @property {string} helpMessage - Helper text
|
|
29
|
+
* @property {string} helpMessage - Helper text. Displayed between the label and the control; a
|
|
30
|
+
* checkbox and a switch display it below the control and its label.
|
|
29
31
|
* @property {boolean} valid - Whether the field currently passes validation.
|
|
30
32
|
* @property {boolean} touched - Whether the user has interacted with the field (focused and
|
|
31
|
-
* blurred). Validation messages only surface
|
|
33
|
+
* blurred), or the browser has refused a submit because of it. Validation messages only surface
|
|
34
|
+
* when this is `true`.
|
|
32
35
|
*/
|
|
33
|
-
export default class FormField {
|
|
36
|
+
export default class FormField extends TemplateElement {
|
|
37
|
+
touched: boolean;
|
|
38
|
+
valid: any;
|
|
39
|
+
value: any;
|
|
40
|
+
/**
|
|
41
|
+
* The state the field was rendered with, for a reset of its form. See `_stateForReset()`.
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
private _renderedState;
|
|
45
|
+
/**
|
|
46
|
+
* Where the field listens for the reset of its form, see `afterUpdate()`.
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
private _resetRoot;
|
|
50
|
+
/**
|
|
51
|
+
* The value the control and the `value` property last agreed on, see `_syncControlValue()`.
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
private _controlValue;
|
|
55
|
+
/**
|
|
56
|
+
* What tells the ids of this field from the ids of every other field, see `_idOf()`.
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
private uuid;
|
|
34
60
|
constructor(options: any);
|
|
35
61
|
connected(): void;
|
|
36
|
-
|
|
62
|
+
afterUpdate(): void;
|
|
63
|
+
disconnected(): void;
|
|
64
|
+
/**
|
|
65
|
+
* The properties that a reset of the form puts back, with the values they have now.
|
|
66
|
+
* @private
|
|
67
|
+
* @returns {Object<string, unknown>}
|
|
68
|
+
*/
|
|
69
|
+
private _stateForReset;
|
|
70
|
+
/**
|
|
71
|
+
* The form of the field was reset. The browser puts every control back to its default, which
|
|
72
|
+
* for these fields is the value of now: a field renders its value as an attribute of the
|
|
73
|
+
* control, and that attribute is the default. So the field puts its own state back, to the one
|
|
74
|
+
* it was rendered with, and the control follows with the next render.
|
|
75
|
+
*
|
|
76
|
+
* The event comes before the browser resets the controls, and a listener after this one can
|
|
77
|
+
* still cancel it. A task later both are settled.
|
|
78
|
+
* @private
|
|
79
|
+
* @param {Event} event
|
|
80
|
+
*/
|
|
81
|
+
private _onFormReset;
|
|
37
82
|
properties(): {
|
|
38
83
|
name: string;
|
|
39
84
|
value: any;
|
|
@@ -59,6 +104,7 @@ export default class FormField {
|
|
|
59
104
|
blur: () => void;
|
|
60
105
|
keyup: (event: any) => void;
|
|
61
106
|
change: () => void;
|
|
107
|
+
invalid: (event: any) => void;
|
|
62
108
|
};
|
|
63
109
|
'.is-invalid': {
|
|
64
110
|
focus: () => void;
|
|
@@ -73,7 +119,6 @@ export default class FormField {
|
|
|
73
119
|
* @returns {void}
|
|
74
120
|
*/
|
|
75
121
|
onFocus(): void;
|
|
76
|
-
valid: any;
|
|
77
122
|
/**
|
|
78
123
|
* Called when the input loses focus. Marks the field as touched and refreshes
|
|
79
124
|
* validation state.
|
|
@@ -82,15 +127,69 @@ export default class FormField {
|
|
|
82
127
|
onBlur(): void;
|
|
83
128
|
/**
|
|
84
129
|
* Called when the input value changes. Updates `value` and refreshes validation.
|
|
130
|
+
*
|
|
131
|
+
* A control that is empty is no change for a field without a value: `value` stays `null`. A key
|
|
132
|
+
* that enters nothing (Shift, an arrow key) and the first key of a date leave the control empty.
|
|
133
|
+
* Taking that as the value `''` wrote it to the control as its default with the next render,
|
|
134
|
+
* and a control for a date or a time drops what the user has entered so far when its value is
|
|
135
|
+
* written: the first key was lost.
|
|
85
136
|
* @returns {void}
|
|
86
137
|
*/
|
|
87
138
|
onChange(): void;
|
|
88
|
-
value: any;
|
|
89
139
|
/**
|
|
90
|
-
*
|
|
140
|
+
* Writes a value that was set from outside to the control. For the fields that take text
|
|
141
|
+
* (`InputField`, `PasswordField`, `TextareaField`), which call it from their `value` watcher.
|
|
142
|
+
*
|
|
143
|
+
* Such a field renders its value as the default of its control: the `value` attribute of an
|
|
144
|
+
* input, the text of a textarea. Once the user has typed, the browser no longer shows that
|
|
145
|
+
* default, so the control has to be told. A value that came from the control itself is not
|
|
146
|
+
* written back: text typed between a change and the next render is kept, and the caret stays
|
|
147
|
+
* where it is.
|
|
148
|
+
*
|
|
149
|
+
* The watcher runs a frame after the change, once for every change. By then the value can have
|
|
150
|
+
* changed again, so it is the value of now that counts, not the one the watcher was called
|
|
151
|
+
* for: writing an older one moves the caret to the end of the text.
|
|
152
|
+
* @private
|
|
153
|
+
*/
|
|
154
|
+
private _syncControlValue;
|
|
155
|
+
/**
|
|
156
|
+
* The browser found the control not valid. If it did so for a submit, the field shows its error
|
|
157
|
+
* message, as it does once the user has left it: the form was refused, and the user has to see
|
|
158
|
+
* why, on every field and in the words of the page.
|
|
159
|
+
*
|
|
160
|
+
* `checkValidity()` and `reportValidity()` fire the same event without a submit. A page that asks
|
|
161
|
+
* on every keystroke whether its form is valid must not turn every field red. The browser tells
|
|
162
|
+
* the two apart itself: before it validates for a submit it marks all controls of the form as
|
|
163
|
+
* touched by the user, which is the state behind `:user-invalid`.
|
|
164
|
+
*
|
|
165
|
+
* The event is not cancelled, so the browser still focuses the first control and shows its
|
|
166
|
+
* bubble there.
|
|
167
|
+
* @private
|
|
168
|
+
* @param {HTMLElement} control
|
|
169
|
+
*/
|
|
170
|
+
private _onInvalid;
|
|
171
|
+
/**
|
|
172
|
+
* Clears the input value, refocuses it, and resets the touched state. The field follows the
|
|
173
|
+
* control, as it does when the user deletes the text by hand: `value` is empty, `input-change`
|
|
174
|
+
* reports it, and `valid` is what the control says.
|
|
91
175
|
* @returns {void}
|
|
92
176
|
*/
|
|
93
177
|
clearInput(): void;
|
|
178
|
+
/**
|
|
179
|
+
* The id of an element of this field that another one refers to: the control, which the label
|
|
180
|
+
* names, the two messages, which describe the control, and the list of a control that has one.
|
|
181
|
+
*
|
|
182
|
+
* It is made from a random part of the field and not from its name. A name is unique in a form
|
|
183
|
+
* at most, an id has to be unique in the document: two forms that each had an `email` shared
|
|
184
|
+
* their ids, and the second input lost its label and its messages to the first.
|
|
185
|
+
*
|
|
186
|
+
* The id is another one on every page load. Server-rendered markup has the ids of the server
|
|
187
|
+
* until the element starts, which writes its own to the same elements.
|
|
188
|
+
* @private
|
|
189
|
+
* @param {'input' | 'help-message' | 'error-message' | 'list'} part
|
|
190
|
+
* @returns {string}
|
|
191
|
+
*/
|
|
192
|
+
private _idOf;
|
|
94
193
|
/** @private */
|
|
95
194
|
private classes;
|
|
96
195
|
template(): any;
|
|
@@ -103,8 +202,24 @@ export default class FormField {
|
|
|
103
202
|
fieldTemplate(): unknown;
|
|
104
203
|
/** @private */
|
|
105
204
|
private helpTemplate;
|
|
106
|
-
/**
|
|
205
|
+
/**
|
|
206
|
+
* Whether the error message is rendered: the field has been touched, is invalid and has a message.
|
|
207
|
+
* @private
|
|
208
|
+
* @returns {boolean}
|
|
209
|
+
*/
|
|
210
|
+
private _showsError;
|
|
211
|
+
/**
|
|
212
|
+
* The value of `aria-describedby` for the control: the help message, and the error message while
|
|
213
|
+
* it is rendered, so that a screen reader reads the error when the control gets focus.
|
|
214
|
+
* @private
|
|
215
|
+
* @returns {string}
|
|
216
|
+
*/
|
|
217
|
+
private _describedBy;
|
|
218
|
+
/**
|
|
219
|
+
* The error message is an alert, so that a screen reader announces it the moment it appears.
|
|
220
|
+
* @private
|
|
221
|
+
*/
|
|
107
222
|
private errorTemplate;
|
|
108
223
|
}
|
|
109
|
-
|
|
110
|
-
export { FormFieldEvents };
|
|
224
|
+
export declare function define(): void;
|
|
225
|
+
export { FormField, FormFieldEvents };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
declare const _default: {
|
|
2
|
+
INPUT_CHANGE: string;
|
|
3
|
+
INPUT_RANGE_CHANGE: string;
|
|
4
|
+
};
|
|
5
5
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import FormField from '../form-field/form-field.js';
|
|
2
2
|
/**
|
|
3
3
|
* Native `<input>` wrapper with label, help text, validation feedback (visual checkmark /
|
|
4
4
|
* cross indicators) and ARIA wiring. Extends `FormField` and inherits its label / help /
|
|
@@ -11,16 +11,28 @@ export function define(): void;
|
|
|
11
11
|
*
|
|
12
12
|
* @property {string} type - Native `type` attribute of the underlying `<input>` (e.g.
|
|
13
13
|
* `'text'`, `'email'`, `'password'`, `'tel'`, `'url'`).
|
|
14
|
+
* @property {'small'|'medium'|'large'} size - Size of the control: its height, its padding and its
|
|
15
|
+
* font size. Default `'medium'`. Reflected to the `size` attribute. It shows once the control is
|
|
16
|
+
* decorated (`styles/native.css`); a control with the look of the browser keeps its size.
|
|
14
17
|
* @property {string} placeholder - Placeholder text shown while the input is empty.
|
|
15
18
|
* @property {string | false} pattern - Regular expression used as the input's `pattern`
|
|
16
19
|
* attribute. When `false` (the default), the `pattern` attribute is omitted entirely, so
|
|
17
20
|
* the field applies no pattern constraint.
|
|
21
|
+
* @property {string | null} autocomplete - Passed on to the control as its `autocomplete`
|
|
22
|
+
* attribute (e.g. `'email'`, `'current-password'`, `'one-time-code'`). `null` (the default)
|
|
23
|
+
* leaves the attribute out. The same holds for the five properties below.
|
|
24
|
+
* @property {string | null} inputmode - Passed on as `inputmode`: the on-screen keyboard to show
|
|
25
|
+
* (e.g. `'numeric'`, `'email'`).
|
|
26
|
+
* @property {string | null} enterkeyhint - Passed on as `enterkeyhint`: the label of the enter key
|
|
27
|
+
* on an on-screen keyboard (e.g. `'next'`, `'send'`).
|
|
28
|
+
* @property {string | null} autocapitalize - Passed on as `autocapitalize` (e.g. `'none'`,
|
|
29
|
+
* `'sentences'`).
|
|
30
|
+
* @property {string | null} autocorrect - Passed on as `autocorrect` (`'on'` or `'off'`).
|
|
31
|
+
* @property {boolean | string | null} spellcheck - Passed on as `spellcheck` (`true` or `false`).
|
|
18
32
|
*/
|
|
19
33
|
export default class InputField extends FormField {
|
|
34
|
+
constructor(options: any);
|
|
20
35
|
properties(): {
|
|
21
|
-
type: string;
|
|
22
|
-
placeholder: string;
|
|
23
|
-
pattern: boolean;
|
|
24
36
|
name: string;
|
|
25
37
|
value: any;
|
|
26
38
|
required: boolean;
|
|
@@ -31,8 +43,43 @@ export default class InputField extends FormField {
|
|
|
31
43
|
helpMessage: string;
|
|
32
44
|
valid: boolean;
|
|
33
45
|
touched: boolean;
|
|
46
|
+
type: string;
|
|
47
|
+
size: string;
|
|
48
|
+
placeholder: string;
|
|
49
|
+
pattern: boolean;
|
|
50
|
+
autocomplete: any;
|
|
51
|
+
inputmode: any;
|
|
52
|
+
enterkeyhint: any;
|
|
53
|
+
autocapitalize: any;
|
|
54
|
+
autocorrect: any;
|
|
55
|
+
spellcheck: any;
|
|
34
56
|
};
|
|
57
|
+
watch(): {
|
|
58
|
+
valid: () => void;
|
|
59
|
+
touched: () => void;
|
|
60
|
+
value: (value: any, oldValue: any) => void;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The pattern of the control. A field that extends this one can have a pattern of its own
|
|
64
|
+
* where the page gives none (`OtpField`).
|
|
65
|
+
* @private
|
|
66
|
+
* @returns {string | false}
|
|
67
|
+
*/
|
|
68
|
+
private _pattern;
|
|
69
|
+
/**
|
|
70
|
+
* Attributes of the control that this field has no property for. A field that extends this one
|
|
71
|
+
* has: the list of its suggestions (`ComboboxField`), the limits and the step of a date
|
|
72
|
+
* (`DateField`). One that is `null` or missing is left out.
|
|
73
|
+
*
|
|
74
|
+
* Each of them is a binding of its own in the template, which writes an attribute when its
|
|
75
|
+
* value has changed. `spreadAttributes()` writes its attributes with every render, and that is
|
|
76
|
+
* not the same for these: a control for a date drops what the user has entered of a date so
|
|
77
|
+
* far when its limits are written again.
|
|
78
|
+
* @private
|
|
79
|
+
* @returns {{ list?: string | null, min?: string | null, max?: string | null, step?: number | string | null }}
|
|
80
|
+
*/
|
|
81
|
+
private _controlAttributes;
|
|
35
82
|
/** @private */
|
|
36
83
|
private fieldTemplate;
|
|
37
84
|
}
|
|
38
|
-
|
|
85
|
+
export declare function define(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { BaseElement } from '@webtides/element-js';
|
|
2
|
+
import Events from './lazy-src.events.js';
|
|
2
3
|
/**
|
|
3
4
|
* Lazy-loads child `<img>` / `<picture>` / `<iframe>` / `<video>` elements that use a
|
|
4
5
|
* `data-src` attribute. Backed by lozad's `IntersectionObserver`; promotes `data-src` to
|
|
@@ -24,7 +25,10 @@ export function define(): void;
|
|
|
24
25
|
* @property {string} imgClass - Class to apply to the inner `<img>` once it is loaded.
|
|
25
26
|
* @property {string} imgAlt - `alt` text to apply to the inner `<img>` once it is loaded.
|
|
26
27
|
*/
|
|
27
|
-
export default class LazySrc {
|
|
28
|
+
export default class LazySrc extends BaseElement {
|
|
29
|
+
#private;
|
|
30
|
+
loaded: boolean;
|
|
31
|
+
constructor();
|
|
28
32
|
properties(): {
|
|
29
33
|
rootMargin: string;
|
|
30
34
|
threshold: number;
|
|
@@ -39,8 +43,6 @@ export default class LazySrc {
|
|
|
39
43
|
get api(): any;
|
|
40
44
|
/** @private */
|
|
41
45
|
private afterIntersection;
|
|
42
|
-
loaded: boolean;
|
|
43
|
-
#private;
|
|
44
46
|
}
|
|
47
|
+
export declare function define(): void;
|
|
45
48
|
export { Events };
|
|
46
|
-
import Events from './lazy-src.events.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
declare const _default: {
|
|
2
|
+
LOAD: string;
|
|
3
|
+
IMG_LOAD: string;
|
|
4
|
+
IMG_ERROR: string;
|
|
5
|
+
};
|
|
6
6
|
export default _default;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { TemplateElement } from '@webtides/element-js';
|
|
2
|
+
import Events from './notification.events.js';
|
|
2
3
|
/**
|
|
3
|
-
* A notification / alert
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* A notification / alert: feedback after an action, or a status message in the page. Semantic
|
|
5
|
+
* variants, an optional close button, and optional auto-dismiss. It is shown where it stands;
|
|
6
|
+
* `el-toast` shows it as a toast, at an edge of the viewport.
|
|
7
|
+
*
|
|
8
|
+
* The `variant` speaks the library's shared vocabulary for colours, as `el-button` does: the
|
|
9
|
+
* stripe at the start of the panel has the border colour of the variant, the icon its text colour.
|
|
6
10
|
*
|
|
7
11
|
* The host is exposed as an ARIA live region — `role="alert"` (assertive) for `danger` / `warning`
|
|
8
|
-
* variants, `role="status"` (polite) otherwise — so
|
|
12
|
+
* variants, `role="status"` (polite) otherwise — so it is announced when it appears.
|
|
9
13
|
*
|
|
10
14
|
* @element el-notification
|
|
11
15
|
*
|
|
@@ -26,17 +30,22 @@ export function define(): void;
|
|
|
26
30
|
* @cssstate open - Set while the notification is shown.
|
|
27
31
|
*
|
|
28
32
|
* @property {boolean} open - Whether the notification is shown. Reflected to the `open` attribute.
|
|
29
|
-
* @property {'
|
|
30
|
-
*
|
|
33
|
+
* @property {'neutral'|'brand'|'success'|'warning'|'danger'} variant - Semantic variant, which
|
|
34
|
+
* picks the colours and the icon. Default `'neutral'`. Reflected to the `variant` attribute.
|
|
31
35
|
* @property {boolean} closable - Whether to render a close button. Default `false`.
|
|
36
|
+
* @property {string} closeLabel - Accessible label for the close button. Default `'Close'`.
|
|
32
37
|
* @property {number} duration - Auto-dismiss delay in milliseconds; `Infinity` (default) never
|
|
33
38
|
* auto-dismisses. The countdown pauses while the pointer or focus is inside the notification.
|
|
34
39
|
*/
|
|
35
|
-
export default class Notification {
|
|
40
|
+
export default class Notification extends TemplateElement {
|
|
41
|
+
open: boolean;
|
|
42
|
+
_autoHideTimer: number;
|
|
43
|
+
constructor();
|
|
36
44
|
properties(): {
|
|
37
45
|
open: boolean;
|
|
38
46
|
variant: string;
|
|
39
47
|
closable: boolean;
|
|
48
|
+
closeLabel: string;
|
|
40
49
|
duration: number;
|
|
41
50
|
};
|
|
42
51
|
connected(): void;
|
|
@@ -60,26 +69,17 @@ export default class Notification {
|
|
|
60
69
|
* @returns {Promise<void>} Resolves after the open transition has finished.
|
|
61
70
|
*/
|
|
62
71
|
show(): Promise<void>;
|
|
63
|
-
open: boolean;
|
|
64
72
|
/**
|
|
65
73
|
* Hides the notification.
|
|
66
74
|
* @returns {Promise<void>} Resolves after the close transition has finished.
|
|
67
75
|
*/
|
|
68
76
|
hide(): Promise<void>;
|
|
69
|
-
/**
|
|
70
|
-
* Moves the notification into the shared top-right toast stack and shows it.
|
|
71
|
-
* @returns {Promise<void>} Resolves after the open transition has finished.
|
|
72
|
-
*/
|
|
73
|
-
toast(): Promise<void>;
|
|
74
77
|
/** @private */
|
|
75
78
|
private _applyOpen;
|
|
76
79
|
/** @private */
|
|
77
80
|
private _applyClose;
|
|
78
81
|
/** @private */
|
|
79
82
|
private _startAutoHide;
|
|
80
|
-
_autoHideTimer: number;
|
|
81
|
-
/** @private */
|
|
82
|
-
private _removeFromToastStack;
|
|
83
83
|
/** @private */
|
|
84
84
|
private _once;
|
|
85
85
|
/** @private */
|
|
@@ -88,5 +88,5 @@ export default class Notification {
|
|
|
88
88
|
/** @private */
|
|
89
89
|
private variantIconTemplate;
|
|
90
90
|
}
|
|
91
|
+
export declare function define(): void;
|
|
91
92
|
export { Events };
|
|
92
|
-
import Events from './notification.events.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
declare const _default: {
|
|
2
|
+
SHOW: string;
|
|
3
|
+
AFTER_SHOW: string;
|
|
4
|
+
HIDE: string;
|
|
5
|
+
AFTER_HIDE: string;
|
|
6
|
+
};
|
|
7
7
|
export default _default;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import InputField from '../input-field/input-field.js';
|
|
2
|
+
import Events from './otp-field.events.js';
|
|
3
|
+
/**
|
|
4
|
+
* A one-time code: the short code of a second factor that the user gets by SMS, by mail or from an
|
|
5
|
+
* app. Extends `InputField` (and therefore `FormField`), inheriting the label / help / error /
|
|
6
|
+
* validation surface and the look from `styles/native.css`.
|
|
7
|
+
*
|
|
8
|
+
* It is one native `<input>`, not one per digit: the code from an SMS, a paste, a password manager
|
|
9
|
+
* and a screen reader all work on one control. The field sets what such an input needs
|
|
10
|
+
* (`autocomplete`, `inputmode`, a pattern of `length` digits), takes the spaces and the hyphens out
|
|
11
|
+
* of a code that is entered the way a mail shows it, takes no further key once the code is full, and
|
|
12
|
+
* says when the code is complete.
|
|
13
|
+
*
|
|
14
|
+
* @element el-otp-field
|
|
15
|
+
*
|
|
16
|
+
* @fires {CustomEvent<string>} input-change - Fired when the value changes. `detail` is the new
|
|
17
|
+
* value. Bubbles.
|
|
18
|
+
* @fires {CustomEvent<string>} input-complete - Fired when the user has entered a code of full
|
|
19
|
+
* length that is valid: once, and again after the code was changed and completed again. Not
|
|
20
|
+
* fired for a value a script sets. `detail` is the code. Bubbles.
|
|
21
|
+
*
|
|
22
|
+
* @property {number} length - The number of characters of the code. Default `6`.
|
|
23
|
+
* @property {string | false} pattern - Regular expression for the code. `false` (the default) is a
|
|
24
|
+
* pattern of `length` digits. Set one of your own for a code with letters.
|
|
25
|
+
* @property {string | null} autocomplete - Passed on to the control as `autocomplete`. Default
|
|
26
|
+
* `'one-time-code'`: a phone offers the code of an SMS it has just got.
|
|
27
|
+
* @property {string | null} inputmode - Passed on as `inputmode`. Default `'numeric'`: a phone
|
|
28
|
+
* shows the digits. Set `'text'` for a code with letters.
|
|
29
|
+
*/
|
|
30
|
+
export default class OtpField extends InputField {
|
|
31
|
+
/**
|
|
32
|
+
* The complete code the control has, or `null`. What `input-complete` is not fired for again.
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
private _completed;
|
|
36
|
+
constructor(options: any);
|
|
37
|
+
properties(): {
|
|
38
|
+
name: string;
|
|
39
|
+
value: any;
|
|
40
|
+
required: boolean;
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
label: string;
|
|
43
|
+
labelScreenReaderOnly: boolean;
|
|
44
|
+
errorMessage: string;
|
|
45
|
+
helpMessage: string;
|
|
46
|
+
valid: boolean;
|
|
47
|
+
touched: boolean;
|
|
48
|
+
type: string;
|
|
49
|
+
size: string;
|
|
50
|
+
placeholder: string;
|
|
51
|
+
pattern: boolean;
|
|
52
|
+
enterkeyhint: any;
|
|
53
|
+
autocapitalize: any;
|
|
54
|
+
autocorrect: any;
|
|
55
|
+
spellcheck: any;
|
|
56
|
+
length: number;
|
|
57
|
+
autocomplete: string;
|
|
58
|
+
inputmode: string;
|
|
59
|
+
};
|
|
60
|
+
watch(): {
|
|
61
|
+
valid: () => void;
|
|
62
|
+
touched: () => void;
|
|
63
|
+
value: (value: any, oldValue: any) => void;
|
|
64
|
+
};
|
|
65
|
+
events(): {
|
|
66
|
+
'.is-invalid': {
|
|
67
|
+
focus: () => void;
|
|
68
|
+
};
|
|
69
|
+
'[data-clear-input]': {
|
|
70
|
+
click: () => void;
|
|
71
|
+
touchstart: () => void;
|
|
72
|
+
};
|
|
73
|
+
'[ref=input]': {
|
|
74
|
+
focus: () => void;
|
|
75
|
+
blur: () => void;
|
|
76
|
+
keyup: (event: any) => void;
|
|
77
|
+
change: () => void;
|
|
78
|
+
invalid: (event: any) => void;
|
|
79
|
+
beforeinput: (event: any) => void;
|
|
80
|
+
input: (event: any) => void;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
onChange(): void;
|
|
84
|
+
/**
|
|
85
|
+
* A code that is full takes no further key, as an input with `maxlength` does: the character
|
|
86
|
+
* would push the last one of the code out, wherever the caret is. The control has no
|
|
87
|
+
* `maxlength` itself, see `_clean()`. A paste is not held back here, it is cut after it was
|
|
88
|
+
* cleaned.
|
|
89
|
+
* @private
|
|
90
|
+
* @param {InputEvent} event
|
|
91
|
+
*/
|
|
92
|
+
private _onBeforeInput;
|
|
93
|
+
/**
|
|
94
|
+
* The control has another text. Cleans it, takes it over, and says so when it is a complete
|
|
95
|
+
* code now and was not one before.
|
|
96
|
+
* @private
|
|
97
|
+
* @param {InputEvent} event
|
|
98
|
+
*/
|
|
99
|
+
private _onInput;
|
|
100
|
+
/**
|
|
101
|
+
* A code the way it is entered: without the spaces and the hyphens that a mail or an SMS groups
|
|
102
|
+
* its digits with, and not longer than a code is. Nothing else is taken out: what does not fit
|
|
103
|
+
* the pattern is not valid, and the field says so.
|
|
104
|
+
*
|
|
105
|
+
* This is why the control has no `maxlength`: the browser would cut a pasted `123 456` to
|
|
106
|
+
* `123 45` before the field has taken the space out.
|
|
107
|
+
* @private
|
|
108
|
+
* @param {string} text
|
|
109
|
+
* @returns {string}
|
|
110
|
+
*/
|
|
111
|
+
private _clean;
|
|
112
|
+
/**
|
|
113
|
+
* @private
|
|
114
|
+
* @returns {number} The length of a code: `length`, or 6 where that is no number of characters.
|
|
115
|
+
*/
|
|
116
|
+
private _length;
|
|
117
|
+
/**
|
|
118
|
+
* The pattern of the page, or one of `length` digits.
|
|
119
|
+
* @private
|
|
120
|
+
* @returns {string}
|
|
121
|
+
*/
|
|
122
|
+
private _pattern;
|
|
123
|
+
/**
|
|
124
|
+
* @private
|
|
125
|
+
* @returns {string | null} The text of the control when it is a complete and valid code.
|
|
126
|
+
*/
|
|
127
|
+
private _completeCode;
|
|
128
|
+
}
|
|
129
|
+
export declare function define(): void;
|
|
130
|
+
export { Events };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|