@camunda/design-system 0.36.0 → 0.37.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/src/components/ui/app-header.d.ts +6 -2
- package/dist/src/components/ui/app-header.d.ts.map +1 -1
- package/dist/src/components/ui/app-header.js +1 -1
- package/dist/src/components/ui/app-header.js.map +1 -1
- package/dist/src/components/ui/app-sidebar.d.ts +44 -12
- package/dist/src/components/ui/app-sidebar.d.ts.map +1 -1
- package/dist/src/components/ui/app-sidebar.js +42 -15
- package/dist/src/components/ui/app-sidebar.js.map +1 -1
- package/dist/src/components/ui/avatar.d.ts +7 -0
- package/dist/src/components/ui/avatar.d.ts.map +1 -1
- package/dist/src/components/ui/avatar.js +1 -1
- package/dist/src/components/ui/avatar.js.map +1 -1
- package/dist/src/components/ui/bar-chart.d.ts.map +1 -1
- package/dist/src/components/ui/bar-chart.js +29 -4
- package/dist/src/components/ui/bar-chart.js.map +1 -1
- package/dist/src/components/ui/chart.d.ts +8 -1
- package/dist/src/components/ui/chart.d.ts.map +1 -1
- package/dist/src/components/ui/chart.js +11 -2
- package/dist/src/components/ui/chart.js.map +1 -1
- package/dist/src/components/ui/data-table.d.ts +6 -0
- package/dist/src/components/ui/data-table.d.ts.map +1 -1
- package/dist/src/components/ui/data-table.js +6 -5
- package/dist/src/components/ui/data-table.js.map +1 -1
- package/dist/src/components/ui/line-chart.d.ts.map +1 -1
- package/dist/src/components/ui/line-chart.js +12 -2
- package/dist/src/components/ui/line-chart.js.map +1 -1
- package/dist/src/components/ui/nav-breadcrumb.d.ts +120 -2
- package/dist/src/components/ui/nav-breadcrumb.d.ts.map +1 -1
- package/dist/src/components/ui/nav-breadcrumb.js +54 -7
- package/dist/src/components/ui/nav-breadcrumb.js.map +1 -1
- package/dist/src/components/ui/nav-data.d.ts +46 -0
- package/dist/src/components/ui/nav-data.d.ts.map +1 -0
- package/dist/src/components/ui/nav-data.js +66 -0
- package/dist/src/components/ui/nav-data.js.map +1 -0
- package/dist/src/components/ui/nav-icon.assignability.d.ts +30 -0
- package/dist/src/components/ui/nav-icon.assignability.d.ts.map +1 -0
- package/dist/src/components/ui/nav-icon.assignability.js +28 -0
- package/dist/src/components/ui/nav-icon.assignability.js.map +1 -0
- package/dist/src/components/ui/nav-icon.d.ts +33 -0
- package/dist/src/components/ui/nav-icon.d.ts.map +1 -0
- package/dist/src/components/ui/nav-icon.js +20 -0
- package/dist/src/components/ui/nav-icon.js.map +1 -0
- package/dist/src/components/ui/notifications.d.ts +72 -0
- package/dist/src/components/ui/notifications.d.ts.map +1 -0
- package/dist/src/components/ui/notifications.js +53 -0
- package/dist/src/components/ui/notifications.js.map +1 -0
- package/dist/src/components/ui/scorecard.d.ts.map +1 -1
- package/dist/src/components/ui/scorecard.js +9 -3
- package/dist/src/components/ui/scorecard.js.map +1 -1
- package/dist/src/components/ui/sheet.d.ts +1 -1
- package/dist/src/components/ui/sparkline.d.ts.map +1 -1
- package/dist/src/components/ui/sparkline.js +11 -1
- package/dist/src/components/ui/sparkline.js.map +1 -1
- package/dist/src/examples/agent-control-plane-processes/DashboardPage.d.ts +3 -0
- package/dist/src/examples/agent-control-plane-processes/DashboardPage.d.ts.map +1 -0
- package/dist/src/examples/agent-control-plane-processes/DashboardPage.js +114 -0
- package/dist/src/examples/agent-control-plane-processes/DashboardPage.js.map +1 -0
- package/dist/src/examples/agent-control-plane-processes/derive.d.ts +65 -0
- package/dist/src/examples/agent-control-plane-processes/derive.d.ts.map +1 -0
- package/dist/src/examples/agent-control-plane-processes/derive.js +234 -0
- package/dist/src/examples/agent-control-plane-processes/derive.js.map +1 -0
- package/dist/src/examples/agent-control-plane-processes/mock-data.d.ts +37 -0
- package/dist/src/examples/agent-control-plane-processes/mock-data.d.ts.map +1 -0
- package/dist/src/examples/agent-control-plane-processes/mock-data.js +206 -0
- package/dist/src/examples/agent-control-plane-processes/mock-data.js.map +1 -0
- package/dist/src/examples/agent-control-plane-processes/summary-mock-data.d.ts +37 -0
- package/dist/src/examples/agent-control-plane-processes/summary-mock-data.d.ts.map +1 -0
- package/dist/src/examples/agent-control-plane-processes/summary-mock-data.js +53 -0
- package/dist/src/examples/agent-control-plane-processes/summary-mock-data.js.map +1 -0
- package/dist/src/examples/shared/DashboardSection.d.ts +9 -0
- package/dist/src/examples/shared/DashboardSection.d.ts.map +1 -0
- package/dist/src/examples/shared/DashboardSection.js +5 -0
- package/dist/src/examples/shared/DashboardSection.js.map +1 -0
- package/dist/src/examples/shared/DateRangePopover.d.ts +3 -0
- package/dist/src/examples/shared/DateRangePopover.d.ts.map +1 -0
- package/dist/src/examples/shared/DateRangePopover.js +35 -0
- package/dist/src/examples/shared/DateRangePopover.js.map +1 -0
- package/dist/src/examples/shared/agent-control-plane-nav.d.ts +4 -0
- package/dist/src/examples/shared/agent-control-plane-nav.d.ts.map +1 -0
- package/dist/src/examples/shared/agent-control-plane-nav.js +25 -0
- package/dist/src/examples/shared/agent-control-plane-nav.js.map +1 -0
- package/dist/src/examples/shared/date-range-utils.d.ts +10 -0
- package/dist/src/examples/shared/date-range-utils.d.ts.map +1 -0
- package/dist/src/examples/shared/date-range-utils.js +75 -0
- package/dist/src/examples/shared/date-range-utils.js.map +1 -0
- package/dist/src/icons/camunda-app-icons.d.ts +19 -0
- package/dist/src/icons/camunda-app-icons.d.ts.map +1 -0
- package/dist/src/icons/camunda-app-icons.js +26 -0
- package/dist/src/icons/camunda-app-icons.js.map +1 -0
- package/dist/src/icons/index.d.ts +1 -0
- package/dist/src/icons/index.d.ts.map +1 -1
- package/dist/src/icons/index.js +1 -0
- package/dist/src/icons/index.js.map +1 -1
- package/dist/src/index.d.ts +6 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -2
- package/dist/src/index.js.map +1 -1
- package/dist/styles.css +52 -5
- package/package.json +1 -1
- package/dist/src/examples/cost-dashboard/CostBreakdownChart.d.ts +0 -2
- package/dist/src/examples/cost-dashboard/CostBreakdownChart.d.ts.map +0 -1
- package/dist/src/examples/cost-dashboard/CostBreakdownChart.js +0 -21
- package/dist/src/examples/cost-dashboard/CostBreakdownChart.js.map +0 -1
- package/dist/src/examples/cost-dashboard/CostDashboardPage.d.ts +0 -2
- package/dist/src/examples/cost-dashboard/CostDashboardPage.d.ts.map +0 -1
- package/dist/src/examples/cost-dashboard/CostDashboardPage.js +0 -56
- package/dist/src/examples/cost-dashboard/CostDashboardPage.js.map +0 -1
- package/dist/src/examples/cost-dashboard/TrendChart.d.ts +0 -2
- package/dist/src/examples/cost-dashboard/TrendChart.d.ts.map +0 -1
- package/dist/src/examples/cost-dashboard/TrendChart.js +0 -19
- package/dist/src/examples/cost-dashboard/TrendChart.js.map +0 -1
- package/dist/src/examples/cost-dashboard/mock-data.d.ts +0 -34
- package/dist/src/examples/cost-dashboard/mock-data.d.ts.map +0 -1
- package/dist/src/examples/cost-dashboard/mock-data.js +0 -120
- package/dist/src/examples/cost-dashboard/mock-data.js.map +0 -1
- package/dist/src/examples/projects-list/ProjectsListPage.d.ts +0 -4
- package/dist/src/examples/projects-list/ProjectsListPage.d.ts.map +0 -1
- package/dist/src/examples/projects-list/ProjectsListPage.js +0 -58
- package/dist/src/examples/projects-list/ProjectsListPage.js.map +0 -1
- package/dist/src/examples/projects-list/mock-data.d.ts +0 -10
- package/dist/src/examples/projects-list/mock-data.d.ts.map +0 -1
- package/dist/src/examples/projects-list/mock-data.js +0 -83
- package/dist/src/examples/projects-list/mock-data.js.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile-time fixture for the `NavIcon` contract. Nothing imports this file — it exists to be
|
|
3
|
+
* type-checked, and `npm run typecheck` is what runs it.
|
|
4
|
+
*
|
|
5
|
+
* `NavIcon` is deliberately structural. Narrowing it back to lucide's `LucideIcon` (a
|
|
6
|
+
* `React.ForwardRefExoticComponent`, which structurally requires `$$typeof`) would silently
|
|
7
|
+
* reject three of the four sources below — including this package's own registry icons — and
|
|
8
|
+
* every consumer would discover it at their call sites rather than here.
|
|
9
|
+
*/
|
|
10
|
+
import type * as React from "react";
|
|
11
|
+
import type { NavIcon } from "./nav-icon.js";
|
|
12
|
+
import type { SidebarItem } from "./app-sidebar.js";
|
|
13
|
+
import type { GlobalActionButton } from "./app-header.js";
|
|
14
|
+
/** A Carbon icon's shape, which is what C3's `IconComponent` resolves to. */
|
|
15
|
+
interface CarbonIconProps extends React.SVGProps<SVGSVGElement> {
|
|
16
|
+
size?: number | string;
|
|
17
|
+
}
|
|
18
|
+
declare const fromLucide: NavIcon;
|
|
19
|
+
declare const fromRegistryNamed: NavIcon;
|
|
20
|
+
declare const fromRegistryMap: NavIcon;
|
|
21
|
+
declare const fromAppMap: NavIcon;
|
|
22
|
+
declare const fromCarbonClass: NavIcon;
|
|
23
|
+
declare const fromCarbonFunction: NavIcon;
|
|
24
|
+
/** Both consuming surfaces accept the same four sources. */
|
|
25
|
+
declare const sidebarItem: SidebarItem;
|
|
26
|
+
declare const sidebarItemWithoutIcon: SidebarItem;
|
|
27
|
+
declare const globalAction: GlobalActionButton;
|
|
28
|
+
export type { CarbonIconProps as _CarbonIconProps };
|
|
29
|
+
export { fromLucide, fromRegistryNamed, fromRegistryMap, fromAppMap, fromCarbonClass, fromCarbonFunction, sidebarItem, sidebarItemWithoutIcon, globalAction, };
|
|
30
|
+
//# sourceMappingURL=nav-icon.assignability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-icon.assignability.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/nav-icon.assignability.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAMpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,6EAA6E;AAC7E,UAAU,eAAgB,SAAQ,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC;IAC7D,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAID,QAAA,MAAM,UAAU,EAAE,OAAmC,CAAC;AACtD,QAAA,MAAM,iBAAiB,EAAE,OAAqB,CAAC;AAC/C,QAAA,MAAM,eAAe,EAAE,OAA8B,CAAC;AACtD,QAAA,MAAM,UAAU,EAAE,OAAiC,CAAC;AACpD,QAAA,MAAM,eAAe,EAAE,OAAyB,CAAC;AACjD,QAAA,MAAM,kBAAkB,EAAE,OAA4B,CAAC;AAEvD,4DAA4D;AAC5D,QAAA,MAAM,WAAW,EAAE,WAKlB,CAAC;AACF,QAAA,MAAM,sBAAsB,EAAE,WAI7B,CAAC;AACF,QAAA,MAAM,YAAY,EAAE,kBAInB,CAAC;AAEF,YAAY,EAAE,eAAe,IAAI,gBAAgB,EAAE,CAAC;AACpD,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,sBAAsB,EACtB,YAAY,GACb,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Home } from "lucide-react";
|
|
2
|
+
import { camundaIcons, ProjectIcon } from "../../icons/index.js";
|
|
3
|
+
import { camundaAppIcons } from "../../icons/camunda-app-icons.js";
|
|
4
|
+
const fromLucide = Home;
|
|
5
|
+
const fromRegistryNamed = ProjectIcon;
|
|
6
|
+
const fromRegistryMap = camundaIcons.project;
|
|
7
|
+
const fromAppMap = camundaAppIcons.operate;
|
|
8
|
+
const fromCarbonClass = CarbonClassIcon;
|
|
9
|
+
const fromCarbonFunction = CarbonFunctionIcon;
|
|
10
|
+
/** Both consuming surfaces accept the same four sources. */
|
|
11
|
+
const sidebarItem = {
|
|
12
|
+
type: "item",
|
|
13
|
+
key: "k",
|
|
14
|
+
label: "Label",
|
|
15
|
+
icon: CarbonFunctionIcon,
|
|
16
|
+
};
|
|
17
|
+
const sidebarItemWithoutIcon = {
|
|
18
|
+
type: "item",
|
|
19
|
+
key: "k",
|
|
20
|
+
label: "Label",
|
|
21
|
+
};
|
|
22
|
+
const globalAction = {
|
|
23
|
+
key: "k",
|
|
24
|
+
label: "Label",
|
|
25
|
+
icon: ProjectIcon,
|
|
26
|
+
};
|
|
27
|
+
export { fromLucide, fromRegistryNamed, fromRegistryMap, fromAppMap, fromCarbonClass, fromCarbonFunction, sidebarItem, sidebarItemWithoutIcon, globalAction, };
|
|
28
|
+
//# sourceMappingURL=nav-icon.assignability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-icon.assignability.js","sourceRoot":"","sources":["../../../../src/components/ui/nav-icon.assignability.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAYhE,MAAM,UAAU,GAAY,IAAyB,CAAC;AACtD,MAAM,iBAAiB,GAAY,WAAW,CAAC;AAC/C,MAAM,eAAe,GAAY,YAAY,CAAC,OAAO,CAAC;AACtD,MAAM,UAAU,GAAY,eAAe,CAAC,OAAO,CAAC;AACpD,MAAM,eAAe,GAAY,eAAe,CAAC;AACjD,MAAM,kBAAkB,GAAY,kBAAkB,CAAC;AAEvD,4DAA4D;AAC5D,MAAM,WAAW,GAAgB;IAC/B,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,GAAG;IACR,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,kBAAkB;CACzB,CAAC;AACF,MAAM,sBAAsB,GAAgB;IAC1C,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,GAAG;IACR,KAAK,EAAE,OAAO;CACf,CAAC;AACF,MAAM,YAAY,GAAuB;IACvC,GAAG,EAAE,GAAG;IACR,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,WAAW;CAClB,CAAC;AAGF,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,sBAAsB,EACtB,YAAY,GACb,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The accepted type of every data-driven icon slot in the navigation API.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately structural rather than lucide's nominal `LucideIcon`: that type is a
|
|
6
|
+
* `React.ForwardRefExoticComponent`, so it structurally requires `$$typeof` and rejects any
|
|
7
|
+
* plain function component — including the design system's own registry icons. All four sources
|
|
8
|
+
* a consumer can hold assign to this one: lucide icons, the registry's icons, `camundaIcons[key]`
|
|
9
|
+
* and Carbon-shaped icon components.
|
|
10
|
+
*
|
|
11
|
+
* `size` is intentionally absent, and both plausible spellings were measured to fail under
|
|
12
|
+
* `strict`: `size?: number | string` rejects Carbon-shaped icons (whose `size` is `number`,
|
|
13
|
+
* through `getDerivedStateFromProps` contravariance) and `size?: number` rejects lucide
|
|
14
|
+
* (`propTypes` invariance). Size icons with the `size-*` utility, optionally reinforced with
|
|
15
|
+
* numeric `width`/`height` — both are members of `SVGProps<SVGSVGElement>`. A class overrides an
|
|
16
|
+
* SVG `width`/`height` attribute but not an inline `style`, so an icon that hardcodes its
|
|
17
|
+
* dimensions inline is out of contract.
|
|
18
|
+
*/
|
|
19
|
+
export type NavIcon = React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
20
|
+
/**
|
|
21
|
+
* Renders a navigation row's icon, falling back to the label's initials.
|
|
22
|
+
*
|
|
23
|
+
* The collapsed rail renders the icon as the row's only visual, with the label moved into
|
|
24
|
+
* `sr-only`. An icon-less node would collapse to a row that is invisible yet still focusable and
|
|
25
|
+
* still carries a tooltip — so something has to occupy the box. Initials keep rows
|
|
26
|
+
* distinguishable, and the rail's existing tooltip names them.
|
|
27
|
+
*/
|
|
28
|
+
export declare function NavRowIcon({ icon: Icon, label, className, }: {
|
|
29
|
+
icon?: NavIcon;
|
|
30
|
+
label: string;
|
|
31
|
+
className?: string;
|
|
32
|
+
}): React.JSX.Element;
|
|
33
|
+
//# sourceMappingURL=nav-icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-icon.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/nav-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EAAE,IAAI,EACV,KAAK,EACL,SAAS,GACV,EAAE;IACD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,qBAmBA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { deriveInitials } from "./avatar.js";
|
|
5
|
+
/**
|
|
6
|
+
* Renders a navigation row's icon, falling back to the label's initials.
|
|
7
|
+
*
|
|
8
|
+
* The collapsed rail renders the icon as the row's only visual, with the label moved into
|
|
9
|
+
* `sr-only`. An icon-less node would collapse to a row that is invisible yet still focusable and
|
|
10
|
+
* still carries a tooltip — so something has to occupy the box. Initials keep rows
|
|
11
|
+
* distinguishable, and the rail's existing tooltip names them.
|
|
12
|
+
*/
|
|
13
|
+
export function NavRowIcon({ icon: Icon, label, className, }) {
|
|
14
|
+
if (Icon) {
|
|
15
|
+
return _jsx(Icon, { "aria-hidden": true, className: cn("size-5 shrink-0", className) });
|
|
16
|
+
}
|
|
17
|
+
const initials = deriveInitials(label);
|
|
18
|
+
return (_jsx("span", { "aria-hidden": true, "data-slot": "nav-row-icon-fallback", className: cn("flex size-5 shrink-0 items-center justify-center rounded-sm border border-current/30 text-[0.625rem] font-medium leading-none", className), children: initials }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=nav-icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-icon.js","sourceRoot":"","sources":["../../../../src/components/ui/nav-icon.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAqB1C;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EAAE,IAAI,EACV,KAAK,EACL,SAAS,GAKV;IACC,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,KAAC,IAAI,yBAAa,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,GAAI,CAAC;IAC3E,CAAC;IAED,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAEvC,OAAO,CACL,iDAEY,uBAAuB,EACjC,SAAS,EAAE,EAAE,CACX,+HAA+H,EAC/H,SAAS,CACV,YAEA,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* One notification, as the consumer already has it.
|
|
4
|
+
*
|
|
5
|
+
* Presentational only: `timestamp` is a pre-formatted string, not a Date, because relative
|
|
6
|
+
* formatting is locale and library work that belongs with the consumer — the design system has
|
|
7
|
+
* no opinion on whether "2h ago" or "14:32" is right for a product.
|
|
8
|
+
*/
|
|
9
|
+
export interface NavNotification {
|
|
10
|
+
key: string;
|
|
11
|
+
title: string;
|
|
12
|
+
description?: React.ReactNode;
|
|
13
|
+
/** Pre-formatted by the consumer. */
|
|
14
|
+
timestamp?: string;
|
|
15
|
+
/** Unread notifications carry a marker and count toward the bell's badge. */
|
|
16
|
+
isRead?: boolean;
|
|
17
|
+
href?: string;
|
|
18
|
+
onClick?: () => void;
|
|
19
|
+
}
|
|
20
|
+
export interface NotificationBellProps {
|
|
21
|
+
/**
|
|
22
|
+
* Unread notifications. Rendered as a badge; counts above `maxCount` show as `9+`. The bell
|
|
23
|
+
* owns no state — pass the count you already hold.
|
|
24
|
+
*/
|
|
25
|
+
unreadCount?: number;
|
|
26
|
+
/** Highest number rendered literally. Default 9. */
|
|
27
|
+
maxCount?: number;
|
|
28
|
+
/** Accessible name for the trigger. Default "Notifications". */
|
|
29
|
+
label?: string;
|
|
30
|
+
/** Reflected as `aria-expanded`, for when the bell toggles a panel. */
|
|
31
|
+
isActive?: boolean;
|
|
32
|
+
onClick?: () => void;
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Notification bell, for `AppHeader.globalActions` (as an `element`) or anywhere a trigger fits.
|
|
37
|
+
*
|
|
38
|
+
* Split from the panel on purpose: the trigger belongs in the header's action row while the
|
|
39
|
+
* panel is an overlay, and a consumer may already own one of the two.
|
|
40
|
+
*/
|
|
41
|
+
export declare function NotificationBell({ unreadCount, maxCount, label, isActive, onClick, className, }: NotificationBellProps): React.JSX.Element;
|
|
42
|
+
export interface NotificationsPanelProps {
|
|
43
|
+
notifications: NavNotification[];
|
|
44
|
+
open: boolean;
|
|
45
|
+
onOpenChange: (open: boolean) => void;
|
|
46
|
+
/** Omit to render notifications without a per-item dismiss control. */
|
|
47
|
+
onDismiss?: (key: string) => void;
|
|
48
|
+
/** Panel heading. Default "Notifications". */
|
|
49
|
+
title?: string;
|
|
50
|
+
/** Shown when there is nothing to list. */
|
|
51
|
+
emptyMessage?: React.ReactNode;
|
|
52
|
+
/** Rendered in the panel header — e.g. a "Mark all as read" button. */
|
|
53
|
+
headerAction?: React.ReactNode;
|
|
54
|
+
/** Component used for notifications carrying an `href`. Default: a plain anchor. */
|
|
55
|
+
linkComponent?: React.ElementType;
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Notification panel — a right-hand overlay listing what the consumer passes.
|
|
60
|
+
*
|
|
61
|
+
* Fetches nothing and stores nothing: `open` is controlled, because the trigger usually lives in
|
|
62
|
+
* the header and the panel does not, so one of the two has to own the state and it cannot be
|
|
63
|
+
* this one.
|
|
64
|
+
*
|
|
65
|
+
* **Mark notifications read from `onOpenChange(true)`.** The panel does not fire that write —
|
|
66
|
+
* it is a persisted mutation and the transport differs per product — but it is the agreed
|
|
67
|
+
* moment. Console's notification runtime deliberately leaves the timing here, and the same feed
|
|
68
|
+
* appears in several products: if one marks on open, another on click and a third only on an
|
|
69
|
+
* explicit action, the unread count means something different in each app.
|
|
70
|
+
*/
|
|
71
|
+
export declare function NotificationsPanel({ notifications, open, onOpenChange, onDismiss, title, emptyMessage, headerAction, linkComponent, className, }: NotificationsPanelProps): React.JSX.Element;
|
|
72
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/notifications.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAA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
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Bell, X } from "lucide-react";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from "./sheet.js";
|
|
8
|
+
/**
|
|
9
|
+
* Notification bell, for `AppHeader.globalActions` (as an `element`) or anywhere a trigger fits.
|
|
10
|
+
*
|
|
11
|
+
* Split from the panel on purpose: the trigger belongs in the header's action row while the
|
|
12
|
+
* panel is an overlay, and a consumer may already own one of the two.
|
|
13
|
+
*/
|
|
14
|
+
export function NotificationBell({ unreadCount = 0, maxCount = 9, label = "Notifications", isActive, onClick, className, }) {
|
|
15
|
+
const hasUnread = unreadCount > 0;
|
|
16
|
+
const badgeText = unreadCount > maxCount ? `${maxCount}+` : `${unreadCount}`;
|
|
17
|
+
return (
|
|
18
|
+
// inline-flex, not block: the badge is positioned against this box, so it has to
|
|
19
|
+
// shrink-wrap the button or it anchors to the container's right edge instead.
|
|
20
|
+
_jsxs("div", { className: cn("relative inline-flex", className), children: [_jsx(Button, { variant: "ghost", size: "icon", "aria-label": hasUnread
|
|
21
|
+
? `${label}, ${unreadCount} unread`
|
|
22
|
+
: `${label}, none unread`, "aria-expanded": isActive, onClick: onClick, "data-slot": "notification-bell", children: _jsx(Bell, { "aria-hidden": true, className: "size-4" }) }), hasUnread ? (_jsx("span", { "aria-hidden": true, "data-slot": "notification-bell-badge", className: "pointer-events-none absolute -right-0.5 -top-0.5 flex size-4 items-center justify-center rounded-full bg-primary-action-default text-[0.625rem] leading-none text-primary-action-foreground", children: badgeText })) : null, _jsx("span", { "aria-live": "polite", className: "sr-only", children: hasUnread ? `${unreadCount} unread notifications` : "" })] }));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Notification panel — a right-hand overlay listing what the consumer passes.
|
|
26
|
+
*
|
|
27
|
+
* Fetches nothing and stores nothing: `open` is controlled, because the trigger usually lives in
|
|
28
|
+
* the header and the panel does not, so one of the two has to own the state and it cannot be
|
|
29
|
+
* this one.
|
|
30
|
+
*
|
|
31
|
+
* **Mark notifications read from `onOpenChange(true)`.** The panel does not fire that write —
|
|
32
|
+
* it is a persisted mutation and the transport differs per product — but it is the agreed
|
|
33
|
+
* moment. Console's notification runtime deliberately leaves the timing here, and the same feed
|
|
34
|
+
* appears in several products: if one marks on open, another on click and a third only on an
|
|
35
|
+
* explicit action, the unread count means something different in each app.
|
|
36
|
+
*/
|
|
37
|
+
export function NotificationsPanel({ notifications, open, onOpenChange, onDismiss, title = "Notifications", emptyMessage = "You have no notifications.", headerAction, linkComponent, className, }) {
|
|
38
|
+
const isEmpty = notifications.length === 0;
|
|
39
|
+
return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { side: "right", "data-slot": "notifications-panel", className: cn("w-full sm:max-w-sm", className), children: [_jsxs(SheetHeader, { children: [_jsx(SheetTitle, { children: title }), isEmpty ? (_jsx(SheetDescription, { children: emptyMessage })) : (_jsx(SheetDescription, { className: "sr-only", children: `${notifications.length} notifications` })), headerAction] }), isEmpty ? null : (_jsx("ul", { className: "m-0 flex list-none flex-col gap-1 overflow-y-auto p-4 pt-0", children: notifications.map((notification) => (_jsx(NotificationRow, { notification: notification, onDismiss: onDismiss, linkComponent: linkComponent }, notification.key))) }))] }) }));
|
|
40
|
+
}
|
|
41
|
+
function NotificationRow({ notification, onDismiss, linkComponent, }) {
|
|
42
|
+
const { key, title, description, timestamp, isRead, href, onClick } = notification;
|
|
43
|
+
const isInteractive = href !== undefined || onClick !== undefined;
|
|
44
|
+
const LinkEl = linkComponent ?? "a";
|
|
45
|
+
const Body = href
|
|
46
|
+
? LinkEl
|
|
47
|
+
: isInteractive
|
|
48
|
+
? "button"
|
|
49
|
+
: "div";
|
|
50
|
+
return (_jsxs("li", { "data-slot": "notification-item", "data-read": isRead ? "true" : "false", className: "flex items-start gap-2 rounded-md p-2 hover:bg-neutral-background-medium", children: [_jsx("span", { "aria-hidden": true, className: cn("mt-1.5 size-2 shrink-0 rounded-full", isRead ? "bg-transparent" : "bg-primary-action-default") }), _jsxs(Body, { ...(href ? { href } : isInteractive ? { type: "button" } : {}), onClick: onClick, className: cn("min-w-0 flex-1 text-left", isInteractive &&
|
|
51
|
+
"rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"), children: [_jsxs("span", { className: "block text-sm text-neutral-foreground-strong", children: [isRead ? null : _jsx("span", { className: "sr-only", children: "Unread. " }), title] }), description ? (_jsx("span", { className: "block text-sm text-neutral-foreground-subtle", children: description })) : null, timestamp ? (_jsx("span", { className: "block text-xs text-neutral-foreground-subtle", children: timestamp })) : null] }), onDismiss ? (_jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": `Dismiss ${title}`, onClick: () => onDismiss(key), className: "shrink-0 text-neutral-foreground-subtle", children: _jsx(X, {}) })) : null] }));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../../src/components/ui/notifications.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AAqCjB;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,WAAW,GAAG,CAAC,EACf,QAAQ,GAAG,CAAC,EACZ,KAAK,GAAG,eAAe,EACvB,QAAQ,EACR,OA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S,CAAC;IACxB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiFD,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,SAAS,EACT,MAAa,EACb,IAAgB,EAChB,OAAe,EACf,KAAa,EACb,YAAwB,EACxB,SAAS,GACV,EAAE,cAAc,qBAwDhB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { Badge } from "./badge.js";
|
|
|
6
6
|
import { Card, CardHeader, CardTitle } from "./card.js";
|
|
7
7
|
import { Skeleton } from "./skeleton.js";
|
|
8
8
|
import { Sparkline } from "./sparkline.js";
|
|
9
|
-
function ScorecardBody({ label, tooltip, value, delta, sparkline, size, loading, empty, emptyMessage, }) {
|
|
9
|
+
function ScorecardBody({ label, tooltip, value, delta, sparkline, size, loading, empty, emptyMessage, asCard, }) {
|
|
10
10
|
if (loading) {
|
|
11
11
|
return (_jsxs(_Fragment, { children: [_jsx(Skeleton, { className: "h-4 w-24" }), _jsx(Skeleton, { className: cn("h-7 w-20", size === "sm" && "h-6 w-16") })] }));
|
|
12
12
|
}
|
|
@@ -14,13 +14,19 @@ function ScorecardBody({ label, tooltip, value, delta, sparkline, size, loading,
|
|
|
14
14
|
// `loading` is always false here — the branch above already returned
|
|
15
15
|
// before this point, so Sparkline never renders its own skeleton; the
|
|
16
16
|
// fixed two-block skeleton above is what represents loading for the tile.
|
|
17
|
-
|
|
17
|
+
// Bled flush to the Card's own edges via negative margins that cancel
|
|
18
|
+
// CardHeader's `px-4`/`px-3` and Card's own `py-4`/`py-3` — only correct
|
|
19
|
+
// when `asCard` actually wraps this content in that padding; the bare
|
|
20
|
+
// `<div>` (`asCard={false}`) has no padding of its own to cancel.
|
|
21
|
+
const sparklineElement = sparkline ? (_jsx(Sparkline, { data: sparkline.data, dataKey: sparkline.dataKey, loading: false, className: asCard
|
|
22
|
+
? "w-auto -mx-4 -mb-4 group-data-[size=sm]/card:-mx-3 group-data-[size=sm]/card:-mb-3"
|
|
23
|
+
: undefined })) : null;
|
|
18
24
|
return (_jsxs(_Fragment, { children: [_jsx(CardTitle, { tooltip: tooltip, className: "text-sm font-normal", children: label }), _jsx("div", { className: "flex min-w-0 items-center", children: _jsxs("span", { className: "inline-flex min-w-0 max-w-full items-center gap-2", children: [_jsx("span", { className: cn("min-w-0 truncate text-2xl font-semibold text-neutral-foreground-strong", size === "sm" && "text-xl"), children: empty ? emptyMessage : value }), !empty && delta && (_jsxs(Badge, { variant: delta.variant, className: "shrink-0", children: [_jsx(DeltaIcon, { "data-icon": "inline-start", "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: delta.direction === "increase"
|
|
19
25
|
? "Increased by "
|
|
20
26
|
: "Decreased by " }), delta.value] }))] }) }), !empty && sparklineElement] }));
|
|
21
27
|
}
|
|
22
28
|
function Scorecard({ label, tooltip, value, delta, sparkline, asCard = true, size = "default", loading = false, empty = false, emptyMessage = "No data", className, }) {
|
|
23
|
-
const content = (_jsx(ScorecardBody, { label: label, tooltip: tooltip, value: value, delta: delta, sparkline: sparkline, size: size, loading: loading, empty: empty, emptyMessage: emptyMessage }));
|
|
29
|
+
const content = (_jsx(ScorecardBody, { label: label, tooltip: tooltip, value: value, delta: delta, sparkline: sparkline, size: size, loading: loading, empty: empty, emptyMessage: emptyMessage, asCard: asCard }));
|
|
24
30
|
// Loading removes the title from the accessible tree (it becomes a
|
|
25
31
|
// Skeleton), so `aria-busy` alone would leave the busy region unnamed.
|
|
26
32
|
// `aria-label` alone isn't enough either: the root is a plain `<div>`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scorecard.js","sourceRoot":"","sources":["../../../../src/components/ui/scorecard.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA2BxC,SAAS,aAAa,CAAC,EACrB,KAAK,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,SAAS,EACT,IAAI,EACJ,OAAO,EACP,KAAK,EACL,YAAY,
|
|
1
|
+
{"version":3,"file":"scorecard.js","sourceRoot":"","sources":["../../../../src/components/ui/scorecard.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA2BxC,SAAS,aAAa,CAAC,EACrB,KAAK,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,SAAS,EACT,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O,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EAC9C,SAAS,EAAE,EAAE,CAAC,gCAAgC,EAAE,SAAS,CAAC,YAE1D,KAAC,UAAU,cAAE,OAAO,GAAc,GAC7B,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,2BACY,WAAW,eACV,OAAO,IAAI,SAAS,EAC/B,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,eACzB,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,gBAC7B,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EAC9C,SAAS,EAAE,EAAE,CACX,qEAAqE,EACrE,SAAS,CACV,YAEA,OAAO,GACJ,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -7,7 +7,7 @@ declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimi
|
|
|
7
7
|
declare function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>): React.JSX.Element;
|
|
8
8
|
declare function SheetOverlay({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Overlay>): React.JSX.Element;
|
|
9
9
|
declare const sheetVariants: (props?: ({
|
|
10
|
-
side?: "
|
|
10
|
+
side?: "bottom" | "left" | "right" | "top" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
12
|
declare function SheetContent({ className, children, side, showCloseButton, onOpenAutoFocus, onCloseAutoFocus, restoreFocusRef, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & VariantProps<typeof sheetVariants> & {
|
|
13
13
|
showCloseButton?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sparkline.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sparkline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,SAAS,CAAC,EACjB,IAAI,EACJ,OAAO,EACP,OAAe,EACf,SAAS,GACV,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"sparkline.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sparkline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,SAAS,CAAC,EACjB,IAAI,EACJ,OAAO,EACP,OAAe,EACf,SAAS,GACV,EAAE,cAAc,qBA0DhB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -13,7 +13,17 @@ function Sparkline({ data, dataKey, loading = false, className, }) {
|
|
|
13
13
|
// BarChart/LineChart, which enable this unconditionally, the
|
|
14
14
|
// default `true` here would otherwise make the SVG an unexpected
|
|
15
15
|
// tab stop (role="application", tabIndex=0) with nothing to do.
|
|
16
|
-
accessibilityLayer: false,
|
|
16
|
+
accessibilityLayer: false,
|
|
17
|
+
// Recharts' own default chart margin otherwise leaves ~5px of
|
|
18
|
+
// gutter on every side — invisible when Scorecard's Card padding
|
|
19
|
+
// dwarfed it, but exactly the gap that kept the trend from truly
|
|
20
|
+
// reaching the card's edges once that padding was canceled.
|
|
21
|
+
// Left/right stay at 0 for a true edge-to-edge bleed. Top/bottom
|
|
22
|
+
// keep a sliver matching the stroke's half-width: with
|
|
23
|
+
// domain=["dataMin", "dataMax"] the highest/lowest point's line
|
|
24
|
+
// is centered exactly on the plot's top/bottom edge, so zero
|
|
25
|
+
// margin there clips half the stroke at that point.
|
|
26
|
+
margin: { top: 2, right: 0, bottom: 2, left: 0 }, children: [_jsx("defs", { children: _jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: "var(--chart-1)", stopOpacity: "var(--chart-area-fill-opacity)" }), _jsx("stop", { offset: "100%", stopColor: "var(--chart-1)", stopOpacity: 0 })] }) }), _jsx(YAxis, { hide: true, domain: ["dataMin", "dataMax"] }), _jsx(Area, { dataKey: dataKey, stroke: "var(--chart-1)", strokeWidth: 2, fill: `url(#${gradientId})`, isAnimationActive: false })] }) })) }));
|
|
17
27
|
}
|
|
18
28
|
export { Sparkline };
|
|
19
29
|
//# sourceMappingURL=sparkline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sparkline.js","sourceRoot":"","sources":["../../../../src/components/ui/sparkline.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,IAAI,EACJ,SAAS,IAAI,iBAAiB,EAC9B,mBAAmB,EACnB,KAAK,GACN,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAStC,SAAS,SAAS,CAAC,EACjB,IAAI,EACJ,OAAO,EACP,OAAO,GAAG,KAAK,EACf,SAAS,GACM;IACf,yEAAyE;IACzE,0EAA0E;IAC1E,oEAAoE;IACpE,MAAM,UAAU,GAAG,sBAAsB,KAAK,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;IAE3E,OAAO,CACL,2BAAe,WAAW,EAAC,SA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,EAAE,KAAK;gBACzB,8DAA8D;gBAC9D,iEAAiE;gBACjE,iEAAiE;gBACjE,4DAA4D;gBAC5D,iEAAiE;gBACjE,uDAAuD;gBACvD,gEAAgE;gBAChE,6DAA6D;gBAC7D,oDAAoD;gBACpD,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,aAEhD,yBACE,0BAAgB,EAAE,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,aACzD,eACE,MAAM,EAAC,IAAI,EACX,SAAS,EAAC,gBAAgB,EAC1B,WAAW,EAAC,gCAAgC,GAC5C,EACF,eACE,MAAM,EAAC,MAAM,EACb,SAAS,EAAC,gBAAgB,EAC1B,WAAW,EAAE,CAAC,GACd,IACa,GACZ,EACP,KAAC,KAAK,IAAC,IAAI,QAAC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,GAAI,EAC9C,KAAC,IAAI,IACH,OAAO,EAAE,OAAO,EAChB,MAAM,EAAC,gBAAgB,EACvB,WAAW,EAAE,CAAC,EACd,IAAI,EAAE,QAAQ,UAAU,GAAG,EAC3B,iBAAiB,EAAE,KAAK,GACxB,IACgB,GACA,CACvB,GACG,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../../../src/examples/agent-control-plane-processes/DashboardPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwF/B,wBAAgB,aAAa,sBAmW5B"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ArrowRight, Workflow } from "lucide-react";
|
|
4
|
+
import { Card, CardHeader, CardTitle, CardContent, Scorecard, LineChart, BarChart, Button, DataTable, Combobox, PageLayout, PageHeader, } from "../../index.js";
|
|
5
|
+
import { AppShell } from "../shared/AppShell.js";
|
|
6
|
+
import { DashboardSection } from "../shared/DashboardSection.js";
|
|
7
|
+
import { agentControlPlaneNavFor, agentControlPlaneBreadcrumb, } from "../shared/agent-control-plane-nav.js";
|
|
8
|
+
import { DateRangePopover } from "../shared/DateRangePopover.js";
|
|
9
|
+
import { ALL, getProcessOptions, getSelectedProcess, getVersionOptions, getAgentOptions, getVisibleAgents, computeKpis, computeTokenTrend, computeTokenBreakdown, computeToolCallFrequency, computeInstanceRows, categoryChartHeight, } from "./derive.js";
|
|
10
|
+
import { topProcessesByInstances, topProcessesByTokens, } from "./summary-mock-data.js";
|
|
11
|
+
const preserveOrder = () => 0;
|
|
12
|
+
const kpiGridClass = "grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4";
|
|
13
|
+
const instancesRankingConfig = {
|
|
14
|
+
instances: { label: "Instances", color: "var(--chart-1)" },
|
|
15
|
+
};
|
|
16
|
+
const tokensRankingConfig = {
|
|
17
|
+
tokens: { label: "Tokens", color: "var(--chart-1)" },
|
|
18
|
+
};
|
|
19
|
+
const instanceColumns = [
|
|
20
|
+
{ accessorKey: "key", header: "Instance key" },
|
|
21
|
+
{ accessorKey: "started", header: "Started" },
|
|
22
|
+
{
|
|
23
|
+
accessorKey: "agentNames",
|
|
24
|
+
header: "Agents",
|
|
25
|
+
cell: ({ row }) => row.original.agentNames.join(", "),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
accessorKey: "inputTokens",
|
|
29
|
+
header: "Input tokens",
|
|
30
|
+
meta: { align: "right" },
|
|
31
|
+
cell: ({ row }) => (_jsx("span", { className: "block text-right tabular-nums", children: row.original.inputTokens.toLocaleString() })),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
accessorKey: "outputTokens",
|
|
35
|
+
header: "Output tokens",
|
|
36
|
+
meta: { align: "right" },
|
|
37
|
+
cell: ({ row }) => (_jsx("span", { className: "block text-right tabular-nums", children: row.original.outputTokens.toLocaleString() })),
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
export function DashboardPage() {
|
|
41
|
+
const [processFilter, setProcessFilter] = React.useState(ALL);
|
|
42
|
+
const [versionFilter, setVersionFilter] = React.useState("");
|
|
43
|
+
const [agentFilter, setAgentFilter] = React.useState(ALL);
|
|
44
|
+
const [prevProcessFilter, setPrevProcessFilter] = React.useState(processFilter);
|
|
45
|
+
let effectiveVersionFilter = versionFilter;
|
|
46
|
+
let effectiveAgentFilter = agentFilter;
|
|
47
|
+
if (processFilter !== prevProcessFilter) {
|
|
48
|
+
setPrevProcessFilter(processFilter);
|
|
49
|
+
const process = processFilter === ALL ? undefined : getSelectedProcess(processFilter);
|
|
50
|
+
if (process) {
|
|
51
|
+
effectiveVersionFilter = String(process.latestVersion);
|
|
52
|
+
effectiveAgentFilter =
|
|
53
|
+
process.agents.length === 1 ? process.agents[0].name : ALL;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
effectiveVersionFilter = "";
|
|
57
|
+
effectiveAgentFilter = ALL;
|
|
58
|
+
}
|
|
59
|
+
setVersionFilter(effectiveVersionFilter);
|
|
60
|
+
setAgentFilter(effectiveAgentFilter);
|
|
61
|
+
}
|
|
62
|
+
const selectedProcess = processFilter === ALL ? undefined : getSelectedProcess(processFilter);
|
|
63
|
+
const visibleAgents = getVisibleAgents(processFilter, effectiveAgentFilter);
|
|
64
|
+
const kpis = computeKpis(processFilter, visibleAgents);
|
|
65
|
+
const trend = computeTokenTrend(processFilter, effectiveAgentFilter, visibleAgents);
|
|
66
|
+
const breakdown = computeTokenBreakdown(visibleAgents);
|
|
67
|
+
const toolFrequency = computeToolCallFrequency(visibleAgents);
|
|
68
|
+
const instanceRows = computeInstanceRows(processFilter, effectiveAgentFilter);
|
|
69
|
+
const processOptions = React.useMemo(() => getProcessOptions().map((opt) => ({ ...opt })), []);
|
|
70
|
+
const versionOptions = React.useMemo(() => selectedProcess
|
|
71
|
+
? getVersionOptions(selectedProcess).map((opt) => ({ ...opt }))
|
|
72
|
+
: [], [selectedProcess]);
|
|
73
|
+
const agentOptions = React.useMemo(() => selectedProcess
|
|
74
|
+
? getAgentOptions(selectedProcess).map((opt) => ({ ...opt }))
|
|
75
|
+
: [], [selectedProcess]);
|
|
76
|
+
const scopeFilters = (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Combobox, { options: processOptions, value: processFilter, onValueChange: (value) => setProcessFilter(value ?? ALL), placeholder: "Select process\u2026", searchPlaceholder: "Search processes\u2026", sortFn: preserveOrder, "aria-label": "Process", className: "w-56" }), selectedProcess ? (_jsx(Combobox, { options: versionOptions, value: effectiveVersionFilter,
|
|
77
|
+
// TODO: model per-version metrics; this filter is currently
|
|
78
|
+
// cosmetic — every version of a process shares the same mock
|
|
79
|
+
// dataset in this pass.
|
|
80
|
+
onValueChange: (value) => {
|
|
81
|
+
if (value)
|
|
82
|
+
setVersionFilter(value);
|
|
83
|
+
}, placeholder: "Select version\u2026", searchPlaceholder: "Search versions\u2026", sortFn: preserveOrder, "aria-label": "Version", className: "w-36" })) : null, selectedProcess ? (_jsx(Combobox, { options: agentOptions, value: effectiveAgentFilter, onValueChange: (value) => setAgentFilter(value ?? ALL), placeholder: "Select agent\u2026", searchPlaceholder: "Search agents\u2026", sortFn: preserveOrder, "aria-label": "Agent", className: "w-48" })) : null] }));
|
|
84
|
+
return (_jsx(AppShell, { sidebarLabel: "Agent Control Plane navigation", items: agentControlPlaneNavFor("processes"), breadcrumb: agentControlPlaneBreadcrumb, children: _jsxs(PageLayout, { tabIndex: -1, width: "constrained", children: [_jsx(PageHeader, { title: "Processes", description: "Drill into process and agent performance, token usage, and running instances.", actions: _jsx(DateRangePopover, {}) }), _jsxs("div", { className: "mt-6 space-y-8", children: [scopeFilters, _jsxs("div", { className: kpiGridClass, children: [_jsx(Scorecard, { label: "Total process instances", value: kpis.totalInstances.toLocaleString(), delta: kpis.deltas.totalInstances, sparkline: {
|
|
85
|
+
data: kpis.sparklines.totalInstances,
|
|
86
|
+
dataKey: "value",
|
|
87
|
+
} }), _jsx(Scorecard, { label: "Total agent runs", value: kpis.totalAgentRuns.toLocaleString(), delta: kpis.deltas.totalAgentRuns, sparkline: {
|
|
88
|
+
data: kpis.sparklines.totalAgentRuns,
|
|
89
|
+
dataKey: "value",
|
|
90
|
+
} }), _jsx(Scorecard, { label: "Total tokens", value: kpis.totalTokens.toLocaleString(), delta: kpis.deltas.totalTokens, sparkline: {
|
|
91
|
+
data: kpis.sparklines.totalTokens,
|
|
92
|
+
dataKey: "value",
|
|
93
|
+
} }), _jsx(Scorecard, { label: "Agent execution duration", value: `${kpis.medianResponseMs.toLocaleString()} ms`, delta: kpis.deltas.medianResponseMs, tooltip: "Median time from agent task activation to completion, across agent runs.", sparkline: {
|
|
94
|
+
data: kpis.sparklines.medianResponseMs,
|
|
95
|
+
dataKey: "value",
|
|
96
|
+
} })] }), processFilter === ALL ? (_jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Top processes by instances" }) }), _jsxs(CardContent, { children: [_jsx("div", { className: "w-full", style: {
|
|
97
|
+
height: categoryChartHeight(topProcessesByInstances.length),
|
|
98
|
+
}, children: _jsx(BarChart, { data: topProcessesByInstances.map((d) => ({ ...d })), categoryKey: "process", config: instancesRankingConfig, orientation: "horizontal", className: "aspect-auto h-full w-full" }) }), _jsxs(Button, { type: "button", variant: "secondary", size: "sm", className: "mt-2",
|
|
99
|
+
// TODO: navigate to a filtered view of processes
|
|
100
|
+
onClick: () => { }, children: ["All processes", _jsx(ArrowRight, {})] })] })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Top processes by tokens" }) }), _jsx(CardContent, { children: _jsx("div", { className: "w-full", style: {
|
|
101
|
+
height: categoryChartHeight(topProcessesByTokens.length),
|
|
102
|
+
}, children: _jsx(BarChart, { data: topProcessesByTokens.map((d) => ({ ...d })), categoryKey: "process", config: tokensRankingConfig, orientation: "horizontal", className: "aspect-auto h-full w-full" }) }) })] })] })) : null, _jsx(DashboardSection, { title: "Model & token usage", children: _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: kpiGridClass, children: _jsx(Scorecard, { label: "Model calls", value: kpis.modelCalls.toLocaleString(), delta: kpis.deltas.modelCalls, sparkline: {
|
|
103
|
+
data: kpis.sparklines.modelCalls,
|
|
104
|
+
dataKey: "value",
|
|
105
|
+
} }) }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Token trend" }) }), _jsx(CardContent, { children: _jsx(LineChart, { data: trend.data, categoryKey: "date", config: trend.config, curve: "linear", className: "h-56 w-full" }) })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Token usage by agent" }) }), _jsx(CardContent, { children: _jsx("div", { className: "w-full", style: {
|
|
106
|
+
height: categoryChartHeight(breakdown.data.length),
|
|
107
|
+
}, children: _jsx(BarChart, { data: breakdown.data, categoryKey: "agent", config: breakdown.config, orientation: "horizontal", stacked: true, className: "aspect-auto h-full w-full" }) }) })] })] })] }) }), _jsx(DashboardSection, { title: "Tool calls", children: _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: kpiGridClass, children: _jsx(Scorecard, { label: "Tool calls", value: kpis.toolCalls.toLocaleString(), delta: kpis.deltas.toolCalls, sparkline: {
|
|
108
|
+
data: kpis.sparklines.toolCalls,
|
|
109
|
+
dataKey: "value",
|
|
110
|
+
} }) }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Tool-call frequency" }) }), _jsx(CardContent, { children: _jsx("div", { className: "w-full", style: {
|
|
111
|
+
height: categoryChartHeight(toolFrequency.data.length),
|
|
112
|
+
}, children: _jsx(BarChart, { data: toolFrequency.data, categoryKey: "tool", config: toolFrequency.config, orientation: "horizontal", className: "aspect-auto h-full w-full" }) }) })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Tool-call heatmap" }) }), _jsxs(CardContent, { className: "flex flex-1 flex-col items-center justify-center gap-2 py-12 text-center", children: [_jsx(Workflow, { className: "size-8 text-neutral-foreground-subtle", "aria-hidden": "true" }), processFilter === ALL ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm font-medium text-foreground", children: "Select a process" }), _jsx("p", { className: "max-w-xs text-sm text-neutral-foreground-subtle", children: "See its tool-call heatmap by process step." })] })) : (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm font-medium text-foreground", children: "Not available" }), _jsx("p", { className: "max-w-xs text-sm text-neutral-foreground-subtle", children: "Needs a BPMN diagram renderer this design system doesn't have." })] }))] })] })] })] }) }), _jsx(DashboardSection, { title: "Instances", children: _jsx(DataTable, { columns: instanceColumns, data: instanceRows, sorting: true, getRowId: (row) => row.key }) })] })] }) }));
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=DashboardPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardPage.js","sourceRoot":"","sources":["../../../../src/examples/agent-control-plane-processes/DashboardPage.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGpD,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,GAEX,M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aAAa,KAAK,GAAG,CAAC,CAAC,CAAC,CACvB,8BACE,YAAG,SAAS,EAAC,qCAAqC,iCAE9C,EACJ,YAAG,SAAS,EAAC,iDAAiD,2DAE1D,IACH,CACJ,CAAC,CAAC,CAAC,CACF,8BACE,YAAG,SAAS,EAAC,qCAAqC,8BAE9C,EACJ,YAAG,SAAS,EAAC,iDAAiD,+EAG1D,IACH,CACJ,IACW,IACT,IACH,IACF,GACW,EAEnB,KAAC,gBAAgB,IAAC,KAAK,EAAC,WAAW,YACjC,KAAC,SAAS,IACR,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,YAAY,EAClB,OAAO,QACP,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,GAC1B,GACe,IACf,IACK,GACJ,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ChartConfig } from "../../index.js";
|
|
2
|
+
import { type ProcessDefinition, type Agent, type InstanceRow } from "./mock-data.js";
|
|
3
|
+
export declare const ALL = "all";
|
|
4
|
+
export declare function getProcessOptions(): {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}[];
|
|
8
|
+
export declare function getSelectedProcess(processName: string): ProcessDefinition | undefined;
|
|
9
|
+
export declare function getVersionOptions(process: ProcessDefinition): {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare function getAgentOptions(process: ProcessDefinition): {
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}[];
|
|
17
|
+
export declare function getVisibleAgents(processFilter: string, agentFilter: string): Agent[];
|
|
18
|
+
export declare function categoryChartHeight(rowCount: number): string;
|
|
19
|
+
export interface KpiDelta {
|
|
20
|
+
value: string;
|
|
21
|
+
direction: "increase" | "decrease";
|
|
22
|
+
variant?: "success" | "danger" | "neutral";
|
|
23
|
+
}
|
|
24
|
+
export interface KpiSparklines {
|
|
25
|
+
totalInstances: Record<string, unknown>[];
|
|
26
|
+
totalAgentRuns: Record<string, unknown>[];
|
|
27
|
+
totalTokens: Record<string, unknown>[];
|
|
28
|
+
medianResponseMs: Record<string, unknown>[];
|
|
29
|
+
modelCalls: Record<string, unknown>[];
|
|
30
|
+
toolCalls: Record<string, unknown>[];
|
|
31
|
+
}
|
|
32
|
+
export interface KpiDeltas {
|
|
33
|
+
totalInstances: KpiDelta;
|
|
34
|
+
totalAgentRuns: KpiDelta;
|
|
35
|
+
totalTokens: KpiDelta;
|
|
36
|
+
medianResponseMs: KpiDelta;
|
|
37
|
+
modelCalls: KpiDelta;
|
|
38
|
+
toolCalls: KpiDelta;
|
|
39
|
+
}
|
|
40
|
+
export interface Kpis {
|
|
41
|
+
totalInstances: number;
|
|
42
|
+
totalAgentRuns: number;
|
|
43
|
+
totalTokens: number;
|
|
44
|
+
medianResponseMs: number;
|
|
45
|
+
modelCalls: number;
|
|
46
|
+
toolCalls: number;
|
|
47
|
+
sparklines: KpiSparklines;
|
|
48
|
+
deltas: KpiDeltas;
|
|
49
|
+
}
|
|
50
|
+
export declare function computeKpis(processFilter: string, visibleAgents: Agent[]): Kpis;
|
|
51
|
+
export interface ModelCallCount {
|
|
52
|
+
model: string;
|
|
53
|
+
calls: number;
|
|
54
|
+
}
|
|
55
|
+
export declare function computeModelBreakdown(visibleAgents: Agent[]): ModelCallCount[];
|
|
56
|
+
export declare function computeMedianResponseSparkline(visibleAgents: Agent[]): Record<string, unknown>[];
|
|
57
|
+
export interface TrendSeries {
|
|
58
|
+
data: Record<string, unknown>[];
|
|
59
|
+
config: ChartConfig;
|
|
60
|
+
}
|
|
61
|
+
export declare function computeTokenTrend(processFilter: string, agentFilter: string, visibleAgents: Agent[]): TrendSeries;
|
|
62
|
+
export declare function computeTokenBreakdown(visibleAgents: Agent[]): TrendSeries;
|
|
63
|
+
export declare function computeToolCallFrequency(visibleAgents: Agent[]): TrendSeries;
|
|
64
|
+
export declare function computeInstanceRows(processFilter: string, agentFilter: string): InstanceRow[];
|
|
65
|
+
//# sourceMappingURL=derive.d.ts.map
|