@karakuri-ui/react 0.3.3 → 0.3.4
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 +27 -24
- 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 +45 -27
- 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 +41 -32
- 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 +46 -43
- 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 +30 -25
- 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 +6 -5
- 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 +24 -14
- 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 +53 -39
- 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 +154 -130
- 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 +47 -40
- 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 +16 -13
- 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 +44 -35
- 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 +31 -24
- 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 +18 -15
- 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 +17 -14
- package/dist/components/ui/icon-button.mjs.map +1 -1
- package/dist/components/ui/input.js +34 -29
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/input.mjs +34 -29
- 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 +24 -21
- 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 +91 -74
- 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 +114 -93
- 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 +66 -55
- 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 +39 -36
- 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 +73 -64
- 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 +23 -19
- 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 +7 -6
- 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 +55 -48
- 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 +20 -19
- 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 +68 -58
- 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 +185 -176
- 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 +39 -28
- 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 +26 -23
- 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 +25 -9
- 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 +2 -1
- 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 +104 -80
- 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 +9 -8
- 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 +3 -2
- 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 +18 -15
- package/dist/components/ui/tooltip.mjs.map +1 -1
- package/package.json +27 -19
|
@@ -44,6 +44,7 @@ __export(chart_exports, {
|
|
|
44
44
|
useChart: () => useChart
|
|
45
45
|
});
|
|
46
46
|
module.exports = __toCommonJS(chart_exports);
|
|
47
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
48
|
var React = __toESM(require("react"));
|
|
48
49
|
var RechartsPrimitive = __toESM(require("recharts"));
|
|
49
50
|
var import_utils = require("../../lib/utils");
|
|
@@ -68,7 +69,7 @@ function Chart({
|
|
|
68
69
|
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
69
70
|
const [activeIndex, setActiveIndex] = React.useState(null);
|
|
70
71
|
const [activeDataKey, setActiveDataKey] = React.useState(null);
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartContext.Provider, { value: { config, hoverFade, activeIndex, setActiveIndex, activeDataKey, setActiveDataKey }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
72
73
|
"div",
|
|
73
74
|
{
|
|
74
75
|
"data-slot": "chart",
|
|
@@ -97,11 +98,13 @@ function Chart({
|
|
|
97
98
|
"[&_.recharts-surface]:outline-none",
|
|
98
99
|
className
|
|
99
100
|
),
|
|
100
|
-
...props
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
...props,
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartStyle, { id: chartId, config }),
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RechartsPrimitive.ResponsiveContainer, { children })
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
) });
|
|
105
108
|
}
|
|
106
109
|
const CHART_TOOLTIP_KEYFRAME = "@keyframes chart-tooltip-in{from{opacity:0}to{opacity:1}}";
|
|
107
110
|
const ChartStyle = ({ id, config }) => {
|
|
@@ -118,7 +121,7 @@ ${colorConfig.map(([key, itemConfig]) => {
|
|
|
118
121
|
}
|
|
119
122
|
`
|
|
120
123
|
).join("\n") : "";
|
|
121
|
-
return /* @__PURE__ */
|
|
124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
122
125
|
"style",
|
|
123
126
|
{
|
|
124
127
|
dangerouslySetInnerHTML: {
|
|
@@ -159,12 +162,12 @@ function ChartBar({
|
|
|
159
162
|
const y = shapeProps.y ?? 0;
|
|
160
163
|
const width = shapeProps.width ?? 0;
|
|
161
164
|
const height = shapeProps.height ?? 0;
|
|
162
|
-
if (!width || !height || width <= 0 || height <= 0) return /* @__PURE__ */
|
|
165
|
+
if (!width || !height || width <= 0 || height <= 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {});
|
|
163
166
|
const sw = 2;
|
|
164
167
|
const inset = sw / 2;
|
|
165
168
|
const rx = typeof appliedRadius === "number" ? Math.max(0, appliedRadius - inset) : 0;
|
|
166
169
|
const fadeMultiplier = hoverFade && activeIndex !== null && shapeProps.index !== activeIndex ? CHART_HOVER_FADE_OPACITY : 1;
|
|
167
|
-
return /* @__PURE__ */
|
|
170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
168
171
|
"rect",
|
|
169
172
|
{
|
|
170
173
|
x: x + inset,
|
|
@@ -183,7 +186,7 @@ function ChartBar({
|
|
|
183
186
|
}, [appliedRadius, fill, hoverFade, activeIndex]);
|
|
184
187
|
const solidHoverShape = React.useCallback((shapeProps) => {
|
|
185
188
|
const opacity = activeIndex === null ? 1 : shapeProps.index === activeIndex ? 1 : CHART_HOVER_FADE_OPACITY;
|
|
186
|
-
return /* @__PURE__ */
|
|
189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
187
190
|
RechartsPrimitive.Rectangle,
|
|
188
191
|
{
|
|
189
192
|
...shapeProps,
|
|
@@ -194,7 +197,7 @@ function ChartBar({
|
|
|
194
197
|
}, [activeIndex]);
|
|
195
198
|
const useOutline = variant === "outline" && !isStacked;
|
|
196
199
|
const needsHoverShape = hoverFade && variant === "solid" && !useOutline;
|
|
197
|
-
return /* @__PURE__ */
|
|
200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
198
201
|
RechartsPrimitive.Bar,
|
|
199
202
|
{
|
|
200
203
|
radius: appliedRadius,
|
|
@@ -209,7 +212,7 @@ function ChartBar({
|
|
|
209
212
|
);
|
|
210
213
|
}
|
|
211
214
|
function ChartTooltip(props) {
|
|
212
|
-
return /* @__PURE__ */
|
|
215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RechartsPrimitive.Tooltip, { animationDuration: 0, ...props });
|
|
213
216
|
}
|
|
214
217
|
function ChartTooltipContent({
|
|
215
218
|
active,
|
|
@@ -236,70 +239,80 @@ function ChartTooltipContent({
|
|
|
236
239
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
237
240
|
const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
|
|
238
241
|
if (labelFormatter) {
|
|
239
|
-
return /* @__PURE__ */
|
|
242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_utils.cn)("font-semibold", labelClassName), children: labelFormatter(value, payload) });
|
|
240
243
|
}
|
|
241
244
|
if (!value) {
|
|
242
245
|
return null;
|
|
243
246
|
}
|
|
244
|
-
return /* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_utils.cn)("font-semibold", labelClassName), children: value });
|
|
245
248
|
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
246
249
|
if (!active || !payload?.length) {
|
|
247
250
|
return null;
|
|
248
251
|
}
|
|
249
252
|
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
250
|
-
return /* @__PURE__ */
|
|
253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
251
254
|
"div",
|
|
252
255
|
{
|
|
253
256
|
className: (0, import_utils.cn)(
|
|
254
257
|
"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",
|
|
255
258
|
className
|
|
256
259
|
),
|
|
257
|
-
style: { animation: "chart-tooltip-in var(--duration-slow) ease-out" }
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
260
|
+
style: { animation: "chart-tooltip-in var(--duration-slow) ease-out" },
|
|
261
|
+
children: [
|
|
262
|
+
!nestLabel ? tooltipLabel : null,
|
|
263
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
264
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
265
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
266
|
+
const indicatorColor = color || item.payload?.fill || item.color;
|
|
267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
268
|
+
"div",
|
|
269
|
+
{
|
|
270
|
+
className: (0, import_utils.cn)(
|
|
271
|
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-text-muted",
|
|
272
|
+
indicator === "dot" && "items-center"
|
|
273
|
+
),
|
|
274
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
275
|
+
itemConfig?.icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
276
|
+
"div",
|
|
277
|
+
{
|
|
278
|
+
className: (0, import_utils.cn)(
|
|
279
|
+
"shrink-0 rounded-sm",
|
|
280
|
+
{
|
|
281
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
282
|
+
"w-1": indicator === "line",
|
|
283
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
284
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
style: {
|
|
288
|
+
backgroundColor: indicator === "dashed" ? "transparent" : indicatorColor,
|
|
289
|
+
borderColor: indicatorColor
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
294
|
+
"div",
|
|
295
|
+
{
|
|
296
|
+
className: (0, import_utils.cn)(
|
|
297
|
+
"flex flex-1 justify-between gap-4 leading-none",
|
|
298
|
+
nestLabel ? "items-end" : "items-center"
|
|
299
|
+
),
|
|
300
|
+
children: [
|
|
301
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid gap-1.5", children: [
|
|
302
|
+
nestLabel ? tooltipLabel : null,
|
|
303
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-text-muted", children: itemConfig?.label || item.name })
|
|
304
|
+
] }),
|
|
305
|
+
item.value && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-mono font-semibold text-foreground tabular-nums", children: item.value.toLocaleString() })
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
] })
|
|
310
|
+
},
|
|
311
|
+
item.dataKey
|
|
312
|
+
);
|
|
313
|
+
}) })
|
|
314
|
+
]
|
|
315
|
+
}
|
|
303
316
|
);
|
|
304
317
|
}
|
|
305
318
|
const ChartLegend = RechartsPrimitive.Legend;
|
|
@@ -317,7 +330,7 @@ function ChartLegendContent({
|
|
|
317
330
|
return null;
|
|
318
331
|
}
|
|
319
332
|
const isVertical = layout === "vertical";
|
|
320
|
-
return /* @__PURE__ */
|
|
333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
321
334
|
"div",
|
|
322
335
|
{
|
|
323
336
|
className: (0, import_utils.cn)(
|
|
@@ -328,29 +341,31 @@ function ChartLegendContent({
|
|
|
328
341
|
verticalAlign === "top" ? "pb-3" : "pt-3"
|
|
329
342
|
],
|
|
330
343
|
className
|
|
331
|
-
)
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
return /* @__PURE__ */ React.createElement(
|
|
337
|
-
"div",
|
|
338
|
-
{
|
|
339
|
-
key: item.value,
|
|
340
|
-
className: "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-text-muted"
|
|
341
|
-
},
|
|
342
|
-
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ React.createElement(itemConfig.icon, null) : /* @__PURE__ */ React.createElement(
|
|
344
|
+
),
|
|
345
|
+
children: payload.filter((item) => item.type !== "none").map((item) => {
|
|
346
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
|
347
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
343
349
|
"div",
|
|
344
350
|
{
|
|
345
|
-
className: "h-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
351
|
+
className: "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-text-muted",
|
|
352
|
+
children: [
|
|
353
|
+
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(itemConfig.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
354
|
+
"div",
|
|
355
|
+
{
|
|
356
|
+
className: "h-2 w-2 shrink-0 rounded-sm",
|
|
357
|
+
style: {
|
|
358
|
+
backgroundColor: item.color
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
),
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-foreground", children: itemConfig?.label })
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
item.value
|
|
366
|
+
);
|
|
367
|
+
})
|
|
368
|
+
}
|
|
354
369
|
);
|
|
355
370
|
}
|
|
356
371
|
function getPayloadConfigFromPayload(config, payload, key) {
|
|
@@ -369,10 +384,10 @@ function getPayloadConfigFromPayload(config, payload, key) {
|
|
|
369
384
|
const CHART_AXIS_TICK_STYLE = { style: { fontSize: "var(--chart-axis-fs)", fill: "var(--color-text-subtle)" } };
|
|
370
385
|
const CHART_XAXIS_PADDING = { left: 16, right: 16 };
|
|
371
386
|
function ChartXAxis({ tick, padding, ...props }) {
|
|
372
|
-
return /* @__PURE__ */
|
|
387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RechartsPrimitive.XAxis, { tick: tick ?? CHART_AXIS_TICK_STYLE, padding: padding ?? CHART_XAXIS_PADDING, ...props });
|
|
373
388
|
}
|
|
374
389
|
function ChartYAxis({ tick, width = "auto", ...props }) {
|
|
375
|
-
return /* @__PURE__ */
|
|
390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RechartsPrimitive.YAxis, { tick: tick ?? CHART_AXIS_TICK_STYLE, width, ...props });
|
|
376
391
|
}
|
|
377
392
|
const CHART_LINE_DASH = "5 5";
|
|
378
393
|
const CHART_DOT_PROPS = { r: 3, strokeWidth: 2 };
|
|
@@ -391,7 +406,7 @@ function ChartLine({
|
|
|
391
406
|
const opacity = isFaded ? CHART_HOVER_FADE_OPACITY : 1;
|
|
392
407
|
const dotProps = showDot ? variant === "dashed" ? { ...CHART_DOT_PROPS, strokeDasharray: "0" } : CHART_DOT_PROPS : false;
|
|
393
408
|
const activeDotProps = showActiveDot ? variant === "dashed" ? { ...CHART_ACTIVE_DOT_PROPS, strokeDasharray: "0" } : CHART_ACTIVE_DOT_PROPS : false;
|
|
394
|
-
return /* @__PURE__ */
|
|
409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
395
410
|
RechartsPrimitive.Line,
|
|
396
411
|
{
|
|
397
412
|
type,
|
|
@@ -429,24 +444,30 @@ function ChartArea({
|
|
|
429
444
|
const gradientId = `area-gradient-${String(dataKey)}`;
|
|
430
445
|
const effectiveFill = variant === "gradient" ? `url(#${gradientId})` : fill || stroke;
|
|
431
446
|
const effectiveFillOpacity = variant === "gradient" ? 1 : fillOpacity;
|
|
432
|
-
return /* @__PURE__ */
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
448
|
+
variant === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "5%", stopColor: fill || stroke, stopOpacity: 0.8 }),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "95%", stopColor: fill || stroke, stopOpacity: 0 })
|
|
451
|
+
] }) }),
|
|
452
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
453
|
+
RechartsPrimitive.Area,
|
|
454
|
+
{
|
|
455
|
+
type,
|
|
456
|
+
dataKey,
|
|
457
|
+
stroke,
|
|
458
|
+
fill: effectiveFill,
|
|
459
|
+
fillOpacity: effectiveFillOpacity * opacity,
|
|
460
|
+
strokeWidth: 2,
|
|
461
|
+
dot: dotProps,
|
|
462
|
+
activeDot: activeDotProps,
|
|
463
|
+
strokeOpacity: opacity,
|
|
464
|
+
...hoverFade && { isAnimationActive: false },
|
|
465
|
+
...hoverFade && { onMouseEnter: () => setActiveDataKey(dataKey) },
|
|
466
|
+
style: hoverFade ? { transition: "fill-opacity var(--duration-fast) ease-out, stroke-opacity var(--duration-fast) ease-out" } : void 0,
|
|
467
|
+
...props
|
|
468
|
+
}
|
|
469
|
+
)
|
|
470
|
+
] });
|
|
450
471
|
}
|
|
451
472
|
const CHART_PIE_ACTIVE_OFFSET = 8;
|
|
452
473
|
const CHART_PIE_DONUT_INNER_RADIUS = 60;
|
|
@@ -466,7 +487,7 @@ function ChartPie({
|
|
|
466
487
|
...props
|
|
467
488
|
}) {
|
|
468
489
|
const resolvedInnerRadius = innerRadius ?? (variant === "donut" ? CHART_PIE_DONUT_INNER_RADIUS : 0);
|
|
469
|
-
const activeShapeConfig = showActiveShape ? (props2) => /* @__PURE__ */
|
|
490
|
+
const activeShapeConfig = showActiveShape ? (props2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
470
491
|
RechartsPrimitive.Sector,
|
|
471
492
|
{
|
|
472
493
|
...props2,
|
|
@@ -483,26 +504,29 @@ function ChartPie({
|
|
|
483
504
|
const my = cy + (outerRadius + CHART_PIE_LABEL_RADIAL) * Math.sin(-midAngle * RADIAN);
|
|
484
505
|
const isRight = mx > cx;
|
|
485
506
|
const ex = mx + (isRight ? CHART_PIE_LABEL_HORIZ : -CHART_PIE_LABEL_HORIZ);
|
|
486
|
-
return /* @__PURE__ */
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { children: [
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
509
|
+
"polyline",
|
|
510
|
+
{
|
|
511
|
+
points: `${sx},${sy} ${mx},${my} ${ex},${my}`,
|
|
512
|
+
fill: "none",
|
|
513
|
+
stroke: fill,
|
|
514
|
+
strokeWidth: 1,
|
|
515
|
+
strokeOpacity: 0.5
|
|
516
|
+
}
|
|
517
|
+
),
|
|
518
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
519
|
+
"text",
|
|
520
|
+
{
|
|
521
|
+
x: ex + (isRight ? 4 : -4),
|
|
522
|
+
y: my,
|
|
523
|
+
textAnchor: isRight ? "start" : "end",
|
|
524
|
+
dominantBaseline: "central",
|
|
525
|
+
style: { fontSize: "var(--font-size-xs)", fill: "var(--color-text-muted)" },
|
|
526
|
+
children: getDisplayText(entry)
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
] });
|
|
506
530
|
} : labelMode === "inside" ? (entry) => {
|
|
507
531
|
const angle = Math.abs(entry.endAngle - entry.startAngle);
|
|
508
532
|
if (angle < CHART_PIE_SKIP_ANGLE) return null;
|
|
@@ -512,19 +536,19 @@ function ChartPie({
|
|
|
512
536
|
const radius = ir + (or - ir) * ratio;
|
|
513
537
|
const x = cx + radius * Math.cos(-midAngle * RADIAN);
|
|
514
538
|
const y = cy + radius * Math.sin(-midAngle * RADIAN);
|
|
515
|
-
return /* @__PURE__ */
|
|
539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
516
540
|
"text",
|
|
517
541
|
{
|
|
518
542
|
x,
|
|
519
543
|
y,
|
|
520
544
|
textAnchor: "middle",
|
|
521
545
|
dominantBaseline: "central",
|
|
522
|
-
style: { fontSize: "var(--font-size-xs)", fill: "white", fontWeight: 600 }
|
|
523
|
-
|
|
524
|
-
|
|
546
|
+
style: { fontSize: "var(--font-size-xs)", fill: "white", fontWeight: 600 },
|
|
547
|
+
children: getDisplayText(entry)
|
|
548
|
+
}
|
|
525
549
|
);
|
|
526
550
|
} : false;
|
|
527
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
528
552
|
RechartsPrimitive.Pie,
|
|
529
553
|
{
|
|
530
554
|
innerRadius: resolvedInnerRadius,
|