@trackunit/react-components 1.9.4 → 1.9.6
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
|
@@ -930,18 +930,22 @@ const cvaBadge = cssClassVarianceUtilities.cvaMerge([
|
|
|
930
930
|
"font-bold",
|
|
931
931
|
"text-center",
|
|
932
932
|
"tabular-nums",
|
|
933
|
-
"text-xs",
|
|
934
933
|
], {
|
|
935
934
|
variants: {
|
|
936
935
|
color: {
|
|
937
|
-
primary: "bg-
|
|
936
|
+
primary: "bg-primary-600 text-white",
|
|
938
937
|
danger: "bg-danger-600 text-white",
|
|
939
938
|
warning: "bg-warning-600 text-white",
|
|
939
|
+
neutral: "bg-neutral-500 text-white",
|
|
940
940
|
},
|
|
941
941
|
compact: {
|
|
942
942
|
true: "size-2",
|
|
943
943
|
false: "h-fit min-h-4 w-fit min-w-4",
|
|
944
944
|
},
|
|
945
|
+
size: {
|
|
946
|
+
default: "text-xs",
|
|
947
|
+
condensed: "h-3.5 min-h-3.5 min-w-3.5 text-[10px]",
|
|
948
|
+
},
|
|
945
949
|
isSingleChar: {
|
|
946
950
|
true: "aspect-square",
|
|
947
951
|
false: "px-1",
|
|
@@ -953,9 +957,15 @@ const cvaBadge = cssClassVarianceUtilities.cvaMerge([
|
|
|
953
957
|
compact: false,
|
|
954
958
|
className: "px-1",
|
|
955
959
|
},
|
|
960
|
+
{
|
|
961
|
+
isSingleChar: false,
|
|
962
|
+
size: "condensed",
|
|
963
|
+
className: "px-[3px] py-0",
|
|
964
|
+
},
|
|
956
965
|
],
|
|
957
966
|
defaultVariants: {
|
|
958
967
|
color: "primary",
|
|
968
|
+
size: "default",
|
|
959
969
|
},
|
|
960
970
|
});
|
|
961
971
|
|
|
@@ -970,7 +980,7 @@ const cvaBadge = cssClassVarianceUtilities.cvaMerge([
|
|
|
970
980
|
* @param {BadgeProps} props - The props for the Badge component
|
|
971
981
|
* @returns {ReactElement} Badge component
|
|
972
982
|
*/
|
|
973
|
-
const Badge = ({ color = "primary", compact = false, className, count, max, hideZero = false, dataTestId, }) => {
|
|
983
|
+
const Badge = ({ color = "primary", size = "default", compact = false, className, count, max, hideZero = false, dataTestId, }) => {
|
|
974
984
|
if (hideZero && count === 0) {
|
|
975
985
|
return null;
|
|
976
986
|
}
|
|
@@ -980,7 +990,7 @@ const Badge = ({ color = "primary", compact = false, className, count, max, hide
|
|
|
980
990
|
: count
|
|
981
991
|
: count;
|
|
982
992
|
const isSingleChar = displayedCount?.toString().length === 1;
|
|
983
|
-
return (jsxRuntime.jsx("span", { className: cvaBadge({ color, className, compact, isSingleChar }), "data-testid": dataTestId, children: compact ? null : displayedCount }));
|
|
993
|
+
return (jsxRuntime.jsx("span", { className: cvaBadge({ color, size, className, compact, isSingleChar }), "data-testid": dataTestId, children: compact ? null : displayedCount }));
|
|
984
994
|
};
|
|
985
995
|
|
|
986
996
|
/**
|
package/index.esm.js
CHANGED
|
@@ -928,18 +928,22 @@ const cvaBadge = cvaMerge([
|
|
|
928
928
|
"font-bold",
|
|
929
929
|
"text-center",
|
|
930
930
|
"tabular-nums",
|
|
931
|
-
"text-xs",
|
|
932
931
|
], {
|
|
933
932
|
variants: {
|
|
934
933
|
color: {
|
|
935
|
-
primary: "bg-
|
|
934
|
+
primary: "bg-primary-600 text-white",
|
|
936
935
|
danger: "bg-danger-600 text-white",
|
|
937
936
|
warning: "bg-warning-600 text-white",
|
|
937
|
+
neutral: "bg-neutral-500 text-white",
|
|
938
938
|
},
|
|
939
939
|
compact: {
|
|
940
940
|
true: "size-2",
|
|
941
941
|
false: "h-fit min-h-4 w-fit min-w-4",
|
|
942
942
|
},
|
|
943
|
+
size: {
|
|
944
|
+
default: "text-xs",
|
|
945
|
+
condensed: "h-3.5 min-h-3.5 min-w-3.5 text-[10px]",
|
|
946
|
+
},
|
|
943
947
|
isSingleChar: {
|
|
944
948
|
true: "aspect-square",
|
|
945
949
|
false: "px-1",
|
|
@@ -951,9 +955,15 @@ const cvaBadge = cvaMerge([
|
|
|
951
955
|
compact: false,
|
|
952
956
|
className: "px-1",
|
|
953
957
|
},
|
|
958
|
+
{
|
|
959
|
+
isSingleChar: false,
|
|
960
|
+
size: "condensed",
|
|
961
|
+
className: "px-[3px] py-0",
|
|
962
|
+
},
|
|
954
963
|
],
|
|
955
964
|
defaultVariants: {
|
|
956
965
|
color: "primary",
|
|
966
|
+
size: "default",
|
|
957
967
|
},
|
|
958
968
|
});
|
|
959
969
|
|
|
@@ -968,7 +978,7 @@ const cvaBadge = cvaMerge([
|
|
|
968
978
|
* @param {BadgeProps} props - The props for the Badge component
|
|
969
979
|
* @returns {ReactElement} Badge component
|
|
970
980
|
*/
|
|
971
|
-
const Badge = ({ color = "primary", compact = false, className, count, max, hideZero = false, dataTestId, }) => {
|
|
981
|
+
const Badge = ({ color = "primary", size = "default", compact = false, className, count, max, hideZero = false, dataTestId, }) => {
|
|
972
982
|
if (hideZero && count === 0) {
|
|
973
983
|
return null;
|
|
974
984
|
}
|
|
@@ -978,7 +988,7 @@ const Badge = ({ color = "primary", compact = false, className, count, max, hide
|
|
|
978
988
|
: count
|
|
979
989
|
: count;
|
|
980
990
|
const isSingleChar = displayedCount?.toString().length === 1;
|
|
981
|
-
return (jsx("span", { className: cvaBadge({ color, className, compact, isSingleChar }), "data-testid": dataTestId, children: compact ? null : displayedCount }));
|
|
991
|
+
return (jsx("span", { className: cvaBadge({ color, size, className, compact, isSingleChar }), "data-testid": dataTestId, children: compact ? null : displayedCount }));
|
|
982
992
|
};
|
|
983
993
|
|
|
984
994
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.6",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@trackunit/ui-design-tokens": "1.7.4",
|
|
20
20
|
"@trackunit/css-class-variance-utilities": "1.7.4",
|
|
21
21
|
"@trackunit/shared-utils": "1.9.4",
|
|
22
|
-
"@trackunit/ui-icons": "1.7.
|
|
22
|
+
"@trackunit/ui-icons": "1.7.5",
|
|
23
23
|
"@trackunit/react-table-pagination": "1.7.4",
|
|
24
24
|
"@trackunit/react-test-setup": "1.4.4",
|
|
25
25
|
"@tanstack/react-router": "1.114.29",
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { ThemeColors } from "@trackunit/ui-design-tokens";
|
|
2
2
|
import { ReactElement } from "react";
|
|
3
3
|
import { CommonProps } from "../../common/CommonProps";
|
|
4
|
-
type BadgeColors = Extract<ThemeColors, "primary" | "danger" | "warning">;
|
|
4
|
+
type BadgeColors = Extract<ThemeColors, "primary" | "danger" | "warning" | "neutral">;
|
|
5
|
+
type BadgeSize = "default" | "condensed";
|
|
5
6
|
interface BaseBadgeProps extends CommonProps {
|
|
6
7
|
/**
|
|
7
8
|
* The color of the badge.
|
|
8
9
|
*/
|
|
9
10
|
color?: BadgeColors;
|
|
11
|
+
/**
|
|
12
|
+
* The size of the badge.
|
|
13
|
+
*/
|
|
14
|
+
size?: BadgeSize;
|
|
10
15
|
/**
|
|
11
16
|
* Custom classNames can be added to make adjustments where needed.
|
|
12
17
|
* Example: Set a maximum width of the badge by adding the className "max-w-[your-max-width]" or similar tailwind max-w class.
|
|
@@ -43,5 +48,5 @@ export type BadgeProps = BaseBadgeProps;
|
|
|
43
48
|
* @param {BadgeProps} props - The props for the Badge component
|
|
44
49
|
* @returns {ReactElement} Badge component
|
|
45
50
|
*/
|
|
46
|
-
export declare const Badge: ({ color, compact, className, count, max, hideZero, dataTestId, }: BadgeProps) => ReactElement | null;
|
|
51
|
+
export declare const Badge: ({ color, size, compact, className, count, max, hideZero, dataTestId, }: BadgeProps) => ReactElement | null;
|
|
47
52
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const cvaBadge: (props?: ({
|
|
2
|
-
color?: "primary" | "danger" | "warning" | null | undefined;
|
|
2
|
+
color?: "primary" | "danger" | "warning" | "neutral" | null | undefined;
|
|
3
3
|
compact?: boolean | null | undefined;
|
|
4
|
+
size?: "default" | "condensed" | null | undefined;
|
|
4
5
|
isSingleChar?: boolean | null | undefined;
|
|
5
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|