@dudousxd/nestjs-catalog-react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/LICENSE-bklit +21 -0
  2. package/README.md +282 -0
  3. package/dist/AccessConsole.d.ts +40 -0
  4. package/dist/AccessConsole.js +160 -0
  5. package/dist/CatalogManager.d.ts +12 -0
  6. package/dist/CatalogManager.js +123 -0
  7. package/dist/ConnectionPanel.d.ts +41 -0
  8. package/dist/ConnectionPanel.js +228 -0
  9. package/dist/CoverageLedger.d.ts +16 -0
  10. package/dist/CoverageLedger.js +16 -0
  11. package/dist/DashboardBoard.d.ts +10 -0
  12. package/dist/DashboardBoard.js +206 -0
  13. package/dist/EditableField.d.ts +18 -0
  14. package/dist/EditableField.js +61 -0
  15. package/dist/FlowView.d.ts +13 -0
  16. package/dist/FlowView.js +93 -0
  17. package/dist/GovernanceTimeline.d.ts +16 -0
  18. package/dist/GovernanceTimeline.js +93 -0
  19. package/dist/ObjectExplorer.d.ts +9 -0
  20. package/dist/ObjectExplorer.js +153 -0
  21. package/dist/PipelineConsole.d.ts +20 -0
  22. package/dist/PipelineConsole.js +272 -0
  23. package/dist/QueryConsole.d.ts +11 -0
  24. package/dist/QueryConsole.js +144 -0
  25. package/dist/SavedQueryPanel.d.ts +16 -0
  26. package/dist/SavedQueryPanel.js +78 -0
  27. package/dist/TraceExplorer.d.ts +54 -0
  28. package/dist/TraceExplorer.js +342 -0
  29. package/dist/TransformEditor.d.ts +23 -0
  30. package/dist/TransformEditor.js +129 -0
  31. package/dist/WorkflowCanvas.d.ts +24 -0
  32. package/dist/WorkflowCanvas.js +701 -0
  33. package/dist/charts/bklit/animation.d.ts +19 -0
  34. package/dist/charts/bklit/animation.js +28 -0
  35. package/dist/charts/bklit/area-chart-loading.d.ts +33 -0
  36. package/dist/charts/bklit/area-chart-loading.js +30 -0
  37. package/dist/charts/bklit/area-chart.d.ts +47 -0
  38. package/dist/charts/bklit/area-chart.js +65 -0
  39. package/dist/charts/bklit/area-gradient-defs.d.ts +28 -0
  40. package/dist/charts/bklit/area-gradient-defs.js +23 -0
  41. package/dist/charts/bklit/area.d.ts +75 -0
  42. package/dist/charts/bklit/area.js +112 -0
  43. package/dist/charts/bklit/bar-chart-loading.d.ts +16 -0
  44. package/dist/charts/bklit/bar-chart-loading.js +22 -0
  45. package/dist/charts/bklit/bar-chart.d.ts +54 -0
  46. package/dist/charts/bklit/bar-chart.js +440 -0
  47. package/dist/charts/bklit/bar-depth-geometry.d.ts +41 -0
  48. package/dist/charts/bklit/bar-depth-geometry.js +46 -0
  49. package/dist/charts/bklit/bar-squares-layout.d.ts +36 -0
  50. package/dist/charts/bklit/bar-squares-layout.js +46 -0
  51. package/dist/charts/bklit/bar-squares.d.ts +48 -0
  52. package/dist/charts/bklit/bar-squares.js +206 -0
  53. package/dist/charts/bklit/bar-x-axis.d.ts +13 -0
  54. package/dist/charts/bklit/bar-x-axis.js +81 -0
  55. package/dist/charts/bklit/bar-y-axis.d.ts +11 -0
  56. package/dist/charts/bklit/bar-y-axis.js +72 -0
  57. package/dist/charts/bklit/bar.d.ts +40 -0
  58. package/dist/charts/bklit/bar.js +207 -0
  59. package/dist/charts/bklit/chart-child-passthrough.d.ts +25 -0
  60. package/dist/charts/bklit/chart-child-passthrough.js +82 -0
  61. package/dist/charts/bklit/chart-config-context.d.ts +34 -0
  62. package/dist/charts/bklit/chart-config-context.js +55 -0
  63. package/dist/charts/bklit/chart-context.d.ts +207 -0
  64. package/dist/charts/bklit/chart-context.js +200 -0
  65. package/dist/charts/bklit/chart-defs.d.ts +21 -0
  66. package/dist/charts/bklit/chart-defs.js +57 -0
  67. package/dist/charts/bklit/chart-formatters.d.ts +16 -0
  68. package/dist/charts/bklit/chart-formatters.js +26 -0
  69. package/dist/charts/bklit/chart-legend-hover.d.ts +21 -0
  70. package/dist/charts/bklit/chart-legend-hover.js +26 -0
  71. package/dist/charts/bklit/chart-loading-label.d.ts +9 -0
  72. package/dist/charts/bklit/chart-loading-label.js +29 -0
  73. package/dist/charts/bklit/chart-phase.d.ts +39 -0
  74. package/dist/charts/bklit/chart-phase.js +20 -0
  75. package/dist/charts/bklit/chart-reveal-clip.d.ts +32 -0
  76. package/dist/charts/bklit/chart-reveal-clip.js +23 -0
  77. package/dist/charts/bklit/dash-tail-stroke.d.ts +17 -0
  78. package/dist/charts/bklit/dash-tail-stroke.js +21 -0
  79. package/dist/charts/bklit/decimate-time-series.d.ts +18 -0
  80. package/dist/charts/bklit/decimate-time-series.js +120 -0
  81. package/dist/charts/bklit/fade-edges.d.ts +42 -0
  82. package/dist/charts/bklit/fade-edges.js +34 -0
  83. package/dist/charts/bklit/filter-data-by-x-domain.d.ts +13 -0
  84. package/dist/charts/bklit/filter-data-by-x-domain.js +50 -0
  85. package/dist/charts/bklit/generate-chart-skeleton-data.d.ts +24 -0
  86. package/dist/charts/bklit/generate-chart-skeleton-data.js +33 -0
  87. package/dist/charts/bklit/grid.d.ts +57 -0
  88. package/dist/charts/bklit/grid.js +88 -0
  89. package/dist/charts/bklit/highlight-segment-bounds.d.ts +26 -0
  90. package/dist/charts/bklit/highlight-segment-bounds.js +35 -0
  91. package/dist/charts/bklit/highlight-segment.d.ts +30 -0
  92. package/dist/charts/bklit/highlight-segment.js +22 -0
  93. package/dist/charts/bklit/indicator-fade.d.ts +23 -0
  94. package/dist/charts/bklit/indicator-fade.js +41 -0
  95. package/dist/charts/bklit/line-chart-loading.d.ts +33 -0
  96. package/dist/charts/bklit/line-chart-loading.js +30 -0
  97. package/dist/charts/bklit/line-chart.d.ts +45 -0
  98. package/dist/charts/bklit/line-chart.js +99 -0
  99. package/dist/charts/bklit/line-loading-pulse.d.ts +19 -0
  100. package/dist/charts/bklit/line-loading-pulse.js +132 -0
  101. package/dist/charts/bklit/line-loading-timing.d.ts +18 -0
  102. package/dist/charts/bklit/line-loading-timing.js +18 -0
  103. package/dist/charts/bklit/line-series-terminal-marker.d.ts +15 -0
  104. package/dist/charts/bklit/line-series-terminal-marker.js +54 -0
  105. package/dist/charts/bklit/line.d.ts +63 -0
  106. package/dist/charts/bklit/line.js +104 -0
  107. package/dist/charts/bklit/loading-sweep.d.ts +65 -0
  108. package/dist/charts/bklit/loading-sweep.js +182 -0
  109. package/dist/charts/bklit/motion-utils.d.ts +17 -0
  110. package/dist/charts/bklit/motion-utils.js +27 -0
  111. package/dist/charts/bklit/path-stroke-utils.d.ts +28 -0
  112. package/dist/charts/bklit/path-stroke-utils.js +64 -0
  113. package/dist/charts/bklit/pattern-area.d.ts +20 -0
  114. package/dist/charts/bklit/pattern-area.js +27 -0
  115. package/dist/charts/bklit/pattern-preset.d.ts +34 -0
  116. package/dist/charts/bklit/pattern-preset.js +82 -0
  117. package/dist/charts/bklit/projection-config.d.ts +19 -0
  118. package/dist/charts/bklit/projection-config.js +88 -0
  119. package/dist/charts/bklit/projection-line-end-marker.d.ts +14 -0
  120. package/dist/charts/bklit/projection-line-end-marker.js +35 -0
  121. package/dist/charts/bklit/projection-line.d.ts +39 -0
  122. package/dist/charts/bklit/projection-line.js +87 -0
  123. package/dist/charts/bklit/projection-utils.d.ts +54 -0
  124. package/dist/charts/bklit/projection-utils.js +252 -0
  125. package/dist/charts/bklit/reference-area-config.d.ts +18 -0
  126. package/dist/charts/bklit/reference-area-config.js +47 -0
  127. package/dist/charts/bklit/reference-area-registration-context.d.ts +7 -0
  128. package/dist/charts/bklit/reference-area-registration-context.js +15 -0
  129. package/dist/charts/bklit/series-bar-layout.d.ts +26 -0
  130. package/dist/charts/bklit/series-bar-layout.js +39 -0
  131. package/dist/charts/bklit/series-dash-tail-overlay.d.ts +16 -0
  132. package/dist/charts/bklit/series-dash-tail-overlay.js +47 -0
  133. package/dist/charts/bklit/series-highlight-layer.d.ts +31 -0
  134. package/dist/charts/bklit/series-highlight-layer.js +20 -0
  135. package/dist/charts/bklit/series-hover-dim.d.ts +28 -0
  136. package/dist/charts/bklit/series-hover-dim.js +34 -0
  137. package/dist/charts/bklit/series-markers.d.ts +13 -0
  138. package/dist/charts/bklit/series-markers.js +106 -0
  139. package/dist/charts/bklit/series-path-utils.d.ts +18 -0
  140. package/dist/charts/bklit/series-path-utils.js +68 -0
  141. package/dist/charts/bklit/series-point-marker.d.ts +47 -0
  142. package/dist/charts/bklit/series-point-marker.js +47 -0
  143. package/dist/charts/bklit/static-chart-preview-context.d.ts +15 -0
  144. package/dist/charts/bklit/static-chart-preview-context.js +20 -0
  145. package/dist/charts/bklit/time-series-chart-shell.d.ts +46 -0
  146. package/dist/charts/bklit/time-series-chart-shell.js +398 -0
  147. package/dist/charts/bklit/tooltip/chart-tooltip.d.ts +75 -0
  148. package/dist/charts/bklit/tooltip/chart-tooltip.js +158 -0
  149. package/dist/charts/bklit/tooltip/date-ticker.d.ts +10 -0
  150. package/dist/charts/bklit/tooltip/date-ticker.js +85 -0
  151. package/dist/charts/bklit/tooltip/index.d.ts +15 -0
  152. package/dist/charts/bklit/tooltip/index.js +15 -0
  153. package/dist/charts/bklit/tooltip/tooltip-box.d.ts +56 -0
  154. package/dist/charts/bklit/tooltip/tooltip-box.js +122 -0
  155. package/dist/charts/bklit/tooltip/tooltip-content.d.ts +26 -0
  156. package/dist/charts/bklit/tooltip/tooltip-content.js +8 -0
  157. package/dist/charts/bklit/tooltip/tooltip-dot.d.ts +27 -0
  158. package/dist/charts/bklit/tooltip/tooltip-dot.js +62 -0
  159. package/dist/charts/bklit/tooltip/tooltip-indicator.d.ts +44 -0
  160. package/dist/charts/bklit/tooltip/tooltip-indicator.js +73 -0
  161. package/dist/charts/bklit/use-animated-series-path.d.ts +18 -0
  162. package/dist/charts/bklit/use-animated-series-path.js +101 -0
  163. package/dist/charts/bklit/use-animated-y-domains.d.ts +13 -0
  164. package/dist/charts/bklit/use-animated-y-domains.js +158 -0
  165. package/dist/charts/bklit/use-chart-interaction.d.ts +40 -0
  166. package/dist/charts/bklit/use-chart-interaction.js +252 -0
  167. package/dist/charts/bklit/use-chart-phase-orchestrator.d.ts +22 -0
  168. package/dist/charts/bklit/use-chart-phase-orchestrator.js +147 -0
  169. package/dist/charts/bklit/use-enter-complete.d.ts +16 -0
  170. package/dist/charts/bklit/use-enter-complete.js +22 -0
  171. package/dist/charts/bklit/use-grid-shimmer.d.ts +15 -0
  172. package/dist/charts/bklit/use-grid-shimmer.js +71 -0
  173. package/dist/charts/bklit/use-highlight-segment.d.ts +22 -0
  174. package/dist/charts/bklit/use-highlight-segment.js +42 -0
  175. package/dist/charts/bklit/use-mount-progress.d.ts +12 -0
  176. package/dist/charts/bklit/use-mount-progress.js +30 -0
  177. package/dist/charts/bklit/use-scheduled-tooltip.d.ts +8 -0
  178. package/dist/charts/bklit/use-scheduled-tooltip.js +84 -0
  179. package/dist/charts/bklit/visx-pattern.d.ts +27 -0
  180. package/dist/charts/bklit/visx-pattern.js +28 -0
  181. package/dist/charts/bklit/x-axis.d.ts +26 -0
  182. package/dist/charts/bklit/x-axis.js +423 -0
  183. package/dist/charts/bklit/y-axis-scales.d.ts +34 -0
  184. package/dist/charts/bklit/y-axis-scales.js +80 -0
  185. package/dist/charts/bklit/y-axis-ticks.d.ts +20 -0
  186. package/dist/charts/bklit/y-axis-ticks.js +32 -0
  187. package/dist/charts/bklit/y-domain-utils.d.ts +26 -0
  188. package/dist/charts/bklit/y-domain-utils.js +96 -0
  189. package/dist/charts/bklit.d.ts +2 -0
  190. package/dist/charts/bklit.js +90 -0
  191. package/dist/charts/components/shimmering-text.d.ts +31 -0
  192. package/dist/charts/components/shimmering-text.js +39 -0
  193. package/dist/charts/css.d.ts +35 -0
  194. package/dist/charts/css.js +64 -0
  195. package/dist/charts/recharts.d.ts +28 -0
  196. package/dist/charts/recharts.js +48 -0
  197. package/dist/charts/registry.d.ts +34 -0
  198. package/dist/charts/registry.js +60 -0
  199. package/dist/charts/skeleton.d.ts +55 -0
  200. package/dist/charts/skeleton.js +66 -0
  201. package/dist/cn.d.ts +10 -0
  202. package/dist/cn.js +13 -0
  203. package/dist/context.d.ts +346 -0
  204. package/dist/context.js +95 -0
  205. package/dist/index.d.ts +30 -0
  206. package/dist/index.js +65 -0
  207. package/dist/routes.d.ts +70 -0
  208. package/dist/routes.js +73 -0
  209. package/dist/source-fields.d.ts +111 -0
  210. package/dist/source-fields.js +204 -0
  211. package/dist/ui/chart.d.ts +54 -0
  212. package/dist/ui/chart.js +122 -0
  213. package/dist/ui/dialog.d.ts +27 -0
  214. package/dist/ui/dialog.js +24 -0
  215. package/dist/ui/field.d.ts +29 -0
  216. package/dist/ui/field.js +31 -0
  217. package/dist/ui/select.d.ts +42 -0
  218. package/dist/ui/select.js +30 -0
  219. package/dist/ui/sheet.d.ts +38 -0
  220. package/dist/ui/sheet.js +37 -0
  221. package/dist/ui/switch.d.ts +17 -0
  222. package/dist/ui/switch.js +14 -0
  223. package/dist/ui/tabs.d.ts +30 -0
  224. package/dist/ui/tabs.js +36 -0
  225. package/dist/ui/tooltip.d.ts +37 -0
  226. package/dist/ui/tooltip.js +43 -0
  227. package/dist/workflow/graph.d.ts +112 -0
  228. package/dist/workflow/graph.js +297 -0
  229. package/dist/workflow/index.d.ts +16 -0
  230. package/dist/workflow/index.js +16 -0
  231. package/dist/workflow/model.d.ts +151 -0
  232. package/dist/workflow/model.js +97 -0
  233. package/dist/workflow/name.d.ts +28 -0
  234. package/dist/workflow/name.js +28 -0
  235. package/dist/workflow/nodes.d.ts +40 -0
  236. package/dist/workflow/nodes.js +86 -0
  237. package/dist/workflow/validate.d.ts +104 -0
  238. package/dist/workflow/validate.js +199 -0
  239. package/package.json +148 -0
