@aiconstructions/graficos 0.0.0-stage → 0.2.2

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 (267) hide show
  1. package/ALTERACOES.md +57 -0
  2. package/LICENSE-BKLIT +21 -0
  3. package/LICENSE-visx-pattern +21 -0
  4. package/README.md +189 -2
  5. package/dist/aic/cores.js +83 -0
  6. package/dist/aic/index.js +22 -0
  7. package/dist/aic/interacao.js +55 -0
  8. package/dist/charts/animation.js +55 -0
  9. package/dist/charts/arc-geometry.js +58 -0
  10. package/dist/charts/arc-path.js +15 -0
  11. package/dist/charts/area-chart-loading.js +89 -0
  12. package/dist/charts/area-chart.js +149 -0
  13. package/dist/charts/area-gradient-defs.js +90 -0
  14. package/dist/charts/area-value-label-layout.js +70 -0
  15. package/dist/charts/area-value-labels.js +211 -0
  16. package/dist/charts/area.js +272 -0
  17. package/dist/charts/background.js +198 -0
  18. package/dist/charts/band-config.js +82 -0
  19. package/dist/charts/band-geometry.js +186 -0
  20. package/dist/charts/band.js +346 -0
  21. package/dist/charts/bar-chart-loading.js +27 -0
  22. package/dist/charts/bar-chart.js +545 -0
  23. package/dist/charts/bar-depth-geometry.js +18 -0
  24. package/dist/charts/bar-depth.js +608 -0
  25. package/dist/charts/bar-lollipop.js +278 -0
  26. package/dist/charts/bar-squares-layout.js +66 -0
  27. package/dist/charts/bar-squares.js +467 -0
  28. package/dist/charts/bar-value-label-layout.js +42 -0
  29. package/dist/charts/bar-x-axis.js +133 -0
  30. package/dist/charts/bar-y-axis.js +116 -0
  31. package/dist/charts/bar.js +457 -0
  32. package/dist/charts/bollinger.js +49 -0
  33. package/dist/charts/candlestick-chart.js +370 -0
  34. package/dist/charts/candlestick.js +368 -0
  35. package/dist/charts/chart-brush-handle.js +91 -0
  36. package/dist/charts/chart-brush-layout.js +91 -0
  37. package/dist/charts/chart-brush-selection-overlay.js +87 -0
  38. package/dist/charts/chart-brush-state.js +253 -0
  39. package/dist/charts/chart-brush-track-overlay.js +103 -0
  40. package/dist/charts/chart-brush.js +517 -0
  41. package/dist/charts/chart-center-typography.js +8 -0
  42. package/dist/charts/chart-child-passthrough.js +119 -0
  43. package/dist/charts/chart-config-context.js +56 -0
  44. package/dist/charts/chart-context.js +337 -0
  45. package/dist/charts/chart-crosshair.js +262 -0
  46. package/dist/charts/chart-data-override.js +186 -0
  47. package/dist/charts/chart-defs.js +56 -0
  48. package/dist/charts/chart-formatters.js +77 -0
  49. package/dist/charts/chart-legend-hover.js +27 -0
  50. package/dist/charts/chart-legend.js +163 -0
  51. package/dist/charts/chart-loading-label.js +52 -0
  52. package/dist/charts/chart-parent-size.js +138 -0
  53. package/dist/charts/chart-phase.js +29 -0
  54. package/dist/charts/chart-reveal-clip.js +62 -0
  55. package/dist/charts/chart-scale.js +19 -0
  56. package/dist/charts/chart-stat-flow.js +72 -0
  57. package/dist/charts/choropleth/choropleth-background.js +29 -0
  58. package/dist/charts/choropleth/choropleth-camera.js +379 -0
  59. package/dist/charts/choropleth/choropleth-chart.js +644 -0
  60. package/dist/charts/choropleth/choropleth-context.js +152 -0
  61. package/dist/charts/choropleth/choropleth-dot-grid.js +293 -0
  62. package/dist/charts/choropleth/choropleth-feature.js +291 -0
  63. package/dist/charts/choropleth/choropleth-graticule.js +40 -0
  64. package/dist/charts/choropleth/choropleth-marker.js +222 -0
  65. package/dist/charts/choropleth/choropleth-projection.js +37 -0
  66. package/dist/charts/choropleth/choropleth-tooltip.js +82 -0
  67. package/dist/charts/choropleth/choropleth-zoom-matrix.js +150 -0
  68. package/dist/charts/choropleth/index.js +44 -0
  69. package/dist/charts/choropleth/use-choropleth-zoom-state.js +636 -0
  70. package/dist/charts/composed-chart.js +346 -0
  71. package/dist/charts/crosshair-store.js +49 -0
  72. package/dist/charts/dash-tail-stroke.js +58 -0
  73. package/dist/charts/date-pill-store.js +50 -0
  74. package/dist/charts/date-ranges.js +131 -0
  75. package/dist/charts/deadline.js +295 -0
  76. package/dist/charts/decimate-time-series.js +112 -0
  77. package/dist/charts/fade-edges.js +171 -0
  78. package/dist/charts/fast-path.js +78 -0
  79. package/dist/charts/filter-data-by-x-domain.js +45 -0
  80. package/dist/charts/funnel-chart.js +773 -0
  81. package/dist/charts/gauge-arc-layers.js +479 -0
  82. package/dist/charts/gauge-dial.js +329 -0
  83. package/dist/charts/gauge-label-layout.js +148 -0
  84. package/dist/charts/gauge.js +946 -0
  85. package/dist/charts/generate-chart-skeleton-data.js +27 -0
  86. package/dist/charts/gradients.js +158 -0
  87. package/dist/charts/grid-lines.js +114 -0
  88. package/dist/charts/grid.js +225 -0
  89. package/dist/charts/heatmap/generate-heatmap-skeleton-data.js +13 -0
  90. package/dist/charts/heatmap/heatmap-animation.js +128 -0
  91. package/dist/charts/heatmap/heatmap-cells.js +519 -0
  92. package/dist/charts/heatmap/heatmap-chart-loading.js +44 -0
  93. package/dist/charts/heatmap/heatmap-chart.js +548 -0
  94. package/dist/charts/heatmap/heatmap-colors.js +127 -0
  95. package/dist/charts/heatmap/heatmap-context.js +107 -0
  96. package/dist/charts/heatmap/heatmap-legend-gradient.js +97 -0
  97. package/dist/charts/heatmap/heatmap-legend-swatch.js +76 -0
  98. package/dist/charts/heatmap/heatmap-legend.js +165 -0
  99. package/dist/charts/heatmap/heatmap-pattern-defs.js +37 -0
  100. package/dist/charts/heatmap/heatmap-rect-cells.js +39 -0
  101. package/dist/charts/heatmap/heatmap-resolve-separator.js +84 -0
  102. package/dist/charts/heatmap/heatmap-separator.js +168 -0
  103. package/dist/charts/heatmap/heatmap-tooltip.js +73 -0
  104. package/dist/charts/heatmap/heatmap-utils.js +633 -0
  105. package/dist/charts/heatmap/heatmap-x-axis.js +79 -0
  106. package/dist/charts/heatmap/heatmap-y-axis.js +72 -0
  107. package/dist/charts/heatmap/index.js +208 -0
  108. package/dist/charts/highlight-segment-bounds.js +34 -0
  109. package/dist/charts/highlight-segment.js +119 -0
  110. package/dist/charts/index.js +944 -0
  111. package/dist/charts/indicator-fade.js +44 -0
  112. package/dist/charts/legend/index.js +22 -0
  113. package/dist/charts/legend/legend-context.js +47 -0
  114. package/dist/charts/legend/legend-item.js +30 -0
  115. package/dist/charts/legend/legend-label.js +14 -0
  116. package/dist/charts/legend/legend-marker.js +18 -0
  117. package/dist/charts/legend/legend-progress.js +39 -0
  118. package/dist/charts/legend/legend-value.js +31 -0
  119. package/dist/charts/legend/legend.js +69 -0
  120. package/dist/charts/line-backdrop.js +129 -0
  121. package/dist/charts/line-chart-loading.js +85 -0
  122. package/dist/charts/line-chart.js +182 -0
  123. package/dist/charts/line-loading-pulse.js +185 -0
  124. package/dist/charts/line-loading-timing.js +12 -0
  125. package/dist/charts/line-path.js +58 -0
  126. package/dist/charts/line-series-terminal-marker.js +75 -0
  127. package/dist/charts/line.js +499 -0
  128. package/dist/charts/live-line-chart.js +494 -0
  129. package/dist/charts/live-line.js +277 -0
  130. package/dist/charts/live-x-axis.js +116 -0
  131. package/dist/charts/live-y-axis.js +164 -0
  132. package/dist/charts/loading-sweep.js +344 -0
  133. package/dist/charts/local-point.js +56 -0
  134. package/dist/charts/markers/chart-markers.js +149 -0
  135. package/dist/charts/markers/index.js +14 -0
  136. package/dist/charts/markers/marker-group.js +411 -0
  137. package/dist/charts/motion-utils.js +29 -0
  138. package/dist/charts/notch-gauge-shared.js +146 -0
  139. package/dist/charts/particle-line.js +1340 -0
  140. package/dist/charts/path-stroke-utils.js +51 -0
  141. package/dist/charts/pattern-area.js +127 -0
  142. package/dist/charts/pattern-preset.js +287 -0
  143. package/dist/charts/pattern-tile.js +31 -0
  144. package/dist/charts/patterns/circles.js +62 -0
  145. package/dist/charts/patterns/constants.js +9 -0
  146. package/dist/charts/patterns/hexagons.js +38 -0
  147. package/dist/charts/patterns/index.js +16 -0
  148. package/dist/charts/patterns/lines.js +65 -0
  149. package/dist/charts/patterns/path.js +37 -0
  150. package/dist/charts/patterns/pattern.js +16 -0
  151. package/dist/charts/patterns/waves.js +40 -0
  152. package/dist/charts/pie-center-shell.js +127 -0
  153. package/dist/charts/pie-center.js +87 -0
  154. package/dist/charts/pie-chart.js +377 -0
  155. package/dist/charts/pie-context.js +116 -0
  156. package/dist/charts/pie-slice.js +394 -0
  157. package/dist/charts/pie-ticks.js +332 -0
  158. package/dist/charts/profit-loss-legend-hover.js +18 -0
  159. package/dist/charts/profit-loss-legend.js +53 -0
  160. package/dist/charts/profit-loss-line.js +162 -0
  161. package/dist/charts/profit-loss-segments.js +88 -0
  162. package/dist/charts/projection-config.js +90 -0
  163. package/dist/charts/projection-line-end-marker.js +50 -0
  164. package/dist/charts/projection-line.js +466 -0
  165. package/dist/charts/projection-utils.js +303 -0
  166. package/dist/charts/radar-area.js +192 -0
  167. package/dist/charts/radar-axis.js +41 -0
  168. package/dist/charts/radar-chart.js +184 -0
  169. package/dist/charts/radar-context.js +104 -0
  170. package/dist/charts/radar-grid.js +121 -0
  171. package/dist/charts/radar-labels.js +62 -0
  172. package/dist/charts/radial-area.js +498 -0
  173. package/dist/charts/radial-axis.js +652 -0
  174. package/dist/charts/radial-bar.js +316 -0
  175. package/dist/charts/radial-center.js +67 -0
  176. package/dist/charts/radial-chart.js +740 -0
  177. package/dist/charts/radial-dot-bar-layout.js +68 -0
  178. package/dist/charts/radial-dot-bar.js +387 -0
  179. package/dist/charts/radial-geometry.js +114 -0
  180. package/dist/charts/radial-legend.js +66 -0
  181. package/dist/charts/radial-line.js +280 -0
  182. package/dist/charts/radial-ring-bar.js +255 -0
  183. package/dist/charts/radial-scrubber.js +120 -0
  184. package/dist/charts/radial-series-color.js +10 -0
  185. package/dist/charts/reference-area-config.js +43 -0
  186. package/dist/charts/reference-area-geometry.js +76 -0
  187. package/dist/charts/reference-area-registration-context.js +10 -0
  188. package/dist/charts/reference-area.js +241 -0
  189. package/dist/charts/responsive-chart-label-count.js +18 -0
  190. package/dist/charts/ring-center.js +78 -0
  191. package/dist/charts/ring-chart.js +362 -0
  192. package/dist/charts/ring-context.js +122 -0
  193. package/dist/charts/ring-grid.js +175 -0
  194. package/dist/charts/ring-labels.js +109 -0
  195. package/dist/charts/ring.js +237 -0
  196. package/dist/charts/sankey/index.js +22 -0
  197. package/dist/charts/sankey/sankey-chart.js +199 -0
  198. package/dist/charts/sankey/sankey-context.js +32 -0
  199. package/dist/charts/sankey/sankey-link.js +232 -0
  200. package/dist/charts/sankey/sankey-node.js +348 -0
  201. package/dist/charts/sankey/sankey-tooltip.js +94 -0
  202. package/dist/charts/scatter-chart-shell.js +279 -0
  203. package/dist/charts/scatter-chart.js +150 -0
  204. package/dist/charts/scatter-jitter.js +86 -0
  205. package/dist/charts/scatter-svg.js +17 -0
  206. package/dist/charts/scatter.js +92 -0
  207. package/dist/charts/segment.js +107 -0
  208. package/dist/charts/series-bar-layout.js +42 -0
  209. package/dist/charts/series-bar.js +241 -0
  210. package/dist/charts/series-dash-tail-overlay.js +53 -0
  211. package/dist/charts/series-highlight-layer.js +43 -0
  212. package/dist/charts/series-hover-dim.js +32 -0
  213. package/dist/charts/series-markers.js +239 -0
  214. package/dist/charts/series-path-utils.js +185 -0
  215. package/dist/charts/series-point-marker.js +150 -0
  216. package/dist/charts/sparkline-geometry.js +197 -0
  217. package/dist/charts/sparkline.js +910 -0
  218. package/dist/charts/static-chart-preview-context.js +16 -0
  219. package/dist/charts/sunburst-breadcrumb.js +33 -0
  220. package/dist/charts/sunburst-center.js +37 -0
  221. package/dist/charts/sunburst-chart.js +408 -0
  222. package/dist/charts/sunburst-context.js +140 -0
  223. package/dist/charts/sunburst-data.js +0 -0
  224. package/dist/charts/sunburst-hint.js +42 -0
  225. package/dist/charts/sunburst-labels.js +130 -0
  226. package/dist/charts/sunburst-segment.js +144 -0
  227. package/dist/charts/sunburst.js +419 -0
  228. package/dist/charts/time-series-chart-shell.js +688 -0
  229. package/dist/charts/tooltip/chart-tooltip.js +516 -0
  230. package/dist/charts/tooltip/cursor-tooltip-box.js +183 -0
  231. package/dist/charts/tooltip/date-ticker.js +376 -0
  232. package/dist/charts/tooltip/index.js +32 -0
  233. package/dist/charts/tooltip/liquid-glass.js +142 -0
  234. package/dist/charts/tooltip/tooltip-box.js +502 -0
  235. package/dist/charts/tooltip/tooltip-content.js +59 -0
  236. package/dist/charts/tooltip/tooltip-dot.js +170 -0
  237. package/dist/charts/tooltip/tooltip-indicator.js +175 -0
  238. package/dist/charts/tooltip/use-delayed-tooltip-data.js +41 -0
  239. package/dist/charts/tooltip/use-velocity-stretch.js +52 -0
  240. package/dist/charts/trend-line-utils.js +64 -0
  241. package/dist/charts/trend-line.js +318 -0
  242. package/dist/charts/use-animated-band.js +175 -0
  243. package/dist/charts/use-animated-series-path.js +208 -0
  244. package/dist/charts/use-animated-y-domains.js +192 -0
  245. package/dist/charts/use-category-slots.js +29 -0
  246. package/dist/charts/use-chart-interaction.js +296 -0
  247. package/dist/charts/use-chart-phase-orchestrator.js +183 -0
  248. package/dist/charts/use-enter-complete.js +18 -0
  249. package/dist/charts/use-grid-shimmer.js +88 -0
  250. package/dist/charts/use-highlight-segment.js +65 -0
  251. package/dist/charts/use-mount-progress.js +23 -0
  252. package/dist/charts/use-scatter-chart-interaction.js +364 -0
  253. package/dist/charts/use-scheduled-tooltip.js +84 -0
  254. package/dist/charts/visx-pattern.js +30 -0
  255. package/dist/charts/weekends.js +174 -0
  256. package/dist/charts/x-axis-hover.js +46 -0
  257. package/dist/charts/x-axis.js +523 -0
  258. package/dist/charts/y-axis-scales.js +71 -0
  259. package/dist/charts/y-axis-ticks.js +22 -0
  260. package/dist/charts/y-axis.js +233 -0
  261. package/dist/charts/y-domain-utils.js +189 -0
  262. package/dist/index.d.ts +7346 -0
  263. package/dist/index.js +2 -0
  264. package/dist/lib/utils.js +8 -0
  265. package/dist/shimmering-text.js +54 -0
  266. package/package.json +78 -4
  267. package/tema.css +202 -0
