@pega/cosmos-react-work 8.0.0-build.4.3 → 8.0.0-build.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +8 -4
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js +6 -4
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/Article/Article.d.ts +2 -6
- package/lib/components/Article/Article.d.ts.map +1 -1
- package/lib/components/Article/Article.js +2 -7
- package/lib/components/Article/Article.js.map +1 -1
- package/lib/components/Article/ArticleMeta.js.map +1 -1
- package/lib/components/ArticleList/AIArticleSummary.d.ts +1 -2
- package/lib/components/ArticleList/AIArticleSummary.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddy.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddy.js +6 -2
- package/lib/components/ArticleList/ArticleBuddy.js.map +1 -1
- package/lib/components/ArticleList/ArticleBuddyList.d.ts +0 -1
- package/lib/components/ArticleList/ArticleBuddyList.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddyResponse.d.ts +3 -3
- package/lib/components/ArticleList/ArticleBuddyResponse.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddyResponse.js +7 -8
- package/lib/components/ArticleList/ArticleBuddyResponse.js.map +1 -1
- package/lib/components/ArticleList/ArticleFeedback.d.ts +1 -2
- package/lib/components/ArticleList/ArticleFeedback.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleFeedback.js.map +1 -1
- package/lib/components/ArticleList/ArticleList.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleList.js +4 -4
- package/lib/components/ArticleList/ArticleList.js.map +1 -1
- package/lib/components/ArticleList/ArticleList.types.d.ts +9 -5
- 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/ArticleListFilter.js.map +1 -1
- package/lib/components/ArticleList/ArticleListHeader.d.ts +1 -1
- package/lib/components/ArticleList/ArticleListHeader.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleListHeader.js +9 -6
- package/lib/components/ArticleList/ArticleListHeader.js.map +1 -1
- package/lib/components/ArticleList/ArticleSemanticSearch.d.ts +0 -1
- package/lib/components/ArticleList/ArticleSemanticSearch.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleSemanticSearch.js +11 -4
- package/lib/components/ArticleList/ArticleSemanticSearch.js.map +1 -1
- package/lib/components/ArticleList/ArticleSummaryHeader.js +1 -1
- package/lib/components/ArticleList/ArticleSummaryHeader.js.map +1 -1
- package/lib/components/ArticleList/ArticleTag.d.ts +0 -1
- package/lib/components/ArticleList/ArticleTag.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleTag.js +3 -3
- package/lib/components/ArticleList/ArticleTag.js.map +1 -1
- package/lib/components/ArticleList/QuestionList.d.ts +1 -2
- package/lib/components/ArticleList/QuestionList.d.ts.map +1 -1
- package/lib/components/ArticleList/QuestionList.js +1 -1
- package/lib/components/ArticleList/QuestionList.js.map +1 -1
- package/lib/components/ArticleList/RelatedQuestions.d.ts +19 -0
- package/lib/components/ArticleList/RelatedQuestions.d.ts.map +1 -0
- package/lib/components/ArticleList/RelatedQuestions.js +40 -0
- package/lib/components/ArticleList/RelatedQuestions.js.map +1 -0
- package/lib/components/ArticleList/index.d.ts +1 -0
- package/lib/components/ArticleList/index.d.ts.map +1 -1
- package/lib/components/ArticleList/index.js +1 -0
- package/lib/components/ArticleList/index.js.map +1 -1
- package/lib/components/Assignments/Assignments.js +2 -2
- package/lib/components/Assignments/Assignments.js.map +1 -1
- package/lib/components/Assignments/Assignments.styles.d.ts +3 -4
- package/lib/components/Assignments/Assignments.styles.d.ts.map +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.d.ts +6 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.d.ts.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.js +24 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.js.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.d.ts +6 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.d.ts.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.js +51 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.js.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.d.ts +2 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.d.ts.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.js +6 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.js.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.types.d.ts +23 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.types.d.ts.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.types.js +2 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.types.js.map +1 -0
- package/lib/components/CaseHierarchy/index.d.ts +4 -0
- package/lib/components/CaseHierarchy/index.d.ts.map +1 -0
- package/lib/components/CaseHierarchy/index.js +3 -0
- package/lib/components/CaseHierarchy/index.js.map +1 -0
- package/lib/components/CasePreview/CasePreview.d.ts +4 -4
- package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
- package/lib/components/CasePreview/CasePreview.js +7 -6
- package/lib/components/CasePreview/CasePreview.js.map +1 -1
- package/lib/components/CasePreview/CasePreview.test-ids.d.ts +1 -1
- package/lib/components/CasePreview/CasePreview.test-ids.d.ts.map +1 -1
- package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -1
- package/lib/components/CaseView/CaseHeader/CaseHeader.js +4 -3
- package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -1
- package/lib/components/CaseView/CaseHeader/Summary.d.ts +1 -1
- package/lib/components/CaseView/CaseHeader/Summary.d.ts.map +1 -1
- package/lib/components/CaseView/CaseHeader/Summary.js.map +1 -1
- package/lib/components/CaseView/CaseView.context.d.ts +0 -1
- package/lib/components/CaseView/CaseView.context.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.d.ts +1 -1
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +65 -24
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +19 -15
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +287 -110
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.test-ids.d.ts +1 -1
- package/lib/components/CaseView/CaseView.test-ids.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.types.d.ts +8 -2
- 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 -0
- package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.js +85 -19
- package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
- package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts +0 -1
- package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitySummaryItemDialog.js +1 -1
- package/lib/components/CaseView/UtilitySummaryItemDialog.js.map +1 -1
- package/lib/components/CaseView/index.d.ts +1 -1
- package/lib/components/CaseView/index.d.ts.map +1 -1
- package/lib/components/CaseView/index.js.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts +0 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.js.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts +0 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/LayoutCell.d.ts +1 -2
- package/lib/components/ConfigurableLayout/LayoutCell.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/LayoutCell.js.map +1 -1
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.js.map +1 -1
- package/lib/components/Confirmation/Confirmation.d.ts +3 -3
- package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/Details/Details.d.ts +6 -4
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +4 -4
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/Details.styles.d.ts +1 -1
- package/lib/components/Details/Details.styles.d.ts.map +1 -1
- package/lib/components/Details/Details.styles.js +17 -4
- 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/DetailsContext.d.ts +0 -1
- package/lib/components/Details/DetailsContext.d.ts.map +1 -1
- package/lib/components/GenAICoach/ConversationHistory.d.ts +5 -0
- package/lib/components/GenAICoach/ConversationHistory.d.ts.map +1 -0
- package/lib/components/GenAICoach/ConversationHistory.js +73 -0
- package/lib/components/GenAICoach/ConversationHistory.js.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.d.ts +1 -1
- package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.js +178 -140
- package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts +24 -14
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.js +106 -57
- package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts +2 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.js +9 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.d.ts +49 -8
- 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/GenAICoach.utils.d.ts +1 -1
- package/lib/components/GenAICoach/GenAICoach.utils.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAIMessage.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAIMessage.js +77 -13
- package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
- package/lib/components/GenAICoach/InitialSuggestedMessage.js +1 -1
- package/lib/components/GenAICoach/InitialSuggestedMessage.js.map +1 -1
- package/lib/components/GenAICoach/index.d.ts +1 -1
- package/lib/components/GenAICoach/index.d.ts.map +1 -1
- package/lib/components/GenAICoach/index.js.map +1 -1
- package/lib/components/Glimpse/Glimpse.d.ts +3 -3
- package/lib/components/Glimpse/Glimpse.d.ts.map +1 -1
- package/lib/components/Glimpse/Glimpse.js.map +1 -1
- package/lib/components/HierarchicalAssignments/AssignmentContext.d.ts +28 -0
- package/lib/components/HierarchicalAssignments/AssignmentContext.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentContext.js +14 -0
- package/lib/components/HierarchicalAssignments/AssignmentContext.js.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentDetail.d.ts +4 -2
- package/lib/components/HierarchicalAssignments/AssignmentDetail.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/AssignmentDetail.js +2 -2
- package/lib/components/HierarchicalAssignments/AssignmentDetail.js.map +1 -1
- package/lib/components/HierarchicalAssignments/AssignmentNode.d.ts +19 -0
- package/lib/components/HierarchicalAssignments/AssignmentNode.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentNode.js +33 -0
- package/lib/components/HierarchicalAssignments/AssignmentNode.js.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentTree.d.ts +15 -0
- package/lib/components/HierarchicalAssignments/AssignmentTree.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentTree.js +21 -0
- package/lib/components/HierarchicalAssignments/AssignmentTree.js.map +1 -0
- package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts +31 -31
- package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/Assignments.styles.js +85 -69
- package/lib/components/HierarchicalAssignments/Assignments.styles.js.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.d.ts +2 -3
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.js +117 -9
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.js.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.d.ts +3 -3
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.js +2 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.js.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts +12 -12
- 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/helpers.d.ts +23 -0
- package/lib/components/HierarchicalAssignments/helpers.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/helpers.js +167 -0
- package/lib/components/HierarchicalAssignments/helpers.js.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts +18 -0
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js +105 -0
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.d.ts +23 -0
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.js +105 -0
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.js.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/useNodeFocus.d.ts +23 -0
- package/lib/components/HierarchicalAssignments/nodeItems/useNodeFocus.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/useNodeFocus.js +42 -0
- package/lib/components/HierarchicalAssignments/nodeItems/useNodeFocus.js.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts +2 -3
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js +5 -2
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +2 -3
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +32 -21
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
- package/lib/components/InteractionNotification/CountdownButton.d.ts +3 -3
- package/lib/components/InteractionNotification/CountdownButton.d.ts.map +1 -1
- package/lib/components/InteractionNotification/CountdownButton.js +1 -1
- package/lib/components/InteractionNotification/CountdownButton.js.map +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.d.ts +3 -3
- package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.js +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.js.map +1 -1
- package/lib/components/Predictions/Predictions.d.ts +2 -3
- package/lib/components/Predictions/Predictions.d.ts.map +1 -1
- package/lib/components/Predictions/Predictions.js +1 -0
- package/lib/components/Predictions/Predictions.js.map +1 -1
- package/lib/components/SearchResults/ActiveFilter.d.ts +1 -2
- 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.map +1 -1
- package/lib/components/SearchResults/SearchResult.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.d.ts +2 -3
- package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.js +1 -2
- package/lib/components/SearchResults/SearchResults.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.styles.d.ts +1 -2
- package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -1
- package/lib/components/Stages/StageGlimpse.js +1 -1
- package/lib/components/Stages/StageGlimpse.js.map +1 -1
- package/lib/components/Stages/Stages.d.ts +2 -3
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +4 -1
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +7 -6
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +6 -10
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stakeholders/StakeholderForm.d.ts +1 -2
- package/lib/components/Stakeholders/StakeholderForm.d.ts.map +1 -1
- package/lib/components/Stakeholders/StakeholderForm.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.d.ts +2 -3
- package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.js +37 -26
- package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
- package/lib/components/Tags/Tags.d.ts +5 -5
- package/lib/components/Tags/Tags.d.ts.map +1 -1
- package/lib/components/Tags/Tags.js.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts +13 -8
- package/lib/components/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +15 -7
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/lib/components/Tasks/Tasks.d.ts +8 -3
- package/lib/components/Tasks/Tasks.d.ts.map +1 -1
- package/lib/components/Tasks/Tasks.js +14 -4
- package/lib/components/Tasks/Tasks.js.map +1 -1
- package/lib/components/Tasks/Tasks.test-ids.d.ts +3 -3
- package/lib/components/Tasks/Tasks.test-ids.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.d.ts +3 -3
- package/lib/components/Timeline/Timeline.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.js +9 -2
- package/lib/components/Timeline/Timeline.js.map +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts +5 -6
- package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.styles.js +10 -3
- package/lib/components/Timeline/Timeline.styles.js.map +1 -1
- package/lib/components/Timeline/Timeline.types.d.ts +11 -1
- package/lib/components/Timeline/Timeline.types.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.types.js.map +1 -1
- package/lib/components/Timeline/TimelineItem.d.ts +1 -2
- package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
- package/lib/components/Timeline/TimelineItem.js +10 -9
- package/lib/components/Timeline/TimelineItem.js.map +1 -1
- package/lib/components/Timeline/TimelineToolbar.d.ts +2 -3
- package/lib/components/Timeline/TimelineToolbar.d.ts.map +1 -1
- package/lib/components/Timeline/TimelineToolbar.js.map +1 -1
- package/lib/components/Timeline/utils.js.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.d.ts +5 -0
- package/lib/components/UtilitiesLayout/UtilitiesLayout.d.ts.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.js +3 -3
- package/lib/components/UtilitiesLayout/UtilitiesLayout.js.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts +2 -4
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js +2 -5
- 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 +10 -9
- package/lib/components/HierarchicalAssignments/AssignmentContainer.d.ts +0 -33
- package/lib/components/HierarchicalAssignments/AssignmentContainer.d.ts.map +0 -1
- package/lib/components/HierarchicalAssignments/AssignmentContainer.js +0 -46
- package/lib/components/HierarchicalAssignments/AssignmentContainer.js.map +0 -1
- package/lib/components/HierarchicalAssignments/AssignmentItem.d.ts +0 -11
- package/lib/components/HierarchicalAssignments/AssignmentItem.d.ts.map +0 -1
- package/lib/components/HierarchicalAssignments/AssignmentItem.js +0 -22
- package/lib/components/HierarchicalAssignments/AssignmentItem.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurableLayout.types.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfigurableLayout.types.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,WAAW,CAAC;AAEhD,2DAA2D;AAC3D,MAAM,WAAW,MAAM;IACrB,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC;IACrB,yBAAyB;IACzB,YAAY,EAAE;QACZ,8BAA8B;QAC9B,KAAK,EAAE,MAAM,OAAO,kBAAkB,CAAC;QACvC;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB;;;WAGG;QACH,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC;KAC1D,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,mDAAmD;IACnD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6BAA6B;IAC7B,WAAW,CAAC,EAAE;QACZ;;;;;;WAMG;QACH,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;QACjC,4FAA4F;QAC5F,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;CACH"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { Config } from './ConfigurableLayout.types';
|
|
3
2
|
declare const LayoutCell: ({ config }: {
|
|
4
3
|
config: Config;
|
|
5
|
-
}) => JSX.Element | null;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
5
|
export default LayoutCell;
|
|
7
6
|
//# sourceMappingURL=LayoutCell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutCell.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/LayoutCell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LayoutCell.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/LayoutCell.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAqDzD,QAAA,MAAM,UAAU,eAAgB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,mDAoCjD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutCell.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/LayoutCell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,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AAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC;QAEpC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,GAAG,KAAK,IAAI,CAAC;QACtB,CAAC;QAED,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACpB,KAAK,CAAC,MAAM,IAAI,CAAC;YACjB,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ;YAC5B,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAClC,CAAC;YACD,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAClC,CAAC;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CACvB,KAAC,IAAI,IACH,EAAE,EAAE,UAAU,EACd,IAAI,EAAE;YACJ,IAAI,EAAE,CAAC;SACR,EACD,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,EACtD,aAAa,EAAE,YAAY,CAAC,aAAa,EACzC,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,YAEjB,MAAM,CAAC,OAAO,GACV,CACR,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\n\nimport { Flex, defaultThemeProp } from '@pega/cosmos-react-core';\n\nimport { StyledAppAnnouncement } from '../AppAnnouncement/AppAnnouncement';\n\nimport type { Config } from './ConfigurableLayout.types';\nimport widthConfigOptions from './options';\nimport { itemMinWidth, cellGap } from './defaults';\n\nconst StyledCell = styled.div(\n ({\n fillAvailable = true,\n percentageWidth,\n minWidth,\n theme\n }: {\n fillAvailable: boolean;\n percentageWidth?: string;\n minWidth?: string | undefined;\n theme: DefaultTheme;\n }) => {\n return css`\n /* variables */\n --marginGap: calc(${cellGap} * ${theme.base.spacing});\n --totalMargin: calc(2 * var(--marginGap));\n --percentageBasis: calc(${percentageWidth} - var(--totalMargin));\n --maxWidth: calc(100% - var(--totalMargin));\n\n /* styles */\n flex-wrap: wrap;\n flex-basis: var(--percentageBasis);\n min-width: min(var(--maxWidth), ${minWidth || itemMinWidth});\n max-width: var(--maxWidth);\n margin-block-end: var(--totalMargin);\n margin-inline: var(--marginGap);\n\n ${!fillAvailable &&\n css`\n flex-grow: 0;\n `}\n\n ${StyledAppAnnouncement} {\n align-self: stretch;\n }\n\n > *,\n > [data-config-root] > * {\n width: 100%;\n height: auto;\n overflow-x: auto;\n }\n `;\n }\n);\nStyledCell.defaultProps = defaultThemeProp;\n\nconst validWidthUnits = ['px', 'ch', 'rem', 'em'];\n\nconst LayoutCell = ({ config }: { config: Config }) => {\n const layoutConfig = useMemo(() => config.layoutConfig, [config]);\n const percentageWidth = useMemo(() => {\n return widthConfigOptions[layoutConfig.width as keyof typeof widthConfigOptions] || '100%';\n }, [layoutConfig.width]);\n const minWidth = useMemo(() => {\n const value = layoutConfig.minWidth;\n\n if (typeof value === 'number') {\n return `${value}px`;\n }\n\n if (\n Array.isArray(value) &&\n value.length >= 2 &&\n typeof value[0] === 'number' &&\n validWidthUnits.includes(value[1])\n ) {\n return `${value[0]}${value[1]}`;\n }\n }, [layoutConfig.minWidth]);\n\n return config?.content ? (\n <Flex\n as={StyledCell}\n item={{\n grow: 1\n }}\n container={{ justify: 'stretch', alignItems: 'start' }}\n fillAvailable={layoutConfig.fillAvailable}\n percentageWidth={percentageWidth}\n minWidth={minWidth}\n >\n {config.content}\n </Flex>\n ) : null;\n};\n\nexport default LayoutCell;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTrackWrappedRegions.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/useTrackWrappedRegions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,QAAA,MAAM,sBAAsB,kBACX,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,aAC1B,OAAO;
|
|
1
|
+
{"version":3,"file":"useTrackWrappedRegions.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/useTrackWrappedRegions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,QAAA,MAAM,sBAAsB,kBACX,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,aAC1B,OAAO,KACjB;IAAE,YAAY,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAAC,mBAAmB,EAAE,OAAO,EAAE,CAAA;CA2CzE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTrackWrappedRegions.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/useTrackWrappedRegions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,MAAM,sBAAsB,GAAG,CAC7B,aAAqC,EACrC,QAAkB,EACyD,EAAE;IAC7E,MAAM,YAAY,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IACtD,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,QAAQ,CAC5D,IAAI,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAC5C,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,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CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;oBACjC,CAAC;yBAAM,CAAC;wBACN,gBAAgB,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;oBAClC,CAAC;gBACH,CAAC,CAAC,CAAC;gBAEH,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC,EAAE,GAAG,CAAC,CACR,CAAC;QAEF,IAAI,YAAY,CAAC,OAAO,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC;YACjD,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,KAAK,CAAC;YAClB,QAAQ,CAAC,UAAU,EAAE,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;IAElC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAC/C,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { useRef, useEffect, useState } from 'react';\nimport type { Ref } from 'react';\n\nimport { debounce } from '@pega/cosmos-react-core';\n\nconst useTrackWrappedRegions = (\n regionElArray: (HTMLElement | null)[],\n disabled?: boolean\n): { containerRef: Ref<HTMLElement | null>; regionWrappedStates: boolean[] } => {\n const containerRef = useRef<HTMLElement | null>(null);\n const [regionWrappedStates, setRegionWrappedStates] = useState(\n new Array(regionElArray.length).fill(false)\n );\n\n useEffect(() => {\n if (disabled) return;\n\n let isMounted = true;\n\n const observer = new ResizeObserver(\n debounce(entries => {\n if (isMounted) {\n const containerWidth = entries[0].contentRect.width;\n const newWrappedStates = [...regionWrappedStates];\n\n regionElArray.forEach((regionEl, index) => {\n const regionWidth = regionEl?.getBoundingClientRect().width;\n\n if (regionWidth !== undefined && regionWidth >= containerWidth) {\n newWrappedStates[index] = true;\n } else {\n newWrappedStates[index] = false;\n }\n });\n\n setRegionWrappedStates(newWrappedStates);\n }\n }, 100)\n );\n\n if (containerRef.current && regionElArray.length) {\n observer.observe(containerRef.current);\n }\n\n return () => {\n isMounted = false;\n observer.disconnect();\n };\n }, [containerRef, regionElArray]);\n\n return { containerRef, regionWrappedStates };\n};\n\nexport default useTrackWrappedRegions;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
2
|
+
import type { ForwardRefForwardPropsComponent, UnorderedListProps, NoChildrenProp } from '@pega/cosmos-react-core';
|
|
3
3
|
export interface ConfirmationProps extends NoChildrenProp {
|
|
4
4
|
/** The title of the confirmation */
|
|
5
5
|
title?: string;
|
|
@@ -14,6 +14,6 @@ export interface ConfirmationProps extends NoChildrenProp {
|
|
|
14
14
|
/** Ref for the wrapping element. */
|
|
15
15
|
ref?: Ref<HTMLElement>;
|
|
16
16
|
}
|
|
17
|
-
declare const Confirmation:
|
|
17
|
+
declare const Confirmation: ForwardRefForwardPropsComponent<ConfirmationProps>;
|
|
18
18
|
export default Confirmation;
|
|
19
19
|
//# sourceMappingURL=Confirmation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confirmation.d.ts","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Confirmation.d.ts","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAc7D,OAAO,KAAK,EACV,+BAA+B,EAC/B,kBAAkB,EAClB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAUjC,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,iDAAiD;IACjD,SAAS,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,mCAAmC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAUD,QAAA,MAAM,YAAY,EAAE,+BAA+B,CAAC,iBAAiB,CAiDpE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confirmation.js","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"Confirmation.js","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEvF,MAAM,mBAAmB,GAAG,MAAM,C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BAAmB,IAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,mBAAmB,GAAI,IAC7D,CACR,EAEA,KAAK,EAEL,OAAO,IAAI,CACV,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,YACjC,MAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,SAAS,aACxC,CAAC,CAAC,MAAM,CAAC,EACT,KAAK,CAAC,CAAC,CAAC,KAAC,kBAAkB,cAAE,KAAK,KAAK,EAAE,GAAsB,CAAC,CAAC,CAAC,IAAI,IAChE,GACJ,CACR,IACI,GACK,GACT,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, useContext, useMemo } from 'react';\nimport type { PropsWithoutRef, ReactNode, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Card,\n CardContent,\n Flex,\n Text,\n useI18n,\n UnorderedList,\n Button,\n defaultThemeProp,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\nimport type {\n ForwardRefForwardPropsComponent,\n UnorderedListProps,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nimport { StyledDetails, StyledFieldValueGroupLabel, DetailsContext } from '../Details';\n\nconst StyledWhatsNextList = styled(UnorderedList)`\n padding-inline-start: 0;\n`;\n\nStyledWhatsNextList.defaultProps = defaultThemeProp;\n\nexport interface ConfirmationProps extends NoChildrenProp {\n /** The title of the confirmation */\n title?: string;\n /** Region for a Field Value List component */\n details?: ReactNode;\n /** Array of React nodes to be put into a list */\n whatsNext?: UnorderedListProps['items'];\n /** Region for a Tasks component */\n tasks?: ReactNode;\n /** Called when the done/close button is clicked */\n onClose?: () => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\nconst StyledConfirmationDetails = styled.div(() => {\n return css`\n > ${StyledDetails} > ${StyledFieldValueGroupLabel}:first-child {\n margin-block-start: 0;\n }\n `;\n});\n\nconst Confirmation: ForwardRefForwardPropsComponent<ConfirmationProps> = forwardRef(\n function Confirmation(\n { title, details, whatsNext, tasks, onClose, ...restProps }: PropsWithoutRef<ConfirmationProps>,\n ref\n ) {\n const t = useI18n();\n const detailsContext = useContext(DetailsContext);\n\n const detailsCtxValue = useMemo(() => {\n return {\n ...detailsContext,\n depth: 4\n };\n }, [detailsContext]);\n\n return (\n <Card {...restProps} ref={ref}>\n <CardContent>\n <Flex container={{ gap: 3, direction: 'column' }}>\n {title && <Text variant='h3'>{title}</Text>}\n\n {details && (\n <DetailsContext.Provider value={detailsCtxValue}>\n <StyledConfirmationDetails>{details}</StyledConfirmationDetails>\n </DetailsContext.Provider>\n )}\n\n {whatsNext && (\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h4'>{t('confirmation_whats_next')}</Text>\n <StyledWhatsNextList items={whatsNext} as={StyledWhatsNextList} />\n </Flex>\n )}\n\n {tasks}\n\n {onClose && (\n <Flex container={{ justify: 'end' }}>\n <Button onClick={onClose} variant='primary'>\n {t('done')}\n {title ? <VisuallyHiddenText>{`- ${title}`}</VisuallyHiddenText> : null}\n </Button>\n </Flex>\n )}\n </Flex>\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default Confirmation;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AdditionalInfoProps,
|
|
1
|
+
import type { PropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { AdditionalInfoProps, TestIdProp } from '@pega/cosmos-react-core';
|
|
3
3
|
export type DetailsProps = TestIdProp & {
|
|
4
4
|
/**
|
|
5
5
|
* FieldValueItems to display as highlighted data above children
|
|
@@ -41,13 +41,15 @@ export type DetailsProps = TestIdProp & {
|
|
|
41
41
|
* @default false
|
|
42
42
|
*/
|
|
43
43
|
collapsible?: boolean;
|
|
44
|
+
defaultCollapsed?: boolean;
|
|
44
45
|
} | {
|
|
45
46
|
name?: undefined;
|
|
46
47
|
additionalInfo?: never;
|
|
47
48
|
collapsible?: never;
|
|
49
|
+
defaultCollapsed?: never;
|
|
48
50
|
});
|
|
49
|
-
declare const _default:
|
|
50
|
-
getTestIds: (testIdProp?:
|
|
51
|
+
declare const _default: import("react").ForwardRefExoticComponent<PropsWithoutRef<DetailsProps> & import("react").RefAttributes<HTMLDivElement>> & {
|
|
52
|
+
getTestIds: (testIdProp?: TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["heading", "description", "highlighted-data", "data", "expand-collapse"]>;
|
|
51
53
|
};
|
|
52
54
|
export default _default;
|
|
53
55
|
//# sourceMappingURL=Details.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Details.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAmB7D,OAAO,KAAK,EAAE,mBAAmB,EAAc,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAgB3F,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG;IACtC;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9B,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,OAAO,EACH;QACE,CAAC,EAAE,SAAS,CAAC;QACb,CAAC,CAAC,EAAE,KAAK,CAAC;QACV,CAAC,CAAC,EAAE,KAAK,CAAC;KACX,GACD;QACE,CAAC,EAAE,SAAS,CAAC;QACb,CAAC,EAAE,SAAS,CAAC;QACb,CAAC,CAAC,EAAE,KAAK,CAAC;KACX,GACD;QACE,CAAC,EAAE,SAAS,CAAC;QACb,CAAC,EAAE,SAAS,CAAC;QACb,CAAC,EAAE,SAAS,CAAC;KACd,CAAC;IACN,6BAA6B;IAC7B,WAAW,CAAC,EAAE,YAAY,GAAG,YAAY,CAAC;IAC1C,uCAAuC;IACvC,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B,GAAG,CACE;IACE,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,cAAc,CAAC,EAAE;QACf,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACzC,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;KAC1C,CAAC;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,GACD;IACE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,cAAc,CAAC,EAAE,KAAK,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,gBAAgB,CAAC,EAAE,KAAK,CAAC;CAC1B,CACJ,CAAC;;;;AAyNJ,wBAAuD"}
|
|
@@ -5,12 +5,12 @@ import { AdditionalInfo, Text, useBreakpoint, useConsolidatedRef, useTheme, Expa
|
|
|
5
5
|
import { getDetailsTestIds } from './Details.test-ids';
|
|
6
6
|
import DetailsContext from './DetailsContext';
|
|
7
7
|
import { StyledFieldValueGroupLabel, StyledDetails, StyledHighlightedDetailList, StyledDetailDescription, StyledDetailColumns, columnGapMultiplier, StyledDetailColumn } from './Details.styles';
|
|
8
|
-
const Details = forwardRef(function Details({ testId, highlightedData, columns, name, description, arrangement, variant, collapsible = false, additionalInfo: additionalInfoProp }, ref) {
|
|
8
|
+
const Details = forwardRef(function Details({ testId, highlightedData, columns, name, description, arrangement, variant, collapsible = false, defaultCollapsed = false, additionalInfo: additionalInfoProp }, ref) {
|
|
9
9
|
const testIds = useTestIds(testId, getDetailsTestIds);
|
|
10
10
|
const t = useI18n();
|
|
11
11
|
const { longestLabelLength, depth, ...context } = useContext(DetailsContext);
|
|
12
12
|
const containerRef = useConsolidatedRef(ref);
|
|
13
|
-
const [open, setOpen] = useState(
|
|
13
|
+
const [open, setOpen] = useState(!defaultCollapsed);
|
|
14
14
|
// Observer and state for mobile.
|
|
15
15
|
const columnCount = (() => {
|
|
16
16
|
let count = 1;
|
|
@@ -74,7 +74,7 @@ const Details = forwardRef(function Details({ testId, highlightedData, columns,
|
|
|
74
74
|
const content = useMemo(() => {
|
|
75
75
|
let applyColumnCount = columnCount;
|
|
76
76
|
if (columnCount !== 1) {
|
|
77
|
-
if (fitsThreeColumns) {
|
|
77
|
+
if (columnCount === 3 && fitsThreeColumns) {
|
|
78
78
|
applyColumnCount = 3;
|
|
79
79
|
}
|
|
80
80
|
else if (fitsTwoColumns) {
|
|
@@ -104,7 +104,7 @@ const Details = forwardRef(function Details({ testId, highlightedData, columns,
|
|
|
104
104
|
]);
|
|
105
105
|
return (_jsx(DetailsContext.Provider, { value: contextValue, children: _jsxs(StyledDetails, { "data-testid": testIds.root, ref: containerRef, variant: applyVariant, children: [name && (_jsx(StyledFieldValueGroupLabel, { "data-testid": testIds.heading, children: _jsx(Flex, { container: { alignItems: 'center', gap: 0.5 }, children: collapsible ? (_jsxs(_Fragment, { children: [_jsx(Button, { type: 'button', variant: 'text', onClick: () => {
|
|
106
106
|
setOpen(cur => !cur);
|
|
107
|
-
}, "aria-expanded": open
|
|
107
|
+
}, "aria-expanded": open, "aria-label": t(open ? 'collapse_noun' : 'expand_noun', [name]), children: _jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: 'span', children: [_jsx(Icon, { name: 'caret-right' }), nameText] }) }), additionalInfo] })) : (_jsxs(_Fragment, { children: [nameText, additionalInfo] })) }) })), collapsible ? (_jsx(ExpandCollapse, { "data-testid": testIds.expandCollapse, collapsed: !open, children: content })) : (content)] }) }));
|
|
108
108
|
});
|
|
109
109
|
export default withTestIds(Details, getDetailsTestIds);
|
|
110
110
|
//# sourceMappingURL=Details.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.js","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvF,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,cAAc,EACd,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,yBAAyB,EACzB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,2BAA2B,EAC3B,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAyD1B,MAAM,OAAO,GAAoC,UAAU,CAAC,SAAS,OAAO,CAC1E,EACE,MAAM,EACN,eAAe,EACf,OAAO,EACP,IAAI,EACJ,WAAW,EACX,WAAW,EACX,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,cAAc,EAAE,kBAAkB,EACnC,EACD,GAAG;IAEH,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACtD,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAE7E,MAAM,YAAY,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,G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AAQ,EACb,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;wCACZ,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;oCACvB,CAAC,mBACc,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,gBAC1B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,YAE7D,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAC,MAAM,aAC5D,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC1B,QAAQ,IACJ,GACA,EACR,cAAc,IACd,CACJ,CAAC,CAAC,CAAC,CACF,8BACG,QAAQ,EACR,cAAc,IACd,CACJ,GACI,GACoB,CAC9B,EAEA,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,cAAc,mBAAc,OAAO,CAAC,cAAc,EAAE,SAAS,EAAE,CAAC,IAAI,YAClE,OAAO,GACO,CAClB,CAAC,CAAC,CAAC,CACF,OAAO,CACR,IACa,GACQ,CAC3B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { forwardRef, Fragment, useState, useContext, useEffect, useMemo } from 'react';\nimport type { FC, ReactNode, Ref } from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n AdditionalInfo,\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useTheme,\n ExpandCollapse,\n Button,\n Flex,\n Icon,\n useChToPxConversionFactor,\n useI18n,\n HTML,\n useTestIds,\n withTestIds\n} from '@pega/cosmos-react-core';\nimport type {\n AdditionalInfoProps,\n ForwardProps,\n HeadingTag,\n TestIdProp\n} from '@pega/cosmos-react-core';\n\nimport { getDetailsTestIds } from './Details.test-ids';\nimport DetailsContext from './DetailsContext';\nimport {\n StyledFieldValueGroupLabel,\n StyledDetails,\n StyledHighlightedDetailList,\n StyledDetailDescription,\n StyledDetailColumns,\n columnGapMultiplier,\n StyledDetailColumn\n} from './Details.styles';\n\ntype ColumnCount = 1 | 2 | 3;\n\nexport type DetailsProps = TestIdProp & {\n /**\n * FieldValueItems to display as highlighted data above children\n */\n highlightedData?: ReactNode[];\n /** Copy placed in paragraph below the name */\n description?: string;\n /**\n * Template children separated into 1-3 columns {a, b, c}\n */\n columns:\n | {\n a: ReactNode;\n b?: never;\n c?: never;\n }\n | {\n a: ReactNode;\n b: ReactNode;\n c?: never;\n }\n | {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n };\n /** Arrangement of columns */\n arrangement?: 'narrowWide' | 'wideNarrow';\n /** Style variant applied to element */\n variant?: 'field-group';\n ref?: Ref<HTMLDivElement>;\n} & (\n | {\n /** Text used as heading of list */\n name: string;\n /** Pass a heading and content to show additional information on the list */\n additionalInfo?: {\n heading?: AdditionalInfoProps['heading'];\n content: AdditionalInfoProps['children'];\n };\n /**\n * Whether the items children can be collapsed (only applies if name is provided)\n * @default false\n */\n collapsible?: boolean;\n }\n | {\n name?: undefined;\n additionalInfo?: never;\n collapsible?: never;\n }\n );\n\nconst Details: FC<DetailsProps & ForwardProps> = forwardRef(function Details(\n {\n testId,\n highlightedData,\n columns,\n name,\n description,\n arrangement,\n variant,\n collapsible = false,\n additionalInfo: additionalInfoProp\n },\n ref\n) {\n const testIds = useTestIds(testId, getDetailsTestIds);\n const t = useI18n();\n const { longestLabelLength, depth, ...context } = useContext(DetailsContext);\n\n const containerRef = useConsolidatedRef(ref);\n const [open, setOpen] = useState(true);\n\n // Observer and state for mobile.\n const columnCount = (() => {\n let count: ColumnCount = 1;\n\n if (columns.b) count = 2;\n if (columns.c) count = 3;\n\n return count;\n })();\n const {\n base: {\n 'content-width': { sm: smContentWidth }\n }\n } = useTheme();\n const chToPxConversionFactor = useChToPxConversionFactor();\n\n const fitsThreeColumns = useBreakpoint('xl', {\n breakpointRef: containerRef,\n themeProp: 'content-width'\n });\n const fitsTwoColumns = useBreakpoint('md', {\n breakpointRef: containerRef,\n themeProp: 'content-width'\n });\n const [contentMobileView, setContentMobileView] = useState(false);\n\n useEffect(() => {\n const checkBreakpoint = (elementWidth: number) => {\n const minWidthPx = parseInt(smContentWidth, 10) * chToPxConversionFactor;\n const oneRemInPx = parseInt(remToPx(1), 10);\n const colGapPxAllowance = oneRemInPx * (0.5 * columnGapMultiplier) * (columnCount - 1);\n const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;\n\n setContentMobileView(elementWidth < mobileViewBreakpoint);\n };\n const resizeObserver = new ResizeObserver(entries => {\n const containerPxWidth = entries[0].contentRect.width;\n checkBreakpoint(containerPxWidth);\n });\n\n if (containerRef.current) {\n checkBreakpoint(containerRef.current.offsetWidth);\n resizeObserver.observe(containerRef.current);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [columnCount]);\n\n // Context\n const headingDepth = depth ?? 1;\n const asFieldGroup = variant === 'field-group' && !!name && !description && !highlightedData;\n\n const contextValue = useMemo(() => {\n return {\n ...context,\n mobileView: contentMobileView,\n depth: name ? headingDepth + 1 : headingDepth,\n inFieldGroup: context.inFieldGroup ? true : asFieldGroup,\n longestLabelLength\n };\n }, [name, headingDepth, longestLabelLength, contentMobileView, asFieldGroup, context]);\n\n // Memoized Elements\n const applyVariant = asFieldGroup ? 'field-group' : undefined;\n\n const nameText = useMemo(() => {\n return <Text variant={`h${Math.min(headingDepth, 6)}` as HeadingTag}>{name}</Text>;\n }, [name, headingDepth]);\n\n const additionalInfo = useMemo(() => {\n return name && additionalInfoProp ? (\n <AdditionalInfo heading={additionalInfoProp.heading} contextualLabel={name}>\n {additionalInfoProp.content}\n </AdditionalInfo>\n ) : undefined;\n }, [name, additionalInfoProp?.heading, additionalInfoProp?.content]);\n\n const content = useMemo(() => {\n let applyColumnCount = columnCount;\n\n if (columnCount !== 1) {\n if (fitsThreeColumns) {\n applyColumnCount = 3;\n } else if (fitsTwoColumns) {\n applyColumnCount = 2;\n } else {\n applyColumnCount = 1;\n }\n }\n\n return (\n <>\n {description && (\n <StyledDetailDescription data-testid={testIds.description}>\n <HTML as='p' content={description} />\n </StyledDetailDescription>\n )}\n\n {highlightedData && (\n <>\n <Flex\n data-testid={testIds.highlightedData}\n as={StyledHighlightedDetailList}\n container={{ wrap: 'wrap', colGap: 10, rowGap: 1, alignItems: 'start' }}\n >\n {highlightedData.map((child, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{child}</Fragment>\n ))}\n </Flex>\n\n <hr />\n </>\n )}\n\n <Flex\n as={StyledDetailColumns}\n container={{\n direction: 'row',\n colGap: columnGapMultiplier\n }}\n data-testid={testIds.data}\n arrangement={arrangement}\n variant={applyVariant}\n columnCount={applyColumnCount}\n >\n <StyledDetailColumn>{columns.a}</StyledDetailColumn>\n {columns.b && <StyledDetailColumn>{columns.b}</StyledDetailColumn>}\n {columns.c && <StyledDetailColumn>{columns.c}</StyledDetailColumn>}\n </Flex>\n </>\n );\n }, [\n highlightedData,\n columnCount,\n columns.a,\n columns.b,\n columns.c,\n arrangement,\n testIds,\n fitsTwoColumns,\n fitsThreeColumns,\n description\n ]);\n\n return (\n <DetailsContext.Provider value={contextValue}>\n <StyledDetails data-testid={testIds.root} ref={containerRef} variant={applyVariant}>\n {name && (\n <StyledFieldValueGroupLabel data-testid={testIds.heading}>\n <Flex container={{ alignItems: 'center', gap: 0.5 }}>\n {collapsible ? (\n <>\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Icon name='caret-right' />\n {nameText}\n </Flex>\n </Button>\n {additionalInfo}\n </>\n ) : (\n <>\n {nameText}\n {additionalInfo}\n </>\n )}\n </Flex>\n </StyledFieldValueGroupLabel>\n )}\n\n {collapsible ? (\n <ExpandCollapse data-testid={testIds.expandCollapse} collapsed={!open}>\n {content}\n </ExpandCollapse>\n ) : (\n content\n )}\n </StyledDetails>\n </DetailsContext.Provider>\n );\n});\n\nexport default withTestIds(Details, getDetailsTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"Details.js","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvF,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,cAAc,EACd,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,yBAAyB,EACzB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,2BAA2B,EAC3B,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AA2D1B,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,OAAO,CACzC,EACE,MAAM,EACN,eAAe,EACf,OAAO,EACP,IAAI,EACJ,WAAW,EACX,WAAW,EACX,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,gBAAgB,GAAG,KAAK,EACxB,cAAc,EAAE,kBAAkB,EACJ,EAChC,GAAwB;IAExB,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACtD,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM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AAC,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,aAC/E,IAAI,IAAI,CACP,KAAC,0BAA0B,mBAAc,OAAO,CAAC,OAAO,YACtD,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,YAChD,WAAW,CAAC,CAAC,CAAC,CACb,8BACE,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;wCACZ,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;oCACvB,CAAC,mBACc,IAAI,gBACP,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,YAE7D,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAC,MAAM,aAC5D,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC1B,QAAQ,IACJ,GACA,EACR,cAAc,IACd,CACJ,CAAC,CAAC,CAAC,CACF,8BACG,QAAQ,EACR,cAAc,IACd,CACJ,GACI,GACoB,CAC9B,EAEA,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,cAAc,mBAAc,OAAO,CAAC,cAAc,EAAE,SAAS,EAAE,CAAC,IAAI,YAClE,OAAO,GACO,CAClB,CAAC,CAAC,CAAC,CACF,OAAO,CACR,IACa,GACQ,CAC3B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { forwardRef, Fragment, useState, useContext, useEffect, useMemo } from 'react';\nimport type { PropsWithoutRef, ReactNode, Ref } from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n AdditionalInfo,\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useTheme,\n ExpandCollapse,\n Button,\n Flex,\n Icon,\n useChToPxConversionFactor,\n useI18n,\n HTML,\n useTestIds,\n withTestIds\n} from '@pega/cosmos-react-core';\nimport type { AdditionalInfoProps, HeadingTag, TestIdProp } from '@pega/cosmos-react-core';\n\nimport { getDetailsTestIds } from './Details.test-ids';\nimport DetailsContext from './DetailsContext';\nimport {\n StyledFieldValueGroupLabel,\n StyledDetails,\n StyledHighlightedDetailList,\n StyledDetailDescription,\n StyledDetailColumns,\n columnGapMultiplier,\n StyledDetailColumn\n} from './Details.styles';\n\ntype ColumnCount = 1 | 2 | 3;\n\nexport type DetailsProps = TestIdProp & {\n /**\n * FieldValueItems to display as highlighted data above children\n */\n highlightedData?: ReactNode[];\n /** Copy placed in paragraph below the name */\n description?: string;\n /**\n * Template children separated into 1-3 columns {a, b, c}\n */\n columns:\n | {\n a: ReactNode;\n b?: never;\n c?: never;\n }\n | {\n a: ReactNode;\n b: ReactNode;\n c?: never;\n }\n | {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n };\n /** Arrangement of columns */\n arrangement?: 'narrowWide' | 'wideNarrow';\n /** Style variant applied to element */\n variant?: 'field-group';\n ref?: Ref<HTMLDivElement>;\n} & (\n | {\n /** Text used as heading of list */\n name: string;\n /** Pass a heading and content to show additional information on the list */\n additionalInfo?: {\n heading?: AdditionalInfoProps['heading'];\n content: AdditionalInfoProps['children'];\n };\n /**\n * Whether the items children can be collapsed (only applies if name is provided)\n * @default false\n */\n collapsible?: boolean;\n defaultCollapsed?: boolean;\n }\n | {\n name?: undefined;\n additionalInfo?: never;\n collapsible?: never;\n defaultCollapsed?: never;\n }\n );\n\nconst Details = forwardRef(function Details(\n {\n testId,\n highlightedData,\n columns,\n name,\n description,\n arrangement,\n variant,\n collapsible = false,\n defaultCollapsed = false,\n additionalInfo: additionalInfoProp\n }: PropsWithoutRef<DetailsProps>,\n ref: DetailsProps['ref']\n) {\n const testIds = useTestIds(testId, getDetailsTestIds);\n const t = useI18n();\n const { longestLabelLength, depth, ...context } = useContext(DetailsContext);\n\n const containerRef = useConsolidatedRef(ref);\n const [open, setOpen] = useState(!defaultCollapsed);\n\n // Observer and state for mobile.\n const columnCount = (() => {\n let count: ColumnCount = 1;\n\n if (columns.b) count = 2;\n if (columns.c) count = 3;\n\n return count;\n })();\n const {\n base: {\n 'content-width': { sm: smContentWidth }\n }\n } = useTheme();\n const chToPxConversionFactor = useChToPxConversionFactor();\n\n const fitsThreeColumns = useBreakpoint('xl', {\n breakpointRef: containerRef,\n themeProp: 'content-width'\n });\n const fitsTwoColumns = useBreakpoint('md', {\n breakpointRef: containerRef,\n themeProp: 'content-width'\n });\n const [contentMobileView, setContentMobileView] = useState(false);\n\n useEffect(() => {\n const checkBreakpoint = (elementWidth: number) => {\n const minWidthPx = parseInt(smContentWidth, 10) * chToPxConversionFactor;\n const oneRemInPx = parseInt(remToPx(1), 10);\n const colGapPxAllowance = oneRemInPx * (0.5 * columnGapMultiplier) * (columnCount - 1);\n const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;\n\n setContentMobileView(elementWidth < mobileViewBreakpoint);\n };\n const resizeObserver = new ResizeObserver(entries => {\n const containerPxWidth = entries[0].contentRect.width;\n checkBreakpoint(containerPxWidth);\n });\n\n if (containerRef.current) {\n checkBreakpoint(containerRef.current.offsetWidth);\n resizeObserver.observe(containerRef.current);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [columnCount]);\n\n // Context\n const headingDepth = depth ?? 1;\n const asFieldGroup = variant === 'field-group' && !!name && !description && !highlightedData;\n\n const contextValue = useMemo(() => {\n return {\n ...context,\n mobileView: contentMobileView,\n depth: name ? headingDepth + 1 : headingDepth,\n inFieldGroup: context.inFieldGroup ? true : asFieldGroup,\n longestLabelLength\n };\n }, [name, headingDepth, longestLabelLength, contentMobileView, asFieldGroup, context]);\n\n // Memoized Elements\n const applyVariant = asFieldGroup ? 'field-group' : undefined;\n\n const nameText = useMemo(() => {\n return <Text variant={`h${Math.min(headingDepth, 6)}` as HeadingTag}>{name}</Text>;\n }, [name, headingDepth]);\n\n const additionalInfo = useMemo(() => {\n return name && additionalInfoProp ? (\n <AdditionalInfo heading={additionalInfoProp.heading} contextualLabel={name}>\n {additionalInfoProp.content}\n </AdditionalInfo>\n ) : undefined;\n }, [name, additionalInfoProp?.heading, additionalInfoProp?.content]);\n\n const content = useMemo(() => {\n let applyColumnCount = columnCount;\n\n if (columnCount !== 1) {\n if (columnCount === 3 && fitsThreeColumns) {\n applyColumnCount = 3;\n } else if (fitsTwoColumns) {\n applyColumnCount = 2;\n } else {\n applyColumnCount = 1;\n }\n }\n\n return (\n <>\n {description && (\n <StyledDetailDescription data-testid={testIds.description}>\n <HTML as='p' content={description} />\n </StyledDetailDescription>\n )}\n\n {highlightedData && (\n <>\n <Flex\n data-testid={testIds.highlightedData}\n as={StyledHighlightedDetailList}\n container={{ wrap: 'wrap', colGap: 10, rowGap: 1, alignItems: 'start' }}\n >\n {highlightedData.map((child, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{child}</Fragment>\n ))}\n </Flex>\n\n <hr />\n </>\n )}\n\n <Flex\n as={StyledDetailColumns}\n container={{\n direction: 'row',\n colGap: columnGapMultiplier\n }}\n data-testid={testIds.data}\n arrangement={arrangement}\n variant={applyVariant}\n columnCount={applyColumnCount}\n >\n <StyledDetailColumn>{columns.a}</StyledDetailColumn>\n {columns.b && <StyledDetailColumn>{columns.b}</StyledDetailColumn>}\n {columns.c && <StyledDetailColumn>{columns.c}</StyledDetailColumn>}\n </Flex>\n </>\n );\n }, [\n highlightedData,\n columnCount,\n columns.a,\n columns.b,\n columns.c,\n arrangement,\n testIds,\n fitsTwoColumns,\n fitsThreeColumns,\n description\n ]);\n\n return (\n <DetailsContext.Provider value={contextValue}>\n <StyledDetails data-testid={testIds.root} ref={containerRef} variant={applyVariant}>\n {name && (\n <StyledFieldValueGroupLabel data-testid={testIds.heading}>\n <Flex container={{ alignItems: 'center', gap: 0.5 }}>\n {collapsible ? (\n <>\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Icon name='caret-right' />\n {nameText}\n </Flex>\n </Button>\n {additionalInfo}\n </>\n ) : (\n <>\n {nameText}\n {additionalInfo}\n </>\n )}\n </Flex>\n </StyledFieldValueGroupLabel>\n )}\n\n {collapsible ? (\n <ExpandCollapse data-testid={testIds.expandCollapse} collapsed={!open}>\n {content}\n </ExpandCollapse>\n ) : (\n content\n )}\n </StyledDetails>\n </DetailsContext.Provider>\n );\n});\n\nexport default withTestIds(Details, getDetailsTestIds);\n"]}
|
|
@@ -39,7 +39,7 @@ export declare const StyledHighlightedDetailList: import("styled-components").St
|
|
|
39
39
|
export declare const StyledInlineFieldValueItem: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
40
40
|
export declare const StyledDetailsList: import("styled-components").StyledComponent<"dl", DefaultTheme, StyledFieldValueListProps & Pick<StyledDetailsListProps, keyof StyledDetailsListProps> & Required<Pick<StyledDetailsListProps, never>>, never>;
|
|
41
41
|
export declare const StyledDetails: import("styled-components").StyledComponent<"div", DefaultTheme, {
|
|
42
|
-
variant?: DetailsProps[
|
|
42
|
+
variant?: DetailsProps["variant"];
|
|
43
43
|
}, never>;
|
|
44
44
|
export declare const StyledDetailColumns: import("styled-components").StyledComponent<"div", DefaultTheme, StyledDetailColumnsProps, never>;
|
|
45
45
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAatD,OAAO,KAAK,EACV,yBAAyB,EAG1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,UAAU,sBAAuB,SAAQ,yBAAyB;IAChE,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,UAAU,wBAAwB;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAC1C;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAClC,KAAK,EAAE,YAAY,CAAC;CACrB;AAKD,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,2BAA2B,UAAU,CAAC;AACnD,eAAO,MAAM,6BAA6B,SAAS,CAAC;AAEpD,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"Details.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAatD,OAAO,KAAK,EACV,yBAAyB,EAG1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,UAAU,sBAAuB,SAAQ,yBAAyB;IAChE,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,UAAU,wBAAwB;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAC1C;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAClC,KAAK,EAAE,YAAY,CAAC;CACrB;AAKD,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,2BAA2B,UAAU,CAAC;AACnD,eAAO,MAAM,6BAA6B,SAAS,CAAC;AAEpD,eAAO,MAAM,0BAA0B,6EAkCrC,CAAC;AAIH,eAAO,MAAM,uBAAuB,6EAYlC,CAAC;AAIH,eAAO,MAAM,kBAAkB,6EAW7B,CAAC;AAIH,eAAO,MAAM,2BAA2B,4EAuBtC,CAAC;AAIH,eAAO,MAAM,0BAA0B,6EAItC,CAAC;AAEF,eAAO,MAAM,iBAAiB,gNAkH5B,CAAC;AAgBH,eAAO,MAAM,aAAa;cAA0B,YAAY,CAAC,SAAS,CAAC;SAmB1E,CAAC;AAIF,eAAO,MAAM,mBAAmB,mGAkG/B,CAAC"}
|
|
@@ -7,12 +7,18 @@ export const columnGapMultiplier = 5.5;
|
|
|
7
7
|
export const oneColumnDetailsColumnWidth = '100ch';
|
|
8
8
|
export const multiColumnDetailsColumnWidth = '80ch';
|
|
9
9
|
export const StyledFieldValueGroupLabel = styled.div(({ theme }) => {
|
|
10
|
-
const { base: { spacing, animation } } = theme;
|
|
10
|
+
const { base: { spacing, animation, palette } } = theme;
|
|
11
11
|
const { rtl } = useDirection();
|
|
12
|
+
const { components: { 'field-value-list': { inline: { detached } } } } = theme;
|
|
12
13
|
return css `
|
|
13
14
|
width: 100%;
|
|
14
15
|
grid-column: 1 / -1;
|
|
15
16
|
margin-block-end: calc(${rowGapMultiplier} * ${spacing});
|
|
17
|
+
${detached &&
|
|
18
|
+
css `
|
|
19
|
+
border-bottom: 0.0625rem solid ${palette['border-line']};
|
|
20
|
+
padding-bottom: calc(0.5 * ${spacing});
|
|
21
|
+
`}
|
|
16
22
|
|
|
17
23
|
${StyledButtonLink} ${StyledIcon} {
|
|
18
24
|
transition: transform ${animation.speed} ${animation.timing.ease};
|
|
@@ -74,7 +80,7 @@ export const StyledInlineFieldValueItem = styled.div `
|
|
|
74
80
|
}
|
|
75
81
|
`;
|
|
76
82
|
export const StyledDetailsList = styled(StyledFieldValueList)(({ stacked, labelLength, variant, theme, narrow = false }) => {
|
|
77
|
-
const { base: { spacing }, components: { details: { 'field-label': fieldLabelPosition } } } = theme;
|
|
83
|
+
const { base: { spacing, palette }, components: { details: { 'field-label': fieldLabelPosition }, 'field-value-list': { inline: { detached } } } } = theme;
|
|
78
84
|
const { inFieldGroup } = useContext(DetailsContext);
|
|
79
85
|
const labelTop = (stacked || fieldLabelPosition === 'stacked') && variant !== 'value-comparison';
|
|
80
86
|
const isValueComparison = variant === 'value-comparison';
|
|
@@ -83,7 +89,7 @@ export const StyledDetailsList = styled(StyledFieldValueList)(({ stacked, labelL
|
|
|
83
89
|
/* Field Grid Styles */
|
|
84
90
|
display: flex;
|
|
85
91
|
flex-direction: column;
|
|
86
|
-
row-gap: calc(${rowGapMultiplier} * ${spacing});
|
|
92
|
+
row-gap: ${detached ? 0 : `calc(${rowGapMultiplier} * ${spacing})`};
|
|
87
93
|
width: 100%;
|
|
88
94
|
max-width: ${oneColumnDetailsColumnWidth};
|
|
89
95
|
height: fit-content;
|
|
@@ -101,13 +107,20 @@ export const StyledDetailsList = styled(StyledFieldValueList)(({ stacked, labelL
|
|
|
101
107
|
grid-template-columns: minmax(14ch, ${labelLength}ch) minmax(14ch, 1fr);
|
|
102
108
|
grid-template-rows: max-content;
|
|
103
109
|
column-gap: calc(${fieldValueGapMultiplier} * ${spacing});
|
|
110
|
+
${detached &&
|
|
111
|
+
css `
|
|
112
|
+
padding-block: calc(0.5 * ${spacing});
|
|
113
|
+
&:not(:last-child) {
|
|
114
|
+
border-bottom: 0.0625rem dashed ${palette['border-line']};
|
|
115
|
+
}
|
|
116
|
+
`}
|
|
104
117
|
|
|
105
118
|
${inFieldGroup &&
|
|
106
119
|
css `
|
|
107
120
|
grid-template-columns:
|
|
108
121
|
minmax(calc(14ch - ${spacing}), calc(${labelLength}ch - ${spacing}))
|
|
109
122
|
minmax(14ch, 1fr);
|
|
110
|
-
`}
|
|
123
|
+
`};
|
|
111
124
|
}
|
|
112
125
|
|
|
113
126
|
/* Stacked Label Styles */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.styles.js","sourceRoot":"","sources":["../../../src/components/Details/Details.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAQjC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAkC9C,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC;AACnD,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;AAEpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjE,MAAM,EACJ,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAC7B,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IAE/B,OAAO,GAAG,CAAA;;;6BAGiB,gBAAgB,MAAM,OAAO;;MAEpD,gBAAgB,IAAI,UAAU;8BACN,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,MAAM,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AE,EACJ,OAAO,EAAE,EAAE,aAAa,EAAE,WAAW,EAAE,EACvC,OAAO,EACR,EACD,UAAU,EAAE,EACV,cAAc,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,EAChD,EACF,GAAG,KAAK,CAAC;IAEV,OAAO,GAAG,CAAA;;;QAGN,WAAW,KAAK,CAAC;QACnB,CAAC,WAAW;QACZ,GAAG,CAAA;;OAEF;;QAEC,WAAW,KAAK,CAAC;QACnB,GAAG,CAAA;;wBAEe,gBAAgB,MAAM,OAAO;;UAE3C,OAAO,KAAK,aAAa;YAC3B,GAAG,CAAA;;kCAEuB,OAAO;;;;;6BAKZ,OAAO;;;qBAGf,WAAW;0BACN,WAAW;;SAE5B;OACF;;;UAGG,kBAAkB;;;UAGlB,WAAW,KAAK,CAAC;QACnB,GAAG,CAAA;mBACQ,6BAA6B;sCACV,mBAAmB,MAAM,OAAO;SAC7D;;UAEC,WAAW,KAAK,CAAC;QACnB,GAAG,CAAA;+BACoB,mBAAmB,MAAM,OAAO;;;6BAGlC,aAAa;cAC5B,UAAU,CAAC,OAAO,CAAC;;SAExB;;UAEC,WAAW,KAAK,CAAC;QACnB,GAAG,CAAA;YACC,WAAW,KAAK,YAAY;YAC9B,GAAG,CAAA;;;kBAGK,6BAA6B,UAAU,mBAAmB,MAAM,OAAO;;0CAE/C,mBAAmB,MAAM,OAAO;;WAE/D;;YAEC,WAAW,KAAK,YAAY;YAC9B,GAAG,CAAA;;;kBAGK,6BAA6B,UAAU,mBAAmB,MAAM,OAAO;;0CAE/C,mBAAmB,MAAM,OAAO;;WAE/D;SACF;;UAEC,WAAW,KAAK,CAAC;QACnB,GAAG,CAAA;;;;kCAIuB,aAAa;cACjC,UAAU,CAAC,OAAO,CAAC;;SAExB;;KAEJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { useContext } from 'react';\n\nimport {\n calculateFontSize,\n defaultThemeProp,\n StyledFieldValue,\n StyledStackedFieldValue,\n StyledFieldValueList,\n StyledIcon,\n useDirection,\n StyledButtonLink\n} from '@pega/cosmos-react-core';\nimport type {\n StyledFieldValueListProps,\n FontSize,\n PropsWithDefaults\n} from '@pega/cosmos-react-core';\n\nimport type { DetailsProps } from './Details';\nimport DetailsContext from './DetailsContext';\n\ninterface StyledDetailsListProps extends StyledFieldValueListProps {\n /** Whether individual list items all have labels stacks on top */\n stacked?: boolean;\n /** The character length applied to all list labels */\n labelLength?: number;\n /**\n * Whether to apply narrow list styles\n * @default false\n */\n narrow?: boolean;\n theme: DefaultTheme;\n}\n\ninterface StyledDetailColumnsProps {\n /**\n * Number of columns in the list\n * @default 1\n */\n columnCount?: 1 | 2 | 3;\n /**\n * Arrangement of columns\n */\n arrangement?: DetailsProps['arrangement'];\n /**\n * Style variations\n */\n variant?: DetailsProps['variant'];\n theme: DefaultTheme;\n}\n\ntype StyledDetailsListPropsWithDefaults = PropsWithDefaults<StyledDetailsListProps>;\n\nconst rowGapMultiplier = 1;\nexport const columnGapMultiplier = 5.5;\nexport const oneColumnDetailsColumnWidth = '100ch';\nexport const multiColumnDetailsColumnWidth = '80ch';\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: 1 / -1;\n margin-block-end: calc(${rowGapMultiplier} * ${spacing});\n\n ${StyledButtonLink} ${StyledIcon} {\n transition: transform ${animation.speed} ${animation.timing.ease};\n }\n\n ${StyledButtonLink}[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(90deg);\n }\n\n ${StyledButtonLink}[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(${rtl ? 180 : 0}deg);\n }\n `;\n});\n\nStyledFieldValueGroupLabel.defaultProps = defaultThemeProp;\n\nexport const StyledDetailDescription = styled.div(({ theme }) => {\n const {\n base: {\n spacing,\n 'content-width': { xl }\n }\n } = theme;\n\n return css`\n max-width: ${xl};\n margin-block-end: calc(1.5 * ${spacing});\n `;\n});\n\nStyledDetailDescription.defaultProps = defaultThemeProp;\n\nexport const StyledDetailColumn = styled.div(({ theme }) => {\n const {\n base: { spacing }\n } = theme;\n\n return css`\n display: flex;\n flex-direction: column;\n row-gap: calc(${rowGapMultiplier} * ${spacing});\n width: 100%;\n `;\n});\n\nStyledDetailColumn.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 max-width: calc(${multiColumnDetailsColumnWidth} * 3 + ${columnGapMultiplier} * ${spacing} * 2);\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 StyledInlineFieldValueItem = styled.div`\n > * {\n min-width: 0;\n }\n`;\n\nexport const StyledDetailsList = styled(StyledFieldValueList)<StyledDetailsListPropsWithDefaults>(({\n stacked,\n labelLength,\n variant,\n theme,\n narrow = false\n}) => {\n const {\n base: { spacing },\n components: {\n details: { 'field-label': fieldLabelPosition }\n }\n } = theme;\n\n const { inFieldGroup } = useContext(DetailsContext);\n const labelTop = (stacked || fieldLabelPosition === 'stacked') && variant !== 'value-comparison';\n const isValueComparison = variant === 'value-comparison';\n const fieldValueGapMultiplier = 2;\n\n return css`\n /* Field Grid Styles */\n display: flex;\n flex-direction: column;\n row-gap: calc(${rowGapMultiplier} * ${spacing});\n width: 100%;\n max-width: ${oneColumnDetailsColumnWidth};\n height: fit-content;\n\n ${StyledFieldValue} {\n word-break: break-word;\n overflow: auto;\n }\n\n ${StyledInlineFieldValueItem}, ${StyledStackedFieldValue} {\n width: 100%;\n }\n\n ${StyledInlineFieldValueItem} {\n grid-template-columns: minmax(14ch, ${labelLength}ch) minmax(14ch, 1fr);\n grid-template-rows: max-content;\n column-gap: calc(${fieldValueGapMultiplier} * ${spacing});\n\n ${inFieldGroup &&\n css`\n grid-template-columns:\n minmax(calc(14ch - ${spacing}), calc(${labelLength}ch - ${spacing}))\n minmax(14ch, 1fr);\n `}\n }\n\n /* Stacked Label Styles */\n ${labelTop &&\n css`\n grid-template-columns: minmax(0, 1fr);\n row-gap: 0;\n\n dt {\n max-width: 100%;\n }\n\n ${!isValueComparison &&\n css`\n ${StyledStackedFieldValue}:not(:first-child) {\n margin-block-start: calc(${rowGapMultiplier} * ${spacing});\n }\n `}\n `}\n\n /* Value Comparison Styles */\n ${isValueComparison &&\n css`\n display: grid;\n grid-template-columns: auto auto;\n column-gap: 0;\n row-gap: calc(0.5 * ${spacing});\n\n > dd {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n }\n `}\n\n /* Responsive behavior */\n ${narrow &&\n !labelTop &&\n !isValueComparison &&\n css`\n ${StyledInlineFieldValueItem} {\n grid-template-columns: minmax(0, ${labelLength}ch) minmax(50%, 1fr);\n\n ${inFieldGroup &&\n css`\n grid-template-columns:\n minmax(0, calc(${labelLength}ch - ${spacing}))\n minmax(calc(50% + 0.5 * ${spacing}), 1fr);\n `}\n }\n\n dd {\n min-width: 50%;\n }\n `}\n `;\n});\n\nStyledDetailsList.defaultProps = defaultThemeProp;\n\nconst spacingTop = (spacing: string) => {\n return css`\n > ${StyledFieldValueGroupLabel} {\n margin-block-start: calc((1.5 * ${rowGapMultiplier}) * ${spacing});\n }\n\n > ${StyledDetailDescription}:first-child {\n margin-block-start: calc(1.5 * ${spacing});\n }\n `;\n};\n\nexport const StyledDetails = styled.div<{ variant?: DetailsProps['variant'] }>(\n ({ variant, theme }) => {\n const {\n base: { spacing }\n } = theme;\n\n return css`\n &:not(:first-child) {\n ${spacingTop(spacing)}\n }\n\n ${variant === 'field-group' &&\n css`\n + ${StyledDetailsList} {\n margin-block-start: calc(1.5 * ${spacing});\n }\n `}\n `;\n }\n);\n\nStyledDetails.defaultProps = defaultThemeProp;\n\nexport const StyledDetailColumns = styled.div<StyledDetailColumnsProps>(\n ({ theme, arrangement, variant, columnCount = 1 }) => {\n const {\n base: {\n palette: { 'border-line': borderColor },\n spacing\n },\n components: {\n 'form-control': { 'border-width': borderWidth }\n }\n } = theme;\n\n return css`\n width: 100%;\n\n ${columnCount === 2 &&\n !arrangement &&\n css`\n flex-wrap: wrap;\n `}\n\n ${columnCount === 1 &&\n css`\n flex-direction: column;\n row-gap: calc(${rowGapMultiplier} * ${spacing});\n\n ${variant === 'field-group' &&\n css`\n position: relative;\n padding-inline-start: ${spacing};\n\n &::before {\n content: '';\n position: absolute;\n top: calc(-1 * ${spacing});\n bottom: 0;\n left: 0;\n width: ${borderWidth};\n background: ${borderColor};\n }\n `}\n `};\n\n /* Column Widths */\n > ${StyledDetailColumn} {\n overflow: hidden;\n\n ${columnCount === 3 &&\n css`\n width: ${multiColumnDetailsColumnWidth};\n max-width: calc(33.33% - (${columnGapMultiplier} * ${spacing} * 2) / 3);\n `}\n\n ${columnCount === 2 &&\n css`\n width: calc(50% - (${columnGapMultiplier} * ${spacing}) / 2);\n max-width: unset;\n\n &:nth-child(3) > ${StyledDetails}:first-child {\n ${spacingTop(spacing)}\n }\n `}\n\n ${columnCount !== 1 &&\n css`\n ${arrangement === 'narrowWide' &&\n css`\n &:nth-child(2) {\n width: calc(\n ${multiColumnDetailsColumnWidth} * 2 + ${columnGapMultiplier} * ${spacing}\n );\n max-width: calc(66.66% - (${columnGapMultiplier} * ${spacing}) / 3);\n }\n `}\n\n ${arrangement === 'wideNarrow' &&\n css`\n &:nth-child(1) {\n width: calc(\n ${multiColumnDetailsColumnWidth} * 2 + ${columnGapMultiplier} * ${spacing}\n );\n max-width: calc(66.66% - (${columnGapMultiplier} * ${spacing}) / 3);\n }\n `}\n `}\n\n ${columnCount === 1 &&\n css`\n width: 100%;\n max-width: 100%;\n\n &:not(:first-child) > ${StyledDetails}:first-child {\n ${spacingTop(spacing)}\n }\n `}\n }\n `;\n }\n);\n\nStyledDetailColumns.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Details.styles.js","sourceRoot":"","sources":["../../../src/components/Details/Details.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAQjC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAkC9C,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC;AACnD,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;AAEpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjE,MAAM,EACJ,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,EACtC,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IAC/B,MAAM,EACJ,UAAU,EAAE,EACV,kBAAkB,EAAE,EAClB,MAAM,EAAE,EAAE,QAAQ,EAAE,EACrB,EACF,EACF,GAAG,KAAK,CAAC;IACV,OAAO,GAAG,CAAA;;;6BAGiB,gBAAgB,MAAM,O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AE/D;;YAEC,WAAW,KAAK,YAAY;YAC9B,GAAG,CAAA;;;kBAGK,6BAA6B,UAAU,mBAAmB,MAAM,OAAO;;0CAE/C,mBAAmB,MAAM,OAAO;;WAE/D;SACF;;UAEC,WAAW,KAAK,CAAC;QACnB,GAAG,CAAA;;;;kCAIuB,aAAa;cACjC,UAAU,CAAC,OAAO,CAAC;;SAExB;;KAEJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { useContext } from 'react';\n\nimport {\n calculateFontSize,\n defaultThemeProp,\n StyledFieldValue,\n StyledStackedFieldValue,\n StyledFieldValueList,\n StyledIcon,\n useDirection,\n StyledButtonLink\n} from '@pega/cosmos-react-core';\nimport type {\n StyledFieldValueListProps,\n FontSize,\n PropsWithDefaults\n} from '@pega/cosmos-react-core';\n\nimport type { DetailsProps } from './Details';\nimport DetailsContext from './DetailsContext';\n\ninterface StyledDetailsListProps extends StyledFieldValueListProps {\n /** Whether individual list items all have labels stacks on top */\n stacked?: boolean;\n /** The character length applied to all list labels */\n labelLength?: number;\n /**\n * Whether to apply narrow list styles\n * @default false\n */\n narrow?: boolean;\n theme: DefaultTheme;\n}\n\ninterface StyledDetailColumnsProps {\n /**\n * Number of columns in the list\n * @default 1\n */\n columnCount?: 1 | 2 | 3;\n /**\n * Arrangement of columns\n */\n arrangement?: DetailsProps['arrangement'];\n /**\n * Style variations\n */\n variant?: DetailsProps['variant'];\n theme: DefaultTheme;\n}\n\ntype StyledDetailsListPropsWithDefaults = PropsWithDefaults<StyledDetailsListProps>;\n\nconst rowGapMultiplier = 1;\nexport const columnGapMultiplier = 5.5;\nexport const oneColumnDetailsColumnWidth = '100ch';\nexport const multiColumnDetailsColumnWidth = '80ch';\n\nexport const StyledFieldValueGroupLabel = styled.div(({ theme }) => {\n const {\n base: { spacing, animation, palette }\n } = theme;\n const { rtl } = useDirection();\n const {\n components: {\n 'field-value-list': {\n inline: { detached }\n }\n }\n } = theme;\n return css`\n width: 100%;\n grid-column: 1 / -1;\n margin-block-end: calc(${rowGapMultiplier} * ${spacing});\n ${detached &&\n css`\n border-bottom: 0.0625rem solid ${palette['border-line']};\n padding-bottom: calc(0.5 * ${spacing});\n `}\n\n ${StyledButtonLink} ${StyledIcon} {\n transition: transform ${animation.speed} ${animation.timing.ease};\n }\n\n ${StyledButtonLink}[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(90deg);\n }\n\n ${StyledButtonLink}[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(${rtl ? 180 : 0}deg);\n }\n `;\n});\n\nStyledFieldValueGroupLabel.defaultProps = defaultThemeProp;\n\nexport const StyledDetailDescription = styled.div(({ theme }) => {\n const {\n base: {\n spacing,\n 'content-width': { xl }\n }\n } = theme;\n\n return css`\n max-width: ${xl};\n margin-block-end: calc(1.5 * ${spacing});\n `;\n});\n\nStyledDetailDescription.defaultProps = defaultThemeProp;\n\nexport const StyledDetailColumn = styled.div(({ theme }) => {\n const {\n base: { spacing }\n } = theme;\n\n return css`\n display: flex;\n flex-direction: column;\n row-gap: calc(${rowGapMultiplier} * ${spacing});\n width: 100%;\n `;\n});\n\nStyledDetailColumn.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 max-width: calc(${multiColumnDetailsColumnWidth} * 3 + ${columnGapMultiplier} * ${spacing} * 2);\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 StyledInlineFieldValueItem = styled.div`\n > * {\n min-width: 0;\n }\n`;\n\nexport const StyledDetailsList = styled(StyledFieldValueList)<StyledDetailsListPropsWithDefaults>(({\n stacked,\n labelLength,\n variant,\n theme,\n narrow = false\n}) => {\n const {\n base: { spacing, palette },\n components: {\n details: { 'field-label': fieldLabelPosition },\n 'field-value-list': {\n inline: { detached }\n }\n }\n } = theme;\n\n const { inFieldGroup } = useContext(DetailsContext);\n const labelTop = (stacked || fieldLabelPosition === 'stacked') && variant !== 'value-comparison';\n const isValueComparison = variant === 'value-comparison';\n const fieldValueGapMultiplier = 2;\n\n return css`\n /* Field Grid Styles */\n display: flex;\n flex-direction: column;\n row-gap: ${detached ? 0 : `calc(${rowGapMultiplier} * ${spacing})`};\n width: 100%;\n max-width: ${oneColumnDetailsColumnWidth};\n height: fit-content;\n\n ${StyledFieldValue} {\n word-break: break-word;\n overflow: auto;\n }\n\n ${StyledInlineFieldValueItem}, ${StyledStackedFieldValue} {\n width: 100%;\n }\n\n ${StyledInlineFieldValueItem} {\n grid-template-columns: minmax(14ch, ${labelLength}ch) minmax(14ch, 1fr);\n grid-template-rows: max-content;\n column-gap: calc(${fieldValueGapMultiplier} * ${spacing});\n ${detached &&\n css`\n padding-block: calc(0.5 * ${spacing});\n &:not(:last-child) {\n border-bottom: 0.0625rem dashed ${palette['border-line']};\n }\n `}\n\n ${inFieldGroup &&\n css`\n grid-template-columns:\n minmax(calc(14ch - ${spacing}), calc(${labelLength}ch - ${spacing}))\n minmax(14ch, 1fr);\n `};\n }\n\n /* Stacked Label Styles */\n ${labelTop &&\n css`\n grid-template-columns: minmax(0, 1fr);\n row-gap: 0;\n\n dt {\n max-width: 100%;\n }\n\n ${!isValueComparison &&\n css`\n ${StyledStackedFieldValue}:not(:first-child) {\n margin-block-start: calc(${rowGapMultiplier} * ${spacing});\n }\n `}\n `}\n\n /* Value Comparison Styles */\n ${isValueComparison &&\n css`\n display: grid;\n grid-template-columns: auto auto;\n column-gap: 0;\n row-gap: calc(0.5 * ${spacing});\n\n > dd {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n }\n `}\n\n /* Responsive behavior */\n ${narrow &&\n !labelTop &&\n !isValueComparison &&\n css`\n ${StyledInlineFieldValueItem} {\n grid-template-columns: minmax(0, ${labelLength}ch) minmax(50%, 1fr);\n\n ${inFieldGroup &&\n css`\n grid-template-columns:\n minmax(0, calc(${labelLength}ch - ${spacing}))\n minmax(calc(50% + 0.5 * ${spacing}), 1fr);\n `}\n }\n\n dd {\n min-width: 50%;\n }\n `}\n `;\n});\n\nStyledDetailsList.defaultProps = defaultThemeProp;\n\nconst spacingTop = (spacing: string) => {\n return css`\n > ${StyledFieldValueGroupLabel} {\n margin-block-start: calc((1.5 * ${rowGapMultiplier}) * ${spacing});\n }\n\n > ${StyledDetailDescription}:first-child {\n margin-block-start: calc(1.5 * ${spacing});\n }\n `;\n};\n\nexport const StyledDetails = styled.div<{ variant?: DetailsProps['variant'] }>(\n ({ variant, theme }) => {\n const {\n base: { spacing }\n } = theme;\n\n return css`\n &:not(:first-child) {\n ${spacingTop(spacing)}\n }\n\n ${variant === 'field-group' &&\n css`\n + ${StyledDetailsList} {\n margin-block-start: calc(1.5 * ${spacing});\n }\n `}\n `;\n }\n);\n\nStyledDetails.defaultProps = defaultThemeProp;\n\nexport const StyledDetailColumns = styled.div<StyledDetailColumnsProps>(\n ({ theme, arrangement, variant, columnCount = 1 }) => {\n const {\n base: {\n palette: { 'border-line': borderColor },\n spacing\n },\n components: {\n 'form-control': { 'border-width': borderWidth }\n }\n } = theme;\n\n return css`\n width: 100%;\n\n ${columnCount === 2 &&\n !arrangement &&\n css`\n flex-wrap: wrap;\n `}\n\n ${columnCount === 1 &&\n css`\n flex-direction: column;\n row-gap: calc(${rowGapMultiplier} * ${spacing});\n\n ${variant === 'field-group' &&\n css`\n position: relative;\n padding-inline-start: ${spacing};\n\n &::before {\n content: '';\n position: absolute;\n top: calc(-1 * ${spacing});\n bottom: 0;\n left: 0;\n width: ${borderWidth};\n background: ${borderColor};\n }\n `}\n `};\n\n /* Column Widths */\n > ${StyledDetailColumn} {\n overflow: hidden;\n\n ${columnCount === 3 &&\n css`\n width: ${multiColumnDetailsColumnWidth};\n max-width: calc(33.33% - (${columnGapMultiplier} * ${spacing} * 2) / 3);\n `}\n\n ${columnCount === 2 &&\n css`\n width: calc(50% - (${columnGapMultiplier} * ${spacing}) / 2);\n max-width: unset;\n\n &:nth-child(3) > ${StyledDetails}:first-child {\n ${spacingTop(spacing)}\n }\n `}\n\n ${columnCount !== 1 &&\n css`\n ${arrangement === 'narrowWide' &&\n css`\n &:nth-child(2) {\n width: calc(\n ${multiColumnDetailsColumnWidth} * 2 + ${columnGapMultiplier} * ${spacing}\n );\n max-width: calc(66.66% - (${columnGapMultiplier} * ${spacing}) / 3);\n }\n `}\n\n ${arrangement === 'wideNarrow' &&\n css`\n &:nth-child(1) {\n width: calc(\n ${multiColumnDetailsColumnWidth} * 2 + ${columnGapMultiplier} * ${spacing}\n );\n max-width: calc(66.66% - (${columnGapMultiplier} * ${spacing}) / 3);\n }\n `}\n `}\n\n ${columnCount === 1 &&\n css`\n width: 100%;\n max-width: 100%;\n\n &:not(:first-child) > ${StyledDetails}:first-child {\n ${spacingTop(spacing)}\n }\n `}\n }\n `;\n }\n);\n\nStyledDetailColumns.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const getDetailsTestIds: (testIdProp?:
|
|
1
|
+
export declare const getDetailsTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["heading", "description", "highlighted-data", "data", "expand-collapse"]>;
|
|
2
2
|
//# sourceMappingURL=Details.test-ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"Details.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,8MAMnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetailsContext.d.ts","sourceRoot":"","sources":["../../../src/components/Details/DetailsContext.ts"],"names":[],"mappings":"
|
|
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;IACf,mEAAmE;IACnE,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,QAAA,MAAM,cAAc,8CAMlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
2
|
+
import type { ConversationHistoryProps } from './GenAICoach.types';
|
|
3
|
+
declare const ConversationHistory: ForwardRefForwardPropsComponent<ConversationHistoryProps>;
|
|
4
|
+
export default ConversationHistory;
|
|
5
|
+
//# sourceMappingURL=ConversationHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationHistory.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/ConversationHistory.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAW/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAKnE,QAAA,MAAM,mBAAmB,EAAE,+BAA+B,CAAC,wBAAwB,CA2KlF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useRef } from 'react';
|
|
3
|
+
import { Button, EmptyState, ErrorState, Flex, getFocusables, Icon, Progress, registerIcon, Text, useArrows, useDirection, useI18n, useItemIntersection, useOuterEvent, useTestIds } from '@pega/cosmos-react-core';
|
|
4
|
+
import * as ArrowLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-left.icon';
|
|
5
|
+
import * as ArrowRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-right.icon';
|
|
6
|
+
import { StyledHistoryContainer, StyledList, StyledLoadingItem, StyledHistorySummaryListItem, StyledGroupHeader } from './GenAICoach.styles';
|
|
7
|
+
import { getConversationHistoryTestIds } from './GenAICoach.test-ids';
|
|
8
|
+
registerIcon(ArrowLeftIcon, ArrowRightIcon);
|
|
9
|
+
const ConversationHistory = forwardRef(function ConversationHistory({ testId, data = [], onDismiss, loading = false, loadMore, inFullPage = false, onItemClick, selectedItemId, error, ...restProps }, ref) {
|
|
10
|
+
const testIds = useTestIds(testId, getConversationHistoryTestIds);
|
|
11
|
+
const t = useI18n();
|
|
12
|
+
const { rtl } = useDirection();
|
|
13
|
+
const focusInMessageListRef = useRef(false);
|
|
14
|
+
const ulRef = useRef(null);
|
|
15
|
+
const backButtonRef = useRef(null);
|
|
16
|
+
const selector = ':scope > li > ul > li';
|
|
17
|
+
const totalConversations = data.reduce((sum, section) => sum + section.conversations.length, 0);
|
|
18
|
+
useArrows(ulRef, {
|
|
19
|
+
selector
|
|
20
|
+
}, [totalConversations, data[0]?.conversations.length]);
|
|
21
|
+
useItemIntersection(ulRef, totalConversations - 1, () => {
|
|
22
|
+
if (!loading)
|
|
23
|
+
loadMore?.();
|
|
24
|
+
}, selector);
|
|
25
|
+
useOuterEvent('mousedown', [ulRef.current], () => {
|
|
26
|
+
focusInMessageListRef.current = false;
|
|
27
|
+
});
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (backButtonRef.current)
|
|
30
|
+
backButtonRef.current.focus();
|
|
31
|
+
}, []);
|
|
32
|
+
const loadingOrEmptyElement = loading ? (_jsx(Progress, { placement: 'block', liveConfig: { contextualLabel: t('conversation') } })) : (_jsx(EmptyState, { message: t('no_conversations_found') }));
|
|
33
|
+
const renderComponent = data.length > 0 ? (_jsxs(StyledList, { container: { direction: 'column', pad: [undefined, undefined, 1], gap: 1 }, forwardedAs: 'ul', "aria-label": `${t('history')} ${t('view')}`, onFocus: () => {
|
|
34
|
+
if (selectedItemId && !focusInMessageListRef.current) {
|
|
35
|
+
focusInMessageListRef.current = true;
|
|
36
|
+
ulRef.current?.querySelector(`li[id="${selectedItemId}"]`)?.focus();
|
|
37
|
+
}
|
|
38
|
+
}, onKeyDown: (e) => {
|
|
39
|
+
if (e.key === 'Tab') {
|
|
40
|
+
focusInMessageListRef.current = false;
|
|
41
|
+
if (e.shiftKey) {
|
|
42
|
+
const prevElement = ulRef.current?.previousElementSibling;
|
|
43
|
+
if (prevElement) {
|
|
44
|
+
const focusables = getFocusables(prevElement);
|
|
45
|
+
if (focusables.length) {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
focusables[focusables.length - 1].focus();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, item: { grow: 1 }, ref: ulRef, children: [data.map(item => {
|
|
53
|
+
return (_jsxs(Flex, { "data-testid": testIds.historyGroup, container: { direction: 'column' }, as: 'li', role: 'presentation', children: [_jsx(Flex, { container: { alignItems: 'center', pad: [0.5, 1] }, as: StyledGroupHeader, id: item.id, children: item.section }), _jsx("ul", { "aria-labelledby": item.id, children: item.conversations.map(conversation => {
|
|
54
|
+
const activeElement = selectedItemId === conversation.id;
|
|
55
|
+
return (_jsx(StyledHistorySummaryListItem, { id: conversation.id, forwardedAs: 'li', "aria-selected": activeElement, primary: _jsx(Text, { children: conversation.title }), onClick: () => {
|
|
56
|
+
onItemClick?.(conversation.id);
|
|
57
|
+
}, "aria-label": conversation.title, onKeyDown: (e) => {
|
|
58
|
+
if (e.key === 'Enter') {
|
|
59
|
+
onItemClick?.(conversation.id);
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
}
|
|
62
|
+
} }, conversation.id));
|
|
63
|
+
}) })] }, item.id));
|
|
64
|
+
}), loading && _jsx(StyledLoadingItem, { children: loadingOrEmptyElement })] })) : (loadingOrEmptyElement);
|
|
65
|
+
return (_jsxs(StyledHistoryContainer, { ...restProps, "data-testid": testIds.root, container: { direction: 'column' }, inFullPage: inFullPage, item: { grow: 1 }, ref: ref, children: [_jsxs(Flex, { container: {
|
|
66
|
+
pad: 1,
|
|
67
|
+
gap: 2,
|
|
68
|
+
justify: 'start',
|
|
69
|
+
alignItems: 'center'
|
|
70
|
+
}, children: [_jsx(Button, { "data-testid": testIds.back, label: t('back'), icon: true, variant: 'simple', onClick: onDismiss, ref: backButtonRef, children: _jsx(Icon, { name: rtl ? 'arrow-right' : 'arrow-left' }) }), _jsx(Text, { variant: 'h2', children: t('history') })] }), error ? _jsx(ErrorState, { message: error }) : renderComponent] }));
|
|
71
|
+
});
|
|
72
|
+
export default ConversationHistory;
|
|
73
|
+
//# sourceMappingURL=ConversationHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationHistory.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/ConversationHistory.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,EACL,MAAM,EACN,UAAU,EACV,UAAU,EACV,IAAI,EACJ,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,YAAY,EAC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,CAAC,CAAC,MAAM,CAAC,EAChB,IAAI,QACJ,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,SAAS,EAClB,GAAG,EAAE,aAAa,YAElB,KAAC,IAAI,IAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,GAAI,GAC3C,EAET,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,SAAS,CAAC,GAAQ,IACnC,EAEN,KAAK,CAAC,CAAC,CAAC,KAAC,UAAU,IAAC,OAAO,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,eAAe,IAClC,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { forwardRef, useEffect, useRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n Button,\n EmptyState,\n ErrorState,\n Flex,\n getFocusables,\n Icon,\n Progress,\n registerIcon,\n Text,\n useArrows,\n useDirection,\n useI18n,\n useItemIntersection,\n useOuterEvent,\n useTestIds\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport * as ArrowLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-left.icon';\nimport * as ArrowRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-right.icon';\n\nimport {\n StyledHistoryContainer,\n StyledList,\n StyledLoadingItem,\n StyledHistorySummaryListItem,\n StyledGroupHeader\n} from './GenAICoach.styles';\nimport type { ConversationHistoryProps } from './GenAICoach.types';\nimport { getConversationHistoryTestIds } from './GenAICoach.test-ids';\n\nregisterIcon(ArrowLeftIcon, ArrowRightIcon);\n\nconst ConversationHistory: ForwardRefForwardPropsComponent<ConversationHistoryProps> = forwardRef(\n function ConversationHistory(\n {\n testId,\n data = [],\n onDismiss,\n loading = false,\n loadMore,\n inFullPage = false,\n onItemClick,\n selectedItemId,\n error,\n ...restProps\n }: PropsWithoutRef<ConversationHistoryProps>,\n ref: ConversationHistoryProps['ref']\n ) {\n const testIds = useTestIds(testId, getConversationHistoryTestIds);\n const t = useI18n();\n const { rtl } = useDirection();\n const focusInMessageListRef = useRef(false);\n const ulRef = useRef<HTMLUListElement>(null);\n const backButtonRef = useRef<HTMLButtonElement>(null);\n const selector = ':scope > li > ul > li';\n const totalConversations = data.reduce((sum, section) => sum + section.conversations.length, 0);\n\n useArrows(\n ulRef,\n {\n selector\n },\n [totalConversations, data[0]?.conversations.length]\n );\n\n useItemIntersection(\n ulRef,\n totalConversations - 1,\n () => {\n if (!loading) loadMore?.();\n },\n selector\n );\n\n useOuterEvent('mousedown', [ulRef.current], () => {\n focusInMessageListRef.current = false;\n });\n\n useEffect(() => {\n if (backButtonRef.current) backButtonRef.current.focus();\n }, []);\n\n const loadingOrEmptyElement = loading ? (\n <Progress placement='block' liveConfig={{ contextualLabel: t('conversation') }} />\n ) : (\n <EmptyState message={t('no_conversations_found')} />\n );\n\n const renderComponent =\n data.length > 0 ? (\n <StyledList\n container={{ direction: 'column', pad: [undefined, undefined, 1], gap: 1 }}\n forwardedAs='ul'\n aria-label={`${t('history')} ${t('view')}`}\n onFocus={() => {\n if (selectedItemId && !focusInMessageListRef.current) {\n focusInMessageListRef.current = true;\n ulRef.current?.querySelector<HTMLLIElement>(`li[id=\"${selectedItemId}\"]`)?.focus();\n }\n }}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key === 'Tab') {\n focusInMessageListRef.current = false;\n if (e.shiftKey) {\n const prevElement = ulRef.current?.previousElementSibling;\n if (prevElement) {\n const focusables = getFocusables(prevElement);\n if (focusables.length) {\n e.preventDefault();\n focusables[focusables.length - 1].focus();\n }\n }\n }\n }\n }}\n item={{ grow: 1 }}\n ref={ulRef}\n >\n {data.map(item => {\n return (\n <Flex\n data-testid={testIds.historyGroup}\n container={{ direction: 'column' }}\n as='li'\n role='presentation'\n key={item.id}\n >\n <Flex\n container={{ alignItems: 'center', pad: [0.5, 1] }}\n as={StyledGroupHeader}\n id={item.id}\n >\n {item.section}\n </Flex>\n\n <ul aria-labelledby={item.id}>\n {item.conversations.map(conversation => {\n const activeElement = selectedItemId === conversation.id;\n return (\n <StyledHistorySummaryListItem\n key={conversation.id}\n id={conversation.id}\n forwardedAs='li'\n aria-selected={activeElement}\n primary={<Text>{conversation.title}</Text>}\n onClick={() => {\n onItemClick?.(conversation.id);\n }}\n aria-label={conversation.title}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n onItemClick?.(conversation.id);\n e.preventDefault();\n }\n }}\n />\n );\n })}\n </ul>\n </Flex>\n );\n })}\n {loading && <StyledLoadingItem>{loadingOrEmptyElement}</StyledLoadingItem>}\n </StyledList>\n ) : (\n loadingOrEmptyElement\n );\n\n return (\n <StyledHistoryContainer\n {...restProps}\n data-testid={testIds.root}\n container={{ direction: 'column' }}\n inFullPage={inFullPage}\n item={{ grow: 1 }}\n ref={ref}\n >\n <Flex\n container={{\n pad: 1,\n gap: 2,\n justify: 'start',\n alignItems: 'center'\n }}\n >\n <Button\n data-testid={testIds.back}\n label={t('back')}\n icon\n variant='simple'\n onClick={onDismiss}\n ref={backButtonRef}\n >\n <Icon name={rtl ? 'arrow-right' : 'arrow-left'} />\n </Button>\n\n <Text variant='h2'>{t('history')}</Text>\n </Flex>\n\n {error ? <ErrorState message={error} /> : renderComponent}\n </StyledHistoryContainer>\n );\n }\n);\n\nexport default ConversationHistory;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FunctionComponent } from 'react';
|
|
2
2
|
import { type GenAICoachProps } from '.';
|
|
3
3
|
declare const _default: FunctionComponent<GenAICoachProps> & {
|
|
4
|
-
getTestIds: (testIdProp?:
|
|
4
|
+
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["user-message", "coach-message", "actions"]>;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
7
7
|
//# sourceMappingURL=GenAICoach.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAwD5D,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,GAAG,CAAC;;;;AAurBhF,wBAA6D"}
|