@warp-ds/elements 2.10.0-next.2 → 2.10.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 +4 -0
- package/dist/.storybook/utilities.js +4 -4
- package/dist/api.js +1 -1
- package/dist/api.js.map +2 -2
- package/dist/custom-elements.json +1303 -619
- package/dist/docs/affix/affix.md +120 -3
- package/dist/docs/affix/api.md +2 -2
- package/dist/docs/affix/styling.md +108 -0
- package/dist/docs/alert/alert.md +6 -6
- package/dist/docs/alert/api.md +4 -4
- package/dist/docs/alert/styling.md +1 -0
- package/dist/docs/attention/api.md +50 -2
- package/dist/docs/attention/attention.md +52 -2
- package/dist/docs/attention/styling.md +1 -0
- package/dist/docs/badge/api.md +50 -4
- package/dist/docs/badge/badge.md +52 -4
- package/dist/docs/badge/styling.md +1 -0
- package/dist/docs/box/api.md +2 -2
- package/dist/docs/box/box.md +24 -42
- package/dist/docs/box/examples.md +20 -38
- package/dist/docs/box/styling.md +1 -0
- package/dist/docs/breadcrumb-item/api.md +27 -0
- package/dist/docs/breadcrumb-item/breadcrumb-item.md +34 -0
- package/dist/docs/breadcrumbs/accessibility.md +8 -18
- package/dist/docs/breadcrumbs/breadcrumbs.md +128 -36
- package/dist/docs/breadcrumbs/examples.md +15 -9
- package/dist/docs/breadcrumbs/styling.md +97 -0
- package/dist/docs/breadcrumbs/usage.md +8 -8
- package/dist/docs/button/api.md +32 -24
- package/dist/docs/button/button.md +105 -26
- package/dist/docs/button/styling.md +72 -0
- package/dist/docs/card/api.md +8 -0
- package/dist/docs/card/card.md +10 -2
- package/dist/docs/card/styling.md +1 -0
- package/dist/docs/checkbox/api.md +176 -0
- package/dist/docs/checkbox/checkbox.md +356 -0
- package/dist/docs/checkbox/styling.md +173 -0
- package/dist/docs/checkbox-group/accessibility.md +71 -0
- package/dist/docs/checkbox-group/api.md +103 -0
- package/dist/docs/checkbox-group/checkbox-group.md +529 -0
- package/dist/docs/checkbox-group/examples.md +105 -0
- package/dist/docs/checkbox-group/styling.md +134 -0
- package/dist/docs/checkbox-group/usage.md +95 -0
- package/dist/docs/combobox/accessibility.md +71 -0
- package/dist/docs/combobox/api.md +74 -36
- package/dist/docs/combobox/combobox.md +219 -38
- package/dist/docs/combobox/examples.md +44 -0
- package/dist/docs/combobox/styling.md +1 -0
- package/dist/docs/combobox/usage.md +28 -0
- package/dist/docs/datepicker/accessibility.md +25 -0
- package/dist/docs/datepicker/api.md +37 -21
- package/dist/docs/datepicker/datepicker.md +223 -23
- package/dist/docs/datepicker/examples.md +75 -0
- package/dist/docs/datepicker/styling.md +1 -0
- package/dist/docs/datepicker/usage.md +84 -0
- package/dist/docs/expandable/api.md +23 -35
- package/dist/docs/expandable/examples.md +54 -0
- package/dist/docs/expandable/expandable.md +77 -35
- package/dist/docs/expandable/styling.md +1 -0
- package/dist/docs/icon/accessibility.md +5 -0
- package/dist/docs/icon/api.md +43 -0
- package/dist/docs/icon/examples.md +45 -0
- package/dist/docs/icon/icon.md +115 -0
- package/dist/docs/icon/styling.md +1 -0
- package/dist/docs/icon/usage.md +11 -0
- package/dist/docs/index.md +49 -0
- package/dist/docs/link/api.md +24 -28
- package/dist/docs/link/examples.md +75 -0
- package/dist/docs/link/link.md +119 -30
- package/dist/docs/link/styling.md +1 -0
- package/dist/docs/link/usage.md +18 -0
- package/dist/docs/modal/api.md +18 -2
- package/dist/docs/modal/modal.md +20 -2
- package/dist/docs/modal/styling.md +1 -0
- package/dist/docs/modal-footer/modal-footer.md +0 -6
- package/dist/docs/modal-header/modal-header.md +0 -6
- package/dist/docs/page-indicator/page-indicator.md +2 -0
- package/dist/docs/page-indicator/styling.md +1 -0
- package/dist/docs/pagination/api.md +4 -4
- package/dist/docs/pagination/pagination.md +6 -4
- package/dist/docs/pagination/styling.md +1 -0
- package/dist/docs/pill/api.md +8 -8
- package/dist/docs/pill/pill.md +10 -8
- package/dist/docs/pill/styling.md +1 -0
- package/dist/docs/radio/radio.md +1 -7
- package/dist/docs/radio-group/api.md +4 -4
- package/dist/docs/radio-group/radio-group.md +183 -68
- package/dist/docs/radio-group/styling.md +179 -64
- package/dist/docs/select/api.md +10 -10
- package/dist/docs/select/select.md +103 -10
- package/dist/docs/select/styling.md +92 -0
- package/dist/docs/slider/api.md +22 -22
- package/dist/docs/slider/slider.md +24 -22
- package/dist/docs/slider/styling.md +1 -0
- package/dist/docs/slider-thumb/api.md +28 -12
- package/dist/docs/slider-thumb/slider-thumb.md +30 -12
- package/dist/docs/slider-thumb/styling.md +1 -0
- package/dist/docs/snackbar/accessibility.md +20 -0
- package/dist/docs/snackbar/api.md +30 -0
- package/dist/docs/snackbar/examples.md +191 -0
- package/dist/docs/snackbar/snackbar.md +385 -0
- package/dist/docs/snackbar/styling.md +72 -0
- package/dist/docs/snackbar/usage.md +60 -0
- package/dist/docs/snackbar-item/api.md +41 -0
- package/dist/docs/snackbar-item/snackbar-item.md +49 -0
- package/dist/docs/step/api.md +16 -0
- package/dist/docs/step/step.md +16 -0
- package/dist/docs/step-indicator/step-indicator.md +2 -0
- package/dist/docs/step-indicator/styling.md +1 -0
- package/dist/docs/switch/api.md +8 -0
- package/dist/docs/switch/styling.md +1 -0
- package/dist/docs/switch/switch.md +10 -0
- package/dist/docs/tabs/api.md +2 -2
- package/dist/docs/tabs/styling.md +1 -0
- package/dist/docs/tabs/tabs.md +4 -2
- package/dist/docs/textarea/api.md +54 -14
- package/dist/docs/textarea/styling.md +92 -0
- package/dist/docs/textarea/textarea.md +147 -14
- package/dist/docs/textfield/api.md +74 -34
- package/dist/docs/textfield/styling.md +96 -0
- package/dist/docs/textfield/textfield.md +171 -34
- package/dist/index.d.ts +1359 -368
- package/dist/packages/affix/affix-styles.d.ts +8 -0
- package/dist/packages/affix/affix-styles.js +108 -0
- package/dist/packages/affix/affix.d.ts +16 -13
- package/dist/packages/affix/affix.hydration.test.d.ts +1 -1
- package/dist/packages/affix/affix.hydration.test.js +15 -15
- package/dist/packages/affix/affix.js +451 -320
- package/dist/packages/affix/affix.js.map +4 -4
- package/dist/packages/affix/affix.react.stories.d.ts +3 -3
- package/dist/packages/affix/affix.react.stories.js +3 -3
- package/dist/packages/affix/affix.react.test.js +5 -3
- package/dist/packages/affix/affix.stories.d.ts +3 -3
- package/dist/packages/affix/affix.stories.js +10 -10
- package/dist/packages/affix/affix.test.d.ts +1 -1
- package/dist/packages/affix/affix.test.js +10 -10
- package/dist/packages/affix/react.d.ts +3 -3
- package/dist/packages/affix/react.js +6 -6
- package/dist/packages/affix/styles.js +2 -2
- package/dist/packages/alert/alert.d.ts +3 -3
- package/dist/packages/alert/alert.hydration.test.d.ts +1 -1
- package/dist/packages/alert/alert.hydration.test.js +21 -21
- package/dist/packages/alert/alert.js +349 -324
- package/dist/packages/alert/alert.js.map +3 -3
- package/dist/packages/alert/alert.react.stories.d.ts +2 -2
- package/dist/packages/alert/alert.react.stories.js +13 -13
- package/dist/packages/alert/alert.stories.d.ts +4 -4
- package/dist/packages/alert/alert.stories.js +29 -27
- package/dist/packages/alert/alert.test.d.ts +1 -1
- package/dist/packages/alert/alert.test.js +34 -21
- package/dist/packages/alert/react.d.ts +1 -1
- package/dist/packages/alert/react.js +4 -4
- package/dist/packages/alert/styles.js +2 -2
- package/dist/packages/attention/attention.d.ts +11 -6
- package/dist/packages/attention/attention.hydration.test.d.ts +1 -1
- package/dist/packages/attention/attention.hydration.test.js +29 -29
- package/dist/packages/attention/attention.js +1795 -1781
- package/dist/packages/attention/attention.js.map +4 -4
- package/dist/packages/attention/attention.react.stories.d.ts +3 -3
- package/dist/packages/attention/attention.react.stories.js +13 -13
- package/dist/packages/attention/attention.react.test.js +11 -7
- package/dist/packages/attention/attention.stories.d.ts +4 -4
- package/dist/packages/attention/attention.stories.js +126 -117
- package/dist/packages/attention/attention.test.d.ts +1 -1
- package/dist/packages/attention/attention.test.js +18 -10
- package/dist/packages/attention/layout-styles.js +900 -900
- package/dist/packages/attention/react.d.ts +4 -4
- package/dist/packages/attention/react.js +13 -11
- package/dist/packages/attention/styles.js +2 -2
- package/dist/packages/badge/badge.d.ts +3 -3
- package/dist/packages/badge/badge.hydration.test.d.ts +1 -1
- package/dist/packages/badge/badge.hydration.test.js +25 -25
- package/dist/packages/badge/badge.js +281 -281
- package/dist/packages/badge/badge.js.map +3 -3
- package/dist/packages/badge/badge.react.stories.d.ts +3 -3
- package/dist/packages/badge/badge.react.stories.js +17 -17
- package/dist/packages/badge/badge.stories.d.ts +3 -3
- package/dist/packages/badge/badge.stories.js +22 -20
- package/dist/packages/badge/badge.test.d.ts +1 -1
- package/dist/packages/badge/badge.test.js +13 -11
- package/dist/packages/badge/react.d.ts +1 -1
- package/dist/packages/badge/react.js +4 -4
- package/dist/packages/badge/styles.js +2 -2
- package/dist/packages/box/box.d.ts +1 -1
- package/dist/packages/box/box.hydration.test.d.ts +1 -1
- package/dist/packages/box/box.hydration.test.js +14 -14
- package/dist/packages/box/box.js +288 -288
- package/dist/packages/box/box.js.map +3 -3
- package/dist/packages/box/box.react.stories.d.ts +3 -3
- package/dist/packages/box/box.react.stories.js +8 -8
- package/dist/packages/box/box.stories.d.ts +3 -3
- package/dist/packages/box/box.stories.js +25 -19
- package/dist/packages/box/box.test.d.ts +1 -1
- package/dist/packages/box/box.test.js +6 -6
- package/dist/packages/box/react.d.ts +1 -1
- package/dist/packages/box/react.js +4 -4
- package/dist/packages/box/slot.test.d.ts +1 -1
- package/dist/packages/box/slot.test.js +6 -6
- package/dist/packages/box/styles.js +2 -2
- package/dist/packages/breadcrumb-item/breadcrumb-item.d.ts +29 -0
- package/dist/packages/breadcrumb-item/breadcrumb-item.js +2529 -0
- package/dist/packages/breadcrumb-item/breadcrumb-item.js.map +7 -0
- package/dist/packages/breadcrumb-item/react.d.ts +2 -0
- package/dist/packages/breadcrumb-item/react.js +11 -0
- package/dist/packages/breadcrumb-item/styles.d.ts +4 -0
- package/dist/packages/breadcrumb-item/styles.js +81 -0
- package/dist/packages/breadcrumbs/breadcrumbs.d.ts +4 -3
- package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.d.ts +1 -1
- package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.js +57 -50
- package/dist/packages/breadcrumbs/breadcrumbs.js +287 -283
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +4 -4
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.d.ts +4 -4
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.js +17 -16
- package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +7 -8
- package/dist/packages/breadcrumbs/breadcrumbs.stories.js +30 -26
- package/dist/packages/breadcrumbs/breadcrumbs.test.d.ts +1 -1
- package/dist/packages/breadcrumbs/breadcrumbs.test.js +19 -17
- package/dist/packages/breadcrumbs/react.d.ts +1 -1
- package/dist/packages/breadcrumbs/react.js +4 -4
- package/dist/packages/breadcrumbs/styles.js +2 -2
- package/dist/packages/button/button.d.ts +20 -15
- package/dist/packages/button/button.hydration.test.d.ts +1 -1
- package/dist/packages/button/button.hydration.test.js +19 -19
- package/dist/packages/button/button.js +809 -811
- package/dist/packages/button/button.js.map +4 -4
- package/dist/packages/button/button.react.stories.d.ts +5 -5
- package/dist/packages/button/button.react.stories.js +30 -30
- package/dist/packages/button/button.react.test.js +13 -13
- package/dist/packages/button/button.stories.d.ts +33 -4
- package/dist/packages/button/button.stories.js +353 -70
- package/dist/packages/button/button.test.d.ts +1 -1
- package/dist/packages/button/button.test.js +36 -35
- package/dist/packages/button/react.d.ts +3 -3
- package/dist/packages/button/react.js +7 -7
- package/dist/packages/button/styles.d.ts +22 -1
- package/dist/packages/button/styles.js +433 -2
- package/dist/packages/card/card.d.ts +1 -1
- package/dist/packages/card/card.hydration.test.d.ts +1 -1
- package/dist/packages/card/card.hydration.test.js +14 -14
- package/dist/packages/card/card.js +311 -296
- package/dist/packages/card/card.js.map +4 -4
- package/dist/packages/card/card.react.stories.d.ts +3 -3
- package/dist/packages/card/card.react.stories.js +11 -11
- package/dist/packages/card/card.stories.d.ts +3 -3
- package/dist/packages/card/card.stories.js +36 -24
- package/dist/packages/card/card.test.d.ts +1 -1
- package/dist/packages/card/card.test.js +6 -6
- package/dist/packages/card/react.d.ts +1 -1
- package/dist/packages/card/react.js +4 -4
- package/dist/packages/card/styles.js +2 -2
- package/dist/packages/checkbox/checkbox.a11y.test.d.ts +1 -1
- package/dist/packages/checkbox/checkbox.a11y.test.js +47 -33
- package/dist/packages/checkbox/checkbox.d.ts +48 -17
- package/dist/packages/checkbox/checkbox.hydration.test.d.ts +1 -1
- package/dist/packages/checkbox/checkbox.hydration.test.js +21 -21
- package/dist/packages/checkbox/checkbox.js +481 -430
- package/dist/packages/checkbox/checkbox.js.map +3 -3
- package/dist/packages/checkbox/checkbox.react.stories.d.ts +3 -3
- package/dist/packages/checkbox/checkbox.react.stories.js +3 -3
- package/dist/packages/checkbox/checkbox.stories.d.ts +5 -5
- package/dist/packages/checkbox/checkbox.stories.js +99 -91
- package/dist/packages/checkbox/checkbox.test.d.ts +1 -1
- package/dist/packages/checkbox/checkbox.test.js +64 -64
- package/dist/packages/checkbox/react.d.ts +2 -2
- package/dist/packages/checkbox/react.js +6 -6
- package/dist/packages/checkbox/styles.js +183 -132
- package/dist/packages/checkbox-group/checkbox-group.a11y.test.d.ts +2 -2
- package/dist/packages/checkbox-group/checkbox-group.a11y.test.js +83 -73
- package/dist/packages/checkbox-group/checkbox-group.d.ts +54 -13
- package/dist/packages/checkbox-group/checkbox-group.hydration.test.d.ts +2 -2
- package/dist/packages/checkbox-group/checkbox-group.hydration.test.js +36 -19
- package/dist/packages/checkbox-group/checkbox-group.js +62 -57
- package/dist/packages/checkbox-group/checkbox-group.js.map +4 -4
- package/dist/packages/checkbox-group/checkbox-group.react.test.js +4 -4
- package/dist/packages/checkbox-group/checkbox-group.test.d.ts +2 -2
- package/dist/packages/checkbox-group/checkbox-group.test.js +96 -90
- package/dist/packages/checkbox-group/react.d.ts +4 -4
- package/dist/packages/checkbox-group/react.js +6 -6
- package/dist/packages/combobox/combobox.a11y.test.d.ts +2 -2
- package/dist/packages/combobox/combobox.a11y.test.js +80 -33
- package/dist/packages/combobox/combobox.d.ts +67 -47
- package/dist/packages/combobox/combobox.hydration.test.d.ts +1 -1
- package/dist/packages/combobox/combobox.hydration.test.js +73 -35
- package/dist/packages/combobox/combobox.js +338 -339
- package/dist/packages/combobox/combobox.js.map +4 -4
- package/dist/packages/combobox/combobox.react.stories.d.ts +29 -13
- package/dist/packages/combobox/combobox.react.stories.js +29 -29
- package/dist/packages/combobox/combobox.react.test.js +8 -8
- package/dist/packages/combobox/combobox.stories.d.ts +4 -4
- package/dist/packages/combobox/combobox.stories.js +104 -85
- package/dist/packages/combobox/combobox.test.d.ts +2 -2
- package/dist/packages/combobox/combobox.test.js +194 -69
- package/dist/packages/combobox/react.d.ts +15 -7
- package/dist/packages/combobox/react.js +14 -14
- package/dist/packages/combobox/styles.js +2 -3
- package/dist/packages/datepicker/DatePicker.test.d.ts +2 -2
- package/dist/packages/datepicker/DatePicker.test.js +49 -42
- package/dist/packages/datepicker/datepicker.d.ts +30 -38
- package/dist/packages/datepicker/datepicker.hydration.test.d.ts +1 -1
- package/dist/packages/datepicker/datepicker.hydration.test.js +21 -21
- package/dist/packages/datepicker/datepicker.js +673 -632
- package/dist/packages/datepicker/datepicker.js.map +4 -4
- package/dist/packages/datepicker/datepicker.react.stories.d.ts +17 -17
- package/dist/packages/datepicker/datepicker.react.stories.js +9 -9
- package/dist/packages/datepicker/datepicker.react.test.js +6 -6
- package/dist/packages/datepicker/datepicker.stories.d.ts +4 -4
- package/dist/packages/datepicker/datepicker.stories.js +32 -32
- package/dist/packages/datepicker/datepicker.test.d.ts +2 -2
- package/dist/packages/datepicker/datepicker.test.js +77 -79
- package/dist/packages/datepicker/react.d.ts +9 -9
- package/dist/packages/datepicker/react.js +16 -14
- package/dist/packages/datepicker/styles/w-datepicker-calendar.styles.js +13 -12
- package/dist/packages/datepicker/styles/w-datepicker-day.styles.js +58 -55
- package/dist/packages/datepicker/styles/w-datepicker-month.styles.js +60 -57
- package/dist/packages/datepicker/styles/w-datepicker.styles.js +87 -87
- package/dist/packages/datepicker/utils.d.ts +3 -0
- package/dist/packages/datepicker/utils.js +40 -1
- package/dist/packages/datepicker/utils.test.d.ts +1 -0
- package/dist/packages/datepicker/utils.test.js +29 -0
- package/dist/packages/expandable/expandable.d.ts +18 -39
- package/dist/packages/expandable/expandable.hydration.test.d.ts +1 -1
- package/dist/packages/expandable/expandable.hydration.test.js +21 -21
- package/dist/packages/expandable/expandable.js +359 -332
- package/dist/packages/expandable/expandable.js.map +4 -4
- package/dist/packages/expandable/expandable.react.stories.d.ts +5 -5
- package/dist/packages/expandable/expandable.react.stories.js +7 -7
- package/dist/packages/expandable/expandable.react.test.js +15 -7
- package/dist/packages/expandable/expandable.stories.d.ts +5 -5
- package/dist/packages/expandable/expandable.stories.js +51 -45
- package/dist/packages/expandable/expandable.test.d.ts +1 -1
- package/dist/packages/expandable/expandable.test.js +19 -17
- package/dist/packages/expandable/react.d.ts +3 -3
- package/dist/packages/expandable/react.js +9 -9
- package/dist/packages/expandable/styles.js +2 -2
- package/dist/packages/global.d.ts +1 -0
- package/dist/packages/global.js +5 -0
- package/dist/packages/i18n.d.ts +1 -1
- package/dist/packages/i18n.js +37 -29
- package/dist/packages/icon/icon.d.ts +22 -5
- package/dist/packages/icon/icon.hydration.test.d.ts +1 -1
- package/dist/packages/icon/icon.hydration.test.js +25 -25
- package/dist/packages/icon/icon.js +31 -26
- package/dist/packages/icon/icon.js.map +3 -3
- package/dist/packages/icon/icon.react.stories.d.ts +4 -3
- package/dist/packages/icon/icon.react.stories.js +284 -283
- package/dist/packages/icon/icon.stories.d.ts +7 -30
- package/dist/packages/icon/icon.stories.js +307 -297
- package/dist/packages/icon/icon.test.d.ts +1 -1
- package/dist/packages/icon/icon.test.js +36 -28
- package/dist/packages/icon/react.d.ts +2 -2
- package/dist/packages/icon/react.js +4 -4
- package/dist/packages/icon/style.js +24 -25
- package/dist/packages/interaction-type-detection.d.ts +22 -0
- package/dist/packages/interaction-type-detection.js +38 -0
- package/dist/packages/link/link.d.ts +22 -23
- package/dist/packages/link/link.hydration.test.d.ts +1 -1
- package/dist/packages/link/link.hydration.test.js +27 -27
- package/dist/packages/link/link.js +775 -498
- package/dist/packages/link/link.js.map +4 -4
- package/dist/packages/link/link.react.stories.d.ts +3 -3
- package/dist/packages/link/link.react.stories.js +42 -42
- package/dist/packages/link/link.react.test.js +5 -3
- package/dist/packages/link/link.stories.d.ts +3 -3
- package/dist/packages/link/link.stories.js +51 -51
- package/dist/packages/link/link.test.d.ts +1 -1
- package/dist/packages/link/link.test.js +11 -7
- package/dist/packages/link/react.d.ts +2 -2
- package/dist/packages/link/react.js +6 -6
- package/dist/packages/link/styles.d.ts +5 -0
- package/dist/packages/link/styles.js +85 -0
- package/dist/packages/modal/index.d.ts +7 -7
- package/dist/packages/modal/index.js +7 -7
- package/dist/packages/modal/modal.d.ts +3 -2
- package/dist/packages/modal/modal.hydration.test.d.ts +1 -1
- package/dist/packages/modal/modal.hydration.test.js +12 -12
- package/dist/packages/modal/modal.js +409 -409
- package/dist/packages/modal/modal.js.map +3 -3
- package/dist/packages/modal/modal.react.stories.d.ts +7 -7
- package/dist/packages/modal/modal.react.stories.js +15 -6
- package/dist/packages/modal/modal.react.test.js +5 -5
- package/dist/packages/modal/modal.stories.d.ts +6 -6
- package/dist/packages/modal/modal.stories.js +253 -238
- package/dist/packages/modal/react.d.ts +38 -8
- package/dist/packages/modal/react.js +43 -13
- package/dist/packages/modal/util.js +3 -1
- package/dist/packages/modal-footer/modal-footer.d.ts +1 -1
- package/dist/packages/modal-footer/modal-footer.js +296 -296
- package/dist/packages/modal-footer/modal-footer.js.map +3 -3
- package/dist/packages/modal-footer/react.d.ts +1 -1
- package/dist/packages/modal-footer/react.js +4 -4
- package/dist/packages/modal-header/modal-header.d.ts +2 -2
- package/dist/packages/modal-header/modal-header.js +443 -422
- package/dist/packages/modal-header/modal-header.js.map +4 -4
- package/dist/packages/modal-header/modal-header.react.test.js +5 -3
- package/dist/packages/modal-header/react.d.ts +4 -4
- package/dist/packages/modal-header/react.js +8 -8
- package/dist/packages/page-indicator/page-indicator.d.ts +1 -5
- package/dist/packages/page-indicator/page-indicator.hydration.test.d.ts +1 -1
- package/dist/packages/page-indicator/page-indicator.hydration.test.js +22 -22
- package/dist/packages/page-indicator/page-indicator.js +29 -29
- package/dist/packages/page-indicator/page-indicator.js.map +4 -4
- package/dist/packages/page-indicator/page-indicator.react.stories.d.ts +3 -3
- package/dist/packages/page-indicator/page-indicator.react.stories.js +11 -11
- package/dist/packages/page-indicator/page-indicator.react.test.js +5 -5
- package/dist/packages/page-indicator/page-indicator.stories.d.ts +9 -27
- package/dist/packages/page-indicator/page-indicator.stories.js +63 -32
- package/dist/packages/page-indicator/page-indicator.test.d.ts +1 -1
- package/dist/packages/page-indicator/page-indicator.test.js +110 -70
- package/dist/packages/page-indicator/react.d.ts +2 -2
- package/dist/packages/page-indicator/react.js +7 -7
- package/dist/packages/page-indicator/style.js +21 -21
- package/dist/packages/pagination/pagination.a11y.test.d.ts +1 -1
- package/dist/packages/pagination/pagination.a11y.test.js +59 -25
- package/dist/packages/pagination/pagination.d.ts +10 -11
- package/dist/packages/pagination/pagination.hydration.test.d.ts +1 -1
- package/dist/packages/pagination/pagination.hydration.test.js +19 -19
- package/dist/packages/pagination/pagination.js +385 -354
- package/dist/packages/pagination/pagination.js.map +4 -4
- package/dist/packages/pagination/pagination.react.stories.d.ts +11 -11
- package/dist/packages/pagination/pagination.react.stories.js +8 -8
- package/dist/packages/pagination/pagination.react.test.js +6 -6
- package/dist/packages/pagination/pagination.stories.d.ts +3 -3
- package/dist/packages/pagination/pagination.stories.js +18 -18
- package/dist/packages/pagination/pagination.test.d.ts +1 -1
- package/dist/packages/pagination/pagination.test.js +146 -72
- package/dist/packages/pagination/react.d.ts +6 -6
- package/dist/packages/pagination/react.js +12 -10
- package/dist/packages/pagination/styles.js +2 -2
- package/dist/packages/pill/pill.d.ts +6 -6
- package/dist/packages/pill/pill.hydration.test.d.ts +1 -1
- package/dist/packages/pill/pill.hydration.test.js +14 -14
- package/dist/packages/pill/pill.js +337 -314
- package/dist/packages/pill/pill.js.map +4 -4
- package/dist/packages/pill/pill.react.stories.d.ts +11 -11
- package/dist/packages/pill/pill.react.stories.js +3 -3
- package/dist/packages/pill/pill.react.test.js +8 -8
- package/dist/packages/pill/pill.stories.d.ts +3 -3
- package/dist/packages/pill/pill.stories.js +8 -8
- package/dist/packages/pill/pill.test.d.ts +1 -1
- package/dist/packages/pill/pill.test.js +17 -15
- package/dist/packages/pill/react.d.ts +6 -6
- package/dist/packages/pill/react.js +18 -14
- package/dist/packages/pill/styles.js +2 -2
- package/dist/packages/radio/base-element.d.ts +3 -3
- package/dist/packages/radio/base-element.js +3 -3
- package/dist/packages/radio/custom-error-validator.d.ts +1 -1
- package/dist/packages/radio/custom-error-validator.js +3 -3
- package/dist/packages/radio/form-associated-element.d.ts +9 -9
- package/dist/packages/radio/form-associated-element.js +27 -26
- package/dist/packages/radio/host-styles.js +9 -9
- package/dist/packages/radio/invalid.d.ts +1 -1
- package/dist/packages/radio/invalid.js +1 -1
- package/dist/packages/radio/radio-styles.js +199 -160
- package/dist/packages/radio/radio.a11y.test.d.ts +2 -2
- package/dist/packages/radio/radio.a11y.test.js +60 -58
- package/dist/packages/radio/radio.d.ts +4 -4
- package/dist/packages/radio/radio.hydration.test.d.ts +1 -1
- package/dist/packages/radio/radio.hydration.test.js +23 -14
- package/dist/packages/radio/radio.js +491 -452
- package/dist/packages/radio/radio.js.map +3 -3
- package/dist/packages/radio/radio.react.stories.d.ts +2 -2
- package/dist/packages/radio/radio.react.stories.js +3 -3
- package/dist/packages/radio/radio.stories.d.ts +4 -4
- package/dist/packages/radio/radio.stories.js +152 -136
- package/dist/packages/radio/radio.test.d.ts +1 -1
- package/dist/packages/radio/radio.test.js +74 -73
- package/dist/packages/radio/react.d.ts +1 -1
- package/dist/packages/radio/react.js +4 -4
- package/dist/packages/radio/required-validator.d.ts +1 -1
- package/dist/packages/radio/required-validator.js +12 -7
- package/dist/packages/radio/slot.d.ts +1 -1
- package/dist/packages/radio/slot.js +11 -8
- package/dist/packages/radio/watch.d.ts +1 -1
- package/dist/packages/radio/watch.js +3 -1
- package/dist/packages/radio-group/radio-group-styles.js +121 -88
- package/dist/packages/radio-group/radio-group.a11y.test.d.ts +2 -2
- package/dist/packages/radio-group/radio-group.a11y.test.js +83 -77
- package/dist/packages/radio-group/radio-group.d.ts +16 -7
- package/dist/packages/radio-group/radio-group.hydration.test.d.ts +2 -2
- package/dist/packages/radio-group/radio-group.hydration.test.js +30 -15
- package/dist/packages/radio-group/radio-group.js +655 -567
- package/dist/packages/radio-group/radio-group.js.map +4 -4
- package/dist/packages/radio-group/radio-group.react.test.js +4 -4
- package/dist/packages/radio-group/radio-group.test.d.ts +2 -2
- package/dist/packages/radio-group/radio-group.test.js +234 -229
- package/dist/packages/radio-group/react.d.ts +7 -7
- package/dist/packages/radio-group/react.js +10 -10
- package/dist/packages/select/input-styles.d.ts +11 -0
- package/dist/packages/select/input-styles.js +88 -0
- package/dist/packages/select/react.d.ts +5 -5
- package/dist/packages/select/react.js +11 -11
- package/dist/packages/select/select.a11y.test.d.ts +1 -1
- package/dist/packages/select/select.a11y.test.js +100 -89
- package/dist/packages/select/select.d.ts +10 -11
- package/dist/packages/select/select.hydration.test.d.ts +1 -1
- package/dist/packages/select/select.hydration.test.js +16 -16
- package/dist/packages/select/select.js +432 -336
- package/dist/packages/select/select.js.map +4 -4
- package/dist/packages/select/select.react.stories.d.ts +10 -10
- package/dist/packages/select/select.react.stories.js +19 -14
- package/dist/packages/select/select.react.test.js +6 -6
- package/dist/packages/select/select.stories.d.ts +3 -3
- package/dist/packages/select/select.stories.js +51 -48
- package/dist/packages/select/select.test.d.ts +1 -1
- package/dist/packages/select/select.test.js +178 -179
- package/dist/packages/select/styles.js +2 -2
- package/dist/packages/slider/Slider.d.ts +1 -1
- package/dist/packages/slider/Slider.js +4 -4
- package/dist/packages/slider/index.d.ts +2 -2
- package/dist/packages/slider/index.js +2 -2
- package/dist/packages/slider/react.d.ts +4 -4
- package/dist/packages/slider/react.js +9 -9
- package/dist/packages/slider/slider.d.ts +17 -17
- package/dist/packages/slider/slider.hydration.test.d.ts +1 -1
- package/dist/packages/slider/slider.hydration.test.js +40 -16
- package/dist/packages/slider/slider.js +485 -467
- package/dist/packages/slider/slider.js.map +4 -4
- package/dist/packages/slider/slider.react.stories.d.ts +4 -4
- package/dist/packages/slider/slider.react.stories.js +29 -32
- package/dist/packages/slider/slider.react.test.js +6 -6
- package/dist/packages/slider/slider.stories.d.ts +7 -7
- package/dist/packages/slider/slider.stories.js +333 -340
- package/dist/packages/slider/slider.test.d.ts +5 -5
- package/dist/packages/slider/slider.test.js +367 -334
- package/dist/packages/slider/styles/w-slider.styles.js +166 -148
- package/dist/packages/slider/styles.js +2 -2
- package/dist/packages/slider-thumb/SliderThumb.d.ts +1 -1
- package/dist/packages/slider-thumb/SliderThumb.js +4 -4
- package/dist/packages/slider-thumb/oddbird-css-anchor-positioning.d.ts +1 -1
- package/dist/packages/slider-thumb/oddbird-css-anchor-positioning.js +1 -1
- package/dist/packages/slider-thumb/react.d.ts +5 -5
- package/dist/packages/slider-thumb/react.js +11 -9
- package/dist/packages/slider-thumb/slider-thumb.d.ts +17 -17
- package/dist/packages/slider-thumb/slider-thumb.hydration.test.d.ts +1 -1
- package/dist/packages/slider-thumb/slider-thumb.hydration.test.js +26 -17
- package/dist/packages/slider-thumb/slider-thumb.js +550 -553
- package/dist/packages/slider-thumb/slider-thumb.js.map +4 -4
- package/dist/packages/slider-thumb/slider-thumb.react.test.js +9 -5
- package/dist/packages/slider-thumb/styles/w-slider-thumb.styles.js +189 -188
- package/dist/packages/slider-thumb/styles.js +2 -0
- package/dist/packages/snackbar/locales/da/messages.d.mts +1 -0
- package/dist/packages/snackbar/locales/da/messages.mjs +1 -0
- package/dist/packages/snackbar/locales/en/messages.d.mts +1 -0
- package/dist/packages/snackbar/locales/en/messages.mjs +1 -0
- package/dist/packages/snackbar/locales/fi/messages.d.mts +1 -0
- package/dist/packages/snackbar/locales/fi/messages.mjs +1 -0
- package/dist/packages/snackbar/locales/nb/messages.d.mts +1 -0
- package/dist/packages/snackbar/locales/nb/messages.mjs +1 -0
- package/dist/packages/snackbar/locales/sv/messages.d.mts +1 -0
- package/dist/packages/snackbar/locales/sv/messages.mjs +1 -0
- package/dist/packages/snackbar/react.d.ts +2 -0
- package/dist/packages/snackbar/react.js +11 -0
- package/dist/packages/snackbar/snackbar.d.ts +132 -0
- package/dist/packages/snackbar/snackbar.hydration.test.d.ts +1 -0
- package/dist/packages/snackbar/snackbar.hydration.test.js +13 -0
- package/dist/packages/snackbar/snackbar.js +2665 -0
- package/dist/packages/snackbar/snackbar.js.map +7 -0
- package/dist/packages/snackbar/snackbar.react.stories.d.ts +12 -0
- package/dist/packages/snackbar/snackbar.react.stories.js +160 -0
- package/dist/packages/snackbar/snackbar.stories.d.ts +20 -0
- package/dist/packages/snackbar/snackbar.stories.js +363 -0
- package/dist/packages/snackbar/snackbar.test.d.ts +4 -0
- package/dist/packages/snackbar/snackbar.test.js +17 -0
- package/dist/packages/snackbar/styles.d.ts +1 -0
- package/dist/packages/snackbar/styles.js +35 -0
- package/dist/packages/snackbar-item/react.d.ts +5 -0
- package/dist/packages/snackbar-item/react.js +16 -0
- package/dist/packages/snackbar-item/snackbar-item.d.ts +69 -0
- package/dist/packages/snackbar-item/snackbar-item.js +2620 -0
- package/dist/packages/snackbar-item/snackbar-item.js.map +7 -0
- package/dist/packages/snackbar-item/snackbar-item.react.test.d.ts +1 -0
- package/dist/packages/snackbar-item/snackbar-item.react.test.js +5 -0
- package/dist/packages/snackbar-item/styles.d.ts +1 -0
- package/dist/packages/snackbar-item/styles.js +133 -0
- package/dist/packages/step/react.d.ts +1 -1
- package/dist/packages/step/react.js +4 -4
- package/dist/packages/step/step.d.ts +2 -2
- package/dist/packages/step/step.hydration.test.d.ts +1 -1
- package/dist/packages/step/step.hydration.test.js +10 -10
- package/dist/packages/step/step.js +337 -315
- package/dist/packages/step/step.js.map +4 -4
- package/dist/packages/step-indicator/index.d.ts +2 -2
- package/dist/packages/step-indicator/index.js +2 -2
- package/dist/packages/step-indicator/react.d.ts +2 -2
- package/dist/packages/step-indicator/react.js +5 -5
- package/dist/packages/step-indicator/step-indicator.a11y.test.d.ts +2 -2
- package/dist/packages/step-indicator/step-indicator.a11y.test.js +48 -46
- package/dist/packages/step-indicator/step-indicator.d.ts +1 -1
- package/dist/packages/step-indicator/step-indicator.hydration.test.d.ts +1 -1
- package/dist/packages/step-indicator/step-indicator.hydration.test.js +10 -10
- package/dist/packages/step-indicator/step-indicator.js +285 -281
- package/dist/packages/step-indicator/step-indicator.js.map +3 -3
- package/dist/packages/step-indicator/stepindicator.react.stories.d.ts +2 -2
- package/dist/packages/step-indicator/stepindicator.react.stories.js +3 -3
- package/dist/packages/step-indicator/stepindicator.stories.d.ts +3 -3
- package/dist/packages/step-indicator/stepindicator.stories.js +129 -129
- package/dist/packages/step-indicator/styles.js +2 -2
- package/dist/packages/styles.js +277 -275
- package/dist/packages/switch/react.d.ts +1 -1
- package/dist/packages/switch/react.js +6 -6
- package/dist/packages/switch/styles.js +2 -2
- package/dist/packages/switch/switch.a11y.test.d.ts +1 -1
- package/dist/packages/switch/switch.a11y.test.js +46 -38
- package/dist/packages/switch/switch.d.ts +3 -3
- package/dist/packages/switch/switch.hydration.test.d.ts +1 -1
- package/dist/packages/switch/switch.hydration.test.js +23 -23
- package/dist/packages/switch/switch.js +304 -304
- package/dist/packages/switch/switch.js.map +3 -3
- package/dist/packages/switch/switch.react.stories.d.ts +2 -2
- package/dist/packages/switch/switch.react.stories.js +2 -2
- package/dist/packages/switch/switch.stories.d.ts +2 -2
- package/dist/packages/switch/switch.stories.js +42 -37
- package/dist/packages/switch/switch.test.d.ts +1 -1
- package/dist/packages/switch/switch.test.js +30 -35
- package/dist/packages/tab/react.d.ts +9 -7
- package/dist/packages/tab/react.js +11 -10
- package/dist/packages/tab/styles.d.ts +1 -0
- package/dist/packages/tab/styles.js +2 -0
- package/dist/packages/tab/tab.d.ts +6 -6
- package/dist/packages/tab/tab.hydration.test.d.ts +1 -1
- package/dist/packages/tab/tab.hydration.test.js +18 -12
- package/dist/packages/tab/tab.js +309 -308
- package/dist/packages/tab/tab.js.map +4 -4
- package/dist/packages/tab/tab.react.test.js +5 -3
- package/dist/packages/tab-panel/react.d.ts +3 -2
- package/dist/packages/tab-panel/react.js +11 -5
- package/dist/packages/tab-panel/tab-panel.d.ts +3 -3
- package/dist/packages/tab-panel/tab-panel.hydration.test.d.ts +1 -1
- package/dist/packages/tab-panel/tab-panel.hydration.test.js +13 -10
- package/dist/packages/tab-panel/tab-panel.js +293 -291
- package/dist/packages/tab-panel/tab-panel.js.map +3 -3
- package/dist/packages/tabs/index.d.ts +4 -4
- package/dist/packages/tabs/index.js +3 -3
- package/dist/packages/tabs/react.d.ts +27 -8
- package/dist/packages/tabs/react.js +30 -9
- package/dist/packages/tabs/styles.js +2 -2
- package/dist/packages/tabs/tabs.a11y.test.d.ts +3 -3
- package/dist/packages/tabs/tabs.a11y.test.js +188 -169
- package/dist/packages/tabs/tabs.d.ts +6 -5
- package/dist/packages/tabs/tabs.hydration.test.d.ts +3 -1
- package/dist/packages/tabs/tabs.hydration.test.js +22 -8
- package/dist/packages/tabs/tabs.js +293 -286
- package/dist/packages/tabs/tabs.js.map +3 -3
- package/dist/packages/tabs/tabs.react.stories.d.ts +12 -10
- package/dist/packages/tabs/tabs.react.stories.js +28 -28
- package/dist/packages/tabs/tabs.stories.d.ts +4 -4
- package/dist/packages/tabs/tabs.stories.js +101 -95
- package/dist/packages/tabs/tabs.test.d.ts +3 -3
- package/dist/packages/tabs/tabs.test.js +137 -123
- package/dist/packages/textarea/input-styles.d.ts +11 -0
- package/dist/packages/textarea/input-styles.js +88 -0
- package/dist/packages/textarea/react.d.ts +11 -11
- package/dist/packages/textarea/react.js +17 -17
- package/dist/packages/textarea/styles.js +2 -2
- package/dist/packages/textarea/textarea.a11y.test.d.ts +1 -1
- package/dist/packages/textarea/textarea.a11y.test.js +90 -58
- package/dist/packages/textarea/textarea.d.ts +11 -11
- package/dist/packages/textarea/textarea.hydration.test.d.ts +1 -1
- package/dist/packages/textarea/textarea.hydration.test.js +19 -19
- package/dist/packages/textarea/textarea.js +385 -304
- package/dist/packages/textarea/textarea.js.map +4 -4
- package/dist/packages/textarea/textarea.react.stories.d.ts +21 -21
- package/dist/packages/textarea/textarea.react.stories.js +13 -13
- package/dist/packages/textarea/textarea.react.test.js +7 -7
- package/dist/packages/textarea/textarea.stories.d.ts +3 -3
- package/dist/packages/textarea/textarea.stories.js +44 -42
- package/dist/packages/textarea/textarea.test.d.ts +1 -1
- package/dist/packages/textarea/textarea.test.js +124 -88
- package/dist/packages/textfield/input-styles.d.ts +11 -0
- package/dist/packages/textfield/input-styles.js +88 -0
- package/dist/packages/textfield/locales/da/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/da/messages.mjs +1 -0
- package/dist/packages/textfield/locales/en/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/en/messages.mjs +1 -0
- package/dist/packages/textfield/locales/fi/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/fi/messages.mjs +1 -0
- package/dist/packages/textfield/locales/nb/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/nb/messages.mjs +1 -0
- package/dist/packages/textfield/locales/sv/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/sv/messages.mjs +1 -0
- package/dist/packages/textfield/react.d.ts +11 -11
- package/dist/packages/textfield/react.js +17 -17
- package/dist/packages/textfield/styles/w-textfield.styles.js +60 -58
- package/dist/packages/textfield/styles.js +2 -2
- package/dist/packages/textfield/textfield.d.ts +36 -26
- package/dist/packages/textfield/textfield.hydration.test.d.ts +1 -1
- package/dist/packages/textfield/textfield.hydration.test.js +19 -19
- package/dist/packages/textfield/textfield.js +468 -373
- package/dist/packages/textfield/textfield.js.map +4 -4
- package/dist/packages/textfield/textfield.react.stories.d.ts +21 -21
- package/dist/packages/textfield/textfield.react.stories.js +31 -31
- package/dist/packages/textfield/textfield.react.test.js +7 -7
- package/dist/packages/textfield/textfield.stories.d.ts +4 -4
- package/dist/packages/textfield/textfield.stories.js +107 -89
- package/dist/packages/textfield/textfield.test.d.ts +2 -2
- package/dist/packages/textfield/textfield.test.js +103 -71
- package/dist/packages/toast/api.d.ts +2 -2
- package/dist/packages/toast/api.js +3 -3
- package/dist/packages/toast/index.d.ts +5 -5
- package/dist/packages/toast/index.js +5 -5
- package/dist/packages/toast/styles.js +2 -2
- package/dist/packages/toast/toast.d.ts +5 -5
- package/dist/packages/toast/toast.js +349 -320
- package/dist/packages/toast/toast.js.map +4 -4
- package/dist/packages/toast/toast.stories.d.ts +5 -9
- package/dist/packages/toast/toast.stories.js +37 -33
- package/dist/packages/toast/toast.test.d.ts +1 -1
- package/dist/packages/toast/toast.test.js +48 -31
- package/dist/packages/toast/types.d.ts +1 -1
- package/dist/packages/toast-container/styles.d.ts +1 -0
- package/dist/packages/toast-container/styles.js +2 -0
- package/dist/packages/toast-container/toast-container.d.ts +2 -2
- package/dist/packages/toast-container/toast-container.js +295 -294
- package/dist/packages/toast-container/toast-container.js.map +4 -4
- package/dist/packages/utils/element-collapse.d.ts +12 -0
- package/dist/packages/utils/element-collapse.js +102 -0
- package/dist/packages/utils/expand-transition.d.ts +1 -1
- package/dist/packages/utils/expand-transition.js +12 -10
- package/dist/packages/utils/unstyled-heading.d.ts +1 -1
- package/dist/packages/utils/unstyled-heading.js +4 -4
- package/dist/packages/utils/window-exists.js +1 -1
- package/dist/packages/utils.js +2 -2
- package/dist/setup-tests.d.ts +3 -3
- package/dist/setup-tests.js +16 -13
- package/dist/tests/react-hydration.js +29 -30
- package/dist/tests/react-ssr-attributes.d.ts +1 -1
- package/dist/tests/react-ssr-attributes.js +4 -4
- package/dist/web-types.json +566 -301
- package/eik/index.js +96 -0
- package/package.json +35 -29
- package/dist/docs/modal-footer/accessibility.md +0 -1
- package/dist/docs/modal-footer/examples.md +0 -1
- package/dist/docs/modal-footer/usage.md +0 -1
- package/dist/docs/modal-header/accessibility.md +0 -1
- package/dist/docs/modal-header/examples.md +0 -1
- package/dist/docs/modal-header/usage.md +0 -1
- package/dist/docs/radio/accessibility.md +0 -1
- package/dist/docs/radio/examples.md +0 -1
- package/dist/docs/radio/usage.md +0 -1
- package/dist/packages/button/styles/w-button.styles.d.ts +0 -1
- package/dist/packages/button/styles/w-button.styles.js +0 -282
- package/dist/packages/link/styles/w-link.styles.js +0 -213
- /package/dist/packages/{link/styles/w-link.styles.d.ts → slider-thumb/styles.d.ts} +0 -0
|
@@ -1,136 +1,261 @@
|
|
|
1
|
-
import { html } from
|
|
2
|
-
import { expect, test } from
|
|
3
|
-
import { render } from
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { expect, test } from "vitest";
|
|
3
|
+
import { render } from "vitest-browser-lit";
|
|
4
|
+
import "../textfield/textfield.js";
|
|
5
|
+
import "./combobox.js";
|
|
6
6
|
test('renders with autocomplete="off" on inner textfield when attribute not provided', async () => {
|
|
7
7
|
const component = html `<w-combobox data-testid="combobox"></w-combobox>`;
|
|
8
8
|
const page = render(component);
|
|
9
|
-
const locator = page.getByTestId(
|
|
9
|
+
const locator = page.getByTestId("combobox");
|
|
10
10
|
await expect.element(locator).toBeVisible();
|
|
11
11
|
const el = (await locator.element());
|
|
12
12
|
// The autocomplete attribute is not reflected on the outer element to avoid hydration mismatches
|
|
13
13
|
// Instead, check that the inner textfield receives the correct default value
|
|
14
|
-
const textfield = el.shadowRoot?.querySelector(
|
|
15
|
-
expect(textfield?.autocomplete).toBe(
|
|
14
|
+
const textfield = el.shadowRoot?.querySelector("w-textfield");
|
|
15
|
+
expect(textfield?.autocomplete).toBe("off");
|
|
16
16
|
});
|
|
17
|
-
test(
|
|
18
|
-
const component = html `<w-combobox
|
|
17
|
+
test("renders with autocomplete attribute when provided", async () => {
|
|
18
|
+
const component = html `<w-combobox
|
|
19
|
+
data-testid="combobox"
|
|
20
|
+
autocomplete="on"
|
|
21
|
+
></w-combobox>`;
|
|
19
22
|
const page = render(component);
|
|
20
|
-
const locator = page.getByTestId(
|
|
23
|
+
const locator = page.getByTestId("combobox");
|
|
21
24
|
await expect.element(locator).toBeVisible();
|
|
22
25
|
const el = (await locator.element());
|
|
23
|
-
expect(el.getAttribute(
|
|
26
|
+
expect(el.getAttribute("autocomplete")).toBe("on");
|
|
24
27
|
});
|
|
25
|
-
test(
|
|
28
|
+
test("displays initial value correctly when value prop is set", async () => {
|
|
26
29
|
const options = [
|
|
27
|
-
{ value:
|
|
28
|
-
{ value:
|
|
30
|
+
{ value: "apple", label: "Apple" },
|
|
31
|
+
{ value: "banana", label: "Banana" },
|
|
29
32
|
];
|
|
30
33
|
const component = html `<w-combobox
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
data-testid="combobox"
|
|
35
|
+
value="apple"
|
|
36
|
+
.options="${options}"
|
|
37
|
+
></w-combobox>`;
|
|
35
38
|
const page = render(component);
|
|
36
|
-
const locator = page.getByTestId(
|
|
39
|
+
const locator = page.getByTestId("combobox");
|
|
37
40
|
await expect.element(locator).toBeVisible();
|
|
38
41
|
const el = (await locator.element());
|
|
39
42
|
// Get the textfield's input element
|
|
40
|
-
const textfield = el.shadowRoot?.querySelector(
|
|
41
|
-
const input = textfield?.shadowRoot?.querySelector(
|
|
43
|
+
const textfield = el.shadowRoot?.querySelector("w-textfield");
|
|
44
|
+
const input = textfield?.shadowRoot?.querySelector("input");
|
|
42
45
|
// Verify the displayed text shows the label "Apple", not the value "apple"
|
|
43
|
-
expect(input?.value).toBe(
|
|
46
|
+
expect(input?.value).toBe("Apple");
|
|
44
47
|
// Verify the combobox value is "apple"
|
|
45
|
-
expect(el.value).toBe(
|
|
48
|
+
expect(el.value).toBe("apple");
|
|
46
49
|
});
|
|
47
|
-
test(
|
|
50
|
+
test("filters options by label, not value", async () => {
|
|
48
51
|
const options = [
|
|
49
|
-
{ value:
|
|
50
|
-
{ value:
|
|
51
|
-
{ value:
|
|
52
|
+
{ value: "us", label: "United States" },
|
|
53
|
+
{ value: "uk", label: "United Kingdom" },
|
|
54
|
+
{ value: "no", label: "Norway" },
|
|
52
55
|
];
|
|
53
56
|
const component = html `<w-combobox
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
data-testid="combobox"
|
|
58
|
+
open-on-focus
|
|
59
|
+
.options="${options}"
|
|
60
|
+
></w-combobox>`;
|
|
58
61
|
const page = render(component);
|
|
59
|
-
const locator = page.getByTestId(
|
|
62
|
+
const locator = page.getByTestId("combobox");
|
|
60
63
|
await expect.element(locator).toBeVisible();
|
|
61
64
|
const el = (await locator.element());
|
|
62
65
|
// Get the textfield's input element
|
|
63
|
-
const textfield = el.shadowRoot?.querySelector(
|
|
64
|
-
const input = textfield?.shadowRoot?.querySelector(
|
|
66
|
+
const textfield = el.shadowRoot?.querySelector("w-textfield");
|
|
67
|
+
const input = textfield?.shadowRoot?.querySelector("input");
|
|
65
68
|
// Type "United" which should match labels "United States" and "United Kingdom"
|
|
66
69
|
// but NOT match any values (us, uk, no)
|
|
67
70
|
input?.focus();
|
|
68
|
-
input.value =
|
|
69
|
-
input.dispatchEvent(new InputEvent(
|
|
71
|
+
input.value = "United";
|
|
72
|
+
input.dispatchEvent(new InputEvent("input", { bubbles: true, composed: true }));
|
|
70
73
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
71
74
|
// Check that the dropdown shows the matching options
|
|
72
75
|
const listbox = el.shadowRoot?.querySelector('[role="listbox"]');
|
|
73
76
|
const visibleOptions = listbox?.querySelectorAll('[role="option"]');
|
|
74
77
|
// Should show 2 options: "United States" and "United Kingdom"
|
|
75
78
|
expect(visibleOptions?.length).toBe(2);
|
|
76
|
-
const optionTexts = Array.from(visibleOptions || []
|
|
77
|
-
expect(optionTexts).toContain(
|
|
78
|
-
expect(optionTexts).toContain(
|
|
79
|
-
expect(optionTexts).not.toContain(
|
|
79
|
+
const optionTexts = Array.from(visibleOptions || [], (opt) => opt.textContent?.trim());
|
|
80
|
+
expect(optionTexts).toContain("United States");
|
|
81
|
+
expect(optionTexts).toContain("United Kingdom");
|
|
82
|
+
expect(optionTexts).not.toContain("Norway");
|
|
80
83
|
});
|
|
81
|
-
test(
|
|
84
|
+
test("displays option label in textfield but stores option value", async () => {
|
|
82
85
|
const optionsWithDifferentLabelAndValue = [
|
|
83
|
-
{ value:
|
|
84
|
-
{ value:
|
|
85
|
-
{ value:
|
|
86
|
+
{ value: "us", label: "United States" },
|
|
87
|
+
{ value: "uk", label: "United Kingdom" },
|
|
88
|
+
{ value: "no", label: "Norway" },
|
|
86
89
|
];
|
|
87
90
|
const component = html `<w-combobox
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
data-testid="combobox"
|
|
92
|
+
open-on-focus
|
|
93
|
+
.options="${optionsWithDifferentLabelAndValue}"
|
|
94
|
+
></w-combobox>`;
|
|
92
95
|
const page = render(component);
|
|
93
|
-
const locator = page.getByTestId(
|
|
96
|
+
const locator = page.getByTestId("combobox");
|
|
94
97
|
await expect.element(locator).toBeVisible();
|
|
95
98
|
const el = (await locator.element());
|
|
96
99
|
// Get the textfield's input element
|
|
97
|
-
const textfield = el.shadowRoot?.querySelector(
|
|
98
|
-
const input = textfield?.shadowRoot?.querySelector(
|
|
100
|
+
const textfield = el.shadowRoot?.querySelector("w-textfield");
|
|
101
|
+
const input = textfield?.shadowRoot?.querySelector("input");
|
|
99
102
|
// Focus to open the dropdown
|
|
100
103
|
input?.focus();
|
|
101
104
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
102
105
|
// Find and click the "Norway" option (which has value "no")
|
|
103
106
|
const listbox = el.shadowRoot?.querySelector('[role="listbox"]');
|
|
104
107
|
const options = listbox?.querySelectorAll('[role="option"]');
|
|
105
|
-
const norwayOption =
|
|
108
|
+
const norwayOption = [...(options || [])].find((opt) => opt.textContent?.trim() === "Norway");
|
|
106
109
|
expect(norwayOption).toBeDefined();
|
|
107
110
|
// Simulate mousedown on the option
|
|
108
|
-
norwayOption?.dispatchEvent(new MouseEvent(
|
|
111
|
+
norwayOption?.dispatchEvent(new MouseEvent("mousedown", { bubbles: true }));
|
|
109
112
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
110
113
|
// Verify the displayed text is the label "Norway", not the value "no"
|
|
111
|
-
expect(input?.value).toBe(
|
|
114
|
+
expect(input?.value).toBe("Norway");
|
|
112
115
|
// Verify the combobox value is "no", not "Norway"
|
|
113
|
-
expect(el.value).toBe(
|
|
116
|
+
expect(el.value).toBe("no");
|
|
114
117
|
});
|
|
115
|
-
test(
|
|
118
|
+
test("announces suggestion count when opened on focus with empty input", async () => {
|
|
116
119
|
const options = [
|
|
117
|
-
{ value:
|
|
118
|
-
{ value:
|
|
119
|
-
{ value:
|
|
120
|
+
{ value: "apple", label: "Apple" },
|
|
121
|
+
{ value: "banana", label: "Banana" },
|
|
122
|
+
{ value: "orange", label: "Orange" },
|
|
120
123
|
];
|
|
121
124
|
const component = html `<w-combobox
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
data-testid="combobox"
|
|
126
|
+
open-on-focus
|
|
127
|
+
.options="${options}"
|
|
128
|
+
></w-combobox>`;
|
|
129
|
+
const page = render(component);
|
|
130
|
+
const locator = page.getByTestId("combobox");
|
|
131
|
+
await expect.element(locator).toBeVisible();
|
|
132
|
+
const el = (await locator.element());
|
|
133
|
+
const textfield = el.shadowRoot?.querySelector("w-textfield");
|
|
134
|
+
const input = textfield?.shadowRoot?.querySelector("input");
|
|
135
|
+
input?.focus();
|
|
136
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
137
|
+
const statusText = el.shadowRoot
|
|
138
|
+
?.querySelector('[role="status"]')
|
|
139
|
+
?.textContent?.trim();
|
|
140
|
+
expect(statusText).toBe("3 suggestions");
|
|
141
|
+
});
|
|
142
|
+
test("renders light-DOM option children in the generated popup", async () => {
|
|
143
|
+
const component = html `
|
|
144
|
+
<w-combobox data-testid="combobox" open-on-focus>
|
|
145
|
+
<option value="no">Norway</option>
|
|
146
|
+
<option value="se">Sweden</option>
|
|
147
|
+
<option value="dk">Denmark</option>
|
|
148
|
+
</w-combobox>
|
|
149
|
+
`;
|
|
126
150
|
const page = render(component);
|
|
127
|
-
const locator = page.getByTestId(
|
|
151
|
+
const locator = page.getByTestId("combobox");
|
|
128
152
|
await expect.element(locator).toBeVisible();
|
|
129
153
|
const el = (await locator.element());
|
|
130
|
-
const
|
|
131
|
-
|
|
154
|
+
const input = el.shadowRoot
|
|
155
|
+
?.querySelector("w-textfield")
|
|
156
|
+
?.shadowRoot?.querySelector("input");
|
|
132
157
|
input?.focus();
|
|
133
158
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
134
|
-
const
|
|
135
|
-
|
|
159
|
+
const visibleOptions = el.shadowRoot?.querySelectorAll('[role="listbox"] [role="option"]');
|
|
160
|
+
const optionTexts = Array.from(visibleOptions || [], (opt) => opt.textContent?.trim());
|
|
161
|
+
expect(optionTexts).toEqual(["Norway", "Sweden", "Denmark"]);
|
|
162
|
+
});
|
|
163
|
+
test("filters light-DOM options by label attribute and stores option value on select", async () => {
|
|
164
|
+
const component = html `
|
|
165
|
+
<w-combobox data-testid="combobox" open-on-focus>
|
|
166
|
+
<option value="us" label="United States">US</option>
|
|
167
|
+
<option value="uk" label="United Kingdom">UK</option>
|
|
168
|
+
<option value="no">Norway</option>
|
|
169
|
+
</w-combobox>
|
|
170
|
+
`;
|
|
171
|
+
const page = render(component);
|
|
172
|
+
const locator = page.getByTestId("combobox");
|
|
173
|
+
await expect.element(locator).toBeVisible();
|
|
174
|
+
const el = (await locator.element());
|
|
175
|
+
const input = el.shadowRoot
|
|
176
|
+
?.querySelector("w-textfield")
|
|
177
|
+
?.shadowRoot?.querySelector("input");
|
|
178
|
+
const selectEvents = [];
|
|
179
|
+
el.addEventListener("select", (event) => selectEvents.push(event));
|
|
180
|
+
input.focus();
|
|
181
|
+
input.value = "United";
|
|
182
|
+
input.dispatchEvent(new InputEvent("input", { bubbles: true, composed: true }));
|
|
183
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
184
|
+
const visibleOptions = el.shadowRoot?.querySelectorAll('[role="listbox"] [role="option"]');
|
|
185
|
+
const optionTexts = Array.from(visibleOptions || [], (opt) => opt.textContent?.trim());
|
|
186
|
+
expect(optionTexts).toEqual(["United States", "United Kingdom"]);
|
|
187
|
+
visibleOptions?.[1]?.dispatchEvent(new MouseEvent("mousedown", { bubbles: true }));
|
|
188
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
189
|
+
expect(input.value).toBe("United Kingdom");
|
|
190
|
+
expect(el.value).toBe("uk");
|
|
191
|
+
expect(selectEvents.at(-1)?.detail).toEqual({ value: "uk" });
|
|
192
|
+
});
|
|
193
|
+
test("uses light-DOM options to display an initial value label", async () => {
|
|
194
|
+
const component = html `
|
|
195
|
+
<w-combobox data-testid="combobox" value="no">
|
|
196
|
+
<option value="se">Sweden</option>
|
|
197
|
+
<option value="no">Norway</option>
|
|
198
|
+
</w-combobox>
|
|
199
|
+
`;
|
|
200
|
+
const page = render(component);
|
|
201
|
+
const locator = page.getByTestId("combobox");
|
|
202
|
+
await expect.element(locator).toBeVisible();
|
|
203
|
+
const el = (await locator.element());
|
|
204
|
+
const input = el.shadowRoot
|
|
205
|
+
?.querySelector("w-textfield")
|
|
206
|
+
?.shadowRoot?.querySelector("input");
|
|
207
|
+
expect(input.value).toBe("Norway");
|
|
208
|
+
expect(el.value).toBe("no");
|
|
209
|
+
});
|
|
210
|
+
test("syncs dynamic light-DOM option child changes", async () => {
|
|
211
|
+
const component = html `
|
|
212
|
+
<w-combobox data-testid="combobox" open-on-focus>
|
|
213
|
+
<option value="no">Norway</option>
|
|
214
|
+
<option value="se">Sweden</option>
|
|
215
|
+
</w-combobox>
|
|
216
|
+
`;
|
|
217
|
+
const page = render(component);
|
|
218
|
+
const locator = page.getByTestId("combobox");
|
|
219
|
+
await expect.element(locator).toBeVisible();
|
|
220
|
+
const el = (await locator.element());
|
|
221
|
+
const input = el.shadowRoot
|
|
222
|
+
?.querySelector("w-textfield")
|
|
223
|
+
?.shadowRoot?.querySelector("input");
|
|
224
|
+
const denmark = document.createElement("option");
|
|
225
|
+
denmark.value = "dk";
|
|
226
|
+
denmark.textContent = "Denmark";
|
|
227
|
+
el.appendChild(denmark);
|
|
228
|
+
const sweden = el.querySelector('option[value="se"]');
|
|
229
|
+
sweden?.remove();
|
|
230
|
+
const norway = el.querySelector('option[value="no"]');
|
|
231
|
+
norway?.setAttribute("value", "nor");
|
|
232
|
+
if (norway) {
|
|
233
|
+
norway.textContent = "Norge";
|
|
234
|
+
}
|
|
235
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
236
|
+
input.focus();
|
|
237
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
238
|
+
const visibleOptions = el.shadowRoot?.querySelectorAll('[role="listbox"] [role="option"]');
|
|
239
|
+
const optionTexts = Array.from(visibleOptions || [], (opt) => opt.textContent?.trim());
|
|
240
|
+
expect(optionTexts).toEqual(["Norge", "Denmark"]);
|
|
241
|
+
});
|
|
242
|
+
test("non-empty options property takes precedence over light-DOM option children", async () => {
|
|
243
|
+
const options = [{ value: "apple", label: "Apple" }];
|
|
244
|
+
const component = html `
|
|
245
|
+
<w-combobox data-testid="combobox" open-on-focus .options="${options}">
|
|
246
|
+
<option value="banana">Banana</option>
|
|
247
|
+
</w-combobox>
|
|
248
|
+
`;
|
|
249
|
+
const page = render(component);
|
|
250
|
+
const locator = page.getByTestId("combobox");
|
|
251
|
+
await expect.element(locator).toBeVisible();
|
|
252
|
+
const el = (await locator.element());
|
|
253
|
+
const input = el.shadowRoot
|
|
254
|
+
?.querySelector("w-textfield")
|
|
255
|
+
?.shadowRoot?.querySelector("input");
|
|
256
|
+
input.focus();
|
|
257
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
258
|
+
const visibleOptions = el.shadowRoot?.querySelectorAll('[role="listbox"] [role="option"]');
|
|
259
|
+
const optionTexts = Array.from(visibleOptions || [], (opt) => opt.textContent?.trim());
|
|
260
|
+
expect(optionTexts).toEqual(["Apple"]);
|
|
136
261
|
});
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { WarpCombobox } from
|
|
3
|
-
export declare const Combobox: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<WarpCombobox>, "value" | "form" | "label" | "name" | "disabled" | "invalid" | "helpText" | "
|
|
4
|
-
onSelect?: (e:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { WarpCombobox } from "./combobox.js";
|
|
3
|
+
export declare const Combobox: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<WarpCombobox>, "value" | "form" | "label" | "autocomplete" | "name" | "disabled" | "invalid" | "helpText" | "optional" | "placeholder" | "required" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onchange" | "onselect" | "updated" | "firstUpdated" | "resetFormControl" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "onChange" | "onSelect" | "options" | "openOnFocus" | "selectOnBlur" | "matchTextSegments" | "disableStaticFiltering"> & {
|
|
4
|
+
onSelect?: ((e: CustomEvent<{
|
|
5
|
+
value: string;
|
|
6
|
+
}>) => void) | undefined;
|
|
7
|
+
onselect?: ((e: CustomEvent<{
|
|
8
|
+
value: string;
|
|
9
|
+
}>) => void) | undefined;
|
|
10
|
+
onChange?: ((e: CustomEvent<{
|
|
11
|
+
value: string;
|
|
12
|
+
}>) => void) | undefined;
|
|
13
|
+
onchange?: ((e: CustomEvent<{
|
|
14
|
+
value: string;
|
|
15
|
+
}>) => void) | undefined;
|
|
8
16
|
} & Partial<Omit<WarpCombobox, keyof HTMLElement>> & React.RefAttributes<WarpCombobox>, "ref">, "help-text" | "open-on-focus" | "select-on-blur" | "match-text-segments" | "disable-static-filtering"> & {
|
|
9
17
|
openOnFocus?: boolean;
|
|
10
18
|
selectOnBlur?: boolean;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { createComponent } from
|
|
2
|
-
import { LitElement } from
|
|
3
|
-
import React from
|
|
1
|
+
import { createComponent } from "@lit/react";
|
|
2
|
+
import { LitElement } from "lit";
|
|
3
|
+
import React from "react";
|
|
4
4
|
// decouple from CDN by providing a dummy class
|
|
5
5
|
class Component extends LitElement {
|
|
6
6
|
}
|
|
7
7
|
const BaseCombobox = createComponent({
|
|
8
|
-
tagName:
|
|
8
|
+
tagName: "w-combobox",
|
|
9
9
|
elementClass: Component,
|
|
10
10
|
react: React,
|
|
11
11
|
events: {
|
|
12
|
-
onSelect:
|
|
13
|
-
onselect:
|
|
14
|
-
onChange:
|
|
15
|
-
onchange:
|
|
12
|
+
onSelect: "select",
|
|
13
|
+
onselect: "select",
|
|
14
|
+
onChange: "change",
|
|
15
|
+
onchange: "change",
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
export const Combobox = React.forwardRef(({ openOnFocus, selectOnBlur, matchTextSegments, disableStaticFiltering, helpText, ...props }, ref) => React.createElement(BaseCombobox, {
|
|
19
19
|
...props,
|
|
20
|
-
...(openOnFocus ? {
|
|
21
|
-
...(selectOnBlur ? {
|
|
22
|
-
...(matchTextSegments ? {
|
|
23
|
-
...(disableStaticFiltering ? {
|
|
24
|
-
...(helpText !== undefined ? {
|
|
20
|
+
...(openOnFocus ? { "open-on-focus": true } : {}),
|
|
21
|
+
...(selectOnBlur ? { "select-on-blur": true } : {}),
|
|
22
|
+
...(matchTextSegments ? { "match-text-segments": true } : {}),
|
|
23
|
+
...(disableStaticFiltering ? { "disable-static-filtering": true } : {}),
|
|
24
|
+
...(helpText !== undefined ? { "help-text": helpText } : {}),
|
|
25
25
|
ref,
|
|
26
26
|
}));
|
|
27
|
-
Combobox.displayName =
|
|
27
|
+
Combobox.displayName = "Combobox";
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const styles =
|
|
3
|
-
.z-0{z-index:0;}.z-20{z-index:20;}`;
|
|
1
|
+
import { unsafeCSS } from "lit";
|
|
2
|
+
export const styles = unsafeCSS("*,: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}.rounded-8{border-radius:8px}.block{display:block}.overflow-hidden{overflow:hidden}.list-none{list-style-type:none}.left-0{left:0}.right-0{right:0}.absolute{position:absolute}.relative{position:relative}.static{position:static}.z-0{z-index:0}.z-20{z-index:20}.s-bg{background-color:var(--w-s-color-background)}.s-bg-selected{background-color:var(--w-s-color-background-selected)}.hover\\:s-bg-hover:hover{background-color:var(--w-s-color-background-hover)}.hover\\:s-bg-selected-hover:hover{background-color:var(--w-s-color-background-selected-hover)}.shadow-m{box-shadow:var(--w-shadow-m)}.m-0{margin:0}.p-0{padding:0}.p-8{padding:.8rem}.pb-4{padding-bottom:.4rem}.visible{visibility:visible}.cursor-pointer{cursor:pointer}.font-bold{font-weight:700}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.select-none{-webkit-user-select:none;user-select:none}");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "../button/button.js";
|
|
2
|
+
import "./datepicker.js";
|
|
@@ -1,58 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { render } from
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { DatePicker } from
|
|
8
|
-
test(
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { expect, test, vi } from "vitest";
|
|
3
|
+
import { server, userEvent } from "vitest/browser";
|
|
4
|
+
import { render } from "vitest-browser-react";
|
|
5
|
+
import "../button/button.js";
|
|
6
|
+
import "./datepicker.js";
|
|
7
|
+
import { DatePicker } from "./react.js";
|
|
8
|
+
test("renders the date picker component", async () => {
|
|
9
9
|
const page = await render(React.createElement("form", null,
|
|
10
10
|
React.createElement(DatePicker, { label: "From date" })));
|
|
11
|
-
await expect.element(page.getByLabelText(
|
|
11
|
+
await expect.element(page.getByLabelText("From date")).toBeVisible();
|
|
12
12
|
});
|
|
13
|
-
test(
|
|
13
|
+
test("can pick a date using a pointer", async () => {
|
|
14
14
|
const page = await render(React.createElement("form", { "data-testid": "flight" },
|
|
15
15
|
React.createElement(DatePicker, { label: "From date", name: "from" })));
|
|
16
|
-
await expect.element(page.getByLabelText(
|
|
17
|
-
await page.getByRole(
|
|
18
|
-
await page.getByRole(
|
|
19
|
-
await expect.element(page.getByLabelText(
|
|
20
|
-
const formData = new FormData(page.getByTestId(
|
|
21
|
-
expect(formData.get(
|
|
16
|
+
await expect.element(page.getByLabelText("From date")).not.toHaveValue();
|
|
17
|
+
await page.getByRole("button").click({ force: true });
|
|
18
|
+
await page.getByRole("gridcell").nth(15).click();
|
|
19
|
+
await expect.element(page.getByLabelText("From date")).toHaveValue();
|
|
20
|
+
const formData = new FormData(page.getByTestId("flight").element());
|
|
21
|
+
expect(formData.get("from")).toBeTruthy();
|
|
22
22
|
});
|
|
23
|
-
test.skipIf(server.browser ===
|
|
23
|
+
test.skipIf(server.browser === "firefox")("can pick a date using keyboard", async () => {
|
|
24
24
|
const page = await render(React.createElement("form", { "data-testid": "flight" },
|
|
25
25
|
React.createElement(DatePicker, { label: "From date", name: "from" })));
|
|
26
|
-
await expect.element(page.getByLabelText(
|
|
27
|
-
await expect
|
|
28
|
-
|
|
26
|
+
await expect.element(page.getByLabelText("From date")).not.toHaveValue();
|
|
27
|
+
await expect
|
|
28
|
+
.element(page.getByTestId("calendar").query())
|
|
29
|
+
.not.toBeVisible();
|
|
30
|
+
const toggle = page.getByRole("button").element();
|
|
29
31
|
toggle.focus();
|
|
30
|
-
await userEvent.keyboard(
|
|
31
|
-
await expect.element(page.getByTestId(
|
|
32
|
-
page.getByRole(
|
|
33
|
-
await userEvent.keyboard(
|
|
32
|
+
await userEvent.keyboard("[Enter]");
|
|
33
|
+
await expect.element(page.getByTestId("calendar")).toBeVisible();
|
|
34
|
+
page.getByRole("gridcell").nth(15).element().focus();
|
|
35
|
+
await userEvent.keyboard("[Enter]");
|
|
34
36
|
await expect
|
|
35
|
-
.element(page.getByTestId(
|
|
37
|
+
.element(page.getByTestId("calendar").query(), {
|
|
38
|
+
message: "expected calendar to close after clicking a date",
|
|
39
|
+
})
|
|
36
40
|
.not.toBeVisible();
|
|
37
|
-
await expect.element(page.getByLabelText(
|
|
38
|
-
const formData = new FormData(page.getByTestId(
|
|
39
|
-
expect(formData.get(
|
|
41
|
+
await expect.element(page.getByLabelText("From date")).toHaveValue();
|
|
42
|
+
const formData = new FormData(page.getByTestId("flight").element());
|
|
43
|
+
expect(formData.get("from")).toBeTruthy();
|
|
40
44
|
});
|
|
41
|
-
test(
|
|
45
|
+
test("can pick a date by typing in the input field", async () => {
|
|
42
46
|
const page = await render(React.createElement("form", { "data-testid": "flight" },
|
|
43
47
|
React.createElement(DatePicker, { label: "From date", name: "from" })));
|
|
44
|
-
await expect.element(page.getByLabelText(
|
|
45
|
-
const toggle = page.getByLabelText(
|
|
48
|
+
await expect.element(page.getByLabelText("From date")).not.toHaveValue();
|
|
49
|
+
const toggle = page.getByLabelText("From date").element();
|
|
46
50
|
toggle.focus();
|
|
47
|
-
await page.getByLabelText(
|
|
48
|
-
await expect.element(page.getByLabelText(
|
|
49
|
-
const formData = new FormData(page.getByTestId(
|
|
50
|
-
expect(formData.get(
|
|
51
|
+
await page.getByLabelText("From date").fill("2025-01-01");
|
|
52
|
+
await expect.element(page.getByLabelText("From date")).toHaveValue();
|
|
53
|
+
const formData = new FormData(page.getByTestId("flight").element());
|
|
54
|
+
expect(formData.get("from")).toBeTruthy();
|
|
51
55
|
});
|
|
52
|
-
test(
|
|
56
|
+
test("allows for the controlled component pattern", async () => {
|
|
53
57
|
const spy = vi.fn();
|
|
54
58
|
const TestComponent = () => {
|
|
55
|
-
const [value, setValue] = useState(
|
|
59
|
+
const [value, setValue] = useState("");
|
|
56
60
|
return (React.createElement("form", { "data-testid": "flight" },
|
|
57
61
|
React.createElement(DatePicker, { label: "From date", name: "from", value: value, onChange: (e) => {
|
|
58
62
|
const nextValue = e.target.value;
|
|
@@ -61,9 +65,12 @@ test('allows for the controlled component pattern', async () => {
|
|
|
61
65
|
} })));
|
|
62
66
|
};
|
|
63
67
|
const page = await render(React.createElement(TestComponent, null));
|
|
64
|
-
await page.getByRole(
|
|
65
|
-
await page.getByRole(
|
|
66
|
-
await expect.element(page.getByLabelText(
|
|
67
|
-
//
|
|
68
|
-
|
|
68
|
+
await page.getByRole("button").click({ force: true });
|
|
69
|
+
await page.getByRole("gridcell").nth(15).click();
|
|
70
|
+
await expect.element(page.getByLabelText("From date")).toHaveValue();
|
|
71
|
+
// Controlled consumers should receive the ISO value, even when the visible input text is localized.
|
|
72
|
+
const selectedValue = spy.mock.calls.at(-1)?.[0];
|
|
73
|
+
expect(selectedValue).toMatch(/^\d{4}-\d{2}-\d{2}$/);
|
|
74
|
+
expect(document.querySelector("w-datepicker")
|
|
75
|
+
.value).toBe(selectedValue);
|
|
69
76
|
});
|