@trackunit/react-components 0.5.24 → 0.5.26
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 +47 -25
- package/index.esm.js +47 -25
- package/package.json +1 -1
- package/src/components/Indicator/Indicator.d.ts +5 -1
- package/src/components/Indicator/Indicator.variants.d.ts +3 -1
- package/src/components/Menu/MenuItem/MenuItem.d.ts +2 -8
- package/src/components/Menu/MenuItem/MenuItem.variants.d.ts +0 -2
- package/src/components/Notice/Notice.d.ts +7 -3
- package/src/components/Notice/Notice.variants.d.ts +3 -2
- package/src/components/ValueBar/ValueBar.d.ts +8 -2
- package/src/components/ValueBar/ValueBar.variants.d.ts +1 -1
- package/src/components/ValueBar/ValueBarHelper.d.ts +3 -1
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(["
|
|
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"], {
|
|
@@ -3897,7 +3908,7 @@ const cvaMenuList = cssClassVarianceUtilities.cvaMerge([
|
|
|
3897
3908
|
});
|
|
3898
3909
|
const cvaMenuListDivider = cssClassVarianceUtilities.cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
|
|
3899
3910
|
const cvaMenuListMultiSelect = cssClassVarianceUtilities.cvaMerge("hover:!bg-blue-200");
|
|
3900
|
-
const cvaMenuListItem = cssClassVarianceUtilities.cvaMerge("max-w-[
|
|
3911
|
+
const cvaMenuListItem = cssClassVarianceUtilities.cvaMerge("max-w-[292px]");
|
|
3901
3912
|
|
|
3902
3913
|
/**
|
|
3903
3914
|
* The MenuDivider component is used to separate items in a menu list.
|
|
@@ -3963,15 +3974,11 @@ const cvaInteractableItem = cssClassVarianceUtilities.cvaMerge("", {
|
|
|
3963
3974
|
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
3964
3975
|
*/
|
|
3965
3976
|
const cvaMenuItem = (props) => {
|
|
3966
|
-
const {
|
|
3967
|
-
return tailwindMerge.twMerge(cvaMenuItemStyle({
|
|
3977
|
+
const { selected, disabled, focused, className, variant } = props !== null && props !== void 0 ? props : {};
|
|
3978
|
+
return tailwindMerge.twMerge(cvaMenuItemStyle({ variant, selected, disabled }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
|
|
3968
3979
|
};
|
|
3969
3980
|
const cvaMenuItemStyle = cssClassVarianceUtilities.cvaMerge(["py-2", "px-2", "h-auto", "flex", "flex-row", "items-center", "gap-x-2", "select-none", "rounded", "text-sm"], {
|
|
3970
3981
|
variants: {
|
|
3971
|
-
size: {
|
|
3972
|
-
small: "py-1",
|
|
3973
|
-
medium: "py-2",
|
|
3974
|
-
},
|
|
3975
3982
|
variant: {
|
|
3976
3983
|
primary: [],
|
|
3977
3984
|
danger: [
|
|
@@ -4068,7 +4075,7 @@ const cvaMenuItemSuffix = cssClassVarianceUtilities.cvaMerge(["text-secondary-40
|
|
|
4068
4075
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
4069
4076
|
* @returns {JSX.Element} MenuItem component
|
|
4070
4077
|
*/
|
|
4071
|
-
const MenuItem = ({ className, dataTestId, label,
|
|
4078
|
+
const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, variant = "primary", }) => {
|
|
4072
4079
|
/* Handle tab navigation */
|
|
4073
4080
|
const handleKeyDown = (e) => {
|
|
4074
4081
|
if (e.key === "Enter" && onClick && !disabled) {
|
|
@@ -4080,7 +4087,6 @@ const MenuItem = ({ className, dataTestId, label, size, children, selected, pref
|
|
|
4080
4087
|
return (jsxRuntime.jsxs("div", { "aria-disabled": disabled, className: cvaMenuItem({
|
|
4081
4088
|
selected,
|
|
4082
4089
|
disabled,
|
|
4083
|
-
size,
|
|
4084
4090
|
className,
|
|
4085
4091
|
variant,
|
|
4086
4092
|
}), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
|
|
@@ -4135,7 +4141,7 @@ const MenuList = ({ dataTestId, className, children, withStickyHeader = false, i
|
|
|
4135
4141
|
? cvaMenuListMultiSelect({ className: menuItem.props.className })
|
|
4136
4142
|
: cvaMenuListItem({ className: menuItem.props.className }),
|
|
4137
4143
|
selected: isSelected,
|
|
4138
|
-
suffix: isMulti && isSelected ?
|
|
4144
|
+
suffix: isMulti && isSelected ? jsxRuntime.jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : null,
|
|
4139
4145
|
}) }, index));
|
|
4140
4146
|
}
|
|
4141
4147
|
return null;
|
|
@@ -4153,14 +4159,15 @@ const cvaMoreMenu = cssClassVarianceUtilities.cvaMerge(["p-0"]);
|
|
|
4153
4159
|
*/
|
|
4154
4160
|
const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
|
|
4155
4161
|
size: "medium",
|
|
4162
|
+
className: "text-secondary-800",
|
|
4156
4163
|
}, iconButtonProps = {
|
|
4157
|
-
size: "
|
|
4164
|
+
size: "medium",
|
|
4158
4165
|
circular: false,
|
|
4159
4166
|
square: true,
|
|
4160
4167
|
variant: "secondary",
|
|
4161
4168
|
}, customButton, customPortalId, children, }) => {
|
|
4162
4169
|
const actionMenuRef = React.useRef(null);
|
|
4163
|
-
return (jsxRuntime.jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId, ref: actionMenuRef, children: jsxRuntime.jsxs(Popover, { placement: "bottom-end", ...popoverProps, children: [jsxRuntime.jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : (jsxRuntime.jsx(IconButton, { dataTestId: "more-menu-icon", ...iconButtonProps, icon: jsxRuntime.jsx(Icon, { name: "EllipsisHorizontal", ...iconProps }) })) }), jsxRuntime.jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] }) }));
|
|
4170
|
+
return (jsxRuntime.jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId ? dataTestId : "more-menu", ref: actionMenuRef, children: jsxRuntime.jsxs(Popover, { placement: "bottom-end", ...popoverProps, children: [jsxRuntime.jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : (jsxRuntime.jsx(IconButton, { dataTestId: "more-menu-icon", ...iconButtonProps, icon: jsxRuntime.jsx(Icon, { name: "EllipsisHorizontal", ...iconProps }) })) }), jsxRuntime.jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] }) }));
|
|
4164
4171
|
};
|
|
4165
4172
|
|
|
4166
4173
|
const cvaNotice = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
@@ -4170,17 +4177,25 @@ const cvaNoticeLabel = cssClassVarianceUtilities.cvaMerge(["pl-1", "pr-1", "font
|
|
|
4170
4177
|
primary: "text-primary-600",
|
|
4171
4178
|
secondary: "text-secondary-600",
|
|
4172
4179
|
accent: "text-accent-600",
|
|
4173
|
-
neutral: "text-neutral-
|
|
4180
|
+
neutral: "text-neutral-400",
|
|
4174
4181
|
info: "text-info-600",
|
|
4175
4182
|
success: "text-success-600",
|
|
4176
4183
|
warning: "text-warning-600",
|
|
4177
4184
|
danger: "text-danger-600",
|
|
4178
4185
|
black: "text-black",
|
|
4179
4186
|
white: "text-white",
|
|
4187
|
+
critical: "text-critical-500",
|
|
4188
|
+
low: "text-low-500",
|
|
4189
|
+
},
|
|
4190
|
+
size: {
|
|
4191
|
+
small: "text-xs",
|
|
4192
|
+
medium: "text-sm",
|
|
4193
|
+
large: "text-base",
|
|
4180
4194
|
},
|
|
4181
4195
|
},
|
|
4182
4196
|
defaultVariants: {
|
|
4183
4197
|
color: "neutral",
|
|
4198
|
+
size: "medium",
|
|
4184
4199
|
},
|
|
4185
4200
|
});
|
|
4186
4201
|
const cvaNoticeIcon = cssClassVarianceUtilities.cvaMerge(["rounded-full", "items-center", "justify-center", "flex", "relative"], {
|
|
@@ -4189,13 +4204,15 @@ const cvaNoticeIcon = cssClassVarianceUtilities.cvaMerge(["rounded-full", "items
|
|
|
4189
4204
|
primary: "text-primary-600",
|
|
4190
4205
|
secondary: "text-secondary-600",
|
|
4191
4206
|
accent: "text-accent-600",
|
|
4192
|
-
neutral: "text-neutral-
|
|
4207
|
+
neutral: "text-neutral-300",
|
|
4193
4208
|
info: "text-info-600",
|
|
4194
4209
|
success: "text-success-600",
|
|
4195
4210
|
warning: "text-warning-600",
|
|
4196
4211
|
danger: "text-danger-600",
|
|
4197
4212
|
black: "text-black",
|
|
4198
4213
|
white: "text-white",
|
|
4214
|
+
critical: "text-critical-500",
|
|
4215
|
+
low: "text-low-500",
|
|
4199
4216
|
},
|
|
4200
4217
|
},
|
|
4201
4218
|
defaultVariants: {
|
|
@@ -4213,8 +4230,8 @@ const cvaNoticeIcon = cssClassVarianceUtilities.cvaMerge(["rounded-full", "items
|
|
|
4213
4230
|
* @param {NoticeProps} props - The props for the Notice component
|
|
4214
4231
|
* @returns {JSX.Element} Notice component
|
|
4215
4232
|
*/
|
|
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] }) }));
|
|
4233
|
+
const Notice = ({ dataTestId, icon, label, color = "neutral", withLabel = true, className, tooltipLabel = label, withTooltip = false, size = "medium", ...rest }) => {
|
|
4234
|
+
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
4235
|
};
|
|
4219
4236
|
|
|
4220
4237
|
const cvaPage = cssClassVarianceUtilities.cvaMerge(["grid", "h-full"], {
|
|
@@ -4574,7 +4591,6 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
4574
4591
|
className: tailwindMerge.twMerge(child.props.className, itemVisibilityClassName(child.props.id)),
|
|
4575
4592
|
});
|
|
4576
4593
|
}) }), overflowItemCount > 0 ? (jsxRuntime.jsx(MoreMenu, { iconButtonProps: {
|
|
4577
|
-
circular: false,
|
|
4578
4594
|
variant: "ghost-neutral",
|
|
4579
4595
|
}, ...moreMenuProps, className: moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className, dataTestId: dataTestId ? `${dataTestId}-more-menu` : undefined, children: close => (jsxRuntime.jsx(MenuList, { ...menuListProps, dataTestId: dataTestId, children: React.Children.map(children, child => {
|
|
4580
4596
|
return itemOverflowMap[child.props.id]
|
|
@@ -4764,6 +4780,7 @@ const ToggleItem = ({ title, onClick, disabled = false, isIconOnly = false, icon
|
|
|
4764
4780
|
const cvaValueBar = cssClassVarianceUtilities.cvaMerge(["w-full"], {
|
|
4765
4781
|
variants: {
|
|
4766
4782
|
size: {
|
|
4783
|
+
extraSmall: "h-1",
|
|
4767
4784
|
small: "h-3",
|
|
4768
4785
|
large: "h-9",
|
|
4769
4786
|
},
|
|
@@ -4801,10 +4818,15 @@ const cvaValueBarText = cssClassVarianceUtilities.cvaMerge([], {
|
|
|
4801
4818
|
* @param {number} value - value for which score should be returned
|
|
4802
4819
|
* @param {number} min - min range value
|
|
4803
4820
|
* @param {number} max - max range value
|
|
4821
|
+
* @param {boolean} zeroScoreAllowed - If true, allows the score to be exactly 0 when the value is less than or equal to the minimum.
|
|
4822
|
+
* If false or not provided, ensures a minimal score (0.01) is returned to always render a small fragment.
|
|
4804
4823
|
* @returns {number} normalized score
|
|
4805
4824
|
*/
|
|
4806
|
-
const getScore = (value, min, max) => {
|
|
4825
|
+
const getScore = (value, min, max, zeroScoreAllowed) => {
|
|
4807
4826
|
if (value <= min) {
|
|
4827
|
+
if (zeroScoreAllowed) {
|
|
4828
|
+
return 0;
|
|
4829
|
+
}
|
|
4808
4830
|
return 0.01; // always render at least some small fragment
|
|
4809
4831
|
}
|
|
4810
4832
|
if (value >= max) {
|
|
@@ -4864,15 +4886,15 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
|
|
|
4864
4886
|
* @param {ValueBarProps} props - The props for the ValueBar component
|
|
4865
4887
|
* @returns {JSX.Element} ValueBar component
|
|
4866
4888
|
*/
|
|
4867
|
-
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, }) => {
|
|
4868
|
-
const score = getScore(value, min, max);
|
|
4889
|
+
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, zeroScoreAllowed, }) => {
|
|
4890
|
+
const score = getScore(value, min, max, zeroScoreAllowed);
|
|
4869
4891
|
const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
|
|
4870
4892
|
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] }) }));
|
|
4893
|
+
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
4894
|
};
|
|
4873
4895
|
|
|
4874
4896
|
const cvaVirtualizedListContainer = cssClassVarianceUtilities.cvaMerge(["h-full", "overflow-auto"]);
|
|
4875
|
-
const cvaVirtualizedList = cssClassVarianceUtilities.cvaMerge(["relative"
|
|
4897
|
+
const cvaVirtualizedList = cssClassVarianceUtilities.cvaMerge(["relative"]);
|
|
4876
4898
|
const cvaVirtualizedListItem = cssClassVarianceUtilities.cvaMerge(["absolute", "top-0", "left-0", "w-full"], {
|
|
4877
4899
|
variants: {
|
|
4878
4900
|
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(["
|
|
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"], {
|
|
@@ -3877,7 +3888,7 @@ const cvaMenuList = cvaMerge([
|
|
|
3877
3888
|
});
|
|
3878
3889
|
const cvaMenuListDivider = cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
|
|
3879
3890
|
const cvaMenuListMultiSelect = cvaMerge("hover:!bg-blue-200");
|
|
3880
|
-
const cvaMenuListItem = cvaMerge("max-w-[
|
|
3891
|
+
const cvaMenuListItem = cvaMerge("max-w-[292px]");
|
|
3881
3892
|
|
|
3882
3893
|
/**
|
|
3883
3894
|
* The MenuDivider component is used to separate items in a menu list.
|
|
@@ -3943,15 +3954,11 @@ const cvaInteractableItem = cvaMerge("", {
|
|
|
3943
3954
|
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
3944
3955
|
*/
|
|
3945
3956
|
const cvaMenuItem = (props) => {
|
|
3946
|
-
const {
|
|
3947
|
-
return twMerge(cvaMenuItemStyle({
|
|
3957
|
+
const { selected, disabled, focused, className, variant } = props !== null && props !== void 0 ? props : {};
|
|
3958
|
+
return twMerge(cvaMenuItemStyle({ variant, selected, disabled }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
|
|
3948
3959
|
};
|
|
3949
3960
|
const cvaMenuItemStyle = cvaMerge(["py-2", "px-2", "h-auto", "flex", "flex-row", "items-center", "gap-x-2", "select-none", "rounded", "text-sm"], {
|
|
3950
3961
|
variants: {
|
|
3951
|
-
size: {
|
|
3952
|
-
small: "py-1",
|
|
3953
|
-
medium: "py-2",
|
|
3954
|
-
},
|
|
3955
3962
|
variant: {
|
|
3956
3963
|
primary: [],
|
|
3957
3964
|
danger: [
|
|
@@ -4048,7 +4055,7 @@ const cvaMenuItemSuffix = cvaMerge(["text-secondary-400", "text-sm"], {
|
|
|
4048
4055
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
4049
4056
|
* @returns {JSX.Element} MenuItem component
|
|
4050
4057
|
*/
|
|
4051
|
-
const MenuItem = ({ className, dataTestId, label,
|
|
4058
|
+
const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, variant = "primary", }) => {
|
|
4052
4059
|
/* Handle tab navigation */
|
|
4053
4060
|
const handleKeyDown = (e) => {
|
|
4054
4061
|
if (e.key === "Enter" && onClick && !disabled) {
|
|
@@ -4060,7 +4067,6 @@ const MenuItem = ({ className, dataTestId, label, size, children, selected, pref
|
|
|
4060
4067
|
return (jsxs("div", { "aria-disabled": disabled, className: cvaMenuItem({
|
|
4061
4068
|
selected,
|
|
4062
4069
|
disabled,
|
|
4063
|
-
size,
|
|
4064
4070
|
className,
|
|
4065
4071
|
variant,
|
|
4066
4072
|
}), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
|
|
@@ -4115,7 +4121,7 @@ const MenuList = ({ dataTestId, className, children, withStickyHeader = false, i
|
|
|
4115
4121
|
? cvaMenuListMultiSelect({ className: menuItem.props.className })
|
|
4116
4122
|
: cvaMenuListItem({ className: menuItem.props.className }),
|
|
4117
4123
|
selected: isSelected,
|
|
4118
|
-
suffix: isMulti && isSelected ?
|
|
4124
|
+
suffix: isMulti && isSelected ? jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : null,
|
|
4119
4125
|
}) }, index));
|
|
4120
4126
|
}
|
|
4121
4127
|
return null;
|
|
@@ -4133,14 +4139,15 @@ const cvaMoreMenu = cvaMerge(["p-0"]);
|
|
|
4133
4139
|
*/
|
|
4134
4140
|
const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
|
|
4135
4141
|
size: "medium",
|
|
4142
|
+
className: "text-secondary-800",
|
|
4136
4143
|
}, iconButtonProps = {
|
|
4137
|
-
size: "
|
|
4144
|
+
size: "medium",
|
|
4138
4145
|
circular: false,
|
|
4139
4146
|
square: true,
|
|
4140
4147
|
variant: "secondary",
|
|
4141
4148
|
}, customButton, customPortalId, children, }) => {
|
|
4142
4149
|
const actionMenuRef = useRef(null);
|
|
4143
|
-
return (jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId, ref: actionMenuRef, children: jsxs(Popover, { placement: "bottom-end", ...popoverProps, children: [jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : (jsx(IconButton, { dataTestId: "more-menu-icon", ...iconButtonProps, icon: jsx(Icon, { name: "EllipsisHorizontal", ...iconProps }) })) }), jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] }) }));
|
|
4150
|
+
return (jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId ? dataTestId : "more-menu", ref: actionMenuRef, children: jsxs(Popover, { placement: "bottom-end", ...popoverProps, children: [jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : (jsx(IconButton, { dataTestId: "more-menu-icon", ...iconButtonProps, icon: jsx(Icon, { name: "EllipsisHorizontal", ...iconProps }) })) }), jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] }) }));
|
|
4144
4151
|
};
|
|
4145
4152
|
|
|
4146
4153
|
const cvaNotice = cvaMerge(["flex", "items-center"]);
|
|
@@ -4150,17 +4157,25 @@ const cvaNoticeLabel = cvaMerge(["pl-1", "pr-1", "font-medium", "text-sm"], {
|
|
|
4150
4157
|
primary: "text-primary-600",
|
|
4151
4158
|
secondary: "text-secondary-600",
|
|
4152
4159
|
accent: "text-accent-600",
|
|
4153
|
-
neutral: "text-neutral-
|
|
4160
|
+
neutral: "text-neutral-400",
|
|
4154
4161
|
info: "text-info-600",
|
|
4155
4162
|
success: "text-success-600",
|
|
4156
4163
|
warning: "text-warning-600",
|
|
4157
4164
|
danger: "text-danger-600",
|
|
4158
4165
|
black: "text-black",
|
|
4159
4166
|
white: "text-white",
|
|
4167
|
+
critical: "text-critical-500",
|
|
4168
|
+
low: "text-low-500",
|
|
4169
|
+
},
|
|
4170
|
+
size: {
|
|
4171
|
+
small: "text-xs",
|
|
4172
|
+
medium: "text-sm",
|
|
4173
|
+
large: "text-base",
|
|
4160
4174
|
},
|
|
4161
4175
|
},
|
|
4162
4176
|
defaultVariants: {
|
|
4163
4177
|
color: "neutral",
|
|
4178
|
+
size: "medium",
|
|
4164
4179
|
},
|
|
4165
4180
|
});
|
|
4166
4181
|
const cvaNoticeIcon = cvaMerge(["rounded-full", "items-center", "justify-center", "flex", "relative"], {
|
|
@@ -4169,13 +4184,15 @@ const cvaNoticeIcon = cvaMerge(["rounded-full", "items-center", "justify-center"
|
|
|
4169
4184
|
primary: "text-primary-600",
|
|
4170
4185
|
secondary: "text-secondary-600",
|
|
4171
4186
|
accent: "text-accent-600",
|
|
4172
|
-
neutral: "text-neutral-
|
|
4187
|
+
neutral: "text-neutral-300",
|
|
4173
4188
|
info: "text-info-600",
|
|
4174
4189
|
success: "text-success-600",
|
|
4175
4190
|
warning: "text-warning-600",
|
|
4176
4191
|
danger: "text-danger-600",
|
|
4177
4192
|
black: "text-black",
|
|
4178
4193
|
white: "text-white",
|
|
4194
|
+
critical: "text-critical-500",
|
|
4195
|
+
low: "text-low-500",
|
|
4179
4196
|
},
|
|
4180
4197
|
},
|
|
4181
4198
|
defaultVariants: {
|
|
@@ -4193,8 +4210,8 @@ const cvaNoticeIcon = cvaMerge(["rounded-full", "items-center", "justify-center"
|
|
|
4193
4210
|
* @param {NoticeProps} props - The props for the Notice component
|
|
4194
4211
|
* @returns {JSX.Element} Notice component
|
|
4195
4212
|
*/
|
|
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] }) }));
|
|
4213
|
+
const Notice = ({ dataTestId, icon, label, color = "neutral", withLabel = true, className, tooltipLabel = label, withTooltip = false, size = "medium", ...rest }) => {
|
|
4214
|
+
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
4215
|
};
|
|
4199
4216
|
|
|
4200
4217
|
const cvaPage = cvaMerge(["grid", "h-full"], {
|
|
@@ -4554,7 +4571,6 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
4554
4571
|
className: twMerge(child.props.className, itemVisibilityClassName(child.props.id)),
|
|
4555
4572
|
});
|
|
4556
4573
|
}) }), overflowItemCount > 0 ? (jsx(MoreMenu, { iconButtonProps: {
|
|
4557
|
-
circular: false,
|
|
4558
4574
|
variant: "ghost-neutral",
|
|
4559
4575
|
}, ...moreMenuProps, className: moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className, dataTestId: dataTestId ? `${dataTestId}-more-menu` : undefined, children: close => (jsx(MenuList, { ...menuListProps, dataTestId: dataTestId, children: React__default.Children.map(children, child => {
|
|
4560
4576
|
return itemOverflowMap[child.props.id]
|
|
@@ -4744,6 +4760,7 @@ const ToggleItem = ({ title, onClick, disabled = false, isIconOnly = false, icon
|
|
|
4744
4760
|
const cvaValueBar = cvaMerge(["w-full"], {
|
|
4745
4761
|
variants: {
|
|
4746
4762
|
size: {
|
|
4763
|
+
extraSmall: "h-1",
|
|
4747
4764
|
small: "h-3",
|
|
4748
4765
|
large: "h-9",
|
|
4749
4766
|
},
|
|
@@ -4781,10 +4798,15 @@ const cvaValueBarText = cvaMerge([], {
|
|
|
4781
4798
|
* @param {number} value - value for which score should be returned
|
|
4782
4799
|
* @param {number} min - min range value
|
|
4783
4800
|
* @param {number} max - max range value
|
|
4801
|
+
* @param {boolean} zeroScoreAllowed - If true, allows the score to be exactly 0 when the value is less than or equal to the minimum.
|
|
4802
|
+
* If false or not provided, ensures a minimal score (0.01) is returned to always render a small fragment.
|
|
4784
4803
|
* @returns {number} normalized score
|
|
4785
4804
|
*/
|
|
4786
|
-
const getScore = (value, min, max) => {
|
|
4805
|
+
const getScore = (value, min, max, zeroScoreAllowed) => {
|
|
4787
4806
|
if (value <= min) {
|
|
4807
|
+
if (zeroScoreAllowed) {
|
|
4808
|
+
return 0;
|
|
4809
|
+
}
|
|
4788
4810
|
return 0.01; // always render at least some small fragment
|
|
4789
4811
|
}
|
|
4790
4812
|
if (value >= max) {
|
|
@@ -4844,15 +4866,15 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
|
|
|
4844
4866
|
* @param {ValueBarProps} props - The props for the ValueBar component
|
|
4845
4867
|
* @returns {JSX.Element} ValueBar component
|
|
4846
4868
|
*/
|
|
4847
|
-
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, }) => {
|
|
4848
|
-
const score = getScore(value, min, max);
|
|
4869
|
+
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, zeroScoreAllowed, }) => {
|
|
4870
|
+
const score = getScore(value, min, max, zeroScoreAllowed);
|
|
4849
4871
|
const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
|
|
4850
4872
|
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] }) }));
|
|
4873
|
+
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
4874
|
};
|
|
4853
4875
|
|
|
4854
4876
|
const cvaVirtualizedListContainer = cvaMerge(["h-full", "overflow-auto"]);
|
|
4855
|
-
const cvaVirtualizedList = cvaMerge(["relative"
|
|
4877
|
+
const cvaVirtualizedList = cvaMerge(["relative"]);
|
|
4856
4878
|
const cvaVirtualizedListItem = cvaMerge(["absolute", "top-0", "left-0", "w-full"], {
|
|
4857
4879
|
variants: {
|
|
4858
4880
|
separator: {
|
package/package.json
CHANGED
|
@@ -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?:
|
|
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;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { CommonProps
|
|
2
|
-
type MenuItemSize = Extract<Size, "small" | "medium">;
|
|
1
|
+
import { CommonProps } from "../../../common";
|
|
3
2
|
export type MenuItemVariant = "primary" | "danger";
|
|
4
3
|
export interface MenuItemProps extends CommonProps {
|
|
5
4
|
/**
|
|
@@ -15,10 +14,6 @@ export interface MenuItemProps extends CommonProps {
|
|
|
15
14
|
* If you use this prop, the label prop will be ignored.
|
|
16
15
|
*/
|
|
17
16
|
children?: React.ReactNode;
|
|
18
|
-
/**
|
|
19
|
-
* Size of the menu item
|
|
20
|
-
*/
|
|
21
|
-
size?: MenuItemSize;
|
|
22
17
|
/**
|
|
23
18
|
* An React element to render before the label.
|
|
24
19
|
* This is typically used to render an icon.
|
|
@@ -73,5 +68,4 @@ export interface MenuItemProps extends CommonProps {
|
|
|
73
68
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
74
69
|
* @returns {JSX.Element} MenuItem component
|
|
75
70
|
*/
|
|
76
|
-
export declare const MenuItem: ({ className, dataTestId, label,
|
|
77
|
-
export {};
|
|
71
|
+
export declare const MenuItem: ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation, id, tabIndex, optionLabelDescription, variant, }: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,6 @@ import { MappedOmit } from "@trackunit/shared-utils";
|
|
|
3
3
|
import { cvaInteractableItem } from "../../InteractableItem/InteractableItem.variants";
|
|
4
4
|
import { MenuItemVariant } from "./MenuItem";
|
|
5
5
|
type CvaMenuItemProps = Partial<MappedOmit<VariantProps<typeof cvaInteractableItem>, "cursor">> & {
|
|
6
|
-
size?: "small" | "medium";
|
|
7
6
|
variant?: MenuItemVariant;
|
|
8
7
|
selected?: boolean | null | undefined;
|
|
9
8
|
};
|
|
@@ -13,7 +12,6 @@ type CvaMenuItemProps = Partial<MappedOmit<VariantProps<typeof cvaInteractableIt
|
|
|
13
12
|
*/
|
|
14
13
|
export declare const cvaMenuItem: (props?: CvaMenuItemProps) => string;
|
|
15
14
|
export declare const cvaMenuItemStyle: (props?: ({
|
|
16
|
-
size?: "small" | "medium" | null | undefined;
|
|
17
15
|
variant?: "primary" | "danger" | null | undefined;
|
|
18
16
|
selected?: boolean | null | undefined;
|
|
19
17
|
disabled?: boolean | null | undefined;
|
|
@@ -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
|
|