@pega/cosmos-react-build 3.0.0-dev.3.0 → 3.0.0-dev.30.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 (274) hide show
  1. package/lib/components/AppHeader/AppHeader.d.ts +4 -2
  2. package/lib/components/AppHeader/AppHeader.d.ts.map +1 -1
  3. package/lib/components/AppHeader/AppHeader.js +12 -10
  4. package/lib/components/AppHeader/AppHeader.js.map +1 -1
  5. package/lib/components/AppHeader/AppHeader.styles.d.ts +1 -3
  6. package/lib/components/AppHeader/AppHeader.styles.d.ts.map +1 -1
  7. package/lib/components/AppHeader/AppHeader.styles.js +5 -22
  8. package/lib/components/AppHeader/AppHeader.styles.js.map +1 -1
  9. package/lib/components/AppHeader/BranchButton.d.ts.map +1 -1
  10. package/lib/components/AppHeader/BranchButton.js +22 -18
  11. package/lib/components/AppHeader/BranchButton.js.map +1 -1
  12. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppShell.js +21 -20
  14. package/lib/components/AppShell/AppShell.js.map +1 -1
  15. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  16. package/lib/components/AppShell/AppShell.styles.js +17 -2
  17. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  18. package/lib/components/AppShell/AppShell.types.d.ts +6 -9
  19. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  20. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  21. package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +3 -0
  22. package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -1
  23. package/lib/components/DynamicContentEditor/DynamicContentEditor.js +173 -42
  24. package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -1
  25. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts +6 -0
  26. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts.map +1 -1
  27. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js.map +1 -1
  28. package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts +307 -3
  29. package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts.map +1 -1
  30. package/lib/components/DynamicContentEditor/PegaCustomElement.js +21 -21
  31. package/lib/components/DynamicContentEditor/PegaCustomElement.js.map +1 -1
  32. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts +8 -0
  33. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -0
  34. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +124 -0
  35. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -0
  36. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts +8 -0
  37. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts.map +1 -0
  38. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +517 -0
  39. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -0
  40. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts +35 -0
  41. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts.map +1 -0
  42. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js +2 -0
  43. package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js.map +1 -0
  44. package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts +13 -0
  45. package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts.map +1 -0
  46. package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js +46 -0
  47. package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js.map +1 -0
  48. package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts +6 -0
  49. package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts.map +1 -0
  50. package/lib/components/ExpressionBuilder/ExpressionBuilder.js +51 -0
  51. package/lib/components/ExpressionBuilder/ExpressionBuilder.js.map +1 -0
  52. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts +14 -0
  53. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts.map +1 -0
  54. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js +81 -0
  55. package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js.map +1 -0
  56. package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts +74 -0
  57. package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts.map +1 -0
  58. package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js +2 -0
  59. package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js.map +1 -0
  60. package/lib/components/ExpressionBuilder/ExpressionBuilderContext.d.ts +7 -0
  61. package/lib/components/ExpressionBuilder/ExpressionBuilderContext.d.ts.map +1 -0
  62. package/lib/components/ExpressionBuilder/ExpressionBuilderContext.js +6 -0
  63. package/lib/components/ExpressionBuilder/ExpressionBuilderContext.js.map +1 -0
  64. package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts +6 -0
  65. package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts.map +1 -0
  66. package/lib/components/ExpressionBuilder/ExpressionDetails.js +12 -0
  67. package/lib/components/ExpressionBuilder/ExpressionDetails.js.map +1 -0
  68. package/lib/components/ExpressionBuilder/ExpressionItem.d.ts +6 -0
  69. package/lib/components/ExpressionBuilder/ExpressionItem.d.ts.map +1 -0
  70. package/lib/components/ExpressionBuilder/ExpressionItem.js +43 -0
  71. package/lib/components/ExpressionBuilder/ExpressionItem.js.map +1 -0
  72. package/lib/components/ExpressionBuilder/ExpressionList.d.ts +6 -0
  73. package/lib/components/ExpressionBuilder/ExpressionList.d.ts.map +1 -0
  74. package/lib/components/ExpressionBuilder/ExpressionList.js +32 -0
  75. package/lib/components/ExpressionBuilder/ExpressionList.js.map +1 -0
  76. package/lib/components/ExpressionBuilder/index.d.ts +8 -0
  77. package/lib/components/ExpressionBuilder/index.d.ts.map +1 -0
  78. package/lib/components/ExpressionBuilder/index.js +6 -0
  79. package/lib/components/ExpressionBuilder/index.js.map +1 -0
  80. package/lib/components/FlowModeller/AddNode.d.ts +11 -9
  81. package/lib/components/FlowModeller/AddNode.d.ts.map +1 -1
  82. package/lib/components/FlowModeller/AddNode.js +9 -3
  83. package/lib/components/FlowModeller/AddNode.js.map +1 -1
  84. package/lib/components/FlowModeller/Connector.d.ts +7 -0
  85. package/lib/components/FlowModeller/Connector.d.ts.map +1 -0
  86. package/lib/components/FlowModeller/Connector.js +71 -0
  87. package/lib/components/FlowModeller/Connector.js.map +1 -0
  88. package/lib/components/FlowModeller/DeletePopover.d.ts +19 -0
  89. package/lib/components/FlowModeller/DeletePopover.d.ts.map +1 -0
  90. package/lib/components/FlowModeller/DeletePopover.js +136 -0
  91. package/lib/components/FlowModeller/DeletePopover.js.map +1 -0
  92. package/lib/components/FlowModeller/FlowModeller.d.ts +3 -19
  93. package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -1
  94. package/lib/components/FlowModeller/FlowModeller.js +187 -63
  95. package/lib/components/FlowModeller/FlowModeller.js.map +1 -1
  96. package/lib/components/FlowModeller/FlowModeller.types.d.ts +25 -0
  97. package/lib/components/FlowModeller/FlowModeller.types.d.ts.map +1 -0
  98. package/lib/components/FlowModeller/FlowModeller.types.js +2 -0
  99. package/lib/components/FlowModeller/FlowModeller.types.js.map +1 -0
  100. package/lib/components/FlowModeller/FlowModellerContext.d.ts +6 -0
  101. package/lib/components/FlowModeller/FlowModellerContext.d.ts.map +1 -0
  102. package/lib/components/FlowModeller/FlowModellerContext.js +7 -0
  103. package/lib/components/FlowModeller/FlowModellerContext.js.map +1 -0
  104. package/lib/components/FlowModeller/Node/Node.types.d.ts +22 -9
  105. package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -1
  106. package/lib/components/FlowModeller/Node/Node.types.js +2 -3
  107. package/lib/components/FlowModeller/Node/Node.types.js.map +1 -1
  108. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +6 -4
  109. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -1
  110. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +21 -11
  111. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -1
  112. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +1 -1
  113. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -1
  114. package/lib/components/FlowModeller/Node/NodeTemplates.js +43 -19
  115. package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -1
  116. package/lib/components/FlowModeller/Node.d.ts +5 -0
  117. package/lib/components/FlowModeller/Node.d.ts.map +1 -0
  118. package/lib/components/FlowModeller/Node.js +22 -0
  119. package/lib/components/FlowModeller/Node.js.map +1 -0
  120. package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +1 -1
  121. package/lib/components/FlowModeller/Renderer/Renderer.js +37 -6
  122. package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -1
  123. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +9 -9
  124. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +1 -1
  125. package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +1 -1
  126. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +8 -3
  127. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +1 -1
  128. package/lib/components/FlowModeller/Renderer/Utils/Graph.js +7 -1
  129. package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -1
  130. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +2 -1
  131. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +1 -1
  132. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +19 -6
  133. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +1 -1
  134. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +9 -6
  135. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts.map +1 -1
  136. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js +23 -3
  137. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js.map +1 -1
  138. package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts +17 -0
  139. package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts.map +1 -0
  140. package/lib/components/FlowModeller/Utils/{AddNodeUtils.js → addNodeUtils.js} +58 -35
  141. package/lib/components/FlowModeller/Utils/addNodeUtils.js.map +1 -0
  142. package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts +30 -0
  143. package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts.map +1 -0
  144. package/lib/components/FlowModeller/Utils/deleteNodeUtils.js +81 -0
  145. package/lib/components/FlowModeller/Utils/deleteNodeUtils.js.map +1 -0
  146. package/lib/components/FlowModeller/helper.d.ts +18 -8
  147. package/lib/components/FlowModeller/helper.d.ts.map +1 -1
  148. package/lib/components/FlowModeller/helper.js +114 -55
  149. package/lib/components/FlowModeller/helper.js.map +1 -1
  150. package/lib/components/FlowModeller/index.d.ts +8 -3
  151. package/lib/components/FlowModeller/index.d.ts.map +1 -1
  152. package/lib/components/FlowModeller/index.js +5 -1
  153. package/lib/components/FlowModeller/index.js.map +1 -1
  154. package/lib/components/ItemLibrary/ItemLibrary.d.ts +8 -6
  155. package/lib/components/ItemLibrary/ItemLibrary.d.ts.map +1 -1
  156. package/lib/components/ItemLibrary/ItemLibrary.js +6 -8
  157. package/lib/components/ItemLibrary/ItemLibrary.js.map +1 -1
  158. package/lib/components/LifeCycle/Category.d.ts.map +1 -1
  159. package/lib/components/LifeCycle/Category.js +17 -13
  160. package/lib/components/LifeCycle/Category.js.map +1 -1
  161. package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -1
  162. package/lib/components/LifeCycle/LifeCycle.js +2 -3
  163. package/lib/components/LifeCycle/LifeCycle.js.map +1 -1
  164. package/lib/components/LifeCycle/LifeCycle.types.d.ts +2 -4
  165. package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
  166. package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -1
  167. package/lib/components/LifeCycle/LifeCycleList.d.ts +1 -1
  168. package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -1
  169. package/lib/components/LifeCycle/LifeCycleList.js +3 -2
  170. package/lib/components/LifeCycle/LifeCycleList.js.map +1 -1
  171. package/lib/components/LifeCycle/Stage.d.ts +1 -1
  172. package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
  173. package/lib/components/LifeCycle/Stage.js +8 -17
  174. package/lib/components/LifeCycle/Stage.js.map +1 -1
  175. package/lib/components/LifeCycle/Step.d.ts +5 -8
  176. package/lib/components/LifeCycle/Step.d.ts.map +1 -1
  177. package/lib/components/LifeCycle/Step.js +10 -32
  178. package/lib/components/LifeCycle/Step.js.map +1 -1
  179. package/lib/components/LifeCycle/Task.d.ts +5 -3
  180. package/lib/components/LifeCycle/Task.d.ts.map +1 -1
  181. package/lib/components/LifeCycle/Task.js +17 -10
  182. package/lib/components/LifeCycle/Task.js.map +1 -1
  183. package/lib/components/LifeCycle/index.d.ts +1 -2
  184. package/lib/components/LifeCycle/index.d.ts.map +1 -1
  185. package/lib/components/LifeCycle/index.js.map +1 -1
  186. package/lib/components/ObjectPreview/ObjectPreview.d.ts +16 -0
  187. package/lib/components/ObjectPreview/ObjectPreview.d.ts.map +1 -0
  188. package/lib/components/ObjectPreview/ObjectPreview.js +25 -0
  189. package/lib/components/ObjectPreview/ObjectPreview.js.map +1 -0
  190. package/lib/components/ObjectPreview/index.d.ts +3 -0
  191. package/lib/components/ObjectPreview/index.d.ts.map +1 -0
  192. package/lib/components/ObjectPreview/index.js +3 -0
  193. package/lib/components/ObjectPreview/index.js.map +1 -0
  194. package/lib/components/ObjectSelect/ObjectPicker.d.ts +15 -0
  195. package/lib/components/ObjectSelect/ObjectPicker.d.ts.map +1 -0
  196. package/lib/components/ObjectSelect/ObjectPicker.js +40 -0
  197. package/lib/components/ObjectSelect/ObjectPicker.js.map +1 -0
  198. package/lib/components/ObjectSelect/ObjectSelect.d.ts +32 -0
  199. package/lib/components/ObjectSelect/ObjectSelect.d.ts.map +1 -0
  200. package/lib/components/ObjectSelect/ObjectSelect.js +41 -0
  201. package/lib/components/ObjectSelect/ObjectSelect.js.map +1 -0
  202. package/lib/components/ObjectSelect/ObjectSummary.d.ts +24 -0
  203. package/lib/components/ObjectSelect/ObjectSummary.d.ts.map +1 -0
  204. package/lib/components/ObjectSelect/ObjectSummary.js +45 -0
  205. package/lib/components/ObjectSelect/ObjectSummary.js.map +1 -0
  206. package/lib/components/ObjectSelect/index.d.ts +3 -0
  207. package/lib/components/ObjectSelect/index.d.ts.map +1 -0
  208. package/lib/components/ObjectSelect/index.js +2 -0
  209. package/lib/components/ObjectSelect/index.js.map +1 -0
  210. package/lib/components/ObjectSelect/useCreateModal.d.ts +34 -0
  211. package/lib/components/ObjectSelect/useCreateModal.d.ts.map +1 -0
  212. package/lib/components/ObjectSelect/useCreateModal.js +61 -0
  213. package/lib/components/ObjectSelect/useCreateModal.js.map +1 -0
  214. package/lib/components/PageTemplates/GalleryPage.js +4 -4
  215. package/lib/components/PageTemplates/GalleryPage.js.map +1 -1
  216. package/lib/components/PageTemplates/PageTemplates.d.ts +3 -3
  217. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  218. package/lib/components/PageTemplates/PageTemplates.js +45 -37
  219. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  220. package/lib/components/SummaryCard/SummaryCard.d.ts +2 -3
  221. package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -1
  222. package/lib/components/SummaryCard/SummaryCard.js +3 -4
  223. package/lib/components/SummaryCard/SummaryCard.js.map +1 -1
  224. package/lib/components/Workbench/ConfigurationPanel.d.ts.map +1 -1
  225. package/lib/components/Workbench/ConfigurationPanel.js +4 -15
  226. package/lib/components/Workbench/ConfigurationPanel.js.map +1 -1
  227. package/lib/components/Workbench/Toolbar.d.ts +1 -5
  228. package/lib/components/Workbench/Toolbar.d.ts.map +1 -1
  229. package/lib/components/Workbench/Toolbar.js +8 -8
  230. package/lib/components/Workbench/Toolbar.js.map +1 -1
  231. package/lib/components/Workbench/UtilityPanel.js +1 -1
  232. package/lib/components/Workbench/UtilityPanel.js.map +1 -1
  233. package/lib/components/Workbench/Workbench.d.ts.map +1 -1
  234. package/lib/components/Workbench/Workbench.js +3 -4
  235. package/lib/components/Workbench/Workbench.js.map +1 -1
  236. package/lib/components/Workbench/Workbench.styles.d.ts +1 -1
  237. package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -1
  238. package/lib/components/Workbench/Workbench.styles.js +15 -16
  239. package/lib/components/Workbench/Workbench.styles.js.map +1 -1
  240. package/lib/components/Workbench/Workbench.types.d.ts +2 -4
  241. package/lib/components/Workbench/Workbench.types.d.ts.map +1 -1
  242. package/lib/components/Workbench/Workbench.types.js.map +1 -1
  243. package/lib/index.d.ts +6 -1
  244. package/lib/index.d.ts.map +1 -1
  245. package/lib/index.js +6 -1
  246. package/lib/index.js.map +1 -1
  247. package/lib/utils/index.d.ts +2 -0
  248. package/lib/utils/index.d.ts.map +1 -0
  249. package/lib/utils/index.js +2 -0
  250. package/lib/utils/index.js.map +1 -0
  251. package/lib/utils/utils.d.ts +14 -0
  252. package/lib/utils/utils.d.ts.map +1 -0
  253. package/lib/utils/utils.js +13 -0
  254. package/lib/utils/utils.js.map +1 -0
  255. package/package.json +23 -14
  256. package/lib/components/FlowModeller/Renderer/Connectors.d.ts +0 -13
  257. package/lib/components/FlowModeller/Renderer/Connectors.d.ts.map +0 -1
  258. package/lib/components/FlowModeller/Renderer/Connectors.js +0 -47
  259. package/lib/components/FlowModeller/Renderer/Connectors.js.map +0 -1
  260. package/lib/components/FlowModeller/Renderer/Nodes.d.ts +0 -9
  261. package/lib/components/FlowModeller/Renderer/Nodes.d.ts.map +0 -1
  262. package/lib/components/FlowModeller/Renderer/Nodes.js +0 -25
  263. package/lib/components/FlowModeller/Renderer/Nodes.js.map +0 -1
  264. package/lib/components/FlowModeller/Utils/AddNodeUtils.d.ts +0 -16
  265. package/lib/components/FlowModeller/Utils/AddNodeUtils.d.ts.map +0 -1
  266. package/lib/components/FlowModeller/Utils/AddNodeUtils.js.map +0 -1
  267. package/lib/components/Visual/Visual.d.ts +0 -17
  268. package/lib/components/Visual/Visual.d.ts.map +0 -1
  269. package/lib/components/Visual/Visual.js +0 -28
  270. package/lib/components/Visual/Visual.js.map +0 -1
  271. package/lib/components/Visual/index.d.ts +0 -3
  272. package/lib/components/Visual/index.d.ts.map +0 -1
  273. package/lib/components/Visual/index.js +0 -3
  274. package/lib/components/Visual/index.js.map +0 -1
