@sia.soul/sia-react-ui 0.1.81 → 0.1.82

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/chart.cjs CHANGED
@@ -254,10 +254,18 @@ function installTitleTooltips(doc) {
254
254
  let root;
255
255
  let observer;
256
256
  let tooltipId = "";
257
+ const canShow = (element) => {
258
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
259
+ return [element, ...element.querySelectorAll("*")].some((node) => {
260
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
261
+ const style = doc.defaultView?.getComputedStyle(node);
262
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
263
+ });
264
+ };
257
265
  const candidate = (target) => {
258
266
  if (!(target instanceof Element)) return null;
259
267
  const element = target.closest("[data-sia-title]");
260
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
268
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
261
269
  };
262
270
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
263
271
  const hide = () => {
@@ -275,7 +283,7 @@ function installTitleTooltips(doc) {
275
283
  };
276
284
  const render = () => {
277
285
  const text = active?.getAttribute("data-sia-title");
278
- if (!active?.isConnected || !text) {
286
+ if (!active?.isConnected || !text || !canShow(active)) {
279
287
  hide();
280
288
  return;
281
289
  }
package/dist/chart.js CHANGED
@@ -56,9 +56,9 @@ import {
56
56
  smoothSvgPath,
57
57
  svgArcPath,
58
58
  transferCompositeValue
59
- } from "./chunk-BDS42FR3.js";
60
- import "./chunk-JZWTTSOZ.js";
61
- import "./chunk-H7IAG72O.js";
59
+ } from "./chunk-ZHQ7PCCF.js";
60
+ import "./chunk-SJFT5OSX.js";
61
+ import "./chunk-PUZWLIIJ.js";
62
62
  export {
63
63
  BarChart,
64
64
  CHART_VIEWBOX_HEIGHT,
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  Popover,
3
3
  Tooltip
4
- } from "./chunk-WXERMWTW.js";
4
+ } from "./chunk-V4GGPMKS.js";
5
5
  import {
6
6
  Dropdown,
7
7
  Icon,
8
8
  useOverlayLifecycle
9
- } from "./chunk-XHLIIDD2.js";
9
+ } from "./chunk-CLBWJEID.js";
10
10
  import {
11
11
  Button,
12
12
  TextArea
13
- } from "./chunk-JZWTTSOZ.js";
13
+ } from "./chunk-SJFT5OSX.js";
14
14
  import {
15
15
  useControlSize,
16
16
  useControllableState,
17
17
  withTitleTooltip
18
- } from "./chunk-H7IAG72O.js";
18
+ } from "./chunk-PUZWLIIJ.js";
19
19
 
20
20
  // src/components/Toolbar.tsx
21
21
  import { useLayoutEffect, useRef, useState } from "react";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  Button,
3
3
  TextArea
4
- } from "./chunk-JZWTTSOZ.js";
4
+ } from "./chunk-SJFT5OSX.js";
5
5
  import {
6
6
  PopupPortal,
7
7
  useControlSize,
8
8
  useControllableState,
9
9
  usePlaceholderMode,
10
10
  withTitleTooltip
11
- } from "./chunk-H7IAG72O.js";
11
+ } from "./chunk-PUZWLIIJ.js";
12
12
 
13
13
  // src/components/Icon.tsx
14
14
  import { forwardRef } from "react";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  FloatingScrollbarProvider,
3
3
  Select
4
- } from "./chunk-WXERMWTW.js";
4
+ } from "./chunk-V4GGPMKS.js";
5
5
  import {
6
6
  Icon
7
- } from "./chunk-XHLIIDD2.js";
7
+ } from "./chunk-CLBWJEID.js";
8
8
  import {
9
9
  PopupPortal,
10
10
  useControlSize,
11
11
  useControllableState,
12
12
  useFloatingPlaceholder,
13
13
  withTitleTooltip
14
- } from "./chunk-H7IAG72O.js";
14
+ } from "./chunk-PUZWLIIJ.js";
15
15
 
