@epilot/spark-ui 0.10.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 +201 -0
- package/NOTICE +2 -0
- package/README.md +32 -0
- package/dist/chunk-DY84GLCh.cjs +29 -0
- package/dist/components/accordion.cjs +57 -0
- package/dist/components/accordion.cjs.map +1 -0
- package/dist/components/accordion.d.cts +44 -0
- package/dist/components/accordion.d.ts +44 -0
- package/dist/components/accordion.js +51 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-dialog.cjs +137 -0
- package/dist/components/alert-dialog.cjs.map +1 -0
- package/dist/components/alert-dialog.d.cts +62 -0
- package/dist/components/alert-dialog.d.ts +62 -0
- package/dist/components/alert-dialog.js +123 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/attachment.cjs +119 -0
- package/dist/components/attachment.cjs.map +1 -0
- package/dist/components/attachment.d.cts +65 -0
- package/dist/components/attachment.d.ts +65 -0
- package/dist/components/attachment.js +108 -0
- package/dist/components/attachment.js.map +1 -0
- package/dist/components/avatar.cjs +56 -0
- package/dist/components/avatar.cjs.map +1 -0
- package/dist/components/avatar.d.cts +26 -0
- package/dist/components/avatar.d.ts +26 -0
- package/dist/components/avatar.js +52 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.cjs +25 -0
- package/dist/components/badge.cjs.map +1 -0
- package/dist/components/badge.d.cts +16 -0
- package/dist/components/badge.d.ts +16 -0
- package/dist/components/badge.js +22 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/bar-chart.cjs +584 -0
- package/dist/components/bar-chart.cjs.map +1 -0
- package/dist/components/bar-chart.d.cts +102 -0
- package/dist/components/bar-chart.d.ts +102 -0
- package/dist/components/bar-chart.js +583 -0
- package/dist/components/bar-chart.js.map +1 -0
- package/dist/components/battery-progress-row.cjs +133 -0
- package/dist/components/battery-progress-row.cjs.map +1 -0
- package/dist/components/battery-progress-row.d.cts +77 -0
- package/dist/components/battery-progress-row.d.ts +77 -0
- package/dist/components/battery-progress-row.js +123 -0
- package/dist/components/battery-progress-row.js.map +1 -0
- package/dist/components/breadcrumbs.cjs +64 -0
- package/dist/components/breadcrumbs.cjs.map +1 -0
- package/dist/components/breadcrumbs.d.cts +42 -0
- package/dist/components/breadcrumbs.d.ts +42 -0
- package/dist/components/breadcrumbs.js +58 -0
- package/dist/components/breadcrumbs.js.map +1 -0
- package/dist/components/bubble.cjs +84 -0
- package/dist/components/bubble.cjs.map +1 -0
- package/dist/components/bubble.d.cts +39 -0
- package/dist/components/bubble.d.ts +39 -0
- package/dist/components/bubble.js +78 -0
- package/dist/components/bubble.js.map +1 -0
- package/dist/components/button-group.cjs +72 -0
- package/dist/components/button-group.cjs.map +1 -0
- package/dist/components/button-group.d.cts +29 -0
- package/dist/components/button-group.d.ts +29 -0
- package/dist/components/button-group.js +64 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/button.cjs +58 -0
- package/dist/components/button.cjs.map +1 -0
- package/dist/components/button.d.cts +29 -0
- package/dist/components/button.d.ts +29 -0
- package/dist/components/button.js +54 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.cjs +59 -0
- package/dist/components/calendar.cjs.map +1 -0
- package/dist/components/calendar.d.cts +20 -0
- package/dist/components/calendar.d.ts +20 -0
- package/dist/components/calendar.js +56 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/callout.cjs +95 -0
- package/dist/components/callout.cjs.map +1 -0
- package/dist/components/callout.d.cts +42 -0
- package/dist/components/callout.d.ts +42 -0
- package/dist/components/callout.js +88 -0
- package/dist/components/callout.js.map +1 -0
- package/dist/components/card.cjs +100 -0
- package/dist/components/card.cjs.map +1 -0
- package/dist/components/card.d.cts +34 -0
- package/dist/components/card.d.ts +34 -0
- package/dist/components/card.js +90 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/chart.cjs +110 -0
- package/dist/components/chart.cjs.map +1 -0
- package/dist/components/chart.d.cts +92 -0
- package/dist/components/chart.d.ts +92 -0
- package/dist/components/chart.js +104 -0
- package/dist/components/chart.js.map +1 -0
- package/dist/components/checkbox.cjs +44 -0
- package/dist/components/checkbox.cjs.map +1 -0
- package/dist/components/checkbox.d.cts +26 -0
- package/dist/components/checkbox.d.ts +26 -0
- package/dist/components/checkbox.js +41 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/circular-gauge.cjs +74 -0
- package/dist/components/circular-gauge.cjs.map +1 -0
- package/dist/components/circular-gauge.d.cts +37 -0
- package/dist/components/circular-gauge.d.ts +37 -0
- package/dist/components/circular-gauge.js +71 -0
- package/dist/components/circular-gauge.js.map +1 -0
- package/dist/components/day-of-week-picker.cjs +123 -0
- package/dist/components/day-of-week-picker.cjs.map +1 -0
- package/dist/components/day-of-week-picker.d.cts +39 -0
- package/dist/components/day-of-week-picker.d.ts +39 -0
- package/dist/components/day-of-week-picker.js +119 -0
- package/dist/components/day-of-week-picker.js.map +1 -0
- package/dist/components/device-card.cjs +118 -0
- package/dist/components/device-card.cjs.map +1 -0
- package/dist/components/device-card.d.cts +70 -0
- package/dist/components/device-card.d.ts +70 -0
- package/dist/components/device-card.js +104 -0
- package/dist/components/device-card.js.map +1 -0
- package/dist/components/dialog.cjs +115 -0
- package/dist/components/dialog.cjs.map +1 -0
- package/dist/components/dialog.d.cts +44 -0
- package/dist/components/dialog.d.ts +44 -0
- package/dist/components/dialog.js +103 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/donut-chart.cjs +70 -0
- package/dist/components/donut-chart.cjs.map +1 -0
- package/dist/components/donut-chart.d.cts +20 -0
- package/dist/components/donut-chart.d.ts +20 -0
- package/dist/components/donut-chart.js +69 -0
- package/dist/components/donut-chart.js.map +1 -0
- package/dist/components/drawer.cjs +95 -0
- package/dist/components/drawer.cjs.map +1 -0
- package/dist/components/drawer.d.cts +45 -0
- package/dist/components/drawer.d.ts +45 -0
- package/dist/components/drawer.js +83 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.cjs +165 -0
- package/dist/components/dropdown-menu.cjs.map +1 -0
- package/dist/components/dropdown-menu.d.cts +92 -0
- package/dist/components/dropdown-menu.d.ts +92 -0
- package/dist/components/dropdown-menu.js +148 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/empty-state.cjs +41 -0
- package/dist/components/empty-state.cjs.map +1 -0
- package/dist/components/empty-state.d.cts +26 -0
- package/dist/components/empty-state.d.ts +26 -0
- package/dist/components/empty-state.js +41 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/energy-bar-chart.cjs +23 -0
- package/dist/components/energy-bar-chart.cjs.map +1 -0
- package/dist/components/energy-bar-chart.d.cts +43 -0
- package/dist/components/energy-bar-chart.d.ts +43 -0
- package/dist/components/energy-bar-chart.js +22 -0
- package/dist/components/energy-bar-chart.js.map +1 -0
- package/dist/components/energy-breakdown.cjs +80 -0
- package/dist/components/energy-breakdown.cjs.map +1 -0
- package/dist/components/energy-breakdown.d.cts +24 -0
- package/dist/components/energy-breakdown.d.ts +24 -0
- package/dist/components/energy-breakdown.js +79 -0
- package/dist/components/energy-breakdown.js.map +1 -0
- package/dist/components/energy-history-chart.cjs +63 -0
- package/dist/components/energy-history-chart.cjs.map +1 -0
- package/dist/components/energy-history-chart.d.cts +64 -0
- package/dist/components/energy-history-chart.d.ts +64 -0
- package/dist/components/energy-history-chart.js +62 -0
- package/dist/components/energy-history-chart.js.map +1 -0
- package/dist/components/feed-in-hero.cjs +55 -0
- package/dist/components/feed-in-hero.cjs.map +1 -0
- package/dist/components/feed-in-hero.d.cts +32 -0
- package/dist/components/feed-in-hero.d.ts +32 -0
- package/dist/components/feed-in-hero.js +51 -0
- package/dist/components/feed-in-hero.js.map +1 -0
- package/dist/components/field.cjs +257 -0
- package/dist/components/field.cjs.map +1 -0
- package/dist/components/field.d.cts +103 -0
- package/dist/components/field.d.ts +103 -0
- package/dist/components/field.js +243 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/icon.cjs +35 -0
- package/dist/components/icon.cjs.map +1 -0
- package/dist/components/icon.d.cts +26 -0
- package/dist/components/icon.d.ts +26 -0
- package/dist/components/icon.js +32 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/info-block.cjs +75 -0
- package/dist/components/info-block.cjs.map +1 -0
- package/dist/components/info-block.d.cts +19 -0
- package/dist/components/info-block.d.ts +19 -0
- package/dist/components/info-block.js +65 -0
- package/dist/components/info-block.js.map +1 -0
- package/dist/components/input-group.cjs +165 -0
- package/dist/components/input-group.cjs.map +1 -0
- package/dist/components/input-group.d.cts +27 -0
- package/dist/components/input-group.d.ts +27 -0
- package/dist/components/input-group.js +159 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input-otp.cjs +112 -0
- package/dist/components/input-otp.cjs.map +1 -0
- package/dist/components/input-otp.d.cts +24 -0
- package/dist/components/input-otp.d.ts +24 -0
- package/dist/components/input-otp.js +111 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/input.cjs +113 -0
- package/dist/components/input.cjs.map +1 -0
- package/dist/components/input.d.cts +14 -0
- package/dist/components/input.d.ts +14 -0
- package/dist/components/input.js +110 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.cjs +18 -0
- package/dist/components/label.cjs.map +1 -0
- package/dist/components/label.d.cts +10 -0
- package/dist/components/label.d.ts +10 -0
- package/dist/components/label.js +15 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/layout.cjs +14 -0
- package/dist/components/layout.cjs.map +1 -0
- package/dist/components/layout.d.cts +11 -0
- package/dist/components/layout.d.ts +12 -0
- package/dist/components/layout.js +14 -0
- package/dist/components/layout.js.map +1 -0
- package/dist/components/line-chart.cjs +538 -0
- package/dist/components/line-chart.cjs.map +1 -0
- package/dist/components/line-chart.d.cts +90 -0
- package/dist/components/line-chart.d.ts +90 -0
- package/dist/components/line-chart.js +536 -0
- package/dist/components/line-chart.js.map +1 -0
- package/dist/components/list.cjs +132 -0
- package/dist/components/list.cjs.map +1 -0
- package/dist/components/list.d.cts +71 -0
- package/dist/components/list.d.ts +71 -0
- package/dist/components/list.js +122 -0
- package/dist/components/list.js.map +1 -0
- package/dist/components/marker.cjs +52 -0
- package/dist/components/marker.cjs.map +1 -0
- package/dist/components/marker.d.cts +27 -0
- package/dist/components/marker.d.ts +27 -0
- package/dist/components/marker.js +46 -0
- package/dist/components/marker.js.map +1 -0
- package/dist/components/message-scroller.cjs +73 -0
- package/dist/components/message-scroller.cjs.map +1 -0
- package/dist/components/message-scroller.d.cts +38 -0
- package/dist/components/message-scroller.d.ts +38 -0
- package/dist/components/message-scroller.js +62 -0
- package/dist/components/message-scroller.js.map +1 -0
- package/dist/components/message.cjs +60 -0
- package/dist/components/message.cjs.map +1 -0
- package/dist/components/message.d.cts +35 -0
- package/dist/components/message.d.ts +35 -0
- package/dist/components/message.js +52 -0
- package/dist/components/message.js.map +1 -0
- package/dist/components/metering-row.cjs +42 -0
- package/dist/components/metering-row.cjs.map +1 -0
- package/dist/components/metering-row.d.cts +31 -0
- package/dist/components/metering-row.d.ts +31 -0
- package/dist/components/metering-row.js +38 -0
- package/dist/components/metering-row.js.map +1 -0
- package/dist/components/money-saved-block.cjs +86 -0
- package/dist/components/money-saved-block.cjs.map +1 -0
- package/dist/components/money-saved-block.d.cts +55 -0
- package/dist/components/money-saved-block.d.ts +55 -0
- package/dist/components/money-saved-block.js +79 -0
- package/dist/components/money-saved-block.js.map +1 -0
- package/dist/components/number-flow.cjs +44 -0
- package/dist/components/number-flow.cjs.map +1 -0
- package/dist/components/number-flow.d.cts +4 -0
- package/dist/components/number-flow.d.ts +4 -0
- package/dist/components/number-flow.js +42 -0
- package/dist/components/number-flow.js.map +1 -0
- package/dist/components/on-off-button.cjs +35 -0
- package/dist/components/on-off-button.cjs.map +1 -0
- package/dist/components/on-off-button.d.cts +18 -0
- package/dist/components/on-off-button.d.ts +18 -0
- package/dist/components/on-off-button.js +34 -0
- package/dist/components/on-off-button.js.map +1 -0
- package/dist/components/onboarding-layout.cjs +67 -0
- package/dist/components/onboarding-layout.cjs.map +1 -0
- package/dist/components/onboarding-layout.d.cts +44 -0
- package/dist/components/onboarding-layout.d.ts +44 -0
- package/dist/components/onboarding-layout.js +60 -0
- package/dist/components/onboarding-layout.js.map +1 -0
- package/dist/components/page-header.cjs +50 -0
- package/dist/components/page-header.cjs.map +1 -0
- package/dist/components/page-header.d.cts +25 -0
- package/dist/components/page-header.d.ts +25 -0
- package/dist/components/page-header.js +44 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/page-spinner.cjs +18 -0
- package/dist/components/page-spinner.cjs.map +1 -0
- package/dist/components/page-spinner.d.cts +12 -0
- package/dist/components/page-spinner.d.ts +12 -0
- package/dist/components/page-spinner.js +17 -0
- package/dist/components/page-spinner.js.map +1 -0
- package/dist/components/period-tabs.cjs +78 -0
- package/dist/components/period-tabs.cjs.map +1 -0
- package/dist/components/period-tabs.d.cts +50 -0
- package/dist/components/period-tabs.d.ts +50 -0
- package/dist/components/period-tabs.js +73 -0
- package/dist/components/period-tabs.js.map +1 -0
- package/dist/components/pill.cjs +62 -0
- package/dist/components/pill.cjs.map +1 -0
- package/dist/components/pill.d.cts +29 -0
- package/dist/components/pill.d.ts +29 -0
- package/dist/components/pill.js +59 -0
- package/dist/components/pill.js.map +1 -0
- package/dist/components/popover.cjs +62 -0
- package/dist/components/popover.cjs.map +1 -0
- package/dist/components/popover.d.cts +28 -0
- package/dist/components/popover.d.ts +28 -0
- package/dist/components/popover.js +56 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/power-history-chart.cjs +498 -0
- package/dist/components/power-history-chart.cjs.map +1 -0
- package/dist/components/power-history-chart.d.cts +71 -0
- package/dist/components/power-history-chart.d.ts +71 -0
- package/dist/components/power-history-chart.js +496 -0
- package/dist/components/power-history-chart.js.map +1 -0
- package/dist/components/power-history.cjs +114 -0
- package/dist/components/power-history.cjs.map +1 -0
- package/dist/components/power-history.d.cts +40 -0
- package/dist/components/power-history.d.ts +41 -0
- package/dist/components/power-history.js +114 -0
- package/dist/components/power-history.js.map +1 -0
- package/dist/components/power-network.cjs +562 -0
- package/dist/components/power-network.cjs.map +1 -0
- package/dist/components/power-network.d.cts +80 -0
- package/dist/components/power-network.d.ts +80 -0
- package/dist/components/power-network.js +556 -0
- package/dist/components/power-network.js.map +1 -0
- package/dist/components/progress.cjs +34 -0
- package/dist/components/progress.cjs.map +1 -0
- package/dist/components/progress.d.cts +17 -0
- package/dist/components/progress.d.ts +17 -0
- package/dist/components/progress.js +31 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-card-group.cjs +94 -0
- package/dist/components/radio-card-group.cjs.map +1 -0
- package/dist/components/radio-card-group.d.cts +21 -0
- package/dist/components/radio-card-group.d.ts +21 -0
- package/dist/components/radio-card-group.js +90 -0
- package/dist/components/radio-card-group.js.map +1 -0
- package/dist/components/radio.cjs +41 -0
- package/dist/components/radio.cjs.map +1 -0
- package/dist/components/radio.d.cts +32 -0
- package/dist/components/radio.d.ts +32 -0
- package/dist/components/radio.js +37 -0
- package/dist/components/radio.js.map +1 -0
- package/dist/components/reparent.cjs +55 -0
- package/dist/components/reparent.cjs.map +1 -0
- package/dist/components/reparent.d.cts +28 -0
- package/dist/components/reparent.d.ts +28 -0
- package/dist/components/reparent.js +49 -0
- package/dist/components/reparent.js.map +1 -0
- package/dist/components/sankey-chart.cjs +187 -0
- package/dist/components/sankey-chart.cjs.map +1 -0
- package/dist/components/sankey-chart.d.cts +66 -0
- package/dist/components/sankey-chart.d.ts +66 -0
- package/dist/components/sankey-chart.js +185 -0
- package/dist/components/sankey-chart.js.map +1 -0
- package/dist/components/schedule-editor.cjs +82 -0
- package/dist/components/schedule-editor.cjs.map +1 -0
- package/dist/components/schedule-editor.d.cts +25 -0
- package/dist/components/schedule-editor.d.ts +25 -0
- package/dist/components/schedule-editor.js +72 -0
- package/dist/components/schedule-editor.js.map +1 -0
- package/dist/components/schedule-list.cjs +110 -0
- package/dist/components/schedule-list.cjs.map +1 -0
- package/dist/components/schedule-list.d.cts +29 -0
- package/dist/components/schedule-list.d.ts +29 -0
- package/dist/components/schedule-list.js +99 -0
- package/dist/components/schedule-list.js.map +1 -0
- package/dist/components/scroll-area.cjs +53 -0
- package/dist/components/scroll-area.cjs.map +1 -0
- package/dist/components/scroll-area.d.cts +24 -0
- package/dist/components/scroll-area.d.ts +24 -0
- package/dist/components/scroll-area.js +44 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/segmented-control.cjs +44 -0
- package/dist/components/segmented-control.cjs.map +1 -0
- package/dist/components/segmented-control.d.cts +32 -0
- package/dist/components/segmented-control.d.ts +32 -0
- package/dist/components/segmented-control.js +40 -0
- package/dist/components/segmented-control.js.map +1 -0
- package/dist/components/select.cjs +136 -0
- package/dist/components/select.cjs.map +1 -0
- package/dist/components/select.d.cts +62 -0
- package/dist/components/select.d.ts +62 -0
- package/dist/components/select.js +124 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.cjs +38 -0
- package/dist/components/separator.cjs.map +1 -0
- package/dist/components/separator.d.cts +13 -0
- package/dist/components/separator.d.ts +13 -0
- package/dist/components/separator.js +35 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/series-legend.cjs +38 -0
- package/dist/components/series-legend.cjs.map +1 -0
- package/dist/components/series-legend.d.cts +29 -0
- package/dist/components/series-legend.d.ts +29 -0
- package/dist/components/series-legend.js +37 -0
- package/dist/components/series-legend.js.map +1 -0
- package/dist/components/sheet.cjs +102 -0
- package/dist/components/sheet.cjs.map +1 -0
- package/dist/components/sheet.d.cts +45 -0
- package/dist/components/sheet.d.ts +45 -0
- package/dist/components/sheet.js +90 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/skeleton.cjs +23 -0
- package/dist/components/skeleton.cjs.map +1 -0
- package/dist/components/skeleton.d.cts +23 -0
- package/dist/components/skeleton.d.ts +23 -0
- package/dist/components/skeleton.js +21 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.cjs +263 -0
- package/dist/components/slider.cjs.map +1 -0
- package/dist/components/slider.d.cts +136 -0
- package/dist/components/slider.d.ts +136 -0
- package/dist/components/slider.js +253 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/smart-toggle-button.cjs +27 -0
- package/dist/components/smart-toggle-button.cjs.map +1 -0
- package/dist/components/smart-toggle-button.d.cts +16 -0
- package/dist/components/smart-toggle-button.d.ts +16 -0
- package/dist/components/smart-toggle-button.js +26 -0
- package/dist/components/smart-toggle-button.js.map +1 -0
- package/dist/components/solar-forecast-chart.cjs +109 -0
- package/dist/components/solar-forecast-chart.cjs.map +1 -0
- package/dist/components/solar-forecast-chart.d.cts +77 -0
- package/dist/components/solar-forecast-chart.d.ts +77 -0
- package/dist/components/solar-forecast-chart.js +104 -0
- package/dist/components/solar-forecast-chart.js.map +1 -0
- package/dist/components/sortable-list.cjs +68 -0
- package/dist/components/sortable-list.cjs.map +1 -0
- package/dist/components/sortable-list.d.cts +45 -0
- package/dist/components/sortable-list.d.ts +45 -0
- package/dist/components/sortable-list.js +67 -0
- package/dist/components/sortable-list.js.map +1 -0
- package/dist/components/spinner.cjs +42 -0
- package/dist/components/spinner.cjs.map +1 -0
- package/dist/components/spinner.d.cts +15 -0
- package/dist/components/spinner.d.ts +15 -0
- package/dist/components/spinner.js +39 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stat-card.cjs +57 -0
- package/dist/components/stat-card.cjs.map +1 -0
- package/dist/components/stat-card.d.cts +34 -0
- package/dist/components/stat-card.d.ts +34 -0
- package/dist/components/stat-card.js +50 -0
- package/dist/components/stat-card.js.map +1 -0
- package/dist/components/stepper.cjs +79 -0
- package/dist/components/stepper.cjs.map +1 -0
- package/dist/components/stepper.d.cts +33 -0
- package/dist/components/stepper.d.ts +33 -0
- package/dist/components/stepper.js +76 -0
- package/dist/components/stepper.js.map +1 -0
- package/dist/components/switch.cjs +26 -0
- package/dist/components/switch.cjs.map +1 -0
- package/dist/components/switch.d.cts +32 -0
- package/dist/components/switch.d.ts +32 -0
- package/dist/components/switch.js +25 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/tabs.cjs +178 -0
- package/dist/components/tabs.cjs.map +1 -0
- package/dist/components/tabs.d.cts +44 -0
- package/dist/components/tabs.d.ts +44 -0
- package/dist/components/tabs.js +170 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.cjs +128 -0
- package/dist/components/textarea.cjs.map +1 -0
- package/dist/components/textarea.d.cts +15 -0
- package/dist/components/textarea.d.ts +15 -0
- package/dist/components/textarea.js +125 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/theme.cjs +122 -0
- package/dist/components/theme.cjs.map +1 -0
- package/dist/components/theme.d.cts +36 -0
- package/dist/components/theme.d.ts +36 -0
- package/dist/components/theme.js +118 -0
- package/dist/components/theme.js.map +1 -0
- package/dist/components/thumbnail.cjs +54 -0
- package/dist/components/thumbnail.cjs.map +1 -0
- package/dist/components/thumbnail.d.cts +33 -0
- package/dist/components/thumbnail.d.ts +33 -0
- package/dist/components/thumbnail.js +51 -0
- package/dist/components/thumbnail.js.map +1 -0
- package/dist/components/time-picker.cjs +105 -0
- package/dist/components/time-picker.cjs.map +1 -0
- package/dist/components/time-picker.d.cts +43 -0
- package/dist/components/time-picker.d.ts +43 -0
- package/dist/components/time-picker.js +101 -0
- package/dist/components/time-picker.js.map +1 -0
- package/dist/components/toast.cjs +192 -0
- package/dist/components/toast.cjs.map +1 -0
- package/dist/components/toast.d.cts +59 -0
- package/dist/components/toast.d.ts +59 -0
- package/dist/components/toast.js +188 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/tooltip.cjs +85 -0
- package/dist/components/tooltip.cjs.map +1 -0
- package/dist/components/tooltip.d.cts +48 -0
- package/dist/components/tooltip.d.ts +48 -0
- package/dist/components/tooltip.js +77 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/typography.cjs +51 -0
- package/dist/components/typography.cjs.map +1 -0
- package/dist/components/typography.d.cts +30 -0
- package/dist/components/typography.d.ts +30 -0
- package/dist/components/typography.js +45 -0
- package/dist/components/typography.js.map +1 -0
- package/dist/generate-radix-colors-Bw-RYaV4.d.cts +33 -0
- package/dist/generate-radix-colors-Bw-RYaV4.d.ts +33 -0
- package/dist/hooks/use-chart-zoom.cjs +236 -0
- package/dist/hooks/use-chart-zoom.cjs.map +1 -0
- package/dist/hooks/use-chart-zoom.d.cts +53 -0
- package/dist/hooks/use-chart-zoom.d.ts +53 -0
- package/dist/hooks/use-chart-zoom.js +234 -0
- package/dist/hooks/use-chart-zoom.js.map +1 -0
- package/dist/hooks/use-container-width.cjs +21 -0
- package/dist/hooks/use-container-width.cjs.map +1 -0
- package/dist/hooks/use-container-width.d.cts +7 -0
- package/dist/hooks/use-container-width.d.ts +7 -0
- package/dist/hooks/use-container-width.js +20 -0
- package/dist/hooks/use-container-width.js.map +1 -0
- package/dist/hooks/use-reduced-motion.cjs +21 -0
- package/dist/hooks/use-reduced-motion.cjs.map +1 -0
- package/dist/hooks/use-reduced-motion.d.cts +7 -0
- package/dist/hooks/use-reduced-motion.d.ts +7 -0
- package/dist/hooks/use-reduced-motion.js +20 -0
- package/dist/hooks/use-reduced-motion.js.map +1 -0
- package/dist/icons/index.cjs +7 -0
- package/dist/icons/index.d.cts +4 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +3 -0
- package/dist/icons/material-symbol.cjs +104 -0
- package/dist/icons/material-symbol.cjs.map +1 -0
- package/dist/icons/material-symbol.d.cts +21 -0
- package/dist/icons/material-symbol.d.ts +21 -0
- package/dist/icons/material-symbol.js +100 -0
- package/dist/icons/material-symbol.js.map +1 -0
- package/dist/lib/accent-colors.cjs +14 -0
- package/dist/lib/accent-colors.cjs.map +1 -0
- package/dist/lib/accent-colors.d.cts +8 -0
- package/dist/lib/accent-colors.d.ts +8 -0
- package/dist/lib/accent-colors.js +13 -0
- package/dist/lib/accent-colors.js.map +1 -0
- package/dist/lib/accent-theme.cjs +130 -0
- package/dist/lib/accent-theme.cjs.map +1 -0
- package/dist/lib/accent-theme.d.cts +35 -0
- package/dist/lib/accent-theme.d.ts +35 -0
- package/dist/lib/accent-theme.js +122 -0
- package/dist/lib/accent-theme.js.map +1 -0
- package/dist/lib/generate-radix-colors.cjs +364 -0
- package/dist/lib/generate-radix-colors.cjs.map +1 -0
- package/dist/lib/generate-radix-colors.d.cts +4 -0
- package/dist/lib/generate-radix-colors.d.ts +4 -0
- package/dist/lib/generate-radix-colors.js +357 -0
- package/dist/lib/generate-radix-colors.js.map +1 -0
- package/dist/lib/input-box-variants.cjs +30 -0
- package/dist/lib/input-box-variants.cjs.map +1 -0
- package/dist/lib/input-box-variants.d.cts +10 -0
- package/dist/lib/input-box-variants.d.ts +10 -0
- package/dist/lib/input-box-variants.js +28 -0
- package/dist/lib/input-box-variants.js.map +1 -0
- package/dist/lib/theme-types.cjs +1 -0
- package/dist/lib/theme-types.d.cts +4 -0
- package/dist/lib/theme-types.d.ts +4 -0
- package/dist/lib/theme-types.js +2 -0
- package/dist/lib/tones.cjs +14 -0
- package/dist/lib/tones.cjs.map +1 -0
- package/dist/lib/tones.d.cts +8 -0
- package/dist/lib/tones.d.ts +8 -0
- package/dist/lib/tones.js +13 -0
- package/dist/lib/tones.js.map +1 -0
- package/dist/number-flow-Bch81ixZ.d.cts +14 -0
- package/dist/number-flow-Bch81ixZ.d.ts +14 -0
- package/dist/styles/index.css +447 -0
- package/dist/styles/internal.css +5 -0
- package/dist/styles/material-symbol.css +22 -0
- package/dist/styles/spark-default.css +980 -0
- package/dist/styles/theme.css +623 -0
- package/dist/styles/utilities.css +557 -0
- package/dist/theme-types-8wjgiNA_.d.cts +29 -0
- package/dist/theme-types-8wjgiNA_.d.ts +29 -0
- package/dist/utils/build-sankey-nodes.cjs +72 -0
- package/dist/utils/build-sankey-nodes.cjs.map +1 -0
- package/dist/utils/build-sankey-nodes.d.cts +27 -0
- package/dist/utils/build-sankey-nodes.d.ts +27 -0
- package/dist/utils/build-sankey-nodes.js +71 -0
- package/dist/utils/build-sankey-nodes.js.map +1 -0
- package/dist/utils/chars.cjs +18 -0
- package/dist/utils/chars.cjs.map +1 -0
- package/dist/utils/chars.d.cts +10 -0
- package/dist/utils/chars.d.ts +10 -0
- package/dist/utils/chars.js +14 -0
- package/dist/utils/chars.js.map +1 -0
- package/dist/utils/chart-scale.cjs +54 -0
- package/dist/utils/chart-scale.cjs.map +1 -0
- package/dist/utils/chart-scale.d.cts +29 -0
- package/dist/utils/chart-scale.d.ts +29 -0
- package/dist/utils/chart-scale.js +51 -0
- package/dist/utils/chart-scale.js.map +1 -0
- package/dist/utils/chart-time-ticks.cjs +35 -0
- package/dist/utils/chart-time-ticks.cjs.map +1 -0
- package/dist/utils/chart-time-ticks.d.cts +7 -0
- package/dist/utils/chart-time-ticks.d.ts +7 -0
- package/dist/utils/chart-time-ticks.js +34 -0
- package/dist/utils/chart-time-ticks.js.map +1 -0
- package/dist/utils/chart-zoom.cjs +84 -0
- package/dist/utils/chart-zoom.cjs.map +1 -0
- package/dist/utils/chart-zoom.d.cts +14 -0
- package/dist/utils/chart-zoom.d.ts +14 -0
- package/dist/utils/chart-zoom.js +77 -0
- package/dist/utils/chart-zoom.js.map +1 -0
- package/dist/utils/cn.cjs +9 -0
- package/dist/utils/cn.d.cts +4 -0
- package/dist/utils/cn.d.ts +4 -0
- package/dist/utils/cn.js +3 -0
- package/dist/utils/date-mask.cjs +45 -0
- package/dist/utils/date-mask.cjs.map +1 -0
- package/dist/utils/date-mask.d.cts +17 -0
- package/dist/utils/date-mask.d.ts +17 -0
- package/dist/utils/date-mask.js +41 -0
- package/dist/utils/date-mask.js.map +1 -0
- package/dist/utils/format.cjs +57 -0
- package/dist/utils/format.cjs.map +1 -0
- package/dist/utils/format.d.cts +23 -0
- package/dist/utils/format.d.ts +23 -0
- package/dist/utils/format.js +47 -0
- package/dist/utils/format.js.map +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.cjs","names":["React"],"sources":["../../src/components/progress.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\nexport interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Current value */\n value: number\n /** Maximum value. Default: 100 */\n max?: number\n /** Height variant */\n size?: 'sm' | 'default' | 'lg'\n}\n\nconst sizeClasses = {\n sm: 'h-1',\n default: 'h-2',\n lg: 'h-3',\n} as const\n\nconst Progress = React.forwardRef<HTMLDivElement, ProgressProps>(\n ({ className, value, max = 100, size = 'default', ...props }, ref) => {\n const percentage = Math.min(100, Math.max(0, (value / max) * 100))\n\n return (\n <div\n aria-valuemax={max}\n aria-valuemin={0}\n aria-valuenow={value}\n className={cn(\n 'w-full overflow-hidden rounded-full bg-gray-a4',\n sizeClasses[size],\n className,\n )}\n ref={ref}\n role=\"progressbar\"\n {...props}\n >\n <div\n className=\"h-full rounded-full bg-spark-9 transition-all duration-300\"\n style={{ width: `${percentage}%` }}\n />\n </div>\n )\n },\n)\n\nProgress.displayName = 'Progress'\n\nexport { Progress }\n"],"mappings":";;;;;;;;AAYA,MAAM,cAAc;CAClB,IAAI;CACJ,SAAS;CACT,IAAI;AACN;AAEA,MAAM,WAAWA,MAAM,YACpB,EAAE,WAAW,OAAO,MAAM,KAAK,OAAO,WAAW,GAAG,SAAS,QAAQ;CACpE,MAAM,aAAa,KAAK,IAAI,KAAK,KAAK,IAAI,GAAI,QAAQ,MAAO,GAAG,CAAC;CAEjE,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,iBAAe;EACf,iBAAe;EACf,iBAAe;EACf,YAAA,GAAA,OAAA,IACE,kDACA,YAAY,OACZ,SACF;EACK;EACL,MAAK;EACL,GAAI;YAEJ,iBAAA,GAAA,kBAAA,KAAC,OAAD;GACE,WAAU;GACV,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG;EAClC,CAAA;CACE,CAAA;AAET,CACF;AAEA,SAAS,cAAc"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/progress.d.ts
|
|
6
|
+
interface ProgressProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
/** Current value */
|
|
8
|
+
value: number;
|
|
9
|
+
/** Maximum value. Default: 100 */
|
|
10
|
+
max?: number;
|
|
11
|
+
/** Height variant */
|
|
12
|
+
size?: 'sm' | 'default' | 'lg';
|
|
13
|
+
}
|
|
14
|
+
declare const Progress: React$1.ForwardRefExoticComponent<ProgressProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Progress, ProgressProps };
|
|
17
|
+
//# sourceMappingURL=progress.d.cts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/progress.d.ts
|
|
6
|
+
interface ProgressProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
/** Current value */
|
|
8
|
+
value: number;
|
|
9
|
+
/** Maximum value. Default: 100 */
|
|
10
|
+
max?: number;
|
|
11
|
+
/** Height variant */
|
|
12
|
+
size?: 'sm' | 'default' | 'lg';
|
|
13
|
+
}
|
|
14
|
+
declare const Progress: React$1.ForwardRefExoticComponent<ProgressProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Progress, ProgressProps };
|
|
17
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../utils/cn.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/progress.tsx
|
|
6
|
+
const sizeClasses = {
|
|
7
|
+
sm: "h-1",
|
|
8
|
+
default: "h-2",
|
|
9
|
+
lg: "h-3"
|
|
10
|
+
};
|
|
11
|
+
const Progress = React$1.forwardRef(({ className, value, max = 100, size = "default", ...props }, ref) => {
|
|
12
|
+
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
13
|
+
return /* @__PURE__ */ jsx("div", {
|
|
14
|
+
"aria-valuemax": max,
|
|
15
|
+
"aria-valuemin": 0,
|
|
16
|
+
"aria-valuenow": value,
|
|
17
|
+
className: cn("w-full overflow-hidden rounded-full bg-gray-a4", sizeClasses[size], className),
|
|
18
|
+
ref,
|
|
19
|
+
role: "progressbar",
|
|
20
|
+
...props,
|
|
21
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: "h-full rounded-full bg-spark-9 transition-all duration-300",
|
|
23
|
+
style: { width: `${percentage}%` }
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
Progress.displayName = "Progress";
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Progress };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","names":["React"],"sources":["../../src/components/progress.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\nexport interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Current value */\n value: number\n /** Maximum value. Default: 100 */\n max?: number\n /** Height variant */\n size?: 'sm' | 'default' | 'lg'\n}\n\nconst sizeClasses = {\n sm: 'h-1',\n default: 'h-2',\n lg: 'h-3',\n} as const\n\nconst Progress = React.forwardRef<HTMLDivElement, ProgressProps>(\n ({ className, value, max = 100, size = 'default', ...props }, ref) => {\n const percentage = Math.min(100, Math.max(0, (value / max) * 100))\n\n return (\n <div\n aria-valuemax={max}\n aria-valuemin={0}\n aria-valuenow={value}\n className={cn(\n 'w-full overflow-hidden rounded-full bg-gray-a4',\n sizeClasses[size],\n className,\n )}\n ref={ref}\n role=\"progressbar\"\n {...props}\n >\n <div\n className=\"h-full rounded-full bg-spark-9 transition-all duration-300\"\n style={{ width: `${percentage}%` }}\n />\n </div>\n )\n },\n)\n\nProgress.displayName = 'Progress'\n\nexport { Progress }\n"],"mappings":";;;;;AAYA,MAAM,cAAc;CAClB,IAAI;CACJ,SAAS;CACT,IAAI;AACN;AAEA,MAAM,WAAWA,QAAM,YACpB,EAAE,WAAW,OAAO,MAAM,KAAK,OAAO,WAAW,GAAG,SAAS,QAAQ;CACpE,MAAM,aAAa,KAAK,IAAI,KAAK,KAAK,IAAI,GAAI,QAAQ,MAAO,GAAG,CAAC;CAEjE,OACE,oBAAC,OAAD;EACE,iBAAe;EACf,iBAAe;EACf,iBAAe;EACf,WAAW,GACT,kDACA,YAAY,OACZ,SACF;EACK;EACL,MAAK;EACL,GAAI;YAEJ,oBAAC,OAAD;GACE,WAAU;GACV,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG;EAClC,CAAA;CACE,CAAA;AAET,CACF;AAEA,SAAS,cAAc"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_chunk.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let cnfast = require("cnfast");
|
|
8
|
+
//#region src/components/radio-card-group.tsx
|
|
9
|
+
const RadioCardGroupContext = react.createContext(void 0);
|
|
10
|
+
const ARROW_STEP = {
|
|
11
|
+
ArrowDown: 1,
|
|
12
|
+
ArrowRight: 1,
|
|
13
|
+
ArrowUp: -1,
|
|
14
|
+
ArrowLeft: -1
|
|
15
|
+
};
|
|
16
|
+
const RadioCardGroup = react.forwardRef(({ value: valueProp, defaultValue, onValueChange, disabled, name, className, children, ...props }, ref) => {
|
|
17
|
+
const generatedName = react.useId();
|
|
18
|
+
const [internalValue, setInternalValue] = react.useState(defaultValue);
|
|
19
|
+
const isControlled = valueProp !== void 0;
|
|
20
|
+
const value = isControlled ? valueProp : internalValue;
|
|
21
|
+
const handleValueChange = react.useCallback((next) => {
|
|
22
|
+
if (!isControlled) setInternalValue(next);
|
|
23
|
+
onValueChange?.(next);
|
|
24
|
+
}, [isControlled, onValueChange]);
|
|
25
|
+
const ctx = react.useMemo(() => ({
|
|
26
|
+
value,
|
|
27
|
+
onValueChange: handleValueChange,
|
|
28
|
+
disabled,
|
|
29
|
+
name: name ?? generatedName
|
|
30
|
+
}), [
|
|
31
|
+
value,
|
|
32
|
+
handleValueChange,
|
|
33
|
+
disabled,
|
|
34
|
+
name,
|
|
35
|
+
generatedName
|
|
36
|
+
]);
|
|
37
|
+
const handleKeyDown = (event) => {
|
|
38
|
+
const step = ARROW_STEP[event.key];
|
|
39
|
+
if (step === void 0 && event.key !== "Home" && event.key !== "End") return;
|
|
40
|
+
const radios = [...event.currentTarget.querySelectorAll("[role=\"radio\"]:not(:disabled)")];
|
|
41
|
+
if (radios.length === 0) return;
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
let next = 0;
|
|
44
|
+
if (event.key === "End") next = radios.length - 1;
|
|
45
|
+
else if (step !== void 0) {
|
|
46
|
+
const current = radios.indexOf(document.activeElement);
|
|
47
|
+
if (current !== -1) next = (current + step + radios.length) % radios.length;
|
|
48
|
+
}
|
|
49
|
+
const target = radios[next];
|
|
50
|
+
if (!target) return;
|
|
51
|
+
target.focus();
|
|
52
|
+
target.click();
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioCardGroupContext.Provider, {
|
|
55
|
+
value: ctx,
|
|
56
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
57
|
+
ref,
|
|
58
|
+
role: "radiogroup",
|
|
59
|
+
onKeyDown: handleKeyDown,
|
|
60
|
+
className: (0, cnfast.cn)("flex flex-col gap-[calc(var(--spark-layout-gap)*2)]", className),
|
|
61
|
+
...props,
|
|
62
|
+
children
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
RadioCardGroup.displayName = "RadioCardGroup";
|
|
67
|
+
const RadioCardGroupItem = react.forwardRef(({ value, className, children, disabled, onClick, ...props }, ref) => {
|
|
68
|
+
const ctx = react.useContext(RadioCardGroupContext);
|
|
69
|
+
if (!ctx) throw new Error("RadioCardGroupItem must be used within a RadioCardGroup");
|
|
70
|
+
const checked = ctx.value === value;
|
|
71
|
+
const isDisabled = disabled ?? ctx.disabled;
|
|
72
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
73
|
+
ref,
|
|
74
|
+
type: "button",
|
|
75
|
+
role: "radio",
|
|
76
|
+
"aria-checked": checked,
|
|
77
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
78
|
+
tabIndex: checked || ctx.value === void 0 ? 0 : -1,
|
|
79
|
+
disabled: isDisabled,
|
|
80
|
+
onClick: (event) => {
|
|
81
|
+
onClick?.(event);
|
|
82
|
+
if (!event.defaultPrevented && !isDisabled) ctx.onValueChange(value);
|
|
83
|
+
},
|
|
84
|
+
className: (0, cnfast.cn)("h-12 w-full rounded-lg px-4 text-base font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50", checked ? "border border-accent bg-base-accent-soft text-accent" : "border border-transparent bg-base-gray-soft text-gray hover:bg-gray-a3", className),
|
|
85
|
+
...props,
|
|
86
|
+
children
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
RadioCardGroupItem.displayName = "RadioCardGroupItem";
|
|
90
|
+
//#endregion
|
|
91
|
+
exports.RadioCardGroup = RadioCardGroup;
|
|
92
|
+
exports.RadioCardGroupItem = RadioCardGroupItem;
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=radio-card-group.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-card-group.cjs","names":["React"],"sources":["../../src/components/radio-card-group.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\ninterface RadioCardGroupContextValue {\n value: string | undefined\n onValueChange: (value: string) => void\n disabled?: boolean\n name: string\n}\n\nconst RadioCardGroupContext = React.createContext<\n RadioCardGroupContextValue | undefined\n>(undefined)\n\nconst ARROW_STEP: Record<string, 1 | -1> = {\n ArrowDown: 1,\n ArrowRight: 1,\n ArrowUp: -1,\n ArrowLeft: -1,\n}\n\ninterface RadioCardGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n value?: string\n defaultValue?: string\n onValueChange?: (value: string) => void\n disabled?: boolean\n /** Optional name used for ARIA grouping. Defaults to a generated id. */\n name?: string\n}\n\nconst RadioCardGroup = React.forwardRef<HTMLDivElement, RadioCardGroupProps>(\n (\n {\n value: valueProp,\n defaultValue,\n onValueChange,\n disabled,\n name,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const generatedName = React.useId()\n const [internalValue, setInternalValue] = React.useState<\n string | undefined\n >(defaultValue)\n const isControlled = valueProp !== undefined\n const value = isControlled ? valueProp : internalValue\n\n const handleValueChange = React.useCallback(\n (next: string) => {\n if (!isControlled) setInternalValue(next)\n onValueChange?.(next)\n },\n [isControlled, onValueChange],\n )\n\n const ctx = React.useMemo<RadioCardGroupContextValue>(\n () => ({\n value,\n onValueChange: handleValueChange,\n disabled,\n name: name ?? generatedName,\n }),\n [value, handleValueChange, disabled, name, generatedName],\n )\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const step = ARROW_STEP[event.key]\n if (step === undefined && event.key !== 'Home' && event.key !== 'End')\n return\n const radios = [\n ...event.currentTarget.querySelectorAll<HTMLButtonElement>(\n '[role=\"radio\"]:not(:disabled)',\n ),\n ]\n if (radios.length === 0) return\n event.preventDefault()\n\n let next = 0\n if (event.key === 'End') {\n next = radios.length - 1\n } else if (step !== undefined) {\n const current = radios.indexOf(\n document.activeElement as HTMLButtonElement,\n )\n if (current !== -1) {\n next = (current + step + radios.length) % radios.length\n }\n }\n const target = radios[next]\n if (!target) return\n target.focus()\n target.click()\n }\n\n return (\n <RadioCardGroupContext.Provider value={ctx}>\n <div\n ref={ref}\n role=\"radiogroup\"\n onKeyDown={handleKeyDown}\n className={cn(\n 'flex flex-col gap-[calc(var(--spark-layout-gap)*2)]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n </RadioCardGroupContext.Provider>\n )\n },\n)\n\nRadioCardGroup.displayName = 'RadioCardGroup'\n\ninterface RadioCardGroupItemProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'value'\n> {\n value: string\n}\n\nconst RadioCardGroupItem = React.forwardRef<\n HTMLButtonElement,\n RadioCardGroupItemProps\n>(({ value, className, children, disabled, onClick, ...props }, ref) => {\n const ctx = React.useContext(RadioCardGroupContext)\n if (!ctx) {\n throw new Error('RadioCardGroupItem must be used within a RadioCardGroup')\n }\n\n const checked = ctx.value === value\n const isDisabled = disabled ?? ctx.disabled\n\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n data-state={checked ? 'checked' : 'unchecked'}\n tabIndex={checked || ctx.value === undefined ? 0 : -1}\n disabled={isDisabled}\n onClick={(event) => {\n onClick?.(event)\n if (!event.defaultPrevented && !isDisabled) {\n ctx.onValueChange(value)\n }\n }}\n className={cn(\n 'h-12 w-full rounded-lg px-4 text-base font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',\n checked\n ? 'border border-accent bg-base-accent-soft text-accent'\n : 'border border-transparent bg-base-gray-soft text-gray hover:bg-gray-a3',\n className,\n )}\n {...props}\n >\n {children}\n </button>\n )\n})\n\nRadioCardGroupItem.displayName = 'RadioCardGroupItem'\n\nexport { RadioCardGroup, RadioCardGroupItem }\nexport type { RadioCardGroupProps, RadioCardGroupItemProps }\n"],"mappings":";;;;;;;;AAUA,MAAM,wBAAwBA,MAAM,cAElC,KAAA,CAAS;AAEX,MAAM,aAAqC;CACzC,WAAW;CACX,YAAY;CACZ,SAAS;CACT,WAAW;AACb;AAWA,MAAM,iBAAiBA,MAAM,YAEzB,EACE,OAAO,WACP,cACA,eACA,UACA,MACA,WACA,UACA,GAAG,SAEL,QACG;CACH,MAAM,gBAAgBA,MAAM,MAAM;CAClC,MAAM,CAAC,eAAe,oBAAoBA,MAAM,SAE9C,YAAY;CACd,MAAM,eAAe,cAAc,KAAA;CACnC,MAAM,QAAQ,eAAe,YAAY;CAEzC,MAAM,oBAAoBA,MAAM,aAC7B,SAAiB;EAChB,IAAI,CAAC,cAAc,iBAAiB,IAAI;EACxC,gBAAgB,IAAI;CACtB,GACA,CAAC,cAAc,aAAa,CAC9B;CAEA,MAAM,MAAMA,MAAM,eACT;EACL;EACA,eAAe;EACf;EACA,MAAM,QAAQ;CAChB,IACA;EAAC;EAAO;EAAmB;EAAU;EAAM;CAAa,CAC1D;CAEA,MAAM,iBAAiB,UAA+C;EACpE,MAAM,OAAO,WAAW,MAAM;EAC9B,IAAI,SAAS,KAAA,KAAa,MAAM,QAAQ,UAAU,MAAM,QAAQ,OAC9D;EACF,MAAM,SAAS,CACb,GAAG,MAAM,cAAc,iBACrB,iCACF,CACF;EACA,IAAI,OAAO,WAAW,GAAG;EACzB,MAAM,eAAe;EAErB,IAAI,OAAO;EACX,IAAI,MAAM,QAAQ,OAChB,OAAO,OAAO,SAAS;OAClB,IAAI,SAAS,KAAA,GAAW;GAC7B,MAAM,UAAU,OAAO,QACrB,SAAS,aACX;GACA,IAAI,YAAY,IACd,QAAQ,UAAU,OAAO,OAAO,UAAU,OAAO;EAErD;EACA,MAAM,SAAS,OAAO;EACtB,IAAI,CAAC,QAAQ;EACb,OAAO,MAAM;EACb,OAAO,MAAM;CACf;CAEA,OACE,iBAAA,GAAA,kBAAA,KAAC,sBAAsB,UAAvB;EAAgC,OAAO;YACrC,iBAAA,GAAA,kBAAA,KAAC,OAAD;GACO;GACL,MAAK;GACL,WAAW;GACX,YAAA,GAAA,OAAA,IACE,uDACA,SACF;GACA,GAAI;GAEH;EACE,CAAA;CACyB,CAAA;AAEpC,CACF;AAEA,eAAe,cAAc;AAS7B,MAAM,qBAAqBA,MAAM,YAG9B,EAAE,OAAO,WAAW,UAAU,UAAU,SAAS,GAAG,SAAS,QAAQ;CACtE,MAAM,MAAMA,MAAM,WAAW,qBAAqB;CAClD,IAAI,CAAC,KACH,MAAM,IAAI,MAAM,yDAAyD;CAG3E,MAAM,UAAU,IAAI,UAAU;CAC9B,MAAM,aAAa,YAAY,IAAI;CAEnC,OACE,iBAAA,GAAA,kBAAA,KAAC,UAAD;EACO;EACL,MAAK;EACL,MAAK;EACL,gBAAc;EACd,cAAY,UAAU,YAAY;EAClC,UAAU,WAAW,IAAI,UAAU,KAAA,IAAY,IAAI;EACnD,UAAU;EACV,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,IAAI,CAAC,MAAM,oBAAoB,CAAC,YAC9B,IAAI,cAAc,KAAK;EAE3B;EACA,YAAA,GAAA,OAAA,IACE,qMACA,UACI,yDACA,0EACJ,SACF;EACA,GAAI;EAEH;CACK,CAAA;AAEZ,CAAC;AAED,mBAAmB,cAAc"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/radio-card-group.d.ts
|
|
6
|
+
interface RadioCardGroupProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
value?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
onValueChange?: (value: string) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Optional name used for ARIA grouping. Defaults to a generated id. */
|
|
12
|
+
name?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const RadioCardGroup: React$1.ForwardRefExoticComponent<RadioCardGroupProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
interface RadioCardGroupItemProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
|
|
16
|
+
value: string;
|
|
17
|
+
}
|
|
18
|
+
declare const RadioCardGroupItem: React$1.ForwardRefExoticComponent<RadioCardGroupItemProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { RadioCardGroup, RadioCardGroupItem, type RadioCardGroupItemProps, type RadioCardGroupProps };
|
|
21
|
+
//# sourceMappingURL=radio-card-group.d.cts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/radio-card-group.d.ts
|
|
6
|
+
interface RadioCardGroupProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
value?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
onValueChange?: (value: string) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Optional name used for ARIA grouping. Defaults to a generated id. */
|
|
12
|
+
name?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const RadioCardGroup: React$1.ForwardRefExoticComponent<RadioCardGroupProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
interface RadioCardGroupItemProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
|
|
16
|
+
value: string;
|
|
17
|
+
}
|
|
18
|
+
declare const RadioCardGroupItem: React$1.ForwardRefExoticComponent<RadioCardGroupItemProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { RadioCardGroup, RadioCardGroupItem, type RadioCardGroupItemProps, type RadioCardGroupProps };
|
|
21
|
+
//# sourceMappingURL=radio-card-group.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../utils/cn.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/radio-card-group.tsx
|
|
6
|
+
const RadioCardGroupContext = React$1.createContext(void 0);
|
|
7
|
+
const ARROW_STEP = {
|
|
8
|
+
ArrowDown: 1,
|
|
9
|
+
ArrowRight: 1,
|
|
10
|
+
ArrowUp: -1,
|
|
11
|
+
ArrowLeft: -1
|
|
12
|
+
};
|
|
13
|
+
const RadioCardGroup = React$1.forwardRef(({ value: valueProp, defaultValue, onValueChange, disabled, name, className, children, ...props }, ref) => {
|
|
14
|
+
const generatedName = React$1.useId();
|
|
15
|
+
const [internalValue, setInternalValue] = React$1.useState(defaultValue);
|
|
16
|
+
const isControlled = valueProp !== void 0;
|
|
17
|
+
const value = isControlled ? valueProp : internalValue;
|
|
18
|
+
const handleValueChange = React$1.useCallback((next) => {
|
|
19
|
+
if (!isControlled) setInternalValue(next);
|
|
20
|
+
onValueChange?.(next);
|
|
21
|
+
}, [isControlled, onValueChange]);
|
|
22
|
+
const ctx = React$1.useMemo(() => ({
|
|
23
|
+
value,
|
|
24
|
+
onValueChange: handleValueChange,
|
|
25
|
+
disabled,
|
|
26
|
+
name: name ?? generatedName
|
|
27
|
+
}), [
|
|
28
|
+
value,
|
|
29
|
+
handleValueChange,
|
|
30
|
+
disabled,
|
|
31
|
+
name,
|
|
32
|
+
generatedName
|
|
33
|
+
]);
|
|
34
|
+
const handleKeyDown = (event) => {
|
|
35
|
+
const step = ARROW_STEP[event.key];
|
|
36
|
+
if (step === void 0 && event.key !== "Home" && event.key !== "End") return;
|
|
37
|
+
const radios = [...event.currentTarget.querySelectorAll("[role=\"radio\"]:not(:disabled)")];
|
|
38
|
+
if (radios.length === 0) return;
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
let next = 0;
|
|
41
|
+
if (event.key === "End") next = radios.length - 1;
|
|
42
|
+
else if (step !== void 0) {
|
|
43
|
+
const current = radios.indexOf(document.activeElement);
|
|
44
|
+
if (current !== -1) next = (current + step + radios.length) % radios.length;
|
|
45
|
+
}
|
|
46
|
+
const target = radios[next];
|
|
47
|
+
if (!target) return;
|
|
48
|
+
target.focus();
|
|
49
|
+
target.click();
|
|
50
|
+
};
|
|
51
|
+
return /* @__PURE__ */ jsx(RadioCardGroupContext.Provider, {
|
|
52
|
+
value: ctx,
|
|
53
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
54
|
+
ref,
|
|
55
|
+
role: "radiogroup",
|
|
56
|
+
onKeyDown: handleKeyDown,
|
|
57
|
+
className: cn("flex flex-col gap-[calc(var(--spark-layout-gap)*2)]", className),
|
|
58
|
+
...props,
|
|
59
|
+
children
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
RadioCardGroup.displayName = "RadioCardGroup";
|
|
64
|
+
const RadioCardGroupItem = React$1.forwardRef(({ value, className, children, disabled, onClick, ...props }, ref) => {
|
|
65
|
+
const ctx = React$1.useContext(RadioCardGroupContext);
|
|
66
|
+
if (!ctx) throw new Error("RadioCardGroupItem must be used within a RadioCardGroup");
|
|
67
|
+
const checked = ctx.value === value;
|
|
68
|
+
const isDisabled = disabled ?? ctx.disabled;
|
|
69
|
+
return /* @__PURE__ */ jsx("button", {
|
|
70
|
+
ref,
|
|
71
|
+
type: "button",
|
|
72
|
+
role: "radio",
|
|
73
|
+
"aria-checked": checked,
|
|
74
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
75
|
+
tabIndex: checked || ctx.value === void 0 ? 0 : -1,
|
|
76
|
+
disabled: isDisabled,
|
|
77
|
+
onClick: (event) => {
|
|
78
|
+
onClick?.(event);
|
|
79
|
+
if (!event.defaultPrevented && !isDisabled) ctx.onValueChange(value);
|
|
80
|
+
},
|
|
81
|
+
className: cn("h-12 w-full rounded-lg px-4 text-base font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50", checked ? "border border-accent bg-base-accent-soft text-accent" : "border border-transparent bg-base-gray-soft text-gray hover:bg-gray-a3", className),
|
|
82
|
+
...props,
|
|
83
|
+
children
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
RadioCardGroupItem.displayName = "RadioCardGroupItem";
|
|
87
|
+
//#endregion
|
|
88
|
+
export { RadioCardGroup, RadioCardGroupItem };
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=radio-card-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-card-group.js","names":["React"],"sources":["../../src/components/radio-card-group.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\ninterface RadioCardGroupContextValue {\n value: string | undefined\n onValueChange: (value: string) => void\n disabled?: boolean\n name: string\n}\n\nconst RadioCardGroupContext = React.createContext<\n RadioCardGroupContextValue | undefined\n>(undefined)\n\nconst ARROW_STEP: Record<string, 1 | -1> = {\n ArrowDown: 1,\n ArrowRight: 1,\n ArrowUp: -1,\n ArrowLeft: -1,\n}\n\ninterface RadioCardGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n value?: string\n defaultValue?: string\n onValueChange?: (value: string) => void\n disabled?: boolean\n /** Optional name used for ARIA grouping. Defaults to a generated id. */\n name?: string\n}\n\nconst RadioCardGroup = React.forwardRef<HTMLDivElement, RadioCardGroupProps>(\n (\n {\n value: valueProp,\n defaultValue,\n onValueChange,\n disabled,\n name,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const generatedName = React.useId()\n const [internalValue, setInternalValue] = React.useState<\n string | undefined\n >(defaultValue)\n const isControlled = valueProp !== undefined\n const value = isControlled ? valueProp : internalValue\n\n const handleValueChange = React.useCallback(\n (next: string) => {\n if (!isControlled) setInternalValue(next)\n onValueChange?.(next)\n },\n [isControlled, onValueChange],\n )\n\n const ctx = React.useMemo<RadioCardGroupContextValue>(\n () => ({\n value,\n onValueChange: handleValueChange,\n disabled,\n name: name ?? generatedName,\n }),\n [value, handleValueChange, disabled, name, generatedName],\n )\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const step = ARROW_STEP[event.key]\n if (step === undefined && event.key !== 'Home' && event.key !== 'End')\n return\n const radios = [\n ...event.currentTarget.querySelectorAll<HTMLButtonElement>(\n '[role=\"radio\"]:not(:disabled)',\n ),\n ]\n if (radios.length === 0) return\n event.preventDefault()\n\n let next = 0\n if (event.key === 'End') {\n next = radios.length - 1\n } else if (step !== undefined) {\n const current = radios.indexOf(\n document.activeElement as HTMLButtonElement,\n )\n if (current !== -1) {\n next = (current + step + radios.length) % radios.length\n }\n }\n const target = radios[next]\n if (!target) return\n target.focus()\n target.click()\n }\n\n return (\n <RadioCardGroupContext.Provider value={ctx}>\n <div\n ref={ref}\n role=\"radiogroup\"\n onKeyDown={handleKeyDown}\n className={cn(\n 'flex flex-col gap-[calc(var(--spark-layout-gap)*2)]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n </RadioCardGroupContext.Provider>\n )\n },\n)\n\nRadioCardGroup.displayName = 'RadioCardGroup'\n\ninterface RadioCardGroupItemProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'value'\n> {\n value: string\n}\n\nconst RadioCardGroupItem = React.forwardRef<\n HTMLButtonElement,\n RadioCardGroupItemProps\n>(({ value, className, children, disabled, onClick, ...props }, ref) => {\n const ctx = React.useContext(RadioCardGroupContext)\n if (!ctx) {\n throw new Error('RadioCardGroupItem must be used within a RadioCardGroup')\n }\n\n const checked = ctx.value === value\n const isDisabled = disabled ?? ctx.disabled\n\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n data-state={checked ? 'checked' : 'unchecked'}\n tabIndex={checked || ctx.value === undefined ? 0 : -1}\n disabled={isDisabled}\n onClick={(event) => {\n onClick?.(event)\n if (!event.defaultPrevented && !isDisabled) {\n ctx.onValueChange(value)\n }\n }}\n className={cn(\n 'h-12 w-full rounded-lg px-4 text-base font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',\n checked\n ? 'border border-accent bg-base-accent-soft text-accent'\n : 'border border-transparent bg-base-gray-soft text-gray hover:bg-gray-a3',\n className,\n )}\n {...props}\n >\n {children}\n </button>\n )\n})\n\nRadioCardGroupItem.displayName = 'RadioCardGroupItem'\n\nexport { RadioCardGroup, RadioCardGroupItem }\nexport type { RadioCardGroupProps, RadioCardGroupItemProps }\n"],"mappings":";;;;;AAUA,MAAM,wBAAwBA,QAAM,cAElC,KAAA,CAAS;AAEX,MAAM,aAAqC;CACzC,WAAW;CACX,YAAY;CACZ,SAAS;CACT,WAAW;AACb;AAWA,MAAM,iBAAiBA,QAAM,YAEzB,EACE,OAAO,WACP,cACA,eACA,UACA,MACA,WACA,UACA,GAAG,SAEL,QACG;CACH,MAAM,gBAAgBA,QAAM,MAAM;CAClC,MAAM,CAAC,eAAe,oBAAoBA,QAAM,SAE9C,YAAY;CACd,MAAM,eAAe,cAAc,KAAA;CACnC,MAAM,QAAQ,eAAe,YAAY;CAEzC,MAAM,oBAAoBA,QAAM,aAC7B,SAAiB;EAChB,IAAI,CAAC,cAAc,iBAAiB,IAAI;EACxC,gBAAgB,IAAI;CACtB,GACA,CAAC,cAAc,aAAa,CAC9B;CAEA,MAAM,MAAMA,QAAM,eACT;EACL;EACA,eAAe;EACf;EACA,MAAM,QAAQ;CAChB,IACA;EAAC;EAAO;EAAmB;EAAU;EAAM;CAAa,CAC1D;CAEA,MAAM,iBAAiB,UAA+C;EACpE,MAAM,OAAO,WAAW,MAAM;EAC9B,IAAI,SAAS,KAAA,KAAa,MAAM,QAAQ,UAAU,MAAM,QAAQ,OAC9D;EACF,MAAM,SAAS,CACb,GAAG,MAAM,cAAc,iBACrB,iCACF,CACF;EACA,IAAI,OAAO,WAAW,GAAG;EACzB,MAAM,eAAe;EAErB,IAAI,OAAO;EACX,IAAI,MAAM,QAAQ,OAChB,OAAO,OAAO,SAAS;OAClB,IAAI,SAAS,KAAA,GAAW;GAC7B,MAAM,UAAU,OAAO,QACrB,SAAS,aACX;GACA,IAAI,YAAY,IACd,QAAQ,UAAU,OAAO,OAAO,UAAU,OAAO;EAErD;EACA,MAAM,SAAS,OAAO;EACtB,IAAI,CAAC,QAAQ;EACb,OAAO,MAAM;EACb,OAAO,MAAM;CACf;CAEA,OACE,oBAAC,sBAAsB,UAAvB;EAAgC,OAAO;YACrC,oBAAC,OAAD;GACO;GACL,MAAK;GACL,WAAW;GACX,WAAW,GACT,uDACA,SACF;GACA,GAAI;GAEH;EACE,CAAA;CACyB,CAAA;AAEpC,CACF;AAEA,eAAe,cAAc;AAS7B,MAAM,qBAAqBA,QAAM,YAG9B,EAAE,OAAO,WAAW,UAAU,UAAU,SAAS,GAAG,SAAS,QAAQ;CACtE,MAAM,MAAMA,QAAM,WAAW,qBAAqB;CAClD,IAAI,CAAC,KACH,MAAM,IAAI,MAAM,yDAAyD;CAG3E,MAAM,UAAU,IAAI,UAAU;CAC9B,MAAM,aAAa,YAAY,IAAI;CAEnC,OACE,oBAAC,UAAD;EACO;EACL,MAAK;EACL,MAAK;EACL,gBAAc;EACd,cAAY,UAAU,YAAY;EAClC,UAAU,WAAW,IAAI,UAAU,KAAA,IAAY,IAAI;EACnD,UAAU;EACV,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,IAAI,CAAC,MAAM,oBAAoB,CAAC,YAC9B,IAAI,cAAc,KAAK;EAE3B;EACA,WAAW,GACT,qMACA,UACI,yDACA,0EACJ,SACF;EACA,GAAI;EAEH;CACK,CAAA;AAEZ,CAAC;AAED,mBAAmB,cAAc"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
|
+
const require_lib_accent_colors = require("../lib/accent-colors.cjs");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_chunk.__toESM(react);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _base_ui_react_radio = require("@base-ui/react/radio");
|
|
9
|
+
let _base_ui_react_radio_group = require("@base-ui/react/radio-group");
|
|
10
|
+
let cnfast = require("cnfast");
|
|
11
|
+
//#region src/components/radio.tsx
|
|
12
|
+
function RadioGroup({ className, styleVariant, color, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_radio_group.RadioGroup, {
|
|
14
|
+
"data-slot": "radio-group",
|
|
15
|
+
"data-style": styleVariant !== void 0 || color !== void 0 ? styleVariant ?? "solid" : void 0,
|
|
16
|
+
"data-accent-color": color ? require_lib_accent_colors.accentByColor[color] : void 0,
|
|
17
|
+
className: (0, cnfast.cn)("grid gap-[calc(var(--spark-layout-gap)*3)]", className),
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function Radio({ className, styleVariant, color, ...props }) {
|
|
22
|
+
const dataStyle = styleVariant !== void 0 || color !== void 0 ? styleVariant ?? "solid" : void 0;
|
|
23
|
+
const dataAccentColor = color ? require_lib_accent_colors.accentByColor[color] : void 0;
|
|
24
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_radio.Radio.Root, {
|
|
25
|
+
"data-slot": "radio",
|
|
26
|
+
"data-style": dataStyle,
|
|
27
|
+
"data-accent-color": dataAccentColor,
|
|
28
|
+
className: (0, cnfast.cn)("peer relative inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border-2 transition-colors", "before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']", "focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden", "data-disabled:cursor-not-allowed data-disabled:opacity-50", "border-(--spark-style-idle-border,var(--spark-a7)) bg-base-accent-soft data-unchecked:border-(length:--spark-style-border-width,2px)", "data-checked:border-(--spark-radio-ring,var(--spark-9))", className),
|
|
29
|
+
...props,
|
|
30
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_radio.Radio.Indicator, {
|
|
31
|
+
"data-slot": "radio-indicator",
|
|
32
|
+
className: "flex items-center justify-center",
|
|
33
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "size-4 rounded-full bg-(--spark-radio-dot,var(--spark-9)) motion-safe:animate-dot-pop" })
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.Radio = Radio;
|
|
39
|
+
exports.RadioGroup = RadioGroup;
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=radio.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio.cjs","names":["RadioGroupPrimitive","accentByColor","RadioPrimitive"],"sources":["../../src/components/radio.tsx"],"sourcesContent":["import { Radio as RadioPrimitive } from '@base-ui/react/radio'\nimport { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group'\nimport * as React from 'react'\nimport { accentByColor } from '../lib/accent-colors'\nimport type { SparkStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\nexport type SparkRadioColor = 'accent' | 'neutral' | 'danger'\n\ntype RadioGroupProps = React.ComponentProps<typeof RadioGroupPrimitive> & {\n styleVariant?: SparkStyle\n color?: SparkRadioColor\n}\n\nfunction RadioGroup({\n className,\n styleVariant,\n color,\n ...props\n}: RadioGroupProps) {\n const hasLook = styleVariant !== undefined || color !== undefined\n const dataStyle = hasLook ? (styleVariant ?? 'solid') : undefined\n const dataAccentColor = color ? accentByColor[color] : undefined\n\n return (\n <RadioGroupPrimitive\n data-slot=\"radio-group\"\n data-style={dataStyle}\n data-accent-color={dataAccentColor}\n className={cn('grid gap-[calc(var(--spark-layout-gap)*3)]', className)}\n {...props}\n />\n )\n}\n\ntype RadioProps = React.ComponentProps<typeof RadioPrimitive.Root> & {\n styleVariant?: SparkStyle\n color?: SparkRadioColor\n}\n\nfunction Radio({ className, styleVariant, color, ...props }: RadioProps) {\n const hasLook = styleVariant !== undefined || color !== undefined\n const dataStyle = hasLook ? (styleVariant ?? 'solid') : undefined\n const dataAccentColor = color ? accentByColor[color] : undefined\n\n return (\n <RadioPrimitive.Root\n data-slot=\"radio\"\n data-style={dataStyle}\n data-accent-color={dataAccentColor}\n className={cn(\n 'peer relative inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border-2 transition-colors',\n \"before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']\",\n 'focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-50',\n 'border-(--spark-style-idle-border,var(--spark-a7)) bg-base-accent-soft data-unchecked:border-(length:--spark-style-border-width,2px)',\n 'data-checked:border-(--spark-radio-ring,var(--spark-9))',\n className,\n )}\n {...props}\n >\n <RadioPrimitive.Indicator\n data-slot=\"radio-indicator\"\n className=\"flex items-center justify-center\"\n >\n <span className=\"size-4 rounded-full bg-(--spark-radio-dot,var(--spark-9)) motion-safe:animate-dot-pop\" />\n </RadioPrimitive.Indicator>\n </RadioPrimitive.Root>\n )\n}\n\nexport { Radio, RadioGroup }\nexport type { RadioGroupProps, RadioProps }\n"],"mappings":";;;;;;;;;;;AAcA,SAAS,WAAW,EAClB,WACA,cACA,OACA,GAAG,SACe;CAKlB,OACE,iBAAA,GAAA,kBAAA,KAACA,2BAAAA,YAAD;EACE,aAAU;EACV,cAPY,iBAAiB,KAAA,KAAa,UAAU,KAAA,IAC3B,gBAAgB,UAAW,KAAA;EAOpD,qBANoB,QAAQC,0BAAAA,cAAc,SAAS,KAAA;EAOnD,YAAA,GAAA,OAAA,IAAc,8CAA8C,SAAS;EACrE,GAAI;CACL,CAAA;AAEL;AAOA,SAAS,MAAM,EAAE,WAAW,cAAc,OAAO,GAAG,SAAqB;CAEvE,MAAM,YADU,iBAAiB,KAAA,KAAa,UAAU,KAAA,IAC3B,gBAAgB,UAAW,KAAA;CACxD,MAAM,kBAAkB,QAAQA,0BAAAA,cAAc,SAAS,KAAA;CAEvD,OACE,iBAAA,GAAA,kBAAA,KAACC,qBAAAA,MAAe,MAAhB;EACE,aAAU;EACV,cAAY;EACZ,qBAAmB;EACnB,YAAA,GAAA,OAAA,IACE,gIACA,qIACA,iFACA,6DACA,wIACA,2DACA,SACF;EACA,GAAI;YAEJ,iBAAA,GAAA,kBAAA,KAACA,qBAAAA,MAAe,WAAhB;GACE,aAAU;GACV,WAAU;aAEV,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,WAAU,wFAAyF,CAAA;EACjF,CAAA;CACP,CAAA;AAEzB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { u as SparkStyle } from "../theme-types-8wjgiNA_.cjs";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { Radio as Radio$1 } from "@base-ui/react/radio";
|
|
6
|
+
import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
|
|
7
|
+
|
|
8
|
+
//#region src/components/radio.d.ts
|
|
9
|
+
type SparkRadioColor = 'accent' | 'neutral' | 'danger';
|
|
10
|
+
type RadioGroupProps = React$1.ComponentProps<typeof RadioGroup$1> & {
|
|
11
|
+
styleVariant?: SparkStyle;
|
|
12
|
+
color?: SparkRadioColor;
|
|
13
|
+
};
|
|
14
|
+
declare function RadioGroup({
|
|
15
|
+
className,
|
|
16
|
+
styleVariant,
|
|
17
|
+
color,
|
|
18
|
+
...props
|
|
19
|
+
}: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
type RadioProps = React$1.ComponentProps<typeof Radio$1.Root> & {
|
|
21
|
+
styleVariant?: SparkStyle;
|
|
22
|
+
color?: SparkRadioColor;
|
|
23
|
+
};
|
|
24
|
+
declare function Radio({
|
|
25
|
+
className,
|
|
26
|
+
styleVariant,
|
|
27
|
+
color,
|
|
28
|
+
...props
|
|
29
|
+
}: RadioProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps, SparkRadioColor };
|
|
32
|
+
//# sourceMappingURL=radio.d.cts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { u as SparkStyle } from "../theme-types-8wjgiNA_.js";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { Radio as Radio$1 } from "@base-ui/react/radio";
|
|
6
|
+
import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
|
|
7
|
+
|
|
8
|
+
//#region src/components/radio.d.ts
|
|
9
|
+
type SparkRadioColor = 'accent' | 'neutral' | 'danger';
|
|
10
|
+
type RadioGroupProps = React$1.ComponentProps<typeof RadioGroup$1> & {
|
|
11
|
+
styleVariant?: SparkStyle;
|
|
12
|
+
color?: SparkRadioColor;
|
|
13
|
+
};
|
|
14
|
+
declare function RadioGroup({
|
|
15
|
+
className,
|
|
16
|
+
styleVariant,
|
|
17
|
+
color,
|
|
18
|
+
...props
|
|
19
|
+
}: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
type RadioProps = React$1.ComponentProps<typeof Radio$1.Root> & {
|
|
21
|
+
styleVariant?: SparkStyle;
|
|
22
|
+
color?: SparkRadioColor;
|
|
23
|
+
};
|
|
24
|
+
declare function Radio({
|
|
25
|
+
className,
|
|
26
|
+
styleVariant,
|
|
27
|
+
color,
|
|
28
|
+
...props
|
|
29
|
+
}: RadioProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps, SparkRadioColor };
|
|
32
|
+
//# sourceMappingURL=radio.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../utils/cn.js";
|
|
3
|
+
import { accentByColor } from "../lib/accent-colors.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Radio as Radio$1 } from "@base-ui/react/radio";
|
|
7
|
+
import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
|
|
8
|
+
//#region src/components/radio.tsx
|
|
9
|
+
function RadioGroup({ className, styleVariant, color, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(RadioGroup$1, {
|
|
11
|
+
"data-slot": "radio-group",
|
|
12
|
+
"data-style": styleVariant !== void 0 || color !== void 0 ? styleVariant ?? "solid" : void 0,
|
|
13
|
+
"data-accent-color": color ? accentByColor[color] : void 0,
|
|
14
|
+
className: cn("grid gap-[calc(var(--spark-layout-gap)*3)]", className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function Radio({ className, styleVariant, color, ...props }) {
|
|
19
|
+
const dataStyle = styleVariant !== void 0 || color !== void 0 ? styleVariant ?? "solid" : void 0;
|
|
20
|
+
const dataAccentColor = color ? accentByColor[color] : void 0;
|
|
21
|
+
return /* @__PURE__ */ jsx(Radio$1.Root, {
|
|
22
|
+
"data-slot": "radio",
|
|
23
|
+
"data-style": dataStyle,
|
|
24
|
+
"data-accent-color": dataAccentColor,
|
|
25
|
+
className: cn("peer relative inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border-2 transition-colors", "before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']", "focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden", "data-disabled:cursor-not-allowed data-disabled:opacity-50", "border-(--spark-style-idle-border,var(--spark-a7)) bg-base-accent-soft data-unchecked:border-(length:--spark-style-border-width,2px)", "data-checked:border-(--spark-radio-ring,var(--spark-9))", className),
|
|
26
|
+
...props,
|
|
27
|
+
children: /* @__PURE__ */ jsx(Radio$1.Indicator, {
|
|
28
|
+
"data-slot": "radio-indicator",
|
|
29
|
+
className: "flex items-center justify-center",
|
|
30
|
+
children: /* @__PURE__ */ jsx("span", { className: "size-4 rounded-full bg-(--spark-radio-dot,var(--spark-9)) motion-safe:animate-dot-pop" })
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Radio, RadioGroup };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=radio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio.js","names":["RadioGroupPrimitive","RadioPrimitive"],"sources":["../../src/components/radio.tsx"],"sourcesContent":["import { Radio as RadioPrimitive } from '@base-ui/react/radio'\nimport { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group'\nimport * as React from 'react'\nimport { accentByColor } from '../lib/accent-colors'\nimport type { SparkStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\nexport type SparkRadioColor = 'accent' | 'neutral' | 'danger'\n\ntype RadioGroupProps = React.ComponentProps<typeof RadioGroupPrimitive> & {\n styleVariant?: SparkStyle\n color?: SparkRadioColor\n}\n\nfunction RadioGroup({\n className,\n styleVariant,\n color,\n ...props\n}: RadioGroupProps) {\n const hasLook = styleVariant !== undefined || color !== undefined\n const dataStyle = hasLook ? (styleVariant ?? 'solid') : undefined\n const dataAccentColor = color ? accentByColor[color] : undefined\n\n return (\n <RadioGroupPrimitive\n data-slot=\"radio-group\"\n data-style={dataStyle}\n data-accent-color={dataAccentColor}\n className={cn('grid gap-[calc(var(--spark-layout-gap)*3)]', className)}\n {...props}\n />\n )\n}\n\ntype RadioProps = React.ComponentProps<typeof RadioPrimitive.Root> & {\n styleVariant?: SparkStyle\n color?: SparkRadioColor\n}\n\nfunction Radio({ className, styleVariant, color, ...props }: RadioProps) {\n const hasLook = styleVariant !== undefined || color !== undefined\n const dataStyle = hasLook ? (styleVariant ?? 'solid') : undefined\n const dataAccentColor = color ? accentByColor[color] : undefined\n\n return (\n <RadioPrimitive.Root\n data-slot=\"radio\"\n data-style={dataStyle}\n data-accent-color={dataAccentColor}\n className={cn(\n 'peer relative inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border-2 transition-colors',\n \"before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']\",\n 'focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-50',\n 'border-(--spark-style-idle-border,var(--spark-a7)) bg-base-accent-soft data-unchecked:border-(length:--spark-style-border-width,2px)',\n 'data-checked:border-(--spark-radio-ring,var(--spark-9))',\n className,\n )}\n {...props}\n >\n <RadioPrimitive.Indicator\n data-slot=\"radio-indicator\"\n className=\"flex items-center justify-center\"\n >\n <span className=\"size-4 rounded-full bg-(--spark-radio-dot,var(--spark-9)) motion-safe:animate-dot-pop\" />\n </RadioPrimitive.Indicator>\n </RadioPrimitive.Root>\n )\n}\n\nexport { Radio, RadioGroup }\nexport type { RadioGroupProps, RadioProps }\n"],"mappings":";;;;;;;;AAcA,SAAS,WAAW,EAClB,WACA,cACA,OACA,GAAG,SACe;CAKlB,OACE,oBAACA,cAAD;EACE,aAAU;EACV,cAPY,iBAAiB,KAAA,KAAa,UAAU,KAAA,IAC3B,gBAAgB,UAAW,KAAA;EAOpD,qBANoB,QAAQ,cAAc,SAAS,KAAA;EAOnD,WAAW,GAAG,8CAA8C,SAAS;EACrE,GAAI;CACL,CAAA;AAEL;AAOA,SAAS,MAAM,EAAE,WAAW,cAAc,OAAO,GAAG,SAAqB;CAEvE,MAAM,YADU,iBAAiB,KAAA,KAAa,UAAU,KAAA,IAC3B,gBAAgB,UAAW,KAAA;CACxD,MAAM,kBAAkB,QAAQ,cAAc,SAAS,KAAA;CAEvD,OACE,oBAACC,QAAe,MAAhB;EACE,aAAU;EACV,cAAY;EACZ,qBAAmB;EACnB,WAAW,GACT,gIACA,qIACA,iFACA,6DACA,wIACA,2DACA,SACF;EACA,GAAI;YAEJ,oBAACA,QAAe,WAAhB;GACE,aAAU;GACV,WAAU;aAEV,oBAAC,QAAD,EAAM,WAAU,wFAAyF,CAAA;EACjF,CAAA;CACP,CAAA;AAEzB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_chunk.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let react_dom = require("react-dom");
|
|
8
|
+
//#region src/components/reparent.tsx
|
|
9
|
+
const supportsMoveBefore = typeof Element !== "undefined" && "moveBefore" in Element.prototype;
|
|
10
|
+
function useReparent() {
|
|
11
|
+
const [host, setHost] = react.useState(null);
|
|
12
|
+
react.useEffect(() => {
|
|
13
|
+
const el = document.createElement("div");
|
|
14
|
+
el.style.display = "contents";
|
|
15
|
+
setHost(el);
|
|
16
|
+
return () => el.remove();
|
|
17
|
+
}, []);
|
|
18
|
+
const park = react.useCallback(() => {
|
|
19
|
+
if (supportsMoveBefore && host?.isConnected) {
|
|
20
|
+
host.style.display = "none";
|
|
21
|
+
document.body.moveBefore(host, null);
|
|
22
|
+
}
|
|
23
|
+
}, [host]);
|
|
24
|
+
return react.useMemo(() => ({
|
|
25
|
+
host,
|
|
26
|
+
park
|
|
27
|
+
}), [host, park]);
|
|
28
|
+
}
|
|
29
|
+
function ReparentContent({ handle, children }) {
|
|
30
|
+
if (!handle.host) return null;
|
|
31
|
+
return (0, react_dom.createPortal)(children, handle.host);
|
|
32
|
+
}
|
|
33
|
+
function ReparentSlot({ handle, ...props }) {
|
|
34
|
+
const ref = react.useRef(null);
|
|
35
|
+
const host = handle.host;
|
|
36
|
+
react.useLayoutEffect(() => {
|
|
37
|
+
const slot = ref.current;
|
|
38
|
+
if (!slot || !host) return;
|
|
39
|
+
host.style.display = "contents";
|
|
40
|
+
if (supportsMoveBefore && host.isConnected) slot.moveBefore(host, null);
|
|
41
|
+
else slot.appendChild(host);
|
|
42
|
+
}, [host]);
|
|
43
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
44
|
+
"data-slot": "reparent-slot",
|
|
45
|
+
ref,
|
|
46
|
+
...props
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.ReparentContent = ReparentContent;
|
|
51
|
+
exports.ReparentSlot = ReparentSlot;
|
|
52
|
+
exports.supportsMoveBefore = supportsMoveBefore;
|
|
53
|
+
exports.useReparent = useReparent;
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=reparent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reparent.cjs","names":["React"],"sources":["../../src/components/reparent.tsx"],"sourcesContent":["import * as React from 'react'\nimport { createPortal } from 'react-dom'\n\n// moveBefore ships in Chrome/Edge 133+, Firefox 144+; Safari has no state-preserving move\nconst supportsMoveBefore =\n typeof Element !== 'undefined' && 'moveBefore' in Element.prototype\n\ntype MovableElement = Element & {\n moveBefore: (node: Node, child: Node | null) => void\n}\n\ninterface ReparentHandle {\n host: HTMLElement | null\n park: () => void\n}\n\n// host created after mount so server and client hydrate the same (empty) markup\nfunction useReparent(): ReparentHandle {\n const [host, setHost] = React.useState<HTMLElement | null>(null)\n React.useEffect(() => {\n const el = document.createElement('div')\n el.style.display = 'contents'\n setHost(el)\n return () => el.remove()\n }, [])\n const park = React.useCallback(() => {\n if (supportsMoveBefore && host?.isConnected) {\n host.style.display = 'none'\n ;(document.body as unknown as MovableElement).moveBefore(host, null)\n }\n }, [host])\n return React.useMemo(() => ({ host, park }), [host, park])\n}\n\nfunction ReparentContent({\n handle,\n children,\n}: {\n handle: ReparentHandle\n children: React.ReactNode\n}) {\n if (!handle.host) return null\n return createPortal(children, handle.host)\n}\n\ninterface ReparentSlotProps extends React.ComponentProps<'div'> {\n handle: ReparentHandle\n}\n\nfunction ReparentSlot({ handle, ...props }: ReparentSlotProps) {\n const ref = React.useRef<HTMLDivElement>(null)\n const host = handle.host\n React.useLayoutEffect(() => {\n const slot = ref.current\n if (!slot || !host) return\n host.style.display = 'contents'\n if (supportsMoveBefore && host.isConnected) {\n ;(slot as unknown as MovableElement).moveBefore(host, null)\n } else {\n slot.appendChild(host)\n }\n }, [host])\n return <div data-slot=\"reparent-slot\" ref={ref} {...props} />\n}\n\nexport { ReparentContent, ReparentSlot, supportsMoveBefore, useReparent }\nexport type { ReparentHandle, ReparentSlotProps }\n"],"mappings":";;;;;;;;AAIA,MAAM,qBACJ,OAAO,YAAY,eAAe,gBAAgB,QAAQ;AAY5D,SAAS,cAA8B;CACrC,MAAM,CAAC,MAAM,WAAWA,MAAM,SAA6B,IAAI;CAC/D,MAAM,gBAAgB;EACpB,MAAM,KAAK,SAAS,cAAc,KAAK;EACvC,GAAG,MAAM,UAAU;EACnB,QAAQ,EAAE;EACV,aAAa,GAAG,OAAO;CACzB,GAAG,CAAC,CAAC;CACL,MAAM,OAAOA,MAAM,kBAAkB;EACnC,IAAI,sBAAsB,MAAM,aAAa;GAC3C,KAAK,MAAM,UAAU;GACpB,SAAU,KAAmC,WAAW,MAAM,IAAI;EACrE;CACF,GAAG,CAAC,IAAI,CAAC;CACT,OAAOA,MAAM,eAAe;EAAE;EAAM;CAAK,IAAI,CAAC,MAAM,IAAI,CAAC;AAC3D;AAEA,SAAS,gBAAgB,EACvB,QACA,YAIC;CACD,IAAI,CAAC,OAAO,MAAM,OAAO;CACzB,QAAA,GAAA,UAAA,cAAoB,UAAU,OAAO,IAAI;AAC3C;AAMA,SAAS,aAAa,EAAE,QAAQ,GAAG,SAA4B;CAC7D,MAAM,MAAMA,MAAM,OAAuB,IAAI;CAC7C,MAAM,OAAO,OAAO;CACpB,MAAM,sBAAsB;EAC1B,MAAM,OAAO,IAAI;EACjB,IAAI,CAAC,QAAQ,CAAC,MAAM;EACpB,KAAK,MAAM,UAAU;EACrB,IAAI,sBAAsB,KAAK,aAC5B,KAAoC,WAAW,MAAM,IAAI;OAE1D,KAAK,YAAY,IAAI;CAEzB,GAAG,CAAC,IAAI,CAAC;CACT,OAAO,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,aAAU;EAAqB;EAAK,GAAI;CAAQ,CAAA;AAC9D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/reparent.d.ts
|
|
6
|
+
declare const supportsMoveBefore: boolean;
|
|
7
|
+
interface ReparentHandle {
|
|
8
|
+
host: HTMLElement | null;
|
|
9
|
+
park: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare function useReparent(): ReparentHandle;
|
|
12
|
+
declare function ReparentContent({
|
|
13
|
+
handle,
|
|
14
|
+
children
|
|
15
|
+
}: {
|
|
16
|
+
handle: ReparentHandle;
|
|
17
|
+
children: React$1.ReactNode;
|
|
18
|
+
}): React$1.ReactPortal | null;
|
|
19
|
+
interface ReparentSlotProps extends React$1.ComponentProps<'div'> {
|
|
20
|
+
handle: ReparentHandle;
|
|
21
|
+
}
|
|
22
|
+
declare function ReparentSlot({
|
|
23
|
+
handle,
|
|
24
|
+
...props
|
|
25
|
+
}: ReparentSlotProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ReparentContent, type ReparentHandle, ReparentSlot, type ReparentSlotProps, supportsMoveBefore, useReparent };
|
|
28
|
+
//# sourceMappingURL=reparent.d.cts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/reparent.d.ts
|
|
6
|
+
declare const supportsMoveBefore: boolean;
|
|
7
|
+
interface ReparentHandle {
|
|
8
|
+
host: HTMLElement | null;
|
|
9
|
+
park: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare function useReparent(): ReparentHandle;
|
|
12
|
+
declare function ReparentContent({
|
|
13
|
+
handle,
|
|
14
|
+
children
|
|
15
|
+
}: {
|
|
16
|
+
handle: ReparentHandle;
|
|
17
|
+
children: React$1.ReactNode;
|
|
18
|
+
}): React$1.ReactPortal | null;
|
|
19
|
+
interface ReparentSlotProps extends React$1.ComponentProps<'div'> {
|
|
20
|
+
handle: ReparentHandle;
|
|
21
|
+
}
|
|
22
|
+
declare function ReparentSlot({
|
|
23
|
+
handle,
|
|
24
|
+
...props
|
|
25
|
+
}: ReparentSlotProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ReparentContent, type ReparentHandle, ReparentSlot, type ReparentSlotProps, supportsMoveBefore, useReparent };
|
|
28
|
+
//# sourceMappingURL=reparent.d.ts.map
|