@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.
Files changed (170) hide show
  1. package/dist/components/ui/area-chart/area-chart.js +177 -0
  2. package/dist/components/ui/area-chart/area-chart.js.map +1 -0
  3. package/dist/components/ui/bar-chart/bar-chart.js +184 -78
  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/calendar/calendar.js +17 -15
  10. package/dist/components/ui/calendar/calendar.js.map +1 -1
  11. package/dist/components/ui/card-filter/card-filter.js +40 -27
  12. package/dist/components/ui/card-filter/card-filter.js.map +1 -1
  13. package/dist/components/ui/carousel-dialog/carousel-dialog.js +87 -0
  14. package/dist/components/ui/carousel-dialog/carousel-dialog.js.map +1 -0
  15. package/dist/components/ui/category-bar/category-bar.js +126 -0
  16. package/dist/components/ui/category-bar/category-bar.js.map +1 -0
  17. package/dist/components/ui/chart/chart-format.js +40 -0
  18. package/dist/components/ui/chart/chart-format.js.map +1 -0
  19. package/dist/components/ui/chart/chart.js.map +1 -1
  20. package/dist/components/ui/chart-state/chart-state.js +42 -0
  21. package/dist/components/ui/chart-state/chart-state.js.map +1 -0
  22. package/dist/components/ui/chip/chip.js +13 -13
  23. package/dist/components/ui/chip/chip.js.map +1 -1
  24. package/dist/components/ui/composed-chart/composed-chart.js +135 -0
  25. package/dist/components/ui/composed-chart/composed-chart.js.map +1 -0
  26. package/dist/components/ui/confidence-cone/confidence-cone.js +223 -0
  27. package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -0
  28. package/dist/components/ui/date-range-picker/date-range-picker.js +21 -21
  29. package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
  30. package/dist/components/ui/dialog/dialog.js +248 -76
  31. package/dist/components/ui/dialog/dialog.js.map +1 -1
  32. package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js +57 -0
  33. package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js.map +1 -0
  34. package/dist/components/ui/dialog-footer-default/dialog-footer-default.js +26 -0
  35. package/dist/components/ui/dialog-footer-default/dialog-footer-default.js.map +1 -0
  36. package/dist/components/ui/dialog-welcome/dialog-welcome.js +272 -0
  37. package/dist/components/ui/dialog-welcome/dialog-welcome.js.map +1 -0
  38. package/dist/components/ui/dropdown-menu/dropdown-menu.js +21 -21
  39. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  40. package/dist/components/ui/filter-search/filter-search.js +91 -90
  41. package/dist/components/ui/filter-search/filter-search.js.map +1 -1
  42. package/dist/components/ui/funnel-chart/funnel-chart.js +87 -0
  43. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -0
  44. package/dist/components/ui/histogram/histogram.js +136 -0
  45. package/dist/components/ui/histogram/histogram.js.map +1 -0
  46. package/dist/components/ui/input/input.js.map +1 -1
  47. package/dist/components/ui/input-otp/input-otp.js +104 -0
  48. package/dist/components/ui/input-otp/input-otp.js.map +1 -0
  49. package/dist/components/ui/input-password/input-password.js +120 -0
  50. package/dist/components/ui/input-password/input-password.js.map +1 -0
  51. package/dist/components/ui/input-text/input-text.js +9 -9
  52. package/dist/components/ui/input-text/input-text.js.map +1 -1
  53. package/dist/components/ui/line-chart/line-chart.js +234 -0
  54. package/dist/components/ui/line-chart/line-chart.js.map +1 -0
  55. package/dist/components/ui/link/link.js +5 -5
  56. package/dist/components/ui/link/link.js.map +1 -1
  57. package/dist/components/ui/loading/loading.js +79 -0
  58. package/dist/components/ui/loading/loading.js.map +1 -0
  59. package/dist/components/ui/meter/meter.js +93 -0
  60. package/dist/components/ui/meter/meter.js.map +1 -0
  61. package/dist/components/ui/metric/metric.js +185 -0
  62. package/dist/components/ui/metric/metric.js.map +1 -0
  63. package/dist/components/ui/pie-chart/pie-chart.js +113 -0
  64. package/dist/components/ui/pie-chart/pie-chart.js.map +1 -0
  65. package/dist/components/ui/popover/popover.js +57 -27
  66. package/dist/components/ui/popover/popover.js.map +1 -1
  67. package/dist/components/ui/radar-chart/radar-chart.js +74 -0
  68. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -0
  69. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +69 -0
  70. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -0
  71. package/dist/components/ui/sankey-chart/sankey-chart.js +192 -0
  72. package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -0
  73. package/dist/components/ui/scatter-chart/scatter-chart.js +130 -0
  74. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -0
  75. package/dist/components/ui/search/search.js +16 -16
  76. package/dist/components/ui/search/search.js.map +1 -1
  77. package/dist/components/ui/sheet/sheet-details.js +16 -16
  78. package/dist/components/ui/sheet/sheet-details.js.map +1 -1
  79. package/dist/components/ui/spinner/spinner.js.map +1 -1
  80. package/dist/components/ui/timeline/timeline.js +175 -0
  81. package/dist/components/ui/timeline/timeline.js.map +1 -0
  82. package/dist/components/ui/toolbar/toolbar.js +82 -92
  83. package/dist/components/ui/toolbar/toolbar.js.map +1 -1
  84. package/dist/components/ui/treemap/treemap.js +83 -0
  85. package/dist/components/ui/treemap/treemap.js.map +1 -0
  86. package/dist/components/ui/trend-indicator/trend-indicator.js +97 -0
  87. package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -0
  88. package/dist/index.js +461 -400
  89. package/dist/index.js.map +1 -1
  90. package/dist/lib/breakpoints.js +9 -6
  91. package/dist/lib/breakpoints.js.map +1 -1
  92. 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
  93. 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
  94. 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
  95. 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
  96. package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js +1205 -0
  97. package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js.map +1 -0
  98. package/dist/react.js +461 -400
  99. package/dist/react.js.map +1 -1
  100. package/dist/src/components/ui/area-chart/area-chart.d.ts +34 -0
  101. package/dist/src/components/ui/area-chart/index.d.ts +1 -0
  102. package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
  103. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +30 -5
  104. package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
  105. package/dist/src/components/ui/button-icon-input/button-icon-input.d.ts +21 -0
  106. package/dist/src/components/ui/button-icon-input/index.d.ts +1 -0
  107. package/dist/src/components/ui/card-filter/card-filter.d.ts +5 -0
  108. package/dist/src/components/ui/carousel-dialog/carousel-dialog.d.ts +28 -0
  109. package/dist/src/components/ui/carousel-dialog/index.d.ts +1 -0
  110. package/dist/src/components/ui/category-bar/category-bar.d.ts +51 -0
  111. package/dist/src/components/ui/category-bar/index.d.ts +1 -0
  112. package/dist/src/components/ui/chart/__tests__/chart-format.test.d.ts +1 -0
  113. package/dist/src/components/ui/chart/chart-format.d.ts +111 -0
  114. package/dist/src/components/ui/chart/chart.d.ts +2 -0
  115. package/dist/src/components/ui/chart/index.d.ts +3 -1
  116. package/dist/src/components/ui/chart-state/chart-state.d.ts +11 -0
  117. package/dist/src/components/ui/chart-state/index.d.ts +1 -0
  118. package/dist/src/components/ui/composed-chart/composed-chart.d.ts +33 -0
  119. package/dist/src/components/ui/composed-chart/index.d.ts +1 -0
  120. package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +62 -0
  121. package/dist/src/components/ui/confidence-cone/index.d.ts +1 -0
  122. package/dist/src/components/ui/dialog/dialog.d.ts +105 -9
  123. package/dist/src/components/ui/dialog/dialog.docs.d.ts +82 -5
  124. package/dist/src/components/ui/dialog/index.d.ts +1 -1
  125. package/dist/src/components/ui/dialog-footer-carousel/dialog-footer-carousel.d.ts +9 -0
  126. package/dist/src/components/ui/dialog-footer-carousel/index.d.ts +1 -0
  127. package/dist/src/components/ui/dialog-footer-default/dialog-footer-default.d.ts +11 -0
  128. package/dist/src/components/ui/dialog-footer-default/index.d.ts +1 -0
  129. package/dist/src/components/ui/dialog-welcome/dialog-welcome.d.ts +54 -0
  130. package/dist/src/components/ui/dialog-welcome/dialog-welcome.docs.d.ts +55 -0
  131. package/dist/src/components/ui/dialog-welcome/index.d.ts +1 -0
  132. package/dist/src/components/ui/filter-search/filter-search.d.ts +1 -1
  133. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +39 -0
  134. package/dist/src/components/ui/funnel-chart/index.d.ts +1 -0
  135. package/dist/src/components/ui/histogram/histogram.d.ts +40 -0
  136. package/dist/src/components/ui/histogram/index.d.ts +1 -0
  137. package/dist/src/components/ui/input-otp/index.d.ts +1 -0
  138. package/dist/src/components/ui/input-otp/input-otp.d.ts +23 -0
  139. package/dist/src/components/ui/input-password/index.d.ts +1 -0
  140. package/dist/src/components/ui/input-password/input-password.d.ts +21 -0
  141. package/dist/src/components/ui/line-chart/index.d.ts +1 -0
  142. package/dist/src/components/ui/line-chart/line-chart.d.ts +68 -0
  143. package/dist/src/components/ui/loading/index.d.ts +1 -0
  144. package/dist/src/components/ui/loading/loading.d.ts +13 -0
  145. package/dist/src/components/ui/meter/index.d.ts +1 -0
  146. package/dist/src/components/ui/meter/meter.d.ts +25 -0
  147. package/dist/src/components/ui/metric/index.d.ts +1 -0
  148. package/dist/src/components/ui/metric/metric.d.ts +37 -0
  149. package/dist/src/components/ui/pie-chart/index.d.ts +1 -0
  150. package/dist/src/components/ui/pie-chart/pie-chart.d.ts +54 -0
  151. package/dist/src/components/ui/popover/index.d.ts +1 -1
  152. package/dist/src/components/ui/popover/popover.d.ts +13 -1
  153. package/dist/src/components/ui/radar-chart/index.d.ts +1 -0
  154. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +40 -0
  155. package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -0
  156. package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +45 -0
  157. package/dist/src/components/ui/sankey-chart/index.d.ts +2 -0
  158. package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +69 -0
  159. package/dist/src/components/ui/scatter-chart/index.d.ts +1 -0
  160. package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +35 -0
  161. package/dist/src/components/ui/stack/stack.d.ts +1 -1
  162. package/dist/src/components/ui/timeline/index.d.ts +1 -0
  163. package/dist/src/components/ui/timeline/timeline.d.ts +41 -0
  164. package/dist/src/components/ui/treemap/index.d.ts +1 -0
  165. package/dist/src/components/ui/treemap/treemap.d.ts +44 -0
  166. package/dist/src/components/ui/trend-indicator/index.d.ts +1 -0
  167. package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +32 -0
  168. package/dist/src/index.d.ts +27 -2
  169. package/dist/ui-react.css +1 -1
  170. package/package.json +5 -4
