@getloopscale/ui 0.0.0-stage → 0.37.1
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/LICENSE +201 -0
- package/README.md +61 -2
- package/dist/components/composites/account-menu/account-menu.d.ts +43 -0
- package/dist/components/composites/account-menu/index.d.ts +1 -0
- package/dist/components/composites/annotation-input/annotation-input.d.ts +38 -0
- package/dist/components/composites/annotation-input/index.d.ts +4 -0
- package/dist/components/composites/annotation-input/types.d.ts +31 -0
- package/dist/components/composites/annotation-summary-group/annotation-summary-group.d.ts +28 -0
- package/dist/components/composites/annotation-summary-group/index.d.ts +1 -0
- package/dist/components/composites/attributes-table/attributes-table.d.ts +20 -0
- package/dist/components/composites/attributes-table/index.d.ts +1 -0
- package/dist/components/composites/chat-message-card/chat-message-card.d.ts +14 -0
- package/dist/components/composites/chat-message-card/index.d.ts +1 -0
- package/dist/components/composites/code-block/code-block.d.ts +29 -0
- package/dist/components/composites/code-block/index.d.ts +1 -0
- package/dist/components/composites/command-palette/command-palette.d.ts +41 -0
- package/dist/components/composites/command-palette/index.d.ts +1 -0
- package/dist/components/composites/comment-thread/comment-thread.d.ts +24 -0
- package/dist/components/composites/comment-thread/index.d.ts +2 -0
- package/dist/components/composites/confirm-dialog/confirm-dialog.d.ts +41 -0
- package/dist/components/composites/confirm-dialog/index.d.ts +1 -0
- package/dist/components/composites/data-table/compare-values.d.ts +2 -0
- package/dist/components/composites/data-table/data-table-loading.d.ts +10 -0
- package/dist/components/composites/data-table/data-table-parts.d.ts +16 -0
- package/dist/components/composites/data-table/data-table-virtualized.d.ts +32 -0
- package/dist/components/composites/data-table/data-table.d.ts +82 -0
- package/dist/components/composites/data-table/index.d.ts +2 -0
- package/dist/components/composites/data-table/use-data-table-sort.d.ts +19 -0
- package/dist/components/composites/dataset-item-diff/dataset-item-diff.d.ts +19 -0
- package/dist/components/composites/dataset-item-diff/index.d.ts +4 -0
- package/dist/components/composites/dataset-item-diff/to-diff-text.d.ts +22 -0
- package/dist/components/composites/deployment-row/deployment-row.d.ts +28 -0
- package/dist/components/composites/deployment-row/index.d.ts +1 -0
- package/dist/components/composites/diff-view/diff-section.d.ts +19 -0
- package/dist/components/composites/diff-view/diff-view.d.ts +39 -0
- package/dist/components/composites/diff-view/index.d.ts +2 -0
- package/dist/components/composites/domain-config/domain-config.d.ts +34 -0
- package/dist/components/composites/domain-config/index.d.ts +1 -0
- package/dist/components/composites/env-var-editor/env-var-editor.d.ts +35 -0
- package/dist/components/composites/env-var-editor/index.d.ts +1 -0
- package/dist/components/composites/evaluator-form/evaluator-form.d.ts +25 -0
- package/dist/components/composites/evaluator-form/index.d.ts +3 -0
- package/dist/components/composites/evaluator-form/types.d.ts +41 -0
- package/dist/components/composites/histogram/histogram.d.ts +19 -0
- package/dist/components/composites/histogram/index.d.ts +2 -0
- package/dist/components/composites/io-cards/index.d.ts +2 -0
- package/dist/components/composites/io-cards/io-cards.d.ts +17 -0
- package/dist/components/composites/io-cards/message-card.d.ts +21 -0
- package/dist/components/composites/message-branch-selector/index.d.ts +1 -0
- package/dist/components/composites/message-branch-selector/message-branch-selector.d.ts +27 -0
- package/dist/components/composites/metric-card/index.d.ts +2 -0
- package/dist/components/composites/metric-card/metric-card.d.ts +46 -0
- package/dist/components/composites/page-shell/index.d.ts +1 -0
- package/dist/components/composites/page-shell/page-shell.d.ts +68 -0
- package/dist/components/composites/percentile-chart/index.d.ts +2 -0
- package/dist/components/composites/percentile-chart/percentile-chart.d.ts +37 -0
- package/dist/components/composites/preview-env-card/index.d.ts +1 -0
- package/dist/components/composites/preview-env-card/preview-env-card.d.ts +36 -0
- package/dist/components/composites/price-breakdown/index.d.ts +2 -0
- package/dist/components/composites/price-breakdown/price-breakdown.d.ts +21 -0
- package/dist/components/composites/project-card/index.d.ts +1 -0
- package/dist/components/composites/project-card/project-card.d.ts +32 -0
- package/dist/components/composites/prompt-template-editor/extract-vars.d.ts +1 -0
- package/dist/components/composites/prompt-template-editor/index.d.ts +2 -0
- package/dist/components/composites/prompt-template-editor/prompt-template-editor.d.ts +24 -0
- package/dist/components/composites/prompt-version-diff/index.d.ts +4 -0
- package/dist/components/composites/prompt-version-diff/prompt-version-diff.d.ts +20 -0
- package/dist/components/composites/prompt-version-diff/to-diff-text.d.ts +26 -0
- package/dist/components/composites/rollback-ui/index.d.ts +1 -0
- package/dist/components/composites/rollback-ui/rollback-ui.d.ts +32 -0
- package/dist/components/composites/session-summary/index.d.ts +1 -0
- package/dist/components/composites/session-summary/session-summary.d.ts +18 -0
- package/dist/components/composites/session-timeline/index.d.ts +1 -0
- package/dist/components/composites/session-timeline/session-timeline.d.ts +22 -0
- package/dist/components/composites/severity-badge/index.d.ts +2 -0
- package/dist/components/composites/severity-badge/severity-badge.d.ts +33 -0
- package/dist/components/composites/span-graph/index.d.ts +1 -0
- package/dist/components/composites/span-graph/span-graph.d.ts +19 -0
- package/dist/components/composites/span-tree/index.d.ts +2 -0
- package/dist/components/composites/span-tree/span-tree-row.d.ts +22 -0
- package/dist/components/composites/span-tree/span-tree-virtual.d.ts +7 -0
- package/dist/components/composites/span-tree/span-tree.d.ts +34 -0
- package/dist/components/composites/span-waterfall/index.d.ts +1 -0
- package/dist/components/composites/span-waterfall/span-waterfall.d.ts +28 -0
- package/dist/components/composites/status-indicator/index.d.ts +2 -0
- package/dist/components/composites/status-indicator/status-indicator.d.ts +31 -0
- package/dist/components/composites/stepper/index.d.ts +1 -0
- package/dist/components/composites/stepper/stepper.d.ts +53 -0
- package/dist/components/composites/tag-input/index.d.ts +2 -0
- package/dist/components/composites/tag-input/tag-input.d.ts +32 -0
- package/dist/components/composites/task-header/index.d.ts +1 -0
- package/dist/components/composites/task-header/task-header.d.ts +20 -0
- package/dist/components/composites/token-cost-breakdown/index.d.ts +2 -0
- package/dist/components/composites/token-cost-breakdown/token-cost-breakdown.d.ts +26 -0
- package/dist/components/composites/trace-compare/index.d.ts +1 -0
- package/dist/components/composites/trace-compare/trace-compare.d.ts +27 -0
- package/dist/components/composites/trace-transcript/index.d.ts +1 -0
- package/dist/components/composites/trace-transcript/trace-transcript.d.ts +26 -0
- package/dist/components/composites/trend-chart/index.d.ts +1 -0
- package/dist/components/composites/trend-chart/trend-chart.d.ts +117 -0
- package/dist/components/primitives/action-bar/action-bar.d.ts +36 -0
- package/dist/components/primitives/action-bar/index.d.ts +1 -0
- package/dist/components/primitives/alert/alert.d.ts +31 -0
- package/dist/components/primitives/alert/index.d.ts +1 -0
- package/dist/components/primitives/avatar/avatar.d.ts +26 -0
- package/dist/components/primitives/avatar/index.d.ts +1 -0
- package/dist/components/primitives/badge/badge.d.ts +33 -0
- package/dist/components/primitives/badge/index.d.ts +1 -0
- package/dist/components/primitives/breadcrumb/breadcrumb.d.ts +15 -0
- package/dist/components/primitives/breadcrumb/index.d.ts +1 -0
- package/dist/components/primitives/button/button.d.ts +26 -0
- package/dist/components/primitives/button/index.d.ts +1 -0
- package/dist/components/primitives/card/card.d.ts +59 -0
- package/dist/components/primitives/card/index.d.ts +1 -0
- package/dist/components/primitives/checkbox/checkbox.d.ts +20 -0
- package/dist/components/primitives/checkbox/index.d.ts +1 -0
- package/dist/components/primitives/combobox/combobox.d.ts +53 -0
- package/dist/components/primitives/combobox/index.d.ts +1 -0
- package/dist/components/primitives/copy-button/copy-button.d.ts +17 -0
- package/dist/components/primitives/copy-button/index.d.ts +1 -0
- package/dist/components/primitives/danger-zone/danger-zone.d.ts +40 -0
- package/dist/components/primitives/danger-zone/index.d.ts +1 -0
- package/dist/components/primitives/description-list/description-list.d.ts +33 -0
- package/dist/components/primitives/description-list/index.d.ts +1 -0
- package/dist/components/primitives/dialog/dialog.d.ts +31 -0
- package/dist/components/primitives/dialog/index.d.ts +1 -0
- package/dist/components/primitives/dropdown-menu/dropdown-menu.d.ts +68 -0
- package/dist/components/primitives/dropdown-menu/index.d.ts +1 -0
- package/dist/components/primitives/empty-state/empty-state.d.ts +22 -0
- package/dist/components/primitives/empty-state/index.d.ts +1 -0
- package/dist/components/primitives/file-dropzone/file-dropzone.d.ts +26 -0
- package/dist/components/primitives/file-dropzone/index.d.ts +1 -0
- package/dist/components/primitives/file-dropzone/validate.d.ts +40 -0
- package/dist/components/primitives/form-field/form-field.d.ts +44 -0
- package/dist/components/primitives/form-field/index.d.ts +1 -0
- package/dist/components/primitives/input/index.d.ts +1 -0
- package/dist/components/primitives/input/input.d.ts +24 -0
- package/dist/components/primitives/json-viewer/index.d.ts +1 -0
- package/dist/components/primitives/json-viewer/json-viewer.d.ts +32 -0
- package/dist/components/primitives/label/index.d.ts +1 -0
- package/dist/components/primitives/label/label.d.ts +15 -0
- package/dist/components/primitives/login-split/index.d.ts +1 -0
- package/dist/components/primitives/login-split/login-split.d.ts +24 -0
- package/dist/components/primitives/metrics-panel/index.d.ts +1 -0
- package/dist/components/primitives/metrics-panel/metrics-panel.d.ts +62 -0
- package/dist/components/primitives/pagination/index.d.ts +1 -0
- package/dist/components/primitives/pagination/pagination.d.ts +44 -0
- package/dist/components/primitives/pin-input/index.d.ts +1 -0
- package/dist/components/primitives/pin-input/pin-input.d.ts +41 -0
- package/dist/components/primitives/plan-badge/index.d.ts +1 -0
- package/dist/components/primitives/plan-badge/plan-badge.d.ts +35 -0
- package/dist/components/primitives/progress/index.d.ts +1 -0
- package/dist/components/primitives/progress/progress.d.ts +44 -0
- package/dist/components/primitives/radio-group/index.d.ts +1 -0
- package/dist/components/primitives/radio-group/radio-group.d.ts +5 -0
- package/dist/components/primitives/scroll-area/index.d.ts +2 -0
- package/dist/components/primitives/scroll-area/scroll-area.d.ts +40 -0
- package/dist/components/primitives/scroll-area/use-stick-to-bottom.d.ts +20 -0
- package/dist/components/primitives/select/index.d.ts +1 -0
- package/dist/components/primitives/select/select.d.ts +50 -0
- package/dist/components/primitives/sheet/index.d.ts +1 -0
- package/dist/components/primitives/sheet/sheet.d.ts +33 -0
- package/dist/components/primitives/sidebar/index.d.ts +1 -0
- package/dist/components/primitives/sidebar/sidebar.d.ts +76 -0
- package/dist/components/primitives/skeleton/index.d.ts +1 -0
- package/dist/components/primitives/skeleton/skeleton.d.ts +21 -0
- package/dist/components/primitives/slider/index.d.ts +1 -0
- package/dist/components/primitives/slider/slider.d.ts +24 -0
- package/dist/components/primitives/social-auth-row/index.d.ts +1 -0
- package/dist/components/primitives/social-auth-row/social-auth-row.d.ts +24 -0
- package/dist/components/primitives/stat-tile/index.d.ts +1 -0
- package/dist/components/primitives/stat-tile/stat-tile.d.ts +28 -0
- package/dist/components/primitives/status-dot/index.d.ts +1 -0
- package/dist/components/primitives/status-dot/status-dot.d.ts +31 -0
- package/dist/components/primitives/switch/index.d.ts +1 -0
- package/dist/components/primitives/switch/switch.d.ts +20 -0
- package/dist/components/primitives/table/index.d.ts +1 -0
- package/dist/components/primitives/table/table.d.ts +61 -0
- package/dist/components/primitives/tabs/index.d.ts +1 -0
- package/dist/components/primitives/tabs/tabs.d.ts +7 -0
- package/dist/components/primitives/textarea/index.d.ts +1 -0
- package/dist/components/primitives/textarea/textarea.d.ts +20 -0
- package/dist/components/primitives/timestamp/index.d.ts +1 -0
- package/dist/components/primitives/timestamp/timestamp.d.ts +34 -0
- package/dist/components/primitives/toast/index.d.ts +2 -0
- package/dist/components/primitives/toast/toast.d.ts +34 -0
- package/dist/components/primitives/toast/toaster.d.ts +38 -0
- package/dist/components/primitives/tooltip/index.d.ts +1 -0
- package/dist/components/primitives/tooltip/tooltip.d.ts +33 -0
- package/dist/components/primitives/topnav/index.d.ts +1 -0
- package/dist/components/primitives/topnav/topnav.d.ts +29 -0
- package/dist/components/primitives/update-banner/index.d.ts +1 -0
- package/dist/components/primitives/update-banner/update-banner.d.ts +16 -0
- package/dist/components.css +2 -0
- package/dist/fonts/geist-400.woff2 +0 -0
- package/dist/fonts/geist-500.woff2 +0 -0
- package/dist/fonts/geist-600.woff2 +0 -0
- package/dist/fonts/geist-mono-400.woff2 +0 -0
- package/dist/fonts/geist-mono-500.woff2 +0 -0
- package/dist/fonts/geist-mono-600.woff2 +0 -0
- package/dist/fonts-cdn.css +28 -0
- package/dist/fonts.css +75 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.js +9274 -0
- package/dist/lib/chart/histogram.d.ts +21 -0
- package/dist/lib/chart/index.d.ts +1 -0
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/diff/diff-lines.d.ts +23 -0
- package/dist/lib/diff/index.d.ts +1 -0
- package/dist/lib/env.d.ts +55 -0
- package/dist/lib/live-region-context.d.ts +2 -0
- package/dist/lib/safe-href.d.ts +27 -0
- package/dist/lib/session/aggregate.d.ts +18 -0
- package/dist/lib/session/index.d.ts +2 -0
- package/dist/lib/session/types.d.ts +30 -0
- package/dist/lib/trace/align.d.ts +41 -0
- package/dist/lib/trace/attributes.d.ts +11 -0
- package/dist/lib/trace/bar-layout.d.ts +52 -0
- package/dist/lib/trace/chat.d.ts +14 -0
- package/dist/lib/trace/cost.d.ts +24 -0
- package/dist/lib/trace/duration.d.ts +18 -0
- package/dist/lib/trace/flatten.d.ts +28 -0
- package/dist/lib/trace/graph-layout.d.ts +52 -0
- package/dist/lib/trace/index.d.ts +9 -0
- package/dist/lib/trace/types.d.ts +85 -0
- package/dist/lib/types.d.ts +10 -0
- package/dist/preset.css +27 -0
- package/dist/styles/tailwind-preset.d.ts +29 -0
- package/dist/styles-v3-legacy.css +88 -0
- package/dist/styles.css +137 -0
- package/dist/tailwind-preset.js +166 -0
- package/dist/test/a11y.d.ts +13 -0
- package/dist/test/fixtures/trace.d.ts +19 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/tokens-v4.css +223 -0
- package/dist/tokens.css +315 -0
- package/dist/types/task.d.ts +9 -0
- package/package.json +127 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { DataTableColumn, DataTableSort } from "./data-table.js";
|
|
3
|
+
/** Header row shared by the default and virtualized DataTable bodies. */
|
|
4
|
+
export declare function DataTableHeaderRow<T>(props: {
|
|
5
|
+
columns: DataTableColumn<T>[];
|
|
6
|
+
sort: DataTableSort | null;
|
|
7
|
+
onSortClick: (columnKey: string) => void;
|
|
8
|
+
hasExpandColumn?: boolean;
|
|
9
|
+
hasActionsColumn?: boolean;
|
|
10
|
+
}): ReactNode;
|
|
11
|
+
/** Row-actions dropdown cell shared by both DataTable bodies. */
|
|
12
|
+
export declare function DataTableRowActionsCell(props: {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}): ReactNode;
|
|
15
|
+
/** Renders a body cell's content per column definition (shared by both bodies). */
|
|
16
|
+
export declare function renderCellContent<T>(row: T, col: DataTableColumn<T>): ReactNode;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { VirtualizerOptions } from "@tanstack/react-virtual";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import type { DataTableBaseProps } from "./data-table.js";
|
|
4
|
+
/**
|
|
5
|
+
* Virtualized body of DataTable — renders 10K+ rows over @tanstack/react-virtual
|
|
6
|
+
* (blueprint M6, ADR D1/D2 + review fix F-dom-1). Semantic `<table>` preserved
|
|
7
|
+
* with the SPACER-ROW technique: two fixed-height spacer `<tr>`s grow the
|
|
8
|
+
* table's real layout box to the full dataset height, so the sticky `<thead>`
|
|
9
|
+
* keeps its containing block for the whole scroll and the last row stays
|
|
10
|
+
* reachable — per-row transforms (the official example's pattern) do NOT grow
|
|
11
|
+
* the layout box and un-stick the header after ~one window.
|
|
12
|
+
*
|
|
13
|
+
* Limitations (documented contract — mutually exclusive at the type level):
|
|
14
|
+
* no pagination, no expandable rows (fixed row heights are required by
|
|
15
|
+
* estimateSize). Cell content must fit `rowHeight` (cells are clipped with
|
|
16
|
+
* reduced padding; keep rowHeight >= ~32px). A row-action dropdown unmounts
|
|
17
|
+
* when its row leaves the overscan window.
|
|
18
|
+
*/
|
|
19
|
+
export interface DataTableVirtualizedOptions {
|
|
20
|
+
/** Scroll container height (px or CSS length). */
|
|
21
|
+
height: number | string;
|
|
22
|
+
/** Fixed row height in px — required by the virtualizer's estimateSize. */
|
|
23
|
+
rowHeight: number;
|
|
24
|
+
/** Rows rendered beyond the viewport on each side. @default 5 */
|
|
25
|
+
overscan?: number;
|
|
26
|
+
/** @internal test-only — inject virtualizer options (e.g. observeElementRect). */
|
|
27
|
+
virtualizerOptions?: Partial<VirtualizerOptions<HTMLElement, Element>>;
|
|
28
|
+
}
|
|
29
|
+
export type DataTableVirtualizedBodyProps<T> = Omit<DataTableBaseProps<T>, "stickyHeader"> & {
|
|
30
|
+
virtualized: DataTableVirtualizedOptions;
|
|
31
|
+
};
|
|
32
|
+
export declare function DataTableVirtualizedBody<T>(props: DataTableVirtualizedBodyProps<T>): ReactNode;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { DataTableVirtualizedOptions } from "./data-table-virtualized.js";
|
|
3
|
+
/**
|
|
4
|
+
* DataTable — generic, sortable, expandable composite over `<Table>`.
|
|
5
|
+
*
|
|
6
|
+
* Adds operator-grade entity-list patterns on top of the plain Table
|
|
7
|
+
* primitive: sortable headers, sticky header, expandable rows
|
|
8
|
+
* (multi-row by default), row action menus (Dropdown), client-side
|
|
9
|
+
* pagination, loading skeleton rows, empty state. Both sort and
|
|
10
|
+
* pagination support controlled OR uncontrolled mode (consumer
|
|
11
|
+
* passes onSortChange / onPageChange to take over state).
|
|
12
|
+
*
|
|
13
|
+
* `virtualized` mode (M6) renders 10K+ rows over @tanstack/react-virtual.
|
|
14
|
+
* It is mutually exclusive with `pagination` and `expandable` at the type
|
|
15
|
+
* level — a virtualized list is one continuous scroll of fixed-height rows.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <DataTable
|
|
19
|
+
* columns={[
|
|
20
|
+
* { key: "name", label: "Name", sortable: true },
|
|
21
|
+
* { key: "status", label: "Status" },
|
|
22
|
+
* ]}
|
|
23
|
+
* data={domains}
|
|
24
|
+
* rowKey={(d) => d.id}
|
|
25
|
+
* expandable={(d) => d.status === "pending" ? <DnsRecords domain={d} /> : null}
|
|
26
|
+
* rowActions={(d) => (
|
|
27
|
+
* <>
|
|
28
|
+
* <DropdownMenu.Item onSelect={() => editDomain(d)}>Edit</DropdownMenu.Item>
|
|
29
|
+
* <DropdownMenu.Item onSelect={() => deleteDomain(d)}>Delete</DropdownMenu.Item>
|
|
30
|
+
* </>
|
|
31
|
+
* )}
|
|
32
|
+
* />
|
|
33
|
+
*/
|
|
34
|
+
export interface DataTableColumn<T> {
|
|
35
|
+
key: string;
|
|
36
|
+
label: ReactNode;
|
|
37
|
+
align?: "left" | "center" | "right";
|
|
38
|
+
sortable?: boolean;
|
|
39
|
+
width?: string;
|
|
40
|
+
render?: (row: T) => ReactNode;
|
|
41
|
+
className?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface DataTableSort {
|
|
44
|
+
key: string;
|
|
45
|
+
direction: "asc" | "desc";
|
|
46
|
+
}
|
|
47
|
+
export interface DataTableBaseProps<T> {
|
|
48
|
+
data: T[];
|
|
49
|
+
columns: DataTableColumn<T>[];
|
|
50
|
+
rowKey: (row: T) => string;
|
|
51
|
+
stickyHeader?: boolean;
|
|
52
|
+
rowActions?: (row: T) => ReactNode;
|
|
53
|
+
defaultSort?: DataTableSort;
|
|
54
|
+
sort?: DataTableSort | null;
|
|
55
|
+
onSortChange?: (sort: DataTableSort | null) => void;
|
|
56
|
+
loading?: boolean;
|
|
57
|
+
emptyState?: ReactNode;
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Discriminated union: the default mode keeps pagination/expandable; the
|
|
62
|
+
* virtualized mode excludes them at the type level (fixed-height single
|
|
63
|
+
* scroll — see DataTableVirtualizedOptions for the documented limitations).
|
|
64
|
+
*/
|
|
65
|
+
export type DataTableProps<T> = DataTableBaseProps<T> & ({
|
|
66
|
+
virtualized?: never;
|
|
67
|
+
expandable?: (row: T) => ReactNode | null;
|
|
68
|
+
expandMode?: "single" | "multiple";
|
|
69
|
+
pagination?: {
|
|
70
|
+
pageSize: number;
|
|
71
|
+
controlledPage?: number;
|
|
72
|
+
onPageChange?: (page: number) => void;
|
|
73
|
+
} | null;
|
|
74
|
+
} | {
|
|
75
|
+
virtualized: DataTableVirtualizedOptions;
|
|
76
|
+
expandable?: never;
|
|
77
|
+
expandMode?: never;
|
|
78
|
+
pagination?: never;
|
|
79
|
+
stickyHeader?: never;
|
|
80
|
+
});
|
|
81
|
+
declare function DataTable<T>(props: DataTableProps<T>): ReactNode;
|
|
82
|
+
export { DataTable };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DataTableColumn, DataTableSort } from "./data-table.js";
|
|
2
|
+
/**
|
|
3
|
+
* Shared controlled/uncontrolled sort state for both DataTable modes.
|
|
4
|
+
* Cycle: none → asc → desc → none. Client-side sorting applies only in
|
|
5
|
+
* uncontrolled mode (controlled consumers pre-sort their data).
|
|
6
|
+
*/
|
|
7
|
+
export declare function useDataTableSort<T>(opts: {
|
|
8
|
+
data: T[];
|
|
9
|
+
columns: DataTableColumn<T>[];
|
|
10
|
+
defaultSort?: DataTableSort;
|
|
11
|
+
sort?: DataTableSort | null;
|
|
12
|
+
onSortChange?: (sort: DataTableSort | null) => void;
|
|
13
|
+
/** Fired on uncontrolled sort change (EC-8: page reset in paginated mode). */
|
|
14
|
+
onUncontrolledSortChange?: () => void;
|
|
15
|
+
}): {
|
|
16
|
+
sort: DataTableSort | null;
|
|
17
|
+
handleSort: (columnKey: string) => void;
|
|
18
|
+
sortedData: T[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
import { type DiffSectionCommon } from "../diff-view/diff-section.js";
|
|
3
|
+
import { type DatasetItemSnapshot } from "./to-diff-text.js";
|
|
4
|
+
/**
|
|
5
|
+
* DatasetItemDiff — diffs two dataset-item versions (M14 ADR D3). Stringifies
|
|
6
|
+
* each field (input / expectedOutput / metadata) and composes a labeled
|
|
7
|
+
* `DiffView` per field. Zero new dependency — reuses the DS diff primitive.
|
|
8
|
+
*
|
|
9
|
+
* A field absent in BOTH items is omitted honestly (no empty "No changes"
|
|
10
|
+
* table); a field present on either side is rendered so an add/remove shows.
|
|
11
|
+
*
|
|
12
|
+
* <DatasetItemDiff oldItem={v1} newItem={v2} />
|
|
13
|
+
*/
|
|
14
|
+
export type DatasetItemDiffProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & DiffSectionCommon & {
|
|
15
|
+
oldItem: DatasetItemSnapshot;
|
|
16
|
+
newItem: DatasetItemSnapshot;
|
|
17
|
+
};
|
|
18
|
+
declare function DatasetItemDiff(props: DatasetItemDiffProps): import("react").JSX.Element;
|
|
19
|
+
export { DatasetItemDiff };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure normalizers for dataset-item snapshots (M14 ADR D3). Turns each field
|
|
3
|
+
* (input / expectedOutput / metadata), whose value is `unknown`, into the plain
|
|
4
|
+
* text a `DiffView` diffs. No React, no I/O; total and deterministic.
|
|
5
|
+
*/
|
|
6
|
+
/** A dataset item version. Fields are optional so absent ones can be omitted. */
|
|
7
|
+
export interface DatasetItemSnapshot {
|
|
8
|
+
input: unknown;
|
|
9
|
+
expectedOutput?: unknown;
|
|
10
|
+
metadata?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Stringify a field value for diffing: a string passes through unchanged;
|
|
14
|
+
* `undefined`/`null` become ""; anything else is pretty-printed JSON. Keeping
|
|
15
|
+
* strings raw avoids wrapping user text in quotes/escapes in the diff.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fieldToText(value: unknown): string;
|
|
18
|
+
/**
|
|
19
|
+
* True when a field is present on either side — the caller renders a section
|
|
20
|
+
* only for present fields, omitting one absent in BOTH items honestly.
|
|
21
|
+
*/
|
|
22
|
+
export declare function fieldPresent(a: unknown, b: unknown): boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type DeploymentStatus = "queued" | "building" | "deploying" | "live" | "failed" | "cancelled" | "idle";
|
|
3
|
+
export interface Deployment {
|
|
4
|
+
id: string;
|
|
5
|
+
status: DeploymentStatus;
|
|
6
|
+
environment: string;
|
|
7
|
+
branch: string;
|
|
8
|
+
commitSha: string;
|
|
9
|
+
commitMessage: string;
|
|
10
|
+
author?: {
|
|
11
|
+
name: string;
|
|
12
|
+
avatarUrl?: string;
|
|
13
|
+
};
|
|
14
|
+
duration?: string;
|
|
15
|
+
timeAgo: string;
|
|
16
|
+
}
|
|
17
|
+
interface DeploymentRowProps extends HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
deployment: Deployment;
|
|
19
|
+
actions?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* DeploymentRow — one row in a deployment list (table-ish layout).
|
|
23
|
+
*
|
|
24
|
+
* Inspired by Vercel/Railway deployment lists. Composes Badge + Badge.Dot for status,
|
|
25
|
+
* mono font for SHA/branch, muted-foreground for metadata.
|
|
26
|
+
*/
|
|
27
|
+
declare const DeploymentRow: import("react").ForwardRefExoticComponent<DeploymentRowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export { DeploymentRow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DeploymentRow, type Deployment, type DeploymentStatus } from "./deployment-row.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type DiffViewMode } from "./diff-view.js";
|
|
2
|
+
/**
|
|
3
|
+
* DiffSection — a labeled `DiffView` (a heading + the diff table). Shared by the
|
|
4
|
+
* domain composites (PromptVersionDiff, DatasetItemDiff) so each labeled diff is
|
|
5
|
+
* a single call instead of a repeated heading+DiffView block (DRY).
|
|
6
|
+
*/
|
|
7
|
+
/** The DiffView pass-through props the composites forward to every section. */
|
|
8
|
+
export interface DiffSectionCommon {
|
|
9
|
+
/** Layout mode, forwarded to DiffView. */
|
|
10
|
+
mode?: DiffViewMode;
|
|
11
|
+
oldLabel?: string;
|
|
12
|
+
newLabel?: string;
|
|
13
|
+
}
|
|
14
|
+
export type DiffSectionProps = DiffSectionCommon & {
|
|
15
|
+
title: string;
|
|
16
|
+
oldText: string;
|
|
17
|
+
newText: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function DiffSection({ title, oldText, newText, ...rest }: DiffSectionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* DiffView — a controlled, line-level text diff rendered as a semantic table
|
|
4
|
+
* (M14 ADR D2). Runs the pure `diffLines` LCS over `oldText`/`newText`; zero
|
|
5
|
+
* new dependency (registry stays copy-pasteable — M14 ADR D1).
|
|
6
|
+
*
|
|
7
|
+
* `mode="split"` (default) shows two columns — old on the left, new on the
|
|
8
|
+
* right, aligning `del` rows on the left and `add` rows on the right; `eq` on
|
|
9
|
+
* both. `mode="unified"` shows a single inline column with `+`/`-` prefixes.
|
|
10
|
+
*
|
|
11
|
+
* A11y is not color-alone: every changed row carries a TEXTUAL marker
|
|
12
|
+
* (`+`/`-`/` `) plus `data-diff`, and the whole thing is a `<table>` with an
|
|
13
|
+
* sr-only `<caption>` so screen readers announce a data table. Identical input
|
|
14
|
+
* reads as an honest "No changes" state, never an empty table.
|
|
15
|
+
*
|
|
16
|
+
* <DiffView oldText={v1} newText={v2} oldLabel="v1" newLabel="v2" />
|
|
17
|
+
*/
|
|
18
|
+
export type DiffViewMode = "split" | "unified";
|
|
19
|
+
export type DiffViewProps = Omit<HTMLAttributes<HTMLTableElement>, "children"> & {
|
|
20
|
+
oldText: string;
|
|
21
|
+
newText: string;
|
|
22
|
+
/** Layout: two-column split (default) or inline unified. */
|
|
23
|
+
mode?: DiffViewMode;
|
|
24
|
+
/** Column header for the old text (split) / caption context. */
|
|
25
|
+
oldLabel?: string;
|
|
26
|
+
/** Column header for the new text (split) / caption context. */
|
|
27
|
+
newLabel?: string;
|
|
28
|
+
};
|
|
29
|
+
declare const DiffView: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLTableElement>, "children"> & {
|
|
30
|
+
oldText: string;
|
|
31
|
+
newText: string;
|
|
32
|
+
/** Layout: two-column split (default) or inline unified. */
|
|
33
|
+
mode?: DiffViewMode;
|
|
34
|
+
/** Column header for the old text (split) / caption context. */
|
|
35
|
+
oldLabel?: string;
|
|
36
|
+
/** Column header for the new text (split) / caption context. */
|
|
37
|
+
newLabel?: string;
|
|
38
|
+
} & import("react").RefAttributes<HTMLTableElement>>;
|
|
39
|
+
export { DiffView };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type DomainStatus = "verified" | "pending" | "invalid";
|
|
3
|
+
export interface Domain {
|
|
4
|
+
id: string;
|
|
5
|
+
hostname: string;
|
|
6
|
+
status: DomainStatus;
|
|
7
|
+
primary?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* TLS state. If true, certificate is provisioned & valid.
|
|
10
|
+
*/
|
|
11
|
+
tls?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* DNS record the user must add to verify ownership.
|
|
14
|
+
*/
|
|
15
|
+
verificationRecord?: {
|
|
16
|
+
type: "TXT" | "CNAME" | "A";
|
|
17
|
+
name: string;
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface DomainConfigProps extends HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
domains: Domain[];
|
|
23
|
+
onAdd?: (hostname: string) => void;
|
|
24
|
+
onRemove?: (id: string) => void;
|
|
25
|
+
onSetPrimary?: (id: string) => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* DomainConfig — manage custom domains for a project.
|
|
29
|
+
*
|
|
30
|
+
* Shows: hostname, status, TLS, primary flag, and verification DNS record when pending.
|
|
31
|
+
* Common in every cloud dashboard (Vercel, Railway, Render).
|
|
32
|
+
*/
|
|
33
|
+
declare const DomainConfig: import("react").ForwardRefExoticComponent<DomainConfigProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
|
+
export { DomainConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DomainConfig, type Domain, type DomainStatus } from "./domain-config.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type EnvScope = "production" | "staging" | "preview" | "all" | string;
|
|
3
|
+
export interface EnvVar {
|
|
4
|
+
id: string;
|
|
5
|
+
key: string;
|
|
6
|
+
/**
|
|
7
|
+
* Secret value. If `masked` is true, value is hidden by default.
|
|
8
|
+
*/
|
|
9
|
+
value: string;
|
|
10
|
+
masked?: boolean;
|
|
11
|
+
scope?: EnvScope;
|
|
12
|
+
/**
|
|
13
|
+
* Read-only marker (e.g. system-managed vars like LOOPZERO_DEPLOY_ID).
|
|
14
|
+
*/
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface EnvVarEditorProps extends HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
vars: EnvVar[];
|
|
19
|
+
onAdd?: (entry: Omit<EnvVar, "id">) => void;
|
|
20
|
+
onRemove?: (id: string) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Available scope options for the add form. Defaults to a sensible PaaS set.
|
|
23
|
+
*/
|
|
24
|
+
scopeOptions?: EnvScope[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* EnvVarEditor — table-like editor for environment variables.
|
|
28
|
+
*
|
|
29
|
+
* Mono font on keys/values, mask toggle on secret values, scope badge,
|
|
30
|
+
* remove + copy actions. Add form sits above the list.
|
|
31
|
+
*
|
|
32
|
+
* Stateless: caller controls the list and reacts to onAdd / onRemove.
|
|
33
|
+
*/
|
|
34
|
+
declare const EnvVarEditor: import("react").ForwardRefExoticComponent<EnvVarEditorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
35
|
+
export { EnvVarEditor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EnvVarEditor, type EnvScope, type EnvVar } from "./env-var-editor.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type EvaluatorConfig } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* EvaluatorForm — a controlled, config-driven builder for a built-in evaluator
|
|
4
|
+
* (M18). Dispatches on `value.type` (Phoenix's code-evaluator model): a
|
|
5
|
+
* `<select>` switches the evaluator type; the fields below it edit the config
|
|
6
|
+
* for the current type — exact_match/contains → a target string; regex →
|
|
7
|
+
* pattern + optional flags; levenshtein/json_distance → a numeric threshold.
|
|
8
|
+
* Switching type emits a FRESH config of that type with sensible defaults.
|
|
9
|
+
*
|
|
10
|
+
* Fully controlled (`value` + `onChange`); the consumer owns the config and its
|
|
11
|
+
* persistence. The form only EDITS — execution/sandboxing of the evaluator is a
|
|
12
|
+
* platform concern (ADR D3). Composes DS primitives; zero new dependency.
|
|
13
|
+
*
|
|
14
|
+
* <EvaluatorForm value={cfg} onChange={setCfg} />
|
|
15
|
+
*/
|
|
16
|
+
export interface EvaluatorFormProps {
|
|
17
|
+
/** The evaluator config being edited (discriminated by `type`). */
|
|
18
|
+
value: EvaluatorConfig;
|
|
19
|
+
/** Emitted with the new config on any edit — always fully typed. */
|
|
20
|
+
onChange: (value: EvaluatorConfig) => void;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const EvaluatorForm: import("react").ForwardRefExoticComponent<EvaluatorFormProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
25
|
+
export { EvaluatorForm };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { EvaluatorForm, type EvaluatorFormProps } from "./evaluator-form.js";
|
|
2
|
+
export type { EvaluatorConfig, EvaluatorType, ExactMatchEvaluatorConfig, ContainsEvaluatorConfig, RegexEvaluatorConfig, LevenshteinEvaluatorConfig, JsonDistanceEvaluatorConfig, } from "./types.js";
|
|
3
|
+
export { defaultEvaluatorConfig, isTargetEvaluator, isRegexEvaluator, isThresholdEvaluator, } from "./types.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluator config types — the discriminated-union contract for EvaluatorForm
|
|
3
|
+
* (M18). Follows Phoenix's built-in code-evaluator model: each evaluator has a
|
|
4
|
+
* `type` discriminant plus the fields that type needs. The config is a plain
|
|
5
|
+
* descriptor the consumer owns (fixture or backend store) — EvaluatorForm only
|
|
6
|
+
* EDITS it; execution/sandboxing of the evaluator is a platform concern (ADR
|
|
7
|
+
* D3). Same union + Extract narrowing pattern as AnnotationInput (M12), which
|
|
8
|
+
* side-steps the TS#30581 correlated-union limitation.
|
|
9
|
+
*/
|
|
10
|
+
/** A string-target evaluator: the produced output is matched against `target`. */
|
|
11
|
+
export interface ExactMatchEvaluatorConfig {
|
|
12
|
+
type: "exact_match";
|
|
13
|
+
target: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ContainsEvaluatorConfig {
|
|
16
|
+
type: "contains";
|
|
17
|
+
target: string;
|
|
18
|
+
}
|
|
19
|
+
/** A regex evaluator: `pattern` is the source, `flags` the optional RegExp flags. */
|
|
20
|
+
export interface RegexEvaluatorConfig {
|
|
21
|
+
type: "regex";
|
|
22
|
+
pattern: string;
|
|
23
|
+
flags?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A Levenshtein-distance evaluator: passes when distance ≤ `threshold`. */
|
|
26
|
+
export interface LevenshteinEvaluatorConfig {
|
|
27
|
+
type: "levenshtein";
|
|
28
|
+
threshold: number;
|
|
29
|
+
}
|
|
30
|
+
/** A JSON-structural-distance evaluator: passes when distance ≤ `threshold`. */
|
|
31
|
+
export interface JsonDistanceEvaluatorConfig {
|
|
32
|
+
type: "json_distance";
|
|
33
|
+
threshold: number;
|
|
34
|
+
}
|
|
35
|
+
export type EvaluatorType = EvaluatorConfig["type"];
|
|
36
|
+
export type EvaluatorConfig = ExactMatchEvaluatorConfig | ContainsEvaluatorConfig | RegexEvaluatorConfig | LevenshteinEvaluatorConfig | JsonDistanceEvaluatorConfig;
|
|
37
|
+
export declare function isTargetEvaluator(c: EvaluatorConfig): c is ExactMatchEvaluatorConfig | ContainsEvaluatorConfig;
|
|
38
|
+
export declare function isRegexEvaluator(c: EvaluatorConfig): c is RegexEvaluatorConfig;
|
|
39
|
+
export declare function isThresholdEvaluator(c: EvaluatorConfig): c is LevenshteinEvaluatorConfig | JsonDistanceEvaluatorConfig;
|
|
40
|
+
/** A fresh config of `type` with sensible defaults — emitted on a type switch. */
|
|
41
|
+
export declare function defaultEvaluatorConfig(type: EvaluatorType): EvaluatorConfig;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
import { type HistogramBin } from "../../../lib/chart/histogram.js";
|
|
3
|
+
type HistogramData = {
|
|
4
|
+
bins: HistogramBin[];
|
|
5
|
+
values?: never;
|
|
6
|
+
binCount?: never;
|
|
7
|
+
} | {
|
|
8
|
+
values: number[];
|
|
9
|
+
binCount: number;
|
|
10
|
+
bins?: never;
|
|
11
|
+
};
|
|
12
|
+
export type HistogramProps = HTMLAttributes<HTMLElement> & {
|
|
13
|
+
title: string;
|
|
14
|
+
height?: number;
|
|
15
|
+
/** Formats the count axis label and the bin bounds in the a11y table. */
|
|
16
|
+
valueFormatter?: (v: number) => string;
|
|
17
|
+
} & HistogramData;
|
|
18
|
+
declare const Histogram: import("react").ForwardRefExoticComponent<HistogramProps & import("react").RefAttributes<HTMLElement>>;
|
|
19
|
+
export { Histogram };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RenderMarkdown } from "./message-card.js";
|
|
2
|
+
export interface IOCardsProps {
|
|
3
|
+
/** Raw payload string: a chat-message-array JSON, other JSON, or plain text. */
|
|
4
|
+
value?: string;
|
|
5
|
+
/** Optional slot for rendering markdown bodies (e.g. react-markdown + sanitize). Default: plain text. */
|
|
6
|
+
renderMarkdown?: RenderMarkdown;
|
|
7
|
+
"data-testid"?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* IOCards — renders a span's input/output value. A chat-message array becomes
|
|
11
|
+
* role-labeled cards (with tool-call/result linkage and long-history
|
|
12
|
+
* collapse); a redacted marker and non-chat payloads fall back to a plain
|
|
13
|
+
* message or the dependency-free `JsonViewer`. Markdown bodies go through the
|
|
14
|
+
* optional `renderMarkdown` slot — the default renderer NEVER interprets HTML
|
|
15
|
+
* (XSS-safe by construction; no `dangerouslySetInnerHTML` anywhere).
|
|
16
|
+
*/
|
|
17
|
+
export declare function IOCards({ value, renderMarkdown, "data-testid": testId }: IOCardsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ChatMessage, ToolCall } from "../../../lib/trace/types.js";
|
|
3
|
+
export type RenderMarkdown = (text: string) => ReactNode;
|
|
4
|
+
/** Props shared by the message-rendering components (kills the repeated `{message, renderMarkdown}` shape). */
|
|
5
|
+
interface MessageProps {
|
|
6
|
+
message: ChatMessage;
|
|
7
|
+
renderMarkdown?: RenderMarkdown;
|
|
8
|
+
}
|
|
9
|
+
/** A bordered, role-labeled Card: role Badge + body (markdown slot or plain text) + raw-JSON toggle. */
|
|
10
|
+
export declare function MessageCard({ message, renderMarkdown }: MessageProps): import("react").JSX.Element;
|
|
11
|
+
/** A dedicated tool-call card: function name + call-id + JSON arguments. Linked to its result by id. */
|
|
12
|
+
export declare function ToolCallCard({ call }: {
|
|
13
|
+
call: ToolCall;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
/** A tool-result card, linked to its originating call by `tool_call_id`. */
|
|
16
|
+
export declare function ToolResultCard({ message }: {
|
|
17
|
+
message: ChatMessage;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
/** Render one chat message as its appropriate card kind (tool-result → tool-calls → plain message). */
|
|
20
|
+
export declare function MessageItem({ message, renderMarkdown }: MessageProps): import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MessageBranchSelector, type MessageBranchSelectorProps, } from "./message-branch-selector.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* MessageBranchSelector — controlled navigator across alternative message
|
|
4
|
+
* branches (e.g. regenerated responses): "‹ 2 / 5 ›" with prev/next buttons.
|
|
5
|
+
*
|
|
6
|
+
* Fully controlled (M19 ADR D3): the consumer owns `index` and reacts to
|
|
7
|
+
* `onPrev` / `onNext`; regenerate / streaming is a platform concern, not the DS.
|
|
8
|
+
* Prev is disabled at the first branch, next at the last. With a single branch
|
|
9
|
+
* (`count <= 1`) there is nothing to navigate, so it renders nothing.
|
|
10
|
+
*
|
|
11
|
+
* <MessageBranchSelector index={i} count={branches.length}
|
|
12
|
+
* onPrev={() => setI(i - 1)} onNext={() => setI(i + 1)} />
|
|
13
|
+
*/
|
|
14
|
+
export interface MessageBranchSelectorProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
15
|
+
/** Zero-based index of the active branch. */
|
|
16
|
+
index: number;
|
|
17
|
+
/** Total number of branches. */
|
|
18
|
+
count: number;
|
|
19
|
+
/** Navigate to the previous branch. */
|
|
20
|
+
onPrev: () => void;
|
|
21
|
+
/** Navigate to the next branch. */
|
|
22
|
+
onNext: () => void;
|
|
23
|
+
/** Disable both controls (e.g. while a branch is loading). */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
declare const MessageBranchSelector: import("react").ForwardRefExoticComponent<MessageBranchSelectorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export { MessageBranchSelector };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* MetricCard — dashboard metric tile (composite).
|
|
4
|
+
*
|
|
5
|
+
* Recurring pattern "Card + CardHeader + value + delta + trend icon" promoted
|
|
6
|
+
* to a first-class composite per ADR-0007 community-best-practices plan.
|
|
7
|
+
*
|
|
8
|
+
* Trend → token mapping (default `invertTrend=false`):
|
|
9
|
+
* up → text-success (positive growth)
|
|
10
|
+
* down → text-destructive (negative growth)
|
|
11
|
+
* neutral → text-muted-foreground
|
|
12
|
+
*
|
|
13
|
+
* EC-17 absorbed: pass `invertTrend` for metrics where "up is bad" (cost,
|
|
14
|
+
* churn, latency). The mapping inverts cleanly:
|
|
15
|
+
* up → text-destructive (cost growing = bad)
|
|
16
|
+
* down → text-success (cost dropping = good)
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <MetricCard title="Revenue" value="$12,345" delta={{ value: "+12%", trend: "up" }} />
|
|
20
|
+
* <MetricCard title="Monthly Cost" value="$3,200" delta={{ value: "+18%", trend: "up" }} invertTrend />
|
|
21
|
+
*/
|
|
22
|
+
export type MetricCardTrend = "up" | "down" | "neutral";
|
|
23
|
+
export interface MetricCardDelta {
|
|
24
|
+
/** Display text (e.g., `"+12%"`, `"-3.4 pp"`, `"unchanged"`). */
|
|
25
|
+
value: string;
|
|
26
|
+
/** Trend direction — drives icon and color (subject to `invertTrend`). */
|
|
27
|
+
trend: MetricCardTrend;
|
|
28
|
+
}
|
|
29
|
+
export interface MetricCardProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
30
|
+
/** Metric label (e.g., "Revenue", "Active Users"). */
|
|
31
|
+
title: string;
|
|
32
|
+
/** Headline value (e.g., "$12,345", "1,234"). */
|
|
33
|
+
value: ReactNode;
|
|
34
|
+
/** Optional delta with trend direction. */
|
|
35
|
+
delta?: MetricCardDelta;
|
|
36
|
+
/** Optional subtle context line below the value (e.g., "vs last month"). */
|
|
37
|
+
hint?: ReactNode;
|
|
38
|
+
/** Optional icon rendered top-right (e.g., `<DollarSign />`). */
|
|
39
|
+
icon?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* EC-17: invert default trend semantics. Use for Cost / Churn / Latency
|
|
42
|
+
* metrics where "up" is bad. Default `false` (Revenue / Users / Conversions).
|
|
43
|
+
*/
|
|
44
|
+
invertTrend?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare const MetricCard: import("react").ForwardRefExoticComponent<MetricCardProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PageShell, type PageShellProps } from "./page-shell.js";
|