@nadicodeai/ui 8.1.0 → 8.3.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/LICENSES/SHADCN-HEATMAP-MIT.txt +21 -0
- package/NOTICE +9 -0
- package/dist/components/activity-calendar.d.ts +27 -0
- package/dist/components/activity-calendar.d.ts.map +1 -0
- package/dist/components/activity-calendar.js +56 -0
- package/dist/components/agent-orb.d.ts +22 -0
- package/dist/components/agent-orb.d.ts.map +1 -0
- package/dist/components/agent-orb.js +28 -0
- package/dist/components/chart-area-stacked.d.ts +1 -1
- package/dist/components/chart-area-stacked.d.ts.map +1 -1
- package/dist/components/chart-area-stacked.js +2 -2
- package/dist/components/chart-bar-horizontal.d.ts +14 -0
- package/dist/components/chart-bar-horizontal.d.ts.map +1 -0
- package/dist/components/chart-bar-horizontal.js +67 -0
- package/dist/components/chart-bar-multiple.d.ts +1 -1
- package/dist/components/chart-bar-multiple.d.ts.map +1 -1
- package/dist/components/chart-bar-multiple.js +2 -2
- package/dist/components/chart-bar-stacked.d.ts +1 -1
- package/dist/components/chart-bar-stacked.d.ts.map +1 -1
- package/dist/components/chart-bar-stacked.js +2 -2
- package/dist/components/chart-card.d.ts +24 -3
- package/dist/components/chart-card.d.ts.map +1 -1
- package/dist/components/chart-card.js +8 -3
- package/dist/components/heatmap/calendar-heatmap.d.ts +138 -0
- package/dist/components/heatmap/calendar-heatmap.d.ts.map +1 -0
- package/dist/components/heatmap/calendar-heatmap.js +449 -0
- package/dist/components/model-identity.d.ts +8 -0
- package/dist/components/model-identity.d.ts.map +1 -0
- package/dist/components/model-identity.js +8 -0
- package/dist/components/object-workspace.d.ts +36 -0
- package/dist/components/object-workspace.d.ts.map +1 -0
- package/dist/components/object-workspace.js +19 -0
- package/dist/components/progress.d.ts +2 -1
- package/dist/components/progress.d.ts.map +1 -1
- package/dist/components/progress.js +5 -4
- package/dist/components/settings-facts.d.ts +2 -1
- package/dist/components/settings-facts.d.ts.map +1 -1
- package/dist/components/settings-facts.js +6 -3
- package/dist/components/settings-section.d.ts +3 -1
- package/dist/components/settings-section.d.ts.map +1 -1
- package/dist/components/settings-section.js +2 -2
- package/dist/components/table-value.d.ts +7 -0
- package/dist/components/table-value.d.ts.map +1 -0
- package/dist/components/table-value.js +6 -0
- package/dist/components/table.d.ts +2 -1
- package/dist/components/table.d.ts.map +1 -1
- package/dist/components/table.js +4 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/internal/agent-orb-motion.d.ts +14 -0
- package/dist/internal/agent-orb-motion.d.ts.map +1 -0
- package/dist/internal/agent-orb-motion.js +120 -0
- package/dist/internal/agent-orb.d.ts +19 -0
- package/dist/internal/agent-orb.d.ts.map +1 -0
- package/dist/internal/agent-orb.js +151 -0
- package/dist/internal/object-identity-support.d.ts +6 -0
- package/dist/internal/object-identity-support.d.ts.map +1 -0
- package/dist/internal/object-identity-support.js +10 -0
- package/dist/lib/format-token-count.d.ts +4 -0
- package/dist/lib/format-token-count.d.ts.map +1 -0
- package/dist/lib/format-token-count.js +31 -0
- package/docs/activity.md +3 -1
- package/docs/agent-orb.md +82 -0
- package/docs/agent-visual.md +5 -0
- package/docs/contract.md +49 -4
- package/docs/model-identity.md +18 -0
- package/package.json +7 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ChingRu <hello@chingru.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
CHANGED
|
@@ -24,3 +24,12 @@ The marks name the maker of a model the product reports, and nothing else. They
|
|
|
24
24
|
are generated by scripts/build-brand-icons.mjs into src/components/brand-icons/,
|
|
25
25
|
so a hand edit there is lost; the allow-list in that script names the marks the
|
|
26
26
|
package ships.
|
|
27
|
+
|
|
28
|
+
@nadicodeai/ui includes a modified CalendarHeatmap from shadcn-heatmap.
|
|
29
|
+
|
|
30
|
+
shadcn-heatmap
|
|
31
|
+
Copyright (c) 2026 ChingRu <hello@chingru.com>
|
|
32
|
+
|
|
33
|
+
Licensed under the MIT License; the full text ships as
|
|
34
|
+
LICENSES/SHADCN-HEATMAP-MIT.txt. The source is adapted to distinguish missing
|
|
35
|
+
coverage from a measured zero and is composed by the shared ActivityCalendar.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
import { type Activity } from "./heatmap/calendar-heatmap.js";
|
|
3
|
+
type ActivityCalendarDatum = {
|
|
4
|
+
date: string;
|
|
5
|
+
value: number;
|
|
6
|
+
};
|
|
7
|
+
type ActivityCalendarLabels = {
|
|
8
|
+
ariaLabel: string;
|
|
9
|
+
unavailable: string;
|
|
10
|
+
legend: string;
|
|
11
|
+
legendLevel: string;
|
|
12
|
+
less: string;
|
|
13
|
+
more: string;
|
|
14
|
+
};
|
|
15
|
+
type ActivityCalendarProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
16
|
+
data: readonly ActivityCalendarDatum[];
|
|
17
|
+
from: string;
|
|
18
|
+
to: string;
|
|
19
|
+
locale?: string;
|
|
20
|
+
labels: ActivityCalendarLabels;
|
|
21
|
+
valueFormatter?: (value: number) => string;
|
|
22
|
+
};
|
|
23
|
+
declare function activityCalendarData(data: readonly ActivityCalendarDatum[], from: string, to: string): Activity[];
|
|
24
|
+
declare function ActivityCalendar({ data, from, to, locale, labels, valueFormatter, className, ...props }: ActivityCalendarProps): import("react").JSX.Element;
|
|
25
|
+
export { ActivityCalendar, activityCalendarData };
|
|
26
|
+
export type { ActivityCalendarDatum, ActivityCalendarLabels, ActivityCalendarProps };
|
|
27
|
+
//# sourceMappingURL=activity-calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-calendar.d.ts","sourceRoot":"","sources":["../../src/components/activity-calendar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAML,KAAK,QAAQ,EACd,MAAM,uCAAuC,CAAC;AAG/C,KAAK,qBAAqB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,KAAK,sBAAsB,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,qBAAqB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG;IAC9E,IAAI,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C,CAAC;AAwBF,iBAAS,oBAAoB,CAC3B,IAAI,EAAE,SAAS,qBAAqB,EAAE,EACtC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,QAAQ,EAAE,CAKZ;AAeD,iBAAS,gBAAgB,CAAC,EACxB,IAAI,EACJ,IAAI,EACJ,EAAE,EACF,MAAM,EACN,MAAM,EACN,cAAuE,EACvE,SAAS,EACT,GAAG,KAAK,EACT,EAAE,qBAAqB,+BAwCvB;AAED,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,CAAC;AAClD,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CalendarHeatmap, CalendarHeatmapBlock, CalendarHeatmapBody, CalendarHeatmapFooter, CalendarHeatmapLegend, } from "./heatmap/calendar-heatmap.js";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
const ISO_DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
6
|
+
function utcDay(day) {
|
|
7
|
+
if (!ISO_DAY.test(day))
|
|
8
|
+
throw new RangeError(`${day} is not an ISO day`);
|
|
9
|
+
const date = new Date(`${day}T00:00:00.000Z`);
|
|
10
|
+
if (Number.isNaN(date.getTime()) || date.toISOString().slice(0, 10) !== day) {
|
|
11
|
+
throw new RangeError(`${day} is not an ISO day`);
|
|
12
|
+
}
|
|
13
|
+
return date;
|
|
14
|
+
}
|
|
15
|
+
function activityDays(from, to) {
|
|
16
|
+
const start = utcDay(from).getTime();
|
|
17
|
+
const end = utcDay(to).getTime();
|
|
18
|
+
if (end < start)
|
|
19
|
+
throw new RangeError("Activity range ends before it starts");
|
|
20
|
+
const days = Math.floor((end - start) / 86_400_000) + 1;
|
|
21
|
+
return Array.from({ length: days }, (_, index) => new Date(start + index * 86_400_000).toISOString().slice(0, 10));
|
|
22
|
+
}
|
|
23
|
+
function activityCalendarData(data, from, to) {
|
|
24
|
+
const values = new Map(data.map((entry) => [entry.date, Number.isFinite(entry.value) ? entry.value : null]));
|
|
25
|
+
return activityDays(from, to).map((date) => ({ date, value: values.get(date) ?? null }));
|
|
26
|
+
}
|
|
27
|
+
function localizedCalendarLabels(locale) {
|
|
28
|
+
const months = new Intl.DateTimeFormat(locale, { month: "short", timeZone: "UTC" });
|
|
29
|
+
const weekdays = new Intl.DateTimeFormat(locale, { weekday: "short", timeZone: "UTC" });
|
|
30
|
+
return {
|
|
31
|
+
months: Array.from({ length: 12 }, (_, month) => months.format(new Date(Date.UTC(2024, month, 1)))),
|
|
32
|
+
weekdays: Array.from({ length: 7 }, (_, day) => weekdays.format(new Date(Date.UTC(2024, 0, 7 + day)))),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function ActivityCalendar({ data, from, to, locale, labels, valueFormatter = (value) => new Intl.NumberFormat(locale).format(value), className, ...props }) {
|
|
36
|
+
const calendarData = activityCalendarData(data, from, to);
|
|
37
|
+
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
38
|
+
dateStyle: "medium",
|
|
39
|
+
timeZone: "UTC",
|
|
40
|
+
});
|
|
41
|
+
const localizedLabels = localizedCalendarLabels(locale);
|
|
42
|
+
return (_jsxs(CalendarHeatmap, { data: calendarData, weekStart: 1, continuousMonths: true, singleRow: true, className: cn("w-full p-0", className), labels: {
|
|
43
|
+
...localizedLabels,
|
|
44
|
+
unavailable: labels.unavailable,
|
|
45
|
+
heatmapLabel: labels.ariaLabel,
|
|
46
|
+
legendLabel: labels.legend,
|
|
47
|
+
legendLevelLabel: labels.legendLevel,
|
|
48
|
+
cellLabel: (activity) => {
|
|
49
|
+
const date = dateFormatter.format(utcDay(activity.date));
|
|
50
|
+
return activity.value === null
|
|
51
|
+
? `${date}: ${labels.unavailable}`
|
|
52
|
+
: `${date}: ${valueFormatter(activity.value)}`;
|
|
53
|
+
},
|
|
54
|
+
}, ...props, children: [_jsx(CalendarHeatmapBody, { hideYearLabels: true, children: ({ activity, dayIndex, weekIndex }) => (_jsx(CalendarHeatmapBlock, { activity: activity, dayIndex: dayIndex, weekIndex: weekIndex })) }), _jsx(CalendarHeatmapFooter, { children: _jsx(CalendarHeatmapLegend, { labels: { less: labels.less, more: labels.more } }) })] }));
|
|
55
|
+
}
|
|
56
|
+
export { ActivityCalendar, activityCalendarData };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
2
|
+
import { type AgentOrbForm, type AgentOrbSize } from "../internal/agent-orb.js";
|
|
3
|
+
export type { AgentOrbForm, AgentOrbSize } from "../internal/agent-orb.js";
|
|
4
|
+
import type { AgentOrbState } from "../internal/agent-orb-motion.js";
|
|
5
|
+
export type { AgentOrbState } from "../internal/agent-orb-motion.js";
|
|
6
|
+
export type AgentOrbProps = {
|
|
7
|
+
form: AgentOrbForm;
|
|
8
|
+
color?: CSSProperties["color"];
|
|
9
|
+
size?: AgentOrbSize;
|
|
10
|
+
paused?: boolean;
|
|
11
|
+
state?: AgentOrbState;
|
|
12
|
+
motionKey?: number;
|
|
13
|
+
className?: string;
|
|
14
|
+
} & ({
|
|
15
|
+
decorative: true;
|
|
16
|
+
label?: never;
|
|
17
|
+
} | {
|
|
18
|
+
decorative?: false;
|
|
19
|
+
label: string;
|
|
20
|
+
});
|
|
21
|
+
export declare function AgentOrb({ form, color, size, paused, state, motionKey, decorative, label, className, }: AgentOrbProps): import("react").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=agent-orb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-orb.d.ts","sourceRoot":"","sources":["../../src/components/agent-orb.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAqB,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAiB,MAAM,uBAAuB,CAAC;AAG5F,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,CAAC;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,UAAU,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAElF,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,KAAK,EACL,IAAS,EACT,MAAc,EACd,KAAc,EACd,SAAa,EACb,UAAkB,EAClB,KAAK,EACL,SAAS,GACV,EAAE,aAAa,+BAyCf"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { mountAgentOrb } from "../internal/agent-orb.js";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
export function AgentOrb({ form, color, size = 32, paused = false, state = "idle", motionKey = 0, decorative = false, label, className, }) {
|
|
7
|
+
const canvas = useRef(null);
|
|
8
|
+
const renderer = useRef(null);
|
|
9
|
+
const pause = useRef(paused);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!canvas.current)
|
|
12
|
+
return;
|
|
13
|
+
const mounted = mountAgentOrb(canvas.current, form, size, pause.current);
|
|
14
|
+
renderer.current = mounted;
|
|
15
|
+
return () => {
|
|
16
|
+
mounted.destroy();
|
|
17
|
+
renderer.current = null;
|
|
18
|
+
};
|
|
19
|
+
}, [form, size]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
pause.current = paused;
|
|
22
|
+
renderer.current?.setPaused(paused);
|
|
23
|
+
}, [paused, form, size]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
renderer.current?.setState(state);
|
|
26
|
+
}, [state, motionKey, form, size]);
|
|
27
|
+
return (_jsx("canvas", { ref: canvas, "data-slot": "agent-orb", "data-form": form, "data-state": state, role: decorative ? undefined : "img", "aria-hidden": decorative || undefined, "aria-label": decorative ? undefined : label, className: cn("inline-block shrink-0 align-middle", className), width: size, height: size, style: { color, width: size, height: size }, children: decorative ? null : label }));
|
|
28
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ChartCardProps } from "./chart-card.js";
|
|
2
|
-
declare function ChartAreaStacked({ title, description, action, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter, axisFormatter, otherLabel, emptyState, size, className, }: ChartCardProps): import("react").JSX.Element;
|
|
2
|
+
declare function ChartAreaStacked({ title, description, action, summary, aside, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter, axisFormatter, otherLabel, emptyState, size, className, }: ChartCardProps): import("react").JSX.Element;
|
|
3
3
|
export { ChartAreaStacked };
|
|
4
4
|
//# sourceMappingURL=chart-area-stacked.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-area-stacked.d.ts","sourceRoot":"","sources":["../../src/components/chart-area-stacked.tsx"],"names":[],"mappings":"AAcA,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,WAAW,EACX,MAAM,EACN,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,cAAc,EACd,cAAsC,EACtC,aAAa,EACb,UAAoB,EACpB,UAAU,EACV,IAAgB,EAChB,SAAS,GACV,EAAE,cAAc,+
|
|
1
|
+
{"version":3,"file":"chart-area-stacked.d.ts","sourceRoot":"","sources":["../../src/components/chart-area-stacked.tsx"],"names":[],"mappings":"AAcA,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,cAAc,EACd,cAAsC,EACtC,aAAa,EACb,UAAoB,EACpB,UAAU,EACV,IAAgB,EAChB,SAAS,GACV,EAAE,cAAc,+BA0EhB;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -7,11 +7,11 @@ import { ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartToo
|
|
|
7
7
|
import { CHART_Y_AXIS_TICK_COUNT, niceAxisTicks, stackedAxisMax } from "./chart-axis.js";
|
|
8
8
|
import { CHART_LEGEND_CLASS, ChartCard, chartPlotClassName, chartSeriesConfig, defaultValueFormatter, foldOtherSeries, } from "./chart-card.js";
|
|
9
9
|
import { entityColor } from "./chart-entity-colors.js";
|
|
10
|
-
function ChartAreaStacked({ title, description, action, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter = defaultValueFormatter, axisFormatter, otherLabel = "Other", emptyState, size = "default", className, }) {
|
|
10
|
+
function ChartAreaStacked({ title, description, action, summary, aside, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter = defaultValueFormatter, axisFormatter, otherLabel = "Other", emptyState, size = "default", className, }) {
|
|
11
11
|
const folded = foldOtherSeries(series, data, entityColorMap, otherLabel);
|
|
12
12
|
const chartConfig = chartSeriesConfig(folded.series, entityColorMap);
|
|
13
13
|
const domainMax = stackedAxisMax(folded.data, folded.series.map((entry) => entry.id));
|
|
14
|
-
return (_jsx(ChartCard, { title: title, description: description, action: action, footer: footer, ...(headingLevel ? { headingLevel } : {}), className: className, children: (titleId) => emptyState && data.length === 0 ? (emptyState) : (_jsx(ChartContainer, { config: chartConfig, className: chartPlotClassName(size), children: _jsxs(AreaChart, { accessibilityLayer: true, "aria-labelledby": titleId, data: folded.data, margin: {
|
|
14
|
+
return (_jsx(ChartCard, { title: title, description: description, action: action, summary: summary, aside: aside, footer: footer, ...(headingLevel ? { headingLevel } : {}), className: className, children: (titleId) => emptyState && data.length === 0 ? (emptyState) : (_jsx(ChartContainer, { config: chartConfig, className: chartPlotClassName(size), children: _jsxs(AreaChart, { accessibilityLayer: true, "aria-labelledby": titleId, data: folded.data, margin: {
|
|
15
15
|
left: 12,
|
|
16
16
|
right: 12,
|
|
17
17
|
}, children: [_jsx(CartesianGrid, { strokeDasharray: "3 3" }), _jsx(XAxis, { dataKey: xKey, tickLine: false, axisLine: false, tickMargin: 8 }), _jsx(YAxis, { width: "auto", tickLine: false, axisLine: false, tickMargin: 8, tickCount: CHART_Y_AXIS_TICK_COUNT, ...(domainMax === undefined
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ChartCardProps } from "./chart-card.js";
|
|
2
|
+
declare function signedAxis(data: readonly Record<string, number | string>[], valueKey: string): {
|
|
3
|
+
domain: readonly [number, number];
|
|
4
|
+
ticks: number[];
|
|
5
|
+
};
|
|
6
|
+
declare function ChartBarHorizontal({ title, description, action, summary, aside, footer, headingLevel, data, xKey, valueKey, displayKey, categoryDisplayKey, positiveLabel, negativeLabel, valueFormatter, axisFormatter, emptyState, size, className, }: Omit<ChartCardProps, "series" | "entityColorMap"> & {
|
|
7
|
+
valueKey: string;
|
|
8
|
+
displayKey?: string;
|
|
9
|
+
categoryDisplayKey?: string;
|
|
10
|
+
positiveLabel: string;
|
|
11
|
+
negativeLabel: string;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
export { ChartBarHorizontal, signedAxis };
|
|
14
|
+
//# sourceMappingURL=chart-bar-horizontal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-bar-horizontal.d.ts","sourceRoot":"","sources":["../../src/components/chart-bar-horizontal.tsx"],"names":[],"mappings":"AAaA,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAOjC,iBAAS,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM;;;EAoCrF;AAED,iBAAS,kBAAkB,CAAC,EAC1B,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,cAAsC,EACtC,aAAa,EACb,UAAU,EACV,IAAgB,EAChB,SAAS,GACV,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,gBAAgB,CAAC,GAAG;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB,+BAyGA;AAED,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Pulled from the shadcn registry item `chart-bar-horizontal`.
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Bar, BarChart, CartesianGrid, ReferenceLine, XAxis, YAxis } from "recharts";
|
|
5
|
+
import { ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, } from "./chart.js";
|
|
6
|
+
import { niceAxisMax, niceAxisTicks, niceStep } from "./chart-axis.js";
|
|
7
|
+
import { CHART_LEGEND_CLASS, ChartCard, chartPlotClassName, defaultValueFormatter, } from "./chart-card.js";
|
|
8
|
+
const POSITIVE_KEY = "__positive";
|
|
9
|
+
const NEGATIVE_KEY = "__negative";
|
|
10
|
+
const POSITIVE_BAR_COLOR = "var(--nc-success)";
|
|
11
|
+
const NEGATIVE_BAR_COLOR = "var(--destructive)";
|
|
12
|
+
function signedAxis(data, valueKey) {
|
|
13
|
+
const values = data.flatMap((datum) => {
|
|
14
|
+
const value = datum[valueKey];
|
|
15
|
+
return typeof value === "number" && Number.isFinite(value) ? [value] : [];
|
|
16
|
+
});
|
|
17
|
+
const minimum = Math.min(0, ...values);
|
|
18
|
+
const maximum = Math.max(0, ...values);
|
|
19
|
+
if (minimum === 0) {
|
|
20
|
+
const bound = niceAxisMax(maximum) ?? 1;
|
|
21
|
+
return { domain: [0, bound], ticks: niceAxisTicks(bound) ?? [0, bound] };
|
|
22
|
+
}
|
|
23
|
+
if (maximum === 0) {
|
|
24
|
+
const bound = niceAxisMax(Math.abs(minimum)) ?? 1;
|
|
25
|
+
return {
|
|
26
|
+
domain: [-bound, 0],
|
|
27
|
+
ticks: (niceAxisTicks(bound) ?? [0, bound]).map((value) => -value).reverse(),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const intervals = 4;
|
|
31
|
+
const positiveIntervals = Math.min(3, Math.max(1, Math.round((maximum / (maximum + Math.abs(minimum))) * intervals)));
|
|
32
|
+
const negativeIntervals = intervals - positiveIntervals;
|
|
33
|
+
const positiveStep = niceStep(maximum / positiveIntervals);
|
|
34
|
+
const negativeStep = niceStep(Math.abs(minimum) / negativeIntervals);
|
|
35
|
+
const negativeTicks = Array.from({ length: negativeIntervals }, (_unused, index) => -negativeStep * (negativeIntervals - index));
|
|
36
|
+
const positiveTicks = Array.from({ length: positiveIntervals }, (_unused, index) => positiveStep * (index + 1));
|
|
37
|
+
const ticks = [...negativeTicks, 0, ...positiveTicks];
|
|
38
|
+
return { domain: [ticks[0] ?? minimum, ticks.at(-1) ?? maximum], ticks };
|
|
39
|
+
}
|
|
40
|
+
function ChartBarHorizontal({ title, description, action, summary, aside, footer, headingLevel, data, xKey, valueKey, displayKey, categoryDisplayKey, positiveLabel, negativeLabel, valueFormatter = defaultValueFormatter, axisFormatter, emptyState, size = "default", className, }) {
|
|
41
|
+
const axis = signedAxis(data, valueKey);
|
|
42
|
+
const signedData = data.map((datum) => {
|
|
43
|
+
const value = datum[valueKey];
|
|
44
|
+
const numeric = typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
45
|
+
return {
|
|
46
|
+
...datum,
|
|
47
|
+
[POSITIVE_KEY]: numeric > 0 ? numeric : 0,
|
|
48
|
+
[NEGATIVE_KEY]: numeric < 0 ? numeric : 0,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const chartConfig = {
|
|
52
|
+
[POSITIVE_KEY]: { label: positiveLabel, color: POSITIVE_BAR_COLOR },
|
|
53
|
+
[NEGATIVE_KEY]: { label: negativeLabel, color: NEGATIVE_BAR_COLOR },
|
|
54
|
+
};
|
|
55
|
+
return (_jsx(ChartCard, { title: title, description: description, action: action, summary: summary, aside: aside, footer: footer, ...(headingLevel ? { headingLevel } : {}), className: className, children: (titleId) => emptyState && data.length === 0 ? (emptyState) : (_jsx(ChartContainer, { config: chartConfig, className: chartPlotClassName(size), children: _jsxs(BarChart, { accessibilityLayer: true, "aria-labelledby": titleId, data: signedData, layout: "vertical", margin: { left: 8, right: 16 }, children: [_jsx(CartesianGrid, { horizontal: false, strokeDasharray: "3 3" }), _jsx(XAxis, { type: "number", domain: axis.domain, ticks: axis.ticks, tickLine: false, axisLine: false, tickMargin: 8, tickFormatter: (value) => (axisFormatter ?? valueFormatter)(Number(value)) }), _jsx(YAxis, { type: "category", dataKey: xKey, width: 112, tickLine: false, axisLine: false, tickMargin: 8 }), _jsx(ReferenceLine, { x: 0, stroke: "var(--border)", strokeWidth: 1.5 }), _jsx(ChartTooltip, { cursor: false, content: _jsx(ChartTooltipContent, { indicator: "line", labelFormatter: (_label, payload) => {
|
|
56
|
+
const exact = categoryDisplayKey
|
|
57
|
+
? payload?.[0]?.payload?.[categoryDisplayKey]
|
|
58
|
+
: undefined;
|
|
59
|
+
return typeof exact === "string" ? exact : _label;
|
|
60
|
+
}, formatter: (value, _name, item) => {
|
|
61
|
+
if (Number(value) === 0)
|
|
62
|
+
return null;
|
|
63
|
+
const exact = displayKey ? item.payload?.[displayKey] : undefined;
|
|
64
|
+
return (_jsx("span", { className: "ml-auto font-mono font-medium text-foreground tabular-nums", children: typeof exact === "string" ? exact : valueFormatter(Number(value)) }));
|
|
65
|
+
} }) }), _jsx(ChartLegend, { itemSorter: null, content: _jsx(ChartLegendContent, { className: CHART_LEGEND_CLASS }) }), _jsx(Bar, { dataKey: POSITIVE_KEY, stackId: "signed", fill: POSITIVE_BAR_COLOR, radius: [0, 4, 4, 0], maxBarSize: 32 }), _jsx(Bar, { dataKey: NEGATIVE_KEY, stackId: "signed", fill: NEGATIVE_BAR_COLOR, radius: [4, 0, 0, 4], maxBarSize: 32 })] }) })) }));
|
|
66
|
+
}
|
|
67
|
+
export { ChartBarHorizontal, signedAxis };
|
|
@@ -4,6 +4,6 @@ import { type ChartCardProps } from "./chart-card.js";
|
|
|
4
4
|
* one unit. A rate over those measures (a margin percentage) is a KPI card, not
|
|
5
5
|
* a second axis on this plot.
|
|
6
6
|
*/
|
|
7
|
-
declare function ChartBarMultiple({ title, description, action, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter, axisFormatter, otherLabel, emptyState, size, className, }: ChartCardProps): import("react").JSX.Element;
|
|
7
|
+
declare function ChartBarMultiple({ title, description, action, summary, aside, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter, axisFormatter, otherLabel, emptyState, size, className, }: ChartCardProps): import("react").JSX.Element;
|
|
8
8
|
export { ChartBarMultiple };
|
|
9
9
|
//# sourceMappingURL=chart-bar-multiple.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-bar-multiple.d.ts","sourceRoot":"","sources":["../../src/components/chart-bar-multiple.tsx"],"names":[],"mappings":"AAcA,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,WAAW,EACX,MAAM,EACN,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,cAAc,EACd,cAAsC,EACtC,aAAa,EACb,UAAoB,EACpB,UAAU,EACV,IAAgB,EAChB,SAAS,GACV,EAAE,cAAc,+
|
|
1
|
+
{"version":3,"file":"chart-bar-multiple.d.ts","sourceRoot":"","sources":["../../src/components/chart-bar-multiple.tsx"],"names":[],"mappings":"AAcA,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,cAAc,EACd,cAAsC,EACtC,aAAa,EACb,UAAoB,EACpB,UAAU,EACV,IAAgB,EAChB,SAAS,GACV,EAAE,cAAc,+BAgEhB;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -12,11 +12,11 @@ import { entityColor } from "./chart-entity-colors.js";
|
|
|
12
12
|
* one unit. A rate over those measures (a margin percentage) is a KPI card, not
|
|
13
13
|
* a second axis on this plot.
|
|
14
14
|
*/
|
|
15
|
-
function ChartBarMultiple({ title, description, action, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter = defaultValueFormatter, axisFormatter, otherLabel = "Other", emptyState, size = "default", className, }) {
|
|
15
|
+
function ChartBarMultiple({ title, description, action, summary, aside, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter = defaultValueFormatter, axisFormatter, otherLabel = "Other", emptyState, size = "default", className, }) {
|
|
16
16
|
const folded = foldOtherSeries(series, data, entityColorMap, otherLabel);
|
|
17
17
|
const chartConfig = chartSeriesConfig(folded.series, entityColorMap);
|
|
18
18
|
const domainMax = seriesAxisMax(folded.data, folded.series.map((entry) => entry.id));
|
|
19
|
-
return (_jsx(ChartCard, { title: title, description: description, action: action, footer: footer, ...(headingLevel ? { headingLevel } : {}), className: className, children: (titleId) => emptyState && data.length === 0 ? (emptyState) : (_jsx(ChartContainer, { config: chartConfig, className: chartPlotClassName(size), children: _jsxs(BarChart, { accessibilityLayer: true, "aria-labelledby": titleId, data: folded.data, children: [_jsx(CartesianGrid, { strokeDasharray: "3 3" }), _jsx(XAxis, { dataKey: xKey, tickLine: false, tickMargin: 10, axisLine: false }), _jsx(YAxis, { width: "auto", tickLine: false, axisLine: false, tickMargin: 8, tickCount: CHART_Y_AXIS_TICK_COUNT, ...(domainMax === undefined
|
|
19
|
+
return (_jsx(ChartCard, { title: title, description: description, action: action, summary: summary, aside: aside, footer: footer, ...(headingLevel ? { headingLevel } : {}), className: className, children: (titleId) => emptyState && data.length === 0 ? (emptyState) : (_jsx(ChartContainer, { config: chartConfig, className: chartPlotClassName(size), children: _jsxs(BarChart, { accessibilityLayer: true, "aria-labelledby": titleId, data: folded.data, children: [_jsx(CartesianGrid, { strokeDasharray: "3 3" }), _jsx(XAxis, { dataKey: xKey, tickLine: false, tickMargin: 10, axisLine: false }), _jsx(YAxis, { width: "auto", tickLine: false, axisLine: false, tickMargin: 8, tickCount: CHART_Y_AXIS_TICK_COUNT, ...(domainMax === undefined
|
|
20
20
|
? {}
|
|
21
21
|
: {
|
|
22
22
|
domain: [0, domainMax],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ChartCardProps } from "./chart-card.js";
|
|
2
|
-
declare function ChartBarStacked({ title, description, action, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter, axisFormatter, otherLabel, emptyState, size, share, className, }: ChartCardProps & {
|
|
2
|
+
declare function ChartBarStacked({ title, description, action, summary, aside, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter, axisFormatter, otherLabel, emptyState, size, share, className, }: ChartCardProps & {
|
|
3
3
|
/**
|
|
4
4
|
* One bar across the card, each entity a segment of 100%: the share of a
|
|
5
5
|
* total with no time axis. `data` is then a single row keyed by series id.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-bar-stacked.d.ts","sourceRoot":"","sources":["../../src/components/chart-bar-stacked.tsx"],"names":[],"mappings":"AAcA,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAmBjC,iBAAS,eAAe,CAAC,EACvB,KAAK,EACL,WAAW,EACX,MAAM,EACN,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,cAAc,EACd,cAAsC,EACtC,aAAa,EACb,UAAoB,EACpB,UAAU,EACV,IAAgB,EAChB,KAAa,EACb,SAAS,GACV,EAAE,cAAc,GAAG;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,+
|
|
1
|
+
{"version":3,"file":"chart-bar-stacked.d.ts","sourceRoot":"","sources":["../../src/components/chart-bar-stacked.tsx"],"names":[],"mappings":"AAcA,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAmBjC,iBAAS,eAAe,CAAC,EACvB,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,cAAc,EACd,cAAsC,EACtC,aAAa,EACb,UAAoB,EACpB,UAAU,EACV,IAAgB,EAChB,KAAa,EACb,SAAS,GACV,EAAE,cAAc,GAAG;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,+BAgGA;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -27,11 +27,11 @@ function shareRadius(index, count) {
|
|
|
27
27
|
return [0, 4, 4, 0];
|
|
28
28
|
return [0, 0, 0, 0];
|
|
29
29
|
}
|
|
30
|
-
function ChartBarStacked({ title, description, action, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter = defaultValueFormatter, axisFormatter, otherLabel = "Other", emptyState, size = "default", share = false, className, }) {
|
|
30
|
+
function ChartBarStacked({ title, description, action, summary, aside, footer, headingLevel, data, xKey, series, entityColorMap, valueFormatter = defaultValueFormatter, axisFormatter, otherLabel = "Other", emptyState, size = "default", share = false, className, }) {
|
|
31
31
|
const folded = foldOtherSeries(series, data, entityColorMap, otherLabel);
|
|
32
32
|
const chartConfig = chartSeriesConfig(folded.series, entityColorMap);
|
|
33
33
|
const domainMax = stackedAxisMax(folded.data, folded.series.map((entry) => entry.id));
|
|
34
|
-
return (_jsx(ChartCard, { title: title, description: description, action: action, footer: footer, ...(headingLevel ? { headingLevel } : {}), className: className, children: (titleId) => emptyState && data.length === 0 ? (emptyState) : share ? (_jsx(ChartContainer, { config: chartConfig, className: "aspect-auto h-16 w-full", children: _jsxs(BarChart, { accessibilityLayer: true, "aria-labelledby": titleId, data: folded.data, layout: "vertical", stackOffset: "expand", children: [_jsx(XAxis, { type: "number", hide: true }), _jsx(YAxis, { type: "category", dataKey: xKey, hide: true }), _jsx(ChartTooltip, { cursor: false, content: _jsx(ChartTooltipContent, { hideLabel: true, indicator: "line", valueFormatter: valueFormatter }) }), _jsx(ChartLegend, { itemSorter: null, content: _jsx(ChartLegendContent, { className: CHART_LEGEND_CLASS }) }), folded.series.map((entry, index) => (_jsx(Bar, { dataKey: entry.id, stackId: "a", fill: entityColor(entityColorMap, entry.id), radius: shareRadius(index, folded.series.length) }, entry.id)))] }) })) : (_jsx(ChartContainer, { config: chartConfig, className: chartPlotClassName(size), children: _jsxs(BarChart, { accessibilityLayer: true, "aria-labelledby": titleId, data: folded.data, children: [_jsx(CartesianGrid, { strokeDasharray: "3 3" }), _jsx(XAxis, { dataKey: xKey, tickLine: false, tickMargin: 10, axisLine: false }), _jsx(YAxis, { width: "auto", tickLine: false, axisLine: false, tickMargin: 8, tickCount: CHART_Y_AXIS_TICK_COUNT, ...(domainMax === undefined
|
|
34
|
+
return (_jsx(ChartCard, { title: title, description: description, action: action, summary: summary, aside: aside, footer: footer, ...(headingLevel ? { headingLevel } : {}), className: className, children: (titleId) => emptyState && data.length === 0 ? (emptyState) : share ? (_jsx(ChartContainer, { config: chartConfig, className: "aspect-auto h-16 w-full", children: _jsxs(BarChart, { accessibilityLayer: true, "aria-labelledby": titleId, data: folded.data, layout: "vertical", stackOffset: "expand", children: [_jsx(XAxis, { type: "number", hide: true }), _jsx(YAxis, { type: "category", dataKey: xKey, hide: true }), _jsx(ChartTooltip, { cursor: false, content: _jsx(ChartTooltipContent, { hideLabel: true, indicator: "line", valueFormatter: valueFormatter }) }), _jsx(ChartLegend, { itemSorter: null, content: _jsx(ChartLegendContent, { className: CHART_LEGEND_CLASS }) }), folded.series.map((entry, index) => (_jsx(Bar, { dataKey: entry.id, stackId: "a", fill: entityColor(entityColorMap, entry.id), radius: shareRadius(index, folded.series.length) }, entry.id)))] }) })) : (_jsx(ChartContainer, { config: chartConfig, className: chartPlotClassName(size), children: _jsxs(BarChart, { accessibilityLayer: true, "aria-labelledby": titleId, data: folded.data, children: [_jsx(CartesianGrid, { strokeDasharray: "3 3" }), _jsx(XAxis, { dataKey: xKey, tickLine: false, tickMargin: 10, axisLine: false }), _jsx(YAxis, { width: "auto", tickLine: false, axisLine: false, tickMargin: 8, tickCount: CHART_Y_AXIS_TICK_COUNT, ...(domainMax === undefined
|
|
35
35
|
? {}
|
|
36
36
|
: {
|
|
37
37
|
domain: [0, domainMax],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ChartConfig } from "./chart.js";
|
|
3
3
|
import { type EntityColorMap } from "./chart-entity-colors.js";
|
|
4
|
+
import { type TrendDirection, type TrendTone } from "./trend-badge.js";
|
|
4
5
|
/**
|
|
5
6
|
* chart-card — the Card frame and series plumbing every chart in this kit
|
|
6
7
|
* renders, so the four registry blocks (`chart-bar-stacked`,
|
|
@@ -17,6 +18,21 @@ type ChartSeries = {
|
|
|
17
18
|
};
|
|
18
19
|
type ChartDatum = Record<string, number | string>;
|
|
19
20
|
type ChartCardSize = "default" | "lg";
|
|
21
|
+
type ChartSummaryTrend = {
|
|
22
|
+
value: React.ReactNode;
|
|
23
|
+
direction: TrendDirection;
|
|
24
|
+
tone: TrendTone;
|
|
25
|
+
comparison: React.ReactNode;
|
|
26
|
+
directionLabel?: string;
|
|
27
|
+
};
|
|
28
|
+
type ChartSummaryProps = {
|
|
29
|
+
label: React.ReactNode;
|
|
30
|
+
value: React.ReactNode;
|
|
31
|
+
valueTitle?: string;
|
|
32
|
+
valueSize?: ChartCardSize;
|
|
33
|
+
trend?: ChartSummaryTrend;
|
|
34
|
+
status?: React.ReactNode;
|
|
35
|
+
};
|
|
20
36
|
type ChartCardProps = {
|
|
21
37
|
title: React.ReactNode;
|
|
22
38
|
description?: React.ReactNode;
|
|
@@ -24,6 +40,10 @@ type ChartCardProps = {
|
|
|
24
40
|
headingLevel?: 2 | 3 | 4;
|
|
25
41
|
/** Trailing header slot, e.g. an "Explore" link. */
|
|
26
42
|
action?: React.ReactNode;
|
|
43
|
+
/** A measured summary between the header and plot. */
|
|
44
|
+
summary?: React.ReactNode;
|
|
45
|
+
/** Related ranking or breakdown beside the plot on wide cards. */
|
|
46
|
+
aside?: React.ReactNode;
|
|
27
47
|
footer?: React.ReactNode;
|
|
28
48
|
data: readonly ChartDatum[];
|
|
29
49
|
/** The datum key carrying the category or period. */
|
|
@@ -56,10 +76,11 @@ declare function foldOtherSeries(series: readonly ChartSeries[], data: readonly
|
|
|
56
76
|
series: ChartSeries[];
|
|
57
77
|
data: ChartDatum[];
|
|
58
78
|
};
|
|
59
|
-
declare function ChartCard({ title, description, action, footer, headingLevel, className, children, }: Pick<ChartCardProps, "title" | "description" | "action" | "footer" | "headingLevel" | "className"> & {
|
|
79
|
+
declare function ChartCard({ title, description, action, summary, aside, footer, headingLevel, className, children, }: Pick<ChartCardProps, "title" | "description" | "action" | "summary" | "aside" | "footer" | "headingLevel" | "className"> & {
|
|
60
80
|
/** Receives the title's id, which the plot takes as `aria-labelledby`. */
|
|
61
81
|
children: (titleId: string) => React.ReactNode;
|
|
62
82
|
}): React.JSX.Element;
|
|
83
|
+
declare function ChartSummary({ label, value, valueTitle, valueSize, trend, status, }: ChartSummaryProps): React.JSX.Element;
|
|
63
84
|
/** The plot frame class: fixed height, no aspect ratio, full width. */
|
|
64
85
|
declare function chartPlotClassName(size: ChartCardSize): string;
|
|
65
86
|
/**
|
|
@@ -70,6 +91,6 @@ declare function chartPlotClassName(size: ChartCardSize): string;
|
|
|
70
91
|
declare const CHART_FOCUS_CLASS = "[&_.recharts-surface:focus-visible]:nc-focus-outline [&_.recharts-surface:focus-visible]:outline-ring";
|
|
71
92
|
/** Legend below the plot, left-aligned, wrapping to a second line. */
|
|
72
93
|
declare const CHART_LEGEND_CLASS = "flex-wrap justify-start";
|
|
73
|
-
export { CHART_FOCUS_CLASS, CHART_LEGEND_CLASS, ChartCard, chartPlotClassName, chartSeriesConfig, defaultValueFormatter, foldOtherSeries, };
|
|
74
|
-
export type { ChartCardProps, ChartCardSize, ChartDatum, ChartSeries };
|
|
94
|
+
export { CHART_FOCUS_CLASS, CHART_LEGEND_CLASS, ChartCard, ChartSummary, chartPlotClassName, chartSeriesConfig, defaultValueFormatter, foldOtherSeries, };
|
|
95
|
+
export type { ChartCardProps, ChartCardSize, ChartDatum, ChartSeries, ChartSummaryProps, ChartSummaryTrend, };
|
|
75
96
|
//# sourceMappingURL=chart-card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-card.d.ts","sourceRoot":"","sources":["../../src/components/chart-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"chart-card.d.ts","sourceRoot":"","sources":["../../src/components/chart-card.tsx"],"names":[],"mappings":"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"}
|
|
@@ -4,6 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "./card.js";
|
|
6
6
|
import { CHART_ENTITY_OTHER_COLOR, entityColor, } from "./chart-entity-colors.js";
|
|
7
|
+
import { TrendBadge } from "./trend-badge.js";
|
|
7
8
|
/** Fixed plot heights, so charts on a page share one register. */
|
|
8
9
|
const chartSizes = {
|
|
9
10
|
default: "h-64",
|
|
@@ -52,9 +53,13 @@ function foldOtherSeries(series, data, entityColorMap, otherLabel) {
|
|
|
52
53
|
});
|
|
53
54
|
return { series: folded, data: foldedData };
|
|
54
55
|
}
|
|
55
|
-
function ChartCard({ title, description, action, footer, headingLevel = 2, className, children, }) {
|
|
56
|
+
function ChartCard({ title, description, action, summary, aside, footer, headingLevel = 2, className, children, }) {
|
|
56
57
|
const titleId = React.useId();
|
|
57
|
-
return (_jsxs(Card, { "data-slot": "chart-card", className: className, children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { id: titleId, role: "heading", "aria-level": headingLevel, children: title }), description ? _jsx(CardDescription, { children: description }) : null, action ? _jsx(CardAction, { children: action }) : null] }),
|
|
58
|
+
return (_jsxs(Card, { "data-slot": "chart-card", className: cn("@container/chart-card", className), children: [_jsxs(CardHeader, { className: "has-data-[slot=card-action]:grid-cols-1 [&>[data-slot=card-action]]:col-start-1 [&>[data-slot=card-action]]:row-span-1 [&>[data-slot=card-action]]:row-start-3 [&>[data-slot=card-action]]:justify-self-start @md/chart-card:has-data-[slot=card-action]:grid-cols-[1fr_auto] @md/chart-card:[&>[data-slot=card-action]]:col-start-2 @md/chart-card:[&>[data-slot=card-action]]:row-span-2 @md/chart-card:[&>[data-slot=card-action]]:row-start-1 @md/chart-card:[&>[data-slot=card-action]]:justify-self-end", children: [_jsx(CardTitle, { id: titleId, role: "heading", "aria-level": headingLevel, children: title }), description ? _jsx(CardDescription, { children: description }) : null, action ? _jsx(CardAction, { children: action }) : null] }), summary ? (_jsx("div", { "data-slot": "chart-card-summary", className: "px-(--card-spacing)", children: summary })) : null, _jsxs(CardContent, { className: cn(aside &&
|
|
59
|
+
"grid min-w-0 gap-(--card-spacing) lg:grid-cols-[minmax(0,2fr)_minmax(16rem,1fr)]"), children: [_jsx("div", { className: "min-w-0", children: children(titleId) }), aside ? (_jsx("aside", { "data-slot": "chart-card-aside", className: "min-w-0 border-t border-border pt-(--card-spacing) lg:border-t-0 lg:border-l lg:pt-0 lg:pl-(--card-spacing)", children: aside })) : null] }), footer ? (_jsx(CardFooter, { className: "flex-col items-start gap-2 text-sm", children: footer })) : null] }));
|
|
60
|
+
}
|
|
61
|
+
function ChartSummary({ label, value, valueTitle, valueSize = "default", trend, status, }) {
|
|
62
|
+
return (_jsxs("div", { "data-slot": "chart-summary", className: "flex flex-col items-start gap-2", children: [_jsx("div", { className: "text-muted-foreground text-sm", children: label }), _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-3", children: [_jsx("div", { "data-slot": "chart-summary-value", className: cn("truncate font-semibold tracking-tight tabular-nums", valueSize === "lg" ? "text-3xl" : "text-2xl"), title: valueTitle, children: value }), trend ? (_jsx(TrendBadge, { direction: trend.direction, directionLabel: trend.directionLabel, tone: trend.tone, value: trend.value })) : null, status] }), trend ? (_jsx("div", { "data-slot": "chart-summary-comparison", className: "text-muted-foreground text-sm", children: trend.comparison })) : null] }));
|
|
58
63
|
}
|
|
59
64
|
/** The plot frame class: fixed height, no aspect ratio, full width. */
|
|
60
65
|
function chartPlotClassName(size) {
|
|
@@ -68,4 +73,4 @@ function chartPlotClassName(size) {
|
|
|
68
73
|
const CHART_FOCUS_CLASS = "[&_.recharts-surface:focus-visible]:nc-focus-outline [&_.recharts-surface:focus-visible]:outline-ring";
|
|
69
74
|
/** Legend below the plot, left-aligned, wrapping to a second line. */
|
|
70
75
|
const CHART_LEGEND_CLASS = "flex-wrap justify-start";
|
|
71
|
-
export { CHART_FOCUS_CLASS, CHART_LEGEND_CLASS, ChartCard, chartPlotClassName, chartSeriesConfig, defaultValueFormatter, foldOtherSeries, };
|
|
76
|
+
export { CHART_FOCUS_CLASS, CHART_LEGEND_CLASS, ChartCard, ChartSummary, chartPlotClassName, chartSeriesConfig, defaultValueFormatter, foldOtherSeries, };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { Locale, Day as WeekDay } from "date-fns";
|
|
2
|
+
import type { CSSProperties, HTMLAttributes, ReactNode } from "react";
|
|
3
|
+
export type Activity = {
|
|
4
|
+
date: string;
|
|
5
|
+
value: number | null;
|
|
6
|
+
};
|
|
7
|
+
type ActivityWithLevel = Activity & {
|
|
8
|
+
level: number;
|
|
9
|
+
measured: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type Labels = {
|
|
12
|
+
months?: string[];
|
|
13
|
+
weekdays?: string[];
|
|
14
|
+
stat?: string;
|
|
15
|
+
cellLabel?: string | ((activity: Activity) => string);
|
|
16
|
+
unavailable?: string;
|
|
17
|
+
heatmapLabel?: string;
|
|
18
|
+
legendLabel?: string;
|
|
19
|
+
legendLevelLabel?: string;
|
|
20
|
+
};
|
|
21
|
+
export type ColorConfig = {
|
|
22
|
+
empty?: string;
|
|
23
|
+
scale?: string;
|
|
24
|
+
unavailable?: string;
|
|
25
|
+
};
|
|
26
|
+
export type CalendarHeatmapProps = HTMLAttributes<HTMLDivElement> & {
|
|
27
|
+
data: Activity[];
|
|
28
|
+
weekStart?: WeekDay;
|
|
29
|
+
continuousMonths?: boolean;
|
|
30
|
+
singleRow?: boolean;
|
|
31
|
+
hasEmptyColumn?: boolean;
|
|
32
|
+
blockSize?: number;
|
|
33
|
+
blockMargin?: number;
|
|
34
|
+
blockRadius?: number;
|
|
35
|
+
blockAspectRatio?: number;
|
|
36
|
+
levels?: number;
|
|
37
|
+
isNormalized?: boolean;
|
|
38
|
+
colors?: ColorConfig;
|
|
39
|
+
locale?: Locale;
|
|
40
|
+
labels?: Labels;
|
|
41
|
+
fontSize?: number;
|
|
42
|
+
emptyState?: ReactNode;
|
|
43
|
+
totalCount?: number;
|
|
44
|
+
style?: CSSProperties;
|
|
45
|
+
className?: string;
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Calendar Heatmap
|
|
50
|
+
*
|
|
51
|
+
* A GitHub-style contribution calendar showing daily activity over months and years.
|
|
52
|
+
* Each cell represents one day, arranged in weeks (rows) and months (columns).
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <CalendarHeatmap data={data} weekStart={1} continuousMonths>
|
|
57
|
+
* <CalendarHeatmapBody>
|
|
58
|
+
* {({ activity, dayIndex, weekIndex }) => (
|
|
59
|
+
* <CalendarHeatmapBlock
|
|
60
|
+
* activity={activity}
|
|
61
|
+
* dayIndex={dayIndex}
|
|
62
|
+
* weekIndex={weekIndex}
|
|
63
|
+
* />
|
|
64
|
+
* )}
|
|
65
|
+
* </CalendarHeatmapBody>
|
|
66
|
+
* <CalendarHeatmapFooter>
|
|
67
|
+
* <CalendarHeatmapStat />
|
|
68
|
+
* <CalendarHeatmapLegend />
|
|
69
|
+
* </CalendarHeatmapFooter>
|
|
70
|
+
* </CalendarHeatmap>
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param data - Array of activities with date (YYYY-MM-DD) and value
|
|
74
|
+
* @param weekStart - First day of week (0=Sunday, 1=Monday). Default: 0
|
|
75
|
+
* @param continuousMonths - Display months continuously vs. grouped by year. Default: true
|
|
76
|
+
* @param singleRow - Keep a continuous range in one row across year boundaries. Default: false
|
|
77
|
+
* @param hasEmptyColumn - Add empty column between months. Default: false
|
|
78
|
+
* @param blockAspectRatio - Width/height ratio of blocks. Default: 1
|
|
79
|
+
* @param levels - Total number of legend cells (including empty when not normalized). Default: 5
|
|
80
|
+
* @param isNormalized - When true, uses min-max normalization across the dataset (suitable for signed values). When false (default), treats 0 as empty and scales from 0 to max.
|
|
81
|
+
*/
|
|
82
|
+
export declare const CalendarHeatmap: ({ data, weekStart, continuousMonths, singleRow, hasEmptyColumn, blockSize, blockMargin, blockRadius, blockAspectRatio, levels: levelsProp, isNormalized, colors, locale, labels: labelsProp, fontSize, emptyState, totalCount: totalCountProp, style, className, children, ...props }: CalendarHeatmapProps) => string | number | bigint | true | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
83
|
+
export type CalendarHeatmapBlockProps = HTMLAttributes<SVGRectElement> & {
|
|
84
|
+
activity: ActivityWithLevel;
|
|
85
|
+
dayIndex: number;
|
|
86
|
+
weekIndex: number;
|
|
87
|
+
highlighted?: boolean;
|
|
88
|
+
onCellClick?: (activity: ActivityWithLevel) => void;
|
|
89
|
+
onCellHover?: (activity: ActivityWithLevel | null) => void;
|
|
90
|
+
};
|
|
91
|
+
export declare const CalendarHeatmapBlock: {
|
|
92
|
+
({ ref, activity, dayIndex, weekIndex, highlighted, onCellClick, onCellHover, onClick, onKeyDown, onMouseEnter, onMouseLeave, className, style: styleProp, ...props }: CalendarHeatmapBlockProps & {
|
|
93
|
+
ref?: React.RefObject<SVGRectElement | null>;
|
|
94
|
+
}): import("react").JSX.Element;
|
|
95
|
+
displayName: string;
|
|
96
|
+
};
|
|
97
|
+
export type CalendarHeatmapBodyProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
98
|
+
hideMonthLabels?: boolean;
|
|
99
|
+
hideWeekdayLabels?: boolean;
|
|
100
|
+
hideYearLabels?: boolean;
|
|
101
|
+
className?: string;
|
|
102
|
+
labelClassName?: string;
|
|
103
|
+
yearClassName?: string;
|
|
104
|
+
children: (props: {
|
|
105
|
+
activity: ActivityWithLevel;
|
|
106
|
+
dayIndex: number;
|
|
107
|
+
weekIndex: number;
|
|
108
|
+
}) => ReactNode;
|
|
109
|
+
renderYearFooter?: (props: {
|
|
110
|
+
year: number;
|
|
111
|
+
totalCount: number;
|
|
112
|
+
}) => ReactNode;
|
|
113
|
+
};
|
|
114
|
+
export declare const CalendarHeatmapBody: ({ hideMonthLabels, hideWeekdayLabels, hideYearLabels, className, labelClassName, yearClassName, children, renderYearFooter, ...props }: CalendarHeatmapBodyProps) => import("react").JSX.Element;
|
|
115
|
+
export type CalendarHeatmapFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
116
|
+
export declare const CalendarHeatmapFooter: ({ className, ...props }: CalendarHeatmapFooterProps) => import("react").JSX.Element;
|
|
117
|
+
export type CalendarHeatmapStatProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
118
|
+
compute?: (data: ActivityWithLevel[]) => number | string;
|
|
119
|
+
label?: string;
|
|
120
|
+
children?: (result: {
|
|
121
|
+
value: number | string;
|
|
122
|
+
data: ActivityWithLevel[];
|
|
123
|
+
year: number;
|
|
124
|
+
}) => ReactNode;
|
|
125
|
+
};
|
|
126
|
+
export declare const CalendarHeatmapStat: ({ compute, label, className, children, ...props }: CalendarHeatmapStatProps) => import("react").JSX.Element;
|
|
127
|
+
export type CalendarHeatmapLegendProps = Omit<HTMLAttributes<HTMLFieldSetElement>, "children"> & {
|
|
128
|
+
labels?: {
|
|
129
|
+
less?: string;
|
|
130
|
+
more?: string;
|
|
131
|
+
};
|
|
132
|
+
children?: (props: {
|
|
133
|
+
level: number;
|
|
134
|
+
}) => ReactNode;
|
|
135
|
+
};
|
|
136
|
+
export declare const CalendarHeatmapLegend: ({ labels: labelsProp, className, children, ...props }: CalendarHeatmapLegendProps) => import("react").JSX.Element;
|
|
137
|
+
export {};
|
|
138
|
+
//# sourceMappingURL=calendar-heatmap.d.ts.map
|