@egose/shadcn-theme 0.0.47 → 0.0.49
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/{chunk-NTLH66CV.mjs → chunk-4NMFJSJN.mjs} +12 -10
- package/chunk-4NMFJSJN.mjs.map +1 -0
- package/{chunk-AHLTYVNO.mjs → chunk-54PLQ33F.mjs} +2 -2
- package/{chunk-LD2UPPDV.mjs → chunk-674CL6CM.mjs} +8 -8
- package/{chunk-G76KR3EI.js → chunk-6LGAYFGF.js} +9 -9
- package/{chunk-G76KR3EI.js.map → chunk-6LGAYFGF.js.map} +1 -1
- package/{chunk-I6HL2O3N.js → chunk-73VYAPJR.js} +4 -4
- package/{chunk-I6HL2O3N.js.map → chunk-73VYAPJR.js.map} +1 -1
- package/{chunk-4NENCAVM.js → chunk-EZZ2YCUU.js} +12 -10
- package/chunk-EZZ2YCUU.js.map +1 -0
- package/chunk-FHSYSVS6.mjs +133 -0
- package/chunk-FHSYSVS6.mjs.map +1 -0
- package/{chunk-YA6R7VDQ.mjs → chunk-FSBUJKT7.mjs} +7 -7
- package/{chunk-UYHM2DIT.js → chunk-GNIJ6SIH.js} +9 -9
- package/{chunk-UYHM2DIT.js.map → chunk-GNIJ6SIH.js.map} +1 -1
- package/{chunk-N53Y7EH3.mjs → chunk-IPTLI5N5.mjs} +3 -3
- package/{chunk-IBMKAE7V.js → chunk-MYO4WRNB.js} +3 -3
- package/{chunk-IBMKAE7V.js.map → chunk-MYO4WRNB.js.map} +1 -1
- package/{chunk-SX5LOZOU.mjs → chunk-P3TWGNQQ.mjs} +7 -7
- package/{chunk-X6IYOIMX.mjs → chunk-PS7WGOZH.mjs} +2 -2
- package/chunk-SCM23WSM.js +134 -0
- package/chunk-SCM23WSM.js.map +1 -0
- package/{chunk-LJBAZKOP.js → chunk-SHCDAPWS.js} +7 -7
- package/{chunk-LJBAZKOP.js.map → chunk-SHCDAPWS.js.map} +1 -1
- package/{chunk-WCKUFKRD.mjs → chunk-SKLZYIKR.mjs} +10 -10
- package/{chunk-HORDUR37.js → chunk-UAKQ4NXG.js} +6 -6
- package/{chunk-HORDUR37.js.map → chunk-UAKQ4NXG.js.map} +1 -1
- package/{chunk-SVBDFC23.js → chunk-YT6UTIPP.js} +5 -5
- package/{chunk-SVBDFC23.js.map → chunk-YT6UTIPP.js.map} +1 -1
- package/components/form/date-picker.js +4 -4
- package/components/form/date-picker.mjs +3 -3
- package/components/form/date-range-picker.js +4 -4
- package/components/form/date-range-picker.mjs +2 -2
- package/components/form/hook-date-picker.js +4 -4
- package/components/form/hook-date-picker.mjs +3 -3
- package/components/ui/alert-dialog.js +3 -3
- package/components/ui/alert-dialog.mjs +1 -1
- package/components/ui/alert.d.mts +9 -4
- package/components/ui/alert.d.ts +9 -4
- package/components/ui/alert.js +13 -50
- package/components/ui/alert.js.map +1 -1
- package/components/ui/alert.mjs +6 -43
- package/components/ui/alert.mjs.map +1 -1
- package/components/ui/badge.d.mts +3 -3
- package/components/ui/badge.d.ts +3 -3
- package/components/ui/badge.js +3 -3
- package/components/ui/badge.js.map +1 -1
- package/components/ui/badge.mjs +3 -3
- package/components/ui/badge.mjs.map +1 -1
- package/components/ui/basic-alert.d.mts +13 -0
- package/components/ui/basic-alert.d.ts +13 -0
- package/components/ui/basic-alert.js +74 -0
- package/components/ui/basic-alert.js.map +1 -0
- package/components/ui/basic-alert.mjs +73 -0
- package/components/ui/basic-alert.mjs.map +1 -0
- package/components/ui/button.d.mts +2 -2
- package/components/ui/button.d.ts +2 -2
- package/components/ui/button.js +2 -2
- package/components/ui/button.mjs +1 -1
- package/components/ui/calendar.js +3 -3
- package/components/ui/calendar.mjs +2 -2
- package/components/ui/carousel.js +3 -3
- package/components/ui/carousel.mjs +1 -1
- package/components/ui/command.d.mts +13 -13
- package/components/ui/command.d.ts +13 -13
- package/components/ui/pagination.js +2 -2
- package/components/ui/pagination.mjs +1 -1
- package/components/ui/resizable.d.mts +1 -1
- package/components/ui/resizable.d.ts +1 -1
- package/components/ui/separator.d.mts +2 -2
- package/components/ui/separator.d.ts +2 -2
- package/components/ui/sidebar.d.mts +3 -3
- package/components/ui/sidebar.d.ts +3 -3
- package/components/ui/sidebar.js +3 -3
- package/components/ui/sidebar.mjs +2 -2
- package/components/ui/toggle-group.d.mts +2 -2
- package/components/ui/toggle-group.d.ts +2 -2
- package/components/ui/toggle.d.mts +2 -2
- package/components/ui/toggle.d.ts +2 -2
- package/layouts/sidebar1/app-sidebar.js +10 -10
- package/layouts/sidebar1/app-sidebar.mjs +9 -9
- package/layouts/sidebar1/context-switcher.js +5 -5
- package/layouts/sidebar1/context-switcher.mjs +4 -4
- package/layouts/sidebar1/index.js +13 -13
- package/layouts/sidebar1/index.js.map +1 -1
- package/layouts/sidebar1/index.mjs +16 -16
- package/layouts/sidebar1/nav-menus.js +5 -5
- package/layouts/sidebar1/nav-menus.mjs +4 -4
- package/layouts/sidebar1/nav-user.js +6 -6
- package/layouts/sidebar1/nav-user.mjs +5 -5
- package/package.json +6 -6
- package/chunk-4NENCAVM.js.map +0 -1
- package/chunk-NTLH66CV.mjs.map +0 -1
- package/components/ui/chart.d.mts +0 -68
- package/components/ui/chart.d.ts +0 -68
- package/components/ui/chart.js +0 -216
- package/components/ui/chart.js.map +0 -1
- package/components/ui/chart.mjs +0 -215
- package/components/ui/chart.mjs.map +0 -1
- /package/{chunk-AHLTYVNO.mjs.map → chunk-54PLQ33F.mjs.map} +0 -0
- /package/{chunk-LD2UPPDV.mjs.map → chunk-674CL6CM.mjs.map} +0 -0
- /package/{chunk-YA6R7VDQ.mjs.map → chunk-FSBUJKT7.mjs.map} +0 -0
- /package/{chunk-N53Y7EH3.mjs.map → chunk-IPTLI5N5.mjs.map} +0 -0
- /package/{chunk-SX5LOZOU.mjs.map → chunk-P3TWGNQQ.mjs.map} +0 -0
- /package/{chunk-X6IYOIMX.mjs.map → chunk-PS7WGOZH.mjs.map} +0 -0
- /package/{chunk-WCKUFKRD.mjs.map → chunk-SKLZYIKR.mjs.map} +0 -0
package/chunk-NTLH66CV.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../components/ui/button.tsx"],"sourcesContent":["\"use client\";\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../lib/utils';\nimport { Spinner } from './spinner';\n\nconst buttonVariants = cva(\n [\n 'cursor-pointer',\n 'active:translate-y-[0.5px]',\n 'disabled:pointer-events-none',\n 'disabled:opacity-50',\n 'focus-visible:outline-none',\n 'focus-visible:ring-1',\n 'focus-visible:ring-ring',\n 'font-medium',\n 'gap-2',\n 'inline-flex',\n 'items-center',\n 'justify-center',\n 'rounded-sm',\n 'text-sm',\n 'transform',\n 'transition',\n 'transition-colors',\n 'whitespace-nowrap',\n '[&_svg]:pointer-events-none',\n '[&_svg]:shrink-0',\n '[&_svg]:size-4',\n ],\n {\n variants: {\n variant: {\n primary: 'border border-primary bg-primary text-primary-foreground shadow-sm hover:bg-primary/90',\n secondary: 'border border-secondary bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/90',\n success: 'border border-success bg-success text-success-foreground shadow-sm hover:bg-success/90',\n warning: 'border border-warning bg-warning text-warning-foreground shadow-sm hover:bg-warning/90',\n danger: 'border border-danger bg-danger text-danger-foreground shadow-sm hover:bg-danger/90',\n info: 'border border-info bg-info text-info-foreground shadow-sm hover:bg-info/90',\n light: 'border border-light bg-light text-light-foreground shadow-sm hover:bg-light/90',\n dark: 'border border-dark bg-dark text-dark-foreground shadow-sm hover:bg-dark/90',\n accent: 'border border-accent bg-accent text-accent-foreground shadow-sm hover:bg-accent/90',\n destructive:\n 'border border-destructive bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',\n muted: 'border border-muted bg-muted text-muted-foreground shadow-sm hover:bg-muted/90',\n link: 'text-primary underline-offset-4 hover:underline',\n ghost: 'hover:bg-light hover:text-light-foreground',\n },\n size: {\n default: 'h-9 px-4 py-2',\n sm: 'h-8 rounded-sm px-3 text-xs',\n lg: 'h-10 rounded-sm px-8',\n icon: 'h-9 w-9',\n 'compact-default': 'h-8 px-2 py-1',\n 'compact-sm': 'h-7 px-2 py-1',\n 'compact-lg': 'h-9 px-2 py-1',\n 'compact-icon': 'h-8 w-8',\n },\n appearance: {\n solid: '',\n outline: 'bg-white border',\n outlineFilled: 'bg-white border',\n },\n loading: {\n true: 'pointer-events-none',\n false: null,\n },\n },\n defaultVariants: {\n variant: 'primary',\n size: 'default',\n appearance: 'solid',\n loading: false,\n },\n },\n);\n\n// Type safety for variant and size\nexport type VariantType = NonNullable<VariantProps<typeof buttonVariants>['variant']>;\nexport type SizeType = NonNullable<VariantProps<typeof buttonVariants>['size']>;\nexport type VariantStyleType = NonNullable<VariantProps<typeof buttonVariants>['appearance']>;\n\nexport interface ButtonProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'size'>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n icon?: React.ReactNode;\n iconPosition?: 'left' | 'right';\n}\n\nfunction getOutlineClasses(variant: VariantType) {\n const colors: Record<VariantType, string> = {\n primary: 'border-primary text-primary shadow-sm hover:bg-primary/10',\n secondary: 'border-secondary text-secondary shadow-sm hover:bg-secondary/10',\n success: 'border-success text-success shadow-sm hover:bg-success/10',\n warning: 'border-warning text-warning shadow-sm hover:bg-warning/10',\n danger: 'border-danger text-danger shadow-sm hover:bg-danger/10',\n info: 'border-info text-info shadow-sm hover:bg-info/10',\n light: 'border-light text-light-foreground shadow-sm hover:bg-light/10',\n dark: 'border-dark text-dark shadow-sm hover:bg-dark/10',\n accent: 'border-accent text-accent shadow-sm hover:bg-accent/10',\n destructive: 'border-destructive text-destructive shadow-sm hover:bg-destructive/10',\n muted: 'border-muted text-muted-foreground shadow-sm hover:bg-muted/10',\n link: 'text-primary',\n ghost: 'text-light-foreground',\n };\n return colors[variant];\n}\n\nfunction getOutlineFilledClasses(variant: VariantType) {\n const colors: Record<VariantType, string> = {\n primary: 'hover:bg-primary hover:text-primary-foreground',\n secondary: 'hover:bg-secondary hover:text-secondary-foreground',\n success: 'hover:bg-success hover:text-success-foreground',\n warning: 'hover:bg-warning hover:text-warning-foreground',\n danger: 'hover:bg-danger hover:text-danger-foreground',\n info: 'hover:bg-info hover:text-info-foreground',\n light: 'hover:bg-light hover:text-light-foreground',\n dark: 'hover:bg-dark hover:text-dark-foreground',\n accent: 'hover:bg-accent hover:text-accent-foreground',\n destructive: 'hover:bg-destructive hover:text-destructive-foreground',\n muted: 'hover:bg-muted hover:text-muted-foreground',\n link: 'hover:underline',\n ghost: 'hover:bg-light',\n };\n return colors[variant];\n}\n\nfunction getSpinnerClasses(variant: VariantType) {\n const colors: Record<VariantType, string> = {\n primary: 'bg-primary text-primary-foreground',\n secondary: 'bg-secondary text-secondary-foreground',\n success: 'bg-success text-success-foreground',\n warning: 'bg-warning text-warning-foreground',\n danger: 'bg-danger text-danger-foreground',\n info: 'bg-info text-info-foreground',\n light: 'bg-light text-light-foreground',\n dark: 'bg-dark text-dark-foreground',\n accent: 'bg-accent text-accent-foreground',\n destructive: 'bg-destructive text-destructive-foreground',\n muted: 'bg-muted text-muted-foreground',\n link: 'text-primary',\n ghost: 'text-light-foreground',\n };\n return colors[variant];\n}\n\nfunction getOutlineSpinnerClasses(variant: VariantType) {\n const colors: Record<VariantType, string> = {\n primary: 'text-primary',\n secondary: 'text-secondary',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-danger',\n info: 'text-info',\n light: 'text-light',\n dark: 'text-dark',\n accent: 'text-accent',\n destructive: 'text-destructive',\n muted: 'text-muted-foreground',\n link: 'text-primary',\n ghost: 'text-light-foreground',\n };\n return colors[variant];\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n { className, variant, size, appearance, loading, icon, iconPosition = 'left', asChild = false, children, ...props },\n ref,\n ) => {\n const Comp = asChild ? Slot : 'button';\n\n const outlineClasses =\n appearance === 'outline' || appearance === 'outlineFilled' ? [getOutlineClasses(variant as VariantType)] : [];\n\n if (appearance === 'outlineFilled') {\n outlineClasses.push(getOutlineFilledClasses(variant as VariantType));\n }\n\n const spinnerClasses =\n appearance === 'outline' || appearance === 'outlineFilled'\n ? getOutlineSpinnerClasses(variant as VariantType)\n : getSpinnerClasses(variant as VariantType);\n\n return (\n <Comp\n type=\"button\"\n className={cn(buttonVariants({ variant, size, appearance, loading, className }), outlineClasses)}\n ref={ref}\n aria-busy={loading || undefined}\n disabled={loading || props.disabled}\n {...props}\n >\n {loading ? (\n <div className=\"relative inline-flex items-center justify-center w-full\">\n <span className=\"invisible\">{children}</span>\n <span className=\"absolute inset-0 flex items-center justify-center\">\n <Spinner className={cn(spinnerClasses, 'animate-spin')} />\n </span>\n </div>\n ) : (\n <div className=\"flex items-center gap-1\">\n {icon && iconPosition === 'left' && <span className=\"flex-shrink-0\">{icon}</span>}\n {children}\n {icon && iconPosition === 'right' && <span className=\"flex-shrink-0\">{icon}</span>}\n </div>\n )}\n </Comp>\n );\n },\n);\n\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\n"],"mappings":";;;;;;;;;;;;AACA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AAIvC,IAAM,iBAAiB;AAAA,EACrB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WAAW;AAAA,QACX,SAAS;AAAA,QACT,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,MAAM;AAAA,QACN,OAAO;AAAA,QACP,MAAM;AAAA,QAC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AAAA,SACvB;AAAA,MAEH,UACC,oCAAC,SAAI,WAAU,6DACb,oCAAC,UAAK,WAAU,eAAa,QAAS,GACtC,oCAAC,UAAK,WAAU,uDACd,oCAAC,WAAQ,WAAW,GAAG,gBAAgB,cAAc,GAAG,CAC1D,CACF,IAEA,oCAAC,SAAI,WAAU,6BACZ,QAAQ,iBAAiB,UAAU,oCAAC,UAAK,WAAU,mBAAiB,IAAK,GACzE,UACA,QAAQ,iBAAiB,WAAW,oCAAC,UAAK,WAAU,mBAAiB,IAAK,CAC7E;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,OAAO,cAAc;","names":[]}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import * as recharts_types_util_payload_getUniqPayload from 'recharts/types/util/payload/getUniqPayload';
|
|
2
|
-
import * as recharts_types_component_Tooltip from 'recharts/types/component/Tooltip';
|
|
3
|
-
import * as recharts_types_util_types from 'recharts/types/util/types';
|
|
4
|
-
import * as recharts_types_component_DefaultTooltipContent from 'recharts/types/component/DefaultTooltipContent';
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import * as RechartsPrimitive from 'recharts';
|
|
7
|
-
|
|
8
|
-
declare const THEMES: {
|
|
9
|
-
readonly light: "";
|
|
10
|
-
readonly dark: ".dark";
|
|
11
|
-
};
|
|
12
|
-
type ChartConfig = {
|
|
13
|
-
[k in string]: {
|
|
14
|
-
label?: React.ReactNode;
|
|
15
|
-
icon?: React.ComponentType;
|
|
16
|
-
} & ({
|
|
17
|
-
color?: string;
|
|
18
|
-
theme?: never;
|
|
19
|
-
} | {
|
|
20
|
-
color?: never;
|
|
21
|
-
theme: Record<keyof typeof THEMES, string>;
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
declare const ChartContainer: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
25
|
-
config: ChartConfig;
|
|
26
|
-
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
27
|
-
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
-
declare const ChartStyle: ({ id, config }: {
|
|
29
|
-
id: string;
|
|
30
|
-
config: ChartConfig;
|
|
31
|
-
}) => React.JSX.Element | null;
|
|
32
|
-
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
33
|
-
declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<RechartsPrimitive.DefaultTooltipContentProps<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType> & {
|
|
34
|
-
accessibilityLayer?: boolean;
|
|
35
|
-
active?: boolean | undefined;
|
|
36
|
-
includeHidden?: boolean | undefined;
|
|
37
|
-
allowEscapeViewBox?: recharts_types_util_types.AllowInDimension;
|
|
38
|
-
animationDuration?: recharts_types_util_types.AnimationDuration;
|
|
39
|
-
animationEasing?: recharts_types_util_types.AnimationTiming;
|
|
40
|
-
content?: recharts_types_component_Tooltip.ContentType<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType> | undefined;
|
|
41
|
-
coordinate?: Partial<recharts_types_util_types.Coordinate>;
|
|
42
|
-
cursor?: boolean | React.ReactElement | React.SVGProps<SVGElement>;
|
|
43
|
-
filterNull?: boolean;
|
|
44
|
-
defaultIndex?: number;
|
|
45
|
-
isAnimationActive?: boolean;
|
|
46
|
-
offset?: number;
|
|
47
|
-
payloadUniqBy?: recharts_types_util_payload_getUniqPayload.UniqueOption<recharts_types_component_DefaultTooltipContent.Payload<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType>> | undefined;
|
|
48
|
-
position?: Partial<recharts_types_util_types.Coordinate>;
|
|
49
|
-
reverseDirection?: recharts_types_util_types.AllowInDimension;
|
|
50
|
-
shared?: boolean;
|
|
51
|
-
trigger?: "hover" | "click";
|
|
52
|
-
useTranslate3d?: boolean;
|
|
53
|
-
viewBox?: recharts_types_util_types.CartesianViewBox;
|
|
54
|
-
wrapperStyle?: React.CSSProperties;
|
|
55
|
-
} & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
56
|
-
hideLabel?: boolean;
|
|
57
|
-
hideIndicator?: boolean;
|
|
58
|
-
indicator?: "line" | "dot" | "dashed";
|
|
59
|
-
nameKey?: string;
|
|
60
|
-
labelKey?: string;
|
|
61
|
-
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
62
|
-
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
63
|
-
declare const ChartLegendContent: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
64
|
-
hideIcon?: boolean;
|
|
65
|
-
nameKey?: string;
|
|
66
|
-
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
-
|
|
68
|
-
export { type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|
package/components/ui/chart.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import * as recharts_types_util_payload_getUniqPayload from 'recharts/types/util/payload/getUniqPayload';
|
|
2
|
-
import * as recharts_types_component_Tooltip from 'recharts/types/component/Tooltip';
|
|
3
|
-
import * as recharts_types_util_types from 'recharts/types/util/types';
|
|
4
|
-
import * as recharts_types_component_DefaultTooltipContent from 'recharts/types/component/DefaultTooltipContent';
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import * as RechartsPrimitive from 'recharts';
|
|
7
|
-
|
|
8
|
-
declare const THEMES: {
|
|
9
|
-
readonly light: "";
|
|
10
|
-
readonly dark: ".dark";
|
|
11
|
-
};
|
|
12
|
-
type ChartConfig = {
|
|
13
|
-
[k in string]: {
|
|
14
|
-
label?: React.ReactNode;
|
|
15
|
-
icon?: React.ComponentType;
|
|
16
|
-
} & ({
|
|
17
|
-
color?: string;
|
|
18
|
-
theme?: never;
|
|
19
|
-
} | {
|
|
20
|
-
color?: never;
|
|
21
|
-
theme: Record<keyof typeof THEMES, string>;
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
declare const ChartContainer: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
25
|
-
config: ChartConfig;
|
|
26
|
-
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
27
|
-
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
-
declare const ChartStyle: ({ id, config }: {
|
|
29
|
-
id: string;
|
|
30
|
-
config: ChartConfig;
|
|
31
|
-
}) => React.JSX.Element | null;
|
|
32
|
-
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
33
|
-
declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<RechartsPrimitive.DefaultTooltipContentProps<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType> & {
|
|
34
|
-
accessibilityLayer?: boolean;
|
|
35
|
-
active?: boolean | undefined;
|
|
36
|
-
includeHidden?: boolean | undefined;
|
|
37
|
-
allowEscapeViewBox?: recharts_types_util_types.AllowInDimension;
|
|
38
|
-
animationDuration?: recharts_types_util_types.AnimationDuration;
|
|
39
|
-
animationEasing?: recharts_types_util_types.AnimationTiming;
|
|
40
|
-
content?: recharts_types_component_Tooltip.ContentType<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType> | undefined;
|
|
41
|
-
coordinate?: Partial<recharts_types_util_types.Coordinate>;
|
|
42
|
-
cursor?: boolean | React.ReactElement | React.SVGProps<SVGElement>;
|
|
43
|
-
filterNull?: boolean;
|
|
44
|
-
defaultIndex?: number;
|
|
45
|
-
isAnimationActive?: boolean;
|
|
46
|
-
offset?: number;
|
|
47
|
-
payloadUniqBy?: recharts_types_util_payload_getUniqPayload.UniqueOption<recharts_types_component_DefaultTooltipContent.Payload<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType>> | undefined;
|
|
48
|
-
position?: Partial<recharts_types_util_types.Coordinate>;
|
|
49
|
-
reverseDirection?: recharts_types_util_types.AllowInDimension;
|
|
50
|
-
shared?: boolean;
|
|
51
|
-
trigger?: "hover" | "click";
|
|
52
|
-
useTranslate3d?: boolean;
|
|
53
|
-
viewBox?: recharts_types_util_types.CartesianViewBox;
|
|
54
|
-
wrapperStyle?: React.CSSProperties;
|
|
55
|
-
} & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
56
|
-
hideLabel?: boolean;
|
|
57
|
-
hideIndicator?: boolean;
|
|
58
|
-
indicator?: "line" | "dot" | "dashed";
|
|
59
|
-
nameKey?: string;
|
|
60
|
-
labelKey?: string;
|
|
61
|
-
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
62
|
-
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
63
|
-
declare const ChartLegendContent: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
64
|
-
hideIcon?: boolean;
|
|
65
|
-
nameKey?: string;
|
|
66
|
-
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
-
|
|
68
|
-
export { type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|
package/components/ui/chart.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunk6N4WCMTEjs = require('../../chunk-6N4WCMTE.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunk2NMEKWO5js = require('../../chunk-2NMEKWO5.js');
|
|
10
|
-
|
|
11
|
-
// components/ui/chart.tsx
|
|
12
|
-
var _react = require('react'); var React = _interopRequireWildcard(_react);
|
|
13
|
-
var _recharts = require('recharts'); var RechartsPrimitive = _interopRequireWildcard(_recharts);
|
|
14
|
-
var THEMES = { light: "", dark: ".dark" };
|
|
15
|
-
var ChartContext = React.createContext(null);
|
|
16
|
-
function useChart() {
|
|
17
|
-
const context = React.useContext(ChartContext);
|
|
18
|
-
if (!context) {
|
|
19
|
-
throw new Error("useChart must be used within a <ChartContainer />");
|
|
20
|
-
}
|
|
21
|
-
return context;
|
|
22
|
-
}
|
|
23
|
-
var ChartContainer = React.forwardRef((_a, ref) => {
|
|
24
|
-
var _b = _a, { id, className, children, config } = _b, props = _chunk2NMEKWO5js.__objRest.call(void 0, _b, ["id", "className", "children", "config"]);
|
|
25
|
-
const uniqueId = React.useId();
|
|
26
|
-
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
27
|
-
return /* @__PURE__ */ React.createElement(ChartContext.Provider, { value: { config } }, /* @__PURE__ */ React.createElement(
|
|
28
|
-
"div",
|
|
29
|
-
_chunk2NMEKWO5js.__spreadValues.call(void 0, {
|
|
30
|
-
"data-chart": chartId,
|
|
31
|
-
ref,
|
|
32
|
-
className: _chunk6N4WCMTEjs.cn.call(void 0,
|
|
33
|
-
"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-none [&_.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[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
|
|
34
|
-
className
|
|
35
|
-
)
|
|
36
|
-
}, props),
|
|
37
|
-
/* @__PURE__ */ React.createElement(ChartStyle, { id: chartId, config }),
|
|
38
|
-
/* @__PURE__ */ React.createElement(RechartsPrimitive.ResponsiveContainer, null, children)
|
|
39
|
-
));
|
|
40
|
-
});
|
|
41
|
-
ChartContainer.displayName = "Chart";
|
|
42
|
-
var ChartStyle = ({ id, config }) => {
|
|
43
|
-
const colorConfig = Object.entries(config).filter(([, config2]) => config2.theme || config2.color);
|
|
44
|
-
if (!colorConfig.length) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
return /* @__PURE__ */ React.createElement(
|
|
48
|
-
"style",
|
|
49
|
-
{
|
|
50
|
-
dangerouslySetInnerHTML: {
|
|
51
|
-
__html: Object.entries(THEMES).map(
|
|
52
|
-
([theme, prefix]) => `
|
|
53
|
-
${prefix} [data-chart=${id}] {
|
|
54
|
-
${colorConfig.map(([key, itemConfig]) => {
|
|
55
|
-
var _a;
|
|
56
|
-
const color = ((_a = itemConfig.theme) == null ? void 0 : _a[theme]) || itemConfig.color;
|
|
57
|
-
return color ? ` --color-${key}: ${color};` : null;
|
|
58
|
-
}).join("\n")}
|
|
59
|
-
}
|
|
60
|
-
`
|
|
61
|
-
).join("\n")
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
var ChartTooltip = RechartsPrimitive.Tooltip;
|
|
67
|
-
var ChartTooltipContent = React.forwardRef(
|
|
68
|
-
({
|
|
69
|
-
active,
|
|
70
|
-
payload,
|
|
71
|
-
className,
|
|
72
|
-
indicator = "dot",
|
|
73
|
-
hideLabel = false,
|
|
74
|
-
hideIndicator = false,
|
|
75
|
-
label,
|
|
76
|
-
labelFormatter,
|
|
77
|
-
labelClassName,
|
|
78
|
-
formatter,
|
|
79
|
-
color,
|
|
80
|
-
nameKey,
|
|
81
|
-
labelKey
|
|
82
|
-
}, ref) => {
|
|
83
|
-
const { config } = useChart();
|
|
84
|
-
const tooltipLabel = React.useMemo(() => {
|
|
85
|
-
var _a;
|
|
86
|
-
if (hideLabel || !(payload == null ? void 0 : payload.length)) {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
const [item] = payload;
|
|
90
|
-
const key = `${labelKey || item.dataKey || item.name || "value"}`;
|
|
91
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
92
|
-
const value = !labelKey && typeof label === "string" ? ((_a = config[label]) == null ? void 0 : _a.label) || label : itemConfig == null ? void 0 : itemConfig.label;
|
|
93
|
-
if (labelFormatter) {
|
|
94
|
-
return /* @__PURE__ */ React.createElement("div", { className: _chunk6N4WCMTEjs.cn.call(void 0, "font-medium", labelClassName) }, labelFormatter(value, payload));
|
|
95
|
-
}
|
|
96
|
-
if (!value) {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
return /* @__PURE__ */ React.createElement("div", { className: _chunk6N4WCMTEjs.cn.call(void 0, "font-medium", labelClassName) }, value);
|
|
100
|
-
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
101
|
-
if (!active || !(payload == null ? void 0 : payload.length)) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
105
|
-
return /* @__PURE__ */ React.createElement(
|
|
106
|
-
"div",
|
|
107
|
-
{
|
|
108
|
-
ref,
|
|
109
|
-
className: _chunk6N4WCMTEjs.cn.call(void 0,
|
|
110
|
-
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
|
111
|
-
className
|
|
112
|
-
)
|
|
113
|
-
},
|
|
114
|
-
!nestLabel ? tooltipLabel : null,
|
|
115
|
-
/* @__PURE__ */ React.createElement("div", { className: "grid gap-1.5" }, payload.map((item, index) => {
|
|
116
|
-
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
117
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
118
|
-
const indicatorColor = color || item.payload.fill || item.color;
|
|
119
|
-
return /* @__PURE__ */ React.createElement(
|
|
120
|
-
"div",
|
|
121
|
-
{
|
|
122
|
-
key: item.dataKey,
|
|
123
|
-
className: _chunk6N4WCMTEjs.cn.call(void 0,
|
|
124
|
-
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
|
125
|
-
indicator === "dot" && "items-center"
|
|
126
|
-
)
|
|
127
|
-
},
|
|
128
|
-
formatter && (item == null ? void 0 : item.value) !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ React.createElement(React.Fragment, null, (itemConfig == null ? void 0 : itemConfig.icon) ? /* @__PURE__ */ React.createElement(itemConfig.icon, null) : !hideIndicator && /* @__PURE__ */ React.createElement(
|
|
129
|
-
"div",
|
|
130
|
-
{
|
|
131
|
-
className: _chunk6N4WCMTEjs.cn.call(void 0, "shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
|
|
132
|
-
"h-2.5 w-2.5": indicator === "dot",
|
|
133
|
-
"w-1": indicator === "line",
|
|
134
|
-
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
135
|
-
"my-0.5": nestLabel && indicator === "dashed"
|
|
136
|
-
}),
|
|
137
|
-
style: {
|
|
138
|
-
"--color-bg": indicatorColor,
|
|
139
|
-
"--color-border": indicatorColor
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
), /* @__PURE__ */ React.createElement(
|
|
143
|
-
"div",
|
|
144
|
-
{
|
|
145
|
-
className: _chunk6N4WCMTEjs.cn.call(void 0,
|
|
146
|
-
"flex flex-1 justify-between leading-none",
|
|
147
|
-
nestLabel ? "items-end" : "items-center"
|
|
148
|
-
)
|
|
149
|
-
},
|
|
150
|
-
/* @__PURE__ */ React.createElement("div", { className: "grid gap-1.5" }, nestLabel ? tooltipLabel : null, /* @__PURE__ */ React.createElement("span", { className: "text-muted-foreground" }, (itemConfig == null ? void 0 : itemConfig.label) || item.name)),
|
|
151
|
-
item.value && /* @__PURE__ */ React.createElement("span", { className: "font-mono font-medium tabular-nums text-foreground" }, item.value.toLocaleString())
|
|
152
|
-
))
|
|
153
|
-
);
|
|
154
|
-
}))
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
ChartTooltipContent.displayName = "ChartTooltip";
|
|
159
|
-
var ChartLegend = RechartsPrimitive.Legend;
|
|
160
|
-
var ChartLegendContent = React.forwardRef(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
|
|
161
|
-
const { config } = useChart();
|
|
162
|
-
if (!(payload == null ? void 0 : payload.length)) {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
return /* @__PURE__ */ React.createElement(
|
|
166
|
-
"div",
|
|
167
|
-
{
|
|
168
|
-
ref,
|
|
169
|
-
className: _chunk6N4WCMTEjs.cn.call(void 0, "flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)
|
|
170
|
-
},
|
|
171
|
-
payload.map((item) => {
|
|
172
|
-
const key = `${nameKey || item.dataKey || "value"}`;
|
|
173
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
174
|
-
return /* @__PURE__ */ React.createElement(
|
|
175
|
-
"div",
|
|
176
|
-
{
|
|
177
|
-
key: item.value,
|
|
178
|
-
className: _chunk6N4WCMTEjs.cn.call(void 0, "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground")
|
|
179
|
-
},
|
|
180
|
-
(itemConfig == null ? void 0 : itemConfig.icon) && !hideIcon ? /* @__PURE__ */ React.createElement(itemConfig.icon, null) : /* @__PURE__ */ React.createElement(
|
|
181
|
-
"div",
|
|
182
|
-
{
|
|
183
|
-
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
184
|
-
style: {
|
|
185
|
-
backgroundColor: item.color
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
),
|
|
189
|
-
itemConfig == null ? void 0 : itemConfig.label
|
|
190
|
-
);
|
|
191
|
-
})
|
|
192
|
-
);
|
|
193
|
-
});
|
|
194
|
-
ChartLegendContent.displayName = "ChartLegend";
|
|
195
|
-
function getPayloadConfigFromPayload(config, payload, key) {
|
|
196
|
-
if (typeof payload !== "object" || payload === null) {
|
|
197
|
-
return void 0;
|
|
198
|
-
}
|
|
199
|
-
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
200
|
-
let configLabelKey = key;
|
|
201
|
-
if (key in payload && typeof payload[key] === "string") {
|
|
202
|
-
configLabelKey = payload[key];
|
|
203
|
-
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
204
|
-
configLabelKey = payloadPayload[key];
|
|
205
|
-
}
|
|
206
|
-
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
exports.ChartContainer = ChartContainer; exports.ChartLegend = ChartLegend; exports.ChartLegendContent = ChartLegendContent; exports.ChartStyle = ChartStyle; exports.ChartTooltip = ChartTooltip; exports.ChartTooltipContent = ChartTooltipContent;
|
|
216
|
-
//# sourceMappingURL=chart.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/jahn/projects/shadcn-theme/packages/react/dist/components/ui/chart.js","../../../components/ui/chart.tsx"],"names":["config"],"mappings":"AAAA,uWAAY;AACZ;AACE;AACF,0DAAgC;AAChC;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AAEN,EAAA;AACb,IAAA;AACT,EAAA;AAGE,EAAA;AAAC,IAAA;AAAA,IAAA;AACC,MAAA;AACc,MAAA;AAA8F,IAAA;AAErF,IAAA;AAC4B,MAAA;AACF,MAAA;AAG7C,MAAA;AAAC,QAAA;AAAA,QAAA;AACW,UAAA;AACI,UAAA;AAAiF,QAAA;AAEzE,QAAA;AAGnB,UAAA;AAAA,UAAA;AACW,YAAA;AACH,YAAA;AACiB,cAAA;AACxB,YAAA;AAAA,UAAA;AACF,QAAA;AAEW,QAAA;AACf,MAAA;AAEH,IAAA;AACH,EAAA;AAEH;AACgC;AAGwD;AAClC,EAAA;AAC5C,IAAA;AACT,EAAA;AAGiC,EAAA;AAIJ,EAAA;AAEmD,EAAA;AAC1B,IAAA;AAIpD,EAAA;AAEkE,IAAA;AACpE,EAAA;AAEuD,EAAA;AACzD;AD/F4D;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/jahn/projects/shadcn-theme/packages/react/dist/components/ui/chart.js","sourcesContent":[null,"\"use client\";\nimport * as React from 'react';\nimport * as RechartsPrimitive from 'recharts';\n\nimport { cn } from '../../lib/utils';\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const;\n\nexport type ChartConfig = {\n [k in string]: {\n label?: React.ReactNode;\n icon?: React.ComponentType;\n } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> });\n};\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 config: ChartConfig;\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 \"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-none [&_.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[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.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(([, config]) => config.theme || config.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 itemConfig.theme] || 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> &\n React.ComponentProps<'div'> & {\n hideLabel?: boolean;\n hideIndicator?: boolean;\n indicator?: 'line' | 'dot' | 'dashed';\n nameKey?: string;\n labelKey?: string;\n }\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 'grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background 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.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.fill || item.color;\n\n return (\n <div\n key={item.dataKey}\n className={cn(\n 'flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground',\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=\"font-mono font-medium tabular-nums text-foreground\">\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 hideIcon?: boolean;\n nameKey?: string;\n }\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.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('flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground')}\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 && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined;\n\n let configLabelKey: string = key;\n\n if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {\n configLabelKey = payload[key as keyof typeof payload] as string;\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];\n}\n\nexport { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle };\n"]}
|
package/components/ui/chart.mjs
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
cn
|
|
4
|
-
} from "../../chunk-F5XCCSBC.mjs";
|
|
5
|
-
import {
|
|
6
|
-
__objRest,
|
|
7
|
-
__spreadValues
|
|
8
|
-
} from "../../chunk-YOSPWY5K.mjs";
|
|
9
|
-
|
|
10
|
-
// components/ui/chart.tsx
|
|
11
|
-
import * as React from "react";
|
|
12
|
-
import * as RechartsPrimitive from "recharts";
|
|
13
|
-
var THEMES = { light: "", dark: ".dark" };
|
|
14
|
-
var ChartContext = React.createContext(null);
|
|
15
|
-
function useChart() {
|
|
16
|
-
const context = React.useContext(ChartContext);
|
|
17
|
-
if (!context) {
|
|
18
|
-
throw new Error("useChart must be used within a <ChartContainer />");
|
|
19
|
-
}
|
|
20
|
-
return context;
|
|
21
|
-
}
|
|
22
|
-
var ChartContainer = React.forwardRef((_a, ref) => {
|
|
23
|
-
var _b = _a, { id, className, children, config } = _b, props = __objRest(_b, ["id", "className", "children", "config"]);
|
|
24
|
-
const uniqueId = React.useId();
|
|
25
|
-
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
26
|
-
return /* @__PURE__ */ React.createElement(ChartContext.Provider, { value: { config } }, /* @__PURE__ */ React.createElement(
|
|
27
|
-
"div",
|
|
28
|
-
__spreadValues({
|
|
29
|
-
"data-chart": chartId,
|
|
30
|
-
ref,
|
|
31
|
-
className: cn(
|
|
32
|
-
"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-none [&_.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[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
|
|
33
|
-
className
|
|
34
|
-
)
|
|
35
|
-
}, props),
|
|
36
|
-
/* @__PURE__ */ React.createElement(ChartStyle, { id: chartId, config }),
|
|
37
|
-
/* @__PURE__ */ React.createElement(RechartsPrimitive.ResponsiveContainer, null, children)
|
|
38
|
-
));
|
|
39
|
-
});
|
|
40
|
-
ChartContainer.displayName = "Chart";
|
|
41
|
-
var ChartStyle = ({ id, config }) => {
|
|
42
|
-
const colorConfig = Object.entries(config).filter(([, config2]) => config2.theme || config2.color);
|
|
43
|
-
if (!colorConfig.length) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
return /* @__PURE__ */ React.createElement(
|
|
47
|
-
"style",
|
|
48
|
-
{
|
|
49
|
-
dangerouslySetInnerHTML: {
|
|
50
|
-
__html: Object.entries(THEMES).map(
|
|
51
|
-
([theme, prefix]) => `
|
|
52
|
-
${prefix} [data-chart=${id}] {
|
|
53
|
-
${colorConfig.map(([key, itemConfig]) => {
|
|
54
|
-
var _a;
|
|
55
|
-
const color = ((_a = itemConfig.theme) == null ? void 0 : _a[theme]) || itemConfig.color;
|
|
56
|
-
return color ? ` --color-${key}: ${color};` : null;
|
|
57
|
-
}).join("\n")}
|
|
58
|
-
}
|
|
59
|
-
`
|
|
60
|
-
).join("\n")
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
var ChartTooltip = RechartsPrimitive.Tooltip;
|
|
66
|
-
var ChartTooltipContent = React.forwardRef(
|
|
67
|
-
({
|
|
68
|
-
active,
|
|
69
|
-
payload,
|
|
70
|
-
className,
|
|
71
|
-
indicator = "dot",
|
|
72
|
-
hideLabel = false,
|
|
73
|
-
hideIndicator = false,
|
|
74
|
-
label,
|
|
75
|
-
labelFormatter,
|
|
76
|
-
labelClassName,
|
|
77
|
-
formatter,
|
|
78
|
-
color,
|
|
79
|
-
nameKey,
|
|
80
|
-
labelKey
|
|
81
|
-
}, ref) => {
|
|
82
|
-
const { config } = useChart();
|
|
83
|
-
const tooltipLabel = React.useMemo(() => {
|
|
84
|
-
var _a;
|
|
85
|
-
if (hideLabel || !(payload == null ? void 0 : payload.length)) {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
const [item] = payload;
|
|
89
|
-
const key = `${labelKey || item.dataKey || item.name || "value"}`;
|
|
90
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
91
|
-
const value = !labelKey && typeof label === "string" ? ((_a = config[label]) == null ? void 0 : _a.label) || label : itemConfig == null ? void 0 : itemConfig.label;
|
|
92
|
-
if (labelFormatter) {
|
|
93
|
-
return /* @__PURE__ */ React.createElement("div", { className: cn("font-medium", labelClassName) }, labelFormatter(value, payload));
|
|
94
|
-
}
|
|
95
|
-
if (!value) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
return /* @__PURE__ */ React.createElement("div", { className: cn("font-medium", labelClassName) }, value);
|
|
99
|
-
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
100
|
-
if (!active || !(payload == null ? void 0 : payload.length)) {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
104
|
-
return /* @__PURE__ */ React.createElement(
|
|
105
|
-
"div",
|
|
106
|
-
{
|
|
107
|
-
ref,
|
|
108
|
-
className: cn(
|
|
109
|
-
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
|
110
|
-
className
|
|
111
|
-
)
|
|
112
|
-
},
|
|
113
|
-
!nestLabel ? tooltipLabel : null,
|
|
114
|
-
/* @__PURE__ */ React.createElement("div", { className: "grid gap-1.5" }, payload.map((item, index) => {
|
|
115
|
-
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
116
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
117
|
-
const indicatorColor = color || item.payload.fill || item.color;
|
|
118
|
-
return /* @__PURE__ */ React.createElement(
|
|
119
|
-
"div",
|
|
120
|
-
{
|
|
121
|
-
key: item.dataKey,
|
|
122
|
-
className: cn(
|
|
123
|
-
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
|
124
|
-
indicator === "dot" && "items-center"
|
|
125
|
-
)
|
|
126
|
-
},
|
|
127
|
-
formatter && (item == null ? void 0 : item.value) !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ React.createElement(React.Fragment, null, (itemConfig == null ? void 0 : itemConfig.icon) ? /* @__PURE__ */ React.createElement(itemConfig.icon, null) : !hideIndicator && /* @__PURE__ */ React.createElement(
|
|
128
|
-
"div",
|
|
129
|
-
{
|
|
130
|
-
className: cn("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
|
|
131
|
-
"h-2.5 w-2.5": indicator === "dot",
|
|
132
|
-
"w-1": indicator === "line",
|
|
133
|
-
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
134
|
-
"my-0.5": nestLabel && indicator === "dashed"
|
|
135
|
-
}),
|
|
136
|
-
style: {
|
|
137
|
-
"--color-bg": indicatorColor,
|
|
138
|
-
"--color-border": indicatorColor
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
), /* @__PURE__ */ React.createElement(
|
|
142
|
-
"div",
|
|
143
|
-
{
|
|
144
|
-
className: cn(
|
|
145
|
-
"flex flex-1 justify-between leading-none",
|
|
146
|
-
nestLabel ? "items-end" : "items-center"
|
|
147
|
-
)
|
|
148
|
-
},
|
|
149
|
-
/* @__PURE__ */ React.createElement("div", { className: "grid gap-1.5" }, nestLabel ? tooltipLabel : null, /* @__PURE__ */ React.createElement("span", { className: "text-muted-foreground" }, (itemConfig == null ? void 0 : itemConfig.label) || item.name)),
|
|
150
|
-
item.value && /* @__PURE__ */ React.createElement("span", { className: "font-mono font-medium tabular-nums text-foreground" }, item.value.toLocaleString())
|
|
151
|
-
))
|
|
152
|
-
);
|
|
153
|
-
}))
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
ChartTooltipContent.displayName = "ChartTooltip";
|
|
158
|
-
var ChartLegend = RechartsPrimitive.Legend;
|
|
159
|
-
var ChartLegendContent = React.forwardRef(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
|
|
160
|
-
const { config } = useChart();
|
|
161
|
-
if (!(payload == null ? void 0 : payload.length)) {
|
|
162
|
-
return null;
|
|
163
|
-
}
|
|
164
|
-
return /* @__PURE__ */ React.createElement(
|
|
165
|
-
"div",
|
|
166
|
-
{
|
|
167
|
-
ref,
|
|
168
|
-
className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)
|
|
169
|
-
},
|
|
170
|
-
payload.map((item) => {
|
|
171
|
-
const key = `${nameKey || item.dataKey || "value"}`;
|
|
172
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
173
|
-
return /* @__PURE__ */ React.createElement(
|
|
174
|
-
"div",
|
|
175
|
-
{
|
|
176
|
-
key: item.value,
|
|
177
|
-
className: cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground")
|
|
178
|
-
},
|
|
179
|
-
(itemConfig == null ? void 0 : itemConfig.icon) && !hideIcon ? /* @__PURE__ */ React.createElement(itemConfig.icon, null) : /* @__PURE__ */ React.createElement(
|
|
180
|
-
"div",
|
|
181
|
-
{
|
|
182
|
-
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
183
|
-
style: {
|
|
184
|
-
backgroundColor: item.color
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
),
|
|
188
|
-
itemConfig == null ? void 0 : itemConfig.label
|
|
189
|
-
);
|
|
190
|
-
})
|
|
191
|
-
);
|
|
192
|
-
});
|
|
193
|
-
ChartLegendContent.displayName = "ChartLegend";
|
|
194
|
-
function getPayloadConfigFromPayload(config, payload, key) {
|
|
195
|
-
if (typeof payload !== "object" || payload === null) {
|
|
196
|
-
return void 0;
|
|
197
|
-
}
|
|
198
|
-
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
199
|
-
let configLabelKey = key;
|
|
200
|
-
if (key in payload && typeof payload[key] === "string") {
|
|
201
|
-
configLabelKey = payload[key];
|
|
202
|
-
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
203
|
-
configLabelKey = payloadPayload[key];
|
|
204
|
-
}
|
|
205
|
-
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
206
|
-
}
|
|
207
|
-
export {
|
|
208
|
-
ChartContainer,
|
|
209
|
-
ChartLegend,
|
|
210
|
-
ChartLegendContent,
|
|
211
|
-
ChartStyle,
|
|
212
|
-
ChartTooltip,
|
|
213
|
-
ChartTooltipContent
|
|
214
|
-
};
|
|
215
|
-
//# sourceMappingURL=chart.mjs.map
|