@molecule/app-comparison-row-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 +2 -2
- package/dist/ComparisonRow.d.ts.map +1 -1
- package/dist/ComparisonRow.js +6 -2
- package/package.json +6 -6
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-16T01:05:18.943Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-comparison-row-react
|
|
@@ -97,7 +97,7 @@ function ComparisonRow({
|
|
|
97
97
|
Peer dependencies:
|
|
98
98
|
|
|
99
99
|
- `@molecule/app-react` ^4.0.0
|
|
100
|
-
- `@molecule/app-ui` ^1.0
|
|
100
|
+
- `@molecule/app-ui` ^1.4.0
|
|
101
101
|
- `@molecule/app-ui-react` ^4.0.0
|
|
102
102
|
- `react` ^18.0.0 || ^19.0.0
|
|
103
103
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComparisonRow.d.ts","sourceRoot":"","sources":["../src/ComparisonRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ComparisonRow.d.ts","sourceRoot":"","sources":["../src/ComparisonRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAK3C,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,KAAK,EAAE,SAAS,CAAA;IAChB,wCAAwC;IACxC,OAAO,EAAE,SAAS,CAAA;IAClB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAA;IAC7C,2CAA2C;IAC3C,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAUD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,WAAW,EACX,SAAS,GACV,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAwClC"}
|
package/dist/ComparisonRow.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { getClassMap } from '@molecule/app-ui';
|
|
3
3
|
const ARROW = (n) => (n > 0 ? '▲' : n < 0 ? '▼' : '–');
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The semantic tone colouring the delta: the theme's success green for a
|
|
6
|
+
* rise, its error red for a fall, its secondary grey for no change.
|
|
7
|
+
*/
|
|
8
|
+
const TONE = (n) => (n > 0 ? 'success' : n < 0 ? 'error' : 'secondary');
|
|
5
9
|
/**
|
|
6
10
|
* Period-over-period stat comparison row — current value, optional
|
|
7
11
|
* previous value, and a coloured delta% chip. Used in dashboards,
|
|
@@ -10,5 +14,5 @@ const COLOR = (n) => (n > 0 ? '#22c55e' : n < 0 ? '#ef4444' : '#94a3b8');
|
|
|
10
14
|
*/
|
|
11
15
|
export function ComparisonRow({ label, current, previous, deltaPct, formatDelta, periodLabel, className, }) {
|
|
12
16
|
const cm = getClassMap();
|
|
13
|
-
return (_jsxs("div", { className: cm.cn(cm.flex({ align: 'baseline', justify: 'between', gap: 'md' }), className), children: [_jsxs("div", { className: cm.stack(0), children: [_jsx("span", { className: cm.cn(cm.textSize('xs'), cm.fontWeight('semibold')), children: label }), periodLabel && _jsx("span", { className: cm.textSize('xs'), children: periodLabel })] }), _jsxs("div", { className: cm.flex({ align: 'baseline', gap: 'sm' }), children: [_jsx("span", { className: cm.cn(cm.textSize('lg'), cm.fontWeight('bold')), children: current }), previous !== undefined && (_jsx("span", { className: cm.cn(cm.textSize('xs')), style: { textDecoration: 'line-through', opacity: 0.6 }, children: previous })), deltaPct !== undefined && (_jsx("span", { className: cm.cn(cm.textSize('xs'), cm.fontWeight('semibold')
|
|
17
|
+
return (_jsxs("div", { className: cm.cn(cm.flex({ align: 'baseline', justify: 'between', gap: 'md' }), className), children: [_jsxs("div", { className: cm.stack(0), children: [_jsx("span", { className: cm.cn(cm.textSize('xs'), cm.fontWeight('semibold')), children: label }), periodLabel && _jsx("span", { className: cm.textSize('xs'), children: periodLabel })] }), _jsxs("div", { className: cm.flex({ align: 'baseline', gap: 'sm' }), children: [_jsx("span", { className: cm.cn(cm.textSize('lg'), cm.fontWeight('bold')), children: current }), previous !== undefined && (_jsx("span", { className: cm.cn(cm.textSize('xs')), style: { textDecoration: 'line-through', opacity: 0.6 }, children: previous })), deltaPct !== undefined && (_jsx("span", { className: cm.cn(cm.textSize('xs'), cm.fontWeight('semibold'), cm.textTone(TONE(deltaPct))), children: formatDelta ? (formatDelta(deltaPct)) : (_jsxs(_Fragment, { children: [ARROW(deltaPct), " ", Math.abs(deltaPct).toFixed(1), "%"] })) }))] })] }));
|
|
14
18
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-comparison-row-react",
|
|
3
|
-
"version": "4.0.
|
|
4
|
-
"description": "Period-over-period stat comparison (\"
|
|
3
|
+
"version": "4.0.2",
|
|
4
|
+
"description": "Period-over-period stat comparison (\" vs \", with delta)",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-comparison-row-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
|
|
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.
|
|
43
|
-
"@molecule/app-ui": "1.
|
|
44
|
-
"@molecule/app-ui-react": "4.
|
|
42
|
+
"@molecule/app-react": "4.7.2",
|
|
43
|
+
"@molecule/app-ui": "1.4.0",
|
|
44
|
+
"@molecule/app-ui-react": "4.1.5",
|
|
45
45
|
"@types/node": "26.6.5",
|
|
46
46
|
"@types/react": "19.3.0",
|
|
47
47
|
"@types/react-dom": "19.3.0",
|