@acronis-platform/ui-react 0.57.1 → 0.58.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.
Files changed (129) hide show
  1. package/dist/components/ui/area-chart/area-chart.js +149 -0
  2. package/dist/components/ui/area-chart/area-chart.js.map +1 -0
  3. package/dist/components/ui/bar-chart/bar-chart.js +152 -77
  4. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  5. package/dist/components/ui/button-icon-input/button-icon-input.js +36 -0
  6. package/dist/components/ui/button-icon-input/button-icon-input.js.map +1 -0
  7. package/dist/components/ui/button-menu/button-menu.js +1 -1
  8. package/dist/components/ui/button-menu/button-menu.js.map +1 -1
  9. package/dist/components/ui/card-filter/card-filter.js +40 -27
  10. package/dist/components/ui/card-filter/card-filter.js.map +1 -1
  11. package/dist/components/ui/chart-state/chart-state.js +42 -0
  12. package/dist/components/ui/chart-state/chart-state.js.map +1 -0
  13. package/dist/components/ui/chip/chip.js +13 -13
  14. package/dist/components/ui/chip/chip.js.map +1 -1
  15. package/dist/components/ui/composed-chart/composed-chart.js +107 -0
  16. package/dist/components/ui/composed-chart/composed-chart.js.map +1 -0
  17. package/dist/components/ui/confidence-cone/confidence-cone.js +195 -0
  18. package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -0
  19. package/dist/components/ui/date-range-picker/date-range-picker.js +21 -21
  20. package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
  21. package/dist/components/ui/dialog/dialog.js +250 -78
  22. package/dist/components/ui/dialog/dialog.js.map +1 -1
  23. package/dist/components/ui/dialog-footer-default/dialog-footer-default.js +26 -0
  24. package/dist/components/ui/dialog-footer-default/dialog-footer-default.js.map +1 -0
  25. package/dist/components/ui/dropdown-menu/dropdown-menu.js +21 -21
  26. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  27. package/dist/components/ui/filter-search/filter-search.js +91 -90
  28. package/dist/components/ui/filter-search/filter-search.js.map +1 -1
  29. package/dist/components/ui/funnel-chart/funnel-chart.js +87 -0
  30. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -0
  31. package/dist/components/ui/histogram/histogram.js +108 -0
  32. package/dist/components/ui/histogram/histogram.js.map +1 -0
  33. package/dist/components/ui/input-otp/input-otp.js +104 -0
  34. package/dist/components/ui/input-otp/input-otp.js.map +1 -0
  35. package/dist/components/ui/input-password/input-password.js +120 -0
  36. package/dist/components/ui/input-password/input-password.js.map +1 -0
  37. package/dist/components/ui/input-text/input-text.js +9 -9
  38. package/dist/components/ui/input-text/input-text.js.map +1 -1
  39. package/dist/components/ui/line-chart/line-chart.js +206 -0
  40. package/dist/components/ui/line-chart/line-chart.js.map +1 -0
  41. package/dist/components/ui/link/link.js +5 -5
  42. package/dist/components/ui/link/link.js.map +1 -1
  43. package/dist/components/ui/loading/loading.js +79 -0
  44. package/dist/components/ui/loading/loading.js.map +1 -0
  45. package/dist/components/ui/meter/meter.js +93 -0
  46. package/dist/components/ui/meter/meter.js.map +1 -0
  47. package/dist/components/ui/metric/metric.js +185 -0
  48. package/dist/components/ui/metric/metric.js.map +1 -0
  49. package/dist/components/ui/pie-chart/pie-chart.js +113 -0
  50. package/dist/components/ui/pie-chart/pie-chart.js.map +1 -0
  51. package/dist/components/ui/popover/popover.js +57 -27
  52. package/dist/components/ui/popover/popover.js.map +1 -1
  53. package/dist/components/ui/radar-chart/radar-chart.js +74 -0
  54. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -0
  55. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +69 -0
  56. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -0
  57. package/dist/components/ui/scatter-chart/scatter-chart.js +102 -0
  58. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -0
  59. package/dist/components/ui/search/search.js +16 -16
  60. package/dist/components/ui/search/search.js.map +1 -1
  61. package/dist/components/ui/sheet/sheet-details.js +16 -16
  62. package/dist/components/ui/sheet/sheet-details.js.map +1 -1
  63. package/dist/components/ui/spinner/spinner.js.map +1 -1
  64. package/dist/components/ui/timeline/timeline.js +175 -0
  65. package/dist/components/ui/timeline/timeline.js.map +1 -0
  66. package/dist/components/ui/treemap/treemap.js +83 -0
  67. package/dist/components/ui/treemap/treemap.js.map +1 -0
  68. package/dist/components/ui/trend-indicator/trend-indicator.js +97 -0
  69. package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -0
  70. package/dist/index.js +423 -384
  71. package/dist/index.js.map +1 -1
  72. package/dist/react.js +423 -384
  73. package/dist/react.js.map +1 -1
  74. package/dist/src/components/ui/area-chart/area-chart.d.ts +49 -0
  75. package/dist/src/components/ui/area-chart/index.d.ts +1 -0
  76. package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
  77. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +42 -2
  78. package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
  79. package/dist/src/components/ui/button-icon-input/button-icon-input.d.ts +21 -0
  80. package/dist/src/components/ui/button-icon-input/index.d.ts +1 -0
  81. package/dist/src/components/ui/card-filter/card-filter.d.ts +5 -0
  82. package/dist/src/components/ui/chart-state/chart-state.d.ts +11 -0
  83. package/dist/src/components/ui/chart-state/index.d.ts +1 -0
  84. package/dist/src/components/ui/composed-chart/composed-chart.d.ts +48 -0
  85. package/dist/src/components/ui/composed-chart/index.d.ts +1 -0
  86. package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +79 -0
  87. package/dist/src/components/ui/confidence-cone/index.d.ts +1 -0
  88. package/dist/src/components/ui/dialog/dialog.d.ts +105 -9
  89. package/dist/src/components/ui/dialog/dialog.docs.d.ts +82 -5
  90. package/dist/src/components/ui/dialog/index.d.ts +1 -1
  91. package/dist/src/components/ui/dialog-footer-default/dialog-footer-default.d.ts +11 -0
  92. package/dist/src/components/ui/dialog-footer-default/index.d.ts +1 -0
  93. package/dist/src/components/ui/filter-search/filter-search.d.ts +1 -1
  94. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +39 -0
  95. package/dist/src/components/ui/funnel-chart/index.d.ts +1 -0
  96. package/dist/src/components/ui/histogram/histogram.d.ts +55 -0
  97. package/dist/src/components/ui/histogram/index.d.ts +1 -0
  98. package/dist/src/components/ui/input-otp/index.d.ts +1 -0
  99. package/dist/src/components/ui/input-otp/input-otp.d.ts +23 -0
  100. package/dist/src/components/ui/input-password/index.d.ts +1 -0
  101. package/dist/src/components/ui/input-password/input-password.d.ts +21 -0
  102. package/dist/src/components/ui/line-chart/index.d.ts +1 -0
  103. package/dist/src/components/ui/line-chart/line-chart.d.ts +83 -0
  104. package/dist/src/components/ui/loading/index.d.ts +1 -0
  105. package/dist/src/components/ui/loading/loading.d.ts +13 -0
  106. package/dist/src/components/ui/meter/index.d.ts +1 -0
  107. package/dist/src/components/ui/meter/meter.d.ts +25 -0
  108. package/dist/src/components/ui/metric/index.d.ts +1 -0
  109. package/dist/src/components/ui/metric/metric.d.ts +37 -0
  110. package/dist/src/components/ui/pie-chart/index.d.ts +1 -0
  111. package/dist/src/components/ui/pie-chart/pie-chart.d.ts +54 -0
  112. package/dist/src/components/ui/popover/index.d.ts +1 -1
  113. package/dist/src/components/ui/popover/popover.d.ts +13 -1
  114. package/dist/src/components/ui/radar-chart/index.d.ts +1 -0
  115. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +40 -0
  116. package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -0
  117. package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +45 -0
  118. package/dist/src/components/ui/scatter-chart/index.d.ts +1 -0
  119. package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +50 -0
  120. package/dist/src/components/ui/stack/stack.d.ts +1 -1
  121. package/dist/src/components/ui/timeline/index.d.ts +1 -0
  122. package/dist/src/components/ui/timeline/timeline.d.ts +41 -0
  123. package/dist/src/components/ui/treemap/index.d.ts +1 -0
  124. package/dist/src/components/ui/treemap/treemap.d.ts +44 -0
  125. package/dist/src/components/ui/trend-indicator/index.d.ts +1 -0
  126. package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +32 -0
  127. package/dist/src/index.d.ts +22 -2
  128. package/dist/ui-react.css +1 -1
  129. package/package.json +3 -3
