@x-plat/design-system 0.5.36 → 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.
@@ -1,5 +1,19 @@
1
1
  // src/components/Tooltip/Tooltip.tsx
2
+ import React2 from "react";
3
+
4
+ // src/tokens/hooks/Portal.tsx
2
5
  import React from "react";
6
+ import ReactDOM from "react-dom";
7
+ import { jsx } from "react/jsx-runtime";
8
+ var PortalContainerContext = React.createContext(null);
9
+ var Portal = ({ children }) => {
10
+ const contextContainer = React.useContext(PortalContainerContext);
11
+ if (typeof document === "undefined") return null;
12
+ const container = contextContainer ?? document.body;
13
+ return ReactDOM.createPortal(children, container);
14
+ };
15
+ Portal.displayName = "Portal";
16
+ var Portal_default = Portal;
3
17
 
4
18
  // ../../node_modules/clsx/dist/clsx.mjs
5
19
  function r(e) {
@@ -18,18 +32,94 @@ function clsx() {
18
32
  var clsx_default = clsx;
19
33
 
20
34
  // src/components/Tooltip/Tooltip.tsx
21
- import { jsx, jsxs } from "react/jsx-runtime";
35
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
36
+ var OFFSET = 12;
37
+ var SHOW_DELAY = 300;
22
38
  var Tooltip = (props) => {
23
39
  const {
24
- type = "primary",
40
+ type = "dark",
41
+ title,
25
42
  description,
26
- children
43
+ children,
44
+ disabled = false
27
45
  } = props;
28
- const iconRef = React.useRef(null);
29
- return /* @__PURE__ */ jsxs("div", { className: "lib-xplat-tooltip", children: [
30
- /* @__PURE__ */ jsx("div", { className: "tooltip-content", ref: iconRef, children: children || "Tooltip" }),
31
- /* @__PURE__ */ jsx("div", { className: clsx_default("tooltip-wrapper", type), children: description })
32
- ] });
46
+ const triggerRef = React2.useRef(null);
47
+ const tooltipRef = React2.useRef(null);
48
+ const [visible, setVisible] = React2.useState(false);
49
+ const [pos, setPos] = React2.useState({ left: 0, top: 0 });
50
+ const delayTimer = React2.useRef(0);
51
+ const calculatePos = React2.useCallback((clientX, clientY) => {
52
+ const el = tooltipRef.current;
53
+ if (!el) return;
54
+ const w = el.offsetWidth;
55
+ const h = el.offsetHeight;
56
+ const vw = window.innerWidth;
57
+ let left = clientX + OFFSET;
58
+ let top = clientY - h - OFFSET;
59
+ if (left + w > vw - 8) left = clientX - w - OFFSET;
60
+ if (top < 8) top = clientY + OFFSET;
61
+ if (left < 8) left = 8;
62
+ setPos({ left, top });
63
+ }, []);
64
+ const handleMouseEnter = React2.useCallback(() => {
65
+ if (disabled) return;
66
+ delayTimer.current = window.setTimeout(() => {
67
+ setVisible(true);
68
+ }, SHOW_DELAY);
69
+ }, [disabled]);
70
+ const handleMouseMove = React2.useCallback((e) => {
71
+ if (!visible) return;
72
+ calculatePos(e.clientX, e.clientY);
73
+ }, [visible, calculatePos]);
74
+ const handleMouseLeave = React2.useCallback(() => {
75
+ window.clearTimeout(delayTimer.current);
76
+ setVisible(false);
77
+ }, []);
78
+ const handleClick = React2.useCallback(() => {
79
+ window.clearTimeout(delayTimer.current);
80
+ setVisible(false);
81
+ }, []);
82
+ const handleFocus = React2.useCallback(() => {
83
+ if (disabled) return;
84
+ setVisible(true);
85
+ }, [disabled]);
86
+ const handleBlur = React2.useCallback(() => {
87
+ setVisible(false);
88
+ }, []);
89
+ React2.useLayoutEffect(() => {
90
+ if (!visible || !triggerRef.current) return;
91
+ const rect = triggerRef.current.getBoundingClientRect();
92
+ calculatePos(rect.right, rect.top);
93
+ }, [visible, calculatePos]);
94
+ if (!title && !description) return /* @__PURE__ */ jsx2(Fragment, { children });
95
+ return /* @__PURE__ */ jsxs(
96
+ "div",
97
+ {
98
+ ref: triggerRef,
99
+ className: "lib-xplat-tooltip-trigger",
100
+ onMouseEnter: handleMouseEnter,
101
+ onMouseMove: handleMouseMove,
102
+ onMouseLeave: handleMouseLeave,
103
+ onClick: handleClick,
104
+ onFocus: handleFocus,
105
+ onBlur: handleBlur,
106
+ children: [
107
+ children,
108
+ visible && /* @__PURE__ */ jsx2(Portal_default, { children: /* @__PURE__ */ jsxs(
109
+ "div",
110
+ {
111
+ ref: tooltipRef,
112
+ className: clsx_default("lib-xplat-tooltip", type),
113
+ style: { position: "fixed", left: pos.left, top: pos.top },
114
+ children: [
115
+ title && /* @__PURE__ */ jsx2("div", { className: "tooltip-title", children: title }),
116
+ description && /* @__PURE__ */ jsx2("div", { className: "tooltip-desc", children: description })
117
+ ]
118
+ }
119
+ ) })
120
+ ]
121
+ }
122
+ );
33
123
  };
34
124
  Tooltip.displayName = "Tooltip";
35
125
  var Tooltip_default = Tooltip;
@@ -2380,15 +2380,11 @@ var useChartTooltip = (enabled) => {
2380
2380
  if (!rect) return;
2381
2381
  setTooltip({ visible: true, x: e.clientX - rect.left, y: e.clientY - rect.top, content });
2382
2382
  }, [enabled]);
2383
- const showAt = import_react6.default.useCallback((x, y, content) => {
2384
- if (!enabled) return;
2385
- setTooltip({ visible: true, x, y, content });
2386
- }, [enabled]);
2387
2383
  const hide = import_react6.default.useCallback(() => {
2388
2384
  cancelAnimationFrame(rafRef.current);
2389
2385
  setTooltip((prev) => ({ ...prev, visible: false }));
2390
2386
  }, []);
2391
- return { tooltip, show, showAt, hide, move, containerRef };
2387
+ return { tooltip, show, hide, move, containerRef };
2392
2388
  };
