@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 { Field as BaseField } from '@base-ui/react/field'
|
|
5
5
|
import { type VariantProps } from 'class-variance-authority'
|
|
6
|
-
import { cn, useComposedRefs } from '../../utils'
|
|
6
|
+
import { cn, useComposedRefs } from '../../internal/utils'
|
|
7
7
|
import { inputVariants } from '../input/input-variants'
|
|
8
8
|
|
|
9
9
|
type BaseControlProps = React.ComponentProps<typeof BaseField.Control>
|
|
@@ -12,11 +12,26 @@ type TextareaVariant = NonNullable<VariantProps<typeof inputVariants>['variant']
|
|
|
12
12
|
type TextareaSize = NonNullable<VariantProps<typeof inputVariants>['size']>
|
|
13
13
|
|
|
14
14
|
interface TextareaProps extends Omit<React.ComponentProps<'textarea'>, 'size'> {
|
|
15
|
+
/**
|
|
16
|
+
* Field appearance - bordered or filled.
|
|
17
|
+
* @default 'outline'
|
|
18
|
+
*/
|
|
15
19
|
variant?: TextareaVariant
|
|
20
|
+
/**
|
|
21
|
+
* Scales padding and text. Named `inputSize` to avoid colliding with native attributes.
|
|
22
|
+
* @default 'md'
|
|
23
|
+
*/
|
|
16
24
|
inputSize?: TextareaSize
|
|
25
|
+
/**
|
|
26
|
+
* Show a clear (✕) button once the field has a value.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
17
29
|
clearable?: boolean
|
|
30
|
+
/** Adornment rendered before the field, aligned to the first line. */
|
|
18
31
|
startSlot?: React.ReactNode
|
|
32
|
+
/** Adornment rendered after the field, aligned to the first line. */
|
|
19
33
|
endSlot?: React.ReactNode
|
|
34
|
+
/** Called when the clear button is pressed. */
|
|
20
35
|
onClear?: () => void
|
|
21
36
|
}
|
|
22
37
|
|
|
@@ -4,7 +4,7 @@ import { axe } from 'vitest-axe'
|
|
|
4
4
|
import { Thumbnail } from './thumbnail'
|
|
5
5
|
|
|
6
6
|
// jsdom does not actually load images. Base UI Avatar uses a pre-loader that
|
|
7
|
-
// listens for `load`/`error` on a probe Image
|
|
7
|
+
// listens for `load`/`error` on a probe Image - without this stub the probe
|
|
8
8
|
// never resolves and the underlying <img> never mounts.
|
|
9
9
|
const ORIGINAL_SRC_DESCRIPTOR = Object.getOwnPropertyDescriptor(window.Image.prototype, 'src')
|
|
10
10
|
beforeAll(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { Avatar as BaseAvatar } from '@base-ui/react/avatar'
|
|
3
3
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
-
import { cn } from '../../utils'
|
|
4
|
+
import { cn } from '../../internal/utils'
|
|
5
5
|
|
|
6
6
|
const thumbnailVariants = cva(
|
|
7
7
|
"relative inline-flex size-[1em] shrink-0 items-center justify-center overflow-hidden [&_svg:not([class*='size-'])]:size-[0.5em]",
|
|
@@ -43,13 +43,33 @@ type ThumbnailVariant = NonNullable<VariantProps<typeof thumbnailVariants>['vari
|
|
|
43
43
|
type BaseImageProps = React.ComponentProps<typeof BaseAvatar.Image>
|
|
44
44
|
|
|
45
45
|
interface ThumbnailProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'size' | 'children'> {
|
|
46
|
+
/**
|
|
47
|
+
* Image tile, or a colored icon tile.
|
|
48
|
+
* @default 'image'
|
|
49
|
+
*/
|
|
46
50
|
variant?: ThumbnailVariant
|
|
51
|
+
/**
|
|
52
|
+
* Rounded square or full circle.
|
|
53
|
+
* @default 'rounded'
|
|
54
|
+
*/
|
|
47
55
|
shape?: ThumbnailShape
|
|
56
|
+
/**
|
|
57
|
+
* A preset scale, or a pixel number for an exact size.
|
|
58
|
+
* @default 'md'
|
|
59
|
+
*/
|
|
48
60
|
size?: ThumbnailPresetSize | number
|
|
61
|
+
/** Image URL (image variant). Lifted from `render` when omitted. */
|
|
49
62
|
src?: string
|
|
63
|
+
/**
|
|
64
|
+
* Alternative text describing the image. Defaults to `""` (decorative) when omitted.
|
|
65
|
+
* @default ''
|
|
66
|
+
*/
|
|
50
67
|
alt?: string
|
|
68
|
+
/** Swap the `<img>` for another element - e.g. a Next.js `<Image>`. */
|
|
51
69
|
render?: BaseImageProps['render']
|
|
70
|
+
/** Fires as the image moves through its loading lifecycle. */
|
|
52
71
|
onLoadingStatusChange?: BaseImageProps['onLoadingStatusChange']
|
|
72
|
+
/** The icon to frame (icon variants). */
|
|
53
73
|
children?: React.ReactNode
|
|
54
74
|
}
|
|
55
75
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { type VariantProps } from 'class-variance-authority'
|
|
5
5
|
import { useFieldRootContext } from '@base-ui/react/internals/field-root-context'
|
|
6
|
-
import { cn } from '../../utils'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
7
|
import { inputVariants } from '../input/input-variants'
|
|
8
8
|
|
|
9
9
|
type TimeFieldVariant = NonNullable<VariantProps<typeof inputVariants>['variant']>
|
|
@@ -25,19 +25,54 @@ interface LiteralNode {
|
|
|
25
25
|
type FormatNode = SegmentNode | LiteralNode
|
|
26
26
|
|
|
27
27
|
interface TimeFieldProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'defaultValue' | 'onChange'> {
|
|
28
|
+
/** Controlled value, a 24-hour `"HH:mm[:ss]"` string. Pair with `onValueChange`. */
|
|
28
29
|
value?: string | null
|
|
30
|
+
/** Uncontrolled initial value. */
|
|
29
31
|
defaultValue?: string | null
|
|
32
|
+
/** Fires with the time string when complete, or `null` when cleared. */
|
|
30
33
|
onValueChange?: (time: string | null) => void
|
|
34
|
+
/**
|
|
35
|
+
* date-fns token string - `H`/`HH`, `h`/`hh`, `m`/`mm`, `s`/`ss`, `a`.
|
|
36
|
+
* @default 'HH:mm'
|
|
37
|
+
*/
|
|
31
38
|
format?: string
|
|
39
|
+
/**
|
|
40
|
+
* Field appearance - bordered or filled.
|
|
41
|
+
* @default 'outline'
|
|
42
|
+
*/
|
|
32
43
|
variant?: TimeFieldVariant
|
|
44
|
+
/**
|
|
45
|
+
* Height, padding, and text scale.
|
|
46
|
+
* @default 'md'
|
|
47
|
+
*/
|
|
33
48
|
size?: TimeFieldSize
|
|
49
|
+
/** Content pinned to the start edge. */
|
|
34
50
|
startSlot?: React.ReactNode
|
|
51
|
+
/** Content pinned to the end edge. */
|
|
35
52
|
endSlot?: React.ReactNode
|
|
53
|
+
/**
|
|
54
|
+
* Blocks interaction and removes the segments from the tab order.
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
36
57
|
disabled?: boolean
|
|
58
|
+
/**
|
|
59
|
+
* Segments stay focusable and readable but can't be edited.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
37
62
|
readOnly?: boolean
|
|
63
|
+
/**
|
|
64
|
+
* Marks the hidden form input as required (needs `name`).
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
38
67
|
required?: boolean
|
|
68
|
+
/** Renders a hidden `<input>` with the time value for form submission. */
|
|
39
69
|
name?: string
|
|
70
|
+
/**
|
|
71
|
+
* Drop the input appearance - for composing inside another field (used by `DatePicker`).
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
40
74
|
unstyled?: boolean
|
|
75
|
+
/** Ref to the underlying element. */
|
|
41
76
|
ref?: React.Ref<HTMLDivElement>
|
|
42
77
|
}
|
|
43
78
|
|
|
@@ -42,7 +42,7 @@ function renderToasterSandbox({
|
|
|
42
42
|
position?: ToastPosition
|
|
43
43
|
progress?: boolean
|
|
44
44
|
}) {
|
|
45
|
-
// Spread props only when defined
|
|
45
|
+
// Spread props only when defined - passing an explicit `undefined`
|
|
46
46
|
// violates exactOptionalPropertyTypes (enabled in the root tsconfig).
|
|
47
47
|
const toasterProps = {
|
|
48
48
|
...(position !== undefined ? { position } : {}),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { Toast as BaseToast } from '@base-ui/react/toast'
|
|
5
5
|
import { type VariantProps } from 'class-variance-authority'
|
|
6
|
-
import { cn } from '../../utils'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
7
|
import { useDirection } from '../../hooks/use-direction'
|
|
8
8
|
import { buttonVariants } from '../button/button-variants'
|
|
9
9
|
|
|
@@ -83,10 +83,28 @@ function ToastProvider(props: ToastProviderProps) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
interface ToasterProps extends Omit<BaseToast.Viewport.Props, 'children'> {
|
|
86
|
+
/**
|
|
87
|
+
* Where the stack is anchored; also sets the default swipe-to-dismiss directions.
|
|
88
|
+
* @default 'bottom-right'
|
|
89
|
+
*/
|
|
86
90
|
position?: ToastPosition
|
|
91
|
+
/**
|
|
92
|
+
* Opt in to a countdown progress bar on auto-dismissing toasts.
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
87
95
|
progress?: boolean
|
|
96
|
+
/**
|
|
97
|
+
* Provider default (ms) used to size the progress bar for toasts that don't set their own `timeout`. Match your
|
|
98
|
+
* `ToastProvider`'s `timeout`.
|
|
99
|
+
* @default 5000
|
|
100
|
+
*/
|
|
88
101
|
timeout?: number
|
|
102
|
+
/**
|
|
103
|
+
* Portal target - scope the toasts to a specific element.
|
|
104
|
+
* @default document.body
|
|
105
|
+
*/
|
|
89
106
|
container?: React.ComponentProps<typeof BaseToast.Portal>['container']
|
|
107
|
+
/** Escape hatch forwarded to the underlying `Toast.Portal`. */
|
|
90
108
|
portalProps?: Omit<React.ComponentProps<typeof BaseToast.Portal>, 'children'>
|
|
91
109
|
}
|
|
92
110
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
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
|
-
import { cn } from '../../utils'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
7
|
|
|
8
8
|
type TocContextValue = {
|
|
9
9
|
activeIds: readonly string[]
|
|
@@ -41,6 +41,11 @@ function closestHeadingId(ids: readonly string[], rootBounds: DOMRectReadOnly |
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
interface TocProps extends React.ComponentPropsWithoutRef<'nav'> {
|
|
44
|
+
/**
|
|
45
|
+
* `IntersectionObserver` `rootMargin` (`top right bottom left`) - offset the active boundary, e.g. for a sticky
|
|
46
|
+
* header.
|
|
47
|
+
* @default '0px'
|
|
48
|
+
*/
|
|
44
49
|
rootMargin?: string
|
|
45
50
|
}
|
|
46
51
|
|
|
@@ -187,7 +192,12 @@ const DEPTH_INDENT: Record<number, string> = {
|
|
|
187
192
|
}
|
|
188
193
|
|
|
189
194
|
interface TocLinkProps extends useRender.ComponentProps<'a', TocLinkState> {
|
|
195
|
+
/** **Required.** The target heading, as a hash (`#id`). The `id` after `#` is the heading observed. */
|
|
190
196
|
href: string
|
|
197
|
+
/**
|
|
198
|
+
* Heading level (2-6); controls the indentation. Higher = deeper indent.
|
|
199
|
+
* @default 2
|
|
200
|
+
*/
|
|
191
201
|
depth?: number
|
|
192
202
|
}
|
|
193
203
|
|
|
@@ -78,7 +78,7 @@ describe('Toggle', () => {
|
|
|
78
78
|
expect(onPressedChange).not.toHaveBeenCalled()
|
|
79
79
|
})
|
|
80
80
|
|
|
81
|
-
it('
|
|
81
|
+
it('honors controlled pressed prop', async () => {
|
|
82
82
|
const user = userEvent.setup()
|
|
83
83
|
const onPressedChange = vi.fn()
|
|
84
84
|
render(
|
|
@@ -59,7 +59,7 @@ describe('Tooltip', () => {
|
|
|
59
59
|
await user.hover(screen.getByRole('button', { name: 'Hover' }))
|
|
60
60
|
|
|
61
61
|
await screen.findByText('Add to library')
|
|
62
|
-
// Popup is portaled
|
|
62
|
+
// Popup is portaled - query at document level.
|
|
63
63
|
const arrow = document.querySelector('[data-slot="tooltip-arrow"]') as HTMLElement | null
|
|
64
64
|
expect(arrow).not.toBeNull()
|
|
65
65
|
expect(arrow!.className).toContain('size-2.5')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip'
|
|
3
|
-
import { cn } from '../../utils'
|
|
4
|
-
import { type FloatingContentProps, splitFloatingProps } from '../../floating'
|
|
3
|
+
import { cn } from '../../internal/utils'
|
|
4
|
+
import { type FloatingContentProps, splitFloatingProps } from '../../internal/floating'
|
|
5
5
|
|
|
6
6
|
type TooltipProviderProps = React.ComponentProps<typeof BaseTooltip.Provider>
|
|
7
7
|
|
|
@@ -26,6 +26,10 @@ type TooltipContentProps = React.ComponentProps<typeof BaseTooltip.Popup> &
|
|
|
26
26
|
React.ComponentProps<typeof BaseTooltip.Positioner>,
|
|
27
27
|
React.ComponentProps<typeof BaseTooltip.Portal>
|
|
28
28
|
> & {
|
|
29
|
+
/**
|
|
30
|
+
* Render the pointer.
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
29
33
|
arrow?: boolean
|
|
30
34
|
}
|
|
31
35
|
|
|
@@ -4,12 +4,16 @@ import { useCallback, useMemo } from 'react'
|
|
|
4
4
|
import { useStorage, type StorageBackend } from './use-local-storage'
|
|
5
5
|
|
|
6
6
|
export interface UseDismissibleOptions {
|
|
7
|
+
/** Which Web Storage area the dismissal is persisted to. */
|
|
7
8
|
storage?: StorageBackend
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export interface UseDismissibleReturn {
|
|
12
|
+
/** Whether the surface should show (`true` until dismissed) */
|
|
11
13
|
open: boolean
|
|
14
|
+
/** Mark it dismissed and persist that */
|
|
12
15
|
dismiss: () => void
|
|
16
|
+
/** Clear the dismissal so it shows again */
|
|
13
17
|
reset: () => void
|
|
14
18
|
}
|
|
15
19
|
|
|
@@ -43,8 +43,8 @@ function getStore(backend: StorageBackend): Storage | null {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// A single `storage` listener shared by every hook instance
|
|
47
|
-
// first subscriber, removed at zero
|
|
46
|
+
// A single `storage` listener shared by every hook instance - installed at the
|
|
47
|
+
// first subscriber, removed at zero - dispatching through the registries above.
|
|
48
48
|
let globalListenerCount = 0
|
|
49
49
|
|
|
50
50
|
function handleGlobalStorage(e: StorageEvent) {
|
|
@@ -105,7 +105,7 @@ export function useStorage<T>(
|
|
|
105
105
|
deserializeRef.current = options.deserializer
|
|
106
106
|
|
|
107
107
|
const read = useCallback((): T => {
|
|
108
|
-
// An empty key means "no persistence"
|
|
108
|
+
// An empty key means "no persistence" - behave like storage is unavailable
|
|
109
109
|
// instead of touching `getItem('')` and registering a listener.
|
|
110
110
|
if (!key) return defaultRef.current
|
|
111
111
|
const store = getStore(backend)
|
|
@@ -6,7 +6,7 @@ import { useReducedMotionContext } from '../providers/reduced-motion-provider'
|
|
|
6
6
|
const QUERY = '(prefers-reduced-motion: reduce)'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Returns `true` when animations should be skipped
|
|
9
|
+
* Returns `true` when animations should be skipped - either because the OS
|
|
10
10
|
* exposes `prefers-reduced-motion: reduce` or because a parent
|
|
11
11
|
* `<ReducedMotionProvider disableAnimations>` opted out globally.
|
|
12
12
|
*/
|
package/src/hooks/use-theme.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type UseThemeReturn = ThemeContextValue
|
|
|
8
8
|
* Read and control the active theme. Returns the stored `theme`, the
|
|
9
9
|
* `resolvedTheme` (`'system'` resolved to `'light'`/`'dark'`), `systemTheme`,
|
|
10
10
|
* the available `themes`, any `forcedTheme`, a `setTheme` setter, and
|
|
11
|
-
* `mounted`
|
|
11
|
+
* `mounted` - guard theme-dependent UI (e.g. a sun/moon icon) with `mounted`
|
|
12
12
|
* to avoid hydration mismatches. Returns inert values with no `<ThemeProvider>`.
|
|
13
13
|
*/
|
|
14
14
|
export function useTheme(): UseThemeReturn {
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Auto-generated by scripts/sync-exports.mjs from src/{components,hooks,providers}/*.
|
|
2
|
-
// Do not edit by hand
|
|
1
|
+
// Auto-generated by scripts/sync-exports.mjs from src/{components,lib,hooks,providers}/*.
|
|
2
|
+
// Do not edit by hand - your changes will be overwritten on the next build.
|
|
3
3
|
|
|
4
4
|
export * from './components/accordion/accordion'
|
|
5
5
|
export * from './components/alert/alert'
|
|
@@ -8,15 +8,22 @@ export * from './components/autocomplete/autocomplete'
|
|
|
8
8
|
export * from './components/avatar/avatar'
|
|
9
9
|
export * from './components/background-pattern/index'
|
|
10
10
|
export * from './components/badge/badge'
|
|
11
|
+
export * from './components/border-beam/border-beam'
|
|
11
12
|
export * from './components/breadcrumb/breadcrumb'
|
|
12
13
|
export * from './components/button/index'
|
|
13
14
|
export * from './components/button-group/button-group'
|
|
14
15
|
export * from './components/calendar/calendar'
|
|
16
|
+
export * from './components/card/card'
|
|
15
17
|
export * from './components/carousel/carousel'
|
|
16
18
|
export * from './components/checkbox/checkbox'
|
|
17
19
|
export * from './components/checkbox-group/checkbox-group'
|
|
18
20
|
export * from './components/chip/chip'
|
|
19
21
|
export * from './components/collapsible/collapsible'
|
|
22
|
+
export * from './components/color-area/color-area'
|
|
23
|
+
export * from './components/color-picker/color-picker'
|
|
24
|
+
export * from './components/color-slider/color-slider'
|
|
25
|
+
export * from './components/color-swatch/color-swatch'
|
|
26
|
+
export * from './components/color-swatch-picker/color-swatch-picker'
|
|
20
27
|
export * from './components/combobox/combobox'
|
|
21
28
|
export * from './components/context-menu/context-menu'
|
|
22
29
|
export * from './components/copy-button/copy-button'
|
|
@@ -45,6 +52,7 @@ export * from './components/preview-card/preview-card'
|
|
|
45
52
|
export * from './components/progress/progress'
|
|
46
53
|
export * from './components/radio/radio'
|
|
47
54
|
export * from './components/radio-group/radio-group'
|
|
55
|
+
export * from './components/rating/rating'
|
|
48
56
|
export * from './components/scroll-area/scroll-area'
|
|
49
57
|
export * from './components/select/select'
|
|
50
58
|
export * from './components/separator/separator'
|
|
@@ -65,6 +73,7 @@ export * from './components/toggle/toggle'
|
|
|
65
73
|
export * from './components/toggle-group/toggle-group'
|
|
66
74
|
export * from './components/toolbar/toolbar'
|
|
67
75
|
export * from './components/tooltip/tooltip'
|
|
76
|
+
export * from './lib/color'
|
|
68
77
|
export * from './hooks/use-direction'
|
|
69
78
|
export * from './hooks/use-dismissible'
|
|
70
79
|
export * from './hooks/use-local-storage'
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// Shared plumbing for the color components (ColorArea, ColorSlider, ColorSwatch,
|
|
2
|
+
// ColorSwatchPicker, ColorPicker). Keeping the border, the disabled treatment, the thumb, the
|
|
3
|
+
// size ladder and the snapping here is what stops them from drifting apart visually.
|
|
4
|
+
// Internal: nothing here is re-exported from the package.
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
type Color,
|
|
8
|
+
type ColorChannel,
|
|
9
|
+
type ColorSpace,
|
|
10
|
+
convertColor,
|
|
11
|
+
getColorChannels,
|
|
12
|
+
parseColor,
|
|
13
|
+
} from '../lib/color'
|
|
14
|
+
|
|
15
|
+
/** Group name both control roots carry, so the shared thumb can react to either. */
|
|
16
|
+
export const COLOR_CONTROL_GROUP = 'group/color-control'
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Inert, dimmed and flat-filled: the disabled treatment every color component shares.
|
|
20
|
+
* The flat fill only shows because the components withhold their inline background
|
|
21
|
+
* when disabled, leaving this class to paint.
|
|
22
|
+
*/
|
|
23
|
+
export const colorControlDisabledClasses =
|
|
24
|
+
'data-disabled:pointer-events-none data-disabled:opacity-disabled data-disabled:bg-background-muted'
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* That treatment plus the focus ring and gesture guards, for the two controls a
|
|
28
|
+
* pointer drags. A swatch takes the disabled classes alone: `touch-none` there would
|
|
29
|
+
* cost a palette its touch scrolling.
|
|
30
|
+
*/
|
|
31
|
+
export const colorControlRootClasses = `outline-ring relative isolate touch-none select-none forced-color-adjust-none outline-offset-2 has-focus-visible:outline-3 ${colorControlDisabledClasses}`
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Hairline over the color, so a pale one still reads as a bounded surface, and
|
|
35
|
+
* the dashed outline that replaces it when disabled. Both live on this overlay rather
|
|
36
|
+
* than the root: a border on the root would shrink the padding box the thumb is
|
|
37
|
+
* positioned against, nudging it a pixel the moment the control is disabled. The
|
|
38
|
+
* border color is inert without a width, so only the width and style are scoped.
|
|
39
|
+
*/
|
|
40
|
+
export const colorControlSurfaceClasses =
|
|
41
|
+
'ring-border border-border-strong pointer-events-none absolute inset-0 rounded-[inherit] ring-1 ring-inset group-data-disabled/color-control:border group-data-disabled/color-control:border-dashed group-data-disabled/color-control:ring-0'
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The thumb, minus positioning. Its own position is deliberately not transitioned -
|
|
45
|
+
* easing it toward the pointer reads as lag. Only the press scale animates, and
|
|
46
|
+
* `translate` and `scale` are separate properties, so centering the thumb and scaling
|
|
47
|
+
* it never contend for `transform`.
|
|
48
|
+
*
|
|
49
|
+
* The white rim carries a faint dark ring on each side, so it stays legible over any
|
|
50
|
+
* point of the gradient in either theme, including a white one.
|
|
51
|
+
*/
|
|
52
|
+
export const colorControlThumbClasses =
|
|
53
|
+
'absolute z-10 size-4.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-3 border-white ring-1 ring-black/20 inset-ring-1 inset-ring-black/20 rtl:translate-x-1/2 motion-safe:transition-[scale] motion-safe:duration-150 motion-safe:ease-out group-active/color-control:scale-125 group-data-dragging/color-control:scale-125 data-disabled:bg-background-muted'
|
|
54
|
+
|
|
55
|
+
// Backdrop for anything translucent - an alpha track, a swatch below full opacity -
|
|
56
|
+
// so the transparency shows rather than being implied. Image and tile size stay
|
|
57
|
+
// separate: `background-image` rejects the `0 0 / size` shorthand outright, taking
|
|
58
|
+
// the whole declaration with it.
|
|
59
|
+
export const colorControlCheckerboard =
|
|
60
|
+
'repeating-conic-gradient(var(--background-strong) 0% 25%, var(--background) 0% 50%)'
|
|
61
|
+
|
|
62
|
+
export const colorControlCheckerboardSize = '0.75rem 0.75rem'
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The swatch ladder: Avatar's, shifted one step down. A swatch is read beside a
|
|
66
|
+
* value rather than looked at, so it needs 16px more than it needs 80px. Every name
|
|
67
|
+
* the two scales share keeps its pixel size. Driven through `font-size` so a `1em`
|
|
68
|
+
* box, its corner and anything nested scale from one declaration.
|
|
69
|
+
*/
|
|
70
|
+
export const COLOR_SWATCH_SIZES = {
|
|
71
|
+
'3xs': 'text-[1rem]',
|
|
72
|
+
'2xs': 'text-[1.25rem]',
|
|
73
|
+
xs: 'text-[1.5rem]',
|
|
74
|
+
sm: 'text-[2rem]',
|
|
75
|
+
md: 'text-[2.5rem]',
|
|
76
|
+
lg: 'text-[3rem]',
|
|
77
|
+
xl: 'text-[4rem]',
|
|
78
|
+
} as const
|
|
79
|
+
|
|
80
|
+
/** Corner of a swatch and of anything drawn around one, as a share of the box. */
|
|
81
|
+
export const COLOR_SWATCH_SHAPES = {
|
|
82
|
+
rounded: 'rounded-[calc(tan(atan2(var(--radius-md),2.5rem))*100%)]',
|
|
83
|
+
circle: 'rounded-full',
|
|
84
|
+
} as const
|
|
85
|
+
|
|
86
|
+
const HUE_NAMES: [number, string][] = [
|
|
87
|
+
[15, 'red'],
|
|
88
|
+
[45, 'orange'],
|
|
89
|
+
[70, 'yellow'],
|
|
90
|
+
[100, 'lime'],
|
|
91
|
+
[150, 'green'],
|
|
92
|
+
[175, 'teal'],
|
|
93
|
+
[200, 'cyan'],
|
|
94
|
+
[240, 'blue'],
|
|
95
|
+
[270, 'indigo'],
|
|
96
|
+
[300, 'purple'],
|
|
97
|
+
[330, 'magenta'],
|
|
98
|
+
[345, 'pink'],
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* An English description of a color, for a swatch's accessible name. A hex string is
|
|
103
|
+
* announced digit by digit, which tells a screen reader user nothing about the color;
|
|
104
|
+
* "dark vivid blue" does.
|
|
105
|
+
*/
|
|
106
|
+
export function describeColor(color: Color): string {
|
|
107
|
+
const { hue, saturation, lightness, alpha } = convertColor(color, 'hsl')
|
|
108
|
+
if (alpha === 0) return 'transparent'
|
|
109
|
+
const opacity = alpha < 1 ? `, ${Math.round(alpha * 100)}% opacity` : ''
|
|
110
|
+
|
|
111
|
+
if (lightness < 4) return `black${opacity}`
|
|
112
|
+
if (lightness > 96) return `white${opacity}`
|
|
113
|
+
if (saturation < 10) {
|
|
114
|
+
return `${lightness < 35 ? 'dark gray' : lightness > 70 ? 'light gray' : 'gray'}${opacity}`
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const name = HUE_NAMES.find(([max]) => hue < max)?.[1] ?? 'red'
|
|
118
|
+
const tone =
|
|
119
|
+
lightness < 25
|
|
120
|
+
? 'very dark '
|
|
121
|
+
: lightness < 42
|
|
122
|
+
? 'dark '
|
|
123
|
+
: lightness > 82
|
|
124
|
+
? 'very light '
|
|
125
|
+
: lightness > 65
|
|
126
|
+
? 'light '
|
|
127
|
+
: ''
|
|
128
|
+
const vividness = saturation < 30 ? 'muted ' : saturation > 85 ? 'vivid ' : ''
|
|
129
|
+
return `${tone}${vividness}${name}${opacity}`
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Spaces a control can plot. Every point of these is a distinct color. */
|
|
133
|
+
export type ColorControlSpace = Extract<ColorSpace, 'rgb' | 'hsl' | 'hsb'>
|
|
134
|
+
|
|
135
|
+
export const COLOR_CONTROL_SPACES: ColorControlSpace[] = ['rgb', 'hsl', 'hsb']
|
|
136
|
+
|
|
137
|
+
/** Rounds to the nearest step, clamped, without the float dust `%` would leave. */
|
|
138
|
+
export function snapToStep(value: number, min: number, max: number, step: number): number {
|
|
139
|
+
const snapped = min + Math.round((value - min) / step) * step
|
|
140
|
+
const decimals = (String(step).split('.')[1] ?? '').length
|
|
141
|
+
return Math.min(Math.max(Number(snapped.toFixed(decimals)), min), max)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Parses a string value, or passes a `Color` through untouched. */
|
|
145
|
+
export function normalizeColor(value: Color | string): Color {
|
|
146
|
+
return typeof value === 'string' ? parseColor(value) : value
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Space a channel belongs to when the value's own can't carry it. Hue and saturation
|
|
150
|
+
// exist in both HSL and HSB; HSB is the pairing a picker is usually built from.
|
|
151
|
+
const CHANNEL_SPACE: Partial<Record<ColorChannel, ColorControlSpace>> = {
|
|
152
|
+
red: 'rgb',
|
|
153
|
+
green: 'rgb',
|
|
154
|
+
blue: 'rgb',
|
|
155
|
+
hue: 'hsb',
|
|
156
|
+
saturation: 'hsb',
|
|
157
|
+
brightness: 'hsb',
|
|
158
|
+
lightness: 'hsl',
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Picks the space a control works in: the value's own whenever it carries the
|
|
163
|
+
* channel, otherwise the channel's home space. Preferring the value's space is what
|
|
164
|
+
* lets an area and a slider share one color without converting it back and forth.
|
|
165
|
+
*/
|
|
166
|
+
export function resolveControlSpace(
|
|
167
|
+
valueSpace: ColorSpace,
|
|
168
|
+
channel: ColorChannel | undefined,
|
|
169
|
+
requested?: ColorControlSpace,
|
|
170
|
+
): ColorControlSpace {
|
|
171
|
+
if (requested) return requested
|
|
172
|
+
// Alpha rides along with every space, so it never forces a conversion.
|
|
173
|
+
const carries = (space: ColorControlSpace) =>
|
|
174
|
+
channel == null || channel === 'alpha' || getColorChannels(space).includes(channel)
|
|
175
|
+
const own = COLOR_CONTROL_SPACES.find((space) => space === valueSpace)
|
|
176
|
+
if (own && carries(own)) return own
|
|
177
|
+
return (channel && CHANNEL_SPACE[channel]) ?? 'rgb'
|
|
178
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Matrix conversions behind lib/color.ts, kept apart from its object API and
|
|
2
|
+
// clamping rules. Internal - nothing here is re-exported from the package.
|
|
3
|
+
// Units are native: sRGB and linear components 0-1, OKLab L 0-1, hue in degrees.
|
|
4
|
+
|
|
5
|
+
/** Applies the sRGB transfer function in reverse, giving linear light. */
|
|
6
|
+
export function srgbToLinear(c: number): number {
|
|
7
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Applies the sRGB transfer function, giving an encoded component. */
|
|
11
|
+
export function linearToSrgb(c: number): number {
|
|
12
|
+
return c <= 0.0031308 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Matrices are Björn Ottosson's reference values, https://bottosson.github.io/posts/oklab/.
|
|
16
|
+
|
|
17
|
+
export function linearRgbToOklab(r: number, g: number, b: number): [number, number, number] {
|
|
18
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b)
|
|
19
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b)
|
|
20
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b)
|
|
21
|
+
return [
|
|
22
|
+
0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
|
|
23
|
+
1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
|
|
24
|
+
0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function oklabToLinearRgb(L: number, a: number, b: number): [number, number, number] {
|
|
29
|
+
const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3
|
|
30
|
+
const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3
|
|
31
|
+
const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3
|
|
32
|
+
return [
|
|
33
|
+
4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
|
34
|
+
-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
|
|
35
|
+
-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Converts OKLCh to encoded sRGB components, without clamping. */
|
|
40
|
+
export function oklchToSrgb(L: number, chroma: number, hue: number): [number, number, number] {
|
|
41
|
+
const radians = (hue * Math.PI) / 180
|
|
42
|
+
const linear = oklabToLinearRgb(L, chroma * Math.cos(radians), chroma * Math.sin(radians))
|
|
43
|
+
return [linearToSrgb(linear[0]), linearToSrgb(linear[1]), linearToSrgb(linear[2])]
|
|
44
|
+
}
|