@fabio.caffarello/react-design-system 4.5.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.
@@ -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 child
35
- * `Stat` carries its own `bg-surface-base`. The 1 px of gap exposes the
36
- * container's background as the divider line, while each cell masks its
37
- * own area with `bg-surface-base`. Works identically for the strip
38
- * layout (vertical dividers) and the grid layout (vertical AND
39
- * horizontal dividers, automatically, as the grid reflows). No separate
40
- * `Divider` component, no per-cell border logic.
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 outer ring is `border border-line-default` matching the gap color,
43
- * with `rounded-lg` and `overflow-hidden` clipping the inner cells to
44
- * the radius.
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.5.0",
4
+ "version": "4.6.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",