@pega/cosmos-react-build 2.1.4 → 3.0.0-dev.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 (234) hide show
  1. package/lib/components/AppHeader/AppHeader.d.ts +6 -4
  2. package/lib/components/AppHeader/AppHeader.d.ts.map +1 -1
  3. package/lib/components/AppHeader/AppHeader.js +10 -8
  4. package/lib/components/AppHeader/AppHeader.js.map +1 -1
  5. package/lib/components/AppHeader/AppHeader.styles.d.ts +1 -1
  6. package/lib/components/AppHeader/AppHeader.styles.d.ts.map +1 -1
  7. package/lib/components/AppHeader/AppHeader.styles.js +7 -18
  8. package/lib/components/AppHeader/AppHeader.styles.js.map +1 -1
  9. package/lib/components/AppHeader/BranchButton.d.ts +19 -0
  10. package/lib/components/AppHeader/BranchButton.d.ts.map +1 -0
  11. package/lib/components/AppHeader/BranchButton.js +87 -0
  12. package/lib/components/AppHeader/BranchButton.js.map +1 -0
  13. package/lib/components/AppHeader/index.d.ts +1 -0
  14. package/lib/components/AppHeader/index.d.ts.map +1 -1
  15. package/lib/components/AppHeader/index.js +1 -0
  16. package/lib/components/AppHeader/index.js.map +1 -1
  17. package/lib/components/AppShell/AppShell.d.ts +1 -0
  18. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  19. package/lib/components/AppShell/AppShell.js +15 -20
  20. package/lib/components/AppShell/AppShell.js.map +1 -1
  21. package/lib/components/AppShell/AppShell.styles.d.ts +1 -0
  22. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  23. package/lib/components/AppShell/AppShell.styles.js +17 -2
  24. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  25. package/lib/components/AppShell/AppShell.types.d.ts +6 -9
  26. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  27. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  28. package/lib/components/AppShell/AppShellContext.d.ts +1 -0
  29. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  30. package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +9 -0
  31. package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -0
  32. package/lib/components/DynamicContentEditor/DynamicContentEditor.js +235 -0
  33. package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -0
  34. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts +23 -0
  35. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts.map +1 -0
  36. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js +2 -0
  37. package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js.map +1 -0
  38. package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts +308 -0
  39. package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts.map +1 -0
  40. package/lib/components/DynamicContentEditor/PegaCustomElement.js +23 -0
  41. package/lib/components/DynamicContentEditor/PegaCustomElement.js.map +1 -0
  42. package/lib/components/DynamicContentEditor/index.d.ts +3 -0
  43. package/lib/components/DynamicContentEditor/index.d.ts.map +1 -0
  44. package/lib/components/DynamicContentEditor/index.js +2 -0
  45. package/lib/components/DynamicContentEditor/index.js.map +1 -0
  46. package/lib/components/FlowModeller/AddNode.d.ts +9 -7
  47. package/lib/components/FlowModeller/AddNode.d.ts.map +1 -1
  48. package/lib/components/FlowModeller/AddNode.js +9 -3
  49. package/lib/components/FlowModeller/AddNode.js.map +1 -1
  50. package/lib/components/FlowModeller/Connector.d.ts +7 -0
  51. package/lib/components/FlowModeller/Connector.d.ts.map +1 -0
  52. package/lib/components/FlowModeller/Connector.js +34 -0
  53. package/lib/components/FlowModeller/Connector.js.map +1 -0
  54. package/lib/components/FlowModeller/DeletePopover.d.ts +19 -0
  55. package/lib/components/FlowModeller/DeletePopover.d.ts.map +1 -0
  56. package/lib/components/FlowModeller/DeletePopover.js +105 -0
  57. package/lib/components/FlowModeller/DeletePopover.js.map +1 -0
  58. package/lib/components/FlowModeller/FlowModeller.d.ts +6 -2
  59. package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -1
  60. package/lib/components/FlowModeller/FlowModeller.js +110 -58
  61. package/lib/components/FlowModeller/FlowModeller.js.map +1 -1
  62. package/lib/components/FlowModeller/Node/Node.types.d.ts +18 -12
  63. package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -1
  64. package/lib/components/FlowModeller/Node/Node.types.js +2 -3
  65. package/lib/components/FlowModeller/Node/Node.types.js.map +1 -1
  66. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +7 -4
  67. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -1
  68. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +21 -11
  69. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -1
  70. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +1 -1
  71. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -1
  72. package/lib/components/FlowModeller/Node/NodeTemplates.js +37 -18
  73. package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -1
  74. package/lib/components/FlowModeller/Node.d.ts +5 -0
  75. package/lib/components/FlowModeller/Node.d.ts.map +1 -0
  76. package/lib/components/FlowModeller/Node.js +22 -0
  77. package/lib/components/FlowModeller/Node.js.map +1 -0
  78. package/lib/components/FlowModeller/Renderer/Connectors.d.ts +2 -0
  79. package/lib/components/FlowModeller/Renderer/Connectors.d.ts.map +1 -1
  80. package/lib/components/FlowModeller/Renderer/Connectors.js +5 -3
  81. package/lib/components/FlowModeller/Renderer/Connectors.js.map +1 -1
  82. package/lib/components/FlowModeller/Renderer/Nodes.d.ts +2 -0
  83. package/lib/components/FlowModeller/Renderer/Nodes.d.ts.map +1 -1
  84. package/lib/components/FlowModeller/Renderer/Nodes.js +3 -3
  85. package/lib/components/FlowModeller/Renderer/Nodes.js.map +1 -1
  86. package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +1 -1
  87. package/lib/components/FlowModeller/Renderer/Renderer.js +2 -2
  88. package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -1
  89. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +10 -4
  90. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +1 -1
  91. package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +1 -1
  92. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +3 -3
  93. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +1 -1
  94. package/lib/components/FlowModeller/Renderer/Utils/Graph.js +7 -1
  95. package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -1
  96. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +8 -4
  97. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts.map +1 -1
  98. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js +23 -3
  99. package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js.map +1 -1
  100. package/lib/components/FlowModeller/Utils/{AddNodeUtils.d.ts → addNodeUtils.d.ts} +1 -1
  101. package/lib/components/FlowModeller/Utils/{AddNodeUtils.d.ts.map → addNodeUtils.d.ts.map} +1 -1
  102. package/lib/components/FlowModeller/Utils/{AddNodeUtils.js → addNodeUtils.js} +1 -1
  103. package/lib/components/FlowModeller/Utils/addNodeUtils.js.map +1 -0
  104. package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts +29 -0
  105. package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts.map +1 -0
  106. package/lib/components/FlowModeller/Utils/deleteNodeUtils.js +71 -0
  107. package/lib/components/FlowModeller/Utils/deleteNodeUtils.js.map +1 -0
  108. package/lib/components/FlowModeller/helper.d.ts +4 -7
  109. package/lib/components/FlowModeller/helper.d.ts.map +1 -1
  110. package/lib/components/FlowModeller/helper.js +67 -43
  111. package/lib/components/FlowModeller/helper.js.map +1 -1
  112. package/lib/components/FlowModeller/index.d.ts +5 -1
  113. package/lib/components/FlowModeller/index.d.ts.map +1 -1
  114. package/lib/components/FlowModeller/index.js +5 -1
  115. package/lib/components/FlowModeller/index.js.map +1 -1
  116. package/lib/components/ItemLibrary/ItemLibrary.d.ts +25 -0
  117. package/lib/components/ItemLibrary/ItemLibrary.d.ts.map +1 -0
  118. package/lib/components/{FlowModeller/NodeLibrary.js → ItemLibrary/ItemLibrary.js} +26 -12
  119. package/lib/components/ItemLibrary/ItemLibrary.js.map +1 -0
  120. package/lib/components/ItemLibrary/index.d.ts +3 -0
  121. package/lib/components/ItemLibrary/index.d.ts.map +1 -0
  122. package/lib/components/ItemLibrary/index.js +3 -0
  123. package/lib/components/ItemLibrary/index.js.map +1 -0
  124. package/lib/components/LifeCycle/Category.d.ts.map +1 -1
  125. package/lib/components/LifeCycle/Category.js +11 -8
  126. package/lib/components/LifeCycle/Category.js.map +1 -1
  127. package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -1
  128. package/lib/components/LifeCycle/LifeCycle.js +5 -5
  129. package/lib/components/LifeCycle/LifeCycle.js.map +1 -1
  130. package/lib/components/LifeCycle/LifeCycle.types.d.ts +14 -5
  131. package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
  132. package/lib/components/LifeCycle/LifeCycle.types.js +78 -1
  133. package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -1
  134. package/lib/components/LifeCycle/LifeCycleList.d.ts +4 -3
  135. package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -1
  136. package/lib/components/LifeCycle/LifeCycleList.js +6 -3
  137. package/lib/components/LifeCycle/LifeCycleList.js.map +1 -1
  138. package/lib/components/LifeCycle/Stage.d.ts +6 -10
  139. package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
  140. package/lib/components/LifeCycle/Stage.js +47 -55
  141. package/lib/components/LifeCycle/Stage.js.map +1 -1
  142. package/lib/components/LifeCycle/Step.d.ts +5 -6
  143. package/lib/components/LifeCycle/Step.d.ts.map +1 -1
  144. package/lib/components/LifeCycle/Step.js +31 -43
  145. package/lib/components/LifeCycle/Step.js.map +1 -1
  146. package/lib/components/LifeCycle/Task.d.ts +6 -1
  147. package/lib/components/LifeCycle/Task.d.ts.map +1 -1
  148. package/lib/components/LifeCycle/Task.js +26 -10
  149. package/lib/components/LifeCycle/Task.js.map +1 -1
  150. package/lib/components/LifeCycle/index.d.ts +1 -2
  151. package/lib/components/LifeCycle/index.d.ts.map +1 -1
  152. package/lib/components/LifeCycle/index.js.map +1 -1
  153. package/lib/components/ObjectPreview/ObjectPreview.d.ts +16 -0
  154. package/lib/components/ObjectPreview/ObjectPreview.d.ts.map +1 -0
  155. package/lib/components/ObjectPreview/ObjectPreview.js +25 -0
  156. package/lib/components/ObjectPreview/ObjectPreview.js.map +1 -0
  157. package/lib/components/ObjectPreview/index.d.ts +3 -0
  158. package/lib/components/ObjectPreview/index.d.ts.map +1 -0
  159. package/lib/components/ObjectPreview/index.js +3 -0
  160. package/lib/components/ObjectPreview/index.js.map +1 -0
  161. package/lib/components/ObjectSelect/ObjectConfig.d.ts +18 -0
  162. package/lib/components/ObjectSelect/ObjectConfig.d.ts.map +1 -0
  163. package/lib/components/ObjectSelect/ObjectConfig.js +14 -0
  164. package/lib/components/ObjectSelect/ObjectConfig.js.map +1 -0
  165. package/lib/components/ObjectSelect/ObjectPicker.d.ts +11 -0
  166. package/lib/components/ObjectSelect/ObjectPicker.d.ts.map +1 -0
  167. package/lib/components/ObjectSelect/ObjectPicker.js +26 -0
  168. package/lib/components/ObjectSelect/ObjectPicker.js.map +1 -0
  169. package/lib/components/ObjectSelect/ObjectSelect.d.ts +27 -0
  170. package/lib/components/ObjectSelect/ObjectSelect.d.ts.map +1 -0
  171. package/lib/components/ObjectSelect/ObjectSelect.js +25 -0
  172. package/lib/components/ObjectSelect/ObjectSelect.js.map +1 -0
  173. package/lib/components/ObjectSelect/ObjectSummary.d.ts +22 -0
  174. package/lib/components/ObjectSelect/ObjectSummary.d.ts.map +1 -0
  175. package/lib/components/ObjectSelect/ObjectSummary.js +50 -0
  176. package/lib/components/ObjectSelect/ObjectSummary.js.map +1 -0
  177. package/lib/components/ObjectSelect/index.d.ts +3 -0
  178. package/lib/components/ObjectSelect/index.d.ts.map +1 -0
  179. package/lib/components/ObjectSelect/index.js +2 -0
  180. package/lib/components/ObjectSelect/index.js.map +1 -0
  181. package/lib/components/PageTemplates/GalleryPage.js +4 -4
  182. package/lib/components/PageTemplates/GalleryPage.js.map +1 -1
  183. package/lib/components/PageTemplates/PageTemplates.d.ts +3 -3
  184. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  185. package/lib/components/PageTemplates/PageTemplates.js +29 -47
  186. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  187. package/lib/components/SummaryCard/SummaryCard.d.ts +2 -3
  188. package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -1
  189. package/lib/components/SummaryCard/SummaryCard.js +3 -4
  190. package/lib/components/SummaryCard/SummaryCard.js.map +1 -1
  191. package/lib/components/Workbench/ConfigurationPanel.d.ts.map +1 -1
  192. package/lib/components/Workbench/ConfigurationPanel.js +3 -4
  193. package/lib/components/Workbench/ConfigurationPanel.js.map +1 -1
  194. package/lib/components/Workbench/Toolbar.d.ts +1 -5
  195. package/lib/components/Workbench/Toolbar.d.ts.map +1 -1
  196. package/lib/components/Workbench/Toolbar.js +8 -8
  197. package/lib/components/Workbench/Toolbar.js.map +1 -1
  198. package/lib/components/Workbench/UtilityPanel.js +1 -1
  199. package/lib/components/Workbench/UtilityPanel.js.map +1 -1
  200. package/lib/components/Workbench/Workbench.d.ts.map +1 -1
  201. package/lib/components/Workbench/Workbench.js +2 -3
  202. package/lib/components/Workbench/Workbench.js.map +1 -1
  203. package/lib/components/Workbench/Workbench.styles.d.ts +2 -3
  204. package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -1
  205. package/lib/components/Workbench/Workbench.styles.js +23 -23
  206. package/lib/components/Workbench/Workbench.styles.js.map +1 -1
  207. package/lib/components/Workbench/Workbench.types.d.ts +0 -2
  208. package/lib/components/Workbench/Workbench.types.d.ts.map +1 -1
  209. package/lib/components/Workbench/Workbench.types.js.map +1 -1
  210. package/lib/index.d.ts +7 -1
  211. package/lib/index.d.ts.map +1 -1
  212. package/lib/index.js +7 -1
  213. package/lib/index.js.map +1 -1
  214. package/lib/utils/index.d.ts +2 -0
  215. package/lib/utils/index.d.ts.map +1 -0
  216. package/lib/utils/index.js +2 -0
  217. package/lib/utils/index.js.map +1 -0
  218. package/lib/utils/utils.d.ts +14 -0
  219. package/lib/utils/utils.d.ts.map +1 -0
  220. package/lib/utils/utils.js +13 -0
  221. package/lib/utils/utils.js.map +1 -0
  222. package/package.json +19 -15
  223. package/lib/components/FlowModeller/NodeLibrary.d.ts +0 -13
  224. package/lib/components/FlowModeller/NodeLibrary.d.ts.map +0 -1
  225. package/lib/components/FlowModeller/NodeLibrary.js.map +0 -1
  226. package/lib/components/FlowModeller/Utils/AddNodeUtils.js.map +0 -1
  227. package/lib/components/Visual/Visual.d.ts +0 -17
  228. package/lib/components/Visual/Visual.d.ts.map +0 -1
  229. package/lib/components/Visual/Visual.js +0 -28
  230. package/lib/components/Visual/Visual.js.map +0 -1
  231. package/lib/components/Visual/index.d.ts +0 -3
  232. package/lib/components/Visual/index.d.ts.map +0 -1
  233. package/lib/components/Visual/index.js +0 -3
  234. package/lib/components/Visual/index.js.map +0 -1
