@fabio.caffarello/react-design-system 3.9.0 → 3.11.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.
@@ -0,0 +1,83 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ export interface FilterChipsProps extends HTMLAttributes<HTMLDivElement> {
3
+ /**
4
+ * Optional group label rendered as neutral text at the left of the
5
+ * chips (e.g. "Filtros"). Deliberately NOT a `<legend>`/`<fieldset>`
6
+ * pair — FilterChips groups navigation/selection chips, not form
7
+ * controls, and fieldset semantics would imply a form that isn't
8
+ * there. When `label` is a plain string it doubles as the group's
9
+ * accessible name (see the aria-label contract in the component
10
+ * JSDoc).
11
+ */
12
+ label?: ReactNode;
13
+ /**
14
+ * The chips. Typically `<Chip>` elements — including the
15
+ * `<Chip asChild><Link/></Chip>` navigation form — but any inline
16
+ * content composes.
17
+ */
18
+ children: ReactNode;
19
+ /**
20
+ * Whether chips wrap to new lines when they overflow the container
21
+ * width. `true` (default) applies `flex-wrap` — the responsive
22
+ * filter-bar behavior; `false` applies `flex-nowrap` and keeps
23
+ * everything on one line (consumer owns overflow handling).
24
+ * @default true
25
+ */
26
+ wrap?: boolean;
27
+ }
28
+ /**
29
+ * `FilterChips` — groups `Chip`s into a labeled filter bar.
30
+ *
31
+ * The shell of every chip-based filter row: a `role="group"` container
32
+ * with an optional neutral text label at the left and a flex run of
33
+ * chips that wraps responsively by default. Purely presentational — the
34
+ * interactive identity (select, navigate, remove) lives in each `Chip`
35
+ * (`onClick`/`onRemove`, or `asChild` with a consumer `<Link>`), never
36
+ * in this wrapper.
37
+ *
38
+ * ### Accessible name contract
39
+ *
40
+ * The container carries `role="group"` so assistive technology can
41
+ * announce the chips as one named unit. The accessible name resolves in
42
+ * this order:
43
+ *
44
+ * 1. An explicit `aria-label` OR `aria-labelledby` passed by the
45
+ * consumer always wins — when either is present, no name is derived
46
+ * from `label`, so the consumer's attribute is the only naming on the
47
+ * element (no redundant `aria-label` is left alongside an
48
+ * `aria-labelledby`).
49
+ * 2. Otherwise, when `label` is a non-empty plain string, it is reused
50
+ * as the group's `aria-label` automatically.
51
+ * 3. When `label` is a non-string `ReactNode` (or absent), no
52
+ * `aria-label` is derived — supply `aria-label`/`aria-labelledby`
53
+ * yourself if the group needs a name AT users can identify it by.
54
+ *
55
+ * ### Server-safe
56
+ *
57
+ * Pure presentation — no hooks, no event handlers on the DOM. Ships in
58
+ * the `./server` entry. Consumer-supplied chips may themselves be
59
+ * client components (`<Chip onRemove>`); React's RSC boundary handles
60
+ * that normally, and the zero-JS path (`<Chip asChild><Link/></Chip>`)
61
+ * stays fully server-rendered.
62
+ *
63
+ * @example
64
+ * ```tsx
65
+ * // Navigation filter bar — server-rendered, zero-JS-friendly.
66
+ * <FilterChips label="Filtros">
67
+ * <Chip asChild selected>
68
+ * <Link href="?uf=SP" aria-current="page">UF: SP</Link>
69
+ * </Chip>
70
+ * <Chip asChild>
71
+ * <Link href="?partido=PT">Partido: PT</Link>
72
+ * </Chip>
73
+ * </FilterChips>
74
+ *
75
+ * // Single-line variant (consumer owns horizontal overflow).
76
+ * <FilterChips label="Período" wrap={false}>
77
+ * <Chip>2024</Chip>
78
+ * <Chip>2025</Chip>
79
+ * </FilterChips>
80
+ * ```
81
+ */
82
+ export declare function FilterChips({ label, children, wrap, className, ...props }: FilterChipsProps): import("react").JSX.Element;
83
+ export default FilterChips;
@@ -0,0 +1,2 @@
1
+ export { FilterChips, default } from "./FilterChips";
2
+ export type { FilterChipsProps } from "./FilterChips";
@@ -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;
@@ -0,0 +1,2 @@
1
+ export { default } from "./TabsAsLinks";
2
+ export type { TabsAsLinksProps, TabAsLink, TabsAsLinksVariant, } from "./TabsAsLinks";
@@ -1,6 +1,8 @@
1
1
  export { default as Card } from "./Card";
2
2
  export { Stat, StatGroup } from "./Stat";
3
3
  export type { StatProps, StatTone, StatAlign, StatGroupProps, StatGroupLayout, StatGroupCols, } from "./Stat";
4
+ export { default as FilterChips } from "./FilterChips";
5
+ export type { FilterChipsProps } from "./FilterChips";
4
6
  export * from "./Form";
5
7
  export { default as Breadcrumb } from "./Breadcrumb";
6
8
  export type { BreadcrumbItem } from "./Breadcrumb";
@@ -79,3 +81,5 @@ export { DataTablePattern, type DataTablePatternProps, type DataTableColumn, } f
79
81
  export { FormWizardPattern, type FormWizardPatternProps, type FormWizardStep, } from "./FormWizardPattern";
80
82
  export { SearchAndFilterPattern, type SearchAndFilterPatternProps, type FilterConfig, type FilterOption, } from "./SearchAndFilterPattern";
81
83
  export { DashboardLayout, type DashboardLayoutProps } from "./DashboardLayout";
84
+ export { default as TabsAsLinks } from "./TabsAsLinks";
85
+ export type { TabsAsLinksProps, TabAsLink, TabsAsLinksVariant, } from "./TabsAsLinks";
@@ -43,6 +43,8 @@ export { default as DrawerHeader } from "./components/Drawer/DrawerHeader";
43
43
  export type { DrawerHeaderProps } from "./components/Drawer/DrawerHeader";
44
44
  export { default as DrawerFooter } from "./components/Drawer/DrawerFooter";
45
45
  export type { DrawerFooterProps } from "./components/Drawer/DrawerFooter";
46
+ export { FilterChips } from "./components/FilterChips/FilterChips";
47
+ export type { FilterChipsProps } from "./components/FilterChips/FilterChips";
46
48
  export { HeaderActions } from "./components/Header/components/HeaderActions";
47
49
  export type { HeaderActionsProps } from "./components/Header/components/HeaderActions";
48
50
  export { HeaderNavigation } from "./components/Header/components/HeaderNavigation";
@@ -59,5 +61,7 @@ export { StatGroup } from "./components/Stat/StatGroup";
59
61
  export type { StatGroupProps, StatGroupLayout, StatGroupCols, } from "./components/Stat/StatGroup";
60
62
  export { default as TableCell } from "./components/Table/TableCell";
61
63
  export type { TableCellProps } from "./components/Table/TableCell";
64
+ export { default as TabsAsLinks } from "./components/TabsAsLinks/TabsAsLinks";
65
+ export type { TabsAsLinksProps, TabAsLink, TabsAsLinksVariant, } from "./components/TabsAsLinks/TabsAsLinks";
62
66
  export { default as Timeline } from "./components/Timeline/Timeline";
63
67
  export type { TimelineItem, TimelineOrientation, TimelineProps, } from "./components/Timeline/Timeline";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fabio.caffarello/react-design-system",
3
3
  "private": false,
4
- "version": "3.9.0",
4
+ "version": "3.11.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",