@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,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { curveMonotoneX } from "@visx/curve";
|
|
4
|
+
import { AreaClosed, LinePath } from "@visx/shape";
|
|
5
|
+
import { motion } from "motion/react";
|
|
6
|
+
import { useCallback, useId, useMemo } from "react";
|
|
7
|
+
import { chartCssVars, useChart } from "./chart-context.js";
|
|
8
|
+
export function detectMomentum(data, dataKey, lookback = 20) {
|
|
9
|
+
if (data.length < 5) {
|
|
10
|
+
return "flat";
|
|
11
|
+
}
|
|
12
|
+
const start = Math.max(0, data.length - lookback);
|
|
13
|
+
let min = Number.POSITIVE_INFINITY;
|
|
14
|
+
let max = Number.NEGATIVE_INFINITY;
|
|
15
|
+
for (let i = start; i < data.length; i++) {
|
|
16
|
+
const v = data[i]?.[dataKey];
|
|
17
|
+
if (typeof v === "number") {
|
|
18
|
+
if (v < min) {
|
|
19
|
+
min = v;
|
|
20
|
+
}
|
|
21
|
+
if (v > max) {
|
|
22
|
+
max = v;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const range = max - min;
|
|
27
|
+
if (range === 0) {
|
|
28
|
+
return "flat";
|
|
29
|
+
}
|
|
30
|
+
const tailStart = Math.max(start, data.length - 5);
|
|
31
|
+
const first = data[tailStart]?.[dataKey] ?? 0;
|
|
32
|
+
const last = data.at(-1)?.[dataKey] ?? 0;
|
|
33
|
+
const delta = last - first;
|
|
34
|
+
const threshold = range * 0.12;
|
|
35
|
+
if (delta > threshold) {
|
|
36
|
+
return "up";
|
|
37
|
+
}
|
|
38
|
+
if (delta < -threshold) {
|
|
39
|
+
return "down";
|
|
40
|
+
}
|
|
41
|
+
return "flat";
|
|
42
|
+
}
|
|
43
|
+
LiveLine.displayName = "LiveLine";
|
|
44
|
+
export function LiveLine({ dataKey, stroke = chartCssVars.linePrimary, strokeWidth = 2, curve = curveMonotoneX, fill = true, pulse = true, dotSize = 4, badge = true, formatValue = (v) => v.toFixed(2), momentumColors, }) {
|
|
45
|
+
const { data, xScale, yScale, innerWidth, innerHeight, xAccessor, lines, tooltipData } = useChart();
|
|
46
|
+
const isScrubbing = tooltipData !== null;
|
|
47
|
+
const uid = useId();
|
|
48
|
+
const gradientId = `live-line-grad-${uid}`;
|
|
49
|
+
const areaGradientId = `live-area-grad-${uid}`;
|
|
50
|
+
const fadeId = `live-fade-${uid}`;
|
|
51
|
+
const fadeMaskId = `live-fade-mask-${uid}`;
|
|
52
|
+
const getX = useCallback((d) => xScale(xAccessor(d)) ?? 0, [xScale, xAccessor]);
|
|
53
|
+
const getY = useCallback((d) => {
|
|
54
|
+
const v = d[dataKey];
|
|
55
|
+
return typeof v === "number" ? (yScale(v) ?? 0) : 0;
|
|
56
|
+
}, [dataKey, yScale]);
|
|
57
|
+
// The second-to-last point is the "now" position (live tip).
|
|
58
|
+
// The last point is the queued future point for the fade-out zone.
|
|
59
|
+
const nowPoint = data.length >= 2 ? data.at(-2) : data.at(-1);
|
|
60
|
+
const liveValue = nowPoint && typeof nowPoint[dataKey] === "number" ? nowPoint[dataKey] : 0;
|
|
61
|
+
const liveDotX = nowPoint ? (xScale(xAccessor(nowPoint)) ?? 0) : innerWidth;
|
|
62
|
+
const liveDotY = yScale(liveValue) ?? 0;
|
|
63
|
+
const momentum = useMemo(() => detectMomentum(data, dataKey), [data, dataKey]);
|
|
64
|
+
const defaultMomentumColors = {
|
|
65
|
+
up: "var(--chart-1)",
|
|
66
|
+
down: "var(--chart-5)",
|
|
67
|
+
flat: stroke,
|
|
68
|
+
};
|
|
69
|
+
const dotMomentumColors = momentumColors ?? defaultMomentumColors;
|
|
70
|
+
const dotColor = dotMomentumColors[momentum];
|
|
71
|
+
// Find the line config for this dataKey to get the resolved stroke
|
|
72
|
+
const lineConfig = lines.find((l) => l.dataKey === dataKey);
|
|
73
|
+
const baseStroke = lineConfig?.stroke ?? stroke;
|
|
74
|
+
const resolvedStroke = momentumColors ? momentumColors[momentum] : baseStroke;
|
|
75
|
+
return (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: gradientId, x1: "0", x2: "0", y1: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: resolvedStroke, stopOpacity: 1 }), _jsx("stop", { offset: "100%", stopColor: resolvedStroke, stopOpacity: 0.6 })] }), _jsxs("linearGradient", { id: areaGradientId, x1: "0", x2: "0", y1: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: resolvedStroke, stopOpacity: 0.1 }), _jsx("stop", { offset: "100%", stopColor: resolvedStroke, stopOpacity: 0 })] }), _jsxs("linearGradient", { id: fadeId, x1: "0", x2: "1", y1: "0", y2: "0", children: [_jsx("stop", { offset: "0%", stopColor: "white", stopOpacity: 0 }), _jsx("stop", { offset: "4%", stopColor: "white", stopOpacity: 1 }), liveDotX < innerWidth - 1 ? (_jsxs(_Fragment, { children: [_jsx("stop", { offset: `${(liveDotX / innerWidth) * 100}%`, stopColor: "white", stopOpacity: 1 }), _jsx("stop", { offset: "100%", stopColor: "white", stopOpacity: 0 })] })) : (_jsx("stop", { offset: "100%", stopColor: "white", stopOpacity: 1 }))] }), _jsx("mask", { id: fadeMaskId, children: _jsx("rect", { fill: `url(#${fadeId})`, height: innerHeight + 40, width: innerWidth, x: 0, y: -20 }) })] }), fill && data.length > 1 && (_jsx("g", { mask: `url(#${fadeMaskId})`, children: _jsx(AreaClosed, { curve: curve, data: data, fill: `url(#${areaGradientId})`, strokeWidth: 0, x: getX, y: getY, yScale: yScale }) })), data.length > 1 && (_jsx("g", { mask: `url(#${fadeMaskId})`, children: _jsx(LinePath, { curve: curve, data: data, stroke: `url(#${gradientId})`, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: strokeWidth, x: getX, y: getY }) })), _jsx("line", { opacity: 0.25, stroke: resolvedStroke, strokeDasharray: "4,4", strokeWidth: 1, x1: 0, x2: innerWidth, y1: liveDotY, y2: liveDotY }), _jsxs(motion.g, { animate: { opacity: isScrubbing ? 0.25 : 1 }, transition: { duration: 0.3, ease: "easeInOut" }, children: [_jsxs("g", { children: [pulse && (_jsxs("circle", { cx: liveDotX, cy: liveDotY, fill: "none", opacity: 0.4, r: dotSize * 2, stroke: dotColor, strokeWidth: 1.5, children: [_jsx("animate", { attributeName: "r", dur: "1.5s", from: String(dotSize), repeatCount: "indefinite", to: String(dotSize * 3.5) }), _jsx("animate", { attributeName: "opacity", dur: "1.5s", from: "0.5", repeatCount: "indefinite", to: "0" })] })), _jsx("circle", { cx: liveDotX, cy: liveDotY, fill: dotColor, opacity: 0.1, r: dotSize + 2 }), _jsx("circle", { cx: liveDotX, cy: liveDotY, fill: dotColor, r: dotSize, stroke: chartCssVars.background, strokeWidth: 2 })] }), badge && (_jsxs("g", { transform: `translate(${liveDotX + 12},${liveDotY})`, children: [_jsx("rect", { fill: "var(--chart-tooltip-background)", height: 24, opacity: 0.95, rx: 6, width: formatValue(liveValue).length * 7.5 + 16, x: 0, y: -12 }), _jsx("text", { fill: "var(--chart-tooltip-foreground)", fontFamily: "SF Mono, Menlo, Monaco, monospace", fontSize: 11, fontWeight: 500, x: 8, y: 4, children: formatValue(liveValue) })] }))] })] }));
|
|
76
|
+
}
|
|
77
|
+
export default LiveLine;
|
|
78
|
+
//# sourceMappingURL=live-line.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface LiveXAxisProps {
|
|
2
|
+
/** Number of time labels. Default: 5 */
|
|
3
|
+
numTicks?: number;
|
|
4
|
+
/** Time formatter. Default: HH:MM:SS */
|
|
5
|
+
formatTime?: (t: number) => string;
|
|
6
|
+
}
|
|
7
|
+
export declare function LiveXAxis(props: LiveXAxisProps): import("react").JSX.Element | null;
|
|
8
|
+
export declare namespace LiveXAxis {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
export default LiveXAxis;
|
|
12
|
+
//# sourceMappingURL=live-x-axis.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { motion, useSpring } from "motion/react";
|
|
4
|
+
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
|
+
import { useChart, useChartStable } from "./chart-context.js";
|
|
7
|
+
import { liveHmsFmt } from "./chart-formatters.js";
|
|
8
|
+
const TICKER_HALF_WIDTH = 50;
|
|
9
|
+
const FADE_BUFFER = 20;
|
|
10
|
+
const crosshairSpringConfig = { stiffness: 300, damping: 30 };
|
|
11
|
+
function labelFadeOpacity(labelX, crosshairX, isHovering) {
|
|
12
|
+
if (!isHovering || crosshairX === null) {
|
|
13
|
+
return 1;
|
|
14
|
+
}
|
|
15
|
+
const distance = Math.abs(labelX - crosshairX);
|
|
16
|
+
if (distance < TICKER_HALF_WIDTH) {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
if (distance < TICKER_HALF_WIDTH + FADE_BUFFER) {
|
|
20
|
+
return (distance - TICKER_HALF_WIDTH) / FADE_BUFFER;
|
|
21
|
+
}
|
|
22
|
+
return 1;
|
|
23
|
+
}
|
|
24
|
+
const defaultFormatTime = (t) => liveHmsFmt.format(new Date(t));
|
|
25
|
+
export function LiveXAxis(props) {
|
|
26
|
+
const { containerRef } = useChartStable();
|
|
27
|
+
const [mounted, setMounted] = useState(false);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
setMounted(true);
|
|
30
|
+
}, []);
|
|
31
|
+
const container = containerRef.current;
|
|
32
|
+
if (!(mounted && container)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return _jsx(LiveXAxisInner, { ...props, container: container });
|
|
36
|
+
}
|
|
37
|
+
const LiveXAxisInner = memo(function LiveXAxisInner({ numTicks = 5, formatTime = defaultFormatTime, container, }) {
|
|
38
|
+
const { xScale, margin, tooltipData } = useChart();
|
|
39
|
+
const domain = xScale.domain();
|
|
40
|
+
const startMs = domain[0]?.getTime() ?? 0;
|
|
41
|
+
const endMs = domain[1]?.getTime() ?? 0;
|
|
42
|
+
const labels = useMemo(() => {
|
|
43
|
+
const step = (endMs - startMs) / (numTicks - 1);
|
|
44
|
+
return Array.from({ length: numTicks }, (_, i) => {
|
|
45
|
+
const t = startMs + i * step;
|
|
46
|
+
const x = (xScale(new Date(t)) ?? 0) + margin.left;
|
|
47
|
+
return { x, label: formatTime(t), stableKey: i };
|
|
48
|
+
});
|
|
49
|
+
}, [startMs, endMs, numTicks, xScale, margin.left, formatTime]);
|
|
50
|
+
const isHovering = tooltipData !== null;
|
|
51
|
+
const crosshairX = tooltipData ? tooltipData.x + margin.left : null;
|
|
52
|
+
// Time pill label
|
|
53
|
+
const pillLabel = useMemo(() => {
|
|
54
|
+
if (!tooltipData) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const timeMs = xScale.invert(tooltipData.x).getTime();
|
|
58
|
+
return formatTime(timeMs);
|
|
59
|
+
}, [tooltipData, xScale, formatTime]);
|
|
60
|
+
// Spring-animated pill position — matches TooltipIndicator's spring config
|
|
61
|
+
// so the pill and crosshair line move in lockstep
|
|
62
|
+
const pillX = tooltipData ? tooltipData.x + margin.left : 0;
|
|
63
|
+
const animatedPillX = useSpring(pillX, crosshairSpringConfig);
|
|
64
|
+
const springRef = useRef(animatedPillX);
|
|
65
|
+
springRef.current = animatedPillX;
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
springRef.current.set(pillX);
|
|
68
|
+
}, [pillX]);
|
|
69
|
+
return createPortal(_jsxs("div", { className: "pointer-events-none absolute inset-0", children: [labels.map((l) => (_jsx("div", { className: "absolute", style: {
|
|
70
|
+
left: l.x,
|
|
71
|
+
bottom: 12,
|
|
72
|
+
width: 0,
|
|
73
|
+
display: "flex",
|
|
74
|
+
justifyContent: "center",
|
|
75
|
+
}, children: _jsx(motion.span, { animate: {
|
|
76
|
+
opacity: labelFadeOpacity(l.x, crosshairX, isHovering),
|
|
77
|
+
}, className: "whitespace-nowrap text-chart-label text-xs", transition: { duration: 0.15, ease: "easeOut" }, children: l.label }) }, l.stableKey))), isHovering && pillLabel && (_jsx(motion.div, { className: "absolute z-50", style: {
|
|
78
|
+
left: animatedPillX,
|
|
79
|
+
x: "-50%",
|
|
80
|
+
bottom: 4,
|
|
81
|
+
}, children: _jsx("div", { className: "overflow-hidden rounded-full bg-zinc-900 px-4 py-1 text-white shadow-lg dark:bg-zinc-100 dark:text-zinc-900", children: _jsx("span", { className: "whitespace-nowrap font-medium text-sm", children: pillLabel }) }) }))] }), container);
|
|
82
|
+
});
|
|
83
|
+
LiveXAxis.displayName = "LiveXAxis";
|
|
84
|
+
export default LiveXAxis;
|
|
85
|
+
//# sourceMappingURL=live-x-axis.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface LiveYAxisProps {
|
|
2
|
+
/** Minimum pixel gap between labels. Default: 36 */
|
|
3
|
+
minGap?: number;
|
|
4
|
+
/** Position. Default: "left" */
|
|
5
|
+
position?: "left" | "right";
|
|
6
|
+
/** Value formatter */
|
|
7
|
+
formatValue?: (v: number) => string;
|
|
8
|
+
/** Allow decimal tick values. Default: true */
|
|
9
|
+
allowDecimals?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function LiveYAxis(props: LiveYAxisProps): import("react").JSX.Element | null;
|
|
12
|
+
export declare namespace LiveYAxis {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
15
|
+
export default LiveYAxis;
|
|
16
|
+
//# sourceMappingURL=live-y-axis.d.ts.map
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
4
|
+
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
|
+
import { useChartStable } from "./chart-context.js";
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Interval picker (inspired by liveline's pickInterval)
|
|
9
|
+
// Finds a "nice" step size that keeps labels ~minGap pixels apart.
|
|
10
|
+
// Uses hysteresis: keeps the previous interval if it still fits, preventing
|
|
11
|
+
// jittery step changes when the range oscillates near a boundary.
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
function pickNiceInterval(valRange, chartHeight, minGap, prevInterval) {
|
|
14
|
+
if (valRange <= 0 || chartHeight <= 0) {
|
|
15
|
+
return 1;
|
|
16
|
+
}
|
|
17
|
+
const pxPerUnit = chartHeight / valRange;
|
|
18
|
+
// Keep previous interval if it still produces reasonable spacing
|
|
19
|
+
if (prevInterval > 0) {
|
|
20
|
+
const px = prevInterval * pxPerUnit;
|
|
21
|
+
if (px >= minGap * 0.5 && px <= minGap * 3) {
|
|
22
|
+
return prevInterval;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Try multiple divisor sequences to find the best nice step
|
|
26
|
+
const divisorSets = [
|
|
27
|
+
[2, 2.5, 2],
|
|
28
|
+
[2, 2, 2.5],
|
|
29
|
+
[2.5, 2, 2],
|
|
30
|
+
];
|
|
31
|
+
let best = Number.POSITIVE_INFINITY;
|
|
32
|
+
for (const divs of divisorSets) {
|
|
33
|
+
let span = 10 ** Math.ceil(Math.log10(valRange));
|
|
34
|
+
let i = 0;
|
|
35
|
+
let d = divs[i % 3] ?? 2;
|
|
36
|
+
while ((span / d) * pxPerUnit >= minGap) {
|
|
37
|
+
span /= d;
|
|
38
|
+
i++;
|
|
39
|
+
d = divs[i % 3] ?? 2;
|
|
40
|
+
}
|
|
41
|
+
if (span < best) {
|
|
42
|
+
best = span;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return best === Number.POSITIVE_INFINITY ? valRange / 5 : best;
|
|
46
|
+
}
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Edge fade: labels near the top/bottom of the chart area fade out
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
const EDGE_FADE_PX = 28;
|
|
51
|
+
function edgeOpacity(y, chartHeight) {
|
|
52
|
+
const fromEdge = Math.min(y, chartHeight - y);
|
|
53
|
+
if (fromEdge >= EDGE_FADE_PX) {
|
|
54
|
+
return 1;
|
|
55
|
+
}
|
|
56
|
+
if (fromEdge <= 0) {
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
return fromEdge / EDGE_FADE_PX;
|
|
60
|
+
}
|
|
61
|
+
const tickSpring = { type: "spring", stiffness: 180, damping: 24 };
|
|
62
|
+
export function LiveYAxis(props) {
|
|
63
|
+
const { containerRef } = useChartStable();
|
|
64
|
+
const [mounted, setMounted] = useState(false);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
setMounted(true);
|
|
67
|
+
}, []);
|
|
68
|
+
const container = containerRef.current;
|
|
69
|
+
if (!(mounted && container)) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return _jsx(LiveYAxisInner, { ...props, container: container });
|
|
73
|
+
}
|
|
74
|
+
const LiveYAxisInner = memo(function LiveYAxisInner({ minGap = 36, position = "left", formatValue = (v) => v.toFixed(2), allowDecimals = true, container, }) {
|
|
75
|
+
const { yScale, margin, innerHeight } = useChartStable();
|
|
76
|
+
const intervalRef = useRef(0);
|
|
77
|
+
const domain = yScale.domain();
|
|
78
|
+
const minVal = domain[0];
|
|
79
|
+
const maxVal = domain[1];
|
|
80
|
+
const valRange = maxVal - minVal;
|
|
81
|
+
// Pick a nice interval with hysteresis
|
|
82
|
+
const interval = useMemo(() => {
|
|
83
|
+
const next = pickNiceInterval(valRange, innerHeight, minGap, intervalRef.current);
|
|
84
|
+
intervalRef.current = next;
|
|
85
|
+
return next;
|
|
86
|
+
}, [valRange, innerHeight, minGap]);
|
|
87
|
+
// Stabilize the tick VALUE set: only recompute which ticks exist when the
|
|
88
|
+
// domain crosses an interval boundary. We quantize min/max to interval
|
|
89
|
+
// boundaries so the set doesn't change on every sub-pixel lerp frame.
|
|
90
|
+
const quantizedMin = interval > 0 ? Math.floor(minVal / interval) : 0;
|
|
91
|
+
const quantizedMax = interval > 0 ? Math.ceil(maxVal / interval) : 0;
|
|
92
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: quantized values are intentional coarse-grained deps for stability
|
|
93
|
+
const stableTickValues = useMemo(() => {
|
|
94
|
+
if (interval <= 0 || valRange <= 0) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
const expandedMin = minVal - interval * 0.5;
|
|
98
|
+
const expandedMax = maxVal + interval * 0.5;
|
|
99
|
+
const first = Math.ceil(expandedMin / interval) * interval;
|
|
100
|
+
const values = [];
|
|
101
|
+
for (let v = first; v <= expandedMax; v += interval) {
|
|
102
|
+
const rounded = Math.round(v * 1e10) / 1e10;
|
|
103
|
+
const isDecimal = !Number.isInteger(rounded);
|
|
104
|
+
if (isDecimal && !allowDecimals) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
values.push(rounded);
|
|
108
|
+
}
|
|
109
|
+
return values;
|
|
110
|
+
}, [quantizedMin, quantizedMax, interval, minVal, maxVal, valRange, allowDecimals]);
|
|
111
|
+
// Pixel positions update every frame for smooth movement
|
|
112
|
+
const tickData = useMemo(() => stableTickValues
|
|
113
|
+
.map((value) => {
|
|
114
|
+
const y = yScale(value) ?? 0;
|
|
115
|
+
return {
|
|
116
|
+
value,
|
|
117
|
+
y,
|
|
118
|
+
label: formatValue(value),
|
|
119
|
+
key: value.toPrecision(10),
|
|
120
|
+
edgeAlpha: edgeOpacity(y, innerHeight),
|
|
121
|
+
};
|
|
122
|
+
})
|
|
123
|
+
.filter((t) => t.y >= -10 && t.y <= innerHeight + 10), [stableTickValues, yScale, innerHeight, formatValue]);
|
|
124
|
+
const isLeft = position === "left";
|
|
125
|
+
return createPortal(_jsx("div", { className: "pointer-events-none absolute inset-0", children: _jsx("div", { className: "absolute overflow-hidden", style: {
|
|
126
|
+
top: margin.top,
|
|
127
|
+
height: innerHeight,
|
|
128
|
+
...(isLeft ? { left: 0, width: margin.left } : { right: 0, width: margin.right }),
|
|
129
|
+
}, children: _jsx(AnimatePresence, { initial: false, children: tickData.map((tick) => (_jsx(motion.div, { animate: { opacity: tick.edgeAlpha, y: tick.y }, className: "absolute w-full", exit: { opacity: 0 }, initial: { opacity: 0, y: tick.y }, style: {
|
|
130
|
+
...(isLeft
|
|
131
|
+
? { right: 0, paddingRight: 8, textAlign: "right" }
|
|
132
|
+
: { left: 0, paddingLeft: 8, textAlign: "left" }),
|
|
133
|
+
}, transition: tickSpring, children: _jsx("span", { className: "whitespace-nowrap font-mono text-chart-label text-xs", children: tick.label }) }, tick.key))) }) }) }), container);
|
|
134
|
+
});
|
|
135
|
+
LiveYAxis.displayName = "LiveYAxis";
|
|
136
|
+
export default LiveYAxis;
|
|
137
|
+
//# sourceMappingURL=live-y-axis.js.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared "sweep" loading visuals. A soft diagonal shimmer band travels across a
|
|
3
|
+
* self-contained skeleton silhouette on a loop, painted via an SVG mask. The
|
|
4
|
+
* silhouette re-randomizes between passes (held steady during a pass, re-rolled
|
|
5
|
+
* once the band clears the right edge) so it reads as live and still loading,
|
|
6
|
+
* without warping mid-sweep. Used as the `loadingStyle="sweep"` alternative to
|
|
7
|
+
* the traveling pulse on `<Line>` and `<Area>`, and as the skeleton for
|
|
8
|
+
* `<BarChart status="loading">`.
|
|
9
|
+
*/
|
|
10
|
+
type CurveFactory = any;
|
|
11
|
+
/** Deterministic heights (percentages of the available height) for a seed. */
|
|
12
|
+
export declare function getSkeletonHeights(count: number, seed?: number, min?: number, max?: number): number[];
|
|
13
|
+
export interface LineLoadingSweepProps {
|
|
14
|
+
/** Curve factory from the host `<Line>` / `<Area>`, so the silhouette matches
|
|
15
|
+
* the chart's interpolation (step, smooth, linear, …). */
|
|
16
|
+
curve: CurveFactory;
|
|
17
|
+
/** Fill the silhouette as an area (for `<Area>`); otherwise stroke only. */
|
|
18
|
+
withArea?: boolean;
|
|
19
|
+
/** Loading phase: `"loop"` (steady), `"exit"` (loading → ready), or `"enter"`
|
|
20
|
+
* (ready → loading). Exit/enter fade the silhouette and then signal the chart
|
|
21
|
+
* to continue its reveal. Default: `"loop"`. */
|
|
22
|
+
mode?: "loop" | "exit" | "enter";
|
|
23
|
+
/** Fired when an exit/enter transition finishes, to advance the chart phase. */
|
|
24
|
+
onTransitionComplete?: () => void;
|
|
25
|
+
stroke?: string;
|
|
26
|
+
strokeOpacity?: number;
|
|
27
|
+
strokeWidth?: number;
|
|
28
|
+
pointCount?: number;
|
|
29
|
+
durationSeconds?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Renders a placeholder line/area silhouette (its own, not the chart's skeleton)
|
|
33
|
+
* with the shimmer sweeping across it. The silhouette re-randomizes between
|
|
34
|
+
* passes. Reads inner dimensions from chart context.
|
|
35
|
+
*/
|
|
36
|
+
export declare function LineLoadingSweep({ curve, withArea, mode, onTransitionComplete, stroke, strokeOpacity, strokeWidth, pointCount, durationSeconds, }: LineLoadingSweepProps): import("react").JSX.Element | null;
|
|
37
|
+
export declare namespace LineLoadingSweep {
|
|
38
|
+
var displayName: string;
|
|
39
|
+
}
|
|
40
|
+
export interface BarLoadingSkeletonProps {
|
|
41
|
+
innerWidth: number;
|
|
42
|
+
innerHeight: number;
|
|
43
|
+
/** Number of skeleton bars. Default: 12 */
|
|
44
|
+
barCount?: number;
|
|
45
|
+
/** Bar fill color. Default: `var(--foreground)` */
|
|
46
|
+
fill?: string;
|
|
47
|
+
/** Bar fill opacity. Default: 0.45 */
|
|
48
|
+
fillOpacity?: number;
|
|
49
|
+
/** Bars rise from the bottom or diverge from the vertical center. Default: `"bottom"` */
|
|
50
|
+
baseline?: "bottom" | "center";
|
|
51
|
+
/** Bar width as a fraction of its band (0–1). Default: 0.7 */
|
|
52
|
+
barFraction?: number;
|
|
53
|
+
/** One shimmer sweep, in seconds. Default: 2 */
|
|
54
|
+
durationSeconds?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Skeleton bars masked by the shimmer sweep, re-randomizing between passes.
|
|
58
|
+
* Rendered in the chart's inner coordinate space (origin at the inner top-left),
|
|
59
|
+
* so a `BarChart` drops it inside its margin-translated group.
|
|
60
|
+
*/
|
|
61
|
+
export declare function BarLoadingSkeleton({ innerWidth, innerHeight, barCount, fill, fillOpacity, baseline, barFraction, durationSeconds, }: BarLoadingSkeletonProps): import("react").JSX.Element | null;
|
|
62
|
+
export declare namespace BarLoadingSkeleton {
|
|
63
|
+
var displayName: string;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=loading-sweep.d.ts.map
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { scaleLinear } from "@visx/scale";
|
|
4
|
+
import { AreaClosed, LinePath } from "@visx/shape";
|
|
5
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
6
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { chartCssVars, useChartStable } from "./chart-context.js";
|
|
8
|
+
import { LINE_LOADING_PULSE_EASE, LOADING_LABEL_EXIT_S } from "./line-loading-timing.js";
|
|
9
|
+
/** One shimmer sweep, in seconds. */
|
|
10
|
+
const DEFAULT_SWEEP_DURATION_S = 2;
|
|
11
|
+
/** Sweep travel in objectBoundingBox space: off the left edge to off the right. */
|
|
12
|
+
const SWEEP_START_X = -1;
|
|
13
|
+
const SWEEP_END_X = 2;
|
|
14
|
+
/** Diagonal tilt of the shimmer band, in degrees. */
|
|
15
|
+
const SWEEP_ANGLE_DEG = 25;
|
|
16
|
+
const HEIGHT_MIN_PCT = 20;
|
|
17
|
+
const HEIGHT_MAX_PCT = 80;
|
|
18
|
+
const DEFAULT_POINT_COUNT = 14;
|
|
19
|
+
const BAR_CORNER_RADIUS = 2;
|
|
20
|
+
const DEFAULT_BAR_COUNT = 12;
|
|
21
|
+
const DEFAULT_FILL = "var(--foreground)";
|
|
22
|
+
const DEFAULT_BAR_FILL_OPACITY = 0.45;
|
|
23
|
+
const LINE_STROKE_OPACITY = 0.55;
|
|
24
|
+
const AREA_FILL_TOP_OPACITY = 0.18;
|
|
25
|
+
const AREA_FILL_BOTTOM_OPACITY = 0.02;
|
|
26
|
+
/** Bar width as a fraction of its band (the rest is the inter-bar gap). */
|
|
27
|
+
const DEFAULT_BAR_FRACTION = 0.7;
|
|
28
|
+
// ─── Pure, SSR-safe helpers ──────────────────────────────────────────────
|
|
29
|
+
// Heights come from a deterministic hash of (index, seed), never
|
|
30
|
+
// `Math.random()`, so the first server render and first client render agree
|
|
31
|
+
// (no Next.js hydration mismatch). Re-randomizing only bumps the numeric seed
|
|
32
|
+
// on the client, after a sweep completes.
|
|
33
|
+
/** Cheap deterministic hash to a fractional part in [0, 1). */
|
|
34
|
+
function hashFract(n) {
|
|
35
|
+
const x = Math.sin(n) * 43_758.5453;
|
|
36
|
+
return x - Math.floor(x);
|
|
37
|
+
}
|
|
38
|
+
/** Deterministic heights (percentages of the available height) for a seed. */
|
|
39
|
+
export function getSkeletonHeights(count, seed = 0, min = HEIGHT_MIN_PCT, max = HEIGHT_MAX_PCT) {
|
|
40
|
+
const range = max - min;
|
|
41
|
+
return Array.from({ length: count }, (_, i) => min + Math.floor(hashFract((i + 1) * 12.9898 + seed) * range));
|
|
42
|
+
}
|
|
43
|
+
/** Deterministic up/down (±1) per bar for the "center" baseline. */
|
|
44
|
+
function getSkeletonSigns(count, seed = 0) {
|
|
45
|
+
return Array.from({ length: count }, (_, i) => hashFract((i + 1) * 78.233 + seed) < 0.5 ? -1 : 1);
|
|
46
|
+
}
|
|
47
|
+
/** Bell-curve opacity stops (sin squared) for the shimmer band's soft edges. */
|
|
48
|
+
function generateEasedGradientStops(steps = 17, minOpacity = 0.05, maxOpacity = 0.9) {
|
|
49
|
+
return Array.from({ length: steps }, (_, i) => {
|
|
50
|
+
const t = i / (steps - 1);
|
|
51
|
+
const eased = Math.sin(t * Math.PI) ** 2;
|
|
52
|
+
const opacity = minOpacity + eased * (maxOpacity - minOpacity);
|
|
53
|
+
return {
|
|
54
|
+
offset: `${(t * 100).toFixed(0)}%`,
|
|
55
|
+
opacity: Number(opacity.toFixed(3)),
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
// ─── Shared mask defs (`${chartId}-mask` is the mask id) ─────────────────────
|
|
60
|
+
function LoadingSweepMask({ chartId, width, height, durationSeconds, onSweepComplete, }) {
|
|
61
|
+
const gradientStops = useMemo(() => generateEasedGradientStops(), []);
|
|
62
|
+
const lastXRef = useRef(SWEEP_START_X);
|
|
63
|
+
const handleUpdate = useCallback((latest) => {
|
|
64
|
+
const xValue = typeof latest.x === "number" ? latest.x : SWEEP_START_X;
|
|
65
|
+
// Re-roll once the band has cleared the visible area (crossed past 1),
|
|
66
|
+
// so the silhouette never changes shape under the user's eye.
|
|
67
|
+
if (xValue >= 1 && lastXRef.current < 1) {
|
|
68
|
+
onSweepComplete();
|
|
69
|
+
}
|
|
70
|
+
lastXRef.current = xValue;
|
|
71
|
+
}, [onSweepComplete]);
|
|
72
|
+
return (_jsxs(_Fragment, { children: [_jsx("linearGradient", { id: `${chartId}-grad`, x1: "0", x2: "1", y1: "0", y2: "0", children: gradientStops.map(({ offset, opacity }) => (_jsx("stop", { offset: offset, stopColor: "white", stopOpacity: opacity }, offset))) }), _jsx("pattern", { height: "1", id: `${chartId}-pattern`, patternContentUnits: "objectBoundingBox", patternTransform: `rotate(${SWEEP_ANGLE_DEG})`, patternUnits: "objectBoundingBox", width: 3, x: "0", y: "0", children: _jsx(motion.rect, { animate: { x: SWEEP_END_X }, fill: `url(#${chartId}-grad)`, height: "1", initial: { x: SWEEP_START_X }, onUpdate: handleUpdate, transition: {
|
|
73
|
+
duration: durationSeconds,
|
|
74
|
+
ease: "linear",
|
|
75
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
76
|
+
repeatType: "loop",
|
|
77
|
+
}, width: "1", y: "0" }) }), _jsx("mask", { id: `${chartId}-mask`, maskUnits: "userSpaceOnUse", children: _jsx("rect", { fill: `url(#${chartId}-pattern)`, height: height, width: width }) })] }));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Renders a placeholder line/area silhouette (its own, not the chart's skeleton)
|
|
81
|
+
* with the shimmer sweeping across it. The silhouette re-randomizes between
|
|
82
|
+
* passes. Reads inner dimensions from chart context.
|
|
83
|
+
*/
|
|
84
|
+
export function LineLoadingSweep({ curve, withArea = false, mode = "loop", onTransitionComplete, stroke = chartCssVars.foreground, strokeOpacity = LINE_STROKE_OPACITY, strokeWidth = 2, pointCount = DEFAULT_POINT_COUNT, durationSeconds = DEFAULT_SWEEP_DURATION_S, }) {
|
|
85
|
+
const { innerWidth, innerHeight } = useChartStable();
|
|
86
|
+
const reduceMotion = useReducedMotion();
|
|
87
|
+
const reactId = useId();
|
|
88
|
+
const chartId = `line-sweep-${reactId.replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
89
|
+
const isLoop = mode === "loop";
|
|
90
|
+
const [tick, setTick] = useState(0);
|
|
91
|
+
// Re-randomize only while looping; hold the silhouette steady through a
|
|
92
|
+
// transition so it fades out (or in) as one piece.
|
|
93
|
+
const onSweepComplete = useCallback(() => {
|
|
94
|
+
if (isLoop) {
|
|
95
|
+
setTick((prev) => prev + 1);
|
|
96
|
+
}
|
|
97
|
+
}, [isLoop]);
|
|
98
|
+
const heights = useMemo(() => getSkeletonHeights(pointCount, tick), [pointCount, tick]);
|
|
99
|
+
// With reduced motion there is no fade to await, so signal the handoff
|
|
100
|
+
// immediately or the phase machine would stall mid-transition.
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (reduceMotion && !isLoop) {
|
|
103
|
+
onTransitionComplete?.();
|
|
104
|
+
}
|
|
105
|
+
}, [reduceMotion, isLoop, onTransitionComplete]);
|
|
106
|
+
if (innerWidth <= 0 || innerHeight <= 0 || heights.length < 2) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const xScale = scaleLinear({
|
|
110
|
+
domain: [0, heights.length - 1],
|
|
111
|
+
range: [0, innerWidth],
|
|
112
|
+
});
|
|
113
|
+
const yScale = scaleLinear({ domain: [0, 100], range: [innerHeight, 0] });
|
|
114
|
+
const points = heights.map((value, index) => ({ index, value }));
|
|
115
|
+
const getX = (d) => xScale(d.index);
|
|
116
|
+
const getY = (d) => yScale(d.value);
|
|
117
|
+
const silhouette = (_jsxs(_Fragment, { children: [withArea ? (_jsx(AreaClosed, { curve: curve, data: points, fill: `url(#${chartId}-area)`, x: getX, y: getY, yScale: yScale })) : null, _jsx(LinePath, { curve: curve, data: points, fill: "none", stroke: stroke, strokeLinecap: "round", strokeOpacity: strokeOpacity, strokeWidth: strokeWidth, x: getX, y: getY })] }));
|
|
118
|
+
const areaGradient = withArea ? (_jsxs("linearGradient", { id: `${chartId}-area`, x1: "0", x2: "0", y1: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: stroke, stopOpacity: AREA_FILL_TOP_OPACITY }), _jsx("stop", { offset: "100%", stopColor: stroke, stopOpacity: AREA_FILL_BOTTOM_OPACITY })] })) : null;
|
|
119
|
+
if (reduceMotion) {
|
|
120
|
+
return (_jsxs(_Fragment, { children: [areaGradient ? _jsx("defs", { children: areaGradient }) : null, silhouette] }));
|
|
121
|
+
}
|
|
122
|
+
const maskUrl = `url(#${chartId}-mask)`;
|
|
123
|
+
const defs = (_jsxs("defs", { children: [areaGradient, _jsx(LoadingSweepMask, { chartId: chartId, durationSeconds: durationSeconds, height: innerHeight, onSweepComplete: onSweepComplete, width: innerWidth })] }));
|
|
124
|
+
if (isLoop) {
|
|
125
|
+
return (_jsxs(_Fragment, { children: [defs, _jsx("g", { mask: maskUrl, children: silhouette })] }));
|
|
126
|
+
}
|
|
127
|
+
// Transition: fade the swept silhouette out (exit) or in (enter), then hand
|
|
128
|
+
// off to the chart so it can reveal the real series.
|
|
129
|
+
return (_jsxs(_Fragment, { children: [defs, _jsx(motion.g, { animate: { opacity: mode === "exit" ? 0 : 1 }, initial: { opacity: mode === "exit" ? 1 : 0 }, mask: maskUrl, onAnimationComplete: onTransitionComplete, transition: {
|
|
130
|
+
duration: LOADING_LABEL_EXIT_S,
|
|
131
|
+
ease: [...LINE_LOADING_PULSE_EASE],
|
|
132
|
+
}, children: silhouette })] }));
|
|
133
|
+
}
|
|
134
|
+
LineLoadingSweep.displayName = "LineLoadingSweep";
|
|
135
|
+
// ─── Bar loading skeleton (seeded bars under the sweep, inner coords) ─────────
|
|
136
|
+
function SkeletonBars({ heights, signs, innerWidth, innerHeight, baseline, barFraction, fill, fillOpacity, }) {
|
|
137
|
+
const bandWidth = innerWidth / heights.length;
|
|
138
|
+
const barW = bandWidth * barFraction;
|
|
139
|
+
const xOffset = (bandWidth * (1 - barFraction)) / 2;
|
|
140
|
+
const isCenter = baseline === "center";
|
|
141
|
+
const baselineY = isCenter ? innerHeight / 2 : innerHeight;
|
|
142
|
+
const halfBarH = isCenter ? innerHeight / 2 : innerHeight;
|
|
143
|
+
return (_jsx(_Fragment, { children: heights.map((value, i) => {
|
|
144
|
+
const sign = isCenter ? (signs[i] ?? 1) : 1;
|
|
145
|
+
const barH = Math.max(1, halfBarH * (value / 100));
|
|
146
|
+
const x = i * bandWidth + xOffset;
|
|
147
|
+
const y = sign === 1 ? baselineY - barH : baselineY;
|
|
148
|
+
return (_jsx("rect", { fill: fill, fillOpacity: fillOpacity, height: barH, rx: BAR_CORNER_RADIUS, width: barW, x: x, y: y }, `${x.toFixed(2)}-${value}`));
|
|
149
|
+
}) }));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Skeleton bars masked by the shimmer sweep, re-randomizing between passes.
|
|
153
|
+
* Rendered in the chart's inner coordinate space (origin at the inner top-left),
|
|
154
|
+
* so a `BarChart` drops it inside its margin-translated group.
|
|
155
|
+
*/
|
|
156
|
+
export function BarLoadingSkeleton({ innerWidth, innerHeight, barCount = DEFAULT_BAR_COUNT, fill = DEFAULT_FILL, fillOpacity = DEFAULT_BAR_FILL_OPACITY, baseline = "bottom", barFraction = DEFAULT_BAR_FRACTION, durationSeconds = DEFAULT_SWEEP_DURATION_S, }) {
|
|
157
|
+
const reduceMotion = useReducedMotion();
|
|
158
|
+
const reactId = useId();
|
|
159
|
+
const chartId = `bar-sweep-${reactId.replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
160
|
+
const [tick, setTick] = useState(0);
|
|
161
|
+
const onSweepComplete = useCallback(() => setTick((prev) => prev + 1), []);
|
|
162
|
+
const heights = useMemo(() => getSkeletonHeights(barCount, tick), [barCount, tick]);
|
|
163
|
+
const signs = useMemo(() => getSkeletonSigns(barCount, tick), [barCount, tick]);
|
|
164
|
+
if (innerWidth <= 0 || innerHeight <= 0) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
const bars = (_jsx(SkeletonBars, { barFraction: barFraction, baseline: baseline, fill: fill, fillOpacity: fillOpacity, heights: heights, innerHeight: innerHeight, innerWidth: innerWidth, signs: signs }));
|
|
168
|
+
if (reduceMotion) {
|
|
169
|
+
return bars;
|
|
170
|
+
}
|
|
171
|
+
return (_jsxs(_Fragment, { children: [_jsx("defs", { children: _jsx(LoadingSweepMask, { chartId: chartId, durationSeconds: durationSeconds, height: innerHeight, onSweepComplete: onSweepComplete, width: innerWidth }) }), _jsx("g", { mask: `url(#${chartId}-mask)`, children: bars })] }));
|
|
172
|
+
}
|
|
173
|
+
BarLoadingSkeleton.displayName = "BarLoadingSkeleton";
|
|
174
|
+
//# sourceMappingURL=loading-sweep.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ChartMarker } from "./marker-group.js";
|
|
2
|
+
export interface ChartMarkersProps {
|
|
3
|
+
/** Array of markers to display */
|
|
4
|
+
items: ChartMarker[];
|
|
5
|
+
/** Size of each marker circle. Default: 28 */
|
|
6
|
+
size?: number;
|
|
7
|
+
/** Whether to show vertical guide lines. Default: true */
|
|
8
|
+
showLines?: boolean;
|
|
9
|
+
/** Whether to animate markers on entrance. Default: true */
|
|
10
|
+
animate?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface MarkerTooltipContentProps {
|
|
13
|
+
markers: ChartMarker[];
|
|
14
|
+
}
|
|
15
|
+
export declare function MarkerTooltipContent({ markers }: MarkerTooltipContentProps): import("react").JSX.Element | null;
|
|
16
|
+
export declare namespace MarkerTooltipContent {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function ChartMarkers({ items, size, showLines, animate, }: ChartMarkersProps): import("react").JSX.Element;
|
|
20
|
+
export declare namespace ChartMarkers {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function useActiveMarkers(items: ChartMarker[]): ChartMarker[];
|
|
24
|
+
export default ChartMarkers;
|
|
25
|
+
//# sourceMappingURL=chart-markers.d.ts.map
|