@pega/cosmos-react-build 8.8.0 → 9.0.0-build.10.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 (316) hide show
  1. package/lib/components/AuthoringPanel/AuthoringPanel.d.ts +7 -0
  2. package/lib/components/AuthoringPanel/AuthoringPanel.d.ts.map +1 -0
  3. package/lib/components/AuthoringPanel/AuthoringPanel.js +49 -0
  4. package/lib/components/AuthoringPanel/AuthoringPanel.js.map +1 -0
  5. package/lib/components/AuthoringPanel/AuthoringPanel.styles.d.ts +18 -0
  6. package/lib/components/AuthoringPanel/AuthoringPanel.styles.d.ts.map +1 -0
  7. package/lib/components/AuthoringPanel/AuthoringPanel.styles.js +133 -0
  8. package/lib/components/AuthoringPanel/AuthoringPanel.styles.js.map +1 -0
  9. package/lib/components/AuthoringPanel/AuthoringPanel.test-ids.d.ts +2 -0
  10. package/lib/components/AuthoringPanel/AuthoringPanel.test-ids.d.ts.map +1 -0
  11. package/lib/components/AuthoringPanel/AuthoringPanel.test-ids.js +16 -0
  12. package/lib/components/AuthoringPanel/AuthoringPanel.test-ids.js.map +1 -0
  13. package/lib/components/AuthoringPanel/AuthoringPanel.types.d.ts +81 -0
  14. package/lib/components/AuthoringPanel/AuthoringPanel.types.d.ts.map +1 -0
  15. package/lib/components/AuthoringPanel/AuthoringPanel.types.js +2 -0
  16. package/lib/components/AuthoringPanel/AuthoringPanel.types.js.map +1 -0
  17. package/lib/components/AuthoringPanel/AuthoringPanelHeader.d.ts +6 -0
  18. package/lib/components/AuthoringPanel/AuthoringPanelHeader.d.ts.map +1 -0
  19. package/lib/components/AuthoringPanel/AuthoringPanelHeader.js +41 -0
  20. package/lib/components/AuthoringPanel/AuthoringPanelHeader.js.map +1 -0
  21. package/lib/components/AuthoringPanel/index.d.ts +4 -0
  22. package/lib/components/AuthoringPanel/index.d.ts.map +1 -0
  23. package/lib/components/AuthoringPanel/index.js +3 -0
  24. package/lib/components/AuthoringPanel/index.js.map +1 -0
  25. package/lib/components/Automation/Automation.d.ts +7 -0
  26. package/lib/components/Automation/Automation.d.ts.map +1 -0
  27. package/lib/components/Automation/Automation.js +113 -0
  28. package/lib/components/Automation/Automation.js.map +1 -0
  29. package/lib/components/Automation/Automation.styles.d.ts +12 -0
  30. package/lib/components/Automation/Automation.styles.d.ts.map +1 -0
  31. package/lib/components/Automation/Automation.styles.js +68 -0
  32. package/lib/components/Automation/Automation.styles.js.map +1 -0
  33. package/lib/components/Automation/Automation.test-ids.d.ts +3 -0
  34. package/lib/components/Automation/Automation.test-ids.d.ts.map +1 -0
  35. package/lib/components/Automation/Automation.test-ids.js +21 -0
  36. package/lib/components/Automation/Automation.test-ids.js.map +1 -0
  37. package/lib/components/Automation/Automation.types.d.ts +95 -0
  38. package/lib/components/Automation/Automation.types.d.ts.map +1 -0
  39. package/lib/components/Automation/Automation.types.js +18 -0
  40. package/lib/components/Automation/Automation.types.js.map +1 -0
  41. package/lib/components/Automation/Automation.utils.d.ts +109 -0
  42. package/lib/components/Automation/Automation.utils.d.ts.map +1 -0
  43. package/lib/components/Automation/Automation.utils.js +208 -0
  44. package/lib/components/Automation/Automation.utils.js.map +1 -0
  45. package/lib/components/Automation/AutomationContext.d.ts +4 -0
  46. package/lib/components/Automation/AutomationContext.d.ts.map +1 -0
  47. package/lib/components/Automation/AutomationContext.js +9 -0
  48. package/lib/components/Automation/AutomationContext.js.map +1 -0
  49. package/lib/components/Automation/RuleStep.d.ts +7 -0
  50. package/lib/components/Automation/RuleStep.d.ts.map +1 -0
  51. package/lib/components/Automation/RuleStep.js +151 -0
  52. package/lib/components/Automation/RuleStep.js.map +1 -0
  53. package/lib/components/Automation/index.d.ts +5 -0
  54. package/lib/components/Automation/index.d.ts.map +1 -0
  55. package/lib/components/Automation/index.js +4 -0
  56. package/lib/components/Automation/index.js.map +1 -0
  57. package/lib/components/DynamicInput/BooleanControl.d.ts +2 -2
  58. package/lib/components/DynamicInput/BooleanControl.d.ts.map +1 -1
  59. package/lib/components/DynamicInput/BooleanControl.js.map +1 -1
  60. package/lib/components/DynamicInput/ConstantControl.d.ts +61 -0
  61. package/lib/components/DynamicInput/ConstantControl.d.ts.map +1 -0
  62. package/lib/components/DynamicInput/ConstantControl.js +58 -0
  63. package/lib/components/DynamicInput/ConstantControl.js.map +1 -0
  64. package/lib/components/DynamicInput/DynamicInput.d.ts +2 -2
  65. package/lib/components/DynamicInput/DynamicInput.d.ts.map +1 -1
  66. package/lib/components/DynamicInput/DynamicInput.js +13 -63
  67. package/lib/components/DynamicInput/DynamicInput.js.map +1 -1
  68. package/lib/components/DynamicInput/DynamicInput.styles.d.ts +0 -1
  69. package/lib/components/DynamicInput/DynamicInput.styles.d.ts.map +1 -1
  70. package/lib/components/DynamicInput/DynamicInput.styles.js +48 -41
  71. package/lib/components/DynamicInput/DynamicInput.styles.js.map +1 -1
  72. package/lib/components/DynamicInput/DynamicInput.types.d.ts +26 -81
  73. package/lib/components/DynamicInput/DynamicInput.types.d.ts.map +1 -1
  74. package/lib/components/DynamicInput/DynamicInput.types.js.map +1 -1
  75. package/lib/components/DynamicInput/index.d.ts +2 -0
  76. package/lib/components/DynamicInput/index.d.ts.map +1 -1
  77. package/lib/components/DynamicInput/index.js +1 -0
  78. package/lib/components/DynamicInput/index.js.map +1 -1
  79. package/lib/components/DynamicInput/utils.d.ts.map +1 -1
  80. package/lib/components/DynamicInput/utils.js +3 -2
  81. package/lib/components/DynamicInput/utils.js.map +1 -1
  82. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.d.ts +34 -0
  83. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.d.ts.map +1 -0
  84. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.js +55 -0
  85. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.js.map +1 -0
  86. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.test-ids.d.ts +2 -0
  87. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.test-ids.d.ts.map +1 -0
  88. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.test-ids.js +10 -0
  89. package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.test-ids.js.map +1 -0
  90. package/lib/components/EmptyRuleTemplate/index.d.ts +3 -0
  91. package/lib/components/EmptyRuleTemplate/index.d.ts.map +1 -0
  92. package/lib/components/EmptyRuleTemplate/index.js +2 -0
  93. package/lib/components/EmptyRuleTemplate/index.js.map +1 -0
  94. package/lib/components/Expression/Expression.d.ts.map +1 -1
  95. package/lib/components/Expression/Expression.js +8 -7
  96. package/lib/components/Expression/Expression.js.map +1 -1
  97. package/lib/components/Expression/Expression.styles.d.ts +5 -1
  98. package/lib/components/Expression/Expression.styles.d.ts.map +1 -1
  99. package/lib/components/Expression/Expression.styles.js +15 -3
  100. package/lib/components/Expression/Expression.styles.js.map +1 -1
  101. package/lib/components/Expression/Expression.test-ids.d.ts +1 -0
  102. package/lib/components/Expression/Expression.test-ids.d.ts.map +1 -1
  103. package/lib/components/Expression/Expression.test-ids.js +6 -0
  104. package/lib/components/Expression/Expression.test-ids.js.map +1 -1
  105. package/lib/components/Expression/ExpressionBuilderModal.d.ts +6 -0
  106. package/lib/components/Expression/ExpressionBuilderModal.d.ts.map +1 -0
  107. package/lib/components/Expression/ExpressionBuilderModal.js +53 -0
  108. package/lib/components/Expression/ExpressionBuilderModal.js.map +1 -0
  109. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -1
  110. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +1 -0
  111. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -1
  112. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts.map +1 -1
  113. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +3 -2
  114. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -1
  115. package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts +4 -2
  116. package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts.map +1 -1
  117. package/lib/components/ExpressionBuilder/ExpressionBuilder.js +66 -25
  118. package/lib/components/ExpressionBuilder/ExpressionBuilder.js.map +1 -1
  119. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts +18 -2
  120. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts.map +1 -1
  121. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js +80 -13
  122. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js.map +1 -1
  123. package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.d.ts +5 -0
  124. package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.d.ts.map +1 -0
  125. package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.js +22 -0
  126. package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.js.map +1 -0
  127. package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts +33 -5
  128. package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts.map +1 -1
  129. package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js.map +1 -1
  130. package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts +4 -2
  131. package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts.map +1 -1
  132. package/lib/components/ExpressionBuilder/ExpressionDetails.js +6 -4
  133. package/lib/components/ExpressionBuilder/ExpressionDetails.js.map +1 -1
  134. package/lib/components/ExpressionBuilder/ExpressionItem.d.ts +4 -2
  135. package/lib/components/ExpressionBuilder/ExpressionItem.d.ts.map +1 -1
  136. package/lib/components/ExpressionBuilder/ExpressionItem.js +8 -6
  137. package/lib/components/ExpressionBuilder/ExpressionItem.js.map +1 -1
  138. package/lib/components/ExpressionBuilder/ExpressionList.d.ts +4 -2
  139. package/lib/components/ExpressionBuilder/ExpressionList.d.ts.map +1 -1
  140. package/lib/components/ExpressionBuilder/ExpressionList.js +17 -5
  141. package/lib/components/ExpressionBuilder/ExpressionList.js.map +1 -1
  142. package/lib/components/ExpressionBuilder/index.d.ts +1 -0
  143. package/lib/components/ExpressionBuilder/index.d.ts.map +1 -1
  144. package/lib/components/ExpressionBuilder/index.js +1 -0
  145. package/lib/components/ExpressionBuilder/index.js.map +1 -1
  146. package/lib/components/FieldReference/FieldReference.types.d.ts +16 -2
  147. package/lib/components/FieldReference/FieldReference.types.d.ts.map +1 -1
  148. package/lib/components/FieldReference/FieldReference.types.js.map +1 -1
  149. package/lib/components/FieldReference/FieldReferenceInput.d.ts.map +1 -1
  150. package/lib/components/FieldReference/FieldReferenceInput.js +5 -5
  151. package/lib/components/FieldReference/FieldReferenceInput.js.map +1 -1
  152. package/lib/components/FieldReference/helpers.d.ts +7 -1
  153. package/lib/components/FieldReference/helpers.d.ts.map +1 -1
  154. package/lib/components/FieldReference/helpers.js +31 -1
  155. package/lib/components/FieldReference/helpers.js.map +1 -1
  156. package/lib/components/FieldReference/index.d.ts +2 -2
  157. package/lib/components/FieldReference/index.d.ts.map +1 -1
  158. package/lib/components/FieldReference/index.js +1 -1
  159. package/lib/components/FieldReference/index.js.map +1 -1
  160. package/lib/components/IconTile/iconUtils.d.ts +2 -1
  161. package/lib/components/IconTile/iconUtils.d.ts.map +1 -1
  162. package/lib/components/IconTile/iconUtils.js +94 -1
  163. package/lib/components/IconTile/iconUtils.js.map +1 -1
  164. package/lib/components/IconTile/index.d.ts +1 -0
  165. package/lib/components/IconTile/index.d.ts.map +1 -1
  166. package/lib/components/IconTile/index.js +1 -0
  167. package/lib/components/IconTile/index.js.map +1 -1
  168. package/lib/components/LifeCycle/Category.d.ts +0 -1
  169. package/lib/components/LifeCycle/Category.d.ts.map +1 -1
  170. package/lib/components/LifeCycle/Category.js +16 -56
  171. package/lib/components/LifeCycle/Category.js.map +1 -1
  172. package/lib/components/LifeCycle/LifeCycle.js +2 -2
  173. package/lib/components/LifeCycle/LifeCycle.js.map +1 -1
  174. package/lib/components/LifeCycle/LifeCycle.types.d.ts +37 -2
  175. package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
  176. package/lib/components/LifeCycle/LifeCycle.types.js +9 -9
  177. package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -1
  178. package/lib/components/LifeCycle/LifeCycleDragDropList.d.ts.map +1 -1
  179. package/lib/components/LifeCycle/LifeCycleDragDropList.js +25 -3
  180. package/lib/components/LifeCycle/LifeCycleDragDropList.js.map +1 -1
  181. package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
  182. package/lib/components/LifeCycle/Stage.js +20 -11
  183. package/lib/components/LifeCycle/Stage.js.map +1 -1
  184. package/lib/components/LifeCycle/Step.d.ts.map +1 -1
  185. package/lib/components/LifeCycle/Step.js +1 -0
  186. package/lib/components/LifeCycle/Step.js.map +1 -1
  187. package/lib/components/LifeCycle/Task.d.ts +7 -1
  188. package/lib/components/LifeCycle/Task.d.ts.map +1 -1
  189. package/lib/components/LifeCycle/Task.js +19 -10
  190. package/lib/components/LifeCycle/Task.js.map +1 -1
  191. package/lib/components/LifeCycle/TaskGroup.d.ts +23 -0
  192. package/lib/components/LifeCycle/TaskGroup.d.ts.map +1 -0
  193. package/lib/components/LifeCycle/TaskGroup.js +92 -0
  194. package/lib/components/LifeCycle/TaskGroup.js.map +1 -0
  195. package/lib/components/LifeCycle/index.d.ts +1 -1
  196. package/lib/components/LifeCycle/index.d.ts.map +1 -1
  197. package/lib/components/LifeCycle/index.js +1 -1
  198. package/lib/components/LifeCycle/index.js.map +1 -1
  199. package/lib/components/LifeCycle/utils.d.ts +6 -1
  200. package/lib/components/LifeCycle/utils.d.ts.map +1 -1
  201. package/lib/components/LifeCycle/utils.js +129 -0
  202. package/lib/components/LifeCycle/utils.js.map +1 -1
  203. package/lib/components/ObjectSelect/InputTree/InputTree.d.ts +21 -0
  204. package/lib/components/ObjectSelect/InputTree/InputTree.d.ts.map +1 -0
  205. package/lib/components/ObjectSelect/InputTree/InputTree.js +20 -0
  206. package/lib/components/ObjectSelect/InputTree/InputTree.js.map +1 -0
  207. package/lib/components/ObjectSelect/InputTree/InputTree.styles.d.ts +10 -0
  208. package/lib/components/ObjectSelect/InputTree/InputTree.styles.d.ts.map +1 -0
  209. package/lib/components/ObjectSelect/InputTree/InputTree.styles.js +82 -0
  210. package/lib/components/ObjectSelect/InputTree/InputTree.styles.js.map +1 -0
  211. package/lib/components/ObjectSelect/InputTree/index.d.ts +3 -0
  212. package/lib/components/ObjectSelect/InputTree/index.d.ts.map +1 -0
  213. package/lib/components/ObjectSelect/InputTree/index.js +2 -0
  214. package/lib/components/ObjectSelect/InputTree/index.js.map +1 -0
  215. package/lib/components/ObjectSelect/ObjectPicker.d.ts +11 -5
  216. package/lib/components/ObjectSelect/ObjectPicker.d.ts.map +1 -1
  217. package/lib/components/ObjectSelect/ObjectPicker.js +24 -15
  218. package/lib/components/ObjectSelect/ObjectPicker.js.map +1 -1
  219. package/lib/components/ObjectSelect/ObjectSelect.d.ts +2 -29
  220. package/lib/components/ObjectSelect/ObjectSelect.d.ts.map +1 -1
  221. package/lib/components/ObjectSelect/ObjectSelect.js +80 -23
  222. package/lib/components/ObjectSelect/ObjectSelect.js.map +1 -1
  223. package/lib/components/ObjectSelect/ObjectSelect.types.d.ts +53 -0
  224. package/lib/components/ObjectSelect/ObjectSelect.types.d.ts.map +1 -0
  225. package/lib/components/ObjectSelect/ObjectSelect.types.js +2 -0
  226. package/lib/components/ObjectSelect/ObjectSelect.types.js.map +1 -0
  227. package/lib/components/ObjectSelect/index.d.ts +1 -1
  228. package/lib/components/ObjectSelect/index.d.ts.map +1 -1
  229. package/lib/components/ObjectSelect/index.js.map +1 -1
  230. package/lib/components/ObjectSelect/useCreateModal.d.ts +6 -2
  231. package/lib/components/ObjectSelect/useCreateModal.d.ts.map +1 -1
  232. package/lib/components/ObjectSelect/useCreateModal.js +7 -4
  233. package/lib/components/ObjectSelect/useCreateModal.js.map +1 -1
  234. package/lib/components/PageBanner/PageBanner.d.ts +6 -4
  235. package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
  236. package/lib/components/PageBanner/PageBanner.js +10 -9
  237. package/lib/components/PageBanner/PageBanner.js.map +1 -1
  238. package/lib/components/PageBanner/PageBanner.test-ids.d.ts +2 -0
  239. package/lib/components/PageBanner/PageBanner.test-ids.d.ts.map +1 -0
  240. package/lib/components/PageBanner/PageBanner.test-ids.js +9 -0
  241. package/lib/components/PageBanner/PageBanner.test-ids.js.map +1 -0
  242. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.d.ts +12 -0
  243. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.d.ts.map +1 -0
  244. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.js +158 -0
  245. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.js.map +1 -0
  246. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.d.ts +5 -0
  247. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.d.ts.map +1 -0
  248. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.js +17 -0
  249. package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.js.map +1 -0
  250. package/lib/components/PageTemplates/GalleryPage.d.ts +14 -4
  251. package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -1
  252. package/lib/components/PageTemplates/GalleryPage.js +57 -12
  253. package/lib/components/PageTemplates/GalleryPage.js.map +1 -1
  254. package/lib/components/PageTemplates/HeaderActionButtons.d.ts +5 -0
  255. package/lib/components/PageTemplates/HeaderActionButtons.d.ts.map +1 -0
  256. package/lib/components/PageTemplates/HeaderActionButtons.js +14 -0
  257. package/lib/components/PageTemplates/HeaderActionButtons.js.map +1 -0
  258. package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageHeader.d.ts +8 -0
  259. package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageHeader.d.ts.map +1 -0
  260. package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageHeader.js +23 -0
  261. package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageHeader.js.map +1 -0
  262. package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageTemplate.d.ts +5 -0
  263. package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageTemplate.d.ts.map +1 -0
  264. package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageTemplate.js +10 -0
  265. package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageTemplate.js.map +1 -0
  266. package/lib/components/PageTemplates/OverviewPageTemplate/OverviewPageTemplate.d.ts +5 -0
  267. package/lib/components/PageTemplates/OverviewPageTemplate/OverviewPageTemplate.d.ts.map +1 -0
  268. package/lib/components/PageTemplates/OverviewPageTemplate/OverviewPageTemplate.js +10 -0
  269. package/lib/components/PageTemplates/OverviewPageTemplate/OverviewPageTemplate.js.map +1 -0
  270. package/lib/components/PageTemplates/OverviewPageTemplate/PageBanner.d.ts +21 -0
  271. package/lib/components/PageTemplates/OverviewPageTemplate/PageBanner.d.ts.map +1 -0
  272. package/lib/components/PageTemplates/OverviewPageTemplate/PageBanner.js +22 -0
  273. package/lib/components/PageTemplates/OverviewPageTemplate/PageBanner.js.map +1 -0
  274. package/lib/components/PageTemplates/PageTemplate.styles.d.ts +16 -0
  275. package/lib/components/PageTemplates/PageTemplate.styles.d.ts.map +1 -0
  276. package/lib/components/PageTemplates/PageTemplate.styles.js +167 -0
  277. package/lib/components/PageTemplates/PageTemplate.styles.js.map +1 -0
  278. package/lib/components/PageTemplates/PageTemplate.types.d.ts +114 -0
  279. package/lib/components/PageTemplates/PageTemplate.types.d.ts.map +1 -0
  280. package/lib/components/PageTemplates/PageTemplate.types.js +2 -0
  281. package/lib/components/PageTemplates/PageTemplate.types.js.map +1 -0
  282. package/lib/components/PageTemplates/PageTemplates.d.ts +16 -12
  283. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  284. package/lib/components/PageTemplates/PageTemplates.js +12 -12
  285. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  286. package/lib/components/PageTemplates/PageTemplates.test-ids.d.ts +4 -0
  287. package/lib/components/PageTemplates/PageTemplates.test-ids.d.ts.map +1 -0
  288. package/lib/components/PageTemplates/PageTemplates.test-ids.js +25 -0
  289. package/lib/components/PageTemplates/PageTemplates.test-ids.js.map +1 -0
  290. package/lib/components/PageTemplates/ShowcasePage.d.ts +2 -2
  291. package/lib/components/PageTemplates/ShowcasePage.d.ts.map +1 -1
  292. package/lib/components/PageTemplates/ShowcasePage.js +5 -6
  293. package/lib/components/PageTemplates/ShowcasePage.js.map +1 -1
  294. package/lib/components/PageTemplates/index.d.ts +6 -1
  295. package/lib/components/PageTemplates/index.d.ts.map +1 -1
  296. package/lib/components/PageTemplates/index.js +5 -1
  297. package/lib/components/PageTemplates/index.js.map +1 -1
  298. package/lib/components/RulePicker/RulePicker.d.ts +4 -0
  299. package/lib/components/RulePicker/RulePicker.d.ts.map +1 -0
  300. package/lib/components/RulePicker/RulePicker.js +81 -0
  301. package/lib/components/RulePicker/RulePicker.js.map +1 -0
  302. package/lib/index.d.ts +5 -1
  303. package/lib/index.d.ts.map +1 -1
  304. package/lib/index.js +5 -1
  305. package/lib/index.js.map +1 -1
  306. package/lib/utils/typeIconMapping.js +1 -1
  307. package/lib/utils/typeIconMapping.js.map +1 -1
  308. package/package.json +4 -4
  309. package/lib/utils/index.d.ts +0 -2
  310. package/lib/utils/index.d.ts.map +0 -1
  311. package/lib/utils/index.js +0 -2
  312. package/lib/utils/index.js.map +0 -1
  313. package/lib/utils/utils.d.ts +0 -14
  314. package/lib/utils/utils.d.ts.map +0 -1
  315. package/lib/utils/utils.js +0 -13
  316. package/lib/utils/utils.js.map +0 -1