2393
2389
  var GridLines = import_react6.default.memo(({ width, height, chartH, maxVal }) => /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(import_jsx_runtime307.Fragment, { children: [0, 0.25, 0.5, 0.75, 1].map((ratio) => {
2394
2390
  const y = PADDING.top + (1 - ratio) * chartH;
@@ -2453,7 +2449,7 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
2453
2449
  }, [entries, seriesPoints]);
2454
2450
  return { activeIndex, handleMouseMove, handleMouseLeave, tooltipContent, getTooltipAt };
2455
2451
  };
2456
- var LineChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onShowAt, onMove, onLeave }) => {
2452
+ var LineChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
2457
2453
  const entries = import_react6.default.useMemo(() => Object.entries(data), [data]);
2458
2454
  const maxVal = import_react6.default.useMemo(() => {
2459
2455
  const allValues = entries.flatMap(([, v]) => v);
@@ -2493,9 +2489,8 @@ var LineChart = import_react6.default.memo(({ data, labels, width, height, anima
2493
2489
  className: "chart-svg",
2494
2490
  onMouseMove: (e) => {
2495
2491
  handleMouseMove(e);
2496
- if (activeIndex !== null && seriesPoints[0]?.[activeIndex]) {
2497
- const p = seriesPoints[0][activeIndex];
2498
- onShowAt(p.x, p.y, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`);
2492
+ if (activeIndex !== null) {
2493
+ onHover(e, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`);
2499
2494
  } else {
2500
2495
  onLeave();
2501
2496
  }
@@ -2563,7 +2558,7 @@ var LineChart = import_react6.default.memo(({ data, labels, width, height, anima
2563
2558
  );
2564
2559
  });
2565
2560
  LineChart.displayName = "LineChart";
2566
- var CurveChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onShowAt, onMove, onLeave }) => {
2561
+ var CurveChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
2567
2562
  const entries = import_react6.default.useMemo(() => Object.entries(data), [data]);
2568
2563
  const maxVal = import_react6.default.useMemo(() => {
2569
2564
  const allValues = entries.flatMap(([, v]) => v);
@@ -2605,7 +2600,7 @@ var CurveChart = import_react6.default.memo(({ data, labels, width, height, anim
2605
2600
  handleMouseMove(e);
2606
2601
  if (activeIndex !== null && seriesPoints[0]?.[activeIndex]) {
2607
2602
  const p = seriesPoints[0][activeIndex];
2608
- onShowAt(p.x, p.y, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`);
2603
+ onHover(e, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`);
2609
2604
  } else {
2610
2605
  onLeave();
2611
2606
  }
@@ -2673,7 +2668,7 @@ var CurveChart = import_react6.default.memo(({ data, labels, width, height, anim
2673
2668
  );
2674
2669
  });
2675
2670
  CurveChart.displayName = "CurveChart";
2676
- var BarChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onShowAt, onMove, onLeave }) => {
2671
+ var BarChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
2677
2672
  const entries = import_react6.default.useMemo(() => Object.entries(data), [data]);
2678
2673
  const maxVal = import_react6.default.useMemo(() => {
2679
2674
  const allValues = entries.flatMap(([, v]) => v);
@@ -2723,7 +2718,8 @@ var BarChart = import_react6.default.memo(({ data, labels, width, height, animat
2723
2718
  transformOrigin: `${b.x + b.w / 2}px ${baseline}px`,
2724
2719
  animationDelay: `${delay}ms`
2725
2720
  } : void 0,
2726
- onMouseEnter: () => onShowAt(b.x + b.w / 2, b.y, `${key}: ${labels[i]} \u2014 ${b.v}`),
2721
+ onMouseEnter: (e) => onHover(e, `${key}: ${labels[i]} \u2014 ${b.v}`),
2722
+ onMouseMove: onMove,
2727
2723
  onMouseLeave: onLeave
2728
2724
  },
2729
2725
  `${di}-${i}`
@@ -2811,14 +2807,17 @@ var PieDonutChart = import_react6.default.memo(
2811
2807
  {
2812
2808
  d: s.d,
2813
2809
  fill: PIE_COLORS[(i + colorOffset) % PIE_COLORS.length],
2814
- className: "chart-slice"
2810
+ className: "chart-slice",
2811
+ onMouseEnter: (e) => onHover(e, `${s.label} \u2014 ${s.v.toLocaleString()} (${s.pct}%)`),
2812
+ onMouseMove: onMove,
2813
+ onMouseLeave: onLeave
2815
2814
  }
2816
2815
  ) }, i)) })
2817
2816
  ] });
2818
2817
  }
2819
2818
  );
2820
2819
  PieDonutChart.displayName = "PieDonutChart";
2821
- var ChartTooltip = ({ x, y, containerWidth, containerHeight, children }) => {
2820
+ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, children }) => {
2822
2821
  const ref = import_react6.default.useRef(null);
2823
2822
  const [pos, setPos] = import_react6.default.useState({ left: 0, top: 0 });
2824
2823
  import_react6.default.useLayoutEffect(() => {
@@ -2833,13 +2832,20 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, children }) => {
2833
2832
  if (left < 0) left = 0;
2834
2833
  setPos({ left, top });
2835
2834
  }, [x, y, containerWidth, containerHeight]);
2836
- return /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
2835
+ const content = typeof children === "string" ? children : "";
2836
+ const sepIdx = content.indexOf(" \u2014 ");
2837
+ const title = sepIdx >= 0 ? content.slice(0, sepIdx) : content;
2838
+ const desc = sepIdx >= 0 ? content.slice(sepIdx + 3) : "";
2839
+ return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)(
2837
2840
  "div",
2838
2841
  {
2839
2842
  ref,
2840
- className: "chart-tooltip chart-tooltip-show",
2843
+ className: `chart-tooltip chart-tooltip-show chart-tooltip-${tooltipType}`,
2841
2844
  style: { left: pos.left, top: pos.top },
2842
- children
2845
+ children: [
2846
+ title && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("div", { className: "chart-tooltip-title", children: title }),
2847
+ desc && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("div", { className: "chart-tooltip-desc", children: desc })
2848
+ ]
2843
2849
  }
2844
2850
  );
2845
2851
  };
