@trackunit/react-components 1.7.41 → 1.8.0
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 +15 -17
- package/index.esm.js +16 -18
- package/package.json +7 -7
- package/src/components/ValueBar/ValueBar.variants.d.ts +0 -3
package/index.cjs.js
CHANGED
|
@@ -3922,7 +3922,16 @@ const ToggleItem = ({ title, onClick, disabled = false, isIconOnly = false, icon
|
|
|
3922
3922
|
return isIconOnly ? (jsxRuntime.jsx(Tooltip, { label: tooltip?.content || title, placement: tooltip?.placement || "top", children: jsxRuntime.jsx(IconButton, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, icon: iconName ? (jsxRuntime.jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, onClick: onClick, size: size, title: iconName, variant: "secondary" }) })) : (jsxRuntime.jsx(Tooltip, { disabled: !tooltip?.content, label: tooltip?.content, placement: tooltip?.placement || "top", children: jsxRuntime.jsx(Button, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, onClick: onClick, prefix: iconName ? (jsxRuntime.jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, size: size, variant: "secondary", children: jsxRuntime.jsx("span", { className: cvaToggleItemText({ disabledAndSelected: disabled && selected, maxWidth: text?.maxWidth }), children: title }) }) }));
|
|
3923
3923
|
};
|
|
3924
3924
|
|
|
3925
|
-
const cvaValueBar = cssClassVarianceUtilities.cvaMerge([
|
|
3925
|
+
const cvaValueBar = cssClassVarianceUtilities.cvaMerge([
|
|
3926
|
+
"w-full",
|
|
3927
|
+
"overflow-hidden",
|
|
3928
|
+
"rounded",
|
|
3929
|
+
"bg-slate-100",
|
|
3930
|
+
"appearance-none",
|
|
3931
|
+
"[&::-webkit-progress-bar]:bg-transparent",
|
|
3932
|
+
"[&::-webkit-progress-value]:bg-current",
|
|
3933
|
+
"[&::-moz-progress-bar]:bg-current",
|
|
3934
|
+
], {
|
|
3926
3935
|
variants: {
|
|
3927
3936
|
size: {
|
|
3928
3937
|
extraSmall: "h-1",
|
|
@@ -3934,22 +3943,11 @@ const cvaValueBar = cssClassVarianceUtilities.cvaMerge(["w-full"], {
|
|
|
3934
3943
|
size: "small",
|
|
3935
3944
|
},
|
|
3936
3945
|
});
|
|
3937
|
-
const
|
|
3938
|
-
variants: {
|
|
3939
|
-
fill: {
|
|
3940
|
-
default: "",
|
|
3941
|
-
background: "fill-slate-100",
|
|
3942
|
-
},
|
|
3943
|
-
},
|
|
3944
|
-
defaultVariants: {
|
|
3945
|
-
fill: "default",
|
|
3946
|
-
},
|
|
3947
|
-
});
|
|
3948
|
-
const cvaValueBarText = cssClassVarianceUtilities.cvaMerge([], {
|
|
3946
|
+
const cvaValueBarText = cssClassVarianceUtilities.cvaMerge(["whitespace-nowrap"], {
|
|
3949
3947
|
variants: {
|
|
3950
3948
|
size: {
|
|
3951
|
-
small: "text-sm font-bold",
|
|
3952
|
-
large: "drop-shadow-lg",
|
|
3949
|
+
small: "text-sm font-bold text-neutral-400",
|
|
3950
|
+
large: "absolute pl-3 text-base text-white drop-shadow-lg",
|
|
3953
3951
|
},
|
|
3954
3952
|
},
|
|
3955
3953
|
defaultVariants: {
|
|
@@ -4033,8 +4031,8 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
|
|
|
4033
4031
|
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, zeroScoreAllowed, }) => {
|
|
4034
4032
|
const score = getScore(value, min, max, zeroScoreAllowed);
|
|
4035
4033
|
const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
|
|
4036
|
-
const
|
|
4037
|
-
return (jsxRuntime.
|
|
4034
|
+
const valueText = `${Number(value.toFixed(1))}${sharedUtils.nonNullable(unit) ? unit : ""}`;
|
|
4035
|
+
return (jsxRuntime.jsxs("span", { className: "relative flex items-center gap-2", "data-testid": dataTestId, children: [jsxRuntime.jsx("progress", { "aria-label": valueText, className: cvaValueBar({ className, size }), max: 100, style: { color: barFillColor }, value: score * 100 }), showValue && (size === "small" || size === "large") ? (jsxRuntime.jsx(Text, { className: cvaValueBarText({ size }), dataTestId: dataTestId ? `${dataTestId}-value` : undefined, children: jsxRuntime.jsx("span", { style: valueColor ? { color: valueColor } : undefined, children: valueText }) })) : null] }));
|
|
4038
4036
|
};
|
|
4039
4037
|
|
|
4040
4038
|
const cvaVirtualizedListContainer = cssClassVarianceUtilities.cvaMerge(["h-full"], {
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useRef, useMemo, useEffect, useState, useCallback, createElement, useReducer, memo, forwardRef, createContext, useContext, isValidElement, cloneElement, Children } from 'react';
|
|
3
|
-
import { objectKeys, uuidv4, objectEntries, objectValues } from '@trackunit/shared-utils';
|
|
3
|
+
import { objectKeys, uuidv4, objectEntries, objectValues, nonNullable } from '@trackunit/shared-utils';
|
|
4
4
|
import { intentPalette, generalPalette, criticalityPalette, activityPalette, utilizationPalette, sitesPalette, rentalStatusPalette, themeScreenSizeAsNumber, color } from '@trackunit/ui-design-tokens';
|
|
5
5
|
import { iconNames } from '@trackunit/ui-icons';
|
|
6
6
|
import IconSpriteMicro from '@trackunit/ui-icons/icons-sprite-micro.svg';
|
|
@@ -3920,7 +3920,16 @@ const ToggleItem = ({ title, onClick, disabled = false, isIconOnly = false, icon
|
|
|
3920
3920
|
return isIconOnly ? (jsx(Tooltip, { label: tooltip?.content || title, placement: tooltip?.placement || "top", children: jsx(IconButton, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, icon: iconName ? (jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, onClick: onClick, size: size, title: iconName, variant: "secondary" }) })) : (jsx(Tooltip, { disabled: !tooltip?.content, label: tooltip?.content, placement: tooltip?.placement || "top", children: jsx(Button, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, onClick: onClick, prefix: iconName ? (jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, size: size, variant: "secondary", children: jsx("span", { className: cvaToggleItemText({ disabledAndSelected: disabled && selected, maxWidth: text?.maxWidth }), children: title }) }) }));
|
|
3921
3921
|
};
|
|
3922
3922
|
|
|
3923
|
-
const cvaValueBar = cvaMerge([
|
|
3923
|
+
const cvaValueBar = cvaMerge([
|
|
3924
|
+
"w-full",
|
|
3925
|
+
"overflow-hidden",
|
|
3926
|
+
"rounded",
|
|
3927
|
+
"bg-slate-100",
|
|
3928
|
+
"appearance-none",
|
|
3929
|
+
"[&::-webkit-progress-bar]:bg-transparent",
|
|
3930
|
+
"[&::-webkit-progress-value]:bg-current",
|
|
3931
|
+
"[&::-moz-progress-bar]:bg-current",
|
|
3932
|
+
], {
|
|
3924
3933
|
variants: {
|
|
3925
3934
|
size: {
|
|
3926
3935
|
extraSmall: "h-1",
|
|
@@ -3932,22 +3941,11 @@ const cvaValueBar = cvaMerge(["w-full"], {
|
|
|
3932
3941
|
size: "small",
|
|
3933
3942
|
},
|
|
3934
3943
|
});
|
|
3935
|
-
const
|
|
3936
|
-
variants: {
|
|
3937
|
-
fill: {
|
|
3938
|
-
default: "",
|
|
3939
|
-
background: "fill-slate-100",
|
|
3940
|
-
},
|
|
3941
|
-
},
|
|
3942
|
-
defaultVariants: {
|
|
3943
|
-
fill: "default",
|
|
3944
|
-
},
|
|
3945
|
-
});
|
|
3946
|
-
const cvaValueBarText = cvaMerge([], {
|
|
3944
|
+
const cvaValueBarText = cvaMerge(["whitespace-nowrap"], {
|
|
3947
3945
|
variants: {
|
|
3948
3946
|
size: {
|
|
3949
|
-
small: "text-sm font-bold",
|
|
3950
|
-
large: "drop-shadow-lg",
|
|
3947
|
+
small: "text-sm font-bold text-neutral-400",
|
|
3948
|
+
large: "absolute pl-3 text-base text-white drop-shadow-lg",
|
|
3951
3949
|
},
|
|
3952
3950
|
},
|
|
3953
3951
|
defaultVariants: {
|
|
@@ -4031,8 +4029,8 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
|
|
|
4031
4029
|
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, zeroScoreAllowed, }) => {
|
|
4032
4030
|
const score = getScore(value, min, max, zeroScoreAllowed);
|
|
4033
4031
|
const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
|
|
4034
|
-
const
|
|
4035
|
-
return (
|
|
4032
|
+
const valueText = `${Number(value.toFixed(1))}${nonNullable(unit) ? unit : ""}`;
|
|
4033
|
+
return (jsxs("span", { className: "relative flex items-center gap-2", "data-testid": dataTestId, children: [jsx("progress", { "aria-label": valueText, className: cvaValueBar({ className, size }), max: 100, style: { color: barFillColor }, value: score * 100 }), showValue && (size === "small" || size === "large") ? (jsx(Text, { className: cvaValueBarText({ size }), dataTestId: dataTestId ? `${dataTestId}-value` : undefined, children: jsx("span", { style: valueColor ? { color: valueColor } : undefined, children: valueText }) })) : null] }));
|
|
4036
4034
|
};
|
|
4037
4035
|
|
|
4038
4036
|
const cvaVirtualizedListContainer = cvaMerge(["h-full"], {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"@floating-ui/react": "^0.26.25",
|
|
18
18
|
"string-ts": "^2.0.0",
|
|
19
19
|
"tailwind-merge": "^2.0.0",
|
|
20
|
-
"@trackunit/ui-design-tokens": "1.6.
|
|
21
|
-
"@trackunit/css-class-variance-utilities": "1.6.
|
|
22
|
-
"@trackunit/shared-utils": "1.8.
|
|
23
|
-
"@trackunit/ui-icons": "1.6.
|
|
24
|
-
"@trackunit/react-table-pagination": "1.6.
|
|
25
|
-
"@trackunit/react-test-setup": "1.3.
|
|
20
|
+
"@trackunit/ui-design-tokens": "1.6.34",
|
|
21
|
+
"@trackunit/css-class-variance-utilities": "1.6.33",
|
|
22
|
+
"@trackunit/shared-utils": "1.8.33",
|
|
23
|
+
"@trackunit/ui-icons": "1.6.32",
|
|
24
|
+
"@trackunit/react-table-pagination": "1.6.32",
|
|
25
|
+
"@trackunit/react-test-setup": "1.3.33",
|
|
26
26
|
"@tanstack/react-router": "1.114.29"
|
|
27
27
|
},
|
|
28
28
|
"module": "./index.esm.js",
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export declare const cvaValueBar: (props?: ({
|
|
2
2
|
size?: "extraSmall" | "small" | "large" | null | undefined;
|
|
3
3
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
4
|
-
export declare const cvaValueBarProgress: (props?: ({
|
|
5
|
-
fill?: "default" | "background" | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
4
|
export declare const cvaValueBarText: (props?: ({
|
|
8
5
|
size?: "small" | "large" | null | undefined;
|
|
9
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|