@x-plat/design-system 0.5.34 → 0.5.35
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/dist/components/Chart/index.cjs +131 -115
- package/dist/components/Chart/index.css +4 -1
- package/dist/components/Chart/index.js +117 -101
- package/dist/components/index.cjs +162 -162
- package/dist/components/index.css +4 -1
- package/dist/components/index.js +142 -142
- package/dist/index.cjs +162 -162
- package/dist/index.css +4 -1
- package/dist/index.js +142 -142
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6229,8 +6229,25 @@ var CardTab = Object.assign(CardTabRoot, {
|
|
|
6229
6229
|
var CardTab_default = CardTab;
|
|
6230
6230
|
|
|
6231
6231
|
// src/components/Chart/Chart.tsx
|
|
6232
|
+
import React7 from "react";
|
|
6233
|
+
|
|
6234
|
+
// src/tokens/hooks/Portal.tsx
|
|
6232
6235
|
import React6 from "react";
|
|
6233
|
-
import
|
|
6236
|
+
import ReactDOM from "react-dom";
|
|
6237
|
+
import { jsx as jsx307 } from "react/jsx-runtime";
|
|
6238
|
+
var PortalContainerContext = React6.createContext(null);
|
|
6239
|
+
var PortalProvider = ({ container, children }) => /* @__PURE__ */ jsx307(PortalContainerContext.Provider, { value: container, children });
|
|
6240
|
+
var Portal = ({ children }) => {
|
|
6241
|
+
const contextContainer = React6.useContext(PortalContainerContext);
|
|
6242
|
+
if (typeof document === "undefined") return null;
|
|
6243
|
+
const container = contextContainer ?? document.body;
|
|
6244
|
+
return ReactDOM.createPortal(children, container);
|
|
6245
|
+
};
|
|
6246
|
+
Portal.displayName = "Portal";
|
|
6247
|
+
var Portal_default = Portal;
|
|
6248
|
+
|
|
6249
|
+
// src/components/Chart/Chart.tsx
|
|
6250
|
+
import { Fragment as Fragment2, jsx as jsx308, jsxs as jsxs197 } from "react/jsx-runtime";
|
|
6234
6251
|
var CATEGORICAL_COUNT2 = 8;
|
|
6235
6252
|
var LINE_BAR_PALETTES = Array.from({ length: CATEGORICAL_COUNT2 }, (_, i) => {
|
|
6236
6253
|
const n = i + 1;
|
|
@@ -6276,11 +6293,11 @@ var toSmoothPath = (points) => {
|
|
|
6276
6293
|
};
|
|
6277
6294
|
var RESIZE_SETTLE_MS = 150;
|
|
6278
6295
|
var useChartSize = (ref) => {
|
|
6279
|
-
const [size, setSize] =
|
|
6280
|
-
const settleTimer =
|
|
6281
|
-
const committedSize =
|
|
6282
|
-
const initialRef =
|
|
6283
|
-
|
|
6296
|
+
const [size, setSize] = React7.useState({ width: 0, height: 0 });
|
|
6297
|
+
const settleTimer = React7.useRef(0);
|
|
6298
|
+
const committedSize = React7.useRef({ width: 0, height: 0 });
|
|
6299
|
+
const initialRef = React7.useRef(true);
|
|
6300
|
+
React7.useEffect(() => {
|
|
6284
6301
|
const el = ref.current;
|
|
6285
6302
|
if (!el) return;
|
|
6286
6303
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -6322,10 +6339,10 @@ var useChartSize = (ref) => {
|
|
|
6322
6339
|
};
|
|
6323
6340
|
var prefersReducedMotion = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6324
6341
|
var useChartAnimation = (containerRef, dataKey) => {
|
|
6325
|
-
const [animate, setAnimate] =
|
|
6326
|
-
const prevDataKey =
|
|
6327
|
-
const hasAnimated =
|
|
6328
|
-
|
|
6342
|
+
const [animate, setAnimate] = React7.useState(false);
|
|
6343
|
+
const prevDataKey = React7.useRef(dataKey);
|
|
6344
|
+
const hasAnimated = React7.useRef(false);
|
|
6345
|
+
React7.useEffect(() => {
|
|
6329
6346
|
if (prefersReducedMotion()) return;
|
|
6330
6347
|
const el = containerRef.current;
|
|
6331
6348
|
if (!el) return;
|
|
@@ -6341,7 +6358,7 @@ var useChartAnimation = (containerRef, dataKey) => {
|
|
|
6341
6358
|
observer.observe(el);
|
|
6342
6359
|
return () => observer.disconnect();
|
|
6343
6360
|
}, [containerRef]);
|
|
6344
|
-
|
|
6361
|
+
React7.useEffect(() => {
|
|
6345
6362
|
if (dataKey !== prevDataKey.current) {
|
|
6346
6363
|
prevDataKey.current = dataKey;
|
|
6347
6364
|
if (prefersReducedMotion()) return;
|
|
@@ -6355,15 +6372,15 @@ var useChartAnimation = (containerRef, dataKey) => {
|
|
|
6355
6372
|
};
|
|
6356
6373
|
var TOOLTIP_OFFSET = 12;
|
|
6357
6374
|
var useChartTooltip = (enabled) => {
|
|
6358
|
-
const [tooltip, setTooltip] =
|
|
6375
|
+
const [tooltip, setTooltip] = React7.useState({
|
|
6359
6376
|
visible: false,
|
|
6360
6377
|
clientX: 0,
|
|
6361
6378
|
clientY: 0,
|
|
6362
6379
|
content: ""
|
|
6363
6380
|
});
|
|
6364
|
-
const containerRef =
|
|
6365
|
-
const rafRef =
|
|
6366
|
-
const move =
|
|
6381
|
+
const containerRef = React7.useRef(null);
|
|
6382
|
+
const rafRef = React7.useRef(0);
|
|
6383
|
+
const move = React7.useCallback((e) => {
|
|
6367
6384
|
if (!enabled) return;
|
|
6368
6385
|
const cx = e.clientX;
|
|
6369
6386
|
const cy = e.clientY;
|
|
@@ -6372,22 +6389,22 @@ var useChartTooltip = (enabled) => {
|
|
|
6372
6389
|
setTooltip((prev) => ({ ...prev, clientX: cx, clientY: cy }));
|
|
6373
6390
|
});
|
|
6374
6391
|
}, [enabled]);
|
|
6375
|
-
const show =
|
|
6392
|
+
const show = React7.useCallback((e, content) => {
|
|
6376
6393
|
if (!enabled) return;
|
|
6377
6394
|
setTooltip({ visible: true, clientX: e.clientX, clientY: e.clientY, content });
|
|
6378
6395
|
}, [enabled]);
|
|
6379
|
-
const hide =
|
|
6396
|
+
const hide = React7.useCallback(() => {
|
|
6380
6397
|
cancelAnimationFrame(rafRef.current);
|
|
6381
6398
|
setTooltip((prev) => ({ ...prev, visible: false }));
|
|
6382
6399
|
}, []);
|
|
6383
6400
|
return { tooltip, show, hide, move, containerRef };
|
|
6384
6401
|
};
|
|
6385
|
-
var GridLines =
|
|
6402
|
+
var GridLines = React7.memo(({ width, height, chartH, maxVal }) => /* @__PURE__ */ jsx308(Fragment2, { children: [0, 0.25, 0.5, 0.75, 1].map((ratio) => {
|
|
6386
6403
|
const y = PADDING.top + (1 - ratio) * chartH;
|
|
6387
6404
|
const val = Math.round(maxVal * ratio);
|
|
6388
6405
|
return /* @__PURE__ */ jsxs197("g", { children: [
|
|
6389
|
-
/* @__PURE__ */
|
|
6390
|
-
/* @__PURE__ */
|
|
6406
|
+
/* @__PURE__ */ jsx308("line", { x1: PADDING.left, y1: y, x2: width - PADDING.right, y2: y, className: "chart-grid" }),
|
|
6407
|
+
/* @__PURE__ */ jsx308("text", { x: PADDING.left - 8, y: y + 4, className: "chart-axis-label", textAnchor: "end", children: val })
|
|
6391
6408
|
] }, ratio);
|
|
6392
6409
|
}) }));
|
|
6393
6410
|
GridLines.displayName = "GridLines";
|
|
@@ -6397,18 +6414,18 @@ var getLabelStep = (count, chartW) => {
|
|
|
6397
6414
|
if (count <= maxLabels) return 1;
|
|
6398
6415
|
return Math.ceil(count / maxLabels);
|
|
6399
6416
|
};
|
|
6400
|
-
var AxisLabels =
|
|
6417
|
+
var AxisLabels = React7.memo(({ labels, count, chartW, height }) => {
|
|
6401
6418
|
const step = getLabelStep(count, chartW);
|
|
6402
|
-
return /* @__PURE__ */
|
|
6419
|
+
return /* @__PURE__ */ jsx308(Fragment2, { children: labels.map((label, i) => {
|
|
6403
6420
|
if (i % step !== 0) return null;
|
|
6404
6421
|
const x = PADDING.left + i / (count - 1 || 1) * chartW;
|
|
6405
|
-
return /* @__PURE__ */
|
|
6422
|
+
return /* @__PURE__ */ jsx308("text", { x, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
6406
6423
|
}) });
|
|
6407
6424
|
});
|
|
6408
6425
|
AxisLabels.displayName = "AxisLabels";
|
|
6409
6426
|
var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
6410
|
-
const [activeIndex, setActiveIndex] =
|
|
6411
|
-
const handleMouseMove =
|
|
6427
|
+
const [activeIndex, setActiveIndex] = React7.useState(null);
|
|
6428
|
+
const handleMouseMove = React7.useCallback((e) => {
|
|
6412
6429
|
const svg = e.currentTarget;
|
|
6413
6430
|
const rect = svg.getBoundingClientRect();
|
|
6414
6431
|
const mx = (e.clientX - rect.left) / rect.width * svg.viewBox.baseVal.width;
|
|
@@ -6427,17 +6444,17 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
|
6427
6444
|
}
|
|
6428
6445
|
setActiveIndex(minDist <= threshold ? closest : null);
|
|
6429
6446
|
}, [seriesPoints]);
|
|
6430
|
-
const handleMouseLeave =
|
|
6447
|
+
const handleMouseLeave = React7.useCallback(() => {
|
|
6431
6448
|
setActiveIndex(null);
|
|
6432
6449
|
}, []);
|
|
6433
|
-
const tooltipContent =
|
|
6450
|
+
const tooltipContent = React7.useMemo(() => {
|
|
6434
6451
|
if (activeIndex === null) return "";
|
|
6435
6452
|
return entries.map(([key], di) => {
|
|
6436
6453
|
const p = seriesPoints[di]?.[activeIndex];
|
|
6437
6454
|
return p ? `${key}: ${p.v}` : "";
|
|
6438
6455
|
}).filter(Boolean).join(" / ");
|
|
6439
6456
|
}, [activeIndex, entries, seriesPoints]);
|
|
6440
|
-
const getTooltipAt =
|
|
6457
|
+
const getTooltipAt = React7.useCallback((idx) => {
|
|
6441
6458
|
return entries.map(([key], di) => {
|
|
6442
6459
|
const p = seriesPoints[di]?.[idx];
|
|
6443
6460
|
return p ? `${key}: ${p.v}` : "";
|
|
@@ -6445,16 +6462,16 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
|
6445
6462
|
}, [entries, seriesPoints]);
|
|
6446
6463
|
return { activeIndex, handleMouseMove, handleMouseLeave, tooltipContent, getTooltipAt };
|
|
6447
6464
|
};
|
|
6448
|
-
var LineChart =
|
|
6449
|
-
const entries =
|
|
6450
|
-
const maxVal =
|
|
6465
|
+
var LineChart = React7.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
6466
|
+
const entries = React7.useMemo(() => Object.entries(data), [data]);
|
|
6467
|
+
const maxVal = React7.useMemo(() => {
|
|
6451
6468
|
const allValues = entries.flatMap(([, v]) => v);
|
|
6452
6469
|
return Math.max(...allValues) * 1.2 || 1;
|
|
6453
6470
|
}, [entries]);
|
|
6454
6471
|
const count = labels.length;
|
|
6455
6472
|
const chartW = width - PADDING.left - PADDING.right;
|
|
6456
6473
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
6457
|
-
const seriesPoints =
|
|
6474
|
+
const seriesPoints = React7.useMemo(
|
|
6458
6475
|
() => entries.map(
|
|
6459
6476
|
([, values]) => values.map((v, i) => ({
|
|
6460
6477
|
x: PADDING.left + i / (count - 1 || 1) * chartW,
|
|
@@ -6464,9 +6481,9 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6464
6481
|
),
|
|
6465
6482
|
[entries, count, chartW, chartH, maxVal]
|
|
6466
6483
|
);
|
|
6467
|
-
const clipRef =
|
|
6484
|
+
const clipRef = React7.useRef(null);
|
|
6468
6485
|
const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
|
|
6469
|
-
|
|
6486
|
+
React7.useEffect(() => {
|
|
6470
6487
|
if (!animate || !clipRef.current) return;
|
|
6471
6488
|
clipRef.current.setAttribute("width", "0");
|
|
6472
6489
|
requestAnimationFrame(() => {
|
|
@@ -6511,9 +6528,9 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6511
6528
|
onLeave();
|
|
6512
6529
|
},
|
|
6513
6530
|
children: [
|
|
6514
|
-
animate && /* @__PURE__ */
|
|
6515
|
-
/* @__PURE__ */
|
|
6516
|
-
/* @__PURE__ */
|
|
6531
|
+
animate && /* @__PURE__ */ jsx308("defs", { children: /* @__PURE__ */ jsx308("clipPath", { id: lineClipId, children: /* @__PURE__ */ jsx308("rect", { ref: clipRef, x: "0", y: "0", width: animate ? 0 : width, height }) }) }),
|
|
6532
|
+
/* @__PURE__ */ jsx308(GridLines, { width, height, chartH, maxVal }),
|
|
6533
|
+
/* @__PURE__ */ jsx308(AxisLabels, { labels, count, chartW, height }),
|
|
6517
6534
|
entries.map(([key], di) => {
|
|
6518
6535
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
6519
6536
|
const color = palette[2];
|
|
@@ -6523,15 +6540,15 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6523
6540
|
const polyPoints = points.map((p) => `${p.x},${p.y}`).join(" ");
|
|
6524
6541
|
const areaD = `M ${points[0].x},${points[0].y} ${points.map((p) => `L ${p.x},${p.y}`).join(" ")} L ${points[points.length - 1].x},${PADDING.top + chartH} L ${points[0].x},${PADDING.top + chartH} Z`;
|
|
6525
6542
|
return /* @__PURE__ */ jsxs197("g", { children: [
|
|
6526
|
-
/* @__PURE__ */
|
|
6527
|
-
/* @__PURE__ */
|
|
6528
|
-
/* @__PURE__ */
|
|
6543
|
+
/* @__PURE__ */ jsx308("defs", { children: /* @__PURE__ */ jsxs197("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
6544
|
+
/* @__PURE__ */ jsx308("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.2" }),
|
|
6545
|
+
/* @__PURE__ */ jsx308("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0" })
|
|
6529
6546
|
] }) }),
|
|
6530
6547
|
/* @__PURE__ */ jsxs197("g", { clipPath: animate ? `url(#${lineClipId})` : void 0, children: [
|
|
6531
|
-
/* @__PURE__ */
|
|
6532
|
-
/* @__PURE__ */
|
|
6548
|
+
/* @__PURE__ */ jsx308("path", { d: areaD, fill: `url(#${gradientId})` }),
|
|
6549
|
+
/* @__PURE__ */ jsx308("polyline", { points: polyPoints, fill: "none", stroke: color, strokeWidth: "2" })
|
|
6533
6550
|
] }),
|
|
6534
|
-
activeIndex !== null && points[activeIndex] && /* @__PURE__ */
|
|
6551
|
+
activeIndex !== null && points[activeIndex] && /* @__PURE__ */ jsx308(
|
|
6535
6552
|
"circle",
|
|
6536
6553
|
{
|
|
6537
6554
|
cx: points[activeIndex].x,
|
|
@@ -6543,7 +6560,7 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6543
6560
|
)
|
|
6544
6561
|
] }, di);
|
|
6545
6562
|
}),
|
|
6546
|
-
activeX !== null && /* @__PURE__ */
|
|
6563
|
+
activeX !== null && /* @__PURE__ */ jsx308(
|
|
6547
6564
|
"line",
|
|
6548
6565
|
{
|
|
6549
6566
|
x1: activeX,
|
|
@@ -6553,7 +6570,7 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6553
6570
|
className: "chart-crosshair"
|
|
6554
6571
|
}
|
|
6555
6572
|
),
|
|
6556
|
-
/* @__PURE__ */
|
|
6573
|
+
/* @__PURE__ */ jsx308(
|
|
6557
6574
|
"rect",
|
|
6558
6575
|
{
|
|
6559
6576
|
x: PADDING.left,
|
|
@@ -6569,16 +6586,16 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6569
6586
|
);
|
|
6570
6587
|
});
|
|
6571
6588
|
LineChart.displayName = "LineChart";
|
|
6572
|
-
var CurveChart =
|
|
6573
|
-
const entries =
|
|
6574
|
-
const maxVal =
|
|
6589
|
+
var CurveChart = React7.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
6590
|
+
const entries = React7.useMemo(() => Object.entries(data), [data]);
|
|
6591
|
+
const maxVal = React7.useMemo(() => {
|
|
6575
6592
|
const allValues = entries.flatMap(([, v]) => v);
|
|
6576
6593
|
return Math.max(...allValues) * 1.2 || 1;
|
|
6577
6594
|
}, [entries]);
|
|
6578
6595
|
const count = labels.length;
|
|
6579
6596
|
const chartW = width - PADDING.left - PADDING.right;
|
|
6580
6597
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
6581
|
-
const seriesPoints =
|
|
6598
|
+
const seriesPoints = React7.useMemo(
|
|
6582
6599
|
() => entries.map(
|
|
6583
6600
|
([, values]) => values.map((v, i) => ({
|
|
6584
6601
|
x: PADDING.left + i / (count - 1 || 1) * chartW,
|
|
@@ -6588,9 +6605,9 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6588
6605
|
),
|
|
6589
6606
|
[entries, count, chartW, chartH, maxVal]
|
|
6590
6607
|
);
|
|
6591
|
-
const curveClipRef =
|
|
6608
|
+
const curveClipRef = React7.useRef(null);
|
|
6592
6609
|
const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
|
|
6593
|
-
|
|
6610
|
+
React7.useEffect(() => {
|
|
6594
6611
|
if (!animate || !curveClipRef.current) return;
|
|
6595
6612
|
curveClipRef.current.setAttribute("width", "0");
|
|
6596
6613
|
requestAnimationFrame(() => {
|
|
@@ -6635,9 +6652,9 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6635
6652
|
onLeave();
|
|
6636
6653
|
},
|
|
6637
6654
|
children: [
|
|
6638
|
-
animate && /* @__PURE__ */
|
|
6639
|
-
/* @__PURE__ */
|
|
6640
|
-
/* @__PURE__ */
|
|
6655
|
+
animate && /* @__PURE__ */ jsx308("defs", { children: /* @__PURE__ */ jsx308("clipPath", { id: curveClipId, children: /* @__PURE__ */ jsx308("rect", { ref: curveClipRef, x: "0", y: "0", width: animate ? 0 : width, height }) }) }),
|
|
6656
|
+
/* @__PURE__ */ jsx308(GridLines, { width, height, chartH, maxVal }),
|
|
6657
|
+
/* @__PURE__ */ jsx308(AxisLabels, { labels, count, chartW, height }),
|
|
6641
6658
|
entries.map(([key], di) => {
|
|
6642
6659
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
6643
6660
|
const color = palette[2];
|
|
@@ -6647,15 +6664,15 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6647
6664
|
const linePath = toSmoothPath(points);
|
|
6648
6665
|
const areaPath = linePath + ` L ${points[points.length - 1].x} ${PADDING.top + chartH} L ${points[0].x} ${PADDING.top + chartH} Z`;
|
|
6649
6666
|
return /* @__PURE__ */ jsxs197("g", { children: [
|
|
6650
|
-
/* @__PURE__ */
|
|
6651
|
-
/* @__PURE__ */
|
|
6652
|
-
/* @__PURE__ */
|
|
6667
|
+
/* @__PURE__ */ jsx308("defs", { children: /* @__PURE__ */ jsxs197("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
6668
|
+
/* @__PURE__ */ jsx308("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.4" }),
|
|
6669
|
+
/* @__PURE__ */ jsx308("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0.02" })
|
|
6653
6670
|
] }) }),
|
|
6654
6671
|
/* @__PURE__ */ jsxs197("g", { clipPath: animate ? `url(#${curveClipId})` : void 0, children: [
|
|
6655
|
-
/* @__PURE__ */
|
|
6656
|
-
/* @__PURE__ */
|
|
6672
|
+
/* @__PURE__ */ jsx308("path", { d: areaPath, fill: `url(#${gradientId})` }),
|
|
6673
|
+
/* @__PURE__ */ jsx308("path", { d: linePath, fill: "none", stroke: color, strokeWidth: "2" })
|
|
6657
6674
|
] }),
|
|
6658
|
-
activeIndex !== null && points[activeIndex] && /* @__PURE__ */
|
|
6675
|
+
activeIndex !== null && points[activeIndex] && /* @__PURE__ */ jsx308(
|
|
6659
6676
|
"circle",
|
|
6660
6677
|
{
|
|
6661
6678
|
cx: points[activeIndex].x,
|
|
@@ -6667,7 +6684,7 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6667
6684
|
)
|
|
6668
6685
|
] }, di);
|
|
6669
6686
|
}),
|
|
6670
|
-
activeX !== null && /* @__PURE__ */
|
|
6687
|
+
activeX !== null && /* @__PURE__ */ jsx308(
|
|
6671
6688
|
"line",
|
|
6672
6689
|
{
|
|
6673
6690
|
x1: activeX,
|
|
@@ -6677,7 +6694,7 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6677
6694
|
className: "chart-crosshair"
|
|
6678
6695
|
}
|
|
6679
6696
|
),
|
|
6680
|
-
/* @__PURE__ */
|
|
6697
|
+
/* @__PURE__ */ jsx308(
|
|
6681
6698
|
"rect",
|
|
6682
6699
|
{
|
|
6683
6700
|
x: PADDING.left,
|
|
@@ -6693,9 +6710,9 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6693
6710
|
);
|
|
6694
6711
|
});
|
|
6695
6712
|
CurveChart.displayName = "CurveChart";
|
|
6696
|
-
var BarChart =
|
|
6697
|
-
const entries =
|
|
6698
|
-
const maxVal =
|
|
6713
|
+
var BarChart = React7.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
6714
|
+
const entries = React7.useMemo(() => Object.entries(data), [data]);
|
|
6715
|
+
const maxVal = React7.useMemo(() => {
|
|
6699
6716
|
const allValues = entries.flatMap(([, v]) => v);
|
|
6700
6717
|
return Math.max(...allValues) * 1.2 || 1;
|
|
6701
6718
|
}, [entries]);
|
|
@@ -6707,7 +6724,7 @@ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
6707
6724
|
const barGap = groupCount > 1 ? 2 : 0;
|
|
6708
6725
|
const barW = Math.max(1, Math.min(32, (groupW * 0.7 - barGap * (groupCount - 1)) / groupCount));
|
|
6709
6726
|
const baseline = PADDING.top + chartH;
|
|
6710
|
-
const bars =
|
|
6727
|
+
const bars = React7.useMemo(
|
|
6711
6728
|
() => entries.map(
|
|
6712
6729
|
([, values], di) => values.map((v, i) => {
|
|
6713
6730
|
const totalBarsW = barW * groupCount + barGap * (groupCount - 1);
|
|
@@ -6721,10 +6738,10 @@ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
6721
6738
|
);
|
|
6722
6739
|
const barLabelStep = getLabelStep(count, chartW);
|
|
6723
6740
|
return /* @__PURE__ */ jsxs197("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
6724
|
-
/* @__PURE__ */
|
|
6741
|
+
/* @__PURE__ */ jsx308(GridLines, { width, height, chartH, maxVal }),
|
|
6725
6742
|
labels.map((label, i) => {
|
|
6726
6743
|
if (i % barLabelStep !== 0) return null;
|
|
6727
|
-
return /* @__PURE__ */
|
|
6744
|
+
return /* @__PURE__ */ jsx308("text", { x: PADDING.left + groupW * i + groupW / 2, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
6728
6745
|
}),
|
|
6729
6746
|
entries.map(([key], di) => {
|
|
6730
6747
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
@@ -6733,7 +6750,7 @@ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
6733
6750
|
const r2 = Math.min(4, b.w / 2);
|
|
6734
6751
|
const d = b.h <= r2 ? `M ${b.x} ${b.y + b.h} V ${b.y} H ${b.x + b.w} V ${b.y + b.h} Z` : `M ${b.x} ${b.y + b.h} V ${b.y + r2} Q ${b.x} ${b.y} ${b.x + r2} ${b.y} H ${b.x + b.w - r2} Q ${b.x + b.w} ${b.y} ${b.x + b.w} ${b.y + r2} V ${b.y + b.h} Z`;
|
|
6735
6752
|
const delay = 100 + i * 80;
|
|
6736
|
-
return /* @__PURE__ */
|
|
6753
|
+
return /* @__PURE__ */ jsx308(
|
|
6737
6754
|
"path",
|
|
6738
6755
|
{
|
|
6739
6756
|
d,
|
|
@@ -6754,11 +6771,11 @@ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
6754
6771
|
] });
|
|
6755
6772
|
});
|
|
6756
6773
|
BarChart.displayName = "BarChart";
|
|
6757
|
-
var PieDonutChart =
|
|
6774
|
+
var PieDonutChart = React7.memo(
|
|
6758
6775
|
({ data, labels, width, height, animate, isDoughnut, onHover, onMove, onLeave }) => {
|
|
6759
|
-
const entries =
|
|
6760
|
-
const values =
|
|
6761
|
-
const total =
|
|
6776
|
+
const entries = React7.useMemo(() => Object.entries(data), [data]);
|
|
6777
|
+
const values = React7.useMemo(() => entries.flatMap(([, v]) => v), [entries]);
|
|
6778
|
+
const total = React7.useMemo(() => values.reduce((a, b) => a + b, 0) || 1, [values]);
|
|
6762
6779
|
const size = Math.min(width, height);
|
|
6763
6780
|
const cx = size / 2;
|
|
6764
6781
|
const cy = size / 2;
|
|
@@ -6766,10 +6783,10 @@ var PieDonutChart = React6.memo(
|
|
|
6766
6783
|
const innerR = isDoughnut ? r2 * 0.5 : 0;
|
|
6767
6784
|
const firstKey = entries[0]?.[0] ?? "";
|
|
6768
6785
|
const colorOffset = hashString(firstKey);
|
|
6769
|
-
const maskRef =
|
|
6786
|
+
const maskRef = React7.useRef(null);
|
|
6770
6787
|
const maskR = r2 + 10;
|
|
6771
6788
|
const maskCircumference = 2 * Math.PI * maskR;
|
|
6772
|
-
|
|
6789
|
+
React7.useEffect(() => {
|
|
6773
6790
|
if (!animate || !maskRef.current) return;
|
|
6774
6791
|
const el = maskRef.current;
|
|
6775
6792
|
el.style.strokeDasharray = `${maskCircumference}`;
|
|
@@ -6779,7 +6796,7 @@ var PieDonutChart = React6.memo(
|
|
|
6779
6796
|
el.style.strokeDashoffset = "0";
|
|
6780
6797
|
});
|
|
6781
6798
|
}, [animate, maskCircumference]);
|
|
6782
|
-
const sliceData =
|
|
6799
|
+
const sliceData = React7.useMemo(() => {
|
|
6783
6800
|
let angle0 = -Math.PI / 2;
|
|
6784
6801
|
let cumulativeAngle = 0;
|
|
6785
6802
|
return values.map((v, i) => {
|
|
@@ -6814,7 +6831,7 @@ var PieDonutChart = React6.memo(
|
|
|
6814
6831
|
}, [values, total, cx, cy, r2, innerR, labels]);
|
|
6815
6832
|
const maskId = `pie-mask-${isDoughnut ? "d" : "p"}`;
|
|
6816
6833
|
return /* @__PURE__ */ jsxs197("svg", { viewBox: `0 0 ${size} ${size}`, className: "chart-svg chart-pie", children: [
|
|
6817
|
-
animate && /* @__PURE__ */
|
|
6834
|
+
animate && /* @__PURE__ */ jsx308("defs", { children: /* @__PURE__ */ jsx308("mask", { id: maskId, children: /* @__PURE__ */ jsx308(
|
|
6818
6835
|
"circle",
|
|
6819
6836
|
{
|
|
6820
6837
|
ref: maskRef,
|
|
@@ -6827,7 +6844,7 @@ var PieDonutChart = React6.memo(
|
|
|
6827
6844
|
transform: `rotate(-90 ${cx} ${cy})`
|
|
6828
6845
|
}
|
|
6829
6846
|
) }) }),
|
|
6830
|
-
/* @__PURE__ */
|
|
6847
|
+
/* @__PURE__ */ jsx308("g", { mask: animate ? `url(#${maskId})` : void 0, children: sliceData.map((s, i) => /* @__PURE__ */ jsx308("g", { children: /* @__PURE__ */ jsx308(
|
|
6831
6848
|
"path",
|
|
6832
6849
|
{
|
|
6833
6850
|
d: s.d,
|
|
@@ -6838,7 +6855,7 @@ var PieDonutChart = React6.memo(
|
|
|
6838
6855
|
onMouseLeave: onLeave
|
|
6839
6856
|
}
|
|
6840
6857
|
) }, i)) }),
|
|
6841
|
-
sliceData.map((s, i) => s.angle > 0.2 && /* @__PURE__ */
|
|
6858
|
+
sliceData.map((s, i) => s.angle > 0.2 && /* @__PURE__ */ jsx308(
|
|
6842
6859
|
"text",
|
|
6843
6860
|
{
|
|
6844
6861
|
x: s.lx,
|
|
@@ -6856,9 +6873,9 @@ var PieDonutChart = React6.memo(
|
|
|
6856
6873
|
);
|
|
6857
6874
|
PieDonutChart.displayName = "PieDonutChart";
|
|
6858
6875
|
var ChartTooltipPortal = ({ clientX, clientY, visible, children }) => {
|
|
6859
|
-
const ref =
|
|
6860
|
-
const [pos, setPos] =
|
|
6861
|
-
|
|
6876
|
+
const ref = React7.useRef(null);
|
|
6877
|
+
const [pos, setPos] = React7.useState({ left: 0, top: 0 });
|
|
6878
|
+
React7.useLayoutEffect(() => {
|
|
6862
6879
|
const el = ref.current;
|
|
6863
6880
|
if (!el) return;
|
|
6864
6881
|
const w = el.offsetWidth;
|
|
@@ -6871,7 +6888,7 @@ var ChartTooltipPortal = ({ clientX, clientY, visible, children }) => {
|
|
|
6871
6888
|
if (left < 8) left = 8;
|
|
6872
6889
|
setPos({ left, top });
|
|
6873
6890
|
}, [clientX, clientY]);
|
|
6874
|
-
return /* @__PURE__ */
|
|
6891
|
+
return /* @__PURE__ */ jsx308(
|
|
6875
6892
|
"div",
|
|
6876
6893
|
{
|
|
6877
6894
|
ref,
|
|
@@ -6888,13 +6905,13 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
6888
6905
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
6889
6906
|
const firstKey = entries[0]?.[0] ?? "";
|
|
6890
6907
|
const colorOffset = hashString(firstKey);
|
|
6891
|
-
return /* @__PURE__ */
|
|
6908
|
+
return /* @__PURE__ */ jsx308("div", { className: "chart-legend", children: values.map((v, i) => {
|
|
6892
6909
|
const pct = Math.round(v / total * 100);
|
|
6893
6910
|
const color = PIE_COLORS[(i + colorOffset) % PIE_COLORS.length];
|
|
6894
6911
|
return /* @__PURE__ */ jsxs197("div", { className: "chart-legend-item", children: [
|
|
6895
|
-
/* @__PURE__ */
|
|
6912
|
+
/* @__PURE__ */ jsx308("span", { className: "chart-legend-dot", style: { backgroundColor: color } }),
|
|
6896
6913
|
/* @__PURE__ */ jsxs197("div", { className: "chart-legend-text", children: [
|
|
6897
|
-
/* @__PURE__ */
|
|
6914
|
+
/* @__PURE__ */ jsx308("span", { className: "chart-legend-label", children: labels[i] || `${i + 1}` }),
|
|
6898
6915
|
/* @__PURE__ */ jsxs197("span", { className: "chart-legend-value", children: [
|
|
6899
6916
|
v.toLocaleString(),
|
|
6900
6917
|
"(",
|
|
@@ -6905,37 +6922,37 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
6905
6922
|
] }, i);
|
|
6906
6923
|
}) });
|
|
6907
6924
|
}
|
|
6908
|
-
return /* @__PURE__ */
|
|
6925
|
+
return /* @__PURE__ */ jsx308("div", { className: "chart-legend", children: entries.map(([key], di) => {
|
|
6909
6926
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
6910
6927
|
const color = palette[2];
|
|
6911
6928
|
const values = entries[di][1];
|
|
6912
6929
|
const sum = values.reduce((a, b) => a + b, 0);
|
|
6913
6930
|
return /* @__PURE__ */ jsxs197("div", { className: "chart-legend-item", children: [
|
|
6914
|
-
/* @__PURE__ */
|
|
6931
|
+
/* @__PURE__ */ jsx308("span", { className: "chart-legend-dot", style: { backgroundColor: color } }),
|
|
6915
6932
|
/* @__PURE__ */ jsxs197("div", { className: "chart-legend-text", children: [
|
|
6916
|
-
/* @__PURE__ */
|
|
6917
|
-
/* @__PURE__ */
|
|
6933
|
+
/* @__PURE__ */ jsx308("span", { className: "chart-legend-label", children: key }),
|
|
6934
|
+
/* @__PURE__ */ jsx308("span", { className: "chart-legend-value", children: sum.toLocaleString() })
|
|
6918
6935
|
] })
|
|
6919
6936
|
] }, di);
|
|
6920
6937
|
}) });
|
|
6921
6938
|
};
|
|
6922
|
-
var Chart =
|
|
6939
|
+
var Chart = React7.memo((props) => {
|
|
6923
6940
|
const { type, data, labels, tooltip: showTooltip = true } = props;
|
|
6924
6941
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
6925
6942
|
const { width, height } = useChartSize(containerRef);
|
|
6926
|
-
const stableData =
|
|
6927
|
-
const stableLabels =
|
|
6928
|
-
const dataKey =
|
|
6943
|
+
const stableData = React7.useMemo(() => data, [JSON.stringify(data)]);
|
|
6944
|
+
const stableLabels = React7.useMemo(() => labels, [JSON.stringify(labels)]);
|
|
6945
|
+
const dataKey = React7.useMemo(() => JSON.stringify(labels), [labels]);
|
|
6929
6946
|
const animate = useChartAnimation(containerRef, dataKey);
|
|
6930
6947
|
const ready = width > 0 && height > 0;
|
|
6931
6948
|
return /* @__PURE__ */ jsxs197("div", { className: "lib-xplat-chart", ref: containerRef, children: [
|
|
6932
|
-
ready && type === "line" && /* @__PURE__ */
|
|
6933
|
-
ready && type === "curve" && /* @__PURE__ */
|
|
6934
|
-
ready && type === "bar" && /* @__PURE__ */
|
|
6935
|
-
ready && type === "pie" && /* @__PURE__ */
|
|
6936
|
-
ready && type === "doughnut" && /* @__PURE__ */
|
|
6937
|
-
ready && (type === "bar" || type === "pie" || type === "doughnut") && /* @__PURE__ */
|
|
6938
|
-
tooltip.content && /* @__PURE__ */
|
|
6949
|
+
ready && type === "line" && /* @__PURE__ */ jsx308(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
6950
|
+
ready && type === "curve" && /* @__PURE__ */ jsx308(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
6951
|
+
ready && type === "bar" && /* @__PURE__ */ jsx308(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
6952
|
+
ready && type === "pie" && /* @__PURE__ */ jsx308(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
6953
|
+
ready && type === "doughnut" && /* @__PURE__ */ jsx308(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
6954
|
+
ready && (type === "bar" || type === "pie" || type === "doughnut") && /* @__PURE__ */ jsx308(ChartLegend, { data: stableData, labels: stableLabels, type }),
|
|
6955
|
+
tooltip.content && /* @__PURE__ */ jsx308(Portal_default, { children: /* @__PURE__ */ jsx308(ChartTooltipPortal, { clientX: tooltip.clientX, clientY: tooltip.clientY, visible: tooltip.visible, children: tooltip.content }) })
|
|
6939
6956
|
] });
|
|
6940
6957
|
});
|
|
6941
6958
|
Chart.displayName = "Chart";
|
|
@@ -6961,7 +6978,7 @@ import { primitive, semantic } from "@x-plat/tokens-core";
|
|
|
6961
6978
|
import { cssVar } from "@x-plat/tokens-core";
|
|
6962
6979
|
|
|
6963
6980
|
// src/components/CheckBox/CheckBox.tsx
|
|
6964
|
-
import { jsx as
|
|
6981
|
+
import { jsx as jsx309, jsxs as jsxs198 } from "react/jsx-runtime";
|
|
6965
6982
|
var CheckBox = (props) => {
|
|
6966
6983
|
const {
|
|
6967
6984
|
checked,
|
|
@@ -6980,7 +6997,7 @@ var CheckBox = (props) => {
|
|
|
6980
6997
|
const disabledClasses = "disabled";
|
|
6981
6998
|
const boxClasses = disabled ? disabledClasses : checked ? checkedClasses : uncheckedClasses;
|
|
6982
6999
|
return /* @__PURE__ */ jsxs198("label", { className: clsx_default("lib-xplat-checkbox", size, type), children: [
|
|
6983
|
-
/* @__PURE__ */
|
|
7000
|
+
/* @__PURE__ */ jsx309(
|
|
6984
7001
|
"input",
|
|
6985
7002
|
{
|
|
6986
7003
|
type: "checkbox",
|
|
@@ -6990,22 +7007,22 @@ var CheckBox = (props) => {
|
|
|
6990
7007
|
...rest
|
|
6991
7008
|
}
|
|
6992
7009
|
),
|
|
6993
|
-
/* @__PURE__ */
|
|
6994
|
-
label && /* @__PURE__ */
|
|
7010
|
+
/* @__PURE__ */ jsx309("span", { className: clsx_default("checkbox", boxClasses), children: /* @__PURE__ */ jsx309("span", { className: clsx_default("check-icon", { visible: checked }), children: /* @__PURE__ */ jsx309(CheckIcon_default, {}) }) }),
|
|
7011
|
+
label && /* @__PURE__ */ jsx309("span", { className: "label", children: label })
|
|
6995
7012
|
] });
|
|
6996
7013
|
};
|
|
6997
7014
|
CheckBox.displayName = "CheckBox";
|
|
6998
7015
|
var CheckBox_default = CheckBox;
|
|
6999
7016
|
|
|
7000
7017
|
// src/components/Chip/Chip.tsx
|
|
7001
|
-
import { jsx as
|
|
7018
|
+
import { jsx as jsx310 } from "react/jsx-runtime";
|
|
7002
7019
|
var Chip = (props) => {
|
|
7003
7020
|
const {
|
|
7004
7021
|
children,
|
|
7005
7022
|
type = "primary",
|
|
7006
7023
|
size = "md"
|
|
7007
7024
|
} = props;
|
|
7008
|
-
return /* @__PURE__ */
|
|
7025
|
+
return /* @__PURE__ */ jsx310("div", { className: clsx_default("lib-xplat-chip", type, size), children });
|
|
7009
7026
|
};
|
|
7010
7027
|
Chip.displayName = "Chip";
|
|
7011
7028
|
var Chip_default = Chip;
|
|
@@ -7014,20 +7031,20 @@ var Chip_default = Chip;
|
|
|
7014
7031
|
import React12 from "react";
|
|
7015
7032
|
|
|
7016
7033
|
// src/components/Input/Input.tsx
|
|
7017
|
-
import
|
|
7034
|
+
import React8 from "react";
|
|
7018
7035
|
|
|
7019
7036
|
// src/components/Input/InputValidations.tsx
|
|
7020
|
-
import { jsx as
|
|
7037
|
+
import { jsx as jsx311, jsxs as jsxs199 } from "react/jsx-runtime";
|
|
7021
7038
|
var InputValidations = (props) => {
|
|
7022
7039
|
const { message, status = "default" } = props;
|
|
7023
7040
|
return /* @__PURE__ */ jsxs199("div", { className: clsx_default("lib-xplat-input-validation", status), children: [
|
|
7024
7041
|
/* @__PURE__ */ jsxs199("div", { className: "icon", children: [
|
|
7025
|
-
status === "default" && /* @__PURE__ */
|
|
7026
|
-
status === "success" && /* @__PURE__ */
|
|
7027
|
-
status === "warning" && /* @__PURE__ */
|
|
7028
|
-
status === "error" && /* @__PURE__ */
|
|
7042
|
+
status === "default" && /* @__PURE__ */ jsx311(InfoIcon_default, {}),
|
|
7043
|
+
status === "success" && /* @__PURE__ */ jsx311(SuccessIcon_default, {}),
|
|
7044
|
+
status === "warning" && /* @__PURE__ */ jsx311(InfoIcon_default, {}),
|
|
7045
|
+
status === "error" && /* @__PURE__ */ jsx311(ErrorIcon_default, {})
|
|
7029
7046
|
] }),
|
|
7030
|
-
/* @__PURE__ */
|
|
7047
|
+
/* @__PURE__ */ jsx311("div", { className: "message", children: message })
|
|
7031
7048
|
] });
|
|
7032
7049
|
};
|
|
7033
7050
|
InputValidations.displayName = "InputValidations";
|
|
@@ -7068,7 +7085,7 @@ var handleTelBackspace = (prevValue, currValue) => {
|
|
|
7068
7085
|
};
|
|
7069
7086
|
|
|
7070
7087
|
// src/components/Input/Input.tsx
|
|
7071
|
-
import { jsx as
|
|
7088
|
+
import { jsx as jsx312, jsxs as jsxs200 } from "react/jsx-runtime";
|
|
7072
7089
|
import { createElement } from "react";
|
|
7073
7090
|
var formatValue = (type, value) => {
|
|
7074
7091
|
if (value === null || value === void 0) return "";
|
|
@@ -7117,7 +7134,7 @@ var parseValue = (type, value) => {
|
|
|
7117
7134
|
return value;
|
|
7118
7135
|
}
|
|
7119
7136
|
};
|
|
7120
|
-
var Input =
|
|
7137
|
+
var Input = React8.forwardRef((props, ref) => {
|
|
7121
7138
|
const {
|
|
7122
7139
|
value,
|
|
7123
7140
|
onChange,
|
|
@@ -7149,7 +7166,7 @@ var Input = React7.forwardRef((props, ref) => {
|
|
|
7149
7166
|
{
|
|
7150
7167
|
className: clsx_default("lib-xplat-input", size, disabled ? "disabled" : void 0),
|
|
7151
7168
|
children: [
|
|
7152
|
-
/* @__PURE__ */
|
|
7169
|
+
/* @__PURE__ */ jsx312(
|
|
7153
7170
|
"input",
|
|
7154
7171
|
{
|
|
7155
7172
|
...inputProps,
|
|
@@ -7160,11 +7177,11 @@ var Input = React7.forwardRef((props, ref) => {
|
|
|
7160
7177
|
onChange: handleChange
|
|
7161
7178
|
}
|
|
7162
7179
|
),
|
|
7163
|
-
suffix && /* @__PURE__ */
|
|
7180
|
+
suffix && /* @__PURE__ */ jsx312("div", { className: "suffix", children: suffix })
|
|
7164
7181
|
]
|
|
7165
7182
|
}
|
|
7166
7183
|
),
|
|
7167
|
-
validations && /* @__PURE__ */
|
|
7184
|
+
validations && /* @__PURE__ */ jsx312("div", { className: "lib-xplat-input-validation-wrap", children: validations?.map((validation, idx) => /* @__PURE__ */ createElement(
|
|
7168
7185
|
InputValidations_default,
|
|
7169
7186
|
{
|
|
7170
7187
|
...validation,
|
|
@@ -7177,20 +7194,20 @@ Input.displayName = "Input";
|
|
|
7177
7194
|
var Input_default = Input;
|
|
7178
7195
|
|
|
7179
7196
|
// src/components/Input/PasswordInput/PasswordInput.tsx
|
|
7180
|
-
import
|
|
7181
|
-
import { jsx as
|
|
7182
|
-
var PasswordInput =
|
|
7197
|
+
import React9 from "react";
|
|
7198
|
+
import { jsx as jsx313 } from "react/jsx-runtime";
|
|
7199
|
+
var PasswordInput = React9.forwardRef(
|
|
7183
7200
|
(props, ref) => {
|
|
7184
7201
|
const { reg: _reg, ...inputProps } = props;
|
|
7185
|
-
const [isView, setIsView] =
|
|
7202
|
+
const [isView, setIsView] = React9.useState(false);
|
|
7186
7203
|
const handleChangeView = () => {
|
|
7187
7204
|
setIsView((prev) => !prev);
|
|
7188
7205
|
};
|
|
7189
|
-
return /* @__PURE__ */
|
|
7206
|
+
return /* @__PURE__ */ jsx313(
|
|
7190
7207
|
Input_default,
|
|
7191
7208
|
{
|
|
7192
7209
|
...inputProps,
|
|
7193
|
-
suffix: /* @__PURE__ */
|
|
7210
|
+
suffix: /* @__PURE__ */ jsx313("div", { className: "wrapper pointer", onClick: handleChangeView, children: isView ? /* @__PURE__ */ jsx313(OpenEyeIcon_default, {}) : /* @__PURE__ */ jsx313(CloseEyeIcon_default, {}) }),
|
|
7194
7211
|
type: isView ? "text" : "password",
|
|
7195
7212
|
ref
|
|
7196
7213
|
}
|
|
@@ -7203,23 +7220,6 @@ var PasswordInput_default = PasswordInput;
|
|
|
7203
7220
|
// src/components/Modal/Modal.tsx
|
|
7204
7221
|
import React10 from "react";
|
|
7205
7222
|
import { createPortal } from "react-dom";
|
|
7206
|
-
|
|
7207
|
-
// src/tokens/hooks/Portal.tsx
|
|
7208
|
-
import React9 from "react";
|
|
7209
|
-
import ReactDOM from "react-dom";
|
|
7210
|
-
import { jsx as jsx313 } from "react/jsx-runtime";
|
|
7211
|
-
var PortalContainerContext = React9.createContext(null);
|
|
7212
|
-
var PortalProvider = ({ container, children }) => /* @__PURE__ */ jsx313(PortalContainerContext.Provider, { value: container, children });
|
|
7213
|
-
var Portal = ({ children }) => {
|
|
7214
|
-
const contextContainer = React9.useContext(PortalContainerContext);
|
|
7215
|
-
if (typeof document === "undefined") return null;
|
|
7216
|
-
const container = contextContainer ?? document.body;
|
|
7217
|
-
return ReactDOM.createPortal(children, container);
|
|
7218
|
-
};
|
|
7219
|
-
Portal.displayName = "Portal";
|
|
7220
|
-
var Portal_default = Portal;
|
|
7221
|
-
|
|
7222
|
-
// src/components/Modal/Modal.tsx
|
|
7223
7223
|
import { jsx as jsx314 } from "react/jsx-runtime";
|
|
7224
7224
|
var ANIMATION_DURATION_MS = 200;
|
|
7225
7225
|
var Modal = (props) => {
|