@trackunit/react-components 1.4.41 → 1.4.42
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 +62 -28
- package/index.esm.js +62 -29
- package/package.json +6 -6
- package/src/components/KPI/KPI.d.ts +75 -0
- package/src/components/KPI/KPI.variants.d.ts +14 -0
- package/src/components/KPICard/KPICard.d.ts +4 -68
- package/src/components/KPICard/KPICard.variants.d.ts +1 -10
- package/src/components/index.d.ts +1 -0
package/index.cjs.js
CHANGED
|
@@ -2674,39 +2674,33 @@ const Indicator = ({ dataTestId, icon, label, color = "unknown", withBackground
|
|
|
2674
2674
|
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] }) }));
|
|
2675
2675
|
};
|
|
2676
2676
|
|
|
2677
|
-
const
|
|
2677
|
+
const cvaKPIContainer = cssClassVarianceUtilities.cvaMerge(["inline-flex"]);
|
|
2678
|
+
const cvaKPI = cssClassVarianceUtilities.cvaMerge(["w-full", "px-4", "py-2", "flex", "flex-col", "gap-1"], {
|
|
2678
2679
|
variants: {
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2680
|
+
variant: {
|
|
2681
|
+
small: ["px-3"],
|
|
2682
|
+
condensed: ["px-2", "py-0"],
|
|
2683
|
+
default: ["min-w-40"],
|
|
2682
2684
|
},
|
|
2683
2685
|
},
|
|
2684
2686
|
defaultVariants: {
|
|
2685
|
-
|
|
2687
|
+
variant: "default",
|
|
2686
2688
|
},
|
|
2687
2689
|
});
|
|
2688
|
-
const
|
|
2690
|
+
const cvaKPITitleText = cssClassVarianceUtilities.cvaMerge(["truncate", "whitespace-nowrap"]);
|
|
2691
|
+
const cvaKPIvalueText = cssClassVarianceUtilities.cvaMerge(["truncate", "whitespace-nowrap"], {
|
|
2689
2692
|
variants: {
|
|
2690
|
-
isClickable: {
|
|
2691
|
-
true: ["hover:bg-slate-50", "component-card-border"],
|
|
2692
|
-
false: [],
|
|
2693
|
-
},
|
|
2694
|
-
isActive: {
|
|
2695
|
-
true: ["bg-primary-50", "border-primary-600"],
|
|
2696
|
-
false: [],
|
|
2697
|
-
},
|
|
2698
2693
|
variant: {
|
|
2699
|
-
small: ["
|
|
2700
|
-
|
|
2694
|
+
small: ["mt-0.5"],
|
|
2695
|
+
condensed: [""],
|
|
2696
|
+
default: [""],
|
|
2701
2697
|
},
|
|
2702
2698
|
},
|
|
2703
2699
|
defaultVariants: {
|
|
2704
|
-
isClickable: false,
|
|
2705
|
-
isActive: false,
|
|
2706
2700
|
variant: "default",
|
|
2707
2701
|
},
|
|
2708
2702
|
});
|
|
2709
|
-
const
|
|
2703
|
+
const cvaKPITrendPercentage = cssClassVarianceUtilities.cvaMerge([""], {
|
|
2710
2704
|
variants: {
|
|
2711
2705
|
color: {
|
|
2712
2706
|
success: ["text-success-500"],
|
|
@@ -2718,7 +2712,7 @@ const cvaKPICardTrendPercentage = cssClassVarianceUtilities.cvaMerge([""], {
|
|
|
2718
2712
|
color: "success",
|
|
2719
2713
|
},
|
|
2720
2714
|
});
|
|
2721
|
-
const
|
|
2715
|
+
const cvaKPIValueContainer = cssClassVarianceUtilities.cvaMerge(["truncate", "whitespace-nowrap"], {
|
|
2722
2716
|
variants: {
|
|
2723
2717
|
isDefaultAndHasTrendValue: {
|
|
2724
2718
|
true: [],
|
|
@@ -2730,25 +2724,64 @@ const cvaKPICardValueContainer = cssClassVarianceUtilities.cvaMerge([], {
|
|
|
2730
2724
|
},
|
|
2731
2725
|
});
|
|
2732
2726
|
|
|
2733
|
-
const LoadingContent$1 = () => (jsxRuntime.jsx("div", { className: "flex flex-row items-center gap-3", "data-testid": "kpi-card-loading-content", children: jsxRuntime.jsx("div", { className: "w-full", children: jsxRuntime.jsx(SkeletonLines, { height: [
|
|
2727
|
+
const LoadingContent$1 = () => (jsxRuntime.jsx("div", { className: "flex h-11 flex-row items-center gap-3", "data-testid": "kpi-card-loading-content", children: jsxRuntime.jsx("div", { className: "w-full", children: jsxRuntime.jsx(SkeletonLines, { height: [14, 18], lines: 2, margin: "3px 0", width: [100, 70] }) }) }));
|
|
2734
2728
|
/**
|
|
2735
|
-
* The
|
|
2729
|
+
* The KPI component is used to display KPIs.
|
|
2736
2730
|
*
|
|
2737
|
-
* @param {
|
|
2738
|
-
* @returns {ReactElement}
|
|
2731
|
+
* @param {KPIProps} props - The props for the KPI component
|
|
2732
|
+
* @returns {ReactElement} KPI component
|
|
2739
2733
|
*/
|
|
2740
|
-
const
|
|
2734
|
+
const KPI = ({ asChild = false, title, value, loading, unit, className, dataTestId, tooltipLabel, variant = "default", trend, ...rest }) => {
|
|
2741
2735
|
const Comp = asChild ? reactSlot.Slot : "div";
|
|
2742
2736
|
const isSmallVariant = variant === "small";
|
|
2743
|
-
return (jsxRuntime.jsxs(Comp, { className:
|
|
2737
|
+
return (jsxRuntime.jsxs(Comp, { className: cvaKPIContainer({ className }), "data-testid": `${dataTestId}-comp`, ...rest, children: [jsxRuntime.jsx(Tooltip, { className: "w-full", disabled: !tooltipLabel, label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsx("div", { className: cvaKPI({ variant }), children: loading ? (jsxRuntime.jsx(LoadingContent$1, {})) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Text, { className: cvaKPITitleText(), dataTestId: `${dataTestId}-title`, size: isSmallVariant ? "small" : "medium", subtle: true, weight: isSmallVariant ? "normal" : "bold", children: title }), jsxRuntime.jsx(Text, { className: cvaKPIvalueText({ variant }), dataTestId: `${dataTestId}-value`, size: isSmallVariant ? "small" : "large", type: "div", weight: isSmallVariant ? "bold" : "thick", children: jsxRuntime.jsxs("div", { className: cvaKPIValueContainer({
|
|
2744
2738
|
isDefaultAndHasTrendValue: Boolean(trend?.value && !isSmallVariant),
|
|
2745
|
-
|
|
2739
|
+
className,
|
|
2740
|
+
}), children: [jsxRuntime.jsxs("span", { className: cvaKPIvalueText({ variant }), children: [value, " ", unit] }), jsxRuntime.jsx(TrendIndicator, { isSmallVariant: isSmallVariant, trend: trend, unit: unit })] }) })] })) }) }), !loading && jsxRuntime.jsx(reactSlot.Slottable, { children: rest.children })] }));
|
|
2746
2741
|
};
|
|
2747
2742
|
const TrendIndicator = ({ trend, unit, isSmallVariant }) => {
|
|
2748
2743
|
if (!trend) {
|
|
2749
2744
|
return null;
|
|
2750
2745
|
}
|
|
2751
|
-
return (jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxRuntime.jsxs(Text, { dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, trend.variant?.icon ? jsxRuntime.jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxRuntime.jsxs(Text, { className:
|
|
2746
|
+
return (jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxRuntime.jsxs(Text, { dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, trend.variant?.icon ? jsxRuntime.jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxRuntime.jsxs(Text, { className: cvaKPITrendPercentage({ color: trend.variant?.color }), size: "small", weight: "bold", children: [trend.percentage, "%"] })) : null] }));
|
|
2747
|
+
};
|
|
2748
|
+
|
|
2749
|
+
const cvaKPICard = cssClassVarianceUtilities.cvaMerge(["inline-flex", "gap-1", "p-0"], {
|
|
2750
|
+
variants: {
|
|
2751
|
+
isClickable: {
|
|
2752
|
+
true: ["hover:bg-slate-50", "component-card-border"],
|
|
2753
|
+
false: [],
|
|
2754
|
+
},
|
|
2755
|
+
isActive: {
|
|
2756
|
+
true: ["bg-primary-50", "border-primary-600"],
|
|
2757
|
+
false: [],
|
|
2758
|
+
},
|
|
2759
|
+
variant: {
|
|
2760
|
+
small: ["px-3"],
|
|
2761
|
+
condensed: ["px-2"],
|
|
2762
|
+
default: ["min-w-40"],
|
|
2763
|
+
},
|
|
2764
|
+
},
|
|
2765
|
+
defaultVariants: {
|
|
2766
|
+
isClickable: false,
|
|
2767
|
+
isActive: false,
|
|
2768
|
+
variant: "default",
|
|
2769
|
+
},
|
|
2770
|
+
});
|
|
2771
|
+
|
|
2772
|
+
/**
|
|
2773
|
+
* The KPICard component is used to display KPIs.
|
|
2774
|
+
*
|
|
2775
|
+
* @param {KPICardProps} props - The props for the KPICard component
|
|
2776
|
+
* @returns {ReactElement} KPICard component
|
|
2777
|
+
*/
|
|
2778
|
+
const KPICard = ({ isActive, onClick, className, ...rest }) => {
|
|
2779
|
+
return (jsxRuntime.jsx(Card, { className: cvaKPICard({
|
|
2780
|
+
isClickable: Boolean((onClick || rest.asChild) && !rest.loading),
|
|
2781
|
+
isActive,
|
|
2782
|
+
variant: rest.variant,
|
|
2783
|
+
className,
|
|
2784
|
+
}), dataTestId: `${rest.dataTestId}-card`, onClick: Boolean(onClick || rest.asChild) ? () => onClick?.() : undefined, children: jsxRuntime.jsx(KPI, { ...rest, className: "overflow-hidden rounded-lg" }) }));
|
|
2752
2785
|
};
|
|
2753
2786
|
|
|
2754
2787
|
const cvaMenuList = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -3910,6 +3943,7 @@ exports.Heading = Heading;
|
|
|
3910
3943
|
exports.Icon = Icon;
|
|
3911
3944
|
exports.IconButton = IconButton;
|
|
3912
3945
|
exports.Indicator = Indicator;
|
|
3946
|
+
exports.KPI = KPI;
|
|
3913
3947
|
exports.KPICard = KPICard;
|
|
3914
3948
|
exports.MenuDivider = MenuDivider;
|
|
3915
3949
|
exports.MenuItem = MenuItem;
|
package/index.esm.js
CHANGED
|
@@ -2672,39 +2672,33 @@ const Indicator = ({ dataTestId, icon, label, color = "unknown", withBackground
|
|
|
2672
2672
|
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] }) }));
|
|
2673
2673
|
};
|
|
2674
2674
|
|
|
2675
|
-
const
|
|
2675
|
+
const cvaKPIContainer = cvaMerge(["inline-flex"]);
|
|
2676
|
+
const cvaKPI = cvaMerge(["w-full", "px-4", "py-2", "flex", "flex-col", "gap-1"], {
|
|
2676
2677
|
variants: {
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2678
|
+
variant: {
|
|
2679
|
+
small: ["px-3"],
|
|
2680
|
+
condensed: ["px-2", "py-0"],
|
|
2681
|
+
default: ["min-w-40"],
|
|
2680
2682
|
},
|
|
2681
2683
|
},
|
|
2682
2684
|
defaultVariants: {
|
|
2683
|
-
|
|
2685
|
+
variant: "default",
|
|
2684
2686
|
},
|
|
2685
2687
|
});
|
|
2686
|
-
const
|
|
2688
|
+
const cvaKPITitleText = cvaMerge(["truncate", "whitespace-nowrap"]);
|
|
2689
|
+
const cvaKPIvalueText = cvaMerge(["truncate", "whitespace-nowrap"], {
|
|
2687
2690
|
variants: {
|
|
2688
|
-
isClickable: {
|
|
2689
|
-
true: ["hover:bg-slate-50", "component-card-border"],
|
|
2690
|
-
false: [],
|
|
2691
|
-
},
|
|
2692
|
-
isActive: {
|
|
2693
|
-
true: ["bg-primary-50", "border-primary-600"],
|
|
2694
|
-
false: [],
|
|
2695
|
-
},
|
|
2696
2691
|
variant: {
|
|
2697
|
-
small: ["
|
|
2698
|
-
|
|
2692
|
+
small: ["mt-0.5"],
|
|
2693
|
+
condensed: [""],
|
|
2694
|
+
default: [""],
|
|
2699
2695
|
},
|
|
2700
2696
|
},
|
|
2701
2697
|
defaultVariants: {
|
|
2702
|
-
isClickable: false,
|
|
2703
|
-
isActive: false,
|
|
2704
2698
|
variant: "default",
|
|
2705
2699
|
},
|
|
2706
2700
|
});
|
|
2707
|
-
const
|
|
2701
|
+
const cvaKPITrendPercentage = cvaMerge([""], {
|
|
2708
2702
|
variants: {
|
|
2709
2703
|
color: {
|
|
2710
2704
|
success: ["text-success-500"],
|
|
@@ -2716,7 +2710,7 @@ const cvaKPICardTrendPercentage = cvaMerge([""], {
|
|
|
2716
2710
|
color: "success",
|
|
2717
2711
|
},
|
|
2718
2712
|
});
|
|
2719
|
-
const
|
|
2713
|
+
const cvaKPIValueContainer = cvaMerge(["truncate", "whitespace-nowrap"], {
|
|
2720
2714
|
variants: {
|
|
2721
2715
|
isDefaultAndHasTrendValue: {
|
|
2722
2716
|
true: [],
|
|
@@ -2728,25 +2722,64 @@ const cvaKPICardValueContainer = cvaMerge([], {
|
|
|
2728
2722
|
},
|
|
2729
2723
|
});
|
|
2730
2724
|
|
|
2731
|
-
const LoadingContent$1 = () => (jsx("div", { className: "flex flex-row items-center gap-3", "data-testid": "kpi-card-loading-content", children: jsx("div", { className: "w-full", children: jsx(SkeletonLines, { height: [
|
|
2725
|
+
const LoadingContent$1 = () => (jsx("div", { className: "flex h-11 flex-row items-center gap-3", "data-testid": "kpi-card-loading-content", children: jsx("div", { className: "w-full", children: jsx(SkeletonLines, { height: [14, 18], lines: 2, margin: "3px 0", width: [100, 70] }) }) }));
|
|
2732
2726
|
/**
|
|
2733
|
-
* The
|
|
2727
|
+
* The KPI component is used to display KPIs.
|
|
2734
2728
|
*
|
|
2735
|
-
* @param {
|
|
2736
|
-
* @returns {ReactElement}
|
|
2729
|
+
* @param {KPIProps} props - The props for the KPI component
|
|
2730
|
+
* @returns {ReactElement} KPI component
|
|
2737
2731
|
*/
|
|
2738
|
-
const
|
|
2732
|
+
const KPI = ({ asChild = false, title, value, loading, unit, className, dataTestId, tooltipLabel, variant = "default", trend, ...rest }) => {
|
|
2739
2733
|
const Comp = asChild ? Slot : "div";
|
|
2740
2734
|
const isSmallVariant = variant === "small";
|
|
2741
|
-
return (jsxs(Comp, { className:
|
|
2735
|
+
return (jsxs(Comp, { className: cvaKPIContainer({ className }), "data-testid": `${dataTestId}-comp`, ...rest, children: [jsx(Tooltip, { className: "w-full", disabled: !tooltipLabel, label: tooltipLabel, placement: "bottom", children: jsx("div", { className: cvaKPI({ variant }), children: loading ? (jsx(LoadingContent$1, {})) : (jsxs(Fragment, { children: [jsx(Text, { className: cvaKPITitleText(), dataTestId: `${dataTestId}-title`, size: isSmallVariant ? "small" : "medium", subtle: true, weight: isSmallVariant ? "normal" : "bold", children: title }), jsx(Text, { className: cvaKPIvalueText({ variant }), dataTestId: `${dataTestId}-value`, size: isSmallVariant ? "small" : "large", type: "div", weight: isSmallVariant ? "bold" : "thick", children: jsxs("div", { className: cvaKPIValueContainer({
|
|
2742
2736
|
isDefaultAndHasTrendValue: Boolean(trend?.value && !isSmallVariant),
|
|
2743
|
-
|
|
2737
|
+
className,
|
|
2738
|
+
}), children: [jsxs("span", { className: cvaKPIvalueText({ variant }), children: [value, " ", unit] }), jsx(TrendIndicator, { isSmallVariant: isSmallVariant, trend: trend, unit: unit })] }) })] })) }) }), !loading && jsx(Slottable, { children: rest.children })] }));
|
|
2744
2739
|
};
|
|
2745
2740
|
const TrendIndicator = ({ trend, unit, isSmallVariant }) => {
|
|
2746
2741
|
if (!trend) {
|
|
2747
2742
|
return null;
|
|
2748
2743
|
}
|
|
2749
|
-
return (jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxs(Text, { dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, trend.variant?.icon ? jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxs(Text, { className:
|
|
2744
|
+
return (jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxs(Text, { dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, trend.variant?.icon ? jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxs(Text, { className: cvaKPITrendPercentage({ color: trend.variant?.color }), size: "small", weight: "bold", children: [trend.percentage, "%"] })) : null] }));
|
|
2745
|
+
};
|
|
2746
|
+
|
|
2747
|
+
const cvaKPICard = cvaMerge(["inline-flex", "gap-1", "p-0"], {
|
|
2748
|
+
variants: {
|
|
2749
|
+
isClickable: {
|
|
2750
|
+
true: ["hover:bg-slate-50", "component-card-border"],
|
|
2751
|
+
false: [],
|
|
2752
|
+
},
|
|
2753
|
+
isActive: {
|
|
2754
|
+
true: ["bg-primary-50", "border-primary-600"],
|
|
2755
|
+
false: [],
|
|
2756
|
+
},
|
|
2757
|
+
variant: {
|
|
2758
|
+
small: ["px-3"],
|
|
2759
|
+
condensed: ["px-2"],
|
|
2760
|
+
default: ["min-w-40"],
|
|
2761
|
+
},
|
|
2762
|
+
},
|
|
2763
|
+
defaultVariants: {
|
|
2764
|
+
isClickable: false,
|
|
2765
|
+
isActive: false,
|
|
2766
|
+
variant: "default",
|
|
2767
|
+
},
|
|
2768
|
+
});
|
|
2769
|
+
|
|
2770
|
+
/**
|
|
2771
|
+
* The KPICard component is used to display KPIs.
|
|
2772
|
+
*
|
|
2773
|
+
* @param {KPICardProps} props - The props for the KPICard component
|
|
2774
|
+
* @returns {ReactElement} KPICard component
|
|
2775
|
+
*/
|
|
2776
|
+
const KPICard = ({ isActive, onClick, className, ...rest }) => {
|
|
2777
|
+
return (jsx(Card, { className: cvaKPICard({
|
|
2778
|
+
isClickable: Boolean((onClick || rest.asChild) && !rest.loading),
|
|
2779
|
+
isActive,
|
|
2780
|
+
variant: rest.variant,
|
|
2781
|
+
className,
|
|
2782
|
+
}), dataTestId: `${rest.dataTestId}-card`, onClick: Boolean(onClick || rest.asChild) ? () => onClick?.() : undefined, children: jsx(KPI, { ...rest, className: "overflow-hidden rounded-lg" }) }));
|
|
2750
2783
|
};
|
|
2751
2784
|
|
|
2752
2785
|
const cvaMenuList = cvaMerge([
|
|
@@ -3888,4 +3921,4 @@ const cvaClickable = cvaMerge([
|
|
|
3888
3921
|
},
|
|
3889
3922
|
});
|
|
3890
3923
|
|
|
3891
|
-
export { ActionRenderer, Alert, Badge, Breadcrumb, BreadcrumbContainer, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, EmptyState, EmptyValue, ExternalLink, Heading, Icon, IconButton, Indicator, KPICard, MenuDivider, MenuItem, MenuList, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, PageHeaderKpiMetrics, PageHeaderSecondaryActions, PageHeaderTitle, Pagination, Polygon, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Portal, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, ToggleGroup, ToggleItem, Tooltip, ValueBar, VirtualizedList, WidgetBody, ZStack, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaContainerStyles, cvaIconButton, cvaImgStyles, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaInteractableItem, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemStyle, cvaMenuItemSuffix, cvaPageHeader, cvaPageHeaderContainer, cvaPageHeaderHeading, cvaToggleGroup, cvaToggleItem, cvaToggleItemText, cvaVirtualizedList, cvaVirtualizedListContainer, cvaVirtualizedListItem, cvaZStackContainer, cvaZStackItem, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, useClickOutside, useContainerBreakpoints, useContinuousTimeout, useDebounce, useDevicePixelRatio, useElevatedReducer, useElevatedState, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextTruncated, useOverflowItems, usePopoverContext, usePrompt, useResize, useScrollDetection, useSelfUpdatingRef, useTimeout, useViewportBreakpoints, useWatch, useWindowActivity };
|
|
3924
|
+
export { ActionRenderer, Alert, Badge, Breadcrumb, BreadcrumbContainer, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, EmptyState, EmptyValue, ExternalLink, Heading, Icon, IconButton, Indicator, KPI, KPICard, MenuDivider, MenuItem, MenuList, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, PageHeaderKpiMetrics, PageHeaderSecondaryActions, PageHeaderTitle, Pagination, Polygon, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Portal, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, ToggleGroup, ToggleItem, Tooltip, ValueBar, VirtualizedList, WidgetBody, ZStack, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaContainerStyles, cvaIconButton, cvaImgStyles, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaInteractableItem, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemStyle, cvaMenuItemSuffix, cvaPageHeader, cvaPageHeaderContainer, cvaPageHeaderHeading, cvaToggleGroup, cvaToggleItem, cvaToggleItemText, cvaVirtualizedList, cvaVirtualizedListContainer, cvaVirtualizedListItem, cvaZStackContainer, cvaZStackItem, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, useClickOutside, useContainerBreakpoints, useContinuousTimeout, useDebounce, useDevicePixelRatio, useElevatedReducer, useElevatedState, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextTruncated, useOverflowItems, usePopoverContext, usePrompt, useResize, useScrollDetection, useSelfUpdatingRef, useTimeout, useViewportBreakpoints, useWatch, useWindowActivity };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.42",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"@tanstack/react-router": "1.47.1",
|
|
19
19
|
"string-ts": "^2.0.0",
|
|
20
20
|
"tailwind-merge": "^2.0.0",
|
|
21
|
-
"@trackunit/ui-design-tokens": "1.3.
|
|
22
|
-
"@trackunit/css-class-variance-utilities": "1.3.
|
|
23
|
-
"@trackunit/shared-utils": "1.5.
|
|
24
|
-
"@trackunit/ui-icons": "1.3.
|
|
25
|
-
"@trackunit/react-table-pagination": "1.3.
|
|
21
|
+
"@trackunit/ui-design-tokens": "1.3.38",
|
|
22
|
+
"@trackunit/css-class-variance-utilities": "1.3.38",
|
|
23
|
+
"@trackunit/shared-utils": "1.5.38",
|
|
24
|
+
"@trackunit/ui-icons": "1.3.38",
|
|
25
|
+
"@trackunit/react-table-pagination": "1.3.39"
|
|
26
26
|
},
|
|
27
27
|
"module": "./index.esm.js",
|
|
28
28
|
"main": "./index.cjs.js",
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { CommonProps } from "../../common";
|
|
3
|
+
export interface KPIProps extends CommonProps {
|
|
4
|
+
/**
|
|
5
|
+
* The title of the KPI Card
|
|
6
|
+
*/
|
|
7
|
+
title: string;
|
|
8
|
+
/**
|
|
9
|
+
* The value of the KPI Card
|
|
10
|
+
*/
|
|
11
|
+
value: string | number;
|
|
12
|
+
/**
|
|
13
|
+
* The unit of the KPI Card
|
|
14
|
+
*/
|
|
15
|
+
unit: string;
|
|
16
|
+
/**
|
|
17
|
+
* Whether or not to show the loading state
|
|
18
|
+
*/
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Use asChild to render the KPI as another component
|
|
22
|
+
*/
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Only add when asChild is true.
|
|
26
|
+
* The child element is used to wrap the KPI component to set it to another HTML element.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <KPI {...props}>
|
|
30
|
+
* <Link to="/" />
|
|
31
|
+
* </KPI>
|
|
32
|
+
*/
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Label for the tooltip
|
|
36
|
+
*/
|
|
37
|
+
tooltipLabel?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The size of the KPI Card
|
|
40
|
+
*/
|
|
41
|
+
variant?: "small" | "default" | "condensed";
|
|
42
|
+
/**
|
|
43
|
+
* The trend of the KPI Card
|
|
44
|
+
*/
|
|
45
|
+
trend?: {
|
|
46
|
+
/**
|
|
47
|
+
* The value of the trend
|
|
48
|
+
*/
|
|
49
|
+
value?: number | string;
|
|
50
|
+
/**
|
|
51
|
+
* The percentage of the trend
|
|
52
|
+
*/
|
|
53
|
+
percentage?: number | string;
|
|
54
|
+
/**
|
|
55
|
+
* The variant of the trend
|
|
56
|
+
*/
|
|
57
|
+
variant?: {
|
|
58
|
+
/**
|
|
59
|
+
* The icon of the trend
|
|
60
|
+
*/
|
|
61
|
+
icon?: "ArrowUp" | "ArrowDown" | "ArrowTrendingUp" | "ArrowTrendingDown";
|
|
62
|
+
/**
|
|
63
|
+
* The color of the trend
|
|
64
|
+
*/
|
|
65
|
+
color?: "success" | "danger" | "neutral";
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The KPI component is used to display KPIs.
|
|
71
|
+
*
|
|
72
|
+
* @param {KPIProps} props - The props for the KPI component
|
|
73
|
+
* @returns {ReactElement} KPI component
|
|
74
|
+
*/
|
|
75
|
+
export declare const KPI: ({ asChild, title, value, loading, unit, className, dataTestId, tooltipLabel, variant, trend, ...rest }: KPIProps) => ReactElement;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const cvaKPIContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaKPI: (props?: ({
|
|
3
|
+
variant?: "default" | "small" | "condensed" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
5
|
+
export declare const cvaKPITitleText: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
6
|
+
export declare const cvaKPIvalueText: (props?: ({
|
|
7
|
+
variant?: "default" | "small" | "condensed" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
9
|
+
export declare const cvaKPITrendPercentage: (props?: ({
|
|
10
|
+
color?: "success" | "danger" | "neutral" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
12
|
+
export declare const cvaKPIValueContainer: (props?: ({
|
|
13
|
+
isDefaultAndHasTrendValue?: boolean | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -1,74 +1,10 @@
|
|
|
1
|
-
import { ReactElement
|
|
2
|
-
import {
|
|
3
|
-
export interface KPICardProps extends
|
|
4
|
-
/**
|
|
5
|
-
* The title of the KPI Card
|
|
6
|
-
*/
|
|
7
|
-
title: string;
|
|
8
|
-
/**
|
|
9
|
-
* The value of the KPI Card
|
|
10
|
-
*/
|
|
11
|
-
value: string | number;
|
|
12
|
-
/**
|
|
13
|
-
* The unit of the KPI Card
|
|
14
|
-
*/
|
|
15
|
-
unit: string;
|
|
16
|
-
/**
|
|
17
|
-
* Whether or not to show the loading state
|
|
18
|
-
*/
|
|
19
|
-
loading?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Use asChild to render the KPICard as another component
|
|
22
|
-
*/
|
|
23
|
-
asChild?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Only add when asChild is true.
|
|
26
|
-
* The child element is used to wrap the KPICard component to set it to another HTML element.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* <KPICard {...props}>
|
|
30
|
-
* <Link to="/" />
|
|
31
|
-
* </KPICard>
|
|
32
|
-
*/
|
|
33
|
-
children?: ReactNode;
|
|
34
|
-
/**
|
|
35
|
-
* Label for the tooltip
|
|
36
|
-
*/
|
|
37
|
-
tooltipLabel?: string;
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { KPIProps } from "../KPI/KPI";
|
|
3
|
+
export interface KPICardProps extends KPIProps {
|
|
38
4
|
/**
|
|
39
5
|
* Is the kpi card active
|
|
40
6
|
*/
|
|
41
7
|
isActive?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* The size of the KPI Card
|
|
44
|
-
*/
|
|
45
|
-
variant?: "small" | "default";
|
|
46
|
-
/**
|
|
47
|
-
* The trend of the KPI Card
|
|
48
|
-
*/
|
|
49
|
-
trend?: {
|
|
50
|
-
/**
|
|
51
|
-
* The value of the trend
|
|
52
|
-
*/
|
|
53
|
-
value?: number | string;
|
|
54
|
-
/**
|
|
55
|
-
* The percentage of the trend
|
|
56
|
-
*/
|
|
57
|
-
percentage?: number | string;
|
|
58
|
-
/**
|
|
59
|
-
* The variant of the trend
|
|
60
|
-
*/
|
|
61
|
-
variant?: {
|
|
62
|
-
/**
|
|
63
|
-
* The icon of the trend
|
|
64
|
-
*/
|
|
65
|
-
icon?: "ArrowUp" | "ArrowDown" | "ArrowTrendingUp" | "ArrowTrendingDown";
|
|
66
|
-
/**
|
|
67
|
-
* The color of the trend
|
|
68
|
-
*/
|
|
69
|
-
color?: "success" | "danger" | "neutral";
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
8
|
/**
|
|
73
9
|
* On kpi card click handler
|
|
74
10
|
*/
|
|
@@ -80,4 +16,4 @@ export interface KPICardProps extends CommonProps {
|
|
|
80
16
|
* @param {KPICardProps} props - The props for the KPICard component
|
|
81
17
|
* @returns {ReactElement} KPICard component
|
|
82
18
|
*/
|
|
83
|
-
export declare const KPICard: ({
|
|
19
|
+
export declare const KPICard: ({ isActive, onClick, className, ...rest }: KPICardProps) => ReactElement;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
export declare const cvaKPICardContainer: (props?: ({
|
|
2
|
-
isClickable?: boolean | null | undefined;
|
|
3
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
4
1
|
export declare const cvaKPICard: (props?: ({
|
|
5
2
|
isClickable?: boolean | null | undefined;
|
|
6
3
|
isActive?: boolean | null | undefined;
|
|
7
|
-
variant?: "default" | "small" | null | undefined;
|
|
8
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
9
|
-
export declare const cvaKPICardTrendPercentage: (props?: ({
|
|
10
|
-
color?: "success" | "danger" | "neutral" | null | undefined;
|
|
11
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
12
|
-
export declare const cvaKPICardValueContainer: (props?: ({
|
|
13
|
-
isDefaultAndHasTrendValue?: boolean | null | undefined;
|
|
4
|
+
variant?: "default" | "small" | "condensed" | null | undefined;
|
|
14
5
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -13,6 +13,7 @@ export * from "./ExternalLink/ExternalLink";
|
|
|
13
13
|
export * from "./Heading";
|
|
14
14
|
export * from "./Icon/Icon";
|
|
15
15
|
export * from "./Indicator";
|
|
16
|
+
export * from "./KPI/KPI";
|
|
16
17
|
export * from "./KPICard/KPICard";
|
|
17
18
|
export * from "./Menu";
|
|
18
19
|
export * from "./Notice";
|