@pega/sdk 0.0.2 → 0.0.3
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/dist/index.js +2 -2
- package/package.json +1 -1
- package/templates/react-sdk-reference/.claude/instructions/component-map.md +38 -0
- package/templates/react-sdk-reference/.claude/instructions/dse-component.md +75 -0
- package/templates/react-sdk-reference/.claude/instructions/field-component.md +71 -0
- package/templates/react-sdk-reference/.claude/instructions/template-component.md +92 -0
- package/templates/react-sdk-reference/.claude/instructions/widget-component.md +87 -0
- package/templates/react-sdk-reference/.claude/prompts/add-component.md +144 -0
- package/templates/react-sdk-reference/.claude/prompts/component-manifest.json +111 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-all-components.md +149 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-dse-components.md +126 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-field-components.md +139 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-template-components.md +151 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-widget-components.md +124 -0
- package/templates/react-sdk-reference/.claude/prompts/identify-components.md +105 -0
- package/templates/react-sdk-reference/.claude/prompts/replace-design-system.md +519 -0
- package/templates/react-sdk-reference/.claude/skills/component-contracts.md +140 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/AlertBanner.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Banner.md +149 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/CaseSummaryFields.md +154 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/DetailsFields.md +144 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldGroup.md +131 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldGroupList.md +111 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldValueList.md +115 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Operator.md +149 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Pulse.md +83 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/RichTextEditor.md +206 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/WssQuickCreate.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension.md +289 -0
- package/templates/react-sdk-reference/.claude/skills/field-components.md +294 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/AutoComplete.md +112 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/CancelAlert.md +203 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Checkbox.md +158 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Currency.md +106 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Date.md +99 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/DateTime.md +103 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Decimal.md +98 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Dropdown.md +114 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Email.md +107 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Group.md +90 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Integer.md +87 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Location.md +136 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Multiselect.md +164 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/ObjectReference.md +164 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Percentage.md +92 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Phone.md +110 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/RadioButtons.md +146 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/RichText.md +138 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/ScalarList.md +124 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/SelectableCard.md +216 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/SemanticLink.md +148 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/TextArea.md +96 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/TextContent.md +101 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/TextInput.md +104 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Time.md +88 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/URL.md +85 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/UserReference.md +180 -0
- package/templates/react-sdk-reference/.claude/skills/run-and-verify.md +68 -0
- package/templates/react-sdk-reference/.claude/skills/template-components.md +322 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/AdvancedSearch.md +144 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/AppShell.md +122 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/BannerPage.md +83 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/CaseSummary.md +100 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/CaseView.md +131 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/CaseViewActionsMenu.md +126 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/Confirmation.md +107 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DataReference.md +120 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DefaultForm.md +102 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DefaultPage.md +110 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/Details.md +88 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsSubTabs.md +95 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsThreeColumn.md +78 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsTwoColumn.md +78 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DynamicTabs.md +101 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/FieldGroupTemplate.md +109 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/HierarchicalForm.md +113 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/InlineDashboard.md +104 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/InlineDashboardPage.md +85 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/ListPage.md +68 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/ListView.md +139 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/MultiReferenceReadOnly.md +80 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/NarrowWide.md +141 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/OneColumn.md +109 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/PromotedFilters.md +124 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SelfServiceCaseView.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SimpleTable.md +127 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SingleReferenceReadOnly.md +103 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SubTabs.md +79 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/TwoColumn.md +131 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/WideNarrow.md +150 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/WssNavBar.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/widget-components.md +271 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/AppAnnouncement.md +82 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/Attachment.md +146 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/CaseHistory.md +107 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/FileUtility.md +200 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/Followers.md +99 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/QuickCreate.md +114 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/SummaryItem.md +167 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/ToDo.md +190 -0
- package/templates/react-sdk-reference/.cursor/rules/component-map.mdrules +41 -0
- package/templates/react-sdk-reference/.cursor/rules/dse-component.mdrules +78 -0
- package/templates/react-sdk-reference/.cursor/rules/field-component.mdrules +74 -0
- package/templates/react-sdk-reference/.cursor/rules/pega-sdk.mdrules +247 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/add-component.mdrules +149 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/component-manifest.json +111 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-all-components.mdrules +154 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-dse-components.mdrules +131 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-field-components.mdrules +144 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-template-components.mdrules +156 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-widget-components.mdrules +129 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/identify-components.mdrules +110 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/replace-design-system.mdrules +524 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/component-contracts.mdrules +145 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/AlertBanner.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Banner.mdrules +154 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/CaseSummaryFields.mdrules +159 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/DetailsFields.mdrules +149 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldGroup.mdrules +136 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldGroupList.mdrules +116 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldValueList.mdrules +120 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Operator.mdrules +154 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Pulse.mdrules +88 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/RichTextEditor.mdrules +211 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/WssQuickCreate.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension.mdrules +294 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-components.mdrules +299 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/AutoComplete.mdrules +117 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/CancelAlert.mdrules +208 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Checkbox.mdrules +163 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Currency.mdrules +111 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Date.mdrules +104 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/DateTime.mdrules +108 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Decimal.mdrules +103 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Dropdown.mdrules +119 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Email.mdrules +112 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Group.mdrules +95 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Integer.mdrules +92 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Location.mdrules +141 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Multiselect.mdrules +169 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/ObjectReference.mdrules +169 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Percentage.mdrules +97 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Phone.mdrules +115 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/RadioButtons.mdrules +151 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/RichText.mdrules +143 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/ScalarList.mdrules +129 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/SelectableCard.mdrules +221 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/SemanticLink.mdrules +153 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextArea.mdrules +101 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextContent.mdrules +106 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextInput.mdrules +109 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Time.mdrules +93 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/URL.mdrules +90 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/UserReference.mdrules +185 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/run-and-verify.mdrules +73 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-components.mdrules +327 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/AdvancedSearch.mdrules +149 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/AppShell.mdrules +127 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/BannerPage.mdrules +88 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseSummary.mdrules +105 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseView.mdrules +136 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseViewActionsMenu.mdrules +131 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/Confirmation.mdrules +112 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DataReference.mdrules +125 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DefaultForm.mdrules +107 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DefaultPage.mdrules +115 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/Details.mdrules +93 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsSubTabs.mdrules +100 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsThreeColumn.mdrules +83 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsTwoColumn.mdrules +83 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DynamicTabs.mdrules +106 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/FieldGroupTemplate.mdrules +114 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/HierarchicalForm.mdrules +118 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/InlineDashboard.mdrules +109 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/InlineDashboardPage.mdrules +90 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/ListPage.mdrules +73 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/ListView.mdrules +144 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/MultiReferenceReadOnly.mdrules +85 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/NarrowWide.mdrules +146 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/OneColumn.mdrules +114 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/PromotedFilters.mdrules +129 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SelfServiceCaseView.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SimpleTable.mdrules +132 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SingleReferenceReadOnly.mdrules +108 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SubTabs.mdrules +84 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/TwoColumn.mdrules +136 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/WideNarrow.mdrules +155 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/WssNavBar.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-components.mdrules +276 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/AppAnnouncement.mdrules +87 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/Attachment.mdrules +151 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/CaseHistory.mdrules +112 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/FileUtility.mdrules +205 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/Followers.mdrules +104 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/QuickCreate.mdrules +119 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/SummaryItem.mdrules +172 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/ToDo.mdrules +195 -0
- package/templates/react-sdk-reference/.cursor/rules/template-component.mdrules +95 -0
- package/templates/react-sdk-reference/.cursor/rules/widget-component.mdrules +90 -0
- package/templates/react-sdk-reference/.github/copilot-instructions.md +58 -0
- package/templates/react-sdk-reference/.github/prompts/add-component.prompt.md +144 -16
- package/templates/react-sdk-reference/.github/prompts/generate-all-components.prompt.md +154 -0
- package/templates/react-sdk-reference/.github/prompts/generate-dse-components.prompt.md +131 -0
- package/templates/react-sdk-reference/.github/prompts/generate-field-components.prompt.md +144 -0
- package/templates/react-sdk-reference/.github/prompts/generate-template-components.prompt.md +156 -0
- package/templates/react-sdk-reference/.github/prompts/generate-widget-components.prompt.md +129 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension.md +58 -18
- package/templates/react-sdk-reference/.github/skills/field-components.md +55 -23
- package/templates/react-sdk-reference/.github/skills/template-components.md +48 -11
- package/templates/react-sdk-reference/.github/skills/widget-components.md +49 -12
- package/templates/react-sdk-reference/AGENTS.md +217 -29
- package/templates/react-sdk-reference/package.json +1 -1
- package/templates/react-sdk-reference/pega-constellationjs-0.26.3-local.tgz +0 -0
- package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
- package/templates/react-sdk-reference/sdk-config.json +1 -1
- package/templates/react-sdk-reference/vite.config.ts +1 -1
- package/templates/react-sdk-reference/.github/prompts/replace-all-fields.prompt.md +0 -48
- package/templates/react-sdk-reference/.github/prompts/replace-component.prompt.md +0 -81
- package/templates/react-sdk-reference/.github/prompts/replace-field.prompt.md +0 -41
- package/templates/react-sdk-reference/.github/prompts/swap-design-system.prompt.md +0 -49
- package/templates/react-sdk-reference/.github/skills/swap-design-system.md +0 -105
- package/templates/react-sdk-reference/pega-constellationjs-0.26.2.tgz +0 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: template-components
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: Template Components
|
|
7
|
+
|
|
8
|
+
Create or replace template components (layouts and page structures) in the react-sdk-reference application. Template components arrange child components into visual layouts (columns, tabs, forms, pages).
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Architecture Overview
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
src/components/template/<ComponentName>/
|
|
16
|
+
├── <ComponentName>.tsx # Component implementation
|
|
17
|
+
├── index.tsx # Re-export (if present)
|
|
18
|
+
├── <ComponentName>.css # Styles (CSS file, optional)
|
|
19
|
+
├── utils.ts # Template-specific utilities (optional)
|
|
20
|
+
└── config-ext.json # Metadata (optional)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Some templates have nested sub-templates:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
src/components/template/TwoColumn/
|
|
27
|
+
├── TwoColumn/TwoColumn.tsx
|
|
28
|
+
├── TwoColumnPage/TwoColumnPage.tsx
|
|
29
|
+
└── TwoColumnTab/TwoColumnTab.tsx
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Props Interface
|
|
35
|
+
|
|
36
|
+
Template components extend `PConnProps`:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import type { PConnProps } from '../../../types/PConnProps';
|
|
40
|
+
|
|
41
|
+
interface PConnProps {
|
|
42
|
+
getPConnect: () => typeof PConnect;
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Templates typically receive children through `getPConnect().getChildren()` rather than React `children` prop, though layout templates (TwoColumn, OneColumn) receive React children directly.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Implementation Patterns
|
|
51
|
+
|
|
52
|
+
### Layout Template (renders React children in grid)
|
|
53
|
+
|
|
54
|
+
Used for: TwoColumn, OneColumn, NarrowWide, WideNarrow
|
|
55
|
+
|
|
56
|
+
This pattern is design-system agnostic. The `// [DS GRID]` section must be replaced with your design system's grid or flex layout primitive — see the "Design System Adaptation" section below.
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
60
|
+
// Import your design system layout primitive here:
|
|
61
|
+
// e.g. import { Grid } from 'antd';
|
|
62
|
+
// e.g. import { SimpleGrid } from '@chakra-ui/react';
|
|
63
|
+
import type { PConnProps } from '@pega/sdk-react';
|
|
64
|
+
|
|
65
|
+
interface TwoColumnProps extends PConnProps {
|
|
66
|
+
templateCol?: string; // e.g. '1fr 1fr', '2fr 1fr'
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default function TwoColumn(props: PropsWithChildren<TwoColumnProps>) {
|
|
70
|
+
const { children, templateCol = '1fr 1fr' } = props;
|
|
71
|
+
const childrenToRender = children as ReactElement[];
|
|
72
|
+
|
|
73
|
+
// Parse templateCol into column width ratios
|
|
74
|
+
// Strip unit suffixes, split on whitespace, convert to numbers
|
|
75
|
+
const colArray = templateCol.replaceAll(/[a-z]+/g, '').split(/\s/).map(Number);
|
|
76
|
+
const totalCols = colArray.reduce((v, itm) => itm + v, 0);
|
|
77
|
+
// colArray[0] / totalCols = left column fraction
|
|
78
|
+
// colArray[1] / totalCols = right column fraction
|
|
79
|
+
|
|
80
|
+
// [DS GRID] — render two children in a responsive grid using the computed ratios
|
|
81
|
+
// On mobile (narrow viewport): both columns should stack to full width
|
|
82
|
+
// On desktop: apply the computed left/right ratio
|
|
83
|
+
return (
|
|
84
|
+
<YourDesignSystemGrid>
|
|
85
|
+
<YourDesignSystemColumn ratio={colArray[0] / totalCols}>
|
|
86
|
+
{childrenToRender[0]}
|
|
87
|
+
</YourDesignSystemColumn>
|
|
88
|
+
<YourDesignSystemColumn ratio={colArray[1] / totalCols}>
|
|
89
|
+
{childrenToRender[1]}
|
|
90
|
+
</YourDesignSystemColumn>
|
|
91
|
+
</YourDesignSystemGrid>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Design System Adaptation (Layout Templates Only)
|
|
99
|
+
|
|
100
|
+
> Form templates and page templates use the PConnect bridge pattern and do **not** use any design system primitives. This section applies only to layout templates: TwoColumn, OneColumn, NarrowWide, WideNarrow, and their sub-variants.
|
|
101
|
+
|
|
102
|
+
**1. Check the component-specific skill file** — `.cursor/rules/skills/template-skills/<ComponentName>.mdrules` contains a **Design System Mapping** table where available. Use it as a starting point.
|
|
103
|
+
|
|
104
|
+
**2. If the chosen design system is not listed** — use the **component purpose** description to identify the appropriate DS layout primitive (grid, flex, columns).
|
|
105
|
+
|
|
106
|
+
**3. Discover the API from installed packages** — confirm layout component names and props from `.d.ts` before writing JSX:
|
|
107
|
+
```bash
|
|
108
|
+
find node_modules/<ds-package> -name "*.d.ts" | xargs grep -l "Grid\|Columns\|Flex" | head -5
|
|
109
|
+
grep -A 30 "interface.*Props" <path-to-file>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**4. Column ratio mapping** — the `templateCol` prop (e.g., `'2fr 1fr'`) gives you fractional widths. Map to your DS's column system:
|
|
113
|
+
|
|
114
|
+
| `templateCol` | Fraction | MUI 12-col | CSS `grid-template-columns` |
|
|
115
|
+
|---|---|---|---|
|
|
116
|
+
| `'1fr 1fr'` | 50% / 50% | 6 / 6 | `1fr 1fr` |
|
|
117
|
+
| `'2fr 1fr'` | 67% / 33% | 8 / 4 | `2fr 1fr` |
|
|
118
|
+
| `'1fr 2fr'` | 33% / 67% | 4 / 8 | `1fr 2fr` |
|
|
119
|
+
|
|
120
|
+
**5. Responsive behavior** — on mobile, both columns must stack to full width. Use your DS's responsive breakpoint props or a CSS media query.
|
|
121
|
+
|
|
122
|
+
### Form Template (renders children via PConnect bridge)
|
|
123
|
+
|
|
124
|
+
Used for: DefaultForm, HierarchicalForm
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { createElement } from 'react';
|
|
128
|
+
import createPConnectComponent from '../../helpers/react_pconnect';
|
|
129
|
+
import connectToState from '../../helpers/state-utils';
|
|
130
|
+
import type { PConnProps } from '../../../types/PConnProps';
|
|
131
|
+
|
|
132
|
+
interface DefaultFormProps extends PConnProps {
|
|
133
|
+
NumCols: string;
|
|
134
|
+
instructions: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export default function DefaultForm(props: DefaultFormProps) {
|
|
138
|
+
const { getPConnect, NumCols = '1' } = props;
|
|
139
|
+
|
|
140
|
+
// Get children from the first region
|
|
141
|
+
const arChildren = getPConnect().getChildren()[0].getPConnect().getChildren();
|
|
142
|
+
|
|
143
|
+
// Wrap each child in a PConnect component
|
|
144
|
+
const dfChildren = arChildren?.map((kid, i) => (
|
|
145
|
+
createElement(createPConnectComponent(), { ...kid, key: `child-${i}` })
|
|
146
|
+
));
|
|
147
|
+
|
|
148
|
+
return <div className={`form-${NumCols}-col`}>{dfChildren}</div>;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Page Template (renders regions from PConnect children)
|
|
153
|
+
|
|
154
|
+
Used for: CaseView, DefaultPage, ObjectPage
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import { createElement } from 'react';
|
|
158
|
+
import createPConnectComponent from '../../helpers/react_pconnect';
|
|
159
|
+
import type { PConnProps } from '../../../types/PConnProps';
|
|
160
|
+
|
|
161
|
+
interface CaseViewProps extends PConnProps {
|
|
162
|
+
header?: string;
|
|
163
|
+
subheader?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export default function CaseView(props: CaseViewProps) {
|
|
167
|
+
const { getPConnect, header } = props;
|
|
168
|
+
const pConn = getPConnect();
|
|
169
|
+
const children = pConn.getChildren();
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<div>
|
|
173
|
+
<h2>{header}</h2>
|
|
174
|
+
{children.map((child, index) => (
|
|
175
|
+
createElement(createPConnectComponent(), { ...child, key: `region-${index}` })
|
|
176
|
+
))}
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Rendering Children
|
|
185
|
+
|
|
186
|
+
Templates use two patterns to render child components:
|
|
187
|
+
|
|
188
|
+
### 1. React children (layout templates)
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
// TwoColumn, OneColumn, etc. receive children as React props
|
|
192
|
+
const { children } = props;
|
|
193
|
+
const childrenToRender = children as ReactElement[];
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 2. PConnect children (form/page templates)
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
import { createElement } from 'react';
|
|
200
|
+
import createPConnectComponent from '../../helpers/react_pconnect';
|
|
201
|
+
|
|
202
|
+
// Get child PConnect objects
|
|
203
|
+
const children = getPConnect().getChildren();
|
|
204
|
+
|
|
205
|
+
// Render each child through the PConnect bridge
|
|
206
|
+
children.map((child, i) =>
|
|
207
|
+
createElement(createPConnectComponent(), { ...child, key: `child-${i}` }),
|
|
208
|
+
);
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### 3. State-connected children (DefaultForm pattern)
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import connectToState from '../../helpers/state-utils';
|
|
215
|
+
import createPConnectComponent from '../../helpers/react_pconnect';
|
|
216
|
+
|
|
217
|
+
// connectToState HOC subscribes to Redux store for visibility/props
|
|
218
|
+
const Child = connectToState(mapStateToProps)((props) => {
|
|
219
|
+
const { key, visibility, ...rest } = props;
|
|
220
|
+
return createElement(createPConnectComponent(), { ...rest, key, visibility });
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Helper Utilities
|
|
227
|
+
|
|
228
|
+
### `createPConnectComponent` (from `../../helpers/react_pconnect`)
|
|
229
|
+
|
|
230
|
+
Factory that returns the PConnect bridge component. Used to render child PConnect objects:
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import createPConnectComponent from '../../helpers/react_pconnect';
|
|
234
|
+
createElement(createPConnectComponent(), childPConnectProps);
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### `connectToState` (from `../../helpers/state-utils`)
|
|
238
|
+
|
|
239
|
+
HOC that connects a component to the Redux store for visibility and dynamic props:
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
import connectToState from '../../helpers/state-utils';
|
|
243
|
+
const ConnectedChild = connectToState(mapStateToProps)(ChildComponent);
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### `getInstructions` (from `../../helpers/template-utils`)
|
|
247
|
+
|
|
248
|
+
Extracts instruction text for forms:
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
import { getInstructions } from '../../helpers/template-utils';
|
|
252
|
+
const instructions = getInstructions(getPConnect(), props.instructions);
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Registration
|
|
258
|
+
|
|
259
|
+
Register templates in `src/components/component-map.ts`:
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import MyTemplate from './template/MyTemplate';
|
|
263
|
+
|
|
264
|
+
// In getSampleComponentMap():
|
|
265
|
+
{
|
|
266
|
+
...sdkComponents,
|
|
267
|
+
MyTemplate, // Key must match Pega component name
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
For nested templates (e.g., TwoColumn/TwoColumnPage/TwoColumnTab), register each separately:
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
import TwoColumn from './template/TwoColumn/TwoColumn/TwoColumn';
|
|
275
|
+
import TwoColumnPage from './template/TwoColumn/TwoColumnPage';
|
|
276
|
+
import TwoColumnTab from './template/TwoColumn/TwoColumnTab';
|
|
277
|
+
|
|
278
|
+
{
|
|
279
|
+
TwoColumn,
|
|
280
|
+
TwoColumnPage,
|
|
281
|
+
TwoColumnTab,
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Existing Template Components
|
|
288
|
+
|
|
289
|
+
| Component | Type | Description |
|
|
290
|
+
| ----------------------------------------------- | ---------- | ------------------------------------ |
|
|
291
|
+
| AdvancedSearch | Page | Advanced search with filters |
|
|
292
|
+
| AppShell | Page | Top-level app layout with nav |
|
|
293
|
+
| BannerPage | Page | Page with banner section |
|
|
294
|
+
| CaseSummary | Page | Case summary header |
|
|
295
|
+
| CaseView | Page | Main case view with regions |
|
|
296
|
+
| CaseViewActionsMenu | Widget | Case action dropdown menu |
|
|
297
|
+
| Confirmation | Page | Case completion confirmation |
|
|
298
|
+
| DataReference | Form | Embedded data reference lookup |
|
|
299
|
+
| DefaultForm | Form | Standard form layout (1/2/3 columns) |
|
|
300
|
+
| DefaultPage | Page | Default page structure |
|
|
301
|
+
| Details / DetailsTwoColumn / DetailsThreeColumn | Layout | Details region layouts |
|
|
302
|
+
| FieldGroupTemplate | Form | Repeating field group |
|
|
303
|
+
| HierarchicalForm | Form | Multi-step hierarchical form |
|
|
304
|
+
| InlineDashboard | Page | Inline dashboard container |
|
|
305
|
+
| ListPage | Page | List/table page |
|
|
306
|
+
| ListView | Page | Data table with filtering/sorting |
|
|
307
|
+
| MultiReferenceReadOnly | Display | Read-only multi-reference display |
|
|
308
|
+
| NarrowWide / WideNarrow | Layout | Asymmetric two-column layouts |
|
|
309
|
+
| ObjectPage | Page | Object detail page |
|
|
310
|
+
| OneColumn | Layout | Single-column layout |
|
|
311
|
+
| PromotedFilters | Widget | Filter bar for lists |
|
|
312
|
+
| SimpleTable | Table | Editable/read-only data tables |
|
|
313
|
+
| SingleReferenceReadOnly | Display | Read-only single reference |
|
|
314
|
+
| SubTabs | Navigation | Tab container |
|
|
315
|
+
| TwoColumn | Layout | Two-column layout |
|
|
316
|
+
| WssNavBar | Navigation | WSS navigation bar |
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Key Conventions
|
|
321
|
+
|
|
322
|
+
1. **Default export** — `export default function TemplateName`.
|
|
323
|
+
2. **Children from PConnect** — Use `getPConnect().getChildren()` to access child regions.
|
|
324
|
+
3. **createElement pattern** — Use `createElement(createPConnectComponent(), childProps)` to render PConnect children.
|
|
325
|
+
4. **CSS files** — Template-specific styles go in `<TemplateName>.css` alongside the component.
|
|
326
|
+
5. **Responsive** — Use MUI Grid with `xs: 12` for mobile and `md: <size>` for desktop breakpoints.
|
|
327
|
+
6. **templateCol** — Layout templates often receive a `templateCol` prop (e.g., `"1fr 1fr"`, `"2fr 1fr"`) to control column ratios.
|
package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/AdvancedSearch.mdrules
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Template component skill: AdvancedSearch
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: AdvancedSearch
|
|
7
|
+
|
|
8
|
+
Advanced search template. Renders grouped search field sections with deduplication, delegating each section to a `SearchGroups` sub-component. Also covers the `SearchGroups` sub-component.
|
|
9
|
+
|
|
10
|
+
> **Prerequisite skill:** [`template-components.md`](../template-components.md) — covers architecture, child rendering patterns, and registration conventions common to ALL template components.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Component Purpose
|
|
15
|
+
|
|
16
|
+
Renders a multi-section advanced search form where search fields are organized into groups. Deduplicates search fields by value across groups. Each group is rendered by the `SearchGroups` sub-component. Shares search configuration via a React context (`DataReferenceAdvancedSearchContext`).
|
|
17
|
+
|
|
18
|
+
## Pega Metadata
|
|
19
|
+
|
|
20
|
+
- **Registration key:** `AdvancedSearch` (in `component-map.ts`)
|
|
21
|
+
- **Category:** Search / Filter template
|
|
22
|
+
- **Extends:** `PConnProps`
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Required | Description |
|
|
27
|
+
|------|------|----------|-------------|
|
|
28
|
+
| `dataPageName` | `string` | Yes | Data page for search results |
|
|
29
|
+
| `parameters` | `object` | No | Parameters passed to the data page |
|
|
30
|
+
| `getPConnect` | `function` | Yes | PConnect getter |
|
|
31
|
+
|
|
32
|
+
## Behavioral Contract
|
|
33
|
+
|
|
34
|
+
### Search Groups from Metadata
|
|
35
|
+
|
|
36
|
+
1. `rawViewMetadata = getPConnect().getRawMetadata()`.
|
|
37
|
+
2. `searchGroups = rawViewMetadata.config.searchGroups` — array of group config objects.
|
|
38
|
+
3. Each group has a `label` and a `fields` array.
|
|
39
|
+
|
|
40
|
+
### Field Deduplication
|
|
41
|
+
|
|
42
|
+
- Track seen field values in a `Set`.
|
|
43
|
+
- For each field across all groups: if `field.value` already in Set, skip it.
|
|
44
|
+
- Else add `field.value` to Set and include the field.
|
|
45
|
+
- Deduplication is applied per-group in order — earlier groups take precedence.
|
|
46
|
+
|
|
47
|
+
### Context (`DataReferenceAdvancedSearchContext`)
|
|
48
|
+
|
|
49
|
+
Provides shared config to `SearchGroups`:
|
|
50
|
+
```tsx
|
|
51
|
+
<DataReferenceAdvancedSearchContext.Provider value={{ dataPageName, parameters, getPConnect }}>
|
|
52
|
+
{searchGroups.map((group) => <SearchGroups key={group.label} group={group} />)}
|
|
53
|
+
</DataReferenceAdvancedSearchContext.Provider>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Render Structure
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
<div className="psdk-advanced-search">
|
|
60
|
+
{searchGroups.map(group => (
|
|
61
|
+
<SearchGroups group={group} key={group.label} />
|
|
62
|
+
))}
|
|
63
|
+
</div>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Sub-Component: SearchGroups
|
|
69
|
+
|
|
70
|
+
Renders a single search group section: a heading + a list of editable search fields.
|
|
71
|
+
|
|
72
|
+
### Props
|
|
73
|
+
|
|
74
|
+
| Prop | Type | Description |
|
|
75
|
+
|------|------|-------------|
|
|
76
|
+
| `group` | `object` | `{ label: string, fields: array }` |
|
|
77
|
+
|
|
78
|
+
### Behavioral Contract
|
|
79
|
+
|
|
80
|
+
For each field in `group.fields`:
|
|
81
|
+
1. Get `firstChildPConnect = getPConnect().getChildren()[0]`.
|
|
82
|
+
2. Create an editable field component: `firstChildPConnect.createComponent({ type: field.type, config: { ...field.config } })`.
|
|
83
|
+
3. Render the created component alongside a `<SearchGroups>` label row.
|
|
84
|
+
|
|
85
|
+
### Render Structure
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
<div className="psdk-search-group">
|
|
89
|
+
<h4>{group.label}</h4>
|
|
90
|
+
{group.fields.map((field, i) => (
|
|
91
|
+
<div key={i} className="psdk-search-group-field">
|
|
92
|
+
{createdFieldComponent[i]}
|
|
93
|
+
</div>
|
|
94
|
+
))}
|
|
95
|
+
</div>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Visual Specifications
|
|
99
|
+
|
|
100
|
+
### AdvancedSearch Container
|
|
101
|
+
|
|
102
|
+
| Element | Description |
|
|
103
|
+
|---------|-------------|
|
|
104
|
+
| Outer container | Vertical stack of search group sections |
|
|
105
|
+
|
|
106
|
+
### SearchGroups Section
|
|
107
|
+
|
|
108
|
+
| Element | Description |
|
|
109
|
+
|---------|-------------|
|
|
110
|
+
| Group heading | `<h4>` with group label |
|
|
111
|
+
| Field rows | Each field rendered as a form control |
|
|
112
|
+
|
|
113
|
+
**CSS-only implementation notes:**
|
|
114
|
+
- Outer container: `display: flex; flex-direction: column; gap: 1.5rem`.
|
|
115
|
+
- Group section: `display: flex; flex-direction: column; gap: 0.75rem`.
|
|
116
|
+
- Group heading: `font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem`.
|
|
117
|
+
- Field row: `display: grid; grid-template-columns: 200px 1fr; align-items: center; gap: 0.5rem`.
|
|
118
|
+
|
|
119
|
+
## Edge Cases & Special Logic
|
|
120
|
+
|
|
121
|
+
- `rawViewMetadata.config.searchGroups` may be undefined if the view has no search groups — default to `[]`.
|
|
122
|
+
- Field deduplication is by `field.value` (the property path), not by label.
|
|
123
|
+
- `firstChildPConnect.createComponent` — must use the correct field type from `field.type`; the created component is a live PConnect view.
|
|
124
|
+
- Context is required by `SearchGroups` — always wrap `SearchGroups` with the context provider.
|
|
125
|
+
|
|
126
|
+
## Dependencies
|
|
127
|
+
|
|
128
|
+
- `DataReferenceAdvancedSearchContext` — shared context (defined in `./context` or inline)
|
|
129
|
+
- `PConnectComponent` from `@pega/sdk-react` — renders created field components
|
|
130
|
+
- `getRawMetadata()` — for search group config extraction
|
|
131
|
+
|
|
132
|
+
## Design System Mapping
|
|
133
|
+
|
|
134
|
+
**UI control type:** Multi-section advanced search form with grouped field rows.
|
|
135
|
+
|
|
136
|
+
Listed design systems are examples only.
|
|
137
|
+
|
|
138
|
+
| Design System | Group Heading | Field Layout |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| Default (CSS only) | `<h4>` | CSS grid 2-col (label + input) |
|
|
141
|
+
| MUI | `<Typography variant='h6'>` | `<Grid container>` |
|
|
142
|
+
| Ant Design | `<Typography.Title level={5}>` | `<Form.Item>` |
|
|
143
|
+
| Chakra UI | `<Heading size='sm'>` | `<FormControl>` rows |
|
|
144
|
+
| Shadcn/ui | `<h4>` or `<Label>` | Tailwind grid |
|
|
145
|
+
|
|
146
|
+
When implementing in a specific design system:
|
|
147
|
+
- `DataReferenceAdvancedSearchContext` must be provided — `SearchGroups` consumes it via `useContext`
|
|
148
|
+
- Field deduplication by `field.value` must happen before rendering
|
|
149
|
+
- `createComponent` creates live editable fields — render via `createElement(PConnectComponent, fieldConfig)`
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Template component skill: AppShell
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: AppShell
|
|
7
|
+
|
|
8
|
+
Top-level application shell template. Renders the outer portal/WSS portal frame: navigation bar, alert banners, operator avatar, portal logo, and case types. Provides NavContext to child components.
|
|
9
|
+
|
|
10
|
+
> **Prerequisite skill:** [`template-components.md`](../template-components.md) — covers architecture, child rendering patterns, and registration conventions common to ALL template components.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Component Purpose
|
|
15
|
+
|
|
16
|
+
The outermost container for the Pega SDK React app. Determines whether the app is running in WSS portal or standard portal mode, renders the appropriate navigation bar, handles HTTP and page-level alert messages, loads the portal logo asynchronously, and passes navigation links and case types to the nav bar.
|
|
17
|
+
|
|
18
|
+
## Pega Metadata
|
|
19
|
+
|
|
20
|
+
- **Registration key:** `AppShell` (in `component-map.ts`)
|
|
21
|
+
- **Category:** Page template — application shell
|
|
22
|
+
- **Extends:** `PConnProps`
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Required | Description |
|
|
27
|
+
|------|------|----------|-------------|
|
|
28
|
+
| `pages` | `array` | Yes | Array of portal page objects `{ name, pyLabel, linkUrl }` |
|
|
29
|
+
| `caseTypes` | `array` | No | Fallback case types (overridden by data page fetch if empty) |
|
|
30
|
+
| `portalName` | `string` | Yes | Portal identifier — determines WSS vs standard rendering |
|
|
31
|
+
| `displayName` | `string` | No | Operator display name for avatar |
|
|
32
|
+
| `getPConnect` | `function` | Yes | PConnect getter |
|
|
33
|
+
| `children` | `ReactNode` | Yes | Main content area |
|
|
34
|
+
|
|
35
|
+
## Behavioral Contract
|
|
36
|
+
|
|
37
|
+
### Portal Type Detection
|
|
38
|
+
|
|
39
|
+
- Check `portalName` (or metadata flag) against WSS portal identifier.
|
|
40
|
+
- WSS portal → render `<WssNavBar>` component.
|
|
41
|
+
- Standard portal → render `<NavBar>` component.
|
|
42
|
+
|
|
43
|
+
### Alert Banners
|
|
44
|
+
|
|
45
|
+
1. Subscribe to `getPConnect()` for `httpMessages` and `pageMessages` updates.
|
|
46
|
+
2. If either array is non-empty, render `<AlertBanner>` DSE component above the main content.
|
|
47
|
+
3. `AlertBanner` receives the combined message array and a dismiss handler.
|
|
48
|
+
|
|
49
|
+
### Portal Logo
|
|
50
|
+
|
|
51
|
+
1. On mount, call `PCore.getAssetLoader().getSvcImageUrl(logoAssetName)` asynchronously.
|
|
52
|
+
2. Store the resolved URL in `portalLogoUrl` state.
|
|
53
|
+
3. Pass `portalLogoUrl` to the nav bar as the `logo` prop.
|
|
54
|
+
|
|
55
|
+
### Operator Avatar
|
|
56
|
+
|
|
57
|
+
- Read `displayName` from `getPConnect().getValue('.pyUserName')` or the `displayName` prop.
|
|
58
|
+
- Render operator avatar (initials) in the nav bar via the `operatorInfo` prop.
|
|
59
|
+
|
|
60
|
+
### Case Types
|
|
61
|
+
|
|
62
|
+
1. On mount, fetch case types via `PCore.getDataPageUtils().getPageDataAsync('D_pyPortalTypeList', 'root', {})`.
|
|
63
|
+
2. Store result in `caseTypes` state (overrides the prop default).
|
|
64
|
+
3. Pass `caseTypes` to the nav bar.
|
|
65
|
+
|
|
66
|
+
### NavContext
|
|
67
|
+
|
|
68
|
+
- Wrap children in `<NavContext.Provider value={{ links, caseTypes }}>`.
|
|
69
|
+
- `links` is derived from `pages` prop: `pages.map(p => ({ label: p.pyLabel, url: p.linkUrl, id: p.name }))`.
|
|
70
|
+
|
|
71
|
+
### Render Structure
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
<div className="psdk-app-shell">
|
|
75
|
+
<NavBar | WssNavBar (with logo, caseTypes, operatorInfo, links) />
|
|
76
|
+
<AlertBanner (if messages) />
|
|
77
|
+
<main className="psdk-app-shell-content">
|
|
78
|
+
<NavContext.Provider>
|
|
79
|
+
{children}
|
|
80
|
+
</NavContext.Provider>
|
|
81
|
+
</main>
|
|
82
|
+
</div>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Visual Specifications
|
|
86
|
+
|
|
87
|
+
**CSS-only implementation notes:**
|
|
88
|
+
- Shell wrapper: `display: flex; flex-direction: column; height: 100vh`.
|
|
89
|
+
- Nav bar: `flex: 0 0 auto` (fixed height).
|
|
90
|
+
- Alert banner: `flex: 0 0 auto` (shown below nav, pushes content down).
|
|
91
|
+
- Content area: `flex: 1 1 auto; overflow-y: auto`.
|
|
92
|
+
|
|
93
|
+
## Edge Cases & Special Logic
|
|
94
|
+
|
|
95
|
+
- Logo loading is async — show fallback (app name or blank) until URL resolves.
|
|
96
|
+
- Case types fetch may fail — catch errors and fall back to the `caseTypes` prop.
|
|
97
|
+
- `httpMessages` are transient (from API errors) — clear them after display or on next navigation.
|
|
98
|
+
- `pageMessages` are persistent until explicitly dismissed.
|
|
99
|
+
- If `pages` is empty, `links` array is empty — nav bar may render without page links.
|
|
100
|
+
|
|
101
|
+
## Dependencies
|
|
102
|
+
|
|
103
|
+
- `NavBar` DSE component — standard portal navigation
|
|
104
|
+
- `WssNavBar` template component — WSS portal navigation (see `WssNavBar.md`)
|
|
105
|
+
- `AlertBanner` DSE component — message display
|
|
106
|
+
- `NavContext` from `../../context/nav-context`
|
|
107
|
+
- `PCore.getAssetLoader().getSvcImageUrl()` — logo URL resolution
|
|
108
|
+
- `PCore.getDataPageUtils().getPageDataAsync()` — case types data page
|
|
109
|
+
|
|
110
|
+
## Design System Mapping
|
|
111
|
+
|
|
112
|
+
**UI control type:** Application shell layout — fixed nav + scrollable content area.
|
|
113
|
+
|
|
114
|
+
Listed design systems are examples only.
|
|
115
|
+
|
|
116
|
+
| Design System | Nav Bar | Alert Banner | Shell Layout |
|
|
117
|
+
|---|---|---|---|
|
|
118
|
+
| Default (CSS only) | `<header>` + custom nav | `<div role='alert'>` | CSS flexbox column |
|
|
119
|
+
| MUI | `<AppBar>` + `<Toolbar>` | `<Alert>` | `<Box display='flex' flexDirection='column'>` |
|
|
120
|
+
| Ant Design | `<Layout.Header>` | `<Alert>` | `<Layout>` |
|
|
121
|
+
| Chakra UI | `<Box as='header'>` | `<Alert>` | `<Flex direction='column'>` |
|
|
122
|
+
| Shadcn/ui | Custom header | `<Alert>` | Tailwind `flex flex-col h-screen` |
|
|
123
|
+
|
|
124
|
+
When implementing in a specific design system:
|
|
125
|
+
- WSS vs portal detection must remain — the nav bar component differs for each
|
|
126
|
+
- Logo URL must be loaded asynchronously from `PCore.getAssetLoader()`
|
|
127
|
+
- `NavContext.Provider` must wrap children so descendant nav-aware components can access links
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Template component skill: BannerPage
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: BannerPage
|
|
7
|
+
|
|
8
|
+
Page template that wraps the `Banner` DSE component, rendering a hero image section with a configurable two-column content area below.
|
|
9
|
+
|
|
10
|
+
> **Prerequisite skill:** [`template-components.md`](../template-components.md) — covers architecture, child rendering patterns, and registration conventions common to ALL template components.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Component Purpose
|
|
15
|
+
|
|
16
|
+
A thin template wrapper that delegates entirely to the `Banner` DSE component. Translates page-template props (heading, message, layout, backgroundImage) into `Banner`'s props and passes the first two React children as the `a` (left) and `b` (right) content slot.
|
|
17
|
+
|
|
18
|
+
## Pega Metadata
|
|
19
|
+
|
|
20
|
+
- **Registration key:** `BannerPage` (in `component-map.ts`)
|
|
21
|
+
- **Category:** Page template
|
|
22
|
+
- **Extends:** `PConnProps`
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Required | Description |
|
|
27
|
+
|------|------|----------|-------------|
|
|
28
|
+
| `children` | `ReactNode[]` | Yes | At least 2 children — `[0]` → left (`a`) slot, `[1]` → right (`b`) slot |
|
|
29
|
+
| `layout` | `string` | No | Column layout variant for `Banner`: `'two-column'` (default), `'narrow-wide'`, `'wide-narrow'` |
|
|
30
|
+
| `heading` | `string` | No | Hero section heading text. Default `''` |
|
|
31
|
+
| `message` | `string` | No | Hero section message/subtitle. Default `''` |
|
|
32
|
+
| `imageTheme` | `string` | No | Banner image theme (e.g., `'light'`). Default `'light'` |
|
|
33
|
+
| `backgroundImage` | `string` | No | URL of the background image for the hero. Default `''` |
|
|
34
|
+
| `backgroundColor` | `string` | No | Background color for the hero. Default `''` |
|
|
35
|
+
| `tintImage` | `boolean` | No | Whether to tint the background image. Default `false` |
|
|
36
|
+
|
|
37
|
+
## Behavioral Contract
|
|
38
|
+
|
|
39
|
+
1. Retrieve `Banner` from the component registry via `getComponentFromRegistry('Banner')`.
|
|
40
|
+
2. Convert `children` to an array using `Children.toArray(children)` (memoized).
|
|
41
|
+
3. Render `<Banner>` with the following props:
|
|
42
|
+
- `variant={layout}` — controls column widths below the hero
|
|
43
|
+
- `a={childArray[0]}` — left/first column content
|
|
44
|
+
- `b={childArray[1]}` — right/second column content
|
|
45
|
+
- `banner={{ variant: imageTheme, backgroundColor, title: heading, message, backgroundImage, tintImage }}`
|
|
46
|
+
4. No additional wrapper or layout — this component IS a single `<Banner>` render.
|
|
47
|
+
|
|
48
|
+
## Visual Specifications
|
|
49
|
+
|
|
50
|
+
This component has no independent visual output — all visual behavior is defined by the `Banner` DSE component. See [`design-system-extension-skills/Banner.md`](../design-system-extension-skills/Banner.md) for full visual specs.
|
|
51
|
+
|
|
52
|
+
Key visual behaviors inherited from `Banner`:
|
|
53
|
+
- Hero: full-width background image section, height `19rem`, centered title and message overlay
|
|
54
|
+
- Content area: two-column grid below the hero, column widths driven by `variant`/`layout`
|
|
55
|
+
|
|
56
|
+
**CSS-only implementation notes:**
|
|
57
|
+
- This template creates no CSS of its own — implement it as a pure pass-through to `Banner`.
|
|
58
|
+
- The `layout` prop maps directly to `Banner`'s `variant` prop.
|
|
59
|
+
- `heading` → `Banner.banner.title`, `message` → `Banner.banner.message`.
|
|
60
|
+
|
|
61
|
+
## Edge Cases & Special Logic
|
|
62
|
+
|
|
63
|
+
- Children are memoized: `useMemo(() => Children.toArray(children), [children])` — only recomputed when `children` changes.
|
|
64
|
+
- If only one child is provided, `childArray[1]` will be `undefined` — `Banner` receives `b={undefined}` and should render an empty second column.
|
|
65
|
+
- `BannerPage` does NOT call `getPConnect()` itself for layout — children are React children (passed by the Pega rendering engine).
|
|
66
|
+
|
|
67
|
+
## Dependencies
|
|
68
|
+
|
|
69
|
+
- `getComponentFromRegistry('Banner')` from `@pega/sdk-react` — all rendering delegated to `Banner`
|
|
70
|
+
- `Children.toArray` from React — for child array normalization
|
|
71
|
+
|
|
72
|
+
## Design System Mapping
|
|
73
|
+
|
|
74
|
+
**UI control type:** Full-width banner hero page with configurable two-column content area.
|
|
75
|
+
|
|
76
|
+
Listed design systems are examples only.
|
|
77
|
+
|
|
78
|
+
| Design System | Recommended Component |
|
|
79
|
+
|---|---|
|
|
80
|
+
| Default (CSS only) | Pass-through to `Banner` — implement Banner's CSS hero + grid layout |
|
|
81
|
+
| MUI | Pass-through to `Banner` (MUI-based) |
|
|
82
|
+
| Ant Design | Pass-through to `Banner` (Ant-based) |
|
|
83
|
+
| Chakra UI | Pass-through to `Banner` (Chakra-based) |
|
|
84
|
+
| Shadcn/ui | Pass-through to `Banner` (Shadcn-based) |
|
|
85
|
+
|
|
86
|
+
When implementing in a specific design system:
|
|
87
|
+
- `BannerPage` is always a thin wrapper — implement `Banner` first, then `BannerPage` simply delegates to it
|
|
88
|
+
- Prop mapping: `layout` → `variant`, `heading` → `banner.title`, `message` → `banner.message`, `backgroundImage` → `banner.backgroundImage`
|