@@ -0,0 +1,185 @@
1
+ import { jsxs as t, jsx as e, Fragment as k } from "react/jsx-runtime";
2
+ import * as n from "react";
3
+ import { cva as S } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
4
+ import { CircleInfoIcon as I } from "@acronis-platform/icons-react/stroke-mono";
5
+ import { cn as a } from "../../../lib/utils.js";
6
+ import { Card as _ } from "../card/card.js";
7
+ import { Tooltip as z, TooltipTrigger as T, TooltipContent as A } from "../tooltip/tooltip.js";
8
+ import { Skeleton as Z } from "../skeleton/skeleton.js";
9
+ const j = S("flex flex-col", {
10
+ variants: {
11
+ size: {
12
+ small: "gap-1",
13
+ medium: "gap-1.5",
14
+ large: "gap-2"
15
+ },
16
+ // Semantic status — drives the icon badge tint (see STATUS_BADGE). Kept as a
17
+ // cva axis so the enum is spec-conformant; the tint is applied on the badge.
18
+ status: {
19
+ neutral: "",
20
+ info: "",
21
+ success: "",
22
+ warning: "",
23
+ danger: "",
24
+ critical: ""
25
+ }
26
+ },
27
+ defaultVariants: {
28
+ size: "medium",
29
+ status: "neutral"
30
+ }
31
+ }), y = {
32
+ small: "text-[10px]",
33
+ medium: "text-[11px]",
34
+ large: "text-xs"
35
+ }, B = {
36
+ small: "text-2xl",
37
+ medium: "text-3xl",
38
+ large: "text-4xl"
39
+ }, C = {
40
+ small: "text-sm",
41
+ medium: "text-base",
42
+ large: "text-lg"
43
+ }, G = {
44
+ small: "text-xs",
45
+ medium: "text-xs",
46
+ large: "text-sm"
47
+ }, L = {
48
+ small: "size-7",
49
+ medium: "size-8",
50
+ large: "size-10"
51
+ }, U = {
52
+ small: 14,
53
+ medium: 16,
54
+ large: 20
55
+ }, V = {
56
+ small: "h-6 w-16",
57
+ medium: "h-8 w-20",
58
+ large: "h-10 w-28"
59
+ }, D = {
60
+ neutral: "bg-[var(--ui-background-status-neutral-pressed)] text-[var(--ui-text-on-status-neutral)]",
61
+ info: "bg-[var(--ui-background-status-info-pressed)] text-[var(--ui-text-on-status-info)]",
62
+ success: "bg-[var(--ui-background-status-success-pressed)] text-[var(--ui-text-on-status-success)]",
63
+ warning: "bg-[var(--ui-background-status-warning-pressed)] text-[var(--ui-text-on-status-warning)]",
64
+ danger: "bg-[var(--ui-background-status-danger-pressed)] text-[var(--ui-text-on-status-danger)]",
65
+ critical: "bg-[var(--ui-background-status-critical-pressed)] text-[var(--ui-text-on-status-critical)]"
66
+ }, M = n.forwardRef(
67
+ ({
68
+ className: f,
69
+ label: p,
70
+ value: h,
71
+ unit: l,
72
+ caption: i,
73
+ trend: c,
74
+ supportingText: m,
75
+ badge: d,
76
+ icon: r,
77
+ tooltip: u,
78
+ tooltipLabel: v = "More information",
79
+ loading: N = !1,
80
+ size: o,
81
+ status: x,
82
+ children: b,
83
+ ...w
84
+ }, E) => {
85
+ const s = o ?? "medium", g = x ?? "neutral";
86
+ return /* @__PURE__ */ t(
87
+ _,
88
+ {
89
+ ref: E,
90
+ "data-size": s,
91
+ "data-status": g,
92
+ className: a("flex flex-col p-4", f),
93
+ ...w,
94
+ children: [
95
+ /* @__PURE__ */ t("div", { className: a(j({ size: o, status: x })), children: [
96
+ /* @__PURE__ */ t("div", { className: "flex items-center justify-between gap-2", children: [
97
+ /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5", children: [
98
+ /* @__PURE__ */ e(
99
+ "span",
100
+ {
101
+ className: a(
102
+ "min-w-0 truncate font-bold uppercase leading-none tracking-wide text-muted-foreground",
103
+ y[s]
104
+ ),
105
+ children: p
106
+ }
107
+ ),
108
+ u != null && /* @__PURE__ */ t(z, { children: [
109
+ /* @__PURE__ */ e(
110
+ T,
111
+ {
112
+ "aria-label": v,
113
+ className: "inline-flex shrink-0 cursor-default appearance-none border-0 bg-transparent p-0 text-muted-foreground",
114
+ children: /* @__PURE__ */ e(I, { size: 16, "aria-hidden": !0 })
115
+ }
116
+ ),
117
+ /* @__PURE__ */ e(A, { children: u })
118
+ ] })
119
+ ] }),
120
+ i != null && /* @__PURE__ */ e("div", { className: "shrink-0", children: i })
121
+ ] }),
122
+ /* @__PURE__ */ t("div", { className: "flex items-center justify-between gap-3", children: [
123
+ /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-2", children: [
124
+ r != null && /* @__PURE__ */ e(
125
+ "span",
126
+ {
127
+ "aria-hidden": !0,
128
+ className: a(
129
+ "flex shrink-0 items-center justify-center rounded-lg [&_svg]:shrink-0",
130
+ L[s],
131
+ D[g]
132
+ ),
133
+ children: n.isValidElement(r) ? n.cloneElement(
134
+ r,
135
+ { size: U[s] }
136
+ ) : r
137
+ }
138
+ ),
139
+ /* @__PURE__ */ t("div", { className: "flex min-w-0 items-baseline gap-1", children: [
140
+ N ? /* @__PURE__ */ e(Z, { className: V[s] }) : /* @__PURE__ */ t(k, { children: [
141
+ /* @__PURE__ */ e(
142
+ "span",
143
+ {
144
+ className: a(
145
+ "font-bold leading-none tabular-nums text-foreground",
146
+ B[s]
147
+ ),
148
+ children: h
149
+ }
150
+ ),
151
+ l != null && /* @__PURE__ */ e(
152
+ "span",
153
+ {
154
+ className: a(
155
+ "font-medium text-muted-foreground",
156
+ C[s]
157
+ ),
158
+ children: l
159
+ }
160
+ )
161
+ ] }),
162
+ d != null && /* @__PURE__ */ e("span", { className: "ms-1 self-center", children: d })
163
+ ] })
164
+ ] }),
165
+ c != null && /* @__PURE__ */ e("div", { className: "shrink-0", children: c })
166
+ ] }),
167
+ m != null && /* @__PURE__ */ e(
168
+ "div",
169
+ {
170
+ className: a("text-muted-foreground", G[s]),
171
+ children: m
172
+ }
173
+ )
174
+ ] }),
175
+ b
176
+ ]
177
+ }
178
+ );
179
+ }
180
+ );
181
+ M.displayName = "Metric";
182
+ export {
183
+ M as Metric
184
+ };
185
+ //# sourceMappingURL=metric.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metric.js","sources":["../../../../src/components/ui/metric/metric.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { CircleInfoIcon } from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { Card } from '../card';\nimport { Skeleton } from '../skeleton';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';\n\n// A presentational metric / statistic, laid out after the Figma MetricCard node:\n// a label row (label + an optional top-right caption) over a value row (an\n// optional status-tinted icon badge + the value + unit on the left, an optional\n// trend on the right), with optional supporting text below. It owns visual\n// hierarchy and layout only — it never computes or formats the value, converts\n// units, or decides whether a value is good or bad; the consumer passes\n// ready-to-render nodes and a resolved `status`, and composes a `TrendIndicator`\n// into the trend slot. `status` tints the icon badge (a subtle cue, not a full\n// color fill). No dedicated token tier — colors are semantic `--ui-*` tokens and\n// geometry uses the Tailwind scale.\nconst metricVariants = cva('flex flex-col', {\n variants: {\n size: {\n small: 'gap-1',\n medium: 'gap-1.5',\n large: 'gap-2',\n },\n // Semantic status — drives the icon badge tint (see STATUS_BADGE). Kept as a\n // cva axis so the enum is spec-conformant; the tint is applied on the badge.\n status: {\n neutral: '',\n info: '',\n success: '',\n warning: '',\n danger: '',\n critical: '',\n },\n },\n defaultVariants: {\n size: 'medium',\n status: 'neutral',\n },\n});\n\nconst LABEL_SIZE = {\n small: 'text-[10px]',\n medium: 'text-[11px]',\n large: 'text-xs',\n} as const;\n\nconst VALUE_SIZE = {\n small: 'text-2xl',\n medium: 'text-3xl',\n large: 'text-4xl',\n} as const;\n\nconst UNIT_SIZE = {\n small: 'text-sm',\n medium: 'text-base',\n large: 'text-lg',\n} as const;\n\nconst SUPPORTING_SIZE = {\n small: 'text-xs',\n medium: 'text-xs',\n large: 'text-sm',\n} as const;\n\nconst BADGE_SIZE = {\n small: 'size-7',\n medium: 'size-8',\n large: 'size-10',\n} as const;\n\n// icons-react icons size themselves from a `size` prop (which also picks the\n// designed stroke weight) — CSS can't do that reliably — so the badge icon is\n// cloned to the right px for the Metric size.\nconst BADGE_ICON_PX = {\n small: 14,\n medium: 16,\n large: 20,\n} as const;\n\nconst SKELETON_SIZE = {\n small: 'h-6 w-16',\n medium: 'h-8 w-20',\n large: 'h-10 w-28',\n} as const;\n\n// The badge pairs the status \"pressed\" background tint with its matching icon\n// color (the same pairing the design uses for status icon chips).\nconst STATUS_BADGE = {\n neutral:\n 'bg-[var(--ui-background-status-neutral-pressed)] text-[var(--ui-text-on-status-neutral)]',\n info: 'bg-[var(--ui-background-status-info-pressed)] text-[var(--ui-text-on-status-info)]',\n success:\n 'bg-[var(--ui-background-status-success-pressed)] text-[var(--ui-text-on-status-success)]',\n warning:\n 'bg-[var(--ui-background-status-warning-pressed)] text-[var(--ui-text-on-status-warning)]',\n danger:\n 'bg-[var(--ui-background-status-danger-pressed)] text-[var(--ui-text-on-status-danger)]',\n critical:\n 'bg-[var(--ui-background-status-critical-pressed)] text-[var(--ui-text-on-status-critical)]',\n} as const;\n\nexport interface MetricProps\n extends React.ComponentProps<'div'>,\n VariantProps<typeof metricVariants> {\n /** What the value measures — e.g. \"Gross margin\". Rendered as an uppercase note heading. */\n label: React.ReactNode;\n /**\n * The primary value, already formatted (`73`, `\"94%\"`, `\"$72K\"`, `\"2.8\"`).\n * The kit does not format currency, units, or decimals.\n */\n value: React.ReactNode;\n /** Unit shown next to the value at a smaller, muted size — e.g. `\"%\"`, `\"hours\"`. */\n unit?: React.ReactNode;\n /** A top-right caption aligned with the label — e.g. a timeframe `Tag` (\"Last 30 days\"). */\n caption?: React.ReactNode;\n /** A trend slot on the right of the value — typically a `TrendIndicator`. */\n trend?: React.ReactNode;\n /** Secondary line below the value — e.g. \"Target: 99%\". */\n supportingText?: React.ReactNode;\n /** A small badge / metadata slot beside the value — e.g. a `Tag`. */\n badge?: React.ReactNode;\n /** Icon rendered in a status-tinted badge before the value. */\n icon?: React.ReactNode;\n /** Contextual hint on an info affordance next to the label (Base UI Tooltip). */\n tooltip?: React.ReactNode;\n /** Accessible name for the info affordance that reveals `tooltip`. */\n tooltipLabel?: string;\n /** Show a skeleton in place of the value, preserving its space. */\n loading?: boolean;\n /** Card body below the header — e.g. a chart, a Separator, an insight line. */\n children?: React.ReactNode;\n}\n\nconst Metric = React.forwardRef<HTMLDivElement, MetricProps>(\n (\n {\n className,\n label,\n value,\n unit,\n caption,\n trend,\n supportingText,\n badge,\n icon,\n tooltip,\n tooltipLabel = 'More information',\n loading = false,\n size,\n status,\n children,\n ...props\n },\n ref\n ) => {\n const resolvedSize = size ?? 'medium';\n const resolvedStatus = status ?? 'neutral';\n\n return (\n <Card\n ref={ref}\n data-size={resolvedSize}\n data-status={resolvedStatus}\n className={cn('flex flex-col p-4', className)}\n {...props}\n >\n <div className={cn(metricVariants({ size, status }))}>\n {/* Label row: label (+ optional info) on the left, caption on the right. */}\n <div className=\"flex items-center justify-between gap-2\">\n <div className=\"flex min-w-0 items-center gap-1.5\">\n <span\n className={cn(\n 'min-w-0 truncate font-bold uppercase leading-none tracking-wide text-muted-foreground',\n LABEL_SIZE[resolvedSize]\n )}\n >\n {label}\n </span>\n {tooltip != null && (\n <Tooltip>\n <TooltipTrigger\n aria-label={tooltipLabel}\n className=\"inline-flex shrink-0 cursor-default appearance-none border-0 bg-transparent p-0 text-muted-foreground\"\n >\n <CircleInfoIcon size={16} aria-hidden />\n </TooltipTrigger>\n <TooltipContent>{tooltip}</TooltipContent>\n </Tooltip>\n )}\n </div>\n {caption != null && <div className=\"shrink-0\">{caption}</div>}\n </div>\n\n {/* Value row: badge + value + unit on the left, trend on the right. */}\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n {icon != null && (\n <span\n aria-hidden\n className={cn(\n 'flex shrink-0 items-center justify-center rounded-lg [&_svg]:shrink-0',\n BADGE_SIZE[resolvedSize],\n STATUS_BADGE[resolvedStatus]\n )}\n >\n {React.isValidElement(icon)\n ? React.cloneElement(\n icon as React.ReactElement<{ size?: number }>,\n { size: BADGE_ICON_PX[resolvedSize] }\n )\n : icon}\n </span>\n )}\n <div className=\"flex min-w-0 items-baseline gap-1\">\n {loading ? (\n <Skeleton className={SKELETON_SIZE[resolvedSize]} />\n ) : (\n <>\n <span\n className={cn(\n 'font-bold leading-none tabular-nums text-foreground',\n VALUE_SIZE[resolvedSize]\n )}\n >\n {value}\n </span>\n {unit != null && (\n <span\n className={cn(\n 'font-medium text-muted-foreground',\n UNIT_SIZE[resolvedSize]\n )}\n >\n {unit}\n </span>\n )}\n </>\n )}\n {badge != null && <span className=\"ms-1 self-center\">{badge}</span>}\n </div>\n </div>\n {trend != null && <div className=\"shrink-0\">{trend}</div>}\n </div>\n\n {supportingText != null && (\n <div\n className={cn('text-muted-foreground', SUPPORTING_SIZE[resolvedSize])}\n >\n {supportingText}\n </div>\n )}\n </div>\n {children}\n </Card>\n );\n }\n);\nMetric.displayName = 'Metric';\n\nexport { Metric };\n"],"names":["metricVariants","cva","LABEL_SIZE","VALUE_SIZE","UNIT_SIZE","SUPPORTING_SIZE","BADGE_SIZE","BADGE_ICON_PX","SKELETON_SIZE","STATUS_BADGE","Metric","React","className","label","value","unit","caption","trend","supportingText","badge","icon","tooltip","tooltipLabel","loading","size","status","children","props","ref","resolvedSize","resolvedStatus","jsxs","Card","cn","jsx","Tooltip","TooltipTrigger","CircleInfoIcon","TooltipContent","Skeleton","Fragment"],"mappings":";;;;;;;;AAqBA,MAAMA,IAAiBC,EAAI,iBAAiB;AAAA,EAC1C,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,IAAA;AAAA;AAAA;AAAA,IAIT,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,IAAA;AAAA,EACZ;AAAA,EAEF,iBAAi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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,IACf,OAAO;AAAA,EAAA;AAEX,CAAC,GA2DKC,IAAqB,IAErBC,IAAWC,EAAM;AAAA,EACrB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC;AA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AK,GAAG,IAAAC,IAAK,MAAMF,GAQrBG,IACJD,KAAMnB,IAAad,IAAqB,IAAI,IACxCmC,IAAW1B,EAAY,SAAS,MAChC2B,IAAW3B,EAAY,SAAS,MAGhC4B,IAAOF,KAAYC;AACzB,+CACG,KAAA,EACE,UAAA;AAAA,wBAAAD,KACC,gBAAAhB;AAAA,0BAAC;AAAA,0BAAA;AAAA,4BACC,GAAGa;AAAA,4BACH,GAAGK,IAAOH,IAAU,KAAKA;AAAA,4BACzB,YAAW;AAAA,4BACX,kBAAiB;AAAA,4BACjB,WAAU;AAAA,4BAET,UAAAzB,EAAY;AAAA,0BAAA;AAAA,wBAAA;AAAA,wBAGhB2B,KACC,gBAAAjB;AAAA,0BAAC;AAAA,0BAAA;AAAA,4BACC,GAAGa;AAAA,4BACH,GAAGK,IAAOH,IAAU,KAAKA;AAAA,4BACzB,YAAW;AAAA,4BACX,kBAAiB;AAAA,4BACjB,WAAU;AAAA,4BAET,UAAAzB,EAAY;AAAA,0BAAA;AAAA,wBAAA;AAAA,sBACf,GAEJ;AAAA,oBAEJ;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA;AAAA,UAGHK,KACC,gBAAAK,EAACmB,GAAA,EAAY,SAAS,gBAAAnB,EAACoB,GAAA,EAAmB,SAAAhC,GAAkB,EAAA,CAAI;AAAA,QAAA,EAAA,CAEpE,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACAN,EAAS,cAAc;"}
@@ -1,49 +1,79 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import * as P from "react";
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import * as i from "react";
3
3
  import { Popover as o } from "@base-ui/react/popover";
