@pega/cosmos-react-build 9.0.0-build.9.8 → 9.0.0

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 (270) hide show
  1. package/lib/components/AppShell/AppShell.styles.d.ts +13 -11
  2. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  3. package/lib/components/AppShell/Header/AppHeader.styles.d.ts +11 -7
  4. package/lib/components/AppShell/Header/AppHeader.styles.d.ts.map +1 -1
  5. package/lib/components/AppShell/Header/BranchButton.d.ts +6 -4
  6. package/lib/components/AppShell/Header/BranchButton.d.ts.map +1 -1
  7. package/lib/components/AppShell/Header/BranchButton.js.map +1 -1
  8. package/lib/components/AuthoringPanel/AuthoringPanel.styles.d.ts +753 -15
  9. package/lib/components/AuthoringPanel/AuthoringPanel.styles.d.ts.map +1 -1
  10. package/lib/components/AuthoringPanel/AuthoringPanel.styles.js +5 -4
  11. package/lib/components/AuthoringPanel/AuthoringPanel.styles.js.map +1 -1
  12. package/lib/components/Automation/Automation.js.map +1 -1
  13. package/lib/components/Automation/Automation.styles.d.ts +33 -10
  14. package/lib/components/Automation/Automation.styles.d.ts.map +1 -1
  15. package/lib/components/Automation/Automation.styles.js +1 -1
  16. package/lib/components/Automation/Automation.styles.js.map +1 -1
  17. package/lib/components/BackgroundPicker/BackgroundPicker.styles.d.ts +375 -11
  18. package/lib/components/BackgroundPicker/BackgroundPicker.styles.d.ts.map +1 -1
  19. package/lib/components/BackgroundPicker/BackgroundPicker.styles.js.map +1 -1
  20. package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +8 -4
  21. package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -1
  22. package/lib/components/DynamicContentEditor/DynamicContentEditor.js +88 -68
  23. package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -1
  24. package/lib/components/DynamicContentEditor/DynamicContentEditor.test-ids.d.ts +2 -0
  25. package/lib/components/DynamicContentEditor/DynamicContentEditor.test-ids.d.ts.map +1 -0
  26. package/lib/components/DynamicContentEditor/DynamicContentEditor.test-ids.js +9 -0
  27. package/lib/components/DynamicContentEditor/DynamicContentEditor.test-ids.js.map +1 -0
  28. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts +12 -3
  29. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts.map +1 -1
  30. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js +2 -1
  31. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js.map +1 -1
  32. package/lib/components/DynamicInput/DynamicInput.d.ts.map +1 -1
  33. package/lib/components/DynamicInput/DynamicInput.js +11 -5
  34. package/lib/components/DynamicInput/DynamicInput.js.map +1 -1
  35. package/lib/components/DynamicInput/DynamicInput.styles.d.ts +187 -2
  36. package/lib/components/DynamicInput/DynamicInput.styles.d.ts.map +1 -1
  37. package/lib/components/DynamicInput/DynamicInput.styles.js +29 -2
  38. package/lib/components/DynamicInput/DynamicInput.styles.js.map +1 -1
  39. package/lib/components/DynamicInput/DynamicInput.types.d.ts +4 -2
  40. package/lib/components/DynamicInput/DynamicInput.types.d.ts.map +1 -1
  41. package/lib/components/DynamicInput/DynamicInput.types.js.map +1 -1
  42. package/lib/components/DynamicInput/SourceButton.d.ts +1 -1
  43. package/lib/components/DynamicInput/SourceButton.d.ts.map +1 -1
  44. package/lib/components/DynamicInput/SourceButton.js.map +1 -1
  45. package/lib/components/DynamicInput/utils.d.ts.map +1 -1
  46. package/lib/components/DynamicInput/utils.js +5 -1
  47. package/lib/components/DynamicInput/utils.js.map +1 -1
  48. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.d.ts +5 -5
  49. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.d.ts.map +1 -1
  50. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.js.map +1 -1
  51. package/lib/components/Expression/Expression.styles.d.ts +376 -8
  52. package/lib/components/Expression/Expression.styles.d.ts.map +1 -1
  53. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -1
  54. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +138 -41
  55. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -1
  56. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts +190 -8
  57. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts.map +1 -1
  58. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +53 -32
  59. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -1
  60. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts +2 -1
  61. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts.map +1 -1
  62. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js.map +1 -1
  63. package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts +1 -1
  64. package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts.map +1 -1
  65. package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js +7 -7
  66. package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js.map +1 -1
  67. package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts.map +1 -1
  68. package/lib/components/ExpressionBuilder/ExpressionBuilder.js +7 -6
  69. package/lib/components/ExpressionBuilder/ExpressionBuilder.js.map +1 -1
  70. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts +211 -22
  71. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts.map +1 -1
  72. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js +6 -0
  73. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js.map +1 -1
  74. package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts +5 -3
  75. package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts.map +1 -1
  76. package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js.map +1 -1
  77. package/lib/components/ExpressionBuilder/ExpressionItem.d.ts.map +1 -1
  78. package/lib/components/ExpressionBuilder/ExpressionItem.js +17 -13
  79. package/lib/components/ExpressionBuilder/ExpressionItem.js.map +1 -1
  80. package/lib/components/ExpressionBuilder/ExpressionList.d.ts.map +1 -1
  81. package/lib/components/ExpressionBuilder/ExpressionList.js +18 -13
  82. package/lib/components/ExpressionBuilder/ExpressionList.js.map +1 -1
  83. package/lib/components/ExpressionBuilder/index.d.ts +1 -1
  84. package/lib/components/ExpressionBuilder/index.d.ts.map +1 -1
  85. package/lib/components/ExpressionBuilder/index.js.map +1 -1
  86. package/lib/components/FieldReference/FieldReference.styles.d.ts +20 -11
  87. package/lib/components/FieldReference/FieldReference.styles.d.ts.map +1 -1
  88. package/lib/components/FieldReference/FieldReference.styles.js +10 -1
  89. package/lib/components/FieldReference/FieldReference.styles.js.map +1 -1
  90. package/lib/components/FieldReference/FieldReferenceDisplay.d.ts.map +1 -1
  91. package/lib/components/FieldReference/FieldReferenceDisplay.js +3 -3
  92. package/lib/components/FieldReference/FieldReferenceDisplay.js.map +1 -1
  93. package/lib/components/FieldReference/FieldReferenceInput.d.ts.map +1 -1
  94. package/lib/components/FieldReference/FieldReferenceInput.js +13 -5
  95. package/lib/components/FieldReference/FieldReferenceInput.js.map +1 -1
  96. package/lib/components/FlowModeller/AddNode.d.ts +22 -0
  97. package/lib/components/FlowModeller/AddNode.d.ts.map +1 -0
  98. package/lib/components/FlowModeller/AddNode.js +95 -0
  99. package/lib/components/FlowModeller/AddNode.js.map +1 -0
  100. package/lib/components/FlowModeller/Connector.d.ts +12 -0
  101. package/lib/components/FlowModeller/Connector.d.ts.map +1 -0
  102. package/lib/components/FlowModeller/Connector.js +84 -0
  103. package/lib/components/FlowModeller/Connector.js.map +1 -0
  104. package/lib/components/FlowModeller/DeleteDialog.d.ts +39 -0
  105. package/lib/components/FlowModeller/DeleteDialog.d.ts.map +1 -0
  106. package/lib/components/FlowModeller/DeleteDialog.js +158 -0
  107. package/lib/components/FlowModeller/DeleteDialog.js.map +1 -0
  108. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.d.ts +4 -0
  109. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.d.ts.map +1 -0
  110. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.js +37 -0
  111. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.js.map +1 -0
  112. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.styles.d.ts +8 -0
  113. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.styles.d.ts.map +1 -0
  114. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.styles.js +80 -0
  115. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.styles.js.map +1 -0
  116. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.types.d.ts +36 -0
  117. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.types.d.ts.map +1 -0
  118. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.types.js +2 -0
  119. package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.types.js.map +1 -0
  120. package/lib/components/FlowModeller/FlowModeller.d.ts +5 -0
  121. package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -0
  122. package/lib/components/FlowModeller/FlowModeller.js +359 -0
  123. package/lib/components/FlowModeller/FlowModeller.js.map +1 -0
  124. package/lib/components/FlowModeller/FlowModeller.test-ids.d.ts +3 -0
  125. package/lib/components/FlowModeller/FlowModeller.test-ids.d.ts.map +1 -0
  126. package/lib/components/FlowModeller/FlowModeller.test-ids.js +5 -0
  127. package/lib/components/FlowModeller/FlowModeller.test-ids.js.map +1 -0
  128. package/lib/components/FlowModeller/FlowModeller.types.d.ts +84 -0
  129. package/lib/components/FlowModeller/FlowModeller.types.d.ts.map +1 -0
  130. package/lib/components/FlowModeller/FlowModeller.types.js +2 -0
  131. package/lib/components/FlowModeller/FlowModeller.types.js.map +1 -0
  132. package/lib/components/FlowModeller/FlowModellerContext.d.ts +10 -0
  133. package/lib/components/FlowModeller/FlowModellerContext.d.ts.map +1 -0
  134. package/lib/components/FlowModeller/FlowModellerContext.js +8 -0
  135. package/lib/components/FlowModeller/FlowModellerContext.js.map +1 -0
  136. package/lib/components/FlowModeller/Node/Node.types.d.ts +93 -0
  137. package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -0
  138. package/lib/components/FlowModeller/Node/Node.types.js +27 -0
  139. package/lib/components/FlowModeller/Node/Node.types.js.map +1 -0
  140. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +212 -0
  141. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -0
  142. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +144 -0
  143. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -0
  144. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +5 -0
  145. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -0
  146. package/lib/components/FlowModeller/Node/NodeTemplates.js +130 -0
  147. package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -0
  148. package/lib/components/FlowModeller/Node.d.ts +10 -0
  149. package/lib/components/FlowModeller/Node.d.ts.map +1 -0
  150. package/lib/components/FlowModeller/Node.js +43 -0
  151. package/lib/components/FlowModeller/Node.js.map +1 -0
  152. package/lib/components/FlowModeller/Renderer/Renderer.d.ts +4 -0
  153. package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +1 -0
  154. package/lib/components/FlowModeller/Renderer/Renderer.js +198 -0
  155. package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -0
  156. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +20 -0
  157. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +1 -0
  158. package/lib/components/FlowModeller/Renderer/Renderer.types.js +2 -0
  159. package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +1 -0
  160. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +63 -0
  161. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +1 -0
  162. package/lib/components/FlowModeller/Renderer/Utils/Graph.js +291 -0
  163. package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -0
  164. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +37 -0
  165. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +1 -0
  166. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +114 -0
  167. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +1 -0
  168. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +29 -0
  169. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts.map +1 -0
  170. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js +191 -0
  171. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js.map +1 -0
  172. package/lib/components/FlowModeller/Renderer/Utils/RendererUtils.d.ts +38 -0
  173. package/lib/components/FlowModeller/Renderer/Utils/RendererUtils.d.ts.map +1 -0
  174. package/lib/components/FlowModeller/Renderer/Utils/RendererUtils.js +363 -0
  175. package/lib/components/FlowModeller/Renderer/Utils/RendererUtils.js.map +1 -0
  176. package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts +18 -0
  177. package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts.map +1 -0
  178. package/lib/components/FlowModeller/Utils/addNodeUtils.js +148 -0
  179. package/lib/components/FlowModeller/Utils/addNodeUtils.js.map +1 -0
  180. package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts +33 -0
  181. package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts.map +1 -0
  182. package/lib/components/FlowModeller/Utils/deleteNodeUtils.js +89 -0
  183. package/lib/components/FlowModeller/Utils/deleteNodeUtils.js.map +1 -0
  184. package/lib/components/FlowModeller/constants.d.ts +10 -0
  185. package/lib/components/FlowModeller/constants.d.ts.map +1 -0
  186. package/lib/components/FlowModeller/constants.js +9 -0
  187. package/lib/components/FlowModeller/constants.js.map +1 -0
  188. package/lib/components/FlowModeller/helper.d.ts +39 -0
  189. package/lib/components/FlowModeller/helper.d.ts.map +1 -0
  190. package/lib/components/FlowModeller/helper.js +230 -0
  191. package/lib/components/FlowModeller/helper.js.map +1 -0
  192. package/lib/components/FlowModeller/index.d.ts +18 -0
  193. package/lib/components/FlowModeller/index.d.ts.map +1 -0
  194. package/lib/components/FlowModeller/index.js +11 -0
  195. package/lib/components/FlowModeller/index.js.map +1 -0
  196. package/lib/components/IconTile/IconTile.d.ts +2 -2
  197. package/lib/components/IconTile/IconTile.d.ts.map +1 -1
  198. package/lib/components/ItemLibrary/ItemLibrary.d.ts +2 -2
  199. package/lib/components/ItemLibrary/ItemLibrary.d.ts.map +1 -1
  200. package/lib/components/ItemLibrary/ItemLibrary.js +5 -1
  201. package/lib/components/ItemLibrary/ItemLibrary.js.map +1 -1
  202. package/lib/components/LifeCycle/Category.d.ts +6 -6
  203. package/lib/components/LifeCycle/Category.d.ts.map +1 -1
  204. package/lib/components/LifeCycle/LifeCycle.d.ts +184 -2
  205. package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -1
  206. package/lib/components/LifeCycle/LifeCycle.types.d.ts +70 -0
  207. package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
  208. package/lib/components/LifeCycle/Stage.d.ts +6 -6
  209. package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
  210. package/lib/components/LifeCycle/Step.d.ts +8 -8
  211. package/lib/components/LifeCycle/Step.d.ts.map +1 -1
  212. package/lib/components/LifeCycle/Step.js +1 -1
  213. package/lib/components/LifeCycle/Step.js.map +1 -1
  214. package/lib/components/LifeCycle/Task.d.ts +14 -10
  215. package/lib/components/LifeCycle/Task.d.ts.map +1 -1
  216. package/lib/components/LifeCycle/TaskGroup.d.ts +3 -1
  217. package/lib/components/LifeCycle/TaskGroup.d.ts.map +1 -1
  218. package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts +2 -2
  219. package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts.map +1 -1
  220. package/lib/components/ObjectSelect/InputTree/InputTree.styles.d.ts +10 -8
  221. package/lib/components/ObjectSelect/InputTree/InputTree.styles.d.ts.map +1 -1
  222. package/lib/components/ObjectSelect/InputTree/InputTree.styles.js +1 -1
  223. package/lib/components/ObjectSelect/InputTree/InputTree.styles.js.map +1 -1
  224. package/lib/components/PageBanner/PageBanner.d.ts +3 -3
  225. package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
  226. package/lib/components/PageBanner/PageBanner.js +6 -2
  227. package/lib/components/PageBanner/PageBanner.js.map +1 -1
  228. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.d.ts +4 -2
  229. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.d.ts.map +1 -1
  230. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.js +23 -12
  231. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.js.map +1 -1
  232. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.d.ts.map +1 -1
  233. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.js +14 -5
  234. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.js.map +1 -1
  235. package/lib/components/PageTemplates/GalleryPage.d.ts +2 -2
  236. package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -1
  237. package/lib/components/PageTemplates/HeaderActionButtons.d.ts.map +1 -1
  238. package/lib/components/PageTemplates/HeaderActionButtons.js +11 -3
  239. package/lib/components/PageTemplates/HeaderActionButtons.js.map +1 -1
  240. package/lib/components/PageTemplates/PageTemplate.styles.d.ts +375 -8
  241. package/lib/components/PageTemplates/PageTemplate.styles.d.ts.map +1 -1
  242. package/lib/components/PageTemplates/PageTemplate.styles.js +18 -10
  243. package/lib/components/PageTemplates/PageTemplate.styles.js.map +1 -1
  244. package/lib/components/PageTemplates/PageTemplate.types.d.ts +18 -13
  245. package/lib/components/PageTemplates/PageTemplate.types.d.ts.map +1 -1
  246. package/lib/components/PageTemplates/PageTemplate.types.js.map +1 -1
  247. package/lib/components/PageTemplates/PageTemplates.d.ts +4 -1
  248. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  249. package/lib/components/PageTemplates/PageTemplates.js +9 -5
  250. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  251. package/lib/components/PageTemplates/ShowcasePage.d.ts +2 -2
  252. package/lib/components/PageTemplates/ShowcasePage.d.ts.map +1 -1
  253. package/lib/components/RulePicker/RulePicker.d.ts +1 -1
  254. package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -1
  255. package/lib/components/SummaryCard/SummaryCard.js +13 -1
  256. package/lib/components/SummaryCard/SummaryCard.js.map +1 -1
  257. package/lib/components/Workbench/Workbench.styles.d.ts +12 -8
  258. package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -1
  259. package/lib/index.d.ts +2 -0
  260. package/lib/index.d.ts.map +1 -1
  261. package/lib/index.js +2 -0
  262. package/lib/index.js.map +1 -1
  263. package/lib/utils/typeIconMapping.d.ts.map +1 -1
  264. package/lib/utils/typeIconMapping.js +2 -0
  265. package/lib/utils/typeIconMapping.js.map +1 -1
  266. package/lib/utils/utils.d.ts +5 -0
  267. package/lib/utils/utils.d.ts.map +1 -0
  268. package/lib/utils/utils.js +19 -0
  269. package/lib/utils/utils.js.map +1 -0
  270. package/package.json +7 -10
