@fabio.caffarello/react-design-system 3.9.0 → 3.10.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 +358 -356
- package/dist/granular/index.js.map +1 -1
- package/dist/granular/ui/components/FilterChips/FilterChips.js +67 -0
- package/dist/granular/ui/components/FilterChips/FilterChips.js.map +1 -0
- package/dist/index.cjs +29 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +124 -86
- package/dist/index.js.map +1 -1
- package/dist/react-design-system.css +1 -1
- package/dist/server/index.cjs +6 -6
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +168 -130
- package/dist/server/index.js.map +1 -1
- package/dist/ui/components/FilterChips/FilterChips.d.ts +83 -0
- package/dist/ui/components/FilterChips/index.d.ts +2 -0
- package/dist/ui/components/index.d.ts +2 -0
- package/dist/ui/server.d.ts +2 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -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";
|
package/dist/ui/server.d.ts
CHANGED
|
@@ -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";
|