@@ -0,0 +1,398 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * Vendored from bklit-ui — https://github.com/bklit/bklit-ui
5
+ * Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
6
+ * LICENSE-bklit at the root of this package.
7
+ *
8
+ * Local change: the `@/lib/utils` import was repointed at this package's own
9
+ * `cn`, which is the same function. Nothing else is modified, so re-syncing
10
+ * with upstream stays a diff rather than a merge.
11
+ */
12
+ import { scaleLinear, scaleTime } from '@visx/scale';
13
+ import { bisector, extent } from 'd3-array';
14
+ import { Children, cloneElement, isValidElement, memo, useCallback, useEffect, useMemo, useState, } from 'react';
15
+ import { DEFAULT_ANIMATION_EASING, DEFAULT_CHART_ENTER_TRANSITION } from './animation';
16
+ import { isClipExcludedComponent, isPostOverlayComponent, isUnderlayComponent, resolveChartChildElement, } from './chart-child-passthrough';
17
+ import { ChartProvider } from './chart-context';
18
+ import { isGradientDefComponent, isPatternDefComponent } from './chart-defs';
19
+ import { shortDateFmt } from './chart-formatters';
20
+ import { DEFAULT_CHART_STATUS, DEFAULT_Y_DOMAIN_TWEEN_MS, isChartInteractionPhase, } from './chart-phase';
21
+ import { ChartRevealClip } from './chart-reveal-clip';
22
+ import { decimateTimeSeries, maxRenderPointsForWidth } from './decimate-time-series';
23
+ import { filterDataByXDomain } from './filter-data-by-x-domain';
24
+ import { generateChartSkeletonData, generateChartSkeletonFromTarget, } from './generate-chart-skeleton-data';
25
+ import { extractProjectionLineConfigs, mergeProjectionXDomainMax, mergeProjectionYDomain, } from './projection-config';
26
+ import { extractReferenceAreaConfigs } from './reference-area-config';
27
+ import { ReferenceAreaRegistrationContext } from './reference-area-registration-context';
28
+ import { computeSeriesBarRevealClipPadding, computeSeriesBarWidth } from './series-bar-layout';
29
+ import { useStaticChartPreview } from './static-chart-preview-context';
30
+ import { useAnimatedYDomains } from './use-animated-y-domains';
31
+ import { useChartInteraction } from './use-chart-interaction';
32
+ import { useChartPhaseOrchestrator } from './use-chart-phase-orchestrator';
33
+ import { DEFAULT_Y_AXIS_ID, buildYScalesFromDomains, getPrimaryYScale, groupLinesByYAxisId, } from './y-axis-scales';
34
+ import { computeYDomainsByAxis } from './y-domain-utils';
35
+ function collectNumericExtents(data, dataKeys) {
36
+ let minValue = Number.POSITIVE_INFINITY;
37
+ let maxValue = Number.NEGATIVE_INFINITY;
38
+ for (const d of data) {
39
+ for (const key of dataKeys) {
40
+ const value = d[key];
41
+ if (typeof value === 'number') {
42
+ if (value < minValue) {
43
+ minValue = value;
44
+ }
45
+ if (value > maxValue) {
46
+ maxValue = value;
47
+ }
48
+ }
49
+ }
50
+ }
51
+ if (minValue === Number.POSITIVE_INFINITY) {
52
+ return { minValue: 0, maxValue: 100 };
53
+ }
54
+ return { minValue, maxValue };
55
+ }
56
+ function resolveTimeSeriesYDomain(data, dataKeys, yScaleDomainMax) {
57
+ if (yScaleDomainMax != null && yScaleDomainMax > 0) {
58
+ return [0, yScaleDomainMax * 1.1];
59
+ }
60
+ const { minValue, maxValue } = collectNumericExtents(data, dataKeys);
61
+ if (minValue >= 0) {
62
+ const top = maxValue <= 0 ? 100 : maxValue * 1.1;
63
+ return [0, top];
64
+ }
65
+ const padding = (maxValue - minValue) * 0.05 || 1;
66
+ return [minValue - padding, maxValue + padding];
67
+ }
68
+ function ensureChildKey(child, index) {
69
+ if (child.key != null) {
70
+ return child;
71
+ }
72
+ return cloneElement(child, { key: `chart-child-${index}` });
73
+ }
74
+ export function TimeSeriesChartInner(props) {
75
+ const { width, height } = props;
76
+ if (width < 10 || height < 10) {
77
+ return null;
78
+ }
79
+ return _jsx(TimeSeriesChartCore, { ...props });
80
+ }
81
+ const TimeSeriesChartCore = memo(function TimeSeriesChartCore({ width, height, data, xDataKey, margin, animationDuration, animationEasing = DEFAULT_ANIMATION_EASING, enterTransition, revealSignature = '', children, containerRef, lines, clipPathId, composedBarDataKeys, composedBarSize, composedMaxBarSize, composedBarGap, composedStacked, composedStackOffsets, composedStackGap, yScaleDomainMax, chartStatus = DEFAULT_CHART_STATUS, loadingLabel, yDomainTween = true, yDomainTweenDuration = DEFAULT_Y_DOMAIN_TWEEN_MS, xDomain, xDomainSlotCount, tweenYDomainOnXDomainChange = false, onPhaseChange, }) {
82
+ const staticPreview = useStaticChartPreview();
83
+ const innerWidth = width - margin.left - margin.right;
84
+ const innerHeight = height - margin.top - margin.bottom;
85
+ const resolveYDomain = useCallback((sourceData, dataKeys) => {
86
+ const axisGroups = groupLinesByYAxisId(lines);
87
+ const usesDefaultOnly = axisGroups.size === 1 && axisGroups.has(DEFAULT_Y_AXIS_ID);
88
+ const domainMax = usesDefaultOnly && yScaleDomainMax != null ? yScaleDomainMax : undefined;
89
+ return resolveTimeSeriesYDomain(sourceData, dataKeys, domainMax);
90
+ }, [lines, yScaleDomainMax]);
91
+ const skeletonData = useMemo(() => {
92
+ const primaryKey = lines[0]?.dataKey ?? 'value';
93
+ if (data.length === 0) {
94
+ return generateChartSkeletonData({ dataKey: primaryKey });
95
+ }
96
+ return generateChartSkeletonFromTarget(data, primaryKey);
97
+ }, [data, lines]);
98
+ const { chartPhase, plotData, revealEpoch, concealEpoch, isLoaded, notifyLoadingPulseComplete, notifyRevealConcealComplete, notifyYDomainTweenComplete, } = useChartPhaseOrchestrator({
99
+ animationDuration,
100
+ chartStatus,
101
+ revealSignature,
102
+ skeletonData,
103
+ skipEnterReveal: staticPreview,
104
+ targetData: data,
105
+ yDomainTweenDuration,
106
+ });
107
+ useEffect(() => {
108
+ onPhaseChange?.(chartPhase);
109
+ }, [chartPhase, onPhaseChange]);
110
+ const xAccessor = useCallback((d) => {
111
+ const value = d[xDataKey];
112
+ return value instanceof Date ? value : new Date(value);
113
+ }, [xDataKey]);
114
+ const bisectDate = useMemo(() => bisector((d) => xAccessor(d)).left, [xAccessor]);
115
+ const visiblePlotData = useMemo(() => {
116
+ if (!xDomain) {
117
+ return plotData;
118
+ }
119
+ return filterDataByXDomain(plotData, xDomain, xAccessor);
120
+ }, [plotData, xDomain, xAccessor]);
121
+ const projectionConfigs = useMemo(() => extractProjectionLineConfigs(children), [children]);
122
+ const xScale = useMemo(() => {
123
+ const minTime = xDomain
124
+ ? xDomain[0].getTime()
125
+ : (extent(plotData, (d) => xAccessor(d).getTime())[0] ?? 0);
126
+ let maxTime = xDomain
127
+ ? xDomain[1].getTime()
128
+ : (extent(plotData, (d) => xAccessor(d).getTime())[1] ?? minTime);
129
+ // Brush defines the viewport — projection horizon is included via brush
130
+ // track extent, not by extending past the selection on the main chart.
131
+ if (!xDomain) {
132
+ maxTime = mergeProjectionXDomainMax(maxTime, projectionConfigs);
133
+ }
134
+ return scaleTime({
135
+ range: [0, innerWidth],
136
+ domain: [minTime, maxTime],
137
+ });
138
+ }, [innerWidth, plotData, projectionConfigs, xAccessor, xDomain]);
139
+ // When brushing, keep the full series for path rendering so edge fades stay
140
+ // anchored to the viewport while the line pans through them. Y-domain and
141
+ // interaction still use the filtered visible slice.
142
+ const seriesSourceData = xDomain ? plotData : visiblePlotData;
143
+ const renderData = useMemo(() => {
144
+ const valueKeys = lines.map((line) => line.dataKey);
145
+ return decimateTimeSeries(seriesSourceData, maxRenderPointsForWidth(innerWidth), valueKeys);
146
+ }, [seriesSourceData, innerWidth, lines]);
147
+ const columnWidth = useMemo(() => {
148
+ const slotCount = xDomain && xDomainSlotCount != null ? xDomainSlotCount : visiblePlotData.length;
149
+ if (slotCount < 2) {
150
+ return 0;
151
+ }
152
+ return innerWidth / (slotCount - 1);
153
+ }, [innerWidth, visiblePlotData.length, xDomain, xDomainSlotCount]);
154
+ const yDomainSkeletonByAxis = useMemo(() => computeYDomainsByAxis({
155
+ lines,
156
+ resolveDomain: (dataKeys) => resolveYDomain(skeletonData, dataKeys),
157
+ }), [lines, resolveYDomain, skeletonData]);
158
+ const yDomainTargetByAxis = useMemo(() => {
159
+ const base = computeYDomainsByAxis({
160
+ lines,
161
+ resolveDomain: (dataKeys) => resolveYDomain(xDomain ? visiblePlotData : data, dataKeys),
162
+ });
163
+ if (projectionConfigs.length === 0) {
164
+ return base;
165
+ }
166
+ const merged = { ...base };
167
+ for (const axisId of Object.keys(base)) {
168
+ merged[axisId] = mergeProjectionYDomain(base[axisId] ?? [0, 100], projectionConfigs, axisId);
169
+ }
170
+ for (const config of projectionConfigs) {
171
+ if (!merged[config.yAxisId]) {
172
+ merged[config.yAxisId] = mergeProjectionYDomain([0, 100], projectionConfigs, config.yAxisId);
173
+ }
174
+ }
175
+ return merged;
176
+ }, [data, lines, projectionConfigs, resolveYDomain, visiblePlotData, xDomain]);
177
+ const animatedYDomainsByAxis = useAnimatedYDomains({
178
+ chartPhase,
179
+ durationMs: yDomainTweenDuration,
180
+ enabled: yDomainTween,
181
+ onSettled: notifyYDomainTweenComplete,
182
+ skeletonByAxis: yDomainSkeletonByAxis,
183
+ targetByAxis: yDomainTargetByAxis,
184
+ tweenOnTargetChange: yDomainTween || (tweenYDomainOnXDomainChange && xDomain != null),
185
+ });
186
+ const yDomainsForScales = animatedYDomainsByAxis;
187
+ const yScales = useMemo(() => buildYScalesFromDomains({
188
+ domainsByAxis: yDomainsForScales,
189
+ innerHeight,
190
+ lines,
191
+ }), [yDomainsForScales, innerHeight, lines]);
192
+ const yScale = getPrimaryYScale(yScales, scaleLinear({ range: [innerHeight, 0], domain: [0, 100], nice: true }));
193
+ const dateLabels = useMemo(() => visiblePlotData.map((d) => shortDateFmt.format(xAccessor(d))), [visiblePlotData, xAccessor]);
194
+ const canInteract = isLoaded && isChartInteractionPhase(chartPhase);
195
+ const { tooltipData, setTooltipData, selection, clearSelection, interactionHandlers, interactionStyle, } = useChartInteraction({
196
+ bisectDate,
197
+ canInteract,
198
+ data: visiblePlotData,
199
+ lines,
200
+ margin,
201
+ xAccessor,
202
+ xScale,
203
+ yScale,
204
+ yScales,
205
+ });
206
+ const defsChildren = [];
207
+ const clipExcludedChildren = [];
208
+ const underlayChildren = [];
209
+ const preOverlayChildren = [];
210
+ const postOverlayChildren = [];
211
+ Children.forEach(children, (child, index) => {
212
+ if (!isValidElement(child)) {
213
+ return;
214
+ }
215
+ const keyedChild = ensureChildKey(child, index);
216
+ const resolvedChild = resolveChartChildElement(keyedChild);
217
+ if (isGradientDefComponent(resolvedChild)) {
218
+ defsChildren.push(resolvedChild);
219
+ }
220
+ else if (isPatternDefComponent(resolvedChild)) {
221
+ preOverlayChildren.push(resolvedChild);
222
+ }
223
+ else if (isPostOverlayComponent(resolvedChild)) {
224
+ postOverlayChildren.push(resolvedChild);
225
+ }
226
+ else if (isClipExcludedComponent(resolvedChild)) {
227
+ clipExcludedChildren.push(resolvedChild);
228
+ }
229
+ else if (isUnderlayComponent(resolvedChild)) {
230
+ underlayChildren.push(resolvedChild);
231
+ }
232
+ else {
233
+ preOverlayChildren.push(resolvedChild);
234
+ }
235
+ });
236
+ const [registeredReferenceAreas, setRegisteredReferenceAreas] = useState(() => new Map());
237
+ const registerReferenceArea = useCallback((id, config) => {
238
+ setRegisteredReferenceAreas((prev) => {
239
+ const existing = prev.get(id);
240
+ if (existing &&
241
+ existing.yAxisId === config.yAxisId &&
242
+ existing.y1 === config.y1 &&
243
+ existing.y2 === config.y2 &&
244
+ existing.axisLabelColor === config.axisLabelColor) {
245
+ return prev;
246
+ }
247
+ const next = new Map(prev);
248
+ next.set(id, config);
249
+ return next;
250
+ });
251
+ }, []);
252
+ const unregisterReferenceArea = useCallback((id) => {
253
+ setRegisteredReferenceAreas((prev) => {
254
+ if (!prev.has(id)) {
255
+ return prev;
256
+ }
257
+ const next = new Map(prev);
258
+ next.delete(id);
259
+ return next;
260
+ });
261
+ }, []);
262
+ const referenceAreaRegistration = useMemo(() => ({ registerReferenceArea, unregisterReferenceArea }), [registerReferenceArea, unregisterReferenceArea]);
263
+ const referenceAreas = useMemo(() => {
264
+ const extracted = extractReferenceAreaConfigs(children);
265
+ const registered = [...registeredReferenceAreas.values()];
266
+ if (registered.length === 0) {
267
+ return extracted;
268
+ }
269
+ if (extracted.length === 0) {
270
+ return registered;
271
+ }
272
+ return [...extracted, ...registered];
273
+ }, [children, registeredReferenceAreas]);
274
+ const contextValue = useMemo(() => ({
275
+ data: visiblePlotData,
276
+ renderData,
277
+ xScale,
278
+ yScale,
279
+ yScales,
280
+ width,
281
+ height,
282
+ innerWidth,
283
+ innerHeight,
284
+ margin,
285
+ columnWidth,
286
+ tooltipData,
287
+ setTooltipData,
288
+ containerRef,
289
+ lines,
290
+ referenceAreas,
291
+ chartPhase,
292
+ chartStatus,
293
+ loadingLabel,
294
+ yDomainTweenDuration,
295
+ yDomainSkeletonByAxis,
296
+ yDomainTargetByAxis,
297
+ isLoaded,
298
+ animationDuration,
299
+ animationEasing,
300
+ enterTransition,
301
+ revealEpoch,
302
+ notifyLoadingPulseComplete,
303
+ xAccessor,
304
+ dateLabels,
305
+ xDomain,
306
+ xDomainSlotCount,
307
+ selection,
308
+ clearSelection,
309
+ composedBarDataKeys,
310
+ composedBarSize,
311
+ composedMaxBarSize,
312
+ composedBarGap,
313
+ composedStacked,
314
+ composedStackOffsets,
315
+ composedStackGap,
316
+ }), [
317
+ visiblePlotData,
318
+ renderData,
319
+ xScale,
320
+ yScale,
321
+ yScales,
322
+ width,
323
+ height,
324
+ innerWidth,
325
+ innerHeight,
326
+ margin,
327
+ columnWidth,
328
+ tooltipData,
329
+ setTooltipData,
330
+ containerRef,
331
+ lines,
332
+ referenceAreas,
333
+ chartPhase,
334
+ chartStatus,
335
+ loadingLabel,
336
+ yDomainTweenDuration,
337
+ yDomainSkeletonByAxis,
338
+ yDomainTargetByAxis,
339
+ isLoaded,
340
+ animationDuration,
341
+ animationEasing,
342
+ enterTransition,
343
+ revealEpoch,
344
+ notifyLoadingPulseComplete,
345
+ xAccessor,
346
+ dateLabels,
347
+ xDomain,
348
+ xDomainSlotCount,
349
+ selection,
350
+ clearSelection,
351
+ composedBarDataKeys,
352
+ composedBarSize,
353
+ composedMaxBarSize,
354
+ composedBarGap,
355
+ composedStacked,
356
+ composedStackOffsets,
357
+ composedStackGap,
358
+ ]);
359
+ const useClipReveal = !staticPreview && renderData.length > 1 && innerWidth > 0 && animationDuration > 0;
360
+ const isRevealAnimating = chartPhase === 'revealing';
361
+ const isRevealConcealing = chartPhase === 'exitingReady' && animationDuration > 0;
362
+ const effectiveEnterTransition = enterTransition ??
363
+ {
364
+ ...DEFAULT_CHART_ENTER_TRANSITION,
365
+ duration: animationDuration / 1000,
366
+ };
367
+ const revealClipPadding = useMemo(() => {
368
+ if (!composedBarDataKeys?.length) {
369
+ return 0;
370
+ }
371
+ const barWidth = computeSeriesBarWidth({
372
+ columnWidth,
373
+ composedBarGap,
374
+ composedBarSize,
375
+ composedMaxBarSize,
376
+ dataLength: plotData.length,
377
+ innerWidth,
378
+ seriesCount: composedBarDataKeys.length,
379
+ stacked: composedStacked,
380
+ });
381
+ return computeSeriesBarRevealClipPadding({
382
+ barWidth,
383
+ gap: composedBarGap,
384
+ seriesCount: composedBarDataKeys.length,
385
+ stacked: composedStacked,
386
+ });
387
+ }, [
388
+ columnWidth,
389
+ composedBarDataKeys,
390
+ composedBarGap,
391
+ composedBarSize,
392
+ composedMaxBarSize,
393
+ composedStacked,
394
+ innerWidth,
395
+ plotData.length,
396
+ ]);
397
+ return (_jsx(ReferenceAreaRegistrationContext.Provider, { value: referenceAreaRegistration, children: _jsx(ChartProvider, { value: contextValue, children: _jsxs("svg", { "aria-hidden": "true", height: height, width: width, children: [_jsxs("defs", { children: [defsChildren, useClipReveal ? (_jsx(ChartRevealClip, { animating: isRevealAnimating || isRevealConcealing, clipPathId: clipPathId, enterTransition: effectiveEnterTransition, height: innerHeight + 20, mode: isRevealConcealing ? 'conceal' : 'reveal', onComplete: isRevealConcealing ? notifyRevealConcealComplete : undefined, padding: revealClipPadding, revealEpoch: isRevealConcealing ? concealEpoch : revealEpoch, targetWidth: innerWidth })) : null] }), _jsx("rect", { fill: "transparent", height: height, width: width, x: 0, y: 0 }), _jsxs("g", { ...interactionHandlers, style: interactionStyle, transform: `translate(${margin.left},${margin.top})`, children: [_jsx("rect", { fill: "transparent", height: innerHeight, width: innerWidth, x: 0, y: 0 }), clipExcludedChildren, underlayChildren, useClipReveal ? (_jsx("g", { clipPath: `url(#${clipPathId})`, children: preOverlayChildren })) : (preOverlayChildren), postOverlayChildren] })] }) }) }));
398
+ });
@@ -0,0 +1,75 @@
1
+ import { type SpringConfig } from '../chart-config-context';
2
+ import { type LineConfig } from '../chart-context';
3
+ import type { IndicatorFadeEdges } from '../indicator-fade';
4
+ import { type TooltipRow } from './tooltip-content';
5
+ export interface ChartTooltipProps {
6
+ /** Whether to show the date pill at bottom. Default: true */
7
+ showDatePill?: boolean;
8
+ /** Whether to show the vertical crosshair line. Default: true */
9
+ showCrosshair?: boolean;
10
+ /** Whether to show dots on the lines. Default: true */
11
+ showDots?: boolean;
12
+ /** Dot style: filled circle or transparent ring. Default: "dot" */
13
+ dotVariant?: 'dot' | 'ring';
14
+ /** Dot / ring radius in pixels. Default: 5 */
15
+ dotSize?: number;
16
+ /** Ring corner radius as a fraction of side length (0 = square, 0.5 = circle). */
17
+ dotRadiusFraction?: number;
18
+ /** Multiplier applied to the computed dot / ring pixel radius. Default: 1 */
19
+ dotScale?: number;
20
+ /** Ring stroke width in pixels. Default: 1.5 for ring variant */
21
+ dotStrokeWidth?: number;
22
+ /**
23
+ * Color for the crosshair/indicator line. When a function, receives the hovered point
24
+ * (e.g. for candlestick: match candle color from close vs open). Default: --chart-crosshair.
25
+ */
26
+ indicatorColor?: string | ((point: Record<string, unknown>) => string);
27
+ /** Custom content renderer for the tooltip box */
28
+ content?: (props: {
29
+ point: Record<string, unknown>;
30
+ index: number;
31
+ }) => React.ReactNode;
32
+ /** Custom row renderer - return array of TooltipRow */
33
+ rows?: (point: Record<string, unknown>) => TooltipRow[];
34
+ /**
35
+ * Override tooltip dot fill. When omitted and `rows` is set, dot colors match row colors.
36
+ * When a function, receives the hovered point and line config.
37
+ */
38
+ dotColor?: string | ((point: Record<string, unknown>, line: LineConfig) => string);
39
+ /** Additional content to show below rows (e.g., markers) */
40
+ children?: React.ReactNode;
41
+ /** Custom class name */
42
+ className?: string;
43
+ /** Per-chart override for the crosshair / dot / date-pill spring. */
44
+ springConfig?: SpringConfig;
45
+ /**
46
+ * When `true`, the floating panel uses the crosshair spring and stays in sync.
47
+ * Default `false` — panel follow uses `damping` (`20`).
48
+ */
49
+ matchCrosshair?: boolean;
50
+ /**
51
+ * Spring damping for the floating tooltip panel when `matchCrosshair` is `false`.
52
+ * `0` disables spring motion (instant). Default: `20`.
53
+ */
54
+ damping?: number;
55
+ /** SVG stroke dash pattern for the crosshair. Omit for solid. */
56
+ indicatorDasharray?: string;
57
+ /** Vertical crosshair fade: `both`, `top`, `bottom`, or `none` (solid). Default: `both`. */
58
+ indicatorFadeEdges?: IndicatorFadeEdges;
59
+ /** Crosshair fade zone size (% of height). Default: `10`. */
60
+ indicatorFadeLength?: number;
61
+ /** Per-chart override for the floating-panel spring. */
62
+ boxSpringConfig?: SpringConfig;
63
+ /** Inline styles for the tooltip panel (background, blur, etc.). */
64
+ panelStyle?: React.CSSProperties;
65
+ /**
66
+ * Tooltip panel background color (CSS variable or color value).
67
+ * Default: `var(--chart-tooltip-background)`.
68
+ */
69
+ backgroundColor?: string;
70
+ }
71
+ export declare function ChartTooltip(props: ChartTooltipProps): import("react/jsx-runtime").JSX.Element | null;
72
+ export declare namespace ChartTooltip {
73
+ var displayName: string;
74
+ }
75
+ export default ChartTooltip;
@@ -0,0 +1,158 @@
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * Vendored from bklit-ui — https://github.com/bklit/bklit-ui
5
+ * Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
6
+ * LICENSE-bklit at the root of this package.
7
+ *
8
+ * Local change: the `@/lib/utils` import was repointed at this package's own
9
+ * `cn`, which is the same function. Nothing else is modified, so re-syncing
10
+ * with upstream stays a diff rather than a merge.
11
+ */
12
+ import { motion, useSpring } from 'motion/react';
13
+ import { memo, useEffect, useMemo, useState } from 'react';
14
+ import { createPortal } from 'react-dom';
15
+ import { resolveTooltipBoxMotion, useChartConfig, } from '../chart-config-context';
16
+ import { chartCssVars, useChart, useChartStable } from '../chart-context';
17
+ import { weekdayDateFmt } from '../chart-formatters';
18
+ import { DateTicker } from './date-ticker';
19
+ import { TooltipBox } from './tooltip-box';
20
+ import { TooltipContent } from './tooltip-content';
21
+ import { TooltipDot } from './tooltip-dot';
22
+ import { TooltipIndicator } from './tooltip-indicator';
23
+ const ChartTooltipInner = memo(function ChartTooltipInner({ showDatePill = true, showCrosshair = true, showDots = true, dotVariant = 'dot', dotSize = 5, dotRadiusFraction, dotScale = 1, dotStrokeWidth, indicatorColor: indicatorColorProp, content, rows: rowsRenderer, dotColor: dotColorProp, children, className = '', container, springConfig, matchCrosshair = false, damping, indicatorDasharray, indicatorFadeEdges, indicatorFadeLength, boxSpringConfig, panelStyle, backgroundColor, }) {
24
+ const { tooltipData, width, height, innerHeight, margin, columnWidth, lines, xAccessor, dateLabels, containerRef, orientation, barXAccessor, bandWidth, squareSnap, } = useChart();
25
+ const { tooltipSpring } = useChartConfig();
26
+ const isHorizontal = orientation === 'horizontal';
27
+ const discreteInteraction = dateLabels.length > 60;
28
+ const resolvedDotSize = useMemo(() => {
29
+ if (dotVariant !== 'ring' || !bandWidth || lines.length === 0) {
30
+ return dotSize * dotScale;
31
+ }
32
+ const seriesCount = lines.length;
33
+ const gap = squareSnap?.groupGap ?? (seriesCount > 1 ? 4 : 0);
34
+ const squareSize = (bandWidth - gap * (seriesCount - 1)) / seriesCount;
35
+ return (squareSize / 2) * dotScale;
36
+ }, [bandWidth, dotScale, dotSize, dotVariant, lines.length, squareSnap?.groupGap]);
37
+ const boxMotion = useMemo(() => {
38
+ if (boxSpringConfig) {
39
+ return {
40
+ animate: !discreteInteraction,
41
+ springConfig: boxSpringConfig,
42
+ };
43
+ }
44
+ if (matchCrosshair) {
45
+ return {
46
+ animate: !discreteInteraction,
47
+ springConfig: springConfig ?? tooltipSpring,
48
+ };
49
+ }
50
+ return resolveTooltipBoxMotion(damping);
51
+ }, [boxSpringConfig, damping, discreteInteraction, matchCrosshair, springConfig, tooltipSpring]);
52
+ const visible = tooltipData !== null;
53
+ const x = tooltipData?.x ?? 0;
54
+ const xWithMargin = x + margin.left;
55
+ // For horizontal charts, get the y position from the first line's yPosition (center of bar)
56
+ const firstLineDataKey = lines[0]?.dataKey;
57
+ const firstLineY = firstLineDataKey ? (tooltipData?.yPositions[firstLineDataKey] ?? 0) : 0;
58
+ const yWithMargin = firstLineY + margin.top;
59
+ const tooltipRows = useMemo(() => {
60
+ if (!tooltipData) {
61
+ return [];
62
+ }
63
+ if (rowsRenderer) {
64
+ return rowsRenderer(tooltipData.point);
65
+ }
66
+ // Default: generate rows from registered lines
67
+ return lines.map((line) => ({
68
+ color: line.stroke,
69
+ label: line.dataKey,
70
+ value: tooltipData.point[line.dataKey] ?? 0,
71
+ }));
72
+ }, [tooltipData, lines, rowsRenderer]);
73
+ const resolveDotColor = useMemo(() => {
74
+ return (line, index) => {
75
+ if (rowsRenderer && tooltipRows[index]?.color) {
76
+ return tooltipRows[index].color;
77
+ }
78
+ if (dotColorProp != null) {
79
+ if (typeof dotColorProp === 'function' && tooltipData) {
80
+ return dotColorProp(tooltipData.point, line);
81
+ }
82
+ if (typeof dotColorProp === 'string') {
83
+ return dotColorProp;
84
+ }
85
+ }
86
+ return line.stroke;
87
+ };
88
+ }, [dotColorProp, rowsRenderer, tooltipData, tooltipRows]);
89
+ // Resolve indicator color (static or from hovered point)
90
+ const indicatorColor = useMemo(() => {
91
+ if (indicatorColorProp == null) {
92
+ return chartCssVars.crosshair;
93
+ }
94
+ if (typeof indicatorColorProp === 'function') {
95
+ return tooltipData ? indicatorColorProp(tooltipData.point) : chartCssVars.crosshair;
96
+ }
97
+ return indicatorColorProp;
98
+ }, [indicatorColorProp, tooltipData]);
99
+ // Title from date or category
100
+ const title = useMemo(() => {
101
+ if (!tooltipData) {
102
+ return undefined;
103
+ }
104
+ // For bar charts (horizontal or vertical), use the category name
105
+ if (barXAccessor) {
106
+ return barXAccessor(tooltipData.point);
107
+ }
108
+ // For line/area charts, use the date
109
+ return weekdayDateFmt.format(xAccessor(tooltipData.point));
110
+ }, [tooltipData, barXAccessor, xAccessor]);
111
+ const tooltipContent = (_jsxs(_Fragment, { children: [showCrosshair && (_jsx("svg", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0", height: "100%", width: "100%", children: _jsx("g", { transform: `translate(${margin.left},${margin.top})`, children: _jsx(TooltipIndicator, { animate: !discreteInteraction, colorEdge: indicatorColor, colorMid: indicatorColor, columnWidth: columnWidth, fadeEdges: indicatorDasharray ? 'none' : (indicatorFadeEdges ?? 'both'), fadeLength: indicatorFadeLength, height: innerHeight, springConfig: springConfig, strokeDasharray: indicatorDasharray, visible: visible, width: "line", x: x }) }) })), showDots && visible && !isHorizontal && (_jsx("svg", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0", height: "100%", width: "100%", children: _jsx("g", { transform: `translate(${margin.left},${margin.top})`, children: lines.map((line, index) => (_jsx(TooltipDot, { color: resolveDotColor(line, index), cornerRadiusFraction: dotVariant === 'ring' ? dotRadiusFraction : undefined, size: resolvedDotSize, springConfig: springConfig, strokeColor: chartCssVars.background, strokeWidth: dotVariant === 'ring' ? dotStrokeWidth : undefined, variant: dotVariant, visible: visible, x: tooltipData?.xPositions?.[line.dataKey] ?? x, y: tooltipData?.yPositions[line.dataKey] ?? 0 }, line.dataKey))) }) })), _jsx(TooltipBox, { animate: boxMotion.animate, backgroundColor: backgroundColor, className: className, containerHeight: height, containerRef: containerRef, containerWidth: width, panelStyle: panelStyle, springConfig: boxMotion.springConfig, top: isHorizontal ? undefined : margin.top, visible: visible, x: xWithMargin, y: isHorizontal ? yWithMargin : margin.top, children: content && tooltipData
112
+ ? content({
113
+ point: tooltipData.point,
114
+ index: tooltipData.index,
115
+ })
116
+ : !content && (_jsx(TooltipContent, { rows: tooltipRows, title: title, children: children })) }), _jsx(DatePillTracker, { currentIndex: tooltipData?.index ?? 0, discreteInteraction: discreteInteraction, enabled: showDatePill && !isHorizontal, labels: dateLabels, springConfig: springConfig, visible: visible, xWithMargin: xWithMargin })] }));
117
+ return createPortal(tooltipContent, container);
118
+ });
119
+ export function ChartTooltip(props) {
120
+ const { containerRef } = useChartStable();
121
+ const [mounted, setMounted] = useState(false);
122
+ // Only render portals on client side after mount
123
+ useEffect(() => {
124
+ setMounted(true);
125
+ }, []);
126
+ const container = containerRef.current;
127
+ if (!(mounted && container)) {
128
+ return null;
129
+ }
130
+ return _jsx(ChartTooltipInner, { ...props, container: container });
131
+ }
132
+ ChartTooltip.displayName = 'ChartTooltip';
133
+ // Inner-only-on-visible so `useSpring` initializes at the real cursor x
134
+ // instead of `margin.left` on first hover.
135
+ function DatePillTracker(props) {
136
+ if (!(props.enabled && props.visible && props.labels.length > 0)) {
137
+ return null;
138
+ }
139
+ return _jsx(DatePillTrackerInner, { ...props });
140
+ }
141
+ function DatePillTrackerInner({ labels, currentIndex, xWithMargin, discreteInteraction, springConfig, visible, }) {
142
+ const { tooltipSpring } = useChartConfig();
143
+ const effectiveSpring = springConfig ?? tooltipSpring;
144
+ const animatedX = useSpring(xWithMargin, effectiveSpring);
145
+ if (!discreteInteraction) {
146
+ animatedX.set(xWithMargin);
147
+ }
148
+ // biome-ignore lint/correctness/useExhaustiveDependencies: we need to jump the animatedX when the visible prop changes
149
+ useEffect(() => {
150
+ animatedX.set(xWithMargin);
151
+ }, [animatedX, visible]);
152
+ return (_jsx(motion.div, { className: "pointer-events-none absolute z-50", style: {
153
+ left: discreteInteraction ? xWithMargin : animatedX,
154
+ transform: 'translateX(-50%)',
155
+ bottom: 4,
156
+ }, children: _jsx(DateTicker, { currentIndex: currentIndex, labels: labels, visible: visible }) }));
157
+ }
158
+ export default ChartTooltip;
@@ -0,0 +1,10 @@
1
+ export interface DateTickerProps {
2
+ currentIndex: number;
3
+ labels: string[];
4
+ visible: boolean;
5
+ }
6
+ export declare function DateTicker({ currentIndex, labels, visible }: DateTickerProps): import("react/jsx-runtime").JSX.Element | null;
7
+ export declare namespace DateTicker {
8
+ var displayName: string;
9
+ }
10
+ export default DateTicker;