@locusgraph/components 0.2.0 → 0.2.2

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 (102) hide show
  1. package/dist/action/button-group.js +45 -17
  2. package/dist/action/button.js +44 -27
  3. package/dist/action/toggle-group.js +176 -12
  4. package/dist/action/toggle.js +70 -17
  5. package/dist/display/avatar.js +118 -7
  6. package/dist/display/badge.js +33 -20
  7. package/dist/display/chart/chart-container.js +205 -45
  8. package/dist/display/chart/chart-legend.js +79 -14
  9. package/dist/display/chart/chart-tooltip.js +211 -40
  10. package/dist/display/chat/attachment/attachment-parts.js +56 -13
  11. package/dist/display/chat/attachment/attachment.js +70 -28
  12. package/dist/display/chat/bubble.js +80 -37
  13. package/dist/display/chat/marker.js +44 -15
  14. package/dist/display/chat/message-scroller.js +276 -14
  15. package/dist/display/chat/message.js +58 -13
  16. package/dist/display/content/item.js +134 -47
  17. package/dist/display/content/kbd.js +19 -5
  18. package/dist/display/media/aspect-ratio.js +27 -3
  19. package/dist/display/media/carousel-controls.js +162 -11
  20. package/dist/display/media/carousel.js +325 -65
  21. package/dist/display/rule-grid/rule-grid.js +86 -29
  22. package/dist/display/separator.js +56 -3
  23. package/dist/display/skeletons/layouts/skeleton-rule-grid.js +30 -6
  24. package/dist/display/skeletons/layouts/skeleton-table.js +44 -6
  25. package/dist/display/skeletons/shapes/skeleton-avatar.js +31 -13
  26. package/dist/display/skeletons/shapes/skeleton-button.js +31 -13
  27. package/dist/display/skeletons/shapes/skeleton-text.js +25 -7
  28. package/dist/display/skeletons/skeleton-parts.js +22 -6
  29. package/dist/display/status/alert.js +44 -18
  30. package/dist/display/status/empty.js +69 -22
  31. package/dist/display/status/progress.js +116 -16
  32. package/dist/display/status/skeleton.js +10 -3
  33. package/dist/display/status/spinner.js +11 -3
  34. package/dist/display/table.js +77 -17
  35. package/dist/feedback/toaster.js +98 -21
  36. package/dist/form/advanced/calendar-day-button.js +89 -12
  37. package/dist/form/advanced/calendar.js +349 -56
  38. package/dist/form/advanced/combobox/combobox-chips.js +151 -8
  39. package/dist/form/advanced/combobox/combobox-items.js +239 -14
  40. package/dist/form/advanced/combobox/combobox.js +386 -13
  41. package/dist/form/advanced/input-otp.js +201 -11
  42. package/dist/form/choice/checkbox.js +58 -3
  43. package/dist/form/choice/radio-group.js +94 -5
  44. package/dist/form/choice/select.js +479 -25
  45. package/dist/form/choice/slider.js +118 -4
  46. package/dist/form/choice/switch.js +53 -3
  47. package/dist/form/field/field-error.js +34 -14
  48. package/dist/form/field/field-separator.js +19 -3
  49. package/dist/form/field/field-set.js +21 -5
  50. package/dist/form/field/field-text.js +28 -7
  51. package/dist/form/field/field.js +43 -25
  52. package/dist/form/hook-form/form.js +338 -40
  53. package/dist/form/input-group.js +297 -47
  54. package/dist/form/input.js +13 -3
  55. package/dist/form/label.js +42 -3
  56. package/dist/form/native-select.js +39 -7
  57. package/dist/form/textarea.js +11 -3
  58. package/dist/layout/accordion.js +165 -8
  59. package/dist/layout/collapsible.js +75 -7
  60. package/dist/layout/resizable.js +122 -7
  61. package/dist/layout/scroll/direction.js +25 -3
  62. package/dist/layout/scroll/scroll-area.js +138 -5
  63. package/dist/layout/sidebar/sidebar-context.js +184 -51
  64. package/dist/layout/sidebar/sidebar-menu-sub.js +219 -14
  65. package/dist/layout/sidebar/sidebar-menu.js +319 -38
  66. package/dist/layout/sidebar/sidebar-sections.js +369 -22
  67. package/dist/layout/sidebar/sidebar.js +384 -28
  68. package/dist/layout/tabs.js +183 -18
  69. package/dist/layout/use-mobile.js +11 -11
  70. package/dist/navigation/breadcrumb.js +82 -17
  71. package/dist/navigation/menubar/menubar-items.js +322 -16
  72. package/dist/navigation/menubar/menubar-sub.js +125 -7
  73. package/dist/navigation/menubar/menubar.js +213 -13
  74. package/dist/navigation/navigation-menu.js +90 -18
  75. package/dist/navigation/pagination.js +91 -20
  76. package/dist/overlay/alert-dialog.js +485 -26
  77. package/dist/overlay/context-menu/context-menu-items.js +322 -16
  78. package/dist/overlay/context-menu/context-menu-sub.js +125 -7
  79. package/dist/overlay/context-menu/context-menu.js +140 -11
  80. package/dist/overlay/dialog.js +405 -24
  81. package/dist/overlay/floating/command.js +423 -20
  82. package/dist/overlay/floating/drawer.js +354 -22
  83. package/dist/overlay/floating/hover-card.js +107 -7
  84. package/dist/overlay/menu/dropdown-menu-choice.js +149 -7
  85. package/dist/overlay/menu/dropdown-menu-item.js +174 -9
  86. package/dist/overlay/menu/dropdown-menu-sub.js +124 -7
  87. package/dist/overlay/menu/dropdown-menu.js +147 -12
  88. package/dist/overlay/popover.js +106 -7
  89. package/dist/overlay/sheet.js +379 -26
  90. package/dist/overlay/tooltip.js +145 -9
  91. package/dist/shell/app-header.js +29 -5
  92. package/dist/shell/app-shell.js +19 -3
  93. package/dist/shell/breadcrumbs.js +46 -14
  94. package/dist/shell/docs/docs-header.js +210 -10
  95. package/dist/shell/docs/docs-shell.js +36 -3
  96. package/dist/shell/docs/docs-sidebar.js +41 -7
  97. package/dist/shell/docs/on-this-page.js +78 -7
  98. package/dist/shell/docs/use-active-section.js +44 -42
  99. package/dist/shell/navigation/app-sidebar.js +66 -6
  100. package/dist/shell/navigation/nav-group.js +53 -11
  101. package/dist/shell/theme-toggle.js +51 -4
  102. package/package.json +2 -2
