@pega/cosmos-react-build 2.0.0-dev.12.0 → 2.0.0-dev.14.1
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.
- package/lib/components/AppHeader/AppHeader.d.ts.map +1 -1
- package/lib/components/AppHeader/AppHeader.js +4 -4
- package/lib/components/AppHeader/AppHeader.js.map +1 -1
- package/lib/components/AppHeader/AppHeader.styles.d.ts +2 -2
- package/lib/components/AppHeader/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppHeader/AppHeader.styles.js +21 -13
- package/lib/components/AppHeader/AppHeader.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +3 -2
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/LifeCycle/Category.d.ts +32 -0
- package/lib/components/LifeCycle/Category.d.ts.map +1 -0
- package/lib/components/LifeCycle/Category.js +98 -0
- package/lib/components/LifeCycle/Category.js.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.d.ts +22 -0
- package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.js +75 -0
- package/lib/components/LifeCycle/LifeCycle.js.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.types.d.ts +56 -0
- package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.types.js +2 -0
- package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -0
- package/lib/components/LifeCycle/LifeCycleList.d.ts +21 -0
- package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -0
- package/lib/components/LifeCycle/LifeCycleList.js +65 -0
- package/lib/components/LifeCycle/LifeCycleList.js.map +1 -0
- package/lib/components/LifeCycle/Stage.d.ts +47 -0
- package/lib/components/LifeCycle/Stage.d.ts.map +1 -0
- package/lib/components/LifeCycle/Stage.js +290 -0
- package/lib/components/LifeCycle/Stage.js.map +1 -0
- package/lib/components/LifeCycle/Step.d.ts +48 -0
- package/lib/components/LifeCycle/Step.d.ts.map +1 -0
- package/lib/components/LifeCycle/Step.js +231 -0
- package/lib/components/LifeCycle/Step.js.map +1 -0
- package/lib/components/LifeCycle/Task.d.ts +51 -0
- package/lib/components/LifeCycle/Task.d.ts.map +1 -0
- package/lib/components/LifeCycle/Task.js +179 -0
- package/lib/components/LifeCycle/Task.js.map +1 -0
- package/lib/components/LifeCycle/index.d.ts +4 -0
- package/lib/components/LifeCycle/index.d.ts.map +1 -0
- package/lib/components/LifeCycle/index.js +2 -0
- package/lib/components/LifeCycle/index.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +12 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,iBAAiB,EAAmB,WAAW,EAAc,MAAM,OAAO,CAAC;AAI9F,OAAO,EAGL,SAAS,EACT,YAAY,EAKZ,gBAAgB,EAMjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxE,iFAAiF;IACjF,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CACpF;AAED,UAAU,kBAAmB,SAAQ,SAAS,EAAE,SAAS;IACvD,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;oDAEgD;IAChD,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EACD,SAAS,GACT,QAAQ,GACR,cAAc,GACd,gBAAgB,GAChB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,YAAY,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAEF,KAAK,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAEhC,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,CAgH9D,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,231 @@
|
|
|
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, ...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
|
+
return (_jsxs(Flex, Object.assign({ as: StyledStep, container: { inline: true }, error: error }, { children: [_jsxs(Flex, Object.assign({ 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, Object.assign({ target: iconEl }, { children: visual.title }), void 0), _jsxs(Flex, Object.assign({ as: StyledStepValue, item: { grow: 2 }, error: error, container: { inline: true, alignItems: 'center' } }, { children: [_jsx(StyledStepValueInput, Object.assign({ value: stepValue, type: 'text', ref: setInputEl, error: error, onChange: onInputChange, "aria-label": stepValue, id: item.id }, restProps), void 0), badge?.type && (_jsx(Flex, Object.assign({ as: StyledStepBadge, container: { inline: true, alignItems: 'center' } }, { children: _jsx(Status, Object.assign({ variant: badge?.type || 'success' }, { children: badge?.label }), void 0) }), void 0))] }), void 0), _jsx(Tooltip, Object.assign({ target: inputEl, hideDelay: 'none' }, { children: error || tooltipValue || 'test' }), void 0), _jsx(Flex, Object.assign({ 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, Object.assign({ target: actionEl, "aria-hidden": 'true' }, { children: actions && actions?.length > 1 ? actionsLabel : singleActionLabel }), void 0)] }), void 0));
|
|
229
|
+
};
|
|
230
|
+
export default Step;
|
|
231
|
+
//# sourceMappingURL=Step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Step.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA+D,MAAM,OAAO,CAAC;AAC9F,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;AAkDjC,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;YACX,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM;QAER;YACE,OAAO,GAAG,SAAS,CAAC;KACvB;IAED,MAAM,aAAa,GAAG,aAAa,CA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M,YACxB,EACV,KAAC,IAAI,kBAAC,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,gBAC3E,YAAY,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,iBAAG,YAChE,EACP,KAAC,OAAO,kBAAC,MAAM,EAAE,QAAQ,iBAAc,MAAM,gBAC1C,OAAO,IAAI,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,YAC1D,aACL,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { useState, FunctionComponent, PropsWithoutRef, ChangeEvent, MouseEvent } 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 onChange?: (param: LifeCycleActionParam, e: ChangeEvent<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 ...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 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 />\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"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FunctionComponent, ChangeEvent } from 'react';
|
|
2
|
+
import { BaseProps, ForwardProps, FormControlProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { StepProps } from './Step';
|
|
4
|
+
import { TaskItemProps, StageItemProps, CategoryItemProps, LifeCycleAction, LifeCycleActionParam } from './LifeCycle.types';
|
|
5
|
+
export interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {
|
|
6
|
+
/** Pass an array of Action objects to append button(s) inline with the Input. */
|
|
7
|
+
actions?: LifeCycleAction[];
|
|
8
|
+
/** Tooltip for adding items to the task component */
|
|
9
|
+
addStepTitle: string;
|
|
10
|
+
/** Region for adding the task component */
|
|
11
|
+
addTask: {
|
|
12
|
+
title: string;
|
|
13
|
+
showOnce: boolean;
|
|
14
|
+
onAddTask?: LifeCycleAction['onClick'];
|
|
15
|
+
};
|
|
16
|
+
onAddStep?: LifeCycleAction['onClick'];
|
|
17
|
+
onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;
|
|
18
|
+
}
|
|
19
|
+
interface TaskComponentProps extends BaseProps, TaskProps {
|
|
20
|
+
/** Pass text for the task. */
|
|
21
|
+
value?: string;
|
|
22
|
+
/** support for an Avatar, Icon, or other supporting visual. */
|
|
23
|
+
visual: {
|
|
24
|
+
imgurl: string;
|
|
25
|
+
};
|
|
26
|
+
/** Pass task data */
|
|
27
|
+
item: TaskItemProps;
|
|
28
|
+
error?: string;
|
|
29
|
+
/** Step Props */
|
|
30
|
+
step?: StepProps;
|
|
31
|
+
/** Stage data to pass it as callback */
|
|
32
|
+
stageItem: StageItemProps;
|
|
33
|
+
/** Category data to pass it as callback */
|
|
34
|
+
categoryItem: CategoryItemProps;
|
|
35
|
+
id: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const StyledTaskList: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
|
|
38
|
+
export declare const StyledCardHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {}, never>;
|
|
39
|
+
export declare const StyledCardContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
40
|
+
export declare const StyledInput: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, {
|
|
41
|
+
error: string | undefined;
|
|
42
|
+
}, never>;
|
|
43
|
+
export declare const StyledTaskActions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
44
|
+
ref: HTMLDivElement;
|
|
45
|
+
error: string;
|
|
46
|
+
}, never>;
|
|
47
|
+
export declare const StyledTask: import("styled-components").StyledComponent<"article", import("styled-components").DefaultTheme, {}, never>;
|
|
48
|
+
export declare const StyledInputWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
49
|
+
declare const Task: FunctionComponent<TaskComponentProps & ForwardProps>;
|
|
50
|
+
export default Task;
|
|
51
|
+
//# sourceMappingURL=Task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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IAC1B,2CAA2C;IAC3C,YAAY,EAAE,iBAAiB,CAAC;IAChC,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,eAAO,MAAM,cAAc,wGAQzB,CAAC;AAEH,eAAO,MAAM,gBAAgB,4GAK3B,CAAC;AAGH,eAAO,MAAM,iBAAiB,yGAI5B,CAAC;AAGH,eAAO,MAAM,WAAW;WAAyB,MAAM,GAAG,SAAS;SA+BjE,CAAC;AAGH,eAAO,MAAM,iBAAiB;SACvB,cAAc;WACZ,MAAM;SAoBb,CAAC;AAGH,eAAO,MAAM,UAAU,6GAoBrB,CAAC;AAGH,eAAO,MAAM,kBAAkB,yGAQ9B,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAwJ9D,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
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 { Flex, defaultThemeProp, Button, Icon, Tooltip, useElement, Actions, useI18n, Avatar, StyledTooltip } from '@pega/cosmos-react-core';
|
|
5
|
+
import Step from './Step';
|
|
6
|
+
export const StyledTaskList = styled.li(({ theme }) => {
|
|
7
|
+
return css `
|
|
8
|
+
list-style-type: none;
|
|
9
|
+
margin-block-end: ${theme.base.spacing};
|
|
10
|
+
&:last-child > article {
|
|
11
|
+
margin-block-end: 0;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
});
|
|
15
|
+
export const StyledCardHeader = styled.header(({ theme }) => {
|
|
16
|
+
return css `
|
|
17
|
+
padding: 0;
|
|
18
|
+
margin: 0 0 calc(0.5 * ${theme.base.spacing});
|
|
19
|
+
`;
|
|
20
|
+
});
|
|
21
|
+
StyledCardHeader.defaultProps = defaultThemeProp;
|
|
22
|
+
export const StyledCardContent = styled.div(() => {
|
|
23
|
+
return css `
|
|
24
|
+
padding: 0;
|
|
25
|
+
`;
|
|
26
|
+
});
|
|
27
|
+
StyledCardContent.defaultProps = defaultThemeProp;
|
|
28
|
+
export const StyledInput = styled.input(({ error, theme }) => {
|
|
29
|
+
return css `
|
|
30
|
+
height: ${theme.components.input.height};
|
|
31
|
+
padding: 0 calc(0.5 * ${theme.base.spacing});
|
|
32
|
+
text-overflow: ellipsis;
|
|
33
|
+
border: 0.0625rem solid transparent;
|
|
34
|
+
border-radius: calc(0.5 * ${theme.base['border-radius']});
|
|
35
|
+
width: 100%;
|
|
36
|
+
outline: none;
|
|
37
|
+
&:hover {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
&:disabled {
|
|
41
|
+
cursor: not-allowed;
|
|
42
|
+
}
|
|
43
|
+
${error
|
|
44
|
+
? css `
|
|
45
|
+
background: ${theme.base.colors.red['extra-light']};
|
|
46
|
+
border: 0.0625rem solid ${theme.base.colors.red.medium};
|
|
47
|
+
`
|
|
48
|
+
: css `
|
|
49
|
+
background: ${theme.base.palette['primary-background']};
|
|
50
|
+
&&:hover {
|
|
51
|
+
background: ${theme.base.palette['secondary-background']};
|
|
52
|
+
}
|
|
53
|
+
&&:focus:enabled {
|
|
54
|
+
border: 0.0625rem solid ${theme.base.colors.blue.medium};
|
|
55
|
+
background: ${theme.base.palette['primary-background']};
|
|
56
|
+
}
|
|
57
|
+
`}
|
|
58
|
+
`;
|
|
59
|
+
});
|
|
60
|
+
StyledInput.defaultProps = defaultThemeProp;
|
|
61
|
+
export const StyledTaskActions = styled.div(({ error }) => {
|
|
62
|
+
return css `
|
|
63
|
+
border: none;
|
|
64
|
+
visibility: hidden;
|
|
65
|
+
&:hover {
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
}
|
|
68
|
+
${error &&
|
|
69
|
+
css `
|
|
70
|
+
visibility: visible;
|
|
71
|
+
`}
|
|
72
|
+
&:focus-within {
|
|
73
|
+
${StyledTooltip} {
|
|
74
|
+
${css `
|
|
75
|
+
display: none;
|
|
76
|
+
`}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
});
|
|
81
|
+
StyledTaskActions.defaultProps = defaultThemeProp;
|
|
82
|
+
export const StyledTask = styled.article(({ theme }) => {
|
|
83
|
+
return css `
|
|
84
|
+
background: ${theme.base.palette['primary-background']};
|
|
85
|
+
border-radius: calc(0.5 * ${theme.base['border-radius']});
|
|
86
|
+
padding: ${theme.base.spacing};
|
|
87
|
+
&:focus-within,
|
|
88
|
+
&:hover {
|
|
89
|
+
${StyledTaskActions} {
|
|
90
|
+
${css `
|
|
91
|
+
visibility: visible;
|
|
92
|
+
`}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
&:focus-within {
|
|
96
|
+
box-shadow: 0 0 0.2rem 0.0625rem ${theme.base.colors.blue.medium};
|
|
97
|
+
}
|
|
98
|
+
&:hover {
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
});
|
|
103
|
+
StyledTask.defaultProps = defaultThemeProp;
|
|
104
|
+
export const StyledInputWrapper = styled.div `
|
|
105
|
+
&:focus-within {
|
|
106
|
+
${StyledTooltip} {
|
|
107
|
+
${css `
|
|
108
|
+
display: none;
|
|
109
|
+
`}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
113
|
+
const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem, error, onAddStep, onChange, categoryItem, id, step: stepProp, ...restProps }) => {
|
|
114
|
+
const t = useI18n();
|
|
115
|
+
const [taskValue, setTaskValue] = useState(value);
|
|
116
|
+
const [actionEl, setActionEl] = useElement();
|
|
117
|
+
const [inputEl, setInputEl] = useElement();
|
|
118
|
+
const [addEl, setAddEl] = useElement();
|
|
119
|
+
const actionsLabel = t('actions');
|
|
120
|
+
const singleActionLabel = actions?.[0]?.text || '';
|
|
121
|
+
const onActionItemClick = (actionId, e) => {
|
|
122
|
+
const param = {
|
|
123
|
+
task: item,
|
|
124
|
+
stage: stageItem,
|
|
125
|
+
category: categoryItem
|
|
126
|
+
};
|
|
127
|
+
actions?.forEach(actionItem => {
|
|
128
|
+
if (actionItem.id === actionId) {
|
|
129
|
+
actionItem.onClick(param, e);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
/* Deep copy of actions is required to provide consistent callback objects on actions */
|
|
134
|
+
const actionsClone = [];
|
|
135
|
+
if (actions) {
|
|
136
|
+
actions.forEach(actionItem => {
|
|
137
|
+
const actionCloneItem = {};
|
|
138
|
+
Object.keys(actionItem).forEach((key) => {
|
|
139
|
+
actionCloneItem[key] = actionItem[key];
|
|
140
|
+
});
|
|
141
|
+
actionCloneItem.onClick = onActionItemClick;
|
|
142
|
+
actionsClone.push(actionCloneItem);
|
|
143
|
+
return actionItem;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const onInputChange = (e) => {
|
|
147
|
+
setTaskValue(e.target.value);
|
|
148
|
+
const param = {
|
|
149
|
+
value: taskValue,
|
|
150
|
+
task: item,
|
|
151
|
+
stage: stageItem,
|
|
152
|
+
category: categoryItem
|
|
153
|
+
};
|
|
154
|
+
onChange?.(param, e);
|
|
155
|
+
};
|
|
156
|
+
const onAddStepClick = (e) => {
|
|
157
|
+
const param = {
|
|
158
|
+
task: item,
|
|
159
|
+
stage: stageItem,
|
|
160
|
+
category: categoryItem
|
|
161
|
+
};
|
|
162
|
+
onAddStep?.(param, e);
|
|
163
|
+
};
|
|
164
|
+
return (_jsx(Flex, Object.assign({ as: StyledTaskList }, restProps, { children: _jsxs(Flex, Object.assign({ as: StyledTask, container: { direction: 'column' }, role: 'region' }, { children: [_jsxs(Flex, Object.assign({ as: StyledCardHeader, container: { itemGap: 0.4 } }, { children: [visual?.imgurl.length > 0 && _jsx(Avatar, { name: taskValue || '', imageSrc: visual?.imgurl }, void 0), _jsxs(Flex, Object.assign({ 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 }, void 0), taskValue && (_jsx(Tooltip, Object.assign({ target: inputEl, hideDelay: 'none' }, { children: error || taskValue }), void 0))] }), void 0), _jsxs(Flex, Object.assign({ as: StyledTaskActions, ref: setActionEl, error: error }, { children: [actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }, void 0), _jsx(Tooltip, Object.assign({ target: actionEl, "aria-hidden": 'true' }, { children: actions && actions?.length > 1 ? actionsLabel : singleActionLabel }), void 0)] }), void 0)] }), void 0), _jsxs(Flex, Object.assign({ as: StyledCardContent }, { children: [item?.steps.map((steps) => {
|
|
165
|
+
const badgeStatus = steps?.status?.type ? steps.status.type : '';
|
|
166
|
+
const badgeLabel = steps?.status?.label ? steps.status.label : '';
|
|
167
|
+
return (_jsx(Step, Object.assign({ id: steps.id, value: steps.label, visual: {
|
|
168
|
+
imgurl: steps.visual.imgurl,
|
|
169
|
+
color: steps.visual.color,
|
|
170
|
+
icon: steps.visual.icon,
|
|
171
|
+
title: steps.visual.label
|
|
172
|
+
}, item: steps, taskItem: item, stageItem: stageItem, badge: {
|
|
173
|
+
type: badgeStatus,
|
|
174
|
+
label: badgeLabel
|
|
175
|
+
}, error: steps.error, categoryItem: categoryItem }, stepProp), steps.id));
|
|
176
|
+
}), _jsxs(Flex, { children: [_jsx(Button, Object.assign({ 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, Object.assign({ target: addEl, "aria-hidden": 'true' }, { children: `${t('add')} ${addStepTitle}` }), void 0)] }, void 0)] }), void 0)] }), void 0) }), void 0));
|
|
177
|
+
};
|
|
178
|
+
export default Task;
|
|
179
|
+
//# sourceMappingURL=Task.js.map
|
|
@@ -0,0 +1 @@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CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,YACtB,YACL,aACF,aACF,YACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { useState, FunctionComponent, PropsWithChildren, ChangeEvent, MouseEvent } 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}\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 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 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 />\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"]}
|
|
@@ -0,0 +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,EACrB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +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} from './LifeCycle.types';\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export { default as AppHeader } from './components/AppHeader';
|
|
|
2
2
|
export * from './components/AppHeader';
|
|
3
3
|
export { default as AppShell } from './components/AppShell';
|
|
4
4
|
export * from './components/AppShell';
|
|
5
|
+
export { default as LifeCycle } from './components/LifeCycle';
|
|
6
|
+
export * from './components/LifeCycle';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -3,4 +3,6 @@ export { default as AppHeader } from './components/AppHeader';
|
|
|
3
3
|
export * from './components/AppHeader';
|
|
4
4
|
export { default as AppShell } from './components/AppShell';
|
|
5
5
|
export * from './components/AppShell';
|
|
6
|
+
export { default as LifeCycle } from './components/LifeCycle';
|
|
7
|
+
export * from './components/LifeCycle';
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport { default as AppHeader } from './components/AppHeader';\nexport * from './components/AppHeader';\nexport { default as AppShell } from './components/AppShell';\nexport * from './components/AppShell';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport { default as AppHeader } from './components/AppHeader';\nexport * from './components/AppHeader';\nexport { default as AppShell } from './components/AppShell';\nexport * from './components/AppShell';\nexport { default as LifeCycle } from './components/LifeCycle';\nexport * from './components/LifeCycle';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-build",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.14.1",
|
|
4
4
|
"author": "Pegasystems",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -20,23 +20,23 @@
|
|
|
20
20
|
"build": "tsc -b"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pega/cosmos-react-core": "2.0.0-dev.
|
|
24
|
-
"@pega/cosmos-react-dnd": "2.0.0-dev.
|
|
23
|
+
"@pega/cosmos-react-core": "2.0.0-dev.14.1",
|
|
24
|
+
"@pega/cosmos-react-dnd": "2.0.0-dev.14.1",
|
|
25
25
|
"polished": "^4.1.0",
|
|
26
26
|
"react": "^16.14.0 || ^17.0.0",
|
|
27
27
|
"react-dom": "^16.14.0 || ^17.0.0",
|
|
28
28
|
"styled-components": "^5.2.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@storybook/addon-a11y": "^6.3.
|
|
32
|
-
"@storybook/addon-actions": "^6.3.
|
|
33
|
-
"@storybook/addon-backgrounds": "^6.3.
|
|
34
|
-
"@storybook/addon-knobs": "^6.3.
|
|
35
|
-
"@storybook/addon-storysource": "^6.3.
|
|
36
|
-
"@storybook/addon-toolbars": "^6.3.
|
|
37
|
-
"@storybook/addons": "^6.3.
|
|
38
|
-
"@storybook/react": "^6.3.
|
|
39
|
-
"@storybook/theming": "^6.3.
|
|
31
|
+
"@storybook/addon-a11y": "^6.3.8",
|
|
32
|
+
"@storybook/addon-actions": "^6.3.8",
|
|
33
|
+
"@storybook/addon-backgrounds": "^6.3.8",
|
|
34
|
+
"@storybook/addon-knobs": "^6.3.1",
|
|
35
|
+
"@storybook/addon-storysource": "^6.3.8",
|
|
36
|
+
"@storybook/addon-toolbars": "^6.3.8",
|
|
37
|
+
"@storybook/addons": "^6.3.8",
|
|
38
|
+
"@storybook/react": "^6.3.8",
|
|
39
|
+
"@storybook/theming": "^6.3.8",
|
|
40
40
|
"enzyme": "^3.11.0",
|
|
41
41
|
"enzyme-adapter-react-16": "^1.15.5",
|
|
42
42
|
"typescript": "~4.4.2"
|