@@ -0,0 +1,32 @@
1
+ import { Ref } from 'react';
2
+ import { BaseProps, FormControlProps, MenuItemProps, NoChildrenProp, MenuProps, ForwardProps } from '@pega/cosmos-react-core';
3
+ import { ObjectPickerProps } from './ObjectPicker';
4
+ import { ObjectSummaryProps } from './ObjectSummary';
5
+ import { CreateModalActionProps, UseCreateModalConfig } from './useCreateModal';
6
+ export interface ObjectSelectProps<P extends object = object> extends BaseProps, NoChildrenProp, Omit<FormControlProps, 'value'> {
7
+ /** An array of MenuItemProps to be shown in the ObjectPicker menu. */
8
+ items: MenuProps['items'];
9
+ /** Boolean to trigger loading state for combobox menu */
10
+ loading?: ObjectPickerProps['loading'];
11
+ /** The value for the ObjectSummary */
12
+ value?: ObjectSummaryProps['value'];
13
+ /** Props for configuration popover */
14
+ configuration?: ObjectSummaryProps['configuration'];
15
+ /** Callback fired when a new item is selected and on clearing the selected item. */
16
+ onChange: MenuItemProps['onClick'];
17
+ /** Callback fired when the preview in the ObjectSummary link is clicked. */
18
+ onPreview?: (id: MenuItemProps['id'], e: {
19
+ href: string;
20
+ }) => void;
21
+ /** Callback fired on click of the link inside summary item */
22
+ onLinkClick?: ObjectSummaryProps['onLinkClick'];
23
+ /** New object creation form options or a link */
24
+ createConfiguration?: (UseCreateModalConfig<P> & CreateModalActionProps<P>) | {
25
+ href: string;
26
+ };
27
+ /** Ref placed on the element. */
28
+ ref?: Ref<HTMLDivElement>;
29
+ }
30
+ declare const ObjectSelect: <P extends object = object>(props: ObjectSelectProps<P> & ForwardProps) => JSX.Element | null;
31
+ export default ObjectSelect;
32
+ //# sourceMappingURL=ObjectSelect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectSelect.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectSelect/ObjectSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,GAAG,EAA+B,MAAM,OAAO,CAAC;AAEtF,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,SAAS,EACT,YAAY,EAGb,MAAM,yBAAyB,CAAC;AAEjC,OAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAuB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEhG,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAC1D,SAAQ,SAAS,EACf,cAAc,EACd,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACjC,sEAAsE;IACtE,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1B,yDAAyD;IACzD,OAAO,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACvC,sCAAsC;IACtC,KAAK,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACpC,sCAAsC;IACtC,aAAa,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACpD,oFAAoF;IACpF,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,4EAA4E;IAC5E,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnE,8DAA8D;IAC9D,WAAW,CAAC,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAChD,iDAAiD;IACjD,mBAAmB,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/F,iCAAiC;IACjC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,QAAA,MAAM,YAAY,6EAmF8D,WAAW,GAAG,IAAI,CAAC;AAEnG,eAAe,YAAY,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useRef, useState } from 'react';
3
+ import { useAfterInitialEffect, hasProp } from '@pega/cosmos-react-core';
4
+ import ObjectPicker from './ObjectPicker';
5
+ import ObjectSummary from './ObjectSummary';
6
+ import useCreateModal from './useCreateModal';
7
+ const ObjectSelect = forwardRef(({ items, value, configuration, disabled, onChange, onPreview, onLinkClick, loading, createConfiguration, ...restProps }, ref) => {
8
+ const [mode, setMode] = useState(value ? 'summary' : 'picker');
9
+ const objectPickerRef = useRef(null);
10
+ const objectSummaryRef = useRef(null);
11
+ const isCreateModalConfig = createConfiguration && hasProp(createConfiguration, 'renderer');
12
+ useAfterInitialEffect(() => {
13
+ const element = mode === 'summary'
14
+ ? objectSummaryRef.current?.querySelector('a')
15
+ : objectPickerRef.current?.querySelector('input');
16
+ element?.focus();
17
+ }, [mode]);
18
+ const { renderModal } = useCreateModal(isCreateModalConfig
19
+ ? {
20
+ ...createConfiguration,
21
+ onAfterClose: () => {
22
+ createConfiguration.onAfterClose?.();
23
+ setMode('summary');
24
+ }
25
+ }
26
+ : undefined);
27
+ useEffect(() => {
28
+ if (mode === 'create' && isCreateModalConfig) {
29
+ renderModal(createConfiguration);
30
+ }
31
+ }, [mode, createConfiguration]);
32
+ return (_jsx("div", { ref: ref, children: value ? (_jsx(ObjectSummary, { ...restProps, value: value, disabled: disabled, onDelete: e => {
33
+ setMode('picker');
34
+ onChange?.('', e);
35
+ }, ref: objectSummaryRef, configuration: configuration, onPreview: e => onPreview?.(value.id, e), onLinkClick: onLinkClick })) : (_jsx(ObjectPicker, { ...restProps, loading: loading, disabled: disabled, ref: objectPickerRef, items: items, onSelect: (id, e) => {
36
+ setMode('summary');
37
+ onChange?.(id, e);
38
+ }, createProps: isCreateModalConfig ? { onClick: () => setMode('create') } : createConfiguration })) }));
39
+ });
40
+ export default ObjectSelect;
41
+ //# sourceMappingURL=ObjectSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectSelect.js","sourceRoot":"","sources":["../../../src/components/ObjectSelect/ObjectSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAwB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtF,OAAO,EAOL,qBAAqB,EACrB,OAAO,EACR,MAAM,yBAAyB,CAAC;AAEjC,OAAO,YAAmC,MAAM,gBAAgB,CAAC;AACjE,OAAO,aAAqC,MAAM,iBAAiB,CAAC;AACpE,OAAO,cAAgE,MAAM,kBAAkB,CAAC;AA0BhG,MAAM,YAAY,GAAG,UAAU,CAC7B,CACE,EACE,KAAK,EACL,KAAK,EACL,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,GAAG,SAAS,EACyC,EACvD,GAA6B,EAC7B,EAAE;IACF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAkC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAChG,MAAM,eAAe,GAAG,MAAM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B,EACrB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EACxC,WAAW,EAAE,WAAW,GACxB,CACH,CAAC,CAAC,CAAC,CACF,KAAC,YAAY,OACP,SAAS,EACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;gBAClB,OAAO,CAAC,SAAS,CAAC,CAAC;gBACnB,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YACpB,CAAC,EACD,WAAW,EACT,mBAAmB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,GAElF,CACH,GACG,CACP,CAAC;AACJ,CAAC,CAC+F,CAAC;AAEnG,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, useEffect, useRef, useState } from 'react';\n\nimport {\n BaseProps,\n FormControlProps,\n MenuItemProps,\n NoChildrenProp,\n MenuProps,\n ForwardProps,\n useAfterInitialEffect,\n hasProp\n} from '@pega/cosmos-react-core';\n\nimport ObjectPicker, { ObjectPickerProps } from './ObjectPicker';\nimport ObjectSummary, { ObjectSummaryProps } from './ObjectSummary';\nimport useCreateModal, { CreateModalActionProps, UseCreateModalConfig } from './useCreateModal';\n\nexport interface ObjectSelectProps<P extends object = object>\n extends BaseProps,\n NoChildrenProp,\n Omit<FormControlProps, 'value'> {\n /** An array of MenuItemProps to be shown in the ObjectPicker menu. */\n items: MenuProps['items'];\n /** Boolean to trigger loading state for combobox menu */\n loading?: ObjectPickerProps['loading'];\n /** The value for the ObjectSummary */\n value?: ObjectSummaryProps['value'];\n /** Props for configuration popover */\n configuration?: ObjectSummaryProps['configuration'];\n /** Callback fired when a new item is selected and on clearing the selected item. */\n onChange: MenuItemProps['onClick'];\n /** Callback fired when the preview in the ObjectSummary link is clicked. */\n onPreview?: (id: MenuItemProps['id'], e: { href: string }) => void;\n /** Callback fired on click of the link inside summary item */\n onLinkClick?: ObjectSummaryProps['onLinkClick'];\n /** New object creation form options or a link */\n createConfiguration?: (UseCreateModalConfig<P> & CreateModalActionProps<P>) | { href: string };\n /** Ref placed on the element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst ObjectSelect = forwardRef(\n <P extends object = object>(\n {\n items,\n value,\n configuration,\n disabled,\n onChange,\n onPreview,\n onLinkClick,\n loading,\n createConfiguration,\n ...restProps\n }: PropsWithoutRef<ObjectSelectProps<P>> & ForwardProps,\n ref: ObjectSelectProps['ref']\n ) => {\n const [mode, setMode] = useState<'picker' | 'summary' | 'create'>(value ? 'summary' : 'picker');\n const objectPickerRef = useRef<HTMLDivElement>(null);\n const objectSummaryRef = useRef<HTMLDivElement>(null);\n\n const isCreateModalConfig = createConfiguration && hasProp(createConfiguration, 'renderer');\n\n useAfterInitialEffect(() => {\n const element =\n mode === 'summary'\n ? objectSummaryRef.current?.querySelector('a')\n : objectPickerRef.current?.querySelector('input');\n element?.focus();\n }, [mode]);\n\n const { renderModal } = useCreateModal(\n isCreateModalConfig\n ? {\n ...createConfiguration,\n onAfterClose: () => {\n createConfiguration.onAfterClose?.();\n setMode('summary');\n }\n }\n : undefined\n );\n\n useEffect(() => {\n if (mode === 'create' && isCreateModalConfig) {\n renderModal(createConfiguration);\n }\n }, [mode, createConfiguration]);\n\n return (\n <div ref={ref}>\n {value ? (\n <ObjectSummary\n {...restProps}\n value={value}\n disabled={disabled}\n onDelete={e => {\n setMode('picker');\n onChange?.('', e);\n }}\n ref={objectSummaryRef}\n configuration={configuration}\n onPreview={e => onPreview?.(value.id, e)}\n onLinkClick={onLinkClick}\n />\n ) : (\n <ObjectPicker\n {...restProps}\n loading={loading}\n disabled={disabled}\n ref={objectPickerRef}\n items={items}\n onSelect={(id, e) => {\n setMode('summary');\n onChange?.(id, e);\n }}\n createProps={\n isCreateModalConfig ? { onClick: () => setMode('create') } : createConfiguration\n }\n />\n )}\n </div>\n );\n }\n) as <P extends object = object>(props: ObjectSelectProps<P> & ForwardProps) => JSX.Element | null;\n\nexport default ObjectSelect;\n"]}
@@ -0,0 +1,24 @@
1
+ import { FC, Ref, PropsWithoutRef, MouseEvent } from 'react';
2
+ import { BaseProps, ForwardProps, FormControlProps, MenuItemProps, DialogProps, OmitStrict } from '@pega/cosmos-react-core';
3
+ interface ObjectSummaryValueProps {
4
+ id: MenuItemProps['id'];
5
+ primary: MenuItemProps['primary'];
6
+ href: string;
7
+ meta?: string;
8
+ }
9
+ interface ObjectConfigProps extends OmitStrict<DialogProps, 'target'> {
10
+ label: string;
11
+ }
12
+ export interface ObjectSummaryProps extends BaseProps, Omit<FormControlProps, 'value'> {
13
+ value: ObjectSummaryValueProps;
14
+ configuration?: ObjectConfigProps;
15
+ onDelete: (e: MouseEvent<HTMLButtonElement>) => void;
16
+ onPreview?: (e: {
17
+ href: string;
18
+ }) => void;
19
+ onLinkClick?: (id: MenuItemProps['id'], e: MouseEvent) => void;
20
+ ref: Ref<HTMLDivElement>;
21
+ }
22
+ declare const ObjectSummary: FC<PropsWithoutRef<ObjectSummaryProps> & ForwardProps>;
23
+ export default ObjectSummary;
24
+ //# sourceMappingURL=ObjectSummary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectSummary.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectSelect/ObjectSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAc,GAAG,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGzE,OAAO,EACL,SAAS,EAIT,YAAY,EAGZ,gBAAgB,EAChB,aAAa,EASb,WAAW,EACX,UAAU,EAEX,MAAM,yBAAyB,CAAC;AAMjC,UAAU,uBAAuB;IAC/B,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,iBAAkB,SAAQ,UAAU,CAAC,WAAW,EAAE,QAAQ,CAAC;IACnE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAmB,SAAQ,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACpF,KAAK,EAAE,uBAAuB,CAAC;IAC/B,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,QAAQ,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACrD,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1C,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAC/D,GAAG,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC1B;AAsDD,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,GAAG,YAAY,CAgFzE,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { SummaryItem, Button, Icon, StyledFormControl, FormField, useI18n, registerIcon, Text, useDirection, useElement, Link, Dialog, defaultThemeProp, StyledLink } from '@pega/cosmos-react-core';
5
+ import * as times from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
6
+ import * as gear from '@pega/cosmos-react-core/lib/components/Icon/icons/gear.icon';
7
+ registerIcon(times, gear);
8
+ const StyledObjectSummary = styled(StyledFormControl)(({ theme: { base: { spacing, 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger }, shadow: { focus } } }, meta }) => {
9
+ return css `
10
+ padding-block: ${meta ? spacing : '0'};
11
+ padding-inline-start: ${spacing};
12
+ min-height: ${hitAreaMouse};
13
+
14
+ ${StyledLink}:focus {
15
+ box-shadow: inset ${focus};
16
+ }
17
+
18
+ @media (pointer: coarse) {
19
+ min-height: ${hitAreaFinger};
20
+ }
21
+ `;
22
+ });
23
+ StyledObjectSummary.defaultProps = defaultThemeProp;
24
+ const StyledMetaText = styled(Text) `
25
+ display: -webkit-box;
26
+ -webkit-box-orient: vertical;
27
+ -webkit-line-clamp: 2;
28
+ overflow: hidden;
29
+ `;
30
+ const ScrollContainer = styled.div(({ theme: { base: { spacing } } }) => {
31
+ return css `
32
+ max-height: 12rem;
33
+ overflow: auto;
34
+ padding: calc(0.25 * ${spacing});
35
+ `;
36
+ });
37
+ ScrollContainer.defaultProps = defaultThemeProp;
38
+ const ObjectSummary = forwardRef(({ value, configuration, label, disabled, status, readOnly, onDelete, onPreview, onLinkClick, ...restProps }, ref) => {
39
+ const [buttonEl, setButtonEl] = useElement();
40
+ const t = useI18n();
41
+ const { rtl } = useDirection();
42
+ return (_jsx(FormField, { ...restProps, ref: ref, label: label, status: status, children: _jsx(SummaryItem, { as: StyledObjectSummary, status: status, meta: value.meta, readOnly: readOnly, overflowStrategy: 'ellipsis', primary: _jsx(Link, { href: value.href, "aria-label": `${label} ${value.primary}`, previewable: true, onPreview: onPreview, onClick: onLinkClick ? (e) => onLinkClick(value.id, e) : undefined, children: value.primary }), secondary: value.meta && _jsx(StyledMetaText, { variant: 'secondary', children: value.meta }), actions: _jsxs(_Fragment, { children: [configuration && (_jsx(Button, { ref: setButtonEl, label: configuration?.label, icon: true, variant: 'simple', children: _jsx(Icon, { name: 'gear' }) })), !readOnly && (_jsx(Button, { disabled: disabled, label: t('clear_object_summary', [String(label)]), icon: true, variant: 'simple', onClick: onDelete, children: _jsx(Icon, { name: 'times' }) })), configuration && (_jsx(Dialog, { heading: configuration.heading, placement: rtl ? 'bottom-end' : 'bottom-start', target: buttonEl, onOpen: configuration.onOpen, onClose: configuration.onClose, onSubmit: readOnly || disabled ? undefined : configuration?.onSubmit, loading: configuration.loading, ref: configuration.ref, children: _jsx(ScrollContainer, { children: configuration?.children }) }))] }) }) }));
43
+ });
44
+ export default ObjectSummary;
45
+ //# sourceMappingURL=ObjectSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectSummary.js","sourceRoot":"","sources":["../../../src/components/ObjectSelect/ObjectSummary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAoC,MAAM,OAAO,CAAC;AACzE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAEL,WAAW,EACX,MAAM,EACN,IAAI,EAEJ,iBAAiB,EACjB,SAAS,EAGT,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,MAAM,EACN,gBAAgB,EAGhB,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,8DAA8D,CAAC;AACtF,OAAO,KAAK,IAAI,MAAM,6DAA6D,CAAC;AAEpF,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAsB1B,MAAM,mBAAmB,GAAG,MAAM,CAAC,iBAAiB,CAAC,CACnD,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EACP,UAAU,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,EACtE,MAAM,EAAE,EAAE,KAAK,EAAE,EAClB,EACF,EACD,IAAI,EACL,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;uBACS,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,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,cAAE,aAAa,EAAE,QAAQ,GAAmB,GACrD,CACV,IACA,GAEL,GACQ,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FC, forwardRef, Ref, PropsWithoutRef, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n BaseProps,\n SummaryItem,\n Button,\n Icon,\n ForwardProps,\n StyledFormControl,\n FormField,\n FormControlProps,\n MenuItemProps,\n useI18n,\n registerIcon,\n Text,\n useDirection,\n useElement,\n Link,\n Dialog,\n defaultThemeProp,\n DialogProps,\n OmitStrict,\n StyledLink\n} from '@pega/cosmos-react-core';\nimport * as times from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\nimport * as gear from '@pega/cosmos-react-core/lib/components/Icon/icons/gear.icon';\n\nregisterIcon(times, gear);\n\ninterface ObjectSummaryValueProps {\n id: MenuItemProps['id'];\n primary: MenuItemProps['primary'];\n href: string;\n meta?: string;\n}\n\ninterface ObjectConfigProps extends OmitStrict<DialogProps, 'target'> {\n label: string;\n}\n\nexport interface ObjectSummaryProps extends BaseProps, Omit<FormControlProps, 'value'> {\n value: ObjectSummaryValueProps;\n configuration?: ObjectConfigProps;\n onDelete: (e: MouseEvent<HTMLButtonElement>) => void;\n onPreview?: (e: { href: string }) => void;\n onLinkClick?: (id: MenuItemProps['id'], e: MouseEvent) => void;\n ref: Ref<HTMLDivElement>;\n}\n\nconst StyledObjectSummary = styled(StyledFormControl)<{ meta: string }>(\n ({\n theme: {\n base: {\n spacing,\n 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger },\n shadow: { focus }\n }\n },\n meta\n }) => {\n return css`\n padding-block: ${meta ? spacing : '0'};\n padding-inline-start: ${spacing};\n min-height: ${hitAreaMouse};\n\n ${StyledLink}:focus {\n box-shadow: inset ${focus};\n }\n\n @media (pointer: coarse) {\n min-height: ${hitAreaFinger};\n }\n `;\n }\n);\n\nStyledObjectSummary.defaultProps = defaultThemeProp;\n\nconst StyledMetaText = styled(Text)`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n`;\n\nconst ScrollContainer = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n max-height: 12rem;\n overflow: auto;\n padding: calc(0.25 * ${spacing});\n `;\n }\n);\n\nScrollContainer.defaultProps = defaultThemeProp;\n\nconst ObjectSummary: FC<PropsWithoutRef<ObjectSummaryProps> & ForwardProps> = forwardRef(\n (\n {\n value,\n configuration,\n label,\n disabled,\n status,\n readOnly,\n onDelete,\n onPreview,\n onLinkClick,\n ...restProps\n },\n ref: ObjectSummaryProps['ref']\n ) => {\n const [buttonEl, setButtonEl] = useElement<HTMLButtonElement>();\n const t = useI18n();\n const { rtl } = useDirection();\n\n return (\n <FormField {...restProps} ref={ref} label={label} status={status}>\n <SummaryItem\n as={StyledObjectSummary}\n status={status}\n meta={value.meta}\n readOnly={readOnly}\n overflowStrategy='ellipsis'\n primary={\n <Link\n href={value.href}\n aria-label={`${label} ${value.primary}`}\n previewable\n onPreview={onPreview}\n onClick={onLinkClick ? (e: MouseEvent) => onLinkClick(value.id, e) : undefined}\n >\n {value.primary}\n </Link>\n }\n secondary={\n value.meta && <StyledMetaText variant='secondary'>{value.meta}</StyledMetaText>\n }\n actions={\n <>\n {configuration && (\n <Button ref={setButtonEl} label={configuration?.label} icon variant='simple'>\n <Icon name='gear' />\n </Button>\n )}\n {!readOnly && (\n <Button\n disabled={disabled}\n label={t('clear_object_summary', [String(label)])}\n icon\n variant='simple'\n onClick={onDelete}\n >\n <Icon name='times' />\n </Button>\n )}\n {configuration && (\n <Dialog\n heading={configuration.heading}\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n target={buttonEl}\n onOpen={configuration.onOpen}\n onClose={configuration.onClose}\n onSubmit={readOnly || disabled ? undefined : configuration?.onSubmit}\n loading={configuration.loading}\n ref={configuration.ref}\n >\n <ScrollContainer>{configuration?.children}</ScrollContainer>\n </Dialog>\n )}\n </>\n }\n />\n </FormField>\n );\n }\n);\n\nexport default ObjectSummary;\n"]}
@@ -0,0 +1,3 @@
1
+ export { default } from './ObjectSelect';
2
+ export { ObjectSelectProps } from './ObjectSelect';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectSelect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './ObjectSelect';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ObjectSelect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default } from './ObjectSelect';\nexport { ObjectSelectProps } from './ObjectSelect';\n"]}
@@ -0,0 +1,34 @@
1
+ import { ComponentType } from 'react';
2
+ import { ModalProps } from '@pega/cosmos-react-core';
3
+ export interface UseCreateModalConfig<P extends object = object> {
4
+ renderer: ComponentType<P>;
5
+ /**
6
+ * Called when a user submits a form.
7
+ */
8
+ onSubmit: ({ close }: {
9
+ close: () => void;
10
+ }) => void;
11
+ /**
12
+ * Called when a user cancels a form.
13
+ */
14
+ onDismiss: ({ close }: {
15
+ close: () => void;
16
+ }) => void;
17
+ /**
18
+ * Called before the modal opens.
19
+ */
20
+ onBeforeOpen?: ModalProps['onBeforeOpen'];
21
+ /**
22
+ * Called after the modal closes.
23
+ */
24
+ onAfterClose?: ModalProps['onAfterClose'];
25
+ }
26
+ export interface CreateModalActionProps<P extends object = object> {
27
+ loading?: boolean;
28
+ rendererProps: P;
29
+ }
30
+ declare const useCreateModal: <P extends object = object>(config: UseCreateModalConfig<P> | undefined) => {
31
+ renderModal: ({ rendererProps, loading }: CreateModalActionProps<P>) => void;
32
+ };
33
+ export default useCreateModal;
34
+ //# sourceMappingURL=useCreateModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateModal.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectSelect/useCreateModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAIL,UAAU,EAIX,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAI7D,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC3B;;OAEG;IACH,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IACrD;;OAEG;IACH,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IACtD;;OAEG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IAC1C;;OAEG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,CAAC,CAAC;CAClB;AAED,QAAA,MAAM,cAAc;;CAgFnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef } from 'react';
3
+ import { Button, Modal, useModalManager, useI18n } from '@pega/cosmos-react-core';
4
+ const useCreateModal = (config) => {
5
+ const t = useI18n();
6
+ const submittingRef = useRef(false);
7
+ const modalMethods = useRef();
8
+ const { create: createModal } = useModalManager();
9
+ if (config) {
10
+ const { renderer: Renderer, onSubmit, onDismiss, onBeforeOpen, onAfterClose } = config;
11
+ const renderModal = ({ rendererProps, loading = false }) => {
12
+ let modalContent = null;
13
+ if (!loading) {
14
+ modalContent = _jsx(Renderer, { ...rendererProps });
15
+ }
16
+ let formActions = null;
17
+ if (!loading || submittingRef.current) {
18
+ const close = () => {
19
+ modalMethods.current?.dismiss();
20
+ modalMethods.current = undefined;
21
+ };
22
+ formActions = (_jsxs(_Fragment, { children: [_jsx(Button, { disabled: loading, onClick: () => {
23
+ onDismiss({ close });
24
+ }, children: t('cancel') }), _jsx(Button, { disabled: loading, type: 'submit', variant: 'primary', onClick: () => {
25
+ submittingRef.current = true;
26
+ onSubmit({ close });
27
+ }, children: t('submit') })] }));
28
+ }
29
+ const modalProps = {
30
+ progress: loading
31
+ ? { message: submittingRef.current ? t('submitting') : t('loading') }
32
+ : undefined,
33
+ children: modalContent,
34
+ actions: formActions,
35
+ onRequestDismiss: loading && submittingRef.current ? () => false : undefined
36
+ };
37
+ if (modalMethods.current) {
38
+ modalMethods.current.update(modalProps);
39
+ }
40
+ else {
41
+ modalMethods.current = createModal(Modal, {
42
+ ...modalProps,
43
+ heading: t('create_new'),
44
+ onBeforeOpen,
45
+ onAfterClose: () => {
46
+ onAfterClose?.();
47
+ submittingRef.current = false;
48
+ }
49
+ });
50
+ }
51
+ };
52
+ return {
53
+ renderModal
54
+ };
55
+ }
56
+ return {
57
+ renderModal: () => { }
58
+ };
59
+ };
60
+ export default useCreateModal;
61
+ //# sourceMappingURL=useCreateModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateModal.js","sourceRoot":"","sources":["../../../src/components/ObjectSelect/useCreateModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAA4B,MAAM,OAAO,CAAC;AAEzD,OAAO,EAEL,MAAM,EAGN,KAAK,EACL,eAAe,EACf,OAAO,EACR,MAAM,yBAAyB,CAAC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AAE,KAAK,EAAE,CAAC,CAAC;4BACtB,CAAC,YAEA,CAAC,CAAC,QAAQ,CAAC,GACL,IACR,CACJ,CAAC;aACH;YAED,MAAM,UAAU,GAAsC;gBACpD,QAAQ,EAAE,OAAO;oBACf,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;oBACrE,CAAC,CAAC,SAAS;gBACb,QAAQ,EAAE,YAAY;gBACtB,OAAO,EAAE,WAAW;gBACpB,gBAAgB,EAAE,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aAC7E,CAAC;YAEF,IAAI,YAAY,CAAC,OAAO,EAAE;gBACxB,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;aACzC;iBAAM;gBACL,YAAY,CAAC,OAAO,GAAG,WAAW,CAAC,KAAK,EAAE;oBACxC,GAAG,UAAU;oBACb,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC;oBACxB,YAAY;oBACZ,YAAY,EAAE,GAAG,EAAE;wBACjB,YAAY,EAAE,EAAE,CAAC;wBACjB,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC;oBAChC,CAAC;iBACF,CAAC,CAAC;aACJ;QACH,CAAC,CAAC;QAEF,OAAO;YACL,WAAW;SACZ,CAAC;KACH;IAED,OAAO;QACL,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;KACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { useRef, ReactNode, ComponentType } from 'react';\n\nimport {\n ModalMethods,\n Button,\n OmitStrict,\n ModalProps,\n Modal,\n useModalManager,\n useI18n\n} from '@pega/cosmos-react-core';\n\nexport interface UseCreateModalConfig<P extends object = object> {\n /*\n * A component to render the add new form.\n */\n renderer: ComponentType<P>;\n /**\n * Called when a user submits a form.\n */\n onSubmit: ({ close }: { close: () => void }) => void;\n /**\n * Called when a user cancels a form.\n */\n onDismiss: ({ close }: { close: () => void }) => void;\n /**\n * Called before the modal opens.\n */\n onBeforeOpen?: ModalProps['onBeforeOpen'];\n /**\n * Called after the modal closes.\n */\n onAfterClose?: ModalProps['onAfterClose'];\n}\n\nexport interface CreateModalActionProps<P extends object = object> {\n loading?: boolean;\n rendererProps: P;\n}\n\nconst useCreateModal = <P extends object = object>(config: UseCreateModalConfig<P> | undefined) => {\n const t = useI18n();\n\n const submittingRef = useRef(false);\n const modalMethods = useRef<ModalMethods>();\n const { create: createModal } = useModalManager();\n\n if (config) {\n const { renderer: Renderer, onSubmit, onDismiss, onBeforeOpen, onAfterClose } = config;\n const renderModal = ({ rendererProps, loading = false }: CreateModalActionProps<P>) => {\n let modalContent: ReactNode = null;\n\n if (!loading) {\n modalContent = <Renderer {...rendererProps} />;\n }\n let formActions: ReactNode = null;\n\n if (!loading || submittingRef.current) {\n const close = () => {\n modalMethods.current?.dismiss();\n modalMethods.current = undefined;\n };\n\n formActions = (\n <>\n <Button\n disabled={loading}\n onClick={() => {\n onDismiss({ close });\n }}\n >\n {t('cancel')}\n </Button>\n <Button\n disabled={loading}\n type='submit'\n variant='primary'\n onClick={() => {\n submittingRef.current = true;\n onSubmit({ close });\n }}\n >\n {t('submit')}\n </Button>\n </>\n );\n }\n\n const modalProps: OmitStrict<ModalProps, 'heading'> = {\n progress: loading\n ? { message: submittingRef.current ? t('submitting') : t('loading') }\n : undefined,\n children: modalContent,\n actions: formActions,\n onRequestDismiss: loading && submittingRef.current ? () => false : undefined\n };\n\n if (modalMethods.current) {\n modalMethods.current.update(modalProps);\n } else {\n modalMethods.current = createModal(Modal, {\n ...modalProps,\n heading: t('create_new'),\n onBeforeOpen,\n onAfterClose: () => {\n onAfterClose?.();\n submittingRef.current = false;\n }\n });\n }\n };\n\n return {\n renderModal\n };\n }\n\n return {\n renderModal: () => {}\n };\n};\n\nexport default useCreateModal;\n"]}
@@ -4,20 +4,20 @@ import { Image, Flex, Grid, Button } from '@pega/cosmos-react-core';
4
4
  import SummaryCard from '../SummaryCard';
