@pega/cosmos-react-build 3.0.0-dev.3.0 → 3.0.0-dev.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +12 -10
- package/lib/components/AppHeader/AppHeader.js.map +1 -1
- package/lib/components/AppHeader/AppHeader.styles.d.ts +1 -3
- package/lib/components/AppHeader/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppHeader/AppHeader.styles.js +5 -22
- package/lib/components/AppHeader/AppHeader.styles.js.map +1 -1
- package/lib/components/AppHeader/BranchButton.d.ts.map +1 -1
- package/lib/components/AppHeader/BranchButton.js +22 -18
- package/lib/components/AppHeader/BranchButton.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +21 -20
- package/lib/components/AppShell/AppShell.js.map +1 -1
- 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/DynamicContentEditor/DynamicContentEditor.d.ts +3 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js +173 -42
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts +6 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js.map +1 -1
- package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts +307 -3
- package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/PegaCustomElement.js +21 -21
- package/lib/components/DynamicContentEditor/PegaCustomElement.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts +8 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +124 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts +8 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +517 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts +35 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js +2 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts +13 -0
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js +46 -0
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts +6 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js +51 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts +14 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js +81 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts +74 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js +2 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilderContext.d.ts +7 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilderContext.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilderContext.js +6 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilderContext.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts +6 -0
- package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionDetails.js +12 -0
- package/lib/components/ExpressionBuilder/ExpressionDetails.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionItem.d.ts +6 -0
- package/lib/components/ExpressionBuilder/ExpressionItem.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionItem.js +43 -0
- package/lib/components/ExpressionBuilder/ExpressionItem.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts +6 -0
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionList.js +32 -0
- package/lib/components/ExpressionBuilder/ExpressionList.js.map +1 -0
- package/lib/components/ExpressionBuilder/index.d.ts +8 -0
- package/lib/components/ExpressionBuilder/index.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/index.js +6 -0
- package/lib/components/ExpressionBuilder/index.js.map +1 -0
- package/lib/components/FlowModeller/AddNode.d.ts +11 -9
- 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 +71 -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 +136 -0
- package/lib/components/FlowModeller/DeletePopover.js.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.d.ts +3 -19
- package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -1
- package/lib/components/FlowModeller/FlowModeller.js +187 -63
- package/lib/components/FlowModeller/FlowModeller.js.map +1 -1
- package/lib/components/FlowModeller/FlowModeller.types.d.ts +25 -0
- package/lib/components/FlowModeller/FlowModeller.types.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.types.js +2 -0
- package/lib/components/FlowModeller/FlowModeller.types.js.map +1 -0
- package/lib/components/FlowModeller/FlowModellerContext.d.ts +6 -0
- package/lib/components/FlowModeller/FlowModellerContext.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowModellerContext.js +7 -0
- package/lib/components/FlowModeller/FlowModellerContext.js.map +1 -0
- package/lib/components/FlowModeller/Node/Node.types.d.ts +22 -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 +6 -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 +43 -19
- 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/Renderer.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Renderer.js +37 -6
- package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +9 -9
- 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 +8 -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/GraphLayout.d.ts +2 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +19 -6
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +9 -6
- 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 +17 -0
- package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts.map +1 -0
- package/lib/components/FlowModeller/Utils/{AddNodeUtils.js → addNodeUtils.js} +58 -35
- package/lib/components/FlowModeller/Utils/addNodeUtils.js.map +1 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts +30 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts.map +1 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js +81 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js.map +1 -0
- package/lib/components/FlowModeller/helper.d.ts +18 -8
- package/lib/components/FlowModeller/helper.d.ts.map +1 -1
- package/lib/components/FlowModeller/helper.js +114 -55
- package/lib/components/FlowModeller/helper.js.map +1 -1
- package/lib/components/FlowModeller/index.d.ts +8 -3
- 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 -8
- 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 +17 -13
- 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 +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 +5 -8
- package/lib/components/LifeCycle/Step.d.ts.map +1 -1
- package/lib/components/LifeCycle/Step.js +10 -32
- package/lib/components/LifeCycle/Step.js.map +1 -1
- package/lib/components/LifeCycle/Task.d.ts +5 -3
- 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/ObjectPicker.d.ts +15 -0
- package/lib/components/ObjectSelect/ObjectPicker.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectPicker.js +40 -0
- package/lib/components/ObjectSelect/ObjectPicker.js.map +1 -0
- package/lib/components/ObjectSelect/ObjectSelect.d.ts +32 -0
- package/lib/components/ObjectSelect/ObjectSelect.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectSelect.js +41 -0
- package/lib/components/ObjectSelect/ObjectSelect.js.map +1 -0
- package/lib/components/ObjectSelect/ObjectSummary.d.ts +24 -0
- package/lib/components/ObjectSelect/ObjectSummary.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectSummary.js +45 -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/ObjectSelect/useCreateModal.d.ts +34 -0
- package/lib/components/ObjectSelect/useCreateModal.d.ts.map +1 -0
- package/lib/components/ObjectSelect/useCreateModal.js +61 -0
- package/lib/components/ObjectSelect/useCreateModal.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 +45 -37
- 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 +4 -15
- 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 +3 -4
- package/lib/components/Workbench/Workbench.js.map +1 -1
- package/lib/components/Workbench/Workbench.styles.d.ts +1 -1
- package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -1
- package/lib/components/Workbench/Workbench.styles.js +15 -16
- package/lib/components/Workbench/Workbench.styles.js.map +1 -1
- package/lib/components/Workbench/Workbench.types.d.ts +2 -4
- 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 +23 -14
- package/lib/components/FlowModeller/Renderer/Connectors.d.ts +0 -13
- package/lib/components/FlowModeller/Renderer/Connectors.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Connectors.js +0 -47
- package/lib/components/FlowModeller/Renderer/Connectors.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Nodes.d.ts +0 -9
- package/lib/components/FlowModeller/Renderer/Nodes.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Nodes.js +0 -25
- package/lib/components/FlowModeller/Renderer/Nodes.js.map +0 -1
- package/lib/components/FlowModeller/Utils/AddNodeUtils.d.ts +0 -16
- package/lib/components/FlowModeller/Utils/AddNodeUtils.d.ts.map +0 -1
- 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":"Step.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,WAAW,EACX,UAAU,EAEX,MAAM,OAAO,CAAC;A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,yGAY1B,CAAC;AAgBH,eAAO,MAAM,oBAAoB;WAAyB,MAAM,GAAG,SAAS;SAoC3E,CAAC;AAIF,eAAO,MAAM,gBAAgB;;;SAuB3B,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,38 +3,11 @@ 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
12
|
height: 2rem;
|
|
40
13
|
padding-inline-end: calc(0.25 * ${theme.base.spacing});
|
|
@@ -48,6 +21,7 @@ export const StyledStepType = styled.div(({ theme, color, img }) => {
|
|
|
48
21
|
border-radius: calc(0.25 * ${theme.base['border-radius']});
|
|
49
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(
|
|
226
|
+
return (_jsxs(Flex, { as: StyledStep, container: { inline: true }, error: error, id: id, children: [_jsxs(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(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/Life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K,EACZ,QAAQ,EAAE,aAAa,gBACX,SAAS,EACrB,EAAE,EAAE,IAAI,CAAC,EAAE,KACP,SAAS,EACb,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,WAAW,WACnB,EACD,KAAK,EAAE,IAAI,IAAI,CACd,KAAC,IAAI,IAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAC1E,KAAC,MAAM,IAAC,OAAO,EAAE,KAAK,EAAE,IAAI,IAAI,SAAS,YAAG,KAAK,EAAE,KAAK,WAAU,WAC7D,CACR,YACI,EACP,KAAC,OAAO,IAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,YACvC,KAAK,IAAI,YAAY,IAAI,MAAM,WACxB,EACV,KAAC,IAAI,IAAC,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,YAC3E,YAAY,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,iBAAG,WAChE,EACP,KAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,iBAAc,MAAM,YAC1C,OAAO,IAAI,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,WAC1D,YACL,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithoutRef,\n ChangeEvent,\n FocusEvent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Icon,\n Tooltip,\n useElement,\n Status,\n FormControlProps,\n Actions,\n useI18n,\n Avatar,\n StyledTooltip,\n Action\n} from '@pega/cosmos-react-core';\n\nimport {\n TaskItemProps,\n StepItemProps,\n StageItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Input Change */\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n /** 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,OAAO,EACP,OAAO,EACP,MAAM,EACN,aAAa,EAEd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;AA+ClD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CACtC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IACpB,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEvC,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,MAAM;QAClB,CAAC,CAAC,GAAG,CAAA;;4CAEiC,KAAK,CAAC,IAAI,CAAC,OAAO;SACrD;QACH,CAAC,CAAC,GAAG,CAAA;wBACa,OAAO;+BACA,KAAK,CAAC,IAAI,CAAC,OAAO;kC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E,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,aAEjD,KAAC,oBAAoB,IACnB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAC,MAAM,EACX,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,gBACX,SAAS,KACjB,SAAS,EACb,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,WAAW,GACnB,EACD,KAAK,EAAE,IAAI,IAAI,CACd,KAAC,IAAI,IAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAC1E,KAAC,MAAM,IAAC,OAAO,EAAE,KAAK,EAAE,IAAI,IAAI,SAAS,YAAG,KAAK,EAAE,KAAK,GAAU,GAC7D,CACR,IACI,EACP,KAAC,OAAO,IAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,YACvC,KAAK,IAAI,YAAY,IAAI,MAAM,GACxB,EACV,KAAC,gBAAgB,IAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,YACjE,YAAY,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,SAAG,GACpD,EACnB,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<Pick<StepComponentProps, 'visual'>>(\n ({ 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);\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 <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 </StyledStepType>\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 <StyledStepStatus ref={setActionEl} badge={badge?.type} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n </StyledStepStatus>\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. */
|
|
@@ -45,8 +48,7 @@ export declare const StyledInput: import("styled-components").StyledComponent<"i
|
|
|
45
48
|
error: string | undefined;
|
|
46
49
|
}, never>;
|
|
47
50
|
export declare const StyledTaskActions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
48
|
-
|
|
49
|
-
error: string;
|
|
51
|
+
error?: string | undefined;
|
|
50
52
|
}, never>;
|
|
51
53
|
export declare const StyledTask: import("styled-components").StyledComponent<"article", import("styled-components").DefaultTheme, {}, never>;
|
|
52
54
|
export declare const StyledInputWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -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,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,OAAO,CAAC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5B,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(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(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(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(
|
|
201
|
+
}), _jsxs("div", { 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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAMT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,gBAAgB,EAGhB,MAAM,EACN,IAAI,EAEJ,OAAO,EACP,UAAU,EACV,OAAO,EAEP,OAAO,EACP,MAAM,EACN,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,IAAmB,MAAM,QAAQ,CAAC;AAiDzC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,OAAO,GAAG,CAAA;;wBAEY,KAAK,CAAC,IAAI,CAAC,OAAO;;;;GAIvC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC1D,OAAO,GAAG,CAAA;;6BAEiB,KAAK,CAAC,IAAI,CAAC,OAAO;GAC5C,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE;IAC/C,OAAO,GAAG,CAAA;;GAET,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAgC,CA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,CAAC,KAAK;oCACzB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;oCACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;iCAC1B,EACD,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,IAAI,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE;oCACL,IAAI,EAAE,WAAW;oCACjB,KAAK,EAAE,UAAU;iCAClB,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,YAAY,EAAE,YAAY,KACtB,QAAQ,IAlBP,KAAK,CAAC,EAAE,CAmBb,CACH,CAAC;wBACJ,CAAC,CAAC,EACF,MAAC,IAAI,eACH,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,cAAc,EACvB,GAAG,EAAE,QAAQ,EACb,IAAI,sBACQ,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,YAEzC,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,WAAG,WACb,EACT,KAAC,OAAO,IAAC,MAAM,EAAE,KAAK,iBAAc,MAAM,YACvC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,WACtB,YACL,YACF,YACF,WACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithChildren,\n ChangeEvent,\n FocusEvent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Button,\n Icon,\n Action,\n Tooltip,\n useElement,\n Actions,\n FormControlProps,\n useI18n,\n Avatar,\n StyledTooltip\n} from '@pega/cosmos-react-core';\n\nimport Step, { StepProps } from './Step';\nimport {\n TaskItemProps,\n StageItemProps,\n StepItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Tooltip for adding items to the task component */\n addStepTitle: string;\n /** Region for adding the task component */\n addTask: {\n title: string;\n showOnce: boolean;\n onAddTask?: LifeCycleAction['onClick'];\n };\n onAddStep?: LifeCycleAction['onClick'];\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n /** callback for Blur of input */\n onBlur?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n}\n\ninterface TaskComponentProps extends BaseProps, TaskProps {\n /** Pass text for the task. */\n value?: string;\n /** support for an Avatar, Icon, or other supporting visual. */\n visual: {\n imgurl: string;\n };\n /** Pass task data */\n item: TaskItemProps;\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /** Step Props */\n step?: StepProps;\n /** Stage data to pass it as callback */\n stageItem: StageItemProps;\n /** Category data to pass it as callback */\n categoryItem: CategoryItemProps;\n id: string;\n}\n\nexport const StyledTaskList = styled.li(({ theme }) => {\n return css`\n list-style-type: none;\n margin-block-end: ${theme.base.spacing};\n &:last-child > article {\n margin-block-end: 0;\n }\n `;\n});\n\nexport const StyledCardHeader = styled.header(({ theme }) => {\n return css`\n padding: 0;\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n `;\n});\nStyledCardHeader.defaultProps = defaultThemeProp;\n\nexport const StyledCardContent = styled.div(() => {\n return css`\n padding: 0;\n `;\n});\nStyledCardContent.defaultProps = defaultThemeProp;\n\nexport const StyledInput = styled.input<{ error: string | undefined }>(({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n text-overflow: ellipsis;\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n width: 100%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n border: 0.0625rem solid ${theme.base.colors.red.medium};\n `\n : css`\n background: ${theme.base.palette['primary-background']};\n &&:hover {\n background: ${theme.base.palette['secondary-background']};\n }\n &&:focus:enabled {\n border: 0.0625rem solid ${theme.base.colors.blue.medium};\n background: ${theme.base.palette['primary-background']};\n }\n `}\n `;\n});\nStyledInput.defaultProps = defaultThemeProp;\n\nexport const StyledTaskActions = styled.div<{\n ref: HTMLDivElement;\n error: string;\n}>(({ error }) => {\n return css`\n border: none;\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n ${error &&\n css`\n visibility: visible;\n `}\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n `;\n});\nStyledTaskActions.defaultProps = defaultThemeProp;\n\nexport const StyledTask = styled.article(({ theme }) => {\n return css`\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding: ${theme.base.spacing};\n &:focus-within,\n &:hover {\n ${StyledTaskActions} {\n ${css`\n visibility: visible;\n `}\n }\n }\n &:focus-within {\n box-shadow: 0 0 0.2rem 0.0625rem ${theme.base.colors.blue.medium};\n }\n &:hover {\n cursor: pointer;\n }\n `;\n});\nStyledTask.defaultProps = defaultThemeProp;\n\nexport const StyledInputWrapper = styled.div`\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n`;\n\nconst Task: FunctionComponent<TaskComponentProps & ForwardProps> = ({\n value,\n visual,\n actions,\n item,\n addStepTitle,\n addTask,\n stageItem,\n error,\n onAddStep,\n onChange,\n onFocus,\n onBlur,\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: e.target.value,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onChange?.(param, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onFocus?.(param, e);\n };\n\n const onInputBlur = (e: FocusEvent<HTMLInputElement>) => {\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onBlur?.(param, e);\n };\n\n const onAddStepClick = (e: MouseEvent<HTMLButtonElement>) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onAddStep?.(param, e);\n };\n\n return (\n <Flex as={StyledTaskList} {...restProps}>\n <Flex as={StyledTask} container={{ direction: 'column' }} role='region'>\n <Flex as={StyledCardHeader} container={{ itemGap: 0.4 }}>\n {visual?.imgurl.length > 0 && <Avatar name={taskValue || ''} imageSrc={visual?.imgurl} />}\n <Flex\n item={{ grow: 1 }}\n as={StyledInputWrapper}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledInput\n value={taskValue}\n type='text'\n onChange={onInputChange}\n ref={setInputEl}\n error={error}\n id={item.id}\n aria-labelledby={categoryItem.categoryId}\n onFocus={onInputFocus}\n onBlur={onInputBlur}\n />\n {taskValue && (\n <Tooltip target={inputEl} hideDelay='none'>\n {error || taskValue}\n </Tooltip>\n )}\n </Flex>\n <Flex as={StyledTaskActions} ref={setActionEl} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n </Flex>\n <Flex as={StyledCardContent}>\n {item?.steps.map((steps: StepItemProps) => {\n const badgeStatus = steps?.status?.type ? steps.status.type : '';\n const badgeLabel = steps?.status?.label ? steps.status.label : '';\n return (\n <Step\n key={steps.id}\n id={steps.id}\n value={steps.label}\n visual={{\n imgurl: steps.visual.imgurl,\n color: steps.visual.color,\n icon: steps.visual.icon,\n title: steps.visual.label\n }}\n item={steps}\n taskItem={item}\n stageItem={stageItem}\n badge={{\n type: badgeStatus,\n label: badgeLabel\n }}\n error={steps.error}\n categoryItem={categoryItem}\n {...stepProp}\n />\n );\n })}\n <Flex>\n <Button\n variant='simple'\n label={addStepTitle}\n onClick={onAddStepClick}\n ref={setAddEl}\n icon\n aria-label={`${t('add')} ${addStepTitle}`}\n >\n <Icon name='plus' />\n </Button>\n <Tooltip target={addEl} aria-hidden='true'>\n {`${t('add')} ${addStepTitle}`}\n </Tooltip>\n </Flex>\n </Flex>\n </Flex>\n </Flex>\n );\n};\n\nexport default Task;\n"]}
|
|
1
|
+
{"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAMR,WAAW,EACZ,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,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,CAAC,MAAM;oCAC3B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;oCACzB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;oCACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;iCAC1B,EACD,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,IAAI,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE;oCACL,IAAI,EAAE,WAAW;oCACjB,KAAK,EAAE,UAAU;iCAClB,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,YAAY,EAAE,YAAY,KACtB,QAAQ,IAlBP,KAAK,CAAC,EAAE,CAmBb,CACH,CAAC;wBACJ,CAAC,CAAC,EACF,0BACE,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,EACvC,GAAG,EAAE,QAAQ,EACb,IAAI,sBACQ,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,YAEzC,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,GACb,EACT,KAAC,OAAO,IAAC,MAAM,EAAE,KAAK,iBAAc,MAAM,YACvC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,GACtB,EACV,KAAC,WAAW,IACV,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,KAAoB,EAC5B,OAAO,EAAE,mBAAmB,EAC5B,GAAG,EAAE,YAAY,EACjB,WAAW,EAAE,CAAC,CAAC,cAAc,CAAC,GAC9B,IACE,IACY,IACf,GACQ,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithChildren,\n ChangeEvent,\n FocusEvent,\n MouseEvent,\n useCallback\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Button,\n Icon,\n Action,\n Tooltip,\n useElement,\n Actions,\n FormControlProps,\n useI18n,\n Avatar,\n StyledTooltip,\n useOuterEvent,\n useEscape\n} from '@pega/cosmos-react-core';\n\nimport { LibraryItem, ItemLibrary } from '../ItemLibrary';\n\nimport Step, { StepProps } from './Step';\nimport {\n TaskItemProps,\n StageItemProps,\n StepItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Tooltip for adding items to the task component */\n addStepTitle: string;\n /** Region for adding the task component */\n addTask: {\n title: string;\n showOnce: boolean;\n onAddTask?: LifeCycleAction['onClick'];\n };\n onAddStep?: (param: LifeCycleActionParam, selectedItem: LibraryItem) => void;\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n /** callback for Blur of input */\n onBlur?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n /** Types of Nodes */\n nodeLibrary: LibraryItem[];\n}\n\ninterface TaskComponentProps extends BaseProps, TaskProps {\n /** Pass text for the task. */\n value?: string;\n /** support for an Avatar, Icon, or other supporting visual. */\n visual: {\n imgurl: string;\n };\n /** Pass task data */\n item: TaskItemProps;\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /** Step Props */\n step?: StepProps;\n /** Stage data to pass it as callback */\n stageItem: StageItemProps;\n /** Category data to pass it as callback */\n categoryItem: CategoryItemProps;\n id: string;\n}\n\nexport const StyledTaskList = styled.li(({ theme }) => {\n return css`\n list-style-type: none;\n margin-block-end: ${theme.base.spacing};\n &:last-child > article {\n margin-block-end: 0;\n }\n `;\n});\n\nStyledTaskList.defaultProps = defaultThemeProp;\n\nexport const StyledCardHeader = styled.header(({ theme }) => {\n return css`\n padding: 0;\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledCardHeader.defaultProps = defaultThemeProp;\n\nexport const StyledCardContent = styled.div(() => {\n return css`\n padding: 0;\n `;\n});\n\nexport const StyledInput = styled.input<{ error: string | undefined }>(({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n text-overflow: ellipsis;\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n width: 100%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n border: 0.0625rem solid ${theme.base.colors.red.medium};\n `\n : css`\n background: ${theme.base.palette['primary-background']};\n &&:hover {\n background: ${theme.base.palette['secondary-background']};\n }\n &&:focus:enabled {\n border: 0.0625rem solid ${theme.base.colors.blue.medium};\n background: ${theme.base.palette['primary-background']};\n }\n `}\n `;\n});\n\nStyledInput.defaultProps = defaultThemeProp;\n\nexport const StyledTaskActions = styled.div<{\n error?: string;\n}>(({ error }) => {\n return css`\n border: none;\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n ${error &&\n css`\n visibility: visible;\n `}\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n `;\n});\n\nexport const StyledTask = styled.article(({ theme }) => {\n return css`\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding: ${theme.base.spacing};\n &:focus-within,\n &:hover {\n ${StyledTaskActions} {\n ${css`\n visibility: visible;\n `}\n }\n }\n &:focus-within {\n box-shadow: 0 0 0.2rem 0.0625rem ${theme.base.colors.blue.medium};\n }\n &:hover {\n cursor: pointer;\n }\n `;\n});\n\nStyledTask.defaultProps = defaultThemeProp;\n\nexport const StyledInputWrapper = styled.div`\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n`;\n\nconst Task: FunctionComponent<TaskComponentProps & ForwardProps> = ({\n value,\n visual,\n actions,\n item,\n addStepTitle,\n addTask,\n stageItem,\n error,\n onAddStep,\n onChange,\n onFocus,\n onBlur,\n categoryItem,\n id,\n step: stepProp,\n nodeLibrary,\n ...restProps\n}: PropsWithChildren<TaskComponentProps>) => {\n const t = useI18n();\n const [taskValue, setTaskValue] = useState(value);\n const [showLibrary, setLibrary] = useState(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const [addEl, setAddEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) || '';\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setTaskValue(e.target.value);\n const param: LifeCycleActionParam = {\n value: e.target.value,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onChange?.(param, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onFocus?.(param, e);\n };\n\n const onInputBlur = (e: FocusEvent<HTMLInputElement>) => {\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onBlur?.(param, e);\n };\n\n const onLibraryItemSelect = useCallback(\n (libItem: LibraryItem) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onAddStep?.(param, libItem);\n setLibrary(false);\n },\n [onAddStep]\n );\n\n useEscape(() => {\n setLibrary(false);\n });\n\n useOuterEvent('mousedown', [addEl, popoverEl], () => setLibrary(false));\n\n return (\n <StyledTaskList id={item.id} {...restProps}>\n <Flex as={StyledTask} container={{ direction: 'column' }} role='region'>\n <Flex as={StyledCardHeader} container={{ itemGap: 0.4 }}>\n {visual?.imgurl.length > 0 && <Avatar name={taskValue || ''} imageSrc={visual?.imgurl} />}\n <Flex\n item={{ grow: 1 }}\n as={StyledInputWrapper}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledInput\n value={taskValue}\n type='text'\n onChange={onInputChange}\n ref={setInputEl}\n error={error}\n aria-labelledby={categoryItem.categoryId}\n onFocus={onInputFocus}\n onBlur={onInputBlur}\n />\n {taskValue && (\n <Tooltip target={inputEl} hideDelay='none'>\n {error || taskValue}\n </Tooltip>\n )}\n </Flex>\n <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 </StyledTaskActions>\n </Flex>\n <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 <div>\n <Button\n variant='simple'\n label={addStepTitle}\n onClick={() => setLibrary(!showLibrary)}\n ref={setAddEl}\n icon\n aria-label={`${t('add')} ${addStepTitle}`}\n >\n <Icon name='plus' />\n </Button>\n <Tooltip target={addEl} aria-hidden='true'>\n {`${t('add')} ${addStepTitle}`}\n </Tooltip>\n <ItemLibrary\n items={nodeLibrary}\n show={showLibrary}\n target={addEl as HTMLElement}\n onClick={onLibraryItemSelect}\n ref={setPopoverEl}\n placeholder={t('search_nodes')}\n />\n </div>\n </StyledCardContent>\n </Flex>\n </StyledTaskList>\n );\n};\n\nexport default Task;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { default } from './LifeCycle';
|
|
2
|
-
export { LifeCycleProps } from './LifeCycle';
|
|
1
|
+
export { default, LifeCycleProps } from './LifeCycle';
|
|
3
2
|
export { StepItemProps, TaskItemProps, StageItemProps, CategoryItemProps, CategoriesItemProps, LifeCycleActionParam, LifeCycleAction } from './LifeCycle.types';
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,aAAa,CAAC","sourcesContent":["export { default, LifeCycleProps } from './LifeCycle';\n\nexport {\n StepItemProps,\n TaskItemProps,\n StageItemProps,\n CategoryItemProps,\n CategoriesItemProps,\n LifeCycleActionParam,\n LifeCycleAction\n} from './LifeCycle.types';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC, PropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
|
+
import { Action, ActionsProps, ForwardProps, OmitStrict, DrawerProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { PageHeaderProps } from '@pega/cosmos-react-build/lib/components/PageTemplates/PageTemplates';
|
|
4
|
+
export interface ObjectPreviewProps extends Pick<DrawerProps, 'onAfterOpen' | 'onAfterClose' | 'onBeforeOpen' | 'onBeforeClose'> {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
header: OmitStrict<PageHeaderProps, 'status'>;
|
|
7
|
+
primaryAction?: Action;
|
|
8
|
+
secondaryAction?: Action;
|
|
9
|
+
additionalActions?: ActionsProps;
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
onDismiss: () => void;
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
13
|
+
}
|
|
14
|
+
declare const ObjectPreview: FC<PropsWithoutRef<ObjectPreviewProps> & ForwardProps>;
|
|
15
|
+
export default ObjectPreview;
|
|
16
|
+
//# sourceMappingURL=ObjectPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectPreview.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectPreview/ObjectPreview.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EAEF,eAAe,EACf,SAAS,EACT,GAAG,EAIJ,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,MAAM,EAEN,YAAY,EAGZ,YAAY,EAGZ,UAAU,EAIV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EAGhB,MAAM,qEAAqE,CAAC;AAE7E,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,cAAc,GAAG,cAAc,GAAG,eAAe,CAAC;IAC5F,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,UAAU,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,YAAY,CAAC;IACjC,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAiDD,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,GAAG,YAAY,CAyCzE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useRef, useEffect } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Actions, Button, Flex, Icon, OneColumnPage, Drawer, useI18n, useConsolidatedRef } from '@pega/cosmos-react-core';
|
|
5
|
+
import { PageHeader, StyledPage } from '@pega/cosmos-react-build/lib/components/PageTemplates/PageTemplates';
|
|
6
|
+
const StyledObjectPreview = styled(Drawer) `
|
|
7
|
+
height: calc(100vh - 3rem);
|
|
8
|
+
top: 3rem;
|
|
9
|
+
`;
|
|
10
|
+
const PreviewHeader = ({ header, primaryAction, secondaryAction, additionalActions, onDismiss, dismissButtonRef }) => {
|
|
11
|
+
const t = useI18n();
|
|
12
|
+
return (_jsxs(Flex, { container: { direction: 'column', rowGap: 1 }, children: [_jsxs(Flex, { container: { justify: 'between' }, children: [_jsx(Button, { icon: true, variant: 'simple', ref: dismissButtonRef, label: t('dismiss_label_a11y'), onClick: onDismiss, children: _jsx(Icon, { name: 'times' }) }), _jsxs(Flex, { container: true, children: [secondaryAction && (_jsx(Button, { onClick: secondaryAction.onClick, children: secondaryAction.text })), primaryAction && (_jsx(Button, { variant: 'primary', onClick: primaryAction.onClick, children: primaryAction.text })), additionalActions && _jsx(Actions, { ...additionalActions })] })] }), _jsx(PageHeader, { ...header, titleTag: 'h2' })] }));
|
|
13
|
+
};
|
|
14
|
+
const ObjectPreview = forwardRef(({ content, header, open, onAfterOpen, onAfterClose, onBeforeOpen, onBeforeClose, ...restprops }, ref) => {
|
|
15
|
+
const contentRef = useConsolidatedRef(ref);
|
|
16
|
+
const dismissButtonRef = useRef(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (open && contentRef.current) {
|
|
19
|
+
contentRef.current?.querySelector('button')?.focus();
|
|
20
|
+
}
|
|
21
|
+
}, [open]);
|
|
22
|
+
return (_jsx(StyledObjectPreview, { ref: contentRef, open: !!open, nullWhenClosed: true, position: 'fixed', size: '30%', shadow: true, placement: 'right', onAfterOpen: onAfterOpen, onAfterClose: onAfterClose, onBeforeOpen: onBeforeOpen, onBeforeClose: onBeforeClose, children: _jsx(OneColumnPage, { ref: contentRef, title: header.title, as: StyledPage, header: _jsx(PreviewHeader, { dismissButtonRef: dismissButtonRef, header: header, ...restprops }), scrollContent: true, a: content }) }));
|
|
23
|
+
});
|
|
24
|
+
export default ObjectPreview;
|
|
25
|
+
//# sourceMappingURL=ObjectPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectPreview.js","sourceRoot":"","sources":["../../../src/components/ObjectPreview/ObjectPreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,MAAM,EACN,SAAS,EAEV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mB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AC,CAAC;AAEF,MAAM,aAAa,GAA2D,UAAU,CACtF,CACE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,EAC/F,GAA8B,EAC9B,EAAE;IACF,MAAM,UAAU,GAAG,kBAAkB,CAAiB,GAAG,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAEzD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,IAAI,UAAU,CAAC,OAAO,EAAE;YAC9B,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;SACtD;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,KAAC,mBAAmB,IAClB,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,CAAC,CAAC,IAAI,EACZ,cAAc,QACd,QAAQ,EAAC,OAAO,EAChB,IAAI,EAAC,KAAK,EACV,MAAM,QACN,SAAS,EAAC,OAAO,EACjB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,YAE5B,KAAC,aAAa,IACZ,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,EAAE,EAAE,UAAU,EACd,MAAM,EACJ,KAAC,aAAa,IAAC,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,KAAM,SAAS,GAAI,EAEtF,aAAa,QACb,CAAC,EAAE,OAAO,GACV,GACkB,CACvB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n FC,\n forwardRef,\n PropsWithoutRef,\n ReactNode,\n Ref,\n useRef,\n useEffect,\n RefObject\n} from 'react';\nimport styled from 'styled-components';\n\nimport {\n Action,\n Actions,\n ActionsProps,\n Button,\n Flex,\n ForwardProps,\n Icon,\n OneColumnPage,\n OmitStrict,\n Drawer,\n useI18n,\n useConsolidatedRef,\n DrawerProps\n} from '@pega/cosmos-react-core';\nimport {\n PageHeaderProps,\n PageHeader,\n StyledPage\n} from '@pega/cosmos-react-build/lib/components/PageTemplates/PageTemplates';\n\nexport interface ObjectPreviewProps\n extends Pick<DrawerProps, 'onAfterOpen' | 'onAfterClose' | 'onBeforeOpen' | 'onBeforeClose'> {\n open?: boolean;\n header: OmitStrict<PageHeaderProps, 'status'>;\n primaryAction?: Action;\n secondaryAction?: Action;\n additionalActions?: ActionsProps;\n content: ReactNode;\n onDismiss: () => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledObjectPreview = styled(Drawer)`\n height: calc(100vh - 3rem);\n top: 3rem;\n`;\n\nconst PreviewHeader: FC<\n OmitStrict<ObjectPreviewProps, 'ref' | 'content' | 'open'> & {\n dismissButtonRef: RefObject<HTMLButtonElement>;\n }\n> = ({\n header,\n primaryAction,\n secondaryAction,\n additionalActions,\n onDismiss,\n dismissButtonRef\n}) => {\n const t = useI18n();\n return (\n <Flex container={{ direction: 'column', rowGap: 1 }}>\n <Flex container={{ justify: 'between' }}>\n <Button\n icon\n variant='simple'\n ref={dismissButtonRef}\n label={t('dismiss_label_a11y')}\n onClick={onDismiss}\n >\n <Icon name='times' />\n </Button>\n <Flex container>\n {secondaryAction && (\n <Button onClick={secondaryAction.onClick}>{secondaryAction.text}</Button>\n )}\n {primaryAction && (\n <Button variant='primary' onClick={primaryAction.onClick}>\n {primaryAction.text}\n </Button>\n )}\n {additionalActions && <Actions {...additionalActions} />}\n </Flex>\n </Flex>\n <PageHeader {...header} titleTag='h2' />\n </Flex>\n );\n};\n\nconst ObjectPreview: FC<PropsWithoutRef<ObjectPreviewProps> & ForwardProps> = forwardRef(\n (\n { content, header, open, onAfterOpen, onAfterClose, onBeforeOpen, onBeforeClose, ...restprops },\n ref: ObjectPreviewProps['ref']\n ) => {\n const contentRef = useConsolidatedRef<HTMLDivElement>(ref);\n const dismissButtonRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (open && contentRef.current) {\n contentRef.current?.querySelector('button')?.focus();\n }\n }, [open]);\n\n return (\n <StyledObjectPreview\n ref={contentRef}\n open={!!open}\n nullWhenClosed\n position='fixed'\n size='30%'\n shadow\n placement='right'\n onAfterOpen={onAfterOpen}\n onAfterClose={onAfterClose}\n onBeforeOpen={onBeforeOpen}\n onBeforeClose={onBeforeClose}\n >\n <OneColumnPage\n ref={contentRef}\n title={header.title}\n as={StyledPage}\n header={\n <PreviewHeader dismissButtonRef={dismissButtonRef} header={header} {...restprops} />\n }\n scrollContent\n a={content}\n />\n </StyledObjectPreview>\n );\n }\n);\n\nexport default ObjectPreview;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectPreview/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ObjectPreview/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,cAAc,iBAAiB,CAAC","sourcesContent":["export { default as ObjectPreview } from './ObjectPreview';\nexport * from './ObjectPreview';\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionComponent, MouseEventHandler } from 'react';
|
|
2
|
+
import { BaseProps, MenuProps, MenuItemProps, ComboBoxProps, NoChildrenProp, ButtonProps } from '@pega/cosmos-react-core';
|
|
3
|
+
export interface ObjectPickerProps extends BaseProps, NoChildrenProp, Pick<ComboBoxProps, 'id' | 'label' | 'labelHidden' | 'required' | 'disabled' | 'readOnly' | 'name' | 'status' | 'info' | 'placeholder'> {
|
|
4
|
+
items: MenuProps['items'];
|
|
5
|
+
loading: MenuProps['loading'];
|
|
6
|
+
onSelect: MenuItemProps['onClick'];
|
|
7
|
+
createProps?: {
|
|
8
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
href?: ButtonProps['href'];
|
|
10
|
+
};
|
|
11
|
+
ref?: ComboBoxProps['ref'];
|
|
12
|
+
}
|
|
13
|
+
declare const ObjectPicker: FunctionComponent<ObjectPickerProps>;
|
|
14
|
+
export default ObjectPicker;
|
|
15
|
+
//# sourceMappingURL=ObjectPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectPicker.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectSelect/ObjectPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,SAAS,EAGT,SAAS,EACT,aAAa,EAEb,aAAa,EACb,cAAc,EAMd,WAAW,EAEZ,MAAM,yBAAyB,CAAC;AAMjC,MAAM,WAAW,iBACf,SAAQ,SAAS,EACf,cAAc,EACd,IAAI,CACF,aAAa,EACX,IAAI,GACJ,OAAO,GACP,aAAa,GACb,UAAU,GACV,UAAU,GACV,UAAU,GACV,MAAM,GACN,QAAQ,GACR,MAAM,GACN,aAAa,CAChB;IACH,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1B,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;IAC7F,GAAG,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAC5B;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CA6DtD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useMemo } from 'react';
|
|
3
|
+
import { ComboBox, menuHelpers, createStringMatcher, Flex, Button, Icon, useI18n, useConsolidatedRef, registerIcon } from '@pega/cosmos-react-core';
|
|
4
|
+
import * as openIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/open.icon';
|
|
5
|
+
import * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';
|
|
6
|
+
registerIcon(openIcon, plusIcon);
|
|
7
|
+
const ObjectPicker = forwardRef(({ items, onSelect, createProps, loading, ...restProps }, ref) => {
|
|
8
|
+
const [filterValue, setFilterValue] = useState('');
|
|
9
|
+
const filterRegex = filterValue ? createStringMatcher(filterValue) : undefined;
|
|
10
|
+
const t = useI18n();
|
|
11
|
+
const comboboxRef = useConsolidatedRef(ref);
|
|
12
|
+
const itemsToRender = useMemo(() => {
|
|
13
|
+
const newItems = filterValue
|
|
14
|
+
? menuHelpers.flatten(items).filter(({ primary }) => {
|
|
15
|
+
return filterRegex?.test(primary);
|
|
16
|
+
})
|
|
17
|
+
: items;
|
|
18
|
+
return menuHelpers.mapTree(newItems, item => ({
|
|
19
|
+
...item,
|
|
20
|
+
selected: item.items ? undefined : !!item.selected
|
|
21
|
+
}));
|
|
22
|
+
}, [filterValue, items]);
|
|
23
|
+
return (_jsx(ComboBox, { ...restProps, ref: comboboxRef, mode: 'single-select', value: filterValue, onChange: (e) => setFilterValue(e.target.value), onBlur: () => setFilterValue(''), menu: {
|
|
24
|
+
items: itemsToRender,
|
|
25
|
+
onItemClick: onSelect,
|
|
26
|
+
accent: filterRegex,
|
|
27
|
+
loading,
|
|
28
|
+
footer: createProps ? (_jsx(Flex, { container: { justify: 'start' }, children: _jsxs(Button, { type: 'button', variant: 'simple', onClick: createProps.onClick, ...(createProps.href && {
|
|
29
|
+
href: createProps.href,
|
|
30
|
+
target: '_blank',
|
|
31
|
+
'aria-label': t('create_in_new_tab')
|
|
32
|
+
}), children: [_jsx(Icon, { name: 'plus' }), t('create_new'), createProps.href && _jsx(Icon, { name: 'open' })] }) })) : undefined
|
|
33
|
+
}, onKeyDown: e => {
|
|
34
|
+
if (e.key === 'Tab') {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
} }));
|
|
38
|
+
});
|
|
39
|
+
export default ObjectPicker;
|
|
40
|
+
//# sourceMappingURL=ObjectPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectPicker.js","sourceRoot":"","sources":["../../../src/components/ObjectSelect/ObjectPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,OAAO,EAIR,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,QAAQ,EACR,WAAW,EAGX,mBAAmB,EAGnB,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,kBAAkB,EAElB,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AAExF,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAyBjC,MAAM,YAAY,GAAyC,UAAU,CACnE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,EAAE,GAA6B,EAAE,EAAE;IACzF,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE/E,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ChB,OAAO,EAAE,WAAW,CAAC,OAAO,KACxB,CAAC,WAAW,CAAC,IAAI,IAAI;wBACvB,IAAI,EAAE,WAAW,CAAC,IAAI;wBACtB,MAAM,EAAE,QAAQ;wBAChB,YAAY,EAAE,CAAC,CAAC,mBAAmB,CAAC;qBACrC,CAAC,aAEF,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,EACnB,CAAC,CAAC,YAAY,CAAC,EACf,WAAW,CAAC,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,IAClC,GACJ,CACR,CAAC,CAAC,CAAC,SAAS;SACd,EACD,SAAS,EAAE,CAAC,CAAC,EAAE;YACb,IAAI,CAAC,CAAC,GAAG,KAAK,KAAK,EAAE;gBACnB,OAAO,KAAK,CAAC;aACd;QACH,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n useMemo,\n ChangeEvent,\n FunctionComponent,\n MouseEventHandler\n} from 'react';\n\nimport {\n BaseProps,\n ComboBox,\n menuHelpers,\n MenuProps,\n MenuItemProps,\n createStringMatcher,\n ComboBoxProps,\n NoChildrenProp,\n Flex,\n Button,\n Icon,\n useI18n,\n useConsolidatedRef,\n ButtonProps,\n registerIcon\n} from '@pega/cosmos-react-core';\nimport * as openIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/open.icon';\nimport * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';\n\nregisterIcon(openIcon, plusIcon);\n\nexport interface ObjectPickerProps\n extends BaseProps,\n NoChildrenProp,\n Pick<\n ComboBoxProps,\n | 'id'\n | 'label'\n | 'labelHidden'\n | 'required'\n | 'disabled'\n | 'readOnly'\n | 'name'\n | 'status'\n | 'info'\n | 'placeholder'\n > {\n items: MenuProps['items'];\n loading: MenuProps['loading'];\n onSelect: MenuItemProps['onClick'];\n createProps?: { onClick?: MouseEventHandler<HTMLButtonElement>; href?: ButtonProps['href'] };\n ref?: ComboBoxProps['ref'];\n}\n\nconst ObjectPicker: FunctionComponent<ObjectPickerProps> = forwardRef(\n ({ items, onSelect, createProps, loading, ...restProps }, ref: ObjectPickerProps['ref']) => {\n const [filterValue, setFilterValue] = useState('');\n const filterRegex = filterValue ? createStringMatcher(filterValue) : undefined;\n\n const t = useI18n();\n const comboboxRef = useConsolidatedRef(ref);\n\n const itemsToRender = useMemo(() => {\n const newItems = filterValue\n ? menuHelpers.flatten(items).filter(({ primary }: MenuItemProps) => {\n return filterRegex?.test(primary);\n })\n : items;\n\n return menuHelpers.mapTree(newItems, item => ({\n ...item,\n selected: item.items ? undefined : !!item.selected\n }));\n }, [filterValue, items]);\n\n return (\n <ComboBox\n {...restProps}\n ref={comboboxRef}\n mode='single-select'\n value={filterValue}\n onChange={(e: ChangeEvent<HTMLInputElement>) => setFilterValue(e.target.value)}\n onBlur={() => setFilterValue('')}\n menu={{\n items: itemsToRender,\n onItemClick: onSelect,\n accent: filterRegex,\n loading,\n footer: createProps ? (\n <Flex container={{ justify: 'start' }}>\n <Button\n type='button'\n variant='simple'\n onClick={createProps.onClick}\n {...(createProps.href && {\n href: createProps.href,\n target: '_blank',\n 'aria-label': t('create_in_new_tab')\n })}\n >\n <Icon name='plus' />\n {t('create_new')}\n {createProps.href && <Icon name='open' />}\n </Button>\n </Flex>\n ) : undefined\n }}\n onKeyDown={e => {\n if (e.key === 'Tab') {\n return false;\n }\n }}\n />\n );\n }\n);\n\nexport default ObjectPicker;\n"]}
|