@trackunit/utilization-indicator 1.17.23 → 1.19.5
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 +81 -80
- package/index.esm.js +81 -80
- package/package.json +5 -5
package/index.cjs.js
CHANGED
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
5
5
|
var reactComponents = require('@trackunit/react-components');
|
|
6
6
|
var utilizationTokens = require('@trackunit/utilization-tokens');
|
|
7
|
+
var react = require('react');
|
|
7
8
|
|
|
8
9
|
var defaultTranslations = {
|
|
9
10
|
"indicator.activity.idle": "Idle",
|
|
@@ -66,48 +67,48 @@ const setupLibraryTranslations = () => {
|
|
|
66
67
|
*/
|
|
67
68
|
const useActivity = (state, size = "medium") => {
|
|
68
69
|
const [t] = useTranslation();
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
activityIndicator: undefined
|
|
109
|
-
|
|
110
|
-
}
|
|
70
|
+
return react.useMemo(() => {
|
|
71
|
+
switch (state) {
|
|
72
|
+
case utilizationTokens.assetActivityState.Working:
|
|
73
|
+
case "WORKING":
|
|
74
|
+
return {
|
|
75
|
+
activityIndicator: {
|
|
76
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { name: "PlayCircle", size: size }),
|
|
77
|
+
label: t("indicator.activity.working"),
|
|
78
|
+
color: "working",
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
case utilizationTokens.assetActivityState.Idling:
|
|
82
|
+
case "IDLING":
|
|
83
|
+
return {
|
|
84
|
+
activityIndicator: {
|
|
85
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { name: "PauseCircle", size: size }),
|
|
86
|
+
label: t("indicator.activity.idle"),
|
|
87
|
+
color: "idle",
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
case utilizationTokens.assetActivityState.Stopped:
|
|
91
|
+
case "STOPPED":
|
|
92
|
+
return {
|
|
93
|
+
activityIndicator: {
|
|
94
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { name: "StopCircle", size: size }),
|
|
95
|
+
label: t("indicator.activity.stopped"),
|
|
96
|
+
color: "stopped",
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
case utilizationTokens.assetActivityState.Unknown:
|
|
100
|
+
case "UNKNOWN":
|
|
101
|
+
return {
|
|
102
|
+
activityIndicator: {
|
|
103
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { name: "QuestionMarkCircle", size: size }),
|
|
104
|
+
label: t("indicator.activity.unknown"),
|
|
105
|
+
color: "unknown",
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
default:
|
|
109
|
+
return { activityIndicator: undefined };
|
|
110
|
+
}
|
|
111
|
+
}, [state, size, t]);
|
|
111
112
|
};
|
|
112
113
|
|
|
113
114
|
/**
|
|
@@ -128,44 +129,44 @@ const ActivityIndicator = (props) => {
|
|
|
128
129
|
*/
|
|
129
130
|
const useUtilization = state => {
|
|
130
131
|
const [t] = useTranslation();
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
utilizationIndicator: undefined
|
|
167
|
-
|
|
168
|
-
}
|
|
132
|
+
return react.useMemo(() => {
|
|
133
|
+
switch (state) {
|
|
134
|
+
case utilizationTokens.UtilizationState.Unused:
|
|
135
|
+
return {
|
|
136
|
+
utilizationIndicator: {
|
|
137
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { name: "ExclamationTriangle", size: "medium" }),
|
|
138
|
+
label: t("indicator.utilization.unused"),
|
|
139
|
+
color: "unused",
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
case utilizationTokens.UtilizationState.Utilized:
|
|
143
|
+
return {
|
|
144
|
+
utilizationIndicator: {
|
|
145
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { name: "CheckCircle", size: "medium" }),
|
|
146
|
+
label: t("indicator.utilization.utilized"),
|
|
147
|
+
color: "utilized",
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
case utilizationTokens.UtilizationState.HeavilyUtilized:
|
|
151
|
+
return {
|
|
152
|
+
utilizationIndicator: {
|
|
153
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { name: "ShieldExclamation", size: "medium" }),
|
|
154
|
+
label: t("indicator.utilization.heavilyUtilized"),
|
|
155
|
+
color: "heavily_utilized",
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
case utilizationTokens.UtilizationState.Unknown:
|
|
159
|
+
return {
|
|
160
|
+
utilizationIndicator: {
|
|
161
|
+
icon: jsxRuntime.jsx(reactComponents.Icon, { name: "QuestionMarkCircle", size: "medium" }),
|
|
162
|
+
label: "N/A",
|
|
163
|
+
color: "unknown_utilization",
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
default:
|
|
167
|
+
return { utilizationIndicator: undefined };
|
|
168
|
+
}
|
|
169
|
+
}, [state, t]);
|
|
169
170
|
};
|
|
170
171
|
|
|
171
172
|
/**
|
package/index.esm.js
CHANGED
|
@@ -2,6 +2,7 @@ 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
4
|
import { assetActivityState, UtilizationState } from '@trackunit/utilization-tokens';
|
|
5
|
+
import { useMemo } from 'react';
|
|
5
6
|
|
|
6
7
|
var defaultTranslations = {
|
|
7
8
|
"indicator.activity.idle": "Idle",
|
|
@@ -64,48 +65,48 @@ const setupLibraryTranslations = () => {
|
|
|
64
65
|
*/
|
|
65
66
|
const useActivity = (state, size = "medium") => {
|
|
66
67
|
const [t] = useTranslation();
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
activityIndicator: undefined
|
|
107
|
-
|
|
108
|
-
}
|
|
68
|
+
return useMemo(() => {
|
|
69
|
+
switch (state) {
|
|
70
|
+
case assetActivityState.Working:
|
|
71
|
+
case "WORKING":
|
|
72
|
+
return {
|
|
73
|
+
activityIndicator: {
|
|
74
|
+
icon: jsx(Icon, { name: "PlayCircle", size: size }),
|
|
75
|
+
label: t("indicator.activity.working"),
|
|
76
|
+
color: "working",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
case assetActivityState.Idling:
|
|
80
|
+
case "IDLING":
|
|
81
|
+
return {
|
|
82
|
+
activityIndicator: {
|
|
83
|
+
icon: jsx(Icon, { name: "PauseCircle", size: size }),
|
|
84
|
+
label: t("indicator.activity.idle"),
|
|
85
|
+
color: "idle",
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
case assetActivityState.Stopped:
|
|
89
|
+
case "STOPPED":
|
|
90
|
+
return {
|
|
91
|
+
activityIndicator: {
|
|
92
|
+
icon: jsx(Icon, { name: "StopCircle", size: size }),
|
|
93
|
+
label: t("indicator.activity.stopped"),
|
|
94
|
+
color: "stopped",
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
case assetActivityState.Unknown:
|
|
98
|
+
case "UNKNOWN":
|
|
99
|
+
return {
|
|
100
|
+
activityIndicator: {
|
|
101
|
+
icon: jsx(Icon, { name: "QuestionMarkCircle", size: size }),
|
|
102
|
+
label: t("indicator.activity.unknown"),
|
|
103
|
+
color: "unknown",
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
default:
|
|
107
|
+
return { activityIndicator: undefined };
|
|
108
|
+
}
|
|
109
|
+
}, [state, size, t]);
|
|
109
110
|
};
|
|
110
111
|
|
|
111
112
|
/**
|
|
@@ -126,44 +127,44 @@ const ActivityIndicator = (props) => {
|
|
|
126
127
|
*/
|
|
127
128
|
const useUtilization = state => {
|
|
128
129
|
const [t] = useTranslation();
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
utilizationIndicator: undefined
|
|
165
|
-
|
|
166
|
-
}
|
|
130
|
+
return useMemo(() => {
|
|
131
|
+
switch (state) {
|
|
132
|
+
case UtilizationState.Unused:
|
|
133
|
+
return {
|
|
134
|
+
utilizationIndicator: {
|
|
135
|
+
icon: jsx(Icon, { name: "ExclamationTriangle", size: "medium" }),
|
|
136
|
+
label: t("indicator.utilization.unused"),
|
|
137
|
+
color: "unused",
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
case UtilizationState.Utilized:
|
|
141
|
+
return {
|
|
142
|
+
utilizationIndicator: {
|
|
143
|
+
icon: jsx(Icon, { name: "CheckCircle", size: "medium" }),
|
|
144
|
+
label: t("indicator.utilization.utilized"),
|
|
145
|
+
color: "utilized",
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
case UtilizationState.HeavilyUtilized:
|
|
149
|
+
return {
|
|
150
|
+
utilizationIndicator: {
|
|
151
|
+
icon: jsx(Icon, { name: "ShieldExclamation", size: "medium" }),
|
|
152
|
+
label: t("indicator.utilization.heavilyUtilized"),
|
|
153
|
+
color: "heavily_utilized",
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
case UtilizationState.Unknown:
|
|
157
|
+
return {
|
|
158
|
+
utilizationIndicator: {
|
|
159
|
+
icon: jsx(Icon, { name: "QuestionMarkCircle", size: "medium" }),
|
|
160
|
+
label: "N/A",
|
|
161
|
+
color: "unknown_utilization",
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
default:
|
|
165
|
+
return { utilizationIndicator: undefined };
|
|
166
|
+
}
|
|
167
|
+
}, [state, t]);
|
|
167
168
|
};
|
|
168
169
|
|
|
169
170
|
/**
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/utilization-indicator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.5",
|
|
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/utilization-tokens": "1.
|
|
12
|
-
"@trackunit/i18n-library-translation": "1.
|
|
13
|
-
"@trackunit/ui-design-tokens": "1.11.
|
|
10
|
+
"@trackunit/react-components": "1.21.5",
|
|
11
|
+
"@trackunit/utilization-tokens": "1.17.5",
|
|
12
|
+
"@trackunit/i18n-library-translation": "1.17.5",
|
|
13
|
+
"@trackunit/ui-design-tokens": "1.11.88"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": "^19.0.0"
|