@cronus-ui/ui 0.6.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.
- package/LICENSE +21 -0
- package/README.md +262 -0
- package/dist/charts/animation.d.ts +11 -0
- package/dist/charts/animation.js +29 -0
- package/dist/charts/area-chart-loading.d.ts +34 -0
- package/dist/charts/area-chart-loading.js +22 -0
- package/dist/charts/area-chart.d.ts +48 -0
- package/dist/charts/area-chart.js +57 -0
- package/dist/charts/area-gradient-defs.d.ts +20 -0
- package/dist/charts/area-gradient-defs.js +15 -0
- package/dist/charts/area.d.ts +76 -0
- package/dist/charts/area.js +104 -0
- package/dist/charts/background.d.ts +27 -0
- package/dist/charts/background.js +68 -0
- package/dist/charts/bar-chart-loading.d.ts +17 -0
- package/dist/charts/bar-chart-loading.js +14 -0
- package/dist/charts/bar-chart.d.ts +55 -0
- package/dist/charts/bar-chart.js +432 -0
- package/dist/charts/bar-depth-geometry.d.ts +33 -0
- package/dist/charts/bar-depth-geometry.js +38 -0
- package/dist/charts/bar-depth.d.ts +157 -0
- package/dist/charts/bar-depth.js +586 -0
- package/dist/charts/bar-squares-layout.d.ts +28 -0
- package/dist/charts/bar-squares-layout.js +47 -0
- package/dist/charts/bar-squares.d.ts +49 -0
- package/dist/charts/bar-squares.js +207 -0
- package/dist/charts/bar-x-axis.d.ts +14 -0
- package/dist/charts/bar-x-axis.js +73 -0
- package/dist/charts/bar-y-axis.d.ts +12 -0
- package/dist/charts/bar-y-axis.js +64 -0
- package/dist/charts/bar.d.ts +41 -0
- package/dist/charts/bar.js +208 -0
- package/dist/charts/candlestick-chart.d.ts +46 -0
- package/dist/charts/candlestick-chart.js +203 -0
- package/dist/charts/candlestick.d.ts +24 -0
- package/dist/charts/candlestick.js +139 -0
- package/dist/charts/chart-brush-handle.d.ts +15 -0
- package/dist/charts/chart-brush-handle.js +47 -0
- package/dist/charts/chart-brush-layout.d.ts +27 -0
- package/dist/charts/chart-brush-layout.js +42 -0
- package/dist/charts/chart-brush-selection-overlay.d.ts +19 -0
- package/dist/charts/chart-brush-selection-overlay.js +44 -0
- package/dist/charts/chart-brush-track-overlay.d.ts +23 -0
- package/dist/charts/chart-brush-track-overlay.js +65 -0
- package/dist/charts/chart-brush.d.ts +32 -0
- package/dist/charts/chart-brush.js +116 -0
- package/dist/charts/chart-center-typography.d.ts +12 -0
- package/dist/charts/chart-center-typography.js +12 -0
- package/dist/charts/chart-child-passthrough.d.ts +17 -0
- package/dist/charts/chart-child-passthrough.js +74 -0
- package/dist/charts/chart-config-context.d.ts +26 -0
- package/dist/charts/chart-config-context.js +47 -0
- package/dist/charts/chart-context.d.ts +199 -0
- package/dist/charts/chart-context.js +201 -0
- package/dist/charts/chart-defs.d.ts +13 -0
- package/dist/charts/chart-defs.js +49 -0
- package/dist/charts/chart-formatters.d.ts +10 -0
- package/dist/charts/chart-formatters.js +28 -0
- package/dist/charts/chart-legend-hover.d.ts +13 -0
- package/dist/charts/chart-legend-hover.js +18 -0
- package/dist/charts/chart-legend.d.ts +55 -0
- package/dist/charts/chart-legend.js +30 -0
- package/dist/charts/chart-loading-label.d.ts +10 -0
- package/dist/charts/chart-loading-label.js +21 -0
- package/dist/charts/chart-phase.d.ts +31 -0
- package/dist/charts/chart-phase.js +21 -0
- package/dist/charts/chart-reveal-clip.d.ts +24 -0
- package/dist/charts/chart-reveal-clip.js +24 -0
- package/dist/charts/chart-scale.d.ts +12 -0
- package/dist/charts/chart-scale.js +17 -0
- package/dist/charts/chart-stat-flow.d.ts +36 -0
- package/dist/charts/chart-stat-flow.js +23 -0
- package/dist/charts/choropleth/choropleth-chart.d.ts +43 -0
- package/dist/charts/choropleth/choropleth-chart.js +218 -0
- package/dist/charts/choropleth/choropleth-context.d.ts +86 -0
- package/dist/charts/choropleth/choropleth-context.js +106 -0
- package/dist/charts/choropleth/choropleth-feature.d.ts +13 -0
- package/dist/charts/choropleth/choropleth-feature.js +125 -0
- package/dist/charts/choropleth/choropleth-graticule.d.ts +11 -0
- package/dist/charts/choropleth/choropleth-graticule.js +12 -0
- package/dist/charts/choropleth/choropleth-tooltip.d.ts +31 -0
- package/dist/charts/choropleth/choropleth-tooltip.js +50 -0
- package/dist/charts/choropleth/index.d.ts +7 -0
- package/dist/charts/choropleth/index.js +6 -0
- package/dist/charts/composed-chart.d.ts +36 -0
- package/dist/charts/composed-chart.js +152 -0
- package/dist/charts/dash-tail-stroke.d.ts +18 -0
- package/dist/charts/dash-tail-stroke.js +13 -0
- package/dist/charts/decimate-time-series.d.ts +10 -0
- package/dist/charts/decimate-time-series.js +112 -0
- package/dist/charts/fade-edges.d.ts +34 -0
- package/dist/charts/fade-edges.js +35 -0
- package/dist/charts/filter-data-by-x-domain.d.ts +5 -0
- package/dist/charts/filter-data-by-x-domain.js +42 -0
- package/dist/charts/funnel-chart.d.ts +91 -0
- package/dist/charts/funnel-chart.js +302 -0
- package/dist/charts/gauge-label-layout.d.ts +22 -0
- package/dist/charts/gauge-label-layout.js +44 -0
- package/dist/charts/gauge.d.ts +56 -0
- package/dist/charts/gauge.js +307 -0
- package/dist/charts/generate-chart-skeleton-data.d.ts +16 -0
- package/dist/charts/generate-chart-skeleton-data.js +25 -0
- package/dist/charts/grid.d.ts +58 -0
- package/dist/charts/grid.js +80 -0
- package/dist/charts/heatmap/generate-heatmap-skeleton-data.d.ts +4 -0
- package/dist/charts/heatmap/generate-heatmap-skeleton-data.js +12 -0
- package/dist/charts/heatmap/heatmap-animation.d.ts +41 -0
- package/dist/charts/heatmap/heatmap-animation.js +85 -0
- package/dist/charts/heatmap/heatmap-cells.d.ts +21 -0
- package/dist/charts/heatmap/heatmap-cells.js +265 -0
- package/dist/charts/heatmap/heatmap-chart-loading.d.ts +21 -0
- package/dist/charts/heatmap/heatmap-chart-loading.js +14 -0
- package/dist/charts/heatmap/heatmap-chart.d.ts +80 -0
- package/dist/charts/heatmap/heatmap-chart.js +275 -0
- package/dist/charts/heatmap/heatmap-colors.d.ts +70 -0
- package/dist/charts/heatmap/heatmap-colors.js +113 -0
- package/dist/charts/heatmap/heatmap-context.d.ts +109 -0
- package/dist/charts/heatmap/heatmap-context.js +69 -0
- package/dist/charts/heatmap/heatmap-legend-gradient.d.ts +20 -0
- package/dist/charts/heatmap/heatmap-legend-gradient.js +44 -0
- package/dist/charts/heatmap/heatmap-legend-swatch.d.ts +8 -0
- package/dist/charts/heatmap/heatmap-legend-swatch.js +26 -0
- package/dist/charts/heatmap/heatmap-legend.d.ts +41 -0
- package/dist/charts/heatmap/heatmap-legend.js +68 -0
- package/dist/charts/heatmap/heatmap-pattern-defs.d.ts +5 -0
- package/dist/charts/heatmap/heatmap-pattern-defs.js +25 -0
- package/dist/charts/heatmap/heatmap-resolve-separator.d.ts +8 -0
- package/dist/charts/heatmap/heatmap-resolve-separator.js +82 -0
- package/dist/charts/heatmap/heatmap-separator.d.ts +63 -0
- package/dist/charts/heatmap/heatmap-separator.js +71 -0
- package/dist/charts/heatmap/heatmap-tooltip.d.ts +30 -0
- package/dist/charts/heatmap/heatmap-tooltip.js +20 -0
- package/dist/charts/heatmap/heatmap-utils.d.ts +175 -0
- package/dist/charts/heatmap/heatmap-utils.js +595 -0
- package/dist/charts/heatmap/heatmap-x-axis.d.ts +7 -0
- package/dist/charts/heatmap/heatmap-x-axis.js +54 -0
- package/dist/charts/heatmap/heatmap-y-axis.d.ts +14 -0
- package/dist/charts/heatmap/heatmap-y-axis.js +37 -0
- package/dist/charts/heatmap/index.d.ts +15 -0
- package/dist/charts/heatmap/index.js +15 -0
- package/dist/charts/heatmap/use-delayed-tooltip-data.d.ts +3 -0
- package/dist/charts/heatmap/use-delayed-tooltip-data.js +53 -0
- package/dist/charts/highlight-segment-bounds.d.ts +18 -0
- package/dist/charts/highlight-segment-bounds.js +36 -0
- package/dist/charts/highlight-segment.d.ts +22 -0
- package/dist/charts/highlight-segment.js +14 -0
- package/dist/charts/index.d.ts +106 -0
- package/dist/charts/index.js +133 -0
- package/dist/charts/indicator-fade.d.ts +15 -0
- package/dist/charts/indicator-fade.js +42 -0
- package/dist/charts/legend/index.d.ts +8 -0
- package/dist/charts/legend/index.js +10 -0
- package/dist/charts/legend/legend-context.d.ts +48 -0
- package/dist/charts/legend/legend-context.js +34 -0
- package/dist/charts/legend/legend-item.d.ts +12 -0
- package/dist/charts/legend/legend-item.js +11 -0
- package/dist/charts/legend/legend-label.d.ts +9 -0
- package/dist/charts/legend/legend-label.js +10 -0
- package/dist/charts/legend/legend-marker.d.ts +9 -0
- package/dist/charts/legend/legend-marker.js +11 -0
- package/dist/charts/legend/legend-progress.d.ts +13 -0
- package/dist/charts/legend/legend-progress.js +15 -0
- package/dist/charts/legend/legend-value.d.ts +17 -0
- package/dist/charts/legend/legend-value.js +11 -0
- package/dist/charts/legend/legend.d.ts +23 -0
- package/dist/charts/legend/legend.js +43 -0
- package/dist/charts/line-chart-loading.d.ts +34 -0
- package/dist/charts/line-chart-loading.js +22 -0
- package/dist/charts/line-chart.d.ts +46 -0
- package/dist/charts/line-chart.js +91 -0
- package/dist/charts/line-loading-pulse.d.ts +20 -0
- package/dist/charts/line-loading-pulse.js +124 -0
- package/dist/charts/line-loading-timing.d.ts +10 -0
- package/dist/charts/line-loading-timing.js +10 -0
- package/dist/charts/line-series-terminal-marker.d.ts +16 -0
- package/dist/charts/line-series-terminal-marker.js +46 -0
- package/dist/charts/line.d.ts +64 -0
- package/dist/charts/line.js +96 -0
- package/dist/charts/live-line-chart.d.ts +35 -0
- package/dist/charts/live-line-chart.js +374 -0
- package/dist/charts/live-line.d.ts +39 -0
- package/dist/charts/live-line.js +78 -0
- package/dist/charts/live-x-axis.d.ts +12 -0
- package/dist/charts/live-x-axis.js +85 -0
- package/dist/charts/live-y-axis.d.ts +16 -0
- package/dist/charts/live-y-axis.js +137 -0
- package/dist/charts/loading-sweep.d.ts +66 -0
- package/dist/charts/loading-sweep.js +174 -0
- package/dist/charts/markers/chart-markers.d.ts +25 -0
- package/dist/charts/markers/chart-markers.js +87 -0
- package/dist/charts/markers/index.d.ts +3 -0
- package/dist/charts/markers/index.js +3 -0
- package/dist/charts/markers/marker-group.d.ts +88 -0
- package/dist/charts/markers/marker-group.js +171 -0
- package/dist/charts/motion-utils.d.ts +9 -0
- package/dist/charts/motion-utils.js +28 -0
- package/dist/charts/notch-gauge-shared.d.ts +49 -0
- package/dist/charts/notch-gauge-shared.js +103 -0
- package/dist/charts/path-stroke-utils.d.ts +20 -0
- package/dist/charts/path-stroke-utils.js +55 -0
- package/dist/charts/pattern-area.d.ts +21 -0
- package/dist/charts/pattern-area.js +19 -0
- package/dist/charts/pattern-preset.d.ts +26 -0
- package/dist/charts/pattern-preset.js +83 -0
- package/dist/charts/pie-center-shell.d.ts +24 -0
- package/dist/charts/pie-center-shell.js +109 -0
- package/dist/charts/pie-center.d.ts +46 -0
- package/dist/charts/pie-center.js +46 -0
- package/dist/charts/pie-chart.d.ts +50 -0
- package/dist/charts/pie-chart.js +248 -0
- package/dist/charts/pie-context.d.ts +74 -0
- package/dist/charts/pie-context.js +95 -0
- package/dist/charts/pie-slice.d.ts +28 -0
- package/dist/charts/pie-slice.js +180 -0
- package/dist/charts/profit-loss-legend-hover.d.ts +11 -0
- package/dist/charts/profit-loss-legend-hover.js +12 -0
- package/dist/charts/profit-loss-legend.d.ts +17 -0
- package/dist/charts/profit-loss-legend.js +18 -0
- package/dist/charts/profit-loss-line.d.ts +27 -0
- package/dist/charts/profit-loss-line.js +77 -0
- package/dist/charts/profit-loss-segments.d.ts +12 -0
- package/dist/charts/profit-loss-segments.js +86 -0
- package/dist/charts/projection-config.d.ts +11 -0
- package/dist/charts/projection-config.js +80 -0
- package/dist/charts/projection-line-end-marker.d.ts +15 -0
- package/dist/charts/projection-line-end-marker.js +27 -0
- package/dist/charts/projection-line.d.ts +40 -0
- package/dist/charts/projection-line.js +79 -0
- package/dist/charts/projection-utils.d.ts +46 -0
- package/dist/charts/projection-utils.js +253 -0
- package/dist/charts/radar-area.d.ts +17 -0
- package/dist/charts/radar-area.js +84 -0
- package/dist/charts/radar-axis.d.ts +14 -0
- package/dist/charts/radar-axis.js +24 -0
- package/dist/charts/radar-chart.d.ts +36 -0
- package/dist/charts/radar-chart.js +89 -0
- package/dist/charts/radar-context.d.ts +68 -0
- package/dist/charts/radar-context.js +87 -0
- package/dist/charts/radar-grid.d.ts +16 -0
- package/dist/charts/radar-grid.js +40 -0
- package/dist/charts/radar-labels.d.ts +16 -0
- package/dist/charts/radar-labels.js +29 -0
- package/dist/charts/reference-area-config.d.ts +10 -0
- package/dist/charts/reference-area-config.js +39 -0
- package/dist/charts/reference-area-geometry.d.ts +23 -0
- package/dist/charts/reference-area-geometry.js +68 -0
- package/dist/charts/reference-area-registration-context.d.ts +8 -0
- package/dist/charts/reference-area-registration-context.js +7 -0
- package/dist/charts/reference-area.d.ts +52 -0
- package/dist/charts/reference-area.js +101 -0
- package/dist/charts/ring-center.d.ts +46 -0
- package/dist/charts/ring-center.js +41 -0
- package/dist/charts/ring-chart.d.ts +41 -0
- package/dist/charts/ring-chart.js +212 -0
- package/dist/charts/ring-context.d.ts +66 -0
- package/dist/charts/ring-context.js +92 -0
- package/dist/charts/ring.d.ts +11 -0
- package/dist/charts/ring.js +104 -0
- package/dist/charts/sankey/index.d.ts +6 -0
- package/dist/charts/sankey/index.js +6 -0
- package/dist/charts/sankey/sankey-chart.d.ts +39 -0
- package/dist/charts/sankey/sankey-chart.js +117 -0
- package/dist/charts/sankey/sankey-context.d.ts +69 -0
- package/dist/charts/sankey/sankey-context.js +23 -0
- package/dist/charts/sankey/sankey-link.d.ts +26 -0
- package/dist/charts/sankey/sankey-link.js +155 -0
- package/dist/charts/sankey/sankey-node.d.ts +29 -0
- package/dist/charts/sankey/sankey-node.js +200 -0
- package/dist/charts/sankey/sankey-tooltip.d.ts +24 -0
- package/dist/charts/sankey/sankey-tooltip.js +70 -0
- package/dist/charts/scatter-chart-shell.d.ts +21 -0
- package/dist/charts/scatter-chart-shell.js +152 -0
- package/dist/charts/scatter-chart.d.ts +32 -0
- package/dist/charts/scatter-chart.js +56 -0
- package/dist/charts/scatter-svg.d.ts +6 -0
- package/dist/charts/scatter-svg.js +16 -0
- package/dist/charts/scatter.d.ts +21 -0
- package/dist/charts/scatter.js +30 -0
- package/dist/charts/segment.d.ts +26 -0
- package/dist/charts/segment.js +42 -0
- package/dist/charts/series-bar-layout.d.ts +18 -0
- package/dist/charts/series-bar-layout.js +31 -0
- package/dist/charts/series-bar.d.ts +20 -0
- package/dist/charts/series-bar.js +120 -0
- package/dist/charts/series-dash-tail-overlay.d.ts +17 -0
- package/dist/charts/series-dash-tail-overlay.js +39 -0
- package/dist/charts/series-highlight-layer.d.ts +23 -0
- package/dist/charts/series-highlight-layer.js +21 -0
- package/dist/charts/series-hover-dim.d.ts +29 -0
- package/dist/charts/series-hover-dim.js +26 -0
- package/dist/charts/series-markers.d.ts +14 -0
- package/dist/charts/series-markers.js +98 -0
- package/dist/charts/series-path-utils.d.ts +19 -0
- package/dist/charts/series-path-utils.js +60 -0
- package/dist/charts/series-point-marker.d.ts +48 -0
- package/dist/charts/series-point-marker.js +48 -0
- package/dist/charts/shimmering-text.d.ts +23 -0
- package/dist/charts/shimmering-text.js +31 -0
- package/dist/charts/static-chart-preview-context.d.ts +7 -0
- package/dist/charts/static-chart-preview-context.js +12 -0
- package/dist/charts/sunburst-breadcrumb.d.ts +16 -0
- package/dist/charts/sunburst-breadcrumb.js +26 -0
- package/dist/charts/sunburst-center.d.ts +5 -0
- package/dist/charts/sunburst-center.js +17 -0
- package/dist/charts/sunburst-chart.d.ts +30 -0
- package/dist/charts/sunburst-chart.js +263 -0
- package/dist/charts/sunburst-context.d.ts +61 -0
- package/dist/charts/sunburst-context.js +112 -0
- package/dist/charts/sunburst-data.d.ts +9 -0
- package/dist/charts/sunburst-data.js +2 -0
- package/dist/charts/sunburst-hint.d.ts +13 -0
- package/dist/charts/sunburst-hint.js +31 -0
- package/dist/charts/sunburst-labels.d.ts +9 -0
- package/dist/charts/sunburst-labels.js +63 -0
- package/dist/charts/sunburst-segment.d.ts +11 -0
- package/dist/charts/sunburst-segment.js +78 -0
- package/dist/charts/sunburst.d.ts +101 -0
- package/dist/charts/sunburst.js +396 -0
- package/dist/charts/time-series-chart-shell.d.ts +47 -0
- package/dist/charts/time-series-chart-shell.js +390 -0
- package/dist/charts/tooltip/chart-tooltip.d.ts +76 -0
- package/dist/charts/tooltip/chart-tooltip.js +150 -0
- package/dist/charts/tooltip/date-ticker.d.ts +11 -0
- package/dist/charts/tooltip/date-ticker.js +77 -0
- package/dist/charts/tooltip/index.d.ts +7 -0
- package/dist/charts/tooltip/index.js +7 -0
- package/dist/charts/tooltip/tooltip-box.d.ts +48 -0
- package/dist/charts/tooltip/tooltip-box.js +114 -0
- package/dist/charts/tooltip/tooltip-content.d.ts +18 -0
- package/dist/charts/tooltip/tooltip-content.js +9 -0
- package/dist/charts/tooltip/tooltip-dot.d.ts +28 -0
- package/dist/charts/tooltip/tooltip-dot.js +54 -0
- package/dist/charts/tooltip/tooltip-indicator.d.ts +45 -0
- package/dist/charts/tooltip/tooltip-indicator.js +65 -0
- package/dist/charts/use-animated-series-path.d.ts +19 -0
- package/dist/charts/use-animated-series-path.js +93 -0
- package/dist/charts/use-animated-y-domains.d.ts +14 -0
- package/dist/charts/use-animated-y-domains.js +150 -0
- package/dist/charts/use-chart-interaction.d.ts +41 -0
- package/dist/charts/use-chart-interaction.js +244 -0
- package/dist/charts/use-chart-phase-orchestrator.d.ts +23 -0
- package/dist/charts/use-chart-phase-orchestrator.js +139 -0
- package/dist/charts/use-enter-complete.d.ts +8 -0
- package/dist/charts/use-enter-complete.js +23 -0
- package/dist/charts/use-grid-shimmer.d.ts +16 -0
- package/dist/charts/use-grid-shimmer.js +63 -0
- package/dist/charts/use-highlight-segment.d.ts +14 -0
- package/dist/charts/use-highlight-segment.js +34 -0
- package/dist/charts/use-mount-progress.d.ts +4 -0
- package/dist/charts/use-mount-progress.js +22 -0
- package/dist/charts/use-scatter-chart-interaction.d.ts +35 -0
- package/dist/charts/use-scatter-chart-interaction.js +228 -0
- package/dist/charts/use-scheduled-tooltip.d.ts +9 -0
- package/dist/charts/use-scheduled-tooltip.js +76 -0
- package/dist/charts/visx-pattern.d.ts +19 -0
- package/dist/charts/visx-pattern.js +20 -0
- package/dist/charts/x-axis.d.ts +27 -0
- package/dist/charts/x-axis.js +415 -0
- package/dist/charts/y-axis-scales.d.ts +26 -0
- package/dist/charts/y-axis-scales.js +72 -0
- package/dist/charts/y-axis-ticks.d.ts +12 -0
- package/dist/charts/y-axis-ticks.js +24 -0
- package/dist/charts/y-axis.d.ts +22 -0
- package/dist/charts/y-axis.js +80 -0
- package/dist/charts/y-domain-utils.d.ts +27 -0
- package/dist/charts/y-domain-utils.js +88 -0
- package/dist/components/accordion.d.ts +6 -0
- package/dist/components/accordion.js +20 -0
- package/dist/components/alert-dialog.d.ts +18 -0
- package/dist/components/alert-dialog.js +41 -0
- package/dist/components/alert.d.ts +24 -0
- package/dist/components/alert.js +46 -0
- package/dist/components/animated-button.d.ts +5 -0
- package/dist/components/animated-button.js +16 -0
- package/dist/components/animated-list.d.ts +26 -0
- package/dist/components/animated-list.js +25 -0
- package/dist/components/animated-number.d.ts +67 -0
- package/dist/components/animated-number.js +131 -0
- package/dist/components/app-shell.d.ts +27 -0
- package/dist/components/app-shell.js +18 -0
- package/dist/components/area-chart.d.ts +11 -0
- package/dist/components/area-chart.js +12 -0
- package/dist/components/aspect-ratio.d.ts +16 -0
- package/dist/components/aspect-ratio.js +14 -0
- package/dist/components/aurora-background.d.ts +3 -0
- package/dist/components/aurora-background.js +8 -0
- package/dist/components/autocomplete.d.ts +55 -0
- package/dist/components/autocomplete.js +279 -0
- package/dist/components/avatar-group.d.ts +39 -0
- package/dist/components/avatar-group.js +50 -0
- package/dist/components/avatar.d.ts +5 -0
- package/dist/components/avatar.js +17 -0
- package/dist/components/badge.d.ts +10 -0
- package/dist/components/badge.js +35 -0
- package/dist/components/banner.d.ts +45 -0
- package/dist/components/banner.js +80 -0
- package/dist/components/bar-chart.d.ts +11 -0
- package/dist/components/bar-chart.js +9 -0
- package/dist/components/border-beam.d.ts +45 -0
- package/dist/components/border-beam.js +48 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +35 -0
- package/dist/components/button-group.d.ts +7 -0
- package/dist/components/button-group.js +10 -0
- package/dist/components/button.d.ts +12 -0
- package/dist/components/button.js +39 -0
- package/dist/components/calendar.d.ts +7 -0
- package/dist/components/calendar.js +71 -0
- package/dist/components/candlestick-chart.d.ts +13 -0
- package/dist/components/candlestick-chart.js +66 -0
- package/dist/components/card-stack.d.ts +28 -0
- package/dist/components/card-stack.js +47 -0
- package/dist/components/card.d.ts +9 -0
- package/dist/components/card.js +32 -0
- package/dist/components/carousel.d.ts +82 -0
- package/dist/components/carousel.js +310 -0
- package/dist/components/chart.d.ts +100 -0
- package/dist/components/chart.js +210 -0
- package/dist/components/checkbox.d.ts +3 -0
- package/dist/components/checkbox.js +11 -0
- package/dist/components/chip.d.ts +80 -0
- package/dist/components/chip.js +186 -0
- package/dist/components/choropleth-chart.d.ts +12 -0
- package/dist/components/choropleth-chart.js +31 -0
- package/dist/components/click-spark.d.ts +19 -0
- package/dist/components/click-spark.js +51 -0
- package/dist/components/code-block.d.ts +13 -0
- package/dist/components/code-block.js +20 -0
- package/dist/components/code-tabs.d.ts +51 -0
- package/dist/components/code-tabs.js +150 -0
- package/dist/components/collapsible.d.ts +5 -0
- package/dist/components/collapsible.js +12 -0
- package/dist/components/color-picker.d.ts +30 -0
- package/dist/components/color-picker.js +300 -0
- package/dist/components/combobox.d.ts +33 -0
- package/dist/components/combobox.js +32 -0
- package/dist/components/command.d.ts +87 -0
- package/dist/components/command.js +44 -0
- package/dist/components/comparison-slider.d.ts +17 -0
- package/dist/components/comparison-slider.js +81 -0
- package/dist/components/composed-chart.d.ts +13 -0
- package/dist/components/composed-chart.js +22 -0
- package/dist/components/confetti.d.ts +21 -0
- package/dist/components/confetti.js +111 -0
- package/dist/components/confirmation-dialog.d.ts +46 -0
- package/dist/components/confirmation-dialog.js +102 -0
- package/dist/components/context-menu.d.ts +28 -0
- package/dist/components/context-menu.js +52 -0
- package/dist/components/copy-button.d.ts +13 -0
- package/dist/components/copy-button.js +72 -0
- package/dist/components/countdown.d.ts +58 -0
- package/dist/components/countdown.js +106 -0
- package/dist/components/credit-card-input.d.ts +62 -0
- package/dist/components/credit-card-input.js +211 -0
- package/dist/components/currency-input.d.ts +86 -0
- package/dist/components/currency-input.js +215 -0
- package/dist/components/data-table.d.ts +232 -0
- package/dist/components/data-table.js +359 -0
- package/dist/components/date-picker.d.ts +66 -0
- package/dist/components/date-picker.js +55 -0
- package/dist/components/date-range-picker.d.ts +59 -0
- package/dist/components/date-range-picker.js +59 -0
- package/dist/components/description-list.d.ts +84 -0
- package/dist/components/description-list.js +138 -0
- package/dist/components/dialog.d.ts +26 -0
- package/dist/components/dialog.js +35 -0
- package/dist/components/dock.d.ts +34 -0
- package/dist/components/dock.js +61 -0
- package/dist/components/dot-pattern.d.ts +24 -0
- package/dist/components/dot-pattern.js +19 -0
- package/dist/components/drawer.d.ts +22 -0
- package/dist/components/drawer.js +37 -0
- package/dist/components/dropdown-menu.d.ts +32 -0
- package/dist/components/dropdown-menu.js +56 -0
- package/dist/components/dynamic-island.d.ts +26 -0
- package/dist/components/dynamic-island.js +31 -0
- package/dist/components/empty.d.ts +7 -0
- package/dist/components/empty.js +24 -0
- package/dist/components/expandable-tabs.d.ts +24 -0
- package/dist/components/expandable-tabs.js +30 -0
- package/dist/components/fab.d.ts +35 -0
- package/dist/components/fab.js +36 -0
- package/dist/components/field.d.ts +6 -0
- package/dist/components/field.js +22 -0
- package/dist/components/file-dropzone.d.ts +28 -0
- package/dist/components/file-dropzone.js +59 -0
- package/dist/components/flickering-grid.d.ts +25 -0
- package/dist/components/flickering-grid.js +30 -0
- package/dist/components/flip-card.d.ts +70 -0
- package/dist/components/flip-card.js +117 -0
- package/dist/components/floating-label-input.d.ts +34 -0
- package/dist/components/floating-label-input.js +25 -0
- package/dist/components/form.d.ts +25 -0
- package/dist/components/form.js +68 -0
- package/dist/components/frame.d.ts +12 -0
- package/dist/components/frame.js +10 -0
- package/dist/components/funnel-chart.d.ts +11 -0
- package/dist/components/funnel-chart.js +16 -0
- package/dist/components/gauge-chart.d.ts +8 -0
- package/dist/components/gauge-chart.js +10 -0
- package/dist/components/glare-hover.d.ts +15 -0
- package/dist/components/glare-hover.js +64 -0
- package/dist/components/glass-card.d.ts +3 -0
- package/dist/components/glass-card.js +8 -0
- package/dist/components/gradient-border.d.ts +7 -0
- package/dist/components/gradient-border.js +8 -0
- package/dist/components/gradient-text.d.ts +6 -0
- package/dist/components/gradient-text.js +10 -0
- package/dist/components/grid-pattern.d.ts +23 -0
- package/dist/components/grid-pattern.js +18 -0
- package/dist/components/heatmap-chart.d.ts +6 -0
- package/dist/components/heatmap-chart.js +8 -0
- package/dist/components/heatmap.d.ts +28 -0
- package/dist/components/heatmap.js +41 -0
- package/dist/components/highlighter.d.ts +20 -0
- package/dist/components/highlighter.js +19 -0
- package/dist/components/hover-card.d.ts +5 -0
- package/dist/components/hover-card.js +12 -0
- package/dist/components/image-zoom.d.ts +47 -0
- package/dist/components/image-zoom.js +125 -0
- package/dist/components/input-group.d.ts +10 -0
- package/dist/components/input-group.js +12 -0
- package/dist/components/input-otp.d.ts +18 -0
- package/dist/components/input-otp.js +38 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +8 -0
- package/dist/components/json-viewer.d.ts +43 -0
- package/dist/components/json-viewer.js +313 -0
- package/dist/components/kanban.d.ts +31 -0
- package/dist/components/kanban.js +143 -0
- package/dist/components/kbd.d.ts +3 -0
- package/dist/components/kbd.js +8 -0
- package/dist/components/label.d.ts +3 -0
- package/dist/components/label.js +9 -0
- package/dist/components/light-rays.d.ts +19 -0
- package/dist/components/light-rays.js +20 -0
- package/dist/components/lightbox.d.ts +24 -0
- package/dist/components/lightbox.js +68 -0
- package/dist/components/line-chart.d.ts +10 -0
- package/dist/components/line-chart.js +9 -0
- package/dist/components/live-line-chart.d.ts +12 -0
- package/dist/components/live-line-chart.js +42 -0
- package/dist/components/logo-carousel.d.ts +27 -0
- package/dist/components/logo-carousel.js +101 -0
- package/dist/components/magnetic.d.ts +44 -0
- package/dist/components/magnetic.js +172 -0
- package/dist/components/marquee.d.ts +71 -0
- package/dist/components/marquee.js +141 -0
- package/dist/components/masonry.d.ts +16 -0
- package/dist/components/masonry.js +84 -0
- package/dist/components/menubar.d.ts +33 -0
- package/dist/components/menubar.js +56 -0
- package/dist/components/meteors.d.ts +20 -0
- package/dist/components/meteors.js +39 -0
- package/dist/components/metric.d.ts +9 -0
- package/dist/components/metric.js +35 -0
- package/dist/components/mode-toggle.d.ts +32 -0
- package/dist/components/mode-toggle.js +40 -0
- package/dist/components/morphing-popover.d.ts +91 -0
- package/dist/components/morphing-popover.js +194 -0
- package/dist/components/motion-presets.d.ts +9 -0
- package/dist/components/motion-presets.js +20 -0
- package/dist/components/multi-select.d.ts +54 -0
- package/dist/components/multi-select.js +0 -0
- package/dist/components/navigation-menu.d.ts +12 -0
- package/dist/components/navigation-menu.js +42 -0
- package/dist/components/noise.d.ts +19 -0
- package/dist/components/noise.js +18 -0
- package/dist/components/notification-center.d.ts +68 -0
- package/dist/components/notification-center.js +57 -0
- package/dist/components/number-input.d.ts +45 -0
- package/dist/components/number-input.js +148 -0
- package/dist/components/orbit.d.ts +77 -0
- package/dist/components/orbit.js +100 -0
- package/dist/components/pagination.d.ts +16 -0
- package/dist/components/pagination.js +34 -0
- package/dist/components/particles.d.ts +18 -0
- package/dist/components/particles.js +92 -0
- package/dist/components/password-input.d.ts +16 -0
- package/dist/components/password-input.js +49 -0
- package/dist/components/phone-input.d.ts +67 -0
- package/dist/components/phone-input.js +225 -0
- package/dist/components/pie-chart.d.ts +12 -0
- package/dist/components/pie-chart.js +13 -0
- package/dist/components/pill-nav.d.ts +25 -0
- package/dist/components/pill-nav.js +66 -0
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.js +15 -0
- package/dist/components/profit-loss-chart.d.ts +10 -0
- package/dist/components/profit-loss-chart.js +8 -0
- package/dist/components/progress.d.ts +10 -0
- package/dist/components/progress.js +17 -0
- package/dist/components/progressive-blur.d.ts +24 -0
- package/dist/components/progressive-blur.js +43 -0
- package/dist/components/radar-chart.d.ts +9 -0
- package/dist/components/radar-chart.js +9 -0
- package/dist/components/radio-group.d.ts +4 -0
- package/dist/components/radio-group.js +15 -0
- package/dist/components/rating.d.ts +29 -0
- package/dist/components/rating.js +94 -0
- package/dist/components/resizable.d.ts +57 -0
- package/dist/components/resizable.js +73 -0
- package/dist/components/retro-grid.d.ts +25 -0
- package/dist/components/retro-grid.js +26 -0
- package/dist/components/reveal.d.ts +9 -0
- package/dist/components/reveal.js +14 -0
- package/dist/components/rich-text-editor.d.ts +28 -0
- package/dist/components/rich-text-editor.js +83 -0
- package/dist/components/ring-chart.d.ts +13 -0
- package/dist/components/ring-chart.js +16 -0
- package/dist/components/ripple.d.ts +25 -0
- package/dist/components/ripple.js +26 -0
- package/dist/components/sankey-chart.d.ts +16 -0
- package/dist/components/sankey-chart.js +8 -0
- package/dist/components/scatter-chart.d.ts +12 -0
- package/dist/components/scatter-chart.js +9 -0
- package/dist/components/scheduler.d.ts +50 -0
- package/dist/components/scheduler.js +93 -0
- package/dist/components/scramble-text.d.ts +39 -0
- package/dist/components/scramble-text.js +78 -0
- package/dist/components/scroll-area.d.ts +13 -0
- package/dist/components/scroll-area.js +14 -0
- package/dist/components/scroll-progress.d.ts +19 -0
- package/dist/components/scroll-progress.js +67 -0
- package/dist/components/segmented-control.d.ts +48 -0
- package/dist/components/segmented-control.js +222 -0
- package/dist/components/select.d.ts +12 -0
- package/dist/components/select.js +43 -0
- package/dist/components/separator.d.ts +3 -0
- package/dist/components/separator.js +9 -0
- package/dist/components/sheet.d.ts +25 -0
- package/dist/components/sheet.js +47 -0
- package/dist/components/shimmer.d.ts +3 -0
- package/dist/components/shimmer.js +8 -0
- package/dist/components/shiny-text.d.ts +20 -0
- package/dist/components/shiny-text.js +24 -0
- package/dist/components/sidebar.d.ts +92 -0
- package/dist/components/sidebar.js +290 -0
- package/dist/components/signature-pad.d.ts +44 -0
- package/dist/components/signature-pad.js +317 -0
- package/dist/components/skeleton.d.ts +3 -0
- package/dist/components/skeleton.js +8 -0
- package/dist/components/slider.d.ts +10 -0
- package/dist/components/slider.js +27 -0
- package/dist/components/sonner.d.ts +9 -0
- package/dist/components/sonner.js +17 -0
- package/dist/components/sparkles-text.d.ts +19 -0
- package/dist/components/sparkles-text.js +36 -0
- package/dist/components/sparkline.d.ts +22 -0
- package/dist/components/sparkline.js +100 -0
- package/dist/components/spinner.d.ts +10 -0
- package/dist/components/spinner.js +20 -0
- package/dist/components/spinning-text.d.ts +29 -0
- package/dist/components/spinning-text.js +40 -0
- package/dist/components/split-button.d.ts +71 -0
- package/dist/components/split-button.js +30 -0
- package/dist/components/spotlight-card.d.ts +11 -0
- package/dist/components/spotlight-card.js +63 -0
- package/dist/components/star-border.d.ts +19 -0
- package/dist/components/star-border.js +18 -0
- package/dist/components/status-dot.d.ts +60 -0
- package/dist/components/status-dot.js +76 -0
- package/dist/components/stepper.d.ts +98 -0
- package/dist/components/stepper.js +164 -0
- package/dist/components/sunburst-chart.d.ts +11 -0
- package/dist/components/sunburst-chart.js +45 -0
- package/dist/components/switch.d.ts +3 -0
- package/dist/components/switch.js +10 -0
- package/dist/components/table-of-contents.d.ts +64 -0
- package/dist/components/table-of-contents.js +0 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +38 -0
- package/dist/components/tabs.d.ts +6 -0
- package/dist/components/tabs.js +22 -0
- package/dist/components/tags-input.d.ts +39 -0
- package/dist/components/tags-input.js +86 -0
- package/dist/components/terminal.d.ts +86 -0
- package/dist/components/terminal.js +182 -0
- package/dist/components/text-effect.d.ts +71 -0
- package/dist/components/text-effect.js +166 -0
- package/dist/components/textarea.d.ts +6 -0
- package/dist/components/textarea.js +8 -0
- package/dist/components/tilt-card.d.ts +30 -0
- package/dist/components/tilt-card.js +84 -0
- package/dist/components/time-picker.d.ts +58 -0
- package/dist/components/time-picker.js +245 -0
- package/dist/components/timeline.d.ts +81 -0
- package/dist/components/timeline.js +165 -0
- package/dist/components/toggle-group.d.ts +12 -0
- package/dist/components/toggle-group.js +23 -0
- package/dist/components/toggle.d.ts +12 -0
- package/dist/components/toggle.js +25 -0
- package/dist/components/toolbar.d.ts +14 -0
- package/dist/components/toolbar.js +89 -0
- package/dist/components/tooltip.d.ts +29 -0
- package/dist/components/tooltip.js +48 -0
- package/dist/components/tree-view.d.ts +45 -0
- package/dist/components/tree-view.js +197 -0
- package/dist/components/typing-text.d.ts +49 -0
- package/dist/components/typing-text.js +90 -0
- package/dist/components/usage-meter.d.ts +30 -0
- package/dist/components/usage-meter.js +90 -0
- package/dist/components/video-player.d.ts +48 -0
- package/dist/components/video-player.js +216 -0
- package/dist/components/word-rotate.d.ts +40 -0
- package/dist/components/word-rotate.js +34 -0
- package/dist/index.d.ts +306 -0
- package/dist/index.js +179 -0
- package/dist/lib/cn.d.ts +7 -0
- package/dist/lib/cn.js +10 -0
- package/dist/lib/demo-saas.d.ts +171 -0
- package/dist/lib/demo-saas.js +210 -0
- package/dist/lib/demo-store.d.ts +157 -0
- package/dist/lib/demo-store.js +353 -0
- package/dist/testing/index.d.ts +76 -0
- package/dist/testing/index.js +116 -0
- package/package.json +941 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { scaleLinear, scaleTime } from "@visx/scale";
|
|
4
|
+
import { bisector, extent } from "d3-array";
|
|
5
|
+
import { Children, cloneElement, isValidElement, memo, useCallback, useEffect, useMemo, useState, } from "react";
|
|
6
|
+
import { DEFAULT_ANIMATION_EASING, DEFAULT_CHART_ENTER_TRANSITION } from "./animation.js";
|
|
7
|
+
import { isClipExcludedComponent, isPostOverlayComponent, isUnderlayComponent, resolveChartChildElement, } from "./chart-child-passthrough.js";
|
|
8
|
+
import { ChartProvider } from "./chart-context.js";
|
|
9
|
+
import { isGradientDefComponent, isPatternDefComponent } from "./chart-defs.js";
|
|
10
|
+
import { shortDateFmt } from "./chart-formatters.js";
|
|
11
|
+
import { DEFAULT_CHART_STATUS, DEFAULT_Y_DOMAIN_TWEEN_MS, isChartInteractionPhase, } from "./chart-phase.js";
|
|
12
|
+
import { ChartRevealClip } from "./chart-reveal-clip.js";
|
|
13
|
+
import { decimateTimeSeries, maxRenderPointsForWidth } from "./decimate-time-series.js";
|
|
14
|
+
import { filterDataByXDomain } from "./filter-data-by-x-domain.js";
|
|
15
|
+
import { generateChartSkeletonData, generateChartSkeletonFromTarget, } from "./generate-chart-skeleton-data.js";
|
|
16
|
+
import { extractProjectionLineConfigs, mergeProjectionXDomainMax, mergeProjectionYDomain, } from "./projection-config.js";
|
|
17
|
+
import { extractReferenceAreaConfigs } from "./reference-area-config.js";
|
|
18
|
+
import { ReferenceAreaRegistrationContext } from "./reference-area-registration-context.js";
|
|
19
|
+
import { computeSeriesBarRevealClipPadding, computeSeriesBarWidth } from "./series-bar-layout.js";
|
|
20
|
+
import { useStaticChartPreview } from "./static-chart-preview-context.js";
|
|
21
|
+
import { useAnimatedYDomains } from "./use-animated-y-domains.js";
|
|
22
|
+
import { useChartInteraction } from "./use-chart-interaction.js";
|
|
23
|
+
import { useChartPhaseOrchestrator } from "./use-chart-phase-orchestrator.js";
|
|
24
|
+
import { buildYScalesFromDomains, DEFAULT_Y_AXIS_ID, getPrimaryYScale, groupLinesByYAxisId, } from "./y-axis-scales.js";
|
|
25
|
+
import { computeYDomainsByAxis } from "./y-domain-utils.js";
|
|
26
|
+
function collectNumericExtents(data, dataKeys) {
|
|
27
|
+
let minValue = Number.POSITIVE_INFINITY;
|
|
28
|
+
let maxValue = Number.NEGATIVE_INFINITY;
|
|
29
|
+
for (const d of data) {
|
|
30
|
+
for (const key of dataKeys) {
|
|
31
|
+
const value = d[key];
|
|
32
|
+
if (typeof value === "number") {
|
|
33
|
+
if (value < minValue) {
|
|
34
|
+
minValue = value;
|
|
35
|
+
}
|
|
36
|
+
if (value > maxValue) {
|
|
37
|
+
maxValue = value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (minValue === Number.POSITIVE_INFINITY) {
|
|
43
|
+
return { minValue: 0, maxValue: 100 };
|
|
44
|
+
}
|
|
45
|
+
return { minValue, maxValue };
|
|
46
|
+
}
|
|
47
|
+
function resolveTimeSeriesYDomain(data, dataKeys, yScaleDomainMax) {
|
|
48
|
+
if (yScaleDomainMax != null && yScaleDomainMax > 0) {
|
|
49
|
+
return [0, yScaleDomainMax * 1.1];
|
|
50
|
+
}
|
|
51
|
+
const { minValue, maxValue } = collectNumericExtents(data, dataKeys);
|
|
52
|
+
if (minValue >= 0) {
|
|
53
|
+
const top = maxValue <= 0 ? 100 : maxValue * 1.1;
|
|
54
|
+
return [0, top];
|
|
55
|
+
}
|
|
56
|
+
const padding = (maxValue - minValue) * 0.05 || 1;
|
|
57
|
+
return [minValue - padding, maxValue + padding];
|
|
58
|
+
}
|
|
59
|
+
function ensureChildKey(child, index) {
|
|
60
|
+
if (child.key != null) {
|
|
61
|
+
return child;
|
|
62
|
+
}
|
|
63
|
+
return cloneElement(child, { key: `chart-child-${index}` });
|
|
64
|
+
}
|
|
65
|
+
export function TimeSeriesChartInner(props) {
|
|
66
|
+
const { width, height } = props;
|
|
67
|
+
if (width < 10 || height < 10) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return _jsx(TimeSeriesChartCore, { ...props });
|
|
71
|
+
}
|
|
72
|
+
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, }) {
|
|
73
|
+
const staticPreview = useStaticChartPreview();
|
|
74
|
+
const innerWidth = width - margin.left - margin.right;
|
|
75
|
+
const innerHeight = height - margin.top - margin.bottom;
|
|
76
|
+
const resolveYDomain = useCallback((sourceData, dataKeys) => {
|
|
77
|
+
const axisGroups = groupLinesByYAxisId(lines);
|
|
78
|
+
const usesDefaultOnly = axisGroups.size === 1 && axisGroups.has(DEFAULT_Y_AXIS_ID);
|
|
79
|
+
const domainMax = usesDefaultOnly && yScaleDomainMax != null ? yScaleDomainMax : undefined;
|
|
80
|
+
return resolveTimeSeriesYDomain(sourceData, dataKeys, domainMax);
|
|
81
|
+
}, [lines, yScaleDomainMax]);
|
|
82
|
+
const skeletonData = useMemo(() => {
|
|
83
|
+
const primaryKey = lines[0]?.dataKey ?? "value";
|
|
84
|
+
if (data.length === 0) {
|
|
85
|
+
return generateChartSkeletonData({ dataKey: primaryKey });
|
|
86
|
+
}
|
|
87
|
+
return generateChartSkeletonFromTarget(data, primaryKey);
|
|
88
|
+
}, [data, lines]);
|
|
89
|
+
const { chartPhase, plotData, revealEpoch, concealEpoch, isLoaded, notifyLoadingPulseComplete, notifyRevealConcealComplete, notifyYDomainTweenComplete, } = useChartPhaseOrchestrator({
|
|
90
|
+
animationDuration,
|
|
91
|
+
chartStatus,
|
|
92
|
+
revealSignature,
|
|
93
|
+
skeletonData,
|
|
94
|
+
skipEnterReveal: staticPreview,
|
|
95
|
+
targetData: data,
|
|
96
|
+
yDomainTweenDuration,
|
|
97
|
+
});
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
onPhaseChange?.(chartPhase);
|
|
100
|
+
}, [chartPhase, onPhaseChange]);
|
|
101
|
+
const xAccessor = useCallback((d) => {
|
|
102
|
+
const value = d[xDataKey];
|
|
103
|
+
return value instanceof Date ? value : new Date(value);
|
|
104
|
+
}, [xDataKey]);
|
|
105
|
+
const bisectDate = useMemo(() => bisector((d) => xAccessor(d)).left, [xAccessor]);
|
|
106
|
+
const visiblePlotData = useMemo(() => {
|
|
107
|
+
if (!xDomain) {
|
|
108
|
+
return plotData;
|
|
109
|
+
}
|
|
110
|
+
return filterDataByXDomain(plotData, xDomain, xAccessor);
|
|
111
|
+
}, [plotData, xDomain, xAccessor]);
|
|
112
|
+
const projectionConfigs = useMemo(() => extractProjectionLineConfigs(children), [children]);
|
|
113
|
+
const xScale = useMemo(() => {
|
|
114
|
+
const minTime = xDomain
|
|
115
|
+
? xDomain[0].getTime()
|
|
116
|
+
: (extent(plotData, (d) => xAccessor(d).getTime())[0] ?? 0);
|
|
117
|
+
let maxTime = xDomain
|
|
118
|
+
? xDomain[1].getTime()
|
|
119
|
+
: (extent(plotData, (d) => xAccessor(d).getTime())[1] ?? minTime);
|
|
120
|
+
// Brush defines the viewport — projection horizon is included via brush
|
|
121
|
+
// track extent, not by extending past the selection on the main chart.
|
|
122
|
+
if (!xDomain) {
|
|
123
|
+
maxTime = mergeProjectionXDomainMax(maxTime, projectionConfigs);
|
|
124
|
+
}
|
|
125
|
+
return scaleTime({
|
|
126
|
+
range: [0, innerWidth],
|
|
127
|
+
domain: [minTime, maxTime],
|
|
128
|
+
});
|
|
129
|
+
}, [innerWidth, plotData, projectionConfigs, xAccessor, xDomain]);
|
|
130
|
+
// When brushing, keep the full series for path rendering so edge fades stay
|
|
131
|
+
// anchored to the viewport while the line pans through them. Y-domain and
|
|
132
|
+
// interaction still use the filtered visible slice.
|
|
133
|
+
const seriesSourceData = xDomain ? plotData : visiblePlotData;
|
|
134
|
+
const renderData = useMemo(() => {
|
|
135
|
+
const valueKeys = lines.map((line) => line.dataKey);
|
|
136
|
+
return decimateTimeSeries(seriesSourceData, maxRenderPointsForWidth(innerWidth), valueKeys);
|
|
137
|
+
}, [seriesSourceData, innerWidth, lines]);
|
|
138
|
+
const columnWidth = useMemo(() => {
|
|
139
|
+
const slotCount = xDomain && xDomainSlotCount != null ? xDomainSlotCount : visiblePlotData.length;
|
|
140
|
+
if (slotCount < 2) {
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
143
|
+
return innerWidth / (slotCount - 1);
|
|
144
|
+
}, [innerWidth, visiblePlotData.length, xDomain, xDomainSlotCount]);
|
|
145
|
+
const yDomainSkeletonByAxis = useMemo(() => computeYDomainsByAxis({
|
|
146
|
+
lines,
|
|
147
|
+
resolveDomain: (dataKeys) => resolveYDomain(skeletonData, dataKeys),
|
|
148
|
+
}), [lines, resolveYDomain, skeletonData]);
|
|
149
|
+
const yDomainTargetByAxis = useMemo(() => {
|
|
150
|
+
const base = computeYDomainsByAxis({
|
|
151
|
+
lines,
|
|
152
|
+
resolveDomain: (dataKeys) => resolveYDomain(xDomain ? visiblePlotData : data, dataKeys),
|
|
153
|
+
});
|
|
154
|
+
if (projectionConfigs.length === 0) {
|
|
155
|
+
return base;
|
|
156
|
+
}
|
|
157
|
+
const merged = { ...base };
|
|
158
|
+
for (const axisId of Object.keys(base)) {
|
|
159
|
+
merged[axisId] = mergeProjectionYDomain(base[axisId] ?? [0, 100], projectionConfigs, axisId);
|
|
160
|
+
}
|
|
161
|
+
for (const config of projectionConfigs) {
|
|
162
|
+
if (!merged[config.yAxisId]) {
|
|
163
|
+
merged[config.yAxisId] = mergeProjectionYDomain([0, 100], projectionConfigs, config.yAxisId);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return merged;
|
|
167
|
+
}, [data, lines, projectionConfigs, resolveYDomain, visiblePlotData, xDomain]);
|
|
168
|
+
const animatedYDomainsByAxis = useAnimatedYDomains({
|
|
169
|
+
chartPhase,
|
|
170
|
+
durationMs: yDomainTweenDuration,
|
|
171
|
+
enabled: yDomainTween,
|
|
172
|
+
onSettled: notifyYDomainTweenComplete,
|
|
173
|
+
skeletonByAxis: yDomainSkeletonByAxis,
|
|
174
|
+
targetByAxis: yDomainTargetByAxis,
|
|
175
|
+
tweenOnTargetChange: yDomainTween || (tweenYDomainOnXDomainChange && xDomain != null),
|
|
176
|
+
});
|
|
177
|
+
const yDomainsForScales = animatedYDomainsByAxis;
|
|
178
|
+
const yScales = useMemo(() => buildYScalesFromDomains({
|
|
179
|
+
domainsByAxis: yDomainsForScales,
|
|
180
|
+
innerHeight,
|
|
181
|
+
lines,
|
|
182
|
+
}), [yDomainsForScales, innerHeight, lines]);
|
|
183
|
+
const yScale = getPrimaryYScale(yScales, scaleLinear({ range: [innerHeight, 0], domain: [0, 100], nice: true }));
|
|
184
|
+
const dateLabels = useMemo(() => visiblePlotData.map((d) => shortDateFmt.format(xAccessor(d))), [visiblePlotData, xAccessor]);
|
|
185
|
+
const canInteract = isLoaded && isChartInteractionPhase(chartPhase);
|
|
186
|
+
const { tooltipData, setTooltipData, selection, clearSelection, interactionHandlers, interactionStyle, } = useChartInteraction({
|
|
187
|
+
bisectDate,
|
|
188
|
+
canInteract,
|
|
189
|
+
data: visiblePlotData,
|
|
190
|
+
lines,
|
|
191
|
+
margin,
|
|
192
|
+
xAccessor,
|
|
193
|
+
xScale,
|
|
194
|
+
yScale,
|
|
195
|
+
yScales,
|
|
196
|
+
});
|
|
197
|
+
const defsChildren = [];
|
|
198
|
+
const clipExcludedChildren = [];
|
|
199
|
+
const underlayChildren = [];
|
|
200
|
+
const preOverlayChildren = [];
|
|
201
|
+
const postOverlayChildren = [];
|
|
202
|
+
Children.forEach(children, (child, index) => {
|
|
203
|
+
if (!isValidElement(child)) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const keyedChild = ensureChildKey(child, index);
|
|
207
|
+
const resolvedChild = resolveChartChildElement(keyedChild);
|
|
208
|
+
if (isGradientDefComponent(resolvedChild)) {
|
|
209
|
+
defsChildren.push(resolvedChild);
|
|
210
|
+
}
|
|
211
|
+
else if (isPatternDefComponent(resolvedChild)) {
|
|
212
|
+
preOverlayChildren.push(resolvedChild);
|
|
213
|
+
}
|
|
214
|
+
else if (isPostOverlayComponent(resolvedChild)) {
|
|
215
|
+
postOverlayChildren.push(resolvedChild);
|
|
216
|
+
}
|
|
217
|
+
else if (isClipExcludedComponent(resolvedChild)) {
|
|
218
|
+
clipExcludedChildren.push(resolvedChild);
|
|
219
|
+
}
|
|
220
|
+
else if (isUnderlayComponent(resolvedChild)) {
|
|
221
|
+
underlayChildren.push(resolvedChild);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
preOverlayChildren.push(resolvedChild);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
const [registeredReferenceAreas, setRegisteredReferenceAreas] = useState(() => new Map());
|
|
228
|
+
const registerReferenceArea = useCallback((id, config) => {
|
|
229
|
+
setRegisteredReferenceAreas((prev) => {
|
|
230
|
+
const existing = prev.get(id);
|
|
231
|
+
if (existing &&
|
|
232
|
+
existing.yAxisId === config.yAxisId &&
|
|
233
|
+
existing.y1 === config.y1 &&
|
|
234
|
+
existing.y2 === config.y2 &&
|
|
235
|
+
existing.axisLabelColor === config.axisLabelColor) {
|
|
236
|
+
return prev;
|
|
237
|
+
}
|
|
238
|
+
const next = new Map(prev);
|
|
239
|
+
next.set(id, config);
|
|
240
|
+
return next;
|
|
241
|
+
});
|
|
242
|
+
}, []);
|
|
243
|
+
const unregisterReferenceArea = useCallback((id) => {
|
|
244
|
+
setRegisteredReferenceAreas((prev) => {
|
|
245
|
+
if (!prev.has(id)) {
|
|
246
|
+
return prev;
|
|
247
|
+
}
|
|
248
|
+
const next = new Map(prev);
|
|
249
|
+
next.delete(id);
|
|
250
|
+
return next;
|
|
251
|
+
});
|
|
252
|
+
}, []);
|
|
253
|
+
const referenceAreaRegistration = useMemo(() => ({ registerReferenceArea, unregisterReferenceArea }), [registerReferenceArea, unregisterReferenceArea]);
|
|
254
|
+
const referenceAreas = useMemo(() => {
|
|
255
|
+
const extracted = extractReferenceAreaConfigs(children);
|
|
256
|
+
const registered = [...registeredReferenceAreas.values()];
|
|
257
|
+
if (registered.length === 0) {
|
|
258
|
+
return extracted;
|
|
259
|
+
}
|
|
260
|
+
if (extracted.length === 0) {
|
|
261
|
+
return registered;
|
|
262
|
+
}
|
|
263
|
+
return [...extracted, ...registered];
|
|
264
|
+
}, [children, registeredReferenceAreas]);
|
|
265
|
+
const contextValue = useMemo(() => ({
|
|
266
|
+
data: visiblePlotData,
|
|
267
|
+
renderData,
|
|
268
|
+
xScale,
|
|
269
|
+
yScale,
|
|
270
|
+
yScales,
|
|
271
|
+
width,
|
|
272
|
+
height,
|
|
273
|
+
innerWidth,
|
|
274
|
+
innerHeight,
|
|
275
|
+
margin,
|
|
276
|
+
columnWidth,
|
|
277
|
+
tooltipData,
|
|
278
|
+
setTooltipData,
|
|
279
|
+
containerRef,
|
|
280
|
+
lines,
|
|
281
|
+
referenceAreas,
|
|
282
|
+
chartPhase,
|
|
283
|
+
chartStatus,
|
|
284
|
+
loadingLabel,
|
|
285
|
+
yDomainTweenDuration,
|
|
286
|
+
yDomainSkeletonByAxis,
|
|
287
|
+
yDomainTargetByAxis,
|
|
288
|
+
isLoaded,
|
|
289
|
+
animationDuration,
|
|
290
|
+
animationEasing,
|
|
291
|
+
enterTransition,
|
|
292
|
+
revealEpoch,
|
|
293
|
+
notifyLoadingPulseComplete,
|
|
294
|
+
xAccessor,
|
|
295
|
+
dateLabels,
|
|
296
|
+
xDomain,
|
|
297
|
+
xDomainSlotCount,
|
|
298
|
+
selection,
|
|
299
|
+
clearSelection,
|
|
300
|
+
composedBarDataKeys,
|
|
301
|
+
composedBarSize,
|
|
302
|
+
composedMaxBarSize,
|
|
303
|
+
composedBarGap,
|
|
304
|
+
composedStacked,
|
|
305
|
+
composedStackOffsets,
|
|
306
|
+
composedStackGap,
|
|
307
|
+
}), [
|
|
308
|
+
visiblePlotData,
|
|
309
|
+
renderData,
|
|
310
|
+
xScale,
|
|
311
|
+
yScale,
|
|
312
|
+
yScales,
|
|
313
|
+
width,
|
|
314
|
+
height,
|
|
315
|
+
innerWidth,
|
|
316
|
+
innerHeight,
|
|
317
|
+
margin,
|
|
318
|
+
columnWidth,
|
|
319
|
+
tooltipData,
|
|
320
|
+
setTooltipData,
|
|
321
|
+
containerRef,
|
|
322
|
+
lines,
|
|
323
|
+
referenceAreas,
|
|
324
|
+
chartPhase,
|
|
325
|
+
chartStatus,
|
|
326
|
+
loadingLabel,
|
|
327
|
+
yDomainTweenDuration,
|
|
328
|
+
yDomainSkeletonByAxis,
|
|
329
|
+
yDomainTargetByAxis,
|
|
330
|
+
isLoaded,
|
|
331
|
+
animationDuration,
|
|
332
|
+
animationEasing,
|
|
333
|
+
enterTransition,
|
|
334
|
+
revealEpoch,
|
|
335
|
+
notifyLoadingPulseComplete,
|
|
336
|
+
xAccessor,
|
|
337
|
+
dateLabels,
|
|
338
|
+
xDomain,
|
|
339
|
+
xDomainSlotCount,
|
|
340
|
+
selection,
|
|
341
|
+
clearSelection,
|
|
342
|
+
composedBarDataKeys,
|
|
343
|
+
composedBarSize,
|
|
344
|
+
composedMaxBarSize,
|
|
345
|
+
composedBarGap,
|
|
346
|
+
composedStacked,
|
|
347
|
+
composedStackOffsets,
|
|
348
|
+
composedStackGap,
|
|
349
|
+
]);
|
|
350
|
+
const useClipReveal = !staticPreview && renderData.length > 1 && innerWidth > 0 && animationDuration > 0;
|
|
351
|
+
const isRevealAnimating = chartPhase === "revealing";
|
|
352
|
+
const isRevealConcealing = chartPhase === "exitingReady" && animationDuration > 0;
|
|
353
|
+
const effectiveEnterTransition = enterTransition ??
|
|
354
|
+
{
|
|
355
|
+
...DEFAULT_CHART_ENTER_TRANSITION,
|
|
356
|
+
duration: animationDuration / 1000,
|
|
357
|
+
};
|
|
358
|
+
const revealClipPadding = useMemo(() => {
|
|
359
|
+
if (!composedBarDataKeys?.length) {
|
|
360
|
+
return 0;
|
|
361
|
+
}
|
|
362
|
+
const barWidth = computeSeriesBarWidth({
|
|
363
|
+
columnWidth,
|
|
364
|
+
composedBarGap,
|
|
365
|
+
composedBarSize,
|
|
366
|
+
composedMaxBarSize,
|
|
367
|
+
dataLength: plotData.length,
|
|
368
|
+
innerWidth,
|
|
369
|
+
seriesCount: composedBarDataKeys.length,
|
|
370
|
+
stacked: composedStacked,
|
|
371
|
+
});
|
|
372
|
+
return computeSeriesBarRevealClipPadding({
|
|
373
|
+
barWidth,
|
|
374
|
+
gap: composedBarGap,
|
|
375
|
+
seriesCount: composedBarDataKeys.length,
|
|
376
|
+
stacked: composedStacked,
|
|
377
|
+
});
|
|
378
|
+
}, [
|
|
379
|
+
columnWidth,
|
|
380
|
+
composedBarDataKeys,
|
|
381
|
+
composedBarGap,
|
|
382
|
+
composedBarSize,
|
|
383
|
+
composedMaxBarSize,
|
|
384
|
+
composedStacked,
|
|
385
|
+
innerWidth,
|
|
386
|
+
plotData.length,
|
|
387
|
+
]);
|
|
388
|
+
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] })] }) }) }));
|
|
389
|
+
});
|
|
390
|
+
//# sourceMappingURL=time-series-chart-shell.js.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type SpringConfig } from "../chart-config-context.js";
|
|
2
|
+
import { type LineConfig } from "../chart-context.js";
|
|
3
|
+
import type { IndicatorFadeEdges } from "../indicator-fade.js";
|
|
4
|
+
import { type TooltipRow } from "./tooltip-content.js";
|
|
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.Element | null;
|
|
72
|
+
export declare namespace ChartTooltip {
|
|
73
|
+
var displayName: string;
|
|
74
|
+
}
|
|
75
|
+
export default ChartTooltip;
|
|
76
|
+
//# sourceMappingURL=chart-tooltip.d.ts.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { motion, useSpring } from "motion/react";
|
|
4
|
+
import { memo, useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
|
+
import { resolveTooltipBoxMotion, useChartConfig, } from "../chart-config-context.js";
|
|
7
|
+
import { chartCssVars, useChart, useChartStable } from "../chart-context.js";
|
|
8
|
+
import { weekdayDateFmt } from "../chart-formatters.js";
|
|
9
|
+
import { DateTicker } from "./date-ticker.js";
|
|
10
|
+
import { TooltipBox } from "./tooltip-box.js";
|
|
11
|
+
import { TooltipContent } from "./tooltip-content.js";
|
|
12
|
+
import { TooltipDot } from "./tooltip-dot.js";
|
|
13
|
+
import { TooltipIndicator } from "./tooltip-indicator.js";
|
|
14
|
+
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, }) {
|
|
15
|
+
const { tooltipData, width, height, innerHeight, margin, columnWidth, lines, xAccessor, dateLabels, containerRef, orientation, barXAccessor, bandWidth, squareSnap, } = useChart();
|
|
16
|
+
const { tooltipSpring } = useChartConfig();
|
|
17
|
+
const isHorizontal = orientation === "horizontal";
|
|
18
|
+
const discreteInteraction = dateLabels.length > 60;
|
|
19
|
+
const resolvedDotSize = useMemo(() => {
|
|
20
|
+
if (dotVariant !== "ring" || !bandWidth || lines.length === 0) {
|
|
21
|
+
return dotSize * dotScale;
|
|
22
|
+
}
|
|
23
|
+
const seriesCount = lines.length;
|
|
24
|
+
const gap = squareSnap?.groupGap ?? (seriesCount > 1 ? 4 : 0);
|
|
25
|
+
const squareSize = (bandWidth - gap * (seriesCount - 1)) / seriesCount;
|
|
26
|
+
return (squareSize / 2) * dotScale;
|
|
27
|
+
}, [bandWidth, dotScale, dotSize, dotVariant, lines.length, squareSnap?.groupGap]);
|
|
28
|
+
const boxMotion = useMemo(() => {
|
|
29
|
+
if (boxSpringConfig) {
|
|
30
|
+
return {
|
|
31
|
+
animate: !discreteInteraction,
|
|
32
|
+
springConfig: boxSpringConfig,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (matchCrosshair) {
|
|
36
|
+
return {
|
|
37
|
+
animate: !discreteInteraction,
|
|
38
|
+
springConfig: springConfig ?? tooltipSpring,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return resolveTooltipBoxMotion(damping);
|
|
42
|
+
}, [boxSpringConfig, damping, discreteInteraction, matchCrosshair, springConfig, tooltipSpring]);
|
|
43
|
+
const visible = tooltipData !== null;
|
|
44
|
+
const x = tooltipData?.x ?? 0;
|
|
45
|
+
const xWithMargin = x + margin.left;
|
|
46
|
+
// For horizontal charts, get the y position from the first line's yPosition (center of bar)
|
|
47
|
+
const firstLineDataKey = lines[0]?.dataKey;
|
|
48
|
+
const firstLineY = firstLineDataKey ? (tooltipData?.yPositions[firstLineDataKey] ?? 0) : 0;
|
|
49
|
+
const yWithMargin = firstLineY + margin.top;
|
|
50
|
+
const tooltipRows = useMemo(() => {
|
|
51
|
+
if (!tooltipData) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
if (rowsRenderer) {
|
|
55
|
+
return rowsRenderer(tooltipData.point);
|
|
56
|
+
}
|
|
57
|
+
// Default: generate rows from registered lines
|
|
58
|
+
return lines.map((line) => ({
|
|
59
|
+
color: line.stroke,
|
|
60
|
+
label: line.dataKey,
|
|
61
|
+
value: tooltipData.point[line.dataKey] ?? 0,
|
|
62
|
+
}));
|
|
63
|
+
}, [tooltipData, lines, rowsRenderer]);
|
|
64
|
+
const resolveDotColor = useMemo(() => {
|
|
65
|
+
return (line, index) => {
|
|
66
|
+
if (rowsRenderer && tooltipRows[index]?.color) {
|
|
67
|
+
return tooltipRows[index].color;
|
|
68
|
+
}
|
|
69
|
+
if (dotColorProp != null) {
|
|
70
|
+
if (typeof dotColorProp === "function" && tooltipData) {
|
|
71
|
+
return dotColorProp(tooltipData.point, line);
|
|
72
|
+
}
|
|
73
|
+
if (typeof dotColorProp === "string") {
|
|
74
|
+
return dotColorProp;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return line.stroke;
|
|
78
|
+
};
|
|
79
|
+
}, [dotColorProp, rowsRenderer, tooltipData, tooltipRows]);
|
|
80
|
+
// Resolve indicator color (static or from hovered point)
|
|
81
|
+
const indicatorColor = useMemo(() => {
|
|
82
|
+
if (indicatorColorProp == null) {
|
|
83
|
+
return chartCssVars.crosshair;
|
|
84
|
+
}
|
|
85
|
+
if (typeof indicatorColorProp === "function") {
|
|
86
|
+
return tooltipData ? indicatorColorProp(tooltipData.point) : chartCssVars.crosshair;
|
|
87
|
+
}
|
|
88
|
+
return indicatorColorProp;
|
|
89
|
+
}, [indicatorColorProp, tooltipData]);
|
|
90
|
+
// Title from date or category
|
|
91
|
+
const title = useMemo(() => {
|
|
92
|
+
if (!tooltipData) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
// For bar charts (horizontal or vertical), use the category name
|
|
96
|
+
if (barXAccessor) {
|
|
97
|
+
return barXAccessor(tooltipData.point);
|
|
98
|
+
}
|
|
99
|
+
// For line/area charts, use the date
|
|
100
|
+
return weekdayDateFmt.format(xAccessor(tooltipData.point));
|
|
101
|
+
}, [tooltipData, barXAccessor, xAccessor]);
|
|
102
|
+
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
|
|
103
|
+
? content({
|
|
104
|
+
point: tooltipData.point,
|
|
105
|
+
index: tooltipData.index,
|
|
106
|
+
})
|
|
107
|
+
: !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 })] }));
|
|
108
|
+
return createPortal(tooltipContent, container);
|
|
109
|
+
});
|
|
110
|
+
export function ChartTooltip(props) {
|
|
111
|
+
const { containerRef } = useChartStable();
|
|
112
|
+
const [mounted, setMounted] = useState(false);
|
|
113
|
+
// Only render portals on client side after mount
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
setMounted(true);
|
|
116
|
+
}, []);
|
|
117
|
+
const container = containerRef.current;
|
|
118
|
+
if (!(mounted && container)) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return _jsx(ChartTooltipInner, { ...props, container: container });
|
|
122
|
+
}
|
|
123
|
+
ChartTooltip.displayName = "ChartTooltip";
|
|
124
|
+
// Inner-only-on-visible so `useSpring` initializes at the real cursor x
|
|
125
|
+
// instead of `margin.left` on first hover.
|
|
126
|
+
function DatePillTracker(props) {
|
|
127
|
+
if (!(props.enabled && props.visible && props.labels.length > 0)) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return _jsx(DatePillTrackerInner, { ...props });
|
|
131
|
+
}
|
|
132
|
+
function DatePillTrackerInner({ labels, currentIndex, xWithMargin, discreteInteraction, springConfig, visible, }) {
|
|
133
|
+
const { tooltipSpring } = useChartConfig();
|
|
134
|
+
const effectiveSpring = springConfig ?? tooltipSpring;
|
|
135
|
+
const animatedX = useSpring(xWithMargin, effectiveSpring);
|
|
136
|
+
if (!discreteInteraction) {
|
|
137
|
+
animatedX.set(xWithMargin);
|
|
138
|
+
}
|
|
139
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: we need to jump the animatedX when the visible prop changes
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
animatedX.set(xWithMargin);
|
|
142
|
+
}, [animatedX, visible]);
|
|
143
|
+
return (_jsx(motion.div, { className: "pointer-events-none absolute z-50", style: {
|
|
144
|
+
left: discreteInteraction ? xWithMargin : animatedX,
|
|
145
|
+
transform: "translateX(-50%)",
|
|
146
|
+
bottom: 4,
|
|
147
|
+
}, children: _jsx(DateTicker, { currentIndex: currentIndex, labels: labels, visible: visible }) }));
|
|
148
|
+
}
|
|
149
|
+
export default ChartTooltip;
|
|
150
|
+
//# sourceMappingURL=chart-tooltip.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
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.Element | null;
|
|
7
|
+
export declare namespace DateTicker {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
export default DateTicker;
|
|
11
|
+
//# sourceMappingURL=date-ticker.d.ts.map
|