@x-plat/design-system 0.5.35 → 0.5.37

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