@pega/cosmos-react-build 9.0.0-build.9.9 → 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
@@ -1 +1 @@
1
- {"version":3,"file":"BackgroundPicker.styles.d.ts","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/BackgroundPicker.styles.ts"],"names":[],"mappings":"AAAA,OAAe,EAAO,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAA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;;;;sOAU7B,CAAC;AAIH,eAAO,MAAM,UAAU;;yLAEtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BackgroundPicker.styles.js","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/BackgroundPicker.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAqB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGpD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,UAAU,EACV,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,WAAW,MAAM,2DAA2D,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAI7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAG9C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EACP,MAAM,EAAE,EAAE,MAAM,EAAE,EAClB,MAAM,EAAE,EAAE,KAAK,EAAE,EACjB,aAAa,EAAE,UAAU,EACzB,WAAW,EAAE,QAAQ,EACrB,YAAY,EAAE,SAAS,EACxB,EACD,UAAU,EAAE,EACV,KAAK,EAAE,EAAE,MAAM,EAAE,EACjB,cAAc,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,EAC7E,EACF,EACD,UAAU,EACV,KAAK,EACN,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEzD,OAAO,GAAG,CAAA;QACN,iBAAiB;;wBAED,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,cAAc,WAAW,GAAG,CAAC,CAAC,CAAC,WAAW;wBAC7D,KAAK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BAAgB;CACnB,CAAC","sourcesContent":["import styled, { css, type DefaultTheme } from 'styled-components';\nimport { hideVisually, parseToRgb } from 'polished';\nimport type { RgbaColor } from 'polished/lib/types/color';\n\nimport {\n calculateFontSize,\n StyledFormControl,\n defaultThemeProp,\n Flex,\n StyledCard,\n Text,\n StyledIcon,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport StyledInput from '@pega/cosmos-react-core/lib/components/Input/Input.styles';\nimport { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';\n\nimport type { BackgroundPickerPropsWithDefaults } from './BackgroundPicker.types';\n\nexport const StyledBackgroundPicker = styled.div<\n Pick<BackgroundPickerPropsWithDefaults, 'swatchOnly' | 'value'>\n>(\n ({\n theme: {\n base: {\n spacing,\n colors: { purple },\n shadow: { focus },\n 'font-family': fontFamily,\n 'font-size': fontSize,\n 'font-scale': fontScale\n },\n components: {\n input: { height },\n 'form-control': { 'border-width': borderWidth, 'border-color': borderColor }\n }\n },\n swatchOnly,\n value\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n ${StyledFormControl} {\n overflow: hidden;\n border-width: ${value === 'auto' ? `calc(1.5 * ${borderWidth})` : borderWidth};\n border-style: ${value === 'auto' ? 'dotted' : 'solid'};\n\n ${value === 'auto' &&\n css`\n border-color: ${purple.medium};\n `}\n\n ${!swatchOnly &&\n css`\n min-width: calc(16 * ${spacing});\n `}\n\n ${!swatchOnly &&\n css`\n padding-inline-end: ${spacing};\n `}\n\n &:focus-within {\n box-shadow: ${focus};\n border: none;\n }\n\n &:hover:not([readonly]):not([disabled]):not(:focus, :focus-within) {\n ${value === 'auto' &&\n css`\n border-color: ${purple.dark};\n `}\n }\n\n & > input {\n ${hideVisually}\n\n & + div {\n height: calc(${height} - (2 * ${borderWidth}));\n\n ${swatchOnly\n ? css`\n width: calc(${height} - (2 * ${borderWidth}));\n `\n : css`\n min-width: calc(${height} - ${borderWidth});\n margin-inline-end: ${spacing};\n border-inline-end: ${borderWidth} solid ${borderColor};\n `}\n }\n\n &:focus + div {\n width: ${height};\n height: ${height};\n }\n }\n\n & input {\n height: 2rem;\n min-height: 2rem;\n color: #000000;\n background-color: #ffffff;\n font-size: ${fontSizes.s};\n font-family: ${fontFamily};\n\n & + label {\n font-weight: 600;\n color: rgba(0, 0, 0, 0.6);\n font-size: ${fontSizes.s};\n font-family: ${fontFamily};\n }\n }\n }\n `;\n }\n);\n\nStyledBackgroundPicker.defaultProps = defaultThemeProp;\n\nexport const ColorSwatchPreview = styled.div(\n ({\n value,\n theme: {\n base: {\n colors: { purple }\n }\n }\n }: {\n value: string;\n theme: DefaultTheme;\n }) => {\n const rgb = tryCatch(() => parseToRgb(value));\n\n let background = value;\n if (value === 'auto') {\n background = 'transparent';\n } else if (value === 'transparent' || (rgb && (rgb as RgbaColor).alpha === 0)) {\n // Red slash to denote transparent or no color\n background =\n 'linear-gradient(137deg,#ffffff 0%,#ffffff 50%,#ff0000 54%,#ffffff 58%,#ffffff 100%)';\n }\n\n return css`\n background: repeating-conic-gradient(#dddddd 0% 25%, transparent 0% 50%) 0 0 / 0.5rem 0.5rem;\n position: relative;\n\n & ${StyledIcon} {\n width: 50%;\n height: 50%;\n z-index: 1;\n fill: ${purple.dark};\n }\n\n &::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n background: ${background};\n }\n `;\n }\n);\n\nColorSwatchPreview.defaultProps = defaultThemeProp;\n\nexport const StyledPreviewContainer = styled.div(({ theme }) => {\n return css`\n background: repeating-conic-gradient(#dddddd 0% 25%, transparent 0% 50%) 0 0 / 0.5rem 0.5rem;\n height: ${theme.base['content-width'].xs};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n position: relative;\n `;\n});\n\nStyledPreviewContainer.defaultProps = defaultThemeProp;\n\nexport const StyledPreview = styled.div<{ background: string }>(({ background }) => {\n return css`\n background: ${background};\n width: 100%;\n height: 100%;\n `;\n});\n\nexport const StyledFlex = styled(Flex)`\n ${StyledCard} {\n width: 100%;\n }\n\n &&& ${StyledCardContent} {\n padding: 0;\n }\n`;\n\nexport const StyledTableWrapper = styled(Flex)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n ${StyledInput} {\n width: calc(6 * ${spacing});\n }\n `;\n});\n\nStyledTableWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledText = styled(Text)`\n ${ellipsisOverflow}\n`;\n"]}
1
+ {"version":3,"file":"BackgroundPicker.styles.js","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/BackgroundPicker.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGpD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,UAAU,EACV,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,WAAW,MAAM,2DAA2D,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAI7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAG9C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EACP,MAAM,EAAE,EAAE,MAAM,EAAE,EAClB,MAAM,EAAE,EAAE,KAAK,EAAE,EACjB,aAAa,EAAE,UAAU,EACzB,WAAW,EAAE,QAAQ,EACrB,YAAY,EAAE,SAAS,EACxB,EACD,UAAU,EAAE,EACV,KAAK,EAAE,EAAE,MAAM,EAAE,EACjB,cAAc,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,EAC7E,EACF,EACD,UAAU,EACV,KAAK,EACN,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AAE,EAAE;IACH,OAAO,GAAG,CAAA;MACN,WAAW;wBACO,OAAO;;GAE5B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAClC,gBAAgB;CACnB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { hideVisually, parseToRgb } from 'polished';\nimport type { RgbaColor } from 'polished/lib/types/color';\n\nimport {\n calculateFontSize,\n StyledFormControl,\n defaultThemeProp,\n Flex,\n StyledCard,\n Text,\n StyledIcon,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport StyledInput from '@pega/cosmos-react-core/lib/components/Input/Input.styles';\nimport { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';\n\nimport type { BackgroundPickerPropsWithDefaults } from './BackgroundPicker.types';\n\nexport const StyledBackgroundPicker = styled.div<\n Pick<BackgroundPickerPropsWithDefaults, 'swatchOnly' | 'value'>\n>(\n ({\n theme: {\n base: {\n spacing,\n colors: { purple },\n shadow: { focus },\n 'font-family': fontFamily,\n 'font-size': fontSize,\n 'font-scale': fontScale\n },\n components: {\n input: { height },\n 'form-control': { 'border-width': borderWidth, 'border-color': borderColor }\n }\n },\n swatchOnly,\n value\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n ${StyledFormControl} {\n overflow: hidden;\n border-width: ${value === 'auto' ? `calc(1.5 * ${borderWidth})` : borderWidth};\n border-style: ${value === 'auto' ? 'dotted' : 'solid'};\n\n ${value === 'auto' &&\n css`\n border-color: ${purple.medium};\n `}\n\n ${!swatchOnly &&\n css`\n min-width: calc(16 * ${spacing});\n `}\n\n ${!swatchOnly &&\n css`\n padding-inline-end: ${spacing};\n `}\n\n &:focus-within {\n box-shadow: ${focus};\n border: none;\n }\n\n &:hover:not([readonly]):not([disabled]):not(:focus, :focus-within) {\n ${value === 'auto' &&\n css`\n border-color: ${purple.dark};\n `}\n }\n\n & > input {\n ${hideVisually}\n\n & + div {\n height: calc(${height} - (2 * ${borderWidth}));\n\n ${swatchOnly\n ? css`\n width: calc(${height} - (2 * ${borderWidth}));\n `\n : css`\n min-width: calc(${height} - ${borderWidth});\n margin-inline-end: ${spacing};\n border-inline-end: ${borderWidth} solid ${borderColor};\n `}\n }\n\n &:focus + div {\n width: ${height};\n height: ${height};\n }\n }\n\n & input {\n height: 2rem;\n min-height: 2rem;\n color: #000000;\n background-color: #ffffff;\n font-size: ${fontSizes.s};\n font-family: ${fontFamily};\n\n & + label {\n font-weight: 600;\n color: rgba(0, 0, 0, 0.6);\n font-size: ${fontSizes.s};\n font-family: ${fontFamily};\n }\n }\n }\n `;\n }\n);\n\nStyledBackgroundPicker.defaultProps = defaultThemeProp;\n\nexport const ColorSwatchPreview = styled.div<{ value: string }>(\n ({\n value,\n theme: {\n base: {\n colors: { purple }\n }\n }\n }) => {\n const rgb = tryCatch(() => parseToRgb(value));\n\n let background = value;\n if (value === 'auto') {\n background = 'transparent';\n } else if (value === 'transparent' || (rgb && (rgb as RgbaColor).alpha === 0)) {\n // Red slash to denote transparent or no color\n background =\n 'linear-gradient(137deg,#ffffff 0%,#ffffff 50%,#ff0000 54%,#ffffff 58%,#ffffff 100%)';\n }\n\n return css`\n background: repeating-conic-gradient(#dddddd 0% 25%, transparent 0% 50%) 0 0 / 0.5rem 0.5rem;\n position: relative;\n\n & ${StyledIcon} {\n width: 50%;\n height: 50%;\n z-index: 1;\n fill: ${purple.dark};\n }\n\n &::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n background: ${background};\n }\n `;\n }\n);\n\nColorSwatchPreview.defaultProps = defaultThemeProp;\n\nexport const StyledPreviewContainer = styled.div(({ theme }) => {\n return css`\n background: repeating-conic-gradient(#dddddd 0% 25%, transparent 0% 50%) 0 0 / 0.5rem 0.5rem;\n height: ${theme.base['content-width'].xs};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n position: relative;\n `;\n});\n\nStyledPreviewContainer.defaultProps = defaultThemeProp;\n\nexport const StyledPreview = styled.div<{ background: string }>(({ background }) => {\n return css`\n background: ${background};\n width: 100%;\n height: 100%;\n `;\n});\n\nexport const StyledFlex = styled(Flex)`\n ${StyledCard} {\n width: 100%;\n }\n\n &&& ${StyledCardContent} {\n padding: 0;\n }\n`;\n\nexport const StyledTableWrapper = styled(Flex)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n ${StyledInput} {\n width: calc(6 * ${spacing});\n }\n `;\n});\n\nStyledTableWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledText = styled(Text)`\n ${ellipsisOverflow}\n`;\n"]}
@@ -1,9 +1,13 @@
1
1
  import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
