@x-plat/design-system 0.5.37 → 0.5.38

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.
@@ -2034,17 +2034,37 @@
2034
2034
  position: absolute;
2035
2035
  z-index: 10;
2036
2036
  padding: var(--spacing-space-3);
2037
- background-color: var(--semantic-surface-neutral-strong);
2038
- color: var(--semantic-text-inverse);
2039
- font-size: 12px;
2040
- line-height: 18px;
2041
- font-weight: 500;
2042
2037
  border-radius: var(--spacing-radius-md);
2043
2038
  max-width: 240px;
2044
2039
  pointer-events: none;
2045
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
2046
2040
  animation: chart-tooltip-in 120ms ease-out;
2047
2041
  }
2042
+ .lib-xplat-chart .chart-tooltip .chart-tooltip-title {
2043
+ font-size: 13px;
2044
+ line-height: 18px;
2045
+ font-weight: 400;
2046
+ }
2047
+ .lib-xplat-chart .chart-tooltip .chart-tooltip-desc {
2048
+ font-size: 12px;
2049
+ line-height: 18px;
2050
+ font-weight: 400;
2051
+ }
2052
+ .lib-xplat-chart .chart-tooltip.chart-tooltip-dark {
2053
+ background-color: var(--semantic-surface-neutral-strong);
2054
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
2055
+ }
2056
+ .lib-xplat-chart .chart-tooltip.chart-tooltip-dark .chart-tooltip-title,
2057
+ .lib-xplat-chart .chart-tooltip.chart-tooltip-dark .chart-tooltip-desc {
2058
+ color: var(--semantic-text-inverse);
2059
+ }
2060
+ .lib-xplat-chart .chart-tooltip.chart-tooltip-light {
2061
+ background-color: var(--semantic-surface-neutral-default);
2062
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
2063
+ }
2064
+ .lib-xplat-chart .chart-tooltip.chart-tooltip-light .chart-tooltip-title,
2065
+ .lib-xplat-chart .chart-tooltip.chart-tooltip-light .chart-tooltip-desc {
2066
+ color: var(--semantic-text-subtle);
2067
+ }
2048
2068
  .lib-xplat-chart .chart-legend {
2049
2069
  display: flex;
2050
2070
  flex-wrap: wrap;
@@ -4435,50 +4455,50 @@
4435
4455
  }
4436
4456
 
4437
4457
  /* src/components/Tooltip/tooltip.scss */
4458
+ .lib-xplat-tooltip-trigger {
4459
+ display: inline-flex;
4460
+ }
4438
4461
  .lib-xplat-tooltip {
4439
- width: fit-content;
4440
- position: relative;
4462
+ z-index: 1100;
4463
+ padding: var(--spacing-space-3);
4464
+ border-radius: var(--spacing-radius-md);
4465
+ max-width: 240px;
4466
+ pointer-events: none;
4467
+ animation: tooltip-show 120ms ease-out;
4441
4468
  }
