@pega/sdk 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/dist/index.js +764 -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/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,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Multi-line text input field that 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
|
|
|
@@ -14,123 +14,70 @@ Renders an editable multi-line text area. Used for long-form text input such as
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `TextArea`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Text` (multi-line)
|
|
17
|
-
- **Registration key:** `TextArea` (in
|
|
17
|
+
- **Registration key:** `TextArea` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
|
|
|
21
|
+
| Name | Type | Description |
|
|
22
22
|
| --------------- | ---------------- | ---------------------------------------------------------- |
|
|
23
23
|
| `fieldMetadata` | `any` (optional) | Metadata object; used to read `maxLength` for the textarea |
|
|
24
24
|
|
|
25
|
-
All other
|
|
25
|
+
All other inputs come from the project's field input contract (see prerequisite skill).
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
import type { PConnFieldProps } from '@pega/sdk-react';
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Component Skeleton
|
|
27
|
+
## Implementation Structure
|
|
32
28
|
|
|
33
29
|
Similar to TextInput but multiline with fixed rows. Does NOT delegate to TextInput in read-only mode.
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
48
|
-
|
|
49
|
-
// 2. Destructure props
|
|
50
|
-
const {
|
|
51
|
-
getPConnect, label, required, disabled, value = '',
|
|
52
|
-
validatemessage, status, readOnly, testId, fieldMetadata,
|
|
53
|
-
helperText, displayMode, hideLabel, placeholder,
|
|
54
|
-
} = props;
|
|
55
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
56
|
-
const pConn = getPConnect();
|
|
57
|
-
const actions = pConn.getActionsApi();
|
|
58
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
59
|
-
const maxLength = fieldMetadata?.maxLength;
|
|
60
|
-
|
|
61
|
-
// 3. State
|
|
62
|
-
const [inputValue, setInputValue] = useState('');
|
|
63
|
-
let readOnlyProp = {};
|
|
64
|
-
|
|
65
|
-
// 4. useEffect: sync from store — deps: [value]
|
|
66
|
-
useEffect(() => { setInputValue(value); }, [value]);
|
|
67
|
-
|
|
68
|
-
// 5. Display mode returns
|
|
69
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
70
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
71
|
-
}
|
|
72
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
73
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// 6. Read-only: set readOnlyProp (do NOT delegate to TextInput — preserve multiline)
|
|
77
|
-
if (readOnly) readOnlyProp = { readOnly: true };
|
|
78
|
-
|
|
79
|
-
// 7. Test ID + handlers
|
|
80
|
-
const testProps: any = { 'data-test-id': testId };
|
|
81
|
-
function handleChange(event) { setInputValue(event?.target?.value); }
|
|
82
|
-
function handleBlur() { handleEvent(actions, 'changeNblur', propName, inputValue); }
|
|
83
|
-
|
|
84
|
-
// 8. Main render — multiline text input
|
|
85
|
-
// Key props:
|
|
86
|
-
// - multiline: true, minRows: 5, maxRows: 5
|
|
87
|
-
// - fullWidth, variant: readOnly ? 'standard' : 'outlined', size: 'small'
|
|
88
|
-
// - value: inputValue, onChange: handleChange
|
|
89
|
-
// - onBlur: !readOnly ? handleBlur : undefined
|
|
90
|
-
// - label, helperText: helperTextToDisplay, placeholder: placeholder ?? ''
|
|
91
|
-
// - required, disabled, error: status === 'error'
|
|
92
|
-
// - slotProps: { input: { ...readOnlyProp, inputProps: { maxLength, ...testProps } } }
|
|
93
|
-
return <TextAreaWidget ... />;
|
|
94
|
-
}
|
|
95
|
-
```
|
|
31
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `FieldValueList`) and the project's event-commit utility (for committing value changes to the store). Define the input contract as an extension of the project's field input contract, adding an optional `fieldMetadata` field.
|
|
32
|
+
|
|
33
|
+
**Main Component Logic** — steps in order:
|
|
34
|
+
|
|
35
|
+
1. **Registry lookup** — resolve `FieldValueList` via the project's component registry.
|
|
36
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required`, `disabled`, `value` (default `''`), `validatemessage`, `status`, `readOnly`, `testId`, `fieldMetadata`, `helperText`, `displayMode`, `hideLabel`, `placeholder`. Compute `helperTextToDisplay = validatemessage || helperText`, set up the PConnect instance, actions API, and bound property name, and derive `maxLength = fieldMetadata?.maxLength`.
|
|
37
|
+
3. **Local state** — `inputValue` initialized to `''`; declare a read-only configuration object.
|
|
38
|
+
4. **Sync from store** — a lifecycle effect watching `value` updates `inputValue` whenever it changes.
|
|
39
|
+
5. **Display mode returns** — `DISPLAY_ONLY` and `STACKED_LARGE_VAL` both return `FieldValueList` using the raw `value`, the latter with a stacked variant.
|
|
40
|
+
6. **Read-only** — set the read-only configuration to mark the textarea read-only when `readOnly` is true. Unlike TextInput, do NOT delegate to `TextInput` — preserve the multiline rendering even when read-only.
|
|
41
|
+
7. **Test ID and handlers** — build a test-id attribute from `testId`; the change handler updates `inputValue` from the event's textarea value; the blur handler commits the value via the project's event-commit utility with event type `'changeNblur'`, the property name, and `inputValue`.
|
|
42
|
+
8. **Render** — a multiline text input configured with: multiline mode enabled, minimum rows `5`, maximum rows `5`, full width, an outlined style when editable or flat/borderless style when read-only, small size, current `inputValue`, the change handler, the blur handler wired only when not read-only, `label`, `helperText: helperTextToDisplay`, `placeholder: placeholder ?? ''`, `required`, `disabled`, an error state when `status === 'error'`, and `maxLength` plus the read-only/test-id attributes applied to the underlying textarea element.
|
|
96
43
|
|
|
97
44
|
## Behavioral Contract
|
|
98
45
|
|
|
99
46
|
1. **Local state:** Maintain `inputValue` in local state (string). Initialize to `''`.
|
|
100
|
-
2. **Sync from store:**
|
|
47
|
+
2. **Sync from store:** A lifecycle effect watching the `value` input updates `inputValue` whenever `value` changes.
|
|
101
48
|
3. **On change:** Update local `inputValue` state only (do NOT commit to store on every keystroke).
|
|
102
|
-
4. **On blur:** Commit to store
|
|
103
|
-
5. **Read-only:** Set
|
|
49
|
+
4. **On blur:** Commit to store via the project's event-commit utility with event type `'changeNblur'`, the property name, and `inputValue`.
|
|
50
|
+
5. **Read-only:** Set the read-only attribute on the textarea; use a visually flat/borderless style. Omit the blur handler when read-only.
|
|
104
51
|
6. **maxLength:** Read from `fieldMetadata?.maxLength`; pass to the textarea's `maxLength` attribute.
|
|
105
|
-
7. **Row sizing:** Fixed at `
|
|
52
|
+
7. **Row sizing:** Fixed at minimum rows `5` and maximum rows `5` — the textarea does not auto-expand; it shows a scrollbar if content exceeds 5 rows.
|
|
106
53
|
|
|
107
54
|
## Display Mode Rendering
|
|
108
55
|
|
|
109
|
-
- **`DISPLAY_ONLY`:** Render
|
|
110
|
-
- **`STACKED_LARGE_VAL`:** Render
|
|
56
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to `label` (or empty when `hideLabel` is true) and `value` set to the raw `value`.
|
|
57
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
111
58
|
- Both modes short-circuit before interactive rendering.
|
|
112
59
|
|
|
113
60
|
## Read-Only Rendering
|
|
114
61
|
|
|
115
|
-
Set
|
|
62
|
+
Set the read-only attribute on the textarea element (NOT a read-only version via `TextInput` — preserves the multiline appearance). Switch to a flat/borderless visual style. The min/max rows constraint is still applied in read-only.
|
|
116
63
|
|
|
117
64
|
## Visual Specifications
|
|
118
65
|
|
|
119
|
-
Derived from the reference component's
|
|
120
|
-
|
|
121
|
-
| Property | Standard (editable) | Read-only
|
|
122
|
-
| ------------- | ---------------------------------------- |
|
|
123
|
-
| Width | 100% | 100%
|
|
124
|
-
| Min rows | 5 | 5
|
|
125
|
-
| Max rows | 5 (scrollable beyond) | 5
|
|
126
|
-
| Border | 1px solid (outlined) | None (
|
|
127
|
-
| Border radius | 4px | —
|
|
128
|
-
| Label | Floating label | Floating label
|
|
129
|
-
| Helper text | Below textarea | Below textarea
|
|
130
|
-
| Error state | Red border + red helper text | —
|
|
131
|
-
| Resize | Vertical resize handle (browser default) | Same
|
|
132
|
-
| Font size | 0.875rem | 0.875rem
|
|
133
|
-
| Padding | 8px 14px | —
|
|
66
|
+
Derived from the reference component's styling:
|
|
67
|
+
|
|
68
|
+
| Property | Standard (editable) | Read-only |
|
|
69
|
+
| ------------- | ---------------------------------------- | ----------------- |
|
|
70
|
+
| Width | 100% | 100% |
|
|
71
|
+
| Min rows | 5 | 5 |
|
|
72
|
+
| Max rows | 5 (scrollable beyond) | 5 |
|
|
73
|
+
| Border | 1px solid (outlined) | None (flat style) |
|
|
74
|
+
| Border radius | 4px | — |
|
|
75
|
+
| Label | Floating label | Floating label |
|
|
76
|
+
| Helper text | Below textarea | Below textarea |
|
|
77
|
+
| Error state | Red border + red helper text | — |
|
|
78
|
+
| Resize | Vertical resize handle (browser default) | Same |
|
|
79
|
+
| Font size | 0.875rem | 0.875rem |
|
|
80
|
+
| Padding | 8px 14px | — |
|
|
134
81
|
|
|
135
82
|
**CSS-only implementation notes:**
|
|
136
83
|
|
|
@@ -140,25 +87,23 @@ Derived from the reference component's MUI props:
|
|
|
140
87
|
|
|
141
88
|
## Edge Cases & Special Logic
|
|
142
89
|
|
|
143
|
-
- Unlike `TextInput`, do NOT delegate to `TextInput` in read-only mode — render the textarea directly with
|
|
90
|
+
- Unlike `TextInput`, do NOT delegate to `TextInput` in read-only mode — render the textarea directly with the read-only attribute set, so the multi-line appearance is preserved.
|
|
144
91
|
- `maxLength` is optional; only apply the attribute if `fieldMetadata?.maxLength` is defined.
|
|
145
92
|
|
|
146
93
|
## Dependencies
|
|
147
94
|
|
|
148
|
-
-
|
|
149
|
-
- `
|
|
150
|
-
- No third-party UI libraries required
|
|
95
|
+
- The project's event-commit utility.
|
|
96
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
97
|
+
- No third-party UI libraries required.
|
|
151
98
|
|
|
152
99
|
## Design System Mapping
|
|
153
100
|
|
|
154
|
-
**UI control type:** Multi-line text input (
|
|
101
|
+
**UI control type:** Multi-line text input (textarea).
|
|
155
102
|
|
|
156
|
-
|
|
103
|
+
When implementing in a specific design system, map the following:
|
|
157
104
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
| Chakra UI | `<Textarea />` |
|
|
164
|
-
| Shadcn/ui | `<Textarea />` |
|
|
105
|
+
- **Multiline input** → use the DS's textarea or multi-line text field component
|
|
106
|
+
- **Row sizing** → configure minimum and maximum rows to `5`
|
|
107
|
+
- **Read-only mode** → set the read-only attribute directly on the textarea (do NOT delegate to TextInput)
|
|
108
|
+
- **Error state** → the DS's error/danger visual state
|
|
109
|
+
- **maxLength** → pass to the textarea's `maxLength` attribute
|
|
@@ -2,65 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
Static text display component that renders formatted text content (paragraph or heading). Non-interactive — no form binding.
|
|
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
|
-
Displays static, read-only text content. Used to embed headings or descriptive paragraph text within forms or views. Not an input field — does NOT bind to a case property value and does NOT use
|
|
11
|
+
Displays static, read-only text content. Used to embed headings or descriptive paragraph text within forms or views. Not an input field — does NOT bind to a case property value and does NOT use the project's field input contract. It renders purely based on static configuration inputs.
|
|
12
12
|
|
|
13
13
|
## Pega Metadata
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `TextContent`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Text`
|
|
17
|
-
- **Registration key:** `TextContent` (in
|
|
17
|
+
- **Registration key:** `TextContent` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
The input contract extends the project's base component interface (NOT the field input contract — there is no form value binding), adding two required fields: `content` and `displayAs`.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
import type { PConnProps } from '@pega/sdk-react';
|
|
25
|
-
|
|
26
|
-
interface TextContentProps extends PConnProps {
|
|
27
|
-
content: string;
|
|
28
|
-
displayAs: 'Paragraph' | 'Heading 1' | 'Heading 2' | 'Heading 3' | 'Heading 4';
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
| Prop | Type | Description |
|
|
23
|
+
| Name | Type | Description |
|
|
33
24
|
| ----------- | ------------------------------------------------------------------------- | ------------------------------------------------- |
|
|
34
25
|
| `content` | `string` | The text string to render |
|
|
35
26
|
| `displayAs` | `'Paragraph' \| 'Heading 1' \| 'Heading 2' \| 'Heading 3' \| 'Heading 4'` | How to render the text — maps to typography level |
|
|
36
27
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
Simplest possible component — no state, no effects, just a switch on `displayAs`.
|
|
28
|
+
## Implementation Structure
|
|
40
29
|
|
|
41
|
-
|
|
42
|
-
import type { PConnProps } from '@pega/sdk-react';
|
|
30
|
+
Simplest possible component — no state, no lifecycle effects, just a switch on `displayAs`.
|
|
43
31
|
|
|
44
|
-
interface
|
|
45
|
-
content: string;
|
|
46
|
-
displayAs: 'Paragraph' | 'Heading 1' | 'Heading 2' | 'Heading 3' | 'Heading 4';
|
|
47
|
-
}
|
|
32
|
+
**Module Setup:** Define the input contract as an extension of the project's base component interface (not the field input contract) with `content: string` and the `displayAs` union type.
|
|
48
33
|
|
|
49
|
-
|
|
50
|
-
const { content, displayAs } = props;
|
|
34
|
+
**Main Component Logic:**
|
|
51
35
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
case 'Heading 2': return <h2>{content}</h2>;
|
|
56
|
-
case 'Heading 3': return <h3>{content}</h3>;
|
|
57
|
-
case 'Heading 4': return <h4>{content}</h4>;
|
|
58
|
-
default:
|
|
59
|
-
console.error(`TextContent got unexpected displayAs: ${displayAs}`);
|
|
60
|
-
return <p>{content}</p>;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
```
|
|
36
|
+
1. Receive `content` and `displayAs` from inputs.
|
|
37
|
+
2. Switch on `displayAs` and render the matching element wrapping `content`: `'Paragraph'` → `<p>`, `'Heading 1'` → `<h1>`, `'Heading 2'` → `<h2>`, `'Heading 3'` → `<h3>`, `'Heading 4'` → `<h4>`.
|
|
38
|
+
3. For any unrecognized `displayAs` value, log an error describing the unexpected value, then fall back to rendering `content` in a `<p>`.
|
|
64
39
|
|
|
65
40
|
## Behavioral Contract
|
|
66
41
|
|
|
@@ -75,7 +50,7 @@ export default function TextContent(props: TextContentProps) {
|
|
|
75
50
|
|
|
76
51
|
## Display Mode Rendering
|
|
77
52
|
|
|
78
|
-
Not applicable — this component is display-only by nature. It does not accept a `displayMode`
|
|
53
|
+
Not applicable — this component is display-only by nature. It does not accept a `displayMode` input.
|
|
79
54
|
|
|
80
55
|
## Read-Only Rendering
|
|
81
56
|
|
|
@@ -93,53 +68,25 @@ Derived from standard HTML typography:
|
|
|
93
68
|
| `Heading 3` | `<h3>` | 1.75rem | 400 |
|
|
94
69
|
| `Heading 4` | `<h4>` | 1.5rem | 400 |
|
|
95
70
|
|
|
96
|
-
Color inherits from the surrounding text color. No padding, margin, border, or background beyond what the browser/design-system applies to the heading element.
|
|
97
|
-
|
|
98
|
-
**CSS-only implementation notes:**
|
|
99
|
-
|
|
100
|
-
```css
|
|
101
|
-
.text-content-h1 {
|
|
102
|
-
font-size: 2.5rem;
|
|
103
|
-
font-weight: 300;
|
|
104
|
-
}
|
|
105
|
-
.text-content-h2 {
|
|
106
|
-
font-size: 2rem;
|
|
107
|
-
font-weight: 300;
|
|
108
|
-
}
|
|
109
|
-
.text-content-h3 {
|
|
110
|
-
font-size: 1.75rem;
|
|
111
|
-
font-weight: 400;
|
|
112
|
-
}
|
|
113
|
-
.text-content-h4 {
|
|
114
|
-
font-size: 1.5rem;
|
|
115
|
-
font-weight: 400;
|
|
116
|
-
}
|
|
117
|
-
.text-content-body {
|
|
118
|
-
font-size: 1rem;
|
|
119
|
-
font-weight: 400;
|
|
120
|
-
}
|
|
121
|
-
```
|
|
71
|
+
Color inherits from the surrounding text color. No padding, margin, border, or background beyond what the browser/design-system applies to the heading element. Each heading level (and the paragraph/body style) uses only `font-size` and `font-weight` to differentiate visual hierarchy, per the table above — no other styling is applied.
|
|
122
72
|
|
|
123
73
|
## Edge Cases & Special Logic
|
|
124
74
|
|
|
125
|
-
- Unrecognized `displayAs` values should trigger
|
|
126
|
-
- No
|
|
75
|
+
- Unrecognized `displayAs` values should trigger an error log and fall back to body text.
|
|
76
|
+
- No event-commit utility, no store interaction, no lifecycle effects.
|
|
127
77
|
|
|
128
78
|
## Dependencies
|
|
129
79
|
|
|
130
80
|
- No event utilities needed
|
|
131
81
|
- No `FieldValueList` needed
|
|
132
|
-
- Only a typography rendering element
|
|
82
|
+
- Only a typography rendering element (native HTML or the DS's typography component)
|
|
133
83
|
|
|
134
84
|
## Design System Mapping
|
|
135
85
|
|
|
136
86
|
**UI control type:** Static typography / text block.
|
|
137
87
|
|
|
138
|
-
|
|
88
|
+
When implementing in a specific design system, map the following:
|
|
139
89
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
| MUI | `<Typography variant='h1' \| 'h2' \| 'h3' \| 'h4' \| 'body1'>` |
|
|
144
|
-
| Ant Design | `<Typography.Title level={1-4}>` or `<Typography.Text>` |
|
|
145
|
-
| Chakra UI | `<Heading as='h1'-'h4'>` or `<Text>` |
|
|
90
|
+
- **Paragraph** → use the DS's body text component or a `<p>` element
|
|
91
|
+
- **Heading 1–4** → use the DS's heading component at the matching level, or native `<h1>`–`<h4>` elements
|
|
92
|
+
- **No interaction** → this component has no event handling, state, or store binding
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Single-line text input field that 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
|
|
|
@@ -14,124 +14,71 @@ Renders a single-line editable text field. It is the simplest and most foundatio
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `TextInput`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Text`
|
|
17
|
-
- **Registration key:** `TextInput` (in
|
|
17
|
+
- **Registration key:** `TextInput` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
|
|
|
21
|
+
| Name | Type | Description |
|
|
22
22
|
| --------------- | ---------------- | ------------------------------------------------------- |
|
|
23
23
|
| `fieldMetadata` | `any` (optional) | Metadata object; used to read `maxLength` for the input |
|
|
24
24
|
|
|
25
|
-
All other
|
|
25
|
+
All other inputs come from the project's field input contract (see prerequisite skill).
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
import type { PConnFieldProps } from '@pega/sdk-react';
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Component Skeleton
|
|
27
|
+
## Implementation Structure
|
|
32
28
|
|
|
33
29
|
The foundational field component — simplest pattern. All text-like fields (Email, URL, Integer, Phone) follow this structure with minor variations.
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// 2. Destructure props
|
|
50
|
-
const {
|
|
51
|
-
getPConnect, label, required, disabled, value = '',
|
|
52
|
-
validatemessage, status, readOnly, testId, fieldMetadata,
|
|
53
|
-
helperText, displayMode, hideLabel, placeholder,
|
|
54
|
-
} = props;
|
|
55
|
-
|
|
56
|
-
// 3. PConnect setup
|
|
57
|
-
const pConn = getPConnect();
|
|
58
|
-
const actions = pConn.getActionsApi();
|
|
59
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
60
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
61
|
-
const maxLength = fieldMetadata?.maxLength;
|
|
62
|
-
|
|
63
|
-
// 4. State + readOnly prop
|
|
64
|
-
const [inputValue, setInputValue] = useState('');
|
|
65
|
-
let readOnlyProp = {};
|
|
66
|
-
|
|
67
|
-
// 5. useEffect: sync from store — deps: [value]
|
|
68
|
-
useEffect(() => { setInputValue(value); }, [value]);
|
|
69
|
-
|
|
70
|
-
// 6. Display mode returns
|
|
71
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
72
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
73
|
-
}
|
|
74
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
75
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// 7. Read-only prop
|
|
79
|
-
if (readOnly) readOnlyProp = { readOnly: true };
|
|
80
|
-
|
|
81
|
-
// 8. Test ID + handlers
|
|
82
|
-
const testProps: any = { 'data-test-id': testId };
|
|
83
|
-
function handleChange(event) { setInputValue(event?.target?.value); }
|
|
84
|
-
function handleBlur() { handleEvent(actions, 'changeNblur', propName, inputValue); }
|
|
85
|
-
|
|
86
|
-
// 9. Main render — single-line text input
|
|
87
|
-
// Key props:
|
|
88
|
-
// - fullWidth, variant: readOnly ? 'standard' : 'outlined', size: 'small'
|
|
89
|
-
// - value: inputValue, onChange: handleChange
|
|
90
|
-
// - onBlur: !readOnly ? handleBlur : undefined
|
|
91
|
-
// - label, helperText: helperTextToDisplay, placeholder: placeholder ?? ''
|
|
92
|
-
// - required, disabled, error: status === 'error'
|
|
93
|
-
// - slotProps: { input: { ...readOnlyProp, inputProps: { maxLength, ...testProps } } }
|
|
94
|
-
return <TextFieldWidget ... />;
|
|
95
|
-
}
|
|
96
|
-
```
|
|
31
|
+
**Module Setup:** The component depends on the project's event-commit utility (for committing value changes to the store) and the project's component registry (to resolve the `FieldValueList` display component). Define the input contract as an extension of the project's field input contract, adding an optional `fieldMetadata` field.
|
|
32
|
+
|
|
33
|
+
**Main Component Logic** — steps in order:
|
|
34
|
+
|
|
35
|
+
1. **Registry lookup** — resolve `FieldValueList` via the project's component registry.
|
|
36
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required`, `disabled`, `value` (default `''`), `validatemessage`, `status`, `readOnly`, `testId`, `fieldMetadata`, `helperText`, `displayMode`, `hideLabel`, `placeholder`.
|
|
37
|
+
3. **PConnect setup** — obtain the PConnect instance, its actions API, and the bound property name; compute `helperTextToDisplay = validatemessage || helperText`, and `maxLength = fieldMetadata?.maxLength`.
|
|
38
|
+
4. **Local state and read-only flag** — `inputValue` initialized to `''`; declare a read-only configuration object (populated conditionally later).
|
|
39
|
+
5. **Sync from store** — a lifecycle effect watching `value` updates `inputValue` whenever `value` changes.
|
|
40
|
+
6. **Display mode returns** — `DISPLAY_ONLY` and `STACKED_LARGE_VAL` both return `FieldValueList` using the raw `value`, the latter with a stacked variant.
|
|
41
|
+
7. **Read-only flag** — set the read-only configuration to mark the input read-only only when `readOnly` is true.
|
|
42
|
+
8. **Test ID and handlers** — build a test-id attribute from `testId`; the change handler updates `inputValue` from the event's input value; the blur handler commits the value via the project's event-commit utility, passing the actions API, event type `'changeNblur'`, the property name, and `inputValue`.
|
|
43
|
+
9. **Render** — a single-line text input configured with: full width, a visually outlined style when editable and a flat/borderless style when read-only, small size, current `inputValue`, the change handler wired to update local state, the blur handler wired only when not read-only, `label`, `helperText: helperTextToDisplay`, `placeholder: placeholder ?? ''`, `required`, `disabled`, an error state when `status === 'error'`, and `maxLength` plus the read-only/test-id attributes applied to the underlying input element.
|
|
97
44
|
|
|
98
45
|
## Behavioral Contract
|
|
99
46
|
|
|
100
|
-
1. **Local state:** Maintain `inputValue` in local state (string). Initialize to `value`
|
|
101
|
-
2. **Sync from store:**
|
|
47
|
+
1. **Local state:** Maintain `inputValue` in local state (string). Initialize to the `value` input (`''` default).
|
|
48
|
+
2. **Sync from store:** A lifecycle effect watching the `value` input updates `inputValue` whenever `value` changes.
|
|
102
49
|
3. **On change:** Update local `inputValue` state only (do NOT commit to store on every keystroke).
|
|
103
|
-
4. **On blur:** Commit to store by
|
|
104
|
-
5. **Read-only:** Render input with
|
|
50
|
+
4. **On blur:** Commit to store by invoking the project's event-commit utility with event type `'changeNblur'`, the property name, and `inputValue`.
|
|
51
|
+
5. **Read-only:** Render input with a read-only attribute set; use a visually borderless ("standard") style. Do NOT skip the blur handler unconditionally — only omit it when the field is read-only.
|
|
105
52
|
6. **maxLength:** Read from `fieldMetadata?.maxLength`; pass to the underlying input's `maxLength` attribute.
|
|
106
|
-
7. **testId:** Pass as
|
|
53
|
+
7. **testId:** Pass as a test-identifier attribute on the underlying input element.
|
|
107
54
|
|
|
108
55
|
## Display Mode Rendering
|
|
109
56
|
|
|
110
|
-
- **`DISPLAY_ONLY`:** Render
|
|
111
|
-
- **`STACKED_LARGE_VAL`:** Render
|
|
112
|
-
- Both modes use `value`
|
|
57
|
+
- **`DISPLAY_ONLY`:** Render the `FieldValueList` display component with `name` set to `label` (or empty when `hideLabel` is true) and `value` set to the raw `value` — display raw string value, no formatting.
|
|
58
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
59
|
+
- Both modes use the `value` input directly (not local state).
|
|
113
60
|
- Both modes short-circuit before any interactive rendering.
|
|
114
61
|
|
|
115
62
|
## Read-Only Rendering
|
|
116
63
|
|
|
117
|
-
Set
|
|
64
|
+
Set a read-only attribute on the underlying input element. Use a visually flat/borderless style (no border box). The editable outlined style switches to a flat (no outline) style when read-only.
|
|
118
65
|
|
|
119
66
|
## Visual Specifications
|
|
120
67
|
|
|
121
|
-
Derived from the reference component's
|
|
122
|
-
|
|
123
|
-
| Property | Standard (editable) | Read-only
|
|
124
|
-
| --------------- | ------------------------------------------------ |
|
|
125
|
-
| Width | 100% of container | 100% of container
|
|
126
|
-
| Height / size | Small (`height ~40px`) | Small
|
|
127
|
-
| Border | 1px solid (outlined) | None (
|
|
128
|
-
| Border radius | 4px | —
|
|
129
|
-
| Label | Floating label (above input when focused/filled) | Floating label
|
|
130
|
-
| Helper text | Shown below input | Shown below input
|
|
131
|
-
| Error state | Red border + red helper text | —
|
|
132
|
-
| Disabled | Reduced opacity (~0.38), not-allowed cursor | —
|
|
133
|
-
| Padding (input) | 8px 14px | —
|
|
134
|
-
| Font size | 0.875rem (14px) | 0.875rem
|
|
68
|
+
Derived from the reference component's styling:
|
|
69
|
+
|
|
70
|
+
| Property | Standard (editable) | Read-only |
|
|
71
|
+
| --------------- | ------------------------------------------------ | ----------------- |
|
|
72
|
+
| Width | 100% of container | 100% of container |
|
|
73
|
+
| Height / size | Small (`height ~40px`) | Small |
|
|
74
|
+
| Border | 1px solid (outlined) | None (flat style) |
|
|
75
|
+
| Border radius | 4px | — |
|
|
76
|
+
| Label | Floating label (above input when focused/filled) | Floating label |
|
|
77
|
+
| Helper text | Shown below input | Shown below input |
|
|
78
|
+
| Error state | Red border + red helper text | — |
|
|
79
|
+
| Disabled | Reduced opacity (~0.38), not-allowed cursor | — |
|
|
80
|
+
| Padding (input) | 8px 14px | — |
|
|
81
|
+
| Font size | 0.875rem (14px) | 0.875rem |
|
|
135
82
|
|
|
136
83
|
**CSS-only implementation notes:**
|
|
137
84
|
|
|
@@ -141,34 +88,25 @@ Derived from the reference component's MUI props and styles:
|
|
|
141
88
|
|
|
142
89
|
## Edge Cases & Special Logic
|
|
143
90
|
|
|
144
|
-
- If `value`
|
|
145
|
-
- If `readOnly` is true, the
|
|
91
|
+
- If the `value` input is `undefined`, default to `''` to keep the input controlled.
|
|
92
|
+
- If `readOnly` is true, the blur handler must be omitted — do not commit on blur for read-only.
|
|
146
93
|
- `maxLength` is optional; only apply the attribute if `fieldMetadata?.maxLength` is defined.
|
|
147
94
|
|
|
148
95
|
## Dependencies
|
|
149
96
|
|
|
150
|
-
-
|
|
151
|
-
- `
|
|
97
|
+
- The project's event-commit utility — for committing value to store.
|
|
98
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
152
99
|
- No third-party UI libraries required beyond a basic text input element.
|
|
153
100
|
|
|
154
101
|
## Design System Mapping
|
|
155
102
|
|
|
156
|
-
**UI control type:** Single-line text input
|
|
157
|
-
|
|
158
|
-
Listed design systems are examples only.
|
|
159
|
-
|
|
160
|
-
| Design System | Recommended Component |
|
|
161
|
-
| ------------------ | --------------------------------------------------------- |
|
|
162
|
-
| Default (CSS only) | `<input type="text">` with floating label pattern |
|
|
163
|
-
| MUI | `<TextField variant='outlined' size='small' fullWidth />` |
|
|
164
|
-
| Ant Design | `<Input />` |
|
|
165
|
-
| Chakra UI | `<Input />` |
|
|
166
|
-
| Shadcn/ui | `<Input />` |
|
|
103
|
+
**UI control type:** Single-line text input.
|
|
167
104
|
|
|
168
|
-
When implementing in a specific design system, map the following
|
|
105
|
+
When implementing in a specific design system, map the following:
|
|
169
106
|
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
107
|
+
- **Text input** → use the DS's basic text input component
|
|
108
|
+
- **`status === 'error'`** → the DS's error/danger visual state
|
|
109
|
+
- **`helperText`** → the DS's helper/description text slot below the input
|
|
110
|
+
- **`label`** → the DS's field label (floating or static depending on the design system)
|
|
111
|
+
- **`disabled`** → the DS's disabled state
|
|
112
|
+
- **`required`** → the DS's required/asterisk indicator
|