@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/components/index.js
CHANGED
|
@@ -2139,8 +2139,25 @@ var CardTab = Object.assign(CardTabRoot, {
|
|
|
2139
2139
|
var CardTab_default = CardTab;
|
|
2140
2140
|
|
|
2141
2141
|
// src/components/Chart/Chart.tsx
|
|
2142
|
+
import React7 from "react";
|
|
2143
|
+
|
|
2144
|
+
// src/tokens/hooks/Portal.tsx
|
|
2142
2145
|
import React6 from "react";
|
|
2143
|
-
import
|
|
2146
|
+
import ReactDOM from "react-dom";
|
|
2147
|
+
import { jsx as jsx307 } from "react/jsx-runtime";
|
|
2148
|
+
var PortalContainerContext = React6.createContext(null);
|
|
2149
|
+
var PortalProvider = ({ container, children }) => /* @__PURE__ */ jsx307(PortalContainerContext.Provider, { value: container, children });
|
|
2150
|
+
var Portal = ({ children }) => {
|
|
2151
|
+
const contextContainer = React6.useContext(PortalContainerContext);
|
|
2152
|
+
if (typeof document === "undefined") return null;
|
|
2153
|
+
const container = contextContainer ?? document.body;
|
|
2154
|
+
return ReactDOM.createPortal(children, container);
|
|
2155
|
+
};
|
|
2156
|
+
Portal.displayName = "Portal";
|
|
2157
|
+
var Portal_default = Portal;
|
|
2158
|
+
|
|
2159
|
+
// src/components/Chart/Chart.tsx
|
|
2160
|
+
import { Fragment as Fragment2, jsx as jsx308, jsxs as jsxs197 } from "react/jsx-runtime";
|
|
2144
2161
|
var CATEGORICAL_COUNT2 = 8;
|
|
2145
2162
|
var LINE_BAR_PALETTES = Array.from({ length: CATEGORICAL_COUNT2 }, (_, i) => {
|
|
2146
2163
|
const n = i + 1;
|
|
@@ -2186,11 +2203,11 @@ var toSmoothPath = (points) => {
|
|
|
2186
2203
|
};
|
|
2187
2204
|
var RESIZE_SETTLE_MS = 150;
|
|
2188
2205
|
var useChartSize = (ref) => {
|
|
2189
|
-
const [size, setSize] =
|
|
2190
|
-
const settleTimer =
|
|
2191
|
-
const committedSize =
|
|
2192
|
-
const initialRef =
|
|
2193
|
-
|
|
2206
|
+
const [size, setSize] = React7.useState({ width: 0, height: 0 });
|
|
2207
|
+
const settleTimer = React7.useRef(0);
|
|
2208
|
+
const committedSize = React7.useRef({ width: 0, height: 0 });
|
|
2209
|
+
const initialRef = React7.useRef(true);
|
|
2210
|
+
React7.useEffect(() => {
|
|
2194
2211
|
const el = ref.current;
|
|
2195
2212
|
if (!el) return;
|
|
2196
2213
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -2232,10 +2249,10 @@ var useChartSize = (ref) => {
|
|
|
2232
2249
|
};
|
|
2233
2250
|
var prefersReducedMotion = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2234
2251
|
var useChartAnimation = (containerRef, dataKey) => {
|
|
2235
|
-
const [animate, setAnimate] =
|
|
2236
|
-
const prevDataKey =
|
|
2237
|
-
const hasAnimated =
|
|
2238
|
-
|
|
2252
|
+
const [animate, setAnimate] = React7.useState(false);
|
|
2253
|
+
const prevDataKey = React7.useRef(dataKey);
|
|
2254
|
+
const hasAnimated = React7.useRef(false);
|
|
2255
|
+
React7.useEffect(() => {
|
|
2239
2256
|
if (prefersReducedMotion()) return;
|
|
2240
2257
|
const el = containerRef.current;
|
|
2241
2258
|
if (!el) return;
|
|
@@ -2251,7 +2268,7 @@ var useChartAnimation = (containerRef, dataKey) => {
|
|
|
2251
2268
|
observer.observe(el);
|
|
2252
2269
|
return () => observer.disconnect();
|
|
2253
2270
|
}, [containerRef]);
|
|
2254
|
-
|
|
2271
|
+
React7.useEffect(() => {
|
|
2255
2272
|
if (dataKey !== prevDataKey.current) {
|
|
2256
2273
|
prevDataKey.current = dataKey;
|
|
2257
2274
|
if (prefersReducedMotion()) return;
|
|
@@ -2265,15 +2282,15 @@ var useChartAnimation = (containerRef, dataKey) => {
|
|
|
2265
2282
|
};
|
|
2266
2283
|
var TOOLTIP_OFFSET = 12;
|
|
2267
2284
|
var useChartTooltip = (enabled) => {
|
|
2268
|
-
const [tooltip, setTooltip] =
|
|
2285
|
+
const [tooltip, setTooltip] = React7.useState({
|
|
2269
2286
|
visible: false,
|
|
2270
2287
|
clientX: 0,
|
|
2271
2288
|
clientY: 0,
|
|
2272
2289
|
content: ""
|
|
2273
2290
|
});
|
|
2274
|
-
const containerRef =
|
|
2275
|
-
const rafRef =
|
|
2276
|
-
const move =
|
|
2291
|
+
const containerRef = React7.useRef(null);
|
|
2292
|
+
const rafRef = React7.useRef(0);
|
|
2293
|
+
const move = React7.useCallback((e) => {
|
|
2277
2294
|
if (!enabled) return;
|
|
2278
2295
|
const cx = e.clientX;
|
|
2279
2296
|
const cy = e.clientY;
|
|
@@ -2282,22 +2299,22 @@ var useChartTooltip = (enabled) => {
|
|
|
2282
2299
|
setTooltip((prev) => ({ ...prev, clientX: cx, clientY: cy }));
|
|
2283
2300
|
});
|
|
2284
2301
|
}, [enabled]);
|
|
2285
|
-
const show =
|
|
2302
|
+
const show = React7.useCallback((e, content) => {
|
|
2286
2303
|
if (!enabled) return;
|
|
2287
2304
|
setTooltip({ visible: true, clientX: e.clientX, clientY: e.clientY, content });
|
|
2288
2305
|
}, [enabled]);
|
|
2289
|
-
const hide =
|
|
2306
|
+
const hide = React7.useCallback(() => {
|
|
2290
2307
|
cancelAnimationFrame(rafRef.current);
|
|
2291
2308
|
setTooltip((prev) => ({ ...prev, visible: false }));
|
|
2292
2309
|
}, []);
|
|
2293
2310
|
return { tooltip, show, hide, move, containerRef };
|
|
2294
2311
|
};
|
|
2295
|
-
var GridLines =
|
|
2312
|
+
var GridLines = React7.memo(({ width, height, chartH, maxVal }) => /* @__PURE__ */ jsx308(Fragment2, { children: [0, 0.25, 0.5, 0.75, 1].map((ratio) => {
|
|
2296
2313
|
const y = PADDING.top + (1 - ratio) * chartH;
|
|
2297
2314
|
const val = Math.round(maxVal * ratio);
|
|
2298
2315
|
return /* @__PURE__ */ jsxs197("g", { children: [
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2316
|
+
/* @__PURE__ */ jsx308("line", { x1: PADDING.left, y1: y, x2: width - PADDING.right, y2: y, className: "chart-grid" }),
|
|
2317
|
+
/* @__PURE__ */ jsx308("text", { x: PADDING.left - 8, y: y + 4, className: "chart-axis-label", textAnchor: "end", children: val })
|
|
2301
2318
|
] }, ratio);
|
|
2302
2319
|
}) }));
|
|
2303
2320
|
GridLines.displayName = "GridLines";
|
|
@@ -2307,18 +2324,18 @@ var getLabelStep = (count, chartW) => {
|
|
|
2307
2324
|
if (count <= maxLabels) return 1;
|
|
2308
2325
|
return Math.ceil(count / maxLabels);
|
|
2309
2326
|
};
|
|
2310
|
-
var AxisLabels =
|
|
2327
|
+
var AxisLabels = React7.memo(({ labels, count, chartW, height }) => {
|
|
2311
2328
|
const step = getLabelStep(count, chartW);
|
|
2312
|
-
return /* @__PURE__ */
|
|
2329
|
+
return /* @__PURE__ */ jsx308(Fragment2, { children: labels.map((label, i) => {
|
|
2313
2330
|
if (i % step !== 0) return null;
|
|
2314
2331
|
const x = PADDING.left + i / (count - 1 || 1) * chartW;
|
|
2315
|
-
return /* @__PURE__ */
|
|
2332
|
+
return /* @__PURE__ */ jsx308("text", { x, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
2316
2333
|
}) });
|
|
2317
2334
|
});
|
|
2318
2335
|
AxisLabels.displayName = "AxisLabels";
|
|
2319
2336
|
var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
2320
|
-
const [activeIndex, setActiveIndex] =
|
|
2321
|
-
const handleMouseMove =
|
|
2337
|
+
const [activeIndex, setActiveIndex] = React7.useState(null);
|
|
2338
|
+
const handleMouseMove = React7.useCallback((e) => {
|
|
2322
2339
|
const svg = e.currentTarget;
|
|
2323
2340
|
const rect = svg.getBoundingClientRect();
|
|
2324
2341
|
const mx = (e.clientX - rect.left) / rect.width * svg.viewBox.baseVal.width;
|
|
@@ -2337,17 +2354,17 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
|
2337
2354
|
}
|
|
2338
2355
|
setActiveIndex(minDist <= threshold ? closest : null);
|
|
2339
2356
|
}, [seriesPoints]);
|
|
2340
|
-
const handleMouseLeave =
|
|
2357
|
+
const handleMouseLeave = React7.useCallback(() => {
|
|
2341
2358
|
setActiveIndex(null);
|
|
2342
2359
|
}, []);
|
|
2343
|
-
const tooltipContent =
|
|
2360
|
+
const tooltipContent = React7.useMemo(() => {
|
|
2344
2361
|
if (activeIndex === null) return "";
|
|
2345
2362
|
return entries.map(([key], di) => {
|
|
2346
2363
|
const p = seriesPoints[di]?.[activeIndex];
|
|
2347
2364
|
return p ? `${key}: ${p.v}` : "";
|
|
2348
2365
|
}).filter(Boolean).join(" / ");
|
|
2349
2366
|
}, [activeIndex, entries, seriesPoints]);
|
|
2350
|
-
const getTooltipAt =
|
|
2367
|
+
const getTooltipAt = React7.useCallback((idx) => {
|
|
2351
2368
|
return entries.map(([key], di) => {
|
|
2352
2369
|
const p = seriesPoints[di]?.[idx];
|
|
2353
2370
|
return p ? `${key}: ${p.v}` : "";
|
|
@@ -2355,16 +2372,16 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
|
2355
2372
|
}, [entries, seriesPoints]);
|
|
2356
2373
|
return { activeIndex, handleMouseMove, handleMouseLeave, tooltipContent, getTooltipAt };
|
|
2357
2374
|
};
|
|
2358
|
-
var LineChart =
|
|
2359
|
-
const entries =
|
|
2360
|
-
const maxVal =
|
|
2375
|
+
var LineChart = React7.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
2376
|
+
const entries = React7.useMemo(() => Object.entries(data), [data]);
|
|
2377
|
+
const maxVal = React7.useMemo(() => {
|
|
2361
2378
|
const allValues = entries.flatMap(([, v]) => v);
|
|
2362
2379
|
return Math.max(...allValues) * 1.2 || 1;
|
|
2363
2380
|
}, [entries]);
|
|
2364
2381
|
const count = labels.length;
|
|
2365
2382
|
const chartW = width - PADDING.left - PADDING.right;
|
|
2366
2383
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
2367
|
-
const seriesPoints =
|
|
2384
|
+
const seriesPoints = React7.useMemo(
|
|
2368
2385
|
() => entries.map(
|
|
2369
2386
|
([, values]) => values.map((v, i) => ({
|
|
2370
2387
|
x: PADDING.left + i / (count - 1 || 1) * chartW,
|
|
@@ -2374,9 +2391,9 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
2374
2391
|
),
|
|
2375
2392
|
[entries, count, chartW, chartH, maxVal]
|
|
2376
2393
|
);
|
|
2377
|
-
const clipRef =
|
|
2394
|
+
const clipRef = React7.useRef(null);
|
|
2378
2395
|
const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
|
|
2379
|
-
|
|
2396
|
+
React7.useEffect(() => {
|
|
2380
2397
|
if (!animate || !clipRef.current) return;
|
|
2381
2398
|
clipRef.current.setAttribute("width", "0");
|
|
2382
2399
|
requestAnimationFrame(() => {
|
|
@@ -2421,9 +2438,9 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
2421
2438
|
onLeave();
|
|
2422
2439
|
},
|
|
2423
2440
|
children: [
|
|
2424
|
-
animate && /* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
2441
|
+
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 }) }) }),
|
|
2442
|
+
/* @__PURE__ */ jsx308(GridLines, { width, height, chartH, maxVal }),
|
|
2443
|
+
/* @__PURE__ */ jsx308(AxisLabels, { labels, count, chartW, height }),
|
|
2427
2444
|
entries.map(([key], di) => {
|
|
2428
2445
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
2429
2446
|
const color = palette[2];
|
|
@@ -2433,15 +2450,15 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
2433
2450
|
const polyPoints = points.map((p) => `${p.x},${p.y}`).join(" ");
|
|
2434
2451
|
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`;
|
|
2435
2452
|
return /* @__PURE__ */ jsxs197("g", { children: [
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2453
|
+
/* @__PURE__ */ jsx308("defs", { children: /* @__PURE__ */ jsxs197("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
2454
|
+
/* @__PURE__ */ jsx308("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.2" }),
|
|
2455
|
+
/* @__PURE__ */ jsx308("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0" })
|
|
2439
2456
|
] }) }),
|
|
2440
2457
|
/* @__PURE__ */ jsxs197("g", { clipPath: animate ? `url(#${lineClipId})` : void 0, children: [
|
|
2441
|
-
/* @__PURE__ */
|
|
2442
|
-
/* @__PURE__ */
|
|
2458
|
+
/* @__PURE__ */ jsx308("path", { d: areaD, fill: `url(#${gradientId})` }),
|
|
2459
|
+
/* @__PURE__ */ jsx308("polyline", { points: polyPoints, fill: "none", stroke: color, strokeWidth: "2" })
|
|
2443
2460
|
] }),
|
|
2444
|
-
activeIndex !== null && points[activeIndex] && /* @__PURE__ */
|
|
2461
|
+
activeIndex !== null && points[activeIndex] && /* @__PURE__ */ jsx308(
|
|
2445
2462
|
"circle",
|
|
2446
2463
|
{
|
|
2447
2464
|
cx: points[activeIndex].x,
|
|
@@ -2453,7 +2470,7 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
2453
2470
|
)
|
|
2454
2471
|
] }, di);
|
|
2455
2472
|
}),
|
|
2456
|
-
activeX !== null && /* @__PURE__ */
|
|
2473
|
+
activeX !== null && /* @__PURE__ */ jsx308(
|
|
2457
2474
|
"line",
|
|
2458
2475
|
{
|
|
2459
2476
|
x1: activeX,
|
|
@@ -2463,7 +2480,7 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
2463
2480
|
className: "chart-crosshair"
|
|
2464
2481
|
}
|
|
2465
2482
|
),
|
|
2466
|
-
/* @__PURE__ */
|
|
2483
|
+
/* @__PURE__ */ jsx308(
|
|
2467
2484
|
"rect",
|
|
2468
2485
|
{
|
|
2469
2486
|
x: PADDING.left,
|
|
@@ -2479,16 +2496,16 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
2479
2496
|
);
|
|
2480
2497
|
});
|
|
2481
2498
|
LineChart.displayName = "LineChart";
|
|
2482
|
-
var CurveChart =
|
|
2483
|
-
const entries =
|
|
2484
|
-
const maxVal =
|
|
2499
|
+
var CurveChart = React7.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
2500
|
+
const entries = React7.useMemo(() => Object.entries(data), [data]);
|
|
2501
|
+
const maxVal = React7.useMemo(() => {
|
|
2485
2502
|
const allValues = entries.flatMap(([, v]) => v);
|
|
2486
2503
|
return Math.max(...allValues) * 1.2 || 1;
|
|
2487
2504
|
}, [entries]);
|
|
2488
2505
|
const count = labels.length;
|
|
2489
2506
|
const chartW = width - PADDING.left - PADDING.right;
|
|
2490
2507
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
2491
|
-
const seriesPoints =
|
|
2508
|
+
const seriesPoints = React7.useMemo(
|
|
2492
2509
|
() => entries.map(
|
|
2493
2510
|
([, values]) => values.map((v, i) => ({
|
|
2494
2511
|
x: PADDING.left + i / (count - 1 || 1) * chartW,
|
|
@@ -2498,9 +2515,9 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
2498
2515
|
),
|
|
2499
2516
|
[entries, count, chartW, chartH, maxVal]
|
|
2500
2517
|
);
|
|
2501
|
-
const curveClipRef =
|
|
2518
|
+
const curveClipRef = React7.useRef(null);
|
|
2502
2519
|
const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
|
|
2503
|
-
|
|
2520
|
+
React7.useEffect(() => {
|
|
2504
2521
|
if (!animate || !curveClipRef.current) return;
|
|
2505
2522
|
curveClipRef.current.setAttribute("width", "0");
|
|
2506
2523
|
requestAnimationFrame(() => {
|
|
@@ -2545,9 +2562,9 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
2545
2562
|
onLeave();
|
|
2546
2563
|
},
|
|
2547
2564
|
children: [
|
|
2548
|
-
animate && /* @__PURE__ */
|
|
2549
|
-
/* @__PURE__ */
|
|
2550
|
-
/* @__PURE__ */
|
|
2565
|
+
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 }) }) }),
|
|
2566
|
+
/* @__PURE__ */ jsx308(GridLines, { width, height, chartH, maxVal }),
|
|
2567
|
+
/* @__PURE__ */ jsx308(AxisLabels, { labels, count, chartW, height }),
|
|
2551
2568
|
entries.map(([key], di) => {
|
|
2552
2569
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
2553
2570
|
const color = palette[2];
|
|
@@ -2557,15 +2574,15 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
2557
2574
|
const linePath = toSmoothPath(points);
|
|
2558
2575
|
const areaPath = linePath + ` L ${points[points.length - 1].x} ${PADDING.top + chartH} L ${points[0].x} ${PADDING.top + chartH} Z`;
|
|
2559
2576
|
return /* @__PURE__ */ jsxs197("g", { children: [
|
|
2560
|
-
/* @__PURE__ */
|
|
2561
|
-
/* @__PURE__ */
|
|
2562
|
-
/* @__PURE__ */
|
|
2577
|
+
/* @__PURE__ */ jsx308("defs", { children: /* @__PURE__ */ jsxs197("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
2578
|
+
/* @__PURE__ */ jsx308("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.4" }),
|
|
2579
|
+
/* @__PURE__ */ jsx308("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0.02" })
|
|
2563
2580
|
] }) }),
|
|
2564
2581
|
/* @__PURE__ */ jsxs197("g", { clipPath: animate ? `url(#${curveClipId})` : void 0, children: [
|
|
2565
|
-
/* @__PURE__ */
|
|
2566
|
-
/* @__PURE__ */
|
|
2582
|
+
/* @__PURE__ */ jsx308("path", { d: areaPath, fill: `url(#${gradientId})` }),
|
|
2583
|
+
/* @__PURE__ */ jsx308("path", { d: linePath, fill: "none", stroke: color, strokeWidth: "2" })
|
|
2567
2584
|
] }),
|
|
2568
|
-
activeIndex !== null && points[activeIndex] && /* @__PURE__ */
|
|
2585
|
+
activeIndex !== null && points[activeIndex] && /* @__PURE__ */ jsx308(
|
|
2569
2586
|
"circle",
|
|
2570
2587
|
{
|
|
2571
2588
|
cx: points[activeIndex].x,
|
|
@@ -2577,7 +2594,7 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
2577
2594
|
)
|
|
2578
2595
|
] }, di);
|
|
2579
2596
|
}),
|
|
2580
|
-
activeX !== null && /* @__PURE__ */
|
|
2597
|
+
activeX !== null && /* @__PURE__ */ jsx308(
|
|
2581
2598
|
"line",
|
|
2582
2599
|
{
|
|
2583
2600
|
x1: activeX,
|
|
@@ -2587,7 +2604,7 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
2587
2604
|
className: "chart-crosshair"
|
|
2588
2605
|
}
|
|
2589
2606
|
),
|
|
2590
|
-
/* @__PURE__ */
|
|
2607
|
+
/* @__PURE__ */ jsx308(
|
|
2591
2608
|
"rect",
|
|
2592
2609
|
{
|
|
2593
2610
|
x: PADDING.left,
|
|
@@ -2603,9 +2620,9 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
2603
2620
|
);
|
|
2604
2621
|
});
|
|
2605
2622
|
CurveChart.displayName = "CurveChart";
|
|
2606
|
-
var BarChart =
|
|
2607
|
-
const entries =
|
|
2608
|
-
const maxVal =
|
|
2623
|
+
var BarChart = React7.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
2624
|
+
const entries = React7.useMemo(() => Object.entries(data), [data]);
|
|
2625
|
+
const maxVal = React7.useMemo(() => {
|
|
2609
2626
|
const allValues = entries.flatMap(([, v]) => v);
|
|
2610
2627
|
return Math.max(...allValues) * 1.2 || 1;
|
|
2611
2628
|
}, [entries]);
|
|
@@ -2617,7 +2634,7 @@ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
2617
2634
|
const barGap = groupCount > 1 ? 2 : 0;
|
|
2618
2635
|
const barW = Math.max(1, Math.min(32, (groupW * 0.7 - barGap * (groupCount - 1)) / groupCount));
|
|
2619
2636
|
const baseline = PADDING.top + chartH;
|
|
2620
|
-
const bars =
|
|
2637
|
+
const bars = React7.useMemo(
|
|
2621
2638
|
() => entries.map(
|
|
2622
2639
|
([, values], di) => values.map((v, i) => {
|
|
2623
2640
|
const totalBarsW = barW * groupCount + barGap * (groupCount - 1);
|
|
@@ -2631,10 +2648,10 @@ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
2631
2648
|
);
|
|
2632
2649
|
const barLabelStep = getLabelStep(count, chartW);
|
|
2633
2650
|
return /* @__PURE__ */ jsxs197("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
2634
|
-
/* @__PURE__ */
|
|
2651
|
+
/* @__PURE__ */ jsx308(GridLines, { width, height, chartH, maxVal }),
|
|
2635
2652
|
labels.map((label, i) => {
|
|
2636
2653
|
if (i % barLabelStep !== 0) return null;
|
|
2637
|
-
return /* @__PURE__ */
|
|
2654
|
+
return /* @__PURE__ */ jsx308("text", { x: PADDING.left + groupW * i + groupW / 2, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
2638
2655
|
}),
|
|
2639
2656
|
entries.map(([key], di) => {
|
|
2640
2657
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
@@ -2643,7 +2660,7 @@ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
2643
2660
|
const r2 = Math.min(4, b.w / 2);
|
|
2644
2661
|
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`;
|
|
2645
2662
|
const delay = 100 + i * 80;
|
|
2646
|
-
return /* @__PURE__ */
|
|
2663
|
+
return /* @__PURE__ */ jsx308(
|
|
2647
2664
|
"path",
|
|
2648
2665
|
{
|
|
2649
2666
|
d,
|
|
@@ -2664,11 +2681,11 @@ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
2664
2681
|
] });
|
|
2665
2682
|
});
|
|
2666
2683
|
BarChart.displayName = "BarChart";
|
|
2667
|
-
var PieDonutChart =
|
|
2684
|
+
var PieDonutChart = React7.memo(
|
|
2668
2685
|
({ data, labels, width, height, animate, isDoughnut, onHover, onMove, onLeave }) => {
|
|
2669
|
-
const entries =
|
|
2670
|
-
const values =
|
|
2671
|
-
const total =
|
|
2686
|
+
const entries = React7.useMemo(() => Object.entries(data), [data]);
|
|
2687
|
+
const values = React7.useMemo(() => entries.flatMap(([, v]) => v), [entries]);
|
|
2688
|
+
const total = React7.useMemo(() => values.reduce((a, b) => a + b, 0) || 1, [values]);
|
|
2672
2689
|
const size = Math.min(width, height);
|
|
2673
2690
|
const cx = size / 2;
|
|
2674
2691
|
const cy = size / 2;
|
|
@@ -2676,10 +2693,10 @@ var PieDonutChart = React6.memo(
|
|
|
2676
2693
|
const innerR = isDoughnut ? r2 * 0.5 : 0;
|
|
2677
2694
|
const firstKey = entries[0]?.[0] ?? "";
|
|
2678
2695
|
const colorOffset = hashString(firstKey);
|
|
2679
|
-
const maskRef =
|
|
2696
|
+
const maskRef = React7.useRef(null);
|
|
2680
2697
|
const maskR = r2 + 10;
|
|
2681
2698
|
const maskCircumference = 2 * Math.PI * maskR;
|
|
2682
|
-
|
|
2699
|
+
React7.useEffect(() => {
|
|
2683
2700
|
if (!animate || !maskRef.current) return;
|
|
2684
2701
|
const el = maskRef.current;
|
|
2685
2702
|
el.style.strokeDasharray = `${maskCircumference}`;
|
|
@@ -2689,7 +2706,7 @@ var PieDonutChart = React6.memo(
|
|
|
2689
2706
|
el.style.strokeDashoffset = "0";
|
|
2690
2707
|
});
|
|
2691
2708
|
}, [animate, maskCircumference]);
|
|
2692
|
-
const sliceData =
|
|
2709
|
+
const sliceData = React7.useMemo(() => {
|
|
2693
2710
|
let angle0 = -Math.PI / 2;
|
|
2694
2711
|
let cumulativeAngle = 0;
|
|
2695
2712
|
return values.map((v, i) => {
|
|
@@ -2724,7 +2741,7 @@ var PieDonutChart = React6.memo(
|
|
|
2724
2741
|
}, [values, total, cx, cy, r2, innerR, labels]);
|
|
2725
2742
|
const maskId = `pie-mask-${isDoughnut ? "d" : "p"}`;
|
|
2726
2743
|
return /* @__PURE__ */ jsxs197("svg", { viewBox: `0 0 ${size} ${size}`, className: "chart-svg chart-pie", children: [
|
|
2727
|
-
animate && /* @__PURE__ */
|
|
2744
|
+
animate && /* @__PURE__ */ jsx308("defs", { children: /* @__PURE__ */ jsx308("mask", { id: maskId, children: /* @__PURE__ */ jsx308(
|
|
2728
2745
|
"circle",
|
|
2729
2746
|
{
|
|
2730
2747
|
ref: maskRef,
|
|
@@ -2737,7 +2754,7 @@ var PieDonutChart = React6.memo(
|
|
|
2737
2754
|
transform: `rotate(-90 ${cx} ${cy})`
|
|
2738
2755
|
}
|
|
2739
2756
|
) }) }),
|
|
2740
|
-
/* @__PURE__ */
|
|
2757
|
+
/* @__PURE__ */ jsx308("g", { mask: animate ? `url(#${maskId})` : void 0, children: sliceData.map((s, i) => /* @__PURE__ */ jsx308("g", { children: /* @__PURE__ */ jsx308(
|
|
2741
2758
|
"path",
|
|
2742
2759
|
{
|
|
2743
2760
|
d: s.d,
|
|
@@ -2748,7 +2765,7 @@ var PieDonutChart = React6.memo(
|
|
|
2748
2765
|
onMouseLeave: onLeave
|
|
2749
2766
|
}
|
|
2750
2767
|
) }, i)) }),
|
|
2751
|
-
sliceData.map((s, i) => s.angle > 0.2 && /* @__PURE__ */
|
|
2768
|
+
sliceData.map((s, i) => s.angle > 0.2 && /* @__PURE__ */ jsx308(
|
|
2752
2769
|
"text",
|
|
2753
2770
|
{
|
|
2754
2771
|
x: s.lx,
|
|
@@ -2766,9 +2783,9 @@ var PieDonutChart = React6.memo(
|
|
|
2766
2783
|
);
|
|
2767
2784
|
PieDonutChart.displayName = "PieDonutChart";
|
|
2768
2785
|
var ChartTooltipPortal = ({ clientX, clientY, visible, children }) => {
|
|
2769
|
-
const ref =
|
|
2770
|
-
const [pos, setPos] =
|
|
2771
|
-
|
|
2786
|
+
const ref = React7.useRef(null);
|
|
2787
|
+
const [pos, setPos] = React7.useState({ left: 0, top: 0 });
|
|
2788
|
+
React7.useLayoutEffect(() => {
|
|
2772
2789
|
const el = ref.current;
|
|
2773
2790
|
if (!el) return;
|
|
2774
2791
|
const w = el.offsetWidth;
|
|
@@ -2781,7 +2798,7 @@ var ChartTooltipPortal = ({ clientX, clientY, visible, children }) => {
|
|
|
2781
2798
|
if (left < 8) left = 8;
|
|
2782
2799
|
setPos({ left, top });
|
|
2783
2800
|
}, [clientX, clientY]);
|
|
2784
|
-
return /* @__PURE__ */
|
|
2801
|
+
return /* @__PURE__ */ jsx308(
|
|
2785
2802
|
"div",
|
|
2786
2803
|
{
|
|
2787
2804
|
ref,
|
|
@@ -2798,13 +2815,13 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
2798
2815
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
2799
2816
|
const firstKey = entries[0]?.[0] ?? "";
|
|
2800
2817
|
const colorOffset = hashString(firstKey);
|
|
2801
|
-
return /* @__PURE__ */
|
|
2818
|
+
return /* @__PURE__ */ jsx308("div", { className: "chart-legend", children: values.map((v, i) => {
|
|
2802
2819
|
const pct = Math.round(v / total * 100);
|
|
2803
2820
|
const color = PIE_COLORS[(i + colorOffset) % PIE_COLORS.length];
|
|
2804
2821
|
return /* @__PURE__ */ jsxs197("div", { className: "chart-legend-item", children: [
|
|
2805
|
-
/* @__PURE__ */
|
|
2822
|
+
/* @__PURE__ */ jsx308("span", { className: "chart-legend-dot", style: { backgroundColor: color } }),
|
|
2806
2823
|
/* @__PURE__ */ jsxs197("div", { className: "chart-legend-text", children: [
|
|
2807
|
-
/* @__PURE__ */
|
|
2824
|
+
/* @__PURE__ */ jsx308("span", { className: "chart-legend-label", children: labels[i] || `${i + 1}` }),
|
|
2808
2825
|
/* @__PURE__ */ jsxs197("span", { className: "chart-legend-value", children: [
|
|
2809
2826
|
v.toLocaleString(),
|
|
2810
2827
|
"(",
|
|
@@ -2815,37 +2832,37 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
2815
2832
|
] }, i);
|
|
2816
2833
|
}) });
|
|
2817
2834
|
}
|
|
2818
|
-
return /* @__PURE__ */
|
|
2835
|
+
return /* @__PURE__ */ jsx308("div", { className: "chart-legend", children: entries.map(([key], di) => {
|
|
2819
2836
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
2820
2837
|
const color = palette[2];
|
|
2821
2838
|
const values = entries[di][1];
|
|
2822
2839
|
const sum = values.reduce((a, b) => a + b, 0);
|
|
2823
2840
|
return /* @__PURE__ */ jsxs197("div", { className: "chart-legend-item", children: [
|
|
2824
|
-
/* @__PURE__ */
|
|
2841
|
+
/* @__PURE__ */ jsx308("span", { className: "chart-legend-dot", style: { backgroundColor: color } }),
|
|
2825
2842
|
/* @__PURE__ */ jsxs197("div", { className: "chart-legend-text", children: [
|
|
2826
|
-
/* @__PURE__ */
|
|
2827
|
-
/* @__PURE__ */
|
|
2843
|
+
/* @__PURE__ */ jsx308("span", { className: "chart-legend-label", children: key }),
|
|
2844
|
+
/* @__PURE__ */ jsx308("span", { className: "chart-legend-value", children: sum.toLocaleString() })
|
|
2828
2845
|
] })
|
|
2829
2846
|
] }, di);
|
|
2830
2847
|
}) });
|
|
2831
2848
|
};
|
|
2832
|
-
var Chart =
|
|
2849
|
+
var Chart = React7.memo((props) => {
|
|
2833
2850
|
const { type, data, labels, tooltip: showTooltip = true } = props;
|
|
2834
2851
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
2835
2852
|
const { width, height } = useChartSize(containerRef);
|
|
2836
|
-
const stableData =
|
|
2837
|
-
const stableLabels =
|
|
2838
|
-
const dataKey =
|
|
2853
|
+
const stableData = React7.useMemo(() => data, [JSON.stringify(data)]);
|
|
2854
|
+
const stableLabels = React7.useMemo(() => labels, [JSON.stringify(labels)]);
|
|
2855
|
+
const dataKey = React7.useMemo(() => JSON.stringify(labels), [labels]);
|
|
2839
2856
|
const animate = useChartAnimation(containerRef, dataKey);
|
|
2840
2857
|
const ready = width > 0 && height > 0;
|
|
2841
2858
|
return /* @__PURE__ */ jsxs197("div", { className: "lib-xplat-chart", ref: containerRef, children: [
|
|
2842
|
-
ready && type === "line" && /* @__PURE__ */
|
|
2843
|
-
ready && type === "curve" && /* @__PURE__ */
|
|
2844
|
-
ready && type === "bar" && /* @__PURE__ */
|
|
2845
|
-
ready && type === "pie" && /* @__PURE__ */
|
|
2846
|
-
ready && type === "doughnut" && /* @__PURE__ */
|
|
2847
|
-
ready && (type === "bar" || type === "pie" || type === "doughnut") && /* @__PURE__ */
|
|
2848
|
-
tooltip.content && /* @__PURE__ */
|
|
2859
|
+
ready && type === "line" && /* @__PURE__ */ jsx308(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2860
|
+
ready && type === "curve" && /* @__PURE__ */ jsx308(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2861
|
+
ready && type === "bar" && /* @__PURE__ */ jsx308(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2862
|
+
ready && type === "pie" && /* @__PURE__ */ jsx308(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2863
|
+
ready && type === "doughnut" && /* @__PURE__ */ jsx308(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
2864
|
+
ready && (type === "bar" || type === "pie" || type === "doughnut") && /* @__PURE__ */ jsx308(ChartLegend, { data: stableData, labels: stableLabels, type }),
|
|
2865
|
+
tooltip.content && /* @__PURE__ */ jsx308(Portal_default, { children: /* @__PURE__ */ jsx308(ChartTooltipPortal, { clientX: tooltip.clientX, clientY: tooltip.clientY, visible: tooltip.visible, children: tooltip.content }) })
|
|
2849
2866
|
] });
|
|
2850
2867
|
});
|
|
2851
2868
|
Chart.displayName = "Chart";
|
|
@@ -2858,7 +2875,7 @@ import { primitive, semantic } from "@x-plat/tokens-core";
|
|
|
2858
2875
|
import { cssVar } from "@x-plat/tokens-core";
|
|
2859
2876
|
|
|
2860
2877
|
// src/components/CheckBox/CheckBox.tsx
|
|
2861
|
-
import { jsx as
|
|
2878
|
+
import { jsx as jsx309, jsxs as jsxs198 } from "react/jsx-runtime";
|
|
2862
2879
|
var CheckBox = (props) => {
|
|
2863
2880
|
const {
|
|
2864
2881
|
checked,
|
|
@@ -2877,7 +2894,7 @@ var CheckBox = (props) => {
|
|
|
2877
2894
|
const disabledClasses = "disabled";
|
|
2878
2895
|
const boxClasses = disabled ? disabledClasses : checked ? checkedClasses : uncheckedClasses;
|
|
2879
2896
|
return /* @__PURE__ */ jsxs198("label", { className: clsx_default("lib-xplat-checkbox", size, type), children: [
|
|
2880
|
-
/* @__PURE__ */
|
|
2897
|
+
/* @__PURE__ */ jsx309(
|
|
2881
2898
|
"input",
|
|
2882
2899
|
{
|
|
2883
2900
|
type: "checkbox",
|
|
@@ -2887,22 +2904,22 @@ var CheckBox = (props) => {
|
|
|
2887
2904
|
...rest
|
|
2888
2905
|
}
|
|
2889
2906
|
),
|
|
2890
|
-
/* @__PURE__ */
|
|
2891
|
-
label && /* @__PURE__ */
|
|
2907
|
+
/* @__PURE__ */ jsx309("span", { className: clsx_default("checkbox", boxClasses), children: /* @__PURE__ */ jsx309("span", { className: clsx_default("check-icon", { visible: checked }), children: /* @__PURE__ */ jsx309(CheckIcon_default, {}) }) }),
|
|
2908
|
+
label && /* @__PURE__ */ jsx309("span", { className: "label", children: label })
|
|
2892
2909
|
] });
|
|
2893
2910
|
};
|
|
2894
2911
|
CheckBox.displayName = "CheckBox";
|
|
2895
2912
|
var CheckBox_default = CheckBox;
|
|
2896
2913
|
|
|
2897
2914
|
// src/components/Chip/Chip.tsx
|
|
2898
|
-
import { jsx as
|
|
2915
|
+
import { jsx as jsx310 } from "react/jsx-runtime";
|
|
2899
2916
|
var Chip = (props) => {
|
|
2900
2917
|
const {
|
|
2901
2918
|
children,
|
|
2902
2919
|
type = "primary",
|
|
2903
2920
|
size = "md"
|
|
2904
2921
|
} = props;
|
|
2905
|
-
return /* @__PURE__ */
|
|
2922
|
+
return /* @__PURE__ */ jsx310("div", { className: clsx_default("lib-xplat-chip", type, size), children });
|
|
2906
2923
|
};
|
|
2907
2924
|
Chip.displayName = "Chip";
|
|
2908
2925
|
var Chip_default = Chip;
|
|
@@ -2911,20 +2928,20 @@ var Chip_default = Chip;
|
|
|
2911
2928
|
import React12 from "react";
|
|
2912
2929
|
|
|
2913
2930
|
// src/components/Input/Input.tsx
|
|
2914
|
-
import
|
|
2931
|
+
import React8 from "react";
|
|
2915
2932
|
|
|
2916
2933
|
// src/components/Input/InputValidations.tsx
|
|
2917
|
-
import { jsx as
|
|
2934
|
+
import { jsx as jsx311, jsxs as jsxs199 } from "react/jsx-runtime";
|
|
2918
2935
|
var InputValidations = (props) => {
|
|
2919
2936
|
const { message, status = "default" } = props;
|
|
2920
2937
|
return /* @__PURE__ */ jsxs199("div", { className: clsx_default("lib-xplat-input-validation", status), children: [
|
|
2921
2938
|
/* @__PURE__ */ jsxs199("div", { className: "icon", children: [
|
|
2922
|
-
status === "default" && /* @__PURE__ */
|
|
2923
|
-
status === "success" && /* @__PURE__ */
|
|
2924
|
-
status === "warning" && /* @__PURE__ */
|
|
2925
|
-
status === "error" && /* @__PURE__ */
|
|
2939
|
+
status === "default" && /* @__PURE__ */ jsx311(InfoIcon_default, {}),
|
|
2940
|
+
status === "success" && /* @__PURE__ */ jsx311(SuccessIcon_default, {}),
|
|
2941
|
+
status === "warning" && /* @__PURE__ */ jsx311(InfoIcon_default, {}),
|
|
2942
|
+
status === "error" && /* @__PURE__ */ jsx311(ErrorIcon_default, {})
|
|
2926
2943
|
] }),
|
|
2927
|
-
/* @__PURE__ */
|
|
2944
|
+
/* @__PURE__ */ jsx311("div", { className: "message", children: message })
|
|
2928
2945
|
] });
|
|
2929
2946
|
};
|
|
2930
2947
|
InputValidations.displayName = "InputValidations";
|
|
@@ -2965,7 +2982,7 @@ var handleTelBackspace = (prevValue, currValue) => {
|
|
|
2965
2982
|
};
|
|
2966
2983
|
|
|
2967
2984
|
// src/components/Input/Input.tsx
|
|
2968
|
-
import { jsx as
|
|
2985
|
+
import { jsx as jsx312, jsxs as jsxs200 } from "react/jsx-runtime";
|
|
2969
2986
|
import { createElement } from "react";
|
|
2970
2987
|
var formatValue = (type, value) => {
|
|
2971
2988
|
if (value === null || value === void 0) return "";
|
|
@@ -3014,7 +3031,7 @@ var parseValue = (type, value) => {
|
|
|
3014
3031
|
return value;
|
|
3015
3032
|
}
|
|
3016
3033
|
};
|
|
3017
|
-
var Input =
|
|
3034
|
+
var Input = React8.forwardRef((props, ref) => {
|
|
3018
3035
|
const {
|
|
3019
3036
|
value,
|
|
3020
3037
|
onChange,
|
|
@@ -3046,7 +3063,7 @@ var Input = React7.forwardRef((props, ref) => {
|
|
|
3046
3063
|
{
|
|
3047
3064
|
className: clsx_default("lib-xplat-input", size, disabled ? "disabled" : void 0),
|
|
3048
3065
|
children: [
|
|
3049
|
-
/* @__PURE__ */
|
|
3066
|
+
/* @__PURE__ */ jsx312(
|
|
3050
3067
|
"input",
|
|
3051
3068
|
{
|
|
3052
3069
|
...inputProps,
|
|
@@ -3057,11 +3074,11 @@ var Input = React7.forwardRef((props, ref) => {
|
|
|
3057
3074
|
onChange: handleChange
|
|
3058
3075
|
}
|
|
3059
3076
|
),
|
|
3060
|
-
suffix && /* @__PURE__ */
|
|
3077
|
+
suffix && /* @__PURE__ */ jsx312("div", { className: "suffix", children: suffix })
|
|
3061
3078
|
]
|
|
3062
3079
|
}
|
|
3063
3080
|
),
|
|
3064
|
-
validations && /* @__PURE__ */
|
|
3081
|
+
validations && /* @__PURE__ */ jsx312("div", { className: "lib-xplat-input-validation-wrap", children: validations?.map((validation, idx) => /* @__PURE__ */ createElement(
|
|
3065
3082
|
InputValidations_default,
|
|
3066
3083
|
{
|
|
3067
3084
|
...validation,
|
|
@@ -3074,20 +3091,20 @@ Input.displayName = "Input";
|
|
|
3074
3091
|
var Input_default = Input;
|
|
3075
3092
|
|
|
3076
3093
|
// src/components/Input/PasswordInput/PasswordInput.tsx
|
|
3077
|
-
import
|
|
3078
|
-
import { jsx as
|
|
3079
|
-
var PasswordInput =
|
|
3094
|
+
import React9 from "react";
|
|
3095
|
+
import { jsx as jsx313 } from "react/jsx-runtime";
|
|
3096
|
+
var PasswordInput = React9.forwardRef(
|
|
3080
3097
|
(props, ref) => {
|
|
3081
3098
|
const { reg: _reg, ...inputProps } = props;
|
|
3082
|
-
const [isView, setIsView] =
|
|
3099
|
+
const [isView, setIsView] = React9.useState(false);
|
|
3083
3100
|
const handleChangeView = () => {
|
|
3084
3101
|
setIsView((prev) => !prev);
|
|
3085
3102
|
};
|
|
3086
|
-
return /* @__PURE__ */
|
|
3103
|
+
return /* @__PURE__ */ jsx313(
|
|
3087
3104
|
Input_default,
|
|
3088
3105
|
{
|
|
3089
3106
|
...inputProps,
|
|
3090
|
-
suffix: /* @__PURE__ */
|
|
3107
|
+
suffix: /* @__PURE__ */ jsx313("div", { className: "wrapper pointer", onClick: handleChangeView, children: isView ? /* @__PURE__ */ jsx313(OpenEyeIcon_default, {}) : /* @__PURE__ */ jsx313(CloseEyeIcon_default, {}) }),
|
|
3091
3108
|
type: isView ? "text" : "password",
|
|
3092
3109
|
ref
|
|
3093
3110
|
}
|
|
@@ -3100,23 +3117,6 @@ var PasswordInput_default = PasswordInput;
|
|
|
3100
3117
|
// src/components/Modal/Modal.tsx
|
|
3101
3118
|
import React10 from "react";
|
|
3102
3119
|
import { createPortal } from "react-dom";
|
|
3103
|
-
|
|
3104
|
-
// src/tokens/hooks/Portal.tsx
|
|
3105
|
-
import React9 from "react";
|
|
3106
|
-
import ReactDOM from "react-dom";
|
|
3107
|
-
import { jsx as jsx313 } from "react/jsx-runtime";
|
|
3108
|
-
var PortalContainerContext = React9.createContext(null);
|
|
3109
|
-
var PortalProvider = ({ container, children }) => /* @__PURE__ */ jsx313(PortalContainerContext.Provider, { value: container, children });
|
|
3110
|
-
var Portal = ({ children }) => {
|
|
3111
|
-
const contextContainer = React9.useContext(PortalContainerContext);
|
|
3112
|
-
if (typeof document === "undefined") return null;
|
|
3113
|
-
const container = contextContainer ?? document.body;
|
|
3114
|
-
return ReactDOM.createPortal(children, container);
|
|
3115
|
-
};
|
|
3116
|
-
Portal.displayName = "Portal";
|
|
3117
|
-
var Portal_default = Portal;
|
|
3118
|
-
|
|
3119
|
-
// src/components/Modal/Modal.tsx
|
|
3120
3120
|
import { jsx as jsx314 } from "react/jsx-runtime";
|
|
3121
3121
|
var ANIMATION_DURATION_MS = 200;
|
|
3122
3122
|
var Modal = (props) => {
|