@trackunit/react-widgets 2.1.36 → 2.1.38

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/index.cjs.js CHANGED
@@ -273,7 +273,17 @@ const cvaWidgetKPITrendPercentage = cssClassVarianceUtilities.cvaMerge(["text-xs
273
273
  color: "success",
274
274
  },
275
275
  });
276
- const cvaWidgetKPINotice = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1", "text-xs", "font-normal"]);
276
+ const cvaWidgetKPINotice = cssClassVarianceUtilities.cvaMerge([
277
+ "flex",
278
+ "items-center",
279
+ "gap-1",
280
+ "text-xs",
281
+ "font-normal",
282
+ // Truncation of children and nested children
283
+ "truncate",
284
+ "*:truncate",
285
+ "**:truncate",
286
+ ]);
277
287
  const cvaWidgetKPIValueContainer = cssClassVarianceUtilities.cvaMerge(["truncate", "whitespace-nowrap"], {
278
288
  variants: {
279
289
  isDefaultAndHasTrendValue: {
@@ -296,7 +306,7 @@ const WidgetKPI = ({ title, value, loading, unit, className, dataTestId, tooltip
296
306
  return (jsxRuntime.jsx("div", { className: cvaWidgetKPI({ className }), "data-testid": dataTestId ? `${dataTestId}` : undefined, ...rest, children: loading ? (jsxRuntime.jsx("div", { className: "flex flex-col gap-2 pt-6", "data-testid": dataTestId ? `${dataTestId}-loading` : "WidgetKPI-loading", children: trend ? (jsxRuntime.jsx(reactComponents.SkeletonLines, { height: [16, 24, 16], lines: 3, margin: "6px 0", width: [100, 40, 60] })) : (jsxRuntime.jsx(reactComponents.SkeletonLines, { height: [16, 24], lines: 2, margin: "6px 0", width: [100, 40] })) })) : (jsxRuntime.jsxs("div", { className: "flex h-full flex-col justify-between", children: [jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [jsxRuntime.jsx("div", { className: cvaWidgetKPIHeader(), children: jsxRuntime.jsxs("div", { className: "flex items-start gap-1", children: [iconName ? (jsxRuntime.jsx(reactComponents.Icon, { className: "flex-shrink-0 py-0.5", color: iconColor, name: iconName, size: "small" })) : null, jsxRuntime.jsx(reactComponents.Tooltip, { dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, disabled: !tooltipLabel, label: tooltipLabel, placement: "bottom-start", children: jsxRuntime.jsx(reactComponents.Text, { className: cvaWidgetKPITitleText(), dataTestId: dataTestId ? `${dataTestId}-title` : undefined, children: title }) })] }) }), jsxRuntime.jsx("div", { className: "flex items-end", children: jsxRuntime.jsx(reactComponents.Text, { className: cvaWidgetKPIvalueText(), dataTestId: dataTestId ? `${dataTestId}-value` : undefined, type: "div", children: jsxRuntime.jsx("div", { className: cvaWidgetKPIValueContainer({
297
307
  isDefaultAndHasTrendValue: Boolean(trend?.value),
298
308
  className,
299
- }), children: jsxRuntime.jsxs("span", { className: cvaWidgetKPIvalueText(), children: [value, " ", unit] }) }) }) })] }), trend ? (jsxRuntime.jsx("div", { className: "flex items-center gap-1", children: jsxRuntime.jsx(TrendIndicator, { isSmallVariant: false, trend: trend, unit: unit }) })) : notice ? (jsxRuntime.jsx("div", { className: cvaWidgetKPINotice(), children: jsxRuntime.jsx("div", { className: "flex flex-1 items-center gap-1", children: notice }) })) : null] })) }));
309
+ }), children: jsxRuntime.jsxs("span", { className: cvaWidgetKPIvalueText(), children: [value, " ", unit] }) }) }) })] }), trend ? (jsxRuntime.jsx("div", { className: "flex items-center gap-1", children: jsxRuntime.jsx(TrendIndicator, { isSmallVariant: false, trend: trend, unit: unit }) })) : notice ? (jsxRuntime.jsx("div", { className: cvaWidgetKPINotice(), children: typeof notice === "string" || typeof notice === "number" ? jsxRuntime.jsx("span", { children: notice }) : notice })) : null] })) }));
300
310
  };
