@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
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
+
import { cn } from '../../internal/utils'
|
|
6
|
+
import { useDirection } from '../../hooks/use-direction'
|
|
7
|
+
import { COLOR_SWATCH_SHAPES, COLOR_SWATCH_SIZES, describeColor, normalizeColor } from '../../internal/color-control'
|
|
8
|
+
import { useColorPickerContext } from '../../internal/color-picker-context'
|
|
9
|
+
import { ColorSwatch } from '../color-swatch/color-swatch'
|
|
10
|
+
import { type Color, formatColor } from '../../lib/color'
|
|
11
|
+
|
|
12
|
+
const ITEM = '[data-slot=color-swatch-picker-item]'
|
|
13
|
+
|
|
14
|
+
type ColorSwatchPickerLayout = 'grid' | 'stack'
|
|
15
|
+
|
|
16
|
+
const pickerVariants = cva('relative isolate flex gap-1', {
|
|
17
|
+
variants: {
|
|
18
|
+
size: COLOR_SWATCH_SIZES,
|
|
19
|
+
layout: {
|
|
20
|
+
grid: 'flex-row flex-wrap',
|
|
21
|
+
stack: 'flex-col',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
// The button is the outer ring's box, so the swatch has to sit inside it. At 0.8em
|
|
27
|
+
// the gap either side is 0.1em, which holds at every size because both are ems.
|
|
28
|
+
const itemVariants = cva(
|
|
29
|
+
'outline-ring relative flex size-[1em] shrink-0 transform-gpu cursor-pointer items-center justify-center focus-visible:outline-3 motion-safe:transition motion-safe:duration-250 motion-safe:ease-[cubic-bezier(0.175,0.885,0.32,1.5)] motion-safe:active:translate-y-px motion-safe:active:scale-90 motion-safe:active:duration-100 motion-safe:active:ease-in-out data-disabled:pointer-events-none data-disabled:cursor-default',
|
|
30
|
+
{ variants: { shape: COLOR_SWATCH_SHAPES } },
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
type ColorSwatchPickerSize = NonNullable<VariantProps<typeof pickerVariants>['size']>
|
|
34
|
+
type ColorSwatchPickerShape = NonNullable<VariantProps<typeof itemVariants>['shape']>
|
|
35
|
+
|
|
36
|
+
interface ColorSwatchPickerContextValue {
|
|
37
|
+
colors: Map<string, Color>
|
|
38
|
+
selectedKey: string | null
|
|
39
|
+
select: (color: Color) => void
|
|
40
|
+
shape: ColorSwatchPickerShape
|
|
41
|
+
disabled: boolean
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const ColorSwatchPickerContext = React.createContext<ColorSwatchPickerContextValue | null>(null)
|
|
45
|
+
|
|
46
|
+
function usePickerContext() {
|
|
47
|
+
const context = React.useContext(ColorSwatchPickerContext)
|
|
48
|
+
if (!context) throw new Error('Appica UI: <ColorSwatchPickerItem> must be used within <ColorSwatchPicker>.')
|
|
49
|
+
return context
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Where the indicator sits, in the picker's own coordinates. */
|
|
53
|
+
interface Indicator {
|
|
54
|
+
x: number
|
|
55
|
+
y: number
|
|
56
|
+
width: number
|
|
57
|
+
height: number
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function sameBox(a: Indicator | null, b: Indicator) {
|
|
61
|
+
return a != null && a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The item one row up or down in a wrapped grid, nearest the column the focus is
|
|
66
|
+
* already in. Rows are whatever shares an `offsetTop`, since the wrapping is the
|
|
67
|
+
* browser's to decide.
|
|
68
|
+
*/
|
|
69
|
+
function rowNeighbor(items: HTMLElement[], from: number, step: 1 | -1) {
|
|
70
|
+
const origin = items[from]!
|
|
71
|
+
const beyond = items.filter((item) =>
|
|
72
|
+
step > 0 ? item.offsetTop > origin.offsetTop : item.offsetTop < origin.offsetTop,
|
|
73
|
+
)
|
|
74
|
+
if (beyond.length === 0) return from + step
|
|
75
|
+
|
|
76
|
+
const tops = beyond.map((item) => item.offsetTop)
|
|
77
|
+
const row = step > 0 ? Math.min(...tops) : Math.max(...tops)
|
|
78
|
+
const nearest = beyond
|
|
79
|
+
.filter((item) => item.offsetTop === row)
|
|
80
|
+
.reduce((best, item) =>
|
|
81
|
+
Math.abs(item.offsetLeft - origin.offsetLeft) < Math.abs(best.offsetLeft - origin.offsetLeft) ? item : best,
|
|
82
|
+
)
|
|
83
|
+
return items.indexOf(nearest)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface ColorSwatchPickerProps extends Omit<
|
|
87
|
+
React.ComponentPropsWithoutRef<'div'>,
|
|
88
|
+
'color' | 'defaultValue' | 'onChange'
|
|
89
|
+
> {
|
|
90
|
+
/**
|
|
91
|
+
* Selected color. Pass a `Color` or any CSS color string to control the component.
|
|
92
|
+
* Inside a `ColorPicker` it can be left off: the control then reads and writes the
|
|
93
|
+
* picker's color.
|
|
94
|
+
*/
|
|
95
|
+
value?: Color | string
|
|
96
|
+
/** Color selected before any interaction, when the component is uncontrolled. */
|
|
97
|
+
defaultValue?: Color | string
|
|
98
|
+
/** Fires with the color that was picked. */
|
|
99
|
+
onValueChange?: (value: Color) => void
|
|
100
|
+
/**
|
|
101
|
+
* Wrapping rows of swatches, or a single column.
|
|
102
|
+
* @default 'grid'
|
|
103
|
+
*/
|
|
104
|
+
layout?: ColorSwatchPickerLayout
|
|
105
|
+
/**
|
|
106
|
+
* A preset scale, or a pixel number for an exact size. Sizes the button; the swatch
|
|
107
|
+
* inside is smaller, so the selected ring has somewhere to sit.
|
|
108
|
+
* @default 'md'
|
|
109
|
+
*/
|
|
110
|
+
size?: ColorSwatchPickerSize | number
|
|
111
|
+
/**
|
|
112
|
+
* Rounded square or full circle, applied to every swatch and to the ring.
|
|
113
|
+
* @default 'rounded'
|
|
114
|
+
*/
|
|
115
|
+
shape?: ColorSwatchPickerShape
|
|
116
|
+
/**
|
|
117
|
+
* Prevent interaction and swap every color for a flat muted fill.
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
disabled?: boolean
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function ColorSwatchPicker({
|
|
124
|
+
value,
|
|
125
|
+
defaultValue,
|
|
126
|
+
onValueChange,
|
|
127
|
+
layout = 'grid',
|
|
128
|
+
size = 'md',
|
|
129
|
+
shape = 'rounded',
|
|
130
|
+
disabled: disabledProp,
|
|
131
|
+
className,
|
|
132
|
+
style,
|
|
133
|
+
children,
|
|
134
|
+
...props
|
|
135
|
+
}: ColorSwatchPickerProps) {
|
|
136
|
+
const mirrored = useDirection() === 'rtl'
|
|
137
|
+
const rootRef = React.useRef<HTMLDivElement>(null)
|
|
138
|
+
const colors = React.useMemo(() => new Map<string, Color>(), [])
|
|
139
|
+
const picker = useColorPickerContext()
|
|
140
|
+
|
|
141
|
+
const [uncontrolled, setUncontrolled] = React.useState<Color | null>(() =>
|
|
142
|
+
defaultValue === undefined ? null : normalizeColor(defaultValue),
|
|
143
|
+
)
|
|
144
|
+
const [indicator, setIndicator] = React.useState<Indicator | null>(null)
|
|
145
|
+
|
|
146
|
+
const disabled = disabledProp || (picker?.disabled ?? false)
|
|
147
|
+
const resolved = value !== undefined ? normalizeColor(value) : (picker?.value ?? uncontrolled)
|
|
148
|
+
// Keyed on hexa like React Aria, so the same color written two ways is one entry.
|
|
149
|
+
const selectedKey = resolved === null ? null : formatColor(resolved, 'hexa')
|
|
150
|
+
|
|
151
|
+
const select = (color: Color) => {
|
|
152
|
+
if (value === undefined && !picker) setUncontrolled(color)
|
|
153
|
+
picker?.setValue(color)
|
|
154
|
+
picker?.commitValue(color)
|
|
155
|
+
onValueChange?.(color)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// No dependency list: this mirrors the rendered DOM back into the roving tab stop
|
|
159
|
+
// and the indicator's box, both of which any render can invalidate.
|
|
160
|
+
React.useEffect(() => {
|
|
161
|
+
const root = rootRef.current
|
|
162
|
+
if (!root) return
|
|
163
|
+
|
|
164
|
+
const sync = () => {
|
|
165
|
+
const items = Array.from(root.querySelectorAll<HTMLElement>(ITEM))
|
|
166
|
+
const selected = items.find((item) => item.getAttribute('aria-selected') === 'true')
|
|
167
|
+
const reachable = selected ?? items.find((item) => !item.hasAttribute('data-disabled'))
|
|
168
|
+
for (const item of items) item.tabIndex = item === reachable ? 0 : -1
|
|
169
|
+
|
|
170
|
+
if (!selected) return setIndicator(null)
|
|
171
|
+
const box = {
|
|
172
|
+
x: selected.offsetLeft,
|
|
173
|
+
y: selected.offsetTop,
|
|
174
|
+
width: selected.offsetWidth,
|
|
175
|
+
height: selected.offsetHeight,
|
|
176
|
+
}
|
|
177
|
+
setIndicator((previous) => (sameBox(previous, box) ? previous : box))
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
sync()
|
|
181
|
+
if (typeof ResizeObserver === 'undefined') return
|
|
182
|
+
const observer = new ResizeObserver(sync)
|
|
183
|
+
observer.observe(root)
|
|
184
|
+
return () => observer.disconnect()
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
188
|
+
const root = rootRef.current
|
|
189
|
+
if (!root) return
|
|
190
|
+
const items = Array.from(root.querySelectorAll<HTMLElement>(`${ITEM}:not([data-disabled])`))
|
|
191
|
+
const current = items.indexOf(document.activeElement as HTMLElement)
|
|
192
|
+
if (current < 0) return
|
|
193
|
+
|
|
194
|
+
const stack = layout === 'stack'
|
|
195
|
+
const forward = mirrored ? 'ArrowLeft' : 'ArrowRight'
|
|
196
|
+
const backward = mirrored ? 'ArrowRight' : 'ArrowLeft'
|
|
197
|
+
|
|
198
|
+
const next =
|
|
199
|
+
event.key === 'Home'
|
|
200
|
+
? 0
|
|
201
|
+
: event.key === 'End'
|
|
202
|
+
? items.length - 1
|
|
203
|
+
: event.key === forward
|
|
204
|
+
? current + 1
|
|
205
|
+
: event.key === backward
|
|
206
|
+
? current - 1
|
|
207
|
+
: event.key === 'ArrowDown'
|
|
208
|
+
? stack
|
|
209
|
+
? current + 1
|
|
210
|
+
: rowNeighbor(items, current, 1)
|
|
211
|
+
: event.key === 'ArrowUp'
|
|
212
|
+
? stack
|
|
213
|
+
? current - 1
|
|
214
|
+
: rowNeighbor(items, current, -1)
|
|
215
|
+
: NaN
|
|
216
|
+
if (Number.isNaN(next)) return
|
|
217
|
+
|
|
218
|
+
event.preventDefault()
|
|
219
|
+
const target = items[(next + items.length) % items.length]
|
|
220
|
+
if (!target) return
|
|
221
|
+
target.focus()
|
|
222
|
+
// Selection follows focus, which is what a single-select listbox is expected to
|
|
223
|
+
// do and what makes arrowing through a palette worth doing at all.
|
|
224
|
+
const color = colors.get(target.dataset.value ?? '')
|
|
225
|
+
if (color) select(color)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const isNumeric = typeof size === 'number'
|
|
229
|
+
const context: ColorSwatchPickerContextValue = { colors, selectedKey, select, shape, disabled }
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<ColorSwatchPickerContext.Provider value={context}>
|
|
233
|
+
<div
|
|
234
|
+
ref={rootRef}
|
|
235
|
+
role="listbox"
|
|
236
|
+
aria-orientation={layout === 'stack' ? 'vertical' : 'horizontal'}
|
|
237
|
+
{...props}
|
|
238
|
+
data-slot="color-swatch-picker"
|
|
239
|
+
data-layout={layout}
|
|
240
|
+
{...(disabled ? { 'data-disabled': '' } : {})}
|
|
241
|
+
className={cn(pickerVariants({ layout, size: isNumeric ? undefined : size }), className)}
|
|
242
|
+
style={{ ...(isNumeric ? { fontSize: `${size}px` } : undefined), ...style }}
|
|
243
|
+
onKeyDown={handleKeyDown}
|
|
244
|
+
>
|
|
245
|
+
{children}
|
|
246
|
+
|
|
247
|
+
{indicator && (
|
|
248
|
+
<span
|
|
249
|
+
aria-hidden="true"
|
|
250
|
+
data-slot="color-swatch-picker-indicator"
|
|
251
|
+
className={cn(
|
|
252
|
+
'border-border-inverse pointer-events-none absolute top-0 left-0 z-10 border',
|
|
253
|
+
COLOR_SWATCH_SHAPES[shape],
|
|
254
|
+
'motion-safe:transition-[translate,width,height] motion-safe:duration-250',
|
|
255
|
+
)}
|
|
256
|
+
style={{
|
|
257
|
+
translate: `${indicator.x}px ${indicator.y}px`,
|
|
258
|
+
width: indicator.width,
|
|
259
|
+
height: indicator.height,
|
|
260
|
+
}}
|
|
261
|
+
/>
|
|
262
|
+
)}
|
|
263
|
+
</div>
|
|
264
|
+
</ColorSwatchPickerContext.Provider>
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface ColorSwatchPickerItemProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'color' | 'value'> {
|
|
269
|
+
/** Color this swatch offers. Pass a `Color` or any CSS color string. */
|
|
270
|
+
color: Color | string
|
|
271
|
+
/** Name announced for the color, in place of the description built from the color itself. */
|
|
272
|
+
colorName?: string
|
|
273
|
+
/**
|
|
274
|
+
* Prevent this swatch from being picked, and swap its color for a flat muted fill.
|
|
275
|
+
* @default false
|
|
276
|
+
*/
|
|
277
|
+
disabled?: boolean
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function ColorSwatchPickerItem({
|
|
281
|
+
color,
|
|
282
|
+
colorName,
|
|
283
|
+
disabled = false,
|
|
284
|
+
className,
|
|
285
|
+
children,
|
|
286
|
+
...props
|
|
287
|
+
}: ColorSwatchPickerItemProps) {
|
|
288
|
+
const { colors, selectedKey, select, shape, disabled: pickerDisabled } = usePickerContext()
|
|
289
|
+
|
|
290
|
+
const resolved = React.useMemo(() => normalizeColor(color), [color])
|
|
291
|
+
const key = formatColor(resolved, 'hexa')
|
|
292
|
+
const selected = selectedKey === key
|
|
293
|
+
const off = disabled || pickerDisabled
|
|
294
|
+
|
|
295
|
+
React.useEffect(() => {
|
|
296
|
+
colors.set(key, resolved)
|
|
297
|
+
return () => {
|
|
298
|
+
colors.delete(key)
|
|
299
|
+
}
|
|
300
|
+
}, [colors, key, resolved])
|
|
301
|
+
|
|
302
|
+
return (
|
|
303
|
+
<button
|
|
304
|
+
type="button"
|
|
305
|
+
role="option"
|
|
306
|
+
aria-selected={selected}
|
|
307
|
+
aria-label={colorName ?? describeColor(resolved)}
|
|
308
|
+
{...props}
|
|
309
|
+
data-slot="color-swatch-picker-item"
|
|
310
|
+
data-value={key}
|
|
311
|
+
{...(off ? { 'data-disabled': '', disabled: true } : {})}
|
|
312
|
+
tabIndex={-1}
|
|
313
|
+
className={cn(itemVariants({ shape }), className)}
|
|
314
|
+
onClick={(event) => {
|
|
315
|
+
props.onClick?.(event)
|
|
316
|
+
if (!event.defaultPrevented) select(resolved)
|
|
317
|
+
}}
|
|
318
|
+
>
|
|
319
|
+
{/* The button carries the name, so a second one on the swatch would double it. */}
|
|
320
|
+
<ColorSwatch aria-hidden="true" color={resolved} shape={shape} disabled={off} className="text-[0.8em]" />
|
|
321
|
+
{children}
|
|
322
|
+
</button>
|
|
323
|
+
)
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export { ColorSwatchPicker, ColorSwatchPickerItem }
|
|
327
|
+
export type { ColorSwatchPickerProps, ColorSwatchPickerItemProps }
|
|
@@ -355,7 +355,7 @@ describe('Combobox', () => {
|
|
|
355
355
|
)
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
it('forwards grid to Base UI Root
|
|
358
|
+
it('forwards grid to Base UI Root - popup uses the grid role', async () => {
|
|
359
359
|
const user = setupUser()
|
|
360
360
|
renderGrid()
|
|
361
361
|
await user.click(screen.getByRole('combobox'))
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { Combobox as BaseCombobox } from '@base-ui/react/combobox'
|
|
5
5
|
import { useReducedMotion } from '../../hooks/use-reduced-motion'
|
|
6
|
-
import { cn } from '../../utils'
|
|
7
|
-
import { type FloatingContentProps, splitFloatingProps } from '../../floating'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
|
+
import { type FloatingContentProps, splitFloatingProps } from '../../internal/floating'
|
|
8
8
|
import { inputVariants } from '../input/input-variants'
|
|
9
9
|
import { buttonVariants } from '../button/button-variants'
|
|
10
10
|
|
|
@@ -33,9 +33,25 @@ function useComboboxContext() {
|
|
|
33
33
|
type BaseComboboxRootProps = React.ComponentProps<typeof BaseCombobox.Root>
|
|
34
34
|
|
|
35
35
|
interface ComboboxProps extends BaseComboboxRootProps {
|
|
36
|
+
/**
|
|
37
|
+
* Input height, popup radius, and item sizing.
|
|
38
|
+
* @default 'md'
|
|
39
|
+
*/
|
|
36
40
|
size?: ComboboxSize
|
|
41
|
+
/**
|
|
42
|
+
* Input appearance - bordered or filled.
|
|
43
|
+
* @default 'outline'
|
|
44
|
+
*/
|
|
37
45
|
variant?: ComboboxVariant
|
|
46
|
+
/**
|
|
47
|
+
* Render a clear button inside the input when a value is present.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
38
50
|
clearable?: boolean
|
|
51
|
+
/**
|
|
52
|
+
* Render a chevron button that toggles the popup.
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
39
55
|
icon?: boolean
|
|
40
56
|
}
|
|
41
57
|
|
|
@@ -69,7 +85,9 @@ const ICON_SIZE: Record<ComboboxSize, string> = {
|
|
|
69
85
|
}
|
|
70
86
|
|
|
71
87
|
interface ComboboxInputProps extends Omit<React.ComponentProps<typeof BaseCombobox.Input>, 'size'> {
|
|
88
|
+
/** Adornment rendered before the field, inside the input frame. */
|
|
72
89
|
startSlot?: React.ReactNode
|
|
90
|
+
/** Adornment rendered after the field, before the controls. */
|
|
73
91
|
endSlot?: React.ReactNode
|
|
74
92
|
}
|
|
75
93
|
|
|
@@ -107,7 +125,9 @@ function ComboboxInput({ className, startSlot, endSlot, placeholder, ...props }:
|
|
|
107
125
|
}
|
|
108
126
|
|
|
109
127
|
interface ComboboxChipsProps extends React.ComponentProps<typeof BaseCombobox.InputGroup> {
|
|
128
|
+
/** Placeholder for the inline text field. */
|
|
110
129
|
placeholder?: string
|
|
130
|
+
/** Props forwarded to the inner text `input`. */
|
|
111
131
|
inputProps?: Omit<React.ComponentProps<typeof BaseCombobox.Input>, 'placeholder'>
|
|
112
132
|
}
|
|
113
133
|
|
|
@@ -185,7 +205,9 @@ function ComboboxToggleButton() {
|
|
|
185
205
|
}
|
|
186
206
|
|
|
187
207
|
interface ComboboxTriggerProps extends React.ComponentProps<typeof BaseCombobox.Trigger> {
|
|
208
|
+
/** Adornment before the value, inside the trigger frame. */
|
|
188
209
|
startSlot?: React.ReactNode
|
|
210
|
+
/** Adornment after the value, before the chevron. */
|
|
189
211
|
endSlot?: React.ReactNode
|
|
190
212
|
}
|
|
191
213
|
|
|
@@ -339,7 +361,9 @@ function ComboboxContent({ className, children, ...props }: ComboboxContentProps
|
|
|
339
361
|
}
|
|
340
362
|
|
|
341
363
|
interface ComboboxListProps<T = any> extends Omit<React.ComponentProps<typeof BaseCombobox.List>, 'children'> {
|
|
364
|
+
/** Items per row in grid mode (defaults to 2 when `grid` is set). */
|
|
342
365
|
cols?: number
|
|
366
|
+
/** A render function over the filtered items, or static `ComboboxItem`s. */
|
|
343
367
|
children?: React.ReactNode | ((item: T, index: number) => React.ReactNode)
|
|
344
368
|
}
|
|
345
369
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { ContextMenu as BaseContextMenu } from '@base-ui/react/context-menu'
|
|
5
5
|
import { useReducedMotion } from '../../hooks/use-reduced-motion'
|
|
6
|
-
import { cn } from '../../utils'
|
|
7
|
-
import { type FloatingContentProps, splitFloatingProps } from '../../floating'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
|
+
import { type FloatingContentProps, splitFloatingProps } from '../../internal/floating'
|
|
8
8
|
import { navigationLinkVariants } from '../navigation/navigation-link-variants'
|
|
9
9
|
|
|
10
10
|
type ContextMenuSize = 'sm' | 'md' | 'lg'
|
|
@@ -27,6 +27,10 @@ function useContextMenuContext() {
|
|
|
27
27
|
type BaseRootProps = React.ComponentProps<typeof BaseContextMenu.Root>
|
|
28
28
|
|
|
29
29
|
interface ContextMenuProps extends BaseRootProps {
|
|
30
|
+
/**
|
|
31
|
+
* Scales the popup radius, item padding, and icon size.
|
|
32
|
+
* @default 'md'
|
|
33
|
+
*/
|
|
30
34
|
size?: ContextMenuSize
|
|
31
35
|
}
|
|
32
36
|
|
|
@@ -60,7 +64,7 @@ const ICON_SIZE: Record<ContextMenuSize, string> = {
|
|
|
60
64
|
|
|
61
65
|
function popupClassName(size: ContextMenuSize, className?: string) {
|
|
62
66
|
return cn(
|
|
63
|
-
'max-h-(--available-height) bg-background border-border-overlay flex flex-col border shadow-2xl outline-none
|
|
67
|
+
'max-h-(--available-height) bg-background border-border-overlay flex flex-col border shadow-2xl outline-none',
|
|
64
68
|
POPUP_SIZE[size],
|
|
65
69
|
'origin-(--transform-origin)',
|
|
66
70
|
'motion-safe:transition-[opacity,scale] motion-safe:duration-200 motion-safe:ease-[cubic-bezier(0.175,0.885,0.32,1.5)]',
|
|
@@ -77,6 +81,7 @@ type ContextMenuFloatingProps = FloatingContentProps<
|
|
|
77
81
|
|
|
78
82
|
type ContextMenuContentProps = Omit<React.ComponentProps<typeof BaseContextMenu.Popup>, 'className'> &
|
|
79
83
|
ContextMenuFloatingProps & {
|
|
84
|
+
/** Extra classes on the popup. */
|
|
80
85
|
className?: string
|
|
81
86
|
}
|
|
82
87
|
|
|
@@ -92,7 +97,7 @@ function ContextMenuContent({ className, children, ...props }: ContextMenuConten
|
|
|
92
97
|
className={cn('isolate z-50', positioner.className as string | undefined)}
|
|
93
98
|
>
|
|
94
99
|
<BaseContextMenu.Popup data-slot="context-menu-content" className={popupClassName(size, className)} {...popup}>
|
|
95
|
-
<div className="flex flex-col gap-0.5 overflow-x-hidden overflow-y-auto
|
|
100
|
+
<div className="flex flex-col gap-0.5 overflow-x-hidden overflow-y-auto p-2">{children}</div>
|
|
96
101
|
</BaseContextMenu.Popup>
|
|
97
102
|
</BaseContextMenu.Positioner>
|
|
98
103
|
</BaseContextMenu.Portal>
|
|
@@ -245,6 +250,7 @@ function ContextMenuSubTrigger({ className, children, ...props }: ContextMenuSub
|
|
|
245
250
|
|
|
246
251
|
type ContextMenuSubContentProps = Omit<React.ComponentProps<typeof BaseContextMenu.Popup>, 'className'> &
|
|
247
252
|
ContextMenuFloatingProps & {
|
|
253
|
+
/** Extra classes on the submenu popup. */
|
|
248
254
|
className?: string
|
|
249
255
|
}
|
|
250
256
|
|
|
@@ -265,7 +271,7 @@ function ContextMenuSubContent({ className, children, ...props }: ContextMenuSub
|
|
|
265
271
|
className={popupClassName(size, cn('w-(--anchor-width)', className))}
|
|
266
272
|
{...popup}
|
|
267
273
|
>
|
|
268
|
-
<div className="flex flex-col gap-0.5 overflow-x-hidden overflow-y-auto
|
|
274
|
+
<div className="flex flex-col gap-0.5 overflow-x-hidden overflow-y-auto p-2">{children}</div>
|
|
269
275
|
</BaseContextMenu.Popup>
|
|
270
276
|
</BaseContextMenu.Positioner>
|
|
271
277
|
</BaseContextMenu.Portal>
|
|
@@ -6,7 +6,7 @@ import { axe } from 'vitest-axe'
|
|
|
6
6
|
import { CopyButton } from './copy-button'
|
|
7
7
|
|
|
8
8
|
// userEvent.setup() installs its own navigator.clipboard stub, so the spy
|
|
9
|
-
// must be created after setup()
|
|
9
|
+
// must be created after setup() - a beforeEach mock would get replaced.
|
|
10
10
|
function setup() {
|
|
11
11
|
const user = userEvent.setup()
|
|
12
12
|
const writeText = vi.spyOn(navigator.clipboard, 'writeText')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import * as React from 'react'
|
|
4
|
-
import { cn } from '../../utils'
|
|
4
|
+
import { cn } from '../../internal/utils'
|
|
5
5
|
import { Button, type ButtonProps } from '../button/button'
|
|
6
6
|
|
|
7
7
|
const CHECK_PATH = 'M4.3 12.55 L9.25 17.5 L19.7 6.5'
|
|
@@ -48,11 +48,26 @@ async function copyTextToClipboard(text: string): Promise<void> {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
interface CopyButtonProps extends Omit<ButtonProps, 'value' | 'onCopy'> {
|
|
51
|
+
/** **Required.** What to copy: a string, an element ref (its value/textContent), or a (possibly async) getter. */
|
|
51
52
|
value: CopyButtonValue
|
|
53
|
+
/**
|
|
54
|
+
* How long (ms) the copied state lasts before reverting.
|
|
55
|
+
* @default 2000
|
|
56
|
+
*/
|
|
52
57
|
timeout?: number
|
|
58
|
+
/**
|
|
59
|
+
* Accessible name (and tooltip via `title`) in the idle state.
|
|
60
|
+
* @default 'Copy'
|
|
61
|
+
*/
|
|
53
62
|
label?: string
|
|
63
|
+
/**
|
|
64
|
+
* Accessible name after a successful copy; a string child also swaps to this.
|
|
65
|
+
* @default 'Copied'
|
|
66
|
+
*/
|
|
54
67
|
copiedLabel?: string
|
|
68
|
+
/** Called with the copied text on success. */
|
|
55
69
|
onCopy?: (value: string) => void
|
|
70
|
+
/** Called if reading the value or writing to the clipboard fails. */
|
|
56
71
|
onCopyError?: (error: unknown) => void
|
|
57
72
|
}
|
|
58
73
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { LazyMotion, domAnimation, m } from 'motion/react'
|
|
5
5
|
import { useReducedMotion } from '../../hooks/use-reduced-motion'
|
|
6
|
-
import { cn } from '../../utils'
|
|
6
|
+
import { cn } from '../../internal/utils'
|
|
7
7
|
|
|
8
8
|
interface CountdownParts {
|
|
9
9
|
days: number
|
|
@@ -37,10 +37,18 @@ function getParts(total: number): CountdownParts {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
interface CountdownProps extends Omit<React.ComponentProps<'div'>, 'children'> {
|
|
40
|
+
/** Absolute instant to count down to (a `Date`, epoch-ms, or date string). */
|
|
40
41
|
targetDate?: Date | number | string
|
|
42
|
+
/** Relative length in **seconds** from mount. Ignored when `targetDate` is set. */
|
|
41
43
|
duration?: number
|
|
44
|
+
/**
|
|
45
|
+
* Tick interval in milliseconds.
|
|
46
|
+
* @default 1000
|
|
47
|
+
*/
|
|
42
48
|
interval?: number
|
|
49
|
+
/** Fired once when the countdown reaches zero. */
|
|
43
50
|
onComplete?: () => void
|
|
51
|
+
/** Segments and labels, or a render-prop receiving `{ days, hours, minutes, seconds, total, isComplete }`. */
|
|
44
52
|
children?: React.ReactNode | ((parts: CountdownParts) => React.ReactNode)
|
|
45
53
|
}
|
|
46
54
|
|
|
@@ -138,8 +146,14 @@ function DigitRoller({ digit, reduced }: { digit: number; reduced: boolean }) {
|
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
interface CountdownSegmentProps extends Omit<React.ComponentProps<'span'>, 'children'> {
|
|
149
|
+
/** Which unit to read from the parent `Countdown`. */
|
|
141
150
|
unit?: 'days' | 'hours' | 'minutes' | 'seconds'
|
|
151
|
+
/** Render this number directly instead of reading context (standalone display). */
|
|
142
152
|
value?: number
|
|
153
|
+
/**
|
|
154
|
+
* Minimum digit count; the value is zero-padded to this width.
|
|
155
|
+
* @default 2
|
|
156
|
+
*/
|
|
143
157
|
minDigits?: number
|
|
144
158
|
}
|
|
145
159
|
|
|
@@ -4,7 +4,7 @@ import * as React from 'react'
|
|
|
4
4
|
import { format as formatDate, formatISO, getDaysInMonth, isValid } from 'date-fns'
|
|
5
5
|
import { type VariantProps } from 'class-variance-authority'
|
|
6
6
|
import { useFieldRootContext } from '@base-ui/react/internals/field-root-context'
|
|
7
|
-
import { cn } from '../../utils'
|
|
7
|
+
import { cn } from '../../internal/utils'
|
|
8
8
|
import { useDirection } from '../../hooks/use-direction'
|
|
9
9
|
import { inputVariants } from '../input/input-variants'
|
|
10
10
|
|
|
@@ -27,19 +27,54 @@ interface LiteralNode {
|
|
|
27
27
|
type FormatNode = SegmentNode | LiteralNode
|
|
28
28
|
|
|
29
29
|
interface DateFieldProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'defaultValue' | 'onChange'> {
|
|
30
|
+
/** Controlled value. Pair with `onValueChange`. */
|
|
30
31
|
value?: Date | null
|
|
32
|
+
/** Uncontrolled initial value. */
|
|
31
33
|
defaultValue?: Date | null
|
|
34
|
+
/** Fires with a `Date` when complete, or `null` when cleared. */
|
|
32
35
|
onValueChange?: (date: Date | null) => void
|
|
36
|
+
/**
|
|
37
|
+
* date-fns token string defining the segments and separators.
|
|
38
|
+
* @default 'MM/dd/yyyy'
|
|
39
|
+
*/
|
|
33
40
|
format?: string
|
|
41
|
+
/**
|
|
42
|
+
* Field appearance - bordered or filled.
|
|
43
|
+
* @default 'outline'
|
|
44
|
+
*/
|
|
34
45
|
variant?: DateFieldVariant
|
|
46
|
+
/**
|
|
47
|
+
* Height, padding, and text scale.
|
|
48
|
+
* @default 'md'
|
|
49
|
+
*/
|
|
35
50
|
size?: DateFieldSize
|
|
51
|
+
/** Content pinned to the start edge. */
|
|
36
52
|
startSlot?: React.ReactNode
|
|
53
|
+
/** Content pinned to the end edge. */
|
|
37
54
|
endSlot?: React.ReactNode
|
|
55
|
+
/**
|
|
56
|
+
* Blocks interaction and removes the segments from the tab order.
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
38
59
|
disabled?: boolean
|
|
60
|
+
/**
|
|
61
|
+
* Segments stay focusable and readable but can't be edited.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
39
64
|
readOnly?: boolean
|
|
65
|
+
/**
|
|
66
|
+
* Marks the hidden form input as required (needs `name`).
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
40
69
|
required?: boolean
|
|
70
|
+
/** Renders a hidden `<input>` with the ISO date for form submission. */
|
|
41
71
|
name?: string
|
|
72
|
+
/**
|
|
73
|
+
* Drop the input appearance - for composing inside another field (used by `DatePicker`).
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
42
76
|
unstyled?: boolean
|
|
77
|
+
/** Ref to the underlying element. */
|
|
43
78
|
ref?: React.Ref<HTMLDivElement>
|
|
44
79
|
}
|
|
45
80
|
|
|
@@ -105,7 +105,7 @@ describe('DatePicker', () => {
|
|
|
105
105
|
await user.keyboard('09')
|
|
106
106
|
|
|
107
107
|
await user.click(screen.getByRole('button', { name: /open calendar/i }))
|
|
108
|
-
// react-day-picker labels the month caption
|
|
108
|
+
// react-day-picker labels the month caption - September should now be visible.
|
|
109
109
|
const grid = await screen.findByRole('grid')
|
|
110
110
|
expect(grid).toHaveAccessibleName(/september 2026/i)
|
|
111
111
|
})
|