@pega/cosmos-react-build 2.0.0-dev.9.2 → 2.0.0-rc.2

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 (161) hide show
  1. package/lib/components/AppHeader/AppHeader.d.ts +4 -3
  2. package/lib/components/AppHeader/AppHeader.d.ts.map +1 -1
  3. package/lib/components/AppHeader/AppHeader.js +10 -18
  4. package/lib/components/AppHeader/AppHeader.js.map +1 -1
  5. package/lib/components/AppHeader/AppHeader.styles.d.ts +4 -3
  6. package/lib/components/AppHeader/AppHeader.styles.d.ts.map +1 -1
  7. package/lib/components/AppHeader/AppHeader.styles.js +35 -17
  8. package/lib/components/AppHeader/AppHeader.styles.js.map +1 -1
  9. package/lib/components/AppShell/AppShell.d.ts +4 -0
  10. package/lib/components/AppShell/AppShell.d.ts.map +1 -0
  11. package/lib/components/AppShell/AppShell.js +82 -0
  12. package/lib/components/AppShell/AppShell.js.map +1 -0
  13. package/lib/components/AppShell/AppShell.styles.d.ts +20 -0
  14. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -0
  15. package/lib/components/AppShell/AppShell.styles.js +329 -0
  16. package/lib/components/AppShell/AppShell.styles.js.map +1 -0
  17. package/lib/components/AppShell/AppShell.types.d.ts +43 -0
  18. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -0
  19. package/lib/components/AppShell/AppShell.types.js +2 -0
  20. package/lib/components/AppShell/AppShell.types.js.map +1 -0
  21. package/lib/components/AppShell/AppShellContext.d.ts +4 -0
  22. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -0
  23. package/lib/components/AppShell/AppShellContext.js +13 -0
  24. package/lib/components/AppShell/AppShellContext.js.map +1 -0
  25. package/lib/components/AppShell/index.d.ts +3 -0
  26. package/lib/components/AppShell/index.d.ts.map +1 -0
  27. package/lib/components/AppShell/index.js +2 -0
  28. package/lib/components/AppShell/index.js.map +1 -0
  29. package/lib/components/FlowModeller/FlowModeller.d.ts +21 -0
  30. package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -0
  31. package/lib/components/FlowModeller/FlowModeller.js +201 -0
  32. package/lib/components/FlowModeller/FlowModeller.js.map +1 -0
  33. package/lib/components/FlowModeller/Node/Node.types.d.ts +54 -0
  34. package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -0
  35. package/lib/components/FlowModeller/Node/Node.types.js +28 -0
  36. package/lib/components/FlowModeller/Node/Node.types.js.map +1 -0
  37. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +19 -0
  38. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -0
  39. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +128 -0
  40. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -0
  41. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +6 -0
  42. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -0
  43. package/lib/components/FlowModeller/Node/NodeTemplates.js +55 -0
  44. package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -0
  45. package/lib/components/FlowModeller/NodeLibrary.d.ts +12 -0
  46. package/lib/components/FlowModeller/NodeLibrary.d.ts.map +1 -0
  47. package/lib/components/FlowModeller/NodeLibrary.js +49 -0
  48. package/lib/components/FlowModeller/NodeLibrary.js.map +1 -0
  49. package/lib/components/FlowModeller/Renderer/AddNode.d.ts +10 -0
  50. package/lib/components/FlowModeller/Renderer/AddNode.d.ts.map +1 -0
  51. package/lib/components/FlowModeller/Renderer/AddNode.js +42 -0
  52. package/lib/components/FlowModeller/Renderer/AddNode.js.map +1 -0
  53. package/lib/components/FlowModeller/Renderer/Connector.d.ts +5 -0
  54. package/lib/components/FlowModeller/Renderer/Connector.d.ts.map +1 -0
  55. package/lib/components/FlowModeller/Renderer/Connector.js +50 -0
  56. package/lib/components/FlowModeller/Renderer/Connector.js.map +1 -0
  57. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.d.ts +12 -0
  58. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.d.ts.map +1 -0
  59. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.js +15 -0
  60. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.js.map +1 -0
  61. package/lib/components/FlowModeller/Renderer/Node.d.ts +5 -0
  62. package/lib/components/FlowModeller/Renderer/Node.d.ts.map +1 -0
  63. package/lib/components/FlowModeller/Renderer/Node.js +18 -0
  64. package/lib/components/FlowModeller/Renderer/Node.js.map +1 -0
  65. package/lib/components/FlowModeller/Renderer/NodesContainer.d.ts +8 -0
  66. package/lib/components/FlowModeller/Renderer/NodesContainer.d.ts.map +1 -0
  67. package/lib/components/FlowModeller/Renderer/NodesContainer.js +15 -0
  68. package/lib/components/FlowModeller/Renderer/NodesContainer.js.map +1 -0
  69. package/lib/components/FlowModeller/Renderer/Renderer.d.ts +5 -0
  70. package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +1 -0
  71. package/lib/components/FlowModeller/Renderer/Renderer.js +17 -0
  72. package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -0
  73. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +18 -0
  74. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +1 -0
  75. package/lib/components/FlowModeller/Renderer/Renderer.types.js +2 -0
  76. package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +1 -0
  77. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +51 -0
  78. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +1 -0
  79. package/lib/components/FlowModeller/Renderer/Utils/Graph.js +247 -0
  80. package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -0
  81. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +35 -0
  82. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +1 -0
  83. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +104 -0
  84. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +1 -0
  85. package/lib/components/FlowModeller/helper.d.ts +22 -0
  86. package/lib/components/FlowModeller/helper.d.ts.map +1 -0
  87. package/lib/components/FlowModeller/helper.js +97 -0
  88. package/lib/components/FlowModeller/helper.js.map +1 -0
  89. package/lib/components/FlowModeller/index.d.ts +3 -0
  90. package/lib/components/FlowModeller/index.d.ts.map +1 -0
  91. package/lib/components/FlowModeller/index.js +2 -0
  92. package/lib/components/FlowModeller/index.js.map +1 -0
  93. package/lib/components/LifeCycle/Category.d.ts +32 -0
  94. package/lib/components/LifeCycle/Category.d.ts.map +1 -0
  95. package/lib/components/LifeCycle/Category.js +98 -0
  96. package/lib/components/LifeCycle/Category.js.map +1 -0
  97. package/lib/components/LifeCycle/LifeCycle.d.ts +22 -0
  98. package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -0
  99. package/lib/components/LifeCycle/LifeCycle.js +73 -0
  100. package/lib/components/LifeCycle/LifeCycle.js.map +1 -0
  101. package/lib/components/LifeCycle/LifeCycle.types.d.ts +56 -0
  102. package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -0
  103. package/lib/components/LifeCycle/LifeCycle.types.js +2 -0
  104. package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -0
  105. package/lib/components/LifeCycle/LifeCycleList.d.ts +22 -0
  106. package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -0
  107. package/lib/components/LifeCycle/LifeCycleList.js +65 -0
  108. package/lib/components/LifeCycle/LifeCycleList.js.map +1 -0
  109. package/lib/components/LifeCycle/Stage.d.ts +49 -0
  110. package/lib/components/LifeCycle/Stage.d.ts.map +1 -0
  111. package/lib/components/LifeCycle/Stage.js +297 -0
  112. package/lib/components/LifeCycle/Stage.js.map +1 -0
  113. package/lib/components/LifeCycle/Step.d.ts +51 -0
  114. package/lib/components/LifeCycle/Step.d.ts.map +1 -0
  115. package/lib/components/LifeCycle/Step.js +241 -0
  116. package/lib/components/LifeCycle/Step.js.map +1 -0
  117. package/lib/components/LifeCycle/Task.d.ts +53 -0
  118. package/lib/components/LifeCycle/Task.d.ts.map +1 -0
  119. package/lib/components/LifeCycle/Task.js +188 -0
  120. package/lib/components/LifeCycle/Task.js.map +1 -0
  121. package/lib/components/LifeCycle/index.d.ts +4 -0
  122. package/lib/components/LifeCycle/index.d.ts.map +1 -0
  123. package/lib/components/LifeCycle/index.js +2 -0
  124. package/lib/components/LifeCycle/index.js.map +1 -0
  125. package/lib/components/PageTemplates/GalleryPage.d.ts +23 -0
  126. package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -0
  127. package/lib/components/PageTemplates/GalleryPage.js +23 -0
  128. package/lib/components/PageTemplates/GalleryPage.js.map +1 -0
  129. package/lib/components/PageTemplates/GalleryPage.styles.d.ts +9 -0
  130. package/lib/components/PageTemplates/GalleryPage.styles.d.ts.map +1 -0
  131. package/lib/components/PageTemplates/GalleryPage.styles.js +70 -0
  132. package/lib/components/PageTemplates/GalleryPage.styles.js.map +1 -0
  133. package/lib/components/PageTemplates/PageTemplates.d.ts +27 -0
  134. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -0
  135. package/lib/components/PageTemplates/PageTemplates.js +86 -0
  136. package/lib/components/PageTemplates/PageTemplates.js.map +1 -0
  137. package/lib/components/PageTemplates/index.d.ts +5 -0
  138. package/lib/components/PageTemplates/index.d.ts.map +1 -0
  139. package/lib/components/PageTemplates/index.js +4 -0
  140. package/lib/components/PageTemplates/index.js.map +1 -0
  141. package/lib/components/SummaryCard/SummaryCard.d.ts +16 -0
  142. package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -0
  143. package/lib/components/SummaryCard/SummaryCard.js +31 -0
  144. package/lib/components/SummaryCard/SummaryCard.js.map +1 -0
  145. package/lib/components/SummaryCard/index.d.ts +3 -0
  146. package/lib/components/SummaryCard/index.d.ts.map +1 -0
  147. package/lib/components/SummaryCard/index.js +3 -0
  148. package/lib/components/SummaryCard/index.js.map +1 -0
  149. package/lib/components/Visual/Visual.d.ts +17 -0
  150. package/lib/components/Visual/Visual.d.ts.map +1 -0
  151. package/lib/components/Visual/Visual.js +28 -0
  152. package/lib/components/Visual/Visual.js.map +1 -0
  153. package/lib/components/Visual/index.d.ts +3 -0
  154. package/lib/components/Visual/index.d.ts.map +1 -0
  155. package/lib/components/Visual/index.js +3 -0
  156. package/lib/components/Visual/index.js.map +1 -0
  157. package/lib/index.d.ts +9 -0
  158. package/lib/index.d.ts.map +1 -1
  159. package/lib/index.js +9 -0
  160. package/lib/index.js.map +1 -1
  161. package/package.json +15 -14