@@ -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 };
@@ -1,49 +1,220 @@
1
1
  "use client";
2
- import { Fragment as _Fragment, 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
7
  import { getPayloadConfigFromPayload, useChart } from "./chart-container.js";
8
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
7
9
  const ChartTooltip = RechartsPrimitive.Tooltip;
8
- function ChartTooltipContent({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }) {
9
- const { config } = useChart();
10
- const tooltipLabel = React.useMemo(() => {
11
- if (hideLabel || !payload?.length) {
12
- return null;
13
- }
14
- const [item] = payload;
15
- const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`;
16
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
17
- const value = !labelKey && typeof label === "string" ? (config[label]?.label ?? label) : itemConfig?.label;
18
- if (labelFormatter) {
19
- return (_jsx("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) }));
20
- }
21
- if (!value) {
22
- return null;
23
- }
24
- return _jsx("div", { className: cn("font-medium", labelClassName), children: value });
25
- }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
26
- if (!active || !payload?.length) {
27
- return null;
10
+ function ChartTooltipContent(t0) {
11
+ const $ = _c(45);
12
+ const {
13
+ active,
14
+ payload,
15
+ className,
16
+ indicator: t1,
17
+ hideLabel: t2,
18
+ hideIndicator: t3,
19
+ label,
20
+ labelFormatter,
21
+ labelClassName,
22
+ formatter,
23
+ color,
24
+ nameKey,
25
+ labelKey
26
+ } = t0;
27
+ const indicator = t1 === undefined ? "dot" : t1;
28
+ const hideLabel = t2 === undefined ? false : t2;
29
+ const hideIndicator = t3 === undefined ? false : t3;
30
+ const {
31
+ config
32
+ } = useChart();
33
+ let t4;
34
+ bb0: {
35
+ if (hideLabel || !payload?.length) {
36
+ t4 = null;
37
+ break bb0;
28
38
  }
29
- const nestLabel = payload.length === 1 && indicator !== "dot";
30
- return (_jsxs("div", { className: cn("grid min-w-[8rem] items-start gap-1.5 bg-popover px-2.5 py-1.5 text-xs text-popover-foreground shadow-overlay ring-1 ring-border", className), children: [!nestLabel ? tooltipLabel : null, _jsx("div", { className: "grid gap-1.5", children: payload
31
- .filter((item) => item.type !== "none")
32
- .map((item, index) => {
33
- const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
34
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
35
- const indicatorColor = color ?? item.payload?.fill ?? item.color;
36
- return (_jsx("div", { className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"), children: formatter && item?.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, item.payload)) : (_jsxs(_Fragment, { children: [itemConfig?.icon ? (_jsx(itemConfig.icon, {})) : (!hideIndicator && (_jsx("div", { className: cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
37
- "h-2.5 w-2.5": indicator === "dot",
38
- "w-1": indicator === "line",
39
- "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
40
- "my-0.5": nestLabel && indicator === "dashed",
41
- }), style: {
42
- "--color-bg": indicatorColor,
43
- "--color-border": indicatorColor,
44
- } }))), _jsxs("div", { className: cn("flex flex-1 justify-between gap-4 leading-none", nestLabel ? "items-end" : "items-center"), children: [_jsxs("div", { className: "grid gap-1.5", children: [nestLabel ? tooltipLabel : null, _jsx("span", { className: "text-muted-foreground", children: itemConfig?.label ?? item.name })] }), item.value != null && (_jsx("span", { className: "font-mono font-medium text-foreground tabular-nums", children: typeof item.value === "number"
45
- ? item.value.toLocaleString()
46
- : String(item.value) }))] })] })) }, key));
47
- }) })] }));
39
+ const [item] = payload;
40
+ const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`;
41
+ let t5;
42
+ if ($[0] !== config || $[1] !== item || $[2] !== key) {
43
+ t5 = getPayloadConfigFromPayload(config, item, key);
44
+ $[0] = config;
45
+ $[1] = item;
46
+ $[2] = key;
47
+ $[3] = t5;
48
+ } else {
49
+ t5 = $[3];
50
+ }
51
+ const itemConfig = t5;
52
+ const value = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
53
+ if (labelFormatter) {
54
+ let t6;
55
+ if ($[4] !== labelClassName) {
56
+ t6 = cn("font-medium", labelClassName);
57
+ $[4] = labelClassName;
58
+ $[5] = t6;
59
+ } else {
60
+ t6 = $[5];
61
+ }
62
+ let t7;
63
+ if ($[6] !== labelFormatter || $[7] !== payload || $[8] !== value) {
64
+ t7 = labelFormatter(value, payload);
65
+ $[6] = labelFormatter;
66
+ $[7] = payload;
67
+ $[8] = value;
68
+ $[9] = t7;
69
+ } else {
70
+ t7 = $[9];
71
+ }
72
+ let t8;
73
+ if ($[10] !== t6 || $[11] !== t7) {
74
+ t8 = /*#__PURE__*/_jsx("div", {
75
+ className: t6,
76
+ children: t7
77
+ });
78
+ $[10] = t6;
79
+ $[11] = t7;
80
+ $[12] = t8;
81
+ } else {
82
+ t8 = $[12];
83
+ }
84
+ t4 = t8;
85
+ break bb0;
86
+ }
87
+ if (!value) {
88
+ t4 = null;
89
+ break bb0;
90
+ }
91
+ let t6;
92
+ if ($[13] !== labelClassName) {
93
+ t6 = cn("font-medium", labelClassName);
94
+ $[13] = labelClassName;
95
+ $[14] = t6;
96
+ } else {
97
+ t6 = $[14];
98
+ }
99
+ let t7;
100
+ if ($[15] !== t6 || $[16] !== value) {
101
+ t7 = /*#__PURE__*/_jsx("div", {
102
+ className: t6,
103
+ children: value
104
+ });
105
+ $[15] = t6;
106
+ $[16] = value;
107
+ $[17] = t7;
108
+ } else {
109
+ t7 = $[17];
110
+ }
111
+ t4 = t7;
112
+ }
113
+ const tooltipLabel = t4;
114
+ if (!active || !payload?.length) {
115
+ return null;
116
+ }
117
+ const nestLabel = payload.length === 1 && indicator !== "dot";
118
+ let t5;
119
+ if ($[18] !== className) {
120
+ t5 = cn("grid min-w-[8rem] items-start gap-1.5 bg-popover px-2.5 py-1.5 text-xs text-popover-foreground shadow-overlay ring-1 ring-border", className);
121
+ $[18] = className;
122
+ $[19] = t5;
123
+ } else {
124
+ t5 = $[19];
125
+ }
126
+ const t6 = !nestLabel ? tooltipLabel : null;
127
+ let t7;
128
+ if ($[20] !== color || $[21] !== config || $[22] !== formatter || $[23] !== hideIndicator || $[24] !== indicator || $[25] !== nameKey || $[26] !== nestLabel || $[27] !== payload || $[28] !== tooltipLabel) {
129
+ let t8;
130
+ if ($[30] !== color || $[31] !== config || $[32] !== formatter || $[33] !== hideIndicator || $[34] !== indicator || $[35] !== nameKey || $[36] !== nestLabel || $[37] !== tooltipLabel) {
131
+ t8 = (item_1, index) => {
132
+ const key_0 = `${nameKey ?? item_1.name ?? item_1.dataKey ?? "value"}`;
133
+ const itemConfig_0 = getPayloadConfigFromPayload(config, item_1, key_0);
134
+ const indicatorColor = color ?? item_1.payload?.fill ?? item_1.color;
135
+ return /*#__PURE__*/_jsx("div", {
136
+ className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"),
137
+ children: formatter && item_1?.value !== undefined && item_1.name ? formatter(item_1.value, item_1.name, item_1, index, item_1.payload) : /*#__PURE__*/_jsxs(_Fragment, {
138
+ children: [itemConfig_0?.icon ? /*#__PURE__*/_jsx(itemConfig_0.icon, {}) : !hideIndicator && /*#__PURE__*/_jsx("div", {
139
+ className: cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
140
+ "h-2.5 w-2.5": indicator === "dot",
141
+ "w-1": indicator === "line",
142
+ "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
143
+ "my-0.5": nestLabel && indicator === "dashed"
144
+ }),
145
+ style: {
146
+ "--color-bg": indicatorColor,
147
+ "--color-border": indicatorColor
148
+ }
149
+ }), /*#__PURE__*/_jsxs("div", {
150
+ className: cn("flex flex-1 justify-between gap-4 leading-none", nestLabel ? "items-end" : "items-center"),
151
+ children: [/*#__PURE__*/_jsxs("div", {
152
+ className: "grid gap-1.5",
153
+ children: [nestLabel ? tooltipLabel : null, /*#__PURE__*/_jsx("span", {
154
+ className: "text-muted-foreground",
155
+ children: itemConfig_0?.label ?? item_1.name
156
+ })]
157
+ }), item_1.value != null && /*#__PURE__*/_jsx("span", {
158
+ className: "font-mono font-medium text-foreground tabular-nums",
159
+ children: typeof item_1.value === "number" ? item_1.value.toLocaleString() : String(item_1.value)
160
+ })]
161
+ })]
162
+ })
163
+ }, key_0);
164
+ };
165
+ $[30] = color;
166
+ $[31] = config;
167
+ $[32] = formatter;
168
+ $[33] = hideIndicator;
169
+ $[34] = indicator;
170
+ $[35] = nameKey;
171
+ $[36] = nestLabel;
172
+ $[37] = tooltipLabel;
173
+ $[38] = t8;
174
+ } else {
175
+ t8 = $[38];
176
+ }
177
+ t7 = payload.filter(_temp).map(t8);
178
+ $[20] = color;
179
+ $[21] = config;
180
+ $[22] = formatter;
181
+ $[23] = hideIndicator;
182
+ $[24] = indicator;
183
+ $[25] = nameKey;
184
+ $[26] = nestLabel;
185
+ $[27] = payload;
186
+ $[28] = tooltipLabel;
187
+ $[29] = t7;
188
+ } else {
189
+ t7 = $[29];
190
+ }
191
+ let t8;
192
+ if ($[39] !== t7) {
193
+ t8 = /*#__PURE__*/_jsx("div", {
194
+ className: "grid gap-1.5",
195
+ children: t7
196
+ });
197
+ $[39] = t7;
198
+ $[40] = t8;
199
+ } else {
200
+ t8 = $[40];
201
+ }
202
+ let t9;
203
+ if ($[41] !== t5 || $[42] !== t6 || $[43] !== t8) {
204
+ t9 = /*#__PURE__*/_jsxs("div", {
205
+ className: t5,
206
+ children: [t6, t8]
207
+ });
208
+ $[41] = t5;
209
+ $[42] = t6;
210
+ $[43] = t8;
211
+ $[44] = t9;
212
+ } else {
213
+ t9 = $[44];
214
+ }
215
+ return t9;
216
+ }
217
+ function _temp(item_0) {
218
+ return item_0.type !== "none";
48
219
  }
49
220
  export { ChartTooltip, ChartTooltipContent };