@pega/cosmos-react-work 5.0.0-dev.4.9 → 5.0.0-dev.5.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/ArticleList.d.ts +6 -0
- package/lib/components/ArticleList/ArticleList.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleList.js +132 -0
- package/lib/components/ArticleList/ArticleList.js.map +1 -0
- package/lib/components/ArticleList/ArticleList.types.d.ts +92 -0
- package/lib/components/ArticleList/ArticleList.types.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleList.types.js +2 -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 +6 -0
- package/lib/components/ArticleList/index.d.ts.map +1 -0
- package/lib/components/ArticleList/index.js +4 -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 +2 -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 +29 -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 +4 -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,68 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { registerIcon, useI18n, Modal, useModalManager, InfoDialog, StyledLabel, Text, SummaryList, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
5
|
+
import * as polarisIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris.icon';
|
|
6
|
+
import * as informationIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/information.icon';
|
|
7
|
+
registerIcon(polarisIcon, informationIcon);
|
|
8
|
+
// Expand minimum width to ensure the chart is readable enough
|
|
9
|
+
const StyledPredictionExplanationDialog = styled(InfoDialog)(({ theme }) => {
|
|
10
|
+
return css `
|
|
11
|
+
min-width: min(${theme.base['content-width'].md}, calc(100vw - 2rem));
|
|
12
|
+
`;
|
|
13
|
+
});
|
|
14
|
+
StyledPredictionExplanationDialog.defaultProps = defaultThemeProp;
|
|
15
|
+
const PredictionsList = forwardRef(function PredictionsList({ items: itemsProp, progress, ...restProps }, ref) {
|
|
16
|
+
const t = useI18n();
|
|
17
|
+
const [currentItemIdTarget, setCurrentItemIdTarget] = useState();
|
|
18
|
+
const currentItem = itemsProp?.find(({ id }) => id === currentItemIdTarget?.id);
|
|
19
|
+
const items = useMemo(() => (itemsProp ?? []).map(item => ({
|
|
20
|
+
id: item.id,
|
|
21
|
+
primary: _jsx(StyledLabel, { forwardedAs: 'span', children: item.label }),
|
|
22
|
+
secondary: (_jsx(Text, { variant: 'h1', as: 'span', children: item.value })),
|
|
23
|
+
overflowStrategy: 'ellipsis',
|
|
24
|
+
actions: item.additionalInfo
|
|
25
|
+
? [
|
|
26
|
+
{
|
|
27
|
+
id: item.id,
|
|
28
|
+
text: t('learn_more'),
|
|
29
|
+
icon: 'information',
|
|
30
|
+
onClick: (id, e) => {
|
|
31
|
+
setCurrentItemIdTarget({
|
|
32
|
+
id: item.id,
|
|
33
|
+
target: e.currentTarget
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
: undefined
|
|
39
|
+
})), [itemsProp]);
|
|
40
|
+
return (_jsxs(_Fragment, { children: [_jsx(SummaryList, { ...restProps, loading: progress, ref: ref, items: items }), currentItemIdTarget && currentItem?.additionalInfo && (_jsx(StyledPredictionExplanationDialog, { heading: currentItem.label, target: currentItemIdTarget.target, onDismiss: () => {
|
|
41
|
+
setCurrentItemIdTarget(undefined);
|
|
42
|
+
}, children: currentItem.additionalInfo }))] }));
|
|
43
|
+
});
|
|
44
|
+
const PredictionsViewAllModal = ({ count, progress, ...restProps }) => {
|
|
45
|
+
const t = useI18n();
|
|
46
|
+
return (_jsx(Modal, { heading: t('all_predictions'), count: count, progress: progress, children: _jsx(PredictionsList, { ...restProps }) }));
|
|
47
|
+
};
|
|
48
|
+
const Predictions = forwardRef(function Predictions({ count, items, progress, ...restProps }, ref) {
|
|
49
|
+
const t = useI18n();
|
|
50
|
+
const { create } = useModalManager();
|
|
51
|
+
const viewAllModalRef = useRef();
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
viewAllModalRef.current?.update({
|
|
54
|
+
items,
|
|
55
|
+
progress,
|
|
56
|
+
count
|
|
57
|
+
});
|
|
58
|
+
}, [items, progress, count]);
|
|
59
|
+
return (_jsx(PredictionsList, { ...restProps, ref: ref, name: t('predictions'), headingTag: 'h3', icon: 'polaris', count: count, items: items?.slice(0, 3), progress: progress, onViewAll: () => {
|
|
60
|
+
viewAllModalRef.current = create(PredictionsViewAllModal, {
|
|
61
|
+
items,
|
|
62
|
+
progress,
|
|
63
|
+
count
|
|
64
|
+
});
|
|
65
|
+
} }));
|
|
66
|
+
});
|
|
67
|
+
export default Predictions;
|
|
68
|
+
//# sourceMappingURL=Predictions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Predictions.js","sourceRoot":"","sources":["../../../src/components/Predictions/Predictions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAEL,YAAY,EACZ,OAAO,EACP,KAAK,EAEL,eAAe,EAEf,UAAU,EAEV,WAAW,EACX,IAAI,EACJ,WAAW,EACX,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,WAAW,MAAM,gEAAgE,CAAC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IAE5B,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,EAAE,CAAC;IACrC,MAAM,eAAe,GAAG,MAAM,EAAkC,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACb,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC;YAC9B,KAAK;YACL,QAAQ;YACR,KAAK;SACN,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAE7B,OAAO,CACL,KAAC,eAAe,OACV,SAAS,EACb,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,EACtB,UAAU,EAAC,IAAI,EACf,IAAI,EAAC,SAAS,EACd,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EACzB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,GAAG,EAAE;YACd,eAAe,CAAC,OAAO,GAAG,MAAM,CAAC,uBAAuB,EAAE;gBACxD,KAAK;gBACL,QAAQ;gBACR,KAAK;aACN,CAAC,CAAC;QACL,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n FC,\n forwardRef,\n FunctionComponent,\n MouseEvent,\n PropsWithoutRef,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n ForwardProps,\n registerIcon,\n useI18n,\n Modal,\n SummaryListProps,\n useModalManager,\n SummaryListItem,\n InfoDialog,\n ModalMethods,\n StyledLabel,\n Text,\n SummaryList,\n defaultThemeProp\n} from '@pega/cosmos-react-core';\nimport * as polarisIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris.icon';\nimport * as informationIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/information.icon';\n\nimport PredictionsProps, { PredictionItem } from './Predictions.types';\n\nregisterIcon(polarisIcon, informationIcon);\n\n// Expand minimum width to ensure the chart is readable enough\nconst StyledPredictionExplanationDialog = styled(InfoDialog)(({ theme }) => {\n return css`\n min-width: min(${theme.base['content-width'].md}, calc(100vw - 2rem));\n `;\n});\n\nStyledPredictionExplanationDialog.defaultProps = defaultThemeProp;\n\nconst PredictionsList: FC<\n PredictionsProps & Pick<SummaryListProps, 'onViewAll' | 'name' | 'icon'> & ForwardProps\n> = forwardRef(function PredictionsList(\n {\n items: itemsProp,\n progress,\n ...restProps\n }: PropsWithoutRef<PredictionsProps & Pick<SummaryListProps, 'onViewAll' | 'name' | 'icon'>>,\n ref: PredictionsProps['ref']\n) {\n const t = useI18n();\n const [currentItemIdTarget, setCurrentItemIdTarget] = useState<\n | {\n id: PredictionItem['id'];\n target: HTMLButtonElement | HTMLAnchorElement | HTMLInputElement;\n }\n | undefined\n >();\n const currentItem = itemsProp?.find(({ id }) => id === currentItemIdTarget?.id);\n\n const items: SummaryListItem[] = useMemo(\n () =>\n (itemsProp ?? []).map(item => ({\n id: item.id,\n primary: <StyledLabel forwardedAs='span'>{item.label}</StyledLabel>,\n secondary: (\n <Text variant='h1' as='span'>\n {item.value}\n </Text>\n ),\n overflowStrategy: 'ellipsis',\n actions: item.additionalInfo\n ? [\n {\n id: item.id,\n text: t('learn_more'),\n icon: 'information',\n onClick: (\n id: string,\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>\n ) => {\n setCurrentItemIdTarget({\n id: item.id,\n target: e.currentTarget\n });\n }\n }\n ]\n : undefined\n })),\n [itemsProp]\n );\n\n return (\n <>\n <SummaryList {...restProps} loading={progress} ref={ref} items={items} />\n {currentItemIdTarget && currentItem?.additionalInfo && (\n <StyledPredictionExplanationDialog\n heading={currentItem.label}\n target={currentItemIdTarget.target}\n onDismiss={() => {\n setCurrentItemIdTarget(undefined);\n }}\n >\n {currentItem.additionalInfo}\n </StyledPredictionExplanationDialog>\n )}\n </>\n );\n});\n\nconst PredictionsViewAllModal = ({ count, progress, ...restProps }: PredictionsProps) => {\n const t = useI18n();\n return (\n <Modal heading={t('all_predictions')} count={count} progress={progress}>\n <PredictionsList {...restProps} />\n </Modal>\n );\n};\n\nconst Predictions: FunctionComponent<PredictionsProps & ForwardProps> = forwardRef(\n function Predictions(\n { count, items, progress, ...restProps }: PropsWithoutRef<PredictionsProps>,\n ref: PredictionsProps['ref']\n ) {\n const t = useI18n();\n const { create } = useModalManager();\n const viewAllModalRef = useRef<ModalMethods<PredictionsProps>>();\n\n useEffect(() => {\n viewAllModalRef.current?.update({\n items,\n progress,\n count\n });\n }, [items, progress, count]);\n\n return (\n <PredictionsList\n {...restProps}\n ref={ref}\n name={t('predictions')}\n headingTag='h3'\n icon='polaris'\n count={count}\n items={items?.slice(0, 3)}\n progress={progress}\n onViewAll={() => {\n viewAllModalRef.current = create(PredictionsViewAllModal, {\n items,\n progress,\n count\n });\n }}\n />\n );\n }\n);\n\nexport default Predictions;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
import { BaseProps, NoChildrenProp } from '@pega/cosmos-react-core';
|
|
3
|
+
export interface PredictionItem {
|
|
4
|
+
/** A unique id to represent the item. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Label for the prediction item. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Value for the prediction item. */
|
|
9
|
+
value: string;
|
|
10
|
+
/** Additional prediction information rendered in a dialog. */
|
|
11
|
+
additionalInfo?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export default interface PredictionsProps extends BaseProps, NoChildrenProp {
|
|
14
|
+
/** Integer representing the total count of items. */
|
|
15
|
+
count?: number;
|
|
16
|
+
/** An array of PredictionItem objects to render. Pass an appropriately limited length array with a desired sort order based on design system defaults or config. */
|
|
17
|
+
items?: PredictionItem[];
|
|
18
|
+
/** Show a progress indicator when initially fetching list data. */
|
|
19
|
+
progress?: boolean;
|
|
20
|
+
/** Ref for the wrapping element. */
|
|
21
|
+
ref?: Ref<HTMLDivElement>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=Predictions.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Predictions.types.d.ts","sourceRoot":"","sources":["../../../src/components/Predictions/Predictions.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEpE,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,cAAc,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED,MAAM,CAAC,OAAO,WAAW,gBAAiB,SAAQ,SAAS,EAAE,cAAc;IACzE,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oKAAoK;IACpK,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Predictions.types.js","sourceRoot":"","sources":["../../../src/components/Predictions/Predictions.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactNode, Ref } from 'react';\n\nimport { BaseProps, NoChildrenProp } from '@pega/cosmos-react-core';\n\nexport interface PredictionItem {\n /** A unique id to represent the item. */\n id: string;\n /** Label for the prediction item. */\n label: string;\n /** Value for the prediction item. */\n value: string;\n /** Additional prediction information rendered in a dialog. */\n additionalInfo?: ReactNode;\n}\n\nexport default interface PredictionsProps extends BaseProps, NoChildrenProp {\n /** Integer representing the total count of items. */\n count?: number;\n /** An array of PredictionItem objects to render. Pass an appropriately limited length array with a desired sort order based on design system defaults or config. */\n items?: PredictionItem[];\n /** Show a progress indicator when initially fetching list data. */\n progress?: boolean;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Predictions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Predictions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { default } from './Predictions';\nexport type { default as PredictionsProps } from './Predictions.types';\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FilterProps, SearchResultsProps } from './SearchResults.types';
|
|
2
|
+
interface FilterComponentProps {
|
|
3
|
+
onFilterChange?: SearchResultsProps['onFilterChange'];
|
|
4
|
+
onClearFilter?: SearchResultsProps['onClearFilter'];
|
|
5
|
+
}
|
|
6
|
+
declare const Filter: ({ onFilterChange, onClearFilter, name, expanded, ...control }: FilterProps & FilterComponentProps) => JSX.Element;
|
|
7
|
+
export default Filter;
|
|
8
|
+
//# sourceMappingURL=Filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Filter.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/Filter.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAyB,MAAM,uBAAuB,CAAC;AAK/F,UAAU,oBAAoB;IAC5B,cAAc,CAAC,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IACtD,aAAa,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;CACrD;AAED,QAAA,MAAM,MAAM,kEAMT,WAAW,GAAG,oBAAoB,KAAG,WA6EvC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Button, Checkbox, CheckboxGroup, ExpandCollapse, Flex, Icon, registerIcon, RadioButton, RadioButtonGroup, Text, useI18n } from '@pega/cosmos-react-core';
|
|
4
|
+
import * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';
|
|
5
|
+
import { StyledFilter, StyledFilterButton } from './SearchResults.styles';
|
|
6
|
+
registerIcon(caretDownIcon);
|
|
7
|
+
const Filter = ({ onFilterChange, onClearFilter, name, expanded = true, ...control }) => {
|
|
8
|
+
const t = useI18n();
|
|
9
|
+
const [filterExpanded, setFilterExpanded] = useState(expanded);
|
|
10
|
+
let filterControl;
|
|
11
|
+
let filterActive = false;
|
|
12
|
+
// eslint-disable-next-line sonarjs/no-small-switch
|
|
13
|
+
switch (control.type) {
|
|
14
|
+
case 'select': {
|
|
15
|
+
const { selectType, items } = control;
|
|
16
|
+
let SelectFilterGroup = CheckboxGroup;
|
|
17
|
+
let SelectFilter = Checkbox;
|
|
18
|
+
if (selectType === 'single-select') {
|
|
19
|
+
SelectFilterGroup = RadioButtonGroup;
|
|
20
|
+
SelectFilter = RadioButton;
|
|
21
|
+
}
|
|
22
|
+
filterControl = (_jsx(SelectFilterGroup, { label: name, labelHidden: true, onChange: e => {
|
|
23
|
+
const item = items.find((x) => x.id === e.target.id);
|
|
24
|
+
if (!item)
|
|
25
|
+
return;
|
|
26
|
+
const newItem = { ...item, checked: !item.checked };
|
|
27
|
+
onFilterChange?.({
|
|
28
|
+
name,
|
|
29
|
+
type: control.type,
|
|
30
|
+
value: newItem
|
|
31
|
+
});
|
|
32
|
+
}, children: control.items.map((filterOption) => {
|
|
33
|
+
if (filterOption.checked)
|
|
34
|
+
filterActive = true;
|
|
35
|
+
return (_jsx(SelectFilter, { id: filterOption.id, name: filterOption.name, label: filterOption.label, checked: filterOption.checked }, filterOption.id));
|
|
36
|
+
}) }));
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
default:
|
|
40
|
+
filterControl = null;
|
|
41
|
+
}
|
|
42
|
+
return (_jsxs(StyledFilter, { children: [_jsxs(Flex, { container: { justify: 'between' }, children: [_jsxs(Flex, { as: StyledFilterButton, container: { gap: 1, alignItems: 'center' }, variant: 'text', onClick: () => setFilterExpanded(curr => !curr), "aria-expanded": filterExpanded, "aria-label": t(filterExpanded ? 'collapse_noun' : 'expand_noun', [name]), children: [_jsx(Icon, { name: 'caret-down' }), _jsx(Text, { variant: 'h3', as: 'span', children: name })] }), filterActive && (_jsx(Button, { variant: 'link', onClick: () => onClearFilter?.(name), children: t('clear') }))] }), _jsx(ExpandCollapse, { collapsed: !filterExpanded, children: filterControl })] }));
|
|
43
|
+
};
|
|
44
|
+
export default Filter;
|
|
45
|
+
//# sourceMappingURL=Filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../src/components/SearchResults/Filter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EACL,MAAM,EACN,QAAQ,EACR,aAAa,EACb,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,IAAI,EACJ,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AAGnG,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE1E,YAAY,CAAC,aAAa,CAAC,CAAC;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eAAe,MAAM,CAAC","sourcesContent":["import { useState } from 'react';\n\nimport {\n Button,\n Checkbox,\n CheckboxGroup,\n ExpandCollapse,\n Flex,\n Icon,\n registerIcon,\n RadioButton,\n RadioButtonGroup,\n Text,\n useI18n\n} from '@pega/cosmos-react-core';\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\n\nimport { FilterProps, SearchResultsProps, SelectFilterItemProps } from './SearchResults.types';\nimport { StyledFilter, StyledFilterButton } from './SearchResults.styles';\n\nregisterIcon(caretDownIcon);\n\ninterface FilterComponentProps {\n onFilterChange?: SearchResultsProps['onFilterChange'];\n onClearFilter?: SearchResultsProps['onClearFilter'];\n}\n\nconst Filter = ({\n onFilterChange,\n onClearFilter,\n name,\n expanded = true,\n ...control\n}: FilterProps & FilterComponentProps): JSX.Element => {\n const t = useI18n();\n const [filterExpanded, setFilterExpanded] = useState(expanded);\n\n let filterControl;\n let filterActive = false;\n // eslint-disable-next-line sonarjs/no-small-switch\n switch (control.type) {\n case 'select': {\n const { selectType, items } = control;\n let SelectFilterGroup = CheckboxGroup;\n let SelectFilter = Checkbox;\n if (selectType === 'single-select') {\n SelectFilterGroup = RadioButtonGroup;\n SelectFilter = RadioButton;\n }\n filterControl = (\n <SelectFilterGroup\n label={name}\n labelHidden\n onChange={e => {\n const item = items.find((x: SelectFilterItemProps) => x.id === e.target.id);\n if (!item) return;\n const newItem = { ...item, checked: !item.checked };\n\n onFilterChange?.({\n name,\n type: control.type,\n value: newItem\n });\n }}\n >\n {control.items.map((filterOption: SelectFilterItemProps) => {\n if (filterOption.checked) filterActive = true;\n return (\n <SelectFilter\n key={filterOption.id}\n id={filterOption.id}\n name={filterOption.name}\n label={filterOption.label}\n checked={filterOption.checked}\n />\n );\n })}\n </SelectFilterGroup>\n );\n break;\n }\n default:\n filterControl = null;\n }\n\n return (\n <StyledFilter>\n <Flex container={{ justify: 'between' }}>\n <Flex\n as={StyledFilterButton}\n container={{ gap: 1, alignItems: 'center' }}\n variant='text'\n onClick={() => setFilterExpanded(curr => !curr)}\n aria-expanded={filterExpanded}\n aria-label={t(filterExpanded ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Icon name='caret-down' />\n <Text variant='h3' as='span'>\n {name}\n </Text>\n </Flex>\n {filterActive && (\n <Button variant='link' onClick={() => onClearFilter?.(name)}>\n {t('clear')}\n </Button>\n )}\n </Flex>\n <ExpandCollapse collapsed={!filterExpanded}>{filterControl}</ExpandCollapse>\n </StyledFilter>\n );\n};\n\nexport default Filter;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchResult.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResult.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAyB1D,QAAA,MAAM,YAAY,+CAMf,iBAAiB,KAAG,WActB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { defaultThemeProp, Text, MetaList, Link, Flex, StyledPopover, calculateFontSize, replaceMatchWithElement, Mark } from '@pega/cosmos-react-core';
|
|
4
|
+
const StyledSearchResult = styled.article(({ theme }) => {
|
|
5
|
+
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
6
|
+
return css `
|
|
7
|
+
h2 ${StyledPopover} {
|
|
8
|
+
font-size: ${fontSize.s};
|
|
9
|
+
font-weight: ${theme.base['font-weight'].normal};
|
|
10
|
+
}
|
|
11
|
+
padding-block-end: calc(2 * ${theme.base.spacing});
|
|
12
|
+
border-bottom: 0.0125rem solid ${theme.base.palette['border-line']};
|
|
13
|
+
|
|
14
|
+
&:last-of-type {
|
|
15
|
+
border-bottom: none;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
});
|
|
19
|
+
StyledSearchResult.defaultProps = defaultThemeProp;
|
|
20
|
+
const StyledDescription = styled(Text) `
|
|
21
|
+
word-break: break-word;
|
|
22
|
+
`;
|
|
23
|
+
const SearchResult = ({ title, link, description, meta = [], accent }) => {
|
|
24
|
+
return (_jsxs(Flex, { as: StyledSearchResult, container: { direction: 'column', gap: 1 }, children: [_jsxs(Flex, { container: { direction: 'column' }, children: [_jsx(Text, { variant: 'h2', children: _jsx(Link, { ...link, children: accent ? replaceMatchWithElement(title, accent, match => _jsx(Mark, { children: match })) : title }) }), !!meta.length && _jsx(MetaList, { items: meta })] }), description && _jsx(StyledDescription, { forwardedAs: 'p', children: description })] }));
|
|
25
|
+
};
|
|
26
|
+
export default SearchResult;
|
|
27
|
+
//# sourceMappingURL=SearchResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchResult.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResult.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,IAAI,EACL,MAAM,yBAAyB,CAAC;AAIjC,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACtD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,OAAO,GAAG,CAAA;SACH,aAAa;mBACH,QAAQ,CAAC,CAAC;qBACR,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM;;kCAEnB,KAAK,CAAC,IAAI,CAAC,OAAO;qCACf,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;;;;;GAKnE,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAErC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,WAAW,EACX,IAAI,GAAG,EAAE,EACT,MAAM,EACY,EAAe,EAAE;IACnC,OAAO,CACL,MAAC,IAAI,IAAC,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aACtE,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,aACtC,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAChB,KAAC,IAAI,OAAK,IAAI,YACX,MAAM,CAAC,CAAC,CAAC,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAC,IAAI,cAAE,KAAK,GAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,GAClF,GACF,EACN,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,KAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,GAAI,IACtC,EACN,WAAW,IAAI,KAAC,iBAAiB,IAAC,WAAW,EAAC,GAAG,YAAE,WAAW,GAAqB,IAC/E,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n Text,\n MetaList,\n Link,\n Flex,\n StyledPopover,\n calculateFontSize,\n replaceMatchWithElement,\n Mark\n} from '@pega/cosmos-react-core';\n\nimport { SearchResultProps } from './SearchResults.types';\n\nconst StyledSearchResult = styled.article(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n h2 ${StyledPopover} {\n font-size: ${fontSize.s};\n font-weight: ${theme.base['font-weight'].normal};\n }\n padding-block-end: calc(2 * ${theme.base.spacing});\n border-bottom: 0.0125rem solid ${theme.base.palette['border-line']};\n\n &:last-of-type {\n border-bottom: none;\n }\n `;\n});\n\nStyledSearchResult.defaultProps = defaultThemeProp;\n\nconst StyledDescription = styled(Text)`\n word-break: break-word;\n`;\n\nconst SearchResult = ({\n title,\n link,\n description,\n meta = [],\n accent\n}: SearchResultProps): JSX.Element => {\n return (\n <Flex as={StyledSearchResult} container={{ direction: 'column', gap: 1 }}>\n <Flex container={{ direction: 'column' }}>\n <Text variant='h2'>\n <Link {...link}>\n {accent ? replaceMatchWithElement(title, accent, match => <Mark>{match}</Mark>) : title}\n </Link>\n </Text>\n {!!meta.length && <MetaList items={meta} />}\n </Flex>\n {description && <StyledDescription forwardedAs='p'>{description}</StyledDescription>}\n </Flex>\n );\n};\n\nexport default SearchResult;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { SearchResultsProps } from './SearchResults.types';
|
|
4
|
+
declare const SearchResults: FunctionComponent<SearchResultsProps & ForwardProps>;
|
|
5
|
+
export default SearchResults;
|
|
6
|
+
//# sourceMappingURL=SearchResults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchResults.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAIlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAIL,YAAY,EAmBb,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EACL,kBAAkB,EAInB,MAAM,uBAAuB,CAAC;AA6E/B,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAsPvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useContext, useRef, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { Button, Count, Flex, Grid, Icon, registerIcon, Modal, EmptyState, SearchInput, Selectable, Text, useModalManager, useI18n, useBreakpoint, useAfterInitialEffect, SummaryItem, Avatar, useTheme, AppShellContext, Progress } from '@pega/cosmos-react-core';
|
|
5
|
+
import * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';
|
|
6
|
+
import * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';
|
|
7
|
+
import SearchResult from './SearchResult';
|
|
8
|
+
import Filter from './Filter';
|
|
9
|
+
import { StyledModalFilterContent, StyledCountText, StyledSelectedFilters, StyledSearchResults, StyledResults, StyledFilters, StyledSearchSummaryItem } from './SearchResults.styles';
|
|
10
|
+
registerIcon(filterIcon, filterOnIcon);
|
|
11
|
+
const FilterModal = (props) => {
|
|
12
|
+
const { activeFilters, count, filters, onFilterChange, onClearFilter, onClearAllFilters } = props;
|
|
13
|
+
const t = useI18n();
|
|
14
|
+
return (_jsx(Modal, { heading: t('filters'), autoWidth: true, children: _jsxs(Grid, { as: StyledModalFilterContent, container: { rowGap: 2 }, children: [_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [_jsx(Text, { as: StyledCountText, variant: 'secondary', children: t('results_count', [count], { count }) }), onClearAllFilters && !!activeFilters.length && (_jsx(Button, { variant: 'link', onClick: onClearAllFilters, children: t('clear_all') }))] }), !!activeFilters.length && (_jsx(Flex, { as: StyledSelectedFilters, container: { gap: 1 }, children: activeFilters.map(filter => {
|
|
15
|
+
return (_jsx(Selectable, { id: filter.id, onRemove: () => onFilterChange?.({
|
|
16
|
+
name: filter.groupName,
|
|
17
|
+
type: filter.type,
|
|
18
|
+
value: filter.resetValue
|
|
19
|
+
}), children: `${filter.groupName}: ${filter.name}` }, filter.id));
|
|
20
|
+
}) })), _jsx("div", { children: filters.map((filter) => {
|
|
21
|
+
return (_jsx(Filter, { onFilterChange: onFilterChange, onClearFilter: onClearFilter, ...filter }, filter.name));
|
|
22
|
+
}) })] }) }));
|
|
23
|
+
};
|
|
24
|
+
const SearchResults = forwardRef(function SearchResults({ results, searchInputProps, count, filters, onFilterChange, onClearAllFilters, onClearFilter, onShowMore, loading = false, ...restProps }, ref) {
|
|
25
|
+
const t = useI18n();
|
|
26
|
+
const isMedium = useBreakpoint('md');
|
|
27
|
+
const { create } = useModalManager();
|
|
28
|
+
const { searchContainerEl } = useContext(AppShellContext);
|
|
29
|
+
const filtersMethods = useRef();
|
|
30
|
+
const { placeholder = t('search_placeholder_default') } = searchInputProps;
|
|
31
|
+
const { base: { palette: { 'brand-primary': primary } } } = useTheme();
|
|
32
|
+
const [accent, setAccent] = useState();
|
|
33
|
+
const [submittedSearchValue, setSubmittedSearchValue] = useState(searchInputProps.value);
|
|
34
|
+
const activeFilters = filters.flatMap(group => {
|
|
35
|
+
if (group.type === 'select') {
|
|
36
|
+
return group.items.flatMap(item => {
|
|
37
|
+
if (item.checked) {
|
|
38
|
+
return {
|
|
39
|
+
id: item.id,
|
|
40
|
+
name: item.name,
|
|
41
|
+
resetValue: { ...item, checked: false },
|
|
42
|
+
groupName: group.name,
|
|
43
|
+
type: group.type
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return [];
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return [];
|
|
50
|
+
});
|
|
51
|
+
const openFiltersModal = () => {
|
|
52
|
+
filtersMethods.current = create(FilterModal, {
|
|
53
|
+
activeFilters,
|
|
54
|
+
count,
|
|
55
|
+
filters,
|
|
56
|
+
onFilterChange,
|
|
57
|
+
onClearFilter,
|
|
58
|
+
onClearAllFilters
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
useAfterInitialEffect(() => {
|
|
62
|
+
if (filtersMethods.current) {
|
|
63
|
+
filtersMethods.current.update({
|
|
64
|
+
activeFilters,
|
|
65
|
+
count,
|
|
66
|
+
filters
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}, [activeFilters, count, filters]);
|
|
70
|
+
useAfterInitialEffect(() => {
|
|
71
|
+
if (isMedium && filtersMethods.current)
|
|
72
|
+
filtersMethods.current.dismiss();
|
|
73
|
+
}, [isMedium]);
|
|
74
|
+
useAfterInitialEffect(() => {
|
|
75
|
+
setAccent(submittedSearchValue ? new RegExp(submittedSearchValue, 'gi') : undefined);
|
|
76
|
+
}, [submittedSearchValue]);
|
|
77
|
+
const searchTitle = (_jsx(SummaryItem, { as: StyledSearchSummaryItem, visual: _jsx(Avatar, { icon: 'search', name: 'search', shape: 'squircle', backgroundColor: primary, color: 'white' }), primary: _jsx(Text, { variant: 'h1', children: "Search" }), actions: onClearAllFilters &&
|
|
78
|
+
isMedium &&
|
|
79
|
+
!!activeFilters.length && (_jsx(Button, { variant: 'link', onClick: onClearAllFilters, children: t('clear_all') })) }));
|
|
80
|
+
const searchInput = (_jsx(SearchInput, { ...searchInputProps, onSearchSubmit: val => {
|
|
81
|
+
searchInputProps.onSearchSubmit?.(val);
|
|
82
|
+
setSubmittedSearchValue(val);
|
|
83
|
+
}, placeholder: placeholder }));
|
|
84
|
+
return (_jsxs(Grid, { ...restProps, as: StyledSearchResults, ref: ref, md: filters.length
|
|
85
|
+
? {
|
|
86
|
+
container: {
|
|
87
|
+
cols: '15rem auto'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
: undefined, sm: filters.length
|
|
91
|
+
? {
|
|
92
|
+
container: {
|
|
93
|
+
cols: 'auto',
|
|
94
|
+
rowGap: 2
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
: undefined, container: {
|
|
98
|
+
rows: 'auto auto',
|
|
99
|
+
cols: 'auto 1fr',
|
|
100
|
+
areas: '"filters results"'
|
|
101
|
+
}, children: [isMedium && !!filters.length && (_jsxs(Grid, { item: { area: 'filters', alignSelf: 'start' }, as: StyledFilters, children: [searchTitle, filters.map((filter) => {
|
|
102
|
+
return (_jsx(Filter, { onFilterChange: onFilterChange, onClearFilter: onClearFilter, ...filter }, filter.name));
|
|
103
|
+
})] })), _jsxs(Grid, { item: { alignSelf: 'start', area: 'results' }, container: {
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
rowGap: 2,
|
|
106
|
+
rows: 'auto auto 1fr',
|
|
107
|
+
areas: '"search" "meta" "items"'
|
|
108
|
+
}, as: StyledResults, children: [loading && _jsx(Progress, { placement: 'local' }), searchContainerEl && isMedium ? (createPortal(searchInput, searchContainerEl)) : (_jsxs(Grid, { item: { area: 'search' }, children: [!isMedium && searchTitle, searchInput] })), _jsxs(Grid, { item: { area: 'meta' }, container: { rowGap: 1 }, children: [_jsxs(Flex, { container: { justify: 'between', alignItems: 'center' }, children: [!loading && (_jsx(Text, { as: StyledCountText, variant: 'secondary', children: submittedSearchValue !== '' || results.length > 0
|
|
109
|
+
? t('results_count', [count], { count })
|
|
110
|
+
: '' })), !isMedium && !!filters.length && (_jsxs(Button, { variant: 'simple', onClick: openFiltersModal, children: [_jsx(Icon, { name: activeFilters.length > 0 ? 'filter-on' : 'filter' }), "\u00A0", t('filters'), "\u00A0", _jsx(Count, { children: activeFilters.length })] }))] }), !!activeFilters.length && (_jsx(Flex, { as: StyledSelectedFilters, container: { gap: 1, wrap: 'wrap' }, children: activeFilters.map(filter => {
|
|
111
|
+
return (_jsx(Selectable, { id: filter.id, onRemove: () => onFilterChange?.({
|
|
112
|
+
name: filter.groupName,
|
|
113
|
+
type: filter.type,
|
|
114
|
+
value: filter.resetValue
|
|
115
|
+
}), children: `${filter.groupName}: ${filter.name}` }, filter.id));
|
|
116
|
+
}) }))] }), _jsx(Grid, { item: { area: 'items', alignSelf: results.length ? 'start' : 'stretch' }, container: { rowGap: 2 }, children: !loading && (_jsxs(_Fragment, { children: [results.length ? (results.map((result) => {
|
|
117
|
+
return _jsx(SearchResult, { ...result, accent: accent }, result.id);
|
|
118
|
+
})) : (_jsx(Grid, { item: { alignSelf: 'stretch' }, children: _jsx(EmptyState, { message: submittedSearchValue === '' ? t('empty_search') : undefined }) })), onShowMore && (_jsx(Flex, { container: { justify: 'center' }, children: _jsx(Button, { variant: 'link', onClick: onShowMore, children: t('show_more') }) }))] })) })] })] }));
|
|
119
|
+
});
|
|
120
|
+
export default SearchResults;
|
|
121
|
+
//# sourceMappingURL=SearchResults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchResults.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,MAAM,EAIN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,KAAK,EACL,IAAI,EAEJ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EAEL,UAAU,EACV,WAAW,EACX,UAAU,EACV,IAAI,EACJ,eAAe,EACf,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,MAAM,EACN,QAAQ,EACR,eAAe,EACf,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,+DAA+D,CAAC;AAC5F,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AAQjG,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAEvC,MAAM,WAAW,GAAG,CAClB,KAKC,EACD,EAAE;IACF,MAAM,EAAE,aAAa,EAA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S,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,EACxE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YAEvB,CAAC,OAAO,IAAI,CACX,8BACG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAChB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAyB,EAAE,EAAE;oCACxC,OAAO,KAAC,YAAY,OAAqB,MAAM,EAAE,MAAM,EAAE,MAAM,IAArC,MAAM,CAAC,EAAE,CAAgC,CAAC;gCACtE,CAAC,CAAC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,YAClC,KAAC,UAAU,IACT,OAAO,EAAE,oBAAoB,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,GACpE,GACG,CACR,EACA,UAAU,IAAI,CACb,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,YACpC,KAAC,MAAM,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,UAAU,YACvC,CAAC,CAAC,WAAW,CAAC,GACR,GACJ,CACR,IACA,CACJ,GACI,IACF,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n forwardRef,\n useContext,\n useRef,\n FunctionComponent,\n PropsWithoutRef,\n ComponentProps,\n useState\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport {\n Button,\n Count,\n Flex,\n ForwardProps,\n Grid,\n Icon,\n registerIcon,\n Modal,\n ModalMethods,\n EmptyState,\n SearchInput,\n Selectable,\n Text,\n useModalManager,\n useI18n,\n useBreakpoint,\n useAfterInitialEffect,\n SummaryItem,\n Avatar,\n useTheme,\n AppShellContext,\n Progress\n} from '@pega/cosmos-react-core';\nimport * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\nimport * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';\n\nimport {\n SearchResultsProps,\n SearchResultProps,\n FilterProps,\n ActiveFilters\n} from './SearchResults.types';\nimport SearchResult from './SearchResult';\nimport Filter from './Filter';\nimport {\n StyledModalFilterContent,\n StyledCountText,\n StyledSelectedFilters,\n StyledSearchResults,\n StyledResults,\n StyledFilters,\n StyledSearchSummaryItem\n} from './SearchResults.styles';\n\nregisterIcon(filterIcon, filterOnIcon);\n\nconst FilterModal = (\n props: Pick<\n SearchResultsProps,\n 'count' | 'filters' | 'onFilterChange' | 'onClearFilter' | 'onClearAllFilters'\n > & {\n activeFilters: ActiveFilters[];\n }\n) => {\n const { activeFilters, count, filters, onFilterChange, onClearFilter, onClearAllFilters } = props;\n const t = useI18n();\n\n return (\n <Modal heading={t('filters')} autoWidth>\n <Grid as={StyledModalFilterContent} container={{ rowGap: 2 }}>\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Text as={StyledCountText} variant='secondary'>\n {t('results_count', [count], { count })}\n </Text>\n {onClearAllFilters && !!activeFilters.length && (\n <Button variant='link' onClick={onClearAllFilters}>\n {t('clear_all')}\n </Button>\n )}\n </Flex>\n {!!activeFilters.length && (\n <Flex as={StyledSelectedFilters} container={{ gap: 1 }}>\n {activeFilters.map(filter => {\n return (\n <Selectable\n key={filter.id}\n id={filter.id}\n onRemove={() =>\n onFilterChange?.({\n name: filter.groupName,\n type: filter.type,\n value: filter.resetValue\n })\n }\n >\n {`${filter.groupName}: ${filter.name}`}\n </Selectable>\n );\n })}\n </Flex>\n )}\n <div>\n {filters.map((filter: FilterProps) => {\n return (\n <Filter\n key={filter.name}\n onFilterChange={onFilterChange}\n onClearFilter={onClearFilter}\n {...filter}\n />\n );\n })}\n </div>\n </Grid>\n </Modal>\n );\n};\n\nconst SearchResults: FunctionComponent<SearchResultsProps & ForwardProps> = forwardRef(\n function SearchResults(\n {\n results,\n searchInputProps,\n count,\n filters,\n onFilterChange,\n onClearAllFilters,\n onClearFilter,\n onShowMore,\n loading = false,\n ...restProps\n }: PropsWithoutRef<SearchResultsProps>,\n ref: SearchResultsProps['ref']\n ) {\n const t = useI18n();\n const isMedium = useBreakpoint('md');\n const { create } = useModalManager();\n const { searchContainerEl } = useContext(AppShellContext);\n const filtersMethods = useRef<ModalMethods<ComponentProps<typeof FilterModal>>>();\n const { placeholder = t('search_placeholder_default') } = searchInputProps;\n const {\n base: {\n palette: { 'brand-primary': primary }\n }\n } = useTheme();\n const [accent, setAccent] = useState<undefined | RegExp>();\n const [submittedSearchValue, setSubmittedSearchValue] = useState(searchInputProps.value);\n\n const activeFilters: ActiveFilters[] = filters.flatMap(group => {\n if (group.type === 'select') {\n return group.items.flatMap(item => {\n if (item.checked) {\n return {\n id: item.id,\n name: item.name,\n resetValue: { ...item, checked: false },\n groupName: group.name,\n type: group.type\n };\n }\n return [];\n });\n }\n return [];\n });\n\n const openFiltersModal = () => {\n filtersMethods.current = create(FilterModal, {\n activeFilters,\n count,\n filters,\n onFilterChange,\n onClearFilter,\n onClearAllFilters\n });\n };\n\n useAfterInitialEffect(() => {\n if (filtersMethods.current) {\n filtersMethods.current.update({\n activeFilters,\n count,\n filters\n });\n }\n }, [activeFilters, count, filters]);\n\n useAfterInitialEffect(() => {\n if (isMedium && filtersMethods.current) filtersMethods.current.dismiss();\n }, [isMedium]);\n\n useAfterInitialEffect(() => {\n setAccent(submittedSearchValue ? new RegExp(submittedSearchValue, 'gi') : undefined);\n }, [submittedSearchValue]);\n\n const searchTitle = (\n <SummaryItem\n as={StyledSearchSummaryItem}\n visual={\n <Avatar\n icon='search'\n name='search'\n shape='squircle'\n backgroundColor={primary}\n color='white'\n />\n }\n primary={<Text variant='h1'>Search</Text>}\n actions={\n onClearAllFilters &&\n isMedium &&\n !!activeFilters.length && (\n <Button variant='link' onClick={onClearAllFilters}>\n {t('clear_all')}\n </Button>\n )\n }\n />\n );\n const searchInput = (\n <SearchInput\n {...searchInputProps}\n onSearchSubmit={val => {\n searchInputProps.onSearchSubmit?.(val);\n setSubmittedSearchValue(val);\n }}\n placeholder={placeholder}\n />\n );\n\n return (\n <Grid\n {...restProps}\n as={StyledSearchResults}\n ref={ref}\n md={\n filters.length\n ? {\n container: {\n cols: '15rem auto'\n }\n }\n : undefined\n }\n sm={\n filters.length\n ? {\n container: {\n cols: 'auto',\n rowGap: 2\n }\n }\n : undefined\n }\n container={{\n rows: 'auto auto',\n cols: 'auto 1fr',\n areas: '\"filters results\"'\n }}\n >\n {isMedium && !!filters.length && (\n <Grid item={{ area: 'filters', alignSelf: 'start' }} as={StyledFilters}>\n {searchTitle}\n {filters.map((filter: FilterProps) => {\n return (\n <Filter\n key={filter.name}\n onFilterChange={onFilterChange}\n onClearFilter={onClearFilter}\n {...filter}\n />\n );\n })}\n </Grid>\n )}\n <Grid\n item={{ alignSelf: 'start', area: 'results' }}\n container={{\n alignItems: 'center',\n rowGap: 2,\n rows: 'auto auto 1fr',\n areas: '\"search\" \"meta\" \"items\"'\n }}\n as={StyledResults}\n >\n {loading && <Progress placement='local' />}\n {searchContainerEl && isMedium ? (\n createPortal(searchInput, searchContainerEl)\n ) : (\n <Grid item={{ area: 'search' }}>\n {!isMedium && searchTitle}\n {searchInput}\n </Grid>\n )}\n <Grid item={{ area: 'meta' }} container={{ rowGap: 1 }}>\n <Flex container={{ justify: 'between', alignItems: 'center' }}>\n {!loading && (\n <Text as={StyledCountText} variant='secondary'>\n {submittedSearchValue !== '' || results.length > 0\n ? t('results_count', [count], { count })\n : ''}\n </Text>\n )}\n {!isMedium && !!filters.length && (\n <Button variant='simple' onClick={openFiltersModal}>\n <Icon name={activeFilters.length > 0 ? 'filter-on' : 'filter'} />\n {t('filters')} \n <Count>{activeFilters.length}</Count>\n </Button>\n )}\n </Flex>\n {!!activeFilters.length && (\n <Flex as={StyledSelectedFilters} container={{ gap: 1, wrap: 'wrap' }}>\n {activeFilters.map(filter => {\n return (\n <Selectable\n key={filter.id}\n id={filter.id}\n onRemove={() =>\n onFilterChange?.({\n name: filter.groupName,\n type: filter.type,\n value: filter.resetValue\n })\n }\n >\n {`${filter.groupName}: ${filter.name}`}\n </Selectable>\n );\n })}\n </Flex>\n )}\n </Grid>\n <Grid\n item={{ area: 'items', alignSelf: results.length ? 'start' : 'stretch' }}\n container={{ rowGap: 2 }}\n >\n {!loading && (\n <>\n {results.length ? (\n results.map((result: SearchResultProps) => {\n return <SearchResult key={result.id} {...result} accent={accent} />;\n })\n ) : (\n <Grid item={{ alignSelf: 'stretch' }}>\n <EmptyState\n message={submittedSearchValue === '' ? t('empty_search') : undefined}\n />\n </Grid>\n )}\n {onShowMore && (\n <Flex container={{ justify: 'center' }}>\n <Button variant='link' onClick={onShowMore}>\n {t('show_more')}\n </Button>\n </Flex>\n )}\n </>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n }\n);\n\nexport default SearchResults;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const StyledSearchResults: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
2
|
+
export declare const StyledFilterTitle: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
+
export declare const StyledCountText: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
4
|
+
export declare const StyledModalFilterContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
+
export declare const StyledSelectedFilters: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
+
export declare const StyledFilter: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
+
export declare const StyledFilterButton: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
+
export declare const StyledSearchSummaryItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
9
|
+
export declare const StyledFilters: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
10
|
+
export declare const StyledResults: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
11
|
+
//# sourceMappingURL=SearchResults.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchResults.styles.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.styles.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,mBAAmB,yGAE/B,CAAC;AAIF,eAAO,MAAM,iBAAiB,0GAI5B,CAAC;AAIH,eAAO,MAAM,eAAe,0GAI1B,CAAC;AAIH,eAAO,MAAM,wBAAwB,yGAWpC,CAAC;AAIF,eAAO,MAAM,qBAAqB,yGAWjC,CAAC;AAIF,eAAO,MAAM,YAAY,yGAAe,CAAC;AAIzC,eAAO,MAAM,kBAAkB,qOAsB7B,CAAC;AAIH,eAAO,MAAM,uBAAuB,yGAYnC,CAAC;AAIF,eAAO,MAAM,aAAa,yGAWxB,CAAC;AAIH,eAAO,MAAM,aAAa,yGAOxB,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { Button, calculateFontSize, defaultThemeProp, StyledIcon, StyledSearchInput, useDirection } from '@pega/cosmos-react-core';
|
|
3
|
+
export const StyledSearchResults = styled.div `
|
|
4
|
+
min-height: inherit;
|
|
5
|
+
`;
|
|
6
|
+
StyledSearchResults.defaultProps = defaultThemeProp;
|
|
7
|
+
export const StyledFilterTitle = styled.span(({ theme: { base } }) => {
|
|
8
|
+
return css `
|
|
9
|
+
padding-bottom: calc(2 * ${base.spacing});
|
|
10
|
+
`;
|
|
11
|
+
});
|
|
12
|
+
StyledFilterTitle.defaultProps = defaultThemeProp;
|
|
13
|
+
export const StyledCountText = styled.span(({ theme: { base } }) => {
|
|
14
|
+
return css `
|
|
15
|
+
font-weight: ${base['font-weight']['semi-bold']};
|
|
16
|
+
`;
|
|
17
|
+
});
|
|
18
|
+
StyledCountText.defaultProps = defaultThemeProp;
|
|
19
|
+
export const StyledModalFilterContent = styled.div(({ theme: { base: { spacing } } }) => {
|
|
20
|
+
return css `
|
|
21
|
+
margin-top: calc(0.5 * ${spacing});
|
|
22
|
+
width: calc(${spacing} * 50);
|
|
23
|
+
`;
|
|
24
|
+
});
|
|
25
|
+
StyledModalFilterContent.defaultProps = defaultThemeProp;
|
|
26
|
+
export const StyledSelectedFilters = styled.div(({ theme: { base: { spacing } } }) => {
|
|
27
|
+
return css `
|
|
28
|
+
overflow-x: auto;
|
|
29
|
+
padding-bottom: calc(1 * ${spacing});
|
|
30
|
+
`;
|
|
31
|
+
});
|
|
32
|
+
StyledSelectedFilters.defaultProps = defaultThemeProp;
|
|
33
|
+
export const StyledFilter = styled.div ``;
|
|
34
|
+
StyledFilter.defaultProps = defaultThemeProp;
|
|
35
|
+
export const StyledFilterButton = styled(Button)(({ theme: { base } }) => {
|
|
36
|
+
const fontSize = calculateFontSize(base['font-size'], base['font-scale']);
|
|
37
|
+
const { rtl } = useDirection();
|
|
38
|
+
return css `
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
font-size: ${fontSize.xl};
|
|
41
|
+
|
|
42
|
+
${StyledIcon} {
|
|
43
|
+
height: 1em;
|
|
44
|
+
width: 1em;
|
|
45
|
+
transition: transform ${base.animation.speed} ${base.animation.timing.ease};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&[aria-expanded='true'] ${StyledIcon} {
|
|
49
|
+
transform: rotate(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&[aria-expanded='false'] ${StyledIcon} {
|
|
53
|
+
transform: rotate(calc(${rtl ? '1' : '-1'} * 90deg));
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
});
|
|
57
|
+
StyledFilterButton.defaultProps = defaultThemeProp;
|
|
58
|
+
export const StyledSearchSummaryItem = styled.div(({ theme: { base: { spacing } } }) => css `
|
|
59
|
+
column-gap: calc(${spacing} * 1);
|
|
60
|
+
|
|
61
|
+
+ ${StyledSearchInput} {
|
|
62
|
+
margin-block-start: calc(${spacing} * 1);
|
|
63
|
+
}
|
|
64
|
+
`);
|
|
65
|
+
StyledSearchSummaryItem.defaultProps = defaultThemeProp;
|
|
66
|
+
export const StyledFilters = styled.div(({ theme }) => {
|
|
67
|
+
return css `
|
|
68
|
+
position: sticky;
|
|
69
|
+
top: var(--appshell-offset, 0);
|
|
70
|
+
max-height: calc(100vh - var(--appshell-offset, 0rem));
|
|
71
|
+
overflow: auto;
|
|
72
|
+
> ${StyledFilter}, ${StyledSearchSummaryItem} {
|
|
73
|
+
border-bottom: 0.0125rem solid ${theme.base.palette['border-line']};
|
|
74
|
+
padding: calc(${theme.base.spacing} * 2);
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
});
|
|
78
|
+
StyledFilters.defaultProps = defaultThemeProp;
|
|
79
|
+
export const StyledResults = styled.div(({ theme }) => {
|
|
80
|
+
return css `
|
|
81
|
+
background-color: ${theme.base.palette['primary-background']};
|
|
82
|
+
padding: calc(${theme.base.spacing} * 2);
|
|
83
|
+
position: relative;
|
|
84
|
+
min-height: calc(100vh - var(--appshell-offset, 0rem));
|
|
85
|
+
`;
|
|
86
|
+
});
|
|
87
|
+
StyledResults.defaultProps = defaultThemeProp;
|
|
88
|
+
//# sourceMappingURL=SearchResults.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchResults.styles.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACb,MA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AC,OAAO;;GAErC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;oBAC5C,KAAK,CAAC,IAAI,CAAC,OAAO;;;GAGnC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport {\n Button,\n calculateFontSize,\n defaultThemeProp,\n StyledIcon,\n StyledSearchInput,\n useDirection\n} from '@pega/cosmos-react-core';\n\nexport const StyledSearchResults = styled.div`\n min-height: inherit;\n`;\n\nStyledSearchResults.defaultProps = defaultThemeProp;\n\nexport const StyledFilterTitle = styled.span(({ theme: { base } }) => {\n return css`\n padding-bottom: calc(2 * ${base.spacing});\n `;\n});\n\nStyledFilterTitle.defaultProps = defaultThemeProp;\n\nexport const StyledCountText = styled.span(({ theme: { base } }) => {\n return css`\n font-weight: ${base['font-weight']['semi-bold']};\n `;\n});\n\nStyledCountText.defaultProps = defaultThemeProp;\n\nexport const StyledModalFilterContent = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n margin-top: calc(0.5 * ${spacing});\n width: calc(${spacing} * 50);\n `;\n }\n);\n\nStyledModalFilterContent.defaultProps = defaultThemeProp;\n\nexport const StyledSelectedFilters = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n overflow-x: auto;\n padding-bottom: calc(1 * ${spacing});\n `;\n }\n);\n\nStyledSelectedFilters.defaultProps = defaultThemeProp;\n\nexport const StyledFilter = styled.div``;\n\nStyledFilter.defaultProps = defaultThemeProp;\n\nexport const StyledFilterButton = styled(Button)(({ theme: { base } }) => {\n const fontSize = calculateFontSize(base['font-size'], base['font-scale']);\n\n const { rtl } = useDirection();\n return css`\n display: inline-flex;\n font-size: ${fontSize.xl};\n\n ${StyledIcon} {\n height: 1em;\n width: 1em;\n transition: transform ${base.animation.speed} ${base.animation.timing.ease};\n }\n\n &[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(0);\n }\n\n &[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(calc(${rtl ? '1' : '-1'} * 90deg));\n }\n `;\n});\n\nStyledFilterButton.defaultProps = defaultThemeProp;\n\nexport const StyledSearchSummaryItem = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => css`\n column-gap: calc(${spacing} * 1);\n\n + ${StyledSearchInput} {\n margin-block-start: calc(${spacing} * 1);\n }\n `\n);\n\nStyledSearchSummaryItem.defaultProps = defaultThemeProp;\n\nexport const StyledFilters = styled.div(({ theme }) => {\n return css`\n position: sticky;\n top: var(--appshell-offset, 0);\n max-height: calc(100vh - var(--appshell-offset, 0rem));\n overflow: auto;\n > ${StyledFilter}, ${StyledSearchSummaryItem} {\n border-bottom: 0.0125rem solid ${theme.base.palette['border-line']};\n padding: calc(${theme.base.spacing} * 2);\n }\n `;\n});\n\nStyledFilters.defaultProps = defaultThemeProp;\n\nexport const StyledResults = styled.div(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n padding: calc(${theme.base.spacing} * 2);\n position: relative;\n min-height: calc(100vh - var(--appshell-offset, 0rem));\n `;\n});\n\nStyledResults.defaultProps = defaultThemeProp;\n"]}
|