@@ -0,0 +1,297 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, forwardRef } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { readableColor } from 'polished';
5
+ import { Flex, Actions, Icon, Tooltip, useElement, defaultThemeProp, useDirection, StyledTooltip, StyledButton } from '@pega/cosmos-react-core';
6
+ export const StyledWrapper = styled.div `
7
+ overflow: hidden;
8
+ `;
9
+ export const StyledDragIcon = styled.div(({ theme, error }) => {
10
+ return css `
11
+ width: 0%;
12
+ transition: width ${theme.base.animation.speed};
13
+ ${error &&
14
+ css `
15
+ display: block;
16
+ `}
17
+ padding: 0 calc(0.5 * ${theme.base.spacing});
18
+ margin: calc(0.5 * ${theme.base.spacing}) 0;
19
+ color: ${theme.base.colors.white};
20
+ text-align: center;
21
+ `;
22
+ });
23
+ export const StyledInput = styled.input(({ error, theme }) => {
24
+ return css `
25
+ height: ${theme.components.input.height};
26
+ padding: 0 calc(0.5 * ${theme.base.spacing});
27
+ text-overflow: ellipsis;
28
+ border: 0.0625rem solid transparent;
29
+ border-radius: calc(0.5 * ${theme.base['border-radius']});
30
+ width: 100%;
31
+ color: ${theme.base.colors.white};
32
+ outline: none;
33
+ &:hover {
34
+ cursor: pointer;
35
+ }
36
+ &:disabled {
37
+ cursor: not-allowed;
38
+ }
39
+ ${error
40
+ ? css `
41
+ background: ${theme.base.colors.red['extra-light']};
42
+ border: 0.0625rem solid ${theme.base.colors.red.medium};
43
+ color: ${theme.base.colors.black};
44
+ `
45
+ : css `
46
+ background: ${theme.base.palette['primary-background']};
47
+ &&:focus:enabled {
48
+ color: ${theme.base.colors.black};
49
+ background: ${theme.base.palette['primary-background']};
50
+ border: 0.0625rem solid ${theme.base.colors.blue.medium};
51
+ }
52
+ `}
53
+ `;
54
+ });
55
+ export const StyledStageActions = styled.div(({ theme, error }) => {
56
+ return css `
57
+ z-index: 2;
58
+ visibility: hidden;
59
+ margin-inline-start: calc(0.5 * ${theme.base.spacing});
60
+
61
+ ${error &&
62
+ css `
63
+ visibility: visible;
64
+ `}
65
+
66
+ & > ${StyledButton} {
67
+ color: ${theme.base.colors.white};
68
+ }
69
+ `;
70
+ });
71
+ export const StyledStage = styled.div(({ variant, theme, tailPointed, headPointed, status }) => {
72
+ let bgColor;
73
+ let bgHover = '';
74
+ switch (variant) {
75
+ case 'start':
76
+ bgColor = theme.base.colors.blue.dark;
77
+ bgHover = theme.base.colors.blue.medium;
78
+ break;
79
+ case 'default':
80
+ bgColor = theme.base.colors.blue.medium;
81
+ bgHover = theme.base.colors.blue.light;
82
+ break;
83
+ case 'resolution':
84
+ bgColor = theme.base.colors.green.medium;
85
+ bgHover = theme.base.colors.green.light;
86
+ break;
87
+ case 'alternate':
88
+ bgColor = theme.base.colors.red.light;
89
+ bgHover = theme.base.colors.red['extra-light'];
90
+ break;
91
+ // eslint-disable-next-line sonarjs/no-duplicated-branches
92
+ default:
93
+ bgColor = theme.base.colors.blue.medium;
94
+ bgHover = theme.base.colors.blue.light;
95
+ }
96
+ const textColor = readableColor(bgHover);
97
+ const { rtl } = useDirection();
98
+ const roundedEndsStyles = css `
99
+ content: '';
100
+ position: absolute;
101
+ display: block;
102
+ width: calc(3 * ${theme.base.spacing});
103
+ height: calc(3 * ${theme.base.spacing});
104
+ top: calc(1 * ${theme.base.spacing});
105
+ border: 0;
106
+ border-inline-end: 0.0625rem solid transparent;
107
+ `;
108
+ return css `
109
+ position: relative;
110
+ padding: calc(0.5 * ${theme.base.spacing});
111
+ background: ${bgColor};
112
+ border: 0.0625rem solid transparent;
113
+ width: 100%;
114
+
115
+ &:hover {
116
+ cursor: pointer;
117
+ ${StyledDragIcon} {
118
+ @keyframes anim {
119
+ 0% {
120
+ transform: scale(0);
121
+ }
122
+ 100% {
123
+ transform: scale(1);
124
+ }
125
+ }
126
+ animation: anim ${theme.base.animation.speed} ${theme.base.animation.timing.ease};
127
+ width: 10%;
128
+ transition: width ${theme.base.animation.speed};
129
+ }
130
+ ${StyledStageActions} {
131
+ ${css `
132
+ visibility: visible;
133
+ `}
134
+ }
135
+ }
136
+ &:focus-within {
137
+ border: 0.0625rem solid ${theme.base.colors.blue.medium};
138
+ ${!headPointed &&
139
+ css `
140
+ &::after {
141
+ border-inline-end: 0.0625rem solid ${theme.base.colors.blue.medium};
142
+ ${rtl
143
+ ? css `
144
+ border-block-start: 0.0625rem solid ${theme.base.colors.blue.medium};
145
+ `
146
+ : css `
147
+ border-block-end: 0.0625rem solid ${theme.base.colors.blue.medium};
148
+ `}
149
+ }
150
+ `}
151
+ ${!tailPointed &&
152
+ css `
153
+ &::before {
154
+ border-inline-end: 0.0625rem solid ${theme.base.colors.blue.medium};
155
+ ${rtl
156
+ ? css `
157
+ border-block-end: 0.0625rem solid ${theme.base.colors.blue.medium};
158
+ `
159
+ : css `
160
+ border-block-start: 0.0625rem solid ${theme.base.colors.blue.medium};
161
+ `}
162
+ }
163
+ `}
164
+ ${StyledDragIcon} {
165
+ ${css `
166
+ @keyframes anim {
167
+ 0% {
168
+ transform: scale(0);
169
+ }
170
+ 100% {
171
+ transform: scale(1);
172
+ }
173
+ }
174
+ animation: anim ${theme.base.animation.speed} ${theme.base.animation.timing.ease};
175
+ width: 10%;
176
+ transition: width ${theme.base.animation.speed};
177
+ `}
178
+ }
179
+ ${StyledStageActions} {
180
+ ${css `
181
+ visibility: visible;
182
+ `}
183
+ }
184
+ }
185
+
186
+ ${!headPointed &&
187
+ css `
188
+ &::after {
189
+ ${roundedEndsStyles}
190
+ z-index: 1;
191
+ background: inherit;
192
+ transform: rotateZ(-45deg) skew(-15deg, -15deg);
193
+ inset-inline-end: calc(1.6 * ${theme.base.spacing} * -1);
194
+ border-block-end: 0.0625rem solid transparent;
195
+ ${rtl
196
+ ? css `
197
+ border-radius: calc(0.75 * ${theme.base['border-radius']}) 0.1rem 0.1rem 0.1rem;
198
+ `
199
+ : css `
200
+ border-radius: 0.0625rem 0.075rem calc(0.75 * ${theme.base['border-radius']})
201
+ 0.0625rem;
202
+ `}
203
+ }
204
+ `}
205
+
206
+ ${!tailPointed &&
207
+ css `
208
+ &::before {
209
+ ${roundedEndsStyles}
210
+ background: ${theme.base.palette['app-background']};
211
+ transform: rotateZ(45deg) skew(15deg, 15deg);
212
+ inset-inline-start: calc(-1.6 * ${theme.base.spacing});
213
+ ${rtl
214
+ ? css `
215
+ border-block-end: 0.0625rem solid transparent;
216
+ border-radius: 0.0625rem 0 0.0625rem calc(0.75 * ${theme.base['border-radius']});
217
+ `
218
+ : css `
219
+ border-block-start: 0.0625rem solid transparent;
220
+ border-radius: 0.0625rem calc(0.75 * ${theme.base['border-radius']}) 0.0625rem 0;
221
+ `}
222
+ }
223
+ `}
224
+
225
+ ${StyledInput} {
226
+ ${!status &&
227
+ css `
228
+ border: 0.0625rem solid transparent;
229
+ background: ${bgColor};
230
+ `}
231
+ :hover:not([readonly]):not([disabled]):not(:focus) {
232
+ ${!status &&
233
+ css `
234
+ border: 0.0625rem solid transparent;
235
+ background: ${bgHover};
236
+
237
+ /* color: ${textColor}; */
238
+ `}
239
+ }
240
+ }
241
+ `;
242
+ });
243
+ StyledStage.defaultProps = defaultThemeProp;
244
+ export const StyledInputWrapper = styled.div `
245
+ &:focus-within {
246
+ ${StyledTooltip} {
247
+ ${css `
248
+ display: none;
249
+ `}
250
+ }
251
+ }
252
+ `;
253
+ const Stage = forwardRef(({ value, actions, variant = 'default', headPointed = true, tailPointed = true, onChange, onFocus, id, item, error, ...restProps }, ref) => {
254
+ const [inputEl, setInputEl] = useElement();
255
+ const [stageName, setStageName] = useState(value);
256
+ const onInputChange = (e) => {
257
+ setStageName(e.target.value);
258
+ const param = {
259
+ value: stageName,
260
+ stage: item
261
+ };
262
+ onChange?.(param, e);
263
+ };
264
+ const onInputFocus = (e) => {
265
+ const param = {
266
+ value: stageName,
267
+ stage: item
268
+ };
269
+ onFocus?.(param, e);
270
+ };
271
+ const onActionItemClick = (actionId, e) => {
272
+ const param = {
273
+ stage: item
274
+ };
275
+ actions?.forEach((actionItem) => {
276
+ if (actionItem.id === actionId) {
277
+ actionItem.onClick?.(param, e);
278
+ }
279
+ });
280
+ };
281
+ /* Deep copy of actions object is required to provide consistent callback objects on actions */
282
+ const actionsClone = [];
283
+ if (actions) {
284
+ actions.forEach(actionItem => {
285
+ const actionCloneItem = {};
286
+ Object.keys(actionItem).forEach((key) => {
287
+ actionCloneItem[key] = actionItem[key];
288
+ });
289
+ actionCloneItem.onClick = onActionItemClick;
290
+ actionsClone.push(actionCloneItem);
291
+ return actionItem;
292
+ });
293
+ }
294
+ return (_jsx(Flex, { container: { inline: true }, as: StyledStage, ...restProps, ref: ref, variant: variant || 'default', tailPointed: tailPointed, headPointed: headPointed, status: error, role: 'columnheader', children: _jsxs(Flex, { as: StyledWrapper, container: { inline: true }, children: [_jsx(Flex, { as: StyledDragIcon, error: error, children: _jsx(Icon, { name: 'drag' }, void 0) }, void 0), _jsxs(Flex, { container: true, children: [_jsxs(Flex, { as: StyledInputWrapper, item: { grow: 1 }, container: { inline: true, alignItems: 'center' }, children: [_jsx(StyledInput, { value: stageName, type: 'text', ref: setInputEl, error: error, id: item.id, onChange: onInputChange, "aria-label": stageName, onFocus: onInputFocus }, void 0), stageName && (_jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || stageName }, void 0))] }, void 0), _jsx(StyledStageActions, { error: error, children: actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }, void 0) }, void 0)] }, void 0)] }, void 0) }, void 0));
295
+ });
296
+ export default Stage;
297
+ //# sourceMappingURL=Stage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stage.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Stage.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EAOX,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,EAGJ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,UAAU,EAEV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EAEb,YAAY,EACb,MAAM,yBAAyB,CAAC;AAmCjC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEtC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAoB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/E,OAAO,GAAG,CAAA;;wBAEY,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK;MAC5C,KAAK;QACP,GAAG,CAAA;;KAEF;4BACuB,KAAK,CAAC,IAAI,CAAC,OAAO;yBACrB,KAAK,CAAC,IAAI,CAAC,OAAO;aAC9B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;GAEjC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAgC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IAC1F,OAAO,GAAG,CAAA;cACE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM;4BACf,KAAK,CAAC,IAAI,CAAC,OAAO;;;gCAGd,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;;aAE9C,KAAK,CAAC,IA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AEF,eAAe,KAAK,CAAC","sourcesContent":["import {\n useState,\n forwardRef,\n FunctionComponent,\n PropsWithChildren,\n Ref,\n ChangeEvent,\n FocusEvent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Flex,\n BaseProps,\n ForwardProps,\n Actions,\n Icon,\n Tooltip,\n useElement,\n FormControlProps,\n defaultThemeProp,\n useDirection,\n StyledTooltip,\n Action,\n StyledButton\n} from '@pega/cosmos-react-core';\n\nimport { LifeCycleAction, LifeCycleActionParam, StageItemProps } from './LifeCycle.types';\n\nexport interface StageProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Callback for Add stage */\n onAddStage?: () => void;\n /** Callback for Adding alternate stage */\n onAddAlternateStage?: () => void;\n /** Input Change */\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** onFocus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n}\n\nexport interface StageComponentProps extends BaseProps, StageProps {\n ref?: Ref<HTMLDivElement>;\n /** Pass text for the task. */\n value: string;\n /* unique id of the component */\n id: string;\n /** Controls the styling of the stage. */\n variant?: StageItemProps['type'] | 'default';\n /** To make the stage with pointed tail */\n tailPointed?: boolean;\n /** To make the stage with pointed head */\n headPointed?: boolean;\n /** Full data object which can be passed to the callback */\n item: StageItemProps;\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n}\n\nexport const StyledWrapper = styled.div`\n overflow: hidden;\n`;\n\nexport const StyledDragIcon = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n width: 0%;\n transition: width ${theme.base.animation.speed};\n ${error &&\n css`\n display: block;\n `}\n padding: 0 calc(0.5 * ${theme.base.spacing});\n margin: calc(0.5 * ${theme.base.spacing}) 0;\n color: ${theme.base.colors.white};\n text-align: center;\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 color: ${theme.base.colors.white};\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 color: ${theme.base.colors.black};\n `\n : css`\n background: ${theme.base.palette['primary-background']};\n &&:focus:enabled {\n color: ${theme.base.colors.black};\n background: ${theme.base.palette['primary-background']};\n border: 0.0625rem solid ${theme.base.colors.blue.medium};\n }\n `}\n `;\n});\n\nexport const StyledStageActions = styled.div<{\n error?: string;\n}>(({ theme, error }) => {\n return css`\n z-index: 2;\n visibility: hidden;\n margin-inline-start: calc(0.5 * ${theme.base.spacing});\n\n ${error &&\n css`\n visibility: visible;\n `}\n\n & > ${StyledButton} {\n color: ${theme.base.colors.white};\n }\n `;\n});\n\nexport const StyledStage = styled.div<\n Pick<StageComponentProps, 'variant'> & {\n tailPointed: boolean;\n headPointed: boolean;\n status: boolean;\n }\n>(({ variant, theme, tailPointed, headPointed, status }) => {\n let bgColor;\n let bgHover = '';\n switch (variant) {\n case 'start':\n bgColor = theme.base.colors.blue.dark;\n bgHover = theme.base.colors.blue.medium;\n break;\n case 'default':\n bgColor = theme.base.colors.blue.medium;\n bgHover = theme.base.colors.blue.light;\n break;\n case 'resolution':\n bgColor = theme.base.colors.green.medium;\n bgHover = theme.base.colors.green.light;\n break;\n case 'alternate':\n bgColor = theme.base.colors.red.light;\n bgHover = theme.base.colors.red['extra-light'];\n break;\n // eslint-disable-next-line sonarjs/no-duplicated-branches\n default:\n bgColor = theme.base.colors.blue.medium;\n bgHover = theme.base.colors.blue.light;\n }\n const textColor = readableColor(bgHover);\n const { rtl } = useDirection();\n const roundedEndsStyles = css`\n content: '';\n position: absolute;\n display: block;\n width: calc(3 * ${theme.base.spacing});\n height: calc(3 * ${theme.base.spacing});\n top: calc(1 * ${theme.base.spacing});\n border: 0;\n border-inline-end: 0.0625rem solid transparent;\n `;\n\n return css`\n position: relative;\n padding: calc(0.5 * ${theme.base.spacing});\n background: ${bgColor};\n border: 0.0625rem solid transparent;\n width: 100%;\n\n &:hover {\n cursor: pointer;\n ${StyledDragIcon} {\n @keyframes anim {\n 0% {\n transform: scale(0);\n }\n 100% {\n transform: scale(1);\n }\n }\n animation: anim ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n width: 10%;\n transition: width ${theme.base.animation.speed};\n }\n ${StyledStageActions} {\n ${css`\n visibility: visible;\n `}\n }\n }\n &:focus-within {\n border: 0.0625rem solid ${theme.base.colors.blue.medium};\n ${!headPointed &&\n css`\n &::after {\n border-inline-end: 0.0625rem solid ${theme.base.colors.blue.medium};\n ${rtl\n ? css`\n border-block-start: 0.0625rem solid ${theme.base.colors.blue.medium};\n `\n : css`\n border-block-end: 0.0625rem solid ${theme.base.colors.blue.medium};\n `}\n }\n `}\n ${!tailPointed &&\n css`\n &::before {\n border-inline-end: 0.0625rem solid ${theme.base.colors.blue.medium};\n ${rtl\n ? css`\n border-block-end: 0.0625rem solid ${theme.base.colors.blue.medium};\n `\n : css`\n border-block-start: 0.0625rem solid ${theme.base.colors.blue.medium};\n `}\n }\n `}\n ${StyledDragIcon} {\n ${css`\n @keyframes anim {\n 0% {\n transform: scale(0);\n }\n 100% {\n transform: scale(1);\n }\n }\n animation: anim ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n width: 10%;\n transition: width ${theme.base.animation.speed};\n `}\n }\n ${StyledStageActions} {\n ${css`\n visibility: visible;\n `}\n }\n }\n\n ${!headPointed &&\n css`\n &::after {\n ${roundedEndsStyles}\n z-index: 1;\n background: inherit;\n transform: rotateZ(-45deg) skew(-15deg, -15deg);\n inset-inline-end: calc(1.6 * ${theme.base.spacing} * -1);\n border-block-end: 0.0625rem solid transparent;\n ${rtl\n ? css`\n border-radius: calc(0.75 * ${theme.base['border-radius']}) 0.1rem 0.1rem 0.1rem;\n `\n : css`\n border-radius: 0.0625rem 0.075rem calc(0.75 * ${theme.base['border-radius']})\n 0.0625rem;\n `}\n }\n `}\n\n ${!tailPointed &&\n css`\n &::before {\n ${roundedEndsStyles}\n background: ${theme.base.palette['app-background']};\n transform: rotateZ(45deg) skew(15deg, 15deg);\n inset-inline-start: calc(-1.6 * ${theme.base.spacing});\n ${rtl\n ? css`\n border-block-end: 0.0625rem solid transparent;\n border-radius: 0.0625rem 0 0.0625rem calc(0.75 * ${theme.base['border-radius']});\n `\n : css`\n border-block-start: 0.0625rem solid transparent;\n border-radius: 0.0625rem calc(0.75 * ${theme.base['border-radius']}) 0.0625rem 0;\n `}\n }\n `}\n\n ${StyledInput} {\n ${!status &&\n css`\n border: 0.0625rem solid transparent;\n background: ${bgColor};\n `}\n :hover:not([readonly]):not([disabled]):not(:focus) {\n ${!status &&\n css`\n border: 0.0625rem solid transparent;\n background: ${bgHover};\n\n /* color: ${textColor}; */\n `}\n }\n }\n `;\n});\n\nStyledStage.defaultProps = defaultThemeProp;\n\nexport const StyledInputWrapper = styled.div`\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n`;\n\nconst Stage: FunctionComponent<StageComponentProps & ForwardProps> = forwardRef(\n (\n {\n value,\n actions,\n variant = 'default',\n headPointed = true,\n tailPointed = true,\n onChange,\n onFocus,\n id,\n item,\n error,\n ...restProps\n }: PropsWithChildren<StageComponentProps>,\n ref: StageComponentProps['ref']\n ) => {\n const [inputEl, setInputEl] = useElement();\n const [stageName, setStageName] = useState(value);\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setStageName(e.target.value);\n const param: LifeCycleActionParam = {\n value: stageName,\n stage: item\n };\n onChange?.(param, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const param: LifeCycleActionParam = {\n value: stageName,\n stage: item\n };\n onFocus?.(param, e);\n };\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n stage: item\n };\n actions?.forEach((actionItem: LifeCycleAction) => {\n if (actionItem.id === actionId) {\n actionItem.onClick?.(param, e);\n }\n });\n };\n\n /* Deep copy of actions object 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 return (\n <Flex\n container={{ inline: true }}\n as={StyledStage}\n {...restProps}\n ref={ref}\n variant={variant || 'default'}\n tailPointed={tailPointed}\n headPointed={headPointed}\n status={error}\n role='columnheader'\n >\n <Flex as={StyledWrapper} container={{ inline: true }}>\n <Flex as={StyledDragIcon} error={error}>\n <Icon name='drag' />\n </Flex>\n <Flex container>\n <Flex\n as={StyledInputWrapper}\n item={{ grow: 1 }}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledInput\n value={stageName}\n type='text'\n ref={setInputEl}\n error={error}\n id={item.id}\n onChange={onInputChange}\n aria-label={stageName}\n onFocus={onInputFocus}\n />\n {stageName && (\n <Tooltip target={inputEl} hideDelay='none'>\n {error || stageName}\n </Tooltip>\n )}\n </Flex>\n <StyledStageActions error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n </StyledStageActions>\n </Flex>\n </Flex>\n </Flex>\n );\n }\n);\n\nexport default Stage;\n"]}
@@ -0,0 +1,51 @@
1
+ import { FunctionComponent, ChangeEvent, FocusEvent } from 'react';
2
+ import { BaseProps, ForwardProps, FormControlProps } from '@pega/cosmos-react-core';
3
+ import { TaskItemProps, StepItemProps, StageItemProps, CategoryItemProps, LifeCycleAction, LifeCycleActionParam } from './LifeCycle.types';
4
+ export interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {
5
+ /** Pass an array of Action objects to append button(s) inline with the Input. */
6
+ actions?: LifeCycleAction[];
7
+ /** Input Change */
8
+ onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;
9
+ /** callback for Focus of input */
10
+ onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;
11
+ }
12
+ interface StepComponentProps extends BaseProps, StepProps {
13
+ /** Pass text for the step. */
14
+ value?: string;
15
+ /** step data id */
16
+ id?: string;
17
+ /** Determines the visual for icon, color and label to render.
18
+ * This color is passed as a variant and accessible colors are used to display.
19
+ * Icon and label are passed as normal string */
20
+ visual: {
21
+ imgurl: string;
22
+ color: 'magenta' | 'studio' | 'congressBlue' | 'Japaneselaurel' | 'violet' | 'yellow' | 'orange' | 'darkyellow';
23
+ icon: string;
24
+ title: string;
25
+ };
26
+ badge?: StepItemProps['status'];
27
+ error?: string;
28
+ item: StepItemProps;
29
+ stageItem: StageItemProps;
30
+ taskItem: TaskItemProps;
31
+ categoryItem: CategoryItemProps;
32
+ }
33
+ export declare const StyledStepType: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
34
+ color: string;
35
+ ref: HTMLDivElement;
36
+ img: string;
37
+ }, never>;
38
+ export declare const StyledStepBadge: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
39
+ export declare const StyledStepValueInput: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, {
40
+ error: string | undefined;
41
+ }, never>;
42
+ export declare const StyledStepStatus: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
43
+ badge: string;
44
+ error: string;
45
+ }, never>;
46
+ export declare const StyledStep: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
47
+ error: string;
48
+ }, never>;
49
+ declare const Step: FunctionComponent<StepComponentProps & ForwardProps>;
50
+ export default Step;
51
+ //# source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AEhC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,cAAc,CAAC;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,EAAE,iBAAiB,CAAC;CACjC;AAED,eAAO,MAAM,cAAc;WAAuB,MAAM;SAAO,cAAc;SAAO,MAAM;SAgDzF,CAAC;AAEF,eAAO,MAAM,eAAe,yGAY1B,CAAC;AAYH,eAAO,MAAM,oBAAoB;WAAyB,MAAM,GAAG,SAAS;SAoC3E,CAAC;AAEF,eAAO,MAAM,gBAAgB;WACpB,MAAM;WACN,MAAM;SAqBb,CAAC;AAEH,eAAO,MAAM,UAAU;WAAuB,MAAM;SAkDlD,CAAC;AAIH,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CA6H9D,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,241 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { readableColor } from 'polished';
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
+ }
36
+ const contrastColor = readableColor(bgColor);
37
+ return img
38
+ ? css `
39
+ height: 2rem;
40
+ padding-inline-end: calc(0.25 * ${theme.base.spacing});
41
+ `
42
+ : 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
+ `;
50
+ });
51
+ export const StyledStepBadge = styled.div(({ theme }) => {
52
+ return css `
53
+ padding: 0 calc(0.5 * ${theme.base.spacing});
54
+ justify-content: flex-end;
55
+ width: auto;
56
+ max-width: calc(50% - ${theme.base.spacing});
57
+ > span {
58
+ white-space: nowrap;
59
+ text-overflow: ellipsis;
60
+ overflow: hidden;
61
+ }
62
+ `;
63
+ });
64
+ const StyledStepValue = styled.div(({ theme, error }) => {
65
+ return css `
66
+ border-radius: calc(0.5 * ${theme.base['border-radius']});
67
+ ${error &&
68
+ css `
69
+ background: ${theme.base.colors.red['extra-light']};
70
+ `}
71
+ `;
72
+ });
73
+ export const StyledStepValueInput = styled.input(({ error, theme }) => {
74
+ return css `
75
+ height: ${theme.components.input.height};
76
+ padding: 0 calc(0.5 * ${theme.base.spacing});
77
+ border: none;
78
+ border-inline-start: 0.0625rem solid transparent;
79
+ border-inline-end: 0.0625rem solid transparent;
80
+ text-overflow: ellipsis;
81
+ min-width: 40%;
82
+ outline: none;
83
+ &:hover {
84
+ cursor: pointer;
85
+ }
86
+ &:disabled {
87
+ cursor: not-allowed;
88
+ }
89
+ ${error
90
+ ? css `
91
+ background: ${theme.base.colors.red['extra-light']};
92
+ &:focus:enabled {
93
+ border-color: ${theme.base.colors.red.medium};
94
+ }
95
+ `
96
+ : css `
97
+ background: ${theme.base.palette['secondary-background']};
98
+ &&:hover {
99
+ background: ${theme.base.palette['app-background']};
100
+ }
101
+ &&:focus:enabled {
102
+ background: ${theme.base.palette['primary-background']};
103
+ border-color: ${theme.base.colors.blue.medium};
104
+ }
105
+ `}
106
+ `;
107
+ });
108
+ export const StyledStepStatus = styled.div(({ theme, badge, error }) => {
109
+ return css `
110
+ border: none;
111
+ ${badge &&
112
+ css `
113
+ display: none;
114
+ `}
115
+ visibility: hidden;
116
+ &:hover {
117
+ cursor: pointer;
118
+ }
119
+ &:focus:not([disabled]) {
120
+ outline: 0.0625rem solid ${theme.base.colors.blue.medium};
121
+ }
122
+ ${error &&
123
+ !badge &&
124
+ css `
125
+ visibility: visible;
126
+ `}
127
+ `;
128
+ });
129
+ export const StyledStep = styled.div(({ theme, error }) => {
130
+ return css `
131
+ background: ${theme.base.palette['secondary-background']};
132
+ border: 0.0625rem solid transparent;
133
+ border-radius: calc(0.5 * ${theme.base['border-radius']});
134
+ margin: 0 0 calc(0.5 * ${theme.base.spacing});
135
+ width: 100%;
136
+ ${error &&
137
+ css `
138
+ border-color: ${theme.base.colors.red.medium};
139
+ box-shadow: none;
140
+ `}
141
+ &:hover {
142
+ cursor: pointer;
143
+ ${StyledStepBadge} {
144
+ ${css `
145
+ display: none;
146
+ `}
147
+ }
148
+ ${StyledStepStatus} {
149
+ ${css `
150
+ visibility: visible;
151
+ display: inline-block;
152
+ `}
153
+ }
154
+ }
155
+ &:focus-within {
156
+ ${!error &&
157
+ css `
158
+ border-color: ${theme.base.colors.blue.medium};
159
+ box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};
160
+ `}
161
+ ${StyledStepBadge} {
162
+ ${css `
163
+ display: none;
164
+ `}
165
+ }
166
+ ${StyledStepStatus} {
167
+ ${css `
168
+ display: inline-block;
169
+ visibility: visible;
170
+ `}
171
+ }
172
+ ${StyledTooltip} {
173
+ ${css `
174
+ visibility: hidden;
175
+ `}
176
+ }
177
+ }
178
+ `;
179
+ });
180
+ StyledStep.defaultProps = defaultThemeProp;
181
+ const Step = ({ value, id, visual, actions, badge, error, onChange, categoryItem, item, stageItem, taskItem, onFocus, ...restProps }) => {
182
+ const t = useI18n();
183
+ const [stepValue, setStepValue] = useState(value);
184
+ const [iconEl, setIconEl] = useElement();
185
+ const [actionEl, setActionEl] = useElement();
186
+ const [inputEl, setInputEl] = useElement();
187
+ const actionsLabel = t('actions');
188
+ const singleActionLabel = actions?.[0]?.text ?? '';
189
+ const tooltipValue = stepValue || error;
190
+ /* Need to check the value with statusProps */
191
+ const onActionItemClick = (actionId, e) => {
192
+ const param = {
193
+ task: taskItem,
194
+ stage: stageItem,
195
+ step: item,
196
+ category: categoryItem
197
+ };
198
+ actions?.forEach(actionItem => {
199
+ if (actionItem.id === actionId) {
200
+ actionItem.onClick(param, e);
201
+ }
202
+ });
203
+ };
204
+ /* Deep copy of actions is required to provide consistent callback objects on actions */
205
+ const actionsClone = [];
206
+ if (actions) {
207
+ actions.forEach(actionItem => {
208
+ const actionCloneItem = {};
209
+ Object.keys(actionItem).forEach((key) => {
210
+ actionCloneItem[key] = actionItem[key];
211
+ });
212
+ actionCloneItem.onClick = onActionItemClick;
213
+ actionsClone.push(actionCloneItem);
214
+ return actionItem;
215
+ });
216
+ }
217
+ const onInputChange = (e) => {
218
+ setStepValue(e.target.value);
219
+ const actionParam = {
220
+ value: e.target.value,
221
+ step: item,
222
+ task: taskItem,
223
+ category: categoryItem,
224
+ stage: stageItem
225
+ };
226
+ onChange?.(actionParam, e);
227
+ };
228
+ const onInputFocus = (e) => {
229
+ const actionParam = {
230
+ value: e.target.value,
231
+ step: item,
232
+ task: taskItem,
233
+ category: categoryItem,
234
+ stage: stageItem
235
+ };
236
+ onFocus?.(actionParam, e);
237
+ };
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));
239
+ };
240
+ export default Step;
241
+ //# sourceMappingURL=Step.js.map