@locusgraph/components 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/action/button-group.js +148 -17
  2. package/dist/action/button.js +91 -27
  3. package/dist/action/toggle-group.js +176 -12
  4. package/dist/action/toggle.js +71 -18
  5. package/dist/display/avatar.js +118 -7
  6. package/dist/display/badge.d.ts +1 -1
  7. package/dist/display/badge.js +74 -17
  8. package/dist/display/chart/chart-container.js +205 -45
  9. package/dist/display/chart/chart-legend.js +79 -14
  10. package/dist/display/chart/chart-tooltip.js +211 -40
  11. package/dist/display/chat/attachment/attachment-parts.js +222 -13
  12. package/dist/display/chat/attachment/attachment.js +210 -28
  13. package/dist/display/chat/bubble.js +225 -37
  14. package/dist/display/chat/marker.js +143 -15
  15. package/dist/display/chat/message-scroller.js +277 -15
  16. package/dist/display/chat/message.js +238 -13
  17. package/dist/display/content/item.js +448 -47
  18. package/dist/display/content/kbd.js +78 -5
  19. package/dist/display/media/aspect-ratio.js +27 -3
  20. package/dist/display/media/carousel-controls.js +163 -12
  21. package/dist/display/media/carousel.js +325 -65
  22. package/dist/display/rule-grid/rule-grid.d.ts +3 -1
  23. package/dist/display/rule-grid/rule-grid.js +311 -25
  24. package/dist/display/separator.js +56 -3
  25. package/dist/display/skeletons/layouts/skeleton-rule-grid.d.ts +8 -0
  26. package/dist/display/skeletons/layouts/skeleton-rule-grid.js +83 -0
  27. package/dist/display/skeletons/layouts/skeleton-table.d.ts +8 -0
  28. package/dist/display/skeletons/layouts/skeleton-table.js +174 -0
  29. package/dist/display/skeletons/shapes/skeleton-avatar.d.ts +10 -0
  30. package/dist/display/skeletons/shapes/skeleton-avatar.js +102 -0
  31. package/dist/display/skeletons/shapes/skeleton-button.d.ts +10 -0
  32. package/dist/display/skeletons/shapes/skeleton-button.js +102 -0
  33. package/dist/display/skeletons/shapes/skeleton-text.d.ts +7 -0
  34. package/dist/display/skeletons/shapes/skeleton-text.js +84 -0
  35. package/dist/display/skeletons/skeleton-parts.d.ts +11 -0
  36. package/dist/display/skeletons/skeleton-parts.js +68 -0
  37. package/dist/display/status/alert.d.ts +1 -1
  38. package/dist/display/status/alert.js +137 -17
  39. package/dist/display/status/empty.js +250 -22
  40. package/dist/display/status/progress.d.ts +5 -1
  41. package/dist/display/status/progress.js +120 -3
  42. package/dist/display/status/skeleton.js +40 -3
  43. package/dist/display/status/spinner.js +42 -4
  44. package/dist/display/table.js +310 -17
  45. package/dist/feedback/toaster.d.ts +1 -1
  46. package/dist/feedback/toaster.js +100 -25
  47. package/dist/form/advanced/calendar-day-button.js +89 -12
  48. package/dist/form/advanced/calendar.js +349 -56
  49. package/dist/form/advanced/combobox/combobox-chips.js +152 -9
  50. package/dist/form/advanced/combobox/combobox-items.js +240 -15
  51. package/dist/form/advanced/combobox/combobox.js +387 -14
  52. package/dist/form/advanced/input-otp.js +202 -12
  53. package/dist/form/choice/checkbox.js +59 -4
  54. package/dist/form/choice/radio-group.js +95 -6
  55. package/dist/form/choice/select.js +479 -25
  56. package/dist/form/choice/slider.js +118 -4
  57. package/dist/form/choice/switch.js +53 -3
  58. package/dist/form/field/field-error.js +117 -14
  59. package/dist/form/field/field-separator.js +70 -3
  60. package/dist/form/field/field-set.js +85 -5
  61. package/dist/form/field/field-text.js +116 -7
  62. package/dist/form/field/field.js +138 -26
  63. package/dist/form/hook-form/form.js +338 -40
  64. package/dist/form/input-group.js +297 -47
  65. package/dist/form/input.js +47 -3
  66. package/dist/form/label.js +42 -3
  67. package/dist/form/native-select.js +148 -8
  68. package/dist/form/textarea.js +41 -3
  69. package/dist/index.d.ts +6 -0
  70. package/dist/index.js +6 -0
  71. package/dist/layout/accordion.js +166 -9
  72. package/dist/layout/collapsible.js +75 -7
  73. package/dist/layout/resizable.js +123 -8
  74. package/dist/layout/scroll/direction.js +25 -3
  75. package/dist/layout/scroll/scroll-area.d.ts +1 -1
  76. package/dist/layout/scroll/scroll-area.js +138 -5
  77. package/dist/layout/sidebar/sidebar-context.js +184 -51
  78. package/dist/layout/sidebar/sidebar-menu-sub.js +219 -14
  79. package/dist/layout/sidebar/sidebar-menu.js +319 -38
  80. package/dist/layout/sidebar/sidebar-sections.js +369 -22
  81. package/dist/layout/sidebar/sidebar.js +385 -29
  82. package/dist/layout/tabs.js +183 -18
  83. package/dist/layout/use-mobile.js +23 -10
  84. package/dist/navigation/breadcrumb.js +302 -18
  85. package/dist/navigation/menubar/menubar-items.js +323 -17
  86. package/dist/navigation/menubar/menubar-sub.js +126 -8
  87. package/dist/navigation/menubar/menubar.js +213 -13
  88. package/dist/navigation/navigation-menu.js +367 -19
  89. package/dist/navigation/pagination.js +329 -20
  90. package/dist/overlay/alert-dialog.js +485 -26
  91. package/dist/overlay/context-menu/context-menu-items.js +323 -17
  92. package/dist/overlay/context-menu/context-menu-sub.js +126 -8
  93. package/dist/overlay/context-menu/context-menu.js +140 -11
  94. package/dist/overlay/dialog.js +406 -25
  95. package/dist/overlay/floating/command.js +424 -21
  96. package/dist/overlay/floating/drawer.js +354 -22
  97. package/dist/overlay/floating/hover-card.js +107 -7
  98. package/dist/overlay/menu/dropdown-menu-choice.js +150 -8
  99. package/dist/overlay/menu/dropdown-menu-item.js +174 -9
  100. package/dist/overlay/menu/dropdown-menu-sub.js +125 -8
  101. package/dist/overlay/menu/dropdown-menu.js +147 -12
  102. package/dist/overlay/popover.js +106 -7
  103. package/dist/overlay/sheet.js +380 -27
  104. package/dist/overlay/tooltip.js +145 -9
  105. package/dist/shell/app-header.js +81 -5
  106. package/dist/shell/app-shell.js +58 -3
  107. package/dist/shell/breadcrumbs.js +102 -12
  108. package/dist/shell/docs/docs-header.js +211 -11
  109. package/dist/shell/docs/docs-shell.js +100 -3
  110. package/dist/shell/docs/docs-sidebar.js +88 -7
  111. package/dist/shell/docs/on-this-page.js +78 -7
  112. package/dist/shell/docs/use-active-section.js +88 -42
  113. package/dist/shell/navigation/app-sidebar.js +188 -6
  114. package/dist/shell/navigation/nav-group.js +161 -10
  115. package/dist/shell/theme-toggle.js +52 -5
  116. package/package.json +5 -5