@@ -2882,8 +2888,8 @@ var ChartLegend = ({ data, labels, type }) => {
2882
2888
  }) });
2883
2889
  };
2884
2890
  var Chart = import_react6.default.memo((props) => {
2885
- const { type, data, labels, tooltip: showTooltip = true } = props;
2886
- const { tooltip, show, showAt, hide, move, containerRef } = useChartTooltip(showTooltip);
2891
+ const { type, data, labels, tooltip: showTooltip = true, tooltipType = "dark" } = props;
2892
+ const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
2887
2893
  const { width, height } = useChartSize(containerRef);
2888
2894
  const stableData = import_react6.default.useMemo(() => data, [JSON.stringify(data)]);
2889
2895
  const stableLabels = import_react6.default.useMemo(() => labels, [JSON.stringify(labels)]);
@@ -2891,13 +2897,13 @@ var Chart = import_react6.default.memo((props) => {
2891
2897
  const animate = useChartAnimation(containerRef, dataKey);
2892
2898
  const ready = width > 0 && height > 0;
2893
2899
  return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("div", { className: "lib-xplat-chart", ref: containerRef, children: [
2894
- ready && type === "line" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onShowAt: showAt, onMove: move, onLeave: hide }),
2895
- ready && type === "curve" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onShowAt: showAt, onMove: move, onLeave: hide }),
2896
- ready && type === "bar" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onShowAt: showAt, onMove: move, onLeave: hide }),
2897
- ready && type === "pie" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onShowAt: showAt, onMove: move, onLeave: hide }),
2898
- ready && type === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onShowAt: showAt, onMove: move, onLeave: hide }),
2899
- ready && (type === "bar" || type === "pie" || type === "doughnut") && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(ChartLegend, { data: stableData, labels: stableLabels, type }),
2900
- tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, children: tooltip.content })
2900
+ ready && type === "line" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
2901
+ ready && type === "curve" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
2902
+ ready && type === "bar" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
2903
+ ready && type === "pie" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
2904
+ ready && type === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
2905
+ ready && (type === "pie" || type === "doughnut") && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(ChartLegend, { data: stableData, labels: stableLabels, type }),
2906
+ tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
2901
2907
  ] });