@@ -0,0 +1,946 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ domAnimation,
5
+ LazyMotion,
6
+ m,
7
+ useReducedMotion
8
+ } from "motion/react";
9
+ import { useId, useMemo, useRef } from "react";
10
+ import { cn } from "../lib/utils";
11
+ import { useChartDataOverride } from "./chart-data-override";
12
+ import { ParentSize } from "./chart-parent-size";
13
+ import {
14
+ defaultChartStatFlowFormat
15
+ } from "./chart-stat-flow";
16
+ import {
17
+ GaugeCenterDisc,
18
+ GaugeConicSector,
19
+ GaugeDots,
20
+ GaugeGlowFilter,
21
+ GaugeProgressRing,
22
+ GaugeSector,
23
+ GaugeSolidArc,
24
+ GaugeZoneBands,
25
+ progressRingExtent,
26
+ resolveCenterDiscOptions,
27
+ resolveDotsOptions,
28
+ resolveGlowOptions,
29
+ resolveProgressRingOptions,
30
+ resolveSectorOptions,
31
+ ZONE_BAND_WIDTH,
32
+ zoneColorAt
33
+ } from "./gauge-arc-layers";
34
+ import {
35
+ clamp01,
36
+ DEFAULT_GAUGE_SWEEP_TRANSITION,
37
+ GAUGE_TRACK_ENTER_TRANSITION,
38
+ GaugeNeedle,
39
+ GaugeRuler,
40
+ resolveNeedleOptions,
41
+ resolveRulerOptions,
42
+ rulerOutsideExtent,
43
+ useGaugeSweep,
44
+ useMotionValueApply
45
+ } from "./gauge-dial";
46
+ import {
47
+ GaugeLabelLayout,
48
+ GaugeLabelShell
49
+ } from "./gauge-label-layout";
50
+ import {
51
+ collectGaugeDefsElements,
52
+ createNotchPath,
53
+ DEFAULT_ACTIVE_FILL_OPACITY,
54
+ DEFAULT_ACTIVE_GRADIENT,
55
+ DEFAULT_INACTIVE_FILL_OPACITY,
56
+ DEFAULT_LINEAR_GAUGE_HEIGHT,
57
+ interpolateGaugeHex,
58
+ resolveGaugeActiveFill,
59
+ resolveGaugeBgFill
60
+ } from "./notch-gauge-shared";
61
+ import { PieCenterShell } from "./pie-center-shell";
62
+ const FILL_ENTER_DELAY = 0.12;
63
+ function GaugeNotchSvg({
64
+ notches,
65
+ width,
66
+ height,
67
+ notchCornerRadius,
68
+ cornerDepth,
69
+ geometryScrubbing,
70
+ fillProgress,
71
+ trackEnter,
72
+ defsChildren,
73
+ useThemePaletteGradient,
74
+ themeActiveGradientId,
75
+ resolvedInactiveFillOpacity,
76
+ resolvedActiveFillOpacity,
77
+ resolveBgFill,
78
+ resolveActiveFill,
79
+ overlay,
80
+ underlay,
81
+ extraDefs,
82
+ activeFilterId
83
+ }) {
84
+ const activeRefs = useRef([]);
85
+ const litAt = (progress, index) => clamp01(progress - index) * resolvedActiveFillOpacity;
86
+ useMotionValueApply(fillProgress, (progress) => {
87
+ for (const notch of notches) {
88
+ activeRefs.current[notch.index]?.setAttribute(
89
+ "fill-opacity",
90
+ String(litAt(progress, notch.index))
91
+ );
92
+ }
93
+ });
94
+ const paths = notches.map((notch) => ({
95
+ notch,
96
+ d: createNotchPath(notch.points, notchCornerRadius, cornerDepth)
97
+ }));
98
+ const initialProgress = fillProgress.get();
99
+ const animateTrack = trackEnter && !geometryScrubbing;
100
+ return /* @__PURE__ */ jsxs(
101
+ "svg",
102
+ {
103
+ "aria-hidden": "true",
104
+ className: "relative block w-full overflow-visible",
105
+ height,
106
+ viewBox: `0 0 ${width} ${height}`,
107
+ width,
108
+ children: [
109
+ defsChildren.length > 0 || useThemePaletteGradient || extraDefs ? /* @__PURE__ */ jsxs("defs", { children: [
110
+ extraDefs,
111
+ useThemePaletteGradient ? /* @__PURE__ */ jsxs(
112
+ "linearGradient",
113
+ {
114
+ id: themeActiveGradientId,
115
+ x1: "0%",
116
+ x2: "100%",
117
+ y1: "0%",
118
+ y2: "0%",
119
+ children: [
120
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "var(--chart-1)" }),
121
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "var(--chart-5)" })
122
+ ]
123
+ }
124
+ ) : null,
125
+ defsChildren
126
+ ] }) : null,
127
+ underlay,
128
+ /* @__PURE__ */ jsx(
129
+ m.g,
130
+ {
131
+ animate: { opacity: 1 },
132
+ initial: animateTrack ? { opacity: 0 } : false,
133
+ transition: GAUGE_TRACK_ENTER_TRANSITION,
134
+ children: paths.map(({ notch, d }) => /* @__PURE__ */ jsx(
135
+ "path",
136
+ {
137
+ d,
138
+ fill: resolveBgFill(notch.index),
139
+ fillOpacity: resolvedInactiveFillOpacity
140
+ },
141
+ `bg-${notch.index}`
142
+ ))
143
+ }
144
+ ),
145
+ /* @__PURE__ */ jsx("g", { filter: activeFilterId ? `url(#${activeFilterId})` : void 0, children: paths.map(({ notch, d }) => /* @__PURE__ */ jsx(
146
+ "path",
147
+ {
148
+ d,
149
+ fill: resolveActiveFill(notch),
150
+ fillOpacity: litAt(initialProgress, notch.index),
151
+ ref: (el) => {
152
+ activeRefs.current[notch.index] = el;
153
+ }
154
+ },
155
+ `active-${notch.index}`
156
+ )) }),
157
+ overlay ? /* @__PURE__ */ jsx(
158
+ m.g,
159
+ {
160
+ animate: { opacity: 1 },
161
+ initial: animateTrack ? { opacity: 0 } : false,
162
+ transition: GAUGE_TRACK_ENTER_TRANSITION,
163
+ children: overlay
164
+ }
165
+ ) : null
166
+ ]
167
+ }
168
+ );
169
+ }
170
+ function useGaugeFillState(props) {
171
+ const {
172
+ useGradient = false,
173
+ activeGradient,
174
+ inactiveGradient,
175
+ inactiveFill,
176
+ activeFill,
177
+ inactiveFillOpacity,
178
+ activeFillOpacity,
179
+ children,
180
+ totalNotches = 40
181
+ } = props;
182
+ const themeActiveGradientId = `gauge-theme-active-${useId().replace(/:/g, "")}`;
183
+ const defsChildren = useMemo(
184
+ () => collectGaugeDefsElements(children),
185
+ [children]
186
+ );
187
+ const hasCustomInactive = inactiveFill !== void 0 && inactiveFill.length > 0;
188
+ const hasCustomActive = activeFill !== void 0 && activeFill.length > 0;
189
+ const activeGrad0 = activeGradient?.[0] ?? DEFAULT_ACTIVE_GRADIENT[0];
190
+ const activeGrad1 = activeGradient?.[1] ?? DEFAULT_ACTIVE_GRADIENT[1];
191
+ const inactiveGrad0 = inactiveGradient?.[0] ?? activeGrad0;
192
+ const inactiveGrad1 = inactiveGradient?.[1] ?? activeGrad1;
193
+ const useThemePaletteGradient = useGradient && activeGradient === void 0;
194
+ return {
195
+ themeActiveGradientId,
196
+ defsChildren,
197
+ hasCustomInactive,
198
+ hasCustomActive,
199
+ activeGrad0,
200
+ activeGrad1,
201
+ inactiveGrad0,
202
+ inactiveGrad1,
203
+ useThemePaletteGradient,
204
+ solidGradientStops: useThemePaletteGradient ? ["var(--chart-1)", "var(--chart-5)"] : [activeGrad0, activeGrad1],
205
+ resolvedActiveFillOpacity: activeFillOpacity ?? DEFAULT_ACTIVE_FILL_OPACITY,
206
+ resolvedInactiveFillOpacity: inactiveFillOpacity ?? DEFAULT_INACTIVE_FILL_OPACITY,
207
+ totalNotches
208
+ };
209
+ }
210
+ function useGaugeMotion({
211
+ value,
212
+ activeNotches,
213
+ enterTransition,
214
+ enterStaggerScale = 1,
215
+ geometryScrubbing = false
216
+ }) {
217
+ const prefersReducedMotion = useReducedMotion();
218
+ const instant = Boolean(prefersReducedMotion) || geometryScrubbing;
219
+ const transition = enterTransition ?? DEFAULT_GAUGE_SWEEP_TRANSITION;
220
+ const stagger = Math.max(0.25, Math.min(2.5, enterStaggerScale));
221
+ const enterDelay = FILL_ENTER_DELAY * stagger;
222
+ const fillProgress = useGaugeSweep({
223
+ target: activeNotches,
224
+ transition,
225
+ enterDelay,
226
+ instant
227
+ });
228
+ const valueProgress = useGaugeSweep({
229
+ target: clamp01(value / 100),
230
+ transition,
231
+ enterDelay,
232
+ instant
233
+ });
234
+ return { fillProgress, valueProgress, trackEnter: !instant };
235
+ }
236
+ function computeArcLayout({
237
+ size,
238
+ rulerOptions,
239
+ ringOptions,
240
+ zones,
241
+ zoneDisplay,
242
+ notchLengthPercent,
243
+ arcStyle,
244
+ arcThickness,
245
+ needleTip
246
+ }) {
247
+ const rulerOutside = rulerOptions?.position === "outside";
248
+ const hasZones = zones != null && zones.length > 0;
249
+ const showZoneBand = hasZones && zoneDisplay !== "fill";
250
+ const zoneFill = hasZones && zoneDisplay !== "band" ? zones : void 0;
251
+ const zoneBandExtent = showZoneBand ? size * (0.02 + ZONE_BAND_WIDTH) : 0;
252
+ const ringExtent = ringOptions ? progressRingExtent(ringOptions, size) : 0;
253
+ const rulerExtent = rulerOutside && rulerOptions ? rulerOutsideExtent(rulerOptions, size) : 0;
254
+ const outsideReserve = ringExtent + zoneBandExtent + rulerExtent;
255
+ const outerRadius = (outsideReserve > 0 ? size * 0.47 : size * 0.42) - outsideReserve;
256
+ const depthFactor = Math.min(100, Math.max(5, notchLengthPercent)) / 100;
257
+ const notchLength = outerRadius / 3 * depthFactor;
258
+ const solidThickness = size * arcThickness;
259
+ const trackDepth = {
260
+ notches: notchLength,
261
+ solid: solidThickness,
262
+ none: 0
263
+ };
264
+ const innerRadius = outerRadius - trackDepth[arcStyle];
265
+ const ringWidth = size * (ringOptions?.width ?? 0.01);
266
+ const insideRulerDepth = rulerOptions && !rulerOutside ? size * ((rulerOptions.gap ?? 0.028) + (rulerOptions.majorLength ?? 0.05) + 0.02) : 0;
267
+ const needleReach = {
268
+ inner: innerRadius - size * 0.014,
269
+ outer: outerRadius,
270
+ edge: outerRadius + outsideReserve
271
+ };
272
+ return {
273
+ outerRadius,
274
+ innerRadius,
275
+ notchLength,
276
+ solidThickness,
277
+ showZoneBand,
278
+ zoneFill,
279
+ rulerOutside,
280
+ ringRadius: outerRadius + size * (ringOptions?.gap ?? 0.022) + ringWidth / 2,
281
+ zoneBandRadius: outerRadius + ringExtent + size * (0.02 + ZONE_BAND_WIDTH / 2),
282
+ outsideRulerAnchor: outerRadius + ringExtent + zoneBandExtent,
283
+ dotsRadius: innerRadius - size * 0.03 - insideRulerDepth,
284
+ needleReach: needleReach[needleTip ?? "inner"]
285
+ };
286
+ }
287
+ function ArcUnderlay(props) {
288
+ const { cx, cy, size, startAngle, endAngle, progress, layout } = props;
289
+ const shared = { cx, cy, startAngle, endAngle, progress };
290
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
291
+ props.sectorOptions ? /* @__PURE__ */ jsx(
292
+ GaugeSector,
293
+ {
294
+ ...shared,
295
+ options: props.sectorOptions,
296
+ radius: layout.outerRadius
297
+ }
298
+ ) : null,
299
+ props.dotsOptions ? /* @__PURE__ */ jsx(
300
+ GaugeDots,
301
+ {
302
+ ...shared,
303
+ options: props.dotsOptions,
304
+ outerRadius: layout.dotsRadius,
305
+ size
306
+ }
307
+ ) : null,
308
+ props.arcStyle === "solid" ? /* @__PURE__ */ jsx(
309
+ GaugeSolidArc,
310
+ {
311
+ ...shared,
312
+ fill: props.solidFill,
313
+ fillOpacity: props.fillOpacity,
314
+ glowFilterId: props.activeFilterId,
315
+ radius: layout.outerRadius - layout.solidThickness / 2,
316
+ thickness: layout.solidThickness,
317
+ trackColor: props.trackColor,
318
+ trackOpacity: props.trackOpacity,
319
+ zones: layout.zoneFill
320
+ }
321
+ ) : null
322
+ ] });
323
+ }
324
+ function ArcOverlay(props) {
325
+ const { cx, cy, size, startAngle, endAngle, progress, layout } = props;
326
+ const shared = { cx, cy, startAngle, endAngle, progress };
327
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
328
+ props.ringOptions ? /* @__PURE__ */ jsx(
329
+ GaugeProgressRing,
330
+ {
331
+ ...shared,
332
+ glowFilterId: props.activeFilterId,
333
+ options: props.ringOptions,
334
+ radius: layout.ringRadius,
335
+ size
336
+ }
337
+ ) : null,
338
+ layout.showZoneBand && props.zones ? /* @__PURE__ */ jsx(
339
+ GaugeZoneBands,
340
+ {
341
+ cx,
342
+ cy,
343
+ endAngle,
344
+ radius: layout.zoneBandRadius,
345
+ size,
346
+ startAngle,
347
+ zones: props.zones
348
+ }
349
+ ) : null,
350
+ props.rulerOptions ? /* @__PURE__ */ jsx(
351
+ GaugeRuler,
352
+ {
353
+ ...shared,
354
+ anchorRadius: layout.rulerOutside ? layout.outsideRulerAnchor : layout.innerRadius,
355
+ options: props.rulerOptions,
356
+ size
357
+ }
358
+ ) : null,
359
+ props.needleOptions ? /* @__PURE__ */ jsx(
360
+ GaugeNeedle,
361
+ {
362
+ ...shared,
363
+ options: props.needleOptions,
364
+ reach: layout.needleReach
365
+ }
366
+ ) : null,
367
+ props.discOptions ? /* @__PURE__ */ jsx(
368
+ GaugeCenterDisc,
369
+ {
370
+ cx,
371
+ cy,
372
+ options: props.discOptions,
373
+ size
374
+ }
375
+ ) : null
376
+ ] });
377
+ }
378
+ function ArcDefs({
379
+ cx,
380
+ cy,
381
+ radius,
382
+ glowId,
383
+ glowOptions,
384
+ solidGradientId,
385
+ stops
386
+ }) {
387
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
388
+ glowOptions ? /* @__PURE__ */ jsx(GaugeGlowFilter, { id: glowId, options: glowOptions }) : null,
389
+ solidGradientId ? /* @__PURE__ */ jsxs(
390
+ "linearGradient",
391
+ {
392
+ gradientUnits: "userSpaceOnUse",
393
+ id: solidGradientId,
394
+ x1: cx - radius,
395
+ x2: cx + radius,
396
+ y1: cy,
397
+ y2: cy,
398
+ children: [
399
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: stops[0] }),
400
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: stops[1] })
401
+ ]
402
+ }
403
+ ) : null
404
+ ] });
405
+ }
406
+ function fitSectorToDisc(sector, disc, size, outerRadius) {
407
+ if (!(sector && disc) || outerRadius <= 0) {
408
+ return sector;
409
+ }
410
+ const discEdge = size * (disc.radius ?? 0.19) + (disc.strokeWidth ?? 3) / 2;
411
+ return {
412
+ ...sector,
413
+ innerRadius: Math.max(sector.innerRadius ?? 0, discEdge / outerRadius)
414
+ };
415
+ }
416
+ function GaugeArcInner(props) {
417
+ const {
418
+ value,
419
+ totalNotches = 40,
420
+ spacing = 25,
421
+ notchCornerRadius = 0,
422
+ uniformWidth = false,
423
+ width,
424
+ height,
425
+ startAngle = 135,
426
+ endAngle = 405,
427
+ useGradient = false,
428
+ centerValue,
429
+ defaultLabel = "Total",
430
+ prefix,
431
+ suffix,
432
+ formatOptions = defaultChartStatFlowFormat,
433
+ inactiveFill,
434
+ activeFill,
435
+ notchLengthPercent = 100,
436
+ enterTransition,
437
+ enterStaggerScale = 1,
438
+ geometryScrubbing = false,
439
+ ruler,
440
+ needle,
441
+ arcStyle = "notches",
442
+ arcThickness = 0.035,
443
+ zones,
444
+ zoneDisplay = "band",
445
+ sector,
446
+ progressRing,
447
+ dots,
448
+ glow,
449
+ centerDisc
450
+ } = props;
451
+ const fillState = useGaugeFillState(props);
452
+ const size = Math.min(width, height);
453
+ const centerX = width / 2;
454
+ const centerY = height / 2;
455
+ const rulerOptions = resolveRulerOptions(ruler);
456
+ const needleOptions = resolveNeedleOptions(needle);
457
+ const ringOptions = resolveProgressRingOptions(progressRing);
458
+ const dotsOptions = resolveDotsOptions(dots);
459
+ const glowOptions = resolveGlowOptions(glow);
460
+ const discOptions = resolveCenterDiscOptions(centerDisc);
461
+ const layout = computeArcLayout({
462
+ size,
463
+ rulerOptions,
464
+ ringOptions,
465
+ zones,
466
+ zoneDisplay,
467
+ notchLengthPercent,
468
+ arcStyle,
469
+ arcThickness,
470
+ needleTip: needleOptions?.tip
471
+ });
472
+ const { outerRadius, innerRadius, notchLength } = layout;
473
+ const sectorOptions = fitSectorToDisc(
474
+ resolveSectorOptions(sector),
475
+ discOptions,
476
+ size,
477
+ outerRadius
478
+ );
479
+ const glowId = `gauge-glow-${useId().replace(/:/g, "")}`;
480
+ const solidGradientId = `${glowId}-solid`;
481
+ const activeFilterId = glowOptions ? glowId : void 0;
482
+ const activeNotches = arcStyle === "notches" ? Math.round(value / 100 * totalNotches) : 0;
483
+ const motion = useGaugeMotion({
484
+ value,
485
+ activeNotches,
486
+ enterTransition,
487
+ enterStaggerScale,
488
+ geometryScrubbing
489
+ });
490
+ const totalAngle = endAngle - startAngle;
491
+ const availableAngle = totalAngle * (1 - spacing / 100);
492
+ const notchAngle = totalNotches > 0 ? availableAngle / totalNotches : 0;
493
+ const gapDen = totalNotches - 1 > 0 ? totalNotches - 1 : 1;
494
+ const gapAngle = totalAngle * (spacing / 100) / gapDen;
495
+ const notchCount = arcStyle === "notches" ? totalNotches : 0;
496
+ const notches = useMemo(() => {
497
+ return Array.from({ length: notchCount }, (_, i) => {
498
+ const angle = startAngle + i * (notchAngle + gapAngle) + notchAngle / 2;
499
+ const radians = angle * Math.PI / 180;
500
+ const arcNotchWidth = notchAngle * 0.8;
501
+ const halfWidth = arcNotchWidth * Math.PI / 180 / 2;
502
+ const x1 = centerX + Math.cos(radians - halfWidth) * outerRadius;
503
+ const y1 = centerY + Math.sin(radians - halfWidth) * outerRadius;
504
+ const x2 = centerX + Math.cos(radians + halfWidth) * outerRadius;
505
+ const y2 = centerY + Math.sin(radians + halfWidth) * outerRadius;
506
+ let x3;
507
+ let y3;
508
+ let x4;
509
+ let y4;
510
+ if (uniformWidth) {
511
+ const perpX = Math.cos(radians);
512
+ const perpY = Math.sin(radians);
513
+ x3 = x2 - perpX * notchLength;
514
+ y3 = y2 - perpY * notchLength;
515
+ x4 = x1 - perpX * notchLength;
516
+ y4 = y1 - perpY * notchLength;
517
+ } else {
518
+ x3 = centerX + Math.cos(radians + halfWidth) * innerRadius;
519
+ y3 = centerY + Math.sin(radians + halfWidth) * innerRadius;
520
+ x4 = centerX + Math.cos(radians - halfWidth) * innerRadius;
521
+ y4 = centerY + Math.sin(radians - halfWidth) * innerRadius;
522
+ }
523
+ const denom = totalNotches > 1 ? totalNotches - 1 : 1;
524
+ const gradientColor = useGradient && !fillState.useThemePaletteGradient ? interpolateGaugeHex(
525
+ fillState.activeGrad0,
526
+ fillState.activeGrad1,
527
+ i / denom
528
+ ) : "var(--chart-1)";
529
+ return {
530
+ index: i,
531
+ points: { x1, y1, x2, y2, x3, y3, x4, y4 },
532
+ isActive: i < activeNotches,
533
+ gradientColor,
534
+ xCenter: centerX,
535
+ yCenter: centerY
536
+ };
537
+ });
538
+ }, [
539
+ notchCount,
540
+ totalNotches,
541
+ notchAngle,
542
+ gapAngle,
543
+ centerX,
544
+ centerY,
545
+ outerRadius,
546
+ innerRadius,
547
+ activeNotches,
548
+ startAngle,
549
+ uniformWidth,
550
+ notchLength,
551
+ useGradient,
552
+ fillState.useThemePaletteGradient,
553
+ fillState.activeGrad0,
554
+ fillState.activeGrad1
555
+ ]);
556
+ const resolveBgFill = (notchIndex) => resolveGaugeBgFill({
557
+ notchIndex,
558
+ totalNotches,
559
+ hasCustomInactive: fillState.hasCustomInactive,
560
+ inactiveFill,
561
+ useThemePaletteGradient: fillState.useThemePaletteGradient,
562
+ useGradient,
563
+ inactiveGrad0: fillState.inactiveGrad0,
564
+ inactiveGrad1: fillState.inactiveGrad1,
565
+ arcTrackFill: "var(--chart-border)",
566
+ linearTrackFill: "var(--chart-background)",
567
+ linearMode: false
568
+ });
569
+ const resolveActiveFill = (notch) => zoneColorAt(
570
+ layout.zoneFill,
571
+ (notch.index + 0.5) / Math.max(1, totalNotches)
572
+ ) ?? resolveGaugeActiveFill({
573
+ notch,
574
+ hasCustomActive: fillState.hasCustomActive,
575
+ activeFill,
576
+ useThemePaletteGradient: fillState.useThemePaletteGradient,
577
+ themeActiveGradientId: fillState.themeActiveGradientId,
578
+ useGradient,
579
+ activeFillSolid: "var(--chart-1)"
580
+ });
581
+ const solidUsesGradient = useGradient && !fillState.hasCustomActive;
582
+ const solidGradientFill = solidUsesGradient ? `url(#${solidGradientId})` : "var(--chart-1)";
583
+ const solidFill = fillState.hasCustomActive && activeFill || solidGradientFill;
584
+ const showCenter = centerValue != null;
585
+ const isConic = (sectorOptions?.gradient ?? "conic") === "conic";
586
+ const conicSectorOptions = isConic ? sectorOptions : null;
587
+ const layerProps = {
588
+ cx: centerX,
589
+ cy: centerY,
590
+ size,
591
+ startAngle,
592
+ endAngle,
593
+ progress: motion.valueProgress,
594
+ layout,
595
+ arcStyle,
596
+ activeFilterId,
597
+ rulerOptions,
598
+ needleOptions,
599
+ ringOptions,
600
+ sectorOptions: isConic ? null : sectorOptions,
601
+ dotsOptions,
602
+ discOptions,
603
+ zones,
604
+ solidFill,
605
+ fillOpacity: fillState.resolvedActiveFillOpacity,
606
+ trackColor: fillState.hasCustomInactive && inactiveFill ? inactiveFill : "var(--chart-border)",
607
+ trackOpacity: fillState.resolvedInactiveFillOpacity
608
+ };
609
+ const extraDefs = glowOptions || solidUsesGradient ? /* @__PURE__ */ jsx(
610
+ ArcDefs,
611
+ {
612
+ cx: centerX,
613
+ cy: centerY,
614
+ glowId,
615
+ glowOptions,
616
+ radius: outerRadius,
617
+ solidGradientId: solidUsesGradient ? solidGradientId : void 0,
618
+ stops: fillState.solidGradientStops
619
+ }
620
+ ) : null;
621
+ return /* @__PURE__ */ jsxs("div", { className: "relative w-full", style: { height, width }, children: [
622
+ conicSectorOptions ? /* @__PURE__ */ jsx(
623
+ GaugeConicSector,
624
+ {
625
+ cx: centerX,
626
+ cy: centerY,
627
+ endAngle,
628
+ options: conicSectorOptions,
629
+ progress: motion.valueProgress,
630
+ radius: outerRadius,
631
+ startAngle
632
+ }
633
+ ) : null,
634
+ /* @__PURE__ */ jsx(
635
+ GaugeNotchSvg,
636
+ {
637
+ activeFilterId,
638
+ cornerDepth: notchLength,
639
+ defsChildren: fillState.defsChildren,
640
+ extraDefs,
641
+ fillProgress: motion.fillProgress,
642
+ geometryScrubbing,
643
+ height,
644
+ notchCornerRadius,
645
+ notches,
646
+ overlay: /* @__PURE__ */ jsx(ArcOverlay, { ...layerProps }),
647
+ resolveActiveFill,
648
+ resolveBgFill,
649
+ resolvedActiveFillOpacity: fillState.resolvedActiveFillOpacity,
650
+ resolvedInactiveFillOpacity: fillState.resolvedInactiveFillOpacity,
651
+ themeActiveGradientId: fillState.themeActiveGradientId,
652
+ trackEnter: motion.trackEnter,
653
+ underlay: /* @__PURE__ */ jsx(ArcUnderlay, { ...layerProps }),
654
+ useThemePaletteGradient: fillState.useThemePaletteGradient,
655
+ width
656
+ }
657
+ ),
658
+ showCenter ? /* @__PURE__ */ jsx(
659
+ "div",
660
+ {
661
+ className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center",
662
+ style: { paddingTop: size * 0.08 },
663
+ children: /* @__PURE__ */ jsx(
664
+ PieCenterShell,
665
+ {
666
+ centerValue,
667
+ contextSize: size,
668
+ defaultLabel,
669
+ formatOptions,
670
+ innerRadiusPx: Math.max(size * 0.2, 52),
671
+ prefix,
672
+ suffix
673
+ }
674
+ )
675
+ }
676
+ ) : null
677
+ ] });
678
+ }
679
+ function GaugeLinearInner(props) {
680
+ const {
681
+ value,
682
+ totalNotches = 40,
683
+ spacing = 25,
684
+ notchCornerRadius = 0,
685
+ uniformWidth = true,
686
+ width,
687
+ height,
688
+ useGradient = false,
689
+ centerValue,
690
+ defaultLabel = "Total",
691
+ prefix,
692
+ suffix,
693
+ formatOptions = defaultChartStatFlowFormat,
694
+ labelPlacement = "top",
695
+ labelAlign = "start",
696
+ inactiveFill,
697
+ activeFill,
698
+ notchLengthPercent = 100,
699
+ notchWidthPercent = 80,
700
+ enterTransition,
701
+ enterStaggerScale = 1,
702
+ geometryScrubbing = false
703
+ } = props;
704
+ const fillState = useGaugeFillState(props);
705
+ const centerY = height / 2;
706
+ const depthFactor = Math.min(100, Math.max(5, notchLengthPercent)) / 100;
707
+ const outerOffset = height / 2 * depthFactor;
708
+ const taperRatio = 28 / 42;
709
+ const innerOffset = uniformWidth ? outerOffset : outerOffset * taperRatio;
710
+ const notchDepth = uniformWidth ? outerOffset * 2 : outerOffset - innerOffset;
711
+ const cornerVerticalDepth = uniformWidth ? notchDepth : outerOffset * 2;
712
+ const widthFactor = Math.min(100, Math.max(10, notchWidthPercent)) / 100;
713
+ const activeNotches = Math.round(value / 100 * totalNotches);
714
+ const motion = useGaugeMotion({
715
+ value,
716
+ activeNotches,
717
+ enterTransition,
718
+ enterStaggerScale,
719
+ geometryScrubbing
720
+ });
721
+ const availableWidth = width * (1 - spacing / 100);
722
+ const slotWidth = totalNotches > 0 ? availableWidth / totalNotches : 0;
723
+ const gapDen = totalNotches - 1 > 0 ? totalNotches - 1 : 1;
724
+ const gapWidth = width * (spacing / 100) / gapDen;
725
+ const notches = useMemo(() => {
726
+ return Array.from({ length: totalNotches }, (_, i) => {
727
+ const xCenter = i * (slotWidth + gapWidth) + slotWidth / 2;
728
+ const halfWidth = slotWidth * widthFactor / 2;
729
+ let x1;
730
+ let y1;
731
+ let x2;
732
+ let y2;
733
+ let x3;
734
+ let y3;
735
+ let x4;
736
+ let y4;
737
+ if (uniformWidth) {
738
+ const halfHeight = notchDepth / 2;
739
+ x1 = xCenter - halfWidth;
740
+ y1 = centerY - halfHeight;
741
+ x2 = xCenter + halfWidth;
742
+ y2 = centerY - halfHeight;
743
+ x3 = xCenter + halfWidth;
744
+ y3 = centerY + halfHeight;
745
+ x4 = xCenter - halfWidth;
746
+ y4 = centerY + halfHeight;
747
+ } else {
748
+ x1 = xCenter - halfWidth;
749
+ y1 = centerY - outerOffset;
750
+ x2 = xCenter + halfWidth;
751
+ y2 = centerY - outerOffset;
752
+ const innerHalfWidth = halfWidth * (innerOffset / outerOffset);
753
+ x3 = xCenter + innerHalfWidth;
754
+ y3 = centerY + outerOffset;
755
+ x4 = xCenter - innerHalfWidth;
756
+ y4 = centerY + outerOffset;
757
+ }
758
+ const denom = totalNotches > 1 ? totalNotches - 1 : 1;
759
+ const gradientColor = useGradient && !fillState.useThemePaletteGradient ? interpolateGaugeHex(
760
+ fillState.activeGrad0,
761
+ fillState.activeGrad1,
762
+ i / denom
763
+ ) : "var(--chart-1)";
764
+ return {
765
+ index: i,
766
+ points: { x1, y1, x2, y2, x3, y3, x4, y4 },
767
+ isActive: i < activeNotches,
768
+ gradientColor,
769
+ xCenter,
770
+ yCenter: centerY
771
+ };
772
+ });
773
+ }, [
774
+ totalNotches,
775
+ slotWidth,
776
+ gapWidth,
777
+ centerY,
778
+ outerOffset,
779
+ innerOffset,
780
+ activeNotches,
781
+ uniformWidth,
782
+ notchDepth,
783
+ widthFactor,
784
+ useGradient,
785
+ fillState.useThemePaletteGradient,
786
+ fillState.activeGrad0,
787
+ fillState.activeGrad1
788
+ ]);
789
+ const resolveBgFill = (notchIndex) => resolveGaugeBgFill({
790
+ notchIndex,
791
+ totalNotches,
792
+ hasCustomInactive: fillState.hasCustomInactive,
793
+ inactiveFill,
794
+ useThemePaletteGradient: fillState.useThemePaletteGradient,
795
+ useGradient,
796
+ inactiveGrad0: fillState.inactiveGrad0,
797
+ inactiveGrad1: fillState.inactiveGrad1,
798
+ arcTrackFill: "var(--chart-border)",
799
+ linearTrackFill: "var(--chart-background)",
800
+ linearMode: true
801
+ });
802
+ const resolveActiveFill = (notch) => resolveGaugeActiveFill({
803
+ notch,
804
+ hasCustomActive: fillState.hasCustomActive,
805
+ activeFill,
806
+ useThemePaletteGradient: fillState.useThemePaletteGradient,
807
+ themeActiveGradientId: fillState.themeActiveGradientId,
808
+ useGradient,
809
+ activeFillSolid: "var(--chart-1)"
810
+ });
811
+ const label = centerValue == null ? null : /* @__PURE__ */ jsx(
812
+ GaugeLabelShell,
813
+ {
814
+ align: labelAlign,
815
+ centerValue,
816
+ defaultLabel,
817
+ formatOptions,
818
+ prefix,
819
+ suffix
820
+ }
821
+ );
822
+ const track = /* @__PURE__ */ jsx("div", { className: "relative w-full", style: { height, width }, children: /* @__PURE__ */ jsx(
823
+ GaugeNotchSvg,
824
+ {
825
+ cornerDepth: cornerVerticalDepth,
826
+ defsChildren: fillState.defsChildren,
827
+ fillProgress: motion.fillProgress,
828
+ geometryScrubbing,
829
+ height,
830
+ notchCornerRadius,
831
+ notches,
832
+ resolveActiveFill,
833
+ resolveBgFill,
834
+ resolvedActiveFillOpacity: fillState.resolvedActiveFillOpacity,
835
+ resolvedInactiveFillOpacity: fillState.resolvedInactiveFillOpacity,
836
+ themeActiveGradientId: fillState.themeActiveGradientId,
837
+ trackEnter: motion.trackEnter,
838
+ useThemePaletteGradient: fillState.useThemePaletteGradient,
839
+ width
840
+ }
841
+ ) });
842
+ return /* @__PURE__ */ jsx(
843
+ GaugeLabelLayout,
844
+ {
845
+ align: labelAlign,
846
+ label,
847
+ placement: labelPlacement,
848
+ children: track
849
+ }
850
+ );
851
+ }
852
+ function GaugeInner(props) {
853
+ if (props.orientation === "linear") {
854
+ return /* @__PURE__ */ jsx(GaugeLinearInner, { ...props });
855
+ }
856
+ return /* @__PURE__ */ jsx(GaugeArcInner, { ...props });
857
+ }
858
+ function Gauge({
859
+ width: widthProp,
860
+ height: heightProp,
861
+ className,
862
+ minWidth,
863
+ orientation = "arc",
864
+ linearHeight,
865
+ value: valueProp,
866
+ centerValue: centerValueProp,
867
+ zones: zonesProp,
868
+ ...gaugeProps
869
+ }) {
870
+ const { value, centerValue, zones } = useChartDataOverride("Gauge", {
871
+ value: valueProp,
872
+ centerValue: centerValueProp,
873
+ zones: zonesProp
874
+ });
875
+ const props = { ...gaugeProps, value, centerValue, zones };
876
+ const isLinear = orientation === "linear";
877
+ const resolvedMinWidth = minWidth ?? (isLinear ? 200 : 300);
878
+ const resolvedLinearHeight = linearHeight ?? DEFAULT_LINEAR_GAUGE_HEIGHT;
879
+ if (isLinear) {
880
+ if (widthProp != null) {
881
+ return /* @__PURE__ */ jsx(LazyMotion, { features: domAnimation, children: /* @__PURE__ */ jsx(
882
+ "div",
883
+ {
884
+ className: cn("relative w-full max-w-full", className),
885
+ style: { width: widthProp },
886
+ children: /* @__PURE__ */ jsx(
887
+ GaugeInner,
888
+ {
889
+ height: heightProp ?? resolvedLinearHeight,
890
+ orientation: "linear",
891
+ width: widthProp,
892
+ ...props
893
+ }
894
+ )
895
+ }
896
+ ) });
897
+ }
898
+ return /* @__PURE__ */ jsx(LazyMotion, { features: domAnimation, children: /* @__PURE__ */ jsx("div", { className: cn("relative w-full min-w-0 max-w-full", className), children: /* @__PURE__ */ jsx(
899
+ "div",
900
+ {
901
+ className: "w-full min-w-0",
902
+ style: { height: resolvedLinearHeight, minWidth: resolvedMinWidth },
903
+ children: /* @__PURE__ */ jsx(ParentSize, { debounceTime: 10, children: ({ width }) => width > 0 ? /* @__PURE__ */ jsx(
904
+ GaugeInner,
905
+ {
906
+ height: resolvedLinearHeight,
907
+ orientation: "linear",
908
+ width,
909
+ ...props
910
+ }
911
+ ) : null })
912
+ }
913
+ ) }) });
914
+ }
915
+ if (widthProp != null && heightProp != null) {
916
+ return /* @__PURE__ */ jsx(LazyMotion, { features: domAnimation, children: /* @__PURE__ */ jsx("div", { className: cn("relative inline-flex max-w-full", className), children: /* @__PURE__ */ jsx(
917
+ GaugeInner,
918
+ {
919
+ height: heightProp,
920
+ orientation: "arc",
921
+ width: widthProp,
922
+ ...props
923
+ }
924
+ ) }) });
925
+ }
926
+ return /* @__PURE__ */ jsx(LazyMotion, { features: domAnimation, children: /* @__PURE__ */ jsx(
927
+ "div",
928
+ {
929
+ className: cn("relative w-full max-w-full", className),
930
+ style: { minWidth: resolvedMinWidth },
931
+ children: /* @__PURE__ */ jsx("div", { className: "mx-auto aspect-[21/16] w-full max-w-[560px]", children: /* @__PURE__ */ jsx(ParentSize, { debounceTime: 10, children: ({ width, height }) => width > 0 && height > 0 ? /* @__PURE__ */ jsx(
932
+ GaugeInner,
933
+ {
934
+ height,
935
+ orientation: "arc",
936
+ width,
937
+ ...props
938
+ }
939
+ ) : null }) })
940
+ }
941
+ ) });
942
+ }
943
+ Gauge.displayName = "Gauge";
944
+ export {
945
+ Gauge
946
+ };