@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,432 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { localPoint } from "@visx/event";
|
|
4
|
+
import { ParentSize } from "@visx/responsive";
|
|
5
|
+
import { scaleBand, scaleLinear } from "@visx/scale";
|
|
6
|
+
import { memo, useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
7
|
+
import { cn } from "../lib/cn.js";
|
|
8
|
+
import { DEFAULT_ANIMATION_EASING } from "./animation.js";
|
|
9
|
+
import { topSquareCenterY } from "./bar-squares-layout.js";
|
|
10
|
+
import { forEachChartChild, isChartClipPassthrough, isClipExcludedComponent, isPostOverlayComponent, isUnderlayComponent, renderKeyedChartLayers, resolveChartChildElement, } from "./chart-child-passthrough.js";
|
|
11
|
+
import { ChartProvider } from "./chart-context.js";
|
|
12
|
+
import { isGradientDefComponent, isPatternDefComponent } from "./chart-defs.js";
|
|
13
|
+
import { shortDateFmt } from "./chart-formatters.js";
|
|
14
|
+
import { DEFAULT_CHART_LIFECYCLE, resolveRestingChartPhase, } from "./chart-phase.js";
|
|
15
|
+
import { BarLoadingSkeleton } from "./loading-sweep.js";
|
|
16
|
+
import { extractReferenceAreaConfigs } from "./reference-area-config.js";
|
|
17
|
+
import { useScheduledTooltip } from "./use-scheduled-tooltip.js";
|
|
18
|
+
import { buildYScalesForLines, getPrimaryYScale, normalizeYAxisId, wrapSingleYScale, } from "./y-axis-scales.js";
|
|
19
|
+
/** Skeleton bars to show when `status="loading"` and `data` is empty. */
|
|
20
|
+
const FALLBACK_LOADING_BARS = 12;
|
|
21
|
+
const DEFAULT_MARGIN = { top: 40, right: 40, bottom: 40, left: 40 };
|
|
22
|
+
// Extract bar configs from children synchronously
|
|
23
|
+
function extractBarConfigs(children) {
|
|
24
|
+
const configs = [];
|
|
25
|
+
forEachChartChild(children, (child) => {
|
|
26
|
+
const childType = child.type;
|
|
27
|
+
// Bar-depth surface layers (BarDepthBack/Front, BarPulse) carry a
|
|
28
|
+
// `dataKey` to pair with a Bar but are not series themselves — skip them
|
|
29
|
+
// so they don't inflate the series count and shrink the real bars.
|
|
30
|
+
if (childType.__isBarDepthLayer) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const componentName = typeof child.type === "function" ? childType.displayName || childType.name || "" : "";
|
|
34
|
+
const props = child.props;
|
|
35
|
+
const isBarComponent = componentName === "Bar" ||
|
|
36
|
+
componentName === "BarSquares" ||
|
|
37
|
+
(props && typeof props.dataKey === "string" && props.dataKey.length > 0);
|
|
38
|
+
if (isBarComponent && props?.dataKey) {
|
|
39
|
+
// Use stroke for tooltip dot color if provided, otherwise fall back to fill
|
|
40
|
+
// This allows gradient/pattern fills to have a solid dot color
|
|
41
|
+
const dotColor = props.stroke || props.fill || "var(--chart-line-primary)";
|
|
42
|
+
configs.push({
|
|
43
|
+
dataKey: props.dataKey,
|
|
44
|
+
stroke: dotColor,
|
|
45
|
+
strokeWidth: 0,
|
|
46
|
+
yAxisId: props.yAxisId,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return configs;
|
|
51
|
+
}
|
|
52
|
+
function ChartInner(props) {
|
|
53
|
+
const { width, height } = props;
|
|
54
|
+
if (width < 10 || height < 10) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return _jsx(ChartCore, { ...props });
|
|
58
|
+
}
|
|
59
|
+
const ChartCore = memo(function ChartCore({ width, height, data, xDataKey, margin, animationDuration, animationEasing, enterTransition, revealSignature = "", barGap, barWidthProp, orientation, stacked, stackGap, squareSnap, children, containerRef, onPhaseChange, status, }) {
|
|
60
|
+
const { tooltipData, setTooltipData, scheduleTooltip, clearTooltip } = useScheduledTooltip();
|
|
61
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
62
|
+
const [revealEpoch, setRevealEpoch] = useState(0);
|
|
63
|
+
const hoveredBarIndex = tooltipData?.index ?? null;
|
|
64
|
+
const isHorizontal = orientation === "horizontal";
|
|
65
|
+
// Extract bar configs synchronously from children
|
|
66
|
+
const lines = useMemo(() => extractBarConfigs(children), [children]);
|
|
67
|
+
const innerWidth = width - margin.left - margin.right;
|
|
68
|
+
const innerHeight = height - margin.top - margin.bottom;
|
|
69
|
+
// Category accessor function - returns string for categorical scale
|
|
70
|
+
const categoryAccessor = useCallback((d) => {
|
|
71
|
+
const value = d[xDataKey];
|
|
72
|
+
if (value instanceof Date) {
|
|
73
|
+
return shortDateFmt.format(value);
|
|
74
|
+
}
|
|
75
|
+
return String(value ?? "");
|
|
76
|
+
}, [xDataKey]);
|
|
77
|
+
// For compatibility with ChartContext, provide a Date-based xAccessor
|
|
78
|
+
const xAccessorDate = useCallback((d) => {
|
|
79
|
+
const value = d[xDataKey];
|
|
80
|
+
if (value instanceof Date) {
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
83
|
+
return new Date();
|
|
84
|
+
}, [xDataKey]);
|
|
85
|
+
// Category scale (band) - for the categorical axis
|
|
86
|
+
const categoryScale = useMemo(() => {
|
|
87
|
+
const domain = data.map((d) => categoryAccessor(d));
|
|
88
|
+
const range = isHorizontal ? [0, innerHeight] : [0, innerWidth];
|
|
89
|
+
return scaleBand({
|
|
90
|
+
range,
|
|
91
|
+
domain,
|
|
92
|
+
padding: barGap,
|
|
93
|
+
});
|
|
94
|
+
}, [innerWidth, innerHeight, data, categoryAccessor, barGap, isHorizontal]);
|
|
95
|
+
// Band width for bars - use prop if provided, otherwise use scale's bandwidth
|
|
96
|
+
const bandWidth = barWidthProp ?? categoryScale.bandwidth();
|
|
97
|
+
// Compute max value considering stacking
|
|
98
|
+
const maxValue = useMemo(() => {
|
|
99
|
+
if (stacked) {
|
|
100
|
+
// For stacked bars, sum all values at each data point
|
|
101
|
+
let max = 0;
|
|
102
|
+
for (const d of data) {
|
|
103
|
+
let sum = 0;
|
|
104
|
+
for (const line of lines) {
|
|
105
|
+
const value = d[line.dataKey];
|
|
106
|
+
if (typeof value === "number") {
|
|
107
|
+
sum += value;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (sum > max) {
|
|
111
|
+
max = sum;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return max || 100;
|
|
115
|
+
}
|
|
116
|
+
// For grouped bars, find max single value
|
|
117
|
+
let max = 0;
|
|
118
|
+
for (const line of lines) {
|
|
119
|
+
for (const d of data) {
|
|
120
|
+
const value = d[line.dataKey];
|
|
121
|
+
if (typeof value === "number" && value > max) {
|
|
122
|
+
max = value;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return max || 100;
|
|
127
|
+
}, [data, lines, stacked]);
|
|
128
|
+
// Value scale (linear) - for the value axis
|
|
129
|
+
const valueScale = useMemo(() => {
|
|
130
|
+
const range = isHorizontal ? [0, innerWidth] : [innerHeight, 0];
|
|
131
|
+
return scaleLinear({
|
|
132
|
+
range,
|
|
133
|
+
domain: [0, maxValue * 1.1],
|
|
134
|
+
nice: true,
|
|
135
|
+
});
|
|
136
|
+
}, [innerWidth, innerHeight, maxValue, isHorizontal]);
|
|
137
|
+
const yScales = useMemo(() => {
|
|
138
|
+
if (isHorizontal) {
|
|
139
|
+
return wrapSingleYScale(valueScale);
|
|
140
|
+
}
|
|
141
|
+
return buildYScalesForLines({
|
|
142
|
+
lines,
|
|
143
|
+
data,
|
|
144
|
+
innerHeight,
|
|
145
|
+
resolveDomain: (dataKeys) => {
|
|
146
|
+
let max = 0;
|
|
147
|
+
for (const d of data) {
|
|
148
|
+
for (const key of dataKeys) {
|
|
149
|
+
const value = d[key];
|
|
150
|
+
if (typeof value === "number" && value > max) {
|
|
151
|
+
max = value;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return [0, (max || 100) * 1.1];
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
}, [data, innerHeight, isHorizontal, lines, valueScale]);
|
|
159
|
+
const primaryYScale = getPrimaryYScale(yScales, valueScale);
|
|
160
|
+
// Compute stack offsets for stacked bars
|
|
161
|
+
const stackOffsets = useMemo(() => {
|
|
162
|
+
if (!stacked) {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
const offsets = new Map();
|
|
166
|
+
for (let i = 0; i < data.length; i++) {
|
|
167
|
+
const d = data[i];
|
|
168
|
+
if (!d) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
const pointOffsets = new Map();
|
|
172
|
+
let cumulative = 0;
|
|
173
|
+
for (const line of lines) {
|
|
174
|
+
pointOffsets.set(line.dataKey, cumulative);
|
|
175
|
+
const value = d[line.dataKey];
|
|
176
|
+
if (typeof value === "number") {
|
|
177
|
+
cumulative += value;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
offsets.set(i, pointOffsets);
|
|
181
|
+
}
|
|
182
|
+
return offsets;
|
|
183
|
+
}, [data, lines, stacked]);
|
|
184
|
+
// Column width for tooltip indicator
|
|
185
|
+
const columnWidth = useMemo(() => {
|
|
186
|
+
if (data.length < 1) {
|
|
187
|
+
return 0;
|
|
188
|
+
}
|
|
189
|
+
return isHorizontal ? innerHeight / data.length : innerWidth / data.length;
|
|
190
|
+
}, [innerWidth, innerHeight, data.length, isHorizontal]);
|
|
191
|
+
// Pre-compute labels for ticker animation
|
|
192
|
+
const dateLabels = useMemo(() => data.map((d) => categoryAccessor(d)), [data, categoryAccessor]);
|
|
193
|
+
// Create a fake time scale for compatibility with ChartContext
|
|
194
|
+
const fakeTimeScale = useMemo(() => {
|
|
195
|
+
const now = Date.now();
|
|
196
|
+
const start = now - data.length * 24 * 60 * 60 * 1000;
|
|
197
|
+
const scale = {
|
|
198
|
+
...categoryScale,
|
|
199
|
+
domain: () => [new Date(start), new Date(now)],
|
|
200
|
+
range: () => [0, innerWidth],
|
|
201
|
+
invert: (x) => new Date(start + (x / innerWidth) * (now - start)),
|
|
202
|
+
copy: () => scale,
|
|
203
|
+
};
|
|
204
|
+
return scale;
|
|
205
|
+
}, [categoryScale, innerWidth, data.length]);
|
|
206
|
+
// Animation timing — replay when motion settings change
|
|
207
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: revealSignature
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
setRevealEpoch((n) => n + 1);
|
|
210
|
+
setIsLoaded(false);
|
|
211
|
+
// While loading, hold the skeleton (no reveal, no interaction). When
|
|
212
|
+
// status flips to "ready" this effect re-runs and plays the grow reveal.
|
|
213
|
+
if (status === "loading") {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const staggerMs = data.length > 1 ? animationDuration * 0.4 : 0;
|
|
217
|
+
const timer = setTimeout(() => {
|
|
218
|
+
setIsLoaded(true);
|
|
219
|
+
}, animationDuration + staggerMs);
|
|
220
|
+
return () => clearTimeout(timer);
|
|
221
|
+
}, [animationDuration, revealSignature, status]);
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
onPhaseChange?.(isLoaded ? "ready" : "revealing");
|
|
224
|
+
}, [isLoaded, onPhaseChange]);
|
|
225
|
+
// Mouse move handler
|
|
226
|
+
const handleMouseMove = useCallback((event) => {
|
|
227
|
+
const point = localPoint(event);
|
|
228
|
+
if (!point) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const pos = isHorizontal ? point.y - margin.top : point.x - margin.left;
|
|
232
|
+
// Find which band the mouse is over
|
|
233
|
+
const bandIndex = Math.floor(pos / columnWidth);
|
|
234
|
+
const clampedIndex = Math.max(0, Math.min(data.length - 1, bandIndex));
|
|
235
|
+
const d = data[clampedIndex];
|
|
236
|
+
if (!d) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
// Calculate positions for each bar
|
|
240
|
+
const yPositions = {};
|
|
241
|
+
const xPositions = {};
|
|
242
|
+
const barPos = categoryScale(categoryAccessor(d)) ?? 0;
|
|
243
|
+
if (isHorizontal) {
|
|
244
|
+
// Horizontal bars: dots at end of bar (x = value), centered vertically in band
|
|
245
|
+
const seriesCount = lines.length;
|
|
246
|
+
const groupGap = seriesCount > 1 ? 4 : 0;
|
|
247
|
+
const individualBarHeight = seriesCount > 0 ? (bandWidth - groupGap * (seriesCount - 1)) / seriesCount : bandWidth;
|
|
248
|
+
if (stacked) {
|
|
249
|
+
// Stacked horizontal: all bars same y, x at cumulative end
|
|
250
|
+
let cumulative = 0;
|
|
251
|
+
for (const line of lines) {
|
|
252
|
+
const value = d[line.dataKey];
|
|
253
|
+
if (typeof value === "number") {
|
|
254
|
+
cumulative += value;
|
|
255
|
+
const axisScale = yScales[normalizeYAxisId(line.yAxisId)] ?? valueScale;
|
|
256
|
+
xPositions[line.dataKey] = axisScale(cumulative) ?? 0;
|
|
257
|
+
yPositions[line.dataKey] = barPos + bandWidth / 2;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
// Grouped horizontal: each bar at its own y position
|
|
263
|
+
lines.forEach((line, idx) => {
|
|
264
|
+
const value = d[line.dataKey];
|
|
265
|
+
if (typeof value === "number") {
|
|
266
|
+
const axisScale = yScales[normalizeYAxisId(line.yAxisId)] ?? valueScale;
|
|
267
|
+
xPositions[line.dataKey] = axisScale(value) ?? 0;
|
|
268
|
+
yPositions[line.dataKey] =
|
|
269
|
+
barPos + idx * (individualBarHeight + groupGap) + individualBarHeight / 2;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
else if (stacked) {
|
|
275
|
+
// Vertical stacked bars
|
|
276
|
+
let cumulative = 0;
|
|
277
|
+
let seriesIdx = 0;
|
|
278
|
+
for (const line of lines) {
|
|
279
|
+
const value = d[line.dataKey];
|
|
280
|
+
if (typeof value === "number") {
|
|
281
|
+
cumulative += value;
|
|
282
|
+
const axisScale = yScales[normalizeYAxisId(line.yAxisId)] ?? primaryYScale;
|
|
283
|
+
const gapOffset = seriesIdx * stackGap;
|
|
284
|
+
yPositions[line.dataKey] = (axisScale(cumulative) ?? 0) - gapOffset;
|
|
285
|
+
seriesIdx++;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
// Vertical grouped bars
|
|
291
|
+
const seriesCount = lines.length;
|
|
292
|
+
const groupGap = seriesCount > 1 ? 4 : 0;
|
|
293
|
+
const individualBarWidth = seriesCount > 0 ? (bandWidth - groupGap * (seriesCount - 1)) / seriesCount : bandWidth;
|
|
294
|
+
lines.forEach((line, idx) => {
|
|
295
|
+
const value = d[line.dataKey];
|
|
296
|
+
if (typeof value === "number") {
|
|
297
|
+
const axisScale = yScales[normalizeYAxisId(line.yAxisId)] ?? primaryYScale;
|
|
298
|
+
const baselineY = axisScale(0) ?? innerHeight;
|
|
299
|
+
const valueY = axisScale(value) ?? 0;
|
|
300
|
+
const barLengthPx = baselineY - valueY;
|
|
301
|
+
if (squareSnap && !isHorizontal && value > 0) {
|
|
302
|
+
yPositions[line.dataKey] = topSquareCenterY({
|
|
303
|
+
baselineY,
|
|
304
|
+
barLengthPx,
|
|
305
|
+
squareSize: individualBarWidth,
|
|
306
|
+
gap: squareSnap.squareGap,
|
|
307
|
+
fit: squareSnap.fit,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
yPositions[line.dataKey] = valueY;
|
|
312
|
+
}
|
|
313
|
+
xPositions[line.dataKey] =
|
|
314
|
+
barPos + idx * (individualBarWidth + groupGap) + individualBarWidth / 2;
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
// Tooltip position: for horizontal, position at max bar end; for vertical, center of band
|
|
319
|
+
let tooltipX;
|
|
320
|
+
if (isHorizontal) {
|
|
321
|
+
// Position tooltip at the end of the longest bar
|
|
322
|
+
const maxX = Math.max(...Object.values(xPositions), 0);
|
|
323
|
+
tooltipX = maxX;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
tooltipX = barPos + bandWidth / 2;
|
|
327
|
+
}
|
|
328
|
+
scheduleTooltip({
|
|
329
|
+
point: d,
|
|
330
|
+
index: clampedIndex,
|
|
331
|
+
x: tooltipX,
|
|
332
|
+
yPositions,
|
|
333
|
+
xPositions: Object.keys(xPositions).length > 0 ? xPositions : undefined,
|
|
334
|
+
});
|
|
335
|
+
}, [
|
|
336
|
+
categoryScale,
|
|
337
|
+
valueScale,
|
|
338
|
+
data,
|
|
339
|
+
lines,
|
|
340
|
+
margin.left,
|
|
341
|
+
margin.top,
|
|
342
|
+
categoryAccessor,
|
|
343
|
+
columnWidth,
|
|
344
|
+
bandWidth,
|
|
345
|
+
isHorizontal,
|
|
346
|
+
stacked,
|
|
347
|
+
stackGap,
|
|
348
|
+
scheduleTooltip,
|
|
349
|
+
yScales,
|
|
350
|
+
primaryYScale,
|
|
351
|
+
squareSnap,
|
|
352
|
+
innerHeight,
|
|
353
|
+
]);
|
|
354
|
+
const handleMouseLeave = useCallback(() => {
|
|
355
|
+
clearTooltip();
|
|
356
|
+
}, [clearTooltip]);
|
|
357
|
+
const canInteract = isLoaded;
|
|
358
|
+
// Separate children into defs, pre-overlay, and post-overlay
|
|
359
|
+
const defsChildren = [];
|
|
360
|
+
const clipExcludedChildren = [];
|
|
361
|
+
const underlayChildren = [];
|
|
362
|
+
const preOverlayChildren = [];
|
|
363
|
+
const postOverlayChildren = [];
|
|
364
|
+
forEachChartChild(children, (child) => {
|
|
365
|
+
const resolvedChild = resolveChartChildElement(child);
|
|
366
|
+
if (isGradientDefComponent(child)) {
|
|
367
|
+
defsChildren.push(child);
|
|
368
|
+
}
|
|
369
|
+
else if (isPatternDefComponent(child)) {
|
|
370
|
+
preOverlayChildren.push(child);
|
|
371
|
+
}
|
|
372
|
+
else if (isPostOverlayComponent(resolvedChild)) {
|
|
373
|
+
postOverlayChildren.push(resolvedChild);
|
|
374
|
+
}
|
|
375
|
+
else if (isClipExcludedComponent(resolvedChild)) {
|
|
376
|
+
clipExcludedChildren.push(isChartClipPassthrough(child.type) ? resolvedChild : child);
|
|
377
|
+
}
|
|
378
|
+
else if (isUnderlayComponent(resolvedChild)) {
|
|
379
|
+
underlayChildren.push(resolvedChild);
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
preOverlayChildren.push(child);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
const referenceAreas = useMemo(() => extractReferenceAreaConfigs(children), [children]);
|
|
386
|
+
const contextValue = {
|
|
387
|
+
...DEFAULT_CHART_LIFECYCLE,
|
|
388
|
+
chartPhase: resolveRestingChartPhase(status),
|
|
389
|
+
chartStatus: status,
|
|
390
|
+
data,
|
|
391
|
+
renderData: data,
|
|
392
|
+
xScale: fakeTimeScale,
|
|
393
|
+
yScale: isHorizontal ? valueScale : primaryYScale,
|
|
394
|
+
yScales,
|
|
395
|
+
width,
|
|
396
|
+
height,
|
|
397
|
+
innerWidth,
|
|
398
|
+
innerHeight,
|
|
399
|
+
margin,
|
|
400
|
+
columnWidth,
|
|
401
|
+
tooltipData,
|
|
402
|
+
setTooltipData,
|
|
403
|
+
containerRef,
|
|
404
|
+
lines,
|
|
405
|
+
referenceAreas,
|
|
406
|
+
isLoaded,
|
|
407
|
+
animationDuration,
|
|
408
|
+
animationEasing,
|
|
409
|
+
enterTransition,
|
|
410
|
+
revealEpoch,
|
|
411
|
+
xAccessor: xAccessorDate,
|
|
412
|
+
dateLabels,
|
|
413
|
+
// Bar-specific properties
|
|
414
|
+
barScale: categoryScale,
|
|
415
|
+
bandWidth,
|
|
416
|
+
hoveredBarIndex,
|
|
417
|
+
barXAccessor: categoryAccessor,
|
|
418
|
+
orientation,
|
|
419
|
+
stacked,
|
|
420
|
+
stackOffsets,
|
|
421
|
+
squareSnap,
|
|
422
|
+
};
|
|
423
|
+
return (_jsx(ChartProvider, { value: contextValue, children: _jsxs("svg", { "aria-hidden": "true", className: "overflow-visible", height: height, width: width, children: [defsChildren.length > 0 && _jsx("defs", { children: defsChildren }), _jsx("rect", { fill: "transparent", height: height, width: width, x: 0, y: 0 }), _jsxs("g", { onMouseLeave: canInteract ? handleMouseLeave : undefined, onMouseMove: canInteract ? handleMouseMove : undefined, style: { cursor: canInteract ? "crosshair" : "default" }, transform: `translate(${margin.left},${margin.top})`, children: [_jsx("rect", { fill: "transparent", height: innerHeight, width: innerWidth, x: 0, y: 0 }), renderKeyedChartLayers(clipExcludedChildren), renderKeyedChartLayers(underlayChildren), status === "loading" ? (_jsx(BarLoadingSkeleton, { barCount: data.length || FALLBACK_LOADING_BARS, innerHeight: innerHeight, innerWidth: innerWidth })) : (renderKeyedChartLayers(preOverlayChildren)), renderKeyedChartLayers(postOverlayChildren)] })] }) }));
|
|
424
|
+
});
|
|
425
|
+
export function BarChart({ data, xDataKey = "name", margin: marginProp, animationDuration = 1100, animationEasing = DEFAULT_ANIMATION_EASING, enterTransition, revealSignature, aspectRatio = "2 / 1", className = "", barGap = 0.2, barWidth, orientation = "vertical", stacked = false, stackGap = 0, squareSnap, children, onPhaseChange, status = "ready", }) {
|
|
426
|
+
const containerRef = useRef(null);
|
|
427
|
+
const margin = { ...DEFAULT_MARGIN, ...marginProp };
|
|
428
|
+
return (_jsx("div", { "data-slot": "bar-chart", className: cn("relative w-full overflow-visible", className), ref: containerRef, style: { aspectRatio }, children: _jsx(ParentSize, { debounceTime: 10, children: ({ width, height }) => (_jsx(ChartInner, { animationDuration: animationDuration, animationEasing: animationEasing, barGap: barGap, barWidthProp: barWidth, containerRef: containerRef, data: data, enterTransition: enterTransition, height: height, margin: margin, onPhaseChange: onPhaseChange, orientation: orientation, revealSignature: revealSignature, squareSnap: squareSnap, stacked: stacked, stackGap: stackGap, status: status, width: width, xDataKey: xDataKey, children: children })) }) }));
|
|
429
|
+
}
|
|
430
|
+
BarChart.displayName = "BarChart";
|
|
431
|
+
export default BarChart;
|
|
432
|
+
//# sourceMappingURL=bar-chart.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared 3D bar-depth geometry — the single source of truth for the
|
|
3
|
+
* perspective math used by BOTH `<Bar perspective>` (which shrinks a
|
|
4
|
+
* bar's front-face top) AND the bar-depth surfaces (`<BarDepthBack>`'s side +
|
|
5
|
+
* lid). Keeping the formula here means the front face and the 3D lid can never
|
|
6
|
+
* drift out of alignment.
|
|
7
|
+
*/
|
|
8
|
+
/** Hard ceiling on side-face thickness in px. Capped further by the column gap
|
|
9
|
+
* so depth never bleeds past the next bar's leading edge. */
|
|
10
|
+
export declare const BAR_DEPTH_MAX_PX = 7;
|
|
11
|
+
/** The side parallelogram's back edge lifts by `depth * this ratio`, giving a
|
|
12
|
+
* subtle head-on perspective slope. */
|
|
13
|
+
export declare const BAR_DEPTH_PERSPECTIVE_RATIO = 0.45;
|
|
14
|
+
/**
|
|
15
|
+
* Maximum side-face depth in px for a chart, clamped so depth never spills past
|
|
16
|
+
* the gap between bars. `stepWidth` is d3-scaleBand's `step()` (bandwidth +
|
|
17
|
+
* gap); `bandWidth` is a single bar's width. Returns 0 for gapless/dense charts.
|
|
18
|
+
*/
|
|
19
|
+
export declare function barDepthMaxDepth(stepWidth: number, bandWidth: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* Per-bar side-face depth + perspective rise.
|
|
22
|
+
*
|
|
23
|
+
* - `absOffset` ∈ [0, 1]: the bar's normalized distance from the chart's
|
|
24
|
+
* horizontal center. 0 = dead center (no depth); 1 = chart edge (full depth).
|
|
25
|
+
* - `naturalHeight`: the bar's pixel height. Depth is capped by it so a short
|
|
26
|
+
* bar's side never reads wider than the bar is tall.
|
|
27
|
+
* - `maxDepth`: from `barDepthMaxDepth`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function barDepthAndRise(absOffset: number, naturalHeight: number, maxDepth: number): {
|
|
30
|
+
depth: number;
|
|
31
|
+
perspectiveRise: number;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=bar-depth-geometry.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared 3D bar-depth geometry — the single source of truth for the
|
|
3
|
+
* perspective math used by BOTH `<Bar perspective>` (which shrinks a
|
|
4
|
+
* bar's front-face top) AND the bar-depth surfaces (`<BarDepthBack>`'s side +
|
|
5
|
+
* lid). Keeping the formula here means the front face and the 3D lid can never
|
|
6
|
+
* drift out of alignment.
|
|
7
|
+
*/
|
|
8
|
+
/** Hard ceiling on side-face thickness in px. Capped further by the column gap
|
|
9
|
+
* so depth never bleeds past the next bar's leading edge. */
|
|
10
|
+
export const BAR_DEPTH_MAX_PX = 7;
|
|
11
|
+
/** The side parallelogram's back edge lifts by `depth * this ratio`, giving a
|
|
12
|
+
* subtle head-on perspective slope. */
|
|
13
|
+
export const BAR_DEPTH_PERSPECTIVE_RATIO = 0.45;
|
|
14
|
+
/**
|
|
15
|
+
* Maximum side-face depth in px for a chart, clamped so depth never spills past
|
|
16
|
+
* the gap between bars. `stepWidth` is d3-scaleBand's `step()` (bandwidth +
|
|
17
|
+
* gap); `bandWidth` is a single bar's width. Returns 0 for gapless/dense charts.
|
|
18
|
+
*/
|
|
19
|
+
export function barDepthMaxDepth(stepWidth, bandWidth) {
|
|
20
|
+
const gap = Math.max(0, stepWidth - bandWidth);
|
|
21
|
+
return Math.min(bandWidth * 0.22, Math.max(0, gap - 1), BAR_DEPTH_MAX_PX);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Per-bar side-face depth + perspective rise.
|
|
25
|
+
*
|
|
26
|
+
* - `absOffset` ∈ [0, 1]: the bar's normalized distance from the chart's
|
|
27
|
+
* horizontal center. 0 = dead center (no depth); 1 = chart edge (full depth).
|
|
28
|
+
* - `naturalHeight`: the bar's pixel height. Depth is capped by it so a short
|
|
29
|
+
* bar's side never reads wider than the bar is tall.
|
|
30
|
+
* - `maxDepth`: from `barDepthMaxDepth`.
|
|
31
|
+
*/
|
|
32
|
+
export function barDepthAndRise(absOffset, naturalHeight, maxDepth) {
|
|
33
|
+
const offset = Math.min(1, Math.max(0, absOffset));
|
|
34
|
+
const cappedMaxDepth = Math.min(maxDepth, Math.max(0, naturalHeight));
|
|
35
|
+
const depth = offset * cappedMaxDepth;
|
|
36
|
+
return { depth, perspectiveRise: depth * BAR_DEPTH_PERSPECTIVE_RATIO };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=bar-depth-geometry.js.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface BarDepthEntry {
|
|
3
|
+
label: string;
|
|
4
|
+
/** Index in the original `data` array — used for stagger calc. NOT the
|
|
5
|
+
* index in this entries list. */
|
|
6
|
+
dataIndex: number;
|
|
7
|
+
/** Original datum reference — handed back to `colorAccessor` /
|
|
8
|
+
* `segmentsAccessor` so consumers can color or split bars without
|
|
9
|
+
* bar-depth knowing the data shape. */
|
|
10
|
+
datum: Record<string, unknown>;
|
|
11
|
+
/** True when this bar is the active bar (`dataIndex === activeIndex`).
|
|
12
|
+
* Used only by `<BarPulse>`; geometry is identical regardless. */
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
/** True when the bar's value is negative — the bar extends downward from
|
|
15
|
+
* the baseline. The lid still sits at the baseline; the side parallelogram
|
|
16
|
+
* grows downward instead of upward. */
|
|
17
|
+
isNegative: boolean;
|
|
18
|
+
/** y of the chart's baseline (= `yScale(0)`). For positive bars this equals
|
|
19
|
+
* `bottomY`; for negative bars it equals `topY`. Used as the grow-from
|
|
20
|
+
* anchor for both the clipPath (side face) and the glass rect. */
|
|
21
|
+
baselineY: number;
|
|
22
|
+
bandX: number;
|
|
23
|
+
bandWidth: number;
|
|
24
|
+
/** Visual top of the bar in screen Y (smaller y = higher on screen). */
|
|
25
|
+
topY: number;
|
|
26
|
+
/** Visual bottom of the bar in screen Y. */
|
|
27
|
+
bottomY: number;
|
|
28
|
+
barHeight: number;
|
|
29
|
+
/** Un-trimmed natural pixel height of the bar (= `|baselineY - yScale(value)|`).
|
|
30
|
+
* Segment heights are scaled against this so they line up with `<Bar>`. */
|
|
31
|
+
naturalHeight: number;
|
|
32
|
+
/** Pixels subtracted from the bar's visual top (and added to `topY`) so the
|
|
33
|
+
* lid's back edge lands at `yScale(value)` regardless of depth. */
|
|
34
|
+
topYTrim: number;
|
|
35
|
+
/** Side-face thickness in px (0 = dead-center bar / dense chart). */
|
|
36
|
+
depth: number;
|
|
37
|
+
perspectiveRise: number;
|
|
38
|
+
isRightOfCenter: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** One segment of a stacked bar, in stack order bottom→top. The values across
|
|
41
|
+
* all segments should sum to the bar's value; bar-depth uses the proportions
|
|
42
|
+
* to pick segment boundaries that line up with the front face's stacking. */
|
|
43
|
+
export interface BarDepthSegment {
|
|
44
|
+
value: number;
|
|
45
|
+
color: string;
|
|
46
|
+
}
|
|
47
|
+
/** Resolve a per-datum color, falling back to the shared `color` default. */
|
|
48
|
+
type ColorAccessor = (datum: Record<string, unknown>, index: number) => string;
|
|
49
|
+
interface BarDepthContextValue {
|
|
50
|
+
segmentsAccessor?: (datum: Record<string, unknown>) => BarDepthSegment[] | null | undefined;
|
|
51
|
+
/** Opacity (0–1) of the baseline contact shadow. 0 removes it. */
|
|
52
|
+
groundShadow?: number;
|
|
53
|
+
/** Minimum bar height in px — floors short/zero bars so they stay visible.
|
|
54
|
+
* Match the value passed to `<Bar minBarHeight>`. */
|
|
55
|
+
minBarHeight?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface BarDepthProviderProps extends BarDepthContextValue {
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Provides shared bar-depth configuration to every depth surface beneath it.
|
|
62
|
+
* Wrap a `<BarChart>` whose children include `<BarDepthBack>` /
|
|
63
|
+
* `<BarDepthFront>` / `<BarPulse>` with this provider to:
|
|
64
|
+
* - split stacked bars into per-segment side faces (`segmentsAccessor`),
|
|
65
|
+
* - tune the baseline contact shadow (`groundShadow`, default 0.26; 0 = off),
|
|
66
|
+
* - floor short/zero bars so they stay visible (`minBarHeight`; pair with the
|
|
67
|
+
* same value on `<Bar minBarHeight>`).
|
|
68
|
+
*
|
|
69
|
+
* Because the glass gradient is chart-wide (one Y-anchored ramp shared by the
|
|
70
|
+
* front face and the side glass), the provider is the single source of truth —
|
|
71
|
+
* so the surfaces can never disagree.
|
|
72
|
+
*/
|
|
73
|
+
export declare function BarDepthProvider({ segmentsAccessor, groundShadow, minBarHeight, children, }: BarDepthProviderProps): import("react").JSX.Element;
|
|
74
|
+
export declare namespace BarDepthProvider {
|
|
75
|
+
var displayName: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Compute per-bar 3D depth geometry from chart context.
|
|
79
|
+
*
|
|
80
|
+
* Memoized on the chart's scales + data, so calling this from sibling layers
|
|
81
|
+
* within the same chart is essentially free after the first settles. Returns
|
|
82
|
+
* one entry per renderable bar; bars with no resolvable height are excluded.
|
|
83
|
+
*
|
|
84
|
+
* Negative-value bars are kept — `isNegative` flips the entry's geometry so
|
|
85
|
+
* the side parallelogram and lid render in the correct direction.
|
|
86
|
+
*
|
|
87
|
+
* Exported for advanced consumers that want to render custom layers aligned
|
|
88
|
+
* with the same geometry (e.g. labels above each bar's top face).
|
|
89
|
+
*/
|
|
90
|
+
export declare function useBarDepthEntries(dataKey: string, activeIndex?: number): BarDepthEntry[];
|
|
91
|
+
export interface BarDepthBackProps {
|
|
92
|
+
/** Key in data for the bar value. Match the sibling `<Bar dataKey>`. */
|
|
93
|
+
dataKey: string;
|
|
94
|
+
/** Solid color for the side + top faces. Default: var(--chart-line-primary). */
|
|
95
|
+
color?: string;
|
|
96
|
+
/** Per-bar color override; takes precedence over `color` when provided. */
|
|
97
|
+
colorAccessor?: ColorAccessor;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Renders the back surfaces (side + top faces) of the 3D bar effect.
|
|
101
|
+
*
|
|
102
|
+
* Place BEFORE the `<Bar>` elements in `<BarChart>` children so the bar's
|
|
103
|
+
* solid front face occludes any depth that would extend into an adjacent
|
|
104
|
+
* column. Skips bars at chart center (depth ≈ 0) and dense charts.
|
|
105
|
+
*
|
|
106
|
+
* For stacked bars, wrap the `<BarChart>` in a
|
|
107
|
+
* `<BarDepthProvider segmentsAccessor={...}>` so the side face splits into
|
|
108
|
+
* per-segment parallelograms and the lid color matches the topmost segment.
|
|
109
|
+
*/
|
|
110
|
+
export declare function BarDepthBack({ dataKey, color, colorAccessor, }: BarDepthBackProps): import("react").JSX.Element;
|
|
111
|
+
export declare namespace BarDepthBack {
|
|
112
|
+
var displayName: string;
|
|
113
|
+
}
|
|
114
|
+
export interface BarDepthFrontProps {
|
|
115
|
+
/** Key in data for the bar value. Match the sibling `<Bar dataKey>`. */
|
|
116
|
+
dataKey: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Renders the front surface: a glossy glass sheen over the bar's solid fill.
|
|
120
|
+
* Place AFTER the `<Bar>` elements in `<BarChart>` children so the gradient
|
|
121
|
+
* sits on top of the bar.
|
|
122
|
+
*
|
|
123
|
+
* Reads `segmentsAccessor` from the surrounding `<BarDepthProvider>` (if any)
|
|
124
|
+
* via `useBarDepthEntries`, so the glass rectangle's `topY` automatically
|
|
125
|
+
* matches the lid+side's trim. No prop wiring required.
|
|
126
|
+
*/
|
|
127
|
+
export declare function BarDepthFront({ dataKey }: BarDepthFrontProps): import("react").JSX.Element;
|
|
128
|
+
export declare namespace BarDepthFront {
|
|
129
|
+
var displayName: string;
|
|
130
|
+
}
|
|
131
|
+
export interface BarPulseProps {
|
|
132
|
+
/** Key in data for the bar value. Match the sibling `<Bar dataKey>`. */
|
|
133
|
+
dataKey: string;
|
|
134
|
+
/** Index (in the data array) of the bar to pulse. */
|
|
135
|
+
activeIndex?: number;
|
|
136
|
+
/** Suppress the sweep while keeping the bar's 3D + glass treatment. */
|
|
137
|
+
pulsePaused?: boolean;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Vertical wave that sweeps from a bar's root (baseline) toward its tip on a
|
|
141
|
+
* continuous loop, painted across the bar's full 3D silhouette (front face +
|
|
142
|
+
* lid + visible side). Reads as a heartbeat pulse flowing up the column for
|
|
143
|
+
* positive bars and down for negative bars — useful for marking a live or
|
|
144
|
+
* in-progress value without adding any fixed element.
|
|
145
|
+
*
|
|
146
|
+
* Select the bar via `activeIndex`. Set `pulsePaused` to freeze it. Place
|
|
147
|
+
* AFTER `<BarDepthFront />` so the wave brightens on top of the glass.
|
|
148
|
+
*
|
|
149
|
+
* Performance: at most one clipped `<motion.rect>` with a single Y translate
|
|
150
|
+
* per frame (no per-frame paint of gradient stops, no SVG filters).
|
|
151
|
+
*/
|
|
152
|
+
export declare function BarPulse({ dataKey, activeIndex, pulsePaused }: BarPulseProps): import("react").JSX.Element | null;
|
|
153
|
+
export declare namespace BarPulse {
|
|
154
|
+
var displayName: string;
|
|
155
|
+
}
|
|
156
|
+
export {};
|
|
157
|
+
//# sourceMappingURL=bar-depth.d.ts.map
|