@app-studio/web 0.8.95 → 0.8.97
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/components/ChatInput/AttachmentGroup.d.ts +19 -0
- package/dist/components/ChatInput/ChatInput/ChatInput.props.d.ts +204 -0
- package/dist/components/ChatInput/ChatInput/ChatInput.state.d.ts +33 -0
- package/dist/components/ChatInput/ChatInput/ChatInput.style.d.ts +112 -0
- package/dist/components/ChatInput/ChatInput/ChatInput.type.d.ts +67 -0
- package/dist/components/ChatInput/ChatInput/ChatInput.view.d.ts +4 -0
- package/dist/components/ChatInput/ChatInput.d.ts +21 -0
- package/dist/components/ChatInput/EditableInput.d.ts +15 -0
- package/dist/components/ChatInput/FileUploadHandler.d.ts +20 -0
- package/dist/components/ChatInput/GuideTip.d.ts +12 -0
- package/dist/components/ChatInput/MessageInput.d.ts +36 -0
- package/dist/components/ChatInput/PromptExamples.d.ts +13 -0
- package/dist/components/ChatInput/ReferenceImageButton.d.ts +11 -0
- package/dist/components/ChatInput/ReferenceImageModal.d.ts +12 -0
- package/dist/components/ChatInput/index.d.ts +9 -0
- package/dist/components/Flow/Flow/Flow.props.d.ts +144 -0
- package/dist/components/Flow/Flow/Flow.state.d.ts +95 -0
- package/dist/components/Flow/Flow/Flow.style.d.ts +40 -0
- package/dist/components/Flow/Flow/Flow.type.d.ts +181 -0
- package/dist/components/Flow/Flow/Flow.view.d.ts +28 -0
- package/dist/components/Flow/Flow.d.ts +2 -0
- package/dist/components/Flow/examples/DragAndDrop.d.ts +2 -0
- package/dist/components/Flow/examples/default.d.ts +2 -0
- package/dist/components/Flow/examples/flowchart.d.ts +2 -0
- package/dist/components/Flow/examples/index.d.ts +2 -0
- package/dist/components/Flow/examples/list.d.ts +2 -0
- package/dist/components/Flow/index.d.ts +2 -0
- package/dist/components/Icon/Icon.d.ts +7 -0
- package/dist/components/TextArea/TextArea.d.ts +22 -0
- package/dist/components/Toast/Toast.d.ts +2 -1
- package/dist/components/Tree/Tree/Tree.props.d.ts +106 -0
- package/dist/components/Tree/Tree/Tree.state.d.ts +38 -0
- package/dist/components/Tree/Tree/Tree.style.d.ts +41 -0
- package/dist/components/Tree/Tree/Tree.type.d.ts +133 -0
- package/dist/components/Tree/Tree/Tree.view.d.ts +36 -0
- package/dist/components/Tree/Tree.d.ts +2 -0
- package/dist/components/Tree/examples/DragAndDrop.d.ts +2 -0
- package/dist/components/Tree/examples/controlled.d.ts +2 -0
- package/dist/components/Tree/examples/custom-styling.d.ts +2 -0
- package/dist/components/Tree/examples/data-driven.d.ts +2 -0
- package/dist/components/Tree/examples/default.d.ts +2 -0
- package/dist/components/Tree/examples/index.d.ts +6 -0
- package/dist/components/Tree/examples/variants.d.ts +2 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/pages/chat.page.d.ts +2 -2
- package/dist/pages/flow.page.d.ts +3 -0
- package/dist/pages/tree.page.d.ts +3 -0
- package/dist/web.cjs.development.js +3831 -281
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +3823 -284
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +3833 -285
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/Chat/AIResponseDisplay/AIResponseDisplay/AIResponseDisplay.props.d.ts +0 -40
- package/dist/components/Chat/AIResponseDisplay/AIResponseDisplay/AIResponseDisplay.style.d.ts +0 -10
- package/dist/components/Chat/AIResponseDisplay/AIResponseDisplay/AIResponseDisplay.type.d.ts +0 -23
- package/dist/components/Chat/AIResponseDisplay/AIResponseDisplay/AIResponseDisplay.view.d.ts +0 -9
- package/dist/components/Chat/AIResponseDisplay/AIResponseDisplay.d.ts +0 -10
- package/dist/components/Chat/AIResponseDisplay/examples/basic.d.ts +0 -5
- package/dist/components/Chat/AIResponseDisplay/examples/index.d.ts +0 -4
- package/dist/components/Chat/ChatInterface/ChatInterface/ChatInterface.props.d.ts +0 -56
- package/dist/components/Chat/ChatInterface/ChatInterface/ChatInterface.state.d.ts +0 -12
- package/dist/components/Chat/ChatInterface/ChatInterface/ChatInterface.style.d.ts +0 -10
- package/dist/components/Chat/ChatInterface/ChatInterface/ChatInterface.type.d.ts +0 -19
- package/dist/components/Chat/ChatInterface/ChatInterface/ChatInterface.view.d.ts +0 -14
- package/dist/components/Chat/ChatInterface/ChatInterface.d.ts +0 -11
- package/dist/components/Chat/CodeBlock/CodeBlock/CodeBlock.props.d.ts +0 -35
- package/dist/components/Chat/CodeBlock/CodeBlock/CodeBlock.state.d.ts +0 -7
- package/dist/components/Chat/CodeBlock/CodeBlock/CodeBlock.style.d.ts +0 -12
- package/dist/components/Chat/CodeBlock/CodeBlock/CodeBlock.type.d.ts +0 -11
- package/dist/components/Chat/CodeBlock/CodeBlock/CodeBlock.view.d.ts +0 -11
- package/dist/components/Chat/CodeBlock/CodeBlock.d.ts +0 -10
- package/dist/components/Chat/FileUploader/FileUploader/FileUploader.props.d.ts +0 -47
- package/dist/components/Chat/FileUploader/FileUploader/FileUploader.state.d.ts +0 -15
- package/dist/components/Chat/FileUploader/FileUploader/FileUploader.style.d.ts +0 -15
- package/dist/components/Chat/FileUploader/FileUploader/FileUploader.type.d.ts +0 -24
- package/dist/components/Chat/FileUploader/FileUploader/FileUploader.view.d.ts +0 -18
- package/dist/components/Chat/FileUploader/FileUploader.d.ts +0 -11
- package/dist/components/Chat/LoadingIndicator/LoadingIndicator/LoadingIndicator.props.d.ts +0 -27
- package/dist/components/Chat/LoadingIndicator/LoadingIndicator/LoadingIndicator.style.d.ts +0 -13
- package/dist/components/Chat/LoadingIndicator/LoadingIndicator/LoadingIndicator.type.d.ts +0 -11
- package/dist/components/Chat/LoadingIndicator/LoadingIndicator/LoadingIndicator.view.d.ts +0 -6
- package/dist/components/Chat/LoadingIndicator/LoadingIndicator.d.ts +0 -10
- package/dist/components/Chat/MessageBubble/MessageBubble/MessageBubble.props.d.ts +0 -36
- package/dist/components/Chat/MessageBubble/MessageBubble/MessageBubble.state.d.ts +0 -14
- package/dist/components/Chat/MessageBubble/MessageBubble/MessageBubble.style.d.ts +0 -10
- package/dist/components/Chat/MessageBubble/MessageBubble/MessageBubble.type.d.ts +0 -11
- package/dist/components/Chat/MessageBubble/MessageBubble/MessageBubble.view.d.ts +0 -17
- package/dist/components/Chat/MessageBubble/MessageBubble.d.ts +0 -10
- package/dist/components/Chat/ModelSelector/ModelSelector/ModelSelector.props.d.ts +0 -39
- package/dist/components/Chat/ModelSelector/ModelSelector/ModelSelector.state.d.ts +0 -12
- package/dist/components/Chat/ModelSelector/ModelSelector/ModelSelector.style.d.ts +0 -11
- package/dist/components/Chat/ModelSelector/ModelSelector/ModelSelector.type.d.ts +0 -21
- package/dist/components/Chat/ModelSelector/ModelSelector/ModelSelector.view.d.ts +0 -16
- package/dist/components/Chat/ModelSelector/ModelSelector.d.ts +0 -10
- package/dist/components/Chat/PromptInput/PromptInput/PromptInput.props.d.ts +0 -59
- package/dist/components/Chat/PromptInput/PromptInput/PromptInput.state.d.ts +0 -13
- package/dist/components/Chat/PromptInput/PromptInput/PromptInput.style.d.ts +0 -10
- package/dist/components/Chat/PromptInput/PromptInput/PromptInput.type.d.ts +0 -11
- package/dist/components/Chat/PromptInput/PromptInput/PromptInput.view.d.ts +0 -16
- package/dist/components/Chat/PromptInput/PromptInput.d.ts +0 -10
- package/dist/components/Chat/SettingsPanel/SettingsPanel/SettingsPanel.props.d.ts +0 -31
- package/dist/components/Chat/SettingsPanel/SettingsPanel/SettingsPanel.style.d.ts +0 -11
- package/dist/components/Chat/SettingsPanel/SettingsPanel/SettingsPanel.type.d.ts +0 -30
- package/dist/components/Chat/SettingsPanel/SettingsPanel/SettingsPanel.view.d.ts +0 -6
- package/dist/components/Chat/SettingsPanel/SettingsPanel.d.ts +0 -10
- package/dist/components/Chat/ToolSelector/ToolSelector/ToolSelector.props.d.ts +0 -39
- package/dist/components/Chat/ToolSelector/ToolSelector/ToolSelector.style.d.ts +0 -10
- package/dist/components/Chat/ToolSelector/ToolSelector/ToolSelector.type.d.ts +0 -20
- package/dist/components/Chat/ToolSelector/ToolSelector/ToolSelector.view.d.ts +0 -6
- package/dist/components/Chat/ToolSelector/ToolSelector.d.ts +0 -10
- package/dist/components/Chat/index.d.ts +0 -16
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ViewProps } from 'app-studio';
|
|
3
|
+
import { Size, Variant, FlowNode, NodeConnection, FlowComponentType, FlowViewport, NodePosition } from './Flow.type';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the Flow component
|
|
6
|
+
*/
|
|
7
|
+
export interface FlowProps extends Omit<ViewProps, 'position'> {
|
|
8
|
+
/**
|
|
9
|
+
* Child elements for compound component pattern
|
|
10
|
+
* Note: Flow component primarily uses `nodes` and `edges` props for data.
|
|
11
|
+
* Children could be used for custom overlays or context providers if needed.
|
|
12
|
+
*/
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Array of nodes in the flow
|
|
16
|
+
*/
|
|
17
|
+
nodes?: FlowNode[];
|
|
18
|
+
/**
|
|
19
|
+
* Array of edges/connections between nodes
|
|
20
|
+
*/
|
|
21
|
+
edges?: NodeConnection[];
|
|
22
|
+
/**
|
|
23
|
+
* Size of the flow nodes
|
|
24
|
+
* @default 'md'
|
|
25
|
+
*/
|
|
26
|
+
size?: Size;
|
|
27
|
+
/**
|
|
28
|
+
* Visual variant of the flow nodes (affects node appearance)
|
|
29
|
+
* @default 'default'
|
|
30
|
+
*/
|
|
31
|
+
variant?: Variant;
|
|
32
|
+
/**
|
|
33
|
+
* Direction of the flow layout (influences default new node placement)
|
|
34
|
+
* @default 'vertical'
|
|
35
|
+
*/
|
|
36
|
+
direction?: 'vertical' | 'horizontal';
|
|
37
|
+
/**
|
|
38
|
+
* Whether to show the controls (zoom, etc.)
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
showControls?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to allow adding nodes
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
allowAddingNodes?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether to allow deleting nodes (functionality not fully implemented in this simplified version)
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
allowDeletingNodes?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to allow connecting nodes (functionality not fully implemented in this simplified version)
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
allowConnectingNodes?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to allow dragging nodes to reposition them
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
allowDraggingNodes?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Callback when nodes change (e.g., added, position changed)
|
|
64
|
+
*/
|
|
65
|
+
onNodesChange?: (nodes: FlowNode[]) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Callback when edges change (e.g., added)
|
|
68
|
+
*/
|
|
69
|
+
onEdgesChange?: (edges: NodeConnection[]) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Callback when a node is selected
|
|
72
|
+
*/
|
|
73
|
+
onNodeSelect?: (nodeId: string) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Callback when a node is added by user interaction
|
|
76
|
+
* The `newNode` passed will have an ID and default data, but its position
|
|
77
|
+
* will be determined by the `addNodeAfter` logic in `useFlowState`.
|
|
78
|
+
*/
|
|
79
|
+
onNodeAdd?: (newNode: FlowNode) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Callback when a node is deleted
|
|
82
|
+
*/
|
|
83
|
+
onNodeDelete?: (nodeId: string) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Callback when a connection is created
|
|
86
|
+
*/
|
|
87
|
+
onConnect?: (connection: NodeConnection) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Callback when a node drag starts
|
|
90
|
+
*/
|
|
91
|
+
onNodeDragStart?: (nodeId: string, event: React.MouseEvent | React.TouchEvent) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Callback when a node is being dragged
|
|
94
|
+
*/
|
|
95
|
+
onNodeDrag?: (nodeId: string, position: NodePosition, event: MouseEvent | TouchEvent) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Callback when a node drag ends
|
|
98
|
+
*/
|
|
99
|
+
onNodeDragEnd?: (nodeId: string, position: NodePosition) => void;
|
|
100
|
+
/**
|
|
101
|
+
* ID of the selected node (controlled mode)
|
|
102
|
+
*/
|
|
103
|
+
selectedNodeId?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Initial viewport state (zoom, pan)
|
|
106
|
+
*/
|
|
107
|
+
initialViewport?: FlowViewport;
|
|
108
|
+
/**
|
|
109
|
+
* Controlled viewport state
|
|
110
|
+
*/
|
|
111
|
+
viewport?: FlowViewport;
|
|
112
|
+
/**
|
|
113
|
+
* Callback when viewport changes
|
|
114
|
+
*/
|
|
115
|
+
onViewportChange?: (viewport: FlowViewport) => void;
|
|
116
|
+
/**
|
|
117
|
+
* Custom views for styling different parts of the component
|
|
118
|
+
*/
|
|
119
|
+
views?: {
|
|
120
|
+
container?: ViewProps;
|
|
121
|
+
node?: {
|
|
122
|
+
container?: ViewProps;
|
|
123
|
+
content?: ViewProps;
|
|
124
|
+
icon?: ViewProps;
|
|
125
|
+
};
|
|
126
|
+
edge?: {
|
|
127
|
+
path?: ViewProps;
|
|
128
|
+
label?: ViewProps;
|
|
129
|
+
};
|
|
130
|
+
controls?: {
|
|
131
|
+
container?: ViewProps;
|
|
132
|
+
button?: ViewProps;
|
|
133
|
+
};
|
|
134
|
+
addButton?: {
|
|
135
|
+
container?: ViewProps;
|
|
136
|
+
icon?: ViewProps;
|
|
137
|
+
};
|
|
138
|
+
fixedControlsContainer?: ViewProps;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Type for the Flow component with sub-components
|
|
143
|
+
*/
|
|
144
|
+
export declare type FlowType = FlowComponentType<FlowProps>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FlowNode, NodeConnection, FlowViewport, NodePosition } from './Flow.type';
|
|
3
|
+
interface UseFlowStateProps {
|
|
4
|
+
/**
|
|
5
|
+
* Initial nodes
|
|
6
|
+
*/
|
|
7
|
+
initialNodes?: FlowNode[];
|
|
8
|
+
/**
|
|
9
|
+
* Initial edges/connections
|
|
10
|
+
*/
|
|
11
|
+
initialEdges?: NodeConnection[];
|
|
12
|
+
/**
|
|
13
|
+
* Controlled nodes
|
|
14
|
+
*/
|
|
15
|
+
nodes?: FlowNode[];
|
|
16
|
+
/**
|
|
17
|
+
* Controlled edges/connections
|
|
18
|
+
*/
|
|
19
|
+
edges?: NodeConnection[];
|
|
20
|
+
/**
|
|
21
|
+
* Callback when nodes change
|
|
22
|
+
*/
|
|
23
|
+
onNodesChange?: (nodes: FlowNode[]) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Callback when edges change
|
|
26
|
+
*/
|
|
27
|
+
onEdgesChange?: (edges: NodeConnection[]) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Callback when a node is selected
|
|
30
|
+
*/
|
|
31
|
+
onNodeSelect?: (nodeId: string) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Controlled selected node ID
|
|
34
|
+
*/
|
|
35
|
+
selectedNodeId?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Direction of the flow
|
|
38
|
+
*/
|
|
39
|
+
direction?: 'vertical' | 'horizontal';
|
|
40
|
+
/**
|
|
41
|
+
* Initial viewport state (zoom, pan)
|
|
42
|
+
*/
|
|
43
|
+
initialViewport?: FlowViewport;
|
|
44
|
+
/**
|
|
45
|
+
* Controlled viewport state
|
|
46
|
+
*/
|
|
47
|
+
viewport?: FlowViewport;
|
|
48
|
+
/**
|
|
49
|
+
* Callback when viewport changes
|
|
50
|
+
*/
|
|
51
|
+
onViewportChange?: (viewport: FlowViewport) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to allow dragging nodes
|
|
54
|
+
*/
|
|
55
|
+
allowDraggingNodes?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Callback when a node drag starts
|
|
58
|
+
*/
|
|
59
|
+
onNodeDragStart?: (nodeId: string, event: React.MouseEvent | React.TouchEvent) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Callback when a node is being dragged
|
|
62
|
+
*/
|
|
63
|
+
onNodeDrag?: (nodeId: string, position: NodePosition, event: MouseEvent | TouchEvent) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Callback when a node drag ends
|
|
66
|
+
*/
|
|
67
|
+
onNodeDragEnd?: (nodeId: string, position: NodePosition) => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Custom hook for managing Flow component state
|
|
71
|
+
*/
|
|
72
|
+
export declare const useFlowState: ({ initialNodes, initialEdges, nodes: controlledNodes, edges: controlledEdges, onNodesChange, onEdgesChange, onNodeSelect, selectedNodeId: controlledSelectedNodeId, direction, initialViewport, viewport: controlledViewport, onViewportChange, allowDraggingNodes, onNodeDragStart, onNodeDrag, onNodeDragEnd, }: UseFlowStateProps) => {
|
|
73
|
+
baseId: string;
|
|
74
|
+
nodes: FlowNode[];
|
|
75
|
+
edges: NodeConnection[];
|
|
76
|
+
selectedNodeId: string | undefined;
|
|
77
|
+
viewport: any;
|
|
78
|
+
updateNodes: (newNodes: FlowNode[]) => void;
|
|
79
|
+
updateEdges: (newEdges: NodeConnection[]) => void;
|
|
80
|
+
updateViewport: (newViewport: FlowViewport) => void;
|
|
81
|
+
selectNode: (nodeId: string) => void;
|
|
82
|
+
addNode: (node: FlowNode) => void;
|
|
83
|
+
addNodeAfter: (afterNodeId: string | null, newNodeData: Omit<FlowNode, 'position'>, position?: "top" | "bottom" | "right" | "left" | undefined) => FlowNode;
|
|
84
|
+
deleteNode: (nodeId: string) => void;
|
|
85
|
+
connectNodes: (connection: NodeConnection) => void;
|
|
86
|
+
zoomIn: () => void;
|
|
87
|
+
zoomOut: () => void;
|
|
88
|
+
resetViewport: () => void;
|
|
89
|
+
draggedNodeId: string | null;
|
|
90
|
+
startNodeDrag: (nodeId: string, event: React.MouseEvent | React.TouchEvent) => void;
|
|
91
|
+
updateNodeDrag: (event: MouseEvent | TouchEvent) => void;
|
|
92
|
+
endNodeDrag: () => void;
|
|
93
|
+
allowDraggingNodes: boolean;
|
|
94
|
+
};
|
|
95
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ViewProps } from 'app-studio';
|
|
2
|
+
import { Size, Variant } from './Flow.type';
|
|
3
|
+
/**
|
|
4
|
+
* Default styles for the Flow component
|
|
5
|
+
*/
|
|
6
|
+
export declare const DefaultFlowStyles: {
|
|
7
|
+
container: ViewProps;
|
|
8
|
+
node: ViewProps;
|
|
9
|
+
startNode: ViewProps;
|
|
10
|
+
selectedNode: ViewProps;
|
|
11
|
+
edge: ViewProps;
|
|
12
|
+
edgeArrow: ViewProps;
|
|
13
|
+
edgeLabel: ViewProps;
|
|
14
|
+
controls: ViewProps;
|
|
15
|
+
controlButton: ViewProps;
|
|
16
|
+
addNodeButton: ViewProps;
|
|
17
|
+
nodeContent: ViewProps;
|
|
18
|
+
nodeIcon: ViewProps;
|
|
19
|
+
nodeInfo: ViewProps;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Size variations for the FlowNodeView component
|
|
23
|
+
* These apply to the node's container.
|
|
24
|
+
*/
|
|
25
|
+
export declare const FlowNodeSizes: Record<Size, ViewProps>;
|
|
26
|
+
/**
|
|
27
|
+
* Variant styles for the FlowNodeView component
|
|
28
|
+
* These apply to the node's container.
|
|
29
|
+
*/
|
|
30
|
+
export declare const FlowNodeVariants: Record<Variant, ViewProps>;
|
|
31
|
+
/**
|
|
32
|
+
* Node states (applied to FlowNodeView container)
|
|
33
|
+
*/
|
|
34
|
+
export declare const FlowNodeStates: {
|
|
35
|
+
selected: ViewProps;
|
|
36
|
+
hover: {
|
|
37
|
+
borderColor: string;
|
|
38
|
+
boxShadow: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ViewProps } from 'app-studio';
|
|
3
|
+
interface FlowPropsPlaceholder {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Size options for FlowNodeView
|
|
7
|
+
*/
|
|
8
|
+
export declare type Size = 'sm' | 'md' | 'lg';
|
|
9
|
+
/**
|
|
10
|
+
* Variant options for FlowNodeView
|
|
11
|
+
*/
|
|
12
|
+
export declare type Variant = 'default' | 'outline' | 'filled';
|
|
13
|
+
/**
|
|
14
|
+
* Position of a node in the flow
|
|
15
|
+
*/
|
|
16
|
+
export interface NodePosition {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Connection between nodes
|
|
22
|
+
*/
|
|
23
|
+
export interface NodeConnection {
|
|
24
|
+
/**
|
|
25
|
+
* Unique ID for the connection (edge)
|
|
26
|
+
* Recommended to be `edge-${sourceNodeId}-${targetNodeId}` or similar
|
|
27
|
+
*/
|
|
28
|
+
id: string;
|
|
29
|
+
/**
|
|
30
|
+
* Source node ID
|
|
31
|
+
*/
|
|
32
|
+
source: string;
|
|
33
|
+
/**
|
|
34
|
+
* Target node ID
|
|
35
|
+
*/
|
|
36
|
+
target: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional label for the connection
|
|
39
|
+
*/
|
|
40
|
+
label?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Optional custom styling for the connection (applied to FlowEdgeView path)
|
|
43
|
+
*/
|
|
44
|
+
style?: ViewProps;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Flow node data structure
|
|
48
|
+
*/
|
|
49
|
+
export interface FlowNode {
|
|
50
|
+
/**
|
|
51
|
+
* Unique identifier for the node
|
|
52
|
+
*/
|
|
53
|
+
id: string;
|
|
54
|
+
/**
|
|
55
|
+
* Node type (used for rendering different node types)
|
|
56
|
+
*/
|
|
57
|
+
type?: 'default' | 'start' | 'end' | 'decision' | 'process' | string;
|
|
58
|
+
/**
|
|
59
|
+
* Position of the node. Essential for layout in a full flow library.
|
|
60
|
+
*/
|
|
61
|
+
position: NodePosition;
|
|
62
|
+
/**
|
|
63
|
+
* Data associated with the node
|
|
64
|
+
*/
|
|
65
|
+
data?: {
|
|
66
|
+
/**
|
|
67
|
+
* Label text for the node
|
|
68
|
+
*/
|
|
69
|
+
label?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Subtitle text for the node
|
|
72
|
+
*/
|
|
73
|
+
subtitle?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Optional icon to display
|
|
76
|
+
*/
|
|
77
|
+
icon?: React.ReactNode;
|
|
78
|
+
/**
|
|
79
|
+
* Optional number/index for the node
|
|
80
|
+
*/
|
|
81
|
+
number?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Any additional data
|
|
84
|
+
*/
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Whether the node is selected (typically managed by state, not set directly on node data)
|
|
89
|
+
* This field can be used if nodes are passed with pre-selected state, but `selectedNodeId` prop is preferred.
|
|
90
|
+
*/
|
|
91
|
+
selected?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the node is currently being dragged
|
|
94
|
+
*/
|
|
95
|
+
isDragging?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the node can be dragged
|
|
98
|
+
*/
|
|
99
|
+
draggable?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Custom styling for the node (applied to FlowNodeView container)
|
|
102
|
+
*/
|
|
103
|
+
style?: ViewProps;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Flow viewport state (relevant for pan and zoom, not used in simplified view)
|
|
107
|
+
*/
|
|
108
|
+
export interface FlowViewport {
|
|
109
|
+
zoom: number;
|
|
110
|
+
x: number;
|
|
111
|
+
y: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Props for the FlowNodeView component (individual node)
|
|
115
|
+
*/
|
|
116
|
+
export interface FlowNodeProps extends ViewProps {
|
|
117
|
+
node: FlowNode;
|
|
118
|
+
onSelect?: (nodeId: string) => void;
|
|
119
|
+
isSelected?: boolean;
|
|
120
|
+
isDragging?: boolean;
|
|
121
|
+
onDragStart?: (nodeId: string, event: React.MouseEvent | React.TouchEvent) => void;
|
|
122
|
+
onDrag?: (nodeId: string, position: NodePosition, event: MouseEvent | TouchEvent) => void;
|
|
123
|
+
onDragEnd?: (nodeId: string, position: NodePosition) => void;
|
|
124
|
+
size?: Size;
|
|
125
|
+
variant?: Variant;
|
|
126
|
+
views?: {
|
|
127
|
+
container?: ViewProps;
|
|
128
|
+
content?: ViewProps;
|
|
129
|
+
icon?: ViewProps;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Props for the FlowEdgeView component (connection line)
|
|
134
|
+
*/
|
|
135
|
+
export interface FlowEdgeProps extends ViewProps {
|
|
136
|
+
edge: NodeConnection;
|
|
137
|
+
sourceNode?: FlowNode;
|
|
138
|
+
targetNode?: FlowNode;
|
|
139
|
+
views?: {
|
|
140
|
+
path?: ViewProps;
|
|
141
|
+
label?: ViewProps;
|
|
142
|
+
};
|
|
143
|
+
nodeSize?: Size;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Props for the FlowControlsView component (zoom/pan buttons)
|
|
147
|
+
*/
|
|
148
|
+
export interface FlowControlsProps extends ViewProps {
|
|
149
|
+
onZoomIn?: () => void;
|
|
150
|
+
onZoomOut?: () => void;
|
|
151
|
+
onReset?: () => void;
|
|
152
|
+
views?: {
|
|
153
|
+
container?: ViewProps;
|
|
154
|
+
button?: ViewProps;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Props for the FlowAddNodeButtonView component (the small '+' button)
|
|
159
|
+
*/
|
|
160
|
+
export interface FlowAddNodeButtonProps extends Omit<ViewProps, 'position'> {
|
|
161
|
+
onClick?: () => void;
|
|
162
|
+
/**
|
|
163
|
+
* Visual position relative to the element it's attached to (for styling hints, not layout)
|
|
164
|
+
*/
|
|
165
|
+
attachmentPosition?: 'top' | 'right' | 'bottom' | 'left';
|
|
166
|
+
views?: {
|
|
167
|
+
container?: ViewProps;
|
|
168
|
+
icon?: ViewProps;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Flow component type with sub-components.
|
|
173
|
+
* P represents the props of the main Flow component (e.g., FlowProps).
|
|
174
|
+
*/
|
|
175
|
+
export interface FlowComponentType<P = FlowPropsPlaceholder> extends React.FC<P> {
|
|
176
|
+
Node: React.FC<FlowNodeProps>;
|
|
177
|
+
Edge: React.FC<FlowEdgeProps>;
|
|
178
|
+
Controls: React.FC<FlowControlsProps>;
|
|
179
|
+
AddNodeButton: React.FC<FlowAddNodeButtonProps>;
|
|
180
|
+
}
|
|
181
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps } from 'app-studio';
|
|
3
|
+
import { FlowNode as FlowNodeType, // Renamed to avoid conflict with component name
|
|
4
|
+
NodeConnection, FlowNodeProps, FlowEdgeProps, FlowControlsProps, FlowAddNodeButtonProps, FlowViewport, NodePosition } from './Flow.type';
|
|
5
|
+
import { FlowProps } from './Flow.props';
|
|
6
|
+
export declare const FlowNodeView: React.FC<FlowNodeProps>;
|
|
7
|
+
export declare const FlowEdgeView: React.FC<FlowEdgeProps>;
|
|
8
|
+
export declare const FlowControlsView: React.FC<FlowControlsProps>;
|
|
9
|
+
export declare const FlowAddNodeButtonView: React.FC<FlowAddNodeButtonProps>;
|
|
10
|
+
interface InternalFlowViewProps extends Pick<FlowProps, 'size' | 'variant' | 'direction' | 'showControls' | 'allowAddingNodes' | 'allowDraggingNodes' | 'views'>, Omit<ViewProps, keyof Pick<FlowProps, 'size' | 'variant' | 'direction' | 'showControls' | 'allowAddingNodes' | 'allowDraggingNodes' | 'views'>> {
|
|
11
|
+
nodes: FlowNodeType[];
|
|
12
|
+
edges: NodeConnection[];
|
|
13
|
+
selectedNodeId?: string;
|
|
14
|
+
draggedNodeId?: string | null;
|
|
15
|
+
onNodeSelect: (nodeId: string) => void;
|
|
16
|
+
onAddNode: (afterNodeId: string, position?: 'top' | 'bottom' | 'right' | 'left') => void;
|
|
17
|
+
onNodeDragStart?: (nodeId: string, event: React.MouseEvent | React.TouchEvent) => void;
|
|
18
|
+
onNodeDrag?: (nodeId: string, position: NodePosition, event: MouseEvent | TouchEvent) => void;
|
|
19
|
+
onNodeDragEnd?: (nodeId: string, position: NodePosition) => void;
|
|
20
|
+
baseId: string;
|
|
21
|
+
viewport?: FlowViewport;
|
|
22
|
+
onZoomIn?: () => void;
|
|
23
|
+
onZoomOut?: () => void;
|
|
24
|
+
onReset?: () => void;
|
|
25
|
+
onViewportChange?: (viewport: FlowViewport) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare const FlowView: React.FC<InternalFlowViewProps>;
|
|
28
|
+
export {};
|
|
@@ -7,6 +7,7 @@ export interface IconProps extends ViewProps {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const UserIcon: React.FC<IconProps>;
|
|
9
9
|
export declare const HelpIcon: React.FC<IconProps>;
|
|
10
|
+
export declare const FolderIcon: React.FC<IconProps>;
|
|
10
11
|
export declare const ChevronIcon: React.FC<IconProps>;
|
|
11
12
|
export declare const DragHandleIcon: React.FC<IconProps>;
|
|
12
13
|
export declare const FileIcon: React.FC<IconProps>;
|
|
@@ -65,6 +66,12 @@ export declare const UnlockIcon: React.FC<IconProps>;
|
|
|
65
66
|
export declare const WifiIcon: React.FC<IconProps>;
|
|
66
67
|
export declare const UploadIcon: React.FC<IconProps>;
|
|
67
68
|
export declare const SearchIcon: React.FC<IconProps>;
|
|
69
|
+
export declare const StopIcon: React.FC<IconProps>;
|
|
70
|
+
export declare const SendIcon: React.FC<IconProps>;
|
|
71
|
+
export declare const LoadingSpinnerIcon: React.FC<IconProps>;
|
|
72
|
+
export declare const DragHandleLinesIcon: React.FC<IconProps>;
|
|
73
|
+
export declare const ChevronDownIcon: React.FC<IconProps>;
|
|
74
|
+
export declare const ChevronRightIcon: React.FC<IconProps>;
|
|
68
75
|
export declare const CloseEyeIcon: React.FC<IconProps>;
|
|
69
76
|
export declare const ExternalLinkIcon: React.FC<IconProps>;
|
|
70
77
|
export declare const PlusIcon: React.FC<IconProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextArea Component
|
|
3
|
+
*
|
|
4
|
+
* A simple textarea component with styling.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
8
|
+
/**
|
|
9
|
+
* Number of rows to display
|
|
10
|
+
*/
|
|
11
|
+
rows?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the textarea is disabled
|
|
14
|
+
*/
|
|
15
|
+
isDisabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the textarea has an error
|
|
18
|
+
*/
|
|
19
|
+
hasError?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const TextArea: React.FC<TextAreaProps>;
|
|
22
|
+
export default TextArea;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ToastProps, ToastContainerProps } from './Toast/Toast.props';
|
|
3
|
+
import { showToast } from './Toast/Toast.store';
|
|
3
4
|
declare const Toast: React.FC<ToastProps> & {
|
|
4
5
|
Container: (props: ToastContainerProps) => React.JSX.Element;
|
|
5
6
|
show: (variant: import("./Toast/Toast.type").ToastVariant, title: string, description?: string | undefined, options?: import("./Toast/Toast.type").ToastOptions | undefined) => any;
|
|
@@ -19,4 +20,4 @@ export declare const useToast: () => {
|
|
|
19
20
|
remove: (id: string) => void;
|
|
20
21
|
removeAll: () => void;
|
|
21
22
|
};
|
|
22
|
-
export { Toast };
|
|
23
|
+
export { Toast, showToast };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ViewProps } from 'app-studio';
|
|
3
|
+
import { Size, Variant, TreeNode, TreeComponentType } from './Tree.type';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the Tree component
|
|
6
|
+
*/
|
|
7
|
+
export interface TreeProps extends ViewProps {
|
|
8
|
+
/**
|
|
9
|
+
* Child elements for compound component pattern (e.g., <Tree.Item />).
|
|
10
|
+
* Used if `items` prop is not provided.
|
|
11
|
+
*/
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Data-driven approach: array of tree nodes.
|
|
15
|
+
* If provided, `children` will be ignored for rendering tree items.
|
|
16
|
+
*/
|
|
17
|
+
items?: TreeNode[];
|
|
18
|
+
/**
|
|
19
|
+
* Size of the tree items (affects padding and font size primarily).
|
|
20
|
+
* @default 'md'
|
|
21
|
+
*/
|
|
22
|
+
size?: Size;
|
|
23
|
+
/**
|
|
24
|
+
* Visual variant of the tree items (affects background, borders).
|
|
25
|
+
* @default 'default'
|
|
26
|
+
*/
|
|
27
|
+
variant?: Variant;
|
|
28
|
+
/**
|
|
29
|
+
* IDs of initially expanded items (uncontrolled mode).
|
|
30
|
+
*/
|
|
31
|
+
defaultExpandedItems?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* IDs of expanded items (controlled mode).
|
|
34
|
+
* If provided, component is controlled; `onExpandedItemsChange` must be used to update.
|
|
35
|
+
*/
|
|
36
|
+
expandedItems?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Callback when expanded items change.
|
|
39
|
+
* Receives an array of currently expanded item IDs.
|
|
40
|
+
*/
|
|
41
|
+
onExpandedItemsChange?: (expandedItems: string[]) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Callback when an item is selected (clicked).
|
|
44
|
+
* Receives the `itemId` and the full `TreeNode` object if available (from data-driven mode).
|
|
45
|
+
*/
|
|
46
|
+
onItemSelect?: (itemId: string, item?: TreeNode) => void;
|
|
47
|
+
/**
|
|
48
|
+
* ID of the currently selected item (controlled mode).
|
|
49
|
+
*/
|
|
50
|
+
selectedItem?: string;
|
|
51
|
+
/**
|
|
52
|
+
* ID of the initially selected item (uncontrolled mode).
|
|
53
|
+
*/
|
|
54
|
+
defaultSelectedItem?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to allow multiple selection.
|
|
57
|
+
* Note: Multi-select state management (tracking multiple selected items) is not fully implemented in `useTreeState` provided.
|
|
58
|
+
* This prop is a placeholder for future enhancement.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
multiSelect?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether to enable drag and drop functionality for tree items.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
allowDragAndDrop?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Custom icon to use for the drag handle.
|
|
69
|
+
* If not provided, a default drag handle icon will be used.
|
|
70
|
+
*/
|
|
71
|
+
dragHandleIcon?: React.ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* Callback when items are reordered via drag and drop.
|
|
74
|
+
* Receives the updated array of tree nodes.
|
|
75
|
+
*/
|
|
76
|
+
onItemsReorder?: (items: TreeNode[]) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Callback when drag starts on an item.
|
|
79
|
+
* Receives the item ID and the event.
|
|
80
|
+
*/
|
|
81
|
+
onDragStart?: (itemId: string, event: React.DragEvent) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Callback when drag ends.
|
|
84
|
+
* Receives the item ID.
|
|
85
|
+
*/
|
|
86
|
+
onDragEnd?: (itemId: string) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Custom views for styling different parts of the component.
|
|
89
|
+
* Allows overriding default styles for sub-components.
|
|
90
|
+
*/
|
|
91
|
+
views?: {
|
|
92
|
+
container?: ViewProps;
|
|
93
|
+
item?: ViewProps;
|
|
94
|
+
itemLabel?: ViewProps;
|
|
95
|
+
itemContent?: ViewProps;
|
|
96
|
+
icon?: ViewProps;
|
|
97
|
+
expandIcon?: ViewProps;
|
|
98
|
+
draggedItem?: ViewProps;
|
|
99
|
+
dragHandle?: ViewProps;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Type for the Tree component with sub-components.
|
|
104
|
+
* Makes `Tree.Item`, `Tree.ItemLabel`, `Tree.ItemContent` available.
|
|
105
|
+
*/
|
|
106
|
+
export declare type TreeType = TreeComponentType<TreeProps>;
|