@molecule/app-status-summary-react 4.0.0 → 4.0.2

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 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-12T04:41:40.561Z
6
+ Generated: 2026-11-21T12:47:27.258Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-status-summary-react
@@ -133,7 +133,7 @@ function StatusSummary({
133
133
  Peer dependencies:
134
134
 
135
135
  - `@molecule/app-react` ^4.0.0
136
- - `@molecule/app-ui` ^1.0.1
136
+ - `@molecule/app-ui` ^1.4.0
137
137
  - `@molecule/app-ui-react` ^4.0.0
138
138
  - `react` ^18.0.0 || ^19.0.0
139
139
 
@@ -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 with English fallbacks; no locale bond currently ships these
158
- keys, so register your own translations if the app is multilingual.
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;AAK3C,iDAAiD;AACjD,MAAM,MAAM,eAAe,GACzB,aAAa,GAAG,UAAU,GAAG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C,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,CAgFlC"}
@@ -1,19 +1,17 @@
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
- const STATUS_LABEL = {
5
- operational: 'Operational',
6
- degraded: 'Degraded performance',
7
- 'partial-outage': 'Partial outage',
8
- 'major-outage': 'Major outage',
9
- maintenance: 'Under maintenance',
10
- };
11
- const STATUS_COLOR = {
12
- operational: '#22c55e',
13
- degraded: '#eab308',
14
- 'partial-outage': '#f97316',
15
- 'major-outage': '#ef4444',
16
- maintenance: '#60a5fa',
4
+ /**
5
+ * The semantic tone colouring each status: the theme's success green for
6
+ * operational, its warning amber for degraded and partial outage, its error
7
+ * red for a major outage and its info blue for maintenance.
8
+ */
9
+ const STATUS_TONE = {
10
+ operational: 'success',
11
+ degraded: 'warning',
12
+ 'partial-outage': 'warning',
13
+ 'major-outage': 'error',
14
+ maintenance: 'info',
17
15
  };
18
16
  /**
19
17
  * Returns the most severe status from an array of ComponentStatus values.
@@ -41,7 +39,27 @@ function worst(statuses) {
41
39
  export function StatusSummary({ groups, overallStatus, header, footer, className, }) {
42
40
  const cm = getClassMap();
43
41
  const { t } = useTranslation();
42
+ /**
43
+ * The label for one status, through its literal i18n key with the English
44
+ * fallback (the same text the `common` locale bond's en.ts ships).
45
+ * @param status - The status to label.
46
+ * @returns The translated label.
47
+ */
48
+ const statusLabel = (status) => {
49
+ switch (status) {
50
+ case 'operational':
51
+ return t('status.operational', {}, { defaultValue: 'Operational' });
52
+ case 'degraded':
53
+ return t('status.degraded', {}, { defaultValue: 'Degraded performance' });
54
+ case 'partial-outage':
55
+ return t('status.partial-outage', {}, { defaultValue: 'Partial outage' });
56
+ case 'major-outage':
57
+ return t('status.major-outage', {}, { defaultValue: 'Major outage' });
58
+ case 'maintenance':
59
+ return t('status.maintenance', {}, { defaultValue: 'Under maintenance' });
60
+ }
61
+ };
44
62
  const allStatuses = groups.flatMap((g) => g.components.map((c) => c.status));
45
63
  const overall = overallStatus ?? worst(allStatuses);
46
- return (_jsxs("div", { className: cm.cn(cm.stack(4), className), children: [_jsxs("div", { className: cm.cn(cm.flex({ align: 'center', justify: 'between', gap: 'md' }), cm.sp('p', 3)), style: { background: STATUS_COLOR[overall], color: '#fff', borderRadius: 8 }, children: [_jsx("span", { className: cm.cn(cm.textSize('lg'), cm.fontWeight('bold')), children: t(`status.${overall}`, {}, { defaultValue: STATUS_LABEL[overall] }) }), header] }), groups.map((g) => (_jsxs("section", { className: cm.stack(2), children: [_jsx("h3", { className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold')), children: g.name }), _jsx("ul", { className: cm.stack(1), children: g.components.map((c) => (_jsxs("li", { className: cm.flex({ align: 'center', justify: 'between', gap: 'sm' }), children: [_jsxs("div", { children: [_jsx("span", { className: cm.cn(cm.textSize('sm'), cm.fontWeight('medium')), children: c.name }), c.subtitle && (_jsx("span", { className: cm.cn(cm.sp('ml', 2), cm.textSize('xs')), children: c.subtitle }))] }), _jsx("span", { className: cm.cn(cm.sp('px', 2), cm.textSize('xs'), cm.fontWeight('semibold')), style: { borderRadius: 4, background: STATUS_COLOR[c.status], color: '#fff' }, children: t(`status.${c.status}`, {}, { defaultValue: STATUS_LABEL[c.status] }) })] }, c.id))) })] }, g.id))), footer] }));
64
+ return (_jsxs("div", { className: cm.cn(cm.stack(4), className), children: [_jsxs("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("span", { className: cm.cn(cm.textSize('lg'), cm.fontWeight('bold')), children: statusLabel(overall) }), header] }), groups.map((g) => (_jsxs("section", { className: cm.stack(2), children: [_jsx("h3", { className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold')), children: g.name }), _jsx("ul", { className: cm.stack(1), children: g.components.map((c) => (_jsxs("li", { className: cm.flex({ align: 'center', justify: 'between', gap: 'sm' }), children: [_jsxs("div", { children: [_jsx("span", { className: cm.cn(cm.textSize('sm'), cm.fontWeight('medium')), children: c.name }), c.subtitle && (_jsx("span", { className: cm.cn(cm.sp('ml', 2), cm.textSize('xs')), children: c.subtitle }))] }), _jsx("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
65
  }
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 with English fallbacks; no locale bond currently ships these
37
- * keys, so register your own translations if the app is multilingual.
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 with English fallbacks; no locale bond currently ships these
37
- * keys, so register your own translations if the app is multilingual.
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,7 +1,7 @@
1
1
  {
2
2
  "name": "@molecule/app-status-summary-react",
3
- "version": "4.0.0",
4
- "description": "Status-page summary: component grid with operational/degraded/outage badges + incident list",
3
+ "version": "4.0.2",
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",
7
7
  "main": "dist/index.js",
@@ -34,14 +34,14 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@molecule/app-react": "^4.0.0",
37
- "@molecule/app-ui": "^1.0.1",
37
+ "@molecule/app-ui": "^1.4.0",
38
38
  "@molecule/app-ui-react": "^4.0.0",
39
39
  "react": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@molecule/app-react": "4.0.0",
43
- "@molecule/app-ui": "1.3.9",
44
- "@molecule/app-ui-react": "4.0.0",
42
+ "@molecule/app-react": "4.10.1",
43
+ "@molecule/app-ui": "1.5.0",
44
+ "@molecule/app-ui-react": "4.2.0",
45
45
  "@types/node": "26.6.5",
46
46
  "@types/react": "19.3.0",
47
47
  "@types/react-dom": "19.3.0",