@x-plat/design-system 0.5.37 → 0.5.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -6779,28 +6779,11 @@ var useChartTooltip = (enabled) => {
6779
6779
  if (!rect) return;
6780
6780
  setTooltip({ visible: true, x: e.clientX - rect.left, y: e.clientY - rect.top, content });
6781
6781
  }, [enabled]);
6782
- const showAt = import_react6.default.useCallback((svgX, svgY, content, svgEl) => {
6783
- if (!enabled) return;
6784
- const container = containerRef.current;
6785
- if (!container) return;
6786
- let x = svgX;
6787
- let y = svgY;
6788
- if (svgEl) {
6789
- const svgRect = svgEl.getBoundingClientRect();
6790
- const containerRect = container.getBoundingClientRect();
6791
- const vb = svgEl.viewBox.baseVal;
6792
- const scaleX = svgRect.width / (vb.width || 1);
6793
- const scaleY = svgRect.height / (vb.height || 1);
6794
- x = svgX * scaleX + (svgRect.left - containerRect.left);
6795
- y = svgY * scaleY + (svgRect.top - containerRect.top);
6796
- }
6797
- setTooltip({ visible: true, x, y, content });
6798
- }, [enabled]);
6799
6782
  const hide = import_react6.default.useCallback(() => {
6800
6783
  cancelAnimationFrame(rafRef.current);
6801
6784
  setTooltip((prev) => ({ ...prev, visible: false }));
6802
6785
  }, []);
6803
- return { tooltip, show, showAt, hide, move, containerRef };
6786
+ return { tooltip, show, hide, move, containerRef };
6804
6787
  };
6805
6788
  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) => {
6806
6789
  const y = PADDING.top + (1 - ratio) * chartH;
@@ -6865,7 +6848,7 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
6865
6848
  }, [entries, seriesPoints]);
6866
6849
  return { activeIndex, handleMouseMove, handleMouseLeave, tooltipContent, getTooltipAt };
6867
6850
  };