@@ -3,51 +3,25 @@ import { useState } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { readableColor } from 'polished';
5
5
  import { Flex, defaultThemeProp, Icon, Tooltip, useElement, Status, Actions, useI18n, Avatar, StyledTooltip } from '@pega/cosmos-react-core';
6
- export const StyledStepType = styled.div(({ theme, color, img }) => {
7
- let bgColor = '';
8
- switch (color) {
9
- case 'magenta':
10
- bgColor = '#AC1361';
11
- break;
12
- case 'studio':
13
- bgColor = '#684AAE';
14
- break;
15
- case 'congressBlue':
16
- bgColor = '#0076d1';
17
- break;
18
- case 'Japaneselaurel':
19
- bgColor = '#27813E';
20
- break;
21
- case 'violet':
22
- bgColor = '#8C479F';
23
- break;
24
- case 'yellow':
25
- bgColor = '#f7a801';
26
- break;
27
- case 'darkyellow':
28
- bgColor = '#f7951c';
29
- break;
30
- case 'orange':
31
- bgColor = '#f46c22';
32
- break;
33
- default:
34
- bgColor = '#27813E';
35
- }
6
+ import { colorMap } from '../../utils';
7
+ export const StyledStepType = styled.div(({ visual, theme }) => {
8
+ const bgColor = colorMap[visual.color];
36
9
  const contrastColor = readableColor(bgColor);
37
- return img
10
+ return visual.imgurl
38
11
  ? css `
39
- height: 2rem;
40
- padding-inline-end: calc(0.25 * ${theme.base.spacing});
41
- `
12
+ height: 2rem;
13
+ padding-inline-end: calc(0.25 * ${theme.base.spacing});
14
+ `
42
15
  : css `
43
- background: ${bgColor};
44
- margin: calc(0.5 * ${theme.base.spacing});
45
- padding: 0 calc(0.5 * ${theme.base.spacing});
46
- color: ${contrastColor};
47
- text-align: center;
48
- border-radius: calc(0.25 * ${theme.base['border-radius']});
49
- `;
16
+ background: ${bgColor};
17
+ margin: calc(0.5 * ${theme.base.spacing});
18
+ padding: 0 calc(0.5 * ${theme.base.spacing});
19
+ color: ${contrastColor};
20
+ text-align: center;
21
+ border-radius: calc(0.25 * ${theme.base['border-radius']});
22
+ `;
50
23
  });
24
+ StyledStepType.defaultProps = defaultThemeProp;
51
25
  export const StyledStepBadge = styled.div(({ theme }) => {
52
26
  return css `
53
27
  padding: 0 calc(0.5 * ${theme.base.spacing});
@@ -61,6 +35,7 @@ export const StyledStepBadge = styled.div(({ theme }) => {
61
35
  }
62
36
  `;
63
37
  });
38
+ StyledStepBadge.defaultProps = defaultThemeProp;
64
39
  const StyledStepValue = styled.div(({ theme, error }) => {
65
40
  return css `
66
41
  border-radius: calc(0.5 * ${theme.base['border-radius']});
@@ -70,6 +45,7 @@ const StyledStepValue = styled.div(({ theme, error }) => {
70
45
  `}
71
46
  `;
72
47
  });
48
+ StyledStepValue.defaultProps = defaultThemeProp;
73
49
  export const StyledStepValueInput = styled.input(({ error, theme }) => {
74
50
  return css `
75
51
  height: ${theme.components.input.height};
@@ -105,6 +81,7 @@ export const StyledStepValueInput = styled.input(({ error, theme }) => {
105
81
  `}
106
82
  `;
107
83
  });
84
+ StyledStepValueInput.defaultProps = defaultThemeProp;
108
85
  export const StyledStepStatus = styled.div(({ theme, badge, error }) => {
109
86
  return css `
110
87
  border: none;
@@ -126,6 +103,7 @@ export const StyledStepStatus = styled.div(({ theme, badge, error }) => {
126
103
  `}
127
104
  `;
128
105
  });
106
+ StyledStepStatus.defaultProps = defaultThemeProp;
129
107
  export const StyledStep = styled.div(({ theme, error }) => {
130
108
  return css `
131
109
  background: ${theme.base.palette['secondary-background']};
@@ -178,7 +156,7 @@ export const StyledStep = styled.div(({ theme, error }) => {
178
156
  `;
179
157
  });
180
158
  StyledStep.defaultProps = defaultThemeProp;
181
- const Step = ({ value, id, visual, actions, badge, error, onChange, categoryItem, item, stageItem, taskItem, onFocus, ...restProps }) => {
159
+ const Step = ({ value, id, visual, actions, badge, error, onChange, categoryItem, item, stageItem, taskItem, onFocus, onBlur, ...restProps }) => {
182
160
  const t = useI18n();
183
161
  const [stepValue, setStepValue] = useState(value);
184
162
  const [iconEl, setIconEl] = useElement();
@@ -235,7 +213,17 @@ const Step = ({ value, id, visual, actions, badge, error, onChange, categoryItem
235
213
  };
236
214
  onFocus?.(actionParam, e);
237
215
  };
238
- return (_jsxs(Flex, { as: StyledStep, container: { inline: true }, error: error, children: [_jsxs(Flex, { as: StyledStepType, color: visual.color, ref: setIconEl, img: visual.imgurl, children: [visual.imgurl.length > 0 && (_jsx(Avatar, { name: visual.title || '', imageSrc: visual?.imgurl, shape: 'squircle', size: 'm' }, void 0)), !visual.imgurl && _jsx(Icon, { name: visual.icon }, void 0)] }, void 0), _jsx(Tooltip, { target: iconEl, children: visual.title }, void 0), _jsxs(Flex, { as: StyledStepValue, item: { grow: 2 }, error: error, container: { inline: true, alignItems: 'center' }, children: [_jsx(StyledStepValueInput, { value: stepValue, type: 'text', ref: setInputEl, error: error, onChange: onInputChange, "aria-label": stepValue, id: item.id, ...restProps, onFocus: onInputFocus }, void 0), badge?.type && (_jsx(Flex, { as: StyledStepBadge, container: { inline: true, alignItems: 'center' }, children: _jsx(Status, { variant: badge?.type || 'success', children: badge?.label }, void 0) }, void 0))] }, void 0), _jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || tooltipValue || 'test' }, void 0), _jsx(Flex, { as: StyledStepStatus, ref: setActionEl, badge: badge?.type, error: error, children: actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }, void 0) }, void 0), _jsx(Tooltip, { target: actionEl, "aria-hidden": 'true', children: actions && actions?.length > 1 ? actionsLabel : singleActionLabel }, void 0)] }, void 0));
216
+ const onInputBlur = (e) => {
217
+ const actionParam = {
218
+ value: e.target.value,
219
+ step: item,
220
+ task: taskItem,
221
+ category: categoryItem,
222
+ stage: stageItem
223
+ };
224
+ onBlur?.(actionParam, e);
225
+ };
226
+ return (_jsxs(Flex, { as: StyledStep, container: { inline: true }, error: error, id: id, children: [_jsxs(Flex, { as: StyledStepType, visual: visual, ref: setIconEl, children: [visual.imgurl.length > 0 && (_jsx(Avatar, { name: visual.title || '', imageSrc: visual?.imgurl, shape: 'squircle', size: 'm' })), !visual.imgurl && _jsx(Icon, { name: visual.icon })] }), _jsx(Tooltip, { target: iconEl, children: visual.title }), _jsxs(Flex, { as: StyledStepValue, item: { grow: 2 }, error: error, container: { inline: true, alignItems: 'center' }, children: [_jsx(StyledStepValueInput, { value: stepValue, type: 'text', ref: setInputEl, error: error, onChange: onInputChange, "aria-label": stepValue, ...restProps, onFocus: onInputFocus, onBlur: onInputBlur }), badge?.type && (_jsx(Flex, { as: StyledStepBadge, container: { inline: true, alignItems: 'center' }, children: _jsx(Status, { variant: badge?.type || 'success', children: badge?.label }) }))] }), _jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || tooltipValue || 'test' }), _jsx(Flex, { as: StyledStepStatus, ref: setActionEl, badge: badge?.type, error: error, children: actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }) }), _jsx(Tooltip, { target: actionEl, "aria-hidden": 'true', children: actions && actions?.length > 1 ? actionsLabel : singleActionLabel })] }));
239
227
  };
240
228
  export default Step;
241
229
  //# sourceMappingURL=Step.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Step.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAMT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,IAAI,EACJ,gBAAgB,EAGhB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,MAAM,EAEN,OAAO,EACP,OAAO,EACP,MAAM,EACN,aAAa,EAEd,MAAM,yBAAyB,CAAC;AAqDjC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CACtC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;IACxB,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,QAAQ,KAAK,EAAE;QACb,KAAK,SAAS;YACZ,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM;QACR,KAAK,QAAQ;YACX,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM;QACR,KAAK,cAAc;YACjB,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM;QACR,KAAK,gBAAgB;YACnB,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM;QACR,KAAK,QAAQ;YACX,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM;QACR,KAAK,QAAQ;YACX,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM;QACR,KAAK,YAAY;YACf,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM;QACR,KAAK,QAAQ;Y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ACrB,EAAE,EAAE,IAAI,CAAC,EAAE,KACP,SAAS,EACb,OAAO,EAAE,YAAY,WACrB,EACD,KAAK,EAAE,IAAI,IAAI,CACd,KAAC,IAAI,IAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAC1E,KAAC,MAAM,IAAC,OAAO,EAAE,KAAK,EAAE,IAAI,IAAI,SAAS,YAAG,KAAK,EAAE,KAAK,WAAU,WAC7D,CACR,YACI,EACP,KAAC,OAAO,IAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,YACvC,KAAK,IAAI,YAAY,IAAI,MAAM,WACxB,EACV,KAAC,IAAI,IAAC,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,YAC3E,YAAY,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,iBAAG,WAChE,EACP,KAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,iBAAc,MAAM,YAC1C,OAAO,IAAI,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,WAC1D,YACL,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithoutRef,\n ChangeEvent,\n FocusEvent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Icon,\n Tooltip,\n useElement,\n Status,\n FormControlProps,\n Actions,\n useI18n,\n Avatar,\n StyledTooltip,\n Action\n} from '@pega/cosmos-react-core';\n\nimport {\n TaskItemProps,\n StepItemProps,\n StageItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Input Change */\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n}\n\ninterface StepComponentProps extends BaseProps, StepProps {\n /** Pass text for the step. */\n value?: string;\n /** step data id */\n id?: string;\n /** Determines the visual for icon, color and label to render.\n * This color is passed as a variant and accessible colors are used to display.\n * Icon and label are passed as normal string */\n visual: {\n imgurl: string;\n color:\n | 'magenta'\n | 'studio'\n | 'congressBlue'\n | 'Japaneselaurel'\n | 'violet'\n | 'yellow'\n | 'orange'\n | 'darkyellow';\n icon: string;\n title: string;\n };\n /* Determines the variant and label for the badges */\n badge?: StepItemProps['status'];\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /* Data of the steps which can be used to send the full info back */\n item: StepItemProps;\n stageItem: StageItemProps;\n taskItem: TaskItemProps;\n categoryItem: CategoryItemProps;\n}\n\nexport const StyledStepType = styled.div<{ color: string; ref: HTMLDivElement; img: string }>(\n ({ theme, color, img }) => {\n let bgColor = '';\n switch (color) {\n case 'magenta':\n bgColor = '#AC1361';\n break;\n case 'studio':\n bgColor = '#684AAE';\n break;\n case 'congressBlue':\n bgColor = '#0076d1';\n break;\n case 'Japaneselaurel':\n bgColor = '#27813E';\n break;\n case 'violet':\n bgColor = '#8C479F';\n break;\n case 'yellow':\n bgColor = '#f7a801';\n break;\n case 'darkyellow':\n bgColor = '#f7951c';\n break;\n case 'orange':\n bgColor = '#f46c22';\n break;\n\n default:\n bgColor = '#27813E';\n }\n\n const contrastColor = readableColor(bgColor);\n return img\n ? css`\n height: 2rem;\n padding-inline-end: calc(0.25 * ${theme.base.spacing});\n `\n : css`\n background: ${bgColor};\n margin: calc(0.5 * ${theme.base.spacing});\n padding: 0 calc(0.5 * ${theme.base.spacing});\n color: ${contrastColor};\n text-align: center;\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n `;\n }\n);\n\nexport const StyledStepBadge = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n justify-content: flex-end;\n width: auto;\n max-width: calc(50% - ${theme.base.spacing});\n > span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n `;\n});\n\nconst StyledStepValue = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n ${error &&\n css`\n background: ${theme.base.colors.red['extra-light']};\n `}\n `;\n});\n\nexport const StyledStepValueInput = styled.input<{ error: string | undefined }>(\n ({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n border: none;\n border-inline-start: 0.0625rem solid transparent;\n border-inline-end: 0.0625rem solid transparent;\n text-overflow: ellipsis;\n min-width: 40%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n &:focus:enabled {\n border-color: ${theme.base.colors.red.medium};\n }\n `\n : css`\n background: ${theme.base.palette['secondary-background']};\n &&:hover {\n background: ${theme.base.palette['app-background']};\n }\n &&:focus:enabled {\n background: ${theme.base.palette['primary-background']};\n border-color: ${theme.base.colors.blue.medium};\n }\n `}\n `;\n }\n);\n\nexport const StyledStepStatus = styled.div<{\n badge: string;\n error: string;\n}>(({ theme, badge, error }) => {\n return css`\n border: none;\n ${badge &&\n css`\n display: none;\n `}\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n &:focus:not([disabled]) {\n outline: 0.0625rem solid ${theme.base.colors.blue.medium};\n }\n ${error &&\n !badge &&\n css`\n visibility: visible;\n `}\n `;\n});\n\nexport const StyledStep = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n width: 100%;\n ${error &&\n css`\n border-color: ${theme.base.colors.red.medium};\n box-shadow: none;\n `}\n &:hover {\n cursor: pointer;\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n visibility: visible;\n display: inline-block;\n `}\n }\n }\n &:focus-within {\n ${!error &&\n css`\n border-color: ${theme.base.colors.blue.medium};\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n `}\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n display: inline-block;\n visibility: visible;\n `}\n }\n ${StyledTooltip} {\n ${css`\n visibility: hidden;\n `}\n }\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nconst Step: FunctionComponent<StepComponentProps & ForwardProps> = ({\n value,\n id,\n visual,\n actions,\n badge,\n error,\n onChange,\n categoryItem,\n item,\n stageItem,\n taskItem,\n onFocus,\n ...restProps\n}: PropsWithoutRef<StepComponentProps>) => {\n const t = useI18n();\n const [stepValue, setStepValue] = useState(value);\n const [iconEl, setIconEl] = useElement();\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) ?? '';\n const tooltipValue = stepValue || error;\n\n /* Need to check the value with statusProps */\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: taskItem,\n stage: stageItem,\n step: item,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setStepValue(e.target.value);\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onChange?.(actionParam, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onFocus?.(actionParam, e);\n };\n\n return (\n <Flex as={StyledStep} container={{ inline: true }} error={error}>\n <Flex as={StyledStepType} color={visual.color} ref={setIconEl} img={visual.imgurl}>\n {visual.imgurl.length > 0 && (\n <Avatar name={visual.title || ''} imageSrc={visual?.imgurl} shape='squircle' size='m' />\n )}\n {!visual.imgurl && <Icon name={visual.icon} />}\n </Flex>\n\n <Tooltip target={iconEl}>{visual.title}</Tooltip>\n\n <Flex\n as={StyledStepValue}\n item={{ grow: 2 }}\n error={error}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledStepValueInput\n value={stepValue}\n type='text'\n ref={setInputEl}\n error={error}\n onChange={onInputChange}\n aria-label={stepValue}\n id={item.id}\n {...restProps}\n onFocus={onInputFocus}\n />\n {badge?.type && (\n <Flex as={StyledStepBadge} container={{ inline: true, alignItems: 'center' }}>\n <Status variant={badge?.type || 'success'}>{badge?.label}</Status>\n </Flex>\n )}\n </Flex>\n <Tooltip target={inputEl} hideDelay='none'>\n {error || tooltipValue || 'test'}\n </Tooltip>\n <Flex as={StyledStepStatus} ref={setActionEl} badge={badge?.type} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n </Flex>\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n );\n};\n\nexport default Step;\n"]}
1
+ {"version":3,"file":"Step.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAMT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,IAAI,EACJ,gBAAgB,EAGhB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,MAAM,EAEN,OAAO,EACP,OAAO,EACP,MAAM,EACN,aAAa,EAEd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;AA+ClD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAqB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IACjF,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEvC,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,MAAM;QAClB,CAAC,CAAC,GAAG,CAAA;;0CAEiC,KAAK,CAAC,IAAI,CAAC,OAAO;OACrD;QACH,CAAC,CAAC,GAAG,CAAA;sBACa,OAAO;6BACA,KAAK,CAAC,IAAI,CAAC,OAAO;gCACf,KAAK,CAAC,IAAI,CAAC,OAAO;iBACjC,aAAa;;qCAEO,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;OACzD,CAAC;AACR,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACtD,OAAO,GAAG,CAAA;4BACgB,KAAK,CAA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ACd,KAAC,IAAI,IAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAC1E,KAAC,MAAM,IAAC,OAAO,EAAE,KAAK,EAAE,IAAI,IAAI,SAAS,YAAG,KAAK,EAAE,KAAK,GAAU,GAC7D,CACR,IACI,EACP,KAAC,OAAO,IAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,YACvC,KAAK,IAAI,YAAY,IAAI,MAAM,GACxB,EACV,KAAC,IAAI,IAAC,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,YAC3E,YAAY,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,SAAG,GAChE,EACP,KAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,iBAAc,MAAM,YAC1C,OAAO,IAAI,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,GAC1D,IACL,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithoutRef,\n ChangeEvent,\n FocusEvent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Icon,\n Tooltip,\n useElement,\n Status,\n FormControlProps,\n Actions,\n useI18n,\n Avatar,\n StyledTooltip,\n Action\n} from '@pega/cosmos-react-core';\n\nimport { colorMap, ColorName } from '../../utils';\n\nimport {\n TaskItemProps,\n StepItemProps,\n StageItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Input Change */\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n /** callback for Blur of input */\n onBlur?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n}\n\ninterface StepComponentProps extends BaseProps, StepProps {\n /** Pass text for the step. */\n value?: string;\n /** step data id */\n id?: string;\n /** Determines the visual for icon, color and label to render.\n * This color is passed as a variant and accessible colors are used to display.\n * Icon and label are passed as normal string */\n visual: {\n imgurl: string;\n color: ColorName;\n icon: string;\n title: string;\n };\n /* Determines the variant and label for the badges */\n badge?: StepItemProps['status'];\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /* Data of the steps which can be used to send the full info back */\n item: StepItemProps;\n stageItem: StageItemProps;\n taskItem: TaskItemProps;\n categoryItem: CategoryItemProps;\n}\n\nexport const StyledStepType = styled.div<StepComponentProps>(({ visual, theme }) => {\n const bgColor = colorMap[visual.color];\n\n const contrastColor = readableColor(bgColor);\n return visual.imgurl\n ? css`\n height: 2rem;\n padding-inline-end: calc(0.25 * ${theme.base.spacing});\n `\n : css`\n background: ${bgColor};\n margin: calc(0.5 * ${theme.base.spacing});\n padding: 0 calc(0.5 * ${theme.base.spacing});\n color: ${contrastColor};\n text-align: center;\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n `;\n});\n\nStyledStepType.defaultProps = defaultThemeProp;\n\nexport const StyledStepBadge = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n justify-content: flex-end;\n width: auto;\n max-width: calc(50% - ${theme.base.spacing});\n > span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n `;\n});\n\nStyledStepBadge.defaultProps = defaultThemeProp;\n\nconst StyledStepValue = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n ${error &&\n css`\n background: ${theme.base.colors.red['extra-light']};\n `}\n `;\n});\n\nStyledStepValue.defaultProps = defaultThemeProp;\n\nexport const StyledStepValueInput = styled.input<{ error: string | undefined }>(\n ({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n border: none;\n border-inline-start: 0.0625rem solid transparent;\n border-inline-end: 0.0625rem solid transparent;\n text-overflow: ellipsis;\n min-width: 40%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n &:focus:enabled {\n border-color: ${theme.base.colors.red.medium};\n }\n `\n : css`\n background: ${theme.base.palette['secondary-background']};\n &&:hover {\n background: ${theme.base.palette['app-background']};\n }\n &&:focus:enabled {\n background: ${theme.base.palette['primary-background']};\n border-color: ${theme.base.colors.blue.medium};\n }\n `}\n `;\n }\n);\n\nStyledStepValueInput.defaultProps = defaultThemeProp;\n\nexport const StyledStepStatus = styled.div<{\n badge: string;\n error: string;\n}>(({ theme, badge, error }) => {\n return css`\n border: none;\n ${badge &&\n css`\n display: none;\n `}\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n &:focus:not([disabled]) {\n outline: 0.0625rem solid ${theme.base.colors.blue.medium};\n }\n ${error &&\n !badge &&\n css`\n visibility: visible;\n `}\n `;\n});\n\nStyledStepStatus.defaultProps = defaultThemeProp;\n\nexport const StyledStep = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n width: 100%;\n ${error &&\n css`\n border-color: ${theme.base.colors.red.medium};\n box-shadow: none;\n `}\n &:hover {\n cursor: pointer;\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n visibility: visible;\n display: inline-block;\n `}\n }\n }\n &:focus-within {\n ${!error &&\n css`\n border-color: ${theme.base.colors.blue.medium};\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n `}\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n display: inline-block;\n visibility: visible;\n `}\n }\n ${StyledTooltip} {\n ${css`\n visibility: hidden;\n `}\n }\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nconst Step: FunctionComponent<StepComponentProps & ForwardProps> = ({\n value,\n id,\n visual,\n actions,\n badge,\n error,\n onChange,\n categoryItem,\n item,\n stageItem,\n taskItem,\n onFocus,\n onBlur,\n ...restProps\n}: PropsWithoutRef<StepComponentProps>) => {\n const t = useI18n();\n const [stepValue, setStepValue] = useState(value);\n const [iconEl, setIconEl] = useElement();\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) ?? '';\n const tooltipValue = stepValue || error;\n\n /* Need to check the value with statusProps */\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: taskItem,\n stage: stageItem,\n step: item,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setStepValue(e.target.value);\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onChange?.(actionParam, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onFocus?.(actionParam, e);\n };\n\n const onInputBlur = (e: FocusEvent<HTMLInputElement>) => {\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onBlur?.(actionParam, e);\n };\n\n return (\n <Flex as={StyledStep} container={{ inline: true }} error={error} id={id}>\n <Flex as={StyledStepType} visual={visual} ref={setIconEl}>\n {visual.imgurl.length > 0 && (\n <Avatar name={visual.title || ''} imageSrc={visual?.imgurl} shape='squircle' size='m' />\n )}\n {!visual.imgurl && <Icon name={visual.icon} />}\n </Flex>\n\n <Tooltip target={iconEl}>{visual.title}</Tooltip>\n\n <Flex\n as={StyledStepValue}\n item={{ grow: 2 }}\n error={error}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledStepValueInput\n value={stepValue}\n type='text'\n ref={setInputEl}\n error={error}\n onChange={onInputChange}\n aria-label={stepValue}\n {...restProps}\n onFocus={onInputFocus}\n onBlur={onInputBlur}\n />\n {badge?.type && (\n <Flex as={StyledStepBadge} container={{ inline: true, alignItems: 'center' }}>\n <Status variant={badge?.type || 'success'}>{badge?.label}</Status>\n </Flex>\n )}\n </Flex>\n <Tooltip target={inputEl} hideDelay='none'>\n {error || tooltipValue || 'test'}\n </Tooltip>\n <Flex as={StyledStepStatus} ref={setActionEl} badge={badge?.type} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n </Flex>\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n );\n};\n\nexport default Step;\n"]}
@@ -1,5 +1,6 @@
1
1
  import { FunctionComponent, ChangeEvent, FocusEvent } from 'react';
2
2
  import { BaseProps, ForwardProps, FormControlProps } from '@pega/cosmos-react-core';
3
+ import { LibraryItem } from '../ItemLibrary';
3
4
  import { StepProps } from './Step';
4
5
  import { TaskItemProps, StageItemProps, CategoryItemProps, LifeCycleAction, LifeCycleActionParam } from './LifeCycle.types';
5
6
  export interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {
@@ -13,10 +14,14 @@ export interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {
13
14
  showOnce: boolean;
14
15
  onAddTask?: LifeCycleAction['onClick'];
15
16
  };
16
- onAddStep?: LifeCycleAction['onClick'];
17
+ onAddStep?: (param: LifeCycleActionParam, selectedItem: LibraryItem) => void;
17
18
  onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;
18
19
  /** callback for Focus of input */
19
20
  onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;
21
+ /** callback for Blur of input */
22
+ onBlur?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;
23
+ /** Types of Nodes */
24
+ nodeLibrary: LibraryItem[];
20
25
  }
21
26
  interface TaskComponentProps extends BaseProps, TaskProps {
22
27
  /** Pass text for the task. */
@@ -1 +1 @@
1
- {"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,WAAW,EACX,UAAU,EAEX,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,SAAS,EACT,YAAY,EAOZ,gBAAgB,EAIjB,MAAM,yBAAyB,CAAC;AAEjC,OAAa,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EACL,aAAa,EACb,cAAc,EAEd,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,gBAAgB,EAAE,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'react';
2
+ import { useState, useCallback } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import { Flex, defaultThemeProp, Button, Icon, Tooltip, useElement, Actions, useI18n, Avatar, StyledTooltip } from '@pega/cosmos-react-core';
4
+ import { Flex, defaultThemeProp, Button, Icon, Tooltip, useElement, Actions, useI18n, Avatar, StyledTooltip, useOuterEvent, useEscape } from '@pega/cosmos-react-core';
5
+ import { ItemLibrary } from '../ItemLibrary';
5
6
  import Step from './Step';
6
7
  export const StyledTaskList = styled.li(({ theme }) => {
7
8
  return css `
@@ -12,6 +13,7 @@ export const StyledTaskList = styled.li(({ theme }) => {
12
13
  }
13
14
  `;
14
15
  });
16
+ StyledTaskList.defaultProps = defaultThemeProp;
15
17
  export const StyledCardHeader = styled.header(({ theme }) => {
16
18
  return css `
17
19
  padding: 0;
@@ -24,7 +26,6 @@ export const StyledCardContent = styled.div(() => {
24
26
  padding: 0;
25
27
  `;
26
28
  });
27
- StyledCardContent.defaultProps = defaultThemeProp;
28
29
  export const StyledInput = styled.input(({ error, theme }) => {
29
30
  return css `
30
31
  height: ${theme.components.input.height};
@@ -78,7 +79,6 @@ export const StyledTaskActions = styled.div(({ error }) => {
78
79
  }
79
80
  `;
80
81
  });
81
- StyledTaskActions.defaultProps = defaultThemeProp;
82
82
  export const StyledTask = styled.article(({ theme }) => {
83
83
  return css `
84
84
  background: ${theme.base.palette['primary-background']};
@@ -110,9 +110,11 @@ export const StyledInputWrapper = styled.div `
110
110
  }
111
111
  }
112
112
  `;
113
- const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem, error, onAddStep, onChange, onFocus, categoryItem, id, step: stepProp, ...restProps }) => {
113
+ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem, error, onAddStep, onChange, onFocus, onBlur, categoryItem, id, step: stepProp, nodeLibrary, ...restProps }) => {
114
114
  const t = useI18n();
115
115
  const [taskValue, setTaskValue] = useState(value);
116
+ const [showLibrary, setLibrary] = useState(false);
117
+ const [popoverEl, setPopoverEl] = useElement(null);
116
118
  const [actionEl, setActionEl] = useElement();
117
119
  const [inputEl, setInputEl] = useElement();
118
120
  const [addEl, setAddEl] = useElement();
@@ -146,7 +148,7 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
146
148
  const onInputChange = (e) => {
147
149
  setTaskValue(e.target.value);
148
150
  const param = {
149
- value: taskValue,
151
+ value: e.target.value,
150
152
  task: item,
151
153
  stage: stageItem,
152
154
  category: categoryItem
@@ -162,15 +164,29 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
162
164
  };
163
165
  onFocus?.(param, e);
164
166
  };
165
- const onAddStepClick = (e) => {
167
+ const onInputBlur = (e) => {
166
168
  const param = {
169
+ value: taskValue,
167
170
  task: item,
168
171
  stage: stageItem,
169
172
  category: categoryItem
170
173
  };
171
- onAddStep?.(param, e);
174
+ onBlur?.(param, e);
172
175
  };
173
- return (_jsx(Flex, { as: StyledTaskList, ...restProps, children: _jsxs(Flex, { as: StyledTask, container: { direction: 'column' }, role: 'region', children: [_jsxs(Flex, { as: StyledCardHeader, container: { itemGap: 0.4 }, children: [visual?.imgurl.length > 0 && _jsx(Avatar, { name: taskValue || '', imageSrc: visual?.imgurl }, void 0), _jsxs(Flex, { item: { grow: 1 }, as: StyledInputWrapper, container: { inline: true, alignItems: 'center' }, children: [_jsx(StyledInput, { value: taskValue, type: 'text', onChange: onInputChange, ref: setInputEl, error: error, id: item.id, "aria-labelledby": categoryItem.categoryId, onFocus: onInputFocus }, void 0), taskValue && (_jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || taskValue }, void 0))] }, void 0), _jsxs(Flex, { as: StyledTaskActions, ref: setActionEl, error: error, children: [actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }, void 0), _jsx(Tooltip, { target: actionEl, "aria-hidden": 'true', children: actions && actions?.length > 1 ? actionsLabel : singleActionLabel }, void 0)] }, void 0)] }, void 0), _jsxs(Flex, { as: StyledCardContent, children: [item?.steps.map((steps) => {
176
+ const onLibraryItemSelect = useCallback((libItem) => {
177
+ const param = {
178
+ task: item,
179
+ stage: stageItem,
180
+ category: categoryItem
181
+ };
182
+ onAddStep?.(param, libItem);
183
+ setLibrary(false);
184
+ }, [onAddStep]);
185
+ useEscape(() => {
186
+ setLibrary(false);
187
+ });
188
+ useOuterEvent('mousedown', [addEl, popoverEl], () => setLibrary(false));
189
+ return (_jsx(Flex, { as: StyledTaskList, id: item.id, ...restProps, children: _jsxs(Flex, { as: StyledTask, container: { direction: 'column' }, role: 'region', children: [_jsxs(Flex, { as: StyledCardHeader, container: { itemGap: 0.4 }, children: [visual?.imgurl.length > 0 && _jsx(Avatar, { name: taskValue || '', imageSrc: visual?.imgurl }), _jsxs(Flex, { item: { grow: 1 }, as: StyledInputWrapper, container: { inline: true, alignItems: 'center' }, children: [_jsx(StyledInput, { value: taskValue, type: 'text', onChange: onInputChange, ref: setInputEl, error: error, "aria-labelledby": categoryItem.categoryId, onFocus: onInputFocus, onBlur: onInputBlur }), taskValue && (_jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || taskValue }))] }), _jsxs(Flex, { as: StyledTaskActions, ref: setActionEl, error: error, children: [actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }), _jsx(Tooltip, { target: actionEl, "aria-hidden": 'true', children: actions && actions?.length > 1 ? actionsLabel : singleActionLabel })] })] }), _jsxs(Flex, { as: StyledCardContent, children: [item?.steps.map((steps) => {
174
190
  const badgeStatus = steps?.status?.type ? steps.status.type : '';
175
191
  const badgeLabel = steps?.status?.label ? steps.status.label : '';
176
192
  return (_jsx(Step, { id: steps.id, value: steps.label, visual: {
@@ -182,7 +198,7 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
182
198
  type: badgeStatus,
183
199
  label: badgeLabel
184
200
  }, error: steps.error, categoryItem: categoryItem, ...stepProp }, steps.id));
185
- }), _jsxs(Flex, { children: [_jsx(Button, { variant: 'simple', label: addStepTitle, onClick: onAddStepClick, ref: setAddEl, icon: true, "aria-label": `${t('add')} ${addStepTitle}`, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0), _jsx(Tooltip, { target: addEl, "aria-hidden": 'true', children: `${t('add')} ${addStepTitle}` }, void 0)] }, void 0)] }, void 0)] }, void 0) }, void 0));
201
+ }), _jsxs(Flex, { children: [_jsx(Button, { variant: 'simple', label: addStepTitle, onClick: () => setLibrary(!showLibrary), ref: setAddEl, icon: true, "aria-label": `${t('add')} ${addStepTitle}`, children: _jsx(Icon, { name: 'plus' }) }), _jsx(Tooltip, { target: addEl, "aria-hidden": 'true', children: `${t('add')} ${addStepTitle}` }), _jsx(ItemLibrary, { items: nodeLibrary, show: showLibrary, target: addEl, onClick: onLibraryItemSelect, ref: setPopoverEl, placeholder: t('search_nodes') })] })] })] }) }));
186
202
  };
