@pega/cosmos-react-build 2.0.0-dev.9.2 → 2.0.0-rc.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.
Files changed (161) hide show
  1. package/lib/components/AppHeader/AppHeader.d.ts +4 -3
  2. package/lib/components/AppHeader/AppHeader.d.ts.map +1 -1
  3. package/lib/components/AppHeader/AppHeader.js +10 -18
  4. package/lib/components/AppHeader/AppHeader.js.map +1 -1
  5. package/lib/components/AppHeader/AppHeader.styles.d.ts +4 -3
  6. package/lib/components/AppHeader/AppHeader.styles.d.ts.map +1 -1
  7. package/lib/components/AppHeader/AppHeader.styles.js +35 -17
  8. package/lib/components/AppHeader/AppHeader.styles.js.map +1 -1
  9. package/lib/components/AppShell/AppShell.d.ts +4 -0
  10. package/lib/components/AppShell/AppShell.d.ts.map +1 -0
  11. package/lib/components/AppShell/AppShell.js +82 -0
  12. package/lib/components/AppShell/AppShell.js.map +1 -0
  13. package/lib/components/AppShell/AppShell.styles.d.ts +20 -0
  14. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -0
  15. package/lib/components/AppShell/AppShell.styles.js +329 -0
  16. package/lib/components/AppShell/AppShell.styles.js.map +1 -0
  17. package/lib/components/AppShell/AppShell.types.d.ts +43 -0
  18. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -0
  19. package/lib/components/AppShell/AppShell.types.js +2 -0
  20. package/lib/components/AppShell/AppShell.types.js.map +1 -0
  21. package/lib/components/AppShell/AppShellContext.d.ts +4 -0
  22. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -0
  23. package/lib/components/AppShell/AppShellContext.js +13 -0
  24. package/lib/components/AppShell/AppShellContext.js.map +1 -0
  25. package/lib/components/AppShell/index.d.ts +3 -0
  26. package/lib/components/AppShell/index.d.ts.map +1 -0
  27. package/lib/components/AppShell/index.js +2 -0
  28. package/lib/components/AppShell/index.js.map +1 -0
  29. package/lib/components/FlowModeller/FlowModeller.d.ts +21 -0
  30. package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -0
  31. package/lib/components/FlowModeller/FlowModeller.js +201 -0
  32. package/lib/components/FlowModeller/FlowModeller.js.map +1 -0
  33. package/lib/components/FlowModeller/Node/Node.types.d.ts +54 -0
  34. package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -0
  35. package/lib/components/FlowModeller/Node/Node.types.js +28 -0
  36. package/lib/components/FlowModeller/Node/Node.types.js.map +1 -0
  37. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +19 -0
  38. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -0
  39. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +128 -0
  40. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -0
  41. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +6 -0
  42. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -0
  43. package/lib/components/FlowModeller/Node/NodeTemplates.js +55 -0
  44. package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -0
  45. package/lib/components/FlowModeller/NodeLibrary.d.ts +12 -0
  46. package/lib/components/FlowModeller/NodeLibrary.d.ts.map +1 -0
  47. package/lib/components/FlowModeller/NodeLibrary.js +49 -0
  48. package/lib/components/FlowModeller/NodeLibrary.js.map +1 -0
  49. package/lib/components/FlowModeller/Renderer/AddNode.d.ts +10 -0
  50. package/lib/components/FlowModeller/Renderer/AddNode.d.ts.map +1 -0
  51. package/lib/components/FlowModeller/Renderer/AddNode.js +42 -0
  52. package/lib/components/FlowModeller/Renderer/AddNode.js.map +1 -0
  53. package/lib/components/FlowModeller/Renderer/Connector.d.ts +5 -0
  54. package/lib/components/FlowModeller/Renderer/Connector.d.ts.map +1 -0
  55. package/lib/components/FlowModeller/Renderer/Connector.js +50 -0
  56. package/lib/components/FlowModeller/Renderer/Connector.js.map +1 -0
  57. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.d.ts +12 -0
  58. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.d.ts.map +1 -0
  59. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.js +15 -0
  60. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.js.map +1 -0
  61. package/lib/components/FlowModeller/Renderer/Node.d.ts +5 -0
  62. package/lib/components/FlowModeller/Renderer/Node.d.ts.map +1 -0
  63. package/lib/components/FlowModeller/Renderer/Node.js +18 -0
  64. package/lib/components/FlowModeller/Renderer/Node.js.map +1 -0
  65. package/lib/components/FlowModeller/Renderer/NodesContainer.d.ts +8 -0
  66. package/lib/components/FlowModeller/Renderer/NodesContainer.d.ts.map +1 -0
  67. package/lib/components/FlowModeller/Renderer/NodesContainer.js +15 -0
  68. package/lib/components/FlowModeller/Renderer/NodesContainer.js.map +1 -0
  69. package/lib/components/FlowModeller/Renderer/Renderer.d.ts +5 -0
  70. package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +1 -0
  71. package/lib/components/FlowModeller/Renderer/Renderer.js +17 -0
  72. package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -0
  73. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +18 -0
  74. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +1 -0
  75. package/lib/components/FlowModeller/Renderer/Renderer.types.js +2 -0
  76. package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +1 -0
  77. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +51 -0
  78. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +1 -0
  79. package/lib/components/FlowModeller/Renderer/Utils/Graph.js +247 -0
  80. package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -0
  81. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +35 -0
  82. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +1 -0
  83. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +104 -0
  84. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +1 -0
  85. package/lib/components/FlowModeller/helper.d.ts +22 -0
  86. package/lib/components/FlowModeller/helper.d.ts.map +1 -0
  87. package/lib/components/FlowModeller/helper.js +97 -0
  88. package/lib/components/FlowModeller/helper.js.map +1 -0
  89. package/lib/components/FlowModeller/index.d.ts +3 -0
  90. package/lib/components/FlowModeller/index.d.ts.map +1 -0
  91. package/lib/components/FlowModeller/index.js +2 -0
  92. package/lib/components/FlowModeller/index.js.map +1 -0
  93. package/lib/components/LifeCycle/Category.d.ts +32 -0
  94. package/lib/components/LifeCycle/Category.d.ts.map +1 -0
  95. package/lib/components/LifeCycle/Category.js +98 -0
  96. package/lib/components/LifeCycle/Category.js.map +1 -0
  97. package/lib/components/LifeCycle/LifeCycle.d.ts +22 -0
  98. package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -0
  99. package/lib/components/LifeCycle/LifeCycle.js +73 -0
  100. package/lib/components/LifeCycle/LifeCycle.js.map +1 -0
  101. package/lib/components/LifeCycle/LifeCycle.types.d.ts +56 -0
  102. package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -0
  103. package/lib/components/LifeCycle/LifeCycle.types.js +2 -0
  104. package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -0
  105. package/lib/components/LifeCycle/LifeCycleList.d.ts +22 -0
  106. package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -0
  107. package/lib/components/LifeCycle/LifeCycleList.js +65 -0
  108. package/lib/components/LifeCycle/LifeCycleList.js.map +1 -0
  109. package/lib/components/LifeCycle/Stage.d.ts +49 -0
  110. package/lib/components/LifeCycle/Stage.d.ts.map +1 -0
  111. package/lib/components/LifeCycle/Stage.js +297 -0
  112. package/lib/components/LifeCycle/Stage.js.map +1 -0
  113. package/lib/components/LifeCycle/Step.d.ts +51 -0
  114. package/lib/components/LifeCycle/Step.d.ts.map +1 -0
  115. package/lib/components/LifeCycle/Step.js +241 -0
  116. package/lib/components/LifeCycle/Step.js.map +1 -0
  117. package/lib/components/LifeCycle/Task.d.ts +53 -0
  118. package/lib/components/LifeCycle/Task.d.ts.map +1 -0
  119. package/lib/components/LifeCycle/Task.js +188 -0
  120. package/lib/components/LifeCycle/Task.js.map +1 -0
  121. package/lib/components/LifeCycle/index.d.ts +4 -0
  122. package/lib/components/LifeCycle/index.d.ts.map +1 -0
  123. package/lib/components/LifeCycle/index.js +2 -0
  124. package/lib/components/LifeCycle/index.js.map +1 -0
  125. package/lib/components/PageTemplates/GalleryPage.d.ts +23 -0
  126. package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -0
  127. package/lib/components/PageTemplates/GalleryPage.js +23 -0
  128. package/lib/components/PageTemplates/GalleryPage.js.map +1 -0
  129. package/lib/components/PageTemplates/GalleryPage.styles.d.ts +9 -0
  130. package/lib/components/PageTemplates/GalleryPage.styles.d.ts.map +1 -0
  131. package/lib/components/PageTemplates/GalleryPage.styles.js +70 -0
  132. package/lib/components/PageTemplates/GalleryPage.styles.js.map +1 -0
  133. package/lib/components/PageTemplates/PageTemplates.d.ts +27 -0
  134. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -0
  135. package/lib/components/PageTemplates/PageTemplates.js +86 -0
  136. package/lib/components/PageTemplates/PageTemplates.js.map +1 -0
  137. package/lib/components/PageTemplates/index.d.ts +5 -0
  138. package/lib/components/PageTemplates/index.d.ts.map +1 -0
  139. package/lib/components/PageTemplates/index.js +4 -0
  140. package/lib/components/PageTemplates/index.js.map +1 -0
  141. package/lib/components/SummaryCard/SummaryCard.d.ts +16 -0
  142. package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -0
  143. package/lib/components/SummaryCard/SummaryCard.js +31 -0
  144. package/lib/components/SummaryCard/SummaryCard.js.map +1 -0
  145. package/lib/components/SummaryCard/index.d.ts +3 -0
  146. package/lib/components/SummaryCard/index.d.ts.map +1 -0
  147. package/lib/components/SummaryCard/index.js +3 -0
  148. package/lib/components/SummaryCard/index.js.map +1 -0
  149. package/lib/components/Visual/Visual.d.ts +17 -0
  150. package/lib/components/Visual/Visual.d.ts.map +1 -0
  151. package/lib/components/Visual/Visual.js +28 -0
  152. package/lib/components/Visual/Visual.js.map +1 -0
  153. package/lib/components/Visual/index.d.ts +3 -0
  154. package/lib/components/Visual/index.d.ts.map +1 -0
  155. package/lib/components/Visual/index.js +3 -0
  156. package/lib/components/Visual/index.js.map +1 -0
  157. package/lib/index.d.ts +9 -0
  158. package/lib/index.d.ts.map +1 -1
  159. package/lib/index.js +9 -0
  160. package/lib/index.js.map +1 -1
  161. package/package.json +15 -14
