@pega/cosmos-react-build 4.0.0-dev.2.0 → 4.0.0-dev.20.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/AppShell/AppShell.d.ts +3 -2
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +42 -80
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +12 -16
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +208 -283
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +63 -31
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +3 -5
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/Header/AppHeader.d.ts.map +1 -0
- package/lib/components/AppShell/Header/AppHeader.js +73 -0
- package/lib/components/AppShell/Header/AppHeader.js.map +1 -0
- package/lib/components/{AppHeader → AppShell/Header}/AppHeader.styles.d.ts +7 -7
- package/lib/components/AppShell/Header/AppHeader.styles.d.ts.map +1 -0
- package/lib/components/AppShell/Header/AppHeader.styles.js +158 -0
- package/lib/components/AppShell/Header/AppHeader.styles.js.map +1 -0
- package/lib/components/{AppHeader → AppShell/Header}/AppHeader.types.d.ts +6 -5
- package/lib/components/AppShell/Header/AppHeader.types.d.ts.map +1 -0
- package/lib/components/AppShell/Header/AppHeader.types.js.map +1 -0
- package/lib/components/AppShell/Header/BranchButton.d.ts.map +1 -0
- package/lib/components/{AppHeader → AppShell/Header}/BranchButton.js +5 -5
- package/lib/components/AppShell/Header/BranchButton.js.map +1 -0
- package/lib/components/AppShell/NavigationList.d.ts +6 -0
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -0
- package/lib/components/AppShell/NavigationList.js +97 -0
- package/lib/components/AppShell/NavigationList.js.map +1 -0
- package/lib/components/AppShell/index.d.ts +3 -1
- package/lib/components/AppShell/index.d.ts.map +1 -1
- package/lib/components/AppShell/index.js.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js +27 -27
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts +41 -27
- package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +17 -33
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +6 -6
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts +4 -3
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js.map +1 -1
- package/lib/components/ExpressionBuilder/index.d.ts +1 -1
- package/lib/components/ExpressionBuilder/index.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/index.js.map +1 -1
- package/lib/components/FlowModeller/AddNode.d.ts.map +1 -1
- package/lib/components/FlowModeller/AddNode.js +3 -4
- package/lib/components/FlowModeller/AddNode.js.map +1 -1
- package/lib/components/FlowModeller/Connector.d.ts +2 -2
- package/lib/components/FlowModeller/Connector.d.ts.map +1 -1
- package/lib/components/FlowModeller/Connector.js +2 -4
- package/lib/components/FlowModeller/Connector.js.map +1 -1
- package/lib/components/FlowModeller/DeletePopover.d.ts +3 -3
- package/lib/components/FlowModeller/DeletePopover.d.ts.map +1 -1
- package/lib/components/FlowModeller/DeletePopover.js.map +1 -1
- package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -1
- package/lib/components/FlowModeller/FlowModeller.js +1 -3
- package/lib/components/FlowModeller/FlowModeller.js.map +1 -1
- package/lib/components/FlowModeller/Node/Node.types.d.ts +5 -0
- package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/Node.types.js.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +5 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +10 -3
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.js +11 -29
- package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +3 -3
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.d.ts.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.js +2 -2
- 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 +2 -2
- package/lib/components/LifeCycle/Category.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.types.d.ts +22 -1
- 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 +11 -0
- package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycleList.js +1 -1
- package/lib/components/LifeCycle/LifeCycleList.js.map +1 -1
- package/lib/components/LifeCycle/Stage.d.ts +2 -0
- package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
- package/lib/components/LifeCycle/Stage.js +4 -10
- package/lib/components/LifeCycle/Stage.js.map +1 -1
- package/lib/components/LifeCycle/Step.d.ts +6 -2
- package/lib/components/LifeCycle/Step.d.ts.map +1 -1
- package/lib/components/LifeCycle/Step.js +30 -24
- package/lib/components/LifeCycle/Step.js.map +1 -1
- package/lib/components/LifeCycle/Task.d.ts +1 -0
- package/lib/components/LifeCycle/Task.d.ts.map +1 -1
- package/lib/components/LifeCycle/Task.js +6 -12
- package/lib/components/LifeCycle/Task.js.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts +0 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.js +5 -16
- package/lib/components/MobileBuildSummary/MobileBuildSummary.js.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.types.d.ts +5 -3
- package/lib/components/MobileBuildSummary/MobileBuildSummary.types.d.ts.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.types.js.map +1 -1
- package/lib/components/ObjectPreview/ObjectPreview.d.ts +2 -2
- package/lib/components/ObjectPreview/ObjectPreview.d.ts.map +1 -1
- package/lib/components/ObjectPreview/ObjectPreview.js +1 -1
- package/lib/components/ObjectPreview/ObjectPreview.js.map +1 -1
- package/lib/components/ObjectSelect/ObjectSummary.d.ts +11 -3
- package/lib/components/ObjectSelect/ObjectSummary.d.ts.map +1 -1
- package/lib/components/ObjectSelect/ObjectSummary.js +50 -14
- package/lib/components/ObjectSelect/ObjectSummary.js.map +1 -1
- package/lib/components/ObjectSelect/useCreateModal.d.ts +9 -11
- package/lib/components/ObjectSelect/useCreateModal.d.ts.map +1 -1
- package/lib/components/ObjectSelect/useCreateModal.js +5 -6
- package/lib/components/ObjectSelect/useCreateModal.js.map +1 -1
- package/lib/components/PageBanner/PageBanner.d.ts +22 -0
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -0
- package/lib/components/PageBanner/PageBanner.js +59 -0
- package/lib/components/PageBanner/PageBanner.js.map +1 -0
- package/lib/components/PageBanner/index.d.ts +3 -0
- package/lib/components/PageBanner/index.d.ts.map +1 -0
- package/lib/components/PageBanner/index.js +2 -0
- package/lib/components/PageBanner/index.js.map +1 -0
- package/lib/components/PageTemplates/GalleryPage.d.ts +10 -10
- package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/GalleryPage.js +35 -11
- package/lib/components/PageTemplates/GalleryPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +8 -45
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/PageTemplates/ShowcasePage.d.ts +16 -0
- package/lib/components/PageTemplates/ShowcasePage.d.ts.map +1 -0
- package/lib/components/PageTemplates/ShowcasePage.js +29 -0
- package/lib/components/PageTemplates/ShowcasePage.js.map +1 -0
- package/lib/components/PageTemplates/index.d.ts +3 -1
- package/lib/components/PageTemplates/index.d.ts.map +1 -1
- package/lib/components/PageTemplates/index.js +2 -1
- package/lib/components/PageTemplates/index.js.map +1 -1
- package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -1
- package/lib/components/SummaryCard/SummaryCard.js +4 -7
- package/lib/components/SummaryCard/SummaryCard.js.map +1 -1
- package/lib/components/Workbench/Workbench.types.d.ts +2 -2
- package/lib/components/Workbench/Workbench.types.d.ts.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/utils.d.ts +1 -1
- package/lib/utils/utils.d.ts.map +1 -1
- package/package.json +16 -9
- package/lib/components/AppHeader/AppHeader.d.ts.map +0 -1
- package/lib/components/AppHeader/AppHeader.js +0 -40
- package/lib/components/AppHeader/AppHeader.js.map +0 -1
- package/lib/components/AppHeader/AppHeader.styles.d.ts.map +0 -1
- package/lib/components/AppHeader/AppHeader.styles.js +0 -118
- package/lib/components/AppHeader/AppHeader.styles.js.map +0 -1
- package/lib/components/AppHeader/AppHeader.types.d.ts.map +0 -1
- package/lib/components/AppHeader/AppHeader.types.js.map +0 -1
- package/lib/components/AppHeader/BranchButton.d.ts.map +0 -1
- package/lib/components/AppHeader/BranchButton.js.map +0 -1
- package/lib/components/AppHeader/index.d.ts +0 -4
- package/lib/components/AppHeader/index.d.ts.map +0 -1
- package/lib/components/AppHeader/index.js +0 -3
- package/lib/components/AppHeader/index.js.map +0 -1
- package/lib/components/PageTemplates/GalleryPage.styles.d.ts +0 -9
- package/lib/components/PageTemplates/GalleryPage.styles.d.ts.map +0 -1
- package/lib/components/PageTemplates/GalleryPage.styles.js +0 -70
- package/lib/components/PageTemplates/GalleryPage.styles.js.map +0 -1
- /package/lib/components/{AppHeader → AppShell/Header}/AppHeader.d.ts +0 -0
- /package/lib/components/{AppHeader → AppShell/Header}/AppHeader.types.js +0 -0
- /package/lib/components/{AppHeader → AppShell/Header}/BranchButton.d.ts +0 -0
|
@@ -16,8 +16,11 @@ interface StepComponentProps extends BaseProps, StepProps {
|
|
|
16
16
|
icon: string;
|
|
17
17
|
title: string;
|
|
18
18
|
};
|
|
19
|
+
/** Determines the variant and label for the badges */
|
|
19
20
|
badge?: StepItemProps['status'];
|
|
21
|
+
/** The status is used to show the input error status and the info on tooltip in case of error */
|
|
20
22
|
error?: string;
|
|
23
|
+
/** Data of the steps which can be used to send the full info back */
|
|
21
24
|
item: StepItemProps;
|
|
22
25
|
stageItem: StageItemProps;
|
|
23
26
|
taskItem: TaskItemProps;
|
|
@@ -25,10 +28,11 @@ interface StepComponentProps extends BaseProps, StepProps {
|
|
|
25
28
|
}
|
|
26
29
|
export declare const StyledStepType: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<StepComponentProps, "visual">, never>;
|
|
27
30
|
export declare const StyledStepBadge: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
28
|
-
export declare const StyledStepWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
29
|
-
export declare const StyledStep: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
31
|
+
export declare const StyledStepWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
30
32
|
hasFocus: boolean;
|
|
33
|
+
selected: boolean;
|
|
31
34
|
}, never>;
|
|
35
|
+
export declare const StyledStep: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
32
36
|
export declare const StyledStepButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
33
37
|
export declare const StyledWarnIcon: typeof Icon;
|
|
34
38
|
declare const Step: FunctionComponent<StepComponentProps & ForwardProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,iBAAiB,EAA2C,MAAM,OAAO,CAAC;AAI7F,OAAO,EAGL,SAAS,EACT,YAAY,EACZ,IAAI,
|
|
1
|
+
{"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,iBAAiB,EAA2C,MAAM,OAAO,CAAC;AAI7F,OAAO,EAGL,SAAS,EACT,YAAY,EACZ,IAAI,EASL,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAY,SAAS,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EAEjB,SAAS,EACV,MAAM,mBAAmB,CAAC;AAG3B,UAAU,kBAAmB,SAAQ,SAAS,EAAE,SAAS;IACvD,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX;;oDAEgD;IAChD,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,SAAS,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,sDAAsD;IACtD,KAAK,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,iGAAiG;IACjG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,cAAc,CAAC;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,EAAE,iBAAiB,CAAC;CACjC;AAED,eAAO,MAAM,cAAc,yIAkB1B,CAAC;AAIF,eAAO,MAAM,eAAe,yGAa1B,CAAC;AAIH,eAAO,MAAM,iBAAiB;cAClB,OAAO;cACP,OAAO;SAuBjB,CAAC;AAIH,eAAO,MAAM,UAAU,yGAUrB,CAAC;AAYH,eAAO,MAAM,gBAAgB,4GAkB3B,CAAC;AAIH,eAAO,MAAM,cAAc,EAAE,OAAO,IASlC,CAAC;AAIH,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CA6H9D,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useContext } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { readableColor } from 'polished';
|
|
5
|
-
import { Flex, defaultThemeProp, Icon,
|
|
5
|
+
import { Flex, defaultThemeProp, Icon, Status, Actions, useI18n, Avatar, useUID, Tooltip, useElement } from '@pega/cosmos-react-core';
|
|
6
6
|
import { colorMap } from '../../utils';
|
|
7
7
|
import LifeCycleContext from './LifeCycleContext';
|
|
8
8
|
export const StyledStepType = styled.div(({ visual, theme }) => {
|
|
@@ -38,16 +38,10 @@ export const StyledStepBadge = styled.div(({ theme }) => {
|
|
|
38
38
|
`;
|
|
39
39
|
});
|
|
40
40
|
StyledStepBadge.defaultProps = defaultThemeProp;
|
|
41
|
-
export const StyledStepWrapper = styled.div(({ theme }) => {
|
|
41
|
+
export const StyledStepWrapper = styled.div(({ hasFocus, theme, selected }) => {
|
|
42
42
|
return css `
|
|
43
43
|
width: 100%;
|
|
44
44
|
margin: 0 0 calc(0.5 * ${theme.base.spacing});
|
|
45
|
-
`;
|
|
46
|
-
});
|
|
47
|
-
StyledStepWrapper.defaultProps = defaultThemeProp;
|
|
48
|
-
export const StyledStep = styled.div(({ hasFocus, theme }) => {
|
|
49
|
-
return css `
|
|
50
|
-
background: ${theme.base.palette['secondary-background']};
|
|
51
45
|
border: 0.125rem solid transparent;
|
|
52
46
|
border-radius: calc(0.5 * ${theme.base['border-radius']});
|
|
53
47
|
|
|
@@ -59,9 +53,23 @@ export const StyledStep = styled.div(({ hasFocus, theme }) => {
|
|
|
59
53
|
&:hover {
|
|
60
54
|
cursor: pointer;
|
|
61
55
|
}
|
|
56
|
+
${selected &&
|
|
57
|
+
css `
|
|
58
|
+
&[aria-current='step'] {
|
|
59
|
+
border-color: ${theme.base.palette.interactive};
|
|
60
|
+
}
|
|
61
|
+
`}
|
|
62
|
+
`;
|
|
63
|
+
});
|
|
64
|
+
StyledStepWrapper.defaultProps = defaultThemeProp;
|
|
65
|
+
export const StyledStep = styled.div(({ theme }) => {
|
|
66
|
+
return css `
|
|
67
|
+
background: ${theme.base.palette['secondary-background']};
|
|
68
|
+
border: 0.125rem solid transparent;
|
|
69
|
+
border-radius: calc(0.5 * ${theme.base['border-radius']});
|
|
62
70
|
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
&:hover {
|
|
72
|
+
cursor: pointer;
|
|
65
73
|
}
|
|
66
74
|
`;
|
|
67
75
|
});
|
|
@@ -95,16 +103,11 @@ StyledStepButton.defaultProps = defaultThemeProp;
|
|
|
95
103
|
export const StyledWarnIcon = styled(Icon)(({ theme }) => {
|
|
96
104
|
return css `
|
|
97
105
|
color: ${theme.base.palette.urgent};
|
|
98
|
-
margin-inline
|
|
106
|
+
margin-inline: ${theme.base.spacing};
|
|
99
107
|
|
|
100
108
|
&:hover {
|
|
101
109
|
cursor: pointer;
|
|
102
110
|
}
|
|
103
|
-
|
|
104
|
-
&:focus {
|
|
105
|
-
outline: none;
|
|
106
|
-
box-shadow: ${theme.base.shadow.focus};
|
|
107
|
-
}
|
|
108
111
|
`;
|
|
109
112
|
});
|
|
110
113
|
StyledWarnIcon.defaultProps = defaultThemeProp;
|
|
@@ -112,9 +115,7 @@ const Step = ({ value, id, visual, actions, badge, error, categoryItem, item, st
|
|
|
112
115
|
const t = useI18n();
|
|
113
116
|
const { selectedItemId } = useContext(LifeCycleContext);
|
|
114
117
|
const [stepHasFocus, setStepHasFocus] = useState(false);
|
|
115
|
-
|
|
116
|
-
const [errorIcon, setErrorIcon] = useElement();
|
|
117
|
-
/* Need to check the value with statusProps */
|
|
118
|
+
// Need to check the value with statusProps
|
|
118
119
|
const onActionItemClick = (actionId, e) => {
|
|
119
120
|
e.stopPropagation();
|
|
120
121
|
const param = {
|
|
@@ -129,8 +130,9 @@ const Step = ({ value, id, visual, actions, badge, error, categoryItem, item, st
|
|
|
129
130
|
}
|
|
130
131
|
});
|
|
131
132
|
};
|
|
132
|
-
|
|
133
|
+
// Deep copy of actions is required to provide consistent callback objects on actions
|
|
133
134
|
const actionsClone = [];
|
|
135
|
+
const buttonDescriptionId = useUID();
|
|
134
136
|
if (actions) {
|
|
135
137
|
actions.forEach(actionItem => {
|
|
136
138
|
const actionCloneItem = {};
|
|
@@ -138,7 +140,10 @@ const Step = ({ value, id, visual, actions, badge, error, categoryItem, item, st
|
|
|
138
140
|
actionCloneItem[key] = actionItem[key];
|
|
139
141
|
});
|
|
140
142
|
actionCloneItem.onClick = onActionItemClick;
|
|
141
|
-
|
|
143
|
+
if (error)
|
|
144
|
+
actionsClone.push(actionCloneItem);
|
|
145
|
+
else
|
|
146
|
+
actionsClone.push({ ...actionCloneItem, 'aria-describedby': buttonDescriptionId });
|
|
142
147
|
return actionItem;
|
|
143
148
|
});
|
|
144
149
|
}
|
|
@@ -154,11 +159,12 @@ const Step = ({ value, id, visual, actions, badge, error, categoryItem, item, st
|
|
|
154
159
|
};
|
|
155
160
|
onClick?.(actionParam, e);
|
|
156
161
|
};
|
|
157
|
-
|
|
162
|
+
const [stepLabelEl, setStepLabelEl] = useElement(null);
|
|
163
|
+
return (_jsxs(Flex, { as: StyledStepWrapper, id: `${id}-stepWrapper`, container: { inline: true, alignItems: 'center' }, "aria-current": selectedItemId === id ? 'step' : undefined, hasFocus: stepHasFocus && selectedItemId !== id, selected: selectedItemId === id, children: [error && _jsx(StyledWarnIcon, { name: 'warn-solid' }), _jsxs(Flex, { as: StyledStep, container: { inline: true }, id: id, item: { grow: 1 }, onClick: onStepClick, children: [_jsxs(StyledStepType, { visual: visual, children: [visual.imgurl.length > 0 && (_jsx(Avatar, { name: visual.title, imageSrc: visual?.imgurl, shape: 'squircle', size: 'm' })), !visual.imgurl && _jsx(Icon, { name: visual.icon })] }), _jsxs(Flex, { as: StyledStepButtonWrapper, item: { grow: 1 }, container: { inline: true, alignItems: 'center', justify: 'between' }, id: buttonDescriptionId, children: [_jsxs(StyledStepButton, { ...restProps, onFocus: () => {
|
|
158
164
|
setStepHasFocus(true);
|
|
159
165
|
}, onBlur: () => {
|
|
160
166
|
setStepHasFocus(false);
|
|
161
|
-
}, "aria-label": t('step_name', [value]), children: value }), badge?.type && (_jsx(Flex, { as: StyledStepBadge, container: { inline: true, alignItems: 'center' }, children: _jsx(Status, { variant: badge?.type || 'success', children: badge?.label }) }))] }), actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true })] })] }));
|
|
167
|
+
}, "aria-label": t(error ? 'step_name_error' : 'step_name', [value]), ref: setStepLabelEl, children: [value, _jsx(Tooltip, { smart: true, target: stepLabelEl, showDelay: 'none', hideDelay: 'none', children: value })] }), badge?.type && (_jsx(Flex, { as: StyledStepBadge, container: { inline: true, alignItems: 'center' }, children: _jsx(Status, { variant: badge?.type || 'success', children: badge?.label }) }))] }), actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true })] })] }));
|
|
162
168
|
};
|
|
163
169
|
export default Step;
|
|
164
170
|
//# sourceMappingURL=Step.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAkD,UAAU,EAAE,MAAM,OAAO,CAAC;AAC7F,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,EACN,OAAO,EACP,OAAO,EACP,MAAM,EAEP,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;AAUlD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AA2BlD,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;IACvC,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,MAAM;QAClB,CAAC,CAAC,GA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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 Actions,\n useI18n,\n Avatar,\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 LifeCycleActionParam,\n StepProps\n} from './LifeCycle.types';\nimport LifeCycleContext from './LifeCycleContext';\n\ninterface StepComponentProps extends BaseProps, StepProps {\n /** Pass text for the step. */\n value: string;\n /** unique id of step */\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 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\n > span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n `;\n});\n\nStyledStepBadge.defaultProps = defaultThemeProp;\n\nexport const StyledStepWrapper = styled.div(({ theme }) => {\n return css`\n width: 100%;\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledStepWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStep = styled.div<{ hasFocus: boolean }>(({ hasFocus, theme }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border: 0.125rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n\n ${hasFocus &&\n css`\n box-shadow: ${theme.base.shadow.focus};\n `}\n\n &:hover {\n cursor: pointer;\n }\n\n &[aria-current='step'] {\n border-color: ${theme.base.palette.interactive};\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nconst StyledStepButtonWrapper = styled.div<{ error: string }>(({ theme }) => {\n return css`\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n `;\n});\n\nStyledStepButtonWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStepButton = styled.button(({ theme }) => {\n return css`\n border: none;\n height: ${theme.components.button.height};\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: start;\n background: ${theme.base.palette['secondary-background']};\n\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n }\n `;\n});\n\nStyledStepButton.defaultProps = defaultThemeProp;\n\nexport const StyledWarnIcon: typeof Icon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n margin-inline-end: ${theme.base.spacing};\n\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\n\nconst Step: FunctionComponent<StepComponentProps & ForwardProps> = ({\n value,\n id,\n visual,\n actions,\n badge,\n error,\n categoryItem,\n item,\n stageItem,\n taskItem,\n onClick,\n ...restProps\n}: PropsWithoutRef<StepComponentProps>) => {\n const t = useI18n();\n const { selectedItemId } = useContext(LifeCycleContext);\n const [stepHasFocus, setStepHasFocus] = useState(false);\n const [iconEl, setIconEl] = useElement();\n const [errorIcon, setErrorIcon] = useElement();\n\n /* Need to check the value with statusProps */\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n e.stopPropagation();\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 onStepClick = (e: MouseEvent) => {\n e.stopPropagation();\n const actionParam: LifeCycleActionParam = {\n value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem,\n type: 'Step'\n };\n onClick?.(actionParam, e);\n };\n\n return (\n <Flex as={StyledStepWrapper} container={{ inline: true, alignItems: 'center' }}>\n {error && (\n <>\n <StyledWarnIcon\n role='status'\n tabIndex='0'\n aria-label={t('item_error', [error])}\n ref={setErrorIcon}\n name='warn-solid'\n />\n <Tooltip target={errorIcon} aria-hidden={!!error} hideDelay='none'>\n {error}\n </Tooltip>\n </>\n )}\n <Flex\n as={StyledStep}\n container={{ inline: true }}\n aria-current={selectedItemId === id ? 'step' : undefined}\n error={error}\n id={id}\n item={{ grow: 1 }}\n hasFocus={stepHasFocus && selectedItemId !== id}\n onClick={onStepClick}\n >\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={StyledStepButtonWrapper}\n item={{ grow: 1 }}\n container={{ inline: true, alignItems: 'center', justify: 'between' }}\n >\n <StyledStepButton\n {...restProps}\n onFocus={() => {\n setStepHasFocus(true);\n }}\n onBlur={() => {\n setStepHasFocus(false);\n }}\n aria-label={t('step_name', [value])}\n >\n {value}\n </StyledStepButton>\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 {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n </Flex>\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,EAAE,QAAQ,EAAkD,UAAU,EAAE,MAAM,OAAO,CAAC;AAC7F,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,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EAEN,MAAM,EACN,OAAO,EACP,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;AAUlD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AA2BlD,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;IACvC,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,MAAM;QAClB,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eAAe,IAAI,CAAC","sourcesContent":["import { useState, FunctionComponent, PropsWithoutRef, MouseEvent, useContext } 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 Status,\n Actions,\n useI18n,\n Avatar,\n Action,\n useUID,\n Tooltip,\n useElement\n} from '@pega/cosmos-react-core';\n\nimport { colorMap, ColorName } from '../../utils';\n\nimport {\n TaskItemProps,\n StepItemProps,\n StageItemProps,\n CategoryItemProps,\n LifeCycleActionParam,\n StepProps\n} from './LifeCycle.types';\nimport LifeCycleContext from './LifeCycleContext';\n\ninterface StepComponentProps extends BaseProps, StepProps {\n /** Pass text for the step. */\n value: string;\n /** unique id of step */\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 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\n > span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n `;\n});\n\nStyledStepBadge.defaultProps = defaultThemeProp;\n\nexport const StyledStepWrapper = styled.div<{\n hasFocus: boolean;\n selected: boolean;\n}>(({ hasFocus, theme, selected }) => {\n return css`\n width: 100%;\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n border: 0.125rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n\n ${hasFocus &&\n css`\n box-shadow: ${theme.base.shadow.focus};\n `}\n\n &:hover {\n cursor: pointer;\n }\n ${selected &&\n css`\n &[aria-current='step'] {\n border-color: ${theme.base.palette.interactive};\n }\n `}\n `;\n});\n\nStyledStepWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStep = styled.div(({ theme }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border: 0.125rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n\n &:hover {\n cursor: pointer;\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nconst StyledStepButtonWrapper = styled.div<{ error: string }>(({ theme }) => {\n return css`\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n `;\n});\n\nStyledStepButtonWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStepButton = styled.button(({ theme }) => {\n return css`\n border: none;\n height: ${theme.components.button.height};\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: start;\n background: ${theme.base.palette['secondary-background']};\n\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n }\n `;\n});\n\nStyledStepButton.defaultProps = defaultThemeProp;\n\nexport const StyledWarnIcon: typeof Icon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n margin-inline: ${theme.base.spacing};\n\n &:hover {\n cursor: pointer;\n }\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\n\nconst Step: FunctionComponent<StepComponentProps & ForwardProps> = ({\n value,\n id,\n visual,\n actions,\n badge,\n error,\n categoryItem,\n item,\n stageItem,\n taskItem,\n onClick,\n ...restProps\n}: PropsWithoutRef<StepComponentProps>) => {\n const t = useI18n();\n const { selectedItemId } = useContext(LifeCycleContext);\n const [stepHasFocus, setStepHasFocus] = useState(false);\n\n // Need to check the value with statusProps\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n e.stopPropagation();\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 const buttonDescriptionId: string = useUID();\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 if (error) actionsClone.push(actionCloneItem);\n else actionsClone.push({ ...actionCloneItem, 'aria-describedby': buttonDescriptionId });\n return actionItem;\n });\n }\n\n const onStepClick = (e: MouseEvent) => {\n e.stopPropagation();\n const actionParam: LifeCycleActionParam = {\n value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem,\n type: 'Step'\n };\n onClick?.(actionParam, e);\n };\n\n const [stepLabelEl, setStepLabelEl] = useElement<HTMLSpanElement>(null);\n\n return (\n <Flex\n as={StyledStepWrapper}\n id={`${id}-stepWrapper`}\n container={{ inline: true, alignItems: 'center' }}\n aria-current={selectedItemId === id ? 'step' : undefined}\n hasFocus={stepHasFocus && selectedItemId !== id}\n selected={selectedItemId === id}\n >\n {error && <StyledWarnIcon name='warn-solid' />}\n <Flex\n as={StyledStep}\n container={{ inline: true }}\n id={id}\n item={{ grow: 1 }}\n onClick={onStepClick}\n >\n <StyledStepType visual={visual}>\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 <Flex\n as={StyledStepButtonWrapper}\n item={{ grow: 1 }}\n container={{ inline: true, alignItems: 'center', justify: 'between' }}\n id={buttonDescriptionId}\n >\n <StyledStepButton\n {...restProps}\n onFocus={() => {\n setStepHasFocus(true);\n }}\n onBlur={() => {\n setStepHasFocus(false);\n }}\n aria-label={t(error ? 'step_name_error' : 'step_name', [value])}\n ref={setStepLabelEl}\n >\n {value}\n <Tooltip smart target={stepLabelEl} showDelay='none' hideDelay='none'>\n {value}\n </Tooltip>\n </StyledStepButton>\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 {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n </Flex>\n </Flex>\n );\n};\n\nexport default Step;\n"]}
|
|
@@ -10,6 +10,7 @@ interface TaskComponentProps extends BaseProps, TaskProps {
|
|
|
10
10
|
};
|
|
11
11
|
/** Pass task data */
|
|
12
12
|
item: TaskItemProps;
|
|
13
|
+
/** The status is used to show the input error status and the info on tooltip in case of error */
|
|
13
14
|
error?: string;
|
|
14
15
|
/** Step Props */
|
|
15
16
|
step?: StepProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,SAAS,EACT,YAAY,EAEZ,IAAI,
|
|
1
|
+
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,SAAS,EACT,YAAY,EAEZ,IAAI,EAQL,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EACL,aAAa,EACb,cAAc,EAEd,iBAAiB,EAEjB,SAAS,EACT,SAAS,EACV,MAAM,mBAAmB,CAAC;AAG3B,UAAU,kBAAmB,SAAQ,SAAS,EAAE,SAAS;IACvD,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,qBAAqB;IACrB,IAAI,EAAE,aAAa,CAAC;IACpB,iGAAiG;IACjG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wCAAwC;IACxC,SAAS,EAAE,cAAc,CAAC;IAC1B,2CAA2C;IAC3C,YAAY,EAAE,iBAAiB,CAAC;IAChC,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,eAAO,MAAM,cAAc,wGASzB,CAAC;AAIH,eAAO,MAAM,gBAAgB,4GAK3B,CAAC;AAIH,eAAO,MAAM,iBAAiB,yGAI5B,CAAC;AAEH,eAAO,MAAM,gBAAgB,4GAkB3B,CAAC;AAIH,eAAO,MAAM,UAAU;cAA8B,OAAO;SAoB1D,CAAC;AAIH,eAAO,MAAM,cAAc,EAAE,OAAO,IASlC,CAAC;AAIH,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAwK9D,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, useContext } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Flex, defaultThemeProp, Button, Icon,
|
|
4
|
+
import { Flex, defaultThemeProp, Button, Icon, useElement, Actions, useI18n, Avatar, useOuterEvent, useEscape } from '@pega/cosmos-react-core';
|
|
5
5
|
import { ItemLibrary } from '../ItemLibrary';
|
|
6
6
|
import Step from './Step';
|
|
7
7
|
import LifeCycleContext from './LifeCycleContext';
|
|
@@ -73,16 +73,11 @@ StyledTask.defaultProps = defaultThemeProp;
|
|
|
73
73
|
export const StyledWarnIcon = styled(Icon)(({ theme }) => {
|
|
74
74
|
return css `
|
|
75
75
|
color: ${theme.base.palette.urgent};
|
|
76
|
-
margin-inline
|
|
76
|
+
margin-inline: ${theme.base.spacing};
|
|
77
77
|
|
|
78
78
|
&:hover {
|
|
79
79
|
cursor: pointer;
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
&:focus {
|
|
83
|
-
outline: none;
|
|
84
|
-
box-shadow: ${theme.base.shadow.focus};
|
|
85
|
-
}
|
|
86
81
|
`;
|
|
87
82
|
});
|
|
88
83
|
StyledWarnIcon.defaultProps = defaultThemeProp;
|
|
@@ -93,7 +88,6 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
|
|
|
93
88
|
const [showLibrary, setLibrary] = useState(false);
|
|
94
89
|
const [popoverEl, setPopoverEl] = useElement(null);
|
|
95
90
|
const [addEl, setAddEl] = useElement();
|
|
96
|
-
const [errorIcon, setErrorIcon] = useElement();
|
|
97
91
|
const onActionItemClick = (actionId, e) => {
|
|
98
92
|
const param = {
|
|
99
93
|
task: item,
|
|
@@ -106,7 +100,7 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
|
|
|
106
100
|
}
|
|
107
101
|
});
|
|
108
102
|
};
|
|
109
|
-
|
|
103
|
+
// Deep copy of actions is required to provide consistent callback objects on actions
|
|
110
104
|
const actionsClone = [];
|
|
111
105
|
if (actions) {
|
|
112
106
|
actions.forEach(actionItem => {
|
|
@@ -142,11 +136,11 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
|
|
|
142
136
|
setLibrary(false);
|
|
143
137
|
});
|
|
144
138
|
useOuterEvent('mousedown', [addEl, popoverEl], () => setLibrary(false));
|
|
145
|
-
return (_jsx(StyledTaskList, { ...restProps, id: item.id, children: _jsxs(Flex, { as: StyledTask, "aria-current": selectedItemId === id ? 'true' : undefined, container: { direction: 'column' }, id: `${id}-task`, hasFocus: taskHasFocus && selectedItemId !== id, children: [_jsxs(Flex, { as: StyledCardHeader, container: { inline: true, alignItems: 'center' }, children: [visual?.imgurl.length > 0 && _jsx(Avatar, { name: value, imageSrc: visual?.imgurl }), error &&
|
|
139
|
+
return (_jsx(StyledTaskList, { ...restProps, id: item.id, children: _jsxs(Flex, { as: StyledTask, "aria-current": selectedItemId === id ? 'true' : undefined, container: { direction: 'column' }, id: `${id}-task`, hasFocus: taskHasFocus && selectedItemId !== id, children: [_jsxs(Flex, { as: StyledCardHeader, container: { inline: true, alignItems: 'center' }, children: [visual?.imgurl.length > 0 && _jsx(Avatar, { name: value, imageSrc: visual?.imgurl }), error && _jsx(StyledWarnIcon, { name: 'warn-solid' }), _jsx(Flex, { item: { grow: 1 }, container: { inline: true, alignItems: 'center' }, onClick: onTaskClick, children: _jsx(StyledTaskButton, { onFocus: () => {
|
|
146
140
|
setTaskHasFocus(true);
|
|
147
141
|
}, onBlur: () => {
|
|
148
142
|
setTaskHasFocus(false);
|
|
149
|
-
}, "aria-label": t('process_name', [value]), children: value }) }), actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true })] }), _jsxs(StyledCardContent, { children: [item?.steps.map((steps) => {
|
|
143
|
+
}, "aria-label": t(error ? 'process_name_error' : 'process_name', [value]), children: value }) }), actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true })] }), _jsxs(StyledCardContent, { children: [item?.steps.map((steps) => {
|
|
150
144
|
const badgeStatus = steps?.status?.type ? steps.status.type : '';
|
|
151
145
|
const badgeLabel = steps?.status?.label ? steps.status.label : '';
|
|
152
146
|
return (_jsx(Step, { id: steps.id, value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KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,GACb,EACT,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,IACD,CACJ,IACiB,IACf,GACQ,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithChildren,\n MouseEvent,\n useCallback,\n useContext\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 useI18n,\n Avatar,\n useOuterEvent,\n useEscape\n} from '@pega/cosmos-react-core';\n\nimport { LibraryItem, ItemLibrary } from '../ItemLibrary';\n\nimport Step from './Step';\nimport {\n TaskItemProps,\n StageItemProps,\n StepItemProps,\n CategoryItemProps,\n LifeCycleActionParam,\n StepProps,\n TaskProps\n} from './LifeCycle.types';\nimport LifeCycleContext from './LifeCycleContext';\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 /** unique id of task */\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\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 StyledTaskButton = styled.button(({ theme }) => {\n return css`\n background: ${theme.base.palette['primary-background']};\n border: none;\n height: ${theme.components.button.height};\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: start;\n\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n }\n `;\n});\n\nStyledTaskButton.defaultProps = defaultThemeProp;\n\nexport const StyledTask = styled.article<{ hasFocus: boolean }>(({ hasFocus, theme }) => {\n return css`\n background: ${theme.base.palette['primary-background']};\n border: 0.125rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding: calc(${theme.base.spacing} - 0.125rem);\n\n ${hasFocus &&\n css`\n box-shadow: ${theme.base.shadow.focus};\n `}\n\n &:hover {\n cursor: pointer;\n }\n\n &[aria-current='true'] {\n border-color: ${theme.base.palette.interactive};\n }\n `;\n});\n\nStyledTask.defaultProps = defaultThemeProp;\n\nexport const StyledWarnIcon: typeof Icon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n margin-inline-end: ${theme.base.spacing};\n\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\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 onClick,\n categoryItem,\n id,\n step: stepProp,\n nodeLibrary,\n ...restProps\n}: PropsWithChildren<TaskComponentProps>) => {\n const t = useI18n();\n const { selectedItemId, readOnly } = useContext(LifeCycleContext);\n const [taskHasFocus, setTaskHasFocus] = useState(false);\n const [showLibrary, setLibrary] = useState(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const [addEl, setAddEl] = useElement();\n const [errorIcon, setErrorIcon] = useElement();\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 onTaskClick = (e: MouseEvent) => {\n const actionParam: LifeCycleActionParam = {\n value,\n task: item,\n stage: stageItem,\n category: categoryItem,\n type: 'Task'\n };\n onClick?.(actionParam, 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 {...restProps} id={item.id}>\n <Flex\n as={StyledTask}\n aria-current={selectedItemId === id ? 'true' : undefined}\n container={{ direction: 'column' }}\n id={`${id}-task`}\n hasFocus={taskHasFocus && selectedItemId !== id}\n >\n <Flex as={StyledCardHeader} container={{ inline: true, alignItems: 'center' }}>\n {visual?.imgurl.length > 0 && <Avatar name={value} imageSrc={visual?.imgurl} />}\n {error && (\n <>\n <StyledWarnIcon\n ref={setErrorIcon}\n role='status'\n tabIndex='0'\n aria-label={t('item_error', [error])}\n name='warn-solid'\n />\n <Tooltip target={errorIcon} aria-hidden={!!error} hideDelay='none'>\n {error}\n </Tooltip>\n </>\n )}\n <Flex\n item={{ grow: 1 }}\n container={{ inline: true, alignItems: 'center' }}\n onClick={onTaskClick}\n >\n <StyledTaskButton\n onFocus={() => {\n setTaskHasFocus(true);\n }}\n onBlur={() => {\n setTaskHasFocus(false);\n }}\n aria-label={t('process_name', [value])}\n >\n {value}\n </StyledTaskButton>\n </Flex>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\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 {!readOnly && (\n <>\n <Button\n variant='simple'\n ref={setAddEl}\n label={t('add_noun', [addStepTitle])}\n onClick={() => setLibrary(prev => !prev)}\n icon\n >\n <Icon name='plus' />\n </Button>\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 </>\n )}\n </StyledCardContent>\n </Flex>\n </StyledTaskList>\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,EAIR,WAAW,EACX,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,gBAAgB,EA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ACvB,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,EACD,CAAC,QAAQ,IAAI,CACZ,8BACE,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,YAAY,CAAC,CAAC,EACpC,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EACxC,IAAI,kBAEJ,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,GACb,EACT,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,IACD,CACJ,IACiB,IACf,GACQ,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithChildren,\n MouseEvent,\n useCallback,\n useContext\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 useElement,\n Actions,\n useI18n,\n Avatar,\n useOuterEvent,\n useEscape\n} from '@pega/cosmos-react-core';\n\nimport { LibraryItem, ItemLibrary } from '../ItemLibrary';\n\nimport Step from './Step';\nimport {\n TaskItemProps,\n StageItemProps,\n StepItemProps,\n CategoryItemProps,\n LifeCycleActionParam,\n StepProps,\n TaskProps\n} from './LifeCycle.types';\nimport LifeCycleContext from './LifeCycleContext';\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 /** unique id of task */\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\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 StyledTaskButton = styled.button(({ theme }) => {\n return css`\n background: ${theme.base.palette['primary-background']};\n border: none;\n height: ${theme.components.button.height};\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: start;\n\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n }\n `;\n});\n\nStyledTaskButton.defaultProps = defaultThemeProp;\n\nexport const StyledTask = styled.article<{ hasFocus: boolean }>(({ hasFocus, theme }) => {\n return css`\n background: ${theme.base.palette['primary-background']};\n border: 0.125rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding: calc(${theme.base.spacing} - 0.125rem);\n\n ${hasFocus &&\n css`\n box-shadow: ${theme.base.shadow.focus};\n `}\n\n &:hover {\n cursor: pointer;\n }\n\n &[aria-current='true'] {\n border-color: ${theme.base.palette.interactive};\n }\n `;\n});\n\nStyledTask.defaultProps = defaultThemeProp;\n\nexport const StyledWarnIcon: typeof Icon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n margin-inline: ${theme.base.spacing};\n\n &:hover {\n cursor: pointer;\n }\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\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 onClick,\n categoryItem,\n id,\n step: stepProp,\n nodeLibrary,\n ...restProps\n}: PropsWithChildren<TaskComponentProps>) => {\n const t = useI18n();\n const { selectedItemId, readOnly } = useContext(LifeCycleContext);\n const [taskHasFocus, setTaskHasFocus] = useState(false);\n const [showLibrary, setLibrary] = useState(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const [addEl, setAddEl] = useElement();\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 onTaskClick = (e: MouseEvent) => {\n const actionParam: LifeCycleActionParam = {\n value,\n task: item,\n stage: stageItem,\n category: categoryItem,\n type: 'Task'\n };\n onClick?.(actionParam, 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 {...restProps} id={item.id}>\n <Flex\n as={StyledTask}\n aria-current={selectedItemId === id ? 'true' : undefined}\n container={{ direction: 'column' }}\n id={`${id}-task`}\n hasFocus={taskHasFocus && selectedItemId !== id}\n >\n <Flex as={StyledCardHeader} container={{ inline: true, alignItems: 'center' }}>\n {visual?.imgurl.length > 0 && <Avatar name={value} imageSrc={visual?.imgurl} />}\n {error && <StyledWarnIcon name='warn-solid' />}\n <Flex\n item={{ grow: 1 }}\n container={{ inline: true, alignItems: 'center' }}\n onClick={onTaskClick}\n >\n <StyledTaskButton\n onFocus={() => {\n setTaskHasFocus(true);\n }}\n onBlur={() => {\n setTaskHasFocus(false);\n }}\n aria-label={t(error ? 'process_name_error' : 'process_name', [value])}\n >\n {value}\n </StyledTaskButton>\n </Flex>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\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 {!readOnly && (\n <>\n <Button\n variant='simple'\n ref={setAddEl}\n label={t('add_noun', [addStepTitle])}\n onClick={() => setLibrary(prev => !prev)}\n icon\n >\n <Icon name='plus' />\n </Button>\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 </>\n )}\n </StyledCardContent>\n </Flex>\n </StyledTaskList>\n );\n};\n\nexport default Task;\n"]}
|
|
@@ -2,7 +2,6 @@ import { FunctionComponent } from 'react';
|
|
|
2
2
|
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
3
|
import { MobileBuildSummaryProps } from './MobileBuildSummary.types';
|
|
4
4
|
export declare const StyledInteractionTimerIconWrapper: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const StyledQRWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
6
5
|
export declare const StyledContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
6
|
declare const MobileBuildSummary: FunctionComponent<MobileBuildSummaryProps & ForwardProps>;
|
|
8
7
|
export default MobileBuildSummary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileBuildSummary.d.ts","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAGvE,OAAO,EAUL,YAAY,
|
|
1
|
+
{"version":3,"file":"MobileBuildSummary.d.ts","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAGvE,OAAO,EAUL,YAAY,EAUb,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAIrE,eAAO,MAAM,iCAAiC,0GAG7C,CAAC;AAIF,eAAO,MAAM,aAAa,yGAEzB,CAAC;AAIF,QAAA,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,GAAG,YAAY,CAkGjF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import styled
|
|
4
|
-
import { Button, Card, CardContent, CardHeader, defaultThemeProp, EmptyState, FieldValueList, Flex, formatNumber, Icon, Link, Progress, registerIcon, Text, useConfiguration, useI18n, useUID } from '@pega/cosmos-react-core';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Button, Card, CardContent, CardHeader, defaultThemeProp, EmptyState, FieldValueList, Flex, formatNumber, Icon, Link, Progress, QRCode, registerIcon, Text, useConfiguration, useI18n, useUID } from '@pega/cosmos-react-core';
|
|
5
5
|
import * as osAndroid from '@pega/cosmos-react-core/lib/components/Icon/icons/os-android.icon';
|
|
6
6
|
import * as osApple from '@pega/cosmos-react-core/lib/components/Icon/icons/os-apple.icon';
|
|
7
|
-
|
|
8
|
-
registerIcon(galaxyIcon, osAndroid, osApple);
|
|
7
|
+
registerIcon(osAndroid, osApple);
|
|
9
8
|
export const StyledInteractionTimerIconWrapper = styled.span `
|
|
10
9
|
position: relative;
|
|
11
10
|
min-height: 4rem;
|
|
12
11
|
`;
|
|
13
12
|
StyledInteractionTimerIconWrapper.defaultProps = defaultThemeProp;
|
|
14
|
-
export const StyledQRWrapper = styled.div(({ theme }) => {
|
|
15
|
-
return css `
|
|
16
|
-
height: ${theme.base['content-width'].xs};
|
|
17
|
-
width: ${theme.base['content-width'].xs};
|
|
18
|
-
border: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
19
|
-
border-radius: calc(${theme.base['border-radius']} / 2);
|
|
20
|
-
text-align: center;
|
|
21
|
-
`;
|
|
22
|
-
});
|
|
23
|
-
StyledQRWrapper.defaultProps = defaultThemeProp;
|
|
24
13
|
export const StyledContent = styled.div `
|
|
25
14
|
min-height: 10rem;
|
|
26
15
|
`;
|
|
@@ -32,13 +21,13 @@ const MobileBuildSummary = forwardRef(({ type, progress = undefined, onBuild, bu
|
|
|
32
21
|
return (_jsxs(Card, { ...restProps, ref: ref, children: [_jsxs(CardHeader, { container: { alignItems: 'center', itemGap: 1 }, children: [_jsx(Icon, { name: type === 'android' ? 'os-android' : 'os-apple' }), _jsx(Text, { variant: 'h3', children: type === 'android' ? 'Android' : 'iOS' })] }), _jsx(CardContent, { children: _jsxs(_Fragment, { children: [progress === undefined && !buildSummary && (_jsxs(Flex, { container: { alignItems: 'center', gap: 1, direction: 'column', justify: 'center' }, as: StyledContent, children: [_jsx(EmptyState, { message: t('no_app_build') }), onBuild && (_jsx(Button, { variant: 'secondary', onClick: onBuild, children: t('build_app') }))] })), progress !== undefined && (_jsxs(Flex, { container: { alignItems: 'center', gap: 1, direction: 'column', justify: 'center' }, as: StyledContent, children: [_jsx(StyledInteractionTimerIconWrapper, { children: _jsx(Progress, { "aria-describedby": progressId, variant: 'ring', placement: 'local', message: formatNumber(progress / 100, {
|
|
33
22
|
locale,
|
|
34
23
|
options: { style: 'percent' }
|
|
35
|
-
}), value: progress, minValue: 0, maxValue: 100 }) }), _jsx(Text, { variant: 'secondary', id: progressId, children: t('build_in_progress') })] })), buildSummary && !progress && (_jsxs(Flex, { container: { wrap: 'wrap', gap: 2 }, as: StyledContent, children: [
|
|
24
|
+
}), value: progress, minValue: 0, maxValue: 100 }) }), _jsx(Text, { variant: 'secondary', id: progressId, children: t('build_in_progress') })] })), buildSummary && !progress && (_jsxs(Flex, { container: { wrap: 'wrap', gap: 2 }, as: StyledContent, children: [_jsx(Flex, { container: {
|
|
36
25
|
direction: 'column',
|
|
37
26
|
alignItems: 'center',
|
|
38
27
|
justify: 'center',
|
|
39
28
|
gap: 1,
|
|
40
29
|
pad: 2
|
|
41
|
-
},
|
|
30
|
+
}, children: _jsx(QRCode, { value: buildSummary.qrCodeUrl ?? buildSummary.downloadUrl }) }), _jsxs(Flex, { container: { direction: 'column', gap: 2 }, children: [_jsx(FieldValueList, { variant: 'inline', fields: buildSummary.summaryFields }), _jsxs(Flex, { container: { wrap: 'wrap', rowGap: 1 }, children: [onBuild && (_jsx(Button, { variant: 'secondary', onClick: onBuild, children: t('rebuild_app') })), _jsx(Link, { href: buildSummary.downloadUrl, variant: 'secondary', onClick: buildSummary.onDownload, children: t('download_app') })] })] })] }))] }) })] }));
|
|
42
31
|
});
|
|
43
32
|
export default MobileBuildSummary;
|
|
44
33
|
//# sourceMappingURL=MobileBuildSummary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileBuildSummary.js","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmB,MAAM,OAAO,CAAC;AACvE,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"MobileBuildSummary.js","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmB,MAAM,OAAO,CAAC;AACvE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,IAAI,EACJ,YAAY,EAEZ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,gBAAgB,EAChB,OAAO,EACP,MAAM,EACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,mEAAmE,CAAC;AAC/F,OAAO,KAAK,OAAO,MAAM,iEAAiE,CAAC;AAI3F,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC,IAAI,CAAA;;;CAG3D,CAAC;AAEF,iCAAiC,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElE,MAAM,CAAC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AAC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,aACzC,OAAO,IAAI,CACV,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,OAAO,YACzC,CAAC,CAAC,aAAa,CAAC,GACV,CACV,EAED,KAAC,IAAI,IACH,IAAI,EAAE,YAAY,CAAC,WAAW,EAC9B,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,YAAY,CAAC,UAAU,YAE/B,CAAC,CAAC,cAAc,CAAC,GACb,IACF,IACF,IACF,CACR,IACA,GACS,IACT,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n defaultThemeProp,\n EmptyState,\n FieldValueList,\n Flex,\n formatNumber,\n ForwardProps,\n Icon,\n Link,\n Progress,\n QRCode,\n registerIcon,\n Text,\n useConfiguration,\n useI18n,\n useUID\n} from '@pega/cosmos-react-core';\nimport * as osAndroid from '@pega/cosmos-react-core/lib/components/Icon/icons/os-android.icon';\nimport * as osApple from '@pega/cosmos-react-core/lib/components/Icon/icons/os-apple.icon';\n\nimport { MobileBuildSummaryProps } from './MobileBuildSummary.types';\n\nregisterIcon(osAndroid, osApple);\n\nexport const StyledInteractionTimerIconWrapper = styled.span`\n position: relative;\n min-height: 4rem;\n`;\n\nStyledInteractionTimerIconWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div`\n min-height: 10rem;\n`;\n\nStyledContent.defaultProps = defaultThemeProp;\n\nconst MobileBuildSummary: FunctionComponent<MobileBuildSummaryProps & ForwardProps> = forwardRef(\n (\n {\n type,\n progress = undefined,\n onBuild,\n buildSummary,\n ...restProps\n }: PropsWithoutRef<MobileBuildSummaryProps>,\n ref: MobileBuildSummaryProps['ref']\n ) => {\n const progressId = useUID();\n const { locale } = useConfiguration();\n const t = useI18n();\n\n return (\n <Card {...restProps} ref={ref}>\n <CardHeader container={{ alignItems: 'center', itemGap: 1 }}>\n <Icon name={type === 'android' ? 'os-android' : 'os-apple'} />\n <Text variant='h3'>{type === 'android' ? 'Android' : 'iOS'}</Text>\n </CardHeader>\n <CardContent>\n <>\n {progress === undefined && !buildSummary && (\n <Flex\n container={{ alignItems: 'center', gap: 1, direction: 'column', justify: 'center' }}\n as={StyledContent}\n >\n <EmptyState message={t('no_app_build')} />\n {onBuild && (\n <Button variant='secondary' onClick={onBuild}>\n {t('build_app')}\n </Button>\n )}\n </Flex>\n )}\n {progress !== undefined && (\n <Flex\n container={{ alignItems: 'center', gap: 1, direction: 'column', justify: 'center' }}\n as={StyledContent}\n >\n <StyledInteractionTimerIconWrapper>\n <Progress\n aria-describedby={progressId}\n variant='ring'\n placement='local'\n message={formatNumber(progress / 100, {\n locale,\n options: { style: 'percent' }\n })}\n value={progress}\n minValue={0}\n maxValue={100}\n />\n </StyledInteractionTimerIconWrapper>\n <Text variant='secondary' id={progressId}>\n {t('build_in_progress')}\n </Text>\n </Flex>\n )}\n {buildSummary && !progress && (\n <Flex container={{ wrap: 'wrap', gap: 2 }} as={StyledContent}>\n <Flex\n container={{\n direction: 'column',\n alignItems: 'center',\n justify: 'center',\n gap: 1,\n pad: 2\n }}\n >\n <QRCode value={buildSummary.qrCodeUrl ?? buildSummary.downloadUrl} />\n </Flex>\n <Flex container={{ direction: 'column', gap: 2 }}>\n <FieldValueList variant='inline' fields={buildSummary.summaryFields} />\n <Flex container={{ wrap: 'wrap', rowGap: 1 }}>\n {onBuild && (\n <Button variant='secondary' onClick={onBuild}>\n {t('rebuild_app')}\n </Button>\n )}\n\n <Link\n href={buildSummary.downloadUrl}\n variant='secondary'\n onClick={buildSummary.onDownload}\n >\n {t('download_app')}\n </Link>\n </Flex>\n </Flex>\n </Flex>\n )}\n </>\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default MobileBuildSummary;\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Ref, MouseEventHandler } from 'react';
|
|
2
|
-
import { BaseProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { FieldValueListItemProps } from '@pega/cosmos-react-core/lib/components/FieldValueList/FieldValueList';
|
|
2
|
+
import { BaseProps, FieldValueListItemProps } from '@pega/cosmos-react-core';
|
|
4
3
|
export interface AppBuildProps {
|
|
5
4
|
/** URL to the application resource. */
|
|
6
5
|
downloadUrl: string;
|
|
6
|
+
/** QR code url. */
|
|
7
|
+
qrCodeUrl?: string;
|
|
7
8
|
/** Click handler for the download link. */
|
|
8
9
|
onDownload?: MouseEventHandler<HTMLAnchorElement>;
|
|
9
10
|
/** The set of field values to render in the list. */
|
|
@@ -13,7 +14,8 @@ export interface MobileBuildSummaryProps extends BaseProps {
|
|
|
13
14
|
/** Determines which platform type should be rendered. */
|
|
14
15
|
type: 'android' | 'ios';
|
|
15
16
|
/**
|
|
16
|
-
* Progress state is visible with current progress, if provided.
|
|
17
|
+
* Progress state is visible with current progress, if provided.
|
|
18
|
+
* Value within the range of 0-100 should be passed.
|
|
17
19
|
*/
|
|
18
20
|
progress?: number;
|
|
19
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileBuildSummary.types.d.ts","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"MobileBuildSummary.types.d.ts","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAE7E,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAClD,qDAAqD;IACrD,aAAa,EAAE,uBAAuB,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,yDAAyD;IACzD,IAAI,EAAE,SAAS,GAAG,KAAK,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,0BAA0B;IAC1B,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileBuildSummary.types.js","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Ref, MouseEventHandler } from 'react';\n\nimport { BaseProps
|
|
1
|
+
{"version":3,"file":"MobileBuildSummary.types.js","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Ref, MouseEventHandler } from 'react';\n\nimport { BaseProps, FieldValueListItemProps } from '@pega/cosmos-react-core';\n\nexport interface AppBuildProps {\n /** URL to the application resource. */\n downloadUrl: string;\n /** QR code url. */\n qrCodeUrl?: string;\n /** Click handler for the download link. */\n onDownload?: MouseEventHandler<HTMLAnchorElement>;\n /** The set of field values to render in the list. */\n summaryFields: FieldValueListItemProps[];\n}\n\nexport interface MobileBuildSummaryProps extends BaseProps {\n /** Determines which platform type should be rendered. */\n type: 'android' | 'ios';\n /**\n * Progress state is visible with current progress, if provided.\n * Value within the range of 0-100 should be passed.\n */\n progress?: number;\n /**\n * Callback when build or rebuild application button is clicked.\n * If not passed, button will be not displayed.\n */\n onBuild?: () => void;\n /** The build summary fields to display. */\n buildSummary?: AppBuildProps;\n /** Ref to the element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
|
|
@@ -4,8 +4,8 @@ import { PageHeaderProps } from '@pega/cosmos-react-build/lib/components/PageTem
|
|
|
4
4
|
export interface ObjectPreviewProps extends Pick<DrawerProps, 'onAfterOpen' | 'onAfterClose' | 'onBeforeOpen' | 'onBeforeClose'> {
|
|
5
5
|
open?: boolean;
|
|
6
6
|
header: OmitStrict<PageHeaderProps, 'status'>;
|
|
7
|
-
primaryAction?: Action
|
|
8
|
-
secondaryAction?: Action
|
|
7
|
+
primaryAction?: Pick<Action, 'text' | 'onClick' | 'disabled'>;
|
|
8
|
+
secondaryAction?: Pick<Action, 'text' | 'onClick' | 'disabled'>;
|
|
9
9
|
additionalActions?: ActionsProps;
|
|
10
10
|
content: ReactNode;
|
|
11
11
|
onDismiss: () => void;
|
|
@@ -1 +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;
|
|
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,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;IAC9D,eAAe,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;IAChE,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;AAuDD,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,GAAG,YAAY,CAyCzE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -9,7 +9,7 @@ const StyledObjectPreview = styled(Drawer) `
|
|
|
9
9
|
`;
|
|
10
10
|
const PreviewHeader = ({ header, primaryAction, secondaryAction, additionalActions, onDismiss, dismissButtonRef }) => {
|
|
11
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' })] }));
|
|
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, disabled: secondaryAction.disabled, children: secondaryAction.text })), primaryAction && (_jsx(Button, { variant: 'primary', onClick: primaryAction.onClick, disabled: primaryAction.disabled, children: primaryAction.text })), additionalActions && _jsx(Actions, { ...additionalActions })] })] }), _jsx(PageHeader, { ...header, titleTag: 'h2' })] }));
|
|
13
13
|
};
|
|
14
14
|
const ObjectPreview = forwardRef(({ content, header, open, onAfterOpen, onAfterClose, onBeforeOpen, onBeforeClose, ...restprops }, ref) => {
|
|
15
15
|
const contentRef = useConsolidatedRef(ref);
|