@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,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
function finiteOr(value, fallback) {
|
|
6
|
+
return Number.isFinite(value) ? value : fallback;
|
|
7
|
+
}
|
|
8
|
+
function prefersReducedMotion() {
|
|
9
|
+
return (typeof window !== "undefined" &&
|
|
10
|
+
typeof window.matchMedia === "function" &&
|
|
11
|
+
window.matchMedia("(prefers-reduced-motion: reduce)").matches);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A calm 2D particle field that drifts behind content. Canvas-only, no WebGL.
|
|
15
|
+
* Paused (and undrawn) under reduced motion so the surface stays still.
|
|
16
|
+
*/
|
|
17
|
+
export function Particles({ ref, className, children, count = 40, ...props }) {
|
|
18
|
+
const canvasRef = useRef(null);
|
|
19
|
+
const specks = useRef([]);
|
|
20
|
+
const frame = useRef(null);
|
|
21
|
+
const speckCount = Math.min(120, Math.max(8, Math.round(finiteOr(count, 40))));
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const canvas = canvasRef.current;
|
|
24
|
+
if (!canvas)
|
|
25
|
+
return;
|
|
26
|
+
let context = null;
|
|
27
|
+
try {
|
|
28
|
+
context = canvas.getContext("2d");
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!context)
|
|
34
|
+
return;
|
|
35
|
+
if (prefersReducedMotion())
|
|
36
|
+
return;
|
|
37
|
+
const resize = () => {
|
|
38
|
+
const parent = canvas.parentElement;
|
|
39
|
+
if (!parent)
|
|
40
|
+
return;
|
|
41
|
+
const rect = parent.getBoundingClientRect();
|
|
42
|
+
const ratio = window.devicePixelRatio || 1;
|
|
43
|
+
canvas.width = Math.max(1, Math.floor(rect.width * ratio));
|
|
44
|
+
canvas.height = Math.max(1, Math.floor(rect.height * ratio));
|
|
45
|
+
canvas.style.width = `${rect.width}px`;
|
|
46
|
+
canvas.style.height = `${rect.height}px`;
|
|
47
|
+
context.setTransform(ratio, 0, 0, ratio, 0, 0);
|
|
48
|
+
specks.current = Array.from({ length: speckCount }, (_, index) => ({
|
|
49
|
+
x: (index * 97) % Math.max(1, rect.width),
|
|
50
|
+
y: (index * 53) % Math.max(1, rect.height),
|
|
51
|
+
vx: ((index % 5) - 2) * 0.12,
|
|
52
|
+
vy: ((index % 3) - 1) * 0.08,
|
|
53
|
+
size: 1 + (index % 3) * 0.4,
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
resize();
|
|
57
|
+
window.addEventListener("resize", resize);
|
|
58
|
+
const tick = () => {
|
|
59
|
+
const parent = canvas.parentElement;
|
|
60
|
+
if (!parent)
|
|
61
|
+
return;
|
|
62
|
+
const { width, height } = parent.getBoundingClientRect();
|
|
63
|
+
context.clearRect(0, 0, width, height);
|
|
64
|
+
context.fillStyle = "color-mix(in oklch, var(--cronus-fg) 35%, transparent)";
|
|
65
|
+
for (const speck of specks.current) {
|
|
66
|
+
speck.x += speck.vx;
|
|
67
|
+
speck.y += speck.vy;
|
|
68
|
+
if (speck.x < 0)
|
|
69
|
+
speck.x = width;
|
|
70
|
+
if (speck.x > width)
|
|
71
|
+
speck.x = 0;
|
|
72
|
+
if (speck.y < 0)
|
|
73
|
+
speck.y = height;
|
|
74
|
+
if (speck.y > height)
|
|
75
|
+
speck.y = 0;
|
|
76
|
+
context.beginPath();
|
|
77
|
+
context.arc(speck.x, speck.y, speck.size, 0, Math.PI * 2);
|
|
78
|
+
context.fill();
|
|
79
|
+
}
|
|
80
|
+
frame.current = requestAnimationFrame(tick);
|
|
81
|
+
};
|
|
82
|
+
frame.current = requestAnimationFrame(tick);
|
|
83
|
+
return () => {
|
|
84
|
+
window.removeEventListener("resize", resize);
|
|
85
|
+
if (frame.current !== null)
|
|
86
|
+
cancelAnimationFrame(frame.current);
|
|
87
|
+
};
|
|
88
|
+
}, [speckCount]);
|
|
89
|
+
return (_jsxs("div", { ref: ref, "data-slot": "particles", className: cn("relative overflow-hidden", className), ...props, children: [_jsx("canvas", { ref: canvasRef, tabIndex: -1, "aria-hidden": "true", className: "pointer-events-none absolute inset-0 motion-reduce:hidden" }), _jsx("div", { className: "relative", children: children })] }));
|
|
90
|
+
}
|
|
91
|
+
Particles.displayName = "Particles";
|
|
92
|
+
//# sourceMappingURL=particles.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type InputHTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Estimate password strength from length and character-class variety.
|
|
4
|
+
* Pure helper — no side effects — so it can be unit-tested in isolation.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getPasswordStrength(value: string): {
|
|
7
|
+
score: 0 | 1 | 2 | 3 | 4;
|
|
8
|
+
label: string;
|
|
9
|
+
};
|
|
10
|
+
export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
11
|
+
invalid?: boolean;
|
|
12
|
+
/** Show a 4-segment strength meter + label below the field. */
|
|
13
|
+
showStrength?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const PasswordInput: import("react").ForwardRefExoticComponent<PasswordInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
16
|
+
//# sourceMappingURL=password-input.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Eye, EyeOff } from "lucide-react";
|
|
4
|
+
import { forwardRef, useState } from "react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { Input } from "./input.js";
|
|
7
|
+
/**
|
|
8
|
+
* Estimate password strength from length and character-class variety.
|
|
9
|
+
* Pure helper — no side effects — so it can be unit-tested in isolation.
|
|
10
|
+
*/
|
|
11
|
+
export function getPasswordStrength(value) {
|
|
12
|
+
if (!value)
|
|
13
|
+
return { score: 0, label: "Weak" };
|
|
14
|
+
let variety = 0;
|
|
15
|
+
if (/[a-z]/.test(value))
|
|
16
|
+
variety += 1;
|
|
17
|
+
if (/[A-Z]/.test(value))
|
|
18
|
+
variety += 1;
|
|
19
|
+
if (/[0-9]/.test(value))
|
|
20
|
+
variety += 1;
|
|
21
|
+
if (/[^A-Za-z0-9]/.test(value))
|
|
22
|
+
variety += 1;
|
|
23
|
+
let points = 0;
|
|
24
|
+
if (value.length >= 8)
|
|
25
|
+
points += 1;
|
|
26
|
+
if (value.length >= 12)
|
|
27
|
+
points += 1;
|
|
28
|
+
points += variety >= 3 ? 2 : variety >= 2 ? 1 : 0;
|
|
29
|
+
const score = (Math.min(points, 4) || 1);
|
|
30
|
+
const label = ["Weak", "Weak", "Fair", "Good", "Strong"][score];
|
|
31
|
+
return { score, label };
|
|
32
|
+
}
|
|
33
|
+
const SEGMENT_COLORS = ["bg-error", "bg-error", "bg-warning", "bg-warning", "bg-success"];
|
|
34
|
+
export const PasswordInput = forwardRef(({ className, showStrength = false, value, defaultValue, onChange, ...props }, ref) => {
|
|
35
|
+
const [visible, setVisible] = useState(false);
|
|
36
|
+
const [internalValue, setInternalValue] = useState(defaultValue != null ? String(defaultValue) : "");
|
|
37
|
+
const isControlled = value !== undefined;
|
|
38
|
+
const currentValue = isControlled ? String(value ?? "") : internalValue;
|
|
39
|
+
const strength = getPasswordStrength(currentValue);
|
|
40
|
+
return (_jsxs("div", { "data-slot": "password-input", className: cn("w-full", className), children: [_jsxs("div", { className: "relative", children: [_jsx(Input, { ref: ref, type: visible ? "text" : "password", className: "pr-10", value: value, defaultValue: defaultValue, onChange: (event) => {
|
|
41
|
+
if (!isControlled)
|
|
42
|
+
setInternalValue(event.target.value);
|
|
43
|
+
onChange?.(event);
|
|
44
|
+
}, ...props }), _jsx("button", { type: "button", "data-slot": "password-input-toggle", onClick: () => setVisible((v) => !v), "aria-label": visible ? "Hide password" : "Show password", "aria-pressed": visible, className: cn("absolute inset-y-0 right-0 flex w-10 items-center justify-center rounded-r-lg text-fg-tertiary", "transition-colors hover:text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset", "disabled:opacity-50 disabled:pointer-events-none [&_svg]:size-4"), disabled: props.disabled, children: visible ? _jsx(EyeOff, { "aria-hidden": "true" }) : _jsx(Eye, { "aria-hidden": "true" }) })] }), showStrength && (_jsxs("div", { "data-slot": "password-input-strength", className: "mt-2 flex items-center gap-2", children: [_jsx("div", { className: "flex flex-1 gap-1", "aria-hidden": "true", children: [0, 1, 2, 3].map((segment) => (_jsx("div", { className: cn("h-1 flex-1 rounded-full transition-colors", segment < strength.score
|
|
45
|
+
? SEGMENT_COLORS[strength.score]
|
|
46
|
+
: "bg-surface-overlay") }, segment))) }), _jsx("span", { className: "text-xs text-fg-tertiary", children: strength.label })] }))] }));
|
|
47
|
+
});
|
|
48
|
+
PasswordInput.displayName = "PasswordInput";
|
|
49
|
+
//# sourceMappingURL=password-input.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type InputHTMLAttributes } from "react";
|
|
2
|
+
/** A single dialling country shown in the selector. */
|
|
3
|
+
export interface PhoneCountry {
|
|
4
|
+
/** ISO 3166-1 alpha-2 code, e.g. `"BR"`. Used as the stable key. */
|
|
5
|
+
code: string;
|
|
6
|
+
/** Human-readable country name, e.g. `"Brazil"`. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** International dialling code without the `+`, e.g. `"55"`. */
|
|
9
|
+
dialCode: string;
|
|
10
|
+
/** Flag emoji rendered in the trigger and list, e.g. `"🇧🇷"`. */
|
|
11
|
+
flag: string;
|
|
12
|
+
/**
|
|
13
|
+
* Digit group sizes for the national number, e.g. `[2, 5, 4]` renders
|
|
14
|
+
* `11 98765 4321`. Extra digits beyond the pattern become a trailing group.
|
|
15
|
+
*/
|
|
16
|
+
format?: number[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A compact, sensible default of ~20 common dialling countries with Brazil
|
|
20
|
+
* first. Pass your own list via the `countries` prop to override or extend it.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_PHONE_COUNTRIES: PhoneCountry[];
|
|
23
|
+
export interface PhoneInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "type"> {
|
|
24
|
+
/** Controlled value as an E.164 string (e.g. `"+5511987654321"`). Pair with `onChange`. */
|
|
25
|
+
value?: string;
|
|
26
|
+
/** Initial E.164 (or bare national) value for uncontrolled usage. */
|
|
27
|
+
defaultValue?: string;
|
|
28
|
+
/** Called with the full E.164 string on every edit; empty string when no number is entered. */
|
|
29
|
+
onChange?: (value: string) => void;
|
|
30
|
+
/** ISO 3166-1 alpha-2 code selected on first render. Defaults to `"BR"`. */
|
|
31
|
+
defaultCountry?: string;
|
|
32
|
+
/** Overrides the built-in country list. Order controls the list order. */
|
|
33
|
+
countries?: PhoneCountry[];
|
|
34
|
+
/** Marks the field invalid (red border/ring + `aria-invalid`). */
|
|
35
|
+
invalid?: boolean;
|
|
36
|
+
/** Placeholder for the country search box inside the selector. */
|
|
37
|
+
searchPlaceholder?: string;
|
|
38
|
+
/** Message shown when no country matches the search. */
|
|
39
|
+
emptyText?: string;
|
|
40
|
+
/** Accessible name for the whole control and the number field. Defaults to `"Phone number"`. */
|
|
41
|
+
label?: string;
|
|
42
|
+
/** Accessible name for the country selector trigger. Defaults to `"Select country"`. */
|
|
43
|
+
countryLabel?: string;
|
|
44
|
+
/** Extra classes for the country selector popover. */
|
|
45
|
+
contentClassName?: string;
|
|
46
|
+
/** Name for a hidden input carrying the E.164 value, so the field submits inside a form. */
|
|
47
|
+
name?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* An international phone input: a searchable country selector (flag + dial code)
|
|
51
|
+
* fused to a national-number field that auto-groups digits for the selected
|
|
52
|
+
* country and emits the composed E.164 string via `onChange`.
|
|
53
|
+
*
|
|
54
|
+
* Behavior & performance: digit grouping is computed with a lightweight
|
|
55
|
+
* per-country pattern (no libphonenumber). The caret is preserved across
|
|
56
|
+
* reformatting via a `useLayoutEffect` that reads a ref set during `onChange` —
|
|
57
|
+
* no timers, intervals, or RAF are scheduled. Country selection and typing both
|
|
58
|
+
* flow through `onChange`, so controlled and uncontrolled usage both work; a
|
|
59
|
+
* synchronising effect keeps controlled state aligned without loops.
|
|
60
|
+
*
|
|
61
|
+
* Accessibility: the root is a labelled `role="group"`; the trigger is a
|
|
62
|
+
* `role="combobox"` (expanded state announced) and the number field is a
|
|
63
|
+
* labelled `type="tel"` input, which is the forwarded ref. Every transition
|
|
64
|
+
* degrades under `prefers-reduced-motion: reduce`.
|
|
65
|
+
*/
|
|
66
|
+
export declare const PhoneInput: import("react").ForwardRefExoticComponent<PhoneInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
67
|
+
//# sourceMappingURL=phone-input.d.ts.map
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check, ChevronDown } from "lucide-react";
|
|
4
|
+
import { forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from "./command.js";
|
|
7
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
8
|
+
const BRAZIL = {
|
|
9
|
+
code: "BR",
|
|
10
|
+
name: "Brazil",
|
|
11
|
+
dialCode: "55",
|
|
12
|
+
flag: "🇧🇷",
|
|
13
|
+
format: [2, 5, 4],
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A compact, sensible default of ~20 common dialling countries with Brazil
|
|
17
|
+
* first. Pass your own list via the `countries` prop to override or extend it.
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_PHONE_COUNTRIES = [
|
|
20
|
+
BRAZIL,
|
|
21
|
+
{ code: "US", name: "United States", dialCode: "1", flag: "🇺🇸", format: [3, 3, 4] },
|
|
22
|
+
{ code: "PT", name: "Portugal", dialCode: "351", flag: "🇵🇹", format: [3, 3, 3] },
|
|
23
|
+
{ code: "GB", name: "United Kingdom", dialCode: "44", flag: "🇬🇧", format: [4, 3, 3] },
|
|
24
|
+
{ code: "ES", name: "Spain", dialCode: "34", flag: "🇪🇸", format: [3, 3, 3] },
|
|
25
|
+
{ code: "FR", name: "France", dialCode: "33", flag: "🇫🇷", format: [1, 2, 2, 2, 2] },
|
|
26
|
+
{ code: "DE", name: "Germany", dialCode: "49", flag: "🇩🇪", format: [3, 4, 4] },
|
|
27
|
+
{ code: "IT", name: "Italy", dialCode: "39", flag: "🇮🇹", format: [3, 3, 4] },
|
|
28
|
+
{ code: "NL", name: "Netherlands", dialCode: "31", flag: "🇳🇱", format: [1, 4, 4] },
|
|
29
|
+
{ code: "MX", name: "Mexico", dialCode: "52", flag: "🇲🇽", format: [2, 4, 4] },
|
|
30
|
+
{ code: "AR", name: "Argentina", dialCode: "54", flag: "🇦🇷", format: [2, 4, 4] },
|
|
31
|
+
{ code: "CL", name: "Chile", dialCode: "56", flag: "🇨🇱", format: [1, 4, 4] },
|
|
32
|
+
{ code: "CO", name: "Colombia", dialCode: "57", flag: "🇨🇴", format: [3, 3, 4] },
|
|
33
|
+
{ code: "CA", name: "Canada", dialCode: "1", flag: "🇨🇦", format: [3, 3, 4] },
|
|
34
|
+
{ code: "AU", name: "Australia", dialCode: "61", flag: "🇦🇺", format: [3, 3, 3] },
|
|
35
|
+
{ code: "JP", name: "Japan", dialCode: "81", flag: "🇯🇵", format: [2, 4, 4] },
|
|
36
|
+
{ code: "IN", name: "India", dialCode: "91", flag: "🇮🇳", format: [5, 5] },
|
|
37
|
+
{ code: "CN", name: "China", dialCode: "86", flag: "🇨🇳", format: [3, 4, 4] },
|
|
38
|
+
{ code: "ZA", name: "South Africa", dialCode: "27", flag: "🇿🇦", format: [2, 3, 4] },
|
|
39
|
+
{ code: "AE", name: "United Arab Emirates", dialCode: "971", flag: "🇦🇪", format: [2, 3, 4] },
|
|
40
|
+
{ code: "NG", name: "Nigeria", dialCode: "234", flag: "🇳🇬", format: [3, 3, 4] },
|
|
41
|
+
{ code: "PH", name: "Philippines", dialCode: "63", flag: "🇵🇭", format: [3, 3, 4] },
|
|
42
|
+
];
|
|
43
|
+
/** E.164 caps the full number (country code + national) at 15 digits. */
|
|
44
|
+
const E164_MAX_DIGITS = 15;
|
|
45
|
+
/** Guaranteed-defined fallback for when a code can't be resolved (e.g. empty list). */
|
|
46
|
+
const FALLBACK_COUNTRY = BRAZIL;
|
|
47
|
+
const digitsOf = (input) => (input ?? "").replace(/\D+/g, "");
|
|
48
|
+
const maxNationalDigits = (country) => Math.max(0, E164_MAX_DIGITS - country.dialCode.length);
|
|
49
|
+
/** Group a run of digits into space-separated chunks per the country pattern. */
|
|
50
|
+
function formatNational(digits, groups) {
|
|
51
|
+
if (!groups || groups.length === 0) {
|
|
52
|
+
return digits;
|
|
53
|
+
}
|
|
54
|
+
const parts = [];
|
|
55
|
+
let index = 0;
|
|
56
|
+
for (const size of groups) {
|
|
57
|
+
if (index >= digits.length) {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
parts.push(digits.slice(index, index + size));
|
|
61
|
+
index += size;
|
|
62
|
+
}
|
|
63
|
+
if (index < digits.length) {
|
|
64
|
+
parts.push(digits.slice(index));
|
|
65
|
+
}
|
|
66
|
+
return parts.join(" ");
|
|
67
|
+
}
|
|
68
|
+
/** Placeholder mask derived from the grouping pattern, e.g. `00 00000 0000`. */
|
|
69
|
+
function maskFromFormat(groups) {
|
|
70
|
+
if (!groups || groups.length === 0) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
return groups.map((size) => "0".repeat(size)).join(" ");
|
|
74
|
+
}
|
|
75
|
+
/** Map a caret position expressed in digit-count onto the formatted string. */
|
|
76
|
+
function caretForDigitIndex(formatted, digitIndex) {
|
|
77
|
+
if (digitIndex <= 0) {
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
let seen = 0;
|
|
81
|
+
for (let i = 0; i < formatted.length; i += 1) {
|
|
82
|
+
if (formatted.charCodeAt(i) >= 48 && formatted.charCodeAt(i) <= 57) {
|
|
83
|
+
seen += 1;
|
|
84
|
+
if (seen === digitIndex) {
|
|
85
|
+
return i + 1;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return formatted.length;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Split an E.164 (or bare national) string into a country + national number.
|
|
93
|
+
* When the input starts with `+`, the country is resolved by the longest
|
|
94
|
+
* matching dial code, preferring the currently-selected country so that
|
|
95
|
+
* countries sharing a dial code (e.g. US/CA on `1`) don't snap around.
|
|
96
|
+
*/
|
|
97
|
+
function splitPhone(raw, countries, preferredCode) {
|
|
98
|
+
const trimmed = (raw ?? "").trim();
|
|
99
|
+
const digits = digitsOf(trimmed);
|
|
100
|
+
if (!trimmed.startsWith("+")) {
|
|
101
|
+
return { code: preferredCode, national: digits };
|
|
102
|
+
}
|
|
103
|
+
const preferred = countries.find((c) => c.code === preferredCode);
|
|
104
|
+
if (preferred && digits.startsWith(preferred.dialCode)) {
|
|
105
|
+
return { code: preferred.code, national: digits.slice(preferred.dialCode.length) };
|
|
106
|
+
}
|
|
107
|
+
let match;
|
|
108
|
+
for (const country of countries) {
|
|
109
|
+
if (digits.startsWith(country.dialCode) &&
|
|
110
|
+
(!match || country.dialCode.length > match.dialCode.length)) {
|
|
111
|
+
match = country;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (match) {
|
|
115
|
+
return { code: match.code, national: digits.slice(match.dialCode.length) };
|
|
116
|
+
}
|
|
117
|
+
return { code: preferred?.code ?? countries[0]?.code ?? preferredCode, national: digits };
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* An international phone input: a searchable country selector (flag + dial code)
|
|
121
|
+
* fused to a national-number field that auto-groups digits for the selected
|
|
122
|
+
* country and emits the composed E.164 string via `onChange`.
|
|
123
|
+
*
|
|
124
|
+
* Behavior & performance: digit grouping is computed with a lightweight
|
|
125
|
+
* per-country pattern (no libphonenumber). The caret is preserved across
|
|
126
|
+
* reformatting via a `useLayoutEffect` that reads a ref set during `onChange` —
|
|
127
|
+
* no timers, intervals, or RAF are scheduled. Country selection and typing both
|
|
128
|
+
* flow through `onChange`, so controlled and uncontrolled usage both work; a
|
|
129
|
+
* synchronising effect keeps controlled state aligned without loops.
|
|
130
|
+
*
|
|
131
|
+
* Accessibility: the root is a labelled `role="group"`; the trigger is a
|
|
132
|
+
* `role="combobox"` (expanded state announced) and the number field is a
|
|
133
|
+
* labelled `type="tel"` input, which is the forwarded ref. Every transition
|
|
134
|
+
* degrades under `prefers-reduced-motion: reduce`.
|
|
135
|
+
*/
|
|
136
|
+
export const PhoneInput = forwardRef(({ value, defaultValue, onChange, defaultCountry = "BR", countries = DEFAULT_PHONE_COUNTRIES, invalid = false, disabled = false, placeholder, searchPlaceholder = "Search country…", emptyText = "No country found.", label = "Phone number", countryLabel = "Select country", className, contentClassName, name, id, autoComplete = "tel-national", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...props }, ref) => {
|
|
137
|
+
const countryMap = useMemo(() => new Map(countries.map((country) => [country.code, country])), [countries]);
|
|
138
|
+
const isControlled = value !== undefined;
|
|
139
|
+
// Seed internal state once from `value`/`defaultValue`; later controlled
|
|
140
|
+
// updates flow through the sync effect below. Lazy initialisers run only on
|
|
141
|
+
// the first render, so this never reacts to prop changes.
|
|
142
|
+
const seed = () => {
|
|
143
|
+
const parsed = splitPhone(value ?? defaultValue, countries, defaultCountry);
|
|
144
|
+
const resolved = countryMap.get(parsed.code) ?? FALLBACK_COUNTRY;
|
|
145
|
+
return {
|
|
146
|
+
code: resolved.code,
|
|
147
|
+
national: parsed.national.slice(0, maxNationalDigits(resolved)),
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
const [open, setOpen] = useState(false);
|
|
151
|
+
const [countryCode, setCountryCode] = useState(() => seed().code);
|
|
152
|
+
const [national, setNational] = useState(() => seed().national);
|
|
153
|
+
const inputRef = useRef(null);
|
|
154
|
+
const caretRef = useRef(null);
|
|
155
|
+
const focusInputOnCloseRef = useRef(false);
|
|
156
|
+
const country = countryMap.get(countryCode) ?? FALLBACK_COUNTRY;
|
|
157
|
+
const maxDigits = maxNationalDigits(country);
|
|
158
|
+
const formattedValue = formatNational(national, country.format);
|
|
159
|
+
const e164 = national ? `+${country.dialCode}${national}` : "";
|
|
160
|
+
const setRef = useCallback((node) => {
|
|
161
|
+
inputRef.current = node;
|
|
162
|
+
if (typeof ref === "function") {
|
|
163
|
+
ref(node);
|
|
164
|
+
}
|
|
165
|
+
else if (ref) {
|
|
166
|
+
ref.current = node;
|
|
167
|
+
}
|
|
168
|
+
}, [ref]);
|
|
169
|
+
// Keep internal state aligned with a controlled `value` without re-render loops.
|
|
170
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: only re-sync when the controlled value changes.
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
if (!isControlled) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const parsed = splitPhone(value, countries, countryCode);
|
|
176
|
+
const nextCountry = countryMap.get(parsed.code) ?? FALLBACK_COUNTRY;
|
|
177
|
+
setCountryCode(nextCountry.code);
|
|
178
|
+
setNational(parsed.national.slice(0, maxNationalDigits(nextCountry)));
|
|
179
|
+
}, [value, isControlled]);
|
|
180
|
+
// Restore the caret after a reformat (runs before paint; no scheduled work).
|
|
181
|
+
useLayoutEffect(() => {
|
|
182
|
+
const node = inputRef.current;
|
|
183
|
+
if (node && caretRef.current !== null && document.activeElement === node) {
|
|
184
|
+
node.setSelectionRange(caretRef.current, caretRef.current);
|
|
185
|
+
}
|
|
186
|
+
caretRef.current = null;
|
|
187
|
+
});
|
|
188
|
+
const emit = useCallback((code, nationalDigits) => {
|
|
189
|
+
const dialCode = countryMap.get(code)?.dialCode ?? "";
|
|
190
|
+
onChange?.(nationalDigits ? `+${dialCode}${nationalDigits}` : "");
|
|
191
|
+
}, [countryMap, onChange]);
|
|
192
|
+
const handleNationalChange = useCallback((event) => {
|
|
193
|
+
const el = event.target;
|
|
194
|
+
const caret = el.selectionStart ?? el.value.length;
|
|
195
|
+
const digitsBeforeCaret = digitsOf(el.value.slice(0, caret)).length;
|
|
196
|
+
const nextDigits = digitsOf(el.value).slice(0, maxDigits);
|
|
197
|
+
caretRef.current = caretForDigitIndex(formatNational(nextDigits, country.format), digitsBeforeCaret);
|
|
198
|
+
setNational(nextDigits);
|
|
199
|
+
emit(countryCode, nextDigits);
|
|
200
|
+
}, [country.format, maxDigits, countryCode, emit]);
|
|
201
|
+
const handleSelectCountry = useCallback((code) => {
|
|
202
|
+
const next = countryMap.get(code);
|
|
203
|
+
if (!next) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const clamped = national.slice(0, maxNationalDigits(next));
|
|
207
|
+
setCountryCode(code);
|
|
208
|
+
setNational(clamped);
|
|
209
|
+
emit(code, clamped);
|
|
210
|
+
focusInputOnCloseRef.current = true;
|
|
211
|
+
setOpen(false);
|
|
212
|
+
}, [national, countryMap, emit]);
|
|
213
|
+
return (_jsxs("div", { "data-slot": "phone-input", role: "group", "aria-label": ariaLabel ?? label, "aria-labelledby": ariaLabelledby, "aria-disabled": disabled || undefined, "data-invalid": invalid || undefined, className: cn("flex h-10 w-full items-center rounded-lg border border-border bg-surface-inset text-fg", "transition-[border-color,box-shadow] duration-150 ease-[var(--ease-out-quart)] motion-reduce:transition-none", "focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-surface-base", invalid && "border-error focus-within:ring-error focus-within:ring-offset-surface-base", disabled && "opacity-50", className), children: [_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", role: "combobox", "aria-expanded": open, "aria-haspopup": "listbox", "aria-label": `${countryLabel}. ${country.name}, +${country.dialCode}`, disabled: disabled, "data-slot": "phone-input-country", className: cn("flex h-full shrink-0 items-center gap-1.5 rounded-l-lg pr-2 pl-3 text-sm outline-none", "text-fg-secondary transition-colors duration-150 ease-[var(--ease-out-quart)] motion-reduce:transition-none", "hover:bg-surface-overlay focus-visible:bg-surface-overlay disabled:pointer-events-none"), children: [_jsx("span", { "aria-hidden": "true", className: "text-base leading-none", children: country.flag }), _jsxs("span", { className: "tabular-nums", children: ["+", country.dialCode] }), _jsx(ChevronDown, { "aria-hidden": "true", "data-open": open || undefined, className: "size-3.5 text-fg-tertiary transition-transform duration-200 ease-[var(--ease-out-quart)] data-[open]:rotate-180 motion-reduce:transition-none" })] }) }), _jsx(PopoverContent, { align: "start", sideOffset: 8, "data-slot": "phone-input-content", onCloseAutoFocus: (event) => {
|
|
214
|
+
if (focusInputOnCloseRef.current) {
|
|
215
|
+
event.preventDefault();
|
|
216
|
+
focusInputOnCloseRef.current = false;
|
|
217
|
+
inputRef.current?.focus();
|
|
218
|
+
}
|
|
219
|
+
}, className: cn("w-[280px] p-0", contentClassName), children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: searchPlaceholder }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: emptyText }), countries.map((item) => {
|
|
220
|
+
const isSelected = item.code === countryCode;
|
|
221
|
+
return (_jsxs(CommandItem, { value: `${item.name} +${item.dialCode} ${item.code}`, onSelect: () => handleSelectCountry(item.code), children: [_jsx("span", { "aria-hidden": "true", className: "text-base leading-none", children: item.flag }), _jsx("span", { className: "flex-1 truncate", children: item.name }), _jsxs("span", { className: "shrink-0 text-fg-tertiary tabular-nums", children: ["+", item.dialCode] }), _jsx(Check, { "aria-hidden": "true", className: cn("size-4 shrink-0 text-primary", isSelected ? "opacity-100" : "opacity-0") }), isSelected ? _jsx("span", { className: "sr-only", children: ", selected" }) : null] }, item.code));
|
|
222
|
+
})] })] }) })] }), _jsx("span", { "aria-hidden": "true", className: "h-5 w-px shrink-0 bg-border" }), _jsx("input", { ref: setRef, id: id, type: "tel", inputMode: "tel", autoComplete: autoComplete, disabled: disabled, "aria-label": ariaLabelledby ? undefined : (ariaLabel ?? label), "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-invalid": invalid || undefined, "data-slot": "phone-input-field", placeholder: placeholder ?? maskFromFormat(country.format), value: formattedValue, onChange: handleNationalChange, className: cn("h-full min-w-0 flex-1 bg-transparent px-3 text-sm text-fg outline-none", "placeholder:text-fg-tertiary disabled:pointer-events-none", "selection:bg-primary selection:text-primary-foreground"), ...props }), name ? _jsx("input", { type: "hidden", name: name, value: e164 }) : null] }));
|
|
223
|
+
});
|
|
224
|
+
PhoneInput.displayName = "PhoneInput";
|
|
225
|
+
//# sourceMappingURL=phone-input.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
import { type ChartSeries } from "./chart.js";
|
|
3
|
+
export interface PieChartItem {
|
|
4
|
+
key: string;
|
|
5
|
+
value: number;
|
|
6
|
+
}
|
|
7
|
+
export interface PieChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
data: PieChartItem[];
|
|
9
|
+
series: ChartSeries[];
|
|
10
|
+
}
|
|
11
|
+
export declare function PieChart({ data, series, className, ...props }: PieChartProps): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=pie-chart.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Cell, Pie, PieChart as RechartsPieChart } from "recharts";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { ChartContainer, ChartTooltip, ChartTooltipContent, chartSeriesConfig, } from "./chart.js";
|
|
5
|
+
export function PieChart({ data, series, className, ...props }) {
|
|
6
|
+
const config = chartSeriesConfig(series);
|
|
7
|
+
const rows = data.map((item) => ({
|
|
8
|
+
...item,
|
|
9
|
+
fill: `var(--color-${item.key})`,
|
|
10
|
+
}));
|
|
11
|
+
return (_jsx("div", { "data-slot": "pie-chart", className: cn("h-64 w-full", className), ...props, children: _jsx(ChartContainer, { config: config, className: "h-full w-full", children: _jsxs(RechartsPieChart, { accessibilityLayer: true, children: [_jsx(ChartTooltip, { content: _jsx(ChartTooltipContent, { hideLabel: true }) }), _jsx(Pie, { data: rows, dataKey: "value", nameKey: "key", strokeWidth: 0, children: rows.map((item) => (_jsx(Cell, { fill: item.fill }, item.key))) })] }) }) }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=pie-chart.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode, type Ref } from "react";
|
|
2
|
+
export interface PillNavItem {
|
|
3
|
+
value: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface PillNavProps extends Omit<HTMLAttributes<HTMLElement>, "onChange"> {
|
|
8
|
+
ref?: Ref<HTMLElement>;
|
|
9
|
+
items: PillNavItem[];
|
|
10
|
+
/** Controlled selected value. */
|
|
11
|
+
value?: string;
|
|
12
|
+
/** Initial selected value when uncontrolled. */
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
onValueChange?: (value: string) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A compact navigation row whose active item is marked by a sliding pill.
|
|
18
|
+
* Keyboard: Left/Right (and Up/Down) move selection; Home/End jump. The
|
|
19
|
+
* sliding thumb is decorative — selection is exposed as `aria-current`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function PillNav({ ref, className, items, value, defaultValue, onValueChange, ...props }: PillNavProps): import("react").JSX.Element;
|
|
22
|
+
export declare namespace PillNav {
|
|
23
|
+
var displayName: string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=pill-nav.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
4
|
+
import { useId, useState, } from "react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
/**
|
|
7
|
+
* A compact navigation row whose active item is marked by a sliding pill.
|
|
8
|
+
* Keyboard: Left/Right (and Up/Down) move selection; Home/End jump. The
|
|
9
|
+
* sliding thumb is decorative — selection is exposed as `aria-current`.
|
|
10
|
+
*/
|
|
11
|
+
export function PillNav({ ref, className, items, value, defaultValue, onValueChange, ...props }) {
|
|
12
|
+
const reduce = !!useReducedMotion();
|
|
13
|
+
const layoutId = useId();
|
|
14
|
+
const enabled = items.filter((item) => !item.disabled);
|
|
15
|
+
const fallback = defaultValue ?? enabled[0]?.value;
|
|
16
|
+
const [uncontrolled, setUncontrolled] = useState(fallback);
|
|
17
|
+
const selected = value ?? uncontrolled;
|
|
18
|
+
const select = (next) => {
|
|
19
|
+
if (next === selected)
|
|
20
|
+
return;
|
|
21
|
+
if (value === undefined)
|
|
22
|
+
setUncontrolled(next);
|
|
23
|
+
onValueChange?.(next);
|
|
24
|
+
};
|
|
25
|
+
const move = (from, direction) => {
|
|
26
|
+
if (enabled.length === 0)
|
|
27
|
+
return;
|
|
28
|
+
const index = enabled.findIndex((item) => item.value === from);
|
|
29
|
+
const current = index === -1 ? 0 : index;
|
|
30
|
+
const last = enabled.length - 1;
|
|
31
|
+
const nextIndex = direction === "first"
|
|
32
|
+
? 0
|
|
33
|
+
: direction === "last"
|
|
34
|
+
? last
|
|
35
|
+
: direction === "next"
|
|
36
|
+
? Math.min(last, current + 1)
|
|
37
|
+
: Math.max(0, current - 1);
|
|
38
|
+
const next = enabled[nextIndex];
|
|
39
|
+
if (next)
|
|
40
|
+
select(next.value);
|
|
41
|
+
};
|
|
42
|
+
const onKeyDown = (event, current) => {
|
|
43
|
+
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
move(current, "next");
|
|
46
|
+
}
|
|
47
|
+
else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
move(current, "prev");
|
|
50
|
+
}
|
|
51
|
+
else if (event.key === "Home") {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
move(current, "first");
|
|
54
|
+
}
|
|
55
|
+
else if (event.key === "End") {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
move(current, "last");
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return (_jsx("nav", { ref: ref, "data-slot": "pill-nav", className: cn("inline-flex items-center gap-1 rounded-full border border-border bg-surface-inset p-1", className), ...props, children: items.map((item) => {
|
|
61
|
+
const isActive = item.value === selected;
|
|
62
|
+
return (_jsxs("button", { type: "button", "data-slot": "pill-nav-item", disabled: item.disabled, "aria-current": isActive ? "page" : undefined, tabIndex: isActive ? 0 : -1, className: cn("relative z-0 rounded-full px-3.5 py-1.5 text-sm font-medium text-fg-secondary outline-none transition-colors 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", isActive && "text-fg"), onClick: () => select(item.value), onKeyDown: (event) => onKeyDown(event, item.value), children: [isActive ? (_jsx(motion.span, { layoutId: reduce ? undefined : layoutId, "aria-hidden": "true", className: "absolute inset-0 -z-10 rounded-full bg-surface-floating shadow-xs", transition: reduce ? { duration: 0 } : { type: "spring", bounce: 0.15, duration: 0.4 } })) : null, item.label] }, item.value));
|
|
63
|
+
}) }));
|
|
64
|
+
}
|
|
65
|
+
PillNav.displayName = "PillNav";
|
|
66
|
+
//# sourceMappingURL=pill-nav.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
2
|
+
import { type ComponentProps } from "react";
|
|
3
|
+
export declare function Popover({ modal, ...props }: ComponentProps<typeof PopoverPrimitive.Root>): import("react").JSX.Element;
|
|
4
|
+
export declare const PopoverTrigger: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export declare const PopoverAnchor: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const PopoverContent: import("react").ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
+
import { forwardRef, } from "react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
export function Popover({ modal = false, ...props }) {
|
|
7
|
+
return _jsx(PopoverPrimitive.Root, { modal: modal, ...props });
|
|
8
|
+
}
|
|
9
|
+
export const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
10
|
+
export const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
11
|
+
export const PopoverContent = forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => {
|
|
12
|
+
return (_jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { ref: ref, "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: cn("z-50 w-72 rounded-lg border border-border bg-surface-floating p-3 text-fg shadow-lg outline-none data-[state=open]:animate-[cronus-pop-in_180ms_var(--ease-out-quart)_both] data-[state=closed]:animate-[cronus-pop-out_140ms_var(--ease-out-quart)_both]", className), ...props }) }));
|
|
13
|
+
});
|
|
14
|
+
PopoverContent.displayName = "PopoverContent";
|
|
15
|
+
//# sourceMappingURL=popover.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export interface ProfitLossPoint {
|
|
3
|
+
month: string;
|
|
4
|
+
pnl: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ProfitLossChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
data: ProfitLossPoint[];
|
|
8
|
+
}
|
|
9
|
+
export declare function ProfitLossChart({ data, className, ...props }: ProfitLossChartProps): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=profit-loss-chart.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CartesianGrid, Line, LineChart, ReferenceLine, XAxis } from "recharts";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { ChartContainer, ChartCursor, ChartTooltip, ChartTooltipContent } from "./chart.js";
|
|
5
|
+
export function ProfitLossChart({ data, className, ...props }) {
|
|
6
|
+
return (_jsx("div", { "data-slot": "profit-loss-chart", className: cn("h-64 w-full", className), ...props, children: _jsx(ChartContainer, { config: { pnl: { label: "P/L", color: "var(--cronus-success)" } }, className: "h-full w-full", children: _jsxs(LineChart, { accessibilityLayer: true, data: data, margin: { left: 8, right: 8, top: 8 }, children: [_jsx(CartesianGrid, { vertical: false, strokeDasharray: "4 4" }), _jsx(ReferenceLine, { y: 0, stroke: "var(--cronus-border)" }), _jsx(XAxis, { dataKey: "month", tickLine: false, axisLine: false, tickMargin: 12 }), _jsx(ChartTooltip, { cursor: _jsx(ChartCursor, { labelKey: "month" }), content: _jsx(ChartTooltipContent, {}) }), _jsx(Line, { type: "monotone", dataKey: "pnl", stroke: "var(--cronus-success)", strokeWidth: 2, dot: false })] }) }) }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=profit-loss-chart.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
2
|
+
/**
|
|
3
|
+
* A determinate/indeterminate progress bar. The Radix Root is the
|
|
4
|
+
* `role="progressbar"` element, so `aria-label`/`aria-labelledby` (and any
|
|
5
|
+
* other prop) spread straight onto it — always pass one describing what the
|
|
6
|
+
* bar measures (e.g. "Upload progress") so the progressbar has an accessible
|
|
7
|
+
* name and satisfies `aria-progressbar-name` (WCAG 4.1.2).
|
|
8
|
+
*/
|
|
9
|
+
export declare const Progress: import("react").ForwardRefExoticComponent<Omit<ProgressPrimitive.ProgressProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
//# sourceMappingURL=progress.d.ts.map
|