@molecule/app-status-summary-react 1.0.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/LICENSE ADDED
@@ -0,0 +1,115 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship.
43
+
44
+ "Contribution" shall mean any work of authorship, including the
45
+ original version of the Work and any modifications or additions
46
+ to that Work, that is intentionally submitted to the Licensor for
47
+ inclusion in the Work by the copyright owner or by an individual or
48
+ Legal Entity authorized to submit on behalf of the copyright owner.
49
+
50
+ "Contributor" shall mean Licensor and any individual or Legal Entity
51
+ on behalf of whom a Contribution has been received by the Licensor and
52
+ subsequently incorporated within the Work.
53
+
54
+ 2. Grant of Copyright License. Subject to the terms and conditions of
55
+ this License, each Contributor hereby grants to You a perpetual,
56
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
57
+ copyright license to reproduce, prepare Derivative Works of,
58
+ publicly display, publicly perform, sublicense, and distribute the
59
+ Work and such Derivative Works in Source or Object form.
60
+
61
+ 3. Grant of Patent License. Subject to the terms and conditions of
62
+ this License, each Contributor hereby grants to You a perpetual,
63
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
+ patent license to make, have made, use, offer to sell, sell, import,
65
+ and otherwise transfer the Work.
66
+
67
+ 4. Redistribution. You may reproduce and distribute copies of the
68
+ Work or Derivative Works thereof in any medium, with or without
69
+ modifications, and in Source or Object form, provided that You
70
+ meet the following conditions:
71
+
72
+ (a) You must give any other recipients of the Work or
73
+ Derivative Works a copy of this License; and
74
+
75
+ (b) You must cause any modified files to carry prominent notices
76
+ stating that You changed the files; and
77
+
78
+ (c) You must retain, in the Source form of any Derivative Works
79
+ that You distribute, all copyright, patent, trademark, and
80
+ attribution notices from the Source form of the Work,
81
+ excluding those notices that do not pertain to any part of
82
+ the Derivative Works; and
83
+
84
+ (d) If the Work includes a "NOTICE" text file as part of its
85
+ distribution, then any Derivative Works that You distribute must
86
+ include a readable copy of the attribution notices contained
87
+ within such NOTICE file.
88
+
89
+ 5. Submission of Contributions.
90
+
91
+ 6. Trademarks. This License does not grant permission to use the trade
92
+ names, trademarks, service marks, or product names of the Licensor.
93
+
94
+ 7. Disclaimer of Warranty. Unless required by applicable law or
95
+ agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
96
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
97
+
98
+ 8. Limitation of Liability. In no event and under no legal theory shall
99
+ any Contributor be liable to You for damages.
100
+
101
+ 9. Accepting Warranty or Additional Liability.
102
+
103
+ Copyright 2026 Molecule Dev, Inc.
104
+
105
+ Licensed under the Apache License, Version 2.0 (the "License");
106
+ you may not use this file except in compliance with the License.
107
+ You may obtain a copy of the License at
108
+
109
+ http://www.apache.org/licenses/LICENSE-2.0
110
+
111
+ Unless required by applicable law or agreed to in writing, software
112
+ distributed under the License is distributed on an "AS IS" BASIS,
113
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
+ See the License for the specific language governing permissions and
115
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,160 @@
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-08-04T00:41:15.086Z
7
+ -->
8
+
9
+ # @molecule/app-status-summary-react
10
+
11
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
+ > It is written to be read by coding agents as much as by people, and is generated from this
13
+ > package's source — edit `src/index.ts` JSDoc, not this file.
14
+
15
+ Status-page summary.
16
+
17
+ Exports `<StatusSummary>`, `ComponentStatus`, `StatusComponent`, `StatusGroup` types.
18
+
19
+ ## Quick Start
20
+
21
+ ```tsx
22
+ import { StatusSummary } from '@molecule/app-status-summary-react'
23
+
24
+ ;<StatusSummary
25
+ groups={[
26
+ {
27
+ id: 'api',
28
+ name: 'API',
29
+ components: [
30
+ { id: 'rest', name: 'REST API', status: 'operational' },
31
+ { id: 'ws', name: 'WebSockets', status: 'degraded' },
32
+ ],
33
+ },
34
+ ]}
35
+ header={<span>Last updated: 2 min ago</span>}
36
+ />
37
+ ```
38
+
39
+ ## Type
40
+
41
+ `feature`
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ npm install @molecule/app-status-summary-react @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
47
+ npm install -D @types/react
48
+ ```
49
+
50
+ ## API
51
+
52
+ ### Interfaces
53
+
54
+ #### `StatusComponent`
55
+
56
+ A single monitored component with its current health status.
57
+
58
+ ```typescript
59
+ interface StatusComponent {
60
+ id: string
61
+ name: ReactNode
62
+ status: ComponentStatus
63
+ /** Optional sub-label (SLA %, region, etc.). */
64
+ subtitle?: ReactNode
65
+ }
66
+ ```
67
+
68
+ #### `StatusGroup`
69
+
70
+ A named group of related StatusComponent entries.
71
+
72
+ ```typescript
73
+ interface StatusGroup {
74
+ id: string
75
+ name: ReactNode
76
+ components: StatusComponent[]
77
+ }
78
+ ```
79
+
80
+ #### `StatusSummaryProps`
81
+
82
+ Props for the {@link StatusSummary} component.
83
+
84
+ ```typescript
85
+ interface StatusSummaryProps {
86
+ /** Grouped components. */
87
+ groups: StatusGroup[]
88
+ /** Overall summary label (auto-derived if omitted). */
89
+ overallStatus?: ComponentStatus
90
+ /** Optional header content (last updated time, subscribe button). */
91
+ header?: ReactNode
92
+ /** Optional below-the-grid slot — typically a recent-incidents list. */
93
+ footer?: ReactNode
94
+ /** Extra classes. */
95
+ className?: string
96
+ }
97
+ ```
98
+
99
+ ### Types
100
+
101
+ #### `ComponentStatus`
102
+
103
+ Union of possible component health states.
104
+
105
+ ```typescript
106
+ type ComponentStatus =
107
+ 'operational' | 'degraded' | 'partial-outage' | 'major-outage' | 'maintenance'
108
+ ```
109
+
110
+ ### Functions
111
+
112
+ #### `StatusSummary(props)`
113
+
114
+ Status-page summary — grouped component list with colored badges and
115
+ an overall banner derived from the worst child status.
116
+
117
+ ```typescript
118
+ function StatusSummary({
119
+ groups,
120
+ overallStatus,
121
+ header,
122
+ footer,
123
+ className,
124
+ }: StatusSummaryProps): JSX.Element
125
+ ```
126
+
127
+ - `props` — Component props (see {@link StatusSummaryProps}).
128
+
129
+ ## Injection Notes
130
+
131
+ ### Requirements
132
+
133
+ Peer dependencies:
134
+
135
+ - `@molecule/app-react` ^1.0.0
136
+ - `@molecule/app-ui` ^1.0.0
137
+ - `@molecule/app-ui-react` ^1.0.0
138
+ - `react` ^18.0.0 || ^19.0.0
139
+
140
+ ### Runtime Dependencies
141
+
142
+ - `@molecule/app-react`
143
+ - `@molecule/app-ui`
144
+ - `@molecule/app-ui-react`
145
+ - `react`
146
+
147
+ - Must render inside the app's i18n provider and with a ClassMap bond
148
+ wired (`useTranslation()` / `getClassMap()` throw otherwise).
149
+ - When `overallStatus` is omitted the banner shows the WORST status
150
+ found across all components (major-outage > partial-outage >
151
+ degraded > maintenance > operational).
152
+ - Status colors are a fixed hex palette applied via inline styles
153
+ (green/yellow/orange/red/blue with white text) — they ignore the
154
+ app theme and cannot be restyled via ClassMap; acceptable for
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.
159
+ - `header` renders inside the overall banner (last-updated stamp,
160
+ subscribe button); `footer` renders below the grid (incident list).
@@ -0,0 +1,37 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ /** Union of possible component health states. */
3
+ export type ComponentStatus = 'operational' | 'degraded' | 'partial-outage' | 'major-outage' | 'maintenance';
4
+ /** A single monitored component with its current health status. */
5
+ export interface StatusComponent {
6
+ id: string;
7
+ name: ReactNode;
8
+ status: ComponentStatus;
9
+ /** Optional sub-label (SLA %, region, etc.). */
10
+ subtitle?: ReactNode;
11
+ }
12
+ /** A named group of related StatusComponent entries. */
13
+ export interface StatusGroup {
14
+ id: string;
15
+ name: ReactNode;
16
+ components: StatusComponent[];
17
+ }
18
+ /** Props for the {@link StatusSummary} component. */
19
+ export interface StatusSummaryProps {
20
+ /** Grouped components. */
21
+ groups: StatusGroup[];
22
+ /** Overall summary label (auto-derived if omitted). */
23
+ overallStatus?: ComponentStatus;
24
+ /** Optional header content (last updated time, subscribe button). */
25
+ header?: ReactNode;
26
+ /** Optional below-the-grid slot — typically a recent-incidents list. */
27
+ footer?: ReactNode;
28
+ /** Extra classes. */
29
+ className?: string;
30
+ }
31
+ /**
32
+ * Status-page summary — grouped component list with colored badges and
33
+ * an overall banner derived from the worst child status.
34
+ * @param props - Component props (see {@link StatusSummaryProps}).
35
+ */
36
+ export declare function StatusSummary({ groups, overallStatus, header, footer, className, }: StatusSummaryProps): JSX.Element;
37
+ //# sourceMappingURL=StatusSummary.d.ts.map
@@ -0,0 +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,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;AAmCD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,aAAa,EACb,MAAM,EACN,MAAM,EACN,SAAS,GACV,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAkDlC"}
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslation } from '@molecule/app-react';
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',
17
+ };
18
+ /**
19
+ * Returns the most severe status from an array of ComponentStatus values.
20
+ * @param statuses
21
+ */
22
+ function worst(statuses) {
23
+ const order = [
24
+ 'major-outage',
25
+ 'partial-outage',
26
+ 'degraded',
27
+ 'maintenance',
28
+ 'operational',
29
+ ];
30
+ for (const s of order) {
31
+ if (statuses.includes(s))
32
+ return s;
33
+ }
34
+ return 'operational';
35
+ }
36
+ /**
37
+ * Status-page summary — grouped component list with colored badges and
38
+ * an overall banner derived from the worst child status.
39
+ * @param props - Component props (see {@link StatusSummaryProps}).
40
+ */
41
+ export function StatusSummary({ groups, overallStatus, header, footer, className, }) {
42
+ const cm = getClassMap();
43
+ const { t } = useTranslation();
44
+ const allStatuses = groups.flatMap((g) => g.components.map((c) => c.status));
45
+ 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] }));
47
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Status-page summary.
3
+ *
4
+ * Exports `<StatusSummary>`, `ComponentStatus`, `StatusComponent`, `StatusGroup` types.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import { StatusSummary } from '@molecule/app-status-summary-react'
9
+ *
10
+ * <StatusSummary
11
+ * groups={[
12
+ * {
13
+ * id: 'api',
14
+ * name: 'API',
15
+ * components: [
16
+ * { id: 'rest', name: 'REST API', status: 'operational' },
17
+ * { id: 'ws', name: 'WebSockets', status: 'degraded' },
18
+ * ],
19
+ * },
20
+ * ]}
21
+ * header={<span>Last updated: 2 min ago</span>}
22
+ * />
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * - Must render inside the app's i18n provider and with a ClassMap bond
27
+ * wired (`useTranslation()` / `getClassMap()` throw otherwise).
28
+ * - When `overallStatus` is omitted the banner shows the WORST status
29
+ * found across all components (major-outage > partial-outage >
30
+ * degraded > maintenance > operational).
31
+ * - Status colors are a fixed hex palette applied via inline styles
32
+ * (green/yellow/orange/red/blue with white text) — they ignore the
33
+ * app theme and cannot be restyled via ClassMap; acceptable for
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.
38
+ * - `header` renders inside the overall banner (last-updated stamp,
39
+ * subscribe button); `footer` renders below the grid (incident list).
40
+ *
41
+ * @module
42
+ */
43
+ export * from './StatusSummary.js';
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,cAAc,oBAAoB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Status-page summary.
3
+ *
4
+ * Exports `<StatusSummary>`, `ComponentStatus`, `StatusComponent`, `StatusGroup` types.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import { StatusSummary } from '@molecule/app-status-summary-react'
9
+ *
10
+ * <StatusSummary
11
+ * groups={[
12
+ * {
13
+ * id: 'api',
14
+ * name: 'API',
15
+ * components: [
16
+ * { id: 'rest', name: 'REST API', status: 'operational' },
17
+ * { id: 'ws', name: 'WebSockets', status: 'degraded' },
18
+ * ],
19
+ * },
20
+ * ]}
21
+ * header={<span>Last updated: 2 min ago</span>}
22
+ * />
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * - Must render inside the app's i18n provider and with a ClassMap bond
27
+ * wired (`useTranslation()` / `getClassMap()` throw otherwise).
28
+ * - When `overallStatus` is omitted the banner shows the WORST status
29
+ * found across all components (major-outage > partial-outage >
30
+ * degraded > maintenance > operational).
31
+ * - Status colors are a fixed hex palette applied via inline styles
32
+ * (green/yellow/orange/red/blue with white text) — they ignore the
33
+ * app theme and cannot be restyled via ClassMap; acceptable for
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.
38
+ * - `header` renders inside the overall banner (last-updated stamp,
39
+ * subscribe button); `footer` renders below the grid (incident list).
40
+ *
41
+ * @module
42
+ */
43
+ export * from './StatusSummary.js';
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@molecule/app-status-summary-react",
3
+ "version": "1.0.0",
4
+ "description": "Status-page summary: component grid with operational/degraded/outage badges + incident list",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "test": "vitest run",
11
+ "test:watch": "vitest"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "keywords": [
24
+ "molecule",
25
+ "status-summary",
26
+ "react"
27
+ ],
28
+ "license": "Apache-2.0",
29
+ "peerDependencies": {
30
+ "@molecule/app-react": "^1.0.0",
31
+ "@molecule/app-ui": "^1.0.0",
32
+ "@molecule/app-ui-react": "^1.0.0",
33
+ "react": "^18.0.0 || ^19.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@molecule/app-react": "1.0.0",
37
+ "@molecule/app-ui": "1.0.0",
38
+ "@molecule/app-ui-react": "1.0.0",
39
+ "@types/node": "26.1.2",
40
+ "@types/react": "19.2.17",
41
+ "@types/react-dom": "19.2.3",
42
+ "react": "19.2.8",
43
+ "react-dom": "19.2.8",
44
+ "typescript": "6.0.3",
45
+ "vitest": "4.1.10"
46
+ }
47
+ }