@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,80 @@
|
|
|
1
|
+
import { Children, Fragment, isValidElement } from "react";
|
|
2
|
+
import { isChartClipPassthrough } from "./chart-child-passthrough.js";
|
|
3
|
+
import { projectionDateExtents, projectionValueExtents } from "./projection-utils.js";
|
|
4
|
+
import { normalizeYAxisId } from "./y-axis-scales.js";
|
|
5
|
+
function getChildComponentName(child) {
|
|
6
|
+
const childType = child.type;
|
|
7
|
+
return typeof child.type === "function" ? childType.displayName || childType.name || "" : "";
|
|
8
|
+
}
|
|
9
|
+
function isProjectionLineElement(child) {
|
|
10
|
+
return getChildComponentName(child) === "ProjectionLine";
|
|
11
|
+
}
|
|
12
|
+
function normalizeProjectionData(data) {
|
|
13
|
+
if (!data?.length) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
return data.map((point) => ({
|
|
17
|
+
date: point.date instanceof Date ? point.date : new Date(point.date),
|
|
18
|
+
value: point.value,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
/** Collect {@link ProjectionLine} props from chart children for domain extension. */
|
|
22
|
+
export function extractProjectionLineConfigs(children) {
|
|
23
|
+
const configs = [];
|
|
24
|
+
const visit = (node) => {
|
|
25
|
+
Children.forEach(node, (child) => {
|
|
26
|
+
if (!isValidElement(child)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (child.type === Fragment) {
|
|
30
|
+
visit(child.props.children);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (isProjectionLineElement(child)) {
|
|
34
|
+
const props = child.props;
|
|
35
|
+
const data = normalizeProjectionData(props?.data);
|
|
36
|
+
if (data.length >= 2) {
|
|
37
|
+
configs.push({
|
|
38
|
+
yAxisId: normalizeYAxisId(props?.yAxisId),
|
|
39
|
+
data,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (isChartClipPassthrough(child.type)) {
|
|
45
|
+
visit(child.props.children);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const childProps = child.props;
|
|
49
|
+
if (childProps?.children) {
|
|
50
|
+
visit(childProps.children);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
visit(children);
|
|
55
|
+
return configs;
|
|
56
|
+
}
|
|
57
|
+
export function mergeProjectionYDomain(domain, configs, yAxisId) {
|
|
58
|
+
const paths = configs.filter((config) => config.yAxisId === yAxisId).map((config) => config.data);
|
|
59
|
+
const extents = projectionValueExtents(paths);
|
|
60
|
+
if (!extents) {
|
|
61
|
+
return domain;
|
|
62
|
+
}
|
|
63
|
+
const [min, max] = domain;
|
|
64
|
+
const nextMin = Math.min(min, extents.minValue);
|
|
65
|
+
const nextMax = Math.max(max, extents.maxValue);
|
|
66
|
+
if (nextMin >= 0 && min >= 0) {
|
|
67
|
+
return [0, nextMax <= 0 ? 100 : nextMax * 1.1];
|
|
68
|
+
}
|
|
69
|
+
const padding = (nextMax - nextMin) * 0.05 || 1;
|
|
70
|
+
return [nextMin - padding, nextMax + padding];
|
|
71
|
+
}
|
|
72
|
+
export function mergeProjectionXDomainMax(maxTime, configs) {
|
|
73
|
+
const paths = configs.map((config) => config.data);
|
|
74
|
+
const extents = projectionDateExtents(paths);
|
|
75
|
+
if (!extents) {
|
|
76
|
+
return maxTime;
|
|
77
|
+
}
|
|
78
|
+
return Math.max(maxTime, extents.maxTime);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=projection-config.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProjectionPoint } from "./projection-utils.js";
|
|
2
|
+
export interface ProjectionLineEndMarkerProps {
|
|
3
|
+
data: ProjectionPoint[];
|
|
4
|
+
yAxisId?: string | number;
|
|
5
|
+
stroke?: string;
|
|
6
|
+
strokeOpacity?: number;
|
|
7
|
+
radius?: number;
|
|
8
|
+
}
|
|
9
|
+
/** Renders the projection horizon dot outside the series reveal clip. */
|
|
10
|
+
export declare function ProjectionLineEndMarker({ data, yAxisId, stroke, strokeOpacity, radius, }: ProjectionLineEndMarkerProps): import("react").JSX.Element | null;
|
|
11
|
+
export declare namespace ProjectionLineEndMarker {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
14
|
+
export default ProjectionLineEndMarker;
|
|
15
|
+
//# sourceMappingURL=projection-line-end-marker.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useChartStable, useYScale } from "./chart-context.js";
|
|
5
|
+
/** Renders the projection horizon dot outside the series reveal clip. */
|
|
6
|
+
export function ProjectionLineEndMarker({ data, yAxisId, stroke = "var(--chart-3)", strokeOpacity = 1, radius = 5, }) {
|
|
7
|
+
const { xScale, chartPhase, innerWidth } = useChartStable();
|
|
8
|
+
const yScale = useYScale(yAxisId);
|
|
9
|
+
const getX = useCallback((point) => xScale(point.date) ?? 0, [xScale]);
|
|
10
|
+
const getY = useCallback((point) => yScale(point.value) ?? 0, [yScale]);
|
|
11
|
+
const showStroke = chartPhase === "revealing" || chartPhase === "ready" || chartPhase === "exitingReady";
|
|
12
|
+
if (!showStroke || data.length < 2) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const endPoint = data.at(-1);
|
|
16
|
+
if (!endPoint) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const edgePadding = radius + 1;
|
|
20
|
+
const endX = Math.min(getX(endPoint), Math.max(0, innerWidth - edgePadding));
|
|
21
|
+
const endY = getY(endPoint);
|
|
22
|
+
return _jsx("circle", { cx: endX, cy: endY, fill: stroke, fillOpacity: strokeOpacity, r: radius * 0.85 });
|
|
23
|
+
}
|
|
24
|
+
ProjectionLineEndMarker.displayName = "ProjectionLineEndMarker";
|
|
25
|
+
ProjectionLineEndMarker.__isPostOverlay = true;
|
|
26
|
+
export default ProjectionLineEndMarker;
|
|
27
|
+
//# sourceMappingURL=projection-line-end-marker.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ProjectionCurveKind, type ProjectionPoint } from "./projection-utils.js";
|
|
2
|
+
type CurveFactory = any;
|
|
3
|
+
export type ProjectionStrokeStyle = "solid" | "gradient";
|
|
4
|
+
export interface ProjectionLineProps {
|
|
5
|
+
/** Projection path points — anchor (last data row) + horizon end. */
|
|
6
|
+
data: ProjectionPoint[];
|
|
7
|
+
/** Y-scale group id. Default: `"left"`. */
|
|
8
|
+
yAxisId?: string | number;
|
|
9
|
+
/** Solid stroke color. Default: var(--chart-3) */
|
|
10
|
+
stroke?: string;
|
|
11
|
+
/** Solid or path-aligned gradient stroke. Default: solid */
|
|
12
|
+
strokeStyle?: ProjectionStrokeStyle;
|
|
13
|
+
/** Gradient start color when `strokeStyle` is gradient. Default: `stroke` */
|
|
14
|
+
gradientStart?: string;
|
|
15
|
+
/** Gradient end color when `strokeStyle` is gradient. Default: var(--chart-5) */
|
|
16
|
+
gradientEnd?: string;
|
|
17
|
+
/** Stroke width. Default: 2 */
|
|
18
|
+
strokeWidth?: number;
|
|
19
|
+
/** Straight segment or horizontal-tangent S-curve. Default: linear */
|
|
20
|
+
curveKind?: ProjectionCurveKind;
|
|
21
|
+
/** Advanced curve override (used when `curveKind` is omitted). */
|
|
22
|
+
curve?: CurveFactory;
|
|
23
|
+
/** Dash pattern. Default: "6,4" */
|
|
24
|
+
strokeDasharray?: string;
|
|
25
|
+
/** Stroke opacity. Default: 1 */
|
|
26
|
+
strokeOpacity?: number;
|
|
27
|
+
/** Show horizon endpoint marker. Default: true */
|
|
28
|
+
showEndMarker?: boolean;
|
|
29
|
+
/** @deprecated Use `showEndMarker`. */
|
|
30
|
+
showEndpoints?: boolean;
|
|
31
|
+
/** Endpoint marker radius. Default: 5 */
|
|
32
|
+
endpointRadius?: number;
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function ProjectionLine({ data, yAxisId, stroke, strokeStyle, gradientStart, gradientEnd, strokeWidth, curveKind, curve, strokeDasharray, strokeOpacity, showEndMarker, showEndpoints, endpointRadius, className, }: ProjectionLineProps): import("react").JSX.Element | null;
|
|
36
|
+
export declare namespace ProjectionLine {
|
|
37
|
+
var displayName: string;
|
|
38
|
+
}
|
|
39
|
+
export default ProjectionLine;
|
|
40
|
+
//# sourceMappingURL=projection-line.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { curveLinear } from "@visx/curve";
|
|
4
|
+
import { LinePath } from "@visx/shape";
|
|
5
|
+
import { useCallback, useId, useMemo } from "react";
|
|
6
|
+
import { useChartStable, useYScale } from "./chart-context.js";
|
|
7
|
+
import { buildHorizontalTangentBezierPath, } from "./projection-utils.js";
|
|
8
|
+
function resolveVisibleEndX(endX, innerWidth, endpointRadius, strokeWidth) {
|
|
9
|
+
const edgePadding = endpointRadius + strokeWidth * 0.5 + 1;
|
|
10
|
+
return Math.min(endX, Math.max(0, innerWidth - edgePadding));
|
|
11
|
+
}
|
|
12
|
+
function renderProjectionStroke({ bezierPath, curve, curveKind, data, getX, getY, linearPath, strokeProps, }) {
|
|
13
|
+
if (curveKind === "bezier" && bezierPath) {
|
|
14
|
+
return _jsx("path", { d: bezierPath, fill: "none", ...strokeProps });
|
|
15
|
+
}
|
|
16
|
+
if (curveKind === "linear" && linearPath) {
|
|
17
|
+
return _jsx("path", { d: linearPath, fill: "none", ...strokeProps });
|
|
18
|
+
}
|
|
19
|
+
return _jsx(LinePath, { curve: curve ?? curveLinear, data: data, ...strokeProps, x: getX, y: getY });
|
|
20
|
+
}
|
|
21
|
+
export function ProjectionLine({ data, yAxisId, stroke = "var(--chart-3)", strokeStyle = "solid", gradientStart, gradientEnd = "var(--chart-5)", strokeWidth = 2, curveKind = "linear", curve, strokeDasharray = "6,4", strokeOpacity = 1, showEndMarker, showEndpoints, endpointRadius = 5, className, }) {
|
|
22
|
+
const { xScale, chartPhase, innerWidth } = useChartStable();
|
|
23
|
+
const yScale = useYScale(yAxisId);
|
|
24
|
+
const gradientId = useId().replace(/:/g, "");
|
|
25
|
+
const showMarker = showEndMarker ?? showEndpoints ?? true;
|
|
26
|
+
const resolvedGradientStart = gradientStart ?? stroke;
|
|
27
|
+
const getX = useCallback((point) => xScale(point.date) ?? 0, [xScale]);
|
|
28
|
+
const getY = useCallback((point) => yScale(point.value) ?? 0, [yScale]);
|
|
29
|
+
const startPoint = data[0];
|
|
30
|
+
const endPoint = data.at(-1);
|
|
31
|
+
const geometry = useMemo(() => {
|
|
32
|
+
if (!(startPoint && endPoint)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const startX = getX(startPoint);
|
|
36
|
+
const startY = getY(startPoint);
|
|
37
|
+
const endX = getX(endPoint);
|
|
38
|
+
const endY = getY(endPoint);
|
|
39
|
+
const visibleEndX = resolveVisibleEndX(endX, innerWidth, showMarker ? endpointRadius : 0, strokeWidth);
|
|
40
|
+
return { startX, startY, visibleEndX, endY };
|
|
41
|
+
}, [endPoint, endpointRadius, getX, getY, innerWidth, showMarker, startPoint, strokeWidth]);
|
|
42
|
+
const bezierPath = useMemo(() => {
|
|
43
|
+
if (curveKind !== "bezier" || !geometry) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return buildHorizontalTangentBezierPath(geometry.startX, geometry.startY, geometry.visibleEndX, geometry.endY);
|
|
47
|
+
}, [curveKind, geometry]);
|
|
48
|
+
const linearPath = useMemo(() => {
|
|
49
|
+
if (curveKind !== "linear" || !geometry) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return `M ${geometry.startX},${geometry.startY} L ${geometry.visibleEndX},${geometry.endY}`;
|
|
53
|
+
}, [curveKind, geometry]);
|
|
54
|
+
const showStroke = chartPhase === "revealing" || chartPhase === "ready" || chartPhase === "exitingReady";
|
|
55
|
+
if (data.length < 2 || !geometry) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const resolvedStroke = strokeStyle === "gradient" && geometry ? `url(#${gradientId})` : stroke;
|
|
59
|
+
const strokeProps = {
|
|
60
|
+
stroke: showStroke ? resolvedStroke : "transparent",
|
|
61
|
+
strokeDasharray,
|
|
62
|
+
strokeLinecap: "round",
|
|
63
|
+
strokeOpacity,
|
|
64
|
+
strokeWidth,
|
|
65
|
+
};
|
|
66
|
+
return (_jsxs("g", { className: className ?? "chart-projection-line", children: [strokeStyle === "gradient" && geometry ? (_jsx("defs", { children: _jsxs("linearGradient", { gradientUnits: "userSpaceOnUse", id: gradientId, x1: geometry.startX, x2: geometry.visibleEndX, y1: geometry.startY, y2: geometry.endY, children: [_jsx("stop", { offset: "0%", stopColor: resolvedGradientStart }), _jsx("stop", { offset: "100%", stopColor: gradientEnd })] }) })) : null, renderProjectionStroke({
|
|
67
|
+
bezierPath,
|
|
68
|
+
curve,
|
|
69
|
+
curveKind,
|
|
70
|
+
data,
|
|
71
|
+
getX,
|
|
72
|
+
getY,
|
|
73
|
+
linearPath,
|
|
74
|
+
strokeProps,
|
|
75
|
+
})] }));
|
|
76
|
+
}
|
|
77
|
+
ProjectionLine.displayName = "ProjectionLine";
|
|
78
|
+
export default ProjectionLine;
|
|
79
|
+
//# sourceMappingURL=projection-line.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type ProjectionMode = "auto" | "target" | "manual";
|
|
2
|
+
export type ProjectionAutoMethod = "linearRegression" | "lastSegment";
|
|
3
|
+
/** How the projection segment is drawn between anchor and horizon. */
|
|
4
|
+
export type ProjectionCurveKind = "linear" | "bezier";
|
|
5
|
+
/** @deprecated Stepped density removed — projections always anchor → horizon. */
|
|
6
|
+
export type ProjectionPathDensity = "stepped" | "endpoints";
|
|
7
|
+
export interface ProjectionPoint {
|
|
8
|
+
date: Date;
|
|
9
|
+
value: number;
|
|
10
|
+
}
|
|
11
|
+
export interface BuildProjectionPathOptions {
|
|
12
|
+
sourceData: Record<string, unknown>[];
|
|
13
|
+
seriesKey: string;
|
|
14
|
+
xDataKey?: string;
|
|
15
|
+
mode: ProjectionMode;
|
|
16
|
+
autoMethod?: ProjectionAutoMethod;
|
|
17
|
+
/** Auto mode: stepped points per interval, or anchor + end only. Default: stepped */
|
|
18
|
+
pathDensity?: ProjectionPathDensity;
|
|
19
|
+
/** Index in sourceData where projection anchors (default: last point). */
|
|
20
|
+
startIndex?: number;
|
|
21
|
+
/** How many future points to generate (matches source cadence). */
|
|
22
|
+
horizonPoints?: number;
|
|
23
|
+
/** Target Y at the final projected date (target mode). */
|
|
24
|
+
endValue?: number;
|
|
25
|
+
/** Full manual path — anchor + future points (manual mode). */
|
|
26
|
+
points?: ProjectionPoint[];
|
|
27
|
+
}
|
|
28
|
+
/** Slope (value change per ms) at the projection anchor from the last data segment. */
|
|
29
|
+
export declare function computeProjectionAnchorTangentSlope(sourceData: Record<string, unknown>[], seriesKey: string, xDataKey?: string, startIndexProp?: number): number;
|
|
30
|
+
/** Cubic bezier with horizontal tangents at start and end (price-target S-curve). */
|
|
31
|
+
export declare function buildHorizontalTangentBezierPath(x0: number, y0: number, x1: number, y1: number,
|
|
32
|
+
/** How far control points sit along the x span (0–0.5). Default: 0.45 */
|
|
33
|
+
tension?: number): string;
|
|
34
|
+
/** Build a projection path from historical chart data or explicit points. */
|
|
35
|
+
export declare function buildProjectionPath(options: BuildProjectionPathOptions): ProjectionPoint[];
|
|
36
|
+
/** Collect numeric Y extents from projection point arrays. */
|
|
37
|
+
export declare function projectionValueExtents(paths: ProjectionPoint[][]): {
|
|
38
|
+
minValue: number;
|
|
39
|
+
maxValue: number;
|
|
40
|
+
} | null;
|
|
41
|
+
/** Collect date extents from projection point arrays. */
|
|
42
|
+
export declare function projectionDateExtents(paths: ProjectionPoint[][]): {
|
|
43
|
+
minTime: number;
|
|
44
|
+
maxTime: number;
|
|
45
|
+
} | null;
|
|
46
|
+
//# sourceMappingURL=projection-utils.d.ts.map
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
function readDate(row, xDataKey) {
|
|
2
|
+
const raw = row[xDataKey];
|
|
3
|
+
if (raw instanceof Date && !Number.isNaN(raw.getTime())) {
|
|
4
|
+
return raw;
|
|
5
|
+
}
|
|
6
|
+
if (typeof raw === "number" && Number.isFinite(raw)) {
|
|
7
|
+
const date = new Date(raw);
|
|
8
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
9
|
+
}
|
|
10
|
+
if (typeof raw === "string") {
|
|
11
|
+
const date = new Date(raw);
|
|
12
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
function readValue(row, seriesKey) {
|
|
17
|
+
const raw = row[seriesKey];
|
|
18
|
+
return typeof raw === "number" && Number.isFinite(raw) ? raw : null;
|
|
19
|
+
}
|
|
20
|
+
function resolveStartIndex(sourceData, startIndex) {
|
|
21
|
+
if (startIndex == null || !Number.isFinite(startIndex)) {
|
|
22
|
+
return Math.max(0, sourceData.length - 1);
|
|
23
|
+
}
|
|
24
|
+
return Math.min(Math.max(0, Math.floor(startIndex)), sourceData.length - 1);
|
|
25
|
+
}
|
|
26
|
+
function intervalFromAdjacentRows(sourceData, xDataKey, startIndex) {
|
|
27
|
+
if (startIndex < 1) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const prevRow = sourceData[startIndex - 1];
|
|
31
|
+
const currentRow = sourceData[startIndex];
|
|
32
|
+
const prev = prevRow ? readDate(prevRow, xDataKey) : null;
|
|
33
|
+
const current = currentRow ? readDate(currentRow, xDataKey) : null;
|
|
34
|
+
if (!(prev && current)) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const delta = current.getTime() - prev.getTime();
|
|
38
|
+
return delta > 0 ? delta : null;
|
|
39
|
+
}
|
|
40
|
+
function intervalFromSeriesSpan(sourceData, xDataKey) {
|
|
41
|
+
if (sourceData.length < 2) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const firstRow = sourceData[0];
|
|
45
|
+
const lastRow = sourceData.at(-1);
|
|
46
|
+
const first = firstRow ? readDate(firstRow, xDataKey) : null;
|
|
47
|
+
const last = lastRow ? readDate(lastRow, xDataKey) : null;
|
|
48
|
+
if (!(first && last)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const span = last.getTime() - first.getTime();
|
|
52
|
+
return span > 0 ? span / (sourceData.length - 1) : null;
|
|
53
|
+
}
|
|
54
|
+
function resolveIntervalMs(sourceData, xDataKey, startIndex) {
|
|
55
|
+
return (intervalFromAdjacentRows(sourceData, xDataKey, startIndex) ??
|
|
56
|
+
intervalFromSeriesSpan(sourceData, xDataKey) ??
|
|
57
|
+
86_400_000);
|
|
58
|
+
}
|
|
59
|
+
function linearRegressionSlope(points) {
|
|
60
|
+
if (points.length < 2) {
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
const n = points.length;
|
|
64
|
+
let sumT = 0;
|
|
65
|
+
let sumY = 0;
|
|
66
|
+
let sumTY = 0;
|
|
67
|
+
let sumTT = 0;
|
|
68
|
+
for (const { t, y } of points) {
|
|
69
|
+
sumT += t;
|
|
70
|
+
sumY += y;
|
|
71
|
+
sumTY += t * y;
|
|
72
|
+
sumTT += t * t;
|
|
73
|
+
}
|
|
74
|
+
const denom = n * sumTT - sumT * sumT;
|
|
75
|
+
if (Math.abs(denom) < 1e-12) {
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
return (n * sumTY - sumT * sumY) / denom;
|
|
79
|
+
}
|
|
80
|
+
function buildAutoFutureValues(options) {
|
|
81
|
+
const { anchorTime, anchorValue, autoMethod, historyPoints, horizonPoints, intervalMs, pathDensity, } = options;
|
|
82
|
+
const slope = autoMethod === "lastSegment" && historyPoints.length >= 2
|
|
83
|
+
? (() => {
|
|
84
|
+
const prev = historyPoints.at(-2);
|
|
85
|
+
const last = historyPoints.at(-1);
|
|
86
|
+
if (!(prev && last)) {
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
const dt = last.t - prev.t;
|
|
90
|
+
return dt === 0 ? 0 : (last.y - prev.y) / dt;
|
|
91
|
+
})()
|
|
92
|
+
: linearRegressionSlope(historyPoints);
|
|
93
|
+
if (pathDensity === "endpoints") {
|
|
94
|
+
const endTime = anchorTime + intervalMs * horizonPoints;
|
|
95
|
+
const endValue = anchorValue + slope * intervalMs * horizonPoints;
|
|
96
|
+
return [
|
|
97
|
+
{ date: new Date(anchorTime), value: anchorValue },
|
|
98
|
+
{ date: new Date(endTime), value: endValue },
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
const result = [{ date: new Date(anchorTime), value: anchorValue }];
|
|
102
|
+
for (let i = 1; i <= horizonPoints; i++) {
|
|
103
|
+
const t = anchorTime + intervalMs * i;
|
|
104
|
+
const value = anchorValue + slope * intervalMs * i;
|
|
105
|
+
result.push({ date: new Date(t), value });
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
/** Slope (value change per ms) at the projection anchor from the last data segment. */
|
|
110
|
+
export function computeProjectionAnchorTangentSlope(sourceData, seriesKey, xDataKey = "date", startIndexProp) {
|
|
111
|
+
if (sourceData.length < 2) {
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
const startIndex = resolveStartIndex(sourceData, startIndexProp);
|
|
115
|
+
const historyPoints = [];
|
|
116
|
+
for (let i = 0; i <= startIndex; i++) {
|
|
117
|
+
const row = sourceData[i];
|
|
118
|
+
if (!row) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const date = readDate(row, xDataKey);
|
|
122
|
+
const value = readValue(row, seriesKey);
|
|
123
|
+
if (date && value != null) {
|
|
124
|
+
historyPoints.push({ t: date.getTime(), y: value });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (historyPoints.length < 2) {
|
|
128
|
+
return 0;
|
|
129
|
+
}
|
|
130
|
+
const prev = historyPoints.at(-2);
|
|
131
|
+
const last = historyPoints.at(-1);
|
|
132
|
+
if (!(prev && last)) {
|
|
133
|
+
return 0;
|
|
134
|
+
}
|
|
135
|
+
const dt = last.t - prev.t;
|
|
136
|
+
return dt === 0 ? 0 : (last.y - prev.y) / dt;
|
|
137
|
+
}
|
|
138
|
+
/** Cubic bezier with horizontal tangents at start and end (price-target S-curve). */
|
|
139
|
+
export function buildHorizontalTangentBezierPath(x0, y0, x1, y1,
|
|
140
|
+
/** How far control points sit along the x span (0–0.5). Default: 0.45 */
|
|
141
|
+
tension = 0.45) {
|
|
142
|
+
const dx = x1 - x0;
|
|
143
|
+
if (Math.abs(dx) < 1e-6) {
|
|
144
|
+
return `M ${x0},${y0} L ${x1},${y1}`;
|
|
145
|
+
}
|
|
146
|
+
const t = Math.min(0.5, Math.max(0.05, tension));
|
|
147
|
+
const c1x = x0 + dx * t;
|
|
148
|
+
const c2x = x1 - dx * t;
|
|
149
|
+
return `M ${x0},${y0} C ${c1x},${y0} ${c2x},${y1} ${x1},${y1}`;
|
|
150
|
+
}
|
|
151
|
+
function buildTargetPath(options) {
|
|
152
|
+
const { anchorTime, anchorValue, endValue, horizonPoints, intervalMs } = options;
|
|
153
|
+
const endTime = anchorTime + intervalMs * horizonPoints;
|
|
154
|
+
return [
|
|
155
|
+
{ date: new Date(anchorTime), value: anchorValue },
|
|
156
|
+
{ date: new Date(endTime), value: endValue },
|
|
157
|
+
];
|
|
158
|
+
}
|
|
159
|
+
/** Build a projection path from historical chart data or explicit points. */
|
|
160
|
+
export function buildProjectionPath(options) {
|
|
161
|
+
const { sourceData, seriesKey, xDataKey = "date", mode, autoMethod = "linearRegression", pathDensity = "endpoints", startIndex: startIndexProp, horizonPoints = 6, endValue, points, } = options;
|
|
162
|
+
if (mode === "manual" && points && points.length >= 2) {
|
|
163
|
+
return points.map((point) => ({
|
|
164
|
+
date: new Date(point.date),
|
|
165
|
+
value: point.value,
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
if (sourceData.length === 0) {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
const startIndex = resolveStartIndex(sourceData, startIndexProp);
|
|
172
|
+
const anchorRow = sourceData[startIndex];
|
|
173
|
+
if (!anchorRow) {
|
|
174
|
+
return [];
|
|
175
|
+
}
|
|
176
|
+
const anchorDate = readDate(anchorRow, xDataKey);
|
|
177
|
+
const anchorValue = readValue(anchorRow, seriesKey);
|
|
178
|
+
if (!anchorDate || anchorValue == null) {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
const intervalMs = resolveIntervalMs(sourceData, xDataKey, startIndex);
|
|
182
|
+
const anchorTime = anchorDate.getTime();
|
|
183
|
+
const historyPoints = [];
|
|
184
|
+
for (let i = 0; i <= startIndex; i++) {
|
|
185
|
+
const row = sourceData[i];
|
|
186
|
+
if (!row) {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
const date = readDate(row, xDataKey);
|
|
190
|
+
const value = readValue(row, seriesKey);
|
|
191
|
+
if (date && value != null) {
|
|
192
|
+
historyPoints.push({ t: date.getTime(), y: value });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (mode === "target" && endValue != null && Number.isFinite(endValue)) {
|
|
196
|
+
return buildTargetPath({
|
|
197
|
+
anchorTime,
|
|
198
|
+
anchorValue,
|
|
199
|
+
endValue,
|
|
200
|
+
horizonPoints,
|
|
201
|
+
intervalMs,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
return buildAutoFutureValues({
|
|
205
|
+
anchorTime,
|
|
206
|
+
anchorValue,
|
|
207
|
+
autoMethod,
|
|
208
|
+
historyPoints,
|
|
209
|
+
horizonPoints,
|
|
210
|
+
intervalMs,
|
|
211
|
+
pathDensity,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/** Collect numeric Y extents from projection point arrays. */
|
|
215
|
+
export function projectionValueExtents(paths) {
|
|
216
|
+
let minValue = Number.POSITIVE_INFINITY;
|
|
217
|
+
let maxValue = Number.NEGATIVE_INFINITY;
|
|
218
|
+
for (const path of paths) {
|
|
219
|
+
for (const point of path) {
|
|
220
|
+
if (point.value < minValue) {
|
|
221
|
+
minValue = point.value;
|
|
222
|
+
}
|
|
223
|
+
if (point.value > maxValue) {
|
|
224
|
+
maxValue = point.value;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (minValue === Number.POSITIVE_INFINITY) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
return { minValue, maxValue };
|
|
232
|
+
}
|
|
233
|
+
/** Collect date extents from projection point arrays. */
|
|
234
|
+
export function projectionDateExtents(paths) {
|
|
235
|
+
let minTime = Number.POSITIVE_INFINITY;
|
|
236
|
+
let maxTime = Number.NEGATIVE_INFINITY;
|
|
237
|
+
for (const path of paths) {
|
|
238
|
+
for (const point of path) {
|
|
239
|
+
const time = point.date.getTime();
|
|
240
|
+
if (time < minTime) {
|
|
241
|
+
minTime = time;
|
|
242
|
+
}
|
|
243
|
+
if (time > maxTime) {
|
|
244
|
+
maxTime = time;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (minTime === Number.POSITIVE_INFINITY) {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
return { minTime, maxTime };
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=projection-utils.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface RadarAreaProps {
|
|
2
|
+
/** Index of this area in the data array */
|
|
3
|
+
index: number;
|
|
4
|
+
/** Optional color override */
|
|
5
|
+
color?: string;
|
|
6
|
+
/** Show data point circles. Default: true */
|
|
7
|
+
showPoints?: boolean;
|
|
8
|
+
/** Show stroke outline on the polygon. Default: true */
|
|
9
|
+
showStroke?: boolean;
|
|
10
|
+
/** Show glow effect on hover. Default: true */
|
|
11
|
+
showGlow?: boolean;
|
|
12
|
+
/** Additional class name */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const RadarArea: import("react").MemoExoticComponent<({ index, color: colorProp, showPoints, showStroke, showGlow, className, }: RadarAreaProps) => import("react").JSX.Element | null>;
|
|
16
|
+
export default RadarArea;
|
|
17
|
+
//# sourceMappingURL=radar-area.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { motion, useTransform } from "motion/react";
|
|
4
|
+
import { memo, useMemo } from "react";
|
|
5
|
+
import { radarCssVars, useRadarHover, useRadarStable } from "./radar-context.js";
|
|
6
|
+
import { useEnterComplete } from "./use-enter-complete.js";
|
|
7
|
+
import { useMountProgress } from "./use-mount-progress.js";
|
|
8
|
+
function getStrokeWidth(isHovered) {
|
|
9
|
+
return isHovered ? 3 : 2;
|
|
10
|
+
}
|
|
11
|
+
function positionsToPath(positions) {
|
|
12
|
+
if (positions.length === 0) {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
return `M ${positions.map((p) => `${p.x},${p.y}`).join(" L ")} Z`;
|
|
16
|
+
}
|
|
17
|
+
const RadarPoint = memo(function RadarPoint({ mountProgress, target, color, isHovered, metricKey, enterComplete, }) {
|
|
18
|
+
const cx = useTransform(mountProgress, (t) => target.x * t);
|
|
19
|
+
const cy = useTransform(mountProgress, (t) => target.y * t);
|
|
20
|
+
if (enterComplete) {
|
|
21
|
+
return (_jsx("circle", { cx: target.x, cy: target.y, fill: color, r: isHovered ? 6 : 4, stroke: radarCssVars.background, strokeWidth: 2 }, metricKey));
|
|
22
|
+
}
|
|
23
|
+
return (_jsx(motion.circle, { cx: cx, cy: cy, fill: color, r: isHovered ? 6 : 4, stroke: radarCssVars.background, strokeWidth: 2, transition: {
|
|
24
|
+
r: { type: "spring", stiffness: 300, damping: 20 },
|
|
25
|
+
} }, metricKey));
|
|
26
|
+
});
|
|
27
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: radar area enter/hover branches mirror pie slice
|
|
28
|
+
export const RadarArea = memo(function RadarArea({ index, color: colorProp, showPoints = true, showStroke = true, showGlow = true, className = "", }) {
|
|
29
|
+
const { data, metrics, levels, animate, enterDurationMs, staggerScale, enterTransition, motionReplayKey, getColor, getPointPosition, } = useRadarStable();
|
|
30
|
+
const { hoveredIndex, setHoveredIndex } = useRadarHover();
|
|
31
|
+
const durationFactor = enterDurationMs / 1100;
|
|
32
|
+
const areaData = data[index];
|
|
33
|
+
const targetPositions = useMemo(() => {
|
|
34
|
+
if (!areaData) {
|
|
35
|
+
return metrics.map(() => ({ x: 0, y: 0 }));
|
|
36
|
+
}
|
|
37
|
+
return metrics.map((metric, i) => {
|
|
38
|
+
const value = areaData.values[metric.key] ?? 0;
|
|
39
|
+
return getPointPosition(i, value);
|
|
40
|
+
});
|
|
41
|
+
}, [metrics, areaData, getPointPosition]);
|
|
42
|
+
const staticPath = useMemo(() => positionsToPath(targetPositions), [targetPositions]);
|
|
43
|
+
const gridStagger = 0.08 * staggerScale * durationFactor;
|
|
44
|
+
const campaignBaseDelay = (levels * gridStagger + 0.2) * durationFactor;
|
|
45
|
+
const campaignStagger = 0.15 * staggerScale * durationFactor;
|
|
46
|
+
const animationDelay = campaignBaseDelay + index * campaignStagger;
|
|
47
|
+
const mountProgress = useMountProgress(enterTransition, animationDelay, `${motionReplayKey}-${index}`);
|
|
48
|
+
const enterComplete = useEnterComplete(mountProgress);
|
|
49
|
+
const animatedPositions = useTransform(mountProgress, (t) => targetPositions.map((p) => ({ x: p.x * t, y: p.y * t })));
|
|
50
|
+
const pathD = useTransform(animatedPositions, positionsToPath);
|
|
51
|
+
if (!areaData) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const color = colorProp || getColor(index);
|
|
55
|
+
const isHovered = hoveredIndex === index;
|
|
56
|
+
const isOtherHovered = hoveredIndex !== null && hoveredIndex !== index;
|
|
57
|
+
return (_jsxs(motion.g, { animate: {
|
|
58
|
+
opacity: isOtherHovered ? 0.3 : 1,
|
|
59
|
+
scale: isHovered ? 1.05 : 1,
|
|
60
|
+
}, className: className, initial: { opacity: animate ? 0 : 1 }, onMouseEnter: () => setHoveredIndex(index), onMouseLeave: () => setHoveredIndex(null), style: { transformOrigin: "0px 0px", cursor: "pointer" }, transition: {
|
|
61
|
+
opacity: { duration: 0.15 },
|
|
62
|
+
scale: { type: "spring", stiffness: 400, damping: 25 },
|
|
63
|
+
}, children: [enterComplete ? (_jsx("path", { d: staticPath, fill: color, fillOpacity: isHovered ? 0.35 : 0.15, stroke: showStroke ? color : "none", strokeLinejoin: "round", strokeWidth: showStroke ? getStrokeWidth(isHovered) : 0, style: {
|
|
64
|
+
filter: showGlow && isHovered ? `drop-shadow(0 0 12px ${color})` : "none",
|
|
65
|
+
} })) : (_jsx(motion.path, { animate: {
|
|
66
|
+
fillOpacity: isHovered ? 0.35 : 0.15,
|
|
67
|
+
strokeWidth: showStroke ? getStrokeWidth(isHovered) : 0,
|
|
68
|
+
}, d: pathD, fill: color, stroke: showStroke ? color : "none", strokeLinejoin: "round", style: {
|
|
69
|
+
filter: showGlow && isHovered ? `drop-shadow(0 0 12px ${color})` : "none",
|
|
70
|
+
}, transition: {
|
|
71
|
+
fillOpacity: { duration: 0.2 },
|
|
72
|
+
strokeWidth: { duration: 0.2 },
|
|
73
|
+
} })), showPoints &&
|
|
74
|
+
metrics.map((metric, i) => {
|
|
75
|
+
const target = targetPositions[i];
|
|
76
|
+
if (!target) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return (_jsx(RadarPoint, { color: color, enterComplete: enterComplete, isHovered: isHovered, metricKey: metric.key, mountProgress: mountProgress, target: target }, metric.key));
|
|
80
|
+
})] }));
|
|
81
|
+
});
|
|
82
|
+
RadarArea.displayName = "RadarArea";
|
|
83
|
+
export default RadarArea;
|
|
84
|
+
//# sourceMappingURL=radar-area.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface RadarAxisProps {
|
|
2
|
+
/** Axis line stroke color. Default: var(--border) */
|
|
3
|
+
stroke?: string;
|
|
4
|
+
/** Axis line stroke opacity. Default: 0.6 */
|
|
5
|
+
strokeOpacity?: number;
|
|
6
|
+
/** Additional class name */
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function RadarAxis({ stroke, strokeOpacity, className, }: RadarAxisProps): import("react").JSX.Element;
|
|
10
|
+
export declare namespace RadarAxis {
|
|
11
|
+
var displayName: string;
|
|
12
|
+
}
|
|
13
|
+
export default RadarAxis;
|
|
14
|
+
//# sourceMappingURL=radar-axis.d.ts.map
|