@epilot/spark-ui 1.0.0-alpha.3 → 1.0.0-alpha.5
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/accent-colors-Ch2J0EEY.js +13 -0
- package/dist/accent-colors-Ch2J0EEY.js.map +1 -0
- package/dist/accent-colors-CjHCf8fH.cjs +18 -0
- package/dist/accent-colors-CjHCf8fH.cjs.map +1 -0
- package/dist/components/accordion.cjs +1 -1
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/attachment.d.cts +1 -1
- package/dist/components/attachment.d.ts +1 -1
- package/dist/components/badge.cjs +12 -7
- package/dist/components/badge.cjs.map +1 -1
- package/dist/components/badge.d.cts +5 -1
- package/dist/components/badge.d.ts +5 -1
- package/dist/components/badge.js +12 -7
- package/dist/components/badge.js.map +1 -1
- package/dist/components/bar-chart.cjs +60 -56
- package/dist/components/bar-chart.cjs.map +1 -1
- package/dist/components/bar-chart.d.cts +7 -2
- package/dist/components/bar-chart.d.ts +7 -2
- package/dist/components/bar-chart.js +60 -56
- package/dist/components/bar-chart.js.map +1 -1
- package/dist/components/battery-progress-row.cjs +10 -16
- package/dist/components/battery-progress-row.cjs.map +1 -1
- package/dist/components/battery-progress-row.d.cts +1 -1
- package/dist/components/battery-progress-row.d.ts +2 -2
- package/dist/components/battery-progress-row.js +10 -16
- package/dist/components/battery-progress-row.js.map +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button.cjs +5 -2
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +16 -7
- package/dist/components/button.d.ts +16 -7
- package/dist/components/button.js +5 -2
- package/dist/components/button.js.map +1 -1
- package/dist/components/callout.d.cts +1 -1
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/card.d.cts +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/chart.cjs +1 -1
- package/dist/components/chart.cjs.map +1 -1
- package/dist/components/chart.js +1 -1
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox.cjs +30 -23
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.d.cts +5 -1
- package/dist/components/checkbox.d.ts +5 -1
- package/dist/components/checkbox.js +30 -23
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/circular-gauge.d.ts +1 -1
- package/dist/components/day-of-week-picker.cjs +2 -2
- package/dist/components/day-of-week-picker.cjs.map +1 -1
- package/dist/components/day-of-week-picker.js +2 -2
- package/dist/components/day-of-week-picker.js.map +1 -1
- package/dist/components/device-card.d.ts +1 -1
- package/dist/components/donut-chart.cjs +3 -3
- package/dist/components/donut-chart.cjs.map +1 -1
- package/dist/components/donut-chart.js +3 -3
- package/dist/components/donut-chart.js.map +1 -1
- package/dist/components/energy-bar-chart.cjs +2 -1
- package/dist/components/energy-bar-chart.cjs.map +1 -1
- package/dist/components/energy-bar-chart.d.ts +1 -1
- package/dist/components/energy-bar-chart.js +2 -1
- package/dist/components/energy-bar-chart.js.map +1 -1
- package/dist/components/energy-breakdown.cjs +1 -1
- package/dist/components/energy-breakdown.cjs.map +1 -1
- package/dist/components/energy-breakdown.js +1 -1
- package/dist/components/energy-breakdown.js.map +1 -1
- package/dist/components/energy-history-chart.cjs +14 -6
- package/dist/components/energy-history-chart.cjs.map +1 -1
- package/dist/components/energy-history-chart.d.cts +11 -3
- package/dist/components/energy-history-chart.d.ts +11 -3
- package/dist/components/energy-history-chart.js +14 -6
- package/dist/components/energy-history-chart.js.map +1 -1
- package/dist/components/feed-in-hero.d.ts +1 -1
- package/dist/components/field.cjs +1 -1
- package/dist/components/field.d.cts +1 -1
- package/dist/components/field.d.ts +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/input-group.cjs +1 -1
- package/dist/components/input-group.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.d.cts +1 -1
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/line-chart.cjs +61 -19
- package/dist/components/line-chart.cjs.map +1 -1
- package/dist/components/line-chart.d.cts +7 -0
- package/dist/components/line-chart.d.ts +7 -0
- package/dist/components/line-chart.js +61 -19
- package/dist/components/line-chart.js.map +1 -1
- package/dist/components/metering-row.d.ts +1 -1
- package/dist/components/money-saved-block.cjs +1 -1
- package/dist/components/money-saved-block.cjs.map +1 -1
- package/dist/components/money-saved-block.js +1 -1
- package/dist/components/money-saved-block.js.map +1 -1
- package/dist/components/number-flow.d.ts +1 -1
- package/dist/components/power-history-chart.cjs +23 -44
- package/dist/components/power-history-chart.cjs.map +1 -1
- package/dist/components/power-history-chart.d.cts +10 -1
- package/dist/components/power-history-chart.d.ts +10 -1
- package/dist/components/power-history-chart.js +24 -45
- package/dist/components/power-history-chart.js.map +1 -1
- package/dist/components/power-history.cjs +1 -1
- package/dist/components/power-history.cjs.map +1 -1
- package/dist/components/power-history.js +1 -1
- package/dist/components/power-history.js.map +1 -1
- package/dist/components/power-network.cjs +36 -11
- package/dist/components/power-network.cjs.map +1 -1
- package/dist/components/power-network.js +36 -11
- package/dist/components/power-network.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-card-group.cjs +26 -1
- package/dist/components/radio-card-group.cjs.map +1 -1
- package/dist/components/radio-card-group.js +26 -1
- package/dist/components/radio-card-group.js.map +1 -1
- package/dist/components/radio.cjs +11 -4
- package/dist/components/radio.cjs.map +1 -1
- package/dist/components/radio.d.cts +15 -3
- package/dist/components/radio.d.ts +15 -3
- package/dist/components/radio.js +11 -4
- package/dist/components/radio.js.map +1 -1
- package/dist/components/sankey-chart.cjs +12 -45
- package/dist/components/sankey-chart.cjs.map +1 -1
- package/dist/components/sankey-chart.d.cts +8 -0
- package/dist/components/sankey-chart.d.ts +9 -1
- package/dist/components/sankey-chart.js +12 -45
- package/dist/components/sankey-chart.js.map +1 -1
- package/dist/components/schedule-list.cjs +3 -3
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/schedule-list.js +3 -3
- package/dist/components/schedule-list.js.map +1 -1
- package/dist/components/segmented-control.cjs +44 -0
- package/dist/components/segmented-control.cjs.map +1 -0
- package/dist/components/segmented-control.d.cts +33 -0
- package/dist/components/segmented-control.d.ts +33 -0
- package/dist/components/segmented-control.js +40 -0
- package/dist/components/segmented-control.js.map +1 -0
- package/dist/components/select.cjs +1 -1
- package/dist/components/select.d.cts +1 -1
- package/dist/components/select.d.ts +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.cjs.map +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/separator.js.map +1 -1
- package/dist/components/series-legend.cjs +1 -1
- package/dist/components/series-legend.cjs.map +1 -1
- package/dist/components/series-legend.js +1 -1
- package/dist/components/series-legend.js.map +1 -1
- package/dist/components/slider.cjs +6 -19
- package/dist/components/slider.cjs.map +1 -1
- package/dist/components/slider.d.cts +0 -13
- package/dist/components/slider.d.ts +0 -13
- package/dist/components/slider.js +6 -19
- package/dist/components/slider.js.map +1 -1
- package/dist/components/solar-forecast-chart.cjs +4 -3
- package/dist/components/solar-forecast-chart.cjs.map +1 -1
- package/dist/components/solar-forecast-chart.d.cts +4 -1
- package/dist/components/solar-forecast-chart.d.ts +4 -1
- package/dist/components/solar-forecast-chart.js +4 -3
- package/dist/components/solar-forecast-chart.js.map +1 -1
- package/dist/components/stepper.cjs +2 -2
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.js +2 -2
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +8 -3
- package/dist/components/switch.cjs.map +1 -1
- package/dist/components/switch.d.cts +9 -4
- package/dist/components/switch.d.ts +9 -4
- package/dist/components/switch.js +8 -3
- package/dist/components/switch.js.map +1 -1
- package/dist/components/tabs.cjs +4 -4
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.js +4 -4
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/theme.cjs +1 -1
- package/dist/components/theme.d.cts +1 -1
- package/dist/components/theme.d.ts +1 -1
- package/dist/components/theme.js +1 -1
- package/dist/components/time-picker.cjs +1 -1
- package/dist/components/time-picker.cjs.map +1 -1
- package/dist/components/time-picker.js +1 -1
- package/dist/components/time-picker.js.map +1 -1
- package/dist/components/tooltip.cjs +1 -1
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/hooks/use-reduced-motion.cjs +22 -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/{input-box-variants-Dr1K7uYE.js → input-box-variants-DcajYXvo.js} +1 -1
- package/dist/{input-box-variants-Dr1K7uYE.js.map → input-box-variants-DcajYXvo.js.map} +1 -1
- package/dist/{input-box-variants-BMDdwvqg.cjs → input-box-variants-ZCtgs-1S.cjs} +1 -1
- package/dist/{input-box-variants-BMDdwvqg.cjs.map → input-box-variants-ZCtgs-1S.cjs.map} +1 -1
- package/dist/{number-flow-DSbucQ_K.d.ts → number-flow-D9zsxH0-.d.ts} +1 -1
- package/dist/styles/index.css +39 -0
- package/dist/styles/spark-default.css +123 -40
- package/dist/styles/theme.css +78 -0
- package/dist/{theme-B3WtiByA.js → theme-8PDO9E0S.js} +2 -2
- package/dist/theme-8PDO9E0S.js.map +1 -0
- package/dist/{theme-C9_OSe0S.cjs → theme-ClRJhexF.cjs} +2 -2
- package/dist/theme-ClRJhexF.cjs.map +1 -0
- package/dist/{theme-types-DoROIXpi.d.ts → theme-types-BDdoRxXa.d.ts} +2 -3
- package/dist/{theme-types-r20EJfEC.d.cts → theme-types-BwSJKdsB.d.cts} +2 -3
- package/dist/{tones-DyCkL71h.d.ts → tones-PXJGlSpe.d.ts} +1 -1
- package/dist/utils/build-sankey-nodes.cjs +16 -3
- package/dist/utils/build-sankey-nodes.cjs.map +1 -1
- package/dist/utils/build-sankey-nodes.js +16 -3
- package/dist/utils/build-sankey-nodes.js.map +1 -1
- package/dist/utils/chart-scale.cjs +43 -0
- package/dist/utils/chart-scale.cjs.map +1 -0
- package/dist/utils/chart-scale.d.cts +22 -0
- package/dist/utils/chart-scale.d.ts +22 -0
- package/dist/utils/chart-scale.js +41 -0
- package/dist/utils/chart-scale.js.map +1 -0
- package/package.json +1 -1
- package/dist/theme-B3WtiByA.js.map +0 -1
- package/dist/theme-C9_OSe0S.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"donut-chart.cjs","names":[],"sources":["../../src/components/donut-chart.tsx"],"sourcesContent":["interface DonutSegment {\n value: number\n color: string\n}\n\ninterface DonutChartProps {\n segments: DonutSegment[]\n centerLabel: string\n centerSub: string\n}\n\nconst RADIUS = 66\nconst STROKE = 14\nconst SIZE = 180\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nexport function DonutChart({\n centerLabel,\n centerSub,\n segments,\n}: DonutChartProps) {\n const total = segments.reduce((sum, seg) => sum + seg.value, 0)\n\n let offset = 0\n const arcs = segments.map((seg) => {\n const dash = total > 0 ? (seg.value / total) * CIRCUMFERENCE : 0\n const arc = {\n color: seg.color,\n dash,\n gap: CIRCUMFERENCE - dash,\n offset,\n }\n offset += dash\n return arc\n })\n\n return (\n <svg width={SIZE} height={SIZE} viewBox={`0 0 ${SIZE} ${SIZE}`}>\n <circle\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke=\"var(--
|
|
1
|
+
{"version":3,"file":"donut-chart.cjs","names":[],"sources":["../../src/components/donut-chart.tsx"],"sourcesContent":["interface DonutSegment {\n value: number\n color: string\n}\n\ninterface DonutChartProps {\n segments: DonutSegment[]\n centerLabel: string\n centerSub: string\n}\n\nconst RADIUS = 66\nconst STROKE = 14\nconst SIZE = 180\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nexport function DonutChart({\n centerLabel,\n centerSub,\n segments,\n}: DonutChartProps) {\n const total = segments.reduce((sum, seg) => sum + seg.value, 0)\n\n let offset = 0\n const arcs = segments.map((seg) => {\n const dash = total > 0 ? (seg.value / total) * CIRCUMFERENCE : 0\n const arc = {\n color: seg.color,\n dash,\n gap: CIRCUMFERENCE - dash,\n offset,\n }\n offset += dash\n return arc\n })\n\n return (\n <svg width={SIZE} height={SIZE} viewBox={`0 0 ${SIZE} ${SIZE}`}>\n <circle\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke=\"var(--neutral-a3)\"\n strokeWidth={STROKE}\n />\n {arcs.map((arc, i) => (\n <circle\n key={i}\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke={arc.color}\n strokeWidth={STROKE}\n strokeDasharray={`${arc.dash} ${arc.gap}`}\n strokeDashoffset={CIRCUMFERENCE / 4 - arc.offset}\n strokeLinecap=\"butt\"\n />\n ))}\n <text\n x={SIZE / 2}\n y={SIZE / 2 - 5}\n textAnchor=\"middle\"\n fontSize={20}\n fontWeight={700}\n fill=\"var(--neutral-12)\"\n >\n {centerLabel}\n </text>\n <text\n x={SIZE / 2}\n y={SIZE / 2 + 14}\n textAnchor=\"middle\"\n fontSize={12}\n fill=\"var(--neutral-a11)\"\n >\n {centerSub}\n </text>\n </svg>\n )\n}\n"],"mappings":";;;;;AAWA,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,OAAO;AACb,MAAM,gBAAgB,IAAI,KAAK,KAAK;AAEpC,SAAgB,WAAW,EACzB,aACA,WACA,YACkB;CAClB,MAAM,QAAQ,SAAS,QAAQ,KAAK,QAAQ,MAAM,IAAI,OAAO,EAAE;CAE/D,IAAI,SAAS;CACb,MAAM,OAAO,SAAS,KAAK,QAAQ;EACjC,MAAM,OAAO,QAAQ,IAAK,IAAI,QAAQ,QAAS,gBAAgB;EAC/D,MAAM,MAAM;GACV,OAAO,IAAI;GACX;GACA,KAAK,gBAAgB;GACrB;GACD;AACD,YAAU;AACV,SAAO;GACP;AAEF,QACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,OAAO;EAAM,QAAQ;EAAM,SAAS,OAAO,KAAK,GAAG;YAAxD;GACE,iBAAA,GAAA,kBAAA,KAAC,UAAD;IACE,IAAI,OAAO;IACX,IAAI,OAAO;IACX,GAAG;IACH,MAAK;IACL,QAAO;IACP,aAAa;IACb,CAAA;GACD,KAAK,KAAK,KAAK,MACd,iBAAA,GAAA,kBAAA,KAAC,UAAD;IAEE,IAAI,OAAO;IACX,IAAI,OAAO;IACX,GAAG;IACH,MAAK;IACL,QAAQ,IAAI;IACZ,aAAa;IACb,iBAAiB,GAAG,IAAI,KAAK,GAAG,IAAI;IACpC,kBAAkB,gBAAgB,IAAI,IAAI;IAC1C,eAAc;IACd,EAVK,EAUL,CACF;GACF,iBAAA,GAAA,kBAAA,KAAC,QAAD;IACE,GAAG,OAAO;IACV,GAAG,OAAO,IAAI;IACd,YAAW;IACX,UAAU;IACV,YAAY;IACZ,MAAK;cAEJ;IACI,CAAA;GACP,iBAAA,GAAA,kBAAA,KAAC,QAAD;IACE,GAAG,OAAO;IACV,GAAG,OAAO,IAAI;IACd,YAAW;IACX,UAAU;IACV,MAAK;cAEJ;IACI,CAAA;GACH"}
|
|
@@ -29,7 +29,7 @@ function DonutChart({ centerLabel, centerSub, segments }) {
|
|
|
29
29
|
cy: SIZE / 2,
|
|
30
30
|
r: RADIUS,
|
|
31
31
|
fill: "none",
|
|
32
|
-
stroke: "var(--
|
|
32
|
+
stroke: "var(--neutral-a3)",
|
|
33
33
|
strokeWidth: STROKE
|
|
34
34
|
}),
|
|
35
35
|
arcs.map((arc, i) => /* @__PURE__ */ jsx("circle", {
|
|
@@ -49,7 +49,7 @@ function DonutChart({ centerLabel, centerSub, segments }) {
|
|
|
49
49
|
textAnchor: "middle",
|
|
50
50
|
fontSize: 20,
|
|
51
51
|
fontWeight: 700,
|
|
52
|
-
fill: "var(--
|
|
52
|
+
fill: "var(--neutral-12)",
|
|
53
53
|
children: centerLabel
|
|
54
54
|
}),
|
|
55
55
|
/* @__PURE__ */ jsx("text", {
|
|
@@ -57,7 +57,7 @@ function DonutChart({ centerLabel, centerSub, segments }) {
|
|
|
57
57
|
y: SIZE / 2 + 14,
|
|
58
58
|
textAnchor: "middle",
|
|
59
59
|
fontSize: 12,
|
|
60
|
-
fill: "var(--
|
|
60
|
+
fill: "var(--neutral-a11)",
|
|
61
61
|
children: centerSub
|
|
62
62
|
})
|
|
63
63
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"donut-chart.js","names":[],"sources":["../../src/components/donut-chart.tsx"],"sourcesContent":["interface DonutSegment {\n value: number\n color: string\n}\n\ninterface DonutChartProps {\n segments: DonutSegment[]\n centerLabel: string\n centerSub: string\n}\n\nconst RADIUS = 66\nconst STROKE = 14\nconst SIZE = 180\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nexport function DonutChart({\n centerLabel,\n centerSub,\n segments,\n}: DonutChartProps) {\n const total = segments.reduce((sum, seg) => sum + seg.value, 0)\n\n let offset = 0\n const arcs = segments.map((seg) => {\n const dash = total > 0 ? (seg.value / total) * CIRCUMFERENCE : 0\n const arc = {\n color: seg.color,\n dash,\n gap: CIRCUMFERENCE - dash,\n offset,\n }\n offset += dash\n return arc\n })\n\n return (\n <svg width={SIZE} height={SIZE} viewBox={`0 0 ${SIZE} ${SIZE}`}>\n <circle\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke=\"var(--
|
|
1
|
+
{"version":3,"file":"donut-chart.js","names":[],"sources":["../../src/components/donut-chart.tsx"],"sourcesContent":["interface DonutSegment {\n value: number\n color: string\n}\n\ninterface DonutChartProps {\n segments: DonutSegment[]\n centerLabel: string\n centerSub: string\n}\n\nconst RADIUS = 66\nconst STROKE = 14\nconst SIZE = 180\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nexport function DonutChart({\n centerLabel,\n centerSub,\n segments,\n}: DonutChartProps) {\n const total = segments.reduce((sum, seg) => sum + seg.value, 0)\n\n let offset = 0\n const arcs = segments.map((seg) => {\n const dash = total > 0 ? (seg.value / total) * CIRCUMFERENCE : 0\n const arc = {\n color: seg.color,\n dash,\n gap: CIRCUMFERENCE - dash,\n offset,\n }\n offset += dash\n return arc\n })\n\n return (\n <svg width={SIZE} height={SIZE} viewBox={`0 0 ${SIZE} ${SIZE}`}>\n <circle\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke=\"var(--neutral-a3)\"\n strokeWidth={STROKE}\n />\n {arcs.map((arc, i) => (\n <circle\n key={i}\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke={arc.color}\n strokeWidth={STROKE}\n strokeDasharray={`${arc.dash} ${arc.gap}`}\n strokeDashoffset={CIRCUMFERENCE / 4 - arc.offset}\n strokeLinecap=\"butt\"\n />\n ))}\n <text\n x={SIZE / 2}\n y={SIZE / 2 - 5}\n textAnchor=\"middle\"\n fontSize={20}\n fontWeight={700}\n fill=\"var(--neutral-12)\"\n >\n {centerLabel}\n </text>\n <text\n x={SIZE / 2}\n y={SIZE / 2 + 14}\n textAnchor=\"middle\"\n fontSize={12}\n fill=\"var(--neutral-a11)\"\n >\n {centerSub}\n </text>\n </svg>\n )\n}\n"],"mappings":";;;AAWA,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,OAAO;AACb,MAAM,gBAAgB,IAAI,KAAK,KAAK;AAEpC,SAAgB,WAAW,EACzB,aACA,WACA,YACkB;CAClB,MAAM,QAAQ,SAAS,QAAQ,KAAK,QAAQ,MAAM,IAAI,OAAO,EAAE;CAE/D,IAAI,SAAS;CACb,MAAM,OAAO,SAAS,KAAK,QAAQ;EACjC,MAAM,OAAO,QAAQ,IAAK,IAAI,QAAQ,QAAS,gBAAgB;EAC/D,MAAM,MAAM;GACV,OAAO,IAAI;GACX;GACA,KAAK,gBAAgB;GACrB;GACD;AACD,YAAU;AACV,SAAO;GACP;AAEF,QACE,qBAAC,OAAD;EAAK,OAAO;EAAM,QAAQ;EAAM,SAAS,OAAO,KAAK,GAAG;YAAxD;GACE,oBAAC,UAAD;IACE,IAAI,OAAO;IACX,IAAI,OAAO;IACX,GAAG;IACH,MAAK;IACL,QAAO;IACP,aAAa;IACb,CAAA;GACD,KAAK,KAAK,KAAK,MACd,oBAAC,UAAD;IAEE,IAAI,OAAO;IACX,IAAI,OAAO;IACX,GAAG;IACH,MAAK;IACL,QAAQ,IAAI;IACZ,aAAa;IACb,iBAAiB,GAAG,IAAI,KAAK,GAAG,IAAI;IACpC,kBAAkB,gBAAgB,IAAI,IAAI;IAC1C,eAAc;IACd,EAVK,EAUL,CACF;GACF,oBAAC,QAAD;IACE,GAAG,OAAO;IACV,GAAG,OAAO,IAAI;IACd,YAAW;IACX,UAAU;IACV,YAAY;IACZ,MAAK;cAEJ;IACI,CAAA;GACP,oBAAC,QAAD;IACE,GAAG,OAAO;IACV,GAAG,OAAO,IAAI;IACd,YAAW;IACX,UAAU;IACV,MAAK;cAEJ;IACI,CAAA;GACH"}
|
|
@@ -9,8 +9,9 @@ function EnergyBarChart({ totalSuffix, totalFormat, className, ...rest }) {
|
|
|
9
9
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_bar_chart.BarChart, {
|
|
10
10
|
...rest,
|
|
11
11
|
className,
|
|
12
|
-
renderTotal: (value) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_number_flow, {
|
|
12
|
+
renderTotal: (value, animated) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_number_flow, {
|
|
13
13
|
value,
|
|
14
|
+
animated,
|
|
14
15
|
...totalSuffix !== void 0 && { suffix: totalSuffix },
|
|
15
16
|
...totalFormat !== void 0 && { format: totalFormat },
|
|
16
17
|
className: "text-base font-bold text-gray tabular-nums"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy-bar-chart.cjs","names":["BarChart","NumberFlow"],"sources":["../../src/components/energy-bar-chart.tsx"],"sourcesContent":["import {\n BarChart,\n type BarChartCategory,\n type BarChartLineSeries,\n type BarChartSeries,\n} from './bar-chart'\nimport NumberFlow, { type Format } from './number-flow'\n\nexport type Category = BarChartCategory\n\nexport interface HourBucket {\n hour: number\n solar: number\n battery: number\n grid: number\n}\n\nexport type EnergyBarSeries<TDatum = HourBucket> = BarChartSeries<TDatum>\nexport type EnergyBarLineSeries<TDatum = HourBucket> =\n BarChartLineSeries<TDatum>\n\ninterface EnergyBarChartProps<TDatum> {\n data: TDatum[]\n series: BarChartSeries<TDatum>[]\n lines?: BarChartLineSeries<TDatum>[]\n getCategory: (datum: TDatum) => Category\n categories?: Category[]\n categoryTicks?: Category[]\n formatCategory?: (category: Category) => string\n formatTooltipCategory?: (category: Category) => string\n highlightedCategory?: Category\n showHighlightLine?: boolean\n title?: string\n yAxisUnit?: string\n formatValue?: (value: number) => string\n totalSuffix?: string\n totalFormat?: Format\n height?: number\n className?: string\n}\n\nexport function EnergyBarChart<TDatum>({\n totalSuffix,\n totalFormat,\n className,\n ...rest\n}: EnergyBarChartProps<TDatum>): React.ReactElement {\n return (\n <BarChart<TDatum>\n {...rest}\n className={className}\n renderTotal={(value) => (\n <NumberFlow\n value={value}\n {...(totalSuffix !== undefined && { suffix: totalSuffix })}\n {...(totalFormat !== undefined && { format: totalFormat })}\n className=\"text-base font-bold text-gray tabular-nums\"\n />\n )}\n />\n )\n}\n"],"mappings":";;;;;;;AAyCA,SAAgB,eAAuB,EACrC,aACA,aACA,WACA,GAAG,QAC+C;AAClD,QACE,iBAAA,GAAA,kBAAA,KAACA,6BAAAA,UAAD;EACE,GAAI;EACO;EACX,cAAc,
|
|
1
|
+
{"version":3,"file":"energy-bar-chart.cjs","names":["BarChart","NumberFlow"],"sources":["../../src/components/energy-bar-chart.tsx"],"sourcesContent":["import {\n BarChart,\n type BarChartCategory,\n type BarChartLineSeries,\n type BarChartSeries,\n} from './bar-chart'\nimport NumberFlow, { type Format } from './number-flow'\n\nexport type Category = BarChartCategory\n\nexport interface HourBucket {\n hour: number\n solar: number\n battery: number\n grid: number\n}\n\nexport type EnergyBarSeries<TDatum = HourBucket> = BarChartSeries<TDatum>\nexport type EnergyBarLineSeries<TDatum = HourBucket> =\n BarChartLineSeries<TDatum>\n\ninterface EnergyBarChartProps<TDatum> {\n data: TDatum[]\n series: BarChartSeries<TDatum>[]\n lines?: BarChartLineSeries<TDatum>[]\n getCategory: (datum: TDatum) => Category\n categories?: Category[]\n categoryTicks?: Category[]\n formatCategory?: (category: Category) => string\n formatTooltipCategory?: (category: Category) => string\n highlightedCategory?: Category\n showHighlightLine?: boolean\n title?: string\n yAxisUnit?: string\n formatValue?: (value: number) => string\n totalSuffix?: string\n totalFormat?: Format\n height?: number\n className?: string\n}\n\nexport function EnergyBarChart<TDatum>({\n totalSuffix,\n totalFormat,\n className,\n ...rest\n}: EnergyBarChartProps<TDatum>): React.ReactElement {\n return (\n <BarChart<TDatum>\n {...rest}\n className={className}\n renderTotal={(value, animated) => (\n <NumberFlow\n value={value}\n animated={animated}\n {...(totalSuffix !== undefined && { suffix: totalSuffix })}\n {...(totalFormat !== undefined && { format: totalFormat })}\n className=\"text-base font-bold text-gray tabular-nums\"\n />\n )}\n />\n )\n}\n"],"mappings":";;;;;;;AAyCA,SAAgB,eAAuB,EACrC,aACA,aACA,WACA,GAAG,QAC+C;AAClD,QACE,iBAAA,GAAA,kBAAA,KAACA,6BAAAA,UAAD;EACE,GAAI;EACO;EACX,cAAc,OAAO,aACnB,iBAAA,GAAA,kBAAA,KAACC,gCAAD;GACS;GACG;GACV,GAAK,gBAAgB,KAAA,KAAa,EAAE,QAAQ,aAAa;GACzD,GAAK,gBAAgB,KAAA,KAAa,EAAE,QAAQ,aAAa;GACzD,WAAU;GACV,CAAA;EAEJ,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { BarChartCategory, BarChartLineSeries, BarChartSeries } from "./bar-chart.js";
|
|
4
|
-
import { t as Format } from "../number-flow-
|
|
4
|
+
import { t as Format } from "../number-flow-D9zsxH0-.js";
|
|
5
5
|
|
|
6
6
|
//#region src/components/energy-bar-chart.d.ts
|
|
7
7
|
type Category = BarChartCategory;
|
|
@@ -7,8 +7,9 @@ function EnergyBarChart({ totalSuffix, totalFormat, className, ...rest }) {
|
|
|
7
7
|
return /* @__PURE__ */ jsx(BarChart, {
|
|
8
8
|
...rest,
|
|
9
9
|
className,
|
|
10
|
-
renderTotal: (value) => /* @__PURE__ */ jsx(NumberFlow, {
|
|
10
|
+
renderTotal: (value, animated) => /* @__PURE__ */ jsx(NumberFlow, {
|
|
11
11
|
value,
|
|
12
|
+
animated,
|
|
12
13
|
...totalSuffix !== void 0 && { suffix: totalSuffix },
|
|
13
14
|
...totalFormat !== void 0 && { format: totalFormat },
|
|
14
15
|
className: "text-base font-bold text-gray tabular-nums"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy-bar-chart.js","names":[],"sources":["../../src/components/energy-bar-chart.tsx"],"sourcesContent":["import {\n BarChart,\n type BarChartCategory,\n type BarChartLineSeries,\n type BarChartSeries,\n} from './bar-chart'\nimport NumberFlow, { type Format } from './number-flow'\n\nexport type Category = BarChartCategory\n\nexport interface HourBucket {\n hour: number\n solar: number\n battery: number\n grid: number\n}\n\nexport type EnergyBarSeries<TDatum = HourBucket> = BarChartSeries<TDatum>\nexport type EnergyBarLineSeries<TDatum = HourBucket> =\n BarChartLineSeries<TDatum>\n\ninterface EnergyBarChartProps<TDatum> {\n data: TDatum[]\n series: BarChartSeries<TDatum>[]\n lines?: BarChartLineSeries<TDatum>[]\n getCategory: (datum: TDatum) => Category\n categories?: Category[]\n categoryTicks?: Category[]\n formatCategory?: (category: Category) => string\n formatTooltipCategory?: (category: Category) => string\n highlightedCategory?: Category\n showHighlightLine?: boolean\n title?: string\n yAxisUnit?: string\n formatValue?: (value: number) => string\n totalSuffix?: string\n totalFormat?: Format\n height?: number\n className?: string\n}\n\nexport function EnergyBarChart<TDatum>({\n totalSuffix,\n totalFormat,\n className,\n ...rest\n}: EnergyBarChartProps<TDatum>): React.ReactElement {\n return (\n <BarChart<TDatum>\n {...rest}\n className={className}\n renderTotal={(value) => (\n <NumberFlow\n value={value}\n {...(totalSuffix !== undefined && { suffix: totalSuffix })}\n {...(totalFormat !== undefined && { format: totalFormat })}\n className=\"text-base font-bold text-gray tabular-nums\"\n />\n )}\n />\n )\n}\n"],"mappings":";;;;;AAyCA,SAAgB,eAAuB,EACrC,aACA,aACA,WACA,GAAG,QAC+C;AAClD,QACE,oBAAC,UAAD;EACE,GAAI;EACO;EACX,cAAc,
|
|
1
|
+
{"version":3,"file":"energy-bar-chart.js","names":[],"sources":["../../src/components/energy-bar-chart.tsx"],"sourcesContent":["import {\n BarChart,\n type BarChartCategory,\n type BarChartLineSeries,\n type BarChartSeries,\n} from './bar-chart'\nimport NumberFlow, { type Format } from './number-flow'\n\nexport type Category = BarChartCategory\n\nexport interface HourBucket {\n hour: number\n solar: number\n battery: number\n grid: number\n}\n\nexport type EnergyBarSeries<TDatum = HourBucket> = BarChartSeries<TDatum>\nexport type EnergyBarLineSeries<TDatum = HourBucket> =\n BarChartLineSeries<TDatum>\n\ninterface EnergyBarChartProps<TDatum> {\n data: TDatum[]\n series: BarChartSeries<TDatum>[]\n lines?: BarChartLineSeries<TDatum>[]\n getCategory: (datum: TDatum) => Category\n categories?: Category[]\n categoryTicks?: Category[]\n formatCategory?: (category: Category) => string\n formatTooltipCategory?: (category: Category) => string\n highlightedCategory?: Category\n showHighlightLine?: boolean\n title?: string\n yAxisUnit?: string\n formatValue?: (value: number) => string\n totalSuffix?: string\n totalFormat?: Format\n height?: number\n className?: string\n}\n\nexport function EnergyBarChart<TDatum>({\n totalSuffix,\n totalFormat,\n className,\n ...rest\n}: EnergyBarChartProps<TDatum>): React.ReactElement {\n return (\n <BarChart<TDatum>\n {...rest}\n className={className}\n renderTotal={(value, animated) => (\n <NumberFlow\n value={value}\n animated={animated}\n {...(totalSuffix !== undefined && { suffix: totalSuffix })}\n {...(totalFormat !== undefined && { format: totalFormat })}\n className=\"text-base font-bold text-gray tabular-nums\"\n />\n )}\n />\n )\n}\n"],"mappings":";;;;;AAyCA,SAAgB,eAAuB,EACrC,aACA,aACA,WACA,GAAG,QAC+C;AAClD,QACE,oBAAC,UAAD;EACE,GAAI;EACO;EACX,cAAc,OAAO,aACnB,oBAAC,YAAD;GACS;GACG;GACV,GAAK,gBAAgB,KAAA,KAAa,EAAE,QAAQ,aAAa;GACzD,GAAK,gBAAgB,KAAA,KAAa,EAAE,QAAQ,aAAa;GACzD,WAAU;GACV,CAAA;EAEJ,CAAA"}
|
|
@@ -60,7 +60,7 @@ function EnergyBreakdown({ title, subtitle, items, centerSub = "kWh" }) {
|
|
|
60
60
|
})]
|
|
61
61
|
})]
|
|
62
62
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
63
|
-
className: "h-1 w-full overflow-hidden rounded-full bg-
|
|
63
|
+
className: "h-1 w-full overflow-hidden rounded-full bg-gray-a4",
|
|
64
64
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
65
65
|
className: "h-full rounded-full",
|
|
66
66
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy-breakdown.cjs","names":["formatThousands","integerFormat","oneDecimalFormat","twoDecimalFormat","DonutChart","formatEnergy"],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => [...items].sort((a, b) => b.value - a.value),\n [items],\n )\n\n const total = items.reduce((s, i) => s + i.value, 0)\n const centerTotal = items\n .filter((i) => !i.excludeFromCenterTotal)\n .reduce((s, i) => s + i.value, 0)\n\n const dataEmpty = total === 0\n\n if (dataEmpty) return null\n\n return (\n <div className=\"flex flex-col gap-4 pt-3 pb-5\">\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-sm font-semibold text-gray\">{title}</span>\n <span className=\"text-xs text-gray-light\">{subtitle}</span>\n </div>\n\n <div className=\"flex items-center gap-6\">\n <DonutChart\n centerLabel={formatBreakdownCenter(centerTotal)}\n centerSub={centerSub}\n segments={sortedItems.map(({ value, color }) => ({ value, color }))}\n />\n\n <div className=\"flex flex-1 flex-col gap-3\">\n {sortedItems.map(({ label, value, color }) => {\n const pct = (value / total) * 100\n return (\n <div key={label} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <span className=\"min-w-0 truncate text-sm font-medium text-gray\">\n {label}\n </span>\n <span className=\"flex shrink-0 items-baseline gap-1.5 text-xs tabular-nums\">\n <span className=\"text-gray-light\">\n {formatEnergy(value)}\n </span>\n <span className=\"font-semibold text-gray\">\n {`${integerFormat.format(pct)}${NARROW_NBSP}%`}\n </span>\n </span>\n </div>\n <div className=\"h-1 w-full overflow-hidden rounded-full bg-
|
|
1
|
+
{"version":3,"file":"energy-breakdown.cjs","names":["formatThousands","integerFormat","oneDecimalFormat","twoDecimalFormat","DonutChart","formatEnergy"],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => [...items].sort((a, b) => b.value - a.value),\n [items],\n )\n\n const total = items.reduce((s, i) => s + i.value, 0)\n const centerTotal = items\n .filter((i) => !i.excludeFromCenterTotal)\n .reduce((s, i) => s + i.value, 0)\n\n const dataEmpty = total === 0\n\n if (dataEmpty) return null\n\n return (\n <div className=\"flex flex-col gap-4 pt-3 pb-5\">\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-sm font-semibold text-gray\">{title}</span>\n <span className=\"text-xs text-gray-light\">{subtitle}</span>\n </div>\n\n <div className=\"flex items-center gap-6\">\n <DonutChart\n centerLabel={formatBreakdownCenter(centerTotal)}\n centerSub={centerSub}\n segments={sortedItems.map(({ value, color }) => ({ value, color }))}\n />\n\n <div className=\"flex flex-1 flex-col gap-3\">\n {sortedItems.map(({ label, value, color }) => {\n const pct = (value / total) * 100\n return (\n <div key={label} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <span className=\"min-w-0 truncate text-sm font-medium text-gray\">\n {label}\n </span>\n <span className=\"flex shrink-0 items-baseline gap-1.5 text-xs tabular-nums\">\n <span className=\"text-gray-light\">\n {formatEnergy(value)}\n </span>\n <span className=\"font-semibold text-gray\">\n {`${integerFormat.format(pct)}${NARROW_NBSP}%`}\n </span>\n </span>\n </div>\n <div className=\"h-1 w-full overflow-hidden rounded-full bg-gray-a4\">\n <div\n className=\"h-full rounded-full\"\n style={{ width: `${pct}%`, background: color }}\n />\n </div>\n </div>\n )\n })}\n </div>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAyBA,SAAS,sBAAsB,GAAW;AACxC,KAAI,KAAK,IAAM,QAAOA,qBAAAA,gBAAgB,EAAE;AACxC,KAAI,KAAK,IAAK,QAAOC,qBAAAA,cAAc,OAAO,EAAE;AAC5C,KAAI,KAAK,GAAI,QAAOC,qBAAAA,iBAAiB,OAAO,EAAE;AAC9C,QAAOC,qBAAAA,iBAAiB,OAAO,EAAE;;AAGnC,SAAgB,gBAAgB,EAC9B,OACA,UACA,OACA,YAAY,SACW;CACvB,MAAM,eAAA,GAAA,MAAA,eACE,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAClD,CAAC,MAAM,CACR;CAED,MAAM,QAAQ,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,EAAE;CACpD,MAAM,cAAc,MACjB,QAAQ,MAAM,CAAC,EAAE,uBAAuB,CACxC,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,EAAE;AAInC,KAFkB,UAAU,EAEb,QAAO;AAEtB,QACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,WAAU;YAAf,CACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;GAAK,WAAU;aAAf,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,WAAU;cAAmC;IAAa,CAAA,EAChE,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,WAAU;cAA2B;IAAgB,CAAA,CACvD;MAEN,iBAAA,GAAA,kBAAA,MAAC,OAAD;GAAK,WAAU;aAAf,CACE,iBAAA,GAAA,kBAAA,KAACC,+BAAAA,YAAD;IACE,aAAa,sBAAsB,YAAY;IACpC;IACX,UAAU,YAAY,KAAK,EAAE,OAAO,aAAa;KAAE;KAAO;KAAO,EAAE;IACnE,CAAA,EAEF,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,WAAU;cACZ,YAAY,KAAK,EAAE,OAAO,OAAO,YAAY;KAC5C,MAAM,MAAO,QAAQ,QAAS;AAC9B,YACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;MAAiB,WAAU;gBAA3B,CACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;OAAK,WAAU;iBAAf,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;QAAM,WAAU;kBACb;QACI,CAAA,EACP,iBAAA,GAAA,kBAAA,MAAC,QAAD;QAAM,WAAU;kBAAhB,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;SAAM,WAAU;mBACbC,qBAAAA,aAAa,MAAM;SACf,CAAA,EACP,iBAAA,GAAA,kBAAA,KAAC,QAAD;SAAM,WAAU;mBACb,GAAGJ,qBAAAA,cAAc,OAAO,IAAI;SACxB,CAAA,CACF;UACH;UACN,iBAAA,GAAA,kBAAA,KAAC,OAAD;OAAK,WAAU;iBACb,iBAAA,GAAA,kBAAA,KAAC,OAAD;QACE,WAAU;QACV,OAAO;SAAE,OAAO,GAAG,IAAI;SAAI,YAAY;SAAO;QAC9C,CAAA;OACE,CAAA,CACF;QApBI,MAoBJ;MAER;IACE,CAAA,CACF;KACF"}
|
|
@@ -58,7 +58,7 @@ function EnergyBreakdown({ title, subtitle, items, centerSub = "kWh" }) {
|
|
|
58
58
|
})]
|
|
59
59
|
})]
|
|
60
60
|
}), /* @__PURE__ */ jsx("div", {
|
|
61
|
-
className: "h-1 w-full overflow-hidden rounded-full bg-
|
|
61
|
+
className: "h-1 w-full overflow-hidden rounded-full bg-gray-a4",
|
|
62
62
|
children: /* @__PURE__ */ jsx("div", {
|
|
63
63
|
className: "h-full rounded-full",
|
|
64
64
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy-breakdown.js","names":[],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => [...items].sort((a, b) => b.value - a.value),\n [items],\n )\n\n const total = items.reduce((s, i) => s + i.value, 0)\n const centerTotal = items\n .filter((i) => !i.excludeFromCenterTotal)\n .reduce((s, i) => s + i.value, 0)\n\n const dataEmpty = total === 0\n\n if (dataEmpty) return null\n\n return (\n <div className=\"flex flex-col gap-4 pt-3 pb-5\">\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-sm font-semibold text-gray\">{title}</span>\n <span className=\"text-xs text-gray-light\">{subtitle}</span>\n </div>\n\n <div className=\"flex items-center gap-6\">\n <DonutChart\n centerLabel={formatBreakdownCenter(centerTotal)}\n centerSub={centerSub}\n segments={sortedItems.map(({ value, color }) => ({ value, color }))}\n />\n\n <div className=\"flex flex-1 flex-col gap-3\">\n {sortedItems.map(({ label, value, color }) => {\n const pct = (value / total) * 100\n return (\n <div key={label} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <span className=\"min-w-0 truncate text-sm font-medium text-gray\">\n {label}\n </span>\n <span className=\"flex shrink-0 items-baseline gap-1.5 text-xs tabular-nums\">\n <span className=\"text-gray-light\">\n {formatEnergy(value)}\n </span>\n <span className=\"font-semibold text-gray\">\n {`${integerFormat.format(pct)}${NARROW_NBSP}%`}\n </span>\n </span>\n </div>\n <div className=\"h-1 w-full overflow-hidden rounded-full bg-
|
|
1
|
+
{"version":3,"file":"energy-breakdown.js","names":[],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => [...items].sort((a, b) => b.value - a.value),\n [items],\n )\n\n const total = items.reduce((s, i) => s + i.value, 0)\n const centerTotal = items\n .filter((i) => !i.excludeFromCenterTotal)\n .reduce((s, i) => s + i.value, 0)\n\n const dataEmpty = total === 0\n\n if (dataEmpty) return null\n\n return (\n <div className=\"flex flex-col gap-4 pt-3 pb-5\">\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-sm font-semibold text-gray\">{title}</span>\n <span className=\"text-xs text-gray-light\">{subtitle}</span>\n </div>\n\n <div className=\"flex items-center gap-6\">\n <DonutChart\n centerLabel={formatBreakdownCenter(centerTotal)}\n centerSub={centerSub}\n segments={sortedItems.map(({ value, color }) => ({ value, color }))}\n />\n\n <div className=\"flex flex-1 flex-col gap-3\">\n {sortedItems.map(({ label, value, color }) => {\n const pct = (value / total) * 100\n return (\n <div key={label} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <span className=\"min-w-0 truncate text-sm font-medium text-gray\">\n {label}\n </span>\n <span className=\"flex shrink-0 items-baseline gap-1.5 text-xs tabular-nums\">\n <span className=\"text-gray-light\">\n {formatEnergy(value)}\n </span>\n <span className=\"font-semibold text-gray\">\n {`${integerFormat.format(pct)}${NARROW_NBSP}%`}\n </span>\n </span>\n </div>\n <div className=\"h-1 w-full overflow-hidden rounded-full bg-gray-a4\">\n <div\n className=\"h-full rounded-full\"\n style={{ width: `${pct}%`, background: color }}\n />\n </div>\n </div>\n )\n })}\n </div>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;AAyBA,SAAS,sBAAsB,GAAW;AACxC,KAAI,KAAK,IAAM,QAAO,gBAAgB,EAAE;AACxC,KAAI,KAAK,IAAK,QAAO,cAAc,OAAO,EAAE;AAC5C,KAAI,KAAK,GAAI,QAAO,iBAAiB,OAAO,EAAE;AAC9C,QAAO,iBAAiB,OAAO,EAAE;;AAGnC,SAAgB,gBAAgB,EAC9B,OACA,UACA,OACA,YAAY,SACW;CACvB,MAAM,cAAc,cACZ,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAClD,CAAC,MAAM,CACR;CAED,MAAM,QAAQ,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,EAAE;CACpD,MAAM,cAAc,MACjB,QAAQ,MAAM,CAAC,EAAE,uBAAuB,CACxC,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,EAAE;AAInC,KAFkB,UAAU,EAEb,QAAO;AAEtB,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,QAAD;IAAM,WAAU;cAAmC;IAAa,CAAA,EAChE,oBAAC,QAAD;IAAM,WAAU;cAA2B;IAAgB,CAAA,CACvD;MAEN,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,YAAD;IACE,aAAa,sBAAsB,YAAY;IACpC;IACX,UAAU,YAAY,KAAK,EAAE,OAAO,aAAa;KAAE;KAAO;KAAO,EAAE;IACnE,CAAA,EAEF,oBAAC,OAAD;IAAK,WAAU;cACZ,YAAY,KAAK,EAAE,OAAO,OAAO,YAAY;KAC5C,MAAM,MAAO,QAAQ,QAAS;AAC9B,YACE,qBAAC,OAAD;MAAiB,WAAU;gBAA3B,CACE,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,oBAAC,QAAD;QAAM,WAAU;kBACb;QACI,CAAA,EACP,qBAAC,QAAD;QAAM,WAAU;kBAAhB,CACE,oBAAC,QAAD;SAAM,WAAU;mBACb,aAAa,MAAM;SACf,CAAA,EACP,oBAAC,QAAD;SAAM,WAAU;mBACb,GAAG,cAAc,OAAO,IAAI;SACxB,CAAA,CACF;UACH;UACN,oBAAC,OAAD;OAAK,WAAU;iBACb,oBAAC,OAAD;QACE,WAAU;QACV,OAAO;SAAE,OAAO,GAAG,IAAI;SAAI,YAAY;SAAO;QAC9C,CAAA;OACE,CAAA,CACF;QApBI,MAoBJ;MAER;IACE,CAAA,CACF;KACF"}
|
|
@@ -9,24 +9,26 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
9
9
|
/**
|
|
10
10
|
* Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid
|
|
11
11
|
* (blue) energy sources stacked per bucket, the total height being the energy
|
|
12
|
-
* consumed.
|
|
12
|
+
* consumed. Grid feed-in (translucent blue) dips below the baseline as an
|
|
13
|
+
* export. For cumulative energy (week/month/year views). Thin wrapper over the
|
|
13
14
|
* shared visx `BarChart`, so it inherits the card tooltip and both indicators.
|
|
14
15
|
*/
|
|
15
|
-
function EnergyHistoryChart({ data, unit, formatValue, formatBucketLabel, labels, highlightedBucket, showHighlightLine, title, className, height = 260, categoryTicks }) {
|
|
16
|
+
function EnergyHistoryChart({ data, unit, formatValue, formatBucketLabel, labels, omitSeries, highlightedBucket, showHighlightLine, title, className, height = 260, categoryTicks }) {
|
|
16
17
|
const fmtValue = (value) => formatValue ? formatValue(value) : `${require_utils_format.twoDecimalFormat.format(value)} ${unit}`;
|
|
18
|
+
const omitted = new Set(omitSeries);
|
|
17
19
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_energy_bar_chart.EnergyBarChart, {
|
|
18
20
|
data,
|
|
19
21
|
series: [
|
|
20
22
|
{
|
|
21
23
|
key: "solar",
|
|
22
24
|
label: labels.solar,
|
|
23
|
-
color: "var(--orange-
|
|
25
|
+
color: "var(--orange-9)",
|
|
24
26
|
getValue: (d) => d.solar
|
|
25
27
|
},
|
|
26
28
|
{
|
|
27
29
|
key: "battery",
|
|
28
30
|
label: labels.battery,
|
|
29
|
-
color: "var(--green-
|
|
31
|
+
color: "var(--green-9)",
|
|
30
32
|
getValue: (d) => d.battery
|
|
31
33
|
},
|
|
32
34
|
{
|
|
@@ -34,8 +36,14 @@ function EnergyHistoryChart({ data, unit, formatValue, formatBucketLabel, labels
|
|
|
34
36
|
label: labels.grid,
|
|
35
37
|
color: "var(--blue-9)",
|
|
36
38
|
getValue: (d) => d.grid
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
+
},
|
|
40
|
+
...labels.gridFeedIn !== void 0 ? [{
|
|
41
|
+
key: "gridFeedIn",
|
|
42
|
+
label: labels.gridFeedIn,
|
|
43
|
+
color: "var(--blue-7)",
|
|
44
|
+
getValue: (d) => -Math.max(0, d.gridFeedIn ?? 0)
|
|
45
|
+
}] : []
|
|
46
|
+
].filter((s) => !omitted.has(s.key)),
|
|
39
47
|
getCategory: (d) => d.bucket,
|
|
40
48
|
title,
|
|
41
49
|
yAxisUnit: unit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy-history-chart.cjs","names":["valueFormat","EnergyBarChart"],"sources":["../../src/components/energy-history-chart.tsx"],"sourcesContent":["import { NARROW_NBSP } from '../utils/chars'\nimport { twoDecimalFormat as valueFormat } from '../utils/format'\nimport type { BarChartSeries } from './bar-chart'\nimport { EnergyBarChart } from './energy-bar-chart'\n\nexport interface EnergyHistoryDatum {\n /** Bucket label/id (e.g. weekday, day-of-month, month). */\n bucket: string\n /** Solar used on-site (kWh, ≥ 0). */\n solar: number\n /** Battery discharged (kWh, ≥ 0). */\n battery: number\n /** Grid imported (kWh, ≥ 0). */\n grid: number\n}\n\nexport interface EnergyHistoryChartProps {\n data: EnergyHistoryDatum[]\n /** Axis/tooltip unit, e.g. \"kWh\". */\n unit: string\n formatValue?: (value: number) => string\n /** Formats the hovered bucket in the tooltip header. Defaults to the raw bucket. */\n formatBucketLabel?: (bucket: string) => string\n labels: {\n solar: string\n battery: string\n grid: string\n }\n /** Bucket to mark with the current-period dashed line. */\n highlightedBucket?: string\n showHighlightLine?: boolean\n title?: string\n className?: string\n height?: number\n /** Subset of bucket ids to label on the x-axis. Defaults to all buckets. */\n categoryTicks?: string[]\n}\n\n/**\n * Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid\n * (blue) energy sources stacked per bucket, the total height being the energy\n * consumed. For cumulative energy (week/month/year views). Thin wrapper over the\n * shared visx `BarChart`, so it inherits the card tooltip and both indicators.\n */\nexport function EnergyHistoryChart({\n data,\n unit,\n formatValue,\n formatBucketLabel,\n labels,\n highlightedBucket,\n showHighlightLine,\n title,\n className,\n height = 260,\n categoryTicks,\n}: EnergyHistoryChartProps) {\n const fmtValue = (value: number) =>\n formatValue\n ? formatValue(value)\n : `${valueFormat.format(value)}${NARROW_NBSP}${unit}`\n\n const
|
|
1
|
+
{"version":3,"file":"energy-history-chart.cjs","names":["valueFormat","EnergyBarChart"],"sources":["../../src/components/energy-history-chart.tsx"],"sourcesContent":["import { NARROW_NBSP } from '../utils/chars'\nimport { twoDecimalFormat as valueFormat } from '../utils/format'\nimport type { BarChartSeries } from './bar-chart'\nimport { EnergyBarChart } from './energy-bar-chart'\n\nexport interface EnergyHistoryDatum {\n /** Bucket label/id (e.g. weekday, day-of-month, month). */\n bucket: string\n /** Solar used on-site (kWh, ≥ 0). */\n solar: number\n /** Battery discharged (kWh, ≥ 0). */\n battery: number\n /** Grid imported (kWh, ≥ 0). */\n grid: number\n /** Grid feed-in (kWh, ≥ 0); drawn below the baseline as an export. */\n gridFeedIn?: number\n}\n\nexport interface EnergyHistoryChartProps {\n data: EnergyHistoryDatum[]\n /** Axis/tooltip unit, e.g. \"kWh\". */\n unit: string\n formatValue?: (value: number) => string\n /** Formats the hovered bucket in the tooltip header. Defaults to the raw bucket. */\n formatBucketLabel?: (bucket: string) => string\n labels: {\n solar: string\n battery: string\n grid: string\n /** Optional; when set, grid feed-in is drawn below the baseline. */\n gridFeedIn?: string\n }\n /** Series to drop entirely (no legend entry, bar segment, or tooltip row). */\n omitSeries?: readonly EnergyHistorySeriesKey[]\n /** Bucket to mark with the current-period dashed line. */\n highlightedBucket?: string\n showHighlightLine?: boolean\n title?: string\n className?: string\n height?: number\n /** Subset of bucket ids to label on the x-axis. Defaults to all buckets. */\n categoryTicks?: string[]\n}\n\nexport type EnergyHistorySeriesKey = 'solar' | 'battery' | 'grid' | 'gridFeedIn'\n\n/**\n * Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid\n * (blue) energy sources stacked per bucket, the total height being the energy\n * consumed. Grid feed-in (translucent blue) dips below the baseline as an\n * export. For cumulative energy (week/month/year views). Thin wrapper over the\n * shared visx `BarChart`, so it inherits the card tooltip and both indicators.\n */\nexport function EnergyHistoryChart({\n data,\n unit,\n formatValue,\n formatBucketLabel,\n labels,\n omitSeries,\n highlightedBucket,\n showHighlightLine,\n title,\n className,\n height = 260,\n categoryTicks,\n}: EnergyHistoryChartProps) {\n const fmtValue = (value: number) =>\n formatValue\n ? formatValue(value)\n : `${valueFormat.format(value)}${NARROW_NBSP}${unit}`\n\n const omitted = new Set<EnergyHistorySeriesKey>(omitSeries)\n const allSeries: BarChartSeries<EnergyHistoryDatum>[] = [\n {\n key: 'solar',\n label: labels.solar,\n color: 'var(--orange-9)',\n getValue: (d) => d.solar,\n },\n {\n key: 'battery',\n label: labels.battery,\n color: 'var(--green-9)',\n getValue: (d) => d.battery,\n },\n {\n key: 'grid',\n label: labels.grid,\n color: 'var(--blue-9)',\n getValue: (d) => d.grid,\n },\n ...(labels.gridFeedIn !== undefined\n ? [\n {\n key: 'gridFeedIn',\n label: labels.gridFeedIn,\n color: 'var(--blue-7)',\n getValue: (d: EnergyHistoryDatum) =>\n -Math.max(0, d.gridFeedIn ?? 0),\n },\n ]\n : []),\n ]\n const series = allSeries.filter(\n (s) => !omitted.has(s.key as EnergyHistorySeriesKey),\n )\n\n return (\n <EnergyBarChart<EnergyHistoryDatum>\n data={data}\n series={series}\n getCategory={(d) => d.bucket}\n title={title}\n yAxisUnit={unit}\n height={height}\n className={className}\n formatValue={fmtValue}\n categoryTicks={categoryTicks}\n {...(formatBucketLabel && {\n formatTooltipCategory: (category: string | number) =>\n formatBucketLabel(String(category)),\n })}\n totalSuffix={unit}\n totalFormat={{ maximumFractionDigits: 2 }}\n {...(highlightedBucket !== undefined && {\n highlightedCategory: highlightedBucket,\n })}\n {...(showHighlightLine !== undefined && { showHighlightLine })}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqDA,SAAgB,mBAAmB,EACjC,MACA,MACA,aACA,mBACA,QACA,YACA,mBACA,mBACA,OACA,WACA,SAAS,KACT,iBAC0B;CAC1B,MAAM,YAAY,UAChB,cACI,YAAY,MAAM,GAClB,GAAGA,qBAAAA,iBAAY,OAAO,MAAM,IAAiB;CAEnD,MAAM,UAAU,IAAI,IAA4B,WAAW;AAoC3D,QACE,iBAAA,GAAA,kBAAA,KAACC,oCAAAA,gBAAD;EACQ;EACN,QAPW;GA9Bb;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;IACpB;GACD;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;IACpB;GACD;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;IACpB;GACD,GAAI,OAAO,eAAe,KAAA,IACtB,CACE;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MACT,CAAC,KAAK,IAAI,GAAG,EAAE,cAAc,EAAE;IAClC,CACF,GACD,EAAE;GAEgB,CAAC,QACtB,MAAM,CAAC,QAAQ,IAAI,EAAE,IAA8B,CAMpC;EACd,cAAc,MAAM,EAAE;EACf;EACP,WAAW;EACH;EACG;EACX,aAAa;EACE;EACf,GAAK,qBAAqB,EACxB,wBAAwB,aACtB,kBAAkB,OAAO,SAAS,CAAC,EACtC;EACD,aAAa;EACb,aAAa,EAAE,uBAAuB,GAAG;EACzC,GAAK,sBAAsB,KAAA,KAAa,EACtC,qBAAqB,mBACtB;EACD,GAAK,sBAAsB,KAAA,KAAa,EAAE,mBAAmB;EAC7D,CAAA"}
|
|
@@ -12,6 +12,8 @@ interface EnergyHistoryDatum {
|
|
|
12
12
|
battery: number;
|
|
13
13
|
/** Grid imported (kWh, ≥ 0). */
|
|
14
14
|
grid: number;
|
|
15
|
+
/** Grid feed-in (kWh, ≥ 0); drawn below the baseline as an export. */
|
|
16
|
+
gridFeedIn?: number;
|
|
15
17
|
}
|
|
16
18
|
interface EnergyHistoryChartProps {
|
|
17
19
|
data: EnergyHistoryDatum[];
|
|
@@ -23,8 +25,11 @@ interface EnergyHistoryChartProps {
|
|
|
23
25
|
labels: {
|
|
24
26
|
solar: string;
|
|
25
27
|
battery: string;
|
|
26
|
-
grid: string;
|
|
28
|
+
grid: string; /** Optional; when set, grid feed-in is drawn below the baseline. */
|
|
29
|
+
gridFeedIn?: string;
|
|
27
30
|
};
|
|
31
|
+
/** Series to drop entirely (no legend entry, bar segment, or tooltip row). */
|
|
32
|
+
omitSeries?: readonly EnergyHistorySeriesKey[];
|
|
28
33
|
/** Bucket to mark with the current-period dashed line. */
|
|
29
34
|
highlightedBucket?: string;
|
|
30
35
|
showHighlightLine?: boolean;
|
|
@@ -34,10 +39,12 @@ interface EnergyHistoryChartProps {
|
|
|
34
39
|
/** Subset of bucket ids to label on the x-axis. Defaults to all buckets. */
|
|
35
40
|
categoryTicks?: string[];
|
|
36
41
|
}
|
|
42
|
+
type EnergyHistorySeriesKey = 'solar' | 'battery' | 'grid' | 'gridFeedIn';
|
|
37
43
|
/**
|
|
38
44
|
* Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid
|
|
39
45
|
* (blue) energy sources stacked per bucket, the total height being the energy
|
|
40
|
-
* consumed.
|
|
46
|
+
* consumed. Grid feed-in (translucent blue) dips below the baseline as an
|
|
47
|
+
* export. For cumulative energy (week/month/year views). Thin wrapper over the
|
|
41
48
|
* shared visx `BarChart`, so it inherits the card tooltip and both indicators.
|
|
42
49
|
*/
|
|
43
50
|
declare function EnergyHistoryChart({
|
|
@@ -46,6 +53,7 @@ declare function EnergyHistoryChart({
|
|
|
46
53
|
formatValue,
|
|
47
54
|
formatBucketLabel,
|
|
48
55
|
labels,
|
|
56
|
+
omitSeries,
|
|
49
57
|
highlightedBucket,
|
|
50
58
|
showHighlightLine,
|
|
51
59
|
title,
|
|
@@ -54,5 +62,5 @@ declare function EnergyHistoryChart({
|
|
|
54
62
|
categoryTicks
|
|
55
63
|
}: EnergyHistoryChartProps): _$react_jsx_runtime0.JSX.Element;
|
|
56
64
|
//#endregion
|
|
57
|
-
export { EnergyHistoryChart, EnergyHistoryChartProps, EnergyHistoryDatum };
|
|
65
|
+
export { EnergyHistoryChart, EnergyHistoryChartProps, EnergyHistoryDatum, EnergyHistorySeriesKey };
|
|
58
66
|
//# sourceMappingURL=energy-history-chart.d.cts.map
|
|
@@ -12,6 +12,8 @@ interface EnergyHistoryDatum {
|
|
|
12
12
|
battery: number;
|
|
13
13
|
/** Grid imported (kWh, ≥ 0). */
|
|
14
14
|
grid: number;
|
|
15
|
+
/** Grid feed-in (kWh, ≥ 0); drawn below the baseline as an export. */
|
|
16
|
+
gridFeedIn?: number;
|
|
15
17
|
}
|
|
16
18
|
interface EnergyHistoryChartProps {
|
|
17
19
|
data: EnergyHistoryDatum[];
|
|
@@ -23,8 +25,11 @@ interface EnergyHistoryChartProps {
|
|
|
23
25
|
labels: {
|
|
24
26
|
solar: string;
|
|
25
27
|
battery: string;
|
|
26
|
-
grid: string;
|
|
28
|
+
grid: string; /** Optional; when set, grid feed-in is drawn below the baseline. */
|
|
29
|
+
gridFeedIn?: string;
|
|
27
30
|
};
|
|
31
|
+
/** Series to drop entirely (no legend entry, bar segment, or tooltip row). */
|
|
32
|
+
omitSeries?: readonly EnergyHistorySeriesKey[];
|
|
28
33
|
/** Bucket to mark with the current-period dashed line. */
|
|
29
34
|
highlightedBucket?: string;
|
|
30
35
|
showHighlightLine?: boolean;
|
|
@@ -34,10 +39,12 @@ interface EnergyHistoryChartProps {
|
|
|
34
39
|
/** Subset of bucket ids to label on the x-axis. Defaults to all buckets. */
|
|
35
40
|
categoryTicks?: string[];
|
|
36
41
|
}
|
|
42
|
+
type EnergyHistorySeriesKey = 'solar' | 'battery' | 'grid' | 'gridFeedIn';
|
|
37
43
|
/**
|
|
38
44
|
* Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid
|
|
39
45
|
* (blue) energy sources stacked per bucket, the total height being the energy
|
|
40
|
-
* consumed.
|
|
46
|
+
* consumed. Grid feed-in (translucent blue) dips below the baseline as an
|
|
47
|
+
* export. For cumulative energy (week/month/year views). Thin wrapper over the
|
|
41
48
|
* shared visx `BarChart`, so it inherits the card tooltip and both indicators.
|
|
42
49
|
*/
|
|
43
50
|
declare function EnergyHistoryChart({
|
|
@@ -46,6 +53,7 @@ declare function EnergyHistoryChart({
|
|
|
46
53
|
formatValue,
|
|
47
54
|
formatBucketLabel,
|
|
48
55
|
labels,
|
|
56
|
+
omitSeries,
|
|
49
57
|
highlightedBucket,
|
|
50
58
|
showHighlightLine,
|
|
51
59
|
title,
|
|
@@ -54,5 +62,5 @@ declare function EnergyHistoryChart({
|
|
|
54
62
|
categoryTicks
|
|
55
63
|
}: EnergyHistoryChartProps): _$react_jsx_runtime0.JSX.Element;
|
|
56
64
|
//#endregion
|
|
57
|
-
export { EnergyHistoryChart, EnergyHistoryChartProps, EnergyHistoryDatum };
|
|
65
|
+
export { EnergyHistoryChart, EnergyHistoryChartProps, EnergyHistoryDatum, EnergyHistorySeriesKey };
|
|
58
66
|
//# sourceMappingURL=energy-history-chart.d.ts.map
|
|
@@ -7,24 +7,26 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
/**
|
|
8
8
|
* Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid
|
|
9
9
|
* (blue) energy sources stacked per bucket, the total height being the energy
|
|
10
|
-
* consumed.
|
|
10
|
+
* consumed. Grid feed-in (translucent blue) dips below the baseline as an
|
|
11
|
+
* export. For cumulative energy (week/month/year views). Thin wrapper over the
|
|
11
12
|
* shared visx `BarChart`, so it inherits the card tooltip and both indicators.
|
|
12
13
|
*/
|
|
13
|
-
function EnergyHistoryChart({ data, unit, formatValue, formatBucketLabel, labels, highlightedBucket, showHighlightLine, title, className, height = 260, categoryTicks }) {
|
|
14
|
+
function EnergyHistoryChart({ data, unit, formatValue, formatBucketLabel, labels, omitSeries, highlightedBucket, showHighlightLine, title, className, height = 260, categoryTicks }) {
|
|
14
15
|
const fmtValue = (value) => formatValue ? formatValue(value) : `${twoDecimalFormat.format(value)} ${unit}`;
|
|
16
|
+
const omitted = new Set(omitSeries);
|
|
15
17
|
return /* @__PURE__ */ jsx(EnergyBarChart, {
|
|
16
18
|
data,
|
|
17
19
|
series: [
|
|
18
20
|
{
|
|
19
21
|
key: "solar",
|
|
20
22
|
label: labels.solar,
|
|
21
|
-
color: "var(--orange-
|
|
23
|
+
color: "var(--orange-9)",
|
|
22
24
|
getValue: (d) => d.solar
|
|
23
25
|
},
|
|
24
26
|
{
|
|
25
27
|
key: "battery",
|
|
26
28
|
label: labels.battery,
|
|
27
|
-
color: "var(--green-
|
|
29
|
+
color: "var(--green-9)",
|
|
28
30
|
getValue: (d) => d.battery
|
|
29
31
|
},
|
|
30
32
|
{
|
|
@@ -32,8 +34,14 @@ function EnergyHistoryChart({ data, unit, formatValue, formatBucketLabel, labels
|
|
|
32
34
|
label: labels.grid,
|
|
33
35
|
color: "var(--blue-9)",
|
|
34
36
|
getValue: (d) => d.grid
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
+
},
|
|
38
|
+
...labels.gridFeedIn !== void 0 ? [{
|
|
39
|
+
key: "gridFeedIn",
|
|
40
|
+
label: labels.gridFeedIn,
|
|
41
|
+
color: "var(--blue-7)",
|
|
42
|
+
getValue: (d) => -Math.max(0, d.gridFeedIn ?? 0)
|
|
43
|
+
}] : []
|
|
44
|
+
].filter((s) => !omitted.has(s.key)),
|
|
37
45
|
getCategory: (d) => d.bucket,
|
|
38
46
|
title,
|
|
39
47
|
yAxisUnit: unit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy-history-chart.js","names":["valueFormat"],"sources":["../../src/components/energy-history-chart.tsx"],"sourcesContent":["import { NARROW_NBSP } from '../utils/chars'\nimport { twoDecimalFormat as valueFormat } from '../utils/format'\nimport type { BarChartSeries } from './bar-chart'\nimport { EnergyBarChart } from './energy-bar-chart'\n\nexport interface EnergyHistoryDatum {\n /** Bucket label/id (e.g. weekday, day-of-month, month). */\n bucket: string\n /** Solar used on-site (kWh, ≥ 0). */\n solar: number\n /** Battery discharged (kWh, ≥ 0). */\n battery: number\n /** Grid imported (kWh, ≥ 0). */\n grid: number\n}\n\nexport interface EnergyHistoryChartProps {\n data: EnergyHistoryDatum[]\n /** Axis/tooltip unit, e.g. \"kWh\". */\n unit: string\n formatValue?: (value: number) => string\n /** Formats the hovered bucket in the tooltip header. Defaults to the raw bucket. */\n formatBucketLabel?: (bucket: string) => string\n labels: {\n solar: string\n battery: string\n grid: string\n }\n /** Bucket to mark with the current-period dashed line. */\n highlightedBucket?: string\n showHighlightLine?: boolean\n title?: string\n className?: string\n height?: number\n /** Subset of bucket ids to label on the x-axis. Defaults to all buckets. */\n categoryTicks?: string[]\n}\n\n/**\n * Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid\n * (blue) energy sources stacked per bucket, the total height being the energy\n * consumed. For cumulative energy (week/month/year views). Thin wrapper over the\n * shared visx `BarChart`, so it inherits the card tooltip and both indicators.\n */\nexport function EnergyHistoryChart({\n data,\n unit,\n formatValue,\n formatBucketLabel,\n labels,\n highlightedBucket,\n showHighlightLine,\n title,\n className,\n height = 260,\n categoryTicks,\n}: EnergyHistoryChartProps) {\n const fmtValue = (value: number) =>\n formatValue\n ? formatValue(value)\n : `${valueFormat.format(value)}${NARROW_NBSP}${unit}`\n\n const
|
|
1
|
+
{"version":3,"file":"energy-history-chart.js","names":["valueFormat"],"sources":["../../src/components/energy-history-chart.tsx"],"sourcesContent":["import { NARROW_NBSP } from '../utils/chars'\nimport { twoDecimalFormat as valueFormat } from '../utils/format'\nimport type { BarChartSeries } from './bar-chart'\nimport { EnergyBarChart } from './energy-bar-chart'\n\nexport interface EnergyHistoryDatum {\n /** Bucket label/id (e.g. weekday, day-of-month, month). */\n bucket: string\n /** Solar used on-site (kWh, ≥ 0). */\n solar: number\n /** Battery discharged (kWh, ≥ 0). */\n battery: number\n /** Grid imported (kWh, ≥ 0). */\n grid: number\n /** Grid feed-in (kWh, ≥ 0); drawn below the baseline as an export. */\n gridFeedIn?: number\n}\n\nexport interface EnergyHistoryChartProps {\n data: EnergyHistoryDatum[]\n /** Axis/tooltip unit, e.g. \"kWh\". */\n unit: string\n formatValue?: (value: number) => string\n /** Formats the hovered bucket in the tooltip header. Defaults to the raw bucket. */\n formatBucketLabel?: (bucket: string) => string\n labels: {\n solar: string\n battery: string\n grid: string\n /** Optional; when set, grid feed-in is drawn below the baseline. */\n gridFeedIn?: string\n }\n /** Series to drop entirely (no legend entry, bar segment, or tooltip row). */\n omitSeries?: readonly EnergyHistorySeriesKey[]\n /** Bucket to mark with the current-period dashed line. */\n highlightedBucket?: string\n showHighlightLine?: boolean\n title?: string\n className?: string\n height?: number\n /** Subset of bucket ids to label on the x-axis. Defaults to all buckets. */\n categoryTicks?: string[]\n}\n\nexport type EnergyHistorySeriesKey = 'solar' | 'battery' | 'grid' | 'gridFeedIn'\n\n/**\n * Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid\n * (blue) energy sources stacked per bucket, the total height being the energy\n * consumed. Grid feed-in (translucent blue) dips below the baseline as an\n * export. For cumulative energy (week/month/year views). Thin wrapper over the\n * shared visx `BarChart`, so it inherits the card tooltip and both indicators.\n */\nexport function EnergyHistoryChart({\n data,\n unit,\n formatValue,\n formatBucketLabel,\n labels,\n omitSeries,\n highlightedBucket,\n showHighlightLine,\n title,\n className,\n height = 260,\n categoryTicks,\n}: EnergyHistoryChartProps) {\n const fmtValue = (value: number) =>\n formatValue\n ? formatValue(value)\n : `${valueFormat.format(value)}${NARROW_NBSP}${unit}`\n\n const omitted = new Set<EnergyHistorySeriesKey>(omitSeries)\n const allSeries: BarChartSeries<EnergyHistoryDatum>[] = [\n {\n key: 'solar',\n label: labels.solar,\n color: 'var(--orange-9)',\n getValue: (d) => d.solar,\n },\n {\n key: 'battery',\n label: labels.battery,\n color: 'var(--green-9)',\n getValue: (d) => d.battery,\n },\n {\n key: 'grid',\n label: labels.grid,\n color: 'var(--blue-9)',\n getValue: (d) => d.grid,\n },\n ...(labels.gridFeedIn !== undefined\n ? [\n {\n key: 'gridFeedIn',\n label: labels.gridFeedIn,\n color: 'var(--blue-7)',\n getValue: (d: EnergyHistoryDatum) =>\n -Math.max(0, d.gridFeedIn ?? 0),\n },\n ]\n : []),\n ]\n const series = allSeries.filter(\n (s) => !omitted.has(s.key as EnergyHistorySeriesKey),\n )\n\n return (\n <EnergyBarChart<EnergyHistoryDatum>\n data={data}\n series={series}\n getCategory={(d) => d.bucket}\n title={title}\n yAxisUnit={unit}\n height={height}\n className={className}\n formatValue={fmtValue}\n categoryTicks={categoryTicks}\n {...(formatBucketLabel && {\n formatTooltipCategory: (category: string | number) =>\n formatBucketLabel(String(category)),\n })}\n totalSuffix={unit}\n totalFormat={{ maximumFractionDigits: 2 }}\n {...(highlightedBucket !== undefined && {\n highlightedCategory: highlightedBucket,\n })}\n {...(showHighlightLine !== undefined && { showHighlightLine })}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAqDA,SAAgB,mBAAmB,EACjC,MACA,MACA,aACA,mBACA,QACA,YACA,mBACA,mBACA,OACA,WACA,SAAS,KACT,iBAC0B;CAC1B,MAAM,YAAY,UAChB,cACI,YAAY,MAAM,GAClB,GAAGA,iBAAY,OAAO,MAAM,IAAiB;CAEnD,MAAM,UAAU,IAAI,IAA4B,WAAW;AAoC3D,QACE,oBAAC,gBAAD;EACQ;EACN,QAPW;GA9Bb;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;IACpB;GACD;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;IACpB;GACD;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;IACpB;GACD,GAAI,OAAO,eAAe,KAAA,IACtB,CACE;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MACT,CAAC,KAAK,IAAI,GAAG,EAAE,cAAc,EAAE;IAClC,CACF,GACD,EAAE;GAEgB,CAAC,QACtB,MAAM,CAAC,QAAQ,IAAI,EAAE,IAA8B,CAMpC;EACd,cAAc,MAAM,EAAE;EACf;EACP,WAAW;EACH;EACG;EACX,aAAa;EACE;EACf,GAAK,qBAAqB,EACxB,wBAAwB,aACtB,kBAAkB,OAAO,SAAS,CAAC,EACtC;EACD,aAAa;EACb,aAAa,EAAE,uBAAuB,GAAG;EACzC,GAAK,sBAAsB,KAAA,KAAa,EACtC,qBAAqB,mBACtB;EACD,GAAK,sBAAsB,KAAA,KAAa,EAAE,mBAAmB;EAC7D,CAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const require_chunk = require("../chunk-aJGBMT86.cjs");
|
|
5
5
|
const require_components_separator = require("./separator.cjs");
|
|
6
|
-
const require_theme = require("../theme-
|
|
6
|
+
const require_theme = require("../theme-ClRJhexF.cjs");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
react = require_chunk.__toESM(react);
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as SparkLabelPosition, i as SparkInputStyle, r as SparkInputColor } from "../theme-types-BwSJKdsB.cjs";
|
|
4
4
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as SparkLabelPosition, i as SparkInputStyle, r as SparkInputColor } from "../theme-types-BDdoRxXa.js";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
|
package/dist/components/field.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { cn } from "../utils/cn.js";
|
|
4
4
|
import { Separator } from "./separator.js";
|
|
5
|
-
import { n as useTheme } from "../theme-
|
|
5
|
+
import { n as useTheme } from "../theme-8PDO9E0S.js";
|
|
6
6
|
import * as React$1 from "react";
|
|
7
7
|
import { useId } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -6,7 +6,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/info-block.d.ts
|
|
8
8
|
declare const InfoBlock: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "bare" | null | undefined;
|
|
10
10
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
declare const InfoBlockIcon: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const InfoBlockContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -6,7 +6,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/info-block.d.ts
|
|
8
8
|
declare const InfoBlock: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "bare" | null | undefined;
|
|
10
10
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
declare const InfoBlockIcon: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const InfoBlockContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const require_chunk = require("../chunk-aJGBMT86.cjs");
|
|
5
|
-
const require_theme = require("../theme-
|
|
5
|
+
const require_theme = require("../theme-ClRJhexF.cjs");
|
|
6
6
|
const require_components_field = require("./field.cjs");
|
|
7
7
|
const require_components_input = require("./input.cjs");
|
|
8
8
|
let react = require("react");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { cn } from "../utils/cn.js";
|
|
4
|
-
import { n as useTheme } from "../theme-
|
|
4
|
+
import { n as useTheme } from "../theme-8PDO9E0S.js";
|
|
5
5
|
import { useFieldContext } from "./field.js";
|
|
6
6
|
import { Input } from "./input.js";
|
|
7
7
|
import "react";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("../chunk-aJGBMT86.cjs");
|
|
4
4
|
const require_components_field = require("./field.cjs");
|
|
5
|
-
const require_input_box_variants = require("../input-box-variants-
|
|
5
|
+
const require_input_box_variants = require("../input-box-variants-ZCtgs-1S.cjs");
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
let class_variance_authority = require("class-variance-authority");
|
|
8
8
|
let _base_ui_react_otp_field = require("@base-ui/react/otp-field");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
3
|
import { useFieldControl } from "./field.js";
|
|
4
|
-
import { n as boxChrome, t as GHOST_UNDERLINE } from "../input-box-variants-
|
|
4
|
+
import { n as boxChrome, t as GHOST_UNDERLINE } from "../input-box-variants-DcajYXvo.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
7
|
import { OTPField } from "@base-ui/react/otp-field";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_chunk = require("../chunk-aJGBMT86.cjs");
|
|
4
4
|
const require_components_field = require("./field.cjs");
|
|
5
|
-
const require_input_box_variants = require("../input-box-variants-
|
|
5
|
+
const require_input_box_variants = require("../input-box-variants-ZCtgs-1S.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
react = require_chunk.__toESM(react);
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
package/dist/components/input.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
3
|
import { useFieldControl } from "./field.js";
|
|
4
|
-
import { n as boxChrome, t as GHOST_UNDERLINE } from "../input-box-variants-
|
|
4
|
+
import { n as boxChrome, t as GHOST_UNDERLINE } from "../input-box-variants-DcajYXvo.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { cva } from "class-variance-authority";
|