@trackunit/criticality-indicator 1.17.22 → 1.19.4
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 +34 -35
- package/index.esm.js +34 -35
- package/package.json +4 -4
package/index.cjs.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
5
5
|
var reactComponents = require('@trackunit/react-components');
|
|
6
|
+
var react = require('react');
|
|
6
7
|
|
|
7
8
|
var defaultTranslations = {
|
|
8
9
|
"indicator.critical": "Critical",
|
|
@@ -68,41 +69,39 @@ const assetCriticalityState = {
|
|
|
68
69
|
*/
|
|
69
70
|
const useCriticality = (state, size = "medium") => {
|
|
70
71
|
const [t] = useTranslation();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
criticalityIndicator: undefined
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
};
|
|
105
|
-
}
|
|
72
|
+
return react.useMemo(() => {
|
|
73
|
+
if (!state) {
|
|
74
|
+
return { criticalityIndicator: undefined };
|
|
75
|
+
}
|
|
76
|
+
switch (state) {
|
|
77
|
+
case assetCriticalityState.Critical:
|
|
78
|
+
return {
|
|
79
|
+
criticalityIndicator: {
|
|
80
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { "data-testid": "indicator-icon-critical", name: "ExclamationCircle", size: size }),
|
|
81
|
+
label: t("indicator.critical"),
|
|
82
|
+
color: "critical",
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
case assetCriticalityState.Low:
|
|
86
|
+
return {
|
|
87
|
+
criticalityIndicator: {
|
|
88
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { "data-testid": "indicator-icon-low", name: "ExclamationTriangle", size: size }),
|
|
89
|
+
label: t("indicator.low"),
|
|
90
|
+
color: "low",
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
case assetCriticalityState.None:
|
|
94
|
+
return {
|
|
95
|
+
criticalityIndicator: {
|
|
96
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { "data-testid": "indicator-icon-good", name: "CheckCircle", size: size }),
|
|
97
|
+
label: t("indicator.none"),
|
|
98
|
+
color: "good",
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
default:
|
|
102
|
+
return { criticalityIndicator: undefined };
|
|
103
|
+
}
|
|
104
|
+
}, [state, size, t]);
|
|
106
105
|
};
|
|
107
106
|
|
|
108
107
|
/**
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { registerTranslations, useNamespaceTranslation } from '@trackunit/i18n-library-translation';
|
|
3
3
|
import { Icon, Indicator } from '@trackunit/react-components';
|
|
4
|
+
import { useMemo } from 'react';
|
|
4
5
|
|
|
5
6
|
var defaultTranslations = {
|
|
6
7
|
"indicator.critical": "Critical",
|
|
@@ -66,41 +67,39 @@ const assetCriticalityState = {
|
|
|
66
67
|
*/
|
|
67
68
|
const useCriticality = (state, size = "medium") => {
|
|
68
69
|
const [t] = useTranslation();
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
criticalityIndicator: undefined
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
};
|
|
103
|
-
}
|
|
70
|
+
return useMemo(() => {
|
|
71
|
+
if (!state) {
|
|
72
|
+
return { criticalityIndicator: undefined };
|
|
73
|
+
}
|
|
74
|
+
switch (state) {
|
|
75
|
+
case assetCriticalityState.Critical:
|
|
76
|
+
return {
|
|
77
|
+
criticalityIndicator: {
|
|
78
|
+
icon: jsx(Icon, { "data-testid": "indicator-icon-critical", name: "ExclamationCircle", size: size }),
|
|
79
|
+
label: t("indicator.critical"),
|
|
80
|
+
color: "critical",
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
case assetCriticalityState.Low:
|
|
84
|
+
return {
|
|
85
|
+
criticalityIndicator: {
|
|
86
|
+
icon: jsx(Icon, { "data-testid": "indicator-icon-low", name: "ExclamationTriangle", size: size }),
|
|
87
|
+
label: t("indicator.low"),
|
|
88
|
+
color: "low",
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
case assetCriticalityState.None:
|
|
92
|
+
return {
|
|
93
|
+
criticalityIndicator: {
|
|
94
|
+
icon: jsx(Icon, { "data-testid": "indicator-icon-good", name: "CheckCircle", size: size }),
|
|
95
|
+
label: t("indicator.none"),
|
|
96
|
+
color: "good",
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
default:
|
|
100
|
+
return { criticalityIndicator: undefined };
|
|
101
|
+
}
|
|
102
|
+
}, [state, size, t]);
|
|
104
103
|
};
|
|
105
104
|
|
|
106
105
|
/**
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/criticality-indicator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.4",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=24.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@trackunit/react-components": "1.
|
|
11
|
-
"@trackunit/i18n-library-translation": "1.
|
|
12
|
-
"@trackunit/ui-design-tokens": "1.11.
|
|
10
|
+
"@trackunit/react-components": "1.21.4",
|
|
11
|
+
"@trackunit/i18n-library-translation": "1.17.4",
|
|
12
|
+
"@trackunit/ui-design-tokens": "1.11.88"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react": "^19.0.0"
|