@appica/ui-react 1.0.0 → 1.2.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/CHANGELOG.md +72 -0
- package/README.md +47 -5
- package/agent-rules.md +41 -0
- package/appica.css +7 -0
- package/dist/components/accordion/accordion.d.ts +24 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/accordion.js +2 -1
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/alert/alert.d.ts +30 -2
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/alert.js +2 -1
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.d.ts +12 -2
- package/dist/components/alert-dialog/alert-dialog.d.ts.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.js +10 -5
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +21 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete.js +3 -2
- package/dist/components/autocomplete/autocomplete.js.map +1 -1
- package/dist/components/avatar/avatar.d.ts +17 -1
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +2 -1
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/background-pattern/background-pattern-interactive.d.ts +2 -1
- package/dist/components/background-pattern/background-pattern-interactive.d.ts.map +1 -1
- package/dist/components/background-pattern/background-pattern-interactive.js +4 -2
- package/dist/components/background-pattern/background-pattern-interactive.js.map +1 -1
- package/dist/components/background-pattern/background-pattern-shared.d.ts +3 -2
- package/dist/components/background-pattern/background-pattern-shared.d.ts.map +1 -1
- package/dist/components/background-pattern/background-pattern-shared.js +48 -16
- package/dist/components/background-pattern/background-pattern-shared.js.map +1 -1
- package/dist/components/background-pattern/background-pattern.d.ts +13 -5
- package/dist/components/background-pattern/background-pattern.d.ts.map +1 -1
- package/dist/components/background-pattern/background-pattern.js +13 -4
- package/dist/components/background-pattern/background-pattern.js.map +1 -1
- package/dist/components/background-pattern/index.js +1 -0
- package/dist/components/background-pattern/index.js.map +1 -1
- package/dist/components/badge/badge.d.ts +13 -3
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +2 -1
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/border-beam/border-beam.d.ts +52 -0
- package/dist/components/border-beam/border-beam.d.ts.map +1 -0
- package/dist/components/border-beam/border-beam.js +68 -0
- package/dist/components/border-beam/border-beam.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +8 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +2 -1
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/button/button-variants.d.ts +2 -2
- package/dist/components/button/button-variants.js +2 -1
- package/dist/components/button/button-variants.js.map +1 -1
- package/dist/components/button/button.d.ts +11 -1
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +2 -1
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button/index.js +1 -0
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/button-group-context.js +1 -0
- package/dist/components/button-group/button-group-context.js.map +1 -1
- package/dist/components/button-group/button-group.d.ts +10 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -1
- package/dist/components/button-group/button-group.js +2 -1
- package/dist/components/button-group/button-group.js.map +1 -1
- package/dist/components/calendar/calendar.d.ts +5 -0
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/calendar.js +2 -1
- package/dist/components/calendar/calendar.js.map +1 -1
- package/dist/components/card/card.d.ts +43 -0
- package/dist/components/card/card.d.ts.map +1 -0
- package/dist/components/card/card.js +104 -0
- package/dist/components/card/card.js.map +1 -0
- package/dist/components/carousel/carousel.d.ts +106 -6
- package/dist/components/carousel/carousel.d.ts.map +1 -1
- package/dist/components/carousel/carousel.js +180 -5
- package/dist/components/carousel/carousel.js.map +1 -1
- package/dist/components/checkbox/checkbox.js +2 -1
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.d.ts +4 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.js +2 -1
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/components/chip/chip.d.ts +33 -1
- package/dist/components/chip/chip.d.ts.map +1 -1
- package/dist/components/chip/chip.js +2 -1
- package/dist/components/chip/chip.js.map +1 -1
- package/dist/components/collapsible/collapsible.js +2 -1
- package/dist/components/collapsible/collapsible.js.map +1 -1
- package/dist/components/color-area/color-area.d.ts +53 -0
- package/dist/components/color-area/color-area.d.ts.map +1 -0
- package/dist/components/color-area/color-area.js +246 -0
- package/dist/components/color-area/color-area.js.map +1 -0
- package/dist/components/color-picker/color-picker.d.ts +152 -0
- package/dist/components/color-picker/color-picker.d.ts.map +1 -0
- package/dist/components/color-picker/color-picker.js +328 -0
- package/dist/components/color-picker/color-picker.js.map +1 -0
- package/dist/components/color-slider/color-slider.d.ts +48 -0
- package/dist/components/color-slider/color-slider.d.ts.map +1 -0
- package/dist/components/color-slider/color-slider.js +217 -0
- package/dist/components/color-slider/color-slider.js.map +1 -0
- package/dist/components/color-swatch/color-swatch.d.ts +47 -0
- package/dist/components/color-swatch/color-swatch.d.ts.map +1 -0
- package/dist/components/color-swatch/color-swatch.js +67 -0
- package/dist/components/color-swatch/color-swatch.js.map +1 -0
- package/dist/components/color-swatch-picker/color-swatch-picker.d.ts +62 -0
- package/dist/components/color-swatch-picker/color-swatch-picker.d.ts.map +1 -0
- package/dist/components/color-swatch-picker/color-swatch-picker.js +203 -0
- package/dist/components/color-swatch-picker/color-swatch-picker.js.map +1 -0
- package/dist/components/combobox/combobox.d.ts +25 -1
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/combobox.js +3 -2
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/context-menu/context-menu.d.ts +7 -1
- package/dist/components/context-menu/context-menu.d.ts.map +1 -1
- package/dist/components/context-menu/context-menu.js +11 -5
- package/dist/components/context-menu/context-menu.js.map +1 -1
- package/dist/components/copy-button/copy-button.d.ts +18 -1
- package/dist/components/copy-button/copy-button.d.ts.map +1 -1
- package/dist/components/copy-button/copy-button.js +6 -5
- package/dist/components/copy-button/copy-button.js.map +1 -1
- package/dist/components/countdown/countdown.d.ts +14 -0
- package/dist/components/countdown/countdown.d.ts.map +1 -1
- package/dist/components/countdown/countdown.js +2 -1
- package/dist/components/countdown/countdown.js.map +1 -1
- package/dist/components/date-field/date-field.d.ts +35 -0
- package/dist/components/date-field/date-field.d.ts.map +1 -1
- package/dist/components/date-field/date-field.js +2 -1
- package/dist/components/date-field/date-field.js.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +94 -0
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.js +2 -1
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/dialog/dialog.d.ts +20 -2
- package/dist/components/dialog/dialog.d.ts.map +1 -1
- package/dist/components/dialog/dialog.js +9 -4
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.d.ts +22 -2
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/drawer.js +14 -7
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +7 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +11 -5
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/field/field.js +2 -1
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/fieldset/fieldset.js +2 -1
- package/dist/components/fieldset/fieldset.js.map +1 -1
- package/dist/components/form/form.js +1 -0
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/gradient-glow/gradient-glow.d.ts +51 -1
- package/dist/components/gradient-glow/gradient-glow.d.ts.map +1 -1
- package/dist/components/gradient-glow/gradient-glow.js +5 -3
- package/dist/components/gradient-glow/gradient-glow.js.map +1 -1
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input/input-variants.d.ts +1 -1
- package/dist/components/input/input-variants.js +2 -1
- package/dist/components/input/input-variants.js.map +1 -1
- package/dist/components/input/input.d.ts +21 -1
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +4 -3
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/kbd/kbd.d.ts +8 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/kbd/kbd.js +2 -1
- package/dist/components/kbd/kbd.js.map +1 -1
- package/dist/components/loader/loader.d.ts +8 -0
- package/dist/components/loader/loader.d.ts.map +1 -1
- package/dist/components/loader/loader.js +2 -1
- package/dist/components/loader/loader.js.map +1 -1
- package/dist/components/menubar/menubar.d.ts +8 -0
- package/dist/components/menubar/menubar.d.ts.map +1 -1
- package/dist/components/menubar/menubar.js +2 -1
- package/dist/components/menubar/menubar.js.map +1 -1
- package/dist/components/meter/meter.d.ts +4 -0
- package/dist/components/meter/meter.d.ts.map +1 -1
- package/dist/components/meter/meter.js +2 -1
- package/dist/components/meter/meter.js.map +1 -1
- package/dist/components/navigation/index.js +1 -0
- package/dist/components/navigation/index.js.map +1 -1
- package/dist/components/navigation/navigation-context.js +1 -0
- package/dist/components/navigation/navigation-context.js.map +1 -1
- package/dist/components/navigation/navigation-link-variants.d.ts +2 -2
- package/dist/components/navigation/navigation-link-variants.js +2 -1
- package/dist/components/navigation/navigation-link-variants.js.map +1 -1
- package/dist/components/navigation/navigation-link.d.ts +22 -0
- package/dist/components/navigation/navigation-link.d.ts.map +1 -1
- package/dist/components/navigation/navigation-link.js +2 -1
- package/dist/components/navigation/navigation-link.js.map +1 -1
- package/dist/components/navigation/navigation.d.ts +12 -0
- package/dist/components/navigation/navigation.d.ts.map +1 -1
- package/dist/components/navigation/navigation.js +2 -1
- package/dist/components/navigation/navigation.js.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.d.ts +33 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.js +2 -1
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/number-field/number-field.d.ts +14 -0
- package/dist/components/number-field/number-field.d.ts.map +1 -1
- package/dist/components/number-field/number-field.js +2 -1
- package/dist/components/number-field/number-field.js.map +1 -1
- package/dist/components/otp-field/otp-field.d.ts +9 -0
- package/dist/components/otp-field/otp-field.d.ts.map +1 -1
- package/dist/components/otp-field/otp-field.js +2 -1
- package/dist/components/otp-field/otp-field.js.map +1 -1
- package/dist/components/pagination/pagination.d.ts +16 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -1
- package/dist/components/pagination/pagination.js +2 -1
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/popover/popover.d.ts +5 -1
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +3 -2
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/preview-card/preview-card.d.ts +5 -1
- package/dist/components/preview-card/preview-card.d.ts.map +1 -1
- package/dist/components/preview-card/preview-card.js +3 -2
- package/dist/components/preview-card/preview-card.js.map +1 -1
- package/dist/components/progress/progress.d.ts +17 -0
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/progress/progress.js +2 -1
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/radio/radio.js +2 -1
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts +4 -0
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/radio-group/radio-group.js +2 -1
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/rating/rating.d.ts +79 -0
- package/dist/components/rating/rating.d.ts.map +1 -0
- package/dist/components/rating/rating.js +302 -0
- package/dist/components/rating/rating.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +13 -0
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -1
- package/dist/components/scroll-area/scroll-area.js +2 -1
- package/dist/components/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/select/select.d.ts +20 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +3 -2
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/separator/separator.d.ts +4 -0
- package/dist/components/separator/separator.d.ts.map +1 -1
- package/dist/components/separator/separator.js +2 -1
- package/dist/components/separator/separator.js.map +1 -1
- package/dist/components/skeleton/skeleton.d.ts +4 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.js +2 -1
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/slider/slider.d.ts +5 -0
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/slider/slider.js +2 -1
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/sparkline/sparkline.d.ts +44 -0
- package/dist/components/sparkline/sparkline.d.ts.map +1 -1
- package/dist/components/sparkline/sparkline.js +2 -1
- package/dist/components/sparkline/sparkline.js.map +1 -1
- package/dist/components/spinner/spinner.d.ts +8 -0
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/spinner/spinner.js +2 -1
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/switch/switch.d.ts +19 -15
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/switch/switch.js +2 -1
- package/dist/components/switch/switch.js.map +1 -1
- package/dist/components/table/table.d.ts +28 -0
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +2 -1
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.d.ts +32 -2
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +2 -1
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/text-animate/text-animate.d.ts +31 -0
- package/dist/components/text-animate/text-animate.d.ts.map +1 -1
- package/dist/components/text-animate/text-animate.js +27 -9
- package/dist/components/text-animate/text-animate.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts +15 -0
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/textarea/textarea.js +2 -1
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/components/thumbnail/thumbnail.d.ts +22 -2
- package/dist/components/thumbnail/thumbnail.d.ts.map +1 -1
- package/dist/components/thumbnail/thumbnail.js +2 -1
- package/dist/components/thumbnail/thumbnail.js.map +1 -1
- package/dist/components/time-field/time-field.d.ts +35 -0
- package/dist/components/time-field/time-field.d.ts.map +1 -1
- package/dist/components/time-field/time-field.js +2 -1
- package/dist/components/time-field/time-field.js.map +1 -1
- package/dist/components/toast/toast.d.ts +18 -0
- package/dist/components/toast/toast.d.ts.map +1 -1
- package/dist/components/toast/toast.js +2 -1
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/toc/toc.d.ts +10 -0
- package/dist/components/toc/toc.d.ts.map +1 -1
- package/dist/components/toc/toc.js +2 -1
- package/dist/components/toc/toc.js.map +1 -1
- package/dist/components/toggle/toggle.js +1 -0
- package/dist/components/toggle/toggle.js.map +1 -1
- package/dist/components/toggle-group/toggle-group.js +2 -1
- package/dist/components/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/toolbar/toolbar.js +2 -1
- package/dist/components/toolbar/toolbar.js.map +1 -1
- package/dist/components/tooltip/tooltip.d.ts +5 -1
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +3 -2
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/hooks/use-direction.js +1 -0
- package/dist/hooks/use-direction.js.map +1 -1
- package/dist/hooks/use-dismissible.d.ts +4 -0
- package/dist/hooks/use-dismissible.d.ts.map +1 -1
- package/dist/hooks/use-dismissible.js +1 -0
- package/dist/hooks/use-dismissible.js.map +1 -1
- package/dist/hooks/use-local-storage.js +1 -0
- package/dist/hooks/use-local-storage.js.map +1 -1
- package/dist/hooks/use-media-query.js +1 -0
- package/dist/hooks/use-media-query.js.map +1 -1
- package/dist/hooks/use-reduced-motion.d.ts +1 -1
- package/dist/hooks/use-reduced-motion.js +1 -0
- package/dist/hooks/use-reduced-motion.js.map +1 -1
- package/dist/hooks/use-theme.d.ts +1 -1
- package/dist/hooks/use-theme.js +1 -0
- package/dist/hooks/use-theme.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/color-control.d.ts +75 -0
- package/dist/internal/color-control.d.ts.map +1 -0
- package/dist/internal/color-control.js +79 -0
- package/dist/internal/color-control.js.map +1 -0
- package/dist/internal/color-math.d.ts +9 -0
- package/dist/internal/color-math.d.ts.map +1 -0
- package/dist/internal/color-math.js +35 -0
- package/dist/internal/color-math.js.map +1 -0
- package/dist/internal/color-picker-context.d.ts +34 -0
- package/dist/internal/color-picker-context.d.ts.map +1 -0
- package/dist/internal/color-picker-context.js +42 -0
- package/dist/internal/color-picker-context.js.map +1 -0
- package/dist/{floating.d.ts → internal/floating.d.ts} +3 -3
- package/dist/internal/floating.d.ts.map +1 -0
- package/dist/{floating.js → internal/floating.js} +1 -0
- package/dist/internal/floating.js.map +1 -0
- package/dist/{modal.d.ts → internal/modal.d.ts} +2 -2
- package/dist/internal/modal.d.ts.map +1 -0
- package/dist/{modal.js → internal/modal.js} +1 -0
- package/dist/internal/modal.js.map +1 -0
- package/dist/{utils.d.ts → internal/utils.d.ts} +2 -2
- package/dist/internal/utils.d.ts.map +1 -0
- package/dist/{utils.js → internal/utils.js} +1 -0
- package/dist/internal/utils.js.map +1 -0
- package/dist/lib/color.d.ts +95 -0
- package/dist/lib/color.d.ts.map +1 -0
- package/dist/lib/color.js +329 -0
- package/dist/lib/color.js.map +1 -0
- package/dist/providers/direction-provider.d.ts +4 -4
- package/dist/providers/direction-provider.d.ts.map +1 -1
- package/dist/providers/direction-provider.js +1 -0
- package/dist/providers/direction-provider.js.map +1 -1
- package/dist/providers/reduced-motion-provider.d.ts +4 -8
- package/dist/providers/reduced-motion-provider.d.ts.map +1 -1
- package/dist/providers/reduced-motion-provider.js +1 -0
- package/dist/providers/reduced-motion-provider.js.map +1 -1
- package/dist/providers/theme-provider/index.js +1 -0
- package/dist/providers/theme-provider/index.js.map +1 -1
- package/dist/providers/theme-provider/theme-provider.d.ts +28 -12
- package/dist/providers/theme-provider/theme-provider.d.ts.map +1 -1
- package/dist/providers/theme-provider/theme-provider.js +1 -0
- package/dist/providers/theme-provider/theme-provider.js.map +1 -1
- package/dist/providers/theme-provider/theme-script.js +1 -0
- package/dist/providers/theme-provider/theme-script.js.map +1 -1
- package/package.json +91 -31
- package/src/components/accordion/accordion.tsx +25 -1
- package/src/components/alert/alert.tsx +30 -2
- package/src/components/alert-dialog/alert-dialog.test.tsx +34 -2
- package/src/components/alert-dialog/alert-dialog.tsx +21 -5
- package/src/components/autocomplete/autocomplete.test.tsx +1 -1
- package/src/components/autocomplete/autocomplete.tsx +22 -2
- package/src/components/avatar/avatar.test.tsx +2 -2
- package/src/components/avatar/avatar.tsx +17 -1
- package/src/components/background-pattern/background-pattern-interactive.tsx +4 -2
- package/src/components/background-pattern/background-pattern-shared.tsx +56 -19
- package/src/components/background-pattern/background-pattern.test.tsx +36 -1
- package/src/components/background-pattern/background-pattern.tsx +24 -9
- package/src/components/badge/badge.tsx +14 -2
- package/src/components/border-beam/border-beam.test.tsx +91 -0
- package/src/components/border-beam/border-beam.tsx +131 -0
- package/src/components/breadcrumb/breadcrumb.tsx +9 -1
- package/src/components/button/button-variants.ts +1 -1
- package/src/components/button/button.tsx +13 -2
- package/src/components/button-group/button-group.tsx +11 -1
- package/src/components/calendar/calendar.tsx +6 -1
- package/src/components/card/card.test.tsx +98 -0
- package/src/components/card/card.tsx +154 -0
- package/src/components/carousel/carousel.test.tsx +179 -0
- package/src/components/carousel/carousel.tsx +329 -6
- package/src/components/checkbox/checkbox.test.tsx +2 -2
- package/src/components/checkbox/checkbox.tsx +1 -1
- package/src/components/checkbox-group/checkbox-group.tsx +5 -1
- package/src/components/chip/chip.tsx +33 -1
- package/src/components/collapsible/collapsible.tsx +1 -1
- package/src/components/color-area/color-area.test.tsx +242 -0
- package/src/components/color-area/color-area.tsx +356 -0
- package/src/components/color-picker/color-picker.test.tsx +286 -0
- package/src/components/color-picker/color-picker.tsx +546 -0
- package/src/components/color-slider/color-slider.test.tsx +222 -0
- package/src/components/color-slider/color-slider.tsx +330 -0
- package/src/components/color-swatch/color-swatch.test.tsx +117 -0
- package/src/components/color-swatch/color-swatch.tsx +119 -0
- package/src/components/color-swatch-picker/color-swatch-picker.test.tsx +287 -0
- package/src/components/color-swatch-picker/color-swatch-picker.tsx +327 -0
- package/src/components/combobox/combobox.test.tsx +1 -1
- package/src/components/combobox/combobox.tsx +26 -2
- package/src/components/context-menu/context-menu.test.tsx +28 -0
- package/src/components/context-menu/context-menu.tsx +16 -5
- package/src/components/copy-button/copy-button.test.tsx +14 -1
- package/src/components/copy-button/copy-button.tsx +27 -6
- package/src/components/countdown/countdown.tsx +15 -1
- package/src/components/date-field/date-field.tsx +36 -1
- package/src/components/date-picker/date-picker.test.tsx +1 -1
- package/src/components/date-picker/date-picker.tsx +95 -1
- package/src/components/dialog/dialog.test.tsx +30 -1
- package/src/components/dialog/dialog.tsx +28 -6
- package/src/components/drawer/drawer.test.tsx +32 -1
- package/src/components/drawer/drawer.tsx +37 -7
- package/src/components/dropdown-menu/dropdown-menu.test.tsx +28 -0
- package/src/components/dropdown-menu/dropdown-menu.tsx +16 -5
- package/src/components/field/field.tsx +1 -1
- package/src/components/fieldset/fieldset.tsx +1 -1
- package/src/components/gradient-glow/gradient-glow.test.tsx +7 -1
- package/src/components/gradient-glow/gradient-glow.tsx +64 -11
- package/src/components/input/input-variants.ts +1 -1
- package/src/components/input/input.tsx +24 -4
- package/src/components/kbd/kbd.tsx +9 -1
- package/src/components/loader/loader.tsx +9 -1
- package/src/components/menubar/menubar.tsx +9 -1
- package/src/components/meter/meter.tsx +5 -1
- package/src/components/navigation/navigation-link-variants.ts +1 -1
- package/src/components/navigation/navigation-link.tsx +23 -1
- package/src/components/navigation/navigation.tsx +23 -3
- package/src/components/navigation-menu/navigation-menu.tsx +34 -1
- package/src/components/number-field/number-field.tsx +15 -1
- package/src/components/otp-field/otp-field.tsx +10 -1
- package/src/components/pagination/pagination.tsx +17 -1
- package/src/components/popover/popover.test.tsx +1 -1
- package/src/components/popover/popover.tsx +6 -2
- package/src/components/preview-card/preview-card.tsx +6 -2
- package/src/components/progress/progress.tsx +18 -1
- package/src/components/radio/radio.test.tsx +1 -1
- package/src/components/radio/radio.tsx +1 -1
- package/src/components/radio-group/radio-group.test.tsx +1 -1
- package/src/components/radio-group/radio-group.tsx +5 -1
- package/src/components/rating/rating.test.tsx +246 -0
- package/src/components/rating/rating.tsx +457 -0
- package/src/components/scroll-area/scroll-area.test.tsx +1 -1
- package/src/components/scroll-area/scroll-area.tsx +14 -1
- package/src/components/select/select.tsx +21 -2
- package/src/components/separator/separator.tsx +5 -1
- package/src/components/skeleton/skeleton.tsx +5 -1
- package/src/components/slider/slider.test.tsx +1 -1
- package/src/components/slider/slider.tsx +6 -1
- package/src/components/sparkline/sparkline.test.tsx +1 -1
- package/src/components/sparkline/sparkline.tsx +45 -1
- package/src/components/spinner/spinner.tsx +9 -1
- package/src/components/switch/switch.test.tsx +1 -1
- package/src/components/switch/switch.tsx +5 -1
- package/src/components/table/table.tsx +29 -1
- package/src/components/tabs/tabs.test.tsx +1 -1
- package/src/components/tabs/tabs.tsx +33 -2
- package/src/components/text-animate/text-animate.test.tsx +62 -0
- package/src/components/text-animate/text-animate.tsx +77 -9
- package/src/components/textarea/textarea.tsx +16 -1
- package/src/components/thumbnail/thumbnail.test.tsx +1 -1
- package/src/components/thumbnail/thumbnail.tsx +21 -1
- package/src/components/time-field/time-field.tsx +36 -1
- package/src/components/toast/toast.test.tsx +1 -1
- package/src/components/toast/toast.tsx +19 -1
- package/src/components/toc/toc.tsx +11 -1
- package/src/components/toggle/toggle.test.tsx +1 -1
- package/src/components/toggle-group/toggle-group.tsx +1 -1
- package/src/components/toolbar/toolbar.tsx +1 -1
- package/src/components/tooltip/tooltip.test.tsx +1 -1
- package/src/components/tooltip/tooltip.tsx +6 -2
- package/src/hooks/use-dismissible.ts +4 -0
- package/src/hooks/use-local-storage.ts +3 -3
- package/src/hooks/use-reduced-motion.ts +1 -1
- package/src/hooks/use-theme.ts +1 -1
- package/src/index.ts +11 -2
- package/src/internal/color-control.ts +178 -0
- package/src/internal/color-math.ts +44 -0
- package/src/internal/color-picker-context.ts +80 -0
- package/src/{floating.ts → internal/floating.ts} +3 -3
- package/src/{modal.ts → internal/modal.ts} +3 -3
- package/src/lib/color.test.ts +178 -0
- package/src/lib/color.ts +471 -0
- package/src/providers/direction-provider.tsx +4 -4
- package/src/providers/reduced-motion-provider.tsx +4 -8
- package/src/providers/theme-provider/theme-provider.tsx +28 -12
- package/src/providers/theme-provider/theme-script.tsx +2 -2
- package/src/test/setup.ts +1 -1
- package/styles.css +28 -4
- package/dist/floating.d.ts.map +0 -1
- package/dist/floating.js.map +0 -1
- package/dist/modal.d.ts.map +0 -1
- package/dist/modal.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
- /package/src/{floating.test.ts → internal/floating.test.ts} +0 -0
- /package/src/{modal.test.ts → internal/modal.test.ts} +0 -0
- /package/src/{utils.test.tsx → internal/utils.test.tsx} +0 -0
- /package/src/{utils.ts → internal/utils.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import * as React from 'react'
|
|
4
|
-
import { cn } from '../../utils'
|
|
4
|
+
import { cn } from '../../internal/utils'
|
|
5
5
|
import { useDirection } from '../../hooks/use-direction'
|
|
6
6
|
|
|
7
7
|
type SparklineVariant = 'line' | 'area' | 'column'
|
|
@@ -32,11 +32,20 @@ function useSparkline(): SparklineContextValue {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
interface SparklineProps extends Omit<React.ComponentProps<'div'>, 'onChange'> {
|
|
35
|
+
/** **Required.** The series to plot. */
|
|
35
36
|
data: number[]
|
|
37
|
+
/** Per-point labels (e.g. dates), surfaced in the tooltip and to `SparklineLabel`. */
|
|
36
38
|
labels?: string[]
|
|
39
|
+
/**
|
|
40
|
+
* Accent for the line, fill, indicator, and tooltip swatch. Any CSS color.
|
|
41
|
+
* @default var(--primary)
|
|
42
|
+
*/
|
|
37
43
|
color?: string
|
|
44
|
+
/** Formatting for displayed values (`SparklineValue`, tooltip). */
|
|
38
45
|
format?: Intl.NumberFormatOptions
|
|
46
|
+
/** Locale used by `Intl.NumberFormat`. */
|
|
39
47
|
locale?: Intl.LocalesArgument
|
|
48
|
+
/** Fires when the hovered point changes; `null` on pointer leave. */
|
|
40
49
|
onActiveChange?: (point: SparklinePoint | null) => void
|
|
41
50
|
}
|
|
42
51
|
|
|
@@ -95,14 +104,47 @@ function Sparkline({
|
|
|
95
104
|
}
|
|
96
105
|
|
|
97
106
|
interface SparklineChartProps extends Omit<React.ComponentProps<'div'>, 'children'> {
|
|
107
|
+
/**
|
|
108
|
+
* The layout.
|
|
109
|
+
* @default 'line'
|
|
110
|
+
*/
|
|
98
111
|
variant?: SparklineVariant
|
|
112
|
+
/**
|
|
113
|
+
* Line smoothing from `0` (straight) to `1` (fully rounded). Line/area only.
|
|
114
|
+
* @default 0.5
|
|
115
|
+
*/
|
|
99
116
|
curve?: number
|
|
117
|
+
/**
|
|
118
|
+
* **`line` only.** Add a gradient fill from the line to the bottom edge. Area is always filled.
|
|
119
|
+
* @default false
|
|
120
|
+
*/
|
|
100
121
|
fill?: boolean
|
|
122
|
+
/**
|
|
123
|
+
* The pivot the fill/bars grow from; values below it render below. Area and column.
|
|
124
|
+
* @default 0
|
|
125
|
+
*/
|
|
101
126
|
baseline?: number
|
|
127
|
+
/**
|
|
128
|
+
* Chart height, in pixels.
|
|
129
|
+
* @default 48
|
|
130
|
+
*/
|
|
102
131
|
height?: number
|
|
132
|
+
/**
|
|
133
|
+
* Line thickness, in pixels. Line/area only.
|
|
134
|
+
* @default 2
|
|
135
|
+
*/
|
|
103
136
|
strokeWidth?: number
|
|
137
|
+
/**
|
|
138
|
+
* Show the hover indicator (dot + guide, or the active-column highlight).
|
|
139
|
+
* @default true
|
|
140
|
+
*/
|
|
104
141
|
indicator?: boolean
|
|
142
|
+
/**
|
|
143
|
+
* Float a tooltip at the hovered point.
|
|
144
|
+
* @default false
|
|
145
|
+
*/
|
|
105
146
|
tooltip?: boolean
|
|
147
|
+
/** Render custom tooltip content instead of the default swatch + value. Implies `tooltip`. */
|
|
106
148
|
renderTooltip?: (point: SparklinePoint) => React.ReactNode
|
|
107
149
|
}
|
|
108
150
|
|
|
@@ -352,6 +394,7 @@ function SparklineChart({
|
|
|
352
394
|
}
|
|
353
395
|
|
|
354
396
|
type SparklineValueProps = Omit<React.ComponentProps<'span'>, 'children'> & {
|
|
397
|
+
/** Render function to fully customize the displayed text. Omit for the number. */
|
|
355
398
|
children?: (formatted: string, value: number) => React.ReactNode
|
|
356
399
|
}
|
|
357
400
|
|
|
@@ -372,6 +415,7 @@ function SparklineValue({ className, children, ...props }: SparklineValueProps)
|
|
|
372
415
|
}
|
|
373
416
|
|
|
374
417
|
type SparklineLabelProps = Omit<React.ComponentProps<'span'>, 'children'> & {
|
|
418
|
+
/** Render function to customize the displayed text. Omit for the raw label. */
|
|
375
419
|
children?: (label: string, point: SparklinePoint) => React.ReactNode
|
|
376
420
|
}
|
|
377
421
|
|
|
@@ -3,12 +3,20 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { animate, LazyMotion, domAnimation, m, useMotionValue, useTransform } from 'motion/react'
|
|
5
5
|
import { useReducedMotion } from '../../hooks/use-reduced-motion'
|
|
6
|
-
import { cn } from '../../utils'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
7
|
|
|
8
8
|
type SpinnerVariant = 'circular' | 'dots' | 'sparkle'
|
|
9
9
|
|
|
10
10
|
interface SpinnerProps extends Omit<React.ComponentProps<'span'>, 'children'> {
|
|
11
|
+
/**
|
|
12
|
+
* The animated shape.
|
|
13
|
+
* @default 'circular'
|
|
14
|
+
*/
|
|
11
15
|
variant?: SpinnerVariant
|
|
16
|
+
/**
|
|
17
|
+
* Inherit the surrounding text color (`currentColor`) instead of the primary accent.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
12
20
|
currentColor?: boolean
|
|
13
21
|
}
|
|
14
22
|
|
|
@@ -71,7 +71,7 @@ describe('Switch', () => {
|
|
|
71
71
|
expect(onCheckedChange).not.toHaveBeenCalled()
|
|
72
72
|
})
|
|
73
73
|
|
|
74
|
-
it('
|
|
74
|
+
it('honors controlled checked prop', async () => {
|
|
75
75
|
const user = userEvent.setup()
|
|
76
76
|
const onCheckedChange = vi.fn()
|
|
77
77
|
render(<Switch checked={false} aria-label="Controlled" onCheckedChange={onCheckedChange} />)
|
|
@@ -5,7 +5,7 @@ import { Switch as BaseSwitch } from '@base-ui/react/switch'
|
|
|
5
5
|
import { LazyMotion, domAnimation, m, useAnimate } from 'motion/react'
|
|
6
6
|
import { useDirection } from '../../hooks/use-direction'
|
|
7
7
|
import { useReducedMotion } from '../../hooks/use-reduced-motion'
|
|
8
|
-
import { cn, useComposedRefs } from '../../utils'
|
|
8
|
+
import { cn, useComposedRefs } from '../../internal/utils'
|
|
9
9
|
|
|
10
10
|
const switchSizes = {
|
|
11
11
|
sm: {
|
|
@@ -112,6 +112,10 @@ function SwitchThumb({
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
interface SwitchProps extends React.ComponentProps<typeof BaseSwitch.Root> {
|
|
115
|
+
/**
|
|
116
|
+
* Scales the track and thumb together.
|
|
117
|
+
* @default 'md'
|
|
118
|
+
*/
|
|
115
119
|
size?: SwitchSize
|
|
116
120
|
}
|
|
117
121
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import { cn } from '../../utils'
|
|
2
|
+
import { cn } from '../../internal/utils'
|
|
3
3
|
|
|
4
4
|
type TableSize = 'sm' | 'md' | 'lg'
|
|
5
5
|
type TableBorderStyle = 'solid' | 'dashed' | 'none'
|
|
@@ -58,10 +58,30 @@ const rowHoverClasses =
|
|
|
58
58
|
'[&>tbody>tr]:transition-colors [&>tbody>tr]:duration-200 motion-reduce:[&>tbody>tr]:transition-none [&>tbody>tr:hover]:bg-background-subtle'
|
|
59
59
|
|
|
60
60
|
interface TableProps extends React.ComponentPropsWithoutRef<'table'> {
|
|
61
|
+
/**
|
|
62
|
+
* Cell padding, corner radius, and text scale.
|
|
63
|
+
* @default 'md'
|
|
64
|
+
*/
|
|
61
65
|
size?: TableSize
|
|
66
|
+
/**
|
|
67
|
+
* Style of the cell separators.
|
|
68
|
+
* @default 'solid'
|
|
69
|
+
*/
|
|
62
70
|
borderStyle?: TableBorderStyle
|
|
71
|
+
/**
|
|
72
|
+
* Tint alternating rows.
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
63
75
|
stripedRows?: boolean
|
|
76
|
+
/**
|
|
77
|
+
* Tint alternating columns.
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
64
80
|
stripedColumns?: boolean
|
|
81
|
+
/**
|
|
82
|
+
* Tint a row on pointer hover.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
65
85
|
hoverableRows?: boolean
|
|
66
86
|
}
|
|
67
87
|
|
|
@@ -96,6 +116,10 @@ function Table({
|
|
|
96
116
|
}
|
|
97
117
|
|
|
98
118
|
interface TableCaptionProps extends React.ComponentPropsWithoutRef<'caption'> {
|
|
119
|
+
/**
|
|
120
|
+
* Render the caption above or below the table.
|
|
121
|
+
* @default 'bottom'
|
|
122
|
+
*/
|
|
99
123
|
position?: 'top' | 'bottom'
|
|
100
124
|
}
|
|
101
125
|
|
|
@@ -126,6 +150,10 @@ function TableBody({ className, ...props }: TableBodyProps) {
|
|
|
126
150
|
}
|
|
127
151
|
|
|
128
152
|
interface TableRowProps extends React.ComponentPropsWithoutRef<'tr'> {
|
|
153
|
+
/**
|
|
154
|
+
* Apply the persistent highlight background (`data-highlighted`).
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
129
157
|
highlighted?: boolean
|
|
130
158
|
}
|
|
131
159
|
|
|
@@ -77,7 +77,7 @@ describe('Tabs', () => {
|
|
|
77
77
|
expect(screen.getByText('Panel Two')).toBeVisible()
|
|
78
78
|
})
|
|
79
79
|
|
|
80
|
-
it('
|
|
80
|
+
it('honors defaultValue', () => {
|
|
81
81
|
render(<Demo defaultValue="three" />)
|
|
82
82
|
expect(screen.getByRole('tab', { name: 'Three' })).toHaveAttribute('aria-selected', 'true')
|
|
83
83
|
expect(screen.getByText('Panel Three')).toBeVisible()
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { Tabs as BaseTabs } from '@base-ui/react/tabs'
|
|
5
5
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
6
|
-
import { cn } from '../../utils'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
7
|
|
|
8
8
|
type TabsVariant = 'pill' | 'line'
|
|
9
9
|
type TabsSize = 'sm' | 'md' | 'lg'
|
|
@@ -163,8 +163,20 @@ const tabsContentClasses =
|
|
|
163
163
|
type BaseTabsRootProps = React.ComponentProps<typeof BaseTabs.Root>
|
|
164
164
|
|
|
165
165
|
interface TabsProps extends BaseTabsRootProps {
|
|
166
|
+
/**
|
|
167
|
+
* Visual style, shared with the list and triggers via context.
|
|
168
|
+
* @default 'pill'
|
|
169
|
+
*/
|
|
166
170
|
variant?: TabsVariant
|
|
171
|
+
/**
|
|
172
|
+
* Trigger sizing, shared via context.
|
|
173
|
+
* @default 'md'
|
|
174
|
+
*/
|
|
167
175
|
size?: TabsSize
|
|
176
|
+
/**
|
|
177
|
+
* Layout axis and the direction arrow keys move focus. Exposed as `data-orientation`.
|
|
178
|
+
* @default 'horizontal'
|
|
179
|
+
*/
|
|
168
180
|
orientation?: TabsOrientation
|
|
169
181
|
}
|
|
170
182
|
|
|
@@ -185,7 +197,18 @@ function Tabs({ variant = 'pill', size = 'md', orientation = 'horizontal', class
|
|
|
185
197
|
|
|
186
198
|
type BaseTabsListProps = React.ComponentProps<typeof BaseTabs.List>
|
|
187
199
|
|
|
188
|
-
interface TabsListProps extends BaseTabsListProps, VariantProps<typeof tabsListVariants> {
|
|
200
|
+
interface TabsListProps extends BaseTabsListProps, Omit<VariantProps<typeof tabsListVariants>, 'variant' | 'size'> {
|
|
201
|
+
/**
|
|
202
|
+
* Override the root's variant for this list.
|
|
203
|
+
* @default context
|
|
204
|
+
*/
|
|
205
|
+
variant?: VariantProps<typeof tabsListVariants>['variant']
|
|
206
|
+
/**
|
|
207
|
+
* Override the root's size for this list.
|
|
208
|
+
* @default context
|
|
209
|
+
*/
|
|
210
|
+
size?: VariantProps<typeof tabsListVariants>['size']
|
|
211
|
+
}
|
|
189
212
|
|
|
190
213
|
function TabsList({ variant: variantProp, size: sizeProp, className, children, ...rest }: TabsListProps) {
|
|
191
214
|
const ctx = useTabsContext()
|
|
@@ -212,7 +235,15 @@ function TabsList({ variant: variantProp, size: sizeProp, className, children, .
|
|
|
212
235
|
type BaseTabsTabProps = React.ComponentProps<typeof BaseTabs.Tab>
|
|
213
236
|
|
|
214
237
|
interface TabsTriggerProps extends BaseTabsTabProps {
|
|
238
|
+
/**
|
|
239
|
+
* Override the variant for this trigger.
|
|
240
|
+
* @default context
|
|
241
|
+
*/
|
|
215
242
|
variant?: TabsVariant
|
|
243
|
+
/**
|
|
244
|
+
* Override the size; `icon-*` makes a square, label-less trigger.
|
|
245
|
+
* @default context
|
|
246
|
+
*/
|
|
216
247
|
size?: TabsTriggerSize
|
|
217
248
|
}
|
|
218
249
|
|
|
@@ -42,6 +42,68 @@ describe('TextAnimate', () => {
|
|
|
42
42
|
expect(units[2]).toHaveTextContent('three')
|
|
43
43
|
})
|
|
44
44
|
|
|
45
|
+
it('sweeps the shimmer glare across the whole string and returns to the same frame at both ends of the loop', () => {
|
|
46
|
+
const { container, rerender } = render(
|
|
47
|
+
<TextAnimate effect="shimmer" progress={0}>
|
|
48
|
+
Generating response
|
|
49
|
+
</TextAnimate>,
|
|
50
|
+
)
|
|
51
|
+
const visual = () => container.querySelector('[aria-hidden="true"]') as HTMLElement
|
|
52
|
+
|
|
53
|
+
// The gradient paints one band over the whole string, so it lives on the wrapper, not the units.
|
|
54
|
+
expect(visual().style.backgroundClip).toBe('text')
|
|
55
|
+
expect(visual().style.backgroundImage).toContain('linear-gradient')
|
|
56
|
+
// Band parked off the leading edge.
|
|
57
|
+
expect(visual().style.backgroundPosition).toBe('100% 0px')
|
|
58
|
+
|
|
59
|
+
rerender(
|
|
60
|
+
<TextAnimate effect="shimmer" progress={0.5}>
|
|
61
|
+
Generating response
|
|
62
|
+
</TextAnimate>,
|
|
63
|
+
)
|
|
64
|
+
expect(visual().style.backgroundPosition).toBe('50% 0px')
|
|
65
|
+
|
|
66
|
+
// Parked off the trailing edge, which paints identically to progress 0.
|
|
67
|
+
rerender(
|
|
68
|
+
<TextAnimate effect="shimmer" progress={1}>
|
|
69
|
+
Generating response
|
|
70
|
+
</TextAnimate>,
|
|
71
|
+
)
|
|
72
|
+
expect(visual().style.backgroundPosition).toBe('0% 0px')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('keeps the shimmer glare identical however the text is split, so `by` stays orthogonal', () => {
|
|
76
|
+
const positions = (['line', 'word', 'char'] as const).map((by) => {
|
|
77
|
+
const { container, unmount } = render(
|
|
78
|
+
<TextAnimate effect="shimmer" by={by} progress={0.4}>
|
|
79
|
+
Generating a response
|
|
80
|
+
</TextAnimate>,
|
|
81
|
+
)
|
|
82
|
+
const visual = container.querySelector('[aria-hidden="true"]') as HTMLElement
|
|
83
|
+
const units = container.querySelectorAll('[data-slot="text-animate-unit"]').length
|
|
84
|
+
const result = { by, units, position: visual.style.backgroundPosition, image: visual.style.backgroundImage }
|
|
85
|
+
unmount()
|
|
86
|
+
return result
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// Splitting finer must change the unit count without touching the glare.
|
|
90
|
+
expect(positions.map((p) => p.units)).toEqual([1, 3, 19])
|
|
91
|
+
expect(new Set(positions.map((p) => p.position)).size).toBe(1)
|
|
92
|
+
expect(new Set(positions.map((p) => p.image)).size).toBe(1)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('drops the shimmer gradient under reduced motion so the text keeps its own color', () => {
|
|
96
|
+
const { container } = render(
|
|
97
|
+
<ReducedMotionProvider disableAnimations>
|
|
98
|
+
<TextAnimate effect="shimmer">Generating response</TextAnimate>
|
|
99
|
+
</ReducedMotionProvider>,
|
|
100
|
+
)
|
|
101
|
+
const visual = container.querySelector('[aria-hidden="true"]') as HTMLElement
|
|
102
|
+
expect(visual.style.backgroundImage).toBe('')
|
|
103
|
+
expect(visual.style.webkitTextFillColor).toBe('')
|
|
104
|
+
expect(visual).toHaveTextContent('Generating response')
|
|
105
|
+
})
|
|
106
|
+
|
|
45
107
|
it('drives the animation from a controlled progress value', () => {
|
|
46
108
|
const { container, rerender } = render(
|
|
47
109
|
<TextAnimate effect="typewriter" progress={0}>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { useReducedMotion } from '../../hooks/use-reduced-motion'
|
|
5
|
-
import { cn } from '../../utils'
|
|
5
|
+
import { cn } from '../../internal/utils'
|
|
6
6
|
|
|
7
7
|
type TextAnimateSegment = 'char' | 'word' | 'line'
|
|
8
8
|
|
|
@@ -26,16 +26,41 @@ type TextAnimateEffect = (
|
|
|
26
26
|
content?: React.ReactNode
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
type TextAnimateContainerEffect = (
|
|
30
|
+
progress: number,
|
|
31
|
+
ctx: { reduced: boolean },
|
|
32
|
+
) => {
|
|
33
|
+
style?: React.CSSProperties
|
|
34
|
+
className?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
interface PresetConfig {
|
|
30
38
|
fn: TextAnimateEffect
|
|
31
39
|
by: TextAnimateSegment
|
|
32
40
|
stagger: number
|
|
33
41
|
continuous: boolean
|
|
42
|
+
/**
|
|
43
|
+
* Styles the wrapper around every unit rather than the units themselves, for effects that span the
|
|
44
|
+
* whole string. Lets `by` stay orthogonal: the units can be split any way and the effect is unchanged.
|
|
45
|
+
*/
|
|
46
|
+
container?: TextAnimateContainerEffect
|
|
34
47
|
}
|
|
35
48
|
|
|
36
49
|
const SCRAMBLE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#%&@$?/<>*'
|
|
37
50
|
const SCRAMBLE_STEPS = 10
|
|
38
51
|
|
|
52
|
+
const SHIMMER_SPREAD = 'var(--text-shimmer-spread, calc(3ch + 40px))'
|
|
53
|
+
const SHIMMER_BASE = 'var(--text-shimmer-base, color-mix(in oklab, currentColor 38%, transparent))'
|
|
54
|
+
const SHIMMER_GLARE = 'var(--text-shimmer-glare, currentColor)'
|
|
55
|
+
const SHIMMER_MID = `color-mix(in oklab, ${SHIMMER_GLARE}, ${SHIMMER_BASE} 50%)`
|
|
56
|
+
const SHIMMER_GRADIENT =
|
|
57
|
+
`linear-gradient(calc(90deg + var(--text-shimmer-angle, 20deg)),` +
|
|
58
|
+
` ${SHIMMER_BASE} calc(50% - ${SHIMMER_SPREAD}),` +
|
|
59
|
+
` ${SHIMMER_MID} calc(50% - ${SHIMMER_SPREAD} * 0.5),` +
|
|
60
|
+
` ${SHIMMER_GLARE} 50%,` +
|
|
61
|
+
` ${SHIMMER_MID} calc(50% + ${SHIMMER_SPREAD} * 0.5),` +
|
|
62
|
+
` ${SHIMMER_BASE} calc(50% + ${SHIMMER_SPREAD}))`
|
|
63
|
+
|
|
39
64
|
const presets: Record<TextAnimateEffectName, PresetConfig> = {
|
|
40
65
|
typewriter: {
|
|
41
66
|
by: 'char',
|
|
@@ -143,15 +168,26 @@ const presets: Record<TextAnimateEffectName, PresetConfig> = {
|
|
|
143
168
|
},
|
|
144
169
|
|
|
145
170
|
shimmer: {
|
|
146
|
-
by: '
|
|
171
|
+
by: 'line',
|
|
147
172
|
stagger: 0,
|
|
148
173
|
continuous: true,
|
|
149
|
-
fn: (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
174
|
+
fn: () => ({}),
|
|
175
|
+
container: (p, { reduced }) => {
|
|
176
|
+
if (reduced) return {}
|
|
177
|
+
return {
|
|
178
|
+
style: {
|
|
179
|
+
display: 'inline-block',
|
|
180
|
+
backgroundImage: SHIMMER_GRADIENT,
|
|
181
|
+
backgroundRepeat: 'no-repeat',
|
|
182
|
+
// Wider than the box by a full band on each side, so both ends of the sweep park the
|
|
183
|
+
// glare off-screen and wrapping the driver from 1 back to 0 is invisible.
|
|
184
|
+
backgroundSize: `calc(200% + ${SHIMMER_SPREAD} * 2) 100%`,
|
|
185
|
+
backgroundPosition: `${((1 - p) * 100).toFixed(3)}% 0`,
|
|
186
|
+
backgroundClip: 'text',
|
|
187
|
+
WebkitBackgroundClip: 'text',
|
|
188
|
+
WebkitTextFillColor: 'transparent',
|
|
189
|
+
},
|
|
190
|
+
}
|
|
155
191
|
},
|
|
156
192
|
},
|
|
157
193
|
}
|
|
@@ -221,14 +257,45 @@ function Unit({ text, index, total, by, stagger, globalProgress, reduced, effect
|
|
|
221
257
|
}
|
|
222
258
|
|
|
223
259
|
interface TextAnimateProps extends Omit<React.ComponentProps<'span'>, 'children'> {
|
|
260
|
+
/** The text to animate. Use `\n` for explicit line breaks. */
|
|
224
261
|
children: string
|
|
262
|
+
/**
|
|
263
|
+
* A preset name (`typewriter`, `scramble`, `rise`, `highlight`, `wave`, `flip`, `shimmer`) or a custom `(progress,
|
|
264
|
+
* ctx) => {…}`.
|
|
265
|
+
* @default 'typewriter'
|
|
266
|
+
*/
|
|
225
267
|
effect?: TextAnimateEffectName | TextAnimateEffect
|
|
268
|
+
/**
|
|
269
|
+
* Segmentation level. Defaults to the preset's natural level (e.g. `word` for `highlight`).
|
|
270
|
+
* @default preset's level
|
|
271
|
+
*/
|
|
226
272
|
by?: TextAnimateSegment
|
|
273
|
+
/** Controlled driver value (`0 → 1`). When set, the internal clock is disabled and you own the timeline. */
|
|
227
274
|
progress?: number
|
|
275
|
+
/**
|
|
276
|
+
* Run the built-in clock when `progress` is not provided.
|
|
277
|
+
* @default true
|
|
278
|
+
*/
|
|
228
279
|
autoPlay?: boolean
|
|
280
|
+
/**
|
|
281
|
+
* Loop the built-in clock. Continuous presets (`wave`, `shimmer`) default to `true`.
|
|
282
|
+
* @default preset's value
|
|
283
|
+
*/
|
|
229
284
|
loop?: boolean
|
|
285
|
+
/**
|
|
286
|
+
* Built-in clock length in **seconds**.
|
|
287
|
+
* @default 1.6
|
|
288
|
+
*/
|
|
230
289
|
duration?: number
|
|
290
|
+
/**
|
|
291
|
+
* Built-in clock start delay in **seconds**.
|
|
292
|
+
* @default 0
|
|
293
|
+
*/
|
|
231
294
|
delay?: number
|
|
295
|
+
/**
|
|
296
|
+
* How offset each unit's window is from its neighbor's, `0 → 1`. `0` = all together; `1` = fully sequential.
|
|
297
|
+
* @default preset's value
|
|
298
|
+
*/
|
|
232
299
|
stagger?: number
|
|
233
300
|
}
|
|
234
301
|
|
|
@@ -301,11 +368,12 @@ function TextAnimate({
|
|
|
301
368
|
|
|
302
369
|
const unitProps = { total, by: segment, stagger: resolvedStagger, globalProgress, reduced, effect: effectFn }
|
|
303
370
|
const multiline = lines.length > 1
|
|
371
|
+
const container = preset?.container?.(globalProgress, { reduced })
|
|
304
372
|
|
|
305
373
|
return (
|
|
306
374
|
<span ref={containerRef} data-slot="text-animate" className={cn('inline-block', className)} {...props}>
|
|
307
375
|
<span className="sr-only">{text}</span>
|
|
308
|
-
<span aria-hidden="true" suppressHydrationWarning>
|
|
376
|
+
<span aria-hidden="true" suppressHydrationWarning className={container?.className} style={container?.style}>
|
|
309
377
|
{lines.map((line, li) => {
|
|
310
378
|
const lineStyle = multiline ? ({ display: 'block' } as const) : undefined
|
|
311
379
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { Field as BaseField } from '@base-ui/react/field'
|
|
5
5
|
import { type VariantProps } from 'class-variance-authority'
|
|
6
|
-
import { cn, useComposedRefs } from '../../utils'
|
|
6
|
+
import { cn, useComposedRefs } from '../../internal/utils'
|
|
7
7
|
import { inputVariants } from '../input/input-variants'
|
|
8
8
|
|
|
9
9
|
type BaseControlProps = React.ComponentProps<typeof BaseField.Control>
|
|
@@ -12,11 +12,26 @@ type TextareaVariant = NonNullable<VariantProps<typeof inputVariants>['variant']
|
|
|
12
12
|
type TextareaSize = NonNullable<VariantProps<typeof inputVariants>['size']>
|
|
13
13
|
|
|
14
14
|
interface TextareaProps extends Omit<React.ComponentProps<'textarea'>, 'size'> {
|
|
15
|
+
/**
|
|
16
|
+
* Field appearance - bordered or filled.
|
|
17
|
+
* @default 'outline'
|
|
18
|
+
*/
|
|
15
19
|
variant?: TextareaVariant
|
|
20
|
+
/**
|
|
21
|
+
* Scales padding and text. Named `inputSize` to avoid colliding with native attributes.
|
|
22
|
+
* @default 'md'
|
|
23
|
+
*/
|
|
16
24
|
inputSize?: TextareaSize
|
|
25
|
+
/**
|
|
26
|
+
* Show a clear (✕) button once the field has a value.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
17
29
|
clearable?: boolean
|
|
30
|
+
/** Adornment rendered before the field, aligned to the first line. */
|
|
18
31
|
startSlot?: React.ReactNode
|
|
32
|
+
/** Adornment rendered after the field, aligned to the first line. */
|
|
19
33
|
endSlot?: React.ReactNode
|
|
34
|
+
/** Called when the clear button is pressed. */
|
|
20
35
|
onClear?: () => void
|
|
21
36
|
}
|
|
22
37
|
|
|
@@ -4,7 +4,7 @@ import { axe } from 'vitest-axe'
|
|
|
4
4
|
import { Thumbnail } from './thumbnail'
|
|
5
5
|
|
|
6
6
|
// jsdom does not actually load images. Base UI Avatar uses a pre-loader that
|
|
7
|
-
// listens for `load`/`error` on a probe Image
|
|
7
|
+
// listens for `load`/`error` on a probe Image - without this stub the probe
|
|
8
8
|
// never resolves and the underlying <img> never mounts.
|
|
9
9
|
const ORIGINAL_SRC_DESCRIPTOR = Object.getOwnPropertyDescriptor(window.Image.prototype, 'src')
|
|
10
10
|
beforeAll(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { Avatar as BaseAvatar } from '@base-ui/react/avatar'
|
|
3
3
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
-
import { cn } from '../../utils'
|
|
4
|
+
import { cn } from '../../internal/utils'
|
|
5
5
|
|
|
6
6
|
const thumbnailVariants = cva(
|
|
7
7
|
"relative inline-flex size-[1em] shrink-0 items-center justify-center overflow-hidden [&_svg:not([class*='size-'])]:size-[0.5em]",
|
|
@@ -43,13 +43,33 @@ type ThumbnailVariant = NonNullable<VariantProps<typeof thumbnailVariants>['vari
|
|
|
43
43
|
type BaseImageProps = React.ComponentProps<typeof BaseAvatar.Image>
|
|
44
44
|
|
|
45
45
|
interface ThumbnailProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'size' | 'children'> {
|
|
46
|
+
/**
|
|
47
|
+
* Image tile, or a colored icon tile.
|
|
48
|
+
* @default 'image'
|
|
49
|
+
*/
|
|
46
50
|
variant?: ThumbnailVariant
|
|
51
|
+
/**
|
|
52
|
+
* Rounded square or full circle.
|
|
53
|
+
* @default 'rounded'
|
|
54
|
+
*/
|
|
47
55
|
shape?: ThumbnailShape
|
|
56
|
+
/**
|
|
57
|
+
* A preset scale, or a pixel number for an exact size.
|
|
58
|
+
* @default 'md'
|
|
59
|
+
*/
|
|
48
60
|
size?: ThumbnailPresetSize | number
|
|
61
|
+
/** Image URL (image variant). Lifted from `render` when omitted. */
|
|
49
62
|
src?: string
|
|
63
|
+
/**
|
|
64
|
+
* Alternative text describing the image. Defaults to `""` (decorative) when omitted.
|
|
65
|
+
* @default ''
|
|
66
|
+
*/
|
|
50
67
|
alt?: string
|
|
68
|
+
/** Swap the `<img>` for another element - e.g. a Next.js `<Image>`. */
|
|
51
69
|
render?: BaseImageProps['render']
|
|
70
|
+
/** Fires as the image moves through its loading lifecycle. */
|
|
52
71
|
onLoadingStatusChange?: BaseImageProps['onLoadingStatusChange']
|
|
72
|
+
/** The icon to frame (icon variants). */
|
|
53
73
|
children?: React.ReactNode
|
|
54
74
|
}
|
|
55
75
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { type VariantProps } from 'class-variance-authority'
|
|
5
5
|
import { useFieldRootContext } from '@base-ui/react/internals/field-root-context'
|
|
6
|
-
import { cn } from '../../utils'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
7
|
import { inputVariants } from '../input/input-variants'
|
|
8
8
|
|
|
9
9
|
type TimeFieldVariant = NonNullable<VariantProps<typeof inputVariants>['variant']>
|
|
@@ -25,19 +25,54 @@ interface LiteralNode {
|
|
|
25
25
|
type FormatNode = SegmentNode | LiteralNode
|
|
26
26
|
|
|
27
27
|
interface TimeFieldProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'defaultValue' | 'onChange'> {
|
|
28
|
+
/** Controlled value, a 24-hour `"HH:mm[:ss]"` string. Pair with `onValueChange`. */
|
|
28
29
|
value?: string | null
|
|
30
|
+
/** Uncontrolled initial value. */
|
|
29
31
|
defaultValue?: string | null
|
|
32
|
+
/** Fires with the time string when complete, or `null` when cleared. */
|
|
30
33
|
onValueChange?: (time: string | null) => void
|
|
34
|
+
/**
|
|
35
|
+
* date-fns token string - `H`/`HH`, `h`/`hh`, `m`/`mm`, `s`/`ss`, `a`.
|
|
36
|
+
* @default 'HH:mm'
|
|
37
|
+
*/
|
|
31
38
|
format?: string
|
|
39
|
+
/**
|
|
40
|
+
* Field appearance - bordered or filled.
|
|
41
|
+
* @default 'outline'
|
|
42
|
+
*/
|
|
32
43
|
variant?: TimeFieldVariant
|
|
44
|
+
/**
|
|
45
|
+
* Height, padding, and text scale.
|
|
46
|
+
* @default 'md'
|
|
47
|
+
*/
|
|
33
48
|
size?: TimeFieldSize
|
|
49
|
+
/** Content pinned to the start edge. */
|
|
34
50
|
startSlot?: React.ReactNode
|
|
51
|
+
/** Content pinned to the end edge. */
|
|
35
52
|
endSlot?: React.ReactNode
|
|
53
|
+
/**
|
|
54
|
+
* Blocks interaction and removes the segments from the tab order.
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
36
57
|
disabled?: boolean
|
|
58
|
+
/**
|
|
59
|
+
* Segments stay focusable and readable but can't be edited.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
37
62
|
readOnly?: boolean
|
|
63
|
+
/**
|
|
64
|
+
* Marks the hidden form input as required (needs `name`).
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
38
67
|
required?: boolean
|
|
68
|
+
/** Renders a hidden `<input>` with the time value for form submission. */
|
|
39
69
|
name?: string
|
|
70
|
+
/**
|
|
71
|
+
* Drop the input appearance - for composing inside another field (used by `DatePicker`).
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
40
74
|
unstyled?: boolean
|
|
75
|
+
/** Ref to the underlying element. */
|
|
41
76
|
ref?: React.Ref<HTMLDivElement>
|
|
42
77
|
}
|
|
43
78
|
|
|
@@ -42,7 +42,7 @@ function renderToasterSandbox({
|
|
|
42
42
|
position?: ToastPosition
|
|
43
43
|
progress?: boolean
|
|
44
44
|
}) {
|
|
45
|
-
// Spread props only when defined
|
|
45
|
+
// Spread props only when defined - passing an explicit `undefined`
|
|
46
46
|
// violates exactOptionalPropertyTypes (enabled in the root tsconfig).
|
|
47
47
|
const toasterProps = {
|
|
48
48
|
...(position !== undefined ? { position } : {}),
|