@gears-frontx/ui-kit 0.4.0-alpha.0 → 0.4.0-alpha.1

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/chart.js CHANGED
@@ -3,19 +3,19 @@ import { jsx as i, jsxs as m, Fragment as j } from "react/jsx-runtime";
3
3
  import { useId as E, useMemo as V, createContext as k, useContext as A } from "react";
4
4
  import { cx as h } from "class-variance-authority";
5
5
  import * as b from "recharts";
6
- import './chunks/chart.CeyctrXQ.css';const P = "_container_2ox8r_24", F = "_tooltipContent_2ox8r_92", G = "_tooltipLabel_2ox8r_104", M = "_tooltipItems_2ox8r_108", U = "_tooltipItem_2ox8r_108", K = "_tooltipItemCentered_2ox8r_124", O = "_indicator_2ox8r_134", R = "_indicatorDot_2ox8r_139", q = "_indicatorLine_2ox8r_147", z = "_indicatorDashed_2ox8r_151", H = "_indicatorNested_2ox8r_158", Z = "_tooltipItemBody_2ox8r_163", J = "_tooltipItemBodyNested_2ox8r_169", Q = "_tooltipItemBodyInline_2ox8r_173", W = "_tooltipItemLabelGroup_2ox8r_177", X = "_tooltipItemName_2ox8r_182", Y = "_tooltipItemValue_2ox8r_186", tt = "_legendContent_2ox8r_195", ot = "_legendTop_2ox8r_202", et = "_legendBottom_2ox8r_206", nt = "_legendItem_2ox8r_210", rt = "_legendSwatch_2ox8r_224", e = {
6
+ import './chunks/chart.CeyctrXQ.css';const P = "_container_2ox8r_24", F = "_tooltipContent_2ox8r_92", G = "_tooltipLabel_2ox8r_104", U = "_tooltipItems_2ox8r_108", K = "_tooltipItem_2ox8r_108", M = "_tooltipItemCentered_2ox8r_124", O = "_indicator_2ox8r_134", R = "_indicatorDot_2ox8r_139", q = "_indicatorLine_2ox8r_147", z = "_indicatorDashed_2ox8r_151", Z = "_indicatorNested_2ox8r_158", H = "_tooltipItemBody_2ox8r_163", J = "_tooltipItemBodyNested_2ox8r_169", Q = "_tooltipItemBodyInline_2ox8r_173", W = "_tooltipItemLabelGroup_2ox8r_177", X = "_tooltipItemName_2ox8r_182", Y = "_tooltipItemValue_2ox8r_186", tt = "_legendContent_2ox8r_195", ot = "_legendTop_2ox8r_202", et = "_legendBottom_2ox8r_206", nt = "_legendItem_2ox8r_210", rt = "_legendSwatch_2ox8r_224", e = {
7
7
  container: P,
8
8
  tooltipContent: F,
9
9
  tooltipLabel: G,
10
- tooltipItems: M,
11
- tooltipItem: U,
12
- tooltipItemCentered: K,
10
+ tooltipItems: U,
11
+ tooltipItem: K,
12
+ tooltipItemCentered: M,
13
13
  indicator: O,
14
14
  indicatorDot: R,
15
15
  indicatorLine: q,
16
16
  indicatorDashed: z,
17
- indicatorNested: H,
18
- tooltipItemBody: Z,
17
+ indicatorNested: Z,
18
+ tooltipItemBody: H,
19
19
  tooltipItemBodyNested: J,
20
20
  tooltipItemBodyInline: Q,
21
21
  tooltipItemLabelGroup: W,
@@ -34,7 +34,7 @@ function w() {
34
34
  return n;
35
35
  }
36
36
  const ct = /[^a-zA-Z0-9_-]/g, it = /[;{}<>\\]|\/\*|\*\//;
37
- function S(n) {
37
+ function B(n) {
38
38
  return n.replace(ct, "_");
39
39
  }
40
40
  function st(n) {
@@ -48,7 +48,7 @@ function ht({
48
48
  initialDimension: a = lt,
49
49
  ...p
50
50
  }) {
51
- const c = E(), u = S(`chart-${n ?? c}`);
51
+ const c = E(), u = B(`chart-${n ?? c}`);
52
52
  return /* @__PURE__ */ i(T.Provider, { value: { config: l }, children: /* @__PURE__ */ m("div", { "data-chart": u, className: h(e.container, t), ...p, children: [
53
53
  /* @__PURE__ */ i(at, { id: u, config: l }),
54
54
  /* @__PURE__ */ i(b.ResponsiveContainer, { initialDimension: a, children: r })
@@ -58,10 +58,10 @@ function at({ id: n, config: t }) {
58
58
  const r = Object.entries(t).filter(([, _]) => _.theme ?? _.color);
59
59
  if (!r.length)
60
60
  return null;
61
- const l = S(n), a = (_) => r.map(([s, N]) => {
61
+ const l = B(n), a = (_) => r.map(([s, N]) => {
62
62
  var I;
63
63
  const g = ((I = N.theme) == null ? void 0 : I[_]) ?? N.color;
64
- return !g || !st(g) ? null : ` --color-${S(s)}: ${g};`;
64
+ return !g || !st(g) ? null : ` --color-${B(s)}: ${g};`;
65
65
  }).filter((s) => s !== null).join(`
66
66
  `), p = a("light"), c = a("dark"), u = `
67
67
  [data-chart='${l}'] {
@@ -78,7 +78,7 @@ ${c}
78
78
  }
79
79
  }
80
80
  `;
81
- return /* @__PURE__ */ i("style", { dangerouslySetInnerHTML: { __html: u } });
81
+ return /* @__PURE__ */ i("style", { children: u });
82
82
  }
83
83
  const pt = b.Tooltip;
84
84
  function It({
@@ -100,7 +100,7 @@ function It({
100
100
  var v;
101
101
  if (a || !(t != null && t.length))
102
102
  return null;
103
- const [o] = t, L = `${I ?? (o == null ? void 0 : o.dataKey) ?? (o == null ? void 0 : o.name) ?? "value"}`, f = B(x, o, L), d = !I && typeof c == "string" ? ((v = x[c]) == null ? void 0 : v.label) ?? c : f == null ? void 0 : f.label;
103
+ const [o] = t, L = `${I ?? (o == null ? void 0 : o.dataKey) ?? (o == null ? void 0 : o.name) ?? "value"}`, f = S(x, o, L), d = !I && typeof c == "string" ? ((v = x[c]) == null ? void 0 : v.label) ?? c : f == null ? void 0 : f.label;
104
104
  return u ? /* @__PURE__ */ i("div", { className: h(e.tooltipLabel, _), children: u(d, t) }) : d ? /* @__PURE__ */ i("div", { className: h(e.tooltipLabel, _), children: d }) : null;
105
105
  }, [c, u, t, a, _, x, I]);
106
106
  if (!n || !(t != null && t.length))
@@ -110,7 +110,7 @@ function It({
110
110
  C ? null : D,
111
111
  /* @__PURE__ */ i("div", { className: e.tooltipItems, children: t.filter((o) => o.type !== "none").map((o, L) => {
112
112
  var $;
113
- const f = `${g ?? o.name ?? o.dataKey ?? "value"}`, d = B(x, o, f), v = N ?? (($ = o.payload) == null ? void 0 : $.fill) ?? o.color;
113
+ const f = `${g ?? o.name ?? o.dataKey ?? "value"}`, d = S(x, o, f), v = N ?? (($ = o.payload) == null ? void 0 : $.fill) ?? o.color;
114
114
  return /* @__PURE__ */ i(
115
115
  "div",
116
116
  {
@@ -170,7 +170,7 @@ function gt({
170
170
  n
171
171
  ),
172
172
  children: r.filter((c) => c.type !== "none").map((c, u) => {
173
- const _ = `${a ?? c.dataKey ?? "value"}`, s = B(p, c, _);
173
+ const _ = `${a ?? c.dataKey ?? "value"}`, s = S(p, c, _);
174
174
  return /* @__PURE__ */ m("div", { className: e.legendItem, children: [
175
175
  s != null && s.icon && !t ? /* @__PURE__ */ i(s.icon, {}) : /* @__PURE__ */ i("div", { className: e.legendSwatch, style: { backgroundColor: c.color } }),
176
176
  s == null ? void 0 : s.label
@@ -185,7 +185,7 @@ function y(n, t) {
185
185
  const r = n[t];
186
186
  return typeof r == "string" ? r : void 0;
187
187
  }
188
- function B(n, t, r) {
188
+ function S(n, t, r) {
189
189
  if (typeof t != "object" || t === null)
190
190
  return;
191
191
  const l = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, a = y(t, r) ?? (l && y(l, r)) ?? r;
package/dist/chart.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"chart.js","sources":["../src/components/chart/chart.tsx"],"sourcesContent":["'use client';\n\n/*\n * Upstream (apps/v4/registry/bases/base/ui/chart.tsx) wraps Recharts:\n * ChartContainer supplies the ResponsiveContainer plus a per-instance\n * runtime `<style>` tag (ChartStyle) that turns each `ChartConfig` entry\n * into a `--color-<key>` custom property scoped to that one chart instance\n * via a `data-chart` id — the hook a consumer's own Bar/Line/Area elements\n * read from (`fill=\"var(--color-desktop)\"`) to pick up branded series\n * colors without prop-drilling them through Recharts' own API. `data-chart`\n * is that scoping id, not this kit's usual `data-slot` marker — there is no\n * `data-slot` here by design, same as every other ported part.\n *\n * Two deliberate deviations from upstream, both forced by this kit's own\n * constraints rather than a style preference — see chart.md's \"Porting\n * notes\" for the consumer-facing summary:\n *\n * 1. THEMES / dark selector — upstream keys the per-theme color map by\n * `{ light: \"\", dark: \".dark\" }`, a literal Tailwind dark-mode class\n * selector. This kit has no such class (see theme.css's header): dark\n * mode is `[data-theme='dark']` plus a `prefers-color-scheme` fallback\n * guarded by `:not([data-theme='light'])`. ChartStyle below emits BOTH\n * selectors for the dark entry instead of one, mirroring theme.css's own\n * dual mechanism. The public `ChartConfig['theme']` keys stay exactly\n * `light`/`dark` regardless — that part is upstream's real API, not the\n * selector text it happens to compile to.\n * 2. No `--chart-1`..`--chart-5` palette — those tokens don't exist in\n * theme.css (frozen for this port) and were deliberately not added.\n * A consumer supplies every series color through `ChartConfig` itself\n * (`color` or `theme`) — upstream's real, load-bearing API regardless;\n * shadcn's own docs setting `--chart-1` etc. is just ONE value for that\n * same `color` field, not a requirement of the mechanism.\n */\n\nimport {\n type ComponentProps,\n type ComponentType,\n type ReactNode,\n createContext,\n useContext,\n useId,\n useMemo,\n} from 'react';\nimport { cx } from 'class-variance-authority';\nimport * as RechartsPrimitive from 'recharts';\nimport type { DefaultLegendContentProps, DefaultTooltipContentProps, TooltipValueType } from 'recharts';\n\nimport styles from './chart.module.css';\n\n// Matches Recharts' own default (used when a chart mounts with no measured\n// size yet) being {-1,-1} — upstream overrides it to a real, positive size\n// so ChartContainer's children render immediately instead of waiting for a\n// ResizeObserver entry that jsdom (and a slow first paint) may delay.\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const;\n\ntype TooltipNameType = number | string;\n\nexport type ChartConfig = Record<\n string,\n {\n label?: ReactNode;\n icon?: ComponentType;\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<'light' | 'dark', string> }\n )\n>;\n\ninterface ChartContextValue {\n config: ChartConfig;\n}\n\nconst ChartContext = createContext<ChartContextValue | null>(null);\n\nfunction useChart() {\n const context = useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nexport type ChartContainerProps = Omit<ComponentProps<'div'>, 'className' | 'children'> & {\n className?: string;\n config: ChartConfig;\n children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n initialDimension?: { width: number; height: number };\n};\n\n/*\n * Everything ChartStyle interpolates into its <style> tag is\n * consumer-supplied — the chart's `id`, every `ChartConfig` key, every\n * colour string — and none of it is escaped by React, which treats\n * `dangerouslySetInnerHTML` as opaque text. An id of `x] { } body {\n * display: none` would end the selector and start a rule of its own; a\n * colour of `red; } body { … }` does the same one line down; either could\n * carry a literal `</style>` and leave CSS altogether. So the two shapes\n * that reach the stylesheet are constrained rather than trusted:\n * identifiers are reduced to a character set that cannot express any of\n * those, and colour VALUES (which have no such small alphabet — they run\n * from `red` to `color-mix(in oklab, …)`) are checked for the characters\n * that would let one escape its own declaration, and dropped whole if\n * they carry any.\n */\nconst CSS_IDENT_UNSAFE = /[^a-zA-Z0-9_-]/g;\n\n// Anything that could close a declaration, a rule, a comment, or the\n// <style> element itself. Backslash is in the list because a CSS escape\n// sequence is another way to spell any of them.\nconst CSS_VALUE_UNSAFE = /[;{}<>\\\\]|\\/\\*|\\*\\//;\n\nfunction cssIdentifier(value: string): string {\n return value.replace(CSS_IDENT_UNSAFE, '_');\n}\n\nfunction isSafeCssValue(value: string): boolean {\n return !CSS_VALUE_UNSAFE.test(value);\n}\n\nexport function ChartContainer({\n id,\n className,\n children,\n config,\n initialDimension = INITIAL_DIMENSION,\n ...props\n}: ChartContainerProps) {\n const uniqueId = useId();\n // Normalized here, not just inside ChartStyle: the same string has to\n // land in the `data-chart` attribute and in the selector that targets\n // it, so they must be normalized by the same rule or they stop matching.\n const chartId = cssIdentifier(`chart-${id ?? uniqueId}`);\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div data-chart={chartId} className={cx(styles.container, className)} {...props}>\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n}\n\nexport interface ChartStyleProps {\n id: string;\n config: ChartConfig;\n}\n\n// Exported standalone (matching upstream) for a consumer building their own\n// chart shell without ChartContainer's div/ResponsiveContainer wrapper, who\n// still wants the same per-instance `--color-*` custom-property injection.\nexport function ChartStyle({ id, config }: ChartStyleProps) {\n const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme ?? itemConfig.color);\n\n if (!colorConfig.length) {\n return null;\n }\n\n const safeId = cssIdentifier(id);\n\n const declarationsFor = (theme: 'light' | 'dark') =>\n colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme] ?? itemConfig.color;\n // A rejected colour drops its whole declaration rather than\n // emitting a broken one: the series then paints in Recharts' own\n // default instead of taking the rest of the stylesheet with it.\n if (!color || !isSafeCssValue(color)) {\n return null;\n }\n return ` --color-${cssIdentifier(key)}: ${color};`;\n })\n .filter((declaration): declaration is string => declaration !== null)\n .join('\\n');\n\n const lightDeclarations = declarationsFor('light');\n const darkDeclarations = declarationsFor('dark');\n\n // See the file header's point 1: two dark blocks (an explicit attribute\n // selector plus a prefers-color-scheme fallback) instead of upstream's\n // single `.dark` class, mirroring theme.css's own dual mechanism. The\n // light block carries no selector prefix, same as upstream's `THEMES.light\n // === \"\"` — it is the unconditional default every chart instance starts\n // from, which the dark blocks below layer on top of.\n const css = `\n[data-chart='${safeId}'] {\n${lightDeclarations}\n}\n\n[data-theme='dark'] [data-chart='${safeId}'] {\n${darkDeclarations}\n}\n\n@media (prefers-color-scheme: dark) {\n :root:not([data-theme='light']) [data-chart='${safeId}'] {\n${darkDeclarations}\n }\n}\n`;\n\n // Per-instance, consumer-supplied colors have no other way to reach a\n // scoped CSS custom property — there is no static class this kit's build\n // could hash for an arbitrary runtime string. Same trade-off upstream\n // makes with its own dangerouslySetInnerHTML.\n return <style dangerouslySetInnerHTML={{ __html: css }} />;\n}\n\nexport const ChartTooltip = RechartsPrimitive.Tooltip;\n\nexport type ChartTooltipContentProps = ComponentProps<typeof RechartsPrimitive.Tooltip> &\n Omit<ComponentProps<'div'>, 'className'> & {\n className?: string;\n hideLabel?: boolean;\n hideIndicator?: boolean;\n indicator?: 'line' | 'dot' | 'dashed';\n nameKey?: string;\n labelKey?: string;\n } & Omit<DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, 'accessibilityLayer'>;\n\nexport function ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: ChartTooltipContentProps) {\n const { config } = useChart();\n\n const tooltipLabel = useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey ?? item?.dataKey ?? item?.name ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value =\n !labelKey && typeof label === 'string' ? (config[label]?.label ?? label) : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cx(styles.tooltipLabel, labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cx(styles.tooltipLabel, labelClassName)}>{value}</div>;\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot';\n\n return (\n <div className={cx(styles.tooltipContent, className)}>\n {!nestLabel ? tooltipLabel : null}\n <div className={styles.tooltipItems}>\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color ?? item.payload?.fill ?? item.color;\n\n return (\n <div\n key={index}\n className={cx(styles.tooltipItem, indicator === 'dot' && styles.tooltipItemCentered)}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cx(\n styles.indicator,\n indicator === 'dot' && styles.indicatorDot,\n indicator === 'line' && styles.indicatorLine,\n indicator === 'dashed' && styles.indicatorDashed,\n indicator === 'dashed' && nestLabel && styles.indicatorNested,\n )}\n // Two paint targets, not one custom-property pair like\n // upstream's Tailwind `bg-(--color-bg)`/`border-(--color-border)`\n // arbitrary-value classes: dot/line indicators are filled\n // swatches (background only — chart.module.css's `.indicator`\n // sets no border), the dashed indicator is a hollow\n // dashed-border swatch (border only — `.indicatorDashed`\n // keeps its own background transparent). Setting both\n // properties unconditionally, like upstream does via two\n // always-present custom properties, would depend on which\n // Tailwind utility wins the cascade for the dashed case;\n // branching here is unambiguous.\n style={\n indicator === 'dashed'\n ? { borderColor: indicatorColor }\n : { backgroundColor: indicatorColor }\n }\n />\n )\n )}\n <div\n className={cx(\n styles.tooltipItemBody,\n nestLabel ? styles.tooltipItemBodyNested : styles.tooltipItemBodyInline,\n )}\n >\n <div className={styles.tooltipItemLabelGroup}>\n {nestLabel ? tooltipLabel : null}\n <span className={styles.tooltipItemName}>{itemConfig?.label ?? item.name}</span>\n </div>\n {item.value != null && (\n <span className={styles.tooltipItemValue}>\n {typeof item.value === 'number' ? item.value.toLocaleString() : String(item.value)}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\nexport const ChartLegend = RechartsPrimitive.Legend;\n\nexport type ChartLegendContentProps = Omit<ComponentProps<'div'>, 'className'> & {\n className?: string;\n hideIcon?: boolean;\n nameKey?: string;\n} & DefaultLegendContentProps;\n\nexport function ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey,\n}: ChartLegendContentProps) {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div\n className={cx(\n styles.legendContent,\n verticalAlign === 'top' ? styles.legendTop : styles.legendBottom,\n className,\n )}\n >\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div key={index} className={styles.legendItem}>\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div className={styles.legendSwatch} style={{ backgroundColor: item.color }} />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n}\n\n// Guarded, single-purpose replacement for upstream's two inline\n// `payload[key as keyof typeof payload] as string` assertions: `in` proves\n// the property exists at runtime, this narrows the read value itself\n// instead of asserting the container's shape.\nfunction getStringField(source: object, key: string): string | undefined {\n if (!(key in source)) {\n return undefined;\n }\n const value = (source as Record<string, unknown>)[key];\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string,\n): ChartConfig[string] | undefined {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined;\n\n const configLabelKey =\n getStringField(payload, key) ?? (payloadPayload && getStringField(payloadPayload, key)) ?? key;\n\n return configLabelKey in config ? config[configLabelKey] : config[key];\n}\n"],"names":["INITIAL_DIMENSION","ChartContext","createContext","useChart","context","useContext","CSS_IDENT_UNSAFE","CSS_VALUE_UNSAFE","cssIdentifier","value","isSafeCssValue","ChartContainer","id","className","children","config","initialDimension","props","uniqueId","useId","chartId","jsxs","cx","styles","jsx","ChartStyle","RechartsPrimitive","colorConfig","itemConfig","safeId","declarationsFor","theme","key","color","_a","declaration","lightDeclarations","darkDeclarations","css","ChartTooltip","ChartTooltipContent","active","payload","indicator","hideLabel","hideIndicator","label","labelFormatter","labelClassName","formatter","nameKey","labelKey","tooltipLabel","useMemo","item","getPayloadConfigFromPayload","nestLabel","index","indicatorColor","Fragment","ChartLegend","ChartLegendContent","hideIcon","verticalAlign","getStringField","source","payloadPayload","configLabelKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDMA,KAAoB,EAAE,OAAO,KAAK,QAAQ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AAkBF,EAAeE,GAAgBlC,CAAG,MAAMA;AAE7F,SAAOmC,KAAkBpD,IAASA,EAAOoD,CAAc,IAAIpD,EAAOiB,CAAG;AACvE;"}
1
+ {"version":3,"file":"chart.js","sources":["../src/components/chart/chart.tsx"],"sourcesContent":["'use client';\n\n/*\n * Upstream (apps/v4/registry/bases/base/ui/chart.tsx) wraps Recharts:\n * ChartContainer supplies the ResponsiveContainer plus a per-instance\n * runtime `<style>` tag (ChartStyle) that turns each `ChartConfig` entry\n * into a `--color-<key>` custom property scoped to that one chart instance\n * via a `data-chart` id — the hook a consumer's own Bar/Line/Area elements\n * read from (`fill=\"var(--color-desktop)\"`) to pick up branded series\n * colors without prop-drilling them through Recharts' own API. `data-chart`\n * is that scoping id, not this kit's usual `data-slot` marker — there is no\n * `data-slot` here by design, same as every other ported part.\n *\n * Two deliberate deviations from upstream, both forced by this kit's own\n * constraints rather than a style preference — see chart.md's \"Porting\n * notes\" for the consumer-facing summary:\n *\n * 1. THEMES / dark selector — upstream keys the per-theme color map by\n * `{ light: \"\", dark: \".dark\" }`, a literal Tailwind dark-mode class\n * selector. This kit has no such class (see theme.css's header): dark\n * mode is `[data-theme='dark']` plus a `prefers-color-scheme` fallback\n * guarded by `:not([data-theme='light'])`. ChartStyle below emits BOTH\n * selectors for the dark entry instead of one, mirroring theme.css's own\n * dual mechanism. The public `ChartConfig['theme']` keys stay exactly\n * `light`/`dark` regardless — that part is upstream's real API, not the\n * selector text it happens to compile to.\n * 2. No `--chart-1`..`--chart-5` palette — those tokens don't exist in\n * theme.css (frozen for this port) and were deliberately not added.\n * A consumer supplies every series color through `ChartConfig` itself\n * (`color` or `theme`) — upstream's real, load-bearing API regardless;\n * shadcn's own docs setting `--chart-1` etc. is just ONE value for that\n * same `color` field, not a requirement of the mechanism.\n */\n\nimport {\n type ComponentProps,\n type ComponentType,\n type ReactNode,\n createContext,\n useContext,\n useId,\n useMemo,\n} from 'react';\nimport { cx } from 'class-variance-authority';\nimport * as RechartsPrimitive from 'recharts';\nimport type { DefaultLegendContentProps, DefaultTooltipContentProps, TooltipValueType } from 'recharts';\n\nimport styles from './chart.module.css';\n\n// Matches Recharts' own default (used when a chart mounts with no measured\n// size yet) being {-1,-1} — upstream overrides it to a real, positive size\n// so ChartContainer's children render immediately instead of waiting for a\n// ResizeObserver entry that jsdom (and a slow first paint) may delay.\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const;\n\ntype TooltipNameType = number | string;\n\nexport type ChartConfig = Record<\n string,\n {\n label?: ReactNode;\n icon?: ComponentType;\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<'light' | 'dark', string> }\n )\n>;\n\ninterface ChartContextValue {\n config: ChartConfig;\n}\n\nconst ChartContext = createContext<ChartContextValue | null>(null);\n\nfunction useChart() {\n const context = useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nexport type ChartContainerProps = Omit<ComponentProps<'div'>, 'className' | 'children'> & {\n className?: string;\n config: ChartConfig;\n children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n initialDimension?: { width: number; height: number };\n};\n\n/*\n * Everything ChartStyle interpolates into its <style> tag is\n * consumer-supplied — the chart's `id`, every `ChartConfig` key, every\n * colour string — and React does not parse or validate CSS syntax within\n * it, whether the string reaches the tag as JSX children or via\n * `dangerouslySetInnerHTML`. An id of `x] { } body { display: none` would\n * end the selector and start a rule of its own; a colour of `red; } body {\n * … }` does the same one line down; either could carry a literal\n * `</style>` and try to leave CSS altogether. So the two shapes that reach\n * the stylesheet are constrained rather than trusted: identifiers are\n * reduced to a character set that cannot express any of those, and colour\n * VALUES (which have no such small alphabet — they run from `red` to\n * `color-mix(in oklab, …)`) are checked for the characters that would let\n * one escape its own declaration, and dropped whole if they carry any.\n */\nconst CSS_IDENT_UNSAFE = /[^a-zA-Z0-9_-]/g;\n\n// Anything that could close a declaration, a rule, a comment, or the\n// <style> element itself. Backslash is in the list because a CSS escape\n// sequence is another way to spell any of them.\nconst CSS_VALUE_UNSAFE = /[;{}<>\\\\]|\\/\\*|\\*\\//;\n\nfunction cssIdentifier(value: string): string {\n return value.replace(CSS_IDENT_UNSAFE, '_');\n}\n\nfunction isSafeCssValue(value: string): boolean {\n return !CSS_VALUE_UNSAFE.test(value);\n}\n\nexport function ChartContainer({\n id,\n className,\n children,\n config,\n initialDimension = INITIAL_DIMENSION,\n ...props\n}: ChartContainerProps) {\n const uniqueId = useId();\n // Normalized here, not just inside ChartStyle: the same string has to\n // land in the `data-chart` attribute and in the selector that targets\n // it, so they must be normalized by the same rule or they stop matching.\n const chartId = cssIdentifier(`chart-${id ?? uniqueId}`);\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div data-chart={chartId} className={cx(styles.container, className)} {...props}>\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n}\n\nexport interface ChartStyleProps {\n id: string;\n config: ChartConfig;\n}\n\n// Exported standalone (matching upstream) for a consumer building their own\n// chart shell without ChartContainer's div/ResponsiveContainer wrapper, who\n// still wants the same per-instance `--color-*` custom-property injection.\nexport function ChartStyle({ id, config }: ChartStyleProps) {\n const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme ?? itemConfig.color);\n\n if (!colorConfig.length) {\n return null;\n }\n\n const safeId = cssIdentifier(id);\n\n const declarationsFor = (theme: 'light' | 'dark') =>\n colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme] ?? itemConfig.color;\n // A rejected colour drops its whole declaration rather than\n // emitting a broken one: the series then paints in Recharts' own\n // default instead of taking the rest of the stylesheet with it.\n if (!color || !isSafeCssValue(color)) {\n return null;\n }\n return ` --color-${cssIdentifier(key)}: ${color};`;\n })\n .filter((declaration): declaration is string => declaration !== null)\n .join('\\n');\n\n const lightDeclarations = declarationsFor('light');\n const darkDeclarations = declarationsFor('dark');\n\n // See the file header's point 1: two dark blocks (an explicit attribute\n // selector plus a prefers-color-scheme fallback) instead of upstream's\n // single `.dark` class, mirroring theme.css's own dual mechanism. The\n // light block carries no selector prefix, same as upstream's `THEMES.light\n // === \"\"` — it is the unconditional default every chart instance starts\n // from, which the dark blocks below layer on top of.\n const css = `\n[data-chart='${safeId}'] {\n${lightDeclarations}\n}\n\n[data-theme='dark'] [data-chart='${safeId}'] {\n${darkDeclarations}\n}\n\n@media (prefers-color-scheme: dark) {\n :root:not([data-theme='light']) [data-chart='${safeId}'] {\n${darkDeclarations}\n }\n}\n`;\n\n // Per-instance, consumer-supplied colors have no other way to reach a\n // scoped CSS custom property — there is no static class this kit's build\n // could hash for an arbitrary runtime string. Passing `css` as the\n // `<style>` element's JSX children — rather than through\n // `dangerouslySetInnerHTML` — gets it React 19's own `</style`-escaping on\n // the server (so a value containing a literal `</style><script>…` cannot\n // break out of the tag in SSR output) and, on the client, lands it as a\n // single inert Text node that is never parsed as markup. Either way it\n // cannot execute as script. `isSafeCssValue`/`cssIdentifier` above still\n // matter here even though they're no longer the primary XSS defense: they\n // keep `<`/`>` out of the string entirely, which is what keeps server and\n // client output identical (a raw `</style` would escape only on the\n // server, producing a hydration mismatch).\n return <style>{css}</style>;\n}\n\nexport const ChartTooltip = RechartsPrimitive.Tooltip;\n\nexport type ChartTooltipContentProps = ComponentProps<typeof RechartsPrimitive.Tooltip> &\n Omit<ComponentProps<'div'>, 'className'> & {\n className?: string;\n hideLabel?: boolean;\n hideIndicator?: boolean;\n indicator?: 'line' | 'dot' | 'dashed';\n nameKey?: string;\n labelKey?: string;\n } & Omit<DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, 'accessibilityLayer'>;\n\nexport function ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: ChartTooltipContentProps) {\n const { config } = useChart();\n\n const tooltipLabel = useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey ?? item?.dataKey ?? item?.name ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value =\n !labelKey && typeof label === 'string' ? (config[label]?.label ?? label) : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cx(styles.tooltipLabel, labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cx(styles.tooltipLabel, labelClassName)}>{value}</div>;\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot';\n\n return (\n <div className={cx(styles.tooltipContent, className)}>\n {!nestLabel ? tooltipLabel : null}\n <div className={styles.tooltipItems}>\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color ?? item.payload?.fill ?? item.color;\n\n return (\n <div\n key={index}\n className={cx(styles.tooltipItem, indicator === 'dot' && styles.tooltipItemCentered)}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cx(\n styles.indicator,\n indicator === 'dot' && styles.indicatorDot,\n indicator === 'line' && styles.indicatorLine,\n indicator === 'dashed' && styles.indicatorDashed,\n indicator === 'dashed' && nestLabel && styles.indicatorNested,\n )}\n // Two paint targets, not one custom-property pair like\n // upstream's Tailwind `bg-(--color-bg)`/`border-(--color-border)`\n // arbitrary-value classes: dot/line indicators are filled\n // swatches (background only — chart.module.css's `.indicator`\n // sets no border), the dashed indicator is a hollow\n // dashed-border swatch (border only — `.indicatorDashed`\n // keeps its own background transparent). Setting both\n // properties unconditionally, like upstream does via two\n // always-present custom properties, would depend on which\n // Tailwind utility wins the cascade for the dashed case;\n // branching here is unambiguous.\n style={\n indicator === 'dashed'\n ? { borderColor: indicatorColor }\n : { backgroundColor: indicatorColor }\n }\n />\n )\n )}\n <div\n className={cx(\n styles.tooltipItemBody,\n nestLabel ? styles.tooltipItemBodyNested : styles.tooltipItemBodyInline,\n )}\n >\n <div className={styles.tooltipItemLabelGroup}>\n {nestLabel ? tooltipLabel : null}\n <span className={styles.tooltipItemName}>{itemConfig?.label ?? item.name}</span>\n </div>\n {item.value != null && (\n <span className={styles.tooltipItemValue}>\n {typeof item.value === 'number' ? item.value.toLocaleString() : String(item.value)}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\nexport const ChartLegend = RechartsPrimitive.Legend;\n\nexport type ChartLegendContentProps = Omit<ComponentProps<'div'>, 'className'> & {\n className?: string;\n hideIcon?: boolean;\n nameKey?: string;\n} & DefaultLegendContentProps;\n\nexport function ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey,\n}: ChartLegendContentProps) {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div\n className={cx(\n styles.legendContent,\n verticalAlign === 'top' ? styles.legendTop : styles.legendBottom,\n className,\n )}\n >\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div key={index} className={styles.legendItem}>\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div className={styles.legendSwatch} style={{ backgroundColor: item.color }} />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n}\n\n// Guarded, single-purpose replacement for upstream's two inline\n// `payload[key as keyof typeof payload] as string` assertions: `in` proves\n// the property exists at runtime, this narrows the read value itself\n// instead of asserting the container's shape.\nfunction getStringField(source: object, key: string): string | undefined {\n if (!(key in source)) {\n return undefined;\n }\n const value = (source as Record<string, unknown>)[key];\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string,\n): ChartConfig[string] | undefined {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined;\n\n const configLabelKey =\n getStringField(payload, key) ?? (payloadPayload && getStringField(payloadPayload, key)) ?? key;\n\n return configLabelKey in config ? config[configLabelKey] : config[key];\n}\n"],"names":["INITIAL_DIMENSION","ChartContext","createContext","useChart","context","useContext","CSS_IDENT_UNSAFE","CSS_VALUE_UNSAFE","cssIdentifier","value","isSafeCssValue","ChartContainer","id","className","children","config","initialDimension","props","uniqueId","useId","chartId","jsxs","cx","styles","jsx","ChartStyle","RechartsPrimitive","colorConfig","itemConfig","safeId","declarationsFor","theme","key","color","_a","declaration","lightDeclarations","darkDeclarations","css","ChartTooltip","ChartTooltipContent","active","payload","indicator","hideLabel","hideIndicator","label","labelFormatter","labelClassName","formatter","nameKey","labelKey","tooltipLabel","useMemo","item","getPayloadConfigFromPayload","nestLabel","index","indicatorColor","Fragment","ChartLegend","ChartLegendContent","hideIcon","verticalAlign","getStringField","source","payloadPayload","configLabelKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDMA,KAAoB,EAAE,OAAO,KAAK,QAAQ,IAAA,GAmB1CC,IAAeC,EAAwC,IAAI;AAEjE,SAASC,IAAW;AAClB,QAAMC,IAAUC,EAAWJ,CAAY;AAEvC,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,mDAAmD;AAGrE,SAAOA;AACT;AAwBA,MAAME,KAAmB,mBAKnBC,KAAmB;AAEzB,SAASC,EAAcC,GAAuB;AAC5C,SAAOA,EAAM,QAAQH,IAAkB,GAAG;AAC5C;AAEA,SAASI,GAAeD,GAAw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e,sCA+DzD;AAED,eAAO,MAAM,YAAY,kCAA4B,CAAC;AAEtD,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,OAAO,CAAC,GACrF,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,GAAG;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,IAAI,CAAC,0BAA0B,CAAC,gBAAgB,EAAE,eAAe,CAAC,EAAE,oBAAoB,CAAC,CAAC;AAEhG,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,OAAO,EACP,SAAS,EACT,SAAiB,EACjB,SAAiB,EACjB,aAAqB,EACrB,KAAK,EACL,cAAc,EACd,cAAc,EACd,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,GACT,EAAE,wBAAwB,sCA0G1B;AAED,eAAO,MAAM,WAAW,0HAA2B,CAAC;AAEpD,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,GAAG;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,yBAAyB,CAAC;AAE9B,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,QAAgB,EAChB,OAAO,EACP,aAAwB,EACxB,OAAO,GACR,EAAE,uBAAuB,sCAkCzB"}
@@ -127,6 +127,14 @@ plain colour syntax and neither rule is noticeable. If you render
127
127
  normalized id on your own `data-chart` attribute or the selector will not
128
128
  match it.
129
129
 
130
+ `ChartStyle` renders its per-instance CSS as the `<style>` element's JSX
131
+ children (`<style>{css}</style>`) rather than through
132
+ `dangerouslySetInnerHTML`, which is what upstream and most React chart
133
+ implementations use. Children get React's own server-side `</style`
134
+ escaping (so the string can't break out of the tag in SSR output) and are
135
+ rendered client-side as an inert Text node — a stronger guarantee than
136
+ `dangerouslySetInnerHTML` offers, for the same runtime-built string.
137
+
130
138
  ## Examples
131
139
 
132
140
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gears-frontx/ui-kit",
3
- "version": "0.4.0-alpha.0",
3
+ "version": "0.4.0-alpha.1",
4
4
  "description": "Standard React component base for FrontX templates - Base UI behavior, CSS Modules styling on semantic tokens, CVA variants",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",