@pega/sdk 0.0.1 → 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 -19
- package/package.json +4 -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 +3 -2
- package/templates/react-sdk-reference/pega-auth-0.2.42.tgz +0 -0
- 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/pega-sdk-types-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
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: agent
|
|
3
|
+
description: Generate all (or a subset of) template components using any design system
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Step 0 — Resolve inputs
|
|
7
|
+
|
|
8
|
+
Read the user's message carefully. Extract:
|
|
9
|
+
|
|
10
|
+
- **Design system** — the UI library to use (e.g. `Ant Design`, `Chakra UI`, `Carbon`, `Radix UI`)
|
|
11
|
+
- **Output base path** — the folder where template components should be generated (e.g. `src/components/template/`)
|
|
12
|
+
- **Component list** — which templates to generate (default: all 32 listed below)
|
|
13
|
+
|
|
14
|
+
Both **design system** and **output base path** are required. If either is missing or ambiguous, ask both unresolved items in one numbered list. Do not assume or default the output path — the client's folder structure may differ from the reference app.
|
|
15
|
+
|
|
16
|
+
Example questions (ask only the ones that are actually missing):
|
|
17
|
+
1. Which design system should I use? (e.g. Ant Design, Chakra UI, Carbon, Radix UI)
|
|
18
|
+
2. Where should the template components be generated? (e.g. `src/components/template/`)
|
|
19
|
+
|
|
20
|
+
> **Note:** The design system applies only to **layout templates** (TwoColumn, OneColumn, NarrowWide, WideNarrow, and their sub-variants). Form templates and page templates use the PConnect bridge pattern and are design-system agnostic — they will be generated without DS primitives regardless of your choice.
|
|
21
|
+
|
|
22
|
+
If the user specified a subset (e.g., "just TwoColumn and OneColumn"), restrict the list accordingly.
|
|
23
|
+
|
|
24
|
+
Once both are known, continue to Step 1.
|
|
25
|
+
|
|
26
|
+
### Full component list (default — 32 templates)
|
|
27
|
+
|
|
28
|
+
| Component | Category |
|
|
29
|
+
|---|---|
|
|
30
|
+
| AdvancedSearch | Page |
|
|
31
|
+
| AppShell | Page |
|
|
32
|
+
| BannerPage | Page |
|
|
33
|
+
| CaseSummary | Page |
|
|
34
|
+
| CaseView | Page |
|
|
35
|
+
| CaseViewActionsMenu | Widget |
|
|
36
|
+
| Confirmation | Page |
|
|
37
|
+
| DataReference | Form |
|
|
38
|
+
| DefaultForm | Form |
|
|
39
|
+
| DefaultPage | Page |
|
|
40
|
+
| Details | Layout |
|
|
41
|
+
| DetailsSubTabs | Layout |
|
|
42
|
+
| DetailsThreeColumn | Layout |
|
|
43
|
+
| DetailsTwoColumn | Layout |
|
|
44
|
+
| DynamicTabs | Navigation |
|
|
45
|
+
| FieldGroupTemplate | Form |
|
|
46
|
+
| HierarchicalForm | Form |
|
|
47
|
+
| InlineDashboard | Page |
|
|
48
|
+
| InlineDashboardPage | Page |
|
|
49
|
+
| ListPage | Page |
|
|
50
|
+
| ListView | Page |
|
|
51
|
+
| MultiReferenceReadOnly | Display |
|
|
52
|
+
| NarrowWide | Layout |
|
|
53
|
+
| OneColumn | Layout |
|
|
54
|
+
| PromotedFilters | Widget |
|
|
55
|
+
| SelfServiceCaseView | Page |
|
|
56
|
+
| SimpleTable | Table |
|
|
57
|
+
| SingleReferenceReadOnly | Display |
|
|
58
|
+
| SubTabs | Navigation |
|
|
59
|
+
| TwoColumn | Layout |
|
|
60
|
+
| WideNarrow | Layout |
|
|
61
|
+
| WssNavBar | Navigation |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Step 1 — Read `template-components.md` (once, for the entire session)
|
|
66
|
+
|
|
67
|
+
Read the full contents of `.github/skills/template-components.md`.
|
|
68
|
+
|
|
69
|
+
This gives you:
|
|
70
|
+
- **Layout template pattern** — DS-agnostic grid skeleton with `// [DS GRID]` placeholder; `templateCol` parsing logic; responsive behavior rules
|
|
71
|
+
- **Design System Adaptation section** — how to map the chosen DS's grid/flex primitive to the computed column ratios
|
|
72
|
+
- **Form template pattern** — PConnect bridge via `createElement(createPConnectComponent(), ...)` and `connectToState`; no DS involved
|
|
73
|
+
- **Page template pattern** — region extraction via `getRawMetadata()` and PConnect bridge; no DS involved
|
|
74
|
+
- Registration conventions and helper utilities
|
|
75
|
+
|
|
76
|
+
Keep this context active throughout the entire generation session. Do not re-read it per component.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Step 2 — Install and discover the design system (once)
|
|
81
|
+
|
|
82
|
+
Execute **Step 3** from `.github/prompts/add-component.prompt.md` exactly as written:
|
|
83
|
+
- Check `package.json` for the DS package
|
|
84
|
+
- Install if missing, including any peer dependencies
|
|
85
|
+
- Report what was installed
|
|
86
|
+
|
|
87
|
+
Then execute **Step 4** from `.github/prompts/add-component.prompt.md` exactly as written:
|
|
88
|
+
- Read the DS README from `node_modules`
|
|
89
|
+
- Discover exported layout components (Grid, Columns, Flex, SimpleGrid, etc.) from `dist/index.d.ts`
|
|
90
|
+
- Read prop interfaces for the grid/layout components needed by layout templates
|
|
91
|
+
- Note responsive breakpoint APIs and column sizing conventions
|
|
92
|
+
|
|
93
|
+
> You only need layout-related DS components. Form and page templates do not use the DS.
|
|
94
|
+
|
|
95
|
+
Build a **DS layout API reference** from this discovery. Reuse it for every layout template — do not repeat these commands per component.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Step 3 — Overwrite check (all at once)
|
|
100
|
+
|
|
101
|
+
For each component in the list, check whether `<outputPath>/<ComponentName>/<ComponentName>.tsx` already exists.
|
|
102
|
+
|
|
103
|
+
If **any** exist, report them all at once and ask:
|
|
104
|
+
> "The following N components already exist: [list]. How should I proceed?
|
|
105
|
+
> - **Overwrite all** — replace all existing implementations
|
|
106
|
+
> - **Skip existing** — only generate components that don't exist yet
|
|
107
|
+
> - **Cancel** — stop without generating anything"
|
|
108
|
+
|
|
109
|
+
Wait for the user's answer before proceeding. If none exist, continue immediately.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Step 4 — Generate each component (loop)
|
|
114
|
+
|
|
115
|
+
For each component in the resolved list (in the order listed in Step 0):
|
|
116
|
+
|
|
117
|
+
### 4a — Read the component-specific skill file
|
|
118
|
+
Execute **Step 2** from `.github/prompts/add-component.prompt.md` for this component:
|
|
119
|
+
- Read `.github/skills/template-skills/<ComponentName>.md` fully
|
|
120
|
+
- Identify the template category from the skill file:
|
|
121
|
+
- **Layout** — uses DS grid primitives from Step 2's API reference
|
|
122
|
+
- **Form** — uses PConnect bridge + CSS classes; ignore DS
|
|
123
|
+
- **Page** — uses region extraction + PConnect bridge; ignore DS
|
|
124
|
+
- Pay attention to Behavioral Contract, sub-variants, and any Design System Mapping table
|
|
125
|
+
|
|
126
|
+
### 4b — Generate the component files
|
|
127
|
+
Execute **Step 5** from `.github/prompts/add-component.prompt.md` for this component:
|
|
128
|
+
- Create `<outputPath>/<ComponentName>/` directory
|
|
129
|
+
- Create `<ComponentName>.tsx` using:
|
|
130
|
+
- **Layout templates**: DS-agnostic skeleton from `template-components.md` with the `// [DS GRID]` section filled in using DS layout API confirmed in Step 2
|
|
131
|
+
- **Form/Page templates**: PConnect bridge pattern from `template-components.md`; no DS primitives
|
|
132
|
+
- Behavioral Contract from the component skill file
|
|
133
|
+
- Create `index.tsx` if required by the skill file:
|
|
134
|
+
```typescript
|
|
135
|
+
export { default } from './<ComponentName>';
|
|
136
|
+
```
|
|
137
|
+
- Create any CSS file required by the skill file (e.g., `DefaultForm.css` with grid classes)
|
|
138
|
+
|
|
139
|
+
### 4c — Register the component
|
|
140
|
+
Execute **Step 6** from `.github/prompts/add-component.prompt.md` for this component:
|
|
141
|
+
- Add the import to `src/components/component-map.ts` in the Templates section
|
|
142
|
+
- Add the entry to `getSampleComponentMap()` under the templates comment
|
|
143
|
+
- For sub-variants (e.g., TwoColumnPage, TwoColumnTab), register each key separately pointing to its own file or a shared implementation as specified in the skill file
|
|
144
|
+
- Do not reorder or restructure any existing entries
|
|
145
|
+
|
|
146
|
+
### 4d — Report progress
|
|
147
|
+
After each component: "`<ComponentName>` ✓ — `<Layout | Form | Page>` template`<, using <DS component name> for grid>` if layout"
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Step 5 — Verify the build
|
|
152
|
+
|
|
153
|
+
Execute **Step 7** from `.github/prompts/add-component.prompt.md` exactly as written:
|
|
154
|
+
- Run `npm run build`
|
|
155
|
+
- Fix any TypeScript or build errors before reporting completion
|
|
156
|
+
- Report a summary: list of all files created and all entries added to `component-map.ts`
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: agent
|
|
3
|
+
description: Generate all (or a subset of) widget components using any design system
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Step 0 — Resolve inputs
|
|
7
|
+
|
|
8
|
+
Read the user's message carefully. Extract:
|
|
9
|
+
|
|
10
|
+
- **Design system** — the UI library to use (e.g. `Ant Design`, `Chakra UI`, `Carbon`, `Radix UI`)
|
|
11
|
+
- **Output base path** — the folder where widget components should be generated (e.g. `src/components/widget/`)
|
|
12
|
+
- **Component list** — which widgets to generate (default: all 9 listed below)
|
|
13
|
+
|
|
14
|
+
Both **design system** and **output base path** are required. If either is missing or ambiguous, ask both unresolved items in one numbered list. Do not assume or default the output path — the client's folder structure may differ from the reference app.
|
|
15
|
+
|
|
16
|
+
Example questions (ask only the ones that are actually missing):
|
|
17
|
+
1. Which design system should I use? (e.g. Ant Design, Chakra UI, Carbon, Radix UI)
|
|
18
|
+
2. Where should the widget components be generated? (e.g. `src/components/widget/`)
|
|
19
|
+
|
|
20
|
+
If the user specified a subset (e.g., "just ToDo and Attachment"), restrict the list accordingly.
|
|
21
|
+
|
|
22
|
+
Once both are known, continue to Step 1.
|
|
23
|
+
|
|
24
|
+
### Full component list (default — 9 widgets)
|
|
25
|
+
|
|
26
|
+
| Component | Description |
|
|
27
|
+
|---|---|
|
|
28
|
+
| AppAnnouncement | System-wide announcements |
|
|
29
|
+
| Attachment | File upload/download |
|
|
30
|
+
| CaseHistory | Case audit trail |
|
|
31
|
+
| FileUtility | File management utility |
|
|
32
|
+
| Followers | Case followers list |
|
|
33
|
+
| QuickCreate | Quick case creation buttons |
|
|
34
|
+
| SummaryItem | Single summary card |
|
|
35
|
+
| SummaryList | List of summary cards |
|
|
36
|
+
| ToDo | Assignment worklist |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Step 1 — Read `widget-components.md` (once, for the entire session)
|
|
41
|
+
|
|
42
|
+
Read the full contents of `.github/skills/widget-components.md`.
|
|
43
|
+
|
|
44
|
+
This gives you:
|
|
45
|
+
- The DS-agnostic data-fetching skeleton with `// [DS RENDER]` placeholder
|
|
46
|
+
- The Design System Adaptation guide (primitive mapping table, icon discovery rules)
|
|
47
|
+
- All common Pega APIs used in widgets: `PCore.getDataPageUtils()`, `PCore.getMashupApi()`, `PCore.getAttachmentUtils()`, `pConn.getCaseInfo()`, etc.
|
|
48
|
+
- Registration conventions
|
|
49
|
+
|
|
50
|
+
> The PCore data-fetching logic is always identical regardless of design system. Only the `// [DS RENDER]` section changes per DS.
|
|
51
|
+
|
|
52
|
+
Keep this context active throughout the entire generation session. Do not re-read it per component.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Step 2 — Install and discover the design system (once)
|
|
57
|
+
|
|
58
|
+
Execute **Step 3** from `.github/prompts/add-component.prompt.md` exactly as written:
|
|
59
|
+
- Check `package.json` for the DS package
|
|
60
|
+
- Install if missing, including any peer dependencies
|
|
61
|
+
- Report what was installed
|
|
62
|
+
|
|
63
|
+
Then execute **Step 4** from `.github/prompts/add-component.prompt.md` exactly as written:
|
|
64
|
+
- Read the DS README from `node_modules`
|
|
65
|
+
- Discover exported components from `dist/index.d.ts`
|
|
66
|
+
- Focus on presentation primitives used in widgets: Card, List, Table, Button, Badge, Spinner, Skeleton, Empty state
|
|
67
|
+
- Read prop interfaces for these components from `.d.ts` files
|
|
68
|
+
- If the DS has a companion icon package, discover its exports
|
|
69
|
+
|
|
70
|
+
Build a **DS UI primitive reference map** from this discovery. Reuse it for every widget — do not repeat these commands per component.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Step 3 — Overwrite check (all at once)
|
|
75
|
+
|
|
76
|
+
For each component in the list, check whether `<outputPath>/<ComponentName>/<ComponentName>.tsx` already exists.
|
|
77
|
+
|
|
78
|
+
If **any** exist, report them all at once and ask:
|
|
79
|
+
> "The following N components already exist: [list]. How should I proceed?
|
|
80
|
+
> - **Overwrite all** — replace all existing implementations
|
|
81
|
+
> - **Skip existing** — only generate components that don't exist yet
|
|
82
|
+
> - **Cancel** — stop without generating anything"
|
|
83
|
+
|
|
84
|
+
Wait for the user's answer before proceeding. If none exist, continue immediately.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Step 4 — Generate each component (loop)
|
|
89
|
+
|
|
90
|
+
For each component in the resolved list (in the order listed in Step 0):
|
|
91
|
+
|
|
92
|
+
### 4a — Read the component-specific skill file
|
|
93
|
+
Execute **Step 2** from `.github/prompts/add-component.prompt.md` for this component:
|
|
94
|
+
- Read `.github/skills/widget-skills/<ComponentName>.md` fully if it exists
|
|
95
|
+
- Pay attention to:
|
|
96
|
+
- **Behavioral Contract** — data fetching logic, PCore API calls, state management, action handlers
|
|
97
|
+
- **Design System Mapping** table — the recommended DS component for presentation
|
|
98
|
+
- If no skill file exists (e.g., `SummaryList`), use the general data-fetching pattern from `widget-components.md`
|
|
99
|
+
|
|
100
|
+
### 4b — Generate the component files
|
|
101
|
+
Execute **Step 5** from `.github/prompts/add-component.prompt.md` for this component:
|
|
102
|
+
- Create `<outputPath>/<ComponentName>/` directory
|
|
103
|
+
- Create `<ComponentName>.tsx` using:
|
|
104
|
+
- The DS-agnostic data-fetching skeleton from `widget-components.md` (read in Step 1)
|
|
105
|
+
- The Behavioral Contract from the component skill file (PCore API calls, state, actions)
|
|
106
|
+
- The DS UI primitives confirmed in Step 2 (from the DS primitive reference map — no new terminal commands needed) filling in the `// [DS RENDER]` section
|
|
107
|
+
- Create `index.tsx` if required by the skill file:
|
|
108
|
+
```typescript
|
|
109
|
+
export { default } from './<ComponentName>';
|
|
110
|
+
```
|
|
111
|
+
- Create any CSS or utility files required by the skill file
|
|
112
|
+
|
|
113
|
+
### 4c — Register the component
|
|
114
|
+
Execute **Step 6** from `.github/prompts/add-component.prompt.md` for this component:
|
|
115
|
+
- Add the import to `src/components/component-map.ts` in the Widgets section
|
|
116
|
+
- Add the entry to `getSampleComponentMap()` under the widgets comment
|
|
117
|
+
- Do not reorder or restructure any existing entries
|
|
118
|
+
|
|
119
|
+
### 4d — Report progress
|
|
120
|
+
After each component: "`<ComponentName>` ✓ — using `<DS card/list primitive>`"
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Step 5 — Verify the build
|
|
125
|
+
|
|
126
|
+
Execute **Step 7** from `.github/prompts/add-component.prompt.md` exactly as written:
|
|
127
|
+
- Run `npm run build`
|
|
128
|
+
- Fix any TypeScript or build errors before reporting completion
|
|
129
|
+
- Report a summary: list of all files created and all entries added to `component-map.ts`
|
|
@@ -61,9 +61,12 @@ interface RichTextEditorProps extends PConnFieldProps {
|
|
|
61
61
|
|
|
62
62
|
Used for: AlertBanner, Banner, Operator
|
|
63
63
|
|
|
64
|
+
This pattern is design-system agnostic. The variant-mapping logic and message normalisation are always the same. The `// [DS RENDER]` section must be replaced with your design system's alert/notification primitive — see "Design System Adaptation" below.
|
|
65
|
+
|
|
64
66
|
```typescript
|
|
65
|
-
|
|
66
|
-
import
|
|
67
|
+
// Import your design system alert/notification component:
|
|
68
|
+
// e.g. import { Alert } from 'antd';
|
|
69
|
+
// e.g. import { Alert } from '@chakra-ui/react';
|
|
67
70
|
|
|
68
71
|
interface AlertBannerProps {
|
|
69
72
|
variant: 'urgent' | 'warning' | 'info' | 'success';
|
|
@@ -75,26 +78,31 @@ interface AlertBannerProps {
|
|
|
75
78
|
export default function AlertBanner(props: AlertBannerProps) {
|
|
76
79
|
const { variant, heading, messages = [], onClose } = props;
|
|
77
80
|
|
|
78
|
-
// Map Pega variant names to
|
|
79
|
-
|
|
81
|
+
// Map Pega variant names to your DS equivalent
|
|
82
|
+
// e.g. MUI: urgent → 'error' | Ant Design: urgent → 'error' | Chakra: urgent → 'error'
|
|
83
|
+
const variantMap: Record<string, string> = {
|
|
80
84
|
urgent: 'error',
|
|
81
85
|
warning: 'warning',
|
|
82
86
|
info: 'info',
|
|
83
87
|
success: 'success'
|
|
84
88
|
};
|
|
85
89
|
|
|
90
|
+
// Normalise messages — Pega may send a plain string or an object
|
|
86
91
|
function renderMessage(msg: string | { label?: string; description?: string }) {
|
|
87
92
|
if (typeof msg === 'string') return msg;
|
|
88
93
|
return `${msg.label ?? ''} ${msg.description ?? ''}`.trim();
|
|
89
94
|
}
|
|
90
95
|
|
|
96
|
+
// [DS RENDER] — replace with your design system's alert/notification primitive
|
|
97
|
+
// The variantMap value above should be passed as the DS severity/type/status prop
|
|
91
98
|
return (
|
|
92
|
-
<
|
|
93
|
-
{
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
<YourDesignSystemAlert
|
|
100
|
+
type={variantMap[variant] ?? 'info'}
|
|
101
|
+
message={heading}
|
|
102
|
+
description={messages.map(renderMessage).join(' ')}
|
|
103
|
+
closable={!!onClose}
|
|
104
|
+
onClose={onClose}
|
|
105
|
+
/>
|
|
98
106
|
);
|
|
99
107
|
}
|
|
100
108
|
```
|
|
@@ -167,9 +175,9 @@ export default function FieldGroup(props: FieldGroupProps) {
|
|
|
167
175
|
|
|
168
176
|
## Styling Patterns
|
|
169
177
|
|
|
170
|
-
DSE components use
|
|
178
|
+
DSE components use one of three approaches depending on the component and design system:
|
|
171
179
|
|
|
172
|
-
### CSS File Pattern
|
|
180
|
+
### CSS File Pattern (DS-agnostic, preferred for Field Value components)
|
|
173
181
|
|
|
174
182
|
```css
|
|
175
183
|
/* FieldValueList.css */
|
|
@@ -190,15 +198,47 @@ DSE components use either CSS files or MUI's `sx` prop:
|
|
|
190
198
|
}
|
|
191
199
|
```
|
|
192
200
|
|
|
193
|
-
###
|
|
201
|
+
### Design System Style Props (use if your DS provides them)
|
|
194
202
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
203
|
+
If the chosen design system provides built-in spacing, typography, or layout props, prefer them over plain CSS:
|
|
204
|
+
- Use the DS's layout wrapper (e.g., `<Stack>`, `<Flex>`, `<HStack>`) instead of manual flex CSS
|
|
205
|
+
- Use DS typography components (e.g., `<Text>`, `<Heading>`) instead of raw `<span>`/`<div>`
|
|
206
|
+
- Use DS CSS custom properties or tokens for spacing — never hardcode `px` values
|
|
207
|
+
- Discover which style props are available from the installed `.d.ts` files before using them
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Design System Adaptation
|
|
212
|
+
|
|
213
|
+
DSE components fall into three patterns with different DS dependencies:
|
|
214
|
+
|
|
215
|
+
| Pattern | Examples | DS needed? |
|
|
216
|
+
|---|---|---|
|
|
217
|
+
| **B — Pure display** (no PConnect) | AlertBanner, Banner, Operator, WssQuickCreate | Yes — DS provides alert/card/avatar primitives |
|
|
218
|
+
| **A — PConnect display** | CaseSummaryFields, DetailsFields, FieldValueList | Minimal — CSS-based layout; DS typography optional |
|
|
219
|
+
| **C — Complex display** (PConnect bridge) | FieldGroup, FieldGroupList, Pulse | No — PConnect bridge is DS-agnostic; semantic HTML |
|
|
220
|
+
|
|
221
|
+
The component-specific skill file specifies which pattern applies.
|
|
222
|
+
|
|
223
|
+
**1. Check the component-specific skill file** — `.github/skills/design-system-extension-skills/<ComponentName>.md` contains a **Design System Mapping** table where available.
|
|
224
|
+
|
|
225
|
+
**2. If the chosen design system is not listed** — use the component purpose and pattern category above to pick the closest DS primitive.
|
|
226
|
+
|
|
227
|
+
**3. Discover the API from installed packages** — confirm component names and props from `.d.ts` before writing JSX:
|
|
228
|
+
```bash
|
|
229
|
+
find node_modules/<ds-package> -name "*.d.ts" | xargs grep -l "Alert\|Badge\|Avatar" | head -5
|
|
230
|
+
grep -A 30 "interface.*Props" <path-to-file>
|
|
200
231
|
```
|
|
201
232
|
|
|
233
|
+
**4. Variant mapping** — always map Pega's variant names to your DS equivalent before passing to DS components:
|
|
234
|
+
|
|
235
|
+
| Pega variant | Meaning | Typical DS equivalent |
|
|
236
|
+
|---|---|---|
|
|
237
|
+
| `urgent` | Critical / error | `error`, `danger`, `critical` |
|
|
238
|
+
| `warning` | Warning | `warning` |
|
|
239
|
+
| `info` | Informational | `info` |
|
|
240
|
+
| `success` | Success | `success` |
|
|
241
|
+
|
|
202
242
|
---
|
|
203
243
|
|
|
204
244
|
## Registration
|
|
@@ -59,18 +59,22 @@ interface MyFieldProps extends PConnFieldProps {
|
|
|
59
59
|
|
|
60
60
|
## Implementation Pattern
|
|
61
61
|
|
|
62
|
-
###
|
|
62
|
+
### Abstract Field Component Template
|
|
63
|
+
|
|
64
|
+
This template is design-system agnostic. It defines the **behavioral skeleton** every field component must follow. Replace the `// [DS RENDER]` section with your design system's input primitive — see the "Design System Adaptation" section below for guidance.
|
|
63
65
|
|
|
64
66
|
```typescript
|
|
65
67
|
import { useState, useEffect } from 'react';
|
|
66
|
-
|
|
68
|
+
// Import your design system component here:
|
|
69
|
+
// e.g. import { Input } from 'antd';
|
|
70
|
+
// e.g. import { Input } from '@chakra-ui/react';
|
|
67
71
|
|
|
68
72
|
import handleEvent from '../../helpers/event-utils';
|
|
69
73
|
import { getComponentFromRegistry } from '@pega/sdk-react';
|
|
70
|
-
import type { PConnFieldProps } from '
|
|
74
|
+
import type { PConnFieldProps } from '@pega/sdk-react';
|
|
71
75
|
|
|
72
76
|
interface MyFieldProps extends PConnFieldProps {
|
|
73
|
-
//
|
|
77
|
+
// Add component-specific props here
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
export default function MyField(props: MyFieldProps) {
|
|
@@ -97,13 +101,15 @@ export default function MyField(props: MyFieldProps) {
|
|
|
97
101
|
const propName = (pConn.getStateProps() as any).value;
|
|
98
102
|
const helperTextToDisplay = validatemessage || helperText;
|
|
99
103
|
|
|
104
|
+
// 1. Track input value locally — do NOT commit on every keystroke
|
|
100
105
|
const [inputValue, setInputValue] = useState(value);
|
|
101
106
|
|
|
107
|
+
// 2. Sync local state when the store value changes
|
|
102
108
|
useEffect(() => {
|
|
103
109
|
setInputValue(value);
|
|
104
110
|
}, [value]);
|
|
105
111
|
|
|
106
|
-
//
|
|
112
|
+
// 3. Display modes — must short-circuit before any interactive rendering
|
|
107
113
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
108
114
|
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
109
115
|
}
|
|
@@ -112,33 +118,30 @@ export default function MyField(props: MyFieldProps) {
|
|
|
112
118
|
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
113
119
|
}
|
|
114
120
|
|
|
115
|
-
//
|
|
116
|
-
function handleChange(
|
|
117
|
-
setInputValue(
|
|
121
|
+
// 4. Event handlers
|
|
122
|
+
function handleChange(newValue: string) {
|
|
123
|
+
setInputValue(newValue); // update local state only
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
function handleBlur() {
|
|
121
|
-
handleEvent(actions, 'changeNblur', propName, inputValue);
|
|
127
|
+
handleEvent(actions, 'changeNblur', propName, inputValue); // commit to Pega store
|
|
122
128
|
}
|
|
123
129
|
|
|
124
|
-
//
|
|
130
|
+
// 5. [DS RENDER] — replace with your design system's input primitive
|
|
131
|
+
// Refer to "Design System Adaptation" below for prop mapping guidance
|
|
125
132
|
return (
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
variant={readOnly ? 'standard' : 'outlined'}
|
|
129
|
-
helperText={helperTextToDisplay}
|
|
130
|
-
placeholder={placeholder ?? ''}
|
|
131
|
-
size='small'
|
|
132
|
-
required={required}
|
|
133
|
-
disabled={disabled}
|
|
133
|
+
<YourDesignSystemInput
|
|
134
|
+
value={inputValue}
|
|
134
135
|
onChange={handleChange}
|
|
135
136
|
onBlur={!readOnly ? handleBlur : undefined}
|
|
136
|
-
|
|
137
|
+
disabled={disabled}
|
|
138
|
+
readOnly={readOnly}
|
|
139
|
+
required={required}
|
|
140
|
+
placeholder={placeholder}
|
|
137
141
|
label={label}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}}
|
|
142
|
+
helperText={helperTextToDisplay}
|
|
143
|
+
isInvalid={status === 'error'}
|
|
144
|
+
data-test-id={testId}
|
|
142
145
|
/>
|
|
143
146
|
);
|
|
144
147
|
}
|
|
@@ -146,6 +149,35 @@ export default function MyField(props: MyFieldProps) {
|
|
|
146
149
|
|
|
147
150
|
---
|
|
148
151
|
|
|
152
|
+
## Design System Adaptation
|
|
153
|
+
|
|
154
|
+
When filling in the `// [DS RENDER]` section with a specific design system:
|
|
155
|
+
|
|
156
|
+
**1. Check the component-specific skill file** — `.github/skills/field-skills/<ComponentName>.md` contains a **Design System Mapping** table that lists the recommended DS component for common design systems. Use it as a starting point.
|
|
157
|
+
|
|
158
|
+
**2. If the chosen design system is not in the mapping table** — use the **UI control type** field in the same skill file (e.g., `"Combobox / typeahead autocomplete input"`) to identify the closest DS primitive.
|
|
159
|
+
|
|
160
|
+
**3. Discover the API from installed packages** — before writing any render JSX, confirm all prop names from `.d.ts` files. Never rely on training-knowledge of a DS API:
|
|
161
|
+
```bash
|
|
162
|
+
find node_modules/<ds-package> -name "ComponentName.d.ts" | head -3
|
|
163
|
+
grep -A 40 "interface.*Props" <path-to-file>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**4. Prop mapping conventions** — adapt these Pega/SDK props to whatever your DS component calls them:
|
|
167
|
+
|
|
168
|
+
| Pega/SDK prop | Meaning | Typical DS equivalent |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| `status === 'error'` | Validation error state | `error`, `status="error"`, `invalid`, `isInvalid` |
|
|
171
|
+
| `validatemessage \|\| helperText` | Helper/error text below field | `helperText`, `description`, `hint`, `extra` |
|
|
172
|
+
| `readOnly` | Non-editable, still visible | `readOnly`, `isReadOnly`, `variant="borderless"` |
|
|
173
|
+
| `testId` | Automation selector | `data-test-id` on the underlying `<input>` element |
|
|
174
|
+
| `required` | Required field marker | `required`, `isRequired` |
|
|
175
|
+
| `hideLabel` | Suppress label display | Pass empty string `''` as label |
|
|
176
|
+
|
|
177
|
+
**5. Use a form layout wrapper** — if the DS provides a wrapper that combines label + input + helper text (e.g., `<Form.Item>` in Ant Design, `<FormControl>` in Chakra UI), use it rather than composing them manually.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
149
181
|
## Event Handling
|
|
150
182
|
|
|
151
183
|
Use `src/components/helpers/event-utils.ts` to commit values to the Pega store:
|
|
@@ -48,35 +48,72 @@ Templates typically receive children through `getPConnect().getChildren()` rathe
|
|
|
48
48
|
|
|
49
49
|
Used for: TwoColumn, OneColumn, NarrowWide, WideNarrow
|
|
50
50
|
|
|
51
|
+
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.
|
|
52
|
+
|
|
51
53
|
```typescript
|
|
52
54
|
import type { PropsWithChildren, ReactElement } from 'react';
|
|
53
|
-
|
|
54
|
-
import
|
|
55
|
+
// Import your design system layout primitive here:
|
|
56
|
+
// e.g. import { Grid } from 'antd';
|
|
57
|
+
// e.g. import { SimpleGrid } from '@chakra-ui/react';
|
|
58
|
+
import type { PConnProps } from '@pega/sdk-react';
|
|
55
59
|
|
|
56
60
|
interface TwoColumnProps extends PConnProps {
|
|
57
|
-
templateCol?: string;
|
|
61
|
+
templateCol?: string; // e.g. '1fr 1fr', '2fr 1fr'
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
export default function TwoColumn(props: PropsWithChildren<TwoColumnProps>) {
|
|
61
65
|
const { children, templateCol = '1fr 1fr' } = props;
|
|
62
66
|
const childrenToRender = children as ReactElement[];
|
|
63
67
|
|
|
64
|
-
// Parse templateCol
|
|
68
|
+
// Parse templateCol into column width ratios
|
|
69
|
+
// Strip unit suffixes, split on whitespace, convert to numbers
|
|
65
70
|
const colArray = templateCol.replaceAll(/[a-z]+/g, '').split(/\s/).map(Number);
|
|
66
71
|
const totalCols = colArray.reduce((v, itm) => itm + v, 0);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const bSize = (ratio * colArray[1]) as GridSize;
|
|
72
|
+
// colArray[0] / totalCols = left column fraction
|
|
73
|
+
// colArray[1] / totalCols = right column fraction
|
|
70
74
|
|
|
75
|
+
// [DS GRID] — render two children in a responsive grid using the computed ratios
|
|
76
|
+
// On mobile (narrow viewport): both columns should stack to full width
|
|
77
|
+
// On desktop: apply the computed left/right ratio
|
|
71
78
|
return (
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
<YourDesignSystemGrid>
|
|
80
|
+
<YourDesignSystemColumn ratio={colArray[0] / totalCols}>
|
|
81
|
+
{childrenToRender[0]}
|
|
82
|
+
</YourDesignSystemColumn>
|
|
83
|
+
<YourDesignSystemColumn ratio={colArray[1] / totalCols}>
|
|
84
|
+
{childrenToRender[1]}
|
|
85
|
+
</YourDesignSystemColumn>
|
|
86
|
+
</YourDesignSystemGrid>
|
|
76
87
|
);
|
|
77
88
|
}
|
|
78
89
|
```
|
|
79
90
|
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Design System Adaptation (Layout Templates Only)
|
|
94
|
+
|
|
95
|
+
> 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.
|
|
96
|
+
|
|
97
|
+
**1. Check the component-specific skill file** — `.github/skills/template-skills/<ComponentName>.md` contains a **Design System Mapping** table where available. Use it as a starting point.
|
|
98
|
+
|
|
99
|
+
**2. If the chosen design system is not listed** — use the **component purpose** description to identify the appropriate DS layout primitive (grid, flex, columns).
|
|
100
|
+
|
|
101
|
+
**3. Discover the API from installed packages** — confirm layout component names and props from `.d.ts` before writing JSX:
|
|
102
|
+
```bash
|
|
103
|
+
find node_modules/<ds-package> -name "*.d.ts" | xargs grep -l "Grid\|Columns\|Flex" | head -5
|
|
104
|
+
grep -A 30 "interface.*Props" <path-to-file>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**4. Column ratio mapping** — the `templateCol` prop (e.g., `'2fr 1fr'`) gives you fractional widths. Map to your DS's column system:
|
|
108
|
+
|
|
109
|
+
| `templateCol` | Fraction | MUI 12-col | CSS `grid-template-columns` |
|
|
110
|
+
|---|---|---|---|
|
|
111
|
+
| `'1fr 1fr'` | 50% / 50% | 6 / 6 | `1fr 1fr` |
|
|
112
|
+
| `'2fr 1fr'` | 67% / 33% | 8 / 4 | `2fr 1fr` |
|
|
113
|
+
| `'1fr 2fr'` | 33% / 67% | 4 / 8 | `1fr 2fr` |
|
|
114
|
+
|
|
115
|
+
**5. Responsive behavior** — on mobile, both columns must stack to full width. Use your DS's responsive breakpoint props or a CSS media query.
|
|
116
|
+
|
|
80
117
|
### Form Template (renders children via PConnect bridge)
|
|
81
118
|
|
|
82
119
|
Used for: DefaultForm, HierarchicalForm
|