@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,376 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ domAnimation,
5
+ frameData,
6
+ JSAnimation,
7
+ LazyMotion,
8
+ m,
9
+ useMotionValue,
10
+ useReducedMotion,
11
+ useSpring
12
+ } from "motion/react";
13
+ import {
14
+ memo,
15
+ useLayoutEffect,
16
+ useMemo,
17
+ useRef
18
+ } from "react";
19
+ import { cn } from "../../lib/utils";
20
+ import {
21
+ DATE_TICKER_GLASS_CLASS,
22
+ LiquidGlassFilter,
23
+ useLiquidGlass
24
+ } from "./liquid-glass";
25
+ const TICKER_ITEM_HEIGHT = 24;
26
+ const TICKER_SPRING = { stiffness: 400, damping: 35 };
27
+ const COMPACT_TICKER_THRESHOLD = 60;
28
+ function driveSpring(value, target, instant) {
29
+ if (instant) {
30
+ value.jump(target);
31
+ } else {
32
+ value.set(target);
33
+ }
34
+ }
35
+ function toSegments(values) {
36
+ const segments = [];
37
+ values.forEach((value, index) => {
38
+ if (segments.at(-1)?.value !== value) {
39
+ segments.push({ value, key: `${value}-${index}`, startIndex: index });
40
+ }
41
+ });
42
+ return segments;
43
+ }
44
+ function segmentIndexAt(segments, index, total) {
45
+ if (index < 0 || index >= total) {
46
+ return 0;
47
+ }
48
+ for (let i = segments.length - 1; i >= 0; i--) {
49
+ const segment = segments[i];
50
+ if (segment && segment.startIndex <= index) {
51
+ return i;
52
+ }
53
+ }
54
+ return 0;
55
+ }
56
+ function useActiveItemWidth(stackRef, items, activeIndex, width, reduceMotion) {
57
+ const widthsRef = useRef([]);
58
+ const activeIndexRef = useRef(activeIndex);
59
+ const fontsPendingRef = useRef(false);
60
+ const mountedRef = useRef(true);
61
+ useLayoutEffect(() => {
62
+ activeIndexRef.current = activeIndex;
63
+ });
64
+ useLayoutEffect(() => {
65
+ mountedRef.current = true;
66
+ return () => {
67
+ mountedRef.current = false;
68
+ };
69
+ }, []);
70
+ useLayoutEffect(() => {
71
+ const measure = (snap) => {
72
+ const stack = stackRef.current;
73
+ if (!(mountedRef.current && stack)) {
74
+ return;
75
+ }
76
+ widthsRef.current = Array.from(
77
+ stack.querySelectorAll("[data-ticker-item]"),
78
+ (node) => node.getBoundingClientRect().width
79
+ );
80
+ const next = widthsRef.current[activeIndexRef.current];
81
+ if (next === void 0) {
82
+ return;
83
+ }
84
+ driveSpring(width, next, snap || reduceMotion);
85
+ };
86
+ measure(widthsRef.current.length === 0);
87
+ const fonts = typeof document === "undefined" ? void 0 : document.fonts;
88
+ if (fonts && fonts.status === "loading" && !fontsPendingRef.current) {
89
+ fontsPendingRef.current = true;
90
+ fonts.ready.then(() => {
91
+ fontsPendingRef.current = false;
92
+ measure(false);
93
+ });
94
+ }
95
+ }, [stackRef, items, width, reduceMotion]);
96
+ useLayoutEffect(() => {
97
+ const target = widthsRef.current[activeIndex];
98
+ if (target !== void 0) {
99
+ driveSpring(width, target, reduceMotion);
100
+ }
101
+ }, [activeIndex, width, reduceMotion]);
102
+ }
103
+ const DATE_TICKER_PILL_CLASS = "overflow-hidden rounded-full bg-chart-pill px-4 py-1 text-chart-pill-foreground shadow-lg";
104
+ function SolidSurface({
105
+ className,
106
+ style,
107
+ children
108
+ }) {
109
+ return /* @__PURE__ */ jsx(
110
+ "div",
111
+ {
112
+ className: cn(DATE_TICKER_PILL_CLASS, className),
113
+ "data-slot": "date-pill",
114
+ style,
115
+ children
116
+ }
117
+ );
118
+ }
119
+ function GlassSurface({
120
+ className,
121
+ style,
122
+ children
123
+ }) {
124
+ const surfaceRef = useRef(null);
125
+ const glass = useLiquidGlass();
126
+ return /* @__PURE__ */ jsxs(
127
+ "div",
128
+ {
129
+ className: cn(DATE_TICKER_GLASS_CLASS, className),
130
+ "data-slot": "date-pill",
131
+ "data-variant": "glass",
132
+ ref: surfaceRef,
133
+ style: { ...glass.style, ...style },
134
+ children: [
135
+ glass.svgFilter && /* @__PURE__ */ jsx(LiquidGlassFilter, { id: glass.filterId, surfaceRef }),
136
+ children
137
+ ]
138
+ }
139
+ );
140
+ }
141
+ function DateTickerSurface({
142
+ variant = "solid",
143
+ ...props
144
+ }) {
145
+ return variant === "glass" ? /* @__PURE__ */ jsx(GlassSurface, { ...props }) : /* @__PURE__ */ jsx(SolidSurface, { ...props });
146
+ }
147
+ const FRAME_MS = 1e3 / 60;
148
+ function useLabelWidth(labelRef, boxRef, width, reduceMotion) {
149
+ useLayoutEffect(() => {
150
+ const labelEl = labelRef.current;
151
+ if (!labelEl) {
152
+ return;
153
+ }
154
+ let animation = null;
155
+ const stop = () => {
156
+ animation?.stop();
157
+ animation = null;
158
+ };
159
+ const start = (target, startTime) => {
160
+ stop();
161
+ animation = new JSAnimation({
162
+ keyframes: [width.get(), target],
163
+ velocity: width.getVelocity(),
164
+ type: "spring",
165
+ restDelta: 1e-3,
166
+ restSpeed: 0.01,
167
+ ...TICKER_SPRING,
168
+ startTime,
169
+ onUpdate: (latest) => width.set(latest)
170
+ });
171
+ };
172
+ let measured = labelEl.getBoundingClientRect().width;
173
+ stop();
174
+ width.jump(measured);
175
+ const follow = (next) => {
176
+ if (reduceMotion) {
177
+ stop();
178
+ width.jump(next);
179
+ if (boxRef.current) {
180
+ boxRef.current.style.width = `${next}px`;
181
+ }
182
+ return;
183
+ }
184
+ const sinceFrame = performance.now() - frameData.timestamp;
185
+ start(
186
+ next,
187
+ sinceFrame >= 0 && sinceFrame < FRAME_MS ? frameData.timestamp : void 0
188
+ );
189
+ };
190
+ if (typeof ResizeObserver === "undefined") {
191
+ return stop;
192
+ }
193
+ const observer = new ResizeObserver(() => {
194
+ const next = labelEl.getBoundingClientRect().width;
195
+ if (next !== measured) {
196
+ measured = next;
197
+ follow(next);
198
+ }
199
+ });
200
+ observer.observe(labelEl, { box: "border-box" });
201
+ return () => {
202
+ observer.disconnect();
203
+ stop();
204
+ };
205
+ }, [labelRef, boxRef, width, reduceMotion]);
206
+ }
207
+ const DateTickerCompact = memo(function DateTickerCompact2({
208
+ currentIndex,
209
+ labels,
210
+ className,
211
+ style,
212
+ variant
213
+ }) {
214
+ const reduceMotion = useReducedMotion() === true;
215
+ const label = labels[currentIndex] ?? labels[0] ?? "";
216
+ const labelRef = useRef(null);
217
+ const boxRef = useRef(null);
218
+ const width = useMotionValue(0);
219
+ useLabelWidth(labelRef, boxRef, width, reduceMotion);
220
+ return /* @__PURE__ */ jsx(DateTickerSurface, { className, style, variant, children: /* @__PURE__ */ jsx(m.div, { className: "relative h-6", ref: boxRef, style: { width }, children: /* @__PURE__ */ jsx(
221
+ m.div,
222
+ {
223
+ className: "absolute top-0 left-1/2 flex h-6 items-center",
224
+ style: { x: "-50%" },
225
+ children: /* @__PURE__ */ jsx(
226
+ "span",
227
+ {
228
+ className: "whitespace-nowrap font-medium text-sm",
229
+ "data-ticker-item": true,
230
+ ref: labelRef,
231
+ children: label
232
+ }
233
+ )
234
+ }
235
+ ) }) });
236
+ });
237
+ const DateTickerInner = memo(function DateTickerInner2({
238
+ currentIndex,
239
+ labels,
240
+ className,
241
+ style,
242
+ variant
243
+ }) {
244
+ const reduceMotion = useReducedMotion() === true;
245
+ const parsedLabels = useMemo(() => {
246
+ return labels.map((label) => {
247
+ const parts = label.split(" ");
248
+ return { month: parts[0] || "", day: parts[1] || "" };
249
+ });
250
+ }, [labels]);
251
+ const monthSegments = useMemo(
252
+ () => toSegments(parsedLabels.map((label) => label.month)),
253
+ [parsedLabels]
254
+ );
255
+ const daySegments = useMemo(
256
+ () => toSegments(parsedLabels.map((label) => label.day)),
257
+ [parsedLabels]
258
+ );
259
+ const currentMonthIndex = segmentIndexAt(
260
+ monthSegments,
261
+ currentIndex,
262
+ parsedLabels.length
263
+ );
264
+ const currentDayIndex = segmentIndexAt(
265
+ daySegments,
266
+ currentIndex,
267
+ parsedLabels.length
268
+ );
269
+ const dayY = useSpring(0, TICKER_SPRING);
270
+ const monthY = useSpring(0, TICKER_SPRING);
271
+ const monthStackRef = useRef(null);
272
+ const dayStackRef = useRef(null);
273
+ const monthWidth = useSpring(0, TICKER_SPRING);
274
+ const dayWidth = useSpring(0, TICKER_SPRING);
275
+ useActiveItemWidth(
276
+ monthStackRef,
277
+ monthSegments,
278
+ currentMonthIndex,
279
+ monthWidth,
280
+ reduceMotion
281
+ );
282
+ useActiveItemWidth(
283
+ dayStackRef,
284
+ daySegments,
285
+ currentDayIndex,
286
+ dayWidth,
287
+ reduceMotion
288
+ );
289
+ useLayoutEffect(() => {
290
+ driveSpring(dayY, -currentDayIndex * TICKER_ITEM_HEIGHT, reduceMotion);
291
+ }, [currentDayIndex, dayY, reduceMotion]);
292
+ useLayoutEffect(() => {
293
+ driveSpring(monthY, -currentMonthIndex * TICKER_ITEM_HEIGHT, reduceMotion);
294
+ }, [currentMonthIndex, monthY, reduceMotion]);
295
+ return /* @__PURE__ */ jsx(DateTickerSurface, { className, style, variant, children: /* @__PURE__ */ jsx("div", { className: "relative h-6 overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-1", children: [
296
+ /* @__PURE__ */ jsx(
297
+ m.div,
298
+ {
299
+ className: "relative h-6 overflow-hidden",
300
+ style: { width: monthWidth },
301
+ children: /* @__PURE__ */ jsx(
302
+ m.div,
303
+ {
304
+ className: "absolute top-0 left-1/2 flex flex-col items-center",
305
+ ref: monthStackRef,
306
+ style: { x: "-50%", y: monthY },
307
+ children: monthSegments.map((segment) => /* @__PURE__ */ jsx(
308
+ "div",
309
+ {
310
+ className: "flex h-6 shrink-0 items-center justify-center",
311
+ "data-ticker-item": true,
312
+ children: /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap font-medium text-sm", children: segment.value })
313
+ },
314
+ segment.key
315
+ ))
316
+ }
317
+ )
318
+ }
319
+ ),
320
+ /* @__PURE__ */ jsx(
321
+ m.div,
322
+ {
323
+ className: "relative h-6 overflow-hidden",
324
+ style: { width: dayWidth },
325
+ children: /* @__PURE__ */ jsx(
326
+ m.div,
327
+ {
328
+ className: "absolute top-0 left-1/2 flex flex-col items-center",
329
+ ref: dayStackRef,
330
+ style: { x: "-50%", y: dayY },
331
+ children: daySegments.map((segment) => /* @__PURE__ */ jsx(
332
+ "div",
333
+ {
334
+ className: "flex h-6 shrink-0 items-center justify-center",
335
+ "data-ticker-item": true,
336
+ children: /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap font-medium text-sm", children: segment.value })
337
+ },
338
+ segment.key
339
+ ))
340
+ }
341
+ )
342
+ }
343
+ )
344
+ ] }) }) });
345
+ });
346
+ function DateTicker({
347
+ currentIndex,
348
+ labels,
349
+ visible,
350
+ animation = "roll",
351
+ variant,
352
+ className,
353
+ style
354
+ }) {
355
+ if (!visible || labels.length === 0) {
356
+ return null;
357
+ }
358
+ const Variant = animation === "static" || labels.length > COMPACT_TICKER_THRESHOLD ? DateTickerCompact : DateTickerInner;
359
+ return /* @__PURE__ */ jsx(LazyMotion, { features: domAnimation, children: /* @__PURE__ */ jsx(
360
+ Variant,
361
+ {
362
+ className,
363
+ currentIndex,
364
+ labels,
365
+ style,
366
+ variant
367
+ }
368
+ ) });
369
+ }
370
+ DateTicker.displayName = "DateTicker";
371
+ var date_ticker_default = DateTicker;
372
+ export {
373
+ DATE_TICKER_PILL_CLASS,
374
+ DateTicker,
375
+ date_ticker_default as default
376
+ };
@@ -0,0 +1,32 @@
1
+ import {
2
+ ChartTooltip
3
+ } from "./chart-tooltip";
4
+ import {
5
+ CursorTooltipBox
6
+ } from "./cursor-tooltip-box";
7
+ import {
8
+ DATE_TICKER_PILL_CLASS,
9
+ DateTicker
10
+ } from "./date-ticker";
11
+ import { DATE_TICKER_GLASS_CLASS } from "./liquid-glass";
12
+ import { TooltipBox } from "./tooltip-box";
13
+ import {
14
+ TooltipContent,
15
+ TooltipHeader
16
+ } from "./tooltip-content";
17
+ import { TooltipDot } from "./tooltip-dot";
18
+ import {
19
+ TooltipIndicator
20
+ } from "./tooltip-indicator";
21
+ export {
22
+ ChartTooltip,
23
+ CursorTooltipBox,
24
+ DATE_TICKER_GLASS_CLASS,
25
+ DATE_TICKER_PILL_CLASS,
26
+ DateTicker,
27
+ TooltipBox,
28
+ TooltipContent,
29
+ TooltipDot,
30
+ TooltipHeader,
31
+ TooltipIndicator
32
+ };
@@ -0,0 +1,142 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ useId,
5
+ useLayoutEffect,
6
+ useRef
7
+ } from "react";
8
+ const MAP_WIDTH = 128;
9
+ const MAP_HEIGHT = 32;
10
+ const MAP_BORDER = 0.07;
11
+ const MAP_BLUR = 4;
12
+ const DISPLACEMENT_SCALE = -48;
13
+ const CHANNEL_OFFSETS = { r: 0, g: 6, b: 12 };
14
+ const SATURATION = 1.6;
15
+ function displacementMapUri() {
16
+ const radius = MAP_HEIGHT / 2;
17
+ const inset = Math.min(MAP_WIDTH, MAP_HEIGHT) * (MAP_BORDER / 2);
18
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${MAP_WIDTH} ${MAP_HEIGHT}" width="${MAP_WIDTH}" height="${MAP_HEIGHT}">
19
+ <defs>
20
+ <linearGradient id="r" x1="100%" y1="0%" x2="0%" y2="0%"><stop offset="0%" stop-color="#000"/><stop offset="100%" stop-color="#f00"/></linearGradient>
21
+ <linearGradient id="b" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" stop-color="#000"/><stop offset="100%" stop-color="#00f"/></linearGradient>
22
+ <filter id="s"><feGaussianBlur stdDeviation="${MAP_BLUR}"/></filter>
23
+ </defs>
24
+ <rect width="${MAP_WIDTH}" height="${MAP_HEIGHT}" fill="#000"/>
25
+ <rect width="${MAP_WIDTH}" height="${MAP_HEIGHT}" rx="${radius}" fill="url(#r)"/>
26
+ <rect width="${MAP_WIDTH}" height="${MAP_HEIGHT}" rx="${radius}" fill="url(#b)" style="mix-blend-mode:difference"/>
27
+ <rect x="${inset}" y="${inset}" width="${MAP_WIDTH - inset * 2}" height="${MAP_HEIGHT - inset * 2}" rx="${radius - inset}" fill="hsl(0 0% 50% / 0.93)" filter="url(#s)"/>
28
+ </svg>`;
29
+ return `data:image/svg+xml,${encodeURIComponent(svg)}`;
30
+ }
31
+ let cachedMapUri = null;
32
+ function getDisplacementMapUri() {
33
+ cachedMapUri ??= displacementMapUri();
34
+ return cachedMapUri;
35
+ }
36
+ let cachedSupport = null;
37
+ function supportsSvgBackdropFilter() {
38
+ if (cachedSupport !== null) {
39
+ return cachedSupport;
40
+ }
41
+ if (typeof window === "undefined" || typeof CSS === "undefined") {
42
+ return false;
43
+ }
44
+ const brands = navigator.userAgentData?.brands;
45
+ const isChromium = brands?.some((b) => b.brand === "Chromium") ?? false;
46
+ cachedSupport = isChromium && CSS.supports("backdrop-filter", "url(#bklit-glass)");
47
+ return cachedSupport;
48
+ }
49
+ const DATE_TICKER_GLASS_CLASS = "relative overflow-hidden rounded-full px-4 py-1 text-chart-foreground bg-chart-glass shadow-[inset_0_0_0_1px_rgb(255_255_255/0.35),inset_1.5px_2px_0_-1px_rgb(255_255_255/0.9),inset_-1.5px_-2px_0_-1px_rgb(255_255_255/0.5),inset_0_-8px_12px_-8px_rgb(255_255_255/0.4),0_6px_20px_rgb(0_0_0/0.12),0_1px_3px_rgb(0_0_0/0.1)] dark:shadow-[inset_0_0_0_1px_rgb(255_255_255/0.14),inset_1.5px_2px_0_-1px_rgb(255_255_255/0.45),inset_-1.5px_-2px_0_-1px_rgb(255_255_255/0.2),inset_0_-8px_12px_-8px_rgb(255_255_255/0.12),0_6px_20px_rgb(0_0_0/0.4)]";
50
+ const FALLBACK_BACKDROP = `blur(6px) saturate(${SATURATION})`;
51
+ function useLiquidGlass() {
52
+ const filterId = `bklit-glass-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
53
+ const svgFilter = supportsSvgBackdropFilter();
54
+ const backdrop = svgFilter ? `url(#${filterId}) saturate(${SATURATION})` : FALLBACK_BACKDROP;
55
+ return {
56
+ filterId,
57
+ svgFilter,
58
+ style: { backdropFilter: backdrop, WebkitBackdropFilter: backdrop }
59
+ };
60
+ }
61
+ function LiquidGlassFilter({
62
+ id,
63
+ surfaceRef
64
+ }) {
65
+ const imageRef = useRef(null);
66
+ useLayoutEffect(() => {
67
+ const surface = surfaceRef.current;
68
+ const image = imageRef.current;
69
+ if (!(surface && image)) {
70
+ return;
71
+ }
72
+ const sync = () => {
73
+ image.setAttribute("width", `${surface.offsetWidth}`);
74
+ image.setAttribute("height", `${surface.offsetHeight}`);
75
+ };
76
+ sync();
77
+ if (typeof ResizeObserver === "undefined") {
78
+ return;
79
+ }
80
+ const observer = new ResizeObserver(sync);
81
+ observer.observe(surface);
82
+ return () => observer.disconnect();
83
+ }, [surfaceRef]);
84
+ const channel = (key, matrix, result) => /* @__PURE__ */ jsxs(Fragment, { children: [
85
+ /* @__PURE__ */ jsx(
86
+ "feDisplacementMap",
87
+ {
88
+ in: "SourceGraphic",
89
+ in2: "map",
90
+ result: `${result}-displaced`,
91
+ scale: DISPLACEMENT_SCALE + CHANNEL_OFFSETS[key],
92
+ xChannelSelector: "R",
93
+ yChannelSelector: "B"
94
+ }
95
+ ),
96
+ /* @__PURE__ */ jsx(
97
+ "feColorMatrix",
98
+ {
99
+ in: `${result}-displaced`,
100
+ result,
101
+ type: "matrix",
102
+ values: matrix
103
+ }
104
+ )
105
+ ] });
106
+ return /* @__PURE__ */ jsx(
107
+ "svg",
108
+ {
109
+ "aria-hidden": "true",
110
+ className: "pointer-events-none absolute",
111
+ height: "0",
112
+ width: "0",
113
+ children: /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", { colorInterpolationFilters: "sRGB", id, children: [
114
+ /* @__PURE__ */ jsx(
115
+ "feImage",
116
+ {
117
+ height: MAP_HEIGHT,
118
+ href: getDisplacementMapUri(),
119
+ preserveAspectRatio: "none",
120
+ ref: imageRef,
121
+ result: "map",
122
+ width: MAP_WIDTH,
123
+ x: "0",
124
+ y: "0"
125
+ }
126
+ ),
127
+ channel("r", "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0", "red"),
128
+ channel("g", "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0", "green"),
129
+ channel("b", "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0", "blue"),
130
+ /* @__PURE__ */ jsx("feBlend", { in: "red", in2: "green", mode: "screen", result: "rg" }),
131
+ /* @__PURE__ */ jsx("feBlend", { in: "rg", in2: "blue", mode: "screen", result: "rgb" }),
132
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "rgb", stdDeviation: "0.3" })
133
+ ] }) })
134
+ }
135
+ );
136
+ }
137
+ export {
138
+ DATE_TICKER_GLASS_CLASS,
139
+ LiquidGlassFilter,
140
+ supportsSvgBackdropFilter,
141
+ useLiquidGlass
142
+ };