@techsio/ui-kit 0.3.2 → 0.4.0
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 +59 -6
- package/dist/.storybook/decorator.d.ts +12 -0
- package/dist/.storybook/decorator.d.ts.map +1 -0
- package/dist/.storybook/main.d.ts +4 -0
- package/dist/.storybook/main.d.ts.map +1 -0
- package/dist/.storybook/preview.d.ts +5 -0
- package/dist/.storybook/preview.d.ts.map +1 -0
- package/dist/.storybook/test-runner.d.ts +12 -0
- package/dist/.storybook/test-runner.d.ts.map +1 -0
- package/dist/atoms/badge.js +37 -19
- package/dist/atoms/button.js +167 -154
- package/dist/atoms/checkbox.js +52 -0
- package/dist/atoms/figma/badge.figma.js +33 -0
- package/dist/atoms/figma/button.figma.js +76 -0
- package/dist/atoms/figma/checkbox.figma.js +35 -0
- package/dist/atoms/figma/icon.figma.js +33 -0
- package/dist/atoms/figma/image.figma.js +21 -0
- package/dist/atoms/figma/input.figma.js +34 -0
- package/dist/atoms/figma/label.figma.js +25 -0
- package/dist/atoms/figma/link-button.figma.js +42 -0
- package/dist/atoms/figma/link.figma.js +15 -0
- package/dist/atoms/figma/numeric-input.figma.js +52 -0
- package/dist/atoms/figma/rating.figma.js +38 -0
- package/dist/atoms/figma/skeleton.figma.js +119 -0
- package/dist/atoms/figma/status-text.figma.js +27 -0
- package/dist/atoms/figma/textarea.figma.js +38 -0
- package/dist/atoms/figma/tooltip.figma.js +47 -0
- package/dist/atoms/icon.js +17 -17
- package/dist/atoms/image.js +22 -4
- package/dist/atoms/input.js +40 -34
- package/dist/atoms/label.js +10 -10
- package/dist/atoms/link-button.js +19 -18
- package/dist/atoms/link.js +6 -4
- package/dist/atoms/numeric-input.js +98 -70
- package/dist/atoms/rating.js +30 -30
- package/dist/atoms/skeleton.js +47 -47
- package/dist/atoms/status-text.js +75 -0
- package/dist/atoms/textarea.js +48 -42
- package/dist/atoms/tooltip.js +17 -17
- package/dist/molecules/accordion.js +58 -60
- package/dist/molecules/breadcrumb.js +206 -124
- package/dist/molecules/carousel.js +139 -87
- package/dist/molecules/color-select.js +56 -56
- package/dist/molecules/combobox.js +131 -104
- package/dist/molecules/dialog.js +97 -97
- package/dist/molecules/figma/accordion.figma.js +41 -0
- package/dist/molecules/figma/breadcrumb.figma.js +31 -0
- package/dist/molecules/figma/carousel.figma.js +34 -0
- package/dist/molecules/figma/combobox.figma.js +38 -0
- package/dist/molecules/figma/dialog.figma.js +24 -0
- package/dist/molecules/figma/form-checkbox.figma.js +41 -0
- package/dist/molecules/figma/form-input.figma.js +38 -0
- package/dist/molecules/figma/form-numeric-input.figma.js +67 -0
- package/dist/molecules/figma/form-textarea.figma.js +38 -0
- package/dist/molecules/figma/menu.figma.js +26 -0
- package/dist/molecules/figma/pagination.figma.js +22 -0
- package/dist/molecules/figma/popover.figma.js +38 -0
- package/dist/molecules/figma/product-card.figma.js +34 -0
- package/dist/molecules/figma/radio-card.figma.js +35 -0
- package/dist/molecules/figma/radio-group.figma.js +45 -0
- package/dist/molecules/figma/search-form.figma.js +24 -0
- package/dist/molecules/figma/select.figma.js +46 -0
- package/dist/molecules/figma/slider.figma.js +30 -0
- package/dist/molecules/figma/steps.figma.js +33 -0
- package/dist/molecules/figma/switch.figma.js +33 -0
- package/dist/molecules/figma/tabs.figma.js +46 -0
- package/dist/molecules/figma/toast.figma.js +34 -0
- package/dist/molecules/figma/tree-view.figma.js +30 -0
- package/dist/molecules/form-checkbox.js +121 -48
- package/dist/molecules/form-input.js +15 -27
- package/dist/molecules/form-numeric-input.js +11 -24
- package/dist/molecules/form-textarea.js +15 -27
- package/dist/molecules/menu.js +69 -67
- package/dist/molecules/pagination.js +112 -76
- package/dist/molecules/phone-input.js +654 -0
- package/dist/molecules/popover.js +221 -96
- package/dist/molecules/product-card.js +38 -37
- package/dist/molecules/radio-card.js +517 -0
- package/dist/molecules/radio-group.js +341 -0
- package/dist/molecules/search-form.js +170 -91
- package/dist/molecules/select.js +369 -141
- package/dist/molecules/slider.js +72 -85
- package/dist/molecules/steps.js +517 -152
- package/dist/molecules/switch.js +37 -43
- package/dist/molecules/tabs.js +63 -61
- package/dist/molecules/toast.js +32 -32
- package/dist/molecules/tree-view.js +89 -83
- package/dist/organisms/footer.js +50 -52
- package/dist/organisms/gallery.js +244 -0
- package/dist/organisms/header.js +60 -58
- package/dist/organisms/table.js +52 -52
- package/dist/src/atoms/badge.d.ts +27 -7
- package/dist/src/atoms/badge.d.ts.map +1 -1
- package/dist/src/atoms/button.d.ts +7 -6
- package/dist/src/atoms/button.d.ts.map +1 -1
- package/dist/src/atoms/checkbox.d.ts +11 -0
- package/dist/src/atoms/checkbox.d.ts.map +1 -0
- package/dist/src/atoms/figma/badge.figma.d.ts +2 -0
- package/dist/src/atoms/figma/badge.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/button.figma.d.ts +2 -0
- package/dist/src/atoms/figma/button.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/checkbox.figma.d.ts +2 -0
- package/dist/src/atoms/figma/checkbox.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/icon.figma.d.ts +2 -0
- package/dist/src/atoms/figma/icon.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/image.figma.d.ts +2 -0
- package/dist/src/atoms/figma/image.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/input.figma.d.ts +2 -0
- package/dist/src/atoms/figma/input.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/label.figma.d.ts +2 -0
- package/dist/src/atoms/figma/label.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/link-button.figma.d.ts +2 -0
- package/dist/src/atoms/figma/link-button.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/link.figma.d.ts +2 -0
- package/dist/src/atoms/figma/link.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/numeric-input.figma.d.ts +2 -0
- package/dist/src/atoms/figma/numeric-input.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/rating.figma.d.ts +2 -0
- package/dist/src/atoms/figma/rating.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/skeleton.figma.d.ts +2 -0
- package/dist/src/atoms/figma/skeleton.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/status-text.figma.d.ts +2 -0
- package/dist/src/atoms/figma/status-text.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/textarea.figma.d.ts +2 -0
- package/dist/src/atoms/figma/textarea.figma.d.ts.map +1 -0
- package/dist/src/atoms/figma/tooltip.figma.d.ts +2 -0
- package/dist/src/atoms/figma/tooltip.figma.d.ts.map +1 -0
- package/dist/src/atoms/icon.d.ts +6 -6
- package/dist/src/atoms/image.d.ts +35 -9
- package/dist/src/atoms/image.d.ts.map +1 -1
- package/dist/src/atoms/input.d.ts +3 -3
- package/dist/src/atoms/input.d.ts.map +1 -1
- package/dist/src/atoms/label.d.ts +2 -2
- package/dist/src/atoms/link-button.d.ts +71 -12
- package/dist/src/atoms/link-button.d.ts.map +1 -1
- package/dist/src/atoms/link.d.ts +5 -5
- package/dist/src/atoms/link.d.ts.map +1 -1
- package/dist/src/atoms/numeric-input.d.ts +23 -22
- package/dist/src/atoms/numeric-input.d.ts.map +1 -1
- package/dist/src/atoms/rating.d.ts +6 -5
- package/dist/src/atoms/rating.d.ts.map +1 -1
- package/dist/src/atoms/skeleton.d.ts +15 -15
- package/dist/src/atoms/skeleton.d.ts.map +1 -1
- package/dist/src/atoms/status-text.d.ts +97 -0
- package/dist/src/atoms/status-text.d.ts.map +1 -0
- package/dist/src/atoms/textarea.d.ts +3 -3
- package/dist/src/atoms/textarea.d.ts.map +1 -1
- package/dist/src/atoms/tooltip.d.ts +3 -3
- package/dist/src/atoms/tooltip.d.ts.map +1 -1
- package/dist/src/molecules/accordion.d.ts +14 -13
- package/dist/src/molecules/accordion.d.ts.map +1 -1
- package/dist/src/molecules/breadcrumb.d.ts +132 -35
- package/dist/src/molecules/breadcrumb.d.ts.map +1 -1
- package/dist/src/molecules/carousel.d.ts +67 -16
- package/dist/src/molecules/carousel.d.ts.map +1 -1
- package/dist/src/molecules/color-select.d.ts +4 -4
- package/dist/src/molecules/combobox.d.ts +36 -9
- package/dist/src/molecules/combobox.d.ts.map +1 -1
- package/dist/src/molecules/dialog.d.ts +3 -3
- package/dist/src/molecules/dialog.d.ts.map +1 -1
- package/dist/src/molecules/figma/accordion.figma.d.ts +2 -0
- package/dist/src/molecules/figma/accordion.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/breadcrumb.figma.d.ts +2 -0
- package/dist/src/molecules/figma/breadcrumb.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/carousel.figma.d.ts +2 -0
- package/dist/src/molecules/figma/carousel.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/combobox.figma.d.ts +2 -0
- package/dist/src/molecules/figma/combobox.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/dialog.figma.d.ts +2 -0
- package/dist/src/molecules/figma/dialog.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/form-checkbox.figma.d.ts +2 -0
- package/dist/src/molecules/figma/form-checkbox.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/form-input.figma.d.ts +2 -0
- package/dist/src/molecules/figma/form-input.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/form-numeric-input.figma.d.ts +2 -0
- package/dist/src/molecules/figma/form-numeric-input.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/form-textarea.figma.d.ts +2 -0
- package/dist/src/molecules/figma/form-textarea.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/menu.figma.d.ts +2 -0
- package/dist/src/molecules/figma/menu.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/pagination.figma.d.ts +2 -0
- package/dist/src/molecules/figma/pagination.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/popover.figma.d.ts +2 -0
- package/dist/src/molecules/figma/popover.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/product-card.figma.d.ts +2 -0
- package/dist/src/molecules/figma/product-card.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/radio-card.figma.d.ts +2 -0
- package/dist/src/molecules/figma/radio-card.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/radio-group.figma.d.ts +2 -0
- package/dist/src/molecules/figma/radio-group.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/search-form.figma.d.ts +2 -0
- package/dist/src/molecules/figma/search-form.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/select.figma.d.ts +2 -0
- package/dist/src/molecules/figma/select.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/slider.figma.d.ts +2 -0
- package/dist/src/molecules/figma/slider.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/steps.figma.d.ts +2 -0
- package/dist/src/molecules/figma/steps.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/switch.figma.d.ts +2 -0
- package/dist/src/molecules/figma/switch.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/tabs.figma.d.ts +2 -0
- package/dist/src/molecules/figma/tabs.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/toast.figma.d.ts +2 -0
- package/dist/src/molecules/figma/toast.figma.d.ts.map +1 -0
- package/dist/src/molecules/figma/tree-view.figma.d.ts +2 -0
- package/dist/src/molecules/figma/tree-view.figma.d.ts.map +1 -0
- package/dist/src/molecules/form-checkbox.d.ts +22 -12
- package/dist/src/molecules/form-checkbox.d.ts.map +1 -1
- package/dist/src/molecules/form-input.d.ts +8 -6
- package/dist/src/molecules/form-input.d.ts.map +1 -1
- package/dist/src/molecules/form-numeric-input.d.ts +6 -6
- package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
- package/dist/src/molecules/form-textarea.d.ts +8 -6
- package/dist/src/molecules/form-textarea.d.ts.map +1 -1
- package/dist/src/molecules/menu.d.ts +11 -11
- package/dist/src/molecules/menu.d.ts.map +1 -1
- package/dist/src/molecules/pagination.d.ts +37 -9
- package/dist/src/molecules/pagination.d.ts.map +1 -1
- package/dist/src/molecules/phone-input.d.ts +246 -0
- package/dist/src/molecules/phone-input.d.ts.map +1 -0
- package/dist/src/molecules/popover.d.ts +76 -24
- package/dist/src/molecules/popover.d.ts.map +1 -1
- package/dist/src/molecules/product-card.d.ts +11 -10
- package/dist/src/molecules/product-card.d.ts.map +1 -1
- package/dist/src/molecules/radio-card.d.ts +429 -0
- package/dist/src/molecules/radio-card.d.ts.map +1 -0
- package/dist/src/molecules/radio-group.d.ts +245 -0
- package/dist/src/molecules/radio-group.d.ts.map +1 -0
- package/dist/src/molecules/search-form.d.ts +94 -27
- package/dist/src/molecules/search-form.d.ts.map +1 -1
- package/dist/src/molecules/select.d.ts +124 -30
- package/dist/src/molecules/select.d.ts.map +1 -1
- package/dist/src/molecules/slider.d.ts +9 -12
- package/dist/src/molecules/slider.d.ts.map +1 -1
- package/dist/src/molecules/steps.d.ts +236 -64
- package/dist/src/molecules/steps.d.ts.map +1 -1
- package/dist/src/molecules/switch.d.ts +7 -7
- package/dist/src/molecules/switch.d.ts.map +1 -1
- package/dist/src/molecules/tabs.d.ts +10 -10
- package/dist/src/molecules/tabs.d.ts.map +1 -1
- package/dist/src/molecules/toast.d.ts +6 -6
- package/dist/src/molecules/tree-view.d.ts +14 -14
- package/dist/src/molecules/tree-view.d.ts.map +1 -1
- package/dist/src/organisms/footer.d.ts +15 -6
- package/dist/src/organisms/footer.d.ts.map +1 -1
- package/dist/src/organisms/gallery.d.ts +147 -0
- package/dist/src/organisms/gallery.d.ts.map +1 -0
- package/dist/src/organisms/header.d.ts +9 -9
- package/dist/src/organisms/header.d.ts.map +1 -1
- package/dist/src/organisms/table.d.ts +10 -10
- package/dist/src/organisms/table.d.ts.map +1 -1
- package/dist/src/templates/accordion.d.ts +3 -3
- package/dist/src/templates/breadcrumb.d.ts +28 -0
- package/dist/src/templates/breadcrumb.d.ts.map +1 -0
- package/dist/src/templates/carousel.d.ts +4 -4
- package/dist/src/templates/carousel.d.ts.map +1 -1
- package/dist/src/templates/gallery.d.ts +43 -0
- package/dist/src/templates/gallery.d.ts.map +1 -0
- package/dist/src/templates/numeric-input.d.ts +5 -5
- package/dist/src/templates/popover.d.ts +19 -0
- package/dist/src/templates/popover.d.ts.map +1 -0
- package/dist/src/templates/product-card.d.ts +4 -4
- package/dist/src/templates/select.d.ts +22 -0
- package/dist/src/templates/select.d.ts.map +1 -0
- package/dist/src/templates/tabs.d.ts +4 -4
- package/dist/src/types/zag.d.ts +19 -18
- package/dist/src/types/zag.d.ts.map +1 -1
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/stories/atoms/badge.stories.d.ts +12 -0
- package/dist/stories/atoms/badge.stories.d.ts.map +1 -0
- package/dist/stories/atoms/button.stories.d.ts +12 -0
- package/dist/stories/atoms/button.stories.d.ts.map +1 -0
- package/dist/stories/atoms/checkbox.stories.d.ts +56 -0
- package/dist/stories/atoms/checkbox.stories.d.ts.map +1 -0
- package/dist/stories/atoms/icon.stories.d.ts +11 -0
- package/dist/stories/atoms/icon.stories.d.ts.map +1 -0
- package/dist/stories/atoms/image.stories.d.ts +8 -0
- package/dist/stories/atoms/image.stories.d.ts.map +1 -0
- package/dist/stories/atoms/input.stories.d.ts +8 -0
- package/dist/stories/atoms/input.stories.d.ts.map +1 -0
- package/dist/stories/atoms/numeric-input.stories.d.ts +23 -0
- package/dist/stories/atoms/numeric-input.stories.d.ts.map +1 -0
- package/dist/stories/atoms/rating.stories.d.ts +10 -0
- package/dist/stories/atoms/rating.stories.d.ts.map +1 -0
- package/dist/stories/atoms/skeleton.stories.d.ts +34 -0
- package/dist/stories/atoms/skeleton.stories.d.ts.map +1 -0
- package/dist/stories/atoms/status-text.stories.d.ts +15 -0
- package/dist/stories/atoms/status-text.stories.d.ts.map +1 -0
- package/dist/stories/atoms/textarea.stories.d.ts +12 -0
- package/dist/stories/atoms/textarea.stories.d.ts.map +1 -0
- package/dist/stories/atoms/tooltip.stories.d.ts +28 -0
- package/dist/stories/atoms/tooltip.stories.d.ts.map +1 -0
- package/dist/stories/helpers/icon-options.d.ts +4 -0
- package/dist/stories/helpers/icon-options.d.ts.map +1 -0
- package/dist/stories/molecules/accordion.stories.d.ts +14 -0
- package/dist/stories/molecules/accordion.stories.d.ts.map +1 -0
- package/dist/stories/molecules/breadcrumb.stories.d.ts +14 -0
- package/dist/stories/molecules/breadcrumb.stories.d.ts.map +1 -0
- package/dist/stories/molecules/carousel.stories.d.ts +19 -0
- package/dist/stories/molecules/carousel.stories.d.ts.map +1 -0
- package/dist/stories/molecules/color-select.stories.d.ts +12 -0
- package/dist/stories/molecules/color-select.stories.d.ts.map +1 -0
- package/dist/stories/molecules/combobox.stories.d.ts +11 -0
- package/dist/stories/molecules/combobox.stories.d.ts.map +1 -0
- package/dist/stories/molecules/dialog.stories.d.ts +19 -0
- package/dist/stories/molecules/dialog.stories.d.ts.map +1 -0
- package/dist/stories/molecules/form-checkbox.stories.d.ts +17 -0
- package/dist/stories/molecules/form-checkbox.stories.d.ts.map +1 -0
- package/dist/stories/molecules/form-input.stories.d.ts +12 -0
- package/dist/stories/molecules/form-input.stories.d.ts.map +1 -0
- package/dist/stories/molecules/form-numeric-input.stories.d.ts +17 -0
- package/dist/stories/molecules/form-numeric-input.stories.d.ts.map +1 -0
- package/dist/stories/molecules/form-textarea.stories.d.ts +12 -0
- package/dist/stories/molecules/form-textarea.stories.d.ts.map +1 -0
- package/dist/stories/molecules/menu.stories.d.ts +22 -0
- package/dist/stories/molecules/menu.stories.d.ts.map +1 -0
- package/dist/stories/molecules/pagination.stories.d.ts +13 -0
- package/dist/stories/molecules/pagination.stories.d.ts.map +1 -0
- package/dist/stories/molecules/phone-input.stories.d.ts +19 -0
- package/dist/stories/molecules/phone-input.stories.d.ts.map +1 -0
- package/dist/stories/molecules/popover.stories.d.ts +140 -0
- package/dist/stories/molecules/popover.stories.d.ts.map +1 -0
- package/dist/stories/molecules/product-card.stories.d.ts +41 -0
- package/dist/stories/molecules/product-card.stories.d.ts.map +1 -0
- package/dist/stories/molecules/radio-card.stories.d.ts +13 -0
- package/dist/stories/molecules/radio-card.stories.d.ts.map +1 -0
- package/dist/stories/molecules/radio-group.stories.d.ts +13 -0
- package/dist/stories/molecules/radio-group.stories.d.ts.map +1 -0
- package/dist/stories/molecules/search-form.stories.d.ts +16 -0
- package/dist/stories/molecules/search-form.stories.d.ts.map +1 -0
- package/dist/stories/molecules/select.stories.d.ts +19 -0
- package/dist/stories/molecules/select.stories.d.ts.map +1 -0
- package/dist/stories/molecules/slider.stories.d.ts +19 -0
- package/dist/stories/molecules/slider.stories.d.ts.map +1 -0
- package/dist/stories/molecules/steps.stories.d.ts +19 -0
- package/dist/stories/molecules/steps.stories.d.ts.map +1 -0
- package/dist/stories/molecules/switch.stories.d.ts +13 -0
- package/dist/stories/molecules/switch.stories.d.ts.map +1 -0
- package/dist/stories/molecules/tabs.stories.d.ts +18 -0
- package/dist/stories/molecules/tabs.stories.d.ts.map +1 -0
- package/dist/stories/molecules/toast.stories.d.ts +11 -0
- package/dist/stories/molecules/toast.stories.d.ts.map +1 -0
- package/dist/stories/molecules/tree-view.stories.d.ts +17 -0
- package/dist/stories/molecules/tree-view.stories.d.ts.map +1 -0
- package/dist/stories/organisms/footer.stories.d.ts +12 -0
- package/dist/stories/organisms/footer.stories.d.ts.map +1 -0
- package/dist/stories/organisms/gallery.stories.d.ts +73 -0
- package/dist/stories/organisms/gallery.stories.d.ts.map +1 -0
- package/dist/stories/organisms/header.stories.d.ts +12 -0
- package/dist/stories/organisms/header.stories.d.ts.map +1 -0
- package/dist/stories/organisms/table.stories.d.ts +56 -0
- package/dist/stories/organisms/table.stories.d.ts.map +1 -0
- package/dist/stories/overview/apca-contrast-test.stories.d.ts +8 -0
- package/dist/stories/overview/apca-contrast-test.stories.d.ts.map +1 -0
- package/dist/stories/overview/color-palette.stories.d.ts +8 -0
- package/dist/stories/overview/color-palette.stories.d.ts.map +1 -0
- package/dist/stories/overview/component-comparison.stories.d.ts +6 -0
- package/dist/stories/overview/component-comparison.stories.d.ts.map +1 -0
- package/dist/stories/templates/accordion.stories.d.ts +8 -0
- package/dist/stories/templates/accordion.stories.d.ts.map +1 -0
- package/dist/stories/templates/breadcrumb.stories.d.ts +12 -0
- package/dist/stories/templates/breadcrumb.stories.d.ts.map +1 -0
- package/dist/stories/templates/carousel.stories.d.ts +8 -0
- package/dist/stories/templates/carousel.stories.d.ts.map +1 -0
- package/dist/stories/templates/comprehensive-form.stories.d.ts +26 -0
- package/dist/stories/templates/comprehensive-form.stories.d.ts.map +1 -0
- package/dist/stories/templates/gallery.stories.d.ts +7 -0
- package/dist/stories/templates/gallery.stories.d.ts.map +1 -0
- package/dist/stories/templates/numeric-input.stories.d.ts +8 -0
- package/dist/stories/templates/numeric-input.stories.d.ts.map +1 -0
- package/dist/stories/templates/popover.stories.d.ts +55 -0
- package/dist/stories/templates/popover.stories.d.ts.map +1 -0
- package/dist/stories/templates/product-card.stories.d.ts +10 -0
- package/dist/stories/templates/product-card.stories.d.ts.map +1 -0
- package/dist/stories/templates/select.stories.d.ts +10 -0
- package/dist/stories/templates/select.stories.d.ts.map +1 -0
- package/dist/stories/templates/tabs.stories.d.ts +8 -0
- package/dist/stories/templates/tabs.stories.d.ts.map +1 -0
- package/dist/templates/accordion.js +9 -9
- package/dist/templates/breadcrumb.js +78 -0
- package/dist/templates/carousel.js +13 -15
- package/dist/templates/gallery.js +89 -0
- package/dist/templates/numeric-input.js +4 -4
- package/dist/templates/popover.js +35 -0
- package/dist/templates/product-card.js +10 -10
- package/dist/templates/select.js +43 -0
- package/dist/templates/tabs.js +8 -8
- package/dist/test/visual.spec.d.ts +2 -0
- package/dist/test/visual.spec.d.ts.map +1 -0
- package/dist/utils.js +1 -1
- package/package.json +41 -28
- package/src/tokens/_base.css +3 -3
- package/src/tokens/_layout.css +4 -0
- package/src/tokens/_semantic.css +49 -10
- package/src/tokens/_tokens-base.css +67 -0
- package/src/tokens/_typography.css +36 -6
- package/src/tokens/components/_form-control.css +67 -0
- package/src/tokens/components/atoms/_badge.css +16 -5
- package/src/tokens/components/atoms/_button.css +16 -10
- package/src/tokens/components/atoms/_checkbox.css +52 -0
- package/src/tokens/components/atoms/_icon.css +90 -2
- package/src/tokens/components/atoms/_image.css +5 -0
- package/src/tokens/components/atoms/_input.css +11 -32
- package/src/tokens/components/atoms/_label.css +11 -0
- package/src/tokens/components/atoms/_numeric-input.css +27 -13
- package/src/tokens/components/atoms/_rating.css +2 -2
- package/src/tokens/components/atoms/_status-text.css +32 -0
- package/src/tokens/components/atoms/_textarea.css +15 -17
- package/src/tokens/components/components.css +10 -1
- package/src/tokens/components/molecules/_accordion.css +1 -8
- package/src/tokens/components/molecules/_breadcrumb.css +42 -20
- package/src/tokens/components/molecules/_carousel.css +10 -2
- package/src/tokens/components/molecules/_color-select.css +3 -3
- package/src/tokens/components/molecules/_combobox.css +15 -21
- package/src/tokens/components/molecules/_dialog.css +0 -1
- package/src/tokens/components/molecules/_menu.css +0 -1
- package/src/tokens/components/molecules/_pagination.css +3 -3
- package/src/tokens/components/molecules/_phone-input.css +63 -0
- package/src/tokens/components/molecules/_popover.css +3 -0
- package/src/tokens/components/molecules/_product-card.css +9 -1
- package/src/tokens/components/molecules/_radio-card.css +197 -0
- package/src/tokens/components/molecules/_radio-group.css +150 -0
- package/src/tokens/components/molecules/_search-form.css +7 -3
- package/src/tokens/components/molecules/_select.css +41 -20
- package/src/tokens/components/molecules/_steps.css +115 -34
- package/src/tokens/components/molecules/_toast.css +5 -5
- package/src/tokens/components/molecules/_tree-view.css +5 -6
- package/src/tokens/components/organisms/_footer.css +1 -6
- package/src/tokens/components/organisms/_gallery.css +35 -0
- package/src/tokens/components/organisms/_header.css +8 -0
- package/src/tokens/figma/dark/variables.css +1406 -0
- package/src/tokens/figma/light/variables.css +1406 -0
- package/src/tokens/index.css +1 -65
- package/src/tokens/tokens-only.css +1 -64
- package/dist/atoms/error-text.js +0 -38
- package/dist/atoms/extra-text.js +0 -27
- package/dist/molecules/checkbox.js +0 -98
- package/dist/src/atoms/error-text.d.ts +0 -29
- package/dist/src/atoms/error-text.d.ts.map +0 -1
- package/dist/src/atoms/extra-text.d.ts +0 -27
- package/dist/src/atoms/extra-text.d.ts.map +0 -1
- package/dist/src/molecules/checkbox.d.ts +0 -19
- package/dist/src/molecules/checkbox.d.ts.map +0 -1
- package/src/tokens/components/molecules/_checkbox.css +0 -34
- package/src/tokens/components/molecules/index.css +0 -2
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { connect, machine } from "@zag-js/radio-group";
|
|
3
|
+
import { normalizeProps, useMachine } from "@zag-js/react";
|
|
4
|
+
import { createContext, useContext, useId } from "react";
|
|
5
|
+
import { Label } from "../atoms/label.js";
|
|
6
|
+
import { StatusText } from "../atoms/status-text.js";
|
|
7
|
+
import { tv } from "../utils.js";
|
|
8
|
+
const radioGroupVariants = tv({
|
|
9
|
+
slots: {
|
|
10
|
+
root: [
|
|
11
|
+
"flex w-full flex-col"
|
|
12
|
+
],
|
|
13
|
+
itemGroup: [
|
|
14
|
+
"relative flex",
|
|
15
|
+
"data-[orientation=horizontal]:flex-row",
|
|
16
|
+
"data-[orientation=horizontal]:flex-wrap",
|
|
17
|
+
"data-[orientation=vertical]:flex-col"
|
|
18
|
+
],
|
|
19
|
+
item: [
|
|
20
|
+
"grid grid-cols-(--radio-group-item-grid) items-start",
|
|
21
|
+
"cursor-pointer select-none",
|
|
22
|
+
"data-disabled:cursor-not-allowed",
|
|
23
|
+
"data-readonly:cursor-default"
|
|
24
|
+
],
|
|
25
|
+
itemControl: [
|
|
26
|
+
"row-start-1 self-center",
|
|
27
|
+
"inline-grid shrink-0 place-items-center rounded-radio-group-control",
|
|
28
|
+
"border-(length:--border-width-radio-group)",
|
|
29
|
+
"border-radio-group-item-control-border",
|
|
30
|
+
"bg-radio-group-item-control-bg",
|
|
31
|
+
"transition-colors duration-200 motion-reduce:transition-none",
|
|
32
|
+
"data-hover:bg-radio-group-item-control-bg-hover",
|
|
33
|
+
"data-hover:border-radio-group-item-control-border-hover",
|
|
34
|
+
"data-disabled:bg-radio-group-item-control-bg-disabled",
|
|
35
|
+
"data-disabled:border-radio-group-item-control-border-disabled",
|
|
36
|
+
"data-focus-visible:outline-(style:--default-ring-style)",
|
|
37
|
+
"data-focus-visible:outline-(length:--default-ring-width)",
|
|
38
|
+
"data-focus-visible:outline-radio-group-ring",
|
|
39
|
+
"data-focus-visible:outline-offset-(length:--default-ring-offset)",
|
|
40
|
+
"data-invalid:border-radio-group-item-control-border-error",
|
|
41
|
+
"data-invalid:outline-offset-(length:--default-ring-offset)"
|
|
42
|
+
],
|
|
43
|
+
itemContent: [
|
|
44
|
+
"col-start-2 row-start-1 min-w-0 flex flex-col"
|
|
45
|
+
],
|
|
46
|
+
itemIndicator: [
|
|
47
|
+
"pointer-events-none block leading-none",
|
|
48
|
+
"token-icon-radio-group-checked",
|
|
49
|
+
"opacity-0 transition-opacity duration-200 motion-reduce:transition-none",
|
|
50
|
+
"data-[state=checked]:opacity-100",
|
|
51
|
+
"data-disabled:data-[state=checked]:text-radio-group-item-indicator-disabled"
|
|
52
|
+
],
|
|
53
|
+
itemText: [
|
|
54
|
+
"min-w-0 text-radio-group-item-fg leading-normal",
|
|
55
|
+
"data-disabled:text-radio-group-item-fg-disabled"
|
|
56
|
+
],
|
|
57
|
+
itemDescription: [
|
|
58
|
+
"col-start-2 row-start-2 min-w-0 text-radio-group-item-description leading-normal",
|
|
59
|
+
"data-disabled:text-radio-group-item-description-disabled"
|
|
60
|
+
],
|
|
61
|
+
hiddenInput: "sr-only"
|
|
62
|
+
},
|
|
63
|
+
variants: {
|
|
64
|
+
variant: {
|
|
65
|
+
outline: {
|
|
66
|
+
itemControl: [
|
|
67
|
+
"data-[state=checked]:bg-radio-group-item-control-bg-outline-checked",
|
|
68
|
+
"data-[state=checked]:border-radio-group-item-control-border-outline-checked",
|
|
69
|
+
"data-hover:data-[state=checked]:bg-radio-group-item-control-bg-outline-checked-hover",
|
|
70
|
+
"data-hover:data-[state=checked]:border-radio-group-item-control-border-outline-checked-hover"
|
|
71
|
+
],
|
|
72
|
+
itemIndicator: "text-radio-group-item-indicator-outline"
|
|
73
|
+
},
|
|
74
|
+
subtle: {
|
|
75
|
+
itemControl: [
|
|
76
|
+
"data-[state=checked]:bg-radio-group-item-control-bg-subtle-checked",
|
|
77
|
+
"data-[state=checked]:border-radio-group-item-control-border-subtle-checked",
|
|
78
|
+
"data-hover:data-[state=checked]:bg-radio-group-item-control-bg-subtle-checked-hover",
|
|
79
|
+
"data-hover:data-[state=checked]:border-radio-group-item-control-border-subtle-checked-hover"
|
|
80
|
+
],
|
|
81
|
+
itemIndicator: "text-radio-group-item-indicator-subtle"
|
|
82
|
+
},
|
|
83
|
+
solid: {
|
|
84
|
+
itemControl: [
|
|
85
|
+
"data-[state=checked]:bg-radio-group-item-control-bg-solid-checked",
|
|
86
|
+
"data-[state=checked]:border-radio-group-item-control-border-solid-checked",
|
|
87
|
+
"data-hover:data-[state=checked]:bg-radio-group-item-control-bg-solid-checked-hover",
|
|
88
|
+
"data-hover:data-[state=checked]:border-radio-group-item-control-border-solid-checked-hover"
|
|
89
|
+
],
|
|
90
|
+
itemIndicator: "text-radio-group-item-indicator-solid"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
size: {
|
|
94
|
+
sm: {
|
|
95
|
+
root: "gap-radio-group-root-sm",
|
|
96
|
+
itemGroup: "data-[orientation=horizontal]:gap-radio-group-items-horizontal-sm data-[orientation=vertical]:gap-radio-group-items-vertical-sm",
|
|
97
|
+
item: "gap-x-radio-group-item-sm",
|
|
98
|
+
itemControl: "size-radio-group-control-sm",
|
|
99
|
+
itemContent: "gap-radio-group-item-content-sm",
|
|
100
|
+
itemIndicator: "size-radio-group-indicator-sm",
|
|
101
|
+
itemText: "text-radio-group-item-sm",
|
|
102
|
+
itemDescription: "text-radio-group-item-description-sm"
|
|
103
|
+
},
|
|
104
|
+
md: {
|
|
105
|
+
root: "gap-radio-group-root-md",
|
|
106
|
+
itemGroup: "data-[orientation=horizontal]:gap-radio-group-items-horizontal-md data-[orientation=vertical]:gap-radio-group-items-vertical-md",
|
|
107
|
+
item: "gap-x-radio-group-item-md",
|
|
108
|
+
itemControl: "size-radio-group-control-md",
|
|
109
|
+
itemContent: "gap-radio-group-item-content-md",
|
|
110
|
+
itemIndicator: "size-radio-group-indicator-md",
|
|
111
|
+
itemText: "text-radio-group-item-md",
|
|
112
|
+
itemDescription: "text-radio-group-item-description-md"
|
|
113
|
+
},
|
|
114
|
+
lg: {
|
|
115
|
+
root: "gap-radio-group-root-lg",
|
|
116
|
+
itemGroup: "data-[orientation=horizontal]:gap-radio-group-items-horizontal-lg data-[orientation=vertical]:gap-radio-group-items-vertical-lg",
|
|
117
|
+
item: "gap-x-radio-group-item-lg",
|
|
118
|
+
itemControl: "size-radio-group-control-lg",
|
|
119
|
+
itemContent: "gap-radio-group-item-content-lg",
|
|
120
|
+
itemIndicator: "size-radio-group-indicator-lg",
|
|
121
|
+
itemText: "text-radio-group-item-lg",
|
|
122
|
+
itemDescription: "text-radio-group-item-description-lg"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
defaultVariants: {
|
|
127
|
+
variant: "outline",
|
|
128
|
+
size: "md"
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const RadioGroupContext = /*#__PURE__*/ createContext(null);
|
|
132
|
+
function useRadioGroupContext() {
|
|
133
|
+
const context = useContext(RadioGroupContext);
|
|
134
|
+
if (!context) throw new Error("RadioGroup components must be used within RadioGroup");
|
|
135
|
+
return context;
|
|
136
|
+
}
|
|
137
|
+
const RadioGroupItemContext = /*#__PURE__*/ createContext(null);
|
|
138
|
+
function useRadioGroupItemContext() {
|
|
139
|
+
const context = useContext(RadioGroupItemContext);
|
|
140
|
+
if (!context) throw new Error("RadioGroup item components must be used within RadioGroup.Item");
|
|
141
|
+
return context;
|
|
142
|
+
}
|
|
143
|
+
function RadioGroup({ id: providedId, disabled = false, required = false, orientation = "vertical", validateStatus = "default", onValueChange, variant = "outline", size = "md", children, className, ref, ...machineProps }) {
|
|
144
|
+
const generatedId = useId();
|
|
145
|
+
const id = providedId || generatedId;
|
|
146
|
+
const invalid = "error" === validateStatus;
|
|
147
|
+
const service = useMachine(machine, {
|
|
148
|
+
...machineProps,
|
|
149
|
+
id,
|
|
150
|
+
disabled,
|
|
151
|
+
required,
|
|
152
|
+
orientation,
|
|
153
|
+
invalid,
|
|
154
|
+
onValueChange: ({ value: nextValue })=>{
|
|
155
|
+
onValueChange?.(nextValue);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
const api = connect(service, normalizeProps);
|
|
159
|
+
const styles = radioGroupVariants({
|
|
160
|
+
size,
|
|
161
|
+
variant
|
|
162
|
+
});
|
|
163
|
+
return /*#__PURE__*/ jsx(RadioGroupContext.Provider, {
|
|
164
|
+
value: {
|
|
165
|
+
api,
|
|
166
|
+
variant,
|
|
167
|
+
size,
|
|
168
|
+
orientation,
|
|
169
|
+
disabled,
|
|
170
|
+
required,
|
|
171
|
+
validateStatus
|
|
172
|
+
},
|
|
173
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
174
|
+
className: styles.root({
|
|
175
|
+
className
|
|
176
|
+
}),
|
|
177
|
+
ref: ref,
|
|
178
|
+
...api.getRootProps(),
|
|
179
|
+
children: children
|
|
180
|
+
})
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
RadioGroup.Label = function({ children, disabled, required, size: sizeProp, ...props }) {
|
|
184
|
+
const { api, size, disabled: groupDisabled, required: groupRequired } = useRadioGroupContext();
|
|
185
|
+
return /*#__PURE__*/ jsx(Label, {
|
|
186
|
+
disabled: disabled ?? groupDisabled,
|
|
187
|
+
required: required ?? groupRequired,
|
|
188
|
+
size: sizeProp ?? size,
|
|
189
|
+
...api.getLabelProps(),
|
|
190
|
+
...props,
|
|
191
|
+
children: children
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
RadioGroup.ItemGroup = function({ children, className, ref, ...props }) {
|
|
195
|
+
const { size, variant, orientation } = useRadioGroupContext();
|
|
196
|
+
const styles = radioGroupVariants({
|
|
197
|
+
size,
|
|
198
|
+
variant
|
|
199
|
+
});
|
|
200
|
+
return /*#__PURE__*/ jsx("div", {
|
|
201
|
+
className: styles.itemGroup({
|
|
202
|
+
className
|
|
203
|
+
}),
|
|
204
|
+
"data-orientation": orientation,
|
|
205
|
+
ref: ref,
|
|
206
|
+
...props,
|
|
207
|
+
children: children
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
RadioGroup.Item = function({ value, disabled, invalid, children, className, ref, ...props }) {
|
|
211
|
+
const { api, size, variant } = useRadioGroupContext();
|
|
212
|
+
const styles = radioGroupVariants({
|
|
213
|
+
size,
|
|
214
|
+
variant
|
|
215
|
+
});
|
|
216
|
+
const itemProps = {
|
|
217
|
+
value,
|
|
218
|
+
disabled,
|
|
219
|
+
invalid
|
|
220
|
+
};
|
|
221
|
+
return /*#__PURE__*/ jsx(RadioGroupItemContext.Provider, {
|
|
222
|
+
value: {
|
|
223
|
+
itemProps
|
|
224
|
+
},
|
|
225
|
+
children: /*#__PURE__*/ jsx("label", {
|
|
226
|
+
className: styles.item({
|
|
227
|
+
className
|
|
228
|
+
}),
|
|
229
|
+
ref: ref,
|
|
230
|
+
...api.getItemProps(itemProps),
|
|
231
|
+
...props,
|
|
232
|
+
children: children
|
|
233
|
+
})
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
RadioGroup.ItemHiddenInput = function({ className, ref, ...props }) {
|
|
237
|
+
const { api, size, variant } = useRadioGroupContext();
|
|
238
|
+
const { itemProps } = useRadioGroupItemContext();
|
|
239
|
+
const styles = radioGroupVariants({
|
|
240
|
+
size,
|
|
241
|
+
variant
|
|
242
|
+
});
|
|
243
|
+
return /*#__PURE__*/ jsx("input", {
|
|
244
|
+
className: styles.hiddenInput({
|
|
245
|
+
className
|
|
246
|
+
}),
|
|
247
|
+
ref: ref,
|
|
248
|
+
...api.getItemHiddenInputProps(itemProps),
|
|
249
|
+
...props
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
RadioGroup.ItemControl = function({ children, className, ref, ...props }) {
|
|
253
|
+
const { api, size, variant } = useRadioGroupContext();
|
|
254
|
+
const { itemProps } = useRadioGroupItemContext();
|
|
255
|
+
const styles = radioGroupVariants({
|
|
256
|
+
size,
|
|
257
|
+
variant
|
|
258
|
+
});
|
|
259
|
+
const itemState = api.getItemState(itemProps);
|
|
260
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
261
|
+
className: styles.itemControl({
|
|
262
|
+
className
|
|
263
|
+
}),
|
|
264
|
+
ref: ref,
|
|
265
|
+
...api.getItemControlProps(itemProps),
|
|
266
|
+
...props,
|
|
267
|
+
children: [
|
|
268
|
+
/*#__PURE__*/ jsx("span", {
|
|
269
|
+
"aria-hidden": "true",
|
|
270
|
+
className: styles.itemIndicator(),
|
|
271
|
+
"data-disabled": itemState.disabled || void 0,
|
|
272
|
+
"data-state": itemState.checked ? "checked" : "unchecked"
|
|
273
|
+
}),
|
|
274
|
+
children
|
|
275
|
+
]
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
RadioGroup.ItemContent = function({ children, className, ref, ...props }) {
|
|
279
|
+
const { size, variant } = useRadioGroupContext();
|
|
280
|
+
const styles = radioGroupVariants({
|
|
281
|
+
size,
|
|
282
|
+
variant
|
|
283
|
+
});
|
|
284
|
+
return /*#__PURE__*/ jsx("div", {
|
|
285
|
+
className: styles.itemContent({
|
|
286
|
+
className
|
|
287
|
+
}),
|
|
288
|
+
ref: ref,
|
|
289
|
+
...props,
|
|
290
|
+
children: children
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
RadioGroup.ItemText = function({ children, className, ref, ...props }) {
|
|
294
|
+
const { api, size, variant } = useRadioGroupContext();
|
|
295
|
+
const { itemProps } = useRadioGroupItemContext();
|
|
296
|
+
const styles = radioGroupVariants({
|
|
297
|
+
size,
|
|
298
|
+
variant
|
|
299
|
+
});
|
|
300
|
+
return /*#__PURE__*/ jsx("span", {
|
|
301
|
+
className: styles.itemText({
|
|
302
|
+
className
|
|
303
|
+
}),
|
|
304
|
+
ref: ref,
|
|
305
|
+
...api.getItemTextProps(itemProps),
|
|
306
|
+
...props,
|
|
307
|
+
children: children
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
RadioGroup.ItemDescription = function({ children, className, ref, ...props }) {
|
|
311
|
+
const { api, size, variant } = useRadioGroupContext();
|
|
312
|
+
const { itemProps } = useRadioGroupItemContext();
|
|
313
|
+
const styles = radioGroupVariants({
|
|
314
|
+
size,
|
|
315
|
+
variant
|
|
316
|
+
});
|
|
317
|
+
const itemState = api.getItemState(itemProps);
|
|
318
|
+
return /*#__PURE__*/ jsx("div", {
|
|
319
|
+
className: styles.itemDescription({
|
|
320
|
+
className
|
|
321
|
+
}),
|
|
322
|
+
"data-disabled": itemState.disabled || void 0,
|
|
323
|
+
ref: ref,
|
|
324
|
+
...props,
|
|
325
|
+
children: children
|
|
326
|
+
});
|
|
327
|
+
};
|
|
328
|
+
RadioGroup.StatusText = function({ status, size: sizeProp, showIcon, children, ...props }) {
|
|
329
|
+
const { size, validateStatus } = useRadioGroupContext();
|
|
330
|
+
const effectiveSize = sizeProp ?? size;
|
|
331
|
+
const effectiveStatus = status ?? validateStatus;
|
|
332
|
+
return /*#__PURE__*/ jsx(StatusText, {
|
|
333
|
+
showIcon: showIcon ?? "default" !== effectiveStatus,
|
|
334
|
+
size: effectiveSize,
|
|
335
|
+
status: effectiveStatus,
|
|
336
|
+
...props,
|
|
337
|
+
children: children
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
RadioGroup.displayName = "RadioGroup";
|
|
341
|
+
export { RadioGroup, radioGroupVariants, useRadioGroupContext };
|
|
@@ -1,106 +1,185 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { useId } from "react";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useId, useState } from "react";
|
|
3
3
|
import { Button } from "../atoms/button.js";
|
|
4
|
-
import { Icon } from "../atoms/icon.js";
|
|
5
4
|
import { Input } from "../atoms/input.js";
|
|
6
5
|
import { Label } from "../atoms/label.js";
|
|
7
6
|
import { tv } from "../utils.js";
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const searchFormVariants = tv({
|
|
8
|
+
slots: {
|
|
9
|
+
root: [
|
|
10
|
+
"relative grid"
|
|
11
|
+
],
|
|
12
|
+
control: [
|
|
13
|
+
"relative flex items-center overflow-hidden",
|
|
14
|
+
"form-control-base",
|
|
15
|
+
"hover:border-input-border-hover",
|
|
16
|
+
"focus-within:border-input-border-focus",
|
|
17
|
+
"focus-within:outline-(style:--default-ring-style) focus-within:outline-(length:--default-ring-width)",
|
|
18
|
+
"focus-within:outline-input-ring",
|
|
19
|
+
"focus-within:outline-offset-(length:--default-ring-offset)",
|
|
20
|
+
"transition-colors duration-200 motion-reduce:transition-none"
|
|
21
|
+
],
|
|
22
|
+
input: [
|
|
23
|
+
"peer",
|
|
24
|
+
"min-w-0 flex-1",
|
|
25
|
+
"border-none bg-transparent",
|
|
26
|
+
"focus-visible:outline-none"
|
|
27
|
+
],
|
|
28
|
+
button: [
|
|
29
|
+
"h-full shrink-0 items-center rounded-l-none"
|
|
30
|
+
],
|
|
31
|
+
clearButton: [
|
|
32
|
+
"h-full shrink-0 rounded-none p-search-form-clear-button",
|
|
33
|
+
"peer-hover:bg-input-hover peer-focus:bg-input-focus"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
17
36
|
variants: {
|
|
18
37
|
size: {
|
|
19
|
-
sm:
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
sm: {
|
|
39
|
+
root: "gap-search-form-sm",
|
|
40
|
+
control: "h-form-control-sm rounded-search-form-sm"
|
|
41
|
+
},
|
|
42
|
+
md: {
|
|
43
|
+
root: "gap-search-form-md",
|
|
44
|
+
control: "h-form-control-md rounded-search-form-md"
|
|
45
|
+
},
|
|
46
|
+
lg: {
|
|
47
|
+
root: "gap-search-form-lg"
|
|
48
|
+
}
|
|
22
49
|
}
|
|
23
50
|
},
|
|
24
51
|
defaultVariants: {
|
|
25
|
-
size:
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const inputWrapperVariants = tv({
|
|
29
|
-
base: [
|
|
30
|
-
'grid relative overflow-hidden rounded-md'
|
|
31
|
-
],
|
|
32
|
-
variants: {
|
|
33
|
-
size: {
|
|
34
|
-
sm: 'gap-search-form-sm',
|
|
35
|
-
md: 'gap-search-form-md',
|
|
36
|
-
lg: 'gap-search-form-lg'
|
|
37
|
-
}
|
|
52
|
+
size: "md"
|
|
38
53
|
}
|
|
39
54
|
});
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
const SearchFormContext = /*#__PURE__*/ createContext(null);
|
|
56
|
+
function useSearchFormContext() {
|
|
57
|
+
const context = useContext(SearchFormContext);
|
|
58
|
+
if (!context) throw new Error("SearchForm components must be used within SearchForm");
|
|
59
|
+
return context;
|
|
60
|
+
}
|
|
61
|
+
function SearchForm({ size = "md", children, defaultValue = "", value, onValueChange, className, ref, onSubmit, ...props }) {
|
|
62
|
+
const generatedId = useId();
|
|
63
|
+
const inputId = `search-input-${generatedId}`;
|
|
64
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
65
|
+
const isControlled = void 0 !== value;
|
|
66
|
+
const inputValue = isControlled ? value : internalValue;
|
|
67
|
+
const setInputValue = (newValue)=>{
|
|
68
|
+
if (!isControlled) setInternalValue(newValue);
|
|
69
|
+
onValueChange?.(newValue);
|
|
70
|
+
};
|
|
71
|
+
const clearInput = ()=>{
|
|
72
|
+
setInputValue("");
|
|
73
|
+
};
|
|
74
|
+
const handleSubmit = (e)=>{
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
onSubmit?.(e);
|
|
77
|
+
};
|
|
78
|
+
const styles = searchFormVariants({
|
|
79
|
+
size
|
|
80
|
+
});
|
|
81
|
+
return /*#__PURE__*/ jsx(SearchFormContext.Provider, {
|
|
82
|
+
value: {
|
|
83
|
+
size,
|
|
84
|
+
inputId,
|
|
85
|
+
inputValue,
|
|
86
|
+
setInputValue,
|
|
87
|
+
clearInput,
|
|
88
|
+
hasValue: inputValue.length > 0
|
|
89
|
+
},
|
|
90
|
+
children: /*#__PURE__*/ jsx("search", {
|
|
91
|
+
children: /*#__PURE__*/ jsx("form", {
|
|
92
|
+
className: styles.root({
|
|
93
|
+
className
|
|
66
94
|
}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/*#__PURE__*/ jsx(Input, {
|
|
73
|
-
id: id,
|
|
74
|
-
type: "search",
|
|
75
|
-
withButtonInside: withButton && 'right',
|
|
76
|
-
placeholder: placeholder,
|
|
77
|
-
size: size,
|
|
78
|
-
"aria-label": label ? void 0 : 'Search',
|
|
79
|
-
...inputProps
|
|
80
|
-
}),
|
|
81
|
-
withButton && /*#__PURE__*/ jsxs(Button, {
|
|
82
|
-
type: "submit",
|
|
83
|
-
theme: buttonProps?.theme || 'borderless',
|
|
84
|
-
block: false,
|
|
85
|
-
size: size,
|
|
86
|
-
"aria-label": buttonText ? void 0 : 'Search',
|
|
87
|
-
className: buttonVariants({
|
|
88
|
-
className: buttonText ? '' : 'aspect-square'
|
|
89
|
-
}),
|
|
90
|
-
...buttonProps,
|
|
91
|
-
children: [
|
|
92
|
-
buttonText,
|
|
93
|
-
buttonIcon && /*#__PURE__*/ jsx(Icon, {
|
|
94
|
-
icon: 'token-icon-search',
|
|
95
|
-
size: iconSize
|
|
96
|
-
})
|
|
97
|
-
]
|
|
98
|
-
})
|
|
99
|
-
]
|
|
100
|
-
})
|
|
101
|
-
]
|
|
95
|
+
onSubmit: handleSubmit,
|
|
96
|
+
ref: ref,
|
|
97
|
+
...props,
|
|
98
|
+
children: children
|
|
99
|
+
})
|
|
102
100
|
})
|
|
103
101
|
});
|
|
104
102
|
}
|
|
105
|
-
SearchForm.
|
|
106
|
-
|
|
103
|
+
SearchForm.Label = function({ children, className, ...props }) {
|
|
104
|
+
const { inputId, size } = useSearchFormContext();
|
|
105
|
+
return /*#__PURE__*/ jsx(Label, {
|
|
106
|
+
className: className,
|
|
107
|
+
htmlFor: inputId,
|
|
108
|
+
size: size,
|
|
109
|
+
...props,
|
|
110
|
+
children: children
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
SearchForm.Control = function({ children, className, ref, ...props }) {
|
|
114
|
+
const { size } = useSearchFormContext();
|
|
115
|
+
const styles = searchFormVariants({
|
|
116
|
+
size
|
|
117
|
+
});
|
|
118
|
+
return /*#__PURE__*/ jsx("div", {
|
|
119
|
+
className: styles.control({
|
|
120
|
+
className
|
|
121
|
+
}),
|
|
122
|
+
ref: ref,
|
|
123
|
+
...props,
|
|
124
|
+
children: children
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
SearchForm.Input = function({ className, placeholder = "Search...", ref, ...props }) {
|
|
128
|
+
const { inputId, inputValue, setInputValue, size } = useSearchFormContext();
|
|
129
|
+
const styles = searchFormVariants({
|
|
130
|
+
size
|
|
131
|
+
});
|
|
132
|
+
return /*#__PURE__*/ jsx(Input, {
|
|
133
|
+
"aria-label": props["aria-label"] || "Search",
|
|
134
|
+
className: styles.input({
|
|
135
|
+
className
|
|
136
|
+
}),
|
|
137
|
+
id: inputId,
|
|
138
|
+
onChange: (e)=>setInputValue(e.target.value),
|
|
139
|
+
placeholder: placeholder,
|
|
140
|
+
ref: ref,
|
|
141
|
+
size: size,
|
|
142
|
+
type: "search",
|
|
143
|
+
value: inputValue,
|
|
144
|
+
...props
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
SearchForm.Button = function({ className, children, showSearchIcon = false, icon, iconPosition = "right", ...props }) {
|
|
148
|
+
const { size } = useSearchFormContext();
|
|
149
|
+
const styles = searchFormVariants({
|
|
150
|
+
size
|
|
151
|
+
});
|
|
152
|
+
const effectiveIcon = icon ?? (showSearchIcon ? "token-icon-search" : void 0);
|
|
153
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
154
|
+
className: styles.button({
|
|
155
|
+
className
|
|
156
|
+
}),
|
|
157
|
+
icon: effectiveIcon,
|
|
158
|
+
iconPosition: iconPosition,
|
|
159
|
+
size: size,
|
|
160
|
+
type: "submit",
|
|
161
|
+
...props,
|
|
162
|
+
children: children
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
SearchForm.ClearButton = function({ className, icon = "token-icon-close", theme = "unstyled", ...props }) {
|
|
166
|
+
const { size, clearInput, hasValue, inputValue } = useSearchFormContext();
|
|
167
|
+
const styles = searchFormVariants({
|
|
168
|
+
size
|
|
169
|
+
});
|
|
170
|
+
if (!hasValue) return null;
|
|
171
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
172
|
+
"aria-label": `Clear search: ${inputValue}`,
|
|
173
|
+
className: styles.clearButton({
|
|
174
|
+
className
|
|
175
|
+
}),
|
|
176
|
+
icon: icon,
|
|
177
|
+
onClick: clearInput,
|
|
178
|
+
size: "current",
|
|
179
|
+
theme: theme,
|
|
180
|
+
type: "button",
|
|
181
|
+
...props
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
SearchForm.displayName = "SearchForm";
|
|
185
|
+
export { SearchForm, searchFormVariants, useSearchFormContext };
|