@pega/cosmos-react-work 5.0.0-dev.4.9 → 5.0.0-dev.6.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 +23 -0
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -0
- package/lib/components/AppAnnouncement/AppAnnouncement.js +93 -0
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -0
- package/lib/components/AppAnnouncement/index.d.ts +3 -0
- package/lib/components/AppAnnouncement/index.d.ts.map +1 -0
- package/lib/components/AppAnnouncement/index.js +2 -0
- package/lib/components/AppAnnouncement/index.js.map +1 -0
- package/lib/components/Article/Article.d.ts +60 -0
- package/lib/components/Article/Article.d.ts.map +1 -0
- package/lib/components/Article/Article.js +87 -0
- package/lib/components/Article/Article.js.map +1 -0
- package/lib/components/Article/ArticleFooter.d.ts +38 -0
- package/lib/components/Article/ArticleFooter.d.ts.map +1 -0
- package/lib/components/Article/ArticleFooter.js +58 -0
- package/lib/components/Article/ArticleFooter.js.map +1 -0
- package/lib/components/Article/ArticleMeta.d.ts +13 -0
- package/lib/components/Article/ArticleMeta.d.ts.map +1 -0
- package/lib/components/Article/ArticleMeta.js +27 -0
- package/lib/components/Article/ArticleMeta.js.map +1 -0
- package/lib/components/Article/ArticleRating.d.ts +13 -0
- package/lib/components/Article/ArticleRating.d.ts.map +1 -0
- package/lib/components/Article/ArticleRating.js +43 -0
- package/lib/components/Article/ArticleRating.js.map +1 -0
- package/lib/components/Article/index.d.ts +7 -0
- package/lib/components/Article/index.d.ts.map +1 -0
- package/lib/components/Article/index.js +4 -0
- package/lib/components/Article/index.js.map +1 -0
- package/lib/components/ArticleList/ArticleBuddy.d.ts +9 -0
- package/lib/components/ArticleList/ArticleBuddy.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleBuddy.js +57 -0
- package/lib/components/ArticleList/ArticleBuddy.js.map +1 -0
- package/lib/components/ArticleList/ArticleList.d.ts +6 -0
- package/lib/components/ArticleList/ArticleList.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleList.js +146 -0
- package/lib/components/ArticleList/ArticleList.js.map +1 -0
- package/lib/components/ArticleList/ArticleList.types.d.ts +128 -0
- package/lib/components/ArticleList/ArticleList.types.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleList.types.js +7 -0
- package/lib/components/ArticleList/ArticleList.types.js.map +1 -0
- package/lib/components/ArticleList/ArticleListFilter.d.ts +6 -0
- package/lib/components/ArticleList/ArticleListFilter.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleListFilter.js +67 -0
- package/lib/components/ArticleList/ArticleListFilter.js.map +1 -0
- package/lib/components/ArticleList/ArticleListHeader.d.ts +5 -0
- package/lib/components/ArticleList/ArticleListHeader.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleListHeader.js +20 -0
- package/lib/components/ArticleList/ArticleListHeader.js.map +1 -0
- package/lib/components/ArticleList/ArticleSummary.d.ts +7 -0
- package/lib/components/ArticleList/ArticleSummary.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleSummary.js +63 -0
- package/lib/components/ArticleList/ArticleSummary.js.map +1 -0
- package/lib/components/ArticleList/index.d.ts +8 -0
- package/lib/components/ArticleList/index.d.ts.map +1 -0
- package/lib/components/ArticleList/index.js +5 -0
- package/lib/components/ArticleList/index.js.map +1 -0
- package/lib/components/Assignments/Assignments.d.ts +21 -0
- package/lib/components/Assignments/Assignments.d.ts.map +1 -0
- package/lib/components/Assignments/Assignments.js +20 -0
- package/lib/components/Assignments/Assignments.js.map +1 -0
- package/lib/components/Assignments/Assignments.styles.d.ts +8 -0
- package/lib/components/Assignments/Assignments.styles.d.ts.map +1 -0
- package/lib/components/Assignments/Assignments.styles.js +41 -0
- package/lib/components/Assignments/Assignments.styles.js.map +1 -0
- package/lib/components/Assignments/index.d.ts +3 -0
- package/lib/components/Assignments/index.d.ts.map +1 -0
- package/lib/components/Assignments/index.js +2 -0
- package/lib/components/Assignments/index.js.map +1 -0
- package/lib/components/CasePreview/CasePreview.d.ts +27 -0
- package/lib/components/CasePreview/CasePreview.d.ts.map +1 -0
- package/lib/components/CasePreview/CasePreview.js +82 -0
- package/lib/components/CasePreview/CasePreview.js.map +1 -0
- package/lib/components/CasePreview/CasePreview.test-ids.d.ts +2 -0
- package/lib/components/CasePreview/CasePreview.test-ids.d.ts.map +1 -0
- package/lib/components/CasePreview/CasePreview.test-ids.js +3 -0
- package/lib/components/CasePreview/CasePreview.test-ids.js.map +1 -0
- package/lib/components/CasePreview/index.d.ts +3 -0
- package/lib/components/CasePreview/index.d.ts.map +1 -0
- package/lib/components/CasePreview/index.js +2 -0
- package/lib/components/CasePreview/index.js.map +1 -0
- package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts +4 -0
- package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -0
- package/lib/components/CaseView/CaseHeader/CaseHeader.js +127 -0
- package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -0
- package/lib/components/CaseView/CaseHeader/Summary.d.ts +6 -0
- package/lib/components/CaseView/CaseHeader/Summary.d.ts.map +1 -0
- package/lib/components/CaseView/CaseHeader/Summary.js +182 -0
- package/lib/components/CaseView/CaseHeader/Summary.js.map +1 -0
- package/lib/components/CaseView/CaseSummary.d.ts +4 -0
- package/lib/components/CaseView/CaseSummary.d.ts.map +1 -0
- package/lib/components/CaseView/CaseSummary.js +18 -0
- package/lib/components/CaseView/CaseSummary.js.map +1 -0
- package/lib/components/CaseView/CaseSummaryFields.d.ts +6 -0
- package/lib/components/CaseView/CaseSummaryFields.d.ts.map +1 -0
- package/lib/components/CaseView/CaseSummaryFields.js +18 -0
- package/lib/components/CaseView/CaseSummaryFields.js.map +1 -0
- package/lib/components/CaseView/CaseView.context.d.ts +5 -0
- package/lib/components/CaseView/CaseView.context.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.context.js +5 -0
- package/lib/components/CaseView/CaseView.context.js.map +1 -0
- package/lib/components/CaseView/CaseView.d.ts +8 -0
- package/lib/components/CaseView/CaseView.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.js +421 -0
- package/lib/components/CaseView/CaseView.js.map +1 -0
- package/lib/components/CaseView/CaseView.styles.d.ts +45 -0
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.styles.js +559 -0
- package/lib/components/CaseView/CaseView.styles.js.map +1 -0
- package/lib/components/CaseView/CaseView.test-ids.d.ts +2 -0
- package/lib/components/CaseView/CaseView.test-ids.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.test-ids.js +18 -0
- package/lib/components/CaseView/CaseView.test-ids.js.map +1 -0
- package/lib/components/CaseView/CaseView.types.d.ts +98 -0
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.types.js +2 -0
- package/lib/components/CaseView/CaseView.types.js.map +1 -0
- package/lib/components/CaseView/UtilitiesSummary.d.ts +9 -0
- package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -0
- package/lib/components/CaseView/UtilitiesSummary.js +53 -0
- package/lib/components/CaseView/UtilitiesSummary.js.map +1 -0
- package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts +9 -0
- package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts.map +1 -0
- package/lib/components/CaseView/UtilitySummaryItemDialog.js +33 -0
- package/lib/components/CaseView/UtilitySummaryItemDialog.js.map +1 -0
- package/lib/components/CaseView/index.d.ts +5 -0
- package/lib/components/CaseView/index.d.ts.map +1 -0
- package/lib/components/CaseView/index.js +4 -0
- package/lib/components/CaseView/index.js.map +1 -0
- package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts +4 -0
- package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts.map +1 -0
- package/lib/components/ConfigurableLayout/ConfigurableLayout.js +86 -0
- package/lib/components/ConfigurableLayout/ConfigurableLayout.js.map +1 -0
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts +41 -0
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts.map +1 -0
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.js +2 -0
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.js.map +1 -0
- package/lib/components/ConfigurableLayout/LayoutCell.d.ts +6 -0
- package/lib/components/ConfigurableLayout/LayoutCell.d.ts.map +1 -0
- package/lib/components/ConfigurableLayout/LayoutCell.js +64 -0
- package/lib/components/ConfigurableLayout/LayoutCell.js.map +1 -0
- package/lib/components/ConfigurableLayout/defaults.d.ts +4 -0
- package/lib/components/ConfigurableLayout/defaults.d.ts.map +1 -0
- package/lib/components/ConfigurableLayout/defaults.js +4 -0
- package/lib/components/ConfigurableLayout/defaults.js.map +1 -0
- package/lib/components/ConfigurableLayout/index.d.ts +4 -0
- package/lib/components/ConfigurableLayout/index.d.ts.map +1 -0
- package/lib/components/ConfigurableLayout/index.js +3 -0
- package/lib/components/ConfigurableLayout/index.js.map +1 -0
- package/lib/components/ConfigurableLayout/options.d.ts +10 -0
- package/lib/components/ConfigurableLayout/options.d.ts.map +1 -0
- package/lib/components/ConfigurableLayout/options.js +10 -0
- package/lib/components/ConfigurableLayout/options.js.map +1 -0
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts +7 -0
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +1 -0
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.js +37 -0
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.js.map +1 -0
- package/lib/components/Confirmation/Confirmation.d.ts +19 -0
- package/lib/components/Confirmation/Confirmation.d.ts.map +1 -0
- package/lib/components/Confirmation/Confirmation.js +29 -0
- package/lib/components/Confirmation/Confirmation.js.map +1 -0
- package/lib/components/Confirmation/index.d.ts +3 -0
- package/lib/components/Confirmation/index.d.ts.map +1 -0
- package/lib/components/Confirmation/index.js +2 -0
- package/lib/components/Confirmation/index.js.map +1 -0
- package/lib/components/Details/Details.d.ts +43 -0
- package/lib/components/Details/Details.d.ts.map +1 -0
- package/lib/components/Details/Details.js +95 -0
- package/lib/components/Details/Details.js.map +1 -0
- package/lib/components/Details/Details.styles.d.ts +50 -0
- package/lib/components/Details/Details.styles.d.ts.map +1 -0
- package/lib/components/Details/Details.styles.js +204 -0
- package/lib/components/Details/Details.styles.js.map +1 -0
- package/lib/components/Details/Details.test-ids.d.ts +2 -0
- package/lib/components/Details/Details.test-ids.d.ts.map +1 -0
- package/lib/components/Details/Details.test-ids.js +9 -0
- package/lib/components/Details/Details.test-ids.js.map +1 -0
- package/lib/components/Details/DetailsContext.d.ts +9 -0
- package/lib/components/Details/DetailsContext.d.ts.map +1 -0
- package/lib/components/Details/DetailsContext.js +9 -0
- package/lib/components/Details/DetailsContext.js.map +1 -0
- package/lib/components/Details/index.d.ts +4 -0
- package/lib/components/Details/index.d.ts.map +1 -0
- package/lib/components/Details/index.js +4 -0
- package/lib/components/Details/index.js.map +1 -0
- package/lib/components/Glimpse/Glimpse.d.ts +20 -0
- package/lib/components/Glimpse/Glimpse.d.ts.map +1 -0
- package/lib/components/Glimpse/Glimpse.js +12 -0
- package/lib/components/Glimpse/Glimpse.js.map +1 -0
- package/lib/components/Glimpse/index.d.ts +3 -0
- package/lib/components/Glimpse/index.d.ts.map +1 -0
- package/lib/components/Glimpse/index.js +2 -0
- package/lib/components/Glimpse/index.js.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts +6 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js +83 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +9 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +199 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts +35 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js +2 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js.map +1 -0
- package/lib/components/IntelligentGuidance/index.d.ts +3 -0
- package/lib/components/IntelligentGuidance/index.d.ts.map +1 -0
- package/lib/components/IntelligentGuidance/index.js +2 -0
- package/lib/components/IntelligentGuidance/index.js.map +1 -0
- package/lib/components/Predictions/Predictions.d.ts +6 -0
- package/lib/components/Predictions/Predictions.d.ts.map +1 -0
- package/lib/components/Predictions/Predictions.js +68 -0
- package/lib/components/Predictions/Predictions.js.map +1 -0
- package/lib/components/Predictions/Predictions.types.d.ts +23 -0
- package/lib/components/Predictions/Predictions.types.d.ts.map +1 -0
- package/lib/components/Predictions/Predictions.types.js +2 -0
- package/lib/components/Predictions/Predictions.types.js.map +1 -0
- package/lib/components/Predictions/index.d.ts +3 -0
- package/lib/components/Predictions/index.d.ts.map +1 -0
- package/lib/components/Predictions/index.js +2 -0
- package/lib/components/Predictions/index.js.map +1 -0
- package/lib/components/SearchResults/Filter.d.ts +8 -0
- package/lib/components/SearchResults/Filter.d.ts.map +1 -0
- package/lib/components/SearchResults/Filter.js +45 -0
- package/lib/components/SearchResults/Filter.js.map +1 -0
- package/lib/components/SearchResults/SearchResult.d.ts +4 -0
- package/lib/components/SearchResults/SearchResult.d.ts.map +1 -0
- package/lib/components/SearchResults/SearchResult.js +27 -0
- package/lib/components/SearchResults/SearchResult.js.map +1 -0
- package/lib/components/SearchResults/SearchResults.d.ts +6 -0
- package/lib/components/SearchResults/SearchResults.d.ts.map +1 -0
- package/lib/components/SearchResults/SearchResults.js +121 -0
- package/lib/components/SearchResults/SearchResults.js.map +1 -0
- package/lib/components/SearchResults/SearchResults.styles.d.ts +11 -0
- package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -0
- package/lib/components/SearchResults/SearchResults.styles.js +88 -0
- package/lib/components/SearchResults/SearchResults.styles.js.map +1 -0
- package/lib/components/SearchResults/SearchResults.types.d.ts +100 -0
- package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -0
- package/lib/components/SearchResults/SearchResults.types.js +2 -0
- package/lib/components/SearchResults/SearchResults.types.js.map +1 -0
- package/lib/components/SearchResults/index.d.ts +3 -0
- package/lib/components/SearchResults/index.d.ts.map +1 -0
- package/lib/components/SearchResults/index.js +2 -0
- package/lib/components/SearchResults/index.js.map +1 -0
- package/lib/components/Stages/StageGlimpse.d.ts +8 -0
- package/lib/components/Stages/StageGlimpse.d.ts.map +1 -0
- package/lib/components/Stages/StageGlimpse.js +11 -0
- package/lib/components/Stages/StageGlimpse.js.map +1 -0
- package/lib/components/Stages/Stages.d.ts +6 -0
- package/lib/components/Stages/Stages.d.ts.map +1 -0
- package/lib/components/Stages/Stages.js +107 -0
- package/lib/components/Stages/Stages.js.map +1 -0
- package/lib/components/Stages/Stages.styles.d.ts +14 -0
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -0
- package/lib/components/Stages/Stages.styles.js +270 -0
- package/lib/components/Stages/Stages.styles.js.map +1 -0
- package/lib/components/Stages/Stages.types.d.ts +38 -0
- package/lib/components/Stages/Stages.types.d.ts.map +1 -0
- package/lib/components/Stages/Stages.types.js +2 -0
- package/lib/components/Stages/Stages.types.js.map +1 -0
- package/lib/components/Stages/index.d.ts +3 -0
- package/lib/components/Stages/index.d.ts.map +1 -0
- package/lib/components/Stages/index.js +2 -0
- package/lib/components/Stages/index.js.map +1 -0
- package/lib/components/Stakeholders/StakeholderForm.d.ts +7 -0
- package/lib/components/Stakeholders/StakeholderForm.d.ts.map +1 -0
- package/lib/components/Stakeholders/StakeholderForm.js +49 -0
- package/lib/components/Stakeholders/StakeholderForm.js.map +1 -0
- package/lib/components/Stakeholders/Stakeholders.d.ts +6 -0
- package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -0
- package/lib/components/Stakeholders/Stakeholders.js +220 -0
- package/lib/components/Stakeholders/Stakeholders.js.map +1 -0
- package/lib/components/Stakeholders/Stakeholders.types.d.ts +75 -0
- package/lib/components/Stakeholders/Stakeholders.types.d.ts.map +1 -0
- package/lib/components/Stakeholders/Stakeholders.types.js +2 -0
- package/lib/components/Stakeholders/Stakeholders.types.js.map +1 -0
- package/lib/components/Stakeholders/index.d.ts +3 -0
- package/lib/components/Stakeholders/index.d.ts.map +1 -0
- package/lib/components/Stakeholders/index.js +2 -0
- package/lib/components/Stakeholders/index.js.map +1 -0
- package/lib/components/Tags/Tags.d.ts +34 -0
- package/lib/components/Tags/Tags.d.ts.map +1 -0
- package/lib/components/Tags/Tags.js +230 -0
- package/lib/components/Tags/Tags.js.map +1 -0
- package/lib/components/Tags/index.d.ts +3 -0
- package/lib/components/Tags/index.d.ts.map +1 -0
- package/lib/components/Tags/index.js +2 -0
- package/lib/components/Tags/index.js.map +1 -0
- package/lib/components/Tasks/TaskList.d.ts +39 -0
- package/lib/components/Tasks/TaskList.d.ts.map +1 -0
- package/lib/components/Tasks/TaskList.js +71 -0
- package/lib/components/Tasks/TaskList.js.map +1 -0
- package/lib/components/Tasks/Tasks.d.ts +29 -0
- package/lib/components/Tasks/Tasks.d.ts.map +1 -0
- package/lib/components/Tasks/Tasks.js +52 -0
- package/lib/components/Tasks/Tasks.js.map +1 -0
- package/lib/components/Tasks/Tasks.test-ids.d.ts +4 -0
- package/lib/components/Tasks/Tasks.test-ids.d.ts.map +1 -0
- package/lib/components/Tasks/Tasks.test-ids.js +5 -0
- package/lib/components/Tasks/Tasks.test-ids.js.map +1 -0
- package/lib/components/Tasks/index.d.ts +6 -0
- package/lib/components/Tasks/index.d.ts.map +1 -0
- package/lib/components/Tasks/index.js +4 -0
- package/lib/components/Tasks/index.js.map +1 -0
- package/lib/components/Timeline/Timeline.d.ts +6 -0
- package/lib/components/Timeline/Timeline.d.ts.map +1 -0
- package/lib/components/Timeline/Timeline.js +26 -0
- package/lib/components/Timeline/Timeline.js.map +1 -0
- package/lib/components/Timeline/Timeline.styles.d.ts +21 -0
- package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -0
- package/lib/components/Timeline/Timeline.styles.js +165 -0
- package/lib/components/Timeline/Timeline.styles.js.map +1 -0
- package/lib/components/Timeline/Timeline.types.d.ts +66 -0
- package/lib/components/Timeline/Timeline.types.d.ts.map +1 -0
- package/lib/components/Timeline/Timeline.types.js +2 -0
- package/lib/components/Timeline/Timeline.types.js.map +1 -0
- package/lib/components/Timeline/TimelineItem.d.ts +13 -0
- package/lib/components/Timeline/TimelineItem.d.ts.map +1 -0
- package/lib/components/Timeline/TimelineItem.js +33 -0
- package/lib/components/Timeline/TimelineItem.js.map +1 -0
- package/lib/components/Timeline/TimelineToolbar.d.ts +6 -0
- package/lib/components/Timeline/TimelineToolbar.d.ts.map +1 -0
- package/lib/components/Timeline/TimelineToolbar.js +68 -0
- package/lib/components/Timeline/TimelineToolbar.js.map +1 -0
- package/lib/components/Timeline/index.d.ts +4 -0
- package/lib/components/Timeline/index.d.ts.map +1 -0
- package/lib/components/Timeline/index.js +3 -0
- package/lib/components/Timeline/index.js.map +1 -0
- package/lib/components/Timeline/utils.d.ts +15 -0
- package/lib/components/Timeline/utils.d.ts.map +1 -0
- package/lib/components/Timeline/utils.js +75 -0
- package/lib/components/Timeline/utils.js.map +1 -0
- package/lib/index.d.ts +37 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +38 -0
- package/lib/index.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo, useState, useEffect, useRef } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { defaultThemeProp, Modal, Tag, Button, useI18n, Count, Flex, Text, CardHeader, Card, Actions, Icon, registerIcon, CardContent, Progress, EmptyState, ErrorState, Popover, Menu, useModalManager, useModalContext, useConsolidatedRef, CardFooter, Banner } from '@pega/cosmos-react-core';
|
|
5
|
+
import * as tagIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/tag.icon';
|
|
6
|
+
import { StyledTag } from '@pega/cosmos-react-core/lib/components/Badges/Tag';
|
|
7
|
+
import { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';
|
|
8
|
+
import MultiSelectInput from '@pega/cosmos-react-core/lib/components/ComboBox/MultiSelectInput/MultiSelectInput';
|
|
9
|
+
import { StyledCardFooter } from '@pega/cosmos-react-core/lib/components/Card/CardFooter';
|
|
10
|
+
registerIcon(tagIcon);
|
|
11
|
+
export const StyledTags = styled.article(({ isLoading, theme, viewAll }) => {
|
|
12
|
+
return css `
|
|
13
|
+
${StyledCardContent} {
|
|
14
|
+
max-height: ${viewAll ? 'fit-content' : '10rem'};
|
|
15
|
+
overflow-y: hidden;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
${StyledCardFooter} {
|
|
19
|
+
margin-block-start: ${theme.base.spacing};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
${StyledTag} {
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
${StyledTag} + ${StyledTag} {
|
|
27
|
+
margin-inline-start: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
${isLoading &&
|
|
31
|
+
css `
|
|
32
|
+
& > ${StyledCardContent} {
|
|
33
|
+
height: 4rem;
|
|
34
|
+
}
|
|
35
|
+
`}
|
|
36
|
+
`;
|
|
37
|
+
});
|
|
38
|
+
StyledTags.defaultProps = defaultThemeProp;
|
|
39
|
+
const StyledMenuPopover = styled.div `
|
|
40
|
+
width: 40ch;
|
|
41
|
+
`;
|
|
42
|
+
const StyledBanner = styled(Banner)(({ theme }) => {
|
|
43
|
+
return css `
|
|
44
|
+
padding-block-end: calc(2 * ${theme.base.spacing});
|
|
45
|
+
`;
|
|
46
|
+
});
|
|
47
|
+
StyledBanner.defaultProps = defaultThemeProp;
|
|
48
|
+
const EditTagModal = ({ tags, availableTags = [], onSearch, onEditTags }) => {
|
|
49
|
+
const { dismiss } = useModalContext();
|
|
50
|
+
const inputRef = useRef(null);
|
|
51
|
+
const [filterValue, setFilterValue] = useState('');
|
|
52
|
+
const [editError, setEditError] = useState('');
|
|
53
|
+
const [selected, setSelected] = useState([]);
|
|
54
|
+
const [items, setItems] = useState([]);
|
|
55
|
+
const [pauseSelectedDescendantEvaluation, setPauseSelectedDescendantEvaluation] = useState(true);
|
|
56
|
+
const t = useI18n();
|
|
57
|
+
const showMenu = !!filterValue && !!items?.length;
|
|
58
|
+
const selectedTagValues = useMemo(() => {
|
|
59
|
+
return selected.map(({ text }) => {
|
|
60
|
+
return { id: text, text };
|
|
61
|
+
});
|
|
62
|
+
}, [selected]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (showMenu) {
|
|
65
|
+
setPauseSelectedDescendantEvaluation(true);
|
|
66
|
+
}
|
|
67
|
+
}, [showMenu]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
setSelected(tags.map(tag => {
|
|
70
|
+
return { text: tag };
|
|
71
|
+
}));
|
|
72
|
+
}, [tags]);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
const menuItems = availableTags
|
|
75
|
+
.filter(tag => !selected.some(x => x.text === tag))
|
|
76
|
+
.map(tag => {
|
|
77
|
+
return { id: tag, primary: tag };
|
|
78
|
+
});
|
|
79
|
+
if (filterValue &&
|
|
80
|
+
!menuItems.some(x => x.id === filterValue) &&
|
|
81
|
+
!selected.some(x => x.text === filterValue)) {
|
|
82
|
+
menuItems.push({
|
|
83
|
+
id: `custom:${filterValue}`,
|
|
84
|
+
primary: t('use_input_value', [filterValue])
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
setItems(menuItems);
|
|
88
|
+
}, [availableTags, filterValue, selected]);
|
|
89
|
+
const setInputValue = (value) => {
|
|
90
|
+
setEditError('');
|
|
91
|
+
setFilterValue(value);
|
|
92
|
+
onSearch?.(value);
|
|
93
|
+
};
|
|
94
|
+
const addTag = (tag) => {
|
|
95
|
+
if (tag && !selected.find(x => x.text === tag)) {
|
|
96
|
+
if (items.find(x => x.id === tag)) {
|
|
97
|
+
setSelected(curr => [...curr, { text: tag }]);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
setSelected(curr => [...curr, { text: tag, newTag: true }]);
|
|
101
|
+
}
|
|
102
|
+
setInputValue('');
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const handlePaste = (e) => {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
const potentialTags = e.clipboardData.getData('Text').split(' ');
|
|
108
|
+
potentialTags.forEach(potentialTag => {
|
|
109
|
+
addTag(potentialTag);
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const handleKeyDown = (e) => {
|
|
113
|
+
if (e.key === ' ') {
|
|
114
|
+
addTag(filterValue);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
return (_jsxs(Modal, { heading: t('edit_tags'), actions: _jsxs(_Fragment, { children: [_jsx(Button, { onClick: dismiss, children: t('cancel') }), _jsx(Button, { variant: 'primary', onClick: () => {
|
|
118
|
+
onEditTags(selected)
|
|
119
|
+
.then(dismiss)
|
|
120
|
+
.catch((error) => {
|
|
121
|
+
if (error instanceof Error) {
|
|
122
|
+
setEditError(error.message || t('unknown_error'));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
setEditError(t('unknown_error'));
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}, children: t('submit') })] }), children: [editError && (_jsx(StyledBanner, { id: 'edit-tags-error', variant: 'urgent', messages: [editError], onDismiss: () => {
|
|
129
|
+
setEditError('');
|
|
130
|
+
} })), _jsx(MultiSelectInput, { ref: inputRef, selected: selectedTagValues, value: filterValue, onChange: (e) => {
|
|
131
|
+
setInputValue(e.target.value.trim());
|
|
132
|
+
}, onRemove: (id, index) => {
|
|
133
|
+
if (selected[index].text === id) {
|
|
134
|
+
const updatedSelected = [...selected];
|
|
135
|
+
updatedSelected.splice(index, 1);
|
|
136
|
+
setSelected(updatedSelected);
|
|
137
|
+
setEditError('');
|
|
138
|
+
}
|
|
139
|
+
}, onBlur: () => {
|
|
140
|
+
setPauseSelectedDescendantEvaluation(true);
|
|
141
|
+
setInputValue('');
|
|
142
|
+
}, onPaste: handlePaste, onKeyDown: handleKeyDown, onSelectedBlur: () => {
|
|
143
|
+
setPauseSelectedDescendantEvaluation(true);
|
|
144
|
+
}, onSelectedFocus: () => {
|
|
145
|
+
setPauseSelectedDescendantEvaluation(false);
|
|
146
|
+
}, pauseDescendantEvaluation: pauseSelectedDescendantEvaluation, autoFocus: true }), _jsx(Popover, { as: StyledMenuPopover, show: showMenu, target: inputRef.current, placement: 'bottom-start', onMouseDown: (e) => e.preventDefault(), children: _jsx(Menu, { role: 'listbox', mode: 'action', items: items, focusControlEl: inputRef.current || undefined, onItemClick: id => {
|
|
147
|
+
if (id.includes('custom:')) {
|
|
148
|
+
const tagValue = id.replace('custom:', '');
|
|
149
|
+
if (!selected.some(x => x.text === tagValue)) {
|
|
150
|
+
setSelected(curr => [...curr, { text: tagValue, newTag: true }]);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
setSelected(curr => [...curr, { text: id }]);
|
|
155
|
+
}
|
|
156
|
+
setInputValue('');
|
|
157
|
+
}, arrowNavigationUnsupported: true }) })] }));
|
|
158
|
+
};
|
|
159
|
+
const Tags = forwardRef(function Tags({ tags, availableTags, loading, error, onSearch, onTagClick, onEditTags, ...restProps }, ref) {
|
|
160
|
+
const { create: createModal } = useModalManager();
|
|
161
|
+
const editModalMethods = useRef();
|
|
162
|
+
const containerRef = useRef(null);
|
|
163
|
+
const contentRef = useRef(null);
|
|
164
|
+
const consolidatedRef = useConsolidatedRef(containerRef, ref);
|
|
165
|
+
const [footer, setFooter] = useState(false);
|
|
166
|
+
const [viewAll, setViewAll] = useState(false);
|
|
167
|
+
const t = useI18n();
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (containerRef.current && contentRef.current) {
|
|
170
|
+
if (contentRef.current.getBoundingClientRect().bottom >
|
|
171
|
+
containerRef.current.getBoundingClientRect().bottom) {
|
|
172
|
+
setFooter(true);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
setFooter(false);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, [containerRef.current, contentRef.current, tags]);
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
if (!onEditTags) {
|
|
181
|
+
editModalMethods.current?.dismiss();
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
editModalMethods.current?.update({
|
|
185
|
+
tags,
|
|
186
|
+
availableTags,
|
|
187
|
+
onSearch,
|
|
188
|
+
onEditTags
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}, [availableTags, tags, onSearch, onEditTags]);
|
|
192
|
+
const openEditModal = () => {
|
|
193
|
+
if (!onEditTags)
|
|
194
|
+
return;
|
|
195
|
+
editModalMethods.current = createModal(EditTagModal, {
|
|
196
|
+
tags,
|
|
197
|
+
availableTags,
|
|
198
|
+
onSearch,
|
|
199
|
+
onEditTags
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
const content = useMemo(() => {
|
|
203
|
+
if (loading) {
|
|
204
|
+
return _jsx(Progress, { placement: 'local' });
|
|
205
|
+
}
|
|
206
|
+
if (error) {
|
|
207
|
+
if (typeof error === 'boolean')
|
|
208
|
+
return _jsx(ErrorState, {});
|
|
209
|
+
if (typeof error === 'string')
|
|
210
|
+
return _jsx(ErrorState, { message: error });
|
|
211
|
+
return _jsx(ErrorState, { ...error });
|
|
212
|
+
}
|
|
213
|
+
return tags.length > 0 ? (_jsx(Flex, { ref: contentRef, container: { gap: 1, wrap: 'wrap' }, children: tags.map(tag => {
|
|
214
|
+
return (_jsx(Tag, { onClick: () => onTagClick?.(tag), children: tag }, tag));
|
|
215
|
+
}) })) : (_jsx(EmptyState, {}));
|
|
216
|
+
}, [loading, error, tags]);
|
|
217
|
+
return (_jsxs(Card, { ref: consolidatedRef, ...restProps, as: StyledTags, viewAll: viewAll, isLoading: loading, children: [_jsxs(CardHeader, { children: [_jsxs(Flex, { container: { alignItems: 'center', gap: 1 }, children: [_jsx(Icon, { name: 'tag' }), _jsx(Text, { variant: 'h3', children: t('tags') }), _jsx(Count, { children: tags.length })] }), _jsx(Actions, { items: onEditTags
|
|
218
|
+
? [
|
|
219
|
+
{
|
|
220
|
+
id: 'editTags',
|
|
221
|
+
text: t('edit'),
|
|
222
|
+
icon: 'pencil',
|
|
223
|
+
onClick: openEditModal,
|
|
224
|
+
disabled: !!error
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
: [], contextualLabel: t('tags') })] }), _jsx(CardContent, { children: content }), footer && (_jsx(CardFooter, { justify: 'center', children: _jsx(Button, { variant: 'link', onClick: () => setViewAll(curr => !curr), children: viewAll ? t('view_less') : t('view_all') }) }))] }));
|
|
228
|
+
});
|
|
229
|
+
export default Tags;
|
|
230
|
+
//# sourceMappingURL=Tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tags.js","sourceRoot":"","sources":["../../../src/components/Tags/Tags.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AASzE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,KAAK,EACL,GAAG,EACH,MAAM,EACN,OAAO,EACP,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,UAAU,EACV,UAAU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ef } from 'react';\nimport type {\n ChangeEvent,\n ClipboardEvent,\n KeyboardEvent,\n FunctionComponent,\n PropsWithoutRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n Modal,\n Tag,\n Button,\n useI18n,\n Count,\n Flex,\n Text,\n CardHeader,\n Card,\n Actions,\n Icon,\n registerIcon,\n CardContent,\n Progress,\n EmptyState,\n ErrorState,\n Popover,\n Menu,\n useModalManager,\n useModalContext,\n useConsolidatedRef,\n CardFooter,\n Banner\n} from '@pega/cosmos-react-core';\nimport type {\n BaseProps,\n ForwardProps,\n ModalMethods,\n MenuProps,\n ErrorStateProps,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport * as tagIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/tag.icon';\nimport { StyledTag } from '@pega/cosmos-react-core/lib/components/Badges/Tag';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport MultiSelectInput from '@pega/cosmos-react-core/lib/components/ComboBox/MultiSelectInput/MultiSelectInput';\nimport { StyledCardFooter } from '@pega/cosmos-react-core/lib/components/Card/CardFooter';\n\nregisterIcon(tagIcon);\n\nexport interface SelectedTag {\n text: string;\n newTag?: boolean;\n}\n\nexport interface TagsProps extends BaseProps, NoChildrenProp {\n /** A list of tags. */\n tags: string[];\n /**\n * A list of available tags to add from.\n * @default []\n */\n availableTags?: string[];\n /** If true, a loading indicator will render in place of the tags list. */\n loading?: boolean;\n /** If defined, an error message will render in the component and actions will be disabled. */\n error?: boolean | string | ErrorStateProps;\n /** Callback triggered when a search query is changed in the Edit tags modal. */\n onSearch?: (filterValue: string) => void;\n /** Callback triggered when a tag is clicked. */\n onTagClick?: (tag: string) => void;\n /** Callback triggered when modified tags are submitted from the modal. */\n onEditTags?: (tags: SelectedTag[]) => Promise<void>;\n /** Ref for the Tags card. */\n ref?: Ref<HTMLElement>;\n}\n\ninterface EditTagModalProps {\n tags: TagsProps['tags'];\n availableTags: TagsProps['availableTags'];\n onSearch?: TagsProps['onSearch'];\n onEditTags: NonNullable<TagsProps['onEditTags']>;\n}\n\nexport const StyledTags = styled.article<{ isLoading?: boolean; viewAll?: boolean }>(\n ({ isLoading, theme, viewAll }) => {\n return css`\n ${StyledCardContent} {\n max-height: ${viewAll ? 'fit-content' : '10rem'};\n overflow-y: hidden;\n }\n\n ${StyledCardFooter} {\n margin-block-start: ${theme.base.spacing};\n }\n\n ${StyledTag} {\n cursor: pointer;\n }\n\n ${StyledTag} + ${StyledTag} {\n margin-inline-start: 0;\n }\n\n ${isLoading &&\n css`\n & > ${StyledCardContent} {\n height: 4rem;\n }\n `}\n `;\n }\n);\n\nStyledTags.defaultProps = defaultThemeProp;\n\nconst StyledMenuPopover = styled.div`\n width: 40ch;\n`;\n\nconst StyledBanner = styled(Banner)(({ theme }) => {\n return css`\n padding-block-end: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledBanner.defaultProps = defaultThemeProp;\n\nconst EditTagModal = ({ tags, availableTags = [], onSearch, onEditTags }: EditTagModalProps) => {\n const { dismiss } = useModalContext();\n const inputRef = useRef<HTMLInputElement>(null);\n const [filterValue, setFilterValue] = useState('');\n const [editError, setEditError] = useState('');\n const [selected, setSelected] = useState<SelectedTag[]>([]);\n const [items, setItems] = useState<MenuProps['items']>([]);\n const [pauseSelectedDescendantEvaluation, setPauseSelectedDescendantEvaluation] = useState(true);\n const t = useI18n();\n\n const showMenu = !!filterValue && !!items?.length;\n\n const selectedTagValues = useMemo(() => {\n return selected.map(({ text }) => {\n return { id: text, text };\n });\n }, [selected]);\n\n useEffect(() => {\n if (showMenu) {\n setPauseSelectedDescendantEvaluation(true);\n }\n }, [showMenu]);\n\n useEffect(() => {\n setSelected(\n tags.map(tag => {\n return { text: tag };\n })\n );\n }, [tags]);\n\n useEffect(() => {\n const menuItems = availableTags\n .filter(tag => !selected.some(x => x.text === tag))\n .map(tag => {\n return { id: tag, primary: tag };\n });\n\n if (\n filterValue &&\n !menuItems.some(x => x.id === filterValue) &&\n !selected.some(x => x.text === filterValue)\n ) {\n menuItems.push({\n id: `custom:${filterValue}`,\n primary: t('use_input_value', [filterValue])\n });\n }\n\n setItems(menuItems);\n }, [availableTags, filterValue, selected]);\n\n const setInputValue = (value: string) => {\n setEditError('');\n setFilterValue(value);\n onSearch?.(value);\n };\n\n const addTag = (tag: string) => {\n if (tag && !selected.find(x => x.text === tag)) {\n if (items.find(x => x.id === tag)) {\n setSelected(curr => [...curr, { text: tag }]);\n } else {\n setSelected(curr => [...curr, { text: tag, newTag: true }]);\n }\n setInputValue('');\n }\n };\n\n const handlePaste = (e: ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n const potentialTags = e.clipboardData.getData('Text').split(' ');\n\n potentialTags.forEach(potentialTag => {\n addTag(potentialTag);\n });\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === ' ') {\n addTag(filterValue);\n }\n };\n\n return (\n <Modal\n heading={t('edit_tags')}\n actions={\n <>\n <Button onClick={dismiss}>{t('cancel')}</Button>\n <Button\n variant='primary'\n onClick={() => {\n onEditTags(selected)\n .then(dismiss)\n .catch((error: unknown) => {\n if (error instanceof Error) {\n setEditError(error.message || t('unknown_error'));\n } else {\n setEditError(t('unknown_error'));\n }\n });\n }}\n >\n {t('submit')}\n </Button>\n </>\n }\n >\n {editError && (\n <StyledBanner\n id='edit-tags-error'\n variant='urgent'\n messages={[editError]}\n onDismiss={() => {\n setEditError('');\n }}\n />\n )}\n <MultiSelectInput\n ref={inputRef}\n selected={selectedTagValues}\n value={filterValue}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n setInputValue(e.target.value.trim());\n }}\n onRemove={(id: string, index: number) => {\n if (selected[index].text === id) {\n const updatedSelected = [...selected];\n updatedSelected.splice(index, 1);\n setSelected(updatedSelected);\n setEditError('');\n }\n }}\n onBlur={() => {\n setPauseSelectedDescendantEvaluation(true);\n setInputValue('');\n }}\n onPaste={handlePaste}\n onKeyDown={handleKeyDown}\n onSelectedBlur={() => {\n setPauseSelectedDescendantEvaluation(true);\n }}\n onSelectedFocus={() => {\n setPauseSelectedDescendantEvaluation(false);\n }}\n pauseDescendantEvaluation={pauseSelectedDescendantEvaluation}\n autoFocus\n />\n <Popover\n as={StyledMenuPopover}\n show={showMenu}\n target={inputRef.current}\n placement='bottom-start'\n onMouseDown={(e: MouseEvent) => e.preventDefault()}\n >\n <Menu\n role='listbox'\n mode='action'\n items={items}\n focusControlEl={inputRef.current || undefined}\n onItemClick={id => {\n if (id.includes('custom:')) {\n const tagValue = id.replace('custom:', '');\n if (!selected.some(x => x.text === tagValue)) {\n setSelected(curr => [...curr, { text: tagValue, newTag: true }]);\n }\n } else {\n setSelected(curr => [...curr, { text: id }]);\n }\n setInputValue('');\n }}\n arrowNavigationUnsupported\n />\n </Popover>\n </Modal>\n );\n};\n\nconst Tags: FunctionComponent<TagsProps & ForwardProps> = forwardRef(function Tags(\n {\n tags,\n availableTags,\n loading,\n error,\n onSearch,\n onTagClick,\n onEditTags,\n ...restProps\n }: PropsWithoutRef<TagsProps>,\n ref: TagsProps['ref']\n) {\n const { create: createModal } = useModalManager();\n const editModalMethods = useRef<ModalMethods<EditTagModalProps>>();\n const containerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const consolidatedRef = useConsolidatedRef(containerRef, ref);\n const [footer, setFooter] = useState(false);\n const [viewAll, setViewAll] = useState(false);\n const t = useI18n();\n\n useEffect(() => {\n if (containerRef.current && contentRef.current) {\n if (\n contentRef.current.getBoundingClientRect().bottom >\n containerRef.current.getBoundingClientRect().bottom\n ) {\n setFooter(true);\n } else {\n setFooter(false);\n }\n }\n }, [containerRef.current, contentRef.current, tags]);\n\n useEffect(() => {\n if (!onEditTags) {\n editModalMethods.current?.dismiss();\n } else {\n editModalMethods.current?.update({\n tags,\n availableTags,\n onSearch,\n onEditTags\n });\n }\n }, [availableTags, tags, onSearch, onEditTags]);\n\n const openEditModal = () => {\n if (!onEditTags) return;\n\n editModalMethods.current = createModal(EditTagModal, {\n tags,\n availableTags,\n onSearch,\n onEditTags\n });\n };\n\n const content = useMemo(() => {\n if (loading) {\n return <Progress placement='local' />;\n }\n\n if (error) {\n if (typeof error === 'boolean') return <ErrorState />;\n if (typeof error === 'string') return <ErrorState message={error} />;\n return <ErrorState {...error} />;\n }\n\n return tags.length > 0 ? (\n <Flex ref={contentRef} container={{ gap: 1, wrap: 'wrap' }}>\n {tags.map(tag => {\n return (\n <Tag key={tag} onClick={() => onTagClick?.(tag)}>\n {tag}\n </Tag>\n );\n })}\n </Flex>\n ) : (\n <EmptyState />\n );\n }, [loading, error, tags]);\n\n return (\n <Card\n ref={consolidatedRef}\n {...restProps}\n as={StyledTags}\n viewAll={viewAll}\n isLoading={loading}\n >\n <CardHeader>\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n <Icon name='tag' />\n <Text variant='h3'>{t('tags')}</Text>\n <Count>{tags.length}</Count>\n </Flex>\n <Actions\n items={\n onEditTags\n ? [\n {\n id: 'editTags',\n text: t('edit'),\n icon: 'pencil',\n onClick: openEditModal,\n disabled: !!error\n }\n ]\n : []\n }\n contextualLabel={t('tags')}\n />\n </CardHeader>\n <CardContent>{content}</CardContent>\n {footer && (\n <CardFooter justify='center'>\n <Button variant='link' onClick={() => setViewAll(curr => !curr)}>\n {viewAll ? t('view_less') : t('view_all')}\n </Button>\n </CardFooter>\n )}\n </Card>\n );\n});\n\nexport default Tags;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tags/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tags/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["export { default } from './Tags';\nexport type { TagsProps, SelectedTag } from './Tags';\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { FunctionComponent, ReactNode, Ref, MouseEvent } from 'react';
|
|
2
|
+
import type { ForwardProps, TestIdProp, ActionsProps } from '@pega/cosmos-react-core';
|
|
3
|
+
export interface TaskItemProps extends TestIdProp {
|
|
4
|
+
id: string;
|
|
5
|
+
/** Name of the task displayed in the list. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Name of the process for the task. */
|
|
8
|
+
processName?: string;
|
|
9
|
+
/** Avatar element to represent the task's assignee. */
|
|
10
|
+
avatar?: ReactNode;
|
|
11
|
+
/** MetaList element with info related to the task. */
|
|
12
|
+
meta?: ReactNode;
|
|
13
|
+
/** Provide a callback to render a button for a task. */
|
|
14
|
+
onOpen?: (id: TaskItemProps['id'], e: MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
/** Content for the task when open. */
|
|
16
|
+
content?: ReactNode;
|
|
17
|
+
/** An array of actions to add to open task. */
|
|
18
|
+
additionalActions?: ActionsProps['items'];
|
|
19
|
+
}
|
|
20
|
+
export interface TaskListProps extends TestIdProp {
|
|
21
|
+
items: TaskItemProps[];
|
|
22
|
+
hasFooter?: boolean;
|
|
23
|
+
/** Ref for the wrapping element. */
|
|
24
|
+
ref?: Ref<HTMLElement>;
|
|
25
|
+
}
|
|
26
|
+
interface Announcement {
|
|
27
|
+
name: string;
|
|
28
|
+
status: 'removed' | 'added';
|
|
29
|
+
}
|
|
30
|
+
export declare const TaskItem: (({ testId, id, name, avatar, meta, processName, onOpen, content, addAnnouncement, additionalActions, ...restProps }: TaskItemProps & {
|
|
31
|
+
addAnnouncement?: ((announcement: Announcement) => void) | undefined;
|
|
32
|
+
}) => JSX.Element) & {
|
|
33
|
+
getTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["open-task"]>;
|
|
34
|
+
};
|
|
35
|
+
declare const _default: FunctionComponent<TaskListProps & ForwardProps> & {
|
|
36
|
+
getTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly []>;
|
|
37
|
+
};
|
|
38
|
+
export default _default;
|
|
39
|
+
//# sourceMappingURL=TaskList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskList.d.ts","sourceRoot":"","sources":["../../../src/components/Tasks/TaskList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAmB,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAoB5F,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAItF,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,sDAAsD;IACtD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wDAAwD;IACxD,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC7E,sCAAsC;IACtC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;CAC7B;AAmBD,eAAO,MAAM,QAAQ;sCAamC,YAAY,KAAK,IAAI;;;CA4D5E,CAAC;;;;AAoDF,wBAAyD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useEffect, useRef } from 'react';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
5
|
+
import { SummaryItem, StyledSummaryListItem, Flex, defaultThemeProp, Button, useI18n, VisuallyHiddenText, Breadcrumbs, StyledBreadcrumbs, StyledText, useTestIds, useLiveLog, debounce, Actions, withTestIds } from '@pega/cosmos-react-core';
|
|
6
|
+
import { getTaskListTestIds, getTaskItemTestIds } from './Tasks.test-ids';
|
|
7
|
+
const StyledTaskList = styled.ul(({ theme, hasFooter }) => {
|
|
8
|
+
return css `
|
|
9
|
+
${hasFooter &&
|
|
10
|
+
css `
|
|
11
|
+
> li:last-child {
|
|
12
|
+
border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
13
|
+
}
|
|
14
|
+
`}
|
|
15
|
+
|
|
16
|
+
${StyledBreadcrumbs} > ${StyledText} {
|
|
17
|
+
font-weight: ${theme.base['font-weight']['semi-bold']};
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
});
|
|
21
|
+
StyledTaskList.defaultProps = defaultThemeProp;
|
|
22
|
+
export const TaskItem = withTestIds(({ testId, id, name, avatar, meta, processName, onOpen, content, addAnnouncement, additionalActions, ...restProps }) => {
|
|
23
|
+
const testIds = useTestIds(testId, getTaskItemTestIds);
|
|
24
|
+
const t = useI18n();
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
addAnnouncement?.({ name, status: 'added' });
|
|
27
|
+
return () => {
|
|
28
|
+
addAnnouncement?.({ name, status: 'removed' });
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
const summary = (_jsx(SummaryItem, { visual: avatar, primary: processName ? (_jsx(Breadcrumbs, { path: [
|
|
32
|
+
{ id: 'processName', primary: processName },
|
|
33
|
+
{ id: 'name', primary: name }
|
|
34
|
+
] })) : (name), secondary: meta, actions: content
|
|
35
|
+
? additionalActions && _jsx(Actions, { menuAt: 1, items: additionalActions })
|
|
36
|
+
: onOpen && (_jsxs(Button, { "data-testid": testIds.openTask, variant: 'primary', onClick: (e) => onOpen(id, e), children: [_jsx("span", { children: t('go') }), _jsx(VisuallyHiddenText, { children: `-${processName ?? ''} ${name}` })] })) }));
|
|
37
|
+
return (_jsxs(Flex, { "data-testid": testIds.root, ...restProps, container: { direction: 'column', gap: 1 }, item: { grow: 1 }, as: StyledSummaryListItem, forwardedAs: 'li', children: [summary, content] }));
|
|
38
|
+
}, getTaskItemTestIds);
|
|
39
|
+
const TaskList = forwardRef(function TaskList({ testId, items, hasFooter = false }, ref) {
|
|
40
|
+
const testIds = useTestIds(testId, getTaskListTestIds);
|
|
41
|
+
const t = useI18n();
|
|
42
|
+
const { announcePolite } = useLiveLog();
|
|
43
|
+
const announcements = useRef([]);
|
|
44
|
+
const debouncedAnnounce = debounce(() => {
|
|
45
|
+
if (announcements.current.length > 0) {
|
|
46
|
+
let tasksAdded = 0;
|
|
47
|
+
let tasksRemoved = 0;
|
|
48
|
+
announcements.current.forEach(item => {
|
|
49
|
+
if (item.status === 'removed') {
|
|
50
|
+
tasksRemoved += 1;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
tasksAdded += 1;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
let message = tasksAdded ? t('tasks_added', [tasksAdded], { count: tasksAdded }) : '';
|
|
57
|
+
if (tasksRemoved) {
|
|
58
|
+
message += t('tasks_removed', [tasksRemoved], { count: tasksRemoved });
|
|
59
|
+
}
|
|
60
|
+
announcePolite({ message });
|
|
61
|
+
announcements.current = [];
|
|
62
|
+
}
|
|
63
|
+
}, 2000);
|
|
64
|
+
const addAnnouncement = (announcement) => {
|
|
65
|
+
announcements.current = [...announcements.current, announcement];
|
|
66
|
+
debouncedAnnounce();
|
|
67
|
+
};
|
|
68
|
+
return (_jsx(Flex, { "data-testid": testIds.root, container: { direction: 'column' }, as: StyledTaskList, hasFooter: hasFooter, ref: ref, children: items.map((item, i) => (_createElement(TaskItem, { ...item, addAnnouncement: addAnnouncement, key: `${i + 1}` }))) }));
|
|
69
|
+
});
|
|
70
|
+
export default withTestIds(TaskList, getTaskListTestIds);
|
|
71
|
+
//# sourceMappingURL=TaskList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskList.js","sourceRoot":"","sources":["../../../src/components/Tasks/TaskList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,IAAI,EACJ,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,OAAO,EACP,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAgC1E,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CAAyB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;IAChF,OAAO,GAAG,CAAA;MACN,SAAS;QACX,GAAG,CAAA;;yCAEkC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;;KAErE;;MAEC,iBAAiB,MAAM,UAAU;qBAClB,KAAK,CAAC,IAAI,CAAC,aAAa,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MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n SummaryItem,\n StyledSummaryListItem,\n Flex,\n defaultThemeProp,\n Button,\n useI18n,\n VisuallyHiddenText,\n Breadcrumbs,\n StyledBreadcrumbs,\n StyledText,\n useTestIds,\n useLiveLog,\n debounce,\n Actions,\n withTestIds\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps, TestIdProp, ActionsProps } from '@pega/cosmos-react-core';\n\nimport { getTaskListTestIds, getTaskItemTestIds } from './Tasks.test-ids';\n\nexport interface TaskItemProps extends TestIdProp {\n id: string;\n /** Name of the task displayed in the list. */\n name: string;\n /** Name of the process for the task. */\n processName?: string;\n /** Avatar element to represent the task's assignee. */\n avatar?: ReactNode;\n /** MetaList element with info related to the task. */\n meta?: ReactNode;\n /** Provide a callback to render a button for a task. */\n onOpen?: (id: TaskItemProps['id'], e: MouseEvent<HTMLButtonElement>) => void;\n /** Content for the task when open. */\n content?: ReactNode;\n /** An array of actions to add to open task. */\n additionalActions?: ActionsProps['items'];\n}\n\nexport interface TaskListProps extends TestIdProp {\n items: TaskItemProps[];\n hasFooter?: boolean;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\ninterface Announcement {\n name: string;\n status: 'removed' | 'added';\n}\n\nconst StyledTaskList = styled.ul<{ hasFooter: boolean }>(({ theme, hasFooter }) => {\n return css`\n ${hasFooter &&\n css`\n > li:last-child {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `}\n\n ${StyledBreadcrumbs} > ${StyledText} {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n }\n `;\n});\n\nStyledTaskList.defaultProps = defaultThemeProp;\n\nexport const TaskItem = withTestIds(\n ({\n testId,\n id,\n name,\n avatar,\n meta,\n processName,\n onOpen,\n content,\n addAnnouncement,\n additionalActions,\n ...restProps\n }: TaskItemProps & { addAnnouncement?: (announcement: Announcement) => void }) => {\n const testIds = useTestIds(testId, getTaskItemTestIds);\n const t = useI18n();\n\n useEffect(() => {\n addAnnouncement?.({ name, status: 'added' });\n\n return () => {\n addAnnouncement?.({ name, status: 'removed' });\n };\n }, []);\n\n const summary = (\n <SummaryItem\n visual={avatar}\n primary={\n processName ? (\n <Breadcrumbs\n path={[\n { id: 'processName', primary: processName },\n { id: 'name', primary: name }\n ]}\n />\n ) : (\n name\n )\n }\n secondary={meta}\n actions={\n content\n ? additionalActions && <Actions menuAt={1} items={additionalActions} />\n : onOpen && (\n <Button\n data-testid={testIds.openTask}\n variant='primary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => onOpen(id, e)}\n >\n <span>{t('go')}</span>\n <VisuallyHiddenText>{`-${processName ?? ''} ${name}`}</VisuallyHiddenText>\n </Button>\n )\n }\n />\n );\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ direction: 'column', gap: 1 }}\n item={{ grow: 1 }}\n as={StyledSummaryListItem}\n forwardedAs='li'\n >\n {summary}\n {content}\n </Flex>\n );\n },\n getTaskItemTestIds\n);\n\nconst TaskList: FunctionComponent<TaskListProps & ForwardProps> = forwardRef(function TaskList(\n { testId, items, hasFooter = false }: PropsWithoutRef<TaskListProps>,\n ref\n) {\n const testIds = useTestIds(testId, getTaskListTestIds);\n const t = useI18n();\n const { announcePolite } = useLiveLog();\n const announcements = useRef<Announcement[]>([]);\n\n const debouncedAnnounce = debounce(() => {\n if (announcements.current.length > 0) {\n let tasksAdded = 0;\n let tasksRemoved = 0;\n announcements.current.forEach(item => {\n if (item.status === 'removed') {\n tasksRemoved += 1;\n } else {\n tasksAdded += 1;\n }\n });\n let message = tasksAdded ? t('tasks_added', [tasksAdded], { count: tasksAdded }) : '';\n if (tasksRemoved) {\n message += t('tasks_removed', [tasksRemoved], { count: tasksRemoved });\n }\n\n announcePolite({ message });\n announcements.current = [];\n }\n }, 2000);\n\n const addAnnouncement = (announcement: Announcement) => {\n announcements.current = [...announcements.current, announcement];\n debouncedAnnounce();\n };\n\n return (\n <Flex\n data-testid={testIds.root}\n container={{ direction: 'column' }}\n as={StyledTaskList}\n hasFooter={hasFooter}\n ref={ref}\n >\n {items.map((item, i) => (\n <TaskItem {...item} addAnnouncement={addAnnouncement} key={`${i + 1}`} />\n ))}\n </Flex>\n );\n});\n\nexport default withTestIds(TaskList, getTaskListTestIds);\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { AvatarProps, ForwardProps, ListToolbarProps, NoChildrenProp, SearchInputProps, TestIdProp } from '@pega/cosmos-react-core';
|
|
3
|
+
import type { ViewSelectorProps } from '@pega/cosmos-react-core/lib/components/ListToolbar/ListToolbar.types';
|
|
4
|
+
import type { TaskItemProps } from './TaskList';
|
|
5
|
+
export interface TasksProps extends NoChildrenProp, TestIdProp {
|
|
6
|
+
/** An array of TaskItemProps to generate the list. */
|
|
7
|
+
items: TaskItemProps[];
|
|
8
|
+
/** Heading text to render at the top of the list. */
|
|
9
|
+
name: ListToolbarProps['name'];
|
|
10
|
+
/** A visual to accompany the header text. */
|
|
11
|
+
avatar?: Pick<AvatarProps, 'name' | 'icon' | 'imageSrc' | 'status'>;
|
|
12
|
+
/** Definition of view selection. */
|
|
13
|
+
viewSelector?: Pick<ViewSelectorProps, 'views' | 'onViewSelect'>;
|
|
14
|
+
/** Integer representing the total count of tasks. */
|
|
15
|
+
count?: number;
|
|
16
|
+
/** Opt-in search configuration. */
|
|
17
|
+
search?: Pick<SearchInputProps, 'value' | 'onSearchChange'>;
|
|
18
|
+
/** Callback for when to show more/less button is clicked. Lists greater than 3 items will display the show toggle button in its footer if passed. */
|
|
19
|
+
onExpandToggle?: () => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const StyledTasks: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardProps & ForwardProps>, import("styled-components").DefaultTheme, {
|
|
22
|
+
openItem?: boolean | undefined;
|
|
23
|
+
}, never>;
|
|
24
|
+
export declare const StyledTaskCardContent: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardContentProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
25
|
+
declare const _default: FC<ForwardProps & TasksProps> & {
|
|
26
|
+
getTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["show-more-less"]>;
|
|
27
|
+
};
|
|
28
|
+
export default _default;
|
|
29
|
+
//# sourceMappingURL=Tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tasks.d.ts","sourceRoot":"","sources":["../../../src/components/Tasks/Tasks.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,OAAO,CAAC;AAkB5C,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sEAAsE,CAAC;AAG9G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,MAAM,WAAW,UAAW,SAAQ,cAAc,EAAE,UAAU;IAC5D,sDAAsD;IACtD,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,qDAAqD;IACrD,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC,CAAC;IACpE,oCAAoC;IACpC,YAAY,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,cAAc,CAAC,CAAC;IACjE,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,MAAM,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC;IAC5D,qJAAqJ;IACrJ,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,WAAW;;SAUtB,CAAC;AAIH,eAAO,MAAM,qBAAqB,wMAUjC,CAAC;;;;AAuEF,wBAAmD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { Card, CardHeader, CardContent, CardFooter, Button, useI18n, defaultThemeProp, ListToolbar, EmptyState, useTestIds, Avatar, withTestIds, StyledCard } from '@pega/cosmos-react-core';
|
|
5
|
+
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
6
|
+
import { StyledCardFooter } from '@pega/cosmos-react-core/lib/components/Card/CardFooter';
|
|
7
|
+
import TaskList, { TaskItem } from './TaskList';
|
|
8
|
+
import { getTasksTestIds } from './Tasks.test-ids';
|
|
9
|
+
export const StyledTasks = styled(Card)(({ theme, openItem }) => {
|
|
10
|
+
return openItem
|
|
11
|
+
? css `
|
|
12
|
+
box-shadow: ${theme.base.shadow.low};
|
|
13
|
+
`
|
|
14
|
+
: css `
|
|
15
|
+
${StyledCardHeader}:not(& & > ${StyledCardHeader}) {
|
|
16
|
+
padding-block-end: calc(${theme.base.spacing} / 2);
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
});
|
|
20
|
+
StyledTasks.defaultProps = defaultThemeProp;
|
|
21
|
+
export const StyledTaskCardContent = styled(CardContent)(({ theme }) => css `
|
|
22
|
+
&:not(${StyledCard} ${StyledCard} > &) {
|
|
23
|
+
padding-block-end: calc(${theme.base.spacing} / 2);
|
|
24
|
+
|
|
25
|
+
& + ${StyledCardFooter} {
|
|
26
|
+
padding-block-start: ${theme.base.spacing};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`);
|
|
30
|
+
StyledTaskCardContent.defaultProps = defaultThemeProp;
|
|
31
|
+
const Tasks = (props) => {
|
|
32
|
+
const { testId, items = [], name, avatar, viewSelector, count = items.length, search, onExpandToggle, ...restProps } = props;
|
|
33
|
+
const testIds = useTestIds(testId, getTasksTestIds);
|
|
34
|
+
const openItem = items.find(item => item.content);
|
|
35
|
+
const t = useI18n();
|
|
36
|
+
const hasFooter = !!(!openItem && onExpandToggle && count > 0);
|
|
37
|
+
const TaskItems = useMemo(() => {
|
|
38
|
+
return openItem ? (_jsx(TaskItem, { ...openItem })) : (_jsx(TaskList, { items: items, hasFooter: hasFooter, testId: testIds.root }));
|
|
39
|
+
}, [items, openItem]);
|
|
40
|
+
return (_jsxs(StyledTasks, { "data-testid": testIds.root, ...restProps, openItem: !!openItem, "data-app-region": true, children: [!openItem && (_jsxs(CardHeader, { container: { justify: 'start', alignItems: 'center', gap: 1 }, children: [avatar && _jsx(Avatar, { ...avatar }), _jsx(ListToolbar, { name: name, headingTag: 'h2', viewSelector: viewSelector, count: { total: count }, search: search, item: { grow: 1 } })] })), _jsx(StyledTaskCardContent, { children: items.length > 0 ? TaskItems : _jsx(EmptyState, {}) }), hasFooter && (_jsx(CardFooter, { justify: 'center', children: _jsx(Button, { "data-testid": testIds.showMoreLess, variant: 'link', "aria-label": t(!!count && count > items.length ? 'show_more' : 'show_less', ['tasks']), onClick: (e) => {
|
|
41
|
+
onExpandToggle?.();
|
|
42
|
+
if (!!count && count <= items.length) {
|
|
43
|
+
const { currentTarget } = e;
|
|
44
|
+
requestAnimationFrame(() => {
|
|
45
|
+
if (currentTarget.getBoundingClientRect().top < 0)
|
|
46
|
+
currentTarget.scrollIntoView();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, children: t(!!count && count > items.length ? 'show_more' : 'show_less') }) }))] }));
|
|
50
|
+
};
|
|
51
|
+
export default withTestIds(Tasks, getTasksTestIds);
|
|
52
|
+
//# sourceMappingURL=Tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tasks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ent":["import { useMemo } from 'react';\nimport type { FC, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Card,\n CardHeader,\n CardContent,\n CardFooter,\n Button,\n useI18n,\n defaultThemeProp,\n ListToolbar,\n EmptyState,\n useTestIds,\n Avatar,\n withTestIds,\n StyledCard\n} from '@pega/cosmos-react-core';\nimport type {\n AvatarProps,\n ForwardProps,\n ListToolbarProps,\n NoChildrenProp,\n SearchInputProps,\n TestIdProp\n} from '@pega/cosmos-react-core';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledCardFooter } from '@pega/cosmos-react-core/lib/components/Card/CardFooter';\nimport type { ViewSelectorProps } from '@pega/cosmos-react-core/lib/components/ListToolbar/ListToolbar.types';\n\nimport TaskList, { TaskItem } from './TaskList';\nimport type { TaskItemProps } from './TaskList';\nimport { getTasksTestIds } from './Tasks.test-ids';\n\nexport interface TasksProps extends NoChildrenProp, TestIdProp {\n /** An array of TaskItemProps to generate the list. */\n items: TaskItemProps[];\n /** Heading text to render at the top of the list. */\n name: ListToolbarProps['name'];\n /** A visual to accompany the header text. */\n avatar?: Pick<AvatarProps, 'name' | 'icon' | 'imageSrc' | 'status'>;\n /** Definition of view selection. */\n viewSelector?: Pick<ViewSelectorProps, 'views' | 'onViewSelect'>;\n /** Integer representing the total count of tasks. */\n count?: number;\n /** Opt-in search configuration. */\n search?: Pick<SearchInputProps, 'value' | 'onSearchChange'>;\n /** Callback for when to show more/less button is clicked. Lists greater than 3 items will display the show toggle button in its footer if passed. */\n onExpandToggle?: () => void;\n}\n\nexport const StyledTasks = styled(Card)<{ openItem?: boolean }>(({ theme, openItem }) => {\n return openItem\n ? css`\n box-shadow: ${theme.base.shadow.low};\n `\n : css`\n ${StyledCardHeader}:not(& & > ${StyledCardHeader}) {\n padding-block-end: calc(${theme.base.spacing} / 2);\n }\n `;\n});\n\nStyledTasks.defaultProps = defaultThemeProp;\n\nexport const StyledTaskCardContent = styled(CardContent)(\n ({ theme }) => css`\n &:not(${StyledCard} ${StyledCard} > &) {\n padding-block-end: calc(${theme.base.spacing} / 2);\n\n & + ${StyledCardFooter} {\n padding-block-start: ${theme.base.spacing};\n }\n }\n `\n);\n\nStyledTaskCardContent.defaultProps = defaultThemeProp;\n\nconst Tasks: FC<ForwardProps & TasksProps> = (props: TasksProps) => {\n const {\n testId,\n items = [],\n name,\n avatar,\n viewSelector,\n count = items.length,\n search,\n onExpandToggle,\n ...restProps\n } = props;\n const testIds = useTestIds(testId, getTasksTestIds);\n const openItem = items.find(item => item.content);\n const t = useI18n();\n\n const hasFooter = !!(!openItem && onExpandToggle && count > 0);\n\n const TaskItems = useMemo(() => {\n return openItem ? (\n <TaskItem {...openItem} />\n ) : (\n <TaskList items={items} hasFooter={hasFooter} testId={testIds.root} />\n );\n }, [items, openItem]);\n\n return (\n <StyledTasks data-testid={testIds.root} {...restProps} openItem={!!openItem} data-app-region>\n {!openItem && (\n <CardHeader container={{ justify: 'start', alignItems: 'center', gap: 1 }}>\n {avatar && <Avatar {...avatar} />}\n <ListToolbar\n name={name}\n headingTag='h2'\n viewSelector={viewSelector}\n count={{ total: count }}\n search={search}\n item={{ grow: 1 }}\n />\n </CardHeader>\n )}\n <StyledTaskCardContent>{items.length > 0 ? TaskItems : <EmptyState />}</StyledTaskCardContent>\n\n {hasFooter && (\n <CardFooter justify='center'>\n <Button\n data-testid={testIds.showMoreLess}\n variant='link'\n aria-label={t(!!count && count > items.length ? 'show_more' : 'show_less', ['tasks'])}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onExpandToggle?.();\n if (!!count && count <= items.length) {\n const { currentTarget } = e;\n requestAnimationFrame(() => {\n if (currentTarget.getBoundingClientRect().top < 0) currentTarget.scrollIntoView();\n });\n }\n }}\n >\n {t(!!count && count > items.length ? 'show_more' : 'show_less')}\n </Button>\n </CardFooter>\n )}\n </StyledTasks>\n );\n};\n\nexport default withTestIds(Tasks, getTasksTestIds);\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const getTasksTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["show-more-less"]>;
|
|
2
|
+
export declare const getTaskListTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly []>;
|
|
3
|
+
export declare const getTaskItemTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["open-task"]>;
|
|
4
|
+
//# sourceMappingURL=Tasks.test-ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tasks.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Tasks/Tasks.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,mHAAsD,CAAC;AAEnF,eAAO,MAAM,kBAAkB,mGAA0C,CAAC;AAE1E,eAAO,MAAM,kBAAkB,8GAAqD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createTestIds } from '@pega/cosmos-react-core';
|
|
2
|
+
export const getTasksTestIds = createTestIds('tasks', ['show-more-less']);
|
|
3
|
+
export const getTaskListTestIds = createTestIds('task-list', []);
|
|
4
|
+
export const getTaskItemTestIds = createTestIds('task-item', ['open-task']);
|
|
5
|
+
//# sourceMappingURL=Tasks.test-ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tasks.test-ids.js","sourceRoot":"","sources":["../../../src/components/Tasks/Tasks.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC,OAAO,EAAE,CAAC,gBAAgB,CAAU,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,WAAW,EAAE,EAAW,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC,WAAW,CAAU,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getTasksTestIds = createTestIds('tasks', ['show-more-less'] as const);\n\nexport const getTaskListTestIds = createTestIds('task-list', [] as const);\n\nexport const getTaskItemTestIds = createTestIds('task-item', ['open-task'] as const);\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default } from './Tasks';
|
|
2
|
+
export type { TasksProps } from './Tasks';
|
|
3
|
+
export { default as TaskList } from './TaskList';
|
|
4
|
+
export type { TaskListProps, TaskItemProps } from './TaskList';
|
|
5
|
+
export { listToolbarHelpers as tasksHelpers } from '@pega/cosmos-react-core';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tasks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tasks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { default } from './Tasks';\nexport type { TasksProps } from './Tasks';\nexport { default as TaskList } from './TaskList';\nexport type { TaskListProps, TaskItemProps } from './TaskList';\nexport { listToolbarHelpers as tasksHelpers } from '@pega/cosmos-react-core';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
2
|
+
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import type TimelineProps from './Timeline.types';
|
|
4
|
+
declare const Timeline: FunctionComponent<TimelineProps & ForwardProps>;
|
|
5
|
+
export default Timeline;
|
|
6
|
+
//# sourceMappingURL=Timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Timeline.d.ts","sourceRoot":"","sources":["../../../src/components/Timeline/Timeline.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAShE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAIlD,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CAkF5D,CAAC;AAEH,eAAe,QAAQ,CAAC"}
|