@app-studio/web 0.9.44 → 0.9.46
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/Icon/Icon.d.ts +2 -1
- package/dist/pages/themeTest.page.d.ts +3 -0
- package/dist/web.cjs.development.js +7 -2
- 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 +7 -3
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +7 -2
- 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/docs/components/Badge.mdx +1 -1
- package/docs/components/ColorPicker.mdx +16 -16
- package/docs/components/DragAndDrop.mdx +11 -11
- package/docs/components/Drawer.mdx +3 -3
- package/docs/components/Gradient.mdx +40 -40
- package/docs/components/Icon.mdx +90 -57
- package/docs/components/Loader.mdx +17 -17
- package/docs/components/ProgressBar.mdx +14 -14
- package/docs/components/StatusIndicator.mdx +5 -5
- package/docs/components.md +0 -164
- package/package.json +1 -1
- package/dist/bot/Bot.d.ts +0 -15
- package/dist/bot/Cache.d.ts +0 -13
- package/dist/bot/Config.d.ts +0 -13
- package/dist/bot/ContentFetcher.d.ts +0 -9
- package/dist/bot/DocuCode.d.ts +0 -19
- package/dist/bot/FileHandler.d.ts +0 -39
- package/dist/bot/ai/AnthropicConnector.d.ts +0 -6
- package/dist/bot/ai/GeminiConnector.d.ts +0 -7
- package/dist/bot/ai/GroqConnector.d.ts +0 -7
- package/dist/bot/ai/HuggingFaceConnector.d.ts +0 -6
- package/dist/bot/ai/OpenAIConnector.d.ts +0 -11
- package/dist/bot/ai/ReplicateConnector.d.ts +0 -7
- package/dist/bot/ai/SambaNovaConnector.d.ts +0 -6
- package/dist/bot/ai/ai.config.d.ts +0 -12
- package/dist/bot/ai/ai.service.d.ts +0 -36
- package/dist/bot/data.d.ts +0 -19
- package/dist/bot/extractors.d.ts +0 -8
- package/dist/bot/index.d.ts +0 -1
- package/dist/bot/prompt/1-project.d.ts +0 -1
- package/dist/bot/prompt/2-response.d.ts +0 -1
- package/dist/bot/prompt/3-comment.d.ts +0 -1
- package/docs/components/Calendar.mdx +0 -189
- package/docs/components/Flow.mdx +0 -258
- package/docs/components/KanbanBoard.mdx +0 -286
- package/docs/components/OKR.mdx +0 -452
- package/docs/components/Tree.mdx +0 -341
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
# Calendar
|
|
2
|
-
|
|
3
|
-
A flexible calendar component with day, week, and month views for displaying and managing events. Features intelligent navigation (day-by-day, week-by-week, month-by-month), interactive hover cards for events and days, custom event rendering, and comprehensive styling customization.
|
|
4
|
-
|
|
5
|
-
### **Import**
|
|
6
|
-
```tsx
|
|
7
|
-
import { Calendar } from '@app-studio/web';
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
### **Default**
|
|
11
|
-
```tsx
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { Calendar } from '@app-studio/web';
|
|
14
|
-
|
|
15
|
-
export const DefaultCalendar = () => {
|
|
16
|
-
return <Calendar />;
|
|
17
|
-
};
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### **With Events**
|
|
21
|
-
Display events in the calendar with customizable event objects. Hover over events to see detailed information in a popup card, and hover over day cells to see a summary of the day's events.
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
import React from 'react';
|
|
25
|
-
import { Calendar } from '@app-studio/web';
|
|
26
|
-
import { CalendarEvent } from '@app-studio/web';
|
|
27
|
-
|
|
28
|
-
export const CalendarWithEvents = () => {
|
|
29
|
-
const events: CalendarEvent[] = [
|
|
30
|
-
{
|
|
31
|
-
id: 1,
|
|
32
|
-
title: 'Team Meeting',
|
|
33
|
-
start: new Date(2025, 9, 15, 10, 0),
|
|
34
|
-
end: new Date(2025, 9, 15, 11, 0),
|
|
35
|
-
description: 'Weekly team sync-up',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
id: 2,
|
|
39
|
-
title: 'Project Deadline',
|
|
40
|
-
start: new Date(2025, 9, 18, 17, 0),
|
|
41
|
-
description: 'Submit final deliverables',
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
return <Calendar events={events} />;
|
|
46
|
-
};
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**Interactive Features:**
|
|
50
|
-
- **Event Hover Cards**: Hover over any event to see full details including title, date, time, and description
|
|
51
|
-
- **Smart Navigation**: Navigation buttons automatically adapt to the current view (Previous/Next Day, Week, or Month)
|
|
52
|
-
- **Fixed Cell Dimensions**: All day cells maintain consistent width (minimum 180px) and height for uniform layout
|
|
53
|
-
- **Scrollable Content**: Events within each day cell scroll independently while maintaining cell dimensions
|
|
54
|
-
|
|
55
|
-
### **Day View**
|
|
56
|
-
Show a single day with all events for that day.
|
|
57
|
-
|
|
58
|
-
```tsx
|
|
59
|
-
import React from 'react';
|
|
60
|
-
import { Calendar } from '@app-studio/web';
|
|
61
|
-
|
|
62
|
-
export const DayViewCalendar = () => {
|
|
63
|
-
return <Calendar initialView="day" />;
|
|
64
|
-
};
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### **Week View**
|
|
68
|
-
Display a full week with events across all days.
|
|
69
|
-
|
|
70
|
-
```tsx
|
|
71
|
-
import React from 'react';
|
|
72
|
-
import { Calendar } from '@app-studio/web';
|
|
73
|
-
|
|
74
|
-
export const WeekViewCalendar = () => {
|
|
75
|
-
return <Calendar initialView="week" />;
|
|
76
|
-
};
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### **Month View**
|
|
80
|
-
Show the entire month with events distributed across days.
|
|
81
|
-
|
|
82
|
-
```tsx
|
|
83
|
-
import React from 'react';
|
|
84
|
-
import { Calendar } from '@app-studio/web';
|
|
85
|
-
|
|
86
|
-
export const MonthViewCalendar = () => {
|
|
87
|
-
return <Calendar initialView="month" />;
|
|
88
|
-
};
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### **Week Starts On**
|
|
92
|
-
Configure which day the week starts on (0 = Sunday, 1 = Monday, etc.).
|
|
93
|
-
|
|
94
|
-
```tsx
|
|
95
|
-
import React from 'react';
|
|
96
|
-
import { Calendar } from '@app-studio/web';
|
|
97
|
-
|
|
98
|
-
export const WeekStartsOnMonday = () => {
|
|
99
|
-
return <Calendar weekStartsOn={1} />;
|
|
100
|
-
};
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### **Custom Styles**
|
|
104
|
-
Customize the appearance of calendar elements using the `views` prop.
|
|
105
|
-
|
|
106
|
-
## Props
|
|
107
|
-
|
|
108
|
-
| Prop | Type | Description | Default |
|
|
109
|
-
| --- | --- | --- | --- |
|
|
110
|
-
| `events` | `CalendarEvent[]` | Array of events to display. | `[]` |
|
|
111
|
-
| `initialDate` | `Date \| string` | Initial date to display (ISO string or Date object). | `new Date()` |
|
|
112
|
-
| `initialView` | `'day' \| 'week' \| 'month'` | Initial view to display. | `'month'` |
|
|
113
|
-
| `weekStartsOn` | `0-6` | Day the week starts on (0 = Sunday, 1 = Monday). | `0` |
|
|
114
|
-
| `onEventDrop` | `(event: CalendarEvent) => void` | Callback when an event is moved to a new date. | - |
|
|
115
|
-
| `onEventResize` | `(event: CalendarEvent) => void` | Callback when an event is resized. | - |
|
|
116
|
-
| `onEventAdd` | `(start: string, end: string) => void` | Callback when a date is double-clicked to add an event. | - |
|
|
117
|
-
| `onEventTitleChange` | `(event: CalendarEvent, newTitle: string) => void` | Callback when an event's title is changed. | - |
|
|
118
|
-
| `onEventDescriptionChange` | `(event: CalendarEvent, newDescription: string) => void` | Callback when an event's description is changed. | - |
|
|
119
|
-
| `onEventDelete` | `(event: CalendarEvent) => void` | Callback when an event is deleted. | - |
|
|
120
|
-
| `onDateClick` | `(date: string) => void` | Callback when a date is clicked. | - |
|
|
121
|
-
| `onDateChange` | `(date: Date) => void` | Callback when the visible date range changes. | - |
|
|
122
|
-
| `onViewChange` | `(view: CalendarView) => void` | Callback when the active view changes. | - |
|
|
123
|
-
| `views` | `CalendarViews` | Style overrides for various parts of the component. | `{}` |
|
|
124
|
-
|
|
125
|
-
## CalendarEvent Interface
|
|
126
|
-
|
|
127
|
-
| Property | Type | Description |
|
|
128
|
-
| --- | --- | --- |
|
|
129
|
-
| `id` | `string \| number` | Unique identifier for the event. |
|
|
130
|
-
| `title` | `string` | Event title shown in the calendar. |
|
|
131
|
-
| `start` | `string` | Start date/time in ISO format (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM`). |
|
|
132
|
-
| `end` | `string` | End date/time in ISO format (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM`). |
|
|
133
|
-
| `color` | `'blue' \| 'red' \| 'green' \| 'purple' \| 'orange'` | Color variant for the event. |
|
|
134
|
-
| `description` | `string` | Optional description (used for tooltips or custom rendering). |
|
|
135
|
-
| `metadata` | `Record<string, unknown>` | Additional metadata for custom logic. |
|
|
136
|
-
|
|
137
|
-
## CalendarViews Interface
|
|
138
|
-
|
|
139
|
-
Customize the appearance of different calendar elements. All elements support the `views` prop for complete customization:
|
|
140
|
-
|
|
141
|
-
### Container & Layout
|
|
142
|
-
- `container` - Main calendar container (ViewProps)
|
|
143
|
-
- `header` - Header section (ViewProps)
|
|
144
|
-
- `grid` - Calendar grid container (ViewProps)
|
|
145
|
-
|
|
146
|
-
### Header Elements
|
|
147
|
-
- `headerTitle` - Title text in header (TextProps)
|
|
148
|
-
- `navigation` - Navigation buttons container (ViewProps)
|
|
149
|
-
- `navigationButton` - Navigation button props (ButtonProps)
|
|
150
|
-
- `viewSwitcher` - View switcher buttons container (ViewProps)
|
|
151
|
-
- `viewButton` - View button props (ButtonProps)
|
|
152
|
-
|
|
153
|
-
### Weekday Header
|
|
154
|
-
- `weekdayRow` - Weekday row container (ViewProps)
|
|
155
|
-
- `weekdayHeader` - Individual weekday header cell (ViewProps)
|
|
156
|
-
- `weekdayLabel` - Weekday label text (TextProps)
|
|
157
|
-
|
|
158
|
-
### Week & Day Structure
|
|
159
|
-
- `weekRow` - Week row container (ViewProps)
|
|
160
|
-
- `dayColumn` - Individual day column/cell (ViewProps)
|
|
161
|
-
- `dayHeader` - Day header within cell (ViewProps)
|
|
162
|
-
- `dayNumber` - Day number text (TextProps)
|
|
163
|
-
- `dayMeta` - Day metadata text (TextProps)
|
|
164
|
-
|
|
165
|
-
### Events
|
|
166
|
-
- `events` - Events container within day (ViewProps)
|
|
167
|
-
- `event` - Individual event container (ViewProps)
|
|
168
|
-
- `eventTitle` - Event title text (TextProps)
|
|
169
|
-
- `eventTime` - Event time text (TextProps)
|
|
170
|
-
- `emptyState` - Empty state text when no events (TextProps)
|
|
171
|
-
|
|
172
|
-
### Example: Complete Customization
|
|
173
|
-
|
|
174
|
-
```tsx
|
|
175
|
-
<Calendar
|
|
176
|
-
events={events}
|
|
177
|
-
views={{
|
|
178
|
-
container: { backgroundColor: 'color.gray.50', padding: 32 },
|
|
179
|
-
headerTitle: { fontSize: 24, color: 'color.primary.700' },
|
|
180
|
-
weekdayRow: { backgroundColor: 'color.primary.50', borderRadius: 8 },
|
|
181
|
-
weekdayLabel: { fontSize: 16, fontWeight: '700' },
|
|
182
|
-
dayColumn: { padding: 20, borderRadius: 16, borderWidth: 2 },
|
|
183
|
-
dayNumber: { fontSize: 20, color: 'color.primary.700' },
|
|
184
|
-
event: { padding: 16, backgroundColor: 'color.primary.100' },
|
|
185
|
-
eventTitle: { fontSize: 16, fontWeight: '700' },
|
|
186
|
-
}}
|
|
187
|
-
/>
|
|
188
|
-
```
|
|
189
|
-
|
package/docs/components/Flow.mdx
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
# Flow
|
|
2
|
-
|
|
3
|
-
A component for creating interactive workflow diagrams and flowcharts with support for node connections, drag-and-drop functionality, and viewport controls.
|
|
4
|
-
|
|
5
|
-
### **Import**
|
|
6
|
-
```tsx
|
|
7
|
-
import { Flow } from '@app-studio/web';
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
### **Basic Usage**
|
|
11
|
-
```tsx
|
|
12
|
-
import React, { useState } from 'react';
|
|
13
|
-
import { Flow } from '@app-studio/web';
|
|
14
|
-
import { View } from '@app-studio/web';
|
|
15
|
-
|
|
16
|
-
export const BasicFlow = () => {
|
|
17
|
-
// Initial nodes and edges
|
|
18
|
-
const [nodes, setNodes] = useState([
|
|
19
|
-
{
|
|
20
|
-
id: 'node-1',
|
|
21
|
-
position: { x: 50, y: 50 },
|
|
22
|
-
data: {
|
|
23
|
-
label: 'Start Node',
|
|
24
|
-
subtitle: 'Begin here'
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: 'node-2',
|
|
29
|
-
position: { x: 50, y: 200 },
|
|
30
|
-
data: {
|
|
31
|
-
label: 'Process Node',
|
|
32
|
-
subtitle: 'Do something'
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
]);
|
|
36
|
-
|
|
37
|
-
const [edges, setEdges] = useState([
|
|
38
|
-
{ id: 'edge-1-2', source: 'node-1', target: 'node-2' },
|
|
39
|
-
]);
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<View height="400px" border="1px solid" borderColor="color.gray.200" borderRadius={8}>
|
|
43
|
-
<Flow
|
|
44
|
-
nodes={nodes}
|
|
45
|
-
edges={edges}
|
|
46
|
-
onNodesChange={setNodes}
|
|
47
|
-
onEdgesChange={setEdges}
|
|
48
|
-
/>
|
|
49
|
-
</View>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### **With Node Addition**
|
|
55
|
-
```tsx
|
|
56
|
-
import React, { useState } from 'react';
|
|
57
|
-
import { Flow } from '@app-studio/web';
|
|
58
|
-
import { View } from '@app-studio/web';
|
|
59
|
-
import { FlowNode } from '@app-studio/web';
|
|
60
|
-
|
|
61
|
-
export const FlowWithNodeAddition = () => {
|
|
62
|
-
const [nodes, setNodes] = useState([
|
|
63
|
-
{
|
|
64
|
-
id: 'node-1',
|
|
65
|
-
position: { x: 50, y: 50 },
|
|
66
|
-
data: { label: 'Start', subtitle: 'Begin workflow' },
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: 'node-2',
|
|
70
|
-
position: { x: 50, y: 200 },
|
|
71
|
-
data: { label: 'Process', subtitle: 'Do something' },
|
|
72
|
-
},
|
|
73
|
-
]);
|
|
74
|
-
|
|
75
|
-
const [edges, setEdges] = useState([
|
|
76
|
-
{ id: 'edge-1-2', source: 'node-1', target: 'node-2' },
|
|
77
|
-
]);
|
|
78
|
-
|
|
79
|
-
const [selectedNodeId, setSelectedNodeId] = useState(null);
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<View height="400px" border="1px solid" borderColor="color.gray.200" borderRadius={8}>
|
|
83
|
-
<Flow
|
|
84
|
-
nodes={nodes}
|
|
85
|
-
edges={edges}
|
|
86
|
-
onNodesChange={setNodes}
|
|
87
|
-
onEdgesChange={setEdges}
|
|
88
|
-
selectedNodeId={selectedNodeId}
|
|
89
|
-
onNodeSelect={setSelectedNodeId}
|
|
90
|
-
allowAddingNodes={true}
|
|
91
|
-
onNodeAdd={(newNode: FlowNode) => {
|
|
92
|
-
setNodes((prevNodes) => [...prevNodes, newNode]);
|
|
93
|
-
}}
|
|
94
|
-
/>
|
|
95
|
-
</View>
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### **With Drag and Drop**
|
|
101
|
-
```tsx
|
|
102
|
-
import React, { useState } from 'react';
|
|
103
|
-
import { Flow } from '@app-studio/web';
|
|
104
|
-
import { View } from '@app-studio/web';
|
|
105
|
-
import { FlowNode } from '@app-studio/web';
|
|
106
|
-
|
|
107
|
-
export const FlowWithDragAndDrop = () => {
|
|
108
|
-
const [nodes, setNodes] = useState([
|
|
109
|
-
{
|
|
110
|
-
id: 'node-1',
|
|
111
|
-
position: { x: 250, y: 100 },
|
|
112
|
-
data: { label: 'Menu Item 1', subtitle: 'Drag to reorder' },
|
|
113
|
-
draggable: true,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
id: 'node-2',
|
|
117
|
-
position: { x: 250, y: 250 },
|
|
118
|
-
data: { label: 'Menu Item 2', subtitle: 'Drag to reorder' },
|
|
119
|
-
draggable: true,
|
|
120
|
-
},
|
|
121
|
-
]);
|
|
122
|
-
|
|
123
|
-
const [edges, setEdges] = useState([]);
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<View height="400px" border="1px solid" borderColor="color.gray.200" borderRadius={8}>
|
|
127
|
-
<Flow
|
|
128
|
-
nodes={nodes}
|
|
129
|
-
edges={edges}
|
|
130
|
-
onNodesChange={setNodes}
|
|
131
|
-
onEdgesChange={setEdges}
|
|
132
|
-
allowDraggingNodes={true}
|
|
133
|
-
onNodeDragStart={(nodeId) => console.log(`Started dragging: ${nodeId}`)}
|
|
134
|
-
onNodeDragEnd={(nodeId, position) => console.log(`Finished dragging: ${nodeId}`)}
|
|
135
|
-
/>
|
|
136
|
-
</View>
|
|
137
|
-
);
|
|
138
|
-
};
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### **Props**
|
|
142
|
-
|
|
143
|
-
| Prop | Type | Default | Description |
|
|
144
|
-
| ---- | ---- | ------- | ----------- |
|
|
145
|
-
| nodes | FlowNode[] | [] | Array of nodes in the flow |
|
|
146
|
-
| edges | NodeConnection[] | [] | Array of edges/connections between nodes |
|
|
147
|
-
| size | 'sm' \| 'md' \| 'lg' | 'md' | Size of the flow nodes |
|
|
148
|
-
| variant | 'default' \| 'outline' \| 'filled' | 'default' | Visual variant of the flow nodes |
|
|
149
|
-
| direction | 'horizontal' \| 'vertical' | 'vertical' | Direction of the flow layout |
|
|
150
|
-
| showControls | boolean | true | Whether to show viewport controls (zoom in/out, reset) |
|
|
151
|
-
| allowAddingNodes | boolean | true | Whether to allow adding new nodes |
|
|
152
|
-
| allowDraggingNodes | boolean | true | Whether to allow dragging nodes |
|
|
153
|
-
| selectedNodeId | string | undefined | ID of the currently selected node |
|
|
154
|
-
| onNodeSelect | (nodeId: string \| null) => void | undefined | Callback when a node is selected |
|
|
155
|
-
| onNodesChange | (nodes: FlowNode[]) => void | undefined | Callback when nodes change |
|
|
156
|
-
| onEdgesChange | (edges: NodeConnection[]) => void | undefined | Callback when edges change |
|
|
157
|
-
| onNodeAdd | (node: FlowNode) => void | undefined | Callback when a node is added |
|
|
158
|
-
| onNodeDragStart | (nodeId: string) => void | undefined | Callback when node dragging starts |
|
|
159
|
-
| onNodeDrag | (nodeId: string, position: NodePosition) => void | undefined | Callback during node dragging |
|
|
160
|
-
| onNodeDragEnd | (nodeId: string, position: NodePosition) => void | undefined | Callback when node dragging ends |
|
|
161
|
-
| viewport | FlowViewport | { zoom: 1, x: 0, y: 0 } | Current viewport state (zoom level and position) |
|
|
162
|
-
| onViewportChange | (viewport: FlowViewport) => void | undefined | Callback when viewport changes |
|
|
163
|
-
| views | object | {} | Custom styling for different parts of the component |
|
|
164
|
-
|
|
165
|
-
### **Node Structure**
|
|
166
|
-
|
|
167
|
-
The `FlowNode` interface defines the structure of nodes in the Flow component:
|
|
168
|
-
|
|
169
|
-
```tsx
|
|
170
|
-
interface FlowNode {
|
|
171
|
-
id: string;
|
|
172
|
-
type?: 'default' | 'start' | 'end' | 'decision' | 'process' | string;
|
|
173
|
-
position: { x: number; y: number };
|
|
174
|
-
data?: {
|
|
175
|
-
label?: string;
|
|
176
|
-
subtitle?: string;
|
|
177
|
-
icon?: React.ReactNode;
|
|
178
|
-
number?: number;
|
|
179
|
-
[key: string]: any;
|
|
180
|
-
};
|
|
181
|
-
selected?: boolean;
|
|
182
|
-
isDragging?: boolean;
|
|
183
|
-
draggable?: boolean;
|
|
184
|
-
style?: ViewProps;
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### **Edge Structure**
|
|
189
|
-
|
|
190
|
-
The `NodeConnection` interface defines the structure of edges in the Flow component:
|
|
191
|
-
|
|
192
|
-
```tsx
|
|
193
|
-
interface NodeConnection {
|
|
194
|
-
id: string;
|
|
195
|
-
source: string;
|
|
196
|
-
target: string;
|
|
197
|
-
label?: string;
|
|
198
|
-
style?: ViewProps;
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
### **Compound Components**
|
|
203
|
-
|
|
204
|
-
The Flow component uses a compound component pattern with the following sub-components:
|
|
205
|
-
|
|
206
|
-
```tsx
|
|
207
|
-
// These are primarily for potential direct use or a more componentized future version
|
|
208
|
-
Flow.Node // Renders a single node
|
|
209
|
-
Flow.Edge // Renders a connection between nodes
|
|
210
|
-
Flow.Controls // Renders viewport controls
|
|
211
|
-
Flow.AddNodeButton // Renders a button to add a new node
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
### **Customization**
|
|
215
|
-
|
|
216
|
-
The Flow component can be customized using the `views` prop:
|
|
217
|
-
|
|
218
|
-
```tsx
|
|
219
|
-
<Flow
|
|
220
|
-
// ...other props
|
|
221
|
-
views={{
|
|
222
|
-
container: { /* styles for the main flow container */ },
|
|
223
|
-
node: {
|
|
224
|
-
container: { /* styles for the node's root View */ },
|
|
225
|
-
content: { /* styles for the content wrapper inside the node */ },
|
|
226
|
-
icon: { /* styles for the node's icon View */ },
|
|
227
|
-
},
|
|
228
|
-
edge: {
|
|
229
|
-
path: { /* styles for the SVG path */ },
|
|
230
|
-
label: { /* styles for the edge label */ },
|
|
231
|
-
},
|
|
232
|
-
controls: {
|
|
233
|
-
container: { /* styles for the controls container */ },
|
|
234
|
-
button: { /* styles for individual control buttons */ },
|
|
235
|
-
},
|
|
236
|
-
addNodeButton: { /* styles for the add node button */ },
|
|
237
|
-
}}
|
|
238
|
-
/>
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
### **Accessibility**
|
|
242
|
-
|
|
243
|
-
The Flow component implements the following accessibility features:
|
|
244
|
-
|
|
245
|
-
- Keyboard navigation for selecting nodes
|
|
246
|
-
- ARIA attributes for interactive elements
|
|
247
|
-
- Focus management for controls and nodes
|
|
248
|
-
- Proper contrast for node and edge colors
|
|
249
|
-
|
|
250
|
-
### **Best Practices**
|
|
251
|
-
|
|
252
|
-
- Provide clear labels and subtitles for nodes to improve understanding
|
|
253
|
-
- Use consistent node types and styling for similar functionality
|
|
254
|
-
- Implement proper error handling for node and edge operations
|
|
255
|
-
- Consider viewport size when determining initial node positions
|
|
256
|
-
- Use the `onNodeAdd` callback to validate new node positions
|
|
257
|
-
- Implement undo/redo functionality for node operations when needed
|
|
258
|
-
|