@pega/cosmos-react-work 3.0.0-dev.9.1 → 3.0.0-rc.10
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/AppAnnouncement/AppAnnouncement.d.ts +4 -0
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js +3 -2
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/CasePreview/CasePreview.d.ts +2 -2
- package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
- package/lib/components/CasePreview/CasePreview.js +2 -2
- package/lib/components/CasePreview/CasePreview.js.map +1 -1
- package/lib/components/CaseView/CaseHeader.d.ts +4 -0
- package/lib/components/CaseView/CaseHeader.d.ts.map +1 -0
- package/lib/components/CaseView/CaseHeader.js +49 -0
- package/lib/components/CaseView/CaseHeader.js.map +1 -0
- package/lib/components/CaseView/CaseSummary.d.ts +4 -0
- package/lib/components/CaseView/CaseSummary.d.ts.map +1 -0
- package/lib/components/CaseView/CaseSummary.js +13 -0
- package/lib/components/CaseView/CaseSummary.js.map +1 -0
- package/lib/components/CaseView/CaseSummaryFields.d.ts +6 -0
- package/lib/components/CaseView/CaseSummaryFields.d.ts.map +1 -0
- package/lib/components/CaseView/CaseSummaryFields.js +8 -0
- package/lib/components/CaseView/CaseSummaryFields.js.map +1 -0
- package/lib/components/CaseView/CaseView.context.d.ts +5 -0
- package/lib/components/CaseView/CaseView.context.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.context.js +5 -0
- package/lib/components/CaseView/CaseView.context.js.map +1 -0
- package/lib/components/CaseView/CaseView.d.ts +2 -27
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +220 -191
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +14 -17
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +249 -41
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.types.d.ts +103 -0
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.types.js +2 -0
- package/lib/components/CaseView/CaseView.types.js.map +1 -0
- package/lib/components/CaseView/UtilitiesSummary.d.ts +4 -6
- package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.js +6 -2
- package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
- package/lib/components/CaseView/index.d.ts +5 -2
- package/lib/components/CaseView/index.d.ts.map +1 -1
- package/lib/components/CaseView/index.js +4 -1
- package/lib/components/CaseView/index.js.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.js +9 -16
- package/lib/components/ConfigurableLayout/ConfigurableLayout.js.map +1 -1
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts +1 -1
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.d.ts +2 -2
- package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.js +1 -1
- package/lib/components/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/Details/Details.d.ts +31 -10
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +77 -35
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/Details.styles.d.ts +47 -0
- package/lib/components/Details/Details.styles.d.ts.map +1 -0
- package/lib/components/Details/Details.styles.js +243 -0
- package/lib/components/Details/Details.styles.js.map +1 -0
- package/lib/components/Details/DetailsContext.d.ts +9 -0
- package/lib/components/Details/DetailsContext.d.ts.map +1 -0
- package/lib/components/Details/DetailsContext.js +9 -0
- package/lib/components/Details/DetailsContext.js.map +1 -0
- package/lib/components/Details/index.d.ts +2 -2
- package/lib/components/Details/index.d.ts.map +1 -1
- package/lib/components/Details/index.js +2 -1
- package/lib/components/Details/index.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts +6 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js +87 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +8 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +143 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts +31 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js +2 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js.map +1 -0
- package/lib/components/IntelligentGuidance/index.d.ts +3 -0
- package/lib/components/IntelligentGuidance/index.d.ts.map +1 -0
- package/lib/components/IntelligentGuidance/index.js +2 -0
- package/lib/components/IntelligentGuidance/index.js.map +1 -0
- package/lib/components/SearchResults/SearchResult.d.ts +1 -1
- package/lib/components/SearchResults/SearchResult.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResult.js +9 -3
- package/lib/components/SearchResults/SearchResult.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.js +56 -37
- package/lib/components/SearchResults/SearchResults.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.styles.d.ts +3 -0
- package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.styles.js +38 -17
- package/lib/components/SearchResults/SearchResults.styles.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.types.d.ts +4 -0
- package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.types.js.map +1 -1
- package/lib/components/Stages/StageGlimpse.d.ts +10 -0
- package/lib/components/Stages/StageGlimpse.d.ts.map +1 -0
- package/lib/components/Stages/StageGlimpse.js +11 -0
- package/lib/components/Stages/StageGlimpse.js.map +1 -0
- package/lib/components/Stages/Stages.d.ts +1 -1
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +105 -112
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +5 -7
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +170 -189
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stages/Stages.types.d.ts +19 -4
- package/lib/components/Stages/Stages.types.d.ts.map +1 -1
- package/lib/components/Stages/Stages.types.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.js +10 -4
- package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
- package/lib/components/Tags/Tags.d.ts.map +1 -1
- package/lib/components/Tags/Tags.js +23 -9
- package/lib/components/Tags/Tags.js.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts +8 -5
- package/lib/components/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +12 -4
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/lib/components/Tasks/Tasks.d.ts.map +1 -1
- package/lib/components/Tasks/Tasks.js +2 -1
- package/lib/components/Tasks/Tasks.js.map +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.styles.js +1 -0
- package/lib/components/Timeline/Timeline.styles.js.map +1 -1
- package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
- package/lib/components/Timeline/TimelineItem.js +2 -2
- package/lib/components/Timeline/TimelineItem.js.map +1 -1
- package/lib/index.d.ts +2 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -6
- package/lib/index.js.map +1 -1
- package/package.json +6 -5
- package/lib/components/CaseHeader/CaseHeader.d.ts +0 -30
- package/lib/components/CaseHeader/CaseHeader.d.ts.map +0 -1
- package/lib/components/CaseHeader/CaseHeader.js +0 -119
- package/lib/components/CaseHeader/CaseHeader.js.map +0 -1
- package/lib/components/CaseHeader/index.d.ts +0 -4
- package/lib/components/CaseHeader/index.d.ts.map +0 -1
- package/lib/components/CaseHeader/index.js +0 -3
- package/lib/components/CaseHeader/index.js.map +0 -1
- package/lib/components/CaseSummary/CaseSummary.d.ts +0 -36
- package/lib/components/CaseSummary/CaseSummary.d.ts.map +0 -1
- package/lib/components/CaseSummary/CaseSummary.js +0 -130
- package/lib/components/CaseSummary/CaseSummary.js.map +0 -1
- package/lib/components/CaseSummary/index.d.ts +0 -4
- package/lib/components/CaseSummary/index.d.ts.map +0 -1
- package/lib/components/CaseSummary/index.js +0 -3
- package/lib/components/CaseSummary/index.js.map +0 -1
- package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts +0 -22
- package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts.map +0 -1
- package/lib/components/CaseSummaryFields/CaseSummaryFields.js +0 -25
- package/lib/components/CaseSummaryFields/CaseSummaryFields.js.map +0 -1
- package/lib/components/CaseSummaryFields/index.d.ts +0 -4
- package/lib/components/CaseSummaryFields/index.d.ts.map +0 -1
- package/lib/components/CaseSummaryFields/index.js +0 -3
- package/lib/components/CaseSummaryFields/index.js.map +0 -1
- package/lib/components/Stages/Steps.d.ts +0 -8
- package/lib/components/Stages/Steps.d.ts.map +0 -1
- package/lib/components/Stages/Steps.js +0 -12
- package/lib/components/Stages/Steps.js.map +0 -1
- package/lib/components/Stages/StepsContainer.d.ts +0 -8
- package/lib/components/Stages/StepsContainer.d.ts.map +0 -1
- package/lib/components/Stages/StepsContainer.js +0 -11
- package/lib/components/Stages/StepsContainer.js.map +0 -1
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { calculateFontSize, defaultThemeProp, StyledFieldValue, StyledStackedFieldValue, StyledFieldValueList, StyledIcon, useDirection, StyledButton } from '@pega/cosmos-react-core';
|
|
3
|
+
const verticalGapSpacingMultiplier = 1;
|
|
4
|
+
// colWidth reduces by 20% as column count increases
|
|
5
|
+
export const colCountChWidth = {
|
|
6
|
+
'1': {
|
|
7
|
+
containerWidth: 100,
|
|
8
|
+
colWidth: 100
|
|
9
|
+
},
|
|
10
|
+
'2': {
|
|
11
|
+
containerWidth: 80 * 2,
|
|
12
|
+
colWidth: 80
|
|
13
|
+
},
|
|
14
|
+
'3': {
|
|
15
|
+
containerWidth: 64 * 3,
|
|
16
|
+
colWidth: 64
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const flexGapProp = 5.5;
|
|
20
|
+
export const chToRem = (chVal) => {
|
|
21
|
+
return chVal / 2;
|
|
22
|
+
};
|
|
23
|
+
export const StyledFieldValueGroupLabel = styled.div(({ theme }) => {
|
|
24
|
+
const { base: { spacing, animation } } = theme;
|
|
25
|
+
const { rtl } = useDirection();
|
|
26
|
+
return css `
|
|
27
|
+
width: 100%;
|
|
28
|
+
grid-column-start: 1;
|
|
29
|
+
grid-column-end: -1;
|
|
30
|
+
margin-block-end: calc(0.5 * ${spacing});
|
|
31
|
+
|
|
32
|
+
&:not(:first-child) {
|
|
33
|
+
margin-block-start: calc(3 * ${spacing});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
${StyledButton} ${StyledIcon} {
|
|
37
|
+
transition: transform ${animation.speed} ${animation.timing.ease};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
${StyledButton}[aria-expanded='true'] ${StyledIcon} {
|
|
41
|
+
transform: rotate(90deg);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
${StyledButton}[aria-expanded='false'] ${StyledIcon} {
|
|
45
|
+
transform: rotate(${rtl ? 180 : 0}deg);
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
});
|
|
49
|
+
StyledFieldValueGroupLabel.defaultProps = defaultThemeProp;
|
|
50
|
+
export const StyledHighlightedDetailList = styled.dl(({ theme }) => {
|
|
51
|
+
const { base: { spacing, palette } } = theme;
|
|
52
|
+
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
53
|
+
return css `
|
|
54
|
+
display: grid;
|
|
55
|
+
grid-template-columns: repeat(auto-fit, minmax(40ch, 1fr));
|
|
56
|
+
column-gap: calc(5 * ${spacing});
|
|
57
|
+
gap: calc(2 * ${spacing});
|
|
58
|
+
align-items: start;
|
|
59
|
+
max-width: ${`${colCountChWidth[3].containerWidth}ch}`};
|
|
60
|
+
padding-block-end: calc(1.5 * ${spacing});
|
|
61
|
+
|
|
62
|
+
dd {
|
|
63
|
+
font-size: ${fontSize[theme.components.text.h1['font-size']]};
|
|
64
|
+
font-weight: ${theme.components.text.h1['font-weight']};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
+ hr {
|
|
68
|
+
border-top: unset;
|
|
69
|
+
border-radius: unset;
|
|
70
|
+
border-style: unset;
|
|
71
|
+
border-bottom: 0.0625rem solid ${palette['border-line']};
|
|
72
|
+
margin-block-end: calc(1.5 * ${spacing});
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
});
|
|
76
|
+
StyledHighlightedDetailList.defaultProps = defaultThemeProp;
|
|
77
|
+
export const StyledDetails = styled.div(() => {
|
|
78
|
+
return css `
|
|
79
|
+
grid-column: 1 / -1;
|
|
80
|
+
`;
|
|
81
|
+
});
|
|
82
|
+
StyledDetails.defaultProps = defaultThemeProp;
|
|
83
|
+
const nthRecursiveContainerSelector = (depth, includeAllImmediateContainers) => {
|
|
84
|
+
const firstContainerSelector = '> div:first-child';
|
|
85
|
+
const baseSelector = includeAllImmediateContainers ? '> div' : firstContainerSelector;
|
|
86
|
+
return baseSelector.concat(` ${firstContainerSelector}`.repeat(depth));
|
|
87
|
+
};
|
|
88
|
+
const initialLabelNoMargin = (applyToAllChildren = false) => {
|
|
89
|
+
return css `
|
|
90
|
+
${nthRecursiveContainerSelector(0, applyToAllChildren)},
|
|
91
|
+
${nthRecursiveContainerSelector(1, applyToAllChildren)},
|
|
92
|
+
${nthRecursiveContainerSelector(2, applyToAllChildren)},
|
|
93
|
+
${nthRecursiveContainerSelector(3, applyToAllChildren)},
|
|
94
|
+
${nthRecursiveContainerSelector(4, applyToAllChildren)},
|
|
95
|
+
${nthRecursiveContainerSelector(5, applyToAllChildren)},
|
|
96
|
+
${nthRecursiveContainerSelector(6, applyToAllChildren)},
|
|
97
|
+
${nthRecursiveContainerSelector(7, applyToAllChildren)},
|
|
98
|
+
${nthRecursiveContainerSelector(8, applyToAllChildren)},
|
|
99
|
+
${nthRecursiveContainerSelector(9, applyToAllChildren)},
|
|
100
|
+
${nthRecursiveContainerSelector(10, applyToAllChildren)} {
|
|
101
|
+
> ${StyledFieldValueGroupLabel}:first-child {
|
|
102
|
+
margin-block-start: 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
};
|
|
107
|
+
export const StyledDetailList = styled(StyledFieldValueList)(({ stacked, flex, hasName, nested, labelLength, variant, theme, wrapped = false, columnCount = 1 }) => {
|
|
108
|
+
const { base: { spacing } } = theme;
|
|
109
|
+
const isValueComparison = variant === 'value-comparison';
|
|
110
|
+
const containerWidthCh = colCountChWidth[columnCount].containerWidth;
|
|
111
|
+
const containerWidthMinusLabel = `${containerWidthCh - (labelLength ?? 0)}ch`;
|
|
112
|
+
return css `
|
|
113
|
+
/* Top Level Styles */
|
|
114
|
+
${!nested &&
|
|
115
|
+
css `
|
|
116
|
+
${StyledFieldValue} {
|
|
117
|
+
word-break: break-word;
|
|
118
|
+
overflow: auto;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
${StyledFieldValueGroupLabel} {
|
|
122
|
+
margin-block-start: calc(3 * ${spacing});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
> ${StyledFieldValueGroupLabel}:nth-child(1) {
|
|
126
|
+
margin-block-start: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
${StyledStackedFieldValue} {
|
|
130
|
+
grid-column: 1 / -1;
|
|
131
|
+
}
|
|
132
|
+
`}
|
|
133
|
+
|
|
134
|
+
/* Nested List */
|
|
135
|
+
${nested &&
|
|
136
|
+
css `
|
|
137
|
+
grid-column: 1 / -1;
|
|
138
|
+
`}
|
|
139
|
+
|
|
140
|
+
/* As Field Grid */
|
|
141
|
+
${!flex &&
|
|
142
|
+
css `
|
|
143
|
+
display: grid;
|
|
144
|
+
grid-template-columns: ${`minmax(14ch, ${labelLength}ch) minmax(14ch, 1fr)`};
|
|
145
|
+
column-gap: calc(2 * ${spacing});
|
|
146
|
+
row-gap: calc(${verticalGapSpacingMultiplier} * ${spacing});
|
|
147
|
+
|
|
148
|
+
${stacked &&
|
|
149
|
+
css `
|
|
150
|
+
grid-template-columns: minmax(0, 1fr);
|
|
151
|
+
row-gap: 0;
|
|
152
|
+
`}
|
|
153
|
+
|
|
154
|
+
> ${StyledStackedFieldValue} {
|
|
155
|
+
max-width: ${`${containerWidthCh}ch`};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
> ${StyledFieldValue} {
|
|
159
|
+
max-width: calc(${containerWidthMinusLabel} - calc(2 * ${spacing}));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
${isValueComparison &&
|
|
163
|
+
css `
|
|
164
|
+
grid-template-columns: auto auto;
|
|
165
|
+
column-gap: 0;
|
|
166
|
+
row-gap: calc(0.5 * ${spacing});
|
|
167
|
+
max-width: ${`${containerWidthCh}ch`};
|
|
168
|
+
`}
|
|
169
|
+
`}
|
|
170
|
+
|
|
171
|
+
/* As Flex Container */
|
|
172
|
+
${flex &&
|
|
173
|
+
css `
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: ${wrapped ? 'column' : 'row'};
|
|
176
|
+
column-gap: calc(${flexGapProp} * ${spacing});
|
|
177
|
+
align-items: flex-start;
|
|
178
|
+
|
|
179
|
+
max-width: ${`${containerWidthCh}ch`};
|
|
180
|
+
|
|
181
|
+
${!wrapped &&
|
|
182
|
+
css `
|
|
183
|
+
> * {
|
|
184
|
+
max-width: ${`${100 / columnCount}%`};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
${hasName && initialLabelNoMargin(true)}
|
|
188
|
+
`}
|
|
189
|
+
|
|
190
|
+
${wrapped &&
|
|
191
|
+
css `
|
|
192
|
+
${hasName && initialLabelNoMargin()}
|
|
193
|
+
|
|
194
|
+
${!stacked &&
|
|
195
|
+
css `
|
|
196
|
+
> div:not(:first-child) {
|
|
197
|
+
margin-block-start: calc(${verticalGapSpacingMultiplier} * ${spacing});
|
|
198
|
+
}
|
|
199
|
+
`}}
|
|
200
|
+
`}
|
|
201
|
+
`}
|
|
202
|
+
|
|
203
|
+
/* Key / Group Label Spacing */
|
|
204
|
+
${!nested &&
|
|
205
|
+
css `
|
|
206
|
+
> div {
|
|
207
|
+
+ dt {
|
|
208
|
+
margin-block-start: calc(3 * ${spacing});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
+ ${StyledStackedFieldValue} {
|
|
212
|
+
margin-block-start: calc(3 * ${spacing});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
${!stacked &&
|
|
216
|
+
css `
|
|
217
|
+
+ dt + dd {
|
|
218
|
+
margin-block-start: calc(3 * ${spacing});
|
|
219
|
+
}
|
|
220
|
+
`}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
${initialLabelNoMargin()}
|
|
224
|
+
`}
|
|
225
|
+
|
|
226
|
+
${stacked &&
|
|
227
|
+
css `
|
|
228
|
+
dt {
|
|
229
|
+
margin-block-start: calc(${verticalGapSpacingMultiplier} * ${spacing});
|
|
230
|
+
}
|
|
231
|
+
`}
|
|
232
|
+
|
|
233
|
+
${StyledFieldValueGroupLabel} + div {
|
|
234
|
+
> ${StyledFieldValueGroupLabel}:first-child {
|
|
235
|
+
margin-block-start: 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
${initialLabelNoMargin()}
|
|
239
|
+
}
|
|
240
|
+
`;
|
|
241
|
+
});
|
|
242
|
+
StyledDetailList.defaultProps = defaultThemeProp;
|
|
243
|
+
//# sourceMappingURL=Details.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Details.styles.js","sourceRoot":"","sources":["../../../src/components/Details/Details.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAgB,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EAEpB,UAAU,EAGV,YAAY,EACZ,YAAY,EACb,MAAM,yBAAyB,CAAC;AA+BjC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC,oDAAoD;AACpD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,GAAG,EAAE;QACH,cAAc,EAAE,GAAG;QACnB,QAAQ,EAAE,GAAG;KACd;IACD,GAAG,EAAE;QACH,cAAc,EAAE,EAAE,GAAG,CAAC;QACtB,QAAQ,EAAE,EAAE;KACb;IACD,GAAG,EAAE;QACH,cAAc,EAAE,EAAE,GAAG,CAAC;QACtB,QAAQ,EAAE,EAAE;KACb;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAU,EAAE;IAC/C,OAAO,KAAK,GAAG,CAAC,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,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ACxC;;UAEC,OAAO;YACT,GAAG,CAAA;YACC,OAAO,IAAI,oBAAoB,EAAE;;YAGjC,CAAC,OAAO;gBACR,GAAG,CAAA;;2CAE4B,4BAA4B,MAAM,OAAO;;aAG1E;SACD;OACF;;;QAGC,CAAC,MAAM;QACT,GAAG,CAAA;;;2CAGkC,OAAO;;;cAGpC,uBAAuB;2CACM,OAAO;;;YAGtC,CAAC,OAAO;YACV,GAAG,CAAA;;6CAEgC,OAAO;;WAEzC;;;UAGD,oBAAoB,EAAE;OACzB;;QAEC,OAAO;QACT,GAAG,CAAA;;qCAE4B,4BAA4B,MAAM,OAAO;;OAEvE;;QAEC,0BAA0B;YACtB,0BAA0B;;;;UAI5B,oBAAoB,EAAE;;KAE3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css, DefaultTheme } from 'styled-components';\n\nimport {\n calculateFontSize,\n defaultThemeProp,\n StyledFieldValue,\n StyledStackedFieldValue,\n StyledFieldValueList,\n StyledFieldValueListProps,\n StyledIcon,\n FontSize,\n PropsWithDefaults,\n useDirection,\n StyledButton\n} from '@pega/cosmos-react-core';\n\ninterface StyledDetailListProps extends StyledFieldValueListProps {\n /** Whether individual list items all have labels stacks on top */\n stacked?: boolean;\n /** Whether the list is a flex row of other lists */\n flex?: boolean;\n /** Whether the list has a name attribute */\n hasName?: boolean;\n /** Whether the list is nested */\n nested?: boolean;\n /** The character length applied to all list labels */\n labelLength?: number;\n /**\n * Whether the list is wrapped to 1 column\n * @default false\n */\n wrapped?: boolean;\n /**\n * Number of columns in the list\n * @default 1\n */\n columnCount?: 1 | 2 | 3;\n theme: DefaultTheme;\n}\n\ntype StyledDetailListPropsWithDefaults = PropsWithDefaults<\n StyledDetailListProps,\n 'wrapped' | 'columnCount'\n>;\n\nconst verticalGapSpacingMultiplier = 1;\n\n// colWidth reduces by 20% as column count increases\nexport const colCountChWidth = {\n '1': {\n containerWidth: 100,\n colWidth: 100\n },\n '2': {\n containerWidth: 80 * 2,\n colWidth: 80\n },\n '3': {\n containerWidth: 64 * 3,\n colWidth: 64\n }\n};\n\nexport const flexGapProp = 5.5;\n\nexport const chToRem = (chVal: number): number => {\n return chVal / 2;\n};\n\nexport const StyledFieldValueGroupLabel = styled.div(({ theme }) => {\n const {\n base: { spacing, animation }\n } = theme;\n const { rtl } = useDirection();\n\n return css`\n width: 100%;\n grid-column-start: 1;\n grid-column-end: -1;\n margin-block-end: calc(0.5 * ${spacing});\n\n &:not(:first-child) {\n margin-block-start: calc(3 * ${spacing});\n }\n\n ${StyledButton} ${StyledIcon} {\n transition: transform ${animation.speed} ${animation.timing.ease};\n }\n\n ${StyledButton}[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(90deg);\n }\n\n ${StyledButton}[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(${rtl ? 180 : 0}deg);\n }\n `;\n});\n\nStyledFieldValueGroupLabel.defaultProps = defaultThemeProp;\n\nexport const StyledHighlightedDetailList = styled.dl(({ theme }) => {\n const {\n base: { spacing, palette }\n } = theme;\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(40ch, 1fr));\n column-gap: calc(5 * ${spacing});\n gap: calc(2 * ${spacing});\n align-items: start;\n max-width: ${`${colCountChWidth[3].containerWidth}ch}`};\n padding-block-end: calc(1.5 * ${spacing});\n\n dd {\n font-size: ${fontSize[theme.components.text.h1['font-size'] as FontSize]};\n font-weight: ${theme.components.text.h1['font-weight']};\n }\n\n + hr {\n border-top: unset;\n border-radius: unset;\n border-style: unset;\n border-bottom: 0.0625rem solid ${palette['border-line']};\n margin-block-end: calc(1.5 * ${spacing});\n }\n `;\n});\n\nStyledHighlightedDetailList.defaultProps = defaultThemeProp;\n\nexport const StyledDetails = styled.div(() => {\n return css`\n grid-column: 1 / -1;\n `;\n});\n\nStyledDetails.defaultProps = defaultThemeProp;\n\nconst nthRecursiveContainerSelector = (\n depth: number,\n includeAllImmediateContainers?: boolean\n): string => {\n const firstContainerSelector = '> div:first-child';\n const baseSelector = includeAllImmediateContainers ? '> div' : firstContainerSelector;\n\n return baseSelector.concat(` ${firstContainerSelector}`.repeat(depth));\n};\n\nconst initialLabelNoMargin = (applyToAllChildren = false) => {\n return css`\n ${nthRecursiveContainerSelector(0, applyToAllChildren)},\n ${nthRecursiveContainerSelector(1, applyToAllChildren)},\n ${nthRecursiveContainerSelector(2, applyToAllChildren)},\n ${nthRecursiveContainerSelector(3, applyToAllChildren)},\n ${nthRecursiveContainerSelector(4, applyToAllChildren)},\n ${nthRecursiveContainerSelector(5, applyToAllChildren)},\n ${nthRecursiveContainerSelector(6, applyToAllChildren)},\n ${nthRecursiveContainerSelector(7, applyToAllChildren)},\n ${nthRecursiveContainerSelector(8, applyToAllChildren)},\n ${nthRecursiveContainerSelector(9, applyToAllChildren)},\n ${nthRecursiveContainerSelector(10, applyToAllChildren)} {\n > ${StyledFieldValueGroupLabel}:first-child {\n margin-block-start: 0;\n }\n }\n `;\n};\n\nexport const StyledDetailList = styled(StyledFieldValueList)<StyledDetailListPropsWithDefaults>(\n ({\n stacked,\n flex,\n hasName,\n nested,\n labelLength,\n variant,\n theme,\n wrapped = false,\n columnCount = 1\n }): any => {\n const {\n base: { spacing }\n } = theme;\n\n const isValueComparison = variant === 'value-comparison';\n const containerWidthCh = colCountChWidth[columnCount].containerWidth;\n const containerWidthMinusLabel = `${containerWidthCh - (labelLength ?? 0)}ch`;\n\n return css`\n /* Top Level Styles */\n ${!nested &&\n css`\n ${StyledFieldValue} {\n word-break: break-word;\n overflow: auto;\n }\n\n ${StyledFieldValueGroupLabel} {\n margin-block-start: calc(3 * ${spacing});\n }\n\n > ${StyledFieldValueGroupLabel}:nth-child(1) {\n margin-block-start: 0;\n }\n\n ${StyledStackedFieldValue} {\n grid-column: 1 / -1;\n }\n `}\n\n /* Nested List */\n ${nested &&\n css`\n grid-column: 1 / -1;\n `}\n\n /* As Field Grid */\n ${!flex &&\n css`\n display: grid;\n grid-template-columns: ${`minmax(14ch, ${labelLength}ch) minmax(14ch, 1fr)`};\n column-gap: calc(2 * ${spacing});\n row-gap: calc(${verticalGapSpacingMultiplier} * ${spacing});\n\n ${stacked &&\n css`\n grid-template-columns: minmax(0, 1fr);\n row-gap: 0;\n `}\n\n > ${StyledStackedFieldValue} {\n max-width: ${`${containerWidthCh}ch`};\n }\n\n > ${StyledFieldValue} {\n max-width: calc(${containerWidthMinusLabel} - calc(2 * ${spacing}));\n }\n\n ${isValueComparison &&\n css`\n grid-template-columns: auto auto;\n column-gap: 0;\n row-gap: calc(0.5 * ${spacing});\n max-width: ${`${containerWidthCh}ch`};\n `}\n `}\n\n /* As Flex Container */\n ${flex &&\n css`\n display: flex;\n flex-direction: ${wrapped ? 'column' : 'row'};\n column-gap: calc(${flexGapProp} * ${spacing});\n align-items: flex-start;\n\n max-width: ${`${containerWidthCh}ch`};\n\n ${!wrapped &&\n css`\n > * {\n max-width: ${`${100 / columnCount}%`};\n }\n\n ${hasName && initialLabelNoMargin(true)}\n `}\n\n ${wrapped &&\n css`\n ${hasName && initialLabelNoMargin()}\n\n ${\n !stacked &&\n css`\n > div:not(:first-child) {\n margin-block-start: calc(${verticalGapSpacingMultiplier} * ${spacing});\n }\n `\n }}\n `}\n `}\n\n /* Key / Group Label Spacing */\n ${!nested &&\n css`\n > div {\n + dt {\n margin-block-start: calc(3 * ${spacing});\n }\n\n + ${StyledStackedFieldValue} {\n margin-block-start: calc(3 * ${spacing});\n }\n\n ${!stacked &&\n css`\n + dt + dd {\n margin-block-start: calc(3 * ${spacing});\n }\n `}\n }\n\n ${initialLabelNoMargin()}\n `}\n\n ${stacked &&\n css`\n dt {\n margin-block-start: calc(${verticalGapSpacingMultiplier} * ${spacing});\n }\n `}\n\n ${StyledFieldValueGroupLabel} + div {\n > ${StyledFieldValueGroupLabel}:first-child {\n margin-block-start: 0;\n }\n\n ${initialLabelNoMargin()}\n }\n `;\n }\n);\n\nStyledDetailList.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface DetailsContextValue {
|
|
2
|
+
longestLabelLength?: number;
|
|
3
|
+
setLongestLabelLength?: (val: number) => void;
|
|
4
|
+
mobileView?: boolean;
|
|
5
|
+
depth?: number;
|
|
6
|
+
}
|
|
7
|
+
declare const DetailsContext: import("react").Context<DetailsContextValue>;
|
|
8
|
+
export default DetailsContext;
|
|
9
|
+
//# sourceMappingURL=DetailsContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailsContext.d.ts","sourceRoot":"","sources":["../../../src/components/Details/DetailsContext.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,cAAc,8CAKlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
const DetailsContext = createContext({
|
|
3
|
+
longestLabelLength: undefined,
|
|
4
|
+
setLongestLabelLength: () => { },
|
|
5
|
+
mobileView: false,
|
|
6
|
+
depth: 1
|
|
7
|
+
});
|
|
8
|
+
export default DetailsContext;
|
|
9
|
+
//# sourceMappingURL=DetailsContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailsContext.js","sourceRoot":"","sources":["../../../src/components/Details/DetailsContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAStC,MAAM,cAAc,GAAG,aAAa,CAAsB;IACxD,kBAAkB,EAAE,SAAS;IAC7B,qBAAqB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC/B,UAAU,EAAE,KAAK;IACjB,KAAK,EAAE,CAAC;CACT,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC","sourcesContent":["import { createContext } from 'react';\n\nexport interface DetailsContextValue {\n longestLabelLength?: number;\n setLongestLabelLength?: (val: number) => void;\n mobileView?: boolean;\n depth?: number;\n}\n\nconst DetailsContext = createContext<DetailsContextValue>({\n longestLabelLength: undefined,\n setLongestLabelLength: () => {},\n mobileView: false,\n depth: 1\n});\n\nexport default DetailsContext;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default } from './Details';
|
|
2
|
-
export {
|
|
3
|
-
export { StyledDetails,
|
|
2
|
+
export { default as DetailsContext } from './DetailsContext';
|
|
3
|
+
export { StyledFieldValueGroupLabel, StyledDetailList, StyledDetails, StyledHighlightedDetailList } from './Details.styles';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default } from './Details';
|
|
2
|
-
export {
|
|
2
|
+
export { default as DetailsContext } from './DetailsContext';
|
|
3
|
+
export { StyledFieldValueGroupLabel, StyledDetailList, StyledDetails, StyledHighlightedDetailList } from './Details.styles';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC","sourcesContent":["export { default } from './Details';\nexport { default as DetailsContext } from './DetailsContext';\nexport {\n StyledFieldValueGroupLabel,\n StyledDetailList,\n StyledDetails,\n StyledHighlightedDetailList\n} from './Details.styles';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import type IntelligentGuidanceProps from './IntelligentGuidance.types';
|
|
4
|
+
declare const IntelligentGuidance: FunctionComponent<IntelligentGuidanceProps & ForwardProps>;
|
|
5
|
+
export default IntelligentGuidance;
|
|
6
|
+
//# sourceMappingURL=IntelligentGuidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntelligentGuidance.d.ts","sourceRoot":"","sources":["../../../src/components/IntelligentGuidance/IntelligentGuidance.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,YAAY,EASb,MAAM,yBAAyB,CAAC;AAQjC,OAAO,KAAK,wBAAwB,MAAM,6BAA6B,CAAC;AAIxE,QAAA,MAAM,mBAAmB,EAAE,iBAAiB,CAAC,wBAAwB,GAAG,YAAY,CAyHnF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Icon, registerIcon, useI18n, Count, useBreakpoint, usePrevious, useAfterInitialEffect } from '@pega/cosmos-react-core';
|
|
4
|
+
import * as polarisSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris-solid.icon';
|
|
5
|
+
import { StyledIntelligentGuidanceList, StyledIntelligentGuidance, StyledIntelligentGuidanceButton } from './IntelligentGuidance.styles';
|
|
6
|
+
registerIcon(polarisSolidIcon);
|
|
7
|
+
const IntelligentGuidance = forwardRef(({ items, heading, ...restProps }, ref) => {
|
|
8
|
+
const t = useI18n();
|
|
9
|
+
const isMediumOrAbove = useBreakpoint('md');
|
|
10
|
+
const [isCollapsed, setIsCollapsed] = useState(true);
|
|
11
|
+
const previousItems = usePrevious(items);
|
|
12
|
+
const summaryListRef = useRef(null);
|
|
13
|
+
const toggleButtonRef = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const previousItemsCount = previousItems?.length || 0;
|
|
16
|
+
if (previousItemsCount < items.length) {
|
|
17
|
+
setIsCollapsed(false);
|
|
18
|
+
}
|
|
19
|
+
else if (previousItemsCount && !items.length) {
|
|
20
|
+
setIsCollapsed(true);
|
|
21
|
+
}
|
|
22
|
+
}, [previousItems, items]);
|
|
23
|
+
const listItems = items.map(item => {
|
|
24
|
+
return {
|
|
25
|
+
id: item.id,
|
|
26
|
+
visual: _jsx(Icon, { name: item.icon }),
|
|
27
|
+
primary: item.label,
|
|
28
|
+
secondary: item.type,
|
|
29
|
+
actions: item.onDismiss
|
|
30
|
+
? [
|
|
31
|
+
{
|
|
32
|
+
text: t('dismiss_label_a11y', [item.label]),
|
|
33
|
+
id: item.id,
|
|
34
|
+
icon: 'times',
|
|
35
|
+
onClick: (id, e) => {
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
item.onDismiss?.(id, e);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
: undefined,
|
|
42
|
+
container: { colGap: 1 },
|
|
43
|
+
role: 'button',
|
|
44
|
+
tabIndex: 0,
|
|
45
|
+
'aria-label': t('continue_label_a11y', [item.label]),
|
|
46
|
+
onClick: item.onClick,
|
|
47
|
+
onKeyDown: (e) => {
|
|
48
|
+
if (e.key === 'Enter') {
|
|
49
|
+
item.onClick(e);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
const [headerHeight, setHeaderHeight] = useState(0);
|
|
55
|
+
useLayoutEffect(() => {
|
|
56
|
+
if (summaryListRef.current) {
|
|
57
|
+
setHeaderHeight(summaryListRef.current.querySelector('header')?.offsetHeight || 0);
|
|
58
|
+
}
|
|
59
|
+
}, [summaryListRef.current]);
|
|
60
|
+
// FIXME: This is a hack to get the Tooltip to reset its position when the list is toggled.
|
|
61
|
+
useAfterInitialEffect(() => {
|
|
62
|
+
if (toggleButtonRef.current && toggleButtonRef.current === document.activeElement) {
|
|
63
|
+
toggleButtonRef.current.blur();
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
toggleButtonRef.current?.focus();
|
|
66
|
+
}, 1000);
|
|
67
|
+
}
|
|
68
|
+
}, [isCollapsed]);
|
|
69
|
+
return (_jsx(StyledIntelligentGuidance, { ...restProps, ref: ref, role: 'region', "aria-live": 'polite', "aria-relevant": 'all', isCollapsed: isCollapsed, hasItems: !!items.length, children: isMediumOrAbove || !isCollapsed ? (_jsx(StyledIntelligentGuidanceList, { ref: summaryListRef, icon: 'polaris-solid', name: heading, count: items.length, items: listItems, actions: [
|
|
70
|
+
{
|
|
71
|
+
text: t(isCollapsed ? 'expand' : 'collapse'),
|
|
72
|
+
id: 'IntelligentGuidanceButton',
|
|
73
|
+
icon: 'caret-down',
|
|
74
|
+
'aria-label': isCollapsed
|
|
75
|
+
? t('expand_noun', [heading])
|
|
76
|
+
: t('collapse_noun', [heading]),
|
|
77
|
+
onClick() {
|
|
78
|
+
setIsCollapsed(prevState => !prevState);
|
|
79
|
+
},
|
|
80
|
+
ref: toggleButtonRef
|
|
81
|
+
}
|
|
82
|
+
], EmptyStateText: t('no_recommendations'), style: { '--headerHeight': `${headerHeight}px` } })) : (_jsxs(StyledIntelligentGuidanceButton, { variant: 'simple', "aria-label": isCollapsed ? t('expand_noun', [heading]) : t('collapse_noun', [heading]), icon: true, onClick: () => {
|
|
83
|
+
setIsCollapsed(false);
|
|
84
|
+
}, children: [_jsx(Icon, { name: 'polaris-solid' }), _jsx(Count, { children: items.length })] })) }));
|
|
85
|
+
});
|
|
86
|
+
export default IntelligentGuidance;
|
|
87
|
+
//# sourceMappingURL=IntelligentGuidance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntelligentGuidance.js","sourceRoot":"","sources":["../../../src/components/IntelligentGuidance/IntelligentGuidance.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAIV,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,IAAI,EACJ,YAAY,EAEZ,OAAO,EACP,KAAK,EACL,aAAa,EACb,WAAW,EACX,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,gBAAgB,MAAM,sEAAsE,CAAC;AAEzG,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,+BAA+B,EAChC,MAAM,8BAA8B,CAAC;AAGtC,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAE/B,MAAM,mBAAmB,GAA+D,UAAU,CAChG,CACE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,EAA6C,EAC3E,GAAoC,EACpC,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,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C7B,KAAC,KAAK,cAAE,KAAK,CAAC,MAAM,GAAS,IACG,CACnC,GACyB,CAC7B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n KeyboardEvent,\n PropsWithoutRef,\n useEffect,\n useLayoutEffect,\n useRef,\n useState\n} from 'react';\n\nimport {\n ForwardProps,\n Icon,\n registerIcon,\n SummaryListItem,\n useI18n,\n Count,\n useBreakpoint,\n usePrevious,\n useAfterInitialEffect\n} from '@pega/cosmos-react-core';\nimport * as polarisSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris-solid.icon';\n\nimport {\n StyledIntelligentGuidanceList,\n StyledIntelligentGuidance,\n StyledIntelligentGuidanceButton\n} from './IntelligentGuidance.styles';\nimport type IntelligentGuidanceProps from './IntelligentGuidance.types';\n\nregisterIcon(polarisSolidIcon);\n\nconst IntelligentGuidance: FunctionComponent<IntelligentGuidanceProps & ForwardProps> = forwardRef(\n (\n { items, heading, ...restProps }: PropsWithoutRef<IntelligentGuidanceProps>,\n ref: IntelligentGuidanceProps['ref']\n ) => {\n const t = useI18n();\n const isMediumOrAbove = useBreakpoint('md');\n const [isCollapsed, setIsCollapsed] = useState(true);\n const previousItems = usePrevious(items);\n const summaryListRef = useRef<HTMLElement>(null);\n const toggleButtonRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n const previousItemsCount = previousItems?.length || 0;\n if (previousItemsCount < items.length) {\n setIsCollapsed(false);\n } else if (previousItemsCount && !items.length) {\n setIsCollapsed(true);\n }\n }, [previousItems, items]);\n\n const listItems: SummaryListItem[] = items.map(item => {\n return {\n id: item.id,\n visual: <Icon name={item.icon} />,\n primary: item.label,\n secondary: item.type,\n actions: item.onDismiss\n ? [\n {\n text: t('dismiss_label_a11y', [item.label]),\n id: item.id,\n icon: 'times',\n onClick: (id, e) => {\n e.stopPropagation();\n item.onDismiss?.(id, e);\n }\n }\n ]\n : undefined,\n container: { colGap: 1 },\n role: 'button',\n tabIndex: 0,\n 'aria-label': t('continue_label_a11y', [item.label]),\n onClick: item.onClick,\n onKeyDown: (e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n item.onClick(e);\n }\n }\n };\n });\n\n const [headerHeight, setHeaderHeight] = useState(0);\n\n useLayoutEffect(() => {\n if (summaryListRef.current) {\n setHeaderHeight(summaryListRef.current.querySelector('header')?.offsetHeight || 0);\n }\n }, [summaryListRef.current]);\n\n // FIXME: This is a hack to get the Tooltip to reset its position when the list is toggled.\n useAfterInitialEffect(() => {\n if (toggleButtonRef.current && toggleButtonRef.current === document.activeElement) {\n toggleButtonRef.current.blur();\n setTimeout(() => {\n toggleButtonRef.current?.focus();\n }, 1000);\n }\n }, [isCollapsed]);\n\n return (\n <StyledIntelligentGuidance\n {...restProps}\n ref={ref}\n role='region'\n aria-live='polite'\n aria-relevant='all'\n isCollapsed={isCollapsed}\n hasItems={!!items.length}\n >\n {isMediumOrAbove || !isCollapsed ? (\n <StyledIntelligentGuidanceList\n ref={summaryListRef}\n icon='polaris-solid'\n name={heading}\n count={items.length}\n items={listItems}\n actions={[\n {\n text: t(isCollapsed ? 'expand' : 'collapse'),\n id: 'IntelligentGuidanceButton',\n icon: 'caret-down',\n 'aria-label': isCollapsed\n ? t('expand_noun', [heading])\n : t('collapse_noun', [heading]),\n onClick() {\n setIsCollapsed(prevState => !prevState);\n },\n ref: toggleButtonRef\n }\n ]}\n EmptyStateText={t('no_recommendations')}\n style={{ '--headerHeight': `${headerHeight}px` }}\n />\n ) : (\n <StyledIntelligentGuidanceButton\n variant='simple'\n aria-label={isCollapsed ? t('expand_noun', [heading]) : t('collapse_noun', [heading])}\n icon\n onClick={() => {\n setIsCollapsed(false);\n }}\n >\n <Icon name='polaris-solid' />\n <Count>{items.length}</Count>\n </StyledIntelligentGuidanceButton>\n )}\n </StyledIntelligentGuidance>\n );\n }\n);\n\nexport default IntelligentGuidance;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const StyledIntelligentGuidanceList: import("styled-components").StyledComponent<import("react").FC<import("@pega/cosmos-react-core").SummaryListProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
2
|
+
export declare const StyledIntelligentGuidanceButton: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
+
export interface StyledIntelligentGuidanceProps {
|
|
4
|
+
isCollapsed: boolean;
|
|
5
|
+
hasItems: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const StyledIntelligentGuidance: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledIntelligentGuidanceProps, never>;
|
|
8
|
+
//# sourceMappingURL=IntelligentGuidance.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntelligentGuidance.styles.d.ts","sourceRoot":"","sources":["../../../src/components/IntelligentGuidance/IntelligentGuidance.styles.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,6BAA6B,2NA8ExC,CAAC;AAIH,eAAO,MAAM,+BAA+B,qOAiB1C,CAAC;AAaH,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,yBAAyB,qIAgCrC,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import styled, { css, keyframes } from 'styled-components';
|
|
2
|
+
import { lighten } from 'polished';
|
|
3
|
+
import { Button, defaultThemeProp, StyledButton, StyledCard, StyledFlex, StyledIcon, StyledEmptyState, SummaryList, StyledText, tryCatch, StyledSummaryItem, StyledVisual } from '@pega/cosmos-react-core';
|
|
4
|
+
import { StyledCount } from '@pega/cosmos-react-core/lib/components/Badges/Count';
|
|
5
|
+
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
6
|
+
import { StyledSummaryListContent } from '@pega/cosmos-react-core/lib/components/SummaryList/SummaryList';
|
|
7
|
+
const itemIconSize = '2rem';
|
|
8
|
+
export const StyledIntelligentGuidanceList = styled(SummaryList)(({ theme }) => {
|
|
9
|
+
const borderColor = tryCatch(() => lighten(0.1, theme.components['app-shell'].nav['background-color']));
|
|
10
|
+
const hoverColor = tryCatch(() => lighten(0.05, theme.components['app-shell'].nav['background-color']));
|
|
11
|
+
return css `
|
|
12
|
+
min-width: 20rem;
|
|
13
|
+
max-width: 20rem;
|
|
14
|
+
color: ${theme.base.palette.light};
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
box-shadow: ${theme.base.shadow.low};
|
|
17
|
+
@media (min-width: ${theme.base.breakpoints.lg}) {
|
|
18
|
+
min-width: 23rem;
|
|
19
|
+
max-width: 23rem;
|
|
20
|
+
}
|
|
21
|
+
&:not(& &) {
|
|
22
|
+
background-color: ${theme.components['app-shell'].nav['background-color']};
|
|
23
|
+
}
|
|
24
|
+
${StyledCardHeader} {
|
|
25
|
+
&:not(${StyledCard} ${StyledCard} > &) {
|
|
26
|
+
padding: ${theme.base.spacing};
|
|
27
|
+
}
|
|
28
|
+
${StyledFlex} > ${StyledIcon} {
|
|
29
|
+
width: ${itemIconSize};
|
|
30
|
+
height: ${itemIconSize};
|
|
31
|
+
padding: calc(0.75 * ${theme.base.spacing});
|
|
32
|
+
border-radius: calc(3 * ${theme.base['border-radius']});
|
|
33
|
+
background-color: ${theme.base.palette.success};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
${StyledSummaryListContent} {
|
|
37
|
+
&:not(${StyledCard} ${StyledCard} > &) {
|
|
38
|
+
padding: 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
${StyledButton}:enabled:focus {
|
|
42
|
+
box-shadow: ${theme.base.shadow['focus-inverted']};
|
|
43
|
+
}
|
|
44
|
+
${StyledSummaryItem} {
|
|
45
|
+
padding: ${theme.base.spacing};
|
|
46
|
+
border-top: ${theme.components.button['border-width']} solid ${borderColor};
|
|
47
|
+
outline: none;
|
|
48
|
+
${StyledVisual} ${StyledIcon} {
|
|
49
|
+
width: ${itemIconSize};
|
|
50
|
+
height: ${itemIconSize};
|
|
51
|
+
padding: calc(0.75 * ${theme.base.spacing});
|
|
52
|
+
}
|
|
53
|
+
${StyledButton} {
|
|
54
|
+
visibility: hidden;
|
|
55
|
+
}
|
|
56
|
+
&:not(:last-child) {
|
|
57
|
+
border-bottom: none;
|
|
58
|
+
}
|
|
59
|
+
&:hover {
|
|
60
|
+
background-color: ${hoverColor};
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
}
|
|
63
|
+
&:hover,
|
|
64
|
+
&:focus,
|
|
65
|
+
&:focus-within {
|
|
66
|
+
${StyledButton} {
|
|
67
|
+
visibility: visible;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
&:enabled:focus,
|
|
71
|
+
&:not([disabled]):focus {
|
|
72
|
+
box-shadow: inset ${theme.base.shadow['focus-inverted']};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
${StyledEmptyState} {
|
|
76
|
+
padding-bottom: ${theme.base.spacing};
|
|
77
|
+
${StyledIcon}, ${StyledText} {
|
|
78
|
+
color: ${theme.base.palette.light};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
});
|
|
83
|
+
StyledIntelligentGuidanceList.defaultProps = defaultThemeProp;
|
|
84
|
+
export const StyledIntelligentGuidanceButton = styled(Button)(({ theme }) => {
|
|
85
|
+
return css `
|
|
86
|
+
box-shadow: ${theme.base.shadow.low};
|
|
87
|
+
color: ${theme.base.palette.light};
|
|
88
|
+
background-color: ${theme.base.palette.success};
|
|
89
|
+
width: 4rem;
|
|
90
|
+
height: 4rem;
|
|
91
|
+
svg {
|
|
92
|
+
width: 2.25rem;
|
|
93
|
+
height: 2.25rem;
|
|
94
|
+
}
|
|
95
|
+
${StyledCount} {
|
|
96
|
+
position: absolute;
|
|
97
|
+
right: 0;
|
|
98
|
+
top: 0;
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
});
|
|
102
|
+
StyledIntelligentGuidanceButton.defaultProps = defaultThemeProp;
|
|
103
|
+
const slideIn = keyframes `
|
|
104
|
+
0% {
|
|
105
|
+
transform: translateY(100%);
|
|
106
|
+
}
|
|
107
|
+
100% {
|
|
108
|
+
transform: translateY(0);
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
export const StyledIntelligentGuidance = styled.div(({ theme, isCollapsed }) => {
|
|
112
|
+
return css `
|
|
113
|
+
position: fixed;
|
|
114
|
+
inset-inline-start: calc(2 * ${theme.base.spacing} + var(--appshell-horizontal-offset, 0rem));
|
|
115
|
+
transition: inset-inline-start ${theme.base.animation.speed}
|
|
116
|
+
${theme.base.animation.timing.ease};
|
|
117
|
+
bottom: ${isCollapsed ? `calc(2 * ${theme.base.spacing}) ` : 0};
|
|
118
|
+
@media (min-width: ${theme.base.breakpoints.md}) {
|
|
119
|
+
bottom: 0;
|
|
120
|
+
}
|
|
121
|
+
z-index: ${theme.base['z-index'].popover};
|
|
122
|
+
${StyledIntelligentGuidanceList}:not(${StyledIntelligentGuidanceList} ${StyledIntelligentGuidanceList}) {
|
|
123
|
+
border-bottom-left-radius: 0;
|
|
124
|
+
border-bottom-right-radius: 0;
|
|
125
|
+
transition: transform calc(4 * ${theme.base.animation.speed})
|
|
126
|
+
${theme.base.animation.timing.ease};
|
|
127
|
+
${isCollapsed &&
|
|
128
|
+
css `
|
|
129
|
+
transform: translateY(calc(100% - var(--headerHeight)));
|
|
130
|
+
`}
|
|
131
|
+
${StyledCardHeader} ${StyledButton} {
|
|
132
|
+
transition: transform calc(2 * ${theme.base.animation.speed})
|
|
133
|
+
${theme.base.animation.timing.ease};
|
|
134
|
+
transform: ${isCollapsed ? 'rotate(-180deg)' : 'rotate(0)'};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
${StyledIntelligentGuidanceButton} {
|
|
138
|
+
animation: ${slideIn} calc(4 * ${theme.base.animation.speed});
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
});
|
|
142
|
+
StyledIntelligentGuidance.defaultProps = defaultThemeProp;
|
|
143
|
+
//# sourceMappingURL=IntelligentGuidance.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntelligentGuidance.styles.js","sourceRoot":"","sources":["../../../src/components/IntelligentGuidance/IntelligentGuidance.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,gEAAgE,CAAC;AAE1G,MAAM,YAAY,GAAG,MAAM,CAAC;AAE5B,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7E,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,EAAE,CAChC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CACpE,CAAC;IACF,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,EAAE,CAC/B,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC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C,IAAI;uBACvB,WAAW,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW;;;QAG5D,+BAA+B;qBAClB,OAAO,aAAa,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK;;KAE9D,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css, keyframes } from 'styled-components';\nimport { lighten } from 'polished';\n\nimport {\n Button,\n defaultThemeProp,\n StyledButton,\n StyledCard,\n StyledFlex,\n StyledIcon,\n StyledEmptyState,\n SummaryList,\n StyledText,\n tryCatch,\n StyledSummaryItem,\n StyledVisual\n} from '@pega/cosmos-react-core';\nimport { StyledCount } from '@pega/cosmos-react-core/lib/components/Badges/Count';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledSummaryListContent } from '@pega/cosmos-react-core/lib/components/SummaryList/SummaryList';\n\nconst itemIconSize = '2rem';\n\nexport const StyledIntelligentGuidanceList = styled(SummaryList)(({ theme }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n const hoverColor = tryCatch(() =>\n lighten(0.05, theme.components['app-shell'].nav['background-color'])\n );\n return css`\n min-width: 20rem;\n max-width: 20rem;\n color: ${theme.base.palette.light};\n overflow: hidden;\n box-shadow: ${theme.base.shadow.low};\n @media (min-width: ${theme.base.breakpoints.lg}) {\n min-width: 23rem;\n max-width: 23rem;\n }\n &:not(& &) {\n background-color: ${theme.components['app-shell'].nav['background-color']};\n }\n ${StyledCardHeader} {\n &:not(${StyledCard} ${StyledCard} > &) {\n padding: ${theme.base.spacing};\n }\n ${StyledFlex} > ${StyledIcon} {\n width: ${itemIconSize};\n height: ${itemIconSize};\n padding: calc(0.75 * ${theme.base.spacing});\n border-radius: calc(3 * ${theme.base['border-radius']});\n background-color: ${theme.base.palette.success};\n }\n }\n ${StyledSummaryListContent} {\n &:not(${StyledCard} ${StyledCard} > &) {\n padding: 0;\n }\n }\n ${StyledButton}:enabled:focus {\n box-shadow: ${theme.base.shadow['focus-inverted']};\n }\n ${StyledSummaryItem} {\n padding: ${theme.base.spacing};\n border-top: ${theme.components.button['border-width']} solid ${borderColor};\n outline: none;\n ${StyledVisual} ${StyledIcon} {\n width: ${itemIconSize};\n height: ${itemIconSize};\n padding: calc(0.75 * ${theme.base.spacing});\n }\n ${StyledButton} {\n visibility: hidden;\n }\n &:not(:last-child) {\n border-bottom: none;\n }\n &:hover {\n background-color: ${hoverColor};\n cursor: pointer;\n }\n &:hover,\n &:focus,\n &:focus-within {\n ${StyledButton} {\n visibility: visible;\n }\n }\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: inset ${theme.base.shadow['focus-inverted']};\n }\n }\n ${StyledEmptyState} {\n padding-bottom: ${theme.base.spacing};\n ${StyledIcon}, ${StyledText} {\n color: ${theme.base.palette.light};\n }\n }\n `;\n});\n\nStyledIntelligentGuidanceList.defaultProps = defaultThemeProp;\n\nexport const StyledIntelligentGuidanceButton = styled(Button)(({ theme }) => {\n return css`\n box-shadow: ${theme.base.shadow.low};\n color: ${theme.base.palette.light};\n background-color: ${theme.base.palette.success};\n width: 4rem;\n height: 4rem;\n svg {\n width: 2.25rem;\n height: 2.25rem;\n }\n ${StyledCount} {\n position: absolute;\n right: 0;\n top: 0;\n }\n `;\n});\n\nStyledIntelligentGuidanceButton.defaultProps = defaultThemeProp;\n\nconst slideIn = keyframes`\n 0% {\n transform: translateY(100%);\n }\n 100% {\n transform: translateY(0);\n }\n`;\n\nexport interface StyledIntelligentGuidanceProps {\n isCollapsed: boolean;\n hasItems: boolean;\n}\n\nexport const StyledIntelligentGuidance = styled.div<StyledIntelligentGuidanceProps>(\n ({ theme, isCollapsed }) => {\n return css`\n position: fixed;\n inset-inline-start: calc(2 * ${theme.base.spacing} + var(--appshell-horizontal-offset, 0rem));\n transition: inset-inline-start ${theme.base.animation.speed}\n ${theme.base.animation.timing.ease};\n bottom: ${isCollapsed ? `calc(2 * ${theme.base.spacing}) ` : 0};\n @media (min-width: ${theme.base.breakpoints.md}) {\n bottom: 0;\n }\n z-index: ${theme.base['z-index'].popover};\n ${StyledIntelligentGuidanceList}:not(${StyledIntelligentGuidanceList} ${StyledIntelligentGuidanceList}) {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n transition: transform calc(4 * ${theme.base.animation.speed})\n ${theme.base.animation.timing.ease};\n ${isCollapsed &&\n css`\n transform: translateY(calc(100% - var(--headerHeight)));\n `}\n ${StyledCardHeader} ${StyledButton} {\n transition: transform calc(2 * ${theme.base.animation.speed})\n ${theme.base.animation.timing.ease};\n transform: ${isCollapsed ? 'rotate(-180deg)' : 'rotate(0)'};\n }\n }\n ${StyledIntelligentGuidanceButton} {\n animation: ${slideIn} calc(4 * ${theme.base.animation.speed});\n }\n `;\n }\n);\n\nStyledIntelligentGuidance.defaultProps = defaultThemeProp;\n"]}
|