@@ -0,0 +1,58 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CurrencyInput, DateInput, DateTimeInput, Input, NumberInput, PhoneInput, TextArea, TimeInput } from '@pega/cosmos-react-core';
3
+ import BooleanControl from './BooleanControl';
4
+ const ConstantControl = ({ format, props, required, 'data-testid': testId, id: inputUid }) => {
5
+ let control = null;
6
+ const { value } = props;
7
+ // Note: This is just a typeguard for the value prop.
8
+ if (typeof value === 'string' || value === undefined) {
9
+ if (format === 'Text') {
10
+ control = (_jsx(Input, { ...props, "data-testid": testId, id: inputUid, onChange: (e) => {
11
+ props.onChange(e.target.value);
12
+ }, required: required }));
13
+ }
14
+ if (format === 'Text (paragraph)') {
15
+ control = (_jsx(TextArea, { ...props, "data-testid": testId, id: inputUid, onChange: (e) => {
16
+ props.onChange(e.target.value);
17
+ }, required: required }));
18
+ }
19
+ if (format === 'Currency') {
20
+ control = _jsx(CurrencyInput, { ...props, "data-testid": testId, id: inputUid, required: required });
21
+ }
22
+ if (format === 'Percentage') {
23
+ control = (_jsx(NumberInput, { ...props, "data-testid": testId, id: inputUid, showGroupSeparators: false, numberOfDecimals: undefined, unit: 'percent', required: required }));
24
+ }
25
+ if (format === 'Integer') {
26
+ control = (_jsx(NumberInput, { ...props, "data-testid": testId, id: inputUid, showGroupSeparators: false,
27
+ // Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.
28
+ showDecimal: false, required: required }));
29
+ }
30
+ if (format === 'Decimal') {
31
+ control = _jsx(NumberInput, { ...props, "data-testid": testId, id: inputUid, required: required });
32
+ }
33
+ if (format === 'Phone') {
34
+ control = (_jsx(PhoneInput, { ...props, "data-testid": testId, id: inputUid, required: required, showCountryCode: true }));
35
+ }
36
+ }
37
+ if (format === 'Boolean') {
38
+ control = _jsx(BooleanControl, { ...props, "data-testid": testId, id: inputUid, required: required });
39
+ }
40
+ // Note: This is just a typeguard for the value prop.
41
+ if (typeof value === 'string' ||
42
+ typeof value === 'number' ||
43
+ value instanceof Date ||
44
+ value === undefined) {
45
+ if (format === 'DateTime') {
46
+ control = _jsx(DateTimeInput, { ...props, "data-testid": testId, id: inputUid, required: required });
47
+ }
48
+ if (format === 'Date') {
49
+ control = _jsx(DateInput, { ...props, "data-testid": testId, id: inputUid, required: required });
50
+ }
51
+ if (format === 'Time') {
52
+ control = _jsx(TimeInput, { ...props, "data-testid": testId, id: inputUid, required: required });
53
+ }
54
+ }
55
+ return control;
56
+ };
57
+ export default ConstantControl;
58
+ //# sourceMappingURL=ConstantControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConstantControl.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/ConstantControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACV,MAAM,yBAAyB,CAAC;AAejC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AA2F9C,MAAM,eAAe,GAAG,CAAC,EACvB,MAAM,EACN,KAAK,EACL,QAAQ,EACR,aAAa,EAAE,MAAM,EACrB,EAAE,EAAE,QAAQ,EAGW,EAAE,EAAE;IAC3B,IAAI,OAAO,GAAuB,IAAI,CAAC;IAEvC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,qDAAqD;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACrD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,CACR,KAAC,KAAK,OACA,KAAK,iBACI,MAAM,EACnB,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,CAAC,CAAgC,EAAE,EAAE;oBAC7C,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACjC,CAAC,EACD,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,KAAK,kBAAkB,EAAE,CAAC;YAClC,OAAO,GAAG,CACR,KAAC,QAAQ,OACH,KAAK,iBACI,MAAM,EACnB,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,CAAC,CAAmC,EAAE,EAAE;oBAChD,KAAK,CAAC,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AAG,KAAC,cAAc,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;IACjG,CAAC;IAED,qDAAqD;IACrD,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,YAAY,IAAI;QACrB,KAAK,KAAK,SAAS,EACnB,CAAC;QACD,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;YAC1B,OAAO,GAAG,KAAC,aAAa,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAChG,CAAC;QAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,KAAC,SAAS,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAC5F,CAAC;QAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,KAAC,SAAS,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAC5F,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import type { ChangeEvent } from 'react';\n\nimport {\n CurrencyInput,\n DateInput,\n DateTimeInput,\n Input,\n NumberInput,\n PhoneInput,\n TextArea,\n TimeInput\n} from '@pega/cosmos-react-core';\nimport type {\n ComboBoxProps,\n CurrencyInputProps,\n DateInputProps,\n DateTimeInputProps,\n FormControlProps,\n InputProps,\n NumberInputProps,\n OmitStrict,\n PhoneInputProps,\n TextAreaProps,\n TimeInputProps\n} from '@pega/cosmos-react-core';\n\nimport BooleanControl from './BooleanControl';\n\nexport type FormControlPropsToOmit = keyof Pick<\n FormControlProps,\n 'label' | 'labelHidden' | 'additionalInfo' | 'info' | 'required'\n>;\n\ntype ConstantTextConfig = {\n format: 'Text';\n props: OmitStrict<InputProps, FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDecimalConfig = {\n format: 'Decimal';\n props: OmitStrict<NumberInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantIntegerConfig = {\n format: 'Integer';\n props: OmitStrict<\n NumberInputProps,\n FormControlPropsToOmit | 'showGroupSeparators' | 'showDecimal'\n >;\n};\n\ntype ConstantPercentageConfig = {\n format: 'Percentage';\n props: OmitStrict<\n NumberInputProps,\n FormControlPropsToOmit | 'showGroupSeparators' | 'numberOfDecimals' | 'unit'\n >;\n};\n\ntype ConstantTextAreaConfig = {\n format: 'Text (paragraph)';\n props: OmitStrict<TextAreaProps, FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDateConfig = {\n format: 'Date';\n props: OmitStrict<DateInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantDateTimeConfig = {\n format: 'DateTime';\n props: OmitStrict<DateTimeInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantTimeConfig = {\n format: 'Time';\n props: OmitStrict<TimeInputProps, FormControlPropsToOmit>;\n};\n\nexport type BooleanLabels = 'true|false' | 'always|never';\n\nexport type ConstantBooleanConfig = {\n format: 'Boolean';\n props: OmitStrict<ComboBoxProps, FormControlPropsToOmit | 'value' | 'onChange'> & {\n value?: boolean;\n onChange: (value: boolean) => void;\n booleanLabels?: BooleanLabels;\n };\n};\n\ntype ConstantCurrencyConfig = {\n format: 'Currency';\n props: OmitStrict<CurrencyInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantPhoneConfig = {\n format: 'Phone';\n props: OmitStrict<PhoneInputProps, FormControlPropsToOmit | 'showCountryCode'>;\n};\n\nexport type ConstantControlConfig =\n | ConstantTextConfig\n | ConstantDecimalConfig\n | ConstantIntegerConfig\n | ConstantPercentageConfig\n | ConstantTextAreaConfig\n | ConstantDateConfig\n | ConstantDateTimeConfig\n | ConstantTimeConfig\n | ConstantBooleanConfig\n | ConstantCurrencyConfig\n | ConstantPhoneConfig;\n\nconst ConstantControl = ({\n format,\n props,\n required,\n 'data-testid': testId,\n id: inputUid\n}: Pick<FormControlProps, 'id' | 'required' | 'disabled' | 'status' | 'readOnly'> & {\n 'data-testid'?: string;\n} & ConstantControlConfig) => {\n let control: JSX.Element | null = null;\n\n const { value } = props;\n // Note: This is just a typeguard for the value prop.\n if (typeof value === 'string' || value === undefined) {\n if (format === 'Text') {\n control = (\n <Input\n {...props}\n data-testid={testId}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Text (paragraph)') {\n control = (\n <TextArea\n {...props}\n data-testid={testId}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Currency') {\n control = <CurrencyInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Percentage') {\n control = (\n <NumberInput\n {...props}\n data-testid={testId}\n id={inputUid}\n showGroupSeparators={false}\n numberOfDecimals={undefined}\n unit='percent'\n required={required}\n />\n );\n }\n\n if (format === 'Integer') {\n control = (\n <NumberInput\n {...props}\n data-testid={testId}\n id={inputUid}\n showGroupSeparators={false}\n // Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.\n showDecimal={false}\n required={required}\n />\n );\n }\n\n if (format === 'Decimal') {\n control = <NumberInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Phone') {\n control = (\n <PhoneInput\n {...props}\n data-testid={testId}\n id={inputUid}\n required={required}\n showCountryCode\n />\n );\n }\n }\n\n if (format === 'Boolean') {\n control = <BooleanControl {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n // Note: This is just a typeguard for the value prop.\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n value instanceof Date ||\n value === undefined\n ) {\n if (format === 'DateTime') {\n control = <DateTimeInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Date') {\n control = <DateInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Time') {\n control = <TimeInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n }\n return control;\n};\n\nexport default ConstantControl;\n"]}
@@ -1,5 +1,5 @@
1
- import type { DynamicInputProps } from './DynamicInput.types';
2
- declare const _default: import("react").ForwardRefExoticComponent<Omit<DynamicInputProps, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
1
+ import type { ConstantComponentProps, DynamicInputProps } from './DynamicInput.types';
2
+ declare const _default: (<T extends object = object, ConstantProps extends ConstantComponentProps<T> = ConstantComponentProps<T>, RuleProps extends object = object, FieldReferenceProps extends object = object, ExpressionProps extends object = object>(props: DynamicInputProps<T, ConstantProps, RuleProps, FieldReferenceProps, ExpressionProps>) => JSX.Element | null) & {
3
3
  getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["field", "menu", "control", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
4
4
  };
5
5
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicInput.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,iBAAiB,EAAU,MAAM,sBAAsB,CAAC;;;;AAsRtE,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;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,20 +1,17 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
- import { ThemeOverride, CurrencyInput, DateInput, DateTimeInput, FormField, Input, NumberInput, PhoneInput, TextArea, TimeInput, useI18n, useTestIds, useUID, withTestIds, Icon, VisuallyHiddenText } from '@pega/cosmos-react-core';
4
- import { RuleSelect } from '../RuleSelect';
5
- import { FieldReferenceInput } from '../FieldReference';
3
+ import { ThemeOverride, useI18n, useTestIds, useUID, Icon, VisuallyHiddenText, FormField, withTestIds } from '@pega/cosmos-react-core';
6
4
  import { StyledExpressionControl, StyledDynamicInput } from './DynamicInput.styles';
7
- import BooleanControl from './BooleanControl';
8
5
  import SourceButton from './SourceButton';
9
6
  import { getCurrentSource, getSourceIcon } from './utils';
10
7
  import { getDynamicInputTestIds } from './DynamicInput.test-ids';
11
- const DynamicInput = forwardRef(({ testId, label: labelProp, sources, onSourceChange, controls, required, hideSourceButton, ...restProps }, ref) => {
8
+ const DynamicInput = forwardRef(function DynamicInput({ testId, label: labelProp, sources, onSourceChange, controls, required, hideSourceButton, ...restProps }, ref) {
12
9
  const testIds = useTestIds(testId, getDynamicInputTestIds);
13
10
  const inputUid = useUID();
14
11
  const t = useI18n();
15
12
  const label = labelProp ?? t('value');
16
13
  const currentSource = getCurrentSource(sources);
17
- const constantFormat = controls.constant?.format;
14
+ const constantFormat = controls.constant?.props.format;
18
15
  const sourceLabels = {
19
16
  Constant: t('constant_label', [
20
17
  constantFormat ? t(`dynamicInput_format_${constantFormat}`) : ''
@@ -31,72 +28,25 @@ const DynamicInput = forwardRef(({ testId, label: labelProp, sources, onSourceCh
31
28
  };
32
29
  let control = _jsx(_Fragment, { children: null });
33
30
  if (currentSource === 'Constant' && controls.constant) {
34
- const { format, props } = controls.constant;
35
- const { value } = props;
36
- // Note: This is just a typeguard for the value prop.
37
- if (typeof value === 'string' || value === undefined) {
38
- if (format === 'Text') {
39
- control = (_jsx(Input, { ...props, "data-testid": testIds.control, id: inputUid, onChange: (e) => {
40
- props.onChange(e.target.value);
41
- }, required: required }));
42
- }
43
- if (format === 'Text (paragraph)') {
44
- control = (_jsx(TextArea, { ...props, "data-testid": testIds.control, id: inputUid, onChange: (e) => {
45
- props.onChange(e.target.value);
46
- }, required: required }));
47
- }
48
- if (format === 'Currency') {
49
- control = (_jsx(CurrencyInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
50
- }
51
- if (format === 'Percentage') {
52
- control = (_jsx(NumberInput, { ...props, "data-testid": testIds.control, id: inputUid, showGroupSeparators: false, numberOfDecimals: undefined, unit: 'percent', required: required }));
53
- }
54
- if (format === 'Integer') {
55
- control = (_jsx(NumberInput, { ...props, "data-testid": testIds.control, id: inputUid, showGroupSeparators: false,
56
- // Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.
57
- showDecimal: false, required: required }));
58
- }
59
- if (format === 'Decimal') {
60
- control = (_jsx(NumberInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
61
- }
62
- if (format === 'Phone') {
63
- control = (_jsx(PhoneInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required, showCountryCode: true }));
64
- }
65
- }
66
- if (format === 'Boolean') {
67
- control = (_jsx(BooleanControl, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
68
- }
69
- // Note: This is just a typeguard for the value prop.
70
- if (typeof value === 'string' ||
71
- typeof value === 'number' ||
72
- value instanceof Date ||
73
- value === undefined) {
74
- if (format === 'DateTime') {
75
- control = (_jsx(DateTimeInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
76
- }
77
- if (format === 'Date') {
78
- control = (_jsx(DateInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
79
- }
80
- if (format === 'Time') {
81
- control = (_jsx(TimeInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
82
- }
83
- }
31
+ const { props, component: Component } = controls.constant;
32
+ control = (_jsx(Component, { ...props, id: inputUid, "data-testid": testIds.control, required: required }));
84
33
  }
85
34
  else if (currentSource === 'Rule' && controls.rule) {
86
- control = (_jsx(RuleSelect, { ...controls.rule.props, "data-testid": testIds.control, id: inputUid, required: required }));
35
+ const { props, component: Component } = controls.rule;
36
+ control = (_jsx(Component, { ...props, id: inputUid, "data-testid": testIds.control, required: required }));
87
37
  }
88
38
  else if (currentSource === 'Expression' && controls.expression) {
89
- const ExpressionControl = controls.expression.component;
90
- const controlProps = controls.expression.props;
91
- control = (_jsx(StyledExpressionControl, { container: true, children: _jsx(ExpressionControl, { ...controlProps, "data-testid": testIds.control, id: inputUid, required: required }) }));
39
+ const { props, component: Component } = controls.expression;
40
+ control = (_jsx(StyledExpressionControl, { container: true, children: _jsx(Component, { ...props, id: inputUid, "data-testid": testIds.control, required: required }) }));
92
41
  }
93
42
  else if (currentSource === 'FieldReference' && controls.fieldReference) {
94
- control = (_jsx(FieldReferenceInput, { ...controls.fieldReference.props, "data-testid": testIds.control, id: inputUid, required: required }));
43
+ const { props, component: Component } = controls.fieldReference;
44
+ control = (_jsx(Component, { ...props, id: inputUid, "data-testid": testIds.control, required: required }));
95
45
  }
96
- 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?.format, icon: currentSource
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
97
47
  ? getSourceIcon({
98
48
  source: currentSource,
99
- format: currentSource === 'Constant' ? controls.constant?.format : undefined
49
+ format: currentSource === 'Constant' ? controls.constant?.props.format : undefined
100
50
  })
101
51
  : undefined, menuItems: sources.map(config => {
102
52
  const type = config.type;
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicInput.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,EACT,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,OAAO,EACP,UAAU,EACV,MAAM,EACN,WAAW,EACX,IAAI,EACJ,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,YAAY,GAAG,UAAU,CAC7B,CACE,EACE,MAAM,EACN,KAAK,EAAE,SAAS,EAChB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,GAAG,SAAS,EACuB,E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Q,kBAAkB,GAC/C,CACH,GACA,EACF,OAAO,IACW,GACX,EAEZ,KAAC,kBAAkB,IAAC,EAAE,EAAE,GAAG,QAAQ,kBAAkB,YAClD,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GACpD,IACP,CACjB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { ChangeEvent, PropsWithoutRef } from 'react';\n\nimport {\n ThemeOverride,\n CurrencyInput,\n DateInput,\n DateTimeInput,\n FormField,\n Input,\n NumberInput,\n PhoneInput,\n TextArea,\n TimeInput,\n useI18n,\n useTestIds,\n useUID,\n withTestIds,\n Icon,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\n\nimport { RuleSelect } from '../RuleSelect';\nimport { FieldReferenceInput } from '../FieldReference';\n\nimport type { DynamicInputProps, Source } from './DynamicInput.types';\nimport { StyledExpressionControl, StyledDynamicInput } from './DynamicInput.styles';\nimport BooleanControl from './BooleanControl';\nimport SourceButton from './SourceButton';\nimport { getCurrentSource, getSourceIcon } from './utils';\nimport { getDynamicInputTestIds } from './DynamicInput.test-ids';\n\nconst DynamicInput = forwardRef(\n (\n {\n testId,\n label: labelProp,\n sources,\n onSourceChange,\n controls,\n required,\n hideSourceButton,\n ...restProps\n }: PropsWithoutRef<DynamicInputProps>,\n ref: DynamicInputProps['ref']\n ) => {\n const testIds = useTestIds(testId, getDynamicInputTestIds);\n const inputUid = useUID();\n const t = useI18n();\n\n const label = labelProp ?? t('value');\n const currentSource = getCurrentSource(sources);\n const constantFormat = controls.constant?.format;\n const sourceLabels: { [key in Source]: string } = {\n Constant: t('constant_label', [\n constantFormat ? t(`dynamicInput_format_${constantFormat}`) : ''\n ]),\n Expression: t('expression_label'),\n FieldReference: t('field_reference_label'),\n Rule: t('rule_label')\n };\n const sourceDescriptions: { [key in Source]: string } = {\n Constant: t('constant_description'),\n Expression: t('expression_description'),\n FieldReference: t('field_reference_description'),\n Rule: t('rule_description')\n };\n\n let control: JSX.Element = <>{null}</>;\n\n if (currentSource === 'Constant' && controls.constant) {\n const { format, props } = controls.constant;\n const { value } = props;\n // Note: This is just a typeguard for the value prop.\n if (typeof value === 'string' || value === undefined) {\n if (format === 'Text') {\n control = (\n <Input\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Text (paragraph)') {\n control = (\n <TextArea\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Currency') {\n control = (\n <CurrencyInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n if (format === 'Percentage') {\n control = (\n <NumberInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n showGroupSeparators={false}\n numberOfDecimals={undefined}\n unit='percent'\n required={required}\n />\n );\n }\n\n if (format === 'Integer') {\n control = (\n <NumberInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n showGroupSeparators={false}\n // Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.\n showDecimal={false}\n required={required}\n />\n );\n }\n\n if (format === 'Decimal') {\n control = (\n <NumberInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n if (format === 'Phone') {\n control = (\n <PhoneInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n showCountryCode\n />\n );\n }\n }\n\n if (format === 'Boolean') {\n control = (\n <BooleanControl\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n // Note: This is just a typeguard for the value prop.\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n value instanceof Date ||\n value === undefined\n ) {\n if (format === 'DateTime') {\n control = (\n <DateTimeInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n if (format === 'Date') {\n control = (\n <DateInput {...props} data-testid={testIds.control} id={inputUid} required={required} />\n );\n }\n\n if (format === 'Time') {\n control = (\n <TimeInput {...props} data-testid={testIds.control} id={inputUid} required={required} />\n );\n }\n }\n } else if (currentSource === 'Rule' && controls.rule) {\n control = (\n <RuleSelect\n {...controls.rule.props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n } else if (currentSource === 'Expression' && controls.expression) {\n const ExpressionControl = controls.expression.component;\n const controlProps = controls.expression.props;\n\n control = (\n <StyledExpressionControl container>\n <ExpressionControl\n {...controlProps}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n </StyledExpressionControl>\n );\n } else if (currentSource === 'FieldReference' && controls.fieldReference) {\n control = (\n <FieldReferenceInput\n {...controls.fieldReference.props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n return (\n <ThemeOverride theme={{ base: { 'icon-set': 'streamline' } }}>\n <FormField\n label={label}\n labelFor={inputUid}\n required={required}\n {...restProps}\n ref={ref}\n testId={testIds.field}\n >\n <StyledDynamicInput>\n <>\n {hideSourceButton ? null : (\n <SourceButton\n testId={testIds.menu}\n sources={sources}\n constantFormat={controls.constant?.format}\n icon={\n currentSource\n ? getSourceIcon({\n source: currentSource,\n format:\n currentSource === 'Constant' ? controls.constant?.format : undefined\n })\n : undefined\n }\n menuItems={sources.map(config => {\n const type = config.type;\n\n return {\n id: type,\n primary: sourceLabels[config.type],\n secondary: [sourceDescriptions[type]],\n visual: (\n <Icon\n name={getSourceIcon({\n source: type,\n format: type === 'Constant' ? constantFormat : undefined\n })}\n set='streamline'\n />\n ),\n selected: config.selected\n };\n })}\n onSourceChange={onSourceChange}\n aria-describedby={`${inputUid}-selected-source`}\n />\n )}\n </>\n {control}\n </StyledDynamicInput>\n </FormField>\n\n <VisuallyHiddenText id={`${inputUid}-selected-source`}>\n {currentSource ? t('selected_noun', [sourceLabels[currentSource]]) : ''}\n </VisuallyHiddenText>\n </ThemeOverride>\n );\n }\n);\n\nexport default withTestIds(DynamicInput, getDynamicInputTestIds);\n"]}
1
+ {"version":3,"file":"DynamicInput.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EACL,aAAa,EACb,OAAO,EACP,UAAU,EACV,MAAM,EACN,IAAI,EACJ,kBAAkB,EAClB,SAAS,EACT,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,YAAY,CAOnD,EACE,MAAM,EACN,KAAK,EAAE,SAAS,EAChB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,GAAG,SAAS,EAGb,EACD,GAAgG;IAEhG,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,KAAK,GAAG,SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,cAAc,GAAG,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,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AAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;qCAC7E,CAAC;oCACJ,CAAC,CAAC,SAAS,EAEf,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;oCAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;oCAEzB,OAAO;wCACL,EAAE,EAAE,IAAI;wCACR,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC;wCAClC,SAAS,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;wCACrC,MAAM,EAAE,CACN,KAAC,IAAI,IACH,IAAI,EAAE,aAAa,CAAC;gDAClB,MAAM,EAAE,IAAI;gDACZ,MAAM,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;6CACzD,CAAC,EACF,GAAG,EAAC,YAAY,GAChB,CACH;wCACD,QAAQ,EAAE,MAAM,CAAC,QAAQ;qCAC1B,CAAC;gCACJ,CAAC,CAAC,EACF,cAAc,EAAE,cAAc,sBACZ,GAAG,QAAQ,kBAAkB,GAC/C,CACH,GACA,EACF,OAAO,IACW,GACX,EAEZ,KAAC,kBAAkB,IAAC,EAAE,EAAE,GAAG,QAAQ,kBAAkB,YAClD,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GACpD,IACP,CACjB,CAAC;AACJ,CAAC,CAQsB,CAAC;AAExB,eAAe,WAAW,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n ThemeOverride,\n useI18n,\n useTestIds,\n useUID,\n Icon,\n VisuallyHiddenText,\n FormField,\n withTestIds\n} from '@pega/cosmos-react-core';\n\nimport type { ConstantComponentProps, DynamicInputProps, Source } from './DynamicInput.types';\nimport { StyledExpressionControl, StyledDynamicInput } from './DynamicInput.styles';\nimport SourceButton from './SourceButton';\nimport { getCurrentSource, getSourceIcon } from './utils';\nimport { getDynamicInputTestIds } from './DynamicInput.test-ids';\n\nconst DynamicInput = forwardRef(function DynamicInput<\n T extends object,\n ConstantProps extends ConstantComponentProps<T> = ConstantComponentProps<T>,\n RuleProps extends object = object,\n FieldReferenceProps extends object = object,\n ExpressionProps extends object = object\n>(\n {\n testId,\n label: labelProp,\n sources,\n onSourceChange,\n controls,\n required,\n hideSourceButton,\n ...restProps\n }: PropsWithoutRef<\n DynamicInputProps<T, ConstantProps, RuleProps, FieldReferenceProps, ExpressionProps>\n >,\n ref: DynamicInputProps<T, ConstantProps, RuleProps, FieldReferenceProps, ExpressionProps>['ref']\n) {\n const testIds = useTestIds(testId, getDynamicInputTestIds);\n const inputUid = useUID();\n const t = useI18n();\n\n const label = labelProp ?? t('value');\n const currentSource = getCurrentSource(sources);\n const constantFormat = controls.constant?.props.format;\n const sourceLabels: { [key in Source]: string } = {\n Constant: t('constant_label', [\n constantFormat ? t(`dynamicInput_format_${constantFormat}`) : ''\n ]),\n Expression: t('expression_label'),\n FieldReference: t('field_reference_label'),\n Rule: t('rule_label')\n };\n const sourceDescriptions: { [key in Source]: string } = {\n Constant: t('constant_description'),\n Expression: t('expression_description'),\n FieldReference: t('field_reference_description'),\n Rule: t('rule_description')\n };\n\n let control: JSX.Element = <>{null}</>;\n\n if (currentSource === 'Constant' && controls.constant) {\n const { props, component: Component } = controls.constant;\n control = (\n <Component {...props} id={inputUid} data-testid={testIds.control} required={required} />\n );\n } else if (currentSource === 'Rule' && controls.rule) {\n const { props, component: Component } = controls.rule;\n control = (\n <Component {...props} id={inputUid} data-testid={testIds.control} required={required} />\n );\n } else if (currentSource === 'Expression' && controls.expression) {\n const { props, component: Component } = controls.expression;\n\n control = (\n <StyledExpressionControl container>\n <Component {...props} id={inputUid} data-testid={testIds.control} required={required} />\n </StyledExpressionControl>\n );\n } else if (currentSource === 'FieldReference' && controls.fieldReference) {\n const { props, component: Component } = controls.fieldReference;\n control = (\n <Component {...props} id={inputUid} data-testid={testIds.control} required={required} />\n );\n }\n\n return (\n <ThemeOverride theme={{ base: { 'icon-set': 'streamline' } }}>\n <FormField\n label={label}\n labelFor={inputUid}\n required={required}\n {...restProps}\n ref={ref}\n testId={testIds.field}\n >\n <StyledDynamicInput>\n <>\n {hideSourceButton ? null : (\n <SourceButton\n testId={testIds.menu}\n sources={sources}\n constantFormat={controls.constant?.props.format}\n icon={\n currentSource\n ? getSourceIcon({\n source: currentSource,\n format:\n currentSource === 'Constant' ? controls.constant?.props.format : undefined\n })\n : undefined\n }\n menuItems={sources.map(config => {\n const type = config.type;\n\n return {\n id: type,\n primary: sourceLabels[config.type],\n secondary: [sourceDescriptions[type]],\n visual: (\n <Icon\n name={getSourceIcon({\n source: type,\n format: type === 'Constant' ? constantFormat : undefined\n })}\n set='streamline'\n />\n ),\n selected: config.selected\n };\n })}\n onSourceChange={onSourceChange}\n aria-describedby={`${inputUid}-selected-source`}\n />\n )}\n </>\n {control}\n </StyledDynamicInput>\n </FormField>\n\n <VisuallyHiddenText id={`${inputUid}-selected-source`}>\n {currentSource ? t('selected_noun', [sourceLabels[currentSource]]) : ''}\n </VisuallyHiddenText>\n </ThemeOverride>\n );\n}) as <\n T extends object = object,\n ConstantProps extends ConstantComponentProps<T> = ConstantComponentProps<T>,\n RuleProps extends object = object,\n FieldReferenceProps extends object = object,\n ExpressionProps extends object = object\n>(\n props: DynamicInputProps<T, ConstantProps, RuleProps, FieldReferenceProps, ExpressionProps>\n) => JSX.Element | null;\n\nexport default withTestIds(DynamicInput, getDynamicInputTestIds);\n"]}
@@ -1,4 +1,3 @@
1
- export declare const StyledExpressionBuilderButton: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").ButtonProps>, import("styled-components").DefaultTheme, {}, never>;
2
1
  export declare const StyledExpressionControl: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
3
2
  export declare const StyledDynamicInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
3
  //# sourceMappingURL=DynamicInput.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicInput.styles.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B,oNAAmB,CAAC;AAC9D,eAAO,MAAM,uBAAuB,kNAAiB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,yGAoD7B,CAAC"}
1
+ {"version":3,"file":"DynamicInput.styles.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.styles.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,uBAAuB,kNAAiB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,yGAsE9B,CAAC"}
@@ -1,60 +1,67 @@
1
1
  import styled, { css } from 'styled-components';
2
- import { Button, Flex, StyledFormControl, defaultThemeProp } from '@pega/cosmos-react-core';
2
+ import { Flex, StyledFormControl, StyledGrid, defaultThemeProp } from '@pega/cosmos-react-core';
3
3
  import { StyledMenuButton } from '@pega/cosmos-react-core/lib/components/MenuButton/MenuButton';
4
- export const StyledExpressionBuilderButton = styled(Button) ``;
4
+ import { StyledContentWrapper, StyledInputTree } from '../ObjectSelect/InputTree/InputTree.styles';
5
+ import { StyledFieldReferenceInput, StyledFieldReferencePicker } from '../FieldReference/FieldReference.styles';
5
6
  export const StyledExpressionControl = styled(Flex) ``;
6
- export const StyledDynamicInput = styled.div(({ theme }) => {
7
+ export const StyledDynamicInput = styled.div(({ theme: { base: { palette: { 'foreground-color': foregroundColor }, 'content-width': contentWidth }, components: { 'form-control': { 'border-color': formControlBorderColor } } } }) => {
7
8
  return css `
8
- display: flex;
9
+ display: flex;
9
10
 
10
- ${StyledFormControl} {
11
- border-start-start-radius: 0;
12
- border-end-start-radius: 0;
13
- width: 100%;
14
- }
11
+ ${StyledInputTree} {
12
+ margin-inline-start: -2.5rem;
13
+ }
15
14
 
16
- ${StyledExpressionControl} {
17
- position: relative;
18
- z-index: 1;
15
+ ${StyledFieldReferencePicker} > ${StyledFieldReferenceInput} > ${StyledGrid} {
16
+ padding: 0;
17
+ }
19
18
 
20
- .react-codemirror2 {
21
- min-height: 0;
19
+ ${StyledContentWrapper} {
20
+ padding-block-start: 0;
22
21
  }
23
22
 
24
- .CodeMirror,
25
- .CodeMirror-wrap {
26
- border-color: ${theme.components['form-control']['border-color']};
23
+ ${StyledFormControl} {
27
24
  border-start-start-radius: 0;
28
25
  border-end-start-radius: 0;
26
+ width: 100%;
29
27
  }
30
28
 
31
- ${StyledExpressionBuilderButton} {
32
- position: absolute;
33
- z-index: 2;
34
- inset-block-start: 0.0625rem;
35
- inset-inline-end: 0.0625rem;
36
- border-start-start-radius: 0;
37
- border-end-start-radius: 0;
29
+ ${StyledExpressionControl} {
30
+ position: relative;
31
+ z-index: 1;
32
+
33
+ .react-codemirror2 {
34
+ min-height: 0;
35
+ }
36
+
37
+ .CodeMirror,
38
+ .CodeMirror-wrap {
39
+ border-color: ${formControlBorderColor};
40
+ border-start-start-radius: 0;
41
+ border-end-start-radius: 0;
42
+ }
38
43
  }
39
- }
40
-
41
- ${StyledMenuButton} {
42
- z-index: 0;
43
- border-inline-end: 0;
44
- border-color: ${theme.components['form-control']['border-color']};
45
- border-start-end-radius: 0;
46
- border-end-end-radius: 0;
47
- color: ${theme.base.palette['foreground-color']};
48
- &:focus {
49
- z-index: 2;
44
+
45
+ ${StyledMenuButton} {
46
+ z-index: 0;
47
+ border-inline-end: 0;
48
+ border-color: ${formControlBorderColor};
49
+ border-start-end-radius: 0;
50
+ border-end-end-radius: 0;
51
+ align-self: flex-start;
52
+ color: ${foregroundColor};
53
+ &:focus {
54
+ z-index: 2;
55
+ }
50
56
  }
51
- }
52
57
 
53
- ${StyledMenuButton} + * {
54
- flex-grow: 1;
55
- z-index: 1;
56
- }
57
- `;
58
+ ${StyledMenuButton} + * {
59
+ flex-grow: 1;
60
+ z-index: 1;
61
+ width: 100%;
62
+ min-width: ${contentWidth.xs};
63
+ }
64
+ `;
58
65
  });
59
66
  StyledDynamicInput.defaultProps = defaultThemeProp;
60
67
  //# sourceMappingURL=DynamicInput.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicInput.styles.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAC;AAEhG,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA,EAAE,CAAC;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA,EAAE,CAAC;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACzD,OAAO,GAAG,CAAA;;;MAGN,iBAAiB;;;;;;MAMjB,uBAAuB;;;;;;;;;;wBAUL,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC;;;;;QAKhE,6BAA6B;;;;;;;;;;MAU/B,gBAAgB;;;sBAGA,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC;;;eAGvD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;;;;;;MAM/C,gBAAgB;;;;GAInB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { Button, Flex, StyledFormControl, defaultThemeProp } from '@pega/cosmos-react-core';\nimport { StyledMenuButton } from '@pega/cosmos-react-core/lib/components/MenuButton/MenuButton';\n\nexport const StyledExpressionBuilderButton = styled(Button)``;\nexport const StyledExpressionControl = styled(Flex)``;\n\nexport const StyledDynamicInput = styled.div(({ theme }) => {\n return css`\n display: flex;\n\n ${StyledFormControl} {\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n width: 100%;\n }\n\n ${StyledExpressionControl} {\n position: relative;\n z-index: 1;\n\n .react-codemirror2 {\n min-height: 0;\n }\n\n .CodeMirror,\n .CodeMirror-wrap {\n border-color: ${theme.components['form-control']['border-color']};\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n\n ${StyledExpressionBuilderButton} {\n position: absolute;\n z-index: 2;\n inset-block-start: 0.0625rem;\n inset-inline-end: 0.0625rem;\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n }\n\n ${StyledMenuButton} {\n z-index: 0;\n border-inline-end: 0;\n border-color: ${theme.components['form-control']['border-color']};\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n color: ${theme.base.palette['foreground-color']};\n &:focus {\n z-index: 2;\n }\n }\n\n ${StyledMenuButton} + * {\n flex-grow: 1;\n z-index: 1;\n }\n `;\n});\n\nStyledDynamicInput.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"DynamicInput.styles.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAC;AAEhG,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,yCAAyC,CAAC;AAEjD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA,EAAE,CAAC;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAC1C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,kBAAkB,EAAE,eAAe,EAAE,EAChD,eAAe,EAAE,YAAY,EAC9B,EACD,UAAU,EAAE,EACV,cAAc,EAAE,EAAE,cAAc,EAAE,sBAAsB,EAAE,EAC3D,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;;;QAGN,eAAe;;;;QAIf,0BAA0B,MAAM,yBAAyB,MAAM,UAAU;;;;QAIzE,oBAAoB;;;;QAIpB,iBAAiB;;;;;;QAMjB,uBAAuB;;;;;;;;;;0BAUL,sBAAsB;;;;;;QAMxC,gBAAgB;;;wBAGA,sBAAsB;;;;iBAI7B,eAAe;;;;;;QAMxB,gBAAgB;;;;qBAIH,YAAY,CAAC,EAAE;;KAE/B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { Flex, StyledFormControl, StyledGrid, defaultThemeProp } from '@pega/cosmos-react-core';\nimport { StyledMenuButton } from '@pega/cosmos-react-core/lib/components/MenuButton/MenuButton';\n\nimport { StyledContentWrapper, StyledInputTree } from '../ObjectSelect/InputTree/InputTree.styles';\nimport {\n StyledFieldReferenceInput,\n StyledFieldReferencePicker\n} from '../FieldReference/FieldReference.styles';\n\nexport const StyledExpressionControl = styled(Flex)``;\n\nexport const StyledDynamicInput = styled.div(\n ({\n theme: {\n base: {\n palette: { 'foreground-color': foregroundColor },\n 'content-width': contentWidth\n },\n components: {\n 'form-control': { 'border-color': formControlBorderColor }\n }\n }\n }) => {\n return css`\n display: flex;\n\n ${StyledInputTree} {\n margin-inline-start: -2.5rem;\n }\n\n ${StyledFieldReferencePicker} > ${StyledFieldReferenceInput} > ${StyledGrid} {\n padding: 0;\n }\n\n ${StyledContentWrapper} {\n padding-block-start: 0;\n }\n\n ${StyledFormControl} {\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n width: 100%;\n }\n\n ${StyledExpressionControl} {\n position: relative;\n z-index: 1;\n\n .react-codemirror2 {\n min-height: 0;\n }\n\n .CodeMirror,\n .CodeMirror-wrap {\n border-color: ${formControlBorderColor};\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n }\n\n ${StyledMenuButton} {\n z-index: 0;\n border-inline-end: 0;\n border-color: ${formControlBorderColor};\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n align-self: flex-start;\n color: ${foregroundColor};\n &:focus {\n z-index: 2;\n }\n }\n\n ${StyledMenuButton} + * {\n flex-grow: 1;\n z-index: 1;\n width: 100%;\n min-width: ${contentWidth.xs};\n }\n `;\n }\n);\n\nStyledDynamicInput.defaultProps = defaultThemeProp;\n"]}
@@ -1,9 +1,15 @@
1
- import type { ComponentProps, ComponentType, Ref } from 'react';
2
- import type { FormFieldProps, InputProps, TextAreaProps, CurrencyInputProps, NumberInputProps, PhoneInputProps, DateTimeInputProps, DateInputProps, TimeInputProps, TestIdProp, OmitStrict, FormControlProps, ComboBoxProps } from '@pega/cosmos-react-core';
3
- import type { CodeEditor } from '../ExpressionBuilder';
4
- import type { RuleSelectProps } from '../RuleSelect';
5
- import type { FieldReferenceInputProps } from '../FieldReference';
6
- export type Source = 'Constant' | 'Rule' | 'FieldReference' | 'Expression';
1
+ import type { ComponentType, Ref } from 'react';
2
+ import type { FormFieldProps, InputProps, TextAreaProps, CurrencyInputProps, NumberInputProps, PhoneInputProps, DateTimeInputProps, DateInputProps, TimeInputProps, TestIdProp, OmitStrict, FormControlProps, DeferInfer } from '@pega/cosmos-react-core';
3
+ export type ConstantSourceType = 'Constant';
4
+ export type RuleSourceType = 'Rule';
5
+ export type FieldReferenceSourceType = 'FieldReference';
6
+ export type ExpressionSourceType = 'Expression';
7
+ export type VariableSourceType = 'Variable';
8
+ export type Source = ConstantSourceType | RuleSourceType | FieldReferenceSourceType | ExpressionSourceType;
9
+ export type SourceConfig = {
10
+ type: Source;
11
+ selected?: boolean;
12
+ }[];
7
13
  export type ConstantValueTypeMap = {
8
14
  Text: InputProps['value'];
9
15
  'Text (paragraph)': TextAreaProps['value'];
@@ -18,76 +24,15 @@ export type ConstantValueTypeMap = {
18
24
  Time: TimeInputProps['value'];
19
25
  };
20
26
  export type ConstantFormat = keyof ConstantValueTypeMap;
21
- export type SourceConfig = {
22
- type: Source;
23
- selected?: boolean;
24
- };
25
- export type ExpressionControlConfig = {
26
- component: ComponentType<ComponentProps<typeof CodeEditor>>;
27
- props: ComponentProps<typeof CodeEditor>;
28
- };
29
- export type FormControlPropsToOmit = Pick<FormControlProps, 'label' | 'labelHidden' | 'additionalInfo' | 'info' | 'required' | 'status' | 'readOnly' | 'disabled'>;
30
- type ConstantTextConfig = {
31
- format: 'Text';
32
- props: OmitStrict<InputProps, keyof FormControlPropsToOmit | 'onChange'> & {
33
- onChange: (value: string | undefined) => void;
34
- };
35
- };
36
- type ConstantDecimalConfig = {
37
- format: 'Decimal';
38
- props: OmitStrict<NumberInputProps, keyof FormControlPropsToOmit>;
39
- };
40
- type ConstantIntegerConfig = {
41
- format: 'Integer';
42
- props: OmitStrict<NumberInputProps, keyof FormControlPropsToOmit | 'showGroupSeparators' | 'showDecimal'>;
43
- };
44
- type ConstantPercentageConfig = {
45
- format: 'Percentage';
46
- props: OmitStrict<NumberInputProps, keyof FormControlPropsToOmit | 'showGroupSeparators' | 'numberOfDecimals' | 'unit'>;
47
- };
48
- type ConstantTextAreaConfig = {
49
- format: 'Text (paragraph)';
50
- props: OmitStrict<TextAreaProps, keyof FormControlPropsToOmit | 'onChange'> & {
51
- onChange: (value: string | undefined) => void;
52
- };
53
- };
54
- type ConstantDateConfig = {
55
- format: 'Date';
56
- props: OmitStrict<DateInputProps, keyof FormControlPropsToOmit>;
57
- };
58
- type ConstantDateTimeConfig = {
59
- format: 'DateTime';
60
- props: OmitStrict<DateTimeInputProps, keyof FormControlPropsToOmit>;
61
- };
62
- type ConstantTimeConfig = {
63
- format: 'Time';
64
- props: OmitStrict<TimeInputProps, keyof FormControlPropsToOmit>;
65
- };
66
- export type BooleanLabels = 'true|false' | 'always|never';
67
- export type ConstantBooleanConfig = {
68
- format: 'Boolean';
69
- props: OmitStrict<ComboBoxProps, keyof FormControlPropsToOmit | 'value' | 'onChange'> & {
70
- value?: boolean;
71
- onChange: (value: boolean) => void;
72
- booleanLabels?: BooleanLabels;
73
- };
74
- };
75
- type ConstantCurrencyConfig = {
76
- format: 'Currency';
77
- props: OmitStrict<CurrencyInputProps, keyof FormControlPropsToOmit>;
78
- };
79
- type ConstantPhoneConfig = {
80
- format: 'Phone';
81
- props: OmitStrict<PhoneInputProps, keyof FormControlPropsToOmit | 'showCountryCode'>;
82
- };
83
- export type ConstantControlConfig = ConstantTextConfig | ConstantDecimalConfig | ConstantIntegerConfig | ConstantPercentageConfig | ConstantTextAreaConfig | ConstantDateConfig | ConstantDateTimeConfig | ConstantTimeConfig | ConstantBooleanConfig | ConstantCurrencyConfig | ConstantPhoneConfig;
84
- export type RuleControlConfig = {
85
- props: RuleSelectProps;
86
- };
87
- export type FieldReferenceConfig = {
88
- props: OmitStrict<FieldReferenceInputProps, 'label' | 'labelHidden' | 'status' | 'info' | 'readOnly' | 'additionalInfo'>;
89
- };
90
- export interface DynamicInputProps extends TestIdProp, Pick<FormFieldProps, 'labelHidden' | 'required' | 'status' | 'id' | 'info'> {
27
+ export type FormControlPropsToOmit = Pick<FormControlProps, 'label' | 'labelHidden' | 'additionalInfo' | 'info' | 'required' | 'status' | 'readOnly' | 'disabled' | 'value' | 'defaultValue'>;
28
+ export type ConstantComponentProps<T> = OmitStrict<FormControlProps, keyof FormControlPropsToOmit> & {
29
+ format?: ConstantFormat;
30
+ } & T;
31
+ type ComponentConfig<P> = {
32
+ component: ComponentType<P>;
33
+ props: DeferInfer<P>;
34
+ };
35
+ export interface DynamicInputProps<T extends object = object, ConstantProps extends ConstantComponentProps<T> = ConstantComponentProps<T>, RuleProps extends object = object, FieldReferenceProps extends object = object, ExpressionProps extends object = object> extends TestIdProp, Pick<FormFieldProps, 'labelHidden' | 'required' | 'status' | 'id' | 'info'> {
91
36
  /**
92
37
  * The accessible and visual field label.
93
38
  * When used as an independent control label should represent the data field.
@@ -99,15 +44,15 @@ export interface DynamicInputProps extends TestIdProp, Pick<FormFieldProps, 'lab
99
44
  * The form control displayed on the RHS
100
45
  */
101
46
  controls: {
102
- constant?: ConstantControlConfig;
103
- rule?: RuleControlConfig;
104
- fieldReference?: FieldReferenceConfig;
105
- expression?: ExpressionControlConfig;
47
+ constant?: ComponentConfig<ConstantProps>;
48
+ rule?: ComponentConfig<RuleProps>;
49
+ fieldReference?: ComponentConfig<FieldReferenceProps>;
50
+ expression?: ComponentConfig<ExpressionProps>;
106
51
  };
107
52
  /**
108
53
  * Methods to source a value from.
109
54
  */
110
- sources: SourceConfig[];
55
+ sources: SourceConfig;
111
56
  /**
112
57
  * Called when the source method changes.
113
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicInput.types.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACd,MAAM,yBAAy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B,EACxB,OAAO,GAAG,aAAa,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,gBAAgB,CAC5E,CAAC;CACH,CAAC;AAGF,MAAM,WAAW,iBACf,SAAQ,UAAU,EAChB,IAAI,CAAC,cAAc,EAAE,aAAa,GAAG,UAAU,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;IAC7E;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE;QACR,QAAQ,CAAC,EAAE,qBAAqB,CAAC;QACjC,IAAI,CAAC,EAAE,iBAAiB,CAAC;QACzB,cAAc,CAAC,EAAE,oBAAoB,CAAC;QACtC,UAAU,CAAC,EAAE,uBAAuB,CAAC;KACtC,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,YAAY,EAAE,CAAC;IAExB;;OAEG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAE1B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"DynamicInput.types.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAC5C,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AACpC,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AACxD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AAG,CAAC,CAAC;AAEN,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5B,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CACtB,CAAC;AAGF,MAAM,WAAW,iBAAiB,CAChC,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,aAAa,SAAS,sBAAsB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,EAC3E,SAAS,SAAS,MAAM,GAAG,MAAM,EACjC,mBAAmB,SAAS,MAAM,GAAG,MAAM,EAC3C,eAAe,SAAS,MAAM,GAAG,MAAM,CACvC,SAAQ,UAAU,EAChB,IAAI,CAAC,cAAc,EAAE,aAAa,GAAG,UAAU,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;IAC7E;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE;QACR,QAAQ,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;QAC1C,IAAI,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;QAClC,cAAc,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAC;QACtD,UAAU,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;KAC/C,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IAEtB;;OAEG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAE1B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicInput.types.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentType, Ref } from 'react';\n\nimport type {\n FormFieldProps,\n InputProps,\n TextAreaProps,\n CurrencyInputProps,\n NumberInputProps,\n PhoneInputProps,\n DateTimeInputProps,\n DateInputProps,\n TimeInputProps,\n TestIdProp,\n OmitStrict,\n FormControlProps,\n ComboBoxProps\n} from '@pega/cosmos-react-core';\n\nimport type { CodeEditor } from '../ExpressionBuilder';\nimport type { RuleSelectProps } from '../RuleSelect';\nimport type { FieldReferenceInputProps } from '../FieldReference';\n\nexport type Source = 'Constant' | 'Rule' | 'FieldReference' | 'Expression'; // Input type options\n\nexport type ConstantValueTypeMap = {\n Text: InputProps['value'];\n 'Text (paragraph)': TextAreaProps['value'];\n Boolean: boolean;\n Currency: CurrencyInputProps['value'];\n Percentage: NumberInputProps['value'];\n Integer: NumberInputProps['value'];\n Decimal: NumberInputProps['value'];\n Phone: PhoneInputProps['value'];\n DateTime: DateTimeInputProps['value'];\n Date: DateInputProps['value'];\n Time: TimeInputProps['value'];\n};\n\nexport type ConstantFormat = keyof ConstantValueTypeMap;\n\nexport type SourceConfig = { type: Source; selected?: boolean };\n\nexport type ExpressionControlConfig = {\n component: ComponentType<ComponentProps<typeof CodeEditor>>;\n props: ComponentProps<typeof CodeEditor>;\n};\n\nexport type FormControlPropsToOmit = Pick<\n FormControlProps,\n | 'label'\n | 'labelHidden'\n | 'additionalInfo'\n | 'info'\n | 'required'\n | 'status'\n | 'readOnly'\n | 'disabled'\n>;\n\ntype ConstantTextConfig = {\n format: 'Text';\n props: OmitStrict<InputProps, keyof FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDecimalConfig = {\n format: 'Decimal';\n props: OmitStrict<NumberInputProps, keyof FormControlPropsToOmit>;\n};\n\ntype ConstantIntegerConfig = {\n format: 'Integer';\n props: OmitStrict<\n NumberInputProps,\n keyof FormControlPropsToOmit | 'showGroupSeparators' | 'showDecimal'\n >;\n};\n\ntype ConstantPercentageConfig = {\n format: 'Percentage';\n props: OmitStrict<\n NumberInputProps,\n keyof FormControlPropsToOmit | 'showGroupSeparators' | 'numberOfDecimals' | 'unit'\n >;\n};\n\ntype ConstantTextAreaConfig = {\n format: 'Text (paragraph)';\n props: OmitStrict<TextAreaProps, keyof FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDateConfig = {\n format: 'Date';\n props: OmitStrict<DateInputProps, keyof FormControlPropsToOmit>;\n};\n\ntype ConstantDateTimeConfig = {\n format: 'DateTime';\n props: OmitStrict<DateTimeInputProps, keyof FormControlPropsToOmit>;\n};\n\ntype ConstantTimeConfig = {\n format: 'Time';\n props: OmitStrict<TimeInputProps, keyof FormControlPropsToOmit>;\n};\n\nexport type BooleanLabels = 'true|false' | 'always|never';\n\nexport type ConstantBooleanConfig = {\n format: 'Boolean';\n props: OmitStrict<ComboBoxProps, keyof FormControlPropsToOmit | 'value' | 'onChange'> & {\n value?: boolean;\n onChange: (value: boolean) => void;\n booleanLabels?: BooleanLabels;\n };\n};\n\ntype ConstantCurrencyConfig = {\n format: 'Currency';\n props: OmitStrict<CurrencyInputProps, keyof FormControlPropsToOmit>;\n};\n\ntype ConstantPhoneConfig = {\n format: 'Phone';\n props: OmitStrict<PhoneInputProps, keyof FormControlPropsToOmit | 'showCountryCode'>;\n};\n\nexport type ConstantControlConfig =\n | ConstantTextConfig\n | ConstantDecimalConfig\n | ConstantIntegerConfig\n | ConstantPercentageConfig\n | ConstantTextAreaConfig\n | ConstantDateConfig\n | ConstantDateTimeConfig\n | ConstantTimeConfig\n | ConstantBooleanConfig\n | ConstantCurrencyConfig\n | ConstantPhoneConfig;\n\nexport type RuleControlConfig = {\n props: RuleSelectProps;\n};\n\nexport type FieldReferenceConfig = {\n props: OmitStrict<\n FieldReferenceInputProps,\n 'label' | 'labelHidden' | 'status' | 'info' | 'readOnly' | 'additionalInfo'\n >;\n};\n\n// ## (DynamicInput) Top level props for the component.\nexport interface DynamicInputProps\n extends TestIdProp,\n Pick<FormFieldProps, 'labelHidden' | 'required' | 'status' | 'id' | 'info'> {\n /**\n * The accessible and visual field label.\n * When used as an independent control label should represent the data field.\n * When used in combination with another LHS element the default \"Value\" may be sufficient.\n * @default \"Value\"\n */\n label?: string;\n\n /**\n * The form control displayed on the RHS\n */\n controls: {\n constant?: ConstantControlConfig;\n rule?: RuleControlConfig;\n fieldReference?: FieldReferenceConfig;\n expression?: ExpressionControlConfig;\n };\n\n /**\n * Methods to source a value from.\n */\n sources: SourceConfig[];\n\n /**\n * Called when the source method changes.\n */\n onSourceChange: (source: Source) => void;\n\n /**\n * Ref to the component's root element.\n */\n ref?: Ref<HTMLDivElement>;\n\n /**\n * Hides source button.\n */\n hideSourceButton?: boolean;\n}\n"]}
1
+ {"version":3,"file":"DynamicInput.types.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType, Ref } from 'react';\n\nimport type {\n FormFieldProps,\n InputProps,\n TextAreaProps,\n CurrencyInputProps,\n NumberInputProps,\n PhoneInputProps,\n DateTimeInputProps,\n DateInputProps,\n TimeInputProps,\n TestIdProp,\n OmitStrict,\n FormControlProps,\n DeferInfer\n} from '@pega/cosmos-react-core';\n\nexport type ConstantSourceType = 'Constant';\nexport type RuleSourceType = 'Rule';\nexport type FieldReferenceSourceType = 'FieldReference';\nexport type ExpressionSourceType = 'Expression';\nexport type VariableSourceType = 'Variable';\n\n// Input type options\nexport type Source =\n | ConstantSourceType\n | RuleSourceType\n | FieldReferenceSourceType\n | ExpressionSourceType;\n\nexport type SourceConfig = { type: Source; selected?: boolean }[];\n\nexport type ConstantValueTypeMap = {\n Text: InputProps['value'];\n 'Text (paragraph)': TextAreaProps['value'];\n Boolean: boolean;\n Currency: CurrencyInputProps['value'];\n Percentage: NumberInputProps['value'];\n Integer: NumberInputProps['value'];\n Decimal: NumberInputProps['value'];\n Phone: PhoneInputProps['value'];\n DateTime: DateTimeInputProps['value'];\n Date: DateInputProps['value'];\n Time: TimeInputProps['value'];\n};\n\nexport type ConstantFormat = keyof ConstantValueTypeMap;\n\nexport type FormControlPropsToOmit = Pick<\n FormControlProps,\n | 'label'\n | 'labelHidden'\n | 'additionalInfo'\n | 'info'\n | 'required'\n | 'status'\n | 'readOnly'\n | 'disabled'\n | 'value'\n | 'defaultValue'\n>;\n\nexport type ConstantComponentProps<T> = OmitStrict<\n FormControlProps,\n keyof FormControlPropsToOmit\n> & {\n format?: ConstantFormat;\n} & T;\n\ntype ComponentConfig<P> = {\n component: ComponentType<P>;\n props: DeferInfer<P>;\n};\n\n// ## (DynamicInput) Top level props for the component.\nexport interface DynamicInputProps<\n T extends object = object,\n ConstantProps extends ConstantComponentProps<T> = ConstantComponentProps<T>,\n RuleProps extends object = object,\n FieldReferenceProps extends object = object,\n ExpressionProps extends object = object\n> extends TestIdProp,\n Pick<FormFieldProps, 'labelHidden' | 'required' | 'status' | 'id' | 'info'> {\n /**\n * The accessible and visual field label.\n * When used as an independent control label should represent the data field.\n * When used in combination with another LHS element the default \"Value\" may be sufficient.\n * @default \"Value\"\n */\n label?: string;\n\n /**\n * The form control displayed on the RHS\n */\n controls: {\n constant?: ComponentConfig<ConstantProps>;\n rule?: ComponentConfig<RuleProps>;\n fieldReference?: ComponentConfig<FieldReferenceProps>;\n expression?: ComponentConfig<ExpressionProps>;\n };\n\n /**\n * Methods to source a value from.\n */\n sources: SourceConfig;\n\n /**\n * Called when the source method changes.\n */\n onSourceChange: (source: Source) => void;\n\n /**\n * Ref to the component's root element.\n */\n ref?: Ref<HTMLDivElement>;\n\n /**\n * Hides source button.\n */\n hideSourceButton?: boolean;\n}\n"]}
@@ -1,3 +1,5 @@
1
1
  export { default as DynamicInput } from './DynamicInput';
2
2
  export * from './DynamicInput.types';
3
+ export { default as ConstantControl } from './ConstantControl';
4
+ export type { ConstantControlConfig } from './ConstantControl';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}