4
- import { cn as u } from "../../../lib/utils.js";
5
- import { usePortalContainer as g } from "../../../lib/portal-container.js";
6
- const w = o.Root, z = o.Trigger, N = o.Portal, b = P.forwardRef(
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: a = "bottom",
10
- align: n = "center",
11
- sideOffset: d = 4,
12
- portal: i = !0,
9
+ side: e = "bottom",
10
+ align: t = "center",
11
+ sideOffset: p = 4,
12
+ portal: l = !0,
13
13
  portalContainer: s,
14
- keepMounted: m,
15
- ...p
16
- }, c) => {
17
- const l = g(), f = s ?? l, e = /* @__PURE__ */ t(
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: a,
21
- align: n,
22
- sideOffset: d,
20
+ side: e,
21
+ align: t,
22
+ sideOffset: p,
23
23
  className: "z-50",
24
- children: /* @__PURE__ */ t(
24
+ children: /* @__PURE__ */ a(
25
25
  o.Popup,
26
26
  {
27
- ref: c,
28
- className: u(
29
- "w-72 rounded-md border border-border bg-background p-4 text-foreground shadow-md outline-none",
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
- ...p
34
+ ...c
35
35
  }
36
36
  )
37
37
  }
38
38
  );
39
- return i ? /* @__PURE__ */ t(o.Portal, { container: f, keepMounted: m, children: e }) : e;
39
+ return l ? /* @__PURE__ */ a(o.Portal, { container: u, keepMounted: v, children: n }) : n;
40
40
  }
41
41
  );