2902
2908
  });
2903
2909
  Chart.displayName = "Chart";
@@ -5405,17 +5411,93 @@ ToastProvider.displayName = "ToastProvider";
5405
5411
  // src/components/Tooltip/Tooltip.tsx
5406
5412
  var import_react40 = __toESM(require("react"), 1);
5407
5413
  var import_jsx_runtime348 = require("react/jsx-runtime");
5414
+ var OFFSET = 12;
5415
+ var SHOW_DELAY = 300;
5408
5416
  var Tooltip = (props) => {
5409
5417
  const {
5410
- type = "primary",
5418
+ type = "dark",
5419
+ title,
5411
5420
  description,
5412
- children
5421
+ children,
5422
+ disabled = false
5413
5423
  } = props;
5414
- const iconRef = import_react40.default.useRef(null);
5415
- return /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)("div", { className: "lib-xplat-tooltip", children: [
5416
- /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("div", { className: "tooltip-content", ref: iconRef, children: children || "Tooltip" }),
5417
- /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("div", { className: clsx_default("tooltip-wrapper", type), children: description })
5418
- ] });
5424
+ const triggerRef = import_react40.default.useRef(null);
5425
+ const tooltipRef = import_react40.default.useRef(null);
5426
+ const [visible, setVisible] = import_react40.default.useState(false);
5427
+ const [pos, setPos] = import_react40.default.useState({ left: 0, top: 0 });
5428
+ const delayTimer = import_react40.default.useRef(0);
5429
+ const calculatePos = import_react40.default.useCallback((clientX, clientY) => {
5430
+ const el = tooltipRef.current;
5431
+ if (!el) return;
5432
+ const w = el.offsetWidth;
5433
+ const h = el.offsetHeight;
5434
+ const vw = window.innerWidth;
5435
+ let left = clientX + OFFSET;
5436
+ let top = clientY - h - OFFSET;
5437
+ if (left + w > vw - 8) left = clientX - w - OFFSET;
5438
+ if (top < 8) top = clientY + OFFSET;
5439
+ if (left < 8) left = 8;
5440
+ setPos({ left, top });
5441
+ }, []);
5442
+ const handleMouseEnter = import_react40.default.useCallback(() => {
5443
+ if (disabled) return;
5444
+ delayTimer.current = window.setTimeout(() => {
5445
+ setVisible(true);
5446
+ }, SHOW_DELAY);
5447
+ }, [disabled]);
5448
+ const handleMouseMove = import_react40.default.useCallback((e) => {
5449
+ if (!visible) return;
5450
+ calculatePos(e.clientX, e.clientY);
5451
+ }, [visible, calculatePos]);
5452
+ const handleMouseLeave = import_react40.default.useCallback(() => {
5453
+ window.clearTimeout(delayTimer.current);
5454
+ setVisible(false);
5455
+ }, []);
5456
+ const handleClick = import_react40.default.useCallback(() => {
5457
+ window.clearTimeout(delayTimer.current);
5458
+ setVisible(false);
5459
+ }, []);
5460
+ const handleFocus = import_react40.default.useCallback(() => {
5461
+ if (disabled) return;
5462
+ setVisible(true);
5463
+ }, [disabled]);
5464
+ const handleBlur = import_react40.default.useCallback(() => {
5465
+ setVisible(false);
5466
+ }, []);
5467
+ import_react40.default.useLayoutEffect(() => {
5468
+ if (!visible || !triggerRef.current) return;
5469
+ const rect = triggerRef.current.getBoundingClientRect();
5470
+ calculatePos(rect.right, rect.top);
5471
+ }, [visible, calculatePos]);
5472
+ if (!title && !description) return /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(import_jsx_runtime348.Fragment, { children });
5473
+ return /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(
5474
+ "div",
5475
+ {
5476
+ ref: triggerRef,
5477
+ className: "lib-xplat-tooltip-trigger",
5478
+ onMouseEnter: handleMouseEnter,
5479
+ onMouseMove: handleMouseMove,
5480
+ onMouseLeave: handleMouseLeave,
5481
+ onClick: handleClick,
5482
+ onFocus: handleFocus,
5483
+ onBlur: handleBlur,
5484
+ children: [
5485
+ children,
5486
+ visible && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(
5487
+ "div",
5488
+ {
5489
+ ref: tooltipRef,
5490
+ className: clsx_default("lib-xplat-tooltip", type),
5491
+ style: { position: "fixed", left: pos.left, top: pos.top },
5492
+ children: [
5493
+ title && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("div", { className: "tooltip-title", children: title }),
5494
+ description && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("div", { className: "tooltip-desc", children: description })
5495
+ ]
5496
+ }
5497
+ ) })
5498
+ ]
5499
+ }
5500
+ );
5419
5501
  };
5420
5502
  Tooltip.displayName = "Tooltip";
5421
5503
  var Tooltip_default = Tooltip;
@@ -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 */