5
5
  import { StyledDescription, StyledHeading, StyledSummaryCardList, StyledBanner, StyledImageContainer, StyledGalleryPage, StyledBannerInfo } from './GalleryPage.styles';
6
6
  const Banner = ({ heading, description, image, action }) => {
7
- return (_jsxs(Flex, { container: { alignItems: 'center', justify: 'between' }, as: StyledBanner, children: [_jsxs(Flex, { as: StyledBannerInfo, item: { grow: 1 }, children: [_jsx(StyledHeading, { variant: 'h1', children: heading }, void 0), description && _jsx(StyledDescription, { children: description }, void 0), action && (_jsx(Button, { onClick: (e) => action.onClick(e), children: action.text }, void 0))] }, void 0), image && (_jsx(StyledImageContainer, { children: _jsx(Image, { ...image }, void 0) }, void 0))] }, void 0));
7
+ return (_jsxs(Flex, { container: { alignItems: 'center', justify: 'between' }, as: StyledBanner, children: [_jsxs(Flex, { as: StyledBannerInfo, item: { grow: 1 }, children: [_jsx(StyledHeading, { variant: 'h1', children: heading }), description && _jsx(StyledDescription, { children: description }), action && (_jsx(Button, { onClick: (e) => action.onClick(e), children: action.text }))] }), image && (_jsx(StyledImageContainer, { children: _jsx(Image, { ...image }) }))] }));
8
8
  };