@@ -1,14 +1,125 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { cn } from "cn";
4
5
  import * as AvatarPrimitive from "radix-ui/avatar";
5
- function Avatar({ className, ...props }) {
6
- return (_jsx(AvatarPrimitive.Root, { "data-slot": "avatar", className: cn("relative flex size-8 shrink-0 overflow-hidden rounded-full", className), ...props }));
6
+ import * as React from "react";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ function Avatar(t0) {
9
+ const $ = _c(8);
10
+ let className;
11
+ let props;
12
+ if ($[0] !== t0) {
13
+ ({
14
+ className,
15
+ ...props
16
+ } = t0);
17
+ $[0] = t0;
18
+ $[1] = className;
19
+ $[2] = props;
20
+ } else {
21
+ className = $[1];
22
+ props = $[2];
23
+ }
24
+ let t1;
25
+ if ($[3] !== className) {
26
+ t1 = cn("relative flex size-8 shrink-0 overflow-hidden rounded-full", className);
27
+ $[3] = className;
28
+ $[4] = t1;
29
+ } else {
30
+ t1 = $[4];
31
+ }
32
+ let t2;
33
+ if ($[5] !== props || $[6] !== t1) {
34
+ t2 = /*#__PURE__*/_jsx(AvatarPrimitive.Root, {
35
+ "data-slot": "avatar",
36
+ className: t1,
37
+ ...props
38
+ });
39
+ $[5] = props;
40
+ $[6] = t1;
41
+ $[7] = t2;
42
+ } else {
43
+ t2 = $[7];
44
+ }
45
+ return t2;
7
46
  }
8
- function AvatarImage({ className, ...props }) {
9
- return (_jsx(AvatarPrimitive.Image, { "data-slot": "avatar-image", className: cn("aspect-square size-full", className), ...props }));
47
+ function AvatarImage(t0) {
48
+ const $ = _c(8);
49
+ let className;
50
+ let props;
51
+ if ($[0] !== t0) {
52
+ ({
53
+ className,
54
+ ...props
55
+ } = t0);
56
+ $[0] = t0;
57
+ $[1] = className;
58
+ $[2] = props;
59
+ } else {
60
+ className = $[1];
61
+ props = $[2];
62
+ }
63
+ let t1;
64
+ if ($[3] !== className) {
65
+ t1 = cn("aspect-square size-full", className);
66
+ $[3] = className;
67
+ $[4] = t1;
68
+ } else {
69
+ t1 = $[4];
70
+ }
71
+ let t2;
72
+ if ($[5] !== props || $[6] !== t1) {
73
+ t2 = /*#__PURE__*/_jsx(AvatarPrimitive.Image, {
74
+ "data-slot": "avatar-image",
75
+ className: t1,
76
+ ...props
77
+ });
78
+ $[5] = props;
79
+ $[6] = t1;
80
+ $[7] = t2;
81
+ } else {
82
+ t2 = $[7];
83
+ }
84
+ return t2;
10
85
  }
11
- function AvatarFallback({ className, ...props }) {
12
- return (_jsx(AvatarPrimitive.Fallback, { "data-slot": "avatar-fallback", className: cn("flex size-full items-center justify-center rounded-full bg-ghost text-xs font-medium uppercase", className), ...props }));
86
+ function AvatarFallback(t0) {
87
+ const $ = _c(8);
88
+ let className;
89
+ let props;
90
+ if ($[0] !== t0) {
91
+ ({
92
+ className,
93
+ ...props
94
+ } = t0);
95
+ $[0] = t0;
96
+ $[1] = className;
97
+ $[2] = props;
98
+ } else {
99
+ className = $[1];
100
+ props = $[2];
101
+ }
102
+ let t1;
103
+ if ($[3] !== className) {
104
+ t1 = cn("flex size-full items-center justify-center rounded-full bg-ghost text-xs font-medium uppercase", className);
105
+ $[3] = className;
106
+ $[4] = t1;
107
+ } else {
108
+ t1 = $[4];
109
+ }
110
+ let t2;
111
+ if ($[5] !== props || $[6] !== t1) {
112
+ t2 = /*#__PURE__*/_jsx(AvatarPrimitive.Fallback, {
113
+ "data-slot": "avatar-fallback",
114
+ className: t1,
115
+ ...props
116
+ });
117
+ $[5] = props;
118
+ $[6] = t1;
119
+ $[7] = t2;
120
+ } else {
121
+ t2 = $[7];
122
+ }
123
+ return t2;
13
124
  }
14
125
  export { Avatar, AvatarFallback, AvatarImage };
@@ -1,7 +1,7 @@
1
1
  import { type VariantProps } from "class-variance-authority";
2
2
  import * as React from "react";
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
4
+ variant?: "default" | "destructive" | "destructive-soft" | "ghost" | "link" | "outline" | "secondary" | "success" | "warning" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
7
7
  asChild?: boolean;
@@ -1,24 +1,81 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { cva } from "class-variance-authority";
3
3
  import { cn } from "cn";
4
4
  import * as Slot from "radix-ui/slot";
5
+ import * as React from "react";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
5
7
  const badgeVariants = cva("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3", {
6
- variants: {
7
- variant: {
8
- default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
9
- secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
10
- destructive: "bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
11
- outline: "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
12
- ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
13
- link: "text-primary underline-offset-4 [a&]:hover:underline",
14
- },
15
- },
16
- defaultVariants: {
17
- variant: "default",
18
- },
8
+ variants: {
9
+ variant: {
10
+ default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
11
+ secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
12
+ destructive: "bg-destructive text-white focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
13
+ success: "bg-good/10 text-good [a&]:hover:bg-good/15",
14
+ warning: "bg-warn/10 text-warn [a&]:hover:bg-warn/15",
15
+ "destructive-soft": "bg-destructive/10 text-destructive [a&]:hover:bg-destructive/15",
16
+ outline: "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
17
+ ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
18
+ link: "text-primary underline-offset-4 [a&]:hover:underline"
19
+ }
20
+ },
21
+ defaultVariants: {
22
+ variant: "default"
23
+ }
19
24
  });
20
- function Badge({ className, variant = "default", asChild = false, ...props }) {
21
- const Comp = asChild ? Slot.Root : "span";
22
- return (_jsx(Comp, { "data-slot": "badge", "data-variant": variant, className: cn(badgeVariants({ variant }), className), ...props }));
25
+ function Badge(t0) {
26
+ const $ = _c(13);
27
+ let className;
28
+ let props;
29
+ let t1;
30
+ let t2;
31
+ if ($[0] !== t0) {
32
+ ({
33
+ className,
34
+ variant: t1,
35
+ asChild: t2,
36
+ ...props
37
+ } = t0);
38
+ $[0] = t0;
39
+ $[1] = className;
40
+ $[2] = props;
41
+ $[3] = t1;
42
+ $[4] = t2;
43
+ } else {
44
+ className = $[1];
45
+ props = $[2];
46
+ t1 = $[3];
47
+ t2 = $[4];
48
+ }
49
+ const variant = t1 === undefined ? "default" : t1;
50
+ const asChild = t2 === undefined ? false : t2;
51
+ const Comp = asChild ? Slot.Root : "span";
52
+ let t3;
53
+ if ($[5] !== className || $[6] !== variant) {
54
+ t3 = cn(badgeVariants({
55
+ variant
56
+ }), className);
57
+ $[5] = className;
58
+ $[6] = variant;
59
+ $[7] = t3;
60
+ } else {
61
+ t3 = $[7];
62
+ }
63
+ let t4;
64
+ if ($[8] !== Comp || $[9] !== props || $[10] !== t3 || $[11] !== variant) {
65
+ t4 = /*#__PURE__*/_jsx(Comp, {
66
+ "data-slot": "badge",
67
+ "data-variant": variant,
68
+ className: t3,
69
+ ...props
70
+ });
71
+ $[8] = Comp;
72
+ $[9] = props;
73
+ $[10] = t3;
74
+ $[11] = variant;
75
+ $[12] = t4;
76
+ } else {
77
+ t4 = $[12];
78
+ }
79
+ return t4;
23
80
  }
24
81
  export { Badge, badgeVariants };
@@ -1,59 +1,219 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { cn } from "cn";
4
5
  import * as React from "react";
5
6
  import * as RechartsPrimitive from "recharts";
6
- const THEMES = { light: "", dark: ".dark" };
7
- const INITIAL_DIMENSION = { width: 320, height: 200 };
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ const THEMES = {
9
+ light: "",
10
+ dark: ".dark"
11
+ };
12
+ const INITIAL_DIMENSION = {
13
+ width: 320,
14
+ height: 200
15
+ };
8
16
  const ChartContext = React.createContext(null);
9
17
  function useChart() {
10
- const context = React.useContext(ChartContext);
11
- if (!context) {
12
- throw new Error("useChart must be used within a <ChartContainer />");
13
- }
14
- return context;
18
+ const context = React.useContext(ChartContext);
19
+ if (!context) {
20
+ throw new Error("useChart must be used within a <ChartContainer />");
21
+ }
22
+ return context;
15
23
  }
16
- function ChartContainer({ id, className, children, config, initialDimension = INITIAL_DIMENSION, ...props }) {
17
- const uniqueId = React.useId();
18
- const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
19
- return (_jsx(ChartContext.Provider, { value: { config }, children: _jsxs("div", { "data-slot": "chart", "data-chart": chartId, className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className), ...props, children: [_jsx(ChartStyle, { id: chartId, config: config }), _jsx(RechartsPrimitive.ResponsiveContainer, { initialDimension: initialDimension, children: children })] }) }));
24
+ function ChartContainer(t0) {
25
+ const $ = _c(29);
26
+ let children;
27
+ let className;
28
+ let config;
29
+ let id;
30
+ let props;
31
+ let t1;
32
+ if ($[0] !== t0) {
33
+ ({
34
+ id,
35
+ className,
36
+ children,
37
+ config,
38
+ initialDimension: t1,
39
+ ...props
40
+ } = t0);
41
+ $[0] = t0;
42
+ $[1] = children;
43
+ $[2] = className;
44
+ $[3] = config;
45
+ $[4] = id;
46
+ $[5] = props;
47
+ $[6] = t1;
48
+ } else {
49
+ children = $[1];
50
+ className = $[2];
51
+ config = $[3];
52
+ id = $[4];
53
+ props = $[5];
54
+ t1 = $[6];
55
+ }
56
+ const initialDimension = t1 === undefined ? INITIAL_DIMENSION : t1;
57
+ const uniqueId = React.useId();
58
+ let t2;
59
+ if ($[7] !== id || $[8] !== uniqueId) {
60
+ t2 = id ?? uniqueId.replace(/:/g, "");
61
+ $[7] = id;
62
+ $[8] = uniqueId;
63
+ $[9] = t2;
64
+ } else {
65
+ t2 = $[9];
66
+ }
67
+ const chartId = `chart-${t2}`;
68
+ let t3;
69
+ if ($[10] !== config) {
70
+ t3 = {
71
+ config
72
+ };
73
+ $[10] = config;
74
+ $[11] = t3;
75
+ } else {
76
+ t3 = $[11];
77
+ }
78
+ let t4;
79
+ if ($[12] !== className) {
80
+ t4 = cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className);
81
+ $[12] = className;
82
+ $[13] = t4;
83
+ } else {
84
+ t4 = $[13];
85
+ }
86
+ let t5;
87
+ if ($[14] !== chartId || $[15] !== config) {
88
+ t5 = /*#__PURE__*/_jsx(ChartStyle, {
89
+ id: chartId,
90
+ config: config
91
+ });
92
+ $[14] = chartId;
93
+ $[15] = config;
94
+ $[16] = t5;
95
+ } else {
96
+ t5 = $[16];
97
+ }
98
+ let t6;
99
+ if ($[17] !== children || $[18] !== initialDimension) {
100
+ t6 = /*#__PURE__*/_jsx(RechartsPrimitive.ResponsiveContainer, {
101
+ initialDimension: initialDimension,
102
+ children: children
103
+ });
104
+ $[17] = children;
105
+ $[18] = initialDimension;
106
+ $[19] = t6;
107
+ } else {
108
+ t6 = $[19];
109
+ }
110
+ let t7;
111
+ if ($[20] !== chartId || $[21] !== props || $[22] !== t4 || $[23] !== t5 || $[24] !== t6) {
112
+ t7 = /*#__PURE__*/_jsxs("div", {
113
+ "data-slot": "chart",
114
+ "data-chart": chartId,
115
+ className: t4,
116
+ ...props,
117
+ children: [t5, t6]
118
+ });
119
+ $[20] = chartId;
120
+ $[21] = props;
121
+ $[22] = t4;
122
+ $[23] = t5;
123
+ $[24] = t6;
124
+ $[25] = t7;
125
+ } else {
126
+ t7 = $[25];
127
+ }
128
+ let t8;
129
+ if ($[26] !== t3 || $[27] !== t7) {
130
+ t8 = /*#__PURE__*/_jsx(ChartContext.Provider, {
131
+ value: t3,
132
+ children: t7
133
+ });
134
+ $[26] = t3;
135
+ $[27] = t7;
136
+ $[28] = t8;
137
+ } else {
138
+ t8 = $[28];
139
+ }
140
+ return t8;
20
141
  }
21
- const ChartStyle = ({ id, config }) => {
22
- const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);
23
- if (!colorConfig.length) {
24
- return null;
25
- }
26
- return (_jsx("style", { dangerouslySetInnerHTML: {
27
- __html: Object.entries(THEMES)
28
- .map(([theme, prefix]) => `
142
+ const ChartStyle = t0 => {
143
+ const $ = _c(8);
144
+ const {
145
+ id,
146
+ config
147
+ } = t0;
148
+ let t1;
149
+ if ($[0] !== config) {
150
+ t1 = Object.entries(config).filter(_temp);
151
+ $[0] = config;
152
+ $[1] = t1;
153
+ } else {
154
+ t1 = $[1];
155
+ }
156
+ const colorConfig = t1;
157
+ if (!colorConfig.length) {
158
+ return null;
159
+ }
160
+ let t2;
161
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
162
+ t2 = Object.entries(THEMES);
163
+ $[2] = t2;
164
+ } else {
165
+ t2 = $[2];
166
+ }
167
+ let t3;
168
+ if ($[3] !== colorConfig || $[4] !== id) {
169
+ t3 = t2.map(t4 => {
170
+ const [theme, prefix] = t4;
171
+ return `
29
172
  ${prefix} [data-chart=${id}] {
30
- ${colorConfig
31
- .map(([key, itemConfig]) => {
32
- const color = itemConfig.theme?.[theme] ?? itemConfig.color;
33
- return color ? ` --color-${key}: ${color};` : null;
34
- })
35
- .join("\n")}
173
+ ${colorConfig.map(t5 => {
174
+ const [key, itemConfig] = t5;
175
+ const color = itemConfig.theme?.[theme] ?? itemConfig.color;
176
+ return color ? ` --color-${key}: ${color};` : null;
177
+ }).join("\n")}
36
178
  }
37
- `)
38
- .join("\n"),
39
- } }));
179
+ `;
180
+ });
181
+ $[3] = colorConfig;
182
+ $[4] = id;
183
+ $[5] = t3;
184
+ } else {
185
+ t3 = $[5];
186
+ }
187
+ const t4 = t3.join("\n");
188
+ let t5;
189
+ if ($[6] !== t4) {
190
+ t5 = /*#__PURE__*/_jsx("style", {
191
+ dangerouslySetInnerHTML: {
192
+ __html: t4
193
+ }
194
+ });
195
+ $[6] = t4;
196
+ $[7] = t5;
197
+ } else {
198
+ t5 = $[7];
199
+ }
200
+ return t5;
40
201
  };
41
202
  function getPayloadConfigFromPayload(config, payload, key) {
42
- if (typeof payload !== "object" || payload === null) {
43
- return undefined;
44
- }
45
- const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null
46
- ? payload.payload
47
- : undefined;
48
- let configLabelKey = key;
49
- if (key in payload && typeof payload[key] === "string") {
50
- configLabelKey = payload[key];
51
- }
52
- else if (payloadPayload &&
53
- key in payloadPayload &&
54
- typeof payloadPayload[key] === "string") {
55
- configLabelKey = payloadPayload[key];
56
- }
57
- return configLabelKey in config ? config[configLabelKey] : config[key];
203
+ if (typeof payload !== "object" || payload === null) {
204
+ return undefined;
205
+ }
206
+ const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : undefined;
207
+ let configLabelKey = key;
208
+ if (key in payload && typeof payload[key] === "string") {
209
+ configLabelKey = payload[key];
210
+ } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
211
+ configLabelKey = payloadPayload[key];
212
+ }
213
+ return configLabelKey in config ? config[configLabelKey] : config[key];
58
214
  }
59
215
  export { ChartContainer, ChartStyle, getPayloadConfigFromPayload, useChart };
216
+ function _temp(t0) {
217
+ const [, config_0] = t0;
218
+ return config_0.theme ?? config_0.color;
219
+ }
@@ -1,22 +1,87 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { cn } from "cn";
5
+ import * as React from "react";
4
6
  import * as RechartsPrimitive from "recharts";
5
7
  import { getPayloadConfigFromPayload, useChart } from "./chart-container.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
9
  const ChartLegend = RechartsPrimitive.Legend;
7
- function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey, }) {
8
- const { config } = useChart();
9
- if (!payload?.length) {
10
- return null;
10
+ function ChartLegendContent(t0) {
11
+ const $ = _c(15);
12
+ const {
13
+ className,
14
+ hideIcon: t1,
15
+ payload,
16
+ verticalAlign: t2,
17
+ nameKey
18
+ } = t0;
19
+ const hideIcon = t1 === undefined ? false : t1;
20
+ const verticalAlign = t2 === undefined ? "bottom" : t2;
21
+ const {
22
+ config
23
+ } = useChart();
24
+ if (!payload?.length) {
25
+ return null;
26
+ }
27
+ const t3 = verticalAlign === "top" ? "pb-3" : "pt-3";
28
+ let t4;
29
+ if ($[0] !== className || $[1] !== t3) {
30
+ t4 = cn("flex items-center justify-center gap-4", t3, className);
31
+ $[0] = className;
32
+ $[1] = t3;
33
+ $[2] = t4;
34
+ } else {
35
+ t4 = $[2];
36
+ }
37
+ let t5;
38
+ if ($[3] !== config || $[4] !== hideIcon || $[5] !== nameKey || $[6] !== payload) {
39
+ let t6;
40
+ if ($[8] !== config || $[9] !== hideIcon || $[10] !== nameKey) {
41
+ t6 = item_0 => {
42
+ const key = `${nameKey ?? item_0.dataKey ?? "value"}`;
43
+ const itemConfig = getPayloadConfigFromPayload(config, item_0, key);
44
+ return /*#__PURE__*/_jsxs("div", {
45
+ className: cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),
46
+ children: [itemConfig?.icon && !hideIcon ? /*#__PURE__*/_jsx(itemConfig.icon, {}) : /*#__PURE__*/_jsx("div", {
47
+ className: "h-2 w-2 shrink-0 rounded-[2px]",
48
+ style: {
49
+ backgroundColor: item_0.color
50
+ }
51
+ }), itemConfig?.label]
52
+ }, key);
53
+ };
54
+ $[8] = config;
55
+ $[9] = hideIcon;
56
+ $[10] = nameKey;
57
+ $[11] = t6;
58
+ } else {
59
+ t6 = $[11];
11
60
  }
12
- return (_jsx("div", { className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className), children: payload
13
- .filter((item) => item.type !== "none")
14
- .map((item) => {
15
- const key = `${nameKey ?? item.dataKey ?? "value"}`;
16
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
17
- return (_jsxs("div", { className: cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"), children: [itemConfig?.icon && !hideIcon ? (_jsx(itemConfig.icon, {})) : (_jsx("div", { className: "h-2 w-2 shrink-0 rounded-[2px]", style: {
18
- backgroundColor: item.color,
19
- } })), itemConfig?.label] }, key));
20
- }) }));
61
+ t5 = payload.filter(_temp).map(t6);
62
+ $[3] = config;
63
+ $[4] = hideIcon;
64
+ $[5] = nameKey;
65
+ $[6] = payload;
66
+ $[7] = t5;
67
+ } else {
68
+ t5 = $[7];
69
+ }
70
+ let t6;
71
+ if ($[12] !== t4 || $[13] !== t5) {
72
+ t6 = /*#__PURE__*/_jsx("div", {
73
+ className: t4,
74
+ children: t5
75
+ });
76
+ $[12] = t4;
77
+ $[13] = t5;
78
+ $[14] = t6;
79
+ } else {
80
+ t6 = $[14];
81
+ }
82
+ return t6;
83
+ }
84
+ function _temp(item) {
85
+ return item.type !== "none";
21
86
  }
22
87
  export { ChartLegend, ChartLegendContent };