@pega/cosmos-react-work 10.0.0-build.4.6 → 10.0.0-build.4.8
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/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +2 -0
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/Details/DetailsList.d.ts.map +1 -1
- package/lib/components/Details/DetailsList.js +2 -2
- package/lib/components/Details/DetailsList.js.map +1 -1
- package/lib/components/GenAICoach/ActiveCases.d.ts.map +1 -1
- package/lib/components/GenAICoach/ActiveCases.js +2 -1
- package/lib/components/GenAICoach/ActiveCases.js.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.d.ts.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.js +13 -6
- package/lib/components/Shortcuts/Shortcuts.js.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.styles.d.ts +13 -2
- package/lib/components/Shortcuts/Shortcuts.styles.d.ts.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.styles.js +71 -29
- package/lib/components/Shortcuts/Shortcuts.styles.js.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.types.d.ts +4 -0
- package/lib/components/Shortcuts/Shortcuts.types.d.ts.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.types.js.map +1 -1
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +55 -36
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +25 -3
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +597 -162
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stages/Stages.types.d.ts +6 -0
- package/lib/components/Stages/Stages.types.d.ts.map +1 -1
- package/lib/components/Stages/Stages.types.js.map +1 -1
- package/lib/components/Stages/index.d.ts +1 -1
- package/lib/components/Stages/index.d.ts.map +1 -1
- package/lib/components/Stages/index.js.map +1 -1
- package/lib/components/Tasks/TaskList.js +1 -1
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcuts.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Shortcuts.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,2BAA2B,6NAEvC,CAAC;AAEF,eAAO,MAAM,6BAA6B,iOAqBxC,CAAC;AAIH,eAAO,MAAM,kCAAkC,6NAS9C,CAAC;AAIF,eAAO,MAAM,8BAA8B;;yLAIzC,CAAC;AAIH,eAAO,MAAM,mBAAmB,6NAG/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;mBAA+B,SAAS,GAAG,QAAQ;YAehF,CAAC;AAIF,eAAO,MAAM,UAAU,+NAOtB,CAAC;AAIF,eAAO,MAAM,kBAAkB;;yLAK9B,CAAC;AAIF,eAAO,MAAM,yBAAyB;;;mBACrB,SAAS,GAAG,QAAQ;oLA4BnC,CAAC;AAIH,eAAO,MAAM,uBAAuB;gBACtB,MAAM;0JAUnB,CAAC;AAIF,eAAO,MAAM,cAAc,+NAM1B,CAAC;AAIF,eAAO,MAAM,kBAAkB,kaAE9B,CAAC;AAIF,eAAO,MAAM,4BAA4B,+NAaxC,CAAC;AAIF,eAAO,MAAM,iBAAiB,oOAK7B,CAAC;AAIF,eAAO,MAAM,wBAAwB;mBACpB,SAAS,GAAG,QAAQ;oBACnB,OAAO;YAsBxB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { mix } from 'polished';
|
|
3
3
|
import { Button, defaultThemeProp, Icon, Text, tryCatch } from '@pega/cosmos-react-core';
|
|
4
|
+
import { lineClamp } from '@pega/cosmos-react-core/lib/styles/mixins';
|
|
4
5
|
export const StyledShortcutsCardsWrapper = styled.div `
|
|
5
6
|
container-type: inline-size;
|
|
6
7
|
`;
|
|
@@ -46,12 +47,40 @@ export const StyledShortcutsCard = styled.li `
|
|
|
46
47
|
display: flex;
|
|
47
48
|
flex-direction: column;
|
|
48
49
|
`;
|
|
50
|
+
export const StyledTextContent = styled.div(({ layoutVariant }) => css `
|
|
51
|
+
${layoutVariant === 'inline' &&
|
|
52
|
+
css `
|
|
53
|
+
flex: 1;
|
|
54
|
+
min-width: 0;
|
|
55
|
+
align-items: flex-start;
|
|
56
|
+
`}
|
|
57
|
+
|
|
58
|
+
${layoutVariant === 'stacked' &&
|
|
59
|
+
css `
|
|
60
|
+
align-items: center;
|
|
61
|
+
width: 100%;
|
|
62
|
+
`}
|
|
63
|
+
`);
|
|
64
|
+
StyledTextContent.defaultProps = defaultThemeProp;
|
|
65
|
+
export const StyledText = styled.span(({ theme: { base } }) => css `
|
|
66
|
+
font-weight: ${base['font-weight']['semi-bold']};
|
|
67
|
+
font-size: 1em;
|
|
68
|
+
color: CanvasText;
|
|
69
|
+
${lineClamp(3)}
|
|
70
|
+
`);
|
|
71
|
+
StyledText.defaultProps = defaultThemeProp;
|
|
72
|
+
export const StyledSubtitleText = styled(Text)(() => css `
|
|
73
|
+
${lineClamp(3)}
|
|
74
|
+
text-align: inherit;
|
|
75
|
+
`);
|
|
76
|
+
StyledSubtitleText.defaultProps = defaultThemeProp;
|
|
49
77
|
export const StyledShortcutsCardButton = styled(Button)(({ theme: { base, components }, layoutVariant }) => {
|
|
50
78
|
const hoverBackgroundColor = tryCatch(() => mix(0.9, base.palette['primary-background'], components.button['secondary-color']));
|
|
51
79
|
return css `
|
|
52
80
|
display: flex;
|
|
53
81
|
align-items: center;
|
|
54
82
|
justify-content: flex-start;
|
|
83
|
+
text-align: ${layoutVariant === 'stacked' ? 'center' : 'start'};
|
|
55
84
|
flex: 1;
|
|
56
85
|
width: 100%;
|
|
57
86
|
border: 0.0625rem solid ${base.palette['border-line']};
|
|
@@ -62,35 +91,18 @@ export const StyledShortcutsCardButton = styled(Button)(({ theme: { base, compon
|
|
|
62
91
|
|
|
63
92
|
&:hover {
|
|
64
93
|
background: ${hoverBackgroundColor};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
${layoutVariant === 'stacked' &&
|
|
68
|
-
css `
|
|
69
|
-
flex-direction: column;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
gap: calc(${base.spacing} * 2);
|
|
72
|
-
text-align: center;
|
|
73
|
-
min-height: 8rem;
|
|
74
|
-
`}
|
|
94
|
+
text-decoration: none;
|
|
75
95
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
text-align: start;
|
|
81
|
-
`}
|
|
96
|
+
${StyledText} {
|
|
97
|
+
text-decoration: underline;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
82
100
|
`;
|
|
83
101
|
});
|
|
84
102
|
StyledShortcutsCardButton.defaultProps = defaultThemeProp;
|
|
85
|
-
export const StyledShortcutsCardIcon = styled(Icon)(({
|
|
103
|
+
export const StyledShortcutsCardIcon = styled(Icon)(({ iconColor }) => css `
|
|
86
104
|
flex-shrink: 0;
|
|
87
105
|
|
|
88
|
-
${layoutVariant === 'stacked' &&
|
|
89
|
-
css `
|
|
90
|
-
width: 3rem;
|
|
91
|
-
height: 3rem;
|
|
92
|
-
`}
|
|
93
|
-
|
|
94
106
|
${iconColor &&
|
|
95
107
|
css `
|
|
96
108
|
color: ${iconColor};
|
|
@@ -103,14 +115,44 @@ export const StyledLabelRow = styled.span(({ theme: { base } }) => css `
|
|
|
103
115
|
gap: calc(${base.spacing} * 0.5);
|
|
104
116
|
`);
|
|
105
117
|
StyledLabelRow.defaultProps = defaultThemeProp;
|
|
106
|
-
export const StyledText = styled.span(({ theme: { base } }) => css `
|
|
107
|
-
font-weight: ${base['font-weight']['semi-bold']};
|
|
108
|
-
font-size: 1em;
|
|
109
|
-
color: CanvasText;
|
|
110
|
-
`);
|
|
111
|
-
StyledText.defaultProps = defaultThemeProp;
|
|
112
118
|
export const StyledExternalIcon = styled(Icon) `
|
|
113
119
|
flex-shrink: 0;
|
|
114
120
|
`;
|
|
115
121
|
StyledExternalIcon.defaultProps = defaultThemeProp;
|
|
122
|
+
export const StyledShortcutImageContainer = styled.span(({ theme: { base, components: { icon } } }) => css `
|
|
123
|
+
flex-shrink: 0;
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
border-radius: calc(${base['border-radius']} / 2);
|
|
126
|
+
width: ${icon.size.m};
|
|
127
|
+
height: ${icon.size.m};
|
|
128
|
+
`);
|
|
129
|
+
StyledShortcutImageContainer.defaultProps = defaultThemeProp;
|
|
130
|
+
export const StyledShortcutImg = styled.img `
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 100%;
|
|
133
|
+
object-fit: contain;
|
|
134
|
+
display: block;
|
|
135
|
+
`;
|
|
136
|
+
StyledShortcutImg.defaultProps = defaultThemeProp;
|
|
137
|
+
export const StyledCardContentWrapper = styled.div(({ layoutVariant, hasDescription, theme: { base } }) => css `
|
|
138
|
+
display: flex;
|
|
139
|
+
flex: 1;
|
|
140
|
+
min-width: 0;
|
|
141
|
+
|
|
142
|
+
${layoutVariant === 'inline' &&
|
|
143
|
+
css `
|
|
144
|
+
flex-direction: row;
|
|
145
|
+
gap: calc(${base.spacing} * 1.5);
|
|
146
|
+
align-items: ${hasDescription ? 'flex-start' : 'center'};
|
|
147
|
+
`}
|
|
148
|
+
|
|
149
|
+
${layoutVariant === 'stacked' &&
|
|
150
|
+
css `
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
gap: calc(${base.spacing} * 2);
|
|
153
|
+
align-items: center;
|
|
154
|
+
justify-content: center;
|
|
155
|
+
`}
|
|
156
|
+
`);
|
|
157
|
+
StyledCardContentWrapper.defaultProps = defaultThemeProp;
|
|
116
158
|
//# sourceMappingURL=Shortcuts.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcuts.styles.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"Shortcuts.styles.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAEtE,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEpD,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IAC7E,OAAO,GAAG,CAAA;;+DAEmD,IAAI,CAAC,OAAO;WAChE,IAAI,CAAC,OAAO;;eAER,IAAI,CAAC,OAAO;;;6BAGE,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;;;;;;;;6BAQ/B,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;;;GAGzD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,6BAA6B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE9D,MAAM,CAAC,MAAM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AI,CAAC,OAAO;GACzB,CACF,CAAC;AAEF,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAE7C,CAAC;AAEF,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,IAAI,CACrD,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EACJ,UAAU,EAAE,EAAE,IAAI,EAAE,EACrB,EACF,EAAE,EAAE,CAAC,GAAG,CAAA;;;0BAGe,IAAI,CAAC,eAAe,CAAC;aAClC,IAAI,CAAC,IAAI,CAAC,CAAC;cACV,IAAI,CAAC,IAAI,CAAC,CAAC;GACtB,CACF,CAAC;AAEF,4BAA4B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAK1C,CAAC;AAEF,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAIhD,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;;;MAKvD,aAAa,KAAK,QAAQ;IAC5B,GAAG,CAAA;;kBAEW,IAAI,CAAC,OAAO;qBACT,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ;KACxD;;MAEC,aAAa,KAAK,SAAS;IAC7B,GAAG,CAAA;;kBAEW,IAAI,CAAC,OAAO;;;KAGzB;GACF,CACF,CAAC;AAEF,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { Button, defaultThemeProp, Icon, Text, tryCatch } from '@pega/cosmos-react-core';\nimport { lineClamp } from '@pega/cosmos-react-core/lib/styles/mixins';\n\nexport const StyledShortcutsCardsWrapper = styled.div`\n container-type: inline-size;\n`;\n\nexport const StyledShortcutsCardsContainer = styled.ul(({ theme: { base } }) => {\n return css`\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(calc(${base.spacing} * 30), 100%), 1fr));\n gap: ${base.spacing};\n list-style: none;\n padding: ${base.spacing} 0;\n margin: 0;\n\n @container (min-width: ${parseFloat(base.breakpoints.sm)}rem) {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n grid-auto-rows: 1fr;\n justify-content: start;\n align-items: stretch;\n width: 100%;\n }\n\n @container (min-width: ${parseFloat(base.breakpoints.md)}rem) {\n grid-template-columns: repeat(4, minmax(0, 1fr));\n }\n `;\n});\n\nStyledShortcutsCardsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCategoriesContainer = styled.div(\n ({ theme: { base } }) => css`\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: calc(${base.spacing} * 2);\n width: 100%;\n padding-block-start: ${base.spacing};\n container-type: inline-size;\n `\n);\n\nStyledShortcutsCategoriesContainer.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCategoryHeading = styled(Text)(({ theme: { base } }) => {\n return css`\n margin-block-end: ${base.spacing};\n `;\n});\n\nStyledShortcutsCategoryHeading.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCard = styled.li`\n display: flex;\n flex-direction: column;\n`;\n\nexport const StyledTextContent = styled.div<{ layoutVariant: 'stacked' | 'inline' }>(\n ({ layoutVariant }) => css`\n ${layoutVariant === 'inline' &&\n css`\n flex: 1;\n min-width: 0;\n align-items: flex-start;\n `}\n\n ${layoutVariant === 'stacked' &&\n css`\n align-items: center;\n width: 100%;\n `}\n `\n);\n\nStyledTextContent.defaultProps = defaultThemeProp;\n\nexport const StyledText = styled.span(\n ({ theme: { base } }) => css`\n font-weight: ${base['font-weight']['semi-bold']};\n font-size: 1em;\n color: CanvasText;\n ${lineClamp(3)}\n `\n);\n\nStyledText.defaultProps = defaultThemeProp;\n\nexport const StyledSubtitleText = styled(Text)(\n () => css`\n ${lineClamp(3)}\n text-align: inherit;\n `\n);\n\nStyledSubtitleText.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCardButton = styled(Button)<{\n layoutVariant: 'stacked' | 'inline';\n}>(({ theme: { base, components }, layoutVariant }) => {\n const hoverBackgroundColor = tryCatch(() =>\n mix(0.9, base.palette['primary-background'], components.button['secondary-color'])\n );\n\n return css`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n text-align: ${layoutVariant === 'stacked' ? 'center' : 'start'};\n flex: 1;\n width: 100%;\n border: 0.0625rem solid ${base.palette['border-line']};\n border-radius: ${base['border-radius']};\n background: ${base.palette['primary-background']};\n padding-inline: calc(${base.spacing} * 2);\n padding-block: calc(${base.spacing} * 1.5);\n\n &:hover {\n background: ${hoverBackgroundColor};\n text-decoration: none;\n\n ${StyledText} {\n text-decoration: underline;\n }\n }\n `;\n});\n\nStyledShortcutsCardButton.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCardIcon = styled(Icon)<{\n iconColor?: string;\n}>(\n ({ iconColor }) => css`\n flex-shrink: 0;\n\n ${iconColor &&\n css`\n color: ${iconColor};\n `}\n `\n);\n\nStyledShortcutsCardIcon.defaultProps = defaultThemeProp;\n\nexport const StyledLabelRow = styled.span(\n ({ theme: { base } }) => css`\n display: flex;\n align-items: center;\n gap: calc(${base.spacing} * 0.5);\n `\n);\n\nStyledLabelRow.defaultProps = defaultThemeProp;\n\nexport const StyledExternalIcon = styled(Icon)`\n flex-shrink: 0;\n`;\n\nStyledExternalIcon.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutImageContainer = styled.span(\n ({\n theme: {\n base,\n components: { icon }\n }\n }) => css`\n flex-shrink: 0;\n overflow: hidden;\n border-radius: calc(${base['border-radius']} / 2);\n width: ${icon.size.m};\n height: ${icon.size.m};\n `\n);\n\nStyledShortcutImageContainer.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutImg = styled.img`\n width: 100%;\n height: 100%;\n object-fit: contain;\n display: block;\n`;\n\nStyledShortcutImg.defaultProps = defaultThemeProp;\n\nexport const StyledCardContentWrapper = styled.div<{\n layoutVariant: 'stacked' | 'inline';\n hasDescription: boolean;\n}>(\n ({ layoutVariant, hasDescription, theme: { base } }) => css`\n display: flex;\n flex: 1;\n min-width: 0;\n\n ${layoutVariant === 'inline' &&\n css`\n flex-direction: row;\n gap: calc(${base.spacing} * 1.5);\n align-items: ${hasDescription ? 'flex-start' : 'center'};\n `}\n\n ${layoutVariant === 'stacked' &&\n css`\n flex-direction: column;\n gap: calc(${base.spacing} * 2);\n align-items: center;\n justify-content: center;\n `}\n `\n);\n\nStyledCardContentWrapper.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -13,6 +13,10 @@ export interface ShortcutLinkItem extends ShortcutItemBase {
|
|
|
13
13
|
type: 'external';
|
|
14
14
|
/** Absolute URL the link navigates to. Opens in a new tab. */
|
|
15
15
|
href: string;
|
|
16
|
+
/** Optional subtitle displayed below the label. */
|
|
17
|
+
description?: string;
|
|
18
|
+
/** Optional image URL. Renders in place of the icon; falls back to icon if the image fails to load. */
|
|
19
|
+
image?: string;
|
|
16
20
|
}
|
|
17
21
|
export interface ShortcutNavItem extends ShortcutItemBase {
|
|
18
22
|
/** Discriminant — this item navigates to a portal landing page. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcuts.types.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1E,UAAU,gBAAgB;IACxB,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CA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C,EAAE,YAAY,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,+EAA+E;IAC/E,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;AAED,UAAU,kBAAmB,SAAQ,cAAc,EAAE,UAAU;IAC7D,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B,qCAAqC;IACrC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,CAAC,kBAAkB,GAAG,uBAAuB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcuts.types.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Ref } from 'react';\n\nimport type { NoChildrenProp, TestIdProp } from '@pega/cosmos-react-core';\n\ninterface ShortcutItemBase {\n /** Unique identifier for this shortcut. */\n id: string;\n /** Display label shown on the shortcut. */\n label: string;\n /** Icon name from the registered icon set. */\n icon: string;\n}\n\nexport interface ShortcutLinkItem extends ShortcutItemBase {\n /** Discriminant — this item navigates to an external URL. */\n type: 'external';\n /** Absolute URL the link navigates to. Opens in a new tab. */\n href: string;\n}\n\nexport interface ShortcutNavItem extends ShortcutItemBase {\n /** Discriminant — this item navigates to a portal landing page. */\n type: 'page';\n /** Callback invoked when the user activates this shortcut. */\n onClick: () => void;\n}\n\nexport type ShortcutItem = ShortcutLinkItem | ShortcutNavItem;\n\nexport interface ShortcutCategory {\n /** Unique identifier for this category. */\n id: string;\n /** Display label shown as the category heading. */\n label: string;\n /** Shortcut items belonging to this category. */\n items: ShortcutItem[];\n}\n\ninterface ShortcutsWithItems {\n /** Shortcut items to render as cards. */\n items?: ShortcutItem[];\n categories?: never;\n /**\n * Whether to render the outer card shell with a heading.\n * When `false`, only the card grid is rendered, centered within its container.\n * @default true\n */\n showHeader?: boolean;\n}\n\ninterface ShortcutsWithCategories {\n items?: never;\n /** Grouped shortcut items, each rendered as cards under a category heading. */\n categories: ShortcutCategory[];\n showHeader?: never;\n}\n\ninterface ShortcutsBaseProps extends NoChildrenProp, TestIdProp {\n /** Heading displayed above the shortcuts. */\n heading?: string;\n /**\n * Controls the layout variant of each shortcut card.\n * - `stacked`: large icon above the label (default card style).\n * - `inline`: small icon inline to the left of the label (list/link style).\n * @default 'inline'\n */\n variant?: 'stacked' | 'inline';\n /** Ref for the root card element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport type ShortcutsProps = ShortcutsBaseProps & (ShortcutsWithItems | ShortcutsWithCategories);\n"]}
|
|
1
|
+
{"version":3,"file":"Shortcuts.types.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Ref } from 'react';\n\nimport type { NoChildrenProp, TestIdProp } from '@pega/cosmos-react-core';\n\ninterface ShortcutItemBase {\n /** Unique identifier for this shortcut. */\n id: string;\n /** Display label shown on the shortcut. */\n label: string;\n /** Icon name from the registered icon set. */\n icon: string;\n}\n\nexport interface ShortcutLinkItem extends ShortcutItemBase {\n /** Discriminant — this item navigates to an external URL. */\n type: 'external';\n /** Absolute URL the link navigates to. Opens in a new tab. */\n href: string;\n /** Optional subtitle displayed below the label. */\n description?: string;\n /** Optional image URL. Renders in place of the icon; falls back to icon if the image fails to load. */\n image?: string;\n}\n\nexport interface ShortcutNavItem extends ShortcutItemBase {\n /** Discriminant — this item navigates to a portal landing page. */\n type: 'page';\n /** Callback invoked when the user activates this shortcut. */\n onClick: () => void;\n}\n\nexport type ShortcutItem = ShortcutLinkItem | ShortcutNavItem;\n\nexport interface ShortcutCategory {\n /** Unique identifier for this category. */\n id: string;\n /** Display label shown as the category heading. */\n label: string;\n /** Shortcut items belonging to this category. */\n items: ShortcutItem[];\n}\n\ninterface ShortcutsWithItems {\n /** Shortcut items to render as cards. */\n items?: ShortcutItem[];\n categories?: never;\n /**\n * Whether to render the outer card shell with a heading.\n * When `false`, only the card grid is rendered, centered within its container.\n * @default true\n */\n showHeader?: boolean;\n}\n\ninterface ShortcutsWithCategories {\n items?: never;\n /** Grouped shortcut items, each rendered as cards under a category heading. */\n categories: ShortcutCategory[];\n showHeader?: never;\n}\n\ninterface ShortcutsBaseProps extends NoChildrenProp, TestIdProp {\n /** Heading displayed above the shortcuts. */\n heading?: string;\n /**\n * Controls the layout variant of each shortcut card.\n * - `stacked`: large icon above the label (default card style).\n * - `inline`: small icon inline to the left of the label (list/link style).\n * @default 'inline'\n */\n variant?: 'stacked' | 'inline';\n /** Ref for the root card element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport type ShortcutsProps = ShortcutsBaseProps & (ShortcutsWithItems | ShortcutsWithCategories);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stages.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,+BAA+B,EAAgB,MAAM,yBAAyB,CAAC;AAG7F,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"Stages.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,+BAA+B,EAAgB,MAAM,yBAAyB,CAAC;AAG7F,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;;;;AAqV/D,wBAAqD"}
|
|
@@ -4,11 +4,12 @@ import { Icon, registerIcon, Flex, useI18n, Button, Modal, useBreakpoint, useMod
|
|
|
4
4
|
import * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';
|
|
5
5
|
import { getStagesTestIds } from './Stages.test-ids';
|
|
6
6
|
import StageGlimpse from './StageGlimpse';
|
|
7
|
-
import { StyledInnerStage, StyledStageCompleteIcon, StyledStage, StyledStageContainer, StyledStageGlimpse, StyledStages, StyledStagesWrapper, StyledStagesDescription, StyledStageText, StyledSentinel } from './Stages.styles';
|
|
7
|
+
import { StyledInnerStage, StyledStageCompleteIcon, StyledStage, StyledStageContainer, StyledStageGlimpse, StyledStages, StyledStagesWrapper, StyledStagesDescription, StyledStageText, StyledSentinel, StyledMilestoneStageContainer, StyledMilestoneButton, StyledMilestoneLabel } from './Stages.styles';
|
|
8
8
|
registerIcon(checkIcon);
|
|
9
|
-
const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadStage, readOnly = false, testId, ...restProps }, ref) {
|
|
9
|
+
const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadStage, readOnly = false, variant = 'chevron', testId, ...restProps }, ref) {
|
|
10
10
|
const t = useI18n();
|
|
11
11
|
const testIds = useTestIds(testId, getStagesTestIds);
|
|
12
|
+
const isMilestoneVariant = variant === 'milestone';
|
|
12
13
|
const stagesRef = useConsolidatedRef(ref);
|
|
13
14
|
const wrapperRef = useRef(null);
|
|
14
15
|
const startSentinelRef = useRef(null);
|
|
@@ -96,7 +97,50 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
|
|
|
96
97
|
children: renderModalStages()
|
|
97
98
|
});
|
|
98
99
|
}, [stagesToLoad.length]);
|
|
99
|
-
|
|
100
|
+
const setStageButtonRef = (stageId, isCurrent) => (el) => {
|
|
101
|
+
if (el) {
|
|
102
|
+
stagesRefs.current.set(stageId, el);
|
|
103
|
+
if (isCurrent)
|
|
104
|
+
setCurrentStageBtn(prev => (prev !== el ? el : prev));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
stagesRefs.current.delete(stageId);
|
|
108
|
+
if (isCurrent)
|
|
109
|
+
setCurrentStageBtn(null);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const handleStageClick = (stageId, hasToLoad) => (e) => {
|
|
113
|
+
if (isSmallOrAbove) {
|
|
114
|
+
if (hasToLoad)
|
|
115
|
+
onLoadStage?.([stageId]);
|
|
116
|
+
const btn = e.currentTarget;
|
|
117
|
+
btn.scrollIntoView({
|
|
118
|
+
inline: 'center',
|
|
119
|
+
behavior: 'smooth',
|
|
120
|
+
block: 'nearest'
|
|
121
|
+
});
|
|
122
|
+
setTarget(btn);
|
|
123
|
+
setTargetStageId(stageId);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
openModal();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const getStageButtonProps = ({ stageId, stageName, stageStatusText, isCurrent, hasToLoad }) => {
|
|
130
|
+
const isExpanded = targetStageId === stageId && Boolean(target) && isSmallOrAbove;
|
|
131
|
+
return {
|
|
132
|
+
ref: setStageButtonRef(stageId, isCurrent),
|
|
133
|
+
'aria-current': isCurrent ? 'step' : undefined,
|
|
134
|
+
'aria-label': t('stages_stage_label', [stageName, stageStatusText]),
|
|
135
|
+
'aria-expanded': isExpanded ? true : undefined,
|
|
136
|
+
'aria-controls': isExpanded ? dialogId : undefined,
|
|
137
|
+
...(!readOnly && {
|
|
138
|
+
'aria-haspopup': 'dialog',
|
|
139
|
+
onClick: handleStageClick(stageId, hasToLoad)
|
|
140
|
+
})
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
return (_jsxs(_Fragment, { children: [_jsx(StyledStagesWrapper, { ref: wrapperRef, "data-testid": testIds.root, children: _jsxs(Flex, { ...restProps, container: true, as: StyledStages, ref: stagesRef, variant: variant, dir: rtl ? 'rtl' : 'ltr', "aria-label": t('stages_label'), "aria-describedby": descriptionId, children: [_jsx(StyledSentinel, { ref: startSentinelRef, "aria-hidden": 'true' }), stages.map((stage, stageIndex) => {
|
|
100
144
|
const isCurrent = stage.id === current;
|
|
101
145
|
let stageStatusText = t(stage.completed ? 'completed' : 'not_started');
|
|
102
146
|
if (isCurrent)
|
|
@@ -112,39 +156,14 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
|
|
|
112
156
|
else {
|
|
113
157
|
stageStatus = 'pending';
|
|
114
158
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (isCurrent)
|
|
124
|
-
setCurrentStageBtn(null);
|
|
125
|
-
}
|
|
126
|
-
}, "aria-expanded": targetStageId === stage.id && Boolean(target) && isSmallOrAbove
|
|
127
|
-
? true
|
|
128
|
-
: undefined, "aria-controls": targetStageId === stage.id && target && isSmallOrAbove ? dialogId : undefined, ...(!readOnly && {
|
|
129
|
-
'aria-haspopup': 'dialog',
|
|
130
|
-
onClick: (e) => {
|
|
131
|
-
if (isSmallOrAbove) {
|
|
132
|
-
if (hasToLoad)
|
|
133
|
-
onLoadStage?.([stage.id]);
|
|
134
|
-
const btn = e.currentTarget;
|
|
135
|
-
btn.scrollIntoView({
|
|
136
|
-
inline: 'center',
|
|
137
|
-
behavior: 'smooth',
|
|
138
|
-
block: 'nearest'
|
|
139
|
-
});
|
|
140
|
-
setTarget(btn);
|
|
141
|
-
setTargetStageId(stage.id);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
openModal();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}), children: _jsxs(StyledInnerStage, { children: [stage.completed && _jsx(Icon, { name: 'check' }), stage.name] }) }) }), target && targetStageId === stage.id && isSmallOrAbove && !showModal && (_jsx(InfoDialog, { id: dialogId, heading: stage.name, target: target, progress: hasToLoad ? t('loading') : undefined, onDismiss: () => {
|
|
159
|
+
const stageButtonProps = getStageButtonProps({
|
|
160
|
+
stageId: stage.id,
|
|
161
|
+
stageName: stage.name,
|
|
162
|
+
stageStatusText,
|
|
163
|
+
isCurrent,
|
|
164
|
+
hasToLoad
|
|
165
|
+
});
|
|
166
|
+
return (_jsxs(Fragment, { children: [isMilestoneVariant ? (_jsxs(StyledMilestoneStageContainer, { status: stageStatus, nextCompleted: stages[stageIndex + 1]?.completed ?? false, readOnly: readOnly, children: [_jsx(StyledMilestoneButton, { status: stageStatus, readOnly: readOnly, ...stageButtonProps, children: stage.completed ? (_jsx(Icon, { name: 'check' })) : (_jsx("span", { "aria-hidden": 'true', children: stageIndex + 1 })) }), _jsx(StyledMilestoneLabel, { children: stage.name })] })) : (_jsx(Flex, { as: StyledStageContainer, item: { grow: 1, shrink: 0 }, readOnly: readOnly, variant: variant, children: _jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, as: StyledStage, item: { grow: 1, shrink: 0 }, status: stageStatus, readOnly: readOnly, variant: variant, ...stageButtonProps, children: _jsxs(StyledInnerStage, { children: [stage.completed && _jsx(Icon, { name: 'check' }), stage.name] }) }) })), target && targetStageId === stage.id && isSmallOrAbove && !showModal && (_jsx(InfoDialog, { id: dialogId, heading: stage.name, target: target, progress: hasToLoad ? t('loading') : undefined, onDismiss: () => {
|
|
148
167
|
setTarget(null);
|
|
149
168
|
setTargetStageId(null);
|
|
150
169
|
}, placement: 'bottom', children: !hasToLoad && (_jsxs(StyledStageGlimpse, { children: [_jsx(StageGlimpse, { stage: stage }), _jsx(Button, { variant: 'secondary', onClick: openModal, children: t('stages_see_full_lifecycle') })] })) }))] }, stage.id));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stages.js","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG1E,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,aAAa,EACb,eAA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AS,IAAI,CACvE,KAAC,UAAU,IACT,EAAE,EAAE,QAAQ,EACZ,OAAO,EAAE,KAAK,CAAC,IAAI,EACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,EAC9C,SAAS,EAAE,GAAG,EAAE;4CACd,SAAS,CAAC,IAAI,CAAC,CAAC;4CAChB,gBAAgB,CAAC,IAAI,CAAC,CAAC;wCACzB,CAAC,EACD,SAAS,EAAC,QAAQ,YAEjB,CAAC,SAAS,IAAI,CACb,MAAC,kBAAkB,eACjB,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,EAC9B,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,SAAS,YAC3C,CAAC,CAAC,2BAA2B,CAAC,GACxB,IACU,CACtB,GACU,CACd,KAzEY,KAAK,CAAC,EAAE,CA0EZ,CACZ,CAAC;wBACJ,CAAC,CAAC,EACF,KAAC,cAAc,IAAC,GAAG,EAAE,cAAc,iBAAc,MAAM,GAAG,IACrD,GACa,EACtB,KAAC,uBAAuB,IAAC,EAAE,EAAE,aAAa,YACvC,CAAC,CAAC,oBAAoB,CAAC,GACA,IACzB,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';\nimport type { MouseEvent, PropsWithoutRef } from 'react';\n\nimport {\n Icon,\n registerIcon,\n Flex,\n useI18n,\n Button,\n Modal,\n useBreakpoint,\n useModalManager,\n useConsolidatedRef,\n useUID,\n InfoDialog,\n useArrows,\n useDirection,\n useAfterInitialEffect,\n VisuallyHiddenText,\n withTestIds,\n useTestIds,\n useElement,\n useFocusWithin,\n isInstance\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, ModalMethods } from '@pega/cosmos-react-core';\nimport * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';\n\nimport type { StagesProps, StageStatus } from './Stages.types';\nimport { getStagesTestIds } from './Stages.test-ids';\nimport StageGlimpse from './StageGlimpse';\nimport {\n StyledInnerStage,\n StyledStageCompleteIcon,\n StyledStage,\n StyledStageContainer,\n StyledStageGlimpse,\n StyledStages,\n StyledStagesWrapper,\n StyledStagesDescription,\n StyledStageText,\n StyledSentinel\n} from './Stages.styles';\n\nregisterIcon(checkIcon);\n\nconst Stages: ForwardRefForwardPropsComponent<StagesProps> = forwardRef(function Stages(\n {\n current,\n stages,\n caseTitle,\n onLoadStage,\n readOnly = false,\n testId,\n ...restProps\n }: PropsWithoutRef<StagesProps>,\n ref: StagesProps['ref']\n) {\n const t = useI18n();\n const testIds = useTestIds(testId, getStagesTestIds);\n const stagesRef = useConsolidatedRef(ref);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const startSentinelRef = useRef<HTMLLIElement>(null);\n const endSentinelRef = useRef<HTMLLIElement>(null);\n const stagesRefs = useRef<Map<string, HTMLButtonElement>>(new Map());\n\n const [target, setTarget] = useElement<HTMLButtonElement>(null);\n const [targetStageId, setTargetStageId] = useState<string | null>(null);\n const [currentStageBtn, setCurrentStageBtn] = useState<HTMLButtonElement | null>(null);\n\n const { create: createModal } = useModalManager();\n const modalMethods = useRef<ModalMethods>();\n const [showModal, setShowModal] = useState(false);\n\n const isSmallOrAbove = useBreakpoint('sm');\n\n const { rtl } = useDirection();\n\n useArrows(\n stagesRef,\n {\n cycle: false,\n selector: ':scope > li > button:not([aria-expanded])',\n dir: 'left-right',\n initialFocusElement: currentStageBtn\n },\n [currentStageBtn]\n );\n\n const dialogId = useUID();\n const descriptionId = useUID();\n\n useEffect(() => {\n const el = stagesRef.current;\n const wrapper = wrapperRef.current;\n const startSentinel = startSentinelRef.current;\n const endSentinel = endSentinelRef.current;\n if (!el || !wrapper || !startSentinel || !endSentinel) return;\n\n const fadeValue = 'var(--stages-fade-width)';\n\n const observer = new IntersectionObserver(\n entries => {\n for (const entry of entries) {\n const visible = entry.isIntersecting;\n if (entry.target === startSentinel) {\n wrapper.style.setProperty('--stages-fade-start', visible ? '0rem' : fadeValue);\n } else if (entry.target === endSentinel) {\n wrapper.style.setProperty('--stages-fade-end', visible ? '0rem' : fadeValue);\n }\n }\n },\n { root: el, threshold: 0 }\n );\n\n observer.observe(startSentinel);\n observer.observe(endSentinel);\n\n return () => observer.disconnect();\n }, [stages.length]);\n\n useEffect(() => {\n const el = stagesRef.current;\n const currentBtn = el?.querySelector<HTMLButtonElement>('[aria-current=\"step\"]');\n currentBtn?.scrollIntoView({ inline: 'center', behavior: 'auto', block: 'nearest' });\n }, [current]); // re-center whenever the active stage changes\n\n useFocusWithin([stagesRef], focused => {\n if (focused && isInstance(document.activeElement, HTMLButtonElement)) {\n document.activeElement.scrollIntoView({\n inline: 'center',\n behavior: 'smooth',\n block: 'nearest'\n });\n }\n });\n\n const stagesToLoad = onLoadStage\n ? stages.filter(stage => !Array.isArray(stage.steps)).map(stage => stage.id)\n : [];\n\n const renderModalStages = () =>\n stages.map(stage => (\n <Fragment key={stage.id}>\n <Flex container={{ alignItems: 'start', gap: 0.5 }}>\n {stage.completed && <StyledStageCompleteIcon name='check' />}\n <StyledStageText variant='h3' isCurrent={stage.id === current}>\n {stage.name}\n {stage.completed && <VisuallyHiddenText>{`- ${t('completed')}`}</VisuallyHiddenText>}\n </StyledStageText>\n </Flex>\n <StageGlimpse stage={stage} />\n </Fragment>\n ));\n\n const openModal = () => {\n setShowModal(true);\n if (stagesToLoad.length > 0) onLoadStage?.(stagesToLoad);\n modalMethods.current = createModal(Modal, {\n heading: caseTitle\n ? t('stages_case_lifecycle', [caseTitle])\n : t('stages_default_case_lifecycle'),\n progress: stagesToLoad.length > 0,\n children: renderModalStages(),\n onBeforeClose: () => {\n setShowModal(false);\n target?.focus();\n setTarget(null);\n setTargetStageId(null);\n modalMethods.current = undefined;\n }\n });\n };\n\n useAfterInitialEffect(() => {\n modalMethods.current?.update({\n progress: stagesToLoad.length > 0,\n children: renderModalStages()\n });\n }, [stagesToLoad.length]);\n\n return (\n <>\n <StyledStagesWrapper ref={wrapperRef} data-testid={testIds.root}>\n <Flex\n {...restProps}\n container\n as={StyledStages}\n ref={stagesRef}\n dir={rtl ? 'rtl' : 'ltr'}\n aria-label={t('stages_label')}\n aria-describedby={descriptionId}\n >\n <StyledSentinel ref={startSentinelRef} aria-hidden='true' />\n {stages.map(stage => {\n const isCurrent = stage.id === current;\n let stageStatusText = t(stage.completed ? 'completed' : 'not_started');\n if (isCurrent) stageStatusText = t('current');\n\n const hasToLoad = stagesToLoad.includes(stage.id);\n\n let stageStatus: StageStatus;\n\n if (stage.completed) {\n stageStatus = 'completed';\n } else if (isCurrent) {\n stageStatus = 'current';\n } else {\n stageStatus = 'pending';\n }\n\n return (\n <Fragment key={stage.id}>\n <Flex as={StyledStageContainer} item={{ grow: 1, shrink: 0 }} readOnly={readOnly}>\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledStage}\n item={{ grow: 1, shrink: 0 }}\n status={stageStatus}\n readOnly={readOnly}\n aria-current={isCurrent ? 'step' : undefined}\n aria-label={t('stages_stage_label', [stage.name, stageStatusText])}\n ref={(el: HTMLButtonElement | null) => {\n if (el) {\n stagesRefs.current.set(stage.id, el);\n if (isCurrent) setCurrentStageBtn(prev => (prev !== el ? el : prev));\n } else {\n stagesRefs.current.delete(stage.id);\n if (isCurrent) setCurrentStageBtn(null);\n }\n }}\n aria-expanded={\n targetStageId === stage.id && Boolean(target) && isSmallOrAbove\n ? true\n : undefined\n }\n aria-controls={\n targetStageId === stage.id && target && isSmallOrAbove ? dialogId : undefined\n }\n {...(!readOnly && {\n 'aria-haspopup': 'dialog' as const,\n onClick: (e: MouseEvent<HTMLButtonElement>) => {\n if (isSmallOrAbove) {\n if (hasToLoad) onLoadStage?.([stage.id]);\n const btn = e.currentTarget;\n btn.scrollIntoView({\n inline: 'center',\n behavior: 'smooth',\n block: 'nearest'\n });\n setTarget(btn);\n setTargetStageId(stage.id);\n } else {\n openModal();\n }\n }\n })}\n >\n <StyledInnerStage>\n {stage.completed && <Icon name='check' />}\n {stage.name}\n </StyledInnerStage>\n </Flex>\n </Flex>\n {target && targetStageId === stage.id && isSmallOrAbove && !showModal && (\n <InfoDialog\n id={dialogId}\n heading={stage.name}\n target={target}\n progress={hasToLoad ? t('loading') : undefined}\n onDismiss={() => {\n setTarget(null);\n setTargetStageId(null);\n }}\n placement='bottom'\n >\n {!hasToLoad && (\n <StyledStageGlimpse>\n <StageGlimpse stage={stage} />\n <Button variant='secondary' onClick={openModal}>\n {t('stages_see_full_lifecycle')}\n </Button>\n </StyledStageGlimpse>\n )}\n </InfoDialog>\n )}\n </Fragment>\n );\n })}\n <StyledSentinel ref={endSentinelRef} aria-hidden='true' />\n </Flex>\n </StyledStagesWrapper>\n <StyledStagesDescription id={descriptionId}>\n {t('stages_description')}\n </StyledStagesDescription>\n </>\n );\n});\n\nexport default withTestIds(Stages, getStagesTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"Stages.js","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG1E,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,SAAS,EACT,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAG1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,YA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AAC;4CAChB,gBAAgB,CAAC,IAAI,CAAC,CAAC;wCACzB,CAAC,EACD,SAAS,EAAC,QAAQ,YAEjB,CAAC,SAAS,IAAI,CACb,MAAC,kBAAkB,eACjB,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,EAC9B,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,SAAS,YAC3C,CAAC,CAAC,2BAA2B,CAAC,GACxB,IACU,CACtB,GACU,CACd,KAjEY,KAAK,CAAC,EAAE,CAkEZ,CACZ,CAAC;wBACJ,CAAC,CAAC,EAEF,KAAC,cAAc,IAAC,GAAG,EAAE,cAAc,iBAAc,MAAM,GAAG,IACrD,GACa,EAEtB,KAAC,uBAAuB,IAAC,EAAE,EAAE,aAAa,YACvC,CAAC,CAAC,oBAAoB,CAAC,GACA,IACzB,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';\nimport type { MouseEvent, PropsWithoutRef } from 'react';\n\nimport {\n Icon,\n registerIcon,\n Flex,\n useI18n,\n Button,\n Modal,\n useBreakpoint,\n useModalManager,\n useConsolidatedRef,\n useUID,\n InfoDialog,\n useArrows,\n useDirection,\n useAfterInitialEffect,\n VisuallyHiddenText,\n withTestIds,\n useTestIds,\n useElement,\n useFocusWithin,\n isInstance\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, ModalMethods } from '@pega/cosmos-react-core';\nimport * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';\n\nimport type { StagesProps, StageStatus } from './Stages.types';\nimport { getStagesTestIds } from './Stages.test-ids';\nimport StageGlimpse from './StageGlimpse';\nimport {\n StyledInnerStage,\n StyledStageCompleteIcon,\n StyledStage,\n StyledStageContainer,\n StyledStageGlimpse,\n StyledStages,\n StyledStagesWrapper,\n StyledStagesDescription,\n StyledStageText,\n StyledSentinel,\n StyledMilestoneStageContainer,\n StyledMilestoneButton,\n StyledMilestoneLabel\n} from './Stages.styles';\n\nregisterIcon(checkIcon);\n\nconst Stages: ForwardRefForwardPropsComponent<StagesProps> = forwardRef(function Stages(\n {\n current,\n stages,\n caseTitle,\n onLoadStage,\n readOnly = false,\n variant = 'chevron',\n testId,\n ...restProps\n }: PropsWithoutRef<StagesProps>,\n ref: StagesProps['ref']\n) {\n const t = useI18n();\n\n const testIds = useTestIds(testId, getStagesTestIds);\n\n const isMilestoneVariant = variant === 'milestone';\n\n const stagesRef = useConsolidatedRef(ref);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const startSentinelRef = useRef<HTMLLIElement>(null);\n const endSentinelRef = useRef<HTMLLIElement>(null);\n const stagesRefs = useRef<Map<string, HTMLButtonElement>>(new Map());\n\n const [target, setTarget] = useElement<HTMLButtonElement>(null);\n const [targetStageId, setTargetStageId] = useState<string | null>(null);\n const [currentStageBtn, setCurrentStageBtn] = useState<HTMLButtonElement | null>(null);\n\n const { create: createModal } = useModalManager();\n const modalMethods = useRef<ModalMethods>();\n const [showModal, setShowModal] = useState(false);\n\n const isSmallOrAbove = useBreakpoint('sm');\n\n const { rtl } = useDirection();\n\n useArrows(\n stagesRef,\n {\n cycle: false,\n selector: ':scope > li > button:not([aria-expanded])',\n dir: 'left-right',\n initialFocusElement: currentStageBtn\n },\n [currentStageBtn]\n );\n\n const dialogId = useUID();\n const descriptionId = useUID();\n\n useEffect(() => {\n const el = stagesRef.current;\n const wrapper = wrapperRef.current;\n const startSentinel = startSentinelRef.current;\n const endSentinel = endSentinelRef.current;\n if (!el || !wrapper || !startSentinel || !endSentinel) return;\n\n const fadeValue = 'var(--stages-fade-width)';\n\n const observer = new IntersectionObserver(\n entries => {\n for (const entry of entries) {\n const visible = entry.isIntersecting;\n if (entry.target === startSentinel) {\n wrapper.style.setProperty('--stages-fade-start', visible ? '0rem' : fadeValue);\n } else if (entry.target === endSentinel) {\n wrapper.style.setProperty('--stages-fade-end', visible ? '0rem' : fadeValue);\n }\n }\n },\n { root: el, threshold: 0 }\n );\n\n observer.observe(startSentinel);\n observer.observe(endSentinel);\n\n return () => observer.disconnect();\n }, [stages.length]);\n\n useEffect(() => {\n const el = stagesRef.current;\n const currentBtn = el?.querySelector<HTMLButtonElement>('[aria-current=\"step\"]');\n currentBtn?.scrollIntoView({ inline: 'center', behavior: 'auto', block: 'nearest' });\n }, [current]); // re-center whenever the active stage changes\n\n useFocusWithin([stagesRef], focused => {\n if (focused && isInstance(document.activeElement, HTMLButtonElement)) {\n document.activeElement.scrollIntoView({\n inline: 'center',\n behavior: 'smooth',\n block: 'nearest'\n });\n }\n });\n\n const stagesToLoad = onLoadStage\n ? stages.filter(stage => !Array.isArray(stage.steps)).map(stage => stage.id)\n : [];\n\n const renderModalStages = () =>\n stages.map(stage => (\n <Fragment key={stage.id}>\n <Flex container={{ alignItems: 'start', gap: 0.5 }}>\n {stage.completed && <StyledStageCompleteIcon name='check' />}\n <StyledStageText variant='h3' isCurrent={stage.id === current}>\n {stage.name}\n {stage.completed && <VisuallyHiddenText>{`- ${t('completed')}`}</VisuallyHiddenText>}\n </StyledStageText>\n </Flex>\n <StageGlimpse stage={stage} />\n </Fragment>\n ));\n\n const openModal = () => {\n setShowModal(true);\n if (stagesToLoad.length > 0) onLoadStage?.(stagesToLoad);\n modalMethods.current = createModal(Modal, {\n heading: caseTitle\n ? t('stages_case_lifecycle', [caseTitle])\n : t('stages_default_case_lifecycle'),\n progress: stagesToLoad.length > 0,\n children: renderModalStages(),\n onBeforeClose: () => {\n setShowModal(false);\n target?.focus();\n setTarget(null);\n setTargetStageId(null);\n modalMethods.current = undefined;\n }\n });\n };\n\n useAfterInitialEffect(() => {\n modalMethods.current?.update({\n progress: stagesToLoad.length > 0,\n children: renderModalStages()\n });\n }, [stagesToLoad.length]);\n\n const setStageButtonRef =\n (stageId: string, isCurrent: boolean) => (el: HTMLButtonElement | null) => {\n if (el) {\n stagesRefs.current.set(stageId, el);\n if (isCurrent) setCurrentStageBtn(prev => (prev !== el ? el : prev));\n } else {\n stagesRefs.current.delete(stageId);\n if (isCurrent) setCurrentStageBtn(null);\n }\n };\n\n const handleStageClick =\n (stageId: string, hasToLoad: boolean) => (e: MouseEvent<HTMLButtonElement>) => {\n if (isSmallOrAbove) {\n if (hasToLoad) onLoadStage?.([stageId]);\n\n const btn = e.currentTarget;\n btn.scrollIntoView({\n inline: 'center',\n behavior: 'smooth',\n block: 'nearest'\n });\n\n setTarget(btn);\n setTargetStageId(stageId);\n } else {\n openModal();\n }\n };\n\n const getStageButtonProps = ({\n stageId,\n stageName,\n stageStatusText,\n isCurrent,\n hasToLoad\n }: {\n stageId: string;\n stageName: string;\n stageStatusText: string;\n isCurrent: boolean;\n hasToLoad: boolean;\n }) => {\n const isExpanded = targetStageId === stageId && Boolean(target) && isSmallOrAbove;\n\n return {\n ref: setStageButtonRef(stageId, isCurrent),\n 'aria-current': isCurrent ? ('step' as const) : undefined,\n 'aria-label': t('stages_stage_label', [stageName, stageStatusText]),\n 'aria-expanded': isExpanded ? true : undefined,\n 'aria-controls': isExpanded ? dialogId : undefined,\n ...(!readOnly && {\n 'aria-haspopup': 'dialog' as const,\n onClick: handleStageClick(stageId, hasToLoad)\n })\n };\n };\n\n return (\n <>\n <StyledStagesWrapper ref={wrapperRef} data-testid={testIds.root}>\n <Flex\n {...restProps}\n container\n as={StyledStages}\n ref={stagesRef}\n variant={variant}\n dir={rtl ? 'rtl' : 'ltr'}\n aria-label={t('stages_label')}\n aria-describedby={descriptionId}\n >\n <StyledSentinel ref={startSentinelRef} aria-hidden='true' />\n\n {stages.map((stage, stageIndex) => {\n const isCurrent = stage.id === current;\n let stageStatusText = t(stage.completed ? 'completed' : 'not_started');\n if (isCurrent) stageStatusText = t('current');\n\n const hasToLoad = stagesToLoad.includes(stage.id);\n\n let stageStatus: StageStatus;\n\n if (stage.completed) {\n stageStatus = 'completed';\n } else if (isCurrent) {\n stageStatus = 'current';\n } else {\n stageStatus = 'pending';\n }\n\n const stageButtonProps = getStageButtonProps({\n stageId: stage.id,\n stageName: stage.name,\n stageStatusText,\n isCurrent,\n hasToLoad\n });\n\n return (\n <Fragment key={stage.id}>\n {isMilestoneVariant ? (\n <StyledMilestoneStageContainer\n status={stageStatus}\n nextCompleted={stages[stageIndex + 1]?.completed ?? false}\n readOnly={readOnly}\n >\n <StyledMilestoneButton\n status={stageStatus}\n readOnly={readOnly}\n {...stageButtonProps}\n >\n {stage.completed ? (\n <Icon name='check' />\n ) : (\n <span aria-hidden='true'>{stageIndex + 1}</span>\n )}\n </StyledMilestoneButton>\n <StyledMilestoneLabel>{stage.name}</StyledMilestoneLabel>\n </StyledMilestoneStageContainer>\n ) : (\n <Flex\n as={StyledStageContainer}\n item={{ grow: 1, shrink: 0 }}\n readOnly={readOnly}\n variant={variant}\n >\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledStage}\n item={{ grow: 1, shrink: 0 }}\n status={stageStatus}\n readOnly={readOnly}\n variant={variant}\n {...stageButtonProps}\n >\n <StyledInnerStage>\n {stage.completed && <Icon name='check' />}\n {stage.name}\n </StyledInnerStage>\n </Flex>\n </Flex>\n )}\n\n {target && targetStageId === stage.id && isSmallOrAbove && !showModal && (\n <InfoDialog\n id={dialogId}\n heading={stage.name}\n target={target}\n progress={hasToLoad ? t('loading') : undefined}\n onDismiss={() => {\n setTarget(null);\n setTargetStageId(null);\n }}\n placement='bottom'\n >\n {!hasToLoad && (\n <StyledStageGlimpse>\n <StageGlimpse stage={stage} />\n <Button variant='secondary' onClick={openModal}>\n {t('stages_see_full_lifecycle')}\n </Button>\n </StyledStageGlimpse>\n )}\n </InfoDialog>\n )}\n </Fragment>\n );\n })}\n\n <StyledSentinel ref={endSentinelRef} aria-hidden='true' />\n </Flex>\n </StyledStagesWrapper>\n\n <StyledStagesDescription id={descriptionId}>\n {t('stages_description')}\n </StyledStagesDescription>\n </>\n );\n});\n\nexport default withTestIds(Stages, getStagesTestIds);\n"]}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import type { StageVariant } from './Stages.types';
|
|
1
2
|
/**
|
|
2
3
|
* Outer wrapper `<div>` for the stages bar. Applies layered scroll-fade masks and
|
|
3
4
|
* reserves scrollbar space so the fade gradient does not overlap the scrollbar track.
|
|
4
5
|
*/
|
|
5
6
|
export declare const StyledStagesWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
7
|
/**
|
|
7
|
-
* Scrollable `<ol>` containing all stage chevron items. Sets the `--chevron-spacing
|
|
8
|
-
* and `--
|
|
8
|
+
* Scrollable `<ol>` containing all stage chevron items. Sets the `--chevron-spacing`,
|
|
9
|
+
* `--chevron-border-thickness`, and `--segmented-border-thickness` custom properties
|
|
10
|
+
* consumed by child elements.
|
|
9
11
|
*/
|
|
10
|
-
export declare const StyledStages: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").
|
|
12
|
+
export declare const StyledStages: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, {
|
|
13
|
+
variant: StageVariant;
|
|
14
|
+
}>> & string;
|
|
11
15
|
/**
|
|
12
16
|
* A sentinel is an invisible 1 px <li> placed at each end of the scrollable stage list.
|
|
13
17
|
* It is observed by an IntersectionObserver; when it scrolls out of view, the component sets
|
|
@@ -35,6 +39,7 @@ export declare const StyledInnerStage: import("styled-components/dist/types").IS
|
|
|
35
39
|
export declare const StyledStage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
36
40
|
status: "completed" | "current" | "pending";
|
|
37
41
|
readOnly?: boolean;
|
|
42
|
+
variant: StageVariant;
|
|
38
43
|
}>> & string;
|
|
39
44
|
/**
|
|
40
45
|
* Checkmark icon shown inside completed stages, tinted to match the stage foreground colour.
|
|
@@ -54,6 +59,7 @@ export declare const StyledStageText: import("styled-components/dist/types").ISt
|
|
|
54
59
|
*/
|
|
55
60
|
export declare const StyledStageContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {
|
|
56
61
|
readOnly?: boolean;
|
|
62
|
+
variant: StageVariant;
|
|
57
63
|
}>> & string;
|
|
58
64
|
/**
|
|
59
65
|
* `<ol>` list of sub-step items displayed below the stages bar when a stage is expanded.
|
|
@@ -76,6 +82,22 @@ export declare const StyledDateTimeDisplay: import("styled-components/dist/types
|
|
|
76
82
|
* Container `<div>` for the stage glimpse preview panel, constrained to a small max-width.
|
|
77
83
|
*/
|
|
78
84
|
export declare const StyledStageGlimpse: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
85
|
+
export declare const StyledMilestoneLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
86
|
+
/**
|
|
87
|
+
* `<li>` container for a single stage item in the 'milestone' shape variant.
|
|
88
|
+
* Renders column-flex layout (milestone above, label below) and draws the
|
|
89
|
+
* horizontal connector as a single line from this milestone's centre to the next
|
|
90
|
+
* milestone's centre (::after), sized so every connector has an identical length.
|
|
91
|
+
*/
|
|
92
|
+
export declare const StyledMilestoneStageContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {
|
|
93
|
+
status: "completed" | "current" | "pending";
|
|
94
|
+
nextCompleted: boolean;
|
|
95
|
+
readOnly?: boolean;
|
|
96
|
+
}>> & string;
|
|
97
|
+
export declare const StyledMilestoneButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
98
|
+
status: "completed" | "current" | "pending";
|
|
99
|
+
readOnly?: boolean;
|
|
100
|
+
}>> & string;
|
|
79
101
|
/**
|
|
80
102
|
* Visually hidden `<p>` providing an accessible description for the stages list,
|
|
81
103
|
* announced by screen readers but not displayed on screen.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stages.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stages.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.styles.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAyInD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,6NAmF9B,CAAC;AAIH;;;;GAIG;AACH,eAAO,MAAM,YAAY;aAAwB,YAAY;YAkD3D,CAAC;AAIH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,6NA6B1B,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;eAA4B,OAAO;YAe9D,CAAC;AAsDH;;;GAGG;AACH,eAAO,MAAM,WAAW;YACd,WAAW,GAAG,SAAS,GAAG,SAAS;eAChC,OAAO;aACT,YAAY;YA6EtB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,uBAAuB,kaAiBlC,CAAC;AAIH;;GAEG;AACH,eAAO,MAAM,eAAe;;;gBAA8B,OAAO;kLAIhE,CAAC;AAsWF;;;GAGG;AACH,eAAO,MAAM,oBAAoB;eACpB,OAAO;aACT,YAAY;YAoDtB,CAAC;AAIF;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