@ceed/ads 1.25.1-next.2 → 1.26.0

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
@@ -2215,12 +2215,22 @@ var import_framer_motion17 = require("framer-motion");
2215
2215
  var import_ArrowUpwardRounded = __toESM(require("@mui/icons-material/ArrowUpwardRounded"));
2216
2216
  var EllipsisDiv = (0, import_joy25.styled)("div", {
2217
2217
  name: "DataTable",
2218
- slot: "textEllipsis"
2219
- })({
2220
- overflow: "hidden",
2221
- textOverflow: "ellipsis",
2222
- whiteSpace: "nowrap"
2223
- });
2218
+ slot: "textEllipsis",
2219
+ shouldForwardProp: (prop) => prop !== "lineClamp"
2220
+ })(
2221
+ ({ lineClamp }) => lineClamp && lineClamp > 1 ? {
2222
+ overflow: "hidden",
2223
+ display: "-webkit-box !important",
2224
+ WebkitBoxOrient: "vertical",
2225
+ WebkitLineClamp: lineClamp,
2226
+ whiteSpace: "normal",
2227
+ overflowWrap: "anywhere"
2228
+ } : {
2229
+ overflow: "hidden",
2230
+ textOverflow: "ellipsis",
2231
+ whiteSpace: "nowrap"
2232
+ }
2233
+ );
2224
2234
  var OverlayWrapper = (0, import_joy25.styled)("tr", {
2225
2235
  name: "DataTable",
2226
2236
  slot: "overlayWrapper"
@@ -2902,21 +2912,22 @@ function InfoSign(props) {
2902
2912
  var InfoSign_default = InfoSign;
2903
2913
 
2904
2914
  // src/components/DataTable/components.tsx
2905
- var TextEllipsis = ({ children }) => {
2915
+ var TextEllipsis = ({ children, lineClamp }) => {
2906
2916
  const textRef = (0, import_react24.useRef)(null);
2907
2917
  const [showTooltip, setShowTooltip] = (0, import_react24.useState)(false);
2908
2918
  (0, import_react24.useLayoutEffect)(() => {
2909
2919
  const element = textRef.current;
2910
- if (element) {
2911
- const isTextTruncated = element.scrollWidth > element.clientWidth;
2912
- setShowTooltip(isTextTruncated);
2913
- }
2914
- }, [children]);
2915
- const content = /* @__PURE__ */ import_react24.default.createElement(EllipsisDiv, { ref: textRef }, children);
2916
- if (showTooltip) {
2917
- return /* @__PURE__ */ import_react24.default.createElement(Tooltip_default, { title: children, placement: "top", onClick: (e) => e.stopPropagation() }, content);
2918
- }
2919
- return content;
2920
+ if (!element) return;
2921
+ const checkTruncation = () => {
2922
+ const isTruncated = lineClamp && lineClamp > 1 ? element.scrollHeight > element.clientHeight + 1 : element.scrollWidth > element.clientWidth;
2923
+ setShowTooltip(isTruncated);
2924
+ };
2925
+ checkTruncation();
2926
+ const ro = new ResizeObserver(checkTruncation);
2927
+ ro.observe(element);
2928
+ return () => ro.disconnect();
2929
+ }, [children, lineClamp]);
2930
+ return /* @__PURE__ */ import_react24.default.createElement(Tooltip_default, { title: showTooltip ? children : "", placement: "top", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react24.default.createElement(EllipsisDiv, { ref: textRef, lineClamp }, children));
2920
2931
  };
2921
2932
  var CellTextEllipsis = ({ children }) => {
2922
2933
  const textRef = (0, import_react24.useRef)(null);
@@ -2967,7 +2978,8 @@ var HeadCell = (props) => {
2967
2978
  pinnedEndPosition,
2968
2979
  headerRef,
2969
2980
  tableColRef,
2970
- headerClassName
2981
+ headerClassName,
2982
+ headerLineClamp
2971
2983
  } = props;
2972
2984
  const theme = (0, import_joy32.useTheme)();
2973
2985
  const ref = headerRef;
@@ -3061,7 +3073,7 @@ var HeadCell = (props) => {
3061
3073
  initial: "initial",
3062
3074
  className: computedHeaderClassName
3063
3075
  },
3064
- /* @__PURE__ */ import_react24.default.createElement(Stack_default, { gap: 1, direction: "row", justifyContent: textAlign, alignItems: "center" }, textAlign === "end" && sortIcon, textAlign === "end" && infoSign, /* @__PURE__ */ import_react24.default.createElement(TextEllipsis, null, headerName ?? field, editMode && required && /* @__PURE__ */ import_react24.default.createElement(Asterisk, null, "*")), textAlign === "start" && infoSign, textAlign === "start" && sortIcon),
3076
+ /* @__PURE__ */ import_react24.default.createElement(Stack_default, { gap: 1, direction: "row", justifyContent: textAlign, alignItems: "center", sx: { minWidth: 0 } }, textAlign === "end" && sortIcon, textAlign === "end" && infoSign, /* @__PURE__ */ import_react24.default.createElement(TextEllipsis, { lineClamp: headerLineClamp }, headerName ?? field, editMode && required && /* @__PURE__ */ import_react24.default.createElement(Asterisk, null, "*")), textAlign === "start" && infoSign, textAlign === "start" && sortIcon),
3065
3077
  resizer
3066
3078
  );
3067
3079
  };
package/dist/index.js CHANGED
@@ -2081,12 +2081,22 @@ import { motion as motion17 } from "framer-motion";
2081
2081
  import SortIcon from "@mui/icons-material/ArrowUpwardRounded";
2082
2082
  var EllipsisDiv = styled8("div", {
2083
2083
  name: "DataTable",
2084
- slot: "textEllipsis"
2085
- })({
2086
- overflow: "hidden",
2087
- textOverflow: "ellipsis",
2088
- whiteSpace: "nowrap"
2089
- });
2084
+ slot: "textEllipsis",
2085
+ shouldForwardProp: (prop) => prop !== "lineClamp"
2086
+ })(
2087
+ ({ lineClamp }) => lineClamp && lineClamp > 1 ? {
2088
+ overflow: "hidden",
2089
+ display: "-webkit-box !important",
2090
+ WebkitBoxOrient: "vertical",
2091
+ WebkitLineClamp: lineClamp,
2092
+ whiteSpace: "normal",
2093
+ overflowWrap: "anywhere"
2094
+ } : {
2095
+ overflow: "hidden",
2096
+ textOverflow: "ellipsis",
2097
+ whiteSpace: "nowrap"
2098
+ }
2099
+ );
2090
2100
  var OverlayWrapper = styled8("tr", {
2091
2101
  name: "DataTable",
2092
2102
  slot: "overlayWrapper"
@@ -2777,21 +2787,22 @@ function InfoSign(props) {
2777
2787
  var InfoSign_default = InfoSign;
2778
2788
 
2779
2789
  // src/components/DataTable/components.tsx
2780
- var TextEllipsis = ({ children }) => {
2790
+ var TextEllipsis = ({ children, lineClamp }) => {
2781
2791
  const textRef = useRef5(null);
2782
2792
  const [showTooltip, setShowTooltip] = useState8(false);
2783
2793
  useLayoutEffect(() => {
2784
2794
  const element = textRef.current;
2785
- if (element) {
2786
- const isTextTruncated = element.scrollWidth > element.clientWidth;
2787
- setShowTooltip(isTextTruncated);
2788
- }
2789
- }, [children]);
2790
- const content = /* @__PURE__ */ React22.createElement(EllipsisDiv, { ref: textRef }, children);
2791
- if (showTooltip) {
2792
- return /* @__PURE__ */ React22.createElement(Tooltip_default, { title: children, placement: "top", onClick: (e) => e.stopPropagation() }, content);
2793
- }
2794
- return content;
2795
+ if (!element) return;
2796
+ const checkTruncation = () => {
2797
+ const isTruncated = lineClamp && lineClamp > 1 ? element.scrollHeight > element.clientHeight + 1 : element.scrollWidth > element.clientWidth;
2798
+ setShowTooltip(isTruncated);
2799
+ };
2800
+ checkTruncation();
2801
+ const ro = new ResizeObserver(checkTruncation);
2802
+ ro.observe(element);
2803
+ return () => ro.disconnect();
2804
+ }, [children, lineClamp]);
2805
+ return /* @__PURE__ */ React22.createElement(Tooltip_default, { title: showTooltip ? children : "", placement: "top", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React22.createElement(EllipsisDiv, { ref: textRef, lineClamp }, children));
2795
2806
  };
2796
2807
  var CellTextEllipsis = ({ children }) => {
2797
2808
  const textRef = useRef5(null);
@@ -2842,7 +2853,8 @@ var HeadCell = (props) => {
2842
2853
  pinnedEndPosition,
2843
2854
  headerRef,
2844
2855
  tableColRef,
2845
- headerClassName
2856
+ headerClassName,
2857
+ headerLineClamp
2846
2858
  } = props;
2847
2859
  const theme = useTheme();
2848
2860
  const ref = headerRef;
@@ -2936,7 +2948,7 @@ var HeadCell = (props) => {
2936
2948
  initial: "initial",
2937
2949
  className: computedHeaderClassName
2938
2950
  },
2939
- /* @__PURE__ */ React22.createElement(Stack_default, { gap: 1, direction: "row", justifyContent: textAlign, alignItems: "center" }, textAlign === "end" && sortIcon, textAlign === "end" && infoSign, /* @__PURE__ */ React22.createElement(TextEllipsis, null, headerName ?? field, editMode && required && /* @__PURE__ */ React22.createElement(Asterisk, null, "*")), textAlign === "start" && infoSign, textAlign === "start" && sortIcon),
2951
+ /* @__PURE__ */ React22.createElement(Stack_default, { gap: 1, direction: "row", justifyContent: textAlign, alignItems: "center", sx: { minWidth: 0 } }, textAlign === "end" && sortIcon, textAlign === "end" && infoSign, /* @__PURE__ */ React22.createElement(TextEllipsis, { lineClamp: headerLineClamp }, headerName ?? field, editMode && required && /* @__PURE__ */ React22.createElement(Asterisk, null, "*")), textAlign === "start" && infoSign, textAlign === "start" && sortIcon),
2940
2952
  resizer
2941
2953
  );
2942
2954
  };