@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,479 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useId, useRef } from "react";
4
+ import { clamp01, useMotionValueApply } from "./gauge-dial";
5
+ const MIN_SWEEP = 0.01;
6
+ const MAX_SWEEP = 359.99;
7
+ function polar(cx, cy, r, deg) {
8
+ const rad = deg * Math.PI / 180;
9
+ return [cx + Math.cos(rad) * r, cy + Math.sin(rad) * r];
10
+ }
11
+ function arcStrokePath(cx, cy, r, a0, a1) {
12
+ const sweep = Math.min(MAX_SWEEP, a1 - a0);
13
+ if (sweep < MIN_SWEEP || r <= 0) {
14
+ return "";
15
+ }
16
+ const [x0, y0] = polar(cx, cy, r, a0);
17
+ const [x1, y1] = polar(cx, cy, r, a0 + sweep);
18
+ const large = sweep > 180 ? 1 : 0;
19
+ return `M ${x0} ${y0} A ${r} ${r} 0 ${large} 1 ${x1} ${y1}`;
20
+ }
21
+ function annularSectorPath(cx, cy, r0, r1, a0, a1) {
22
+ const sweep = Math.min(MAX_SWEEP, a1 - a0);
23
+ if (sweep < MIN_SWEEP) {
24
+ return "";
25
+ }
26
+ const end = a0 + sweep;
27
+ const large = sweep > 180 ? 1 : 0;
28
+ const [ox0, oy0] = polar(cx, cy, r1, a0);
29
+ const [ox1, oy1] = polar(cx, cy, r1, end);
30
+ if (r0 <= 0.5) {
31
+ return `M ${cx} ${cy} L ${ox0} ${oy0} A ${r1} ${r1} 0 ${large} 1 ${ox1} ${oy1} Z`;
32
+ }
33
+ const [ix1, iy1] = polar(cx, cy, r0, end);
34
+ const [ix0, iy0] = polar(cx, cy, r0, a0);
35
+ return `M ${ox0} ${oy0} A ${r1} ${r1} 0 ${large} 1 ${ox1} ${oy1} L ${ix1} ${iy1} A ${r0} ${r0} 0 ${large} 0 ${ix0} ${iy0} Z`;
36
+ }
37
+ function zoneColorAt(zones, t) {
38
+ if (!zones) {
39
+ return;
40
+ }
41
+ const pct = t * 100;
42
+ for (let i = zones.length - 1; i >= 0; i--) {
43
+ const z = zones[i];
44
+ if (z && pct >= z.from && pct <= z.to) {
45
+ return z.color;
46
+ }
47
+ }
48
+ }
49
+ const ZONE_BAND_WIDTH = 0.014;
50
+ function GaugeZoneBands({
51
+ cx,
52
+ cy,
53
+ radius,
54
+ size,
55
+ startAngle,
56
+ endAngle,
57
+ zones,
58
+ opacity = 0.9
59
+ }) {
60
+ const sweep = endAngle - startAngle;
61
+ return /* @__PURE__ */ jsx("g", { children: zones.map((z) => /* @__PURE__ */ jsx(
62
+ "path",
63
+ {
64
+ d: arcStrokePath(
65
+ cx,
66
+ cy,
67
+ radius,
68
+ startAngle + clamp01(z.from / 100) * sweep,
69
+ startAngle + clamp01(z.to / 100) * sweep
70
+ ),
71
+ fill: "none",
72
+ stroke: z.color,
73
+ strokeOpacity: opacity,
74
+ strokeWidth: size * ZONE_BAND_WIDTH
75
+ },
76
+ `${z.from}-${z.to}-${z.color}`
77
+ )) });
78
+ }
79
+ function GaugeSolidArc({
80
+ cx,
81
+ cy,
82
+ radius,
83
+ thickness,
84
+ startAngle,
85
+ endAngle,
86
+ progress,
87
+ trackColor,
88
+ trackOpacity,
89
+ fill,
90
+ fillOpacity,
91
+ zones,
92
+ glowFilterId
93
+ }) {
94
+ const sweep = endAngle - startAngle;
95
+ const fillRef = useRef(null);
96
+ const zoneRefs = useRef([]);
97
+ const fillD = (p) => arcStrokePath(cx, cy, radius, startAngle, startAngle + p * sweep);
98
+ const zoneD = (z, p) => {
99
+ const from = clamp01(z.from / 100);
100
+ const to = Math.min(clamp01(z.to / 100), p);
101
+ return to > from ? arcStrokePath(
102
+ cx,
103
+ cy,
104
+ radius,
105
+ startAngle + from * sweep,
106
+ startAngle + to * sweep
107
+ ) : "";
108
+ };
109
+ useMotionValueApply(progress, (p) => {
110
+ fillRef.current?.setAttribute("d", fillD(p));
111
+ zones?.forEach((z, i) => {
112
+ zoneRefs.current[i]?.setAttribute("d", zoneD(z, p));
113
+ });
114
+ });
115
+ const p0 = progress.get();
116
+ return /* @__PURE__ */ jsxs("g", { children: [
117
+ /* @__PURE__ */ jsx(
118
+ "path",
119
+ {
120
+ d: arcStrokePath(cx, cy, radius, startAngle, endAngle),
121
+ fill: "none",
122
+ stroke: trackColor,
123
+ strokeLinecap: "round",
124
+ strokeOpacity: trackOpacity,
125
+ strokeWidth: thickness
126
+ }
127
+ ),
128
+ /* @__PURE__ */ jsxs("g", { filter: glowFilterId ? `url(#${glowFilterId})` : void 0, children: [
129
+ /* @__PURE__ */ jsx(
130
+ "path",
131
+ {
132
+ d: fillD(p0),
133
+ fill: "none",
134
+ ref: fillRef,
135
+ stroke: fill,
136
+ strokeLinecap: "round",
137
+ strokeOpacity: fillOpacity,
138
+ strokeWidth: thickness
139
+ }
140
+ ),
141
+ zones?.map((z, i) => /* @__PURE__ */ jsx(
142
+ "path",
143
+ {
144
+ d: zoneD(z, p0),
145
+ fill: "none",
146
+ ref: (el) => {
147
+ zoneRefs.current[i] = el;
148
+ },
149
+ stroke: z.color,
150
+ strokeOpacity: fillOpacity,
151
+ strokeWidth: thickness
152
+ },
153
+ `${z.from}-${z.to}-${z.color}`
154
+ ))
155
+ ] })
156
+ ] });
157
+ }
158
+ function resolveSectorOptions(sector) {
159
+ if (!sector) {
160
+ return null;
161
+ }
162
+ return sector === true ? {} : sector;
163
+ }
164
+ function GaugeSector({
165
+ cx,
166
+ cy,
167
+ radius,
168
+ startAngle,
169
+ endAngle,
170
+ progress,
171
+ options
172
+ }) {
173
+ const {
174
+ gradient = "conic",
175
+ color = "var(--chart-1)",
176
+ opacity = 0.85,
177
+ innerRadius = 0
178
+ } = options;
179
+ const gradientId = `gauge-sector-${useId().replace(/:/g, "")}`;
180
+ const ref = useRef(null);
181
+ const r0 = radius * clamp01(innerRadius);
182
+ const sweep = endAngle - startAngle;
183
+ const d = (p) => annularSectorPath(cx, cy, r0, radius, startAngle, startAngle + p * sweep);
184
+ useMotionValueApply(progress, (p) => {
185
+ ref.current?.setAttribute("d", d(p));
186
+ });
187
+ const isRadial = gradient === "radial";
188
+ return /* @__PURE__ */ jsxs("g", { children: [
189
+ isRadial ? /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
190
+ "radialGradient",
191
+ {
192
+ cx,
193
+ cy,
194
+ gradientUnits: "userSpaceOnUse",
195
+ id: gradientId,
196
+ r: radius,
197
+ children: [
198
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0 }),
199
+ /* @__PURE__ */ jsx(
200
+ "stop",
201
+ {
202
+ offset: `${Math.round(r0 / radius * 100)}%`,
203
+ stopColor: color,
204
+ stopOpacity: 0.04
205
+ }
206
+ ),
207
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: opacity })
208
+ ]
209
+ }
210
+ ) }) : null,
211
+ /* @__PURE__ */ jsx(
212
+ "path",
213
+ {
214
+ d: d(progress.get()),
215
+ fill: isRadial ? `url(#${gradientId})` : color,
216
+ fillOpacity: isRadial ? 1 : opacity,
217
+ ref
218
+ }
219
+ )
220
+ ] });
221
+ }
222
+ function GaugeConicSector({
223
+ cx,
224
+ cy,
225
+ radius,
226
+ startAngle,
227
+ endAngle,
228
+ progress,
229
+ options
230
+ }) {
231
+ const { color = "var(--chart-1)", opacity = 0.85, innerRadius = 0 } = options;
232
+ const ref = useRef(null);
233
+ const r0 = radius * clamp01(innerRadius);
234
+ const sweep = endAngle - startAngle;
235
+ const style = (p) => {
236
+ const deg = p * sweep;
237
+ const path = annularSectorPath(
238
+ cx,
239
+ cy,
240
+ r0,
241
+ radius,
242
+ startAngle,
243
+ startAngle + deg
244
+ );
245
+ return {
246
+ background: `conic-gradient(from ${startAngle + 90}deg at ${cx}px ${cy}px, transparent 0deg, ${color} ${Math.max(deg, 0.01)}deg, transparent ${Math.max(deg, 0.01)}deg)`,
247
+ clipPath: path ? `path("${path}")` : "inset(50%)"
248
+ };
249
+ };
250
+ useMotionValueApply(progress, (p) => {
251
+ const el = ref.current;
252
+ if (!el) {
253
+ return;
254
+ }
255
+ const next = style(p);
256
+ el.style.background = next.background;
257
+ el.style.clipPath = next.clipPath;
258
+ });
259
+ return /* @__PURE__ */ jsx(
260
+ "div",
261
+ {
262
+ "aria-hidden": "true",
263
+ className: "pointer-events-none absolute inset-0",
264
+ ref,
265
+ style: { ...style(progress.get()), opacity }
266
+ }
267
+ );
268
+ }
269
+ function resolveProgressRingOptions(ring) {
270
+ if (!ring) {
271
+ return null;
272
+ }
273
+ return ring === true ? {} : ring;
274
+ }
275
+ function progressRingExtent(options, size) {
276
+ return size * ((options.gap ?? 0.022) + (options.width ?? 0.01));
277
+ }
278
+ function GaugeProgressRing({
279
+ cx,
280
+ cy,
281
+ radius,
282
+ size,
283
+ startAngle,
284
+ endAngle,
285
+ progress,
286
+ options,
287
+ glowFilterId
288
+ }) {
289
+ const {
290
+ color = "var(--chart-1)",
291
+ trackColor = "var(--chart-foreground-muted)",
292
+ trackOpacity = 0.35,
293
+ width = 0.01
294
+ } = options;
295
+ const activeRef = useRef(null);
296
+ const restRef = useRef(null);
297
+ const sweep = endAngle - startAngle;
298
+ const at = (p) => startAngle + p * sweep;
299
+ useMotionValueApply(progress, (p) => {
300
+ activeRef.current?.setAttribute(
301
+ "d",
302
+ arcStrokePath(cx, cy, radius, startAngle, at(p))
303
+ );
304
+ restRef.current?.setAttribute(
305
+ "d",
306
+ arcStrokePath(cx, cy, radius, at(p), endAngle)
307
+ );
308
+ });
309
+ const p0 = progress.get();
310
+ const strokeWidth = Math.max(1, size * width);
311
+ return /* @__PURE__ */ jsxs("g", { children: [
312
+ /* @__PURE__ */ jsx(
313
+ "path",
314
+ {
315
+ d: arcStrokePath(cx, cy, radius, at(p0), endAngle),
316
+ fill: "none",
317
+ ref: restRef,
318
+ stroke: trackColor,
319
+ strokeOpacity: trackOpacity,
320
+ strokeWidth
321
+ }
322
+ ),
323
+ /* @__PURE__ */ jsx(
324
+ "path",
325
+ {
326
+ d: arcStrokePath(cx, cy, radius, startAngle, at(p0)),
327
+ fill: "none",
328
+ filter: glowFilterId ? `url(#${glowFilterId})` : void 0,
329
+ ref: activeRef,
330
+ stroke: color,
331
+ strokeWidth
332
+ }
333
+ )
334
+ ] });
335
+ }
336
+ function resolveDotsOptions(dots) {
337
+ if (!dots) {
338
+ return null;
339
+ }
340
+ return dots === true ? {} : dots;
341
+ }
342
+ function GaugeDots({
343
+ cx,
344
+ cy,
345
+ outerRadius,
346
+ size,
347
+ startAngle,
348
+ endAngle,
349
+ progress,
350
+ options
351
+ }) {
352
+ const {
353
+ rings = 5,
354
+ spacing = 0.03,
355
+ radius = 1.6,
356
+ color = "var(--chart-1)",
357
+ dimOpacity = 0.12,
358
+ litOpacity = 0.9,
359
+ fadeInward = true
360
+ } = options;
361
+ const step = Math.max(4, size * spacing);
362
+ const sweep = endAngle - startAngle;
363
+ const sweepRad = sweep * Math.PI / 180;
364
+ const ringCount = Math.max(1, Math.round(rings));
365
+ const dots = [];
366
+ for (let k = 0; k < ringCount; k++) {
367
+ const r = outerRadius - k * step;
368
+ if (r <= step) {
369
+ break;
370
+ }
371
+ const count = Math.max(2, Math.round(sweepRad * r / step));
372
+ const weight = fadeInward ? 1 - k / ringCount * 0.6 : 1;
373
+ for (let i = 0; i <= count; i++) {
374
+ const t = i / count;
375
+ const [x, y] = polar(cx, cy, r, startAngle + t * sweep);
376
+ dots.push({ x, y, t, weight });
377
+ }
378
+ }
379
+ const refs = useRef([]);
380
+ const opacityAt = (p, t, weight) => {
381
+ const lit = clamp01((p - t) * 60 + 1);
382
+ return (dimOpacity + (litOpacity - dimOpacity) * lit) * weight;
383
+ };
384
+ useMotionValueApply(progress, (p) => {
385
+ dots.forEach((dot, i) => {
386
+ refs.current[i]?.setAttribute(
387
+ "fill-opacity",
388
+ String(opacityAt(p, dot.t, dot.weight))
389
+ );
390
+ });
391
+ });
392
+ const p0 = progress.get();
393
+ return /* @__PURE__ */ jsx("g", { children: dots.map((dot, i) => /* @__PURE__ */ jsx(
394
+ "circle",
395
+ {
396
+ cx: dot.x,
397
+ cy: dot.y,
398
+ fill: color,
399
+ fillOpacity: opacityAt(p0, dot.t, dot.weight),
400
+ r: radius,
401
+ ref: (el) => {
402
+ refs.current[i] = el;
403
+ }
404
+ },
405
+ i
406
+ )) });
407
+ }
408
+ function resolveCenterDiscOptions(disc) {
409
+ if (!disc) {
410
+ return null;
411
+ }
412
+ return disc === true ? {} : disc;
413
+ }
414
+ function GaugeCenterDisc({
415
+ cx,
416
+ cy,
417
+ size,
418
+ options
419
+ }) {
420
+ const {
421
+ radius = 0.19,
422
+ fill = "var(--chart-background)",
423
+ stroke = "var(--chart-foreground)",
424
+ strokeOpacity = 0.75,
425
+ strokeWidth = 3
426
+ } = options;
427
+ return /* @__PURE__ */ jsx(
428
+ "circle",
429
+ {
430
+ cx,
431
+ cy,
432
+ fill,
433
+ r: size * radius,
434
+ stroke,
435
+ strokeOpacity,
436
+ strokeWidth
437
+ }
438
+ );
439
+ }
440
+ function resolveGlowOptions(glow) {
441
+ if (!glow) {
442
+ return null;
443
+ }
444
+ return glow === true ? {} : glow;
445
+ }
446
+ function GaugeGlowFilter({
447
+ id,
448
+ options
449
+ }) {
450
+ const { blur = 6, intensity = 0.8 } = options;
451
+ return /* @__PURE__ */ jsxs("filter", { height: "200%", id, width: "200%", x: "-50%", y: "-50%", children: [
452
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", result: "blur", stdDeviation: blur }),
453
+ /* @__PURE__ */ jsx("feComponentTransfer", { in: "blur", result: "glow", children: /* @__PURE__ */ jsx("feFuncA", { slope: intensity, type: "linear" }) }),
454
+ /* @__PURE__ */ jsxs("feMerge", { children: [
455
+ /* @__PURE__ */ jsx("feMergeNode", { in: "glow" }),
456
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
457
+ ] })
458
+ ] });
459
+ }
460
+ export {
461
+ GaugeCenterDisc,
462
+ GaugeConicSector,
463
+ GaugeDots,
464
+ GaugeGlowFilter,
465
+ GaugeProgressRing,
466
+ GaugeSector,
467
+ GaugeSolidArc,
468
+ GaugeZoneBands,
469
+ ZONE_BAND_WIDTH,
470
+ annularSectorPath,
471
+ arcStrokePath,
472
+ progressRingExtent,
473
+ resolveCenterDiscOptions,
474
+ resolveDotsOptions,
475
+ resolveGlowOptions,
476
+ resolveProgressRingOptions,
477
+ resolveSectorOptions,
478
+ zoneColorAt
479
+ };