@ceed/cds 1.8.1 → 1.8.3

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,42 @@ 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
+ variant: "plain",
2975
+ title: children,
2976
+ placement: "top",
2977
+ enterDelay: 1500,
2978
+ enterNextDelay: 1500,
2979
+ onClick: (e) => e.stopPropagation()
2980
+ },
2981
+ content
2982
+ );
2948
2983
  }
2949
2984
  return content;
2950
2985
  };
@@ -3438,26 +3473,7 @@ var BodyCell = (props) => {
3438
3473
  className: isLastStartPinnedColumn && "is-last-left" || isLastEndPinnedColumn && "is-last-right" || ""
3439
3474
  },
3440
3475
  (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,
3476
+ () => showTooltip ? /* @__PURE__ */ import_react25.default.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
3461
3477
  [CellComponent, showTooltip, value]
3462
3478
  )
3463
3479
  );
@@ -3530,6 +3546,8 @@ function useDataTableRenderer({
3530
3546
  isTotalSelected: _isTotalSelected,
3531
3547
  isRowSelectable
3532
3548
  }) {
3549
+ const onSelectionModelChangeRef = (0, import_react25.useRef)(onSelectionModelChange);
3550
+ onSelectionModelChangeRef.current = onSelectionModelChange;
3533
3551
  const [focusedRowId, setFocusedRowId] = (0, import_react25.useState)(null);
3534
3552
  const [sortModel, setSortModel] = useControlledState(
3535
3553
  controlledSortModel,
@@ -3719,7 +3737,7 @@ function useDataTableRenderer({
3719
3737
  }
3720
3738
  }, [page, rowCount, pageSize, handlePageChange]);
3721
3739
  (0, import_react25.useEffect)(() => {
3722
- onSelectionModelChange?.([]);
3740
+ onSelectionModelChangeRef.current?.([]);
3723
3741
  }, [page]);
3724
3742
  return {
3725
3743
  rowCount,
package/dist/index.js CHANGED
@@ -2912,7 +2912,42 @@ 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
+ variant: "plain",
2943
+ title: children,
2944
+ placement: "top",
2945
+ enterDelay: 1500,
2946
+ enterNextDelay: 1500,
2947
+ onClick: (e) => e.stopPropagation()
2948
+ },
2949
+ content
2950
+ );
2916
2951
  }
2917
2952
  return content;
2918
2953
  };
@@ -3406,26 +3441,7 @@ var BodyCell = (props) => {
3406
3441
  className: isLastStartPinnedColumn && "is-last-left" || isLastEndPinnedColumn && "is-last-right" || ""
3407
3442
  },
3408
3443
  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,
3444
+ () => showTooltip ? /* @__PURE__ */ React23.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
3429
3445
  [CellComponent, showTooltip, value]
3430
3446
  )
3431
3447
  );
@@ -3498,6 +3514,8 @@ function useDataTableRenderer({
3498
3514
  isTotalSelected: _isTotalSelected,
3499
3515
  isRowSelectable
3500
3516
  }) {
3517
+ const onSelectionModelChangeRef = useRef4(onSelectionModelChange);
3518
+ onSelectionModelChangeRef.current = onSelectionModelChange;
3501
3519
  const [focusedRowId, setFocusedRowId] = useState6(null);
3502
3520
  const [sortModel, setSortModel] = useControlledState(
3503
3521
  controlledSortModel,
@@ -3687,7 +3705,7 @@ function useDataTableRenderer({
3687
3705
  }
3688
3706
  }, [page, rowCount, pageSize, handlePageChange]);
3689
3707
  useEffect5(() => {
3690
- onSelectionModelChange?.([]);
3708
+ onSelectionModelChangeRef.current?.([]);
3691
3709
  }, [page]);
3692
3710
  return {
3693
3711
  rowCount,