4442
- .lib-xplat-tooltip > .tooltip-content {
4443
- width: fit-content;
4444
- height: fit-content;
4469
+ .lib-xplat-tooltip .tooltip-title {
4470
+ font-size: 13px;
4471
+ line-height: 18px;
4472
+ font-weight: 400;
4445
4473
  }
4446
- .lib-xplat-tooltip > .tooltip-wrapper {
4447
- position: absolute;
4448
- transform: translateX(-50%) scale(0.5);
4449
- left: 50%;
4450
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
4451
- white-space: nowrap;
4452
- border-radius: var(--spacing-radius-sm);
4453
- padding: var(--spacing-space-2) var(--spacing-space-2);
4454
- opacity: 0;
4455
- pointer-events: none;
4456
- bottom: 100%;
4457
- transition: opacity 0.12s ease, transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
4474
+ .lib-xplat-tooltip .tooltip-desc {
4475
+ font-size: 12px;
4476
+ line-height: 18px;
4477
+ font-weight: 400;
4458
4478
  }
4459
- .lib-xplat-tooltip > .tooltip-wrapper.primary {
4460
- color: var(--semantic-text-inverse);
4479
+ .lib-xplat-tooltip.dark {
4461
4480
  background-color: var(--semantic-surface-neutral-strong);
4481
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
4462
4482
  }
4463
- .lib-xplat-tooltip > .tooltip-wrapper.secondary {
4464
- background-color: var(--semantic-surface-neutral-default);
4465
- color: var(--semantic-text-strong);
4483
+ .lib-xplat-tooltip.dark .tooltip-title,
4484
+ .lib-xplat-tooltip.dark .tooltip-desc {
4485
+ color: var(--semantic-text-inverse);
4466
4486
  }
4467
- .lib-xplat-tooltip.tooltip-bottom > .tooltip-wrapper {
4468
- top: 100%;
4469
- bottom: auto;
4470
- transform-origin: top center;
4487
+ .lib-xplat-tooltip.light {
4488
+ background-color: var(--semantic-surface-neutral-default);
4489
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
4471
4490
  }
4472
- .lib-xplat-tooltip.tooltip-top > .tooltip-wrapper {
4473
- bottom: 100%;
4474
- top: auto;
4475
- transform-origin: bottom center;
4491
+ .lib-xplat-tooltip.light .tooltip-title,
4492
+ .lib-xplat-tooltip.light .tooltip-desc {
4493
+ color: var(--semantic-text-subtle);
4476
4494
  }
4477
- .lib-xplat-tooltip:hover > .tooltip-content + .tooltip-wrapper,
4478
- .lib-xplat-tooltip > .tooltip-content:hover + .tooltip-wrapper {
4479
- opacity: 1;
4480
- pointer-events: auto;
4481
- transform: translateX(-50%) scale(1);
4495
+ @keyframes tooltip-show {
4496
+ from {
4497
+ opacity: 0;
4498
+ }
4499
+ to {
4500
+ opacity: 1;
4501
+ }
4482
4502
  }
4483
4503
 
4484
4504
  /* src/components/Video/video.scss */
@@ -2290,28 +2290,11 @@ var useChartTooltip = (enabled) => {
2290
2290
  if (!rect) return;
2291
2291
  setTooltip({ visible: true, x: e.clientX - rect.left, y: e.clientY - rect.top, content });
2292
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 });
2309
- }, [enabled]);
2310
2293
  const hide = React6.useCallback(() => {
2311
2294
  cancelAnimationFrame(rafRef.current);
2312
2295
  setTooltip((prev) => ({ ...prev, visible: false }));
2313
2296
  }, []);
2314
- return { tooltip, show, showAt, hide, move, containerRef };
2297
+ return { tooltip, show, hide, move, containerRef };
2315
2298
  };
2316
2299
  var GridLines = React6.memo(({ width, height, chartH, maxVal }) => /* @__PURE__ */ jsx307(Fragment2, { children: [0, 0.25, 0.5, 0.75, 1].map((ratio) => {
2317
2300
  const y = PADDING.top + (1 - ratio) * chartH;
@@ -2376,7 +2359,7 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
2376
2359
  }, [entries, seriesPoints]);
2377
2360
  return { activeIndex, handleMouseMove, handleMouseLeave, tooltipContent, getTooltipAt };
2378
2361
  };
2379
- var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, onShowAt, onMove, onLeave }) => {
2362
+ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
2380
2363
  const entries = React6.useMemo(() => Object.entries(data), [data]);
2381
2364
  const maxVal = React6.useMemo(() => {
2382
2365
  const allValues = entries.flatMap(([, v]) => v);
@@ -2396,7 +2379,6 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
2396
2379
  [entries, count, chartW, chartH, maxVal]
2397
2380
  );
2398
2381
  const clipRef = React6.useRef(null);
2399
- const svgRef = React6.useRef(null);
2400
2382
  const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
2401
2383
  React6.useEffect(() => {
2402
2384
  if (!animate || !clipRef.current) return;
@@ -2413,14 +2395,12 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
2413
2395
  return /* @__PURE__ */ jsxs197(
2414
2396
  "svg",
2415
2397
  {
2416
- ref: svgRef,
2417
2398
  viewBox: `0 0 ${width} ${height}`,
2418
2399
  className: "chart-svg",
2419
2400
  onMouseMove: (e) => {
2420
2401
  handleMouseMove(e);
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);
2402
+ if (activeIndex !== null) {
2403
+ onHover(e, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`);
2424
2404
  } else {
2425
2405
  onLeave();
2426
2406
  }
@@ -2488,7 +2468,7 @@ var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, on
2488
2468
  );
2489
2469
  });
2490
2470
  LineChart.displayName = "LineChart";
2491
- var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, onShowAt, onMove, onLeave }) => {
2471
+ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
2492
2472
  const entries = React6.useMemo(() => Object.entries(data), [data]);
2493
2473
  const maxVal = React6.useMemo(() => {
2494
2474
  const allValues = entries.flatMap(([, v]) => v);
@@ -2508,7 +2488,6 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
2508
2488
  [entries, count, chartW, chartH, maxVal]
2509
2489
  );
2510
2490
  const curveClipRef = React6.useRef(null);
2511
- const curveSvgRef = React6.useRef(null);
2512
2491
  const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
2513
2492
  React6.useEffect(() => {
2514
2493
  if (!animate || !curveClipRef.current) return;
@@ -2525,14 +2504,13 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
2525
2504
  return /* @__PURE__ */ jsxs197(
2526
2505
  "svg",
2527
2506
  {
2528
- ref: curveSvgRef,
2529
2507
  viewBox: `0 0 ${width} ${height}`,
2530
2508
  className: "chart-svg",
2531
2509
  onMouseMove: (e) => {
2532
2510
  handleMouseMove(e);
2533
2511
  if (activeIndex !== null && seriesPoints[0]?.[activeIndex]) {
2534
2512
  const p = seriesPoints[0][activeIndex];
2535
- onShowAt(p.x, p.y, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`, curveSvgRef.current);
2513
+ onHover(e, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`);
2536
2514
  } else {
2537
2515
  onLeave();
2538
2516
  }
@@ -2600,8 +2578,7 @@ var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, o
2600
2578
  );
2601
2579
  });
2602
2580
  CurveChart.displayName = "CurveChart";
2603
- var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onShowAt, onMove, onLeave }) => {
2604
- const barSvgRef = React6.useRef(null);
2581
+ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
2605
2582
  const entries = React6.useMemo(() => Object.entries(data), [data]);
2606
2583
  const maxVal = React6.useMemo(() => {
2607
2584
  const allValues = entries.flatMap(([, v]) => v);
@@ -2628,7 +2605,7 @@ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onS
2628
2605
  [entries, maxVal, chartH, groupW, barW, barGap, groupCount]
2629
2606
  );
2630
2607
  const barLabelStep = getLabelStep(count, chartW);
2631
- return /* @__PURE__ */ jsxs197("svg", { ref: barSvgRef, viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
2608
+ return /* @__PURE__ */ jsxs197("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
2632
2609
  /* @__PURE__ */ jsx307(GridLines, { width, height, chartH, maxVal }),
2633
2610
  labels.map((label, i) => {
2634
2611
  if (i % barLabelStep !== 0) return null;
@@ -2651,7 +2628,8 @@ var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onS
2651
2628
  transformOrigin: `${b.x + b.w / 2}px ${baseline}px`,
2652
2629
  animationDelay: `${delay}ms`
2653
2630
  } : void 0,
2654
- onMouseEnter: () => onShowAt(b.x + b.w / 2, b.y, `${key}: ${labels[i]} \u2014 ${b.v}`, barSvgRef.current),
2631
+ onMouseEnter: (e) => onHover(e, `${key}: ${labels[i]} \u2014 ${b.v}`),
2632
+ onMouseMove: onMove,
2655
2633
  onMouseLeave: onLeave
2656
2634
  },
2657
2635
  `${di}-${i}`
@@ -2739,14 +2717,17 @@ var PieDonutChart = React6.memo(
2739
2717
  {
2740
2718
  d: s.d,
2741
2719
  fill: PIE_COLORS[(i + colorOffset) % PIE_COLORS.length],
2742
- className: "chart-slice"
2720
+ className: "chart-slice",
2721
+ onMouseEnter: (e) => onHover(e, `${s.label} \u2014 ${s.v.toLocaleString()} (${s.pct}%)`),
2722
+ onMouseMove: onMove,
2723
+ onMouseLeave: onLeave
2743
2724
  }
2744
2725
  ) }, i)) })
2745
2726
  ] });
2746
2727
  }
2747
2728
  );
2748
2729
  PieDonutChart.displayName = "PieDonutChart";
2749
- var ChartTooltip = ({ x, y, containerWidth, containerHeight, children }) => {
2730
+ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, children }) => {
2750
2731
  const ref = React6.useRef(null);
2751
2732
  const [pos, setPos] = React6.useState({ left: 0, top: 0 });
2752
2733
  React6.useLayoutEffect(() => {
@@ -2761,13 +2742,20 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, children }) => {
2761
2742
  if (left < 0) left = 0;
2762
2743
  setPos({ left, top });
2763
2744
  }, [x, y, containerWidth, containerHeight]);
2764
- return /* @__PURE__ */ jsx307(
2745
+ const content = typeof children === "string" ? children : "";
2746
+ const sepIdx = content.indexOf(" \u2014 ");
2747
+ const title = sepIdx >= 0 ? content.slice(0, sepIdx) : content;
2748
+ const desc = sepIdx >= 0 ? content.slice(sepIdx + 3) : "";
2749
+ return /* @__PURE__ */ jsxs197(
2765
2750
  "div",
2766
2751
  {
2767
2752
  ref,
2768
- className: "chart-tooltip chart-tooltip-show",
2753
+ className: `chart-tooltip chart-tooltip-show chart-tooltip-${tooltipType}`,
2769
2754
  style: { left: pos.left, top: pos.top },
2770
- children
2755
+ children: [
2756
+ title && /* @__PURE__ */ jsx307("div", { className: "chart-tooltip-title", children: title }),
2757
+ desc && /* @__PURE__ */ jsx307("div", { className: "chart-tooltip-desc", children: desc })
2758
+ ]
2771
2759
  }
2772
2760
  );
2773
2761
  };
@@ -2810,8 +2798,8 @@ var ChartLegend = ({ data, labels, type }) => {
2810
2798
  }) });
2811
2799
  };
2812
2800
  var Chart = React6.memo((props) => {
2813
- const { type, data, labels, tooltip: showTooltip = true } = props;
2814
- const { tooltip, show, showAt, hide, move, containerRef } = useChartTooltip(showTooltip);
2801
+ const { type, data, labels, tooltip: showTooltip = true, tooltipType = "dark" } = props;
2802
+ const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
2815
2803
  const { width, height } = useChartSize(containerRef);
2816
2804
  const stableData = React6.useMemo(() => data, [JSON.stringify(data)]);
2817
2805
  const stableLabels = React6.useMemo(() => labels, [JSON.stringify(labels)]);
@@ -2819,13 +2807,13 @@ var Chart = React6.memo((props) => {
2819
2807
  const animate = useChartAnimation(containerRef, dataKey);
2820
2808
  const ready = width > 0 && height > 0;
2821
2809
  return /* @__PURE__ */ jsxs197("div", { className: "lib-xplat-chart", ref: containerRef, children: [
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 }),
2810
+ ready && type === "line" && /* @__PURE__ */ jsx307(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
2811
+ ready && type === "curve" && /* @__PURE__ */ jsx307(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
2812
+ ready && type === "bar" && /* @__PURE__ */ jsx307(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
2813
+ ready && type === "pie" && /* @__PURE__ */ jsx307(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
2814
+ ready && type === "doughnut" && /* @__PURE__ */ jsx307(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
2827
2815
  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 })
2816
+ tooltip.visible && tooltip.content && /* @__PURE__ */ jsx307(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
2829
2817
  ] });
2830
2818
  });
2831
2819
  Chart.displayName = "Chart";
@@ -5332,18 +5320,94 @@ ToastProvider.displayName = "ToastProvider";
5332
5320
 
5333
5321
  // src/components/Tooltip/Tooltip.tsx
5334
5322
  import React39 from "react";
5335
- import { jsx as jsx348, jsxs as jsxs221 } from "react/jsx-runtime";
5323
+ import { Fragment as Fragment5, jsx as jsx348, jsxs as jsxs221 } from "react/jsx-runtime";
5324
+ var OFFSET = 12;
5325
+ var SHOW_DELAY = 300;
5336
5326
  var Tooltip = (props) => {
5337
5327
  const {
5338
- type = "primary",
5328
+ type = "dark",
5329
+ title,
5339
5330
  description,
5340
- children
5331
+ children,
5332
+ disabled = false
5341
5333
  } = props;
5342
- const iconRef = React39.useRef(null);
5343
- return /* @__PURE__ */ jsxs221("div", { className: "lib-xplat-tooltip", children: [
5344
- /* @__PURE__ */ jsx348("div", { className: "tooltip-content", ref: iconRef, children: children || "Tooltip" }),
5345
- /* @__PURE__ */ jsx348("div", { className: clsx_default("tooltip-wrapper", type), children: description })
5346
- ] });
5334
+ const triggerRef = React39.useRef(null);
5335
+ const tooltipRef = React39.useRef(null);
5336
+ const [visible, setVisible] = React39.useState(false);
5337
+ const [pos, setPos] = React39.useState({ left: 0, top: 0 });
5338
+ const delayTimer = React39.useRef(0);
5339
+ const calculatePos = React39.useCallback((clientX, clientY) => {
5340
+ const el = tooltipRef.current;
5341
+ if (!el) return;
5342
+ const w = el.offsetWidth;
5343
+ const h = el.offsetHeight;
5344
+ const vw = window.innerWidth;
5345
+ let left = clientX + OFFSET;
5346
+ let top = clientY - h - OFFSET;
5347
+ if (left + w > vw - 8) left = clientX - w - OFFSET;
5348
+ if (top < 8) top = clientY + OFFSET;
5349
+ if (left < 8) left = 8;
5350
+ setPos({ left, top });
5351
+ }, []);
5352
+ const handleMouseEnter = React39.useCallback(() => {
5353
+ if (disabled) return;
5354
+ delayTimer.current = window.setTimeout(() => {
5355
+ setVisible(true);
5356
+ }, SHOW_DELAY);
5357
+ }, [disabled]);
5358
+ const handleMouseMove = React39.useCallback((e) => {
5359
+ if (!visible) return;
5360
+ calculatePos(e.clientX, e.clientY);
5361
+ }, [visible, calculatePos]);
5362
+ const handleMouseLeave = React39.useCallback(() => {
5363
+ window.clearTimeout(delayTimer.current);
5364
+ setVisible(false);
5365
+ }, []);
5366
+ const handleClick = React39.useCallback(() => {
5367
+ window.clearTimeout(delayTimer.current);
5368
+ setVisible(false);
5369
+ }, []);
5370
+ const handleFocus = React39.useCallback(() => {
5371
+ if (disabled) return;
5372
+ setVisible(true);
5373
+ }, [disabled]);
5374
+ const handleBlur = React39.useCallback(() => {
5375
+ setVisible(false);
5376
+ }, []);
5377
+ React39.useLayoutEffect(() => {
5378
+ if (!visible || !triggerRef.current) return;
5379
+ const rect = triggerRef.current.getBoundingClientRect();
5380
+ calculatePos(rect.right, rect.top);
5381
+ }, [visible, calculatePos]);
5382
+ if (!title && !description) return /* @__PURE__ */ jsx348(Fragment5, { children });
5383
+ return /* @__PURE__ */ jsxs221(
5384
+ "div",
5385
+ {
5386
+ ref: triggerRef,
5387
+ className: "lib-xplat-tooltip-trigger",
5388
+ onMouseEnter: handleMouseEnter,
5389
+ onMouseMove: handleMouseMove,
5390
+ onMouseLeave: handleMouseLeave,
5391
+ onClick: handleClick,
5392
+ onFocus: handleFocus,
5393
+ onBlur: handleBlur,
5394
+ children: [
5395
+ children,
5396
+ visible && /* @__PURE__ */ jsx348(Portal_default, { children: /* @__PURE__ */ jsxs221(
5397
+ "div",
5398
+ {
5399
+ ref: tooltipRef,
5400
+ className: clsx_default("lib-xplat-tooltip", type),
5401
+ style: { position: "fixed", left: pos.left, top: pos.top },
5402
+ children: [
5403
+ title && /* @__PURE__ */ jsx348("div", { className: "tooltip-title", children: title }),
5404
+ description && /* @__PURE__ */ jsx348("div", { className: "tooltip-desc", children: description })
5405
+ ]
5406
+ }
5407
+ ) })
5408
+ ]
5409
+ }
5410
+ );
5347
5411
  };
5348
5412
  Tooltip.displayName = "Tooltip";
5349
5413
  var Tooltip_default = Tooltip;