@warp-ds/elements 2.2.0-next.2 → 2.2.0-next.20
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 +7005 -0
- package/dist/index.d.ts +1826 -18
- 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 +8 -0
- package/dist/packages/affix/styles.d.ts +1 -0
- package/dist/packages/affix/styles.js +2 -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 +16 -0
- package/dist/packages/alert/index.d.ts +22 -17
- 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 +8 -0
- package/dist/packages/alert/styles.d.ts +1 -0
- package/dist/packages/alert/styles.js +2 -0
- package/dist/packages/attention/attention.stories.d.ts +15 -0
- package/dist/packages/attention/attention.stories.js +188 -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 -90
- package/dist/packages/attention/index.js +3360 -3984
- 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 +1 -0
- package/dist/packages/attention/react.js +9 -0
- package/dist/packages/attention/styles.d.ts +1 -0
- package/dist/packages/attention/styles.js +2 -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 +8 -0
- package/dist/packages/badge/styles.d.ts +1 -0
- package/dist/packages/badge/styles.js +2 -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 +8 -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.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 +8 -0
- package/dist/packages/breadcrumbs/styles.d.ts +1 -0
- package/dist/packages/breadcrumbs/styles.js +2 -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 +8 -0
- package/dist/packages/button/styles.d.ts +1 -0
- package/dist/packages/button/styles.js +2 -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 +28 -16
- 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 +8 -0
- package/dist/packages/card/styles.d.ts +1 -0
- package/dist/packages/card/styles.js +2 -0
- package/dist/packages/combobox/combobox.stories.d.ts +14 -0
- package/dist/packages/combobox/combobox.stories.js +95 -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/styles.d.ts +1 -0
- package/dist/packages/combobox/styles.js +2 -0
- package/dist/packages/datepicker/DatePicker.test.d.ts +1 -0
- package/dist/packages/datepicker/DatePicker.test.js +68 -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.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 +2 -0
- package/dist/packages/datepicker/react.js +8 -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.stories.d.ts +10 -0
- package/dist/packages/dead-toggle/dead-toggle.stories.js +23 -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 +8 -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 +8 -0
- package/dist/packages/expandable/styles.d.ts +1 -0
- package/dist/packages/expandable/styles.js +2 -0
- package/dist/packages/i18n.js +44 -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.stories.d.ts +20 -0
- package/dist/packages/link/link.stories.js +121 -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 +8 -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.stories.d.ts +19 -0
- package/dist/packages/modal/modal.stories.js +160 -0
- package/dist/packages/modal/react.d.ts +4 -0
- package/dist/packages/modal/react.js +18 -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.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 +8 -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 +2494 -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.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 +2 -0
- package/dist/packages/pagination/react.js +8 -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.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 +23 -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/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/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/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/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 +54 -48
- 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 +2 -0
- package/dist/packages/select/react.js +8 -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/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.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 +13 -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 +2 -0
- package/dist/packages/switch/react.js +8 -0
- package/dist/packages/switch/styles.d.ts +1 -0
- package/dist/packages/switch/styles.js +2 -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 +4 -0
- package/dist/packages/tabs/react.js +18 -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 +38 -0
- package/dist/packages/tabs/tabs.js +2448 -0
- package/dist/packages/tabs/tabs.js.map +7 -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 +2 -0
- package/dist/packages/textfield/react.js +8 -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.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 +153 -0
- package/dist/packages/toast/toast.d.ts +34 -29
- package/dist/packages/toast/toast.js +200 -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 +733 -0
- package/dist/web-types.json +1685 -0
- package/package.json +93 -38
- package/dist/index.js +0 -6838
- package/dist/index.js.map +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"toast.aria.error\":[\"Fejl\"],\"toast.aria.successful\":[\"Fuldført\"],\"toast.aria.warning\":[\"Advarsel\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"toast.aria.error\":[\"Error\"],\"toast.aria.successful\":[\"Successful\"],\"toast.aria.warning\":[\"Warning\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"toast.aria.error\":[\"Virhe\"],\"toast.aria.successful\":[\"Onnistui\"],\"toast.aria.warning\":[\"Varoitus\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"toast.aria.error\":[\"Feil\"],\"toast.aria.successful\":[\"Vellykket\"],\"toast.aria.warning\":[\"Advarsel\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"toast.aria.error\":[\"Fel\"],\"toast.aria.successful\":[\"Genomfört\"],\"toast.aria.warning\":[\"Varning\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.bg-transparent{background-color:#0000}.border-2{border-width:2px}.rounded-8{border-radius:8px}.rounded-full{border-radius:9999px}.block{display:block}.flex{display:flex}.grid{display:grid}.shrink-0{flex-shrink:0}.auto-rows-auto{grid-auto-rows:auto}.overflow-hidden{overflow:hidden}.self-center{align-self:center}.bottom-16{bottom:1.6rem}.left-0{left:0}.right-0{right:0}.justify-center{justify-content:center}.justify-items-center{justify-items:center}.fixed{position:fixed}.relative{position:relative}.static{position:static}.z-50{z-index:50}.s-bg-negative-subtle{background-color:var(--w-s-color-background-negative-subtle)}.s-bg-positive-subtle{background-color:var(--w-s-color-background-positive-subtle)}.s-bg-warning-subtle{background-color:var(--w-s-color-background-warning-subtle)}.s-text{color:var(--w-s-color-text)}.s-icon{color:var(--w-s-color-icon)}.s-icon-negative{color:var(--w-s-color-icon-negative)}.s-icon-positive{color:var(--w-s-color-icon-positive)}.s-icon-warning{color:var(--w-s-color-icon-warning)}.hover\\:s-icon-hover:hover{color:var(--w-s-color-icon-hover)}.active\\:s-icon-active:active{color:var(--w-s-color-icon-active)}.s-border-negative-subtle{border-color:var(--w-s-color-border-negative-subtle)}.s-border-positive-subtle{border-color:var(--w-s-color-border-positive-subtle)}.s-border-warning-subtle{border-color:var(--w-s-color-border-warning-subtle)}.w-full{width:100%}.h-\\[16px\\]{height:16px}.w-\\[16px\\]{width:16px}.mx-8{margin-left:.8rem;margin-right:.8rem}.mx-auto{margin-left:auto;margin-right:auto}.last-child\\:mb-0>:last-child{margin-bottom:0}.ml-auto{margin-left:auto}.mr-8{margin-right:.8rem}.mt-16{margin-top:1.6rem}.m-\\[8px\\]{margin:8px}.p-8{padding:.8rem}.py-4{padding-top:.4rem;padding-bottom:.4rem}.p-\\[8px\\]{padding:8px}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.translate-z-0{--w-translate-z:0rem;transform:translateX(var(--w-translate-x))translateY(var(--w-translate-y))translateZ(var(--w-translate-z))rotate(var(--w-rotate))rotateX(var(--w-rotate-x))rotateY(var(--w-rotate-y))rotateZ(var(--w-rotate-z))skewX(var(--w-skew-x))skewY(var(--w-skew-y))scaleX(var(--w-scale-x))scaleY(var(--w-scale-y))scaleZ(var(--w-scale-z))}.transform{transform:translateX(var(--w-translate-x))translateY(var(--w-translate-y))translateZ(var(--w-translate-z))rotate(var(--w-rotate))rotateX(var(--w-rotate-x))rotateY(var(--w-rotate-y))rotateZ(var(--w-rotate-z))skewX(var(--w-skew-x))skewY(var(--w-skew-y))scaleX(var(--w-scale-x))scaleY(var(--w-scale-y))scaleZ(var(--w-scale-z))}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}@media (min-width:480px){.sm\\:mx-16{margin-left:1.6rem;margin-right:1.6rem}}`;
|
|
@@ -1,67 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @property {(number|string)} [duration] Duration of toast in milliseconds. Defaults to 5000. For accessibility reasons, toasts should never be interactive and therefore need to auto remove. If you must disable auto remove, set duration to Number.POSITIVE_INFINITY.
|
|
8
|
-
* @property {Boolean} [canClose] Whether the toast can be dismissed. Defaults to false. WARNING! For accessibility reasons, toasts should not be interactive and canclose should always be false. If the toast absolutely must be dismissble, set this to true.
|
|
9
|
-
*/
|
|
10
|
-
export class WarpToastContainer {
|
|
11
|
-
static styles: any[];
|
|
12
|
-
static properties: {
|
|
13
|
-
_toasts: {
|
|
14
|
-
state: boolean;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
static init(): Element;
|
|
18
|
-
_toasts: Map<any, any>;
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import type { ToastOptions, ToastInternal } from './types';
|
|
3
|
+
export declare class WarpToastContainer extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
private _toasts;
|
|
6
|
+
private _interval;
|
|
19
7
|
connectedCallback(): void;
|
|
20
|
-
_interval: NodeJS.Timeout;
|
|
21
8
|
disconnectedCallback(): void;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
get(id: string | number): ToastOptions;
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* @param {Object} toast
|
|
32
|
-
* @returns {WarpToastContainer}
|
|
33
|
-
*/
|
|
34
|
-
set(toast: any): WarpToastContainer;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @param {String|Number} id
|
|
38
|
-
* @returns {ToastOptions | false}
|
|
39
|
-
*/
|
|
40
|
-
del(id: string | number): ToastOptions | false;
|
|
9
|
+
static init(): Element;
|
|
10
|
+
/** @internal */
|
|
11
|
+
get _toastsArray(): ToastInternal[];
|
|
12
|
+
get(id: string | number): ToastInternal | undefined;
|
|
13
|
+
set(toast: ToastOptions): Map<string | number, ToastInternal>;
|
|
14
|
+
del(id: string | number): Promise<boolean>;
|
|
41
15
|
render(): import("lit").TemplateResult<1>;
|
|
42
16
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Toast helper function options
|
|
45
|
-
*/
|
|
46
|
-
export type ToastOptions = {
|
|
47
|
-
/**
|
|
48
|
-
* Custom identifier
|
|
49
|
-
*/
|
|
50
|
-
id?: (number | string);
|
|
51
|
-
/**
|
|
52
|
-
* Type of alert
|
|
53
|
-
*/
|
|
54
|
-
type?: ("success" | "error" | "warning");
|
|
55
|
-
/**
|
|
56
|
-
* The toast message. Only needed when updating text on existing toast
|
|
57
|
-
*/
|
|
58
|
-
text?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Duration of toast in milliseconds. Defaults to 5000. For accessibility reasons, toasts should never be interactive and therefore need to auto remove. If you must disable auto remove, set duration to Number.POSITIVE_INFINITY.
|
|
61
|
-
*/
|
|
62
|
-
duration?: (number | string);
|
|
63
|
-
/**
|
|
64
|
-
* Whether the toast can be dismissed. Defaults to false. WARNING! For accessibility reasons, toasts should not be interactive and canclose should always be false. If the toast absolutely must be dismissble, set this to true.
|
|
65
|
-
*/
|
|
66
|
-
canClose?: boolean;
|
|
67
|
-
};
|
|
@@ -0,0 +1,153 @@
|
|
|
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
|
+
// @warp-css;
|
|
8
|
+
import { css, html, LitElement } from 'lit';
|
|
9
|
+
import { state } from 'lit/decorators.js';
|
|
10
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
11
|
+
import { reset } from '../styles';
|
|
12
|
+
import { styles } from './styles';
|
|
13
|
+
/**
|
|
14
|
+
* You should probably not include this component in HTML markup.
|
|
15
|
+
*
|
|
16
|
+
* As long as the element definition is imported in your application you can use the toast JS API to create toasts.
|
|
17
|
+
*
|
|
18
|
+
* ```js
|
|
19
|
+
* import from '@warp-ds/elements/components/toast';
|
|
20
|
+
* import { toast, removeToast, updateToast } from '@warp-ds/elements/toast';
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/overlays-toast--docs)
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
// all class objects have to be in this file when generating
|
|
28
|
+
const ccToastContainer = {
|
|
29
|
+
wrapper: 'fixed transform translate-z-0 bottom-16 left-0 right-0 mx-8 sm:mx-16 z-50 pointer-events-none',
|
|
30
|
+
base: 'grid auto-rows-auto justify-items-center justify-center mx-auto pointer-events-none',
|
|
31
|
+
content: 'w-full',
|
|
32
|
+
};
|
|
33
|
+
export class WarpToastContainer extends LitElement {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
this._toasts = new Map();
|
|
37
|
+
}
|
|
38
|
+
static { this.styles = [
|
|
39
|
+
reset,
|
|
40
|
+
styles,
|
|
41
|
+
css `
|
|
42
|
+
:host {
|
|
43
|
+
display: block;
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
]; }
|
|
47
|
+
connectedCallback() {
|
|
48
|
+
super.connectedCallback();
|
|
49
|
+
// regularly check if any toasts have expired
|
|
50
|
+
this._interval = setInterval(() => {
|
|
51
|
+
// sort toasts into keep and remove
|
|
52
|
+
const keep = [];
|
|
53
|
+
const remove = [];
|
|
54
|
+
for (const toast of this._toasts) {
|
|
55
|
+
if (Date.now() <= toast[1].duration)
|
|
56
|
+
keep.push(toast);
|
|
57
|
+
else
|
|
58
|
+
remove.push(toast);
|
|
59
|
+
}
|
|
60
|
+
// collapse toasts that will be removed
|
|
61
|
+
const collapseTasks = [];
|
|
62
|
+
for (const [id] of remove) {
|
|
63
|
+
const el = this.renderRoot.querySelector(`#${id}`);
|
|
64
|
+
collapseTasks.push(el.collapse());
|
|
65
|
+
}
|
|
66
|
+
// once all toasts that should be removed have been collapsed, remove them from the map
|
|
67
|
+
Promise.all(collapseTasks).then(() => {
|
|
68
|
+
if (keep.length !== this._toasts.size) {
|
|
69
|
+
this._toasts = new Map(keep);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}, 500);
|
|
73
|
+
}
|
|
74
|
+
disconnectedCallback() {
|
|
75
|
+
super.disconnectedCallback();
|
|
76
|
+
if (this._interval) {
|
|
77
|
+
clearTimeout(this._interval);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
static init() {
|
|
81
|
+
let el = document.querySelector('w-toast-container');
|
|
82
|
+
if (!el) {
|
|
83
|
+
el = document.createElement('w-toast-container');
|
|
84
|
+
document.body.appendChild(el);
|
|
85
|
+
}
|
|
86
|
+
return el;
|
|
87
|
+
}
|
|
88
|
+
/** @internal */
|
|
89
|
+
get _toastsArray() {
|
|
90
|
+
return Array.from(this._toasts).map(([, toast]) => toast);
|
|
91
|
+
}
|
|
92
|
+
get(id) {
|
|
93
|
+
if (!id) {
|
|
94
|
+
throw new Error('undefined "id" given when attempting to retrieve toast');
|
|
95
|
+
}
|
|
96
|
+
if (typeof id !== 'string' && !Number.isInteger(id)) {
|
|
97
|
+
throw new Error('"id" must be number or string when attempting to retrieve toast');
|
|
98
|
+
}
|
|
99
|
+
return this._toasts.get(id);
|
|
100
|
+
}
|
|
101
|
+
set(toast) {
|
|
102
|
+
if (!toast.id) {
|
|
103
|
+
throw new Error('invalid or undefined "id" on toast object');
|
|
104
|
+
}
|
|
105
|
+
const result = this._toasts.set(toast.id, {
|
|
106
|
+
id: toast.id,
|
|
107
|
+
type: toast.type ?? 'success',
|
|
108
|
+
text: toast.text ?? '',
|
|
109
|
+
canclose: toast.canclose ?? false,
|
|
110
|
+
duration: Date.now() + (toast.duration || 5000),
|
|
111
|
+
});
|
|
112
|
+
this._toasts = new Map(Array.from(this._toasts));
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
async del(id) {
|
|
116
|
+
if (!id) {
|
|
117
|
+
throw new Error('undefined "id" given when attempting to retrieve toast');
|
|
118
|
+
}
|
|
119
|
+
if (typeof id !== 'string' && !Number.isInteger(id)) {
|
|
120
|
+
throw new Error('"id" must be number or string when attempting to retrieve toast');
|
|
121
|
+
}
|
|
122
|
+
const el = this.renderRoot.querySelector(`#${id}`);
|
|
123
|
+
if (!this._toasts.has(id)) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
await el.collapse();
|
|
127
|
+
const result = this._toasts.delete(id);
|
|
128
|
+
this._toasts = new Map(Array.from(this._toasts));
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
render() {
|
|
132
|
+
return html `
|
|
133
|
+
<aside class="${ccToastContainer.wrapper}">
|
|
134
|
+
<div class="${ccToastContainer.base}" id="w-toast-container-list">
|
|
135
|
+
${repeat(this._toastsArray, (toast) => toast.id, (toast) => html ` <w-toast
|
|
136
|
+
class="${ccToastContainer.content}"
|
|
137
|
+
id="${toast.id}"
|
|
138
|
+
type="${toast.type}"
|
|
139
|
+
text="${toast.text}"
|
|
140
|
+
?canclose=${toast.canclose}
|
|
141
|
+
@close=${() => this.del(toast.id)}>
|
|
142
|
+
</w-toast>`)}
|
|
143
|
+
</div>
|
|
144
|
+
</aside>
|
|
145
|
+
`;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
__decorate([
|
|
149
|
+
state()
|
|
150
|
+
], WarpToastContainer.prototype, "_toasts", void 0);
|
|
151
|
+
if (!customElements.get('w-toast-container')) {
|
|
152
|
+
customElements.define('w-toast-container', WarpToastContainer);
|
|
153
|
+
}
|
|
@@ -1,43 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import '@warp-ds/icons/elements/warning-16';
|
|
3
|
+
import '@warp-ds/icons/elements/error-16';
|
|
4
|
+
import '@warp-ds/icons/elements/success-16';
|
|
5
|
+
import '@warp-ds/icons/elements/close-16';
|
|
6
|
+
import type { ToastType } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* You should probably not include this component in HTML markup.
|
|
9
|
+
*
|
|
10
|
+
* As long as the element definition is imported in your application you can use the toast JS API to create toasts.
|
|
11
|
+
*
|
|
12
|
+
* ```js
|
|
13
|
+
* import from '@warp-ds/elements/components/toast';
|
|
14
|
+
* import { toast, removeToast, updateToast } from '@warp-ds/elements/toast';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/overlays-toast--docs)
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare class WarpToast extends LitElement {
|
|
22
|
+
#private;
|
|
23
|
+
static styles: import("lit").CSSResult[];
|
|
25
24
|
id: string;
|
|
26
|
-
type:
|
|
25
|
+
type: ToastType;
|
|
27
26
|
text: string;
|
|
28
27
|
canclose: boolean;
|
|
28
|
+
private _expanded;
|
|
29
|
+
constructor();
|
|
29
30
|
connectedCallback(): void;
|
|
30
31
|
disconnectedCallback(): void;
|
|
31
32
|
updated(): void;
|
|
32
|
-
|
|
33
|
-
get _wrapper():
|
|
33
|
+
/** @internal */
|
|
34
|
+
get _wrapper(): HTMLElement;
|
|
35
|
+
/** @internal */
|
|
34
36
|
get _warning(): boolean;
|
|
37
|
+
/** @internal */
|
|
35
38
|
get _error(): boolean;
|
|
39
|
+
/** @internal */
|
|
36
40
|
get _role(): "alert" | "status";
|
|
41
|
+
/** @internal */
|
|
37
42
|
get _typeLabel(): string;
|
|
43
|
+
/** @internal */
|
|
38
44
|
get _iconMarkup(): import("lit").TemplateResult<1>;
|
|
39
|
-
collapse(): Promise<
|
|
45
|
+
collapse(): Promise<void>;
|
|
40
46
|
close(): void;
|
|
41
47
|
render(): import("lit").TemplateResult<1>;
|
|
42
|
-
#private;
|
|
43
48
|
}
|
|
@@ -0,0 +1,200 @@
|
|
|
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 { css, html, LitElement } from 'lit';
|
|
8
|
+
import { classNames } from '@chbphone55/classnames';
|
|
9
|
+
import { i18n } from '@lingui/core';
|
|
10
|
+
import { expand, collapse } from 'element-collapse';
|
|
11
|
+
import { property, state } from 'lit/decorators.js';
|
|
12
|
+
import { when } from 'lit/directives/when.js';
|
|
13
|
+
import '@warp-ds/icons/elements/warning-16';
|
|
14
|
+
import '@warp-ds/icons/elements/error-16';
|
|
15
|
+
import '@warp-ds/icons/elements/success-16';
|
|
16
|
+
import '@warp-ds/icons/elements/close-16';
|
|
17
|
+
import { activateI18n } from '../i18n';
|
|
18
|
+
import { reset } from '../styles';
|
|
19
|
+
import { messages as daMessages } from './locales/da/messages.mjs';
|
|
20
|
+
import { messages as enMessages } from './locales/en/messages.mjs';
|
|
21
|
+
import { messages as fiMessages } from './locales/fi/messages.mjs';
|
|
22
|
+
import { messages as nbMessages } from './locales/nb/messages.mjs';
|
|
23
|
+
import { messages as svMessages } from './locales/sv/messages.mjs';
|
|
24
|
+
import { styles } from './styles';
|
|
25
|
+
const ccToast = {
|
|
26
|
+
wrapper: 'relative overflow-hidden w-full',
|
|
27
|
+
base: 'flex group p-8 mt-16 rounded-8 border-2 pointer-events-auto transition-all',
|
|
28
|
+
positive: 's-bg-positive-subtle s-border-positive-subtle s-text',
|
|
29
|
+
warning: 's-bg-warning-subtle s-border-warning-subtle s-text',
|
|
30
|
+
negative: 's-bg-negative-subtle s-border-negative-subtle s-text',
|
|
31
|
+
iconBase: 'shrink-0 rounded-full w-[16px] h-[16px] m-[8px]',
|
|
32
|
+
iconPositive: 's-icon-positive',
|
|
33
|
+
iconWarning: 's-icon-warning',
|
|
34
|
+
iconNegative: 's-icon-negative',
|
|
35
|
+
iconLoading: 'animate-bounce',
|
|
36
|
+
content: 'self-center mr-8 py-4 last-child:mb-0',
|
|
37
|
+
close: 'bg-transparent ml-auto p-[8px] s-icon hover:s-icon-hover active:s-icon-active',
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* You should probably not include this component in HTML markup.
|
|
41
|
+
*
|
|
42
|
+
* As long as the element definition is imported in your application you can use the toast JS API to create toasts.
|
|
43
|
+
*
|
|
44
|
+
* ```js
|
|
45
|
+
* import from '@warp-ds/elements/components/toast';
|
|
46
|
+
* import { toast, removeToast, updateToast } from '@warp-ds/elements/toast';
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/overlays-toast--docs)
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export class WarpToast extends LitElement {
|
|
54
|
+
static { this.styles = [
|
|
55
|
+
reset,
|
|
56
|
+
styles,
|
|
57
|
+
css `
|
|
58
|
+
:host {
|
|
59
|
+
display: block;
|
|
60
|
+
}
|
|
61
|
+
`,
|
|
62
|
+
]; }
|
|
63
|
+
constructor() {
|
|
64
|
+
super();
|
|
65
|
+
this.id = Date.now().toString(36) + Math.random().toString(36).slice(2, 5);
|
|
66
|
+
this.type = 'success';
|
|
67
|
+
this.text = '';
|
|
68
|
+
this.canclose = false;
|
|
69
|
+
this._expanded = false;
|
|
70
|
+
activateI18n(enMessages, nbMessages, fiMessages, daMessages, svMessages);
|
|
71
|
+
}
|
|
72
|
+
connectedCallback() {
|
|
73
|
+
super.connectedCallback();
|
|
74
|
+
}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
super.disconnectedCallback();
|
|
77
|
+
}
|
|
78
|
+
updated() {
|
|
79
|
+
if (!this._expanded && this._wrapper)
|
|
80
|
+
expand(this._wrapper, () => (this._expanded = true));
|
|
81
|
+
}
|
|
82
|
+
get #primaryClasses() {
|
|
83
|
+
return classNames([
|
|
84
|
+
ccToast.base,
|
|
85
|
+
this.type === 'success' && ccToast.positive,
|
|
86
|
+
this.type === 'warning' && ccToast.warning,
|
|
87
|
+
this.type === 'error' && ccToast.negative,
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
get #iconClasses() {
|
|
91
|
+
return classNames([
|
|
92
|
+
ccToast.iconBase,
|
|
93
|
+
this.type === 'success' && ccToast.iconPositive,
|
|
94
|
+
this.type === 'warning' && ccToast.iconWarning,
|
|
95
|
+
this.type === 'error' && ccToast.iconNegative,
|
|
96
|
+
]);
|
|
97
|
+
}
|
|
98
|
+
/** @internal */
|
|
99
|
+
get _wrapper() {
|
|
100
|
+
return this.renderRoot?.querySelector(`section`) ?? null;
|
|
101
|
+
}
|
|
102
|
+
/** @internal */
|
|
103
|
+
get _warning() {
|
|
104
|
+
return this.type === 'warning';
|
|
105
|
+
}
|
|
106
|
+
/** @internal */
|
|
107
|
+
get _error() {
|
|
108
|
+
return this.type === 'error';
|
|
109
|
+
}
|
|
110
|
+
/** @internal */
|
|
111
|
+
get _role() {
|
|
112
|
+
return this._error || this._warning ? 'alert' : 'status';
|
|
113
|
+
}
|
|
114
|
+
/** @internal */
|
|
115
|
+
get _typeLabel() {
|
|
116
|
+
if (this._warning) {
|
|
117
|
+
return i18n._({
|
|
118
|
+
id: 'toast.aria.warning',
|
|
119
|
+
message: 'Warning',
|
|
120
|
+
comment: 'Default screenreader message for warning in toast component',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (this._error) {
|
|
124
|
+
return i18n._({
|
|
125
|
+
id: 'toast.aria.error',
|
|
126
|
+
message: 'Error',
|
|
127
|
+
comment: 'Default screenreader message for error in toast component',
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
return i18n._({
|
|
132
|
+
id: 'toast.aria.successful',
|
|
133
|
+
message: 'Successful',
|
|
134
|
+
comment: 'Default screenreader message for successful in toast component',
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/** @internal */
|
|
139
|
+
get _iconMarkup() {
|
|
140
|
+
if (this._warning)
|
|
141
|
+
return html `<w-icon-warning-16></w-icon-warning-16>`;
|
|
142
|
+
if (this._error)
|
|
143
|
+
return html `<w-icon-error-16></w-icon-error-16>`;
|
|
144
|
+
else
|
|
145
|
+
return html `<w-icon-success-16></w-icon-success-16>`;
|
|
146
|
+
}
|
|
147
|
+
async collapse() {
|
|
148
|
+
return new Promise((resolve) => {
|
|
149
|
+
if (this._expanded && this._wrapper) {
|
|
150
|
+
collapse(this._wrapper, resolve);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
resolve();
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
close() {
|
|
158
|
+
const event = new CustomEvent('close', {
|
|
159
|
+
detail: { id: this.id },
|
|
160
|
+
bubbles: true,
|
|
161
|
+
composed: true,
|
|
162
|
+
});
|
|
163
|
+
this.updateComplete.then(() => this.dispatchEvent(event));
|
|
164
|
+
}
|
|
165
|
+
render() {
|
|
166
|
+
if (!this.text)
|
|
167
|
+
return html ``;
|
|
168
|
+
return html ` <section class="${ccToast.wrapper}" aria-label="${this._typeLabel}">
|
|
169
|
+
<div class="${this.#primaryClasses}">
|
|
170
|
+
<div class="${this.#iconClasses}">${this._iconMarkup}</div>
|
|
171
|
+
<div role="${this._role}" class="${ccToast.content}">
|
|
172
|
+
<p>${this.text}</p>
|
|
173
|
+
</div>
|
|
174
|
+
${when(this.canclose === true, () => html `
|
|
175
|
+
<button class="${ccToast.close}" @click="${this.close}">
|
|
176
|
+
<w-icon-close-16></w-icon-close-16>
|
|
177
|
+
</button>
|
|
178
|
+
`)}
|
|
179
|
+
</div>
|
|
180
|
+
</section>`;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
__decorate([
|
|
184
|
+
property({ type: String, attribute: true, reflect: true })
|
|
185
|
+
], WarpToast.prototype, "id", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
property({ type: String, attribute: true, reflect: true })
|
|
188
|
+
], WarpToast.prototype, "type", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
property({ type: String, attribute: true, reflect: true })
|
|
191
|
+
], WarpToast.prototype, "text", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
property({ type: Boolean, attribute: true, reflect: true })
|
|
194
|
+
], WarpToast.prototype, "canclose", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
state()
|
|
197
|
+
], WarpToast.prototype, "_expanded", void 0);
|
|
198
|
+
if (!customElements.get('w-toast')) {
|
|
199
|
+
customElements.define('w-toast', WarpToast);
|
|
200
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
import type { WarpToastContainer } from './index.js';
|
|
3
|
+
import '../button/index.js';
|
|
4
|
+
import './index.js';
|
|
5
|
+
declare const containerArgs: Partial<WarpToastContainer> & {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
declare const meta: Meta;
|
|
9
|
+
export default meta;
|
|
10
|
+
export declare const Default: StoryObj;
|
|
11
|
+
export declare const ToastContainer: StoryObj<typeof containerArgs>;
|
|
12
|
+
export declare const Toast: StoryObj;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { spread } from '@open-wc/lit-helpers';
|
|
3
|
+
import { getStorybookHelpers } from '@wc-toolkit/storybook-helpers';
|
|
4
|
+
import { prespread } from '../../.storybook/utilities.js';
|
|
5
|
+
import '../button/index.js';
|
|
6
|
+
import './index.js';
|
|
7
|
+
const { events, args, argTypes } = getStorybookHelpers('w-pill');
|
|
8
|
+
const { events: containerEvents, args: containerArgs, argTypes: containerArgTypes, } = getStorybookHelpers('w-toast-container');
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Overlays/Toast',
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Default = {
|
|
14
|
+
args: {},
|
|
15
|
+
render() {
|
|
16
|
+
return html `
|
|
17
|
+
<w-button small onclick="window.toast('message goes here', { type: 'error', canclose: true })"> See Error Example </w-button>
|
|
18
|
+
<w-button small onclick="window.toast('message goes here', { type: 'warning', canclose: true })"> See Warning Example </w-button>
|
|
19
|
+
<w-button small onclick="window.toast('message goes here', { type: 'success', canclose: true })"> See Success Example </w-button>
|
|
20
|
+
`;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export const ToastContainer = {
|
|
24
|
+
args: containerArgs,
|
|
25
|
+
render(args) {
|
|
26
|
+
return html ` <p>This is here to document attributes. See the Default example for a complete usage example.</p>
|
|
27
|
+
<w-toast-container ${spread(prespread(args))}></w-toast-container>`;
|
|
28
|
+
},
|
|
29
|
+
argTypes: containerArgTypes,
|
|
30
|
+
parameters: {
|
|
31
|
+
actions: {
|
|
32
|
+
handles: containerEvents,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export const Toast = {
|
|
37
|
+
args,
|
|
38
|
+
render(args) {
|
|
39
|
+
return html `
|
|
40
|
+
<p>This is here to document attributes. See the Default example for a complete usage example.</p>
|
|
41
|
+
<w-toast ${spread(prespread(args))}></w-toast>
|
|
42
|
+
`;
|
|
43
|
+
},
|
|
44
|
+
argTypes,
|
|
45
|
+
parameters: {
|
|
46
|
+
actions: {
|
|
47
|
+
handles: events,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ToastType = 'success' | 'error' | 'warning';
|
|
2
|
+
export interface ToastOptions {
|
|
3
|
+
id?: string | number;
|
|
4
|
+
type?: ToastType;
|
|
5
|
+
text?: string;
|
|
6
|
+
duration?: number;
|
|
7
|
+
canclose?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ToastInternal {
|
|
10
|
+
id: string | number;
|
|
11
|
+
type: ToastType;
|
|
12
|
+
text: string;
|
|
13
|
+
duration: number;
|
|
14
|
+
canclose: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class ExpandTransition {
|
|
1
|
+
export class ExpandTransition extends LitElement {
|
|
2
2
|
static properties: {
|
|
3
3
|
show: {
|
|
4
4
|
type: BooleanConstructor;
|
|
@@ -9,7 +9,7 @@ export class ExpandTransition {
|
|
|
9
9
|
state: boolean;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
static styles:
|
|
12
|
+
static styles: import("lit").CSSResult[];
|
|
13
13
|
show: boolean;
|
|
14
14
|
_mounted: boolean;
|
|
15
15
|
_removeElement: boolean;
|
|
@@ -18,3 +18,4 @@ export class ExpandTransition {
|
|
|
18
18
|
get _wrapper(): this;
|
|
19
19
|
render(): import("lit").TemplateResult<1>;
|
|
20
20
|
}
|
|
21
|
+
import { LitElement } from 'lit';
|