@gv-tech/design-system 2.20.0 → 2.21.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/dist/accordion.cjs +2 -2
- package/dist/accordion.cjs.map +1 -1
- package/dist/accordion.d.ts +2 -34
- package/dist/accordion.mjs +35 -38
- package/dist/accordion.mjs.map +1 -1
- package/dist/alert-dialog.cjs +2 -2
- package/dist/alert-dialog.cjs.map +1 -1
- package/dist/alert-dialog.d.ts +2 -74
- package/dist/alert-dialog.mjs +55 -69
- package/dist/alert-dialog.mjs.map +1 -1
- package/dist/alert.cjs +2 -2
- package/dist/alert.cjs.map +1 -1
- package/dist/alert.d.ts +2 -29
- package/dist/alert.mjs +36 -32
- package/dist/alert.mjs.map +1 -1
- package/dist/aspect-ratio.cjs +2 -2
- package/dist/aspect-ratio.cjs.map +1 -1
- package/dist/aspect-ratio.d.ts +2 -14
- package/dist/aspect-ratio.mjs +8 -6
- package/dist/aspect-ratio.mjs.map +1 -1
- package/dist/avatar.cjs +2 -2
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.d.ts +2 -26
- package/dist/avatar.mjs +27 -29
- package/dist/avatar.mjs.map +1 -1
- package/dist/badge.cjs +2 -2
- package/dist/badge.cjs.map +1 -1
- package/dist/badge.d.ts +2 -21
- package/dist/badge.mjs +23 -25
- package/dist/badge.mjs.map +1 -1
- package/dist/breadcrumb.cjs +2 -2
- package/dist/breadcrumb.cjs.map +1 -1
- package/dist/breadcrumb.d.ts +2 -62
- package/dist/breadcrumb.mjs +60 -67
- package/dist/breadcrumb.mjs.map +1 -1
- package/dist/button.cjs +2 -2
- package/dist/button.cjs.map +1 -1
- package/dist/button.d.ts +2 -22
- package/dist/button.mjs +40 -39
- package/dist/button.mjs.map +1 -1
- package/dist/calendar.cjs +2 -2
- package/dist/calendar.cjs.map +1 -1
- package/dist/calendar.d.ts +2 -36
- package/dist/calendar.mjs +94 -130
- package/dist/calendar.mjs.map +1 -1
- package/dist/card.cjs +2 -2
- package/dist/card.cjs.map +1 -1
- package/dist/card.d.ts +2 -23
- package/dist/card.mjs +44 -33
- package/dist/card.mjs.map +1 -1
- package/dist/carousel.cjs +2 -2
- package/dist/carousel.cjs.map +1 -1
- package/dist/carousel.d.ts +2 -78
- package/dist/carousel.mjs +113 -151
- package/dist/carousel.mjs.map +1 -1
- package/dist/chart.cjs +5 -5
- package/dist/chart.cjs.map +1 -1
- package/dist/chart.d.ts +2 -90
- package/dist/chart.mjs +124 -182
- package/dist/chart.mjs.map +1 -1
- package/dist/checkbox.cjs +2 -2
- package/dist/checkbox.cjs.map +1 -1
- package/dist/checkbox.d.ts +2 -17
- package/dist/checkbox.mjs +19 -22
- package/dist/checkbox.mjs.map +1 -1
- package/dist/collapsible.cjs +2 -2
- package/dist/collapsible.cjs.map +1 -1
- package/dist/collapsible.d.ts +2 -32
- package/dist/collapsible.mjs +8 -8
- package/dist/collapsible.mjs.map +1 -1
- package/dist/command.cjs +2 -2
- package/dist/command.cjs.map +1 -1
- package/dist/command.d.ts +2 -133
- package/dist/command.mjs +80 -86
- package/dist/command.mjs.map +1 -1
- package/dist/context-menu.cjs +2 -2
- package/dist/context-menu.cjs.map +1 -1
- package/dist/context-menu.d.ts +2 -115
- package/dist/context-menu.mjs +72 -124
- package/dist/context-menu.mjs.map +1 -1
- package/dist/design-system.css +3 -1
- package/dist/dialog.cjs +2 -2
- package/dist/dialog.cjs.map +1 -1
- package/dist/dialog.d.ts +2 -31
- package/dist/dialog.mjs +50 -65
- package/dist/dialog.mjs.map +1 -1
- package/dist/drawer.cjs +2 -2
- package/dist/drawer.cjs.map +1 -1
- package/dist/drawer.d.ts +2 -79
- package/dist/drawer.mjs +49 -54
- package/dist/drawer.mjs.map +1 -1
- package/dist/dropdown-menu.cjs +2 -2
- package/dist/dropdown-menu.cjs.map +1 -1
- package/dist/dropdown-menu.d.ts +2 -124
- package/dist/dropdown-menu.mjs +73 -126
- package/dist/dropdown-menu.mjs.map +1 -1
- package/dist/form.cjs +2 -2
- package/dist/form.cjs.map +1 -1
- package/dist/form.d.ts +2 -62
- package/dist/form.mjs +75 -65
- package/dist/form.mjs.map +1 -1
- package/dist/hover-card.cjs +2 -2
- package/dist/hover-card.cjs.map +1 -1
- package/dist/hover-card.d.ts +2 -30
- package/dist/hover-card.mjs +17 -23
- package/dist/hover-card.mjs.map +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.d.ts +2 -2442
- package/dist/index.mjs +56 -430
- package/dist/input.cjs +2 -2
- package/dist/input.cjs.map +1 -1
- package/dist/input.d.ts +2 -14
- package/dist/input.mjs +16 -20
- package/dist/input.mjs.map +1 -1
- package/dist/label.cjs +2 -2
- package/dist/label.cjs.map +1 -1
- package/dist/label.d.ts +2 -14
- package/dist/label.mjs +14 -8
- package/dist/label.mjs.map +1 -1
- package/dist/menubar.cjs +2 -2
- package/dist/menubar.cjs.map +1 -1
- package/dist/menubar.d.ts +2 -125
- package/dist/menubar.mjs +101 -156
- package/dist/menubar.mjs.map +1 -1
- package/dist/navigation-menu.cjs +2 -2
- package/dist/navigation-menu.cjs.map +1 -1
- package/dist/navigation-menu.d.ts +2 -77
- package/dist/navigation-menu.mjs +58 -96
- package/dist/navigation-menu.mjs.map +1 -1
- package/dist/packages/design-tokens/src/index.d.ts +91 -0
- package/dist/packages/design-tokens/src/palette.d.ts +31 -0
- package/dist/packages/design-tokens/src/preset.d.ts +107 -0
- package/dist/packages/design-tokens/src/radii.d.ts +20 -0
- package/dist/packages/design-tokens/src/shadows.d.ts +11 -0
- package/dist/packages/design-tokens/src/spacing.d.ts +29 -0
- package/dist/packages/design-tokens/src/theme.d.ts +47 -0
- package/dist/packages/design-tokens/src/typography.d.ts +32 -0
- package/dist/packages/ui-core/src/contracts/accordion.d.ts +19 -0
- package/dist/packages/ui-core/src/contracts/alert-dialog.d.ts +39 -0
- package/dist/packages/ui-core/src/contracts/alert.d.ts +14 -0
- package/dist/packages/ui-core/src/contracts/aspect-ratio.d.ts +6 -0
- package/dist/packages/ui-core/src/contracts/avatar.d.ts +14 -0
- package/dist/packages/ui-core/src/contracts/badge.d.ts +6 -0
- package/dist/packages/ui-core/src/contracts/breadcrumb.d.ts +30 -0
- package/dist/packages/ui-core/src/contracts/button.d.ts +9 -0
- package/dist/packages/ui-core/src/contracts/calendar.d.ts +4 -0
- package/dist/packages/ui-core/src/contracts/card.d.ts +5 -0
- package/dist/packages/ui-core/src/contracts/carousel.d.ts +24 -0
- package/dist/packages/ui-core/src/contracts/chart.d.ts +33 -0
- package/dist/packages/ui-core/src/contracts/checkbox.d.ts +7 -0
- package/dist/packages/ui-core/src/contracts/collapsible.d.ts +18 -0
- package/dist/packages/ui-core/src/contracts/command.d.ts +35 -0
- package/dist/packages/ui-core/src/contracts/context-menu.d.ts +64 -0
- package/dist/packages/ui-core/src/contracts/dialog.d.ts +13 -0
- package/dist/packages/ui-core/src/contracts/drawer.d.ts +31 -0
- package/dist/packages/ui-core/src/contracts/dropdown-menu.d.ts +73 -0
- package/dist/packages/ui-core/src/contracts/form.d.ts +23 -0
- package/dist/packages/ui-core/src/contracts/hover-card.d.ts +18 -0
- package/dist/packages/ui-core/src/contracts/input.d.ts +5 -0
- package/dist/packages/ui-core/src/contracts/label.d.ts +6 -0
- package/dist/packages/ui-core/src/contracts/menubar.d.ts +73 -0
- package/dist/packages/ui-core/src/contracts/navigation-menu.d.ts +47 -0
- package/dist/packages/ui-core/src/contracts/pagination.d.ts +31 -0
- package/dist/packages/ui-core/src/contracts/popover.d.ts +24 -0
- package/dist/packages/ui-core/src/contracts/progress.d.ts +4 -0
- package/dist/packages/ui-core/src/contracts/radio.d.ts +9 -0
- package/dist/packages/ui-core/src/contracts/resizable.d.ts +38 -0
- package/dist/packages/ui-core/src/contracts/scroll-area.d.ts +13 -0
- package/dist/packages/ui-core/src/contracts/scroll-to-top.d.ts +25 -0
- package/dist/packages/ui-core/src/contracts/search.d.ts +12 -0
- package/dist/packages/ui-core/src/contracts/select.d.ts +54 -0
- package/dist/packages/ui-core/src/contracts/separator.d.ts +5 -0
- package/dist/packages/ui-core/src/contracts/sheet.d.ts +48 -0
- package/dist/packages/ui-core/src/contracts/skeleton.d.ts +5 -0
- package/dist/packages/ui-core/src/contracts/slider.d.ts +15 -0
- package/dist/packages/ui-core/src/contracts/sonner.d.ts +15 -0
- package/dist/packages/ui-core/src/contracts/switch.d.ts +11 -0
- package/dist/packages/ui-core/src/contracts/table-of-contents.d.ts +41 -0
- package/dist/packages/ui-core/src/contracts/table.d.ts +33 -0
- package/dist/packages/ui-core/src/contracts/tabs.d.ts +27 -0
- package/dist/packages/ui-core/src/contracts/text.d.ts +6 -0
- package/dist/packages/ui-core/src/contracts/textarea.d.ts +7 -0
- package/dist/packages/ui-core/src/contracts/theme-provider.d.ts +13 -0
- package/dist/packages/ui-core/src/contracts/theme-toggle.d.ts +15 -0
- package/dist/packages/ui-core/src/contracts/toast.d.ts +10 -0
- package/dist/packages/ui-core/src/contracts/toaster.d.ts +3 -0
- package/dist/packages/ui-core/src/contracts/toggle-group.d.ts +21 -0
- package/dist/packages/ui-core/src/contracts/toggle.d.ts +29 -0
- package/dist/packages/ui-core/src/contracts/tooltip.d.ts +24 -0
- package/dist/packages/ui-core/src/index.d.ts +56 -0
- package/dist/packages/ui-web/src/accordion.d.ts +9 -0
- package/dist/packages/ui-web/src/accordion.test.d.ts +1 -0
- package/dist/packages/ui-web/src/alert-dialog.d.ts +22 -0
- package/dist/packages/ui-web/src/alert-dialog.test.d.ts +1 -0
- package/dist/packages/ui-web/src/alert.d.ts +11 -0
- package/dist/packages/ui-web/src/alert.test.d.ts +1 -0
- package/dist/packages/ui-web/src/aspect-ratio.d.ts +6 -0
- package/dist/packages/ui-web/src/aspect-ratio.test.d.ts +1 -0
- package/dist/packages/ui-web/src/avatar.d.ts +8 -0
- package/dist/packages/ui-web/src/avatar.test.d.ts +1 -0
- package/dist/packages/ui-web/src/badge.d.ts +11 -0
- package/dist/packages/ui-web/src/badge.test.d.ts +1 -0
- package/dist/packages/ui-web/src/breadcrumb.d.ts +19 -0
- package/dist/packages/ui-web/src/button.d.ts +13 -0
- package/dist/packages/ui-web/src/button.test.d.ts +1 -0
- package/dist/packages/ui-web/src/calendar.d.ts +10 -0
- package/dist/packages/ui-web/src/calendar.test.d.ts +1 -0
- package/dist/packages/ui-web/src/card.d.ts +11 -0
- package/dist/packages/ui-web/src/card.test.d.ts +1 -0
- package/dist/packages/ui-web/src/carousel.d.ts +24 -0
- package/dist/packages/ui-web/src/carousel.test.d.ts +1 -0
- package/dist/packages/ui-web/src/chart.d.ts +16 -0
- package/dist/packages/ui-web/src/chart.test.d.ts +1 -0
- package/dist/packages/ui-web/src/checkbox.d.ts +7 -0
- package/dist/packages/ui-web/src/checkbox.test.d.ts +1 -0
- package/dist/packages/ui-web/src/collapsible.d.ts +8 -0
- package/dist/packages/ui-web/src/collapsible.test.d.ts +1 -0
- package/dist/packages/ui-web/src/command.d.ts +82 -0
- package/dist/packages/ui-web/src/command.test.d.ts +1 -0
- package/dist/packages/ui-web/src/context-menu.d.ts +23 -0
- package/dist/packages/ui-web/src/context-menu.test.d.ts +1 -0
- package/dist/packages/ui-web/src/dialog.d.ts +19 -0
- package/dist/packages/ui-web/src/dialog.test.d.ts +1 -0
- package/dist/packages/ui-web/src/drawer.d.ts +25 -0
- package/dist/packages/ui-web/src/drawer.test.d.ts +1 -0
- package/dist/packages/ui-web/src/dropdown-menu.d.ts +23 -0
- package/dist/packages/ui-web/src/dropdown-menu.test.d.ts +1 -0
- package/dist/packages/ui-web/src/form.d.ts +26 -0
- package/dist/packages/ui-web/src/form.test.d.ts +1 -0
- package/dist/packages/ui-web/src/hooks/use-theme.d.ts +51 -0
- package/dist/packages/ui-web/src/hooks/use-toast.d.ts +44 -0
- package/dist/packages/ui-web/src/hover-card.d.ts +8 -0
- package/dist/packages/ui-web/src/hover-card.test.d.ts +1 -0
- package/dist/packages/ui-web/src/index.d.ts +107 -0
- package/dist/packages/ui-web/src/input.d.ts +6 -0
- package/dist/packages/ui-web/src/input.test.d.ts +1 -0
- package/dist/packages/ui-web/src/label.d.ts +8 -0
- package/dist/packages/ui-web/src/label.test.d.ts +1 -0
- package/dist/packages/ui-web/src/lib/utils.d.ts +3 -0
- package/dist/packages/ui-web/src/menubar.d.ts +24 -0
- package/dist/packages/ui-web/src/menubar.test.d.ts +1 -0
- package/dist/packages/ui-web/src/navigation-menu.d.ts +15 -0
- package/dist/packages/ui-web/src/navigation-menu.test.d.ts +1 -0
- package/dist/packages/ui-web/src/pagination.d.ts +30 -0
- package/dist/packages/ui-web/src/pagination.test.d.ts +1 -0
- package/dist/packages/ui-web/src/popover.d.ts +9 -0
- package/dist/packages/ui-web/src/popover.test.d.ts +1 -0
- package/dist/packages/ui-web/src/progress.d.ts +6 -0
- package/dist/packages/ui-web/src/progress.test.d.ts +1 -0
- package/dist/packages/ui-web/src/radio-group.d.ts +10 -0
- package/dist/packages/ui-web/src/radio-group.test.d.ts +1 -0
- package/dist/packages/ui-web/src/resizable.d.ts +8 -0
- package/dist/packages/ui-web/src/resizable.test.d.ts +1 -0
- package/dist/packages/ui-web/src/scroll-area.d.ts +7 -0
- package/dist/packages/ui-web/src/scroll-area.test.d.ts +1 -0
- package/dist/packages/ui-web/src/scroll-to-top.d.ts +7 -0
- package/dist/packages/ui-web/src/scroll-to-top.test.d.ts +1 -0
- package/dist/packages/ui-web/src/search.d.ts +7 -0
- package/dist/packages/ui-web/src/search.test.d.ts +1 -0
- package/dist/packages/ui-web/src/select.d.ts +15 -0
- package/dist/packages/ui-web/src/select.test.d.ts +1 -0
- package/dist/packages/ui-web/src/separator.d.ts +6 -0
- package/dist/packages/ui-web/src/separator.test.d.ts +1 -0
- package/dist/packages/ui-web/src/setupTests.d.ts +0 -0
- package/dist/packages/ui-web/src/sheet.d.ts +28 -0
- package/dist/packages/ui-web/src/sheet.test.d.ts +1 -0
- package/dist/packages/ui-web/src/skeleton.d.ts +5 -0
- package/dist/packages/ui-web/src/skeleton.test.d.ts +1 -0
- package/dist/packages/ui-web/src/slider.d.ts +6 -0
- package/dist/packages/ui-web/src/slider.test.d.ts +1 -0
- package/dist/packages/ui-web/src/sonner.d.ts +7 -0
- package/dist/packages/ui-web/src/sonner.test.d.ts +1 -0
- package/dist/packages/ui-web/src/support-fab.d.ts +15 -0
- package/dist/packages/ui-web/src/support-fab.test.d.ts +1 -0
- package/dist/packages/ui-web/src/switch.d.ts +6 -0
- package/dist/packages/ui-web/src/switch.test.d.ts +1 -0
- package/dist/packages/ui-web/src/table-of-contents.d.ts +23 -0
- package/dist/packages/ui-web/src/table-of-contents.test.d.ts +1 -0
- package/dist/packages/ui-web/src/table.d.ts +12 -0
- package/dist/packages/ui-web/src/table.test.d.ts +1 -0
- package/dist/packages/ui-web/src/tabs.d.ts +9 -0
- package/dist/packages/ui-web/src/tabs.test.d.ts +1 -0
- package/dist/packages/ui-web/src/text.d.ts +12 -0
- package/dist/packages/ui-web/src/text.test.d.ts +1 -0
- package/dist/packages/ui-web/src/textarea.d.ts +6 -0
- package/dist/packages/ui-web/src/textarea.test.d.ts +1 -0
- package/dist/packages/ui-web/src/theme-provider.d.ts +4 -0
- package/dist/packages/ui-web/src/theme-toggle.d.ts +3 -0
- package/dist/packages/ui-web/src/theme-toggle.test.d.ts +1 -0
- package/dist/packages/ui-web/src/toast.d.ts +16 -0
- package/dist/packages/ui-web/src/toast.test.d.ts +1 -0
- package/dist/packages/ui-web/src/toaster.d.ts +2 -0
- package/dist/packages/ui-web/src/toggle-group.d.ts +13 -0
- package/dist/packages/ui-web/src/toggle-group.test.d.ts +1 -0
- package/dist/packages/ui-web/src/toggle.d.ts +8 -0
- package/dist/packages/ui-web/src/toggle.test.d.ts +1 -0
- package/dist/packages/ui-web/src/tooltip.d.ts +12 -0
- package/dist/pagination.cjs +2 -2
- package/dist/pagination.cjs.map +1 -1
- package/dist/pagination.d.ts +2 -94
- package/dist/pagination.mjs +63 -67
- package/dist/pagination.mjs.map +1 -1
- package/dist/popover.cjs +2 -2
- package/dist/popover.cjs.map +1 -1
- package/dist/popover.d.ts +2 -39
- package/dist/popover.mjs +17 -24
- package/dist/popover.mjs.map +1 -1
- package/dist/progress.cjs +2 -2
- package/dist/progress.cjs.map +1 -1
- package/dist/progress.d.ts +2 -11
- package/dist/progress.mjs +19 -23
- package/dist/progress.mjs.map +1 -1
- package/dist/radio-group.cjs +2 -2
- package/dist/radio-group.cjs.map +1 -1
- package/dist/radio-group.d.ts +2 -25
- package/dist/radio-group.mjs +25 -27
- package/dist/radio-group.mjs.map +1 -1
- package/dist/resizable.cjs +2 -2
- package/dist/resizable.cjs.map +1 -1
- package/dist/resizable.d.ts +2 -53
- package/dist/resizable.mjs +21 -34
- package/dist/resizable.mjs.map +1 -1
- package/dist/rolldown-runtime-C0IHAABJ.mjs +23 -0
- package/dist/rolldown-runtime-CacfPODE.js +1 -0
- package/dist/scroll-area.cjs +2 -2
- package/dist/scroll-area.cjs.map +1 -1
- package/dist/scroll-area.d.ts +2 -22
- package/dist/scroll-area.mjs +31 -30
- package/dist/scroll-area.mjs.map +1 -1
- package/dist/scroll-to-top.cjs +2 -2
- package/dist/scroll-to-top.cjs.map +1 -1
- package/dist/scroll-to-top.d.ts +2 -37
- package/dist/scroll-to-top.mjs +72 -84
- package/dist/scroll-to-top.mjs.map +1 -1
- package/dist/search.cjs +2 -2
- package/dist/search.cjs.map +1 -1
- package/dist/search.d.ts +2 -26
- package/dist/search.mjs +54 -63
- package/dist/search.mjs.map +1 -1
- package/dist/select.cjs +2 -2
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.ts +2 -87
- package/dist/select.mjs +70 -100
- package/dist/select.mjs.map +1 -1
- package/dist/separator.cjs +2 -2
- package/dist/separator.cjs.map +1 -1
- package/dist/separator.d.ts +2 -12
- package/dist/separator.mjs +17 -18
- package/dist/separator.mjs.map +1 -1
- package/dist/sheet.cjs +2 -2
- package/dist/sheet.cjs.map +1 -1
- package/dist/sheet.d.ts +2 -97
- package/dist/sheet.mjs +58 -64
- package/dist/sheet.mjs.map +1 -1
- package/dist/skeleton.cjs +2 -2
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.d.ts +2 -11
- package/dist/skeleton.mjs +15 -8
- package/dist/skeleton.mjs.map +1 -1
- package/dist/slider.cjs +2 -2
- package/dist/slider.cjs.map +1 -1
- package/dist/slider.d.ts +2 -22
- package/dist/slider.mjs +19 -20
- package/dist/slider.mjs.map +1 -1
- package/dist/sonner.cjs +2 -2
- package/dist/sonner.cjs.map +1 -1
- package/dist/sonner.d.ts +2 -25
- package/dist/sonner.mjs +22 -24
- package/dist/sonner.mjs.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/setupTests.d.ts +0 -0
- package/dist/src-B8AA-nU4.js +2 -0
- package/dist/src-B8AA-nU4.js.map +1 -0
- package/dist/src-C65A5RuY.mjs +23 -0
- package/dist/src-C65A5RuY.mjs.map +1 -0
- package/dist/support-fab.cjs +2 -2
- package/dist/support-fab.cjs.map +1 -1
- package/dist/support-fab.d.ts +2 -20
- package/dist/support-fab.mjs +82 -117
- package/dist/support-fab.mjs.map +1 -1
- package/dist/switch.cjs +2 -2
- package/dist/switch.cjs.map +1 -1
- package/dist/switch.d.ts +2 -18
- package/dist/switch.mjs +16 -27
- package/dist/switch.mjs.map +1 -1
- package/dist/table-of-contents.cjs +2 -2
- package/dist/table-of-contents.cjs.map +1 -1
- package/dist/table-of-contents.d.ts +2 -68
- package/dist/table-of-contents.mjs +161 -156
- package/dist/table-of-contents.mjs.map +1 -1
- package/dist/table.cjs +2 -2
- package/dist/table.cjs.map +1 -1
- package/dist/table.d.ts +2 -59
- package/dist/table.mjs +60 -58
- package/dist/table.mjs.map +1 -1
- package/dist/tabs.cjs +2 -2
- package/dist/tabs.cjs.map +1 -1
- package/dist/tabs.d.ts +2 -42
- package/dist/tabs.mjs +27 -46
- package/dist/tabs.mjs.map +1 -1
- package/dist/text.cjs +2 -2
- package/dist/text.cjs.map +1 -1
- package/dist/text.d.ts +2 -21
- package/dist/text.mjs +42 -42
- package/dist/text.mjs.map +1 -1
- package/dist/textarea.cjs +2 -2
- package/dist/textarea.cjs.map +1 -1
- package/dist/textarea.d.ts +2 -16
- package/dist/textarea.mjs +14 -18
- package/dist/textarea.mjs.map +1 -1
- package/dist/theme-provider.cjs +2 -2
- package/dist/theme-provider.cjs.map +1 -1
- package/dist/theme-provider.d.ts +2 -22
- package/dist/theme-provider.mjs +17 -8
- package/dist/theme-provider.mjs.map +1 -1
- package/dist/theme-toggle-B8UiizQB.js +2 -0
- package/dist/theme-toggle-B8UiizQB.js.map +1 -0
- package/dist/theme-toggle-DoAVRoyO.mjs +321 -0
- package/dist/theme-toggle-DoAVRoyO.mjs.map +1 -0
- package/dist/theme-toggle.cjs +1 -2
- package/dist/theme-toggle.d.ts +2 -23
- package/dist/theme-toggle.mjs +3 -9
- package/dist/toast.cjs +2 -2
- package/dist/toast.cjs.map +1 -1
- package/dist/toast.d.ts +2 -26
- package/dist/toast.mjs +53 -70
- package/dist/toast.mjs.map +1 -1
- package/dist/toaster-BgZxvlTL.mjs +128 -0
- package/dist/toaster-BgZxvlTL.mjs.map +1 -0
- package/dist/toaster-DnZKPR-G.js +2 -0
- package/dist/toaster-DnZKPR-G.js.map +1 -0
- package/dist/toaster.cjs +1 -2
- package/dist/toaster.d.ts +2 -9
- package/dist/toaster.mjs +3 -7
- package/dist/toggle-group.cjs +2 -2
- package/dist/toggle-group.cjs.map +1 -1
- package/dist/toggle-group.d.ts +2 -22
- package/dist/toggle-group.mjs +39 -37
- package/dist/toggle-group.mjs.map +1 -1
- package/dist/toggle.cjs +2 -2
- package/dist/toggle.cjs.map +1 -1
- package/dist/toggle.d.ts +2 -43
- package/dist/toggle.mjs +19 -12
- package/dist/toggle.mjs.map +1 -1
- package/dist/tooltip.cjs +2 -2
- package/dist/tooltip.cjs.map +1 -1
- package/dist/tooltip.d.ts +2 -48
- package/dist/tooltip.mjs +25 -29
- package/dist/tooltip.mjs.map +1 -1
- package/dist/utils-BtI8Nf6i.mjs +12 -0
- package/dist/utils-BtI8Nf6i.mjs.map +1 -0
- package/dist/utils-CbSX47LV.js +2 -0
- package/dist/utils-CbSX47LV.js.map +1 -0
- package/dist/vendor-Cr0eKZrm.mjs +28603 -0
- package/dist/vendor-Cr0eKZrm.mjs.map +1 -0
- package/dist/vendor-D3ZzLf8D.js +92 -0
- package/dist/vendor-D3ZzLf8D.js.map +1 -0
- package/package.json +29 -32
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/theme-toggle-BNtYv2Jv.mjs +0 -177
- package/dist/theme-toggle-BNtYv2Jv.mjs.map +0 -1
- package/dist/theme-toggle-DK_OhDRf.js +0 -2
- package/dist/theme-toggle-DK_OhDRf.js.map +0 -1
- package/dist/theme-toggle.cjs.map +0 -1
- package/dist/theme-toggle.mjs.map +0 -1
- package/dist/toaster-Cj_SryBI.mjs +0 -119
- package/dist/toaster-Cj_SryBI.mjs.map +0 -1
- package/dist/toaster-Q_hzVonm.js +0 -2
- package/dist/toaster-Q_hzVonm.js.map +0 -1
- package/dist/toaster.cjs.map +0 -1
- package/dist/toaster.mjs.map +0 -1
- package/dist/toggle-DPMTgo47.mjs +0 -25
- package/dist/toggle-DPMTgo47.mjs.map +0 -1
- package/dist/toggle-_F_yB_Dj.js +0 -2
- package/dist/toggle-_F_yB_Dj.js.map +0 -1
- package/dist/utils-Bgpn0CK0.mjs +0 -12
- package/dist/utils-Bgpn0CK0.mjs.map +0 -1
- package/dist/utils-CBWPs0D7.js +0 -2
- package/dist/utils-CBWPs0D7.js.map +0 -1
- package/dist/vendor-BQwS7aJt.mjs +0 -25217
- package/dist/vendor-BQwS7aJt.mjs.map +0 -1
- package/dist/vendor-B_07FHqh.js +0 -68
- package/dist/vendor-B_07FHqh.js.map +0 -1
package/dist/carousel.d.ts
CHANGED
|
@@ -1,78 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import * as React_2 from 'react';
|
|
4
|
-
import { UseEmblaCarouselType } from 'embla-carousel-react';
|
|
5
|
-
import { VariantProps } from 'class-variance-authority';
|
|
6
|
-
|
|
7
|
-
declare interface ButtonBaseProps {
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
className?: string;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare interface ButtonProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants>, ButtonBaseProps {
|
|
14
|
-
asChild?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare const buttonVariants: (props?: ({
|
|
18
|
-
variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "link" | null | undefined;
|
|
19
|
-
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
20
|
-
} & ClassProp) | undefined) => string;
|
|
21
|
-
|
|
22
|
-
export declare const Carousel: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & CarouselBaseProps & {
|
|
23
|
-
opts?: CarouselOptions;
|
|
24
|
-
plugins?: CarouselPlugin;
|
|
25
|
-
setApi?: (api: CarouselApi) => void;
|
|
26
|
-
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
27
|
-
|
|
28
|
-
export declare type CarouselApi = UseEmblaCarouselType[1];
|
|
29
|
-
|
|
30
|
-
declare interface CarouselBaseProps {
|
|
31
|
-
className?: string;
|
|
32
|
-
children?: React_2.ReactNode;
|
|
33
|
-
orientation?: 'horizontal' | 'vertical';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export declare const CarouselContent: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & CarouselContentBaseProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
37
|
-
|
|
38
|
-
declare interface CarouselContentBaseProps {
|
|
39
|
-
className?: string;
|
|
40
|
-
children?: React_2.ReactNode;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export declare const CarouselItem: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & CarouselItemBaseProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
44
|
-
|
|
45
|
-
declare interface CarouselItemBaseProps {
|
|
46
|
-
className?: string;
|
|
47
|
-
children?: React_2.ReactNode;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export declare const CarouselNext: React_2.ForwardRefExoticComponent<Omit< ButtonProps & React_2.RefAttributes<HTMLButtonElement> & CarouselNextBaseProps, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
|
|
51
|
-
|
|
52
|
-
declare interface CarouselNextBaseProps {
|
|
53
|
-
className?: string;
|
|
54
|
-
variant?: string;
|
|
55
|
-
size?: string;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
declare type CarouselOptions = UseCarouselParameters[0];
|
|
59
|
-
|
|
60
|
-
declare type CarouselPlugin = UseCarouselParameters[1];
|
|
61
|
-
|
|
62
|
-
export declare const CarouselPrevious: React_2.ForwardRefExoticComponent<Omit< ButtonProps & React_2.RefAttributes<HTMLButtonElement> & CarouselPreviousBaseProps, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
|
|
63
|
-
|
|
64
|
-
declare interface CarouselPreviousBaseProps {
|
|
65
|
-
className?: string;
|
|
66
|
-
variant?: string;
|
|
67
|
-
size?: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export declare type CarouselProps = React_2.HTMLAttributes<HTMLDivElement> & CarouselBaseProps & {
|
|
71
|
-
opts?: CarouselOptions;
|
|
72
|
-
plugins?: CarouselPlugin;
|
|
73
|
-
setApi?: (api: CarouselApi) => void;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
declare type UseCarouselParameters = Parameters<typeof default_2>;
|
|
77
|
-
|
|
78
|
-
export { }
|
|
1
|
+
export * from './packages/ui-web/src/carousel'
|
|
2
|
+
export {}
|
package/dist/carousel.mjs
CHANGED
|
@@ -1,155 +1,117 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"use client";
|
|
3
|
+
import { bn as e, cr as t, lr as n, vr as r } from "./vendor-Cr0eKZrm.mjs";
|
|
4
|
+
import { t as i } from "./utils-BtI8Nf6i.mjs";
|
|
5
|
+
import { Button as a } from "./button.mjs";
|
|
6
|
+
import * as o from "react";
|
|
7
|
+
//#region packages/ui-web/src/carousel.tsx
|
|
8
|
+
var s = r(), c = o.createContext(null);
|
|
9
|
+
function l() {
|
|
10
|
+
let e = o.useContext(c);
|
|
11
|
+
if (!e) throw Error("useCarousel must be used within a <Carousel />");
|
|
12
|
+
return e;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
14
|
+
var u = o.forwardRef(({ orientation: t = "horizontal", opts: n, setApi: r, plugins: a, className: l, children: u, ...d }, f) => {
|
|
15
|
+
let [p, m] = e({
|
|
16
|
+
...n,
|
|
17
|
+
axis: t === "horizontal" ? "x" : "y"
|
|
18
|
+
}, a), [h, g] = o.useState(!1), [_, v] = o.useState(!1), y = o.useCallback((e) => {
|
|
19
|
+
e && (g(e.canScrollPrev()), v(e.canScrollNext()));
|
|
20
|
+
}, []), b = o.useCallback(() => {
|
|
21
|
+
m?.scrollPrev();
|
|
22
|
+
}, [m]), x = o.useCallback(() => {
|
|
23
|
+
m?.scrollNext();
|
|
24
|
+
}, [m]), S = o.useCallback((e) => {
|
|
25
|
+
e.key === "ArrowLeft" ? (e.preventDefault(), b()) : e.key === "ArrowRight" && (e.preventDefault(), x());
|
|
26
|
+
}, [b, x]);
|
|
27
|
+
return o.useEffect(() => {
|
|
28
|
+
!m || !r || r(m);
|
|
29
|
+
}, [m, r]), o.useEffect(() => {
|
|
30
|
+
if (m) return y(m), m.on("reInit", y), m.on("select", y), () => {
|
|
31
|
+
m?.off("select", y);
|
|
32
|
+
};
|
|
33
|
+
}, [m, y]), /* @__PURE__ */ (0, s.jsx)(c.Provider, {
|
|
34
|
+
value: {
|
|
35
|
+
carouselRef: p,
|
|
36
|
+
api: m,
|
|
37
|
+
opts: n,
|
|
38
|
+
orientation: t || (n?.axis === "y" ? "vertical" : "horizontal"),
|
|
39
|
+
scrollPrev: b,
|
|
40
|
+
scrollNext: x,
|
|
41
|
+
canScrollPrev: h,
|
|
42
|
+
canScrollNext: _
|
|
43
|
+
},
|
|
44
|
+
children: /* @__PURE__ */ (0, s.jsx)("div", {
|
|
45
|
+
ref: f,
|
|
46
|
+
onKeyDownCapture: S,
|
|
47
|
+
className: i("relative", l),
|
|
48
|
+
role: "region",
|
|
49
|
+
"aria-roledescription": "carousel",
|
|
50
|
+
...d,
|
|
51
|
+
children: u
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
u.displayName = "Carousel";
|
|
56
|
+
var d = o.forwardRef(({ className: e, ...t }, n) => {
|
|
57
|
+
let { carouselRef: r, orientation: a } = l();
|
|
58
|
+
return /* @__PURE__ */ (0, s.jsx)("div", {
|
|
59
|
+
ref: r,
|
|
60
|
+
className: "overflow-hidden",
|
|
61
|
+
children: /* @__PURE__ */ (0, s.jsx)("div", {
|
|
62
|
+
ref: n,
|
|
63
|
+
className: i("flex", a === "horizontal" ? "-ml-4" : "-mt-4 flex-col", e),
|
|
64
|
+
...t
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
d.displayName = "CarouselContent";
|
|
69
|
+
var f = o.forwardRef(({ className: e, ...t }, n) => {
|
|
70
|
+
let { orientation: r } = l();
|
|
71
|
+
return /* @__PURE__ */ (0, s.jsx)("div", {
|
|
72
|
+
ref: n,
|
|
73
|
+
role: "group",
|
|
74
|
+
"aria-roledescription": "slide",
|
|
75
|
+
className: i("min-w-0 shrink-0 grow-0 basis-full", r === "horizontal" ? "pl-4" : "pt-4", e),
|
|
76
|
+
...t
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
f.displayName = "CarouselItem";
|
|
80
|
+
var p = o.forwardRef(({ className: e, variant: t = "outline", size: r = "icon", ...o }, c) => {
|
|
81
|
+
let { orientation: u, scrollPrev: d, canScrollPrev: f } = l();
|
|
82
|
+
return /* @__PURE__ */ (0, s.jsxs)(a, {
|
|
83
|
+
ref: c,
|
|
84
|
+
variant: t,
|
|
85
|
+
size: r,
|
|
86
|
+
className: i("absolute h-8 w-8 rounded-full", u === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", e),
|
|
87
|
+
disabled: !f,
|
|
88
|
+
onClick: d,
|
|
89
|
+
...o,
|
|
90
|
+
children: [/* @__PURE__ */ (0, s.jsx)(n, { className: "h-4 w-4" }), /* @__PURE__ */ (0, s.jsx)("span", {
|
|
91
|
+
className: "sr-only",
|
|
92
|
+
children: "Previous slide"
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
80
95
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
);
|
|
97
|
-
E.displayName = "CarouselItem";
|
|
98
|
-
const D = e.forwardRef(({ className: o, variant: l = "outline", size: s = "icon", ...a }, c) => {
|
|
99
|
-
const { orientation: i, scrollPrev: u, canScrollPrev: f } = m();
|
|
100
|
-
return /* @__PURE__ */ t.jsxs(
|
|
101
|
-
N,
|
|
102
|
-
{
|
|
103
|
-
ref: c,
|
|
104
|
-
variant: l,
|
|
105
|
-
size: s,
|
|
106
|
-
className: x(
|
|
107
|
-
"absolute h-8 w-8 rounded-full",
|
|
108
|
-
i === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
109
|
-
o
|
|
110
|
-
),
|
|
111
|
-
disabled: !f,
|
|
112
|
-
onClick: u,
|
|
113
|
-
...a,
|
|
114
|
-
children: [
|
|
115
|
-
/* @__PURE__ */ t.jsx(S, { className: "h-4 w-4" }),
|
|
116
|
-
/* @__PURE__ */ t.jsx("span", { className: "sr-only", children: "Previous slide" })
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
);
|
|
96
|
+
p.displayName = "CarouselPrevious";
|
|
97
|
+
var m = o.forwardRef(({ className: e, variant: n = "outline", size: r = "icon", ...o }, c) => {
|
|
98
|
+
let { orientation: u, scrollNext: d, canScrollNext: f } = l();
|
|
99
|
+
return /* @__PURE__ */ (0, s.jsxs)(a, {
|
|
100
|
+
ref: c,
|
|
101
|
+
variant: n,
|
|
102
|
+
size: r,
|
|
103
|
+
className: i("absolute h-8 w-8 rounded-full", u === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", e),
|
|
104
|
+
disabled: !f,
|
|
105
|
+
onClick: d,
|
|
106
|
+
...o,
|
|
107
|
+
children: [/* @__PURE__ */ (0, s.jsx)(t, { className: "h-4 w-4" }), /* @__PURE__ */ (0, s.jsx)("span", {
|
|
108
|
+
className: "sr-only",
|
|
109
|
+
children: "Next slide"
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
120
112
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
N,
|
|
127
|
-
{
|
|
128
|
-
ref: c,
|
|
129
|
-
variant: l,
|
|
130
|
-
size: s,
|
|
131
|
-
className: x(
|
|
132
|
-
"absolute h-8 w-8 rounded-full",
|
|
133
|
-
i === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
134
|
-
o
|
|
135
|
-
),
|
|
136
|
-
disabled: !f,
|
|
137
|
-
onClick: u,
|
|
138
|
-
...a,
|
|
139
|
-
children: [
|
|
140
|
-
/* @__PURE__ */ t.jsx(k, { className: "h-4 w-4" }),
|
|
141
|
-
/* @__PURE__ */ t.jsx("span", { className: "sr-only", children: "Next slide" })
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
I.displayName = "CarouselNext";
|
|
148
|
-
export {
|
|
149
|
-
z as Carousel,
|
|
150
|
-
g as CarouselContent,
|
|
151
|
-
E as CarouselItem,
|
|
152
|
-
I as CarouselNext,
|
|
153
|
-
D as CarouselPrevious
|
|
154
|
-
};
|
|
155
|
-
//# sourceMappingURL=carousel.mjs.map
|
|
113
|
+
m.displayName = "CarouselNext";
|
|
114
|
+
//#endregion
|
|
115
|
+
export { u as Carousel, d as CarouselContent, f as CarouselItem, m as CarouselNext, p as CarouselPrevious };
|
|
116
|
+
|
|
117
|
+
//# sourceMappingURL=carousel.mjs.map
|
package/dist/carousel.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.mjs","sources":["../packages/ui-web/src/carousel.tsx"],"sourcesContent":["'use client';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ArrowLeft, ArrowRight } from 'lucide-react';\nimport * as React from 'react';\n\nimport {\n CarouselBaseProps,\n CarouselContentBaseProps,\n CarouselItemBaseProps,\n CarouselNextBaseProps,\n CarouselPreviousBaseProps,\n} from '@gv-tech/ui-core';\nimport { Button } from './button';\nimport { cn } from './lib/utils';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = React.HTMLAttributes<HTMLDivElement> &\n CarouselBaseProps & {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n setApi?: (api: CarouselApi) => void;\n };\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />');\n }\n\n return context;\n}\n\nconst Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(\n ({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }, ref) => {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) {\n return;\n }\n\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n },\n);\nCarousel.displayName = 'Carousel';\n\nconst CarouselContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & CarouselContentBaseProps\n>(({ className, ...props }, ref) => {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)}\n {...props}\n />\n </div>\n );\n});\nCarouselContent.displayName = 'CarouselContent';\n\nconst CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselItemBaseProps>(\n ({ className, ...props }, ref) => {\n const { orientation } = useCarousel();\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'pl-4' : 'pt-4', className)}\n {...props}\n />\n );\n },\n);\nCarouselItem.displayName = 'CarouselItem';\n\nconst CarouselPrevious = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button> & CarouselPreviousBaseProps\n>(({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -left-12 -translate-y-1/2'\n : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft className=\"h-4 w-4\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n});\nCarouselPrevious.displayName = 'CarouselPrevious';\n\nconst CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button> & CarouselNextBaseProps>(\n ({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -right-12 -translate-y-1/2'\n : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight className=\"h-4 w-4\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n },\n);\nCarouselNext.displayName = 'CarouselNext';\n\nexport { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CarouselApi };\nexport type { CarouselProps };\n"],"names":["CarouselContext","React","useCarousel","context","Carousel","orientation","opts","setApi","plugins","className","children","props","ref","carouselRef","api","useEmblaCarousel","canScrollPrev","setCanScrollPrev","canScrollNext","setCanScrollNext","onSelect","scrollPrev","scrollNext","handleKeyDown","event","jsx","cn","CarouselContent","CarouselItem","CarouselPrevious","variant","size","jsxs","Button","ArrowLeft","CarouselNext","ArrowRight"],"mappings":";;;;;AAoCA,MAAMA,IAAkBC,EAAM,cAA2C,IAAI;AAE7E,SAASC,IAAc;AACrB,QAAMC,IAAUF,EAAM,WAAWD,CAAe;AAEhD,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,gDAAgD;AAGlE,SAAOA;AACT;AAEA,MAAMC,IAAWH,EAAM;AAAA,EACrB,CAAC,EAAE,aAAAI,IAAc,cAAc,MAAAC,GAAM,QAAAC,GAAQ,SAAAC,GAAS,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,GAASC,MAAQ;AAC7F,UAAM,CAACC,GAAaC,CAAG,IAAIC;AAAA,MACzB;AAAA,QACE,GAAGT;AAAA,QACH,MAAMD,MAAgB,eAAe,MAAM;AAAA,MAAA;AAAA,MAE7CG;AAAA,IAAA,GAEI,CAACQ,GAAeC,CAAgB,IAAIhB,EAAM,SAAS,EAAK,GACxD,CAACiB,GAAeC,CAAgB,IAAIlB,EAAM,SAAS,EAAK,GAExDmB,IAAWnB,EAAM,YAAY,CAACa,MAAqB;AACvD,MAAKA,MAILG,EAAiBH,EAAI,eAAe,GACpCK,EAAiBL,EAAI,eAAe;AAAA,IACtC,GAAG,CAAA,CAAE,GAECO,IAAapB,EAAM,YAAY,MAAM;AACzC,MAAAa,GAAK,WAAA;AAAA,IACP,GAAG,CAACA,CAAG,CAAC,GAEFQ,IAAarB,EAAM,YAAY,MAAM;AACzC,MAAAa,GAAK,WAAA;AAAA,IACP,GAAG,CAACA,CAAG,CAAC,GAEF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AAAc,gBAAAA,EAAAA,IAACS,GAAA,EAAU,WAAU,UAAA,CAAU;AAAA,QAC/BT,gBAAAA,EAAAA,IAAC,QAAA,EAAK,WAAU,WAAU,UAAA,iBAAA,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG9C,CAAC;AACDI,EAAiB,cAAc;AAE/B,MAAMM,IAAelC,EAAM;AAAA,EACzB,CAAC,EAAE,WAAAQ,GAAW,SAAAqB,IAAU,WAAW,MAAAC,IAAO,QAAQ,GAAGpB,EAAA,GAASC,MAAQ;AACpE,UAAM,EAAE,aAAAP,GAAa,YAAAiB,GAAY,eAAAJ,EAAA,IAAkBhB,EAAA;AAEnD,WACE8B,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAArB;AAAA,QACA,SAAAkB;AAAA,QACA,MAAAC;AAAA,QACA,WAAWL;AAAA,UACT;AAAA,UACArB,MAAgB,eACZ,uCACA;AAAA,UACJI;AAAA,QAAA;AAAA,QAEF,UAAU,CAACS;AAAA,QACX,SAASI;AAAA,QACR,GAAGX;AAAA,QAEJ,UAAA;AAAA,UAAAc,gBAAAA,EAAAA,IAACW,GAAA,EAAW,WAAU,UAAA,CAAU;AAAA,UAChCX,gBAAAA,EAAAA,IAAC,QAAA,EAAK,WAAU,WAAU,UAAA,aAAA,CAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG1C;AACF;AACAU,EAAa,cAAc;"}
|
|
1
|
+
{"version":3,"file":"carousel.mjs","names":[],"sources":["../packages/ui-web/src/carousel.tsx"],"sourcesContent":["'use client';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ArrowLeft, ArrowRight } from 'lucide-react';\nimport * as React from 'react';\n\nimport {\n CarouselBaseProps,\n CarouselContentBaseProps,\n CarouselItemBaseProps,\n CarouselNextBaseProps,\n CarouselPreviousBaseProps,\n} from '@gv-tech/ui-core';\nimport { Button } from './button';\nimport { cn } from './lib/utils';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = React.HTMLAttributes<HTMLDivElement> &\n CarouselBaseProps & {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n setApi?: (api: CarouselApi) => void;\n };\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />');\n }\n\n return context;\n}\n\nconst Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(\n ({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }, ref) => {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) {\n return;\n }\n\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n },\n);\nCarousel.displayName = 'Carousel';\n\nconst CarouselContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & CarouselContentBaseProps\n>(({ className, ...props }, ref) => {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)}\n {...props}\n />\n </div>\n );\n});\nCarouselContent.displayName = 'CarouselContent';\n\nconst CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselItemBaseProps>(\n ({ className, ...props }, ref) => {\n const { orientation } = useCarousel();\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'pl-4' : 'pt-4', className)}\n {...props}\n />\n );\n },\n);\nCarouselItem.displayName = 'CarouselItem';\n\nconst CarouselPrevious = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button> & CarouselPreviousBaseProps\n>(({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -left-12 -translate-y-1/2'\n : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft className=\"h-4 w-4\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n});\nCarouselPrevious.displayName = 'CarouselPrevious';\n\nconst CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button> & CarouselNextBaseProps>(\n ({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -right-12 -translate-y-1/2'\n : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight className=\"h-4 w-4\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n },\n);\nCarouselNext.displayName = 'CarouselNext';\n\nexport { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CarouselApi };\nexport type { CarouselProps };\n"],"mappings":";;;;;;;aAoCM,IAAkB,EAAM,cAA2C,KAAK;AAE9E,SAAS,IAAc;CACrB,IAAM,IAAU,EAAM,WAAW,EAAgB;AAEjD,KAAI,CAAC,EACH,OAAU,MAAM,iDAAiD;AAGnE,QAAO;;AAGT,IAAM,IAAW,EAAM,YACpB,EAAE,iBAAc,cAAc,SAAM,WAAQ,YAAS,cAAW,aAAU,GAAG,KAAS,MAAQ;CAC7F,IAAM,CAAC,GAAa,KAAO,EACzB;EACE,GAAG;EACH,MAAM,MAAgB,eAAe,MAAM;EAC5C,EACD,EACD,EACK,CAAC,GAAe,KAAoB,EAAM,SAAS,GAAM,EACzD,CAAC,GAAe,KAAo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GAAA,EAAA,KAAC,QAAD;GAAM,WAAU;aAAU;GAAiB,CAAA,CACpC;;EAGd;AACD,EAAa,cAAc"}
|
package/dist/chart.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use client";"use
|
|
2
|
-
${
|
|
3
|
-
${n.map(([
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./rolldown-runtime-CacfPODE.js`),t=require(`./vendor-D3ZzLf8D.js`),n=require(`./utils-CbSX47LV.js`);let r=require(`react`);r=e.r(r);var i=t.vr(),a={light:``,dark:`.dark`},o=r.createContext(null);function s(){let e=r.useContext(o);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}var c=r.forwardRef(({id:e,className:a,children:s,config:c,...u},d)=>{let f=r.useId(),p=`chart-${e||f.replace(/:/g,``)}`;return(0,i.jsx)(o.Provider,{value:{config:c},children:(0,i.jsxs)(`div`,{"data-chart":p,ref:d,className:n.t(`[&_.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-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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-sector]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-none`,a),...u,children:[(0,i.jsx)(l,{id:p,config:c}),(0,i.jsx)(t.yn,{children:s})]})})});c.displayName=`Chart`;var l=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,i.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(a).map(([t,r])=>`
|
|
2
|
+
${r} [data-chart=${e}] {
|
|
3
|
+
${n.map(([e,n])=>{let r=n.theme?.[t]||n.color;return r?` --color-${e}: ${r};`:null}).join(`
|
|
4
4
|
`)}
|
|
5
5
|
}
|
|
6
6
|
`).join(`
|
|
7
|
-
`)}}):null},
|
|
8
|
-
//# sourceMappingURL=chart.cjs.map
|
|
7
|
+
`)}}):null},u=t._n,d=r.forwardRef(({active:e,payload:t,className:a,indicator:o=`dot`,hideLabel:c=!1,hideIndicator:l=!1,label:u,labelFormatter:d,labelClassName:f,formatter:p,color:h,nameKey:g,labelKey:_},v)=>{let{config:y}=s(),b=r.useMemo(()=>{if(c||!t?.length)return null;let[e]=t,r=m(y,e,`${_||e?.dataKey||e?.name||`value`}`),a=!_&&typeof u==`string`?y[u]?.label||u:r?.label;return d?(0,i.jsx)(`div`,{className:n.t(`font-medium`,f),children:d(a,t)}):a?(0,i.jsx)(`div`,{className:n.t(`font-medium`,f),children:a}):null},[u,d,t,c,f,y,_]);if(!e||!t?.length)return null;let x=t.length===1&&o!==`dot`;return(0,i.jsxs)(`div`,{ref:v,className:n.t(`border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl`,a),children:[x?null:b,(0,i.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let r=m(y,e,`${g||e.name||e.dataKey||`value`}`),a=h||e.payload.fill||e.color;return(0,i.jsx)(`div`,{className:n.t(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,o===`dot`&&`items-center`),children:p&&e?.value!==void 0&&e.name?p(e.value,e.name,e,t,e.payload):(0,i.jsxs)(i.Fragment,{children:[r?.icon?(0,i.jsx)(r.icon,{}):!l&&(0,i.jsx)(`div`,{className:n.t(`shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]`,{"h-2.5 w-2.5":o===`dot`,"w-1":o===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":o===`dashed`,"my-0.5":x&&o===`dashed`}),style:{"--color-bg":a,"--color-border":a}}),(0,i.jsxs)(`div`,{className:n.t(`flex flex-1 justify-between leading-none`,x?`items-end`:`items-center`),children:[(0,i.jsxs)(`div`,{className:`grid gap-1.5`,children:[x?b:null,(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:r?.label||e.name})]}),e.value&&(0,i.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:e.value.toLocaleString()})]})]})},typeof e.dataKey==`function`?t:e.dataKey??t)})})]})});d.displayName=`ChartTooltip`;var f=t.vn,p=r.forwardRef(({className:e,hideIcon:t=!1,payload:r,verticalAlign:a=`bottom`,nameKey:o},c)=>{let{config:l}=s();return r?.length?(0,i.jsx)(`div`,{ref:c,className:n.t(`flex items-center justify-center gap-4`,a===`top`?`pb-3`:`pt-3`,e),children:r.filter(e=>e.type!==`none`).map(e=>{let r=m(l,e,`${o||e.dataKey||`value`}`);return(0,i.jsxs)(`div`,{className:n.t(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[r?.icon&&!t?(0,i.jsx)(r.icon,{}):(0,i.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),r?.label]},e.value)})}):null});p.displayName=`ChartLegend`;function m(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}exports.ChartContainer=c,exports.ChartLegend=f,exports.ChartLegendContent=p,exports.ChartStyle=l,exports.ChartTooltip=u,exports.ChartTooltipContent=d;
|
|
8
|
+
//# sourceMappingURL=chart.cjs.map
|
package/dist/chart.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.cjs","sources":["../packages/ui-web/src/chart.tsx"],"sourcesContent":["'use client';\nimport * as React from 'react';\nimport * as RechartsPrimitive from 'recharts';\n\nimport {\n ChartConfig,\n ChartContainerBaseProps,\n ChartLegendContentBaseProps,\n ChartTooltipContentBaseProps,\n} from '@gv-tech/ui-core';\nimport { cn } from './lib/utils';\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const;\n\ntype ChartContextProps = {\n config: ChartConfig;\n};\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null);\n\nfunction useChart() {\n const context = React.useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nconst ChartContainer = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> &\n ChartContainerBaseProps & {\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n }\n>(({ id, className, children, config, ...props }, ref) => {\n const uniqueId = React.useId();\n const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-chart={chartId}\n ref={ref}\n className={cn(\n \"[&_.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-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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-sector]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-none\",\n className,\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n});\nChartContainer.displayName = 'Chart';\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme || itemConfig.color);\n\n if (!colorConfig.length) {\n return null;\n }\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme as keyof typeof THEMES] || itemConfig.color;\n return color ? ` --color-${key}: ${color};` : null;\n })\n .join('\\n')}\n}\n`,\n )\n .join('\\n'),\n }}\n />\n );\n};\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\nconst ChartTooltipContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof RechartsPrimitive.Tooltip> & React.ComponentProps<'div'> & ChartTooltipContentBaseProps\n>(\n (\n {\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n },\n ref,\n ) => {\n const { config } = useChart();\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value =\n !labelKey && typeof label === 'string'\n ? config[label as keyof typeof config]?.label || label\n : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>;\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot';\n\n return (\n <div\n ref={ref}\n className={cn(\n 'border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',\n className,\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color || ((item.payload as Record<string, unknown>).fill as string) || item.color;\n\n return (\n <div\n key={item.dataKey}\n className={cn(\n '[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',\n indicator === 'dot' && 'items-center',\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn('shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]', {\n 'h-2.5 w-2.5': indicator === 'dot',\n 'w-1': indicator === 'line',\n 'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',\n 'my-0.5': nestLabel && indicator === 'dashed',\n })}\n style={\n {\n '--color-bg': indicatorColor,\n '--color-border': indicatorColor,\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n 'flex flex-1 justify-between leading-none',\n nestLabel ? 'items-end' : 'items-center',\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">{itemConfig?.label || item.name}</span>\n </div>\n {item.value && (\n <span className=\"text-foreground font-mono font-medium tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n },\n);\nChartTooltipContent.displayName = 'ChartTooltip';\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\nconst ChartLegendContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> &\n Pick<RechartsPrimitive.LegendProps, 'payload' | 'verticalAlign'> &\n ChartLegendContentBaseProps\n>(({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }, ref) => {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div\n ref={ref}\n className={cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className)}\n >\n {payload\n .filter((item) => item.type !== 'none')\n .map((item) => {\n const key = `${nameKey || item.dataKey || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div\n key={item.value}\n className={cn('[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3')}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n});\nChartLegendContent.displayName = 'ChartLegend';\n\n// Helper to extract item config from a payload.\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload &&\n typeof (payload as { payload: unknown }).payload === 'object' &&\n (payload as { payload: unknown }).payload !== null\n ? ((payload as { payload: unknown }).payload as Record<string, unknown>)\n : undefined;\n\n let configLabelKey: string = key;\n\n if (key in payload && typeof (payload as Record<string, unknown>)[key] === 'string') {\n configLabelKey = (payload as Record<string, unknown>)[key] as string;\n } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === 'string') {\n configLabelKey = payloadPayload[key] as string;\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];\n}\n\nexport { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };\nexport type { ChartConfig };\n"],"names":["THEMES","ChartContext","React","useChart","context","ChartContainer","id","className","children","config","props","ref","uniqueId","chartId","jsxs","cn","jsx","ChartStyle","RechartsPrimitive.ResponsiveContainer","colorConfig","itemConfig","theme","prefix","key","color","ChartTooltip","RechartsPrimitive.Tooltip","ChartTooltipContent","active","payload","indicator","hideLabel","hideIndicator","label","labelFormatter","labelClassName","formatter","nameKey","labelKey","tooltipLabel","item","getPayloadConfigFromPayload","value","nestLabel","index","indicatorColor","Fragment","ChartLegend","RechartsPrimitive.Legend","ChartLegendContent","hideIcon","verticalAlign","payloadPayload","configLabelKey"],"mappings":"mdAaMA,EAAS,CAAE,MAAO,GAAI,KAAM,OAAA,EAM5BC,EAAeC,EAAM,cAAwC,IAAI,EAEvE,SAASC,GAAW,CAClB,MAAMC,EAAUF,EAAM,WAAWD,CAAY,EAE7C,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,mDAAmD,EAGrE,OAAOA,CACT,CAEA,MAAMC,EAAiBH,EAAM,WAM3B,CAAC,CAAE,GAAAI,EAAI,UAAAC,EAAW,SAAAC,EAAU,OAAAC,EAAQ,GAAGC,CAAA,EAASC,IAAQ,CACxD,MAAMC,EAAWV,EAAM,MAAA,EACjBW,EAAU,SAASP,GAAMM,EAAS,QAAQ,KAAM,EAAE,CAAC,GAEzD,+BACGX,EAAa,SAAb,CAAsB,MAAO,CAAE,OAAAQ,GAC9B,SAAAK,EAAAA,kBAAAA,KAAC,MAAA,CACC,aAAYD,EACZ,IAAAF,EACA,UAAWI,EAAAA,GACT,wpBACAR,CAAA,EAED,GAAGG,EAEJ,SAAA,CAAAM,EAAAA,kBAAAA,IAACC,EAAA,CAAW,GAAIJ,EAAS,OAAAJ,CAAA,CAAgB,EACzCO,wBAACE,EAAAA,oBAAA,CAAuC,SAAAV,CAAA,CAAS,CAAA,CAAA,CAAA,EAErD,CAEJ,CAAC,EACDH,EAAe,YAAc,QAE7B,MAAMY,EAAa,CAAC,CAAE,GAAAX,EAAI,OAAAG,KAAkD,CAC1E,MAAMU,EAAc,OAAO,QAAQV,CAAM,EAAE,OAAO,CAAC,CAAA,CAAGW,CAAU,IAA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,UAAU,iCACV,MAAO,CACL,gBAAiBwB,EAAK,KAAA,CACxB,CAAA,EAGHpB,GAAY,KAAA,CAAA,EAbRoB,EAAK,KAAA,CAgBhB,CAAC,CAAA,CAAA,EAhCE,IAmCX,CAAC,EACDS,EAAmB,YAAc,cAGjC,SAASR,EAA4BhC,EAAqBoB,EAAkBN,EAAa,CACvF,GAAI,OAAOM,GAAY,UAAYA,IAAY,KAC7C,OAGF,MAAMuB,EACJ,YAAavB,GACb,OAAQA,EAAiC,SAAY,UACpDA,EAAiC,UAAY,KACxCA,EAAiC,QACnC,OAEN,IAAIwB,EAAyB9B,EAE7B,OAAIA,KAAOM,GAAW,OAAQA,EAAoCN,CAAG,GAAM,SACzE8B,EAAkBxB,EAAoCN,CAAG,EAChD6B,GAAkB7B,KAAO6B,GAAkB,OAAOA,EAAe7B,CAAG,GAAM,WACnF8B,EAAiBD,EAAe7B,CAAG,GAG9B8B,KAAkB5C,EAASA,EAAO4C,CAAc,EAAI5C,EAAOc,CAA0B,CAC9F"}
|
|
1
|
+
{"version":3,"file":"chart.cjs","names":[],"sources":["../packages/ui-web/src/chart.tsx"],"sourcesContent":["'use client';\nimport * as React from 'react';\nimport * as RechartsPrimitive from 'recharts';\n\nimport {\n ChartConfig,\n ChartContainerBaseProps,\n ChartLegendContentBaseProps,\n ChartTooltipContentBaseProps,\n} from '@gv-tech/ui-core';\nimport { cn } from './lib/utils';\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const;\n\ntype ChartContextProps = {\n config: ChartConfig;\n};\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null);\n\nfunction useChart() {\n const context = React.useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nconst ChartContainer = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> &\n ChartContainerBaseProps & {\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n }\n>(({ id, className, children, config, ...props }, ref) => {\n const uniqueId = React.useId();\n const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-chart={chartId}\n ref={ref}\n className={cn(\n \"[&_.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-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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-sector]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-none\",\n className,\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n});\nChartContainer.displayName = 'Chart';\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme || itemConfig.color);\n\n if (!colorConfig.length) {\n return null;\n }\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme as keyof typeof THEMES] || itemConfig.color;\n return color ? ` --color-${key}: ${color};` : null;\n })\n .join('\\n')}\n}\n`,\n )\n .join('\\n'),\n }}\n />\n );\n};\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\nconst ChartTooltipContent = React.forwardRef<\n HTMLDivElement,\n Partial<RechartsPrimitive.TooltipContentProps> & React.ComponentProps<'div'> & ChartTooltipContentBaseProps\n>(\n (\n {\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n },\n ref,\n ) => {\n const { config } = useChart();\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value =\n !labelKey && typeof label === 'string'\n ? config[label as keyof typeof config]?.label || label\n : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>;\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot';\n\n return (\n <div\n ref={ref}\n className={cn(\n 'border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',\n className,\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item: RechartsPrimitive.TooltipPayloadEntry) => item.type !== 'none')\n .map((item: RechartsPrimitive.TooltipPayloadEntry, index: number) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color || ((item.payload as Record<string, unknown>).fill as string) || item.color;\n\n return (\n <div\n key={typeof item.dataKey === 'function' ? index : (item.dataKey ?? index)}\n className={cn(\n '[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',\n indicator === 'dot' && 'items-center',\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn('shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]', {\n 'h-2.5 w-2.5': indicator === 'dot',\n 'w-1': indicator === 'line',\n 'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',\n 'my-0.5': nestLabel && indicator === 'dashed',\n })}\n style={\n {\n '--color-bg': indicatorColor,\n '--color-border': indicatorColor,\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n 'flex flex-1 justify-between leading-none',\n nestLabel ? 'items-end' : 'items-center',\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">{itemConfig?.label || item.name}</span>\n </div>\n {item.value && (\n <span className=\"text-foreground font-mono font-medium tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n },\n);\nChartTooltipContent.displayName = 'ChartTooltip';\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\nconst ChartLegendContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> &\n Pick<RechartsPrimitive.DefaultLegendContentProps, 'payload' | 'verticalAlign'> &\n ChartLegendContentBaseProps\n>(({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }, ref) => {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div\n ref={ref}\n className={cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className)}\n >\n {payload\n .filter((item: RechartsPrimitive.LegendPayload) => item.type !== 'none')\n .map((item: RechartsPrimitive.LegendPayload) => {\n const key = `${nameKey || item.dataKey || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div\n key={item.value}\n className={cn('[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3')}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n});\nChartLegendContent.displayName = 'ChartLegend';\n\n// Helper to extract item config from a payload.\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload &&\n typeof (payload as { payload: unknown }).payload === 'object' &&\n (payload as { payload: unknown }).payload !== null\n ? ((payload as { payload: unknown }).payload as Record<string, unknown>)\n : undefined;\n\n let configLabelKey: string = key;\n\n if (key in payload && typeof (payload as Record<string, unknown>)[key] === 'string') {\n configLabelKey = (payload as Record<string, unknown>)[key] as string;\n } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === 'string') {\n configLabelKey = payloadPayload[key] as string;\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];\n}\n\nexport { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };\nexport type { ChartConfig };\n"],"mappings":"+PAaM,EAAS,CAAE,MAAO,GAAI,KAAM,QAAS,CAMrC,EAAe,EAAM,cAAwC,KAAK,CAExE,SAAS,GAAW,CAClB,IAAM,EAAU,EAAM,WAAW,EAAa,CAE9C,GAAI,CAAC,EACH,MAAU,MAAM,oDAAoD,CAGtE,OAAO,EAGT,IAAM,EAAiB,EAAM,YAM1B,CAAE,KAAI,YAAW,WAAU,SAAQ,GAAG,GAAS,IAAQ,CACxD,IAAM,EAAW,EAAM,OAAO,CACxB,EAAU,SAAS,GAAM,EAAS,QAAQ,KAAM,GAAG,GAEzD,OACE,EAAA,EAAA,KAAC,EAAa,SAAd,CAAuB,MAAO,CAAE,SAAQ,WACtC,EAAA,EAAA,MAAC,MAAD,CACE,aAAY,EACP,MACL,UAAW,EAAA,EACT,wp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O,GAAW,OAAQ,EAAoC,IAAS,SACzE,EAAkB,EAAoC,GAC7C,GAAkB,KAAO,GAAkB,OAAO,EAAe,IAAS,WACnF,EAAiB,EAAe,IAG3B,KAAkB,EAAS,EAAO,GAAkB,EAAO"}
|
package/dist/chart.d.ts
CHANGED
|
@@ -1,90 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { AnimationTiming } from 'recharts/types/util/types';
|
|
4
|
-
import { CartesianViewBox } from 'recharts/types/util/types';
|
|
5
|
-
import { ContentType } from 'recharts/types/component/Tooltip';
|
|
6
|
-
import { Coordinate } from 'recharts/types/util/types';
|
|
7
|
-
import { JSX } from 'react/jsx-runtime';
|
|
8
|
-
import { NameType } from 'recharts/types/component/DefaultTooltipContent';
|
|
9
|
-
import { Payload } from 'recharts/types/component/DefaultTooltipContent';
|
|
10
|
-
import * as React_2 from 'react';
|
|
11
|
-
import * as RechartsPrimitive from 'recharts';
|
|
12
|
-
import { UniqueOption } from 'recharts/types/util/payload/getUniqPayload';
|
|
13
|
-
import { ValueType } from 'recharts/types/component/DefaultTooltipContent';
|
|
14
|
-
|
|
15
|
-
export declare type ChartConfig = {
|
|
16
|
-
[k in string]: {
|
|
17
|
-
label?: React_2.ReactNode;
|
|
18
|
-
icon?: React_2.ComponentType;
|
|
19
|
-
} & ({
|
|
20
|
-
color?: string;
|
|
21
|
-
theme?: never;
|
|
22
|
-
} | {
|
|
23
|
-
color?: never;
|
|
24
|
-
theme: Record<string, string>;
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export declare const ChartContainer: React_2.ForwardRefExoticComponent<Omit<React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & ChartContainerBaseProps & {
|
|
29
|
-
children: React_2.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
30
|
-
}, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
31
|
-
|
|
32
|
-
declare interface ChartContainerBaseProps {
|
|
33
|
-
config: ChartConfig;
|
|
34
|
-
className?: string;
|
|
35
|
-
children?: React_2.ReactNode;
|
|
36
|
-
id?: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
40
|
-
|
|
41
|
-
export declare const ChartLegendContent: React_2.ForwardRefExoticComponent<Omit<React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & ChartLegendContentBaseProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
42
|
-
|
|
43
|
-
declare interface ChartLegendContentBaseProps {
|
|
44
|
-
hideIcon?: boolean;
|
|
45
|
-
nameKey?: string;
|
|
46
|
-
className?: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export declare const ChartStyle: ({ id, config }: {
|
|
50
|
-
id: string;
|
|
51
|
-
config: ChartConfig;
|
|
52
|
-
}) => JSX.Element | null;
|
|
53
|
-
|
|
54
|
-
export declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
55
|
-
|
|
56
|
-
export declare const ChartTooltipContent: React_2.ForwardRefExoticComponent<Omit<RechartsPrimitive.DefaultTooltipContentProps< ValueType, NameType> & {
|
|
57
|
-
accessibilityLayer?: boolean;
|
|
58
|
-
active?: boolean | undefined;
|
|
59
|
-
includeHidden?: boolean | undefined;
|
|
60
|
-
allowEscapeViewBox?: AllowInDimension;
|
|
61
|
-
animationDuration?: AnimationDuration;
|
|
62
|
-
animationEasing?: AnimationTiming;
|
|
63
|
-
content?: ContentType<ValueType, NameType> | undefined;
|
|
64
|
-
coordinate?: Partial< Coordinate>;
|
|
65
|
-
cursor?: boolean | React_2.ReactElement | React_2.SVGProps<SVGElement>;
|
|
66
|
-
filterNull?: boolean;
|
|
67
|
-
defaultIndex?: number;
|
|
68
|
-
isAnimationActive?: boolean;
|
|
69
|
-
offset?: number;
|
|
70
|
-
payloadUniqBy?: UniqueOption<Payload<ValueType, NameType>> | undefined;
|
|
71
|
-
position?: Partial< Coordinate>;
|
|
72
|
-
reverseDirection?: AllowInDimension;
|
|
73
|
-
shared?: boolean;
|
|
74
|
-
trigger?: "hover" | "click";
|
|
75
|
-
useTranslate3d?: boolean;
|
|
76
|
-
viewBox?: CartesianViewBox;
|
|
77
|
-
wrapperStyle?: React_2.CSSProperties;
|
|
78
|
-
} & React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & ChartTooltipContentBaseProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
79
|
-
|
|
80
|
-
declare interface ChartTooltipContentBaseProps {
|
|
81
|
-
hideLabel?: boolean;
|
|
82
|
-
hideIndicator?: boolean;
|
|
83
|
-
indicator?: 'line' | 'dot' | 'dashed';
|
|
84
|
-
nameKey?: string;
|
|
85
|
-
labelKey?: string;
|
|
86
|
-
className?: string;
|
|
87
|
-
labelClassName?: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export { }
|
|
1
|
+
export * from './packages/ui-web/src/chart'
|
|
2
|
+
export {}
|