@@ -0,0 +1,177 @@
1
+ import { jsx as t, jsxs as f } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { cva as Y } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
4
+ import { AreaChart as _, CartesianGrid as q, XAxis as E, YAxis as J, Area as P } from "recharts";
5
+ import { cn as Q } from "../../../lib/utils.js";
6
+ import { ChartContainer as U, ChartTooltip as W, ChartTooltipContent as Z, ChartLegend as b, ChartLegendContent as tt } from "../chart/chart.js";
7
+ import { resolveAxisDomain as at } from "../chart/chart-format.js";
8
+ const et = Y("", {
9
+ variants: {
10
+ layout: {
11
+ single: "",
12
+ stacked: ""
13
+ },
14
+ fill: {
15
+ solid: "",
16
+ gradient: ""
17
+ }
18
+ },
19
+ defaultVariants: {
20
+ layout: "single",
21
+ fill: "gradient"
22
+ }
23
+ }), rt = m.forwardRef(
24
+ ({
25
+ className: p,
26
+ config: h,
27
+ data: u,
28
+ dataKeys: l,
29
+ xKey: v,
30
+ xAxisLabel: r,
31
+ yAxisLabel: o,
32
+ yUnit: C,
33
+ layout: i = "single",
34
+ fill: n = "gradient",
35
+ curve: g = "monotone",
36
+ strokeWidth: $ = 2,
37
+ fillOpacity: y = 0.4,
38
+ showDots: d = !1,
39
+ connectNulls: k = !1,
40
+ showGrid: T = !0,
41
+ showTooltip: D = !0,
42
+ showLegend: G = !0,
43
+ showXAxis: I = !0,
44
+ showYAxis: N = !0,
45
+ xTickFormatter: O,
46
+ yTickFormatter: j,
47
+ xAxisAngle: e,
48
+ xAxisInterval: z,
49
+ yAxisTickCount: A,
50
+ yAxisDomain: F,
51
+ gridDashed: L,
52
+ gridHorizontal: R,
53
+ gridVertical: V,
54
+ tooltipContent: w,
55
+ ...x
56
+ }, B) => {
57
+ const H = i === "stacked", s = n === "gradient", K = r ? { value: r, position: "insideBottom", offset: 0 } : void 0, M = o ? {
58
+ value: o,
59
+ angle: -90,
60
+ position: "insideLeft",
61
+ style: { textAnchor: "middle" }
62
+ } : void 0, S = at(F), X = r || e != null ? 30 + (e != null ? 20 : 0) + (r ? 18 : 0) : void 0, c = `area-gradient-${m.useId().replace(/:/g, "")}`;
63
+ return /* @__PURE__ */ t(
64
+ "div",
65
+ {
66
+ ref: B,
67
+ "data-layout": i,
68
+ "data-fill": n,
69
+ className: Q(et({ layout: i, fill: n }), p),
70
+ ...x,
71
+ children: /* @__PURE__ */ t(
72
+ U,
73
+ {
74
+ config: h,
75
+ className: "size-full [&_.recharts-label]:fill-foreground",
76
+ children: /* @__PURE__ */ f(_, { data: u, children: [
77
+ s && /* @__PURE__ */ t("defs", { children: l.map((a) => /* @__PURE__ */ f(
78
+ "linearGradient",
79
+ {
80
+ id: `${c}-${a}`,
81
+ x1: "0",
82
+ y1: "0",
83
+ x2: "0",
84
+ y2: "1",
85
+ children: [
86
+ /* @__PURE__ */ t(
87
+ "stop",
88
+ {
89
+ offset: "5%",
90
+ stopColor: `var(--color-${a})`,
91
+ stopOpacity: 0.8
92
+ }
93
+ ),
94
+ /* @__PURE__ */ t(
95
+ "stop",
96
+ {
97
+ offset: "95%",
98
+ stopColor: `var(--color-${a})`,
99
+ stopOpacity: 0.1
100
+ }
101
+ )
102
+ ]
103
+ },
104
+ a
105
+ )) }),
106
+ T && /* @__PURE__ */ t(
107
+ q,
108
+ {
109
+ horizontal: R ?? !0,
110
+ vertical: V ?? !1,
111
+ strokeDasharray: L ? "3 3" : void 0
112
+ }
113
+ ),
114
+ /* @__PURE__ */ t(
115
+ E,
116
+ {
117
+ dataKey: v,
118
+ type: "category",
119
+ hide: !I,
120
+ tickLine: !1,
121
+ axisLine: !1,
122
+ tickMargin: 8,
123
+ tickFormatter: O,
124
+ angle: e,
125
+ interval: z,
126
+ textAnchor: e != null ? e < 0 ? "end" : "start" : void 0,
127
+ height: X,
128
+ label: K
129
+ }
130
+ ),
131
+ /* @__PURE__ */ t(
132
+ J,
133
+ {
134
+ type: "number",
135
+ hide: !N,
136
+ tickLine: !1,
137
+ axisLine: !1,
138
+ unit: C,
139
+ tickFormatter: j,
140
+ tickCount: A,
141
+ domain: S,
142
+ width: o ? 72 : void 0,
143
+ label: M
144
+ }
145
+ ),
146
+ D && /* @__PURE__ */ t(W, { content: w ?? /* @__PURE__ */ t(Z, {}) }),
147
+ G && /* @__PURE__ */ t(b, { content: /* @__PURE__ */ t(tt, {}) }),
148
+ l.map((a) => /* @__PURE__ */ t(
149
+ P,
150
+ {
151
+ type: g ?? "monotone",
152
+ dataKey: a,
153
+ stackId: H ? "a" : void 0,
154
+ stroke: `var(--color-${a})`,
155
+ strokeWidth: $,
156
+ fill: s ? `url(#${c}-${a})` : `var(--color-${a})`,
157
+ fillOpacity: s ? 1 : y,
158
+ dot: d ? { r: 3 } : !1,
159
+ activeDot: d ? { r: 5 } : !1,
160
+ connectNulls: k,
161
+ isAnimationActive: !1
162
+ },
163
+ a
164
+ ))
165
+ ] })
166
+ }
167
+ )
168
+ }
169
+ );
170
+ }
171
+ );
172
+ rt.displayName = "AreaChart";
173
+ export {
174
+ rt as AreaChart,
175
+ et as areaChartVariants
176
+ };
177
+ //# sourceMappingURL=area-chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"area-chart.js","sources":["../../../../src/components/ui/area-chart/area-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Area,\n AreaChart as RechartsAreaChart,\n CartesianGrid,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { cn } from '@/lib/utils';\nimport {\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n resolveAxisDomain,\n type ChartConfig,\n type CartesianChartProps,\n} from '../chart';\n\n// A typed recharts composition over the shared `Chart` primitives. The two CVA\n// axes are the design's Area-chart variant set: `layout` (independent\n// overlapping areas vs summed on a shared stack) and `fill` (a flat translucent\n// fill vs a vertical gradient). The classes stay empty because recharts' SVG —\n// not CSS — draws the areas: `layout` drives each `<Area>`'s `stackId` and `fill`\n// drives whether it paints from a `<linearGradient>` def or a flat token color.\n// CVA is kept so the variant set is a first-class, spec-conformant part of the\n// API (matched against ui-spec's api.yaml enums) and exposed via `VariantProps`;\n// the resolved values are also mirrored onto `data-layout` / `data-fill`.\nconst areaChartVariants = cva('', {\n variants: {\n layout: {\n single: '',\n stacked: '',\n },\n fill: {\n solid: '',\n gradient: '',\n },\n },\n defaultVariants: {\n layout: 'single',\n fill: 'gradient',\n },\n});\n\nexport interface AreaChartProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n VariantProps<typeof areaChartVariants>,\n CartesianChartProps {\n /** Row-per-point data. Each object holds the category key + one numeric field per series (`null` breaks the area unless `connectNulls`). */\n data: ReadonlyArray<Record<string, string | number | null>>;\n /**\n * Per-series map of `label` / `color` (imported from the shared `Chart`\n * primitives). Series colors are caller-supplied — reference an existing\n * semantic `--ui-*` token; there is no chart palette tier yet.\n */\n config: ChartConfig;\n /** Series to plot — one `<Area>` per key. Each must exist in `config` and in every data row. */\n dataKeys: string[];\n /** Category axis key (the shared dimension across rows, e.g. `\"month\"`). */\n xKey: string;\n /** Interpolation between points. */\n curve?: 'linear' | 'monotone' | 'step';\n /** Stroke width of each area's top border. */\n strokeWidth?: number;\n /** Flat-fill opacity — used only when `fill=\"solid\"` (gradient controls its own stops). */\n fillOpacity?: number;\n /** Render a dot at each data point. */\n showDots?: boolean;\n /** Bridge `null` gaps in the data instead of breaking the area. */\n connectNulls?: boolean;\n showLegend?: boolean;\n}\n\nconst AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>(\n (\n {\n className,\n config,\n data,\n dataKeys,\n xKey,\n xAxisLabel,\n yAxisLabel,\n yUnit,\n layout = 'single',\n fill = 'gradient',\n curve = 'monotone',\n strokeWidth = 2,\n fillOpacity = 0.4,\n showDots = false,\n connectNulls = false,\n showGrid = true,\n showTooltip = true,\n showLegend = true,\n showXAxis = true,\n showYAxis = true,\n xTickFormatter,\n yTickFormatter,\n xAxisAngle,\n xAxisInterval,\n yAxisTickCount,\n yAxisDomain,\n gridDashed,\n gridHorizontal,\n gridVertical,\n tooltipContent,\n ...props\n },\n ref\n ) => {\n const isStacked = layout === 'stacked';\n const isGradient = fill === 'gradient';\n\n // Axis titles: the X title sits below the ticks; the Y title is rotated in\n // the left gutter. Passed to recharts' native `label` (themed via the\n // `.recharts-label` fill selector on the container).\n const xAxisTitle = xAxisLabel\n ? { value: xAxisLabel, position: 'insideBottom' as const, offset: 0 }\n : undefined;\n const yAxisTitle = yAxisLabel\n ? {\n value: yAxisLabel,\n angle: -90,\n position: 'insideLeft' as const,\n style: { textAnchor: 'middle' as const },\n }\n : undefined;\n\n const yDomain = resolveAxisDomain(yAxisDomain);\n\n // Room for the X tick row: recharts' default 30, plus a rotated tick row\n // (+20) and/or the axis title (+18). Additive — both can be present at once,\n // which the old label-or-angle ternary under-allocated.\n const xAxisHeight =\n xAxisLabel || xAxisAngle != null\n ? 30 + (xAxisAngle != null ? 20 : 0) + (xAxisLabel ? 18 : 0)\n : undefined;\n\n // recharts renders SVG <defs> once per chart; the gradient ids must be unique\n // across chart instances on the page. useId gives a stable per-instance id;\n // strip the colons React emits (invalid in a url(#…) reference) — same guard\n // the shared ChartContainer applies to its chart id.\n const gradientId = `area-gradient-${React.useId().replace(/:/g, '')}`;\n\n return (\n <div\n ref={ref}\n data-layout={layout}\n data-fill={fill}\n className={cn(areaChartVariants({ layout, fill }), className)}\n {...props}\n >\n <ChartContainer\n config={config}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <RechartsAreaChart data={data as readonly unknown[]}>\n {isGradient && (\n <defs>\n {dataKeys.map((key) => (\n <linearGradient\n key={key}\n id={`${gradientId}-${key}`}\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"1\"\n >\n <stop\n offset=\"5%\"\n stopColor={`var(--color-${key})`}\n stopOpacity={0.8}\n />\n <stop\n offset=\"95%\"\n stopColor={`var(--color-${key})`}\n stopOpacity={0.1}\n />\n </linearGradient>\n ))}\n </defs>\n )}\n {showGrid && (\n <CartesianGrid\n horizontal={gridHorizontal ?? true}\n vertical={gridVertical ?? false}\n strokeDasharray={gridDashed ? '3 3' : undefined}\n />\n )}\n <XAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n tickMargin={8}\n tickFormatter={xTickFormatter}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={\n xAxisAngle != null ? (xAxisAngle < 0 ? 'end' : 'start') : undefined\n }\n height={xAxisHeight}\n label={xAxisTitle}\n />\n <YAxis\n type=\"number\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n unit={yUnit}\n tickFormatter={yTickFormatter}\n tickCount={yAxisTickCount}\n domain={yDomain}\n width={yAxisLabel ? 72 : undefined}\n label={yAxisTitle}\n />\n {showTooltip && (\n <ChartTooltip content={tooltipContent ?? <ChartTooltipContent />} />\n )}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n {dataKeys.map((key) => (\n <Area\n key={key}\n type={curve ?? 'monotone'}\n dataKey={key}\n stackId={isStacked ? 'a' : undefined}\n stroke={`var(--color-${key})`}\n strokeWidth={strokeWidth}\n fill={isGradient ? `url(#${gradientId}-${key})` : `var(--color-${key})`}\n fillOpacity={isGradient ? 1 : fillOpacity}\n dot={showDots ? { r: 3 } : false}\n activeDot={showDots ? { r: 5 } : false}\n connectNulls={connectNulls}\n isAnimationActive={false}\n />\n ))}\n </RechartsAreaChart>\n </ChartContainer>\n </div>\n );\n }\n);\nAreaChart.displayName = 'AreaChart';\n\nexport { AreaChart, areaChartVariants };\n"],"names":["areaChartVariants","cva","AreaChart","React","className","config","data","dataKeys","xKey","xAxisLabel","yAxisLabel","yUnit","layout","fill","curve","strokeWidth","fillOpacity","showDots","connectNulls","showGrid","showTooltip","showLegend","showXAxis","showYAxis","xTickFormatter","yTickFormatter","xAxisAngle","xAxisInterval","yAxisTickCount","yAxisDomain","gridDashed","gridHorizontal","gridVertical","tooltipContent","props","ref","isStacked","isGradient","xAxisTitle","yAxisTitle","yDomain","resolveAxisDomain","xAxisHeight","gradientId","jsx","cn","ChartContainer","jsxs","RechartsAreaChart","key","CartesianGrid","XAxis","YAxis","ChartTooltip","ChartTooltipContent","ChartLegend","ChartLegendContent","Area"],"mappings":";;;;;;;AAiCA,MAAMA,KAAoBC,EAAI,IAAI;AAAA,EAChC,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,QAAQ;AAAA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kBACA,mBAAmB;AAAA,gBAAA;AAAA,gBAXd+B;AAAA,cAAA,CAaR;AAAA,YAAA,EAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AACA/C,GAAU,cAAc;"}
@@ -1,10 +1,11 @@
1
- import { jsx as t, jsxs as o, Fragment as c } from "react/jsx-runtime";
2
- import * as B from "react";
3
- import { cva as A } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
4
- import { BarChart as N, CartesianGrid as j, XAxis as d, YAxis as h, Bar as w } from "recharts";
5
- import { cn as T } from "../../../lib/utils.js";
6
- import { ChartContainer as V, ChartTooltip as $, ChartTooltipContent as F, ChartLegend as G, ChartLegendContent as I } from "../chart/chart.js";
7
- const K = A("", {
1
+ import { jsx as t, jsxs as p, Fragment as V } from "react/jsx-runtime";
2
+ import * as Q from "react";
3
+ import { cva as U } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
4
+ import { BarChart as W, CartesianGrid as X, XAxis as j, YAxis as w, Bar as Y, ReferenceLine as Z } from "recharts";
5
+ import { cn as x } from "../../../lib/utils.js";
6
+ import { ChartContainer as A, ChartTooltip as tt, ChartTooltipContent as at, ChartLegend as rt, ChartLegendContent as et } from "../chart/chart.js";
7
+ import { resolveAxisDomain as ot } from "../chart/chart-format.js";
8
+ const it = U("", {
8
9
  variants: {
9
10
  orientation: {
10
11
  vertical: "",
@@ -19,86 +20,191 @@ const K = A("", {
19
20
  orientation: "vertical",
20
21
  layout: "grouped"
21
22
  }
22
- }), S = B.forwardRef(
23
+ });
24
+ function nt(e, v, u) {
25
+ if (!e) return;
26
+ if (typeof e.value == "number") return e.value;
27
+ if (!e.average) return;
28
+ const s = typeof e.average == "string" ? [e.average] : u, l = v.flatMap(
29
+ (o) => s.map((a) => o[a]).filter((a) => typeof a == "number")
30
+ );
31
+ if (l.length !== 0)
32
+ return l.reduce((o, a) => o + a, 0) / l.length;
33
+ }
34
+ const lt = Q.forwardRef(
23
35
  ({
24
- className: f,
25
- config: m,
26
- data: p,
27
- dataKeys: n,
36
+ className: e,
37
+ config: v,
38
+ data: u,
39
+ dataKeys: s,
28
40
  xKey: l,
29
- orientation: a = "vertical",
30
- layout: e = "grouped",
31
- barRadius: r = 4,
32
- showGrid: u = !0,
33
- showTooltip: C = !0,
34
- showLegend: v = !0,
35
- ...L
36
- }, g) => {
37
- const y = a === "horizontal" ? "vertical" : "horizontal", s = e === "stacked", x = a === "horizontal" ? [0, r, r, 0] : [r, r, 0, 0];
41
+ referenceLine: o,
42
+ xAxisLabel: a,
43
+ yAxisLabel: h,
44
+ xUnit: R,
45
+ yUnit: S,
46
+ orientation: r = "vertical",
47
+ layout: f = "grouped",
48
+ barRadius: d = 4,
49
+ showGrid: T = !0,
50
+ showTooltip: G = !0,
51
+ showLegend: H = !0,
52
+ showXAxis: y = !0,
53
+ showYAxis: g = !0,
54
+ xTickFormatter: C,
55
+ yTickFormatter: k,
56
+ xAxisAngle: i,
57
+ xAxisInterval: z,
58
+ yAxisTickCount: B,
59
+ yAxisDomain: M,
60
+ gridDashed: O,
61
+ gridHorizontal: _,
62
+ gridVertical: q,
63
+ tooltipContent: E,
64
+ ...I
65
+ }, J) => {
66
+ const K = r === "horizontal" ? "vertical" : "horizontal", b = f === "stacked", L = o ? Array.isArray(o) ? o : [o] : [], D = a ? { value: a, position: "insideBottom", offset: 0 } : void 0, $ = h ? {
67
+ value: h,
68
+ angle: -90,
69
+ position: "insideLeft",
70
+ style: { textAnchor: "middle" }
71
+ } : void 0, F = ot(M), N = a || i != null ? 30 + (i != null ? 20 : 0) + (a ? 18 : 0) : void 0, P = r === "horizontal" ? [0, d, d, 0] : [d, d, 0, 0];
38
72
  return /* @__PURE__ */ t(
39
73
  "div",
40
74
  {
41
- ref: g,
42
- "data-orientation": a,
43
- "data-layout": e,
44
- className: T(K({ orientation: a, layout: e }), f),
45
- ...L,
46
- children: /* @__PURE__ */ t(V, { config: m, className: "size-full", children: /* @__PURE__ */ o(N, { data: p, layout: y, children: [
47
- u && /* @__PURE__ */ t(
48
- j,
49
- {
50
- horizontal: a === "vertical",
51
- vertical: a === "horizontal"
52
- }
53
- ),
54
- a === "horizontal" ? /* @__PURE__ */ o(c, { children: [
55
- /* @__PURE__ */ t(d, { type: "number", tickLine: !1, axisLine: !1 }),
56
- /* @__PURE__ */ t(
57
- h,
58
- {
59
- dataKey: l,
60
- type: "category",
61
- tickLine: !1,
62
- axisLine: !1,
63
- width: 80
64
- }
65
- )
66
- ] }) : /* @__PURE__ */ o(c, { children: [
67
- /* @__PURE__ */ t(
68
- d,
69
- {
70
- dataKey: l,
71
- type: "category",
72
- tickLine: !1,
73
- axisLine: !1
74
- }
75
- ),
76
- /* @__PURE__ */ t(h, { type: "number", tickLine: !1, axisLine: !1 })
77
- ] }),
78
- C && /* @__PURE__ */ t($, { content: /* @__PURE__ */ t(F, {}) }),
79
- v && /* @__PURE__ */ t(G, { content: /* @__PURE__ */ t(I, {}) }),
80
- n.map((i, z) => {
81
- const k = s ? z === n.length - 1 : !0;
82
- return /* @__PURE__ */ t(
83
- w,
84
- {
85
- dataKey: i,
86
- fill: `var(--color-${i})`,
87
- stackId: s ? "a" : void 0,
88
- radius: r > 0 && k ? x : void 0,
89
- isAnimationActive: !1
90
- },
91
- i
92
- );
93
- })
94
- ] }) })
75
+ ref: J,
76
+ "data-orientation": r,
77
+ "data-layout": f,
78
+ className: x(it({ orientation: r, layout: f }), e),
79
+ ...I,
80
+ children: /* @__PURE__ */ t(
81
+ A,
82
+ {
83
+ config: v,
84
+ className: "size-full [&_.recharts-label]:fill-foreground",
85
+ children: /* @__PURE__ */ p(W, { data: u, layout: K, children: [
86
+ T && /* @__PURE__ */ t(
87
+ X,
88
+ {
89
+ horizontal: _ ?? r === "vertical",
90
+ vertical: q ?? r === "horizontal",
91
+ strokeDasharray: O ? "3 3" : void 0
92
+ }
93
+ ),
94
+ r === "horizontal" ? /* @__PURE__ */ p(V, { children: [
95
+ /* @__PURE__ */ t(
96
+ j,
97
+ {
98
+ type: "number",
99
+ hide: !y,
100
+ tickLine: !1,
101
+ axisLine: !1,
102
+ unit: R,
103
+ tickFormatter: C,
104
+ angle: i,
105
+ interval: z,
106
+ textAnchor: i != null ? i < 0 ? "end" : "start" : void 0,
107
+ tickCount: B,
108
+ domain: F,
109
+ height: N,
110
+ label: D
111
+ }
112
+ ),
113
+ /* @__PURE__ */ t(
114
+ w,
115
+ {
116
+ dataKey: l,
117
+ type: "category",
118
+ hide: !g,
119
+ tickLine: !1,
120
+ axisLine: !1,
121
+ tickFormatter: k,
122
+ width: h ? 96 : 80,
123
+ label: $
124
+ }
125
+ )
126
+ ] }) : /* @__PURE__ */ p(V, { children: [
127
+ /* @__PURE__ */ t(
128
+ j,
129
+ {
130
+ dataKey: l,
131
+ type: "category",
132
+ hide: !y,
133
+ tickLine: !1,
134
+ axisLine: !1,
135
+ tickFormatter: C,
136
+ angle: i,
137
+ interval: z,
138
+ textAnchor: i != null ? i < 0 ? "end" : "start" : void 0,
139
+ height: N,
140
+ label: D
141
+ }
142
+ ),
143
+ /* @__PURE__ */ t(
144
+ w,
145
+ {
146
+ type: "number",
147
+ hide: !g,
148
+ tickLine: !1,
149
+ axisLine: !1,
150
+ unit: S,
151
+ tickFormatter: k,
152
+ tickCount: B,
153
+ domain: F,
154
+ width: h ? 72 : void 0,
155
+ label: $
156
+ }
157
+ )
158
+ ] }),
159
+ G && /* @__PURE__ */ t(tt, { content: E ?? /* @__PURE__ */ t(at, {}) }),
160
+ H && /* @__PURE__ */ t(rt, { content: /* @__PURE__ */ t(et, {}) }),
161
+ s.map((n, m) => {
162
+ const c = b ? m === s.length - 1 : !0;
163
+ return /* @__PURE__ */ t(
164
+ Y,
165
+ {
166
+ dataKey: n,
167
+ fill: `var(--color-${n})`,
168
+ stackId: b ? "a" : void 0,
169
+ radius: d > 0 && c ? P : void 0,
170
+ isAnimationActive: !1
171
+ },
172
+ n
173
+ );
174
+ }),
175
+ L.map((n, m) => {
176
+ const c = nt(n, u, s);
177
+ return c === void 0 ? null : /* @__PURE__ */ t(
178
+ Z,
179
+ {
180
+ ...r === "horizontal" ? { x: c } : { y: c },
181
+ stroke: "var(--ui-text-on-surface-secondary)",
182
+ strokeDasharray: "4 4",
183
+ ifOverflow: "extendDomain",
184
+ label: n.label ? {
185
+ value: n.label,
186
+ // Sit the caption at the top of the line: above the
187
+ // right end of a horizontal line (vertical bars), or
188
+ // above the top of a vertical line (horizontal bars).
189
+ position: r === "horizontal" ? "top" : "insideTopRight",
190
+ fill: "var(--ui-text-on-surface-secondary)",
191
+ fontSize: 12
192
+ } : void 0
193
+ },
194
+ `${n.label ?? "ref"}-${m}`
195
+ );
196
+ })
197
+ ] })
198
+ }
199
+ )
95
200
  }
96
201
  );
97
202
  }
98
203
  );
99
- S.displayName = "BarChart";
204
+ lt.displayName = "BarChart";
100
205
  export {
101
- S as BarChart,
102
- K as barChartVariants
206
+ lt as BarChart,
207
+ nt as barChartReferenceValue,
208
+ it as barChartVariants
103
209
  };
104
210
  //# sourceMappingURL=bar-chart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bar-chart.js","sources":["../../../../src/components/ui/bar-chart/bar-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Bar,\n BarChart as RechartsBarChart,\n CartesianGrid,\n XAxis,\n YAxis,\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 two CVA\n// axes are the design's Bar-chart variant set (B2): `orientation` (which way the\n// bars grow) and `layout` (grouped side-by-side vs stacked). The classes stay\n// empty because the recharts SVG — not CSS — draws the bars: the same two props\n// drive recharts' `layout` prop, the axis roles, the `stackId`, and the corner\n// radius below. CVA is kept so the variant set is a first-class, spec-conformant\n// part of the API (matched against ui-spec's api.yaml enums) and exposed via\n// `VariantProps`; the resolved values are also mirrored onto `data-orientation`\n// / `data-layout` for styling hooks and tests.\nconst barChartVariants = cva('', {\n variants: {\n orientation: {\n vertical: '',\n horizontal: '',\n },\n layout: {\n grouped: '',\n stacked: '',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n layout: 'grouped',\n },\n});\n\nexport interface BarChartProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n VariantProps<typeof barChartVariants> {\n /** Row-per-category data. Each object holds the category key + 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). Series colors are caller-supplied — reference an existing\n * semantic `--ui-*` token; there is no chart palette tier yet.\n */\n config: ChartConfig;\n /** Series to plot — one `<Bar>` per key. Each must exist in `config` and in every data row. */\n dataKeys: string[];\n /** Category axis key (the shared dimension across rows, e.g. `\"month\"`). */\n xKey: string;\n /** Corner radius applied to the growing end of each bar. */\n barRadius?: number;\n showGrid?: boolean;\n showTooltip?: boolean;\n showLegend?: boolean;\n}\n\nconst BarChart = React.forwardRef<HTMLDivElement, BarChartProps>(\n (\n {\n className,\n config,\n data,\n dataKeys,\n xKey,\n orientation = 'vertical',\n layout = 'grouped',\n barRadius = 4,\n showGrid = true,\n showTooltip = true,\n showLegend = true,\n ...props\n },\n ref\n ) => {\n // Our `orientation` is bar-direction; recharts' `layout` is the opposite axis.\n const rechartsLayout = orientation === 'horizontal' ? 'vertical' : 'horizontal';\n const isStacked = layout === 'stacked';\n\n // Round only the growing end: top for vertical bars, right for horizontal.\n const endRadius: [number, number, number, number] =\n orientation === 'horizontal'\n ? [0, barRadius, barRadius, 0]\n : [barRadius, barRadius, 0, 0];\n\n return (\n <div\n ref={ref}\n data-orientation={orientation}\n data-layout={layout}\n className={cn(barChartVariants({ orientation, layout }), className)}\n {...props}\n >\n <ChartContainer config={config} className=\"size-full\">\n <RechartsBarChart data={data as readonly unknown[]} layout={rechartsLayout}>\n {showGrid && (\n <CartesianGrid\n horizontal={orientation === 'vertical'}\n vertical={orientation === 'horizontal'}\n />\n )}\n {orientation === 'horizontal' ? (\n <>\n <XAxis type=\"number\" tickLine={false} axisLine={false} />\n <YAxis\n dataKey={xKey}\n type=\"category\"\n tickLine={false}\n axisLine={false}\n width={80}\n />\n </>\n ) : (\n <>\n <XAxis\n dataKey={xKey}\n type=\"category\"\n tickLine={false}\n axisLine={false}\n />\n <YAxis type=\"number\" tickLine={false} axisLine={false} />\n </>\n )}\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n {dataKeys.map((key, index) => {\n // In a stack only the last segment's end is rounded; grouped bars\n // each round their own end.\n const rounded = isStacked ? index === dataKeys.length - 1 : true;\n return (\n <Bar\n key={key}\n dataKey={key}\n fill={`var(--color-${key})`}\n stackId={isStacked ? 'a' : undefined}\n radius={barRadius > 0 && rounded ? endRadius : undefined}\n isAnimationActive={false}\n />\n );\n })}\n </RechartsBarChart>\n </ChartContainer>\n </div>\n );\n }\n);\nBarChart.displayName = 'BarChart';\n\nexport { BarChart, barChartVariants };\n"],"names":["barChartVariants","cva","BarChart","React","className","config","data","dataKeys","xKey","orientation","layout","barRadius","showGrid","showTooltip","showLegend","props","ref","rechartsLayout","isStacked","endRadius","jsx","cn","ChartContainer","jsxs","RechartsBarChart","CartesianGrid","Fragment","XAxis","YAxis","ChartTooltip","ChartTooltipContent","ChartLegend","ChartLegendContent","key","index","rounded","Bar"],"mappings":";;;;;;AA+BA,MAAMA,IAAmBC,EAAI,IAAI;AAAA,EAC/B,UAAU;AAAA,IACR,aAAa;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,IAAA;AAAA,IAEd,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,iBAAiB;AAAA,IACf,aAAa;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BACV,UAAU;AAAA,gBACV,OAAO;AAAA,cAAA;AAAA,YAAA;AAAA,UACT,EAAA,CACF,IAEA,gBAAAe,EAAAG,GAAA,EACE,UAAA;AAAA,YAAA,gBAAAN;AAAA,cAACO;AAAA,cAAA;AAAA,gBACC,SAASnB;AAAA,gBACT,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,UAAU;AAAA,cAAA;AAAA,YAAA;AAAA,8BAEXoB,GAAA,EAAM,MAAK,UAAS,UAAU,IAAO,UAAU,GAAA,CAAO;AAAA,UAAA,GACzD;AAAA,UAEDf,KAAe,gBAAAO,EAACS,GAAA,EAAa,SAAS,gBAAAT,EAACU,KAAoB,GAAI;AAAA,UAC/DhB,KAAc,gBAAAM,EAACW,GAAA,EAAY,SAAS,gBAAAX,EAACY,KAAmB,GAAI;AAAA,UAC5DzB,EAAS,IAAI,CAAC0B,GAAKC,MAAU;AAG5B,kBAAMC,IAAUjB,IAAYgB,MAAU3B,EAAS,SAAS,IAAI;AAC5D,mBACE,gBAAAa;AAAA,cAACgB;AAAA,cAAA;AAAA,gBAEC,SAASH;AAAA,gBACT,MAAM,eAAeA,CAAG;AAAA,gBACxB,SAASf,IAAY,MAAM;AAAA,gBAC3B,QAAQP,IAAY,KAAKwB,IAAUhB,IAAY;AAAA,gBAC/C,mBAAmB;AAAA,cAAA;AAAA,cALdc;AAAA,YAAA;AAAA,UAQX,CAAC;AAAA,QAAA,EAAA,CACH,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACA/B,EAAS,cAAc;"}
1
+ {"version":3,"file":"bar-chart.js","sources":["../../../../src/components/ui/bar-chart/bar-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Bar,\n BarChart as RechartsBarChart,\n CartesianGrid,\n ReferenceLine,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { cn } from '@/lib/utils';\nimport {\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n resolveAxisDomain,\n type ChartConfig,\n type CartesianChartProps,\n} from '../chart';\n\n// A typed recharts composition over the shared `Chart` primitives. The two CVA\n// axes are the design's Bar-chart variant set (B2): `orientation` (which way the\n// bars grow) and `layout` (grouped side-by-side vs stacked). The classes stay\n// empty because the recharts SVG — not CSS — draws the bars: the same two props\n// drive recharts' `layout` prop, the axis roles, the `stackId`, and the corner\n// radius below. CVA is kept so the variant set is a first-class, spec-conformant\n// part of the API (matched against ui-spec's api.yaml enums) and exposed via\n// `VariantProps`; the resolved values are also mirrored onto `data-orientation`\n// / `data-layout` for styling hooks and tests.\nconst barChartVariants = cva('', {\n variants: {\n orientation: {\n vertical: '',\n horizontal: '',\n },\n layout: {\n grouped: '',\n stacked: '',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n layout: 'grouped',\n },\n});\n\nexport interface BarChartReferenceLine {\n /** Fixed position on the value axis. Takes precedence over `average`. */\n value?: number;\n /**\n * Draw the line at the mean of one series (a `dataKeys` entry) or, when\n * `true`, of every plotted series' values.\n */\n average?: boolean | string;\n /** Optional caption rendered alongside the line. */\n label?: string;\n}\n\n/**\n * Resolve a `referenceLine` config to a position on the value axis: a fixed\n * `value` wins; otherwise the mean of the requested series (a single `dataKeys`\n * entry, or all of them when `average` is `true`). Returns `undefined` when\n * there is nothing to draw (no config, or no numeric values to average).\n * Exported for unit tests; not part of the package's public API.\n */\nexport function barChartReferenceValue(\n referenceLine: BarChartReferenceLine | undefined,\n data: ReadonlyArray<Record<string, string | number>>,\n dataKeys: string[]\n): number | undefined {\n if (!referenceLine) return undefined;\n if (typeof referenceLine.value === 'number') return referenceLine.value;\n if (!referenceLine.average) return undefined;\n\n const keys =\n typeof referenceLine.average === 'string'\n ? [referenceLine.average]\n : dataKeys;\n const nums = data.flatMap((row) =>\n keys\n .map((key) => row[key])\n .filter((value): value is number => typeof value === 'number')\n );\n if (nums.length === 0) return undefined;\n return nums.reduce((sum, n) => sum + n, 0) / nums.length;\n}\n\nexport interface BarChartProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n VariantProps<typeof barChartVariants>,\n CartesianChartProps {\n /** Row-per-category data. Each object holds the category key + 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). Series colors are caller-supplied — reference an existing\n * semantic `--ui-*` token; there is no chart palette tier yet.\n */\n config: ChartConfig;\n /** Series to plot — one `<Bar>` per key. Each must exist in `config` and in every data row. */\n dataKeys: string[];\n /** Category axis key (the shared dimension across rows, e.g. `\"month\"`). */\n xKey: string;\n /**\n * One or more dashed reference/average lines on the value axis (Y for vertical\n * bars, X for horizontal). Each is driven by a fixed `value` or a computed\n * series `average`. Pass a single object or an array to draw several at once.\n */\n referenceLine?: BarChartReferenceLine | BarChartReferenceLine[];\n /** Unit suffix on X-axis tick values (recharts `unit`) — applies when the X axis is numeric (`orientation=\"horizontal\"`). */\n xUnit?: string;\n /** Corner radius applied to the growing end of each bar. */\n barRadius?: number;\n showLegend?: boolean;\n}\n\nconst BarChart = React.forwardRef<HTMLDivElement, BarChartProps>(\n (\n {\n className,\n config,\n data,\n dataKeys,\n xKey,\n referenceLine,\n xAxisLabel,\n yAxisLabel,\n xUnit,\n yUnit,\n orientation = 'vertical',\n layout = 'grouped',\n barRadius = 4,\n showGrid = true,\n showTooltip = true,\n showLegend = true,\n showXAxis = true,\n showYAxis = true,\n xTickFormatter,\n yTickFormatter,\n xAxisAngle,\n xAxisInterval,\n yAxisTickCount,\n yAxisDomain,\n gridDashed,\n gridHorizontal,\n gridVertical,\n tooltipContent,\n ...props\n },\n ref\n ) => {\n // Our `orientation` is bar-direction; recharts' `layout` is the opposite axis.\n const rechartsLayout = orientation === 'horizontal' ? 'vertical' : 'horizontal';\n const isStacked = layout === 'stacked';\n\n const referenceLines = referenceLine\n ? Array.isArray(referenceLine)\n ? referenceLine\n : [referenceLine]\n : [];\n\n // Axis titles: the X title sits below the ticks; the Y title is rotated in\n // the left gutter. Passed to recharts' native `label` (themed via the\n // `.recharts-label` fill selector on the container).\n const xAxisTitle = xAxisLabel\n ? { value: xAxisLabel, position: 'insideBottom' as const, offset: 0 }\n : undefined;\n const yAxisTitle = yAxisLabel\n ? {\n value: yAxisLabel,\n angle: -90,\n position: 'insideLeft' as const,\n style: { textAnchor: 'middle' as const },\n }\n : undefined;\n\n const yDomain = resolveAxisDomain(yAxisDomain);\n\n // Room for the X tick row: recharts' default 30, plus a rotated tick row\n // (+20) and/or the axis title (+18). Additive — both can be present at once,\n // which the old label-or-angle ternary under-allocated.\n const xAxisHeight =\n xAxisLabel || xAxisAngle != null\n ? 30 + (xAxisAngle != null ? 20 : 0) + (xAxisLabel ? 18 : 0)\n : undefined;\n\n // Round only the growing end: top for vertical bars, right for horizontal.\n const endRadius: [number, number, number, number] =\n orientation === 'horizontal'\n ? [0, barRadius, barRadius, 0]\n : [barRadius, barRadius, 0, 0];\n\n return (\n <div\n ref={ref}\n data-orientation={orientation}\n data-layout={layout}\n className={cn(barChartVariants({ orientation, layout }), className)}\n {...props}\n >\n <ChartContainer\n config={config}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <RechartsBarChart data={data as readonly unknown[]} layout={rechartsLayout}>\n {showGrid && (\n <CartesianGrid\n horizontal={gridHorizontal ?? orientation === 'vertical'}\n vertical={gridVertical ?? orientation === 'horizontal'}\n strokeDasharray={gridDashed ? '3 3' : undefined}\n />\n )}\n {orientation === 'horizontal' ? (\n <>\n {/* Horizontal bars put the values on X, so the value-axis\n props (tickCount/domain) belong here — recharts ignores both\n on the category axis. */}\n <XAxis\n type=\"number\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n unit={xUnit}\n tickFormatter={xTickFormatter}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={\n xAxisAngle != null ? (xAxisAngle < 0 ? 'end' : 'start') : undefined\n }\n tickCount={yAxisTickCount}\n domain={yDomain}\n height={xAxisHeight}\n label={xAxisTitle}\n />\n <YAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n tickFormatter={yTickFormatter}\n width={yAxisLabel ? 96 : 80}\n label={yAxisTitle}\n />\n </>\n ) : (\n <>\n <XAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n tickFormatter={xTickFormatter}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={\n xAxisAngle != null ? (xAxisAngle < 0 ? 'end' : 'start') : undefined\n }\n height={xAxisHeight}\n label={xAxisTitle}\n />\n <YAxis\n type=\"number\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n unit={yUnit}\n tickFormatter={yTickFormatter}\n tickCount={yAxisTickCount}\n domain={yDomain}\n width={yAxisLabel ? 72 : undefined}\n label={yAxisTitle}\n />\n </>\n )}\n {showTooltip && (\n <ChartTooltip content={tooltipContent ?? <ChartTooltipContent />} />\n )}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n {dataKeys.map((key, index) => {\n // In a stack only the last segment's end is rounded; grouped bars\n // each round their own end.\n const rounded = isStacked ? index === dataKeys.length - 1 : true;\n return (\n <Bar\n key={key}\n dataKey={key}\n fill={`var(--color-${key})`}\n stackId={isStacked ? 'a' : undefined}\n radius={barRadius > 0 && rounded ? endRadius : undefined}\n isAnimationActive={false}\n />\n );\n })}\n {referenceLines.map((ref, index) => {\n const value = barChartReferenceValue(ref, data, dataKeys);\n if (value === undefined) return null;\n return (\n <ReferenceLine\n key={`${ref.label ?? 'ref'}-${index}`}\n // Draw on the value axis: Y for vertical bars, X for horizontal.\n {...(orientation === 'horizontal' ? { x: value } : { y: value })}\n stroke=\"var(--ui-text-on-surface-secondary)\"\n strokeDasharray=\"4 4\"\n // extendDomain so a target beyond the data max stays visible.\n ifOverflow=\"extendDomain\"\n label={\n ref.label\n ? {\n value: ref.label,\n // Sit the caption at the top of the line: above the\n // right end of a horizontal line (vertical bars), or\n // above the top of a vertical line (horizontal bars).\n position:\n orientation === 'horizontal'\n ? 'top'\n : 'insideTopRight',\n fill: 'var(--ui-text-on-surface-secondary)',\n fontSize: 12,\n }\n : undefined\n }\n />\n );\n })}\n </RechartsBarChart>\n </ChartContainer>\n </div>\n );\n }\n);\nBarChart.displayName = 'BarChart';\n\nexport { BarChart, barChartVariants };\n"],"names":["barChartVariants","cva","barChartReferenceValue","referenceLine","data","dataKeys","keys","nums","row","key","value","sum","n","BarChart","React","className","config","xKey","xAxisLabel","yAxisLabel","xUnit","yUnit","orientation","layout","barRadius","showGrid","showTooltip","showLegend","showXAxis","showYAxis","xTickFormatter","yTickFormatter","xAxisAngle","xAxisInterval","yAxisTickCount","yAxisDomain","gridDashed","gridHorizontal","gridVertical","tooltipContent","props","ref","rechartsLayout","isStacked","referenceLines","xAxisTitle","yAxisTitle","yDomain","resolveAxisDomain","xAxisHeight","endRadius","jsx","cn","ChartContainer","jsxs","RechartsBarChart","CartesianGrid","Fragment","XAxis","YAxis","ChartTooltip","ChartTooltipContent","ChartLegend","ChartLegendContent","index","rounded","Bar","ReferenceLine"],"mappings":";;;;;;;AAkCA,MAAMA,KAAmBC,EAAI,IAAI;AAAA,EAC/B,UAAU;AAAA,IACR,aAAa;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,IAAA;AAAA,IAEd,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,QAAQ;AAAA,EAAA;AAEZ,CAAC;AAqBM,SAASC,GACdC,GACAC,GACAC,GACoB;AACpB,MAAI,CAACF,EAAe;AACpB,MAAI,OAAOA,EAAc,SAAU,iBAAiBA,EAAc;AAClE,MAAI,CAACA,EAAc,QAAS;AAE5B,QAAMG,IACJ,OAAOH,EAAc,WAAY,WAC7B,CAACA,EAAc,OAAO,IACtBE,GACAE,IAAOH,EAAK;AAA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;AAAA,kBAACe;AAAA,kBAAA;AAAA,oBAEC,SAASzD;AAAA,oBACT,MAAM,eAAeA,CAAG;AAAA,oBACxB,SAASkC,IAAY,MAAM;AAAA,oBAC3B,QAAQnB,IAAY,KAAKyC,IAAUf,IAAY;AAAA,oBAC/C,mBAAmB;AAAA,kBAAA;AAAA,kBALdzC;AAAA,gBAAA;AAAA,cAQX,CAAC;AAAA,cACAmC,EAAe,IAAI,CAACH,GAAKuB,MAAU;AAClC,sBAAMtD,IAAQR,GAAuBuC,GAAKrC,GAAMC,CAAQ;AACxD,uBAAIK,MAAU,SAAkB,OAE9B,gBAAAyC;AAAA,kBAACgB;AAAA,kBAAA;AAAA,oBAGE,GAAI7C,MAAgB,eAAe,EAAE,GAAGZ,MAAU,EAAE,GAAGA,EAAA;AAAA,oBACxD,QAAO;AAAA,oBACP,iBAAgB;AAAA,oBAEhB,YAAW;AAAA,oBACX,OACE+B,EAAI,QACA;AAAA,sBACE,OAAOA,EAAI;AAAA;AAAA;AAAA;AAAA,sBAIX,UACEnB,MAAgB,eACZ,QACA;AAAA,sBACN,MAAM;AAAA,sBACN,UAAU;AAAA,oBAAA,IAEZ;AAAA,kBAAA;AAAA,kBArBD,GAAGmB,EAAI,SAAS,KAAK,IAAIuB,CAAK;AAAA,gBAAA;AAAA,cAyBzC,CAAC;AAAA,YAAA,EAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AACAnD,GAAS,cAAc;"}
@@ -0,0 +1,36 @@
1
+ import * as e from "react";
2
+ import { mergeProps as a } from "@base-ui/react/merge-props";
3
+ import { useRender as u } from "@base-ui/react/use-render";
4
+ import { cva as c } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
5
+ import { cn as l } from "../../../lib/utils.js";
6
+ const v = c(
7
+ "inline-flex size-[var(--ui-button-icon-input-global-container-width)] shrink-0 items-center justify-center rounded-[var(--ui-button-icon-input-global-container-border-radius)] outline-none transition-colors cursor-pointer disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-[var(--ui-button-icon-input-normal-container-color-disabled)] disabled:text-[var(--ui-button-icon-input-normal-icon-color-disabled)] focus-visible:ring-[3px] [&_svg]:pointer-events-none [&_svg]:shrink-0",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ normal: "bg-[var(--ui-button-icon-input-normal-container-color-idle)] text-[var(--ui-button-icon-input-normal-icon-color-idle)] hover:bg-[var(--ui-button-icon-input-normal-container-color-hover)] hover:text-[var(--ui-button-icon-input-normal-icon-color-hover)] active:bg-[var(--ui-button-icon-input-normal-container-color-active)] active:text-[var(--ui-button-icon-input-normal-icon-color-active)] focus-visible:ring-[var(--ui-focus-primary)] [&_svg]:size-[var(--ui-button-icon-input-normal-icon-size)]",
12
+ error: "bg-[var(--ui-button-icon-input-error-container-color-idle)] text-[var(--ui-button-icon-input-error-icon-color-idle)] hover:bg-[var(--ui-button-icon-input-error-container-color-hover)] hover:text-[var(--ui-button-icon-input-error-icon-color-hover)] active:bg-[var(--ui-button-icon-input-error-container-color-active)] active:text-[var(--ui-button-icon-input-error-icon-color-active)] focus-visible:ring-[var(--ui-focus-error)] [&_svg]:size-[var(--ui-button-icon-input-error-icon-size)]"
13
+ }
14
+ },
15
+ defaultVariants: {
16
+ variant: "normal"
17
+ }
18
+ }
19
+ ), s = e.forwardRef(({ className: o, variant: n, render: r, ...i }, t) => u({
20
+ render: r,
21
+ ref: t,
22
+ defaultTagName: "button",
23
+ props: a(
24
+ {
25
+ type: "button",
26
+ className: l(v({ variant: n, className: o }))
27
+ },
28
+ i
29
+ )
30
+ }));
31
+ s.displayName = "ButtonIconInput";
32
+ export {
33
+ s as ButtonIconInput,
34
+ v as buttonIconInputVariants
35
+ };
36
+ //# sourceMappingURL=button-icon-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-icon-input.js","sources":["../../../../src/components/ui/button-icon-input/button-icon-input.tsx"],"sourcesContent":["import * as React from 'react';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\n// Mirrors the Figma \"ButtonIconInput\" component set: a smaller icon-only\n// button (20px box, 16px glyph) meant to live inside an input's box (e.g. the\n// clear/reveal affordance), as opposed to `ButtonIcon`'s standalone 32px/24px\n// sizing. `variant` (`normal` / `error`) picks the field's tone — `error`\n// mirrors the input's error-state red — and each interaction state\n// (idle/hover/active) is wired to its own `--ui-button-icon-input-*` token per\n// variant (they use distinct tokens, not a shared `global` tier like\n// `ButtonIcon`). The Figma set has no `disabled` variant for `error` (only\n// `normal` does), so disabled always uses the `normal` disabled tokens\n// regardless of `variant` — there's no dead-token fallback here, just the one\n// disabled treatment the design actually defines. Focus is a 3px ring —\n// `--ui-focus-primary` for `normal`, `--ui-focus-error` for `error` —\n// matching the field it sits in.\nconst buttonIconInputVariants = cva(\n 'inline-flex size-[var(--ui-button-icon-input-global-container-width)] shrink-0 items-center justify-center rounded-[var(--ui-button-icon-input-global-container-border-radius)] outline-none transition-colors cursor-pointer disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-[var(--ui-button-icon-input-normal-container-color-disabled)] disabled:text-[var(--ui-button-icon-input-normal-icon-color-disabled)] focus-visible:ring-[3px] [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n normal:\n 'bg-[var(--ui-button-icon-input-normal-container-color-idle)] text-[var(--ui-button-icon-input-normal-icon-color-idle)] hover:bg-[var(--ui-button-icon-input-normal-container-color-hover)] hover:text-[var(--ui-button-icon-input-normal-icon-color-hover)] active:bg-[var(--ui-button-icon-input-normal-container-color-active)] active:text-[var(--ui-button-icon-input-normal-icon-color-active)] focus-visible:ring-[var(--ui-focus-primary)] [&_svg]:size-[var(--ui-button-icon-input-normal-icon-size)]',\n error:\n 'bg-[var(--ui-button-icon-input-error-container-color-idle)] text-[var(--ui-button-icon-input-error-icon-color-idle)] hover:bg-[var(--ui-button-icon-input-error-container-color-hover)] hover:text-[var(--ui-button-icon-input-error-icon-color-hover)] active:bg-[var(--ui-button-icon-input-error-container-color-active)] active:text-[var(--ui-button-icon-input-error-icon-color-active)] focus-visible:ring-[var(--ui-focus-error)] [&_svg]:size-[var(--ui-button-icon-input-error-icon-size)]',\n },\n },\n defaultVariants: {\n variant: 'normal',\n },\n }\n);\n\nexport interface ButtonIconInputProps\n extends\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonIconInputVariants> {\n /**\n * Replace the rendered `<button>` with another element or component\n * (Base UI composition). Accepts a React element or a render function —\n * the component's props and class names are merged onto it.\n */\n render?: useRender.RenderProp;\n}\n\n/**\n * Small icon-only button meant to sit inside an input's box. The icon is\n * passed as `children`; provide an `aria-label` (or `aria-labelledby`) so the\n * control has an accessible name.\n */\nconst ButtonIconInput = React.forwardRef<\n HTMLButtonElement,\n ButtonIconInputProps\n>(({ className, variant, render, ...props }, ref) => {\n return useRender({\n render,\n ref,\n defaultTagName: 'button',\n props: mergeProps<'button'>(\n {\n type: 'button',\n className: cn(buttonIconInputVariants({ variant, className })),\n },\n props\n ),\n });\n});\nButtonIconInput.displayName = 'ButtonIconInput';\n\nexport { ButtonIconInput, buttonIconInputVariants };\n"],"names":["buttonIconInputVariants","cva","ButtonIconInput","React","className","variant","render","props","ref","useRender","mergeProps","cn"],"mappings":";;;;;AAoBA,MAAMA,IAA0BC;AAAA,EAC9B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,QACE;AAAA,QACF,OACE;AAAA,MAAA;AAAA,IACJ;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ,GAmBMC,IAAkBC,EAAM,WAG5B,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,QAAAC,GAAQ,GAAGC,EAAA,GAASC,MACpCC,EAAU;AAAA,EACf,QAAAH;AAAA,EACA,KAAAE;AAAA,EACA,gBAAgB;AAAA,EAChB,OAAOE;AAAA,IACL;AAAA,MACE,MAAM;AAAA,MACN,WAAWC,EAAGX,EAAwB,EAAE,SAAAK,GAAS,WAAAD,EAAA,CAAW,CAAC;AAAA,IAAA;AAAA,IAE/DG;AAAA,EAAA;AACF,CACD,CACF;AACDL,EAAgB,cAAc;"}
@@ -6,7 +6,7 @@ import { ChevronUpIcon as m, ChevronDownIcon as p } from "@acronis-platform/icon
6
6
  import { cva as g } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
7
7
  import { cn as y } from "../../../lib/utils.js";
8
8
  const h = g(
9
- "inline-flex h-[var(--ui-button-menu-global-container-height)] min-w-[var(--ui-button-menu-global-container-width-min)] items-center justify-center gap-[var(--ui-button-menu-global-container-gap)] whitespace-nowrap rounded-[var(--ui-button-menu-global-container-border-radius)] border border-transparent px-[var(--ui-button-menu-global-container-padding-x)] text-sm font-semibold leading-6 transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-[var(--ui-button-menu-global-icon-size)] [&_svg]:shrink-0",
9
+ "inline-flex h-[var(--ui-button-menu-global-container-height)] min-w-[var(--ui-button-menu-global-container-width-min)] cursor-pointer items-center justify-center gap-[var(--ui-button-menu-global-container-gap)] whitespace-nowrap rounded-[var(--ui-button-menu-global-container-border-radius)] border border-transparent px-[var(--ui-button-menu-global-container-padding-x)] text-sm font-semibold leading-6 transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-[var(--ui-button-menu-global-icon-size)] [&_svg]:shrink-0",
10
10
  {
11
11
  variants: {
12
12
  variant: {