@pega/cosmos-react-work 9.0.0-build.9.9 → 9.0.1
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 +2 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js +36 -21
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/Article/ArticleRating.d.ts +1 -1
- package/lib/components/Article/ArticleRating.d.ts.map +1 -1
- package/lib/components/ArticleList/AIArticleSummary.d.ts +3 -1
- package/lib/components/ArticleList/AIArticleSummary.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddy.d.ts +1 -1
- package/lib/components/ArticleList/ArticleBuddy.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddy.js +5 -1
- package/lib/components/ArticleList/ArticleBuddy.js.map +1 -1
- package/lib/components/ArticleList/ArticleBuddyList.d.ts +1 -1
- package/lib/components/ArticleList/ArticleBuddyList.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddyResponse.d.ts +189 -3
- package/lib/components/ArticleList/ArticleBuddyResponse.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddyResponse.js +1 -1
- package/lib/components/ArticleList/ArticleBuddyResponse.js.map +1 -1
- package/lib/components/ArticleList/ArticleFeedback.d.ts +3 -1
- package/lib/components/ArticleList/ArticleFeedback.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleList.d.ts +2 -2
- package/lib/components/ArticleList/ArticleList.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleList.js +6 -0
- package/lib/components/ArticleList/ArticleList.js.map +1 -1
- package/lib/components/ArticleList/ArticleList.types.d.ts +17 -2
- package/lib/components/ArticleList/ArticleList.types.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleList.types.js.map +1 -1
- package/lib/components/ArticleList/ArticleListHeader.d.ts +183 -1
- package/lib/components/ArticleList/ArticleListHeader.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleSummary.styles.d.ts +2 -2
- package/lib/components/ArticleList/ArticleSummary.styles.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleSummaryHeader.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleSummaryHeader.js +3 -1
- package/lib/components/ArticleList/ArticleSummaryHeader.js.map +1 -1
- package/lib/components/ArticleList/QuestionList.d.ts +5 -3
- package/lib/components/ArticleList/QuestionList.d.ts.map +1 -1
- package/lib/components/ArticleList/RelatedQuestions.d.ts +4 -2
- package/lib/components/ArticleList/RelatedQuestions.d.ts.map +1 -1
- package/lib/components/Assignments/Assignments.d.ts +2 -2
- package/lib/components/Assignments/Assignments.d.ts.map +1 -1
- package/lib/components/Assignments/Assignments.js +1 -1
- package/lib/components/Assignments/Assignments.js.map +1 -1
- package/lib/components/Assignments/Assignments.styles.d.ts +7 -3
- package/lib/components/Assignments/Assignments.styles.d.ts.map +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.d.ts +2 -2
- package/lib/components/CaseHierarchy/CaseHierarchy.d.ts.map +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.js +4 -3
- package/lib/components/CaseHierarchy/CaseHierarchy.js.map +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.d.ts +7 -3
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.d.ts.map +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.js +9 -7
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.js.map +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.d.ts +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.d.ts.map +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.js +2 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.js.map +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.types.d.ts +7 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.types.d.ts.map +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.types.js.map +1 -1
- package/lib/components/CasePreview/CasePreview.d.ts +1 -1
- package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
- package/lib/components/CasePreview/CasePreview.js +83 -115
- package/lib/components/CasePreview/CasePreview.js.map +1 -1
- package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -1
- package/lib/components/CaseView/CaseHeader/CaseHeader.js +97 -27
- package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -1
- package/lib/components/CaseView/CaseHeader/Summary.d.ts.map +1 -1
- package/lib/components/CaseView/CaseHeader/Summary.js +8 -1
- package/lib/components/CaseView/CaseHeader/Summary.js.map +1 -1
- package/lib/components/CaseView/CaseSummaryFields.js +1 -1
- package/lib/components/CaseView/CaseSummaryFields.js.map +1 -1
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +49 -20
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +83 -47
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +329 -122
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.types.d.ts +24 -8
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.types.js.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.d.ts +1 -1
- package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.js +14 -4
- package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
- package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitySummaryItemDialog.js +10 -4
- package/lib/components/CaseView/UtilitySummaryItemDialog.js.map +1 -1
- package/lib/components/ConfigurableLayout/LayoutCell.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/LayoutCell.js +25 -25
- package/lib/components/ConfigurableLayout/LayoutCell.js.map +1 -1
- package/lib/components/Confirmation/Confirmation.d.ts +10 -0
- package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.js +2 -2
- package/lib/components/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/Confirmation/index.d.ts +1 -1
- package/lib/components/Confirmation/index.d.ts.map +1 -1
- package/lib/components/Confirmation/index.js.map +1 -1
- package/lib/components/Details/Details.d.ts +3 -2
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +6 -5
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/Details.styles.d.ts +17 -15
- package/lib/components/Details/Details.styles.d.ts.map +1 -1
- package/lib/components/Details/Details.styles.js +28 -15
- package/lib/components/Details/Details.styles.js.map +1 -1
- package/lib/components/Details/Details.test-ids.d.ts +1 -1
- package/lib/components/Details/Details.test-ids.d.ts.map +1 -1
- package/lib/components/Details/Details.test-ids.js +2 -1
- package/lib/components/Details/Details.test-ids.js.map +1 -1
- package/lib/components/Details/DetailsList.d.ts.map +1 -1
- package/lib/components/Details/DetailsList.js +1 -5
- package/lib/components/Details/DetailsList.js.map +1 -1
- package/lib/components/GenAICoach/ActiveCases.d.ts +5 -0
- package/lib/components/GenAICoach/ActiveCases.d.ts.map +1 -0
- package/lib/components/GenAICoach/ActiveCases.js +50 -0
- package/lib/components/GenAICoach/ActiveCases.js.map +1 -0
- package/lib/components/GenAICoach/CaseWorkflow.d.ts +5 -0
- package/lib/components/GenAICoach/CaseWorkflow.d.ts.map +1 -0
- package/lib/components/GenAICoach/CaseWorkflow.js +111 -0
- package/lib/components/GenAICoach/CaseWorkflow.js.map +1 -0
- package/lib/components/GenAICoach/ConversationHistory.d.ts.map +1 -1
- package/lib/components/GenAICoach/ConversationHistory.js +11 -13
- package/lib/components/GenAICoach/ConversationHistory.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.d.ts +4 -3
- package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.js +721 -141
- package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts +1639 -35
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.js +867 -82
- package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts +3 -2
- package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.js +6 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.d.ts +215 -9
- package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -1
- package/lib/components/GenAICoach/GenAIMessage.d.ts +6 -0
- package/lib/components/GenAICoach/GenAIMessage.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAIMessage.js +101 -52
- package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
- package/lib/components/GenAICoach/GenAIMessageFeedback.d.ts +4 -0
- package/lib/components/GenAICoach/GenAIMessageFeedback.d.ts.map +1 -0
- package/lib/components/GenAICoach/GenAIMessageFeedback.js +95 -0
- package/lib/components/GenAICoach/GenAIMessageFeedback.js.map +1 -0
- package/lib/components/GenAICoach/GenAIMessageProgress.d.ts +4 -1
- package/lib/components/GenAICoach/GenAIMessageProgress.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAIMessageProgress.js +11 -35
- package/lib/components/GenAICoach/GenAIMessageProgress.js.map +1 -1
- package/lib/components/GenAICoach/InitialSuggestedMessage.d.ts.map +1 -1
- package/lib/components/GenAICoach/InitialSuggestedMessage.js +5 -6
- package/lib/components/GenAICoach/InitialSuggestedMessage.js.map +1 -1
- package/lib/components/GenAICoach/PortalAgentSplitView.d.ts +6 -0
- package/lib/components/GenAICoach/PortalAgentSplitView.d.ts.map +1 -0
- package/lib/components/GenAICoach/PortalAgentSplitView.js +75 -0
- package/lib/components/GenAICoach/PortalAgentSplitView.js.map +1 -0
- package/lib/components/GenAICoach/Questionnaire.d.ts +4 -0
- package/lib/components/GenAICoach/Questionnaire.d.ts.map +1 -0
- package/lib/components/GenAICoach/Questionnaire.js +155 -0
- package/lib/components/GenAICoach/Questionnaire.js.map +1 -0
- package/lib/components/GenAICoach/ToolCandidates.d.ts +4 -0
- package/lib/components/GenAICoach/ToolCandidates.d.ts.map +1 -0
- package/lib/components/GenAICoach/ToolCandidates.js +19 -0
- package/lib/components/GenAICoach/ToolCandidates.js.map +1 -0
- package/lib/components/GenAICoach/ToolConfirmationMessage.d.ts +4 -0
- package/lib/components/GenAICoach/ToolConfirmationMessage.d.ts.map +1 -0
- package/lib/components/GenAICoach/ToolConfirmationMessage.js +20 -0
- package/lib/components/GenAICoach/ToolConfirmationMessage.js.map +1 -0
- package/lib/components/GenAICoach/ToolDetails.d.ts +5 -0
- package/lib/components/GenAICoach/ToolDetails.d.ts.map +1 -0
- package/lib/components/GenAICoach/ToolDetails.js +99 -0
- package/lib/components/GenAICoach/ToolDetails.js.map +1 -0
- package/lib/components/GenAICoach/index.d.ts +5 -3
- package/lib/components/GenAICoach/index.d.ts.map +1 -1
- package/lib/components/GenAICoach/index.js +4 -2
- package/lib/components/GenAICoach/index.js.map +1 -1
- package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts +55 -34
- package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/Assignments.styles.js +41 -11
- package/lib/components/HierarchicalAssignments/Assignments.styles.js.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts +2 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.js.map +1 -1
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts +1 -1
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js +7 -4
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js.map +1 -1
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.js +2 -2
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +9 -5
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +17 -3
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.d.ts +31 -8
- package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.js +17 -10
- package/lib/components/InteractionNotification/InteractionNotification.js.map +1 -1
- package/lib/components/Predictions/Predictions.d.ts.map +1 -1
- package/lib/components/Predictions/Predictions.js +11 -2
- package/lib/components/Predictions/Predictions.js.map +1 -1
- package/lib/components/SearchResults/ActiveFilter.d.ts +1 -1
- package/lib/components/SearchResults/ActiveFilter.d.ts.map +1 -1
- package/lib/components/SearchResults/Filter.d.ts.map +1 -1
- package/lib/components/SearchResults/Filter.js +1 -1
- package/lib/components/SearchResults/Filter.js.map +1 -1
- package/lib/components/SearchResults/SearchResult.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResult.js +14 -6
- 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 +18 -3
- package/lib/components/SearchResults/SearchResults.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.styles.d.ts +12 -10
- package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.d.ts +7 -0
- package/lib/components/Shortcuts/Shortcuts.d.ts.map +1 -0
- package/lib/components/Shortcuts/Shortcuts.js +47 -0
- package/lib/components/Shortcuts/Shortcuts.js.map +1 -0
- package/lib/components/Shortcuts/Shortcuts.styles.d.ts +22 -0
- package/lib/components/Shortcuts/Shortcuts.styles.d.ts.map +1 -0
- package/lib/components/Shortcuts/Shortcuts.styles.js +114 -0
- package/lib/components/Shortcuts/Shortcuts.styles.js.map +1 -0
- package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts +2 -0
- package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts.map +1 -0
- package/lib/components/Shortcuts/Shortcuts.test-ids.js +8 -0
- package/lib/components/Shortcuts/Shortcuts.test-ids.js.map +1 -0
- package/lib/components/Shortcuts/Shortcuts.types.d.ts +64 -0
- package/lib/components/Shortcuts/Shortcuts.types.d.ts.map +1 -0
- package/lib/components/Shortcuts/Shortcuts.types.js +2 -0
- package/lib/components/Shortcuts/Shortcuts.types.js.map +1 -0
- package/lib/components/Shortcuts/index.d.ts +3 -0
- package/lib/components/Shortcuts/index.d.ts.map +1 -0
- package/lib/components/Shortcuts/index.js +2 -0
- package/lib/components/Shortcuts/index.js.map +1 -0
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +37 -12
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +22 -15
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +285 -119
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stages/Stages.types.d.ts +5 -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/Stakeholders/Stakeholders.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.js +109 -145
- package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
- package/lib/components/Tags/Tags.d.ts +2 -2
- package/lib/components/Tags/Tags.d.ts.map +1 -1
- package/lib/components/Tags/Tags.js +12 -2
- package/lib/components/Tags/Tags.js.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts +10 -3
- package/lib/components/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +59 -5
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/lib/components/Tasks/Tasks.d.ts +10 -3
- package/lib/components/Tasks/Tasks.d.ts.map +1 -1
- package/lib/components/Tasks/Tasks.js +29 -5
- package/lib/components/Tasks/Tasks.js.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.d.ts.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.js +3 -2
- package/lib/components/UtilitiesLayout/UtilitiesLayout.js.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts +2 -2
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js +3 -2
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +6 -7
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { mix } from 'polished';
|
|
3
|
+
import { Button, defaultThemeProp, Icon, Text, tryCatch } from '@pega/cosmos-react-core';
|
|
4
|
+
export const StyledShortcutsCardsContainer = styled.ul(({ theme: { base }, isSmallOrAbove, showHeader }) => {
|
|
5
|
+
return css `
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: minmax(0, 1fr);
|
|
8
|
+
gap: ${base.spacing};
|
|
9
|
+
list-style: none;
|
|
10
|
+
padding: ${base.spacing} 0;
|
|
11
|
+
margin: 0;
|
|
12
|
+
|
|
13
|
+
${isSmallOrAbove &&
|
|
14
|
+
css `
|
|
15
|
+
grid-auto-rows: 1fr;
|
|
16
|
+
grid-template-columns: ${showHeader
|
|
17
|
+
? 'repeat(auto-fill, minmax(14rem, 1fr))'
|
|
18
|
+
: 'repeat(auto-fit, minmax(14rem, 14rem))'};
|
|
19
|
+
justify-content: ${showHeader ? 'start' : 'center'};
|
|
20
|
+
align-items: stretch;
|
|
21
|
+
width: 100%;
|
|
22
|
+
`}
|
|
23
|
+
`;
|
|
24
|
+
});
|
|
25
|
+
StyledShortcutsCardsContainer.defaultProps = defaultThemeProp;
|
|
26
|
+
export const StyledShortcutsCategoriesContainer = styled.div(({ theme: { base }, isSmallOrAbove }) => {
|
|
27
|
+
return css `
|
|
28
|
+
display: grid;
|
|
29
|
+
grid-template-columns: minmax(0, 1fr);
|
|
30
|
+
gap: calc(${base.spacing} * 2);
|
|
31
|
+
width: 100%;
|
|
32
|
+
|
|
33
|
+
${isSmallOrAbove &&
|
|
34
|
+
css `
|
|
35
|
+
grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
|
|
36
|
+
align-items: start;
|
|
37
|
+
`}
|
|
38
|
+
|
|
39
|
+
${!isSmallOrAbove &&
|
|
40
|
+
css `
|
|
41
|
+
padding-inline: calc(${base.spacing} * 0.5);
|
|
42
|
+
padding-block: ${base.spacing};
|
|
43
|
+
`}
|
|
44
|
+
`;
|
|
45
|
+
});
|
|
46
|
+
StyledShortcutsCategoriesContainer.defaultProps = defaultThemeProp;
|
|
47
|
+
export const StyledShortcutsCategoryHeading = styled(Text)(({ theme: { base } }) => {
|
|
48
|
+
return css `
|
|
49
|
+
margin-block-end: ${base.spacing};
|
|
50
|
+
`;
|
|
51
|
+
});
|
|
52
|
+
StyledShortcutsCategoryHeading.defaultProps = defaultThemeProp;
|
|
53
|
+
export const StyledShortcutsCard = styled.li `
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
`;
|
|
57
|
+
export const StyledShortcutsCardButton = styled(Button)(({ theme: { base, components }, layoutVariant }) => {
|
|
58
|
+
const hoverBackgroundColor = tryCatch(() => mix(0.9, base.palette['primary-background'], components.button['secondary-color']));
|
|
59
|
+
return css `
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: flex-start;
|
|
63
|
+
flex: 1;
|
|
64
|
+
width: 100%;
|
|
65
|
+
border: 0.0625rem solid ${base.palette['border-line']};
|
|
66
|
+
border-radius: ${base['border-radius']};
|
|
67
|
+
background: ${base.palette['primary-background']};
|
|
68
|
+
padding-inline: calc(${base.spacing} * 2);
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
background: ${hoverBackgroundColor};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
${layoutVariant === 'stacked' &&
|
|
75
|
+
css `
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
gap: calc(${base.spacing} * 2);
|
|
78
|
+
padding-block-start: calc(${base.spacing} * 4);
|
|
79
|
+
padding-block-end: calc(${base.spacing} * 3);
|
|
80
|
+
text-align: center;
|
|
81
|
+
min-height: 8rem;
|
|
82
|
+
`}
|
|
83
|
+
|
|
84
|
+
${layoutVariant === 'inline' &&
|
|
85
|
+
css `
|
|
86
|
+
flex-direction: row;
|
|
87
|
+
gap: calc(${base.spacing} * 1.5);
|
|
88
|
+
padding-block: calc(${base.spacing} * 1.5);
|
|
89
|
+
text-align: start;
|
|
90
|
+
`}
|
|
91
|
+
`;
|
|
92
|
+
});
|
|
93
|
+
StyledShortcutsCardButton.defaultProps = defaultThemeProp;
|
|
94
|
+
export const StyledShortcutsCardIcon = styled(Icon)(({ layoutVariant }) => css `
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
|
|
97
|
+
${layoutVariant === 'stacked' &&
|
|
98
|
+
css `
|
|
99
|
+
width: 3rem;
|
|
100
|
+
height: 3rem;
|
|
101
|
+
`}
|
|
102
|
+
`);
|
|
103
|
+
StyledShortcutsCardIcon.defaultProps = defaultThemeProp;
|
|
104
|
+
export const StyledLabelRow = styled.span(({ theme: { base } }) => css `
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: calc(${base.spacing} * 0.5);
|
|
108
|
+
`);
|
|
109
|
+
StyledLabelRow.defaultProps = defaultThemeProp;
|
|
110
|
+
export const StyledExternalIcon = styled(Icon) `
|
|
111
|
+
flex-shrink: 0;
|
|
112
|
+
`;
|
|
113
|
+
StyledExternalIcon.defaultProps = defaultThemeProp;
|
|
114
|
+
//# sourceMappingURL=Shortcuts.styles.js.map
|
|
@@ -0,0 +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;AAEzF,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,EAAE,CAGnD,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE;IACrD,OAAO,GAAG,CAAA;;;WAGD,IAAI,CAAC,OAAO;;eAER,IAAI,CAAC,OAAO;;;MAGrB,cAAc;QAChB,GAAG,CAAA;;+BAEwB,UAAU;YACjC,CAAC,CAAC,uCAAuC;YACzC,CAAC,CAAC,wCAAwC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CAAC;IAEF,OAAO,GAAG,CAAA;;;;;;8BAMkB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;qBACpC,IAAI,CAAC,eAAe,CAAC;kBACxB,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;2BACzB,IAAI,CAAC,OAAO;;;oBAGnB,oBAAoB;;;MAGlC,aAAa,KAAK,SAAS;QAC7B,GAAG,CAAA;;kBAEW,IAAI,CAAC,OAAO;kCACI,IAAI,CAAC,OAAO;gCACd,IAAI,CAAC,OAAO;;;KAGvC;;MAEC,aAAa,KAAK,QAAQ;QAC5B,GAAG,CAAA;;kBAEW,IAAI,CAAC,OAAO;4BACF,IAAI,CAAC,OAAO;;KAEnC;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,CAAC,CACjD,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;MAGtB,aAAa,KAAK,SAAS;IAC7B,GAAG,CAAA;;;KAGF;GACF,CACF,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CACvC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;gBAGd,IAAI,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","sourcesContent":["import styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { Button, defaultThemeProp, Icon, Text, tryCatch } from '@pega/cosmos-react-core';\n\nexport const StyledShortcutsCardsContainer = styled.ul<{\n isSmallOrAbove: boolean;\n showHeader: boolean;\n}>(({ theme: { base }, isSmallOrAbove, showHeader }) => {\n return css`\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: ${base.spacing};\n list-style: none;\n padding: ${base.spacing} 0;\n margin: 0;\n\n ${isSmallOrAbove &&\n css`\n grid-auto-rows: 1fr;\n grid-template-columns: ${showHeader\n ? 'repeat(auto-fill, minmax(14rem, 1fr))'\n : 'repeat(auto-fit, minmax(14rem, 14rem))'};\n justify-content: ${showHeader ? 'start' : 'center'};\n align-items: stretch;\n width: 100%;\n `}\n `;\n});\n\nStyledShortcutsCardsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCategoriesContainer = styled.div<{ isSmallOrAbove: boolean }>(\n ({ theme: { base }, isSmallOrAbove }) => {\n return css`\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: calc(${base.spacing} * 2);\n width: 100%;\n\n ${isSmallOrAbove &&\n css`\n grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));\n align-items: start;\n `}\n\n ${!isSmallOrAbove &&\n css`\n padding-inline: calc(${base.spacing} * 0.5);\n padding-block: ${base.spacing};\n `}\n `;\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 StyledShortcutsCardButton = styled(Button)<{ layoutVariant: 'stacked' | 'inline' }>(({\n theme: { base, components },\n layoutVariant\n}) => {\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 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\n &:hover {\n background: ${hoverBackgroundColor};\n }\n\n ${layoutVariant === 'stacked' &&\n css`\n flex-direction: column;\n gap: calc(${base.spacing} * 2);\n padding-block-start: calc(${base.spacing} * 4);\n padding-block-end: calc(${base.spacing} * 3);\n text-align: center;\n min-height: 8rem;\n `}\n\n ${layoutVariant === 'inline' &&\n css`\n flex-direction: row;\n gap: calc(${base.spacing} * 1.5);\n padding-block: calc(${base.spacing} * 1.5);\n text-align: start;\n `}\n `;\n});\n\nStyledShortcutsCardButton.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCardIcon = styled(Icon)<{ layoutVariant: 'stacked' | 'inline' }>(\n ({ layoutVariant }) => css`\n flex-shrink: 0;\n\n ${layoutVariant === 'stacked' &&\n css`\n width: 3rem;\n height: 3rem;\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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const getShortcutsTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["list", "emptyState", "categorySection", "categoryHeading"]>;
|
|
2
|
+
//# sourceMappingURL=Shortcuts.test-ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shortcuts.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,iMAKrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shortcuts.test-ids.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,WAAW,EAAE;IAC5D,MAAM;IACN,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;CACT,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getShortcutsTestIds = createTestIds('shortcuts', [\n 'list',\n 'emptyState',\n 'categorySection',\n 'categoryHeading'\n] as const);\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
2
|
+
import type { NoChildrenProp, TestIdProp } from '@pega/cosmos-react-core';
|
|
3
|
+
interface ShortcutItemBase {
|
|
4
|
+
/** Unique identifier for this shortcut. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Display label shown on the shortcut. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Icon name from the registered icon set. */
|
|
9
|
+
icon: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ShortcutLinkItem extends ShortcutItemBase {
|
|
12
|
+
/** Discriminant — this item navigates to an external URL. */
|
|
13
|
+
type: 'external';
|
|
14
|
+
/** Absolute URL the link navigates to. Opens in a new tab. */
|
|
15
|
+
href: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ShortcutNavItem extends ShortcutItemBase {
|
|
18
|
+
/** Discriminant — this item navigates to a portal landing page. */
|
|
19
|
+
type: 'page';
|
|
20
|
+
/** Callback invoked when the user activates this shortcut. */
|
|
21
|
+
onClick: () => void;
|
|
22
|
+
}
|
|
23
|
+
export type ShortcutItem = ShortcutLinkItem | ShortcutNavItem;
|
|
24
|
+
export interface ShortcutCategory {
|
|
25
|
+
/** Unique identifier for this category. */
|
|
26
|
+
id: string;
|
|
27
|
+
/** Display label shown as the category heading. */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Shortcut items belonging to this category. */
|
|
30
|
+
items: ShortcutItem[];
|
|
31
|
+
}
|
|
32
|
+
interface ShortcutsWithItems {
|
|
33
|
+
/** Shortcut items to render as cards. */
|
|
34
|
+
items?: ShortcutItem[];
|
|
35
|
+
categories?: never;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to render the outer card shell with a heading.
|
|
38
|
+
* When `false`, only the card grid is rendered, centered within its container.
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
showHeader?: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface ShortcutsWithCategories {
|
|
44
|
+
items?: never;
|
|
45
|
+
/** Grouped shortcut items, each rendered as cards under a category heading. */
|
|
46
|
+
categories: ShortcutCategory[];
|
|
47
|
+
showHeader?: never;
|
|
48
|
+
}
|
|
49
|
+
interface ShortcutsBaseProps extends NoChildrenProp, TestIdProp {
|
|
50
|
+
/** Heading displayed above the shortcuts. */
|
|
51
|
+
heading?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Controls the layout variant of each shortcut card.
|
|
54
|
+
* - `stacked`: large icon above the label (default card style).
|
|
55
|
+
* - `inline`: small icon inline to the left of the label (list/link style).
|
|
56
|
+
* @default 'inline'
|
|
57
|
+
*/
|
|
58
|
+
variant?: 'stacked' | 'inline';
|
|
59
|
+
/** Ref for the root card element. */
|
|
60
|
+
ref?: Ref<HTMLDivElement>;
|
|
61
|
+
}
|
|
62
|
+
export type ShortcutsProps = ShortcutsBaseProps & (ShortcutsWithItems | ShortcutsWithCategories);
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=Shortcuts.types.d.ts.map
|
|
@@ -0,0 +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,OA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C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,CAAC,kBAAkB,GAAG,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,YAAY,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EACjB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { default } from './Shortcuts';\nexport type {\n ShortcutsProps,\n ShortcutItem,\n ShortcutLinkItem,\n ShortcutNavItem,\n ShortcutCategory\n} from './Shortcuts.types';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stages.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stages.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,+BAA+B,EAAgB,MAAM,yBAAyB,CAAC;AAG7F,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAe/D,QAAA,MAAM,MAAM,EAAE,+BAA+B,CAAC,WAAW,CAwOvD,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';
|
|
3
3
|
import { remToPx } from 'polished';
|
|
4
|
-
import { Icon, registerIcon, Flex, useI18n, Button, Modal, useBreakpoint, debounce, useModalManager, useConsolidatedRef, useUID, InfoDialog, useArrows, useAfterInitialEffect, VisuallyHiddenText } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Icon, registerIcon, Flex, useI18n, Button, Modal, useBreakpoint, debounce, useModalManager, useConsolidatedRef, useUID, InfoDialog, useArrows, useDirection, useAfterInitialEffect, VisuallyHiddenText, tryCatch } from '@pega/cosmos-react-core';
|
|
5
5
|
import * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';
|
|
6
6
|
import StageGlimpse from './StageGlimpse';
|
|
7
7
|
import { StyledInnerStage, StyledStageCompleteIcon, StyledStage, StyledStageContainer, StyledStageGlimpse, StyledStages, StyledStagesDescription, StyledStageText } from './Stages.styles';
|
|
8
8
|
registerIcon(checkIcon);
|
|
9
|
-
const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadStage, ...restProps }, ref) {
|
|
9
|
+
const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadStage, readOnly = false, ...restProps }, ref) {
|
|
10
10
|
const t = useI18n();
|
|
11
11
|
const stagesRef = useConsolidatedRef(ref);
|
|
12
|
-
const stagesRefs = useRef(
|
|
12
|
+
const stagesRefs = useRef(new Map());
|
|
13
13
|
const [target, setTarget] = useState(null);
|
|
14
|
+
const [targetStageId, setTargetStageId] = useState(null);
|
|
14
15
|
const { create: createModal } = useModalManager();
|
|
15
16
|
const modalMethods = useRef();
|
|
16
17
|
const [showModal, setShowModal] = useState(false);
|
|
17
18
|
const isSmallOrAbove = useBreakpoint('sm');
|
|
18
19
|
const [compressedView, setCompressedView] = useState(false);
|
|
19
20
|
const [minExpandedWidth, setMinExpandedWidth] = useState(0);
|
|
21
|
+
const { rtl } = useDirection();
|
|
20
22
|
useArrows(stagesRef, {
|
|
23
|
+
cycle: false,
|
|
21
24
|
selector: ':scope > li > button:not([aria-expanded])',
|
|
22
25
|
dir: 'left-right',
|
|
23
|
-
initialFocusElement: stagesRefs.current.
|
|
26
|
+
initialFocusElement: stagesRefs.current.get(current) ?? null
|
|
24
27
|
});
|
|
25
28
|
const dialogId = useUID();
|
|
26
29
|
const descriptionId = useUID();
|
|
@@ -43,7 +46,7 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
|
|
|
43
46
|
}
|
|
44
47
|
}, {
|
|
45
48
|
root: stagesRef.current,
|
|
46
|
-
rootMargin: remToPx(0.0625),
|
|
49
|
+
rootMargin: tryCatch(() => remToPx(0.0625), () => '1px'),
|
|
47
50
|
threshold: 1
|
|
48
51
|
});
|
|
49
52
|
if (stagesRef.current.lastElementChild) {
|
|
@@ -55,6 +58,7 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
|
|
|
55
58
|
const stagesToLoad = onLoadStage
|
|
56
59
|
? stages.filter(stage => !Array.isArray(stage.steps)).map(stage => stage.id)
|
|
57
60
|
: [];
|
|
61
|
+
const renderModalStages = () => stages.map(stage => (_jsxs(Fragment, { children: [_jsxs(Flex, { container: { alignItems: 'start', gap: 0.5 }, children: [stage.completed && _jsx(StyledStageCompleteIcon, { name: 'check' }), _jsxs(StyledStageText, { variant: 'h3', isCurrent: stage.id === current, children: [stage.name, stage.completed && _jsx(VisuallyHiddenText, { children: `- ${t('completed')}` })] })] }), _jsx(StageGlimpse, { stage: stage })] }, stage.id)));
|
|
58
62
|
const openModal = () => {
|
|
59
63
|
setShowModal(true);
|
|
60
64
|
if (stagesToLoad.length > 0)
|
|
@@ -64,11 +68,12 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
|
|
|
64
68
|
? t('stages_case_lifecycle', [caseTitle])
|
|
65
69
|
: t('stages_default_case_lifecycle'),
|
|
66
70
|
progress: stagesToLoad.length > 0,
|
|
67
|
-
children:
|
|
71
|
+
children: renderModalStages(),
|
|
68
72
|
onBeforeClose: () => {
|
|
69
73
|
setShowModal(false);
|
|
70
74
|
target?.focus();
|
|
71
75
|
setTarget(null);
|
|
76
|
+
setTargetStageId(null);
|
|
72
77
|
modalMethods.current = undefined;
|
|
73
78
|
}
|
|
74
79
|
});
|
|
@@ -76,10 +81,10 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
|
|
|
76
81
|
useAfterInitialEffect(() => {
|
|
77
82
|
modalMethods.current?.update({
|
|
78
83
|
progress: stagesToLoad.length > 0,
|
|
79
|
-
children:
|
|
84
|
+
children: renderModalStages()
|
|
80
85
|
});
|
|
81
86
|
}, [stagesToLoad.length]);
|
|
82
|
-
return (_jsxs(_Fragment, { children: [_jsx(Flex, { ...restProps, container: true, as: StyledStages, ref: stagesRef, "aria-label": t('stages_label'), "aria-describedby": descriptionId, children: stages.map((stage, index) => {
|
|
87
|
+
return (_jsxs(_Fragment, { children: [_jsx(Flex, { ...restProps, container: true, as: StyledStages, ref: stagesRef, dir: rtl ? 'rtl' : 'ltr', "aria-label": t('stages_label'), "aria-describedby": descriptionId, children: stages.map((stage, index) => {
|
|
83
88
|
const isCurrent = stage.id === current;
|
|
84
89
|
let stageStatusText = t(stage.completed ? 'completed' : 'not_started');
|
|
85
90
|
if (isCurrent)
|
|
@@ -95,22 +100,42 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
|
|
|
95
100
|
else {
|
|
96
101
|
stageStatus = 'pending';
|
|
97
102
|
}
|
|
98
|
-
return (_jsxs(Fragment, { children: [_jsx(Flex, { as: StyledStageContainer, item: { grow: 1, shrink: 0 }, children: _jsxs(Flex, { container: { justify: 'center', alignItems: 'center' }, as: StyledStage, item: {
|
|
103
|
+
return (_jsxs(Fragment, { children: [_jsx(Flex, { as: StyledStageContainer, item: { grow: 1, shrink: 0 }, readOnly: readOnly, children: _jsxs(Flex, { container: { justify: 'center', alignItems: 'center' }, as: StyledStage, item: {
|
|
99
104
|
grow: compressedView && !isCurrent ? 0 : 1,
|
|
100
105
|
shrink: compressedView && isCurrent ? 1 : 0
|
|
101
|
-
}, status: stageStatus, "aria-current": isCurrent ? 'step' : undefined, "aria-label": t('stages_stage_label', [stage.name, stageStatusText]), onClick: (e) => {
|
|
106
|
+
}, status: stageStatus, readOnly: readOnly, "aria-current": isCurrent ? 'step' : undefined, "aria-label": t('stages_stage_label', [stage.name, stageStatusText]), onClick: (e) => {
|
|
102
107
|
if (isSmallOrAbove) {
|
|
103
108
|
if (hasToLoad)
|
|
104
109
|
onLoadStage?.([stage.id]);
|
|
105
110
|
setTarget(e.currentTarget);
|
|
111
|
+
setTargetStageId(stage.id);
|
|
106
112
|
}
|
|
107
113
|
else {
|
|
108
114
|
openModal();
|
|
109
115
|
}
|
|
110
116
|
}, ref: (el) => {
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
if (el) {
|
|
118
|
+
stagesRefs.current.set(stage.id, el);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
stagesRefs.current.delete(stage.id);
|
|
122
|
+
}
|
|
123
|
+
}, "aria-expanded": target && isSmallOrAbove, "aria-controls": target ? dialogId : undefined, ...(!readOnly && {
|
|
124
|
+
'aria-haspopup': true,
|
|
125
|
+
onClick: (e) => {
|
|
126
|
+
if (isSmallOrAbove) {
|
|
127
|
+
if (hasToLoad)
|
|
128
|
+
onLoadStage?.([stage.id]);
|
|
129
|
+
setTarget(e.currentTarget);
|
|
130
|
+
setTargetStageId(stage.id);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
openModal();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}), children: [stage.completed && _jsx(Icon, { name: 'check' }), (!compressedView || isCurrent || !stage.completed) && (_jsx(StyledInnerStage, { ellipsis: isCurrent && compressedView, children: !isCurrent && compressedView ? index + 1 : stage.name }))] }) }), target && targetStageId === stage.id && isSmallOrAbove && !showModal && (_jsx(InfoDialog, { heading: stage.name, target: target, progress: hasToLoad ? t('loading') : undefined, onDismiss: () => {
|
|
113
137
|
setTarget(null);
|
|
138
|
+
setTargetStageId(null);
|
|
114
139
|
}, placement: 'bottom-start', children: !hasToLoad && (_jsxs(StyledStageGlimpse, { children: [_jsx(StageGlimpse, { stage: stage }), _jsx(Button, { variant: 'secondary', onClick: openModal, children: t('stages_see_full_lifecycle') })] })) }))] }, stage.id));
|
|
115
140
|
}) }), _jsx(StyledStagesDescription, { id: descriptionId, children: t('stages_description') })] }));
|
|
116
141
|
});
|
|
@@ -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;AAE1E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,aAAa,EACb,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAG1F,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,uBAAuB,EACvB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,CAAC,SAAS,CAAC,CAAC;AAExB,MAAM,MAAM,GAAiD,UAAU,CAAC,SAAS,MAAM,CACrF,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,SAAS,EAAgC,EACvF,GAAuB;IAEvB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,SAAS,GAAG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,eAAe,MAAM,CAAC","sourcesContent":["import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';\nimport type { MouseEvent, PropsWithoutRef } from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Icon,\n registerIcon,\n Flex,\n useI18n,\n Button,\n Modal,\n useBreakpoint,\n debounce,\n useModalManager,\n useConsolidatedRef,\n useUID,\n InfoDialog,\n useArrows,\n useAfterInitialEffect,\n VisuallyHiddenText\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 StageGlimpse from './StageGlimpse';\nimport {\n StyledInnerStage,\n StyledStageCompleteIcon,\n StyledStage,\n StyledStageContainer,\n StyledStageGlimpse,\n StyledStages,\n StyledStagesDescription,\n StyledStageText\n} from './Stages.styles';\n\nregisterIcon(checkIcon);\n\nconst Stages: ForwardRefForwardPropsComponent<StagesProps> = forwardRef(function Stages(\n { current, stages, caseTitle, onLoadStage, ...restProps }: PropsWithoutRef<StagesProps>,\n ref: StagesProps['ref']\n) {\n const t = useI18n();\n\n const stagesRef = useConsolidatedRef(ref);\n const stagesRefs = useRef<HTMLButtonElement[]>([]);\n\n const [target, setTarget] = 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 const [compressedView, setCompressedView] = useState(false);\n const [minExpandedWidth, setMinExpandedWidth] = useState(0);\n\n useArrows(stagesRef, {\n selector: ':scope > li > button:not([aria-expanded])',\n dir: 'left-right',\n initialFocusElement: stagesRefs.current.find(stage => stage.ariaCurrent)\n });\n\n const dialogId = useUID();\n const descriptionId = useUID();\n\n useEffect(() => {\n if (stagesRef.current) {\n if (compressedView) {\n const resizeObserver = new ResizeObserver(\n debounce((entries: ResizeObserverEntry[]) => {\n if (entries[0].contentRect.width > minExpandedWidth) {\n setCompressedView(false);\n }\n }, 100)\n );\n resizeObserver.observe(stagesRef.current);\n return () => resizeObserver.disconnect();\n }\n\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (!entries[0].isIntersecting) {\n setCompressedView(true);\n if (entries[0].rootBounds) setMinExpandedWidth(entries[0].rootBounds.width);\n }\n },\n {\n root: stagesRef.current,\n rootMargin: remToPx(0.0625),\n threshold: 1\n }\n );\n\n if (stagesRef.current.lastElementChild) {\n intersectionObserver.observe(stagesRef.current.lastElementChild);\n return () => intersectionObserver.disconnect();\n }\n }\n }, [minExpandedWidth, compressedView, stages.length]);\n\n const stagesToLoad = onLoadStage\n ? stages.filter(stage => !Array.isArray(stage.steps)).map(stage => stage.id)\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: 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='h2' 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 onBeforeClose: () => {\n setShowModal(false);\n target?.focus();\n setTarget(null);\n modalMethods.current = undefined;\n }\n });\n };\n\n useAfterInitialEffect(() => {\n modalMethods.current?.update({\n progress: stagesToLoad.length > 0,\n children: 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='h2' 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 }, [stagesToLoad.length]);\n\n return (\n <>\n <Flex\n {...restProps}\n container\n as={StyledStages}\n ref={stagesRef}\n aria-label={t('stages_label')}\n aria-describedby={descriptionId}\n >\n {stages.map((stage, index) => {\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 }}>\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledStage}\n item={{\n grow: compressedView && !isCurrent ? 0 : 1,\n shrink: compressedView && isCurrent ? 1 : 0\n }}\n status={stageStatus}\n aria-current={isCurrent ? 'step' : undefined}\n aria-label={t('stages_stage_label', [stage.name, stageStatusText])}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n if (isSmallOrAbove) {\n if (hasToLoad) onLoadStage?.([stage.id]);\n setTarget(e.currentTarget);\n } else {\n openModal();\n }\n }}\n ref={(el: HTMLButtonElement) => {\n stagesRefs.current[index] = el;\n }}\n aria-expanded={target && isSmallOrAbove}\n aria-controls={target ? dialogId : undefined}\n aria-haspopup\n >\n {stage.completed && <Icon name='check' />}\n {(!compressedView || isCurrent || !stage.completed) && (\n <StyledInnerStage ellipsis={isCurrent && compressedView}>\n {!isCurrent && compressedView ? index + 1 : stage.name}\n </StyledInnerStage>\n )}\n </Flex>\n </Flex>\n {target && stagesRefs.current[index] === target && isSmallOrAbove && !showModal && (\n <InfoDialog\n heading={stage.name}\n target={target}\n progress={hasToLoad ? t('loading') : undefined}\n onDismiss={() => {\n setTarget(null);\n }}\n placement='bottom-start'\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 </Flex>\n <StyledStagesDescription id={descriptionId}>\n {t('stages_description')}\n </StyledStagesDescription>\n </>\n );\n});\n\nexport default Stages;\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;AAE1E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,aAAa,EACb,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,SAAS,EACT,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAG1F,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,uBAAuB,EACvB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,CAAC,SAAS,CAAC,CAAC;AAExB,MAAM,MAAM,GAAiD,UAAU,CAAC,SAAS,MAAM,CACrF,EACE,OAAO,EACP,MAAM,EACN,SAAS,EACT,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,GAAG,SAAS,EACiB,EAC/B,GAAuB;IAEvB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAE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AC,CAAC,CAAC,CAAC,SAAS,EAC9C,SAAS,EAAE,GAAG,EAAE;oCACd,SAAS,CAAC,IAAI,CAAC,CAAC;oCAChB,gBAAgB,CAAC,IAAI,CAAC,CAAC;gCACzB,CAAC,EACD,SAAS,EAAC,cAAc,YAEvB,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,KAxEY,KAAK,CAAC,EAAE,CAyEZ,CACZ,CAAC;gBACJ,CAAC,CAAC,GACG,EACP,KAAC,uBAAuB,IAAC,EAAE,EAAE,aAAa,YACvC,CAAC,CAAC,oBAAoB,CAAC,GACA,IACzB,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC","sourcesContent":["import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';\nimport type { MouseEvent, PropsWithoutRef } from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Icon,\n registerIcon,\n Flex,\n useI18n,\n Button,\n Modal,\n useBreakpoint,\n debounce,\n useModalManager,\n useConsolidatedRef,\n useUID,\n InfoDialog,\n useArrows,\n useDirection,\n useAfterInitialEffect,\n VisuallyHiddenText,\n tryCatch\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 StageGlimpse from './StageGlimpse';\nimport {\n StyledInnerStage,\n StyledStageCompleteIcon,\n StyledStage,\n StyledStageContainer,\n StyledStageGlimpse,\n StyledStages,\n StyledStagesDescription,\n StyledStageText\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 ...restProps\n }: PropsWithoutRef<StagesProps>,\n ref: StagesProps['ref']\n) {\n const t = useI18n();\n\n const stagesRef = useConsolidatedRef(ref);\n const stagesRefs = useRef<Map<string, HTMLButtonElement>>(new Map());\n\n const [target, setTarget] = useState<HTMLButtonElement | null>(null);\n const [targetStageId, setTargetStageId] = useState<string | 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 const [compressedView, setCompressedView] = useState(false);\n const [minExpandedWidth, setMinExpandedWidth] = useState(0);\n\n const { rtl } = useDirection();\n\n useArrows(stagesRef, {\n cycle: false,\n selector: ':scope > li > button:not([aria-expanded])',\n dir: 'left-right',\n initialFocusElement: stagesRefs.current.get(current) ?? null\n });\n\n const dialogId = useUID();\n const descriptionId = useUID();\n\n useEffect(() => {\n if (stagesRef.current) {\n if (compressedView) {\n const resizeObserver = new ResizeObserver(\n debounce((entries: ResizeObserverEntry[]) => {\n if (entries[0].contentRect.width > minExpandedWidth) {\n setCompressedView(false);\n }\n }, 100)\n );\n resizeObserver.observe(stagesRef.current);\n return () => resizeObserver.disconnect();\n }\n\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (!entries[0].isIntersecting) {\n setCompressedView(true);\n if (entries[0].rootBounds) setMinExpandedWidth(entries[0].rootBounds.width);\n }\n },\n {\n root: stagesRef.current,\n rootMargin: tryCatch(\n () => remToPx(0.0625),\n () => '1px'\n ),\n threshold: 1\n }\n );\n\n if (stagesRef.current.lastElementChild) {\n intersectionObserver.observe(stagesRef.current.lastElementChild);\n return () => intersectionObserver.disconnect();\n }\n }\n }, [minExpandedWidth, compressedView, stages.length]);\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 <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 {stages.map((stage, index) => {\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={{\n grow: compressedView && !isCurrent ? 0 : 1,\n shrink: compressedView && isCurrent ? 1 : 0\n }}\n status={stageStatus}\n readOnly={readOnly}\n aria-current={isCurrent ? 'step' : undefined}\n aria-label={t('stages_stage_label', [stage.name, stageStatusText])}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n if (isSmallOrAbove) {\n if (hasToLoad) onLoadStage?.([stage.id]);\n setTarget(e.currentTarget);\n setTargetStageId(stage.id);\n } else {\n openModal();\n }\n }}\n ref={(el: HTMLButtonElement | null) => {\n if (el) {\n stagesRefs.current.set(stage.id, el);\n } else {\n stagesRefs.current.delete(stage.id);\n }\n }}\n aria-expanded={target && isSmallOrAbove}\n aria-controls={target ? dialogId : undefined}\n {...(!readOnly && {\n 'aria-haspopup': true,\n onClick: (e: MouseEvent<HTMLButtonElement>) => {\n if (isSmallOrAbove) {\n if (hasToLoad) onLoadStage?.([stage.id]);\n setTarget(e.currentTarget);\n setTargetStageId(stage.id);\n } else {\n openModal();\n }\n }\n })}\n >\n {stage.completed && <Icon name='check' />}\n {(!compressedView || isCurrent || !stage.completed) && (\n <StyledInnerStage ellipsis={isCurrent && compressedView}>\n {!isCurrent && compressedView ? index + 1 : stage.name}\n </StyledInnerStage>\n )}\n </Flex>\n </Flex>\n {target && targetStageId === stage.id && isSmallOrAbove && !showModal && (\n <InfoDialog\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-start'\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 </Flex>\n <StyledStagesDescription id={descriptionId}>\n {t('stages_description')}\n </StyledStagesDescription>\n </>\n );\n});\n\nexport default Stages;\n"]}
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
export declare const StyledStages: import("styled-components").
|
|
2
|
-
export declare const StyledInnerStage: import("styled-components").
|
|
1
|
+
export declare const StyledStages: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, never>> & string;
|
|
2
|
+
export declare const StyledInnerStage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
3
3
|
ellipsis?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare const StyledStage: import("styled-components").
|
|
4
|
+
}>> & string;
|
|
5
|
+
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>, {
|
|
6
6
|
status: "completed" | "current" | "pending";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare const
|
|
7
|
+
readOnly?: boolean;
|
|
8
|
+
}>> & string;
|
|
9
|
+
export declare const StyledStageCompleteIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("@pega/cosmos-react-core").IconProps & import("styled-components/dist/types").BaseObject, import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("@pega/cosmos-react-core").IconProps>, keyof import("react").Component<any, {}, any>>;
|
|
10
|
+
export declare const StyledStageText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("@pega/cosmos-react-core").TextProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement | HTMLSpanElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
|
|
11
|
+
ref?: ((instance: HTMLHeadingElement | HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLHeadingElement | HTMLSpanElement> | null | undefined;
|
|
12
|
+
}, {
|
|
10
13
|
isCurrent?: boolean;
|
|
11
|
-
},
|
|
12
|
-
export declare const StyledStageContainer: import("styled-components").
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
}>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").TextProps>, keyof import("react").Component<any, {}, any>>;
|
|
15
|
+
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>, {
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
}>> & string;
|
|
18
|
+
export declare const StyledStepsContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, never>> & string;
|
|
19
|
+
export declare const StyledStep: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {
|
|
15
20
|
completed: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare const StyledDateTimeDisplay: import("styled-components").
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
}>> & string;
|
|
22
|
+
export declare const StyledDateTimeDisplay: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("@pega/cosmos-react-core").DateTimeDisplayProps, "ref"> & import("react").RefAttributes<HTMLSpanElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
|
|
23
|
+
ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
24
|
+
}, never>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").DateTimeDisplayProps>, keyof import("react").Component<any, {}, any>>;
|
|
25
|
+
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;
|
|
26
|
+
export declare const StyledStagesDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
20
27
|
//# sourceMappingURL=Stages.styles.d.ts.map
|
|
@@ -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":"AAqHA,eAAO,MAAM,YAAY,mOAgBvB,CAAC;AAIH,eAAO,MAAM,gBAAgB;eAA4B,OAAO;YAW9D,CAAC;AAIH,eAAO,MAAM,WAAW;YACd,WAAW,GAAG,SAAS,GAAG,SAAS;eAChC,OAAO;YAwGnB,CAAC;AAIF,eAAO,MAAM,uBAAuB,kaAiBlC,CAAC;AAGH,eAAO,MAAM,eAAe;;;gBAA8B,OAAO;kLAIhE,CAAC;AAIF,eAAO,MAAM,oBAAoB;eACpB,OAAO;YAqLnB,CAAC;AAIF,eAAO,MAAM,oBAAoB,mOAS/B,CAAC;AAIH,eAAO,MAAM,UAAU;eAA0B,OAAO;YAoBtD,CAAC;AAIH,eAAO,MAAM,qBAAqB;;oMAMhC,CAAC;AAIH,eAAO,MAAM,kBAAkB,6NAI7B,CAAC;AAIH,eAAO,MAAM,uBAAuB,yOAEnC,CAAC"}
|