2
2
  import type { DynamicContentEditorProps } from './DynamicContentEditor.types';
3
- export declare const StyledSearchPopover: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
3
+ export declare const StyledSearchPopover: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "offset" | "portal"> & {
4
4
  offset?: number;
5
5
  portal?: boolean;
6
- }, never>;
7
- declare const DynamicContentEditor: ForwardRefForwardPropsComponent<DynamicContentEditorProps>;
8
- export default DynamicContentEditor;
6
+ }, "ref"> & {
7
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
8
+ }, never>> & string;
9
+ declare const _default: ForwardRefForwardPropsComponent<DynamicContentEditorProps> & {
10
+ getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["root", "insert-field", "insert-field-modal", "insert-field-modal-cancel", "insert-field-modal-submit"]>;
11
+ };
12
+ export default _default;
9
13
  //# sourceMappingURL=DynamicContentEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicContentEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,+BAA+B,EAIhC,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,yBAAyB,EAAY,MAAM,8BAA8B,CAAC;AAOxF,eAAO,MAAM,mBAAmB;;;SAE/B,CAAC;AAIF,QAAA,MAAM,oBAAoB,EAAE,+BAA+B,CAAC,yBAAyB,CA0TpF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"DynamicContentEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,+BAA+B,EAGhC,MAAM,yBAAyB,CAAC;AAKjC,OAAO,KAAK,EAAE,yBAAyB,EAAwB,MAAM,8BAA8B,CAAC;AAUpG,eAAO,MAAM,mBAAmB;;;;;mBAE/B,CAAC;;;;AAoWF,wBAAiF"}
@@ -2,21 +2,25 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { forwardRef, useRef, useEffect, useState } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { Editor } from '@pega/cosmos-react-rte';
5
- import { Button, defaultThemeProp, Menu, menuHelpers, Modal, Popover, StyledPopover, useModalManager, useConsolidatedRef, useI18n, useUID } from '@pega/cosmos-react-core';
5
+ import { Button, defaultThemeProp, Menu, menuHelpers, Modal, Popover, StyledPopover, useModalManager, useConsolidatedRef, useI18n, useUID, useTestIds, withTestIds, registerIcon } from '@pega/cosmos-react-core';
6
+ import * as codeIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/code.icon';
6
7
  import { getKeyCommand } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/Toolbar/utils';
8
+ import { isFieldMenuItem } from './DynamicContentEditor.types';
7
9
  import { pegaReferenceElementStyle, createPegaReferenceElement } from './PegaCustomElement';
10
+ import { getDynamicContentEditorTestIds } from './DynamicContentEditor.test-ids';
11
+ registerIcon(codeIcon);
8
12
  const StyledDynamicContentEditor = styled.div ``;
9
13
  export const StyledSearchPopover = styled(StyledPopover) `
10
14
  min-width: 20rem;
11
15
  `;
12
16
  StyledDynamicContentEditor.defaultProps = defaultThemeProp;