9
9
  const SummaryCardList = ({ items, onItemClick }) => {
10
10
  return (_jsx(Grid, { container: {
11
11
  cols: 'repeat(auto-fill, minmax(18.75rem, 1fr))',
12
12
  autoRows: '10rem',
13
13
  gap: 2
14
- }, as: StyledSummaryCardList, children: items && items.map(item => _jsx(SummaryCard, { ...item, onClick: onItemClick }, item.id)) }, void 0));
14
+ }, as: StyledSummaryCardList, children: items && items.map(item => _jsx(SummaryCard, { ...item, onClick: onItemClick }, item.id)) }));
15
15
  };
16
16
  const EmptyState = ({ heading, description, action }) => {
17
- return (_jsxs(Flex, { container: { direction: 'column', alignItems: 'center', justify: 'center', rowGap: 2 }, item: { grow: 1 }, children: [_jsx(StyledHeading, { variant: 'h2', children: heading }, void 0), description && _jsx(StyledDescription, { children: description }, void 0), action && (_jsx(Button, { variant: 'primary', onClick: action.onClick, children: action.text }, void 0))] }, void 0));
17
+ return (_jsxs(Flex, { container: { direction: 'column', alignItems: 'center', justify: 'center', rowGap: 2 }, item: { grow: 1 }, children: [_jsx(StyledHeading, { variant: 'h2', children: heading }), description && _jsx(StyledDescription, { children: description }), action && (_jsx(Button, { variant: 'primary', onClick: action.onClick, children: action.text }))] }));
18
18
  };