187
203
  export default Task;
188
204
  //# sourceMappingURL=Task.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAMT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,gBAAgB,EAGhB,MAAM,EACN,IAAI,EAEJ,OAAO,EACP,UAAU,EACV,OAAO,EAEP,OAAO,EACP,MAAM,EACN,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,IAAmB,MAAM,QAAQ,CAAC;AA+CzC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,OAAO,GAAG,CAAA;;wBAEY,KAAK,CAAC,IAAI,CAAC,OAAO;;;;GAIvC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,C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,CAAC,KAAK,EAClB,MAAM,EAAE;oCACN,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;oCAC3B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;oCACzB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;oCACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;iCAC1B,EACD,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,IAAI,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE;oCACL,IAAI,EAAE,WAAW;oCACjB,KAAK,EAAE,UAAU;iCAClB,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,YAAY,EAAE,YAAY,KACtB,QAAQ,IAlBP,KAAK,CAAC,EAAE,CAmBb,CACH,CAAC;wBACJ,CAAC,CAAC,EACF,MAAC,IAAI,eACH,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,cAAc,EACvB,GAAG,EAAE,QAAQ,EACb,IAAI,sBACQ,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,YAEzC,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,WAAG,WACb,EACT,KAAC,OAAO,IAAC,MAAM,EAAE,KAAK,iBAAc,MAAM,YACvC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,WACtB,YACL,YACF,YACF,WACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithChildren,\n ChangeEvent,\n FocusEvent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Button,\n Icon,\n Action,\n Tooltip,\n useElement,\n Actions,\n FormControlProps,\n useI18n,\n Avatar,\n StyledTooltip\n} from '@pega/cosmos-react-core';\n\nimport Step, { StepProps } from './Step';\nimport {\n TaskItemProps,\n StageItemProps,\n StepItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Tooltip for adding items to the task component */\n addStepTitle: string;\n /** Region for adding the task component */\n addTask: {\n title: string;\n showOnce: boolean;\n onAddTask?: LifeCycleAction['onClick'];\n };\n onAddStep?: LifeCycleAction['onClick'];\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n}\n\ninterface TaskComponentProps extends BaseProps, TaskProps {\n /** Pass text for the task. */\n value?: string;\n /** support for an Avatar, Icon, or other supporting visual. */\n visual: {\n imgurl: string;\n };\n /** Pass task data */\n item: TaskItemProps;\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /** Step Props */\n step?: StepProps;\n /** Stage data to pass it as callback */\n stageItem: StageItemProps;\n /** Category data to pass it as callback */\n categoryItem: CategoryItemProps;\n id: string;\n}\n\nexport const StyledTaskList = styled.li(({ theme }) => {\n return css`\n list-style-type: none;\n margin-block-end: ${theme.base.spacing};\n &:last-child > article {\n margin-block-end: 0;\n }\n `;\n});\n\nexport const StyledCardHeader = styled.header(({ theme }) => {\n return css`\n padding: 0;\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n `;\n});\nStyledCardHeader.defaultProps = defaultThemeProp;\n\nexport const StyledCardContent = styled.div(() => {\n return css`\n padding: 0;\n `;\n});\nStyledCardContent.defaultProps = defaultThemeProp;\n\nexport const StyledInput = styled.input<{ error: string | undefined }>(({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n text-overflow: ellipsis;\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n width: 100%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n border: 0.0625rem solid ${theme.base.colors.red.medium};\n `\n : css`\n background: ${theme.base.palette['primary-background']};\n &&:hover {\n background: ${theme.base.palette['secondary-background']};\n }\n &&:focus:enabled {\n border: 0.0625rem solid ${theme.base.colors.blue.medium};\n background: ${theme.base.palette['primary-background']};\n }\n `}\n `;\n});\nStyledInput.defaultProps = defaultThemeProp;\n\nexport const StyledTaskActions = styled.div<{\n ref: HTMLDivElement;\n error: string;\n}>(({ error }) => {\n return css`\n border: none;\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n ${error &&\n css`\n visibility: visible;\n `}\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n `;\n});\nStyledTaskActions.defaultProps = defaultThemeProp;\n\nexport const StyledTask = styled.article(({ theme }) => {\n return css`\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding: ${theme.base.spacing};\n &:focus-within,\n &:hover {\n ${StyledTaskActions} {\n ${css`\n visibility: visible;\n `}\n }\n }\n &:focus-within {\n box-shadow: 0 0 0.2rem 0.0625rem ${theme.base.colors.blue.medium};\n }\n &:hover {\n cursor: pointer;\n }\n `;\n});\nStyledTask.defaultProps = defaultThemeProp;\n\nexport const StyledInputWrapper = styled.div`\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n`;\n\nconst Task: FunctionComponent<TaskComponentProps & ForwardProps> = ({\n value,\n visual,\n actions,\n item,\n addStepTitle,\n addTask,\n stageItem,\n error,\n onAddStep,\n onChange,\n onFocus,\n categoryItem,\n id,\n step: stepProp,\n ...restProps\n}: PropsWithChildren<TaskComponentProps>) => {\n const t = useI18n();\n const [taskValue, setTaskValue] = useState(value);\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const [addEl, setAddEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) || '';\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setTaskValue(e.target.value);\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onChange?.(param, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onFocus?.(param, e);\n };\n\n const onAddStepClick = (e: MouseEvent<HTMLButtonElement>) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onAddStep?.(param, e);\n };\n\n return (\n <Flex as={StyledTaskList} {...restProps}>\n <Flex as={StyledTask} container={{ direction: 'column' }} role='region'>\n <Flex as={StyledCardHeader} container={{ itemGap: 0.4 }}>\n {visual?.imgurl.length > 0 && <Avatar name={taskValue || ''} imageSrc={visual?.imgurl} />}\n <Flex\n item={{ grow: 1 }}\n as={StyledInputWrapper}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledInput\n value={taskValue}\n type='text'\n onChange={onInputChange}\n ref={setInputEl}\n error={error}\n id={item.id}\n aria-labelledby={categoryItem.categoryId}\n onFocus={onInputFocus}\n />\n {taskValue && (\n <Tooltip target={inputEl} hideDelay='none'>\n {error || taskValue}\n </Tooltip>\n )}\n </Flex>\n <Flex as={StyledTaskActions} ref={setActionEl} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n </Flex>\n <Flex as={StyledCardContent}>\n {item?.steps.map((steps: StepItemProps) => {\n const badgeStatus = steps?.status?.type ? steps.status.type : '';\n const badgeLabel = steps?.status?.label ? steps.status.label : '';\n return (\n <Step\n key={steps.id}\n id={steps.id}\n value={steps.label}\n visual={{\n imgurl: steps.visual.imgurl,\n color: steps.visual.color,\n icon: steps.visual.icon,\n title: steps.visual.label\n }}\n item={steps}\n taskItem={item}\n stageItem={stageItem}\n badge={{\n type: badgeStatus,\n label: badgeLabel\n }}\n error={steps.error}\n categoryItem={categoryItem}\n {...stepProp}\n />\n );\n })}\n <Flex>\n <Button\n variant='simple'\n label={addStepTitle}\n onClick={onAddStepClick}\n ref={setAddEl}\n icon\n aria-label={`${t('add')} ${addStepTitle}`}\n >\n <Icon name='plus' />\n </Button>\n <Tooltip target={addEl} aria-hidden='true'>\n {`${t('add')} ${addStepTitle}`}\n </Tooltip>\n </Flex>\n </Flex>\n </Flex>\n </Flex>\n );\n};\n\nexport default Task;\n"]}
