@trackunit/react-components 0.5.23 → 0.5.25

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
@@ -3720,7 +3720,18 @@ const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label
3720
3720
 
3721
3721
  const cvaIndicator = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
3722
3722
  const cvaIndicatorIcon = cssClassVarianceUtilities.cvaMerge(["mr-2"]);
3723
- const cvaIndicatorLabel = cssClassVarianceUtilities.cvaMerge(["pl-2", "pr-2", "font-medium", "capitalize", "text-sm"]);
3723
+ const cvaIndicatorLabel = cssClassVarianceUtilities.cvaMerge(["font-medium", "capitalize", "text-secondary-600"], {
3724
+ variants: {
3725
+ size: {
3726
+ small: "pl-1 pr-1 text-xs",
3727
+ medium: "pl-2 pr-2 text-sm",
3728
+ large: "pl-2 pr-2 text-base",
3729
+ },
3730
+ },
3731
+ defaultVariants: {
3732
+ size: "medium",
3733
+ },
3734
+ });
3724
3735
  const cvaIndicatorPing = cssClassVarianceUtilities.cvaMerge(["animate-ping-sm", "absolute", "inline-flex", "h-full", "w-full", "rounded-full", "opacity-75", "bg-neutral-600"], {
3725
3736
  variants: {
3726
3737
  color: {
@@ -3816,8 +3827,8 @@ const cvaIndicatorIconBackground = cssClassVarianceUtilities.cvaMerge(["rounded-
3816
3827
  * @param {IndicatorProps} props - The props for the Indicator component
3817
3828
  * @returns {JSX.Element} Indicator component
3818
3829
  */
3819
- const Indicator = ({ dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, className, ...rest }) => {
3820
- return (jsxRuntime.jsx(Tooltip, { className: className, disabled: withLabel, label: label, placement: "bottom", children: jsxRuntime.jsxs("div", { "aria-label": label, className: cvaIndicator(), "data-testid": dataTestId, ...rest, children: [jsxRuntime.jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping ? (jsxRuntime.jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" })) : null, icon] }), label !== undefined && withLabel ? (jsxRuntime.jsx("div", { className: cvaIndicatorLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label })) : null] }) }));
3830
+ const Indicator = ({ dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, size, className, ...rest }) => {
3831
+ return (jsxRuntime.jsx(Tooltip, { className: className, disabled: withLabel, label: label, placement: "bottom", children: jsxRuntime.jsxs("div", { "aria-label": label, className: cvaIndicator(), "data-testid": dataTestId, ...rest, children: [jsxRuntime.jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping ? (jsxRuntime.jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" })) : null, icon] }), label !== undefined && withLabel ? (jsxRuntime.jsx("div", { className: cvaIndicatorLabel({ size }), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label })) : null] }) }));
3821
3832
  };
3822
3833
 
3823
3834
  const cvaKPICardContainer = cssClassVarianceUtilities.cvaMerge(["inline-flex"], {
@@ -4068,7 +4079,7 @@ const cvaMenuItemSuffix = cssClassVarianceUtilities.cvaMerge(["text-secondary-40
4068
4079
  * @param {MenuItemProps} props - The props for the MenuItem component
4069
4080
  * @returns {JSX.Element} MenuItem component
4070
4081
  */
4071
- const MenuItem = ({ className, dataTestId, label, size, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, variant = "primary", }) => {
4082
+ const MenuItem = ({ className, dataTestId, label, size, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, variant = "primary", }) => {
4072
4083
  /* Handle tab navigation */
4073
4084
  const handleKeyDown = (e) => {
4074
4085
  if (e.key === "Enter" && onClick && !disabled) {
@@ -4086,7 +4097,7 @@ const MenuItem = ({ className, dataTestId, label, size, children, selected, pref
4086
4097
  }), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
4087
4098
  stopPropagation && e.stopPropagation();
4088
4099
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
4089
- }, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0, children: [prefix ? (jsxRuntime.jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxRuntime.jsx("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: children !== null && children !== void 0 ? children : label })), suffix ? (jsxRuntime.jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
4100
+ }, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0, children: [prefix ? (jsxRuntime.jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxRuntime.jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [children !== null && children !== void 0 ? children : label, optionLabelDescription ? jsxRuntime.jsxs("span", { className: "text-secondary-400 ml-1", children: ["(", optionLabelDescription, ")"] }) : null] })), suffix ? (jsxRuntime.jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
4090
4101
  };
4091
4102
 
4092
4103
  /**
@@ -4170,17 +4181,25 @@ const cvaNoticeLabel = cssClassVarianceUtilities.cvaMerge(["pl-1", "pr-1", "font
4170
4181
  primary: "text-primary-600",
4171
4182
  secondary: "text-secondary-600",
4172
4183
  accent: "text-accent-600",
4173
- neutral: "text-neutral-600",
4184
+ neutral: "text-neutral-400",
4174
4185
  info: "text-info-600",
4175
4186
  success: "text-success-600",
4176
4187
  warning: "text-warning-600",
4177
4188
  danger: "text-danger-600",
4178
4189
  black: "text-black",
4179
4190
  white: "text-white",
4191
+ critical: "text-critical-500",
4192
+ low: "text-low-500",
4193
+ },
4194
+ size: {
4195
+ small: "text-xs",
4196
+ medium: "text-sm",
4197
+ large: "text-base",
4180
4198
  },
4181
4199
  },
4182
4200
  defaultVariants: {
4183
4201
  color: "neutral",
4202
+ size: "medium",
4184
4203
  },
4185
4204
  });
4186
4205
  const cvaNoticeIcon = cssClassVarianceUtilities.cvaMerge(["rounded-full", "items-center", "justify-center", "flex", "relative"], {
@@ -4189,13 +4208,15 @@ const cvaNoticeIcon = cssClassVarianceUtilities.cvaMerge(["rounded-full", "items
4189
4208
  primary: "text-primary-600",
4190
4209
  secondary: "text-secondary-600",
4191
4210
  accent: "text-accent-600",
4192
- neutral: "text-neutral-600",
4211
+ neutral: "text-neutral-300",
4193
4212
  info: "text-info-600",
4194
4213
  success: "text-success-600",
4195
4214
  warning: "text-warning-600",
4196
4215
  danger: "text-danger-600",
4197
4216
  black: "text-black",
4198
4217
  white: "text-white",
4218
+ critical: "text-critical-500",
4219
+ low: "text-low-500",
4199
4220
  },
4200
4221
  },
4201
4222
  defaultVariants: {
@@ -4213,8 +4234,8 @@ const cvaNoticeIcon = cssClassVarianceUtilities.cvaMerge(["rounded-full", "items
4213
4234
  * @param {NoticeProps} props - The props for the Notice component
4214
4235
  * @returns {JSX.Element} Notice component
4215
4236
  */
4216
- const Notice = ({ dataTestId, icon, label, color = "neutral", withLabel = true, className, tooltipLabel = label, withTooltip = false, ...rest }) => {
4217
- return (jsxRuntime.jsx(Tooltip, { className: className, disabled: !withTooltip, label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsxs("div", { "aria-label": label, className: cvaNotice(), "data-testid": dataTestId, ...rest, children: [jsxRuntime.jsx("div", { className: cvaNoticeIcon({ color }), "data-testid": dataTestId ? `${dataTestId}-icon` : "notice-icon", children: icon }), label !== undefined && withLabel ? (jsxRuntime.jsx("div", { className: cvaNoticeLabel({ color }), "data-testid": dataTestId ? `${dataTestId}-label` : "notice-label", children: label })) : null] }) }));
4237
+ const Notice = ({ dataTestId, icon, label, color = "neutral", withLabel = true, className, tooltipLabel = label, withTooltip = false, size = "medium", ...rest }) => {
4238
+ return (jsxRuntime.jsx(Tooltip, { className: className, disabled: !withTooltip, label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsxs("div", { "aria-label": label, className: cvaNotice(), "data-testid": dataTestId, ...rest, children: [jsxRuntime.jsx("div", { className: cvaNoticeIcon({ color }), "data-testid": dataTestId ? `${dataTestId}-icon` : "notice-icon", children: icon }), label !== undefined && withLabel ? (jsxRuntime.jsx("div", { className: cvaNoticeLabel({ color, size }), "data-testid": dataTestId ? `${dataTestId}-label` : "notice-label", children: label })) : null] }) }));
4218
4239
  };
4219
4240
 
4220
4241
  const cvaPage = cssClassVarianceUtilities.cvaMerge(["grid", "h-full"], {
@@ -4764,6 +4785,7 @@ const ToggleItem = ({ title, onClick, disabled = false, isIconOnly = false, icon
4764
4785
  const cvaValueBar = cssClassVarianceUtilities.cvaMerge(["w-full"], {
4765
4786
  variants: {
4766
4787
  size: {
4788
+ extraSmall: "h-1",
4767
4789
  small: "h-3",
4768
4790
  large: "h-9",
4769
4791
  },
@@ -4801,10 +4823,15 @@ const cvaValueBarText = cssClassVarianceUtilities.cvaMerge([], {
4801
4823
  * @param {number} value - value for which score should be returned
4802
4824
  * @param {number} min - min range value
4803
4825
  * @param {number} max - max range value
4826
+ * @param {boolean} zeroScoreAllowed - If true, allows the score to be exactly 0 when the value is less than or equal to the minimum.
4827
+ * If false or not provided, ensures a minimal score (0.01) is returned to always render a small fragment.
4804
4828
  * @returns {number} normalized score
4805
4829
  */
4806
- const getScore = (value, min, max) => {
4830
+ const getScore = (value, min, max, zeroScoreAllowed) => {
4807
4831
  if (value <= min) {
4832
+ if (zeroScoreAllowed) {
4833
+ return 0;
4834
+ }
4808
4835
  return 0.01; // always render at least some small fragment
4809
4836
  }
4810
4837
  if (value >= max) {
@@ -4864,15 +4891,15 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
4864
4891
  * @param {ValueBarProps} props - The props for the ValueBar component
4865
4892
  * @returns {JSX.Element} ValueBar component
4866
4893
  */
4867
- const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, }) => {
4868
- const score = getScore(value, min, max);
4894
+ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, zeroScoreAllowed, }) => {
4895
+ const score = getScore(value, min, max, zeroScoreAllowed);
4869
4896
  const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
4870
4897
  const barWidth = showValue && size === "small" ? 90 : 100;
4871
- return (jsxRuntime.jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, role: "img", children: jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("rect", { className: cvaValueBarProgress({ fill: "background" }), "data-testid": "value-bar-svg-rect-0", rx: "5", width: `${barWidth}%` }), jsxRuntime.jsx("rect", { className: cvaValueBarProgress(), "data-testid": "value-bar-svg-rect-1", fill: barFillColor, rx: "5", width: `${score * barWidth}%` }), showValue && size === "large" ? (jsxRuntime.jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor !== null && valueColor !== void 0 ? valueColor : "white", x: "12", y: "23", children: [Number(value.toFixed(1)), unit || ""] })) : null, showValue && size === "small" ? (jsxRuntime.jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor !== null && valueColor !== void 0 ? valueColor : uiDesignTokens.color("NEUTRAL", 400, "CSS"), x: `${barWidth + 2}%`, y: "11", children: [Number(value.toFixed(1)), unit || ""] })) : null] }) }));
4898
+ return (jsxRuntime.jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, role: "img", children: jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("rect", { className: cvaValueBarProgress({ fill: "background", className }), "data-testid": "value-bar-svg-rect-0", rx: size === "extraSmall" ? "2" : "5", width: `${barWidth}%` }), jsxRuntime.jsx("rect", { className: cvaValueBarProgress(), "data-testid": "value-bar-svg-rect-1", fill: barFillColor, rx: size === "extraSmall" ? "2" : "5", width: `${score * barWidth}%` }), showValue && size === "large" ? (jsxRuntime.jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor !== null && valueColor !== void 0 ? valueColor : "white", x: "12", y: "23", children: [Number(value.toFixed(1)), unit || ""] })) : null, showValue && size === "small" ? (jsxRuntime.jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor !== null && valueColor !== void 0 ? valueColor : uiDesignTokens.color("NEUTRAL", 400, "CSS"), x: `${barWidth + 2}%`, y: "11", children: [Number(value.toFixed(1)), unit || ""] })) : null] }) }));
4872
4899
  };
4873
4900
 
4874
4901
  const cvaVirtualizedListContainer = cssClassVarianceUtilities.cvaMerge(["h-full", "overflow-auto"]);
4875
- const cvaVirtualizedList = cssClassVarianceUtilities.cvaMerge(["relative", "m-1"]);
4902
+ const cvaVirtualizedList = cssClassVarianceUtilities.cvaMerge(["relative"]);
4876
4903
  const cvaVirtualizedListItem = cssClassVarianceUtilities.cvaMerge(["absolute", "top-0", "left-0", "w-full"], {
4877
4904
  variants: {
4878
4905
  separator: {
package/index.esm.js CHANGED
@@ -3700,7 +3700,18 @@ const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label
3700
3700
 
3701
3701
  const cvaIndicator = cvaMerge(["flex", "items-center"]);
3702
3702
  const cvaIndicatorIcon = cvaMerge(["mr-2"]);
3703
- const cvaIndicatorLabel = cvaMerge(["pl-2", "pr-2", "font-medium", "capitalize", "text-sm"]);
3703
+ const cvaIndicatorLabel = cvaMerge(["font-medium", "capitalize", "text-secondary-600"], {
3704
+ variants: {
3705
+ size: {
3706
+ small: "pl-1 pr-1 text-xs",
3707
+ medium: "pl-2 pr-2 text-sm",
3708
+ large: "pl-2 pr-2 text-base",
3709
+ },
3710
+ },
3711
+ defaultVariants: {
3712
+ size: "medium",
3713
+ },
3714
+ });
3704
3715
  const cvaIndicatorPing = cvaMerge(["animate-ping-sm", "absolute", "inline-flex", "h-full", "w-full", "rounded-full", "opacity-75", "bg-neutral-600"], {
3705
3716
  variants: {
3706
3717
  color: {
@@ -3796,8 +3807,8 @@ const cvaIndicatorIconBackground = cvaMerge(["rounded-full", "items-center", "ju
3796
3807
  * @param {IndicatorProps} props - The props for the Indicator component
3797
3808
  * @returns {JSX.Element} Indicator component
3798
3809
  */
3799
- const Indicator = ({ dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, className, ...rest }) => {
3800
- return (jsx(Tooltip, { className: className, disabled: withLabel, label: label, placement: "bottom", children: jsxs("div", { "aria-label": label, className: cvaIndicator(), "data-testid": dataTestId, ...rest, children: [jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping ? (jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" })) : null, icon] }), label !== undefined && withLabel ? (jsx("div", { className: cvaIndicatorLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label })) : null] }) }));
3810
+ const Indicator = ({ dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, size, className, ...rest }) => {
3811
+ return (jsx(Tooltip, { className: className, disabled: withLabel, label: label, placement: "bottom", children: jsxs("div", { "aria-label": label, className: cvaIndicator(), "data-testid": dataTestId, ...rest, children: [jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping ? (jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" })) : null, icon] }), label !== undefined && withLabel ? (jsx("div", { className: cvaIndicatorLabel({ size }), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label })) : null] }) }));
3801
3812
  };
3802
3813
 
3803
3814
  const cvaKPICardContainer = cvaMerge(["inline-flex"], {
@@ -4048,7 +4059,7 @@ const cvaMenuItemSuffix = cvaMerge(["text-secondary-400", "text-sm"], {
4048
4059
  * @param {MenuItemProps} props - The props for the MenuItem component
4049
4060
  * @returns {JSX.Element} MenuItem component
4050
4061
  */
4051
- const MenuItem = ({ className, dataTestId, label, size, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, variant = "primary", }) => {
4062
+ const MenuItem = ({ className, dataTestId, label, size, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, variant = "primary", }) => {
4052
4063
  /* Handle tab navigation */
4053
4064
  const handleKeyDown = (e) => {
4054
4065
  if (e.key === "Enter" && onClick && !disabled) {
@@ -4066,7 +4077,7 @@ const MenuItem = ({ className, dataTestId, label, size, children, selected, pref
4066
4077
  }), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
4067
4078
  stopPropagation && e.stopPropagation();
4068
4079
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
4069
- }, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0, children: [prefix ? (jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsx("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: children !== null && children !== void 0 ? children : label })), suffix ? (jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
4080
+ }, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0, children: [prefix ? (jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [children !== null && children !== void 0 ? children : label, optionLabelDescription ? jsxs("span", { className: "text-secondary-400 ml-1", children: ["(", optionLabelDescription, ")"] }) : null] })), suffix ? (jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
4070
4081
  };
4071
4082
 
4072
4083
  /**
@@ -4150,17 +4161,25 @@ const cvaNoticeLabel = cvaMerge(["pl-1", "pr-1", "font-medium", "text-sm"], {
4150
4161
  primary: "text-primary-600",
4151
4162
  secondary: "text-secondary-600",
4152
4163
  accent: "text-accent-600",
4153
- neutral: "text-neutral-600",
4164
+ neutral: "text-neutral-400",
4154
4165
  info: "text-info-600",
4155
4166
  success: "text-success-600",
4156
4167
  warning: "text-warning-600",
4157
4168
  danger: "text-danger-600",
4158
4169
  black: "text-black",
4159
4170
  white: "text-white",
4171
+ critical: "text-critical-500",
4172
+ low: "text-low-500",
4173
+ },
4174
+ size: {
4175
+ small: "text-xs",
4176
+ medium: "text-sm",
4177
+ large: "text-base",
4160
4178
  },
4161
4179
  },
4162
4180
  defaultVariants: {
4163
4181
  color: "neutral",
4182
+ size: "medium",
4164
4183
  },
4165
4184
  });
4166
4185
  const cvaNoticeIcon = cvaMerge(["rounded-full", "items-center", "justify-center", "flex", "relative"], {
@@ -4169,13 +4188,15 @@ const cvaNoticeIcon = cvaMerge(["rounded-full", "items-center", "justify-center"
4169
4188
  primary: "text-primary-600",
4170
4189
  secondary: "text-secondary-600",
4171
4190
  accent: "text-accent-600",
4172
- neutral: "text-neutral-600",
4191
+ neutral: "text-neutral-300",
4173
4192
  info: "text-info-600",
4174
4193
  success: "text-success-600",
4175
4194
  warning: "text-warning-600",
4176
4195
  danger: "text-danger-600",
4177
4196
  black: "text-black",
4178
4197
  white: "text-white",
4198
+ critical: "text-critical-500",
4199
+ low: "text-low-500",
4179
4200
  },
4180
4201
  },
4181
4202
  defaultVariants: {
@@ -4193,8 +4214,8 @@ const cvaNoticeIcon = cvaMerge(["rounded-full", "items-center", "justify-center"
4193
4214
  * @param {NoticeProps} props - The props for the Notice component
4194
4215
  * @returns {JSX.Element} Notice component
4195
4216
  */
4196
- const Notice = ({ dataTestId, icon, label, color = "neutral", withLabel = true, className, tooltipLabel = label, withTooltip = false, ...rest }) => {
4197
- return (jsx(Tooltip, { className: className, disabled: !withTooltip, label: tooltipLabel, placement: "bottom", children: jsxs("div", { "aria-label": label, className: cvaNotice(), "data-testid": dataTestId, ...rest, children: [jsx("div", { className: cvaNoticeIcon({ color }), "data-testid": dataTestId ? `${dataTestId}-icon` : "notice-icon", children: icon }), label !== undefined && withLabel ? (jsx("div", { className: cvaNoticeLabel({ color }), "data-testid": dataTestId ? `${dataTestId}-label` : "notice-label", children: label })) : null] }) }));
4217
+ const Notice = ({ dataTestId, icon, label, color = "neutral", withLabel = true, className, tooltipLabel = label, withTooltip = false, size = "medium", ...rest }) => {
4218
+ return (jsx(Tooltip, { className: className, disabled: !withTooltip, label: tooltipLabel, placement: "bottom", children: jsxs("div", { "aria-label": label, className: cvaNotice(), "data-testid": dataTestId, ...rest, children: [jsx("div", { className: cvaNoticeIcon({ color }), "data-testid": dataTestId ? `${dataTestId}-icon` : "notice-icon", children: icon }), label !== undefined && withLabel ? (jsx("div", { className: cvaNoticeLabel({ color, size }), "data-testid": dataTestId ? `${dataTestId}-label` : "notice-label", children: label })) : null] }) }));
4198
4219
  };
4199
4220
 
4200
4221
  const cvaPage = cvaMerge(["grid", "h-full"], {
@@ -4744,6 +4765,7 @@ const ToggleItem = ({ title, onClick, disabled = false, isIconOnly = false, icon
4744
4765
  const cvaValueBar = cvaMerge(["w-full"], {
4745
4766
  variants: {
4746
4767
  size: {
4768
+ extraSmall: "h-1",
4747
4769
  small: "h-3",
4748
4770
  large: "h-9",
4749
4771
  },
@@ -4781,10 +4803,15 @@ const cvaValueBarText = cvaMerge([], {
4781
4803
  * @param {number} value - value for which score should be returned
4782
4804
  * @param {number} min - min range value
4783
4805
  * @param {number} max - max range value
4806
+ * @param {boolean} zeroScoreAllowed - If true, allows the score to be exactly 0 when the value is less than or equal to the minimum.
4807
+ * If false or not provided, ensures a minimal score (0.01) is returned to always render a small fragment.
4784
4808
  * @returns {number} normalized score
4785
4809
  */
4786
- const getScore = (value, min, max) => {
4810
+ const getScore = (value, min, max, zeroScoreAllowed) => {
4787
4811
  if (value <= min) {
4812
+ if (zeroScoreAllowed) {
4813
+ return 0;
4814
+ }
4788
4815
  return 0.01; // always render at least some small fragment
4789
4816
  }
4790
4817
  if (value >= max) {
@@ -4844,15 +4871,15 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
4844
4871
  * @param {ValueBarProps} props - The props for the ValueBar component
4845
4872
  * @returns {JSX.Element} ValueBar component
4846
4873
  */
4847
- const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, }) => {
4848
- const score = getScore(value, min, max);
4874
+ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, zeroScoreAllowed, }) => {
4875
+ const score = getScore(value, min, max, zeroScoreAllowed);
4849
4876
  const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
4850
4877
  const barWidth = showValue && size === "small" ? 90 : 100;
4851
- return (jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, role: "img", children: jsxs("g", { children: [jsx("rect", { className: cvaValueBarProgress({ fill: "background" }), "data-testid": "value-bar-svg-rect-0", rx: "5", width: `${barWidth}%` }), jsx("rect", { className: cvaValueBarProgress(), "data-testid": "value-bar-svg-rect-1", fill: barFillColor, rx: "5", width: `${score * barWidth}%` }), showValue && size === "large" ? (jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor !== null && valueColor !== void 0 ? valueColor : "white", x: "12", y: "23", children: [Number(value.toFixed(1)), unit || ""] })) : null, showValue && size === "small" ? (jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor !== null && valueColor !== void 0 ? valueColor : color("NEUTRAL", 400, "CSS"), x: `${barWidth + 2}%`, y: "11", children: [Number(value.toFixed(1)), unit || ""] })) : null] }) }));
4878
+ return (jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, role: "img", children: jsxs("g", { children: [jsx("rect", { className: cvaValueBarProgress({ fill: "background", className }), "data-testid": "value-bar-svg-rect-0", rx: size === "extraSmall" ? "2" : "5", width: `${barWidth}%` }), jsx("rect", { className: cvaValueBarProgress(), "data-testid": "value-bar-svg-rect-1", fill: barFillColor, rx: size === "extraSmall" ? "2" : "5", width: `${score * barWidth}%` }), showValue && size === "large" ? (jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor !== null && valueColor !== void 0 ? valueColor : "white", x: "12", y: "23", children: [Number(value.toFixed(1)), unit || ""] })) : null, showValue && size === "small" ? (jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor !== null && valueColor !== void 0 ? valueColor : color("NEUTRAL", 400, "CSS"), x: `${barWidth + 2}%`, y: "11", children: [Number(value.toFixed(1)), unit || ""] })) : null] }) }));
4852
4879
  };
4853
4880
 
4854
4881
  const cvaVirtualizedListContainer = cvaMerge(["h-full", "overflow-auto"]);
4855
- const cvaVirtualizedList = cvaMerge(["relative", "m-1"]);
4882
+ const cvaVirtualizedList = cvaMerge(["relative"]);
4856
4883
  const cvaVirtualizedListItem = cvaMerge(["absolute", "top-0", "left-0", "w-full"], {
4857
4884
  variants: {
4858
4885
  separator: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.5.23",
3
+ "version": "0.5.25",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,6 +9,10 @@ export interface IndicatorProps extends CommonProps {
9
9
  * A color token used to style the icon and the icon background
10
10
  */
11
11
  color?: GeneralColors | IntentColors | CriticalityColors | ActivityColors | UtilizationColors | RentalStatusColors | SitesColors;
12
+ /**
13
+ * The size of the label's text
14
+ */
15
+ size?: "small" | "medium" | "large";
12
16
  /**
13
17
  * A text label to be displayed next to the indicator
14
18
  */
@@ -38,4 +42,4 @@ export interface IndicatorProps extends CommonProps {
38
42
  * @param {IndicatorProps} props - The props for the Indicator component
39
43
  * @returns {JSX.Element} Indicator component
40
44
  */
41
- export declare const Indicator: ({ dataTestId, icon, label, color, withBackground, withLabel, ping, className, ...rest }: IndicatorProps) => JSX.Element;
45
+ export declare const Indicator: ({ dataTestId, icon, label, color, withBackground, withLabel, ping, size, className, ...rest }: IndicatorProps) => JSX.Element;
@@ -1,6 +1,8 @@
1
1
  export declare const cvaIndicator: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
2
  export declare const cvaIndicatorIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
3
- export declare const cvaIndicatorLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
3
+ export declare const cvaIndicatorLabel: (props?: ({
4
+ size?: "small" | "medium" | "large" | null | undefined;
5
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
6
  export declare const cvaIndicatorPing: (props?: ({
5
7
  color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "stopped" | "moving" | "active" | "unknown" | "unused" | "utilized" | "heavily_utilized" | "unknown_utilization" | "available" | "on_rent" | "pickup_ready" | "transfer" | "in_repair" | "returned" | "other_rental_status" | "site" | "white" | "black" | null | undefined;
6
8
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -62,6 +62,10 @@ export interface MenuItemProps extends CommonProps {
62
62
  * The button's variant. Values are primary and danger.
63
63
  */
64
64
  variant?: MenuItemVariant;
65
+ /**
66
+ * Adds a suffixed description to the label, ie. (CustomerID 1234)
67
+ */
68
+ optionLabelDescription?: string;
65
69
  }
66
70
  /**
67
71
  * The MenuItem component is used to display a menu, primarily meant to be used in a list form.
@@ -69,5 +73,5 @@ export interface MenuItemProps extends CommonProps {
69
73
  * @param {MenuItemProps} props - The props for the MenuItem component
70
74
  * @returns {JSX.Element} MenuItem component
71
75
  */
72
- export declare const MenuItem: ({ className, dataTestId, label, size, children, selected, prefix, suffix, disabled, onClick, stopPropagation, id, tabIndex, variant, }: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
76
+ export declare const MenuItem: ({ className, dataTestId, label, size, children, selected, prefix, suffix, disabled, onClick, stopPropagation, id, tabIndex, optionLabelDescription, variant, }: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
73
77
  export {};
@@ -1,4 +1,4 @@
1
- import { GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
1
+ import { CriticalityColors, GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
3
  export interface NoticeProps extends CommonProps {
4
4
  /**
@@ -8,7 +8,11 @@ export interface NoticeProps extends CommonProps {
8
8
  /**
9
9
  * A color token used to style the icon and the icon background
10
10
  */
11
- color?: GeneralColors | IntentColors;
11
+ color?: Exclude<GeneralColors | IntentColors | CriticalityColors, "good">;
12
+ /**
13
+ * The size of the label's text
14
+ */
15
+ size?: "small" | "medium" | "large";
12
16
  /**
13
17
  * A text label to be displayed next to the icon
14
18
  */
@@ -36,4 +40,4 @@ export interface NoticeProps extends CommonProps {
36
40
  * @param {NoticeProps} props - The props for the Notice component
37
41
  * @returns {JSX.Element} Notice component
38
42
  */
39
- export declare const Notice: ({ dataTestId, icon, label, color, withLabel, className, tooltipLabel, withTooltip, ...rest }: NoticeProps) => JSX.Element;
43
+ export declare const Notice: ({ dataTestId, icon, label, color, withLabel, className, tooltipLabel, withTooltip, size, ...rest }: NoticeProps) => JSX.Element;
@@ -1,7 +1,8 @@
1
1
  export declare const cvaNotice: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
2
  export declare const cvaNoticeLabel: (props?: ({
3
- color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "black" | "white" | null | undefined;
3
+ color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "black" | "white" | "critical" | "low" | null | undefined;
4
+ size?: "small" | "medium" | "large" | null | undefined;
4
5
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
6
  export declare const cvaNoticeIcon: (props?: ({
6
- color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "black" | "white" | null | undefined;
7
+ color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "black" | "white" | "critical" | "low" | null | undefined;
7
8
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,6 +1,6 @@
1
1
  import { CommonProps, Size } from "../../common";
2
2
  import { LevelColors } from "./ValueBarTypes";
3
- type ValueBarSize = Extract<Size, "small" | "large">;
3
+ type ValueBarSize = Extract<Size, "small" | "large"> | "extraSmall";
4
4
  export interface ValueBarProps extends CommonProps {
5
5
  /**
6
6
  * Value to display.
@@ -34,6 +34,12 @@ export interface ValueBarProps extends CommonProps {
34
34
  * Show value with unit (if provided) on the bar in large version or after the bar in the small version.
35
35
  */
36
36
  showValue?: boolean;
37
+ /**
38
+ * Allows the score of the value bar to be exactly 0 when the value is less than or equal to the minimum.
39
+ * If not provided or set to false, ensures a minimal score (0.01)
40
+ * is returned to always render a small fragment of the bar.
41
+ */
42
+ zeroScoreAllowed?: boolean;
37
43
  }
38
44
  /**
39
45
  * ValueBar component is used to display value on a colorful bar within provided range.
@@ -41,5 +47,5 @@ export interface ValueBarProps extends CommonProps {
41
47
  * @param {ValueBarProps} props - The props for the ValueBar component
42
48
  * @returns {JSX.Element} ValueBar component
43
49
  */
44
- export declare const ValueBar: ({ value, min, max, unit, size, levelColors, valueColor, showValue, className, dataTestId, }: ValueBarProps) => import("react/jsx-runtime").JSX.Element;
50
+ export declare const ValueBar: ({ value, min, max, unit, size, levelColors, valueColor, showValue, className, dataTestId, zeroScoreAllowed, }: ValueBarProps) => import("react/jsx-runtime").JSX.Element;
45
51
  export {};
@@ -1,5 +1,5 @@
1
1
  export declare const cvaValueBar: (props?: ({
2
- size?: "small" | "large" | null | undefined;
2
+ size?: "extraSmall" | "small" | "large" | null | undefined;
3
3
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
4
  export declare const cvaValueBarProgress: (props?: ({
5
5
  fill?: "default" | "background" | null | undefined;
@@ -5,9 +5,11 @@ import { LevelColors } from "./ValueBarTypes";
5
5
  * @param {number} value - value for which score should be returned
6
6
  * @param {number} min - min range value
7
7
  * @param {number} max - max range value
8
+ * @param {boolean} zeroScoreAllowed - If true, allows the score to be exactly 0 when the value is less than or equal to the minimum.
9
+ * If false or not provided, ensures a minimal score (0.01) is returned to always render a small fragment.
8
10
  * @returns {number} normalized score
9
11
  */
10
- export declare const getScore: (value: number, min: number, max: number) => number;
12
+ export declare const getScore: (value: number, min: number, max: number, zeroScoreAllowed?: boolean) => number;
11
13
  /**
12
14
  * Helper function to get default color used by the ValueBar
13
15