19
19
  const GalleryPage = forwardRef(({ heading, description, image, items, onItemClick, emptyState, action }, ref) => {
20
- return (_jsx(StyledGalleryPage, { title: '', ref: ref, header: _jsx(Banner, { heading: heading, description: description, action: action, image: image }, void 0), a: items && items.length > 0 ? (_jsx(SummaryCardList, { items: items, onItemClick: onItemClick }, void 0)) : (_jsx(EmptyState, { ...emptyState, action: action }, void 0)), scrollContent: true }, void 0));
20
+ return (_jsx(StyledGalleryPage, { title: '', ref: ref, header: _jsx(Banner, { heading: heading, description: description, action: action, image: image }), a: items && items.length > 0 ? (_jsx(SummaryCardList, { items: items, onItemClick: onItemClick })) : (_jsx(EmptyState, { ...emptyState, action: action })), scrollContent: true }));
21
21
  });
22
22
  export default GalleryPage;
23
23
  //# sourceMappingURL=GalleryPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryPage.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/GalleryPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAuB,UAAU,EAAmB,MAAM,OAAO,CAAC;AAEzE,OAAO,EAEL,KAAK,EAEL,IAAI,EACJ,IAAI,EACJ,MAAM,EAEP,MAAM,yBAAyB,CAAC;AAEjC,OAAO,WAAiC,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAqB9B,MAAM,MAAM,G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AAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,EACtF,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,aAEjB,KAAC,aAAa,IAAC,OAAO,EAAC,IAAI,YAAE,OAAO,WAAiB,EACpD,WAAW,IAAI,KAAC,iBAAiB,cAAE,WAAW,WAAqB,EACnE,MAAM,IAAI,CACT,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,MAAM,CAAC,OAAO,YAC9C,MAAM,CAAC,IAAI,WACL,CACV,YACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAwC,UAAU,CACjE,CACE,EACE,OAAO,EACP,WAAW,EACX,KAAK,EACL,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EAC4B,EACpC,GAA4B,EAC5B,EAAE;IACF,OAAO,CACL,KAAC,iBAAiB,IAChB,KAAK,EAAC,EAAE,EACR,GAAG,EAAE,GAAG,EACR,MAAM,EACJ,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,WAAI,EAEtF,CAAC,EACC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAC1B,KAAC,eAAe,IAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,WAAI,CAC5D,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,OAAK,UAAU,EAAE,MAAM,EAAE,MAAM,WAAI,CAC/C,EAEH,aAAa,iBACb,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { FC, PropsWithoutRef, forwardRef, Ref, MouseEvent } from 'react';\n\nimport {\n ForwardProps,\n Image,\n ImageProps,\n Flex,\n Grid,\n Button,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nimport SummaryCard, { SummaryCardProps } from '../SummaryCard';\n\nimport {\n StyledDescription,\n StyledHeading,\n StyledSummaryCardList,\n StyledBanner,\n StyledImageContainer,\n StyledGalleryPage,\n StyledBannerInfo\n} from './GalleryPage.styles';\n\ninterface EmptyStateProps {\n heading: string;\n description?: string;\n}\n\nexport interface GalleryPageProps extends NoChildrenProp {\n heading: string;\n description?: string;\n image?: ImageProps;\n action: {\n text: string;\n onClick: (e: MouseEvent<HTMLButtonElement>) => void;\n };\n emptyState: EmptyStateProps;\n items?: SummaryCardProps[];\n onItemClick: (id: SummaryCardProps['id'], e: MouseEvent<HTMLDivElement>) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst Banner: FC<Pick<GalleryPageProps, 'heading' | 'description' | 'image' | 'action'>> = ({\n heading,\n description,\n image,\n action\n}) => {\n return (\n <Flex container={{ alignItems: 'center', justify: 'between' }} as={StyledBanner}>\n <Flex as={StyledBannerInfo} item={{ grow: 1 }}>\n <StyledHeading variant='h1'>{heading}</StyledHeading>\n {description && <StyledDescription>{description}</StyledDescription>}\n {action && (\n <Button onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick(e)}>\n {action.text}\n </Button>\n )}\n </Flex>\n {image && (\n <StyledImageContainer>\n <Image {...image} />\n </StyledImageContainer>\n )}\n </Flex>\n );\n};\n\nconst SummaryCardList: FC<{\n items: GalleryPageProps['items'];\n onItemClick: GalleryPageProps['onItemClick'];\n}> = ({ items, onItemClick }) => {\n return (\n <Grid\n container={{\n cols: 'repeat(auto-fill, minmax(18.75rem, 1fr))',\n autoRows: '10rem',\n gap: 2\n }}\n as={StyledSummaryCardList}\n >\n {items && items.map(item => <SummaryCard key={item.id} {...item} onClick={onItemClick} />)}\n </Grid>\n );\n};\n\nconst EmptyState: FC<EmptyStateProps & Pick<GalleryPageProps, 'action'>> = ({\n heading,\n description,\n action\n}) => {\n return (\n <Flex\n container={{ direction: 'column', alignItems: 'center', justify: 'center', rowGap: 2 }}\n item={{ grow: 1 }}\n >\n <StyledHeading variant='h2'>{heading}</StyledHeading>\n {description && <StyledDescription>{description}</StyledDescription>}\n {action && (\n <Button variant='primary' onClick={action.onClick}>\n {action.text}\n </Button>\n )}\n </Flex>\n );\n};\n\nconst GalleryPage: FC<GalleryPageProps & ForwardProps> = forwardRef(\n (\n {\n heading,\n description,\n image,\n items,\n onItemClick,\n emptyState,\n action\n }: PropsWithoutRef<GalleryPageProps>,\n ref: GalleryPageProps['ref']\n ) => {\n return (\n <StyledGalleryPage\n title=''\n ref={ref}\n header={\n <Banner heading={heading} description={description} action={action} image={image} />\n }\n a={\n items && items.length > 0 ? (\n <SummaryCardList items={items} onItemClick={onItemClick} />\n ) : (\n <EmptyState {...emptyState} action={action} />\n )\n }\n scrollContent\n />\n );\n }\n);\n\nexport default GalleryPage;\n"]}
