@trackunit/react-components 1.12.11 → 1.13.0
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 +216 -178
- package/index.esm.js +217 -181
- package/package.json +5 -5
- package/src/components/KPI/KPI.d.ts +1 -27
- package/src/components/KPI/KPI.variants.d.ts +1 -9
- package/src/components/KPICard/KPICard.d.ts +18 -2
- package/src/components/KPICard/KPICard.variants.d.ts +0 -3
- package/src/components/KPICard/components/TrendIndicator/TrendIndicator.d.ts +32 -0
- package/src/components/KPICard/components/TrendIndicators.d.ts +13 -0
- package/src/components/List/List.d.ts +2 -0
- package/src/components/Notice/Notice.d.ts +15 -5
- package/src/components/Spacer/Spacer.d.ts +12 -1
- package/src/components/Tag/Tag.d.ts +1 -4
- package/src/components/Tag/Tag.variants.d.ts +8 -1
- package/src/index.d.ts +2 -0
|
@@ -26,32 +26,6 @@ export interface KPIProps extends CommonProps, Styleable {
|
|
|
26
26
|
* The size of the KPI
|
|
27
27
|
*/
|
|
28
28
|
variant?: "small" | "default" | "condensed";
|
|
29
|
-
/**
|
|
30
|
-
* The trend of the KPI
|
|
31
|
-
*/
|
|
32
|
-
trend?: {
|
|
33
|
-
/**
|
|
34
|
-
* The value of the trend
|
|
35
|
-
*/
|
|
36
|
-
value?: number | string;
|
|
37
|
-
/**
|
|
38
|
-
* The percentage of the trend
|
|
39
|
-
*/
|
|
40
|
-
percentage?: number | string;
|
|
41
|
-
/**
|
|
42
|
-
* The variant of the trend
|
|
43
|
-
*/
|
|
44
|
-
variant?: {
|
|
45
|
-
/**
|
|
46
|
-
* The icon of the trend
|
|
47
|
-
*/
|
|
48
|
-
icon?: "ArrowUp" | "ArrowDown" | "ArrowTrendingUp" | "ArrowTrendingDown";
|
|
49
|
-
/**
|
|
50
|
-
* The color of the trend
|
|
51
|
-
*/
|
|
52
|
-
color?: "success" | "danger" | "neutral";
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
29
|
}
|
|
56
30
|
/**
|
|
57
31
|
* The KPI component is used to display KPIs.
|
|
@@ -59,4 +33,4 @@ export interface KPIProps extends CommonProps, Styleable {
|
|
|
59
33
|
* @param {KPIProps} props - The props for the KPI component
|
|
60
34
|
* @returns {ReactElement} KPI component
|
|
61
35
|
*/
|
|
62
|
-
export declare const KPI: ({ title, value, loading, unit, className, "data-testid": dataTestId, tooltipLabel, variant,
|
|
36
|
+
export declare const KPI: ({ title, value, loading, unit, className, "data-testid": dataTestId, tooltipLabel, variant, style, ...rest }: KPIProps) => ReactElement;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
export declare const cvaKPI: (props?: ({
|
|
2
2
|
variant?: "default" | "small" | "condensed" | null | undefined;
|
|
3
3
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
4
|
-
export declare const cvaKPIHeader: (props?: 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
4
|
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;
|
|
5
|
+
color?: "success" | "danger" | "warning" | "neutral" | "info" | null | undefined;
|
|
14
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { MappedOmit } from "@trackunit/shared-utils";
|
|
2
2
|
import { IconName } from "@trackunit/ui-icons";
|
|
3
3
|
import { ReactElement, ReactNode } from "react";
|
|
4
|
+
import { IconColors } from "../Icon/Icon";
|
|
4
5
|
import { KPIProps } from "../KPI/KPI";
|
|
6
|
+
import { NoticeProps } from "../Notice";
|
|
7
|
+
import { ValueBarProps } from "../ValueBar";
|
|
8
|
+
import { TrendIndicatorProps } from "./components/TrendIndicator/TrendIndicator";
|
|
5
9
|
export interface KPICardProps extends MappedOmit<KPIProps, "variant"> {
|
|
6
10
|
/**
|
|
7
11
|
* Is the kpi card active
|
|
@@ -22,7 +26,19 @@ export interface KPICardProps extends MappedOmit<KPIProps, "variant"> {
|
|
|
22
26
|
/**
|
|
23
27
|
* The color of the icon
|
|
24
28
|
*/
|
|
25
|
-
iconColor?: "success" | "warning" | "danger" | "info" | "neutral"
|
|
29
|
+
iconColor?: Extract<IconColors, "success" | "warning" | "danger" | "info" | "neutral">;
|
|
30
|
+
/**
|
|
31
|
+
* The trends to display in the KPI
|
|
32
|
+
*/
|
|
33
|
+
trends?: Array<Omit<TrendIndicatorProps, "className" | "dataTestId">>;
|
|
34
|
+
/**
|
|
35
|
+
* The notice to display in the KPI
|
|
36
|
+
*/
|
|
37
|
+
notice?: Pick<NoticeProps, "label" | "iconName" | "iconColor">;
|
|
38
|
+
/**
|
|
39
|
+
* Value bar to display in the KPI
|
|
40
|
+
*/
|
|
41
|
+
valueBar?: Omit<ValueBarProps, "className" | "dataTestId" | "size" | "valueColor">;
|
|
26
42
|
}
|
|
27
43
|
/**
|
|
28
44
|
* The KPICard component is used to display KPIs.
|
|
@@ -30,4 +46,4 @@ export interface KPICardProps extends MappedOmit<KPIProps, "variant"> {
|
|
|
30
46
|
* @param {KPICardProps} props - The props for the KPICard component
|
|
31
47
|
* @returns {ReactElement} KPICard component
|
|
32
48
|
*/
|
|
33
|
-
export declare const KPICard: ({ isActive, onClick, className, "data-testid": dataTestId, children, iconName, iconColor, loading, ...rest }: KPICardProps) => ReactElement;
|
|
49
|
+
export declare const KPICard: ({ isActive, onClick, className, "data-testid": dataTestId, children, iconName, iconColor, loading, notice, valueBar, trends, unit, ...rest }: KPICardProps) => ReactElement;
|
|
@@ -5,6 +5,3 @@ export declare const cvaKPICard: (props?: ({
|
|
|
5
5
|
export declare const cvaKPIIconContainer: (props?: ({
|
|
6
6
|
iconColor?: "success" | "warning" | "danger" | "info" | "neutral" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
|
-
export declare const cvaCardBodyContainer: (props?: ({
|
|
9
|
-
iconName?: boolean | null | undefined;
|
|
10
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { CommonProps } from "../../../../common/CommonProps";
|
|
3
|
+
import { KPICardProps } from "../../KPICard";
|
|
4
|
+
export interface TrendIndicatorProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* The absolute value
|
|
7
|
+
*/
|
|
8
|
+
value?: string | number;
|
|
9
|
+
/**
|
|
10
|
+
* The trend of the value
|
|
11
|
+
*/
|
|
12
|
+
trend: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* A short description of the trend
|
|
15
|
+
*/
|
|
16
|
+
label?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The trend icon
|
|
19
|
+
*/
|
|
20
|
+
icon?: "ArrowUp" | "ArrowDown" | "ArrowTrendingUp" | "ArrowTrendingDown";
|
|
21
|
+
/**
|
|
22
|
+
* The color of the trend icon
|
|
23
|
+
*/
|
|
24
|
+
color?: KPICardProps["iconColor"];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The TrendIndicator component is used within the KPI Card component to display the trend indicator.
|
|
28
|
+
*
|
|
29
|
+
* @param {TrendIndicatorProps} props - The props for the TrendIndicator component
|
|
30
|
+
* @returns {ReactElement} TrendIndicator component
|
|
31
|
+
*/
|
|
32
|
+
export declare const TrendIndicator: ({ value, trend, label, icon, color, "data-testid": dataTestId, className, }: TrendIndicatorProps) => ReactElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { CommonProps } from "../../../common/CommonProps";
|
|
3
|
+
import { TrendIndicatorProps } from "./TrendIndicator/TrendIndicator";
|
|
4
|
+
export interface TrendIndicatorsProps extends CommonProps {
|
|
5
|
+
trends: Array<Omit<TrendIndicatorProps, "className" | "data-testid">>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The TrendIndicators component is used within the KPI Card component to display the trend indicators.
|
|
9
|
+
*
|
|
10
|
+
* @param {TrendIndicatorsProps} props - The props for the TrendIndicators component
|
|
11
|
+
* @returns {ReactElement} TrendIndicators component
|
|
12
|
+
*/
|
|
13
|
+
export declare const TrendIndicators: ({ trends, "data-testid": dataTestId, className, }: TrendIndicatorsProps) => ReactElement;
|
|
@@ -52,6 +52,7 @@ export interface ListProps<TItem = unknown> extends CommonProps, UseListResult<T
|
|
|
52
52
|
*
|
|
53
53
|
* @example Basic usage
|
|
54
54
|
* ```tsx
|
|
55
|
+
* import { useList, List } from "@trackunit/react-components";
|
|
55
56
|
* const list = useList({
|
|
56
57
|
* count: items.length,
|
|
57
58
|
* getItem: index => items[index],
|
|
@@ -68,6 +69,7 @@ export interface ListProps<TItem = unknown> extends CommonProps, UseListResult<T
|
|
|
68
69
|
* ```
|
|
69
70
|
* @example With header
|
|
70
71
|
* ```tsx
|
|
72
|
+
* import { useList, List } from "@trackunit/react-components";
|
|
71
73
|
* const list = useList({
|
|
72
74
|
* count: items.length,
|
|
73
75
|
* getItem: index => items[index],
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
|
|
2
|
+
import { IconName } from "@trackunit/ui-icons";
|
|
2
3
|
import { ReactElement } from "react";
|
|
3
4
|
import { CommonProps } from "../../common/CommonProps";
|
|
5
|
+
import { Size } from "../../common/Size";
|
|
4
6
|
export interface NoticeProps extends CommonProps {
|
|
5
7
|
/**
|
|
6
|
-
* The
|
|
8
|
+
* The name of the icon
|
|
7
9
|
*/
|
|
8
|
-
|
|
10
|
+
iconName?: IconName;
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
12
|
+
* The size of the icon
|
|
13
|
+
*/
|
|
14
|
+
iconSize?: Size;
|
|
15
|
+
/**
|
|
16
|
+
* The color of the icon. Icon color overrides the color prop.
|
|
17
|
+
*/
|
|
18
|
+
iconColor?: NoticeProps["color"];
|
|
19
|
+
/**
|
|
20
|
+
* A color token used to style both the text and icon
|
|
11
21
|
*/
|
|
12
22
|
color?: Extract<GeneralColors, "neutral"> | IntentColors;
|
|
13
23
|
/**
|
|
@@ -37,8 +47,8 @@ export interface NoticeProps extends CommonProps {
|
|
|
37
47
|
* _**Do use** notices to communicate non-essential information that does not necessarily require action to be taken._
|
|
38
48
|
*
|
|
39
49
|
* _**Do not use** notices for essential information (use `<Alert/>` instead), or to communicate information related to the state of an asset (use `<Indicator/>` instead)._
|
|
40
|
-
|
|
50
|
+
*
|
|
41
51
|
* @param {NoticeProps} props - The props for the Notice component
|
|
42
52
|
* @returns {ReactElement} Notice component
|
|
43
53
|
*/
|
|
44
|
-
export declare const Notice: ({ "data-testid": dataTestId,
|
|
54
|
+
export declare const Notice: ({ "data-testid": dataTestId, iconName, iconSize, iconColor, label, color, withLabel, className, tooltipLabel, withTooltip, size, ...rest }: NoticeProps) => ReactElement;
|
|
@@ -14,7 +14,18 @@ export interface SpacerProps extends CommonProps {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* The Spacer component is used for adding a bit of space in the ui.
|
|
17
|
-
|
|
17
|
+
*
|
|
18
|
+
* @example basic usage
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { Spacer } from "@trackunit/react-components";
|
|
21
|
+
* const MySpacer = () => {
|
|
22
|
+
* return (
|
|
23
|
+
* <div>
|
|
24
|
+
* <Spacer size="small" border data-testid="my-spacer-testid" />
|
|
25
|
+
* </div>
|
|
26
|
+
* );
|
|
27
|
+
* };
|
|
28
|
+
* ```
|
|
18
29
|
* @param {SpacerProps} props - The props for the Spacer component
|
|
19
30
|
* @returns {ReactElement} Spacer component
|
|
20
31
|
*/
|
|
@@ -58,7 +58,4 @@ export interface TagProps extends CommonProps {
|
|
|
58
58
|
* @param {TagProps} props - The props for the Tag component.
|
|
59
59
|
* @returns {ReactElement} The rendered Tag component.
|
|
60
60
|
*/
|
|
61
|
-
export declare const Tag: {
|
|
62
|
-
({ className, "data-testid": dataTestId, children, size, onClose, color, disabled, ref, icon, onMouseEnter, }: TagProps): ReactElement;
|
|
63
|
-
displayName: string;
|
|
64
|
-
};
|
|
61
|
+
export declare const Tag: ({ className, "data-testid": dataTestId, children, size, onClose, color, disabled, ref, icon, onMouseEnter, }: TagProps) => ReactElement;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Tailwind class for minimum width of tag text.
|
|
3
|
+
* This is the source of truth - use parseTailwindArbitraryValue to derive the numeric value.
|
|
4
|
+
*/
|
|
5
|
+
export declare const TAG_TEXT_MIN_WIDTH_CLASS = "min-w-[80px]";
|
|
1
6
|
export declare const cvaTag: (props?: ({
|
|
2
7
|
size?: "small" | "medium" | null | undefined;
|
|
3
8
|
layout?: "default" | "containsDismiss" | "containsIcon" | null | undefined;
|
|
4
9
|
color?: "primary" | "neutral" | "black" | "white" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "stopped" | "idle" | "unknown" | "moving" | "active" | "excessive_usage" | null | undefined;
|
|
5
10
|
border?: "default" | "none" | null | undefined;
|
|
6
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
|
-
export declare const cvaTagText: (props?:
|
|
12
|
+
export declare const cvaTagText: (props?: ({
|
|
13
|
+
truncate?: boolean | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
15
|
export declare const cvaTagIconContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
9
16
|
export declare const cvaTagIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
package/src/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export * from "./components/Indicator";
|
|
|
28
28
|
export * from "./components/Indicator/Indicator.variants";
|
|
29
29
|
export * from "./components/InteractableItem/InteractableItem.variants";
|
|
30
30
|
export * from "./components/KPI/KPI";
|
|
31
|
+
export * from "./components/KPICard/components/TrendIndicator/TrendIndicator";
|
|
32
|
+
export * from "./components/KPICard/components/TrendIndicators";
|
|
31
33
|
export * from "./components/KPICard/KPICard";
|
|
32
34
|
export * from "./components/List/List";
|
|
33
35
|
export * from "./components/List/List.variants";
|