@molecule/app-status-summary-react 4.0.1 → 4.1.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/README.md +5 -5
- package/dist/StatusSummary.d.ts.map +1 -1
- package/dist/StatusSummary.js +33 -14
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-25T00:35:38.133Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-status-summary-react
|
|
@@ -134,7 +134,7 @@ Peer dependencies:
|
|
|
134
134
|
|
|
135
135
|
- `@molecule/app-react` ^4.0.0
|
|
136
136
|
- `@molecule/app-ui` ^1.4.0
|
|
137
|
-
- `@molecule/app-ui-react` ^4.
|
|
137
|
+
- `@molecule/app-ui-react` ^4.4.0
|
|
138
138
|
- `react` ^18.0.0 || ^19.0.0
|
|
139
139
|
|
|
140
140
|
### Runtime Dependencies
|
|
@@ -153,8 +153,8 @@ Peer dependencies:
|
|
|
153
153
|
(green/yellow/orange/red/blue with white text) — they ignore the
|
|
154
154
|
app theme and cannot be restyled via ClassMap; acceptable for
|
|
155
155
|
status pages, but know they will not follow a rebrand.
|
|
156
|
-
- Status labels use `status.operational` … `status.maintenance` i18n
|
|
157
|
-
keys
|
|
158
|
-
|
|
156
|
+
- Status labels use the `status.operational` … `status.maintenance` i18n
|
|
157
|
+
keys, which the `common` locale bond ships in every language; the
|
|
158
|
+
English fallbacks in code match its en.ts.
|
|
159
159
|
- `header` renders inside the overall banner (last-updated stamp,
|
|
160
160
|
subscribe button); `footer` renders below the grid (incident list).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusSummary.d.ts","sourceRoot":"","sources":["../src/StatusSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"StatusSummary.d.ts","sourceRoot":"","sources":["../src/StatusSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAO3C,iDAAiD;AACjD,MAAM,MAAM,eAAe,GACzB,aAAa,GAAG,UAAU,GAAG,gBAAgB,GAAG,cAAc,GAAG,aAAa,CAAA;AAEhF,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,EAAE,eAAe,CAAA;IACvB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED,wDAAwD;AACxD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,SAAS,CAAA;IACf,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAED,qDAAqD;AACrD,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,uDAAuD;IACvD,aAAa,CAAC,EAAE,eAAe,CAAA;IAC/B,qEAAqE;IACrE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,wEAAwE;IACxE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAiCD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,aAAa,EACb,MAAM,EACN,MAAM,EACN,SAAS,GACV,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAuFlC"}
|
package/dist/StatusSummary.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from '@molecule/app-react';
|
|
3
3
|
import { getClassMap } from '@molecule/app-ui';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'
|
|
15
|
-
|
|
16
|
-
maintenance: '#60a5fa',
|
|
4
|
+
import { Box, Text } from '@molecule/app-ui-react/elements';
|
|
5
|
+
/**
|
|
6
|
+
* The semantic tone colouring each status: the theme's success green for
|
|
7
|
+
* operational, its warning amber for degraded and partial outage, its error
|
|
8
|
+
* red for a major outage and its info blue for maintenance.
|
|
9
|
+
*/
|
|
10
|
+
const STATUS_TONE = {
|
|
11
|
+
operational: 'success',
|
|
12
|
+
degraded: 'warning',
|
|
13
|
+
'partial-outage': 'warning',
|
|
14
|
+
'major-outage': 'error',
|
|
15
|
+
maintenance: 'info',
|
|
17
16
|
};
|
|
18
17
|
/**
|
|
19
18
|
* Returns the most severe status from an array of ComponentStatus values.
|
|
@@ -41,7 +40,27 @@ function worst(statuses) {
|
|
|
41
40
|
export function StatusSummary({ groups, overallStatus, header, footer, className, }) {
|
|
42
41
|
const cm = getClassMap();
|
|
43
42
|
const { t } = useTranslation();
|
|
43
|
+
/**
|
|
44
|
+
* The label for one status, through its literal i18n key with the English
|
|
45
|
+
* fallback (the same text the `common` locale bond's en.ts ships).
|
|
46
|
+
* @param status - The status to label.
|
|
47
|
+
* @returns The translated label.
|
|
48
|
+
*/
|
|
49
|
+
const statusLabel = (status) => {
|
|
50
|
+
switch (status) {
|
|
51
|
+
case 'operational':
|
|
52
|
+
return t('status.operational', {}, { defaultValue: 'Operational' });
|
|
53
|
+
case 'degraded':
|
|
54
|
+
return t('status.degraded', {}, { defaultValue: 'Degraded performance' });
|
|
55
|
+
case 'partial-outage':
|
|
56
|
+
return t('status.partial-outage', {}, { defaultValue: 'Partial outage' });
|
|
57
|
+
case 'major-outage':
|
|
58
|
+
return t('status.major-outage', {}, { defaultValue: 'Major outage' });
|
|
59
|
+
case 'maintenance':
|
|
60
|
+
return t('status.maintenance', {}, { defaultValue: 'Under maintenance' });
|
|
61
|
+
}
|
|
62
|
+
};
|
|
44
63
|
const allStatuses = groups.flatMap((g) => g.components.map((c) => c.status));
|
|
45
64
|
const overall = overallStatus ?? worst(allStatuses);
|
|
46
|
-
return (_jsxs("div",
|
|
65
|
+
return (_jsxs(Box, { as: "div", className: cm.cn(cm.stack(4), className), children: [_jsxs(Box, { as: "div", className: cm.cn(cm.flex({ align: 'center', justify: 'between', gap: 'md' }), cm.sp('p', 3), cm.bgTone(STATUS_TONE[overall]), cm.textOnTone), style: { borderRadius: 8 }, children: [_jsx(Text, { as: "span", className: cm.cn(cm.textSize('lg'), cm.fontWeight('bold')), children: statusLabel(overall) }), header] }), groups.map((g) => (_jsxs(Box, { as: "section", className: cm.stack(2), children: [_jsx(Text, { as: "h3", className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold')), children: g.name }), _jsx(Box, { as: "ul", className: cm.stack(1), children: g.components.map((c) => (_jsxs(Box, { as: "li", className: cm.flex({ align: 'center', justify: 'between', gap: 'sm' }), children: [_jsxs(Box, { as: "div", children: [_jsx(Text, { as: "span", className: cm.cn(cm.textSize('sm'), cm.fontWeight('medium')), children: c.name }), c.subtitle && (_jsx(Text, { as: "span", className: cm.cn(cm.sp('ml', 2), cm.textSize('xs')), children: c.subtitle }))] }), _jsx(Text, { as: "span", className: cm.cn(cm.sp('px', 2), cm.textSize('xs'), cm.fontWeight('semibold'), cm.bgTone(STATUS_TONE[c.status]), cm.textOnTone), style: { borderRadius: 4 }, children: statusLabel(c.status) })] }, c.id))) })] }, g.id))), footer] }));
|
|
47
66
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
* (green/yellow/orange/red/blue with white text) — they ignore the
|
|
33
33
|
* app theme and cannot be restyled via ClassMap; acceptable for
|
|
34
34
|
* status pages, but know they will not follow a rebrand.
|
|
35
|
-
* - Status labels use `status.operational` … `status.maintenance` i18n
|
|
36
|
-
* keys
|
|
37
|
-
*
|
|
35
|
+
* - Status labels use the `status.operational` … `status.maintenance` i18n
|
|
36
|
+
* keys, which the `common` locale bond ships in every language; the
|
|
37
|
+
* English fallbacks in code match its en.ts.
|
|
38
38
|
* - `header` renders inside the overall banner (last-updated stamp,
|
|
39
39
|
* subscribe button); `footer` renders below the grid (incident list).
|
|
40
40
|
*
|
package/dist/index.js
CHANGED
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
* (green/yellow/orange/red/blue with white text) — they ignore the
|
|
33
33
|
* app theme and cannot be restyled via ClassMap; acceptable for
|
|
34
34
|
* status pages, but know they will not follow a rebrand.
|
|
35
|
-
* - Status labels use `status.operational` … `status.maintenance` i18n
|
|
36
|
-
* keys
|
|
37
|
-
*
|
|
35
|
+
* - Status labels use the `status.operational` … `status.maintenance` i18n
|
|
36
|
+
* keys, which the `common` locale bond ships in every language; the
|
|
37
|
+
* English fallbacks in code match its en.ts.
|
|
38
38
|
* - `header` renders inside the overall banner (last-updated stamp,
|
|
39
39
|
* subscribe button); `footer` renders below the grid (incident list).
|
|
40
40
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-status-summary-react",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Status-page summary: component grid with operational/degraded/outage badges",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-status-summary-react",
|
|
6
6
|
"type": "module",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@molecule/app-react": "^4.0.0",
|
|
37
37
|
"@molecule/app-ui": "^1.4.0",
|
|
38
|
-
"@molecule/app-ui-react": "^4.
|
|
38
|
+
"@molecule/app-ui-react": "^4.4.0",
|
|
39
39
|
"react": "^18.0.0 || ^19.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@molecule/app-react": "4.
|
|
43
|
-
"@molecule/app-ui": "1.
|
|
44
|
-
"@molecule/app-ui-react": "4.
|
|
42
|
+
"@molecule/app-react": "4.17.0",
|
|
43
|
+
"@molecule/app-ui": "1.13.0",
|
|
44
|
+
"@molecule/app-ui-react": "4.11.0",
|
|
45
45
|
"@types/node": "26.6.5",
|
|
46
46
|
"@types/react": "19.3.0",
|
|
47
47
|
"@types/react-dom": "19.3.0",
|