@sustaina/shared-ui 1.65.3 → 1.65.5

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.js CHANGED
@@ -3489,7 +3489,7 @@ var AuditFooter = ({
3489
3489
  ...labels
3490
3490
  };
3491
3491
  const dateFormatter = formatters?.date ?? ((value) => formatISODate(value, "DD/MM/YYYY"));
3492
- const timeFormatter = formatters?.time ?? ((value) => formatISODate(value, "H:i"));
3492
+ const timeFormatter = formatters?.time ?? ((value) => formatISODate(value, "H:i:s"));
3493
3493
  const userFormatter = formatters?.user ?? ((value) => value ?? emptyValue);
3494
3494
  const resolvedDeleteIcon = deleteIcon ?? /* @__PURE__ */ jsxRuntime.jsx(TrashIcon, { className: "w-5 h-5" });
3495
3495
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex w-full h-14 mt-12 justify-between items-end px-3", classNames?.root), children: [
@@ -6339,7 +6339,7 @@ function TooltipContent({
6339
6339
  "data-slot": "tooltip-content",
6340
6340
  sideOffset,
6341
6341
  className: cn(
6342
- "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
6342
+ "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance whitespace-pre-wrap",
6343
6343
  className
6344
6344
  ),
6345
6345
  ...props,
@@ -6785,6 +6785,7 @@ var Truncated = ({
6785
6785
  const [isTruncated, setIsTruncated] = React__namespace.useState(false);
6786
6786
  const [measureWidth, setMeasureWidth] = React__namespace.useState(0);
6787
6787
  const Comp = as;
6788
+ const isStringChildren = typeof children === "string";
6788
6789
  const normalizedChildren = typeof children === "string" ? children.replace(/>/g, ">\u200B") : children;
6789
6790
  const lineClampLines = typeof ellipsis === "number" ? ellipsis : typeof ellipsis === "object" ? ellipsis?.lineClamp ?? 3 : null;
6790
6791
  const enableMeasure = Boolean(ellipsis) && !tooltipProps?.disabled;
@@ -6824,19 +6825,31 @@ var Truncated = ({
6824
6825
  overflow: "hidden"
6825
6826
  };
6826
6827
  }, [lineClampLines, style]);
6827
- const baseContent = /* @__PURE__ */ jsxRuntime.jsx(Comp, { ref: elementRef, className: cn(truncationClass, className), style: clampedStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
6828
- EllipsisMeasure,
6828
+ const contentWhitespaceClass = React__namespace.useMemo(() => {
6829
+ if (!isStringChildren) return void 0;
6830
+ return truncationClass === "truncate" ? "whitespace-pre" : "whitespace-pre-wrap";
6831
+ }, [isStringChildren, truncationClass]);
6832
+ const baseContent = /* @__PURE__ */ jsxRuntime.jsx(
6833
+ Comp,
6829
6834
  {
6830
- enableMeasure,
6831
- text: normalizedChildren,
6832
- width: measureWidth,
6833
- rows: lineClampLines ?? 1,
6834
- expanded: false,
6835
- miscDeps: [truncationClass],
6836
- onEllipsis: setIsTruncated,
6837
- children: () => normalizedChildren
6835
+ ref: elementRef,
6836
+ className: cn(truncationClass, contentWhitespaceClass, className),
6837
+ style: clampedStyle,
6838
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6839
+ EllipsisMeasure,
6840
+ {
6841
+ enableMeasure,
6842
+ text: normalizedChildren,
6843
+ width: measureWidth,
6844
+ rows: lineClampLines ?? 1,
6845
+ expanded: false,
6846
+ miscDeps: [truncationClass],
6847
+ onEllipsis: setIsTruncated,
6848
+ children: () => normalizedChildren
6849
+ }
6850
+ )
6838
6851
  }
6839
- ) });
6852
+ );
6840
6853
  let tooltipContent = normalizedChildren;
6841
6854
  if (typeof ellipsis === "object") {
6842
6855
  tooltipContent = ellipsis?.content ?? normalizedChildren;
@@ -6864,6 +6877,7 @@ var Truncated = ({
6864
6877
  side: tooltipSide,
6865
6878
  className: cn(
6866
6879
  "text-white bg-sus-secondary-gray-10 max-w-xs sm:max-w-md wrap-break-word shadow-lg",
6880
+ isStringChildren && "whitespace-pre-wrap",
6867
6881
  tooltipContentClassName
6868
6882
  ),
6869
6883
  arrowClassName: cn("bg-sus-secondary-gray-10 fill-sus-secondary-gray-10", tooltipArrowClassName),
@@ -8637,7 +8651,7 @@ var sanitizeInput = (val) => {
8637
8651
  if (/[%*~^]/.test(trimmed)) return "__INVALID_WILDCARD__";
8638
8652
  if (/[%><={}\\[\]"']/u.test(trimmed)) return "__INVALID_CHAR__";
8639
8653
  if (/\p{Cc}/u.test(val)) return "__INVALID_CONTROL_CHAR__";
8640
- return trimmed.replace(/\s+/g, " ");
8654
+ return val;
8641
8655
  };
8642
8656
  var numericTypes = ["number"];
8643
8657
  var dateTypes = ["date", "datemonth"];
@@ -16283,7 +16297,10 @@ var DefaultHeader = ({
16283
16297
  "span",
16284
16298
  {
16285
16299
  ref: titleRef,
16286
- className: cn("text-lg font-semibold text-sus-green-1 truncate", classNames?.title),
16300
+ className: cn(
16301
+ "text-lg font-semibold text-sus-green-1 truncate whitespace-pre",
16302
+ classNames?.title
16303
+ ),
16287
16304
  children: title
16288
16305
  }
16289
16306
  ) : null;
@@ -16300,10 +16317,10 @@ var DefaultHeader = ({
16300
16317
  }
16301
16318
  ) : null,
16302
16319
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0", children: [
16303
- subtitle ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-xs text-gray-500", classNames?.subtitle), children: subtitle }) : null,
16320
+ subtitle ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-xs text-gray-500 whitespace-pre-wrap", classNames?.subtitle), children: subtitle }) : null,
16304
16321
  textElement ? isTruncated ? /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
16305
16322
  /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: textElement }),
16306
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: title })
16323
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { className: "whitespace-pre-wrap", children: title })
16307
16324
  ] }) : textElement : null
16308
16325
  ] })
16309
16326
  ] }),
@@ -17798,7 +17815,7 @@ var TruncatedMouseEnterDiv = ({
17798
17815
  ref: textRef,
17799
17816
  onMouseEnter: checkTruncation,
17800
17817
  onMouseLeave: () => setIsTruncated(false),
17801
- className: cn("truncate", className),
17818
+ className: cn("truncate whitespace-pre", className),
17802
17819
  children: value
17803
17820
  }
17804
17821
  ) }),