16
16
  // src/components/DatePicker.tsx
17
17
  import { useEffect, useId, useLayoutEffect as useLayoutEffect2, useMemo, useRef as useRef2, useState } from "react";
@@ -20,10 +20,18 @@ function installTitleTooltips(doc) {
20
20
  let root;
21
21
  let observer;
22
22
  let tooltipId = "";
23
+ const canShow = (element) => {
24
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
25
+ return [element, ...element.querySelectorAll("*")].some((node) => {
26
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
27
+ const style = doc.defaultView?.getComputedStyle(node);
28
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
29
+ });
30
+ };
23
31
  const candidate = (target) => {
24
32
  if (!(target instanceof Element)) return null;
25
33
  const element = target.closest("[data-sia-title]");
26
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
34
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
27
35
  };
28
36
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
29
37
  const hide = () => {
@@ -41,7 +49,7 @@ function installTitleTooltips(doc) {
41
49
  };
42
50
  const render = () => {
43
51
  const text = active?.getAttribute("data-sia-title");
44
- if (!active?.isConnected || !text) {
52
+ if (!active?.isConnected || !text || !canShow(active)) {
45
53
  hide();
46
54
  return;
47
55
  }
@@ -2,14 +2,14 @@ import {
2
2
  Dropdown,
3
3
  Icon,
4
4
  Input
5
- } from "./chunk-XHLIIDD2.js";
5
+ } from "./chunk-CLBWJEID.js";
6
6
  import {
7
7
  Button
8
- } from "./chunk-JZWTTSOZ.js";
8
+ } from "./chunk-SJFT5OSX.js";
9
9
  import {
10
10
  useFloatingPlaceholder,
11
11
  withTitleTooltip
12
- } from "./chunk-H7IAG72O.js";
12
+ } from "./chunk-PUZWLIIJ.js";
13
13
 
14
14
  // src/components/RichTextEditor.tsx
15
15
  import { useEffect, useMemo, useRef, useState } from "react";
@@ -2,7 +2,7 @@ import {
2
2
  useControlSize,
3
3
  useFloatingPlaceholder,
4
4
  withTitleTooltip
5
- } from "./chunk-H7IAG72O.js";
5
+ } from "./chunk-PUZWLIIJ.js";
6
6
 
7
7
  // src/components/Button.tsx
8
8
  import { forwardRef, useRef } from "react";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useFloatingPlaceholder,
3
3
  withTitleTooltip
4
- } from "./chunk-H7IAG72O.js";
4
+ } from "./chunk-PUZWLIIJ.js";
5
5
 
6
6
  // src/components/MarkdownEditor.tsx
7
7
  import { useEffect, useRef, useState } from "react";
@@ -3,10 +3,10 @@ import {
3
3
  Icon,
4
4
  Input,
5
5
  Modal
6
- } from "./chunk-XHLIIDD2.js";
6
+ } from "./chunk-CLBWJEID.js";
7
7
  import {
8
8
  Button
9
- } from "./chunk-JZWTTSOZ.js";
9
+ } from "./chunk-SJFT5OSX.js";
10
10
  import {
11
11
  ControlSizeContext,
12
12
  PopupPortal,
@@ -14,7 +14,7 @@ import {
14
14
  useControllableState,
15
15
  useFloatingPlaceholder,
16
16
  withTitleTooltip
17
- } from "./chunk-H7IAG72O.js";
17
+ } from "./chunk-PUZWLIIJ.js";
18
18
 
19
19
  // src/components/Checkbox.tsx
20
20
  import { createContext, forwardRef, useContext, useEffect, useId, useMemo, useRef } from "react";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Button,
3
3
  TextArea
4
- } from "./chunk-JZWTTSOZ.js";
4
+ } from "./chunk-SJFT5OSX.js";
5
5
  import {
6
6
  withTitleTooltip
7
- } from "./chunk-H7IAG72O.js";
7
+ } from "./chunk-PUZWLIIJ.js";
8
8
 
