@l3mpire/ui 2.26.2 → 2.26.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.mjs CHANGED
@@ -1133,20 +1133,39 @@ import * as React7 from "react";
1133
1133
  import * as TooltipPrimitive2 from "@radix-ui/react-tooltip";
1134
1134
  import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1135
1135
  var TruncatedText = React7.forwardRef(
1136
- ({ children, tooltip, delayDuration = 300, className, ...props }, ref) => {
1137
- const innerRef = React7.useRef(null);
1138
- React7.useImperativeHandle(ref, () => innerRef.current);
1136
+ ({ children, tooltip, delayDuration = 300, className, ...props }, forwardedRef) => {
1137
+ const [el, setEl] = React7.useState(null);
1139
1138
  const [isTruncated, setIsTruncated] = React7.useState(false);
1140
- React7.useEffect(() => {
1141
- const el = innerRef.current;
1139
+ const setRef = React7.useCallback(
1140
+ (node) => {
1141
+ setEl(node);
1142
+ if (typeof forwardedRef === "function") forwardedRef(node);
1143
+ else if (forwardedRef) {
1144
+ forwardedRef.current = node;
1145
+ }
1146
+ },
1147
+ [forwardedRef]
1148
+ );
1149
+ React7.useLayoutEffect(() => {
1142
1150
  if (!el) return;
1143
1151
  const check = () => setIsTruncated(el.scrollWidth > el.clientWidth);
1144
1152
  check();
1145
1153
  const ro = new ResizeObserver(check);
1146
1154
  ro.observe(el);
1147
1155
  return () => ro.disconnect();
1148
- }, [children]);
1149
- const span = /* @__PURE__ */ jsx7("span", { ref: innerRef, className: cn("truncate", className), ...props, children });
1156
+ }, [el, children]);
1157
+ const span = /* @__PURE__ */ jsx7(
1158
+ "span",
1159
+ {
1160
+ ref: setRef,
1161
+ className: cn(
1162
+ "inline-block max-w-full min-w-0 align-bottom truncate",
1163
+ className
1164
+ ),
1165
+ ...props,
1166
+ children
1167
+ }
1168
+ );
1150
1169
  if (!isTruncated) return span;
1151
1170
  return /* @__PURE__ */ jsx7(TooltipPrimitive2.Provider, { delayDuration, children: /* @__PURE__ */ jsxs7(TooltipPrimitive2.Root, { children: [
1152
1171
  /* @__PURE__ */ jsx7(TooltipPrimitive2.Trigger, { asChild: true, children: span }),