@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,125 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { ZoomIn } from "lucide-react";
|
|
5
|
+
import { forwardRef, useRef, useState, } from "react";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
const imageZoomVariants = cva(
|
|
8
|
+
// Single-style base (no variant axes yet); the exported const still keeps the
|
|
9
|
+
// frame styling centralized and the `<name>Variants` contract intact.
|
|
10
|
+
"group/image-zoom relative block w-full cursor-zoom-in select-none overflow-hidden rounded-xl border border-border bg-surface-inset outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base disabled:pointer-events-none disabled:opacity-50 data-[state=zoomed]:cursor-zoom-out");
|
|
11
|
+
const DEFAULT_LABELS = {
|
|
12
|
+
zoom: "Zoom image",
|
|
13
|
+
};
|
|
14
|
+
function clampPercent(value) {
|
|
15
|
+
return Math.min(100, Math.max(0, value));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Inline hover/press zoom for product and detail imagery. Fine pointers zoom
|
|
19
|
+
* while hovering and the pan follows the cursor via transform-origin tracking;
|
|
20
|
+
* touch, pen, and keyboard (Enter/Space) toggle a sticky zoom centered on the
|
|
21
|
+
* last point (or the center). The root is a toggle button whose `aria-pressed`
|
|
22
|
+
* reflects the zoom state and whose accessible name folds in the image `alt`
|
|
23
|
+
* (a button's label would otherwise swallow it). The zoom state is
|
|
24
|
+
* uncontrolled by default (`defaultZoomed`) or controlled via `zoomed` +
|
|
25
|
+
* `onZoomChange`.
|
|
26
|
+
*/
|
|
27
|
+
export const ImageZoom = forwardRef(({ src, alt = "", zoom = 2, disabled = false, showIndicator = true, labels, zoomed: zoomedProp, defaultZoomed = false, onZoomChange, className, children, onClick, onKeyDown, onPointerDown, onPointerMove, onPointerLeave, ...props }, ref) => {
|
|
28
|
+
const isControlled = zoomedProp !== undefined;
|
|
29
|
+
const [uncontrolledZoomed, setUncontrolledZoomed] = useState(defaultZoomed);
|
|
30
|
+
const zoomed = isControlled ? zoomedProp : uncontrolledZoomed;
|
|
31
|
+
// transform-origin of the zoom pan, as percentages of the frame.
|
|
32
|
+
const [origin, setOrigin] = useState({ x: 50, y: 50 });
|
|
33
|
+
// Pointer type of the press behind the upcoming click. Only consulted
|
|
34
|
+
// for pointer-driven clicks (detail > 0), which are always preceded by
|
|
35
|
+
// their own pointerdown — so an abandoned press (drag off, pointercancel)
|
|
36
|
+
// can never leave a stale value that suppresses keyboard activation.
|
|
37
|
+
const pressPointerTypeRef = useRef("");
|
|
38
|
+
const mergedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
39
|
+
// Buttons have children-presentational semantics and `aria-label`
|
|
40
|
+
// overrides name-from-content, so a meaningful `alt` would never reach
|
|
41
|
+
// assistive tech unless it is composed into the accessible name.
|
|
42
|
+
const accessibleName = alt ? `${mergedLabels.zoom}: ${alt}` : mergedLabels.zoom;
|
|
43
|
+
// Non-finite zoom (NaN/Infinity) falls back to the default instead of
|
|
44
|
+
// reaching `scale()` as an invalid value.
|
|
45
|
+
const scale = Math.max(1, Number.isFinite(zoom) ? zoom : 2);
|
|
46
|
+
const applyZoom = (next) => {
|
|
47
|
+
if (next === zoomed)
|
|
48
|
+
return;
|
|
49
|
+
if (!isControlled)
|
|
50
|
+
setUncontrolledZoomed(next);
|
|
51
|
+
onZoomChange?.(next);
|
|
52
|
+
};
|
|
53
|
+
/** Moves the transform-origin to the pointer, clamped inside the frame. */
|
|
54
|
+
const updateOrigin = (event) => {
|
|
55
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
56
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
57
|
+
return;
|
|
58
|
+
setOrigin({
|
|
59
|
+
x: clampPercent(((event.clientX - rect.left) / rect.width) * 100),
|
|
60
|
+
y: clampPercent(((event.clientY - rect.top) / rect.height) * 100),
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const handlePointerMove = (event) => {
|
|
64
|
+
onPointerMove?.(event);
|
|
65
|
+
if (disabled)
|
|
66
|
+
return;
|
|
67
|
+
updateOrigin(event);
|
|
68
|
+
// Fine pointers zoom on hover, so the pan simply follows the cursor.
|
|
69
|
+
if (event.pointerType === "mouse")
|
|
70
|
+
applyZoom(true);
|
|
71
|
+
};
|
|
72
|
+
const handlePointerLeave = (event) => {
|
|
73
|
+
onPointerLeave?.(event);
|
|
74
|
+
if (disabled)
|
|
75
|
+
return;
|
|
76
|
+
// Hover-driven zoom ends with the hover; a toggled (touch/keyboard)
|
|
77
|
+
// zoom sticks until the next activation.
|
|
78
|
+
if (event.pointerType === "mouse")
|
|
79
|
+
applyZoom(false);
|
|
80
|
+
};
|
|
81
|
+
const handlePointerDown = (event) => {
|
|
82
|
+
onPointerDown?.(event);
|
|
83
|
+
if (disabled)
|
|
84
|
+
return;
|
|
85
|
+
pressPointerTypeRef.current = event.pointerType;
|
|
86
|
+
updateOrigin(event);
|
|
87
|
+
};
|
|
88
|
+
const handleClick = (event) => {
|
|
89
|
+
onClick?.(event);
|
|
90
|
+
if (disabled)
|
|
91
|
+
return;
|
|
92
|
+
const pressPointerType = pressPointerTypeRef.current;
|
|
93
|
+
pressPointerTypeRef.current = "";
|
|
94
|
+
// Mouse zoom is hover-driven — a mouse click toggling here would fight
|
|
95
|
+
// the hover state. Touch, pen, and keyboard clicks toggle at the last
|
|
96
|
+
// recorded point (the center when none was recorded). Keyboard clicks
|
|
97
|
+
// fire with `detail === 0`, so they always toggle even when a mouse
|
|
98
|
+
// press was abandoned without producing a click.
|
|
99
|
+
if (event.detail !== 0 && pressPointerType === "mouse")
|
|
100
|
+
return;
|
|
101
|
+
applyZoom(!zoomed);
|
|
102
|
+
};
|
|
103
|
+
const handleKeyDown = (event) => {
|
|
104
|
+
onKeyDown?.(event);
|
|
105
|
+
if (disabled)
|
|
106
|
+
return;
|
|
107
|
+
if (event.key !== "Escape" || !zoomed)
|
|
108
|
+
return;
|
|
109
|
+
// Scope Escape to the active zoom so an enclosing dialog/lightbox is not
|
|
110
|
+
// dismissed by the same press; an idle Escape passes through untouched.
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
event.stopPropagation();
|
|
113
|
+
applyZoom(false);
|
|
114
|
+
};
|
|
115
|
+
return (_jsxs("button", { ref: ref, type: "button", "data-slot": "image-zoom", "data-state": zoomed ? "zoomed" : "idle", "aria-pressed": zoomed, "aria-label": accessibleName, disabled: disabled, className: cn(imageZoomVariants(), className), onClick: handleClick, onKeyDown: handleKeyDown, onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerLeave: handlePointerLeave, ...props, children: [_jsx("span", { "data-slot": "image-zoom-content",
|
|
116
|
+
// will-change promotion is scoped to hover/zoom so idle instances
|
|
117
|
+
// (e.g. a product grid full of frames) don't hold compositor layers.
|
|
118
|
+
className: "pointer-events-none block size-full group-hover/image-zoom:will-change-transform group-data-[state=zoomed]/image-zoom:will-change-transform motion-safe:transition-transform motion-safe:duration-300 motion-safe:ease-[var(--ease-out-quart)] [&_img]:block [&_img]:size-full [&_img]:select-none [&_img]:object-cover", style: {
|
|
119
|
+
transform: `scale(${zoomed ? scale : 1})`,
|
|
120
|
+
transformOrigin: `${origin.x}% ${origin.y}%`,
|
|
121
|
+
}, children: children ?? (src ? _jsx("img", { src: src, alt: alt, draggable: false }) : null) }), showIndicator ? (_jsx("span", { "aria-hidden": "true", "data-slot": "image-zoom-indicator", className: "pointer-events-none absolute end-2 bottom-2 inline-flex size-8 items-center justify-center rounded-full border border-border bg-surface-overlay/90 text-fg-secondary shadow-sm transition-opacity duration-200 group-data-[state=zoomed]/image-zoom:opacity-0 [&_svg]:size-4", children: _jsx(ZoomIn, { "aria-hidden": "true" }) })) : null] }));
|
|
122
|
+
});
|
|
123
|
+
ImageZoom.displayName = "ImageZoom";
|
|
124
|
+
export { imageZoomVariants };
|
|
125
|
+
//# sourceMappingURL=image-zoom.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
export interface InputGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
}
|
|
4
|
+
export declare const InputGroup: import("react").ForwardRefExoticComponent<InputGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export interface InputGroupAddonProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/** Which side the addon flanks. Affects the divider edge. Defaults to "start". */
|
|
7
|
+
align?: "start" | "end";
|
|
8
|
+
}
|
|
9
|
+
export declare const InputGroupAddon: import("react").ForwardRefExoticComponent<InputGroupAddonProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
//# sourceMappingURL=input-group.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
export const InputGroup = forwardRef(({ className, ...props }, ref) => {
|
|
5
|
+
return (_jsx("div", { ref: ref, "data-slot": "input-group", className: cn("flex h-10 w-full items-stretch overflow-hidden rounded-lg border border-border bg-surface-inset text-sm", "transition-[border-color,box-shadow] duration-150 ease-[var(--ease-out-quart)]", "focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-surface-base", "has-[input[aria-invalid=true]]:border-error has-[input[aria-invalid=true]]:ring-2 has-[input[aria-invalid=true]]:ring-error/30", "[&_input]:h-full [&_input]:rounded-none [&_input]:border-0 [&_input]:bg-transparent [&_input]:shadow-none", "[&_input]:ring-0 [&_input]:focus-visible:ring-0 [&_input]:focus-visible:ring-offset-0", className), ...props }));
|
|
6
|
+
});
|
|
7
|
+
InputGroup.displayName = "InputGroup";
|
|
8
|
+
export const InputGroupAddon = forwardRef(({ className, align = "start", children, ...props }, ref) => {
|
|
9
|
+
return (_jsx("div", { ref: ref, "data-slot": "input-group-addon", "data-align": align, className: cn("flex shrink-0 select-none items-center gap-1.5 whitespace-nowrap px-3 text-fg-tertiary", "[&_svg]:size-4 [&_svg]:shrink-0", align === "start" ? "border-r border-border" : "border-l border-border", className), ...props, children: children }));
|
|
10
|
+
});
|
|
11
|
+
InputGroupAddon.displayName = "InputGroupAddon";
|
|
12
|
+
//# sourceMappingURL=input-group.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type HTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A segmented one-time-passcode field. The visible slots are decorative; a
|
|
4
|
+
* single hidden `<input autocomplete="one-time-code">` holds the real value and
|
|
5
|
+
* receives keyboard input.
|
|
6
|
+
*
|
|
7
|
+
* That input is the only labelable control, so it always needs an accessible
|
|
8
|
+
* name. Pass `aria-label` (or `aria-labelledby`) to describe the specific code
|
|
9
|
+
* being entered; when neither is provided it falls back to a generic
|
|
10
|
+
* `"One-time passcode"` so the field is never nameless.
|
|
11
|
+
*/
|
|
12
|
+
export declare const InputOTP: import("react").ForwardRefExoticComponent<ComponentPropsWithoutRef<import("react").ForwardRefExoticComponent<import("input-otp").OTPInputProps & import("react").RefAttributes<HTMLInputElement>>> & import("react").RefAttributes<HTMLInputElement>>;
|
|
13
|
+
export declare const InputOTPGroup: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export declare const InputOTPSlot: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
15
|
+
index: number;
|
|
16
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export declare const InputOTPSeparator: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
//# sourceMappingURL=input-otp.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
4
|
+
import { Minus } from "lucide-react";
|
|
5
|
+
import { forwardRef, useContext, } from "react";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
/**
|
|
8
|
+
* A segmented one-time-passcode field. The visible slots are decorative; a
|
|
9
|
+
* single hidden `<input autocomplete="one-time-code">` holds the real value and
|
|
10
|
+
* receives keyboard input.
|
|
11
|
+
*
|
|
12
|
+
* That input is the only labelable control, so it always needs an accessible
|
|
13
|
+
* name. Pass `aria-label` (or `aria-labelledby`) to describe the specific code
|
|
14
|
+
* being entered; when neither is provided it falls back to a generic
|
|
15
|
+
* `"One-time passcode"` so the field is never nameless.
|
|
16
|
+
*/
|
|
17
|
+
export const InputOTP = forwardRef(({ className, containerClassName, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }, ref) => {
|
|
18
|
+
return (_jsx(OTPInput, { ref: ref, "data-slot": "input-otp", "aria-label": ariaLabelledBy ? undefined : (ariaLabel ?? "One-time passcode"), "aria-labelledby": ariaLabelledBy, containerClassName: cn("flex items-center gap-2 has-[:disabled]:opacity-50", containerClassName), className: cn("disabled:cursor-not-allowed", className), ...props }));
|
|
19
|
+
});
|
|
20
|
+
InputOTP.displayName = "InputOTP";
|
|
21
|
+
export const InputOTPGroup = forwardRef(({ className, ...props }, ref) => {
|
|
22
|
+
return (_jsx("div", { ref: ref, "data-slot": "input-otp-group", className: cn("flex items-center", className), ...props }));
|
|
23
|
+
});
|
|
24
|
+
InputOTPGroup.displayName = "InputOTPGroup";
|
|
25
|
+
export const InputOTPSlot = forwardRef(({ index, className, ...props }, ref) => {
|
|
26
|
+
const inputOTPContext = useContext(OTPInputContext);
|
|
27
|
+
const slot = inputOTPContext?.slots[index];
|
|
28
|
+
const char = slot?.char;
|
|
29
|
+
const hasFakeCaret = slot?.hasFakeCaret;
|
|
30
|
+
const isActive = slot?.isActive;
|
|
31
|
+
return (_jsxs("div", { ref: ref, "data-slot": "input-otp-slot", "data-active": isActive, className: cn("relative flex h-10 w-10 items-center justify-center border-y border-r border-border text-sm transition-all first:rounded-l-lg first:border-l last:rounded-r-lg data-[active=true]:border-ring data-[active=true]:ring-2 data-[active=true]:ring-ring", className), ...props, children: [char, hasFakeCaret && (_jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: _jsx("div", { className: "h-4 w-px animate-caret-blink bg-fg duration-1000" }) }))] }));
|
|
32
|
+
});
|
|
33
|
+
InputOTPSlot.displayName = "InputOTPSlot";
|
|
34
|
+
export const InputOTPSeparator = forwardRef(({ className, ...props }, ref) => {
|
|
35
|
+
return (_jsx("div", { ref: ref, "data-slot": "input-otp-separator", "aria-hidden": "true", className: cn("flex items-center text-fg-muted", className), ...props, children: _jsx(Minus, { className: "size-4" }) }));
|
|
36
|
+
});
|
|
37
|
+
InputOTPSeparator.displayName = "InputOTPSeparator";
|
|
38
|
+
//# sourceMappingURL=input-otp.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type InputHTMLAttributes } from "react";
|
|
2
|
+
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
invalid?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
6
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
export const Input = forwardRef(({ className, invalid = false, "aria-invalid": ariaInvalid, ...props }, ref) => {
|
|
5
|
+
return (_jsx("input", { ref: ref, "data-slot": "input", "aria-invalid": invalid ? true : ariaInvalid, className: cn("flex h-10 w-full rounded-lg border border-border bg-surface-inset px-3 text-sm text-fg", "placeholder:text-fg-tertiary", "transition-[border-color,box-shadow] duration-150 ease-[var(--ease-out-quart)]", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base", "disabled:opacity-50 disabled:pointer-events-none", "selection:bg-primary selection:text-primary-foreground", "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-fg", "aria-invalid:border-error aria-invalid:ring-2 aria-invalid:ring-error/30", invalid && "border-error focus-visible:ring-error focus-visible:ring-offset-surface-base", className), ...props }));
|
|
6
|
+
});
|
|
7
|
+
Input.displayName = "Input";
|
|
8
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
export interface JsonViewerProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** The value to render. Objects and arrays become collapsible branches. */
|
|
4
|
+
data: unknown;
|
|
5
|
+
/**
|
|
6
|
+
* How many levels start expanded — a mount-time default, not a controlled
|
|
7
|
+
* value. Expansion state is uncontrolled per branch and seeded once when a
|
|
8
|
+
* branch first mounts, so later changes to this prop leave already-mounted
|
|
9
|
+
* branches untouched. The root value is depth 0, so the default of 1 shows
|
|
10
|
+
* the root's entries with every nested branch collapsed. Pass
|
|
11
|
+
* `Number.POSITIVE_INFINITY` to expand everything.
|
|
12
|
+
*/
|
|
13
|
+
defaultExpandedDepth?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A collapsible JSON tree viewer. Any `unknown` value renders as a recursive,
|
|
17
|
+
* monospaced tree: objects and arrays become branches with a real chevron
|
|
18
|
+
* `<button>` (`aria-expanded`, focus ring) and a muted child-count summary
|
|
19
|
+
* while collapsed; primitives are colored purely by semantic tokens (strings
|
|
20
|
+
* `text-success-strong`, numbers `text-info-strong` + `tabular-nums`, booleans
|
|
21
|
+
* `text-warning-strong`, null/undefined `text-fg-tertiary`), keys use
|
|
22
|
+
* `text-fg-secondary` and punctuation `text-fg-tertiary`, with `border-border`
|
|
23
|
+
* indent guides.
|
|
24
|
+
*
|
|
25
|
+
* Non-plain built-ins render faithfully instead of as empty objects: Date
|
|
26
|
+
* (ISO 8601), RegExp (literal), URL (href), and Error ("Name: message") are
|
|
27
|
+
* leaves with a dim type hint where the text alone is ambiguous, while Map
|
|
28
|
+
* and Set are branches — a `Map(n)`/`Set(n)` hint plus indexed `[key, value]`
|
|
29
|
+
* pairs (Map) or items (Set), exactly the shape their copied JSON takes.
|
|
30
|
+
*
|
|
31
|
+
* Expansion state lives per branch (seeded from `defaultExpandedDepth`), so
|
|
32
|
+
* toggling a node only re-renders its own subtree, and collapsed subtrees are
|
|
33
|
+
* not mounted at all. Every row reveals a clipboard button on hover or focus
|
|
34
|
+
* — string-like leaves copy their raw contents, everything else copies
|
|
35
|
+
* pretty-printed JSON, and branch payloads are serialized lazily on the first
|
|
36
|
+
* copy rather than during render. Both rendering and serialization are
|
|
37
|
+
* cycle-safe: values that reference their own ancestors render/serialize as a
|
|
38
|
+
* `"[Circular]"` token instead of recursing forever. Fully keyboard operable
|
|
39
|
+
* (chevrons and copy buttons are native buttons), reduced-motion safe, and
|
|
40
|
+
* SSR-safe (no DOM reads, no time- or random-dependent output).
|
|
41
|
+
*/
|
|
42
|
+
export declare const JsonViewer: import("react").ForwardRefExoticComponent<JsonViewerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
|
+
//# sourceMappingURL=json-viewer.d.ts.map
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronRight } from "lucide-react";
|
|
4
|
+
import { forwardRef, useCallback, useMemo, useState, } from "react";
|
|
5
|
+
import { flushSync } from "react-dom";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { CopyButton } from "./copy-button.js";
|
|
8
|
+
/**
|
|
9
|
+
* Built-ins that render as single leaf rows even though `typeof` calls them
|
|
10
|
+
* objects: they have no useful enumerable properties, so recursing into them
|
|
11
|
+
* would display — and copy — an empty `{}`.
|
|
12
|
+
*/
|
|
13
|
+
function isLeafObject(value) {
|
|
14
|
+
return (value instanceof Date ||
|
|
15
|
+
value instanceof RegExp ||
|
|
16
|
+
value instanceof URL ||
|
|
17
|
+
value instanceof Error);
|
|
18
|
+
}
|
|
19
|
+
function isBranchValue(value) {
|
|
20
|
+
return typeof value === "object" && value !== null && !isLeafObject(value);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The visible entries of a branch: index/value pairs for arrays and Sets,
|
|
24
|
+
* indexed `[key, value]` pair tuples for Maps (keys can be arbitrary values,
|
|
25
|
+
* so the pairs mirror the copied JSON exactly), and own enumerable
|
|
26
|
+
* string-keyed entries (insertion order) for objects.
|
|
27
|
+
*/
|
|
28
|
+
function branchEntries(value) {
|
|
29
|
+
if (Array.isArray(value)) {
|
|
30
|
+
return value.map((item, index) => [String(index), item]);
|
|
31
|
+
}
|
|
32
|
+
if (value instanceof Map) {
|
|
33
|
+
return [...value].map((pair, index) => [String(index), pair]);
|
|
34
|
+
}
|
|
35
|
+
if (value instanceof Set) {
|
|
36
|
+
return [...value].map((item, index) => [String(index), item]);
|
|
37
|
+
}
|
|
38
|
+
return Object.entries(value);
|
|
39
|
+
}
|
|
40
|
+
function branchKind(value) {
|
|
41
|
+
if (Array.isArray(value))
|
|
42
|
+
return "array";
|
|
43
|
+
if (value instanceof Map)
|
|
44
|
+
return "map";
|
|
45
|
+
if (value instanceof Set)
|
|
46
|
+
return "set";
|
|
47
|
+
return "object";
|
|
48
|
+
}
|
|
49
|
+
/** Collapsed-summary noun ([singular, plural]) per branch kind. */
|
|
50
|
+
const BRANCH_NOUNS = {
|
|
51
|
+
array: ["item", "items"],
|
|
52
|
+
map: ["entry", "entries"],
|
|
53
|
+
set: ["item", "items"],
|
|
54
|
+
object: ["key", "keys"],
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Rebuild `value` as a plain JSON-serializable clone. Built-ins convert to
|
|
58
|
+
* faithful forms instead of `{}`: Date → ISO 8601 string (invalid dates →
|
|
59
|
+
* null, matching `JSON.stringify`), RegExp → its literal source, URL → its
|
|
60
|
+
* href, Error → `"Name: message"`, Map → an array of `[key, value]` pairs,
|
|
61
|
+
* Set → an array of its items. Ancestors are tracked in a `WeakSet` that is
|
|
62
|
+
* entered before and left after each object, so genuine cycles become a
|
|
63
|
+
* `"[Circular]"` token while mere shared references (the same object
|
|
64
|
+
* appearing under two siblings) serialize normally. Bigints keep an `n`
|
|
65
|
+
* suffix instead of throwing.
|
|
66
|
+
*/
|
|
67
|
+
function toSerializable(value, ancestors) {
|
|
68
|
+
if (typeof value === "bigint")
|
|
69
|
+
return `${value}n`;
|
|
70
|
+
if (value instanceof Date) {
|
|
71
|
+
return Number.isNaN(value.getTime()) ? null : value.toISOString();
|
|
72
|
+
}
|
|
73
|
+
if (value instanceof RegExp || value instanceof Error)
|
|
74
|
+
return String(value);
|
|
75
|
+
if (value instanceof URL)
|
|
76
|
+
return value.href;
|
|
77
|
+
if (!isBranchValue(value))
|
|
78
|
+
return value;
|
|
79
|
+
if (ancestors.has(value))
|
|
80
|
+
return "[Circular]";
|
|
81
|
+
ancestors.add(value);
|
|
82
|
+
let clone;
|
|
83
|
+
if (Array.isArray(value)) {
|
|
84
|
+
clone = value.map((item) => toSerializable(item, ancestors));
|
|
85
|
+
}
|
|
86
|
+
else if (value instanceof Map) {
|
|
87
|
+
clone = [...value].map(([key, entry]) => [
|
|
88
|
+
toSerializable(key, ancestors),
|
|
89
|
+
toSerializable(entry, ancestors),
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
else if (value instanceof Set) {
|
|
93
|
+
clone = [...value].map((item) => toSerializable(item, ancestors));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
clone = Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, toSerializable(entry, ancestors)]));
|
|
97
|
+
}
|
|
98
|
+
ancestors.delete(value);
|
|
99
|
+
return clone;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Serialize any value for the copy button. Falls back to `String(value)` for
|
|
103
|
+
* values `JSON.stringify` cannot represent at the top level (undefined,
|
|
104
|
+
* functions, symbols).
|
|
105
|
+
*/
|
|
106
|
+
function stringifyValue(value) {
|
|
107
|
+
if (value === undefined)
|
|
108
|
+
return "undefined";
|
|
109
|
+
if (typeof value === "bigint")
|
|
110
|
+
return `${value}n`;
|
|
111
|
+
const json = JSON.stringify(toSerializable(value, new WeakSet()), null, 2);
|
|
112
|
+
return json ?? String(value);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Map a primitive to its display text + semantic color token.
|
|
116
|
+
*
|
|
117
|
+
* De-emphasized values (`null`, `undefined`, functions/symbols) use
|
|
118
|
+
* `fg-tertiary`, not `fg-muted`: they are meaningful data, and `fg-muted` fails
|
|
119
|
+
* AA contrast on the inset surface (see CONTRACT.md).
|
|
120
|
+
*/
|
|
121
|
+
function formatPrimitive(value) {
|
|
122
|
+
if (value === null)
|
|
123
|
+
return { text: "null", className: "text-fg-tertiary" };
|
|
124
|
+
if (value === undefined)
|
|
125
|
+
return { text: "undefined", className: "text-fg-tertiary" };
|
|
126
|
+
switch (typeof value) {
|
|
127
|
+
case "string":
|
|
128
|
+
// JSON.stringify supplies the quotes and escapes embedded ones.
|
|
129
|
+
// `text-*-strong` (the AA-tuned same-hue variants): the plain semantic
|
|
130
|
+
// colors read ~4.4:1 as small code text on the lightest light surfaces.
|
|
131
|
+
return { text: JSON.stringify(value), className: "text-success-strong" };
|
|
132
|
+
case "number":
|
|
133
|
+
return { text: String(value), className: "text-info-strong tabular-nums" };
|
|
134
|
+
case "bigint":
|
|
135
|
+
return { text: `${value}n`, className: "text-info-strong tabular-nums" };
|
|
136
|
+
case "boolean":
|
|
137
|
+
return { text: String(value), className: "text-warning-strong" };
|
|
138
|
+
default:
|
|
139
|
+
// Functions and symbols are not JSON; render a compact de-emphasized token.
|
|
140
|
+
return {
|
|
141
|
+
text: typeof value === "function" ? "ƒ ()" : String(value),
|
|
142
|
+
className: "text-fg-tertiary italic",
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Display text, color token, and optional dim type hint for a leaf value —
|
|
148
|
+
* primitives plus the leaf-rendered built-ins (Date, RegExp, URL, Error).
|
|
149
|
+
*/
|
|
150
|
+
function formatLeaf(value) {
|
|
151
|
+
if (value instanceof Date) {
|
|
152
|
+
return Number.isNaN(value.getTime())
|
|
153
|
+
? { text: "Invalid Date", className: "text-fg-tertiary italic", hint: "Date" }
|
|
154
|
+
: { text: value.toISOString(), className: "text-info-strong", hint: "Date" };
|
|
155
|
+
}
|
|
156
|
+
if (value instanceof RegExp) {
|
|
157
|
+
// The literal form (`/ab+c/gi`) is self-describing — no hint needed.
|
|
158
|
+
return { text: String(value), className: "text-success-strong" };
|
|
159
|
+
}
|
|
160
|
+
if (value instanceof URL) {
|
|
161
|
+
return { text: JSON.stringify(value.href), className: "text-success-strong", hint: "URL" };
|
|
162
|
+
}
|
|
163
|
+
if (value instanceof Error) {
|
|
164
|
+
// `String(error)` is "Name: message", so the name doubles as the hint.
|
|
165
|
+
return { text: String(value), className: "text-error-strong" };
|
|
166
|
+
}
|
|
167
|
+
return formatPrimitive(value);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Clipboard text for a leaf. Strings copy their raw contents and the
|
|
171
|
+
* string-like built-ins copy their faithful string form (Date → ISO 8601,
|
|
172
|
+
* URL → href, RegExp → literal, Error → `"Name: message"`) — the most useful
|
|
173
|
+
* shapes to paste; the remaining primitives copy their display text, which
|
|
174
|
+
* `String` produces directly without involving the tree serializer.
|
|
175
|
+
*/
|
|
176
|
+
function leafCopyText(value) {
|
|
177
|
+
if (typeof value === "string")
|
|
178
|
+
return value;
|
|
179
|
+
if (value instanceof Date) {
|
|
180
|
+
// Matches serialization: an invalid Date is `null` in JSON.
|
|
181
|
+
return Number.isNaN(value.getTime()) ? "null" : value.toISOString();
|
|
182
|
+
}
|
|
183
|
+
if (value instanceof RegExp || value instanceof Error)
|
|
184
|
+
return String(value);
|
|
185
|
+
if (value instanceof URL)
|
|
186
|
+
return value.href;
|
|
187
|
+
if (typeof value === "bigint")
|
|
188
|
+
return `${value}n`;
|
|
189
|
+
return String(value);
|
|
190
|
+
}
|
|
191
|
+
function copyLabelFor(name) {
|
|
192
|
+
return name === undefined ? "Copy value" : `Copy value of ${name}`;
|
|
193
|
+
}
|
|
194
|
+
/* ------------------------------------------------------------------ *
|
|
195
|
+
* Row building blocks
|
|
196
|
+
* ------------------------------------------------------------------ */
|
|
197
|
+
/** Punctuation ({}, [], commas, colons) in the tertiary foreground token. */
|
|
198
|
+
function Punct({ children }) {
|
|
199
|
+
return _jsx("span", { className: "text-fg-tertiary", children: children });
|
|
200
|
+
}
|
|
201
|
+
/** Dim type hint (`Date`, `URL`, `Map(2)`, …) rendered before a value. */
|
|
202
|
+
function TypeHint({ children }) {
|
|
203
|
+
return (_jsx("span", { "data-slot": "json-viewer-hint", className: "text-fg-muted", children: `${children} ` }));
|
|
204
|
+
}
|
|
205
|
+
/** Chevron-width placeholder that keeps leaf rows aligned with branch rows. */
|
|
206
|
+
function ControlSpacer() {
|
|
207
|
+
return _jsx("span", { "aria-hidden": "true", className: "size-5 shrink-0" });
|
|
208
|
+
}
|
|
209
|
+
/** Property key (quoted for objects, bare index for arrays) plus its colon. */
|
|
210
|
+
function KeyLabel({ name, quoted }) {
|
|
211
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { "data-slot": "json-viewer-key", className: "text-fg-secondary", children: quoted ? JSON.stringify(name) : name }), _jsx(Punct, { children: ": " })] }));
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* One visual line of the tree. The copy button is always rendered (so it is
|
|
215
|
+
* keyboard-reachable and the layout never shifts) but kept at `opacity-0`
|
|
216
|
+
* until the row is hovered or anything inside the row holds focus.
|
|
217
|
+
*
|
|
218
|
+
* The copy button deliberately stays in the tab order: a leaf row has no
|
|
219
|
+
* other focusable element, so `tabIndex={-1}` would make copying impossible
|
|
220
|
+
* from the keyboard. The extra tab stop per row is the lesser harm until the
|
|
221
|
+
* tree gets a proper roving-tabindex treatment.
|
|
222
|
+
*
|
|
223
|
+
* Branch payloads are produced lazily: the first activation cancels the copy
|
|
224
|
+
* (CopyButton honors `defaultPrevented`), commits the serialized text
|
|
225
|
+
* synchronously, and re-dispatches the click so the copy proceeds with the
|
|
226
|
+
* real payload. The text is cached against its producer — which branches
|
|
227
|
+
* memoize on their value — so it recomputes only when the data changes.
|
|
228
|
+
*/
|
|
229
|
+
function JsonRow({ control, copyText, copyLabel, children }) {
|
|
230
|
+
const [cache, setCache] = useState(null);
|
|
231
|
+
const resolved = typeof copyText === "string" ? copyText : cache?.produce === copyText ? cache.text : null;
|
|
232
|
+
return (_jsxs("div", { "data-slot": "json-viewer-row", className: "group/row flex items-start gap-1", children: [control, _jsx("span", { className: "min-w-0 flex-1 break-words", children: children }), _jsx(CopyButton, { value: resolved ?? "", copyLabel: copyLabel, onClick: (event) => {
|
|
233
|
+
if (typeof copyText === "string" || resolved !== null)
|
|
234
|
+
return;
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
const button = event.currentTarget;
|
|
237
|
+
flushSync(() => setCache({ produce: copyText, text: copyText() }));
|
|
238
|
+
button.click();
|
|
239
|
+
}, variant: "ghost", size: "icon-sm", className: "mt-0.5 size-5 shrink-0 rounded-md opacity-0 transition-opacity duration-150 focus-visible:opacity-100 group-focus-within/row:opacity-100 group-hover/row:opacity-100 motion-reduce:transition-none [&_svg]:size-3" })] }));
|
|
240
|
+
}
|
|
241
|
+
function JsonNode(props) {
|
|
242
|
+
const { value, ancestors } = props;
|
|
243
|
+
if (isBranchValue(value)) {
|
|
244
|
+
if (ancestors.includes(value)) {
|
|
245
|
+
return _jsx(JsonCircularLeaf, { ...props });
|
|
246
|
+
}
|
|
247
|
+
return _jsx(JsonBranch, { ...props, value: value });
|
|
248
|
+
}
|
|
249
|
+
return _jsx(JsonLeaf, { ...props });
|
|
250
|
+
}
|
|
251
|
+
/** A value that references one of its own ancestors — never recurse into it. */
|
|
252
|
+
function JsonCircularLeaf({ name, quotedName, isLast }) {
|
|
253
|
+
return (_jsxs(JsonRow, { control: _jsx(ControlSpacer, {}), copyText: "[Circular]", copyLabel: copyLabelFor(name), children: [name !== undefined && _jsx(KeyLabel, { name: name, quoted: quotedName }), _jsx("span", { "data-slot": "json-viewer-value", className: "text-fg-tertiary italic", children: "[Circular]" }), !isLast && _jsx(Punct, { children: "," })] }));
|
|
254
|
+
}
|
|
255
|
+
function JsonLeaf({ name, quotedName, value, isLast }) {
|
|
256
|
+
const { text, className, hint } = formatLeaf(value);
|
|
257
|
+
return (_jsxs(JsonRow, { control: _jsx(ControlSpacer, {}), copyText: leafCopyText(value), copyLabel: copyLabelFor(name), children: [name !== undefined && _jsx(KeyLabel, { name: name, quoted: quotedName }), hint !== undefined && _jsx(TypeHint, { children: hint }), _jsx("span", { "data-slot": "json-viewer-value", className: cn("break-all", className), children: text }), !isLast && _jsx(Punct, { children: "," })] }));
|
|
258
|
+
}
|
|
259
|
+
function JsonBranch({ name, quotedName, value, depth, defaultExpandedDepth, ancestors, isLast, }) {
|
|
260
|
+
// Expansion is per branch and uncontrolled, seeded from the depth budget, so
|
|
261
|
+
// toggling one node re-renders only its own subtree.
|
|
262
|
+
const [expanded, setExpanded] = useState(depth < defaultExpandedDepth);
|
|
263
|
+
const entries = useMemo(() => branchEntries(value), [value]);
|
|
264
|
+
// Serialization is deferred to the copy handler (see JsonRow) — memoized on
|
|
265
|
+
// the value so JsonRow's cache invalidates exactly when the data changes.
|
|
266
|
+
const getCopyText = useCallback(() => stringifyValue(value), [value]);
|
|
267
|
+
const childAncestors = useMemo(() => [...ancestors, value], [ancestors, value]);
|
|
268
|
+
const kind = branchKind(value);
|
|
269
|
+
const count = entries.length;
|
|
270
|
+
// Maps and Sets copy as arrays, so they display with array brackets too;
|
|
271
|
+
// the dim `Map(n)`/`Set(n)` hint carries the real type.
|
|
272
|
+
const [openToken, closeToken] = kind === "object" ? ["{", "}"] : ["[", "]"];
|
|
273
|
+
const hint = kind === "map" ? `Map(${count})` : kind === "set" ? `Set(${count})` : null;
|
|
274
|
+
const noun = BRANCH_NOUNS[kind][count === 1 ? 0 : 1];
|
|
275
|
+
// Empty containers have nothing to expand — render them as a single leaf row.
|
|
276
|
+
if (count === 0) {
|
|
277
|
+
return (_jsxs(JsonRow, { control: _jsx(ControlSpacer, {}), copyText: getCopyText, copyLabel: copyLabelFor(name), children: [name !== undefined && _jsx(KeyLabel, { name: name, quoted: quotedName }), hint !== null && _jsx(TypeHint, { children: hint }), _jsxs(Punct, { children: [openToken, closeToken] }), !isLast && _jsx(Punct, { children: "," })] }));
|
|
278
|
+
}
|
|
279
|
+
return (_jsxs("div", { "data-slot": "json-viewer-branch", children: [_jsxs(JsonRow, { control: _jsx("button", { type: "button", "data-slot": "json-viewer-toggle", "data-state": expanded ? "open" : "closed", "aria-expanded": expanded, "aria-label": `Toggle ${name ?? "root"}`, onClick: () => setExpanded((previous) => !previous), className: cn("mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-md text-fg-tertiary outline-none", "transition-[background,color] duration-150 ease-[var(--ease-out-quart)] motion-reduce:transition-none", "hover:bg-surface-overlay hover:text-fg focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"), children: _jsx(ChevronRight, { "aria-hidden": "true", className: cn("size-3.5 transition-transform duration-200 ease-[var(--ease-out-quart)] motion-reduce:transition-none", expanded && "rotate-90") }) }), copyText: getCopyText, copyLabel: copyLabelFor(name), children: [name !== undefined && _jsx(KeyLabel, { name: name, quoted: quotedName }), hint !== null && _jsx(TypeHint, { children: hint }), _jsx(Punct, { children: openToken }), !expanded && (_jsxs(_Fragment, { children: [_jsx("span", { "data-slot": "json-viewer-summary",
|
|
280
|
+
// The child count is information-bearing, so it uses `fg-tertiary`
|
|
281
|
+
// (AA-safe on the inset surface) rather than the decorative `fg-muted`.
|
|
282
|
+
className: "text-fg-tertiary tabular-nums", children: ` … ${count} ${noun} ` }), _jsx(Punct, { children: closeToken }), !isLast && _jsx(Punct, { children: "," })] }))] }), expanded && (_jsxs(_Fragment, { children: [_jsx("div", { "data-slot": "json-viewer-children", className: "ml-2.5 border-border border-l pl-3.5", children: entries.map(([childName, childValue], index) => (_jsx(JsonNode, { name: childName, quotedName: kind === "object", value: childValue, depth: depth + 1, defaultExpandedDepth: defaultExpandedDepth, ancestors: childAncestors, isLast: index === count - 1 }, childName))) }), _jsxs("div", { "data-slot": "json-viewer-closer", className: "flex items-start gap-1", children: [_jsx(ControlSpacer, {}), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx(Punct, { children: closeToken }), !isLast && _jsx(Punct, { children: "," })] })] })] }))] }));
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* A collapsible JSON tree viewer. Any `unknown` value renders as a recursive,
|
|
286
|
+
* monospaced tree: objects and arrays become branches with a real chevron
|
|
287
|
+
* `<button>` (`aria-expanded`, focus ring) and a muted child-count summary
|
|
288
|
+
* while collapsed; primitives are colored purely by semantic tokens (strings
|
|
289
|
+
* `text-success-strong`, numbers `text-info-strong` + `tabular-nums`, booleans
|
|
290
|
+
* `text-warning-strong`, null/undefined `text-fg-tertiary`), keys use
|
|
291
|
+
* `text-fg-secondary` and punctuation `text-fg-tertiary`, with `border-border`
|
|
292
|
+
* indent guides.
|
|
293
|
+
*
|
|
294
|
+
* Non-plain built-ins render faithfully instead of as empty objects: Date
|
|
295
|
+
* (ISO 8601), RegExp (literal), URL (href), and Error ("Name: message") are
|
|
296
|
+
* leaves with a dim type hint where the text alone is ambiguous, while Map
|
|
297
|
+
* and Set are branches — a `Map(n)`/`Set(n)` hint plus indexed `[key, value]`
|
|
298
|
+
* pairs (Map) or items (Set), exactly the shape their copied JSON takes.
|
|
299
|
+
*
|
|
300
|
+
* Expansion state lives per branch (seeded from `defaultExpandedDepth`), so
|
|
301
|
+
* toggling a node only re-renders its own subtree, and collapsed subtrees are
|
|
302
|
+
* not mounted at all. Every row reveals a clipboard button on hover or focus
|
|
303
|
+
* — string-like leaves copy their raw contents, everything else copies
|
|
304
|
+
* pretty-printed JSON, and branch payloads are serialized lazily on the first
|
|
305
|
+
* copy rather than during render. Both rendering and serialization are
|
|
306
|
+
* cycle-safe: values that reference their own ancestors render/serialize as a
|
|
307
|
+
* `"[Circular]"` token instead of recursing forever. Fully keyboard operable
|
|
308
|
+
* (chevrons and copy buttons are native buttons), reduced-motion safe, and
|
|
309
|
+
* SSR-safe (no DOM reads, no time- or random-dependent output).
|
|
310
|
+
*/
|
|
311
|
+
export const JsonViewer = forwardRef(({ data, defaultExpandedDepth = 1, className, ...props }, ref) => (_jsx("div", { ref: ref, "data-slot": "json-viewer", className: cn("overflow-x-auto rounded-xl border border-border bg-surface-inset p-4 font-mono text-fg text-sm leading-6", className), ...props, children: _jsx(JsonNode, { value: data, quotedName: false, depth: 0, defaultExpandedDepth: defaultExpandedDepth, ancestors: [], isLast: true }) })));
|
|
312
|
+
JsonViewer.displayName = "JsonViewer";
|
|
313
|
+
//# sourceMappingURL=json-viewer.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface KanbanItem {
|
|
3
|
+
/** Stable identifier, unique across the whole board. */
|
|
4
|
+
id: string;
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface KanbanColumn {
|
|
9
|
+
/** Stable identifier, unique across the whole board. */
|
|
10
|
+
id: string;
|
|
11
|
+
title: ReactNode;
|
|
12
|
+
items: KanbanItem[];
|
|
13
|
+
}
|
|
14
|
+
export interface KanbanProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
15
|
+
/** The board's columns and their cards (controlled). */
|
|
16
|
+
columns: KanbanColumn[];
|
|
17
|
+
/** Called with the next columns after a reorder/move. The consumer owns state. */
|
|
18
|
+
onColumnsChange: (next: KanbanColumn[]) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Render a card's body. Defaults to the item's title + description in a
|
|
21
|
+
* Card-like tile. The drag handle and tile chrome are always provided.
|
|
22
|
+
*/
|
|
23
|
+
renderItem?: (item: KanbanItem) => ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A drag-and-drop board: columns of cards that reorder within a column and
|
|
27
|
+
* move across columns. Controlled via `columns` / `onColumnsChange` — the
|
|
28
|
+
* consumer owns state. SSR-safe (no effects run on the server).
|
|
29
|
+
*/
|
|
30
|
+
export declare const Kanban: import("react").ForwardRefExoticComponent<KanbanProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
31
|
+
//# sourceMappingURL=kanban.d.ts.map
|