@warp-ds/elements 2.2.0-next.2 → 2.2.0-next.21
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/README.md +228 -28
- package/dist/.storybook/utilities.d.ts +28 -0
- package/dist/.storybook/utilities.js +52 -0
- package/dist/api.js +1 -49
- package/dist/api.js.map +4 -4
- package/dist/custom-elements.json +7146 -0
- package/dist/index.d.ts +1847 -18
- package/dist/packages/affix/affix.react.stories.d.ts +9 -0
- package/dist/packages/affix/affix.react.stories.js +10 -0
- package/dist/packages/affix/affix.stories.d.ts +10 -0
- package/dist/packages/affix/affix.stories.js +25 -0
- package/dist/packages/affix/affix.test.d.ts +1 -0
- package/dist/packages/affix/affix.test.js +9 -0
- package/dist/packages/affix/index.d.ts +47 -24
- package/dist/packages/affix/index.js +2448 -2240
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/affix/react.d.ts +2 -0
- package/dist/packages/affix/react.js +15 -0
- package/dist/packages/affix/styles.d.ts +1 -0
- package/dist/packages/affix/styles.js +2 -0
- package/dist/packages/alert/alert.react.stories.d.ts +13 -0
- package/dist/packages/alert/alert.react.stories.js +44 -0
- package/dist/packages/alert/alert.stories.d.ts +15 -0
- package/dist/packages/alert/alert.stories.js +68 -0
- package/dist/packages/alert/alert.test.d.ts +1 -0
- package/dist/packages/alert/alert.test.js +18 -0
- package/dist/packages/alert/index.d.ts +21 -16
- package/dist/packages/alert/index.js +2452 -2446
- package/dist/packages/alert/index.js.map +4 -4
- package/dist/packages/alert/react.d.ts +2 -0
- package/dist/packages/alert/react.js +11 -0
- package/dist/packages/alert/styles.d.ts +1 -0
- package/dist/packages/alert/styles.js +2 -0
- package/dist/packages/attention/attention.react.stories.d.ts +15 -0
- package/dist/packages/attention/attention.react.stories.js +92 -0
- package/dist/packages/attention/attention.stories.d.ts +15 -0
- package/dist/packages/attention/attention.stories.js +173 -0
- package/dist/packages/attention/attention.test.d.ts +1 -0
- package/dist/packages/attention/attention.test.js +11 -0
- package/dist/packages/attention/index.d.ts +62 -89
- package/dist/packages/attention/index.js +3521 -3924
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/attention/layout-styles.d.ts +1 -0
- package/dist/packages/attention/layout-styles.js +905 -0
- package/dist/packages/attention/locales/da/messages.mjs +1 -0
- package/dist/packages/attention/locales/en/messages.mjs +1 -0
- package/dist/packages/attention/locales/fi/messages.mjs +1 -0
- package/dist/packages/attention/locales/nb/messages.mjs +1 -0
- package/dist/packages/attention/locales/sv/messages.mjs +1 -0
- package/dist/packages/attention/react.d.ts +15 -0
- package/dist/packages/attention/react.js +17 -0
- package/dist/packages/attention/styles.d.ts +1 -0
- package/dist/packages/attention/styles.js +2 -0
- package/dist/packages/badge/badge.react.stories.d.ts +18 -0
- package/dist/packages/badge/badge.react.stories.js +60 -0
- package/dist/packages/badge/badge.stories.d.ts +17 -0
- package/dist/packages/badge/badge.stories.js +68 -0
- package/dist/packages/badge/badge.test.d.ts +1 -0
- package/dist/packages/badge/badge.test.js +9 -0
- package/dist/packages/badge/index.d.ts +12 -11
- package/dist/packages/badge/index.js +2441 -300
- package/dist/packages/badge/index.js.map +4 -4
- package/dist/packages/badge/react.d.ts +2 -0
- package/dist/packages/badge/react.js +11 -0
- package/dist/packages/badge/styles.d.ts +1 -0
- package/dist/packages/badge/styles.js +2 -0
- package/dist/packages/box/box.react.stories.d.ts +15 -0
- package/dist/packages/box/box.react.stories.js +45 -0
- package/dist/packages/box/box.stories.d.ts +14 -0
- package/dist/packages/box/box.stories.js +59 -0
- package/dist/packages/box/box.test.d.ts +1 -0
- package/dist/packages/box/box.test.js +9 -0
- package/dist/packages/box/index.d.ts +17 -20
- package/dist/packages/box/index.js +2443 -299
- package/dist/packages/box/index.js.map +4 -4
- package/dist/packages/box/react.d.ts +2 -0
- package/dist/packages/box/react.js +11 -0
- package/dist/packages/box/slot.test.d.ts +1 -0
- package/dist/packages/box/slot.test.js +9 -0
- package/dist/packages/box/styles.d.ts +1 -0
- package/dist/packages/box/styles.js +2 -0
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.d.ts +13 -0
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.js +40 -0
- package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +12 -0
- package/dist/packages/breadcrumbs/breadcrumbs.stories.js +60 -0
- package/dist/packages/breadcrumbs/breadcrumbs.test.d.ts +1 -0
- package/dist/packages/breadcrumbs/breadcrumbs.test.js +16 -0
- package/dist/packages/breadcrumbs/index.d.ts +19 -16
- package/dist/packages/breadcrumbs/index.js +2402 -2051
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/breadcrumbs/locales/da/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/en/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/fi/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/nb/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/sv/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/react.d.ts +2 -0
- package/dist/packages/breadcrumbs/react.js +11 -0
- package/dist/packages/breadcrumbs/styles.d.ts +1 -0
- package/dist/packages/breadcrumbs/styles.js +2 -0
- package/dist/packages/button/button.react.stories.d.ts +22 -0
- package/dist/packages/button/button.react.stories.js +102 -0
- package/dist/packages/button/button.stories.d.ts +21 -0
- package/dist/packages/button/button.stories.js +119 -0
- package/dist/packages/button/button.test.d.ts +1 -0
- package/dist/packages/button/button.test.js +25 -0
- package/dist/packages/button/index.d.ts +106 -56
- package/dist/packages/button/index.js +2618 -2130
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/button/locales/da/messages.mjs +1 -0
- package/dist/packages/button/locales/en/messages.mjs +1 -0
- package/dist/packages/button/locales/fi/messages.mjs +1 -0
- package/dist/packages/button/locales/nb/messages.mjs +1 -0
- package/dist/packages/button/locales/sv/messages.mjs +1 -0
- package/dist/packages/button/react.d.ts +2 -0
- package/dist/packages/button/react.js +11 -0
- package/dist/packages/button/styles.d.ts +1 -0
- package/dist/packages/button/styles.js +2 -0
- package/dist/packages/card/card.react.stories.d.ts +16 -0
- package/dist/packages/card/card.react.stories.js +63 -0
- package/dist/packages/card/card.stories.d.ts +15 -0
- package/dist/packages/card/card.stories.js +82 -0
- package/dist/packages/card/card.test.d.ts +1 -0
- package/dist/packages/card/card.test.js +9 -0
- package/dist/packages/card/index.d.ts +27 -15
- package/dist/packages/card/index.js +2403 -2067
- package/dist/packages/card/index.js.map +4 -4
- package/dist/packages/card/locales/da/messages.mjs +1 -0
- package/dist/packages/card/locales/en/messages.mjs +1 -0
- package/dist/packages/card/locales/fi/messages.mjs +1 -0
- package/dist/packages/card/locales/nb/messages.mjs +1 -0
- package/dist/packages/card/locales/sv/messages.mjs +1 -0
- package/dist/packages/card/react.d.ts +2 -0
- package/dist/packages/card/react.js +11 -0
- package/dist/packages/card/styles.d.ts +1 -0
- package/dist/packages/card/styles.js +2 -0
- package/dist/packages/combobox/combobox.react.stories.d.ts +28 -0
- package/dist/packages/combobox/combobox.react.stories.js +90 -0
- package/dist/packages/combobox/combobox.stories.d.ts +18 -0
- package/dist/packages/combobox/combobox.stories.js +117 -0
- package/dist/packages/combobox/index.d.ts +95 -0
- package/dist/packages/combobox/index.js +2492 -0
- package/dist/packages/combobox/index.js.map +7 -0
- package/dist/packages/combobox/locales/da/messages.d.mts +1 -0
- package/dist/packages/combobox/locales/da/messages.mjs +1 -0
- package/dist/packages/combobox/locales/en/messages.d.mts +1 -0
- package/dist/packages/combobox/locales/en/messages.mjs +1 -0
- package/dist/packages/combobox/locales/fi/messages.d.mts +1 -0
- package/dist/packages/combobox/locales/fi/messages.mjs +1 -0
- package/dist/packages/combobox/locales/nb/messages.d.mts +1 -0
- package/dist/packages/combobox/locales/nb/messages.mjs +1 -0
- package/dist/packages/combobox/locales/sv/messages.d.mts +1 -0
- package/dist/packages/combobox/locales/sv/messages.mjs +1 -0
- package/dist/packages/combobox/react.d.ts +7 -0
- package/dist/packages/combobox/react.js +17 -0
- package/dist/packages/combobox/styles.d.ts +1 -0
- package/dist/packages/combobox/styles.js +2 -0
- package/dist/packages/datepicker/DatePicker.test.d.ts +2 -0
- package/dist/packages/datepicker/DatePicker.test.js +69 -0
- package/dist/packages/datepicker/datepicker.d.ts +102 -0
- package/dist/packages/datepicker/datepicker.js +2785 -0
- package/dist/packages/datepicker/datepicker.js.map +7 -0
- package/dist/packages/datepicker/datepicker.react.stories.d.ts +18 -0
- package/dist/packages/datepicker/datepicker.react.stories.js +26 -0
- package/dist/packages/datepicker/datepicker.stories.d.ts +12 -0
- package/dist/packages/datepicker/datepicker.stories.js +51 -0
- package/dist/packages/datepicker/datepicker.test.d.ts +2 -0
- package/dist/packages/datepicker/datepicker.test.js +62 -0
- package/dist/packages/datepicker/index.d.ts +1 -0
- package/dist/packages/datepicker/index.js +2785 -0
- package/dist/packages/datepicker/index.js.map +7 -0
- package/dist/packages/datepicker/locales/da/messages.d.mts +1 -0
- package/dist/packages/datepicker/locales/da/messages.mjs +1 -0
- package/dist/packages/datepicker/locales/en/messages.d.mts +1 -0
- package/dist/packages/datepicker/locales/en/messages.mjs +1 -0
- package/dist/packages/datepicker/locales/fi/messages.d.mts +1 -0
- package/dist/packages/datepicker/locales/fi/messages.mjs +1 -0
- package/dist/packages/datepicker/locales/nb/messages.d.mts +1 -0
- package/dist/packages/datepicker/locales/nb/messages.mjs +1 -0
- package/dist/packages/datepicker/locales/sv/messages.d.mts +1 -0
- package/dist/packages/datepicker/locales/sv/messages.mjs +1 -0
- package/dist/packages/datepicker/react.d.ts +5 -0
- package/dist/packages/datepicker/react.js +15 -0
- package/dist/packages/datepicker/styles/w-datepicker-calendar.styles.d.ts +1 -0
- package/dist/packages/datepicker/styles/w-datepicker-calendar.styles.js +15 -0
- package/dist/packages/datepicker/styles/w-datepicker-day.styles.d.ts +1 -0
- package/dist/packages/datepicker/styles/w-datepicker-day.styles.js +64 -0
- package/dist/packages/datepicker/styles/w-datepicker-month.styles.d.ts +1 -0
- package/dist/packages/datepicker/styles/w-datepicker-month.styles.js +72 -0
- package/dist/packages/datepicker/styles/w-datepicker.styles.d.ts +1 -0
- package/dist/packages/datepicker/styles/w-datepicker.styles.js +101 -0
- package/dist/packages/datepicker/utils.d.ts +13 -0
- package/dist/packages/datepicker/utils.js +28 -0
- package/dist/packages/dead-toggle/dead-toggle.react.stories.d.ts +15 -0
- package/dist/packages/dead-toggle/dead-toggle.react.stories.js +34 -0
- package/dist/packages/dead-toggle/dead-toggle.stories.d.ts +14 -0
- package/dist/packages/dead-toggle/dead-toggle.stories.js +45 -0
- package/dist/packages/dead-toggle/dead-toggle.test.d.ts +1 -0
- package/dist/packages/dead-toggle/dead-toggle.test.js +9 -0
- package/dist/packages/dead-toggle/index.d.ts +16 -0
- package/dist/packages/dead-toggle/index.js +2487 -0
- package/dist/packages/dead-toggle/index.js.map +7 -0
- package/dist/packages/dead-toggle/react.d.ts +2 -0
- package/dist/packages/dead-toggle/react.js +11 -0
- package/dist/packages/expandable/expandable.react.stories.d.ts +18 -0
- package/dist/packages/expandable/expandable.react.stories.js +103 -0
- package/dist/packages/expandable/expandable.stories.d.ts +19 -0
- package/dist/packages/expandable/expandable.stories.js +133 -0
- package/dist/packages/expandable/expandable.test.d.ts +1 -0
- package/dist/packages/expandable/expandable.test.js +24 -0
- package/dist/packages/expandable/index.d.ts +52 -50
- package/dist/packages/expandable/index.js +2424 -2286
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/expandable/react.d.ts +2 -0
- package/dist/packages/expandable/react.js +11 -0
- package/dist/packages/expandable/styles.d.ts +1 -0
- package/dist/packages/expandable/styles.js +2 -0
- package/dist/packages/i18n.js +45 -0
- package/dist/packages/link/index.d.ts +34 -0
- package/dist/packages/link/index.js +2646 -0
- package/dist/packages/link/index.js.map +7 -0
- package/dist/packages/link/link.react.stories.d.ts +21 -0
- package/dist/packages/link/link.react.stories.js +96 -0
- package/dist/packages/link/link.stories.d.ts +20 -0
- package/dist/packages/link/link.stories.js +110 -0
- package/dist/packages/link/link.test.d.ts +1 -0
- package/dist/packages/link/link.test.js +9 -0
- package/dist/packages/link/react.d.ts +2 -0
- package/dist/packages/link/react.js +11 -0
- package/dist/packages/link/styles.d.ts +1 -0
- package/dist/packages/link/styles.js +200 -0
- package/dist/packages/modal/index.d.ts +4 -5
- package/dist/packages/modal/index.js +2649 -2575
- package/dist/packages/modal/index.js.map +4 -4
- package/dist/packages/modal/locales/da/messages.mjs +1 -0
- package/dist/packages/modal/locales/en/messages.mjs +1 -0
- package/dist/packages/modal/locales/fi/messages.mjs +1 -0
- package/dist/packages/modal/locales/nb/messages.mjs +1 -0
- package/dist/packages/modal/locales/sv/messages.mjs +1 -0
- package/dist/packages/modal/modal-footer.d.ts +13 -11
- package/dist/packages/modal/modal-footer.js +2460 -0
- package/dist/packages/modal/modal-footer.js.map +7 -0
- package/dist/packages/modal/modal-header.d.ts +25 -31
- package/dist/packages/modal/modal-header.js +2584 -0
- package/dist/packages/modal/modal-header.js.map +7 -0
- package/dist/packages/modal/modal-main.d.ts +27 -31
- package/dist/packages/modal/modal-main.js +2572 -0
- package/dist/packages/modal/modal-main.js.map +7 -0
- package/dist/packages/modal/modal.react.stories.d.ts +14 -0
- package/dist/packages/modal/modal.react.stories.js +27 -0
- package/dist/packages/modal/modal.stories.d.ts +19 -0
- package/dist/packages/modal/modal.stories.js +160 -0
- package/dist/packages/modal/react.d.ts +12 -0
- package/dist/packages/modal/react.js +31 -0
- package/dist/packages/modal/util.d.ts +7 -17
- package/dist/packages/modal/util.js +21 -0
- package/dist/packages/pageindicator/index.d.ts +10 -0
- package/dist/packages/pageindicator/index.js +32 -0
- package/dist/packages/pageindicator/index.js.map +7 -0
- package/dist/packages/pageindicator/pageindicator.react.stories.d.ts +19 -0
- package/dist/packages/pageindicator/pageindicator.react.stories.js +20 -0
- package/dist/packages/pageindicator/pageindicator.stories.d.ts +32 -0
- package/dist/packages/pageindicator/pageindicator.stories.js +71 -0
- package/dist/packages/pageindicator/react.d.ts +2 -0
- package/dist/packages/pageindicator/react.js +11 -0
- package/dist/packages/pageindicator/style.d.ts +1 -0
- package/dist/packages/pageindicator/style.js +26 -0
- package/dist/packages/pagination/index.d.ts +32 -0
- package/dist/packages/pagination/index.js +2500 -0
- package/dist/packages/pagination/index.js.map +7 -0
- package/dist/packages/pagination/locales/da/messages.d.mts +1 -0
- package/dist/packages/pagination/locales/da/messages.mjs +1 -0
- package/dist/packages/pagination/locales/en/messages.d.mts +1 -0
- package/dist/packages/pagination/locales/en/messages.mjs +1 -0
- package/dist/packages/pagination/locales/fi/messages.d.mts +1 -0
- package/dist/packages/pagination/locales/fi/messages.mjs +1 -0
- package/dist/packages/pagination/locales/nb/messages.d.mts +1 -0
- package/dist/packages/pagination/locales/nb/messages.mjs +1 -0
- package/dist/packages/pagination/locales/sv/messages.d.mts +1 -0
- package/dist/packages/pagination/locales/sv/messages.mjs +1 -0
- package/dist/packages/pagination/pagination.react.stories.d.ts +21 -0
- package/dist/packages/pagination/pagination.react.stories.js +45 -0
- package/dist/packages/pagination/pagination.stories.d.ts +14 -0
- package/dist/packages/pagination/pagination.stories.js +56 -0
- package/dist/packages/pagination/pagination.test.d.ts +1 -0
- package/dist/packages/pagination/pagination.test.js +76 -0
- package/dist/packages/pagination/react.d.ts +5 -0
- package/dist/packages/pagination/react.js +15 -0
- package/dist/packages/pagination/styles.d.ts +1 -0
- package/dist/packages/pagination/styles.js +2 -0
- package/dist/packages/pill/index.d.ts +39 -23
- package/dist/packages/pill/index.js +2408 -2175
- package/dist/packages/pill/index.js.map +4 -4
- package/dist/packages/pill/locales/da/messages.mjs +1 -0
- package/dist/packages/pill/locales/en/messages.mjs +1 -0
- package/dist/packages/pill/locales/fi/messages.mjs +1 -0
- package/dist/packages/pill/locales/nb/messages.mjs +1 -0
- package/dist/packages/pill/locales/sv/messages.mjs +1 -0
- package/dist/packages/pill/pill.react.stories.d.ts +23 -0
- package/dist/packages/pill/pill.react.stories.js +22 -0
- package/dist/packages/pill/pill.stories.d.ts +12 -0
- package/dist/packages/pill/pill.stories.js +33 -0
- package/dist/packages/pill/pill.test.d.ts +1 -0
- package/dist/packages/pill/pill.test.js +25 -0
- package/dist/packages/pill/react.d.ts +7 -0
- package/dist/packages/pill/react.js +17 -0
- package/dist/packages/pill/styles.d.ts +1 -0
- package/dist/packages/pill/styles.js +2 -0
- package/dist/packages/rip-and-tear-checkbox/checkbox.d.ts +64 -0
- package/dist/packages/rip-and-tear-checkbox/checkbox.js +160 -0
- package/dist/packages/rip-and-tear-checkbox/checkbox.js.map +7 -0
- package/dist/packages/rip-and-tear-checkbox/checkbox.stories.d.ts +8 -0
- package/dist/packages/rip-and-tear-checkbox/checkbox.stories.js +11 -0
- package/dist/packages/rip-and-tear-checkbox/index.d.ts +1 -0
- package/dist/packages/rip-and-tear-checkbox/index.js +160 -0
- package/dist/packages/rip-and-tear-checkbox/index.js.map +7 -0
- package/dist/packages/rip-and-tear-checkbox/react.d.ts +5 -0
- package/dist/packages/rip-and-tear-checkbox/react.js +15 -0
- package/dist/packages/rip-and-tear-checkbox/rip-and-tear-checkbox.react.stories.d.ts +12 -0
- package/dist/packages/rip-and-tear-checkbox/rip-and-tear-checkbox.react.stories.js +10 -0
- package/dist/packages/rip-and-tear-checkbox/styles.d.ts +1 -0
- package/dist/packages/rip-and-tear-checkbox/styles.js +116 -0
- package/dist/packages/rip-and-tear-radio/base-element.d.ts +46 -0
- package/dist/packages/rip-and-tear-radio/base-element.js +100 -0
- package/dist/packages/rip-and-tear-radio/custom-error-validator.d.ts +6 -0
- package/dist/packages/rip-and-tear-radio/custom-error-validator.js +22 -0
- package/dist/packages/rip-and-tear-radio/form-associated-element.d.ts +103 -0
- package/dist/packages/rip-and-tear-radio/form-associated-element.js +282 -0
- package/dist/packages/rip-and-tear-radio/host-styles.d.ts +1 -0
- package/dist/packages/rip-and-tear-radio/host-styles.js +12 -0
- package/dist/packages/rip-and-tear-radio/index.d.ts +1 -0
- package/dist/packages/rip-and-tear-radio/index.js +270 -0
- package/dist/packages/rip-and-tear-radio/index.js.map +7 -0
- package/dist/packages/rip-and-tear-radio/invalid.d.ts +8 -0
- package/dist/packages/rip-and-tear-radio/invalid.js +5 -0
- package/dist/packages/rip-and-tear-radio/math.d.ts +1 -0
- package/dist/packages/rip-and-tear-radio/math.js +4 -0
- package/dist/packages/rip-and-tear-radio/radio-group-styles.d.ts +1 -0
- package/dist/packages/rip-and-tear-radio/radio-group-styles.js +60 -0
- package/dist/packages/rip-and-tear-radio/radio-group-styles.js.map +7 -0
- package/dist/packages/rip-and-tear-radio/radio-group.d.ts +72 -0
- package/dist/packages/rip-and-tear-radio/radio-group.js +270 -0
- package/dist/packages/rip-and-tear-radio/radio-group.js.map +7 -0
- package/dist/packages/rip-and-tear-radio/radio-styles.d.ts +1 -0
- package/dist/packages/rip-and-tear-radio/radio-styles.js +170 -0
- package/dist/packages/rip-and-tear-radio/radio-styles.js.map +7 -0
- package/dist/packages/rip-and-tear-radio/radio.d.ts +38 -0
- package/dist/packages/rip-and-tear-radio/radio.js +183 -0
- package/dist/packages/rip-and-tear-radio/radio.js.map +7 -0
- package/dist/packages/rip-and-tear-radio/radio.stories.d.ts +8 -0
- package/dist/packages/rip-and-tear-radio/radio.stories.js +275 -0
- package/dist/packages/rip-and-tear-radio/radio.stories.js.map +7 -0
- package/dist/packages/rip-and-tear-radio/react.d.ts +9 -0
- package/dist/packages/rip-and-tear-radio/react.js +22 -0
- package/dist/packages/rip-and-tear-radio/required-validator.d.ts +11 -0
- package/dist/packages/rip-and-tear-radio/required-validator.js +34 -0
- package/dist/packages/rip-and-tear-radio/rip-and-tear-radio.react.stories.d.ts +9 -0
- package/dist/packages/rip-and-tear-radio/rip-and-tear-radio.react.stories.js +10 -0
- package/dist/packages/rip-and-tear-radio/slot.d.ts +20 -0
- package/dist/packages/rip-and-tear-radio/slot.js +71 -0
- package/dist/packages/rip-and-tear-radio/watch.d.ts +26 -0
- package/dist/packages/rip-and-tear-radio/watch.js +39 -0
- package/dist/packages/select/index.d.ts +56 -50
- package/dist/packages/select/index.js +2421 -2236
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/select/locales/da/messages.mjs +1 -0
- package/dist/packages/select/locales/en/messages.mjs +1 -0
- package/dist/packages/select/locales/fi/messages.mjs +1 -0
- package/dist/packages/select/locales/nb/messages.mjs +1 -0
- package/dist/packages/select/locales/sv/messages.mjs +1 -0
- package/dist/packages/select/react.d.ts +6 -0
- package/dist/packages/select/react.js +20 -0
- package/dist/packages/select/select.react.stories.d.ts +18 -0
- package/dist/packages/select/select.react.stories.js +28 -0
- package/dist/packages/select/select.stories.d.ts +10 -0
- package/dist/packages/select/select.stories.js +31 -0
- package/dist/packages/select/select.test.d.ts +1 -0
- package/dist/packages/select/select.test.js +31 -0
- package/dist/packages/select/styles.d.ts +1 -0
- package/dist/packages/select/styles.js +2 -0
- package/dist/packages/slider/Slider.d.ts +2 -0
- package/dist/packages/slider/Slider.js +8 -0
- package/dist/packages/slider/SliderThumb.d.ts +2 -0
- package/dist/packages/slider/SliderThumb.js +8 -0
- package/dist/packages/slider/index.d.ts +2 -0
- package/dist/packages/slider/index.js +2791 -0
- package/dist/packages/slider/index.js.map +7 -0
- package/dist/packages/slider/oddbird-css-anchor-positioning.d.ts +2 -0
- package/dist/packages/slider/oddbird-css-anchor-positioning.js +3 -0
- package/dist/packages/slider/react.d.ts +8 -0
- package/dist/packages/slider/react.js +20 -0
- package/dist/packages/slider/slider-thumb.d.ts +57 -0
- package/dist/packages/slider/slider-thumb.js +2663 -0
- package/dist/packages/slider/slider-thumb.js.map +7 -0
- package/dist/packages/slider/slider.d.ts +46 -0
- package/dist/packages/slider/slider.js +2569 -0
- package/dist/packages/slider/slider.js.map +7 -0
- package/dist/packages/slider/slider.react.stories.d.ts +18 -0
- package/dist/packages/slider/slider.react.stories.js +119 -0
- package/dist/packages/slider/slider.stories.d.ts +17 -0
- package/dist/packages/slider/slider.stories.js +203 -0
- package/dist/packages/slider/slider.test.d.ts +4 -0
- package/dist/packages/slider/slider.test.js +83 -0
- package/dist/packages/slider/styles/w-slider-thumb.styles.d.ts +1 -0
- package/dist/packages/slider/styles/w-slider-thumb.styles.js +132 -0
- package/dist/packages/slider/styles/w-slider.styles.d.ts +1 -0
- package/dist/packages/slider/styles/w-slider.styles.js +118 -0
- package/dist/packages/slider/styles.d.ts +1 -0
- package/dist/packages/slider/styles.js +2 -0
- package/dist/packages/steps/index.d.ts +36 -0
- package/dist/packages/steps/index.js +2465 -0
- package/dist/packages/steps/index.js.map +7 -0
- package/dist/packages/steps/locales/da/messages.d.mts +1 -0
- package/dist/packages/steps/locales/da/messages.mjs +1 -0
- package/dist/packages/steps/locales/en/messages.d.mts +1 -0
- package/dist/packages/steps/locales/en/messages.mjs +1 -0
- package/dist/packages/steps/locales/fi/messages.d.mts +1 -0
- package/dist/packages/steps/locales/fi/messages.mjs +1 -0
- package/dist/packages/steps/locales/nb/messages.d.mts +1 -0
- package/dist/packages/steps/locales/nb/messages.mjs +1 -0
- package/dist/packages/steps/locales/sv/messages.d.mts +1 -0
- package/dist/packages/steps/locales/sv/messages.mjs +1 -0
- package/dist/packages/steps/react.d.ts +3 -0
- package/dist/packages/steps/react.js +16 -0
- package/dist/packages/steps/steps.react.stories.d.ts +15 -0
- package/dist/packages/steps/steps.react.stories.js +112 -0
- package/dist/packages/steps/steps.stories.d.ts +12 -0
- package/dist/packages/steps/steps.stories.js +172 -0
- package/dist/packages/steps/styles.d.ts +1 -0
- package/dist/packages/steps/styles.js +2 -0
- package/dist/packages/styles.d.ts +2 -0
- package/dist/packages/styles.js +2442 -0
- package/dist/packages/switch/index.d.ts +15 -0
- package/dist/packages/switch/index.js +2455 -0
- package/dist/packages/switch/index.js.map +7 -0
- package/dist/packages/switch/react.d.ts +5 -0
- package/dist/packages/switch/react.js +15 -0
- package/dist/packages/switch/styles.d.ts +1 -0
- package/dist/packages/switch/styles.js +2 -0
- package/dist/packages/switch/switch.react.stories.d.ts +15 -0
- package/dist/packages/switch/switch.react.stories.js +29 -0
- package/dist/packages/switch/switch.stories.d.ts +9 -0
- package/dist/packages/switch/switch.stories.js +34 -0
- package/dist/packages/tabs/index.d.ts +4 -0
- package/dist/packages/tabs/index.js +2470 -0
- package/dist/packages/tabs/index.js.map +7 -0
- package/dist/packages/tabs/react.d.ts +12 -0
- package/dist/packages/tabs/react.js +31 -0
- package/dist/packages/tabs/styles.d.ts +1 -0
- package/dist/packages/tabs/styles.js +2 -0
- package/dist/packages/tabs/tab-panel.d.ts +20 -0
- package/dist/packages/tabs/tab-panel.js +2441 -0
- package/dist/packages/tabs/tab-panel.js.map +7 -0
- package/dist/packages/tabs/tab.d.ts +18 -0
- package/dist/packages/tabs/tab.js +2463 -0
- package/dist/packages/tabs/tab.js.map +7 -0
- package/dist/packages/tabs/tabs.d.ts +40 -0
- package/dist/packages/tabs/tabs.js +2448 -0
- package/dist/packages/tabs/tabs.js.map +7 -0
- package/dist/packages/tabs/tabs.react.stories.d.ts +15 -0
- package/dist/packages/tabs/tabs.react.stories.js +51 -0
- package/dist/packages/tabs/tabs.stories.d.ts +8 -0
- package/dist/packages/tabs/tabs.stories.js +2545 -0
- package/dist/packages/tabs/tabs.stories.js.map +7 -0
- package/dist/packages/textfield/index.d.ts +78 -74
- package/dist/packages/textfield/index.js +2514 -422
- package/dist/packages/textfield/index.js.map +4 -4
- package/dist/packages/textfield/react.d.ts +11 -0
- package/dist/packages/textfield/react.js +21 -0
- package/dist/packages/textfield/styles/w-textfield.styles.d.ts +1 -0
- package/dist/packages/textfield/styles/w-textfield.styles.js +46 -0
- package/dist/packages/textfield/styles.d.ts +1 -0
- package/dist/packages/textfield/styles.js +2 -0
- package/dist/packages/textfield/textfield.react.stories.d.ts +37 -0
- package/dist/packages/textfield/textfield.react.stories.js +88 -0
- package/dist/packages/textfield/textfield.stories.d.ts +18 -0
- package/dist/packages/textfield/textfield.stories.js +105 -0
- package/dist/packages/textfield/textfield.test.d.ts +2 -0
- package/dist/packages/textfield/textfield.test.js +68 -0
- package/dist/packages/toast/api.d.ts +4 -45
- package/dist/packages/toast/api.js +41 -0
- package/dist/packages/toast/index.d.ts +3 -0
- package/dist/packages/toast/index.js +2466 -2787
- package/dist/packages/toast/index.js.map +4 -4
- package/dist/packages/toast/locales/da/messages.mjs +1 -0
- package/dist/packages/toast/locales/en/messages.mjs +1 -0
- package/dist/packages/toast/locales/fi/messages.mjs +1 -0
- package/dist/packages/toast/locales/nb/messages.mjs +1 -0
- package/dist/packages/toast/locales/sv/messages.mjs +1 -0
- package/dist/packages/toast/styles.d.ts +1 -0
- package/dist/packages/toast/styles.js +2 -0
- package/dist/packages/toast/toast-container.d.ts +12 -63
- package/dist/packages/toast/toast-container.js +2458 -0
- package/dist/packages/toast/toast-container.js.map +7 -0
- package/dist/packages/toast/toast.d.ts +34 -29
- package/dist/packages/toast/toast.js +2466 -0
- package/dist/packages/toast/toast.js.map +7 -0
- package/dist/packages/toast/toast.stories.d.ts +12 -0
- package/dist/packages/toast/toast.stories.js +50 -0
- package/dist/packages/toast/types.d.ts +15 -0
- package/dist/packages/toast/types.js +1 -0
- package/dist/packages/utils/expand-transition.d.ts +3 -2
- package/dist/packages/utils/expand-transition.js +59 -0
- package/dist/packages/utils/index.d.ts +1 -1
- package/dist/packages/utils/index.js +2 -0
- package/dist/packages/utils/index.js.map +7 -0
- package/dist/packages/utils/unstyled-heading.d.ts +3 -3
- package/dist/packages/utils/unstyled-heading.js +22 -0
- package/dist/packages/utils/window-exists.js +1 -0
- package/dist/setup-tests.d.ts +1 -0
- package/dist/setup-tests.js +1 -0
- package/dist/vscode.css-custom-data.json +6 -0
- package/dist/vscode.html-custom-data.json +738 -0
- package/dist/web-types.json +1693 -0
- package/package.json +93 -37
- package/dist/index.js +0 -6838
- package/dist/index.js.map +0 -7
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import BaseElement from './base-element.js';
|
|
3
|
+
export interface Validator<T extends BaseFormAssociatedElement = BaseFormAssociatedElement> {
|
|
4
|
+
observedAttributes?: string[];
|
|
5
|
+
checkValidity: (element: T) => {
|
|
6
|
+
message: string;
|
|
7
|
+
isValid: boolean;
|
|
8
|
+
invalidKeys: Exclude<keyof ValidityState, 'valid'>[];
|
|
9
|
+
};
|
|
10
|
+
message?: string | ((element: T) => string);
|
|
11
|
+
}
|
|
12
|
+
export interface BaseFormControl extends BaseElement {
|
|
13
|
+
name: null | string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
defaultValue?: unknown;
|
|
16
|
+
defaultChecked?: boolean;
|
|
17
|
+
checked?: boolean;
|
|
18
|
+
defaultSelected?: boolean;
|
|
19
|
+
selected?: boolean;
|
|
20
|
+
form?: string | null;
|
|
21
|
+
value?: unknown;
|
|
22
|
+
pattern?: string;
|
|
23
|
+
min?: number | string | Date;
|
|
24
|
+
max?: number | string | Date;
|
|
25
|
+
step?: number | 'any';
|
|
26
|
+
required?: boolean;
|
|
27
|
+
minlength?: number;
|
|
28
|
+
maxlength?: number;
|
|
29
|
+
readonly validity: ValidityState;
|
|
30
|
+
readonly validationMessage: string;
|
|
31
|
+
checkValidity: () => boolean;
|
|
32
|
+
getForm: () => HTMLFormElement | null;
|
|
33
|
+
reportValidity: () => boolean;
|
|
34
|
+
setCustomValidity: (message: string) => void;
|
|
35
|
+
hasInteracted: boolean;
|
|
36
|
+
valueHasChanged?: boolean;
|
|
37
|
+
/** Convenience API for `setCustomValidity()` */
|
|
38
|
+
customError: null | string;
|
|
39
|
+
}
|
|
40
|
+
export declare class BaseFormAssociatedElement extends BaseElement implements Omit<ElementInternals, 'form' | 'setFormValue'>, BaseFormControl {
|
|
41
|
+
static formAssociated: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Validators are static because they have `observedAttributes`, essentially attributes to "watch"
|
|
44
|
+
* for changes. Whenever these attributes change, we want to be notified and update the validator.
|
|
45
|
+
*/
|
|
46
|
+
static get validators(): Validator[];
|
|
47
|
+
static get observedAttributes(): string[];
|
|
48
|
+
/** The name of the input, submitted as a name/value pair with form data. */
|
|
49
|
+
name: string | null;
|
|
50
|
+
/** Disables the form control. */
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
required: boolean;
|
|
53
|
+
assumeInteractionOn: string[];
|
|
54
|
+
input?: (HTMLElement & {
|
|
55
|
+
value: unknown;
|
|
56
|
+
}) | HTMLInputElement | HTMLTextAreaElement;
|
|
57
|
+
validators: Validator[];
|
|
58
|
+
valueHasChanged: boolean;
|
|
59
|
+
hasInteracted: boolean;
|
|
60
|
+
customError: string | null;
|
|
61
|
+
private emittedEvents;
|
|
62
|
+
constructor();
|
|
63
|
+
private states;
|
|
64
|
+
connectedCallback(): void;
|
|
65
|
+
firstUpdated(...args: Parameters<LitElement['firstUpdated']>): void;
|
|
66
|
+
emitInvalid: (e: Event) => void;
|
|
67
|
+
protected willUpdate(changedProperties: Parameters<LitElement['willUpdate']>[0]): void;
|
|
68
|
+
private handleInteraction;
|
|
69
|
+
get labels(): NodeList;
|
|
70
|
+
getForm(): HTMLFormElement;
|
|
71
|
+
get validity(): ValidityState;
|
|
72
|
+
get willValidate(): boolean;
|
|
73
|
+
get validationMessage(): string;
|
|
74
|
+
checkValidity(): boolean;
|
|
75
|
+
reportValidity(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Override this to change where constraint validation popups are anchored.
|
|
78
|
+
*/
|
|
79
|
+
get validationTarget(): undefined | HTMLElement;
|
|
80
|
+
setValidity(...args: Parameters<typeof this.internals.setValidity>): void;
|
|
81
|
+
setCustomStates(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Do not use this when creating a "Validator". This is intended for end users of components.
|
|
84
|
+
* We track manually defined custom errors so we don't clear them on accident in our validators.
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
87
|
+
setCustomValidity(message: string): void;
|
|
88
|
+
formResetCallback(): void;
|
|
89
|
+
formDisabledCallback(isDisabled: boolean): void;
|
|
90
|
+
/**
|
|
91
|
+
* Called when the browser is trying to restore element’s state to state in which case reason is "restore", or when
|
|
92
|
+
* the browser is trying to fulfill autofill on behalf of user in which case reason is "autocomplete". In the case of
|
|
93
|
+
* "restore", state is a string, File, or FormData object previously set as the second argument to setFormValue.
|
|
94
|
+
*/
|
|
95
|
+
formStateRestoreCallback(state: string | File | FormData | null, reason: 'autocomplete' | 'restore'): void;
|
|
96
|
+
setValue(...args: Parameters<typeof this.internals.setFormValue>): void;
|
|
97
|
+
get allValidators(): Validator<BaseFormAssociatedElement>[];
|
|
98
|
+
/**
|
|
99
|
+
* Reset validity is a way of removing manual custom errors and native validation.
|
|
100
|
+
*/
|
|
101
|
+
resetValidity(): void;
|
|
102
|
+
updateValidity(): void;
|
|
103
|
+
}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { isServer } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
import BaseElement from './base-element.js';
|
|
10
|
+
import { CustomErrorValidator } from './custom-error-validator.js';
|
|
11
|
+
import { WInvalidEvent } from './invalid';
|
|
12
|
+
// setFormValue omitted so that we can use `setValue`
|
|
13
|
+
export class BaseFormAssociatedElement extends BaseElement {
|
|
14
|
+
static { this.formAssociated = true; }
|
|
15
|
+
/**
|
|
16
|
+
* Validators are static because they have `observedAttributes`, essentially attributes to "watch"
|
|
17
|
+
* for changes. Whenever these attributes change, we want to be notified and update the validator.
|
|
18
|
+
*/
|
|
19
|
+
static get validators() {
|
|
20
|
+
return [CustomErrorValidator()];
|
|
21
|
+
}
|
|
22
|
+
// Append all Validator "observedAttributes" into the "observedAttributes" so they can run.
|
|
23
|
+
static get observedAttributes() {
|
|
24
|
+
const parentAttrs = new Set(super.observedAttributes || []);
|
|
25
|
+
for (const validator of this.validators) {
|
|
26
|
+
if (!validator.observedAttributes) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
for (const attr of validator.observedAttributes) {
|
|
30
|
+
parentAttrs.add(attr);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return [...parentAttrs];
|
|
34
|
+
}
|
|
35
|
+
constructor() {
|
|
36
|
+
super();
|
|
37
|
+
// Form attributes
|
|
38
|
+
/** The name of the input, submitted as a name/value pair with form data. */
|
|
39
|
+
this.name = null;
|
|
40
|
+
/** Disables the form control. */
|
|
41
|
+
this.disabled = false;
|
|
42
|
+
this.required = false;
|
|
43
|
+
this.assumeInteractionOn = ['input'];
|
|
44
|
+
this.validators = [];
|
|
45
|
+
// Should these be private?
|
|
46
|
+
this.valueHasChanged = false;
|
|
47
|
+
this.hasInteracted = false;
|
|
48
|
+
// This works around a limitation in Safari. It is a hacky way for us to preserve custom errors generated by the user.
|
|
49
|
+
this.customError = null;
|
|
50
|
+
this.emittedEvents = [];
|
|
51
|
+
this.emitInvalid = (e) => {
|
|
52
|
+
if (e.target !== this)
|
|
53
|
+
return;
|
|
54
|
+
// An "invalid" event counts as interacted, this is usually triggered by a button "submitting"
|
|
55
|
+
this.hasInteracted = true;
|
|
56
|
+
this.dispatchEvent(new WInvalidEvent());
|
|
57
|
+
};
|
|
58
|
+
this.handleInteraction = (event) => {
|
|
59
|
+
const emittedEvents = this.emittedEvents;
|
|
60
|
+
if (!emittedEvents.includes(event.type)) {
|
|
61
|
+
emittedEvents.push(event.type);
|
|
62
|
+
}
|
|
63
|
+
// Mark it as user-interacted as soon as all associated events have been emitted
|
|
64
|
+
if (emittedEvents.length === this.assumeInteractionOn?.length) {
|
|
65
|
+
this.hasInteracted = true;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
if (!isServer) {
|
|
69
|
+
this.addEventListener('invalid', this.emitInvalid);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
connectedCallback() {
|
|
73
|
+
super.connectedCallback();
|
|
74
|
+
this.updateValidity();
|
|
75
|
+
// Lazily evaluate after the constructor to allow people to override the `assumeInteractionOn`
|
|
76
|
+
this.assumeInteractionOn.forEach((event) => {
|
|
77
|
+
this.addEventListener(event, this.handleInteraction);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
firstUpdated(...args) {
|
|
81
|
+
super.firstUpdated(...args);
|
|
82
|
+
this.updateValidity();
|
|
83
|
+
}
|
|
84
|
+
willUpdate(changedProperties) {
|
|
85
|
+
if (!isServer && changedProperties.has('customError')) {
|
|
86
|
+
// We use null because it we really don't want it to show up in the attributes because `custom-error` does reflect
|
|
87
|
+
if (!this.customError) {
|
|
88
|
+
this.customError = null;
|
|
89
|
+
}
|
|
90
|
+
this.setCustomValidity(this.customError || '');
|
|
91
|
+
}
|
|
92
|
+
if (changedProperties.has('value') || changedProperties.has('disabled')) {
|
|
93
|
+
// @ts-expect-error Some components will use an accessors, other use a property, so we don't want to limit them.
|
|
94
|
+
const value = this.value;
|
|
95
|
+
// Accounts for the snowflake case on `<wa-select>`
|
|
96
|
+
if (Array.isArray(value)) {
|
|
97
|
+
if (this.name) {
|
|
98
|
+
const formData = new FormData();
|
|
99
|
+
for (const val of value) {
|
|
100
|
+
formData.append(this.name, val);
|
|
101
|
+
}
|
|
102
|
+
this.setValue(formData, formData);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.setValue(value, value);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (changedProperties.has('disabled')) {
|
|
110
|
+
this.customStates.set('disabled', this.disabled);
|
|
111
|
+
if (this.hasAttribute('disabled') || (!isServer && !this.matches(':disabled'))) {
|
|
112
|
+
this.toggleAttribute('disabled', this.disabled);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
this.updateValidity();
|
|
116
|
+
super.willUpdate(changedProperties);
|
|
117
|
+
}
|
|
118
|
+
get labels() {
|
|
119
|
+
return this.internals.labels;
|
|
120
|
+
}
|
|
121
|
+
getForm() {
|
|
122
|
+
return this.internals.form;
|
|
123
|
+
}
|
|
124
|
+
get validity() {
|
|
125
|
+
return this.internals.validity;
|
|
126
|
+
}
|
|
127
|
+
// Not sure if this supports `novalidate`. Will need to test.
|
|
128
|
+
get willValidate() {
|
|
129
|
+
return this.internals.willValidate;
|
|
130
|
+
}
|
|
131
|
+
get validationMessage() {
|
|
132
|
+
return this.internals.validationMessage;
|
|
133
|
+
}
|
|
134
|
+
checkValidity() {
|
|
135
|
+
this.updateValidity();
|
|
136
|
+
return this.internals.checkValidity();
|
|
137
|
+
}
|
|
138
|
+
reportValidity() {
|
|
139
|
+
this.updateValidity();
|
|
140
|
+
// This seems reasonable. `reportValidity()` is kind of like "we expect you to have interacted"
|
|
141
|
+
this.hasInteracted = true;
|
|
142
|
+
return this.internals.reportValidity();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Override this to change where constraint validation popups are anchored.
|
|
146
|
+
*/
|
|
147
|
+
get validationTarget() {
|
|
148
|
+
return (this.input || undefined);
|
|
149
|
+
}
|
|
150
|
+
setValidity(...args) {
|
|
151
|
+
const flags = args[0];
|
|
152
|
+
const message = args[1];
|
|
153
|
+
let anchor = args[2];
|
|
154
|
+
if (!anchor) {
|
|
155
|
+
anchor = this.validationTarget;
|
|
156
|
+
}
|
|
157
|
+
this.internals.setValidity(flags, message, anchor || undefined);
|
|
158
|
+
this.requestUpdate('validity');
|
|
159
|
+
this.setCustomStates();
|
|
160
|
+
}
|
|
161
|
+
setCustomStates() {
|
|
162
|
+
const required = Boolean(this.required);
|
|
163
|
+
const isValid = this.internals.validity.valid;
|
|
164
|
+
const hasInteracted = this.hasInteracted;
|
|
165
|
+
this.customStates.set('required', required);
|
|
166
|
+
this.customStates.set('optional', !required);
|
|
167
|
+
this.customStates.set('invalid', !isValid);
|
|
168
|
+
this.customStates.set('valid', isValid);
|
|
169
|
+
this.customStates.set('user-invalid', !isValid && hasInteracted);
|
|
170
|
+
this.customStates.set('user-valid', isValid && hasInteracted);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Do not use this when creating a "Validator". This is intended for end users of components.
|
|
174
|
+
* We track manually defined custom errors so we don't clear them on accident in our validators.
|
|
175
|
+
*
|
|
176
|
+
*/
|
|
177
|
+
setCustomValidity(message) {
|
|
178
|
+
if (!message) {
|
|
179
|
+
// We use null because it we really don't want it to show up in the attributes because `custom-error` does reflect
|
|
180
|
+
this.customError = null;
|
|
181
|
+
this.setValidity({});
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.customError = message;
|
|
185
|
+
this.setValidity({ customError: true }, message, this.validationTarget);
|
|
186
|
+
}
|
|
187
|
+
formResetCallback() {
|
|
188
|
+
this.resetValidity();
|
|
189
|
+
this.hasInteracted = false;
|
|
190
|
+
this.valueHasChanged = false;
|
|
191
|
+
this.emittedEvents = [];
|
|
192
|
+
this.updateValidity();
|
|
193
|
+
}
|
|
194
|
+
formDisabledCallback(isDisabled) {
|
|
195
|
+
this.disabled = isDisabled;
|
|
196
|
+
this.updateValidity();
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Called when the browser is trying to restore element’s state to state in which case reason is "restore", or when
|
|
200
|
+
* the browser is trying to fulfill autofill on behalf of user in which case reason is "autocomplete". In the case of
|
|
201
|
+
* "restore", state is a string, File, or FormData object previously set as the second argument to setFormValue.
|
|
202
|
+
*/
|
|
203
|
+
formStateRestoreCallback(state, reason) {
|
|
204
|
+
// @ts-expect-error We purposely do not have a value property. It makes things hard to extend.
|
|
205
|
+
this.value = state;
|
|
206
|
+
if (reason === 'restore') {
|
|
207
|
+
this.resetValidity();
|
|
208
|
+
}
|
|
209
|
+
this.updateValidity();
|
|
210
|
+
}
|
|
211
|
+
setValue(...args) {
|
|
212
|
+
const [value, state] = args;
|
|
213
|
+
this.internals.setFormValue(value, state);
|
|
214
|
+
}
|
|
215
|
+
get allValidators() {
|
|
216
|
+
const staticValidators = this.constructor.validators || [];
|
|
217
|
+
const validators = this.validators || [];
|
|
218
|
+
return [...staticValidators, ...validators];
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Reset validity is a way of removing manual custom errors and native validation.
|
|
222
|
+
*/
|
|
223
|
+
resetValidity() {
|
|
224
|
+
this.setCustomValidity('');
|
|
225
|
+
this.setValidity({});
|
|
226
|
+
}
|
|
227
|
+
updateValidity() {
|
|
228
|
+
if (this.disabled ||
|
|
229
|
+
this.hasAttribute('disabled') ||
|
|
230
|
+
!this.willValidate //
|
|
231
|
+
) {
|
|
232
|
+
this.resetValidity();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const validators = this.allValidators;
|
|
236
|
+
if (!validators?.length) {
|
|
237
|
+
// If there's no validators, we do nothing. We also don't want to mess with custom errors, so we just stop here.
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const flags = {
|
|
241
|
+
// Don't trust custom errors from the Browser. Safari breaks the spec.
|
|
242
|
+
customError: Boolean(this.customError),
|
|
243
|
+
};
|
|
244
|
+
const formControl = this.validationTarget || this.input || undefined;
|
|
245
|
+
let finalMessage = '';
|
|
246
|
+
for (const validator of validators) {
|
|
247
|
+
const { isValid, message, invalidKeys } = validator.checkValidity(this);
|
|
248
|
+
if (isValid) {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
if (!finalMessage) {
|
|
252
|
+
finalMessage = message;
|
|
253
|
+
}
|
|
254
|
+
if (invalidKeys?.length >= 0) {
|
|
255
|
+
invalidKeys.forEach((str) => (flags[str] = true));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// This is a workaround for preserving custom errors
|
|
259
|
+
if (!finalMessage) {
|
|
260
|
+
finalMessage = this.validationMessage;
|
|
261
|
+
}
|
|
262
|
+
this.setValidity(flags, finalMessage, formControl);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
__decorate([
|
|
266
|
+
property({ reflect: true })
|
|
267
|
+
], BaseFormAssociatedElement.prototype, "name", void 0);
|
|
268
|
+
__decorate([
|
|
269
|
+
property({ type: Boolean })
|
|
270
|
+
], BaseFormAssociatedElement.prototype, "disabled", void 0);
|
|
271
|
+
__decorate([
|
|
272
|
+
property({ state: true, attribute: false })
|
|
273
|
+
], BaseFormAssociatedElement.prototype, "valueHasChanged", void 0);
|
|
274
|
+
__decorate([
|
|
275
|
+
property({ state: true, attribute: false })
|
|
276
|
+
], BaseFormAssociatedElement.prototype, "hasInteracted", void 0);
|
|
277
|
+
__decorate([
|
|
278
|
+
property({ attribute: 'custom-error', reflect: true })
|
|
279
|
+
], BaseFormAssociatedElement.prototype, "customError", void 0);
|
|
280
|
+
__decorate([
|
|
281
|
+
property({ attribute: false, state: true, type: Object })
|
|
282
|
+
], BaseFormAssociatedElement.prototype, "validity", null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|