@epilot/spark-ui 0.19.0 → 0.20.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/dist/components/accordion.cjs +2 -2
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/alert-dialog.cjs +1 -1
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/attachment.d.cts +2 -2
- package/dist/components/attachment.d.ts +2 -2
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/avatar.cjs +1 -1
- package/dist/components/avatar.cjs.map +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +1 -1
- package/dist/components/badge.cjs.map +1 -1
- package/dist/components/badge.d.cts +2 -1
- package/dist/components/badge.d.ts +2 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/{energy-bar-chart.cjs → bar-chart-with-total.cjs} +4 -4
- package/dist/components/bar-chart-with-total.cjs.map +1 -0
- package/dist/components/bar-chart-with-total.d.cts +19 -0
- package/dist/components/bar-chart-with-total.d.ts +19 -0
- package/dist/components/{energy-bar-chart.js → bar-chart-with-total.js} +4 -4
- package/dist/components/bar-chart-with-total.js.map +1 -0
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button-group.cjs +2 -2
- package/dist/components/button-group.cjs.map +1 -1
- package/dist/components/button-group.d.cts +1 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/button.cjs +6 -4
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +6 -5
- package/dist/components/button.d.ts +6 -5
- package/dist/components/button.js +6 -4
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.cjs +3 -3
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.js +3 -3
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/callout.cjs +11 -11
- package/dist/components/callout.cjs.map +1 -1
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/callout.js +11 -11
- package/dist/components/callout.js.map +1 -1
- package/dist/components/checkbox.cjs +1 -1
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/circular-gauge.cjs +7 -7
- package/dist/components/circular-gauge.cjs.map +1 -1
- package/dist/components/circular-gauge.js +7 -7
- package/dist/components/circular-gauge.js.map +1 -1
- package/dist/components/day-of-week-picker.cjs +21 -41
- package/dist/components/day-of-week-picker.cjs.map +1 -1
- package/dist/components/day-of-week-picker.d.cts +19 -23
- package/dist/components/day-of-week-picker.d.ts +19 -23
- package/dist/components/day-of-week-picker.js +21 -41
- package/dist/components/day-of-week-picker.js.map +1 -1
- package/dist/components/dialog.cjs +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/dropdown-menu.cjs +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/empty-state.d.ts +1 -1
- package/dist/components/{device-card.cjs → entity-card.cjs} +31 -31
- package/dist/components/entity-card.cjs.map +1 -0
- package/dist/components/{device-card.d.cts → entity-card.d.cts} +15 -15
- package/dist/components/{device-card.d.ts → entity-card.d.ts} +16 -16
- package/dist/components/{device-card.js → entity-card.js} +20 -20
- package/dist/components/entity-card.js.map +1 -0
- package/dist/components/{feed-in-hero.cjs → hero-metric.cjs} +10 -15
- package/dist/components/hero-metric.cjs.map +1 -0
- package/dist/components/hero-metric.d.cts +27 -0
- package/dist/components/hero-metric.d.ts +27 -0
- package/dist/components/{feed-in-hero.js → hero-metric.js} +7 -12
- package/dist/components/hero-metric.js.map +1 -0
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/input-date.cjs +1 -1
- package/dist/components/input-date.js +1 -1
- package/dist/components/input-otp.cjs +1 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/line-chart.cjs +1 -1
- package/dist/components/line-chart.js +1 -1
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/message-scroller.cjs +3 -3
- package/dist/components/message-scroller.js +3 -3
- package/dist/components/number-flow.d.cts +12 -2
- package/dist/components/number-flow.d.ts +12 -2
- package/dist/components/page-header.cjs +1 -1
- package/dist/components/page-header.js +1 -1
- package/dist/components/period-tabs.cjs +2 -22
- package/dist/components/period-tabs.cjs.map +1 -1
- package/dist/components/period-tabs.d.cts +5 -22
- package/dist/components/period-tabs.d.ts +5 -22
- package/dist/components/period-tabs.js +2 -22
- package/dist/components/period-tabs.js.map +1 -1
- package/dist/components/pill.cjs +3 -3
- package/dist/components/pill.cjs.map +1 -1
- package/dist/components/pill.js +3 -3
- package/dist/components/pill.js.map +1 -1
- package/dist/components/progress.cjs +1 -1
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio.cjs +1 -1
- package/dist/components/radio.cjs.map +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/radio.js.map +1 -1
- package/dist/components/sankey-chart.cjs +1 -11
- package/dist/components/sankey-chart.cjs.map +1 -1
- package/dist/components/sankey-chart.d.cts +2 -3
- package/dist/components/sankey-chart.d.ts +2 -3
- package/dist/components/sankey-chart.js +2 -11
- package/dist/components/sankey-chart.js.map +1 -1
- package/dist/components/schedule-list.cjs +1 -1
- package/dist/components/schedule-list.js +1 -1
- package/dist/components/segmented-control.cjs +2 -2
- package/dist/components/segmented-control.cjs.map +1 -1
- package/dist/components/segmented-control.js +2 -2
- package/dist/components/segmented-control.js.map +1 -1
- package/dist/components/select.cjs +33 -3
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.d.cts +11 -1
- package/dist/components/select.d.ts +11 -1
- package/dist/components/select.js +32 -4
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.cjs +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/stepper.cjs +2 -2
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.d.cts +4 -4
- package/dist/components/stepper.d.ts +4 -4
- package/dist/components/stepper.js +2 -2
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/table.cjs +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.cjs +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/toast.cjs +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/tooltip.cjs +2 -2
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.js +2 -2
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/typography.cjs +1 -1
- package/dist/components/typography.cjs.map +1 -1
- package/dist/components/typography.d.cts +4 -1
- package/dist/components/typography.d.ts +4 -1
- package/dist/components/typography.js +1 -1
- package/dist/components/typography.js.map +1 -1
- package/dist/components/wizard-layout.cjs +57 -0
- package/dist/components/wizard-layout.cjs.map +1 -0
- package/dist/components/wizard-layout.d.cts +34 -0
- package/dist/components/wizard-layout.d.ts +34 -0
- package/dist/components/wizard-layout.js +50 -0
- package/dist/components/wizard-layout.js.map +1 -0
- package/dist/lib/accent-colors.cjs +4 -1
- package/dist/lib/accent-colors.cjs.map +1 -1
- package/dist/lib/accent-colors.d.cts +1 -1
- package/dist/lib/accent-colors.d.ts +1 -1
- package/dist/lib/accent-colors.js +4 -1
- package/dist/lib/accent-colors.js.map +1 -1
- package/dist/lib/accent-theme.cjs +2 -2
- package/dist/lib/accent-theme.cjs.map +1 -1
- package/dist/lib/accent-theme.js +2 -2
- package/dist/lib/accent-theme.js.map +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles/spark-default.css +49 -314
- package/dist/styles/theme.css +52 -6
- package/dist/utils/format.cjs +0 -13
- package/dist/utils/format.cjs.map +1 -1
- package/dist/utils/format.d.cts +1 -7
- package/dist/utils/format.d.ts +1 -7
- package/dist/utils/format.js +1 -12
- package/dist/utils/format.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/battery-progress-row.cjs +0 -135
- package/dist/components/battery-progress-row.cjs.map +0 -1
- package/dist/components/battery-progress-row.d.cts +0 -69
- package/dist/components/battery-progress-row.d.ts +0 -69
- package/dist/components/battery-progress-row.js +0 -125
- package/dist/components/battery-progress-row.js.map +0 -1
- package/dist/components/device-card.cjs.map +0 -1
- package/dist/components/device-card.js.map +0 -1
- package/dist/components/energy-bar-chart.cjs.map +0 -1
- package/dist/components/energy-bar-chart.d.cts +0 -43
- package/dist/components/energy-bar-chart.d.ts +0 -43
- package/dist/components/energy-bar-chart.js.map +0 -1
- package/dist/components/energy-breakdown.cjs +0 -80
- package/dist/components/energy-breakdown.cjs.map +0 -1
- package/dist/components/energy-breakdown.d.cts +0 -24
- package/dist/components/energy-breakdown.d.ts +0 -24
- package/dist/components/energy-breakdown.js +0 -79
- package/dist/components/energy-breakdown.js.map +0 -1
- package/dist/components/energy-history-chart.cjs +0 -63
- package/dist/components/energy-history-chart.cjs.map +0 -1
- package/dist/components/energy-history-chart.d.cts +0 -64
- package/dist/components/energy-history-chart.d.ts +0 -64
- package/dist/components/energy-history-chart.js +0 -62
- package/dist/components/energy-history-chart.js.map +0 -1
- package/dist/components/feed-in-hero.cjs.map +0 -1
- package/dist/components/feed-in-hero.d.cts +0 -32
- package/dist/components/feed-in-hero.d.ts +0 -32
- package/dist/components/feed-in-hero.js.map +0 -1
- package/dist/components/metering-row.cjs +0 -59
- package/dist/components/metering-row.cjs.map +0 -1
- package/dist/components/metering-row.d.cts +0 -31
- package/dist/components/metering-row.d.ts +0 -31
- package/dist/components/metering-row.js +0 -55
- package/dist/components/metering-row.js.map +0 -1
- package/dist/components/money-saved-block.cjs +0 -83
- package/dist/components/money-saved-block.cjs.map +0 -1
- package/dist/components/money-saved-block.d.cts +0 -55
- package/dist/components/money-saved-block.d.ts +0 -55
- package/dist/components/money-saved-block.js +0 -76
- package/dist/components/money-saved-block.js.map +0 -1
- package/dist/components/on-off-button.cjs +0 -32
- package/dist/components/on-off-button.cjs.map +0 -1
- package/dist/components/on-off-button.d.cts +0 -18
- package/dist/components/on-off-button.d.ts +0 -18
- package/dist/components/on-off-button.js +0 -31
- package/dist/components/on-off-button.js.map +0 -1
- package/dist/components/onboarding-layout.cjs +0 -67
- package/dist/components/onboarding-layout.cjs.map +0 -1
- package/dist/components/onboarding-layout.d.cts +0 -44
- package/dist/components/onboarding-layout.d.ts +0 -44
- package/dist/components/onboarding-layout.js +0 -60
- package/dist/components/onboarding-layout.js.map +0 -1
- package/dist/components/power-history-chart.cjs +0 -498
- package/dist/components/power-history-chart.cjs.map +0 -1
- package/dist/components/power-history-chart.d.cts +0 -71
- package/dist/components/power-history-chart.d.ts +0 -71
- package/dist/components/power-history-chart.js +0 -496
- package/dist/components/power-history-chart.js.map +0 -1
- package/dist/components/power-history.cjs +0 -114
- package/dist/components/power-history.cjs.map +0 -1
- package/dist/components/power-history.d.cts +0 -40
- package/dist/components/power-history.d.ts +0 -41
- package/dist/components/power-history.js +0 -114
- package/dist/components/power-history.js.map +0 -1
- package/dist/components/power-network.cjs +0 -559
- package/dist/components/power-network.cjs.map +0 -1
- package/dist/components/power-network.d.cts +0 -80
- package/dist/components/power-network.d.ts +0 -80
- package/dist/components/power-network.js +0 -553
- package/dist/components/power-network.js.map +0 -1
- package/dist/components/smart-toggle-button.cjs +0 -24
- package/dist/components/smart-toggle-button.cjs.map +0 -1
- package/dist/components/smart-toggle-button.d.cts +0 -16
- package/dist/components/smart-toggle-button.d.ts +0 -16
- package/dist/components/smart-toggle-button.js +0 -23
- package/dist/components/smart-toggle-button.js.map +0 -1
- package/dist/components/solar-forecast-chart.cjs +0 -108
- package/dist/components/solar-forecast-chart.cjs.map +0 -1
- package/dist/components/solar-forecast-chart.d.cts +0 -77
- package/dist/components/solar-forecast-chart.d.ts +0 -77
- package/dist/components/solar-forecast-chart.js +0 -103
- package/dist/components/solar-forecast-chart.js.map +0 -1
- package/dist/number-flow-Bch81ixZ.d.cts +0 -14
- package/dist/number-flow-Bch81ixZ.d.ts +0 -14
- package/dist/utils/build-sankey-nodes.cjs +0 -72
- package/dist/utils/build-sankey-nodes.cjs.map +0 -1
- package/dist/utils/build-sankey-nodes.d.cts +0 -27
- package/dist/utils/build-sankey-nodes.d.ts +0 -27
- package/dist/utils/build-sankey-nodes.js +0 -71
- package/dist/utils/build-sankey-nodes.js.map +0 -1
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//#region src/components/onboarding-layout.d.ts
|
|
4
|
-
declare const OnboardingLayout: ({
|
|
5
|
-
className,
|
|
6
|
-
...rest
|
|
7
|
-
}: React.ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
/**
|
|
9
|
-
* Top section: typically wraps the title row, optional description, and a
|
|
10
|
-
* progress bar.
|
|
11
|
-
*/
|
|
12
|
-
declare const OnboardingLayoutHeader: ({
|
|
13
|
-
className,
|
|
14
|
-
...rest
|
|
15
|
-
}: React.ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
/** Text-only group inside the header (title row + description). */
|
|
17
|
-
declare const OnboardingLayoutHeading: ({
|
|
18
|
-
className,
|
|
19
|
-
...rest
|
|
20
|
-
}: React.ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
/** Row that holds the title on the left and (optionally) a step badge on the right. */
|
|
22
|
-
declare const OnboardingLayoutTitleRow: ({
|
|
23
|
-
className,
|
|
24
|
-
...rest
|
|
25
|
-
}: React.ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
declare const OnboardingLayoutTitle: ({
|
|
27
|
-
className,
|
|
28
|
-
...rest
|
|
29
|
-
}: React.ComponentProps<"h2">) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
declare const OnboardingLayoutDescription: ({
|
|
31
|
-
className,
|
|
32
|
-
...rest
|
|
33
|
-
}: React.ComponentProps<"p">) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
-
/**
|
|
35
|
-
* Bottom action row. Use with `justify-between`-aware children — typically a
|
|
36
|
-
* back action on the left and a cancel/primary action on the right.
|
|
37
|
-
*/
|
|
38
|
-
declare const OnboardingLayoutFooter: ({
|
|
39
|
-
className,
|
|
40
|
-
...rest
|
|
41
|
-
}: React.ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
-
//#endregion
|
|
43
|
-
export { OnboardingLayout, OnboardingLayoutDescription, OnboardingLayoutFooter, OnboardingLayoutHeader, OnboardingLayoutHeading, OnboardingLayoutTitle, OnboardingLayoutTitleRow };
|
|
44
|
-
//# sourceMappingURL=onboarding-layout.d.ts.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
//#region src/components/onboarding-layout.tsx
|
|
5
|
-
const OnboardingLayout = ({ className, ...rest }) => {
|
|
6
|
-
return /* @__PURE__ */ jsx("div", {
|
|
7
|
-
className: cn("flex flex-col gap-[calc(var(--spark-layout-gap)*6)]", className),
|
|
8
|
-
...rest
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Top section: typically wraps the title row, optional description, and a
|
|
13
|
-
* progress bar.
|
|
14
|
-
*/
|
|
15
|
-
const OnboardingLayoutHeader = ({ className, ...rest }) => {
|
|
16
|
-
return /* @__PURE__ */ jsx("div", {
|
|
17
|
-
className: cn("flex flex-col gap-[calc(var(--spark-layout-gap)*3)] pt-4", className),
|
|
18
|
-
...rest
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
/** Text-only group inside the header (title row + description). */
|
|
22
|
-
const OnboardingLayoutHeading = ({ className, ...rest }) => {
|
|
23
|
-
return /* @__PURE__ */ jsx("div", {
|
|
24
|
-
className: cn("flex flex-col gap-[calc(var(--spark-layout-gap)*1)]", className),
|
|
25
|
-
...rest
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
/** Row that holds the title on the left and (optionally) a step badge on the right. */
|
|
29
|
-
const OnboardingLayoutTitleRow = ({ className, ...rest }) => {
|
|
30
|
-
return /* @__PURE__ */ jsx("div", {
|
|
31
|
-
className: cn("flex items-center justify-between", className),
|
|
32
|
-
...rest
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
const OnboardingLayoutTitle = ({ className, ...rest }) => {
|
|
36
|
-
return /* @__PURE__ */ jsx("h2", {
|
|
37
|
-
className: cn("text-lg font-bold text-gray", className),
|
|
38
|
-
...rest
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
const OnboardingLayoutDescription = ({ className, ...rest }) => {
|
|
42
|
-
return /* @__PURE__ */ jsx("p", {
|
|
43
|
-
className: cn("text-sm text-gray-light", className),
|
|
44
|
-
...rest
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Bottom action row. Use with `justify-between`-aware children — typically a
|
|
49
|
-
* back action on the left and a cancel/primary action on the right.
|
|
50
|
-
*/
|
|
51
|
-
const OnboardingLayoutFooter = ({ className, ...rest }) => {
|
|
52
|
-
return /* @__PURE__ */ jsx("div", {
|
|
53
|
-
className: cn("flex items-center justify-between", className),
|
|
54
|
-
...rest
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
//#endregion
|
|
58
|
-
export { OnboardingLayout, OnboardingLayoutDescription, OnboardingLayoutFooter, OnboardingLayoutHeader, OnboardingLayoutHeading, OnboardingLayoutTitle, OnboardingLayoutTitleRow };
|
|
59
|
-
|
|
60
|
-
//# sourceMappingURL=onboarding-layout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding-layout.js","names":[],"sources":["../../src/components/onboarding-layout.tsx"],"sourcesContent":["import { cn } from '../utils/cn'\n\nconst OnboardingLayout = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex flex-col gap-[calc(var(--spark-layout-gap)*6)]',\n className,\n )}\n {...rest}\n />\n )\n}\n\n/**\n * Top section: typically wraps the title row, optional description, and a\n * progress bar.\n */\nconst OnboardingLayoutHeader = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex flex-col gap-[calc(var(--spark-layout-gap)*3)] pt-4',\n className,\n )}\n {...rest}\n />\n )\n}\n\n/** Text-only group inside the header (title row + description). */\nconst OnboardingLayoutHeading = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex flex-col gap-[calc(var(--spark-layout-gap)*1)]',\n className,\n )}\n {...rest}\n />\n )\n}\n\n/** Row that holds the title on the left and (optionally) a step badge on the right. */\nconst OnboardingLayoutTitleRow = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex items-center justify-between', className)}\n {...rest}\n />\n )\n}\n\nconst OnboardingLayoutTitle = ({\n className,\n ...rest\n}: React.ComponentProps<'h2'>) => {\n return (\n <h2 className={cn('text-lg font-bold text-gray', className)} {...rest} />\n )\n}\n\nconst OnboardingLayoutDescription = ({\n className,\n ...rest\n}: React.ComponentProps<'p'>) => {\n return <p className={cn('text-sm text-gray-light', className)} {...rest} />\n}\n\n/**\n * Bottom action row. Use with `justify-between`-aware children — typically a\n * back action on the left and a cancel/primary action on the right.\n */\nconst OnboardingLayoutFooter = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex items-center justify-between', className)}\n {...rest}\n />\n )\n}\n\nexport {\n OnboardingLayout,\n OnboardingLayoutHeader,\n OnboardingLayoutHeading,\n OnboardingLayoutTitleRow,\n OnboardingLayoutTitle,\n OnboardingLayoutDescription,\n OnboardingLayoutFooter,\n}\n"],"mappings":";;;;AAEA,MAAM,oBAAoB,EACxB,WACA,GAAG,WAC8B;CACjC,OACE,oBAAC,OAAD;EACE,WAAW,GACT,uDACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;;;;AAMA,MAAM,0BAA0B,EAC9B,WACA,GAAG,WAC8B;CACjC,OACE,oBAAC,OAAD;EACE,WAAW,GACT,4DACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;AAGA,MAAM,2BAA2B,EAC/B,WACA,GAAG,WAC8B;CACjC,OACE,oBAAC,OAAD;EACE,WAAW,GACT,uDACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;AAGA,MAAM,4BAA4B,EAChC,WACA,GAAG,WAC8B;CACjC,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,qCAAqC,SAAS;EAC5D,GAAI;CACL,CAAA;AAEL;AAEA,MAAM,yBAAyB,EAC7B,WACA,GAAG,WAC6B;CAChC,OACE,oBAAC,MAAD;EAAI,WAAW,GAAG,+BAA+B,SAAS;EAAG,GAAI;CAAO,CAAA;AAE5E;AAEA,MAAM,+BAA+B,EACnC,WACA,GAAG,WAC4B;CAC/B,OAAO,oBAAC,KAAD;EAAG,WAAW,GAAG,2BAA2B,SAAS;EAAG,GAAI;CAAO,CAAA;AAC5E;;;;;AAMA,MAAM,0BAA0B,EAC9B,WACA,GAAG,WAC8B;CACjC,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,qCAAqC,SAAS;EAC5D,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1,498 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
|
-
require("../utils/chars.cjs");
|
|
5
|
-
const require_utils_format = require("../utils/format.cjs");
|
|
6
|
-
const require_utils_chart_scale = require("../utils/chart-scale.cjs");
|
|
7
|
-
const require_utils_chart_time_ticks = require("../utils/chart-time-ticks.cjs");
|
|
8
|
-
const require_hooks_use_chart_zoom = require("../hooks/use-chart-zoom.cjs");
|
|
9
|
-
const require_hooks_use_reduced_motion = require("../hooks/use-reduced-motion.cjs");
|
|
10
|
-
const require_components_chart = require("./chart.cjs");
|
|
11
|
-
const require_components_series_legend = require("./series-legend.cjs");
|
|
12
|
-
const require_components_typography = require("./typography.cjs");
|
|
13
|
-
let react = require("react");
|
|
14
|
-
react = require_chunk.__toESM(react);
|
|
15
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
|
-
let _visx_event = require("@visx/event");
|
|
17
|
-
let _visx_scale = require("@visx/scale");
|
|
18
|
-
let _visx_shape = require("@visx/shape");
|
|
19
|
-
let _visx_curve = require("@visx/curve");
|
|
20
|
-
let _visx_tooltip = require("@visx/tooltip");
|
|
21
|
-
let _visx_vendor_d3_array = require("@visx/vendor/d3-array");
|
|
22
|
-
let cnfast = require("cnfast");
|
|
23
|
-
//#region src/components/power-history-chart.tsx
|
|
24
|
-
const AREA_KEYS = [
|
|
25
|
-
"solar",
|
|
26
|
-
"grid",
|
|
27
|
-
"battery"
|
|
28
|
-
];
|
|
29
|
-
const SERIES_KEYS = [
|
|
30
|
-
"solar",
|
|
31
|
-
"grid",
|
|
32
|
-
"battery",
|
|
33
|
-
"consumption"
|
|
34
|
-
];
|
|
35
|
-
const SERIES_COLORS = {
|
|
36
|
-
solar: "var(--orange-a9)",
|
|
37
|
-
grid: "var(--blue-9)",
|
|
38
|
-
battery: "var(--green-a9)",
|
|
39
|
-
consumption: "var(--neutral-12)"
|
|
40
|
-
};
|
|
41
|
-
const PADDING_TOP = 20;
|
|
42
|
-
const PADDING_BOTTOM = 28;
|
|
43
|
-
const PADDING_RIGHT = 8;
|
|
44
|
-
const X_TICK_COUNT = 6;
|
|
45
|
-
const DEFAULT_HEIGHT = 260;
|
|
46
|
-
const DETAILED_X_AXIS_THRESHOLD = 360 * 60 * 1e3;
|
|
47
|
-
const tBisector = (0, _visx_vendor_d3_array.bisector)((d) => d.t);
|
|
48
|
-
function touchDistance(a, b) {
|
|
49
|
-
return Math.hypot(a.clientX - b.clientX, a.clientY - b.clientY);
|
|
50
|
-
}
|
|
51
|
-
function touchMidpoint(a, b) {
|
|
52
|
-
return {
|
|
53
|
-
clientX: (a.clientX + b.clientX) / 2,
|
|
54
|
-
clientY: (a.clientY + b.clientY) / 2
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Diverging "power sources" area chart over a continuous time axis: solar
|
|
59
|
-
* (orange), grid (blue) and battery (green) areas around a zero baseline, with
|
|
60
|
-
* consumption overlaid as a line. Negative values (grid feed-in, battery
|
|
61
|
-
* charging) dip below zero. For instantaneous power (day view). A legend at the
|
|
62
|
-
* top toggles each series on/off; the y-axis rescales to the visible ones. visx.
|
|
63
|
-
*/
|
|
64
|
-
function PowerHistoryChart({ data, unit, formatX, formatTooltipX, formatValue, labels, omitSeries, highlightAt, title, className, height = DEFAULT_HEIGHT, zoomable = false, zoomResetLabel, zoomDomain, onZoomDomainChange }) {
|
|
65
|
-
const plotClipId = react.useId();
|
|
66
|
-
const fmtTooltipX = formatTooltipX ?? formatX;
|
|
67
|
-
const containerRef = (0, react.useRef)(null);
|
|
68
|
-
const reducedMotion = require_hooks_use_reduced_motion.useReducedMotion();
|
|
69
|
-
const [width, setWidth] = (0, react.useState)(0);
|
|
70
|
-
const [hiddenSeries, setHiddenSeries] = (0, react.useState)(() => /* @__PURE__ */ new Set());
|
|
71
|
-
const omitted = (0, react.useMemo)(() => new Set(omitSeries), [omitSeries]);
|
|
72
|
-
const toggleSeries = (0, react.useCallback)((id) => {
|
|
73
|
-
setHiddenSeries((prev) => {
|
|
74
|
-
const next = new Set(prev);
|
|
75
|
-
if (next.has(id)) next.delete(id);
|
|
76
|
-
else next.add(id);
|
|
77
|
-
return next;
|
|
78
|
-
});
|
|
79
|
-
}, []);
|
|
80
|
-
const isHidden = (0, react.useCallback)((key) => omitted.has(key) || hiddenSeries.has(key), [hiddenSeries, omitted]);
|
|
81
|
-
const { showTooltip, hideTooltip, tooltipData, tooltipLeft, tooltipTop, tooltipOpen } = (0, _visx_tooltip.useTooltip)();
|
|
82
|
-
(0, react.useEffect)(() => {
|
|
83
|
-
const element = containerRef.current;
|
|
84
|
-
if (!element) return;
|
|
85
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
86
|
-
const entry = entries[0];
|
|
87
|
-
if (!entry) return;
|
|
88
|
-
setWidth(entry.contentRect.width);
|
|
89
|
-
});
|
|
90
|
-
resizeObserver.observe(element);
|
|
91
|
-
return () => resizeObserver.disconnect();
|
|
92
|
-
}, []);
|
|
93
|
-
const fmtValue = (value) => formatValue ? formatValue(value) : `${require_utils_format.twoDecimalFormat.format(value)} ${unit}`;
|
|
94
|
-
const tMin = data.length ? data[0]?.t ?? 0 : 0;
|
|
95
|
-
const tMax = data.length ? data[data.length - 1]?.t ?? 0 : 0;
|
|
96
|
-
const zoom = require_hooks_use_chart_zoom.useChartZoom({
|
|
97
|
-
enabled: zoomable,
|
|
98
|
-
fullDomain: (0, react.useMemo)(() => {
|
|
99
|
-
if (data.length === 0) return null;
|
|
100
|
-
return [tMin, tMax];
|
|
101
|
-
}, [
|
|
102
|
-
data.length,
|
|
103
|
-
tMin,
|
|
104
|
-
tMax
|
|
105
|
-
]),
|
|
106
|
-
zoomDomain,
|
|
107
|
-
onZoomDomainChange
|
|
108
|
-
});
|
|
109
|
-
const viewMin = zoom.zoomWindow?.[0] ?? tMin;
|
|
110
|
-
const viewMax = zoom.zoomWindow?.[1] ?? tMax;
|
|
111
|
-
const visibleData = (0, react.useMemo)(() => data.filter((d) => d.t >= viewMin && d.t <= viewMax), [
|
|
112
|
-
data,
|
|
113
|
-
viewMin,
|
|
114
|
-
viewMax
|
|
115
|
-
]);
|
|
116
|
-
const { yMin, yMax } = (0, react.useMemo)(() => {
|
|
117
|
-
let min = 0;
|
|
118
|
-
let max = 0;
|
|
119
|
-
for (const d of visibleData) {
|
|
120
|
-
if (!isHidden("solar")) max = Math.max(max, d.solar);
|
|
121
|
-
if (!isHidden("consumption")) max = Math.max(max, d.consumption);
|
|
122
|
-
if (!isHidden("grid")) {
|
|
123
|
-
max = Math.max(max, d.grid);
|
|
124
|
-
min = Math.min(min, d.grid);
|
|
125
|
-
}
|
|
126
|
-
if (!isHidden("battery")) {
|
|
127
|
-
max = Math.max(max, d.battery);
|
|
128
|
-
min = Math.min(min, d.battery);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return {
|
|
132
|
-
yMin: min,
|
|
133
|
-
yMax: max
|
|
134
|
-
};
|
|
135
|
-
}, [visibleData, isHidden]);
|
|
136
|
-
const { ticks: yTicks, min: lo, max: hi } = (0, react.useMemo)(() => require_utils_chart_scale.buildYAxisScale(yMin, yMax), [yMin, yMax]);
|
|
137
|
-
const displayedYDomain = require_hooks_use_chart_zoom.useAnimatedChartDomain([lo, hi], {
|
|
138
|
-
animateChanges: zoom.isPinching,
|
|
139
|
-
reducedMotion
|
|
140
|
-
});
|
|
141
|
-
const gutter = (0, react.useMemo)(() => require_utils_chart_scale.measureYAxisGutter(yTicks, require_utils_chart_scale.formatYAxisTick), [yTicks]);
|
|
142
|
-
const plotRight = Math.max(gutter, width - PADDING_RIGHT);
|
|
143
|
-
const xScale = (0, react.useMemo)(() => (0, _visx_scale.scaleLinear)({
|
|
144
|
-
domain: [viewMin, viewMax === viewMin ? viewMin + 1 : viewMax],
|
|
145
|
-
range: [gutter, plotRight]
|
|
146
|
-
}), [
|
|
147
|
-
viewMin,
|
|
148
|
-
viewMax,
|
|
149
|
-
plotRight,
|
|
150
|
-
gutter
|
|
151
|
-
]);
|
|
152
|
-
const plotHeight = Math.max(0, height - PADDING_BOTTOM - PADDING_TOP);
|
|
153
|
-
const plotWidth = Math.max(0, plotRight - gutter);
|
|
154
|
-
const yScale = (0, react.useMemo)(() => (0, _visx_scale.scaleLinear)({
|
|
155
|
-
domain: [displayedYDomain[0], displayedYDomain[1] === displayedYDomain[0] ? displayedYDomain[0] + 1 : displayedYDomain[1]],
|
|
156
|
-
range: [height - PADDING_BOTTOM, PADDING_TOP]
|
|
157
|
-
}), [displayedYDomain, height]);
|
|
158
|
-
const xTicks = (0, react.useMemo)(() => require_utils_chart_time_ticks.buildTimeTicks(viewMin, viewMax, X_TICK_COUNT), [viewMin, viewMax]);
|
|
159
|
-
const formatAxisX = zoom.isZoomed && viewMax - viewMin <= DETAILED_X_AXIS_THRESHOLD ? fmtTooltipX : formatX;
|
|
160
|
-
const domainXFromEvent = (0, react.useCallback)((event) => {
|
|
161
|
-
const point = (0, _visx_event.localPoint)(event);
|
|
162
|
-
if (!point) return null;
|
|
163
|
-
return xScale.invert(point.x);
|
|
164
|
-
}, [xScale]);
|
|
165
|
-
const handleTooltip = (0, react.useCallback)((event) => {
|
|
166
|
-
if (zoom.isBrushing || zoom.isPanning) return;
|
|
167
|
-
const point = (0, _visx_event.localPoint)(event);
|
|
168
|
-
if (!point || data.length === 0) return;
|
|
169
|
-
const xMs = xScale.invert(point.x);
|
|
170
|
-
const index = tBisector.left(data, xMs, 1);
|
|
171
|
-
const d0 = data[index - 1];
|
|
172
|
-
const d1 = data[index];
|
|
173
|
-
if (!d0) return;
|
|
174
|
-
const d = d1 && xMs - d0.t > d1.t - xMs ? d1 : d0;
|
|
175
|
-
showTooltip({
|
|
176
|
-
tooltipData: d,
|
|
177
|
-
tooltipLeft: xScale(d.t),
|
|
178
|
-
tooltipTop: PADDING_TOP
|
|
179
|
-
});
|
|
180
|
-
}, [
|
|
181
|
-
data,
|
|
182
|
-
showTooltip,
|
|
183
|
-
xScale,
|
|
184
|
-
zoom.isBrushing,
|
|
185
|
-
zoom.isPanning
|
|
186
|
-
]);
|
|
187
|
-
const legendItems = SERIES_KEYS.filter((key) => !omitted.has(key)).map((key) => ({
|
|
188
|
-
id: key,
|
|
189
|
-
label: labels[key],
|
|
190
|
-
color: SERIES_COLORS[key]
|
|
191
|
-
}));
|
|
192
|
-
const tooltipRows = tooltipData ? SERIES_KEYS.filter((key) => !isHidden(key)).map((key) => ({
|
|
193
|
-
key,
|
|
194
|
-
label: labels[key],
|
|
195
|
-
color: SERIES_COLORS[key],
|
|
196
|
-
value: fmtValue(tooltipData[key])
|
|
197
|
-
})) : [];
|
|
198
|
-
const showHighlight = highlightAt !== void 0 && highlightAt >= viewMin && highlightAt <= viewMax;
|
|
199
|
-
const [tooltipRef, tooltipSize] = require_components_chart.useMeasuredSize();
|
|
200
|
-
const tooltipPos = require_components_chart.clampTooltipPosition({
|
|
201
|
-
anchorX: tooltipLeft ?? 0,
|
|
202
|
-
anchorY: tooltipTop ?? PADDING_TOP,
|
|
203
|
-
width,
|
|
204
|
-
height,
|
|
205
|
-
tipWidth: tooltipSize.width,
|
|
206
|
-
tipHeight: tooltipSize.height,
|
|
207
|
-
placement: "beside"
|
|
208
|
-
});
|
|
209
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
210
|
-
className: (0, cnfast.cn)("flex w-full flex-col gap-2", className),
|
|
211
|
-
children: [
|
|
212
|
-
title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_typography.SectionTitle, { children: title }),
|
|
213
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_series_legend.SeriesLegend, {
|
|
214
|
-
items: legendItems,
|
|
215
|
-
hiddenIds: hiddenSeries,
|
|
216
|
-
onToggle: toggleSeries
|
|
217
|
-
}),
|
|
218
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
219
|
-
className: "px-1 text-xs text-gray-light",
|
|
220
|
-
children: unit
|
|
221
|
-
}),
|
|
222
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
223
|
-
ref: containerRef,
|
|
224
|
-
className: "relative w-full",
|
|
225
|
-
style: { height },
|
|
226
|
-
children: [
|
|
227
|
-
width > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
228
|
-
width,
|
|
229
|
-
height,
|
|
230
|
-
children: [
|
|
231
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [AREA_KEYS.map((key) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
232
|
-
id: `power-history-fill-${key}`,
|
|
233
|
-
x1: "0",
|
|
234
|
-
y1: "0",
|
|
235
|
-
x2: "0",
|
|
236
|
-
y2: "1",
|
|
237
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
238
|
-
offset: "0%",
|
|
239
|
-
stopColor: SERIES_COLORS[key],
|
|
240
|
-
stopOpacity: .35
|
|
241
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
242
|
-
offset: "100%",
|
|
243
|
-
stopColor: SERIES_COLORS[key],
|
|
244
|
-
stopOpacity: .04
|
|
245
|
-
})]
|
|
246
|
-
}, key)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("clipPath", {
|
|
247
|
-
id: plotClipId,
|
|
248
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
249
|
-
height: plotHeight,
|
|
250
|
-
width: plotWidth,
|
|
251
|
-
x: gutter,
|
|
252
|
-
y: PADDING_TOP
|
|
253
|
-
})
|
|
254
|
-
})] }),
|
|
255
|
-
yTicks.map((tick) => {
|
|
256
|
-
const y = yScale(tick);
|
|
257
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
258
|
-
x1: gutter,
|
|
259
|
-
x2: plotRight,
|
|
260
|
-
y1: y,
|
|
261
|
-
y2: y,
|
|
262
|
-
stroke: "var(--neutral-a4)",
|
|
263
|
-
strokeWidth: 1
|
|
264
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
|
|
265
|
-
x: gutter - 7,
|
|
266
|
-
y: y + 3,
|
|
267
|
-
textAnchor: "end",
|
|
268
|
-
fill: "var(--neutral-a11)",
|
|
269
|
-
fontSize: 10,
|
|
270
|
-
children: require_utils_chart_scale.formatYAxisTick(tick)
|
|
271
|
-
})] }, `y-tick-${tick}`);
|
|
272
|
-
}),
|
|
273
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
|
|
274
|
-
clipPath: `url(#${plotClipId})`,
|
|
275
|
-
"data-testid": "chart-plot-clip",
|
|
276
|
-
children: [
|
|
277
|
-
AREA_KEYS.filter((key) => !isHidden(key)).map((key) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_shape.Area, {
|
|
278
|
-
data,
|
|
279
|
-
x: (d) => xScale(d.t),
|
|
280
|
-
y0: yScale(0),
|
|
281
|
-
y1: (d) => yScale(d[key]),
|
|
282
|
-
curve: _visx_curve.curveMonotoneX,
|
|
283
|
-
fill: `url(#power-history-fill-${key})`,
|
|
284
|
-
stroke: "transparent"
|
|
285
|
-
}, `area-${key}`)),
|
|
286
|
-
AREA_KEYS.filter((key) => !isHidden(key)).map((key) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_shape.LinePath, {
|
|
287
|
-
data,
|
|
288
|
-
x: (d) => xScale(d.t),
|
|
289
|
-
y: (d) => yScale(d[key]),
|
|
290
|
-
curve: _visx_curve.curveMonotoneX,
|
|
291
|
-
stroke: SERIES_COLORS[key],
|
|
292
|
-
strokeWidth: 1.5,
|
|
293
|
-
fill: "none"
|
|
294
|
-
}, `line-${key}`)),
|
|
295
|
-
!isHidden("consumption") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_shape.LinePath, {
|
|
296
|
-
data,
|
|
297
|
-
x: (d) => xScale(d.t),
|
|
298
|
-
y: (d) => yScale(d.consumption),
|
|
299
|
-
curve: _visx_curve.curveMonotoneX,
|
|
300
|
-
stroke: SERIES_COLORS.consumption,
|
|
301
|
-
strokeWidth: 1.5,
|
|
302
|
-
fill: "none"
|
|
303
|
-
})
|
|
304
|
-
]
|
|
305
|
-
}),
|
|
306
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
307
|
-
x1: gutter,
|
|
308
|
-
x2: plotRight,
|
|
309
|
-
y1: yScale(0),
|
|
310
|
-
y2: yScale(0),
|
|
311
|
-
stroke: "var(--neutral-a6)",
|
|
312
|
-
strokeWidth: 1
|
|
313
|
-
}),
|
|
314
|
-
showHighlight && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
315
|
-
x1: xScale(highlightAt),
|
|
316
|
-
x2: xScale(highlightAt),
|
|
317
|
-
y1: PADDING_TOP,
|
|
318
|
-
y2: height - PADDING_BOTTOM,
|
|
319
|
-
stroke: "var(--spark-a9)",
|
|
320
|
-
strokeWidth: 1.5,
|
|
321
|
-
strokeDasharray: "5 4",
|
|
322
|
-
pointerEvents: "none"
|
|
323
|
-
}),
|
|
324
|
-
xTicks.map((tick, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
|
|
325
|
-
x: xScale(tick),
|
|
326
|
-
y: height - PADDING_BOTTOM + 16,
|
|
327
|
-
textAnchor: index === 0 ? "start" : index === xTicks.length - 1 ? "end" : "middle",
|
|
328
|
-
fill: "var(--neutral-a11)",
|
|
329
|
-
fontSize: 10,
|
|
330
|
-
children: formatAxisX(tick)
|
|
331
|
-
}, `x-tick-${tick}`)),
|
|
332
|
-
tooltipOpen && tooltipData && !zoom.isBrushing && !zoom.isPanning && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
333
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
334
|
-
x1: xScale(tooltipData.t),
|
|
335
|
-
x2: xScale(tooltipData.t),
|
|
336
|
-
y1: PADDING_TOP,
|
|
337
|
-
y2: height - PADDING_BOTTOM,
|
|
338
|
-
stroke: "var(--neutral-a6)",
|
|
339
|
-
strokeDasharray: "4 4",
|
|
340
|
-
pointerEvents: "none"
|
|
341
|
-
}),
|
|
342
|
-
AREA_KEYS.filter((key) => !isHidden(key)).map((key) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
343
|
-
cx: xScale(tooltipData.t),
|
|
344
|
-
cy: yScale(tooltipData[key]),
|
|
345
|
-
r: 3.5,
|
|
346
|
-
fill: SERIES_COLORS[key],
|
|
347
|
-
stroke: "white",
|
|
348
|
-
strokeWidth: 1.5,
|
|
349
|
-
pointerEvents: "none"
|
|
350
|
-
}, `dot-${key}`)),
|
|
351
|
-
!isHidden("consumption") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
352
|
-
cx: xScale(tooltipData.t),
|
|
353
|
-
cy: yScale(tooltipData.consumption),
|
|
354
|
-
r: 3.5,
|
|
355
|
-
fill: SERIES_COLORS.consumption,
|
|
356
|
-
stroke: "white",
|
|
357
|
-
strokeWidth: 1.5,
|
|
358
|
-
pointerEvents: "none"
|
|
359
|
-
})
|
|
360
|
-
] }),
|
|
361
|
-
zoom.brushBand && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
362
|
-
"data-testid": "chart-brush-band",
|
|
363
|
-
x: Math.min(xScale(zoom.brushBand[0]), xScale(zoom.brushBand[1])),
|
|
364
|
-
y: PADDING_TOP,
|
|
365
|
-
width: Math.abs(xScale(zoom.brushBand[1]) - xScale(zoom.brushBand[0])),
|
|
366
|
-
height: plotHeight,
|
|
367
|
-
fill: "var(--spark-a4)",
|
|
368
|
-
pointerEvents: "none"
|
|
369
|
-
}),
|
|
370
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
371
|
-
x: gutter,
|
|
372
|
-
y: PADDING_TOP,
|
|
373
|
-
width: plotWidth,
|
|
374
|
-
height: plotHeight,
|
|
375
|
-
fill: "transparent",
|
|
376
|
-
style: zoomable ? { touchAction: "pan-y" } : void 0,
|
|
377
|
-
onMouseLeave: () => {
|
|
378
|
-
if (!zoom.isBrushing) hideTooltip();
|
|
379
|
-
},
|
|
380
|
-
onMouseMove: (event) => {
|
|
381
|
-
if (zoom.isBrushing) {
|
|
382
|
-
const domainX = domainXFromEvent(event);
|
|
383
|
-
if (domainX != null) zoom.onPointerMove(domainX);
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
handleTooltip(event);
|
|
387
|
-
},
|
|
388
|
-
onPointerDown: (event) => {
|
|
389
|
-
if (!zoomable || event.pointerType === "touch") return;
|
|
390
|
-
if (event.button !== 0) return;
|
|
391
|
-
const domainX = domainXFromEvent(event);
|
|
392
|
-
if (domainX == null) return;
|
|
393
|
-
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
394
|
-
hideTooltip();
|
|
395
|
-
zoom.onPointerDown(domainX);
|
|
396
|
-
},
|
|
397
|
-
onPointerMove: (event) => {
|
|
398
|
-
if (!zoomable) return;
|
|
399
|
-
const domainX = domainXFromEvent(event);
|
|
400
|
-
if (domainX != null) zoom.onPointerMove(domainX);
|
|
401
|
-
},
|
|
402
|
-
onPointerUp: (event) => {
|
|
403
|
-
if (!zoomable) return;
|
|
404
|
-
const domainX = domainXFromEvent(event);
|
|
405
|
-
if (domainX != null) zoom.onPointerUp(domainX);
|
|
406
|
-
else zoom.onPointerCancel();
|
|
407
|
-
},
|
|
408
|
-
onPointerCancel: () => {
|
|
409
|
-
zoom.onPointerCancel();
|
|
410
|
-
},
|
|
411
|
-
onDoubleClick: () => {
|
|
412
|
-
if (zoomable) zoom.onDoubleClick();
|
|
413
|
-
},
|
|
414
|
-
onTouchStart: (event) => {
|
|
415
|
-
if (!zoomable) return;
|
|
416
|
-
if (event.touches.length === 2) {
|
|
417
|
-
const [a, b] = [event.touches[0], event.touches[1]];
|
|
418
|
-
if (!a || !b) return;
|
|
419
|
-
const point = (0, _visx_event.localPoint)(event.currentTarget, touchMidpoint(a, b));
|
|
420
|
-
if (!point) return;
|
|
421
|
-
const midpoint = Math.min(1, Math.max(0, (point.x - gutter) / plotWidth));
|
|
422
|
-
zoom.onPinchStart(touchDistance(a, b), midpoint);
|
|
423
|
-
hideTooltip();
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
if (event.touches.length === 1 && zoom.isZoomed) {
|
|
427
|
-
const point = (0, _visx_event.localPoint)(event);
|
|
428
|
-
if (!point) return;
|
|
429
|
-
zoom.onPanStart({
|
|
430
|
-
x: (point.x - gutter) / plotWidth,
|
|
431
|
-
y: (point.y - PADDING_TOP) / plotHeight
|
|
432
|
-
});
|
|
433
|
-
hideTooltip();
|
|
434
|
-
}
|
|
435
|
-
},
|
|
436
|
-
onTouchMove: (event) => {
|
|
437
|
-
if (zoomable && event.touches.length === 2) {
|
|
438
|
-
const [a, b] = [event.touches[0], event.touches[1]];
|
|
439
|
-
if (!a || !b) return;
|
|
440
|
-
const point = (0, _visx_event.localPoint)(event.currentTarget, touchMidpoint(a, b));
|
|
441
|
-
if (!point) return;
|
|
442
|
-
const midpoint = Math.min(1, Math.max(0, (point.x - gutter) / plotWidth));
|
|
443
|
-
zoom.onPinchMove(touchDistance(a, b), midpoint);
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
if (event.touches.length === 1 && zoom.isZoomed) {
|
|
447
|
-
const point = (0, _visx_event.localPoint)(event);
|
|
448
|
-
if (!point) return;
|
|
449
|
-
zoom.onPanMove({
|
|
450
|
-
x: (point.x - gutter) / plotWidth,
|
|
451
|
-
y: (point.y - PADDING_TOP) / plotHeight
|
|
452
|
-
});
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
if (event.touches.length === 1) handleTooltip(event);
|
|
456
|
-
},
|
|
457
|
-
onTouchEnd: (event) => {
|
|
458
|
-
if (zoomable && event.touches.length < 2) zoom.onPinchEnd();
|
|
459
|
-
if (event.touches.length === 0) {
|
|
460
|
-
if (zoomable) zoom.onPanEnd();
|
|
461
|
-
if (zoomable) zoom.onTap();
|
|
462
|
-
hideTooltip();
|
|
463
|
-
}
|
|
464
|
-
},
|
|
465
|
-
onTouchCancel: () => {
|
|
466
|
-
zoom.onPinchEnd();
|
|
467
|
-
zoom.onPanEnd();
|
|
468
|
-
}
|
|
469
|
-
})
|
|
470
|
-
]
|
|
471
|
-
}),
|
|
472
|
-
zoom.isZoomed && zoomResetLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_chart.ChartZoomResetButton, {
|
|
473
|
-
label: zoomResetLabel,
|
|
474
|
-
onReset: zoom.resetZoom
|
|
475
|
-
}),
|
|
476
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
477
|
-
ref: tooltipRef,
|
|
478
|
-
className: "pointer-events-none absolute z-10",
|
|
479
|
-
style: {
|
|
480
|
-
left: tooltipPos.left,
|
|
481
|
-
top: tooltipPos.top,
|
|
482
|
-
opacity: tooltipOpen && tooltipData && !zoom.isPanning && !zoom.isBrushing ? 1 : 0,
|
|
483
|
-
transition: reducedMotion ? "opacity 140ms ease-out" : "left 140ms ease-out, top 140ms ease-out, opacity 140ms ease-out"
|
|
484
|
-
},
|
|
485
|
-
children: tooltipData && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_chart.ChartTooltipCard, {
|
|
486
|
-
label: fmtTooltipX(tooltipData.t),
|
|
487
|
-
rows: tooltipRows
|
|
488
|
-
})
|
|
489
|
-
})
|
|
490
|
-
]
|
|
491
|
-
})
|
|
492
|
-
]
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
//#endregion
|
|
496
|
-
exports.PowerHistoryChart = PowerHistoryChart;
|
|
497
|
-
|
|
498
|
-
//# sourceMappingURL=power-history-chart.cjs.map
|