13
- const DynamicContentEditor = forwardRef(function DynamicContentEditor({ form: { dynamicContentPicker, onSubmit }, onActiveFieldChange, label, toolbar, fieldItems, defaultValue, onBlur, ...restProps }, ref) {
17
+ const DynamicContentEditor = forwardRef(function DynamicContentEditor({ testId, form: { dynamicContentPicker, onSubmit }, onActiveFieldChange, label, toolbar, fieldItems, defaultValue, onBlur, onKeyDown: onKeyDownProp, customActions = [], customComponents = [], ...restProps }, ref) {
18
+ const testIds = useTestIds(testId, getDynamicContentEditorTestIds);
14
19
  const menuID = useUID();
15
20
  const { create } = useModalManager();
16
21
  const t = useI18n();
17
22
  const modalMethods = useRef();
18
- const [editor, setEditor] = useState();
19
- const [bookmark, setBookmark] = useState();
23
+ const [editor, setEditor] = useState(null);
20
24
  const [fieldMenuItems, setFieldMenuItems] = useState(fieldItems || []);
21
25
  const [currentElementId, setCurrentElementId] = useState('');
22
26
  const [currentElementContent, setCurrentElementContent] = useState('');
@@ -39,52 +43,39 @@ const DynamicContentEditor = forwardRef(function DynamicContentEditor({ form: {
39
43
  if (!editor)
40
44
  return;
41
45
  const fieldContent = `<pega-reference role="button" contenteditable="false" data-rule-type='field' data-rule-id=${field.id}>${field.text}</pega-reference>`;
42
- if (bookmark) {
43
- editor.selection.moveToBookmark(bookmark);
44
- editor.selection.setContent(fieldContent);
45
- }
46
- else {
47
- editor.insertContent(fieldContent);
48
- }
46
+ editor.chain().focus().insertContent(fieldContent).run();
49
47
  modalMethods.current?.dismiss();
50
48
  };
51
49
  const modalProps = {
50
+ 'data-testid': testIds.insertFieldModal,
52
51
  children: dynamicContentPicker,
53
52
  heading: t('rte_insert_field'),
54
- actions: (_jsxs(_Fragment, { children: [_jsx(Button, { variant: 'secondary', onClick: () => modalMethods.current?.dismiss(), children: t('cancel') }), _jsx(Button, { variant: 'primary', onClick: () => onSubmit(insertField), children: t('submit') })] })),
53
+ actions: (_jsxs(_Fragment, { children: [_jsx(Button, { "data-testid": testIds.insertFieldModalCancel, variant: 'secondary', onClick: () => modalMethods.current?.dismiss(), children: t('cancel') }), _jsx(Button, { "data-testid": testIds.insertFieldModalSubmit, variant: 'primary', onClick: () => onSubmit(insertField), children: t('submit') })] })),
55
54
  center: true,
56
55
  onAfterClose: () => {
57
- setBookmark(undefined);
58
56
  setCurrentElementId('');
59
57
  setCurrentElementContent('');
60
58
  onActiveFieldChange({ id: '', text: '' });
61
59
  },
62
60
  onBeforeOpen: () => {
63
61
  if (currentElementId) {
64
- onActiveFieldChange({ id: currentElementId, text: currentElementContent });
62
+ onActiveFieldChange({
63
+ id: currentElementId,
64
+ text: currentElementContent
65
+ });
65
66
  }
66
67
  }
67
68
  };
68
69
  const findAndRenameField = (fieldId) => {
69
70
  if (!editor || !fieldMenuItems)
70
71
  return;
71
- const selectedRange = editor.selection.getRng();
72
- const endOffset = selectedRange.endOffset;
73
- const stringToSearch = selectedRange.commonAncestorContainer.nodeValue?.slice(0, endOffset);
74
- if (stringToSearch === undefined)
75
- return;
76
- const splitSearch = stringToSearch.split(' ');
77
- const fieldString = splitSearch[splitSearch.length - 1];
78
- const range = editor.getDoc().createRange();
79
- const startPos = stringToSearch.lastIndexOf(fieldString);
80
- const endPos = startPos + fieldString.length;
81
- range.setStart(selectedRange.commonAncestorContainer, startPos);
82
- range.setEnd(selectedRange.commonAncestorContainer, endPos);
83
- editor.getDoc().getSelection()?.removeAllRanges();
84
- editor.getDoc().getSelection()?.addRange(range);
85
72
  const selectedField = menuHelpers.getItem(fieldMenuItems, fieldId);
86
- if (selectedField) {
87
- editor.selection.setContent(`<pega-reference role="button" contenteditable="false" data-rule-type="field" data-rule-id=".${selectedField.id}">${selectedField.primary}</pega-reference>`);
73
+ if (selectedField && isFieldMenuItem(selectedField)) {
74
+ editor
75
+ .chain()
76
+ .focus()
77
+ .insertContent(`<pega-reference role="button" contenteditable="false" data-rule-type="field" data-rule-id=".${selectedField.id}">${selectedField.primary}</pega-reference>`)
78
+ .run();
88
79
  setShowFieldsPopover(false);
89
80
  }
90
81
  };
@@ -111,34 +102,40 @@ const DynamicContentEditor = forwardRef(function DynamicContentEditor({ form: {
111
102
  setShowFieldsPopover(false);
112
103
  }
113
104
  };
114
- const updateBookmarkAndCurrentElement = (editorSelection) => {
115
- const targetEl = editorSelection.getNode();
105
+ const updateCurrentElement = (targetEl) => {
116
106
  const fieldId = targetEl.getAttribute('data-rule-id');
117
107
  const fieldValue = targetEl.innerText;
118
- setBookmark(editorSelection.getBookmark());
119
108
  setCurrentElementId(fieldId || '');
120
109
  setCurrentElementContent(fieldValue);
121
110
  };
122
111
  const handleElementClick = ({ target }) => {
123
112
  if (editor && target && target.tagName === 'PEGA-REFERENCE') {
124
- updateBookmarkAndCurrentElement(editor.selection);
113
+ updateCurrentElement(target);
125
114
  }
126
115
  hidePopover();
127
116
  };
128
- const onInsertField = (incEditor) => {
129
- const targetEl = incEditor.selection.getNode();
130
- if (targetEl.tagName === 'PEGA-REFERENCE') {
131
- updateBookmarkAndCurrentElement(incEditor.selection);
117
+ const onInsertField = () => {
118
+ if (!editor)
119
+ return;
120
+ // Get the DOM element at the current selection
121
+ const { from } = editor.state.selection;
122
+ const domAtPos = editor.view.domAtPos(from);
123
+ const targetEl = domAtPos.node.parentElement;
124
+ if (targetEl?.tagName === 'PEGA-REFERENCE') {
125
+ updateCurrentElement(targetEl);
132
126
  }
133
127
  else {
134
128
  modalMethods.current = create(Modal, modalProps);
135
129
  }
136
130
  };
137
- const isPegaRefActive = (incEditor) => {
138
- const targetEl = incEditor.selection.getNode();
139
- return targetEl.tagName === 'PEGA-REFERENCE';
131
+ const isPegaRefActive = () => {
132
+ if (!editor)
133
+ return false;
134
+ // Check if the selected node is a pega-reference element
135
+ const { $from } = editor.state.selection;
136
+ return $from.parent.type.name === 'pega-reference';
140
137
  };
141
- const fieldSelectionPopover = (_jsx(Popover, { show: showFieldsPopover, strategy: 'fixed', ref: fieldPopoverRef, target: {
138
+ const fieldSelectionPopover = (_jsx(Popover, { show: showFieldsPopover, strategy: 'fixed', ref: fieldPopoverRef, "aria-label": t('rte_insert_field'), target: {
142
139
  getBoundingClientRect() {
143
140
  return currentCursorPosition;
144
141
  }
@@ -155,48 +152,68 @@ const DynamicContentEditor = forwardRef(function DynamicContentEditor({ form: {
155
152
  }
156
153
  }
157
154
  }
158
- ], placement: 'bottom-start', children: fieldMenuItems && (_jsx(Menu, { id: menuID, items: fieldMenuItems, as: StyledSearchPopover, focusControlEl: editor?.getBody() || undefined, mode: 'action', onItemClick: findAndRenameField, variant: 'drill-down' })) }));
155
+ ], placement: 'bottom-start', children: fieldMenuItems && (_jsx(Menu, { id: menuID, items: fieldMenuItems, as: StyledSearchPopover, focusControlEl: editor?.view.dom || undefined, mode: 'action', onItemClick: findAndRenameField, variant: 'drill-down' })) }));
159
156
  useEffect(() => {
160
157
  if (currentElementId && currentElementContent)
161
158
  modalMethods.current = create(Modal, modalProps);
162
159
  }, [currentElementId, currentElementContent]);
163
- useEffect(() => {
164
- editor?.getDoc().addEventListener('click', handleElementClick);
165
- return () => {
166
- editor?.getDoc().removeEventListener('click', handleElementClick);
167
- };
168
- }, [editor, editorRef.current]);
169
160
  useEffect(() => {
170
161
  if (modalMethods.current) {
171
162
  modalMethods.current.update(modalProps);
172
163
  }
173
164
  }, [modalProps]);
165
+ // Set up click listener on iframe document for pega-reference interactions
166
+ useEffect(() => {
167
+ const iframe = editorRef.current?.element?.querySelector('iframe');
168
+ const iframeDoc = iframe?.contentDocument;
169
+ if (!iframeDoc)
170
+ return;
171
+ const clickListener = (e) => {
172
+ handleElementClick(e);
173
+ };
174
+ iframeDoc.addEventListener('click', clickListener);
175
+ return () => {
176
+ iframeDoc.removeEventListener('click', clickListener);
177
+ };
178
+ }, [editor]);
174
179
  const onEditorChange = (formEditor) => {
175
180
  if (formEditor) {
176
- const targetEl = formEditor.selection.getBoundingClientRect();
177
- const { left = 0, top = 0 } = targetEl ?? {};
181
+ // Get cursor position from Tiptap editor
182
+ const { selection } = formEditor.state;
183
+ const { from } = selection;
184
+ // Get the coordinates of the cursor position
185
+ const coords = formEditor.view.coordsAtPos(from);
178
186
  setCurrentCursorPosition({
179
- ...formEditor.selection.getBoundingClientRect(),
180
- x: left,
181
- y: top,
187
+ bottom: coords.bottom,
188
+ height: coords.bottom - coords.top,
189
+ left: coords.left,
190
+ right: coords.right,
191
+ top: coords.top,
192
+ width: coords.right - coords.left,
193
+ x: coords.left,
194
+ y: coords.top,
182
195
  toJSON: () => { }
183
196
  });
184
- if (formEditor.selection.isCollapsed()) {
185
- // get the full line string
186
- const selectedRange = formEditor.selection.getRng();
187
- const endOffset = selectedRange.endOffset;
188
- const stringToSearch = selectedRange.commonAncestorContainer.nodeValue?.slice(0, endOffset);
189
- const fieldString = stringToSearch?.split(' ')[stringToSearch.split(' ').length - 1];
190
- if (fieldString?.startsWith('@') &&
191
- fieldString.indexOf('@') === fieldString.lastIndexOf('@')) {
192
- filterFieldMenu(fieldString.slice(1));
197
+ if (selection.empty) {
198
+ // Get text before cursor to check for @ mentions
199
+ const textBefore = formEditor.state.doc.textBetween(Math.max(0, from - 50), // Look back up to 50 characters
200
+ from, ' ');
201
+ // Get the last word (after last space)
202
+ const words = textBefore.split(' ');
203
+ const lastWord = words[words.length - 1];
204
+ if (lastWord?.startsWith('@') && lastWord.indexOf('@') === lastWord.lastIndexOf('@')) {
205
+ filterFieldMenu(lastWord.slice(1));
193
206
  }
194
- else
207
+ else {
195
208
  setShowFieldsPopover(false);
209
+ }
196
210
  }
197
211
  }
198
212
  };
199
213
  const onKeyDown = event => {
214
+ if (onKeyDownProp) {
215
+ onKeyDownProp(event);
216
+ }
200
217
  if ((event?.key === 'Enter' ||
201
218
  event?.key === 'ArrowLeft' ||
202
219
  event?.key === 'ArrowRight' ||
@@ -209,15 +226,17 @@ const DynamicContentEditor = forwardRef(function DynamicContentEditor({ form: {
209
226
  hidePopover();
210
227
  }
211
228
  };
212
- return (_jsx(Editor, { ref: editorRef, ...restProps, label: label, toolbar: toolbar, customComponents: [
229
+ return (_jsx(Editor, { "data-testid": testIds.root, ref: editorRef, ...restProps, label: label, toolbar: toolbar, customComponents: [
213
230
  {
214
231
  createCustomElement: createPegaReferenceElement,
215
232
  name: 'pega-reference',
216
233
  extensionAttributes: ['contenteditable'],
217
234
  style: pegaReferenceElementStyle
218
- }
235
+ },
236
+ ...customComponents
219
237
  ], customActions: [
220
238
  {
239
+ 'data-testid': testIds.insertField,
221
240
  icon: 'code',
222
241
  text: tooltip,
223
242
  onMouseDown: () => {
@@ -229,11 +248,12 @@ const DynamicContentEditor = forwardRef(function DynamicContentEditor({ form: {
229
248
  description: tooltip,
230
249
  command: onInsertField
231
250
  }
232
- }
251
+ },
252
+ ...customActions
233
253
  ], onInit: setEditor, onChange: onEditorChange, onBlur: () => {
234
254
  onBlur?.();
235
255
  hidePopover();
236
256
  }, onKeyDown: onKeyDown, defaultValue: defaultValue, children: fieldSelectionPopover }));
237
257
  });
238
- export default DynamicContentEditor;
258
+ export default withTestIds(DynamicContentEditor, getDynamicContentEditorTestIds);
239
259
  //# sourceMappingURL=DynamicContentEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicContentEditor.js","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QA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,SAAS,CAAC;YAC3B,CAAC,CAAC,eAAe,CAAC,OAAO,EACzB,CAAC;YACD,KAAK,EAAE,cAAc,EAAE,CAAC;QAC1B,CAAC;QACD,IAAI,KAAK,EAAE,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;YACzD,WAAW,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IACL,GAAG,EAAE,SAAS,KACV,SAAS,EACb,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE;YAChB;gBACE,mBAAmB,EAAE,0BAA0B;gBAC/C,IAAI,EAAE,gBAAgB;gBACtB,mBAAmB,EAAE,CAAC,iBAAiB,CAAC;gBACxC,KAAK,EAAE,yBAAyB;aACjC;SACF,EACD,aAAa,EAAE;YACb;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,GAAG,EAAE;oBAChB,YAAY,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;gBACnD,CAAC;gBACD,MAAM,EAAE,eAAe;gBACvB,QAAQ,EAAE;oBACR,OAAO,EAAE,UAAU;oBACnB,WAAW,EAAE,OAAO;oBACpB,OAAO,EAAE,aAAa;iBACvB;aACF;SACF,EACD,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,GAAG,EAAE;YACX,MAAM,EAAE,EAAE,CAAC;YACX,WAAW,EAAE,CAAC;QAChB,CAAC,EACD,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,YAEzB,qBAAqB,GACf,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { forwardRef, useRef, useEffect, useState } from 'react';\nimport type { PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\nimport type { Bookmark, Editor as TinyMCEEditor, EditorSelection } from 'tinymce';\n\nimport { Editor } from '@pega/cosmos-react-rte';\nimport type { EditorProps } from '@pega/cosmos-react-rte';\nimport {\n Button,\n defaultThemeProp,\n Menu,\n menuHelpers,\n Modal,\n Popover,\n StyledPopover,\n useModalManager,\n useConsolidatedRef,\n useI18n,\n useUID\n} from '@pega/cosmos-react-core';\nimport type {\n ForwardRefForwardPropsComponent,\n MenuProps,\n ModalMethods,\n PropsWithDefaults\n} from '@pega/cosmos-react-core';\nimport { getKeyCommand } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/Toolbar/utils';\n\nimport type { DynamicContentEditorProps, ItemType } from './DynamicContentEditor.types';\nimport { pegaReferenceElementStyle, createPegaReferenceElement } from './PegaCustomElement';\n\ntype DynamicContentEditorPropsWithDefaults = PropsWithDefaults<DynamicContentEditorProps>;\n\nconst StyledDynamicContentEditor = styled.div<DynamicContentEditorPropsWithDefaults>``;\n\nexport const StyledSearchPopover = styled(StyledPopover)`\n min-width: 20rem;\n`;\n\nStyledDynamicContentEditor.defaultProps = defaultThemeProp;\n\nconst DynamicContentEditor: ForwardRefForwardPropsComponent<DynamicContentEditorProps> = forwardRef(\n function DynamicContentEditor(\n {\n form: { dynamicContentPicker, onSubmit },\n onActiveFieldChange,\n label,\n toolbar,\n fieldItems,\n defaultValue,\n onBlur,\n ...restProps\n }: PropsWithoutRef<DynamicContentEditorProps>,\n ref: DynamicContentEditorProps['ref']\n ) {\n const menuID = useUID();\n const { create } = useModalManager();\n const t = useI18n();\n\n const modalMethods = useRef<ModalMethods>();\n const [editor, setEditor] = useState<TinyMCEEditor | undefined>();\n const [bookmark, setBookmark] = useState<Bookmark | undefined>();\n const [fieldMenuItems, setFieldMenuItems] = useState<MenuProps['items']>(fieldItems || []);\n const [currentElementId, setCurrentElementId] = useState('');\n const [currentElementContent, setCurrentElementContent] = useState('');\n const [currentCursorPosition, setCurrentCursorPosition] = useState({\n bottom: 0,\n height: 0,\n left: 0,\n right: 0,\n top: 0,\n width: 0,\n x: 0,\n y: 0,\n toJSON: () => {}\n });\n const [showFieldsPopover, setShowFieldsPopover] = useState<boolean>(false);\n\n const fieldPopoverRef = useRef<HTMLDivElement>(null);\n const editorRef = useConsolidatedRef(ref);\n\n const tooltip = getKeyCommand(\n navigator.appVersion.includes('Mac'),\n ({ ctrl }) => `${t('rte_insert_field')} (${ctrl}/)`\n );\n\n const insertField = (field: ItemType) => {\n if (!editor) return;\n\n const fieldContent = `<pega-reference role=\"button\" contenteditable=\"false\" data-rule-type='field' data-rule-id=${field.id}>${field.text}</pega-reference>`;\n if (bookmark) {\n editor.selection.moveToBookmark(bookmark);\n editor.selection.setContent(fieldContent);\n } else {\n editor.insertContent(fieldContent);\n }\n\n modalMethods.current?.dismiss();\n };\n\n const modalProps = {\n children: dynamicContentPicker,\n heading: t('rte_insert_field'),\n actions: (\n <>\n <Button variant='secondary' onClick={() => modalMethods.current?.dismiss()}>\n {t('cancel')}\n </Button>\n <Button variant='primary' onClick={() => onSubmit(insertField)}>\n {t('submit')}\n </Button>\n </>\n ),\n center: true,\n onAfterClose: () => {\n setBookmark(undefined);\n setCurrentElementId('');\n setCurrentElementContent('');\n onActiveFieldChange({ id: '', text: '' });\n },\n onBeforeOpen: () => {\n if (currentElementId) {\n onActiveFieldChange({ id: currentElementId, text: currentElementContent });\n }\n }\n };\n\n const findAndRenameField = (fieldId: string) => {\n if (!editor || !fieldMenuItems) return;\n\n const selectedRange = editor.selection.getRng();\n const endOffset = selectedRange.endOffset;\n const stringToSearch = selectedRange.commonAncestorContainer.nodeValue?.slice(0, endOffset);\n if (stringToSearch === undefined) return;\n\n const splitSearch = stringToSearch.split(' ');\n const fieldString = splitSearch[splitSearch.length - 1];\n const range = editor.getDoc().createRange();\n\n const startPos = stringToSearch.lastIndexOf(fieldString);\n const endPos = startPos + fieldString.length;\n range.setStart(selectedRange.commonAncestorContainer, startPos);\n range.setEnd(selectedRange.commonAncestorContainer, endPos);\n editor.getDoc().getSelection()?.removeAllRanges();\n editor.getDoc().getSelection()?.addRange(range);\n\n const selectedField = menuHelpers.getItem(fieldMenuItems, fieldId);\n if (selectedField) {\n editor.selection.setContent(\n `<pega-reference role=\"button\" contenteditable=\"false\" data-rule-type=\"field\" data-rule-id=\".${selectedField.id}\">${selectedField.primary}</pega-reference>`\n );\n setShowFieldsPopover(false);\n }\n };\n\n const hidePopover = () => {\n if (fieldPopoverRef) setShowFieldsPopover(false);\n };\n\n const filterFieldMenu = (searchString: string) => {\n setShowFieldsPopover(true);\n setFieldMenuItems(fieldItems || []);\n if (/\\s/.test(searchString)) {\n setShowFieldsPopover(false);\n return;\n }\n if (searchString && fieldMenuItems) {\n const newFieldMenuItems: MenuProps['items'] = menuHelpers\n .flatten(fieldMenuItems)\n .filter(({ primary }) =>\n primary.toLowerCase().startsWith(searchString.toLocaleLowerCase())\n );\n if (newFieldMenuItems) {\n setShowFieldsPopover(true);\n setFieldMenuItems(newFieldMenuItems);\n } else setShowFieldsPopover(false);\n }\n };\n\n const updateBookmarkAndCurrentElement = (editorSelection: EditorSelection) => {\n const targetEl = editorSelection.getNode() as HTMLElement;\n const fieldId = targetEl.getAttribute('data-rule-id');\n const fieldValue = targetEl.innerText;\n setBookmark(editorSelection.getBookmark());\n setCurrentElementId(fieldId || '');\n setCurrentElementContent(fieldValue);\n };\n\n const handleElementClick = ({ target }: MouseEvent) => {\n if (editor && target && (target as HTMLElement).tagName === 'PEGA-REFERENCE') {\n updateBookmarkAndCurrentElement(editor.selection);\n }\n hidePopover();\n };\n\n const onInsertField = (incEditor: TinyMCEEditor) => {\n const targetEl = incEditor.selection.getNode();\n if (targetEl.tagName === 'PEGA-REFERENCE') {\n updateBookmarkAndCurrentElement(incEditor.selection);\n } else {\n modalMethods.current = create(Modal, modalProps);\n }\n };\n\n const isPegaRefActive = (incEditor: TinyMCEEditor) => {\n const targetEl = incEditor.selection.getNode();\n return targetEl.tagName === 'PEGA-REFERENCE';\n };\n\n const fieldSelectionPopover = (\n <Popover\n show={showFieldsPopover}\n strategy='fixed'\n ref={fieldPopoverRef}\n target={{\n getBoundingClientRect() {\n return currentCursorPosition;\n }\n }}\n modifiers={[\n {\n name: 'offset',\n options: {\n offset: () => {\n const iframe = editorRef.current?.element?.querySelector('iframe');\n const iframeRect = iframe?.getBoundingClientRect();\n const x = iframeRect?.x ?? 0;\n const y = iframeRect?.y ?? 0;\n return [x, y] satisfies [number, number];\n }\n }\n }\n ]}\n placement='bottom-start'\n >\n {fieldMenuItems && (\n <Menu\n id={menuID}\n items={fieldMenuItems}\n as={StyledSearchPopover}\n focusControlEl={editor?.getBody() || undefined}\n mode='action'\n onItemClick={findAndRenameField}\n variant='drill-down'\n />\n )}\n </Popover>\n );\n\n useEffect(() => {\n if (currentElementId && currentElementContent)\n modalMethods.current = create(Modal, modalProps);\n }, [currentElementId, currentElementContent]);\n\n useEffect(() => {\n editor?.getDoc().addEventListener('click', handleElementClick);\n return () => {\n editor?.getDoc().removeEventListener('click', handleElementClick);\n };\n }, [editor, editorRef.current]);\n\n useEffect(() => {\n if (modalMethods.current) {\n modalMethods.current.update(modalProps);\n }\n }, [modalProps]);\n\n const onEditorChange: EditorProps['onChange'] = (formEditor?: TinyMCEEditor) => {\n if (formEditor) {\n const targetEl = formEditor.selection.getBoundingClientRect();\n const { left = 0, top = 0 } = targetEl ?? {};\n setCurrentCursorPosition({\n ...formEditor.selection.getBoundingClientRect(),\n x: left,\n y: top,\n toJSON: () => {}\n });\n\n if (formEditor.selection.isCollapsed()) {\n // get the full line string\n const selectedRange = formEditor.selection.getRng();\n const endOffset = selectedRange.endOffset;\n const stringToSearch = selectedRange.commonAncestorContainer.nodeValue?.slice(\n 0,\n endOffset\n );\n const fieldString = stringToSearch?.split(' ')[stringToSearch.split(' ').length - 1];\n if (\n fieldString?.startsWith('@') &&\n fieldString.indexOf('@') === fieldString.lastIndexOf('@')\n ) {\n filterFieldMenu(fieldString.slice(1));\n } else setShowFieldsPopover(false);\n }\n }\n };\n\n const onKeyDown: EditorProps['onKeyDown'] = event => {\n if (\n (event?.key === 'Enter' ||\n event?.key === 'ArrowLeft' ||\n event?.key === 'ArrowRight' ||\n event?.key === 'ArrowDown' ||\n event?.key === 'ArrowUp') &&\n !!fieldPopoverRef.current\n ) {\n event?.preventDefault();\n }\n if (event?.key === 'Escape' && !!fieldPopoverRef.current) {\n hidePopover();\n }\n };\n\n return (\n <Editor\n ref={editorRef}\n {...restProps}\n label={label}\n toolbar={toolbar}\n customComponents={[\n {\n createCustomElement: createPegaReferenceElement,\n name: 'pega-reference',\n extensionAttributes: ['contenteditable'],\n style: pegaReferenceElementStyle\n }\n ]}\n customActions={[\n {\n icon: 'code',\n text: tooltip,\n onMouseDown: () => {\n modalMethods.current = create(Modal, modalProps);\n },\n active: isPegaRefActive,\n shortcut: {\n pattern: 'meta+191',\n description: tooltip,\n command: onInsertField\n }\n }\n ]}\n onInit={setEditor}\n onChange={onEditorChange}\n onBlur={() => {\n onBlur?.();\n hidePopover();\n }}\n onKeyDown={onKeyDown}\n defaultValue={defaultValue}\n >\n {fieldSelectionPopover}\n </Editor>\n );\n }\n);\n\nexport default DynamicContentEditor;\n"]}
1
+ {"version":3,"file":"DynamicContentEditor.js","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,IAAI,EACJ,WAAW,EACX,KAAK,EACL,OAAO,EACP,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,UAAU,EACV,WAAW,EACX,YAAY,EACb,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO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AAE,CAAC;QAChB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,mBACQ,OAAO,CAAC,IAAI,EACzB,GAAG,EAAE,SAAS,KACV,SAAS,EACb,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE;YAChB;gBACE,mBAAmB,EAAE,0BAA0B;gBAC/C,IAAI,EAAE,gBAAgB;gBACtB,mBAAmB,EAAE,CAAC,iBAAiB,CAAC;gBACxC,KAAK,EAAE,yBAAyB;aACjC;YACD,GAAG,gBAAgB;SACpB,EACD,aAAa,EAAE;YACb;gBACE,aAAa,EAAE,OAAO,CAAC,WAAW;gBAClC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,GAAG,EAAE;oBAChB,YAAY,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;gBACnD,CAAC;gBACD,MAAM,EAAE,eAAe;gBACvB,QAAQ,EAAE;oBACR,OAAO,EAAE,UAAU;oBACnB,WAAW,EAAE,OAAO;oBACpB,OAAO,EAAE,aAAa;iBACvB;aACF;YACD,GAAG,aAAa;SACjB,EACD,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,GAAG,EAAE;YACX,MAAM,EAAE,EAAE,CAAC;YACX,WAAW,EAAE,CAAC;QAChB,CAAC,EACD,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,YAEzB,qBAAqB,GACf,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,oBAAoB,EAAE,8BAA8B,CAAC,CAAC","sourcesContent":["import { forwardRef, useRef, useEffect, useState } from 'react';\nimport type { PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\nimport type { Editor as TiptapEditor } from '@tiptap/core';\n\nimport { Editor } from '@pega/cosmos-react-rte';\nimport type { EditorProps } from '@pega/cosmos-react-rte';\nimport {\n Button,\n defaultThemeProp,\n Menu,\n menuHelpers,\n Modal,\n Popover,\n StyledPopover,\n useModalManager,\n useConsolidatedRef,\n useI18n,\n useUID,\n useTestIds,\n withTestIds,\n registerIcon\n} from '@pega/cosmos-react-core';\nimport type {\n ForwardRefForwardPropsComponent,\n ModalMethods,\n PropsWithDefaults\n} from '@pega/cosmos-react-core';\nimport * as codeIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/code.icon';\nimport { getKeyCommand } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/Toolbar/utils';\n\nimport { isFieldMenuItem } from './DynamicContentEditor.types';\nimport type { DynamicContentEditorProps, FieldItems, ItemType } from './DynamicContentEditor.types';\nimport { pegaReferenceElementStyle, createPegaReferenceElement } from './PegaCustomElement';\nimport { getDynamicContentEditorTestIds } from './DynamicContentEditor.test-ids';\n\nregisterIcon(codeIcon);\n\ntype DynamicContentEditorPropsWithDefaults = PropsWithDefaults<DynamicContentEditorProps>;\n\nconst StyledDynamicContentEditor = styled.div<DynamicContentEditorPropsWithDefaults>``;\n\nexport const StyledSearchPopover = styled(StyledPopover)`\n min-width: 20rem;\n`;\n\nStyledDynamicContentEditor.defaultProps = defaultThemeProp;\n\nconst DynamicContentEditor: ForwardRefForwardPropsComponent<DynamicContentEditorProps> = forwardRef(\n function DynamicContentEditor(\n {\n testId,\n form: { dynamicContentPicker, onSubmit },\n onActiveFieldChange,\n label,\n toolbar,\n fieldItems,\n defaultValue,\n onBlur,\n onKeyDown: onKeyDownProp,\n customActions = [],\n customComponents = [],\n ...restProps\n }: PropsWithoutRef<DynamicContentEditorProps>,\n ref: DynamicContentEditorProps['ref']\n ) {\n const testIds = useTestIds(testId, getDynamicContentEditorTestIds);\n const menuID = useUID();\n const { create } = useModalManager();\n const t = useI18n();\n\n const modalMethods = useRef<ModalMethods>();\n const [editor, setEditor] = useState<TiptapEditor | null>(null);\n const [fieldMenuItems, setFieldMenuItems] = useState<FieldItems[]>(fieldItems || []);\n const [currentElementId, setCurrentElementId] = useState('');\n const [currentElementContent, setCurrentElementContent] = useState('');\n const [currentCursorPosition, setCurrentCursorPosition] = useState({\n bottom: 0,\n height: 0,\n left: 0,\n right: 0,\n top: 0,\n width: 0,\n x: 0,\n y: 0,\n toJSON: () => {}\n });\n const [showFieldsPopover, setShowFieldsPopover] = useState<boolean>(false);\n\n const fieldPopoverRef = useRef<HTMLDivElement>(null);\n const editorRef = useConsolidatedRef(ref);\n\n const tooltip = getKeyCommand(\n navigator.appVersion.includes('Mac'),\n ({ ctrl }) => `${t('rte_insert_field')} (${ctrl}/)`\n );\n\n const insertField = (field: ItemType) => {\n if (!editor) return;\n\n const fieldContent = `<pega-reference role=\"button\" contenteditable=\"false\" data-rule-type='field' data-rule-id=${field.id}>${field.text}</pega-reference>`;\n\n editor.chain().focus().insertContent(fieldContent).run();\n modalMethods.current?.dismiss();\n };\n\n const modalProps = {\n 'data-testid': testIds.insertFieldModal,\n children: dynamicContentPicker,\n heading: t('rte_insert_field'),\n actions: (\n <>\n <Button\n data-testid={testIds.insertFieldModalCancel}\n variant='secondary'\n onClick={() => modalMethods.current?.dismiss()}\n >\n {t('cancel')}\n </Button>\n <Button\n data-testid={testIds.insertFieldModalSubmit}\n variant='primary'\n onClick={() => onSubmit(insertField)}\n >\n {t('submit')}\n </Button>\n </>\n ),\n center: true,\n onAfterClose: () => {\n setCurrentElementId('');\n setCurrentElementContent('');\n onActiveFieldChange({ id: '', text: '' });\n },\n onBeforeOpen: () => {\n if (currentElementId) {\n onActiveFieldChange({\n id: currentElementId,\n text: currentElementContent\n });\n }\n }\n };\n\n const findAndRenameField = (fieldId: string) => {\n if (!editor || !fieldMenuItems) return;\n\n const selectedField = menuHelpers.getItem(fieldMenuItems, fieldId);\n if (selectedField && isFieldMenuItem(selectedField)) {\n editor\n .chain()\n .focus()\n .insertContent(\n `<pega-reference role=\"button\" contenteditable=\"false\" data-rule-type=\"field\" data-rule-id=\".${selectedField.id}\">${selectedField.primary}</pega-reference>`\n )\n .run();\n setShowFieldsPopover(false);\n }\n };\n\n const hidePopover = () => {\n if (fieldPopoverRef) setShowFieldsPopover(false);\n };\n\n const filterFieldMenu = (searchString: string) => {\n setShowFieldsPopover(true);\n setFieldMenuItems(fieldItems || []);\n if (/\\s/.test(searchString)) {\n setShowFieldsPopover(false);\n return;\n }\n if (searchString && fieldMenuItems) {\n const newFieldMenuItems: FieldItems[] = menuHelpers\n .flatten(fieldMenuItems)\n .filter(({ primary }) =>\n primary.toLowerCase().startsWith(searchString.toLocaleLowerCase())\n );\n if (newFieldMenuItems) {\n setShowFieldsPopover(true);\n setFieldMenuItems(newFieldMenuItems);\n } else setShowFieldsPopover(false);\n }\n };\n\n const updateCurrentElement = (targetEl: HTMLElement) => {\n const fieldId = targetEl.getAttribute('data-rule-id');\n const fieldValue = targetEl.innerText;\n setCurrentElementId(fieldId || '');\n setCurrentElementContent(fieldValue);\n };\n\n const handleElementClick = ({ target }: MouseEvent) => {\n if (editor && target && (target as HTMLElement).tagName === 'PEGA-REFERENCE') {\n updateCurrentElement(target as HTMLElement);\n }\n hidePopover();\n };\n\n const onInsertField = () => {\n if (!editor) return;\n\n // Get the DOM element at the current selection\n const { from } = editor.state.selection;\n const domAtPos = editor.view.domAtPos(from);\n const targetEl = domAtPos.node.parentElement;\n\n if (targetEl?.tagName === 'PEGA-REFERENCE') {\n updateCurrentElement(targetEl);\n } else {\n modalMethods.current = create(Modal, modalProps);\n }\n };\n\n const isPegaRefActive = () => {\n if (!editor) return false;\n\n // Check if the selected node is a pega-reference element\n const { $from } = editor.state.selection;\n return $from.parent.type.name === 'pega-reference';\n };\n\n const fieldSelectionPopover = (\n <Popover\n show={showFieldsPopover}\n strategy='fixed'\n ref={fieldPopoverRef}\n aria-label={t('rte_insert_field')}\n target={{\n getBoundingClientRect() {\n return currentCursorPosition;\n }\n }}\n modifiers={[\n {\n name: 'offset',\n options: {\n offset: () => {\n const iframe = editorRef.current?.element?.querySelector('iframe');\n const iframeRect = iframe?.getBoundingClientRect();\n const x = iframeRect?.x ?? 0;\n const y = iframeRect?.y ?? 0;\n return [x, y] satisfies [number, number];\n }\n }\n }\n ]}\n placement='bottom-start'\n >\n {fieldMenuItems && (\n <Menu\n id={menuID}\n items={fieldMenuItems}\n as={StyledSearchPopover}\n focusControlEl={editor?.view.dom || undefined}\n mode='action'\n onItemClick={findAndRenameField}\n variant='drill-down'\n />\n )}\n </Popover>\n );\n\n useEffect(() => {\n if (currentElementId && currentElementContent)\n modalMethods.current = create(Modal, modalProps);\n }, [currentElementId, currentElementContent]);\n\n useEffect(() => {\n if (modalMethods.current) {\n modalMethods.current.update(modalProps);\n }\n }, [modalProps]);\n\n // Set up click listener on iframe document for pega-reference interactions\n useEffect(() => {\n const iframe = editorRef.current?.element?.querySelector('iframe');\n const iframeDoc = iframe?.contentDocument;\n if (!iframeDoc) return;\n\n const clickListener = (e: MouseEvent) => {\n handleElementClick(e);\n };\n\n iframeDoc.addEventListener('click', clickListener);\n\n return () => {\n iframeDoc.removeEventListener('click', clickListener);\n };\n }, [editor]);\n\n const onEditorChange: EditorProps['onChange'] = (formEditor?: TiptapEditor) => {\n if (formEditor) {\n // Get cursor position from Tiptap editor\n const { selection } = formEditor.state;\n const { from } = selection;\n\n // Get the coordinates of the cursor position\n const coords = formEditor.view.coordsAtPos(from);\n\n setCurrentCursorPosition({\n bottom: coords.bottom,\n height: coords.bottom - coords.top,\n left: coords.left,\n right: coords.right,\n top: coords.top,\n width: coords.right - coords.left,\n x: coords.left,\n y: coords.top,\n toJSON: () => {}\n });\n\n if (selection.empty) {\n // Get text before cursor to check for @ mentions\n const textBefore = formEditor.state.doc.textBetween(\n Math.max(0, from - 50), // Look back up to 50 characters\n from,\n ' '\n );\n\n // Get the last word (after last space)\n const words = textBefore.split(' ');\n const lastWord = words[words.length - 1];\n\n if (lastWord?.startsWith('@') && lastWord.indexOf('@') === lastWord.lastIndexOf('@')) {\n filterFieldMenu(lastWord.slice(1));\n } else {\n setShowFieldsPopover(false);\n }\n }\n }\n };\n\n const onKeyDown: EditorProps['onKeyDown'] = event => {\n if (onKeyDownProp) {\n onKeyDownProp(event);\n }\n\n if (\n (event?.key === 'Enter' ||\n event?.key === 'ArrowLeft' ||\n event?.key === 'ArrowRight' ||\n event?.key === 'ArrowDown' ||\n event?.key === 'ArrowUp') &&\n !!fieldPopoverRef.current\n ) {\n event?.preventDefault();\n }\n if (event?.key === 'Escape' && !!fieldPopoverRef.current) {\n hidePopover();\n }\n };\n\n return (\n <Editor\n data-testid={testIds.root}\n ref={editorRef}\n {...restProps}\n label={label}\n toolbar={toolbar}\n customComponents={[\n {\n createCustomElement: createPegaReferenceElement,\n name: 'pega-reference',\n extensionAttributes: ['contenteditable'],\n style: pegaReferenceElementStyle\n },\n ...customComponents\n ]}\n customActions={[\n {\n 'data-testid': testIds.insertField,\n icon: 'code',\n text: tooltip,\n onMouseDown: () => {\n modalMethods.current = create(Modal, modalProps);\n },\n active: isPegaRefActive,\n shortcut: {\n pattern: 'meta+191',\n description: tooltip,\n command: onInsertField\n }\n },\n ...customActions\n ]}\n onInit={setEditor}\n onChange={onEditorChange}\n onBlur={() => {\n onBlur?.();\n hidePopover();\n }}\n onKeyDown={onKeyDown}\n defaultValue={defaultValue}\n >\n {fieldSelectionPopover}\n </Editor>\n );\n }\n);\n\nexport default withTestIds(DynamicContentEditor, getDynamicContentEditorTestIds);\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const getDynamicContentEditorTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["root", "insert-field", "insert-field-modal", "insert-field-modal-cancel", "insert-field-modal-submit"]>;
2
+ //# sourceMappingURL=DynamicContentEditor.test-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DynamicContentEditor.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,6OAMhC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { createTestIds } from '@pega/cosmos-react-core';
2
+ export const getDynamicContentEditorTestIds = createTestIds('dynamic-content-editor', [
3
+ 'root',
4
+ 'insert-field',
5
+ 'insert-field-modal',
6
+ 'insert-field-modal-cancel',
7
+ 'insert-field-modal-submit'
8
+ ]);
9
+ //# sourceMappingURL=DynamicContentEditor.test-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DynamicContentEditor.test-ids.js","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,8BAA8B,GAAG,aAAa,CAAC,wBAAwB,EAAE;IACpF,MAAM;IACN,cAAc;IACd,oBAAoB;IACpB,2BAA2B;IAC3B,2BAA2B;CACnB,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getDynamicContentEditorTestIds = createTestIds('dynamic-content-editor', [\n 'root',\n 'insert-field',\n 'insert-field-modal',\n 'insert-field-modal-cancel',\n 'insert-field-modal-submit'\n] as const);\n"]}
@@ -1,11 +1,20 @@
1
1
  import type { ReactNode } from 'react';
2
+ import type { TestIdProp } from '@pega/cosmos-react-core';
3
+ import type { MenuGroupProps, MenuItemProps } from '@pega/cosmos-react-core/lib/components/Menu/Menu.types';
2
4
  import type { EditorProps } from '@pega/cosmos-react-rte';
3
- import type { MenuProps } from '@pega/cosmos-react-core/lib/components/Menu/Menu.types';
4
5
  export type ItemType = {
5
6
  id: string;
6
7
  text: string;
7
8
  };
8
- export interface DynamicContentEditorProps extends EditorProps {
9
+ export type FieldMenuItem = MenuItemProps & {
10
+ items?: FieldItems[];
11
+ };
12
+ export type FieldMenuGroup = MenuGroupProps & {
13
+ items?: FieldItems[];
14
+ };
15
+ export type FieldItems = FieldMenuItem | FieldMenuGroup;
16
+ export declare const isFieldMenuItem: (item: FieldItems) => item is FieldMenuItem;
17
+ export interface DynamicContentEditorProps extends EditorProps, TestIdProp {
9
18
  /** Insert field form */
10
19
  form: {
11
20
  onSubmit: (insertField: (selectedField: ItemType) => void) => void;
@@ -13,7 +22,7 @@ export interface DynamicContentEditorProps extends EditorProps {
13
22
  };
14
23
  onActiveFieldChange: (field: ItemType) => void;
15
24
  /** Property selection array */
16
- fieldItems?: MenuProps['items'];
25
+ fieldItems?: FieldItems[];
17
26
  defaultValue?: string;
18
27
  onBlur?: () => void;
19
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicContentEditor.types.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wDAAwD,CAAC;AAExF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,yBAA0B,SAAQ,WAAW;IAC5D,wBAAwB;IACxB,IAAI,EAAE;QACJ,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC,aAAa,EAAE,QAAQ,KAAK,IAAI,KAAK,IAAI,CAAC;QACnE,oBAAoB,EAAE,SAAS,CAAC;KACjC,CAAC;IACF,mBAAmB,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC/C,+BAA+B;IAC/B,UAAU,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,gCAAiC,SAAQ,yBAAyB;IACjF,gBAAgB,CAAC,EAAE,CAAC,aAAa,EAAE,QAAQ,KAAK,IAAI,CAAC;CACtD"}
1
+ {"version":3,"file":"DynamicContentEditor.types.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAC1C,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC;AAExD,eAAO,MAAM,eAAe,GAAI,MAAM,UAAU,KAAG,IAAI,IAAI,aACjC,CAAC;AAE3B,MAAM,WAAW,yBAA0B,SAAQ,WAAW,EAAE,UAAU;IACxE,wBAAwB;IACxB,IAAI,EAAE;QACJ,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC,aAAa,EAAE,QAAQ,KAAK,IAAI,KAAK,IAAI,CAAC;QACnE,oBAAoB,EAAE,SAAS,CAAC;KACjC,CAAC;IACF,mBAAmB,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC/C,+BAA+B;IAC/B,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,gCAAiC,SAAQ,yBAAyB;IACjF,gBAAgB,CAAC,EAAE,CAAC,aAAa,EAAE,QAAQ,KAAK,IAAI,CAAC;CACtD"}
@@ -1,2 +1,3 @@
1
- export {};
1
+ import { hasProp } from '@pega/cosmos-react-core';
2
+ export const isFieldMenuItem = (item) => hasProp(item, 'primary');
2
3
  //# sourceMappingURL=DynamicContentEditor.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicContentEditor.types.js","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { EditorProps } from '@pega/cosmos-react-rte';\nimport type { MenuProps } from '@pega/cosmos-react-core/lib/components/Menu/Menu.types';\n\nexport type ItemType = {\n id: string;\n text: string;\n};\n\nexport interface DynamicContentEditorProps extends EditorProps {\n /** Insert field form */\n form: {\n onSubmit: (insertField: (selectedField: ItemType) => void) => void;\n dynamicContentPicker: ReactNode;\n };\n onActiveFieldChange: (field: ItemType) => void;\n /** Property selection array */\n fieldItems?: MenuProps['items'];\n defaultValue?: string;\n onBlur?: () => void;\n}\n\nexport interface DynamicContentEditorContextProps extends DynamicContentEditorProps {\n updateProperties?: (selectedfield: ItemType) => void;\n}\n"]}
1
+ {"version":3,"file":"DynamicContentEditor.types.js","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAuBlD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAgB,EAAyB,EAAE,CACzE,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import type { ReactNode } from 'react';\n\nimport { hasProp } from '@pega/cosmos-react-core';\nimport type { TestIdProp } from '@pega/cosmos-react-core';\nimport type {\n MenuGroupProps,\n MenuItemProps\n} from '@pega/cosmos-react-core/lib/components/Menu/Menu.types';\nimport type { EditorProps } from '@pega/cosmos-react-rte';\n\nexport type ItemType = {\n id: string;\n text: string;\n};\n\nexport type FieldMenuItem = MenuItemProps & {\n items?: FieldItems[];\n};\n\nexport type FieldMenuGroup = MenuGroupProps & {\n items?: FieldItems[];\n};\n\nexport type FieldItems = FieldMenuItem | FieldMenuGroup;\n\nexport const isFieldMenuItem = (item: FieldItems): item is FieldMenuItem =>\n hasProp(item, 'primary');\n\nexport interface DynamicContentEditorProps extends EditorProps, TestIdProp {\n /** Insert field form */\n form: {\n onSubmit: (insertField: (selectedField: ItemType) => void) => void;\n dynamicContentPicker: ReactNode;\n };\n onActiveFieldChange: (field: ItemType) => void;\n /** Property selection array */\n fieldItems?: FieldItems[];\n defaultValue?: string;\n onBlur?: () => void;\n}\n\nexport interface DynamicContentEditorContextProps extends DynamicContentEditorProps {\n updateProperties?: (selectedfield: ItemType) => void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicInput.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAU,MAAM,sBAAsB,CAAC;0BAwI5F,CAAC,SAAS,MAAM,WAChB,aAAa,SAAS,sBAAsB,CAAC,CAAC,CAAC,8BAC/C,SAAS,SAAS,MAAM,WACxB,mBAAmB,SAAS,MAAM,WAClC,eAAe,SAAS,MAAM,kBAEvB,iBAAiB,CAAC,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,CAAC,KACxF,GAAG,CAAC,OAAO,GAAG,IAAI;;;AAEvB,wBAAiE"}
1
+ {"version":3,"file":"DynamicInput.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAU,MAAM,sBAAsB,CAAC;0BAoJ5F,CAAC,SAAS,MAAM,WAChB,aAAa,SAAS,sBAAsB,CAAC,CAAC,CAAC,8BAC/C,SAAS,SAAS,MAAM,WACxB,mBAAmB,SAAS,MAAM,WAClC,eAAe,SAAS,MAAM,kBAEvB,iBAAiB,CAAC,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,CAAC,KACxF,GAAG,CAAC,OAAO,GAAG,IAAI;;;AAEvB,wBAAiE"}
@@ -5,7 +5,7 @@ import { StyledExpressionControl, StyledDynamicInput } from './DynamicInput.styl
5
5
  import SourceButton from './SourceButton';
6
6
  import { getCurrentSource, getSourceIcon } from './utils';
7
7
  import { getDynamicInputTestIds } from './DynamicInput.test-ids';
8
- const DynamicInput = forwardRef(function DynamicInput({ testId, label: labelProp, sources, onSourceChange, controls, required, hideSourceButton, ...restProps }, ref) {
8
+ const DynamicInput = forwardRef(function DynamicInput({ testId, label: labelProp, sources, onSourceChange, controls, required, hideSourceButton, disabled, readOnly, ...restProps }, ref) {
9
9
  const testIds = useTestIds(testId, getDynamicInputTestIds);
10
10
  const inputUid = useUID();
11
11
  const t = useI18n();
@@ -18,19 +18,25 @@ const DynamicInput = forwardRef(function DynamicInput({ testId, label: labelProp
18
18
  ]),
19
19
  Expression: t('expression_label'),
20
20
  FieldReference: t('field_reference_label'),
21
- Rule: t('rule_label')
21
+ Rule: t('rule_label'),
22
+ ConfigurationSettings: t('configuration_settings_label')
22
23
  };
23
24
  const sourceDescriptions = {
24
25
  Constant: t('constant_description'),
25
26
  Expression: t('expression_description'),
26
27
  FieldReference: t('field_reference_description'),
27
- Rule: t('rule_description')
28
+ Rule: t('rule_description'),
29
+ ConfigurationSettings: t('configuration_settings_description')
28
30
  };
29
31
  let control = _jsx(_Fragment, { children: null });
30
32
  if (currentSource === 'Constant' && controls.constant) {
31
33
  const { props, component: Component } = controls.constant;
32
34
  control = (_jsx(Component, { ...props, id: inputUid, "data-testid": testIds.control, required: required }));
33
35
  }
36
+ else if (currentSource === 'ConfigurationSettings' && controls.configurationSettings) {
37
+ const { props, component: Component } = controls.configurationSettings;
38
+ control = (_jsx(Component, { ...props, id: inputUid, "data-testid": testIds.control, required: required }));
39
+ }
34
40
  else if (currentSource === 'Rule' && controls.rule) {
35
41
  const { props, component: Component } = controls.rule;
36
42
  control = (_jsx(Component, { ...props, id: inputUid, "data-testid": testIds.control, required: required }));
@@ -43,7 +49,7 @@ const DynamicInput = forwardRef(function DynamicInput({ testId, label: labelProp
43
49
  const { props, component: Component } = controls.fieldReference;
44
50
  control = (_jsx(Component, { ...props, id: inputUid, "data-testid": testIds.control, required: required }));
45
51
  }
46
- return (_jsxs(ThemeOverride, { theme: { base: { 'icon-set': 'streamline' } }, children: [_jsx(FormField, { label: label, labelFor: inputUid, required: required, ...restProps, ref: ref, testId: testIds.field, children: _jsxs(StyledDynamicInput, { children: [_jsx(_Fragment, { children: hideSourceButton ? null : (_jsx(SourceButton, { testId: testIds.menu, sources: sources, constantFormat: controls.constant?.props.format, icon: currentSource
52
+ return (_jsxs(ThemeOverride, { theme: { base: { 'icon-set': 'streamline' } }, children: [_jsx(FormField, { label: label, labelFor: inputUid, required: required, ...restProps, ref: ref, testId: testIds.field, disabled: disabled, readOnly: readOnly, children: _jsxs(StyledDynamicInput, { disabled: disabled, readOnly: readOnly, children: [_jsx(_Fragment, { children: hideSourceButton ? null : (_jsx(SourceButton, { testId: testIds.menu, sources: sources, constantFormat: controls.constant?.props.format, icon: currentSource
47
53
  ? getSourceIcon({
48
54
  source: currentSource,
49
55
  format: currentSource === 'Constant' ? controls.constant?.props.format : undefined
@@ -60,7 +66,7 @@ const DynamicInput = forwardRef(function DynamicInput({ testId, label: labelProp
60
66
  }), set: 'streamline' })),
61
67
  selected: config.selected
62
68
  };
63
- }), onSourceChange: onSourceChange, "aria-describedby": `${inputUid}-selected-source` })) }), control] }) }), _jsx(VisuallyHiddenText, { id: `${inputUid}-selected-source`, children: currentSource ? t('selected_noun', [sourceLabels[currentSource]]) : '' })] }));
69
+ }), onSourceChange: onSourceChange, "aria-describedby": `${inputUid}-selected-source`, disabled: disabled || readOnly })) }), control] }) }), _jsx(VisuallyHiddenText, { id: `${inputUid}-selected-source`, children: currentSource ? t('selected_noun', [sourceLabels[currentSource]]) : '' })] }));
64
70
  });
65
71
  export default withTestIds(DynamicInput, getDynamicInputTestIds);
66
72
  //# sourceMappingURL=DynamicInput.js.map