1
+ {"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAMR,WAAW,EACZ,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,gBAAgB,EAGhB,MAAM,EACN,IAAI,EAEJ,OAAO,EACP,UAAU,EACV,OAAO,EAEP,OAAO,EACP,MAAM,EACN,aAAa,EACb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,CAAC,MAAM,CAAC,KAAK;oCACzB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;oCACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;iCAC1B,EACD,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,IAAI,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE;oCACL,IAAI,EAAE,WAAW;oCACjB,KAAK,EAAE,UAAU;iCAClB,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,YAAY,EAAE,YAAY,KACtB,QAAQ,IAlBP,KAAK,CAAC,EAAE,CAmBb,CACH,CAAC;wBACJ,CAAC,CAAC,EACF,MAAC,IAAI,eACH,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,EACvC,GAAG,EAAE,QAAQ,EACb,IAAI,sBACQ,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,YAEzC,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,GACb,EACT,KAAC,OAAO,IAAC,MAAM,EAAE,KAAK,iBAAc,MAAM,YACvC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,GACtB,EACV,KAAC,WAAW,IACV,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,KAAoB,EAC5B,OAAO,EAAE,mBAAmB,EAC5B,GAAG,EAAE,YAAY,EACjB,WAAW,EAAE,CAAC,CAAC,cAAc,CAAC,GAC9B,IACG,IACF,IACF,GACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithChildren,\n ChangeEvent,\n FocusEvent,\n MouseEvent,\n useCallback\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Button,\n Icon,\n Action,\n Tooltip,\n useElement,\n Actions,\n FormControlProps,\n useI18n,\n Avatar,\n StyledTooltip,\n useOuterEvent,\n useEscape\n} from '@pega/cosmos-react-core';\n\nimport { LibraryItem, ItemLibrary } from '../ItemLibrary';\n\nimport Step, { StepProps } from './Step';\nimport {\n TaskItemProps,\n StageItemProps,\n StepItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Tooltip for adding items to the task component */\n addStepTitle: string;\n /** Region for adding the task component */\n addTask: {\n title: string;\n showOnce: boolean;\n onAddTask?: LifeCycleAction['onClick'];\n };\n onAddStep?: (param: LifeCycleActionParam, selectedItem: LibraryItem) => void;\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n /** callback for Blur of input */\n onBlur?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n /** Types of Nodes */\n nodeLibrary: LibraryItem[];\n}\n\ninterface TaskComponentProps extends BaseProps, TaskProps {\n /** Pass text for the task. */\n value?: string;\n /** support for an Avatar, Icon, or other supporting visual. */\n visual: {\n imgurl: string;\n };\n /** Pass task data */\n item: TaskItemProps;\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /** Step Props */\n step?: StepProps;\n /** Stage data to pass it as callback */\n stageItem: StageItemProps;\n /** Category data to pass it as callback */\n categoryItem: CategoryItemProps;\n id: string;\n}\n\nexport const StyledTaskList = styled.li(({ theme }) => {\n return css`\n list-style-type: none;\n margin-block-end: ${theme.base.spacing};\n &:last-child > article {\n margin-block-end: 0;\n }\n `;\n});\n\nStyledTaskList.defaultProps = defaultThemeProp;\n\nexport const StyledCardHeader = styled.header(({ theme }) => {\n return css`\n padding: 0;\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledCardHeader.defaultProps = defaultThemeProp;\n\nexport const StyledCardContent = styled.div(() => {\n return css`\n padding: 0;\n `;\n});\n\nexport const StyledInput = styled.input<{ error: string | undefined }>(({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n text-overflow: ellipsis;\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n width: 100%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n border: 0.0625rem solid ${theme.base.colors.red.medium};\n `\n : css`\n background: ${theme.base.palette['primary-background']};\n &&:hover {\n background: ${theme.base.palette['secondary-background']};\n }\n &&:focus:enabled {\n border: 0.0625rem solid ${theme.base.colors.blue.medium};\n background: ${theme.base.palette['primary-background']};\n }\n `}\n `;\n});\n\nStyledInput.defaultProps = defaultThemeProp;\n\nexport const StyledTaskActions = styled.div<{\n ref: HTMLDivElement;\n error: string;\n}>(({ error }) => {\n return css`\n border: none;\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n ${error &&\n css`\n visibility: visible;\n `}\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n `;\n});\n\nexport const StyledTask = styled.article(({ theme }) => {\n return css`\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding: ${theme.base.spacing};\n &:focus-within,\n &:hover {\n ${StyledTaskActions} {\n ${css`\n visibility: visible;\n `}\n }\n }\n &:focus-within {\n box-shadow: 0 0 0.2rem 0.0625rem ${theme.base.colors.blue.medium};\n }\n &:hover {\n cursor: pointer;\n }\n `;\n});\n\nStyledTask.defaultProps = defaultThemeProp;\n\nexport const StyledInputWrapper = styled.div`\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n`;\n\nconst Task: FunctionComponent<TaskComponentProps & ForwardProps> = ({\n value,\n visual,\n actions,\n item,\n addStepTitle,\n addTask,\n stageItem,\n error,\n onAddStep,\n onChange,\n onFocus,\n onBlur,\n categoryItem,\n id,\n step: stepProp,\n nodeLibrary,\n ...restProps\n}: PropsWithChildren<TaskComponentProps>) => {\n const t = useI18n();\n const [taskValue, setTaskValue] = useState(value);\n const [showLibrary, setLibrary] = useState(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const [addEl, setAddEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) || '';\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setTaskValue(e.target.value);\n const param: LifeCycleActionParam = {\n value: e.target.value,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onChange?.(param, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onFocus?.(param, e);\n };\n\n const onInputBlur = (e: FocusEvent<HTMLInputElement>) => {\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onBlur?.(param, e);\n };\n\n const onLibraryItemSelect = useCallback(\n (libItem: LibraryItem) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onAddStep?.(param, libItem);\n setLibrary(false);\n },\n [onAddStep]\n );\n\n useEscape(() => {\n setLibrary(false);\n });\n\n useOuterEvent('mousedown', [addEl, popoverEl], () => setLibrary(false));\n\n return (\n <Flex as={StyledTaskList} id={item.id} {...restProps}>\n <Flex as={StyledTask} container={{ direction: 'column' }} role='region'>\n <Flex as={StyledCardHeader} container={{ itemGap: 0.4 }}>\n {visual?.imgurl.length > 0 && <Avatar name={taskValue || ''} imageSrc={visual?.imgurl} />}\n <Flex\n item={{ grow: 1 }}\n as={StyledInputWrapper}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledInput\n value={taskValue}\n type='text'\n onChange={onInputChange}\n ref={setInputEl}\n error={error}\n aria-labelledby={categoryItem.categoryId}\n onFocus={onInputFocus}\n onBlur={onInputBlur}\n />\n {taskValue && (\n <Tooltip target={inputEl} hideDelay='none'>\n {error || taskValue}\n </Tooltip>\n )}\n </Flex>\n <Flex as={StyledTaskActions} ref={setActionEl} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n </Flex>\n <Flex as={StyledCardContent}>\n {item?.steps.map((steps: StepItemProps) => {\n const badgeStatus = steps?.status?.type ? steps.status.type : '';\n const badgeLabel = steps?.status?.label ? steps.status.label : '';\n return (\n <Step\n key={steps.id}\n id={steps.id}\n value={steps.label}\n visual={{\n imgurl: steps.visual.imgurl,\n color: steps.visual.color,\n icon: steps.visual.icon,\n title: steps.visual.label\n }}\n item={steps}\n taskItem={item}\n stageItem={stageItem}\n badge={{\n type: badgeStatus,\n label: badgeLabel\n }}\n error={steps.error}\n categoryItem={categoryItem}\n {...stepProp}\n />\n );\n })}\n <Flex>\n <Button\n variant='simple'\n label={addStepTitle}\n onClick={() => setLibrary(!showLibrary)}\n ref={setAddEl}\n icon\n aria-label={`${t('add')} ${addStepTitle}`}\n >\n <Icon name='plus' />\n </Button>\n <Tooltip target={addEl} aria-hidden='true'>\n {`${t('add')} ${addStepTitle}`}\n </Tooltip>\n <ItemLibrary\n items={nodeLibrary}\n show={showLibrary}\n target={addEl as HTMLElement}\n onClick={onLibraryItemSelect}\n ref={setPopoverEl}\n placeholder={t('search_nodes')}\n />\n </Flex>\n </Flex>\n </Flex>\n </Flex>\n );\n};\n\nexport default Task;\n"]}
@@ -1,4 +1,3 @@
1
- export { default } from './LifeCycle';
2
- export { LifeCycleProps } from './LifeCycle';
1
+ export { default, LifeCycleProps } from './LifeCycle';
3
2
  export { StepItemProps, TaskItemProps, StageItemProps, CategoryItemProps, CategoriesItemProps, LifeCycleActionParam, LifeCycleAction } from './LifeCycle.types';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { default } from './LifeCycle';\nexport { LifeCycleProps } from './LifeCycle';\nexport {\n StepItemProps,\n TaskItemProps,\n StageItemProps,\n CategoryItemProps,\n CategoriesItemProps,\n LifeCycleActionParam,\n LifeCycleAction\n} from './LifeCycle.types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,aAAa,CAAC","sourcesContent":["export { default, LifeCycleProps } from './LifeCycle';\n\nexport {\n StepItemProps,\n TaskItemProps,\n StageItemProps,\n CategoryItemProps,\n CategoriesItemProps,\n LifeCycleActionParam,\n LifeCycleAction\n} from './LifeCycle.types';\n"]}
