@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,595 @@
|
|
|
1
|
+
/** Calendar months shown in default one-year contribution grids. */
|
|
2
|
+
export const HEATMAP_MONTHS_ONE_YEAR = 12;
|
|
3
|
+
/** Half-year contribution grids (gallery card demos). */
|
|
4
|
+
export const HEATMAP_MONTHS_SIX = 6;
|
|
5
|
+
/** Nominal week count for one year (~52). Default data uses calendar-month math instead. */
|
|
6
|
+
export const HEATMAP_WEEKS_ONE_YEAR = 52;
|
|
7
|
+
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
8
|
+
const MS_PER_WEEK = MS_PER_DAY * 7;
|
|
9
|
+
export function getHeatmapCalendarRangeStart(today, months) {
|
|
10
|
+
const monthOffset = months === HEATMAP_MONTHS_SIX ? months : months - 1;
|
|
11
|
+
const start = new Date(today.getFullYear(), today.getMonth() - monthOffset, 1);
|
|
12
|
+
start.setHours(0, 0, 0, 0);
|
|
13
|
+
return start;
|
|
14
|
+
}
|
|
15
|
+
export function getHeatmapYearStartMonth(today) {
|
|
16
|
+
return getHeatmapCalendarRangeStart(today, HEATMAP_MONTHS_ONE_YEAR);
|
|
17
|
+
}
|
|
18
|
+
export function getHeatmapWeekStartSunday(date) {
|
|
19
|
+
const sunday = new Date(date);
|
|
20
|
+
sunday.setDate(sunday.getDate() - sunday.getDay());
|
|
21
|
+
sunday.setHours(0, 0, 0, 0);
|
|
22
|
+
return sunday;
|
|
23
|
+
}
|
|
24
|
+
export function getHeatmapWeekCount(startSunday, endDate) {
|
|
25
|
+
const endSunday = getHeatmapWeekStartSunday(endDate);
|
|
26
|
+
return Math.floor((endSunday.getTime() - startSunday.getTime()) / MS_PER_WEEK) + 1;
|
|
27
|
+
}
|
|
28
|
+
/** Days in a Sun–Sat column on or after `threshold` (for trimming partial lead weeks). */
|
|
29
|
+
export function countHeatmapWeekDaysOnOrAfter(weekStart, threshold) {
|
|
30
|
+
const day = new Date(weekStart);
|
|
31
|
+
day.setHours(0, 0, 0, 0);
|
|
32
|
+
const cutoff = new Date(threshold);
|
|
33
|
+
cutoff.setHours(0, 0, 0, 0);
|
|
34
|
+
let count = 0;
|
|
35
|
+
for (let i = 0; i < 7; i++) {
|
|
36
|
+
if (day >= cutoff) {
|
|
37
|
+
count++;
|
|
38
|
+
}
|
|
39
|
+
day.setDate(day.getDate() + 1);
|
|
40
|
+
}
|
|
41
|
+
return count;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* First Sunday week column where enough days fall on/after `rangeStart`.
|
|
45
|
+
* Skips a lead week that is mostly before the range (e.g. late July before Aug 1).
|
|
46
|
+
*/
|
|
47
|
+
export function getHeatmapWeekStartAlignedToRange(rangeStart, minDaysInFirstWeek = 4) {
|
|
48
|
+
const startDate = getHeatmapWeekStartSunday(rangeStart);
|
|
49
|
+
const weekEnd = new Date(startDate);
|
|
50
|
+
weekEnd.setDate(weekEnd.getDate() + 6);
|
|
51
|
+
// Keep the Sun–Sat column that contains the 1st (e.g. Jan 1 in a partial lead week).
|
|
52
|
+
if (rangeStart >= startDate && rangeStart <= weekEnd) {
|
|
53
|
+
return startDate;
|
|
54
|
+
}
|
|
55
|
+
while (countHeatmapWeekDaysOnOrAfter(startDate, rangeStart) < minDaysInFirstWeek) {
|
|
56
|
+
startDate.setDate(startDate.getDate() + 7);
|
|
57
|
+
}
|
|
58
|
+
return startDate;
|
|
59
|
+
}
|
|
60
|
+
/** Column index for a month label — snaps to separator group start when layout is set. */
|
|
61
|
+
export function getHeatmapMonthLabelColumnIndex(columnIndex, separatorLayout) {
|
|
62
|
+
if (!separatorLayout?.atColumns.length) {
|
|
63
|
+
return columnIndex;
|
|
64
|
+
}
|
|
65
|
+
return getHeatmapSeparatorGroupStartColumn(columnIndex, separatorLayout.atColumns);
|
|
66
|
+
}
|
|
67
|
+
/** Default `weeks` uses 12 calendar months; other values use a rolling week window. */
|
|
68
|
+
export function resolveHeatmapWeekRange(today, weeks = HEATMAP_WEEKS_ONE_YEAR) {
|
|
69
|
+
const endDate = new Date(today);
|
|
70
|
+
endDate.setHours(0, 0, 0, 0);
|
|
71
|
+
if (weeks === HEATMAP_WEEKS_ONE_YEAR) {
|
|
72
|
+
const rangeStart = getHeatmapYearStartMonth(endDate);
|
|
73
|
+
const startDate = getHeatmapWeekStartAlignedToRange(rangeStart);
|
|
74
|
+
return {
|
|
75
|
+
startDate,
|
|
76
|
+
weekCount: getHeatmapWeekCount(startDate, endDate),
|
|
77
|
+
rangeStart,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const startDate = new Date(endDate);
|
|
81
|
+
startDate.setDate(startDate.getDate() - (weeks - 1) * 7);
|
|
82
|
+
startDate.setDate(startDate.getDate() - startDate.getDay());
|
|
83
|
+
startDate.setHours(0, 0, 0, 0);
|
|
84
|
+
return {
|
|
85
|
+
startDate,
|
|
86
|
+
weekCount: weeks,
|
|
87
|
+
rangeStart: null,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** Month label anchor for a week column — prefers the 1st, else the 1st of the first bin's month. */
|
|
91
|
+
export function getHeatmapColumnMonthAnchor(column) {
|
|
92
|
+
for (const bin of column.bins) {
|
|
93
|
+
if (bin.date && bin.date.getDate() === 1) {
|
|
94
|
+
return bin.date;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const firstDate = column.bins[0]?.date;
|
|
98
|
+
if (!firstDate) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return new Date(firstDate.getFullYear(), firstDate.getMonth(), 1);
|
|
102
|
+
}
|
|
103
|
+
export function getHeatmapColumnStartDate(column) {
|
|
104
|
+
return column.bins[0]?.date ?? null;
|
|
105
|
+
}
|
|
106
|
+
export function getHeatmapColumnEndDate(column) {
|
|
107
|
+
const lastBin = column.bins.at(-1);
|
|
108
|
+
return lastBin?.date ?? null;
|
|
109
|
+
}
|
|
110
|
+
export function getHeatmapTimeExtent(columns) {
|
|
111
|
+
if (columns.length === 0) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const firstColumn = columns[0];
|
|
115
|
+
if (!firstColumn) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
const start = getHeatmapColumnStartDate(firstColumn);
|
|
119
|
+
const lastColumn = columns.at(-1);
|
|
120
|
+
if (!lastColumn) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
const end = getHeatmapColumnEndDate(lastColumn);
|
|
124
|
+
if (!(start && end)) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
return [start, end];
|
|
128
|
+
}
|
|
129
|
+
export function filterHeatmapColumns(columns, xDomain) {
|
|
130
|
+
if (!xDomain) {
|
|
131
|
+
return columns;
|
|
132
|
+
}
|
|
133
|
+
const start = Math.min(xDomain[0].getTime(), xDomain[1].getTime());
|
|
134
|
+
const end = Math.max(xDomain[0].getTime(), xDomain[1].getTime());
|
|
135
|
+
return columns.filter((column) => {
|
|
136
|
+
const weekStart = getHeatmapColumnStartDate(column)?.getTime();
|
|
137
|
+
const weekEnd = getHeatmapColumnEndDate(column)?.getTime();
|
|
138
|
+
if (weekStart == null || weekEnd == null) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return weekEnd >= start && weekStart <= end;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
const heatmapTooltipMonthFmt = new Intl.DateTimeFormat("en-US", {
|
|
145
|
+
month: "long",
|
|
146
|
+
});
|
|
147
|
+
const heatmapTooltipWeekdayFmt = new Intl.DateTimeFormat("en-US", {
|
|
148
|
+
weekday: "long",
|
|
149
|
+
});
|
|
150
|
+
function formatHeatmapOrdinalDay(day) {
|
|
151
|
+
if (day >= 11 && day <= 13) {
|
|
152
|
+
return `${day}th`;
|
|
153
|
+
}
|
|
154
|
+
switch (day % 10) {
|
|
155
|
+
case 1:
|
|
156
|
+
return `${day}st`;
|
|
157
|
+
case 2:
|
|
158
|
+
return `${day}nd`;
|
|
159
|
+
case 3:
|
|
160
|
+
return `${day}rd`;
|
|
161
|
+
default:
|
|
162
|
+
return `${day}th`;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** Tooltip header date — e.g. `January 20th 2026`. */
|
|
166
|
+
export function formatHeatmapTooltipDate(date) {
|
|
167
|
+
const month = heatmapTooltipMonthFmt.format(date);
|
|
168
|
+
const day = formatHeatmapOrdinalDay(date.getDate());
|
|
169
|
+
return `${month} ${day} ${date.getFullYear()}`;
|
|
170
|
+
}
|
|
171
|
+
/** Tooltip weekday line — e.g. `Monday`. */
|
|
172
|
+
export function formatHeatmapTooltipWeekday(date) {
|
|
173
|
+
return heatmapTooltipWeekdayFmt.format(date);
|
|
174
|
+
}
|
|
175
|
+
/** Tooltip contribution line — e.g. `3 contributions`. */
|
|
176
|
+
export function formatHeatmapContributionLabel(count, _date) {
|
|
177
|
+
const word = count === 1 ? "contribution" : "contributions";
|
|
178
|
+
return `${count} ${word}`;
|
|
179
|
+
}
|
|
180
|
+
/** Sunday-first day labels for heatmap row bins. */
|
|
181
|
+
export const HEATMAP_DAY_LABELS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
182
|
+
/** Day labels with row 0 aligned to `weekStartDay`. */
|
|
183
|
+
export function getHeatmapDayLabels(weekStartDay = 0) {
|
|
184
|
+
if (weekStartDay === 0) {
|
|
185
|
+
return HEATMAP_DAY_LABELS;
|
|
186
|
+
}
|
|
187
|
+
return [...HEATMAP_DAY_LABELS.slice(weekStartDay), ...HEATMAP_DAY_LABELS.slice(0, weekStartDay)];
|
|
188
|
+
}
|
|
189
|
+
/** Rotates Sun-first column bins so display row 0 starts on `weekStartDay`. */
|
|
190
|
+
export function rotateHeatmapColumnBins(columns, weekStartDay = 0) {
|
|
191
|
+
if (weekStartDay === 0) {
|
|
192
|
+
return columns;
|
|
193
|
+
}
|
|
194
|
+
return columns.map((column) => ({
|
|
195
|
+
...column,
|
|
196
|
+
bins: [...column.bins.slice(weekStartDay), ...column.bins.slice(0, weekStartDay)],
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
export function formatHeatmapYAxisLabel(label, labelFormat) {
|
|
200
|
+
return labelFormat === "initial" ? label.charAt(0) : label;
|
|
201
|
+
}
|
|
202
|
+
export function shouldShowHeatmapYAxisTick(row, tickFilter) {
|
|
203
|
+
switch (tickFilter) {
|
|
204
|
+
case "all":
|
|
205
|
+
return true;
|
|
206
|
+
case "odd":
|
|
207
|
+
return row % 2 === 1;
|
|
208
|
+
case "even":
|
|
209
|
+
return row % 2 === 0;
|
|
210
|
+
default:
|
|
211
|
+
return row % 2 === 1;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/** Builds SVG gradient stops for a vertical separator line. */
|
|
215
|
+
export function buildHeatmapSeparatorGradientStops(gradient, strokeOpacity = 1) {
|
|
216
|
+
const scaleOpacity = (value, fallback = 1) => (value ?? fallback) * strokeOpacity;
|
|
217
|
+
if (gradient.via != null) {
|
|
218
|
+
return [
|
|
219
|
+
{
|
|
220
|
+
offset: "0%",
|
|
221
|
+
color: gradient.from,
|
|
222
|
+
opacity: scaleOpacity(gradient.fromOpacity),
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
offset: "50%",
|
|
226
|
+
color: gradient.via,
|
|
227
|
+
opacity: scaleOpacity(gradient.viaOpacity),
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
offset: "100%",
|
|
231
|
+
color: gradient.to,
|
|
232
|
+
opacity: scaleOpacity(gradient.toOpacity),
|
|
233
|
+
},
|
|
234
|
+
];
|
|
235
|
+
}
|
|
236
|
+
return [
|
|
237
|
+
{
|
|
238
|
+
offset: "0%",
|
|
239
|
+
color: gradient.from,
|
|
240
|
+
opacity: scaleOpacity(gradient.fromOpacity),
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
offset: "100%",
|
|
244
|
+
color: gradient.to,
|
|
245
|
+
opacity: scaleOpacity(gradient.toOpacity),
|
|
246
|
+
},
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
export function resolveHeatmapSeparatorStrokeDasharray(strokeStyle = "solid", strokeDasharray) {
|
|
250
|
+
if (strokeStyle !== "dashed") {
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
return strokeDasharray ?? "4,4";
|
|
254
|
+
}
|
|
255
|
+
/** Calendar quarter (1–4) for Jan–Mar, Apr–Jun, Jul–Sep, Oct–Dec. */
|
|
256
|
+
export function getCalendarQuarter(date) {
|
|
257
|
+
return Math.floor(date.getMonth() / 3) + 1;
|
|
258
|
+
}
|
|
259
|
+
const CALENDAR_QUARTER_START_MONTHS = [0, 3, 6, 9];
|
|
260
|
+
/** Jan/Apr/Jul/Oct 1 dates strictly after `gridStart` and on or before `gridEnd`. */
|
|
261
|
+
export function getCalendarQuarterStartDatesBetween(gridStart, gridEnd) {
|
|
262
|
+
const startTime = gridStart.getTime();
|
|
263
|
+
const endTime = gridEnd.getTime();
|
|
264
|
+
const dates = [];
|
|
265
|
+
for (let year = gridStart.getFullYear(); year <= gridEnd.getFullYear(); year++) {
|
|
266
|
+
for (const month of CALENDAR_QUARTER_START_MONTHS) {
|
|
267
|
+
const date = new Date(year, month, 1);
|
|
268
|
+
date.setHours(0, 0, 0, 0);
|
|
269
|
+
const time = date.getTime();
|
|
270
|
+
if (time > startTime && time <= endTime) {
|
|
271
|
+
dates.push(date);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return dates;
|
|
276
|
+
}
|
|
277
|
+
/** Week column index whose Sun–Sat span contains `date`. */
|
|
278
|
+
export function findHeatmapColumnIndexForDate(columns, date) {
|
|
279
|
+
const target = new Date(date);
|
|
280
|
+
target.setHours(0, 0, 0, 0);
|
|
281
|
+
const targetTime = target.getTime();
|
|
282
|
+
for (let columnIndex = 0; columnIndex < columns.length; columnIndex++) {
|
|
283
|
+
const column = columns[columnIndex];
|
|
284
|
+
if (!column) {
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
const weekStart = getHeatmapColumnStartDate(column);
|
|
288
|
+
const weekEnd = getHeatmapColumnEndDate(column);
|
|
289
|
+
if (!(weekStart && weekEnd)) {
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
weekStart.setHours(0, 0, 0, 0);
|
|
293
|
+
weekEnd.setHours(0, 0, 0, 0);
|
|
294
|
+
if (targetTime >= weekStart.getTime() && targetTime <= weekEnd.getTime()) {
|
|
295
|
+
return columnIndex;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
/** Quarter anchor for a week column — prefers the 1st of a quarter month, else the quarter of the first bin. */
|
|
301
|
+
export function getHeatmapColumnQuarterAnchor(column) {
|
|
302
|
+
for (const bin of column.bins) {
|
|
303
|
+
if (!bin.date) {
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
const month = bin.date.getMonth();
|
|
307
|
+
if (bin.date.getDate() === 1 && month % 3 === 0) {
|
|
308
|
+
return {
|
|
309
|
+
quarter: month / 3 + 1,
|
|
310
|
+
year: bin.date.getFullYear(),
|
|
311
|
+
date: bin.date,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
const firstDate = column.bins[0]?.date;
|
|
316
|
+
if (!firstDate) {
|
|
317
|
+
return null;
|
|
318
|
+
}
|
|
319
|
+
const quarter = getCalendarQuarter(firstDate);
|
|
320
|
+
return {
|
|
321
|
+
quarter,
|
|
322
|
+
year: firstDate.getFullYear(),
|
|
323
|
+
date: new Date(firstDate.getFullYear(), (quarter - 1) * 3, 1),
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/** Label column snapped to the start of a separator group. */
|
|
327
|
+
export function getHeatmapSeparatorGroupStartColumn(columnIndex, atColumns) {
|
|
328
|
+
let groupStart = 0;
|
|
329
|
+
for (const start of atColumns) {
|
|
330
|
+
if (start <= columnIndex) {
|
|
331
|
+
groupStart = start;
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return groupStart;
|
|
338
|
+
}
|
|
339
|
+
/** Column indices (0-based) where a vertical separator is drawn (fixed interval). */
|
|
340
|
+
export function getHeatmapSeparatorColumnIndices(columnCount, every) {
|
|
341
|
+
if (every <= 0 || columnCount <= every) {
|
|
342
|
+
return [];
|
|
343
|
+
}
|
|
344
|
+
const indices = [];
|
|
345
|
+
for (let columnIndex = every; columnIndex < columnCount; columnIndex += every) {
|
|
346
|
+
indices.push(columnIndex);
|
|
347
|
+
}
|
|
348
|
+
return indices;
|
|
349
|
+
}
|
|
350
|
+
/** Matches demo-style calendar grids to their range start (Jan 1, etc.). */
|
|
351
|
+
export function inferHeatmapCalendarRangeStart(columns) {
|
|
352
|
+
const firstColumn = columns[0];
|
|
353
|
+
if (!firstColumn) {
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
const gridStart = getHeatmapColumnStartDate(firstColumn);
|
|
357
|
+
if (!gridStart) {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
const today = new Date();
|
|
361
|
+
today.setHours(0, 0, 0, 0);
|
|
362
|
+
for (const months of [HEATMAP_MONTHS_SIX, HEATMAP_MONTHS_ONE_YEAR]) {
|
|
363
|
+
const rangeStart = getHeatmapCalendarRangeStart(today, months);
|
|
364
|
+
const alignedStart = getHeatmapWeekStartAlignedToRange(rangeStart);
|
|
365
|
+
if (gridStart.getTime() === alignedStart.getTime()) {
|
|
366
|
+
return rangeStart;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
export function buildHeatmapQuarterSeparatorGroups(columns) {
|
|
372
|
+
if (columns.length === 0) {
|
|
373
|
+
return [];
|
|
374
|
+
}
|
|
375
|
+
const extent = getHeatmapTimeExtent(columns);
|
|
376
|
+
if (!extent) {
|
|
377
|
+
return [];
|
|
378
|
+
}
|
|
379
|
+
const [extentStart, gridEnd] = extent;
|
|
380
|
+
const displayRange = resolveHeatmapDisplayRange(columns);
|
|
381
|
+
const quarterRangeStart = displayRange.start ?? inferHeatmapCalendarRangeStart(columns) ?? extentStart;
|
|
382
|
+
const firstQuarter = getCalendarQuarter(quarterRangeStart);
|
|
383
|
+
const groups = [
|
|
384
|
+
{
|
|
385
|
+
startColumnIndex: 0,
|
|
386
|
+
quarter: firstQuarter,
|
|
387
|
+
year: quarterRangeStart.getFullYear(),
|
|
388
|
+
startDate: quarterRangeStart,
|
|
389
|
+
label: `Q${firstQuarter}`,
|
|
390
|
+
},
|
|
391
|
+
];
|
|
392
|
+
const usedColumns = new Set([0]);
|
|
393
|
+
const quarterStarts = getCalendarQuarterStartDatesBetween(quarterRangeStart, gridEnd);
|
|
394
|
+
for (const quarterStart of quarterStarts) {
|
|
395
|
+
const columnIndex = findHeatmapColumnIndexForDate(columns, quarterStart);
|
|
396
|
+
if (columnIndex == null || columnIndex === 0 || usedColumns.has(columnIndex)) {
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
usedColumns.add(columnIndex);
|
|
400
|
+
const quarter = getCalendarQuarter(quarterStart);
|
|
401
|
+
groups.push({
|
|
402
|
+
startColumnIndex: columnIndex,
|
|
403
|
+
quarter,
|
|
404
|
+
year: quarterStart.getFullYear(),
|
|
405
|
+
startDate: quarterStart,
|
|
406
|
+
label: `Q${quarter}`,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
groups.sort((a, b) => a.startColumnIndex - b.startColumnIndex);
|
|
410
|
+
return groups;
|
|
411
|
+
}
|
|
412
|
+
export function resolveHeatmapSeparatorLayout(config, columns) {
|
|
413
|
+
if (!config) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
if (config.groupBy === "quarter") {
|
|
417
|
+
const groups = buildHeatmapQuarterSeparatorGroups(columns);
|
|
418
|
+
if (groups.length === 0) {
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
return {
|
|
422
|
+
spacing: config.spacing,
|
|
423
|
+
atColumns: groups
|
|
424
|
+
.map((group) => group.startColumnIndex)
|
|
425
|
+
.filter((columnIndex) => columnIndex > 0),
|
|
426
|
+
groups,
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
if (!config.every || config.every <= 0) {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
const atColumns = getHeatmapSeparatorColumnIndices(columns.length, config.every);
|
|
433
|
+
return {
|
|
434
|
+
spacing: config.spacing,
|
|
435
|
+
atColumns,
|
|
436
|
+
groups: [],
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
export function getHeatmapSeparatorCount(separator) {
|
|
440
|
+
return separator?.atColumns.length ?? 0;
|
|
441
|
+
}
|
|
442
|
+
/** Extra x-offset for a column when separator spacing is enabled. */
|
|
443
|
+
export function getHeatmapColumnXOffset(columnIndex, separator) {
|
|
444
|
+
if (!separator || separator.spacing <= 0) {
|
|
445
|
+
return 0;
|
|
446
|
+
}
|
|
447
|
+
if (columnIndex <= 0) {
|
|
448
|
+
return 0;
|
|
449
|
+
}
|
|
450
|
+
const separatorCount = separator.atColumns.filter((atColumn) => atColumn <= columnIndex).length;
|
|
451
|
+
return separatorCount * separator.spacing;
|
|
452
|
+
}
|
|
453
|
+
export function getHeatmapPlotInnerWidth(columnCount, binWidth, separator) {
|
|
454
|
+
const separatorCount = separator ? getHeatmapSeparatorCount(separator) : 0;
|
|
455
|
+
return columnCount * binWidth + separatorCount * (separator?.spacing ?? 0);
|
|
456
|
+
}
|
|
457
|
+
/** Vertical span for a separator line in plot coordinates. */
|
|
458
|
+
export function getHeatmapSeparatorLineY({ innerHeight, marginTop, startOffset, paddingY = 0, }) {
|
|
459
|
+
const resolvedStart = startOffset ?? marginTop;
|
|
460
|
+
const y1 = resolvedStart - marginTop + paddingY;
|
|
461
|
+
const y2 = Math.max(innerHeight - paddingY, y1);
|
|
462
|
+
return { y1, y2 };
|
|
463
|
+
}
|
|
464
|
+
/** X position for a separator line (centered in the gutter when spacing > 0). */
|
|
465
|
+
export function getHeatmapSeparatorX(columnIndex, gap, separator, xScale) {
|
|
466
|
+
if (separator.spacing > 0) {
|
|
467
|
+
return xScale(columnIndex) - separator.spacing / 2;
|
|
468
|
+
}
|
|
469
|
+
return xScale(columnIndex) - gap / 2;
|
|
470
|
+
}
|
|
471
|
+
/** Whether a bin falls outside the contribution display window (not merely inactive). */
|
|
472
|
+
export function isHeatmapGhostBin(bin, range) {
|
|
473
|
+
const time = bin.date.getTime();
|
|
474
|
+
if (range.end && time > range.end.getTime()) {
|
|
475
|
+
return true;
|
|
476
|
+
}
|
|
477
|
+
if (range.start && time < range.start.getTime()) {
|
|
478
|
+
return true;
|
|
479
|
+
}
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Infers GitHub-style display range for calendar-month contribution grids.
|
|
484
|
+
* Custom data that does not match a known grid shape returns null bounds (show all).
|
|
485
|
+
*/
|
|
486
|
+
export function resolveHeatmapDisplayRange(columns) {
|
|
487
|
+
if (columns.length === 0) {
|
|
488
|
+
return { start: null, end: null };
|
|
489
|
+
}
|
|
490
|
+
const extent = getHeatmapTimeExtent(columns);
|
|
491
|
+
if (!extent) {
|
|
492
|
+
return { start: null, end: null };
|
|
493
|
+
}
|
|
494
|
+
const today = new Date();
|
|
495
|
+
today.setHours(0, 0, 0, 0);
|
|
496
|
+
const firstColumn = columns[0];
|
|
497
|
+
if (!firstColumn) {
|
|
498
|
+
return { start: null, end: null };
|
|
499
|
+
}
|
|
500
|
+
const gridStart = getHeatmapColumnStartDate(firstColumn);
|
|
501
|
+
if (!gridStart) {
|
|
502
|
+
return { start: null, end: null };
|
|
503
|
+
}
|
|
504
|
+
const inferredStart = inferHeatmapCalendarRangeStart(columns);
|
|
505
|
+
if (inferredStart && extent[1].getTime() >= today.getTime()) {
|
|
506
|
+
return { start: inferredStart, end: today };
|
|
507
|
+
}
|
|
508
|
+
return { start: null, end: null };
|
|
509
|
+
}
|
|
510
|
+
/** Maps a contribution count to the GitHub-style legend level (0–4). */
|
|
511
|
+
export function getHeatmapContributionLevel(count) {
|
|
512
|
+
if (count <= 0) {
|
|
513
|
+
return 0;
|
|
514
|
+
}
|
|
515
|
+
if (count === 1) {
|
|
516
|
+
return 1;
|
|
517
|
+
}
|
|
518
|
+
if (count === 2) {
|
|
519
|
+
return 2;
|
|
520
|
+
}
|
|
521
|
+
if (count === 3) {
|
|
522
|
+
return 3;
|
|
523
|
+
}
|
|
524
|
+
return 4;
|
|
525
|
+
}
|
|
526
|
+
/** Whether hover styling runs (disabled when all scale/opacity props are 1). */
|
|
527
|
+
export function isHeatmapHoverEffectEnabled(params) {
|
|
528
|
+
return params.inactiveOpacity !== 1 || params.inactiveScale !== 1 || params.activeScale !== 1;
|
|
529
|
+
}
|
|
530
|
+
/** Whether inactive hover styling runs (disabled when both props are 1). */
|
|
531
|
+
export function isHeatmapInactiveEffectEnabled(inactiveOpacity, inactiveScale) {
|
|
532
|
+
return isHeatmapHoverEffectEnabled({
|
|
533
|
+
inactiveOpacity,
|
|
534
|
+
inactiveScale,
|
|
535
|
+
activeScale: 1,
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
/** Opacity and scale for highlighted vs dimmed cells and legend swatches. */
|
|
539
|
+
export function resolveHeatmapHoverStyle(isHighlighted, isDimmed, params) {
|
|
540
|
+
if (isHighlighted && params.activeScale !== 1) {
|
|
541
|
+
return { opacity: 1, scale: params.activeScale };
|
|
542
|
+
}
|
|
543
|
+
if (isDimmed) {
|
|
544
|
+
return {
|
|
545
|
+
opacity: params.inactiveOpacity,
|
|
546
|
+
scale: params.inactiveScale,
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
return { opacity: 1, scale: 1 };
|
|
550
|
+
}
|
|
551
|
+
/** Opacity and scale for an inactive cell or legend swatch. */
|
|
552
|
+
export function resolveHeatmapInactiveStyle(isInactive, inactiveOpacity, inactiveScale) {
|
|
553
|
+
return resolveHeatmapHoverStyle(false, isInactive, {
|
|
554
|
+
inactiveOpacity,
|
|
555
|
+
inactiveScale,
|
|
556
|
+
activeScale: 1,
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
/** Per-row opacity multiplier for display rows (default 1). */
|
|
560
|
+
export function resolveHeatmapRowOpacity(row, rowOpacity) {
|
|
561
|
+
if (rowOpacity == null) {
|
|
562
|
+
return 1;
|
|
563
|
+
}
|
|
564
|
+
if (typeof rowOpacity === "number") {
|
|
565
|
+
return rowOpacity;
|
|
566
|
+
}
|
|
567
|
+
return rowOpacity[row] ?? 1;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Builds a per-row opacity map for {@link HeatmapCells} and {@link HeatmapYAxis}.
|
|
571
|
+
* Pass explicit row indices (e.g. `[5, 6]` for display Sat/Sun when `weekStartDay={1}`)
|
|
572
|
+
* or a predicate — `(row) => row >= 5` fades the last two rows.
|
|
573
|
+
*/
|
|
574
|
+
export function buildHeatmapRowOpacity(match, fadedOpacity = 0.35, activeOpacity = 1, rowCount = 7) {
|
|
575
|
+
if (typeof match === "function") {
|
|
576
|
+
return Array.from({ length: rowCount }, (_, row) => match(row) ? fadedOpacity : activeOpacity);
|
|
577
|
+
}
|
|
578
|
+
const opacity = new Array(rowCount).fill(activeOpacity);
|
|
579
|
+
for (const row of match) {
|
|
580
|
+
if (row >= 0 && row < rowCount) {
|
|
581
|
+
opacity[row] = fadedOpacity;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return opacity;
|
|
585
|
+
}
|
|
586
|
+
/** CSS `linear-gradient` for a continuous legend bar from level styles. */
|
|
587
|
+
export function buildHeatmapLegendGradient(levelStyles) {
|
|
588
|
+
const lastIndex = levelStyles.length - 1;
|
|
589
|
+
const stops = levelStyles.map((style, index) => {
|
|
590
|
+
const offset = lastIndex === 0 ? 0 : (index / lastIndex) * 100;
|
|
591
|
+
return `${style.color} ${offset}%`;
|
|
592
|
+
});
|
|
593
|
+
return `linear-gradient(to right, ${stops.join(", ")})`;
|
|
594
|
+
}
|
|
595
|
+
//# sourceMappingURL=heatmap-utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface HeatmapXAxisProps {
|
|
2
|
+
/** Additional class name for labels */
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const HeatmapXAxis: import("react").MemoExoticComponent<({ className }: HeatmapXAxisProps) => import("react").ReactPortal | null>;
|
|
6
|
+
export default HeatmapXAxis;
|
|
7
|
+
//# sourceMappingURL=heatmap-x-axis.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { memo, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { cn } from "../../lib/cn.js";
|
|
6
|
+
import { useHeatmap } from "./heatmap-context.js";
|
|
7
|
+
import { getHeatmapColumnMonthAnchor } from "./heatmap-utils.js";
|
|
8
|
+
const monthFmt = new Intl.DateTimeFormat("en-US", { month: "short" });
|
|
9
|
+
export const HeatmapXAxis = memo(function HeatmapXAxis({ className }) {
|
|
10
|
+
const { containerRef, data, margin, xScale } = useHeatmap();
|
|
11
|
+
const [mounted, setMounted] = useState(false);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setMounted(true);
|
|
14
|
+
}, []);
|
|
15
|
+
const labels = useMemo(() => {
|
|
16
|
+
const ticks = [];
|
|
17
|
+
let lastMonthKey = "";
|
|
18
|
+
for (let columnIndex = 0; columnIndex < data.length; columnIndex++) {
|
|
19
|
+
const column = data[columnIndex];
|
|
20
|
+
if (!column) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const monthAnchor = getHeatmapColumnMonthAnchor(column);
|
|
24
|
+
if (!monthAnchor) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const monthKey = `${monthAnchor.getFullYear()}-${monthAnchor.getMonth()}`;
|
|
28
|
+
if (monthKey === lastMonthKey) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
ticks.push({
|
|
32
|
+
label: monthFmt.format(monthAnchor),
|
|
33
|
+
x: margin.left + xScale(columnIndex),
|
|
34
|
+
key: monthKey,
|
|
35
|
+
});
|
|
36
|
+
lastMonthKey = monthKey;
|
|
37
|
+
}
|
|
38
|
+
return ticks;
|
|
39
|
+
}, [data, margin.left, xScale]);
|
|
40
|
+
const container = containerRef.current;
|
|
41
|
+
if (!(mounted && container)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return createPortal(labels.map((tick) => (_jsx("div", { className: "pointer-events-none absolute", style: {
|
|
45
|
+
top: 0,
|
|
46
|
+
left: tick.x,
|
|
47
|
+
width: 0,
|
|
48
|
+
display: "flex",
|
|
49
|
+
justifyContent: "flex-start",
|
|
50
|
+
}, children: _jsx("span", { className: cn("whitespace-nowrap text-chart-label text-xs", className), children: tick.label }) }, tick.key))), container);
|
|
51
|
+
});
|
|
52
|
+
HeatmapXAxis.displayName = "HeatmapXAxis";
|
|
53
|
+
export default HeatmapXAxis;
|
|
54
|
+
//# sourceMappingURL=heatmap-x-axis.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type HeatmapYAxisLabelFormat, type HeatmapYAxisTickFilter } from "./heatmap-utils.js";
|
|
2
|
+
export interface HeatmapYAxisProps {
|
|
3
|
+
/** Additional class name for labels */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Which row ticks to display. Default: `"odd"` (Mon / Wed / Fri). */
|
|
6
|
+
tickFilter?: HeatmapYAxisTickFilter;
|
|
7
|
+
/** Label format — `"initial"` shows the first letter only (Mon → M). Default: `"full"`. */
|
|
8
|
+
labelFormat?: HeatmapYAxisLabelFormat;
|
|
9
|
+
/** Per-row label opacity — mirrors {@link HeatmapCells} `rowOpacity`. */
|
|
10
|
+
rowOpacity?: number | readonly number[];
|
|
11
|
+
}
|
|
12
|
+
export declare const HeatmapYAxis: import("react").MemoExoticComponent<({ className, tickFilter, labelFormat, rowOpacity, }: HeatmapYAxisProps) => import("react").ReactPortal | null>;
|
|
13
|
+
export default HeatmapYAxis;
|
|
14
|
+
//# sourceMappingURL=heatmap-y-axis.d.ts.map
|