@pega/cosmos-react-work 7.0.0-build.3.3 → 7.0.0-build.30.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.js +1 -2
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/Article/Article.d.ts +3 -3
- package/lib/components/Article/Article.d.ts.map +1 -1
- package/lib/components/Article/Article.js +5 -5
- package/lib/components/Article/Article.js.map +1 -1
- package/lib/components/Article/ArticleFooter.d.ts +4 -7
- package/lib/components/Article/ArticleFooter.d.ts.map +1 -1
- package/lib/components/Article/ArticleFooter.js +7 -15
- package/lib/components/Article/ArticleFooter.js.map +1 -1
- package/lib/components/Article/ArticleMeta.d.ts.map +1 -1
- package/lib/components/Article/ArticleMeta.js +2 -2
- package/lib/components/Article/ArticleMeta.js.map +1 -1
- package/lib/components/ArticleList/AIArticleSummary.d.ts +5 -0
- package/lib/components/ArticleList/AIArticleSummary.d.ts.map +1 -0
- package/lib/components/ArticleList/AIArticleSummary.js +33 -0
- package/lib/components/ArticleList/AIArticleSummary.js.map +1 -0
- package/lib/components/ArticleList/ArticleBuddy.d.ts +1 -3
- package/lib/components/ArticleList/ArticleBuddy.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddy.js +35 -53
- package/lib/components/ArticleList/ArticleBuddy.js.map +1 -1
- package/lib/components/ArticleList/ArticleBuddyList.d.ts +6 -0
- package/lib/components/ArticleList/ArticleBuddyList.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleBuddyList.js +22 -0
- package/lib/components/ArticleList/ArticleBuddyList.js.map +1 -0
- package/lib/components/ArticleList/ArticleBuddyResponse.d.ts +9 -0
- package/lib/components/ArticleList/ArticleBuddyResponse.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleBuddyResponse.js +59 -0
- package/lib/components/ArticleList/ArticleBuddyResponse.js.map +1 -0
- package/lib/components/ArticleList/ArticleFeedback.d.ts +4 -5
- package/lib/components/ArticleList/ArticleFeedback.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleFeedback.js +21 -22
- package/lib/components/ArticleList/ArticleFeedback.js.map +1 -1
- package/lib/components/ArticleList/ArticleList.d.ts +1 -0
- package/lib/components/ArticleList/ArticleList.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleList.js +69 -16
- package/lib/components/ArticleList/ArticleList.js.map +1 -1
- package/lib/components/ArticleList/ArticleList.types.d.ts +99 -23
- package/lib/components/ArticleList/ArticleList.types.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleList.types.js +9 -0
- package/lib/components/ArticleList/ArticleList.types.js.map +1 -1
- package/lib/components/ArticleList/ArticleListFilter.d.ts +5 -2
- package/lib/components/ArticleList/ArticleListFilter.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleListFilter.js +8 -5
- package/lib/components/ArticleList/ArticleListFilter.js.map +1 -1
- package/lib/components/ArticleList/ArticleListHeader.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleListHeader.js +2 -2
- package/lib/components/ArticleList/ArticleListHeader.js.map +1 -1
- package/lib/components/ArticleList/ArticleSemanticSearch.d.ts +5 -0
- package/lib/components/ArticleList/ArticleSemanticSearch.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleSemanticSearch.js +24 -0
- package/lib/components/ArticleList/ArticleSemanticSearch.js.map +1 -0
- package/lib/components/ArticleList/ArticleSummary.d.ts +0 -1
- package/lib/components/ArticleList/ArticleSummary.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleSummary.js +7 -56
- package/lib/components/ArticleList/ArticleSummary.js.map +1 -1
- package/lib/components/ArticleList/ArticleSummary.styles.d.ts +3 -0
- package/lib/components/ArticleList/ArticleSummary.styles.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleSummary.styles.js +48 -0
- package/lib/components/ArticleList/ArticleSummary.styles.js.map +1 -0
- package/lib/components/ArticleList/ArticleSummaryHeader.d.ts +7 -0
- package/lib/components/ArticleList/ArticleSummaryHeader.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleSummaryHeader.js +9 -0
- package/lib/components/ArticleList/ArticleSummaryHeader.js.map +1 -0
- package/lib/components/ArticleList/ArticleTag.d.ts +7 -0
- package/lib/components/ArticleList/ArticleTag.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleTag.js +17 -0
- package/lib/components/ArticleList/ArticleTag.js.map +1 -0
- package/lib/components/ArticleList/QuestionList.d.ts +14 -0
- package/lib/components/ArticleList/QuestionList.d.ts.map +1 -0
- package/lib/components/ArticleList/QuestionList.js +78 -0
- package/lib/components/ArticleList/QuestionList.js.map +1 -0
- package/lib/components/ArticleList/index.d.ts +3 -2
- package/lib/components/ArticleList/index.d.ts.map +1 -1
- package/lib/components/ArticleList/index.js +1 -0
- package/lib/components/ArticleList/index.js.map +1 -1
- package/lib/components/Assignments/Assignments.styles.d.ts +1 -0
- package/lib/components/Assignments/Assignments.styles.d.ts.map +1 -1
- package/lib/components/Assignments/Assignments.styles.js +14 -14
- package/lib/components/Assignments/Assignments.styles.js.map +1 -1
- package/lib/components/CasePreview/CasePreview.d.ts +8 -2
- package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
- package/lib/components/CasePreview/CasePreview.js +58 -14
- package/lib/components/CasePreview/CasePreview.js.map +1 -1
- package/lib/components/CasePreview/CasePreview.test-ids.d.ts +1 -1
- package/lib/components/CasePreview/CasePreview.test-ids.d.ts.map +1 -1
- package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -1
- package/lib/components/CaseView/CaseHeader/CaseHeader.js +12 -13
- package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -1
- package/lib/components/CaseView/CaseSummary.d.ts +4 -2
- package/lib/components/CaseView/CaseSummary.d.ts.map +1 -1
- package/lib/components/CaseView/CaseSummary.js +2 -2
- package/lib/components/CaseView/CaseSummary.js.map +1 -1
- package/lib/components/CaseView/CaseView.context.d.ts +1 -0
- package/lib/components/CaseView/CaseView.context.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.d.ts +1 -1
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +53 -17
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +10 -3
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +85 -60
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.test-ids.d.ts +1 -1
- package/lib/components/CaseView/CaseView.test-ids.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.types.d.ts +3 -0
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.types.js.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.d.ts +1 -1
- package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.js +38 -15
- package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
- package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts +1 -0
- package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitySummaryItemDialog.js +3 -2
- package/lib/components/CaseView/UtilitySummaryItemDialog.js.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts +1 -0
- package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts +1 -0
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/LayoutCell.d.ts +1 -0
- package/lib/components/ConfigurableLayout/LayoutCell.d.ts.map +1 -1
- package/lib/components/Details/Details.d.ts +24 -19
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +66 -51
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/Details.styles.d.ts +23 -27
- package/lib/components/Details/Details.styles.d.ts.map +1 -1
- package/lib/components/Details/Details.styles.js +197 -116
- package/lib/components/Details/Details.styles.js.map +1 -1
- package/lib/components/Details/Details.test-ids.d.ts +1 -1
- package/lib/components/Details/Details.test-ids.d.ts.map +1 -1
- package/lib/components/Details/DetailsContext.d.ts +3 -0
- package/lib/components/Details/DetailsContext.d.ts.map +1 -1
- package/lib/components/Details/DetailsContext.js +2 -1
- package/lib/components/Details/DetailsContext.js.map +1 -1
- package/lib/components/Details/DetailsList.d.ts +14 -0
- package/lib/components/Details/DetailsList.d.ts.map +1 -0
- package/lib/components/Details/DetailsList.js +30 -0
- package/lib/components/Details/DetailsList.js.map +1 -0
- package/lib/components/Details/index.d.ts +2 -1
- package/lib/components/Details/index.d.ts.map +1 -1
- package/lib/components/Details/index.js +2 -1
- package/lib/components/Details/index.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.d.ts +7 -0
- package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.js +315 -0
- package/lib/components/GenAICoach/GenAICoach.js.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts +28 -0
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.styles.js +217 -0
- package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts +2 -0
- package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.test-ids.js +3 -0
- package/lib/components/GenAICoach/GenAICoach.test-ids.js.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.types.d.ts +66 -0
- package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.types.js +2 -0
- package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.utils.d.ts +9 -0
- package/lib/components/GenAICoach/GenAICoach.utils.d.ts.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.utils.js +10 -0
- package/lib/components/GenAICoach/GenAICoach.utils.js.map +1 -0
- package/lib/components/GenAICoach/GenAIMessage.d.ts +5 -0
- package/lib/components/GenAICoach/GenAIMessage.d.ts.map +1 -0
- package/lib/components/GenAICoach/GenAIMessage.js +34 -0
- package/lib/components/GenAICoach/GenAIMessage.js.map +1 -0
- package/lib/components/GenAICoach/InitialSuggestedMessage.d.ts +5 -0
- package/lib/components/GenAICoach/InitialSuggestedMessage.d.ts.map +1 -0
- package/lib/components/GenAICoach/InitialSuggestedMessage.js +18 -0
- package/lib/components/GenAICoach/InitialSuggestedMessage.js.map +1 -0
- package/lib/components/GenAICoach/index.d.ts +6 -0
- package/lib/components/GenAICoach/index.d.ts.map +1 -0
- package/lib/components/GenAICoach/index.js +5 -0
- package/lib/components/GenAICoach/index.js.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentContainer.d.ts +33 -0
- package/lib/components/HierarchicalAssignments/AssignmentContainer.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentContainer.js +46 -0
- package/lib/components/HierarchicalAssignments/AssignmentContainer.js.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentItem.d.ts +11 -0
- package/lib/components/HierarchicalAssignments/AssignmentItem.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentItem.js +22 -0
- package/lib/components/HierarchicalAssignments/AssignmentItem.js.map +1 -0
- package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts +49 -0
- package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/Assignments.styles.js +223 -0
- package/lib/components/HierarchicalAssignments/Assignments.styles.js.map +1 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.d.ts +7 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.js +33 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.js.map +1 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.d.ts +4 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.js +17 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.js.map +1 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts +69 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.js +2 -0
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.js.map +1 -0
- package/lib/components/HierarchicalAssignments/index.d.ts +3 -0
- package/lib/components/HierarchicalAssignments/index.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/index.js +2 -0
- package/lib/components/HierarchicalAssignments/index.js.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js +2 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +67 -78
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
- package/lib/components/SearchResults/Filter.d.ts.map +1 -1
- package/lib/components/SearchResults/Filter.js +1 -1
- package/lib/components/SearchResults/Filter.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.js +1 -1
- package/lib/components/SearchResults/SearchResults.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.styles.d.ts +1 -0
- package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +29 -29
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +2 -0
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +7 -1
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stakeholders/StakeholderForm.d.ts +1 -0
- package/lib/components/Stakeholders/StakeholderForm.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts +2 -2
- package/lib/components/Tasks/Tasks.d.ts +6 -1
- package/lib/components/Tasks/Tasks.d.ts.map +1 -1
- package/lib/components/Tasks/Tasks.js +13 -5
- package/lib/components/Tasks/Tasks.js.map +1 -1
- package/lib/components/Tasks/Tasks.test-ids.d.ts +3 -3
- package/lib/components/Tasks/Tasks.test-ids.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.js +7 -11
- package/lib/components/Timeline/Timeline.js.map +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts +4 -0
- package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.styles.js +21 -9
- package/lib/components/Timeline/Timeline.styles.js.map +1 -1
- package/lib/components/Timeline/Timeline.types.d.ts +1 -6
- package/lib/components/Timeline/Timeline.types.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.types.js.map +1 -1
- package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
- package/lib/components/Timeline/TimelineItem.js +3 -3
- package/lib/components/Timeline/TimelineItem.js.map +1 -1
- package/lib/components/Timeline/utils.d.ts +1 -4
- package/lib/components/Timeline/utils.d.ts.map +1 -1
- package/lib/components/Timeline/utils.js +0 -9
- package/lib/components/Timeline/utils.js.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.d.ts +14 -0
- package/lib/components/UtilitiesLayout/UtilitiesLayout.d.ts.map +1 -0
- package/lib/components/UtilitiesLayout/UtilitiesLayout.js +46 -0
- package/lib/components/UtilitiesLayout/UtilitiesLayout.js.map +1 -0
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts +8 -0
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts.map +1 -0
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js +29 -0
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js.map +1 -0
- package/lib/components/UtilitiesLayout/index.d.ts +3 -0
- package/lib/components/UtilitiesLayout/index.d.ts.map +1 -0
- package/lib/components/UtilitiesLayout/index.js +2 -0
- package/lib/components/UtilitiesLayout/index.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/package.json +5 -4
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { readableColor } from '
|
|
5
|
-
import { Button, StyledButton, Text, Icon, registerIcon, useI18n, tryCatch, defaultThemeProp, useDirection } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Button, StyledButton, Text, Icon, registerIcon, useI18n, tryCatch, defaultThemeProp, useDirection, readableColor } from '@pega/cosmos-react-core';
|
|
6
5
|
import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
|
|
7
6
|
registerIcon(timesIcon);
|
|
8
7
|
const StyledDismissButton = styled.button `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppAnnouncement.js","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EA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G,IACgB,CACzB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n StyledButton,\n Text,\n Icon,\n registerIcon,\n useI18n,\n tryCatch,\n defaultThemeProp,\n useDirection,\n readableColor\n} from '@pega/cosmos-react-core';\nimport type { BaseProps, ForwardProps, NoChildrenProp } from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nregisterIcon(timesIcon);\n\nexport interface AppAnnouncementProps extends BaseProps, NoChildrenProp {\n /** Heading text for the announcement. */\n heading?: string;\n /** Description text for the announcement. */\n description?: string;\n /** Announcement details to be displayed in form of bulleted list. */\n details?: string[];\n /** Url to open with What's new link. */\n whatsNewLink?: string;\n /** Content to populate the announcement button. */\n whatsNewText?: string;\n /** An image source for the decorative background. */\n image?: string;\n /** Callback when user dismisses the announcements. */\n onDismiss?: () => void;\n ref?: Ref<HTMLElement>;\n}\n\nconst StyledDismissButton = styled.button`\n font-size: 1.25rem;\n border: none;\n`;\n\nexport const StyledAppAnnouncement = styled.article<Pick<AppAnnouncementProps, 'image'>>(props => {\n const {\n theme: {\n base: {\n palette: { 'brand-primary': brandBackground },\n shadow,\n spacing\n },\n components: {\n card: { 'border-radius': borderRadius }\n }\n },\n image\n } = props;\n\n const { end } = useDirection();\n const color = tryCatch(() => readableColor(brandBackground));\n\n return css`\n padding: calc(2 * ${spacing});\n background: ${brandBackground};\n border-radius: ${borderRadius};\n color: ${color};\n position: relative;\n\n &::after {\n background: url('${image}') no-repeat;\n background-position: ${end} bottom;\n background-size: contain;\n background-origin: content-box;\n opacity: 0.2;\n content: '';\n display: block;\n position: absolute;\n width: 50%;\n height: 100%;\n inset-inline-end: 0;\n bottom: 0;\n padding: calc(2 * ${spacing});\n }\n\n h2 {\n position: relative;\n z-index: 2;\n margin-bottom: ${spacing};\n }\n\n ${StyledDismissButton} {\n position: absolute;\n top: 0.75rem;\n inset-inline-end: 0.75rem;\n color: inherit;\n z-index: 3;\n &:enabled:hover {\n background: #ffffff19;\n }\n &:enabled:focus {\n box-shadow: ${shadow.focus};\n }\n }\n\n > div {\n width: 75%;\n position: relative;\n z-index: 2;\n\n p,\n ul {\n padding-top: calc(2 * ${spacing});\n }\n\n ul {\n padding-inline-start: calc(2 * ${spacing});\n }\n\n ${StyledButton} {\n margin-top: calc(2 * ${spacing});\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: ${shadow.focus};\n }\n }\n }\n `;\n});\n\nStyledAppAnnouncement.defaultProps = defaultThemeProp;\n\nconst AppAnnouncement: FunctionComponent<AppAnnouncementProps & ForwardProps> = forwardRef(\n function AppAnnouncement(\n props: PropsWithoutRef<AppAnnouncementProps>,\n ref: AppAnnouncementProps['ref']\n ) {\n const t = useI18n();\n const {\n heading,\n description,\n details,\n whatsNewLink,\n whatsNewText = t('app_announcement_whats_new_button_label'),\n image,\n onDismiss,\n ...restProps\n } = props;\n\n return (\n <StyledAppAnnouncement {...restProps} ref={ref} image={image}>\n {onDismiss && (\n <Button\n as={StyledDismissButton}\n variant='simple'\n icon\n onClick={onDismiss}\n aria-label={t('app_announcement_dismiss_button_label_a11y')}\n >\n <Icon name='times' />\n </Button>\n )}\n <Text variant='h2'>{heading || t('app_announcement_details_list_header')}</Text>\n <div>\n {description && <p>{description}</p>}\n {details && (\n <ul>\n {details.map((item, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <li key={index}>{item}</li>;\n })}\n </ul>\n )}\n {whatsNewLink && (\n <Button variant='secondary' href={whatsNewLink} target='_blank'>\n {whatsNewText}\n </Button>\n )}\n </div>\n </StyledAppAnnouncement>\n );\n }\n);\n\nexport default AppAnnouncement;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ReactNode, FunctionComponent, MouseEvent } from 'react';
|
|
2
2
|
import type { MenuItemProps, BaseProps, ForwardProps, NoChildrenProp, OmitStrict } from '@pega/cosmos-react-core';
|
|
3
|
-
import type { ArticleListHeaderProps } from '../ArticleList/ArticleList.types';
|
|
3
|
+
import type { ArticleFeedbackProps, ArticleListHeaderProps } from '../ArticleList/ArticleList.types';
|
|
4
4
|
import type { ArticleRatingProps } from './ArticleRating';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ArticleFooterProps } from './ArticleFooter';
|
|
6
6
|
import type { ArticleMetaProps } from './ArticleMeta';
|
|
7
7
|
type OnReactionWithId = (articleId: BaseArticleProps['articleId'], reaction: ArticleRatingProps['reaction']) => void;
|
|
8
8
|
export interface BaseArticleProps extends BaseProps, NoChildrenProp {
|
|
@@ -43,7 +43,7 @@ export interface BaseArticleProps extends BaseProps, NoChildrenProp {
|
|
|
43
43
|
content: ReactNode;
|
|
44
44
|
/** Footer */
|
|
45
45
|
footer?: OmitStrict<ArticleFooterProps, 'feedback'> & {
|
|
46
|
-
feedback?: OmitStrict<
|
|
46
|
+
feedback?: OmitStrict<ArticleFeedbackProps, 'onReaction'> & {
|
|
47
47
|
onReaction: OnReactionWithId;
|
|
48
48
|
};
|
|
49
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Article.d.ts","sourceRoot":"","sources":["../../../src/components/Article/Article.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAetE,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,YAAY,EACZ,cAAc,EACd,UAAU,EACX,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Article.d.ts","sourceRoot":"","sources":["../../../src/components/Article/Article.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAetE,OAAO,KAAK,EACV,aAAa,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AC,CAAC;KACnC,EAAE,CAAC;IACJ,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,UAAU,CAAC,kBAAkB,EAAE,YAAY,CAAC,GAAG;QACxD,UAAU,EAAE,gBAAgB,CAAC;KAC9B,CAAC;IACF,sBAAsB;IACtB,OAAO,EAAE,SAAS,CAAC;IACnB,aAAa;IACb,MAAM,CAAC,EAAE,UAAU,CAAC,kBAAkB,EAAE,UAAU,CAAC,GAAG;QACpD,QAAQ,CAAC,EAAE,UAAU,CAAC,oBAAoB,EAAE,YAAY,CAAC,GAAG;YAC1D,UAAU,EAAE,gBAAgB,CAAC;SAC9B,CAAC;KACH,CAAC;IACF,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GACpB,CAAC,gBAAgB,GAAG;IAAE,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,GACxC,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AA8DpD,QAAA,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,GAAG,YAAY,CAqI3D,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -45,11 +45,11 @@ const StyledArticleContent = styled.div(props => {
|
|
|
45
45
|
});
|
|
46
46
|
const StyledBackNavButton = styled(Button)(({ theme: { base: { spacing } } }) => {
|
|
47
47
|
return css `
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: start;
|
|
50
|
+
gap: calc(0.5 * ${spacing});
|
|
51
|
+
margin-inline-end: calc(1.5 * ${spacing});
|
|
52
|
+
`;
|
|
53
53
|
});
|
|
54
54
|
StyledArticleContent.defaultProps = defaultThemeProp;
|
|
55
55
|
StyledArticleWrapper.defaultProps = defaultThemeProp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Article.js","sourceRoot":"","sources":["../../../src/components/Article/Article.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,gBAAgB,EAChB,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,YAAY,EACb,MAAM,yBAAyB,CAAC;AAQjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AAGrG,OAAO,iBAAiB,EAAE,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE9F,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,OAAO,WAAW,MAAM,eAAe,CAAC;AAGxC,YAAY,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AAyD5C,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;IAC9C,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,OAAO,GAAG,CAAA;kBACM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;gCAC1B,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;;;MAGrD,uBAAuB;gCACG,KAAK,CAAC,IAAI,CAAC,OAAO;;GAE/C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAA;;CAExC,CAAC;AAEF,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;IAC9C,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AAE,QAAQ,CAAC,EAAE;wCACrB,cAAc,EAAE,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;oCAClD,CAAC;iCACF;6BACF;4BACH,CAAC,CAAC,SAAS,CAAC,GACd,CACH,IACA,CACJ,EACD,KAAC,QAAQ,IACP,OAAO,EAAE,CAAC,CAAC,OAAO,EAClB,SAAS,EAAC,OAAO,EACjB,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,EACrB,UAAU,EAAE,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC,CAAC,oBAAoB,CAAC,EAAE,GACjE,IACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { ReactNode, FunctionComponent, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n registerIcon,\n Flex,\n MenuButton,\n Text,\n defaultThemeProp,\n Button,\n Icon,\n Progress,\n useI18n,\n useDirection\n} from '@pega/cosmos-react-core';\nimport type {\n MenuItemProps,\n BaseProps,\n ForwardProps,\n NoChildrenProp,\n OmitStrict\n} from '@pega/cosmos-react-core';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\n\nimport type { ArticleListHeaderProps } from '../ArticleList/ArticleList.types';\nimport ArticleListHeader, { StyledArticleListHeader } from '../ArticleList/ArticleListHeader';\n\nimport ArticleRating from './ArticleRating';\nimport type { ArticleRatingProps } from './ArticleRating';\nimport ArticleFooter from './ArticleFooter';\nimport type { ArticleFooterFeedback, ArticleFooterProps } from './ArticleFooter';\nimport ArticleMeta from './ArticleMeta';\nimport type { ArticleMetaProps } from './ArticleMeta';\n\nregisterIcon(caretRightIcon, caretLeftIcon);\n\ntype OnReactionWithId = (\n articleId: BaseArticleProps['articleId'],\n reaction: ArticleRatingProps['reaction']\n) => void;\n\nexport interface BaseArticleProps extends BaseProps, NoChildrenProp {\n articleId: string;\n /** Header to show icon , title and any actions on the container */\n header?: ArticleListHeaderProps;\n /** Control for navigating back */\n backNavigation?: {\n title: string;\n onClick: (e: MouseEvent<HTMLButtonElement>) => void;\n };\n /** Primary actions which needs to be displayed with an icon */\n primaryActions?: {\n /** Unique id for action, used in onClick callback */\n id: string;\n /** Label for this action, shown in tooltip and used for generating aria-label */\n label: string;\n /** Icon to be displayed in the button */\n icon: string;\n /** Callback triggered when a user clicks of presses enter on the action */\n onClick: (id: string, e: MouseEvent<HTMLButtonElement>) => void;\n }[];\n /** Secondary actions that needs to be pushed under more icon */\n secondaryActions?: {\n id: MenuItemProps['id'];\n text: MenuItemProps['primary'];\n onClick: MenuItemProps['onClick'];\n }[];\n /** Article title */\n title: string;\n /** Array of meta data */\n meta?: ArticleMetaProps;\n /** like and dislike status of the article */\n feedback?: OmitStrict<ArticleRatingProps, 'onReaction'> & {\n onReaction: OnReactionWithId;\n };\n /** Article content */\n content: ReactNode;\n /** Footer */\n footer?: OmitStrict<ArticleFooterProps, 'feedback'> & {\n feedback?: OmitStrict<ArticleFooterFeedback, 'onReaction'> & {\n onReaction: OnReactionWithId;\n };\n };\n /** Prop to check visibility of skeleton */\n loading: boolean;\n}\n\nexport type ArticleProps =\n | (BaseArticleProps & { loading?: false })\n | (Partial<BaseArticleProps> & { loading: true });\n\nconst StyledArticleWrapper = styled.div(props => {\n const { theme } = props;\n return css`\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n max-height: inherit;\n\n ${StyledArticleListHeader} {\n padding: 0 0 calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nconst StyledArticleHeader = styled.header`\n flex-shrink: 0;\n`;\n\nconst StyledArticleContent = styled.div(props => {\n const {\n theme,\n theme: {\n base: { spacing }\n }\n } = props;\n\n return css`\n flex-grow: 1;\n overflow-y: auto;\n padding: 0 calc(1.5 * ${spacing});\n margin: 0 calc(-1.5 * ${spacing});\n ul,\n ol {\n padding-left: calc(3 * ${spacing});\n }\n a {\n color: ${theme.components.link.color};\n }\n * {\n margin: revert;\n }\n `;\n});\n\nconst StyledBackNavButton = styled(Button)(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n display: flex;\n align-items: start;\n gap: calc(0.5 * ${spacing});\n margin-inline-end: calc(1.5 * ${spacing});\n `;\n }\n);\n\nStyledArticleContent.defaultProps = defaultThemeProp;\nStyledArticleWrapper.defaultProps = defaultThemeProp;\nStyledBackNavButton.defaultProps = defaultThemeProp;\n\nconst Article: FunctionComponent<ArticleProps & ForwardProps> = (props: ArticleProps) => {\n const {\n articleId,\n header,\n meta,\n title,\n backNavigation,\n content,\n primaryActions,\n secondaryActions,\n footer,\n loading,\n feedback,\n ...restProps\n } = props;\n\n const { feedback: footerFeedback, ...restFooter } = footer ?? {};\n const { rtl, ltr, end, start } = useDirection();\n\n const t = useI18n();\n const backButtonRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (!loading) {\n backButtonRef.current?.focus();\n }\n }, [loading]);\n\n return (\n <Flex\n {...restProps}\n container={{ direction: 'column', gap: 1, pad: [1.5, 2] }}\n as={StyledArticleWrapper}\n aria-busy={loading ? true : undefined}\n >\n {header && <ArticleListHeader {...header} />}\n {(backNavigation || primaryActions || secondaryActions) && (\n <Flex container={{ alignItems: 'start' }} item={{ grow: 1 }}>\n <Flex container={{ pad: [1, undefined, undefined] }} item={{ grow: 1 }}>\n <Button\n as={StyledBackNavButton}\n onClick={backNavigation?.onClick}\n variant='link'\n ref={backButtonRef}\n >\n {ltr && <Icon name={`caret-${start}`} />}\n {backNavigation?.title}\n {rtl && <Icon name={`caret-${end}`} />}\n </Button>\n </Flex>\n\n {!loading && (\n <>\n {primaryActions?.map(({ id, label, onClick, icon }) => {\n return (\n <Button\n key={id}\n onClick={(e: MouseEvent<HTMLButtonElement>) => onClick(id, e)}\n variant='simple'\n label={label}\n icon\n >\n <Icon name={icon} />\n </Button>\n );\n })}\n {secondaryActions && (\n <MenuButton\n variant='simple'\n text={t('actions')}\n icon='more'\n iconOnly\n menu={{\n items: secondaryActions.map(({ text, ...rest }) => ({\n ...rest,\n primary: text\n }))\n }}\n />\n )}\n </>\n )}\n </Flex>\n )}\n {!loading && (\n <>\n <Flex container as={StyledArticleHeader}>\n <Text variant={header ? 'h3' : 'h2'}>{title}</Text>\n </Flex>\n\n {feedback && (\n <ArticleRating\n {...{\n ...feedback,\n onReaction: reaction => {\n feedback?.onReaction(articleId, reaction);\n }\n }}\n />\n )}\n\n {meta && (\n <Flex container item={{ shrink: 0 }}>\n <ArticleMeta {...meta} />\n </Flex>\n )}\n <StyledArticleContent>{content}</StyledArticleContent>\n\n {footer && (\n <ArticleFooter\n {...restFooter}\n {...(footerFeedback\n ? {\n feedback: {\n ...footerFeedback,\n onReaction: reaction => {\n footerFeedback?.onReaction(articleId, reaction);\n }\n }\n }\n : undefined)}\n />\n )}\n </>\n )}\n <Progress\n visible={!!loading}\n placement='block'\n message={t('loading')}\n liveConfig={{ contextualLabel: title ?? t('article_label_a11y') }}\n />\n </Flex>\n );\n};\n\nexport default Article;\n"]}
|
|
1
|
+
{"version":3,"file":"Article.js","sourceRoot":"","sources":["../../../src/components/Article/Article.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,gBAAgB,EAChB,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,YAAY,EACb,MAAM,yBAAyB,CAAC;AAQjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AAMrG,OAAO,iBAAiB,EAAE,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AA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SAAS,QAAC,EAAE,EAAE,mBAAmB,YACrC,KAAC,IAAI,IAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,YAAG,KAAK,GAAQ,GAC9C,EAEN,QAAQ,IAAI,CACX,KAAC,aAAa,IAEV,GAAG,QAAQ;wBACX,UAAU,EAAE,QAAQ,CAAC,EAAE;4BACrB,QAAQ,EAAE,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;wBAC5C,CAAC,GAEH,CACH,EAEA,IAAI,IAAI,CACP,KAAC,IAAI,IAAC,SAAS,QAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YACjC,KAAC,WAAW,OAAK,IAAI,GAAI,GACpB,CACR,EACD,KAAC,oBAAoB,cAAE,OAAO,GAAwB,EAErD,MAAM,IAAI,CACT,KAAC,aAAa,OACR,UAAU,KACV,CAAC,cAAc;4BACjB,CAAC,CAAC;gCACE,QAAQ,EAAE;oCACR,GAAG,cAAc;oCACjB,UAAU,EAAE,QAAQ,CAAC,EAAE;wCACrB,cAAc,EAAE,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;oCAClD,CAAC;iCACF;6BACF;4BACH,CAAC,CAAC,SAAS,CAAC,GACd,CACH,IACA,CACJ,EACD,KAAC,QAAQ,IACP,OAAO,EAAE,CAAC,CAAC,OAAO,EAClB,SAAS,EAAC,OAAO,EACjB,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,EACrB,UAAU,EAAE,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC,CAAC,oBAAoB,CAAC,EAAE,GACjE,IACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { ReactNode, FunctionComponent, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n registerIcon,\n Flex,\n MenuButton,\n Text,\n defaultThemeProp,\n Button,\n Icon,\n Progress,\n useI18n,\n useDirection\n} from '@pega/cosmos-react-core';\nimport type {\n MenuItemProps,\n BaseProps,\n ForwardProps,\n NoChildrenProp,\n OmitStrict\n} from '@pega/cosmos-react-core';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\n\nimport type {\n ArticleFeedbackProps,\n ArticleListHeaderProps\n} from '../ArticleList/ArticleList.types';\nimport ArticleListHeader, { StyledArticleListHeader } from '../ArticleList/ArticleListHeader';\n\nimport ArticleRating from './ArticleRating';\nimport type { ArticleRatingProps } from './ArticleRating';\nimport ArticleFooter from './ArticleFooter';\nimport type { ArticleFooterProps } from './ArticleFooter';\nimport ArticleMeta from './ArticleMeta';\nimport type { ArticleMetaProps } from './ArticleMeta';\n\nregisterIcon(caretRightIcon, caretLeftIcon);\n\ntype OnReactionWithId = (\n articleId: BaseArticleProps['articleId'],\n reaction: ArticleRatingProps['reaction']\n) => void;\n\nexport interface BaseArticleProps extends BaseProps, NoChildrenProp {\n articleId: string;\n /** Header to show icon , title and any actions on the container */\n header?: ArticleListHeaderProps;\n /** Control for navigating back */\n backNavigation?: {\n title: string;\n onClick: (e: MouseEvent<HTMLButtonElement>) => void;\n };\n /** Primary actions which needs to be displayed with an icon */\n primaryActions?: {\n /** Unique id for action, used in onClick callback */\n id: string;\n /** Label for this action, shown in tooltip and used for generating aria-label */\n label: string;\n /** Icon to be displayed in the button */\n icon: string;\n /** Callback triggered when a user clicks of presses enter on the action */\n onClick: (id: string, e: MouseEvent<HTMLButtonElement>) => void;\n }[];\n /** Secondary actions that needs to be pushed under more icon */\n secondaryActions?: {\n id: MenuItemProps['id'];\n text: MenuItemProps['primary'];\n onClick: MenuItemProps['onClick'];\n }[];\n /** Article title */\n title: string;\n /** Array of meta data */\n meta?: ArticleMetaProps;\n /** like and dislike status of the article */\n feedback?: OmitStrict<ArticleRatingProps, 'onReaction'> & {\n onReaction: OnReactionWithId;\n };\n /** Article content */\n content: ReactNode;\n /** Footer */\n footer?: OmitStrict<ArticleFooterProps, 'feedback'> & {\n feedback?: OmitStrict<ArticleFeedbackProps, 'onReaction'> & {\n onReaction: OnReactionWithId;\n };\n };\n /** Prop to check visibility of skeleton */\n loading: boolean;\n}\n\nexport type ArticleProps =\n | (BaseArticleProps & { loading?: false })\n | (Partial<BaseArticleProps> & { loading: true });\n\nconst StyledArticleWrapper = styled.div(props => {\n const { theme } = props;\n return css`\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n max-height: inherit;\n\n ${StyledArticleListHeader} {\n padding: 0 0 calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nconst StyledArticleHeader = styled.header`\n flex-shrink: 0;\n`;\n\nconst StyledArticleContent = styled.div(props => {\n const {\n theme,\n theme: {\n base: { spacing }\n }\n } = props;\n\n return css`\n flex-grow: 1;\n overflow-y: auto;\n padding: 0 calc(1.5 * ${spacing});\n margin: 0 calc(-1.5 * ${spacing});\n ul,\n ol {\n padding-left: calc(3 * ${spacing});\n }\n a {\n color: ${theme.components.link.color};\n }\n * {\n margin: revert;\n }\n `;\n});\n\nconst StyledBackNavButton = styled(Button)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n display: flex;\n align-items: start;\n gap: calc(0.5 * ${spacing});\n margin-inline-end: calc(1.5 * ${spacing});\n `;\n});\n\nStyledArticleContent.defaultProps = defaultThemeProp;\nStyledArticleWrapper.defaultProps = defaultThemeProp;\nStyledBackNavButton.defaultProps = defaultThemeProp;\n\nconst Article: FunctionComponent<ArticleProps & ForwardProps> = (props: ArticleProps) => {\n const {\n articleId,\n header,\n meta,\n title,\n backNavigation,\n content,\n primaryActions,\n secondaryActions,\n footer,\n loading,\n feedback,\n ...restProps\n } = props;\n\n const { feedback: footerFeedback, ...restFooter } = footer ?? {};\n const { rtl, ltr, end, start } = useDirection();\n\n const t = useI18n();\n const backButtonRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (!loading) {\n backButtonRef.current?.focus();\n }\n }, [loading]);\n\n return (\n <Flex\n {...restProps}\n container={{ direction: 'column', gap: 1, pad: [1.5, 2] }}\n as={StyledArticleWrapper}\n aria-busy={loading ? true : undefined}\n >\n {header && <ArticleListHeader {...header} />}\n {(backNavigation || primaryActions || secondaryActions) && (\n <Flex container={{ alignItems: 'start' }} item={{ grow: 1 }}>\n <Flex container={{ pad: [1, undefined, undefined] }} item={{ grow: 1 }}>\n <Button\n as={StyledBackNavButton}\n onClick={backNavigation?.onClick}\n variant='link'\n ref={backButtonRef}\n >\n {ltr && <Icon name={`caret-${start}`} />}\n {backNavigation?.title}\n {rtl && <Icon name={`caret-${end}`} />}\n </Button>\n </Flex>\n\n {!loading && (\n <>\n {primaryActions?.map(({ id, label, onClick, icon }) => {\n return (\n <Button\n key={id}\n onClick={(e: MouseEvent<HTMLButtonElement>) => onClick(id, e)}\n variant='simple'\n label={label}\n icon\n >\n <Icon name={icon} />\n </Button>\n );\n })}\n {secondaryActions && (\n <MenuButton\n variant='simple'\n text={t('actions')}\n icon='more'\n iconOnly\n menu={{\n items: secondaryActions.map(({ text, ...rest }) => ({\n ...rest,\n primary: text\n }))\n }}\n />\n )}\n </>\n )}\n </Flex>\n )}\n {!loading && (\n <>\n <Flex container as={StyledArticleHeader}>\n <Text variant={header ? 'h3' : 'h2'}>{title}</Text>\n </Flex>\n\n {feedback && (\n <ArticleRating\n {...{\n ...feedback,\n onReaction: reaction => {\n feedback?.onReaction(articleId, reaction);\n }\n }}\n />\n )}\n\n {meta && (\n <Flex container item={{ shrink: 0 }}>\n <ArticleMeta {...meta} />\n </Flex>\n )}\n <StyledArticleContent>{content}</StyledArticleContent>\n\n {footer && (\n <ArticleFooter\n {...restFooter}\n {...(footerFeedback\n ? {\n feedback: {\n ...footerFeedback,\n onReaction: reaction => {\n footerFeedback?.onReaction(articleId, reaction);\n }\n }\n }\n : undefined)}\n />\n )}\n </>\n )}\n <Progress\n visible={!!loading}\n placement='block'\n message={t('loading')}\n liveConfig={{ contextualLabel: title ?? t('article_label_a11y') }}\n />\n </Flex>\n );\n};\n\nexport default Article;\n"]}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import type { FunctionComponent, MouseEvent } from 'react';
|
|
2
|
-
import type { BaseProps, ForwardProps,
|
|
3
|
-
import type {
|
|
2
|
+
import type { BaseProps, ForwardProps, FileItemProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import type { ArticleFeedbackProps } from '../ArticleList/ArticleList.types';
|
|
4
4
|
export interface ArticleTag {
|
|
5
5
|
/** Tag name */
|
|
6
6
|
tagName: string;
|
|
7
7
|
/** Tag id. If not set tagName is treated as id */
|
|
8
8
|
id: string;
|
|
9
9
|
}
|
|
10
|
-
export interface ArticleFooterFeedback extends OmitStrict<ArticleRatingProps, 'likes' | 'dislikes'> {
|
|
11
|
-
showThanksMessage?: boolean;
|
|
12
|
-
}
|
|
13
10
|
export interface ArticleFooterProps extends BaseProps {
|
|
14
11
|
/** Feedback for this article */
|
|
15
|
-
feedback?:
|
|
12
|
+
feedback?: ArticleFeedbackProps;
|
|
16
13
|
tags?: {
|
|
17
14
|
/** Article tags */
|
|
18
15
|
list: ArticleTag[];
|
|
@@ -31,7 +28,7 @@ export interface ArticleFooterProps extends BaseProps {
|
|
|
31
28
|
onClick: (id: string, e: MouseEvent<HTMLButtonElement>) => void;
|
|
32
29
|
}[];
|
|
33
30
|
/** Attachments */
|
|
34
|
-
attachments?:
|
|
31
|
+
attachments?: FileItemProps[];
|
|
35
32
|
}
|
|
36
33
|
declare const ArticleFooter: FunctionComponent<ArticleFooterProps & ForwardProps>;
|
|
37
34
|
export default ArticleFooter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleFooter.d.ts","sourceRoot":"","sources":["../../../src/components/Article/ArticleFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,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}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Flex, Tag, defaultThemeProp, Button, Text, Link, useI18n,
|
|
3
|
+
import { Flex, Tag, defaultThemeProp, Button, Text, Link, useI18n, FileList } from '@pega/cosmos-react-core';
|
|
5
4
|
import { StyledTag } from '@pega/cosmos-react-core/lib/components/Badges/Tag';
|
|
5
|
+
import ArticleFeedback from '../ArticleList/ArticleFeedback';
|
|
6
6
|
const StyledRelatedItemsContainer = styled.div ``;
|
|
7
7
|
const StyledRelatedItemsList = styled.div ``;
|
|
8
8
|
const StyledArticleFooter = styled.div(({ theme }) => {
|
|
@@ -13,7 +13,7 @@ const StyledArticleFooter = styled.div(({ theme }) => {
|
|
|
13
13
|
display: block;
|
|
14
14
|
background: ${theme.base.palette['border-line']};
|
|
15
15
|
height: 0.0625rem;
|
|
16
|
-
margin-
|
|
16
|
+
margin-block-end: ${theme.base.spacing};
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
${StyledRelatedItemsContainer} {
|
|
@@ -39,20 +39,12 @@ const ArticleFooter = (props) => {
|
|
|
39
39
|
const { tags, relatedLinks, relatedArticles, feedback, attachments, ...restProps } = props;
|
|
40
40
|
const t = useI18n();
|
|
41
41
|
return (_jsxs(Flex, { as: StyledArticleFooter, container: {
|
|
42
|
-
direction: 'column'
|
|
43
|
-
|
|
44
|
-
}, ...restProps, children: [feedback && (_jsx(Flex, { container: { gap: 2, alignItems: 'center' }, children: feedback.showThanksMessage ? (_jsx(Text, { children: t('article_thank_you_for_your_feedback') })) : (_jsxs(_Fragment, { children: [_jsx(Text, { children: t('article_was_this_helpful') }), _jsxs(Flex, { container: true, children: [_jsx(Button, { variant: feedback.reaction === 'liked' ? 'primary' : 'secondary', onClick: () => {
|
|
45
|
-
feedback.onReaction(feedback.reaction === 'liked' ? undefined : 'liked');
|
|
46
|
-
}, "aria-pressed": feedback.reaction === 'liked', children: t('yes') }), _jsx(Button, { variant: feedback.reaction === 'disliked' ? 'primary' : 'secondary', onClick: () => {
|
|
47
|
-
feedback.onReaction(feedback.reaction === 'disliked' ? undefined : 'disliked');
|
|
48
|
-
}, "aria-pressed": feedback.reaction === 'disliked', children: t('no') })] })] })) })), tags && (_jsx(Flex, { container: { wrap: 'wrap' }, as: StyledTags, children: tags.list.map(tag => (_jsx(Tag, { tabIndex: 0, type: 'pill', variant: 'light', "data-tag-id": tag.id, onClick: tags.onTagClick ? () => tags.onTagClick?.(tag.id) : undefined, rel: 'tag', children: tag.tagName }, tag.id))) })), relatedLinks && (_jsxs(Flex, { as: StyledRelatedItemsContainer, container: { direction: 'column', gap: 1 }, children: [_jsx(Text, { variant: 'h3', children: t('article_related_links') }), _jsx(Flex, { as: StyledRelatedItemsList, container: { direction: 'column', alignItems: 'start', gap: 0.5 }, children: relatedLinks?.map(({ title, href }) => {
|
|
42
|
+
direction: 'column'
|
|
43
|
+
}, ...restProps, children: [feedback && _jsx(ArticleFeedback, { ...feedback }), tags && (_jsx(Flex, { container: { wrap: 'wrap' }, as: StyledTags, children: tags.list.map(tag => (_jsx(Tag, { tabIndex: 0, type: 'pill', variant: 'light', "data-tag-id": tag.id, onClick: tags.onTagClick ? () => tags.onTagClick?.(tag.id) : undefined, rel: 'tag', children: tag.tagName }, tag.id))) })), relatedLinks && (_jsxs(Flex, { as: StyledRelatedItemsContainer, container: { direction: 'column', gap: 1 }, children: [_jsx(Text, { variant: 'h3', children: t('article_related_links') }), _jsx(Flex, { as: StyledRelatedItemsList, container: { direction: 'column', alignItems: 'start', gap: 0.5 }, children: relatedLinks?.map(({ title, href }) => {
|
|
49
44
|
return (_jsx(Link, { href: href, target: '_blank', children: title }, title));
|
|
50
45
|
}) })] })), relatedArticles && (_jsxs(Flex, { as: StyledRelatedItemsContainer, container: { direction: 'column', gap: 1 }, children: [_jsx(Text, { variant: 'h3', children: t('article_more_like_this') }), _jsx(Flex, { as: StyledRelatedItemsList, container: { direction: 'column', alignItems: 'start', gap: 0.5 }, children: relatedArticles?.map(({ id, title, onClick }) => {
|
|
51
46
|
return (_jsx(Button, { variant: 'link', onClick: (e) => onClick(id, e), children: title }, id));
|
|
52
|
-
}) })] })), attachments && (_jsxs(Flex, { as: StyledRelatedItemsContainer, container: { direction: 'column', gap: 1 }, children: [_jsx(Text, { variant: 'h3', children: t('article_attachments') }), _jsx(
|
|
53
|
-
cols: 'repeat(auto-fill, minmax(10rem, 1fr))',
|
|
54
|
-
gap: 1
|
|
55
|
-
}, as: 'ul', children: attachments?.map(attachment => (_createElement(FileUploadItem, { ...attachment, key: attachment.name }))) })] }))] }));
|
|
47
|
+
}) })] })), attachments && (_jsxs(Flex, { as: StyledRelatedItemsContainer, container: { direction: 'column', gap: 1 }, children: [_jsx(Text, { variant: 'h3', children: t('article_attachments') }), _jsx(FileList, { type: 'item', items: attachments })] }))] }));
|
|
56
48
|
};
|
|
57
49
|
export default ArticleFooter;
|
|
58
50
|
//# sourceMappingURL=ArticleFooter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleFooter.js","sourceRoot":"","sources":["../../../src/components/Article/ArticleFooter.tsx"],"names":[],"mappings":";;AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,GAAG,EACH,gBAAgB,EAChB,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,cAAc,EACd,IAAI,EACL,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,SAAS,EAAE,MAAM,mDAAmD,CAAC;AAqC9E,MAAM,2BAA2B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACjD,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA,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EAAE;4BAC/C,OAAO,CACL,KAAC,MAAM,IAEL,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,CAAC,CAAgC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,YAE5D,KAAK,IAJD,EAAE,CAKA,CACV,CAAC;wBACJ,CAAC,CAAC,GACG,IACF,CACR,EAEA,WAAW,IAAI,CACd,MAAC,IAAI,IAAC,EAAE,EAAE,2BAA2B,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAC/E,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,qBAAqB,CAAC,GAAQ,EACpD,KAAC,IAAI,IACH,SAAS,EAAE;4BACT,IAAI,EAAE,uCAAuC;4BAC7C,GAAG,EAAE,CAAC;yBACP,EACD,EAAE,EAAC,IAAI,YAEN,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAC9B,eAAC,cAAc,OAAK,UAAU,EAAE,GAAG,EAAE,UAAU,CAAC,IAAI,GAAI,CACzD,CAAC,GACG,IACF,CACR,IACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import type { FunctionComponent, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Tag,\n defaultThemeProp,\n Button,\n Text,\n Link,\n useI18n,\n FileUploadItem,\n Grid\n} from '@pega/cosmos-react-core';\nimport type {\n BaseProps,\n ForwardProps,\n FileUploadItemProps,\n OmitStrict\n} from '@pega/cosmos-react-core';\nimport { StyledTag } from '@pega/cosmos-react-core/lib/components/Badges/Tag';\n\nimport type { ArticleRatingProps } from './ArticleRating';\n\nexport interface ArticleTag {\n /** Tag name */\n tagName: string;\n /** Tag id. If not set tagName is treated as id */\n id: string;\n}\n\nexport interface ArticleFooterFeedback\n extends OmitStrict<ArticleRatingProps, 'likes' | 'dislikes'> {\n showThanksMessage?: boolean;\n}\n\nexport interface ArticleFooterProps extends BaseProps {\n /** Feedback for this article */\n feedback?: ArticleFooterFeedback;\n tags?: {\n /** Article tags */\n list: ArticleTag[];\n /** Callback that triggers on click of tag */\n onTagClick?: (id: ArticleTag['id']) => void;\n };\n /** Links to external sites */\n relatedLinks?: { title: string; href: string }[];\n /** Links to other articles */\n relatedArticles?: {\n id: string;\n title: string;\n onClick: (id: string, e: MouseEvent<HTMLButtonElement>) => void;\n }[];\n /** Attachments */\n attachments?: FileUploadItemProps[];\n}\n\nconst StyledRelatedItemsContainer = styled.div``;\nconst StyledRelatedItemsList = styled.div``;\n\nconst StyledArticleFooter = styled.div(({ theme }) => {\n return css`\n flex-shrink: 0;\n &::before {\n content: '';\n display: block;\n background: ${theme.base.palette['border-line']};\n height: 0.0625rem;\n margin-bottom: calc(2 * ${theme.base.spacing});\n }\n\n ${StyledRelatedItemsContainer} {\n margin-block-start: ${theme.base.spacing};\n & > ${StyledRelatedItemsList} * {\n margin-inline-start: 0;\n }\n }\n `;\n});\n\nStyledArticleFooter.defaultProps = defaultThemeProp;\n\nconst StyledTags = styled.div(({ theme }) => {\n return css`\n padding: calc(0.25 * ${theme.base.spacing});\n margin: 0 calc(-0.5 * ${theme.base.spacing});\n & > ${StyledTag} {\n margin: calc(0.25 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledTags.defaultProps = defaultThemeProp;\n\nconst ArticleFooter: FunctionComponent<ArticleFooterProps & ForwardProps> = (\n props: ArticleFooterProps\n) => {\n const { tags, relatedLinks, relatedArticles, feedback, attachments, ...restProps } = props;\n const t = useI18n();\n\n return (\n <Flex\n as={StyledArticleFooter}\n container={{\n direction: 'column',\n gap: 2\n }}\n {...restProps}\n >\n {feedback && (\n <Flex container={{ gap: 2, alignItems: 'center' }}>\n {feedback.showThanksMessage ? (\n <Text>{t('article_thank_you_for_your_feedback')}</Text>\n ) : (\n <>\n <Text>{t('article_was_this_helpful')}</Text>\n <Flex container>\n <Button\n variant={feedback.reaction === 'liked' ? 'primary' : 'secondary'}\n onClick={() => {\n feedback.onReaction(feedback.reaction === 'liked' ? undefined : 'liked');\n }}\n aria-pressed={feedback.reaction === 'liked'}\n >\n {t('yes')}\n </Button>\n <Button\n variant={feedback.reaction === 'disliked' ? 'primary' : 'secondary'}\n onClick={() => {\n feedback.onReaction(feedback.reaction === 'disliked' ? undefined : 'disliked');\n }}\n aria-pressed={feedback.reaction === 'disliked'}\n >\n {t('no')}\n </Button>\n </Flex>\n </>\n )}\n </Flex>\n )}\n {tags && (\n <Flex container={{ wrap: 'wrap' }} as={StyledTags}>\n {tags.list.map(tag => (\n <Tag\n tabIndex={0}\n type='pill'\n variant='light'\n key={tag.id}\n data-tag-id={tag.id}\n onClick={tags.onTagClick ? () => tags.onTagClick?.(tag.id) : undefined}\n rel='tag'\n >\n {tag.tagName}\n </Tag>\n ))}\n </Flex>\n )}\n\n {relatedLinks && (\n <Flex as={StyledRelatedItemsContainer} container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{t('article_related_links')}</Text>\n <Flex\n as={StyledRelatedItemsList}\n container={{ direction: 'column', alignItems: 'start', gap: 0.5 }}\n >\n {relatedLinks?.map(({ title, href }) => {\n return (\n <Link href={href} target='_blank' key={title}>\n {title}\n </Link>\n );\n })}\n </Flex>\n </Flex>\n )}\n\n {relatedArticles && (\n <Flex as={StyledRelatedItemsContainer} container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{t('article_more_like_this')}</Text>\n <Flex\n as={StyledRelatedItemsList}\n container={{ direction: 'column', alignItems: 'start', gap: 0.5 }}\n >\n {relatedArticles?.map(({ id, title, onClick }) => {\n return (\n <Button\n key={id}\n variant='link'\n onClick={(e: MouseEvent<HTMLButtonElement>) => onClick(id, e)}\n >\n {title}\n </Button>\n );\n })}\n </Flex>\n </Flex>\n )}\n\n {attachments && (\n <Flex as={StyledRelatedItemsContainer} container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{t('article_attachments')}</Text>\n <Grid\n container={{\n cols: 'repeat(auto-fill, minmax(10rem, 1fr))',\n gap: 1\n }}\n as='ul'\n >\n {attachments?.map(attachment => (\n <FileUploadItem {...attachment} key={attachment.name} />\n ))}\n </Grid>\n </Flex>\n )}\n </Flex>\n );\n};\n\nexport default ArticleFooter;\n"]}
|
|
1
|
+
{"version":3,"file":"ArticleFooter.js","sourceRoot":"","sources":["../../../src/components/Article/ArticleFooter.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,GAAG,EACH,gBAAgB,EAChB,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,mDAAmD,CAAC;AAE9E,OAAO,eAAe,MAAM,gCAAgC,CAAC;AA+B7D,MAAM,2BAA2B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACjD,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE5C,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACnD,OAAO,GAAG,CAAA;;;;;oBAKQ,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;;0BAE3B,KAAK,CAAC,IAAI,CAAC,OAAO;;;MAGtC,2BAA2B;4BACL,KAAK,CAAC,IAAI,CAAC,OAAO;YAClC,sBAAsB;;;;GAI/B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC1C,OAAO,GAAG,CAAA;2BACe,KAAK,CAAC,IAAI,CAAC,OAAO;4BACjB,KAAK,CAAC,IAAI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AC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,qBAAqB,CAAC,GAAQ,EACpD,KAAC,QAAQ,IAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAE,WAAW,GAAI,IACvC,CACR,IACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import type { FunctionComponent, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Tag,\n defaultThemeProp,\n Button,\n Text,\n Link,\n useI18n,\n FileList\n} from '@pega/cosmos-react-core';\nimport type { BaseProps, ForwardProps, FileItemProps } from '@pega/cosmos-react-core';\nimport { StyledTag } from '@pega/cosmos-react-core/lib/components/Badges/Tag';\n\nimport ArticleFeedback from '../ArticleList/ArticleFeedback';\nimport type { ArticleFeedbackProps } from '../ArticleList/ArticleList.types';\n\nexport interface ArticleTag {\n /** Tag name */\n tagName: string;\n /** Tag id. If not set tagName is treated as id */\n id: string;\n}\n\nexport interface ArticleFooterProps extends BaseProps {\n /** Feedback for this article */\n feedback?: ArticleFeedbackProps;\n tags?: {\n /** Article tags */\n list: ArticleTag[];\n /** Callback that triggers on click of tag */\n onTagClick?: (id: ArticleTag['id']) => void;\n };\n /** Links to external sites */\n relatedLinks?: { title: string; href: string }[];\n /** Links to other articles */\n relatedArticles?: {\n id: string;\n title: string;\n onClick: (id: string, e: MouseEvent<HTMLButtonElement>) => void;\n }[];\n /** Attachments */\n attachments?: FileItemProps[];\n}\n\nconst StyledRelatedItemsContainer = styled.div``;\nconst StyledRelatedItemsList = styled.div``;\n\nconst StyledArticleFooter = styled.div(({ theme }) => {\n return css`\n flex-shrink: 0;\n &::before {\n content: '';\n display: block;\n background: ${theme.base.palette['border-line']};\n height: 0.0625rem;\n margin-block-end: ${theme.base.spacing};\n }\n\n ${StyledRelatedItemsContainer} {\n margin-block-start: ${theme.base.spacing};\n & > ${StyledRelatedItemsList} * {\n margin-inline-start: 0;\n }\n }\n `;\n});\n\nStyledArticleFooter.defaultProps = defaultThemeProp;\n\nconst StyledTags = styled.div(({ theme }) => {\n return css`\n padding: calc(0.25 * ${theme.base.spacing});\n margin: 0 calc(-0.5 * ${theme.base.spacing});\n & > ${StyledTag} {\n margin: calc(0.25 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledTags.defaultProps = defaultThemeProp;\n\nconst ArticleFooter: FunctionComponent<ArticleFooterProps & ForwardProps> = (\n props: ArticleFooterProps\n) => {\n const { tags, relatedLinks, relatedArticles, feedback, attachments, ...restProps } = props;\n const t = useI18n();\n\n return (\n <Flex\n as={StyledArticleFooter}\n container={{\n direction: 'column'\n }}\n {...restProps}\n >\n {feedback && <ArticleFeedback {...feedback} />}\n {tags && (\n <Flex container={{ wrap: 'wrap' }} as={StyledTags}>\n {tags.list.map(tag => (\n <Tag\n tabIndex={0}\n type='pill'\n variant='light'\n key={tag.id}\n data-tag-id={tag.id}\n onClick={tags.onTagClick ? () => tags.onTagClick?.(tag.id) : undefined}\n rel='tag'\n >\n {tag.tagName}\n </Tag>\n ))}\n </Flex>\n )}\n\n {relatedLinks && (\n <Flex as={StyledRelatedItemsContainer} container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{t('article_related_links')}</Text>\n <Flex\n as={StyledRelatedItemsList}\n container={{ direction: 'column', alignItems: 'start', gap: 0.5 }}\n >\n {relatedLinks?.map(({ title, href }) => {\n return (\n <Link href={href} target='_blank' key={title}>\n {title}\n </Link>\n );\n })}\n </Flex>\n </Flex>\n )}\n\n {relatedArticles && (\n <Flex as={StyledRelatedItemsContainer} container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{t('article_more_like_this')}</Text>\n <Flex\n as={StyledRelatedItemsList}\n container={{ direction: 'column', alignItems: 'start', gap: 0.5 }}\n >\n {relatedArticles?.map(({ id, title, onClick }) => {\n return (\n <Button\n key={id}\n variant='link'\n onClick={(e: MouseEvent<HTMLButtonElement>) => onClick(id, e)}\n >\n {title}\n </Button>\n );\n })}\n </Flex>\n </Flex>\n )}\n\n {attachments && (\n <Flex as={StyledRelatedItemsContainer} container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{t('article_attachments')}</Text>\n <FileList type='item' items={attachments} />\n </Flex>\n )}\n </Flex>\n );\n};\n\nexport default ArticleFooter;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleMeta.d.ts","sourceRoot":"","sources":["../../../src/components/Article/ArticleMeta.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"ArticleMeta.d.ts","sourceRoot":"","sources":["../../../src/components/Article/ArticleMeta.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAcpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;CAC/C;AAED,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CAcpD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -4,8 +4,8 @@ import styled, { css } from 'styled-components';
|
|
|
4
4
|
import { DateTimeDisplay, MetaList, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
5
5
|
const StyledMetaList = styled(MetaList)(({ theme: { base: { spacing } } }) => {
|
|
6
6
|
return css `
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
padding: calc(0.5 * ${spacing});
|
|
8
|
+
`;
|
|
9
9
|
});
|
|
10
10
|
StyledMetaList.defaultProps = defaultThemeProp;
|
|
11
11
|
const ArticleMeta = ({ category, publishedDate }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleMeta.js","sourceRoot":"","sources":["../../../src/components/Article/ArticleMeta.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGtF,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"ArticleMeta.js","sourceRoot":"","sources":["../../../src/components/Article/ArticleMeta.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGtF,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EACvC,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,OAAO,EAAE,EAClB,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;0BACc,OAAO;GAC9B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAO/C,MAAM,WAAW,GAAwC,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,EAAE;IACvF,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE;QAC7B,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,IAAI,QAAQ,EAAE;YACZ,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACtB;QACD,IAAI,aAAa,EAAE;YACjB,KAAK,CAAC,IAAI,CAAC,KAAC,eAAe,IAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,GAAG,CAAC,CAAC;SACpF;QAED,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;IAE9B,OAAO,KAAC,cAAc,IAAC,KAAK,EAAE,SAAS,GAAI,CAAC;AAC9C,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport type { FunctionComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { DateTimeDisplay, MetaList, defaultThemeProp } from '@pega/cosmos-react-core';\nimport type { DateTimeDisplayProps } from '@pega/cosmos-react-core';\n\nconst StyledMetaList = styled(MetaList)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n padding: calc(0.5 * ${spacing});\n `;\n});\n\nStyledMetaList.defaultProps = defaultThemeProp;\n\nexport interface ArticleMetaProps {\n category?: string;\n publishedDate?: DateTimeDisplayProps['value'];\n}\n\nconst ArticleMeta: FunctionComponent<ArticleMetaProps> = ({ category, publishedDate }) => {\n const metaItems = useMemo(() => {\n const items = [];\n if (category) {\n items.push(category);\n }\n if (publishedDate) {\n items.push(<DateTimeDisplay value={publishedDate} variant='date' format='long' />);\n }\n\n return items;\n }, [category, publishedDate]);\n\n return <StyledMetaList items={metaItems} />;\n};\n\nexport default ArticleMeta;\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AIArticleSummaryProps } from './ArticleList.types';
|
|
3
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<AIArticleSummaryProps, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=AIArticleSummary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AIArticleSummary.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/AIArticleSummary.tsx"],"names":[],"mappings":";AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;;AA4BjE,wBAkDG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { CardContent, Text, NumberDisplay, useI18n, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
5
|
+
import { ArticleCard } from './ArticleSummary.styles';
|
|
6
|
+
import ArticleSummaryHeader from './ArticleSummaryHeader';
|
|
7
|
+
import ArticleTag from './ArticleTag';
|
|
8
|
+
const StyledAiArticleCard = styled(ArticleCard)(({ theme, semanticSearch }) => {
|
|
9
|
+
return css `
|
|
10
|
+
&:last-child {
|
|
11
|
+
padding-block-end: ${theme.base.spacing};
|
|
12
|
+
}
|
|
13
|
+
${semanticSearch
|
|
14
|
+
? css `
|
|
15
|
+
&&&&:last-child {
|
|
16
|
+
border-block-end: none;
|
|
17
|
+
}
|
|
18
|
+
`
|
|
19
|
+
: css `
|
|
20
|
+
&:not(:last-child) {
|
|
21
|
+
border-block-end: none;
|
|
22
|
+
}
|
|
23
|
+
`}
|
|
24
|
+
`;
|
|
25
|
+
});
|
|
26
|
+
StyledAiArticleCard.defaultProps = defaultThemeProp;
|
|
27
|
+
export default forwardRef(function AIArticleSummary({ articleId, title, href, onTitleClick, actions, score, semanticSearch = false, quickFilters, onQuickFilterClick, ...restProps }, ref) {
|
|
28
|
+
const t = useI18n();
|
|
29
|
+
return (_jsxs(StyledAiArticleCard, { ...restProps, as: 'li', ref: ref, semanticSearch: semanticSearch, children: [_jsx(ArticleSummaryHeader, { articleId: articleId, title: title, actions: actions, onTitleClick: onTitleClick, href: href }), ((score !== undefined && score > 0) || (quickFilters && quickFilters.length > 0)) && (_jsxs(CardContent, { children: [score !== undefined && score > 0 && (_jsx(Text, { variant: 'secondary', children: t(semanticSearch ? 'relevance_score' : 'score', [
|
|
30
|
+
_jsx(NumberDisplay, { value: score, unit: 'percent', formattingOptions: { fractionDigits: 0 } })
|
|
31
|
+
]) })), quickFilters && quickFilters.length > 0 && (_jsx(ArticleTag, { quickFilters: quickFilters, onQuickFilterClick: onQuickFilterClick }))] }))] }));
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=AIArticleSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AIArticleSummary.js","sourceRoot":"","sources":["../../../src/components/ArticleList/AIArticleSummary.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,WAAW,EACX,IAAI,EAEJ,aAAa,EACb,OAAO,EACP,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,mBAAmB,GAAG,MAAM,CAAC,WAAW,CAAC,CAE5C,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE;IAC/B,OAAO,GAAG,CAAA;;2BAEe,KAAK,CAAC,IAAI,CAAC,OAAO;;MAEvC,cAAc;QACd,CAAC,CAAC,GAAG,CAAA;;;;SAIF;QACH,CAAC,CAAC,GAAG,CAAA;;;;SAIF;GACN,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,eAAe,UAAU,CAGvB,SAAS,gBAAgB,CACzB,EACE,SAAS,EACT,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,KAAK,EACL,cAAc,GAAG,KAAK,EACtB,YAAY,EACZ,kBAAkB,EAClB,GAAG,SAAS,EACb,EACD,GAAG;IAEH,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,OAAO,CACL,MAAC,mBAAmB,OAAK,SAAS,EAAE,EAAE,EAAC,IAAI,EAAC,GAAG,EAAE,GAAG,EAAE,cAAc,EAAE,cAAc,aAClF,KAAC,oBAAoB,IACnB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,IAAI,GACV,EACD,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CACpF,MAAC,WAAW,eACT,KAAK,KAAK,SAAS,IAAI,KAAK,GAAG,CAAC,IAAI,CACnC,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,YACtB,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,EAAE;4BAC/C,KAAC,aAAa,IACZ,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,SAAS,EACd,iBAAiB,EAAE,EAAE,cAAc,EAAE,CAAC,EAAE,GACxC;yBACH,CAAC,GACG,CACR,EAEA,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,CAC1C,KAAC,UAAU,IAAC,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,GAAI,CACnF,IACW,CACf,IACmB,CACvB,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import type { PropsWithoutRef } from 'react';\nimport { forwardRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n CardContent,\n Text,\n type RefElement,\n NumberDisplay,\n useI18n,\n defaultThemeProp\n} from '@pega/cosmos-react-core';\n\nimport type { AIArticleSummaryProps } from './ArticleList.types';\nimport { ArticleCard } from './ArticleSummary.styles';\nimport ArticleSummaryHeader from './ArticleSummaryHeader';\nimport ArticleTag from './ArticleTag';\n\nconst StyledAiArticleCard = styled(ArticleCard)<{\n semanticSearch: AIArticleSummaryProps['semanticSearch'];\n}>(({ theme, semanticSearch }) => {\n return css`\n &:last-child {\n padding-block-end: ${theme.base.spacing};\n }\n ${semanticSearch\n ? css`\n &&&&:last-child {\n border-block-end: none;\n }\n `\n : css`\n &:not(:last-child) {\n border-block-end: none;\n }\n `}\n `;\n});\n\nStyledAiArticleCard.defaultProps = defaultThemeProp;\n\nexport default forwardRef<\n RefElement<AIArticleSummaryProps>,\n PropsWithoutRef<AIArticleSummaryProps>\n>(function AIArticleSummary(\n {\n articleId,\n title,\n href,\n onTitleClick,\n actions,\n score,\n semanticSearch = false,\n quickFilters,\n onQuickFilterClick,\n ...restProps\n },\n ref\n) {\n const t = useI18n();\n\n return (\n <StyledAiArticleCard {...restProps} as='li' ref={ref} semanticSearch={semanticSearch}>\n <ArticleSummaryHeader\n articleId={articleId}\n title={title}\n actions={actions}\n onTitleClick={onTitleClick}\n href={href}\n />\n {((score !== undefined && score > 0) || (quickFilters && quickFilters.length > 0)) && (\n <CardContent>\n {score !== undefined && score > 0 && (\n <Text variant='secondary'>\n {t(semanticSearch ? 'relevance_score' : 'score', [\n <NumberDisplay\n value={score}\n unit='percent'\n formattingOptions={{ fractionDigits: 0 }}\n />\n ])}\n </Text>\n )}\n\n {quickFilters && quickFilters.length > 0 && (\n <ArticleTag quickFilters={quickFilters} onQuickFilterClick={onQuickFilterClick} />\n )}\n </CardContent>\n )}\n </StyledAiArticleCard>\n );\n});\n"]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { FunctionComponent } from 'react';
|
|
2
2
|
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
3
|
import type { ArticleBuddyProps } from './ArticleList.types';
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const StyledDisclaimerText: import("styled-components").StyledComponent<FunctionComponent<import("@pega/cosmos-react-core").TextProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
-
export declare const StyledBuddyContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
4
|
+
export declare const StyledQueryContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
5
|
declare const ArticleBuddy: FunctionComponent<ArticleBuddyProps & ForwardProps>;
|
|
8
6
|
export default ArticleBuddy;
|
|
9
7
|
//# sourceMappingURL=ArticleBuddy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleBuddy.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleBuddy.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ArticleBuddy.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleBuddy.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAgB9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,eAAO,MAAM,oBAAoB,yGAWhC,CAAC;AAQF,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CA2FrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,69 +1,51 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { useEffect } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
export const StyledDisclaimerHeader = styled(Text)(({ theme: { base: { spacing, palette } } }) => {
|
|
8
|
-
return css `
|
|
9
|
-
font-weight: bold;
|
|
10
|
-
border-block-start: 0.0625rem solid ${palette['border-line']};
|
|
11
|
-
padding-block: ${spacing};
|
|
12
|
-
`;
|
|
13
|
-
});
|
|
14
|
-
StyledDisclaimerHeader.defaultProps = defaultThemeProp;
|
|
15
|
-
export const StyledDisclaimerText = styled(Text)(({ theme: { base: { 'font-size': fontSize, 'font-scale': fontScale, spacing } } }) => {
|
|
16
|
-
const systemFontSize = calculateFontSize(fontSize, fontScale).xs;
|
|
17
|
-
return css `
|
|
18
|
-
font-style: italic;
|
|
19
|
-
font-size: ${systemFontSize};
|
|
20
|
-
margin-block-end: calc(2.5 * ${spacing});
|
|
21
|
-
`;
|
|
22
|
-
});
|
|
23
|
-
StyledDisclaimerText.defaultProps = defaultThemeProp;
|
|
24
|
-
export const StyledBuddyContainer = styled.div(({ theme: { base: { spacing } } }) => {
|
|
4
|
+
import { Flex, defaultThemeProp, useI18n, Button, useLiveLog, TextArea, AIButton, Progress, getFocusables, MenuButton, AdditionalInfo } from '@pega/cosmos-react-core';
|
|
5
|
+
import ArticleBuddyResponse from './ArticleBuddyResponse';
|
|
6
|
+
export const StyledQueryContainer = styled.div(({ theme: { base: { spacing, colors } } }) => {
|
|
25
7
|
return css `
|
|
26
8
|
padding: calc(2 * ${spacing});
|
|
27
|
-
|
|
28
|
-
max-height: inherit;
|
|
29
|
-
height: 100%;
|
|
9
|
+
background-color: ${colors.gray['extra-light']};
|
|
30
10
|
`;
|
|
31
11
|
});
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
12
|
+
StyledQueryContainer.defaultProps = defaultThemeProp;
|
|
13
|
+
const StyledBuddyContainer = styled(Flex) `
|
|
14
|
+
height: 100%;
|
|
15
|
+
`;
|
|
16
|
+
const ArticleBuddy = ({ query, onClear, onSubmit, buddyOptions, response, list, loading, ...restProps }) => {
|
|
35
17
|
const t = useI18n();
|
|
36
|
-
const
|
|
18
|
+
const buddyRef = useRef(null);
|
|
37
19
|
const { announcePolite } = useLiveLog();
|
|
20
|
+
const [announceResult, setannounceResult] = useState(false);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const focusables = getFocusables(buddyRef);
|
|
23
|
+
if (focusables.length > 0) {
|
|
24
|
+
focusables[0].focus();
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
38
27
|
useEffect(() => {
|
|
39
|
-
if (content) {
|
|
28
|
+
if (response?.content && !loading && announceResult) {
|
|
40
29
|
announcePolite({
|
|
41
30
|
message: t('result_available'),
|
|
42
31
|
type: 'acknowledgement'
|
|
43
32
|
});
|
|
33
|
+
setannounceResult(false);
|
|
44
34
|
}
|
|
45
|
-
}, [content]);
|
|
46
|
-
return (_jsxs(Flex, { ...restProps, as: StyledBuddyContainer, container: { direction: 'column', gap: 1 },
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
locale,
|
|
60
|
-
options: {
|
|
61
|
-
style: 'unit',
|
|
62
|
-
unit: 'percent',
|
|
63
|
-
maximumFractionDigits: 0
|
|
64
|
-
}
|
|
65
|
-
}) }) }))] }, reference.id));
|
|
66
|
-
})] })), feedback && (_jsx(ArticleFeedback, { comment: feedback.comment, reaction: feedback.reaction, onReaction: feedback.onReaction, onSubmit: feedback.onSubmit }))] })), error && !content && !loading && (_jsx(Flex, { container: { justify: 'center', pad: 1, gap: 1 }, children: _jsx(ErrorState, { message: t('error_message') }) })), disclaimer && (_jsxs(Flex, { container: { direction: 'column' }, children: [_jsx(StyledDisclaimerHeader, { children: t('disclaimer') }), _jsx(StyledDisclaimerText, { children: disclaimer })] }))] }));
|
|
35
|
+
}, [response?.content, loading, announceResult]);
|
|
36
|
+
return (_jsxs(Flex, { ...restProps, container: { direction: 'column' }, ref: buddyRef, "aria-busy": loading, as: StyledBuddyContainer, children: [_jsxs(Flex, { as: StyledQueryContainer, container: { direction: 'column', gap: 1 }, children: [buddyOptions && (_jsxs(Flex, { container: { gap: 0.5 }, children: [_jsx(MenuButton, { ...buddyOptions.list }), buddyOptions.buddyInfo?.title && (_jsx(AdditionalInfo, { heading: buddyOptions.buddyInfo.title, children: buddyOptions.buddyInfo.description }))] })), _jsx(TextArea, { ...query, autoResize: false, onKeyDown: (e) => {
|
|
37
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
if (query.value?.trim()) {
|
|
40
|
+
onSubmit();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} }), _jsxs(Flex, { container: { gap: 1, justify: 'end' }, children: [query.value && onClear && (_jsx(Button, { variant: 'link', onClick: () => {
|
|
44
|
+
onClear();
|
|
45
|
+
}, children: t('clear') })), _jsx(AIButton, { label: t('ask'), disabled: loading, "aria-label": t('ask_buddy'), onClick: () => {
|
|
46
|
+
setannounceResult(true);
|
|
47
|
+
onSubmit();
|
|
48
|
+
} })] })] }), _jsx(Progress, { visible: !!loading, placement: 'block', message: t('loading') }), !loading && response && _jsx(ArticleBuddyResponse, { ...response })] }));
|
|
67
49
|
};
|
|
68
50
|
export default ArticleBuddy;
|
|
69
51
|
//# sourceMappingURL=ArticleBuddy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleBuddy.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleBuddy.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,gBAAgB,EAChB,OAAO,EACP,IAAI,EACJ,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,yBAAyB,CAAC;AAGjC,OAAO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C,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,YACpD,KAAC,UAAU,IAAC,OAAO,EAAE,CAAC,CAAC,eAAe,CAAC,GAAI,GACtC,CACR,EAEA,UAAU,IAAI,CACb,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,aACtC,KAAC,sBAAsB,cAAE,CAAC,CAAC,YAAY,CAAC,GAA0B,EAClE,KAAC,oBAAoB,cAAE,UAAU,GAAwB,IACpD,CACR,IACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useEffect } from 'react';\nimport type { FunctionComponent, MouseEvent, KeyboardEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Text,\n Actions,\n Flex,\n defaultThemeProp,\n useI18n,\n Link,\n calculateFontSize,\n Progress,\n Button,\n useConfiguration,\n formatNumber,\n useLiveLog,\n TextArea,\n AIButton,\n ErrorState\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } from '@pega/cosmos-react-core';\n\nimport { isExternalLink, isInternalArticle } from './ArticleList.types';\nimport type { ArticleBuddyProps } from './ArticleList.types';\nimport ArticleFeedback from './ArticleFeedback';\n\nexport const StyledDisclaimerHeader = styled(Text)(\n ({\n theme: {\n base: { spacing, palette }\n }\n }) => {\n return css`\n font-weight: bold;\n border-block-start: 0.0625rem solid ${palette['border-line']};\n padding-block: ${spacing};\n `;\n }\n);\n\nStyledDisclaimerHeader.defaultProps = defaultThemeProp;\n\nexport const StyledDisclaimerText = styled(Text)(\n ({\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing }\n }\n }) => {\n const systemFontSize = calculateFontSize(fontSize, fontScale).xs;\n return css`\n font-style: italic;\n font-size: ${systemFontSize};\n margin-block-end: calc(2.5 * ${spacing});\n `;\n }\n);\n\nStyledDisclaimerText.defaultProps = defaultThemeProp;\n\nexport const StyledBuddyContainer = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n padding: calc(2 * ${spacing});\n overflow-y: auto;\n max-height: inherit;\n height: 100%;\n `;\n }\n);\n\nStyledBuddyContainer.defaultProps = defaultThemeProp;\n\nconst StyledBuddyArticleHeader = styled.header``;\n\nconst ArticleBuddy: FunctionComponent<ArticleBuddyProps & ForwardProps> = ({\n query,\n onClear,\n onSubmit,\n title,\n content,\n actions,\n references,\n disclaimer,\n loading = false,\n error = false,\n feedback,\n ...restProps\n}) => {\n const t = useI18n();\n const { locale } = useConfiguration();\n const { announcePolite } = useLiveLog();\n\n useEffect(() => {\n if (content) {\n announcePolite({\n message: t('result_available'),\n type: 'acknowledgement'\n });\n }\n }, [content]);\n\n return (\n <Flex\n {...restProps}\n as={StyledBuddyContainer}\n container={{ direction: 'column', gap: 1 }}\n aria-busy={loading ? true : undefined}\n >\n <TextArea\n {...query}\n autoResize={false}\n onKeyDown={(e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n if (query.value?.trim()) {\n onSubmit();\n }\n }\n }}\n />\n <Flex container={{ gap: 1, justify: 'end' }}>\n {query.value && onClear && (\n <Button\n variant='link'\n onClick={() => {\n onClear();\n }}\n >\n {t('clear')}\n </Button>\n )}\n <AIButton\n label={t('ask')}\n disabled={loading}\n onClick={() => {\n onSubmit();\n }}\n />\n </Flex>\n\n {loading && <Progress visible={!!loading} placement='block' message={t('loading')} />}\n {!loading && title && content && (\n <>\n <article>\n <Flex container={{ alignItems: 'start' }} item={{ grow: 1 }}>\n <Flex\n container={{ pad: [1, undefined] }}\n item={{ grow: 1 }}\n as={StyledBuddyArticleHeader}\n >\n <Text variant='h3'>{title}</Text>\n </Flex>\n\n {actions && <Actions items={actions} />}\n </Flex>\n <Flex container item={{ grow: 1 }}>\n {content}\n </Flex>\n </article>\n {references && (\n <Flex container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{t('references')}</Text>\n {references?.map(reference => {\n return (\n <Flex container key={reference.id}>\n <Flex container={{ alignItems: 'start', gap: 1 }} item={{ grow: 1 }}>\n {isExternalLink(reference) && (\n <Link href={reference.href} target='_blank' key={reference.id}>\n {reference.name}\n </Link>\n )}\n {isInternalArticle(reference) && (\n <Button\n variant='link'\n onClick={(e: MouseEvent<HTMLButtonElement>) =>\n reference.onClick(reference.id, e)\n }\n >\n {reference.name}\n </Button>\n )}\n </Flex>\n {reference.confidence && (\n <Flex container={{ alignItems: 'start' }} item={{ grow: 0 }}>\n <Text>\n {formatNumber(reference.confidence, {\n locale,\n options: {\n style: 'unit',\n unit: 'percent',\n maximumFractionDigits: 0\n }\n })}\n </Text>\n </Flex>\n )}\n </Flex>\n );\n })}\n </Flex>\n )}\n {feedback && (\n <ArticleFeedback\n comment={feedback.comment}\n reaction={feedback.reaction}\n onReaction={feedback.onReaction}\n onSubmit={feedback.onSubmit}\n />\n )}\n </>\n )}\n {error && !content && !loading && (\n <Flex container={{ justify: 'center', pad: 1, gap: 1 }}>\n <ErrorState message={t('error_message')} />\n </Flex>\n )}\n\n {disclaimer && (\n <Flex container={{ direction: 'column' }}>\n <StyledDisclaimerHeader>{t('disclaimer')}</StyledDisclaimerHeader>\n <StyledDisclaimerText>{disclaimer}</StyledDisclaimerText>\n </Flex>\n )}\n </Flex>\n );\n};\n\nexport default ArticleBuddy;\n"]}
|
|
1
|
+
{"version":3,"file":"ArticleBuddy.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleBuddy.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR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AC,MAAM,IACL,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;oCACZ,OAAO,EAAE,CAAC;gCACZ,CAAC,YAEA,CAAC,CAAC,OAAO,CAAC,GACJ,CACV,EACD,KAAC,QAAQ,IACP,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,EACf,QAAQ,EAAE,OAAO,gBACL,CAAC,CAAC,WAAW,CAAC,EAC1B,OAAO,EAAE,GAAG,EAAE;oCACZ,iBAAiB,CAAC,IAAI,CAAC,CAAC;oCACxB,QAAQ,EAAE,CAAC;gCACb,CAAC,GACD,IACG,IACF,EACP,KAAC,QAAQ,IAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,EAAC,OAAO,EAAC,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,GAAI,EACxE,CAAC,OAAO,IAAI,QAAQ,IAAI,KAAC,oBAAoB,OAAK,QAAQ,GAAI,IAC1D,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport type { FunctionComponent, KeyboardEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n defaultThemeProp,\n useI18n,\n Button,\n useLiveLog,\n TextArea,\n AIButton,\n Progress,\n getFocusables,\n MenuButton,\n AdditionalInfo\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } from '@pega/cosmos-react-core';\n\nimport type { ArticleBuddyProps } from './ArticleList.types';\nimport ArticleBuddyResponse from './ArticleBuddyResponse';\n\nexport const StyledQueryContainer = styled.div(\n ({\n theme: {\n base: { spacing, colors }\n }\n }) => {\n return css`\n padding: calc(2 * ${spacing});\n background-color: ${colors.gray['extra-light']};\n `;\n }\n);\n\nStyledQueryContainer.defaultProps = defaultThemeProp;\n\nconst StyledBuddyContainer = styled(Flex)`\n height: 100%;\n`;\n\nconst ArticleBuddy: FunctionComponent<ArticleBuddyProps & ForwardProps> = ({\n query,\n onClear,\n onSubmit,\n buddyOptions,\n response,\n list,\n loading,\n ...restProps\n}) => {\n const t = useI18n();\n const buddyRef = useRef<HTMLDivElement>(null);\n const { announcePolite } = useLiveLog();\n const [announceResult, setannounceResult] = useState(false);\n\n useEffect(() => {\n const focusables = getFocusables(buddyRef);\n if (focusables.length > 0) {\n focusables[0].focus();\n }\n }, []);\n\n useEffect(() => {\n if (response?.content && !loading && announceResult) {\n announcePolite({\n message: t('result_available'),\n type: 'acknowledgement'\n });\n setannounceResult(false);\n }\n }, [response?.content, loading, announceResult]);\n\n return (\n <Flex\n {...restProps}\n container={{ direction: 'column' }}\n ref={buddyRef}\n aria-busy={loading}\n as={StyledBuddyContainer}\n >\n <Flex as={StyledQueryContainer} container={{ direction: 'column', gap: 1 }}>\n {buddyOptions && (\n <Flex container={{ gap: 0.5 }}>\n <MenuButton {...buddyOptions.list} />\n {buddyOptions.buddyInfo?.title && (\n <AdditionalInfo heading={buddyOptions.buddyInfo.title}>\n {buddyOptions.buddyInfo.description}\n </AdditionalInfo>\n )}\n </Flex>\n )}\n\n <TextArea\n {...query}\n autoResize={false}\n onKeyDown={(e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n if (query.value?.trim()) {\n onSubmit();\n }\n }\n }}\n />\n\n <Flex container={{ gap: 1, justify: 'end' }}>\n {query.value && onClear && (\n <Button\n variant='link'\n onClick={() => {\n onClear();\n }}\n >\n {t('clear')}\n </Button>\n )}\n <AIButton\n label={t('ask')}\n disabled={loading}\n aria-label={t('ask_buddy')}\n onClick={() => {\n setannounceResult(true);\n onSubmit();\n }}\n />\n </Flex>\n </Flex>\n <Progress visible={!!loading} placement='block' message={t('loading')} />\n {!loading && response && <ArticleBuddyResponse {...response} />}\n </Flex>\n );\n};\n\nexport default ArticleBuddy;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { BuddySuggestedArticlesProps } from './ArticleList.types';
|
|
3
|
+
export declare const StyledListContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
4
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<BuddySuggestedArticlesProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=ArticleBuddyList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleBuddyList.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleBuddyList.tsx"],"names":[],"mappings":";AAcA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAGvE,eAAO,MAAM,mBAAmB,yGAQ9B,CAAC;;AAIH,wBAqDG"}
|