@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,584 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_hooks_use_reduced_motion = require("../hooks/use-reduced-motion.cjs");
|
|
4
|
+
const require_utils_format = require("../utils/format.cjs");
|
|
5
|
+
const require_utils_chart_scale = require("../utils/chart-scale.cjs");
|
|
6
|
+
const require_components_chart = require("./chart.cjs");
|
|
7
|
+
const require_components_series_legend = require("./series-legend.cjs");
|
|
8
|
+
const require_components_typography = require("./typography.cjs");
|
|
9
|
+
let react = require("react");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let _visx_event = require("@visx/event");
|
|
12
|
+
let _visx_group = require("@visx/group");
|
|
13
|
+
let _visx_scale = require("@visx/scale");
|
|
14
|
+
let _visx_shape = require("@visx/shape");
|
|
15
|
+
let cnfast = require("cnfast");
|
|
16
|
+
//#region src/components/bar-chart.tsx
|
|
17
|
+
const defaultTotalFormat = require_utils_format.localeNumberFormat();
|
|
18
|
+
const PADDING_TOP = 20;
|
|
19
|
+
const PADDING_BOTTOM = 28;
|
|
20
|
+
const HOVER_FADE_MS = 200;
|
|
21
|
+
const FOCUS_TRANSITION_MS = 180;
|
|
22
|
+
const DEFAULT_HEIGHT = 220;
|
|
23
|
+
const BAR_RADIUS = 2;
|
|
24
|
+
function buildBarPath(x, y, width, height, radius, roundTop, roundBottom) {
|
|
25
|
+
const r = Math.max(0, Math.min(radius, width / 2, height / 2));
|
|
26
|
+
if (r === 0 || !roundTop && !roundBottom) return `M ${x} ${y} H ${x + width} V ${y + height} H ${x} Z`;
|
|
27
|
+
const tl = roundTop ? r : 0;
|
|
28
|
+
const tr = roundTop ? r : 0;
|
|
29
|
+
const br = roundBottom ? r : 0;
|
|
30
|
+
const bl = roundBottom ? r : 0;
|
|
31
|
+
return [
|
|
32
|
+
`M ${x + tl} ${y}`,
|
|
33
|
+
`H ${x + width - tr}`,
|
|
34
|
+
tr > 0 ? `Q ${x + width} ${y} ${x + width} ${y + tr}` : `L ${x + width} ${y}`,
|
|
35
|
+
`V ${y + height - br}`,
|
|
36
|
+
br > 0 ? `Q ${x + width} ${y + height} ${x + width - br} ${y + height}` : `L ${x + width} ${y + height}`,
|
|
37
|
+
`H ${x + bl}`,
|
|
38
|
+
bl > 0 ? `Q ${x} ${y + height} ${x} ${y + height - bl}` : `L ${x} ${y + height}`,
|
|
39
|
+
`V ${y + tl}`,
|
|
40
|
+
tl > 0 ? `Q ${x} ${y} ${x + tl} ${y}` : `L ${x} ${y}`,
|
|
41
|
+
"Z"
|
|
42
|
+
].join(" ");
|
|
43
|
+
}
|
|
44
|
+
function BarStackLayer({ stackData, series, seriesByKey, xScale, yScale, colorScale }) {
|
|
45
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_shape.BarStack, {
|
|
46
|
+
data: stackData,
|
|
47
|
+
keys: series.map((entry) => entry.key),
|
|
48
|
+
x: (record) => record.__category,
|
|
49
|
+
value: (record, key) => record.__values[key] ?? 0,
|
|
50
|
+
xScale,
|
|
51
|
+
yScale,
|
|
52
|
+
color: colorScale,
|
|
53
|
+
offset: "diverging",
|
|
54
|
+
children: (barStacks) => barStacks.map((barStack) => barStack.bars.map((bar) => {
|
|
55
|
+
const values = bar.bar.data.__values;
|
|
56
|
+
const segmentValue = values[barStack.key] ?? 0;
|
|
57
|
+
if (segmentValue === 0) return null;
|
|
58
|
+
const strokeColor = seriesByKey.get(barStack.key)?.color ?? bar.color;
|
|
59
|
+
const fillColor = strokeColor;
|
|
60
|
+
const positiveKeys = series.map((entry) => entry.key).filter((key) => (values[key] ?? 0) > 0);
|
|
61
|
+
const negativeKeys = series.map((entry) => entry.key).filter((key) => (values[key] ?? 0) < 0);
|
|
62
|
+
const roundTop = segmentValue > 0 && positiveKeys[positiveKeys.length - 1] === barStack.key;
|
|
63
|
+
const roundBottom = segmentValue > 0 ? positiveKeys[0] === barStack.key : negativeKeys[negativeKeys.length - 1] === barStack.key;
|
|
64
|
+
const top = bar.height < 0 ? bar.y + bar.height : bar.y;
|
|
65
|
+
const barHeight = Math.abs(bar.height);
|
|
66
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
67
|
+
d: buildBarPath(bar.x, top, bar.width, Math.max(0, barHeight), BAR_RADIUS, roundTop, roundBottom),
|
|
68
|
+
fill: fillColor,
|
|
69
|
+
stroke: strokeColor,
|
|
70
|
+
strokeWidth: 1,
|
|
71
|
+
style: { transition: "fill 180ms ease" }
|
|
72
|
+
}, `bar-${barStack.index}-${bar.index}`);
|
|
73
|
+
}))
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function FocusBorder({ category, visible, stackData, series, xScale, yScale }) {
|
|
77
|
+
const reducedMotion = require_hooks_use_reduced_motion.useReducedMotion();
|
|
78
|
+
const x = xScale(category);
|
|
79
|
+
const datum = stackData.find((entry) => entry.__category === category);
|
|
80
|
+
if (x === void 0 || !datum) return null;
|
|
81
|
+
if (!series.some((entry) => (datum.__values[entry.key] ?? 0) !== 0)) return null;
|
|
82
|
+
const topY = PADDING_TOP;
|
|
83
|
+
const bottomY = yScale(series.reduce((sum, entry) => sum + Math.min(0, datum.__values[entry.key] ?? 0), 0));
|
|
84
|
+
const borderPaddingX = 4;
|
|
85
|
+
const borderPaddingY = 3;
|
|
86
|
+
const borderXRaw = x - borderPaddingX;
|
|
87
|
+
const borderY = topY - borderPaddingY;
|
|
88
|
+
const borderWidthRaw = xScale.bandwidth() + borderPaddingX * 2;
|
|
89
|
+
const [rangeStart, rangeEnd] = xScale.range();
|
|
90
|
+
const minX = Math.min(rangeStart, rangeEnd);
|
|
91
|
+
const maxX = Math.max(rangeStart, rangeEnd);
|
|
92
|
+
const borderX = Math.max(minX, borderXRaw);
|
|
93
|
+
const borderRight = Math.min(maxX, borderXRaw + borderWidthRaw);
|
|
94
|
+
const borderWidth = Math.max(0, borderRight - borderX);
|
|
95
|
+
const borderHeight = Math.max(1, bottomY - topY + borderPaddingY * 2);
|
|
96
|
+
if (borderWidth <= 0) return null;
|
|
97
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
98
|
+
x: borderX,
|
|
99
|
+
y: borderY,
|
|
100
|
+
width: borderWidth,
|
|
101
|
+
height: borderHeight,
|
|
102
|
+
rx: 6,
|
|
103
|
+
fill: "var(--spark-a2)",
|
|
104
|
+
stroke: "var(--spark-a9)",
|
|
105
|
+
strokeWidth: 2,
|
|
106
|
+
pointerEvents: "none",
|
|
107
|
+
style: {
|
|
108
|
+
opacity: visible ? 1 : 0,
|
|
109
|
+
transition: reducedMotion ? `opacity ${FOCUS_TRANSITION_MS}ms ease` : `x ${FOCUS_TRANSITION_MS}ms ease, y ${FOCUS_TRANSITION_MS}ms ease, width ${FOCUS_TRANSITION_MS}ms ease, height ${FOCUS_TRANSITION_MS}ms ease, opacity ${FOCUS_TRANSITION_MS}ms ease`
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function InteractionLayer({ xDomain, activeCategories, xScale, height, onHoverChange }) {
|
|
114
|
+
const bandwidth = xScale.bandwidth();
|
|
115
|
+
const [rangeStart, rangeEnd] = xScale.range();
|
|
116
|
+
const minX = Math.min(rangeStart, rangeEnd);
|
|
117
|
+
const maxX = Math.max(rangeStart, rangeEnd);
|
|
118
|
+
const handleMove = (event) => {
|
|
119
|
+
const point = (0, _visx_event.localPoint)(event);
|
|
120
|
+
if (!point) return;
|
|
121
|
+
let nearest = null;
|
|
122
|
+
let best = Infinity;
|
|
123
|
+
for (const category of xDomain) {
|
|
124
|
+
if (!activeCategories.has(category)) continue;
|
|
125
|
+
const x = xScale(category);
|
|
126
|
+
if (x === void 0) continue;
|
|
127
|
+
const distance = Math.abs(x + bandwidth / 2 - point.x);
|
|
128
|
+
if (distance < best) {
|
|
129
|
+
best = distance;
|
|
130
|
+
nearest = category;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (nearest !== null) onHoverChange(nearest);
|
|
134
|
+
};
|
|
135
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
136
|
+
x: minX,
|
|
137
|
+
y: PADDING_TOP,
|
|
138
|
+
width: Math.max(0, maxX - minX),
|
|
139
|
+
height: height - PADDING_TOP - PADDING_BOTTOM,
|
|
140
|
+
fill: "transparent",
|
|
141
|
+
onMouseMove: handleMove,
|
|
142
|
+
onMouseLeave: () => onHoverChange(null),
|
|
143
|
+
onTouchMove: handleMove,
|
|
144
|
+
onTouchEnd: () => onHoverChange(null)
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function CategoryTicks({ ticks, xScale, height, formatCategory }) {
|
|
148
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: ticks.map((category) => {
|
|
149
|
+
const x = xScale(category);
|
|
150
|
+
if (x === void 0) return null;
|
|
151
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
|
|
152
|
+
x: x + xScale.bandwidth() / 2,
|
|
153
|
+
y: height - PADDING_BOTTOM + 16,
|
|
154
|
+
textAnchor: "middle",
|
|
155
|
+
fill: "var(--neutral-a11)",
|
|
156
|
+
fontSize: 10,
|
|
157
|
+
children: formatCategory(category)
|
|
158
|
+
}, `tick-${String(category)}`);
|
|
159
|
+
}) });
|
|
160
|
+
}
|
|
161
|
+
function defaultFormatTotal(value) {
|
|
162
|
+
return defaultTotalFormat.format(value);
|
|
163
|
+
}
|
|
164
|
+
function BarChart({ data, series, lines, getCategory, categories, categoryTicks, formatCategory = (category) => String(category), formatTooltipCategory = formatCategory, highlightedCategory, showHighlightLine = false, referenceLine, title, yAxisUnit, formatYTick = require_utils_chart_scale.formatYAxisTick, yAxisWidth, yAxisRightUnit, formatYTickRight = require_utils_chart_scale.formatYAxisTick, yAxisRightWidth, height = DEFAULT_HEIGHT, renderTotal, formatTotal = defaultFormatTotal, formatValue, className }) {
|
|
165
|
+
const containerRef = (0, react.useRef)(null);
|
|
166
|
+
const reducedMotion = require_hooks_use_reduced_motion.useReducedMotion();
|
|
167
|
+
const [width, setWidth] = (0, react.useState)(0);
|
|
168
|
+
const [hoveredCategory, setHoveredCategory] = (0, react.useState)(null);
|
|
169
|
+
const [trailingHoverLabel, setTrailingHoverLabel] = (0, react.useState)(null);
|
|
170
|
+
const [hiddenSeries, setHiddenSeries] = (0, react.useState)(() => new Set((lines ?? []).filter((line) => line.hiddenByDefault).map((line) => line.key)));
|
|
171
|
+
const toggleSeries = (0, react.useCallback)((id) => {
|
|
172
|
+
setHiddenSeries((prev) => {
|
|
173
|
+
const next = new Set(prev);
|
|
174
|
+
if (next.has(id)) next.delete(id);
|
|
175
|
+
else next.add(id);
|
|
176
|
+
return next;
|
|
177
|
+
});
|
|
178
|
+
}, []);
|
|
179
|
+
(0, react.useEffect)(() => {
|
|
180
|
+
const element = containerRef.current;
|
|
181
|
+
if (!element) return;
|
|
182
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
183
|
+
const entry = entries[0];
|
|
184
|
+
if (!entry) return;
|
|
185
|
+
setWidth(entry.contentRect.width);
|
|
186
|
+
});
|
|
187
|
+
resizeObserver.observe(element);
|
|
188
|
+
return () => {
|
|
189
|
+
resizeObserver.disconnect();
|
|
190
|
+
};
|
|
191
|
+
}, []);
|
|
192
|
+
const seriesByKey = (0, react.useMemo)(() => {
|
|
193
|
+
const map = /* @__PURE__ */ new Map();
|
|
194
|
+
for (const entry of series) map.set(entry.key, entry);
|
|
195
|
+
return map;
|
|
196
|
+
}, [series]);
|
|
197
|
+
const stackData = (0, react.useMemo)(() => data.map((datum) => {
|
|
198
|
+
const values = {};
|
|
199
|
+
for (const entry of series) values[entry.key] = hiddenSeries.has(entry.key) ? 0 : entry.getValue(datum);
|
|
200
|
+
return {
|
|
201
|
+
__category: getCategory(datum),
|
|
202
|
+
__values: values
|
|
203
|
+
};
|
|
204
|
+
}), [
|
|
205
|
+
data,
|
|
206
|
+
getCategory,
|
|
207
|
+
series,
|
|
208
|
+
hiddenSeries
|
|
209
|
+
]);
|
|
210
|
+
const yMax = (0, react.useMemo)(() => Math.max(1, referenceLine?.value ?? 0, ...stackData.map((record) => series.reduce((sum, entry) => sum + Math.max(0, record.__values[entry.key] ?? 0), 0))), [
|
|
211
|
+
referenceLine,
|
|
212
|
+
series,
|
|
213
|
+
stackData
|
|
214
|
+
]);
|
|
215
|
+
const yMin = (0, react.useMemo)(() => Math.min(0, ...stackData.map((record) => series.reduce((sum, entry) => sum + Math.min(0, record.__values[entry.key] ?? 0), 0))), [series, stackData]);
|
|
216
|
+
const xDomain = (0, react.useMemo)(() => categories ?? stackData.map((record) => record.__category), [categories, stackData]);
|
|
217
|
+
const yTicks = (0, react.useMemo)(() => require_utils_chart_scale.buildYAxisScale(yMin, yMax).ticks, [yMin, yMax]);
|
|
218
|
+
const gutter = (0, react.useMemo)(() => yAxisWidth ?? require_utils_chart_scale.measureYAxisGutter(yTicks, formatYTick), [
|
|
219
|
+
yTicks,
|
|
220
|
+
formatYTick,
|
|
221
|
+
yAxisWidth
|
|
222
|
+
]);
|
|
223
|
+
const rightAxisDomain = (0, react.useMemo)(() => (lines ?? []).filter((line) => line.domain !== void 0 && !hiddenSeries.has(line.key)), [lines, hiddenSeries])[0]?.domain;
|
|
224
|
+
const rightAxisScale = (0, react.useMemo)(() => rightAxisDomain === void 0 ? null : require_utils_chart_scale.buildYAxisScale(rightAxisDomain[0], rightAxisDomain[1]), [rightAxisDomain]);
|
|
225
|
+
const rightTicks = rightAxisScale?.ticks ?? [];
|
|
226
|
+
const rightGutter = (0, react.useMemo)(() => rightAxisScale === null ? 0 : yAxisRightWidth ?? require_utils_chart_scale.measureYAxisGutter(rightTicks, formatYTickRight, 0), [
|
|
227
|
+
rightAxisScale,
|
|
228
|
+
rightTicks,
|
|
229
|
+
formatYTickRight,
|
|
230
|
+
yAxisRightWidth
|
|
231
|
+
]);
|
|
232
|
+
const plotRight = Math.max(gutter, width - rightGutter);
|
|
233
|
+
const xScale = (0, react.useMemo)(() => (0, _visx_scale.scaleBand)({
|
|
234
|
+
domain: xDomain,
|
|
235
|
+
range: [gutter, plotRight],
|
|
236
|
+
padding: .32
|
|
237
|
+
}), [
|
|
238
|
+
xDomain,
|
|
239
|
+
gutter,
|
|
240
|
+
plotRight
|
|
241
|
+
]);
|
|
242
|
+
const yScale = (0, react.useMemo)(() => (0, _visx_scale.scaleLinear)({
|
|
243
|
+
domain: [yMin, yMax],
|
|
244
|
+
range: [height - PADDING_BOTTOM, PADDING_TOP]
|
|
245
|
+
}), [
|
|
246
|
+
height,
|
|
247
|
+
yMax,
|
|
248
|
+
yMin
|
|
249
|
+
]);
|
|
250
|
+
const rightYScale = (0, react.useMemo)(() => rightAxisDomain === void 0 ? null : (0, _visx_scale.scaleLinear)({
|
|
251
|
+
domain: rightAxisDomain,
|
|
252
|
+
range: [height - PADDING_BOTTOM, PADDING_TOP]
|
|
253
|
+
}), [height, rightAxisDomain]);
|
|
254
|
+
const colorScale = (0, react.useMemo)(() => (0, _visx_scale.scaleOrdinal)({
|
|
255
|
+
domain: series.map((entry) => entry.key),
|
|
256
|
+
range: series.map((entry) => entry.color)
|
|
257
|
+
}), [series]);
|
|
258
|
+
const linePaths = (0, react.useMemo)(() => {
|
|
259
|
+
if (!lines || width === 0) return [];
|
|
260
|
+
return lines.filter((line) => !hiddenSeries.has(line.key)).map((line) => {
|
|
261
|
+
const lineScale = line.domain ? (0, _visx_scale.scaleLinear)({
|
|
262
|
+
domain: line.domain,
|
|
263
|
+
range: [height - PADDING_BOTTOM, PADDING_TOP]
|
|
264
|
+
}) : yScale;
|
|
265
|
+
const segments = [];
|
|
266
|
+
let previous = null;
|
|
267
|
+
for (const datum of data) {
|
|
268
|
+
const x = xScale(getCategory(datum));
|
|
269
|
+
const value = line.getValue(datum);
|
|
270
|
+
if (x === void 0 || value === null || !Number.isFinite(value)) {
|
|
271
|
+
previous = null;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
const point = {
|
|
275
|
+
x: x + xScale.bandwidth() / 2,
|
|
276
|
+
y: lineScale(value)
|
|
277
|
+
};
|
|
278
|
+
segments.push(previous === null ? `M ${point.x} ${point.y}` : `L ${point.x} ${point.y}`);
|
|
279
|
+
previous = point;
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
key: line.key,
|
|
283
|
+
d: segments.join(" "),
|
|
284
|
+
color: line.color,
|
|
285
|
+
strokeDasharray: line.strokeDasharray ?? "5 4"
|
|
286
|
+
};
|
|
287
|
+
}).filter((path) => path.d !== "");
|
|
288
|
+
}, [
|
|
289
|
+
lines,
|
|
290
|
+
hiddenSeries,
|
|
291
|
+
data,
|
|
292
|
+
getCategory,
|
|
293
|
+
xScale,
|
|
294
|
+
yScale,
|
|
295
|
+
height,
|
|
296
|
+
width
|
|
297
|
+
]);
|
|
298
|
+
const stackCategorySet = (0, react.useMemo)(() => new Set(stackData.map((record) => record.__category)), [stackData]);
|
|
299
|
+
const lastFocusCategoryRef = (0, react.useRef)(null);
|
|
300
|
+
if (hoveredCategory !== null) lastFocusCategoryRef.current = hoveredCategory;
|
|
301
|
+
const focusCategory = lastFocusCategoryRef.current;
|
|
302
|
+
const focused = (0, react.useMemo)(() => hoveredCategory === null ? null : stackData.find((record) => record.__category === hoveredCategory) ?? null, [hoveredCategory, stackData]);
|
|
303
|
+
const totalValue = (0, react.useMemo)(() => {
|
|
304
|
+
if (focused) return series.reduce((sum, entry) => sum + Math.max(0, focused.__values[entry.key] ?? 0), 0);
|
|
305
|
+
return stackData.reduce((sum, record) => sum + series.reduce((s, entry) => s + Math.max(0, record.__values[entry.key] ?? 0), 0), 0);
|
|
306
|
+
}, [
|
|
307
|
+
focused,
|
|
308
|
+
series,
|
|
309
|
+
stackData
|
|
310
|
+
]);
|
|
311
|
+
const hoverLabel = focused ? formatTooltipCategory(focused.__category) : null;
|
|
312
|
+
(0, react.useEffect)(() => {
|
|
313
|
+
if (hoverLabel) {
|
|
314
|
+
setTrailingHoverLabel(hoverLabel);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const timeoutId = window.setTimeout(() => {
|
|
318
|
+
setTrailingHoverLabel(null);
|
|
319
|
+
}, HOVER_FADE_MS);
|
|
320
|
+
return () => {
|
|
321
|
+
window.clearTimeout(timeoutId);
|
|
322
|
+
};
|
|
323
|
+
}, [hoverLabel]);
|
|
324
|
+
const ticks = categoryTicks ?? xDomain;
|
|
325
|
+
const highlightX = (0, react.useMemo)(() => {
|
|
326
|
+
if (!showHighlightLine || highlightedCategory === void 0) return null;
|
|
327
|
+
const x = xScale(highlightedCategory);
|
|
328
|
+
if (x === void 0) return null;
|
|
329
|
+
return x + xScale.bandwidth() / 2;
|
|
330
|
+
}, [
|
|
331
|
+
highlightedCategory,
|
|
332
|
+
showHighlightLine,
|
|
333
|
+
xScale
|
|
334
|
+
]);
|
|
335
|
+
const focusedDatum = (0, react.useMemo)(() => hoveredCategory === null ? null : data.find((datum) => getCategory(datum) === hoveredCategory) ?? null, [
|
|
336
|
+
hoveredCategory,
|
|
337
|
+
data,
|
|
338
|
+
getCategory
|
|
339
|
+
]);
|
|
340
|
+
const barStackLayer = (0, react.useMemo)(() => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BarStackLayer, {
|
|
341
|
+
stackData,
|
|
342
|
+
series,
|
|
343
|
+
seriesByKey,
|
|
344
|
+
xScale,
|
|
345
|
+
yScale,
|
|
346
|
+
colorScale
|
|
347
|
+
}), [
|
|
348
|
+
stackData,
|
|
349
|
+
series,
|
|
350
|
+
seriesByKey,
|
|
351
|
+
xScale,
|
|
352
|
+
yScale,
|
|
353
|
+
colorScale
|
|
354
|
+
]);
|
|
355
|
+
const fmtTooltipValue = formatValue ?? formatTotal;
|
|
356
|
+
const tooltipRows = focused ? [...series.filter((entry) => (focused.__values[entry.key] ?? 0) !== 0).map((entry) => ({
|
|
357
|
+
key: entry.key,
|
|
358
|
+
label: entry.label,
|
|
359
|
+
color: entry.color,
|
|
360
|
+
value: fmtTooltipValue(Math.abs(focused.__values[entry.key] ?? 0))
|
|
361
|
+
})), ...(lines ?? []).filter((line) => !hiddenSeries.has(line.key)).flatMap((line) => {
|
|
362
|
+
const value = focusedDatum === null ? null : line.getValue(focusedDatum);
|
|
363
|
+
if (value === null || !Number.isFinite(value)) return [];
|
|
364
|
+
return [{
|
|
365
|
+
key: line.key,
|
|
366
|
+
label: line.label,
|
|
367
|
+
color: line.color,
|
|
368
|
+
value: (line.formatValue ?? fmtTooltipValue)(value),
|
|
369
|
+
marker: "dashed-line"
|
|
370
|
+
}];
|
|
371
|
+
})] : [];
|
|
372
|
+
const tooltipActive = tooltipRows.length > 0;
|
|
373
|
+
const anchorX = focusCategory !== null ? (xScale(focusCategory) ?? 0) + xScale.bandwidth() / 2 : 0;
|
|
374
|
+
const anchorY = yScale(totalValue);
|
|
375
|
+
const [tooltipRef, tooltipSize] = require_components_chart.useMeasuredSize();
|
|
376
|
+
const tooltipPos = require_components_chart.clampTooltipPosition({
|
|
377
|
+
anchorX,
|
|
378
|
+
anchorY,
|
|
379
|
+
width,
|
|
380
|
+
height,
|
|
381
|
+
tipWidth: tooltipSize.width,
|
|
382
|
+
tipHeight: tooltipSize.height
|
|
383
|
+
});
|
|
384
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
385
|
+
"data-slot": "bar-chart",
|
|
386
|
+
className: (0, cnfast.cn)("flex w-full flex-col", className),
|
|
387
|
+
children: [
|
|
388
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
389
|
+
className: "flex items-baseline justify-between",
|
|
390
|
+
children: [title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_typography.SectionTitle, { children: title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
391
|
+
className: "tabular-nums",
|
|
392
|
+
children: renderTotal ? renderTotal(totalValue, focused === null) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
393
|
+
className: "text-base font-bold text-gray tabular-nums",
|
|
394
|
+
children: formatTotal(totalValue)
|
|
395
|
+
})
|
|
396
|
+
})]
|
|
397
|
+
}),
|
|
398
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
399
|
+
className: "flex min-h-5 items-baseline justify-between gap-4",
|
|
400
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_series_legend.SeriesLegend, {
|
|
401
|
+
items: [...series.map((entry) => ({
|
|
402
|
+
id: entry.key,
|
|
403
|
+
label: entry.label,
|
|
404
|
+
color: entry.color
|
|
405
|
+
})), ...(lines ?? []).map((line) => ({
|
|
406
|
+
id: line.key,
|
|
407
|
+
label: line.label,
|
|
408
|
+
color: line.color,
|
|
409
|
+
marker: "dashed-line"
|
|
410
|
+
}))],
|
|
411
|
+
hiddenIds: hiddenSeries,
|
|
412
|
+
onToggle: toggleSeries,
|
|
413
|
+
className: "gap-y-1"
|
|
414
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
415
|
+
className: (0, cnfast.cn)("text-xs text-gray-light transition-opacity duration-200", hoverLabel ? "opacity-100" : "opacity-0"),
|
|
416
|
+
children: trailingHoverLabel ?? " "
|
|
417
|
+
})]
|
|
418
|
+
}),
|
|
419
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
420
|
+
ref: containerRef,
|
|
421
|
+
className: "relative mt-2 w-full",
|
|
422
|
+
style: { height },
|
|
423
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
424
|
+
ref: tooltipRef,
|
|
425
|
+
className: "pointer-events-none absolute z-10",
|
|
426
|
+
style: {
|
|
427
|
+
left: tooltipPos.left,
|
|
428
|
+
top: tooltipPos.top,
|
|
429
|
+
opacity: tooltipActive ? 1 : 0,
|
|
430
|
+
transition: reducedMotion ? "opacity 140ms ease-out" : "left 140ms ease-out, top 140ms ease-out, opacity 140ms ease-out"
|
|
431
|
+
},
|
|
432
|
+
children: focusCategory !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_chart.ChartTooltipCard, {
|
|
433
|
+
label: formatTooltipCategory(focusCategory),
|
|
434
|
+
rows: tooltipRows
|
|
435
|
+
})
|
|
436
|
+
}), width > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
437
|
+
width,
|
|
438
|
+
height,
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
441
|
+
x1: gutter,
|
|
442
|
+
x2: gutter,
|
|
443
|
+
y1: PADDING_TOP,
|
|
444
|
+
y2: height - PADDING_BOTTOM,
|
|
445
|
+
stroke: "var(--neutral-a6)",
|
|
446
|
+
strokeWidth: 1
|
|
447
|
+
}),
|
|
448
|
+
yTicks.map((tick, index) => {
|
|
449
|
+
const y = yScale(tick);
|
|
450
|
+
const hideTickLabel = yAxisUnit !== void 0 && index === yTicks.length - 1;
|
|
451
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", { children: [!hideTickLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
452
|
+
x1: gutter - 4,
|
|
453
|
+
x2: gutter,
|
|
454
|
+
y1: y,
|
|
455
|
+
y2: y,
|
|
456
|
+
stroke: "var(--neutral-a8)",
|
|
457
|
+
strokeWidth: 1
|
|
458
|
+
}), !hideTickLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
|
|
459
|
+
x: gutter - 7,
|
|
460
|
+
y: y + 3,
|
|
461
|
+
textAnchor: "end",
|
|
462
|
+
fill: "var(--neutral-a11)",
|
|
463
|
+
fontSize: 10,
|
|
464
|
+
children: formatYTick(tick)
|
|
465
|
+
})] }, `y-tick-${tick}`);
|
|
466
|
+
}),
|
|
467
|
+
yAxisUnit && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
|
|
468
|
+
x: 0,
|
|
469
|
+
y: PADDING_TOP - 6,
|
|
470
|
+
textAnchor: "start",
|
|
471
|
+
fill: "var(--neutral-a11)",
|
|
472
|
+
fontSize: 10,
|
|
473
|
+
fontWeight: 600,
|
|
474
|
+
children: yAxisUnit
|
|
475
|
+
}),
|
|
476
|
+
highlightX !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
477
|
+
x1: highlightX,
|
|
478
|
+
x2: highlightX,
|
|
479
|
+
y1: PADDING_TOP,
|
|
480
|
+
y2: height - PADDING_BOTTOM,
|
|
481
|
+
stroke: "var(--spark-a9)",
|
|
482
|
+
strokeWidth: 1.5,
|
|
483
|
+
strokeDasharray: "5 4",
|
|
484
|
+
pointerEvents: "none"
|
|
485
|
+
}),
|
|
486
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
487
|
+
x1: gutter,
|
|
488
|
+
x2: plotRight,
|
|
489
|
+
y1: yScale(0),
|
|
490
|
+
y2: yScale(0),
|
|
491
|
+
stroke: "var(--neutral-a5)",
|
|
492
|
+
strokeWidth: 1
|
|
493
|
+
}),
|
|
494
|
+
rightYScale !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
495
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
496
|
+
x1: plotRight,
|
|
497
|
+
x2: plotRight,
|
|
498
|
+
y1: PADDING_TOP,
|
|
499
|
+
y2: height - PADDING_BOTTOM,
|
|
500
|
+
stroke: "var(--neutral-a6)",
|
|
501
|
+
strokeWidth: 1
|
|
502
|
+
}),
|
|
503
|
+
rightTicks.map((tick, index) => {
|
|
504
|
+
const y = rightYScale(tick);
|
|
505
|
+
const hideTickLabel = yAxisRightUnit !== void 0 && index === rightTicks.length - 1;
|
|
506
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", { children: [!hideTickLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
507
|
+
x1: plotRight,
|
|
508
|
+
x2: plotRight + 4,
|
|
509
|
+
y1: y,
|
|
510
|
+
y2: y,
|
|
511
|
+
stroke: "var(--neutral-a8)",
|
|
512
|
+
strokeWidth: 1
|
|
513
|
+
}), !hideTickLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
|
|
514
|
+
x: plotRight + 7,
|
|
515
|
+
y: y + 3,
|
|
516
|
+
textAnchor: "start",
|
|
517
|
+
fill: "var(--neutral-a11)",
|
|
518
|
+
fontSize: 10,
|
|
519
|
+
children: formatYTickRight(tick)
|
|
520
|
+
})] }, `y-tick-right-${tick}`);
|
|
521
|
+
}),
|
|
522
|
+
yAxisRightUnit && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
|
|
523
|
+
x: width,
|
|
524
|
+
y: PADDING_TOP - 6,
|
|
525
|
+
textAnchor: "end",
|
|
526
|
+
fill: "var(--neutral-a11)",
|
|
527
|
+
fontSize: 10,
|
|
528
|
+
fontWeight: 600,
|
|
529
|
+
children: yAxisRightUnit
|
|
530
|
+
})
|
|
531
|
+
] }),
|
|
532
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_visx_group.Group, { children: [
|
|
533
|
+
focusCategory !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FocusBorder, {
|
|
534
|
+
category: focusCategory,
|
|
535
|
+
visible: hoveredCategory !== null,
|
|
536
|
+
stackData,
|
|
537
|
+
series,
|
|
538
|
+
xScale,
|
|
539
|
+
yScale
|
|
540
|
+
}),
|
|
541
|
+
barStackLayer,
|
|
542
|
+
referenceLine && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
543
|
+
x1: gutter,
|
|
544
|
+
x2: width,
|
|
545
|
+
y1: yScale(referenceLine.value),
|
|
546
|
+
y2: yScale(referenceLine.value),
|
|
547
|
+
stroke: referenceLine.color ?? "var(--neutral-a11)",
|
|
548
|
+
strokeWidth: 1.5,
|
|
549
|
+
pointerEvents: "none"
|
|
550
|
+
}),
|
|
551
|
+
linePaths.map((path) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
552
|
+
d: path.d,
|
|
553
|
+
fill: "none",
|
|
554
|
+
stroke: path.color,
|
|
555
|
+
strokeWidth: 1.5,
|
|
556
|
+
strokeDasharray: path.strokeDasharray,
|
|
557
|
+
strokeLinecap: "round",
|
|
558
|
+
strokeLinejoin: "round",
|
|
559
|
+
pointerEvents: "none"
|
|
560
|
+
}, `line-${path.key}`))
|
|
561
|
+
] }),
|
|
562
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(InteractionLayer, {
|
|
563
|
+
xDomain,
|
|
564
|
+
activeCategories: stackCategorySet,
|
|
565
|
+
xScale,
|
|
566
|
+
height,
|
|
567
|
+
onHoverChange: setHoveredCategory
|
|
568
|
+
}),
|
|
569
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CategoryTicks, {
|
|
570
|
+
ticks,
|
|
571
|
+
xScale,
|
|
572
|
+
height,
|
|
573
|
+
formatCategory
|
|
574
|
+
})
|
|
575
|
+
]
|
|
576
|
+
})]
|
|
577
|
+
})
|
|
578
|
+
]
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
//#endregion
|
|
582
|
+
exports.BarChart = BarChart;
|
|
583
|
+
|
|
584
|
+
//# sourceMappingURL=bar-chart.cjs.map
|