@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
|
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,12 +1,13 @@
|
|
|
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
|
|
|
8
8
|
interface BackgroundPatternInteractiveProps {
|
|
9
9
|
variant: BackgroundPatternVariant
|
|
10
|
+
cell: number
|
|
10
11
|
persistent?: boolean
|
|
11
12
|
track?: 'self' | 'window'
|
|
12
13
|
}
|
|
@@ -18,6 +19,7 @@ const FADE_DURATION = 1200
|
|
|
18
19
|
|
|
19
20
|
function BackgroundPatternInteractive({
|
|
20
21
|
variant,
|
|
22
|
+
cell,
|
|
21
23
|
persistent: persistentProp = false,
|
|
22
24
|
track = 'self',
|
|
23
25
|
}: BackgroundPatternInteractiveProps) {
|
|
@@ -85,7 +87,7 @@ function BackgroundPatternInteractive({
|
|
|
85
87
|
)}
|
|
86
88
|
style={{ WebkitMaskImage: SPOTLIGHT, maskImage: SPOTLIGHT }}
|
|
87
89
|
>
|
|
88
|
-
<PatternLayer variant={variant} className={patternSpotlight(variant)} />
|
|
90
|
+
<PatternLayer variant={variant} cell={cell} className={patternSpotlight(variant)} />
|
|
89
91
|
</div>
|
|
90
92
|
)
|
|
91
93
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { cn } from '../../utils'
|
|
1
|
+
import { cn } from '../../internal/utils'
|
|
2
2
|
|
|
3
|
-
type BackgroundPatternVariant = 'dots' | 'grid' | '
|
|
3
|
+
type BackgroundPatternVariant = 'dots' | 'grid' | 'hexagons' | 'rings' | 'checkerboard'
|
|
4
4
|
|
|
5
5
|
interface MaskSpec {
|
|
6
|
-
maskImage: string
|
|
6
|
+
maskImage: string | ((cell: number) => string)
|
|
7
7
|
maskSize?: string
|
|
8
8
|
maskRepeat?: string
|
|
9
9
|
cell: number
|
|
@@ -14,30 +14,53 @@ interface MaskSpec {
|
|
|
14
14
|
|
|
15
15
|
const CELL = 'var(--pattern-cell) var(--pattern-cell)'
|
|
16
16
|
|
|
17
|
+
const GRID_DOT_RADIUS = 1
|
|
18
|
+
const GRID_GAP = 3
|
|
19
|
+
const RING_RADIUS = 4.5
|
|
20
|
+
const RING_STROKE = 2
|
|
21
|
+
|
|
17
22
|
function svgMask(body: string, width = 12, height = width) {
|
|
18
23
|
const svg = `<svg xmlns='http://www.w3.org/2000/svg' width='${width}' height='${height}' viewBox='0 0 ${width} ${height}'>${body}</svg>`
|
|
19
24
|
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`
|
|
20
25
|
}
|
|
21
26
|
|
|
27
|
+
function corners(cell: number): [number, number][] {
|
|
28
|
+
return [
|
|
29
|
+
[0, 0],
|
|
30
|
+
[cell, 0],
|
|
31
|
+
[0, cell],
|
|
32
|
+
[cell, cell],
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function gridMask(cell: number) {
|
|
37
|
+
const start = 0.5 + GRID_DOT_RADIUS + GRID_GAP
|
|
38
|
+
const end = cell + 0.5 - GRID_DOT_RADIUS - GRID_GAP
|
|
39
|
+
const lines = end > start ? `<path d='M${start} .5H${end}M.5 ${start}V${end}' stroke='#000'/>` : ''
|
|
40
|
+
const dots = corners(cell)
|
|
41
|
+
.map(([x, y]) => `<circle cx='${x + 0.5}' cy='${y + 0.5}' r='${GRID_DOT_RADIUS}'/>`)
|
|
42
|
+
.join('')
|
|
43
|
+
return svgMask(lines + dots, cell)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function ringsMask(cell: number) {
|
|
47
|
+
const centers: [number, number][] = [...corners(cell), [cell / 2, cell / 2]]
|
|
48
|
+
const rings = centers.map(([x, y]) => `<circle cx='${x}' cy='${y}' r='${RING_RADIUS}'/>`).join('')
|
|
49
|
+
return svgMask(`<g fill='none' stroke='#000' stroke-width='${RING_STROKE}'>${rings}</g>`, cell)
|
|
50
|
+
}
|
|
51
|
+
|
|
22
52
|
const PATTERN_MASKS: Record<BackgroundPatternVariant, MaskSpec> = {
|
|
23
53
|
dots: {
|
|
24
54
|
maskImage: 'radial-gradient(circle at 1px 1px, #000 1px, transparent 1.5px)',
|
|
25
55
|
cell: 14,
|
|
26
|
-
tint: 'bg-current/
|
|
27
|
-
spotlight: 'bg-current/
|
|
56
|
+
tint: 'bg-current/14',
|
|
57
|
+
spotlight: 'bg-current/62 dark:bg-current/68',
|
|
28
58
|
},
|
|
29
59
|
grid: {
|
|
30
|
-
maskImage:
|
|
31
|
-
'linear-gradient(to right, #000 0 1px, transparent 1px), linear-gradient(to bottom, #000 0 1px, transparent 1px)',
|
|
32
|
-
cell: 28,
|
|
33
|
-
tint: 'bg-current/7',
|
|
34
|
-
spotlight: 'bg-current/28 dark:bg-current/34',
|
|
35
|
-
},
|
|
36
|
-
'dashed-grid': {
|
|
37
|
-
maskImage: svgMask(`<path d='M0 0H12 M0 0V12' stroke='#000' stroke-width='1' stroke-dasharray='2 2'/>`),
|
|
60
|
+
maskImage: gridMask,
|
|
38
61
|
cell: 28,
|
|
39
|
-
tint: 'bg-current/
|
|
40
|
-
spotlight: 'bg-current/
|
|
62
|
+
tint: 'bg-current/9',
|
|
63
|
+
spotlight: 'bg-current/32 dark:bg-current/38',
|
|
41
64
|
},
|
|
42
65
|
hexagons: {
|
|
43
66
|
maskImage: svgMask(
|
|
@@ -47,8 +70,21 @@ const PATTERN_MASKS: Record<BackgroundPatternVariant, MaskSpec> = {
|
|
|
47
70
|
),
|
|
48
71
|
maskSize: 'var(--pattern-cell) calc(var(--pattern-cell) * 1.7320508)',
|
|
49
72
|
cell: 40,
|
|
50
|
-
tint: 'bg-current/
|
|
51
|
-
spotlight: 'bg-current/
|
|
73
|
+
tint: 'bg-current/9',
|
|
74
|
+
spotlight: 'bg-current/32 dark:bg-current/38',
|
|
75
|
+
},
|
|
76
|
+
rings: {
|
|
77
|
+
maskImage: ringsMask,
|
|
78
|
+
cell: 48,
|
|
79
|
+
tint: 'bg-current/9',
|
|
80
|
+
spotlight: 'bg-current/32 dark:bg-current/38',
|
|
81
|
+
},
|
|
82
|
+
checkerboard: {
|
|
83
|
+
maskImage: 'repeating-conic-gradient(#000 0% 25%, transparent 0% 50%)',
|
|
84
|
+
maskSize: 'calc(var(--pattern-cell) * 2) calc(var(--pattern-cell) * 2)',
|
|
85
|
+
cell: 16,
|
|
86
|
+
tint: 'bg-current/5',
|
|
87
|
+
spotlight: 'bg-current/12 dark:bg-current/14',
|
|
52
88
|
},
|
|
53
89
|
}
|
|
54
90
|
|
|
@@ -66,12 +102,13 @@ function patternSpotlight(variant: BackgroundPatternVariant) {
|
|
|
66
102
|
|
|
67
103
|
interface PatternLayerProps {
|
|
68
104
|
variant: BackgroundPatternVariant
|
|
105
|
+
cell: number
|
|
69
106
|
className?: string
|
|
70
107
|
}
|
|
71
108
|
|
|
72
|
-
function PatternLayer({ variant, className }: PatternLayerProps) {
|
|
109
|
+
function PatternLayer({ variant, cell, className }: PatternLayerProps) {
|
|
73
110
|
const spec = PATTERN_MASKS[variant]
|
|
74
|
-
const maskImage = spec.maskImage
|
|
111
|
+
const maskImage = typeof spec.maskImage === 'function' ? spec.maskImage(cell) : spec.maskImage
|
|
75
112
|
const maskSize = spec.maskSize ?? CELL
|
|
76
113
|
const maskRepeat = spec.maskRepeat ?? 'repeat'
|
|
77
114
|
|
|
@@ -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>
|
|
@@ -80,6 +80,41 @@ describe('BackgroundPattern', () => {
|
|
|
80
80
|
expect(root).not.toHaveClass('bg-background-subtle')
|
|
81
81
|
})
|
|
82
82
|
|
|
83
|
+
it.each([
|
|
84
|
+
['dots', 14],
|
|
85
|
+
['grid', 28],
|
|
86
|
+
['hexagons', 40],
|
|
87
|
+
['rings', 48],
|
|
88
|
+
['checkerboard', 16],
|
|
89
|
+
] as const)('paints one masked %s layer at its default cell size', (variant, cell) => {
|
|
90
|
+
const { container } = render(<BackgroundPattern variant={variant} />)
|
|
91
|
+
const root = container.querySelector('[data-slot="background-pattern"]') as HTMLElement
|
|
92
|
+
const layers = container.querySelectorAll<HTMLElement>('[data-slot="background-pattern-layer"]')
|
|
93
|
+
expect(root.style.getPropertyValue('--pattern-cell')).toBe(`${cell}px`)
|
|
94
|
+
expect(layers).toHaveLength(1)
|
|
95
|
+
expect(layers[0]!.style.getPropertyValue('mask-image')).not.toBe('')
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('draws the grid and rings tiles at the resolved cell size', () => {
|
|
99
|
+
const tile = (variant: 'grid' | 'rings', cellSize?: number) => {
|
|
100
|
+
const { container, unmount } = render(<BackgroundPattern variant={variant} cellSize={cellSize} />)
|
|
101
|
+
const mask = container
|
|
102
|
+
.querySelector<HTMLElement>('[data-slot="background-pattern-layer"]')!
|
|
103
|
+
.style.getPropertyValue('mask-image')
|
|
104
|
+
unmount()
|
|
105
|
+
return decodeURIComponent(mask)
|
|
106
|
+
}
|
|
107
|
+
expect(tile('grid')).toContain("width='28' height='28'")
|
|
108
|
+
expect(tile('grid', 40)).toContain("width='40' height='40'")
|
|
109
|
+
expect(tile('rings', 32)).toContain("width='32' height='32'")
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('tiles the checkerboard two cells wide so cellSize sets one square', () => {
|
|
113
|
+
const { container } = render(<BackgroundPattern variant="checkerboard" />)
|
|
114
|
+
const layer = container.querySelector<HTMLElement>('[data-slot="background-pattern-layer"]')!
|
|
115
|
+
expect(layer.style.getPropertyValue('mask-size')).toContain('calc(var(--pattern-cell) * 2)')
|
|
116
|
+
})
|
|
117
|
+
|
|
83
118
|
it('forwards cellSize as a CSS variable', () => {
|
|
84
119
|
const { container } = render(<BackgroundPattern cellSize={20} />)
|
|
85
120
|
const root = container.querySelector('[data-slot="background-pattern"]') as HTMLElement
|
|
@@ -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 28, hexagons 40, rings 48; checkerboard 16, per square). */
|
|
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
|
}
|
|
@@ -39,8 +47,9 @@ function BackgroundPattern({
|
|
|
39
47
|
...props
|
|
40
48
|
}: BackgroundPatternProps) {
|
|
41
49
|
const spot = resolveSpotlight(spotlight)
|
|
50
|
+
const cell = cellSize ?? patternCell(variant)
|
|
42
51
|
const cssVars = {
|
|
43
|
-
'--pattern-cell': `${
|
|
52
|
+
'--pattern-cell': `${cell}px`,
|
|
44
53
|
...(spot?.size != null && {
|
|
45
54
|
'--spotlight-size': typeof spot.size === 'number' ? `${spot.size}px` : spot.size,
|
|
46
55
|
}),
|
|
@@ -56,8 +65,14 @@ function BackgroundPattern({
|
|
|
56
65
|
style={{ ...cssVars, ...style }}
|
|
57
66
|
{...props}
|
|
58
67
|
>
|
|
59
|
-
<PatternLayer
|
|
60
|
-
|
|
68
|
+
<PatternLayer
|
|
69
|
+
variant={variant}
|
|
70
|
+
cell={cell}
|
|
71
|
+
className={cn('-z-10 text-(--pattern-color)', patternTint(variant))}
|
|
72
|
+
/>
|
|
73
|
+
{spot ? (
|
|
74
|
+
<BackgroundPatternInteractive variant={variant} cell={cell} persistent={spot.persistent} track={track} />
|
|
75
|
+
) : null}
|
|
61
76
|
{children}
|
|
62
77
|
</div>
|
|
63
78
|
)
|
|
@@ -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
|
+
})
|