@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 +0,0 @@
|
|
|
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;CACxC,IAAI,KAAK,KAAM,OAAOA,qBAAAA,gBAAgB,CAAC;CACvC,IAAI,KAAK,KAAK,OAAOC,qBAAAA,cAAc,OAAO,CAAC;CAC3C,IAAI,KAAK,IAAI,OAAOC,qBAAAA,iBAAiB,OAAO,CAAC;CAC7C,OAAOC,qBAAAA,iBAAiB,OAAO,CAAC;AAClC;AAEA,SAAgB,gBAAgB,EAC9B,OACA,UACA,OACA,YAAY,SACW;CACvB,MAAM,eAAA,GAAA,MAAA,eACE,CAAC,GAAG,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,GACjD,CAAC,KAAK,CACR;CAEA,MAAM,QAAQ,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC;CACnD,MAAM,cAAc,MACjB,QAAQ,MAAM,CAAC,EAAE,sBAAsB,EACvC,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC;CAIlC,IAFkB,UAAU,GAEb,OAAO;CAEtB,OACE,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;GAAY,CAAA,GAC/D,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,WAAU;cAA2B;GAAe,CAAA,CACvD;MAEL,iBAAA,GAAA,kBAAA,MAAC,OAAD;GAAK,WAAU;aAAf,CACE,iBAAA,GAAA,kBAAA,KAACC,+BAAAA,YAAD;IACE,aAAa,sBAAsB,WAAW;IACnC;IACX,UAAU,YAAY,KAAK,EAAE,OAAO,aAAa;KAAE;KAAO;IAAM,EAAE;GACnE,CAAA,GAED,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,WAAU;cACZ,YAAY,KAAK,EAAE,OAAO,OAAO,YAAY;KAC5C,MAAM,MAAO,QAAQ,QAAS;KAC9B,OACE,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;OACG,CAAA,GACN,iBAAA,GAAA,kBAAA,MAAC,QAAD;QAAM,WAAU;kBAAhB,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;SAAM,WAAU;mBACbC,qBAAAA,aAAa,KAAK;QACf,CAAA,GACN,iBAAA,GAAA,kBAAA,KAAC,QAAD;SAAM,WAAU;mBACb,GAAGJ,qBAAAA,cAAc,OAAO,GAAG;QACxB,CAAA,CACF;SACH;UACL,iBAAA,GAAA,kBAAA,KAAC,OAAD;OAAK,WAAU;iBACb,iBAAA,GAAA,kBAAA,KAAC,OAAD;QACE,WAAU;QACV,OAAO;SAAE,OAAO,GAAG,IAAI;SAAI,YAAY;QAAM;OAC9C,CAAA;MACE,CAAA,CACF;QApBK,KAoBL;IAET,CAAC;GACE,CAAA,CACF;IACF;;AAET"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//#region src/components/energy-breakdown.d.ts
|
|
4
|
-
type BreakdownItem = {
|
|
5
|
-
label: string;
|
|
6
|
-
value: number;
|
|
7
|
-
color: string;
|
|
8
|
-
excludeFromCenterTotal?: boolean;
|
|
9
|
-
};
|
|
10
|
-
type EnergyBreakdownProps = {
|
|
11
|
-
title: string;
|
|
12
|
-
subtitle: string;
|
|
13
|
-
items: BreakdownItem[];
|
|
14
|
-
centerSub?: string;
|
|
15
|
-
};
|
|
16
|
-
declare function EnergyBreakdown({
|
|
17
|
-
title,
|
|
18
|
-
subtitle,
|
|
19
|
-
items,
|
|
20
|
-
centerSub
|
|
21
|
-
}: EnergyBreakdownProps): import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { BreakdownItem, EnergyBreakdown, EnergyBreakdownProps };
|
|
24
|
-
//# sourceMappingURL=energy-breakdown.d.cts.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//#region src/components/energy-breakdown.d.ts
|
|
4
|
-
type BreakdownItem = {
|
|
5
|
-
label: string;
|
|
6
|
-
value: number;
|
|
7
|
-
color: string;
|
|
8
|
-
excludeFromCenterTotal?: boolean;
|
|
9
|
-
};
|
|
10
|
-
type EnergyBreakdownProps = {
|
|
11
|
-
title: string;
|
|
12
|
-
subtitle: string;
|
|
13
|
-
items: BreakdownItem[];
|
|
14
|
-
centerSub?: string;
|
|
15
|
-
};
|
|
16
|
-
declare function EnergyBreakdown({
|
|
17
|
-
title,
|
|
18
|
-
subtitle,
|
|
19
|
-
items,
|
|
20
|
-
centerSub
|
|
21
|
-
}: EnergyBreakdownProps): import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { BreakdownItem, EnergyBreakdown, EnergyBreakdownProps };
|
|
24
|
-
//# sourceMappingURL=energy-breakdown.d.ts.map
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../utils/chars.js";
|
|
3
|
-
import { formatEnergy, formatThousands, integerFormat, oneDecimalFormat, twoDecimalFormat } from "../utils/format.js";
|
|
4
|
-
import { DonutChart } from "./donut-chart.js";
|
|
5
|
-
import { useMemo } from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
//#region src/components/energy-breakdown.tsx
|
|
8
|
-
function formatBreakdownCenter(v) {
|
|
9
|
-
if (v >= 1e3) return formatThousands(v);
|
|
10
|
-
if (v >= 100) return integerFormat.format(v);
|
|
11
|
-
if (v >= 10) return oneDecimalFormat.format(v);
|
|
12
|
-
return twoDecimalFormat.format(v);
|
|
13
|
-
}
|
|
14
|
-
function EnergyBreakdown({ title, subtitle, items, centerSub = "kWh" }) {
|
|
15
|
-
const sortedItems = useMemo(() => [...items].sort((a, b) => b.value - a.value), [items]);
|
|
16
|
-
const total = items.reduce((s, i) => s + i.value, 0);
|
|
17
|
-
const centerTotal = items.filter((i) => !i.excludeFromCenterTotal).reduce((s, i) => s + i.value, 0);
|
|
18
|
-
if (total === 0) return null;
|
|
19
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
20
|
-
className: "flex flex-col gap-4 pt-3 pb-5",
|
|
21
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
22
|
-
className: "flex flex-col gap-0.5",
|
|
23
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
24
|
-
className: "text-sm font-semibold text-gray",
|
|
25
|
-
children: title
|
|
26
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
27
|
-
className: "text-xs text-gray-light",
|
|
28
|
-
children: subtitle
|
|
29
|
-
})]
|
|
30
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
31
|
-
className: "flex items-center gap-6",
|
|
32
|
-
children: [/* @__PURE__ */ jsx(DonutChart, {
|
|
33
|
-
centerLabel: formatBreakdownCenter(centerTotal),
|
|
34
|
-
centerSub,
|
|
35
|
-
segments: sortedItems.map(({ value, color }) => ({
|
|
36
|
-
value,
|
|
37
|
-
color
|
|
38
|
-
}))
|
|
39
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
40
|
-
className: "flex flex-1 flex-col gap-3",
|
|
41
|
-
children: sortedItems.map(({ label, value, color }) => {
|
|
42
|
-
const pct = value / total * 100;
|
|
43
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
44
|
-
className: "flex flex-col gap-1.5",
|
|
45
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
46
|
-
className: "flex items-baseline justify-between gap-2",
|
|
47
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
48
|
-
className: "min-w-0 truncate text-sm font-medium text-gray",
|
|
49
|
-
children: label
|
|
50
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
51
|
-
className: "flex shrink-0 items-baseline gap-1.5 text-xs tabular-nums",
|
|
52
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
53
|
-
className: "text-gray-light",
|
|
54
|
-
children: formatEnergy(value)
|
|
55
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
56
|
-
className: "font-semibold text-gray",
|
|
57
|
-
children: `${integerFormat.format(pct)} %`
|
|
58
|
-
})]
|
|
59
|
-
})]
|
|
60
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
61
|
-
className: "h-1 w-full overflow-hidden rounded-full bg-gray-a4",
|
|
62
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
63
|
-
className: "h-full rounded-full",
|
|
64
|
-
style: {
|
|
65
|
-
width: `${pct}%`,
|
|
66
|
-
background: color
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
})]
|
|
70
|
-
}, label);
|
|
71
|
-
})
|
|
72
|
-
})]
|
|
73
|
-
})]
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
export { EnergyBreakdown };
|
|
78
|
-
|
|
79
|
-
//# sourceMappingURL=energy-breakdown.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;CACxC,IAAI,KAAK,KAAM,OAAO,gBAAgB,CAAC;CACvC,IAAI,KAAK,KAAK,OAAO,cAAc,OAAO,CAAC;CAC3C,IAAI,KAAK,IAAI,OAAO,iBAAiB,OAAO,CAAC;CAC7C,OAAO,iBAAiB,OAAO,CAAC;AAClC;AAEA,SAAgB,gBAAgB,EAC9B,OACA,UACA,OACA,YAAY,SACW;CACvB,MAAM,cAAc,cACZ,CAAC,GAAG,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,GACjD,CAAC,KAAK,CACR;CAEA,MAAM,QAAQ,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC;CACnD,MAAM,cAAc,MACjB,QAAQ,MAAM,CAAC,EAAE,sBAAsB,EACvC,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC;CAIlC,IAFkB,UAAU,GAEb,OAAO;CAEtB,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,QAAD;IAAM,WAAU;cAAmC;GAAY,CAAA,GAC/D,oBAAC,QAAD;IAAM,WAAU;cAA2B;GAAe,CAAA,CACvD;MAEL,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,YAAD;IACE,aAAa,sBAAsB,WAAW;IACnC;IACX,UAAU,YAAY,KAAK,EAAE,OAAO,aAAa;KAAE;KAAO;IAAM,EAAE;GACnE,CAAA,GAED,oBAAC,OAAD;IAAK,WAAU;cACZ,YAAY,KAAK,EAAE,OAAO,OAAO,YAAY;KAC5C,MAAM,MAAO,QAAQ,QAAS;KAC9B,OACE,qBAAC,OAAD;MAAiB,WAAU;gBAA3B,CACE,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,oBAAC,QAAD;QAAM,WAAU;kBACb;OACG,CAAA,GACN,qBAAC,QAAD;QAAM,WAAU;kBAAhB,CACE,oBAAC,QAAD;SAAM,WAAU;mBACb,aAAa,KAAK;QACf,CAAA,GACN,oBAAC,QAAD;SAAM,WAAU;mBACb,GAAG,cAAc,OAAO,GAAG;QACxB,CAAA,CACF;SACH;UACL,oBAAC,OAAD;OAAK,WAAU;iBACb,oBAAC,OAAD;QACE,WAAU;QACV,OAAO;SAAE,OAAO,GAAG,IAAI;SAAI,YAAY;QAAM;OAC9C,CAAA;MACE,CAAA,CACF;QApBK,KAoBL;IAET,CAAC;GACE,CAAA,CACF;IACF;;AAET"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("../utils/chars.cjs");
|
|
4
|
-
const require_utils_format = require("../utils/format.cjs");
|
|
5
|
-
const require_components_energy_bar_chart = require("./energy-bar-chart.cjs");
|
|
6
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
//#region src/components/energy-history-chart.tsx
|
|
8
|
-
/**
|
|
9
|
-
* Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid
|
|
10
|
-
* (blue) energy sources stacked per bucket, the total height being the energy
|
|
11
|
-
* consumed. Grid feed-in (translucent blue) dips below the baseline as an
|
|
12
|
-
* export. For cumulative energy (week/month/year views). Thin wrapper over the
|
|
13
|
-
* shared visx `BarChart`, so it inherits the card tooltip and both indicators.
|
|
14
|
-
*/
|
|
15
|
-
function EnergyHistoryChart({ data, unit, formatValue, formatBucketLabel, labels, omitSeries, highlightedBucket, showHighlightLine, title, className, height = 260, categoryTicks }) {
|
|
16
|
-
const fmtValue = (value) => formatValue ? formatValue(value) : `${require_utils_format.twoDecimalFormat.format(value)} ${unit}`;
|
|
17
|
-
const omitted = new Set(omitSeries);
|
|
18
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_energy_bar_chart.EnergyBarChart, {
|
|
19
|
-
data,
|
|
20
|
-
series: [
|
|
21
|
-
{
|
|
22
|
-
key: "solar",
|
|
23
|
-
label: labels.solar,
|
|
24
|
-
color: "var(--orange-9)",
|
|
25
|
-
getValue: (d) => d.solar
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
key: "battery",
|
|
29
|
-
label: labels.battery,
|
|
30
|
-
color: "var(--green-9)",
|
|
31
|
-
getValue: (d) => d.battery
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
key: "grid",
|
|
35
|
-
label: labels.grid,
|
|
36
|
-
color: "var(--blue-9)",
|
|
37
|
-
getValue: (d) => d.grid
|
|
38
|
-
},
|
|
39
|
-
...labels.gridFeedIn !== void 0 ? [{
|
|
40
|
-
key: "gridFeedIn",
|
|
41
|
-
label: labels.gridFeedIn,
|
|
42
|
-
color: "var(--blue-7)",
|
|
43
|
-
getValue: (d) => -Math.max(0, d.gridFeedIn ?? 0)
|
|
44
|
-
}] : []
|
|
45
|
-
].filter((s) => !omitted.has(s.key)),
|
|
46
|
-
getCategory: (d) => d.bucket,
|
|
47
|
-
title,
|
|
48
|
-
yAxisUnit: unit,
|
|
49
|
-
height,
|
|
50
|
-
className,
|
|
51
|
-
formatValue: fmtValue,
|
|
52
|
-
categoryTicks,
|
|
53
|
-
...formatBucketLabel && { formatTooltipCategory: (category) => formatBucketLabel(String(category)) },
|
|
54
|
-
totalSuffix: unit,
|
|
55
|
-
totalFormat: { maximumFractionDigits: 2 },
|
|
56
|
-
...highlightedBucket !== void 0 && { highlightedCategory: highlightedBucket },
|
|
57
|
-
...showHighlightLine !== void 0 && { showHighlightLine }
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
exports.EnergyHistoryChart = EnergyHistoryChart;
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=energy-history-chart.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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,KAAK,IACjB,GAAGA,qBAAAA,iBAAY,OAAO,KAAK,KAAkB;CAEnD,MAAM,UAAU,IAAI,IAA4B,UAAU;CAoC1D,OACE,iBAAA,GAAA,kBAAA,KAACC,oCAAAA,gBAAD;EACQ;EACN,QAPW;GA9Bb;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;GACrB;GACA;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;GACrB;GACA;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;GACrB;GACA,GAAI,OAAO,eAAe,KAAA,IACtB,CACE;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MACT,CAAC,KAAK,IAAI,GAAG,EAAE,cAAc,CAAC;GAClC,CACF,IACA,CAAC;EAEgB,EAAE,QACtB,MAAM,CAAC,QAAQ,IAAI,EAAE,GAA6B,CAMpC;EACb,cAAc,MAAM,EAAE;EACf;EACP,WAAW;EACH;EACG;EACX,aAAa;EACE;EACf,GAAK,qBAAqB,EACxB,wBAAwB,aACtB,kBAAkB,OAAO,QAAQ,CAAC,EACtC;EACA,aAAa;EACb,aAAa,EAAE,uBAAuB,EAAE;EACxC,GAAK,sBAAsB,KAAA,KAAa,EACtC,qBAAqB,kBACvB;EACA,GAAK,sBAAsB,KAAA,KAAa,EAAE,kBAAkB;CAC7D,CAAA;AAEL"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//#region src/components/energy-history-chart.d.ts
|
|
4
|
-
interface EnergyHistoryDatum {
|
|
5
|
-
/** Bucket label/id (e.g. weekday, day-of-month, month). */
|
|
6
|
-
bucket: string;
|
|
7
|
-
/** Solar used on-site (kWh, ≥ 0). */
|
|
8
|
-
solar: number;
|
|
9
|
-
/** Battery discharged (kWh, ≥ 0). */
|
|
10
|
-
battery: number;
|
|
11
|
-
/** Grid imported (kWh, ≥ 0). */
|
|
12
|
-
grid: number;
|
|
13
|
-
/** Grid feed-in (kWh, ≥ 0); drawn below the baseline as an export. */
|
|
14
|
-
gridFeedIn?: number;
|
|
15
|
-
}
|
|
16
|
-
interface EnergyHistoryChartProps {
|
|
17
|
-
data: EnergyHistoryDatum[];
|
|
18
|
-
/** Axis/tooltip unit, e.g. "kWh". */
|
|
19
|
-
unit: string;
|
|
20
|
-
formatValue?: (value: number) => string;
|
|
21
|
-
/** Formats the hovered bucket in the tooltip header. Defaults to the raw bucket. */
|
|
22
|
-
formatBucketLabel?: (bucket: string) => string;
|
|
23
|
-
labels: {
|
|
24
|
-
solar: string;
|
|
25
|
-
battery: string;
|
|
26
|
-
grid: string; /** Optional; when set, grid feed-in is drawn below the baseline. */
|
|
27
|
-
gridFeedIn?: string;
|
|
28
|
-
};
|
|
29
|
-
/** Series to drop entirely (no legend entry, bar segment, or tooltip row). */
|
|
30
|
-
omitSeries?: readonly EnergyHistorySeriesKey[];
|
|
31
|
-
/** Bucket to mark with the current-period dashed line. */
|
|
32
|
-
highlightedBucket?: string;
|
|
33
|
-
showHighlightLine?: boolean;
|
|
34
|
-
title?: string;
|
|
35
|
-
className?: string;
|
|
36
|
-
height?: number;
|
|
37
|
-
/** Subset of bucket ids to label on the x-axis. Defaults to all buckets. */
|
|
38
|
-
categoryTicks?: string[];
|
|
39
|
-
}
|
|
40
|
-
type EnergyHistorySeriesKey = 'solar' | 'battery' | 'grid' | 'gridFeedIn';
|
|
41
|
-
/**
|
|
42
|
-
* Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid
|
|
43
|
-
* (blue) energy sources stacked per bucket, the total height being the energy
|
|
44
|
-
* consumed. Grid feed-in (translucent blue) dips below the baseline as an
|
|
45
|
-
* export. For cumulative energy (week/month/year views). Thin wrapper over the
|
|
46
|
-
* shared visx `BarChart`, so it inherits the card tooltip and both indicators.
|
|
47
|
-
*/
|
|
48
|
-
declare function EnergyHistoryChart({
|
|
49
|
-
data,
|
|
50
|
-
unit,
|
|
51
|
-
formatValue,
|
|
52
|
-
formatBucketLabel,
|
|
53
|
-
labels,
|
|
54
|
-
omitSeries,
|
|
55
|
-
highlightedBucket,
|
|
56
|
-
showHighlightLine,
|
|
57
|
-
title,
|
|
58
|
-
className,
|
|
59
|
-
height,
|
|
60
|
-
categoryTicks
|
|
61
|
-
}: EnergyHistoryChartProps): import("react/jsx-runtime").JSX.Element;
|
|
62
|
-
//#endregion
|
|
63
|
-
export { EnergyHistoryChart, EnergyHistoryChartProps, EnergyHistoryDatum, EnergyHistorySeriesKey };
|
|
64
|
-
//# sourceMappingURL=energy-history-chart.d.cts.map
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//#region src/components/energy-history-chart.d.ts
|
|
4
|
-
interface EnergyHistoryDatum {
|
|
5
|
-
/** Bucket label/id (e.g. weekday, day-of-month, month). */
|
|
6
|
-
bucket: string;
|
|
7
|
-
/** Solar used on-site (kWh, ≥ 0). */
|
|
8
|
-
solar: number;
|
|
9
|
-
/** Battery discharged (kWh, ≥ 0). */
|
|
10
|
-
battery: number;
|
|
11
|
-
/** Grid imported (kWh, ≥ 0). */
|
|
12
|
-
grid: number;
|
|
13
|
-
/** Grid feed-in (kWh, ≥ 0); drawn below the baseline as an export. */
|
|
14
|
-
gridFeedIn?: number;
|
|
15
|
-
}
|
|
16
|
-
interface EnergyHistoryChartProps {
|
|
17
|
-
data: EnergyHistoryDatum[];
|
|
18
|
-
/** Axis/tooltip unit, e.g. "kWh". */
|
|
19
|
-
unit: string;
|
|
20
|
-
formatValue?: (value: number) => string;
|
|
21
|
-
/** Formats the hovered bucket in the tooltip header. Defaults to the raw bucket. */
|
|
22
|
-
formatBucketLabel?: (bucket: string) => string;
|
|
23
|
-
labels: {
|
|
24
|
-
solar: string;
|
|
25
|
-
battery: string;
|
|
26
|
-
grid: string; /** Optional; when set, grid feed-in is drawn below the baseline. */
|
|
27
|
-
gridFeedIn?: string;
|
|
28
|
-
};
|
|
29
|
-
/** Series to drop entirely (no legend entry, bar segment, or tooltip row). */
|
|
30
|
-
omitSeries?: readonly EnergyHistorySeriesKey[];
|
|
31
|
-
/** Bucket to mark with the current-period dashed line. */
|
|
32
|
-
highlightedBucket?: string;
|
|
33
|
-
showHighlightLine?: boolean;
|
|
34
|
-
title?: string;
|
|
35
|
-
className?: string;
|
|
36
|
-
height?: number;
|
|
37
|
-
/** Subset of bucket ids to label on the x-axis. Defaults to all buckets. */
|
|
38
|
-
categoryTicks?: string[];
|
|
39
|
-
}
|
|
40
|
-
type EnergyHistorySeriesKey = 'solar' | 'battery' | 'grid' | 'gridFeedIn';
|
|
41
|
-
/**
|
|
42
|
-
* Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid
|
|
43
|
-
* (blue) energy sources stacked per bucket, the total height being the energy
|
|
44
|
-
* consumed. Grid feed-in (translucent blue) dips below the baseline as an
|
|
45
|
-
* export. For cumulative energy (week/month/year views). Thin wrapper over the
|
|
46
|
-
* shared visx `BarChart`, so it inherits the card tooltip and both indicators.
|
|
47
|
-
*/
|
|
48
|
-
declare function EnergyHistoryChart({
|
|
49
|
-
data,
|
|
50
|
-
unit,
|
|
51
|
-
formatValue,
|
|
52
|
-
formatBucketLabel,
|
|
53
|
-
labels,
|
|
54
|
-
omitSeries,
|
|
55
|
-
highlightedBucket,
|
|
56
|
-
showHighlightLine,
|
|
57
|
-
title,
|
|
58
|
-
className,
|
|
59
|
-
height,
|
|
60
|
-
categoryTicks
|
|
61
|
-
}: EnergyHistoryChartProps): import("react/jsx-runtime").JSX.Element;
|
|
62
|
-
//#endregion
|
|
63
|
-
export { EnergyHistoryChart, EnergyHistoryChartProps, EnergyHistoryDatum, EnergyHistorySeriesKey };
|
|
64
|
-
//# sourceMappingURL=energy-history-chart.d.ts.map
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../utils/chars.js";
|
|
3
|
-
import { twoDecimalFormat } from "../utils/format.js";
|
|
4
|
-
import { EnergyBarChart } from "./energy-bar-chart.js";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
//#region src/components/energy-history-chart.tsx
|
|
7
|
-
/**
|
|
8
|
-
* Energy-per-bucket stacked bar chart: solar (orange), battery (green) and grid
|
|
9
|
-
* (blue) energy sources stacked per bucket, the total height being the energy
|
|
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
|
|
12
|
-
* shared visx `BarChart`, so it inherits the card tooltip and both indicators.
|
|
13
|
-
*/
|
|
14
|
-
function EnergyHistoryChart({ data, unit, formatValue, formatBucketLabel, labels, omitSeries, highlightedBucket, showHighlightLine, title, className, height = 260, categoryTicks }) {
|
|
15
|
-
const fmtValue = (value) => formatValue ? formatValue(value) : `${twoDecimalFormat.format(value)} ${unit}`;
|
|
16
|
-
const omitted = new Set(omitSeries);
|
|
17
|
-
return /* @__PURE__ */ jsx(EnergyBarChart, {
|
|
18
|
-
data,
|
|
19
|
-
series: [
|
|
20
|
-
{
|
|
21
|
-
key: "solar",
|
|
22
|
-
label: labels.solar,
|
|
23
|
-
color: "var(--orange-9)",
|
|
24
|
-
getValue: (d) => d.solar
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
key: "battery",
|
|
28
|
-
label: labels.battery,
|
|
29
|
-
color: "var(--green-9)",
|
|
30
|
-
getValue: (d) => d.battery
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
key: "grid",
|
|
34
|
-
label: labels.grid,
|
|
35
|
-
color: "var(--blue-9)",
|
|
36
|
-
getValue: (d) => d.grid
|
|
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)),
|
|
45
|
-
getCategory: (d) => d.bucket,
|
|
46
|
-
title,
|
|
47
|
-
yAxisUnit: unit,
|
|
48
|
-
height,
|
|
49
|
-
className,
|
|
50
|
-
formatValue: fmtValue,
|
|
51
|
-
categoryTicks,
|
|
52
|
-
...formatBucketLabel && { formatTooltipCategory: (category) => formatBucketLabel(String(category)) },
|
|
53
|
-
totalSuffix: unit,
|
|
54
|
-
totalFormat: { maximumFractionDigits: 2 },
|
|
55
|
-
...highlightedBucket !== void 0 && { highlightedCategory: highlightedBucket },
|
|
56
|
-
...showHighlightLine !== void 0 && { showHighlightLine }
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
export { EnergyHistoryChart };
|
|
61
|
-
|
|
62
|
-
//# sourceMappingURL=energy-history-chart.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,KAAK,IACjB,GAAGA,iBAAY,OAAO,KAAK,KAAkB;CAEnD,MAAM,UAAU,IAAI,IAA4B,UAAU;CAoC1D,OACE,oBAAC,gBAAD;EACQ;EACN,QAPW;GA9Bb;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;GACrB;GACA;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;GACrB;GACA;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MAAM,EAAE;GACrB;GACA,GAAI,OAAO,eAAe,KAAA,IACtB,CACE;IACE,KAAK;IACL,OAAO,OAAO;IACd,OAAO;IACP,WAAW,MACT,CAAC,KAAK,IAAI,GAAG,EAAE,cAAc,CAAC;GAClC,CACF,IACA,CAAC;EAEgB,EAAE,QACtB,MAAM,CAAC,QAAQ,IAAI,EAAE,GAA6B,CAMpC;EACb,cAAc,MAAM,EAAE;EACf;EACP,WAAW;EACH;EACG;EACX,aAAa;EACE;EACf,GAAK,qBAAqB,EACxB,wBAAwB,aACtB,kBAAkB,OAAO,QAAQ,CAAC,EACtC;EACA,aAAa;EACb,aAAa,EAAE,uBAAuB,EAAE;EACxC,GAAK,sBAAsB,KAAA,KAAa,EACtC,qBAAqB,kBACvB;EACA,GAAK,sBAAsB,KAAA,KAAa,EAAE,kBAAkB;CAC7D,CAAA;AAEL"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"feed-in-hero.cjs","names":[],"sources":["../../src/components/feed-in-hero.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\n\nconst FeedInHero = ({ className, ...rest }: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex flex-col items-center gap-1 rounded-lg border border-gray p-5 text-center',\n className,\n )}\n {...rest}\n />\n )\n}\n\n/**\n * Label row above the value. Lays out children in a flex row with a small\n * gap so a tooltip / icon can sit alongside the label text.\n */\nconst FeedInHeroLabel = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex items-center gap-1.5 text-xs font-medium text-gray-light',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst valueToneVariants = cva('text-4xl font-bold tabular-nums', {\n variants: {\n tone: {\n success: 'text-success',\n warning: 'text-warning',\n error: 'text-error',\n accent: 'text-accent',\n neutral: 'text-gray',\n },\n },\n defaultVariants: {\n tone: 'neutral',\n },\n})\n\nconst FeedInHeroValue = ({\n className,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & { tone?: Tone }) => {\n return <span className={valueToneVariants({ tone, className })} {...rest} />\n}\n\n/** Smaller-weight unit suffix that sits inline with the value (e.g. \"W\"). */\nconst FeedInHeroValueUnit = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n return <span className={cn('text-2xl font-semibold', className)} {...rest} />\n}\n\nexport { FeedInHero, FeedInHeroLabel, FeedInHeroValue, FeedInHeroValueUnit }\n"],"mappings":";;;;;;AAIA,MAAM,cAAc,EAAE,WAAW,GAAG,WAAwC;CAC1E,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,YAAA,GAAA,OAAA,IACE,kFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;;;;AAMA,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC8B;CACjC,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,YAAA,GAAA,OAAA,IACE,iEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,MAAM,qBAAA,GAAA,yBAAA,KAAwB,mCAAmC;CAC/D,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,OAAO;EACP,QAAQ;EACR,SAAS;CACX,EACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CAAC;AAED,MAAM,mBAAmB,EACvB,WACA,MACA,GAAG,WACiD;CACpD,OAAO,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,WAAW,kBAAkB;GAAE;GAAM;EAAU,CAAC;EAAG,GAAI;CAAO,CAAA;AAC7E;;AAGA,MAAM,uBAAuB,EAC3B,WACA,GAAG,WAC+B;CAClC,OAAO,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,YAAA,GAAA,OAAA,IAAc,0BAA0B,SAAS;EAAG,GAAI;CAAO,CAAA;AAC9E"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Tone } from "../lib/tones.cjs";
|
|
4
|
-
|
|
5
|
-
//#region src/components/feed-in-hero.d.ts
|
|
6
|
-
declare const FeedInHero: ({
|
|
7
|
-
className,
|
|
8
|
-
...rest
|
|
9
|
-
}: React.ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
/**
|
|
11
|
-
* Label row above the value. Lays out children in a flex row with a small
|
|
12
|
-
* gap so a tooltip / icon can sit alongside the label text.
|
|
13
|
-
*/
|
|
14
|
-
declare const FeedInHeroLabel: ({
|
|
15
|
-
className,
|
|
16
|
-
...rest
|
|
17
|
-
}: React.ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
declare const FeedInHeroValue: ({
|
|
19
|
-
className,
|
|
20
|
-
tone,
|
|
21
|
-
...rest
|
|
22
|
-
}: React.ComponentProps<"span"> & {
|
|
23
|
-
tone?: Tone;
|
|
24
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
/** Smaller-weight unit suffix that sits inline with the value (e.g. "W"). */
|
|
26
|
-
declare const FeedInHeroValueUnit: ({
|
|
27
|
-
className,
|
|
28
|
-
...rest
|
|
29
|
-
}: React.ComponentProps<"span">) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
//#endregion
|
|
31
|
-
export { FeedInHero, FeedInHeroLabel, FeedInHeroValue, FeedInHeroValueUnit };
|
|
32
|
-
//# sourceMappingURL=feed-in-hero.d.cts.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Tone } from "../lib/tones.js";
|
|
4
|
-
|
|
5
|
-
//#region src/components/feed-in-hero.d.ts
|
|
6
|
-
declare const FeedInHero: ({
|
|
7
|
-
className,
|
|
8
|
-
...rest
|
|
9
|
-
}: React.ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
/**
|
|
11
|
-
* Label row above the value. Lays out children in a flex row with a small
|
|
12
|
-
* gap so a tooltip / icon can sit alongside the label text.
|
|
13
|
-
*/
|
|
14
|
-
declare const FeedInHeroLabel: ({
|
|
15
|
-
className,
|
|
16
|
-
...rest
|
|
17
|
-
}: React.ComponentProps<"div">) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
declare const FeedInHeroValue: ({
|
|
19
|
-
className,
|
|
20
|
-
tone,
|
|
21
|
-
...rest
|
|
22
|
-
}: React.ComponentProps<"span"> & {
|
|
23
|
-
tone?: Tone;
|
|
24
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
/** Smaller-weight unit suffix that sits inline with the value (e.g. "W"). */
|
|
26
|
-
declare const FeedInHeroValueUnit: ({
|
|
27
|
-
className,
|
|
28
|
-
...rest
|
|
29
|
-
}: React.ComponentProps<"span">) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
//#endregion
|
|
31
|
-
export { FeedInHero, FeedInHeroLabel, FeedInHeroValue, FeedInHeroValueUnit };
|
|
32
|
-
//# sourceMappingURL=feed-in-hero.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"feed-in-hero.js","names":[],"sources":["../../src/components/feed-in-hero.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\n\nconst FeedInHero = ({ className, ...rest }: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex flex-col items-center gap-1 rounded-lg border border-gray p-5 text-center',\n className,\n )}\n {...rest}\n />\n )\n}\n\n/**\n * Label row above the value. Lays out children in a flex row with a small\n * gap so a tooltip / icon can sit alongside the label text.\n */\nconst FeedInHeroLabel = ({\n className,\n ...rest\n}: React.ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'flex items-center gap-1.5 text-xs font-medium text-gray-light',\n className,\n )}\n {...rest}\n />\n )\n}\n\nconst valueToneVariants = cva('text-4xl font-bold tabular-nums', {\n variants: {\n tone: {\n success: 'text-success',\n warning: 'text-warning',\n error: 'text-error',\n accent: 'text-accent',\n neutral: 'text-gray',\n },\n },\n defaultVariants: {\n tone: 'neutral',\n },\n})\n\nconst FeedInHeroValue = ({\n className,\n tone,\n ...rest\n}: React.ComponentProps<'span'> & { tone?: Tone }) => {\n return <span className={valueToneVariants({ tone, className })} {...rest} />\n}\n\n/** Smaller-weight unit suffix that sits inline with the value (e.g. \"W\"). */\nconst FeedInHeroValueUnit = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n return <span className={cn('text-2xl font-semibold', className)} {...rest} />\n}\n\nexport { FeedInHero, FeedInHeroLabel, FeedInHeroValue, FeedInHeroValueUnit }\n"],"mappings":";;;;;AAIA,MAAM,cAAc,EAAE,WAAW,GAAG,WAAwC;CAC1E,OACE,oBAAC,OAAD;EACE,WAAW,GACT,kFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;;;;AAMA,MAAM,mBAAmB,EACvB,WACA,GAAG,WAC8B;CACjC,OACE,oBAAC,OAAD;EACE,WAAW,GACT,iEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,MAAM,oBAAoB,IAAI,mCAAmC;CAC/D,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,OAAO;EACP,QAAQ;EACR,SAAS;CACX,EACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CAAC;AAED,MAAM,mBAAmB,EACvB,WACA,MACA,GAAG,WACiD;CACpD,OAAO,oBAAC,QAAD;EAAM,WAAW,kBAAkB;GAAE;GAAM;EAAU,CAAC;EAAG,GAAI;CAAO,CAAA;AAC7E;;AAGA,MAAM,uBAAuB,EAC3B,WACA,GAAG,WAC+B;CAClC,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,0BAA0B,SAAS;EAAG,GAAI;CAAO,CAAA;AAC9E"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_components_icon = require("./icon.cjs");
|
|
4
|
-
let react = require("react");
|
|
5
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
-
let cnfast = require("cnfast");
|
|
7
|
-
//#region src/components/metering-row.tsx
|
|
8
|
-
const MeteringRowContext = (0, react.createContext)(null);
|
|
9
|
-
function useMeteringRowTone() {
|
|
10
|
-
const tone = (0, react.useContext)(MeteringRowContext);
|
|
11
|
-
if (!tone) throw new Error("MeteringRow.* must be rendered inside <MeteringRow>");
|
|
12
|
-
return tone;
|
|
13
|
-
}
|
|
14
|
-
const MeteringRow = ({ className, tone, ...rest }) => {
|
|
15
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MeteringRowContext.Provider, {
|
|
16
|
-
value: tone,
|
|
17
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
18
|
-
className: (0, cnfast.cn)("group flex items-center gap-3", className),
|
|
19
|
-
"data-tone": tone,
|
|
20
|
-
...rest
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
const toneToIconColor = {
|
|
25
|
-
accent: "accent",
|
|
26
|
-
neutral: "neutral",
|
|
27
|
-
success: "success",
|
|
28
|
-
warning: "warning",
|
|
29
|
-
error: "danger"
|
|
30
|
-
};
|
|
31
|
-
const MeteringRowIcon = ({ className, icon: Glyph, ...rest }) => {
|
|
32
|
-
const tone = useMeteringRowTone();
|
|
33
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_icon.Icon, {
|
|
34
|
-
...rest,
|
|
35
|
-
className,
|
|
36
|
-
color: toneToIconColor[tone],
|
|
37
|
-
size: "large",
|
|
38
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Glyph, {})
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
const MeteringRowLabel = ({ className, ...rest }) => {
|
|
42
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
43
|
-
className: (0, cnfast.cn)("flex-1 text-sm text-gray", className),
|
|
44
|
-
...rest
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
const MeteringRowValue = ({ className, ...rest }) => {
|
|
48
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
49
|
-
className: (0, cnfast.cn)("text-lg leading-tight font-bold tabular-nums group-data-[tone=accent]:text-accent group-data-[tone=error]:text-error group-data-[tone=neutral]:text-gray group-data-[tone=success]:text-success group-data-[tone=warning]:text-warning", className),
|
|
50
|
-
...rest
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
//#endregion
|
|
54
|
-
exports.MeteringRow = MeteringRow;
|
|
55
|
-
exports.MeteringRowIcon = MeteringRowIcon;
|
|
56
|
-
exports.MeteringRowLabel = MeteringRowLabel;
|
|
57
|
-
exports.MeteringRowValue = MeteringRowValue;
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=metering-row.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metering-row.cjs","names":["Icon"],"sources":["../../src/components/metering-row.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { createContext, useContext } from 'react'\nimport type { SparkAccentColor } from '../lib/accent-colors'\nimport type { Tone } from '../lib/tones'\nimport { cn } from '../utils/cn'\nimport { Icon } from './icon'\n\nconst MeteringRowContext = createContext<Tone | null>(null)\n\nfunction useMeteringRowTone() {\n const tone = useContext(MeteringRowContext)\n if (!tone) {\n throw new Error('MeteringRow.* must be rendered inside <MeteringRow>')\n }\n return tone\n}\n\nconst MeteringRow = ({\n className,\n tone,\n ...rest\n}: React.ComponentProps<'div'> & {\n tone: Tone\n}) => {\n return (\n <MeteringRowContext.Provider value={tone}>\n <div\n className={cn('group flex items-center gap-3', className)}\n data-tone={tone}\n {...rest}\n />\n </MeteringRowContext.Provider>\n )\n}\n\nconst toneToIconColor: Record<Tone, SparkAccentColor> = {\n accent: 'accent',\n neutral: 'neutral',\n success: 'success',\n warning: 'warning',\n error: 'danger',\n}\n\nconst MeteringRowIcon = ({\n className,\n icon: Glyph,\n ...rest\n}: React.ComponentProps<'span'> & {\n icon: SparkIcon\n}) => {\n const tone = useMeteringRowTone()\n return (\n <Icon\n {...rest}\n className={className}\n color={toneToIconColor[tone]}\n size=\"large\"\n >\n <Glyph />\n </Icon>\n )\n}\n\nconst MeteringRowLabel = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n return (\n <span className={cn('flex-1 text-sm text-gray', className)} {...rest} />\n )\n}\n\nconst MeteringRowValue = ({\n className,\n ...rest\n}: React.ComponentProps<'span'>) => {\n return (\n <span\n className={cn(\n 'text-lg leading-tight font-bold tabular-nums group-data-[tone=accent]:text-accent group-data-[tone=error]:text-error group-data-[tone=neutral]:text-gray group-data-[tone=success]:text-success group-data-[tone=warning]:text-warning',\n className,\n )}\n {...rest}\n />\n )\n}\n\nexport { MeteringRow, MeteringRowIcon, MeteringRowLabel, MeteringRowValue }\n"],"mappings":";;;;;;;AAOA,MAAM,sBAAA,GAAA,MAAA,eAAgD,IAAI;AAE1D,SAAS,qBAAqB;CAC5B,MAAM,QAAA,GAAA,MAAA,YAAkB,kBAAkB;CAC1C,IAAI,CAAC,MACH,MAAM,IAAI,MAAM,qDAAqD;CAEvE,OAAO;AACT;AAEA,MAAM,eAAe,EACnB,WACA,MACA,GAAG,WAGC;CACJ,OACE,iBAAA,GAAA,kBAAA,KAAC,mBAAmB,UAApB;EAA6B,OAAO;YAClC,iBAAA,GAAA,kBAAA,KAAC,OAAD;GACE,YAAA,GAAA,OAAA,IAAc,iCAAiC,SAAS;GACxD,aAAW;GACX,GAAI;EACL,CAAA;CAC0B,CAAA;AAEjC;AAEA,MAAM,kBAAkD;CACtD,QAAQ;CACR,SAAS;CACT,SAAS;CACT,SAAS;CACT,OAAO;AACT;AAEA,MAAM,mBAAmB,EACvB,WACA,MAAM,OACN,GAAG,WAGC;CACJ,MAAM,OAAO,mBAAmB;CAChC,OACE,iBAAA,GAAA,kBAAA,KAACA,wBAAAA,MAAD;EACE,GAAI;EACO;EACX,OAAO,gBAAgB;EACvB,MAAK;YAEL,iBAAA,GAAA,kBAAA,KAAC,OAAD,CAAQ,CAAA;CACJ,CAAA;AAEV;AAEA,MAAM,oBAAoB,EACxB,WACA,GAAG,WAC+B;CAClC,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,YAAA,GAAA,OAAA,IAAc,4BAA4B,SAAS;EAAG,GAAI;CAAO,CAAA;AAE3E;AAEA,MAAM,oBAAoB,EACxB,WACA,GAAG,WAC+B;CAClC,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EACE,YAAA,GAAA,OAAA,IACE,0OACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Tone } from "../lib/tones.cjs";
|
|
4
|
-
import { SparkIcon } from "@epilot/spark-icons";
|
|
5
|
-
|
|
6
|
-
//#region src/components/metering-row.d.ts
|
|
7
|
-
declare const MeteringRow: ({
|
|
8
|
-
className,
|
|
9
|
-
tone,
|
|
10
|
-
...rest
|
|
11
|
-
}: React.ComponentProps<"div"> & {
|
|
12
|
-
tone: Tone;
|
|
13
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
declare const MeteringRowIcon: ({
|
|
15
|
-
className,
|
|
16
|
-
icon: Glyph,
|
|
17
|
-
...rest
|
|
18
|
-
}: React.ComponentProps<"span"> & {
|
|
19
|
-
icon: SparkIcon;
|
|
20
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
declare const MeteringRowLabel: ({
|
|
22
|
-
className,
|
|
23
|
-
...rest
|
|
24
|
-
}: React.ComponentProps<"span">) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
declare const MeteringRowValue: ({
|
|
26
|
-
className,
|
|
27
|
-
...rest
|
|
28
|
-
}: React.ComponentProps<"span">) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
//#endregion
|
|
30
|
-
export { MeteringRow, MeteringRowIcon, MeteringRowLabel, MeteringRowValue };
|
|
31
|
-
//# sourceMappingURL=metering-row.d.cts.map
|