@appica/ui-react 1.0.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/LICENSE +21 -0
- package/README.md +91 -0
- package/dist/components/accordion/accordion.d.ts +29 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -0
- package/dist/components/accordion/accordion.js +210 -0
- package/dist/components/accordion/accordion.js.map +1 -0
- package/dist/components/alert/alert.d.ts +32 -0
- package/dist/components/alert/alert.d.ts.map +1 -0
- package/dist/components/alert/alert.js +203 -0
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +28 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog/alert-dialog.js +127 -0
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -0
- package/dist/components/autocomplete/autocomplete.d.ts +48 -0
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -0
- package/dist/components/autocomplete/autocomplete.js +299 -0
- package/dist/components/autocomplete/autocomplete.js.map +1 -0
- package/dist/components/avatar/avatar.d.ts +29 -0
- package/dist/components/avatar/avatar.d.ts.map +1 -0
- package/dist/components/avatar/avatar.js +115 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/background-pattern/background-pattern-interactive.d.ts +10 -0
- package/dist/components/background-pattern/background-pattern-interactive.d.ts.map +1 -0
- package/dist/components/background-pattern/background-pattern-interactive.js +72 -0
- package/dist/components/background-pattern/background-pattern-interactive.js.map +1 -0
- package/dist/components/background-pattern/background-pattern-shared.d.ts +12 -0
- package/dist/components/background-pattern/background-pattern-shared.d.ts.map +1 -0
- package/dist/components/background-pattern/background-pattern-shared.js +73 -0
- package/dist/components/background-pattern/background-pattern-shared.js.map +1 -0
- package/dist/components/background-pattern/background-pattern.d.ts +23 -0
- package/dist/components/background-pattern/background-pattern.d.ts.map +1 -0
- package/dist/components/background-pattern/background-pattern.js +49 -0
- package/dist/components/background-pattern/background-pattern.js.map +1 -0
- package/dist/components/background-pattern/index.d.ts +4 -0
- package/dist/components/background-pattern/index.d.ts.map +1 -0
- package/dist/components/background-pattern/index.js +3 -0
- package/dist/components/background-pattern/index.js.map +1 -0
- package/dist/components/badge/badge.d.ts +17 -0
- package/dist/components/badge/badge.d.ts.map +1 -0
- package/dist/components/badge/badge.js +134 -0
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +24 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.js +106 -0
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/button/button-variants.d.ts +6 -0
- package/dist/components/button/button-variants.d.ts.map +1 -0
- package/dist/components/button/button-variants.js +69 -0
- package/dist/components/button/button-variants.js.map +1 -0
- package/dist/components/button/button.d.ts +10 -0
- package/dist/components/button/button.d.ts.map +1 -0
- package/dist/components/button/button.js +26 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/index.d.ts +3 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/button/index.js +3 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/button-group/button-group-context.d.ts +13 -0
- package/dist/components/button-group/button-group-context.d.ts.map +1 -0
- package/dist/components/button-group/button-group-context.js +7 -0
- package/dist/components/button-group/button-group-context.js.map +1 -0
- package/dist/components/button-group/button-group.d.ts +12 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -0
- package/dist/components/button-group/button-group.js +45 -0
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/calendar/calendar.d.ts +14 -0
- package/dist/components/calendar/calendar.d.ts.map +1 -0
- package/dist/components/calendar/calendar.js +228 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/carousel/carousel.d.ts +128 -0
- package/dist/components/carousel/carousel.d.ts.map +1 -0
- package/dist/components/carousel/carousel.js +795 -0
- package/dist/components/carousel/carousel.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +7 -0
- package/dist/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox.js +128 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +9 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts.map +1 -0
- package/dist/components/checkbox-group/checkbox-group.js +18 -0
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -0
- package/dist/components/chip/chip.d.ts +36 -0
- package/dist/components/chip/chip.d.ts.map +1 -0
- package/dist/components/chip/chip.js +159 -0
- package/dist/components/chip/chip.js.map +1 -0
- package/dist/components/collapsible/collapsible.d.ts +11 -0
- package/dist/components/collapsible/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible/collapsible.js +41 -0
- package/dist/components/collapsible/collapsible.js.map +1 -0
- package/dist/components/combobox/combobox.d.ts +57 -0
- package/dist/components/combobox/combobox.d.ts.map +1 -0
- package/dist/components/combobox/combobox.js +456 -0
- package/dist/components/combobox/combobox.js.map +1 -0
- package/dist/components/context-menu/context-menu.d.ts +43 -0
- package/dist/components/context-menu/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu/context-menu.js +243 -0
- package/dist/components/context-menu/context-menu.js.map +1 -0
- package/dist/components/copy-button/copy-button.d.ts +15 -0
- package/dist/components/copy-button/copy-button.d.ts.map +1 -0
- package/dist/components/copy-button/copy-button.js +126 -0
- package/dist/components/copy-button/copy-button.js.map +1 -0
- package/dist/components/countdown/countdown.d.ts +26 -0
- package/dist/components/countdown/countdown.d.ts.map +1 -0
- package/dist/components/countdown/countdown.js +111 -0
- package/dist/components/countdown/countdown.js.map +1 -0
- package/dist/components/date-field/date-field.d.ts +25 -0
- package/dist/components/date-field/date-field.d.ts.map +1 -0
- package/dist/components/date-field/date-field.js +403 -0
- package/dist/components/date-field/date-field.js.map +1 -0
- package/dist/components/date-picker/date-picker.d.ts +58 -0
- package/dist/components/date-picker/date-picker.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.js +449 -0
- package/dist/components/date-picker/date-picker.js.map +1 -0
- package/dist/components/dialog/dialog.d.ts +30 -0
- package/dist/components/dialog/dialog.d.ts.map +1 -0
- package/dist/components/dialog/dialog.js +138 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/drawer/drawer.d.ts +39 -0
- package/dist/components/drawer/drawer.d.ts.map +1 -0
- package/dist/components/drawer/drawer.js +270 -0
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +43 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +235 -0
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/components/field/field.d.ts +15 -0
- package/dist/components/field/field.d.ts.map +1 -0
- package/dist/components/field/field.js +62 -0
- package/dist/components/field/field.js.map +1 -0
- package/dist/components/fieldset/fieldset.d.ts +9 -0
- package/dist/components/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/fieldset/fieldset.js +20 -0
- package/dist/components/fieldset/fieldset.js.map +1 -0
- package/dist/components/form/form.d.ts +7 -0
- package/dist/components/form/form.d.ts.map +1 -0
- package/dist/components/form/form.js +9 -0
- package/dist/components/form/form.js.map +1 -0
- package/dist/components/gradient-glow/gradient-glow.d.ts +21 -0
- package/dist/components/gradient-glow/gradient-glow.d.ts.map +1 -0
- package/dist/components/gradient-glow/gradient-glow.js +99 -0
- package/dist/components/gradient-glow/gradient-glow.js.map +1 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/index.d.ts.map +1 -0
- package/dist/components/input/index.js +3 -0
- package/dist/components/input/index.js.map +1 -0
- package/dist/components/input/input-variants.d.ts +7 -0
- package/dist/components/input/input-variants.d.ts.map +1 -0
- package/dist/components/input/input-variants.js +52 -0
- package/dist/components/input/input-variants.js.map +1 -0
- package/dist/components/input/input.d.ts +19 -0
- package/dist/components/input/input.d.ts.map +1 -0
- package/dist/components/input/input.js +96 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/kbd/kbd.d.ts +13 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -0
- package/dist/components/kbd/kbd.js +34 -0
- package/dist/components/kbd/kbd.js.map +1 -0
- package/dist/components/loader/loader.d.ts +10 -0
- package/dist/components/loader/loader.d.ts.map +1 -0
- package/dist/components/loader/loader.js +137 -0
- package/dist/components/loader/loader.js.map +1 -0
- package/dist/components/menubar/menubar.d.ts +44 -0
- package/dist/components/menubar/menubar.d.ts.map +1 -0
- package/dist/components/menubar/menubar.js +114 -0
- package/dist/components/menubar/menubar.js.map +1 -0
- package/dist/components/meter/meter.d.ts +24 -0
- package/dist/components/meter/meter.d.ts.map +1 -0
- package/dist/components/meter/meter.js +105 -0
- package/dist/components/meter/meter.js.map +1 -0
- package/dist/components/navigation/index.d.ts +4 -0
- package/dist/components/navigation/index.d.ts.map +1 -0
- package/dist/components/navigation/index.js +4 -0
- package/dist/components/navigation/index.js.map +1 -0
- package/dist/components/navigation/navigation-context.d.ts +16 -0
- package/dist/components/navigation/navigation-context.d.ts.map +1 -0
- package/dist/components/navigation/navigation-context.js +10 -0
- package/dist/components/navigation/navigation-context.js.map +1 -0
- package/dist/components/navigation/navigation-link-variants.d.ts +9 -0
- package/dist/components/navigation/navigation-link-variants.d.ts.map +1 -0
- package/dist/components/navigation/navigation-link-variants.js +189 -0
- package/dist/components/navigation/navigation-link-variants.js.map +1 -0
- package/dist/components/navigation/navigation-link.d.ts +20 -0
- package/dist/components/navigation/navigation-link.d.ts.map +1 -0
- package/dist/components/navigation/navigation-link.js +54 -0
- package/dist/components/navigation/navigation-link.js.map +1 -0
- package/dist/components/navigation/navigation.d.ts +21 -0
- package/dist/components/navigation/navigation.d.ts.map +1 -0
- package/dist/components/navigation/navigation.js +41 -0
- package/dist/components/navigation/navigation.js.map +1 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +41 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts.map +1 -0
- package/dist/components/navigation-menu/navigation-menu.js +329 -0
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -0
- package/dist/components/number-field/number-field.d.ts +17 -0
- package/dist/components/number-field/number-field.d.ts.map +1 -0
- package/dist/components/number-field/number-field.js +270 -0
- package/dist/components/number-field/number-field.js.map +1 -0
- package/dist/components/otp-field/otp-field.d.ts +19 -0
- package/dist/components/otp-field/otp-field.d.ts.map +1 -0
- package/dist/components/otp-field/otp-field.js +66 -0
- package/dist/components/otp-field/otp-field.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +29 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -0
- package/dist/components/pagination/pagination.js +92 -0
- package/dist/components/pagination/pagination.js.map +1 -0
- package/dist/components/popover/popover.d.ts +22 -0
- package/dist/components/popover/popover.d.ts.map +1 -0
- package/dist/components/popover/popover.js +108 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/preview-card/preview-card.d.ts +16 -0
- package/dist/components/preview-card/preview-card.d.ts.map +1 -0
- package/dist/components/preview-card/preview-card.js +92 -0
- package/dist/components/preview-card/preview-card.js.map +1 -0
- package/dist/components/progress/progress.d.ts +18 -0
- package/dist/components/progress/progress.d.ts.map +1 -0
- package/dist/components/progress/progress.js +134 -0
- package/dist/components/progress/progress.js.map +1 -0
- package/dist/components/radio/radio.d.ts +7 -0
- package/dist/components/radio/radio.d.ts.map +1 -0
- package/dist/components/radio/radio.js +73 -0
- package/dist/components/radio/radio.js.map +1 -0
- package/dist/components/radio-group/radio-group.d.ts +9 -0
- package/dist/components/radio-group/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group/radio-group.js +19 -0
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +14 -0
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area/scroll-area.js +87 -0
- package/dist/components/scroll-area/scroll-area.js.map +1 -0
- package/dist/components/select/select.d.ts +36 -0
- package/dist/components/select/select.d.ts.map +1 -0
- package/dist/components/select/select.js +345 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/separator/separator.d.ts +10 -0
- package/dist/components/separator/separator.d.ts.map +1 -0
- package/dist/components/separator/separator.js +81 -0
- package/dist/components/separator/separator.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +9 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton.js +27 -0
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/slider/slider.d.ts +11 -0
- package/dist/components/slider/slider.d.ts.map +1 -0
- package/dist/components/slider/slider.js +187 -0
- package/dist/components/slider/slider.js.map +1 -0
- package/dist/components/sparkline/sparkline.d.ts +39 -0
- package/dist/components/sparkline/sparkline.d.ts.map +1 -0
- package/dist/components/sparkline/sparkline.js +356 -0
- package/dist/components/sparkline/sparkline.js.map +1 -0
- package/dist/components/spinner/spinner.d.ts +10 -0
- package/dist/components/spinner/spinner.d.ts.map +1 -0
- package/dist/components/spinner/spinner.js +179 -0
- package/dist/components/spinner/spinner.js.map +1 -0
- package/dist/components/switch/switch.d.ts +33 -0
- package/dist/components/switch/switch.d.ts.map +1 -0
- package/dist/components/switch/switch.js +137 -0
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/table/table.d.ts +34 -0
- package/dist/components/table/table.d.ts.map +1 -0
- package/dist/components/table/table.js +108 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +35 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -0
- package/dist/components/tabs/tabs.js +192 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/text-animate/text-animate.d.ts +31 -0
- package/dist/components/text-animate/text-animate.d.ts.map +1 -0
- package/dist/components/text-animate/text-animate.js +230 -0
- package/dist/components/text-animate/text-animate.js.map +1 -0
- package/dist/components/textarea/textarea.d.ts +17 -0
- package/dist/components/textarea/textarea.d.ts.map +1 -0
- package/dist/components/textarea/textarea.js +117 -0
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/thumbnail/thumbnail.d.ts +26 -0
- package/dist/components/thumbnail/thumbnail.d.ts.map +1 -0
- package/dist/components/thumbnail/thumbnail.js +116 -0
- package/dist/components/thumbnail/thumbnail.js.map +1 -0
- package/dist/components/time-field/time-field.d.ts +25 -0
- package/dist/components/time-field/time-field.d.ts.map +1 -0
- package/dist/components/time-field/time-field.js +488 -0
- package/dist/components/time-field/time-field.js.map +1 -0
- package/dist/components/toast/toast.d.ts +59 -0
- package/dist/components/toast/toast.d.ts.map +1 -0
- package/dist/components/toast/toast.js +239 -0
- package/dist/components/toast/toast.js.map +1 -0
- package/dist/components/toc/toc.d.ts +21 -0
- package/dist/components/toc/toc.d.ts.map +1 -0
- package/dist/components/toc/toc.js +185 -0
- package/dist/components/toc/toc.js.map +1 -0
- package/dist/components/toggle/toggle.d.ts +7 -0
- package/dist/components/toggle/toggle.d.ts.map +1 -0
- package/dist/components/toggle/toggle.js +9 -0
- package/dist/components/toggle/toggle.js.map +1 -0
- package/dist/components/toggle-group/toggle-group.d.ts +7 -0
- package/dist/components/toggle-group/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group/toggle-group.js +21 -0
- package/dist/components/toggle-group/toggle-group.js.map +1 -0
- package/dist/components/toolbar/toolbar.d.ts +23 -0
- package/dist/components/toolbar/toolbar.d.ts.map +1 -0
- package/dist/components/toolbar/toolbar.js +56 -0
- package/dist/components/toolbar/toolbar.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +16 -0
- package/dist/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.js +64 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/floating.d.ts +47 -0
- package/dist/floating.d.ts.map +1 -0
- package/dist/floating.js +35 -0
- package/dist/floating.js.map +1 -0
- package/dist/hooks/use-direction.d.ts +2 -0
- package/dist/hooks/use-direction.d.ts.map +1 -0
- package/dist/hooks/use-direction.js +3 -0
- package/dist/hooks/use-direction.js.map +1 -0
- package/dist/hooks/use-dismissible.d.ts +16 -0
- package/dist/hooks/use-dismissible.d.ts.map +1 -0
- package/dist/hooks/use-dismissible.js +17 -0
- package/dist/hooks/use-dismissible.js.map +1 -0
- package/dist/hooks/use-local-storage.d.ts +24 -0
- package/dist/hooks/use-local-storage.d.ts.map +1 -0
- package/dist/hooks/use-local-storage.js +127 -0
- package/dist/hooks/use-local-storage.js.map +1 -0
- package/dist/hooks/use-media-query.d.ts +20 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +19 -0
- package/dist/hooks/use-media-query.js.map +1 -0
- package/dist/hooks/use-reduced-motion.d.ts +7 -0
- package/dist/hooks/use-reduced-motion.d.ts.map +1 -0
- package/dist/hooks/use-reduced-motion.js +13 -0
- package/dist/hooks/use-reduced-motion.js.map +1 -0
- package/dist/hooks/use-theme.d.ts +11 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/hooks/use-theme.js +9 -0
- package/dist/hooks/use-theme.js.map +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/modal.d.ts +42 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +18 -0
- package/dist/modal.js.map +1 -0
- package/dist/providers/direction-provider.d.ts +21 -0
- package/dist/providers/direction-provider.d.ts.map +1 -0
- package/dist/providers/direction-provider.js +9 -0
- package/dist/providers/direction-provider.js.map +1 -0
- package/dist/providers/reduced-motion-provider.d.ts +30 -0
- package/dist/providers/reduced-motion-provider.d.ts.map +1 -0
- package/dist/providers/reduced-motion-provider.js +27 -0
- package/dist/providers/reduced-motion-provider.js.map +1 -0
- package/dist/providers/theme-provider/index.d.ts +5 -0
- package/dist/providers/theme-provider/index.d.ts.map +1 -0
- package/dist/providers/theme-provider/index.js +3 -0
- package/dist/providers/theme-provider/index.js.map +1 -0
- package/dist/providers/theme-provider/theme-provider.d.ts +39 -0
- package/dist/providers/theme-provider/theme-provider.d.ts.map +1 -0
- package/dist/providers/theme-provider/theme-provider.js +118 -0
- package/dist/providers/theme-provider/theme-provider.js.map +1 -0
- package/dist/providers/theme-provider/theme-script.d.ts +28 -0
- package/dist/providers/theme-provider/theme-script.d.ts.map +1 -0
- package/dist/providers/theme-provider/theme-script.js +59 -0
- package/dist/providers/theme-provider/theme-script.js.map +1 -0
- package/dist/utils.d.ts +17 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +51 -0
- package/dist/utils.js.map +1 -0
- package/package.json +479 -0
- package/src/components/accordion/accordion.test.tsx +220 -0
- package/src/components/accordion/accordion.tsx +269 -0
- package/src/components/alert/alert.test.tsx +188 -0
- package/src/components/alert/alert.tsx +243 -0
- package/src/components/alert-dialog/alert-dialog.test.tsx +141 -0
- package/src/components/alert-dialog/alert-dialog.tsx +179 -0
- package/src/components/autocomplete/autocomplete.test.tsx +384 -0
- package/src/components/autocomplete/autocomplete.tsx +442 -0
- package/src/components/avatar/avatar.test.tsx +368 -0
- package/src/components/avatar/avatar.tsx +142 -0
- package/src/components/background-pattern/background-pattern-interactive.tsx +93 -0
- package/src/components/background-pattern/background-pattern-shared.tsx +96 -0
- package/src/components/background-pattern/background-pattern.test.tsx +97 -0
- package/src/components/background-pattern/background-pattern.tsx +67 -0
- package/src/components/background-pattern/index.ts +3 -0
- package/src/components/badge/badge.test.tsx +58 -0
- package/src/components/badge/badge.tsx +149 -0
- package/src/components/breadcrumb/breadcrumb.test.tsx +174 -0
- package/src/components/breadcrumb/breadcrumb.tsx +146 -0
- package/src/components/button/button-variants.ts +69 -0
- package/src/components/button/button.test.tsx +79 -0
- package/src/components/button/button.tsx +28 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/button-group/button-group-context.ts +18 -0
- package/src/components/button-group/button-group.test.tsx +223 -0
- package/src/components/button-group/button-group.tsx +59 -0
- package/src/components/calendar/calendar.test.tsx +69 -0
- package/src/components/calendar/calendar.tsx +295 -0
- package/src/components/carousel/carousel.test.tsx +493 -0
- package/src/components/carousel/carousel.tsx +1003 -0
- package/src/components/checkbox/checkbox.test.tsx +100 -0
- package/src/components/checkbox/checkbox.tsx +154 -0
- package/src/components/checkbox-group/checkbox-group.test.tsx +86 -0
- package/src/components/checkbox-group/checkbox-group.tsx +21 -0
- package/src/components/chip/chip.test.tsx +242 -0
- package/src/components/chip/chip.tsx +234 -0
- package/src/components/collapsible/collapsible.test.tsx +126 -0
- package/src/components/collapsible/collapsible.tsx +47 -0
- package/src/components/combobox/combobox.test.tsx +410 -0
- package/src/components/combobox/combobox.tsx +598 -0
- package/src/components/context-menu/context-menu.test.tsx +226 -0
- package/src/components/context-menu/context-menu.tsx +345 -0
- package/src/components/copy-button/copy-button.test.tsx +147 -0
- package/src/components/copy-button/copy-button.tsx +141 -0
- package/src/components/countdown/countdown.test.tsx +130 -0
- package/src/components/countdown/countdown.tsx +170 -0
- package/src/components/date-field/date-field.test.tsx +373 -0
- package/src/components/date-field/date-field.tsx +512 -0
- package/src/components/date-picker/date-picker.test.tsx +291 -0
- package/src/components/date-picker/date-picker.tsx +572 -0
- package/src/components/dialog/dialog.test.tsx +173 -0
- package/src/components/dialog/dialog.tsx +190 -0
- package/src/components/drawer/drawer.test.tsx +191 -0
- package/src/components/drawer/drawer.tsx +365 -0
- package/src/components/dropdown-menu/dropdown-menu.test.tsx +227 -0
- package/src/components/dropdown-menu/dropdown-menu.tsx +341 -0
- package/src/components/field/field.test.tsx +84 -0
- package/src/components/field/field.tsx +71 -0
- package/src/components/fieldset/fieldset.test.tsx +62 -0
- package/src/components/fieldset/fieldset.tsx +24 -0
- package/src/components/form/form.test.tsx +61 -0
- package/src/components/form/form.tsx +11 -0
- package/src/components/gradient-glow/gradient-glow.test.tsx +110 -0
- package/src/components/gradient-glow/gradient-glow.tsx +132 -0
- package/src/components/input/index.ts +2 -0
- package/src/components/input/input-variants.ts +52 -0
- package/src/components/input/input.test.tsx +118 -0
- package/src/components/input/input.tsx +120 -0
- package/src/components/kbd/kbd.test.tsx +119 -0
- package/src/components/kbd/kbd.tsx +48 -0
- package/src/components/loader/loader.test.tsx +57 -0
- package/src/components/loader/loader.tsx +163 -0
- package/src/components/menubar/menubar.test.tsx +162 -0
- package/src/components/menubar/menubar.tsx +226 -0
- package/src/components/meter/meter.test.tsx +172 -0
- package/src/components/meter/meter.tsx +144 -0
- package/src/components/navigation/index.ts +3 -0
- package/src/components/navigation/navigation-context.ts +24 -0
- package/src/components/navigation/navigation-link-variants.ts +197 -0
- package/src/components/navigation/navigation-link.tsx +90 -0
- package/src/components/navigation/navigation.test.tsx +253 -0
- package/src/components/navigation/navigation.tsx +74 -0
- package/src/components/navigation-menu/navigation-menu.test.tsx +258 -0
- package/src/components/navigation-menu/navigation-menu.tsx +410 -0
- package/src/components/number-field/number-field.test.tsx +224 -0
- package/src/components/number-field/number-field.tsx +310 -0
- package/src/components/otp-field/otp-field.test.tsx +113 -0
- package/src/components/otp-field/otp-field.tsx +105 -0
- package/src/components/pagination/pagination.test.tsx +147 -0
- package/src/components/pagination/pagination.tsx +139 -0
- package/src/components/popover/popover.test.tsx +135 -0
- package/src/components/popover/popover.tsx +134 -0
- package/src/components/preview-card/preview-card.test.tsx +99 -0
- package/src/components/preview-card/preview-card.tsx +103 -0
- package/src/components/progress/progress.test.tsx +109 -0
- package/src/components/progress/progress.tsx +151 -0
- package/src/components/radio/radio.test.tsx +141 -0
- package/src/components/radio/radio.tsx +94 -0
- package/src/components/radio-group/radio-group.test.tsx +80 -0
- package/src/components/radio-group/radio-group.tsx +22 -0
- package/src/components/scroll-area/scroll-area.test.tsx +133 -0
- package/src/components/scroll-area/scroll-area.tsx +101 -0
- package/src/components/select/select.test.tsx +251 -0
- package/src/components/select/select.tsx +446 -0
- package/src/components/separator/separator.test.tsx +46 -0
- package/src/components/separator/separator.tsx +95 -0
- package/src/components/skeleton/skeleton.test.tsx +55 -0
- package/src/components/skeleton/skeleton.tsx +33 -0
- package/src/components/slider/slider.test.tsx +123 -0
- package/src/components/slider/slider.tsx +262 -0
- package/src/components/sparkline/sparkline.test.tsx +249 -0
- package/src/components/sparkline/sparkline.tsx +446 -0
- package/src/components/spinner/spinner.test.tsx +57 -0
- package/src/components/spinner/spinner.tsx +219 -0
- package/src/components/switch/switch.test.tsx +100 -0
- package/src/components/switch/switch.tsx +166 -0
- package/src/components/table/table.test.tsx +175 -0
- package/src/components/table/table.tsx +157 -0
- package/src/components/tabs/tabs.test.tsx +165 -0
- package/src/components/tabs/tabs.tsx +246 -0
- package/src/components/text-animate/text-animate.test.tsx +125 -0
- package/src/components/text-animate/text-animate.tsx +354 -0
- package/src/components/textarea/textarea.test.tsx +188 -0
- package/src/components/textarea/textarea.tsx +144 -0
- package/src/components/thumbnail/thumbnail.test.tsx +217 -0
- package/src/components/thumbnail/thumbnail.tsx +139 -0
- package/src/components/time-field/time-field.test.tsx +376 -0
- package/src/components/time-field/time-field.tsx +625 -0
- package/src/components/toast/toast.test.tsx +277 -0
- package/src/components/toast/toast.tsx +377 -0
- package/src/components/toc/toc.test.tsx +197 -0
- package/src/components/toc/toc.tsx +233 -0
- package/src/components/toggle/toggle.test.tsx +109 -0
- package/src/components/toggle/toggle.tsx +10 -0
- package/src/components/toggle-group/toggle-group.test.tsx +95 -0
- package/src/components/toggle-group/toggle-group.tsx +21 -0
- package/src/components/toolbar/toolbar.test.tsx +78 -0
- package/src/components/toolbar/toolbar.tsx +77 -0
- package/src/components/tooltip/tooltip.test.tsx +100 -0
- package/src/components/tooltip/tooltip.tsx +78 -0
- package/src/floating.test.ts +40 -0
- package/src/floating.ts +103 -0
- package/src/globals.d.ts +34 -0
- package/src/hooks/use-direction.ts +3 -0
- package/src/hooks/use-dismissible.ts +33 -0
- package/src/hooks/use-local-storage.test.tsx +63 -0
- package/src/hooks/use-local-storage.ts +190 -0
- package/src/hooks/use-media-query.test.tsx +65 -0
- package/src/hooks/use-media-query.ts +38 -0
- package/src/hooks/use-reduced-motion.ts +17 -0
- package/src/hooks/use-theme.ts +16 -0
- package/src/index.ts +76 -0
- package/src/modal.test.ts +34 -0
- package/src/modal.ts +80 -0
- package/src/providers/direction-provider.test.tsx +20 -0
- package/src/providers/direction-provider.tsx +26 -0
- package/src/providers/reduced-motion-provider.test.tsx +42 -0
- package/src/providers/reduced-motion-provider.tsx +58 -0
- package/src/providers/theme-provider/index.ts +4 -0
- package/src/providers/theme-provider/theme-provider.test.tsx +97 -0
- package/src/providers/theme-provider/theme-provider.tsx +169 -0
- package/src/providers/theme-provider/theme-script.tsx +108 -0
- package/src/test/setup.ts +27 -0
- package/src/test/vitest-axe.d.ts +7 -0
- package/src/utils.test.tsx +63 -0
- package/src/utils.ts +57 -0
- package/styles.css +523 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react'
|
|
2
|
+
import { describe, it, expect } from 'vitest'
|
|
3
|
+
import { axe } from 'vitest-axe'
|
|
4
|
+
import { GradientGlow } from './gradient-glow'
|
|
5
|
+
|
|
6
|
+
describe('GradientGlow', () => {
|
|
7
|
+
it('renders its children inside a labelled wrapper', () => {
|
|
8
|
+
render(
|
|
9
|
+
<GradientGlow>
|
|
10
|
+
<span>Content</span>
|
|
11
|
+
</GradientGlow>,
|
|
12
|
+
)
|
|
13
|
+
expect(screen.getByText('Content')).toBeInTheDocument()
|
|
14
|
+
expect(screen.getByText('Content').closest('[data-slot="gradient-glow"]')).not.toBeNull()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('paints a decorative, blurred aura layer by default', () => {
|
|
18
|
+
const { container } = render(<GradientGlow />)
|
|
19
|
+
const aura = container.querySelector('[data-slot="gradient-glow-aura"]')!
|
|
20
|
+
expect(aura).not.toBeNull()
|
|
21
|
+
expect(aura).toHaveAttribute('aria-hidden')
|
|
22
|
+
expect(aura).toHaveClass('blur-lg')
|
|
23
|
+
expect(aura.getAttribute('style')).toContain('linear-gradient(')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('omits the border ring unless requested', () => {
|
|
27
|
+
const { container, rerender } = render(<GradientGlow />)
|
|
28
|
+
expect(container.querySelector('[data-slot="gradient-glow-border"]')).toBeNull()
|
|
29
|
+
|
|
30
|
+
rerender(<GradientGlow border />)
|
|
31
|
+
const ring = container.querySelector('[data-slot="gradient-glow-border"]')
|
|
32
|
+
expect(ring).not.toBeNull()
|
|
33
|
+
expect(ring).toHaveAttribute('aria-hidden')
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('maps the blur prop to a Tailwind utility', () => {
|
|
37
|
+
const { container } = render(<GradientGlow blur="2xl" />)
|
|
38
|
+
const aura = container.querySelector('[data-slot="gradient-glow-aura"]')!
|
|
39
|
+
expect(aura).toHaveClass('blur-2xl')
|
|
40
|
+
expect(aura).not.toHaveClass('blur-lg')
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('reflects custom colors in the gradient', () => {
|
|
44
|
+
const { container } = render(<GradientGlow from="#112233" via="#445566" to="#778899" />)
|
|
45
|
+
const style = container.querySelector('[data-slot="gradient-glow-aura"]')!.getAttribute('style') ?? ''
|
|
46
|
+
expect(style).toContain('#112233')
|
|
47
|
+
expect(style).toContain('#445566')
|
|
48
|
+
expect(style).toContain('#778899')
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('marks managed visibility via data-reveal for interaction triggers', () => {
|
|
52
|
+
const { container } = render(<GradientGlow revealOn={['hover', 'press']} />)
|
|
53
|
+
const root = container.querySelector('[data-slot="gradient-glow"]')!
|
|
54
|
+
expect(root).toHaveAttribute('data-reveal', 'hover press')
|
|
55
|
+
expect(root).not.toHaveAttribute('data-revealed')
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('groups and scales the layers on press when pressScale is set', () => {
|
|
59
|
+
const { container } = render(<GradientGlow pressScale />)
|
|
60
|
+
expect(container.querySelector('[data-slot="gradient-glow"]')).toHaveClass('group/glow')
|
|
61
|
+
expect(container.querySelector('[data-slot="gradient-glow-aura"]')).toHaveClass('group-active/glow:scale-[0.97]')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('opts into the touch fallback via data-show-on-touch', () => {
|
|
65
|
+
const { container, rerender } = render(<GradientGlow revealOn="hover" />)
|
|
66
|
+
const root = () => container.querySelector('[data-slot="gradient-glow"]') as HTMLElement
|
|
67
|
+
expect(root()).not.toHaveAttribute('data-show-on-touch')
|
|
68
|
+
|
|
69
|
+
rerender(<GradientGlow revealOn="hover" showOnTouch />)
|
|
70
|
+
expect(root()).toHaveAttribute('data-show-on-touch')
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('is always-on (no data-reveal) by default', () => {
|
|
74
|
+
const { container } = render(<GradientGlow />)
|
|
75
|
+
expect(container.querySelector('[data-slot="gradient-glow"]')).not.toHaveAttribute('data-reveal')
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('reflects the controlled reveal prop via data-revealed', () => {
|
|
79
|
+
const { container, rerender } = render(<GradientGlow reveal={false} />)
|
|
80
|
+
const root = () => container.querySelector('[data-slot="gradient-glow"]') as HTMLElement
|
|
81
|
+
// Controlled mode is still "managed" so the layer can be hidden when false.
|
|
82
|
+
expect(root()).toHaveAttribute('data-reveal', '')
|
|
83
|
+
expect(root()).not.toHaveAttribute('data-revealed')
|
|
84
|
+
|
|
85
|
+
rerender(<GradientGlow reveal />)
|
|
86
|
+
expect(root()).toHaveAttribute('data-revealed')
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it('forwards the speed as an animation-duration variable', () => {
|
|
90
|
+
const { container } = render(<GradientGlow speed={10} />)
|
|
91
|
+
const root = container.querySelector('[data-slot="gradient-glow"]') as HTMLElement
|
|
92
|
+
expect(root.style.getPropertyValue('--gradient-glow-duration')).toBe('10s')
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('merges a consumer className onto the wrapper', () => {
|
|
96
|
+
const { container } = render(<GradientGlow className="rounded-3xl" />)
|
|
97
|
+
const root = container.querySelector('[data-slot="gradient-glow"]')!
|
|
98
|
+
expect(root).toHaveClass('rounded-3xl')
|
|
99
|
+
expect(root).not.toHaveClass('rounded-2xl')
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('has no accessibility violations (decorative layers are hidden)', async () => {
|
|
103
|
+
const { container } = render(
|
|
104
|
+
<GradientGlow border>
|
|
105
|
+
<p>Readable content</p>
|
|
106
|
+
</GradientGlow>,
|
|
107
|
+
)
|
|
108
|
+
expect(await axe(container)).toHaveNoViolations()
|
|
109
|
+
})
|
|
110
|
+
})
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { cn } from '../../utils'
|
|
3
|
+
|
|
4
|
+
type GradientGlowBlur = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'
|
|
5
|
+
type GradientGlowTrigger = 'hover' | 'press'
|
|
6
|
+
|
|
7
|
+
interface GradientGlowProps extends React.ComponentProps<'div'> {
|
|
8
|
+
from?: string
|
|
9
|
+
via?: string
|
|
10
|
+
to?: string
|
|
11
|
+
angle?: number
|
|
12
|
+
blur?: GradientGlowBlur
|
|
13
|
+
border?: boolean
|
|
14
|
+
borderWidth?: number
|
|
15
|
+
speed?: number
|
|
16
|
+
revealOn?: GradientGlowTrigger | GradientGlowTrigger[]
|
|
17
|
+
reveal?: boolean
|
|
18
|
+
showOnTouch?: boolean
|
|
19
|
+
pressScale?: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const BLUR_CLASS: Record<GradientGlowBlur, string> = {
|
|
23
|
+
sm: 'blur-sm',
|
|
24
|
+
md: 'blur-md',
|
|
25
|
+
lg: 'blur-lg',
|
|
26
|
+
xl: 'blur-xl',
|
|
27
|
+
'2xl': 'blur-2xl',
|
|
28
|
+
'3xl': 'blur-3xl',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const BORDER_MASK = 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)'
|
|
32
|
+
|
|
33
|
+
function GradientGlow({
|
|
34
|
+
from = '#8EC5FF',
|
|
35
|
+
via = '#EFADF7',
|
|
36
|
+
to = '#FFD69B',
|
|
37
|
+
angle = 95,
|
|
38
|
+
blur = 'lg',
|
|
39
|
+
border = false,
|
|
40
|
+
borderWidth = 1,
|
|
41
|
+
speed = 4,
|
|
42
|
+
revealOn,
|
|
43
|
+
reveal,
|
|
44
|
+
showOnTouch = false,
|
|
45
|
+
pressScale = false,
|
|
46
|
+
className,
|
|
47
|
+
style,
|
|
48
|
+
children,
|
|
49
|
+
...props
|
|
50
|
+
}: GradientGlowProps) {
|
|
51
|
+
const gradient = `linear-gradient(calc(${angle}deg + var(--gradient-glow-rotation, 0deg)), ${from} 3.64%, ${via} 53.35%, ${to} 95.37%)`
|
|
52
|
+
|
|
53
|
+
const triggers = revealOn == null ? [] : Array.isArray(revealOn) ? revealOn : [revealOn]
|
|
54
|
+
const managed = triggers.length > 0 || reveal !== undefined
|
|
55
|
+
const grouped = managed || pressScale
|
|
56
|
+
const transition =
|
|
57
|
+
managed && pressScale
|
|
58
|
+
? '[transition:opacity_500ms_ease-out,scale_150ms_ease-out,translate_150ms_ease-out]'
|
|
59
|
+
: managed
|
|
60
|
+
? 'transition-opacity duration-500 ease-out'
|
|
61
|
+
: pressScale
|
|
62
|
+
? '[transition:scale_150ms_ease-out,translate_150ms_ease-out]'
|
|
63
|
+
: undefined
|
|
64
|
+
|
|
65
|
+
const layerClasses = grouped
|
|
66
|
+
? cn(
|
|
67
|
+
transition,
|
|
68
|
+
managed && 'opacity-0 [animation-play-state:paused]',
|
|
69
|
+
managed &&
|
|
70
|
+
triggers.includes('hover') &&
|
|
71
|
+
'group-hover/glow:opacity-(--gradient-glow-opacity) group-hover/glow:[animation-play-state:running]',
|
|
72
|
+
managed &&
|
|
73
|
+
triggers.includes('hover') &&
|
|
74
|
+
showOnTouch &&
|
|
75
|
+
'hover-none:opacity-(--gradient-glow-opacity) hover-none:[animation-play-state:running]',
|
|
76
|
+
managed &&
|
|
77
|
+
triggers.includes('press') &&
|
|
78
|
+
'group-active/glow:opacity-(--gradient-glow-opacity) group-active/glow:[animation-play-state:running]',
|
|
79
|
+
managed && reveal && 'opacity-(--gradient-glow-opacity) [animation-play-state:running]',
|
|
80
|
+
pressScale && 'group-active/glow:scale-[0.97] group-active/glow:translate-y-px',
|
|
81
|
+
)
|
|
82
|
+
: undefined
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div
|
|
86
|
+
data-slot="gradient-glow"
|
|
87
|
+
data-reveal={managed ? triggers.join(' ') : undefined}
|
|
88
|
+
data-revealed={reveal ? '' : undefined}
|
|
89
|
+
data-show-on-touch={showOnTouch ? '' : undefined}
|
|
90
|
+
className={cn(
|
|
91
|
+
'relative isolate rounded-2xl [--gradient-glow-opacity:1] dark:[--gradient-glow-opacity:0.6]',
|
|
92
|
+
grouped && 'group/glow',
|
|
93
|
+
className,
|
|
94
|
+
)}
|
|
95
|
+
style={{ '--gradient-glow-duration': `${speed}s`, ...style } as React.CSSProperties}
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
<span
|
|
99
|
+
aria-hidden
|
|
100
|
+
data-slot="gradient-glow-aura"
|
|
101
|
+
className={cn(
|
|
102
|
+
'motion-safe:animate-gradient-glow-aura pointer-events-none absolute inset-0 -z-10 rounded-[inherit] opacity-(--gradient-glow-opacity)',
|
|
103
|
+
BLUR_CLASS[blur],
|
|
104
|
+
layerClasses,
|
|
105
|
+
)}
|
|
106
|
+
style={{ background: gradient }}
|
|
107
|
+
/>
|
|
108
|
+
{children}
|
|
109
|
+
{border ? (
|
|
110
|
+
<span
|
|
111
|
+
aria-hidden
|
|
112
|
+
data-slot="gradient-glow-border"
|
|
113
|
+
className={cn(
|
|
114
|
+
'motion-safe:animate-gradient-glow pointer-events-none absolute inset-0 rounded-[inherit] opacity-(--gradient-glow-opacity)',
|
|
115
|
+
layerClasses,
|
|
116
|
+
)}
|
|
117
|
+
style={{
|
|
118
|
+
background: gradient,
|
|
119
|
+
padding: borderWidth,
|
|
120
|
+
WebkitMask: BORDER_MASK,
|
|
121
|
+
WebkitMaskComposite: 'xor',
|
|
122
|
+
mask: BORDER_MASK,
|
|
123
|
+
maskComposite: 'exclude',
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
) : null}
|
|
127
|
+
</div>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { GradientGlow }
|
|
132
|
+
export type { GradientGlowProps }
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority'
|
|
2
|
+
import { cn } from '../../utils'
|
|
3
|
+
|
|
4
|
+
const inputVariants = cva(
|
|
5
|
+
'w-full border text-foreground outline-none transition-[background-color,border-color,box-shadow] duration-200 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
outline:
|
|
10
|
+
'bg-background border-border-strong hover:not-focus:not-focus-visible:not-has-focus:not-has-focus-visible:not-data-popup-open:not-has-data-popup-open:not-data-pressed:not-has-data-pressed:not-data-invalid:not-has-data-invalid:border-border-emphasis',
|
|
11
|
+
soft: 'bg-background-muted border-transparent hover:not-focus:not-focus-visible:not-has-focus:not-has-focus-visible:not-data-popup-open:not-has-data-popup-open:not-data-pressed:not-has-data-pressed:not-data-invalid:not-has-data-invalid:border-border-strong',
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
sm: "h-8 px-3 text-xs pointer-coarse:text-base rounded-sm gap-1.5 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='stroke-'])]:stroke-[1.75]",
|
|
15
|
+
md: "h-10 px-3.5 text-sm pointer-coarse:text-base rounded-md gap-2 [&_svg:not([class*='size-'])]:size-4.5 [&_svg:not([class*='stroke-'])]:stroke-[1.65]",
|
|
16
|
+
lg: "h-12 px-4 text-base rounded-lg gap-2 [&_svg:not([class*='size-'])]:size-5 [&_svg:not([class*='stroke-'])]:stroke-[1.65]",
|
|
17
|
+
},
|
|
18
|
+
state: {
|
|
19
|
+
self: cn(
|
|
20
|
+
'focus-visible:ring-3 focus-visible:ring-ring-input focus-visible:border-transparent focus-visible:bg-background',
|
|
21
|
+
'data-popup-open:ring-3 data-popup-open:ring-ring-input data-popup-open:border-transparent data-popup-open:bg-background',
|
|
22
|
+
'data-pressed:ring-3 data-pressed:ring-ring-input data-pressed:border-transparent data-pressed:bg-background',
|
|
23
|
+
'data-invalid:bg-error-subtle data-invalid:border-error',
|
|
24
|
+
'data-invalid:focus-visible:border-transparent data-invalid:focus-visible:ring-ring-error data-invalid:focus-visible:bg-background',
|
|
25
|
+
'data-invalid:data-popup-open:border-transparent data-invalid:data-popup-open:ring-ring-error data-invalid:data-popup-open:bg-background',
|
|
26
|
+
'data-invalid:data-pressed:border-transparent data-invalid:data-pressed:ring-ring-error data-invalid:data-pressed:bg-background',
|
|
27
|
+
'data-disabled:border-border-strong! data-disabled:bg-background-subtle! data-disabled:cursor-not-allowed data-disabled:border-dashed data-disabled:opacity-disabled',
|
|
28
|
+
),
|
|
29
|
+
within: cn(
|
|
30
|
+
'flex items-center',
|
|
31
|
+
'has-focus:ring-[3px] has-focus:ring-ring-input has-focus:border-transparent has-focus:bg-background',
|
|
32
|
+
'has-data-popup-open:ring-3 has-data-popup-open:ring-ring-input has-data-popup-open:border-transparent has-data-popup-open:bg-background',
|
|
33
|
+
'has-data-pressed:ring-3 has-data-pressed:ring-ring-input has-data-pressed:border-transparent has-data-pressed:bg-background',
|
|
34
|
+
'data-invalid:bg-error-subtle data-invalid:border-error data-invalid:has-focus:border-transparent data-invalid:has-focus:ring-ring-error data-invalid:has-focus:bg-background',
|
|
35
|
+
'data-invalid:has-data-popup-open:border-transparent data-invalid:has-data-popup-open:ring-ring-error data-invalid:has-data-popup-open:bg-background',
|
|
36
|
+
'data-invalid:has-data-pressed:border-transparent data-invalid:has-data-pressed:ring-ring-error data-invalid:has-data-pressed:bg-background',
|
|
37
|
+
'has-data-invalid:bg-error-subtle has-data-invalid:border-error has-data-invalid:has-focus:border-transparent has-data-invalid:has-focus:ring-ring-error has-data-invalid:has-focus:bg-background',
|
|
38
|
+
'has-data-invalid:has-data-popup-open:border-transparent has-data-invalid:has-data-popup-open:ring-ring-error has-data-invalid:has-data-popup-open:bg-background',
|
|
39
|
+
'has-data-invalid:has-data-pressed:border-transparent has-data-invalid:has-data-pressed:ring-ring-error has-data-invalid:has-data-pressed:bg-background',
|
|
40
|
+
'has-[input:disabled]:border-border-strong! has-[input:disabled]:bg-background-subtle! has-[input:disabled]:cursor-not-allowed has-[input:disabled]:border-dashed has-[input:disabled]:opacity-disabled',
|
|
41
|
+
),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
variant: 'outline',
|
|
46
|
+
size: 'md',
|
|
47
|
+
state: 'self',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
export { inputVariants }
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react'
|
|
2
|
+
import userEvent from '@testing-library/user-event'
|
|
3
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
4
|
+
import { axe } from 'vitest-axe'
|
|
5
|
+
import * as React from 'react'
|
|
6
|
+
import { Input } from './input'
|
|
7
|
+
|
|
8
|
+
describe('Input', () => {
|
|
9
|
+
it('renders with textbox role', () => {
|
|
10
|
+
render(<Input aria-label="Email" />)
|
|
11
|
+
expect(screen.getByRole('textbox', { name: 'Email' })).toBeInTheDocument()
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('accepts user typing', async () => {
|
|
15
|
+
const user = userEvent.setup()
|
|
16
|
+
render(<Input aria-label="Name" />)
|
|
17
|
+
const input = screen.getByRole('textbox')
|
|
18
|
+
await user.type(input, 'Roman')
|
|
19
|
+
expect(input).toHaveValue('Roman')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('calls onChange when typing in a controlled input', async () => {
|
|
23
|
+
const user = userEvent.setup()
|
|
24
|
+
const onChange = vi.fn()
|
|
25
|
+
|
|
26
|
+
function Controlled() {
|
|
27
|
+
const [value, setValue] = React.useState('')
|
|
28
|
+
return (
|
|
29
|
+
<Input
|
|
30
|
+
aria-label="Controlled"
|
|
31
|
+
value={value}
|
|
32
|
+
onChange={(e) => {
|
|
33
|
+
setValue(e.target.value)
|
|
34
|
+
onChange(e.target.value)
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
render(<Controlled />)
|
|
41
|
+
await user.type(screen.getByRole('textbox'), 'hi')
|
|
42
|
+
expect(onChange).toHaveBeenCalledWith('hi')
|
|
43
|
+
expect(screen.getByRole('textbox')).toHaveValue('hi')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('is disabled when the disabled prop is set', async () => {
|
|
47
|
+
const user = userEvent.setup()
|
|
48
|
+
render(<Input aria-label="Disabled" disabled />)
|
|
49
|
+
const input = screen.getByRole('textbox')
|
|
50
|
+
expect(input).toBeDisabled()
|
|
51
|
+
await user.type(input, 'x')
|
|
52
|
+
expect(input).toHaveValue('')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('applies size classes', () => {
|
|
56
|
+
render(<Input aria-label="Large" inputSize="lg" />)
|
|
57
|
+
expect(screen.getByRole('textbox').className).toContain('h-12')
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('applies variant classes', () => {
|
|
61
|
+
render(<Input aria-label="Soft" variant="soft" />)
|
|
62
|
+
expect(screen.getByRole('textbox').className).toContain('bg-background-muted')
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('forwards an outer ref', () => {
|
|
66
|
+
const ref = React.createRef<HTMLInputElement>()
|
|
67
|
+
render(<Input aria-label="Ref" ref={ref} />)
|
|
68
|
+
expect(ref.current).toBeInstanceOf(HTMLInputElement)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('renders the clear button when clearable and clears the value', async () => {
|
|
72
|
+
const user = userEvent.setup()
|
|
73
|
+
const onClear = vi.fn()
|
|
74
|
+
render(<Input aria-label="Search" clearable onClear={onClear} />)
|
|
75
|
+
|
|
76
|
+
const input = screen.getByRole('textbox')
|
|
77
|
+
await user.type(input, 'query')
|
|
78
|
+
expect(input).toHaveValue('query')
|
|
79
|
+
|
|
80
|
+
await user.click(screen.getByRole('button', { name: 'Clear input' }))
|
|
81
|
+
expect(input).toHaveValue('')
|
|
82
|
+
expect(onClear).toHaveBeenCalledOnce()
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('renders startSlot and endSlot when provided', () => {
|
|
86
|
+
render(
|
|
87
|
+
<Input
|
|
88
|
+
aria-label="With slots"
|
|
89
|
+
startSlot={<span data-testid="start">$</span>}
|
|
90
|
+
endSlot={<span data-testid="end">USD</span>}
|
|
91
|
+
/>,
|
|
92
|
+
)
|
|
93
|
+
expect(screen.getByTestId('start')).toBeInTheDocument()
|
|
94
|
+
expect(screen.getByTestId('end')).toBeInTheDocument()
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
it('bridges aria-invalid to data-invalid on the bare input', () => {
|
|
98
|
+
const { container } = render(<Input aria-label="Email" aria-invalid />)
|
|
99
|
+
const input = container.querySelector('[data-slot="input"]')
|
|
100
|
+
expect(input).toHaveAttribute('aria-invalid', 'true')
|
|
101
|
+
expect(input).toHaveAttribute('data-invalid')
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it('bridges aria-invalid to data-invalid on the wrapper when slots are present', () => {
|
|
105
|
+
const { container } = render(<Input aria-label="Email" aria-invalid endSlot={<span>@</span>} />)
|
|
106
|
+
expect(container.querySelector('[data-slot="input-wrapper"]')).toHaveAttribute('data-invalid')
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('does not set data-invalid when valid', () => {
|
|
110
|
+
const { container } = render(<Input aria-label="Email" />)
|
|
111
|
+
expect(container.querySelector('[data-slot="input"]')).not.toHaveAttribute('data-invalid')
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('has no accessibility violations', async () => {
|
|
115
|
+
const { container } = render(<Input aria-label="Email" />)
|
|
116
|
+
expect(await axe(container)).toHaveNoViolations()
|
|
117
|
+
})
|
|
118
|
+
})
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { Input as BaseInput } from '@base-ui/react/input'
|
|
5
|
+
import { type VariantProps } from 'class-variance-authority'
|
|
6
|
+
import { cn, useComposedRefs } from '../../utils'
|
|
7
|
+
import { inputVariants } from './input-variants'
|
|
8
|
+
|
|
9
|
+
type InputVariant = NonNullable<VariantProps<typeof inputVariants>['variant']>
|
|
10
|
+
type InputSize = NonNullable<VariantProps<typeof inputVariants>['size']>
|
|
11
|
+
|
|
12
|
+
interface InputProps extends Omit<React.ComponentProps<typeof BaseInput>, 'size'> {
|
|
13
|
+
variant?: InputVariant
|
|
14
|
+
inputSize?: InputSize
|
|
15
|
+
clearable?: boolean
|
|
16
|
+
startSlot?: React.ReactNode
|
|
17
|
+
endSlot?: React.ReactNode
|
|
18
|
+
onClear?: () => void
|
|
19
|
+
inputProps?: Omit<React.ComponentProps<typeof BaseInput>, 'size'>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function setNativeValue(input: HTMLInputElement, value: string) {
|
|
23
|
+
const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set
|
|
24
|
+
setter?.call(input, value)
|
|
25
|
+
input.dispatchEvent(new Event('input', { bubbles: true }))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function Input({
|
|
29
|
+
className,
|
|
30
|
+
variant = 'outline',
|
|
31
|
+
inputSize = 'md',
|
|
32
|
+
clearable,
|
|
33
|
+
startSlot,
|
|
34
|
+
endSlot,
|
|
35
|
+
onClear,
|
|
36
|
+
inputProps,
|
|
37
|
+
ref,
|
|
38
|
+
...props
|
|
39
|
+
}: InputProps) {
|
|
40
|
+
const innerRef = React.useRef<HTMLInputElement>(null)
|
|
41
|
+
const hasWrapper = Boolean(clearable || startSlot || endSlot)
|
|
42
|
+
|
|
43
|
+
const ariaInvalid = props['aria-invalid']
|
|
44
|
+
const invalid = ariaInvalid === true || ariaInvalid === 'true'
|
|
45
|
+
|
|
46
|
+
const composedRef = useComposedRefs(ref, innerRef)
|
|
47
|
+
|
|
48
|
+
const handleClear = () => {
|
|
49
|
+
if (innerRef.current && props.value === undefined) {
|
|
50
|
+
setNativeValue(innerRef.current, '')
|
|
51
|
+
}
|
|
52
|
+
innerRef.current?.focus()
|
|
53
|
+
onClear?.()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!hasWrapper) {
|
|
57
|
+
return (
|
|
58
|
+
<BaseInput
|
|
59
|
+
data-slot="input"
|
|
60
|
+
ref={composedRef}
|
|
61
|
+
{...inputProps}
|
|
62
|
+
className={cn(
|
|
63
|
+
inputVariants({ variant, size: inputSize, state: 'self' }),
|
|
64
|
+
'placeholder:text-foreground-subtle',
|
|
65
|
+
inputProps?.className,
|
|
66
|
+
className,
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
{...(invalid ? { 'data-invalid': '' } : {})}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
data-slot="input-wrapper"
|
|
77
|
+
className={cn(inputVariants({ variant, size: inputSize, state: 'within' }), className)}
|
|
78
|
+
{...(invalid ? { 'data-invalid': '' } : {})}
|
|
79
|
+
>
|
|
80
|
+
{startSlot && (
|
|
81
|
+
<div data-slot="input-start" className="-ms-1 shrink-0">
|
|
82
|
+
{startSlot}
|
|
83
|
+
</div>
|
|
84
|
+
)}
|
|
85
|
+
<BaseInput
|
|
86
|
+
data-slot="input"
|
|
87
|
+
ref={composedRef}
|
|
88
|
+
placeholder={props.placeholder ?? ' '}
|
|
89
|
+
{...inputProps}
|
|
90
|
+
className={cn(
|
|
91
|
+
'peer text-foreground placeholder:text-foreground-subtle h-full min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed',
|
|
92
|
+
inputProps?.className,
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
{clearable && (
|
|
97
|
+
<button
|
|
98
|
+
data-slot="input-clear"
|
|
99
|
+
type="button"
|
|
100
|
+
onClick={handleClear}
|
|
101
|
+
className="text-foreground-subtle hover:text-foreground pointer-events-none shrink-0 cursor-pointer opacity-0 transition-[opacity,color] duration-200 peer-not-placeholder-shown:pointer-events-auto peer-not-placeholder-shown:opacity-100"
|
|
102
|
+
tabIndex={-1}
|
|
103
|
+
aria-label="Clear input"
|
|
104
|
+
>
|
|
105
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="2 2 16 16" fill="currentColor" className="size-[1em]">
|
|
106
|
+
<path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" />
|
|
107
|
+
</svg>
|
|
108
|
+
</button>
|
|
109
|
+
)}
|
|
110
|
+
{endSlot && (
|
|
111
|
+
<div data-slot="input-end" className="-me-1 shrink-0">
|
|
112
|
+
{endSlot}
|
|
113
|
+
</div>
|
|
114
|
+
)}
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { Input }
|
|
120
|
+
export type { InputProps }
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import { describe, expect, it } from 'vitest'
|
|
4
|
+
import { axe } from 'vitest-axe'
|
|
5
|
+
import { Kbd, KbdGroup } from './kbd'
|
|
6
|
+
|
|
7
|
+
describe('Kbd', () => {
|
|
8
|
+
it('renders a <kbd> with data-slot and default md size classes', () => {
|
|
9
|
+
const { container } = render(<Kbd>K</Kbd>)
|
|
10
|
+
const el = container.querySelector('[data-slot="kbd"]') as HTMLElement
|
|
11
|
+
expect(el).not.toBeNull()
|
|
12
|
+
expect(el.tagName).toBe('KBD')
|
|
13
|
+
expect(el.className).toContain('text-sm')
|
|
14
|
+
expect(el.className).toContain('min-w-6')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it.each([
|
|
18
|
+
['sm', 'min-w-5', 'text-xs'],
|
|
19
|
+
['md', 'min-w-6', 'text-sm'],
|
|
20
|
+
['lg', 'min-w-7', 'text-base'],
|
|
21
|
+
] as const)('applies size="%s" classes', (size, minW, text) => {
|
|
22
|
+
const { container } = render(<Kbd size={size}>K</Kbd>)
|
|
23
|
+
const el = container.querySelector('[data-slot="kbd"]') as HTMLElement
|
|
24
|
+
expect(el.className).toContain(minW)
|
|
25
|
+
expect(el.className).toContain(text)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('merges caller className', () => {
|
|
29
|
+
const { container } = render(<Kbd className="my-kbd">K</Kbd>)
|
|
30
|
+
const el = container.querySelector('[data-slot="kbd"]') as HTMLElement
|
|
31
|
+
expect(el.className).toContain('my-kbd')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('forwards extra props to the kbd element', () => {
|
|
35
|
+
const { container } = render(<Kbd aria-label="key">K</Kbd>)
|
|
36
|
+
const el = container.querySelector('[data-slot="kbd"]') as HTMLElement
|
|
37
|
+
expect(el.getAttribute('aria-label')).toBe('key')
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('has no accessibility violations', async () => {
|
|
41
|
+
const { container } = render(<Kbd>K</Kbd>)
|
|
42
|
+
expect(await axe(container)).toHaveNoViolations()
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
describe('KbdGroup', () => {
|
|
47
|
+
it('renders a data-slot wrapper', () => {
|
|
48
|
+
const { container } = render(
|
|
49
|
+
<KbdGroup>
|
|
50
|
+
<Kbd>⌘</Kbd>
|
|
51
|
+
<Kbd>K</Kbd>
|
|
52
|
+
</KbdGroup>,
|
|
53
|
+
)
|
|
54
|
+
const group = container.querySelector('[data-slot="kbd-group"]') as HTMLElement
|
|
55
|
+
expect(group).not.toBeNull()
|
|
56
|
+
expect(group.className).toContain('inline-flex')
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('propagates size to child Kbd elements', () => {
|
|
60
|
+
const { container } = render(
|
|
61
|
+
<KbdGroup size="lg">
|
|
62
|
+
<Kbd data-testid="a">⌘</Kbd>
|
|
63
|
+
<Kbd data-testid="b">K</Kbd>
|
|
64
|
+
</KbdGroup>,
|
|
65
|
+
)
|
|
66
|
+
const a = container.querySelector('[data-testid="a"]') as HTMLElement
|
|
67
|
+
const b = container.querySelector('[data-testid="b"]') as HTMLElement
|
|
68
|
+
expect(a.className).toContain('min-w-7')
|
|
69
|
+
expect(b.className).toContain('min-w-7')
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('lets an explicit size on an inner Kbd override the group default', () => {
|
|
73
|
+
const { container } = render(
|
|
74
|
+
<KbdGroup size="lg">
|
|
75
|
+
<Kbd size="sm" data-testid="overridden">
|
|
76
|
+
⌘
|
|
77
|
+
</Kbd>
|
|
78
|
+
<Kbd data-testid="inherits">K</Kbd>
|
|
79
|
+
</KbdGroup>,
|
|
80
|
+
)
|
|
81
|
+
const overridden = container.querySelector('[data-testid="overridden"]') as HTMLElement
|
|
82
|
+
const inherits = container.querySelector('[data-testid="inherits"]') as HTMLElement
|
|
83
|
+
expect(overridden.className).toContain('min-w-5')
|
|
84
|
+
expect(inherits.className).toContain('min-w-7')
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
it('leaves non-Kbd children untouched', () => {
|
|
88
|
+
const { container } = render(
|
|
89
|
+
<KbdGroup size="lg">
|
|
90
|
+
<span data-testid="plus">+</span>
|
|
91
|
+
<Kbd data-testid="k">K</Kbd>
|
|
92
|
+
</KbdGroup>,
|
|
93
|
+
)
|
|
94
|
+
const plus = container.querySelector('[data-testid="plus"]') as HTMLElement
|
|
95
|
+
expect(plus.tagName).toBe('SPAN')
|
|
96
|
+
const k = container.querySelector('[data-testid="k"]') as HTMLElement
|
|
97
|
+
expect(k.className).toContain('min-w-7')
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it('merges caller className on the wrapper', () => {
|
|
101
|
+
const { container } = render(
|
|
102
|
+
<KbdGroup className="my-group">
|
|
103
|
+
<Kbd>K</Kbd>
|
|
104
|
+
</KbdGroup>,
|
|
105
|
+
)
|
|
106
|
+
const group = container.querySelector('[data-slot="kbd-group"]') as HTMLElement
|
|
107
|
+
expect(group.className).toContain('my-group')
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it('has no accessibility violations', async () => {
|
|
111
|
+
const { container } = render(
|
|
112
|
+
<KbdGroup size="md">
|
|
113
|
+
<Kbd>⌘</Kbd>
|
|
114
|
+
<Kbd>K</Kbd>
|
|
115
|
+
</KbdGroup>,
|
|
116
|
+
)
|
|
117
|
+
expect(await axe(container)).toHaveNoViolations()
|
|
118
|
+
})
|
|
119
|
+
})
|