1
+ {"version":3,"file":"GalleryPage.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/GalleryPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAuB,UAAU,EAAmB,MAAM,OAAO,CAAC;AAEzE,OAAO,EAEL,KAAK,EAEL,IAAI,EACJ,IAAI,EACJ,MAAM,EAEP,MAAM,yBAAyB,CAAC;AAEjC,OAAO,WAAiC,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAqB9B,MAAM,MAAM,GAA+E,CAAC,EAC1F,OAAO,EACP,WAAW,EACX,KAAK,EACL,MAAM,EACP,EAAE,EAAE;IACH,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,YAAY,aAC7E,MAAC,IAAI,IAAC,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CA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KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,MAAM,CAAC,OAAO,YAC9C,MAAM,CAAC,IAAI,GACL,CACV,IACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAwC,UAAU,CACjE,CACE,EACE,OAAO,EACP,WAAW,EACX,KAAK,EACL,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EAC4B,EACpC,GAA4B,EAC5B,EAAE;IACF,OAAO,CACL,KAAC,iBAAiB,IAChB,KAAK,EAAC,EAAE,EACR,GAAG,EAAE,GAAG,EACR,MAAM,EACJ,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAI,EAEtF,CAAC,EACC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAC1B,KAAC,eAAe,IAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,GAAI,CAC5D,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,OAAK,UAAU,EAAE,MAAM,EAAE,MAAM,GAAI,CAC/C,EAEH,aAAa,SACb,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { FC, PropsWithoutRef, forwardRef, Ref, MouseEvent } from 'react';\n\nimport {\n ForwardProps,\n Image,\n ImageProps,\n Flex,\n Grid,\n Button,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nimport SummaryCard, { SummaryCardProps } from '../SummaryCard';\n\nimport {\n StyledDescription,\n StyledHeading,\n StyledSummaryCardList,\n StyledBanner,\n StyledImageContainer,\n StyledGalleryPage,\n StyledBannerInfo\n} from './GalleryPage.styles';\n\ninterface EmptyStateProps {\n heading: string;\n description?: string;\n}\n\nexport interface GalleryPageProps extends NoChildrenProp {\n heading: string;\n description?: string;\n image?: ImageProps;\n action: {\n text: string;\n onClick: (e: MouseEvent<HTMLButtonElement>) => void;\n };\n emptyState: EmptyStateProps;\n items?: SummaryCardProps[];\n onItemClick: (id: SummaryCardProps['id'], e: MouseEvent<HTMLDivElement>) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst Banner: FC<Pick<GalleryPageProps, 'heading' | 'description' | 'image' | 'action'>> = ({\n heading,\n description,\n image,\n action\n}) => {\n return (\n <Flex container={{ alignItems: 'center', justify: 'between' }} as={StyledBanner}>\n <Flex as={StyledBannerInfo} item={{ grow: 1 }}>\n <StyledHeading variant='h1'>{heading}</StyledHeading>\n {description && <StyledDescription>{description}</StyledDescription>}\n {action && (\n <Button onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick(e)}>\n {action.text}\n </Button>\n )}\n </Flex>\n {image && (\n <StyledImageContainer>\n <Image {...image} />\n </StyledImageContainer>\n )}\n </Flex>\n );\n};\n\nconst SummaryCardList: FC<{\n items: GalleryPageProps['items'];\n onItemClick: GalleryPageProps['onItemClick'];\n}> = ({ items, onItemClick }) => {\n return (\n <Grid\n container={{\n cols: 'repeat(auto-fill, minmax(18.75rem, 1fr))',\n autoRows: '10rem',\n gap: 2\n }}\n as={StyledSummaryCardList}\n >\n {items && items.map(item => <SummaryCard key={item.id} {...item} onClick={onItemClick} />)}\n </Grid>\n );\n};\n\nconst EmptyState: FC<EmptyStateProps & Pick<GalleryPageProps, 'action'>> = ({\n heading,\n description,\n action\n}) => {\n return (\n <Flex\n container={{ direction: 'column', alignItems: 'center', justify: 'center', rowGap: 2 }}\n item={{ grow: 1 }}\n >\n <StyledHeading variant='h2'>{heading}</StyledHeading>\n {description && <StyledDescription>{description}</StyledDescription>}\n {action && (\n <Button variant='primary' onClick={action.onClick}>\n {action.text}\n </Button>\n )}\n </Flex>\n );\n};\n\nconst GalleryPage: FC<GalleryPageProps & ForwardProps> = forwardRef(\n (\n {\n heading,\n description,\n image,\n items,\n onItemClick,\n emptyState,\n action\n }: PropsWithoutRef<GalleryPageProps>,\n ref: GalleryPageProps['ref']\n ) => {\n return (\n <StyledGalleryPage\n title=''\n ref={ref}\n header={\n <Banner heading={heading} description={description} action={action} image={image} />\n }\n a={\n items && items.length > 0 ? (\n <SummaryCardList items={items} onItemClick={onItemClick} />\n ) : (\n <EmptyState {...emptyState} action={action} />\n )\n }\n scrollContent\n />\n );\n }\n);\n\nexport default GalleryPage;\n"]}
@@ -2,11 +2,11 @@ import { FunctionComponent, MouseEvent } from 'react';
2
2
  import { OneColumnPageProps as CoreOneColumnPageProps, TabbedPageProps as CoreTabbedPageProps, FieldValueListProps, ForwardProps, PageTemplateProps, OmitStrict, StatusProps } from '@pega/cosmos-react-core';
