@appica/ui-react 1.0.0 → 1.1.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 +46 -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 +1 -1
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/alert/alert.d.ts +29 -1
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/alert.js +1 -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 +9 -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 +2 -2
- package/dist/components/autocomplete/autocomplete.js.map +1 -1
- package/dist/components/avatar/avatar.d.ts +16 -0
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/background-pattern/background-pattern-interactive.js +1 -1
- package/dist/components/background-pattern/background-pattern-interactive.js.map +1 -1
- package/dist/components/background-pattern/background-pattern-shared.js +1 -1
- 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 +1 -1
- package/dist/components/background-pattern/background-pattern.js.map +1 -1
- package/dist/components/badge/badge.d.ts +11 -1
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +1 -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 +67 -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 +1 -1
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/button/button-variants.js +1 -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 +1 -1
- package/dist/components/button/button.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 +1 -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 +1 -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 +103 -0
- package/dist/components/card/card.js.map +1 -0
- package/dist/components/carousel/carousel.d.ts +105 -5
- package/dist/components/carousel/carousel.d.ts.map +1 -1
- package/dist/components/carousel/carousel.js +157 -5
- package/dist/components/carousel/carousel.js.map +1 -1
- package/dist/components/checkbox/checkbox.js +1 -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 +1 -1
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/components/chip/chip.d.ts +32 -0
- package/dist/components/chip/chip.d.ts.map +1 -1
- package/dist/components/chip/chip.js +1 -1
- package/dist/components/chip/chip.js.map +1 -1
- package/dist/components/collapsible/collapsible.js +1 -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 +245 -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 +327 -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 +216 -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 +66 -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 +202 -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 +2 -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 +5 -5
- package/dist/components/context-menu/context-menu.js.map +1 -1
- package/dist/components/copy-button/copy-button.d.ts +15 -0
- package/dist/components/copy-button/copy-button.d.ts.map +1 -1
- package/dist/components/copy-button/copy-button.js +1 -1
- 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 +1 -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 +1 -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 +1 -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 +8 -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 +13 -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 +5 -5
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/field/field.js +1 -1
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/fieldset/fieldset.js +1 -1
- package/dist/components/fieldset/fieldset.js.map +1 -1
- package/dist/components/gradient-glow/gradient-glow.d.ts +45 -0
- package/dist/components/gradient-glow/gradient-glow.d.ts.map +1 -1
- package/dist/components/gradient-glow/gradient-glow.js +1 -1
- package/dist/components/gradient-glow/gradient-glow.js.map +1 -1
- package/dist/components/input/input-variants.js +1 -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 +3 -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 +1 -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 +1 -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 +1 -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 +1 -1
- package/dist/components/meter/meter.js.map +1 -1
- package/dist/components/navigation/navigation-link-variants.d.ts +1 -1
- package/dist/components/navigation/navigation-link-variants.js +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +2 -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 +2 -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 +1 -1
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/radio/radio.js +1 -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 +1 -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 +301 -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 +1 -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 +2 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -1
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/switch/switch.d.ts +4 -0
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/switch/switch.js +1 -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 +1 -1
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.d.ts +31 -1
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +1 -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 +26 -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 +1 -1
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/components/thumbnail/thumbnail.d.ts +20 -0
- package/dist/components/thumbnail/thumbnail.d.ts.map +1 -1
- package/dist/components/thumbnail/thumbnail.js +1 -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 +1 -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 +1 -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 +1 -1
- package/dist/components/toc/toc.js.map +1 -1
- package/dist/components/toggle-group/toggle-group.js +1 -1
- package/dist/components/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/toolbar/toolbar.js +1 -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 +2 -2
- package/dist/components/tooltip/tooltip.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.map +1 -1
- package/dist/hooks/use-local-storage.js.map +1 -1
- package/dist/hooks/use-reduced-motion.d.ts +1 -1
- 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.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -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 +78 -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 +34 -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 +41 -0
- package/dist/internal/color-picker-context.js.map +1 -0
- package/dist/{floating.d.ts → internal/floating.d.ts} +1 -1
- package/dist/internal/floating.d.ts.map +1 -0
- package/dist/internal/floating.js.map +1 -0
- package/dist/{modal.d.ts → internal/modal.d.ts} +1 -1
- package/dist/internal/modal.d.ts.map +1 -0
- package/dist/internal/modal.js.map +1 -0
- package/dist/internal/utils.d.ts.map +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 +328 -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.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.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.map +1 -1
- package/dist/providers/theme-provider/theme-script.js.map +1 -1
- package/package.json +75 -17
- 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 +1 -1
- package/src/components/background-pattern/background-pattern-shared.tsx +1 -1
- package/src/components/background-pattern/background-pattern.test.tsx +1 -1
- package/src/components/background-pattern/background-pattern.tsx +14 -6
- 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 +155 -0
- package/src/components/carousel/carousel.tsx +305 -5
- 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.tsx +11 -5
- package/src/components/copy-button/copy-button.test.tsx +1 -1
- package/src/components/copy-button/copy-button.tsx +16 -1
- 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.tsx +11 -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 +1 -1
- package/src/components/gradient-glow/gradient-glow.tsx +46 -1
- 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/dist/{floating.js → internal/floating.js} +0 -0
- /package/dist/{modal.js → internal/modal.js} +0 -0
- /package/dist/{utils.d.ts → internal/utils.d.ts} +0 -0
- /package/dist/{utils.js → internal/utils.js} +0 -0
- /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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { Accordion as BaseAccordion } from '@base-ui/react/accordion'
|
|
5
5
|
import { cva } from 'class-variance-authority'
|
|
6
|
-
import { cn } from '../../utils'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
7
|
|
|
8
8
|
type AccordionVariant = 'default' | 'alt' | 'flush'
|
|
9
9
|
type AccordionIcon = 'chevron' | 'plus' | false
|
|
@@ -93,9 +93,25 @@ const iconBoxVariants = cva(
|
|
|
93
93
|
)
|
|
94
94
|
|
|
95
95
|
interface AccordionProps extends React.ComponentProps<typeof BaseAccordion.Root> {
|
|
96
|
+
/**
|
|
97
|
+
* Surface style applied to every item.
|
|
98
|
+
* @default 'default'
|
|
99
|
+
*/
|
|
96
100
|
variant?: AccordionVariant
|
|
101
|
+
/**
|
|
102
|
+
* The open/close indicator, or `false` to hide it.
|
|
103
|
+
* @default 'chevron'
|
|
104
|
+
*/
|
|
97
105
|
icon?: AccordionIcon
|
|
106
|
+
/**
|
|
107
|
+
* Plain glyph, or wrapped in a tinted tile.
|
|
108
|
+
* @default 'icon'
|
|
109
|
+
*/
|
|
98
110
|
iconVariant?: AccordionIconVariant
|
|
111
|
+
/**
|
|
112
|
+
* Place the icon after or before the trigger label.
|
|
113
|
+
* @default 'end'
|
|
114
|
+
*/
|
|
99
115
|
iconPosition?: AccordionIconPosition
|
|
100
116
|
}
|
|
101
117
|
|
|
@@ -124,7 +140,12 @@ function Accordion({
|
|
|
124
140
|
}
|
|
125
141
|
|
|
126
142
|
interface AccordionItemProps extends Omit<React.ComponentProps<typeof BaseAccordion.Item>, 'disabled'> {
|
|
143
|
+
/** Override the root's `variant` for this item. */
|
|
127
144
|
variant?: AccordionVariant
|
|
145
|
+
/**
|
|
146
|
+
* Lock this item shut and skip it during keyboard navigation.
|
|
147
|
+
* @default false
|
|
148
|
+
*/
|
|
128
149
|
disabled?: boolean | undefined
|
|
129
150
|
}
|
|
130
151
|
|
|
@@ -145,8 +166,11 @@ function AccordionItem({ className, variant, ...props }: AccordionItemProps) {
|
|
|
145
166
|
}
|
|
146
167
|
|
|
147
168
|
interface AccordionTriggerProps extends React.ComponentProps<typeof BaseAccordion.Trigger> {
|
|
169
|
+
/** Override the root's icon for this trigger. */
|
|
148
170
|
icon?: AccordionIcon
|
|
171
|
+
/** Override the root's icon style. */
|
|
149
172
|
iconVariant?: AccordionIconVariant
|
|
173
|
+
/** Override the root's icon position. */
|
|
150
174
|
iconPosition?: AccordionIconPosition
|
|
151
175
|
}
|
|
152
176
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
5
|
import { AnimatePresence, LazyMotion, domAnimation, m } from 'motion/react'
|
|
6
|
-
import { cn } from '../../utils'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
7
|
import { useReducedMotion } from '../../hooks/use-reduced-motion'
|
|
8
8
|
import { useDismissible } from '../../hooks/use-dismissible'
|
|
9
9
|
|
|
@@ -62,13 +62,37 @@ const transition = {
|
|
|
62
62
|
|
|
63
63
|
type AlertLayout = 'block' | 'inline'
|
|
64
64
|
|
|
65
|
-
interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {
|
|
65
|
+
interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, Omit<VariantProps<typeof alertVariants>, 'variant'> {
|
|
66
|
+
/**
|
|
67
|
+
* Color scheme; also drives the `AlertIcon` accent.
|
|
68
|
+
* @default 'default'
|
|
69
|
+
*/
|
|
70
|
+
variant?: VariantProps<typeof alertVariants>['variant']
|
|
71
|
+
/**
|
|
72
|
+
* Stack the parts (`block`) or flow them on one row when wide enough (`inline`).
|
|
73
|
+
* @default 'block'
|
|
74
|
+
*/
|
|
66
75
|
layout?: AlertLayout
|
|
76
|
+
/**
|
|
77
|
+
* Render a close button that hides the alert (with an exit animation).
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
67
80
|
dismissible?: boolean
|
|
81
|
+
/** Controlled visibility. Pair with `onOpenChange`. */
|
|
68
82
|
open?: boolean
|
|
83
|
+
/** Called when the alert is dismissed (with `false`). */
|
|
69
84
|
onOpenChange?: (open: boolean) => void
|
|
85
|
+
/** Remember the dismissal under this key so the alert stays hidden on return (uncontrolled). */
|
|
70
86
|
persistKey?: string
|
|
87
|
+
/**
|
|
88
|
+
* Which Web Storage backs `persistKey`.
|
|
89
|
+
* @default 'local'
|
|
90
|
+
*/
|
|
71
91
|
persistStorage?: 'local' | 'session'
|
|
92
|
+
/**
|
|
93
|
+
* Accessible label for the close button.
|
|
94
|
+
* @default 'Dismiss'
|
|
95
|
+
*/
|
|
72
96
|
closeLabel?: string
|
|
73
97
|
}
|
|
74
98
|
|
|
@@ -190,6 +214,10 @@ function AlertIcon({ className, ...props }: AlertIconProps) {
|
|
|
190
214
|
}
|
|
191
215
|
|
|
192
216
|
interface AlertTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
217
|
+
/**
|
|
218
|
+
* Heading level, so the alert fits the page's heading outline.
|
|
219
|
+
* @default 'h5'
|
|
220
|
+
*/
|
|
193
221
|
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div'
|
|
194
222
|
}
|
|
195
223
|
|
|
@@ -19,17 +19,23 @@ function renderAlertDialog({
|
|
|
19
19
|
title = 'Delete project',
|
|
20
20
|
description = 'This action cannot be undone.',
|
|
21
21
|
backdrop,
|
|
22
|
+
frame,
|
|
22
23
|
contentClassName,
|
|
23
24
|
}: {
|
|
24
25
|
title?: string
|
|
25
26
|
description?: string
|
|
26
27
|
backdrop?: boolean
|
|
28
|
+
frame?: boolean
|
|
27
29
|
contentClassName?: string
|
|
28
30
|
} = {}) {
|
|
29
31
|
return render(
|
|
30
32
|
<AlertDialog>
|
|
31
33
|
<AlertDialogTrigger render={<Button variant="destructive">Delete</Button>} />
|
|
32
|
-
<AlertDialogContent
|
|
34
|
+
<AlertDialogContent
|
|
35
|
+
className={contentClassName}
|
|
36
|
+
{...(backdrop !== undefined ? { backdrop } : {})}
|
|
37
|
+
{...(frame !== undefined ? { frame } : {})}
|
|
38
|
+
>
|
|
33
39
|
<AlertDialogHeader>
|
|
34
40
|
<AlertDialogTitle>{title}</AlertDialogTitle>
|
|
35
41
|
<AlertDialogDescription>{description}</AlertDialogDescription>
|
|
@@ -55,7 +61,7 @@ describe('AlertDialog', () => {
|
|
|
55
61
|
expect(screen.queryByText('Everything in this project will be removed.')).toBeNull()
|
|
56
62
|
})
|
|
57
63
|
|
|
58
|
-
it('opens on trigger click and exposes a
|
|
64
|
+
it('opens on trigger click and exposes a labeled alertdialog', async () => {
|
|
59
65
|
const user = userEvent.setup()
|
|
60
66
|
renderAlertDialog()
|
|
61
67
|
|
|
@@ -103,6 +109,32 @@ describe('AlertDialog', () => {
|
|
|
103
109
|
expect(document.querySelector('[data-slot="alert-dialog-backdrop"]')).toBeNull()
|
|
104
110
|
})
|
|
105
111
|
|
|
112
|
+
it('frames the popup by default and drops the frame when frame is false', async () => {
|
|
113
|
+
const user = userEvent.setup()
|
|
114
|
+
const { unmount } = renderAlertDialog()
|
|
115
|
+
|
|
116
|
+
await user.click(screen.getByRole('button', { name: 'Delete' }))
|
|
117
|
+
await screen.findByRole('alertdialog')
|
|
118
|
+
expect(document.querySelector('[data-slot="alert-dialog-popup"]')).toHaveAttribute('data-frame')
|
|
119
|
+
|
|
120
|
+
unmount()
|
|
121
|
+
renderAlertDialog({ frame: false })
|
|
122
|
+
|
|
123
|
+
await user.click(screen.getByRole('button', { name: 'Delete' }))
|
|
124
|
+
await screen.findByRole('alertdialog')
|
|
125
|
+
expect(document.querySelector('[data-slot="alert-dialog-popup"]')).not.toHaveAttribute('data-frame')
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('drops the frame when the backdrop is off, even if frame is set', async () => {
|
|
129
|
+
const user = userEvent.setup()
|
|
130
|
+
renderAlertDialog({ backdrop: false, frame: true })
|
|
131
|
+
|
|
132
|
+
await user.click(screen.getByRole('button', { name: 'Delete' }))
|
|
133
|
+
await screen.findByRole('alertdialog')
|
|
134
|
+
|
|
135
|
+
expect(document.querySelector('[data-slot="alert-dialog-popup"]')).not.toHaveAttribute('data-frame')
|
|
136
|
+
})
|
|
137
|
+
|
|
106
138
|
it('does not close on an outside click (requires an explicit choice)', async () => {
|
|
107
139
|
const user = userEvent.setup()
|
|
108
140
|
renderAlertDialog()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog'
|
|
3
|
-
import { cn } from '../../utils'
|
|
4
|
-
import { type ModalContentProps, splitModalProps } from '../../modal'
|
|
3
|
+
import { cn } from '../../internal/utils'
|
|
4
|
+
import { type ModalContentProps, splitModalProps } from '../../internal/modal'
|
|
5
5
|
|
|
6
6
|
type AlertDialogProps = React.ComponentProps<typeof BaseAlertDialog.Root>
|
|
7
7
|
|
|
@@ -24,19 +24,33 @@ type AlertDialogContentProps = ModalContentProps<
|
|
|
24
24
|
React.ComponentProps<typeof BaseAlertDialog.Backdrop>,
|
|
25
25
|
React.ComponentProps<typeof BaseAlertDialog.Viewport>
|
|
26
26
|
> & {
|
|
27
|
+
/**
|
|
28
|
+
* Render the dimmed, blurred backdrop behind the popup.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
27
31
|
backdrop?: boolean
|
|
32
|
+
/**
|
|
33
|
+
* Wrap the popup in a translucent glass frame. Needs `backdrop`: without one the popup
|
|
34
|
+
* is always a plain solid card.
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
frame?: boolean
|
|
28
38
|
}
|
|
29
39
|
|
|
30
40
|
function AlertDialogContent({
|
|
31
41
|
className,
|
|
32
42
|
children,
|
|
33
43
|
backdrop = true,
|
|
44
|
+
frame = true,
|
|
34
45
|
backdropProps,
|
|
35
46
|
viewportProps,
|
|
36
47
|
...props
|
|
37
48
|
}: AlertDialogContentProps) {
|
|
38
49
|
const { portal, popup } = splitModalProps(props)
|
|
39
50
|
const forceBackdrop = backdropProps?.forceRender === true
|
|
51
|
+
// The frame is a rim of blurred page around the popup, so it only reads against the
|
|
52
|
+
// backdrop. Without one it collapses to a plain solid card.
|
|
53
|
+
const showFrame = frame && backdrop
|
|
40
54
|
return (
|
|
41
55
|
<BaseAlertDialog.Portal {...portal}>
|
|
42
56
|
{backdrop && (
|
|
@@ -61,16 +75,18 @@ function AlertDialogContent({
|
|
|
61
75
|
>
|
|
62
76
|
<BaseAlertDialog.Popup
|
|
63
77
|
data-slot="alert-dialog-popup"
|
|
78
|
+
{...(showFrame ? { 'data-frame': '' } : {})}
|
|
64
79
|
className={cn(
|
|
65
80
|
'group/alert-dialog-popup relative flex max-h-full min-h-0 w-100 max-w-full flex-col',
|
|
66
81
|
'rounded-2xl border',
|
|
67
|
-
|
|
82
|
+
showFrame
|
|
68
83
|
? cn(
|
|
69
84
|
'border-white/15 bg-white/10 p-1.5 backdrop-blur-sm',
|
|
70
85
|
!forceBackdrop &&
|
|
71
86
|
'data-nested:border-border-overlay data-nested:bg-background data-nested:p-0 data-nested:shadow-2xl data-nested:backdrop-blur-none',
|
|
72
87
|
)
|
|
73
|
-
: 'bg-background border-border-overlay
|
|
88
|
+
: 'bg-background border-border-overlay',
|
|
89
|
+
!showFrame && 'shadow-2xl',
|
|
74
90
|
'isolate transform-gpu outline-none',
|
|
75
91
|
'motion-safe:transition-[opacity,scale] motion-safe:duration-250 motion-safe:ease-[cubic-bezier(0.175,0.885,0.32,1.5)]',
|
|
76
92
|
'data-starting-style:motion-safe:scale-95 data-starting-style:motion-safe:opacity-0',
|
|
@@ -83,7 +99,7 @@ function AlertDialogContent({
|
|
|
83
99
|
data-slot="alert-dialog-content"
|
|
84
100
|
className={cn(
|
|
85
101
|
'flex min-h-0 flex-col overflow-hidden not-has-[>[data-slot=alert-dialog-footer]]:pb-6 not-has-[>[data-slot=alert-dialog-header]]:pt-6 [&>[data-slot=alert-dialog-header]+[data-slot=alert-dialog-footer]]:pt-0',
|
|
86
|
-
|
|
102
|
+
showFrame &&
|
|
87
103
|
cn(
|
|
88
104
|
'bg-background rounded-[calc(var(--radius-2xl)*5/6)]',
|
|
89
105
|
!forceBackdrop &&
|
|
@@ -305,7 +305,7 @@ describe('Autocomplete', () => {
|
|
|
305
305
|
)
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
it('forwards grid to Base UI Root
|
|
308
|
+
it('forwards grid to Base UI Root - popup uses the grid role', async () => {
|
|
309
309
|
const user = setupUser()
|
|
310
310
|
renderGrid()
|
|
311
311
|
await user.click(screen.getByRole('button', { name: 'Toggle popup' }))
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { Autocomplete as BaseAutocomplete } from '@base-ui/react/autocomplete'
|
|
5
|
-
import { cn } from '../../utils'
|
|
6
|
-
import { type FloatingContentProps, splitFloatingProps } from '../../floating'
|
|
5
|
+
import { cn } from '../../internal/utils'
|
|
6
|
+
import { type FloatingContentProps, splitFloatingProps } from '../../internal/floating'
|
|
7
7
|
import { inputVariants } from '../input/input-variants'
|
|
8
8
|
|
|
9
9
|
type AutocompleteSize = 'sm' | 'md' | 'lg'
|
|
@@ -30,9 +30,25 @@ function useAutocompleteContext() {
|
|
|
30
30
|
type BaseAutocompleteRootProps = React.ComponentProps<typeof BaseAutocomplete.Root>
|
|
31
31
|
|
|
32
32
|
interface AutocompleteProps extends BaseAutocompleteRootProps {
|
|
33
|
+
/**
|
|
34
|
+
* Input height, popup radius, and item sizing.
|
|
35
|
+
* @default 'md'
|
|
36
|
+
*/
|
|
33
37
|
size?: AutocompleteSize
|
|
38
|
+
/**
|
|
39
|
+
* Input appearance - bordered or filled.
|
|
40
|
+
* @default 'outline'
|
|
41
|
+
*/
|
|
34
42
|
variant?: AutocompleteVariant
|
|
43
|
+
/**
|
|
44
|
+
* Render a clear button inside the input when a value is present.
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
35
47
|
clearable?: boolean
|
|
48
|
+
/**
|
|
49
|
+
* Render a chevron button that toggles the popup.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
36
52
|
icon?: boolean
|
|
37
53
|
}
|
|
38
54
|
|
|
@@ -65,7 +81,9 @@ const ICON_SIZE: Record<AutocompleteSize, string> = {
|
|
|
65
81
|
}
|
|
66
82
|
|
|
67
83
|
interface AutocompleteInputProps extends Omit<React.ComponentProps<typeof BaseAutocomplete.Input>, 'size'> {
|
|
84
|
+
/** Adornment rendered before the field, inside the input frame. */
|
|
68
85
|
startSlot?: React.ReactNode
|
|
86
|
+
/** Adornment rendered after the field, inside the input frame. */
|
|
69
87
|
endSlot?: React.ReactNode
|
|
70
88
|
}
|
|
71
89
|
|
|
@@ -202,7 +220,9 @@ function AutocompleteContent({ className, children, ...props }: AutocompleteCont
|
|
|
202
220
|
}
|
|
203
221
|
|
|
204
222
|
interface AutocompleteListProps<T = any> extends Omit<React.ComponentProps<typeof BaseAutocomplete.List>, 'children'> {
|
|
223
|
+
/** Items per row in grid mode (defaults to 2 when `grid` is set). */
|
|
205
224
|
cols?: number
|
|
225
|
+
/** A render function over the filtered items, or static `AutocompleteItem`s. */
|
|
206
226
|
children?: React.ReactNode | ((item: T, index: number) => React.ReactNode)
|
|
207
227
|
}
|
|
208
228
|
|
|
@@ -4,7 +4,7 @@ import { axe } from 'vitest-axe'
|
|
|
4
4
|
import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarImage } from './avatar'
|
|
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 Image
|
|
8
8
|
// never transitions out of "loading", and Avatar.Image is never mounted.
|
|
9
9
|
const ORIGINAL_SRC_DESCRIPTOR = Object.getOwnPropertyDescriptor(window.Image.prototype, 'src')
|
|
10
10
|
beforeAll(() => {
|
|
@@ -139,7 +139,7 @@ describe('Avatar', () => {
|
|
|
139
139
|
})
|
|
140
140
|
|
|
141
141
|
it('lifts src from the render element so Base UI mounts without redeclaring it', async () => {
|
|
142
|
-
// No `src` on AvatarImage
|
|
142
|
+
// No `src` on AvatarImage - only on the render element. The wrapper should
|
|
143
143
|
// lift it across so Base UI's pre-loader fires and the cloned element mounts.
|
|
144
144
|
render(
|
|
145
145
|
<Avatar>
|
|
@@ -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 avatarVariants = cva(
|
|
7
7
|
"relative flex size-[1em] shrink-0 items-center justify-center bg-background-strong text-center font-medium text-foreground-emphasis [&_svg:not([class*='size-'])]:size-[0.5em]",
|
|
@@ -28,7 +28,15 @@ type AvatarPresetSize = NonNullable<VariantProps<typeof avatarVariants>['size']>
|
|
|
28
28
|
type AvatarShape = NonNullable<VariantProps<typeof avatarVariants>['shape']>
|
|
29
29
|
|
|
30
30
|
interface AvatarProps extends Omit<React.ComponentProps<typeof BaseAvatar.Root>, 'size'> {
|
|
31
|
+
/**
|
|
32
|
+
* Full circle or rounded square.
|
|
33
|
+
* @default 'circle'
|
|
34
|
+
*/
|
|
31
35
|
shape?: AvatarShape
|
|
36
|
+
/**
|
|
37
|
+
* A preset scale, or a pixel number for an exact size.
|
|
38
|
+
* @default 'md'
|
|
39
|
+
*/
|
|
32
40
|
size?: AvatarPresetSize | number
|
|
33
41
|
}
|
|
34
42
|
|
|
@@ -85,6 +93,10 @@ function AvatarFallback({ className, ...props }: AvatarFallbackProps) {
|
|
|
85
93
|
}
|
|
86
94
|
|
|
87
95
|
interface AvatarBadgeProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
96
|
+
/**
|
|
97
|
+
* Add a pulsing ping behind the dot (skipped under reduced motion).
|
|
98
|
+
* @default false
|
|
99
|
+
*/
|
|
88
100
|
animate?: boolean
|
|
89
101
|
}
|
|
90
102
|
|
|
@@ -107,6 +119,10 @@ function AvatarBadge({ animate = false, className, ...props }: AvatarBadgeProps)
|
|
|
107
119
|
}
|
|
108
120
|
|
|
109
121
|
interface AvatarGroupProps extends React.ComponentPropsWithoutRef<'div'>, Pick<AvatarProps, 'size' | 'shape'> {
|
|
122
|
+
/**
|
|
123
|
+
* Stack the avatars in a row or a column.
|
|
124
|
+
* @default 'horizontal'
|
|
125
|
+
*/
|
|
110
126
|
orientation?: 'horizontal' | 'vertical'
|
|
111
127
|
}
|
|
112
128
|
|
|
@@ -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 { useReducedMotion } from '../../hooks/use-reduced-motion'
|
|
6
6
|
import { PatternLayer, patternSpotlight, type BackgroundPatternVariant } from './background-pattern-shared'
|
|
7
7
|
|
|
@@ -4,7 +4,7 @@ import { axe } from 'vitest-axe'
|
|
|
4
4
|
import { BackgroundPattern } from './background-pattern'
|
|
5
5
|
|
|
6
6
|
describe('BackgroundPattern', () => {
|
|
7
|
-
it('renders its children inside a
|
|
7
|
+
it('renders its children inside a labeled wrapper', () => {
|
|
8
8
|
render(
|
|
9
9
|
<BackgroundPattern>
|
|
10
10
|
<span>Content</span>
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import { cn } from '../../utils'
|
|
2
|
+
import { cn } from '../../internal/utils'
|
|
3
3
|
import { PatternLayer, patternCell, patternTint, type BackgroundPatternVariant } from './background-pattern-shared'
|
|
4
4
|
import { BackgroundPatternInteractive } from './background-pattern-interactive'
|
|
5
5
|
|
|
6
6
|
type SpotlightConfig = { size?: number | string; persistent?: boolean }
|
|
7
7
|
|
|
8
8
|
interface BackgroundPatternProps extends React.ComponentProps<'div'> {
|
|
9
|
+
/**
|
|
10
|
+
* Pattern texture painted behind the content.
|
|
11
|
+
* @default 'dots'
|
|
12
|
+
*/
|
|
9
13
|
variant?: BackgroundPatternVariant
|
|
14
|
+
/**
|
|
15
|
+
* Cursor-following highlight. `true` for a 200px fading highlight; a number/length sizes it; an object with
|
|
16
|
+
* `persistent: true` keeps it always on.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
10
19
|
spotlight?: boolean | number | string | SpotlightConfig
|
|
20
|
+
/** Cell size in px; overrides the per-variant default (dots 14, grid/dashed-grid 28, hexagons 40). */
|
|
11
21
|
cellSize?: number
|
|
12
22
|
/**
|
|
13
|
-
* Where the spotlight reads pointer movement
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* - `'window'`: tracks pointer movement anywhere — for a pattern positioned
|
|
17
|
-
* `fixed`/`absolute` behind unrelated content.
|
|
23
|
+
* Where the spotlight reads pointer movement. `'self'` tracks over this element; `'window'` tracks anywhere - for a
|
|
24
|
+
* pattern positioned behind unrelated content.
|
|
25
|
+
* @default 'self'
|
|
18
26
|
*/
|
|
19
27
|
track?: 'self' | 'window'
|
|
20
28
|
}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react'
|
|
|
4
4
|
import { mergeProps } from '@base-ui/react/merge-props'
|
|
5
5
|
import { useRender } from '@base-ui/react/use-render'
|
|
6
6
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
7
|
-
import { cn, focusableProps } from '../../utils'
|
|
7
|
+
import { cn, focusableProps } from '../../internal/utils'
|
|
8
8
|
|
|
9
9
|
const backgroundLayer = [
|
|
10
10
|
'before:pointer-events-none',
|
|
@@ -120,7 +120,19 @@ type BadgeState = {
|
|
|
120
120
|
size: VariantProps<typeof badgeVariants>['size']
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
interface BadgeProps
|
|
123
|
+
interface BadgeProps
|
|
124
|
+
extends useRender.ComponentProps<'span', BadgeState>, Omit<VariantProps<typeof badgeVariants>, 'variant' | 'size'> {
|
|
125
|
+
/**
|
|
126
|
+
* Color scheme.
|
|
127
|
+
* @default 'primary'
|
|
128
|
+
*/
|
|
129
|
+
variant?: VariantProps<typeof badgeVariants>['variant']
|
|
130
|
+
/**
|
|
131
|
+
* Scale. The `icon-*` sizes render a square badge for a lone icon.
|
|
132
|
+
* @default 'md'
|
|
133
|
+
*/
|
|
134
|
+
size?: VariantProps<typeof badgeVariants>['size']
|
|
135
|
+
}
|
|
124
136
|
|
|
125
137
|
function Badge({ className, variant, size, render, ...props }: BadgeProps) {
|
|
126
138
|
const renderedProps = React.isValidElement<Record<string, unknown>>(render) ? render.props : undefined
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react'
|
|
2
|
+
import { describe, it, expect } from 'vitest'
|
|
3
|
+
import { axe } from 'vitest-axe'
|
|
4
|
+
import { BorderBeam } from './border-beam'
|
|
5
|
+
|
|
6
|
+
const root = (container: HTMLElement) => container.querySelector('[data-slot="border-beam"]') as HTMLElement
|
|
7
|
+
const ring = (container: HTMLElement) => container.querySelector('[data-slot="border-beam-ring"]') as HTMLElement
|
|
8
|
+
|
|
9
|
+
describe('BorderBeam', () => {
|
|
10
|
+
it('renders its children inside the wrapper', () => {
|
|
11
|
+
render(
|
|
12
|
+
<BorderBeam>
|
|
13
|
+
<span>Content</span>
|
|
14
|
+
</BorderBeam>,
|
|
15
|
+
)
|
|
16
|
+
expect(screen.getByText('Content').closest('[data-slot="border-beam"]')).not.toBeNull()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('paints a decorative comet that fades into a transparent tail', () => {
|
|
20
|
+
const { container } = render(<BorderBeam />)
|
|
21
|
+
expect(ring(container)).toHaveAttribute('aria-hidden')
|
|
22
|
+
expect(ring(container).style.background).toContain('conic-gradient(from var(--border-beam-angle), transparent')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('maps color and length onto the gradient, and thickness onto the ring', () => {
|
|
26
|
+
const { container } = render(<BorderBeam color="#8EC5FF" length={25} thickness={3} />)
|
|
27
|
+
const style = ring(container).style
|
|
28
|
+
expect(style.background).toContain('#8EC5FF 25%')
|
|
29
|
+
expect(style.padding).toBe('3px')
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('forwards speed and delay as CSS variables', () => {
|
|
33
|
+
const { container } = render(<BorderBeam speed={10} delay={-2} />)
|
|
34
|
+
const style = root(container).style
|
|
35
|
+
expect(style.getPropertyValue('--border-beam-duration')).toBe('10s')
|
|
36
|
+
expect(style.getPropertyValue('--border-beam-delay')).toBe('-2s')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('is always-on (no data-reveal) by default', () => {
|
|
40
|
+
const { container } = render(<BorderBeam />)
|
|
41
|
+
expect(root(container)).not.toHaveAttribute('data-reveal')
|
|
42
|
+
expect(ring(container)).not.toHaveClass('opacity-0')
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('marks managed visibility via data-reveal for interaction triggers', () => {
|
|
46
|
+
const { container } = render(<BorderBeam revealOn={['hover', 'press']} />)
|
|
47
|
+
expect(root(container)).toHaveAttribute('data-reveal', 'hover press')
|
|
48
|
+
expect(root(container)).not.toHaveAttribute('data-revealed')
|
|
49
|
+
expect(ring(container)).toHaveClass('opacity-0', '[animation-play-state:paused]')
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('reflects the controlled reveal prop via data-revealed', () => {
|
|
53
|
+
const { container, rerender } = render(<BorderBeam reveal={false} />)
|
|
54
|
+
// Controlled mode is still "managed" so the beam can be hidden when false.
|
|
55
|
+
expect(root(container)).toHaveAttribute('data-reveal', '')
|
|
56
|
+
expect(root(container)).not.toHaveAttribute('data-revealed')
|
|
57
|
+
|
|
58
|
+
rerender(<BorderBeam reveal />)
|
|
59
|
+
expect(root(container)).toHaveAttribute('data-revealed')
|
|
60
|
+
expect(ring(container)).toHaveClass('opacity-100')
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('opts into the touch fallback via data-show-on-touch', () => {
|
|
64
|
+
const { container, rerender } = render(<BorderBeam revealOn="hover" />)
|
|
65
|
+
expect(root(container)).not.toHaveAttribute('data-show-on-touch')
|
|
66
|
+
|
|
67
|
+
rerender(<BorderBeam revealOn="hover" showOnTouch />)
|
|
68
|
+
expect(root(container)).toHaveAttribute('data-show-on-touch')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('groups and scales the ring on press when pressScale is set', () => {
|
|
72
|
+
const { container } = render(<BorderBeam pressScale />)
|
|
73
|
+
expect(root(container)).toHaveClass('group/beam')
|
|
74
|
+
expect(ring(container)).toHaveClass('group-active/beam:scale-[0.97]')
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it('merges a consumer className onto the wrapper', () => {
|
|
78
|
+
const { container } = render(<BorderBeam className="rounded-full" />)
|
|
79
|
+
expect(root(container)).toHaveClass('rounded-full')
|
|
80
|
+
expect(root(container)).not.toHaveClass('rounded-xl')
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
it('has no accessibility violations (the beam is decorative)', async () => {
|
|
84
|
+
const { container } = render(
|
|
85
|
+
<BorderBeam>
|
|
86
|
+
<p>Readable content</p>
|
|
87
|
+
</BorderBeam>,
|
|
88
|
+
)
|
|
89
|
+
expect(await axe(container)).toHaveNoViolations()
|
|
90
|
+
})
|
|
91
|
+
})
|