@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,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../utils/cn.js";
|
|
4
|
+
import { CURATED_ACCENTS, accentSparkVars, generateAccentScale, getMatchingNeutral } from "../lib/accent-theme.js";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
8
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
9
|
+
//#region src/components/theme.tsx
|
|
10
|
+
const ThemeContext = React$1.createContext({});
|
|
11
|
+
/** Merged theme values from enclosing `<Theme>` providers. */
|
|
12
|
+
function useTheme() {
|
|
13
|
+
return React$1.useContext(ThemeContext);
|
|
14
|
+
}
|
|
15
|
+
/** Optional sugar: writes the theming `data-*` attrs + accent `--spark-*` vars onto a wrapper. */
|
|
16
|
+
const Theme = React$1.forwardRef(function Theme({ accentColor, neutralColor, radius, scaling, spacing, styleVariant, highContrast, labelPosition, inputStyle, inputColor, cardVariant, cardColor, appearance, render, className, style, children, ...rest }, ref) {
|
|
17
|
+
const parent = useTheme();
|
|
18
|
+
const value = React$1.useMemo(() => ({
|
|
19
|
+
accentColor: accentColor ?? parent.accentColor,
|
|
20
|
+
neutralColor: neutralColor ?? parent.neutralColor,
|
|
21
|
+
radius: radius ?? parent.radius,
|
|
22
|
+
scaling: scaling ?? parent.scaling,
|
|
23
|
+
spacing: spacing ?? parent.spacing,
|
|
24
|
+
styleVariant: styleVariant ?? parent.styleVariant,
|
|
25
|
+
highContrast: highContrast ?? parent.highContrast,
|
|
26
|
+
labelPosition: labelPosition ?? parent.labelPosition,
|
|
27
|
+
inputStyle: inputStyle ?? parent.inputStyle,
|
|
28
|
+
inputColor: inputColor ?? parent.inputColor,
|
|
29
|
+
cardVariant: cardVariant ?? parent.cardVariant,
|
|
30
|
+
cardColor: cardColor ?? parent.cardColor,
|
|
31
|
+
appearance: appearance ?? parent.appearance
|
|
32
|
+
}), [
|
|
33
|
+
accentColor,
|
|
34
|
+
neutralColor,
|
|
35
|
+
radius,
|
|
36
|
+
scaling,
|
|
37
|
+
spacing,
|
|
38
|
+
styleVariant,
|
|
39
|
+
highContrast,
|
|
40
|
+
labelPosition,
|
|
41
|
+
inputStyle,
|
|
42
|
+
inputColor,
|
|
43
|
+
cardVariant,
|
|
44
|
+
cardColor,
|
|
45
|
+
appearance,
|
|
46
|
+
parent
|
|
47
|
+
]);
|
|
48
|
+
const scopeId = React$1.useId();
|
|
49
|
+
const accent = React$1.useMemo(() => {
|
|
50
|
+
const empty = {
|
|
51
|
+
inlineVars: {},
|
|
52
|
+
css: "",
|
|
53
|
+
scoped: false
|
|
54
|
+
};
|
|
55
|
+
if (!accentColor) return empty;
|
|
56
|
+
const toVars = (decls) => Object.fromEntries(decls.filter((decl) => decl.includes(":")).map((decl) => {
|
|
57
|
+
const i = decl.indexOf(":");
|
|
58
|
+
return [decl.slice(0, i).trim(), decl.slice(i + 1).replace(/;$/, "").trim()];
|
|
59
|
+
}));
|
|
60
|
+
try {
|
|
61
|
+
const hex = CURATED_ACCENTS[accentColor] ?? accentColor;
|
|
62
|
+
if (value.appearance) return {
|
|
63
|
+
inlineVars: toVars(accentSparkVars(generateAccentScale(hex, value.appearance))),
|
|
64
|
+
css: "",
|
|
65
|
+
scoped: false
|
|
66
|
+
};
|
|
67
|
+
const light = accentSparkVars(generateAccentScale(hex, "light"));
|
|
68
|
+
const dark = accentSparkVars(generateAccentScale(hex, "dark"));
|
|
69
|
+
const sel = `[data-spark-scope="${scopeId}"]`;
|
|
70
|
+
return {
|
|
71
|
+
inlineVars: {},
|
|
72
|
+
css: `${sel}{${light.join("")}}:is(.dark,.dark-theme) ${sel}{${dark.join("")}}`,
|
|
73
|
+
scoped: true
|
|
74
|
+
};
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.warn(`[Theme] Ignoring invalid accentColor "${accentColor}".`, error);
|
|
77
|
+
return empty;
|
|
78
|
+
}
|
|
79
|
+
}, [
|
|
80
|
+
accentColor,
|
|
81
|
+
value.appearance,
|
|
82
|
+
scopeId
|
|
83
|
+
]);
|
|
84
|
+
const resolvedNeutralColor = neutralColor === "auto" ? getMatchingNeutral(value.accentColor ?? "#005EB4") : neutralColor;
|
|
85
|
+
const element = useRender({
|
|
86
|
+
defaultTagName: "div",
|
|
87
|
+
render,
|
|
88
|
+
ref,
|
|
89
|
+
props: mergeProps({
|
|
90
|
+
className: cn("spark-theme", appearance, className),
|
|
91
|
+
"data-neutral-color": resolvedNeutralColor,
|
|
92
|
+
"data-radius": radius,
|
|
93
|
+
"data-scaling": scaling,
|
|
94
|
+
"data-spacing": spacing,
|
|
95
|
+
"data-style": styleVariant,
|
|
96
|
+
"data-high-contrast": highContrast ? "" : void 0,
|
|
97
|
+
"data-label-position": labelPosition,
|
|
98
|
+
"data-input-style": inputStyle,
|
|
99
|
+
"data-input-color": inputColor,
|
|
100
|
+
"data-card-variant": cardVariant,
|
|
101
|
+
"data-card-color": cardColor === "accent" ? "accent" : void 0,
|
|
102
|
+
"data-spark-scope": accent.scoped ? scopeId : void 0,
|
|
103
|
+
style: {
|
|
104
|
+
...accent.inlineVars,
|
|
105
|
+
...style
|
|
106
|
+
},
|
|
107
|
+
children
|
|
108
|
+
}, rest)
|
|
109
|
+
});
|
|
110
|
+
return /* @__PURE__ */ jsxs(ThemeContext.Provider, {
|
|
111
|
+
value,
|
|
112
|
+
children: [accent.css ? /* @__PURE__ */ jsx("style", { children: accent.css }) : null, element]
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
//#endregion
|
|
116
|
+
export { Theme, useTheme };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","names":["React"],"sources":["../../src/components/theme.tsx"],"sourcesContent":["'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport {\n CURATED_ACCENTS,\n accentSparkVars,\n generateAccentScale,\n getMatchingNeutral,\n type Appearance,\n} from '../lib/accent-theme'\nimport type {\n SparkCardColor,\n SparkCardVariant,\n SparkInputColor,\n SparkInputStyle,\n SparkLabelPosition,\n SparkNeutral,\n SparkRadius,\n SparkScaling,\n SparkSpacing,\n SparkStyle,\n} from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\nexport type {\n SparkCardColor,\n SparkCardVariant,\n SparkInputColor,\n SparkInputStyle,\n SparkLabelPosition,\n SparkNeutral,\n SparkRadius,\n SparkScaling,\n SparkSpacing,\n SparkStyle,\n} from '../lib/theme-types'\n\nexport interface ThemeValue {\n /** Curated accent name or a custom hex. */\n accentColor?: string\n /** A neutral name, or `'auto'` to pair one with the accent (Radix's `grayColor=\"auto\"`). */\n neutralColor?: SparkNeutral\n radius?: SparkRadius\n scaling?: SparkScaling\n spacing?: SparkSpacing\n styleVariant?: SparkStyle\n /** Orthogonal to `styleVariant`: shifts any style toward higher-contrast steps. */\n highContrast?: boolean\n labelPosition?: SparkLabelPosition\n inputStyle?: SparkInputStyle\n inputColor?: SparkInputColor\n /** App-level default `<Card>` chrome; a per-card `variant` prop overrides it. */\n cardVariant?: SparkCardVariant\n /** App-level default `<Card>` palette; a per-card `color` prop overrides it. */\n cardColor?: SparkCardColor\n appearance?: Appearance\n}\n\nconst ThemeContext = React.createContext<ThemeValue>({})\n\n/** Merged theme values from enclosing `<Theme>` providers. */\nexport function useTheme(): ThemeValue {\n return React.useContext(ThemeContext)\n}\n\nexport interface ThemeProps\n extends useRender.ComponentProps<'div'>, ThemeValue {}\n\n/** Optional sugar: writes the theming `data-*` attrs + accent `--spark-*` vars onto a wrapper. */\nexport const Theme = React.forwardRef<HTMLDivElement, ThemeProps>(\n function Theme(\n {\n accentColor,\n neutralColor,\n radius,\n scaling,\n spacing,\n styleVariant,\n highContrast,\n labelPosition,\n inputStyle,\n inputColor,\n cardVariant,\n cardColor,\n appearance,\n render,\n className,\n style,\n children,\n ...rest\n },\n ref,\n ) {\n const parent = useTheme()\n\n const value = React.useMemo<ThemeValue>(\n () => ({\n accentColor: accentColor ?? parent.accentColor,\n neutralColor: neutralColor ?? parent.neutralColor,\n radius: radius ?? parent.radius,\n scaling: scaling ?? parent.scaling,\n spacing: spacing ?? parent.spacing,\n styleVariant: styleVariant ?? parent.styleVariant,\n highContrast: highContrast ?? parent.highContrast,\n labelPosition: labelPosition ?? parent.labelPosition,\n inputStyle: inputStyle ?? parent.inputStyle,\n inputColor: inputColor ?? parent.inputColor,\n cardVariant: cardVariant ?? parent.cardVariant,\n cardColor: cardColor ?? parent.cardColor,\n appearance: appearance ?? parent.appearance,\n }),\n [\n accentColor,\n neutralColor,\n radius,\n scaling,\n spacing,\n styleVariant,\n highContrast,\n labelPosition,\n inputStyle,\n inputColor,\n cardVariant,\n cardColor,\n appearance,\n parent,\n ],\n )\n\n // Scope id for the ambient-appearance case (both scales emitted in a <style>).\n const scopeId = React.useId()\n\n const accent = React.useMemo(() => {\n const empty = {\n inlineVars: {} as React.CSSProperties,\n css: '',\n scoped: false,\n }\n if (!accentColor) return empty\n\n const toVars = (decls: string[]) =>\n Object.fromEntries(\n decls\n .filter((decl) => decl.includes(':'))\n .map((decl) => {\n const i = decl.indexOf(':')\n return [\n decl.slice(0, i).trim(),\n decl\n .slice(i + 1)\n .replace(/;$/, '')\n .trim(),\n ]\n }),\n ) as React.CSSProperties\n\n try {\n const hex = CURATED_ACCENTS[accentColor] ?? accentColor\n\n // Explicit appearance → single-scale inline vars. Correct for a light\n // island inside a dark page (which must NOT pick up the dark scale).\n if (value.appearance) {\n return {\n inlineVars: toVars(\n accentSparkVars(generateAccentScale(hex, value.appearance)),\n ),\n css: '',\n scoped: false,\n }\n }\n\n // Ambient appearance → emit BOTH scales in a scoped <style> so the\n // `.dark` class selects the right one. Without this, a single-appearance\n // inline scale (default light) breaks components in dark mode.\n const light = accentSparkVars(generateAccentScale(hex, 'light'))\n const dark = accentSparkVars(generateAccentScale(hex, 'dark'))\n const sel = `[data-spark-scope=\"${scopeId}\"]`\n const css = `${sel}{${light.join('')}}:is(.dark,.dark-theme) ${sel}{${dark.join('')}}`\n return { inlineVars: {} as React.CSSProperties, css, scoped: true }\n } catch (error) {\n // A bad accentColor must not throw through render — fall back to the default theme.\n console.warn(\n `[Theme] Ignoring invalid accentColor \"${accentColor}\".`,\n error,\n )\n return empty\n }\n }, [accentColor, value.appearance, scopeId])\n\n // 'auto' pairs a neutral with the effective accent (Radix's grayColor=\"auto\").\n const resolvedNeutralColor =\n neutralColor === 'auto'\n ? getMatchingNeutral(value.accentColor ?? '#005EB4')\n : neutralColor\n\n const element = useRender({\n defaultTagName: 'div',\n render,\n ref,\n props: mergeProps<'div'>(\n {\n className: cn('spark-theme', appearance, className),\n 'data-neutral-color': resolvedNeutralColor,\n 'data-radius': radius,\n 'data-scaling': scaling,\n 'data-spacing': spacing,\n 'data-style': styleVariant,\n 'data-high-contrast': highContrast ? '' : undefined,\n 'data-label-position': labelPosition,\n 'data-input-style': inputStyle,\n 'data-input-color': inputColor,\n 'data-card-variant': cardVariant,\n 'data-card-color': cardColor === 'accent' ? 'accent' : undefined,\n 'data-spark-scope': accent.scoped ? scopeId : undefined,\n style: { ...accent.inlineVars, ...style },\n children,\n } as React.ComponentProps<'div'>,\n rest,\n ),\n })\n\n return (\n <ThemeContext.Provider value={value}>\n {accent.css ? <style>{accent.css}</style> : null}\n {element}\n </ThemeContext.Provider>\n )\n },\n)\n"],"mappings":"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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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/thumbnail.tsx
|
|
9
|
+
const ratioClasses = {
|
|
10
|
+
"1:1": "aspect-square",
|
|
11
|
+
"3:2": "aspect-[3/2]",
|
|
12
|
+
"4:3": "aspect-[4/3]",
|
|
13
|
+
"16:9": "aspect-[16/9]",
|
|
14
|
+
"3:4": "aspect-[3/4]",
|
|
15
|
+
"2:3": "aspect-[2/3]"
|
|
16
|
+
};
|
|
17
|
+
const radiusClasses = {
|
|
18
|
+
none: "rounded-none",
|
|
19
|
+
sm: "rounded-sm",
|
|
20
|
+
md: "rounded-md",
|
|
21
|
+
lg: "rounded-lg",
|
|
22
|
+
full: "rounded-full"
|
|
23
|
+
};
|
|
24
|
+
function Thumbnail({ className, src, alt = "", ratio = "1:1", fit = "cover", radius = "md", imgProps, children, ...props }) {
|
|
25
|
+
const [errored, setErrored] = react.useState(false);
|
|
26
|
+
const imgRef = react.useRef(null);
|
|
27
|
+
react.useEffect(() => {
|
|
28
|
+
setErrored(false);
|
|
29
|
+
const node = imgRef.current;
|
|
30
|
+
if (node?.complete && node.naturalWidth === 0) setErrored(true);
|
|
31
|
+
}, [src]);
|
|
32
|
+
const showImage = !!src && !errored;
|
|
33
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
34
|
+
"data-slot": "thumbnail",
|
|
35
|
+
className: (0, cnfast.cn)("relative flex items-center justify-center overflow-hidden bg-base-gray-soft", ratioClasses[ratio], radiusClasses[radius], className),
|
|
36
|
+
...props,
|
|
37
|
+
children: showImage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
38
|
+
...imgProps,
|
|
39
|
+
ref: imgRef,
|
|
40
|
+
src,
|
|
41
|
+
alt,
|
|
42
|
+
onError: (e) => {
|
|
43
|
+
setErrored(true);
|
|
44
|
+
imgProps?.onError?.(e);
|
|
45
|
+
},
|
|
46
|
+
className: (0, cnfast.cn)("size-full", fit === "contain" ? "object-contain" : "object-cover", imgProps?.className)
|
|
47
|
+
}) : children
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
Thumbnail.displayName = "Thumbnail";
|
|
51
|
+
//#endregion
|
|
52
|
+
exports.Thumbnail = Thumbnail;
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=thumbnail.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thumbnail.cjs","names":["React"],"sources":["../../src/components/thumbnail.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\ntype ThumbnailRatio = '1:1' | '3:2' | '4:3' | '16:9' | '3:4' | '2:3'\ntype ThumbnailFit = 'cover' | 'contain'\ntype ThumbnailRadius = 'none' | 'sm' | 'md' | 'lg' | 'full'\n\nconst ratioClasses = {\n '1:1': 'aspect-square',\n '3:2': 'aspect-[3/2]',\n '4:3': 'aspect-[4/3]',\n '16:9': 'aspect-[16/9]',\n '3:4': 'aspect-[3/4]',\n '2:3': 'aspect-[2/3]',\n}\n\nconst radiusClasses = {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n full: 'rounded-full',\n}\n\ninterface ThumbnailProps extends React.ComponentProps<'div'> {\n src?: string\n alt?: string\n ratio?: ThumbnailRatio\n fit?: ThumbnailFit\n radius?: ThumbnailRadius\n imgProps?: React.ComponentProps<'img'>\n}\n\nfunction Thumbnail({\n className,\n src,\n alt = '',\n ratio = '1:1',\n fit = 'cover',\n radius = 'md',\n imgProps,\n children,\n ...props\n}: ThumbnailProps) {\n const [errored, setErrored] = React.useState(false)\n const imgRef = React.useRef<HTMLImageElement>(null)\n\n React.useEffect(() => {\n // A new src must clear a prior error, or a fixed src would stay stuck on the\n // fallback. An image that already failed before React attached onError (SSR\n // hydration, or a cached 404) never fires the event, so also detect that failure\n // straight from the DOM node here.\n setErrored(false)\n const node = imgRef.current\n if (node?.complete && node.naturalWidth === 0) setErrored(true)\n }, [src])\n\n const showImage = !!src && !errored\n\n return (\n <div\n data-slot=\"thumbnail\"\n className={cn(\n 'relative flex items-center justify-center overflow-hidden bg-base-gray-soft',\n ratioClasses[ratio],\n radiusClasses[radius],\n className,\n )}\n {...props}\n >\n {showImage ? (\n <img\n {...imgProps}\n ref={imgRef}\n src={src}\n alt={alt}\n onError={(e) => {\n setErrored(true)\n imgProps?.onError?.(e)\n }}\n className={cn(\n 'size-full',\n fit === 'contain' ? 'object-contain' : 'object-cover',\n imgProps?.className,\n )}\n />\n ) : (\n children\n )}\n </div>\n )\n}\n\nThumbnail.displayName = 'Thumbnail'\n\nexport { Thumbnail }\nexport type { ThumbnailProps, ThumbnailRatio, ThumbnailFit, ThumbnailRadius }\n"],"mappings":";;;;;;;;AAOA,MAAM,eAAe;CACnB,OAAO;CACP,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,OAAO;AACT;AAEA,MAAM,gBAAgB;CACpB,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;AACR;AAWA,SAAS,UAAU,EACjB,WACA,KACA,MAAM,IACN,QAAQ,OACR,MAAM,SACN,SAAS,MACT,UACA,UACA,GAAG,SACc;CACjB,MAAM,CAAC,SAAS,cAAcA,MAAM,SAAS,KAAK;CAClD,MAAM,SAASA,MAAM,OAAyB,IAAI;CAElD,MAAM,gBAAgB;EAKpB,WAAW,KAAK;EAChB,MAAM,OAAO,OAAO;EACpB,IAAI,MAAM,YAAY,KAAK,iBAAiB,GAAG,WAAW,IAAI;CAChE,GAAG,CAAC,GAAG,CAAC;CAER,MAAM,YAAY,CAAC,CAAC,OAAO,CAAC;CAE5B,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,aAAU;EACV,YAAA,GAAA,OAAA,IACE,+EACA,aAAa,QACb,cAAc,SACd,SACF;EACA,GAAI;YAEH,YACC,iBAAA,GAAA,kBAAA,KAAC,OAAD;GACE,GAAI;GACJ,KAAK;GACA;GACA;GACL,UAAU,MAAM;IACd,WAAW,IAAI;IACf,UAAU,UAAU,CAAC;GACvB;GACA,YAAA,GAAA,OAAA,IACE,aACA,QAAQ,YAAY,mBAAmB,gBACvC,UAAU,SACZ;EACD,CAAA,IAED;CAEC,CAAA;AAET;AAEA,UAAU,cAAc"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/thumbnail.d.ts
|
|
6
|
+
type ThumbnailRatio = '1:1' | '3:2' | '4:3' | '16:9' | '3:4' | '2:3';
|
|
7
|
+
type ThumbnailFit = 'cover' | 'contain';
|
|
8
|
+
type ThumbnailRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
9
|
+
interface ThumbnailProps extends React$1.ComponentProps<'div'> {
|
|
10
|
+
src?: string;
|
|
11
|
+
alt?: string;
|
|
12
|
+
ratio?: ThumbnailRatio;
|
|
13
|
+
fit?: ThumbnailFit;
|
|
14
|
+
radius?: ThumbnailRadius;
|
|
15
|
+
imgProps?: React$1.ComponentProps<'img'>;
|
|
16
|
+
}
|
|
17
|
+
declare function Thumbnail({
|
|
18
|
+
className,
|
|
19
|
+
src,
|
|
20
|
+
alt,
|
|
21
|
+
ratio,
|
|
22
|
+
fit,
|
|
23
|
+
radius,
|
|
24
|
+
imgProps,
|
|
25
|
+
children,
|
|
26
|
+
...props
|
|
27
|
+
}: ThumbnailProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare namespace Thumbnail {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Thumbnail, type ThumbnailFit, type ThumbnailProps, type ThumbnailRadius, type ThumbnailRatio };
|
|
33
|
+
//# sourceMappingURL=thumbnail.d.cts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/thumbnail.d.ts
|
|
6
|
+
type ThumbnailRatio = '1:1' | '3:2' | '4:3' | '16:9' | '3:4' | '2:3';
|
|
7
|
+
type ThumbnailFit = 'cover' | 'contain';
|
|
8
|
+
type ThumbnailRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
9
|
+
interface ThumbnailProps extends React$1.ComponentProps<'div'> {
|
|
10
|
+
src?: string;
|
|
11
|
+
alt?: string;
|
|
12
|
+
ratio?: ThumbnailRatio;
|
|
13
|
+
fit?: ThumbnailFit;
|
|
14
|
+
radius?: ThumbnailRadius;
|
|
15
|
+
imgProps?: React$1.ComponentProps<'img'>;
|
|
16
|
+
}
|
|
17
|
+
declare function Thumbnail({
|
|
18
|
+
className,
|
|
19
|
+
src,
|
|
20
|
+
alt,
|
|
21
|
+
ratio,
|
|
22
|
+
fit,
|
|
23
|
+
radius,
|
|
24
|
+
imgProps,
|
|
25
|
+
children,
|
|
26
|
+
...props
|
|
27
|
+
}: ThumbnailProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare namespace Thumbnail {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Thumbnail, type ThumbnailFit, type ThumbnailProps, type ThumbnailRadius, type ThumbnailRatio };
|
|
33
|
+
//# sourceMappingURL=thumbnail.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
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/thumbnail.tsx
|
|
6
|
+
const ratioClasses = {
|
|
7
|
+
"1:1": "aspect-square",
|
|
8
|
+
"3:2": "aspect-[3/2]",
|
|
9
|
+
"4:3": "aspect-[4/3]",
|
|
10
|
+
"16:9": "aspect-[16/9]",
|
|
11
|
+
"3:4": "aspect-[3/4]",
|
|
12
|
+
"2:3": "aspect-[2/3]"
|
|
13
|
+
};
|
|
14
|
+
const radiusClasses = {
|
|
15
|
+
none: "rounded-none",
|
|
16
|
+
sm: "rounded-sm",
|
|
17
|
+
md: "rounded-md",
|
|
18
|
+
lg: "rounded-lg",
|
|
19
|
+
full: "rounded-full"
|
|
20
|
+
};
|
|
21
|
+
function Thumbnail({ className, src, alt = "", ratio = "1:1", fit = "cover", radius = "md", imgProps, children, ...props }) {
|
|
22
|
+
const [errored, setErrored] = React$1.useState(false);
|
|
23
|
+
const imgRef = React$1.useRef(null);
|
|
24
|
+
React$1.useEffect(() => {
|
|
25
|
+
setErrored(false);
|
|
26
|
+
const node = imgRef.current;
|
|
27
|
+
if (node?.complete && node.naturalWidth === 0) setErrored(true);
|
|
28
|
+
}, [src]);
|
|
29
|
+
const showImage = !!src && !errored;
|
|
30
|
+
return /* @__PURE__ */ jsx("div", {
|
|
31
|
+
"data-slot": "thumbnail",
|
|
32
|
+
className: cn("relative flex items-center justify-center overflow-hidden bg-base-gray-soft", ratioClasses[ratio], radiusClasses[radius], className),
|
|
33
|
+
...props,
|
|
34
|
+
children: showImage ? /* @__PURE__ */ jsx("img", {
|
|
35
|
+
...imgProps,
|
|
36
|
+
ref: imgRef,
|
|
37
|
+
src,
|
|
38
|
+
alt,
|
|
39
|
+
onError: (e) => {
|
|
40
|
+
setErrored(true);
|
|
41
|
+
imgProps?.onError?.(e);
|
|
42
|
+
},
|
|
43
|
+
className: cn("size-full", fit === "contain" ? "object-contain" : "object-cover", imgProps?.className)
|
|
44
|
+
}) : children
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
Thumbnail.displayName = "Thumbnail";
|
|
48
|
+
//#endregion
|
|
49
|
+
export { Thumbnail };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=thumbnail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thumbnail.js","names":["React"],"sources":["../../src/components/thumbnail.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\ntype ThumbnailRatio = '1:1' | '3:2' | '4:3' | '16:9' | '3:4' | '2:3'\ntype ThumbnailFit = 'cover' | 'contain'\ntype ThumbnailRadius = 'none' | 'sm' | 'md' | 'lg' | 'full'\n\nconst ratioClasses = {\n '1:1': 'aspect-square',\n '3:2': 'aspect-[3/2]',\n '4:3': 'aspect-[4/3]',\n '16:9': 'aspect-[16/9]',\n '3:4': 'aspect-[3/4]',\n '2:3': 'aspect-[2/3]',\n}\n\nconst radiusClasses = {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n full: 'rounded-full',\n}\n\ninterface ThumbnailProps extends React.ComponentProps<'div'> {\n src?: string\n alt?: string\n ratio?: ThumbnailRatio\n fit?: ThumbnailFit\n radius?: ThumbnailRadius\n imgProps?: React.ComponentProps<'img'>\n}\n\nfunction Thumbnail({\n className,\n src,\n alt = '',\n ratio = '1:1',\n fit = 'cover',\n radius = 'md',\n imgProps,\n children,\n ...props\n}: ThumbnailProps) {\n const [errored, setErrored] = React.useState(false)\n const imgRef = React.useRef<HTMLImageElement>(null)\n\n React.useEffect(() => {\n // A new src must clear a prior error, or a fixed src would stay stuck on the\n // fallback. An image that already failed before React attached onError (SSR\n // hydration, or a cached 404) never fires the event, so also detect that failure\n // straight from the DOM node here.\n setErrored(false)\n const node = imgRef.current\n if (node?.complete && node.naturalWidth === 0) setErrored(true)\n }, [src])\n\n const showImage = !!src && !errored\n\n return (\n <div\n data-slot=\"thumbnail\"\n className={cn(\n 'relative flex items-center justify-center overflow-hidden bg-base-gray-soft',\n ratioClasses[ratio],\n radiusClasses[radius],\n className,\n )}\n {...props}\n >\n {showImage ? (\n <img\n {...imgProps}\n ref={imgRef}\n src={src}\n alt={alt}\n onError={(e) => {\n setErrored(true)\n imgProps?.onError?.(e)\n }}\n className={cn(\n 'size-full',\n fit === 'contain' ? 'object-contain' : 'object-cover',\n imgProps?.className,\n )}\n />\n ) : (\n children\n )}\n </div>\n )\n}\n\nThumbnail.displayName = 'Thumbnail'\n\nexport { Thumbnail }\nexport type { ThumbnailProps, ThumbnailRatio, ThumbnailFit, ThumbnailRadius }\n"],"mappings":";;;;;AAOA,MAAM,eAAe;CACnB,OAAO;CACP,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,OAAO;AACT;AAEA,MAAM,gBAAgB;CACpB,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;AACR;AAWA,SAAS,UAAU,EACjB,WACA,KACA,MAAM,IACN,QAAQ,OACR,MAAM,SACN,SAAS,MACT,UACA,UACA,GAAG,SACc;CACjB,MAAM,CAAC,SAAS,cAAcA,QAAM,SAAS,KAAK;CAClD,MAAM,SAASA,QAAM,OAAyB,IAAI;CAElD,QAAM,gBAAgB;EAKpB,WAAW,KAAK;EAChB,MAAM,OAAO,OAAO;EACpB,IAAI,MAAM,YAAY,KAAK,iBAAiB,GAAG,WAAW,IAAI;CAChE,GAAG,CAAC,GAAG,CAAC;CAER,MAAM,YAAY,CAAC,CAAC,OAAO,CAAC;CAE5B,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,+EACA,aAAa,QACb,cAAc,SACd,SACF;EACA,GAAI;YAEH,YACC,oBAAC,OAAD;GACE,GAAI;GACJ,KAAK;GACA;GACA;GACL,UAAU,MAAM;IACd,WAAW,IAAI;IACf,UAAU,UAAU,CAAC;GACvB;GACA,WAAW,GACT,aACA,QAAQ,YAAY,mBAAmB,gBACvC,UAAU,SACZ;EACD,CAAA,IAED;CAEC,CAAA;AAET;AAEA,UAAU,cAAc"}
|
|
@@ -0,0 +1,105 @@
|
|
|
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/time-picker.tsx
|
|
9
|
+
const MINUTES_PER_DAY = 1440;
|
|
10
|
+
/**
|
|
11
|
+
* Move `HH:mm` one grid step in `direction`, aligning to the `step` grid first.
|
|
12
|
+
* A native `<input type="time">` steps each focused segment by one unit and
|
|
13
|
+
* ignores `step`, so callers that want arrow keys to move by a coarse step
|
|
14
|
+
* (e.g. 5 minutes) route the arrow keys through this instead. Clamped to
|
|
15
|
+
* `00:00`–`23:55` (no wrap); an off-grid start lands on the next grid point in
|
|
16
|
+
* the pressed direction.
|
|
17
|
+
*/
|
|
18
|
+
function stepGridValue(value, step, direction) {
|
|
19
|
+
const stepMinutes = Math.floor(step / 60);
|
|
20
|
+
if (stepMinutes <= 1) return value;
|
|
21
|
+
const match = /^(\d{1,2}):(\d{2})/.exec(value);
|
|
22
|
+
const base = match ? Number(match[1]) * 60 + Number(match[2]) : 0;
|
|
23
|
+
const next = direction === 1 ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes;
|
|
24
|
+
const lastOnGrid = Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes;
|
|
25
|
+
const clamped = Math.max(0, Math.min(next, lastOnGrid));
|
|
26
|
+
return `${String(Math.floor(clamped / 60)).padStart(2, "0")}:${String(clamped % 60).padStart(2, "0")}`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Round `HH:mm` to the nearest multiple of `step` (used to autofix a typed
|
|
30
|
+
* off-grid value on blur). Already-on-grid values pass through unchanged (so a
|
|
31
|
+
* seconds suffix is preserved); anything that isn't `HH:mm(:ss)` passes through.
|
|
32
|
+
*/
|
|
33
|
+
function snapToNearestStep(value, step) {
|
|
34
|
+
const stepMinutes = Math.floor(step / 60);
|
|
35
|
+
if (stepMinutes <= 1) return value;
|
|
36
|
+
const match = /^(\d{1,2}):(\d{2})/.exec(value);
|
|
37
|
+
if (!match) return value;
|
|
38
|
+
const minutes = Number(match[2]);
|
|
39
|
+
if (minutes % stepMinutes === 0) return value;
|
|
40
|
+
const total = Number(match[1]) * 60 + minutes;
|
|
41
|
+
const lastOnGrid = Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes;
|
|
42
|
+
const snapped = Math.min(Math.round(total / stepMinutes) * stepMinutes, lastOnGrid);
|
|
43
|
+
return `${String(Math.floor(snapped / 60)).padStart(2, "0")}:${String(snapped % 60).padStart(2, "0")}`;
|
|
44
|
+
}
|
|
45
|
+
const TimePicker = react.forwardRef(({ "aria-label": ariaLabel, className, disabled, id, onValueChange, step = 60, value }, ref) => {
|
|
46
|
+
const stepMinutes = Math.floor(step / 60);
|
|
47
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
48
|
+
ref,
|
|
49
|
+
id,
|
|
50
|
+
type: "time",
|
|
51
|
+
value,
|
|
52
|
+
step,
|
|
53
|
+
disabled,
|
|
54
|
+
onChange: (event) => onValueChange(event.target.value),
|
|
55
|
+
onKeyDown: (event) => {
|
|
56
|
+
if (stepMinutes <= 1) return;
|
|
57
|
+
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
onValueChange(stepGridValue(value, step, event.key === "ArrowUp" ? 1 : -1));
|
|
60
|
+
},
|
|
61
|
+
onBlur: (event) => {
|
|
62
|
+
if (stepMinutes <= 1) return;
|
|
63
|
+
const snapped = snapToNearestStep(event.currentTarget.value, step);
|
|
64
|
+
if (snapped !== event.currentTarget.value) onValueChange(snapped);
|
|
65
|
+
},
|
|
66
|
+
"aria-label": ariaLabel,
|
|
67
|
+
className: (0, cnfast.cn)("h-10 w-full rounded-xl bg-base-gray-soft px-3 text-base font-medium text-gray tabular-nums transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className)
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
TimePicker.displayName = "TimePicker";
|
|
71
|
+
function TimeRangePicker({ className, disabled, end, endLabel = "End", onEndChange, onStartChange, start, startLabel = "Start", step }) {
|
|
72
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
73
|
+
className: (0, cnfast.cn)("grid grid-cols-2 gap-2", className),
|
|
74
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
75
|
+
className: "flex flex-col gap-1.5",
|
|
76
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
77
|
+
className: "text-xs font-medium text-gray-light",
|
|
78
|
+
children: startLabel
|
|
79
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimePicker, {
|
|
80
|
+
value: start,
|
|
81
|
+
onValueChange: onStartChange,
|
|
82
|
+
disabled,
|
|
83
|
+
step,
|
|
84
|
+
"aria-label": startLabel
|
|
85
|
+
})]
|
|
86
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
87
|
+
className: "flex flex-col gap-1.5",
|
|
88
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
89
|
+
className: "text-xs font-medium text-gray-light",
|
|
90
|
+
children: endLabel
|
|
91
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimePicker, {
|
|
92
|
+
value: end,
|
|
93
|
+
onValueChange: onEndChange,
|
|
94
|
+
disabled,
|
|
95
|
+
step,
|
|
96
|
+
"aria-label": endLabel
|
|
97
|
+
})]
|
|
98
|
+
})]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
exports.TimePicker = TimePicker;
|
|
103
|
+
exports.TimeRangePicker = TimeRangePicker;
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=time-picker.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-picker.cjs","names":["React"],"sources":["../../src/components/time-picker.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\ninterface TimePickerProps {\n /** `HH:MM` 24-hour string. */\n value: string\n onValueChange: (next: string) => void\n disabled?: boolean\n /** Step in seconds (defaults to 60 — minute-resolution). */\n step?: number\n className?: string\n id?: string\n 'aria-label'?: string\n}\n\nconst MINUTES_PER_DAY = 24 * 60\n\n/**\n * Move `HH:mm` one grid step in `direction`, aligning to the `step` grid first.\n * A native `<input type=\"time\">` steps each focused segment by one unit and\n * ignores `step`, so callers that want arrow keys to move by a coarse step\n * (e.g. 5 minutes) route the arrow keys through this instead. Clamped to\n * `00:00`–`23:55` (no wrap); an off-grid start lands on the next grid point in\n * the pressed direction.\n */\nfunction stepGridValue(value: string, step: number, direction: 1 | -1): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const match = /^(\\d{1,2}):(\\d{2})/.exec(value)\n const base = match ? Number(match[1]) * 60 + Number(match[2]) : 0\n const next =\n direction === 1\n ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes\n : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes\n const lastOnGrid =\n Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes\n const clamped = Math.max(0, Math.min(next, lastOnGrid))\n const hh = String(Math.floor(clamped / 60)).padStart(2, '0')\n const mm = String(clamped % 60).padStart(2, '0')\n return `${hh}:${mm}`\n}\n\n/**\n * Round `HH:mm` to the nearest multiple of `step` (used to autofix a typed\n * off-grid value on blur). Already-on-grid values pass through unchanged (so a\n * seconds suffix is preserved); anything that isn't `HH:mm(:ss)` passes through.\n */\nfunction snapToNearestStep(value: string, step: number): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const match = /^(\\d{1,2}):(\\d{2})/.exec(value)\n if (!match) return value\n const minutes = Number(match[2])\n if (minutes % stepMinutes === 0) return value\n const total = Number(match[1]) * 60 + minutes\n const lastOnGrid =\n Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes\n const snapped = Math.min(\n Math.round(total / stepMinutes) * stepMinutes,\n lastOnGrid,\n )\n const hh = String(Math.floor(snapped / 60)).padStart(2, '0')\n const mm = String(snapped % 60).padStart(2, '0')\n return `${hh}:${mm}`\n}\n\nconst TimePicker = React.forwardRef<HTMLInputElement, TimePickerProps>(\n (\n {\n 'aria-label': ariaLabel,\n className,\n disabled,\n id,\n onValueChange,\n step = 60,\n value,\n },\n ref,\n ) => {\n const stepMinutes = Math.floor(step / 60)\n return (\n <input\n ref={ref}\n id={id}\n type=\"time\"\n value={value}\n step={step}\n disabled={disabled}\n onChange={(event) => onValueChange(event.target.value)}\n onKeyDown={(event) => {\n // Native arrows step the focused segment by one unit and ignore step;\n // for a coarse grid, drive up/down through the grid instead.\n if (stepMinutes <= 1) return\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return\n event.preventDefault()\n onValueChange(\n stepGridValue(value, step, event.key === 'ArrowUp' ? 1 : -1),\n )\n }}\n onBlur={(event) => {\n // Autofix a typed off-grid value to the closest grid point on blur.\n if (stepMinutes <= 1) return\n const snapped = snapToNearestStep(event.currentTarget.value, step)\n if (snapped !== event.currentTarget.value) onValueChange(snapped)\n }}\n aria-label={ariaLabel}\n className={cn(\n 'h-10 w-full rounded-xl bg-base-gray-soft px-3 text-base font-medium text-gray tabular-nums transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n />\n )\n },\n)\n\nTimePicker.displayName = 'TimePicker'\n\ninterface TimeRangePickerProps {\n start: string\n end: string\n onStartChange: (next: string) => void\n onEndChange: (next: string) => void\n disabled?: boolean\n startLabel?: string\n endLabel?: string\n /** Step in seconds, forwarded to both inputs (defaults to 60). */\n step?: number\n className?: string\n}\n\nfunction TimeRangePicker({\n className,\n disabled,\n end,\n endLabel = 'End',\n onEndChange,\n onStartChange,\n start,\n startLabel = 'Start',\n step,\n}: TimeRangePickerProps) {\n return (\n <div className={cn('grid grid-cols-2 gap-2', className)}>\n <label className=\"flex flex-col gap-1.5\">\n <span className=\"text-xs font-medium text-gray-light\">\n {startLabel}\n </span>\n <TimePicker\n value={start}\n onValueChange={onStartChange}\n disabled={disabled}\n step={step}\n aria-label={startLabel}\n />\n </label>\n <label className=\"flex flex-col gap-1.5\">\n <span className=\"text-xs font-medium text-gray-light\">{endLabel}</span>\n <TimePicker\n value={end}\n onValueChange={onEndChange}\n disabled={disabled}\n step={step}\n aria-label={endLabel}\n />\n </label>\n </div>\n )\n}\n\nexport { TimePicker, TimeRangePicker }\n"],"mappings":"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"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/time-picker.d.ts
|
|
6
|
+
interface TimePickerProps {
|
|
7
|
+
/** `HH:MM` 24-hour string. */
|
|
8
|
+
value: string;
|
|
9
|
+
onValueChange: (next: string) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Step in seconds (defaults to 60 — minute-resolution). */
|
|
12
|
+
step?: number;
|
|
13
|
+
className?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
'aria-label'?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const TimePicker: React$1.ForwardRefExoticComponent<TimePickerProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
18
|
+
interface TimeRangePickerProps {
|
|
19
|
+
start: string;
|
|
20
|
+
end: string;
|
|
21
|
+
onStartChange: (next: string) => void;
|
|
22
|
+
onEndChange: (next: string) => void;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
startLabel?: string;
|
|
25
|
+
endLabel?: string;
|
|
26
|
+
/** Step in seconds, forwarded to both inputs (defaults to 60). */
|
|
27
|
+
step?: number;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
declare function TimeRangePicker({
|
|
31
|
+
className,
|
|
32
|
+
disabled,
|
|
33
|
+
end,
|
|
34
|
+
endLabel,
|
|
35
|
+
onEndChange,
|
|
36
|
+
onStartChange,
|
|
37
|
+
start,
|
|
38
|
+
startLabel,
|
|
39
|
+
step
|
|
40
|
+
}: TimeRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { TimePicker, TimeRangePicker };
|
|
43
|
+
//# sourceMappingURL=time-picker.d.cts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/time-picker.d.ts
|
|
6
|
+
interface TimePickerProps {
|
|
7
|
+
/** `HH:MM` 24-hour string. */
|
|
8
|
+
value: string;
|
|
9
|
+
onValueChange: (next: string) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Step in seconds (defaults to 60 — minute-resolution). */
|
|
12
|
+
step?: number;
|
|
13
|
+
className?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
'aria-label'?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const TimePicker: React$1.ForwardRefExoticComponent<TimePickerProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
18
|
+
interface TimeRangePickerProps {
|
|
19
|
+
start: string;
|
|
20
|
+
end: string;
|
|
21
|
+
onStartChange: (next: string) => void;
|
|
22
|
+
onEndChange: (next: string) => void;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
startLabel?: string;
|
|
25
|
+
endLabel?: string;
|
|
26
|
+
/** Step in seconds, forwarded to both inputs (defaults to 60). */
|
|
27
|
+
step?: number;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
declare function TimeRangePicker({
|
|
31
|
+
className,
|
|
32
|
+
disabled,
|
|
33
|
+
end,
|
|
34
|
+
endLabel,
|
|
35
|
+
onEndChange,
|
|
36
|
+
onStartChange,
|
|
37
|
+
start,
|
|
38
|
+
startLabel,
|
|
39
|
+
step
|
|
40
|
+
}: TimeRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { TimePicker, TimeRangePicker };
|
|
43
|
+
//# sourceMappingURL=time-picker.d.ts.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../utils/cn.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/time-picker.tsx
|
|
6
|
+
const MINUTES_PER_DAY = 1440;
|
|
7
|
+
/**
|
|
8
|
+
* Move `HH:mm` one grid step in `direction`, aligning to the `step` grid first.
|
|
9
|
+
* A native `<input type="time">` steps each focused segment by one unit and
|
|
10
|
+
* ignores `step`, so callers that want arrow keys to move by a coarse step
|
|
11
|
+
* (e.g. 5 minutes) route the arrow keys through this instead. Clamped to
|
|
12
|
+
* `00:00`–`23:55` (no wrap); an off-grid start lands on the next grid point in
|
|
13
|
+
* the pressed direction.
|
|
14
|
+
*/
|
|
15
|
+
function stepGridValue(value, step, direction) {
|
|
16
|
+
const stepMinutes = Math.floor(step / 60);
|
|
17
|
+
if (stepMinutes <= 1) return value;
|
|
18
|
+
const match = /^(\d{1,2}):(\d{2})/.exec(value);
|
|
19
|
+
const base = match ? Number(match[1]) * 60 + Number(match[2]) : 0;
|
|
20
|
+
const next = direction === 1 ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes;
|
|
21
|
+
const lastOnGrid = Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes;
|
|
22
|
+
const clamped = Math.max(0, Math.min(next, lastOnGrid));
|
|
23
|
+
return `${String(Math.floor(clamped / 60)).padStart(2, "0")}:${String(clamped % 60).padStart(2, "0")}`;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Round `HH:mm` to the nearest multiple of `step` (used to autofix a typed
|
|
27
|
+
* off-grid value on blur). Already-on-grid values pass through unchanged (so a
|
|
28
|
+
* seconds suffix is preserved); anything that isn't `HH:mm(:ss)` passes through.
|
|
29
|
+
*/
|
|
30
|
+
function snapToNearestStep(value, step) {
|
|
31
|
+
const stepMinutes = Math.floor(step / 60);
|
|
32
|
+
if (stepMinutes <= 1) return value;
|
|
33
|
+
const match = /^(\d{1,2}):(\d{2})/.exec(value);
|
|
34
|
+
if (!match) return value;
|
|
35
|
+
const minutes = Number(match[2]);
|
|
36
|
+
if (minutes % stepMinutes === 0) return value;
|
|
37
|
+
const total = Number(match[1]) * 60 + minutes;
|
|
38
|
+
const lastOnGrid = Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes;
|
|
39
|
+
const snapped = Math.min(Math.round(total / stepMinutes) * stepMinutes, lastOnGrid);
|
|
40
|
+
return `${String(Math.floor(snapped / 60)).padStart(2, "0")}:${String(snapped % 60).padStart(2, "0")}`;
|
|
41
|
+
}
|
|
42
|
+
const TimePicker = React$1.forwardRef(({ "aria-label": ariaLabel, className, disabled, id, onValueChange, step = 60, value }, ref) => {
|
|
43
|
+
const stepMinutes = Math.floor(step / 60);
|
|
44
|
+
return /* @__PURE__ */ jsx("input", {
|
|
45
|
+
ref,
|
|
46
|
+
id,
|
|
47
|
+
type: "time",
|
|
48
|
+
value,
|
|
49
|
+
step,
|
|
50
|
+
disabled,
|
|
51
|
+
onChange: (event) => onValueChange(event.target.value),
|
|
52
|
+
onKeyDown: (event) => {
|
|
53
|
+
if (stepMinutes <= 1) return;
|
|
54
|
+
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
onValueChange(stepGridValue(value, step, event.key === "ArrowUp" ? 1 : -1));
|
|
57
|
+
},
|
|
58
|
+
onBlur: (event) => {
|
|
59
|
+
if (stepMinutes <= 1) return;
|
|
60
|
+
const snapped = snapToNearestStep(event.currentTarget.value, step);
|
|
61
|
+
if (snapped !== event.currentTarget.value) onValueChange(snapped);
|
|
62
|
+
},
|
|
63
|
+
"aria-label": ariaLabel,
|
|
64
|
+
className: cn("h-10 w-full rounded-xl bg-base-gray-soft px-3 text-base font-medium text-gray tabular-nums transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className)
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
TimePicker.displayName = "TimePicker";
|
|
68
|
+
function TimeRangePicker({ className, disabled, end, endLabel = "End", onEndChange, onStartChange, start, startLabel = "Start", step }) {
|
|
69
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
70
|
+
className: cn("grid grid-cols-2 gap-2", className),
|
|
71
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
72
|
+
className: "flex flex-col gap-1.5",
|
|
73
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
74
|
+
className: "text-xs font-medium text-gray-light",
|
|
75
|
+
children: startLabel
|
|
76
|
+
}), /* @__PURE__ */ jsx(TimePicker, {
|
|
77
|
+
value: start,
|
|
78
|
+
onValueChange: onStartChange,
|
|
79
|
+
disabled,
|
|
80
|
+
step,
|
|
81
|
+
"aria-label": startLabel
|
|
82
|
+
})]
|
|
83
|
+
}), /* @__PURE__ */ jsxs("label", {
|
|
84
|
+
className: "flex flex-col gap-1.5",
|
|
85
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
86
|
+
className: "text-xs font-medium text-gray-light",
|
|
87
|
+
children: endLabel
|
|
88
|
+
}), /* @__PURE__ */ jsx(TimePicker, {
|
|
89
|
+
value: end,
|
|
90
|
+
onValueChange: onEndChange,
|
|
91
|
+
disabled,
|
|
92
|
+
step,
|
|
93
|
+
"aria-label": endLabel
|
|
94
|
+
})]
|
|
95
|
+
})]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { TimePicker, TimeRangePicker };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=time-picker.js.map
|