@trackunit/react-components 1.7.28 → 1.7.31

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
@@ -2943,7 +2943,7 @@ const LoadingContent$1 = () => (jsxRuntime.jsx("div", { className: "flex h-11 fl
2943
2943
  * @param {KPIProps} props - The props for the KPI component
2944
2944
  * @returns {ReactElement} KPI component
2945
2945
  */
2946
- const KPI = ({ title, value, loading, unit, className, dataTestId, tooltipLabel, variant = "default", trend, iconName, iconColor = "info", ...rest }) => {
2946
+ const KPI = ({ title, value, loading, unit, className, dataTestId, tooltipLabel, variant = "default", trend, ...rest }) => {
2947
2947
  const isSmallVariant = variant === "small";
2948
2948
  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
2949
  isDefaultAndHasTrendValue: Boolean(trend?.value && !isSmallVariant),
@@ -2975,16 +2975,10 @@ const cvaKPICard = cssClassVarianceUtilities.cvaMerge([
2975
2975
  true: ["bg-primary-50", "border-primary-600"],
2976
2976
  false: [],
2977
2977
  },
2978
- variant: {
2979
- small: ["px-3"],
2980
- condensed: ["px-2"],
2981
- default: ["min-w-40"],
2982
- },
2983
2978
  },
2984
2979
  defaultVariants: {
2985
2980
  isClickable: false,
2986
2981
  isActive: false,
2987
- variant: "default",
2988
2982
  },
2989
2983
  });
2990
2984
  const cvaKPIIconContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "justify-center", "w-7", "h-7", "rounded-md", "text-white"], {
@@ -3005,15 +2999,14 @@ const cvaKPIIconContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-c
3005
2999
  * @param {KPICardProps} props - The props for the KPICard component
3006
3000
  * @returns {ReactElement} KPICard component
3007
3001
  */
3008
- const KPICard = ({ isActive, onClick, className, dataTestId, children, ...rest }) => {
3002
+ const KPICard = ({ isActive, onClick, className, dataTestId, children, iconName, iconColor, ...rest }) => {
3009
3003
  const isClickable = Boolean(onClick && !rest.loading);
3010
3004
  return (jsxRuntime.jsx(Card, { className: cvaKPICard({
3011
3005
  isClickable,
3012
3006
  isActive,
3013
3007
  minHeight: rest.trend ? "withTrends" : "default",
3014
- variant: rest.variant,
3015
3008
  className,
3016
- }), "data-testid": dataTestId ? dataTestId : undefined, onClick: onClick, children: jsxRuntime.jsxs(CardBody, { className: cvaCardBodyDensityContainer({ iconName: Boolean(rest.iconName) }), density: "none", children: [jsxRuntime.jsx(KPI, { ...rest, className: tailwindMerge.twMerge(rest.iconName ? "gap-2" : "", "p-0"), dataTestId: dataTestId ? `${dataTestId}-kpi` : undefined }), rest.iconName ? (jsxRuntime.jsx("div", { className: cvaKPIIconContainer({ iconColor: rest.iconColor ?? "info" }), children: jsxRuntime.jsx(Icon, { name: rest.iconName, size: "small", type: "solid" }) })) : null, children] }) }));
3009
+ }), "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
3010
  };
3018
3011
  const cvaCardBodyDensityContainer = cssClassVarianceUtilities.cvaMerge(["grid", "grid-cols-[1fr_auto]"], {
3019
3012
  variants: {
package/index.esm.js CHANGED
@@ -2941,7 +2941,7 @@ const LoadingContent$1 = () => (jsx("div", { className: "flex h-11 flex-row item
2941
2941
  * @param {KPIProps} props - The props for the KPI component
2942
2942
  * @returns {ReactElement} KPI component
2943
2943
  */
2944
- const KPI = ({ title, value, loading, unit, className, dataTestId, tooltipLabel, variant = "default", trend, iconName, iconColor = "info", ...rest }) => {
2944
+ const KPI = ({ title, value, loading, unit, className, dataTestId, tooltipLabel, variant = "default", trend, ...rest }) => {
2945
2945
  const isSmallVariant = variant === "small";
2946
2946
  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
2947
  isDefaultAndHasTrendValue: Boolean(trend?.value && !isSmallVariant),
@@ -2973,16 +2973,10 @@ const cvaKPICard = cvaMerge([
2973
2973
  true: ["bg-primary-50", "border-primary-600"],
2974
2974
  false: [],
2975
2975
  },
2976
- variant: {
2977
- small: ["px-3"],
2978
- condensed: ["px-2"],
2979
- default: ["min-w-40"],
2980
- },
2981
2976
  },
2982
2977
  defaultVariants: {
2983
2978
  isClickable: false,
2984
2979
  isActive: false,
2985
- variant: "default",
2986
2980
  },
2987
2981
  });
2988
2982
  const cvaKPIIconContainer = cvaMerge(["flex", "items-center", "justify-center", "w-7", "h-7", "rounded-md", "text-white"], {
@@ -3003,15 +2997,14 @@ const cvaKPIIconContainer = cvaMerge(["flex", "items-center", "justify-center",
3003
2997
  * @param {KPICardProps} props - The props for the KPICard component
3004
2998
  * @returns {ReactElement} KPICard component
3005
2999
  */
3006
- const KPICard = ({ isActive, onClick, className, dataTestId, children, ...rest }) => {
3000
+ const KPICard = ({ isActive, onClick, className, dataTestId, children, iconName, iconColor, ...rest }) => {
3007
3001
  const isClickable = Boolean(onClick && !rest.loading);
3008
3002
  return (jsx(Card, { className: cvaKPICard({
3009
3003
  isClickable,
3010
3004
  isActive,
3011
3005
  minHeight: rest.trend ? "withTrends" : "default",
3012
- variant: rest.variant,
3013
3006
  className,
3014
- }), "data-testid": dataTestId ? dataTestId : undefined, onClick: onClick, children: jsxs(CardBody, { className: cvaCardBodyDensityContainer({ iconName: Boolean(rest.iconName) }), density: "none", children: [jsx(KPI, { ...rest, className: twMerge(rest.iconName ? "gap-2" : "", "p-0"), dataTestId: dataTestId ? `${dataTestId}-kpi` : undefined }), rest.iconName ? (jsx("div", { className: cvaKPIIconContainer({ iconColor: rest.iconColor ?? "info" }), children: jsx(Icon, { name: rest.iconName, size: "small", type: "solid" }) })) : null, children] }) }));
3007
+ }), "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
3008
  };
3016
3009
  const cvaCardBodyDensityContainer = cvaMerge(["grid", "grid-cols-[1fr_auto]"], {
3017
3010
  variants: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.7.28",
3
+ "version": "1.7.31",
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.22",
21
- "@trackunit/css-class-variance-utilities": "1.6.21",
22
- "@trackunit/shared-utils": "1.8.21",
23
- "@trackunit/ui-icons": "1.6.20",
24
- "@trackunit/react-table-pagination": "1.6.20",
25
- "@trackunit/react-test-setup": "1.3.21",
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 Card
5
+ * The title of the KPI
7
6
  */
8
7
  title: string;
9
8
  /**
10
- * The value of the KPI Card
9
+ * The value of the KPI
11
10
  */
12
11
  value: string | number;
13
12
  /**
14
- * The unit of the KPI Card
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 Card
25
+ * The size of the KPI
27
26
  */
28
27
  variant?: "small" | "default" | "condensed";
29
28
  /**
30
- * The icon name to be displayed
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, iconName, iconColor, ...rest }: KPIProps) => ReactElement;
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;