@codefast/ui 0.8.0 → 0.9.1
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 +38 -0
- package/README.md +78 -39
- package/dist/components/accordion.d.ts +1 -2
- package/dist/components/accordion.js +1 -2
- package/dist/components/alert-dialog.d.ts +1 -2
- package/dist/components/alert-dialog.js +1 -2
- package/dist/components/alert.d.ts +1 -2
- package/dist/components/alert.js +1 -2
- package/dist/components/aspect-ratio.d.ts +1 -2
- package/dist/components/aspect-ratio.js +1 -2
- package/dist/components/attachment.d.ts +1 -2
- package/dist/components/attachment.js +1 -2
- package/dist/components/avatar.d.ts +1 -2
- package/dist/components/avatar.js +1 -2
- package/dist/components/badge.d.ts +1 -2
- package/dist/components/badge.js +1 -2
- package/dist/components/breadcrumb.d.ts +1 -2
- package/dist/components/breadcrumb.js +1 -2
- package/dist/components/bubble.d.ts +1 -2
- package/dist/components/bubble.js +1 -2
- package/dist/components/button-group.d.ts +1 -2
- package/dist/components/button-group.js +1 -2
- package/dist/components/button.d.ts +1 -2
- package/dist/components/button.js +1 -2
- package/dist/components/calendar.d.ts +2 -3
- package/dist/components/calendar.js +1 -2
- package/dist/components/card.d.ts +1 -2
- package/dist/components/card.js +1 -2
- package/dist/components/carousel.d.ts +1 -2
- package/dist/components/carousel.js +1 -2
- package/dist/components/chart.d.ts +1 -2
- package/dist/components/chart.js +1 -2
- package/dist/components/checkbox-cards.d.ts +1 -2
- package/dist/components/checkbox-cards.js +1 -2
- package/dist/components/checkbox-group.d.ts +1 -2
- package/dist/components/checkbox-group.js +1 -2
- package/dist/components/checkbox.d.ts +1 -2
- package/dist/components/checkbox.js +1 -2
- package/dist/components/collapsible.d.ts +1 -2
- package/dist/components/collapsible.js +1 -2
- package/dist/components/command.d.ts +1 -2
- package/dist/components/command.js +1 -2
- package/dist/components/context-menu.d.ts +2 -3
- package/dist/components/context-menu.js +3 -4
- package/dist/components/dialog.d.ts +1 -2
- package/dist/components/dialog.js +1 -2
- package/dist/components/direction.d.ts +1 -2
- package/dist/components/direction.js +1 -2
- package/dist/components/drawer.d.ts +1 -2
- package/dist/components/drawer.js +1 -2
- package/dist/components/dropdown-menu.d.ts +2 -3
- package/dist/components/dropdown-menu.js +3 -4
- package/dist/components/empty.d.ts +1 -2
- package/dist/components/empty.js +1 -2
- package/dist/components/field.d.ts +1 -2
- package/dist/components/field.js +1 -2
- package/dist/components/form.d.ts +1 -2
- package/dist/components/form.js +1 -2
- package/dist/components/hover-card.d.ts +1 -2
- package/dist/components/hover-card.js +1 -2
- package/dist/components/input-group.d.ts +1 -2
- package/dist/components/input-group.js +1 -2
- package/dist/components/input-number.d.ts +1 -2
- package/dist/components/input-number.js +1 -2
- package/dist/components/input-otp.d.ts +1 -2
- package/dist/components/input-otp.js +1 -2
- package/dist/components/input-password.d.ts +1 -2
- package/dist/components/input-password.js +1 -2
- package/dist/components/input-search.d.ts +1 -2
- package/dist/components/input-search.js +2 -3
- package/dist/components/input.d.ts +1 -2
- package/dist/components/input.js +1 -2
- package/dist/components/item.d.ts +1 -2
- package/dist/components/item.js +1 -2
- package/dist/components/kbd.d.ts +1 -2
- package/dist/components/kbd.js +1 -2
- package/dist/components/label.d.ts +1 -2
- package/dist/components/label.js +1 -2
- package/dist/components/marker.d.ts +1 -2
- package/dist/components/marker.js +1 -2
- package/dist/components/menubar.d.ts +2 -3
- package/dist/components/menubar.js +3 -4
- package/dist/components/message-scroller.d.ts +1 -2
- package/dist/components/message-scroller.js +1 -2
- package/dist/components/message.d.ts +1 -2
- package/dist/components/message.js +1 -2
- package/dist/components/native-select.d.ts +1 -2
- package/dist/components/native-select.js +1 -2
- package/dist/components/navigation-menu.d.ts +1 -2
- package/dist/components/navigation-menu.js +1 -2
- package/dist/components/pagination.d.ts +1 -2
- package/dist/components/pagination.js +1 -2
- package/dist/components/popover.d.ts +1 -2
- package/dist/components/popover.js +1 -2
- package/dist/components/progress-circle.d.ts +1 -2
- package/dist/components/progress-circle.js +1 -2
- package/dist/components/progress.d.ts +1 -2
- package/dist/components/progress.js +1 -2
- package/dist/components/radio-cards.d.ts +1 -2
- package/dist/components/radio-cards.js +1 -2
- package/dist/components/radio-group.d.ts +1 -2
- package/dist/components/radio-group.js +1 -2
- package/dist/components/radio.d.ts +1 -2
- package/dist/components/radio.js +1 -2
- package/dist/components/resizable.d.ts +1 -2
- package/dist/components/resizable.js +1 -2
- package/dist/components/scroll-area.d.ts +1 -2
- package/dist/components/scroll-area.js +2 -3
- package/dist/components/select.d.ts +1 -2
- package/dist/components/select.js +1 -2
- package/dist/components/separator.d.ts +1 -2
- package/dist/components/separator.js +2 -3
- package/dist/components/sheet.d.ts +1 -2
- package/dist/components/sheet.js +1 -2
- package/dist/components/sidebar.d.ts +1 -2
- package/dist/components/sidebar.js +1 -2
- package/dist/components/skeleton.d.ts +1 -2
- package/dist/components/skeleton.js +1 -2
- package/dist/components/slider.d.ts +1 -2
- package/dist/components/slider.js +2 -3
- package/dist/components/sonner.d.ts +1 -2
- package/dist/components/sonner.js +1 -2
- package/dist/components/spinner.d.ts +1 -2
- package/dist/components/spinner.js +1 -2
- package/dist/components/switch.d.ts +1 -2
- package/dist/components/switch.js +1 -2
- package/dist/components/table.d.ts +1 -2
- package/dist/components/table.js +1 -2
- package/dist/components/tabs.d.ts +1 -2
- package/dist/components/tabs.js +1 -2
- package/dist/components/textarea.d.ts +1 -2
- package/dist/components/textarea.js +1 -2
- package/dist/components/toggle-group.d.ts +1 -2
- package/dist/components/toggle-group.js +1 -2
- package/dist/components/toggle.d.ts +1 -2
- package/dist/components/toggle.js +1 -2
- package/dist/components/tooltip.d.ts +1 -2
- package/dist/components/tooltip.js +1 -2
- package/dist/hooks/use-animated-value.d.ts +1 -2
- package/dist/hooks/use-animated-value.js +1 -2
- package/dist/hooks/use-copy-to-clipboard.d.ts +1 -2
- package/dist/hooks/use-copy-to-clipboard.js +1 -2
- package/dist/hooks/use-has-hydrated.d.ts +1 -2
- package/dist/hooks/use-has-hydrated.js +1 -2
- package/dist/hooks/use-is-mobile.d.ts +1 -2
- package/dist/hooks/use-is-mobile.js +1 -2
- package/dist/hooks/use-latest.d.ts +1 -2
- package/dist/hooks/use-latest.js +1 -2
- package/dist/hooks/use-media-query.d.ts +1 -2
- package/dist/hooks/use-media-query.js +1 -2
- package/dist/hooks/use-message-scroller-commands.d.ts +4 -3
- package/dist/hooks/use-message-scroller-commands.js +33 -5
- package/dist/hooks/use-message-scroller-controller.d.ts +1 -2
- package/dist/hooks/use-message-scroller-controller.js +76 -13
- package/dist/hooks/use-message-scroller-refs.d.ts +3 -3
- package/dist/hooks/use-message-scroller-refs.js +5 -2
- package/dist/hooks/use-mutation-observer.d.ts +1 -2
- package/dist/hooks/use-mutation-observer.js +1 -2
- package/dist/hooks/use-pagination.d.ts +1 -2
- package/dist/hooks/use-pagination.js +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/lib/message-scroller/geometry.d.ts +3 -4
- package/dist/lib/message-scroller/geometry.js +1 -2
- package/dist/lib/message-scroller/stores.d.ts +1 -2
- package/dist/lib/message-scroller/stores.js +2 -3
- package/dist/lib/message-scroller/types.d.ts +17 -9
- package/dist/lib/message-scroller/types.js +2 -2
- package/dist/lib/use-render.d.ts +2 -3
- package/dist/lib/use-render.js +1 -2
- package/dist/lib/utils.d.ts +1 -2
- package/dist/lib/utils.js +1 -2
- package/dist/primitives/checkbox-group.d.ts +2 -3
- package/dist/primitives/checkbox-group.js +3 -4
- package/dist/primitives/input-number.d.ts +1 -2
- package/dist/primitives/input-number.js +2 -3
- package/dist/primitives/input.d.ts +1 -2
- package/dist/primitives/input.js +1 -2
- package/dist/primitives/message-scroller.d.ts +1 -2
- package/dist/primitives/message-scroller.js +17 -9
- package/dist/primitives/progress-circle.d.ts +1 -2
- package/dist/primitives/progress-circle.js +1 -2
- package/dist/variants/alert.d.ts +1 -2
- package/dist/variants/alert.js +1 -2
- package/dist/variants/attachment.d.ts +1 -2
- package/dist/variants/attachment.js +1 -2
- package/dist/variants/badge.d.ts +1 -2
- package/dist/variants/badge.js +1 -2
- package/dist/variants/bubble.d.ts +1 -2
- package/dist/variants/bubble.js +1 -2
- package/dist/variants/button-group.d.ts +1 -2
- package/dist/variants/button-group.js +1 -2
- package/dist/variants/button.d.ts +1 -2
- package/dist/variants/button.js +1 -2
- package/dist/variants/empty.d.ts +1 -2
- package/dist/variants/empty.js +1 -2
- package/dist/variants/field.d.ts +1 -2
- package/dist/variants/field.js +1 -2
- package/dist/variants/input-group.d.ts +1 -2
- package/dist/variants/input-group.js +1 -2
- package/dist/variants/item.d.ts +1 -2
- package/dist/variants/item.js +1 -2
- package/dist/variants/marker.d.ts +1 -2
- package/dist/variants/marker.js +1 -2
- package/dist/variants/navigation-menu.d.ts +1 -2
- package/dist/variants/navigation-menu.js +1 -2
- package/dist/variants/progress-circle.d.ts +1 -2
- package/dist/variants/progress-circle.js +1 -2
- package/dist/variants/scroll-area.d.ts +1 -2
- package/dist/variants/scroll-area.js +1 -2
- package/dist/variants/separator.d.ts +1 -2
- package/dist/variants/separator.js +1 -2
- package/dist/variants/sheet.d.ts +1 -2
- package/dist/variants/sheet.js +1 -2
- package/dist/variants/sidebar.d.ts +1 -2
- package/dist/variants/sidebar.js +1 -2
- package/dist/variants/tabs.d.ts +1 -2
- package/dist/variants/tabs.js +1 -2
- package/dist/variants/toggle.d.ts +1 -2
- package/dist/variants/toggle.js +1 -2
- package/package.json +12 -129
- package/dist/components/accordion.d.ts.map +0 -1
- package/dist/components/accordion.js.map +0 -1
- package/dist/components/alert-dialog.d.ts.map +0 -1
- package/dist/components/alert-dialog.js.map +0 -1
- package/dist/components/alert.d.ts.map +0 -1
- package/dist/components/alert.js.map +0 -1
- package/dist/components/aspect-ratio.d.ts.map +0 -1
- package/dist/components/aspect-ratio.js.map +0 -1
- package/dist/components/attachment.d.ts.map +0 -1
- package/dist/components/attachment.js.map +0 -1
- package/dist/components/avatar.d.ts.map +0 -1
- package/dist/components/avatar.js.map +0 -1
- package/dist/components/badge.d.ts.map +0 -1
- package/dist/components/badge.js.map +0 -1
- package/dist/components/breadcrumb.d.ts.map +0 -1
- package/dist/components/breadcrumb.js.map +0 -1
- package/dist/components/bubble.d.ts.map +0 -1
- package/dist/components/bubble.js.map +0 -1
- package/dist/components/button-group.d.ts.map +0 -1
- package/dist/components/button-group.js.map +0 -1
- package/dist/components/button.d.ts.map +0 -1
- package/dist/components/button.js.map +0 -1
- package/dist/components/calendar.d.ts.map +0 -1
- package/dist/components/calendar.js.map +0 -1
- package/dist/components/card.d.ts.map +0 -1
- package/dist/components/card.js.map +0 -1
- package/dist/components/carousel.d.ts.map +0 -1
- package/dist/components/carousel.js.map +0 -1
- package/dist/components/chart.d.ts.map +0 -1
- package/dist/components/chart.js.map +0 -1
- package/dist/components/checkbox-cards.d.ts.map +0 -1
- package/dist/components/checkbox-cards.js.map +0 -1
- package/dist/components/checkbox-group.d.ts.map +0 -1
- package/dist/components/checkbox-group.js.map +0 -1
- package/dist/components/checkbox.d.ts.map +0 -1
- package/dist/components/checkbox.js.map +0 -1
- package/dist/components/collapsible.d.ts.map +0 -1
- package/dist/components/collapsible.js.map +0 -1
- package/dist/components/command.d.ts.map +0 -1
- package/dist/components/command.js.map +0 -1
- package/dist/components/context-menu.d.ts.map +0 -1
- package/dist/components/context-menu.js.map +0 -1
- package/dist/components/dialog.d.ts.map +0 -1
- package/dist/components/dialog.js.map +0 -1
- package/dist/components/direction.d.ts.map +0 -1
- package/dist/components/direction.js.map +0 -1
- package/dist/components/drawer.d.ts.map +0 -1
- package/dist/components/drawer.js.map +0 -1
- package/dist/components/dropdown-menu.d.ts.map +0 -1
- package/dist/components/dropdown-menu.js.map +0 -1
- package/dist/components/empty.d.ts.map +0 -1
- package/dist/components/empty.js.map +0 -1
- package/dist/components/field.d.ts.map +0 -1
- package/dist/components/field.js.map +0 -1
- package/dist/components/form.d.ts.map +0 -1
- package/dist/components/form.js.map +0 -1
- package/dist/components/hover-card.d.ts.map +0 -1
- package/dist/components/hover-card.js.map +0 -1
- package/dist/components/input-group.d.ts.map +0 -1
- package/dist/components/input-group.js.map +0 -1
- package/dist/components/input-number.d.ts.map +0 -1
- package/dist/components/input-number.js.map +0 -1
- package/dist/components/input-otp.d.ts.map +0 -1
- package/dist/components/input-otp.js.map +0 -1
- package/dist/components/input-password.d.ts.map +0 -1
- package/dist/components/input-password.js.map +0 -1
- package/dist/components/input-search.d.ts.map +0 -1
- package/dist/components/input-search.js.map +0 -1
- package/dist/components/input.d.ts.map +0 -1
- package/dist/components/input.js.map +0 -1
- package/dist/components/item.d.ts.map +0 -1
- package/dist/components/item.js.map +0 -1
- package/dist/components/kbd.d.ts.map +0 -1
- package/dist/components/kbd.js.map +0 -1
- package/dist/components/label.d.ts.map +0 -1
- package/dist/components/label.js.map +0 -1
- package/dist/components/marker.d.ts.map +0 -1
- package/dist/components/marker.js.map +0 -1
- package/dist/components/menubar.d.ts.map +0 -1
- package/dist/components/menubar.js.map +0 -1
- package/dist/components/message-scroller.d.ts.map +0 -1
- package/dist/components/message-scroller.js.map +0 -1
- package/dist/components/message.d.ts.map +0 -1
- package/dist/components/message.js.map +0 -1
- package/dist/components/native-select.d.ts.map +0 -1
- package/dist/components/native-select.js.map +0 -1
- package/dist/components/navigation-menu.d.ts.map +0 -1
- package/dist/components/navigation-menu.js.map +0 -1
- package/dist/components/pagination.d.ts.map +0 -1
- package/dist/components/pagination.js.map +0 -1
- package/dist/components/popover.d.ts.map +0 -1
- package/dist/components/popover.js.map +0 -1
- package/dist/components/progress-circle.d.ts.map +0 -1
- package/dist/components/progress-circle.js.map +0 -1
- package/dist/components/progress.d.ts.map +0 -1
- package/dist/components/progress.js.map +0 -1
- package/dist/components/radio-cards.d.ts.map +0 -1
- package/dist/components/radio-cards.js.map +0 -1
- package/dist/components/radio-group.d.ts.map +0 -1
- package/dist/components/radio-group.js.map +0 -1
- package/dist/components/radio.d.ts.map +0 -1
- package/dist/components/radio.js.map +0 -1
- package/dist/components/resizable.d.ts.map +0 -1
- package/dist/components/resizable.js.map +0 -1
- package/dist/components/scroll-area.d.ts.map +0 -1
- package/dist/components/scroll-area.js.map +0 -1
- package/dist/components/select.d.ts.map +0 -1
- package/dist/components/select.js.map +0 -1
- package/dist/components/separator.d.ts.map +0 -1
- package/dist/components/separator.js.map +0 -1
- package/dist/components/sheet.d.ts.map +0 -1
- package/dist/components/sheet.js.map +0 -1
- package/dist/components/sidebar.d.ts.map +0 -1
- package/dist/components/sidebar.js.map +0 -1
- package/dist/components/skeleton.d.ts.map +0 -1
- package/dist/components/skeleton.js.map +0 -1
- package/dist/components/slider.d.ts.map +0 -1
- package/dist/components/slider.js.map +0 -1
- package/dist/components/sonner.d.ts.map +0 -1
- package/dist/components/sonner.js.map +0 -1
- package/dist/components/spinner.d.ts.map +0 -1
- package/dist/components/spinner.js.map +0 -1
- package/dist/components/switch.d.ts.map +0 -1
- package/dist/components/switch.js.map +0 -1
- package/dist/components/table.d.ts.map +0 -1
- package/dist/components/table.js.map +0 -1
- package/dist/components/tabs.d.ts.map +0 -1
- package/dist/components/tabs.js.map +0 -1
- package/dist/components/textarea.d.ts.map +0 -1
- package/dist/components/textarea.js.map +0 -1
- package/dist/components/toggle-group.d.ts.map +0 -1
- package/dist/components/toggle-group.js.map +0 -1
- package/dist/components/toggle.d.ts.map +0 -1
- package/dist/components/toggle.js.map +0 -1
- package/dist/components/tooltip.d.ts.map +0 -1
- package/dist/components/tooltip.js.map +0 -1
- package/dist/hooks/use-animated-value.d.ts.map +0 -1
- package/dist/hooks/use-animated-value.js.map +0 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +0 -1
- package/dist/hooks/use-copy-to-clipboard.js.map +0 -1
- package/dist/hooks/use-has-hydrated.d.ts.map +0 -1
- package/dist/hooks/use-has-hydrated.js.map +0 -1
- package/dist/hooks/use-is-mobile.d.ts.map +0 -1
- package/dist/hooks/use-is-mobile.js.map +0 -1
- package/dist/hooks/use-latest.d.ts.map +0 -1
- package/dist/hooks/use-latest.js.map +0 -1
- package/dist/hooks/use-media-query.d.ts.map +0 -1
- package/dist/hooks/use-media-query.js.map +0 -1
- package/dist/hooks/use-message-scroller-commands.d.ts.map +0 -1
- package/dist/hooks/use-message-scroller-commands.js.map +0 -1
- package/dist/hooks/use-message-scroller-controller.d.ts.map +0 -1
- package/dist/hooks/use-message-scroller-controller.js.map +0 -1
- package/dist/hooks/use-message-scroller-refs.d.ts.map +0 -1
- package/dist/hooks/use-message-scroller-refs.js.map +0 -1
- package/dist/hooks/use-mutation-observer.d.ts.map +0 -1
- package/dist/hooks/use-mutation-observer.js.map +0 -1
- package/dist/hooks/use-pagination.d.ts.map +0 -1
- package/dist/hooks/use-pagination.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/message-scroller/geometry.d.ts.map +0 -1
- package/dist/lib/message-scroller/geometry.js.map +0 -1
- package/dist/lib/message-scroller/stores.d.ts.map +0 -1
- package/dist/lib/message-scroller/stores.js.map +0 -1
- package/dist/lib/message-scroller/types.d.ts.map +0 -1
- package/dist/lib/message-scroller/types.js.map +0 -1
- package/dist/lib/use-render.d.ts.map +0 -1
- package/dist/lib/use-render.js.map +0 -1
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js.map +0 -1
- package/dist/primitives/checkbox-group.d.ts.map +0 -1
- package/dist/primitives/checkbox-group.js.map +0 -1
- package/dist/primitives/input-number.d.ts.map +0 -1
- package/dist/primitives/input-number.js.map +0 -1
- package/dist/primitives/input.d.ts.map +0 -1
- package/dist/primitives/input.js.map +0 -1
- package/dist/primitives/message-scroller.d.ts.map +0 -1
- package/dist/primitives/message-scroller.js.map +0 -1
- package/dist/primitives/progress-circle.d.ts.map +0 -1
- package/dist/primitives/progress-circle.js.map +0 -1
- package/dist/variants/alert.d.ts.map +0 -1
- package/dist/variants/alert.js.map +0 -1
- package/dist/variants/attachment.d.ts.map +0 -1
- package/dist/variants/attachment.js.map +0 -1
- package/dist/variants/badge.d.ts.map +0 -1
- package/dist/variants/badge.js.map +0 -1
- package/dist/variants/bubble.d.ts.map +0 -1
- package/dist/variants/bubble.js.map +0 -1
- package/dist/variants/button-group.d.ts.map +0 -1
- package/dist/variants/button-group.js.map +0 -1
- package/dist/variants/button.d.ts.map +0 -1
- package/dist/variants/button.js.map +0 -1
- package/dist/variants/empty.d.ts.map +0 -1
- package/dist/variants/empty.js.map +0 -1
- package/dist/variants/field.d.ts.map +0 -1
- package/dist/variants/field.js.map +0 -1
- package/dist/variants/input-group.d.ts.map +0 -1
- package/dist/variants/input-group.js.map +0 -1
- package/dist/variants/item.d.ts.map +0 -1
- package/dist/variants/item.js.map +0 -1
- package/dist/variants/marker.d.ts.map +0 -1
- package/dist/variants/marker.js.map +0 -1
- package/dist/variants/navigation-menu.d.ts.map +0 -1
- package/dist/variants/navigation-menu.js.map +0 -1
- package/dist/variants/progress-circle.d.ts.map +0 -1
- package/dist/variants/progress-circle.js.map +0 -1
- package/dist/variants/scroll-area.d.ts.map +0 -1
- package/dist/variants/scroll-area.js.map +0 -1
- package/dist/variants/separator.d.ts.map +0 -1
- package/dist/variants/separator.js.map +0 -1
- package/dist/variants/sheet.d.ts.map +0 -1
- package/dist/variants/sheet.js.map +0 -1
- package/dist/variants/sidebar.d.ts.map +0 -1
- package/dist/variants/sidebar.js.map +0 -1
- package/dist/variants/tabs.d.ts.map +0 -1
- package/dist/variants/tabs.js.map +0 -1
- package/dist/variants/toggle.d.ts.map +0 -1
- package/dist/variants/toggle.js.map +0 -1
- package/src/components/accordion.tsx +0 -104
- package/src/components/alert-dialog.tsx +0 -274
- package/src/components/alert.tsx +0 -84
- package/src/components/aspect-ratio.tsx +0 -21
- package/src/components/attachment.tsx +0 -264
- package/src/components/avatar.tsx +0 -157
- package/src/components/badge.tsx +0 -31
- package/src/components/breadcrumb.tsx +0 -170
- package/src/components/bubble.tsx +0 -106
- package/src/components/button-group.tsx +0 -89
- package/src/components/button.tsx +0 -51
- package/src/components/calendar.tsx +0 -210
- package/src/components/card.tsx +0 -153
- package/src/components/carousel.tsx +0 -344
- package/src/components/chart.tsx +0 -514
- package/src/components/checkbox-cards.tsx +0 -67
- package/src/components/checkbox-group.tsx +0 -55
- package/src/components/checkbox.tsx +0 -41
- package/src/components/collapsible.tsx +0 -49
- package/src/components/command.tsx +0 -276
- package/src/components/context-menu.tsx +0 -378
- package/src/components/dialog.tsx +0 -226
- package/src/components/direction.tsx +0 -28
- package/src/components/drawer.tsx +0 -191
- package/src/components/dropdown-menu.tsx +0 -387
- package/src/components/empty.tsx +0 -141
- package/src/components/field.tsx +0 -307
- package/src/components/form.tsx +0 -238
- package/src/components/hover-card.tsx +0 -83
- package/src/components/input-group.tsx +0 -171
- package/src/components/input-number.tsx +0 -191
- package/src/components/input-otp.tsx +0 -122
- package/src/components/input-password.tsx +0 -46
- package/src/components/input-search.tsx +0 -77
- package/src/components/input.tsx +0 -32
- package/src/components/item.tsx +0 -244
- package/src/components/kbd.tsx +0 -43
- package/src/components/label.tsx +0 -32
- package/src/components/marker.tsx +0 -86
- package/src/components/menubar.tsx +0 -406
- package/src/components/message-scroller.tsx +0 -199
- package/src/components/message.tsx +0 -159
- package/src/components/native-select.tsx +0 -79
- package/src/components/navigation-menu.tsx +0 -217
- package/src/components/pagination.tsx +0 -182
- package/src/components/popover.tsx +0 -152
- package/src/components/progress-circle.tsx +0 -179
- package/src/components/progress.tsx +0 -37
- package/src/components/radio-cards.tsx +0 -60
- package/src/components/radio-group.tsx +0 -55
- package/src/components/radio.tsx +0 -36
- package/src/components/resizable.tsx +0 -70
- package/src/components/scroll-area.tsx +0 -87
- package/src/components/select.tsx +0 -274
- package/src/components/separator.tsx +0 -54
- package/src/components/sheet.tsx +0 -221
- package/src/components/sidebar.tsx +0 -891
- package/src/components/skeleton.tsx +0 -31
- package/src/components/slider.tsx +0 -62
- package/src/components/sonner.tsx +0 -53
- package/src/components/spinner.tsx +0 -62
- package/src/components/switch.tsx +0 -40
- package/src/components/table.tsx +0 -165
- package/src/components/tabs.tsx +0 -100
- package/src/components/textarea.tsx +0 -31
- package/src/components/toggle-group.tsx +0 -129
- package/src/components/toggle.tsx +0 -26
- package/src/components/tooltip.tsx +0 -103
- package/src/css/foundation/base.css +0 -68
- package/src/css/foundation/motion.css +0 -65
- package/src/css/foundation/source.css +0 -10
- package/src/css/foundation/tokens.css +0 -83
- package/src/css/foundation/utilities.css +0 -451
- package/src/css/foundation/variants.css +0 -108
- package/src/css/preset.css +0 -14
- package/src/css/style.css +0 -11
- package/src/css/themes/amber.css +0 -105
- package/src/css/themes/blue.css +0 -105
- package/src/css/themes/cyan.css +0 -105
- package/src/css/themes/emerald.css +0 -105
- package/src/css/themes/fuchsia.css +0 -105
- package/src/css/themes/gray.css +0 -105
- package/src/css/themes/green.css +0 -105
- package/src/css/themes/indigo.css +0 -105
- package/src/css/themes/lime.css +0 -105
- package/src/css/themes/neutral.css +0 -105
- package/src/css/themes/orange.css +0 -105
- package/src/css/themes/pink.css +0 -105
- package/src/css/themes/purple.css +0 -105
- package/src/css/themes/red.css +0 -105
- package/src/css/themes/rose.css +0 -105
- package/src/css/themes/sky.css +0 -105
- package/src/css/themes/slate.css +0 -105
- package/src/css/themes/stone.css +0 -105
- package/src/css/themes/teal.css +0 -105
- package/src/css/themes/violet.css +0 -105
- package/src/css/themes/yellow.css +0 -105
- package/src/css/themes/zinc.css +0 -105
- package/src/hooks/use-animated-value.ts +0 -95
- package/src/hooks/use-copy-to-clipboard.ts +0 -58
- package/src/hooks/use-has-hydrated.ts +0 -22
- package/src/hooks/use-is-mobile.ts +0 -25
- package/src/hooks/use-latest.ts +0 -23
- package/src/hooks/use-media-query.ts +0 -69
- package/src/hooks/use-message-scroller-commands.ts +0 -312
- package/src/hooks/use-message-scroller-controller.ts +0 -651
- package/src/hooks/use-message-scroller-refs.ts +0 -158
- package/src/hooks/use-mutation-observer.ts +0 -51
- package/src/hooks/use-pagination.ts +0 -166
- package/src/index.ts +0 -751
- package/src/lib/message-scroller/geometry.ts +0 -401
- package/src/lib/message-scroller/stores.ts +0 -88
- package/src/lib/message-scroller/types.ts +0 -336
- package/src/lib/use-render.ts +0 -201
- package/src/lib/utils.ts +0 -5
- package/src/primitives/checkbox-group.tsx +0 -335
- package/src/primitives/input-number.tsx +0 -1030
- package/src/primitives/input.tsx +0 -221
- package/src/primitives/message-scroller.tsx +0 -404
- package/src/primitives/progress-circle.tsx +0 -489
- package/src/variants/alert.ts +0 -30
- package/src/variants/attachment.ts +0 -67
- package/src/variants/badge.ts +0 -35
- package/src/variants/bubble.ts +0 -75
- package/src/variants/button-group.ts +0 -32
- package/src/variants/button.ts +0 -51
- package/src/variants/empty.ts +0 -30
- package/src/variants/field.ts +0 -33
- package/src/variants/input-group.ts +0 -72
- package/src/variants/item.ts +0 -62
- package/src/variants/marker.ts +0 -34
- package/src/variants/navigation-menu.ts +0 -21
- package/src/variants/progress-circle.ts +0 -42
- package/src/variants/scroll-area.ts +0 -69
- package/src/variants/separator.ts +0 -36
- package/src/variants/sheet.ts +0 -33
- package/src/variants/sidebar.ts +0 -37
- package/src/variants/tabs.ts +0 -30
- package/src/variants/toggle.ts +0 -36
package/src/components/chart.tsx
DELETED
|
@@ -1,514 +0,0 @@
|
|
|
1
|
-
import { Context } from "radix-ui/internal";
|
|
2
|
-
import type { ComponentProps, ComponentType, CSSProperties, JSX, ReactNode } from "react";
|
|
3
|
-
import { useId, useMemo } from "react";
|
|
4
|
-
import type { TooltipContentProps, TooltipProps } from "recharts";
|
|
5
|
-
import * as RechartsPrimitive from "recharts";
|
|
6
|
-
import type { NameType, Payload, ValueType } from "recharts/types/component/DefaultTooltipContent";
|
|
7
|
-
|
|
8
|
-
import { cn } from "#/lib/utils";
|
|
9
|
-
|
|
10
|
-
// ── Type Definitions and Utilities ───────────────────────────────────────────────────────────────────────────────────
|
|
11
|
-
|
|
12
|
-
type ExtractProps<T> = T extends (props: infer P) => ReactNode ? P : never;
|
|
13
|
-
|
|
14
|
-
type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
15
|
-
|
|
16
|
-
// ── Chart Configuration and Theme Constants ──────────────────────────────────────────────────────────────────────────
|
|
17
|
-
|
|
18
|
-
const THEMES = { dark: ".dark", light: "" } as const;
|
|
19
|
-
|
|
20
|
-
const INITIAL_DIMENSION = { height: 200, width: 320 } as const;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @since 0.3.16-canary.0
|
|
24
|
-
*/
|
|
25
|
-
type ChartConfig = Record<
|
|
26
|
-
string,
|
|
27
|
-
{
|
|
28
|
-
label?: ReactNode;
|
|
29
|
-
icon?: ComponentType;
|
|
30
|
-
} & ({ color?: never; theme: Record<keyof typeof THEMES, string> } | { color?: string; theme?: never })
|
|
31
|
-
>;
|
|
32
|
-
|
|
33
|
-
// ── Context: ChartProvider ───────────────────────────────────────────────────────────────────────────────────────────
|
|
34
|
-
|
|
35
|
-
const CHART_PROVIDER_NAME = "ChartProvider";
|
|
36
|
-
|
|
37
|
-
type ScopedProps<P> = P & { __scopeChart?: Context.Scope };
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Value provided by Chart Context
|
|
41
|
-
*/
|
|
42
|
-
interface ChartContextValue {
|
|
43
|
-
/**
|
|
44
|
-
* Display configuration for the chart
|
|
45
|
-
*/
|
|
46
|
-
config: ChartConfig;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const [createChartContext, createChartScope] = Context.createContextScope(CHART_PROVIDER_NAME);
|
|
50
|
-
|
|
51
|
-
const [ChartContextProvider, useChartContext] = createChartContext<ChartContextValue>(CHART_PROVIDER_NAME);
|
|
52
|
-
|
|
53
|
-
// ── Component: Chart ─────────────────────────────────────────────────────────────────────────────────────────────────
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @since 0.3.16-canary.0
|
|
57
|
-
*/
|
|
58
|
-
interface ChartContainerProps extends ComponentProps<"div"> {
|
|
59
|
-
children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
60
|
-
config: ChartConfig;
|
|
61
|
-
initialDimension?: {
|
|
62
|
-
height: number;
|
|
63
|
-
width: number;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @since 0.3.16-canary.0
|
|
69
|
-
*/
|
|
70
|
-
function ChartContainer({
|
|
71
|
-
__scopeChart,
|
|
72
|
-
children,
|
|
73
|
-
className,
|
|
74
|
-
config,
|
|
75
|
-
id,
|
|
76
|
-
initialDimension = INITIAL_DIMENSION,
|
|
77
|
-
...props
|
|
78
|
-
}: ScopedProps<ChartContainerProps>): JSX.Element {
|
|
79
|
-
const uniqueId = useId();
|
|
80
|
-
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<ChartContextProvider config={config} scope={__scopeChart}>
|
|
84
|
-
<div
|
|
85
|
-
className={cn(
|
|
86
|
-
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
|
|
87
|
-
className,
|
|
88
|
-
)}
|
|
89
|
-
data-chart={chartId}
|
|
90
|
-
data-slot="chart"
|
|
91
|
-
{...props}
|
|
92
|
-
>
|
|
93
|
-
<ChartStyle config={config} id={chartId} />
|
|
94
|
-
<RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>
|
|
95
|
-
{children}
|
|
96
|
-
</RechartsPrimitive.ResponsiveContainer>
|
|
97
|
-
</div>
|
|
98
|
-
</ChartContextProvider>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// ── Component: ChartStyle ────────────────────────────────────────────────────────────────────────────────────────────
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @since 0.3.16-canary.0
|
|
106
|
-
*/
|
|
107
|
-
interface ChartStyleProps {
|
|
108
|
-
config: ChartConfig;
|
|
109
|
-
id: string;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @since 0.3.16-canary.0
|
|
114
|
-
*/
|
|
115
|
-
function ChartStyle({ config, id }: ChartStyleProps): ReactNode {
|
|
116
|
-
const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme ?? itemConfig.color);
|
|
117
|
-
|
|
118
|
-
if (colorConfig.length === 0) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<style
|
|
124
|
-
dangerouslySetInnerHTML={{
|
|
125
|
-
__html: generateChartStyles(id, colorConfig),
|
|
126
|
-
}}
|
|
127
|
-
/>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// ── Component: ChartTooltip ──────────────────────────────────────────────────────────────────────────────────────────
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @since 0.3.16-canary.0
|
|
135
|
-
*/
|
|
136
|
-
type ChartTooltipProps<TValue extends ValueType, TName extends NameType> = TooltipProps<TValue, TName>;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* @since 0.3.16-canary.0
|
|
140
|
-
*/
|
|
141
|
-
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
142
|
-
|
|
143
|
-
// ── Component: ChartTooltipContent ───────────────────────────────────────────────────────────────────────────────────
|
|
144
|
-
|
|
145
|
-
const CHART_TOOLTIP_CONTENT_NAME = "ChartTooltipContent";
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @since 0.3.16-canary.0
|
|
149
|
-
*/
|
|
150
|
-
type ChartTooltipContentProps<TValue extends ValueType, TName extends NameType> = Omit<
|
|
151
|
-
MakeOptional<
|
|
152
|
-
TooltipContentProps<TValue, TName>,
|
|
153
|
-
"accessibilityLayer" | "active" | "activeIndex" | "coordinate" | "payload"
|
|
154
|
-
>,
|
|
155
|
-
"payload"
|
|
156
|
-
> & {
|
|
157
|
-
hideIndicator?: boolean;
|
|
158
|
-
hideLabel?: boolean;
|
|
159
|
-
indicator?: "dashed" | "dot" | "line";
|
|
160
|
-
labelKey?: string;
|
|
161
|
-
nameKey?: string;
|
|
162
|
-
color?: string | undefined;
|
|
163
|
-
className?: string | undefined;
|
|
164
|
-
payload?: Array<Payload<TValue, TName>>;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* @since 0.3.16-canary.0
|
|
169
|
-
*/
|
|
170
|
-
function ChartTooltipContent<TValue extends ValueType, TName extends NameType>({
|
|
171
|
-
__scopeChart,
|
|
172
|
-
active,
|
|
173
|
-
className,
|
|
174
|
-
color,
|
|
175
|
-
formatter,
|
|
176
|
-
hideIndicator = false,
|
|
177
|
-
hideLabel = false,
|
|
178
|
-
indicator = "dot",
|
|
179
|
-
label,
|
|
180
|
-
labelClassName,
|
|
181
|
-
labelFormatter,
|
|
182
|
-
labelKey,
|
|
183
|
-
nameKey,
|
|
184
|
-
payload = [],
|
|
185
|
-
}: ScopedProps<ChartTooltipContentProps<TValue, TName>>): ReactNode {
|
|
186
|
-
const { config } = useChartContext(CHART_TOOLTIP_CONTENT_NAME, __scopeChart);
|
|
187
|
-
|
|
188
|
-
const tooltipLabel = useMemo((): ReactNode => {
|
|
189
|
-
if (hideLabel || payload.length === 0) {
|
|
190
|
-
return null;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const item = payload[0];
|
|
194
|
-
if (item === undefined) {
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
const key = safeToString(labelKey ?? item.dataKey ?? item.name ?? "value");
|
|
198
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
199
|
-
const configEntry = typeof label === "string" && label in config ? config[label] : undefined;
|
|
200
|
-
const value =
|
|
201
|
-
!labelKey && typeof label === "string"
|
|
202
|
-
? configEntry !== undefined
|
|
203
|
-
? (configEntry.label ?? label)
|
|
204
|
-
: label
|
|
205
|
-
: itemConfig?.label;
|
|
206
|
-
|
|
207
|
-
if (labelFormatter) {
|
|
208
|
-
return <div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (!value) {
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return <div className={cn("font-medium", labelClassName)}>{value}</div>;
|
|
216
|
-
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
217
|
-
|
|
218
|
-
if (!active || payload.length === 0) {
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
223
|
-
|
|
224
|
-
return (
|
|
225
|
-
<div
|
|
226
|
-
className={cn(
|
|
227
|
-
"grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
|
228
|
-
className,
|
|
229
|
-
)}
|
|
230
|
-
>
|
|
231
|
-
{nestLabel ? null : tooltipLabel}
|
|
232
|
-
<div className="grid gap-1.5">
|
|
233
|
-
{payload.map((item, index) => {
|
|
234
|
-
const key = safeToString(nameKey ?? item.name ?? item.dataKey ?? "value");
|
|
235
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
236
|
-
const indicatorColor =
|
|
237
|
-
color ??
|
|
238
|
-
(isRecord(item.payload) && "fill" in item.payload && typeof item.payload.fill === "string"
|
|
239
|
-
? item.payload.fill
|
|
240
|
-
: undefined) ??
|
|
241
|
-
item.color;
|
|
242
|
-
|
|
243
|
-
return (
|
|
244
|
-
<div
|
|
245
|
-
key={key}
|
|
246
|
-
className={cn(
|
|
247
|
-
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
|
248
|
-
indicator === "dot" && "items-center",
|
|
249
|
-
)}
|
|
250
|
-
>
|
|
251
|
-
{formatter && item.value !== undefined && item.name ? (
|
|
252
|
-
formatter(item.value, item.name, item, index, [item])
|
|
253
|
-
) : (
|
|
254
|
-
<>
|
|
255
|
-
{itemConfig?.icon ? (
|
|
256
|
-
<itemConfig.icon />
|
|
257
|
-
) : (
|
|
258
|
-
!hideIndicator && (
|
|
259
|
-
<div
|
|
260
|
-
className={cn("shrink-0 rounded-xs border-(--color-border) bg-(--color-bg)", {
|
|
261
|
-
"h-2.5 w-2.5": indicator === "dot",
|
|
262
|
-
"my-0.5": nestLabel && indicator === "dashed",
|
|
263
|
-
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
264
|
-
"w-1": indicator === "line",
|
|
265
|
-
})}
|
|
266
|
-
style={
|
|
267
|
-
{
|
|
268
|
-
"--color-bg": indicatorColor,
|
|
269
|
-
"--color-border": indicatorColor,
|
|
270
|
-
} as CSSProperties
|
|
271
|
-
}
|
|
272
|
-
/>
|
|
273
|
-
)
|
|
274
|
-
)}
|
|
275
|
-
<div
|
|
276
|
-
className={cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center")}
|
|
277
|
-
>
|
|
278
|
-
<div className="grid gap-1.5">
|
|
279
|
-
{nestLabel ? tooltipLabel : null}
|
|
280
|
-
<span className="text-muted-foreground">{itemConfig?.label ?? item.name}</span>
|
|
281
|
-
</div>
|
|
282
|
-
{item.value != null && (
|
|
283
|
-
<span className="font-mono font-medium text-foreground tabular-nums">
|
|
284
|
-
{typeof item.value === "number" ? item.value.toLocaleString() : safeToString(item.value)}
|
|
285
|
-
</span>
|
|
286
|
-
)}
|
|
287
|
-
</div>
|
|
288
|
-
</>
|
|
289
|
-
)}
|
|
290
|
-
</div>
|
|
291
|
-
);
|
|
292
|
-
})}
|
|
293
|
-
</div>
|
|
294
|
-
</div>
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// ── Component: ChartLegend ───────────────────────────────────────────────────────────────────────────────────────────
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* @since 0.3.16-canary.0
|
|
302
|
-
*/
|
|
303
|
-
type ChartLegendProps = ComponentProps<typeof RechartsPrimitive.Legend>;
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* @since 0.3.16-canary.0
|
|
307
|
-
*/
|
|
308
|
-
const ChartLegend: typeof RechartsPrimitive.Legend = RechartsPrimitive.Legend;
|
|
309
|
-
|
|
310
|
-
// ── Component: ChartLegendContent ────────────────────────────────────────────────────────────────────────────────────
|
|
311
|
-
|
|
312
|
-
const CHART_LEGEND_CONTENT_NAME = "ChartLegendContent";
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* @since 0.3.16-canary.0
|
|
316
|
-
*/
|
|
317
|
-
type ChartLegendContentProps = ComponentProps<"div"> &
|
|
318
|
-
ExtractProps<RechartsPrimitive.LegendProps["content"]> & {
|
|
319
|
-
hideIcon?: boolean;
|
|
320
|
-
nameKey?: string;
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* @since 0.3.16-canary.0
|
|
325
|
-
*/
|
|
326
|
-
function ChartLegendContent({
|
|
327
|
-
__scopeChart,
|
|
328
|
-
className,
|
|
329
|
-
hideIcon = false,
|
|
330
|
-
nameKey,
|
|
331
|
-
payload,
|
|
332
|
-
verticalAlign = "bottom",
|
|
333
|
-
}: ScopedProps<ChartLegendContentProps>): ReactNode {
|
|
334
|
-
const { config } = useChartContext(CHART_LEGEND_CONTENT_NAME, __scopeChart);
|
|
335
|
-
|
|
336
|
-
if (!payload?.length) {
|
|
337
|
-
return null;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
return (
|
|
341
|
-
<div className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}>
|
|
342
|
-
{payload.map((item) => {
|
|
343
|
-
let key = "value";
|
|
344
|
-
|
|
345
|
-
if (nameKey) {
|
|
346
|
-
key = nameKey;
|
|
347
|
-
} else if (item.dataKey != null) {
|
|
348
|
-
key = safeToString(item.dataKey);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
352
|
-
|
|
353
|
-
return (
|
|
354
|
-
<div
|
|
355
|
-
key={nameKey ? safeToString(itemConfig?.color ?? "") : safeToString(item.value ?? "")}
|
|
356
|
-
className="flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
|
|
357
|
-
>
|
|
358
|
-
{itemConfig?.icon && !hideIcon ? (
|
|
359
|
-
<itemConfig.icon />
|
|
360
|
-
) : (
|
|
361
|
-
<div
|
|
362
|
-
className="h-2 w-2 shrink-0 rounded-xs"
|
|
363
|
-
style={{
|
|
364
|
-
backgroundColor: item.color,
|
|
365
|
-
}}
|
|
366
|
-
/>
|
|
367
|
-
)}
|
|
368
|
-
{itemConfig?.label}
|
|
369
|
-
</div>
|
|
370
|
-
);
|
|
371
|
-
})}
|
|
372
|
-
</div>
|
|
373
|
-
);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// ── Helpers ──────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* Type guard to check if an unknown value is a record with string keys
|
|
380
|
-
*/
|
|
381
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
382
|
-
return typeof value === "object" && value !== null;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Safely gets a string value from a record by key
|
|
387
|
-
*/
|
|
388
|
-
function getStringValue(record: Record<string, unknown>, key: string): string | undefined {
|
|
389
|
-
if (key in record) {
|
|
390
|
-
const value = record[key];
|
|
391
|
-
|
|
392
|
-
return typeof value === "string" ? value : undefined;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
return undefined;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Safely converts a value to string without type coercion
|
|
400
|
-
*/
|
|
401
|
-
function safeToString(value: unknown): string {
|
|
402
|
-
if (typeof value === "string") {
|
|
403
|
-
return value;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if (typeof value === "number") {
|
|
407
|
-
return value.toString();
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
if (value === null || value === undefined) {
|
|
411
|
-
return "";
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
if (typeof value === "boolean") {
|
|
415
|
-
return value.toString();
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
if (typeof value === "bigint") {
|
|
419
|
-
return value.toString();
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
if (typeof value === "symbol") {
|
|
423
|
-
return value.toString();
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// For objects, arrays, functions, and other complex types, return empty string to avoid [object Object]
|
|
427
|
-
return "";
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
function getPayloadConfigFromPayload(
|
|
431
|
-
config: ChartConfig,
|
|
432
|
-
payload: unknown,
|
|
433
|
-
key: string,
|
|
434
|
-
): ChartConfig[string] | undefined {
|
|
435
|
-
if (!isRecord(payload)) {
|
|
436
|
-
return undefined;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
const payloadPayload = isRecord(payload.payload) ? payload.payload : undefined;
|
|
440
|
-
let configLabelKey: string = key;
|
|
441
|
-
|
|
442
|
-
// Try to get the config key from the payload first
|
|
443
|
-
const payloadValue = getStringValue(payload, key);
|
|
444
|
-
|
|
445
|
-
if (payloadValue) {
|
|
446
|
-
configLabelKey = payloadValue;
|
|
447
|
-
} else if (payloadPayload) {
|
|
448
|
-
// If not found in the payload, try the nested payload
|
|
449
|
-
const nestedValue = getStringValue(payloadPayload, key);
|
|
450
|
-
|
|
451
|
-
if (nestedValue) {
|
|
452
|
-
configLabelKey = nestedValue;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Generates CSS custom property for a specific theme and config item
|
|
461
|
-
*/
|
|
462
|
-
function generateCssVariable(key: string, itemConfig: ChartConfig[string], theme: string): null | string {
|
|
463
|
-
const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ?? itemConfig.color;
|
|
464
|
-
|
|
465
|
-
return color ? ` --color-${key}: ${color};` : null;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* Generates CSS rules for a specific theme
|
|
470
|
-
*/
|
|
471
|
-
function generateThemeStyles(
|
|
472
|
-
theme: string,
|
|
473
|
-
prefix: string,
|
|
474
|
-
id: string,
|
|
475
|
-
colorConfig: Array<[string, ChartConfig[string]]>,
|
|
476
|
-
): string {
|
|
477
|
-
const cssVariables = colorConfig
|
|
478
|
-
.map(([key, itemConfig]) => generateCssVariable(key, itemConfig, theme))
|
|
479
|
-
.filter(Boolean)
|
|
480
|
-
.join("\n");
|
|
481
|
-
|
|
482
|
-
return `${prefix} [data-chart=${id}] {\n${cssVariables}\n}`;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Generates complete CSS styles for all themes
|
|
487
|
-
*/
|
|
488
|
-
function generateChartStyles(id: string, colorConfig: Array<[string, ChartConfig[string]]>): string {
|
|
489
|
-
return Object.entries(THEMES)
|
|
490
|
-
.map(([theme, prefix]) => generateThemeStyles(theme, prefix, id, colorConfig))
|
|
491
|
-
.join("\n\n");
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
// ── Exports ──────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
495
|
-
|
|
496
|
-
export type {
|
|
497
|
-
ChartConfig,
|
|
498
|
-
ChartContainerProps,
|
|
499
|
-
ChartLegendContentProps,
|
|
500
|
-
ChartLegendProps,
|
|
501
|
-
ChartStyleProps,
|
|
502
|
-
ChartTooltipContentProps,
|
|
503
|
-
ChartTooltipProps,
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
export {
|
|
507
|
-
ChartContainer,
|
|
508
|
-
ChartLegend,
|
|
509
|
-
ChartLegendContent,
|
|
510
|
-
ChartStyle,
|
|
511
|
-
ChartTooltip,
|
|
512
|
-
ChartTooltipContent,
|
|
513
|
-
createChartScope,
|
|
514
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { CheckIcon, MinusIcon } from "lucide-react";
|
|
2
|
-
import type { ComponentProps, JSX } from "react";
|
|
3
|
-
|
|
4
|
-
import { Label } from "#/components/label";
|
|
5
|
-
import { cn } from "#/lib/utils";
|
|
6
|
-
import * as CheckboxGroupPrimitive from "#/primitives/checkbox-group";
|
|
7
|
-
|
|
8
|
-
// ── Component: CheckboxCards ─────────────────────────────────────────────────────────────────────────────────────────
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @since 0.3.16-canary.0
|
|
12
|
-
*/
|
|
13
|
-
type CheckboxCardsProps = ComponentProps<typeof CheckboxGroupPrimitive.Root>;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @since 0.3.16-canary.0
|
|
17
|
-
*/
|
|
18
|
-
function CheckboxCards(props: CheckboxCardsProps): JSX.Element {
|
|
19
|
-
return <CheckboxGroupPrimitive.Root data-slot="checkbox-cards" {...props} />;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// ── Component: CheckboxCardsItem ─────────────────────────────────────────────────────────────────────────────────────
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @since 0.3.16-canary.0
|
|
26
|
-
*/
|
|
27
|
-
interface CheckboxCardsItemProps extends ComponentProps<typeof CheckboxGroupPrimitive.Item> {
|
|
28
|
-
checkboxClassName?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @since 0.3.16-canary.0
|
|
33
|
-
*/
|
|
34
|
-
function CheckboxCardsItem({ checkboxClassName, children, className, ...props }: CheckboxCardsItemProps): JSX.Element {
|
|
35
|
-
return (
|
|
36
|
-
<Label
|
|
37
|
-
className={cn(
|
|
38
|
-
"flex items-start gap-2.5 rounded-lg border border-input p-2.5 transition has-focus-visible:border-ring has-disabled:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-data-indeterminate:border-primary/30 has-data-indeterminate:bg-primary/5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10 dark:has-data-indeterminate:border-primary/20 dark:has-data-indeterminate:bg-primary/10",
|
|
39
|
-
className,
|
|
40
|
-
)}
|
|
41
|
-
data-slot="checkbox-card"
|
|
42
|
-
>
|
|
43
|
-
<CheckboxGroupPrimitive.Item
|
|
44
|
-
className={cn(
|
|
45
|
-
"peer relative mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-sm border border-input shadow-xs transition-shadow duration-control ease-snappy outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground dark:data-indeterminate:bg-primary",
|
|
46
|
-
checkboxClassName,
|
|
47
|
-
)}
|
|
48
|
-
data-slot="checkbox-card-item"
|
|
49
|
-
{...props}
|
|
50
|
-
>
|
|
51
|
-
<CheckboxGroupPrimitive.CheckboxGroupIndicator
|
|
52
|
-
className="group/checkbox-card-indicator grid animate-in place-content-center text-current duration-control-indicator ease-spring zoom-in-50 [&>svg]:size-3.5"
|
|
53
|
-
data-slot="checkbox-card-indicator"
|
|
54
|
-
>
|
|
55
|
-
<CheckIcon className="group-data-indeterminate/checkbox-card-indicator:hidden" />
|
|
56
|
-
<MinusIcon className="hidden group-data-indeterminate/checkbox-card-indicator:block" />
|
|
57
|
-
</CheckboxGroupPrimitive.CheckboxGroupIndicator>
|
|
58
|
-
</CheckboxGroupPrimitive.Item>
|
|
59
|
-
{children}
|
|
60
|
-
</Label>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ── Exports ──────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
65
|
-
|
|
66
|
-
export { CheckboxCards, CheckboxCardsItem };
|
|
67
|
-
export type { CheckboxCardsItemProps, CheckboxCardsProps };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { CheckIcon, MinusIcon } from "lucide-react";
|
|
2
|
-
import type { ComponentProps, JSX } from "react";
|
|
3
|
-
|
|
4
|
-
import { cn } from "#/lib/utils";
|
|
5
|
-
import * as CheckboxGroupPrimitive from "#/primitives/checkbox-group";
|
|
6
|
-
|
|
7
|
-
// ── Component: CheckboxGroup ─────────────────────────────────────────────────────────────────────────────────────────
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @since 0.3.16-canary.0
|
|
11
|
-
*/
|
|
12
|
-
type CheckboxGroupProps = ComponentProps<typeof CheckboxGroupPrimitive.Root>;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @since 0.3.16-canary.0
|
|
16
|
-
*/
|
|
17
|
-
function CheckboxGroup({ className, ...props }: CheckboxGroupProps): JSX.Element {
|
|
18
|
-
return <CheckboxGroupPrimitive.Root className={cn("grid gap-2", className)} data-slot="checkbox-group" {...props} />;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// ── Component: CheckboxGroupItem ─────────────────────────────────────────────────────────────────────────────────────
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @since 0.3.16-canary.0
|
|
25
|
-
*/
|
|
26
|
-
type CheckboxGroupItemProps = ComponentProps<typeof CheckboxGroupPrimitive.Item>;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @since 0.3.16-canary.0
|
|
30
|
-
*/
|
|
31
|
-
function CheckboxGroupItem({ className, ...props }: CheckboxGroupItemProps): JSX.Element {
|
|
32
|
-
return (
|
|
33
|
-
<CheckboxGroupPrimitive.Item
|
|
34
|
-
className={cn(
|
|
35
|
-
"peer relative flex size-4 shrink-0 items-center justify-center rounded-sm border border-input shadow-xs transition-shadow duration-control ease-snappy outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground dark:data-indeterminate:bg-primary",
|
|
36
|
-
className,
|
|
37
|
-
)}
|
|
38
|
-
data-slot="checkbox-group-item"
|
|
39
|
-
{...props}
|
|
40
|
-
>
|
|
41
|
-
<CheckboxGroupPrimitive.CheckboxGroupIndicator
|
|
42
|
-
className="group/checkbox-group-indicator grid animate-in place-content-center text-current duration-control-indicator ease-spring zoom-in-50 [&>svg]:size-3.5"
|
|
43
|
-
data-slot="checkbox-group-indicator"
|
|
44
|
-
>
|
|
45
|
-
<CheckIcon className="group-data-indeterminate/checkbox-group-indicator:hidden" />
|
|
46
|
-
<MinusIcon className="hidden group-data-indeterminate/checkbox-group-indicator:block" />
|
|
47
|
-
</CheckboxGroupPrimitive.CheckboxGroupIndicator>
|
|
48
|
-
</CheckboxGroupPrimitive.Item>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// ── Exports ──────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
53
|
-
|
|
54
|
-
export { CheckboxGroup, CheckboxGroupItem };
|
|
55
|
-
export type { CheckboxGroupItemProps, CheckboxGroupProps };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { CheckIcon, MinusIcon } from "lucide-react";
|
|
2
|
-
import * as CheckboxPrimitive from "radix-ui/checkbox";
|
|
3
|
-
import type { ComponentProps, JSX } from "react";
|
|
4
|
-
|
|
5
|
-
import { cn } from "#/lib/utils";
|
|
6
|
-
|
|
7
|
-
// ── Component: Checkbox ──────────────────────────────────────────────────────────────────────────────────────────────
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @since 0.3.16-canary.0
|
|
11
|
-
*/
|
|
12
|
-
type CheckboxProps = ComponentProps<typeof CheckboxPrimitive.Root>;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @since 0.3.16-canary.0
|
|
16
|
-
*/
|
|
17
|
-
function Checkbox({ className, ...props }: CheckboxProps): JSX.Element {
|
|
18
|
-
return (
|
|
19
|
-
<CheckboxPrimitive.Root
|
|
20
|
-
className={cn(
|
|
21
|
-
"peer relative flex size-4 shrink-0 items-center justify-center rounded-sm border border-input shadow-xs transition-shadow duration-control ease-snappy outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground dark:data-indeterminate:bg-primary",
|
|
22
|
-
className,
|
|
23
|
-
)}
|
|
24
|
-
data-slot="checkbox"
|
|
25
|
-
{...props}
|
|
26
|
-
>
|
|
27
|
-
<CheckboxPrimitive.Indicator
|
|
28
|
-
className="group/checkbox-indicator grid animate-in place-content-center text-current duration-control-indicator ease-spring zoom-in-50 [&>svg]:size-3.5"
|
|
29
|
-
data-slot="checkbox-indicator"
|
|
30
|
-
>
|
|
31
|
-
<CheckIcon className="group-data-indeterminate/checkbox-indicator:hidden" />
|
|
32
|
-
<MinusIcon className="hidden group-data-indeterminate/checkbox-indicator:block" />
|
|
33
|
-
</CheckboxPrimitive.Indicator>
|
|
34
|
-
</CheckboxPrimitive.Root>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ── Exports ──────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
39
|
-
|
|
40
|
-
export { Checkbox };
|
|
41
|
-
export type { CheckboxProps };
|