@you-agent-factory/components 0.0.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/README.md +223 -0
- package/docs/README.md +83 -0
- package/docs/button.md +119 -0
- package/docs/charts.md +325 -0
- package/docs/data-display-code-panel.md +120 -0
- package/docs/feedback-alert-panel.md +117 -0
- package/docs/feedback-skeleton.md +54 -0
- package/docs/forms-form-field.md +490 -0
- package/docs/forms-input-primitives.md +311 -0
- package/docs/forms-select-primitives.md +362 -0
- package/docs/graphs.md +250 -0
- package/docs/layout-display-primitives.md +211 -0
- package/docs/overlays.md +414 -0
- package/docs/table-data-table.md +331 -0
- package/docs/typography-roles.md +182 -0
- package/docs/widget-frame-recipes.md +273 -0
- package/package.json +161 -0
- package/src/category-paths.ts +20 -0
- package/src/charts/chart-state-panel.tsx +103 -0
- package/src/charts/chart.tsx +287 -0
- package/src/charts/index.ts +21 -0
- package/src/data-display/code-panel.tsx +67 -0
- package/src/data-display/data-table.tsx +180 -0
- package/src/data-display/description-list.tsx +24 -0
- package/src/data-display/index.ts +34 -0
- package/src/data-display/table-layout.ts +12 -0
- package/src/data-display/table.tsx +131 -0
- package/src/feedback/alert-panel-semantics.ts +75 -0
- package/src/feedback/alert-panel.tsx +187 -0
- package/src/feedback/index.ts +21 -0
- package/src/feedback/skeleton.tsx +16 -0
- package/src/forms/index.ts +73 -0
- package/src/forms/package-checkbox.tsx +50 -0
- package/src/forms/package-enum-select.tsx +185 -0
- package/src/forms/package-file-input.tsx +25 -0
- package/src/forms/package-form-field.tsx +202 -0
- package/src/forms/package-input.tsx +25 -0
- package/src/forms/package-native-select.tsx +25 -0
- package/src/forms/package-select.tsx +209 -0
- package/src/forms/package-textarea.tsx +35 -0
- package/src/forms/select-icons.tsx +35 -0
- package/src/graphs/graph-edge-path.ts +241 -0
- package/src/graphs/graph-edge.tsx +130 -0
- package/src/graphs/graph-interactive-example.tsx +187 -0
- package/src/graphs/graph-node-button.tsx +51 -0
- package/src/graphs/graph-node-handle-badge.tsx +108 -0
- package/src/graphs/graph-node-handle.ts +28 -0
- package/src/graphs/graph-node-shell.tsx +111 -0
- package/src/graphs/graph-node-state-indicator.tsx +47 -0
- package/src/graphs/graph-node-state.ts +111 -0
- package/src/graphs/graph-viewport-surface.tsx +27 -0
- package/src/graphs/index.ts +41 -0
- package/src/icons/index.ts +4 -0
- package/src/index.ts +209 -0
- package/src/layout/action-row.tsx +53 -0
- package/src/layout/index.ts +9 -0
- package/src/layout/surface-panel.tsx +91 -0
- package/src/navigation/index.ts +4 -0
- package/src/overlays/collapsible.tsx +22 -0
- package/src/overlays/dialog.tsx +148 -0
- package/src/overlays/index.ts +31 -0
- package/src/overlays/overlay-layout.ts +9 -0
- package/src/overlays/popover.tsx +29 -0
- package/src/overlays/scroll-area.tsx +78 -0
- package/src/primitives/button-link.tsx +22 -0
- package/src/primitives/button.tsx +258 -0
- package/src/primitives/icon-button-shell.tsx +49 -0
- package/src/primitives/index.ts +31 -0
- package/src/primitives/package-text.tsx +29 -0
- package/src/primitives/typography-roles.ts +12 -0
- package/src/primitives/typography.tsx +165 -0
- package/src/recipes/index.ts +61 -0
- package/src/recipes/widget-frame-content.tsx +114 -0
- package/src/recipes/widget-frame-disclosure.tsx +161 -0
- package/src/recipes/widget-frame-layout.ts +40 -0
- package/src/recipes/widget-frame-skeleton.tsx +16 -0
- package/src/recipes/widget-frame-states.tsx +99 -0
- package/src/recipes/widget-frame-typography.ts +19 -0
- package/src/recipes/widget-frame.tsx +84 -0
- package/src/styles/color-palette-presets.css +167 -0
- package/src/styles/color-role-tokens.css +163 -0
- package/src/styles/layout-role-tokens.css +27 -0
- package/src/styles/text-color-role-tokens.css +29 -0
- package/src/styles/typography-role-tokens.css +72 -0
- package/src/styles/typography-role-utilities.css +73 -0
- package/src/styles/typography-roles.css +53 -0
- package/src/styles.css +32 -0
- package/src/testing/index.ts +13 -0
- package/src/testing/render.tsx +16 -0
- package/src/tokens/index.ts +4 -0
- package/src/utilities/cn.ts +5 -0
- package/src/utilities/index.ts +6 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Handle, Position } from "@xyflow/react";
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../utilities/cn";
|
|
5
|
+
import type { GraphNodeHandle, GraphNodeHandleTone } from "./graph-node-handle";
|
|
6
|
+
|
|
7
|
+
export interface GraphNodeHandleBadgeProps {
|
|
8
|
+
handle: GraphNodeHandle;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function GraphNodeHandleBadge({ handle }: GraphNodeHandleBadgeProps) {
|
|
12
|
+
const position = handle.side === "left" ? Position.Left : Position.Right;
|
|
13
|
+
const overlayHandleStyle = anchoredHandleStyle(handle.side);
|
|
14
|
+
|
|
15
|
+
if (handle.hidden) {
|
|
16
|
+
return (
|
|
17
|
+
<Handle
|
|
18
|
+
className="pointer-events-none !top-1/2 opacity-0"
|
|
19
|
+
id={handle.id}
|
|
20
|
+
isConnectable={handle.connectable ?? false}
|
|
21
|
+
position={position}
|
|
22
|
+
style={overlayHandleStyle}
|
|
23
|
+
type={handle.type}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const tone = handle.tone ?? "default";
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
className="pointer-events-none relative flex h-5 w-5 items-center justify-center"
|
|
33
|
+
data-node-handle-badge={handle.id}
|
|
34
|
+
data-node-handle-invalid={handle.validationError ? "true" : undefined}
|
|
35
|
+
data-node-handle-tone={tone}
|
|
36
|
+
>
|
|
37
|
+
<Handle
|
|
38
|
+
aria-invalid={handle.validationError ? true : undefined}
|
|
39
|
+
aria-label={handle.buttonAriaLabel ?? handle.label}
|
|
40
|
+
className={cn(
|
|
41
|
+
"pointer-events-auto absolute !top-1/2 !h-5 !w-5 !border-0 !bg-transparent",
|
|
42
|
+
"before:pointer-events-none before:absolute before:top-1/2 before:h-2.5 before:w-2.5 before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:border before:border-surface before:bg-[var(--node-handle-background)] before:shadow-sm before:transition before:content-['']",
|
|
43
|
+
handle.side === "left" ? "before:left-0" : "before:left-full",
|
|
44
|
+
handle.buttonPressed &&
|
|
45
|
+
"before:scale-125 before:shadow-[0_0_0_3px_var(--color-primary-container)]",
|
|
46
|
+
handle.variant === "valid-target" &&
|
|
47
|
+
"before:scale-125 before:shadow-[0_0_0_3px_var(--color-success-container)]",
|
|
48
|
+
handle.variant === "error" &&
|
|
49
|
+
"before:border-af-danger-border before:shadow-[0_0_0_3px_var(--color-error-container)] motion-safe:before:animate-pulse",
|
|
50
|
+
handle.validationError &&
|
|
51
|
+
"before:ring-2 before:ring-af-danger-border motion-safe:before:animate-pulse",
|
|
52
|
+
)}
|
|
53
|
+
id={handle.id}
|
|
54
|
+
isConnectable={handle.connectable ?? true}
|
|
55
|
+
onClick={handle.onButtonClick}
|
|
56
|
+
position={position}
|
|
57
|
+
style={
|
|
58
|
+
{
|
|
59
|
+
...overlayHandleStyle,
|
|
60
|
+
"--node-handle-background": handleDotColor(tone),
|
|
61
|
+
opacity: handle.buttonDisabled ? 0.45 : undefined,
|
|
62
|
+
} as CSSProperties
|
|
63
|
+
}
|
|
64
|
+
title={handle.buttonTitle ?? handle.validationMessage}
|
|
65
|
+
type={handle.type}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function handleDotColor(tone: GraphNodeHandleTone): string {
|
|
72
|
+
switch (tone) {
|
|
73
|
+
case "assignment":
|
|
74
|
+
return "var(--color-success)";
|
|
75
|
+
case "continue":
|
|
76
|
+
return "var(--color-secondary)";
|
|
77
|
+
case "failure":
|
|
78
|
+
return "var(--color-error)";
|
|
79
|
+
case "input":
|
|
80
|
+
return "var(--color-success)";
|
|
81
|
+
case "output":
|
|
82
|
+
return "var(--color-success)";
|
|
83
|
+
case "rejection":
|
|
84
|
+
return "var(--color-warning)";
|
|
85
|
+
case "resource":
|
|
86
|
+
return "var(--color-black)";
|
|
87
|
+
case "worker":
|
|
88
|
+
return "var(--color-purple-500)";
|
|
89
|
+
default:
|
|
90
|
+
return "var(--color-success)";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function anchoredHandleStyle(
|
|
95
|
+
side: GraphNodeHandle["side"],
|
|
96
|
+
): CSSProperties {
|
|
97
|
+
return side === "left"
|
|
98
|
+
? {
|
|
99
|
+
left: "50%",
|
|
100
|
+
top: "50%",
|
|
101
|
+
transform: "translateY(-50%)",
|
|
102
|
+
}
|
|
103
|
+
: {
|
|
104
|
+
left: "50%",
|
|
105
|
+
top: "50%",
|
|
106
|
+
transform: "translate(-100%, -50%)",
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type GraphNodeHandleTone =
|
|
2
|
+
| "assignment"
|
|
3
|
+
| "continue"
|
|
4
|
+
| "default"
|
|
5
|
+
| "failure"
|
|
6
|
+
| "input"
|
|
7
|
+
| "output"
|
|
8
|
+
| "rejection"
|
|
9
|
+
| "resource"
|
|
10
|
+
| "worker";
|
|
11
|
+
|
|
12
|
+
export interface GraphNodeHandle {
|
|
13
|
+
buttonAriaLabel?: string;
|
|
14
|
+
buttonDisabled?: boolean;
|
|
15
|
+
buttonPressed?: boolean;
|
|
16
|
+
buttonTitle?: string;
|
|
17
|
+
connectable?: boolean;
|
|
18
|
+
hidden?: boolean;
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
onButtonClick?: () => void;
|
|
22
|
+
side: "left" | "right";
|
|
23
|
+
tone?: GraphNodeHandleTone;
|
|
24
|
+
type: "source" | "target";
|
|
25
|
+
validationError?: boolean;
|
|
26
|
+
validationMessage?: string;
|
|
27
|
+
variant?: "default" | "error" | "muted" | "selected" | "valid-target";
|
|
28
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../utilities/cn";
|
|
4
|
+
import { GraphNodeHandleBadge } from "./graph-node-handle-badge";
|
|
5
|
+
import type { GraphNodeHandle } from "./graph-node-handle";
|
|
6
|
+
import { GraphNodeStateIndicator } from "./graph-node-state-indicator";
|
|
7
|
+
import {
|
|
8
|
+
GRAPH_NODE_CONTENT_MIN_HEIGHT_CLASS,
|
|
9
|
+
type GraphNodeState,
|
|
10
|
+
graphNodeShellStateAttributes,
|
|
11
|
+
graphNodeShellStateClassName,
|
|
12
|
+
} from "./graph-node-state";
|
|
13
|
+
|
|
14
|
+
export interface GraphNodeShellProps
|
|
15
|
+
extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
handles: GraphNodeHandle[];
|
|
19
|
+
nodeKind?: string;
|
|
20
|
+
showStateIndicator?: boolean;
|
|
21
|
+
state?: GraphNodeState;
|
|
22
|
+
stateLabel?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function GraphNodeShell({
|
|
26
|
+
children,
|
|
27
|
+
className = "",
|
|
28
|
+
handles,
|
|
29
|
+
nodeKind,
|
|
30
|
+
showStateIndicator = true,
|
|
31
|
+
state = "default",
|
|
32
|
+
stateLabel,
|
|
33
|
+
...articleProps
|
|
34
|
+
}: GraphNodeShellProps) {
|
|
35
|
+
const leftHandles = handles.filter((handle) => handle.side === "left");
|
|
36
|
+
const rightHandles = handles.filter((handle) => handle.side === "right");
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<article
|
|
40
|
+
className={cn(
|
|
41
|
+
"relative flex h-full min-w-0 w-full overflow-visible rounded-lg border border-outline bg-surface text-on-surface",
|
|
42
|
+
graphNodeShellStateClassName(state),
|
|
43
|
+
className,
|
|
44
|
+
)}
|
|
45
|
+
data-graph-node-kind={nodeKind}
|
|
46
|
+
{...graphNodeShellStateAttributes(state, stateLabel)}
|
|
47
|
+
{...articleProps}
|
|
48
|
+
>
|
|
49
|
+
<NodeHandleRail handles={leftHandles} side="left" />
|
|
50
|
+
<NodeHandleRail handles={rightHandles} side="right" />
|
|
51
|
+
<div
|
|
52
|
+
className={cn(
|
|
53
|
+
"flex h-full min-w-0 w-full flex-col gap-1 py-3",
|
|
54
|
+
showStateIndicator && GRAPH_NODE_CONTENT_MIN_HEIGHT_CLASS,
|
|
55
|
+
leftHandles.length > 0 ? "pl-6 pr-3" : "px-3",
|
|
56
|
+
rightHandles.length > 0 && leftHandles.length > 0
|
|
57
|
+
? "pr-6"
|
|
58
|
+
: rightHandles.length > 0
|
|
59
|
+
? "pl-3 pr-6"
|
|
60
|
+
: null,
|
|
61
|
+
)}
|
|
62
|
+
>
|
|
63
|
+
{showStateIndicator ? (
|
|
64
|
+
<GraphNodeStateIndicator state={state} stateLabel={stateLabel} />
|
|
65
|
+
) : null}
|
|
66
|
+
{children}
|
|
67
|
+
</div>
|
|
68
|
+
</article>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function NodeHandleRail({
|
|
73
|
+
handles,
|
|
74
|
+
side,
|
|
75
|
+
}: {
|
|
76
|
+
handles: GraphNodeHandle[];
|
|
77
|
+
side: "left" | "right";
|
|
78
|
+
}) {
|
|
79
|
+
if (handles.length === 0) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
className={cn(
|
|
86
|
+
"pointer-events-none absolute inset-y-0 z-20 w-6",
|
|
87
|
+
side === "left" ? "left-0" : "right-0",
|
|
88
|
+
)}
|
|
89
|
+
data-node-handle-rail={side}
|
|
90
|
+
>
|
|
91
|
+
{handles.map((handle, index) => (
|
|
92
|
+
<div
|
|
93
|
+
className={cn(
|
|
94
|
+
"absolute top-0 flex -translate-y-1/2",
|
|
95
|
+
side === "left"
|
|
96
|
+
? "left-0 -translate-x-1/2"
|
|
97
|
+
: "right-0 translate-x-1/2",
|
|
98
|
+
)}
|
|
99
|
+
key={handle.id}
|
|
100
|
+
style={{ top: handlePosition(index, handles.length) }}
|
|
101
|
+
>
|
|
102
|
+
<GraphNodeHandleBadge handle={handle} />
|
|
103
|
+
</div>
|
|
104
|
+
))}
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function handlePosition(index: number, count: number): string {
|
|
110
|
+
return `${((index + 1) * 100) / (count + 1)}%`;
|
|
111
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { cn } from "../utilities/cn";
|
|
2
|
+
import {
|
|
3
|
+
defaultGraphNodeStateLabel,
|
|
4
|
+
GRAPH_NODE_STATE_INDICATOR_HEIGHT_CLASS,
|
|
5
|
+
type GraphNodeState,
|
|
6
|
+
} from "./graph-node-state";
|
|
7
|
+
|
|
8
|
+
export interface GraphNodeStateIndicatorProps {
|
|
9
|
+
state: GraphNodeState;
|
|
10
|
+
stateLabel?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function GraphNodeStateIndicator({
|
|
14
|
+
state,
|
|
15
|
+
stateLabel,
|
|
16
|
+
}: GraphNodeStateIndicatorProps) {
|
|
17
|
+
const label = stateLabel ?? defaultGraphNodeStateLabel(state);
|
|
18
|
+
const showIndicator = state === "loading" || state === "error";
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
aria-hidden={showIndicator ? undefined : true}
|
|
23
|
+
className={cn(
|
|
24
|
+
GRAPH_NODE_STATE_INDICATOR_HEIGHT_CLASS,
|
|
25
|
+
"flex items-center gap-2 text-[0.65rem] font-semibold uppercase tracking-[0.08em]",
|
|
26
|
+
state === "error" ? "text-on-error-container" : "text-on-surface-variant",
|
|
27
|
+
!showIndicator && "invisible",
|
|
28
|
+
)}
|
|
29
|
+
data-graph-node-state-indicator={showIndicator ? state : undefined}
|
|
30
|
+
>
|
|
31
|
+
{state === "loading" ? (
|
|
32
|
+
<>
|
|
33
|
+
<span
|
|
34
|
+
aria-hidden="true"
|
|
35
|
+
className="inline-block h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-outline border-t-primary"
|
|
36
|
+
data-graph-node-loading-spinner="true"
|
|
37
|
+
/>
|
|
38
|
+
<span>{label ?? "Loading"}</span>
|
|
39
|
+
</>
|
|
40
|
+
) : state === "error" ? (
|
|
41
|
+
<span role="alert">{label ?? "Error"}</span>
|
|
42
|
+
) : (
|
|
43
|
+
<span aria-hidden="true"> </span>
|
|
44
|
+
)}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { cn } from "../utilities/cn";
|
|
2
|
+
|
|
3
|
+
export type GraphNodeState =
|
|
4
|
+
| "default"
|
|
5
|
+
| "selected"
|
|
6
|
+
| "disabled"
|
|
7
|
+
| "loading"
|
|
8
|
+
| "error";
|
|
9
|
+
|
|
10
|
+
export const GRAPH_NODE_CONTENT_MIN_HEIGHT_CLASS = "min-h-12";
|
|
11
|
+
|
|
12
|
+
export const GRAPH_NODE_STATE_INDICATOR_HEIGHT_CLASS = "min-h-5";
|
|
13
|
+
|
|
14
|
+
export function graphNodeShellStateClassName(state: GraphNodeState): string {
|
|
15
|
+
switch (state) {
|
|
16
|
+
case "selected":
|
|
17
|
+
return cn(
|
|
18
|
+
"border-2 border-primary bg-primary-container",
|
|
19
|
+
"shadow-[0_0_0_1px_rgb(from_var(--color-primary)_r_g_b_/_0.28),0_0_0_4px_rgb(from_var(--color-primary)_r_g_b_/_0.08)]",
|
|
20
|
+
);
|
|
21
|
+
case "error":
|
|
22
|
+
return cn(
|
|
23
|
+
"border-2 border-dashed border-error bg-error-container",
|
|
24
|
+
"shadow-[0_0_0_3px_var(--color-error-container)]",
|
|
25
|
+
);
|
|
26
|
+
case "disabled":
|
|
27
|
+
return "border-outline-variant bg-surface-container text-on-surface";
|
|
28
|
+
case "loading":
|
|
29
|
+
return "border-outline bg-surface";
|
|
30
|
+
default:
|
|
31
|
+
return "";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function graphNodeButtonStateClassName(state: GraphNodeState): string {
|
|
36
|
+
switch (state) {
|
|
37
|
+
case "selected":
|
|
38
|
+
return "ring-2 ring-primary/30";
|
|
39
|
+
case "error":
|
|
40
|
+
return "ring-2 ring-error/40";
|
|
41
|
+
case "disabled":
|
|
42
|
+
case "loading":
|
|
43
|
+
return "cursor-not-allowed";
|
|
44
|
+
default:
|
|
45
|
+
return "";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function graphNodeShellStateAttributes(
|
|
50
|
+
state: GraphNodeState,
|
|
51
|
+
stateLabel?: string,
|
|
52
|
+
): {
|
|
53
|
+
"aria-busy"?: boolean;
|
|
54
|
+
"aria-disabled"?: boolean;
|
|
55
|
+
"aria-invalid"?: boolean;
|
|
56
|
+
"aria-label"?: string;
|
|
57
|
+
"aria-selected"?: boolean;
|
|
58
|
+
"data-graph-node-state"?: GraphNodeState;
|
|
59
|
+
} {
|
|
60
|
+
return {
|
|
61
|
+
"aria-busy": state === "loading" ? true : undefined,
|
|
62
|
+
"aria-disabled": state === "disabled" ? true : undefined,
|
|
63
|
+
"aria-invalid": state === "error" ? true : undefined,
|
|
64
|
+
"aria-label": stateLabel,
|
|
65
|
+
"aria-selected": state === "selected" ? true : undefined,
|
|
66
|
+
"data-graph-node-state": state === "default" ? undefined : state,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function graphNodeButtonStateAttributes(
|
|
71
|
+
state: GraphNodeState,
|
|
72
|
+
stateLabel?: string,
|
|
73
|
+
): {
|
|
74
|
+
"aria-busy"?: boolean;
|
|
75
|
+
"aria-disabled"?: boolean;
|
|
76
|
+
"aria-invalid"?: boolean;
|
|
77
|
+
"aria-label"?: string;
|
|
78
|
+
"aria-pressed"?: boolean;
|
|
79
|
+
"data-graph-node-state"?: GraphNodeState;
|
|
80
|
+
} {
|
|
81
|
+
return {
|
|
82
|
+
"aria-busy": state === "loading" ? true : undefined,
|
|
83
|
+
"aria-disabled": state === "disabled" ? true : undefined,
|
|
84
|
+
"aria-invalid": state === "error" ? true : undefined,
|
|
85
|
+
"aria-label": stateLabel,
|
|
86
|
+
"aria-pressed": state === "selected" ? true : undefined,
|
|
87
|
+
"data-graph-node-state": state === "default" ? undefined : state,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function graphNodeButtonIsDisabled(
|
|
92
|
+
state: GraphNodeState,
|
|
93
|
+
disabled?: boolean,
|
|
94
|
+
): boolean {
|
|
95
|
+
return disabled === true || state === "disabled" || state === "loading";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function defaultGraphNodeStateLabel(state: GraphNodeState): string | undefined {
|
|
99
|
+
switch (state) {
|
|
100
|
+
case "selected":
|
|
101
|
+
return "Selected node";
|
|
102
|
+
case "disabled":
|
|
103
|
+
return "Disabled node";
|
|
104
|
+
case "loading":
|
|
105
|
+
return "Loading node";
|
|
106
|
+
case "error":
|
|
107
|
+
return "Error node";
|
|
108
|
+
default:
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { forwardRef, type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../utilities/cn";
|
|
4
|
+
|
|
5
|
+
export interface GraphViewportSurfaceProps extends HTMLAttributes<HTMLElement> {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const GraphViewportSurface = forwardRef<
|
|
10
|
+
HTMLElement,
|
|
11
|
+
GraphViewportSurfaceProps
|
|
12
|
+
>(function GraphViewportSurface({ children, className, role, ...props }, ref) {
|
|
13
|
+
return (
|
|
14
|
+
<section
|
|
15
|
+
className={cn(
|
|
16
|
+
"relative min-h-0 overflow-hidden rounded-3xl border shadow-none transition-colors",
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
data-graph-viewport-surface="true"
|
|
20
|
+
ref={ref}
|
|
21
|
+
role={role ?? "region"}
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
{children}
|
|
25
|
+
</section>
|
|
26
|
+
);
|
|
27
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Stable category path for `@you-agent-factory/components/graphs`. */
|
|
2
|
+
export const COMPONENTS_CATEGORY = "graphs" as const;
|
|
3
|
+
|
|
4
|
+
export type ComponentsCategory = typeof COMPONENTS_CATEGORY;
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
GRAPH_NODE_BUTTON_BASE_CLASS,
|
|
8
|
+
GraphNodeButton,
|
|
9
|
+
type GraphNodeButtonProps,
|
|
10
|
+
} from "./graph-node-button";
|
|
11
|
+
export {
|
|
12
|
+
GraphViewportSurface,
|
|
13
|
+
type GraphViewportSurfaceProps,
|
|
14
|
+
} from "./graph-viewport-surface";
|
|
15
|
+
export type { GraphNodeHandle, GraphNodeHandleTone } from "./graph-node-handle";
|
|
16
|
+
export {
|
|
17
|
+
GraphNodeHandleBadge,
|
|
18
|
+
type GraphNodeHandleBadgeProps,
|
|
19
|
+
} from "./graph-node-handle-badge";
|
|
20
|
+
export { GraphNodeShell, type GraphNodeShellProps } from "./graph-node-shell";
|
|
21
|
+
export {
|
|
22
|
+
defaultGraphNodeStateLabel,
|
|
23
|
+
GRAPH_NODE_CONTENT_MIN_HEIGHT_CLASS,
|
|
24
|
+
GRAPH_NODE_STATE_INDICATOR_HEIGHT_CLASS,
|
|
25
|
+
graphNodeButtonIsDisabled,
|
|
26
|
+
graphNodeButtonStateAttributes,
|
|
27
|
+
graphNodeButtonStateClassName,
|
|
28
|
+
graphNodeShellStateAttributes,
|
|
29
|
+
graphNodeShellStateClassName,
|
|
30
|
+
type GraphNodeState,
|
|
31
|
+
} from "./graph-node-state";
|
|
32
|
+
export {
|
|
33
|
+
GraphNodeStateIndicator,
|
|
34
|
+
type GraphNodeStateIndicatorProps,
|
|
35
|
+
} from "./graph-node-state-indicator";
|
|
36
|
+
export {
|
|
37
|
+
buildGraphEdgePathThroughWaypoints,
|
|
38
|
+
type GraphEdgeWaypoint,
|
|
39
|
+
} from "./graph-edge-path";
|
|
40
|
+
export type { GraphEdgeData, GraphEdgeProps } from "./graph-edge";
|
|
41
|
+
export { GRAPH_EDGE_TYPES, GraphEdge } from "./graph-edge";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/** Stable package identifier for `@you-agent-factory/components` consumers. */
|
|
2
|
+
export const COMPONENTS_PACKAGE_NAME = "@you-agent-factory/components" as const;
|
|
3
|
+
|
|
4
|
+
export type ComponentsPackageName = typeof COMPONENTS_PACKAGE_NAME;
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
COMPONENT_CATEGORY_EXPORT_PATHS,
|
|
8
|
+
type ComponentCategoryExportPath,
|
|
9
|
+
} from "./category-paths";
|
|
10
|
+
|
|
11
|
+
export { Button, ButtonLink, buttonVariants, IconButtonShell } from "./primitives";
|
|
12
|
+
export type {
|
|
13
|
+
ButtonLinkProps,
|
|
14
|
+
ButtonProps,
|
|
15
|
+
IconButtonShellProps,
|
|
16
|
+
} from "./primitives";
|
|
17
|
+
export { DescriptionList } from "./data-display/description-list";
|
|
18
|
+
export type { DescriptionListProps } from "./data-display/description-list";
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
AlertPanel,
|
|
22
|
+
AlertPanelStatusLabel,
|
|
23
|
+
AlertPanelText,
|
|
24
|
+
AlertPanelTitle,
|
|
25
|
+
Skeleton,
|
|
26
|
+
} from "./feedback";
|
|
27
|
+
export type {
|
|
28
|
+
AlertPanelProps,
|
|
29
|
+
AlertPanelSemanticVariant,
|
|
30
|
+
AlertPanelStatusLabelProps,
|
|
31
|
+
AlertPanelTextProps,
|
|
32
|
+
AlertPanelTitleProps,
|
|
33
|
+
AlertPanelTone,
|
|
34
|
+
AlertPanelVariant,
|
|
35
|
+
} from "./feedback";
|
|
36
|
+
export {
|
|
37
|
+
CodePanel,
|
|
38
|
+
DataTable,
|
|
39
|
+
Table,
|
|
40
|
+
TableBody,
|
|
41
|
+
TableCaption,
|
|
42
|
+
TableCell,
|
|
43
|
+
TableHead,
|
|
44
|
+
TableHeader,
|
|
45
|
+
TableRow,
|
|
46
|
+
codePanelVariants,
|
|
47
|
+
tableCellTruncateClassName,
|
|
48
|
+
tableCellWrapClassName,
|
|
49
|
+
tableMinWidthWideClassName,
|
|
50
|
+
tableNarrowContainerClassName,
|
|
51
|
+
} from "./data-display";
|
|
52
|
+
export type {
|
|
53
|
+
CodePanelProps,
|
|
54
|
+
DataTableColumn,
|
|
55
|
+
DataTableProps,
|
|
56
|
+
DataTableState,
|
|
57
|
+
TableProps,
|
|
58
|
+
TableSize,
|
|
59
|
+
} from "./data-display";
|
|
60
|
+
export {
|
|
61
|
+
WidgetDetailCopy,
|
|
62
|
+
WidgetEmptyState,
|
|
63
|
+
WidgetEmptyStateText,
|
|
64
|
+
WidgetEmptyStateTitle,
|
|
65
|
+
WidgetErrorState,
|
|
66
|
+
WidgetFrame,
|
|
67
|
+
WidgetFrameDisclosure,
|
|
68
|
+
WidgetFrameDisclosureIcon,
|
|
69
|
+
WidgetFrameDisclosurePanel,
|
|
70
|
+
WidgetFrameDisclosureTrigger,
|
|
71
|
+
WidgetFrameSkeleton,
|
|
72
|
+
WidgetLoadingState,
|
|
73
|
+
WidgetSubtitle,
|
|
74
|
+
WidgetSuccessState,
|
|
75
|
+
WIDGET_FRAME_BODY_TEXT_CLASS,
|
|
76
|
+
WIDGET_FRAME_MIN_WIDTH_CLASS,
|
|
77
|
+
WIDGET_FRAME_OVERFLOW_TOLERANCE_PX,
|
|
78
|
+
WIDGET_FRAME_RESPONSIVE_SHELL_CLASS,
|
|
79
|
+
WIDGET_FRAME_SECTION_HEADING_CLASS,
|
|
80
|
+
WIDGET_FRAME_STORY_SHELL_DATA_ATTR,
|
|
81
|
+
WIDGET_FRAME_SUBTITLE_CLASS,
|
|
82
|
+
WIDGET_FRAME_SUPPORTING_LABEL_CLASS,
|
|
83
|
+
WIDGET_FRAME_SUPPORTING_LABELS_CLASS,
|
|
84
|
+
WIDGET_FRAME_WIDE_BODY_CLASS,
|
|
85
|
+
widgetFrameDetailCardClass,
|
|
86
|
+
widgetFrameHasNoHorizontalOverflow,
|
|
87
|
+
widgetFrameStoryShellStyle,
|
|
88
|
+
} from "./recipes";
|
|
89
|
+
export type {
|
|
90
|
+
WidgetDetailCopyProps,
|
|
91
|
+
WidgetEmptyStateProps,
|
|
92
|
+
WidgetEmptyStateTextProps,
|
|
93
|
+
WidgetEmptyStateTitleProps,
|
|
94
|
+
WidgetErrorStateProps,
|
|
95
|
+
WidgetFrameDisclosureIconProps,
|
|
96
|
+
WidgetFrameDisclosurePanelProps,
|
|
97
|
+
WidgetFrameDisclosureProps,
|
|
98
|
+
WidgetFrameDisclosureTriggerProps,
|
|
99
|
+
WidgetFrameProps,
|
|
100
|
+
WidgetLoadingStateProps,
|
|
101
|
+
WidgetSubtitleProps,
|
|
102
|
+
WidgetSuccessStateProps,
|
|
103
|
+
} from "./recipes";
|
|
104
|
+
export {
|
|
105
|
+
buildFormFieldAriaDescribedBy,
|
|
106
|
+
EnumSelect,
|
|
107
|
+
ENUM_SELECT_EMPTY_VALUE,
|
|
108
|
+
FormDescription,
|
|
109
|
+
FormError,
|
|
110
|
+
FormField,
|
|
111
|
+
FormFieldGroup,
|
|
112
|
+
FormFieldGroupLabel,
|
|
113
|
+
FormHelperText,
|
|
114
|
+
FormLabel,
|
|
115
|
+
FormSuccess,
|
|
116
|
+
FormWarning,
|
|
117
|
+
NativeSelect,
|
|
118
|
+
OptionalEnumSelect,
|
|
119
|
+
PackageCheckbox,
|
|
120
|
+
PackageFileInput,
|
|
121
|
+
PackageInput,
|
|
122
|
+
PackageTextarea,
|
|
123
|
+
ResetEnumSelect,
|
|
124
|
+
Select,
|
|
125
|
+
SELECT_EMPTY_STATE_VALUE,
|
|
126
|
+
SelectContent,
|
|
127
|
+
SelectEmpty,
|
|
128
|
+
SelectField,
|
|
129
|
+
SelectGroup,
|
|
130
|
+
SelectItem,
|
|
131
|
+
SelectLabel,
|
|
132
|
+
SelectSeparator,
|
|
133
|
+
SelectTrigger,
|
|
134
|
+
SelectValue,
|
|
135
|
+
inputVariants,
|
|
136
|
+
textareaVariants,
|
|
137
|
+
} from "./forms";
|
|
138
|
+
export type {
|
|
139
|
+
EnumSelectOption,
|
|
140
|
+
EnumSelectProps,
|
|
141
|
+
FormDescriptionProps,
|
|
142
|
+
FormErrorProps,
|
|
143
|
+
FormFieldGroupLabelProps,
|
|
144
|
+
FormFieldGroupProps,
|
|
145
|
+
FormFieldMessageIds,
|
|
146
|
+
FormFieldProps,
|
|
147
|
+
FormHelperTextProps,
|
|
148
|
+
FormLabelProps,
|
|
149
|
+
FormSuccessProps,
|
|
150
|
+
FormWarningProps,
|
|
151
|
+
NativeSelectProps,
|
|
152
|
+
OptionalEnumSelectProps,
|
|
153
|
+
PackageCheckboxProps,
|
|
154
|
+
PackageFileInputProps,
|
|
155
|
+
PackageInputProps,
|
|
156
|
+
PackageTextareaProps,
|
|
157
|
+
ResetEnumSelectProps,
|
|
158
|
+
SelectContentProps,
|
|
159
|
+
SelectEmptyProps,
|
|
160
|
+
SelectFieldProps,
|
|
161
|
+
SelectItemProps,
|
|
162
|
+
SelectLabelProps,
|
|
163
|
+
SelectSeparatorProps,
|
|
164
|
+
SelectTriggerProps,
|
|
165
|
+
} from "./forms";
|
|
166
|
+
|
|
167
|
+
export { ActionRow } from "./layout/action-row";
|
|
168
|
+
export type { ActionRowProps } from "./layout/action-row";
|
|
169
|
+
export { SurfacePanel, surfacePanelVariants } from "./layout/surface-panel";
|
|
170
|
+
export type { SurfacePanelProps } from "./layout/surface-panel";
|
|
171
|
+
|
|
172
|
+
export { Code, Heading, Label, Text } from "./primitives/typography";
|
|
173
|
+
export type {
|
|
174
|
+
CodeProps,
|
|
175
|
+
HeadingProps,
|
|
176
|
+
LabelProps,
|
|
177
|
+
TextProps,
|
|
178
|
+
TextVariant,
|
|
179
|
+
} from "./primitives/typography";
|
|
180
|
+
export {
|
|
181
|
+
Collapsible,
|
|
182
|
+
CollapsibleContent,
|
|
183
|
+
CollapsibleTrigger,
|
|
184
|
+
Dialog,
|
|
185
|
+
DialogClose,
|
|
186
|
+
DialogContent,
|
|
187
|
+
DialogDescription,
|
|
188
|
+
DialogFooter,
|
|
189
|
+
DialogHeader,
|
|
190
|
+
DialogOverlay,
|
|
191
|
+
DialogPortal,
|
|
192
|
+
DialogTitle,
|
|
193
|
+
DialogTrigger,
|
|
194
|
+
OVERLAY_DIALOG_BODY_CLASS,
|
|
195
|
+
OVERLAY_DIALOG_CONTENT_SHELL_CLASS,
|
|
196
|
+
OVERLAY_FORM_GROUP_CLASS,
|
|
197
|
+
Popover,
|
|
198
|
+
PopoverAnchor,
|
|
199
|
+
PopoverContent,
|
|
200
|
+
PopoverTrigger,
|
|
201
|
+
ScrollArea,
|
|
202
|
+
ScrollBar,
|
|
203
|
+
} from "./overlays";
|
|
204
|
+
export type {
|
|
205
|
+
DialogContentProps,
|
|
206
|
+
ScrollAreaProps,
|
|
207
|
+
ScrollBarProps,
|
|
208
|
+
} from "./overlays";
|
|
209
|
+
|