6868
- var LineChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onShowAt, onMove, onLeave }) => {
6851
+ var LineChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
6869
6852
  const entries = import_react6.default.useMemo(() => Object.entries(data), [data]);
6870
6853
  const maxVal = import_react6.default.useMemo(() => {
6871
6854
  const allValues = entries.flatMap(([, v]) => v);
@@ -6885,7 +6868,6 @@ var LineChart = import_react6.default.memo(({ data, labels, width, height, anima
6885
6868
  [entries, count, chartW, chartH, maxVal]
6886
6869
  );
6887
6870
  const clipRef = import_react6.default.useRef(null);
6888
- const svgRef = import_react6.default.useRef(null);
6889
6871
  const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
6890
6872
  import_react6.default.useEffect(() => {
6891
6873
  if (!animate || !clipRef.current) return;
@@ -6902,14 +6884,12 @@ var LineChart = import_react6.default.memo(({ data, labels, width, height, anima
6902
6884
  return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)(
6903
6885
  "svg",
6904
6886
  {
6905
- ref: svgRef,
6906
6887
  viewBox: `0 0 ${width} ${height}`,
6907
6888
  className: "chart-svg",
6908
6889
  onMouseMove: (e) => {
6909
6890
  handleMouseMove(e);
6910
- if (activeIndex !== null && seriesPoints[0]?.[activeIndex]) {
6911
- const p = seriesPoints[0][activeIndex];
6912
- onShowAt(p.x, p.y, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`, svgRef.current);
6891
+ if (activeIndex !== null) {
6892
+ onHover(e, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`);
6913
6893
  } else {
6914
6894
  onLeave();
6915
6895
  }
@@ -6977,7 +6957,7 @@ var LineChart = import_react6.default.memo(({ data, labels, width, height, anima
6977
6957
  );
6978
6958
  });
6979
6959
  LineChart.displayName = "LineChart";
6980
- var CurveChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onShowAt, onMove, onLeave }) => {
6960
+ var CurveChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
6981
6961
  const entries = import_react6.default.useMemo(() => Object.entries(data), [data]);
6982
6962
  const maxVal = import_react6.default.useMemo(() => {
6983
6963
  const allValues = entries.flatMap(([, v]) => v);
@@ -6997,7 +6977,6 @@ var CurveChart = import_react6.default.memo(({ data, labels, width, height, anim
6997
6977
  [entries, count, chartW, chartH, maxVal]
6998
6978
  );
6999
6979
  const curveClipRef = import_react6.default.useRef(null);
7000
- const curveSvgRef = import_react6.default.useRef(null);
7001
6980
  const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
7002
6981
  import_react6.default.useEffect(() => {
7003
6982
  if (!animate || !curveClipRef.current) return;
@@ -7014,14 +6993,13 @@ var CurveChart = import_react6.default.memo(({ data, labels, width, height, anim
7014
6993
  return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)(
7015
6994
  "svg",
7016
6995
  {
7017
- ref: curveSvgRef,
7018
6996
  viewBox: `0 0 ${width} ${height}`,
7019
6997
  className: "chart-svg",
7020
6998
  onMouseMove: (e) => {
7021
6999
  handleMouseMove(e);
7022
7000
  if (activeIndex !== null && seriesPoints[0]?.[activeIndex]) {
7023
7001
  const p = seriesPoints[0][activeIndex];
7024
- onShowAt(p.x, p.y, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`, curveSvgRef.current);
7002
+ onHover(e, `${labels[activeIndex]} \u2014 ${getTooltipAt(activeIndex)}`);
7025
7003
  } else {
7026
7004
  onLeave();
7027
7005
  }
@@ -7089,8 +7067,7 @@ var CurveChart = import_react6.default.memo(({ data, labels, width, height, anim
7089
7067
  );
7090
7068
  });
7091
7069
  CurveChart.displayName = "CurveChart";
7092
- var BarChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onShowAt, onMove, onLeave }) => {
7093
- const barSvgRef = import_react6.default.useRef(null);
7070
+ var BarChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
7094
7071
  const entries = import_react6.default.useMemo(() => Object.entries(data), [data]);
7095
7072
  const maxVal = import_react6.default.useMemo(() => {
7096
7073
  const allValues = entries.flatMap(([, v]) => v);
@@ -7117,7 +7094,7 @@ var BarChart = import_react6.default.memo(({ data, labels, width, height, animat
7117
7094
  [entries, maxVal, chartH, groupW, barW, barGap, groupCount]
7118
7095
  );
7119
7096
  const barLabelStep = getLabelStep(count, chartW);
7120
- return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("svg", { ref: barSvgRef, viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
7097
+ return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
7121
7098
  /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(GridLines, { width, height, chartH, maxVal }),
7122
7099
  labels.map((label, i) => {
7123
7100
  if (i % barLabelStep !== 0) return null;
@@ -7140,7 +7117,8 @@ var BarChart = import_react6.default.memo(({ data, labels, width, height, animat
7140
7117
  transformOrigin: `${b.x + b.w / 2}px ${baseline}px`,
7141
7118
  animationDelay: `${delay}ms`
7142
7119
  } : void 0,
7143
- onMouseEnter: () => onShowAt(b.x + b.w / 2, b.y, `${key}: ${labels[i]} \u2014 ${b.v}`, barSvgRef.current),
7120
+ onMouseEnter: (e) => onHover(e, `${key}: ${labels[i]} \u2014 ${b.v}`),
7121
+ onMouseMove: onMove,
7144
7122
  onMouseLeave: onLeave
7145
7123
  },
7146
7124
  `${di}-${i}`
@@ -7228,14 +7206,17 @@ var PieDonutChart = import_react6.default.memo(
7228
7206
  {
7229
7207
  d: s.d,
7230
7208
  fill: PIE_COLORS[(i + colorOffset) % PIE_COLORS.length],
7231
- className: "chart-slice"
7209
+ className: "chart-slice",
7210
+ onMouseEnter: (e) => onHover(e, `${s.label} \u2014 ${s.v.toLocaleString()} (${s.pct}%)`),
7211
+ onMouseMove: onMove,
7212
+ onMouseLeave: onLeave
7232
7213
  }
7233
7214
  ) }, i)) })
7234
7215
  ] });
7235
7216
  }
7236
7217
  );
7237
7218
  PieDonutChart.displayName = "PieDonutChart";
7238
- var ChartTooltip = ({ x, y, containerWidth, containerHeight, children }) => {
7219
+ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, children }) => {
7239
7220
  const ref = import_react6.default.useRef(null);
7240
7221
  const [pos, setPos] = import_react6.default.useState({ left: 0, top: 0 });
7241
7222
  import_react6.default.useLayoutEffect(() => {
@@ -7246,17 +7227,25 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, children }) => {
7246
7227
  let left = x + TOOLTIP_OFFSET;
7247
7228
  let top = y - h - TOOLTIP_OFFSET;
7248
7229
  if (left + w > containerWidth) left = x - w - TOOLTIP_OFFSET;
7249
- if (top < 0) top = y + TOOLTIP_OFFSET;
7250
7230
  if (left < 0) left = 0;
7231
+ if (top < 0) top = y + TOOLTIP_OFFSET;
7232
+ if (top + h > containerHeight) top = containerHeight - h;
7251
7233
  setPos({ left, top });
7252
7234
  }, [x, y, containerWidth, containerHeight]);
7253
- return /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
7235
+ const content = typeof children === "string" ? children : "";
7236
+ const sepIdx = content.indexOf(" \u2014 ");
7237
+ const title = sepIdx >= 0 ? content.slice(0, sepIdx) : content;
7238
+ const desc = sepIdx >= 0 ? content.slice(sepIdx + 3) : "";
7239
+ return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)(
7254
7240
  "div",
7255
7241
  {
7256
7242
  ref,
7257
- className: "chart-tooltip chart-tooltip-show",
7243
+ className: `chart-tooltip chart-tooltip-show chart-tooltip-${tooltipType}`,
7258
7244
  style: { left: pos.left, top: pos.top },
7259
- children
7245
+ children: [
7246
+ title && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("div", { className: "chart-tooltip-title", children: title }),
7247
+ desc && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("div", { className: "chart-tooltip-desc", children: desc })
7248
+ ]
7260
7249
  }
7261
7250
  );
7262
7251
  };
@@ -7299,8 +7288,8 @@ var ChartLegend = ({ data, labels, type }) => {
7299
7288
  }) });
7300
7289
  };
7301
7290
  var Chart = import_react6.default.memo((props) => {
7302
- const { type, data, labels, tooltip: showTooltip = true } = props;
7303
- const { tooltip, show, showAt, hide, move, containerRef } = useChartTooltip(showTooltip);
7291
+ const { type, data, labels, tooltip: showTooltip = true, tooltipType = "dark" } = props;
7292
+ const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
7304
7293
  const { width, height } = useChartSize(containerRef);
7305
7294
  const stableData = import_react6.default.useMemo(() => data, [JSON.stringify(data)]);
7306
7295
  const stableLabels = import_react6.default.useMemo(() => labels, [JSON.stringify(labels)]);
@@ -7308,13 +7297,13 @@ var Chart = import_react6.default.memo((props) => {
7308
7297
  const animate = useChartAnimation(containerRef, dataKey);
7309
7298
  const ready = width > 0 && height > 0;
7310
7299
  return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("div", { className: "lib-xplat-chart", ref: containerRef, children: [
7311
- 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 }),
7312
- 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 }),
7313
- 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 }),
7314
- 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 }),
7315
- 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 }),
7300
+ ready && type === "line" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
7301
+ ready && type === "curve" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
7302
+ ready && type === "bar" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
7303
+ ready && type === "pie" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
7304
+ 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 }),
7316
7305
  ready && (type === "pie" || type === "doughnut") && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(ChartLegend, { data: stableData, labels: stableLabels, type }),
7317
- tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, children: tooltip.content })
7306
+ 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 })
7318
7307
  ] });
7319
7308
  });
7320
7309
  Chart.displayName = "Chart";
@@ -9835,17 +9824,93 @@ ToastProvider.displayName = "ToastProvider";
9835
9824
  // src/components/Tooltip/Tooltip.tsx
9836
9825
  var import_react40 = __toESM(require("react"), 1);
9837
9826
  var import_jsx_runtime348 = require("react/jsx-runtime");
9827
+ var OFFSET = 12;
9828
+ var SHOW_DELAY = 300;
9838
9829
  var Tooltip = (props) => {
9839
9830
  const {
9840
- type = "primary",
9831
+ type = "dark",
9832
+ title,
9841
9833
  description,
9842
- children
9834
+ children,
9835
+ disabled = false
9843
9836
  } = props;
9844
- const iconRef = import_react40.default.useRef(null);
9845
- return /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)("div", { className: "lib-xplat-tooltip", children: [
9846
- /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("div", { className: "tooltip-content", ref: iconRef, children: children || "Tooltip" }),
9847
- /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("div", { className: clsx_default("tooltip-wrapper", type), children: description })
9848
- ] });
9837
+ const triggerRef = import_react40.default.useRef(null);
9838
+ const tooltipRef = import_react40.default.useRef(null);
9839
+ const [visible, setVisible] = import_react40.default.useState(false);
9840
+ const [pos, setPos] = import_react40.default.useState({ left: 0, top: 0 });
9841
+ const delayTimer = import_react40.default.useRef(0);
9842
+ const calculatePos = import_react40.default.useCallback((clientX, clientY) => {
9843
+ const el = tooltipRef.current;
9844
+ if (!el) return;
9845
+ const w = el.offsetWidth;
9846
+ const h = el.offsetHeight;
9847
+ const vw = window.innerWidth;
9848
+ let left = clientX + OFFSET;
9849
+ let top = clientY - h - OFFSET;
9850
+ if (left + w > vw - 8) left = clientX - w - OFFSET;
9851
+ if (top < 8) top = clientY + OFFSET;
9852
+ if (left < 8) left = 8;
9853
+ setPos({ left, top });
9854
+ }, []);
9855
+ const handleMouseEnter = import_react40.default.useCallback(() => {
9856
+ if (disabled) return;
9857
+ delayTimer.current = window.setTimeout(() => {
9858
+ setVisible(true);
9859
+ }, SHOW_DELAY);
9860
+ }, [disabled]);
9861
+ const handleMouseMove = import_react40.default.useCallback((e) => {
9862
+ if (!visible) return;
9863
+ calculatePos(e.clientX, e.clientY);
9864
+ }, [visible, calculatePos]);
9865
+ const handleMouseLeave = import_react40.default.useCallback(() => {
9866
+ window.clearTimeout(delayTimer.current);
9867
+ setVisible(false);
9868
+ }, []);
9869
+ const handleClick = import_react40.default.useCallback(() => {
9870
+ window.clearTimeout(delayTimer.current);
9871
+ setVisible(false);
9872
+ }, []);
9873
+ const handleFocus = import_react40.default.useCallback(() => {
9874
+ if (disabled) return;
9875
+ setVisible(true);
9876
+ }, [disabled]);
9877
+ const handleBlur = import_react40.default.useCallback(() => {
9878
+ setVisible(false);
9879
+ }, []);
9880
+ import_react40.default.useLayoutEffect(() => {
9881
+ if (!visible || !triggerRef.current) return;
9882
+ const rect = triggerRef.current.getBoundingClientRect();
9883
+ calculatePos(rect.right, rect.top);
9884
+ }, [visible, calculatePos]);
9885
+ if (!title && !description) return /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(import_jsx_runtime348.Fragment, { children });
9886
+ return /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(
9887
+ "div",
9888
+ {
9889
+ ref: triggerRef,
9890
+ className: "lib-xplat-tooltip-trigger",
9891
+ onMouseEnter: handleMouseEnter,
9892
+ onMouseMove: handleMouseMove,
9893
+ onMouseLeave: handleMouseLeave,
9894
+ onClick: handleClick,
9895
+ onFocus: handleFocus,
9896
+ onBlur: handleBlur,
9897
+ children: [
9898
+ children,
9899
+ visible && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(
9900
+ "div",
9901
+ {
9902
+ ref: tooltipRef,
9903
+ className: clsx_default("lib-xplat-tooltip", type),
9904
+ style: { position: "fixed", left: pos.left, top: pos.top },
9905
+ children: [
9906
+ title && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("div", { className: "tooltip-title", children: title }),
9907
+ description && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("div", { className: "tooltip-desc", children: description })
9908
+ ]
9909
+ }
9910
+ ) })
9911
+ ]
9912
+ }
9913
+ );
9849
9914
  };
9850
9915
  Tooltip.displayName = "Tooltip";
9851
9916
  var Tooltip_default = Tooltip;
package/dist/index.css CHANGED
@@ -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 */