@fabio.caffarello/react-design-system 4.4.0 → 4.6.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 +15 -1
- package/dist/granular/ui/components/Stat/StatGroup.js +51 -36
- package/dist/granular/ui/components/Stat/StatGroup.js.map +1 -1
- package/dist/index.cjs +31 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +577 -563
- package/dist/index.js.map +1 -1
- package/dist/react-design-system.css +1 -1
- package/dist/server/index.cjs +13 -13
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +331 -317
- package/dist/server/index.js.map +1 -1
- package/dist/tokens.css +2920 -0
- package/dist/ui/components/Stat/StatGroup.d.ts +59 -11
- package/package.json +16 -14
|
@@ -23,6 +23,53 @@ export interface StatGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
23
23
|
* @default 4
|
|
24
24
|
*/
|
|
25
25
|
cols?: StatGroupCols;
|
|
26
|
+
/**
|
|
27
|
+
* Optional slot for a badge that floats centered over the top border of
|
|
28
|
+
* the container. Use when all metrics in the group share a common
|
|
29
|
+
* provenance mark (e.g. a trust badge, data-source seal, tier label).
|
|
30
|
+
*
|
|
31
|
+
* The slot is intentionally opaque — the consumer supplies any ReactNode
|
|
32
|
+
* and owns the badge's styling and a11y. `StatGroup` provides only the
|
|
33
|
+
* positioning, not the badge shape. This is the same convention as the
|
|
34
|
+
* `kicker` slot in `HeroSection` or the `badge` slot in `PageHeader`.
|
|
35
|
+
*
|
|
36
|
+
* ### Layout
|
|
37
|
+
*
|
|
38
|
+
* When `floatingBadge` is supplied the outer container gains
|
|
39
|
+
* `pt-4` (16 px) top padding, which creates a landing zone for the
|
|
40
|
+
* badge's bottom half while keeping the first stat row clear. The badge
|
|
41
|
+
* itself is absolutely centred at `top-4 left-1/2`, then shifted up by
|
|
42
|
+
* `−50%` of its own height so its centre sits on the inner container's
|
|
43
|
+
* top border. This calibration is accurate for badges up to ~32 px tall
|
|
44
|
+
* (a standard `Badge` or small `Chip`). If a taller badge is needed,
|
|
45
|
+
* pass a `className` that increases the top padding to match.
|
|
46
|
+
*
|
|
47
|
+
* ### Reading order
|
|
48
|
+
*
|
|
49
|
+
* The badge node appears in the DOM **before** the stat cells, so screen
|
|
50
|
+
* readers encounter it first — "Fonte oficial, followed by the metrics" —
|
|
51
|
+
* which is the correct contextual order.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* import { CheckCircle2 } from "lucide-react";
|
|
56
|
+
* import { Badge } from "@fabio.caffarello/react-design-system";
|
|
57
|
+
*
|
|
58
|
+
* <StatGroup
|
|
59
|
+
* layout="strip"
|
|
60
|
+
* floatingBadge={
|
|
61
|
+
* <Badge variant="success" size="sm">
|
|
62
|
+
* <CheckCircle2 size={10} aria-hidden="true" />
|
|
63
|
+
* Fonte oficial
|
|
64
|
+
* </Badge>
|
|
65
|
+
* }
|
|
66
|
+
* >
|
|
67
|
+
* <Stat icon={<Users />} value="726" label="Parlam." align="center" />
|
|
68
|
+
* <Stat icon={<FileText />} value="28,1 mil" label="Proposições" align="center" />
|
|
69
|
+
* </StatGroup>
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
floatingBadge?: ReactNode;
|
|
26
73
|
children: ReactNode;
|
|
27
74
|
}
|
|
28
75
|
/**
|
|
@@ -31,17 +78,18 @@ export interface StatGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
31
78
|
*
|
|
32
79
|
* ### Divider technique
|
|
33
80
|
*
|
|
34
|
-
* The container has `bg-line-default` and `gap-px` (1 px); each
|
|
35
|
-
* `Stat` carries its own `bg-surface-base`. The 1 px of gap exposes
|
|
36
|
-
* container's background as the divider line, while each cell masks
|
|
37
|
-
* own area with `bg-surface-base`. Works identically for the strip
|
|
38
|
-
* layout (vertical dividers) and the grid layout (vertical AND
|
|
39
|
-
*
|
|
40
|
-
*
|
|
81
|
+
* The inner container has `bg-line-default` and `gap-px` (1 px); each
|
|
82
|
+
* child `Stat` carries its own `bg-surface-base`. The 1 px of gap exposes
|
|
83
|
+
* the container's background as the divider line, while each cell masks
|
|
84
|
+
* its own area with `bg-surface-base`. Works identically for the strip
|
|
85
|
+
* layout (vertical dividers) and the grid layout (vertical AND horizontal
|
|
86
|
+
* dividers, automatically, as the grid reflows). No separate `Divider`
|
|
87
|
+
* component, no per-cell border logic.
|
|
41
88
|
*
|
|
42
|
-
* The
|
|
43
|
-
* with `rounded-lg` and `overflow-hidden` clipping the inner cells to
|
|
44
|
-
* the
|
|
89
|
+
* The inner ring is `border border-line-default` matching the gap color,
|
|
90
|
+
* with `rounded-lg` and `overflow-hidden` clipping the inner cells to the
|
|
91
|
+
* radius. The outer wrapper is `relative` so the optional `floatingBadge`
|
|
92
|
+
* can be absolutely positioned over the inner container's top border.
|
|
45
93
|
*
|
|
46
94
|
* ### Server-safe
|
|
47
95
|
*
|
|
@@ -65,5 +113,5 @@ export interface StatGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
65
113
|
* </StatGroup>
|
|
66
114
|
* ```
|
|
67
115
|
*/
|
|
68
|
-
export declare function StatGroup({ layout, cols, className, children, ...props }: StatGroupProps): import("react").JSX.Element;
|
|
116
|
+
export declare function StatGroup({ layout, cols, floatingBadge, className, children, ...props }: StatGroupProps): import("react").JSX.Element;
|
|
69
117
|
export default StatGroup;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabio.caffarello/react-design-system",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.6.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
"import": "./dist/granular/index.js"
|
|
33
33
|
},
|
|
34
34
|
"./styles": "./dist/react-design-system.css",
|
|
35
|
-
"./styles.css": "./dist/react-design-system.css"
|
|
35
|
+
"./styles.css": "./dist/react-design-system.css",
|
|
36
|
+
"./theme": "./dist/tokens.css",
|
|
37
|
+
"./theme.css": "./dist/tokens.css"
|
|
36
38
|
},
|
|
37
39
|
"files": [
|
|
38
40
|
"dist",
|
|
@@ -43,8 +45,8 @@
|
|
|
43
45
|
"access": "public"
|
|
44
46
|
},
|
|
45
47
|
"scripts": {
|
|
46
|
-
"build": "npx tsc --project tsconfig.app.json --declaration --emitDeclarationOnly --outDir dist && vite build && vite build --config vite.config.server.ts && vite build --config vite.config.hooks.ts && vite build --config vite.config.granular.ts && npm run build:validate",
|
|
47
|
-
"build:validate": "tsx scripts/validate-build-exports.ts && node scripts/validate-use-client-in-dist.mjs && node scripts/validate-server-entry.mjs",
|
|
48
|
+
"build": "npx tsc --project tsconfig.app.json --declaration --emitDeclarationOnly --outDir dist && vite build && vite build --config vite.config.server.ts && vite build --config vite.config.hooks.ts && vite build --config vite.config.granular.ts && node scripts/build-tokens-css.mjs && npm run build:validate",
|
|
49
|
+
"build:validate": "tsx scripts/validate-build-exports.ts && node scripts/validate-use-client-in-dist.mjs && node scripts/validate-server-entry.mjs && node scripts/validate-theme-export.mjs",
|
|
48
50
|
"lint": "eslint .",
|
|
49
51
|
"typecheck": "tsc --build --force tsconfig.json",
|
|
50
52
|
"storybook": "storybook dev -p 6006",
|
|
@@ -101,14 +103,14 @@
|
|
|
101
103
|
"@commitlint/config-conventional": "^21.0.2",
|
|
102
104
|
"@eslint/js": "^10.0.1",
|
|
103
105
|
"@playwright/test": "^1.60.0",
|
|
104
|
-
"@storybook/addon-a11y": "^10.4.
|
|
106
|
+
"@storybook/addon-a11y": "^10.4.6",
|
|
105
107
|
"@storybook/addon-coverage": "^3.0.1",
|
|
106
108
|
"@storybook/addon-designs": "^11.1.3",
|
|
107
|
-
"@storybook/addon-docs": "^10.4.
|
|
109
|
+
"@storybook/addon-docs": "^10.4.6",
|
|
108
110
|
"@storybook/addon-measure": "^9.0.8",
|
|
109
111
|
"@storybook/addon-outline": "^9.0.8",
|
|
110
|
-
"@storybook/addon-vitest": "^10.4.
|
|
111
|
-
"@storybook/react-vite": "^10.4.
|
|
112
|
+
"@storybook/addon-vitest": "^10.4.6",
|
|
113
|
+
"@storybook/react-vite": "^10.4.6",
|
|
112
114
|
"@storybook/test": "^8.6.15",
|
|
113
115
|
"@tailwindcss/vite": "^4.3.0",
|
|
114
116
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -125,10 +127,10 @@
|
|
|
125
127
|
"baseline-browser-mapping": "^2.10.37",
|
|
126
128
|
"culori": "^4.0.2",
|
|
127
129
|
"dependency-cruiser": "^17.3.6",
|
|
128
|
-
"eslint": "^10.
|
|
130
|
+
"eslint": "^10.5.0",
|
|
129
131
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
130
|
-
"eslint-plugin-react-refresh": "^0.
|
|
131
|
-
"eslint-plugin-storybook": "^10.4.
|
|
132
|
+
"eslint-plugin-react-refresh": "^0.5.3",
|
|
133
|
+
"eslint-plugin-storybook": "^10.4.6",
|
|
132
134
|
"globals": "^16.4.0",
|
|
133
135
|
"husky": "^9.1.7",
|
|
134
136
|
"jsdom": "^29.1.1",
|
|
@@ -137,15 +139,15 @@
|
|
|
137
139
|
"madge": "^8.0.0",
|
|
138
140
|
"plop": "^4.0.5",
|
|
139
141
|
"postcss": "^8.5.6",
|
|
140
|
-
"prettier": "^3.8.
|
|
142
|
+
"prettier": "^3.8.4",
|
|
141
143
|
"react-hook-form": "^7.79.0",
|
|
142
144
|
"remark-gfm": "^4.0.1",
|
|
143
|
-
"storybook": "^10.4.
|
|
145
|
+
"storybook": "^10.4.6",
|
|
144
146
|
"storybook-addon-performance": "^0.17.3",
|
|
145
147
|
"tailwindcss": "^4.3.0",
|
|
146
148
|
"tsx": "^4.22.4",
|
|
147
149
|
"typescript": "~6.0.3",
|
|
148
|
-
"typescript-eslint": "^8.
|
|
150
|
+
"typescript-eslint": "^8.61.1",
|
|
149
151
|
"vite": "^7.1.7",
|
|
150
152
|
"vite-tsconfig-paths": "^6.1.1",
|
|
151
153
|
"vitest": "^4.1.8"
|