@pega/cosmos-react-work 4.0.0-dev.2.0 → 4.0.0-dev.20.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 +7 -21
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js +2 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
- 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 +9 -4
- package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
- package/lib/components/CasePreview/CasePreview.js +6 -9
- package/lib/components/CasePreview/CasePreview.js.map +1 -1
- 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/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -0
- package/lib/components/CaseView/CaseHeader/CaseHeader.js +119 -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.map +1 -1
- package/lib/components/CaseView/CaseSummary.js +9 -4
- package/lib/components/CaseView/CaseSummary.js.map +1 -1
- package/lib/components/CaseView/CaseSummaryFields.d.ts.map +1 -1
- package/lib/components/CaseView/CaseSummaryFields.js +14 -4
- package/lib/components/CaseView/CaseSummaryFields.js.map +1 -1
- package/lib/components/CaseView/CaseView.d.ts +4 -2
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +183 -68
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +45 -19
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +324 -66
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- 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 +17 -0
- package/lib/components/CaseView/CaseView.test-ids.js.map +1 -0
- package/lib/components/CaseView/CaseView.types.d.ts +27 -34
- 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 +0 -1
- package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.js +4 -8
- package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
- package/lib/components/CaseView/index.d.ts +0 -5
- package/lib/components/CaseView/index.d.ts.map +1 -1
- package/lib/components/CaseView/index.js +0 -4
- package/lib/components/CaseView/index.js.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts +1 -3
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.types.js.map +1 -1
- package/lib/components/Confirmation/Confirmation.d.ts +1 -1
- package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.js +2 -2
- package/lib/components/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +25 -16
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/Details.styles.d.ts +6 -4
- package/lib/components/Details/Details.styles.d.ts.map +1 -1
- package/lib/components/Details/Details.styles.js +38 -101
- package/lib/components/Details/Details.styles.js.map +1 -1
- package/lib/components/Glimpse/Glimpse.d.ts +10 -10
- package/lib/components/Glimpse/Glimpse.d.ts.map +1 -1
- package/lib/components/Glimpse/Glimpse.js +7 -17
- package/lib/components/Glimpse/Glimpse.js.map +1 -1
- package/lib/components/Glimpse/index.d.ts +1 -1
- package/lib/components/Glimpse/index.d.ts.map +1 -1
- package/lib/components/Glimpse/index.js +0 -1
- package/lib/components/Glimpse/index.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js +39 -43
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +3 -2
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +137 -81
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts +13 -9
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js.map +1 -1
- 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 +60 -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/SearchResults.types.d.ts +5 -5
- package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.types.js.map +1 -1
- package/lib/components/Stages/StageGlimpse.d.ts +0 -2
- package/lib/components/Stages/StageGlimpse.d.ts.map +1 -1
- package/lib/components/Stages/StageGlimpse.js +4 -4
- package/lib/components/Stages/StageGlimpse.js.map +1 -1
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +39 -58
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +0 -2
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +10 -18
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.js +2 -2
- package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.types.d.ts +5 -13
- package/lib/components/Stakeholders/Stakeholders.types.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.types.js.map +1 -1
- package/lib/components/Tags/Tags.d.ts +1 -1
- package/lib/components/Tags/Tags.d.ts.map +1 -1
- package/lib/components/Tags/Tags.js +5 -20
- package/lib/components/Tags/Tags.js.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts +18 -7
- package/lib/components/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +48 -10
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/lib/components/Tasks/Tasks.d.ts +21 -15
- package/lib/components/Tasks/Tasks.d.ts.map +1 -1
- package/lib/components/Tasks/Tasks.js +9 -9
- package/lib/components/Tasks/Tasks.js.map +1 -1
- 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 +3 -5
- package/lib/components/Tasks/index.d.ts.map +1 -1
- package/lib/components/Tasks/index.js +1 -0
- package/lib/components/Tasks/index.js.map +1 -1
- package/lib/components/Timeline/Timeline.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.js +14 -12
- package/lib/components/Timeline/Timeline.js.map +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts +4 -5
- package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.styles.js +34 -55
- package/lib/components/Timeline/Timeline.styles.js.map +1 -1
- package/lib/components/Timeline/Timeline.types.d.ts +8 -8
- 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 +19 -7
- package/lib/components/Timeline/TimelineItem.js.map +1 -1
- package/lib/components/Timeline/utils.d.ts +1 -0
- package/lib/components/Timeline/utils.d.ts.map +1 -1
- package/lib/components/Timeline/utils.js +12 -0
- package/lib/components/Timeline/utils.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/package.json +8 -6
- package/lib/components/CaseView/CaseHeader.d.ts.map +0 -1
- package/lib/components/CaseView/CaseHeader.js +0 -49
- package/lib/components/CaseView/CaseHeader.js.map +0 -1
- package/lib/components/CaseView/MobileCaseView.d.ts +0 -13
- package/lib/components/CaseView/MobileCaseView.d.ts.map +0 -1
- package/lib/components/CaseView/MobileCaseView.js +0 -25
- package/lib/components/CaseView/MobileCaseView.js.map +0 -1
- /package/lib/components/CaseView/{CaseHeader.d.ts → CaseHeader/CaseHeader.d.ts} +0 -0
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import { ReactElement, ReactNode, MouseEvent } from 'react';
|
|
2
|
-
import { Tab, NoChildrenProp, ForwardProps, MenuItemProps, Action, BaseProps } from '@pega/cosmos-react-core';
|
|
3
|
-
|
|
2
|
+
import { Tab, NoChildrenProp, FieldValueListItemProps, ForwardProps, MenuItemProps, Action, BaseProps, TestIdProp } from '@pega/cosmos-react-core';
|
|
3
|
+
import type { getCaseViewTestIds } from './CaseView.test-ids';
|
|
4
|
+
export type CaseSummaryFieldsProps = {
|
|
5
|
+
primary?: SummaryField[];
|
|
6
|
+
secondary?: SummaryField[];
|
|
7
|
+
inSummaryPanel?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type SummaryField = {
|
|
10
|
+
name: FieldValueListItemProps['name'];
|
|
11
|
+
value: FieldValueListItemProps['value'];
|
|
12
|
+
simpleValue?: string | number | ReactNode;
|
|
13
|
+
variant?: FieldValueListItemProps['variant'];
|
|
14
|
+
};
|
|
15
|
+
export interface CaseViewProps extends NoChildrenProp, BaseProps, TestIdProp {
|
|
4
16
|
/** A unique identifier for the case instance. */
|
|
5
17
|
caseId: string;
|
|
6
18
|
/** Text to quickly identify a case instance. */
|
|
7
19
|
heading: string;
|
|
8
20
|
/** Supplemental text to identify a case instance. */
|
|
9
21
|
subheading?: string;
|
|
10
|
-
/** A set of props including an href that will be forwarded to the case heading and caseId. */
|
|
11
|
-
caseLink?: {
|
|
12
|
-
href: string;
|
|
13
|
-
} & ForwardProps;
|
|
14
22
|
/** A set of Link props representing the case parents, rendered as Breadcrumbs. */
|
|
15
23
|
parentCases?: MenuItemProps[];
|
|
16
24
|
/** An icon to serve as a visual for the CaseView. */
|
|
17
25
|
icon?: ReactElement;
|
|
18
|
-
/** Indicates if the current user is following the case. This should be updated based on onFollowedChange.
|
|
26
|
+
/** Indicates if the current user is following the case. This should be updated based on onFollowedChange. */
|
|
19
27
|
followed?: boolean;
|
|
20
28
|
/** Called when user chooses to follow or unfollow the case. Use this to update followed. */
|
|
21
29
|
onFollowedChange?: (following: boolean) => void;
|
|
@@ -25,16 +33,14 @@ export interface CaseViewProps extends NoChildrenProp, BaseProps {
|
|
|
25
33
|
promotedActions?: Action[];
|
|
26
34
|
/** A callback for when the edit button is clicked */
|
|
27
35
|
onEdit?: () => void;
|
|
28
|
-
/**
|
|
29
|
-
|
|
36
|
+
/** Field data to render in summary areas. */
|
|
37
|
+
summaryFields: CaseSummaryFieldsProps;
|
|
30
38
|
/**
|
|
31
39
|
* Determines the layout state of the summary region.
|
|
32
40
|
* @default true
|
|
33
41
|
*/
|
|
34
42
|
summaryExpanded?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Callback to toggle the case summary's layout.
|
|
37
|
-
*/
|
|
43
|
+
/** Callback to toggle the case summary's layout. */
|
|
38
44
|
onToggleSummary?: () => void;
|
|
39
45
|
/** An object handling the rendering and functionality of the Tabs in CaseSummary. */
|
|
40
46
|
tabs: {
|
|
@@ -58,15 +64,14 @@ export interface CaseViewProps extends NoChildrenProp, BaseProps {
|
|
|
58
64
|
content: ReactNode;
|
|
59
65
|
title: string;
|
|
60
66
|
};
|
|
61
|
-
/**
|
|
62
|
-
* Provide an instance of IntelligentGuidance to be rendered for a case.
|
|
63
|
-
*/
|
|
67
|
+
/** Provide an instance of IntelligentGuidance to be rendered for a case. */
|
|
64
68
|
intelligentGuidance?: ReactNode;
|
|
65
69
|
/** A region for case widgets. */
|
|
66
70
|
utilities?: ReactNode;
|
|
67
71
|
/** An indicator of case widgets when the utilities are collapsed. */
|
|
68
72
|
utilitiesSummaryItems?: {
|
|
69
73
|
iconName: string;
|
|
74
|
+
name: string;
|
|
70
75
|
count?: number;
|
|
71
76
|
}[];
|
|
72
77
|
/**
|
|
@@ -74,30 +79,18 @@ export interface CaseViewProps extends NoChildrenProp, BaseProps {
|
|
|
74
79
|
* @default true
|
|
75
80
|
*/
|
|
76
81
|
utilitiesExpanded?: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Callback to toggle the utilities.
|
|
79
|
-
*/
|
|
82
|
+
/** Callback to toggle the utilities. */
|
|
80
83
|
onToggleUtilities?: () => void;
|
|
81
84
|
}
|
|
82
|
-
export interface
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
id?: string;
|
|
86
|
-
name: string;
|
|
87
|
-
value: ReactNode;
|
|
88
|
-
}[];
|
|
89
|
-
/** The secondary summary fields to display below primary fields. */
|
|
90
|
-
secondaryFields: {
|
|
91
|
-
id?: string;
|
|
92
|
-
name: string;
|
|
93
|
-
value: ReactNode;
|
|
94
|
-
}[];
|
|
95
|
-
}
|
|
96
|
-
export interface CaseViewContextValue extends Pick<CaseViewProps, 'caseId' | 'heading' | 'subheading' | 'caseLink' | 'parentCases' | 'icon' | 'followed' | 'onFollowedChange' | 'actions' | 'promotedActions' | 'onEdit' | 'summary' | 'tabs' | 'summaryExpanded' | 'onToggleSummary' | 'utilitiesExpanded' | 'persistentUtility' | 'intelligentGuidance'> {
|
|
97
|
-
summaryId: string;
|
|
85
|
+
export interface CaseViewContextValue extends Pick<CaseViewProps, 'caseId' | 'heading' | 'subheading' | 'parentCases' | 'icon' | 'followed' | 'onFollowedChange' | 'actions' | 'promotedActions' | 'onEdit' | 'tabs' | 'summaryExpanded' | 'summaryFields' | 'onToggleSummary' | 'utilitiesExpanded' | 'stages' | 'tasks' | 'persistentUtility' | 'intelligentGuidance'> {
|
|
86
|
+
testIds: Partial<ReturnType<typeof getCaseViewTestIds>>;
|
|
87
|
+
aboveSM: boolean;
|
|
98
88
|
aboveMD: boolean;
|
|
99
89
|
aboveLG: boolean;
|
|
100
90
|
aboveXL: boolean;
|
|
101
91
|
isPreview: boolean;
|
|
92
|
+
caseLink?: {
|
|
93
|
+
href: string;
|
|
94
|
+
} & ForwardProps;
|
|
102
95
|
}
|
|
103
96
|
//# sourceMappingURL=CaseView.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.types.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EACL,GAAG,EACH,cAAc,EACd,YAAY,EACZ,aAAa,EACb,MAAM,EACN,SAAS,
|
|
1
|
+
{"version":3,"file":"CaseView.types.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EACL,GAAG,EACH,cAAc,EACd,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,MAAM,EACN,SAAS,EACT,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACtC,KAAK,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC1C,OAAO,CAAC,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,WAAW,aAAc,SAAQ,cAAc,EAAE,SAAS,EAA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,CAAC;IAEpB,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAE1D,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAEhC,iCAAiC;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,qEAAqE;IACrE,qBAAqB,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAE7E;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAOhC;AAED,MAAM,WAAW,oBACf,SAAQ,IAAI,CACV,aAAa,EACX,QAAQ,GACR,SAAS,GACT,YAAY,GACZ,aAAa,GACb,MAAM,GACN,UAAU,GACV,kBAAkB,GAClB,SAAS,GACT,iBAAiB,GACjB,QAAQ,GACR,MAAM,GACN,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,mBAAmB,GACnB,QAAQ,GACR,OAAO,GACP,mBAAmB,GACnB,qBAAqB,CACxB;IACD,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;IACxD,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,CAAC;CAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.types.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactElement, ReactNode, MouseEvent } from 'react';\n\nimport {\n Tab,\n NoChildrenProp,\n ForwardProps,\n MenuItemProps,\n Action,\n BaseProps\n} from '@pega/cosmos-react-core';\n\nexport interface CaseViewProps extends NoChildrenProp, BaseProps {\n /** A unique identifier for the case instance. */\n caseId: string;\n /** Text to quickly identify a case instance. */\n heading: string;\n /** Supplemental text to identify a case instance. */\n subheading?: string;\n /**
|
|
1
|
+
{"version":3,"file":"CaseView.types.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactElement, ReactNode, MouseEvent } from 'react';\n\nimport {\n Tab,\n NoChildrenProp,\n FieldValueListItemProps,\n ForwardProps,\n MenuItemProps,\n Action,\n BaseProps,\n TestIdProp\n} from '@pega/cosmos-react-core';\n\nimport type { getCaseViewTestIds } from './CaseView.test-ids';\n\nexport type CaseSummaryFieldsProps = {\n primary?: SummaryField[];\n secondary?: SummaryField[];\n inSummaryPanel?: boolean;\n};\n\nexport type SummaryField = {\n name: FieldValueListItemProps['name'];\n value: FieldValueListItemProps['value'];\n simpleValue?: string | number | ReactNode;\n variant?: FieldValueListItemProps['variant'];\n};\n\nexport interface CaseViewProps extends NoChildrenProp, BaseProps, TestIdProp {\n /** A unique identifier for the case instance. */\n caseId: string;\n\n /** Text to quickly identify a case instance. */\n heading: string;\n\n /** Supplemental text to identify a case instance. */\n subheading?: string;\n\n /** @internal */\n caseLink?: CaseViewContextValue['caseLink'];\n\n /** A set of Link props representing the case parents, rendered as Breadcrumbs. */\n parentCases?: MenuItemProps[];\n\n /** An icon to serve as a visual for the CaseView. */\n icon?: ReactElement;\n\n /** Indicates if the current user is following the case. This should be updated based on onFollowedChange. */\n followed?: boolean;\n\n /** Called when user chooses to follow or unfollow the case. Use this to update followed. */\n onFollowedChange?: (following: boolean) => void;\n\n /** Case level actions available in an action menu. */\n actions?: Action[];\n\n /** Visually promoted case level actions available outside the menu. */\n promotedActions?: Action[];\n\n /** A callback for when the edit button is clicked */\n onEdit?: () => void;\n\n /** Field data to render in summary areas. */\n summaryFields: CaseSummaryFieldsProps;\n\n /**\n * Determines the layout state of the summary region.\n * @default true\n */\n summaryExpanded?: boolean;\n\n /** Callback to toggle the case summary's layout. */\n onToggleSummary?: () => void;\n\n /** An object handling the rendering and functionality of the Tabs in CaseSummary. */\n tabs: {\n items: Tab[];\n onClick: (id: string, event?: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;\n currentTabId: string;\n };\n\n /** A region within the center column that is controlled by tabs in CaseSummary. */\n tabContent?: { content: ReactNode; id: string }[];\n\n /** A region to hold a Stages component. */\n stages?: ReactNode;\n\n /** A region to hold a Tasks component. */\n tasks?: ReactNode;\n\n /** A region above the center column to display banners. */\n banners?: ReactNode;\n\n /** A region to the right reserved for persistent utilities. */\n persistentUtility?: { content: ReactNode; title: string };\n\n /** Provide an instance of IntelligentGuidance to be rendered for a case. */\n intelligentGuidance?: ReactNode;\n\n /** A region for case widgets. */\n utilities?: ReactNode;\n\n /** An indicator of case widgets when the utilities are collapsed. */\n utilitiesSummaryItems?: { iconName: string; name: string; count?: number }[];\n\n /**\n * Determines the layout state of the utilities.\n * @default true\n */\n utilitiesExpanded?: boolean;\n\n /** Callback to toggle the utilities. */\n onToggleUtilities?: () => void;\n\n /**\n * Indicates CaseView is rendered within a CasePreview.\n * @internal\n */\n isPreview?: boolean;\n}\n\nexport interface CaseViewContextValue\n extends Pick<\n CaseViewProps,\n | 'caseId'\n | 'heading'\n | 'subheading'\n | 'parentCases'\n | 'icon'\n | 'followed'\n | 'onFollowedChange'\n | 'actions'\n | 'promotedActions'\n | 'onEdit'\n | 'tabs'\n | 'summaryExpanded'\n | 'summaryFields'\n | 'onToggleSummary'\n | 'utilitiesExpanded'\n | 'stages'\n | 'tasks'\n | 'persistentUtility'\n | 'intelligentGuidance'\n > {\n testIds: Partial<ReturnType<typeof getCaseViewTestIds>>;\n aboveSM: boolean;\n aboveMD: boolean;\n aboveLG: boolean;\n aboveXL: boolean;\n isPreview: boolean;\n caseLink?: { href: string } & ForwardProps;\n}\n"]}
|
|
@@ -2,7 +2,6 @@ import { FunctionComponent } from 'react';
|
|
|
2
2
|
import { CaseViewProps } from './CaseView.types';
|
|
3
3
|
export interface UtilitiesSummaryProps {
|
|
4
4
|
items?: CaseViewProps['utilitiesSummaryItems'];
|
|
5
|
-
onClick?: () => void;
|
|
6
5
|
}
|
|
7
6
|
export declare const StyledUtilitiesSummary: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
8
7
|
declare const UtilitiesSummary: FunctionComponent<UtilitiesSummaryProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilitiesSummary.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/UtilitiesSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"UtilitiesSummary.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/UtilitiesSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;CAChD;AAED,eAAO,MAAM,sBAAsB,yGAKjC,CAAC;AAEH,QAAA,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,qBAAqB,CA8B9D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
-
import { Card, Count, Flex, Icon, useI18n } from '@pega/cosmos-react-core';
|
|
3
|
+
import { Card, Count, Flex, Icon, useI18n, VisuallyHiddenText } from '@pega/cosmos-react-core';
|
|
4
4
|
export const StyledUtilitiesSummary = styled.div(({ theme }) => {
|
|
5
5
|
return css `
|
|
6
6
|
width: 2.75rem;
|
|
7
7
|
padding: ${theme.base.spacing} 0;
|
|
8
|
-
cursor: pointer;
|
|
9
8
|
`;
|
|
10
9
|
});
|
|
11
|
-
const UtilitiesSummary = ({ items = []
|
|
10
|
+
const UtilitiesSummary = ({ items = [] }) => {
|
|
12
11
|
const t = useI18n();
|
|
13
|
-
return items.length ? (_jsx(Card, {
|
|
14
|
-
if (e.key === ' ' || e.key === 'Enter')
|
|
15
|
-
onClick?.();
|
|
16
|
-
}, children: items.map(item => {
|
|
12
|
+
return items.length ? (_jsx(Card, { container: { direction: 'column', alignItems: 'center', gap: 3 }, as: StyledUtilitiesSummary, "aria-label": t('utilities_summary'), role: 'list', children: items.map(item => {
|
|
17
13
|
return (_jsxs(Flex, { container: {
|
|
18
14
|
direction: 'column',
|
|
19
15
|
alignItems: 'center',
|
|
20
16
|
gap: 0.5
|
|
21
|
-
}, item: { grow: 1 }, children: [_jsx(Icon, { name: item.iconName }), item.count !== undefined && _jsx(Count, {
|
|
17
|
+
}, item: { grow: 1 }, children: [_jsx(Icon, { name: item.iconName }), item.count !== undefined && _jsx(Count, { "aria-hidden": true, children: item.count }), _jsx(VisuallyHiddenText, { role: 'listitem', children: `${item.count ?? ''} ${item.name}` })] }, item.iconName));
|
|
22
18
|
}) })) : null;
|
|
23
19
|
};
|
|
24
20
|
export default UtilitiesSummary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilitiesSummary.js","sourceRoot":"","sources":["../../../src/components/CaseView/UtilitiesSummary.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"UtilitiesSummary.js","sourceRo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CAAC,KAAK,IAAI,EAAE,IACtD,IAAI,CAAC,IACP,EAAE,GAAsB,KANnB,IAAI,CAAC,QAAQ,CAOb,CACR,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { FunctionComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Card, Count, Flex, Icon, useI18n, VisuallyHiddenText } from '@pega/cosmos-react-core';\n\nimport { CaseViewProps } from './CaseView.types';\n\nexport interface UtilitiesSummaryProps {\n items?: CaseViewProps['utilitiesSummaryItems'];\n}\n\nexport const StyledUtilitiesSummary = styled.div(({ theme }) => {\n return css`\n width: 2.75rem;\n padding: ${theme.base.spacing} 0;\n `;\n});\n\nconst UtilitiesSummary: FunctionComponent<UtilitiesSummaryProps> = ({ items = [] }) => {\n const t = useI18n();\n return items.length ? (\n <Card\n container={{ direction: 'column', alignItems: 'center', gap: 3 }}\n as={StyledUtilitiesSummary}\n aria-label={t('utilities_summary')}\n role='list'\n >\n {items.map(item => {\n return (\n <Flex\n container={{\n direction: 'column',\n alignItems: 'center',\n gap: 0.5\n }}\n item={{ grow: 1 }}\n key={item.iconName}\n >\n <Icon name={item.iconName} />\n {item.count !== undefined && <Count aria-hidden>{item.count}</Count>}\n <VisuallyHiddenText role='listitem'>{`${item.count ?? ''} ${\n item.name\n }`}</VisuallyHiddenText>\n </Flex>\n );\n })}\n </Card>\n ) : null;\n};\n\nexport default UtilitiesSummary;\n"]}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
export { default } from './CaseView';
|
|
2
2
|
export { CaseViewProps } from './CaseView.types';
|
|
3
3
|
export { StyledCaseView, StyledWorkArea as StyledCaseViewContent, StyledCaseDrawer, StyledCaseDrawerContent, StyledSummary as StyledSummaryRegion } from './CaseView.styles';
|
|
4
|
-
export { default as MobileCaseView } from './MobileCaseView';
|
|
5
|
-
export { MobileCaseViewProps } from './MobileCaseView';
|
|
6
|
-
export { default as CaseSummary } from './CaseSummary';
|
|
7
|
-
export { default as CaseSummaryFields } from './CaseSummaryFields';
|
|
8
|
-
export { default as CaseHeader } from './CaseHeader';
|
|
9
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,cAAc,EACd,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,IAAI,mBAAmB,EACrC,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,cAAc,EACd,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,IAAI,mBAAmB,EACrC,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
export { default } from './CaseView';
|
|
2
2
|
export { StyledCaseView, StyledWorkArea as StyledCaseViewContent, StyledCaseDrawer, StyledCaseDrawerContent, StyledSummary as StyledSummaryRegion } from './CaseView.styles';
|
|
3
|
-
export { default as MobileCaseView } from './MobileCaseView';
|
|
4
|
-
export { default as CaseSummary } from './CaseSummary';
|
|
5
|
-
export { default as CaseSummaryFields } from './CaseSummaryFields';
|
|
6
|
-
export { default as CaseHeader } from './CaseHeader';
|
|
7
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CaseView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EACL,cAAc,EACd,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,IAAI,mBAAmB,EACrC,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CaseView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EACL,cAAc,EACd,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,IAAI,mBAAmB,EACrC,MAAM,mBAAmB,CAAC","sourcesContent":["export { default } from './CaseView';\nexport { CaseViewProps } from './CaseView.types';\nexport {\n StyledCaseView,\n StyledWorkArea as StyledCaseViewContent,\n StyledCaseDrawer,\n StyledCaseDrawerContent,\n StyledSummary as StyledSummaryRegion\n} from './CaseView.styles';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurableLayout.types.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,WAAW,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"ConfigurableLayout.types.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,WAAW,CAAC;AAEhD,2DAA2D;AAC3D,MAAM,WAAW,MAAM;IACrB,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC;IACrB,yBAAyB;IACzB,YAAY,EAAE;QACZ,8BAA8B;QAC9B,KAAK,EAAE,MAAM,OAAO,kBAAkB,CAAC;QACvC;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB;;;WAGG;QACH,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC;KAC1D,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,mDAAmD;IACnD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6BAA6B;IAC7B,WAAW,CAAC,EAAE;QACZ;;;;;;WAMG;QACH,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;QACjC,4FAA4F;QAC5F,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurableLayout.types.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.types.ts"],"names":[],"mappings":"","sourcesContent":["import type widthConfigOptions from './options';\n\n
|
|
1
|
+
{"version":3,"file":"ConfigurableLayout.types.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.types.ts"],"names":[],"mappings":"","sourcesContent":["import type widthConfigOptions from './options';\n\n/** Type for config of a single ConfigurableLayout item. */\nexport interface Config {\n /** Unique identifier in render region */\n id: string;\n /** Element to render */\n content: JSX.Element;\n /** Config for element */\n layoutConfig: {\n /** Responsive width option */\n width: keyof typeof widthConfigOptions;\n /**\n * Fills remaining space if true, else does not grow beyond `width` value.\n * @default true\n */\n fillAvailable?: boolean;\n /** Flex basis (minimum fixed width) of element as:\n * - a numeric value to be applied in __pixels__\n * - a tuple of a numeric value and string unit\n */\n minWidth?: number | [number, 'px' | 'ch' | 'rem' | 'em'];\n };\n}\n\nexport interface ConfigurableLayoutProps {\n /** Array of configs for individual layout cells */\n items: Config[];\n /** Arrangement properties */\n arrangement?: {\n /** Defines the arrangement size of the given ConfigurableLayout.\n * Used to determine what width to apply to the given item when the arrangement is applied,\n * with the following mapping:\n * - 'narrow' --> applies 'full' width\n * - 'main' --> applies configured width\n * - 'half' --> applies double the configured width, or 'full' width (whichever is smaller)\n */\n size: 'narrow' | 'main' | 'half';\n /** Indicates when the ConfigurableLayout has wrapped to the full width of it's container */\n hasWrapped: boolean;\n };\n}\n"]}
|
|
@@ -5,7 +5,7 @@ export interface ConfirmationProps extends NoChildrenProp {
|
|
|
5
5
|
title?: string;
|
|
6
6
|
/** Region for a Field Value List component */
|
|
7
7
|
details?: ReactNode;
|
|
8
|
-
/** Array of React nodes to be put into a list
|
|
8
|
+
/** Array of React nodes to be put into a list */
|
|
9
9
|
whatsNext?: UnorderedListProps['items'];
|
|
10
10
|
/** Region for a Tasks component */
|
|
11
11
|
tasks?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confirmation.d.ts","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAGL,YAAY,EAOZ,kBAAkB,EAClB,cAAc,
|
|
1
|
+
{"version":3,"file":"Confirmation.d.ts","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAGL,YAAY,EAOZ,kBAAkB,EAClB,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAQjC,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,iDAAiD;IACjD,SAAS,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,mCAAmC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAsCrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { Card, CardContent, Flex, Text, useI18n, UnorderedList, Button, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Card, CardContent, Flex, Text, useI18n, UnorderedList, Button, defaultThemeProp, VisuallyHiddenText } from '@pega/cosmos-react-core';
|
|
5
5
|
const StyledWhatsNextList = styled(UnorderedList) `
|
|
6
6
|
padding-inline-start: 0;
|
|
7
7
|
`;
|
|
8
8
|
StyledWhatsNextList.defaultProps = defaultThemeProp;
|
|
9
9
|
const Confirmation = forwardRef(({ title, details, whatsNext, tasks, onClose, ...restProps }, ref) => {
|
|
10
10
|
const t = useI18n();
|
|
11
|
-
return (_jsx(Card, { ...restProps, ref: ref, children: _jsx(CardContent, { children: _jsxs(Flex, { container: { gap: 3, direction: 'column' }, children: [title && _jsx(Text, { variant: '
|
|
11
|
+
return (_jsx(Card, { ...restProps, ref: ref, children: _jsx(CardContent, { children: _jsxs(Flex, { container: { gap: 3, direction: 'column' }, children: [title && _jsx(Text, { variant: 'h3', children: title }), details && (_jsxs(Flex, { container: { gap: 1, direction: 'column' }, children: [_jsx(Text, { variant: 'h4', children: t('confirmation_details') }), details] })), whatsNext && (_jsxs(Flex, { container: { gap: 1, direction: 'column' }, children: [_jsx(Text, { variant: 'h4', children: t('confirmation_whats_next') }), _jsx(StyledWhatsNextList, { items: whatsNext, as: StyledWhatsNextList })] })), tasks, onClose && (_jsx(Flex, { container: { justify: 'end' }, children: _jsxs(Button, { onClick: onClose, variant: 'primary', children: [t('close'), title ? _jsx(VisuallyHiddenText, { children: `- ${title}` }) : null] }) }))] }) }) }));
|
|
12
12
|
});
|
|
13
13
|
export default Confirmation;
|
|
14
14
|
//# sourceMappingURL=Confirmation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confirmation.js","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,IAAI,EACJ,WAAW,EAEX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,MAAM,EACN,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Confirmation.js","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,IAAI,EACJ,WAAW,EAEX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,MAAM,EACN,gBAAgB,EAGhB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;CAEhD,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAiBpD,MAAM,YAAY,GAAwD,UAAU,CAClF,CACE,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,EAAsC,EAC/F,GAAG,EACH,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,OAAO,CACL,KAAC,IAAI,OAAK,SAAS,EAAE,GAAG,EAAE,GAAG,YAC3B,KAAC,WAAW,cACV,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC7C,KAAK,IAAI,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,GAAQ,EAC1C,OAAO,IAAI,CACV,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC9C,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,sBAAsB,CAAC,GAAQ,EACpD,OAAO,IACH,CACR,EACA,SAAS,IAAI,CACZ,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC9C,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,yBAAyB,CAAC,GAAQ,EACxD,KAAC,mBAAmB,IAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,mBAAmB,GAAI,IAC7D,CACR,EACA,KAAK,EACL,OAAO,IAAI,CACV,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,YACjC,MAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,SAAS,aACxC,CAAC,CAAC,OAAO,CAAC,EACV,KAAK,CAAC,CAAC,CAAC,KAAC,kBAAkB,cAAE,KAAK,KAAK,EAAE,GAAsB,CAAC,CAAC,CAAC,IAAI,IAChE,GACJ,CACR,IACI,GACK,GACT,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, ReactNode, Ref } from 'react';\nimport styled from 'styled-components';\n\nimport {\n Card,\n CardContent,\n ForwardProps,\n Flex,\n Text,\n useI18n,\n UnorderedList,\n Button,\n defaultThemeProp,\n UnorderedListProps,\n NoChildrenProp,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\n\nconst StyledWhatsNextList = styled(UnorderedList)`\n padding-inline-start: 0;\n`;\n\nStyledWhatsNextList.defaultProps = defaultThemeProp;\n\nexport interface ConfirmationProps extends NoChildrenProp {\n /** The title of the confirmation */\n title?: string;\n /** Region for a Field Value List component */\n details?: ReactNode;\n /** Array of React nodes to be put into a list */\n whatsNext?: UnorderedListProps['items'];\n /** Region for a Tasks component */\n tasks?: ReactNode;\n /** Called when the done/close button is clicked */\n onClose?: () => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\nconst Confirmation: FunctionComponent<ConfirmationProps & ForwardProps> = forwardRef(\n (\n { title, details, whatsNext, tasks, onClose, ...restProps }: PropsWithoutRef<ConfirmationProps>,\n ref\n ) => {\n const t = useI18n();\n\n return (\n <Card {...restProps} ref={ref}>\n <CardContent>\n <Flex container={{ gap: 3, direction: 'column' }}>\n {title && <Text variant='h3'>{title}</Text>}\n {details && (\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h4'>{t('confirmation_details')}</Text>\n {details}\n </Flex>\n )}\n {whatsNext && (\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h4'>{t('confirmation_whats_next')}</Text>\n <StyledWhatsNextList items={whatsNext} as={StyledWhatsNextList} />\n </Flex>\n )}\n {tasks}\n {onClose && (\n <Flex container={{ justify: 'end' }}>\n <Button onClick={onClose} variant='primary'>\n {t('close')}\n {title ? <VisuallyHiddenText>{`- ${title}`}</VisuallyHiddenText> : null}\n </Button>\n </Flex>\n )}\n </Flex>\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default Confirmation;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EAEF,SAAS,EACT,GAAG,EAKJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAKL,YAAY,
|
|
1
|
+
{"version":3,"file":"Details.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EAEF,SAAS,EACT,GAAG,EAKJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAKL,YAAY,EAQb,MAAM,yBAAyB,CAAC;AAWjC,MAAM,WAAW,YAAY;IAC3B,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,GAAG,YAAY,CAgL5C,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, Fragment, useState, useContext, useEffect, useMemo } from 'react';
|
|
3
3
|
import { remToPx } from 'polished';
|
|
4
|
-
import { Text, useBreakpoint, useConsolidatedRef, useTheme, ExpandCollapse, Button, Flex, Icon, useI18n } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Text, useBreakpoint, useConsolidatedRef, useTheme, ExpandCollapse, Button, Flex, Icon, useChToPxConversionFactor, useI18n } from '@pega/cosmos-react-core';
|
|
5
5
|
import DetailsContext from './DetailsContext';
|
|
6
|
-
import { StyledFieldValueGroupLabel, StyledDetails, StyledDetailList, StyledHighlightedDetailList, flexGapProp
|
|
6
|
+
import { StyledFieldValueGroupLabel, StyledDetails, StyledDetailList, StyledHighlightedDetailList, flexGapProp } from './Details.styles';
|
|
7
7
|
const Details = forwardRef(({ highlightedData, children, name, columnCount = 1, nested = false, asFlex = false, valueComparison = false, collapsible = false }, ref) => {
|
|
8
|
-
const { longestLabelLength, mobileView, depth, ...context } = useContext(DetailsContext);
|
|
9
|
-
const { base: { 'content-width': { sm } } } = useTheme();
|
|
8
|
+
const { longestLabelLength, mobileView: inMobileView, depth, ...context } = useContext(DetailsContext);
|
|
9
|
+
const { base: { 'content-width': { sm: smContentWidth } } } = useTheme();
|
|
10
10
|
const isSmallOrAbove = useBreakpoint('sm');
|
|
11
11
|
const listRef = useConsolidatedRef(ref);
|
|
12
|
-
const
|
|
12
|
+
const isXsContentWidthOrAbove = useBreakpoint('xs', {
|
|
13
|
+
breakpointRef: listRef,
|
|
14
|
+
themeProp: 'content-width'
|
|
15
|
+
});
|
|
16
|
+
const isMdContentWidthOrAbove = useBreakpoint('md', {
|
|
17
|
+
breakpointRef: listRef,
|
|
18
|
+
themeProp: 'content-width'
|
|
19
|
+
});
|
|
20
|
+
const flexRow = useBreakpoint(columnCount > 2 ? 'lg' : 'md', {
|
|
13
21
|
breakpointRef: listRef,
|
|
14
22
|
themeProp: 'content-width'
|
|
15
23
|
});
|
|
@@ -18,16 +26,15 @@ const Details = forwardRef(({ highlightedData, children, name, columnCount = 1,
|
|
|
18
26
|
const [open, setOpen] = useState(true);
|
|
19
27
|
const labelLength = Math.max(14, Math.min(longestLabelLength ?? 16, 40));
|
|
20
28
|
const headingDepth = depth ?? 1;
|
|
21
|
-
const applyMobileView =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
const applyMobileView = inMobileView ||
|
|
30
|
+
!isSmallOrAbove ||
|
|
31
|
+
!isXsContentWidthOrAbove ||
|
|
32
|
+
(asFlex && flexRow && flexContextMobileView);
|
|
33
|
+
const chToPxConversionFactor = useChToPxConversionFactor();
|
|
34
|
+
// Mount resize observer to update flex context mobile view & run initial check.
|
|
27
35
|
useEffect(() => {
|
|
28
36
|
const checkBreakpoint = (elementWidth) => {
|
|
29
|
-
const
|
|
30
|
-
const minWidthPx = parseInt(remToPx(minWidthRem), 10);
|
|
37
|
+
const minWidthPx = parseInt(smContentWidth, 10) * chToPxConversionFactor;
|
|
31
38
|
const oneRemInPx = parseInt(remToPx(1), 10);
|
|
32
39
|
const colGapPxAllowance = oneRemInPx * (0.5 * flexGapProp) * (columnCount - 1);
|
|
33
40
|
const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;
|
|
@@ -54,12 +61,12 @@ const Details = forwardRef(({ highlightedData, children, name, columnCount = 1,
|
|
|
54
61
|
};
|
|
55
62
|
}, [applyMobileView, name, headingDepth, longestLabelLength, context]);
|
|
56
63
|
const nameText = useMemo(() => {
|
|
57
|
-
return
|
|
64
|
+
return _jsx(Text, { variant: `h${Math.min(headingDepth, 6)}`, children: name });
|
|
58
65
|
}, [name, headingDepth]);
|
|
59
66
|
const details = useMemo(() => {
|
|
60
|
-
return (_jsxs(_Fragment, { children: [highlightedData && (_jsxs(_Fragment, { children: [_jsx(
|
|
67
|
+
return (_jsxs(_Fragment, { children: [highlightedData && (_jsxs(_Fragment, { children: [_jsx(Flex, { as: StyledHighlightedDetailList, forwardedAs: nested ? 'div' : 'dl', container: { wrap: 'wrap', colGap: 10, rowGap: 1, alignItems: 'start' }, children: highlightedData.map((child, i) => (
|
|
61
68
|
// eslint-disable-next-line react/no-array-index-key
|
|
62
|
-
_jsx(Fragment, { children: child }, i))) }), _jsx("hr", {})] })), _jsx(StyledDetailList, { ref: listRef, as: nested ? 'div' : 'dl', columnCount: columnCount, labelLength: labelLength, stacked: applyMobileView,
|
|
69
|
+
_jsx(Fragment, { children: child }, i))) }), _jsx("hr", {})] })), children ? (_jsx(StyledDetailList, { ref: listRef, as: nested ? 'div' : 'dl', columnCount: columnCount, labelLength: labelLength, stacked: applyMobileView, nested: nested, flex: asFlex, wrapped: asFlex ? !flexRow : false, variant: valueComparison ? 'value-comparison' : undefined, narrow: !isMdContentWidthOrAbove, children: children })) : null] }));
|
|
63
70
|
}, [
|
|
64
71
|
highlightedData,
|
|
65
72
|
nested,
|
|
@@ -72,6 +79,8 @@ const Details = forwardRef(({ highlightedData, children, name, columnCount = 1,
|
|
|
72
79
|
valueComparison,
|
|
73
80
|
children
|
|
74
81
|
]);
|
|
82
|
+
if (!name && !children && !highlightedData)
|
|
83
|
+
return null;
|
|
75
84
|
return (_jsx(DetailsContext.Provider, { value: contextValue, children: _jsxs(StyledDetails, { children: [name && (_jsx(StyledFieldValueGroupLabel, { children: collapsible ? (_jsx(Button, { type: 'button', variant: 'text', onClick: () => {
|
|
76
85
|
setOpen(cur => !cur);
|
|
77
86
|
}, "aria-expanded": open ? 'true' : 'false', "aria-label": t(open ? 'collapse_noun' : 'expand_noun', [name]), children: _jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: 'span', children: [_jsx(Icon, { name: 'caret-right' }), nameText] }) })) : (nameText) })), collapsible ? _jsx(ExpandCollapse, { collapsed: !open, children: details }) : details] }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.js","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,QAAQ,EAGR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,QAAQ,EAER,cAAc,EACd,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,EACR,MAAM,yBAAyB,CAAC;AAEjC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,0BAA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cesContent":["import {\n forwardRef,\n FC,\n Fragment,\n ReactNode,\n Ref,\n useState,\n useContext,\n useEffect,\n useMemo\n} from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useTheme,\n ForwardProps,\n ExpandCollapse,\n Button,\n Flex,\n Icon,\n useI18n\n} from '@pega/cosmos-react-core';\n\nimport DetailsContext from './DetailsContext';\nimport {\n StyledFieldValueGroupLabel,\n StyledDetails,\n StyledDetailList,\n StyledHighlightedDetailList,\n flexGapProp,\n chToRem\n} from './Details.styles';\n\nexport interface DetailsProps {\n highlightedData?: ReactNode[];\n children?: ReactNode;\n /** Text used as heading of list */\n name?: string;\n /**\n * Whether the items children can be collapsed (only applies if name is provided)\n * @default false\n */\n collapsible?: boolean;\n /**\n * Number of columns in detail layout\n * @default 1\n */\n columnCount?: 1 | 2 | 3;\n /** Whether detail list is rendering within another detail list\n * @default false\n */\n nested?: boolean;\n /** Whether detail list is rendering multiple sub-lists in columns (passed as children)\n * @default false\n */\n asFlex?: boolean;\n /** Whether to apply `value-comparison` styles to list items\n * @default false\n */\n valueComparison?: boolean;\n ref?: Ref<HTMLDListElement>;\n}\n\nconst Details: FC<DetailsProps & ForwardProps> = forwardRef(\n (\n {\n highlightedData,\n children,\n name,\n columnCount = 1,\n nested = false,\n asFlex = false,\n valueComparison = false,\n collapsible = false\n },\n ref\n ) => {\n const { longestLabelLength, mobileView, depth, ...context } = useContext(DetailsContext);\n const {\n base: {\n 'content-width': { sm }\n }\n } = useTheme();\n const isSmallOrAbove = useBreakpoint('sm');\n const listRef = useConsolidatedRef<HTMLDListElement>(ref);\n const flexRow = useBreakpoint(columnCount > 2 ? 'md' : 'sm', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const t = useI18n();\n\n const [flexContextMobileView, setFlexContextMobileView] = useState(false);\n const [open, setOpen] = useState(true);\n\n const labelLength = Math.max(14, Math.min(longestLabelLength ?? 16, 40));\n const headingDepth = depth ?? 1;\n const applyMobileView = asFlex\n ? mobileView || (flexRow && flexContextMobileView) || !isSmallOrAbove\n : mobileView || !isSmallOrAbove;\n\n /**\n * Mount resize observer to update flex context mobile view & run initial check.\n */\n useEffect(() => {\n const checkBreakpoint = (elementWidth: number) => {\n const minWidthRem = chToRem(parseInt(sm, 10));\n const minWidthPx = parseInt(remToPx(minWidthRem), 10);\n const oneRemInPx = parseInt(remToPx(1), 10);\n const colGapPxAllowance = oneRemInPx * (0.5 * flexGapProp) * (columnCount - 1);\n const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;\n\n setFlexContextMobileView(elementWidth < mobileViewBreakpoint);\n };\n const resizeObserver = new ResizeObserver(entries => {\n const containerPxWidth = entries[0].contentRect.width;\n checkBreakpoint(containerPxWidth);\n });\n\n if (listRef.current) {\n checkBreakpoint(listRef.current.offsetWidth);\n resizeObserver.observe(listRef.current);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [listRef, columnCount]);\n\n const contextValue = useMemo(() => {\n return {\n mobileView: applyMobileView,\n depth: name ? headingDepth + 1 : headingDepth,\n longestLabelLength,\n ...context\n };\n }, [applyMobileView, name, headingDepth, longestLabelLength, context]);\n\n const nameText = useMemo(() => {\n return (\n <Text variant={`h${Math.min(headingDepth, 6)}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'}>\n {name}\n </Text>\n );\n }, [name, headingDepth]);\n\n const details = useMemo(() => {\n return (\n <>\n {highlightedData && (\n <>\n <StyledHighlightedDetailList as={nested ? 'div' : 'dl'}>\n {highlightedData.map((child, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{child}</Fragment>\n ))}\n </StyledHighlightedDetailList>\n\n <hr />\n </>\n )}\n\n <StyledDetailList\n ref={listRef}\n as={nested ? 'div' : 'dl'}\n columnCount={columnCount}\n labelLength={labelLength}\n stacked={applyMobileView}\n hasName={!!name}\n nested={nested}\n flex={asFlex}\n wrapped={asFlex ? !flexRow : false}\n variant={valueComparison ? 'value-comparison' : undefined}\n >\n {children}\n </StyledDetailList>\n </>\n );\n }, [\n highlightedData,\n nested,\n columnCount,\n labelLength,\n applyMobileView,\n name,\n asFlex,\n flexRow,\n valueComparison,\n children\n ]);\n\n return (\n <DetailsContext.Provider value={contextValue}>\n <StyledDetails>\n {name && (\n <StyledFieldValueGroupLabel>\n {collapsible ? (\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Icon name='caret-right' />\n {nameText}\n </Flex>\n </Button>\n ) : (\n nameText\n )}\n </StyledFieldValueGroupLabel>\n )}\n\n {collapsible ? <ExpandCollapse collapsed={!open}>{details}</ExpandCollapse> : details}\n </StyledDetails>\n </DetailsContext.Provider>\n );\n }\n);\n\nexport default Details;\n"]}
|
|
1
|
+
{"version":3,"file":"Details.js","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,QAAQ,EAGR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,QAAQ,EAER,cAAc,EACd,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,yBAAyB,EACzB,OAAO,EAER,MAAM,yBAAyB,CAAC;AAEjC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAC3B,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAgC1B,MAAM,OAAO,GAAoC,UAAU,CACzD,CACE,EACE,eAAe,EACf,QAAQ,EACR,IAAI,EACJ,WAAW,GAAG,CAAC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1B,QAAQ,IACJ,GACA,CACV,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GAC0B,CAC9B,EAEA,WAAW,CAAC,CAAC,CAAC,KAAC,cAAc,IAAC,SAAS,EAAE,CAAC,IAAI,YAAG,OAAO,GAAkB,CAAC,CAAC,CAAC,OAAO,IACvE,GACQ,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import {\n forwardRef,\n FC,\n Fragment,\n ReactNode,\n Ref,\n useState,\n useContext,\n useEffect,\n useMemo\n} from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useTheme,\n ForwardProps,\n ExpandCollapse,\n Button,\n Flex,\n Icon,\n useChToPxConversionFactor,\n useI18n,\n HeadingTag\n} from '@pega/cosmos-react-core';\n\nimport DetailsContext from './DetailsContext';\nimport {\n StyledFieldValueGroupLabel,\n StyledDetails,\n StyledDetailList,\n StyledHighlightedDetailList,\n flexGapProp\n} from './Details.styles';\n\nexport interface DetailsProps {\n highlightedData?: ReactNode[];\n children?: ReactNode;\n /** Text used as heading of list */\n name?: string;\n /**\n * Whether the items children can be collapsed (only applies if name is provided)\n * @default false\n */\n collapsible?: boolean;\n /**\n * Number of columns in detail layout\n * @default 1\n */\n columnCount?: 1 | 2 | 3;\n /** Whether detail list is rendering within another detail list\n * @default false\n */\n nested?: boolean;\n /** Whether detail list is rendering multiple sub-lists in columns (passed as children)\n * @default false\n */\n asFlex?: boolean;\n /** Whether to apply `value-comparison` styles to list items\n * @default false\n */\n valueComparison?: boolean;\n ref?: Ref<HTMLDListElement>;\n}\n\nconst Details: FC<DetailsProps & ForwardProps> = forwardRef(\n (\n {\n highlightedData,\n children,\n name,\n columnCount = 1,\n nested = false,\n asFlex = false,\n valueComparison = false,\n collapsible = false\n },\n ref\n ) => {\n const {\n longestLabelLength,\n mobileView: inMobileView,\n depth,\n ...context\n } = useContext(DetailsContext);\n const {\n base: {\n 'content-width': { sm: smContentWidth }\n }\n } = useTheme();\n const isSmallOrAbove = useBreakpoint('sm');\n const listRef = useConsolidatedRef<HTMLDListElement>(ref);\n const isXsContentWidthOrAbove = useBreakpoint('xs', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const isMdContentWidthOrAbove = useBreakpoint('md', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const flexRow = useBreakpoint(columnCount > 2 ? 'lg' : 'md', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const t = useI18n();\n\n const [flexContextMobileView, setFlexContextMobileView] = useState(false);\n const [open, setOpen] = useState(true);\n\n const labelLength = Math.max(14, Math.min(longestLabelLength ?? 16, 40));\n const headingDepth = depth ?? 1;\n const applyMobileView =\n inMobileView ||\n !isSmallOrAbove ||\n !isXsContentWidthOrAbove ||\n (asFlex && flexRow && flexContextMobileView);\n\n const chToPxConversionFactor = useChToPxConversionFactor();\n\n // Mount resize observer to update flex context mobile view & run initial check.\n useEffect(() => {\n const checkBreakpoint = (elementWidth: number) => {\n const minWidthPx = parseInt(smContentWidth, 10) * chToPxConversionFactor;\n const oneRemInPx = parseInt(remToPx(1), 10);\n const colGapPxAllowance = oneRemInPx * (0.5 * flexGapProp) * (columnCount - 1);\n const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;\n\n setFlexContextMobileView(elementWidth < mobileViewBreakpoint);\n };\n const resizeObserver = new ResizeObserver(entries => {\n const containerPxWidth = entries[0].contentRect.width;\n checkBreakpoint(containerPxWidth);\n });\n\n if (listRef.current) {\n checkBreakpoint(listRef.current.offsetWidth);\n resizeObserver.observe(listRef.current);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [listRef, columnCount]);\n\n const contextValue = useMemo(() => {\n return {\n mobileView: applyMobileView,\n depth: name ? headingDepth + 1 : headingDepth,\n longestLabelLength,\n ...context\n };\n }, [applyMobileView, name, headingDepth, longestLabelLength, context]);\n\n const nameText = useMemo(() => {\n return <Text variant={`h${Math.min(headingDepth, 6)}` as HeadingTag}>{name}</Text>;\n }, [name, headingDepth]);\n\n const details = useMemo(() => {\n return (\n <>\n {highlightedData && (\n <>\n <Flex\n as={StyledHighlightedDetailList}\n forwardedAs={nested ? 'div' : 'dl'}\n container={{ wrap: 'wrap', colGap: 10, rowGap: 1, alignItems: 'start' }}\n >\n {highlightedData.map((child, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{child}</Fragment>\n ))}\n </Flex>\n\n <hr />\n </>\n )}\n\n {children ? (\n <StyledDetailList\n ref={listRef}\n as={nested ? 'div' : 'dl'}\n columnCount={columnCount}\n labelLength={labelLength}\n stacked={applyMobileView}\n nested={nested}\n flex={asFlex}\n wrapped={asFlex ? !flexRow : false}\n variant={valueComparison ? 'value-comparison' : undefined}\n narrow={!isMdContentWidthOrAbove}\n >\n {children}\n </StyledDetailList>\n ) : null}\n </>\n );\n }, [\n highlightedData,\n nested,\n columnCount,\n labelLength,\n applyMobileView,\n name,\n asFlex,\n flexRow,\n valueComparison,\n children\n ]);\n\n if (!name && !children && !highlightedData) return null;\n\n return (\n <DetailsContext.Provider value={contextValue}>\n <StyledDetails>\n {name && (\n <StyledFieldValueGroupLabel>\n {collapsible ? (\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Icon name='caret-right' />\n {nameText}\n </Flex>\n </Button>\n ) : (\n nameText\n )}\n </StyledFieldValueGroupLabel>\n )}\n\n {collapsible ? <ExpandCollapse collapsed={!open}>{details}</ExpandCollapse> : details}\n </StyledDetails>\n </DetailsContext.Provider>\n );\n }\n);\n\nexport default Details;\n"]}
|
|
@@ -5,8 +5,6 @@ interface StyledDetailListProps extends StyledFieldValueListProps {
|
|
|
5
5
|
stacked?: boolean;
|
|
6
6
|
/** Whether the list is a flex row of other lists */
|
|
7
7
|
flex?: boolean;
|
|
8
|
-
/** Whether the list has a name attribute */
|
|
9
|
-
hasName?: boolean;
|
|
10
8
|
/** Whether the list is nested */
|
|
11
9
|
nested?: boolean;
|
|
12
10
|
/** The character length applied to all list labels */
|
|
@@ -21,6 +19,11 @@ interface StyledDetailListProps extends StyledFieldValueListProps {
|
|
|
21
19
|
* @default 1
|
|
22
20
|
*/
|
|
23
21
|
columnCount?: 1 | 2 | 3;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to apply narrow list styles
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
narrow?: boolean;
|
|
24
27
|
theme: DefaultTheme;
|
|
25
28
|
}
|
|
26
29
|
export declare const colCountChWidth: {
|
|
@@ -38,10 +41,9 @@ export declare const colCountChWidth: {
|
|
|
38
41
|
};
|
|
39
42
|
};
|
|
40
43
|
export declare const flexGapProp = 5.5;
|
|
41
|
-
export declare const chToRem: (chVal: number) => number;
|
|
42
44
|
export declare const StyledFieldValueGroupLabel: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
43
45
|
export declare const StyledHighlightedDetailList: import("styled-components").StyledComponent<"dl", DefaultTheme, {}, never>;
|
|
44
46
|
export declare const StyledDetails: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
45
|
-
export declare const StyledDetailList: import("styled-components").StyledComponent<"dl", DefaultTheme, StyledFieldValueListProps &
|
|
47
|
+
export declare const StyledDetailList: import("styled-components").StyledComponent<"dl", DefaultTheme, StyledFieldValueListProps & Pick<StyledDetailListProps, "flex" | "theme" | "variant" | "narrow" | "stacked" | "nested" | "labelLength"> & Required<Pick<StyledDetailListProps, "columnCount" | "wrapped">>, never>;
|
|
46
48
|
export {};
|
|
47
49
|
//# sourceMappingURL=Details.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.styles.ts"],"names":[],"mappings":"AAAA,OAAe,EAAO,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAML,yBAAyB,EAM1B,MAAM,yBAAyB,CAAC;AAEjC,UAAU,qBAAsB,SAAQ,yBAAyB;IAC/D,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"Details.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.styles.ts"],"names":[],"mappings":"AAAA,OAAe,EAAO,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAML,yBAAyB,EAM1B,MAAM,yBAAyB,CAAC;AAEjC,UAAU,qBAAsB,SAAQ,yBAAyB;IAC/D,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;CACrB;AAUD,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAa3B,CAAC;AAEF,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,eAAO,MAAM,0BAA0B,6EAyBrC,CAAC;AAIH,eAAO,MAAM,2BAA2B,4EAuBtC,CAAC;AAIH,eAAO,MAAM,aAAa,6EAAe,CAAC;AAE1C,eAAO,MAAM,gBAAgB,oRA+H5B,CAAC"}
|