@trackunit/react-components 0.1.382 → 0.1.384
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
|
@@ -3668,12 +3668,17 @@ const cvaKPICardContainer = cssClassVarianceUtilities.cvaMerge(["inline-flex"],
|
|
|
3668
3668
|
const cvaKPICard = cssClassVarianceUtilities.cvaMerge(["w-full", "bg-white", "pl-6", "pr-8", "py-4", "flex", "flex-row", "items-center", "gap-3"], {
|
|
3669
3669
|
variants: {
|
|
3670
3670
|
isClickable: {
|
|
3671
|
-
true: ["hover:bg-slate-50"],
|
|
3671
|
+
true: ["hover:bg-slate-50", "component-card-border"],
|
|
3672
|
+
false: [],
|
|
3673
|
+
},
|
|
3674
|
+
isActive: {
|
|
3675
|
+
true: ["bg-primary-50", "border-primary-600"],
|
|
3672
3676
|
false: [],
|
|
3673
3677
|
},
|
|
3674
3678
|
},
|
|
3675
3679
|
defaultVariants: {
|
|
3676
3680
|
isClickable: false,
|
|
3681
|
+
isActive: false,
|
|
3677
3682
|
},
|
|
3678
3683
|
});
|
|
3679
3684
|
const cvaKPICardIconContainer = cssClassVarianceUtilities.cvaMerge(["w-7", "h-7", "flex", "justify-center", "items-center", "rounded"], {
|
|
@@ -3698,9 +3703,12 @@ const LoadingContent = () => (jsxRuntime.jsxs("div", { className: "flex flex-row
|
|
|
3698
3703
|
* @returns {JSX.Element} KPICard component
|
|
3699
3704
|
*/
|
|
3700
3705
|
const KPICard = (_a) => {
|
|
3701
|
-
var { asChild = false, title, value, loading, unit, iconName, iconBackgroundColor, className, dataTestId } = _a, rest = __rest(_a, ["asChild", "title", "value", "loading", "unit", "iconName", "iconBackgroundColor", "className", "dataTestId"]);
|
|
3706
|
+
var { asChild = false, title, value, loading, unit, iconName, iconBackgroundColor, className, dataTestId, tooltipLabel, isActive, onClick } = _a, rest = __rest(_a, ["asChild", "title", "value", "loading", "unit", "iconName", "iconBackgroundColor", "className", "dataTestId", "tooltipLabel", "isActive", "onClick"]);
|
|
3702
3707
|
const Comp = asChild ? reactSlot.Slot : "div";
|
|
3703
|
-
|
|
3708
|
+
const CardContent = () => {
|
|
3709
|
+
return (jsxRuntime.jsx(Card, { className: cvaKPICard({ isClickable: Boolean((onClick || asChild) && !loading), isActive }), children: loading ? (jsxRuntime.jsx(LoadingContent, {})) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconName ? (jsxRuntime.jsx("div", { className: cvaKPICardIconContainer({ backgroundColor: iconBackgroundColor }), "data-testid": `${dataTestId}-icon-container`, children: jsxRuntime.jsx(Icon, { color: "white", dataTestId: `${dataTestId}-icon`, name: iconName, size: "medium" }) })) : null, jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Text, { dataTestId: `${dataTestId}-title`, subtle: true, weight: "bold", children: title }), jsxRuntime.jsxs(Text, { dataTestId: `${dataTestId}-value`, size: "large", weight: "bold", children: [value, " ", unit] })] })] })) }));
|
|
3710
|
+
};
|
|
3711
|
+
return (jsxRuntime.jsxs(Comp, Object.assign({ className: cvaKPICardContainer({ className, isClickable: Boolean(asChild || onClick) }), "data-testid": `${dataTestId}-comp`, onClick: onClick }, rest, { children: [tooltipLabel ? (jsxRuntime.jsx(Tooltip, { className: "w-full", label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsx(CardContent, {}) })) : (jsxRuntime.jsx(CardContent, {})), !loading && jsxRuntime.jsx(reactSlot.Slottable, { children: rest.children })] })));
|
|
3704
3712
|
};
|
|
3705
3713
|
|
|
3706
3714
|
const cvaMenuItem = cssClassVarianceUtilities.cvaMerge([
|
package/index.esm.js
CHANGED
|
@@ -3637,12 +3637,17 @@ const cvaKPICardContainer = cvaMerge(["inline-flex"], {
|
|
|
3637
3637
|
const cvaKPICard = cvaMerge(["w-full", "bg-white", "pl-6", "pr-8", "py-4", "flex", "flex-row", "items-center", "gap-3"], {
|
|
3638
3638
|
variants: {
|
|
3639
3639
|
isClickable: {
|
|
3640
|
-
true: ["hover:bg-slate-50"],
|
|
3640
|
+
true: ["hover:bg-slate-50", "component-card-border"],
|
|
3641
|
+
false: [],
|
|
3642
|
+
},
|
|
3643
|
+
isActive: {
|
|
3644
|
+
true: ["bg-primary-50", "border-primary-600"],
|
|
3641
3645
|
false: [],
|
|
3642
3646
|
},
|
|
3643
3647
|
},
|
|
3644
3648
|
defaultVariants: {
|
|
3645
3649
|
isClickable: false,
|
|
3650
|
+
isActive: false,
|
|
3646
3651
|
},
|
|
3647
3652
|
});
|
|
3648
3653
|
const cvaKPICardIconContainer = cvaMerge(["w-7", "h-7", "flex", "justify-center", "items-center", "rounded"], {
|
|
@@ -3667,9 +3672,12 @@ const LoadingContent = () => (jsxs("div", { className: "flex flex-row items-cent
|
|
|
3667
3672
|
* @returns {JSX.Element} KPICard component
|
|
3668
3673
|
*/
|
|
3669
3674
|
const KPICard = (_a) => {
|
|
3670
|
-
var { asChild = false, title, value, loading, unit, iconName, iconBackgroundColor, className, dataTestId } = _a, rest = __rest(_a, ["asChild", "title", "value", "loading", "unit", "iconName", "iconBackgroundColor", "className", "dataTestId"]);
|
|
3675
|
+
var { asChild = false, title, value, loading, unit, iconName, iconBackgroundColor, className, dataTestId, tooltipLabel, isActive, onClick } = _a, rest = __rest(_a, ["asChild", "title", "value", "loading", "unit", "iconName", "iconBackgroundColor", "className", "dataTestId", "tooltipLabel", "isActive", "onClick"]);
|
|
3671
3676
|
const Comp = asChild ? Slot : "div";
|
|
3672
|
-
|
|
3677
|
+
const CardContent = () => {
|
|
3678
|
+
return (jsx(Card, { className: cvaKPICard({ isClickable: Boolean((onClick || asChild) && !loading), isActive }), children: loading ? (jsx(LoadingContent, {})) : (jsxs(Fragment, { children: [iconName ? (jsx("div", { className: cvaKPICardIconContainer({ backgroundColor: iconBackgroundColor }), "data-testid": `${dataTestId}-icon-container`, children: jsx(Icon, { color: "white", dataTestId: `${dataTestId}-icon`, name: iconName, size: "medium" }) })) : null, jsxs("div", { children: [jsx(Text, { dataTestId: `${dataTestId}-title`, subtle: true, weight: "bold", children: title }), jsxs(Text, { dataTestId: `${dataTestId}-value`, size: "large", weight: "bold", children: [value, " ", unit] })] })] })) }));
|
|
3679
|
+
};
|
|
3680
|
+
return (jsxs(Comp, Object.assign({ className: cvaKPICardContainer({ className, isClickable: Boolean(asChild || onClick) }), "data-testid": `${dataTestId}-comp`, onClick: onClick }, rest, { children: [tooltipLabel ? (jsx(Tooltip, { className: "w-full", label: tooltipLabel, placement: "bottom", children: jsx(CardContent, {}) })) : (jsx(CardContent, {})), !loading && jsx(Slottable, { children: rest.children })] })));
|
|
3673
3681
|
};
|
|
3674
3682
|
|
|
3675
3683
|
const cvaMenuItem = cvaMerge([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.384",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"jest-fetch-mock": "^3.0.3",
|
|
23
23
|
"@testing-library/react": "14.0.0",
|
|
24
24
|
"@floating-ui/react": "^0.26.6",
|
|
25
|
-
"@tanstack/react-router": "1.
|
|
25
|
+
"@tanstack/react-router": "1.46.8",
|
|
26
26
|
"string-ts": "^2.0.0",
|
|
27
27
|
"tailwind-merge": "^2.0.0",
|
|
28
28
|
"@trackunit/react-table-pagination": "*",
|
|
@@ -41,6 +41,18 @@ export interface KPICardProps extends CommonProps {
|
|
|
41
41
|
* </KPICard>
|
|
42
42
|
*/
|
|
43
43
|
children?: ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Label for the tooltip
|
|
46
|
+
*/
|
|
47
|
+
tooltipLabel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Is the kpi card active
|
|
50
|
+
*/
|
|
51
|
+
isActive?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* On kpi card click handler
|
|
54
|
+
*/
|
|
55
|
+
onClick?: () => void;
|
|
44
56
|
}
|
|
45
57
|
/**
|
|
46
58
|
* The KPICard component is used to display KPIs.
|
|
@@ -48,4 +60,4 @@ export interface KPICardProps extends CommonProps {
|
|
|
48
60
|
* @param {KPICardProps} props - The props for the KPICard component
|
|
49
61
|
* @returns {JSX.Element} KPICard component
|
|
50
62
|
*/
|
|
51
|
-
export declare const KPICard: ({ asChild, title, value, loading, unit, iconName, iconBackgroundColor, className, dataTestId, ...rest }: KPICardProps) => JSX.Element;
|
|
63
|
+
export declare const KPICard: ({ asChild, title, value, loading, unit, iconName, iconBackgroundColor, className, dataTestId, tooltipLabel, isActive, onClick, ...rest }: KPICardProps) => JSX.Element;
|
|
@@ -3,6 +3,7 @@ export declare const cvaKPICardContainer: (props?: ({
|
|
|
3
3
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
4
4
|
export declare const cvaKPICard: (props?: ({
|
|
5
5
|
isClickable?: boolean | null | undefined;
|
|
6
|
+
isActive?: boolean | null | undefined;
|
|
6
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
8
|
export declare const cvaKPICardIconContainer: (props?: ({
|
|
8
9
|
backgroundColor?: "info" | "success" | "warning" | "danger" | null | undefined;
|