9
9
  // src/components/ChartWhirlingLoading.tsx
10
10
  import { useEffect, useState } from "react";
package/dist/core.cjs CHANGED
@@ -182,10 +182,18 @@ function installTitleTooltips(doc) {
182
182
  let root;
183
183
  let observer;
184
184
  let tooltipId = "";
185
+ const canShow = (element) => {
186
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
187
+ return [element, ...element.querySelectorAll("*")].some((node) => {
188
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
189
+ const style = doc.defaultView?.getComputedStyle(node);
190
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
191
+ });
192
+ };
185
193
  const candidate = (target) => {
186
194
  if (!(target instanceof Element)) return null;
187
195
  const element = target.closest("[data-sia-title]");
188
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
196
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
189
197
  };
190
198
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
191
199
  const hide = () => {
@@ -203,7 +211,7 @@ function installTitleTooltips(doc) {
203
211
  };
204
212
  const render = () => {
205
213
  const text = active?.getAttribute("data-sia-title");
206
- if (!active?.isConnected || !text) {
214
+ if (!active?.isConnected || !text || !canShow(active)) {
207
215
  hide();
208
216
  return;
209
217
  }
package/dist/core.js CHANGED
@@ -10,20 +10,20 @@ import {
10
10
  Typography,
11
11
  Upload,
12
12
  message
13
- } from "./chunk-ZNJK3IKA.js";
13
+ } from "./chunk-BCOFQJ76.js";
14
14
  import {
15
15
  Select
16
- } from "./chunk-WXERMWTW.js";
16
+ } from "./chunk-V4GGPMKS.js";
17
17
  import {
18
18
  Icon,
19
19
  Input,
20
20
  Modal,
21
21
  Segmented
22
- } from "./chunk-XHLIIDD2.js";
22
+ } from "./chunk-CLBWJEID.js";
23
23
  import {
24
24
  Button
25
- } from "./chunk-JZWTTSOZ.js";
26
- import "./chunk-H7IAG72O.js";
25
+ } from "./chunk-SJFT5OSX.js";
26
+ import "./chunk-PUZWLIIJ.js";
27
27
  export {
28
28
  Breadcrumb,
29
29
  Button,
package/dist/index.cjs CHANGED
@@ -331,10 +331,18 @@ function installTitleTooltips(doc) {
331
331
  let root;
332
332
  let observer;
333
333
  let tooltipId = "";
334
+ const canShow = (element) => {
335
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
336
+ return [element, ...element.querySelectorAll("*")].some((node) => {
337
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
338
+ const style = doc.defaultView?.getComputedStyle(node);
339
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
340
+ });
341
+ };
334
342
  const candidate = (target) => {
335
343
  if (!(target instanceof Element)) return null;
336
344
  const element = target.closest("[data-sia-title]");
337
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
345
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
338
346
  };
339
347
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
340
348
  const hide = () => {
@@ -352,7 +360,7 @@ function installTitleTooltips(doc) {
352
360
  };
353
361
  const render = () => {
354
362
  const text = active?.getAttribute("data-sia-title");
355
- if (!active?.isConnected || !text) {
363
+ if (!active?.isConnected || !text || !canShow(active)) {
356
364
  hide();
357
365
  return;
358
366
  }
@@ -15677,7 +15685,7 @@ function TableInner(props, ref) {
15677
15685
  function renderHeaderContent(column, content) {
15678
15686
  const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
15679
15687
  return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "sia-table__header-label", children: [
15680
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "sia-table__header-label-content", ...withTitleTooltip({ title }), children: content }),
15688
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
15681
15689
  column.description != null && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Icon, { name: "info", size: 14 }) }) })
15682
15690
  ] });
15683
15691
  }
