@fabio.caffarello/react-design-system 4.2.0 → 4.4.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,140 @@
1
+ "use client";
2
+ var S = Object.defineProperty, B = Object.defineProperties;
3
+ var D = Object.getOwnPropertyDescriptors;
4
+ var i = Object.getOwnPropertySymbols;
5
+ var p = Object.prototype.hasOwnProperty, b = Object.prototype.propertyIsEnumerable;
6
+ var g = (e, r, a) => r in e ? S(e, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[r] = a, f = (e, r) => {
7
+ for (var a in r || (r = {}))
8
+ p.call(r, a) && g(e, a, r[a]);
9
+ if (i)
10
+ for (var a of i(r))
11
+ b.call(r, a) && g(e, a, r[a]);
12
+ return e;
13
+ }, u = (e, r) => B(e, D(r));
14
+ var x = (e, r) => {
15
+ var a = {};
16
+ for (var n in e)
17
+ p.call(e, n) && r.indexOf(n) < 0 && (a[n] = e[n]);
18
+ if (e != null && i)
19
+ for (var n of i(e))
20
+ r.indexOf(n) < 0 && b.call(e, n) && (a[n] = e[n]);
21
+ return a;
22
+ };
23
+ import { jsxs as h, jsx as d, Fragment as j } from "react/jsx-runtime";
24
+ import { memo as C, forwardRef as R } from "react";
25
+ import { getRadiusClass as T } from "../../tokens/radius.js";
26
+ import { getSpacingClass as s } from "../../tokens/spacing.js";
27
+ import { getTypographyWeight as y, getTypographySize as o } from "../../tokens/typography.js";
28
+ import { cn as t } from "../../utils/cn.js";
29
+ import { cva as V } from "../../utils/cva.js";
30
+ const _ = V(
31
+ t("inline-flex", "items-center", "border", T("md")),
32
+ {
33
+ variants: {
34
+ tone: {
35
+ neutral: t(
36
+ "bg-surface-muted",
37
+ "text-fg-primary",
38
+ "border-line-default"
39
+ ),
40
+ success: t("bg-success-bg", "text-success-dark", "border-success"),
41
+ warning: t("bg-warning-bg", "text-warning-dark", "border-warning"),
42
+ error: t("bg-error-bg", "text-error-dark", "border-error"),
43
+ info: t("bg-info-bg", "text-info-dark", "border-info"),
44
+ primary: t(
45
+ "bg-surface-brand-subtle",
46
+ "text-fg-brand-emphasis",
47
+ "border-line-brand"
48
+ ),
49
+ secondary: t(
50
+ "bg-surface-secondary-subtle",
51
+ "text-fg-brand-secondary-emphasis",
52
+ "border-line-secondary"
53
+ ),
54
+ // Categorical data-viz tone — fuchsia soft-wash, sibling to the
55
+ // chart palette. Not a status; distinct from secondary (brand violet).
56
+ dataviz: t("bg-dataviz-bg", "text-dataviz-dark", "border-dataviz")
57
+ },
58
+ size: {
59
+ sm: t(
60
+ s("1.5", "px"),
61
+ s("0.5", "py"),
62
+ s("0.5", "gap"),
63
+ "[&_svg]:size-3"
64
+ ),
65
+ md: t(
66
+ s("sm", "px"),
67
+ s("0.5", "py"),
68
+ s("xs", "gap"),
69
+ "[&_svg]:size-3.5"
70
+ )
71
+ }
72
+ },
73
+ defaultVariants: { tone: "neutral", size: "md" }
74
+ }
75
+ ), F = C(
76
+ R(function(W, k) {
77
+ var m = W, {
78
+ label: r,
79
+ source: a,
80
+ tone: n = "neutral",
81
+ size: l = "md",
82
+ icon: c,
83
+ className: v = ""
84
+ } = m, z = x(m, [
85
+ "label",
86
+ "source",
87
+ "tone",
88
+ "size",
89
+ "icon",
90
+ "className"
91
+ ]);
92
+ const N = a != null && a !== "", w = l === "sm" ? "caption" : "bodySmall";
93
+ return /* @__PURE__ */ h(
94
+ "span",
95
+ u(f({
96
+ ref: k,
97
+ className: t(_({ tone: n, size: l }), v)
98
+ }, z), {
99
+ children: [
100
+ c ? /* @__PURE__ */ d(
101
+ "span",
102
+ {
103
+ className: "inline-flex shrink-0 items-center",
104
+ "aria-hidden": "true",
105
+ children: c
106
+ }
107
+ ) : null,
108
+ /* @__PURE__ */ d(
109
+ "span",
110
+ {
111
+ className: t(
112
+ o(w),
113
+ y("label")
114
+ ),
115
+ children: r
116
+ }
117
+ ),
118
+ N ? /* @__PURE__ */ h(j, { children: [
119
+ /* @__PURE__ */ d("span", { "aria-hidden": "true", className: o("caption"), children: "·" }),
120
+ /* @__PURE__ */ d(
121
+ "span",
122
+ {
123
+ className: t(
124
+ o("caption"),
125
+ y("caption")
126
+ ),
127
+ children: a
128
+ }
129
+ )
130
+ ] }) : null
131
+ ]
132
+ })
133
+ );
134
+ })
135
+ );
136
+ F.displayName = "DataBadge";
137
+ export {
138
+ F as default
139
+ };
140
+ //# sourceMappingURL=DataBadge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBadge.js","sources":["../../../../../src/ui/primitives/DataBadge/DataBadge.tsx"],"sourcesContent":["import { memo, forwardRef } from \"react\";\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { getRadiusClass } from \"../../tokens/radius\";\nimport { getSpacingClass } from \"../../tokens/spacing\";\nimport {\n getTypographySize,\n getTypographyWeight,\n} from \"../../tokens/typography\";\nimport { cn, cva } from \"../../utils\";\n\n/**\n * Semantic tone for a {@link DataBadge}. The status/brand members mirror the\n * `Badge` vocabulary (role, not tone) so the soft-wash treatment is shared\n * and already AA-verified; `dataviz` adds a CATEGORICAL member (a\n * reddish-purple wash for \"category / analytical\" data, the badge-facing\n * counterpart to the chart palette) that is intentionally NOT a status.\n * Map a consumer's tone names onto these roles: `default → neutral`,\n * `destructive → error`, `brand → primary`, `accent → dataviz` (the\n * data-viz purple — RDS `accent` is cyan, so the category tone is `dataviz`).\n */\nexport type DataBadgeTone =\n | \"neutral\"\n | \"success\"\n | \"warning\"\n | \"error\"\n | \"info\"\n | \"primary\"\n | \"secondary\"\n | \"dataviz\";\n\nexport type DataBadgeSize = \"sm\" | \"md\";\n\nexport interface DataBadgeProps extends HTMLAttributes<HTMLSpanElement> {\n /** Primary datum — the value the badge is about (e.g. \"L2\", \"Aprovada\"). */\n label: ReactNode;\n /**\n * Provenance of the datum, rendered as a lesser-emphasis sub-label after\n * the label (e.g. \"Câmara\", \"Portal Transparência\"). Omitted when absent.\n */\n source?: ReactNode;\n /** Semantic tone (role-based color). Defaults to `neutral`. */\n tone?: DataBadgeTone;\n /** Optional decorative leading icon (rendered `aria-hidden`). */\n icon?: ReactNode;\n /** Size scale. Defaults to `md`. */\n size?: DataBadgeSize;\n}\n\n// Tone → soft-wash classes, mirroring Badge's already-AA-verified scale.\nconst dataBadgeVariants = cva(\n cn(\"inline-flex\", \"items-center\", \"border\", getRadiusClass(\"md\")),\n {\n variants: {\n tone: {\n neutral: cn(\n \"bg-surface-muted\",\n \"text-fg-primary\",\n \"border-line-default\",\n ),\n success: cn(\"bg-success-bg\", \"text-success-dark\", \"border-success\"),\n warning: cn(\"bg-warning-bg\", \"text-warning-dark\", \"border-warning\"),\n error: cn(\"bg-error-bg\", \"text-error-dark\", \"border-error\"),\n info: cn(\"bg-info-bg\", \"text-info-dark\", \"border-info\"),\n primary: cn(\n \"bg-surface-brand-subtle\",\n \"text-fg-brand-emphasis\",\n \"border-line-brand\",\n ),\n secondary: cn(\n \"bg-surface-secondary-subtle\",\n \"text-fg-brand-secondary-emphasis\",\n \"border-line-secondary\",\n ),\n // Categorical data-viz tone — fuchsia soft-wash, sibling to the\n // chart palette. Not a status; distinct from secondary (brand violet).\n dataviz: cn(\"bg-dataviz-bg\", \"text-dataviz-dark\", \"border-dataviz\"),\n },\n size: {\n sm: cn(\n getSpacingClass(\"1.5\", \"px\"),\n getSpacingClass(\"0.5\", \"py\"),\n getSpacingClass(\"0.5\", \"gap\"),\n \"[&_svg]:size-3\",\n ),\n md: cn(\n getSpacingClass(\"sm\", \"px\"),\n getSpacingClass(\"0.5\", \"py\"),\n getSpacingClass(\"xs\", \"gap\"),\n \"[&_svg]:size-3.5\",\n ),\n },\n },\n defaultVariants: { tone: \"neutral\", size: \"md\" },\n },\n);\n\n/**\n * DataBadge\n *\n * An inline metadata chip: a primary `label`, an optional lesser-emphasis\n * `source` sub-label (the datum's provenance), a semantic `tone`, and an\n * optional decorative `icon`. Built for transparency/data UIs where a value\n * must travel with where it came from (\"L2 · Portal Transparência\").\n *\n * Why a separate primitive and not `Badge`: `Badge` is a single-string\n * status label; `DataBadge` carries a value + its source as a structured\n * pair. The `source` is the differentiator — it has no slot in `Badge` /\n * `Chip` / `Info`.\n *\n * Accessibility: the visible text (label, then source) IS the accessible\n * name — the separator and any `icon` are `aria-hidden`. Hierarchy between\n * label and source is conveyed by size + weight, never by dropping the\n * source below its tone's AA-safe text color. The root is a plain inline\n * `<span>` with no live-region role (metadata is static, not announced);\n * pass `role` / `aria-label` via props if a grouping role is wanted.\n *\n * Server-safe: no hooks, no client APIs, no DOM handlers of its own — ships\n * from the `./server` entry.\n *\n * @example\n * ```tsx\n * <DataBadge label=\"L2\" source=\"Portal Transparência\" tone=\"warning\" />\n * <DataBadge label=\"Aprovada\" tone=\"success\" />\n * ```\n */\nconst DataBadge = memo(\n forwardRef<HTMLSpanElement, DataBadgeProps>(function DataBadge(\n {\n label,\n source,\n tone = \"neutral\",\n size = \"md\",\n icon,\n className = \"\",\n ...rest\n },\n ref,\n ) {\n const hasSource = source !== undefined && source !== null && source !== \"\";\n // Label is the larger/heavier tier; source is one size smaller and a\n // lighter weight. Both keep the tone's AA-safe text color — hierarchy\n // comes from size + weight, not from reducing contrast.\n const labelSize = size === \"sm\" ? \"caption\" : \"bodySmall\";\n\n return (\n <span\n ref={ref}\n className={cn(dataBadgeVariants({ tone, size }), className)}\n {...rest}\n >\n {icon ? (\n <span\n className=\"inline-flex shrink-0 items-center\"\n aria-hidden=\"true\"\n >\n {icon}\n </span>\n ) : null}\n <span\n className={cn(\n getTypographySize(labelSize),\n getTypographyWeight(\"label\"),\n )}\n >\n {label}\n </span>\n {hasSource ? (\n <>\n <span aria-hidden=\"true\" className={getTypographySize(\"caption\")}>\n ·\n </span>\n <span\n className={cn(\n getTypographySize(\"caption\"),\n getTypographyWeight(\"caption\"),\n )}\n >\n {source}\n </span>\n </>\n ) : null}\n </span>\n );\n }),\n);\n\nDataBadge.displayName = \"DataBadge\";\n\nexport default DataBadge;\n"],"names":["dataBadgeVariants","cva","cn","getRadiusClass","getSpacingClass","DataBadge","memo","forwardRef","_a","ref","_b","label","source","tone","size","icon","className","rest","__objRest","hasSource","labelSize","jsxs","__spreadProps","__spreadValues","jsx","getTypographySize","getTypographyWeight","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAMA,IAAoBC;AAAA,EACxBC,EAAG,eAAe,gBAAgB,UAAUC,EAAe,IAAI,CAAC;AAAA,EAChE;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,SAASD;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,SAASA,EAAG,iBAAiB,qBAAqB,gBAAgB;AAAA,QAClE,SAASA,EAAG,iBAAiB,qBAAqB,gBAAgB;AAAA,QAClE,OAAOA,EAAG,eAAe,mBAAmB,cAAc;AAAA,QAC1D,MAAMA,EAAG,cAAc,kBAAkB,aAAa;AAAA,QACtD,SAASA;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,WAAWA;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA;AAAA;AAAA,QAIF,SAASA,EAAG,iBAAiB,qBAAqB,gBAAgB;AAAA,MAAA;AAAA,MAEpE,MAAM;AAAA,QACJ,IAAIA;AAAA,UACFE,EAAgB,OAAO,IAAI;AAAA,UAC3BA,EAAgB,OAAO,IAAI;AAAA,UAC3BA,EAAgB,OAAO,KAAK;AAAA,UAC5B;AAAA,QAAA;AAAA,QAEF,IAAIF;AAAA,UACFE,EAAgB,MAAM,IAAI;AAAA,UAC1BA,EAAgB,OAAO,IAAI;AAAA,UAC3BA,EAAgB,MAAM,KAAK;AAAA,UAC3B;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,IAEF,iBAAiB,EAAE,MAAM,WAAW,MAAM,KAAA;AAAA,EAAK;AAEnD,GA+BMC,IAAYC;AAAA,EAChBC,EAA4C,SAC1CC,GASAC,GACA;AAVA,QAAAC,IAAAF,GACE;AAAA,aAAAG;AAAA,MACA,QAAAC;AAAA,MACA,MAAAC,IAAO;AAAA,MACP,MAAAC,IAAO;AAAA,MACP,MAAAC;AAAA,MACA,WAAAC,IAAY;AAAA,QANdN,GAOKO,IAAAC,EAPLR,GAOK;AAAA,MANH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAMS,IAAoCP,KAAW,QAAQA,MAAW,IAIlEQ,IAAYN,MAAS,OAAO,YAAY;AAE9C,WACE,gBAAAO;AAAA,MAAC;AAAA,MAAAC,EAAAC,EAAA;AAAA,QACC,KAAAd;AAAA,QACA,WAAWP,EAAGF,EAAkB,EAAE,MAAAa,GAAM,MAAAC,EAAA,CAAM,GAAGE,CAAS;AAAA,SACtDC,IAHL;AAAA,QAKE,UAAA;AAAA,UAAAF,IACC,gBAAAS;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,eAAY;AAAA,cAEX,UAAAT;AAAA,YAAA;AAAA,UAAA,IAED;AAAA,UACJ,gBAAAS;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWtB;AAAA,gBACTuB,EAAkBL,CAAS;AAAA,gBAC3BM,EAAoB,OAAO;AAAA,cAAA;AAAA,cAG5B,UAAAf;AAAA,YAAA;AAAA,UAAA;AAAA,UAEFQ,IACC,gBAAAE,EAAAM,GAAA,EACE,UAAA;AAAA,YAAA,gBAAAH,EAAC,UAAK,eAAY,QAAO,WAAWC,EAAkB,SAAS,GAAG,UAAA,KAElE;AAAA,YACA,gBAAAD;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWtB;AAAA,kBACTuB,EAAkB,SAAS;AAAA,kBAC3BC,EAAoB,SAAS;AAAA,gBAAA;AAAA,gBAG9B,UAAAd;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,EAAA,CACF,IACE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV,CAAC;AACH;AAEAP,EAAU,cAAc;"}
@@ -0,0 +1,73 @@
1
+ "use client";
2
+ const c = 8, n = [
3
+ {
4
+ index: 1,
5
+ name: "Orange",
6
+ var: "var(--color-chart-1)",
7
+ bg: "bg-chart-1",
8
+ text: "text-chart-1"
9
+ },
10
+ {
11
+ index: 2,
12
+ name: "Sky blue",
13
+ var: "var(--color-chart-2)",
14
+ bg: "bg-chart-2",
15
+ text: "text-chart-2"
16
+ },
17
+ {
18
+ index: 3,
19
+ name: "Bluish green",
20
+ var: "var(--color-chart-3)",
21
+ bg: "bg-chart-3",
22
+ text: "text-chart-3"
23
+ },
24
+ {
25
+ index: 4,
26
+ name: "Vermillion",
27
+ var: "var(--color-chart-4)",
28
+ bg: "bg-chart-4",
29
+ text: "text-chart-4"
30
+ },
31
+ {
32
+ index: 5,
33
+ name: "Blue",
34
+ var: "var(--color-chart-5)",
35
+ bg: "bg-chart-5",
36
+ text: "text-chart-5"
37
+ },
38
+ {
39
+ index: 6,
40
+ name: "Reddish purple",
41
+ var: "var(--color-chart-6)",
42
+ bg: "bg-chart-6",
43
+ text: "text-chart-6"
44
+ },
45
+ {
46
+ index: 7,
47
+ name: "Yellow",
48
+ var: "var(--color-chart-7)",
49
+ bg: "bg-chart-7",
50
+ text: "text-chart-7"
51
+ },
52
+ {
53
+ index: 8,
54
+ name: "Gray",
55
+ var: "var(--color-chart-8)",
56
+ bg: "bg-chart-8",
57
+ text: "text-chart-8"
58
+ }
59
+ ];
60
+ function o(t) {
61
+ return `var(--color-chart-${(Math.trunc(t) % 8 + 8) % 8 + 1})`;
62
+ }
63
+ function h(t, r = "bg") {
64
+ const e = (Math.trunc(t) % 8 + 8) % 8;
65
+ return `${r}-chart-${e + 1}`;
66
+ }
67
+ export {
68
+ c as CHART_PALETTE_SIZE,
69
+ n as CHART_PALETTE_TOKENS,
70
+ o as getChartColor,
71
+ h as getChartColorClass
72
+ };
73
+ //# sourceMappingURL=chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart.js","sources":["../../../../src/ui/tokens/chart.ts"],"sourcesContent":["/**\n * Data-Visualization Categorical Palette (Okabe-Ito)\n *\n * Eight colorblind-safe categorical colors for chart series (parties, vote\n * types, ranges, …). This is a SEPARATE axis from the semantic feedback\n * colors: `success`/`warning`/`error`/`info` encode *state*, never\n * *category* — using `error` for \"series 3\" is semantically wrong and\n * destroys meaning. A categorical palette answers \"which series is this\",\n * and it must stay distinguishable under color-vision deficiency.\n *\n * The values are the canonical Okabe & Ito (2008) palette — the reference\n * categorical palette engineered to be distinguishable in deuteranopia,\n * protanopia, and tritanopia — with `black` swapped for a neutral gray so\n * the 8th series survives on a dark canvas. Light values are the canonical\n * tones; the dark theme lifts each toward higher luminance (hue preserved)\n * so every series clears the WCAG 1.4.11 graphical-object 3:1 contrast over\n * `surface-canvas` (slate-950). The CSS source of truth is\n * `src/styles/semantic/colors.css` (light) and `src/styles/themes/dark.css`\n * (dark, both blocks).\n *\n * On-WHITE caveat: orange/sky-blue/yellow/gray are below 3:1 against a white\n * canvas — an intrinsic property of Okabe-Ito's light hues. Fine for FILLS\n * (bars, areas, large marks); for thin strokes (lines, 1px borders) add a\n * stroke/outline or use a darker series first. Colorblind-safety (the point\n * of the palette) is preserved regardless.\n */\n\n/** Number of distinct colors in the categorical palette. */\nexport const CHART_PALETTE_SIZE = 8 as const;\n\n/** 1-based position within the categorical palette. */\nexport type ChartColorIndex = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;\n\nexport interface ChartColorToken {\n /** 1-based palette position (matches the `--color-chart-N` token). */\n index: ChartColorIndex;\n /** Okabe-Ito hue name — use for legends / documentation. */\n name: string;\n /** Theme-aware CSS reference, e.g. `\"var(--color-chart-1)\"`. */\n var: string;\n /** Tailwind background class, e.g. `\"bg-chart-1\"`. */\n bg: string;\n /** Tailwind text class, e.g. `\"text-chart-1\"`. */\n text: string;\n}\n\n/**\n * Palette metadata in canonical order. The actual color values live in CSS\n * (theme-aware); these tokens carry the references and human-readable names.\n */\nexport const CHART_PALETTE_TOKENS: readonly ChartColorToken[] = [\n {\n index: 1,\n name: \"Orange\",\n var: \"var(--color-chart-1)\",\n bg: \"bg-chart-1\",\n text: \"text-chart-1\",\n },\n {\n index: 2,\n name: \"Sky blue\",\n var: \"var(--color-chart-2)\",\n bg: \"bg-chart-2\",\n text: \"text-chart-2\",\n },\n {\n index: 3,\n name: \"Bluish green\",\n var: \"var(--color-chart-3)\",\n bg: \"bg-chart-3\",\n text: \"text-chart-3\",\n },\n {\n index: 4,\n name: \"Vermillion\",\n var: \"var(--color-chart-4)\",\n bg: \"bg-chart-4\",\n text: \"text-chart-4\",\n },\n {\n index: 5,\n name: \"Blue\",\n var: \"var(--color-chart-5)\",\n bg: \"bg-chart-5\",\n text: \"text-chart-5\",\n },\n {\n index: 6,\n name: \"Reddish purple\",\n var: \"var(--color-chart-6)\",\n bg: \"bg-chart-6\",\n text: \"text-chart-6\",\n },\n {\n index: 7,\n name: \"Yellow\",\n var: \"var(--color-chart-7)\",\n bg: \"bg-chart-7\",\n text: \"text-chart-7\",\n },\n {\n index: 8,\n name: \"Gray\",\n var: \"var(--color-chart-8)\",\n bg: \"bg-chart-8\",\n text: \"text-chart-8\",\n },\n] as const;\n\n/**\n * Resolve a chart series index to a theme-aware color reference.\n *\n * `seriesIndex` is **0-based** (built for `data.map((d, i) => …)`) and wraps\n * modulo {@link CHART_PALETTE_SIZE}, so a 10-series chart cycles back to the\n * first color rather than running out. Negative indices wrap correctly too.\n * The returned `var(--color-chart-N)` resolves per active theme (light/dark),\n * so charts re-tint automatically — pass it straight to a recharts\n * `fill`/`stroke` or an inline `style`.\n *\n * @example\n * ```tsx\n * import { getChartColor } from \"@fabio.caffarello/react-design-system\";\n *\n * {series.map((s, i) => (\n * <Bar key={s.id} dataKey={s.id} fill={getChartColor(i)} />\n * ))}\n * ```\n *\n * @param seriesIndex - 0-based series position.\n * @returns A `var(--color-chart-N)` reference (theme-aware).\n */\nexport function getChartColor(seriesIndex: number): string {\n const n = Math.trunc(seriesIndex);\n const wrapped =\n ((n % CHART_PALETTE_SIZE) + CHART_PALETTE_SIZE) % CHART_PALETTE_SIZE;\n return `var(--color-chart-${wrapped + 1})`;\n}\n\n/**\n * Tailwind class variant of {@link getChartColor} for DOM elements (legend\n * dots, swatches) where a class is more convenient than an inline style.\n *\n * @param seriesIndex - 0-based series position (wraps modulo the palette).\n * @param property - `\"bg\"` (default) or `\"text\"`.\n * @returns A `bg-chart-N` / `text-chart-N` class string.\n */\nexport function getChartColorClass(\n seriesIndex: number,\n property: \"bg\" | \"text\" = \"bg\",\n): string {\n const n = Math.trunc(seriesIndex);\n const wrapped =\n ((n % CHART_PALETTE_SIZE) + CHART_PALETTE_SIZE) % CHART_PALETTE_SIZE;\n return `${property}-chart-${wrapped + 1}`;\n}\n"],"names":["CHART_PALETTE_SIZE","CHART_PALETTE_TOKENS","getChartColor","seriesIndex","getChartColorClass","property","wrapped"],"mappings":";AA4BO,MAAMA,IAAqB,GAsBrBC,IAAmD;AAAA,EAC9D;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAEV;AAwBO,SAASC,EAAcC,GAA6B;AAIzD,SAAO,sBAHG,KAAK,MAAMA,CAAW,IAExB,IAAsB,KAAsB,IACd,CAAC;AACzC;AAUO,SAASC,EACdD,GACAE,IAA0B,MAClB;AAER,QAAMC,KADI,KAAK,MAAMH,CAAW,IAExB,IAAsB,KAAsB;AACpD,SAAO,GAAGE,CAAQ,UAAUC,IAAU,CAAC;AACzC;"}