@fabio.caffarello/react-design-system 3.10.0 → 3.12.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/dist/granular/index.js +360 -356
- package/dist/granular/index.js.map +1 -1
- package/dist/granular/ui/components/HeroSection/HeroSection.js +176 -0
- package/dist/granular/ui/components/HeroSection/HeroSection.js.map +1 -0
- package/dist/granular/ui/components/TabsAsLinks/TabsAsLinks.js +145 -0
- package/dist/granular/ui/components/TabsAsLinks/TabsAsLinks.js.map +1 -0
- package/dist/index.cjs +75 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1812 -1554
- package/dist/index.js.map +1 -1
- package/dist/react-design-system.css +1 -1
- package/dist/server/index.cjs +8 -8
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +833 -575
- package/dist/server/index.js.map +1 -1
- package/dist/ui/components/HeroSection/HeroSection.d.ts +101 -0
- package/dist/ui/components/HeroSection/index.d.ts +2 -0
- package/dist/ui/components/TabsAsLinks/TabsAsLinks.d.ts +80 -0
- package/dist/ui/components/TabsAsLinks/index.d.ts +2 -0
- package/dist/ui/components/index.d.ts +4 -0
- package/dist/ui/server.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Visual treatment of the hero surface.
|
|
4
|
+
*
|
|
5
|
+
* - `plain` — no decorative background; the hero is text + padding on
|
|
6
|
+
* whatever surface it sits on.
|
|
7
|
+
* - `gradient` — a soft brand→secondary wash (theme-aware, see
|
|
8
|
+
* `utilities/gradients.css`).
|
|
9
|
+
* - `gradient-glow` — the same wash plus a brand-colored outer glow for
|
|
10
|
+
* top-of-funnel emphasis (landing / home).
|
|
11
|
+
*/
|
|
12
|
+
export type HeroSectionVariant = "plain" | "gradient" | "gradient-glow";
|
|
13
|
+
/** Block alignment of the hero content. */
|
|
14
|
+
export type HeroSectionAlign = "start" | "center";
|
|
15
|
+
export interface HeroSectionProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
16
|
+
/** Eyebrow / kicker above the title (rendered uppercase, brand-colored). */
|
|
17
|
+
kicker?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* The hero title. Rendered as the section's `<h1>`. **Required.**
|
|
20
|
+
*
|
|
21
|
+
* When `title` is a plain string it also becomes the accessible name of
|
|
22
|
+
* the hero `<section>` landmark (the FilterChips `label` pattern). When it
|
|
23
|
+
* is a non-string `ReactNode`, supply `aria-label` or `aria-labelledby`
|
|
24
|
+
* yourself — otherwise the landmark renders without an accessible name and
|
|
25
|
+
* the component emits a dev-only warning.
|
|
26
|
+
*/
|
|
27
|
+
title: ReactNode;
|
|
28
|
+
/** Supporting copy below the title (constrained to a readable measure). */
|
|
29
|
+
description?: ReactNode;
|
|
30
|
+
/** Call-to-action slot — typically one or more `<Button>`s. */
|
|
31
|
+
actions?: ReactNode;
|
|
32
|
+
/** Metrics slot — typically a `<StatGroup>` of `<Stat>`s. Spans full width. */
|
|
33
|
+
kpis?: ReactNode;
|
|
34
|
+
/** A line of metadata below everything else (low emphasis). */
|
|
35
|
+
meta?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Visual treatment of the hero surface.
|
|
38
|
+
* @default 'plain'
|
|
39
|
+
*/
|
|
40
|
+
variant?: HeroSectionVariant;
|
|
41
|
+
/**
|
|
42
|
+
* Block alignment of the content.
|
|
43
|
+
* @default 'start'
|
|
44
|
+
*/
|
|
45
|
+
align?: HeroSectionAlign;
|
|
46
|
+
/** Additional CSS classes merged onto the root `<section>`. */
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* `HeroSection` — top-of-page hero: kicker + title + description + actions +
|
|
51
|
+
* kpis + meta, in three visual treatments (`plain` / `gradient` /
|
|
52
|
+
* `gradient-glow`) and two alignments (`start` / `center`).
|
|
53
|
+
*
|
|
54
|
+
* Distinct from `PageHeader` (contextual navigation: breadcrumb + title +
|
|
55
|
+
* actions). The hero is a page/landing **introduction** with a visual
|
|
56
|
+
* identity and slots for KPIs and metadata.
|
|
57
|
+
*
|
|
58
|
+
* ### Slots
|
|
59
|
+
*
|
|
60
|
+
* Every slot except `title` is optional and collapses cleanly when absent —
|
|
61
|
+
* no empty wrapper leaks into the DOM. `kpis` is an opaque slot: pass a
|
|
62
|
+
* `<StatGroup>` (or any node); the consumer chooses the metric layout.
|
|
63
|
+
*
|
|
64
|
+
* ### Landmark & accessible name
|
|
65
|
+
*
|
|
66
|
+
* Renders as a `<section>`. A `<section>` is only exposed as a navigable
|
|
67
|
+
* region when it has an accessible name, so the component derives one:
|
|
68
|
+
* - a string `title` becomes the `aria-label` automatically;
|
|
69
|
+
* - an explicit `aria-label` / `aria-labelledby` from the consumer always
|
|
70
|
+
* wins (and `aria-labelledby` suppresses the derived label to avoid a
|
|
71
|
+
* redundant name);
|
|
72
|
+
* - a non-string `title` with no consumer-supplied name triggers a dev-only
|
|
73
|
+
* `console.warn` (dead-code-eliminated in production builds).
|
|
74
|
+
*
|
|
75
|
+
* ### Server-safe
|
|
76
|
+
*
|
|
77
|
+
* Pure presentation — no hooks, no event handlers on the DOM. Ships in the
|
|
78
|
+
* `./server` entry. Interactive children supplied via `actions` (e.g.
|
|
79
|
+
* `<Button onClick>`) cross the RSC boundary as client references normally.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <HeroSection
|
|
84
|
+
* variant="gradient-glow"
|
|
85
|
+
* align="center"
|
|
86
|
+
* kicker="Transparência"
|
|
87
|
+
* title="Acompanhe o Congresso em tempo real"
|
|
88
|
+
* description="Proposições, votações e parlamentares — tudo em um só lugar."
|
|
89
|
+
* actions={<Button variant="primary">Começar</Button>}
|
|
90
|
+
* kpis={
|
|
91
|
+
* <StatGroup layout="strip">
|
|
92
|
+
* <Stat value="9,4 mil" label="Parlamentares" align="center" />
|
|
93
|
+
* <Stat value="3,2 mil" label="Proposições" align="center" />
|
|
94
|
+
* </StatGroup>
|
|
95
|
+
* }
|
|
96
|
+
* meta="Atualizado diariamente"
|
|
97
|
+
* />
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
declare const HeroSection: import("react").ForwardRefExoticComponent<HeroSectionProps & import("react").RefAttributes<HTMLElement>>;
|
|
101
|
+
export default HeroSection;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ElementType, HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
/** Visual hierarchy: `default` = primary tab bar, `sub` = nested sub-tabs. */
|
|
3
|
+
export type TabsAsLinksVariant = "default" | "sub";
|
|
4
|
+
/** A single navigation tab. The active state is decided by the caller. */
|
|
5
|
+
export interface TabAsLink {
|
|
6
|
+
/** Visible tab label. */
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
/** Destination URL — pre-computed by the caller. */
|
|
9
|
+
href: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether this tab is the current one. The caller derives it (from
|
|
12
|
+
* `pathname` / `searchParams`); the component does no detection of its own.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
active?: boolean;
|
|
16
|
+
/** Optional leading icon (decorative — rendered `aria-hidden`). */
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
/** Optional trailing count (e.g. number of items behind the tab). */
|
|
19
|
+
count?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface TabsAsLinksProps extends HTMLAttributes<HTMLElement> {
|
|
22
|
+
/** The tabs to render, in order. */
|
|
23
|
+
items: TabAsLink[];
|
|
24
|
+
/**
|
|
25
|
+
* Visual hierarchy.
|
|
26
|
+
* @default 'default'
|
|
27
|
+
*/
|
|
28
|
+
variant?: TabsAsLinksVariant;
|
|
29
|
+
/**
|
|
30
|
+
* Element/component each tab renders as. Defaults to a plain `<a>` (zero
|
|
31
|
+
* JS, works without hydration). Pass a router link — e.g. Next's `Link` —
|
|
32
|
+
* to keep client-side navigation/prefetch: `linkComponent={Link}`. It
|
|
33
|
+
* receives `href`, `className`, `aria-current`, and `children`.
|
|
34
|
+
* @default 'a'
|
|
35
|
+
*/
|
|
36
|
+
linkComponent?: ElementType;
|
|
37
|
+
/** Additional CSS classes merged onto the root `<nav>`. */
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* `TabsAsLinks` — tabs rendered as **navigation links**, with the active tab
|
|
42
|
+
* decided by the caller (from the URL), not by interactive state.
|
|
43
|
+
*
|
|
44
|
+
* This is the server-safe counterpart to the interactive `Tabs` widget. Use
|
|
45
|
+
* it for tab bars whose selection lives in the URL (`?tab=`, `/section`) so
|
|
46
|
+
* they work without JavaScript and survive a shared link. Because each tab is
|
|
47
|
+
* a real link to a distinct destination, the component uses the **navigation**
|
|
48
|
+
* pattern — a named `<nav>` landmark with `aria-current="page"` on the active
|
|
49
|
+
* link — NOT the `role="tab"` widget pattern (which would promise arrow-key
|
|
50
|
+
* semantics that links don't have).
|
|
51
|
+
*
|
|
52
|
+
* ### Accessible name
|
|
53
|
+
*
|
|
54
|
+
* Renders a `<nav>` landmark, which must be named so screen-reader users can
|
|
55
|
+
* tell multiple tab bars apart. Pass `aria-label` (e.g. `"Painel"`) or
|
|
56
|
+
* `aria-labelledby`. With neither, a dev-only warning fires (the landmark
|
|
57
|
+
* still renders, just anonymously).
|
|
58
|
+
*
|
|
59
|
+
* ### Server-safe
|
|
60
|
+
*
|
|
61
|
+
* No hooks, no event handlers on the DOM — pure presentation. Ships in the
|
|
62
|
+
* `./server` entry. Defaults to a plain `<a>`; pass `linkComponent={Link}` to
|
|
63
|
+
* keep a router's client-side navigation, which crosses the RSC boundary as a
|
|
64
|
+
* client reference.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```tsx
|
|
68
|
+
* // Next App Router — active derived from searchParams in a Server Component
|
|
69
|
+
* <TabsAsLinks
|
|
70
|
+
* aria-label="Painel"
|
|
71
|
+
* linkComponent={Link}
|
|
72
|
+
* items={[
|
|
73
|
+
* { label: "Visão geral", href: "/painel?tab=overview", active: tab === "overview" },
|
|
74
|
+
* { label: "Alertas", href: "/painel?tab=alerts", active: tab === "alerts", count: 3 },
|
|
75
|
+
* ]}
|
|
76
|
+
* />
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
declare const TabsAsLinks: import("react").ForwardRefExoticComponent<TabsAsLinksProps & import("react").RefAttributes<HTMLElement>>;
|
|
80
|
+
export default TabsAsLinks;
|
|
@@ -81,3 +81,7 @@ export { DataTablePattern, type DataTablePatternProps, type DataTableColumn, } f
|
|
|
81
81
|
export { FormWizardPattern, type FormWizardPatternProps, type FormWizardStep, } from "./FormWizardPattern";
|
|
82
82
|
export { SearchAndFilterPattern, type SearchAndFilterPatternProps, type FilterConfig, type FilterOption, } from "./SearchAndFilterPattern";
|
|
83
83
|
export { DashboardLayout, type DashboardLayoutProps } from "./DashboardLayout";
|
|
84
|
+
export { default as HeroSection } from "./HeroSection";
|
|
85
|
+
export type { HeroSectionProps, HeroSectionVariant, HeroSectionAlign, } from "./HeroSection";
|
|
86
|
+
export { default as TabsAsLinks } from "./TabsAsLinks";
|
|
87
|
+
export type { TabsAsLinksProps, TabAsLink, TabsAsLinksVariant, } from "./TabsAsLinks";
|
package/dist/ui/server.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export { HeaderActions } from "./components/Header/components/HeaderActions";
|
|
|
49
49
|
export type { HeaderActionsProps } from "./components/Header/components/HeaderActions";
|
|
50
50
|
export { HeaderNavigation } from "./components/Header/components/HeaderNavigation";
|
|
51
51
|
export type { HeaderNavigationProps } from "./components/Header/components/HeaderNavigation";
|
|
52
|
+
export { default as HeroSection } from "./components/HeroSection/HeroSection";
|
|
53
|
+
export type { HeroSectionProps, HeroSectionVariant, HeroSectionAlign, } from "./components/HeroSection/HeroSection";
|
|
52
54
|
export { default as MenuSeparator } from "./components/Menu/MenuSeparator";
|
|
53
55
|
export type { MenuSeparatorProps } from "./components/Menu/MenuSeparator";
|
|
54
56
|
export { default as NavbarSeparator } from "./components/SideNavbar/components/Navbar/NavbarSeparator";
|
|
@@ -61,5 +63,7 @@ export { StatGroup } from "./components/Stat/StatGroup";
|
|
|
61
63
|
export type { StatGroupProps, StatGroupLayout, StatGroupCols, } from "./components/Stat/StatGroup";
|
|
62
64
|
export { default as TableCell } from "./components/Table/TableCell";
|
|
63
65
|
export type { TableCellProps } from "./components/Table/TableCell";
|
|
66
|
+
export { default as TabsAsLinks } from "./components/TabsAsLinks/TabsAsLinks";
|
|
67
|
+
export type { TabsAsLinksProps, TabAsLink, TabsAsLinksVariant, } from "./components/TabsAsLinks/TabsAsLinks";
|
|
64
68
|
export { default as Timeline } from "./components/Timeline/Timeline";
|
|
65
69
|
export type { TimelineItem, TimelineOrientation, TimelineProps, } from "./components/Timeline/Timeline";
|