@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
|
Select/dropdown field with options loaded from a data page, associated list, or deferred datasource. Includes localization of option labels.
|
|
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,11 +14,11 @@ Renders a single-select dropdown (select box). Options are loaded from a Pega da
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `Dropdown`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Picklist`
|
|
17
|
-
- **Registration key:** `Dropdown` (in
|
|
17
|
+
- **Registration key:** `Dropdown` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
|
|
|
21
|
+
| Name | Type | Description |
|
|
22
22
|
| -------------------- | -------------------- | ------------------------------------------------------------------- |
|
|
23
23
|
| `listType` | `string` | `'associated'` or `'datapage'` — determines how options are loaded |
|
|
24
24
|
| `datasource` | `any[]` (optional) | The raw datasource (array for associated, string name for datapage) |
|
|
@@ -29,168 +29,67 @@ Renders a single-select dropdown (select box). Options are loaded from a Pega da
|
|
|
29
29
|
| `fieldMetadata` | `any` (optional) | Field metadata for localization context |
|
|
30
30
|
| `onRecordChange` | `any` (optional) | Callback fired after a selection change |
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
deferDatasource?: boolean;
|
|
57
|
-
datasourceMetadata?: any;
|
|
58
|
-
parameters?: any;
|
|
59
|
-
columns: any[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default function Dropdown(props: DropdownProps) {
|
|
63
|
-
// 1. Registry lookup
|
|
64
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
65
|
-
|
|
66
|
-
// 2. Destructure props
|
|
67
|
-
const {
|
|
68
|
-
getPConnect, label, required, disabled, value = '',
|
|
69
|
-
validatemessage, status, readOnly, testId, helperText,
|
|
70
|
-
displayMode, deferDatasource, datasourceMetadata,
|
|
71
|
-
hideLabel, onRecordChange, fieldMetadata,
|
|
72
|
-
} = props;
|
|
73
|
-
let { placeholder = '' } = props;
|
|
74
|
-
const context = getPConnect().getContextName();
|
|
75
|
-
let { listType, parameters, datasource = [], columns = [] } = props;
|
|
76
|
-
placeholder = placeholder || 'Select...';
|
|
77
|
-
|
|
78
|
-
// 3. State
|
|
79
|
-
const [options, setOptions] = useState<IOption[]>([]);
|
|
80
|
-
const [theDatasource, setDatasource] = useState<any[] | null>(null);
|
|
81
|
-
|
|
82
|
-
// 4. PConnect setup
|
|
83
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
84
|
-
const thePConn = getPConnect();
|
|
85
|
-
const actionsApi = thePConn.getActionsApi();
|
|
86
|
-
const propName = (thePConn.getStateProps() as any).value;
|
|
87
|
-
const className = thePConn.getCaseInfo().getClassName();
|
|
88
|
-
const refName = propName?.slice(propName.lastIndexOf('.') + 1);
|
|
89
|
-
|
|
90
|
-
// 5. Render-time datasource comparison (NOT in useEffect)
|
|
91
|
-
if (!isDeepEqual(datasource, theDatasource)) {
|
|
92
|
-
setDatasource(datasource);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// 6. Deferred datasource transformation (same as AutoComplete)
|
|
96
|
-
// → reassigns listType, datasource, parameters, columns
|
|
97
|
-
|
|
98
|
-
// 7. Column preprocessing
|
|
99
|
-
columns = preProcessColumns(columns);
|
|
100
|
-
|
|
101
|
-
// 8. useEffect: associated options — deps: [theDatasource]
|
|
102
|
-
// → prepend placeholder option, call Utils.getOptionList
|
|
103
|
-
|
|
104
|
-
// 9. useEffect: datapage options — deps: []
|
|
105
|
-
// Guard: listType !== 'associated' && typeof datasource === 'string'
|
|
106
|
-
|
|
107
|
-
// 10. Localization metadata derivation
|
|
108
|
-
// → metaData, displayName, localeContext, localeClass, localeName, localePath
|
|
109
|
-
|
|
110
|
-
// 11. Display mode — resolve key→value, localize, return FieldValueList
|
|
111
|
-
if (displayMode) {
|
|
112
|
-
const resolvedValue = options.find(opt => opt.key === value)?.value || value;
|
|
113
|
-
const localizedValue = thePConn.getLocalizedValue(resolvedValue, localePath,
|
|
114
|
-
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName));
|
|
115
|
-
// return <FieldValueList ... value={localizedValue} />
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// 12. Read-only prop
|
|
119
|
-
let readOnlyProp = {};
|
|
120
|
-
if (readOnly) readOnlyProp = { readOnly: true };
|
|
121
|
-
|
|
122
|
-
// 13. Test ID + handleChange
|
|
123
|
-
const testProps: any = { 'data-test-id': testId };
|
|
124
|
-
const handleChange = (evt) => {
|
|
125
|
-
const selectedValue = evt.target.value === placeholder ? '' : evt.target.value;
|
|
126
|
-
handleEvent(actionsApi, 'changeNblur', propName, selectedValue);
|
|
127
|
-
if (onRecordChange) onRecordChange(evt);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
// 14. Main render — return null if options empty, otherwise select
|
|
131
|
-
// value: value === '' && !readOnly ? placeholder : value
|
|
132
|
-
// Options rendered with localized labels via thePConn.getLocalizedValue()
|
|
133
|
-
return options.length === 0 ? null : <SelectWidget ... />;
|
|
134
|
-
}
|
|
135
|
-
```
|
|
32
|
+
All other inputs come from the project's field input contract (see prerequisite skill).
|
|
33
|
+
|
|
34
|
+
## Implementation Structure
|
|
35
|
+
|
|
36
|
+
Follow this exact structure. Same helper functions as AutoComplete (`flattenParameters`, `preProcessColumns`, `getDisplayFieldsMetaData`) — see that skill file for their exact behavior.
|
|
37
|
+
|
|
38
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `FieldValueList`), the project's event-commit utility, a deep-equality utility (for datasource change detection), the project's utility helpers (for associated option list loading), and the project's data-page utility (for async data page fetching). Define an option type with `key: string` and `value: string`. Declare the same top-level helper functions used by AutoComplete (`flattenParameters`, `preProcessColumns`, `getDisplayFieldsMetaData`). Define the input contract as an extension of the project's field input contract, adding `datasource`, `onRecordChange`, `fieldMetadata`, `listType`, `deferDatasource`, `datasourceMetadata`, `parameters`, and `columns` fields.
|
|
39
|
+
|
|
40
|
+
**Main Component Logic** — steps in order:
|
|
41
|
+
|
|
42
|
+
1. **Registry lookup** — resolve `FieldValueList` via the project's component registry.
|
|
43
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required`, `disabled`, `value` (default `''`), `validatemessage`, `status`, `readOnly`, `testId`, `helperText`, `displayMode`, `deferDatasource`, `datasourceMetadata`, `hideLabel`, `onRecordChange`, `fieldMetadata`; separately receive `placeholder` (default `''`) as a reassignable variable since it may be overridden; also grab `context` via `getPConnect().getContextName()`, and `listType`, `parameters`, `datasource` (default `[]`), `columns` (default `[]`) as reassignable since they may be overridden. Default `placeholder` to `'Select...'` when empty.
|
|
44
|
+
3. **Local state** — `options` (array of option objects, default `[]`) and `theDatasource` (default `null`).
|
|
45
|
+
4. **PConnect setup** — `helperTextToDisplay = validatemessage || helperText`; obtain the PConnect instance, actions API, bound property name; derive `className` via `thePConn.getCaseInfo().getClassName()`; derive `refName` by taking the substring of the property name after its last `.`.
|
|
46
|
+
5. **Render-time datasource comparison (not in a lifecycle effect)** — if deep-equal comparison of incoming `datasource` vs cached `theDatasource` is false, update `theDatasource` directly during render to trigger the associated-list effect.
|
|
47
|
+
6. **Deferred datasource transformation** (same as AutoComplete) — reassigns `listType`, `datasource`, `parameters`, and `columns` when deferred.
|
|
48
|
+
7. **Column preprocessing** — apply `preProcessColumns(columns)`.
|
|
49
|
+
8. **Lifecycle effect: associated options** — watching `theDatasource`: prepend a placeholder option, then load options via the project's utility helper.
|
|
50
|
+
9. **Lifecycle effect: datapage options** — on mount only, guarded to skip when `listType === 'associated'`.
|
|
51
|
+
10. **Localization metadata derivation** — compute `metaData`, `displayName`, `localeContext`, `localeClass`, `localeName`, `localePath` (see Behavioral Contract item 10 for the exact derivation).
|
|
52
|
+
11. **Display mode** — when `displayMode` is set: resolve the display value by matching `value` against the `key` of an entry in `options` (falling back to the raw `value` if no match), localize it via `thePConn.getLocalizedValue(resolvedValue, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))`, and return `FieldValueList` with that localized value.
|
|
53
|
+
12. **Read-only flag** — build a read-only configuration, set to mark the input read-only only when `readOnly` is true.
|
|
54
|
+
13. **Test ID and change handler** — build a test-id attribute from `testId`; the change handler treats a selection equal to the placeholder as an empty string, commits via the project's event-commit utility with event type `'changeNblur'`, the property name, and the selected value, and invokes `onRecordChange` when provided.
|
|
55
|
+
14. **Render** — return `null` when `options` is empty (avoids rendering with no options); otherwise render the select widget with `value` set to the placeholder when `value === '' && !readOnly`, and options rendered with localized labels via `thePConn.getLocalizedValue()`.
|
|
136
56
|
|
|
137
57
|
## Behavioral Contract
|
|
138
58
|
|
|
139
|
-
1. **Options state:** Maintain `options` as `
|
|
140
|
-
2. **Datasource detection:** Use
|
|
59
|
+
1. **Options state:** Maintain `options` as an array of `{key: string, value: string}` objects. Initially empty — render nothing (`return null`) until options are populated (avoids design system warnings about undefined options).
|
|
60
|
+
2. **Datasource detection:** Use deep equality to compare incoming `datasource` input with cached `theDatasource` state. If different, update `theDatasource` to trigger a lifecycle effect.
|
|
141
61
|
3. **Deferred datasource transformation:** If `deferDatasource && datasourceMetadata?.datasource?.name`:
|
|
142
62
|
- Override `listType = 'datapage'`
|
|
143
|
-
- Set `datasource
|
|
63
|
+
- Set `datasource` to the metadata's datasource name (string page name)
|
|
144
64
|
- Flatten `parameters` from `{key: {name, value}}` format to `{name: value}` pairs
|
|
145
65
|
- Build `columns` from `propertyForDisplayText` and `propertyForValue`
|
|
146
66
|
4. **Column preprocessing:** Strip leading `.` from column `value` fields.
|
|
147
|
-
5. **Loading options for `associated` listType:** In
|
|
148
|
-
6. **Loading options for `datapage` listType:** In mount-time
|
|
67
|
+
5. **Loading options for `associated` listType:** In a lifecycle effect watching `theDatasource`, load options via the project's utility helper. Prepend a placeholder option `{key: placeholder, value: localizedPlaceholder}`.
|
|
68
|
+
6. **Loading options for `datapage` listType:** In a mount-time lifecycle effect, call the project's data-page utility. Map results using `getDisplayFieldsMetaData(columns)` to extract `key` and `value` per row.
|
|
149
69
|
7. **Placeholder:** Default `'Select...'` if not provided. Prepended as the first option for associated lists.
|
|
150
70
|
8. **On change:**
|
|
151
|
-
- If selected value equals `placeholder`, treat as empty string
|
|
152
|
-
- Commit via
|
|
153
|
-
- Fire `onRecordChange
|
|
154
|
-
9. **Read-only:** Set
|
|
155
|
-
10. **Localization metadata:** Derived from `fieldMetadata`:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
let displayName = metaData?.datasource?.propertyForDisplayText;
|
|
161
|
-
displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
|
|
162
|
-
const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
|
|
163
|
-
const localeClass = localeContext === 'datapage' ? '@baseclass' : className;
|
|
164
|
-
const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : refName;
|
|
165
|
-
const localePath = localeContext === 'datapage' ? displayName : localeName;
|
|
166
|
-
```
|
|
167
|
-
Where `className = thePConn.getCaseInfo().getClassName()` and `refName = propName?.slice(propName.lastIndexOf('.') + 1)`.
|
|
168
|
-
11. **Display mode rendering:** Uses a `displayFn` that resolves key→value from options, then localizes:
|
|
169
|
-
```
|
|
170
|
-
const resolvedValue = options.find(opt => opt.key === value)?.value || value;
|
|
171
|
-
return <FieldValueList value={thePConn.getLocalizedValue(resolvedValue, localePath,
|
|
172
|
-
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))} />;
|
|
173
|
-
```
|
|
174
|
-
12. **Select value when empty:** `value={value === '' && !readOnly ? placeholder : value}` — shows placeholder as selected when value is empty.
|
|
175
|
-
13. **Return null until options load:** `return options.length === 0 ? null : <Select ... />` — prevents rendering empty select.
|
|
176
|
-
14. **Option labels localized:** Each `<MenuItem>` label is wrapped in `thePConn.getLocalizedValue(option.value, localePath, localeRuleName)`.
|
|
71
|
+
- If selected value equals `placeholder`, treat as empty string.
|
|
72
|
+
- Commit via the project's event-commit utility with event type `'changeNblur'`, the property name, and the selected value.
|
|
73
|
+
- Fire `onRecordChange` if provided.
|
|
74
|
+
9. **Read-only:** Set the read-only attribute on the select input. Flat/borderless style. Change handler omitted.
|
|
75
|
+
10. **Localization metadata:** Derived from `fieldMetadata`: if `fieldMetadata` is an array, filter to the entry whose `classID` matches `className` and take the first match, otherwise use `fieldMetadata` directly, to get `metaData`. `displayName` is `metaData?.datasource?.propertyForDisplayText`, trimmed to the substring after its last `.`. `localeContext` is `'datapage'` when `metaData?.datasource?.tableType === 'DataPage'`, else `'associated'`. `localeClass` is `'@baseclass'` for datapage context, else `className`. `localeName` is `metaData?.datasource?.name` for datapage context, else `refName`. `localePath` is `displayName` for datapage context, else `localeName`. Where `className = thePConn.getCaseInfo().getClassName()` and `refName` is the substring of the property name after its last `.`.
|
|
76
|
+
11. **Display mode rendering:** Resolve the display value by matching `value` (the stored key) against `options` to find the corresponding `value` field (falling back to the raw `value` if no match), then localize it via `thePConn.getLocalizedValue(resolvedValue, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))` and render it inside `FieldValueList`.
|
|
77
|
+
12. **Select value when empty:** Show the placeholder as selected when `value` is empty and the field is not read-only.
|
|
78
|
+
13. **Return null until options load:** Prevents rendering an empty select.
|
|
79
|
+
14. **Option labels localized:** Each option's label is wrapped in `thePConn.getLocalizedValue(option.value, localePath, localeRuleName)`.
|
|
177
80
|
|
|
178
81
|
## Display Mode Rendering
|
|
179
82
|
|
|
180
|
-
Display modes use the **resolved display value** (the `value` string matching the selected `key`), NOT the raw stored key:
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
options.find(option => option.key === value)?.value || value
|
|
184
|
-
```
|
|
83
|
+
Display modes use the **resolved display value** (the `value` string matching the selected `key`), NOT the raw stored key: found by matching `value` against each option's `key` field and taking its `value` field (falling back to the raw `value` if no match found).
|
|
185
84
|
|
|
186
85
|
Both modes pass this resolved value through `pConn.getLocalizedValue()` for localization:
|
|
187
86
|
|
|
188
|
-
- **`DISPLAY_ONLY`:**
|
|
189
|
-
- **`STACKED_LARGE_VAL`:**
|
|
87
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to `label` (or empty when `hideLabel` is true) and `value` set to the localized display value.
|
|
88
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
190
89
|
|
|
191
90
|
## Read-Only Rendering
|
|
192
91
|
|
|
193
|
-
Set
|
|
92
|
+
Set the read-only attribute on the select element. Flat/borderless style. Change handler removed.
|
|
194
93
|
|
|
195
94
|
## Visual Specifications
|
|
196
95
|
|
|
@@ -198,36 +97,13 @@ Set `readOnly: true` on the select element. Flat/borderless variant. Change hand
|
|
|
198
97
|
| ------------------ | ------------------------------------ | --------------- |
|
|
199
98
|
| Width | 100% | 100% |
|
|
200
99
|
| Size | Small | Small |
|
|
201
|
-
| Variant | Outlined |
|
|
100
|
+
| Variant | Outlined | Flat/borderless |
|
|
202
101
|
| Placeholder option | First option in list (`'Select...'`) | Not shown |
|
|
203
102
|
| Options | Rendered as select menu items | — |
|
|
204
103
|
| Error state | Red border + red helper text | — |
|
|
205
104
|
| Label | Floating label | — |
|
|
206
105
|
|
|
207
|
-
**
|
|
208
|
-
|
|
209
|
-
```css
|
|
210
|
-
select {
|
|
211
|
-
width: 100%;
|
|
212
|
-
height: 40px;
|
|
213
|
-
border: 1px solid rgba(0, 0, 0, 0.23);
|
|
214
|
-
border-radius: 4px;
|
|
215
|
-
padding: 8px 12px;
|
|
216
|
-
font-size: 0.875rem;
|
|
217
|
-
}
|
|
218
|
-
select:focus {
|
|
219
|
-
border-color: #1976d2;
|
|
220
|
-
outline: none;
|
|
221
|
-
}
|
|
222
|
-
select.error {
|
|
223
|
-
border-color: #d32f2f;
|
|
224
|
-
}
|
|
225
|
-
select[readonly] {
|
|
226
|
-
border: none;
|
|
227
|
-
background: transparent;
|
|
228
|
-
pointer-events: none;
|
|
229
|
-
}
|
|
230
|
-
```
|
|
106
|
+
**Visual-only styling notes:** The select element spans full width at a fixed ~40px height, with a 1px solid outlined border and 4px border radius. On focus, the border switches to an accent color (no default browser outline). In an error state, the border switches to red. When read-only, the border is removed, the background becomes transparent, and pointer interaction is disabled.
|
|
231
107
|
|
|
232
108
|
## Edge Cases & Special Logic
|
|
233
109
|
|
|
@@ -236,25 +112,25 @@ select[readonly] {
|
|
|
236
112
|
- `localeContext`: `'datapage'` if `tableType === 'DataPage'`, else `'associated'`
|
|
237
113
|
- `localeClass`: `'@baseclass'` for datapage, else the case className
|
|
238
114
|
- `localeName`, `localePath` derived from datasource name and display text property
|
|
239
|
-
-
|
|
115
|
+
- Display mode check must resolve the key→value mapping before localizing and rendering.
|
|
240
116
|
|
|
241
117
|
## Dependencies
|
|
242
118
|
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
-
|
|
246
|
-
-
|
|
247
|
-
- `
|
|
119
|
+
- A deep-equality utility — for datasource change detection.
|
|
120
|
+
- The project's utility helpers — for associated list option loading.
|
|
121
|
+
- The project's data-page utility — for async datapage fetch.
|
|
122
|
+
- The project's event-commit utility.
|
|
123
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
248
124
|
|
|
249
125
|
## Design System Mapping
|
|
250
126
|
|
|
251
127
|
**UI control type:** Single-select dropdown / select box.
|
|
252
128
|
|
|
253
|
-
|
|
129
|
+
When implementing in a specific design system, map the following:
|
|
254
130
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
131
|
+
- **Select/dropdown** → use the DS's select component with option items
|
|
132
|
+
- **Placeholder option** → prepend as the first option for associated lists
|
|
133
|
+
- **Option labels** → localize via `pConn.getLocalizedValue()` before display
|
|
134
|
+
- **Read-only mode** → flat/borderless style with read-only attribute
|
|
135
|
+
- **Error state** → the DS's error/danger visual state
|
|
136
|
+
- **Return null until loaded** → do not render an empty select
|
|
@@ -2,176 +2,98 @@
|
|
|
2
2
|
|
|
3
3
|
Email input field with a leading mail icon, 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 single-line text input of type `email` with a leading mail icon adornment. Provides browser-native email validation via `
|
|
11
|
+
Renders a single-line text input of type `email` with a leading mail icon adornment. Provides browser-native email validation via the `email` input type. Delegates read-only rendering to the `TextInput` component.
|
|
12
12
|
|
|
13
13
|
## Pega Metadata
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `Email`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Text-Email`
|
|
17
|
-
- **Registration key:** `Email` (in
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
No
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// 1. Registry lookups
|
|
41
|
-
const TextInput = getComponentFromRegistry('TextInput');
|
|
42
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
43
|
-
|
|
44
|
-
// 2. Destructure props
|
|
45
|
-
const {
|
|
46
|
-
getPConnect, label, required, disabled, value = '',
|
|
47
|
-
validatemessage, status, readOnly, testId,
|
|
48
|
-
helperText, displayMode, hideLabel, placeholder,
|
|
49
|
-
} = props;
|
|
50
|
-
|
|
51
|
-
// 3. PConnect setup
|
|
52
|
-
const pConn = getPConnect();
|
|
53
|
-
const actions = pConn.getActionsApi();
|
|
54
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
55
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
56
|
-
|
|
57
|
-
// 4. State
|
|
58
|
-
const [inputValue, setInputValue] = useState('');
|
|
59
|
-
|
|
60
|
-
// 5. useEffect: sync from store — deps: [value]
|
|
61
|
-
useEffect(() => { setInputValue(value); }, [value]);
|
|
62
|
-
|
|
63
|
-
// 6. Display mode returns
|
|
64
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
65
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
66
|
-
}
|
|
67
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
68
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// 7. Read-only return (delegates entirely to TextInput — no mail icon)
|
|
72
|
-
if (readOnly) {
|
|
73
|
-
return <TextInput {...props} />;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// 8. Test ID + event handlers
|
|
77
|
-
const testProps: any = { 'data-test-id': testId };
|
|
78
|
-
function handleChange(event) { setInputValue(event?.target?.value); }
|
|
79
|
-
function handleBlur() { handleEvent(actions, 'changeNblur', propName, inputValue); }
|
|
80
|
-
|
|
81
|
-
// 9. Main render — email input with leading mail icon
|
|
82
|
-
// Key props:
|
|
83
|
-
// - fullWidth, variant: 'outlined', size: 'small'
|
|
84
|
-
// - type: 'email'
|
|
85
|
-
// - value: inputValue, onChange: handleChange
|
|
86
|
-
// - onBlur: !readOnly ? handleBlur : undefined
|
|
87
|
-
// - label, helperText: helperTextToDisplay, placeholder: placeholder ?? ''
|
|
88
|
-
// - required, disabled, error: status === 'error'
|
|
89
|
-
// - startAdornment: mail/envelope icon
|
|
90
|
-
// - inputProps: { ...testProps }
|
|
91
|
-
return <EmailInput ... />;
|
|
92
|
-
}
|
|
93
|
-
```
|
|
17
|
+
- **Registration key:** `Email` (in the project's component map)
|
|
18
|
+
|
|
19
|
+
## Inputs (component-specific)
|
|
20
|
+
|
|
21
|
+
No inputs beyond the project's field input contract (see prerequisite skill).
|
|
22
|
+
|
|
23
|
+
## Implementation Structure
|
|
24
|
+
|
|
25
|
+
Follow this exact structure. Replace the mail icon and text field with equivalents from your chosen design system.
|
|
26
|
+
|
|
27
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `TextInput` and `FieldValueList`) and the project's event-commit utility (for committing value changes to the store). Define the input contract as the project's field input contract with no additional fields.
|
|
28
|
+
|
|
29
|
+
**Main Component Logic** — steps in order:
|
|
30
|
+
|
|
31
|
+
1. **Registry lookups** — resolve `TextInput` and `FieldValueList` via the project's component registry.
|
|
32
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required`, `disabled`, `value` (default `''`), `validatemessage`, `status`, `readOnly`, `testId`, `helperText`, `displayMode`, `hideLabel`, `placeholder`.
|
|
33
|
+
3. **PConnect setup** — obtain the PConnect instance, its actions API, and the bound property name; compute `helperTextToDisplay = validatemessage || helperText`.
|
|
34
|
+
4. **Local state** — `inputValue` initialized to `''`.
|
|
35
|
+
5. **Sync from store** — a lifecycle effect watching `value` updates `inputValue` whenever `value` changes.
|
|
36
|
+
6. **Display mode returns** — `DISPLAY_ONLY` and `STACKED_LARGE_VAL` both return `FieldValueList` using the raw `value`, the latter with a stacked variant.
|
|
37
|
+
7. **Read-only return** — when `readOnly` is true, render the `TextInput` component with all inputs passed through directly (full delegation; no mail icon in read-only mode).
|
|
38
|
+
8. **Test ID and event 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`.
|
|
39
|
+
9. **Render** — an email input with a leading mail icon, configured with: full width, an outlined style, small size, input type `email`, 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'`, a start-adornment slot containing a mail/envelope icon, and the test-id attribute applied to the underlying input element.
|
|
94
40
|
|
|
95
41
|
## Behavioral Contract
|
|
96
42
|
|
|
97
|
-
1. **Local state:** Maintain `inputValue` (string). Initialize from `value`
|
|
98
|
-
2. **Sync from store:**
|
|
99
|
-
3. **On change:** Update local state only (`
|
|
100
|
-
4. **On blur:** Commit via
|
|
101
|
-
5. **Input type:** Use `
|
|
102
|
-
6. **Read-only:** Delegate entirely to `TextInput` component
|
|
43
|
+
1. **Local state:** Maintain `inputValue` (string). Initialize from the `value` input (`''` default).
|
|
44
|
+
2. **Sync from store:** A lifecycle effect watching `value` updates `inputValue`.
|
|
45
|
+
3. **On change:** Update local state only (set `inputValue` from the event's input value).
|
|
46
|
+
4. **On blur:** Commit via the project's event-commit utility with event type `'changeNblur'`, the property name, and `inputValue`.
|
|
47
|
+
5. **Input type:** Use an `email`-typed input for browser-native email format validation.
|
|
48
|
+
6. **Read-only:** Delegate entirely to the `TextInput` component, passing all inputs through. Do NOT render the email-specific UI.
|
|
103
49
|
|
|
104
50
|
## Display Mode Rendering
|
|
105
51
|
|
|
106
|
-
- **`DISPLAY_ONLY`:**
|
|
107
|
-
- **`STACKED_LARGE_VAL`:**
|
|
52
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to `label` (or empty when `hideLabel` is true) and `value` set to the raw `value` — raw email string, no formatting.
|
|
53
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
108
54
|
|
|
109
55
|
## Read-Only Rendering
|
|
110
56
|
|
|
111
|
-
Delegate to `TextInput
|
|
57
|
+
Delegate to `TextInput`, passing all inputs through. This means the mail icon adornment is NOT shown in read-only mode.
|
|
112
58
|
|
|
113
59
|
## Visual Specifications
|
|
114
60
|
|
|
115
|
-
Derived from the reference component's
|
|
116
|
-
|
|
117
|
-
| Property | Value
|
|
118
|
-
| ------------- |
|
|
119
|
-
| Width | 100%
|
|
120
|
-
| Size | Small (~40px height)
|
|
121
|
-
| Variant | Outlined
|
|
122
|
-
| Leading icon | Mail/envelope icon (
|
|
123
|
-
| Icon color | Inherits text color
|
|
124
|
-
| Border | 1px solid outlined
|
|
125
|
-
| Border radius | 4px
|
|
126
|
-
| Error state | Red border + red helper text
|
|
127
|
-
| Helper text | Below input
|
|
128
|
-
| Placeholder | From `placeholder`
|
|
129
|
-
|
|
130
|
-
**
|
|
131
|
-
|
|
132
|
-
```css
|
|
133
|
-
.email-input-wrapper {
|
|
134
|
-
position: relative;
|
|
135
|
-
display: flex;
|
|
136
|
-
align-items: center;
|
|
137
|
-
width: 100%;
|
|
138
|
-
border: 1px solid rgba(0, 0, 0, 0.23);
|
|
139
|
-
border-radius: 4px;
|
|
140
|
-
padding: 8px 14px 8px 36px; /* left padding for icon */
|
|
141
|
-
}
|
|
142
|
-
.email-input-icon {
|
|
143
|
-
position: absolute;
|
|
144
|
-
left: 10px;
|
|
145
|
-
color: rgba(0, 0, 0, 0.54);
|
|
146
|
-
pointer-events: none;
|
|
147
|
-
}
|
|
148
|
-
.email-input-wrapper.error {
|
|
149
|
-
border-color: #d32f2f;
|
|
150
|
-
}
|
|
151
|
-
```
|
|
61
|
+
Derived from the reference component's styling:
|
|
62
|
+
|
|
63
|
+
| Property | Value |
|
|
64
|
+
| ------------- | --------------------------------------------- |
|
|
65
|
+
| Width | 100% |
|
|
66
|
+
| Size | Small (~40px height) |
|
|
67
|
+
| Variant | Outlined |
|
|
68
|
+
| Leading icon | Mail/envelope icon (start-adornment position) |
|
|
69
|
+
| Icon color | Inherits text color |
|
|
70
|
+
| Border | 1px solid outlined |
|
|
71
|
+
| Border radius | 4px |
|
|
72
|
+
| Error state | Red border + red helper text |
|
|
73
|
+
| Helper text | Below input |
|
|
74
|
+
| Placeholder | From the `placeholder` input (`''` default) |
|
|
75
|
+
|
|
76
|
+
**Visual-only styling notes:** The wrapper element is a flex container spanning the full input width, with a 1px solid outlined border (`rgba(0, 0, 0, 0.23)`) and 4px border radius. Left padding is increased (36px) to make room for the icon. The icon itself is absolutely positioned near the left edge (10px), colored with a muted text tone (`rgba(0, 0, 0, 0.54)`), and marked non-interactive (`pointer-events: none`) so clicks pass through to the input. In the error state, the wrapper border color switches to red (`#d32f2f`).
|
|
152
77
|
|
|
153
78
|
## Edge Cases & Special Logic
|
|
154
79
|
|
|
155
|
-
- The `
|
|
80
|
+
- The `email` input type triggers browser-native validation — this is intentional and supplements Pega's server-side validation.
|
|
156
81
|
- In read-only mode, the full delegation to `TextInput` means the component renders without the mail icon adornment.
|
|
157
|
-
-
|
|
82
|
+
- The blur handler is only attached when the field is not read-only.
|
|
158
83
|
|
|
159
84
|
## Dependencies
|
|
160
85
|
|
|
161
|
-
-
|
|
162
|
-
- `
|
|
163
|
-
- `
|
|
164
|
-
- A mail/envelope icon (e.g., from an icon library or inline SVG)
|
|
86
|
+
- The project's event-commit utility.
|
|
87
|
+
- The project's component registry, resolving `TextInput` — for read-only delegation.
|
|
88
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
89
|
+
- A mail/envelope icon (e.g., from an icon library or inline SVG).
|
|
165
90
|
|
|
166
91
|
## Design System Mapping
|
|
167
92
|
|
|
168
93
|
**UI control type:** Email text input with leading icon adornment.
|
|
169
94
|
|
|
170
|
-
|
|
95
|
+
When implementing in a specific design system, map the following:
|
|
171
96
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
| MUI | `<TextField type='email' InputProps={{ startAdornment: <MailIcon /> }} />` |
|
|
176
|
-
| Ant Design | `<Input type="email" prefix={<MailOutlined />} />` |
|
|
177
|
-
| Chakra UI | `<InputGroup><InputLeftElement><EmailIcon /></InputLeftElement><Input type="email" /></InputGroup>` |
|
|
97
|
+
- **Email input** → use the DS's text input with input type set to `email`
|
|
98
|
+
- **Leading mail icon** → use the DS's input adornment/prefix slot, or an absolutely-positioned icon if the DS has no adornment slot
|
|
99
|
+
- **Read-only mode** → delegate to the `TextInput` component (no icon shown)
|