301
311
  const TrendIndicator = ({ trend, unit, isSmallVariant }) => {
302
312
  if (!trend) {
package/index.esm.js CHANGED
@@ -271,7 +271,17 @@ const cvaWidgetKPITrendPercentage = cvaMerge(["text-xs", "font-semibold"], {
271
271
  color: "success",
272
272
  },
273
273
  });
274
- const cvaWidgetKPINotice = cvaMerge(["flex", "items-center", "gap-1", "text-xs", "font-normal"]);
274
+ const cvaWidgetKPINotice = cvaMerge([
275
+ "flex",
276
+ "items-center",
277
+ "gap-1",
278
+ "text-xs",
279
+ "font-normal",
280
+ // Truncation of children and nested children
281
+ "truncate",
282
+ "*:truncate",
283
+ "**:truncate",
284
+ ]);
275
285
  const cvaWidgetKPIValueContainer = cvaMerge(["truncate", "whitespace-nowrap"], {
276
286
  variants: {
277
287
  isDefaultAndHasTrendValue: {
@@ -294,7 +304,7 @@ const WidgetKPI = ({ title, value, loading, unit, className, dataTestId, tooltip
294
304
  return (jsx("div", { className: cvaWidgetKPI({ className }), "data-testid": dataTestId ? `${dataTestId}` : undefined, ...rest, children: loading ? (jsx("div", { className: "flex flex-col gap-2 pt-6", "data-testid": dataTestId ? `${dataTestId}-loading` : "WidgetKPI-loading", children: trend ? (jsx(SkeletonLines, { height: [16, 24, 16], lines: 3, margin: "6px 0", width: [100, 40, 60] })) : (jsx(SkeletonLines, { height: [16, 24], lines: 2, margin: "6px 0", width: [100, 40] })) })) : (jsxs("div", { className: "flex h-full flex-col justify-between", children: [jsxs("div", { className: "flex flex-col gap-1", children: [jsx("div", { className: cvaWidgetKPIHeader(), children: jsxs("div", { className: "flex items-start gap-1", children: [iconName ? (jsx(Icon, { className: "flex-shrink-0 py-0.5", color: iconColor, name: iconName, size: "small" })) : null, jsx(Tooltip, { dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, disabled: !tooltipLabel, label: tooltipLabel, placement: "bottom-start", children: jsx(Text, { className: cvaWidgetKPITitleText(), dataTestId: dataTestId ? `${dataTestId}-title` : undefined, children: title }) })] }) }), jsx("div", { className: "flex items-end", children: jsx(Text, { className: cvaWidgetKPIvalueText(), dataTestId: dataTestId ? `${dataTestId}-value` : undefined, type: "div", children: jsx("div", { className: cvaWidgetKPIValueContainer({
295
305
  isDefaultAndHasTrendValue: Boolean(trend?.value),
296
306
  className,
297
- }), children: jsxs("span", { className: cvaWidgetKPIvalueText(), children: [value, " ", unit] }) }) }) })] }), trend ? (jsx("div", { className: "flex items-center gap-1", children: jsx(TrendIndicator, { isSmallVariant: false, trend: trend, unit: unit }) })) : notice ? (jsx("div", { className: cvaWidgetKPINotice(), children: jsx("div", { className: "flex flex-1 items-center gap-1", children: notice }) })) : null] })) }));
307
+ }), children: jsxs("span", { className: cvaWidgetKPIvalueText(), children: [value, " ", unit] }) }) }) })] }), trend ? (jsx("div", { className: "flex items-center gap-1", children: jsx(TrendIndicator, { isSmallVariant: false, trend: trend, unit: unit }) })) : notice ? (jsx("div", { className: cvaWidgetKPINotice(), children: typeof notice === "string" || typeof notice === "number" ? jsx("span", { children: notice }) : notice })) : null] })) }));
298
308
  };
299
309
  const TrendIndicator = ({ trend, unit, isSmallVariant }) => {
300
310
  if (!trend) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-widgets",
3
- "version": "2.1.36",
3
+ "version": "2.1.38",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "react": "19.0.0",
11
- "@trackunit/react-components": "1.7.31",
11
+ "@trackunit/react-components": "1.7.32",
12
12
  "@trackunit/iris-app-runtime-core": "1.7.25",
13
13
  "@trackunit/css-class-variance-utilities": "1.6.23",
14
14
  "@trackunit/ui-design-tokens": "1.6.24",
@@ -60,6 +60,7 @@ export interface WidgetKPIProps extends CommonProps {
60
60
  /**
61
61
  * Custom notice or text to display in the trend area
62
62
  * If provided, this will override the trend display
63
+ * Text will be truncated to fit on a single line
63
64
  */
64
65
  notice?: ReactNode;
65
66
  }