@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,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/utils/chart-zoom.ts
|
|
3
|
+
const DEFAULT_MIN_ZOOM_RATIO = .05;
|
|
4
|
+
function spanOf(domain) {
|
|
5
|
+
return domain[1] - domain[0];
|
|
6
|
+
}
|
|
7
|
+
function minSpanFor(window, minRatio) {
|
|
8
|
+
return spanOf(window) * minRatio;
|
|
9
|
+
}
|
|
10
|
+
function normalizeDomain(a, b) {
|
|
11
|
+
return a <= b ? [a, b] : [b, a];
|
|
12
|
+
}
|
|
13
|
+
function clampWindowToFull(window, fullDomain) {
|
|
14
|
+
if (spanOf(fullDomain) <= 0) return fullDomain;
|
|
15
|
+
const start = Math.max(window[0], fullDomain[0]);
|
|
16
|
+
const end = Math.min(window[1], fullDomain[1]);
|
|
17
|
+
if (end <= start) return fullDomain;
|
|
18
|
+
return [start, end];
|
|
19
|
+
}
|
|
20
|
+
function placeWindowInFull(start, width, fullDomain) {
|
|
21
|
+
const fullSpan = spanOf(fullDomain);
|
|
22
|
+
if (fullSpan <= 0) return fullDomain;
|
|
23
|
+
const clampedWidth = Math.min(width, fullSpan);
|
|
24
|
+
let nextStart = start;
|
|
25
|
+
let nextEnd = nextStart + clampedWidth;
|
|
26
|
+
if (nextStart < fullDomain[0]) {
|
|
27
|
+
nextStart = fullDomain[0];
|
|
28
|
+
nextEnd = nextStart + clampedWidth;
|
|
29
|
+
}
|
|
30
|
+
if (nextEnd > fullDomain[1]) {
|
|
31
|
+
nextEnd = fullDomain[1];
|
|
32
|
+
nextStart = nextEnd - clampedWidth;
|
|
33
|
+
}
|
|
34
|
+
if (nextStart < fullDomain[0]) nextStart = fullDomain[0];
|
|
35
|
+
return [nextStart, nextEnd];
|
|
36
|
+
}
|
|
37
|
+
function isInertZoom(fullDomain, minRatio = DEFAULT_MIN_ZOOM_RATIO) {
|
|
38
|
+
const span = spanOf(fullDomain);
|
|
39
|
+
if (span <= 0) return true;
|
|
40
|
+
return minSpanFor(fullDomain, minRatio) >= span;
|
|
41
|
+
}
|
|
42
|
+
function resolveZoomWindow(fullDomain, zoomDomain) {
|
|
43
|
+
if (zoomDomain == null) return fullDomain;
|
|
44
|
+
return clampWindowToFull(normalizeDomain(zoomDomain[0], zoomDomain[1]), fullDomain);
|
|
45
|
+
}
|
|
46
|
+
function commitBrushZoom(fullDomain, currentWindow, brushStart, brushEnd, minRatio = DEFAULT_MIN_ZOOM_RATIO) {
|
|
47
|
+
if (isInertZoom(fullDomain, minRatio)) return null;
|
|
48
|
+
const current = resolveZoomWindow(fullDomain, currentWindow);
|
|
49
|
+
const brushed = clampWindowToFull(normalizeDomain(brushStart, brushEnd), current);
|
|
50
|
+
if (spanOf(brushed) < minSpanFor(fullDomain, minRatio)) return null;
|
|
51
|
+
const next = clampWindowToFull(brushed, fullDomain);
|
|
52
|
+
if (spanOf(next) < minSpanFor(fullDomain, minRatio)) return null;
|
|
53
|
+
return next;
|
|
54
|
+
}
|
|
55
|
+
function applyPinchZoom(fullDomain, currentWindow, scaleFactor, anchor, anchorFraction, minRatio = DEFAULT_MIN_ZOOM_RATIO) {
|
|
56
|
+
if (isInertZoom(fullDomain, minRatio) || scaleFactor <= 0) return resolveZoomWindow(fullDomain, currentWindow);
|
|
57
|
+
const current = resolveZoomWindow(fullDomain, currentWindow);
|
|
58
|
+
const currentSpan = spanOf(current);
|
|
59
|
+
if (currentSpan <= 0) return fullDomain;
|
|
60
|
+
const fullSpan = spanOf(fullDomain);
|
|
61
|
+
const minSpan = minSpanFor(fullDomain, minRatio);
|
|
62
|
+
const nextSpan = Math.min(fullSpan, Math.max(minSpan, currentSpan * scaleFactor));
|
|
63
|
+
const fraction = anchorFraction ?? (currentSpan === 0 ? .5 : (anchor - current[0]) / currentSpan);
|
|
64
|
+
return placeWindowInFull(anchor - nextSpan * Math.min(1, Math.max(0, fraction)), nextSpan, fullDomain);
|
|
65
|
+
}
|
|
66
|
+
function panZoomWindow(fullDomain, currentWindow, delta) {
|
|
67
|
+
const current = resolveZoomWindow(fullDomain, currentWindow);
|
|
68
|
+
return placeWindowInFull(current[0] + delta, spanOf(current), fullDomain);
|
|
69
|
+
}
|
|
70
|
+
function shouldInvalidateZoom(previousFullDomain, nextFullDomain) {
|
|
71
|
+
if (previousFullDomain == null) return false;
|
|
72
|
+
return previousFullDomain[0] !== nextFullDomain[0] || previousFullDomain[1] !== nextFullDomain[1];
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { DEFAULT_MIN_ZOOM_RATIO, applyPinchZoom, commitBrushZoom, isInertZoom, panZoomWindow, resolveZoomWindow, shouldInvalidateZoom };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=chart-zoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-zoom.js","names":[],"sources":["../../src/utils/chart-zoom.ts"],"sourcesContent":["export type TimeDomain = readonly [number, number]\n\nexport const DEFAULT_MIN_ZOOM_RATIO = 0.05\n\nfunction spanOf(domain: TimeDomain): number {\n return domain[1] - domain[0]\n}\n\nfunction minSpanFor(window: TimeDomain, minRatio: number): number {\n return spanOf(window) * minRatio\n}\n\nfunction normalizeDomain(a: number, b: number): TimeDomain {\n return a <= b ? [a, b] : [b, a]\n}\n\nfunction clampWindowToFull(\n window: TimeDomain,\n fullDomain: TimeDomain,\n): TimeDomain {\n const fullSpan = spanOf(fullDomain)\n if (fullSpan <= 0) return fullDomain\n\n const start = Math.max(window[0], fullDomain[0])\n const end = Math.min(window[1], fullDomain[1])\n if (end <= start) return fullDomain\n return [start, end]\n}\n\nfunction placeWindowInFull(\n start: number,\n width: number,\n fullDomain: TimeDomain,\n): TimeDomain {\n const fullSpan = spanOf(fullDomain)\n if (fullSpan <= 0) return fullDomain\n const clampedWidth = Math.min(width, fullSpan)\n let nextStart = start\n let nextEnd = nextStart + clampedWidth\n if (nextStart < fullDomain[0]) {\n nextStart = fullDomain[0]\n nextEnd = nextStart + clampedWidth\n }\n if (nextEnd > fullDomain[1]) {\n nextEnd = fullDomain[1]\n nextStart = nextEnd - clampedWidth\n }\n if (nextStart < fullDomain[0]) nextStart = fullDomain[0]\n return [nextStart, nextEnd]\n}\n\nexport function isInertZoom(\n fullDomain: TimeDomain,\n minRatio = DEFAULT_MIN_ZOOM_RATIO,\n): boolean {\n const span = spanOf(fullDomain)\n if (span <= 0) return true\n return minSpanFor(fullDomain, minRatio) >= span\n}\n\nexport function resolveZoomWindow(\n fullDomain: TimeDomain,\n zoomDomain: TimeDomain | null | undefined,\n): TimeDomain {\n if (zoomDomain == null) return fullDomain\n return clampWindowToFull(\n normalizeDomain(zoomDomain[0], zoomDomain[1]),\n fullDomain,\n )\n}\n\nexport function commitBrushZoom(\n fullDomain: TimeDomain,\n currentWindow: TimeDomain,\n brushStart: number,\n brushEnd: number,\n minRatio = DEFAULT_MIN_ZOOM_RATIO,\n): TimeDomain | null {\n if (isInertZoom(fullDomain, minRatio)) return null\n\n const current = resolveZoomWindow(fullDomain, currentWindow)\n const brushed = clampWindowToFull(\n normalizeDomain(brushStart, brushEnd),\n current,\n )\n const brushedSpan = spanOf(brushed)\n if (brushedSpan < minSpanFor(fullDomain, minRatio)) return null\n\n const next = clampWindowToFull(brushed, fullDomain)\n if (spanOf(next) < minSpanFor(fullDomain, minRatio)) return null\n return next\n}\n\nexport function applyPinchZoom(\n fullDomain: TimeDomain,\n currentWindow: TimeDomain,\n scaleFactor: number,\n anchor: number,\n anchorFraction?: number,\n minRatio = DEFAULT_MIN_ZOOM_RATIO,\n): TimeDomain {\n if (isInertZoom(fullDomain, minRatio) || scaleFactor <= 0) {\n return resolveZoomWindow(fullDomain, currentWindow)\n }\n\n const current = resolveZoomWindow(fullDomain, currentWindow)\n const currentSpan = spanOf(current)\n if (currentSpan <= 0) return fullDomain\n\n const fullSpan = spanOf(fullDomain)\n const minSpan = minSpanFor(fullDomain, minRatio)\n const nextSpan = Math.min(\n fullSpan,\n Math.max(minSpan, currentSpan * scaleFactor),\n )\n\n const fraction =\n anchorFraction ??\n (currentSpan === 0 ? 0.5 : (anchor - current[0]) / currentSpan)\n const clampedFraction = Math.min(1, Math.max(0, fraction))\n const start = anchor - nextSpan * clampedFraction\n return placeWindowInFull(start, nextSpan, fullDomain)\n}\n\nexport function panZoomWindow(\n fullDomain: TimeDomain,\n currentWindow: TimeDomain,\n delta: number,\n): TimeDomain {\n const current = resolveZoomWindow(fullDomain, currentWindow)\n return placeWindowInFull(current[0] + delta, spanOf(current), fullDomain)\n}\n\nexport function shouldInvalidateZoom(\n previousFullDomain: TimeDomain | null,\n nextFullDomain: TimeDomain,\n): boolean {\n if (previousFullDomain == null) return false\n return (\n previousFullDomain[0] !== nextFullDomain[0] ||\n previousFullDomain[1] !== nextFullDomain[1]\n )\n}\n"],"mappings":";;AAEA,MAAa,yBAAyB;AAEtC,SAAS,OAAO,QAA4B;CAC1C,OAAO,OAAO,KAAK,OAAO;AAC5B;AAEA,SAAS,WAAW,QAAoB,UAA0B;CAChE,OAAO,OAAO,MAAM,IAAI;AAC1B;AAEA,SAAS,gBAAgB,GAAW,GAAuB;CACzD,OAAO,KAAK,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;AAChC;AAEA,SAAS,kBACP,QACA,YACY;CAEZ,IADiB,OAAO,UACb,KAAK,GAAG,OAAO;CAE1B,MAAM,QAAQ,KAAK,IAAI,OAAO,IAAI,WAAW,EAAE;CAC/C,MAAM,MAAM,KAAK,IAAI,OAAO,IAAI,WAAW,EAAE;CAC7C,IAAI,OAAO,OAAO,OAAO;CACzB,OAAO,CAAC,OAAO,GAAG;AACpB;AAEA,SAAS,kBACP,OACA,OACA,YACY;CACZ,MAAM,WAAW,OAAO,UAAU;CAClC,IAAI,YAAY,GAAG,OAAO;CAC1B,MAAM,eAAe,KAAK,IAAI,OAAO,QAAQ;CAC7C,IAAI,YAAY;CAChB,IAAI,UAAU,YAAY;CAC1B,IAAI,YAAY,WAAW,IAAI;EAC7B,YAAY,WAAW;EACvB,UAAU,YAAY;CACxB;CACA,IAAI,UAAU,WAAW,IAAI;EAC3B,UAAU,WAAW;EACrB,YAAY,UAAU;CACxB;CACA,IAAI,YAAY,WAAW,IAAI,YAAY,WAAW;CACtD,OAAO,CAAC,WAAW,OAAO;AAC5B;AAEA,SAAgB,YACd,YACA,WAAW,wBACF;CACT,MAAM,OAAO,OAAO,UAAU;CAC9B,IAAI,QAAQ,GAAG,OAAO;CACtB,OAAO,WAAW,YAAY,QAAQ,KAAK;AAC7C;AAEA,SAAgB,kBACd,YACA,YACY;CACZ,IAAI,cAAc,MAAM,OAAO;CAC/B,OAAO,kBACL,gBAAgB,WAAW,IAAI,WAAW,EAAE,GAC5C,UACF;AACF;AAEA,SAAgB,gBACd,YACA,eACA,YACA,UACA,WAAW,wBACQ;CACnB,IAAI,YAAY,YAAY,QAAQ,GAAG,OAAO;CAE9C,MAAM,UAAU,kBAAkB,YAAY,aAAa;CAC3D,MAAM,UAAU,kBACd,gBAAgB,YAAY,QAAQ,GACpC,OACF;CAEA,IADoB,OAAO,OACb,IAAI,WAAW,YAAY,QAAQ,GAAG,OAAO;CAE3D,MAAM,OAAO,kBAAkB,SAAS,UAAU;CAClD,IAAI,OAAO,IAAI,IAAI,WAAW,YAAY,QAAQ,GAAG,OAAO;CAC5D,OAAO;AACT;AAEA,SAAgB,eACd,YACA,eACA,aACA,QACA,gBACA,WAAW,wBACC;CACZ,IAAI,YAAY,YAAY,QAAQ,KAAK,eAAe,GACtD,OAAO,kBAAkB,YAAY,aAAa;CAGpD,MAAM,UAAU,kBAAkB,YAAY,aAAa;CAC3D,MAAM,cAAc,OAAO,OAAO;CAClC,IAAI,eAAe,GAAG,OAAO;CAE7B,MAAM,WAAW,OAAO,UAAU;CAClC,MAAM,UAAU,WAAW,YAAY,QAAQ;CAC/C,MAAM,WAAW,KAAK,IACpB,UACA,KAAK,IAAI,SAAS,cAAc,WAAW,CAC7C;CAEA,MAAM,WACJ,mBACC,gBAAgB,IAAI,MAAO,SAAS,QAAQ,MAAM;CAGrD,OAAO,kBADO,SAAS,WADC,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,QAAQ,CACR,GAChB,UAAU,UAAU;AACtD;AAEA,SAAgB,cACd,YACA,eACA,OACY;CACZ,MAAM,UAAU,kBAAkB,YAAY,aAAa;CAC3D,OAAO,kBAAkB,QAAQ,KAAK,OAAO,OAAO,OAAO,GAAG,UAAU;AAC1E;AAEA,SAAgB,qBACd,oBACA,gBACS;CACT,IAAI,sBAAsB,MAAM,OAAO;CACvC,OACE,mBAAmB,OAAO,eAAe,MACzC,mBAAmB,OAAO,eAAe;AAE7C"}
|
package/dist/utils/cn.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
//#region src/utils/date-mask.ts
|
|
4
|
+
function maskDateInput(value, { separator = ".", deleting = false } = {}) {
|
|
5
|
+
const digits = value.replace(/\D/g, "").slice(0, 8);
|
|
6
|
+
let out = digits.slice(0, 2);
|
|
7
|
+
if (digits.length > 2) out += separator + digits.slice(2, 4);
|
|
8
|
+
if (digits.length > 4) out += separator + digits.slice(4, 8);
|
|
9
|
+
const groupComplete = digits.length === 2 || digits.length === 4;
|
|
10
|
+
const keepTrailing = deleting ? /[./-]$/.test(value) : true;
|
|
11
|
+
if (groupComplete && keepTrailing) out += separator;
|
|
12
|
+
return out;
|
|
13
|
+
}
|
|
14
|
+
function parseTypedDate(value) {
|
|
15
|
+
const parts = value.trim().split(/[./-]/).map(Number);
|
|
16
|
+
if (parts.length !== 3 || parts.some(Number.isNaN)) return void 0;
|
|
17
|
+
const [day, month, year] = parts;
|
|
18
|
+
const parsed = new Date(year, month - 1, day);
|
|
19
|
+
return parsed.getFullYear() === year && parsed.getMonth() === month - 1 && parsed.getDate() === day ? parsed : void 0;
|
|
20
|
+
}
|
|
21
|
+
function maskedDateCaret(masked, digitsBefore) {
|
|
22
|
+
let digits = 0;
|
|
23
|
+
let index = 0;
|
|
24
|
+
while (index < masked.length && digits < digitsBefore) {
|
|
25
|
+
if (/\d/.test(masked[index])) digits++;
|
|
26
|
+
index++;
|
|
27
|
+
}
|
|
28
|
+
while (index < masked.length && /\D/.test(masked[index])) index++;
|
|
29
|
+
return index;
|
|
30
|
+
}
|
|
31
|
+
function formatTypedDate(date, separator = ".") {
|
|
32
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
33
|
+
return [
|
|
34
|
+
pad(date.getDate()),
|
|
35
|
+
pad(date.getMonth() + 1),
|
|
36
|
+
date.getFullYear()
|
|
37
|
+
].join(separator);
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.formatTypedDate = formatTypedDate;
|
|
41
|
+
exports.maskDateInput = maskDateInput;
|
|
42
|
+
exports.maskedDateCaret = maskedDateCaret;
|
|
43
|
+
exports.parseTypedDate = parseTypedDate;
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=date-mask.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-mask.cjs","names":[],"sources":["../../src/utils/date-mask.ts"],"sourcesContent":["// Helpers for a typeable date field: mask keystrokes into DD.MM.YYYY, parse the\n// masked value into a Date, and format a picked Date back into the masked value.\n\n// While typing, a completed group (2 or 4 digits) gets a trailing separator so\n// the next group flows. While deleting, the trailing separator is kept only if\n// the raw value still ends with one — so backspace lands on `DD.MM.` first, then\n// removes the separator on the next press, one character at a time.\nexport function maskDateInput(\n value: string,\n { separator = '.', deleting = false }: MaskOptions = {},\n): string {\n const digits = value.replace(/\\D/g, '').slice(0, 8)\n let out = digits.slice(0, 2)\n if (digits.length > 2) out += separator + digits.slice(2, 4)\n if (digits.length > 4) out += separator + digits.slice(4, 8)\n const groupComplete = digits.length === 2 || digits.length === 4\n const keepTrailing = deleting ? /[./-]$/.test(value) : true\n if (groupComplete && keepTrailing) out += separator\n return out\n}\n\n// Accepts any of `.` `/` `-` as separators; rejects impossible dates (32.01.2020).\nexport function parseTypedDate(value: string): Date | undefined {\n const parts = value.trim().split(/[./-]/).map(Number)\n if (parts.length !== 3 || parts.some(Number.isNaN)) return undefined\n const [day, month, year] = parts as [number, number, number]\n const parsed = new Date(year, month - 1, day)\n const valid =\n parsed.getFullYear() === year &&\n parsed.getMonth() === month - 1 &&\n parsed.getDate() === day\n return valid ? parsed : undefined\n}\n\n// Caret position after TYPING: after the typed digit, flowing past a\n// separator into the next group. (For deletions, keep the raw caret instead —\n// the mask's separator positions are fixed, so it maps directly and backspace\n// can cross separators without looping.)\nexport function maskedDateCaret(masked: string, digitsBefore: number): number {\n let digits = 0\n let index = 0\n while (index < masked.length && digits < digitsBefore) {\n if (/\\d/.test(masked[index]!)) digits++\n index++\n }\n while (index < masked.length && /\\D/.test(masked[index]!)) index++\n return index\n}\n\nexport function formatTypedDate(date: Date, separator = '.'): string {\n const pad = (n: number) => String(n).padStart(2, '0')\n return [\n pad(date.getDate()),\n pad(date.getMonth() + 1),\n date.getFullYear(),\n ].join(separator)\n}\n\ninterface MaskOptions {\n separator?: string\n deleting?: boolean\n}\n"],"mappings":";;;AAOA,SAAgB,cACd,OACA,EAAE,YAAY,KAAK,WAAW,UAAuB,CAAC,GAC9C;CACR,MAAM,SAAS,MAAM,QAAQ,OAAO,EAAE,EAAE,MAAM,GAAG,CAAC;CAClD,IAAI,MAAM,OAAO,MAAM,GAAG,CAAC;CAC3B,IAAI,OAAO,SAAS,GAAG,OAAO,YAAY,OAAO,MAAM,GAAG,CAAC;CAC3D,IAAI,OAAO,SAAS,GAAG,OAAO,YAAY,OAAO,MAAM,GAAG,CAAC;CAC3D,MAAM,gBAAgB,OAAO,WAAW,KAAK,OAAO,WAAW;CAC/D,MAAM,eAAe,WAAW,SAAS,KAAK,KAAK,IAAI;CACvD,IAAI,iBAAiB,cAAc,OAAO;CAC1C,OAAO;AACT;AAGA,SAAgB,eAAe,OAAiC;CAC9D,MAAM,QAAQ,MAAM,KAAK,EAAE,MAAM,OAAO,EAAE,IAAI,MAAM;CACpD,IAAI,MAAM,WAAW,KAAK,MAAM,KAAK,OAAO,KAAK,GAAG,OAAO,KAAA;CAC3D,MAAM,CAAC,KAAK,OAAO,QAAQ;CAC3B,MAAM,SAAS,IAAI,KAAK,MAAM,QAAQ,GAAG,GAAG;CAK5C,OAHE,OAAO,YAAY,MAAM,QACzB,OAAO,SAAS,MAAM,QAAQ,KAC9B,OAAO,QAAQ,MAAM,MACR,SAAS,KAAA;AAC1B;AAMA,SAAgB,gBAAgB,QAAgB,cAA8B;CAC5E,IAAI,SAAS;CACb,IAAI,QAAQ;CACZ,OAAO,QAAQ,OAAO,UAAU,SAAS,cAAc;EACrD,IAAI,KAAK,KAAK,OAAO,MAAO,GAAG;EAC/B;CACF;CACA,OAAO,QAAQ,OAAO,UAAU,KAAK,KAAK,OAAO,MAAO,GAAG;CAC3D,OAAO;AACT;AAEA,SAAgB,gBAAgB,MAAY,YAAY,KAAa;CACnE,MAAM,OAAO,MAAc,OAAO,CAAC,EAAE,SAAS,GAAG,GAAG;CACpD,OAAO;EACL,IAAI,KAAK,QAAQ,CAAC;EAClB,IAAI,KAAK,SAAS,IAAI,CAAC;EACvB,KAAK,YAAY;CACnB,EAAE,KAAK,SAAS;AAClB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/date-mask.d.ts
|
|
4
|
+
declare function maskDateInput(value: string, {
|
|
5
|
+
separator,
|
|
6
|
+
deleting
|
|
7
|
+
}?: MaskOptions): string;
|
|
8
|
+
declare function parseTypedDate(value: string): Date | undefined;
|
|
9
|
+
declare function maskedDateCaret(masked: string, digitsBefore: number): number;
|
|
10
|
+
declare function formatTypedDate(date: Date, separator?: string): string;
|
|
11
|
+
interface MaskOptions {
|
|
12
|
+
separator?: string;
|
|
13
|
+
deleting?: boolean;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { formatTypedDate, maskDateInput, maskedDateCaret, parseTypedDate };
|
|
17
|
+
//# sourceMappingURL=date-mask.d.cts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/date-mask.d.ts
|
|
4
|
+
declare function maskDateInput(value: string, {
|
|
5
|
+
separator,
|
|
6
|
+
deleting
|
|
7
|
+
}?: MaskOptions): string;
|
|
8
|
+
declare function parseTypedDate(value: string): Date | undefined;
|
|
9
|
+
declare function maskedDateCaret(masked: string, digitsBefore: number): number;
|
|
10
|
+
declare function formatTypedDate(date: Date, separator?: string): string;
|
|
11
|
+
interface MaskOptions {
|
|
12
|
+
separator?: string;
|
|
13
|
+
deleting?: boolean;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { formatTypedDate, maskDateInput, maskedDateCaret, parseTypedDate };
|
|
17
|
+
//# sourceMappingURL=date-mask.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/utils/date-mask.ts
|
|
3
|
+
function maskDateInput(value, { separator = ".", deleting = false } = {}) {
|
|
4
|
+
const digits = value.replace(/\D/g, "").slice(0, 8);
|
|
5
|
+
let out = digits.slice(0, 2);
|
|
6
|
+
if (digits.length > 2) out += separator + digits.slice(2, 4);
|
|
7
|
+
if (digits.length > 4) out += separator + digits.slice(4, 8);
|
|
8
|
+
const groupComplete = digits.length === 2 || digits.length === 4;
|
|
9
|
+
const keepTrailing = deleting ? /[./-]$/.test(value) : true;
|
|
10
|
+
if (groupComplete && keepTrailing) out += separator;
|
|
11
|
+
return out;
|
|
12
|
+
}
|
|
13
|
+
function parseTypedDate(value) {
|
|
14
|
+
const parts = value.trim().split(/[./-]/).map(Number);
|
|
15
|
+
if (parts.length !== 3 || parts.some(Number.isNaN)) return void 0;
|
|
16
|
+
const [day, month, year] = parts;
|
|
17
|
+
const parsed = new Date(year, month - 1, day);
|
|
18
|
+
return parsed.getFullYear() === year && parsed.getMonth() === month - 1 && parsed.getDate() === day ? parsed : void 0;
|
|
19
|
+
}
|
|
20
|
+
function maskedDateCaret(masked, digitsBefore) {
|
|
21
|
+
let digits = 0;
|
|
22
|
+
let index = 0;
|
|
23
|
+
while (index < masked.length && digits < digitsBefore) {
|
|
24
|
+
if (/\d/.test(masked[index])) digits++;
|
|
25
|
+
index++;
|
|
26
|
+
}
|
|
27
|
+
while (index < masked.length && /\D/.test(masked[index])) index++;
|
|
28
|
+
return index;
|
|
29
|
+
}
|
|
30
|
+
function formatTypedDate(date, separator = ".") {
|
|
31
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
32
|
+
return [
|
|
33
|
+
pad(date.getDate()),
|
|
34
|
+
pad(date.getMonth() + 1),
|
|
35
|
+
date.getFullYear()
|
|
36
|
+
].join(separator);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { formatTypedDate, maskDateInput, maskedDateCaret, parseTypedDate };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=date-mask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-mask.js","names":[],"sources":["../../src/utils/date-mask.ts"],"sourcesContent":["// Helpers for a typeable date field: mask keystrokes into DD.MM.YYYY, parse the\n// masked value into a Date, and format a picked Date back into the masked value.\n\n// While typing, a completed group (2 or 4 digits) gets a trailing separator so\n// the next group flows. While deleting, the trailing separator is kept only if\n// the raw value still ends with one — so backspace lands on `DD.MM.` first, then\n// removes the separator on the next press, one character at a time.\nexport function maskDateInput(\n value: string,\n { separator = '.', deleting = false }: MaskOptions = {},\n): string {\n const digits = value.replace(/\\D/g, '').slice(0, 8)\n let out = digits.slice(0, 2)\n if (digits.length > 2) out += separator + digits.slice(2, 4)\n if (digits.length > 4) out += separator + digits.slice(4, 8)\n const groupComplete = digits.length === 2 || digits.length === 4\n const keepTrailing = deleting ? /[./-]$/.test(value) : true\n if (groupComplete && keepTrailing) out += separator\n return out\n}\n\n// Accepts any of `.` `/` `-` as separators; rejects impossible dates (32.01.2020).\nexport function parseTypedDate(value: string): Date | undefined {\n const parts = value.trim().split(/[./-]/).map(Number)\n if (parts.length !== 3 || parts.some(Number.isNaN)) return undefined\n const [day, month, year] = parts as [number, number, number]\n const parsed = new Date(year, month - 1, day)\n const valid =\n parsed.getFullYear() === year &&\n parsed.getMonth() === month - 1 &&\n parsed.getDate() === day\n return valid ? parsed : undefined\n}\n\n// Caret position after TYPING: after the typed digit, flowing past a\n// separator into the next group. (For deletions, keep the raw caret instead —\n// the mask's separator positions are fixed, so it maps directly and backspace\n// can cross separators without looping.)\nexport function maskedDateCaret(masked: string, digitsBefore: number): number {\n let digits = 0\n let index = 0\n while (index < masked.length && digits < digitsBefore) {\n if (/\\d/.test(masked[index]!)) digits++\n index++\n }\n while (index < masked.length && /\\D/.test(masked[index]!)) index++\n return index\n}\n\nexport function formatTypedDate(date: Date, separator = '.'): string {\n const pad = (n: number) => String(n).padStart(2, '0')\n return [\n pad(date.getDate()),\n pad(date.getMonth() + 1),\n date.getFullYear(),\n ].join(separator)\n}\n\ninterface MaskOptions {\n separator?: string\n deleting?: boolean\n}\n"],"mappings":";;AAOA,SAAgB,cACd,OACA,EAAE,YAAY,KAAK,WAAW,UAAuB,CAAC,GAC9C;CACR,MAAM,SAAS,MAAM,QAAQ,OAAO,EAAE,EAAE,MAAM,GAAG,CAAC;CAClD,IAAI,MAAM,OAAO,MAAM,GAAG,CAAC;CAC3B,IAAI,OAAO,SAAS,GAAG,OAAO,YAAY,OAAO,MAAM,GAAG,CAAC;CAC3D,IAAI,OAAO,SAAS,GAAG,OAAO,YAAY,OAAO,MAAM,GAAG,CAAC;CAC3D,MAAM,gBAAgB,OAAO,WAAW,KAAK,OAAO,WAAW;CAC/D,MAAM,eAAe,WAAW,SAAS,KAAK,KAAK,IAAI;CACvD,IAAI,iBAAiB,cAAc,OAAO;CAC1C,OAAO;AACT;AAGA,SAAgB,eAAe,OAAiC;CAC9D,MAAM,QAAQ,MAAM,KAAK,EAAE,MAAM,OAAO,EAAE,IAAI,MAAM;CACpD,IAAI,MAAM,WAAW,KAAK,MAAM,KAAK,OAAO,KAAK,GAAG,OAAO,KAAA;CAC3D,MAAM,CAAC,KAAK,OAAO,QAAQ;CAC3B,MAAM,SAAS,IAAI,KAAK,MAAM,QAAQ,GAAG,GAAG;CAK5C,OAHE,OAAO,YAAY,MAAM,QACzB,OAAO,SAAS,MAAM,QAAQ,KAC9B,OAAO,QAAQ,MAAM,MACR,SAAS,KAAA;AAC1B;AAMA,SAAgB,gBAAgB,QAAgB,cAA8B;CAC5E,IAAI,SAAS;CACb,IAAI,QAAQ;CACZ,OAAO,QAAQ,OAAO,UAAU,SAAS,cAAc;EACrD,IAAI,KAAK,KAAK,OAAO,MAAO,GAAG;EAC/B;CACF;CACA,OAAO,QAAQ,OAAO,UAAU,KAAK,KAAK,OAAO,MAAO,GAAG;CAC3D,OAAO;AACT;AAEA,SAAgB,gBAAgB,MAAY,YAAY,KAAa;CACnE,MAAM,OAAO,MAAc,OAAO,CAAC,EAAE,SAAS,GAAG,GAAG;CACpD,OAAO;EACL,IAAI,KAAK,QAAQ,CAAC;EAClB,IAAI,KAAK,SAAS,IAAI,CAAC;EACvB,KAAK,YAAY;CACnB,EAAE,KAAK,SAAS;AAClB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("./chars.cjs");
|
|
4
|
+
//#region src/utils/format.ts
|
|
5
|
+
function getDocumentLang() {
|
|
6
|
+
return typeof document === "undefined" ? void 0 : document.documentElement.lang || void 0;
|
|
7
|
+
}
|
|
8
|
+
const localeNumberFormat = (options) => {
|
|
9
|
+
const cache = /* @__PURE__ */ new Map();
|
|
10
|
+
return { format: (value) => {
|
|
11
|
+
const locale = getDocumentLang();
|
|
12
|
+
const key = locale ?? "";
|
|
13
|
+
let formatter = cache.get(key);
|
|
14
|
+
if (!formatter) {
|
|
15
|
+
formatter = new Intl.NumberFormat(locale, options);
|
|
16
|
+
cache.set(key, formatter);
|
|
17
|
+
}
|
|
18
|
+
return formatter.format(value);
|
|
19
|
+
} };
|
|
20
|
+
};
|
|
21
|
+
const decimalsFormat = (decimals) => localeNumberFormat({ maximumFractionDigits: decimals });
|
|
22
|
+
const integerFormat = decimalsFormat(0);
|
|
23
|
+
const oneDecimalFormat = decimalsFormat(1);
|
|
24
|
+
const twoDecimalFormat = decimalsFormat(2);
|
|
25
|
+
const formatThousands = (n) => integerFormat.format(n);
|
|
26
|
+
const formatEnergy = (v) => {
|
|
27
|
+
if (v >= 1e6) return `${twoDecimalFormat.format(v / 1e3)} MWh`;
|
|
28
|
+
if (v >= 1e3) return `${integerFormat.format(v)} kWh`;
|
|
29
|
+
if (v >= 10) return `${oneDecimalFormat.format(v)} kWh`;
|
|
30
|
+
return `${twoDecimalFormat.format(v)} kWh`;
|
|
31
|
+
};
|
|
32
|
+
const formatPower = (value, { signed = false } = {}) => {
|
|
33
|
+
if (value == null) return "—";
|
|
34
|
+
const rounded = Math.round(value);
|
|
35
|
+
return `${signed && rounded > 0 ? "+" : ""}${integerFormat.format(rounded)} W`;
|
|
36
|
+
};
|
|
37
|
+
const formatPercent = (value) => {
|
|
38
|
+
if (value == null) return "—";
|
|
39
|
+
return `${integerFormat.format(value)} %`;
|
|
40
|
+
};
|
|
41
|
+
const formatRatio = (value) => {
|
|
42
|
+
if (value == null) return "—";
|
|
43
|
+
return `${integerFormat.format(value * 100)} %`;
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.decimalsFormat = decimalsFormat;
|
|
47
|
+
exports.formatEnergy = formatEnergy;
|
|
48
|
+
exports.formatPercent = formatPercent;
|
|
49
|
+
exports.formatPower = formatPower;
|
|
50
|
+
exports.formatRatio = formatRatio;
|
|
51
|
+
exports.formatThousands = formatThousands;
|
|
52
|
+
exports.integerFormat = integerFormat;
|
|
53
|
+
exports.localeNumberFormat = localeNumberFormat;
|
|
54
|
+
exports.oneDecimalFormat = oneDecimalFormat;
|
|
55
|
+
exports.twoDecimalFormat = twoDecimalFormat;
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=format.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.cjs","names":[],"sources":["../../src/utils/format.ts"],"sourcesContent":["import { EM_DASH, NARROW_NBSP } from './chars'\n\ninterface LocaleNumberFormat {\n format: (value: number) => string\n}\n\nfunction getDocumentLang(): string | undefined {\n return typeof document === 'undefined'\n ? undefined\n : document.documentElement.lang || undefined\n}\n\nconst localeNumberFormat = (\n options?: Intl.NumberFormatOptions,\n): LocaleNumberFormat => {\n const cache = new Map<string, Intl.NumberFormat>()\n return {\n format: (value) => {\n const locale = getDocumentLang()\n const key = locale ?? ''\n let formatter = cache.get(key)\n if (!formatter) {\n formatter = new Intl.NumberFormat(locale, options)\n cache.set(key, formatter)\n }\n return formatter.format(value)\n },\n }\n}\n\nconst decimalsFormat = (decimals: number) =>\n localeNumberFormat({ maximumFractionDigits: decimals })\n\nconst integerFormat = decimalsFormat(0)\nconst oneDecimalFormat = decimalsFormat(1)\nconst twoDecimalFormat = decimalsFormat(2)\n\nconst formatThousands = (n: number) => integerFormat.format(n)\n\nconst formatEnergy = (v: number) => {\n if (v >= 1_000_000) {\n return `${twoDecimalFormat.format(v / 1000)}${NARROW_NBSP}MWh`\n }\n if (v >= 1_000) return `${integerFormat.format(v)}${NARROW_NBSP}kWh`\n if (v >= 10) return `${oneDecimalFormat.format(v)}${NARROW_NBSP}kWh`\n return `${twoDecimalFormat.format(v)}${NARROW_NBSP}kWh`\n}\n\nconst formatPower = (\n value: number | null,\n { signed = false }: { signed?: boolean } = {},\n): string => {\n if (value == null) return EM_DASH\n const rounded = Math.round(value)\n const sign = signed && rounded > 0 ? '+' : ''\n return `${sign}${integerFormat.format(rounded)}${NARROW_NBSP}W`\n}\n\nconst formatPercent = (value: number | null): string => {\n if (value == null) return EM_DASH\n return `${integerFormat.format(value)}${NARROW_NBSP}%`\n}\n\nconst formatRatio = (value: number | null): string => {\n if (value == null) return EM_DASH\n return `${integerFormat.format(value * 100)}${NARROW_NBSP}%`\n}\n\nexport {\n formatThousands,\n formatEnergy,\n formatPower,\n formatPercent,\n formatRatio,\n localeNumberFormat,\n decimalsFormat,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n}\n"],"mappings":";;;;AAMA,SAAS,kBAAsC;CAC7C,OAAO,OAAO,aAAa,cACvB,KAAA,IACA,SAAS,gBAAgB,QAAQ,KAAA;AACvC;AAEA,MAAM,sBACJ,YACuB;CACvB,MAAM,wBAAQ,IAAI,IAA+B;CACjD,OAAO,EACL,SAAS,UAAU;EACjB,MAAM,SAAS,gBAAgB;EAC/B,MAAM,MAAM,UAAU;EACtB,IAAI,YAAY,MAAM,IAAI,GAAG;EAC7B,IAAI,CAAC,WAAW;GACd,YAAY,IAAI,KAAK,aAAa,QAAQ,OAAO;GACjD,MAAM,IAAI,KAAK,SAAS;EAC1B;EACA,OAAO,UAAU,OAAO,KAAK;CAC/B,EACF;AACF;AAEA,MAAM,kBAAkB,aACtB,mBAAmB,EAAE,uBAAuB,SAAS,CAAC;AAExD,MAAM,gBAAgB,eAAe,CAAC;AACtC,MAAM,mBAAmB,eAAe,CAAC;AACzC,MAAM,mBAAmB,eAAe,CAAC;AAEzC,MAAM,mBAAmB,MAAc,cAAc,OAAO,CAAC;AAE7D,MAAM,gBAAgB,MAAc;CAClC,IAAI,KAAK,KACP,OAAO,GAAG,iBAAiB,OAAO,IAAI,GAAI;CAE5C,IAAI,KAAK,KAAO,OAAO,GAAG,cAAc,OAAO,CAAC;CAChD,IAAI,KAAK,IAAI,OAAO,GAAG,iBAAiB,OAAO,CAAC;CAChD,OAAO,GAAG,iBAAiB,OAAO,CAAC;AACrC;AAEA,MAAM,eACJ,OACA,EAAE,SAAS,UAAgC,CAAC,MACjC;CACX,IAAI,SAAS,MAAM,OAAA;CACnB,MAAM,UAAU,KAAK,MAAM,KAAK;CAEhC,OAAO,GADM,UAAU,UAAU,IAAI,MAAM,KAC1B,cAAc,OAAO,OAAO;AAC/C;AAEA,MAAM,iBAAiB,UAAiC;CACtD,IAAI,SAAS,MAAM,OAAA;CACnB,OAAO,GAAG,cAAc,OAAO,KAAK;AACtC;AAEA,MAAM,eAAe,UAAiC;CACpD,IAAI,SAAS,MAAM,OAAA;CACnB,OAAO,GAAG,cAAc,OAAO,QAAQ,GAAG;AAC5C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/format.d.ts
|
|
4
|
+
interface LocaleNumberFormat {
|
|
5
|
+
format: (value: number) => string;
|
|
6
|
+
}
|
|
7
|
+
declare const localeNumberFormat: (options?: Intl.NumberFormatOptions) => LocaleNumberFormat;
|
|
8
|
+
declare const decimalsFormat: (decimals: number) => LocaleNumberFormat;
|
|
9
|
+
declare const integerFormat: LocaleNumberFormat;
|
|
10
|
+
declare const oneDecimalFormat: LocaleNumberFormat;
|
|
11
|
+
declare const twoDecimalFormat: LocaleNumberFormat;
|
|
12
|
+
declare const formatThousands: (n: number) => string;
|
|
13
|
+
declare const formatEnergy: (v: number) => string;
|
|
14
|
+
declare const formatPower: (value: number | null, {
|
|
15
|
+
signed
|
|
16
|
+
}?: {
|
|
17
|
+
signed?: boolean;
|
|
18
|
+
}) => string;
|
|
19
|
+
declare const formatPercent: (value: number | null) => string;
|
|
20
|
+
declare const formatRatio: (value: number | null) => string;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { decimalsFormat, formatEnergy, formatPercent, formatPower, formatRatio, formatThousands, integerFormat, localeNumberFormat, oneDecimalFormat, twoDecimalFormat };
|
|
23
|
+
//# sourceMappingURL=format.d.cts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/format.d.ts
|
|
4
|
+
interface LocaleNumberFormat {
|
|
5
|
+
format: (value: number) => string;
|
|
6
|
+
}
|
|
7
|
+
declare const localeNumberFormat: (options?: Intl.NumberFormatOptions) => LocaleNumberFormat;
|
|
8
|
+
declare const decimalsFormat: (decimals: number) => LocaleNumberFormat;
|
|
9
|
+
declare const integerFormat: LocaleNumberFormat;
|
|
10
|
+
declare const oneDecimalFormat: LocaleNumberFormat;
|
|
11
|
+
declare const twoDecimalFormat: LocaleNumberFormat;
|
|
12
|
+
declare const formatThousands: (n: number) => string;
|
|
13
|
+
declare const formatEnergy: (v: number) => string;
|
|
14
|
+
declare const formatPower: (value: number | null, {
|
|
15
|
+
signed
|
|
16
|
+
}?: {
|
|
17
|
+
signed?: boolean;
|
|
18
|
+
}) => string;
|
|
19
|
+
declare const formatPercent: (value: number | null) => string;
|
|
20
|
+
declare const formatRatio: (value: number | null) => string;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { decimalsFormat, formatEnergy, formatPercent, formatPower, formatRatio, formatThousands, integerFormat, localeNumberFormat, oneDecimalFormat, twoDecimalFormat };
|
|
23
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "./chars.js";
|
|
3
|
+
//#region src/utils/format.ts
|
|
4
|
+
function getDocumentLang() {
|
|
5
|
+
return typeof document === "undefined" ? void 0 : document.documentElement.lang || void 0;
|
|
6
|
+
}
|
|
7
|
+
const localeNumberFormat = (options) => {
|
|
8
|
+
const cache = /* @__PURE__ */ new Map();
|
|
9
|
+
return { format: (value) => {
|
|
10
|
+
const locale = getDocumentLang();
|
|
11
|
+
const key = locale ?? "";
|
|
12
|
+
let formatter = cache.get(key);
|
|
13
|
+
if (!formatter) {
|
|
14
|
+
formatter = new Intl.NumberFormat(locale, options);
|
|
15
|
+
cache.set(key, formatter);
|
|
16
|
+
}
|
|
17
|
+
return formatter.format(value);
|
|
18
|
+
} };
|
|
19
|
+
};
|
|
20
|
+
const decimalsFormat = (decimals) => localeNumberFormat({ maximumFractionDigits: decimals });
|
|
21
|
+
const integerFormat = decimalsFormat(0);
|
|
22
|
+
const oneDecimalFormat = decimalsFormat(1);
|
|
23
|
+
const twoDecimalFormat = decimalsFormat(2);
|
|
24
|
+
const formatThousands = (n) => integerFormat.format(n);
|
|
25
|
+
const formatEnergy = (v) => {
|
|
26
|
+
if (v >= 1e6) return `${twoDecimalFormat.format(v / 1e3)} MWh`;
|
|
27
|
+
if (v >= 1e3) return `${integerFormat.format(v)} kWh`;
|
|
28
|
+
if (v >= 10) return `${oneDecimalFormat.format(v)} kWh`;
|
|
29
|
+
return `${twoDecimalFormat.format(v)} kWh`;
|
|
30
|
+
};
|
|
31
|
+
const formatPower = (value, { signed = false } = {}) => {
|
|
32
|
+
if (value == null) return "—";
|
|
33
|
+
const rounded = Math.round(value);
|
|
34
|
+
return `${signed && rounded > 0 ? "+" : ""}${integerFormat.format(rounded)} W`;
|
|
35
|
+
};
|
|
36
|
+
const formatPercent = (value) => {
|
|
37
|
+
if (value == null) return "—";
|
|
38
|
+
return `${integerFormat.format(value)} %`;
|
|
39
|
+
};
|
|
40
|
+
const formatRatio = (value) => {
|
|
41
|
+
if (value == null) return "—";
|
|
42
|
+
return `${integerFormat.format(value * 100)} %`;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { decimalsFormat, formatEnergy, formatPercent, formatPower, formatRatio, formatThousands, integerFormat, localeNumberFormat, oneDecimalFormat, twoDecimalFormat };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","names":[],"sources":["../../src/utils/format.ts"],"sourcesContent":["import { EM_DASH, NARROW_NBSP } from './chars'\n\ninterface LocaleNumberFormat {\n format: (value: number) => string\n}\n\nfunction getDocumentLang(): string | undefined {\n return typeof document === 'undefined'\n ? undefined\n : document.documentElement.lang || undefined\n}\n\nconst localeNumberFormat = (\n options?: Intl.NumberFormatOptions,\n): LocaleNumberFormat => {\n const cache = new Map<string, Intl.NumberFormat>()\n return {\n format: (value) => {\n const locale = getDocumentLang()\n const key = locale ?? ''\n let formatter = cache.get(key)\n if (!formatter) {\n formatter = new Intl.NumberFormat(locale, options)\n cache.set(key, formatter)\n }\n return formatter.format(value)\n },\n }\n}\n\nconst decimalsFormat = (decimals: number) =>\n localeNumberFormat({ maximumFractionDigits: decimals })\n\nconst integerFormat = decimalsFormat(0)\nconst oneDecimalFormat = decimalsFormat(1)\nconst twoDecimalFormat = decimalsFormat(2)\n\nconst formatThousands = (n: number) => integerFormat.format(n)\n\nconst formatEnergy = (v: number) => {\n if (v >= 1_000_000) {\n return `${twoDecimalFormat.format(v / 1000)}${NARROW_NBSP}MWh`\n }\n if (v >= 1_000) return `${integerFormat.format(v)}${NARROW_NBSP}kWh`\n if (v >= 10) return `${oneDecimalFormat.format(v)}${NARROW_NBSP}kWh`\n return `${twoDecimalFormat.format(v)}${NARROW_NBSP}kWh`\n}\n\nconst formatPower = (\n value: number | null,\n { signed = false }: { signed?: boolean } = {},\n): string => {\n if (value == null) return EM_DASH\n const rounded = Math.round(value)\n const sign = signed && rounded > 0 ? '+' : ''\n return `${sign}${integerFormat.format(rounded)}${NARROW_NBSP}W`\n}\n\nconst formatPercent = (value: number | null): string => {\n if (value == null) return EM_DASH\n return `${integerFormat.format(value)}${NARROW_NBSP}%`\n}\n\nconst formatRatio = (value: number | null): string => {\n if (value == null) return EM_DASH\n return `${integerFormat.format(value * 100)}${NARROW_NBSP}%`\n}\n\nexport {\n formatThousands,\n formatEnergy,\n formatPower,\n formatPercent,\n formatRatio,\n localeNumberFormat,\n decimalsFormat,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n}\n"],"mappings":";;;AAMA,SAAS,kBAAsC;CAC7C,OAAO,OAAO,aAAa,cACvB,KAAA,IACA,SAAS,gBAAgB,QAAQ,KAAA;AACvC;AAEA,MAAM,sBACJ,YACuB;CACvB,MAAM,wBAAQ,IAAI,IAA+B;CACjD,OAAO,EACL,SAAS,UAAU;EACjB,MAAM,SAAS,gBAAgB;EAC/B,MAAM,MAAM,UAAU;EACtB,IAAI,YAAY,MAAM,IAAI,GAAG;EAC7B,IAAI,CAAC,WAAW;GACd,YAAY,IAAI,KAAK,aAAa,QAAQ,OAAO;GACjD,MAAM,IAAI,KAAK,SAAS;EAC1B;EACA,OAAO,UAAU,OAAO,KAAK;CAC/B,EACF;AACF;AAEA,MAAM,kBAAkB,aACtB,mBAAmB,EAAE,uBAAuB,SAAS,CAAC;AAExD,MAAM,gBAAgB,eAAe,CAAC;AACtC,MAAM,mBAAmB,eAAe,CAAC;AACzC,MAAM,mBAAmB,eAAe,CAAC;AAEzC,MAAM,mBAAmB,MAAc,cAAc,OAAO,CAAC;AAE7D,MAAM,gBAAgB,MAAc;CAClC,IAAI,KAAK,KACP,OAAO,GAAG,iBAAiB,OAAO,IAAI,GAAI;CAE5C,IAAI,KAAK,KAAO,OAAO,GAAG,cAAc,OAAO,CAAC;CAChD,IAAI,KAAK,IAAI,OAAO,GAAG,iBAAiB,OAAO,CAAC;CAChD,OAAO,GAAG,iBAAiB,OAAO,CAAC;AACrC;AAEA,MAAM,eACJ,OACA,EAAE,SAAS,UAAgC,CAAC,MACjC;CACX,IAAI,SAAS,MAAM,OAAA;CACnB,MAAM,UAAU,KAAK,MAAM,KAAK;CAEhC,OAAO,GADM,UAAU,UAAU,IAAI,MAAM,KAC1B,cAAc,OAAO,OAAO;AAC/C;AAEA,MAAM,iBAAiB,UAAiC;CACtD,IAAI,SAAS,MAAM,OAAA;CACnB,OAAO,GAAG,cAAc,OAAO,KAAK;AACtC;AAEA,MAAM,eAAe,UAAiC;CACpD,IAAI,SAAS,MAAM,OAAA;CACnB,OAAO,GAAG,cAAc,OAAO,QAAQ,GAAG;AAC5C"}
|
package/package.json
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@epilot/spark-ui",
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "React UI component library from Spark SDK",
|
|
5
|
+
"homepage": "https://spark-ui.epilot.io/docs/ui",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "epilot",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://gitlab.com/e-pilot/product/customer-portal/spark.git",
|
|
11
|
+
"directory": "packages/ui"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"NOTICE",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"**/*.css"
|
|
22
|
+
],
|
|
23
|
+
"exports": {
|
|
24
|
+
"./styles": "./dist/styles/index.css",
|
|
25
|
+
"./spark-default": "./dist/styles/spark-default.css",
|
|
26
|
+
"./utils/*": {
|
|
27
|
+
"types": "./dist/utils/*.d.ts",
|
|
28
|
+
"default": "./dist/utils/*.js"
|
|
29
|
+
},
|
|
30
|
+
"./hooks/*": {
|
|
31
|
+
"types": "./dist/hooks/*.d.ts",
|
|
32
|
+
"default": "./dist/hooks/*.js"
|
|
33
|
+
},
|
|
34
|
+
"./icons": {
|
|
35
|
+
"types": "./dist/icons/index.d.ts",
|
|
36
|
+
"default": "./dist/icons/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./icons/*": {
|
|
39
|
+
"types": "./dist/icons/*.d.ts",
|
|
40
|
+
"default": "./dist/icons/*.js"
|
|
41
|
+
},
|
|
42
|
+
"./lib/*": {
|
|
43
|
+
"types": "./dist/lib/*.d.ts",
|
|
44
|
+
"default": "./dist/lib/*.js"
|
|
45
|
+
},
|
|
46
|
+
"./*": {
|
|
47
|
+
"types": "./dist/components/*.d.ts",
|
|
48
|
+
"default": "./dist/components/*.js"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@base-ui/react": "^1.6.0",
|
|
56
|
+
"@daypicker/react": "^10.0.1",
|
|
57
|
+
"@dnd-kit/core": "^6.3.1",
|
|
58
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
59
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
60
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
61
|
+
"@number-flow/react": "^0.6.0",
|
|
62
|
+
"@radix-ui/colors": "^3.0.0",
|
|
63
|
+
"@shadcn/react": "^0.2.1",
|
|
64
|
+
"@visx/curve": "^4.0.0-alpha.11",
|
|
65
|
+
"@visx/event": "^4.0.0-alpha.11",
|
|
66
|
+
"@visx/group": "^4.0.0-alpha.11",
|
|
67
|
+
"@visx/sankey": "^4.0.0-alpha.11",
|
|
68
|
+
"@visx/scale": "^4.0.0-alpha.11",
|
|
69
|
+
"@visx/shape": "^4.0.0-alpha.11",
|
|
70
|
+
"@visx/tooltip": "^4.0.0-alpha.11",
|
|
71
|
+
"@visx/vendor": "^4.0.0-alpha.11",
|
|
72
|
+
"bezier-easing": "^2.1.0",
|
|
73
|
+
"class-variance-authority": "^0.7.1",
|
|
74
|
+
"cnfast": "^0.0.8",
|
|
75
|
+
"colorjs.io": "^0.5.2",
|
|
76
|
+
"vaul": "^1.1.2"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@tailwindcss/postcss": "^4.2.4",
|
|
80
|
+
"@testing-library/dom": "^10.4.0",
|
|
81
|
+
"@testing-library/react": "^16.3.0",
|
|
82
|
+
"@types/react": "^19.2.14",
|
|
83
|
+
"@types/react-dom": "^19.2.3",
|
|
84
|
+
"jsdom": "^29.1.1",
|
|
85
|
+
"postcss": "^8.5.23",
|
|
86
|
+
"react": "^19.2.5",
|
|
87
|
+
"react-dom": "^19.2.5",
|
|
88
|
+
"tailwindcss": "^4.2.4",
|
|
89
|
+
"tw-animate-css": "^1.4.0",
|
|
90
|
+
"typescript": "^6.0.2",
|
|
91
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
92
|
+
"vite-plus": "^0.1.24",
|
|
93
|
+
"vitest": "npm:@voidzero-dev/vite-plus-test@latest",
|
|
94
|
+
"vitest-axe": "^0.1.0"
|
|
95
|
+
},
|
|
96
|
+
"peerDependencies": {
|
|
97
|
+
"react": ">=18.0.0",
|
|
98
|
+
"react-dom": ">=18.0.0",
|
|
99
|
+
"tailwindcss": ">=4.1.0",
|
|
100
|
+
"tw-animate-css": ">=1.4.0"
|
|
101
|
+
},
|
|
102
|
+
"scripts": {
|
|
103
|
+
"build": "vp pack",
|
|
104
|
+
"clean": "rm -rf dist",
|
|
105
|
+
"dev": "vp pack --watch",
|
|
106
|
+
"test": "vp test run",
|
|
107
|
+
"typecheck": "tsc --noEmit"
|
|
108
|
+
}
|
|
109
|
+
}
|