@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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ var p = Object.defineProperty, x = Object.defineProperties;
3
+ var g = Object.getOwnPropertyDescriptors;
4
+ var n = Object.getOwnPropertySymbols;
5
+ var o = Object.prototype.hasOwnProperty, m = Object.prototype.propertyIsEnumerable;
6
+ var l = (e, r, a) => r in e ? p(e, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[r] = a, c = (e, r) => {
7
+ for (var a in r || (r = {}))
8
+ o.call(r, a) && l(e, a, r[a]);
9
+ if (n)
10
+ for (var a of n(r))
11
+ m.call(r, a) && l(e, a, r[a]);
12
+ return e;
13
+ }, u = (e, r) => x(e, g(r));
14
+ var f = (e, r) => {
15
+ var a = {};
16
+ for (var s in e)
17
+ o.call(e, s) && r.indexOf(s) < 0 && (a[s] = e[s]);
18
+ if (e != null && n)
19
+ for (var s of n(e))
20
+ r.indexOf(s) < 0 && m.call(e, s) && (a[s] = e[s]);
21
+ return a;
22
+ };
23
+ import { jsxs as h, jsx as C } from "react/jsx-runtime";
24
+ import { getSpacingClass as N } from "../../tokens/spacing.js";
25
+ import { cn as v } from "../../utils/cn.js";
26
+ function F(y) {
27
+ var i = y, {
28
+ label: e,
29
+ children: r,
30
+ wrap: a = !0,
31
+ className: s
32
+ } = i, t = f(i, [
33
+ "label",
34
+ "children",
35
+ "wrap",
36
+ "className"
37
+ ]);
38
+ const d = !(t["aria-label"] != null || t["aria-labelledby"] != null) && typeof e == "string" && e !== "" ? e : void 0;
39
+ return /* @__PURE__ */ h(
40
+ "div",
41
+ u(c({
42
+ role: "group",
43
+ "aria-label": d,
44
+ className: v(
45
+ "flex items-center",
46
+ a ? "flex-wrap" : "flex-nowrap",
47
+ N("sm", "gap"),
48
+ s
49
+ )
50
+ }, t), {
51
+ children: [
52
+ e ? (
53
+ // shrink-0 keeps the label a stable leading unit: in the wrapping
54
+ // flex run it must not be squeezed or mid-word-wrapped when the
55
+ // chips overflow — it stays on one line and the chips wrap around it.
56
+ /* @__PURE__ */ C("span", { className: "shrink-0 text-fg-secondary text-sm", children: e })
57
+ ) : null,
58
+ r
59
+ ]
60
+ })
61
+ );
62
+ }
63
+ export {
64
+ F as FilterChips,
65
+ F as default
66
+ };
67
+ //# sourceMappingURL=FilterChips.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterChips.js","sources":["../../../../../src/ui/components/FilterChips/FilterChips.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { getSpacingClass } from \"../../tokens/spacing\";\nimport { cn } from \"../../utils\";\n\nexport interface FilterChipsProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Optional group label rendered as neutral text at the left of the\n * chips (e.g. \"Filtros\"). Deliberately NOT a `<legend>`/`<fieldset>`\n * pair — FilterChips groups navigation/selection chips, not form\n * controls, and fieldset semantics would imply a form that isn't\n * there. When `label` is a plain string it doubles as the group's\n * accessible name (see the aria-label contract in the component\n * JSDoc).\n */\n label?: ReactNode;\n /**\n * The chips. Typically `<Chip>` elements — including the\n * `<Chip asChild><Link/></Chip>` navigation form — but any inline\n * content composes.\n */\n children: ReactNode;\n /**\n * Whether chips wrap to new lines when they overflow the container\n * width. `true` (default) applies `flex-wrap` — the responsive\n * filter-bar behavior; `false` applies `flex-nowrap` and keeps\n * everything on one line (consumer owns overflow handling).\n * @default true\n */\n wrap?: boolean;\n}\n\n/**\n * `FilterChips` — groups `Chip`s into a labeled filter bar.\n *\n * The shell of every chip-based filter row: a `role=\"group\"` container\n * with an optional neutral text label at the left and a flex run of\n * chips that wraps responsively by default. Purely presentational — the\n * interactive identity (select, navigate, remove) lives in each `Chip`\n * (`onClick`/`onRemove`, or `asChild` with a consumer `<Link>`), never\n * in this wrapper.\n *\n * ### Accessible name contract\n *\n * The container carries `role=\"group\"` so assistive technology can\n * announce the chips as one named unit. The accessible name resolves in\n * this order:\n *\n * 1. An explicit `aria-label` OR `aria-labelledby` passed by the\n * consumer always wins — when either is present, no name is derived\n * from `label`, so the consumer's attribute is the only naming on the\n * element (no redundant `aria-label` is left alongside an\n * `aria-labelledby`).\n * 2. Otherwise, when `label` is a non-empty plain string, it is reused\n * as the group's `aria-label` automatically.\n * 3. When `label` is a non-string `ReactNode` (or absent), no\n * `aria-label` is derived — supply `aria-label`/`aria-labelledby`\n * yourself if the group needs a name AT users can identify it by.\n *\n * ### Server-safe\n *\n * Pure presentation — no hooks, no event handlers on the DOM. Ships in\n * the `./server` entry. Consumer-supplied chips may themselves be\n * client components (`<Chip onRemove>`); React's RSC boundary handles\n * that normally, and the zero-JS path (`<Chip asChild><Link/></Chip>`)\n * stays fully server-rendered.\n *\n * @example\n * ```tsx\n * // Navigation filter bar — server-rendered, zero-JS-friendly.\n * <FilterChips label=\"Filtros\">\n * <Chip asChild selected>\n * <Link href=\"?uf=SP\" aria-current=\"page\">UF: SP</Link>\n * </Chip>\n * <Chip asChild>\n * <Link href=\"?partido=PT\">Partido: PT</Link>\n * </Chip>\n * </FilterChips>\n *\n * // Single-line variant (consumer owns horizontal overflow).\n * <FilterChips label=\"Período\" wrap={false}>\n * <Chip>2024</Chip>\n * <Chip>2025</Chip>\n * </FilterChips>\n * ```\n */\nexport function FilterChips({\n label,\n children,\n wrap = true,\n className,\n ...props\n}: FilterChipsProps) {\n // The string label doubles as the group's accessible name — but only\n // when the consumer supplies no naming of their own. An explicit\n // `aria-label` OR `aria-labelledby` (both spread onto the root below)\n // takes precedence; deriving a name alongside `aria-labelledby` would\n // leave a redundant `aria-label` on the element, so suppress it here\n // rather than relying on ARIA name-computation precedence to hide it.\n const hasConsumerName =\n props[\"aria-label\"] != null || props[\"aria-labelledby\"] != null;\n const derivedAriaLabel =\n !hasConsumerName && typeof label === \"string\" && label !== \"\"\n ? label\n : undefined;\n\n return (\n <div\n role=\"group\"\n aria-label={derivedAriaLabel}\n className={cn(\n \"flex items-center\",\n wrap ? \"flex-wrap\" : \"flex-nowrap\",\n getSpacingClass(\"sm\", \"gap\"),\n className,\n )}\n {...props}\n >\n {label ? (\n // shrink-0 keeps the label a stable leading unit: in the wrapping\n // flex run it must not be squeezed or mid-word-wrapped when the\n // chips overflow — it stays on one line and the chips wrap around it.\n <span className=\"shrink-0 text-fg-secondary text-sm\">{label}</span>\n ) : null}\n {children}\n </div>\n );\n}\n\nexport default FilterChips;\n"],"names":["FilterChips","_a","_b","label","children","wrap","className","props","__objRest","derivedAriaLabel","jsxs","__spreadProps","__spreadValues","cn","getSpacingClass","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqFO,SAASA,EAAYC,GAMP;AANO,MAAAC,IAAAD,GAC1B;AAAA,WAAAE;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,WAAAC;AAAA,MAJ0BJ,GAKvBK,IAAAC,EALuBN,GAKvB;AAAA,IAJH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAWA,QAAMO,IACJ,EAFAF,EAAM,YAAY,KAAK,QAAQA,EAAM,iBAAiB,KAAK,SAEvC,OAAOJ,KAAU,YAAYA,MAAU,KACvDA,IACA;AAEN,SACE,gBAAAO;AAAA,IAAC;AAAA,IAAAC,EAAAC,EAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAYH;AAAA,MACZ,WAAWI;AAAA,QACT;AAAA,QACAR,IAAO,cAAc;AAAA,QACrBS,EAAgB,MAAM,KAAK;AAAA,QAC3BR;AAAA,MAAA;AAAA,OAEEC,IATL;AAAA,MAWE,UAAA;AAAA,QAAAJ;AAAA;AAAA;AAAA;AAAA,UAIC,gBAAAY,EAAC,QAAA,EAAK,WAAU,sCAAsC,UAAAZ,EAAA,CAAM;AAAA,YAC1D;AAAA,QACHC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}