@@ -0,0 +1,144 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { defaultThemeProp, Card, Text, CardFooter, Icon, Flex } from '@pega/cosmos-react-core';
3
+ const borderRadius = 'border-radius';
4
+ export const StyledCircle = styled.div(({ theme, bgColor }) => {
5
+ return css `
6
+ height: calc(4 * ${theme.base.spacing});
7
+ width: calc(4 * ${theme.base.spacing});
8
+ background: ${bgColor};
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 StyledStartNode = styled(Flex) `
19
+ height: inherit;
20
+ `;
21
+ export const StyledIcon = styled.div(({ theme, bgColor, color }) => {
22
+ const { base: { 'border-radius': baseRadius }, components: { icon: { 'border-radius-multiplier': borderRadiusMultiplier } } } = theme;
23
+ return css `
24
+ min-height: calc(4 * ${theme.base.spacing});
25
+ min-width: calc(4 * ${theme.base.spacing});
26
+ margin-inline-end: ${theme.base.spacing};
27
+ ${bgColor && `background-color: ${bgColor};`}
28
+ ${color && `color: ${color};`}
29
+ border-radius: calc(0.5 * ${borderRadiusMultiplier} * ${baseRadius});
30
+ `;
31
+ });
32
+ StyledIcon.defaultProps = defaultThemeProp;
33
+ export const StyledNodeTemplateHeader = styled.header(({ theme }) => {
34
+ return css `
35
+ white-space: nowrap;
36
+ button {
37
+ border-radius: ${theme.base[borderRadius]};
38
+ }
39
+ `;
40
+ });
41
+ StyledNodeTemplateHeader.defaultProps = defaultThemeProp;
42
+ export const StyledText = styled(Text)(({ error, theme }) => {
43
+ return css `
44
+ padding-inline-end: ${theme.base.spacing};
45
+ overflow: hidden;
46
+ text-overflow: ellipsis;
47
+ max-width: ${error
48
+ ? `calc(0.9 * ${theme.base['content-width'].xs})`
49
+ : theme.base['content-width'].xs};
50
+ `;
51
+ });
52
+ StyledText.defaultProps = defaultThemeProp;
53
+ export const StyledNodeTemplate = styled(Card)(({ highlight, theme }) => {
54
+ return css `
55
+ width: calc(35 * ${theme.base.spacing});
56
+ height: calc(15 * ${theme.base.spacing});
57
+ align-self: center;
58
+ overflow: hidden;
59
+ background-color: ${theme.base.palette['primary-background']};
60
+ border: calc(0.25 * ${theme.base.spacing}) solid transparent;
61
+
62
+ ${highlight &&
63
+ css `
64
+ &&& {
65
+ color: ${theme.base.colors.black};
66
+ background-color: ${theme.base.colors.red['extra-light']};
67
+ border-radius: calc(0.25 * ${theme.base.spacing});
68
+ box-shadow: 0 0 0 calc(0.25 * ${theme.base.spacing}) ${theme.base.colors.red.medium};
69
+ }
70
+ `}
71
+
72
+ &&& {
73
+ border-radius: ${theme.base[borderRadius]};
74
+ }
75
+
76
+ &:hover {
77
+ cursor: pointer;
78
+ }
79
+
80
+ :focus-visible {
81
+ box-shadow: ${theme.base.shadow.focus};
82
+ }
83
+
84
+ &[aria-current='location'] {
85
+ box-shadow: none;
86
+ border: calc(0.25 * ${theme.base.spacing}) solid ${theme.base.palette.interactive};
87
+ cursor: pointer;
88
+ }
89
+ `;
90
+ });
91
+ StyledNodeTemplate.defaultProps = defaultThemeProp;
92
+ export const StyledNodeTemplateFooter = styled(CardFooter)(({ theme }) => {
93
+ return css `
94
+ margin-top: auto;
95
+ &:not(${StyledNodeTemplate} ${StyledNodeTemplate} > &) {
96
+ padding: ${theme.base.spacing};
97
+ }
98
+ `;
99
+ });
100
+ StyledNodeTemplateFooter.defaultProps = defaultThemeProp;
101
+ export const StyledNodeTemplateContent = styled.div(({ theme }) => {
102
+ return css `
103
+ padding: ${theme.base.spacing};
104
+ padding-block-start: 0;
105
+ max-height: calc(5 * ${theme.base.spacing});
106
+ display: -webkit-box;
107
+ -webkit-line-clamp: 2;
108
+ -webkit-box-orient: vertical;
109
+ overflow: hidden;
110
+ text-overflow: ellipsis;
111
+ white-space: pre-wrap;
112
+ word-wrap: break-word;
113
+ `;
114
+ });
115
+ StyledNodeTemplateContent.defaultProps = defaultThemeProp;
116
+ export const StyledAdditionalData = styled.dl `
117
+ overflow: hidden;
118
+ `;
119
+ export const StyledAdditionalDataItem = styled.div(({ theme }) => {
120
+ return css `
121
+ padding: 0 calc(0.5 * ${theme.base.spacing});
122
+ background-color: ${theme.base.palette['secondary-background']};
123
+ border-radius: ${theme.base[borderRadius]};
124
+ `;
125
+ });
126
+ StyledAdditionalDataItem.defaultProps = defaultThemeProp;
127
+ export const StyledTextWithEllipsis = styled(Text)(() => {
128
+ return css `
129
+ overflow: hidden;
130
+ width: auto;
131
+ display: inline-block;
132
+ white-space: nowrap;
133
+ text-overflow: ellipsis;
134
+ `;
135
+ });
136
+ StyledTextWithEllipsis.defaultProps = defaultThemeProp;
137
+ export const StyledErrorIcon = styled(Icon)(({ theme }) => {
138
+ return css `
139
+ color: ${theme.base.palette.urgent};
140
+ margin-inline-end: ${theme.base.spacing};
141
+ `;
142
+ });
143
+ StyledErrorIcon.defaultProps = defaultThemeProp;
144
+ //# 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;AAEhD,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE/F,MAAM,YAAY,GAAG,eAAe,CAAC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAsB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;IACjF,OAAO,GAAG,CAAA;uBACW,KAAK,CAAC,IAAI,CAAC,OAAO;sBACnB,KAAK,CAAC,IAAI,CAAC,OAAO;kBACtB,OAAO;;;;;oBAKL,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;GAExC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,YAAY,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE7C,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAE1C,CAAC;AAOF,MAAM,CAAC,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icon, Flex } from '@pega/cosmos-react-core';\n\nconst borderRadius = 'border-radius';\nexport const StyledCircle = styled.div<{ bgColor: string }>(({ theme, bgColor }) => {\n return css`\n height: calc(4 * ${theme.base.spacing});\n width: calc(4 * ${theme.base.spacing});\n background: ${bgColor};\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 StyledStartNode = styled(Flex)`\n height: inherit;\n`;\n\ninterface StyledIconProps {\n bgColor?: string;\n color?: string;\n}\n\nexport const StyledIcon = styled.div<StyledIconProps>(({ theme, bgColor, color }) => {\n const {\n base: { 'border-radius': baseRadius },\n components: {\n icon: { 'border-radius-multiplier': borderRadiusMultiplier }\n }\n } = theme;\n return css`\n min-height: calc(4 * ${theme.base.spacing});\n min-width: calc(4 * ${theme.base.spacing});\n margin-inline-end: ${theme.base.spacing};\n ${bgColor && `background-color: ${bgColor};`}\n ${color && `color: ${color};`}\n border-radius: calc(0.5 * ${borderRadiusMultiplier} * ${baseRadius});\n `;\n});\n\nStyledIcon.defaultProps = defaultThemeProp;\n\nexport const StyledNodeTemplateHeader = styled.header(({ theme }) => {\n return css`\n white-space: nowrap;\n button {\n border-radius: ${theme.base[borderRadius]};\n }\n `;\n});\n\nStyledNodeTemplateHeader.defaultProps = defaultThemeProp;\n\nexport const StyledText = styled(Text)<{ error?: string | undefined }>(({ error, theme }) => {\n return css`\n padding-inline-end: ${theme.base.spacing};\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: ${error\n ? `calc(0.9 * ${theme.base['content-width'].xs})`\n : theme.base['content-width'].xs};\n `;\n});\n\nStyledText.defaultProps = defaultThemeProp;\n\nexport const StyledNodeTemplate = styled(Card)<{ highlight: boolean }>(({ highlight, theme }) => {\n return css`\n width: calc(35 * ${theme.base.spacing});\n height: calc(15 * ${theme.base.spacing});\n align-self: center;\n overflow: hidden;\n background-color: ${theme.base.palette['primary-background']};\n border: calc(0.25 * ${theme.base.spacing}) solid transparent;\n\n ${highlight &&\n css`\n &&& {\n color: ${theme.base.colors.black};\n background-color: ${theme.base.colors.red['extra-light']};\n border-radius: calc(0.25 * ${theme.base.spacing});\n box-shadow: 0 0 0 calc(0.25 * ${theme.base.spacing}) ${theme.base.colors.red.medium};\n }\n `}\n\n &&& {\n border-radius: ${theme.base[borderRadius]};\n }\n\n &:hover {\n cursor: pointer;\n }\n\n :focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n }\n\n &[aria-current='location'] {\n box-shadow: none;\n border: calc(0.25 * ${theme.base.spacing}) solid ${theme.base.palette.interactive};\n cursor: pointer;\n }\n `;\n});\n\nStyledNodeTemplate.defaultProps = defaultThemeProp;\n\nexport const StyledNodeTemplateFooter = styled(CardFooter)(({ theme }) => {\n return css`\n margin-top: auto;\n &:not(${StyledNodeTemplate} ${StyledNodeTemplate} > &) {\n padding: ${theme.base.spacing};\n }\n `;\n});\n\nStyledNodeTemplateFooter.defaultProps = defaultThemeProp;\n\nexport const StyledNodeTemplateContent = styled.div(({ theme }) => {\n return css`\n padding: ${theme.base.spacing};\n padding-block-start: 0;\n max-height: calc(5 * ${theme.base.spacing});\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: pre-wrap;\n word-wrap: break-word;\n `;\n});\n\nStyledNodeTemplateContent.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[borderRadius]};\n `;\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});\n\nStyledTextWithEllipsis.defaultProps = defaultThemeProp;\n\nexport const StyledErrorIcon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n margin-inline-end: ${theme.base.spacing};\n `;\n});\n\nStyledErrorIcon.defaultProps = defaultThemeProp;\n"]}
@@ -0,0 +1,5 @@
1
+ import type { NodeProps, NodeComponentProps, NodeEvents } from './Node.types';
2
+ export declare const DefaultNode: ({ id, label, type, description, additionalData, actions, onActionClick, onClick, onDelete, reference, error, selected, referencedNode, active, onKeyDown, ...restProps }: NodeComponentProps & NodeEvents) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const StartNode: ({ type, label, active, ...restProps }: NodeProps & NodeEvents) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const EndNode: ({ type, label, active, ...restProps }: NodeProps & NodeEvents) => import("react/jsx-runtime").JSX.Element;
5
+ //# 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":"AAgCA,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EAElB,UAAU,EACX,MAAM,cAAc,CAAC;AAmCtB,eAAO,MAAM,WAAW,GAAI,0KAiBzB,kBAAkB,GAAG,UAAU,4CAsJjC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,uCAKvB,SAAS,GAAG,UAAU,4CAoCxB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,uCAA+C,SAAS,GAAG,UAAU,4CAmC5F,CAAC"}
@@ -0,0 +1,130 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useContext, useRef, useEffect, useState } from 'react';
3
+ import { MenuButton, Flex, useI18n, Text, VisuallyHiddenText, useUID, useTheme } from '@pega/cosmos-react-core';
4
+ import { generateDynamicTestId } from '../../../utils/utils';
5
+ import FlowModellerContext from '../FlowModellerContext';
6
+ import IconTile from '../../IconTile';
7
+ import { flowModellerConstants } from '../constants';
8
+ import { StyledCircle, StyledIcon, StyledNodeTemplateHeader, StyledNodeTemplateContent, StyledNodeTemplate, StyledText, StyledTextWithEllipsis, StyledAdditionalData, StyledNodeTemplateFooter, StyledAdditionalDataItem, StyledErrorIcon, StyledStartNode } from './NodeTemplate.styles';
9
+ const focusable = 0;
10
+ const notFocusable = -1;
11
+ const MetaListItem = ({ label, value }) => {
12
+ return (_jsxs(Flex, { as: StyledAdditionalDataItem, container: { wrap: 'nowrap', pad: 0.25, gap: 0.25 }, item: { grow: 1 }, children: [_jsx(StyledTextWithEllipsis, { as: 'dd', children: label }), _jsx(Text, { role: 'separator', variant: 'secondary', "aria-hidden": 'true', children: ":\u00A0" }), _jsx(StyledTextWithEllipsis, { as: 'dt', children: value })] }));
13
+ };
14
+ const MetaList = ({ metadata }) => {
15
+ return (_jsxs(Flex, { as: StyledAdditionalData, container: { wrap: 'nowrap', colGap: 1, rowGap: 0.25 }, children: [metadata?.map((data, index) => index >= 2 ? undefined : _jsx(MetaListItem, { ...data }, data.id)), metadata && metadata.length > 2 && (_jsx(Flex, { as: StyledAdditionalDataItem, container: { pad: 0.25 }, item: { grow: 1, shrink: 0 }, children: _jsx(StyledTextWithEllipsis, { as: 'dt', children: `+${metadata.length - 2}` }) }))] }));
16
+ };
17
+ export const DefaultNode = ({ id, label, type, description, additionalData, actions, onActionClick, onClick, onDelete, reference, error, selected, referencedNode, active = false, onKeyDown, ...restProps }) => {
18
+ const t = useI18n();
19
+ const nodeRef = useRef(null);
20
+ const actionMenuRef = useRef(null);
21
+ const [nodeFocusable, setNodeFocusable] = useState(notFocusable);
22
+ const [menuButtonFocusable, setMenuButtonFocusable] = useState(notFocusable);
23
+ useEffect(() => {
24
+ if (active) {
25
+ nodeRef.current?.focus();
26
+ }
27
+ }, [active]);
28
+ const actionItems = actions?.map(actionItem => {
29
+ return {
30
+ id: actionItem.id,
31
+ primary: actionItem.text,
32
+ onClick: (actionId, e) => {
33
+ e.stopPropagation();
34
+ onActionClick?.({ actionId, nodeId: id }, e);
35
+ },
36
+ onKeyDown: (e) => e.stopPropagation()
37
+ };
38
+ });
39
+ const references = referencedNode && [
40
+ { id: referencedNode?.id, label: t('go_to_noun'), value: referencedNode?.label }
41
+ ];
42
+ if (onDelete !== undefined) {
43
+ actionItems?.push({
44
+ id: 'flowmodeller-delete-node',
45
+ primary: t('delete'),
46
+ onClick: (actionId, e) => {
47
+ e.stopPropagation();
48
+ onDelete?.({ actionId, nodeId: id }, e);
49
+ },
50
+ onKeyDown: (e) => e.stopPropagation()
51
+ });
52
+ }
53
+ const handleEnterKeyDown = (e) => {
54
+ if ((e.key === 'Enter' && !e.shiftKey) || e.key === ' ') {
55
+ onClick?.(id, e);
56
+ e.preventDefault();
57
+ }
58
+ else if (e.key === 'A' && e.shiftKey) {
59
+ actionMenuRef.current?.focus();
60
+ }
61
+ else {
62
+ onKeyDown(e);
63
+ }
64
+ };
65
+ const { readOnly, highlights } = useContext(FlowModellerContext);
66
+ const menuTestId = generateDynamicTestId([label]);
67
+ return (_jsxs(StyledNodeTemplate, { ...restProps, ref: nodeRef, "aria-label": error ? t('step_name_error', [label]) : label, "aria-current": selected ? 'location' : undefined, onClick: (e) => {
68
+ if (!e.detail) {
69
+ return;
70
+ }
71
+ onClick?.(id, e);
72
+ nodeRef.current?.scrollIntoView({
73
+ block: 'center',
74
+ behavior: 'smooth'
75
+ });
76
+ }, onFocus: () => {
77
+ setNodeFocusable(focusable);
78
+ }, onBlur: () => {
79
+ setNodeFocusable(notFocusable);
80
+ }, onKeyDown: handleEnterKeyDown, id: `modeller-node-${id}`, highlight: !!highlights?.nodes?.[id], tabIndex: nodeFocusable, children: [_jsxs(Flex, { as: StyledNodeTemplateHeader, container: { alignItems: 'center', pad: 1, justify: 'between' }, children: [_jsxs(Flex, { container: { alignItems: 'center' }, children: [error && _jsx(StyledErrorIcon, { name: 'warn-solid' }), _jsx(Flex, { as: StyledIcon, container: { inline: true, alignItems: 'center', justify: 'center' }, id: id, children: _jsx(IconTile, { name: type?.icon.name, category: type?.icon.category, label: type?.icon.label, inverted: type?.icon.inverted, size: 'l' }) }), _jsx(StyledText, { variant: 'h4', error: error, children: label })] }), !readOnly && actionItems && (_jsx(MenuButton, { testId: menuTestId, ref: actionMenuRef, tabIndex: menuButtonFocusable, portal: true, variant: 'simple', text: t('actions'), icon: 'more', iconOnly: true, onFocus: (e) => {
81
+ setMenuButtonFocusable(focusable);
82
+ e.stopPropagation();
83
+ }, onBlur: (e) => {
84
+ setMenuButtonFocusable(notFocusable);
85
+ e.stopPropagation();
86
+ }, onClick: (e) => {
87
+ e.stopPropagation();
88
+ }, onKeyDown: (e) => {
89
+ if (nodeFocusable === notFocusable && e.key === 'Escape') {
90
+ nodeRef.current?.focus();
91
+ }
92
+ e.stopPropagation();
93
+ }, menu: menuButtonFocusable === focusable ? { items: actionItems } : undefined }))] }), description && _jsx(StyledNodeTemplateContent, { children: description }), additionalData && type.minConnectors > 0 && (_jsx(StyledNodeTemplateFooter, { children: _jsx(MetaList, { metadata: additionalData }) })), references && type.minConnectors < 1 && (_jsx(StyledNodeTemplateFooter, { children: _jsx(MetaList, { metadata: references }) }))] }));
94
+ };
95
+ export const StartNode = ({ type, label, active = false, ...restProps }) => {
96
+ const nodeRef = useRef(null);
97
+ const descriptionId = useUID();
98
+ const t = useI18n();
99
+ const { base: { palette } } = useTheme();
100
+ useEffect(() => {
101
+ if (active) {
102
+ nodeRef.current?.focus();
103
+ nodeRef.current?.scrollIntoView({
104
+ block: 'center',
105
+ behavior: 'auto'
106
+ });
107
+ }
108
+ }, [active]);
109
+ return (_jsxs(StyledStartNode, { container: { direction: 'column', alignItems: 'center', justify: 'end', rowGap: 1 }, children: [label && _jsx(Text, { variant: 'h4', children: label }), _jsx(StyledCircle, { ...restProps, ref: nodeRef, bgColor: palette.success, tabIndex: 0, "aria-label": label || flowModellerConstants.START_NODE, "aria-describedby": descriptionId, role: 'button', children: _jsx(VisuallyHiddenText, { id: descriptionId, children: t('use_arrow_keys') }) })] }));
110
+ };
111
+ export const EndNode = ({ type, label, active = false, ...restProps }) => {
112
+ const nodeRef = useRef(null);
113
+ const [endNodeFocusable, setEndNodeFocusable] = useState(notFocusable);
114
+ const { base: { palette } } = useTheme();
115
+ useEffect(() => {
116
+ if (active) {
117
+ nodeRef.current?.focus();
118
+ nodeRef.current?.scrollIntoView({
119
+ block: 'center',
120
+ behavior: 'auto'
121
+ });
122
+ }
123
+ }, [active]);
124
+ return (_jsxs(Flex, { container: { direction: 'column', alignItems: 'center', justify: 'start', rowGap: 1 }, children: [_jsx(StyledCircle, { ...restProps, ref: nodeRef, bgColor: palette.urgent, tabIndex: endNodeFocusable, "aria-label": label || flowModellerConstants.END_NODE, role: 'button', onFocus: () => {
125
+ setEndNodeFocusable(focusable);
126
+ }, onBlur: () => {
127
+ setEndNodeFocusable(notFocusable);
128
+ } }), label && _jsx(Text, { variant: 'h4', children: label })] }));
129
+ };
130
+ //# 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,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGhE,OAAO,EACL,UAAU,EACV,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,kBAAkB,EAClB,MAAM,EACN,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AACzD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EACL,YAAY,EACZ,UAAU,EACV,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EACl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Q,EAAE,MAAM;aACjB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,aACzF,KAAC,YAAY,OACP,SAAS,EACb,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,OAAO,CAAC,MAAM,EACvB,QAAQ,EAAE,gBAAgB,gBACd,KAAK,IAAI,qBAAqB,CAAC,QAAQ,EACnD,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE;oBACZ,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBACjC,CAAC,EACD,MAAM,EAAE,GAAG,EAAE;oBACX,mBAAmB,CAAC,YAAY,CAAC,CAAC;gBACpC,CAAC,GACD,EACD,KAAK,IAAI,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,GAAQ,IACtC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useContext, useRef, useEffect, useState } from 'react';\nimport type { MouseEvent, KeyboardEvent } from 'react';\n\nimport {\n MenuButton,\n Flex,\n useI18n,\n Text,\n VisuallyHiddenText,\n useUID,\n useTheme\n} from '@pega/cosmos-react-core';\n\nimport { generateDynamicTestId } from '../../../utils/utils';\nimport FlowModellerContext from '../FlowModellerContext';\nimport IconTile from '../../IconTile';\nimport { flowModellerConstants } from '../constants';\n\nimport {\n StyledCircle,\n StyledIcon,\n StyledNodeTemplateHeader,\n StyledNodeTemplateContent,\n StyledNodeTemplate,\n StyledText,\n StyledTextWithEllipsis,\n StyledAdditionalData,\n StyledNodeTemplateFooter,\n StyledAdditionalDataItem,\n StyledErrorIcon,\n StyledStartNode\n} from './NodeTemplate.styles';\nimport type {\n NodeProps,\n NodeComponentProps,\n AdditionalDataItemProps,\n NodeEvents\n} from './Node.types';\n\nconst focusable = 0;\nconst notFocusable = -1;\n\nconst MetaListItem = ({ label, value }: AdditionalDataItemProps) => {\n return (\n <Flex\n as={StyledAdditionalDataItem}\n container={{ wrap: 'nowrap', pad: 0.25, gap: 0.25 }}\n item={{ grow: 1 }}\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 );\n};\n\nconst MetaList = ({ metadata }: { metadata: NodeProps['additionalData'] }) => {\n return (\n <Flex as={StyledAdditionalData} container={{ wrap: 'nowrap', colGap: 1, rowGap: 0.25 }}>\n {metadata?.map((data: AdditionalDataItemProps, index: number) =>\n index >= 2 ? undefined : <MetaListItem key={data.id} {...data} />\n )}\n {metadata && metadata.length > 2 && (\n <Flex as={StyledAdditionalDataItem} container={{ pad: 0.25 }} item={{ grow: 1, shrink: 0 }}>\n <StyledTextWithEllipsis as='dt'>{`+${metadata.length - 2}`}</StyledTextWithEllipsis>\n </Flex>\n )}\n </Flex>\n );\n};\nexport const DefaultNode = ({\n id,\n label,\n type,\n description,\n additionalData,\n actions,\n onActionClick,\n onClick,\n onDelete,\n reference,\n error,\n selected,\n referencedNode,\n active = false,\n onKeyDown,\n ...restProps\n}: NodeComponentProps & NodeEvents) => {\n const t = useI18n();\n\n const nodeRef = useRef<HTMLDivElement>(null);\n const actionMenuRef = useRef<HTMLButtonElement>(null);\n const [nodeFocusable, setNodeFocusable] = useState(notFocusable);\n const [menuButtonFocusable, setMenuButtonFocusable] = useState(notFocusable);\n\n useEffect(() => {\n if (active) {\n nodeRef.current?.focus();\n }\n }, [active]);\n\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 onKeyDown: (e: MouseEvent) => e.stopPropagation()\n };\n });\n\n const references = referencedNode && [\n { id: referencedNode?.id, label: t('go_to_noun'), value: referencedNode?.label }\n ];\n\n if (onDelete !== undefined) {\n actionItems?.push({\n id: 'flowmodeller-delete-node',\n primary: t('delete'),\n onClick: (actionId: string, e: MouseEvent) => {\n e.stopPropagation();\n onDelete?.({ actionId, nodeId: id }, e);\n },\n onKeyDown: (e: MouseEvent) => e.stopPropagation()\n });\n }\n\n const handleEnterKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n if ((e.key === 'Enter' && !e.shiftKey) || e.key === ' ') {\n onClick?.(id, e);\n e.preventDefault();\n } else if (e.key === 'A' && e.shiftKey) {\n actionMenuRef.current?.focus();\n } else {\n onKeyDown(e);\n }\n };\n\n const { readOnly, highlights } = useContext(FlowModellerContext);\n const menuTestId = generateDynamicTestId([label]);\n\n return (\n <StyledNodeTemplate\n {...restProps}\n ref={nodeRef}\n aria-label={error ? t('step_name_error', [label]) : label}\n aria-current={selected ? 'location' : undefined}\n onClick={(e: MouseEvent) => {\n if (!e.detail) {\n return;\n }\n onClick?.(id, e);\n nodeRef.current?.scrollIntoView({\n block: 'center',\n behavior: 'smooth'\n });\n }}\n onFocus={() => {\n setNodeFocusable(focusable);\n }}\n onBlur={() => {\n setNodeFocusable(notFocusable);\n }}\n onKeyDown={handleEnterKeyDown}\n id={`modeller-node-${id}`}\n highlight={!!highlights?.nodes?.[id]}\n tabIndex={nodeFocusable}\n >\n <Flex\n as={StyledNodeTemplateHeader}\n container={{ alignItems: 'center', pad: 1, justify: 'between' }}\n >\n <Flex container={{ alignItems: 'center' }}>\n {error && <StyledErrorIcon name='warn-solid' />}\n <Flex\n as={StyledIcon}\n container={{ inline: true, alignItems: 'center', justify: 'center' }}\n id={id}\n >\n <IconTile\n name={type?.icon.name}\n category={type?.icon.category}\n label={type?.icon.label}\n inverted={type?.icon.inverted}\n size='l'\n />\n </Flex>\n <StyledText variant='h4' error={error}>\n {label}\n </StyledText>\n </Flex>\n {!readOnly && actionItems && (\n <MenuButton\n testId={menuTestId}\n ref={actionMenuRef}\n tabIndex={menuButtonFocusable}\n portal\n variant='simple'\n text={t('actions')}\n icon='more'\n iconOnly\n onFocus={(e: KeyboardEvent) => {\n setMenuButtonFocusable(focusable);\n e.stopPropagation();\n }}\n onBlur={(e: KeyboardEvent) => {\n setMenuButtonFocusable(notFocusable);\n e.stopPropagation();\n }}\n onClick={(e: MouseEvent) => {\n e.stopPropagation();\n }}\n onKeyDown={(e: KeyboardEvent) => {\n if (nodeFocusable === notFocusable && e.key === 'Escape') {\n nodeRef.current?.focus();\n }\n e.stopPropagation();\n }}\n menu={menuButtonFocusable === focusable ? { items: actionItems } : undefined}\n />\n )}\n </Flex>\n {description && <StyledNodeTemplateContent>{description}</StyledNodeTemplateContent>}\n {additionalData && type.minConnectors > 0 && (\n <StyledNodeTemplateFooter>\n <MetaList metadata={additionalData} />\n </StyledNodeTemplateFooter>\n )}\n {references && type.minConnectors < 1 && (\n <StyledNodeTemplateFooter>\n <MetaList metadata={references} />\n </StyledNodeTemplateFooter>\n )}\n </StyledNodeTemplate>\n );\n};\n\nexport const StartNode = ({\n type,\n label,\n active = false,\n ...restProps\n}: NodeProps & NodeEvents) => {\n const nodeRef = useRef<HTMLDivElement>(null);\n const descriptionId = useUID();\n const t = useI18n();\n const {\n base: { palette }\n } = useTheme();\n\n useEffect(() => {\n if (active) {\n nodeRef.current?.focus();\n nodeRef.current?.scrollIntoView({\n block: 'center',\n behavior: 'auto'\n });\n }\n }, [active]);\n\n return (\n <StyledStartNode\n container={{ direction: 'column', alignItems: 'center', justify: 'end', rowGap: 1 }}\n >\n {label && <Text variant='h4'>{label}</Text>}\n <StyledCircle\n {...restProps}\n ref={nodeRef}\n bgColor={palette.success}\n tabIndex={0}\n aria-label={label || flowModellerConstants.START_NODE}\n aria-describedby={descriptionId}\n role='button'\n >\n <VisuallyHiddenText id={descriptionId}>{t('use_arrow_keys')}</VisuallyHiddenText>\n </StyledCircle>\n </StyledStartNode>\n );\n};\n\nexport const EndNode = ({ type, label, active = false, ...restProps }: NodeProps & NodeEvents) => {\n const nodeRef = useRef<HTMLDivElement>(null);\n const [endNodeFocusable, setEndNodeFocusable] = useState(notFocusable);\n const {\n base: { palette }\n } = useTheme();\n useEffect(() => {\n if (active) {\n nodeRef.current?.focus();\n nodeRef.current?.scrollIntoView({\n block: 'center',\n behavior: 'auto'\n });\n }\n }, [active]);\n\n return (\n <Flex container={{ direction: 'column', alignItems: 'center', justify: 'start', rowGap: 1 }}>\n <StyledCircle\n {...restProps}\n ref={nodeRef}\n bgColor={palette.urgent}\n tabIndex={endNodeFocusable}\n aria-label={label || flowModellerConstants.END_NODE}\n role='button'\n onFocus={() => {\n setEndNodeFocusable(focusable);\n }}\n onBlur={() => {\n setEndNodeFocusable(notFocusable);\n }}\n />\n {label && <Text variant='h4'>{label}</Text>}\n </Flex>\n );\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import type { NodeEvents, NodeLabels } from './Node/Node.types';
2
+ import type { PlottedGraphNode } from './Renderer/Utils/GraphLayout';
3
+ type NodeProps = PlottedGraphNode & NodeEvents & NodeLabels;
4
+ declare const _default: import("react").NamedExoticComponent<PlottedGraphNode<unknown> & NodeEvents & NodeLabels> & {
5
+ readonly type: (props: NodeProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ } & {
7
+ getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly string[]>;
8
+ };
9
+ export default _default;
10
+ //# sourceMappingURL=Node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Node.d.ts","sourceRoot":"","sources":["../../../src/components/FlowModeller/Node.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,UAAU,EACV,UAAU,EAGX,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,KAAK,SAAS,GAAG,gBAAgB,GAAG,UAAU,GAAG,UAAU,CAAC;;2BAWlC,SAAS;;;;AA8EnC,wBAAiD"}
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo, useCallback } from 'react';
3
+ import { useTestIds, withTestIds } from '@pega/cosmos-react-core';
4
+ import { generateDynamicTestId } from '../../utils/utils';
5
+ import { START_NODETYPE, END_NODETYPE } from './Node/Node.types';
6
+ import { DefaultNode, EndNode, StartNode } from './Node/NodeTemplates';
7
+ import { getNodeTestIds } from './FlowModeller.test-ids';
8
+ const isNodeComponentData = (d) => typeof d === 'object' && d !== null;
9
+ const isFlowNodeType = (t) => t !== undefined && 'id' in t && 'icon' in t && 'defaults' in t;
10
+ const isFullNodeProps = (n) => typeof n === 'object' && n !== null && 'id' in n && 'label' in n;
11
+ const Node = memo((props) => {
12
+ const { id, type: rawType, label = '', fromNodeLabel, toNodeLabel, data: rawData, referencedNode: rawReferencedNode, ...restProps } = props;
13
+ const data = isNodeComponentData(rawData) ? rawData : undefined;
14
+ const type = isFlowNodeType(rawType) ? rawType : undefined;
15
+ const referencedNode = isFullNodeProps(rawReferencedNode) ? rawReferencedNode : undefined;
16
+ let stepTestID = '';
17
+ if (type?.id === START_NODETYPE.id || type?.id === END_NODETYPE.id) {
18
+ stepTestID = generateDynamicTestId([label]);
19
+ }
20
+ else {
21
+ stepTestID = generateDynamicTestId([
22
+ fromNodeLabel ? `from-${fromNodeLabel}` : 'from-merge',
23
+ toNodeLabel ? `to-${toNodeLabel}` : 'to-branch-end',
24
+ label
25
+ ]);
26
+ }
27
+ const testIds = useTestIds(stepTestID, getNodeTestIds);
28
+ const clickHandler = useCallback((nodeId, e) => {
29
+ data?.onClick?.(nodeId, e);
30
+ }, [data?.onClick]);
31
+ if (!type) {
32
+ return null;
33
+ }
34
+ if (type.id === START_NODETYPE.id) {
35
+ return (_jsx(StartNode, { "data-testid": testIds.root, ...restProps, id: id, type: type, label: label.toUpperCase() }));
36
+ }
37
+ if (type.id === END_NODETYPE.id) {
38
+ return (_jsx(EndNode, { "data-testid": testIds.root, ...restProps, id: id, type: type, label: label.toUpperCase() }));
39
+ }
40
+ return (_jsx(DefaultNode, { "data-testid": testIds.root, ...restProps, id: id, label: label, type: type, referencedNode: referencedNode, onClick: clickHandler, onDelete: data?.onDelete, onActionClick: data?.onActionClick, actions: data?.actions, selected: data?.selected }));
41
+ });
42
+ export default withTestIds(Node, getNodeTestIds);
43
+ //# sourceMappingURL=Node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Node.js","sourceRoot":"","sources":["../../../src/components/FlowModeller/Node.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAS1D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIzD,MAAM,mBAAmB,GAAG,CAAC,CAAU,EAA0B,EAAE,CACjE,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC;AAEtC,MAAM,cAAc,GAAG,CAAC,CAA2B,EAAqB,EAAE,CACxE,CAAC,KAAK,SAAS,IAAI,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,UAAU,IAAI,CAAC,CAAC;AAEjE,MAAM,eAAe,GAAG,CAAC,CAAU,EAAsB,EAAE,CACzD,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC;AAEnE,MAAM,IAAI,GAAG,IAAI,CAAC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,CAChB,CAAC;IAEF,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,IAAI,CAAC,EAAE,KAAK,cAAc,CAAC,EAAE,EAAE,CAAC;QAClC,OAAO,CACL,KAAC,SAAS,mBACK,OAAO,CAAC,IAAI,KACrB,SAAS,EACb,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,GAC1B,CACH,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,CAAC,EAAE,KAAK,YAAY,CAAC,EAAE,EAAE,CAAC;QAChC,OAAO,CACL,KAAC,OAAO,mBACO,OAAO,CAAC,IAAI,KACrB,SAAS,EACb,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,GAC1B,CACH,CAAC;IACJ,CAAC;IACD,OAAO,CACL,KAAC,WAAW,mBACG,OAAO,CAAC,IAAI,KACrB,SAAS,EACb,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,IAAI,EAAE,QAAQ,EACxB,aAAa,EAAE,IAAI,EAAE,aAAa,EAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EACtB,QAAQ,EAAE,IAAI,EAAE,QAAQ,GACxB,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { memo, useCallback } from 'react';\nimport type { MouseEvent, KeyboardEvent } from 'react';\n\nimport { useTestIds, withTestIds } from '@pega/cosmos-react-core';\n\nimport { generateDynamicTestId } from '../../utils/utils';\n\nimport type {\n NodeComponentData,\n NodeEvents,\n NodeLabels,\n NodeProps as FullNodeProps,\n NodeType as FlowNodeType\n} from './Node/Node.types';\nimport { START_NODETYPE, END_NODETYPE } from './Node/Node.types';\nimport { DefaultNode, EndNode, StartNode } from './Node/NodeTemplates';\nimport type { PlottedGraphNode } from './Renderer/Utils/GraphLayout';\nimport { getNodeTestIds } from './FlowModeller.test-ids';\n\ntype NodeProps = PlottedGraphNode & NodeEvents & NodeLabels;\n\nconst isNodeComponentData = (d: unknown): d is NodeComponentData =>\n typeof d === 'object' && d !== null;\n\nconst isFlowNodeType = (t: PlottedGraphNode['type']): t is FlowNodeType =>\n t !== undefined && 'id' in t && 'icon' in t && 'defaults' in t;\n\nconst isFullNodeProps = (n: unknown): n is FullNodeProps =>\n typeof n === 'object' && n !== null && 'id' in n && 'label' in n;\n\nconst Node = memo((props: NodeProps) => {\n const {\n id,\n type: rawType,\n label = '',\n fromNodeLabel,\n toNodeLabel,\n data: rawData,\n referencedNode: rawReferencedNode,\n ...restProps\n } = props;\n\n const data = isNodeComponentData(rawData) ? rawData : undefined;\n const type = isFlowNodeType(rawType) ? rawType : undefined;\n const referencedNode = isFullNodeProps(rawReferencedNode) ? rawReferencedNode : undefined;\n\n let stepTestID = '';\n if (type?.id === START_NODETYPE.id || type?.id === END_NODETYPE.id) {\n stepTestID = generateDynamicTestId([label]);\n } else {\n stepTestID = generateDynamicTestId([\n fromNodeLabel ? `from-${fromNodeLabel}` : 'from-merge',\n toNodeLabel ? `to-${toNodeLabel}` : 'to-branch-end',\n label\n ]);\n }\n const testIds = useTestIds(stepTestID, getNodeTestIds);\n\n const clickHandler = useCallback(\n (nodeId: string, e: MouseEvent<Element> | KeyboardEvent<Element>) => {\n data?.onClick?.(nodeId, e);\n },\n [data?.onClick]\n );\n\n if (!type) {\n return null;\n }\n\n if (type.id === START_NODETYPE.id) {\n return (\n <StartNode\n data-testid={testIds.root}\n {...restProps}\n id={id}\n type={type}\n label={label.toUpperCase()}\n />\n );\n }\n if (type.id === END_NODETYPE.id) {\n return (\n <EndNode\n data-testid={testIds.root}\n {...restProps}\n id={id}\n type={type}\n label={label.toUpperCase()}\n />\n );\n }\n return (\n <DefaultNode\n data-testid={testIds.root}\n {...restProps}\n id={id}\n label={label}\n type={type}\n referencedNode={referencedNode}\n onClick={clickHandler}\n onDelete={data?.onDelete}\n onActionClick={data?.onActionClick}\n actions={data?.actions}\n selected={data?.selected}\n />\n );\n});\n\nexport default withTestIds(Node, getNodeTestIds);\n"]}
@@ -0,0 +1,4 @@
1
+ import type { RendererProps } from './Renderer.types';
2
+ declare const Renderer: ({ graphData, connector: Connector, node: Node, selectedNodeId }: RendererProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default Renderer;
4
+ //# sourceMappingURL=Renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Renderer/Renderer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA8CtD,QAAA,MAAM,QAAQ,GAAI,iEAKf,aAAa,4CAuPf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,198 @@
1
+ import { createElement as _createElement } from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useContext, useEffect, useMemo, useRef, useState } from 'react';
4
+ import styled, { css } from 'styled-components';
5
+ import { Flex, defaultThemeProp } from '@pega/cosmos-react-core';
6
+ import FlowModellerContext from '../FlowModellerContext';
7
+ import GraphLayout from './Utils/GraphLayout';
8
+ import { DirectedGraph } from './Utils/Graph';
9
+ import GraphTraversal from './Utils/GraphTraversal';
10
+ import { getParentConvergence, groupByPosition, arrowUpKey, arrowDownKey, horizontalNavigation } from './Utils/RendererUtils';
11
+ const StyledWrapper = styled.div `
12
+ position: relative;
13
+ width: 100%;
14
+ height: 100%;
15
+ `;
16
+ const StyledContentWrapper = styled.div(({ theme }) => {
17
+ return css `
18
+ position: absolute;
19
+ top: 0;
20
+ left: 0;
21
+ width: 100%;
22
+ background-color: ${theme.base.palette['app-background']};
23
+ > svg {
24
+ background-color: ${theme.base.palette['app-background']};
25
+ }
26
+ `;
27
+ });
28
+ StyledContentWrapper.defaultProps = defaultThemeProp;
29
+ const StyledNodeWrapper = styled(StyledContentWrapper)(() => {
30
+ return css `
31
+ width: var(--width);
32
+ height: var(--height);
33
+ transform: translate(var(--xPos), var(--yPos));
34
+ `;
35
+ });
36
+ const StyledRootNodeWrapper = styled.foreignObject `
37
+ overflow: visible;
38
+ `;
39
+ const Renderer = ({ graphData, connector: Connector, node: Node, selectedNodeId }) => {
40
+ // apply the plotted positions
41
+ const { readOnly } = useContext(FlowModellerContext);
42
+ const graph = new DirectedGraph(graphData);
43
+ const rootNode = useMemo(() => {
44
+ const rootNodeId = GraphTraversal.findRootNode(graph);
45
+ return rootNodeId ? graph.getNode(rootNodeId) : undefined;
46
+ }, [graph]);
47
+ const graphDimensions = GraphLayout.plot(graphData, readOnly);
48
+ const positions = useMemo(() => groupByPosition(graph), [graph]);
49
+ const [activeGraphItemId, setActiveGraphItemId] = useState();
50
+ const rendererRef = useRef(null);
51
+ const prevItem = useRef();
52
+ const prevSelectedNodeId = useRef();
53
+ const activeGraphItem = useMemo(() => [...graph.getNodes(), ...graph.getConnectors()].find(data => {
54
+ return data.id === activeGraphItemId;
55
+ }), [activeGraphItemId, graph]);
56
+ useEffect(() => {
57
+ // Set PREVIOUS Connector - If current focused item is a node, we are saving the previous connector id.
58
+ let inConnectors = activeGraphItem ? graph.getInConnectors(activeGraphItem.id) : [];
59
+ if (activeGraphItem &&
60
+ 'dimensions' in activeGraphItem &&
61
+ activeGraphItem.dimensions?.height &&
62
+ inConnectors.length) {
63
+ const prevNode = graph.getNode(inConnectors[0].fromNodeId);
64
+ inConnectors = !prevNode.dimensions.height
65
+ ? graph.getInConnectors(prevNode.id)
66
+ : inConnectors;
67
+ const parentConvergence = getParentConvergence(prevNode, graph);
68
+ if (inConnectors.length) {
69
+ prevItem.current =
70
+ !prevNode.dimensions.height && inConnectors.length > 1 && parentConvergence
71
+ ? parentConvergence.parent.id
72
+ : inConnectors[0].id;
73
+ }
74
+ }
75
+ /** DELETE NODE - If no item is found and prevItem has a value then we assume that a node has been deleted
76
+ * set activeGraphItemId to prevItem and reset it
77
+ */
78
+ if (!activeGraphItem && prevItem.current && !selectedNodeId) {
79
+ const convergence = GraphTraversal.getConvergenceData(graphData, prevItem.current);
80
+ setActiveGraphItemId(convergence ? graph.getOutConnectors(convergence.nodeId)[0].id : prevItem.current);
81
+ prevItem.current = undefined;
82
+ }
83
+ }, [activeGraphItemId, graph]);
84
+ const elementScrollIntoView = (focusElementId) => {
85
+ const isConnector = graphData?.connectors?.find(item => item.id === focusElementId);
86
+ const elementRef = isConnector
87
+ ? rendererRef.current?.querySelector(`[id='${focusElementId}']`)?.nextElementSibling
88
+ : rendererRef.current?.querySelector(`[id='modeller-node-${focusElementId}']`);
89
+ if (elementRef) {
90
+ setTimeout(() => {
91
+ elementRef.scrollIntoView({
92
+ block: 'center',
93
+ behavior: 'smooth'
94
+ });
95
+ });
96
+ }
97
+ };
98
+ const onKeyDown = (e) => {
99
+ if (activeGraphItemId &&
100
+ activeGraphItem &&
101
+ ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(e.key) &&
102
+ !selectedNodeId) {
103
+ let focusElementId;
104
+ switch (e.key) {
105
+ case 'ArrowUp':
106
+ focusElementId = arrowUpKey({
107
+ activeGraphItemId,
108
+ graph,
109
+ activeGraphItem,
110
+ readOnly: readOnly ?? false
111
+ });
112
+ break;
113
+ case 'ArrowDown':
114
+ focusElementId = arrowDownKey({
115
+ activeGraphItemId,
116
+ graph,
117
+ activeGraphItem,
118
+ readOnly: readOnly ?? false
119
+ });
120
+ break;
121
+ case 'ArrowLeft':
122
+ focusElementId = horizontalNavigation({
123
+ keyEvent: 'ArrowLeft',
124
+ positions,
125
+ activeGraphItem,
126
+ graph,
127
+ readOnly
128
+ });
129
+ break;
130
+ case 'ArrowRight':
131
+ focusElementId = horizontalNavigation({
132
+ keyEvent: 'ArrowRight',
133
+ positions,
134
+ activeGraphItem,
135
+ graph,
136
+ readOnly
137
+ });
138
+ break;
139
+ default:
140
+ break;
141
+ }
142
+ if (focusElementId) {
143
+ setActiveGraphItemId(focusElementId);
144
+ elementScrollIntoView(focusElementId);
145
+ }
146
+ }
147
+ };
148
+ /** Saving the last selectedNodeId in a variable
149
+ * so on close of workbench the focus can return to the node
150
+ * might be removed in future when workbench handles re-focusing the target element on close
151
+ */
152
+ useEffect(() => {
153
+ if (selectedNodeId) {
154
+ prevSelectedNodeId.current = selectedNodeId;
155
+ }
156
+ else if (!selectedNodeId && prevSelectedNodeId.current) {
157
+ setActiveGraphItemId(prevSelectedNodeId.current);
158
+ prevSelectedNodeId.current = undefined;
159
+ }
160
+ }, [selectedNodeId]);
161
+ const getNodeLabel = (target) => {
162
+ if (target) {
163
+ const targetNode = graphData.nodes.find(nodeItem => nodeItem.id === target);
164
+ return targetNode && 'label' in targetNode ? String(targetNode.label) : undefined;
165
+ }
166
+ return target;
167
+ };
168
+ return (_jsxs(StyledWrapper, { ref: rendererRef, children: [_jsx(StyledContentWrapper, { children: _jsxs("svg", { width: graphDimensions.width, height: graphDimensions.height, viewBox: `0 0 ${graphDimensions.width} ${graphDimensions.height}`, children: [rootNode && (_jsx(StyledRootNodeWrapper, { width: rootNode.dimensions.width, height: rootNode.dimensions.height, x: rootNode.position.x, y: rootNode.position.y, children: _jsx(Node, { ...rootNode, active: rootNode.id === activeGraphItemId, onFocus: () => {
169
+ setActiveGraphItemId(rootNode.id);
170
+ }, onKeyDown: onKeyDown }) })), graphData.connectors.map(item => {
171
+ const fromNodeLabel = getNodeLabel(item.fromNodeId);
172
+ const toNodeLabel = getNodeLabel(item.toNodeId);
173
+ return (_createElement(Connector, { ...item, fromNodeLabel: fromNodeLabel, toNodeLabel: toNodeLabel, key: item.id, active: item.id === activeGraphItemId, onFocus: () => {
174
+ setActiveGraphItemId(item.id);
175
+ }, onKeyDown: onKeyDown }));
176
+ })] }) }), _jsx(StyledContentWrapper, { children: graphData.nodes
177
+ .filter(node => node.id !== rootNode?.id)
178
+ .map(item => {
179
+ let referencedNode;
180
+ if (item.type?.minConnectors === 0 && item.reference) {
181
+ referencedNode = graph.getNode(item.reference);
182
+ }
183
+ const prevNodeId = graphData.connectors.find(connector => connector.toNodeId === item.id)?.fromNodeId;
184
+ const fromNodeLabel = getNodeLabel(prevNodeId);
185
+ const nextNodeId = graphData.connectors.find(connector => connector.fromNodeId === item.id)?.toNodeId;
186
+ const toNodeLabel = getNodeLabel(nextNodeId);
187
+ return (_jsx(Flex, { as: StyledNodeWrapper, id: item.id, style: {
188
+ '--width': `${item.dimensions.width}px`,
189
+ '--height': `${item.dimensions.height}px`,
190
+ '--xPos': `${item.position.x}px`,
191
+ '--yPos': `${item.position.y}px`
192
+ }, container: { justify: 'center' }, children: _jsx(Node, { ...item, fromNodeLabel: fromNodeLabel, toNodeLabel: toNodeLabel, referencedNode: referencedNode, active: item.id === activeGraphItemId, onFocus: () => {
193
+ setActiveGraphItemId(item.id);
194
+ }, onKeyDown: onKeyDown }) }, item.id));
195
+ }) })] }));
196
+ };
197
+ export default Renderer;
198
+ //# sourceMappingURL=Renderer.js.map