@@ -0,0 +1,201 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useReducer, useCallback } from 'react';
3
+ import { useElement, useOuterEvent } from '@pega/cosmos-react-core';
4
+ import { DirectedGraph } from './Renderer/Utils/Graph';
5
+ import { AddButton } from './Renderer/AddNode';
6
+ import FlowRenderer from './Renderer/Renderer';
7
+ import { StartNode, EndNode, DefaultNode } from './Node/NodeTemplates';
8
+ import { START_NODETYPE, STOP_NODETYPE } from './Node/Node.types';
9
+ import NodeLibrary from './NodeLibrary';
10
+ const initState = {
11
+ showLib: false,
12
+ activeAddBtnMeta: {
13
+ target: null,
14
+ meta: {
15
+ refType: 'node',
16
+ refId: ''
17
+ }
18
+ },
19
+ graphData: { nodes: [], connectors: [] }
20
+ };
21
+ const reducer = (state, action) => {
22
+ switch (action.type) {
23
+ case 'showLibrary':
24
+ // minor optimization, not to update state.. if no change in the value
25
+ return action.payload.show === state.showLib
26
+ ? state
27
+ : { ...state, showLib: action.payload.show };
28
+ case 'setActiveAddButton':
29
+ state.activeAddBtnMeta = {
30
+ ...action.payload
31
+ };
32
+ return {
33
+ ...state
34
+ };
35
+ case 'setGraphData':
36
+ return {
37
+ ...state,
38
+ graphData: action.payload
39
+ };
40
+ default:
41
+ return state;
42
+ }
43
+ };
44
+ const injectPlaceholderNodes = (graphData, onAddNode) => {
45
+ const targetGraph = new DirectedGraph(graphData);
46
+ // iterate all nodes with more than one in-connectors and insert addNode.
47
+ targetGraph.getNodes().forEach(node => {
48
+ if (targetGraph.getPrevNodesCount(node.id) > 1) {
49
+ const metaData = {
50
+ refType: 'node',
51
+ refId: node.id
52
+ };
53
+ // create a new placeholder node
54
+ const addShapeNode = {
55
+ id: `temp-${node.id}`,
56
+ children: (_jsx(AddButton, { addNodeHandler: (e) => {
57
+ onAddNode(e.target, metaData);
58
+ } }, void 0)),
59
+ position: { x: 0, y: 0 },
60
+ dimensions: { width: 20, height: 16 }
61
+ };
62
+ targetGraph.addNode(addShapeNode);
63
+ // connect all in-connectors to a new node and create a new connector that connects from new node to the actual toNodeId.
64
+ targetGraph.getInConnectors(node.id).forEach(con => {
65
+ con.toNodeId = addShapeNode.id;
66
+ });
67
+ const newConnector = {
68
+ id: `placeholder-${addShapeNode.id}-${node.id}`,
69
+ fromNodeId: addShapeNode.id,
70
+ toNodeId: node.id,
71
+ points: []
72
+ };
73
+ targetGraph.addConnector(newConnector);
74
+ }
75
+ });
76
+ // iterate all connectors and inject addNodes.
77
+ targetGraph.getConnectors().forEach((con) => {
78
+ // Condition to skip processing placeholder connectors created in the previous step
79
+ if (con.id.startsWith('placeholder-')) {
80
+ return;
81
+ }
82
+ const metaData = {
83
+ refType: 'connector',
84
+ refId: con.id
85
+ };
86
+ const addShapeNode = {
87
+ id: `temp-con-${con.id}`,
88
+ children: (_jsx(AddButton, { addNodeHandler: (e) => {
89
+ onAddNode(e.target, metaData);
90
+ } }, void 0)),
91
+ position: { x: 0, y: 0 },
92
+ dimensions: { width: 20, height: 16 }
93
+ };
94
+ targetGraph.addNode(addShapeNode);
95
+ const newConnector = {
96
+ id: `con-${con.id}`,
97
+ fromNodeId: addShapeNode.id,
98
+ toNodeId: con.toNodeId,
99
+ points: []
100
+ };
101
+ targetGraph.addConnector(newConnector);
102
+ con.toNodeId = addShapeNode.id;
103
+ });
104
+ return targetGraph.getGraphData();
105
+ };
106
+ const FlowModeller = ({ graphData, onNodeActionClick, onNodeClick, onNodeAdd, nodeLibrary, actions }) => {
107
+ const [state, dispatch] = useReducer(reducer, initState);
108
+ const [popoverEl, setPopoverEl] = useElement(null);
109
+ useEffect(() => {
110
+ const flowNodes = graphData.nodes.map(node => {
111
+ const flowNode = {
112
+ ...node,
113
+ children: _jsx(_Fragment, {}, void 0),
114
+ dimensions: {
115
+ width: 280,
116
+ height: 120
117
+ },
118
+ position: {
119
+ x: 0,
120
+ y: 0
121
+ }
122
+ };
123
+ if (node.type.id === START_NODETYPE.id) {
124
+ flowNode.dimensions.width = 50;
125
+ flowNode.dimensions.height = 50;
126
+ flowNode.children = (_jsx(StartNode, { id: node.id, type: node.type, label: node.label.toUpperCase() }, void 0));
127
+ }
128
+ else if (node.type.id === STOP_NODETYPE.id) {
129
+ flowNode.dimensions.width = 50;
130
+ flowNode.dimensions.height = 50;
131
+ flowNode.children = (_jsx(EndNode, { id: node.id, type: node.type, label: node.label.toUpperCase() }, void 0));
132
+ }
133
+ else {
134
+ flowNode.children = (_jsx(DefaultNode, { id: node.id, label: node.label, type: node.type, description: node.description, onActionClick: onNodeActionClick, onClick: onNodeClick, actions: actions, additionalData: node.additionalData }, void 0));
135
+ }
136
+ return flowNode;
137
+ });
138
+ const connectors = graphData.connectors.map(connector => {
139
+ return {
140
+ ...connector,
141
+ points: [],
142
+ data: {
143
+ label: connector.label
144
+ }
145
+ };
146
+ });
147
+ dispatch({
148
+ type: 'setGraphData',
149
+ payload: { nodes: flowNodes, connectors }
150
+ });
151
+ }, [graphData]);
152
+ /**
153
+ * Library popover functionality
154
+ */
155
+ const closeMenu = () => {
156
+ dispatch({
157
+ type: 'showLibrary',
158
+ payload: {
159
+ show: false
160
+ }
161
+ });
162
+ };
163
+ const onLibraryItemSelect = useCallback((libItem) => {
164
+ onNodeAdd(libItem.type, state.activeAddBtnMeta.meta);
165
+ closeMenu();
166
+ }, [state.activeAddBtnMeta] // TODO VERIFY whether this parameter helps or not
167
+ );
168
+ const onKeydown = useCallback((e) => {
169
+ if (e.key === 'Escape') {
170
+ closeMenu();
171
+ }
172
+ }, [closeMenu]);
173
+ useOuterEvent('mousedown', [popoverEl], closeMenu);
174
+ useEffect(() => {
175
+ document.addEventListener('keydown', onKeydown);
176
+ return () => {
177
+ document.removeEventListener('keydown', onKeydown);
178
+ };
179
+ }, []);
180
+ const items = nodeLibrary !== undefined ? nodeLibrary : [];
181
+ const onNodeCreate = (el, meta) => {
182
+ dispatch({
183
+ type: 'setActiveAddButton',
184
+ payload: {
185
+ target: el,
186
+ meta
187
+ }
188
+ });
189
+ // TODO try to merge both the above and below dispatches into one
190
+ dispatch({
191
+ type: 'showLibrary',
192
+ payload: {
193
+ show: true
194
+ }
195
+ });
196
+ };
197
+ const newGraphData = injectPlaceholderNodes(state.graphData, onNodeCreate);
198
+ return (_jsxs("div", { children: [_jsx(FlowRenderer, { graphData: newGraphData }, void 0), _jsx(NodeLibrary, { show: state.showLib, target: state.activeAddBtnMeta.target, items: items, onClick: onLibraryItemSelect, ref: setPopoverEl }, void 0)] }, void 0));
199
+ };
200
+ export default FlowModeller;
201
+ //# sourceMappingURL=FlowModeller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowModeller.js","sourceRoot":"","sources":["../../../src/components/FlowModeller/FlowModeller.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAmB,SAAS,EAAc,UAAU,EAAW,WAAW,EAAE,MAAM,OAAO,CAAC;AAEjG,OAAO,EAA0B,UAAU,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE5F,OAAO,EAAE,aAAa,EAA6B,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAM/C,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAIL,cAAc,EACd,aAAa,EAEd,MAAM,mBAAmB,CAAC;AAC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AAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChD,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAsB,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAE9E,MAAM,YAAY,GAAG,CAAC,EAAe,EAAE,IAA0B,EAAE,EAAE;QACnE,QAAQ,CAAC;YACP,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE;gBACP,MAAM,EAAE,EAAE;gBACV,IAAI;aACL;SACF,CAAC,CAAC;QAEH,iEAAiE;QACjE,QAAQ,CAAC;YACP,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE;gBACP,IAAI,EAAE,IAAI;aACX;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,YAAY,GAAyD,sBAAsB,CAC/F,KAAK,CAAC,SAAS,EACf,YAAY,CACb,CAAC;IAEF,OAAO,CACL,0BACE,KAAC,YAAY,IAAC,SAAS,EAAE,YAAY,WAAI,EACzC,KAAC,WAAW,IACV,IAAI,EAAE,KAAK,CAAC,OAAO,EACnB,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,EACrC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,mBAAmB,EAC5B,GAAG,EAAE,YAAY,WACjB,YACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { PropsWithoutRef, useEffect, MouseEvent, useReducer, Reducer, useCallback } from 'react';\n\nimport { Action, NoChildrenProp, useElement, useOuterEvent } from '@pega/cosmos-react-core';\n\nimport { DirectedGraph, GraphData, ConnectorProps } from './Renderer/Utils/Graph';\nimport { AddButton } from './Renderer/AddNode';\nimport {\n AddNodeHandlerParams,\n RendererConnectorProps,\n RendererNodeProps\n} from './Renderer/Renderer.types';\nimport FlowRenderer from './Renderer/Renderer';\nimport { StartNode, EndNode, DefaultNode } from './Node/NodeTemplates';\nimport {\n ActionParams,\n NodeProps,\n NodeLibraryItem,\n START_NODETYPE,\n STOP_NODETYPE,\n NodeType\n} from './Node/Node.types';\nimport NodeLibrary from './NodeLibrary';\n\nexport interface FlowModellerProps extends NoChildrenProp {\n graphData: GraphData<NodeProps, ConnectorProps>;\n /** Node actions */\n actions?: Action[];\n /** Callback to add node from connector */\n onNodeAdd: (nodeType: NodeType, params: AddNodeHandlerParams) => void;\n /** Callback for handling the click on the node */\n onNodeClick?: (nodeId: string) => void;\n /** Callback for actions on Node */\n onNodeActionClick?: (param: ActionParams, e: MouseEvent) => void;\n /** Types of nodes */\n nodeLibrary: NodeLibraryItem[];\n}\n\ntype ModellerState = {\n showLib: boolean;\n activeAddBtnMeta: {\n target: null; // we will maintain ref of an Element\n meta: AddNodeHandlerParams;\n };\n graphData: GraphData<RendererNodeProps, RendererConnectorProps>;\n};\n\nconst initState: ModellerState = {\n showLib: false,\n activeAddBtnMeta: {\n target: null,\n meta: {\n refType: 'node',\n refId: ''\n }\n },\n graphData: { nodes: [], connectors: [] }\n};\n\nconst reducer = (state: ModellerState, action: { type: string; payload: any }) => {\n switch (action.type) {\n case 'showLibrary':\n // minor optimization, not to update state.. if no change in the value\n return action.payload.show === state.showLib\n ? state\n : { ...state, showLib: action.payload.show };\n case 'setActiveAddButton':\n state.activeAddBtnMeta = {\n ...action.payload\n };\n return {\n ...state\n };\n case 'setGraphData':\n return {\n ...state,\n graphData: action.payload\n };\n default:\n return state;\n }\n};\n\ninterface AddNodeProps extends RendererNodeProps {\n onClick?: (ev: Event) => void;\n}\n\nconst injectPlaceholderNodes: (\n graphData: GraphData<RendererNodeProps, RendererConnectorProps>,\n onAddNode: (el: HTMLElement, meta: AddNodeHandlerParams) => void\n) => GraphData<RendererNodeProps, RendererConnectorProps> = (graphData, onAddNode) => {\n const targetGraph = new DirectedGraph(graphData);\n\n // iterate all nodes with more than one in-connectors and insert addNode.\n targetGraph.getNodes().forEach(node => {\n if (targetGraph.getPrevNodesCount(node.id) > 1) {\n const metaData: AddNodeHandlerParams = {\n refType: 'node',\n refId: node.id\n };\n\n // create a new placeholder node\n const addShapeNode: AddNodeProps = {\n id: `temp-${node.id}`,\n children: (\n <AddButton\n addNodeHandler={(e: MouseEvent<HTMLButtonElement>) => {\n onAddNode(e.target as HTMLElement, metaData);\n }}\n />\n ),\n position: { x: 0, y: 0 },\n dimensions: { width: 20, height: 16 }\n };\n\n targetGraph.addNode(addShapeNode);\n\n // connect all in-connectors to a new node and create a new connector that connects from new node to the actual toNodeId.\n targetGraph.getInConnectors(node.id).forEach(con => {\n con.toNodeId = addShapeNode.id;\n });\n\n const newConnector: RendererConnectorProps = {\n id: `placeholder-${addShapeNode.id}-${node.id}`,\n fromNodeId: addShapeNode.id,\n toNodeId: node.id,\n points: []\n };\n\n targetGraph.addConnector(newConnector);\n }\n });\n\n // iterate all connectors and inject addNodes.\n targetGraph.getConnectors().forEach((con: RendererConnectorProps) => {\n // Condition to skip processing placeholder connectors created in the previous step\n if (con.id.startsWith('placeholder-')) {\n return;\n }\n\n const metaData: AddNodeHandlerParams = {\n refType: 'connector',\n refId: con.id\n };\n\n const addShapeNode: AddNodeProps = {\n id: `temp-con-${con.id}`,\n children: (\n <AddButton\n addNodeHandler={(e: MouseEvent<HTMLButtonElement>) => {\n onAddNode(e.target as HTMLElement, metaData);\n }}\n />\n ),\n position: { x: 0, y: 0 },\n dimensions: { width: 20, height: 16 }\n };\n\n targetGraph.addNode(addShapeNode);\n\n const newConnector: RendererConnectorProps = {\n id: `con-${con.id}`,\n fromNodeId: addShapeNode.id,\n toNodeId: con.toNodeId,\n points: []\n };\n\n targetGraph.addConnector(newConnector);\n con.toNodeId = addShapeNode.id;\n });\n\n return targetGraph.getGraphData();\n};\n\nconst FlowModeller = ({\n graphData,\n onNodeActionClick,\n onNodeClick,\n onNodeAdd,\n nodeLibrary,\n actions\n}: PropsWithoutRef<FlowModellerProps>) => {\n const [state, dispatch] = useReducer<Reducer<ModellerState, any>>(reducer, initState);\n\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n\n useEffect(() => {\n const flowNodes: RendererNodeProps[] = graphData.nodes.map(node => {\n const flowNode: RendererNodeProps = {\n ...node,\n children: <></>,\n dimensions: {\n width: 280,\n height: 120\n },\n position: {\n x: 0,\n y: 0\n }\n };\n\n if (node.type.id === START_NODETYPE.id) {\n flowNode.dimensions.width = 50;\n flowNode.dimensions.height = 50;\n\n flowNode.children = (\n <StartNode id={node.id} type={node.type} label={node.label.toUpperCase()} />\n );\n } else if (node.type.id === STOP_NODETYPE.id) {\n flowNode.dimensions.width = 50;\n flowNode.dimensions.height = 50;\n\n flowNode.children = (\n <EndNode id={node.id} type={node.type} label={node.label.toUpperCase()} />\n );\n } else {\n flowNode.children = (\n <DefaultNode\n id={node.id}\n label={node.label}\n type={node.type}\n description={node.description}\n onActionClick={onNodeActionClick}\n onClick={onNodeClick}\n actions={actions}\n additionalData={node.additionalData}\n />\n );\n }\n\n return flowNode;\n });\n\n const connectors: RendererConnectorProps[] = graphData.connectors.map(connector => {\n return {\n ...connector,\n points: [],\n data: {\n label: connector.label\n }\n };\n });\n\n dispatch({\n type: 'setGraphData',\n payload: { nodes: flowNodes, connectors }\n });\n }, [graphData]);\n\n /**\n * Library popover functionality\n */\n const closeMenu = () => {\n dispatch({\n type: 'showLibrary',\n payload: {\n show: false\n }\n });\n };\n\n const onLibraryItemSelect = useCallback(\n (libItem: NodeLibraryItem) => {\n onNodeAdd(libItem.type, state.activeAddBtnMeta.meta);\n\n closeMenu();\n },\n [state.activeAddBtnMeta] // TODO VERIFY whether this parameter helps or not\n );\n\n const onKeydown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n closeMenu();\n }\n },\n [closeMenu]\n );\n\n useOuterEvent('mousedown', [popoverEl], closeMenu);\n\n useEffect(() => {\n document.addEventListener('keydown', onKeydown);\n return () => {\n document.removeEventListener('keydown', onKeydown);\n };\n }, []);\n\n const items: NodeLibraryItem[] = nodeLibrary !== undefined ? nodeLibrary : [];\n\n const onNodeCreate = (el: HTMLElement, meta: AddNodeHandlerParams) => {\n dispatch({\n type: 'setActiveAddButton',\n payload: {\n target: el,\n meta\n }\n });\n\n // TODO try to merge both the above and below dispatches into one\n dispatch({\n type: 'showLibrary',\n payload: {\n show: true\n }\n });\n };\n\n const newGraphData: GraphData<RendererNodeProps, RendererConnectorProps> = injectPlaceholderNodes(\n state.graphData,\n onNodeCreate\n );\n\n return (\n <div>\n <FlowRenderer graphData={newGraphData} />\n <NodeLibrary\n show={state.showLib}\n target={state.activeAddBtnMeta.target}\n items={items}\n onClick={onLibraryItemSelect}\n ref={setPopoverEl}\n />\n </div>\n );\n};\n\nexport default FlowModeller;\n"]}
@@ -0,0 +1,54 @@
1
+ import { Ref, MouseEvent } from 'react';
2
+ import { Action, MenuItemProps, OmitStrict } from '@pega/cosmos-react-core';
3
+ import { Node } from '../Renderer/Utils/Graph';
4
+ export interface NodeType {
5
+ id: string;
6
+ name: string;
7
+ color: string;
8
+ icon: string;
9
+ minConnectors: number;
10
+ defaults: {
11
+ node: OmitStrict<NodeProps, 'type' | 'id'>;
12
+ connector: {
13
+ label: string;
14
+ }[];
15
+ };
16
+ }
17
+ export interface NodeProps extends Node {
18
+ /** Unique id for Node */
19
+ id: string;
20
+ /** Label for Node */
21
+ label: string;
22
+ /** Description for Node */
23
+ description?: string;
24
+ /** Additional data for Node */
25
+ additionalData?: AdditionalDataItemProps[];
26
+ type: NodeType;
27
+ }
28
+ export interface NodeComponentProps extends NodeProps {
29
+ /** Callback for the node actions click */
30
+ onActionClick?: (params: ActionParams, e: MouseEvent) => void;
31
+ /** Callback for the node click */
32
+ onClick?: (nodeId: NodeProps['id']) => void;
33
+ /** Actions for the node click */
34
+ actions?: Action[];
35
+ /** Ref of the node */
36
+ ref?: Ref<HTMLElement>;
37
+ }
38
+ export interface AdditionalDataItemProps {
39
+ id: string;
40
+ label: string;
41
+ value: string;
42
+ }
43
+ export interface ActionParams {
44
+ actionId: string;
45
+ nodeId: NodeProps['id'];
46
+ }
47
+ export interface NodeLibraryItem extends MenuItemProps {
48
+ id: string;
49
+ type: NodeType;
50
+ items?: NodeLibraryItem[];
51
+ }
52
+ export declare const START_NODETYPE: NodeType;
53
+ export declare const STOP_NODETYPE: NodeType;
54
+ //# sourceMappingURL=Node.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Node.types.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/Node.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAmB,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE/C,MAAM,WAAW,QAAQ;IAEvB,EAAE,EAAE,MAAM,CAAC;IAEX,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,MAAM,CAAC;IAEb,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;QAC3C,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC;SACf,EAAE,CAAC;KACL,CAAC;CACH;AAED,MAAM,WAAW,SAAU,SAAQ,IAAI;IACrC,yBAAyB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAE3C,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,0CAA0C;IAC1C,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9D,kCAAkC;IAClC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAC5C,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,sBAAsB;IACtB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,EAAE,QAY3B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,QAY1B,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { themeDefinition } from '@pega/cosmos-react-core';
2
+ export const START_NODETYPE = Object.freeze({
3
+ id: 'start',
4
+ name: 'start',
5
+ color: themeDefinition.base.colors.green.medium.$value,
6
+ icon: 'circle',
7
+ minConnectors: 1,
8
+ defaults: {
9
+ node: {
10
+ label: 'Start'
11
+ },
12
+ connector: []
13
+ }
14
+ });
15
+ export const STOP_NODETYPE = Object.freeze({
16
+ id: 'stop',
17
+ name: 'stop',
18
+ color: themeDefinition.base.colors.red.light.$value,
19
+ icon: 'circle',
20
+ minConnectors: 0,
21
+ defaults: {
22
+ node: {
23
+ label: 'Stop'
24
+ },
25
+ connector: []
26
+ }
27
+ });
28
+ //# sourceMappingURL=Node.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Node.types.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/Node.types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqC,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA+D7F,MAAM,CAAC,MAAM,cAAc,GAAa,MAAM,CAAC,MAAM,CAAC;IACpD,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;IACtD,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,CAAC;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,KAAK,EAAE,OAAO;SACf;QACD,SAAS,EAAE,EAAE;KACd;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAa,MAAM,CAAC,MAAM,CAAC;IACnD,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM;IACnD,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,CAAC;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;SACd;QACD,SAAS,EAAE,EAAE;KACd;CACF,CAAC,CAAC","sourcesContent":["import { Ref, MouseEvent } from 'react';\n\nimport { Action, MenuItemProps, OmitStrict, themeDefinition } from '@pega/cosmos-react-core';\n\nimport { Node } from '../Renderer/Utils/Graph';\n\nexport interface NodeType {\n /* node type id. this must be unique */\n id: string;\n /* human readable name of the type */\n name: string;\n /* color that represents the type */\n color: string;\n /* icon that represents the type */\n icon: string;\n /* min no. of connectors */\n minConnectors: number;\n defaults: {\n node: OmitStrict<NodeProps, 'type' | 'id'>;\n connector: {\n label: string;\n }[];\n };\n}\n\nexport interface NodeProps extends Node {\n /** Unique id for Node */\n id: string;\n /** Label for Node */\n label: string;\n /** Description for Node */\n description?: string;\n /** Additional data for Node */\n additionalData?: AdditionalDataItemProps[];\n /* type of the Node */\n type: NodeType;\n}\n\nexport interface NodeComponentProps extends NodeProps {\n /** Callback for the node actions click */\n onActionClick?: (params: ActionParams, e: MouseEvent) => void;\n /** Callback for the node click */\n onClick?: (nodeId: NodeProps['id']) => void;\n /** Actions for the node click */\n actions?: Action[];\n /** Ref of the node */\n ref?: Ref<HTMLElement>;\n}\n\nexport interface AdditionalDataItemProps {\n id: string;\n label: string;\n value: string;\n}\nexport interface ActionParams {\n actionId: string;\n nodeId: NodeProps['id'];\n}\n\nexport interface NodeLibraryItem extends MenuItemProps {\n id: string;\n type: NodeType;\n items?: NodeLibraryItem[];\n}\n\nexport const START_NODETYPE: NodeType = Object.freeze({\n id: 'start',\n name: 'start',\n color: themeDefinition.base.colors.green.medium.$value,\n icon: 'circle',\n minConnectors: 1,\n defaults: {\n node: {\n label: 'Start'\n },\n connector: []\n }\n});\n\nexport const STOP_NODETYPE: NodeType = Object.freeze({\n id: 'stop',\n name: 'stop',\n color: themeDefinition.base.colors.red.light.$value,\n icon: 'circle',\n minConnectors: 0,\n defaults: {\n node: {\n label: 'Stop'\n },\n connector: []\n }\n});\n"]}
@@ -0,0 +1,19 @@
1
+ import { NodeType } from './Node.types';
2
+ export declare const StyledCircle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
3
+ color: NodeType['color'];
4
+ }, never>;
5
+ export declare const StyledLabel: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").LabelProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {
6
+ type: NodeType;
7
+ }, never>;
8
+ export declare const StyledIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
9
+ color: string;
10
+ }, never>;
11
+ export declare const StyledCardHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {}, never>;
12
+ export declare const StyledText: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
13
+ export declare const StyledCard: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
14
+ export declare const StyledCardFooter: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardFooterProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
15
+ export declare const StyledCardContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
16
+ export declare const StyledAdditionalData: import("styled-components").StyledComponent<"dl", import("styled-components").DefaultTheme, {}, never>;
17
+ export declare const StyledAdditionalDataItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
18
+ export declare const StyledTextWithEllipsis: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
19
+ //# sourceMappingURL=NodeTemplate.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeTemplate.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplate.styles.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,YAAY;WAAuB,QAAQ,CAAC,OAAO,CAAC;SAY/D,CAAC;AAIH,eAAO,MAAM,WAAW;UAAyB,QAAQ;SAWvD,CAAC;AAIH,eAAO,MAAM,UAAU;WAAuB,MAAM;SAalD,CAAC;AAIH,eAAO,MAAM,gBAAgB,4GAQ3B,CAAC;AAIH,eAAO,MAAM,UAAU,mOAOrB,CAAC;AAIH,eAAO,MAAM,UAAU,mOAoBrB,CAAC;AAEH,eAAO,MAAM,gBAAgB,yOAO3B,CAAC;AAIH,eAAO,MAAM,iBAAiB,yGAW5B,CAAC;AAIH,eAAO,MAAM,oBAAoB,wGAEhC,CAAC;AAEF,eAAO,MAAM,wBAAwB,yGAMnC,CAAC;AAGH,eAAO,MAAM,sBAAsB,mOAQjC,CAAC"}
@@ -0,0 +1,128 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { readableColor } from 'polished';
3
+ import { Label, defaultThemeProp, Card, Text, CardFooter } from '@pega/cosmos-react-core';
4
+ export const StyledCircle = styled.div(({ theme, color }) => {
5
+ return css `
6
+ height: 2rem;
7
+ width: 2rem;
8
+ background: ${color};
9
+ border-radius: 50%;
10
+ align-self: center;
11
+ &:focus {
12
+ outline: none;
13
+ box-shadow: ${theme.base.shadow.focus};
14
+ }
15
+ `;
16
+ });
17
+ StyledCircle.defaultProps = defaultThemeProp;
18
+ export const StyledLabel = styled(Label)(({ type, theme }) => {
19
+ return css `
20
+ align-self: center;
21
+ ${type.name === 'start'
22
+ ? css `
23
+ padding-block-end: ${theme.base.spacing};
24
+ `
25
+ : css `
26
+ padding-block-start: ${theme.base.spacing};
27
+ `}
28
+ `;
29
+ });
30
+ StyledLabel.defaultProps = defaultThemeProp;
31
+ export const StyledIcon = styled.div(({ theme, color }) => {
32
+ const contrastColor = readableColor(color);
33
+ return css `
34
+ min-height: 2rem;
35
+ min-width: 2rem;
36
+ background: ${color};
37
+ padding: calc(0.5 * ${theme.base.spacing});
38
+ margin-inline-end: ${theme.base.spacing};
39
+ text-align: center;
40
+ color: ${contrastColor};
41
+ border-radius: ${theme.base['border-radius']};
42
+ `;
43
+ });
44
+ StyledIcon.defaultProps = defaultThemeProp;
45
+ export const StyledCardHeader = styled.header(({ theme }) => {
46
+ return css `
47
+ white-space: nowrap;
48
+ button {
49
+ visibility: hidden;
50
+ border-radius: ${theme.base['border-radius']};
51
+ }
52
+ `;
53
+ });
54
+ StyledCardHeader.defaultProps = defaultThemeProp;
55
+ export const StyledText = styled(Text)(({ theme }) => {
56
+ return css `
57
+ padding-inline-end: ${theme.base.spacing};
58
+ overflow: hidden;
59
+ min-width: 12rem;
60
+ text-overflow: ellipsis;
61
+ `;
62
+ });
63
+ StyledText.defaultProps = defaultThemeProp;
64
+ export const StyledCard = styled(Card)(({ theme }) => {
65
+ return css `
66
+ width: 17.5rem;
67
+ height: 7.5rem;
68
+ align-self: center;
69
+ overflow: hidden;
70
+ &&& {
71
+ border-radius: ${theme.base['border-radius']};
72
+ }
73
+ &:focus-within,
74
+ &:hover {
75
+ box-shadow: ${theme.base.shadow.focus};
76
+ cursor: pointer;
77
+ ${StyledCardHeader} {
78
+ button {
79
+ visibility: visible;
80
+ }
81
+ }
82
+ }
83
+ `;
84
+ });
85
+ export const StyledCardFooter = styled(CardFooter)(() => {
86
+ return css `
87
+ margin-top: auto;
88
+ &:not(${StyledCard} ${StyledCard} > &) {
89
+ padding: 0.5rem;
90
+ }
91
+ `;
92
+ });
93
+ StyledCard.defaultProps = defaultThemeProp;
94
+ export const StyledCardContent = styled.div(({ theme }) => {
95
+ return css `
96
+ padding: ${theme.base.spacing};
97
+ padding-block-start: 0;
98
+ max-height: 2.5rem;
99
+ display: -webkit-box;
100
+ -webkit-line-clamp: 2;
101
+ -webkit-box-orient: vertical;
102
+ overflow: hidden;
103
+ text-overflow: ellipsis;
104
+ `;
105
+ });
106
+ StyledCardContent.defaultProps = defaultThemeProp;
107
+ export const StyledAdditionalData = styled.dl `
108
+ overflow: hidden;
109
+ `;
110
+ export const StyledAdditionalDataItem = styled.div(({ theme }) => {
111
+ return css `
112
+ padding: 0 calc(0.5 * ${theme.base.spacing});
113
+ background-color: ${theme.base.palette['secondary-background']};
114
+ border-radius: ${theme.base['border-radius']};
115
+ `;
116
+ });
117
+ StyledAdditionalDataItem.defaultProps = defaultThemeProp;
118
+ export const StyledTextWithEllipsis = styled(Text)(() => {
119
+ return css `
120
+ overflow: hidden;
121
+ width: auto;
122
+ display: inline-block;
123
+ white-space: nowrap;
124
+ text-overflow: ellipsis;
125
+ `;
126
+ });
127
+ StyledTextWithEllipsis.defaultProps = defaultThemeProp;
128
+ //# sourceMappingURL=NodeTemplate.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeTemplate.styles.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplate.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1F,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAA+B,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IACxF,OAAO,GAAG,CAAA;;;kBAGM,KAAK;;;;;oBAKH,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;GAExC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,YAAY,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE7C,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAqB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/E,OAAO,GAAG,CAAA;;MAEN,IAAI,CAAC,IAAI,KAAK,OAAO;QACrB,CAAC,CAAC,GAAG,CAAA;+BACoB,KAAK,CAAC,IAAI,CAAC,OAAO;SACxC;QACH,CAAC,CAAC,GAAG,CAAA;iCACsB,KAAK,CAAC,IAAI,CAAC,OAAO;SAC1C;GACN,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAW,CAAC,YA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C,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE;IACtD,OAAO,GAAG,CAAA;;YAEA,UAAU,IAAI,UAAU;;;GAGjC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,OAAO,GAAG,CAAA;eACG,KAAK,CAAC,IAAI,CAAC,OAAO;;;;;;;;GAQ9B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,EAAE,CAAA;;CAE5C,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/D,OAAO,GAAG,CAAA;4BACgB,KAAK,CAAC,IAAI,CAAC,OAAO;wBACtB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC;qBAC7C,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;GAC7C,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE;IACtD,OAAO,GAAG,CAAA;;;;;;GAMT,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport { Label, defaultThemeProp, Card, Text, CardFooter } from '@pega/cosmos-react-core';\n\nimport { NodeType } from './Node.types';\n\nexport const StyledCircle = styled.div<{ color: NodeType['color'] }>(({ theme, color }) => {\n return css`\n height: 2rem;\n width: 2rem;\n background: ${color};\n border-radius: 50%;\n align-self: center;\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledCircle.defaultProps = defaultThemeProp;\n\nexport const StyledLabel = styled(Label)<{ type: NodeType }>(({ type, theme }) => {\n return css`\n align-self: center;\n ${type.name === 'start'\n ? css`\n padding-block-end: ${theme.base.spacing};\n `\n : css`\n padding-block-start: ${theme.base.spacing};\n `}\n `;\n});\n\nStyledLabel.defaultProps = defaultThemeProp;\n\nexport const StyledIcon = styled.div<{ color: string }>(({ theme, color }) => {\n const contrastColor = readableColor(color);\n\n return css`\n min-height: 2rem;\n min-width: 2rem;\n background: ${color};\n padding: calc(0.5 * ${theme.base.spacing});\n margin-inline-end: ${theme.base.spacing};\n text-align: center;\n color: ${contrastColor};\n border-radius: ${theme.base['border-radius']};\n `;\n});\n\nStyledIcon.defaultProps = defaultThemeProp;\n\nexport const StyledCardHeader = styled.header(({ theme }) => {\n return css`\n white-space: nowrap;\n button {\n visibility: hidden;\n border-radius: ${theme.base['border-radius']};\n }\n `;\n});\n\nStyledCardHeader.defaultProps = defaultThemeProp;\n\nexport const StyledText = styled(Text)(({ theme }) => {\n return css`\n padding-inline-end: ${theme.base.spacing};\n overflow: hidden;\n min-width: 12rem;\n text-overflow: ellipsis;\n `;\n});\n\nStyledText.defaultProps = defaultThemeProp;\n\nexport const StyledCard = styled(Card)(({ theme }) => {\n return css`\n width: 17.5rem;\n height: 7.5rem;\n align-self: center;\n overflow: hidden;\n &&& {\n border-radius: ${theme.base['border-radius']};\n }\n &:focus-within,\n &:hover {\n box-shadow: ${theme.base.shadow.focus};\n cursor: pointer;\n ${StyledCardHeader} {\n button {\n visibility: visible;\n }\n }\n }\n `;\n});\n\nexport const StyledCardFooter = styled(CardFooter)(() => {\n return css`\n margin-top: auto;\n &:not(${StyledCard} ${StyledCard} > &) {\n padding: 0.5rem;\n }\n `;\n});\n\nStyledCard.defaultProps = defaultThemeProp;\n\nexport const StyledCardContent = styled.div(({ theme }) => {\n return css`\n padding: ${theme.base.spacing};\n padding-block-start: 0;\n max-height: 2.5rem;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n});\n\nStyledCardContent.defaultProps = defaultThemeProp;\n\nexport const StyledAdditionalData = styled.dl`\n overflow: hidden;\n`;\n\nexport const StyledAdditionalDataItem = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n background-color: ${theme.base.palette['secondary-background']};\n border-radius: ${theme.base['border-radius']};\n `;\n});\nStyledAdditionalDataItem.defaultProps = defaultThemeProp;\n\nexport const StyledTextWithEllipsis = styled(Text)(() => {\n return css`\n overflow: hidden;\n width: auto;\n display: inline-block;\n white-space: nowrap;\n text-overflow: ellipsis;\n `;\n});\nStyledTextWithEllipsis.defaultProps = defaultThemeProp;\n"]}
@@ -0,0 +1,6 @@
1
+ import { PropsWithoutRef } from 'react';
2
+ import { NodeProps, NodeComponentProps } from './Node.types';
3
+ export declare const DefaultNode: import("react").ForwardRefExoticComponent<Pick<NodeComponentProps, "description" | "data" | "label" | "id" | "type" | "onClick" | "actions" | "additionalData" | "onActionClick"> & import("react").RefAttributes<HTMLElement>>;
4
+ export declare const StartNode: ({ type, label }: PropsWithoutRef<NodeProps>) => JSX.Element;
5
+ export declare const EndNode: ({ type, label }: PropsWithoutRef<NodeProps>) => JSX.Element;
6
+ //# sourceMappingURL=NodeTemplates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeTemplates.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA0D,MAAM,OAAO,CAAC;AA0BhG,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAA2B,MAAM,cAAc,CAAC;AA8DtF,eAAO,MAAM,WAAW,iOA8FvB,CAAC;AAEF,eAAO,MAAM,SAAS,oBAAqB,gBAAgB,SAAS,CAAC,gBASpE,CAAC;AAEF,eAAO,MAAM,OAAO,oBAAqB,gBAAgB,SAAS,CAAC,gBASlE,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useCallback, forwardRef } from 'react';
3
+ import { MenuButton, Icon, Flex, Tooltip, useElement, useI18n, cap, Text } from '@pega/cosmos-react-core';
4
+ import { StyledLabel, StyledCircle, StyledIcon, StyledCardHeader, StyledCardContent, StyledCard, StyledText, StyledTextWithEllipsis, StyledAdditionalData, StyledCardFooter, StyledAdditionalDataItem } from './NodeTemplate.styles';
5
+ const MetaListItem = ({ label, value }) => {
6
+ const [nodeAdditionalDataItem, setNodeAdditionalDataItem] = useElement();
7
+ return (_jsxs(_Fragment, { children: [_jsxs(Flex, { as: StyledAdditionalDataItem, container: { wrap: 'nowrap', pad: 0.25, gap: 0.25 }, item: { grow: 1 }, ref: setNodeAdditionalDataItem, children: [_jsx(StyledTextWithEllipsis, { as: 'dd', children: label }, void 0), _jsx(Text, { role: 'separator', variant: 'secondary', "aria-hidden": 'true', children: ":\u00A0" }, void 0), _jsx(StyledTextWithEllipsis, { as: 'dt', children: value }, void 0)] }, void 0), _jsx(Tooltip, { target: nodeAdditionalDataItem, hideDelay: 'none', children: `${label}:${value}` }, void 0)] }, void 0));
8
+ };
9
+ const MetaList = ({ metadata }) => {
10
+ const [nodeAdditionalData, setNodeAdditionalData] = useElement();
11
+ let additionalDataValue = '';
12
+ metadata?.forEach((item, index) => {
13
+ if (index > 1) {
14
+ additionalDataValue += `${item.label}: ${item.value}
15
+ `;
16
+ }
17
+ });
18
+ return (_jsxs(Flex, { as: StyledAdditionalData, container: { wrap: 'nowrap', colGap: 1, rowGap: 0.25 }, children: [metadata?.map((data, index) => {
19
+ if (index >= 2) {
20
+ return;
21
+ }
22
+ return _jsx(MetaListItem, { ...data }, data.id);
23
+ }), metadata && metadata.length > 2 && (_jsxs(_Fragment, { children: [_jsx(Flex, { as: StyledAdditionalDataItem, container: { pad: 0.25 }, item: { grow: 1, shrink: 0 }, ref: setNodeAdditionalData, children: _jsx(StyledTextWithEllipsis, { as: 'dt', children: `+${metadata?.length - 2}` }, void 0) }, void 0), additionalDataValue && (_jsx(Tooltip, { target: nodeAdditionalData, hideDelay: 'none', children: additionalDataValue }, void 0))] }, void 0))] }, void 0));
24
+ };
25
+ export const DefaultNode = forwardRef(({ id, label, type, description, additionalData, actions, onActionClick, onClick, ...restProps }, ref) => {
26
+ const t = useI18n();
27
+ const actionItems = actions?.map(actionItem => {
28
+ return {
29
+ id: actionItem.id,
30
+ primary: actionItem.text,
31
+ onClick: (actionId, e) => {
32
+ e.stopPropagation();
33
+ onActionClick?.({ actionId, nodeId: id }, e);
34
+ }
35
+ };
36
+ });
37
+ const handleEnterKeyDown = useCallback((e) => {
38
+ if (e.key === 'Enter' && !e.shiftKey) {
39
+ onClick?.(id);
40
+ }
41
+ }, [onClick]);
42
+ const [nodeLabel, setNodeLabel] = useElement();
43
+ const [nodeDescription, setNodeDescription] = useElement();
44
+ const [nodeIcon, setNodeIcon] = useElement();
45
+ return (_jsxs(StyledCard, { "aria-label": label, onClick: () => onClick?.(id), onKeyDown: handleEnterKeyDown, ref: ref, ...restProps, children: [_jsxs(Flex, { as: StyledCardHeader, container: { alignItems: 'center', pad: 1 }, children: [_jsx(StyledIcon, { id: id, color: type.color, ref: setNodeIcon, children: _jsx(Icon, { name: type.icon }, void 0) }, void 0), _jsx(Tooltip, { target: nodeIcon, hideDelay: 'none', children: cap(type.name) }, void 0), _jsx(StyledText, { variant: 'h4', ref: setNodeLabel, children: label }, void 0), _jsx(Tooltip, { describeTarget: false, target: nodeLabel, hideDelay: 'none', children: label }, void 0), actionItems && (_jsx(MenuButton, { portal: true, variant: 'simple', text: t('actions'), icon: 'more', iconOnly: true, onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), menu: {
46
+ items: actionItems
47
+ } }, void 0))] }, void 0), description && (_jsxs(_Fragment, { children: [_jsx(StyledCardContent, { ref: setNodeDescription, children: description }, void 0), _jsx(Tooltip, { describeTarget: false, target: nodeDescription, hideDelay: 'none', children: description }, void 0)] }, void 0)), additionalData && (_jsx(StyledCardFooter, { children: _jsx(MetaList, { metadata: additionalData }, void 0) }, void 0))] }, void 0));
48
+ });
49
+ export const StartNode = ({ type, label }) => {
50
+ return (_jsxs(Flex, { container: { justify: 'center', direction: 'column' }, children: [_jsx(Flex, { as: StyledLabel, type: type, children: label }, void 0), _jsx(Flex, { as: StyledCircle, color: type.color, tabIndex: '0', "aria-label": label, role: 'button' }, void 0)] }, void 0));
51
+ };
52
+ export const EndNode = ({ type, label }) => {
53
+ return (_jsxs(Flex, { container: { justify: 'center', direction: 'column' }, children: [_jsx(Flex, { as: StyledCircle, color: type.color, tabIndex: '0', "aria-label": label, role: 'button' }, void 0), _jsx(Flex, { as: StyledLabel, type: type, children: label }, void 0)] }, void 0));
54
+ };
55
+ //# sourceMappingURL=NodeTemplates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeTemplates.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAmB,WAAW,EAA6B,UAAU,EAAM,MAAM,OAAO,CAAC;AAEhG,OAAO,EACL,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,UAAU,EACV,OAAO,EACP,GAAG,EACH,IAAI,EACL,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,YAAY,GAAG,CAA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,YACtF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAA8B,EAAE,EAAE;IACrE,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,aACzD,KAAC,IAAI,IAAC,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAC,GAAG,gBAAa,KAAK,EAAE,IAAI,EAAC,QAAQ,WAAG,EAC3F,KAAC,IAAI,IAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,YAC9B,KAAK,WACD,YACF,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { PropsWithoutRef, useCallback, MouseEvent, KeyboardEvent, forwardRef, FC } from 'react';\n\nimport {\n MenuButton,\n Icon,\n Flex,\n Tooltip,\n useElement,\n useI18n,\n cap,\n Text\n} from '@pega/cosmos-react-core';\n\nimport {\n StyledLabel,\n StyledCircle,\n StyledIcon,\n StyledCardHeader,\n StyledCardContent,\n StyledCard,\n StyledText,\n StyledTextWithEllipsis,\n StyledAdditionalData,\n StyledCardFooter,\n StyledAdditionalDataItem\n} from './NodeTemplate.styles';\nimport { NodeProps, NodeComponentProps, AdditionalDataItemProps } from './Node.types';\n\nconst MetaListItem = ({ label, value }: AdditionalDataItemProps) => {\n const [nodeAdditionalDataItem, setNodeAdditionalDataItem] = useElement();\n return (\n <>\n <Flex\n as={StyledAdditionalDataItem}\n container={{ wrap: 'nowrap', pad: 0.25, gap: 0.25 }}\n item={{ grow: 1 }}\n ref={setNodeAdditionalDataItem}\n >\n <StyledTextWithEllipsis as='dd'>{label}</StyledTextWithEllipsis>\n <Text role='separator' variant='secondary' aria-hidden='true'>\n :&nbsp;\n </Text>\n <StyledTextWithEllipsis as='dt'>{value}</StyledTextWithEllipsis>\n </Flex>\n <Tooltip target={nodeAdditionalDataItem} hideDelay='none'>\n {`${label}:${value}`}\n </Tooltip>\n </>\n );\n};\n\nconst MetaList: FC<{ metadata: NodeProps['additionalData'] }> = ({ metadata }) => {\n const [nodeAdditionalData, setNodeAdditionalData] = useElement();\n let additionalDataValue = '';\n metadata?.forEach((item: AdditionalDataItemProps, index: number) => {\n if (index > 1) {\n additionalDataValue += `${item.label}: ${item.value}\n `;\n }\n });\n return (\n <Flex as={StyledAdditionalData} container={{ wrap: 'nowrap', colGap: 1, rowGap: 0.25 }}>\n {metadata?.map((data: AdditionalDataItemProps, index: number) => {\n if (index >= 2) {\n return;\n }\n return <MetaListItem key={data.id} {...data} />;\n })}\n {metadata && metadata.length > 2 && (\n <>\n <Flex\n as={StyledAdditionalDataItem}\n container={{ pad: 0.25 }}\n item={{ grow: 1, shrink: 0 }}\n ref={setNodeAdditionalData}\n >\n <StyledTextWithEllipsis as='dt'>{`+${metadata?.length - 2}`}</StyledTextWithEllipsis>\n </Flex>\n {additionalDataValue && (\n <Tooltip target={nodeAdditionalData} hideDelay='none'>\n {additionalDataValue}\n </Tooltip>\n )}\n </>\n )}\n </Flex>\n );\n};\nexport const DefaultNode = forwardRef(\n (\n {\n id,\n label,\n type,\n description,\n additionalData,\n actions,\n onActionClick,\n onClick,\n ...restProps\n }: PropsWithoutRef<NodeComponentProps>,\n ref: NodeComponentProps['ref']\n ) => {\n const t = useI18n();\n const actionItems = actions?.map(actionItem => {\n return {\n id: actionItem.id,\n primary: actionItem.text,\n onClick: (actionId: string, e: MouseEvent) => {\n e.stopPropagation();\n onActionClick?.({ actionId, nodeId: id }, e);\n }\n };\n });\n\n const handleEnterKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n onClick?.(id);\n }\n },\n [onClick]\n );\n\n const [nodeLabel, setNodeLabel] = useElement();\n const [nodeDescription, setNodeDescription] = useElement();\n\n const [nodeIcon, setNodeIcon] = useElement();\n\n return (\n <StyledCard\n aria-label={label}\n onClick={() => onClick?.(id)}\n onKeyDown={handleEnterKeyDown}\n ref={ref}\n {...restProps}\n >\n <Flex as={StyledCardHeader} container={{ alignItems: 'center', pad: 1 }}>\n <StyledIcon id={id} color={type.color} ref={setNodeIcon}>\n <Icon name={type.icon} />\n </StyledIcon>\n <Tooltip target={nodeIcon} hideDelay='none'>\n {cap(type.name)}\n </Tooltip>\n <StyledText variant='h4' ref={setNodeLabel}>\n {label}\n </StyledText>\n <Tooltip describeTarget={false} target={nodeLabel} hideDelay='none'>\n {label}\n </Tooltip>\n\n {actionItems && (\n <MenuButton\n portal\n variant='simple'\n text={t('actions')}\n icon='more'\n iconOnly\n onClick={(e: MouseEvent) => e.stopPropagation()}\n onKeyDown={(e: KeyboardEvent) => e.stopPropagation()}\n menu={{\n items: actionItems\n }}\n />\n )}\n </Flex>\n {description && (\n <>\n <StyledCardContent ref={setNodeDescription}>{description}</StyledCardContent>\n <Tooltip describeTarget={false} target={nodeDescription} hideDelay='none'>\n {description}\n </Tooltip>\n </>\n )}\n {additionalData && (\n <StyledCardFooter>\n <MetaList metadata={additionalData} />\n </StyledCardFooter>\n )}\n </StyledCard>\n );\n }\n);\n\nexport const StartNode = ({ type, label }: PropsWithoutRef<NodeProps>) => {\n return (\n <Flex container={{ justify: 'center', direction: 'column' }}>\n <Flex as={StyledLabel} type={type}>\n {label}\n </Flex>\n <Flex as={StyledCircle} color={type.color} tabIndex='0' aria-label={label} role='button' />\n </Flex>\n );\n};\n\nexport const EndNode = ({ type, label }: PropsWithoutRef<NodeProps>) => {\n return (\n <Flex container={{ justify: 'center', direction: 'column' }}>\n <Flex as={StyledCircle} color={type.color} tabIndex='0' aria-label={label} role='button' />\n <Flex as={StyledLabel} type={type}>\n {label}\n </Flex>\n </Flex>\n );\n};\n"]}
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import { ForwardProps } from '@pega/cosmos-react-core';
3
+ import { NodeLibraryItem } from './Node/Node.types';
4
+ export interface NodeLibraryProps {
5
+ show: boolean;
6
+ target: HTMLElement | null;
7
+ items: NodeLibraryItem[];
8
+ onClick: (libItem: NodeLibraryItem) => void;
9
+ }
10
+ declare const NodeLibrary: FC<NodeLibraryProps & ForwardProps>;
11
+ export default NodeLibrary;
12
+ //# sourceMappingURL=NodeLibrary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeLibrary.d.ts","sourceRoot":"","sources":["../../../src/components/FlowModeller/NodeLibrary.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EASH,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,YAAY,EAUb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAOpD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,OAAO,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CAC7C;AAED,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,GAAG,YAAY,CA4EpD,CAAC;AAEF,eAAe,WAAW,CAAC"}