@trackunit/criticality-indicator 0.0.304 → 0.0.305
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 +6 -5
- package/index.esm.js +6 -5
- package/package.json +1 -1
- package/src/CriticalityIndicator.d.ts +1 -1
- package/src/useCriticality.d.ts +2 -1
package/index.cjs.js
CHANGED
@@ -63,9 +63,10 @@ const assetCriticalityState = {
|
|
63
63
|
* Returns the criticality indicator props.
|
64
64
|
*
|
65
65
|
* @param state - The criticality state.
|
66
|
+
* @param size - The size of the icon.
|
66
67
|
* @returns {UseCriticality} - The criticality indicator props.
|
67
68
|
*/
|
68
|
-
const useCriticality = state => {
|
69
|
+
const useCriticality = (state, size = "medium") => {
|
69
70
|
const [t] = useTranslation();
|
70
71
|
if (!state) {
|
71
72
|
return {
|
@@ -76,7 +77,7 @@ const useCriticality = state => {
|
|
76
77
|
case assetCriticalityState.Critical:
|
77
78
|
return {
|
78
79
|
criticalityIndicator: {
|
79
|
-
icon: jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "indicator-icon-critical", name: "ExclamationCircle", size:
|
80
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "indicator-icon-critical", name: "ExclamationCircle", size: size }),
|
80
81
|
label: t("indicator.critical"),
|
81
82
|
color: "critical",
|
82
83
|
},
|
@@ -84,7 +85,7 @@ const useCriticality = state => {
|
|
84
85
|
case assetCriticalityState.Low:
|
85
86
|
return {
|
86
87
|
criticalityIndicator: {
|
87
|
-
icon: jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "indicator-icon-low", name: "ExclamationTriangle", size:
|
88
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "indicator-icon-low", name: "ExclamationTriangle", size: size }),
|
88
89
|
label: t("indicator.low"),
|
89
90
|
color: "low",
|
90
91
|
},
|
@@ -92,7 +93,7 @@ const useCriticality = state => {
|
|
92
93
|
case assetCriticalityState.None:
|
93
94
|
return {
|
94
95
|
criticalityIndicator: {
|
95
|
-
icon: jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "indicator-icon-good", name: "CheckCircle", size:
|
96
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "indicator-icon-good", name: "CheckCircle", size: size }),
|
96
97
|
label: t("indicator.none"),
|
97
98
|
color: "good",
|
98
99
|
},
|
@@ -111,7 +112,7 @@ const useCriticality = state => {
|
|
111
112
|
* @returns {JSX.Element | null} Criticality indicator.
|
112
113
|
*/
|
113
114
|
const CriticalityIndicator = (props) => {
|
114
|
-
const { criticalityIndicator } = useCriticality(props.state);
|
115
|
+
const { criticalityIndicator } = useCriticality(props.state, props.size);
|
115
116
|
return criticalityIndicator ? jsxRuntime.jsx(reactComponents.Indicator, { ...criticalityIndicator, ...props }) : null;
|
116
117
|
};
|
117
118
|
|
package/index.esm.js
CHANGED
@@ -61,9 +61,10 @@ const assetCriticalityState = {
|
|
61
61
|
* Returns the criticality indicator props.
|
62
62
|
*
|
63
63
|
* @param state - The criticality state.
|
64
|
+
* @param size - The size of the icon.
|
64
65
|
* @returns {UseCriticality} - The criticality indicator props.
|
65
66
|
*/
|
66
|
-
const useCriticality = state => {
|
67
|
+
const useCriticality = (state, size = "medium") => {
|
67
68
|
const [t] = useTranslation();
|
68
69
|
if (!state) {
|
69
70
|
return {
|
@@ -74,7 +75,7 @@ const useCriticality = state => {
|
|
74
75
|
case assetCriticalityState.Critical:
|
75
76
|
return {
|
76
77
|
criticalityIndicator: {
|
77
|
-
icon: jsx(Icon, { dataTestId: "indicator-icon-critical", name: "ExclamationCircle", size:
|
78
|
+
icon: jsx(Icon, { dataTestId: "indicator-icon-critical", name: "ExclamationCircle", size: size }),
|
78
79
|
label: t("indicator.critical"),
|
79
80
|
color: "critical",
|
80
81
|
},
|
@@ -82,7 +83,7 @@ const useCriticality = state => {
|
|
82
83
|
case assetCriticalityState.Low:
|
83
84
|
return {
|
84
85
|
criticalityIndicator: {
|
85
|
-
icon: jsx(Icon, { dataTestId: "indicator-icon-low", name: "ExclamationTriangle", size:
|
86
|
+
icon: jsx(Icon, { dataTestId: "indicator-icon-low", name: "ExclamationTriangle", size: size }),
|
86
87
|
label: t("indicator.low"),
|
87
88
|
color: "low",
|
88
89
|
},
|
@@ -90,7 +91,7 @@ const useCriticality = state => {
|
|
90
91
|
case assetCriticalityState.None:
|
91
92
|
return {
|
92
93
|
criticalityIndicator: {
|
93
|
-
icon: jsx(Icon, { dataTestId: "indicator-icon-good", name: "CheckCircle", size:
|
94
|
+
icon: jsx(Icon, { dataTestId: "indicator-icon-good", name: "CheckCircle", size: size }),
|
94
95
|
label: t("indicator.none"),
|
95
96
|
color: "good",
|
96
97
|
},
|
@@ -109,7 +110,7 @@ const useCriticality = state => {
|
|
109
110
|
* @returns {JSX.Element | null} Criticality indicator.
|
110
111
|
*/
|
111
112
|
const CriticalityIndicator = (props) => {
|
112
|
-
const { criticalityIndicator } = useCriticality(props.state);
|
113
|
+
const { criticalityIndicator } = useCriticality(props.state, props.size);
|
113
114
|
return criticalityIndicator ? jsx(Indicator, { ...criticalityIndicator, ...props }) : null;
|
114
115
|
};
|
115
116
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CommonProps, IndicatorProps } from "@trackunit/react-components";
|
2
2
|
import { AssetCriticalityState } from "./types";
|
3
|
-
export interface CriticalityIndicatorProps extends Pick<IndicatorProps, "withBackground" | "withLabel" | "ping">, CommonProps {
|
3
|
+
export interface CriticalityIndicatorProps extends Pick<IndicatorProps, "withBackground" | "withLabel" | "ping" | "size">, CommonProps {
|
4
4
|
state: AssetCriticalityState;
|
5
5
|
}
|
6
6
|
/**
|
package/src/useCriticality.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CriticalityColors } from "@trackunit/ui-design-tokens";
|
2
2
|
import { AssetCriticalityState } from "./types";
|
3
|
-
type UseCriticality = (state?: AssetCriticalityState) => {
|
3
|
+
type UseCriticality = (state?: AssetCriticalityState, size?: "small" | "medium" | "large") => {
|
4
4
|
criticalityIndicator?: {
|
5
5
|
icon: JSX.Element;
|
6
6
|
label: string;
|
@@ -11,6 +11,7 @@ type UseCriticality = (state?: AssetCriticalityState) => {
|
|
11
11
|
* Returns the criticality indicator props.
|
12
12
|
*
|
13
13
|
* @param state - The criticality state.
|
14
|
+
* @param size - The size of the icon.
|
14
15
|
* @returns {UseCriticality} - The criticality indicator props.
|
15
16
|
*/
|
16
17
|
export declare const useCriticality: UseCriticality;
|