@pega/sdk 0.0.5 → 0.0.7
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/README.md +10 -3
- package/dist/index.js +828 -165
- package/package.json +1 -1
- package/templates/react-native-sdk-reference/.claude/settings.json +5 -0
- package/templates/react-native-sdk-reference/.prettierignore +17 -0
- package/templates/react-native-sdk-reference/.vscode/extensions.json +1 -0
- package/templates/react-native-sdk-reference/.vscode/settings.json +7 -0
- package/templates/react-native-sdk-reference/AGENTS.md +3 -0
- package/templates/react-native-sdk-reference/CLAUDE.md +1 -0
- package/templates/react-native-sdk-reference/README.md +56 -0
- package/templates/react-native-sdk-reference/app.json +40 -5
- package/templates/react-native-sdk-reference/assets/expo.icon/Assets/expo-symbol 2.svg +3 -0
- package/templates/react-native-sdk-reference/assets/expo.icon/Assets/grid.png +0 -0
- package/templates/react-native-sdk-reference/assets/expo.icon/icon.json +35 -0
- package/templates/react-native-sdk-reference/assets/icons/bell.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/clock.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/cross.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/donut.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/gear.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/globe.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/internet.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/music.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/right-arrow.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/speed.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/MediaCo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/adaptive-icon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/android-icon-background.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/android-icon-foreground.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/android-icon-monochrome.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/expo-badge-white.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/expo-badge.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/expo-logo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/favicon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/icon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/logo-glow.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/partial-react-logo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/react-logo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/react-logo@2x.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/react-logo@3x.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/splash-icon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/tutorial-web.png +0 -0
- package/templates/react-native-sdk-reference/eslint.config.mjs +68 -0
- package/templates/react-native-sdk-reference/package.json +59 -14
- package/templates/react-native-sdk-reference/pega-constellationjs-0.26.3.tgz +0 -0
- package/templates/react-native-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
- package/templates/react-native-sdk-reference/pega-sdk-types-0.1.0.tgz +0 -0
- package/templates/react-native-sdk-reference/sdk-config.json +31 -9
- package/templates/react-native-sdk-reference/src/app/_layout.tsx +38 -0
- package/templates/react-native-sdk-reference/src/app/home/_layout.tsx +39 -0
- package/templates/react-native-sdk-reference/src/app/home/contact.tsx +11 -0
- package/templates/react-native-sdk-reference/src/app/home/index.tsx +36 -0
- package/templates/react-native-sdk-reference/src/app/home/shop.tsx +11 -0
- package/templates/react-native-sdk-reference/src/app/home/your-services.tsx +11 -0
- package/templates/react-native-sdk-reference/src/app/index.tsx +72 -0
- package/templates/react-native-sdk-reference/src/app/workarea.tsx +135 -0
- package/templates/react-native-sdk-reference/src/bridge/Context/StoreContext.ts +4 -0
- package/templates/react-native-sdk-reference/src/bridge/RootComponent.tsx +12 -0
- package/templates/react-native-sdk-reference/src/bridge/react_pconnect.jsx +334 -0
- package/templates/react-native-sdk-reference/src/components/common/DisplayField.tsx +29 -0
- package/templates/react-native-sdk-reference/src/components/common/FormFieldWrapper.tsx +5 -0
- package/templates/react-native-sdk-reference/src/components/common/HelperText.tsx +11 -0
- package/templates/react-native-sdk-reference/src/components/common/LabelText.tsx +22 -0
- package/templates/react-native-sdk-reference/src/components/common/inputTheme.ts +17 -0
- package/templates/react-native-sdk-reference/src/components/design-system/AutoComplete.tsx +126 -0
- package/templates/react-native-sdk-reference/src/components/design-system/FieldGroup.tsx +72 -0
- package/templates/react-native-sdk-reference/src/components/design-system/Radio.tsx +61 -0
- package/templates/react-native-sdk-reference/src/components/field/AutoComplete/AutoComplete.tsx +196 -0
- package/templates/react-native-sdk-reference/src/components/field/AutoComplete/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Checkbox/Checkbox.tsx +89 -0
- package/templates/react-native-sdk-reference/src/components/field/Checkbox/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Currency/Currency.tsx +84 -0
- package/templates/react-native-sdk-reference/src/components/field/Currency/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Date/Date.tsx +94 -0
- package/templates/react-native-sdk-reference/src/components/field/Date/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Dropdown/Dropdown.tsx +211 -0
- package/templates/react-native-sdk-reference/src/components/field/Dropdown/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Email/Email.tsx +81 -0
- package/templates/react-native-sdk-reference/src/components/field/Email/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Group/Group.tsx +47 -0
- package/templates/react-native-sdk-reference/src/components/field/Group/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Integer/Integer.tsx +84 -0
- package/templates/react-native-sdk-reference/src/components/field/Integer/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Phone/Phone.tsx +85 -0
- package/templates/react-native-sdk-reference/src/components/field/Phone/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/field/RadioButtons/RadioButtons.tsx +118 -0
- package/templates/react-native-sdk-reference/src/components/field/RadioButtons/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/field/TextArea/TextArea.tsx +86 -0
- package/templates/react-native-sdk-reference/src/components/field/TextArea/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/TextInput/TextInput.tsx +84 -0
- package/templates/react-native-sdk-reference/src/components/field/TextInput/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/URL/URL.tsx +86 -0
- package/templates/react-native-sdk-reference/src/components/field/URL/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/helpers/data_page.ts +20 -0
- package/templates/react-native-sdk-reference/src/components/helpers/event-utils.ts +20 -0
- package/templates/react-native-sdk-reference/src/components/helpers/instructions-utils.ts +57 -0
- package/templates/react-native-sdk-reference/src/components/helpers/state-utils.tsx +46 -0
- package/templates/react-native-sdk-reference/src/components/helpers/template-utils.ts +75 -0
- package/templates/react-native-sdk-reference/src/components/helpers/utils.ts +339 -0
- package/templates/react-native-sdk-reference/src/components/infra/ActionButtons/ActionButtons.tsx +63 -0
- package/templates/react-native-sdk-reference/src/components/infra/ActionButtons/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Assignment/Assignment.tsx +348 -0
- package/templates/react-native-sdk-reference/src/components/infra/Assignment/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/AssignmentCard.tsx +56 -0
- package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/FlowContainer.tsx +57 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/helpers.ts +137 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/RootContainer.tsx +52 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/SimpleView/helper.ts +128 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/SimpleView/index.tsx +59 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/ViewContainer.tsx +31 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/helper.ts +39 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/helper.ts +9 -0
- package/templates/react-native-sdk-reference/src/components/infra/ErrorBoundary/ErrorBoundary.tsx +53 -0
- package/templates/react-native-sdk-reference/src/components/infra/ErrorBoundary/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/MultiStep/MultiStep.tsx +24 -0
- package/templates/react-native-sdk-reference/src/components/infra/MultiStep/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Reference/Reference.tsx +68 -0
- package/templates/react-native-sdk-reference/src/components/infra/Reference/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Reference/utils.ts +16 -0
- package/templates/react-native-sdk-reference/src/components/infra/Region/Region.tsx +10 -0
- package/templates/react-native-sdk-reference/src/components/infra/Region/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/View/View.tsx +49 -0
- package/templates/react-native-sdk-reference/src/components/template/DefaultForm/DefaultForm.tsx +38 -0
- package/templates/react-native-sdk-reference/src/components/template/DefaultForm/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/template/DefaultForm/utils/index.ts +28 -0
- package/templates/react-native-sdk-reference/src/components/template/Details/Details.tsx +82 -0
- package/templates/react-native-sdk-reference/src/components/template/Details/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/template/OneColumn/OneColumn.tsx +29 -0
- package/templates/react-native-sdk-reference/src/components/template/OneColumn/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/context/LoaderContext.tsx +42 -0
- package/templates/react-native-sdk-reference/src/mediaco/AdvBanner.tsx +62 -0
- package/templates/react-native-sdk-reference/src/mediaco/Header.tsx +60 -0
- package/templates/react-native-sdk-reference/src/mediaco/HomeScreen.tsx +78 -0
- package/templates/react-native-sdk-reference/src/mediaco/QuickActions.tsx +68 -0
- package/templates/react-native-sdk-reference/src/mediaco/ResolutionScreen.tsx +48 -0
- package/templates/react-native-sdk-reference/src/mediaco/SafeArea.tsx +11 -0
- package/templates/react-native-sdk-reference/src/mediaco/TabBar.tsx +102 -0
- package/templates/react-native-sdk-reference/src/mediaco/YourServices.tsx +90 -0
- package/templates/react-native-sdk-reference/src/sdk-pega-component-map.ts +64 -0
- package/templates/react-native-sdk-reference/src/types/PConnProps.d.ts +41 -0
- package/templates/react-native-sdk-reference/src/utils/auth.ts +62 -0
- package/templates/react-native-sdk-reference/src/utils/init-pcore.ts +37 -0
- package/templates/react-native-sdk-reference/src/utils/pcore-polyfills.ts +66 -0
- package/templates/react-native-sdk-reference/tsconfig.json +9 -8
- package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +171 -0
- package/templates/react-sdk-reference/.ai-common/agents/implementation-expert.md +25 -26
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions-embedded.md +119 -0
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions.md +70 -121
- package/templates/react-sdk-reference/.ai-common/instructions/component-map.md +7 -19
- package/templates/react-sdk-reference/.ai-common/instructions/dse-component.md +10 -40
- package/templates/react-sdk-reference/.ai-common/instructions/embedded-component.md +134 -0
- package/templates/react-sdk-reference/.ai-common/instructions/field-component.md +15 -43
- package/templates/react-sdk-reference/.ai-common/instructions/template-component.md +11 -63
- package/templates/react-sdk-reference/.ai-common/instructions/widget-component.md +12 -57
- package/templates/react-sdk-reference/.ai-common/mcp/claude-code.mcp.json +8 -0
- package/templates/react-sdk-reference/.ai-common/mcp/copilot.mcp.json +8 -0
- package/templates/react-sdk-reference/.ai-common/mcp/cursor.mcp.json +11 -0
- package/templates/react-sdk-reference/.ai-common/prompts/add-component.md +45 -71
- package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +98 -0
- package/templates/react-sdk-reference/.ai-common/prompts/embedded-component-manifest.md +155 -0
- package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +67 -237
- package/templates/react-sdk-reference/.ai-common/prompts/generate-dse-components.md +26 -77
- package/templates/react-sdk-reference/.ai-common/prompts/generate-embedded-components.md +315 -0
- package/templates/react-sdk-reference/.ai-common/prompts/generate-field-components.md +31 -80
- package/templates/react-sdk-reference/.ai-common/prompts/generate-template-components.md +43 -99
- package/templates/react-sdk-reference/.ai-common/prompts/generate-widget-components.md +33 -83
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/AlertBanner.md +60 -74
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Banner.md +64 -84
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/CaseSummaryFields.md +76 -109
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/DetailsFields.md +84 -101
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldGroup.md +62 -87
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldGroupList.md +56 -76
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldValueList.md +61 -85
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Operator.md +84 -107
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Pulse.md +36 -44
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/RichTextEditor.md +125 -189
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/WssQuickCreate.md +34 -50
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension.md +57 -179
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/analyze-customer-repo.md +130 -0
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/authenticate.md +311 -0
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/run-and-verify-integration.md +156 -0
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/wire-integration.md +476 -0
- package/templates/react-sdk-reference/.ai-common/skills/field-components.md +120 -242
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/AutoComplete.md +71 -212
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/CancelAlert.md +47 -209
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Checkbox.md +90 -259
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Currency.md +75 -169
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Date.md +65 -160
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/DateTime.md +59 -157
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Decimal.md +55 -134
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Dropdown.md +61 -185
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Email.md +60 -138
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Group.md +40 -99
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Integer.md +44 -111
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Location.md +57 -165
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Multiselect.md +41 -122
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/ObjectReference.md +32 -130
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Percentage.md +48 -112
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Phone.md +43 -153
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/RadioButtons.md +76 -183
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/RichText.md +59 -176
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/ScalarList.md +30 -123
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/SelectableCard.md +47 -178
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/SemanticLink.md +31 -117
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextArea.md +51 -106
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextContent.md +22 -75
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextInput.md +54 -116
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Time.md +46 -100
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/URL.md +44 -93
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/UserReference.md +40 -167
- package/templates/react-sdk-reference/.ai-common/skills/infra-components.md +165 -0
- package/templates/react-sdk-reference/.ai-common/skills/infra-skills/ActionButtons.md +122 -0
- package/templates/react-sdk-reference/.ai-common/skills/infra-skills/MultiStep.md +178 -0
- package/templates/react-sdk-reference/.ai-common/skills/infra-skills/Stages.md +140 -0
- package/templates/react-sdk-reference/.ai-common/skills/template-components.md +74 -228
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/AdvancedSearch.md +66 -167
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/AppShell.md +57 -170
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/BannerPage.md +41 -76
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseSummary.md +53 -109
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseView.md +86 -289
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseViewActionsMenu.md +60 -185
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/Confirmation.md +66 -115
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DataReference.md +33 -68
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DefaultForm.md +53 -133
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DefaultPage.md +39 -82
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/Details.md +38 -91
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsSubTabs.md +47 -101
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsThreeColumn.md +27 -34
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsTwoColumn.md +25 -40
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DynamicTabs.md +34 -104
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/FieldGroupTemplate.md +46 -147
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/HierarchicalForm.md +139 -100
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/InlineDashboard.md +43 -82
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/InlineDashboardPage.md +47 -80
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListPage.md +16 -29
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListView.md +43 -228
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/MultiReferenceReadOnly.md +20 -65
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/NarrowWide.md +49 -97
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/OneColumn.md +37 -71
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/PromotedFilters.md +58 -148
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SelfServiceCaseView.md +82 -107
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SimpleTable.md +21 -60
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SingleReferenceReadOnly.md +43 -100
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SubTabs.md +36 -76
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/TwoColumn.md +41 -90
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/WideNarrow.md +36 -43
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/WssNavBar.md +25 -115
- package/templates/react-sdk-reference/.ai-common/skills/widget-components.md +38 -174
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/AppAnnouncement.md +30 -57
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/Attachment.md +55 -101
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/CaseHistory.md +38 -121
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/FileUtility.md +37 -98
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/Followers.md +18 -33
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/QuickCreate.md +26 -91
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/SummaryItem.md +28 -120
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/ToDo.md +41 -272
- package/templates/react-sdk-reference/package.json +1 -1
- package/templates/react-sdk-reference/pega-auth-0.2.44.tgz +0 -0
- package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
- package/templates/react-sdk-reference/src/components/helpers/formatters/index.ts +13 -3
- package/templates/react-native-sdk-reference/.github/AGENTS.md +0 -23
- package/templates/react-native-sdk-reference/.github/copilot-instructions.md +0 -40
- package/templates/react-native-sdk-reference/.github/skills/pega-sdk-component.md +0 -48
- package/templates/react-native-sdk-reference/App.tsx +0 -49
- package/templates/react-native-sdk-reference/expo-env.d.ts +0 -3
- package/templates/react-sdk-reference/pega-auth-0.2.42.tgz +0 -0
|
@@ -2,196 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
Rich text editor field with HTML content support, binds to a Pega case property.
|
|
4
4
|
|
|
5
|
-
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture,
|
|
5
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, input contract, display modes, event handling, and registration patterns common to ALL field components.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Component Purpose
|
|
10
10
|
|
|
11
|
-
Renders a rich text (WYSIWYG) editor for HTML content. Uses a registry-resolved `RichTextEditor` component. Handles both read-only and editable states. Commits HTML content on blur by reading from the editor's internal
|
|
11
|
+
Renders a rich text (WYSIWYG) editor for HTML content. Uses a registry-resolved `RichTextEditor` component. Handles both read-only and editable states. Commits HTML content on blur by reading from the editor's internal instance reference.
|
|
12
12
|
|
|
13
13
|
## Pega Metadata
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `RichText`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Text-RichText`
|
|
17
|
-
- **Registration key:** `RichText` (in
|
|
17
|
+
- **Registration key:** `RichText` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
|
|
|
22
|
-
| ----------------- | ------------------- |
|
|
23
|
-
| `additionalProps` | `object` (optional) | Extra
|
|
21
|
+
| Name | Type | Description |
|
|
22
|
+
| ----------------- | ------------------- | ---------------------------------------------- |
|
|
23
|
+
| `additionalProps` | `object` (optional) | Extra inputs forwarded to the `RichTextEditor` |
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
All other inputs come from the project's field input contract (see prerequisite skill).
|
|
26
|
+
|
|
27
|
+
## Implementation Structure
|
|
26
28
|
|
|
27
29
|
Follow this exact structure. The `RichTextEditor` is resolved from the registry — it wraps whatever WYSIWYG library you choose.
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// 1. Registry lookups
|
|
42
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
43
|
-
const RichTextEditor = getComponentFromRegistry('RichTextEditor');
|
|
44
|
-
|
|
45
|
-
// 2. Destructure props
|
|
46
|
-
const {
|
|
47
|
-
getPConnect, value, placeholder, validatemessage,
|
|
48
|
-
label, hideLabel, helperText, testId, displayMode, additionalProps,
|
|
49
|
-
} = props;
|
|
50
|
-
const pConn = getPConnect();
|
|
51
|
-
const editorRef: any = useRef(null);
|
|
52
|
-
|
|
53
|
-
// 3. Props coercion — Pega may pass 'true'/'false' strings
|
|
54
|
-
let { readOnly, required, disabled } = props;
|
|
55
|
-
[readOnly, required, disabled] = [readOnly, required, disabled].map(
|
|
56
|
-
(prop) => prop === true || (typeof prop === 'string' && prop === 'true'),
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
// 4. Derived
|
|
60
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
61
|
-
|
|
62
|
-
// 5. Display mode returns — note isHtml prop
|
|
63
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
64
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} isHtml />;
|
|
65
|
-
}
|
|
66
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
67
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} isHtml variant="stacked" />;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// 6. Read-only render — no onChange/onBlur
|
|
71
|
-
if (readOnly) {
|
|
72
|
-
return (
|
|
73
|
-
<RichTextEditor {...additionalProps}
|
|
74
|
-
label={label} labelHidden={hideLabel} defaultValue={value}
|
|
75
|
-
testId={testId} info={helperTextToDisplay} ref={editorRef} readOnly />
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// 7. Editable handlers
|
|
80
|
-
const actionsApi = pConn.getActionsApi();
|
|
81
|
-
let status = '';
|
|
82
|
-
if (validatemessage !== '') status = 'error';
|
|
83
|
-
|
|
84
|
-
const handleChange = () => {
|
|
85
|
-
if (status === 'error') {
|
|
86
|
-
const property = (pConn.getStateProps() as any).value;
|
|
87
|
-
pConn.clearErrorMessages({ property, category: '', context: '' });
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
const handleBlur = () => {
|
|
91
|
-
if (editorRef.current) {
|
|
92
|
-
const editorValue = editorRef.current.getContent({ format: 'html' });
|
|
93
|
-
const property = (pConn.getStateProps() as any).value;
|
|
94
|
-
handleEvent(actionsApi, 'changeNblur', property, editorValue);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// 8. Editable render
|
|
99
|
-
return (
|
|
100
|
-
<RichTextEditor {...additionalProps}
|
|
101
|
-
label={label} labelHidden={hideLabel} info={helperTextToDisplay}
|
|
102
|
-
defaultValue={value} placeholder={placeholder}
|
|
103
|
-
disabled={disabled} required={required} testId={testId}
|
|
104
|
-
ref={editorRef} error={status === 'error'}
|
|
105
|
-
onBlur={handleBlur} onChange={handleChange} />
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
```
|
|
31
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `FieldValueList` and `RichTextEditor`), the project's event-commit utility, and a companion stylesheet for editor theming. Define the input contract as an extension of the project's field input contract, adding an optional `additionalProps` field.
|
|
32
|
+
|
|
33
|
+
**Main Component Logic** — steps in order:
|
|
34
|
+
|
|
35
|
+
1. **Registry lookups** — resolve `FieldValueList` and `RichTextEditor` via the project's component registry.
|
|
36
|
+
2. **Receive inputs** — `getPConnect`, `value`, `placeholder`, `validatemessage`, `label`, `hideLabel`, `helperText`, `testId`, `displayMode`, `additionalProps`; also obtain the PConnect instance and create an instance reference for the editor (initialized to `null`).
|
|
37
|
+
3. **Input coercion** — Pega may pass `readOnly`, `required`, and `disabled` as the strings `'true'`/`'false'` rather than booleans; map each to a real boolean by checking `prop === true || (typeof prop === 'string' && prop === 'true')`.
|
|
38
|
+
4. **Derived** — `helperTextToDisplay = validatemessage || helperText`.
|
|
39
|
+
5. **Display mode returns** (note the `isHtml` flag) — `DISPLAY_ONLY` and `STACKED_LARGE_VAL` (the latter with a stacked variant) both return `FieldValueList` with `value` and `isHtml` set.
|
|
40
|
+
6. **Read-only render** (no change/blur handlers) — render `RichTextEditor` with `additionalProps` spread, plus `label`, `labelHidden` set to `hideLabel`, `defaultValue` set to `value`, `testId`, `info` set to `helperTextToDisplay`, the editor instance reference, and `readOnly`.
|
|
41
|
+
7. **Editable handlers** — obtain the actions API from PConnect; set a local `status` variable to `'error'` when `validatemessage !== ''`; the change handler clears error messages (via `pConn.clearErrorMessages({ property, category: '', context: '' })`, where `property` is the bound property name) when `status === 'error'`; the blur handler reads the HTML content from the editor instance reference (via its `getContent({ format: 'html' })` method) and commits it via the project's event-commit utility with event type `'changeNblur'`, the property name, and the HTML content.
|
|
42
|
+
8. **Editable render** — render `RichTextEditor` with `additionalProps` spread, plus `label`, `labelHidden` set to `hideLabel`, `info` set to `helperTextToDisplay`, `defaultValue` set to `value`, `placeholder`, `disabled`, `required`, `testId`, the editor instance reference, `error` set to `status === 'error'`, the blur handler, and the change handler.
|
|
109
43
|
|
|
110
44
|
## Behavioral Contract
|
|
111
45
|
|
|
112
|
-
1. **Editor
|
|
46
|
+
1. **Editor instance reference:** Maintain an instance reference for the editor — the editor exposes its content via the reference's `getContent({ format: 'html' })` method.
|
|
113
47
|
2. **No local state** — unlike text inputs, value is NOT tracked in local state. The editor manages its own internal content via `defaultValue`.
|
|
114
|
-
3. **
|
|
115
|
-
```typescript
|
|
116
|
-
[readOnly, required, disabled] = [readOnly, required, disabled].map(
|
|
117
|
-
(prop) => prop === true || (typeof prop === 'string' && prop === 'true'),
|
|
118
|
-
);
|
|
119
|
-
```
|
|
48
|
+
3. **Input coercion:** `readOnly`, `required`, `disabled` must be coerced to booleans by mapping each value to `prop === true || (typeof prop === 'string' && prop === 'true')`.
|
|
120
49
|
4. **Editable mode:**
|
|
121
50
|
- Track `status` for error state.
|
|
122
|
-
- **On change:** If `status === 'error'`, clear error messages via:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
### Editable RichTextEditor props
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
label, labelHidden={hideLabel}, info={helperTextToDisplay}, defaultValue={value},
|
|
138
|
-
placeholder, disabled, required, testId, ref={editorRef},
|
|
139
|
-
error={status === 'error'}, onBlur={handleBlur}, onChange={handleChange}
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Read-only RichTextEditor props
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
label, labelHidden={hideLabel}, defaultValue={value}, testId, info={helperTextToDisplay},
|
|
146
|
-
ref={editorRef}, readOnly
|
|
147
|
-
```
|
|
51
|
+
- **On change:** If `status === 'error'`, clear error messages via `pConn.clearErrorMessages({ property, category: '', context: '' })`.
|
|
52
|
+
- **On blur:** Read HTML from the editor instance reference via its `getContent({ format: 'html' })` method and commit it via the project's event-commit utility with event type `'changeNblur'`, the property name, and the HTML content.
|
|
53
|
+
5. **Read-only mode:** Render `RichTextEditor` with `readOnly` flag only — no change/blur handlers.
|
|
54
|
+
6. **`RichTextEditor` component:** Resolved via the project's component registry. This is a design-system extension component that wraps the actual WYSIWYG library (e.g., TinyMCE).
|
|
55
|
+
|
|
56
|
+
### Editable RichTextEditor inputs
|
|
57
|
+
|
|
58
|
+
Spread `additionalProps` first, then pass `label`, `labelHidden` set to `hideLabel`, `info` set to `helperTextToDisplay`, `defaultValue` set to `value`, `placeholder`, `disabled`, `required`, `testId`, the editor instance reference, `error` set to `status === 'error'`, the blur handler, and the change handler.
|
|
59
|
+
|
|
60
|
+
### Read-only RichTextEditor inputs
|
|
61
|
+
|
|
62
|
+
Spread `additionalProps` first, then pass `label`, `labelHidden` set to `hideLabel`, `defaultValue` set to `value`, `testId`, `info` set to `helperTextToDisplay`, the editor instance reference, and `readOnly`.
|
|
148
63
|
|
|
149
64
|
## Display Mode Rendering
|
|
150
65
|
|
|
151
|
-
Display modes pass `isHtml
|
|
66
|
+
Display modes pass `isHtml` to render HTML content safely:
|
|
152
67
|
|
|
153
|
-
- **`DISPLAY_ONLY`:**
|
|
154
|
-
- **`STACKED_LARGE_VAL`:**
|
|
68
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to `label` (or empty when `hideLabel` is true), `value`, and `isHtml` set.
|
|
69
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant and `isHtml` set.
|
|
155
70
|
|
|
156
71
|
## Read-Only Rendering
|
|
157
72
|
|
|
158
|
-
Render `RichTextEditor` with `readOnly`
|
|
73
|
+
Render `RichTextEditor` with `readOnly` flag. Uses the same editor instance reference.
|
|
159
74
|
|
|
160
75
|
## Visual Specifications
|
|
161
76
|
|
|
162
|
-
The visual appearance of the rich text editor depends on the underlying `RichTextEditor` implementation. The reference implementation uses
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
/* RichText.css — must be imported */
|
|
166
|
-
.tox .tox-toolbar {
|
|
167
|
-
background-color: var(--app-background-color) !important;
|
|
168
|
-
}
|
|
169
|
-
.tox .tox-toolbar__primary {
|
|
170
|
-
background-color: var(--app-background-color) !important;
|
|
171
|
-
}
|
|
172
|
-
.tox .tox-toolbar__button {
|
|
173
|
-
color: var(--app-text-color) !important;
|
|
174
|
-
}
|
|
175
|
-
.tox .tox-toolbar__button--enabled {
|
|
176
|
-
background: var(--app-primary-color) !important;
|
|
177
|
-
color: #fff !important;
|
|
178
|
-
}
|
|
179
|
-
.tox .tox-dialog {
|
|
180
|
-
background-color: var(--modal-top-color) !important;
|
|
181
|
-
color: var(--app-text-color) !important;
|
|
182
|
-
border: 1px solid var(--modal-border-color) !important;
|
|
183
|
-
padding: 20px !important;
|
|
184
|
-
box-shadow: 0 0 10px 3px var(--modal-box-shadow-color) !important;
|
|
185
|
-
}
|
|
186
|
-
.tox .tox-dialog__header {
|
|
187
|
-
background-color: var(--modal-top-color) !important;
|
|
188
|
-
color: var(--app-text-color) !important;
|
|
189
|
-
font-weight: 500;
|
|
190
|
-
border-bottom: 1px solid var(--modal-border-color);
|
|
191
|
-
}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**Note:** Import `./RichText.css` in the component file. The CSS variables (`--app-background-color`, `--app-text-color`, etc.) are set by the application theme.
|
|
77
|
+
The visual appearance of the rich text editor depends on the underlying `RichTextEditor` implementation. The reference implementation uses editor theming via CSS variables, imported from a companion stylesheet: the toolbar and primary toolbar background use `--app-background-color`; toolbar buttons use `--app-text-color` for their icon color, and enabled/active toolbar buttons use `--app-primary-color` as background with white text; dialogs use `--modal-top-color` for background, `--app-text-color` for text, a 1px border in `--modal-border-color`, 20px padding, and a box shadow using `--modal-box-shadow-color`; the dialog header shares the same background/text colors with medium font weight and a bottom border in `--modal-border-color`.
|
|
78
|
+
|
|
79
|
+
**Note:** Import the companion stylesheet in the component file. The CSS variables (`--app-background-color`, `--app-text-color`, etc.) are set by the application theme.
|
|
195
80
|
|
|
196
81
|
When implementing with a different design system:
|
|
197
82
|
|
|
@@ -201,34 +86,32 @@ When implementing with a different design system:
|
|
|
201
86
|
|
|
202
87
|
## Edge Cases & Special Logic
|
|
203
88
|
|
|
204
|
-
- **
|
|
89
|
+
- **Input coercion to boolean:** Pega may pass these inputs as strings (`'true'`/`'false'`) — always coerce.
|
|
205
90
|
- **On blur, NOT on change:** Content is committed to the store only on blur (when user leaves the editor), not on every keystroke.
|
|
206
|
-
- **Error clearing:** When `status === 'error'`, the
|
|
207
|
-
- **`editorRef.current.getContent`:** This is specific to the TinyMCE API. For other rich text libraries, use the equivalent method to get HTML content.
|
|
208
|
-
- **`FieldValueList` with `isHtml`:** The display mode renders HTML — ensure XSS protection in the `FieldValueList` component (use
|
|
91
|
+
- **Error clearing:** When `status === 'error'`, the change handler clears the error message from Pega so it doesn't persist after the user starts editing.
|
|
92
|
+
- **`editorRef.current.getContent`:** This method is specific to the TinyMCE API. For other rich text libraries, use the equivalent method to get HTML content.
|
|
93
|
+
- **`FieldValueList` with `isHtml`:** The display mode renders HTML — ensure XSS protection in the `FieldValueList` component (use the framework's trusted HTML injection mechanism with proper sanitization).
|
|
209
94
|
|
|
210
95
|
## Dependencies
|
|
211
96
|
|
|
212
|
-
- `
|
|
213
|
-
- `
|
|
214
|
-
-
|
|
215
|
-
-
|
|
216
|
-
- `useRef` from React.
|
|
97
|
+
- The project's component registry, resolving `RichTextEditor` — the actual editor widget (e.g., TinyMCE wrapper).
|
|
98
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
99
|
+
- The project's event-commit utility.
|
|
100
|
+
- A companion stylesheet for editor toolbar theming.
|
|
217
101
|
|
|
218
102
|
**For other rich text editors:**
|
|
219
103
|
|
|
220
|
-
- Any WYSIWYG editor that exposes
|
|
221
|
-
- Examples: Quill,
|
|
104
|
+
- Any WYSIWYG editor that exposes a method to get HTML content from an instance reference.
|
|
105
|
+
- Examples: Quill, Slate.js, CKEditor, Tiptap.
|
|
222
106
|
|
|
223
107
|
## Design System Mapping
|
|
224
108
|
|
|
225
109
|
**UI control type:** WYSIWYG rich text editor (HTML content).
|
|
226
110
|
|
|
227
|
-
|
|
111
|
+
When implementing in a specific design system, map the following:
|
|
228
112
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
| Chakra UI | Quill or TipTap with Chakra styling |
|
|
113
|
+
- **Rich text editor** → resolve the `RichTextEditor` component from the project's component registry
|
|
114
|
+
- **Read-only** → pass the `readOnly` flag to the editor, which renders as static HTML display
|
|
115
|
+
- **Display modes** → render `FieldValueList` with `isHtml` set for HTML content
|
|
116
|
+
- **Blur commit** → read HTML from the editor's instance reference on blur and commit to store
|
|
117
|
+
- **Theming** → import a companion stylesheet to theme the editor toolbar using CSS variables
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Read-only display component that renders a list of scalar values by creating a child component for each item.
|
|
4
4
|
|
|
5
|
-
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture,
|
|
5
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, input contract, display modes, event handling, and registration patterns common to ALL field components.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -14,15 +14,11 @@ Renders a list of scalar (primitive) values by dynamically creating a child comp
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `ScalarList`
|
|
16
16
|
- **Type / Subtype:** `Field` / `ScalarList`
|
|
17
|
-
- **Registration key:** `ScalarList` (in
|
|
17
|
+
- **Registration key:** `ScalarList` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
> ScalarList uses
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
import type { PConnProps } from '@pega/sdk-react';
|
|
25
|
-
```
|
|
21
|
+
> ScalarList uses the project's base component interface (NOT the field input contract) because its `value` is an array, not a string.
|
|
26
22
|
|
|
27
23
|
| Prop | Type | Description |
|
|
28
24
|
| ---------------- | --------- | ---------------------------------------------------------------------------- |
|
|
@@ -33,111 +29,35 @@ import type { PConnProps } from '@pega/sdk-react';
|
|
|
33
29
|
| `hideLabel` | `boolean` | Whether to hide the label |
|
|
34
30
|
| `displayInModal` | `boolean` | Whether this is displayed in a modal context |
|
|
35
31
|
|
|
36
|
-
All remaining
|
|
32
|
+
All remaining inputs are forwarded to each child component.
|
|
37
33
|
|
|
38
|
-
##
|
|
34
|
+
## Implementation Structure
|
|
39
35
|
|
|
40
36
|
Read-only display component — no state, no event handling.
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
import { getComponentFromRegistry } from '@pega/sdk-react';
|
|
44
|
-
import type { PConnProps } from '@pega/sdk-react';
|
|
45
|
-
|
|
46
|
-
interface ScalarListProps extends PConnProps {
|
|
47
|
-
displayInModal: boolean;
|
|
48
|
-
hideLabel: boolean;
|
|
49
|
-
value: any[];
|
|
50
|
-
componentType: string;
|
|
51
|
-
label: string;
|
|
52
|
-
displayMode: string;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Local sub-component: renders items as spans in an unstyled list
|
|
56
|
-
function CommaSeparatedList({ items }) {
|
|
57
|
-
return (
|
|
58
|
-
<ul style={{ padding: '0', margin: '0' }}>
|
|
59
|
-
{items.map((value, index) => <span key={index}>{value}</span>)}
|
|
60
|
-
</ul>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default function ScalarList(props: ScalarListProps) {
|
|
65
|
-
// 1. Registry lookup
|
|
66
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
67
|
-
|
|
68
|
-
// 2. Destructure — note ...restProps forwarded to each child
|
|
69
|
-
const { label, getPConnect, componentType, value: scalarValues, displayMode, hideLabel, ...restProps } = props;
|
|
70
|
-
|
|
71
|
-
// 3. Create child components for each scalar value
|
|
72
|
-
const items = scalarValues?.map((scalarValue) =>
|
|
73
|
-
getPConnect().createComponent(
|
|
74
|
-
{
|
|
75
|
-
type: componentType,
|
|
76
|
-
config: { value: scalarValue, displayMode: 'DISPLAY_ONLY', label, ...restProps, readOnly: 'true' },
|
|
77
|
-
},
|
|
78
|
-
'', '', {}, // 2nd/3rd/4th args per typedef
|
|
79
|
-
),
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
// 4. Display mode: STACKED_LARGE_VAL or DISPLAY_ONLY → bare list
|
|
83
|
-
if (['STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode)) {
|
|
84
|
-
return <div><CommaSeparatedList items={items} /></div>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// 5. Default: wrap in FieldValueList
|
|
88
|
-
return <FieldValueList name={hideLabel ? '' : label} value={<CommaSeparatedList items={items} />} variant="stacked" />;
|
|
89
|
-
}
|
|
90
|
-
```
|
|
38
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `FieldValueList`). Define the input contract as an extension of the project's base component interface (not the field input contract) with `displayInModal`, `hideLabel`, `value` (array), `componentType`, `label`, and `displayMode` fields.
|
|
91
39
|
|
|
92
|
-
|
|
40
|
+
**Local sub-component `CommaSeparatedList`:** renders the given items as inline elements inside an unstyled list (no padding, no margin) — despite the name, there is no comma separator; items are simply adjacent inline elements.
|
|
93
41
|
|
|
94
|
-
|
|
95
|
-
2. **Item rendering:** Map each value in `scalarValues` to a component via `getPConnect().createComponent(...)`:
|
|
96
|
-
```typescript
|
|
97
|
-
const items = scalarValues?.map((scalarValue) =>
|
|
98
|
-
getPConnect().createComponent(
|
|
99
|
-
{
|
|
100
|
-
type: componentType,
|
|
101
|
-
config: {
|
|
102
|
-
value: scalarValue,
|
|
103
|
-
displayMode: 'DISPLAY_ONLY',
|
|
104
|
-
label,
|
|
105
|
-
...restProps,
|
|
106
|
-
readOnly: 'true',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
'', // 2nd arg: empty string
|
|
110
|
-
'', // 3rd arg: empty string
|
|
111
|
-
{}, // 4th arg: empty object
|
|
112
|
-
),
|
|
113
|
-
);
|
|
114
|
-
```
|
|
115
|
-
3. **`CommaSeparatedList` sub-component:** A local component that renders items as `<span>` elements inside a `<ul>` with no list styling:
|
|
116
|
-
```html
|
|
117
|
-
<ul style="padding: 0; margin: 0;">
|
|
118
|
-
<span>item1</span>
|
|
119
|
-
<span>item2</span>
|
|
120
|
-
...
|
|
121
|
-
</ul>
|
|
122
|
-
```
|
|
42
|
+
**Main Component Logic** — steps in order:
|
|
123
43
|
|
|
124
|
-
|
|
44
|
+
1. **Registry lookup** — resolve `FieldValueList` via the project's component registry.
|
|
45
|
+
2. **Receive inputs** — `label`, `getPConnect`, `componentType`, `value` (aliased to `scalarValues`), `displayMode`, `hideLabel`, and the remaining inputs collected into `restInputs` for forwarding to each child.
|
|
46
|
+
3. **Create child components for each scalar value** — map each entry in `scalarValues` to a child component created via `getPConnect().createComponent(...)`, passing a config object of `type: componentType` and a `config` object containing `value: scalarValue`, `displayMode: 'DISPLAY_ONLY'`, `label`, the spread remaining inputs, and `readOnly: 'true'`; the second, third, and fourth arguments to `createComponent` are an empty string, empty string, and empty object respectively (per its type signature).
|
|
47
|
+
4. **Display mode: `STACKED_LARGE_VAL` or `DISPLAY_ONLY`** — return the items wrapped directly in a `<div>` containing `<CommaSeparatedList items={items} />`, with no `FieldValueList` wrapper.
|
|
48
|
+
5. **Default** — wrap in `FieldValueList` with `name={hideLabel ? '' : label}`, `value={<CommaSeparatedList items={items} />}`, and `variant="stacked"`.
|
|
125
49
|
|
|
126
|
-
|
|
50
|
+
## Behavioral Contract
|
|
127
51
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
</div>
|
|
132
|
-
```
|
|
52
|
+
1. **No state, no event handling** — purely display/read-only.
|
|
53
|
+
2. **Item rendering:** Map each value in `scalarValues` to a component via `getPConnect().createComponent(...)`, passing `type: componentType` and a `config` object with `value: scalarValue`, `displayMode: 'DISPLAY_ONLY'`, `label`, the spread remaining inputs, and `readOnly: 'true'`; the remaining three call arguments are an empty string, empty string, and empty object.
|
|
54
|
+
3. **`CommaSeparatedList` sub-component:** A local component that renders items as inline elements inside a list with no list styling (zero padding, zero margin).
|
|
133
55
|
|
|
134
|
-
|
|
56
|
+
## Display Mode Rendering
|
|
135
57
|
|
|
136
|
-
|
|
58
|
+
**`STACKED_LARGE_VAL` or `DISPLAY_ONLY`:** the items are rendered directly inside a `<div>` wrapping a `<CommaSeparatedList items={items} />` — no `FieldValueList` wrapper in these modes.
|
|
137
59
|
|
|
138
|
-
|
|
139
|
-
<FieldValueList name={hideLabel ? '' : label} value={<CommaSeparatedList items={items} />} variant='stacked' />
|
|
140
|
-
```
|
|
60
|
+
**Default (no display mode):** wrap in `FieldValueList` with `name={hideLabel ? '' : label}`, `value={<CommaSeparatedList items={items} />}`, and `variant='stacked'`.
|
|
141
61
|
|
|
142
62
|
## Visual Specifications
|
|
143
63
|
|
|
@@ -148,41 +68,28 @@ No `FieldValueList` wrapper in these modes — the items are rendered directly.
|
|
|
148
68
|
| Separator | Items are adjacent spans (no comma separator despite the name) |
|
|
149
69
|
| Layout | Vertical stack when wrapped in `FieldValueList variant='stacked'` |
|
|
150
70
|
|
|
151
|
-
**
|
|
152
|
-
|
|
153
|
-
```css
|
|
154
|
-
.scalar-list {
|
|
155
|
-
list-style: none;
|
|
156
|
-
padding: 0;
|
|
157
|
-
margin: 0;
|
|
158
|
-
}
|
|
159
|
-
.scalar-list-item {
|
|
160
|
-
display: inline;
|
|
161
|
-
}
|
|
162
|
-
```
|
|
71
|
+
**Visual-only styling notes:** The `<ul>` has no bullet markers and zero padding/margin. Each item span is rendered inline with no additional styling.
|
|
163
72
|
|
|
164
73
|
## Edge Cases & Special Logic
|
|
165
74
|
|
|
166
75
|
- `scalarValues` may be `undefined` — the `?.map()` safely returns `undefined`; ensure null-check before rendering.
|
|
167
76
|
- Each child component is created with `displayMode: 'DISPLAY_ONLY'` and `readOnly: 'true'` (as string) — the read-only is passed as a string, not boolean.
|
|
168
|
-
- `
|
|
77
|
+
- `restInputs` includes all remaining inputs from the parent beyond the destructured ones — these are forwarded to each child component config.
|
|
169
78
|
- `createComponent` takes 4 args — 2nd, 3rd, 4th are empty string/object as the typedef marks them optional.
|
|
170
79
|
|
|
171
80
|
## Dependencies
|
|
172
81
|
|
|
173
|
-
- `
|
|
82
|
+
- The project's component registry, resolving `FieldValueList` — for default display.
|
|
174
83
|
- `getPConnect().createComponent()` — for creating each child component.
|
|
175
|
-
- No
|
|
84
|
+
- No event-commit utility — read-only component.
|
|
176
85
|
|
|
177
86
|
## Design System Mapping
|
|
178
87
|
|
|
179
88
|
**UI control type:** Read-only list of scalar values.
|
|
180
89
|
|
|
181
|
-
|
|
90
|
+
When implementing in a specific design system, map the following:
|
|
182
91
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
| Ant Design | `<List>` items or `<Space>` with `<Tag>` |
|
|
188
|
-
| Chakra UI | `<List>` or `<HStack>` with `<Tag>` |
|
|
92
|
+
- **List container** → an unstyled list element (no bullets, no padding/margin)
|
|
93
|
+
- **List items** → inline elements for each rendered child component
|
|
94
|
+
- **Default display** → wrap in `FieldValueList` with a stacked variant
|
|
95
|
+
- **Display modes** → render the list directly without `FieldValueList` wrapper
|