ai-design-system 0.1.36 → 0.1.38
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/components/blocks/WorkflowCanvas/WorkflowCanvas.tsx +4 -2
- package/components/composites/TriggerNode/TriggerNode.tsx +60 -0
- package/components/composites/TriggerNode/index.ts +2 -0
- package/components/composites/index.ts +4 -0
- package/dist/index.cjs +30 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +35 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -18,8 +18,9 @@ import { Connection as ConnectionLine } from "@/components/ai-elements/connectio
|
|
|
18
18
|
import { Controls } from "@/components/ai-elements/controls";
|
|
19
19
|
import { Edge } from "@/components/ai-elements/edge";
|
|
20
20
|
import { Panel } from "@/components/ai-elements/panel";
|
|
21
|
-
import { StateNode } from "@/components/composites/StateNode";
|
|
22
|
-
import { TransitionNode } from "@/components/composites/TransitionNode";
|
|
21
|
+
import { StateNode, type StateNodeData } from "@/components/composites/StateNode";
|
|
22
|
+
import { TransitionNode, type TransitionNodeData } from "@/components/composites/TransitionNode";
|
|
23
|
+
import { TriggerNode, type TriggerNodeData } from "@/components/composites/TriggerNode";
|
|
23
24
|
import type { WorkflowCanvasProps, WorkflowEdge } from "./interfaces";
|
|
24
25
|
import "@xyflow/react/dist/style.css";
|
|
25
26
|
|
|
@@ -32,6 +33,7 @@ const edgeTypes = {
|
|
|
32
33
|
const nodeTypes = {
|
|
33
34
|
state: StateNode,
|
|
34
35
|
transition: TransitionNode,
|
|
36
|
+
trigger: TriggerNode,
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
function WorkflowCanvasInner({
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { NodeProps } from "@xyflow/react";
|
|
4
|
+
import { Play } from "lucide-react";
|
|
5
|
+
import { memo } from "react";
|
|
6
|
+
import {
|
|
7
|
+
Node,
|
|
8
|
+
NodeDescription,
|
|
9
|
+
NodeTitle,
|
|
10
|
+
} from "@/components/ai-elements/node";
|
|
11
|
+
import { cn } from "@/lib/utils";
|
|
12
|
+
|
|
13
|
+
export type TriggerNodeData = {
|
|
14
|
+
label: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
type: "trigger";
|
|
17
|
+
status?: "idle" | "running" | "success" | "error";
|
|
18
|
+
enabled?: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type TriggerNodeProps = NodeProps & {
|
|
22
|
+
data?: TriggerNodeData;
|
|
23
|
+
id: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const TriggerNode = memo(({ data, selected, id }: TriggerNodeProps) => {
|
|
27
|
+
if (!data) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const displayTitle = data.label || "Trigger";
|
|
32
|
+
const displayDescription = data.description;
|
|
33
|
+
const status = data.status;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Node
|
|
37
|
+
className={cn(
|
|
38
|
+
"relative flex h-auto w-auto min-w-[120px] max-w-[180px] flex-col items-center justify-center bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 shadow-none transition-all duration-150 ease-out",
|
|
39
|
+
selected && "border-primary border-2"
|
|
40
|
+
)}
|
|
41
|
+
data-testid={`trigger-node-${id}`}
|
|
42
|
+
handles={{ target: false, source: true }}
|
|
43
|
+
status={status}
|
|
44
|
+
>
|
|
45
|
+
<div className="flex items-center gap-1.5 px-3 py-2">
|
|
46
|
+
<Play className="size-3 shrink-0 text-purple-600 dark:text-purple-400" strokeWidth={1.5} />
|
|
47
|
+
<div className="flex flex-col">
|
|
48
|
+
<NodeTitle className="text-xs font-medium leading-tight">{displayTitle}</NodeTitle>
|
|
49
|
+
{displayDescription && (
|
|
50
|
+
<NodeDescription className="text-[10px] leading-tight mt-0.5">
|
|
51
|
+
{displayDescription}
|
|
52
|
+
</NodeDescription>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</Node>
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
TriggerNode.displayName = "TriggerNode";
|
|
@@ -130,6 +130,10 @@ export type { StateNodeData } from './StateNode'
|
|
|
130
130
|
export { TransitionNode } from './TransitionNode'
|
|
131
131
|
export type { TransitionNodeData } from './TransitionNode'
|
|
132
132
|
|
|
133
|
+
// TriggerNode Composite
|
|
134
|
+
export { TriggerNode } from './TriggerNode'
|
|
135
|
+
export type { TriggerNodeData } from './TriggerNode'
|
|
136
|
+
|
|
133
137
|
// WorkflowToolbar Composite
|
|
134
138
|
export { WorkflowToolbar, WorkflowToolbarActions } from './WorkflowToolbar'
|
|
135
139
|
export type { WorkflowToolbarProps, WorkflowToolbarActionsProps, WorkflowVersion, ToolbarAction } from './WorkflowToolbar'
|
package/dist/index.cjs
CHANGED
|
@@ -8370,6 +8370,34 @@ var TransitionNode = React3.memo(
|
|
|
8370
8370
|
}
|
|
8371
8371
|
);
|
|
8372
8372
|
TransitionNode.displayName = "TransitionNode";
|
|
8373
|
+
var TriggerNode = React3.memo(({ data, selected, id }) => {
|
|
8374
|
+
if (!data) {
|
|
8375
|
+
return null;
|
|
8376
|
+
}
|
|
8377
|
+
const displayTitle = data.label || "Trigger";
|
|
8378
|
+
const displayDescription = data.description;
|
|
8379
|
+
const status = data.status;
|
|
8380
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8381
|
+
Node2,
|
|
8382
|
+
{
|
|
8383
|
+
className: cn(
|
|
8384
|
+
"relative flex h-auto w-auto min-w-[120px] max-w-[180px] flex-col items-center justify-center bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 shadow-none transition-all duration-150 ease-out",
|
|
8385
|
+
selected && "border-primary border-2"
|
|
8386
|
+
),
|
|
8387
|
+
"data-testid": `trigger-node-${id}`,
|
|
8388
|
+
handles: { target: false, source: true },
|
|
8389
|
+
status,
|
|
8390
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 px-3 py-2", children: [
|
|
8391
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "size-3 shrink-0 text-purple-600 dark:text-purple-400", strokeWidth: 1.5 }),
|
|
8392
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
8393
|
+
/* @__PURE__ */ jsxRuntime.jsx(NodeTitle, { className: "text-xs font-medium leading-tight", children: displayTitle }),
|
|
8394
|
+
displayDescription && /* @__PURE__ */ jsxRuntime.jsx(NodeDescription, { className: "text-[10px] leading-tight mt-0.5", children: displayDescription })
|
|
8395
|
+
] })
|
|
8396
|
+
] })
|
|
8397
|
+
}
|
|
8398
|
+
);
|
|
8399
|
+
});
|
|
8400
|
+
TriggerNode.displayName = "TriggerNode";
|
|
8373
8401
|
function WorkflowToolbarActions({
|
|
8374
8402
|
actionGroups = [],
|
|
8375
8403
|
className
|
|
@@ -9341,7 +9369,8 @@ var edgeTypes = {
|
|
|
9341
9369
|
};
|
|
9342
9370
|
var nodeTypes = {
|
|
9343
9371
|
state: StateNode,
|
|
9344
|
-
transition: TransitionNode
|
|
9372
|
+
transition: TransitionNode,
|
|
9373
|
+
trigger: TriggerNode
|
|
9345
9374
|
};
|
|
9346
9375
|
function WorkflowCanvasInner({
|
|
9347
9376
|
nodes,
|