@pega/cosmos-react-build 3.0.0-dev.1.0 → 3.0.0-dev.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AppHeader/AppHeader.d.ts +4 -2
- package/lib/components/AppHeader/AppHeader.d.ts.map +1 -1
- package/lib/components/AppHeader/AppHeader.js +9 -8
- package/lib/components/AppHeader/AppHeader.js.map +1 -1
- package/lib/components/AppHeader/AppHeader.styles.d.ts +1 -1
- package/lib/components/AppHeader/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppHeader/AppHeader.styles.js +4 -18
- package/lib/components/AppHeader/AppHeader.styles.js.map +1 -1
- package/lib/components/AppHeader/BranchButton.js +1 -1
- package/lib/components/AppHeader/BranchButton.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts +1 -0
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +15 -20
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +1 -0
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +17 -2
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +6 -9
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts +1 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +9 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js +235 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts +23 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts.map +1 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js +2 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js.map +1 -0
- package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts +308 -0
- package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts.map +1 -0
- package/lib/components/DynamicContentEditor/PegaCustomElement.js +23 -0
- package/lib/components/DynamicContentEditor/PegaCustomElement.js.map +1 -0
- package/lib/components/DynamicContentEditor/index.d.ts +3 -0
- package/lib/components/DynamicContentEditor/index.d.ts.map +1 -0
- package/lib/components/DynamicContentEditor/index.js +2 -0
- package/lib/components/DynamicContentEditor/index.js.map +1 -0
- package/lib/components/FlowModeller/AddNode.d.ts +9 -7
- package/lib/components/FlowModeller/AddNode.d.ts.map +1 -1
- package/lib/components/FlowModeller/AddNode.js +9 -3
- package/lib/components/FlowModeller/AddNode.js.map +1 -1
- package/lib/components/FlowModeller/Connector.d.ts +7 -0
- package/lib/components/FlowModeller/Connector.d.ts.map +1 -0
- package/lib/components/FlowModeller/Connector.js +34 -0
- package/lib/components/FlowModeller/Connector.js.map +1 -0
- package/lib/components/FlowModeller/DeletePopover.d.ts +19 -0
- package/lib/components/FlowModeller/DeletePopover.d.ts.map +1 -0
- package/lib/components/FlowModeller/DeletePopover.js +105 -0
- package/lib/components/FlowModeller/DeletePopover.js.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.d.ts +6 -2
- package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -1
- package/lib/components/FlowModeller/FlowModeller.js +108 -57
- package/lib/components/FlowModeller/FlowModeller.js.map +1 -1
- package/lib/components/FlowModeller/Node/Node.types.d.ts +14 -9
- package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/Node.types.js +2 -3
- package/lib/components/FlowModeller/Node/Node.types.js.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +7 -4
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +21 -11
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.js +37 -18
- package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -1
- package/lib/components/FlowModeller/Node.d.ts +5 -0
- package/lib/components/FlowModeller/Node.d.ts.map +1 -0
- package/lib/components/FlowModeller/Node.js +22 -0
- package/lib/components/FlowModeller/Node.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Connectors.d.ts +2 -0
- package/lib/components/FlowModeller/Renderer/Connectors.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Connectors.js +5 -3
- package/lib/components/FlowModeller/Renderer/Connectors.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Nodes.d.ts +2 -0
- package/lib/components/FlowModeller/Renderer/Nodes.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Nodes.js +3 -3
- package/lib/components/FlowModeller/Renderer/Nodes.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Renderer.js +2 -2
- package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +10 -4
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +3 -3
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js +7 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +8 -4
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js +23 -3
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js.map +1 -1
- package/lib/components/FlowModeller/Utils/{AddNodeUtils.d.ts → addNodeUtils.d.ts} +1 -1
- package/lib/components/FlowModeller/Utils/{AddNodeUtils.d.ts.map → addNodeUtils.d.ts.map} +1 -1
- package/lib/components/FlowModeller/Utils/{AddNodeUtils.js → addNodeUtils.js} +1 -1
- package/lib/components/FlowModeller/Utils/addNodeUtils.js.map +1 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts +29 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts.map +1 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js +71 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js.map +1 -0
- package/lib/components/FlowModeller/helper.d.ts +4 -7
- package/lib/components/FlowModeller/helper.d.ts.map +1 -1
- package/lib/components/FlowModeller/helper.js +67 -43
- package/lib/components/FlowModeller/helper.js.map +1 -1
- package/lib/components/FlowModeller/index.d.ts +5 -1
- package/lib/components/FlowModeller/index.d.ts.map +1 -1
- package/lib/components/FlowModeller/index.js +5 -1
- package/lib/components/FlowModeller/index.js.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.d.ts +8 -6
- package/lib/components/ItemLibrary/ItemLibrary.d.ts.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.js +6 -5
- package/lib/components/ItemLibrary/ItemLibrary.js.map +1 -1
- package/lib/components/LifeCycle/Category.d.ts.map +1 -1
- package/lib/components/LifeCycle/Category.js +11 -8
- package/lib/components/LifeCycle/Category.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.js +2 -3
- package/lib/components/LifeCycle/LifeCycle.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.types.d.ts +2 -4
- package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycleList.d.ts +1 -1
- package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycleList.js +3 -2
- package/lib/components/LifeCycle/LifeCycleList.js.map +1 -1
- package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
- package/lib/components/LifeCycle/Stage.js +8 -17
- package/lib/components/LifeCycle/Stage.js.map +1 -1
- package/lib/components/LifeCycle/Step.d.ts +3 -6
- package/lib/components/LifeCycle/Step.d.ts.map +1 -1
- package/lib/components/LifeCycle/Step.js +20 -42
- package/lib/components/LifeCycle/Step.js.map +1 -1
- package/lib/components/LifeCycle/Task.d.ts +4 -1
- package/lib/components/LifeCycle/Task.d.ts.map +1 -1
- package/lib/components/LifeCycle/Task.js +17 -10
- package/lib/components/LifeCycle/Task.js.map +1 -1
- package/lib/components/LifeCycle/index.d.ts +1 -2
- package/lib/components/LifeCycle/index.d.ts.map +1 -1
- package/lib/components/LifeCycle/index.js.map +1 -1
- package/lib/components/ObjectPreview/ObjectPreview.d.ts +16 -0
- package/lib/components/ObjectPreview/ObjectPreview.d.ts.map +1 -0
- package/lib/components/ObjectPreview/ObjectPreview.js +25 -0
- package/lib/components/ObjectPreview/ObjectPreview.js.map +1 -0
- package/lib/components/ObjectPreview/index.d.ts +3 -0
- package/lib/components/ObjectPreview/index.d.ts.map +1 -0
- package/lib/components/ObjectPreview/index.js +3 -0
- package/lib/components/ObjectPreview/index.js.map +1 -0
- package/lib/components/ObjectSelect/ObjectConfig.d.ts +18 -0
- package/lib/components/ObjectSelect/ObjectConfig.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectConfig.js +24 -0
- package/lib/components/ObjectSelect/ObjectConfig.js.map +1 -0
- package/lib/components/ObjectSelect/ObjectPicker.d.ts +11 -0
- package/lib/components/ObjectSelect/ObjectPicker.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectPicker.js +26 -0
- package/lib/components/ObjectSelect/ObjectPicker.js.map +1 -0
- package/lib/components/ObjectSelect/ObjectSelect.d.ts +27 -0
- package/lib/components/ObjectSelect/ObjectSelect.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectSelect.js +25 -0
- package/lib/components/ObjectSelect/ObjectSelect.js.map +1 -0
- package/lib/components/ObjectSelect/ObjectSummary.d.ts +22 -0
- package/lib/components/ObjectSelect/ObjectSummary.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectSummary.js +50 -0
- package/lib/components/ObjectSelect/ObjectSummary.js.map +1 -0
- package/lib/components/ObjectSelect/index.d.ts +3 -0
- package/lib/components/ObjectSelect/index.d.ts.map +1 -0
- package/lib/components/ObjectSelect/index.js +2 -0
- package/lib/components/ObjectSelect/index.js.map +1 -0
- package/lib/components/PageTemplates/GalleryPage.js +4 -4
- package/lib/components/PageTemplates/GalleryPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +3 -3
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +29 -48
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/SummaryCard/SummaryCard.d.ts +2 -3
- package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -1
- package/lib/components/SummaryCard/SummaryCard.js +3 -4
- package/lib/components/SummaryCard/SummaryCard.js.map +1 -1
- package/lib/components/Workbench/ConfigurationPanel.d.ts.map +1 -1
- package/lib/components/Workbench/ConfigurationPanel.js +3 -4
- package/lib/components/Workbench/ConfigurationPanel.js.map +1 -1
- package/lib/components/Workbench/Toolbar.d.ts +1 -5
- package/lib/components/Workbench/Toolbar.d.ts.map +1 -1
- package/lib/components/Workbench/Toolbar.js +8 -8
- package/lib/components/Workbench/Toolbar.js.map +1 -1
- package/lib/components/Workbench/UtilityPanel.js +1 -1
- package/lib/components/Workbench/UtilityPanel.js.map +1 -1
- package/lib/components/Workbench/Workbench.d.ts.map +1 -1
- package/lib/components/Workbench/Workbench.js +2 -3
- package/lib/components/Workbench/Workbench.js.map +1 -1
- package/lib/components/Workbench/Workbench.styles.d.ts +2 -3
- package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -1
- package/lib/components/Workbench/Workbench.styles.js +23 -23
- package/lib/components/Workbench/Workbench.styles.js.map +1 -1
- package/lib/components/Workbench/Workbench.types.d.ts +0 -2
- package/lib/components/Workbench/Workbench.types.d.ts.map +1 -1
- package/lib/components/Workbench/Workbench.types.js.map +1 -1
- package/lib/index.d.ts +6 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/utils.d.ts +14 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/lib/utils/utils.js +13 -0
- package/lib/utils/utils.js.map +1 -0
- package/package.json +19 -14
- package/lib/components/FlowModeller/Utils/AddNodeUtils.js.map +0 -1
- package/lib/components/Visual/Visual.d.ts +0 -17
- package/lib/components/Visual/Visual.d.ts.map +0 -1
- package/lib/components/Visual/Visual.js +0 -28
- package/lib/components/Visual/Visual.js.map +0 -1
- package/lib/components/Visual/index.d.ts +0 -3
- package/lib/components/Visual/index.d.ts.map +0 -1
- package/lib/components/Visual/index.js +0 -3
- package/lib/components/Visual/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stage.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Stage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAEjB,GAAG,EACH,WAAW,EACX,UAAU,EAEX,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,SAAS,EACT,YAAY,EAKZ,gBAAgB,EAMjB,MAAM,yBAAyB,CAAC;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C;IACrB,2DAA2D;IAC3D,IAAI,EAAE,cAAc,CAAC;IAErB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,yGAEzB,CAAC;AAEF,eAAO,MAAM,cAAc;WAAuB,MAAM;SAatD,CAAC;AAIH,eAAO,MAAM,WAAW;WAAyB,MAAM,GAAG,SAAS;SA+BjE,CAAC;AAIH,eAAO,MAAM,kBAAkB;;SAiB7B,CAAC;AAIH,eAAO,MAAM,WAAW;YAEZ,OAAO;SA2IjB,CAAC;AAIH,eAAO,MAAM,kBAAkB,yGAQ9B,CAAC;AAEF,QAAA,MAAM,KAAK,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CA2IhE,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -7,8 +7,8 @@ export const StyledWrapper = styled.div `
|
|
|
7
7
|
`;
|
|
8
8
|
export const StyledDragIcon = styled.div(({ theme, error }) => {
|
|
9
9
|
return css `
|
|
10
|
-
width:
|
|
11
|
-
|
|
10
|
+
width: 1.5rem;
|
|
11
|
+
visibility: hidden;
|
|
12
12
|
${error &&
|
|
13
13
|
css `
|
|
14
14
|
display: block;
|
|
@@ -19,6 +19,7 @@ export const StyledDragIcon = styled.div(({ theme, error }) => {
|
|
|
19
19
|
text-align: center;
|
|
20
20
|
`;
|
|
21
21
|
});
|
|
22
|
+
StyledDragIcon.defaultProps = defaultThemeProp;
|
|
22
23
|
export const StyledInput = styled.input(({ error, theme }) => {
|
|
23
24
|
return css `
|
|
24
25
|
height: ${theme.components.input.height};
|
|
@@ -51,6 +52,7 @@ export const StyledInput = styled.input(({ error, theme }) => {
|
|
|
51
52
|
`}
|
|
52
53
|
`;
|
|
53
54
|
});
|
|
55
|
+
StyledInput.defaultProps = defaultThemeProp;
|
|
54
56
|
export const StyledStageActions = styled.div(({ theme, error }) => {
|
|
55
57
|
return css `
|
|
56
58
|
z-index: 2;
|
|
@@ -67,6 +69,7 @@ export const StyledStageActions = styled.div(({ theme, error }) => {
|
|
|
67
69
|
}
|
|
68
70
|
`;
|
|
69
71
|
});
|
|
72
|
+
StyledStageActions.defaultProps = defaultThemeProp;
|
|
70
73
|
export const StyledStage = styled.div(({ stageInfo, theme, status }) => {
|
|
71
74
|
const { visual: { bgColor, bgHover, tailPointed, headPointed } } = stageInfo;
|
|
72
75
|
const { rtl } = useDirection();
|
|
@@ -89,20 +92,8 @@ export const StyledStage = styled.div(({ stageInfo, theme, status }) => {
|
|
|
89
92
|
|
|
90
93
|
&:hover {
|
|
91
94
|
cursor: pointer;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
0% {
|
|
95
|
-
transform: scale(0);
|
|
96
|
-
}
|
|
97
|
-
100% {
|
|
98
|
-
transform: scale(1);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
animation: anim ${theme.base.animation.speed} ${theme.base.animation.timing.ease};
|
|
102
|
-
width: 10%;
|
|
103
|
-
transition: width ${theme.base.animation.speed};
|
|
104
|
-
}
|
|
105
|
-
${StyledStageActions} {
|
|
95
|
+
|
|
96
|
+
${StyledDragIcon},${StyledStageActions} {
|
|
106
97
|
${css `
|
|
107
98
|
visibility: visible;
|
|
108
99
|
`}
|
|
@@ -288,7 +279,7 @@ const Stage = forwardRef(({ value, actions, stageInfo, onChange, onFocus, onBlur
|
|
|
288
279
|
return actionItem;
|
|
289
280
|
});
|
|
290
281
|
}
|
|
291
|
-
return (_jsx(Flex, { container: { inline: true }, as: StyledStage, ...restProps, ref: ref, stageInfo: stageInfo, status: error, role: 'columnheader', children: _jsxs(Flex, { as: StyledWrapper, container: { inline: true }, children: [_jsx(Flex, { as: StyledDragIcon, error: error, children: _jsx(Icon, { name: 'drag' }
|
|
282
|
+
return (_jsx(Flex, { container: { inline: true }, as: StyledStage, ...restProps, ref: ref, stageInfo: stageInfo, status: error, role: 'columnheader', id: item.id, children: _jsxs(Flex, { as: StyledWrapper, container: { inline: true }, children: [item.type !== 'alternate' && item.type !== 'alternate-wait' && (_jsx(Flex, { as: StyledDragIcon, error: error, children: _jsx(Icon, { name: 'drag' }) })), _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, onChange: onInputChange, "aria-label": stageName, onFocus: onInputFocus, onBlur: onInputBlur }), stageName && (_jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || stageName }))] }), _jsx(StyledStageActions, { error: error, children: actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }) })] })] }) }));
|
|
292
283
|
});
|
|
293
284
|
export default Stage;
|
|
294
285
|
//# sourceMappingURL=Stage.js.map
|
|
@@ -1 +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;AAEhD,OAAO,EACL,IAAI,EAGJ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,UAAU,EAEV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EAEb,YAAY,EACb,MAAM,yBAAyB,CAAC;AAuCjC,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,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AK,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';\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 {\n LifeCycleAction,\n LifeCycleActionParam,\n StageInfo,\n StageItemProps,\n StageType\n} 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?: Record<StageType, LifeCycleAction[]> | 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 /** onBlur of input */\n onBlur?: (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 stageInfo: StageInfo;\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, 'stageInfo'> & {\n status: boolean;\n }\n>(({ stageInfo, theme, status }) => {\n const {\n visual: { bgColor, bgHover, tailPointed, headPointed }\n } = stageInfo;\n\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 1rem 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 1rem;\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 }\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 stageInfo,\n onChange,\n onFocus,\n onBlur,\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: e.target.value,\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 onInputBlur = (e: FocusEvent<HTMLInputElement>) => {\n setStageName(e.target.value);\n const param: LifeCycleActionParam = {\n value: e.target.value,\n stage: item\n };\n onBlur?.(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\n if (actions) {\n let actionsList: LifeCycleAction[] = [];\n\n if (Array.isArray(actions)) {\n actionsList = actions;\n } else {\n actionsList = actions[item.type];\n }\n\n actionsList?.forEach((actionItem: LifeCycleAction) => {\n if (actionItem.id === actionId) {\n actionItem.onClick?.(param, e);\n }\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 let actionsList: LifeCycleAction[] = [];\n if (Array.isArray(actions)) {\n actionsList = actions;\n } else {\n actionsList = actions[item.type];\n }\n\n actionsList.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 stageInfo={stageInfo}\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 onBlur={onInputBlur}\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"]}
|
|
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;AAEhD,OAAO,EACL,IAAI,EAGJ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,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AI,EAAC,MAAM,EACX,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,gBACX,SAAS,EACrB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,WAAW,GACnB,EACD,SAAS,IAAI,CACZ,KAAC,OAAO,IAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,YACvC,KAAK,IAAI,SAAS,GACX,CACX,IACI,EACP,KAAC,kBAAkB,IAAC,KAAK,EAAE,KAAK,YAC7B,YAAY,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,SAAG,GAClD,IAChB,IACF,GACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,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';\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 {\n LifeCycleAction,\n LifeCycleActionParam,\n StageInfo,\n StageItemProps,\n StageType\n} 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?: Record<StageType, LifeCycleAction[]> | 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 /** onBlur of input */\n onBlur?: (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 stageInfo: StageInfo;\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: 1.5rem;\n visibility: hidden;\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\nStyledDragIcon.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 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\nStyledInput.defaultProps = defaultThemeProp;\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\nStyledStageActions.defaultProps = defaultThemeProp;\n\nexport const StyledStage = styled.div<\n Pick<StageComponentProps, 'stageInfo'> & {\n status: boolean;\n }\n>(({ stageInfo, theme, status }) => {\n const {\n visual: { bgColor, bgHover, tailPointed, headPointed }\n } = stageInfo;\n\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\n ${StyledDragIcon},${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 1rem 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 1rem;\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 }\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 stageInfo,\n onChange,\n onFocus,\n onBlur,\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: e.target.value,\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 onInputBlur = (e: FocusEvent<HTMLInputElement>) => {\n setStageName(e.target.value);\n const param: LifeCycleActionParam = {\n value: e.target.value,\n stage: item\n };\n onBlur?.(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\n if (actions) {\n let actionsList: LifeCycleAction[] = [];\n\n if (Array.isArray(actions)) {\n actionsList = actions;\n } else {\n actionsList = actions[item.type];\n }\n\n actionsList?.forEach((actionItem: LifeCycleAction) => {\n if (actionItem.id === actionId) {\n actionItem.onClick?.(param, e);\n }\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 let actionsList: LifeCycleAction[] = [];\n if (Array.isArray(actions)) {\n actionsList = actions;\n } else {\n actionsList = actions[item.type];\n }\n\n actionsList.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 stageInfo={stageInfo}\n status={error}\n role='columnheader'\n id={item.id}\n >\n <Flex as={StyledWrapper} container={{ inline: true }}>\n {item.type !== 'alternate' && item.type !== 'alternate-wait' && (\n <Flex as={StyledDragIcon} error={error}>\n <Icon name='drag' />\n </Flex>\n )}\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 onChange={onInputChange}\n aria-label={stageName}\n onFocus={onInputFocus}\n onBlur={onInputBlur}\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"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent, ChangeEvent, FocusEvent } from 'react';
|
|
2
2
|
import { BaseProps, ForwardProps, FormControlProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { ColorName } from '../../utils';
|
|
3
4
|
import { TaskItemProps, StepItemProps, StageItemProps, CategoryItemProps, LifeCycleAction, LifeCycleActionParam } from './LifeCycle.types';
|
|
4
5
|
export interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {
|
|
5
6
|
/** Pass an array of Action objects to append button(s) inline with the Input. */
|
|
@@ -21,7 +22,7 @@ interface StepComponentProps extends BaseProps, StepProps {
|
|
|
21
22
|
* Icon and label are passed as normal string */
|
|
22
23
|
visual: {
|
|
23
24
|
imgurl: string;
|
|
24
|
-
color:
|
|
25
|
+
color: ColorName;
|
|
25
26
|
icon: string;
|
|
26
27
|
title: string;
|
|
27
28
|
};
|
|
@@ -32,11 +33,7 @@ interface StepComponentProps extends BaseProps, StepProps {
|
|
|
32
33
|
taskItem: TaskItemProps;
|
|
33
34
|
categoryItem: CategoryItemProps;
|
|
34
35
|
}
|
|
35
|
-
export declare const StyledStepType: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme,
|
|
36
|
-
color: string;
|
|
37
|
-
ref: HTMLDivElement;
|
|
38
|
-
img: string;
|
|
39
|
-
}, never>;
|
|
36
|
+
export declare const StyledStepType: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StepComponentProps, never>;
|
|
40
37
|
export declare const StyledStepBadge: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
41
38
|
export declare const StyledStepValueInput: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, {
|
|
42
39
|
error: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,WAAW,EACX,UAAU,EAEX,MAAM,OAAO,CAAC;AAIf,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,mBAAmB;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACnF,kCAAkC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,EAAE,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACjF,iCAAiC;IACjC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,EAAE,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CACjF;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,
|
|
1
|
+
{"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../../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AC,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,yHAiBzB,CAAC;AAIH,eAAO,MAAM,eAAe,yGAY1B,CAAC;AAgBH,eAAO,MAAM,oBAAoB;WAAyB,MAAM,GAAG,SAAS;SAoC3E,CAAC;AAIF,eAAO,MAAM,gBAAgB;WACpB,MAAM;WACN,MAAM;SAqBb,CAAC;AAIH,eAAO,MAAM,UAAU;WAAuB,MAAM;SAkDlD,CAAC;AAIH,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAyI9D,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -3,51 +3,25 @@ import { useState } from 'react';
|
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { readableColor } from 'polished';
|
|
5
5
|
import { Flex, defaultThemeProp, Icon, Tooltip, useElement, Status, Actions, useI18n, Avatar, StyledTooltip } from '@pega/cosmos-react-core';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
case 'magenta':
|
|
10
|
-
bgColor = '#AC1361';
|
|
11
|
-
break;
|
|
12
|
-
case 'studio':
|
|
13
|
-
bgColor = '#684AAE';
|
|
14
|
-
break;
|
|
15
|
-
case 'congressBlue':
|
|
16
|
-
bgColor = '#0076d1';
|
|
17
|
-
break;
|
|
18
|
-
case 'Japaneselaurel':
|
|
19
|
-
bgColor = '#27813E';
|
|
20
|
-
break;
|
|
21
|
-
case 'violet':
|
|
22
|
-
bgColor = '#8C479F';
|
|
23
|
-
break;
|
|
24
|
-
case 'yellow':
|
|
25
|
-
bgColor = '#f7a801';
|
|
26
|
-
break;
|
|
27
|
-
case 'darkyellow':
|
|
28
|
-
bgColor = '#f7951c';
|
|
29
|
-
break;
|
|
30
|
-
case 'orange':
|
|
31
|
-
bgColor = '#f46c22';
|
|
32
|
-
break;
|
|
33
|
-
default:
|
|
34
|
-
bgColor = '#27813E';
|
|
35
|
-
}
|
|
6
|
+
import { colorMap } from '../../utils';
|
|
7
|
+
export const StyledStepType = styled.div(({ visual, theme }) => {
|
|
8
|
+
const bgColor = colorMap[visual.color];
|
|
36
9
|
const contrastColor = readableColor(bgColor);
|
|
37
|
-
return
|
|
10
|
+
return visual.imgurl
|
|
38
11
|
? css `
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
12
|
+
height: 2rem;
|
|
13
|
+
padding-inline-end: calc(0.25 * ${theme.base.spacing});
|
|
14
|
+
`
|
|
42
15
|
: css `
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
16
|
+
background: ${bgColor};
|
|
17
|
+
margin: calc(0.5 * ${theme.base.spacing});
|
|
18
|
+
padding: 0 calc(0.5 * ${theme.base.spacing});
|
|
19
|
+
color: ${contrastColor};
|
|
20
|
+
text-align: center;
|
|
21
|
+
border-radius: calc(0.25 * ${theme.base['border-radius']});
|
|
22
|
+
`;
|
|
50
23
|
});
|
|
24
|
+
StyledStepType.defaultProps = defaultThemeProp;
|
|
51
25
|
export const StyledStepBadge = styled.div(({ theme }) => {
|
|
52
26
|
return css `
|
|
53
27
|
padding: 0 calc(0.5 * ${theme.base.spacing});
|
|
@@ -61,6 +35,7 @@ export const StyledStepBadge = styled.div(({ theme }) => {
|
|
|
61
35
|
}
|
|
62
36
|
`;
|
|
63
37
|
});
|
|
38
|
+
StyledStepBadge.defaultProps = defaultThemeProp;
|
|
64
39
|
const StyledStepValue = styled.div(({ theme, error }) => {
|
|
65
40
|
return css `
|
|
66
41
|
border-radius: calc(0.5 * ${theme.base['border-radius']});
|
|
@@ -70,6 +45,7 @@ const StyledStepValue = styled.div(({ theme, error }) => {
|
|
|
70
45
|
`}
|
|
71
46
|
`;
|
|
72
47
|
});
|
|
48
|
+
StyledStepValue.defaultProps = defaultThemeProp;
|
|
73
49
|
export const StyledStepValueInput = styled.input(({ error, theme }) => {
|
|
74
50
|
return css `
|
|
75
51
|
height: ${theme.components.input.height};
|
|
@@ -105,6 +81,7 @@ export const StyledStepValueInput = styled.input(({ error, theme }) => {
|
|
|
105
81
|
`}
|
|
106
82
|
`;
|
|
107
83
|
});
|
|
84
|
+
StyledStepValueInput.defaultProps = defaultThemeProp;
|
|
108
85
|
export const StyledStepStatus = styled.div(({ theme, badge, error }) => {
|
|
109
86
|
return css `
|
|
110
87
|
border: none;
|
|
@@ -126,6 +103,7 @@ export const StyledStepStatus = styled.div(({ theme, badge, error }) => {
|
|
|
126
103
|
`}
|
|
127
104
|
`;
|
|
128
105
|
});
|
|
106
|
+
StyledStepStatus.defaultProps = defaultThemeProp;
|
|
129
107
|
export const StyledStep = styled.div(({ theme, error }) => {
|
|
130
108
|
return css `
|
|
131
109
|
background: ${theme.base.palette['secondary-background']};
|
|
@@ -245,7 +223,7 @@ const Step = ({ value, id, visual, actions, badge, error, onChange, categoryItem
|
|
|
245
223
|
};
|
|
246
224
|
onBlur?.(actionParam, e);
|
|
247
225
|
};
|
|
248
|
-
return (_jsxs(Flex, { as: StyledStep, container: { inline: true }, error: error, children: [_jsxs(Flex, { as: StyledStepType,
|
|
226
|
+
return (_jsxs(Flex, { as: StyledStep, container: { inline: true }, error: error, id: id, children: [_jsxs(Flex, { as: StyledStepType, visual: visual, ref: setIconEl, children: [visual.imgurl.length > 0 && (_jsx(Avatar, { name: visual.title || '', imageSrc: visual?.imgurl, shape: 'squircle', size: 'm' })), !visual.imgurl && _jsx(Icon, { name: visual.icon })] }), _jsx(Tooltip, { target: iconEl, children: visual.title }), _jsxs(Flex, { as: StyledStepValue, item: { grow: 2 }, error: error, container: { inline: true, alignItems: 'center' }, children: [_jsx(StyledStepValueInput, { value: stepValue, type: 'text', ref: setInputEl, error: error, onChange: onInputChange, "aria-label": stepValue, ...restProps, onFocus: onInputFocus, onBlur: onInputBlur }), badge?.type && (_jsx(Flex, { as: StyledStepBadge, container: { inline: true, alignItems: 'center' }, children: _jsx(Status, { variant: badge?.type || 'success', children: badge?.label }) }))] }), _jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || tooltipValue || 'test' }), _jsx(Flex, { as: StyledStepStatus, ref: setActionEl, badge: badge?.type, error: error, children: actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }) }), _jsx(Tooltip, { target: actionEl, "aria-hidden": 'true', children: actions && actions?.length > 1 ? actionsLabel : singleActionLabel })] }));
|
|
249
227
|
};
|
|
250
228
|
export default Step;
|
|
251
229
|
//# sourceMappingURL=Step.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAMT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,IAAI,EACJ,gBAAgB,EAGhB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,MAAM,EAEN,OAAO,EACP,OAAO,EACP,MAAM,EACN,aAAa,EAEd,MAAM,yBAAyB,CAAC;AAuDjC,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,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M,EAAE,CAAC,EAAE,QAAQ,iBAAG,WAChE,EACP,KAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,iBAAc,MAAM,YAC1C,OAAO,IAAI,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,WAC1D,YACL,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithoutRef,\n ChangeEvent,\n FocusEvent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Icon,\n Tooltip,\n useElement,\n Status,\n FormControlProps,\n Actions,\n useI18n,\n Avatar,\n StyledTooltip,\n Action\n} from '@pega/cosmos-react-core';\n\nimport {\n TaskItemProps,\n StepItemProps,\n StageItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Input Change */\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n /** callback for Blur of input */\n onBlur?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n}\n\ninterface StepComponentProps extends BaseProps, StepProps {\n /** Pass text for the step. */\n value?: string;\n /** step data id */\n id?: string;\n /** Determines the visual for icon, color and label to render.\n * This color is passed as a variant and accessible colors are used to display.\n * Icon and label are passed as normal string */\n visual: {\n imgurl: string;\n color:\n | 'magenta'\n | 'studio'\n | 'congressBlue'\n | 'Japaneselaurel'\n | 'violet'\n | 'yellow'\n | 'orange'\n | 'darkyellow';\n icon: string;\n title: string;\n };\n /* Determines the variant and label for the badges */\n badge?: StepItemProps['status'];\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /* Data of the steps which can be used to send the full info back */\n item: StepItemProps;\n stageItem: StageItemProps;\n taskItem: TaskItemProps;\n categoryItem: CategoryItemProps;\n}\n\nexport const StyledStepType = styled.div<{ color: string; ref: HTMLDivElement; img: string }>(\n ({ theme, color, img }) => {\n let bgColor = '';\n switch (color) {\n case 'magenta':\n bgColor = '#AC1361';\n break;\n case 'studio':\n bgColor = '#684AAE';\n break;\n case 'congressBlue':\n bgColor = '#0076d1';\n break;\n case 'Japaneselaurel':\n bgColor = '#27813E';\n break;\n case 'violet':\n bgColor = '#8C479F';\n break;\n case 'yellow':\n bgColor = '#f7a801';\n break;\n case 'darkyellow':\n bgColor = '#f7951c';\n break;\n case 'orange':\n bgColor = '#f46c22';\n break;\n\n default:\n bgColor = '#27813E';\n }\n\n const contrastColor = readableColor(bgColor);\n return img\n ? css`\n height: 2rem;\n padding-inline-end: calc(0.25 * ${theme.base.spacing});\n `\n : css`\n background: ${bgColor};\n margin: calc(0.5 * ${theme.base.spacing});\n padding: 0 calc(0.5 * ${theme.base.spacing});\n color: ${contrastColor};\n text-align: center;\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n `;\n }\n);\n\nexport const StyledStepBadge = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n justify-content: flex-end;\n width: auto;\n max-width: calc(50% - ${theme.base.spacing});\n > span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n `;\n});\n\nconst StyledStepValue = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n ${error &&\n css`\n background: ${theme.base.colors.red['extra-light']};\n `}\n `;\n});\n\nexport const StyledStepValueInput = styled.input<{ error: string | undefined }>(\n ({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n border: none;\n border-inline-start: 0.0625rem solid transparent;\n border-inline-end: 0.0625rem solid transparent;\n text-overflow: ellipsis;\n min-width: 40%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n &:focus:enabled {\n border-color: ${theme.base.colors.red.medium};\n }\n `\n : css`\n background: ${theme.base.palette['secondary-background']};\n &&:hover {\n background: ${theme.base.palette['app-background']};\n }\n &&:focus:enabled {\n background: ${theme.base.palette['primary-background']};\n border-color: ${theme.base.colors.blue.medium};\n }\n `}\n `;\n }\n);\n\nexport const StyledStepStatus = styled.div<{\n badge: string;\n error: string;\n}>(({ theme, badge, error }) => {\n return css`\n border: none;\n ${badge &&\n css`\n display: none;\n `}\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n &:focus:not([disabled]) {\n outline: 0.0625rem solid ${theme.base.colors.blue.medium};\n }\n ${error &&\n !badge &&\n css`\n visibility: visible;\n `}\n `;\n});\n\nexport const StyledStep = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n width: 100%;\n ${error &&\n css`\n border-color: ${theme.base.colors.red.medium};\n box-shadow: none;\n `}\n &:hover {\n cursor: pointer;\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n visibility: visible;\n display: inline-block;\n `}\n }\n }\n &:focus-within {\n ${!error &&\n css`\n border-color: ${theme.base.colors.blue.medium};\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n `}\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n display: inline-block;\n visibility: visible;\n `}\n }\n ${StyledTooltip} {\n ${css`\n visibility: hidden;\n `}\n }\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nconst Step: FunctionComponent<StepComponentProps & ForwardProps> = ({\n value,\n id,\n visual,\n actions,\n badge,\n error,\n onChange,\n categoryItem,\n item,\n stageItem,\n taskItem,\n onFocus,\n onBlur,\n ...restProps\n}: PropsWithoutRef<StepComponentProps>) => {\n const t = useI18n();\n const [stepValue, setStepValue] = useState(value);\n const [iconEl, setIconEl] = useElement();\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) ?? '';\n const tooltipValue = stepValue || error;\n\n /* Need to check the value with statusProps */\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: taskItem,\n stage: stageItem,\n step: item,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setStepValue(e.target.value);\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onChange?.(actionParam, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onFocus?.(actionParam, e);\n };\n\n const onInputBlur = (e: FocusEvent<HTMLInputElement>) => {\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onBlur?.(actionParam, e);\n };\n\n return (\n <Flex as={StyledStep} container={{ inline: true }} error={error}>\n <Flex as={StyledStepType} color={visual.color} ref={setIconEl} img={visual.imgurl}>\n {visual.imgurl.length > 0 && (\n <Avatar name={visual.title || ''} imageSrc={visual?.imgurl} shape='squircle' size='m' />\n )}\n {!visual.imgurl && <Icon name={visual.icon} />}\n </Flex>\n\n <Tooltip target={iconEl}>{visual.title}</Tooltip>\n\n <Flex\n as={StyledStepValue}\n item={{ grow: 2 }}\n error={error}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledStepValueInput\n value={stepValue}\n type='text'\n ref={setInputEl}\n error={error}\n onChange={onInputChange}\n aria-label={stepValue}\n id={item.id}\n {...restProps}\n onFocus={onInputFocus}\n onBlur={onInputBlur}\n />\n {badge?.type && (\n <Flex as={StyledStepBadge} container={{ inline: true, alignItems: 'center' }}>\n <Status variant={badge?.type || 'success'}>{badge?.label}</Status>\n </Flex>\n )}\n </Flex>\n <Tooltip target={inputEl} hideDelay='none'>\n {error || tooltipValue || 'test'}\n </Tooltip>\n <Flex as={StyledStepStatus} ref={setActionEl} badge={badge?.type} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n </Flex>\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n );\n};\n\nexport default Step;\n"]}
|
|
1
|
+
{"version":3,"file":"Step.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAMT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,IAAI,EACJ,gBAAgB,EAGhB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,MAAM,EAEN,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AG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,YAC3E,YAAY,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,SAAG,GAChE,EACP,KAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,iBAAc,MAAM,YAC1C,OAAO,IAAI,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,GAC1D,IACL,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithoutRef,\n ChangeEvent,\n FocusEvent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Icon,\n Tooltip,\n useElement,\n Status,\n FormControlProps,\n Actions,\n useI18n,\n Avatar,\n StyledTooltip,\n Action\n} from '@pega/cosmos-react-core';\n\nimport { colorMap, ColorName } from '../../utils';\n\nimport {\n TaskItemProps,\n StepItemProps,\n StageItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Input Change */\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n /** callback for Blur of input */\n onBlur?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n}\n\ninterface StepComponentProps extends BaseProps, StepProps {\n /** Pass text for the step. */\n value?: string;\n /** step data id */\n id?: string;\n /** Determines the visual for icon, color and label to render.\n * This color is passed as a variant and accessible colors are used to display.\n * Icon and label are passed as normal string */\n visual: {\n imgurl: string;\n color: ColorName;\n icon: string;\n title: string;\n };\n /* Determines the variant and label for the badges */\n badge?: StepItemProps['status'];\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /* Data of the steps which can be used to send the full info back */\n item: StepItemProps;\n stageItem: StageItemProps;\n taskItem: TaskItemProps;\n categoryItem: CategoryItemProps;\n}\n\nexport const StyledStepType = styled.div<StepComponentProps>(({ visual, theme }) => {\n const bgColor = colorMap[visual.color];\n\n const contrastColor = readableColor(bgColor);\n return visual.imgurl\n ? css`\n height: 2rem;\n padding-inline-end: calc(0.25 * ${theme.base.spacing});\n `\n : css`\n background: ${bgColor};\n margin: calc(0.5 * ${theme.base.spacing});\n padding: 0 calc(0.5 * ${theme.base.spacing});\n color: ${contrastColor};\n text-align: center;\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n `;\n});\n\nStyledStepType.defaultProps = defaultThemeProp;\n\nexport const StyledStepBadge = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n justify-content: flex-end;\n width: auto;\n max-width: calc(50% - ${theme.base.spacing});\n > span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n `;\n});\n\nStyledStepBadge.defaultProps = defaultThemeProp;\n\nconst StyledStepValue = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n ${error &&\n css`\n background: ${theme.base.colors.red['extra-light']};\n `}\n `;\n});\n\nStyledStepValue.defaultProps = defaultThemeProp;\n\nexport const StyledStepValueInput = styled.input<{ error: string | undefined }>(\n ({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n border: none;\n border-inline-start: 0.0625rem solid transparent;\n border-inline-end: 0.0625rem solid transparent;\n text-overflow: ellipsis;\n min-width: 40%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n &:focus:enabled {\n border-color: ${theme.base.colors.red.medium};\n }\n `\n : css`\n background: ${theme.base.palette['secondary-background']};\n &&:hover {\n background: ${theme.base.palette['app-background']};\n }\n &&:focus:enabled {\n background: ${theme.base.palette['primary-background']};\n border-color: ${theme.base.colors.blue.medium};\n }\n `}\n `;\n }\n);\n\nStyledStepValueInput.defaultProps = defaultThemeProp;\n\nexport const StyledStepStatus = styled.div<{\n badge: string;\n error: string;\n}>(({ theme, badge, error }) => {\n return css`\n border: none;\n ${badge &&\n css`\n display: none;\n `}\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n &:focus:not([disabled]) {\n outline: 0.0625rem solid ${theme.base.colors.blue.medium};\n }\n ${error &&\n !badge &&\n css`\n visibility: visible;\n `}\n `;\n});\n\nStyledStepStatus.defaultProps = defaultThemeProp;\n\nexport const StyledStep = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n width: 100%;\n ${error &&\n css`\n border-color: ${theme.base.colors.red.medium};\n box-shadow: none;\n `}\n &:hover {\n cursor: pointer;\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n visibility: visible;\n display: inline-block;\n `}\n }\n }\n &:focus-within {\n ${!error &&\n css`\n border-color: ${theme.base.colors.blue.medium};\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n `}\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n display: inline-block;\n visibility: visible;\n `}\n }\n ${StyledTooltip} {\n ${css`\n visibility: hidden;\n `}\n }\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nconst Step: FunctionComponent<StepComponentProps & ForwardProps> = ({\n value,\n id,\n visual,\n actions,\n badge,\n error,\n onChange,\n categoryItem,\n item,\n stageItem,\n taskItem,\n onFocus,\n onBlur,\n ...restProps\n}: PropsWithoutRef<StepComponentProps>) => {\n const t = useI18n();\n const [stepValue, setStepValue] = useState(value);\n const [iconEl, setIconEl] = useElement();\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) ?? '';\n const tooltipValue = stepValue || error;\n\n /* Need to check the value with statusProps */\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: taskItem,\n stage: stageItem,\n step: item,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setStepValue(e.target.value);\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onChange?.(actionParam, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onFocus?.(actionParam, e);\n };\n\n const onInputBlur = (e: FocusEvent<HTMLInputElement>) => {\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onBlur?.(actionParam, e);\n };\n\n return (\n <Flex as={StyledStep} container={{ inline: true }} error={error} id={id}>\n <Flex as={StyledStepType} visual={visual} ref={setIconEl}>\n {visual.imgurl.length > 0 && (\n <Avatar name={visual.title || ''} imageSrc={visual?.imgurl} shape='squircle' size='m' />\n )}\n {!visual.imgurl && <Icon name={visual.icon} />}\n </Flex>\n\n <Tooltip target={iconEl}>{visual.title}</Tooltip>\n\n <Flex\n as={StyledStepValue}\n item={{ grow: 2 }}\n error={error}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledStepValueInput\n value={stepValue}\n type='text'\n ref={setInputEl}\n error={error}\n onChange={onInputChange}\n aria-label={stepValue}\n {...restProps}\n onFocus={onInputFocus}\n onBlur={onInputBlur}\n />\n {badge?.type && (\n <Flex as={StyledStepBadge} container={{ inline: true, alignItems: 'center' }}>\n <Status variant={badge?.type || 'success'}>{badge?.label}</Status>\n </Flex>\n )}\n </Flex>\n <Tooltip target={inputEl} hideDelay='none'>\n {error || tooltipValue || 'test'}\n </Tooltip>\n <Flex as={StyledStepStatus} ref={setActionEl} badge={badge?.type} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n </Flex>\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n );\n};\n\nexport default Step;\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent, ChangeEvent, FocusEvent } from 'react';
|
|
2
2
|
import { BaseProps, ForwardProps, FormControlProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { LibraryItem } from '../ItemLibrary';
|
|
3
4
|
import { StepProps } from './Step';
|
|
4
5
|
import { TaskItemProps, StageItemProps, CategoryItemProps, LifeCycleAction, LifeCycleActionParam } from './LifeCycle.types';
|
|
5
6
|
export interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {
|
|
@@ -13,12 +14,14 @@ export interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {
|
|
|
13
14
|
showOnce: boolean;
|
|
14
15
|
onAddTask?: LifeCycleAction['onClick'];
|
|
15
16
|
};
|
|
16
|
-
onAddStep?:
|
|
17
|
+
onAddStep?: (param: LifeCycleActionParam, selectedItem: LibraryItem) => void;
|
|
17
18
|
onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;
|
|
18
19
|
/** callback for Focus of input */
|
|
19
20
|
onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;
|
|
20
21
|
/** callback for Blur of input */
|
|
21
22
|
onBlur?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;
|
|
23
|
+
/** Types of Nodes */
|
|
24
|
+
nodeLibrary: LibraryItem[];
|
|
22
25
|
}
|
|
23
26
|
interface TaskComponentProps extends BaseProps, TaskProps {
|
|
24
27
|
/** Pass text for the task. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,WAAW,EACX,UAAU,
|
|
1
|
+
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,WAAW,EACX,UAAU,EAGX,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,SAAS,EACT,YAAY,EAOZ,gBAAgB,EAMjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAE1D,OAAa,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EACL,aAAa,EACb,cAAc,EAEd,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxE,iFAAiF;IACjF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H,eAAO,MAAM,gBAAgB,4GAK3B,CAAC;AAIH,eAAO,MAAM,iBAAiB,yGAI5B,CAAC;AAEH,eAAO,MAAM,WAAW;WAAyB,MAAM,GAAG,SAAS;SA+BjE,CAAC;AAIH,eAAO,MAAM,iBAAiB;SACvB,cAAc;WACZ,MAAM;SAoBb,CAAC;AAEH,eAAO,MAAM,UAAU,6GAoBrB,CAAC;AAIH,eAAO,MAAM,kBAAkB,yGAQ9B,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAqM9D,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Flex, defaultThemeProp, Button, Icon, Tooltip, useElement, Actions, useI18n, Avatar, StyledTooltip } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Flex, defaultThemeProp, Button, Icon, Tooltip, useElement, Actions, useI18n, Avatar, StyledTooltip, useOuterEvent, useEscape } from '@pega/cosmos-react-core';
|
|
5
|
+
import { ItemLibrary } from '../ItemLibrary';
|
|
5
6
|
import Step from './Step';
|
|
6
7
|
export const StyledTaskList = styled.li(({ theme }) => {
|
|
7
8
|
return css `
|
|
@@ -12,6 +13,7 @@ export const StyledTaskList = styled.li(({ theme }) => {
|
|
|
12
13
|
}
|
|
13
14
|
`;
|
|
14
15
|
});
|
|
16
|
+
StyledTaskList.defaultProps = defaultThemeProp;
|
|
15
17
|
export const StyledCardHeader = styled.header(({ theme }) => {
|
|
16
18
|
return css `
|
|
17
19
|
padding: 0;
|
|
@@ -24,7 +26,6 @@ export const StyledCardContent = styled.div(() => {
|
|
|
24
26
|
padding: 0;
|
|
25
27
|
`;
|
|
26
28
|
});
|
|
27
|
-
StyledCardContent.defaultProps = defaultThemeProp;
|
|
28
29
|
export const StyledInput = styled.input(({ error, theme }) => {
|
|
29
30
|
return css `
|
|
30
31
|
height: ${theme.components.input.height};
|
|
@@ -78,7 +79,6 @@ export const StyledTaskActions = styled.div(({ error }) => {
|
|
|
78
79
|
}
|
|
79
80
|
`;
|
|
80
81
|
});
|
|
81
|
-
StyledTaskActions.defaultProps = defaultThemeProp;
|
|
82
82
|
export const StyledTask = styled.article(({ theme }) => {
|
|
83
83
|
return css `
|
|
84
84
|
background: ${theme.base.palette['primary-background']};
|
|
@@ -110,9 +110,11 @@ export const StyledInputWrapper = styled.div `
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
`;
|
|
113
|
-
const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem, error, onAddStep, onChange, onFocus, onBlur, categoryItem, id, step: stepProp, ...restProps }) => {
|
|
113
|
+
const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem, error, onAddStep, onChange, onFocus, onBlur, categoryItem, id, step: stepProp, nodeLibrary, ...restProps }) => {
|
|
114
114
|
const t = useI18n();
|
|
115
115
|
const [taskValue, setTaskValue] = useState(value);
|
|
116
|
+
const [showLibrary, setLibrary] = useState(false);
|
|
117
|
+
const [popoverEl, setPopoverEl] = useElement(null);
|
|
116
118
|
const [actionEl, setActionEl] = useElement();
|
|
117
119
|
const [inputEl, setInputEl] = useElement();
|
|
118
120
|
const [addEl, setAddEl] = useElement();
|
|
@@ -171,15 +173,20 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
|
|
|
171
173
|
};
|
|
172
174
|
onBlur?.(param, e);
|
|
173
175
|
};
|
|
174
|
-
const
|
|
176
|
+
const onLibraryItemSelect = useCallback((libItem) => {
|
|
175
177
|
const param = {
|
|
176
178
|
task: item,
|
|
177
179
|
stage: stageItem,
|
|
178
180
|
category: categoryItem
|
|
179
181
|
};
|
|
180
|
-
onAddStep?.(param,
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
onAddStep?.(param, libItem);
|
|
183
|
+
setLibrary(false);
|
|
184
|
+
}, [onAddStep]);
|
|
185
|
+
useEscape(() => {
|
|
186
|
+
setLibrary(false);
|
|
187
|
+
});
|
|
188
|
+
useOuterEvent('mousedown', [addEl, popoverEl], () => setLibrary(false));
|
|
189
|
+
return (_jsx(Flex, { as: StyledTaskList, id: item.id, ...restProps, children: _jsxs(Flex, { as: StyledTask, container: { direction: 'column' }, role: 'region', children: [_jsxs(Flex, { as: StyledCardHeader, container: { itemGap: 0.4 }, children: [visual?.imgurl.length > 0 && _jsx(Avatar, { name: taskValue || '', imageSrc: visual?.imgurl }), _jsxs(Flex, { item: { grow: 1 }, as: StyledInputWrapper, container: { inline: true, alignItems: 'center' }, children: [_jsx(StyledInput, { value: taskValue, type: 'text', onChange: onInputChange, ref: setInputEl, error: error, "aria-labelledby": categoryItem.categoryId, onFocus: onInputFocus, onBlur: onInputBlur }), taskValue && (_jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || taskValue }))] }), _jsxs(Flex, { as: StyledTaskActions, ref: setActionEl, error: error, children: [actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }), _jsx(Tooltip, { target: actionEl, "aria-hidden": 'true', children: actions && actions?.length > 1 ? actionsLabel : singleActionLabel })] })] }), _jsxs(Flex, { as: StyledCardContent, children: [item?.steps.map((steps) => {
|
|
183
190
|
const badgeStatus = steps?.status?.type ? steps.status.type : '';
|
|
184
191
|
const badgeLabel = steps?.status?.label ? steps.status.label : '';
|
|
185
192
|
return (_jsx(Step, { id: steps.id, value: steps.label, visual: {
|
|
@@ -191,7 +198,7 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
|
|
|
191
198
|
type: badgeStatus,
|
|
192
199
|
label: badgeLabel
|
|
193
200
|
}, error: steps.error, categoryItem: categoryItem, ...stepProp }, steps.id));
|
|
194
|
-
}), _jsxs(Flex, { children: [_jsx(Button, { variant: 'simple', label: addStepTitle, onClick:
|
|
201
|
+
}), _jsxs(Flex, { children: [_jsx(Button, { variant: 'simple', label: addStepTitle, onClick: () => setLibrary(!showLibrary), ref: setAddEl, icon: true, "aria-label": `${t('add')} ${addStepTitle}`, children: _jsx(Icon, { name: 'plus' }) }), _jsx(Tooltip, { target: addEl, "aria-hidden": 'true', children: `${t('add')} ${addStepTitle}` }), _jsx(ItemLibrary, { items: nodeLibrary, show: showLibrary, target: addEl, onClick: onLibraryItemSelect, ref: setPopoverEl, placeholder: t('search_nodes') })] })] })] }) }));
|
|
195
202
|
};
|
|
196
203
|
export default Task;
|
|
197
204
|
//# sourceMappingURL=Task.js.map
|