package/dist/index.d.cts CHANGED
@@ -1900,7 +1900,7 @@ interface TableColumn<T = Record<string, unknown>> {
1900
1900
  code?: string;
1901
1901
  /** 名称或字段标识。 */
1902
1902
  name?: string;
1903
- /** 列头内容,可传入文本或 React 节点;默认单行显示,超宽省略,并通过框架 title 提示展示完整文本。节点无法提取文本时使用 name 或 key。 */
1903
+ /** 列头内容,可传入文本或 React 节点;默认单行显示,仅文字实际超宽省略时通过框架 title 提示展示完整文本,完整显示时不提示。节点无法提取文本时使用 name 或 key。 */
1904
1904
  title?: ReactNode;
1905
1905
  /** 补充说明内容。 */
1906
1906
  description?: ReactNode;
@@ -1924,7 +1924,7 @@ interface TableColumn<T = Record<string, unknown>> {
1924
1924
  hidden?: boolean;
1925
1925
  /** 数据单元格默认单行显示并省略溢出内容(含 Space 标签组);设为 false 允许多行,不影响列头始终单行省略。 */
1926
1926
  ellipsis?: boolean;
1927
- /** 数据单元格是否使用 Sia Tooltip 显示完整文本;默认 false,不生成浏览器原生 title。列头始终提供完整标题提示,不受此属性影响。 */
1927
+ /** 数据单元格是否使用 Sia Tooltip 显示完整文本;默认 false,不生成浏览器原生 title。列头仅在文字实际省略时提示完整标题,不受此属性影响。 */
1928
1928
  showTitle?: boolean;
1929
1929
  /** 是否允许该列排序;配合排序插件显示按钮,依次切换升序、降序、未排序,当前排序方向以高亮单箭头显示。 */
1930
1930
  sortable?: boolean;
package/dist/index.d.ts CHANGED
@@ -1900,7 +1900,7 @@ interface TableColumn<T = Record<string, unknown>> {
1900
1900
  code?: string;
1901
1901
  /** 名称或字段标识。 */
1902
1902
  name?: string;
1903
- /** 列头内容,可传入文本或 React 节点;默认单行显示,超宽省略,并通过框架 title 提示展示完整文本。节点无法提取文本时使用 name 或 key。 */
1903
+ /** 列头内容,可传入文本或 React 节点;默认单行显示,仅文字实际超宽省略时通过框架 title 提示展示完整文本,完整显示时不提示。节点无法提取文本时使用 name 或 key。 */
1904
1904
  title?: ReactNode;
1905
1905
  /** 补充说明内容。 */
1906
1906
  description?: ReactNode;
@@ -1924,7 +1924,7 @@ interface TableColumn<T = Record<string, unknown>> {
1924
1924
  hidden?: boolean;
1925
1925
  /** 数据单元格默认单行显示并省略溢出内容(含 Space 标签组);设为 false 允许多行,不影响列头始终单行省略。 */
1926
1926
  ellipsis?: boolean;
1927
- /** 数据单元格是否使用 Sia Tooltip 显示完整文本;默认 false,不生成浏览器原生 title。列头始终提供完整标题提示,不受此属性影响。 */
1927
+ /** 数据单元格是否使用 Sia Tooltip 显示完整文本;默认 false,不生成浏览器原生 title。列头仅在文字实际省略时提示完整标题,不受此属性影响。 */
1928
1928
  showTitle?: boolean;
1929
1929
  /** 是否允许该列排序;配合排序插件显示按钮,依次切换升序、降序、未排序,当前排序方向以高亮单箭头显示。 */
1930
1930
  sortable?: boolean;
package/dist/index.js CHANGED
@@ -56,7 +56,7 @@ import {
56
56
  smoothSvgPath,
57
57
  svgArcPath,
58
58
  transferCompositeValue
59
- } from "./chunk-BDS42FR3.js";
59
+ } from "./chunk-ZHQ7PCCF.js";
60
60
  import {
61
61
  Badge,
62
62
  Breadcrumb,
@@ -80,19 +80,19 @@ import {
80
80
  Watermark,
81
81
  message,
82
82
  notification
83
- } from "./chunk-ZNJK3IKA.js";
83
+ } from "./chunk-BCOFQJ76.js";
84
84
  import {
85
85
  MarkdownEditor
86
- } from "./chunk-JZPAIZYK.js";
86
+ } from "./chunk-TUXNOSCT.js";
87
87
  import {
88
88
  RichTextContent,
89
89
  RichTextEditor
90
- } from "./chunk-GODBVCIQ.js";
90
+ } from "./chunk-SBNHEETW.js";
91
91
  import {
92
92
  DatePicker,
93
93
  SelectDateRange,
94
94
  TimePanel
95
- } from "./chunk-Y4Y2NVBM.js";
95
+ } from "./chunk-N6DVNCZT.js";
96
96
  import {
97
97
  Checkbox,
98
98
  FloatingScrollbarProvider,
@@ -104,7 +104,7 @@ import {
104
104
  Tooltip,
105
105
  Tree,
106
106
  useScrollbarProximity
107
- } from "./chunk-WXERMWTW.js";
107
+ } from "./chunk-V4GGPMKS.js";
108
108
  import {
109
109
  Dropdown,
110
110
  FILLED_ICON_NAMES,
@@ -117,11 +117,11 @@ import {
117
117
  Segmented,
118
118
  Steps,
119
119
  useOverlayLifecycle
120
- } from "./chunk-XHLIIDD2.js";
120
+ } from "./chunk-CLBWJEID.js";
121
121
  import {
122
122
  Button,
123
123
  TextArea
124
- } from "./chunk-JZWTTSOZ.js";
124
+ } from "./chunk-SJFT5OSX.js";
125
125
  import {
126
126
  ControlSizeContext,
127
127
  PlaceholderModeContext,
@@ -131,7 +131,7 @@ import {
131
131
  useFloatingPlaceholder,
132
132
  usePlaceholderMode,
133
133
  withTitleTooltip
134
- } from "./chunk-H7IAG72O.js";
134
+ } from "./chunk-PUZWLIIJ.js";
135
135
 
