@warp-ds/elements 2.4.0 → 2.5.0-next.2
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/dist/api.js.map +2 -2
- package/dist/custom-elements.json +878 -412
- package/dist/index.d.ts +2204 -777
- package/dist/packages/affix/{index.js → affix.js} +1 -1
- package/dist/packages/affix/{index.js.map → affix.js.map} +1 -1
- package/dist/packages/affix/affix.react.stories.d.ts +1 -1
- package/dist/packages/affix/affix.stories.d.ts +2 -2
- package/dist/packages/affix/affix.stories.js +1 -1
- package/dist/packages/affix/affix.test.d.ts +1 -1
- package/dist/packages/affix/affix.test.js +1 -1
- package/dist/packages/affix/react.d.ts +1 -1
- package/dist/packages/alert/{index.js → alert.js} +1 -1
- package/dist/packages/alert/{index.js.map → alert.js.map} +1 -1
- package/dist/packages/alert/alert.react.stories.d.ts +1 -1
- package/dist/packages/alert/alert.stories.d.ts +2 -2
- package/dist/packages/alert/alert.stories.js +1 -1
- package/dist/packages/alert/alert.test.d.ts +1 -1
- package/dist/packages/alert/alert.test.js +1 -1
- package/dist/packages/alert/react.d.ts +1 -1
- package/dist/packages/alert/react.js +1 -1
- package/dist/packages/attention/{index.d.ts → attention.d.ts} +1 -1
- package/dist/packages/attention/{index.js → attention.js} +18 -18
- package/dist/packages/attention/attention.js.map +7 -0
- package/dist/packages/attention/attention.react.stories.d.ts +1 -1
- package/dist/packages/attention/attention.stories.d.ts +3 -3
- package/dist/packages/attention/attention.stories.js +2 -2
- package/dist/packages/attention/attention.test.d.ts +1 -1
- package/dist/packages/attention/attention.test.js +1 -1
- package/dist/packages/attention/react.d.ts +1 -1
- package/dist/packages/attention/react.js +1 -1
- package/dist/packages/badge/{index.js → badge.js} +1 -1
- package/dist/packages/badge/{index.js.map → badge.js.map} +1 -1
- package/dist/packages/badge/badge.react.stories.d.ts +3 -3
- package/dist/packages/badge/badge.stories.d.ts +2 -2
- package/dist/packages/badge/badge.stories.js +1 -1
- package/dist/packages/badge/badge.test.d.ts +1 -1
- package/dist/packages/badge/badge.test.js +1 -1
- package/dist/packages/badge/react.d.ts +1 -1
- package/dist/packages/badge/react.js +1 -1
- package/dist/packages/box/{index.js → box.js} +1 -1
- package/dist/packages/box/{index.js.map → box.js.map} +1 -1
- package/dist/packages/box/box.react.stories.d.ts +3 -3
- package/dist/packages/box/box.stories.d.ts +2 -2
- package/dist/packages/box/box.stories.js +1 -1
- package/dist/packages/box/box.test.d.ts +1 -1
- package/dist/packages/box/box.test.js +1 -1
- package/dist/packages/box/react.d.ts +1 -1
- package/dist/packages/box/react.js +1 -1
- package/dist/packages/box/slot.test.d.ts +1 -1
- package/dist/packages/box/slot.test.js +1 -1
- package/dist/packages/breadcrumbs/{index.js → breadcrumbs.js} +10 -10
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +7 -0
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.d.ts +3 -3
- package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +2 -2
- package/dist/packages/breadcrumbs/breadcrumbs.stories.js +1 -1
- package/dist/packages/breadcrumbs/breadcrumbs.test.d.ts +1 -1
- package/dist/packages/breadcrumbs/breadcrumbs.test.js +1 -1
- package/dist/packages/breadcrumbs/react.d.ts +1 -1
- package/dist/packages/breadcrumbs/react.js +1 -1
- package/dist/packages/button/{index.d.ts → button.d.ts} +1 -1
- package/dist/packages/button/{index.js → button.js} +12 -12
- package/dist/packages/button/button.js.map +7 -0
- package/dist/packages/button/button.react.stories.d.ts +3 -3
- package/dist/packages/button/button.stories.d.ts +2 -2
- package/dist/packages/button/button.stories.js +1 -1
- package/dist/packages/button/button.test.d.ts +1 -1
- package/dist/packages/button/button.test.js +1 -1
- package/dist/packages/button/react.d.ts +1 -1
- package/dist/packages/button/react.js +1 -1
- package/dist/packages/card/{index.js → card.js} +9 -9
- package/dist/packages/card/card.js.map +7 -0
- package/dist/packages/card/card.react.stories.d.ts +3 -3
- package/dist/packages/card/card.stories.d.ts +2 -2
- package/dist/packages/card/card.stories.js +1 -1
- package/dist/packages/card/card.test.d.ts +1 -1
- package/dist/packages/card/card.test.js +1 -1
- package/dist/packages/card/react.d.ts +1 -1
- package/dist/packages/card/react.js +1 -1
- package/dist/packages/combobox/{index.js → combobox.js} +14 -14
- package/dist/packages/combobox/{index.js.map → combobox.js.map} +4 -4
- package/dist/packages/combobox/combobox.react.stories.d.ts +4 -4
- package/dist/packages/combobox/combobox.stories.d.ts +3 -3
- package/dist/packages/combobox/combobox.stories.js +2 -2
- package/dist/packages/combobox/combobox.test.d.ts +2 -2
- package/dist/packages/combobox/combobox.test.js +2 -2
- package/dist/packages/combobox/react.d.ts +1 -1
- package/dist/packages/combobox/react.js +1 -1
- package/dist/packages/datepicker/DatePicker.test.d.ts +2 -2
- package/dist/packages/datepicker/DatePicker.test.js +2 -2
- package/dist/packages/datepicker/datepicker.js +15 -15
- package/dist/packages/datepicker/datepicker.js.map +3 -3
- package/dist/packages/datepicker/datepicker.react.stories.d.ts +2 -2
- package/dist/packages/datepicker/datepicker.stories.d.ts +3 -3
- package/dist/packages/datepicker/datepicker.stories.js +2 -2
- package/dist/packages/datepicker/datepicker.test.d.ts +2 -2
- package/dist/packages/datepicker/datepicker.test.js +2 -2
- package/dist/packages/datepicker/react.js +1 -1
- package/dist/packages/expandable/{index.js → expandable.js} +1 -1
- package/dist/packages/expandable/{index.js.map → expandable.js.map} +1 -1
- package/dist/packages/expandable/expandable.react.stories.d.ts +3 -3
- package/dist/packages/expandable/expandable.stories.d.ts +2 -2
- package/dist/packages/expandable/expandable.stories.js +1 -1
- package/dist/packages/expandable/expandable.test.d.ts +1 -1
- package/dist/packages/expandable/expandable.test.js +1 -1
- package/dist/packages/expandable/react.d.ts +1 -1
- package/dist/packages/expandable/react.js +1 -1
- package/dist/packages/i18n.js +6 -2
- package/dist/packages/icon/icon.d.ts +22 -0
- package/dist/packages/icon/icon.js +27 -0
- package/dist/packages/icon/icon.js.map +7 -0
- package/dist/packages/icon/icon.react.stories.d.ts +28 -0
- package/dist/packages/icon/icon.react.stories.js +37 -0
- package/dist/packages/icon/icon.stories.d.ts +39 -0
- package/dist/packages/icon/icon.stories.js +43 -0
- package/dist/packages/icon/react.d.ts +2 -0
- package/dist/packages/{deadtoggle → icon}/react.js +3 -3
- package/dist/packages/icon/style.js +27 -0
- package/dist/packages/link/{index.js → link.js} +3 -3
- package/dist/packages/link/link.js.map +7 -0
- package/dist/packages/link/link.react.stories.d.ts +3 -3
- package/dist/packages/link/link.stories.d.ts +2 -2
- package/dist/packages/link/link.stories.js +1 -1
- package/dist/packages/link/link.test.d.ts +1 -1
- package/dist/packages/link/link.test.js +1 -1
- package/dist/packages/link/react.d.ts +1 -1
- package/dist/packages/link/react.js +1 -1
- package/dist/packages/link/styles.js +2 -2
- package/dist/packages/modal/index.d.ts +6 -3
- package/dist/packages/modal/index.js +10 -2717
- package/dist/packages/modal/{modal-main.js → modal.js} +1 -1
- package/dist/packages/modal/{modal-main.js.map → modal.js.map} +1 -1
- package/dist/packages/modal/modal.react.stories.d.ts +1 -1
- package/dist/packages/modal/modal.stories.d.ts +6 -3
- package/dist/packages/modal/modal.stories.js +3 -1
- package/dist/packages/modal/react.d.ts +3 -6
- package/dist/packages/modal/react.js +4 -15
- package/dist/packages/{modal → modal-footer}/modal-footer.d.ts +2 -2
- package/dist/packages/{modal → modal-footer}/modal-footer.js +4 -4
- package/dist/packages/modal-footer/modal-footer.js.map +7 -0
- package/dist/packages/modal-footer/react.d.ts +2 -0
- package/dist/packages/{stepindicator → modal-footer}/react.js +3 -8
- package/dist/packages/{modal → modal-header}/modal-header.d.ts +1 -1
- package/dist/packages/{modal → modal-header}/modal-header.js +7 -7
- package/dist/packages/modal-header/modal-header.js.map +7 -0
- package/dist/packages/modal-header/react.d.ts +5 -0
- package/dist/packages/{pagination → modal-header}/react.js +5 -5
- package/dist/packages/page-indicator/locales/da/messages.mjs +1 -0
- package/dist/packages/page-indicator/locales/en/messages.mjs +1 -0
- package/dist/packages/page-indicator/locales/fi/messages.mjs +1 -0
- package/dist/packages/page-indicator/locales/nb/messages.mjs +1 -0
- package/dist/packages/page-indicator/locales/sv/messages.mjs +1 -0
- package/dist/packages/page-indicator/page-indicator.d.ts +26 -0
- package/dist/packages/page-indicator/page-indicator.js +41 -0
- package/dist/packages/page-indicator/page-indicator.js.map +7 -0
- package/dist/packages/{pageindicator/pageindicator.react.stories.d.ts → page-indicator/page-indicator.react.stories.d.ts} +3 -3
- package/dist/packages/{pageindicator/pageindicator.stories.d.ts → page-indicator/page-indicator.stories.d.ts} +1 -1
- package/dist/packages/page-indicator/page-indicator.stories.js +87 -0
- package/dist/packages/page-indicator/page-indicator.test.d.ts +1 -0
- package/dist/packages/page-indicator/page-indicator.test.js +118 -0
- package/dist/packages/{pageindicator → page-indicator}/react.d.ts +1 -1
- package/dist/packages/{pageindicator → page-indicator}/react.js +2 -2
- package/dist/packages/{pageindicator → page-indicator}/style.js +4 -4
- package/dist/packages/pill/{index.js → pill.js} +9 -9
- package/dist/packages/pill/pill.js.map +7 -0
- package/dist/packages/pill/pill.react.stories.d.ts +4 -4
- package/dist/packages/pill/pill.stories.d.ts +2 -2
- package/dist/packages/pill/pill.stories.js +1 -1
- package/dist/packages/pill/pill.test.d.ts +1 -1
- package/dist/packages/pill/pill.test.js +1 -1
- package/dist/packages/pill/react.d.ts +1 -1
- package/dist/packages/pill/react.js +1 -1
- package/dist/packages/select/react.d.ts +1 -1
- package/dist/packages/select/react.js +1 -1
- package/dist/packages/select/{index.js → select.js} +16 -16
- package/dist/packages/select/select.js.map +7 -0
- package/dist/packages/select/select.react.stories.d.ts +4 -4
- package/dist/packages/select/select.react.stories.js +1 -1
- package/dist/packages/select/select.stories.d.ts +2 -2
- package/dist/packages/select/select.stories.js +1 -1
- package/dist/packages/select/select.test.d.ts +1 -1
- package/dist/packages/select/select.test.js +1 -1
- package/dist/packages/switch/react.d.ts +1 -1
- package/dist/packages/switch/react.js +1 -1
- package/dist/packages/switch/{index.js → switch.js} +1 -1
- package/dist/packages/switch/{index.js.map → switch.js.map} +1 -1
- package/dist/packages/switch/switch.react.stories.d.ts +1 -1
- package/dist/packages/switch/switch.stories.d.ts +1 -1
- package/dist/packages/switch/switch.stories.js +1 -1
- package/dist/packages/switch/switch.test.d.ts +1 -1
- package/dist/packages/switch/switch.test.js +2 -2
- package/dist/packages/tab/react.d.ts +7 -0
- package/dist/packages/tab/react.js +17 -0
- package/dist/packages/{tabs → tab}/tab.d.ts +2 -5
- package/dist/packages/tab/tab.js +2464 -0
- package/dist/packages/tab/tab.js.map +7 -0
- package/dist/packages/tab-panel/react.d.ts +2 -0
- package/dist/packages/tab-panel/react.js +11 -0
- package/dist/packages/{tabs → tab-panel}/tab-panel.d.ts +3 -3
- package/dist/packages/tab-panel/tab-panel.js +2441 -0
- package/dist/packages/tab-panel/tab-panel.js.map +7 -0
- package/dist/packages/tabs/index.d.ts +2 -3
- package/dist/packages/tabs/index.js +3 -2
- package/dist/packages/tabs/react.d.ts +3 -8
- package/dist/packages/tabs/react.js +4 -17
- package/dist/packages/tabs/tabs.d.ts +2 -5
- package/dist/packages/tabs/tabs.js +2447 -252
- package/dist/packages/tabs/tabs.js.map +7 -0
- package/dist/packages/tabs/tabs.react.stories.d.ts +14 -1
- package/dist/packages/tabs/tabs.react.stories.js +55 -35
- package/dist/packages/tabs/tabs.stories.d.ts +5 -4
- package/dist/packages/tabs/tabs.stories.js +89 -65
- package/dist/packages/textfield/react.d.ts +1 -1
- package/dist/packages/textfield/react.js +1 -1
- package/dist/packages/textfield/{index.js → textfield.js} +1 -1
- package/dist/packages/textfield/{index.js.map → textfield.js.map} +1 -1
- package/dist/packages/textfield/textfield.react.stories.d.ts +4 -4
- package/dist/packages/textfield/textfield.stories.d.ts +2 -2
- package/dist/packages/textfield/textfield.stories.js +1 -1
- package/dist/packages/textfield/textfield.test.d.ts +2 -2
- package/dist/packages/textfield/textfield.test.js +2 -2
- package/dist/packages/toast/index.d.ts +5 -3
- package/dist/packages/toast/index.js +7 -2483
- package/dist/packages/toast/toast.js +8 -8
- package/dist/packages/toast/toast.js.map +3 -3
- package/dist/packages/toast/toast.stories.d.ts +4 -3
- package/dist/packages/toast/toast.stories.js +3 -2
- package/dist/packages/{toast → toast-container}/toast-container.d.ts +1 -1
- package/dist/packages/toast-container/toast-container.js.map +7 -0
- package/dist/web-types.json +175 -38
- package/package.json +91 -38
- package/dist/packages/attention/index.js.map +0 -7
- package/dist/packages/breadcrumbs/index.js.map +0 -7
- package/dist/packages/button/index.js.map +0 -7
- package/dist/packages/card/index.js.map +0 -7
- package/dist/packages/checkbox/checkbox-group.d.ts +0 -10
- package/dist/packages/checkbox/checkbox-group.js +0 -15
- package/dist/packages/checkbox/checkbox.d.ts +0 -66
- package/dist/packages/checkbox/checkbox.js +0 -220
- package/dist/packages/checkbox/checkbox.react.stories.d.ts +0 -12
- package/dist/packages/checkbox/checkbox.react.stories.js +0 -10
- package/dist/packages/checkbox/checkbox.stories.d.ts +0 -11
- package/dist/packages/checkbox/checkbox.stories.js +0 -25
- package/dist/packages/checkbox/index.d.ts +0 -2
- package/dist/packages/checkbox/index.js +0 -2
- package/dist/packages/checkbox/react.d.ts +0 -7
- package/dist/packages/checkbox/react.js +0 -20
- package/dist/packages/checkbox/styles.d.ts +0 -0
- package/dist/packages/checkbox/styles.js +0 -0
- package/dist/packages/datepicker/index.d.ts +0 -1
- package/dist/packages/datepicker/index.js +0 -2785
- package/dist/packages/datepicker/index.js.map +0 -7
- package/dist/packages/deadtoggle/dead-toggle.react.stories.d.ts +0 -15
- package/dist/packages/deadtoggle/dead-toggle.react.stories.js +0 -34
- package/dist/packages/deadtoggle/dead-toggle.stories.d.ts +0 -14
- package/dist/packages/deadtoggle/dead-toggle.stories.js +0 -45
- package/dist/packages/deadtoggle/dead-toggle.test.d.ts +0 -1
- package/dist/packages/deadtoggle/dead-toggle.test.js +0 -9
- package/dist/packages/deadtoggle/index.d.ts +0 -17
- package/dist/packages/deadtoggle/index.js +0 -51
- package/dist/packages/deadtoggle/react.d.ts +0 -2
- package/dist/packages/link/index.js.map +0 -7
- package/dist/packages/modal/index.js.map +0 -7
- package/dist/packages/modal/modal-footer.js.map +0 -7
- package/dist/packages/modal/modal-header.js.map +0 -7
- package/dist/packages/pageindicator/index.d.ts +0 -10
- package/dist/packages/pageindicator/index.js +0 -48
- package/dist/packages/pageindicator/pageindicator.stories.js +0 -71
- package/dist/packages/pagination/index.d.ts +0 -32
- package/dist/packages/pagination/index.js +0 -199
- package/dist/packages/pagination/locales/da/messages.mjs +0 -1
- package/dist/packages/pagination/locales/en/messages.mjs +0 -1
- package/dist/packages/pagination/locales/fi/messages.mjs +0 -1
- package/dist/packages/pagination/locales/nb/messages.mjs +0 -1
- package/dist/packages/pagination/locales/sv/messages.mjs +0 -1
- package/dist/packages/pagination/pagination.react.stories.d.ts +0 -21
- package/dist/packages/pagination/pagination.react.stories.js +0 -45
- package/dist/packages/pagination/pagination.stories.d.ts +0 -14
- package/dist/packages/pagination/pagination.stories.js +0 -56
- package/dist/packages/pagination/pagination.test.d.ts +0 -1
- package/dist/packages/pagination/pagination.test.js +0 -76
- package/dist/packages/pagination/react.d.ts +0 -5
- package/dist/packages/pagination/styles.js +0 -2
- package/dist/packages/pill/index.js.map +0 -7
- package/dist/packages/radio/base-element.d.ts +0 -46
- package/dist/packages/radio/base-element.js +0 -100
- package/dist/packages/radio/custom-error-validator.d.ts +0 -6
- package/dist/packages/radio/custom-error-validator.js +0 -22
- package/dist/packages/radio/form-associated-element.d.ts +0 -103
- package/dist/packages/radio/form-associated-element.js +0 -282
- package/dist/packages/radio/host-styles.d.ts +0 -1
- package/dist/packages/radio/host-styles.js +0 -12
- package/dist/packages/radio/index.d.ts +0 -2
- package/dist/packages/radio/index.js +0 -2
- package/dist/packages/radio/invalid.d.ts +0 -8
- package/dist/packages/radio/invalid.js +0 -5
- package/dist/packages/radio/math.d.ts +0 -1
- package/dist/packages/radio/math.js +0 -4
- package/dist/packages/radio/radio-group-styles.d.ts +0 -1
- package/dist/packages/radio/radio-group-styles.js +0 -59
- package/dist/packages/radio/radio-group.d.ts +0 -72
- package/dist/packages/radio/radio-group.js +0 -342
- package/dist/packages/radio/radio-styles.d.ts +0 -0
- package/dist/packages/radio/radio-styles.js +0 -0
- package/dist/packages/radio/radio.d.ts +0 -38
- package/dist/packages/radio/radio.js +0 -115
- package/dist/packages/radio/radio.react.stories.d.ts +0 -9
- package/dist/packages/radio/radio.react.stories.js +0 -10
- package/dist/packages/radio/radio.stories.d.ts +0 -15
- package/dist/packages/radio/radio.stories.js +0 -61
- package/dist/packages/radio/react.d.ts +0 -9
- package/dist/packages/radio/react.js +0 -22
- package/dist/packages/radio/required-validator.d.ts +0 -11
- package/dist/packages/radio/required-validator.js +0 -34
- package/dist/packages/radio/slot.d.ts +0 -20
- package/dist/packages/radio/slot.js +0 -71
- package/dist/packages/radio/watch.d.ts +0 -26
- package/dist/packages/radio/watch.js +0 -39
- package/dist/packages/select/index.js.map +0 -7
- package/dist/packages/slider/Slider.d.ts +0 -2
- package/dist/packages/slider/Slider.js +0 -8
- package/dist/packages/slider/SliderThumb.d.ts +0 -2
- package/dist/packages/slider/SliderThumb.js +0 -8
- package/dist/packages/slider/index.d.ts +0 -2
- package/dist/packages/slider/index.js +0 -2
- package/dist/packages/slider/locales/da/messages.d.mts +0 -1
- package/dist/packages/slider/locales/da/messages.mjs +0 -1
- package/dist/packages/slider/locales/en/messages.d.mts +0 -1
- package/dist/packages/slider/locales/en/messages.mjs +0 -1
- package/dist/packages/slider/locales/fi/messages.d.mts +0 -1
- package/dist/packages/slider/locales/fi/messages.mjs +0 -1
- package/dist/packages/slider/locales/nb/messages.d.mts +0 -1
- package/dist/packages/slider/locales/nb/messages.mjs +0 -1
- package/dist/packages/slider/locales/sv/messages.d.mts +0 -1
- package/dist/packages/slider/locales/sv/messages.mjs +0 -1
- package/dist/packages/slider/oddbird-css-anchor-positioning.d.ts +0 -2
- package/dist/packages/slider/oddbird-css-anchor-positioning.js +0 -3
- package/dist/packages/slider/react.d.ts +0 -8
- package/dist/packages/slider/react.js +0 -20
- package/dist/packages/slider/slider-thumb.d.ts +0 -63
- package/dist/packages/slider/slider-thumb.js +0 -501
- package/dist/packages/slider/slider.d.ts +0 -55
- package/dist/packages/slider/slider.js +0 -301
- package/dist/packages/slider/slider.react.stories.d.ts +0 -19
- package/dist/packages/slider/slider.react.stories.js +0 -140
- package/dist/packages/slider/slider.stories.d.ts +0 -21
- package/dist/packages/slider/slider.stories.js +0 -404
- package/dist/packages/slider/slider.test.d.ts +0 -4
- package/dist/packages/slider/slider.test.js +0 -111
- package/dist/packages/slider/styles/w-slider-thumb.styles.d.ts +0 -1
- package/dist/packages/slider/styles/w-slider-thumb.styles.js +0 -175
- package/dist/packages/slider/styles/w-slider.styles.d.ts +0 -1
- package/dist/packages/slider/styles/w-slider.styles.js +0 -148
- package/dist/packages/slider/styles.d.ts +0 -1
- package/dist/packages/slider/styles.js +0 -2
- package/dist/packages/stepindicator/index.d.ts +0 -37
- package/dist/packages/stepindicator/index.js +0 -195
- package/dist/packages/stepindicator/locales/da/messages.d.mts +0 -1
- package/dist/packages/stepindicator/locales/da/messages.mjs +0 -1
- package/dist/packages/stepindicator/locales/en/messages.d.mts +0 -1
- package/dist/packages/stepindicator/locales/en/messages.mjs +0 -1
- package/dist/packages/stepindicator/locales/fi/messages.d.mts +0 -1
- package/dist/packages/stepindicator/locales/fi/messages.mjs +0 -1
- package/dist/packages/stepindicator/locales/nb/messages.d.mts +0 -1
- package/dist/packages/stepindicator/locales/nb/messages.mjs +0 -1
- package/dist/packages/stepindicator/locales/sv/messages.d.mts +0 -1
- package/dist/packages/stepindicator/locales/sv/messages.mjs +0 -1
- package/dist/packages/stepindicator/react.d.ts +0 -3
- package/dist/packages/stepindicator/stepindicator.react.stories.d.ts +0 -15
- package/dist/packages/stepindicator/stepindicator.react.stories.js +0 -112
- package/dist/packages/stepindicator/stepindicator.stories.d.ts +0 -12
- package/dist/packages/stepindicator/stepindicator.stories.js +0 -172
- package/dist/packages/stepindicator/styles.d.ts +0 -1
- package/dist/packages/stepindicator/styles.js +0 -2
- package/dist/packages/tabs/tab-panel.js +0 -51
- package/dist/packages/tabs/tab.js +0 -104
- package/dist/packages/textarea/index.d.ts +0 -1
- package/dist/packages/textarea/index.js +0 -1
- package/dist/packages/textarea/locales/da/messages.d.mts +0 -1
- package/dist/packages/textarea/locales/da/messages.mjs +0 -1
- package/dist/packages/textarea/locales/en/messages.d.mts +0 -1
- package/dist/packages/textarea/locales/en/messages.mjs +0 -1
- package/dist/packages/textarea/locales/fi/messages.d.mts +0 -1
- package/dist/packages/textarea/locales/fi/messages.mjs +0 -1
- package/dist/packages/textarea/locales/nb/messages.d.mts +0 -1
- package/dist/packages/textarea/locales/nb/messages.mjs +0 -1
- package/dist/packages/textarea/locales/sv/messages.d.mts +0 -1
- package/dist/packages/textarea/locales/sv/messages.mjs +0 -1
- package/dist/packages/textarea/react.d.ts +0 -11
- package/dist/packages/textarea/react.js +0 -21
- package/dist/packages/textarea/styles.d.ts +0 -1
- package/dist/packages/textarea/styles.js +0 -2
- package/dist/packages/textarea/textarea.d.ts +0 -49
- package/dist/packages/textarea/textarea.js +0 -220
- package/dist/packages/textarea/textarea.react.stories.d.ts +0 -33
- package/dist/packages/textarea/textarea.react.stories.js +0 -41
- package/dist/packages/textarea/textarea.stories.d.ts +0 -19
- package/dist/packages/textarea/textarea.stories.js +0 -85
- package/dist/packages/textarea/textarea.test.d.ts +0 -1
- package/dist/packages/textarea/textarea.test.js +0 -68
- package/dist/packages/toast/index.js.map +0 -7
- package/dist/packages/toast/toast-container.js.map +0 -7
- package/dist/packages/toggle-styles.d.ts +0 -1
- package/dist/packages/toggle-styles.js +0 -108
- /package/dist/packages/affix/{index.d.ts → affix.d.ts} +0 -0
- /package/dist/packages/alert/{index.d.ts → alert.d.ts} +0 -0
- /package/dist/packages/badge/{index.d.ts → badge.d.ts} +0 -0
- /package/dist/packages/box/{index.d.ts → box.d.ts} +0 -0
- /package/dist/packages/breadcrumbs/{index.d.ts → breadcrumbs.d.ts} +0 -0
- /package/dist/packages/card/{index.d.ts → card.d.ts} +0 -0
- /package/dist/packages/combobox/{index.d.ts → combobox.d.ts} +0 -0
- /package/dist/packages/expandable/{index.d.ts → expandable.d.ts} +0 -0
- /package/dist/packages/{pageindicator → icon}/style.d.ts +0 -0
- /package/dist/packages/link/{index.d.ts → link.d.ts} +0 -0
- /package/dist/packages/modal/{modal-main.d.ts → modal.d.ts} +0 -0
- /package/dist/packages/{pagination → page-indicator}/locales/da/messages.d.mts +0 -0
- /package/dist/packages/{pagination → page-indicator}/locales/en/messages.d.mts +0 -0
- /package/dist/packages/{pagination → page-indicator}/locales/fi/messages.d.mts +0 -0
- /package/dist/packages/{pagination → page-indicator}/locales/nb/messages.d.mts +0 -0
- /package/dist/packages/{pagination → page-indicator}/locales/sv/messages.d.mts +0 -0
- /package/dist/packages/{pageindicator/pageindicator.react.stories.js → page-indicator/page-indicator.react.stories.js} +0 -0
- /package/dist/packages/{pagination/styles.d.ts → page-indicator/style.d.ts} +0 -0
- /package/dist/packages/pill/{index.d.ts → pill.d.ts} +0 -0
- /package/dist/packages/select/{index.d.ts → select.d.ts} +0 -0
- /package/dist/packages/switch/{index.d.ts → switch.d.ts} +0 -0
- /package/dist/packages/textfield/{index.d.ts → textfield.d.ts} +0 -0
- /package/dist/packages/{toast → toast-container}/toast-container.js +0 -0
|
@@ -1,342 +0,0 @@
|
|
|
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 { html } from 'lit';
|
|
8
|
-
import { property, query, state } from 'lit/decorators.js';
|
|
9
|
-
import { classMap } from 'lit/directives/class-map.js';
|
|
10
|
-
import { BaseFormAssociatedElement } from './form-associated-element';
|
|
11
|
-
import { uniqueId } from './math';
|
|
12
|
-
import './radio';
|
|
13
|
-
// eslint-disable-next-line
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
import { styles } from './radio-group-styles';
|
|
16
|
-
import { RequiredValidator } from './required-validator';
|
|
17
|
-
import { HasSlotController } from './slot';
|
|
18
|
-
/**
|
|
19
|
-
* @slot label - Alternative to the `label` attribute should you need custom HTML.
|
|
20
|
-
*/
|
|
21
|
-
export class WRadioGroup extends BaseFormAssociatedElement {
|
|
22
|
-
static { this.css = [styles]; }
|
|
23
|
-
static get validators() {
|
|
24
|
-
const validators = [
|
|
25
|
-
RequiredValidator({
|
|
26
|
-
validationElement: Object.assign(document.createElement('input'), {
|
|
27
|
-
required: true,
|
|
28
|
-
type: 'radio',
|
|
29
|
-
// we need an id that's guaranteed to be unique; users will never see this
|
|
30
|
-
name: uniqueId('__w-radio'),
|
|
31
|
-
}),
|
|
32
|
-
}),
|
|
33
|
-
];
|
|
34
|
-
return [...super.validators, ...validators];
|
|
35
|
-
}
|
|
36
|
-
get value() {
|
|
37
|
-
if (this.valueHasChanged) {
|
|
38
|
-
return this._value;
|
|
39
|
-
}
|
|
40
|
-
return this._value ?? this.defaultValue;
|
|
41
|
-
}
|
|
42
|
-
/** The current value of the radio group, submitted as a name/value pair with form data. */
|
|
43
|
-
set value(val) {
|
|
44
|
-
if (typeof val === 'number')
|
|
45
|
-
val = String(val);
|
|
46
|
-
this.valueHasChanged = true;
|
|
47
|
-
this._value = val;
|
|
48
|
-
}
|
|
49
|
-
//
|
|
50
|
-
// We need this because if we don't have it, FormValidation yells at us that it's "not focusable".
|
|
51
|
-
// If we use `this.tabIndex = -1` we can't focus the radio inside.
|
|
52
|
-
//
|
|
53
|
-
static { this.shadowRootOptions = { ...BaseFormAssociatedElement.shadowRootOptions, delegatesFocus: true }; }
|
|
54
|
-
constructor() {
|
|
55
|
-
super();
|
|
56
|
-
this.hasSlotController = new HasSlotController(this, 'hint', 'label');
|
|
57
|
-
this.hasRadioButtons = false;
|
|
58
|
-
/**
|
|
59
|
-
* The radio group's label. Required for proper accessibility. If you need to display HTML, use the `label` slot
|
|
60
|
-
* instead.
|
|
61
|
-
*/
|
|
62
|
-
this.label = '';
|
|
63
|
-
/** The radio groups's hint. If you need to display HTML, use the `hint` slot instead. */
|
|
64
|
-
this.hint = '';
|
|
65
|
-
/** The name of the radio group, submitted as a name/value pair with form data. */
|
|
66
|
-
this.name = null;
|
|
67
|
-
/** Disables the radio group and all child radios. */
|
|
68
|
-
this.disabled = false;
|
|
69
|
-
/** The orientation in which to show radio items. */
|
|
70
|
-
this.orientation = 'vertical';
|
|
71
|
-
this._value = null;
|
|
72
|
-
/** The default value of the form control. Primarily used for resetting the form control. */
|
|
73
|
-
this.defaultValue = this.getAttribute('value') || null;
|
|
74
|
-
/** The radio group's size. This size will be applied to all child radios and radio buttons, except when explicitly overridden. */
|
|
75
|
-
this.size = 'medium';
|
|
76
|
-
/** Ensures a child radio is checked before allowing the containing form to submit. */
|
|
77
|
-
this.required = false;
|
|
78
|
-
/**
|
|
79
|
-
* Used for SSR. if true, will show slotted label on initial render.
|
|
80
|
-
*/
|
|
81
|
-
this.withLabel = false;
|
|
82
|
-
/**
|
|
83
|
-
* Used for SSR. if true, will show slotted hint on initial render.
|
|
84
|
-
*/
|
|
85
|
-
this.withHint = false;
|
|
86
|
-
this.handleRadioClick = (e) => {
|
|
87
|
-
const clickedRadio = e.target.closest('w-radio');
|
|
88
|
-
/* eslint-disable */
|
|
89
|
-
if (!clickedRadio || clickedRadio.disabled || clickedRadio.forceDisabled || this.disabled) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const oldValue = this.value;
|
|
93
|
-
this.value = clickedRadio.value;
|
|
94
|
-
clickedRadio.checked = true;
|
|
95
|
-
const radios = this.getAllRadios();
|
|
96
|
-
for (const radio of radios) {
|
|
97
|
-
if (clickedRadio === radio) {
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
radio.checked = false;
|
|
101
|
-
radio.setAttribute('tabindex', '-1');
|
|
102
|
-
}
|
|
103
|
-
if (this.value !== oldValue) {
|
|
104
|
-
this.updateComplete.then(() => {
|
|
105
|
-
this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));
|
|
106
|
-
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
this.addEventListener('keydown', this.handleKeyDown);
|
|
111
|
-
this.addEventListener('click', this.handleRadioClick);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* We use the first available radio as the validationTarget similar to native HTML that shows the validation popup on
|
|
115
|
-
* the first radio element.
|
|
116
|
-
*/
|
|
117
|
-
get validationTarget() {
|
|
118
|
-
const radio = this.querySelector(':is(w-radio):not([disabled])');
|
|
119
|
-
if (!radio)
|
|
120
|
-
return undefined;
|
|
121
|
-
return radio;
|
|
122
|
-
}
|
|
123
|
-
updated(changedProperties) {
|
|
124
|
-
if (changedProperties.has('disabled') || changedProperties.has('value')) {
|
|
125
|
-
this.syncRadioElements();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
formResetCallback(...args) {
|
|
129
|
-
this.value = this.defaultValue;
|
|
130
|
-
super.formResetCallback(...args);
|
|
131
|
-
this.syncRadioElements();
|
|
132
|
-
}
|
|
133
|
-
getAllRadios() {
|
|
134
|
-
return [...this.querySelectorAll('w-radio')];
|
|
135
|
-
}
|
|
136
|
-
handleLabelClick() {
|
|
137
|
-
this.focus();
|
|
138
|
-
}
|
|
139
|
-
async syncRadioElements() {
|
|
140
|
-
const radios = this.getAllRadios();
|
|
141
|
-
let hasRadioButtons = false;
|
|
142
|
-
// Add data attributes to support styling
|
|
143
|
-
radios.forEach((radio, index) => {
|
|
144
|
-
if (radio.appearance === 'button')
|
|
145
|
-
hasRadioButtons = true;
|
|
146
|
-
radio.setAttribute('size', this.size);
|
|
147
|
-
radio.toggleAttribute('data-w-radio-horizontal', this.orientation !== 'vertical');
|
|
148
|
-
radio.toggleAttribute('data-w-radio-vertical', this.orientation === 'vertical');
|
|
149
|
-
radio.toggleAttribute('data-w-radio-first', index === 0);
|
|
150
|
-
radio.toggleAttribute('data-w-radio-inner', index !== 0 && index !== radios.length - 1);
|
|
151
|
-
radio.toggleAttribute('data-w-radio-last', index === radios.length - 1);
|
|
152
|
-
// Set forceDisabled state based on radio group's disabled state
|
|
153
|
-
radio.forceDisabled = this.disabled;
|
|
154
|
-
});
|
|
155
|
-
// If at least one radio button exists, we assume it's a radio button group
|
|
156
|
-
this.hasRadioButtons = hasRadioButtons;
|
|
157
|
-
await Promise.all(radios.map(async (radio) => {
|
|
158
|
-
await radio.updateComplete;
|
|
159
|
-
if (!radio.disabled && radio.value === this.value) {
|
|
160
|
-
radio.checked = true;
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
radio.checked = false;
|
|
164
|
-
}
|
|
165
|
-
}));
|
|
166
|
-
// Manage tabIndex based on disabled state and checked status
|
|
167
|
-
if (this.disabled) {
|
|
168
|
-
// If radio group is disabled, all radios should not be tabbable
|
|
169
|
-
radios.forEach((radio) => {
|
|
170
|
-
radio.tabIndex = -1;
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
// Normal tabbing behavior
|
|
175
|
-
const enabledRadios = radios.filter((radio) => !radio.disabled);
|
|
176
|
-
const checkedRadio = enabledRadios.find((radio) => radio.checked);
|
|
177
|
-
if (enabledRadios.length > 0) {
|
|
178
|
-
if (checkedRadio) {
|
|
179
|
-
// If there's a checked radio, it should be tabbable
|
|
180
|
-
enabledRadios.forEach((radio) => {
|
|
181
|
-
radio.tabIndex = radio.checked ? 0 : -1;
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
// If no radio is checked, first enabled radio should be tabbable
|
|
186
|
-
enabledRadios.forEach((radio, index) => {
|
|
187
|
-
radio.tabIndex = index === 0 ? 0 : -1;
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
// Disabled radios should never be tabbable
|
|
192
|
-
radios
|
|
193
|
-
.filter((radio) => radio.disabled)
|
|
194
|
-
.forEach((radio) => {
|
|
195
|
-
radio.tabIndex = -1;
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
handleKeyDown(event) {
|
|
200
|
-
if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', ' '].includes(event.key) || this.disabled) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
const radios = this.getAllRadios().filter((radio) => !radio.disabled);
|
|
204
|
-
if (radios.length <= 0) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
event.preventDefault();
|
|
208
|
-
const oldValue = this.value;
|
|
209
|
-
const checkedRadio = radios.find((radio) => radio.checked) ?? radios[0];
|
|
210
|
-
const incr = event.key === ' ' ? 0 : ['ArrowUp', 'ArrowLeft'].includes(event.key) ? -1 : 1;
|
|
211
|
-
let index = radios.indexOf(checkedRadio) + incr;
|
|
212
|
-
if (!index)
|
|
213
|
-
index = 0;
|
|
214
|
-
if (index < 0) {
|
|
215
|
-
index = radios.length - 1;
|
|
216
|
-
}
|
|
217
|
-
if (index > radios.length - 1) {
|
|
218
|
-
index = 0;
|
|
219
|
-
}
|
|
220
|
-
const hasRadioButtons = radios.some((radio) => radio.tagName.toLowerCase() === 'w-radio-button');
|
|
221
|
-
this.getAllRadios().forEach((radio) => {
|
|
222
|
-
radio.checked = false;
|
|
223
|
-
if (!hasRadioButtons) {
|
|
224
|
-
radio.setAttribute('tabindex', '-1');
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
this.value = radios[index].value;
|
|
228
|
-
radios[index].checked = true;
|
|
229
|
-
if (!hasRadioButtons) {
|
|
230
|
-
radios[index].setAttribute('tabindex', '0');
|
|
231
|
-
radios[index].focus();
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
radios[index].shadowRoot?.querySelector('button')?.focus();
|
|
235
|
-
}
|
|
236
|
-
if (this.value !== oldValue) {
|
|
237
|
-
this.updateComplete.then(() => {
|
|
238
|
-
this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));
|
|
239
|
-
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
event.preventDefault();
|
|
243
|
-
}
|
|
244
|
-
/** Sets focus on the radio group. */
|
|
245
|
-
focus(options) {
|
|
246
|
-
if (this.disabled)
|
|
247
|
-
return;
|
|
248
|
-
const radios = this.getAllRadios();
|
|
249
|
-
const checked = radios.find((radio) => radio.checked);
|
|
250
|
-
const firstEnabledRadio = radios.find((radio) => !radio.disabled);
|
|
251
|
-
const radioToFocus = checked || firstEnabledRadio;
|
|
252
|
-
// Call focus for the checked radio. If no radio is checked, focus the first one that isn't disabled.
|
|
253
|
-
if (radioToFocus) {
|
|
254
|
-
radioToFocus.focus(options);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
render() {
|
|
258
|
-
const hasLabelSlot = this.hasUpdated ? this.hasSlotController.test('label') : this.withLabel;
|
|
259
|
-
const hasHintSlot = this.hasUpdated ? this.hasSlotController.test('hint') : this.withHint;
|
|
260
|
-
const hasLabel = this.label ? true : !!hasLabelSlot;
|
|
261
|
-
const hasHint = this.hint ? true : !!hasHintSlot;
|
|
262
|
-
return html `
|
|
263
|
-
<fieldset
|
|
264
|
-
part="form-control"
|
|
265
|
-
class=${classMap({
|
|
266
|
-
'form-control': true,
|
|
267
|
-
'form-control-radio-group': true,
|
|
268
|
-
'form-control-has-label': hasLabel,
|
|
269
|
-
'has-radio-buttons': this.hasRadioButtons,
|
|
270
|
-
})}
|
|
271
|
-
role="radiogroup"
|
|
272
|
-
aria-labelledby="label"
|
|
273
|
-
aria-describedby="hint"
|
|
274
|
-
aria-errormessage="error-message"
|
|
275
|
-
aria-orientation=${this.orientation}>
|
|
276
|
-
<label
|
|
277
|
-
part="form-control-label"
|
|
278
|
-
id="label"
|
|
279
|
-
class="label"
|
|
280
|
-
aria-hidden=${hasLabel ? 'false' : 'true'}
|
|
281
|
-
@click=${this.handleLabelClick}>
|
|
282
|
-
<slot name="label">${this.label}</slot>
|
|
283
|
-
</label>
|
|
284
|
-
|
|
285
|
-
<slot part="form-control-input" @slotchange=${this.syncRadioElements}></slot>
|
|
286
|
-
|
|
287
|
-
<slot
|
|
288
|
-
id="hint"
|
|
289
|
-
name="hint"
|
|
290
|
-
part="hint"
|
|
291
|
-
class=${classMap({
|
|
292
|
-
'has-slotted': hasHint,
|
|
293
|
-
})}
|
|
294
|
-
aria-hidden=${hasHint ? 'false' : 'true'}
|
|
295
|
-
>${this.hint}</slot
|
|
296
|
-
>
|
|
297
|
-
</fieldset>
|
|
298
|
-
`;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
__decorate([
|
|
302
|
-
state()
|
|
303
|
-
], WRadioGroup.prototype, "hasRadioButtons", void 0);
|
|
304
|
-
__decorate([
|
|
305
|
-
query('slot:not([name])')
|
|
306
|
-
], WRadioGroup.prototype, "defaultSlot", void 0);
|
|
307
|
-
__decorate([
|
|
308
|
-
property()
|
|
309
|
-
], WRadioGroup.prototype, "label", void 0);
|
|
310
|
-
__decorate([
|
|
311
|
-
property({ attribute: 'hint' })
|
|
312
|
-
], WRadioGroup.prototype, "hint", void 0);
|
|
313
|
-
__decorate([
|
|
314
|
-
property({ reflect: true })
|
|
315
|
-
], WRadioGroup.prototype, "name", void 0);
|
|
316
|
-
__decorate([
|
|
317
|
-
property({ type: Boolean, reflect: true })
|
|
318
|
-
], WRadioGroup.prototype, "disabled", void 0);
|
|
319
|
-
__decorate([
|
|
320
|
-
property({ reflect: true })
|
|
321
|
-
], WRadioGroup.prototype, "orientation", void 0);
|
|
322
|
-
__decorate([
|
|
323
|
-
state()
|
|
324
|
-
], WRadioGroup.prototype, "value", null);
|
|
325
|
-
__decorate([
|
|
326
|
-
property({ attribute: 'value', reflect: true })
|
|
327
|
-
], WRadioGroup.prototype, "defaultValue", void 0);
|
|
328
|
-
__decorate([
|
|
329
|
-
property({ reflect: true })
|
|
330
|
-
], WRadioGroup.prototype, "size", void 0);
|
|
331
|
-
__decorate([
|
|
332
|
-
property({ type: Boolean, reflect: true })
|
|
333
|
-
], WRadioGroup.prototype, "required", void 0);
|
|
334
|
-
__decorate([
|
|
335
|
-
property({ type: Boolean, attribute: 'with-label' })
|
|
336
|
-
], WRadioGroup.prototype, "withLabel", void 0);
|
|
337
|
-
__decorate([
|
|
338
|
-
property({ type: Boolean, attribute: 'with-hint' })
|
|
339
|
-
], WRadioGroup.prototype, "withHint", void 0);
|
|
340
|
-
if (!customElements.get('w-radio-group')) {
|
|
341
|
-
customElements.define('w-radio-group', WRadioGroup);
|
|
342
|
-
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { PropertyValues } from 'lit';
|
|
2
|
-
import { BaseFormAssociatedElement } from './form-associated-element';
|
|
3
|
-
export declare class WRadio extends BaseFormAssociatedElement {
|
|
4
|
-
static css: import("lit").CSSResult[];
|
|
5
|
-
checked: boolean;
|
|
6
|
-
/** @internal Used by radio group to force disable radios while preserving their original disabled state. */
|
|
7
|
-
forceDisabled: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* The string pointing to a form's id.
|
|
10
|
-
*/
|
|
11
|
-
form: string | null;
|
|
12
|
-
/** The radio's value. When selected, the radio group will receive this value. */
|
|
13
|
-
value: string;
|
|
14
|
-
/** The radio's value. When selected, the radio group will receive this value. */
|
|
15
|
-
appearance: 'default' | 'button' | 'clickable';
|
|
16
|
-
/**
|
|
17
|
-
* The radio's size. When used inside a radio group, the size will be determined by the radio group's size so this
|
|
18
|
-
* attribute can typically be omitted.
|
|
19
|
-
*/
|
|
20
|
-
size: 'small' | 'medium' | 'large';
|
|
21
|
-
/** Disables the radio. */
|
|
22
|
-
disabled: boolean;
|
|
23
|
-
constructor();
|
|
24
|
-
connectedCallback(): void;
|
|
25
|
-
private setInitialAttributes;
|
|
26
|
-
updated(changedProperties: PropertyValues<this>): void;
|
|
27
|
-
/**
|
|
28
|
-
* @override
|
|
29
|
-
*/
|
|
30
|
-
setValue(): void;
|
|
31
|
-
private handleClick;
|
|
32
|
-
render(): import("lit").TemplateResult<1>;
|
|
33
|
-
}
|
|
34
|
-
declare global {
|
|
35
|
-
interface HTMLElementTagNameMap {
|
|
36
|
-
'w-radio': WRadio;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
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 { html } from 'lit';
|
|
8
|
-
import { property, state } from 'lit/decorators.js';
|
|
9
|
-
import { BaseFormAssociatedElement } from './form-associated-element';
|
|
10
|
-
// eslint-disable-next-line
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
import { toggleStyles } from '../toggle-styles';
|
|
13
|
-
import { reset } from '../styles';
|
|
14
|
-
export class WRadio extends BaseFormAssociatedElement {
|
|
15
|
-
static { this.css = [reset, toggleStyles]; }
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
this.checked = false;
|
|
19
|
-
/** @internal Used by radio group to force disable radios while preserving their original disabled state. */
|
|
20
|
-
this.forceDisabled = false;
|
|
21
|
-
/**
|
|
22
|
-
* The string pointing to a form's id.
|
|
23
|
-
*/
|
|
24
|
-
this.form = null;
|
|
25
|
-
/** The radio's value. When selected, the radio group will receive this value. */
|
|
26
|
-
this.appearance = 'default';
|
|
27
|
-
/**
|
|
28
|
-
* The radio's size. When used inside a radio group, the size will be determined by the radio group's size so this
|
|
29
|
-
* attribute can typically be omitted.
|
|
30
|
-
*/
|
|
31
|
-
this.size = 'medium';
|
|
32
|
-
/** Disables the radio. */
|
|
33
|
-
this.disabled = false;
|
|
34
|
-
// Update the handleClick method (around line 75)
|
|
35
|
-
this.handleClick = () => {
|
|
36
|
-
if (!this.disabled && !this.forceDisabled) {
|
|
37
|
-
this.checked = true;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
this.addEventListener('click', this.handleClick);
|
|
41
|
-
}
|
|
42
|
-
connectedCallback() {
|
|
43
|
-
super.connectedCallback();
|
|
44
|
-
this.setInitialAttributes();
|
|
45
|
-
}
|
|
46
|
-
setInitialAttributes() {
|
|
47
|
-
this.setAttribute('role', 'radio');
|
|
48
|
-
this.tabIndex = 0;
|
|
49
|
-
this.setAttribute('aria-disabled', this.disabled || this.forceDisabled ? 'true' : 'false');
|
|
50
|
-
}
|
|
51
|
-
updated(changedProperties) {
|
|
52
|
-
super.updated(changedProperties);
|
|
53
|
-
if (changedProperties.has('checked')) {
|
|
54
|
-
this.customStates.set('checked', this.checked);
|
|
55
|
-
this[this.checked ? 'setAttribute' : 'removeAttribute']('checked-ui', '');
|
|
56
|
-
this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
|
|
57
|
-
// Only set tabIndex if not disabled
|
|
58
|
-
if (!this.disabled && !this.forceDisabled) {
|
|
59
|
-
this.tabIndex = this.checked ? 0 : -1;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (changedProperties.has('disabled') || changedProperties.has('forceDisabled')) {
|
|
63
|
-
const effectivelyDisabled = this.disabled || this.forceDisabled;
|
|
64
|
-
this.customStates.set('disabled', effectivelyDisabled);
|
|
65
|
-
this[effectivelyDisabled ? 'setAttribute' : 'removeAttribute']('disabled-ui', '');
|
|
66
|
-
this.setAttribute('aria-disabled', effectivelyDisabled ? 'true' : 'false');
|
|
67
|
-
// Set tabIndex based on disabled state
|
|
68
|
-
if (effectivelyDisabled) {
|
|
69
|
-
this.tabIndex = -1;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
// Restore proper tabIndex - this will be managed by the radio group
|
|
73
|
-
this.tabIndex = this.checked ? 0 : -1;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* @override
|
|
79
|
-
*/
|
|
80
|
-
setValue() {
|
|
81
|
-
// We override `setValue` because we don't want to set form values from here. We want to do that in "RadioGroup" itself.
|
|
82
|
-
}
|
|
83
|
-
render() {
|
|
84
|
-
return html `
|
|
85
|
-
<div class="wrapper">
|
|
86
|
-
<div part="control" class="control"></div>
|
|
87
|
-
<slot part="label" class="label"></slot>
|
|
88
|
-
</div>
|
|
89
|
-
`;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
__decorate([
|
|
93
|
-
state()
|
|
94
|
-
], WRadio.prototype, "checked", void 0);
|
|
95
|
-
__decorate([
|
|
96
|
-
state()
|
|
97
|
-
], WRadio.prototype, "forceDisabled", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
property({ reflect: true })
|
|
100
|
-
], WRadio.prototype, "form", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
property({ reflect: true })
|
|
103
|
-
], WRadio.prototype, "value", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
property({ reflect: true })
|
|
106
|
-
], WRadio.prototype, "appearance", void 0);
|
|
107
|
-
__decorate([
|
|
108
|
-
property({ reflect: true })
|
|
109
|
-
], WRadio.prototype, "size", void 0);
|
|
110
|
-
__decorate([
|
|
111
|
-
property({ type: Boolean })
|
|
112
|
-
], WRadio.prototype, "disabled", void 0);
|
|
113
|
-
if (!customElements.get('w-radio')) {
|
|
114
|
-
customElements.define('w-radio', WRadio);
|
|
115
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/react';
|
|
2
|
-
import { Radio } from './react';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: import("@lit/react").ReactWebComponent<import("./radio").WRadio, {}>;
|
|
6
|
-
};
|
|
7
|
-
export default _default;
|
|
8
|
-
export type Story = StoryObj<typeof Radio>;
|
|
9
|
-
export declare const Primary: Story;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
-
import type { WRadioGroup } from './radio-group.js';
|
|
3
|
-
import './radio';
|
|
4
|
-
import './radio-group';
|
|
5
|
-
declare const args: Partial<WRadioGroup> & {
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
};
|
|
8
|
-
declare const meta: Meta<typeof args>;
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof args>;
|
|
11
|
-
export declare const Default: Story;
|
|
12
|
-
export declare const Disabled: Story;
|
|
13
|
-
export declare const Required: Story;
|
|
14
|
-
export declare const DisabledGroup: Story;
|
|
15
|
-
export declare const DisabledRadio: Story;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { spread } from '@open-wc/lit-helpers';
|
|
2
|
-
import { getStorybookHelpers } from '@wc-toolkit/storybook-helpers';
|
|
3
|
-
import { html } from 'lit';
|
|
4
|
-
import { prespread } from '../../.storybook/utilities.js';
|
|
5
|
-
import './radio';
|
|
6
|
-
import './radio-group';
|
|
7
|
-
const { events: radioEvents, args: radioArgs, argTypes: radioArgTypes } = getStorybookHelpers('w-radio');
|
|
8
|
-
const { events, args, argTypes } = getStorybookHelpers('w-radio-group');
|
|
9
|
-
const meta = {
|
|
10
|
-
title: 'Forms/Radio',
|
|
11
|
-
render: (args) => {
|
|
12
|
-
return html `
|
|
13
|
-
<w-radio-group ${spread(prespread(args))}>
|
|
14
|
-
<w-radio value="foo">foo</w-radio>
|
|
15
|
-
<w-radio value="bar">bar</w-radio>
|
|
16
|
-
</w-radio-group>
|
|
17
|
-
`;
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
export default meta;
|
|
21
|
-
export const Default = {
|
|
22
|
-
args: {
|
|
23
|
-
label: 'Group',
|
|
24
|
-
name: 'foobar',
|
|
25
|
-
value: 'foo',
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
export const Disabled = {
|
|
29
|
-
args: {
|
|
30
|
-
label: 'Disabled',
|
|
31
|
-
disabled: true,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
export const Required = {
|
|
35
|
-
args: {},
|
|
36
|
-
render() {
|
|
37
|
-
return html `
|
|
38
|
-
<form>
|
|
39
|
-
<w-radio-group required>
|
|
40
|
-
<w-radio value="foo">foo</w-radio>
|
|
41
|
-
<w-radio value="bar">bar</w-radio>
|
|
42
|
-
</w-radio-group>
|
|
43
|
-
<button>click me</button>
|
|
44
|
-
</form>
|
|
45
|
-
`;
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
export const DisabledGroup = {
|
|
49
|
-
args: { disabled: true },
|
|
50
|
-
};
|
|
51
|
-
export const DisabledRadio = {
|
|
52
|
-
args: {},
|
|
53
|
-
render() {
|
|
54
|
-
return html `
|
|
55
|
-
<w-radio-group>
|
|
56
|
-
<w-radio value="foo" disabled appearance="button">disabled</w-radio>
|
|
57
|
-
<w-radio value="bar" appearance="clickable">not disabled</w-radio>
|
|
58
|
-
</w-radio-group>
|
|
59
|
-
`;
|
|
60
|
-
},
|
|
61
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { WRadio } from './radio.js';
|
|
2
|
-
import { WRadioGroup } from './radio-group.js';
|
|
3
|
-
export declare const Radio: import("@lit/react").ReactWebComponent<WRadio, {}>;
|
|
4
|
-
export declare const RadioGroup: import("@lit/react").ReactWebComponent<WRadioGroup, {
|
|
5
|
-
onInput: string;
|
|
6
|
-
oninput: string;
|
|
7
|
-
onChange: string;
|
|
8
|
-
onchange: string;
|
|
9
|
-
}>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { createComponent } from '@lit/react';
|
|
4
|
-
// decouple from CDN by providing a dummy class
|
|
5
|
-
class Component extends LitElement {
|
|
6
|
-
}
|
|
7
|
-
export const Radio = createComponent({
|
|
8
|
-
tagName: 'w-radio',
|
|
9
|
-
elementClass: Component,
|
|
10
|
-
react: React,
|
|
11
|
-
});
|
|
12
|
-
export const RadioGroup = createComponent({
|
|
13
|
-
tagName: 'w-radio-group',
|
|
14
|
-
elementClass: Component,
|
|
15
|
-
react: React,
|
|
16
|
-
events: {
|
|
17
|
-
onInput: 'input',
|
|
18
|
-
oninput: 'input',
|
|
19
|
-
onChange: 'change',
|
|
20
|
-
onchange: 'change',
|
|
21
|
-
},
|
|
22
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Validator } from './form-associated-element';
|
|
2
|
-
export interface RequiredValidatorOptions {
|
|
3
|
-
/** This is a cheap way for us to get translation strings for the user without having proper translations. */
|
|
4
|
-
validationElement?: HTMLSelectElement | HTMLInputElement;
|
|
5
|
-
/**
|
|
6
|
-
* The property to check if its not null-ish. For most elements this will be "value".
|
|
7
|
-
* For "checkbox" for example it will be "checked"
|
|
8
|
-
*/
|
|
9
|
-
validationProperty?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare const RequiredValidator: (options?: RequiredValidatorOptions) => Validator;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const RequiredValidator = (options = {}) => {
|
|
2
|
-
let { validationElement, validationProperty } = options;
|
|
3
|
-
if (!validationElement) {
|
|
4
|
-
validationElement = Object.assign(document.createElement('input'), { required: true });
|
|
5
|
-
}
|
|
6
|
-
if (!validationProperty) {
|
|
7
|
-
validationProperty = 'value';
|
|
8
|
-
}
|
|
9
|
-
const obj = {
|
|
10
|
-
observedAttributes: ['required'],
|
|
11
|
-
message: validationElement.validationMessage, // @TODO: Add a translation.
|
|
12
|
-
checkValidity(element) {
|
|
13
|
-
const validity = {
|
|
14
|
-
message: '',
|
|
15
|
-
isValid: true,
|
|
16
|
-
invalidKeys: [],
|
|
17
|
-
};
|
|
18
|
-
const isRequired = element.required ?? element.hasAttribute('required');
|
|
19
|
-
// Always true if the element isn't required.
|
|
20
|
-
if (!isRequired) {
|
|
21
|
-
return validity;
|
|
22
|
-
}
|
|
23
|
-
const value = element[validationProperty];
|
|
24
|
-
const isEmpty = !value;
|
|
25
|
-
if (isEmpty) {
|
|
26
|
-
validity.message = typeof obj.message === 'function' ? obj.message(element) : obj.message || '';
|
|
27
|
-
validity.isValid = false;
|
|
28
|
-
validity.invalidKeys.push('valueMissing');
|
|
29
|
-
}
|
|
30
|
-
return validity;
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
return obj;
|
|
34
|
-
};
|