@@ -0,0 +1,16 @@
1
+ import { FC, PropsWithoutRef, ReactNode, Ref } from 'react';
2
+ import { Action, ActionsProps, ForwardProps, OmitStrict, DrawerProps } from '@pega/cosmos-react-core';
3
+ import { PageHeaderProps } from '@pega/cosmos-react-build/lib/components/PageTemplates/PageTemplates';
4
+ export interface ObjectPreviewProps extends Pick<DrawerProps, 'onAfterOpen' | 'onAfterClose' | 'onBeforeOpen' | 'onBeforeClose'> {
5
+ open?: boolean;
6
+ header: OmitStrict<PageHeaderProps, 'status'>;
7
+ primaryAction: Action;
8
+ secondaryAction?: Action;
9
+ additionalActions?: ActionsProps;
10
+ content: ReactNode;
11
+ onDismiss: () => void;
12
+ ref?: Ref<HTMLDivElement>;
13
+ }
14
+ declare const ObjectPreview: FC<PropsWithoutRef<ObjectPreviewProps> & ForwardProps>;
15
+ export default ObjectPreview;
16
+ //# sourceMappingURL=ObjectPreview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectPreview.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectPreview/ObjectPreview.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EAEF,eAAe,EACf,SAAS,EACT,GAAG,EAIJ,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,MAAM,EAEN,YAAY,EAGZ,YAAY,EAGZ,UAAU,EAIV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EAGhB,MAAM,qEAAqE,CAAC;AAE7E,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,cAAc,GAAG,cAAc,GAAG,eAAe,CAAC;IAC5F,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,UAAU,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,YAAY,CAAC;IACjC,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AA+CD,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,GAAG,YAAY,CAyCzE,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useRef, useEffect } from 'react';
3
+ import styled from 'styled-components';
4
+ import { Actions, Button, Flex, Icon, OneColumnPage, Drawer, useI18n, useConsolidatedRef } from '@pega/cosmos-react-core';
5
+ import { PageHeader, StyledPage } from '@pega/cosmos-react-build/lib/components/PageTemplates/PageTemplates';
6
+ const StyledObjectPreview = styled(Drawer) `
7
+ height: calc(100vh - 3rem);
8
+ top: 3rem;
9
+ `;
10
+ const PreviewHeader = ({ header, primaryAction, secondaryAction, additionalActions, onDismiss, dismissButtonRef }) => {
11
+ const t = useI18n();
12
+ return (_jsxs(Flex, { container: { direction: 'column', rowGap: 1 }, children: [_jsxs(Flex, { container: { justify: 'between' }, children: [_jsx(Button, { icon: true, variant: 'simple', ref: dismissButtonRef, label: t('dismiss_label_a11y'), onClick: onDismiss, children: _jsx(Icon, { name: 'times' }) }), _jsxs(Flex, { container: true, children: [secondaryAction && (_jsx(Button, { onClick: secondaryAction.onClick, children: secondaryAction.text })), _jsx(Button, { variant: 'primary', onClick: primaryAction.onClick, children: primaryAction.text }), additionalActions && _jsx(Actions, { ...additionalActions })] })] }), _jsx(PageHeader, { ...header, titleTag: 'h2' })] }));
13
+ };
14
+ const ObjectPreview = forwardRef(({ content, header, open, onAfterOpen, onAfterClose, onBeforeOpen, onBeforeClose, ...restprops }, ref) => {
15
+ const contentRef = useConsolidatedRef(ref);
16
+ const dismissButtonRef = useRef(null);
17
+ useEffect(() => {
18
+ if (open && contentRef.current) {
19
+ contentRef.current?.querySelector('button')?.focus();
20
+ }
21
+ }, [open]);
22
+ return (_jsx(StyledObjectPreview, { ref: contentRef, open: !!open, nullWhenClosed: true, position: 'fixed', size: '30%', shadow: true, placement: 'right', onAfterOpen: onAfterOpen, onAfterClose: onAfterClose, onBeforeOpen: onBeforeOpen, onBeforeClose: onBeforeClose, children: _jsx(OneColumnPage, { ref: contentRef, title: header.title, as: StyledPage, header: _jsx(PreviewHeader, { dismissButtonRef: dismissButtonRef, header: header, ...restprops }), scrollContent: true, a: content }) }));
23
+ });
24
+ export default ObjectPreview;
25
+ //# sourceMappingURL=ObjectPreview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectPreview.js","sourceRoot":"","sources":["../../../src/components/ObjectPreview/ObjectPreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,MAAM,EACN,SAAS,EAEV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAEL,OAAO,EAEP,MAAM,EACN,IAAI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IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,EAC/F,GAA8B,EAC9B,EAAE;IACF,MAAM,UAAU,GAAG,kBAAkB,CAAiB,GAAG,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAEzD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,IAAI,UAAU,CAAC,OAAO,EAAE;YAC9B,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;SACtD;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,KAAC,mBAAmB,IAClB,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,CAAC,CAAC,IAAI,EACZ,cAAc,QACd,QAAQ,EAAC,OAAO,EAChB,IAAI,EAAC,KAAK,EACV,MAAM,QACN,SAAS,EAAC,OAAO,EACjB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,YAE5B,KAAC,aAAa,IACZ,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,EAAE,EAAE,UAAU,EACd,MAAM,EACJ,KAAC,aAAa,IAAC,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,KAAM,SAAS,GAAI,EAEtF,aAAa,QACb,CAAC,EAAE,OAAO,GACV,GACkB,CACvB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n FC,\n forwardRef,\n PropsWithoutRef,\n ReactNode,\n Ref,\n useRef,\n useEffect,\n RefObject\n} from 'react';\nimport styled from 'styled-components';\n\nimport {\n Action,\n Actions,\n ActionsProps,\n Button,\n Flex,\n ForwardProps,\n Icon,\n OneColumnPage,\n OmitStrict,\n Drawer,\n useI18n,\n useConsolidatedRef,\n DrawerProps\n} from '@pega/cosmos-react-core';\nimport {\n PageHeaderProps,\n PageHeader,\n StyledPage\n} from '@pega/cosmos-react-build/lib/components/PageTemplates/PageTemplates';\n\nexport interface ObjectPreviewProps\n extends Pick<DrawerProps, 'onAfterOpen' | 'onAfterClose' | 'onBeforeOpen' | 'onBeforeClose'> {\n open?: boolean;\n header: OmitStrict<PageHeaderProps, 'status'>;\n primaryAction: Action;\n secondaryAction?: Action;\n additionalActions?: ActionsProps;\n content: ReactNode;\n onDismiss: () => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledObjectPreview = styled(Drawer)`\n height: calc(100vh - 3rem);\n top: 3rem;\n`;\n\nconst PreviewHeader: FC<\n OmitStrict<ObjectPreviewProps, 'ref' | 'content' | 'open'> & {\n dismissButtonRef: RefObject<HTMLButtonElement>;\n }\n> = ({\n header,\n primaryAction,\n secondaryAction,\n additionalActions,\n onDismiss,\n dismissButtonRef\n}) => {\n const t = useI18n();\n return (\n <Flex container={{ direction: 'column', rowGap: 1 }}>\n <Flex container={{ justify: 'between' }}>\n <Button\n icon\n variant='simple'\n ref={dismissButtonRef}\n label={t('dismiss_label_a11y')}\n onClick={onDismiss}\n >\n <Icon name='times' />\n </Button>\n <Flex container>\n {secondaryAction && (\n <Button onClick={secondaryAction.onClick}>{secondaryAction.text}</Button>\n )}\n <Button variant='primary' onClick={primaryAction.onClick}>\n {primaryAction.text}\n </Button>\n {additionalActions && <Actions {...additionalActions} />}\n </Flex>\n </Flex>\n <PageHeader {...header} titleTag='h2' />\n </Flex>\n );\n};\n\nconst ObjectPreview: FC<PropsWithoutRef<ObjectPreviewProps> & ForwardProps> = forwardRef(\n (\n { content, header, open, onAfterOpen, onAfterClose, onBeforeOpen, onBeforeClose, ...restprops },\n ref: ObjectPreviewProps['ref']\n ) => {\n const contentRef = useConsolidatedRef<HTMLDivElement>(ref);\n const dismissButtonRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (open && contentRef.current) {\n contentRef.current?.querySelector('button')?.focus();\n }\n }, [open]);\n\n return (\n <StyledObjectPreview\n ref={contentRef}\n open={!!open}\n nullWhenClosed\n position='fixed'\n size='30%'\n shadow\n placement='right'\n onAfterOpen={onAfterOpen}\n onAfterClose={onAfterClose}\n onBeforeOpen={onBeforeOpen}\n onBeforeClose={onBeforeClose}\n >\n <OneColumnPage\n ref={contentRef}\n title={header.title}\n as={StyledPage}\n header={\n <PreviewHeader dismissButtonRef={dismissButtonRef} header={header} {...restprops} />\n }\n scrollContent\n a={content}\n />\n </StyledObjectPreview>\n );\n }\n);\n\nexport default ObjectPreview;\n"]}
@@ -0,0 +1,3 @@
1
+ export { default as ObjectPreview } from './ObjectPreview';
2
+ export * from './ObjectPreview';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectPreview/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as ObjectPreview } from './ObjectPreview';
2
+ export * from './ObjectPreview';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ObjectPreview/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,cAAc,iBAAiB,CAAC","sourcesContent":["export { default as ObjectPreview } from './ObjectPreview';\nexport * from './ObjectPreview';\n"]}
@@ -0,0 +1,18 @@
1
+ import { ReactNode, FC, Ref } from 'react';
2
+ import { ForwardProps, Action } from '@pega/cosmos-react-core';
3
+ export interface ObjectConfigProps {
4
+ label: string;
5
+ heading: string;
6
+ primaryAction: Action;
7
+ secondaryAction: Action;
8
+ content?: ReactNode;
9
+ onBeforeOpen?: () => void;
10
+ onAfterClose?: (id?: string) => void;
11
+ ref?: Ref<HTMLDivElement>;
12
+ }
13
+ declare const ObjectConfig: FC<ObjectConfigProps & ForwardProps & {
14
+ disabled?: boolean;
15
+ dismissPopover: (id?: string) => void;
16
+ }>;
17
+ export default ObjectConfig;
18
+ //# sourceMappingURL=ObjectConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectConfig.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectSelect/ObjectConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,EAAc,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAsB,MAAM,EAAiB,MAAM,yBAAyB,CAAC;AAElG,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,QAAA,MAAM,YAAY,EAAE,EAAE,CACpB,iBAAiB,GAAG,YAAY,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAqCjG,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Flex, Icon, Text, useI18n } from '@pega/cosmos-react-core';
3
+ const ObjectConfig = ({ heading, content, primaryAction, secondaryAction, disabled, dismissPopover }) => {
4
+ const t = useI18n();
5
+ return (_jsxs(Flex, { container: { direction: 'column', pad: 2, gap: 2 }, children: [_jsxs(Flex, { container: { justify: 'between', alignItems: 'center' }, children: [_jsx(Text, { variant: 'h3', children: heading }), _jsx(Button, { icon: true, variant: 'simple', label: t('close'), onClick: () => dismissPopover(), children: _jsx(Icon, { name: 'times' }) })] }), content, _jsxs(Flex, { container: { justify: 'between' }, children: [_jsx(Button, { variant: 'secondary', disabled: disabled, onClick: (e) => {
6
+ secondaryAction.onClick?.(secondaryAction.id, e);
7
+ dismissPopover(secondaryAction.id);
8
+ }, children: secondaryAction.text }), _jsx(Button, { variant: 'primary', disabled: disabled, onClick: (e) => {
9
+ primaryAction.onClick?.(primaryAction.id, e);
10
+ dismissPopover(primaryAction.id);
11
+ }, children: primaryAction.text })] })] }));
12
+ };
13
+ export default ObjectConfig;
14
+ //# sourceMappingURL=ObjectConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectConfig.js","sourceRoot":"","sources":["../../../src/components/ObjectSelect/ObjectConfig.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAgB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAU,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAalG,MAAM,YAAY,GAEd,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,EAAE;IACrF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,aACtD,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,aAC3D,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,OAAO,GAAQ,EACnC,KAAC,MAAM,IAAC,IAAI,QAAC,OAAO,EAAC,QAAQ,EAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,YAC9E,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACd,IACJ,EACN,OAAO,EACR,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,aACrC,KAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,CAAgC,EAAE,EAAE;4BAC5C,eAAe,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;4BACjD,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;wBACrC,CAAC,YAEA,eAAe,CAAC,IAAI,GACd,EACT,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,CAAgC,EAAE,EAAE;4BAC5C,aAAa,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;4BAC7C,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;wBACnC,CAAC,YAEA,aAAa,CAAC,IAAI,GACZ,IACJ,IACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { ReactNode, FC, Ref, MouseEvent } from 'react';\n\nimport { ForwardProps, Button, Flex, Icon, Action, Text, useI18n } from '@pega/cosmos-react-core';\n\nexport interface ObjectConfigProps {\n label: string;\n heading: string;\n primaryAction: Action;\n secondaryAction: Action;\n content?: ReactNode;\n onBeforeOpen?: () => void;\n onAfterClose?: (id?: string) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst ObjectConfig: FC<\n ObjectConfigProps & ForwardProps & { disabled?: boolean; dismissPopover: (id?: string) => void }\n> = ({ heading, content, primaryAction, secondaryAction, disabled, dismissPopover }) => {\n const t = useI18n();\n\n return (\n <Flex container={{ direction: 'column', pad: 2, gap: 2 }}>\n <Flex container={{ justify: 'between', alignItems: 'center' }}>\n <Text variant='h3'>{heading}</Text>\n <Button icon variant='simple' label={t('close')} onClick={() => dismissPopover()}>\n <Icon name='times' />\n </Button>\n </Flex>\n {content}\n <Flex container={{ justify: 'between' }}>\n <Button\n variant='secondary'\n disabled={disabled}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n secondaryAction.onClick?.(secondaryAction.id, e);\n dismissPopover(secondaryAction.id);\n }}\n >\n {secondaryAction.text}\n </Button>\n <Button\n variant='primary'\n disabled={disabled}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n primaryAction.onClick?.(primaryAction.id, e);\n dismissPopover(primaryAction.id);\n }}\n >\n {primaryAction.text}\n </Button>\n </Flex>\n </Flex>\n );\n};\n\nexport default ObjectConfig;\n"]}