@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,275 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ParentSize } from "@visx/responsive";
|
|
4
|
+
import { scaleLinear, scaleTime } from "@visx/scale";
|
|
5
|
+
import { useReducedMotion } from "motion/react";
|
|
6
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
7
|
+
import { cn } from "../../lib/cn.js";
|
|
8
|
+
import { ChartLoadingLabel } from "../chart-loading-label.js";
|
|
9
|
+
import { DEFAULT_CHART_STATUS, resolveRestingChartPhase, } from "../chart-phase.js";
|
|
10
|
+
import { HEATMAP_DEFAULT_ENTER_DURATION_MS, HEATMAP_DEFAULT_ENTER_TRANSITION, HEATMAP_DEFAULT_LOADING_CELL_MAX_OPACITY, HEATMAP_DEFAULT_LOADING_CELL_RANDOMNESS, HEATMAP_LOADING_CHART_OPACITY, HEATMAP_LOADING_CONCEAL_MS, } from "./heatmap-animation.js";
|
|
11
|
+
import { buildHeatmapColorScaleFromStyles, buildHeatmapFillScale, resolveHeatmapLevelStyles, } from "./heatmap-colors.js";
|
|
12
|
+
import { HeatmapInteractionRoot, HeatmapProvider, useHeatmap, useHeatmapInteraction, } from "./heatmap-context.js";
|
|
13
|
+
import { HeatmapPatternDefs } from "./heatmap-pattern-defs.js";
|
|
14
|
+
import { resolveHeatmapSeparatorConfigWithData } from "./heatmap-resolve-separator.js";
|
|
15
|
+
import { filterHeatmapColumns, getHeatmapColumnXOffset, getHeatmapPlotInnerWidth, getHeatmapSeparatorCount, getHeatmapTimeExtent, rotateHeatmapColumnBins, } from "./heatmap-utils.js";
|
|
16
|
+
const DEFAULT_MARGIN = { top: 28, right: 16, bottom: 0, left: 40 };
|
|
17
|
+
function computeHeatmapDimensions({ width, parentHeight, margin, columnCount, rowCount, binSize, layout, separator, }) {
|
|
18
|
+
const innerWidth = Math.max(width - margin.left - margin.right, 0);
|
|
19
|
+
const availableHeight = Math.max(parentHeight - margin.top - margin.bottom, 0);
|
|
20
|
+
const separatorCount = separator ? getHeatmapSeparatorCount(separator) : 0;
|
|
21
|
+
const totalSpacing = separatorCount * (separator?.spacing ?? 0);
|
|
22
|
+
let binWidth;
|
|
23
|
+
let binHeight;
|
|
24
|
+
if (binSize > 0) {
|
|
25
|
+
binWidth = binSize;
|
|
26
|
+
binHeight = binSize;
|
|
27
|
+
}
|
|
28
|
+
else if (layout === "fluid") {
|
|
29
|
+
const cellSize = Math.max((innerWidth - totalSpacing) / columnCount, 0);
|
|
30
|
+
binWidth = cellSize;
|
|
31
|
+
binHeight = cellSize;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const cellSize = Math.min(Math.max((innerWidth - totalSpacing) / columnCount, 0), availableHeight / rowCount);
|
|
35
|
+
binWidth = cellSize;
|
|
36
|
+
binHeight = cellSize;
|
|
37
|
+
}
|
|
38
|
+
const plotInnerWidth = getHeatmapPlotInnerWidth(columnCount, binWidth, separator);
|
|
39
|
+
const innerHeight = rowCount * binHeight;
|
|
40
|
+
const height = layout === "fluid"
|
|
41
|
+
? margin.top + innerHeight + margin.bottom
|
|
42
|
+
: Math.max(parentHeight, margin.top + innerHeight + margin.bottom);
|
|
43
|
+
const chartWidth = binSize > 0 && layout === "fluid" ? margin.left + plotInnerWidth + margin.right : width;
|
|
44
|
+
return {
|
|
45
|
+
binWidth,
|
|
46
|
+
binHeight,
|
|
47
|
+
innerWidth: plotInnerWidth,
|
|
48
|
+
innerHeight,
|
|
49
|
+
height,
|
|
50
|
+
width: chartWidth,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function HeatmapChartInner({ width, height: parentHeight, data, xDomain, sizingColumnCount: sizingColumnCountProp, margin, binSize, gap, layout, colorScale, fillScale, levelStyles, chartStatus, chartPhase, isLoaded, revealEpoch, animationDuration, enterTransition, enterStaggerScale, animateCells, loadingOpacity, showLoadingCells, loadingCellMaxOpacity, loadingCellRandomness, revealMode, loadingLabel, showLoadingLabel, columnSeparators, weekStartDay, children, }) {
|
|
54
|
+
const containerRef = useRef(null);
|
|
55
|
+
const filteredData = useMemo(() => filterHeatmapColumns(data, xDomain), [data, xDomain]);
|
|
56
|
+
const visibleData = useMemo(() => rotateHeatmapColumnBins(filteredData, weekStartDay), [filteredData, weekStartDay]);
|
|
57
|
+
const visibleColumnCount = Math.max(visibleData.length, 1);
|
|
58
|
+
const columnCount = xDomain && sizingColumnCountProp != null
|
|
59
|
+
? Math.max(sizingColumnCountProp, 1)
|
|
60
|
+
: visibleColumnCount;
|
|
61
|
+
const rowCount = Math.max(visibleData[0]?.bins.length ?? 7, 1);
|
|
62
|
+
const separatorLayout = useMemo(() => resolveHeatmapSeparatorConfigWithData(children, visibleData, columnSeparators), [children, columnSeparators, visibleData]);
|
|
63
|
+
const { binWidth, binHeight, innerWidth, innerHeight, height, width: chartWidth, } = useMemo(() => computeHeatmapDimensions({
|
|
64
|
+
width,
|
|
65
|
+
parentHeight,
|
|
66
|
+
margin,
|
|
67
|
+
columnCount,
|
|
68
|
+
rowCount,
|
|
69
|
+
binSize,
|
|
70
|
+
layout,
|
|
71
|
+
separator: separatorLayout,
|
|
72
|
+
}), [binSize, columnCount, layout, margin, parentHeight, rowCount, separatorLayout, width]);
|
|
73
|
+
const xScale = useMemo(() => (columnIndex) => columnIndex * binWidth + getHeatmapColumnXOffset(columnIndex, separatorLayout), [binWidth, separatorLayout]);
|
|
74
|
+
const yScale = useMemo(() => (rowIndex) => rowIndex * binHeight, [binHeight]);
|
|
75
|
+
const timeExtent = useMemo(() => getHeatmapTimeExtent(data), [data]);
|
|
76
|
+
const timeXScale = useMemo(() => {
|
|
77
|
+
const domain = timeExtent ?? [new Date(), new Date()];
|
|
78
|
+
return scaleTime({
|
|
79
|
+
domain,
|
|
80
|
+
range: [0, innerWidth],
|
|
81
|
+
});
|
|
82
|
+
}, [innerWidth, timeExtent]);
|
|
83
|
+
const brushYScale = useMemo(() => scaleLinear({
|
|
84
|
+
domain: [0, 1],
|
|
85
|
+
range: [innerHeight, 0],
|
|
86
|
+
}), [innerHeight]);
|
|
87
|
+
const contextValue = useMemo(() => ({
|
|
88
|
+
data: visibleData,
|
|
89
|
+
width: chartWidth,
|
|
90
|
+
height,
|
|
91
|
+
innerWidth,
|
|
92
|
+
innerHeight,
|
|
93
|
+
margin,
|
|
94
|
+
binWidth,
|
|
95
|
+
binHeight,
|
|
96
|
+
gap,
|
|
97
|
+
weekStartDay,
|
|
98
|
+
xScale,
|
|
99
|
+
yScale,
|
|
100
|
+
separatorLayout,
|
|
101
|
+
timeXScale,
|
|
102
|
+
brushYScale,
|
|
103
|
+
isReady: chartWidth >= 10 && height >= 10,
|
|
104
|
+
colorScale,
|
|
105
|
+
fillScale,
|
|
106
|
+
levelStyles,
|
|
107
|
+
containerRef,
|
|
108
|
+
chartStatus,
|
|
109
|
+
chartPhase,
|
|
110
|
+
isLoaded,
|
|
111
|
+
revealEpoch,
|
|
112
|
+
animationDuration,
|
|
113
|
+
enterTransition,
|
|
114
|
+
enterStaggerScale,
|
|
115
|
+
animateCells,
|
|
116
|
+
loadingOpacity,
|
|
117
|
+
showLoadingCells,
|
|
118
|
+
loadingCellMaxOpacity,
|
|
119
|
+
loadingCellRandomness,
|
|
120
|
+
revealMode,
|
|
121
|
+
loadingLabel,
|
|
122
|
+
showLoadingLabel,
|
|
123
|
+
}), [
|
|
124
|
+
animateCells,
|
|
125
|
+
animationDuration,
|
|
126
|
+
binHeight,
|
|
127
|
+
binWidth,
|
|
128
|
+
brushYScale,
|
|
129
|
+
chartPhase,
|
|
130
|
+
chartStatus,
|
|
131
|
+
chartWidth,
|
|
132
|
+
colorScale,
|
|
133
|
+
fillScale,
|
|
134
|
+
enterStaggerScale,
|
|
135
|
+
enterTransition,
|
|
136
|
+
gap,
|
|
137
|
+
height,
|
|
138
|
+
innerHeight,
|
|
139
|
+
innerWidth,
|
|
140
|
+
isLoaded,
|
|
141
|
+
loadingCellMaxOpacity,
|
|
142
|
+
loadingCellRandomness,
|
|
143
|
+
loadingLabel,
|
|
144
|
+
levelStyles,
|
|
145
|
+
loadingOpacity,
|
|
146
|
+
margin,
|
|
147
|
+
revealMode,
|
|
148
|
+
separatorLayout,
|
|
149
|
+
showLoadingCells,
|
|
150
|
+
showLoadingLabel,
|
|
151
|
+
revealEpoch,
|
|
152
|
+
timeXScale,
|
|
153
|
+
visibleData,
|
|
154
|
+
weekStartDay,
|
|
155
|
+
xScale,
|
|
156
|
+
yScale,
|
|
157
|
+
]);
|
|
158
|
+
if (chartWidth < 10 || height < 10) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
return (_jsx(HeatmapProvider, { value: contextValue, children: _jsx(HeatmapInteractionRoot, { children: _jsx(HeatmapChartSurface, { layout: layout, children: children }) }) }));
|
|
162
|
+
}
|
|
163
|
+
function HeatmapChartSurface({ layout, children }) {
|
|
164
|
+
const { containerRef, height, width, margin, levelStyles, chartPhase, loadingOpacity, loadingLabel, showLoadingLabel, } = useHeatmap();
|
|
165
|
+
const { clearInteraction } = useHeatmapInteraction();
|
|
166
|
+
const reducedOpacity = chartPhase === "loading" || chartPhase === "exitingReady" ? loadingOpacity : 1;
|
|
167
|
+
return (_jsxs("div", { "data-slot": "heatmap-chart", className: cn("relative w-full", layout === "fill" && "h-full"), onPointerLeave: clearInteraction, ref: containerRef, style: { opacity: reducedOpacity }, children: [_jsxs("svg", { "aria-hidden": "true", height: height, width: width, children: [_jsx(HeatmapPatternDefs, { levelStyles: levelStyles }), _jsx("g", { transform: `translate(${margin.left},${margin.top})`, children: children })] }), showLoadingLabel && loadingLabel?.trim() ? (_jsx("div", { className: "pointer-events-none absolute", style: {
|
|
168
|
+
top: margin.top,
|
|
169
|
+
left: margin.left,
|
|
170
|
+
width: Math.max(width - margin.left - margin.right, 0),
|
|
171
|
+
height: Math.max(height - margin.top - margin.bottom, 0),
|
|
172
|
+
}, children: _jsx(ChartLoadingLabel, { exiting: chartPhase !== "loading", text: loadingLabel }) })) : null] }));
|
|
173
|
+
}
|
|
174
|
+
function useHeatmapChartLifecycle({ chartStatus, animationDuration, revealSignature = "", animate, }) {
|
|
175
|
+
const reducedMotion = useReducedMotion();
|
|
176
|
+
const [chartPhase, setChartPhase] = useState(() => resolveRestingChartPhase(chartStatus));
|
|
177
|
+
const [isLoaded, setIsLoaded] = useState(() => chartStatus === "ready" && (!animate || animationDuration <= 0));
|
|
178
|
+
const [revealEpoch, setRevealEpoch] = useState(0);
|
|
179
|
+
const [revealMode, setRevealMode] = useState(null);
|
|
180
|
+
const prevStatusRef = useRef(chartStatus);
|
|
181
|
+
const phaseRef = useRef(chartPhase);
|
|
182
|
+
phaseRef.current = chartPhase;
|
|
183
|
+
const animateCells = animate && !reducedMotion;
|
|
184
|
+
const animateEnter = animateCells && animationDuration > 0;
|
|
185
|
+
const finishReveal = useCallback(() => {
|
|
186
|
+
setIsLoaded(true);
|
|
187
|
+
setChartPhase("ready");
|
|
188
|
+
setRevealMode(null);
|
|
189
|
+
}, []);
|
|
190
|
+
const beginReveal = useCallback(() => {
|
|
191
|
+
setRevealMode("enter");
|
|
192
|
+
setRevealEpoch((epoch) => epoch + 1);
|
|
193
|
+
setIsLoaded(false);
|
|
194
|
+
setChartPhase("revealing");
|
|
195
|
+
if (!animateEnter) {
|
|
196
|
+
finishReveal();
|
|
197
|
+
}
|
|
198
|
+
}, [animateEnter, finishReveal]);
|
|
199
|
+
useLayoutEffect(() => {
|
|
200
|
+
const prevStatus = prevStatusRef.current;
|
|
201
|
+
if (prevStatus === chartStatus) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
prevStatusRef.current = chartStatus;
|
|
205
|
+
if (chartStatus === "ready" && prevStatus === "loading") {
|
|
206
|
+
setRevealMode("fromLoading");
|
|
207
|
+
setIsLoaded(false);
|
|
208
|
+
setChartPhase("revealing");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (chartStatus === "loading" && prevStatus === "ready") {
|
|
212
|
+
setRevealMode(null);
|
|
213
|
+
setIsLoaded(false);
|
|
214
|
+
setChartPhase("exitingReady");
|
|
215
|
+
}
|
|
216
|
+
}, [chartStatus]);
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
if (chartPhase !== "exitingReady") {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const timer = window.setTimeout(() => {
|
|
222
|
+
setChartPhase("loading");
|
|
223
|
+
}, HEATMAP_LOADING_CONCEAL_MS);
|
|
224
|
+
return () => window.clearTimeout(timer);
|
|
225
|
+
}, [chartPhase]);
|
|
226
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: revealSignature replays enter
|
|
227
|
+
useEffect(() => {
|
|
228
|
+
if (!animateEnter) {
|
|
229
|
+
setIsLoaded(true);
|
|
230
|
+
setChartPhase(resolveRestingChartPhase(chartStatus));
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (chartStatus !== "ready") {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (phaseRef.current !== "ready") {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
beginReveal();
|
|
240
|
+
}, [animateEnter, animationDuration, beginReveal, chartStatus, revealSignature]);
|
|
241
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: revealEpoch replays finish timer
|
|
242
|
+
useEffect(() => {
|
|
243
|
+
if (!animateEnter || chartPhase !== "revealing") {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const finishTimer = window.setTimeout(finishReveal, animationDuration);
|
|
247
|
+
return () => window.clearTimeout(finishTimer);
|
|
248
|
+
}, [animateEnter, animationDuration, chartPhase, finishReveal, revealEpoch]);
|
|
249
|
+
return {
|
|
250
|
+
chartPhase,
|
|
251
|
+
isLoaded,
|
|
252
|
+
revealEpoch,
|
|
253
|
+
revealMode,
|
|
254
|
+
animateCells,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
export function HeatmapChart({ data, xDomain, sizingColumnCount, layout = "fluid", margin: marginProp, binSize = 0, gap = 2, colorScale: colorScaleProp, levelColors, levelStyles: levelStylesProp, aspectRatio, className = "", status = DEFAULT_CHART_STATUS, loadingLabel, animationDuration = HEATMAP_DEFAULT_ENTER_DURATION_MS, enterTransition = HEATMAP_DEFAULT_ENTER_TRANSITION, revealSignature = "", enterStaggerScale = 1, animate = true, loadingOpacity = HEATMAP_LOADING_CHART_OPACITY, showLoadingCells = true, loadingCellMaxOpacity = HEATMAP_DEFAULT_LOADING_CELL_MAX_OPACITY, loadingCellRandomness = HEATMAP_DEFAULT_LOADING_CELL_RANDOMNESS, columnSeparators, weekStartDay = 0, children, }) {
|
|
258
|
+
const margin = { ...DEFAULT_MARGIN, ...marginProp };
|
|
259
|
+
const levelStyles = useMemo(() => resolveHeatmapLevelStyles(levelColors, levelStylesProp), [levelColors, levelStylesProp]);
|
|
260
|
+
const colorScale = useMemo(() => colorScaleProp ?? buildHeatmapColorScaleFromStyles(levelStyles), [colorScaleProp, levelStyles]);
|
|
261
|
+
const fillScale = useMemo(() => buildHeatmapFillScale(levelStyles), [levelStyles]);
|
|
262
|
+
const { chartPhase, isLoaded, revealEpoch, revealMode, animateCells } = useHeatmapChartLifecycle({
|
|
263
|
+
chartStatus: status,
|
|
264
|
+
animationDuration,
|
|
265
|
+
revealSignature,
|
|
266
|
+
animate,
|
|
267
|
+
});
|
|
268
|
+
const showLoadingLabel = Boolean(loadingLabel?.trim() &&
|
|
269
|
+
status === "loading" &&
|
|
270
|
+
(chartPhase === "loading" || chartPhase === "exitingReady"));
|
|
271
|
+
return (_jsx("div", { className: cn("relative w-full", layout === "fill" && "h-full min-h-0", className), "data-slot": "heatmap-chart", style: aspectRatio ? { aspectRatio } : undefined, children: _jsx(ParentSize, { children: ({ width, height: parentHeight }) => (_jsx(HeatmapChartInner, { animateCells: animateCells, animationDuration: animationDuration, binSize: binSize, chartPhase: chartPhase, chartStatus: status, colorScale: colorScale, columnSeparators: columnSeparators, data: data, enterStaggerScale: enterStaggerScale, enterTransition: enterTransition, fillScale: fillScale, gap: gap, height: parentHeight, isLoaded: isLoaded, layout: layout, levelStyles: levelStyles, loadingCellMaxOpacity: loadingCellMaxOpacity, loadingCellRandomness: loadingCellRandomness, loadingLabel: loadingLabel, loadingOpacity: loadingOpacity, margin: margin, revealEpoch: revealEpoch, revealMode: revealMode, showLoadingCells: showLoadingCells, showLoadingLabel: showLoadingLabel, sizingColumnCount: sizingColumnCount, weekStartDay: weekStartDay, width: width, xDomain: xDomain, children: children })) }) }));
|
|
272
|
+
}
|
|
273
|
+
HeatmapChart.displayName = "HeatmapChart";
|
|
274
|
+
export default HeatmapChart;
|
|
275
|
+
//# sourceMappingURL=heatmap-chart.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { PatternPresetId } from "../pattern-preset.js";
|
|
2
|
+
/** Default Less → More scale using {@link CHART_SCALE_VARS}. */
|
|
3
|
+
export declare const HEATMAP_DEFAULT_LEVEL_COLORS: readonly ["var(--chart-scale-01)", "var(--chart-scale-02)", "var(--chart-scale-03)", "var(--chart-scale-04)", "var(--chart-scale-05)"];
|
|
4
|
+
export type HeatmapLevelColors = readonly [string, string, string, string, string];
|
|
5
|
+
export type HeatmapLevelFillMode = "solid" | "pattern";
|
|
6
|
+
export interface HeatmapLevelStyle {
|
|
7
|
+
color: string;
|
|
8
|
+
fillMode?: HeatmapLevelFillMode;
|
|
9
|
+
pattern?: PatternPresetId;
|
|
10
|
+
patternColor?: string;
|
|
11
|
+
patternScale?: number;
|
|
12
|
+
patternStrokeWidth?: number;
|
|
13
|
+
patternRadius?: number;
|
|
14
|
+
patternComplement?: boolean;
|
|
15
|
+
patternFill?: string;
|
|
16
|
+
patternTileBackground?: string;
|
|
17
|
+
patternOpacity?: number;
|
|
18
|
+
patternDotsFill?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type HeatmapLevelStyles = readonly [
|
|
21
|
+
HeatmapLevelStyle,
|
|
22
|
+
HeatmapLevelStyle,
|
|
23
|
+
HeatmapLevelStyle,
|
|
24
|
+
HeatmapLevelStyle,
|
|
25
|
+
HeatmapLevelStyle
|
|
26
|
+
];
|
|
27
|
+
export declare const HEATMAP_DEFAULT_LEVEL_STYLES: readonly [{
|
|
28
|
+
readonly color: "var(--chart-scale-01)";
|
|
29
|
+
readonly fillMode: "solid";
|
|
30
|
+
readonly pattern: "none";
|
|
31
|
+
}, {
|
|
32
|
+
readonly color: "var(--chart-scale-02)";
|
|
33
|
+
readonly fillMode: "solid";
|
|
34
|
+
readonly pattern: "none";
|
|
35
|
+
}, {
|
|
36
|
+
readonly color: "var(--chart-scale-03)";
|
|
37
|
+
readonly fillMode: "solid";
|
|
38
|
+
readonly pattern: "none";
|
|
39
|
+
}, {
|
|
40
|
+
readonly color: "var(--chart-scale-04)";
|
|
41
|
+
readonly fillMode: "solid";
|
|
42
|
+
readonly pattern: "none";
|
|
43
|
+
}, {
|
|
44
|
+
readonly color: "var(--chart-scale-05)";
|
|
45
|
+
readonly fillMode: "solid";
|
|
46
|
+
readonly pattern: "none";
|
|
47
|
+
}];
|
|
48
|
+
export declare function heatmapLevelPatternId(level: number): string;
|
|
49
|
+
export declare function isHeatmapLevelPattern(style: HeatmapLevelStyle): boolean;
|
|
50
|
+
export declare function heatmapPatternStrokeFallback(color: string): string;
|
|
51
|
+
export declare function heatmapLevelPatternRenderOptions(style: HeatmapLevelStyle): {
|
|
52
|
+
color: string;
|
|
53
|
+
tileBackground: string;
|
|
54
|
+
scale: number;
|
|
55
|
+
strokeWidth: number | undefined;
|
|
56
|
+
radius: number | undefined;
|
|
57
|
+
complement: boolean | undefined;
|
|
58
|
+
fill: string | undefined;
|
|
59
|
+
dotFill: boolean | undefined;
|
|
60
|
+
};
|
|
61
|
+
export declare function heatmapLevelCellFillOpacity(style: HeatmapLevelStyle): number;
|
|
62
|
+
export declare function levelColorsFromStyles(levelStyles: HeatmapLevelStyles): HeatmapLevelColors;
|
|
63
|
+
export declare function levelStylesFromColors(levelColors: HeatmapLevelColors): HeatmapLevelStyles;
|
|
64
|
+
export declare function resolveHeatmapLevelStyles(levelColors?: HeatmapLevelColors, levelStyles?: HeatmapLevelStyles): HeatmapLevelStyles;
|
|
65
|
+
export declare function buildHeatmapColorScale(levelColors: HeatmapLevelColors): (count: number | null | undefined) => string;
|
|
66
|
+
export declare function buildHeatmapColorScaleFromStyles(levelStyles: HeatmapLevelStyles): (count: number | null | undefined) => string;
|
|
67
|
+
export declare function buildHeatmapFillScale(levelStyles: HeatmapLevelStyles): (count: number | null | undefined) => string;
|
|
68
|
+
export declare const defaultHeatmapColorScale: (count: number | null | undefined) => string;
|
|
69
|
+
export declare const defaultHeatmapFillScale: (count: number | null | undefined) => string;
|
|
70
|
+
//# sourceMappingURL=heatmap-colors.d.ts.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { CHART_SCALE_VARS } from "../chart-scale.js";
|
|
2
|
+
import { getHeatmapContributionLevel } from "./heatmap-utils.js";
|
|
3
|
+
/** Default Less → More scale using {@link CHART_SCALE_VARS}. */
|
|
4
|
+
export const HEATMAP_DEFAULT_LEVEL_COLORS = CHART_SCALE_VARS;
|
|
5
|
+
export const HEATMAP_DEFAULT_LEVEL_STYLES = [
|
|
6
|
+
{
|
|
7
|
+
color: HEATMAP_DEFAULT_LEVEL_COLORS[0],
|
|
8
|
+
fillMode: "solid",
|
|
9
|
+
pattern: "none",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
color: HEATMAP_DEFAULT_LEVEL_COLORS[1],
|
|
13
|
+
fillMode: "solid",
|
|
14
|
+
pattern: "none",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
color: HEATMAP_DEFAULT_LEVEL_COLORS[2],
|
|
18
|
+
fillMode: "solid",
|
|
19
|
+
pattern: "none",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
color: HEATMAP_DEFAULT_LEVEL_COLORS[3],
|
|
23
|
+
fillMode: "solid",
|
|
24
|
+
pattern: "none",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
color: HEATMAP_DEFAULT_LEVEL_COLORS[4],
|
|
28
|
+
fillMode: "solid",
|
|
29
|
+
pattern: "none",
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
export function heatmapLevelPatternId(level) {
|
|
33
|
+
return `heatmap-level-${level}`;
|
|
34
|
+
}
|
|
35
|
+
export function isHeatmapLevelPattern(style) {
|
|
36
|
+
return style.fillMode === "pattern" && style.pattern != null && style.pattern !== "none";
|
|
37
|
+
}
|
|
38
|
+
export function heatmapPatternStrokeFallback(color) {
|
|
39
|
+
return `color-mix(in oklch, ${color} 45%, white)`;
|
|
40
|
+
}
|
|
41
|
+
export function heatmapLevelPatternRenderOptions(style) {
|
|
42
|
+
const preset = style.pattern ?? "diagonal";
|
|
43
|
+
let defaultScale = 1;
|
|
44
|
+
if (preset === "cross") {
|
|
45
|
+
defaultScale = 1.33;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
color: style.patternColor?.trim() ||
|
|
49
|
+
(preset === "accent" ? "#e879f9" : heatmapPatternStrokeFallback(style.color)),
|
|
50
|
+
tileBackground: style.patternTileBackground?.trim() || style.color,
|
|
51
|
+
scale: style.patternScale ?? defaultScale,
|
|
52
|
+
strokeWidth: style.patternStrokeWidth,
|
|
53
|
+
radius: style.patternRadius,
|
|
54
|
+
complement: style.patternComplement,
|
|
55
|
+
fill: style.patternFill?.trim() || undefined,
|
|
56
|
+
dotFill: style.patternDotsFill,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function heatmapLevelCellFillOpacity(style) {
|
|
60
|
+
if (!isHeatmapLevelPattern(style)) {
|
|
61
|
+
return 1;
|
|
62
|
+
}
|
|
63
|
+
return style.patternOpacity ?? 1;
|
|
64
|
+
}
|
|
65
|
+
export function levelColorsFromStyles(levelStyles) {
|
|
66
|
+
return [
|
|
67
|
+
levelStyles[0].color,
|
|
68
|
+
levelStyles[1].color,
|
|
69
|
+
levelStyles[2].color,
|
|
70
|
+
levelStyles[3].color,
|
|
71
|
+
levelStyles[4].color,
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
export function levelStylesFromColors(levelColors) {
|
|
75
|
+
return [
|
|
76
|
+
{ color: levelColors[0], fillMode: "solid", pattern: "none" },
|
|
77
|
+
{ color: levelColors[1], fillMode: "solid", pattern: "none" },
|
|
78
|
+
{ color: levelColors[2], fillMode: "solid", pattern: "none" },
|
|
79
|
+
{ color: levelColors[3], fillMode: "solid", pattern: "none" },
|
|
80
|
+
{ color: levelColors[4], fillMode: "solid", pattern: "none" },
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
export function resolveHeatmapLevelStyles(levelColors, levelStyles) {
|
|
84
|
+
if (levelStyles) {
|
|
85
|
+
return levelStyles;
|
|
86
|
+
}
|
|
87
|
+
if (levelColors) {
|
|
88
|
+
return levelStylesFromColors(levelColors);
|
|
89
|
+
}
|
|
90
|
+
return HEATMAP_DEFAULT_LEVEL_STYLES;
|
|
91
|
+
}
|
|
92
|
+
export function buildHeatmapColorScale(levelColors) {
|
|
93
|
+
return buildHeatmapColorScaleFromStyles(levelStylesFromColors(levelColors));
|
|
94
|
+
}
|
|
95
|
+
export function buildHeatmapColorScaleFromStyles(levelStyles) {
|
|
96
|
+
return (count) => {
|
|
97
|
+
const level = getHeatmapContributionLevel(count ?? 0);
|
|
98
|
+
return levelStyles[level]?.color ?? levelStyles[0].color;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export function buildHeatmapFillScale(levelStyles) {
|
|
102
|
+
return (count) => {
|
|
103
|
+
const level = getHeatmapContributionLevel(count ?? 0);
|
|
104
|
+
const style = levelStyles[level] ?? levelStyles[0];
|
|
105
|
+
if (isHeatmapLevelPattern(style)) {
|
|
106
|
+
return `url(#${heatmapLevelPatternId(level)})`;
|
|
107
|
+
}
|
|
108
|
+
return style.color;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export const defaultHeatmapColorScale = buildHeatmapColorScale(HEATMAP_DEFAULT_LEVEL_COLORS);
|
|
112
|
+
export const defaultHeatmapFillScale = buildHeatmapFillScale(HEATMAP_DEFAULT_LEVEL_STYLES);
|
|
113
|
+
//# sourceMappingURL=heatmap-colors.js.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { scaleLinear, scaleTime } from "@visx/scale";
|
|
2
|
+
import type { Transition } from "motion/react";
|
|
3
|
+
import { type Dispatch, type ReactNode, type RefObject, type SetStateAction } from "react";
|
|
4
|
+
import type { Margin } from "../chart-context.js";
|
|
5
|
+
import type { ChartPhase, ChartStatus } from "../chart-phase.js";
|
|
6
|
+
import { type HeatmapLevelStyles } from "./heatmap-colors.js";
|
|
7
|
+
import type { HeatmapSeparatorLayout, HeatmapWeekStartDay } from "./heatmap-utils.js";
|
|
8
|
+
type HeatmapTimeScale = ReturnType<typeof scaleTime<number>>;
|
|
9
|
+
type HeatmapLinearScale = ReturnType<typeof scaleLinear<number>>;
|
|
10
|
+
export interface HeatmapBin {
|
|
11
|
+
count: number;
|
|
12
|
+
bin: number;
|
|
13
|
+
date: Date;
|
|
14
|
+
}
|
|
15
|
+
export interface HeatmapColumn {
|
|
16
|
+
bin: number;
|
|
17
|
+
bins: HeatmapBin[];
|
|
18
|
+
}
|
|
19
|
+
export interface HeatmapTooltipData {
|
|
20
|
+
column: number;
|
|
21
|
+
row: number;
|
|
22
|
+
count: number;
|
|
23
|
+
date: Date;
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}
|
|
27
|
+
export interface HeatmapInteractionContextValue {
|
|
28
|
+
hoveredCell: {
|
|
29
|
+
column: number;
|
|
30
|
+
row: number;
|
|
31
|
+
} | null;
|
|
32
|
+
hoveredLegendLevel: number | null;
|
|
33
|
+
tooltipData: HeatmapTooltipData | null;
|
|
34
|
+
setHoveredCell: (cell: {
|
|
35
|
+
column: number;
|
|
36
|
+
row: number;
|
|
37
|
+
} | null) => void;
|
|
38
|
+
setHoveredLegendLevel: (level: number | null) => void;
|
|
39
|
+
setTooltipData: Dispatch<SetStateAction<HeatmapTooltipData | null>>;
|
|
40
|
+
clearInteraction: () => void;
|
|
41
|
+
}
|
|
42
|
+
export interface HeatmapContextValue {
|
|
43
|
+
data: HeatmapColumn[];
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
innerWidth: number;
|
|
47
|
+
innerHeight: number;
|
|
48
|
+
margin: Margin;
|
|
49
|
+
binWidth: number;
|
|
50
|
+
binHeight: number;
|
|
51
|
+
gap: number;
|
|
52
|
+
weekStartDay: HeatmapWeekStartDay;
|
|
53
|
+
xScale: (columnIndex: number) => number;
|
|
54
|
+
yScale: (rowIndex: number) => number;
|
|
55
|
+
separatorLayout: HeatmapSeparatorLayout | null;
|
|
56
|
+
timeXScale: HeatmapTimeScale;
|
|
57
|
+
brushYScale: HeatmapLinearScale;
|
|
58
|
+
isReady: boolean;
|
|
59
|
+
colorScale: (count: number | null | undefined) => string;
|
|
60
|
+
fillScale: (count: number | null | undefined) => string;
|
|
61
|
+
levelStyles: HeatmapLevelStyles;
|
|
62
|
+
containerRef: RefObject<HTMLDivElement | null>;
|
|
63
|
+
chartStatus: ChartStatus;
|
|
64
|
+
chartPhase: ChartPhase;
|
|
65
|
+
isLoaded: boolean;
|
|
66
|
+
revealEpoch: number;
|
|
67
|
+
animationDuration: number;
|
|
68
|
+
enterTransition?: Transition;
|
|
69
|
+
enterStaggerScale: number;
|
|
70
|
+
animateCells: boolean;
|
|
71
|
+
loadingOpacity: number;
|
|
72
|
+
showLoadingCells: boolean;
|
|
73
|
+
loadingCellMaxOpacity: number;
|
|
74
|
+
loadingCellRandomness: number;
|
|
75
|
+
revealMode: HeatmapRevealMode;
|
|
76
|
+
loadingLabel?: string;
|
|
77
|
+
showLoadingLabel: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** How cells transition into view after loading or on first mount. */
|
|
80
|
+
export type HeatmapRevealMode = "enter" | "fromLoading" | null;
|
|
81
|
+
export declare function HeatmapInteractionProvider({ children }: {
|
|
82
|
+
children: ReactNode;
|
|
83
|
+
}): import("react").JSX.Element;
|
|
84
|
+
export declare function HeatmapProvider({ children, value, }: {
|
|
85
|
+
children: ReactNode;
|
|
86
|
+
value: HeatmapContextValue;
|
|
87
|
+
}): import("react").JSX.Element;
|
|
88
|
+
export declare function useHeatmap(): HeatmapContextValue;
|
|
89
|
+
export declare function useHeatmapInteraction(): HeatmapInteractionContextValue;
|
|
90
|
+
export declare function useHeatmapInteractionOptional(): HeatmapInteractionContextValue | null;
|
|
91
|
+
/** Clears hover state when the pointer leaves chart + legend. */
|
|
92
|
+
export declare function HeatmapInteractionBoundary({ children, className, }: {
|
|
93
|
+
children: ReactNode;
|
|
94
|
+
className?: string;
|
|
95
|
+
}): import("react").JSX.Element;
|
|
96
|
+
/** Nests a provider only when one is not already present upstream. */
|
|
97
|
+
export declare function HeatmapInteractionRoot({ children }: {
|
|
98
|
+
children: ReactNode;
|
|
99
|
+
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
100
|
+
/** @deprecated Use {@link HEATMAP_DEFAULT_LEVEL_COLORS} */
|
|
101
|
+
export declare const heatmapCssVars: {
|
|
102
|
+
readonly empty: "var(--chart-scale-01)";
|
|
103
|
+
readonly level1: "var(--chart-scale-02)";
|
|
104
|
+
readonly level2: "var(--chart-scale-03)";
|
|
105
|
+
readonly level3: "var(--chart-scale-04)";
|
|
106
|
+
readonly level4: "var(--chart-scale-05)";
|
|
107
|
+
};
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=heatmap-context.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useCallback, useContext, useMemo, useState, } from "react";
|
|
4
|
+
import { cn } from "../../lib/cn.js";
|
|
5
|
+
import { HEATMAP_DEFAULT_LEVEL_COLORS } from "./heatmap-colors.js";
|
|
6
|
+
const HeatmapContext = createContext(null);
|
|
7
|
+
const HeatmapInteractionContext = createContext(null);
|
|
8
|
+
export function HeatmapInteractionProvider({ children }) {
|
|
9
|
+
const [hoveredCell, setHoveredCell] = useState(null);
|
|
10
|
+
const [hoveredLegendLevel, setHoveredLegendLevel] = useState(null);
|
|
11
|
+
const [tooltipData, setTooltipData] = useState(null);
|
|
12
|
+
const clearInteraction = useCallback(() => {
|
|
13
|
+
setHoveredCell(null);
|
|
14
|
+
setHoveredLegendLevel(null);
|
|
15
|
+
setTooltipData(null);
|
|
16
|
+
}, []);
|
|
17
|
+
const value = useMemo(() => ({
|
|
18
|
+
hoveredCell,
|
|
19
|
+
hoveredLegendLevel,
|
|
20
|
+
tooltipData,
|
|
21
|
+
setHoveredCell,
|
|
22
|
+
setHoveredLegendLevel,
|
|
23
|
+
setTooltipData,
|
|
24
|
+
clearInteraction,
|
|
25
|
+
}), [clearInteraction, hoveredCell, hoveredLegendLevel, tooltipData]);
|
|
26
|
+
return (_jsx(HeatmapInteractionContext.Provider, { value: value, children: children }));
|
|
27
|
+
}
|
|
28
|
+
export function HeatmapProvider({ children, value, }) {
|
|
29
|
+
return _jsx(HeatmapContext.Provider, { value: value, children: children });
|
|
30
|
+
}
|
|
31
|
+
export function useHeatmap() {
|
|
32
|
+
const context = useContext(HeatmapContext);
|
|
33
|
+
if (!context) {
|
|
34
|
+
throw new Error("useHeatmap must be used within a HeatmapProvider");
|
|
35
|
+
}
|
|
36
|
+
return context;
|
|
37
|
+
}
|
|
38
|
+
export function useHeatmapInteraction() {
|
|
39
|
+
const context = useContext(HeatmapInteractionContext);
|
|
40
|
+
if (!context) {
|
|
41
|
+
throw new Error("useHeatmapInteraction must be used within a HeatmapInteractionProvider");
|
|
42
|
+
}
|
|
43
|
+
return context;
|
|
44
|
+
}
|
|
45
|
+
export function useHeatmapInteractionOptional() {
|
|
46
|
+
return useContext(HeatmapInteractionContext);
|
|
47
|
+
}
|
|
48
|
+
/** Clears hover state when the pointer leaves chart + legend. */
|
|
49
|
+
export function HeatmapInteractionBoundary({ children, className, }) {
|
|
50
|
+
const { clearInteraction } = useHeatmapInteraction();
|
|
51
|
+
return (_jsx("div", { className: cn("size-full min-h-0 min-w-0", className), onPointerLeave: clearInteraction, children: children }));
|
|
52
|
+
}
|
|
53
|
+
/** Nests a provider only when one is not already present upstream. */
|
|
54
|
+
export function HeatmapInteractionRoot({ children }) {
|
|
55
|
+
const existing = useContext(HeatmapInteractionContext);
|
|
56
|
+
if (existing) {
|
|
57
|
+
return children;
|
|
58
|
+
}
|
|
59
|
+
return _jsx(HeatmapInteractionProvider, { children: children });
|
|
60
|
+
}
|
|
61
|
+
/** @deprecated Use {@link HEATMAP_DEFAULT_LEVEL_COLORS} */
|
|
62
|
+
export const heatmapCssVars = {
|
|
63
|
+
empty: HEATMAP_DEFAULT_LEVEL_COLORS[0],
|
|
64
|
+
level1: HEATMAP_DEFAULT_LEVEL_COLORS[1],
|
|
65
|
+
level2: HEATMAP_DEFAULT_LEVEL_COLORS[2],
|
|
66
|
+
level3: HEATMAP_DEFAULT_LEVEL_COLORS[3],
|
|
67
|
+
level4: HEATMAP_DEFAULT_LEVEL_COLORS[4],
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=heatmap-context.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HeatmapLevelStyles } from "./heatmap-colors.js";
|
|
2
|
+
export interface HeatmapLegendGradientProps {
|
|
3
|
+
levels: readonly number[];
|
|
4
|
+
levelStyles: HeatmapLevelStyles;
|
|
5
|
+
cellSize: number;
|
|
6
|
+
gap: number;
|
|
7
|
+
cornerRadius: number;
|
|
8
|
+
gradientSpan: number;
|
|
9
|
+
highlightedLevel: number | null;
|
|
10
|
+
isDimming: boolean;
|
|
11
|
+
inactiveOpacity: number;
|
|
12
|
+
inactiveScale: number;
|
|
13
|
+
activeScale: number;
|
|
14
|
+
isInteractive: boolean;
|
|
15
|
+
onEnter: (level: number) => void;
|
|
16
|
+
onLeave: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const HeatmapLegendGradient: import("react").MemoExoticComponent<({ levels, levelStyles, cellSize, gap, cornerRadius, gradientSpan, highlightedLevel, isDimming, inactiveOpacity, inactiveScale, activeScale, isInteractive, onEnter, onLeave, }: HeatmapLegendGradientProps) => import("react").JSX.Element>;
|
|
19
|
+
export default HeatmapLegendGradient;
|
|
20
|
+
//# sourceMappingURL=heatmap-legend-gradient.d.ts.map
|