3
3
  export interface PageHeaderProps extends Pick<PageTemplateProps, 'title' | 'actions'> {
4
4
  metadata?: FieldValueListProps['fields'];
5
- branchName?: string;
6
5
  status?: {
7
- type?: StatusProps['variant'];
6
+ type: StatusProps['variant'];
8
7
  label: string;
9
8
  };
9
+ titleTag?: 'h1' | 'h2';
10
10
  additionalInfo?: {
11
11
  title: string;
12
12
  description?: string;
@@ -19,8 +19,8 @@ export interface OneColumnPageProps extends OmitStrict<CoreOneColumnPageProps, O
19
19
  }
20
20
  export interface TabbedPageProps extends OmitStrict<CoreTabbedPageProps, OmittedPageProps>, PageHeaderProps {
21
21
  }
22
- export declare const StyledBranch: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
23
22
  export declare const StyledPage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
23
+ export declare const PageHeader: ({ title, metadata, additionalInfo, actions, status, titleTag }: PageHeaderProps) => JSX.Element;
24
24
  export declare const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps>;
25
25
  export declare const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps>;
26
26
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"PageTemplates.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,E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,eAAe,GAAG,YAAY,CAaxE,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAoB9E,CAAC"}
@@ -1,66 +1,63 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { forwardRef, useState, useEffect } from 'react';
2
+ import { forwardRef, useState, useEffect, useMemo, useRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import { OneColumnPage as CoreOneColumnPage, TabbedPage as CoreTabbedPage, Flex, Status, SummaryItem, Text, Button, Popover, FieldValueList, Icon, defaultThemeProp, useI18n, useDirection, useElement, useOuterEvent, StyledSummaryItemActions, registerIcon, StyledLabel, StyledRegion } from '@pega/cosmos-react-core';
4
+ import { OneColumnPage as CoreOneColumnPage, TabbedPage as CoreTabbedPage, Flex, Status, SummaryItem, Text, Button, Popover, FieldValueList, Icon, defaultThemeProp, useI18n, useDirection, useElement, useOuterEvent, StyledSummaryItemActions, registerIcon, StyledRegion, MetaList, StyledBreadcrumbs, StyledPageHeader, useAfterInitialEffect } from '@pega/cosmos-react-core';
5
5
  import * as nodesDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/nodes-down.icon';
6
6
  import * as informationIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/information.icon';
7
- import { StyledTabPanel } from '@pega/cosmos-react-core/lib/components/Tabs/TabPanel';
7
+ import { StyledForm } from '@pega/cosmos-react-core/lib/components/MultiStepForm/MultiStepForm';
8
+ import { StyledBanner } from '@pega/cosmos-react-core/lib/components/Banner/Banner';
9
+ import { StyledTabs } from '@pega/cosmos-react-core/lib/components/Tabs/Tabs';
10
+ import { StyledDialogTitle } from '@pega/cosmos-react-core/lib/components/Dialog/Dialog';
8
11
  import { StyledWorkbench } from '../Workbench/Workbench.styles';
9
12
  registerIcon(nodesDownIcon, informationIcon);
10
13
  const StyledTextWithEllipsis = styled(Text) `
11
14
  overflow: hidden;
12
15
  white-space: nowrap;
13
16
  text-overflow: ellipsis;
17
+ line-height: 1.15;
14
18
  `;
15
19
  const StyledInfoPopover = styled(Popover) `
16
20
  max-width: 60ch;
17
21
  overflow-wrap: break-word;
18
22
  `;
19
- const StyledMetaFields = styled.dl `
20
- dd,
21
- dt {
22
- display: inline;
23
- }
24
- `;
25
- export const StyledBranch = styled.div(({ theme }) => {
26
- return css `
27
- border: 0.0625rem solid ${theme.base.colors.gray.light};
28
- border-radius: calc(0.5 * ${theme.base['border-radius']});
29
- padding: calc(0.5 * ${theme.base.spacing});
30
- max-width: 100%;
31
- overflow: hidden;
32
- `;
33
- });
34
- StyledBranch.defaultProps = defaultThemeProp;
35
23
  const StyledHeaderContent = styled(SummaryItem) `
36
24
  ${StyledSummaryItemActions} {
37
25
  align-self: start;
38
26
  }
39
27
  `;
40
- export const StyledPage = styled.div(({ theme: { base: { spacing } } }) => {
28
+ export const StyledPage = styled.div(({ theme: { base: { spacing, palette: { 'primary-background': primaryBackground } } } }) => {
41
29
  return css `
42
- ${StyledRegion} > ${StyledWorkbench},
43
- ${StyledTabPanel} > ${StyledWorkbench} {
30
+ background: ${primaryBackground};
31
+ height: 100%;
32
+
33
+ ${StyledBanner},
34
+ ${StyledTabs} {
35
+ margin-block-start: calc(1.5 * ${spacing});
36
+ }
37
+
38
+ ${StyledRegion} ${StyledWorkbench} {
44
39
  position: absolute;
45
- width: calc(100% - calc(4 * ${spacing}));
40
+ width: 100%;
41
+ margin: 0 calc(-2 * ${spacing});
42
+ }
43
+
44
+ ${StyledRegion} ${StyledForm} {
45
+ max-width: 80ch;
46
+ }
47
+
48
+ ${StyledPageHeader} > ${StyledBreadcrumbs} {
49
+ margin-block-end: 0;
46
50
  }
47
51
  `;
48
52
  });
49
53
  StyledPage.defaultProps = defaultThemeProp;
50
- const MetaFields = ({ metadata }) => {
51
- return (_jsx(Flex, { container: { wrap: 'wrap', colGap: 1, rowGap: 0.25 }, as: StyledMetaFields, children: metadata.map(meta => {
52
- return (_jsxs("div", { children: [_jsxs(StyledLabel, { as: 'dt', children: [meta.name, _jsx("span", { "aria-hidden": 'true', children: ": " }, void 0)] }, void 0), _jsx(Text, { variant: 'secondary', as: 'dd', children: meta.value }, void 0)] }, meta.id));
53
- }) }, void 0));
54
- };
55
- const Branch = ({ branchName, status }) => {
56
- return (_jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: StyledBranch, children: [status && (_jsx(Flex, { item: { shrink: 0 }, as: Status, variant: status.type, children: status.label }, void 0)), _jsx(Flex, { item: { shrink: 0 }, as: Icon, name: 'nodes-down' }, void 0), branchName && _jsx(StyledTextWithEllipsis, { children: branchName }, void 0)] }, void 0));
57
- };
58
- const PageHeader = ({ title, metadata, additionalInfo, actions, branchName, status }) => {
54
+ export const PageHeader = ({ title, metadata, additionalInfo, actions, status, titleTag }) => {
59
55
  const [open, setOpen] = useState(false);
60
56
  const [popoverEl, setPopoverRef] = useElement();
61
57
  const [buttonEl, setButtonEl] = useElement();
62
58
  const t = useI18n();
63
59
  const { rtl } = useDirection();
60
+ const popoverTitleRef = useRef(null);
64
61
  useOuterEvent('mousedown', [popoverEl, buttonEl], () => {
65
62
  if (open)
66
63
  setOpen(false);
@@ -83,15 +80,26 @@ const PageHeader = ({ title, metadata, additionalInfo, actions, branchName, stat
83
80
  popoverEl?.removeEventListener('keydown', closePopover);
84
81
  };
85
82
  }, [popoverEl]);
86
- return (_jsx(StyledHeaderContent, { container: { rowGap: 0.5 }, primary: _jsxs(Flex, { container: { alignItems: 'start', gap: 0.5, wrap: 'wrap' }, children: [_jsxs(Flex, { container: { gap: 0.5 }, item: { shrink: 0 }, children: [_jsx(StyledTextWithEllipsis, { variant: 'h1', children: title }, void 0), additionalInfo && (_jsxs(_Fragment, { children: [_jsx(Button, { label: t('additional_info'), variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), children: _jsx(Icon, { name: 'information' }, void 0) }, void 0), _jsx(StyledInfoPopover, { ref: setPopoverRef, show: open, target: buttonEl, placement: rtl ? 'bottom-end' : 'bottom-start', children: _jsxs(Flex, { container: { direction: 'column', alignItems: 'start', gap: 2, pad: 2 }, children: [_jsxs(Flex, { container: { direction: 'column', gap: 1 }, children: [_jsx(Text, { variant: 'h3', children: additionalInfo.title }, void 0), additionalInfo.description && (_jsx(Text, { as: 'p', children: additionalInfo.description }, void 0)), _jsx(FieldValueList, { variant: 'inline', fields: additionalInfo.fields }, void 0)] }, void 0), additionalInfo.onEdit && (_jsx(Button, { onClick: (e) => {
83
+ useAfterInitialEffect(() => {
84
+ if (open && popoverEl) {
85
+ if (popoverTitleRef.current) {
86
+ popoverTitleRef.current.focus();
87
+ }
88
+ else {
89
+ buttonEl?.focus();
90
+ }
91
+ }
92
+ }, [open, popoverEl]);
93
+ const metaListItems = useMemo(() => metadata?.map(({ name, value }) => `${name}: ${value}`), [metadata]);
94
+ return (_jsx(StyledHeaderContent, { container: true, primary: _jsxs(Flex, { container: { alignItems: 'center', gap: 0.5, wrap: 'wrap' }, children: [_jsxs(Flex, { container: { gap: 0.5 }, item: { shrink: 0 }, children: [_jsx(StyledTextWithEllipsis, { variant: 'h1', forwardedAs: titleTag, children: title }), additionalInfo && (_jsxs(_Fragment, { children: [_jsx(Button, { label: t('additional_info'), variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), children: _jsx(Icon, { name: 'information' }) }), _jsx(StyledInfoPopover, { ref: setPopoverRef, show: open, target: buttonEl, placement: rtl ? 'bottom-end' : 'bottom-start', children: _jsxs(Flex, { container: { direction: 'column', alignItems: 'start', gap: 2, pad: 2 }, children: [_jsxs(Flex, { container: { direction: 'column', gap: 1 }, children: [_jsx(StyledDialogTitle, { variant: 'h3', tabIndex: -1, ref: popoverTitleRef, children: additionalInfo.title }), additionalInfo.description && (_jsx(Text, { as: 'p', children: additionalInfo.description })), _jsx(FieldValueList, { variant: 'inline', fields: additionalInfo.fields })] }), additionalInfo.onEdit && (_jsx(Button, { onClick: (e) => {
87
95
  setOpen(false);
88
96
  additionalInfo.onEdit?.(e);
89
- }, children: t('edit_details') }, void 0))] }, void 0) }, void 0)] }, void 0))] }, void 0), branchName && status && _jsx(Branch, { branchName: branchName, status: status }, void 0)] }, void 0), secondary: metadata && _jsx(MetaFields, { metadata: metadata }, void 0), actions: actions }, void 0));
97
+ }, children: t('edit_details') }))] }) })] }))] }), status && _jsx(Status, { variant: status.type, children: status.label })] }), secondary: metaListItems && _jsx(MetaList, { items: metaListItems }), actions: actions }));
90
98
  };
91
- export const TabbedPage = forwardRef(({ tabs, a, ...restProps }, ref) => {
92
- return (_jsx(CoreTabbedPage, { ...restProps, as: StyledPage, header: _jsx(PageHeader, { ...restProps }, void 0), tabs: tabs, ref: ref, scrollContent: true, a: a }, void 0));
99
+ export const TabbedPage = forwardRef(({ tabs, ...restProps }, ref) => {
100
+ return (_jsx(CoreTabbedPage, { ...restProps, as: StyledPage, header: _jsx(PageHeader, { ...restProps }), tabs: tabs, ref: ref, scrollContent: true }));
93
101
  });
94
102
  export const OneColumnPage = forwardRef(({ a, ...restProps }, ref) => {
95
- return (_jsx(CoreOneColumnPage, { ...restProps, as: StyledPage, header: _jsx(PageHeader, { ...restProps }, void 0), scrollContent: true, a: a, ref: ref }, void 0));
103
+ return (_jsx(CoreOneColumnPage, { ...restProps, as: StyledPage, header: _jsx(PageHeader, { ...restProps }), scrollContent: true, a: a, ref: ref }));
96
104
  });
97
105
  //# sourceMappingURL=PageTemplates.js.map