@principal-ai/principal-view-react 0.8.1 → 0.8.2
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/ConfigurationSelector.d.ts +1 -1
- package/dist/components/ConfigurationSelector.d.ts.map +1 -1
- package/dist/components/EdgeInfoPanel.d.ts +1 -1
- package/dist/components/EdgeInfoPanel.d.ts.map +1 -1
- package/dist/components/EdgeInfoPanel.js +77 -86
- package/dist/components/EdgeInfoPanel.js.map +1 -1
- package/dist/components/GraphRenderer.d.ts +1 -1
- package/dist/components/GraphRenderer.d.ts.map +1 -1
- package/dist/components/GraphRenderer.js +1 -1
- package/dist/components/GraphRenderer.js.map +1 -1
- package/dist/components/NodeInfoPanel.d.ts +1 -1
- package/dist/components/NodeInfoPanel.d.ts.map +1 -1
- package/dist/components/NodeInfoPanel.js +88 -67
- package/dist/components/NodeInfoPanel.js.map +1 -1
- package/dist/components/NodeTooltip.d.ts +1 -0
- package/dist/components/NodeTooltip.d.ts.map +1 -1
- package/dist/components/NodeTooltip.js +12 -2
- package/dist/components/NodeTooltip.js.map +1 -1
- package/dist/components/SelectionSidebar.d.ts +1 -1
- package/dist/components/SelectionSidebar.d.ts.map +1 -1
- package/dist/edges/CustomEdge.d.ts +1 -1
- package/dist/edges/CustomEdge.d.ts.map +1 -1
- package/dist/edges/GenericEdge.d.ts +1 -1
- package/dist/edges/GenericEdge.d.ts.map +1 -1
- package/dist/hooks/usePathBasedEvents.d.ts +1 -1
- package/dist/hooks/usePathBasedEvents.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/nodes/CustomNode.d.ts +1 -1
- package/dist/nodes/CustomNode.d.ts.map +1 -1
- package/dist/nodes/CustomNode.js +5 -4
- package/dist/nodes/CustomNode.js.map +1 -1
- package/dist/nodes/GenericNode.d.ts +1 -1
- package/dist/nodes/GenericNode.d.ts.map +1 -1
- package/dist/utils/animationMapping.d.ts +1 -1
- package/dist/utils/animationMapping.d.ts.map +1 -1
- package/dist/utils/graphConverter.d.ts +1 -1
- package/dist/utils/graphConverter.d.ts.map +1 -1
- package/dist/utils/orientationUtils.d.ts +1 -1
- package/dist/utils/orientationUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/ConfigurationSelector.tsx +1 -1
- package/src/components/EdgeInfoPanel.tsx +161 -167
- package/src/components/GraphRenderer.test.tsx +1 -1
- package/src/components/GraphRenderer.tsx +2 -2
- package/src/components/NodeInfoPanel.tsx +178 -139
- package/src/components/NodeTooltip.tsx +28 -0
- package/src/components/PendingChanges.test.tsx +1 -1
- package/src/components/SelectionSidebar.tsx +1 -1
- package/src/edges/CustomEdge.tsx +1 -1
- package/src/edges/GenericEdge.tsx +1 -1
- package/src/hooks/usePathBasedEvents.ts +1 -1
- package/src/index.ts +1 -1
- package/src/nodes/CustomNode.tsx +6 -2
- package/src/nodes/GenericNode.tsx +1 -1
- package/src/stories/AnimationWorkshop.stories.tsx +1 -1
- package/src/stories/CanvasEdgeTypes.stories.tsx +1 -1
- package/src/stories/CanvasNodeTypes.stories.tsx +1 -1
- package/src/stories/ColorPriority.stories.tsx +1 -1
- package/src/stories/EventDrivenAnimations.stories.tsx +1 -1
- package/src/stories/GraphOrientation.stories.tsx +2 -2
- package/src/stories/GraphRenderer.stories.tsx +253 -1
- package/src/stories/MultiConfig.stories.tsx +1 -1
- package/src/stories/MultiDirectionalConnections.stories.tsx +1 -1
- package/src/stories/NodeFieldsAudit.stories.tsx +1 -1
- package/src/stories/NodeShapes.stories.tsx +1 -1
- package/src/stories/OtelComponents.stories.tsx +1 -1
- package/src/stories/TraceViewer.stories.tsx +1 -1
- package/src/stories/data/graph-converter-test-execution.json +245 -27
- package/src/utils/animationMapping.ts +1 -1
- package/src/utils/graphConverter.ts +1 -1
- package/src/utils/orientationUtils.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animationMapping.d.ts","sourceRoot":"","sources":["../../src/utils/animationMapping.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"animationMapping.d.ts","sourceRoot":"","sources":["../../src/utils/animationMapping.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,eAAe,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,QAAQ,GAAG,aAAa,CAkCtE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,aAAa,CAiDpF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,aAAa,GAAG,aAAa,CAShG;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAE,QAAiB,GAAG,OAAO,CAMnF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,MAAa,GACzB,MAAM,CAIR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Node, type Edge } from '@xyflow/react';
|
|
2
|
-
import type { NodeState, EdgeState, GraphConfiguration, Violation } from '@principal-ai/principal-view-core
|
|
2
|
+
import type { NodeState, EdgeState, GraphConfiguration, Violation } from '@principal-ai/principal-view-core';
|
|
3
3
|
import type { CustomNodeData } from '../nodes/CustomNode';
|
|
4
4
|
import type { CustomEdgeData } from '../edges/CustomEdge';
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphConverter.d.ts","sourceRoot":"","sources":["../../src/utils/graphConverter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,SAAS,EACV,MAAM,
|
|
1
|
+
{"version":3,"file":"graphConverter.d.ts","sourceRoot":"","sources":["../../src/utils/graphConverter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,SAAS,EACV,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAAE,EAClB,aAAa,EAAE,kBAAkB,EACjC,UAAU,GAAE,SAAS,EAAO,GAC3B,IAAI,CAAC,cAAc,CAAC,EAAE,CAgCxB;AAED,yEAAyE;AACzE,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAmBD;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,CAAC,SAAS,GAAG,oBAAoB,CAAC,EAAE,EAC3C,aAAa,EAAE,kBAAkB,EACjC,UAAU,GAAE,SAAS,EAAO,GAC3B,IAAI,CAAC,cAAc,CAAC,EAAE,CAiDxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NodeState, EdgeState } from '@principal-ai/principal-view-core
|
|
1
|
+
import type { NodeState, EdgeState } from '@principal-ai/principal-view-core';
|
|
2
2
|
/**
|
|
3
3
|
* Swaps the orientation of a graph from horizontal to vertical or vice versa.
|
|
4
4
|
* This swaps x/y coordinates and adjusts edge connection sides accordingly.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orientationUtils.d.ts","sourceRoot":"","sources":["../../src/utils/orientationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"orientationUtils.d.ts","sourceRoot":"","sources":["../../src/utils/orientationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAc,MAAM,mCAAmC,CAAC;AAE1F;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAAE,EAClB,KAAK,EAAE,SAAS,EAAE,GACjB;IAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAAC,KAAK,EAAE,SAAS,EAAE,CAAA;CAAE,CAK5C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAQjE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAuB7D"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ConfigurationFile } from '@principal-ai/principal-view-core
|
|
2
|
+
import type { ConfigurationFile } from '@principal-ai/principal-view-core';
|
|
3
3
|
|
|
4
4
|
export interface ConfigurationSelectorProps {
|
|
5
5
|
/** Available configurations */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { EdgeState, EdgeTypeDefinition } from '@principal-ai/principal-view-core
|
|
2
|
+
import type { EdgeState, EdgeTypeDefinition } from '@principal-ai/principal-view-core';
|
|
3
3
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
4
4
|
|
|
5
5
|
export interface EdgeInfoPanelProps {
|
|
@@ -35,17 +35,17 @@ export const EdgeInfoPanel: React.FC<EdgeInfoPanelProps> = ({
|
|
|
35
35
|
<div
|
|
36
36
|
style={{
|
|
37
37
|
position: 'absolute',
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
bottom: 0,
|
|
39
|
+
left: 0,
|
|
40
|
+
right: 0,
|
|
40
41
|
backgroundColor: theme.colors.background,
|
|
41
42
|
color: theme.colors.text,
|
|
42
|
-
|
|
43
|
-
boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
|
|
44
|
-
padding: '16px',
|
|
45
|
-
minWidth: '250px',
|
|
46
|
-
maxWidth: '350px',
|
|
43
|
+
borderTop: `2px solid ${edgeColor}`,
|
|
44
|
+
boxShadow: '0 -4px 12px rgba(0,0,0,0.15)',
|
|
45
|
+
padding: '16px 24px',
|
|
47
46
|
zIndex: 1000,
|
|
48
|
-
|
|
47
|
+
maxHeight: '40%',
|
|
48
|
+
overflowY: 'auto',
|
|
49
49
|
}}
|
|
50
50
|
>
|
|
51
51
|
{/* Header */}
|
|
@@ -53,14 +53,17 @@ export const EdgeInfoPanel: React.FC<EdgeInfoPanelProps> = ({
|
|
|
53
53
|
style={{
|
|
54
54
|
display: 'flex',
|
|
55
55
|
justifyContent: 'space-between',
|
|
56
|
-
alignItems: '
|
|
57
|
-
marginBottom: '
|
|
58
|
-
paddingBottom: '8px',
|
|
59
|
-
borderBottom: `2px solid ${edgeColor}`,
|
|
56
|
+
alignItems: 'flex-start',
|
|
57
|
+
marginBottom: '16px',
|
|
60
58
|
}}
|
|
61
59
|
>
|
|
62
|
-
<div style={{
|
|
63
|
-
|
|
60
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '12px', flex: 1 }}>
|
|
61
|
+
<div style={{ fontWeight: theme.fontWeights.bold, fontSize: theme.fontSizes[2], fontFamily: theme.fonts.body, color: edgeColor }}>
|
|
62
|
+
Edge Information
|
|
63
|
+
</div>
|
|
64
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textMuted }}>
|
|
65
|
+
{edge.type}
|
|
66
|
+
</div>
|
|
64
67
|
</div>
|
|
65
68
|
<button
|
|
66
69
|
onClick={onClose}
|
|
@@ -71,183 +74,174 @@ export const EdgeInfoPanel: React.FC<EdgeInfoPanelProps> = ({
|
|
|
71
74
|
fontSize: theme.fontSizes[3],
|
|
72
75
|
fontFamily: theme.fonts.body,
|
|
73
76
|
color: theme.colors.textSecondary,
|
|
74
|
-
padding: '
|
|
75
|
-
width: '
|
|
76
|
-
height: '
|
|
77
|
+
padding: '4px',
|
|
78
|
+
width: '28px',
|
|
79
|
+
height: '28px',
|
|
77
80
|
display: 'flex',
|
|
78
81
|
alignItems: 'center',
|
|
79
82
|
justifyContent: 'center',
|
|
83
|
+
borderRadius: '4px',
|
|
84
|
+
transition: 'background-color 0.15s',
|
|
85
|
+
}}
|
|
86
|
+
onMouseEnter={(e) => {
|
|
87
|
+
e.currentTarget.style.backgroundColor = theme.colors.muted;
|
|
88
|
+
}}
|
|
89
|
+
onMouseLeave={(e) => {
|
|
90
|
+
e.currentTarget.style.backgroundColor = 'transparent';
|
|
80
91
|
}}
|
|
81
92
|
>
|
|
82
93
|
×
|
|
83
94
|
</button>
|
|
84
95
|
</div>
|
|
85
96
|
|
|
86
|
-
{/*
|
|
87
|
-
<div style={{
|
|
88
|
-
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textSecondary, marginBottom: '4px' }}>
|
|
89
|
-
Type
|
|
90
|
-
</div>
|
|
91
|
-
<div
|
|
92
|
-
style={{
|
|
93
|
-
fontSize: theme.fontSizes[0],
|
|
94
|
-
fontFamily: theme.fonts.body,
|
|
95
|
-
padding: '4px 8px',
|
|
96
|
-
backgroundColor: edgeColor,
|
|
97
|
-
color: theme.colors.background,
|
|
98
|
-
borderRadius: '4px',
|
|
99
|
-
display: 'inline-block',
|
|
100
|
-
}}
|
|
101
|
-
>
|
|
102
|
-
{edge.type}
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
97
|
+
{/* Content - use horizontal layout */}
|
|
98
|
+
<div style={{ display: 'flex', gap: '32px', alignItems: 'flex-start' }}>
|
|
105
99
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
100
|
+
{/* Left section - Connection Info */}
|
|
101
|
+
<div style={{ flex: 1 }}>
|
|
102
|
+
<div style={{ marginBottom: '12px' }}>
|
|
103
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textSecondary, marginBottom: '4px' }}>
|
|
104
|
+
Connection
|
|
105
|
+
</div>
|
|
106
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body }}>
|
|
107
|
+
<span
|
|
108
|
+
style={{
|
|
109
|
+
fontFamily: theme.fonts.monospace,
|
|
110
|
+
backgroundColor: theme.colors.muted,
|
|
111
|
+
padding: '2px 6px',
|
|
112
|
+
borderRadius: '3px',
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
{sourceNodeId}
|
|
116
|
+
</span>
|
|
117
|
+
<span style={{ margin: '0 8px', color: theme.colors.textMuted }}>→</span>
|
|
118
|
+
<span
|
|
119
|
+
style={{
|
|
120
|
+
fontFamily: theme.fonts.monospace,
|
|
121
|
+
backgroundColor: theme.colors.muted,
|
|
122
|
+
padding: '2px 6px',
|
|
123
|
+
borderRadius: '3px',
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
{targetNodeId}
|
|
127
|
+
</span>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
{/* Metadata */}
|
|
132
|
+
<div
|
|
124
133
|
style={{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
borderRadius: '3px',
|
|
134
|
+
fontSize: theme.fontSizes[0],
|
|
135
|
+
fontFamily: theme.fonts.body,
|
|
136
|
+
color: theme.colors.textMuted,
|
|
129
137
|
}}
|
|
130
138
|
>
|
|
131
|
-
{
|
|
132
|
-
</
|
|
139
|
+
ID: {edge.id}
|
|
140
|
+
</div>
|
|
133
141
|
</div>
|
|
134
|
-
</div>
|
|
135
142
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
</div>
|
|
141
|
-
<div style={{ display: 'flex', gap: '12px' }}>
|
|
142
|
-
<div style={{ flex: 1 }}>
|
|
143
|
-
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textMuted, marginBottom: '4px' }}>
|
|
144
|
-
From Side
|
|
145
|
-
</div>
|
|
146
|
-
<select
|
|
147
|
-
value={(edge.data?.fromSide as string) || 'right'}
|
|
148
|
-
onChange={(e) => {
|
|
149
|
-
if (onUpdateSides) {
|
|
150
|
-
onUpdateSides(edge.id, e.target.value, (edge.data?.toSide as string) || 'left');
|
|
151
|
-
}
|
|
152
|
-
}}
|
|
153
|
-
disabled={!onUpdateSides}
|
|
154
|
-
style={{
|
|
155
|
-
width: '100%',
|
|
156
|
-
padding: '6px 8px',
|
|
157
|
-
fontSize: theme.fontSizes[0],
|
|
158
|
-
fontFamily: theme.fonts.body,
|
|
159
|
-
borderRadius: '4px',
|
|
160
|
-
border: `1px solid ${theme.colors.border}`,
|
|
161
|
-
backgroundColor: theme.colors.background,
|
|
162
|
-
color: theme.colors.text,
|
|
163
|
-
cursor: onUpdateSides ? 'pointer' : 'not-allowed',
|
|
164
|
-
opacity: onUpdateSides ? 1 : 0.6,
|
|
165
|
-
}}
|
|
166
|
-
>
|
|
167
|
-
{SIDE_OPTIONS.map((side) => (
|
|
168
|
-
<option key={side} value={side}>
|
|
169
|
-
{side}
|
|
170
|
-
</option>
|
|
171
|
-
))}
|
|
172
|
-
</select>
|
|
143
|
+
{/* Center section - Connection Sides */}
|
|
144
|
+
<div style={{ flex: 1 }}>
|
|
145
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textSecondary, marginBottom: '8px' }}>
|
|
146
|
+
Connection Sides
|
|
173
147
|
</div>
|
|
174
|
-
<div style={{ flex:
|
|
175
|
-
<div style={{
|
|
176
|
-
|
|
148
|
+
<div style={{ display: 'flex', gap: '12px' }}>
|
|
149
|
+
<div style={{ flex: 1 }}>
|
|
150
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textMuted, marginBottom: '4px' }}>
|
|
151
|
+
From Side
|
|
152
|
+
</div>
|
|
153
|
+
<select
|
|
154
|
+
value={(edge.data?.fromSide as string) || 'right'}
|
|
155
|
+
onChange={(e) => {
|
|
156
|
+
if (onUpdateSides) {
|
|
157
|
+
onUpdateSides(edge.id, e.target.value, (edge.data?.toSide as string) || 'left');
|
|
158
|
+
}
|
|
159
|
+
}}
|
|
160
|
+
disabled={!onUpdateSides}
|
|
161
|
+
style={{
|
|
162
|
+
width: '100%',
|
|
163
|
+
padding: '6px 8px',
|
|
164
|
+
fontSize: theme.fontSizes[0],
|
|
165
|
+
fontFamily: theme.fonts.body,
|
|
166
|
+
borderRadius: '4px',
|
|
167
|
+
border: `1px solid ${theme.colors.border}`,
|
|
168
|
+
backgroundColor: theme.colors.background,
|
|
169
|
+
color: theme.colors.text,
|
|
170
|
+
cursor: onUpdateSides ? 'pointer' : 'not-allowed',
|
|
171
|
+
opacity: onUpdateSides ? 1 : 0.6,
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
{SIDE_OPTIONS.map((side) => (
|
|
175
|
+
<option key={side} value={side}>
|
|
176
|
+
{side}
|
|
177
|
+
</option>
|
|
178
|
+
))}
|
|
179
|
+
</select>
|
|
177
180
|
</div>
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
181
|
+
<div style={{ flex: 1 }}>
|
|
182
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textMuted, marginBottom: '4px' }}>
|
|
183
|
+
To Side
|
|
184
|
+
</div>
|
|
185
|
+
<select
|
|
186
|
+
value={(edge.data?.toSide as string) || 'left'}
|
|
187
|
+
onChange={(e) => {
|
|
188
|
+
if (onUpdateSides) {
|
|
189
|
+
onUpdateSides(
|
|
190
|
+
edge.id,
|
|
191
|
+
(edge.data?.fromSide as string) || 'right',
|
|
192
|
+
e.target.value
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
}}
|
|
196
|
+
disabled={!onUpdateSides}
|
|
197
|
+
style={{
|
|
198
|
+
width: '100%',
|
|
199
|
+
padding: '6px 8px',
|
|
200
|
+
fontSize: theme.fontSizes[0],
|
|
201
|
+
fontFamily: theme.fonts.body,
|
|
202
|
+
borderRadius: '4px',
|
|
203
|
+
border: `1px solid ${theme.colors.border}`,
|
|
204
|
+
backgroundColor: theme.colors.background,
|
|
205
|
+
color: theme.colors.text,
|
|
206
|
+
cursor: onUpdateSides ? 'pointer' : 'not-allowed',
|
|
207
|
+
opacity: onUpdateSides ? 1 : 0.6,
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
{SIDE_OPTIONS.map((side) => (
|
|
211
|
+
<option key={side} value={side}>
|
|
212
|
+
{side}
|
|
213
|
+
</option>
|
|
214
|
+
))}
|
|
215
|
+
</select>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
{/* Right section - Delete Button */}
|
|
221
|
+
{onDelete && (
|
|
222
|
+
<div style={{ display: 'flex', alignItems: 'flex-end' }}>
|
|
223
|
+
<button
|
|
224
|
+
onClick={() => {
|
|
225
|
+
onDelete(edge.id);
|
|
226
|
+
onClose();
|
|
188
227
|
}}
|
|
189
|
-
disabled={!onUpdateSides}
|
|
190
228
|
style={{
|
|
191
|
-
|
|
192
|
-
|
|
229
|
+
padding: '8px 16px',
|
|
230
|
+
backgroundColor: theme.colors.error,
|
|
231
|
+
color: theme.colors.background,
|
|
232
|
+
border: 'none',
|
|
233
|
+
borderRadius: '4px',
|
|
234
|
+
cursor: 'pointer',
|
|
193
235
|
fontSize: theme.fontSizes[0],
|
|
194
236
|
fontFamily: theme.fonts.body,
|
|
195
|
-
|
|
196
|
-
border: `1px solid ${theme.colors.border}`,
|
|
197
|
-
backgroundColor: theme.colors.background,
|
|
198
|
-
color: theme.colors.text,
|
|
199
|
-
cursor: onUpdateSides ? 'pointer' : 'not-allowed',
|
|
200
|
-
opacity: onUpdateSides ? 1 : 0.6,
|
|
237
|
+
fontWeight: theme.fontWeights.bold,
|
|
201
238
|
}}
|
|
202
239
|
>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
{side}
|
|
206
|
-
</option>
|
|
207
|
-
))}
|
|
208
|
-
</select>
|
|
240
|
+
Delete Edge
|
|
241
|
+
</button>
|
|
209
242
|
</div>
|
|
210
|
-
|
|
211
|
-
</div>
|
|
212
|
-
|
|
213
|
-
{/* Metadata */}
|
|
214
|
-
<div
|
|
215
|
-
style={{
|
|
216
|
-
fontSize: theme.fontSizes[0],
|
|
217
|
-
fontFamily: theme.fonts.body,
|
|
218
|
-
color: theme.colors.textMuted,
|
|
219
|
-
marginTop: '12px',
|
|
220
|
-
paddingTop: '8px',
|
|
221
|
-
borderTop: `1px solid ${theme.colors.border}`,
|
|
222
|
-
}}
|
|
223
|
-
>
|
|
224
|
-
ID: {edge.id}
|
|
243
|
+
)}
|
|
225
244
|
</div>
|
|
226
|
-
|
|
227
|
-
{/* Delete Button */}
|
|
228
|
-
{onDelete && (
|
|
229
|
-
<button
|
|
230
|
-
onClick={() => {
|
|
231
|
-
onDelete(edge.id);
|
|
232
|
-
onClose();
|
|
233
|
-
}}
|
|
234
|
-
style={{
|
|
235
|
-
marginTop: '12px',
|
|
236
|
-
width: '100%',
|
|
237
|
-
padding: '8px 12px',
|
|
238
|
-
backgroundColor: theme.colors.error,
|
|
239
|
-
color: theme.colors.background,
|
|
240
|
-
border: 'none',
|
|
241
|
-
borderRadius: '4px',
|
|
242
|
-
cursor: 'pointer',
|
|
243
|
-
fontSize: theme.fontSizes[0],
|
|
244
|
-
fontFamily: theme.fonts.body,
|
|
245
|
-
fontWeight: theme.fontWeights.bold,
|
|
246
|
-
}}
|
|
247
|
-
>
|
|
248
|
-
Delete Edge
|
|
249
|
-
</button>
|
|
250
|
-
)}
|
|
251
245
|
</div>
|
|
252
246
|
);
|
|
253
247
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { GraphRenderer } from './GraphRenderer';
|
|
4
|
-
import type { GraphConfiguration, NodeState, EdgeState } from '@principal-ai/principal-view-core
|
|
4
|
+
import type { GraphConfiguration, NodeState, EdgeState } from '@principal-ai/principal-view-core';
|
|
5
5
|
|
|
6
6
|
describe('GraphRenderer', () => {
|
|
7
7
|
const testConfig: GraphConfiguration = {
|
|
@@ -38,8 +38,8 @@ import type {
|
|
|
38
38
|
ExtendedCanvas,
|
|
39
39
|
ComponentLibrary,
|
|
40
40
|
JsonValue,
|
|
41
|
-
} from '@principal-ai/principal-view-core
|
|
42
|
-
import { CanvasConverter } from '@principal-ai/principal-view-core
|
|
41
|
+
} from '@principal-ai/principal-view-core';
|
|
42
|
+
import { CanvasConverter } from '@principal-ai/principal-view-core';
|
|
43
43
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
44
44
|
import { CustomNode } from '../nodes/CustomNode';
|
|
45
45
|
import type { CustomNodeData } from '../nodes/CustomNode';
|