@karakuri-ui/react 0.3.3 → 0.3.5
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/README.md +27 -4
- package/dist/components/ui/accordion.js +27 -24
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/accordion.mjs +28 -25
- package/dist/components/ui/accordion.mjs.map +1 -1
- package/dist/components/ui/alert.js +45 -27
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/alert.mjs +46 -28
- package/dist/components/ui/alert.mjs.map +1 -1
- package/dist/components/ui/avatar.js +41 -32
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/avatar.mjs +42 -33
- package/dist/components/ui/avatar.mjs.map +1 -1
- package/dist/components/ui/badge.js +46 -43
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/badge.mjs +47 -44
- package/dist/components/ui/badge.mjs.map +1 -1
- package/dist/components/ui/breadcrumb.js +30 -25
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/breadcrumb.mjs +31 -26
- package/dist/components/ui/breadcrumb.mjs.map +1 -1
- package/dist/components/ui/button-group.js +6 -5
- package/dist/components/ui/button-group.js.map +1 -1
- package/dist/components/ui/button-group.mjs +7 -6
- package/dist/components/ui/button-group.mjs.map +1 -1
- package/dist/components/ui/button.js +24 -14
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/button.mjs +26 -16
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.js +53 -39
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/card.mjs +54 -40
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/chart.d.mts +1 -1
- package/dist/components/ui/chart.d.ts +1 -1
- package/dist/components/ui/chart.js +154 -130
- package/dist/components/ui/chart.js.map +1 -1
- package/dist/components/ui/chart.mjs +155 -131
- package/dist/components/ui/chart.mjs.map +1 -1
- package/dist/components/ui/checkbox.js +47 -40
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/checkbox.mjs +49 -42
- package/dist/components/ui/checkbox.mjs.map +1 -1
- package/dist/components/ui/divider.js +16 -13
- package/dist/components/ui/divider.js.map +1 -1
- package/dist/components/ui/divider.mjs +17 -14
- package/dist/components/ui/divider.mjs.map +1 -1
- package/dist/components/ui/drawer.js +44 -35
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/drawer.mjs +45 -36
- package/dist/components/ui/drawer.mjs.map +1 -1
- package/dist/components/ui/dropdown.js +31 -24
- package/dist/components/ui/dropdown.js.map +1 -1
- package/dist/components/ui/dropdown.mjs +32 -25
- package/dist/components/ui/dropdown.mjs.map +1 -1
- package/dist/components/ui/field.js +18 -15
- package/dist/components/ui/field.js.map +1 -1
- package/dist/components/ui/field.mjs +19 -16
- package/dist/components/ui/field.mjs.map +1 -1
- package/dist/components/ui/icon-button.js +17 -14
- package/dist/components/ui/icon-button.js.map +1 -1
- package/dist/components/ui/icon-button.mjs +19 -16
- package/dist/components/ui/icon-button.mjs.map +1 -1
- package/dist/components/ui/index.mjs +35 -35
- package/dist/components/ui/input.js +34 -29
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/input.mjs +36 -31
- package/dist/components/ui/input.mjs.map +1 -1
- package/dist/components/ui/metric-card.js +24 -21
- package/dist/components/ui/metric-card.js.map +1 -1
- package/dist/components/ui/metric-card.mjs +25 -22
- package/dist/components/ui/metric-card.mjs.map +1 -1
- package/dist/components/ui/modal.js +91 -74
- package/dist/components/ui/modal.js.map +1 -1
- package/dist/components/ui/modal.mjs +92 -75
- package/dist/components/ui/modal.mjs.map +1 -1
- package/dist/components/ui/navigation-menu.js +114 -93
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/navigation-menu.mjs +115 -94
- package/dist/components/ui/navigation-menu.mjs.map +1 -1
- package/dist/components/ui/pagination.js +66 -55
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/pagination.mjs +67 -56
- package/dist/components/ui/pagination.mjs.map +1 -1
- package/dist/components/ui/popover.js +39 -36
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/popover.mjs +40 -37
- package/dist/components/ui/popover.mjs.map +1 -1
- package/dist/components/ui/progress.js +73 -64
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/progress.mjs +74 -65
- package/dist/components/ui/progress.mjs.map +1 -1
- package/dist/components/ui/radio-group.js +23 -19
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/radio-group.mjs +25 -21
- package/dist/components/ui/radio-group.mjs.map +1 -1
- package/dist/components/ui/segmented.js +7 -6
- package/dist/components/ui/segmented.js.map +1 -1
- package/dist/components/ui/segmented.mjs +8 -7
- package/dist/components/ui/segmented.mjs.map +1 -1
- package/dist/components/ui/select.js +55 -48
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/select.mjs +56 -49
- package/dist/components/ui/select.mjs.map +1 -1
- package/dist/components/ui/skeleton.js +20 -19
- package/dist/components/ui/skeleton.js.map +1 -1
- package/dist/components/ui/skeleton.mjs +21 -20
- package/dist/components/ui/skeleton.mjs.map +1 -1
- package/dist/components/ui/slider.js +68 -58
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/slider.mjs +69 -59
- package/dist/components/ui/slider.mjs.map +1 -1
- package/dist/components/ui/spinner.js +185 -176
- package/dist/components/ui/spinner.js.map +1 -1
- package/dist/components/ui/spinner.mjs +186 -177
- package/dist/components/ui/spinner.mjs.map +1 -1
- package/dist/components/ui/switch.js +39 -28
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/switch.mjs +41 -30
- package/dist/components/ui/switch.mjs.map +1 -1
- package/dist/components/ui/table.js +26 -23
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/table.mjs +27 -24
- package/dist/components/ui/table.mjs.map +1 -1
- package/dist/components/ui/tabs.js +25 -9
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/tabs.mjs +26 -10
- package/dist/components/ui/tabs.mjs.map +1 -1
- package/dist/components/ui/textarea.js +2 -1
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/textarea.mjs +4 -3
- package/dist/components/ui/textarea.mjs.map +1 -1
- package/dist/components/ui/toast.js +104 -80
- package/dist/components/ui/toast.js.map +1 -1
- package/dist/components/ui/toast.mjs +105 -81
- package/dist/components/ui/toast.mjs.map +1 -1
- package/dist/components/ui/toggle-group.js +9 -8
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/toggle-group.mjs +10 -9
- package/dist/components/ui/toggle-group.mjs.map +1 -1
- package/dist/components/ui/toggle.js +3 -2
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/components/ui/toggle.mjs +4 -3
- package/dist/components/ui/toggle.mjs.map +1 -1
- package/dist/components/ui/tooltip.js +18 -15
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/ui/tooltip.mjs +19 -16
- package/dist/components/ui/tooltip.mjs.map +1 -1
- package/package.json +27 -19
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import * as RechartsPrimitive from "recharts";
|
|
4
|
-
import { cn } from "../../lib/utils";
|
|
5
|
+
import { cn } from "../../lib/utils.mjs";
|
|
5
6
|
const THEMES = { light: "", dark: ".dark" };
|
|
6
7
|
const ChartContext = React.createContext(null);
|
|
7
8
|
function useChart() {
|
|
@@ -23,7 +24,7 @@ function Chart({
|
|
|
23
24
|
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
24
25
|
const [activeIndex, setActiveIndex] = React.useState(null);
|
|
25
26
|
const [activeDataKey, setActiveDataKey] = React.useState(null);
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ jsx(ChartContext.Provider, { value: { config, hoverFade, activeIndex, setActiveIndex, activeDataKey, setActiveDataKey }, children: /* @__PURE__ */ jsxs(
|
|
27
28
|
"div",
|
|
28
29
|
{
|
|
29
30
|
"data-slot": "chart",
|
|
@@ -52,11 +53,13 @@ function Chart({
|
|
|
52
53
|
"[&_.recharts-surface]:outline-none",
|
|
53
54
|
className
|
|
54
55
|
),
|
|
55
|
-
...props
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
...props,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(ChartStyle, { id: chartId, config }),
|
|
59
|
+
/* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, { children })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
) });
|
|
60
63
|
}
|
|
61
64
|
const CHART_TOOLTIP_KEYFRAME = "@keyframes chart-tooltip-in{from{opacity:0}to{opacity:1}}";
|
|
62
65
|
const ChartStyle = ({ id, config }) => {
|
|
@@ -73,7 +76,7 @@ ${colorConfig.map(([key, itemConfig]) => {
|
|
|
73
76
|
}
|
|
74
77
|
`
|
|
75
78
|
).join("\n") : "";
|
|
76
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ jsx(
|
|
77
80
|
"style",
|
|
78
81
|
{
|
|
79
82
|
dangerouslySetInnerHTML: {
|
|
@@ -114,12 +117,12 @@ function ChartBar({
|
|
|
114
117
|
const y = shapeProps.y ?? 0;
|
|
115
118
|
const width = shapeProps.width ?? 0;
|
|
116
119
|
const height = shapeProps.height ?? 0;
|
|
117
|
-
if (!width || !height || width <= 0 || height <= 0) return /* @__PURE__ */
|
|
120
|
+
if (!width || !height || width <= 0 || height <= 0) return /* @__PURE__ */ jsx("g", {});
|
|
118
121
|
const sw = 2;
|
|
119
122
|
const inset = sw / 2;
|
|
120
123
|
const rx = typeof appliedRadius === "number" ? Math.max(0, appliedRadius - inset) : 0;
|
|
121
124
|
const fadeMultiplier = hoverFade && activeIndex !== null && shapeProps.index !== activeIndex ? CHART_HOVER_FADE_OPACITY : 1;
|
|
122
|
-
return /* @__PURE__ */
|
|
125
|
+
return /* @__PURE__ */ jsx(
|
|
123
126
|
"rect",
|
|
124
127
|
{
|
|
125
128
|
x: x + inset,
|
|
@@ -138,7 +141,7 @@ function ChartBar({
|
|
|
138
141
|
}, [appliedRadius, fill, hoverFade, activeIndex]);
|
|
139
142
|
const solidHoverShape = React.useCallback((shapeProps) => {
|
|
140
143
|
const opacity = activeIndex === null ? 1 : shapeProps.index === activeIndex ? 1 : CHART_HOVER_FADE_OPACITY;
|
|
141
|
-
return /* @__PURE__ */
|
|
144
|
+
return /* @__PURE__ */ jsx(
|
|
142
145
|
RechartsPrimitive.Rectangle,
|
|
143
146
|
{
|
|
144
147
|
...shapeProps,
|
|
@@ -149,7 +152,7 @@ function ChartBar({
|
|
|
149
152
|
}, [activeIndex]);
|
|
150
153
|
const useOutline = variant === "outline" && !isStacked;
|
|
151
154
|
const needsHoverShape = hoverFade && variant === "solid" && !useOutline;
|
|
152
|
-
return /* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ jsx(
|
|
153
156
|
RechartsPrimitive.Bar,
|
|
154
157
|
{
|
|
155
158
|
radius: appliedRadius,
|
|
@@ -164,7 +167,7 @@ function ChartBar({
|
|
|
164
167
|
);
|
|
165
168
|
}
|
|
166
169
|
function ChartTooltip(props) {
|
|
167
|
-
return /* @__PURE__ */
|
|
170
|
+
return /* @__PURE__ */ jsx(RechartsPrimitive.Tooltip, { animationDuration: 0, ...props });
|
|
168
171
|
}
|
|
169
172
|
function ChartTooltipContent({
|
|
170
173
|
active,
|
|
@@ -191,70 +194,80 @@ function ChartTooltipContent({
|
|
|
191
194
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
192
195
|
const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
|
|
193
196
|
if (labelFormatter) {
|
|
194
|
-
return /* @__PURE__ */
|
|
197
|
+
return /* @__PURE__ */ jsx("div", { className: cn("font-semibold", labelClassName), children: labelFormatter(value, payload) });
|
|
195
198
|
}
|
|
196
199
|
if (!value) {
|
|
197
200
|
return null;
|
|
198
201
|
}
|
|
199
|
-
return /* @__PURE__ */
|
|
202
|
+
return /* @__PURE__ */ jsx("div", { className: cn("font-semibold", labelClassName), children: value });
|
|
200
203
|
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
201
204
|
if (!active || !payload?.length) {
|
|
202
205
|
return null;
|
|
203
206
|
}
|
|
204
207
|
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
205
|
-
return /* @__PURE__ */
|
|
208
|
+
return /* @__PURE__ */ jsxs(
|
|
206
209
|
"div",
|
|
207
210
|
{
|
|
208
211
|
className: cn(
|
|
209
212
|
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
|
210
213
|
className
|
|
211
214
|
),
|
|
212
|
-
style: { animation: "chart-tooltip-in var(--duration-slow) ease-out" }
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
215
|
+
style: { animation: "chart-tooltip-in var(--duration-slow) ease-out" },
|
|
216
|
+
children: [
|
|
217
|
+
!nestLabel ? tooltipLabel : null,
|
|
218
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
219
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
220
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
221
|
+
const indicatorColor = color || item.payload?.fill || item.color;
|
|
222
|
+
return /* @__PURE__ */ jsx(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
className: cn(
|
|
226
|
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-text-muted",
|
|
227
|
+
indicator === "dot" && "items-center"
|
|
228
|
+
),
|
|
229
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
230
|
+
itemConfig?.icon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx(
|
|
231
|
+
"div",
|
|
232
|
+
{
|
|
233
|
+
className: cn(
|
|
234
|
+
"shrink-0 rounded-sm",
|
|
235
|
+
{
|
|
236
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
237
|
+
"w-1": indicator === "line",
|
|
238
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
239
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
style: {
|
|
243
|
+
backgroundColor: indicator === "dashed" ? "transparent" : indicatorColor,
|
|
244
|
+
borderColor: indicatorColor
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
/* @__PURE__ */ jsxs(
|
|
249
|
+
"div",
|
|
250
|
+
{
|
|
251
|
+
className: cn(
|
|
252
|
+
"flex flex-1 justify-between gap-4 leading-none",
|
|
253
|
+
nestLabel ? "items-end" : "items-center"
|
|
254
|
+
),
|
|
255
|
+
children: [
|
|
256
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", children: [
|
|
257
|
+
nestLabel ? tooltipLabel : null,
|
|
258
|
+
/* @__PURE__ */ jsx("span", { className: "text-text-muted", children: itemConfig?.label || item.name })
|
|
259
|
+
] }),
|
|
260
|
+
item.value && /* @__PURE__ */ jsx("span", { className: "font-mono font-semibold text-foreground tabular-nums", children: item.value.toLocaleString() })
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
)
|
|
264
|
+
] })
|
|
265
|
+
},
|
|
266
|
+
item.dataKey
|
|
267
|
+
);
|
|
268
|
+
}) })
|
|
269
|
+
]
|
|
270
|
+
}
|
|
258
271
|
);
|
|
259
272
|
}
|
|
260
273
|
const ChartLegend = RechartsPrimitive.Legend;
|
|
@@ -272,7 +285,7 @@ function ChartLegendContent({
|
|
|
272
285
|
return null;
|
|
273
286
|
}
|
|
274
287
|
const isVertical = layout === "vertical";
|
|
275
|
-
return /* @__PURE__ */
|
|
288
|
+
return /* @__PURE__ */ jsx(
|
|
276
289
|
"div",
|
|
277
290
|
{
|
|
278
291
|
className: cn(
|
|
@@ -283,29 +296,31 @@ function ChartLegendContent({
|
|
|
283
296
|
verticalAlign === "top" ? "pb-3" : "pt-3"
|
|
284
297
|
],
|
|
285
298
|
className
|
|
286
|
-
)
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
return /* @__PURE__ */ React.createElement(
|
|
292
|
-
"div",
|
|
293
|
-
{
|
|
294
|
-
key: item.value,
|
|
295
|
-
className: "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-text-muted"
|
|
296
|
-
},
|
|
297
|
-
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ React.createElement(itemConfig.icon, null) : /* @__PURE__ */ React.createElement(
|
|
299
|
+
),
|
|
300
|
+
children: payload.filter((item) => item.type !== "none").map((item) => {
|
|
301
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
|
302
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
303
|
+
return /* @__PURE__ */ jsxs(
|
|
298
304
|
"div",
|
|
299
305
|
{
|
|
300
|
-
className: "h-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
className: "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-text-muted",
|
|
307
|
+
children: [
|
|
308
|
+
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx(
|
|
309
|
+
"div",
|
|
310
|
+
{
|
|
311
|
+
className: "h-2 w-2 shrink-0 rounded-sm",
|
|
312
|
+
style: {
|
|
313
|
+
backgroundColor: item.color
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: itemConfig?.label })
|
|
318
|
+
]
|
|
319
|
+
},
|
|
320
|
+
item.value
|
|
321
|
+
);
|
|
322
|
+
})
|
|
323
|
+
}
|
|
309
324
|
);
|
|
310
325
|
}
|
|
311
326
|
function getPayloadConfigFromPayload(config, payload, key) {
|
|
@@ -324,10 +339,10 @@ function getPayloadConfigFromPayload(config, payload, key) {
|
|
|
324
339
|
const CHART_AXIS_TICK_STYLE = { style: { fontSize: "var(--chart-axis-fs)", fill: "var(--color-text-subtle)" } };
|
|
325
340
|
const CHART_XAXIS_PADDING = { left: 16, right: 16 };
|
|
326
341
|
function ChartXAxis({ tick, padding, ...props }) {
|
|
327
|
-
return /* @__PURE__ */
|
|
342
|
+
return /* @__PURE__ */ jsx(RechartsPrimitive.XAxis, { tick: tick ?? CHART_AXIS_TICK_STYLE, padding: padding ?? CHART_XAXIS_PADDING, ...props });
|
|
328
343
|
}
|
|
329
344
|
function ChartYAxis({ tick, width = "auto", ...props }) {
|
|
330
|
-
return /* @__PURE__ */
|
|
345
|
+
return /* @__PURE__ */ jsx(RechartsPrimitive.YAxis, { tick: tick ?? CHART_AXIS_TICK_STYLE, width, ...props });
|
|
331
346
|
}
|
|
332
347
|
const CHART_LINE_DASH = "5 5";
|
|
333
348
|
const CHART_DOT_PROPS = { r: 3, strokeWidth: 2 };
|
|
@@ -346,7 +361,7 @@ function ChartLine({
|
|
|
346
361
|
const opacity = isFaded ? CHART_HOVER_FADE_OPACITY : 1;
|
|
347
362
|
const dotProps = showDot ? variant === "dashed" ? { ...CHART_DOT_PROPS, strokeDasharray: "0" } : CHART_DOT_PROPS : false;
|
|
348
363
|
const activeDotProps = showActiveDot ? variant === "dashed" ? { ...CHART_ACTIVE_DOT_PROPS, strokeDasharray: "0" } : CHART_ACTIVE_DOT_PROPS : false;
|
|
349
|
-
return /* @__PURE__ */
|
|
364
|
+
return /* @__PURE__ */ jsx(
|
|
350
365
|
RechartsPrimitive.Line,
|
|
351
366
|
{
|
|
352
367
|
type,
|
|
@@ -384,24 +399,30 @@ function ChartArea({
|
|
|
384
399
|
const gradientId = `area-gradient-${String(dataKey)}`;
|
|
385
400
|
const effectiveFill = variant === "gradient" ? `url(#${gradientId})` : fill || stroke;
|
|
386
401
|
const effectiveFillOpacity = variant === "gradient" ? 1 : fillOpacity;
|
|
387
|
-
return /* @__PURE__ */
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
403
|
+
variant === "gradient" && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
404
|
+
/* @__PURE__ */ jsx("stop", { offset: "5%", stopColor: fill || stroke, stopOpacity: 0.8 }),
|
|
405
|
+
/* @__PURE__ */ jsx("stop", { offset: "95%", stopColor: fill || stroke, stopOpacity: 0 })
|
|
406
|
+
] }) }),
|
|
407
|
+
/* @__PURE__ */ jsx(
|
|
408
|
+
RechartsPrimitive.Area,
|
|
409
|
+
{
|
|
410
|
+
type,
|
|
411
|
+
dataKey,
|
|
412
|
+
stroke,
|
|
413
|
+
fill: effectiveFill,
|
|
414
|
+
fillOpacity: effectiveFillOpacity * opacity,
|
|
415
|
+
strokeWidth: 2,
|
|
416
|
+
dot: dotProps,
|
|
417
|
+
activeDot: activeDotProps,
|
|
418
|
+
strokeOpacity: opacity,
|
|
419
|
+
...hoverFade && { isAnimationActive: false },
|
|
420
|
+
...hoverFade && { onMouseEnter: () => setActiveDataKey(dataKey) },
|
|
421
|
+
style: hoverFade ? { transition: "fill-opacity var(--duration-fast) ease-out, stroke-opacity var(--duration-fast) ease-out" } : void 0,
|
|
422
|
+
...props
|
|
423
|
+
}
|
|
424
|
+
)
|
|
425
|
+
] });
|
|
405
426
|
}
|
|
406
427
|
const CHART_PIE_ACTIVE_OFFSET = 8;
|
|
407
428
|
const CHART_PIE_DONUT_INNER_RADIUS = 60;
|
|
@@ -421,7 +442,7 @@ function ChartPie({
|
|
|
421
442
|
...props
|
|
422
443
|
}) {
|
|
423
444
|
const resolvedInnerRadius = innerRadius ?? (variant === "donut" ? CHART_PIE_DONUT_INNER_RADIUS : 0);
|
|
424
|
-
const activeShapeConfig = showActiveShape ? (props2) => /* @__PURE__ */
|
|
445
|
+
const activeShapeConfig = showActiveShape ? (props2) => /* @__PURE__ */ jsx(
|
|
425
446
|
RechartsPrimitive.Sector,
|
|
426
447
|
{
|
|
427
448
|
...props2,
|
|
@@ -438,26 +459,29 @@ function ChartPie({
|
|
|
438
459
|
const my = cy + (outerRadius + CHART_PIE_LABEL_RADIAL) * Math.sin(-midAngle * RADIAN);
|
|
439
460
|
const isRight = mx > cx;
|
|
440
461
|
const ex = mx + (isRight ? CHART_PIE_LABEL_HORIZ : -CHART_PIE_LABEL_HORIZ);
|
|
441
|
-
return /* @__PURE__ */
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
462
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
463
|
+
/* @__PURE__ */ jsx(
|
|
464
|
+
"polyline",
|
|
465
|
+
{
|
|
466
|
+
points: `${sx},${sy} ${mx},${my} ${ex},${my}`,
|
|
467
|
+
fill: "none",
|
|
468
|
+
stroke: fill,
|
|
469
|
+
strokeWidth: 1,
|
|
470
|
+
strokeOpacity: 0.5
|
|
471
|
+
}
|
|
472
|
+
),
|
|
473
|
+
/* @__PURE__ */ jsx(
|
|
474
|
+
"text",
|
|
475
|
+
{
|
|
476
|
+
x: ex + (isRight ? 4 : -4),
|
|
477
|
+
y: my,
|
|
478
|
+
textAnchor: isRight ? "start" : "end",
|
|
479
|
+
dominantBaseline: "central",
|
|
480
|
+
style: { fontSize: "var(--font-size-xs)", fill: "var(--color-text-muted)" },
|
|
481
|
+
children: getDisplayText(entry)
|
|
482
|
+
}
|
|
483
|
+
)
|
|
484
|
+
] });
|
|
461
485
|
} : labelMode === "inside" ? (entry) => {
|
|
462
486
|
const angle = Math.abs(entry.endAngle - entry.startAngle);
|
|
463
487
|
if (angle < CHART_PIE_SKIP_ANGLE) return null;
|
|
@@ -467,19 +491,19 @@ function ChartPie({
|
|
|
467
491
|
const radius = ir + (or - ir) * ratio;
|
|
468
492
|
const x = cx + radius * Math.cos(-midAngle * RADIAN);
|
|
469
493
|
const y = cy + radius * Math.sin(-midAngle * RADIAN);
|
|
470
|
-
return /* @__PURE__ */
|
|
494
|
+
return /* @__PURE__ */ jsx(
|
|
471
495
|
"text",
|
|
472
496
|
{
|
|
473
497
|
x,
|
|
474
498
|
y,
|
|
475
499
|
textAnchor: "middle",
|
|
476
500
|
dominantBaseline: "central",
|
|
477
|
-
style: { fontSize: "var(--font-size-xs)", fill: "white", fontWeight: 600 }
|
|
478
|
-
|
|
479
|
-
|
|
501
|
+
style: { fontSize: "var(--font-size-xs)", fill: "white", fontWeight: 600 },
|
|
502
|
+
children: getDisplayText(entry)
|
|
503
|
+
}
|
|
480
504
|
);
|
|
481
505
|
} : false;
|
|
482
|
-
return /* @__PURE__ */
|
|
506
|
+
return /* @__PURE__ */ jsx(
|
|
483
507
|
RechartsPrimitive.Pie,
|
|
484
508
|
{
|
|
485
509
|
innerRadius: resolvedInnerRadius,
|