136
136
  // src/components/Alert.tsx
137
137
  import { useState } from "react";
@@ -8199,7 +8199,7 @@ function TableInner(props, ref) {
8199
8199
  function renderHeaderContent(column, content) {
8200
8200
  const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
8201
8201
  return /* @__PURE__ */ jsxs21("span", { className: "sia-table__header-label", children: [
8202
- /* @__PURE__ */ jsx23("span", { className: "sia-table__header-label-content", ...withTitleTooltip({ title }), children: content }),
8202
+ /* @__PURE__ */ jsx23("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
8203
8203
  column.description != null && /* @__PURE__ */ jsx23(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx23("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx23(Icon, { name: "info", size: 14 }) }) })
8204
8204
  ] });
8205
8205
  }
@@ -173,10 +173,18 @@ function installTitleTooltips(doc) {
173
173
  let root;
174
174
  let observer;
175
175
  let tooltipId = "";
176
+ const canShow = (element) => {
177
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
178
+ return [element, ...element.querySelectorAll("*")].some((node) => {
179
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
180
+ const style = doc.defaultView?.getComputedStyle(node);
181
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
182
+ });
183
+ };
176
184
  const candidate = (target) => {
177
185
  if (!(target instanceof Element)) return null;
178
186
  const element = target.closest("[data-sia-title]");
179
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
187
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
180
188
  };
181
189
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
182
190
  const hide = () => {
@@ -194,7 +202,7 @@ function installTitleTooltips(doc) {
194
202
  };
195
203
  const render = () => {
196
204
  const text = active?.getAttribute("data-sia-title");
197
- if (!active?.isConnected || !text) {
205
+ if (!active?.isConnected || !text || !canShow(active)) {
198
206
  hide();
199
207
  return;
200
208
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MarkdownEditor
3
- } from "./chunk-JZPAIZYK.js";
4
- import "./chunk-H7IAG72O.js";
3
+ } from "./chunk-TUXNOSCT.js";
4
+ import "./chunk-PUZWLIIJ.js";
5
5
  export {
6
6
  MarkdownEditor
7
7
  };
@@ -174,10 +174,18 @@ function installTitleTooltips(doc) {
174
174
  let root;
175
175
  let observer;
176
176
  let tooltipId = "";
177
+ const canShow = (element) => {
178
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
179
+ return [element, ...element.querySelectorAll("*")].some((node) => {
180
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
181
+ const style = doc.defaultView?.getComputedStyle(node);
182
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
183
+ });
184
+ };
177
185
  const candidate = (target) => {
178
186
  if (!(target instanceof Element)) return null;
179
187
  const element = target.closest("[data-sia-title]");
180
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
188
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
181
189
  };
182
190
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
183
191
  const hide = () => {
@@ -195,7 +203,7 @@ function installTitleTooltips(doc) {
195
203
  };
196
204
  const render = () => {
197
205
  const text = active?.getAttribute("data-sia-title");
198
- if (!active?.isConnected || !text) {
206
+ if (!active?.isConnected || !text || !canShow(active)) {
199
207
  hide();
200
208
  return;
201
209
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  RichTextContent,
3
3
  RichTextEditor
4
- } from "./chunk-GODBVCIQ.js";
5
- import "./chunk-XHLIIDD2.js";
6
- import "./chunk-JZWTTSOZ.js";
7
- import "./chunk-H7IAG72O.js";
4
+ } from "./chunk-SBNHEETW.js";
5
+ import "./chunk-CLBWJEID.js";
6
+ import "./chunk-SJFT5OSX.js";
7
+ import "./chunk-PUZWLIIJ.js";
8
8
  export {
9
9
  RichTextContent,
10
10
  RichTextEditor
@@ -163,10 +163,18 @@ function installTitleTooltips(doc) {
163
163
  let root;
164
164
  let observer;
165
165
  let tooltipId = "";
166
+ const canShow = (element) => {
167
+ if (!element.hasAttribute("data-sia-title-overflow-only")) return true;
168
+ return [element, ...element.querySelectorAll("*")].some((node) => {
169
+ if (node.clientWidth <= 0 || node.scrollWidth <= node.clientWidth) return false;
170
+ const style = doc.defaultView?.getComputedStyle(node);
171
+ return style?.textOverflow === "ellipsis" && (style.overflowX === "hidden" || style.overflowX === "clip");
172
+ });
173
+ };
166
174
  const candidate = (target) => {
167
175
  if (!(target instanceof Element)) return null;
168
176
  const element = target.closest("[data-sia-title]");
169
- return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") ? element : null;
177
+ return element?.getAttribute("data-sia-title") && !element.closest(".sia-floating") && canShow(element) ? element : null;
170
178
  };
171
179
  const hasExplicitTooltip = (target) => target instanceof Element && Boolean(target.closest(".sia-floating"));
172
180
  const hide = () => {
@@ -184,7 +192,7 @@ function installTitleTooltips(doc) {
184
192
  };
185
193
  const render = () => {
186
194
  const text = active?.getAttribute("data-sia-title");
187
- if (!active?.isConnected || !text) {
195
+ if (!active?.isConnected || !text || !canShow(active)) {
188
196
  hide();
189
197
  return;
190
198
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  SelectDateRange
3
- } from "./chunk-Y4Y2NVBM.js";
4
- import "./chunk-WXERMWTW.js";
5
- import "./chunk-XHLIIDD2.js";
6
- import "./chunk-JZWTTSOZ.js";
7
- import "./chunk-H7IAG72O.js";
3
+ } from "./chunk-N6DVNCZT.js";
4
+ import "./chunk-V4GGPMKS.js";
5
+ import "./chunk-CLBWJEID.js";
6
+ import "./chunk-SJFT5OSX.js";
7
+ import "./chunk-PUZWLIIJ.js";
8
8
  export {
9
9
  SelectDateRange
10
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.81",
3
+ "version": "0.1.82",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",