@pega/custom-dx-components 26.1.10-alpha-0.4 → 26.1.10-alpha-0.6
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/package.json +1 -1
- package/src/tasks/create/templates/Constellation/Presentation/CASEVIEW/index.tsx.mustache +10 -2
- package/src/tasks/init/template/package.json.mustache +4 -4
- package/tests/assets/library/components/create/shared/PConnProps.d.ts +17 -18
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/config.json +15 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/demo.stories.tsx +37 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/demo.test.tsx +19 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/index.tsx +101 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/localizations.json +15 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/mock.ts +33 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/styles.ts +27 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/config.json +15 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/demo.stories.tsx +36 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/demo.test.tsx +18 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/index.tsx +64 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/localizations.json +9 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/mock.ts +27 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/styles.ts +27 -0
- package/tests/assets/library/components/createAll/Constellation/shared/PConnProps.d.ts +17 -18
- package/tests/assets/original/components/create/Pega_DXIL_MyTestText/PConnProps.d.ts +17 -18
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseview/config.json +15 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseview/demo.stories.tsx +37 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseview/demo.test.tsx +19 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseview/index.tsx +101 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseview/localizations.json +15 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseview/mock.ts +33 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseview/styles.ts +27 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/suggestions-handler.ts +0 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyEmail/PConnProps.d.ts +17 -18
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/PConnProps.d.ts +17 -18
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/PConnProps.d.ts +17 -18
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyText/PConnProps.d.ts +17 -18
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/config.json +15 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/demo.stories.tsx +36 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/demo.test.tsx +18 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/index.tsx +64 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/localizations.json +9 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/mock.ts +27 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/styles.ts +27 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseview/config.json +15 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseview/demo.stories.tsx +37 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseview/demo.test.tsx +19 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseview/index.tsx +101 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseview/localizations.json +15 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseview/mock.ts +33 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseview/styles.ts +27 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/suggestions-handler.ts +0 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyEmail/PConnProps.d.ts +17 -18
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/PConnProps.d.ts +17 -18
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/PConnProps.d.ts +17 -18
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyText/PConnProps.d.ts +17 -18
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyWsscaseview/config.json +15 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyWsscaseview/demo.stories.tsx +36 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyWsscaseview/demo.test.tsx +18 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyWsscaseview/index.tsx +64 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyWsscaseview/localizations.json +9 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyWsscaseview/mock.ts +27 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyWsscaseview/styles.ts +27 -0
- package/tests/assets/original/components/create/shared/PConnProps.d.ts +0 -46
- package/tests/assets/original/components/create/shared/create-nonce.ts +0 -5
- package/tests/assets/original/components/create/shared/suggestions-handler.ts +0 -9
- package/tests/assets/original/components/createAll/Constellation/shared/PConnProps.d.ts +0 -46
- package/tests/assets/original/components/createAll/Constellation/shared/create-nonce.ts +0 -5
- package/tests/assets/original/components/createAll/Constellation/shared/suggestions-handler.ts +0 -9
- package/tests/assets/original/components/createAll/Launchpad/shared/PConnProps.d.ts +0 -46
- package/tests/assets/original/components/createAll/Launchpad/shared/create-nonce.ts +0 -5
- package/tests/assets/original/components/createAll/Launchpad/shared/suggestions-handler.ts +0 -9
package/package.json
CHANGED
|
@@ -30,8 +30,16 @@ function {{COMPONENT_CLASS_NAME}}(props: CaseViewProps) {
|
|
|
30
30
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
31
31
|
<header>
|
|
32
32
|
<span>{caseType}</span>
|
|
33
|
-
<h1>{heading}</h1>
|
|
34
|
-
{subheading &&
|
|
33
|
+
<h1>{typeof heading === 'string' ? heading : heading?.text}</h1>
|
|
34
|
+
{subheading && (
|
|
35
|
+
<p>
|
|
36
|
+
{(() => {
|
|
37
|
+
if (typeof subheading === 'string') return subheading;
|
|
38
|
+
if (Array.isArray(subheading)) return subheading.join(' ');
|
|
39
|
+
return subheading?.text;
|
|
40
|
+
})()}
|
|
41
|
+
</p>
|
|
42
|
+
)}
|
|
35
43
|
<span>{caseId}</span>
|
|
36
44
|
</header>
|
|
37
45
|
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
"pega"
|
|
84
84
|
],
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@pega/cosmos-react-condition-builder": "
|
|
87
|
-
"@pega/cosmos-react-core": "
|
|
88
|
-
"@pega/cosmos-react-work": "
|
|
89
|
-
"@pega/cosmos-react-wss": "
|
|
86
|
+
"@pega/cosmos-react-condition-builder": "~9.5.5-8",
|
|
87
|
+
"@pega/cosmos-react-core": "~9.5.5-8",
|
|
88
|
+
"@pega/cosmos-react-work": "~9.5.5-8",
|
|
89
|
+
"@pega/cosmos-react-wss": "~9.5.5-8",
|
|
90
90
|
"@pega/eslint-config": "^0.16.3",
|
|
91
91
|
"@pega/tsconfig": "^0.16.3",
|
|
92
92
|
"babel-loader": "^10.0.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PConnect } from '@pega/pcore-pconnect-typedefs';
|
|
2
2
|
|
|
3
3
|
// PConnProps.d.ts
|
|
4
4
|
// This gives us a place to have each component (which is most DX Components) that is
|
|
@@ -22,25 +22,24 @@ export interface PConnProps {
|
|
|
22
22
|
// [key: string]: any;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
// PConnFieldProps extends PConnProps to bring in the common properties that are
|
|
27
26
|
// associated with most field components (ex: Dropdown, TextInput, etc.) in the
|
|
28
27
|
// components/field directory
|
|
29
28
|
export interface PConnFieldProps extends PConnProps {
|
|
30
|
-
label: string
|
|
31
|
-
required: boolean
|
|
32
|
-
disabled: boolean
|
|
33
|
-
value: any
|
|
34
|
-
validatemessage: string
|
|
35
|
-
status?: string
|
|
36
|
-
onChange?: any
|
|
37
|
-
onBlur?: any
|
|
38
|
-
readOnly: boolean
|
|
39
|
-
testId: string
|
|
40
|
-
helperText: string
|
|
41
|
-
displayMode?: string
|
|
42
|
-
hideLabel: boolean
|
|
43
|
-
placeholder?: string
|
|
44
|
-
fieldMetadata?: any
|
|
45
|
-
additionalProps?: any
|
|
29
|
+
label: string;
|
|
30
|
+
required: boolean;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
value: any;
|
|
33
|
+
validatemessage: string;
|
|
34
|
+
status?: string;
|
|
35
|
+
onChange?: any;
|
|
36
|
+
onBlur?: any;
|
|
37
|
+
readOnly: boolean;
|
|
38
|
+
testId: string;
|
|
39
|
+
helperText: string;
|
|
40
|
+
displayMode?: string;
|
|
41
|
+
hideLabel: boolean;
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
fieldMetadata?: any;
|
|
44
|
+
additionalProps?: any;
|
|
46
45
|
}
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Pega_DXIL_MyCaseview",
|
|
3
|
+
"label": "My Caseview",
|
|
4
|
+
"description": "My Caseview",
|
|
5
|
+
"organization": "Pega",
|
|
6
|
+
"version": "0.0.1",
|
|
7
|
+
"library": "DXIL",
|
|
8
|
+
"componentKey": "Pega_DXIL_MyCaseview",
|
|
9
|
+
"type": "Presentation",
|
|
10
|
+
"subtype": "CASEVIEW",
|
|
11
|
+
"subtypeLabel": "CASEVIEW",
|
|
12
|
+
"icon": "OneColumnPage.svg",
|
|
13
|
+
"properties": [],
|
|
14
|
+
"defaultConfig": {}
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-no-useless-fragment */
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import PegaDxilMyCaseview from './index';
|
|
5
|
+
import configProps from './mock';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof PegaDxilMyCaseview> = {
|
|
8
|
+
title: 'PegaDxilMyCaseview',
|
|
9
|
+
component: PegaDxilMyCaseview,
|
|
10
|
+
excludeStories: /.*Data$/
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof PegaDxilMyCaseview>;
|
|
15
|
+
|
|
16
|
+
export const BasePegaDxilMyCaseview: Story = (args: any) => {
|
|
17
|
+
const props = {
|
|
18
|
+
...configProps
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<PegaDxilMyCaseview {...props} {...args} />
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
BasePegaDxilMyCaseview.args = {
|
|
29
|
+
caseId: configProps.caseId,
|
|
30
|
+
heading: configProps.heading,
|
|
31
|
+
subheading: configProps.subheading,
|
|
32
|
+
caseType: configProps.caseType,
|
|
33
|
+
summaryFields: configProps.summaryFields,
|
|
34
|
+
tabs: configProps.tabs,
|
|
35
|
+
summaryExpanded: configProps.summaryExpanded,
|
|
36
|
+
utilitiesExpanded: configProps.utilitiesExpanded
|
|
37
|
+
};
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/demo.test.tsx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { composeStories } from '@storybook/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
|
|
5
|
+
import * as DemoStories from './demo.stories';
|
|
6
|
+
|
|
7
|
+
const { BasePegaDxilMyCaseview } = composeStories(DemoStories);
|
|
8
|
+
|
|
9
|
+
test('renders PegaDxilMyCaseview', async () => {
|
|
10
|
+
render(<BasePegaDxilMyCaseview />);
|
|
11
|
+
expect(await screen.findByText('My Caseview')).toBeVisible();
|
|
12
|
+
expect(await screen.findByText('C-1001')).toBeInTheDocument();
|
|
13
|
+
expect(await screen.findByText('Subheading for My Caseview')).toBeInTheDocument();
|
|
14
|
+
expect(await screen.findByText('My Case Type')).toBeInTheDocument();
|
|
15
|
+
expect(await screen.findByText('Status')).toBeVisible();
|
|
16
|
+
expect(await screen.findByText('Open')).toBeVisible();
|
|
17
|
+
expect(await screen.findByText('Details')).toBeVisible();
|
|
18
|
+
expect(await screen.findByText('History')).toBeVisible();
|
|
19
|
+
});
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/index.tsx
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { withConfiguration } from '@pega/cosmos-react-core';
|
|
2
|
+
import type { CaseViewProps } from '@pega/cosmos-react-work';
|
|
3
|
+
|
|
4
|
+
import StyledPegaDxilMyCaseviewWrapper from './styles';
|
|
5
|
+
|
|
6
|
+
// Presentation-only component: props contract defined by CaseViewProps.
|
|
7
|
+
// No PCore / PConnect dependencies — all data is provided through props.
|
|
8
|
+
function PegaDxilMyCaseview(props: CaseViewProps) {
|
|
9
|
+
const {
|
|
10
|
+
caseId,
|
|
11
|
+
heading,
|
|
12
|
+
subheading,
|
|
13
|
+
caseType,
|
|
14
|
+
summaryFields,
|
|
15
|
+
tabs,
|
|
16
|
+
tabContent,
|
|
17
|
+
stages,
|
|
18
|
+
tasks,
|
|
19
|
+
banners,
|
|
20
|
+
utilities,
|
|
21
|
+
summaryExpanded,
|
|
22
|
+
onToggleSummary,
|
|
23
|
+
utilitiesExpanded,
|
|
24
|
+
onToggleUtilities
|
|
25
|
+
} = props;
|
|
26
|
+
|
|
27
|
+
const activeTab = tabContent?.find(t => t.id === tabs.currentTabId);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<StyledPegaDxilMyCaseviewWrapper>
|
|
31
|
+
<header>
|
|
32
|
+
<span>{caseType}</span>
|
|
33
|
+
<h1>{typeof heading === 'string' ? heading : heading?.text}</h1>
|
|
34
|
+
{subheading && (
|
|
35
|
+
<p>
|
|
36
|
+
{(() => {
|
|
37
|
+
if (typeof subheading === 'string') return subheading;
|
|
38
|
+
if (Array.isArray(subheading)) return subheading.join(' ');
|
|
39
|
+
return subheading?.text;
|
|
40
|
+
})()}
|
|
41
|
+
</p>
|
|
42
|
+
)}
|
|
43
|
+
<span>{caseId}</span>
|
|
44
|
+
</header>
|
|
45
|
+
|
|
46
|
+
{banners && <section aria-label='Banners'>{banners}</section>}
|
|
47
|
+
|
|
48
|
+
<section aria-label='Summary' aria-expanded={summaryExpanded}>
|
|
49
|
+
<button type='button' onClick={onToggleSummary}>{summaryExpanded ? 'Collapse' : 'Expand'} summary</button>
|
|
50
|
+
{summaryExpanded && (
|
|
51
|
+
<>
|
|
52
|
+
<dl>
|
|
53
|
+
{summaryFields.primary?.map(f => (
|
|
54
|
+
<div key={String(f.name)}>
|
|
55
|
+
<dt>{f.name}</dt>
|
|
56
|
+
<dd>{f.value}</dd>
|
|
57
|
+
</div>
|
|
58
|
+
))}
|
|
59
|
+
</dl>
|
|
60
|
+
{summaryFields.secondary && summaryFields.secondary.length > 0 && (
|
|
61
|
+
<dl>
|
|
62
|
+
{summaryFields.secondary.map(f => (
|
|
63
|
+
<div key={String(f.name)}>
|
|
64
|
+
<dt>{f.name}</dt>
|
|
65
|
+
<dd>{f.value}</dd>
|
|
66
|
+
</div>
|
|
67
|
+
))}
|
|
68
|
+
</dl>
|
|
69
|
+
)}
|
|
70
|
+
</>
|
|
71
|
+
)}
|
|
72
|
+
</section>
|
|
73
|
+
|
|
74
|
+
{stages && <section aria-label='Stages'>{stages}</section>}
|
|
75
|
+
|
|
76
|
+
<nav aria-label='Tabs'>
|
|
77
|
+
{tabs.items.map(tab => (
|
|
78
|
+
<button
|
|
79
|
+
type='button'
|
|
80
|
+
key={tab.id}
|
|
81
|
+
onClick={e => tabs.onClick(tab.id, e)}
|
|
82
|
+
aria-selected={tab.id === tabs.currentTabId}
|
|
83
|
+
>
|
|
84
|
+
{tab.name}
|
|
85
|
+
</button>
|
|
86
|
+
))}
|
|
87
|
+
</nav>
|
|
88
|
+
|
|
89
|
+
{activeTab && <section aria-label='Tab content'>{activeTab.content}</section>}
|
|
90
|
+
|
|
91
|
+
{tasks && <section aria-label='Tasks'>{tasks}</section>}
|
|
92
|
+
|
|
93
|
+
<section aria-label='Utilities' aria-expanded={utilitiesExpanded}>
|
|
94
|
+
<button type='button' onClick={onToggleUtilities}>{utilitiesExpanded ? 'Collapse' : 'Expand'} utilities</button>
|
|
95
|
+
{utilitiesExpanded && utilities}
|
|
96
|
+
</section>
|
|
97
|
+
</StyledPegaDxilMyCaseviewWrapper>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export default withConfiguration(PegaDxilMyCaseview);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fields": {
|
|
3
|
+
"Status": "Status",
|
|
4
|
+
"Urgency": "Urgency",
|
|
5
|
+
"Created": "Created",
|
|
6
|
+
"Owner": "Owner",
|
|
7
|
+
"Details": "Details",
|
|
8
|
+
"History": "History",
|
|
9
|
+
"Summary": "Summary",
|
|
10
|
+
"Collapse summary": "Collapse summary",
|
|
11
|
+
"Expand summary": "Expand summary",
|
|
12
|
+
"Collapse utilities": "Collapse utilities",
|
|
13
|
+
"Expand utilities": "Expand utilities"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Mock props satisfying CaseViewProps from @pega/cosmos-react-work
|
|
2
|
+
const configProps = {
|
|
3
|
+
caseId: 'C-1001',
|
|
4
|
+
heading: 'My Caseview',
|
|
5
|
+
subheading: 'Subheading for My Caseview',
|
|
6
|
+
caseType: 'My Case Type',
|
|
7
|
+
summaryFields: {
|
|
8
|
+
primary: [
|
|
9
|
+
{ name: 'Status', value: 'Open' },
|
|
10
|
+
{ name: 'Urgency', value: '10' }
|
|
11
|
+
],
|
|
12
|
+
secondary: [
|
|
13
|
+
{ name: 'Created', value: '2024-01-01' },
|
|
14
|
+
{ name: 'Owner', value: 'John Doe' }
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
tabs: {
|
|
18
|
+
items: [
|
|
19
|
+
{ id: 'tab-details', name: 'Details' },
|
|
20
|
+
{ id: 'tab-history', name: 'History' }
|
|
21
|
+
],
|
|
22
|
+
onClick: () => {},
|
|
23
|
+
currentTabId: 'tab-details'
|
|
24
|
+
},
|
|
25
|
+
tabContent: [
|
|
26
|
+
{ id: 'tab-details', content: 'Details content goes here' },
|
|
27
|
+
{ id: 'tab-history', content: 'History content goes here' }
|
|
28
|
+
],
|
|
29
|
+
summaryExpanded: true,
|
|
30
|
+
utilitiesExpanded: false
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default configProps;
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseview/styles.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { defaultThemeProp } from '@pega/cosmos-react-core';
|
|
3
|
+
|
|
4
|
+
// Commonly used theme tokens — explore more under theme.base.* or theme.components.*
|
|
5
|
+
// const spacing = theme.base.spacing;
|
|
6
|
+
// const borderRadius = theme.base['border-radius'];
|
|
7
|
+
// const brand = theme.base.palette['brand-primary'];
|
|
8
|
+
// const brandBg = theme.base.palette['brand-background'];
|
|
9
|
+
// const appBackground = theme.base.palette['app-background'];
|
|
10
|
+
// const panelBg = theme.base.palette['primary-background'];
|
|
11
|
+
// const secondaryBg = theme.base.palette['secondary-background'];
|
|
12
|
+
// const interactive = theme.base.palette.interactive;
|
|
13
|
+
// const border = theme.base.palette['border-line'];
|
|
14
|
+
// const urgent = theme.base.palette.urgent;
|
|
15
|
+
// const success = theme.base.palette.success;
|
|
16
|
+
|
|
17
|
+
const StyledPegaDxilMyCaseviewWrapper = styled.div(({ theme }) => {
|
|
18
|
+
const foregroundColor = theme.base.palette['foreground-color'];
|
|
19
|
+
|
|
20
|
+
return css`
|
|
21
|
+
color: ${foregroundColor};
|
|
22
|
+
`;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
StyledPegaDxilMyCaseviewWrapper.defaultProps = defaultThemeProp;
|
|
26
|
+
|
|
27
|
+
export default StyledPegaDxilMyCaseviewWrapper;
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Pega_DXIL_MyWsscaseview",
|
|
3
|
+
"label": "My Wsscaseview",
|
|
4
|
+
"description": "My Wsscaseview",
|
|
5
|
+
"organization": "Pega",
|
|
6
|
+
"version": "0.0.1",
|
|
7
|
+
"library": "DXIL",
|
|
8
|
+
"componentKey": "Pega_DXIL_MyWsscaseview",
|
|
9
|
+
"type": "Presentation",
|
|
10
|
+
"subtype": "WSSCASEVIEW",
|
|
11
|
+
"subtypeLabel": "WSSCASEVIEW",
|
|
12
|
+
"icon": "OneColumnPage.svg",
|
|
13
|
+
"properties": [],
|
|
14
|
+
"defaultConfig": {}
|
|
15
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-no-useless-fragment */
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import PegaDxilMyWsscaseview from './index';
|
|
5
|
+
import configProps from './mock';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof PegaDxilMyWsscaseview> = {
|
|
8
|
+
title: 'PegaDxilMyWsscaseview',
|
|
9
|
+
component: PegaDxilMyWsscaseview,
|
|
10
|
+
excludeStories: /.*Data$/
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof PegaDxilMyWsscaseview>;
|
|
15
|
+
|
|
16
|
+
export const BasePegaDxilMyWsscaseview: Story = (args: any) => {
|
|
17
|
+
const props = {
|
|
18
|
+
...configProps
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<PegaDxilMyWsscaseview {...props} {...args} />
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
BasePegaDxilMyWsscaseview.args = {
|
|
29
|
+
caseId: configProps.caseId,
|
|
30
|
+
heading: configProps.heading,
|
|
31
|
+
summary: configProps.summary,
|
|
32
|
+
stages: configProps.stages,
|
|
33
|
+
tasks: configProps.tasks,
|
|
34
|
+
feed: configProps.feed,
|
|
35
|
+
utility: configProps.utility
|
|
36
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { composeStories } from '@storybook/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
|
|
5
|
+
import * as DemoStories from './demo.stories';
|
|
6
|
+
|
|
7
|
+
const { BasePegaDxilMyWsscaseview } = composeStories(DemoStories);
|
|
8
|
+
|
|
9
|
+
test('renders PegaDxilMyWsscaseview', async () => {
|
|
10
|
+
render(<BasePegaDxilMyWsscaseview />);
|
|
11
|
+
expect(await screen.findByText('My Wsscaseview')).toBeVisible();
|
|
12
|
+
expect(await screen.findByText('C-1001')).toBeInTheDocument();
|
|
13
|
+
expect(await screen.findByText('Summary')).toBeVisible();
|
|
14
|
+
expect(await screen.findByText('Stages')).toBeVisible();
|
|
15
|
+
expect(await screen.findByText('Tasks')).toBeVisible();
|
|
16
|
+
expect(await screen.findByText('Feed')).toBeVisible();
|
|
17
|
+
expect(await screen.findByText('Utilities')).toBeVisible();
|
|
18
|
+
});
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/index.tsx
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { withConfiguration } from '@pega/cosmos-react-core';
|
|
2
|
+
import type { CaseViewProps as WSSCaseViewProps } from '@pega/cosmos-react-wss';
|
|
3
|
+
|
|
4
|
+
import StyledPegaDxilMyWsscaseviewWrapper from './styles';
|
|
5
|
+
|
|
6
|
+
// Presentation-only component: props contract defined by WSSCaseViewProps.
|
|
7
|
+
// No PCore / PConnect dependencies — all data is provided through props.
|
|
8
|
+
function PegaDxilMyWsscaseview(props: WSSCaseViewProps) {
|
|
9
|
+
const {
|
|
10
|
+
caseId,
|
|
11
|
+
heading,
|
|
12
|
+
summary,
|
|
13
|
+
stages,
|
|
14
|
+
tasks,
|
|
15
|
+
feed,
|
|
16
|
+
utility
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<StyledPegaDxilMyWsscaseviewWrapper>
|
|
21
|
+
<header>
|
|
22
|
+
<h1>{heading}</h1>
|
|
23
|
+
<span>{caseId}</span>
|
|
24
|
+
</header>
|
|
25
|
+
|
|
26
|
+
{summary && (
|
|
27
|
+
<section aria-label={summary.label}>
|
|
28
|
+
<h2>{summary.label}</h2>
|
|
29
|
+
{summary.content}
|
|
30
|
+
</section>
|
|
31
|
+
)}
|
|
32
|
+
|
|
33
|
+
{stages && (
|
|
34
|
+
<section aria-label={stages.label}>
|
|
35
|
+
<h2>{stages.label}</h2>
|
|
36
|
+
{stages.content}
|
|
37
|
+
</section>
|
|
38
|
+
)}
|
|
39
|
+
|
|
40
|
+
{tasks && (
|
|
41
|
+
<section aria-label={tasks.label}>
|
|
42
|
+
<h2>{tasks.label}</h2>
|
|
43
|
+
{tasks.content}
|
|
44
|
+
</section>
|
|
45
|
+
)}
|
|
46
|
+
|
|
47
|
+
{feed && (
|
|
48
|
+
<section aria-label={feed.label}>
|
|
49
|
+
<h2>{feed.label}</h2>
|
|
50
|
+
{feed.content}
|
|
51
|
+
</section>
|
|
52
|
+
)}
|
|
53
|
+
|
|
54
|
+
{utility && (
|
|
55
|
+
<section aria-label={utility.label}>
|
|
56
|
+
<h2>{utility.label}</h2>
|
|
57
|
+
{utility.content}
|
|
58
|
+
</section>
|
|
59
|
+
)}
|
|
60
|
+
</StyledPegaDxilMyWsscaseviewWrapper>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default withConfiguration(PegaDxilMyWsscaseview);
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/mock.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Mock props satisfying CaseViewProps from @pega/cosmos-react-wss
|
|
2
|
+
const configProps = {
|
|
3
|
+
caseId: 'C-1001',
|
|
4
|
+
heading: 'My Wsscaseview',
|
|
5
|
+
summary: {
|
|
6
|
+
label: 'Summary',
|
|
7
|
+
content: 'Summary content goes here'
|
|
8
|
+
},
|
|
9
|
+
stages: {
|
|
10
|
+
label: 'Stages',
|
|
11
|
+
content: 'Stages content goes here'
|
|
12
|
+
},
|
|
13
|
+
tasks: {
|
|
14
|
+
label: 'Tasks',
|
|
15
|
+
content: 'Tasks content goes here'
|
|
16
|
+
},
|
|
17
|
+
feed: {
|
|
18
|
+
label: 'Feed',
|
|
19
|
+
content: 'Feed content goes here'
|
|
20
|
+
},
|
|
21
|
+
utility: {
|
|
22
|
+
label: 'Utilities',
|
|
23
|
+
content: 'Utilities content goes here'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default configProps;
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyWsscaseview/styles.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { defaultThemeProp } from '@pega/cosmos-react-core';
|
|
3
|
+
|
|
4
|
+
// Commonly used theme tokens — explore more under theme.base.* or theme.components.*
|
|
5
|
+
// const spacing = theme.base.spacing;
|
|
6
|
+
// const borderRadius = theme.base['border-radius'];
|
|
7
|
+
// const brand = theme.base.palette['brand-primary'];
|
|
8
|
+
// const brandBg = theme.base.palette['brand-background'];
|
|
9
|
+
// const appBackground = theme.base.palette['app-background'];
|
|
10
|
+
// const panelBg = theme.base.palette['primary-background'];
|
|
11
|
+
// const secondaryBg = theme.base.palette['secondary-background'];
|
|
12
|
+
// const interactive = theme.base.palette.interactive;
|
|
13
|
+
// const border = theme.base.palette['border-line'];
|
|
14
|
+
// const urgent = theme.base.palette.urgent;
|
|
15
|
+
// const success = theme.base.palette.success;
|
|
16
|
+
|
|
17
|
+
const StyledPegaDxilMyWsscaseviewWrapper = styled.div(({ theme }) => {
|
|
18
|
+
const foregroundColor = theme.base.palette['foreground-color'];
|
|
19
|
+
|
|
20
|
+
return css`
|
|
21
|
+
color: ${foregroundColor};
|
|
22
|
+
`;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
StyledPegaDxilMyWsscaseviewWrapper.defaultProps = defaultThemeProp;
|
|
26
|
+
|
|
27
|
+
export default StyledPegaDxilMyWsscaseviewWrapper;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PConnect } from '@pega/pcore-pconnect-typedefs';
|
|
2
2
|
|
|
3
3
|
// PConnProps.d.ts
|
|
4
4
|
// This gives us a place to have each component (which is most DX Components) that is
|
|
@@ -22,25 +22,24 @@ export interface PConnProps {
|
|
|
22
22
|
// [key: string]: any;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
// PConnFieldProps extends PConnProps to bring in the common properties that are
|
|
27
26
|
// associated with most field components (ex: Dropdown, TextInput, etc.) in the
|
|
28
27
|
// components/field directory
|
|
29
28
|
export interface PConnFieldProps extends PConnProps {
|
|
30
|
-
label: string
|
|
31
|
-
required: boolean
|
|
32
|
-
disabled: boolean
|
|
33
|
-
value: any
|
|
34
|
-
validatemessage: string
|
|
35
|
-
status?: string
|
|
36
|
-
onChange?: any
|
|
37
|
-
onBlur?: any
|
|
38
|
-
readOnly: boolean
|
|
39
|
-
testId: string
|
|
40
|
-
helperText: string
|
|
41
|
-
displayMode?: string
|
|
42
|
-
hideLabel: boolean
|
|
43
|
-
placeholder?: string
|
|
44
|
-
fieldMetadata?: any
|
|
45
|
-
additionalProps?: any
|
|
29
|
+
label: string;
|
|
30
|
+
required: boolean;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
value: any;
|
|
33
|
+
validatemessage: string;
|
|
34
|
+
status?: string;
|
|
35
|
+
onChange?: any;
|
|
36
|
+
onBlur?: any;
|
|
37
|
+
readOnly: boolean;
|
|
38
|
+
testId: string;
|
|
39
|
+
helperText: string;
|
|
40
|
+
displayMode?: string;
|
|
41
|
+
hideLabel: boolean;
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
fieldMetadata?: any;
|
|
44
|
+
additionalProps?: any;
|
|
46
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PConnect } from '@pega/pcore-pconnect-typedefs';
|
|
2
2
|
|
|
3
3
|
// PConnProps.d.ts
|
|
4
4
|
// This gives us a place to have each component (which is most DX Components) that is
|
|
@@ -22,25 +22,24 @@ export interface PConnProps {
|
|
|
22
22
|
// [key: string]: any;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
// PConnFieldProps extends PConnProps to bring in the common properties that are
|
|
27
26
|
// associated with most field components (ex: Dropdown, TextInput, etc.) in the
|
|
28
27
|
// components/field directory
|
|
29
28
|
export interface PConnFieldProps extends PConnProps {
|
|
30
|
-
label: string
|
|
31
|
-
required: boolean
|
|
32
|
-
disabled: boolean
|
|
33
|
-
value: any
|
|
34
|
-
validatemessage: string
|
|
35
|
-
status?: string
|
|
36
|
-
onChange?: any
|
|
37
|
-
onBlur?: any
|
|
38
|
-
readOnly: boolean
|
|
39
|
-
testId: string
|
|
40
|
-
helperText: string
|
|
41
|
-
displayMode?: string
|
|
42
|
-
hideLabel: boolean
|
|
43
|
-
placeholder?: string
|
|
44
|
-
fieldMetadata?: any
|
|
45
|
-
additionalProps?: any
|
|
29
|
+
label: string;
|
|
30
|
+
required: boolean;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
value: any;
|
|
33
|
+
validatemessage: string;
|
|
34
|
+
status?: string;
|
|
35
|
+
onChange?: any;
|
|
36
|
+
onBlur?: any;
|
|
37
|
+
readOnly: boolean;
|
|
38
|
+
testId: string;
|
|
39
|
+
helperText: string;
|
|
40
|
+
displayMode?: string;
|
|
41
|
+
hideLabel: boolean;
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
fieldMetadata?: any;
|
|
44
|
+
additionalProps?: any;
|
|
46
45
|
}
|
package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseview/config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Pega_DXIL_MyCaseview",
|
|
3
|
+
"label": "My Caseview",
|
|
4
|
+
"description": "My Caseview",
|
|
5
|
+
"organization": "Pega",
|
|
6
|
+
"version": "0.0.1",
|
|
7
|
+
"library": "DXIL",
|
|
8
|
+
"componentKey": "Pega_DXIL_MyCaseview",
|
|
9
|
+
"type": "Presentation",
|
|
10
|
+
"subtype": "CASEVIEW",
|
|
11
|
+
"subtypeLabel": "CASEVIEW",
|
|
12
|
+
"icon": "OneColumnPage.svg",
|
|
13
|
+
"properties": [],
|
|
14
|
+
"defaultConfig": {}
|
|
15
|
+
}
|