42
- b.displayName = "PopoverContent";
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
- w as Popover,
45
- b as PopoverContent,
46
- N as PopoverPortal,
47
- z as PopoverTrigger
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). No\n// `--ui-popover-*` token tier exists yet, so this design-pending v1 themes from\n// the shared semantic tokens:\n// • surface -> bg-background (--ui-background-surface-primary) (legacy `bg-popover`)\n// • text -> text-foreground (--ui-text-on-surface-primary) (legacy `text-popover-foreground`)\n// • border -> border-border (--ui-border-on-surface-border) (legacy bare `border`)\n// Enter/exit animations use `tw-animate-css` keyed to Base UI's data-[open] /\n// data-[closed] / data-[side] attributes. Reconcile (and a possible\n// `--ui-popover-*` tier) with `/figma-component Popover <url> --update`.\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 'w-72 rounded-md border border-border bg-background p-4 text-foreground shadow-md 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\nexport { Popover, PopoverTrigger, PopoverPortal, PopoverContent };\n"],"names":["Popover","PopoverPrimitive","PopoverTrigger","PopoverPortal","PopoverContent","React","className","side","align","sideOffset","portal","portalContainer","keepMounted","props","ref","ctxContainer","usePortalContainer","resolvedContainer","positioner","jsx","cn"],"mappings":";;;;;AAmBA,MAAMA,IAAUC,EAAiB,MAE3BC,IAAiBD,EAAiB,SAElCE,IAAgBF,EAAiB,QAwBjCG,IAAiBC,EAAM;AAAA,EAI3B,CACE;AAAA,IACE,WAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,OAAAC,IAAQ;AAAA,IACR,YAAAC,IAAa;AAAA,IACb,QAAAC,IAAS;AAAA,IACT,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAeC,EAAA,GACfC,IAAoBN,KAAmBI,GAEvCG,IACJ,gBAAAC;AAAA,MAAClB,EAAiB;AAAA,MAAjB;AAAA,QACC,MAAAM;AAAA,QACA,OAAAC;AAAA,QACA,YAAAC;AAAA,QACA,WAAU;AAAA,QAEV,UAAA,gBAAAU;AAAA,UAAClB,EAAiB;AAAA,UAAjB;AAAA,YACC,KAAAa;AAAA,YACA,WAAWM;AAAA,cACT;AAAA,cACA;AAAA,cACA;AAAA,cACAd;AAAA,YAAA;AAAA,YAED,GAAGO;AAAA,UAAA;AAAA,QAAA;AAAA,MACN;AAAA,IAAA;AAIJ,WAAOH,sBACJT,EAAiB,QAAjB,EAAwB,WAAWgB,GAAmB,aAAAL,GACpD,UAAAM,EAAA,CACH,IAEAA;AAAA,EAEJ;AACF;AACAd,EAAe,cAAc;"}
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"],"mappings":";;;;;AAoBA,MAAMA,IAAUC,EAAiB,MAE3BC,IAAiBD,EAAiB,SAElCE,IAAgBF,EAAiB,QAwBjCG,IAAiBC,EAAM;AAAA,EAI3B,CACE;AAAA,IACE,WAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,OAAAC,IAAQ;AAAA,IACR,YAAAC,IAAa;AAAA,IACb,QAAAC,IAAS;AAAA,IACT,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAeC,EAAA,GACfC,IAAoBN,KAAmBI,GAEvCG,IACJ,gBAAAC;AAAA,MAAClB,EAAiB;AAAA,MAAjB;AAAA,QACC,MAAAM;AAAA,QACA,OAAAC;AAAA,QACA,YAAAC;AAAA,QACA,WAAU;AAAA,QAEV,UAAA,gBAAAU;AAAA,UAAClB,EAAiB;AAAA,UAAjB;AAAA,YACC,KAAAa;AAAA,YACA,WAAWM;AAAA,cACT;AAAA,cACA;AAAA,cACA;AAAA,cACAd;AAAA,YAAA;AAAA,YAED,GAAGO;AAAA,UAAA;AAAA,QAAA;AAAA,MACN;AAAA,IAAA;AAIJ,WAAOH,sBACJT,EAAiB,QAAjB,EAAwB,WAAWgB,GAAmB,aAAAL,GACpD,UAAAM,EAAA,CACH,IAEAA;AAAA,EAEJ;AACF;AACAd,EAAe,cAAc;AAQ7B,MAAMiB,IAAchB,EAAM;AAAA,EACxB,CAAC,EAAE,WAAAC,GAAW,GAAGO,EAAA,GAASC,MACxB,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAL;AAAA,MACA,WAAWM;AAAA,QACT;AAAA,QACAd;AAAA,MAAA;AAAA,MAED,GAAGO;AAAA,IAAA;AAAA,EAAA;AAGV;AACAQ,EAAY,cAAc;AAM1B,MAAMC,IAAgBjB,EAAM;AAAA,EAC1B,CAAC,EAAE,WAAAC,GAAW,GAAGO,EAAA,GAASC,MACxB,gBAAAK;AAAA,IAAC;AAAA,IAAA;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;AAAA,MACT,QAAQ;AAAA,IAAA;AAAA,EACV;AAAA,EAEF,iBAAiB;AAAA,IACf,UAAU;AAAA,EAAA;AAEd,CAAC,GAqCKC,IAAaC,EAAM;AAAA,EACvB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,aAAAC,IAAc;AAAA,IACd,aAAAC,IAAc;AAAA,IACd,UAAAC,IAAW;AAAA,IACX,UAAAC,IAAW;AAAA,IACX,aAAAC,IAAc;AAAA,IACd,YAAAC,IAAa;AAAA,IACb,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MAGE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,kBAAgBT;AAAA,MAChB,WAAWW,EAAGpB,EAAmB,EAAE,UAAAS,EAAA,CAAU,GAAGL,CAAS;AAAA,MACxD,GAAGa;AAAA,MAEJ,UAAA,gBAAAE;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,QAAAhB;AAAA,UAMA,WAAU;AAAA,UAEV,UAAA,gBAAAiB,EAACC,KAAmB,MAAAjB,GACjB,UAAA;AAAA,YAAAQ,uBACEU,GAAA,EAAa,SAASR,KAAkB,gBAAAG,EAACM,KAAoB,GAAI;AAAA,YAEnEZ,KAAY,gBAAAM,EAACO,GAAA,EAAU,UAAUjB,KAAY,WAAW;AAAA,YACzD,gBAAAU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