@ceed/cds 1.8.2 → 1.8.4

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
@@ -2944,7 +2944,41 @@ var TextEllipsis = ({ children }) => {
2944
2944
  }, [children]);
2945
2945
  const content = /* @__PURE__ */ import_react25.default.createElement(EllipsisDiv, { ref: textRef }, children);
2946
2946
  if (showTooltip) {
2947
- return /* @__PURE__ */ import_react25.default.createElement(Tooltip_default, { title: children, placement: "top" }, content);
2947
+ return /* @__PURE__ */ import_react25.default.createElement(
2948
+ Tooltip_default,
2949
+ {
2950
+ title: children,
2951
+ placement: "top",
2952
+ onClick: (e) => e.stopPropagation()
2953
+ },
2954
+ content
2955
+ );
2956
+ }
2957
+ return content;
2958
+ };
2959
+ var CellTextEllipsis = ({ children }) => {
2960
+ const textRef = (0, import_react25.useRef)(null);
2961
+ const [showTooltip, setShowTooltip] = (0, import_react25.useState)(false);
2962
+ (0, import_react25.useLayoutEffect)(() => {
2963
+ const element = textRef.current;
2964
+ if (element) {
2965
+ const isTextTruncated = element.scrollWidth > element.clientWidth;
2966
+ setShowTooltip(isTextTruncated);
2967
+ }
2968
+ }, [children]);
2969
+ const content = /* @__PURE__ */ import_react25.default.createElement(EllipsisDiv, { ref: textRef }, children);
2970
+ if (showTooltip) {
2971
+ return /* @__PURE__ */ import_react25.default.createElement(
2972
+ Tooltip_default,
2973
+ {
2974
+ title: children,
2975
+ placement: "top",
2976
+ enterDelay: 1500,
2977
+ enterNextDelay: 1500,
2978
+ onClick: (e) => e.stopPropagation()
2979
+ },
2980
+ content
2981
+ );
2948
2982
  }
2949
2983
  return content;
2950
2984
  };
@@ -3438,26 +3472,7 @@ var BodyCell = (props) => {
3438
3472
  className: isLastStartPinnedColumn && "is-last-left" || isLastEndPinnedColumn && "is-last-right" || ""
3439
3473
  },
3440
3474
  (0, import_react25.useMemo)(
3441
- () => showTooltip ? /* @__PURE__ */ import_react25.default.createElement(
3442
- Tooltip_default,
3443
- {
3444
- title: value,
3445
- placement: "bottom",
3446
- style: { maxWidth: "100%" },
3447
- enterDelay: 1500,
3448
- enterNextDelay: 1500
3449
- },
3450
- /* @__PURE__ */ import_react25.default.createElement(
3451
- "div",
3452
- {
3453
- style: {
3454
- overflow: "hidden",
3455
- textOverflow: "ellipsis"
3456
- }
3457
- },
3458
- CellComponent
3459
- )
3460
- ) : CellComponent,
3475
+ () => showTooltip ? /* @__PURE__ */ import_react25.default.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
3461
3476
  [CellComponent, showTooltip, value]
3462
3477
  )
3463
3478
  );
package/dist/index.js CHANGED
@@ -2912,7 +2912,41 @@ var TextEllipsis = ({ children }) => {
2912
2912
  }, [children]);
2913
2913
  const content = /* @__PURE__ */ React23.createElement(EllipsisDiv, { ref: textRef }, children);
2914
2914
  if (showTooltip) {
2915
- return /* @__PURE__ */ React23.createElement(Tooltip_default, { title: children, placement: "top" }, content);
2915
+ return /* @__PURE__ */ React23.createElement(
2916
+ Tooltip_default,
2917
+ {
2918
+ title: children,
2919
+ placement: "top",
2920
+ onClick: (e) => e.stopPropagation()
2921
+ },
2922
+ content
2923
+ );
2924
+ }
2925
+ return content;
2926
+ };
2927
+ var CellTextEllipsis = ({ children }) => {
2928
+ const textRef = useRef4(null);
2929
+ const [showTooltip, setShowTooltip] = useState6(false);
2930
+ useLayoutEffect(() => {
2931
+ const element = textRef.current;
2932
+ if (element) {
2933
+ const isTextTruncated = element.scrollWidth > element.clientWidth;
2934
+ setShowTooltip(isTextTruncated);
2935
+ }
2936
+ }, [children]);
2937
+ const content = /* @__PURE__ */ React23.createElement(EllipsisDiv, { ref: textRef }, children);
2938
+ if (showTooltip) {
2939
+ return /* @__PURE__ */ React23.createElement(
2940
+ Tooltip_default,
2941
+ {
2942
+ title: children,
2943
+ placement: "top",
2944
+ enterDelay: 1500,
2945
+ enterNextDelay: 1500,
2946
+ onClick: (e) => e.stopPropagation()
2947
+ },
2948
+ content
2949
+ );
2916
2950
  }
2917
2951
  return content;
2918
2952
  };
@@ -3406,26 +3440,7 @@ var BodyCell = (props) => {
3406
3440
  className: isLastStartPinnedColumn && "is-last-left" || isLastEndPinnedColumn && "is-last-right" || ""
3407
3441
  },
3408
3442
  useMemo8(
3409
- () => showTooltip ? /* @__PURE__ */ React23.createElement(
3410
- Tooltip_default,
3411
- {
3412
- title: value,
3413
- placement: "bottom",
3414
- style: { maxWidth: "100%" },
3415
- enterDelay: 1500,
3416
- enterNextDelay: 1500
3417
- },
3418
- /* @__PURE__ */ React23.createElement(
3419
- "div",
3420
- {
3421
- style: {
3422
- overflow: "hidden",
3423
- textOverflow: "ellipsis"
3424
- }
3425
- },
3426
- CellComponent
3427
- )
3428
- ) : CellComponent,
3443
+ () => showTooltip ? /* @__PURE__ */ React23.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
3429
3444
  [CellComponent, showTooltip, value]
3430
3445
  )
3431
3446
  );