@acronis-platform/ui-react 0.57.1 → 0.60.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/components/ui/area-chart/area-chart.js +177 -0
- package/dist/components/ui/area-chart/area-chart.js.map +1 -0
- package/dist/components/ui/bar-chart/bar-chart.js +184 -78
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/button-icon-input/button-icon-input.js +36 -0
- package/dist/components/ui/button-icon-input/button-icon-input.js.map +1 -0
- package/dist/components/ui/button-menu/button-menu.js +1 -1
- package/dist/components/ui/button-menu/button-menu.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +17 -15
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/card-filter/card-filter.js +40 -27
- package/dist/components/ui/card-filter/card-filter.js.map +1 -1
- package/dist/components/ui/carousel-dialog/carousel-dialog.js +87 -0
- package/dist/components/ui/carousel-dialog/carousel-dialog.js.map +1 -0
- package/dist/components/ui/category-bar/category-bar.js +126 -0
- package/dist/components/ui/category-bar/category-bar.js.map +1 -0
- package/dist/components/ui/chart/chart-format.js +40 -0
- package/dist/components/ui/chart/chart-format.js.map +1 -0
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/chart-state/chart-state.js +42 -0
- package/dist/components/ui/chart-state/chart-state.js.map +1 -0
- package/dist/components/ui/chip/chip.js +13 -13
- package/dist/components/ui/chip/chip.js.map +1 -1
- package/dist/components/ui/composed-chart/composed-chart.js +135 -0
- package/dist/components/ui/composed-chart/composed-chart.js.map +1 -0
- package/dist/components/ui/confidence-cone/confidence-cone.js +223 -0
- package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -0
- package/dist/components/ui/date-range-picker/date-range-picker.js +21 -21
- package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +248 -76
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js +57 -0
- package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js.map +1 -0
- package/dist/components/ui/dialog-footer-default/dialog-footer-default.js +26 -0
- package/dist/components/ui/dialog-footer-default/dialog-footer-default.js.map +1 -0
- package/dist/components/ui/dialog-welcome/dialog-welcome.js +272 -0
- package/dist/components/ui/dialog-welcome/dialog-welcome.js.map +1 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +21 -21
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/filter-search/filter-search.js +91 -90
- package/dist/components/ui/filter-search/filter-search.js.map +1 -1
- package/dist/components/ui/funnel-chart/funnel-chart.js +87 -0
- package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -0
- package/dist/components/ui/histogram/histogram.js +136 -0
- package/dist/components/ui/histogram/histogram.js.map +1 -0
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.js +104 -0
- package/dist/components/ui/input-otp/input-otp.js.map +1 -0
- package/dist/components/ui/input-password/input-password.js +120 -0
- package/dist/components/ui/input-password/input-password.js.map +1 -0
- package/dist/components/ui/input-text/input-text.js +9 -9
- package/dist/components/ui/input-text/input-text.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.js +234 -0
- package/dist/components/ui/line-chart/line-chart.js.map +1 -0
- package/dist/components/ui/link/link.js +5 -5
- package/dist/components/ui/link/link.js.map +1 -1
- package/dist/components/ui/loading/loading.js +79 -0
- package/dist/components/ui/loading/loading.js.map +1 -0
- package/dist/components/ui/meter/meter.js +93 -0
- package/dist/components/ui/meter/meter.js.map +1 -0
- package/dist/components/ui/metric/metric.js +185 -0
- package/dist/components/ui/metric/metric.js.map +1 -0
- package/dist/components/ui/pie-chart/pie-chart.js +113 -0
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -0
- package/dist/components/ui/popover/popover.js +57 -27
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/radar-chart/radar-chart.js +74 -0
- package/dist/components/ui/radar-chart/radar-chart.js.map +1 -0
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +69 -0
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -0
- package/dist/components/ui/sankey-chart/sankey-chart.js +192 -0
- package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -0
- package/dist/components/ui/scatter-chart/scatter-chart.js +130 -0
- package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -0
- package/dist/components/ui/search/search.js +16 -16
- package/dist/components/ui/search/search.js.map +1 -1
- package/dist/components/ui/sheet/sheet-details.js +16 -16
- package/dist/components/ui/sheet/sheet-details.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/timeline/timeline.js +175 -0
- package/dist/components/ui/timeline/timeline.js.map +1 -0
- package/dist/components/ui/toolbar/toolbar.js +82 -92
- package/dist/components/ui/toolbar/toolbar.js.map +1 -1
- package/dist/components/ui/treemap/treemap.js +83 -0
- package/dist/components/ui/treemap/treemap.js.map +1 -0
- package/dist/components/ui/trend-indicator/trend-indicator.js +97 -0
- package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -0
- package/dist/index.js +461 -400
- package/dist/index.js.map +1 -1
- package/dist/lib/breakpoints.js +9 -6
- package/dist/lib/breakpoints.js.map +1 -1
- package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +25 -0
- package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js.map +1 -0
- package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +36 -0
- package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js.map +1 -0
- package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js +1205 -0
- package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js.map +1 -0
- package/dist/react.js +461 -400
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/area-chart/area-chart.d.ts +34 -0
- package/dist/src/components/ui/area-chart/index.d.ts +1 -0
- package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +30 -5
- package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/button-icon-input/button-icon-input.d.ts +21 -0
- package/dist/src/components/ui/button-icon-input/index.d.ts +1 -0
- package/dist/src/components/ui/card-filter/card-filter.d.ts +5 -0
- package/dist/src/components/ui/carousel-dialog/carousel-dialog.d.ts +28 -0
- package/dist/src/components/ui/carousel-dialog/index.d.ts +1 -0
- package/dist/src/components/ui/category-bar/category-bar.d.ts +51 -0
- package/dist/src/components/ui/category-bar/index.d.ts +1 -0
- package/dist/src/components/ui/chart/__tests__/chart-format.test.d.ts +1 -0
- package/dist/src/components/ui/chart/chart-format.d.ts +111 -0
- package/dist/src/components/ui/chart/chart.d.ts +2 -0
- package/dist/src/components/ui/chart/index.d.ts +3 -1
- package/dist/src/components/ui/chart-state/chart-state.d.ts +11 -0
- package/dist/src/components/ui/chart-state/index.d.ts +1 -0
- package/dist/src/components/ui/composed-chart/composed-chart.d.ts +33 -0
- package/dist/src/components/ui/composed-chart/index.d.ts +1 -0
- package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +62 -0
- package/dist/src/components/ui/confidence-cone/index.d.ts +1 -0
- package/dist/src/components/ui/dialog/dialog.d.ts +105 -9
- package/dist/src/components/ui/dialog/dialog.docs.d.ts +82 -5
- package/dist/src/components/ui/dialog/index.d.ts +1 -1
- package/dist/src/components/ui/dialog-footer-carousel/dialog-footer-carousel.d.ts +9 -0
- package/dist/src/components/ui/dialog-footer-carousel/index.d.ts +1 -0
- package/dist/src/components/ui/dialog-footer-default/dialog-footer-default.d.ts +11 -0
- package/dist/src/components/ui/dialog-footer-default/index.d.ts +1 -0
- package/dist/src/components/ui/dialog-welcome/dialog-welcome.d.ts +54 -0
- package/dist/src/components/ui/dialog-welcome/dialog-welcome.docs.d.ts +55 -0
- package/dist/src/components/ui/dialog-welcome/index.d.ts +1 -0
- package/dist/src/components/ui/filter-search/filter-search.d.ts +1 -1
- package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +39 -0
- package/dist/src/components/ui/funnel-chart/index.d.ts +1 -0
- package/dist/src/components/ui/histogram/histogram.d.ts +40 -0
- package/dist/src/components/ui/histogram/index.d.ts +1 -0
- package/dist/src/components/ui/input-otp/index.d.ts +1 -0
- package/dist/src/components/ui/input-otp/input-otp.d.ts +23 -0
- package/dist/src/components/ui/input-password/index.d.ts +1 -0
- package/dist/src/components/ui/input-password/input-password.d.ts +21 -0
- package/dist/src/components/ui/line-chart/index.d.ts +1 -0
- package/dist/src/components/ui/line-chart/line-chart.d.ts +68 -0
- package/dist/src/components/ui/loading/index.d.ts +1 -0
- package/dist/src/components/ui/loading/loading.d.ts +13 -0
- package/dist/src/components/ui/meter/index.d.ts +1 -0
- package/dist/src/components/ui/meter/meter.d.ts +25 -0
- package/dist/src/components/ui/metric/index.d.ts +1 -0
- package/dist/src/components/ui/metric/metric.d.ts +37 -0
- package/dist/src/components/ui/pie-chart/index.d.ts +1 -0
- package/dist/src/components/ui/pie-chart/pie-chart.d.ts +54 -0
- package/dist/src/components/ui/popover/index.d.ts +1 -1
- package/dist/src/components/ui/popover/popover.d.ts +13 -1
- package/dist/src/components/ui/radar-chart/index.d.ts +1 -0
- package/dist/src/components/ui/radar-chart/radar-chart.d.ts +40 -0
- package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -0
- package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +45 -0
- package/dist/src/components/ui/sankey-chart/index.d.ts +2 -0
- package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +69 -0
- package/dist/src/components/ui/scatter-chart/index.d.ts +1 -0
- package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +35 -0
- package/dist/src/components/ui/stack/stack.d.ts +1 -1
- package/dist/src/components/ui/timeline/index.d.ts +1 -0
- package/dist/src/components/ui/timeline/timeline.d.ts +41 -0
- package/dist/src/components/ui/treemap/index.d.ts +1 -0
- package/dist/src/components/ui/treemap/treemap.d.ts +44 -0
- package/dist/src/components/ui/trend-indicator/index.d.ts +1 -0
- package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +32 -0
- package/dist/src/index.d.ts +27 -2
- package/dist/ui-react.css +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as t, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import * as V from "react";
|
|
3
|
+
import { cva as b } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
|
4
|
+
import { PieChart as j, Pie as T, Cell as _, Label as $ } from "recharts";
|
|
5
|
+
import { cn as y } from "../../../lib/utils.js";
|
|
6
|
+
import { ChartContainer as z, ChartTooltip as D, ChartTooltipContent as G, ChartLegend as I, ChartLegendContent as L } from "../chart/chart.js";
|
|
7
|
+
const O = b("", {
|
|
8
|
+
variants: {
|
|
9
|
+
shape: {
|
|
10
|
+
pie: "",
|
|
11
|
+
donut: ""
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
shape: "pie"
|
|
16
|
+
}
|
|
17
|
+
}), S = 28, W = V.forwardRef(
|
|
18
|
+
({
|
|
19
|
+
className: u,
|
|
20
|
+
config: f,
|
|
21
|
+
data: s,
|
|
22
|
+
dataKey: p,
|
|
23
|
+
nameKey: r,
|
|
24
|
+
shape: i = "pie",
|
|
25
|
+
centerLabel: e,
|
|
26
|
+
innerRadius: C = 60,
|
|
27
|
+
outerRadius: x,
|
|
28
|
+
paddingAngle: R = 0,
|
|
29
|
+
showTooltip: v = !0,
|
|
30
|
+
showLegend: c = !0,
|
|
31
|
+
tooltipContent: N,
|
|
32
|
+
...E
|
|
33
|
+
}, P) => {
|
|
34
|
+
const g = i === "donut" ? C : 0;
|
|
35
|
+
return /* @__PURE__ */ t(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
ref: P,
|
|
39
|
+
"data-shape": i,
|
|
40
|
+
className: y(O({ shape: i }), u),
|
|
41
|
+
...E,
|
|
42
|
+
children: /* @__PURE__ */ t(z, { config: f, className: "size-full", children: /* @__PURE__ */ o(j, { children: [
|
|
43
|
+
v && /* @__PURE__ */ t(
|
|
44
|
+
D,
|
|
45
|
+
{
|
|
46
|
+
content: N ?? /* @__PURE__ */ t(G, { nameKey: r, hideLabel: !0 })
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ o(
|
|
50
|
+
T,
|
|
51
|
+
{
|
|
52
|
+
data: s,
|
|
53
|
+
dataKey: p,
|
|
54
|
+
nameKey: r,
|
|
55
|
+
innerRadius: g,
|
|
56
|
+
outerRadius: x,
|
|
57
|
+
paddingAngle: R,
|
|
58
|
+
isAnimationActive: !1,
|
|
59
|
+
children: [
|
|
60
|
+
s.map((n, a) => (
|
|
61
|
+
// Keyed by index, not the name: two rows may share a nameKey
|
|
62
|
+
// value, which would collide as a React key. Same-named rows
|
|
63
|
+
// intentionally share a color/config entry via `--color-<name>`.
|
|
64
|
+
/* @__PURE__ */ t(_, { fill: `var(--color-${n[r]})` }, a)
|
|
65
|
+
)),
|
|
66
|
+
i === "donut" && e && /* @__PURE__ */ t(
|
|
67
|
+
$,
|
|
68
|
+
{
|
|
69
|
+
content: ({ viewBox: n }) => {
|
|
70
|
+
if (!n || !("cx" in n)) return null;
|
|
71
|
+
const { cx: a = 0, cy: A = 0 } = n, l = A - (c ? S / 2 : 0), d = e.value != null, m = e.label != null, h = d && m;
|
|
72
|
+
return /* @__PURE__ */ o("g", { children: [
|
|
73
|
+
d && /* @__PURE__ */ t(
|
|
74
|
+
"text",
|
|
75
|
+
{
|
|
76
|
+
x: a,
|
|
77
|
+
y: h ? l - 10 : l,
|
|
78
|
+
textAnchor: "middle",
|
|
79
|
+
dominantBaseline: "central",
|
|
80
|
+
className: "fill-foreground text-2xl font-semibold",
|
|
81
|
+
children: e.value
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
m && /* @__PURE__ */ t(
|
|
85
|
+
"text",
|
|
86
|
+
{
|
|
87
|
+
x: a,
|
|
88
|
+
y: h ? l + 13 : l,
|
|
89
|
+
textAnchor: "middle",
|
|
90
|
+
dominantBaseline: "central",
|
|
91
|
+
className: "fill-muted-foreground text-sm",
|
|
92
|
+
children: e.label
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
] });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
c && /* @__PURE__ */ t(I, { content: /* @__PURE__ */ t(L, { nameKey: r }) })
|
|
103
|
+
] }) })
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
W.displayName = "PieChart";
|
|
109
|
+
export {
|
|
110
|
+
W as PieChart,
|
|
111
|
+
O as pieChartVariants
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=pie-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-chart.js","sources":["../../../../src/components/ui/pie-chart/pie-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Cell, Label, Pie, PieChart as RechartsPieChart } from 'recharts';\n\nimport { cn } from '@/lib/utils';\nimport {\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from '../chart';\n\n// A typed recharts composition over the shared `Chart` primitives. The single\n// CVA axis is the design's Pie-chart variant set: `shape` (a filled pie vs a\n// hollow-centre donut). The class stays empty because recharts' SVG — not CSS —\n// draws the arc: `shape` drives the `<Pie>`'s `innerRadius` (0 for a pie, the\n// `innerRadius` prop for a donut). CVA is kept so the variant set is a\n// first-class, spec-conformant part of the API (matched against ui-spec's\n// api.yaml enums) and exposed via `VariantProps`; the resolved value is also\n// mirrored onto `data-shape`.\nconst pieChartVariants = cva('', {\n variants: {\n shape: {\n pie: '',\n donut: '',\n },\n },\n defaultVariants: {\n shape: 'pie',\n },\n});\n\nexport interface PieChartCenterLabel {\n // Rendered as SVG <text>, which only lays out text — hence string | number,\n // not ReactNode.\n /** Headline metric rendered large in the donut hole (e.g. a total). */\n value?: string | number;\n /** Caption rendered under the value. */\n label?: string | number;\n}\n\nexport interface PieChartProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n VariantProps<typeof pieChartVariants> {\n /** Row-per-slice data. Each object holds the slice's `nameKey` label + its `dataKey` numeric value. */\n data: ReadonlyArray<Record<string, string | number>>;\n /**\n * Per-slice map of `label` / `color`, keyed by the slice's `nameKey` value\n * (imported from the shared `Chart` primitives). Turned into `--color-<name>`\n * custom properties. Colors are caller-supplied — reference an existing\n * semantic `--ui-*` token; there is no chart palette tier yet.\n */\n config: ChartConfig;\n /** Numeric field that sizes each slice. */\n dataKey: string;\n /**\n * Label field that names each slice (drives the legend, tooltip, and\n * `--color-<name>` lookup). Values should be unique per chart — rows sharing a\n * name share one `config`/color entry.\n */\n nameKey: string;\n /** Inner radius of the arc when `shape=\"donut\"` (ignored for `shape=\"pie\"`). */\n innerRadius?: number;\n /**\n * Custom content for the donut hole — a headline `value` and/or a `label`\n * caption, stacked and centered. Rendered only for `shape=\"donut\"` (a filled\n * pie has no hole).\n */\n centerLabel?: PieChartCenterLabel;\n /** Outer radius of the arc. Omit to use recharts' responsive default. */\n outerRadius?: number;\n /** Gap between slices, in degrees. */\n paddingAngle?: number;\n showTooltip?: boolean;\n showLegend?: boolean;\n /**\n * Replace the default tooltip. Pass a configured `ChartTooltipContent`\n * (imported from this library) — e.g. with a `formatter` / `labelFormatter` —\n * to customize formatting, per-slice rows, or extra fields without composing\n * recharts yourself. Ignored when `showTooltip` is false.\n */\n tooltipContent?: React.ComponentProps<typeof ChartTooltip>['content'];\n}\n\n// Reserved height (px) of the shared single-row `ChartLegendContent` at the\n// bottom of the chart surface. recharts shifts the donut centre up by half of\n// this to make room for the legend, but a Pie <Label>'s viewBox does not\n// reflect it — so the centre label is nudged up by the same amount. VR\n// baselines guard this value if the legend's height ever changes.\nconst LEGEND_ROW_RESERVE = 28;\n\nconst PieChart = React.forwardRef<HTMLDivElement, PieChartProps>(\n (\n {\n className,\n config,\n data,\n dataKey,\n nameKey,\n shape = 'pie',\n centerLabel,\n innerRadius = 60,\n outerRadius,\n paddingAngle = 0,\n showTooltip = true,\n showLegend = true,\n tooltipContent,\n ...props\n },\n ref\n ) => {\n const resolvedInnerRadius = shape === 'donut' ? innerRadius : 0;\n\n return (\n <div\n ref={ref}\n data-shape={shape}\n className={cn(pieChartVariants({ shape }), className)}\n {...props}\n >\n <ChartContainer config={config} className=\"size-full\">\n <RechartsPieChart>\n {showTooltip && (\n <ChartTooltip\n content={\n tooltipContent ?? (\n <ChartTooltipContent nameKey={nameKey} hideLabel />\n )\n }\n />\n )}\n <Pie\n data={data as unknown[]}\n dataKey={dataKey}\n nameKey={nameKey}\n innerRadius={resolvedInnerRadius}\n outerRadius={outerRadius}\n paddingAngle={paddingAngle}\n isAnimationActive={false}\n >\n {data.map((entry, index) => (\n // Keyed by index, not the name: two rows may share a nameKey\n // value, which would collide as a React key. Same-named rows\n // intentionally share a color/config entry via `--color-<name>`.\n <Cell key={index} fill={`var(--color-${entry[nameKey]})`} />\n ))}\n {shape === 'donut' && centerLabel && (\n <Label\n content={({ viewBox }) => {\n if (!viewBox || !('cx' in viewBox)) return null;\n const { cx = 0, cy = 0 } = viewBox as {\n cx?: number;\n cy?: number;\n };\n // recharts centres the pie in the plot area (surface minus\n // the legend), but a Pie <Label>'s viewBox reports the full\n // surface centre — so a bottom legend leaves cy half a legend\n // row too low. Nudge up onto the real donut centre.\n const centerY =\n cy - (showLegend ? LEGEND_ROW_RESERVE / 2 : 0);\n const hasValue = centerLabel.value != null;\n const hasLabel = centerLabel.label != null;\n // Straddle centerY when both lines show, so the value + label\n // block is centered as a whole (not just the value).\n const both = hasValue && hasLabel;\n return (\n <g>\n {hasValue && (\n <text\n x={cx}\n y={both ? centerY - 10 : centerY}\n textAnchor=\"middle\"\n dominantBaseline=\"central\"\n className=\"fill-foreground text-2xl font-semibold\"\n >\n {centerLabel.value}\n </text>\n )}\n {hasLabel && (\n <text\n x={cx}\n y={both ? centerY + 13 : centerY}\n textAnchor=\"middle\"\n dominantBaseline=\"central\"\n className=\"fill-muted-foreground text-sm\"\n >\n {centerLabel.label}\n </text>\n )}\n </g>\n );\n }}\n />\n )}\n </Pie>\n {showLegend && (\n <ChartLegend content={<ChartLegendContent nameKey={nameKey} />} />\n )}\n </RechartsPieChart>\n </ChartContainer>\n </div>\n );\n }\n);\nPieChart.displayName = 'PieChart';\n\nexport { PieChart, pieChartVariants };\n"],"names":["pieChartVariants","cva","LEGEND_ROW_RESERVE","PieChart","React","className","config","data","dataKey","nameKey","shape","centerLabel","innerRadius","outerRadius","paddingAngle","showTooltip","showLegend","tooltipContent","props","ref","resolvedInnerRadius","jsx","cn","ChartContainer","RechartsPieChart","ChartTooltip","ChartTooltipContent","jsxs","Pie","entry","index","Cell","Label","viewBox","cx","cy","centerY","hasValue","hasLabel","both","ChartLegend","ChartLegendContent"],"mappings":";;;;;;AAwBA,MAAMA,IAAmBC,EAAI,IAAI;AAAA,EAC/B,UAAU;AAAA,IACR,OAAO;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,IAAA;AAAA,EACT;AAAA,EAEF,iBAAiB;AAAA,IAC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3
|
import { Popover as o } from "@base-ui/react/popover";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { usePortalContainer as
|
|
6
|
-
const
|
|
4
|
+
import { cn as d } from "../../../lib/utils.js";
|
|
5
|
+
import { usePortalContainer as b } from "../../../lib/portal-container.js";
|
|
6
|
+
const C = o.Root, R = o.Trigger, z = o.Portal, g = i.forwardRef(
|
|
7
7
|
({
|
|
8
8
|
className: r,
|
|
9
|
-
side:
|
|
10
|
-
align:
|
|
11
|
-
sideOffset:
|
|
12
|
-
portal:
|
|
9
|
+
side: e = "bottom",
|
|
10
|
+
align: t = "center",
|
|
11
|
+
sideOffset: p = 4,
|
|
12
|
+
portal: l = !0,
|
|
13
13
|
portalContainer: s,
|
|
14
|
-
keepMounted:
|
|
15
|
-
...
|
|
16
|
-
},
|
|
17
|
-
const
|
|
14
|
+
keepMounted: v,
|
|
15
|
+
...c
|
|
16
|
+
}, f) => {
|
|
17
|
+
const m = b(), u = s ?? m, n = /* @__PURE__ */ a(
|
|
18
18
|
o.Positioner,
|
|
19
19
|
{
|
|
20
|
-
side:
|
|
21
|
-
align:
|
|
22
|
-
sideOffset:
|
|
20
|
+
side: e,
|
|
21
|
+
align: t,
|
|
22
|
+
sideOffset: p,
|
|
23
23
|
className: "z-50",
|
|
24
|
-
children: /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ a(
|
|
25
25
|
o.Popup,
|
|
26
26
|
{
|
|
27
|
-
ref:
|
|
28
|
-
className:
|
|
29
|
-
"w-
|
|
27
|
+
ref: f,
|
|
28
|
+
className: d(
|
|
29
|
+
"min-w-[var(--ui-popover-container-min-width)] max-w-[var(--ui-popover-container-max-width)] rounded-[var(--ui-popover-container-border-radius)] border-[length:var(--ui-popover-container-border-width)] border-solid border-[var(--ui-popover-container-border-color)] bg-[var(--ui-popover-container-color)] text-foreground outline-none",
|
|
30
30
|
"duration-200 data-[open]:animate-in data-[closed]:animate-out data-[open]:fade-in-0 data-[closed]:fade-out-0 data-[open]:zoom-in-95 data-[closed]:zoom-out-95",
|
|
31
31
|
"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2",
|
|
32
32
|
r
|
|
33
33
|
),
|
|
34
|
-
...
|
|
34
|
+
...c
|
|
35
35
|
}
|
|
36
36
|
)
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
|
-
return
|
|
39
|
+
return l ? /* @__PURE__ */ a(o.Portal, { container: u, keepMounted: v, children: n }) : n;
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
|
-
|
|
42
|
+
g.displayName = "PopoverContent";
|
|
43
|
+
const P = i.forwardRef(
|
|
44
|
+
({ className: r, ...e }, t) => /* @__PURE__ */ a(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
ref: t,
|
|
48
|
+
className: d(
|
|
49
|
+
"flex w-full flex-col gap-[var(--ui-popover-body-gap)] px-4 py-[var(--ui-popover-body-padding-y)]",
|
|
50
|
+
r
|
|
51
|
+
),
|
|
52
|
+
...e
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
P.displayName = "PopoverBody";
|
|
57
|
+
const h = i.forwardRef(
|
|
58
|
+
({ className: r, ...e }, t) => /* @__PURE__ */ a(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
ref: t,
|
|
62
|
+
className: d(
|
|
63
|
+
"flex h-[var(--ui-footer-global-height)] w-full shrink-0 items-center justify-end gap-[var(--ui-footer-global-gap)] border-t-[length:var(--ui-footer-default-border-width)] border-solid border-[var(--ui-footer-default-border-color)] bg-[var(--ui-footer-default-color)] px-[var(--ui-footer-global-padding-x)]",
|
|
64
|
+
r
|
|
65
|
+
),
|
|
66
|
+
...e
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
h.displayName = "PopoverFooter";
|
|
43
71
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
72
|
+
C as Popover,
|
|
73
|
+
P as PopoverBody,
|
|
74
|
+
g as PopoverContent,
|
|
75
|
+
h as PopoverFooter,
|
|
76
|
+
z as PopoverPortal,
|
|
77
|
+
R as PopoverTrigger
|
|
48
78
|
};
|
|
49
79
|
//# sourceMappingURL=popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sources":["../../../../src/components/ui/popover/popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `popover`\n// (packages/ui-legacy/src/components/ui/popover.tsx). A floating panel anchored\n// to a trigger, built on the Base UI Popover primitive (positioning, focus\n// management, outside-press / Esc dismissal, ARIA come from Base UI).
|
|
1
|
+
{"version":3,"file":"popover.js","sources":["../../../../src/components/ui/popover/popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `popover`\n// (packages/ui-legacy/src/components/ui/popover.tsx). A floating panel anchored\n// to a trigger, built on the Base UI Popover primitive (positioning, focus\n// management, outside-press / Esc dismissal, ARIA come from Base UI). Themed by\n// the `--ui-popover-*` tier (container chrome: color, border, radius, min/max\n// width) per Figma node 6364:17907. The optional `PopoverBody`/`PopoverFooter`\n// parts mirror that node's `Body` slot and `FooterDefault` recipe — `PopoverBody`\n// from `--ui-popover-body-*`, `PopoverFooter` from the shared `--ui-footer-*`\n// tier (also used by other components' default action-row footer). Text color\n// stays on the bridged semantic token (--ui-text-on-surface-primary), which the\n// design references directly rather than a Popover-specific token.\n// Enter/exit animations use `tw-animate-css` keyed to Base UI's data-[open] /\n// data-[closed] / data-[side] attributes.\n\nconst Popover = PopoverPrimitive.Root;\n\nconst PopoverTrigger = PopoverPrimitive.Trigger;\n\nconst PopoverPortal = PopoverPrimitive.Portal;\n\nexport interface PopoverContentProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Popup> {\n /** Which side of the trigger to render on. */\n side?: PopoverPrimitive.Positioner.Props['side'];\n /** Alignment along the chosen side. */\n align?: PopoverPrimitive.Positioner.Props['align'];\n /** Distance in px from the trigger. */\n sideOffset?: number;\n /**\n * Render inside a portal (default `true`). Set `false` for inline usage\n * (e.g. when supplying your own `PopoverPortal`).\n */\n portal?: boolean;\n /**\n * Portal container. Pass a shadow-root mount for isolated-style previews\n * (the docs demos do this via `useShadowMount`).\n */\n portalContainer?: PopoverPrimitive.Portal.Props['container'];\n /** Keep the content mounted while closed (Base UI `Portal` prop). */\n keepMounted?: PopoverPrimitive.Portal.Props['keepMounted'];\n}\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Popup>,\n PopoverContentProps\n>(\n (\n {\n className,\n side = 'bottom',\n align = 'center',\n sideOffset = 4,\n portal = true,\n portalContainer,\n keepMounted,\n ...props\n },\n ref\n ) => {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n const positioner = (\n <PopoverPrimitive.Positioner\n side={side}\n align={align}\n sideOffset={sideOffset}\n className=\"z-50\"\n >\n <PopoverPrimitive.Popup\n ref={ref}\n className={cn(\n 'min-w-[var(--ui-popover-container-min-width)] max-w-[var(--ui-popover-container-max-width)] rounded-[var(--ui-popover-container-border-radius)] border-[length:var(--ui-popover-container-border-width)] border-solid border-[var(--ui-popover-container-border-color)] bg-[var(--ui-popover-container-color)] text-foreground outline-none',\n 'duration-200 data-[open]:animate-in data-[closed]:animate-out data-[open]:fade-in-0 data-[closed]:fade-out-0 data-[open]:zoom-in-95 data-[closed]:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2',\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Positioner>\n );\n\n return portal ? (\n <PopoverPrimitive.Portal container={resolvedContainer} keepMounted={keepMounted}>\n {positioner}\n </PopoverPrimitive.Portal>\n ) : (\n positioner\n );\n }\n);\nPopoverContent.displayName = 'PopoverContent';\n\n/**\n * Vertical-rhythm wrapper for a `PopoverContent`'s main content — the `Body`\n * slot in the Figma node. Themed from `--ui-popover-body-*` (gap, padding-y);\n * horizontal inset is a plain utility since the design has no dedicated\n * component token for it.\n */\nconst PopoverBody = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex w-full flex-col gap-[var(--ui-popover-body-gap)] px-4 py-[var(--ui-popover-body-padding-y)]',\n className\n )}\n {...props}\n />\n )\n);\nPopoverBody.displayName = 'PopoverBody';\n\n/**\n * Default action-row footer — the `FooterDefault` (`variant=default`) recipe\n * from the Figma node. Themed from the shared `--ui-footer-*` tier.\n */\nconst PopoverFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex h-[var(--ui-footer-global-height)] w-full shrink-0 items-center justify-end gap-[var(--ui-footer-global-gap)] border-t-[length:var(--ui-footer-default-border-width)] border-solid border-[var(--ui-footer-default-border-color)] bg-[var(--ui-footer-default-color)] px-[var(--ui-footer-global-padding-x)]',\n className\n )}\n {...props}\n />\n )\n);\nPopoverFooter.displayName = 'PopoverFooter';\n\nexport {\n Popover,\n PopoverTrigger,\n PopoverPortal,\n PopoverContent,\n PopoverBody,\n PopoverFooter,\n};\n"],"names":["Popover","PopoverPrimitive","PopoverTrigger","PopoverPortal","PopoverContent","React","className","side","align","sideOffset","portal","portalContainer","keepMounted","props","ref","ctxContainer","usePortalContainer","resolvedContainer","positioner","jsx","cn","PopoverBody","PopoverFooter"],"mapp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AAA;AAAA,MACC,KAAAL;AAAA,MACA,WAAWM;AAAA,QACT;AAAA,QACAd;AAAA,MAAA;AAAA,MAED,GAAGO;AAAA,IAAA;AAAA,EAAA;AAGV;AACAS,EAAc,cAAc;"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as r, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import * as R from "react";
|
|
3
|
+
import { cva as v } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
|
4
|
+
import { RadarChart as x, PolarGrid as y, PolarAngleAxis as A, Radar as N } from "recharts";
|
|
5
|
+
import { cn as T } from "../../../lib/utils.js";
|
|
6
|
+
import { ChartContainer as $, ChartTooltip as j, ChartTooltipContent as K, ChartLegend as L, ChartLegendContent as P } from "../chart/chart.js";
|
|
7
|
+
const V = v("", {
|
|
8
|
+
variants: {
|
|
9
|
+
gridType: {
|
|
10
|
+
polygon: "",
|
|
11
|
+
circle: ""
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
gridType: "polygon"
|
|
16
|
+
}
|
|
17
|
+
}), _ = R.forwardRef(
|
|
18
|
+
({
|
|
19
|
+
className: o,
|
|
20
|
+
config: e,
|
|
21
|
+
data: i,
|
|
22
|
+
dataKeys: n,
|
|
23
|
+
angleKey: l,
|
|
24
|
+
gridType: t = "polygon",
|
|
25
|
+
fillOpacity: d = 0.3,
|
|
26
|
+
strokeWidth: s = 2,
|
|
27
|
+
showDots: c = !1,
|
|
28
|
+
showGrid: m = !0,
|
|
29
|
+
showTooltip: p = !0,
|
|
30
|
+
showLegend: f = !0,
|
|
31
|
+
tooltipContent: h,
|
|
32
|
+
...C
|
|
33
|
+
}, g) => /* @__PURE__ */ r(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
ref: g,
|
|
37
|
+
"data-grid-type": t,
|
|
38
|
+
className: T(V({ gridType: t }), o),
|
|
39
|
+
...C,
|
|
40
|
+
children: /* @__PURE__ */ r(
|
|
41
|
+
$,
|
|
42
|
+
{
|
|
43
|
+
config: e,
|
|
44
|
+
className: "size-full [&_.recharts-polar-angle-axis-tick_text]:fill-muted-foreground",
|
|
45
|
+
children: /* @__PURE__ */ u(x, { data: i, children: [
|
|
46
|
+
p && /* @__PURE__ */ r(j, { content: h ?? /* @__PURE__ */ r(K, {}) }),
|
|
47
|
+
m && /* @__PURE__ */ r(y, { gridType: t ?? "polygon" }),
|
|
48
|
+
/* @__PURE__ */ r(A, { dataKey: l }),
|
|
49
|
+
f && /* @__PURE__ */ r(L, { content: /* @__PURE__ */ r(P, {}) }),
|
|
50
|
+
n.map((a) => /* @__PURE__ */ r(
|
|
51
|
+
N,
|
|
52
|
+
{
|
|
53
|
+
dataKey: a,
|
|
54
|
+
stroke: `var(--color-${a})`,
|
|
55
|
+
fill: `var(--color-${a})`,
|
|
56
|
+
fillOpacity: d,
|
|
57
|
+
strokeWidth: s,
|
|
58
|
+
dot: c ? { r: 3 } : !1,
|
|
59
|
+
isAnimationActive: !1
|
|
60
|
+
},
|
|
61
|
+
a
|
|
62
|
+
))
|
|
63
|
+
] })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
_.displayName = "RadarChart";
|
|
70
|
+
export {
|
|
71
|
+
_ as RadarChart,
|
|
72
|
+
V as radarChartVariants
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=radar-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radar-chart.js","sources":["../../../../src/components/ui/radar-chart/radar-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n PolarAngleAxis,\n PolarGrid,\n Radar,\n RadarChart as RechartsRadarChart,\n} from 'recharts';\n\nimport { cn } from '@/lib/utils';\nimport {\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from '../chart';\n\n// A typed recharts composition over the shared `Chart` primitives — the first\n// polar chart type. The single CVA axis is the design's Radar-chart variant set:\n// `gridType` (the polar web is drawn as straight-edged `polygon` rings or smooth\n// `circle` rings). The class stays empty because recharts' SVG — not CSS — draws\n// the web: `gridType` drives `<PolarGrid gridType>`. CVA is kept so the variant\n// set is a first-class, spec-conformant part of the API (matched against\n// ui-spec's api.yaml enums) and exposed via `VariantProps`; the resolved value is\n// also mirrored onto `data-grid-type`.\nconst radarChartVariants = cva('', {\n variants: {\n gridType: {\n polygon: '',\n circle: '',\n },\n },\n defaultVariants: {\n gridType: 'polygon',\n },\n});\n\nexport interface RadarChartProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n VariantProps<typeof radarChartVariants> {\n /** Row-per-axis data. Each object holds the `angleKey` label + one numeric field per series. */\n data: ReadonlyArray<Record<string, string | number>>;\n /**\n * Per-series map of `label` / `color` (imported from the shared `Chart`\n * primitives). Turned into `--color-<key>` custom properties. Series colors\n * are caller-supplied — reference an existing semantic `--ui-*` token; there is\n * no chart palette tier yet.\n */\n config: ChartConfig;\n /** Series to plot — one `<Radar>` per key. Each must exist in `config` and in every data row. */\n dataKeys: string[];\n /** The categorical axis key placed around the web (e.g. `\"subject\"`). */\n angleKey: string;\n /** Fill opacity of each radar area. */\n fillOpacity?: number;\n /** Stroke width of each radar outline. */\n strokeWidth?: number;\n /** Render a dot at each axis point. */\n showDots?: boolean;\n /** Render the polar grid (the web). */\n showGrid?: boolean;\n showTooltip?: boolean;\n showLegend?: boolean;\n /**\n * Replace the default tooltip. Pass a configured `ChartTooltipContent`\n * (imported from this library) — e.g. with a `formatter` / `labelFormatter` /\n * `indicator` — to customize formatting, per-series rows, or extra fields\n * without composing recharts yourself. Ignored when `showTooltip` is false.\n */\n tooltipContent?: React.ComponentProps<typeof ChartTooltip>['content'];\n}\n\nconst RadarChart = React.forwardRef<HTMLDivElement, RadarChartProps>(\n (\n {\n className,\n config,\n data,\n dataKeys,\n angleKey,\n gridType = 'polygon',\n fillOpacity = 0.3,\n strokeWidth = 2,\n showDots = false,\n showGrid = true,\n showTooltip = true,\n showLegend = true,\n tooltipContent,\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n data-grid-type={gridType}\n className={cn(radarChartVariants({ gridType }), className)}\n {...props}\n >\n <ChartContainer\n config={config}\n // The shared container themes cartesian axis ticks but not polar ones,\n // so scope the angle-axis (spoke) labels to the muted-foreground token\n // here — otherwise they render near-black and vanish in dark mode. This\n // is a shared-primitives gap (a Chart task); worked around locally, not\n // by editing chart.tsx.\n className=\"size-full [&_.recharts-polar-angle-axis-tick_text]:fill-muted-foreground\"\n >\n <RechartsRadarChart data={data as readonly unknown[]}>\n {showTooltip && (\n <ChartTooltip content={tooltipContent ?? <ChartTooltipContent />} />\n )}\n {showGrid && <PolarGrid gridType={gridType ?? 'polygon'} />}\n <PolarAngleAxis dataKey={angleKey} />\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n {dataKeys.map((key) => (\n <Radar\n key={key}\n dataKey={key}\n stroke={`var(--color-${key})`}\n fill={`var(--color-${key})`}\n fillOpacity={fillOpacity}\n strokeWidth={strokeWidth}\n dot={showDots ? { r: 3 } : false}\n isAnimationActive={false}\n />\n ))}\n </RechartsRadarChart>\n </ChartContainer>\n </div>\n );\n }\n);\nRadarChart.displayName = 'RadarChart';\n\nexport { RadarChart, radarChartVariants };\n"],"names":["radarChartVariants","cva","RadarChart","React","className","config","data","dataKeys","angleKey","gridType","fillOpacity","strokeWidth","showDots","showGrid","showTooltip","showLegend","tooltipContent","props","ref","jsx","cn","ChartContainer","jsxs","RechartsRadarChart","ChartTooltip","ChartTooltipContent","PolarGrid","PolarAngleAxis","ChartLegend","ChartLegendContent","key","Radar"],"mappings":";;;;;;AA6BA,MAAMA,IAAqBC,EAAI,IAAI;AAAA,EACjC,UAAU;AAAA,IACR,UAAU;AAAA,MACR,SAAS;AA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AAAA,gBACA,aAAAC;AAAA,gBACA,KAAKC,IAAW,EAAE,GAAG,MAAM;AAAA,gBAC3B,mBAAmB;AAAA,cAAA;AAAA,cAPdkB;AAAA,YAAA,CASR;AAAA,UAAA,EAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAIR;AACA5B,EAAW,cAAc;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as r, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import * as x from "react";
|
|
3
|
+
import { RadialBarChart as L, RadialBar as N, Cell as $ } from "recharts";
|
|
4
|
+
import { cn as b } from "../../../lib/utils.js";
|
|
5
|
+
import { ChartContainer as j, ChartTooltip as A, ChartTooltipContent as T, ChartLegend as k, ChartLegendContent as z } from "../chart/chart.js";
|
|
6
|
+
const D = x.forwardRef(
|
|
7
|
+
({
|
|
8
|
+
className: l,
|
|
9
|
+
config: e,
|
|
10
|
+
data: n,
|
|
11
|
+
dataKey: i,
|
|
12
|
+
nameKey: a,
|
|
13
|
+
innerRadius: s = 30,
|
|
14
|
+
outerRadius: c = 110,
|
|
15
|
+
startAngle: d = 90,
|
|
16
|
+
endAngle: h = -270,
|
|
17
|
+
cornerRadius: m = 4,
|
|
18
|
+
showBackground: C = !0,
|
|
19
|
+
showTooltip: f = !0,
|
|
20
|
+
showLegend: p = !0,
|
|
21
|
+
tooltipContent: u,
|
|
22
|
+
...R
|
|
23
|
+
}, B) => {
|
|
24
|
+
const o = n.map((t) => ({
|
|
25
|
+
...t,
|
|
26
|
+
fill: `var(--color-${t[a]})`
|
|
27
|
+
}));
|
|
28
|
+
return /* @__PURE__ */ r("div", { ref: B, className: b(l), ...R, children: /* @__PURE__ */ r(j, { config: e, className: "size-full", children: /* @__PURE__ */ g(
|
|
29
|
+
L,
|
|
30
|
+
{
|
|
31
|
+
data: o,
|
|
32
|
+
dataKey: i,
|
|
33
|
+
innerRadius: s,
|
|
34
|
+
outerRadius: c,
|
|
35
|
+
startAngle: d,
|
|
36
|
+
endAngle: h,
|
|
37
|
+
children: [
|
|
38
|
+
f && /* @__PURE__ */ r(
|
|
39
|
+
A,
|
|
40
|
+
{
|
|
41
|
+
content: u ?? /* @__PURE__ */ r(T, { nameKey: a, hideLabel: !0 })
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ r(
|
|
45
|
+
N,
|
|
46
|
+
{
|
|
47
|
+
dataKey: i,
|
|
48
|
+
background: C,
|
|
49
|
+
cornerRadius: m,
|
|
50
|
+
isAnimationActive: !1,
|
|
51
|
+
children: o.map((t, v) => (
|
|
52
|
+
// Keyed by index, not the name: two arcs could share a nameKey
|
|
53
|
+
// value, which would collide as a React key. Same-named arcs
|
|
54
|
+
// intentionally share a color/config entry via `--color-<name>`.
|
|
55
|
+
/* @__PURE__ */ r($, { fill: `var(--color-${t[a]})` }, v)
|
|
56
|
+
))
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
p && /* @__PURE__ */ r(k, { content: /* @__PURE__ */ r(z, { nameKey: a }) })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
) }) });
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
D.displayName = "RadialBarChart";
|
|
66
|
+
export {
|
|
67
|
+
D as RadialBarChart
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=radial-bar-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radial-bar-chart.js","sources":["../../../../src/components/ui/radial-bar-chart/radial-bar-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Cell, RadialBar, RadialBarChart as RechartsRadialBarChart } from 'recharts';\n\nimport { cn } from '@/lib/utils';\nimport {\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from '../chart';\n\n// A typed recharts composition over the shared `Chart` primitives (a polar/radial\n// type). Rows become concentric arcs sized by `dataKey`, each colored from its\n// `--color-<name>` var. Like ScatterChart/ComposedChart there's no CVA variant:\n// a radial bar's expressiveness is geometry (angles/radii, plain props) and the\n// data mapping, not a visual \"mode\". The angular sweep is exposed as\n// startAngle/endAngle props so a caller can build a gauge or a full ring.\nexport interface RadialBarChartProps\n extends Omit<React.ComponentProps<'div'>, 'children'> {\n /** Row-per-arc data. Each object holds the arc's `nameKey` label + its `dataKey` numeric value. */\n data: ReadonlyArray<Record<string, string | number>>;\n /**\n * Per-arc map of `label` / `color`, keyed by the arc's `nameKey` value\n * (imported from the shared `Chart` primitives). Turned into `--color-<name>`\n * custom properties. Colors are caller-supplied — reference an existing\n * semantic `--ui-*` token; there is no chart palette tier yet.\n */\n config: ChartConfig;\n /** Numeric field that sizes each arc. */\n dataKey: string;\n /**\n * Label field that names each arc (drives the legend, tooltip, and\n * `--color-<name>` lookup). Values should be unique per chart (arcs sharing a\n * name share one `config`/color entry) and CSS-safe — they become part of a\n * custom-property name.\n */\n nameKey: string;\n /** Inner radius of the innermost arc. */\n innerRadius?: number;\n /** Outer radius of the outermost arc. */\n outerRadius?: number;\n /** Angle (degrees) the arcs sweep from. */\n startAngle?: number;\n /** Angle (degrees) the arcs sweep to (default is a full clockwise circle). */\n endAngle?: number;\n /** Corner radius on each arc's ends. */\n cornerRadius?: number;\n /** Render a muted background track behind each arc. */\n showBackground?: boolean;\n showTooltip?: boolean;\n showLegend?: boolean;\n /**\n * Replace the default tooltip. Pass a configured `ChartTooltipContent`\n * (imported from this library) — e.g. with a `formatter` / `labelFormatter` —\n * to customize formatting, per-arc rows, or extra fields without composing\n * recharts yourself. Ignored when `showTooltip` is false.\n */\n tooltipContent?: React.ComponentProps<typeof ChartTooltip>['content'];\n}\n\nconst RadialBarChart = React.forwardRef<HTMLDivElement, RadialBarChartProps>(\n (\n {\n className,\n config,\n data,\n dataKey,\n nameKey,\n innerRadius = 30,\n outerRadius = 110,\n startAngle = 90,\n endAngle = -270,\n cornerRadius = 4,\n showBackground = true,\n showTooltip = true,\n showLegend = true,\n tooltipContent,\n ...props\n },\n ref\n ) => {\n // Stamp each row with its `fill` (the shadcn data-driven pattern) so a real\n // hover resolves the arc color in the tooltip — recharts' RadialBar, like\n // Funnel, carries no per-arc color on the tooltip payload item.\n const seriesData: Record<string, string | number>[] = data.map((row) => ({\n ...row,\n fill: `var(--color-${row[nameKey]})`,\n }));\n\n return (\n <div ref={ref} className={cn(className)} {...props}>\n <ChartContainer config={config} className=\"size-full\">\n <RechartsRadialBarChart\n data={seriesData}\n dataKey={dataKey}\n innerRadius={innerRadius}\n outerRadius={outerRadius}\n startAngle={startAngle}\n endAngle={endAngle}\n >\n {showTooltip && (\n <ChartTooltip\n content={\n tooltipContent ?? (\n <ChartTooltipContent nameKey={nameKey} hideLabel />\n )\n }\n />\n )}\n <RadialBar\n dataKey={dataKey}\n background={showBackground}\n cornerRadius={cornerRadius}\n isAnimationActive={false}\n >\n {seriesData.map((entry, index) => (\n // Keyed by index, not the name: two arcs could share a nameKey\n // value, which would collide as a React key. Same-named arcs\n // intentionally share a color/config entry via `--color-<name>`.\n <Cell key={index} fill={`var(--color-${entry[nameKey]})`} />\n ))}\n </RadialBar>\n {showLegend && (\n <ChartLegend content={<ChartLegendContent nameKey={nameKey} />} />\n )}\n </RechartsRadialBarChart>\n </ChartContainer>\n </div>\n );\n }\n);\nRadialBarChart.displayName = 'RadialBarChart';\n\nexport { RadialBarChart };\n"],"names":["RadialBarChart","React","className","config","data","dataKey","nameKey","innerRadius","outerRadius","startAngle","endAngle","cornerRadius","showBackground","showTooltip","showLegend","tooltipContent","props","ref","seriesData","row","jsx","cn","ChartContainer","jsxs","RechartsRadialBarChart","ChartTooltip","ChartTooltipContent","RadialBar","entry","index","Cell","ChartLegend","ChartLegendContent"],"mappings":";;;;;AAgEA,MAAMA,IAAiBC,EAAM;AAAA,EAC3B,CACE;AAAA,IACE,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC;AAAA,IAC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X,EAACY,GAAA,EAAmB,SAAA1B,GAAkB,EAAA,CAAI;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAGtE,EAAA,CACF;AAAA,EAEJ;AACF;AACAN,EAAe,cAAc;"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { jsxs as b, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import * as f from "react";
|
|
3
|
+
import { Sankey as R, Rectangle as T } from "recharts";
|
|
4
|
+
import { cn as j } from "../../../lib/utils.js";
|
|
5
|
+
import { ChartStyle as A, ChartContainer as q, ChartTooltip as B } from "../chart/chart.js";
|
|
6
|
+
function F(s, n, e) {
|
|
7
|
+
return function({
|
|
8
|
+
x: l,
|
|
9
|
+
y: m,
|
|
10
|
+
width: d,
|
|
11
|
+
height: t,
|
|
12
|
+
index: c,
|
|
13
|
+
payload: a
|
|
14
|
+
}) {
|
|
15
|
+
var i;
|
|
16
|
+
const r = String(a.name), h = ((i = s[r]) == null ? void 0 : i.label) ?? r, x = n.has(c);
|
|
17
|
+
return /* @__PURE__ */ b("g", { children: [
|
|
18
|
+
/* @__PURE__ */ o(
|
|
19
|
+
T,
|
|
20
|
+
{
|
|
21
|
+
x: l,
|
|
22
|
+
y: m,
|
|
23
|
+
width: d,
|
|
24
|
+
height: t,
|
|
25
|
+
fill: `var(--color-${r})`,
|
|
26
|
+
radius: 2
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
e && /* @__PURE__ */ o(
|
|
30
|
+
"text",
|
|
31
|
+
{
|
|
32
|
+
x: x ? l + d + 6 : l - 6,
|
|
33
|
+
y: m + t / 2,
|
|
34
|
+
textAnchor: x ? "start" : "end",
|
|
35
|
+
dominantBaseline: "middle",
|
|
36
|
+
className: "fill-foreground text-xs",
|
|
37
|
+
children: h
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
] });
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function L({
|
|
44
|
+
sourceX: s,
|
|
45
|
+
targetX: n,
|
|
46
|
+
sourceY: e,
|
|
47
|
+
targetY: g,
|
|
48
|
+
sourceControlX: l,
|
|
49
|
+
targetControlX: m,
|
|
50
|
+
linkWidth: d,
|
|
51
|
+
payload: t
|
|
52
|
+
}) {
|
|
53
|
+
const c = String(t.target.name), a = t.color ?? `var(--color-${c})`;
|
|
54
|
+
return /* @__PURE__ */ o(
|
|
55
|
+
"path",
|
|
56
|
+
{
|
|
57
|
+
d: `M${s},${e}C${l},${e} ${m},${g} ${n},${g}`,
|
|
58
|
+
fill: "none",
|
|
59
|
+
stroke: a,
|
|
60
|
+
strokeWidth: Math.max(1, d),
|
|
61
|
+
strokeOpacity: t.color ? 1 : 0.35
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
function O(s, n, e) {
|
|
66
|
+
var m, d;
|
|
67
|
+
const g = (t) => {
|
|
68
|
+
var c;
|
|
69
|
+
return ((c = s[t]) == null ? void 0 : c.label) ?? t;
|
|
70
|
+
}, l = /* @__PURE__ */ new Map();
|
|
71
|
+
for (const t of n) {
|
|
72
|
+
const c = ((m = e[t.source]) == null ? void 0 : m.name) ?? "", a = ((d = e[t.target]) == null ? void 0 : d.name) ?? "";
|
|
73
|
+
l.set(c + " - " + a, {
|
|
74
|
+
color: t.color ?? `var(--color-${a})`,
|
|
75
|
+
opacity: t.color ? 1 : 0.35
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return function({
|
|
79
|
+
active: c,
|
|
80
|
+
payload: a
|
|
81
|
+
}) {
|
|
82
|
+
if (!c || !(a != null && a.length)) return null;
|
|
83
|
+
const r = a[0], h = String((r == null ? void 0 : r.name) ?? "").split(" - "), x = h[h.length - 1], i = l.get(String((r == null ? void 0 : r.name) ?? "")), v = (i == null ? void 0 : i.color) ?? `var(--color-${x})`, y = (i == null ? void 0 : i.opacity) ?? 1, C = r == null ? void 0 : r.value;
|
|
84
|
+
return /* @__PURE__ */ b("div", { className: "flex items-center gap-2 rounded-[var(--ui-tooltip-container-border-radius)] border border-border bg-background px-[var(--ui-tooltip-container-padding-x)] py-[var(--ui-tooltip-container-padding-y)] text-xs text-foreground shadow-md", children: [
|
|
85
|
+
/* @__PURE__ */ o(
|
|
86
|
+
"span",
|
|
87
|
+
{
|
|
88
|
+
className: "h-2.5 w-2.5 shrink-0 rounded-[2px]",
|
|
89
|
+
style: { backgroundColor: v, opacity: y }
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ o("span", { className: "text-muted-foreground", children: h.map((M, w) => /* @__PURE__ */ b(f.Fragment, { children: [
|
|
93
|
+
w > 0 && " → ",
|
|
94
|
+
g(M)
|
|
95
|
+
] }, `${M}-${w}`)) }),
|
|
96
|
+
C != null && /* @__PURE__ */ o("span", { className: "ms-2 font-medium tabular-nums", children: I(C) })
|
|
97
|
+
] });
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function I(s) {
|
|
101
|
+
return Array.isArray(s) ? s.map((n) => I(n)).join(" – ") : typeof s == "number" ? s.toLocaleString() : String(s);
|
|
102
|
+
}
|
|
103
|
+
const z = f.forwardRef(
|
|
104
|
+
({
|
|
105
|
+
className: s,
|
|
106
|
+
config: n,
|
|
107
|
+
data: e,
|
|
108
|
+
nodePadding: g = 24,
|
|
109
|
+
nodeWidth: l = 12,
|
|
110
|
+
linkCurvature: m = 0.5,
|
|
111
|
+
sort: d = !1,
|
|
112
|
+
showLabels: t = !0,
|
|
113
|
+
showLegend: c = !1,
|
|
114
|
+
showTooltip: a = !0,
|
|
115
|
+
tooltipContent: r,
|
|
116
|
+
...h
|
|
117
|
+
}, x) => {
|
|
118
|
+
const v = `chart-${f.useId().replace(/:/g, "")}`, y = f.useMemo(
|
|
119
|
+
() => new Set(e.links.map((u) => u.source)),
|
|
120
|
+
[e.links]
|
|
121
|
+
), C = f.useMemo(
|
|
122
|
+
() => F(n, y, t),
|
|
123
|
+
[n, y, t]
|
|
124
|
+
), M = f.useMemo(
|
|
125
|
+
() => O(n, e.links, e.nodes),
|
|
126
|
+
[n, e.links, e.nodes]
|
|
127
|
+
), w = f.useMemo(() => {
|
|
128
|
+
const u = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
|
|
129
|
+
for (const p of e.links)
|
|
130
|
+
N.set(p.source, (N.get(p.source) ?? 0) + p.value), u.set(p.target, (u.get(p.target) ?? 0) + p.value);
|
|
131
|
+
const k = e.nodes.map(
|
|
132
|
+
(p, $) => u.get($) ?? N.get($) ?? 0
|
|
133
|
+
), S = k.length ? Math.max(...k) : 0;
|
|
134
|
+
return e.nodes.map((p, $) => ({
|
|
135
|
+
name: p.name,
|
|
136
|
+
value: k[$],
|
|
137
|
+
pct: S > 0 ? Math.round(k[$] / S * 100) : 0
|
|
138
|
+
}));
|
|
139
|
+
}, [e]);
|
|
140
|
+
return /* @__PURE__ */ b(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
ref: x,
|
|
144
|
+
"data-chart": v,
|
|
145
|
+
className: j("flex flex-col", s),
|
|
146
|
+
...h,
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ o(A, { id: v, config: n }),
|
|
149
|
+
/* @__PURE__ */ o(q, { config: n, className: "min-h-0 flex-1", children: /* @__PURE__ */ o(
|
|
150
|
+
R,
|
|
151
|
+
{
|
|
152
|
+
data: e,
|
|
153
|
+
node: C,
|
|
154
|
+
link: L,
|
|
155
|
+
nodePadding: g,
|
|
156
|
+
nodeWidth: l,
|
|
157
|
+
linkCurvature: m,
|
|
158
|
+
sort: d,
|
|
159
|
+
align: "left",
|
|
160
|
+
margin: { top: 8, right: 24, bottom: 8, left: 24 },
|
|
161
|
+
children: a && /* @__PURE__ */ o(B, { content: r ?? M })
|
|
162
|
+
}
|
|
163
|
+
) }),
|
|
164
|
+
c && /* @__PURE__ */ o("div", { className: "mt-3 grid grid-cols-2 gap-x-6 gap-y-1.5 text-xs", children: w.map(({ name: u, value: N, pct: k }) => {
|
|
165
|
+
var S;
|
|
166
|
+
return /* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
|
|
167
|
+
/* @__PURE__ */ o(
|
|
168
|
+
"span",
|
|
169
|
+
{
|
|
170
|
+
className: "size-2.5 shrink-0 rounded-full",
|
|
171
|
+
style: { backgroundColor: `var(--color-${u})` }
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ o("span", { className: "truncate text-muted-foreground", children: ((S = n[u]) == null ? void 0 : S.label) ?? u }),
|
|
175
|
+
/* @__PURE__ */ o("span", { className: "ms-auto font-semibold tabular-nums", children: N.toLocaleString() }),
|
|
176
|
+
/* @__PURE__ */ b("span", { className: "w-9 shrink-0 text-end tabular-nums text-muted-foreground", children: [
|
|
177
|
+
k,
|
|
178
|
+
"%"
|
|
179
|
+
] })
|
|
180
|
+
] }, u);
|
|
181
|
+
}) })
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
z.displayName = "SankeyChart";
|
|
188
|
+
export {
|
|
189
|
+
z as SankeyChart,
|
|
190
|
+
O as makeSankeyTooltip
|
|
191
|
+
};
|
|
192
|
+
//# sourceMappingURL=sankey-chart.js.map
|