@trackunit/react-components 1.7.29 → 1.7.32
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
|
@@ -28,7 +28,7 @@ const docs = {
|
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
31
|
+
const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-grid", "relative", "shrink-0"], {
|
|
32
32
|
variants: {
|
|
33
33
|
color: {
|
|
34
34
|
primary: "text-primary-600",
|
|
@@ -1773,6 +1773,7 @@ const cvaCard = cssClassVarianceUtilities.cvaMerge([
|
|
|
1773
1773
|
"component-card-border",
|
|
1774
1774
|
"transition-shadow",
|
|
1775
1775
|
"ease-in-out",
|
|
1776
|
+
"overflow-clip", //otherwise rounded corners are not respected (clip is preferable to hidden since it doesn't create a scroll clipping box. )
|
|
1776
1777
|
], {
|
|
1777
1778
|
variants: {
|
|
1778
1779
|
clickable: {
|
|
@@ -2943,7 +2944,7 @@ const LoadingContent$1 = () => (jsxRuntime.jsx("div", { className: "flex h-11 fl
|
|
|
2943
2944
|
* @param {KPIProps} props - The props for the KPI component
|
|
2944
2945
|
* @returns {ReactElement} KPI component
|
|
2945
2946
|
*/
|
|
2946
|
-
const KPI = ({ title, value, loading, unit, className, dataTestId, tooltipLabel, variant = "default", trend,
|
|
2947
|
+
const KPI = ({ title, value, loading, unit, className, dataTestId, tooltipLabel, variant = "default", trend, ...rest }) => {
|
|
2947
2948
|
const isSmallVariant = variant === "small";
|
|
2948
2949
|
return (jsxRuntime.jsx(Tooltip, { dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, disabled: !tooltipLabel, label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsx("div", { className: cvaKPI({ variant, className }), "data-testid": dataTestId ? `${dataTestId}` : undefined, ...rest, children: loading ? (jsxRuntime.jsx(LoadingContent$1, {})) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: cvaKPIHeader(), children: jsxRuntime.jsx(Text, { className: cvaKPITitleText(), dataTestId: dataTestId ? `${dataTestId}-title` : undefined, size: isSmallVariant ? "small" : "medium", subtle: true, weight: isSmallVariant ? "normal" : "bold", children: title }) }), jsxRuntime.jsx(Text, { className: cvaKPIvalueText({ variant }), dataTestId: dataTestId ? `${dataTestId}-value` : undefined, size: isSmallVariant ? "small" : "large", type: "div", weight: isSmallVariant ? "bold" : "thick", children: jsxRuntime.jsxs("div", { className: cvaKPIValueContainer({
|
|
2949
2950
|
isDefaultAndHasTrendValue: Boolean(trend?.value && !isSmallVariant),
|
|
@@ -2975,16 +2976,10 @@ const cvaKPICard = cssClassVarianceUtilities.cvaMerge([
|
|
|
2975
2976
|
true: ["bg-primary-50", "border-primary-600"],
|
|
2976
2977
|
false: [],
|
|
2977
2978
|
},
|
|
2978
|
-
variant: {
|
|
2979
|
-
small: ["px-3"],
|
|
2980
|
-
condensed: ["px-2"],
|
|
2981
|
-
default: ["min-w-40"],
|
|
2982
|
-
},
|
|
2983
2979
|
},
|
|
2984
2980
|
defaultVariants: {
|
|
2985
2981
|
isClickable: false,
|
|
2986
2982
|
isActive: false,
|
|
2987
|
-
variant: "default",
|
|
2988
2983
|
},
|
|
2989
2984
|
});
|
|
2990
2985
|
const cvaKPIIconContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "justify-center", "w-7", "h-7", "rounded-md", "text-white"], {
|
|
@@ -3005,15 +3000,14 @@ const cvaKPIIconContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-c
|
|
|
3005
3000
|
* @param {KPICardProps} props - The props for the KPICard component
|
|
3006
3001
|
* @returns {ReactElement} KPICard component
|
|
3007
3002
|
*/
|
|
3008
|
-
const KPICard = ({ isActive, onClick, className, dataTestId, children, ...rest }) => {
|
|
3003
|
+
const KPICard = ({ isActive, onClick, className, dataTestId, children, iconName, iconColor, ...rest }) => {
|
|
3009
3004
|
const isClickable = Boolean(onClick && !rest.loading);
|
|
3010
3005
|
return (jsxRuntime.jsx(Card, { className: cvaKPICard({
|
|
3011
3006
|
isClickable,
|
|
3012
3007
|
isActive,
|
|
3013
3008
|
minHeight: rest.trend ? "withTrends" : "default",
|
|
3014
|
-
variant: rest.variant,
|
|
3015
3009
|
className,
|
|
3016
|
-
}), "data-testid": dataTestId ? dataTestId : undefined, onClick: onClick, children: jsxRuntime.jsxs(CardBody, { className: cvaCardBodyDensityContainer({ iconName: Boolean(
|
|
3010
|
+
}), "data-testid": dataTestId ? dataTestId : undefined, onClick: onClick, children: jsxRuntime.jsxs(CardBody, { className: cvaCardBodyDensityContainer({ iconName: Boolean(iconName) }), density: "none", children: [jsxRuntime.jsx(KPI, { ...rest, className: tailwindMerge.twMerge(iconName ? "gap-2" : "", "p-0"), dataTestId: dataTestId ? `${dataTestId}-kpi` : undefined }), iconName ? (jsxRuntime.jsx("div", { className: cvaKPIIconContainer({ iconColor: iconColor ?? "info" }), children: jsxRuntime.jsx(Icon, { name: iconName, size: "small", type: "solid" }) })) : null, children] }) }));
|
|
3017
3011
|
};
|
|
3018
3012
|
const cvaCardBodyDensityContainer = cssClassVarianceUtilities.cvaMerge(["grid", "grid-cols-[1fr_auto]"], {
|
|
3019
3013
|
variants: {
|
package/index.esm.js
CHANGED
|
@@ -26,7 +26,7 @@ const docs = {
|
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
29
|
+
const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative", "shrink-0"], {
|
|
30
30
|
variants: {
|
|
31
31
|
color: {
|
|
32
32
|
primary: "text-primary-600",
|
|
@@ -1771,6 +1771,7 @@ const cvaCard = cvaMerge([
|
|
|
1771
1771
|
"component-card-border",
|
|
1772
1772
|
"transition-shadow",
|
|
1773
1773
|
"ease-in-out",
|
|
1774
|
+
"overflow-clip", //otherwise rounded corners are not respected (clip is preferable to hidden since it doesn't create a scroll clipping box. )
|
|
1774
1775
|
], {
|
|
1775
1776
|
variants: {
|
|
1776
1777
|
clickable: {
|
|
@@ -2941,7 +2942,7 @@ const LoadingContent$1 = () => (jsx("div", { className: "flex h-11 flex-row item
|
|
|
2941
2942
|
* @param {KPIProps} props - The props for the KPI component
|
|
2942
2943
|
* @returns {ReactElement} KPI component
|
|
2943
2944
|
*/
|
|
2944
|
-
const KPI = ({ title, value, loading, unit, className, dataTestId, tooltipLabel, variant = "default", trend,
|
|
2945
|
+
const KPI = ({ title, value, loading, unit, className, dataTestId, tooltipLabel, variant = "default", trend, ...rest }) => {
|
|
2945
2946
|
const isSmallVariant = variant === "small";
|
|
2946
2947
|
return (jsx(Tooltip, { dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, disabled: !tooltipLabel, label: tooltipLabel, placement: "bottom", children: jsx("div", { className: cvaKPI({ variant, className }), "data-testid": dataTestId ? `${dataTestId}` : undefined, ...rest, children: loading ? (jsx(LoadingContent$1, {})) : (jsxs(Fragment, { children: [jsx("div", { className: cvaKPIHeader(), children: jsx(Text, { className: cvaKPITitleText(), dataTestId: dataTestId ? `${dataTestId}-title` : undefined, size: isSmallVariant ? "small" : "medium", subtle: true, weight: isSmallVariant ? "normal" : "bold", children: title }) }), jsx(Text, { className: cvaKPIvalueText({ variant }), dataTestId: dataTestId ? `${dataTestId}-value` : undefined, size: isSmallVariant ? "small" : "large", type: "div", weight: isSmallVariant ? "bold" : "thick", children: jsxs("div", { className: cvaKPIValueContainer({
|
|
2947
2948
|
isDefaultAndHasTrendValue: Boolean(trend?.value && !isSmallVariant),
|
|
@@ -2973,16 +2974,10 @@ const cvaKPICard = cvaMerge([
|
|
|
2973
2974
|
true: ["bg-primary-50", "border-primary-600"],
|
|
2974
2975
|
false: [],
|
|
2975
2976
|
},
|
|
2976
|
-
variant: {
|
|
2977
|
-
small: ["px-3"],
|
|
2978
|
-
condensed: ["px-2"],
|
|
2979
|
-
default: ["min-w-40"],
|
|
2980
|
-
},
|
|
2981
2977
|
},
|
|
2982
2978
|
defaultVariants: {
|
|
2983
2979
|
isClickable: false,
|
|
2984
2980
|
isActive: false,
|
|
2985
|
-
variant: "default",
|
|
2986
2981
|
},
|
|
2987
2982
|
});
|
|
2988
2983
|
const cvaKPIIconContainer = cvaMerge(["flex", "items-center", "justify-center", "w-7", "h-7", "rounded-md", "text-white"], {
|
|
@@ -3003,15 +2998,14 @@ const cvaKPIIconContainer = cvaMerge(["flex", "items-center", "justify-center",
|
|
|
3003
2998
|
* @param {KPICardProps} props - The props for the KPICard component
|
|
3004
2999
|
* @returns {ReactElement} KPICard component
|
|
3005
3000
|
*/
|
|
3006
|
-
const KPICard = ({ isActive, onClick, className, dataTestId, children, ...rest }) => {
|
|
3001
|
+
const KPICard = ({ isActive, onClick, className, dataTestId, children, iconName, iconColor, ...rest }) => {
|
|
3007
3002
|
const isClickable = Boolean(onClick && !rest.loading);
|
|
3008
3003
|
return (jsx(Card, { className: cvaKPICard({
|
|
3009
3004
|
isClickable,
|
|
3010
3005
|
isActive,
|
|
3011
3006
|
minHeight: rest.trend ? "withTrends" : "default",
|
|
3012
|
-
variant: rest.variant,
|
|
3013
3007
|
className,
|
|
3014
|
-
}), "data-testid": dataTestId ? dataTestId : undefined, onClick: onClick, children: jsxs(CardBody, { className: cvaCardBodyDensityContainer({ iconName: Boolean(
|
|
3008
|
+
}), "data-testid": dataTestId ? dataTestId : undefined, onClick: onClick, children: jsxs(CardBody, { className: cvaCardBodyDensityContainer({ iconName: Boolean(iconName) }), density: "none", children: [jsx(KPI, { ...rest, className: twMerge(iconName ? "gap-2" : "", "p-0"), dataTestId: dataTestId ? `${dataTestId}-kpi` : undefined }), iconName ? (jsx("div", { className: cvaKPIIconContainer({ iconColor: iconColor ?? "info" }), children: jsx(Icon, { name: iconName, size: "small", type: "solid" }) })) : null, children] }) }));
|
|
3015
3009
|
};
|
|
3016
3010
|
const cvaCardBodyDensityContainer = cvaMerge(["grid", "grid-cols-[1fr_auto]"], {
|
|
3017
3011
|
variants: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.32",
|
|
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.24",
|
|
21
|
+
"@trackunit/css-class-variance-utilities": "1.6.23",
|
|
22
|
+
"@trackunit/shared-utils": "1.8.23",
|
|
23
|
+
"@trackunit/ui-icons": "1.6.22",
|
|
24
|
+
"@trackunit/react-table-pagination": "1.6.22",
|
|
25
|
+
"@trackunit/react-test-setup": "1.3.23",
|
|
26
26
|
"@tanstack/react-router": "1.114.29"
|
|
27
27
|
},
|
|
28
28
|
"module": "./index.esm.js",
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { IconName } from "@trackunit/ui-icons";
|
|
2
1
|
import { ReactElement } from "react";
|
|
3
2
|
import { CommonProps } from "../../common";
|
|
4
3
|
export interface KPIProps extends CommonProps {
|
|
5
4
|
/**
|
|
6
|
-
* The title of the KPI
|
|
5
|
+
* The title of the KPI
|
|
7
6
|
*/
|
|
8
7
|
title: string;
|
|
9
8
|
/**
|
|
10
|
-
* The value of the KPI
|
|
9
|
+
* The value of the KPI
|
|
11
10
|
*/
|
|
12
11
|
value: string | number;
|
|
13
12
|
/**
|
|
14
|
-
* The unit of the KPI
|
|
13
|
+
* The unit of the KPI
|
|
15
14
|
*/
|
|
16
15
|
unit: string;
|
|
17
16
|
/**
|
|
@@ -23,19 +22,11 @@ export interface KPIProps extends CommonProps {
|
|
|
23
22
|
*/
|
|
24
23
|
tooltipLabel?: string;
|
|
25
24
|
/**
|
|
26
|
-
* The size of the KPI
|
|
25
|
+
* The size of the KPI
|
|
27
26
|
*/
|
|
28
27
|
variant?: "small" | "default" | "condensed";
|
|
29
28
|
/**
|
|
30
|
-
* The
|
|
31
|
-
*/
|
|
32
|
-
iconName?: IconName;
|
|
33
|
-
/**
|
|
34
|
-
* The color of the icon
|
|
35
|
-
*/
|
|
36
|
-
iconColor?: "success" | "warning" | "danger" | "info" | "neutral";
|
|
37
|
-
/**
|
|
38
|
-
* The trend of the KPI Card
|
|
29
|
+
* The trend of the KPI
|
|
39
30
|
*/
|
|
40
31
|
trend?: {
|
|
41
32
|
/**
|
|
@@ -67,4 +58,4 @@ export interface KPIProps extends CommonProps {
|
|
|
67
58
|
* @param {KPIProps} props - The props for the KPI component
|
|
68
59
|
* @returns {ReactElement} KPI component
|
|
69
60
|
*/
|
|
70
|
-
export declare const KPI: ({ title, value, loading, unit, className, dataTestId, tooltipLabel, variant, trend,
|
|
61
|
+
export declare const KPI: ({ title, value, loading, unit, className, dataTestId, tooltipLabel, variant, trend, ...rest }: KPIProps) => ReactElement;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { MappedOmit } from "@trackunit/shared-utils";
|
|
1
2
|
import { IconName } from "@trackunit/ui-icons";
|
|
2
3
|
import { ReactElement, ReactNode } from "react";
|
|
3
4
|
import { KPIProps } from "../KPI/KPI";
|
|
4
|
-
export interface KPICardProps extends KPIProps {
|
|
5
|
+
export interface KPICardProps extends MappedOmit<KPIProps, "variant"> {
|
|
5
6
|
/**
|
|
6
7
|
* Is the kpi card active
|
|
7
8
|
*/
|
|
@@ -29,4 +30,4 @@ export interface KPICardProps extends KPIProps {
|
|
|
29
30
|
* @param {KPICardProps} props - The props for the KPICard component
|
|
30
31
|
* @returns {ReactElement} KPICard component
|
|
31
32
|
*/
|
|
32
|
-
export declare const KPICard: ({ isActive, onClick, className, dataTestId, children, ...rest }: KPICardProps) => ReactElement;
|
|
33
|
+
export declare const KPICard: ({ isActive, onClick, className, dataTestId, children, iconName, iconColor, ...rest }: KPICardProps) => ReactElement;
|
|
@@ -2,7 +2,6 @@ export declare const cvaKPICard: (props?: ({
|
|
|
2
2
|
minHeight?: "default" | "withTrends" | null | undefined;
|
|
3
3
|
isClickable?: boolean | null | undefined;
|
|
4
4
|
isActive?: boolean | null | undefined;
|
|
5
|
-
variant?: "default" | "small" | "condensed" | null | undefined;
|
|
6
5
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
6
|
export declare const cvaKPIIconContainer: (props?: ({
|
|
8
7
|
iconColor?: "success" | "warning" | "danger" | "info" | "neutral" | null | undefined;
|