@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
|
Telephone input field with country code selector, 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,132 +14,47 @@ Renders a telephone number input with an integrated country code selector (flag
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `Phone`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Text-Phone`
|
|
17
|
-
- **Registration key:** `Phone` (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 lookup
|
|
41
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
42
|
-
|
|
43
|
-
// 2. Destructure props — note: onChange is used in readOnly mode
|
|
44
|
-
const {
|
|
45
|
-
getPConnect, label, required, disabled, value = '',
|
|
46
|
-
validatemessage, status, onChange, readOnly, testId,
|
|
47
|
-
helperText, displayMode, hideLabel, placeholder,
|
|
48
|
-
} = props;
|
|
49
|
-
|
|
50
|
-
// 3. PConnect setup
|
|
51
|
-
const pConn = getPConnect();
|
|
52
|
-
const actions = pConn.getActionsApi();
|
|
53
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
54
|
-
|
|
55
|
-
// 4. State + sync
|
|
56
|
-
const [inputValue, setInputValue] = useState(value);
|
|
57
|
-
useEffect(() => setInputValue(value), [value]);
|
|
58
|
-
|
|
59
|
-
// 5. Derived values
|
|
60
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
61
|
-
let testProp = { 'data-test-id': testId };
|
|
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 — keeps phone widget but disables dropdown + sets input readOnly
|
|
72
|
-
// Uses onChange from PROPS (not local handler), value from PROPS (not state)
|
|
73
|
-
if (readOnly) {
|
|
74
|
-
return (
|
|
75
|
-
<div>
|
|
76
|
-
<PhoneInputWidget
|
|
77
|
-
defaultCountry="US" value={value} onChange={onChange}
|
|
78
|
-
disableDropdown={true}
|
|
79
|
-
slotProps={{ input: { readOnly: true, ...testProp } }}
|
|
80
|
-
/* + label, helperText, required, disabled, error, size, placeholder */
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// 8. Editable handlers
|
|
87
|
-
const handleChange = (inputVal) => { setInputValue(inputVal); };
|
|
88
|
-
const handleBlur = (event) => {
|
|
89
|
-
const phoneValue = event?.target?.value;
|
|
90
|
-
let phoneNumber = phoneValue.split(' ').slice(1).join();
|
|
91
|
-
phoneNumber = phoneNumber ? `+${phoneValue.replace(/\\D+/g, '')}` : '';
|
|
92
|
-
handleEvent(actions, 'changeNblur', propName, phoneNumber);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
// 9. Main render — phone input with country selector
|
|
96
|
-
// Key props:
|
|
97
|
-
// - fullWidth, variant: 'outlined', size: 'small'
|
|
98
|
-
// - defaultCountry: 'US'
|
|
99
|
-
// - value: inputValue, onChange: handleChange
|
|
100
|
-
// - onBlur: !readOnly ? handleBlur : undefined
|
|
101
|
-
// - label, helperText: helperTextToDisplay, placeholder: placeholder ?? ''
|
|
102
|
-
// - required, disabled, error: status === 'error'
|
|
103
|
-
// - slotProps: { input: { ...testProp } }
|
|
104
|
-
return <PhoneInputWidget ... />;
|
|
105
|
-
}
|
|
106
|
-
```
|
|
17
|
+
- **Registration key:** `Phone` (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 phone-input widget with an equivalent from your chosen design system / phone library.
|
|
26
|
+
|
|
27
|
+
**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). It also uses a phone-input library that provides a country-code picker with flag display and dial-code formatting. 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 lookup** — resolve `FieldValueList` via the project's component registry.
|
|
32
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required`, `disabled`, `value` (default `''`), `validatemessage`, `status`, `onChange` (note: this raw input is used directly in read-only mode), `readOnly`, `testId`, `helperText`, `displayMode`, `hideLabel`, `placeholder`.
|
|
33
|
+
3. **PConnect setup** — obtain the PConnect instance, its actions API, and the bound property name.
|
|
34
|
+
4. **Local state and sync** — `inputValue` initialized from `value`; a lifecycle effect watching `value` updates `inputValue` whenever it changes.
|
|
35
|
+
5. **Derived values** — `helperTextToDisplay = validatemessage || helperText` and a test-id attribute object built from `testId`.
|
|
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** — keeps the phone widget visible but disables the country dropdown and sets the input itself to read-only. Notably, this branch uses the raw `onChange` input (not a local handler) and the raw `value` input (not local state). Render the phone widget wrapped in a container element, configured with default country `US`, `value` set to the raw value, `onChange` set to the raw onChange input, country dropdown disabled, and the read-only/test-id attributes merged into the input element, alongside the usual label/helperText/required/disabled/error/size/placeholder configuration.
|
|
38
|
+
8. **Editable handlers** — the change handler updates local `inputValue` state only. The blur handler extracts the raw phone value from the event, strips the country-code prefix by splitting on spaces and dropping the first segment, then normalizes to E.164 format by stripping all non-digit characters and prefixing with `+` (or produces an empty string if nothing remains); it then commits via the project's event-commit utility with event type `'changeNblur'`, the property name, and the normalized phone number.
|
|
39
|
+
9. **Render** — a phone input with country selector, configured with: full width, an outlined style, small size, default country `US`, 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 the test-id attribute applied to the underlying input element.
|
|
107
40
|
|
|
108
41
|
## Behavioral Contract
|
|
109
42
|
|
|
110
|
-
1. **Local state:** Maintain `inputValue` (string). Initialize from `value`
|
|
43
|
+
1. **Local state:** Maintain `inputValue` (string). Initialize from `value` input. A lifecycle effect watching `value` updates `inputValue`.
|
|
111
44
|
2. **Default country:** `'US'` — the country code selector defaults to United States.
|
|
112
45
|
3. **On change (editable):** Update local `inputValue` state with the formatted phone string from the library callback.
|
|
113
|
-
4. **On blur (editable):** Extract and normalize the phone number to E.164 format:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
let phoneNumber = phoneValue.split(' ').slice(1).join() // remove country code prefix
|
|
117
|
-
phoneNumber = phoneNumber ? `+${phoneValue.replace(/\D+/g, '')}` : ''
|
|
118
|
-
handleEvent(actions, 'changeNblur', propName, phoneNumber)
|
|
119
|
-
```
|
|
120
|
-
5. **Read-only:** Render the phone input with `readOnly: true` on the input element and `disableDropdown: true` (country picker dropdown disabled). Keep the country flag/code visible but non-interactive. `onBlur` and `onChange` are NOT committed — use the `onChange` prop from the component itself but disable dropdown.
|
|
121
|
-
6. **testId:** Pass as attribute on the input element.
|
|
46
|
+
4. **On blur (editable):** Extract and normalize the phone number to E.164 format: read the raw target value from the event, strip the country-code prefix by splitting the string on spaces and discarding the first segment, then strip all non-digit characters from the original value and prefix the result with `+` (producing an empty string if the stripped-prefix segment was empty). Commit the normalized value via the project's event-commit utility with event type `'changeNblur'`, the property name, and the normalized phone number.
|
|
47
|
+
5. **Read-only:** Render the phone input with the read-only attribute on the input element and country dropdown disabled. Keep the country flag/code visible but non-interactive. The `onChange` handler used is the raw platform-wired `onChange` input (not the local state updater). Do NOT call the event-commit utility in read-only mode.
|
|
48
|
+
6. **testId:** Pass as a test-identifier attribute on the input element.
|
|
122
49
|
|
|
123
50
|
## Display Mode Rendering
|
|
124
51
|
|
|
125
|
-
- **`DISPLAY_ONLY`:**
|
|
126
|
-
- **`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 phone string.
|
|
53
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
127
54
|
|
|
128
55
|
## Read-Only Rendering
|
|
129
56
|
|
|
130
|
-
Render phone input with
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
<div>
|
|
134
|
-
<PhoneInput
|
|
135
|
-
readOnly: true on input
|
|
136
|
-
disableDropdown={true}
|
|
137
|
-
onChange={onChange} // from props — not local handler
|
|
138
|
-
value={value}
|
|
139
|
-
defaultCountry='US'
|
|
140
|
-
/>
|
|
141
|
-
</div>
|
|
142
|
-
```
|
|
57
|
+
Render the phone input wrapped in a container element, with a read-only attribute applied to the input element and the country dropdown disabled. The `onChange` handler passed through is the raw `onChange` from the field input contract (not a local handler), and `value` is the raw input value (not local state), with default country `US` still applied.
|
|
143
58
|
|
|
144
59
|
## Visual Specifications
|
|
145
60
|
|
|
@@ -153,58 +68,33 @@ Render phone input with `readOnly: true` and `disableDropdown: true` on the coun
|
|
|
153
68
|
| Error state | Red border + red helper text | — |
|
|
154
69
|
| Helper text | Below input | Below input |
|
|
155
70
|
|
|
156
|
-
**
|
|
157
|
-
For a CSS-only implementation, create a two-part input:
|
|
158
|
-
|
|
159
|
-
```css
|
|
160
|
-
.phone-input-wrapper {
|
|
161
|
-
display: flex;
|
|
162
|
-
border: 1px solid rgba(0, 0, 0, 0.23);
|
|
163
|
-
border-radius: 4px;
|
|
164
|
-
overflow: hidden;
|
|
165
|
-
}
|
|
166
|
-
.phone-country-select {
|
|
167
|
-
border: none;
|
|
168
|
-
border-right: 1px solid rgba(0, 0, 0, 0.23);
|
|
169
|
-
padding: 0 8px;
|
|
170
|
-
background: none;
|
|
171
|
-
}
|
|
172
|
-
.phone-number-input {
|
|
173
|
-
flex: 1;
|
|
174
|
-
border: none;
|
|
175
|
-
padding: 8px 12px;
|
|
176
|
-
font-size: 0.875rem;
|
|
177
|
-
outline: none;
|
|
178
|
-
}
|
|
179
|
-
```
|
|
71
|
+
**Visual-only styling notes:** For a CSS-only implementation, build a two-part flex container: an outer wrapper with a 1px solid outlined border, 4px border radius, and hidden overflow so the two inner sections share one visual border; a country-select segment with no border of its own but a right-side divider border, horizontal padding, and a transparent background; and a number-input segment that flexes to fill remaining space, has no border, standard input padding, small font size, and no focus outline (since the outer wrapper conveys the focus/border state).
|
|
180
72
|
|
|
181
73
|
## Edge Cases & Special Logic
|
|
182
74
|
|
|
183
75
|
- **E.164 normalization on blur:** Strip all non-digit chars from the full value (including country code), then prepend `+`. If the result after stripping the country part is empty, store `''`.
|
|
184
|
-
- **Read-only uses `onChange`
|
|
185
|
-
-
|
|
76
|
+
- **Read-only uses the raw `onChange` input** (not the local change handler) — this is the platform-wired handler, not the local state updater. Do NOT call the event-commit utility in read-only mode.
|
|
77
|
+
- Country dropdown is disabled in read-only — prevents country switching.
|
|
186
78
|
- The library provides the formatted display value (e.g., `+1 (555) 123-4567`) in the callback; we normalize it to E.164 only on blur.
|
|
187
79
|
|
|
188
80
|
## Dependencies
|
|
189
81
|
|
|
190
|
-
- A phone input library with country code selector and E.164 formatting support
|
|
191
|
-
-
|
|
192
|
-
- `
|
|
82
|
+
- A phone input library with country code selector and E.164 formatting support.
|
|
83
|
+
- The project's event-commit utility.
|
|
84
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
193
85
|
|
|
194
86
|
**For CSS-only / non-library implementations:**
|
|
195
87
|
|
|
196
|
-
- Use a `<select>` for country code + a text `<input>` for the number.
|
|
88
|
+
- Use a `<select>` for country code + a text `<input type="tel">` for the number.
|
|
197
89
|
- On blur, combine dial code + number and strip non-digits, then format as `+{digits}`.
|
|
198
90
|
|
|
199
91
|
## Design System Mapping
|
|
200
92
|
|
|
201
93
|
**UI control type:** Telephone input with integrated country code selector.
|
|
202
94
|
|
|
203
|
-
|
|
95
|
+
When implementing in a specific design system, map the following:
|
|
204
96
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
| Ant Design | `<Input addonBefore={countrySelect}>` |
|
|
210
|
-
| Chakra UI | `<InputGroup>` with `<InputLeftAddon>` for country |
|
|
97
|
+
- **Phone input** → use the DS's phone/telephone input or a third-party phone-input library compatible with the project's framework
|
|
98
|
+
- **Country code selector** → a dropdown with flag + dial code as a prefix/adornment on the input
|
|
99
|
+
- **Read-only mode** → keep the country flag visible but disable the dropdown and set the input to read-only
|
|
100
|
+
- **E.164 normalization** → perform on blur before committing to the store
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Radio button group field with optional card-style variant and localized 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,126 +14,55 @@ Renders a group of radio buttons for single-selection from a list of options. Su
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `RadioButtons`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Picklist-Radio`
|
|
17
|
-
- **Registration key:** `RadioButtons` (in
|
|
17
|
+
- **Registration key:** `RadioButtons` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
|
|
|
21
|
+
| Name | Type | Description |
|
|
22
22
|
| ---------------------- | -------------------- | ------------------------------------------------------------------------------- |
|
|
23
23
|
| `inline` | `boolean` | If `true`, render radio buttons in a horizontal row; if `false`, vertical stack |
|
|
24
24
|
| `fieldMetadata` | `any` (optional) | For localization context (tableType, datasource name, display text property) |
|
|
25
25
|
| `variant` | `string` (optional) | `'card'` — renders options as selectable cards instead of radio buttons |
|
|
26
26
|
| `hideFieldLabels` | `boolean` (optional) | Hide field labels inside card variant |
|
|
27
|
-
| `additionalProps` | `any` (optional) | Extra
|
|
27
|
+
| `additionalProps` | `any` (optional) | Extra inputs passed to `SelectableCard` in card variant |
|
|
28
28
|
| `imagePosition` | `string` (optional) | Card image position: `'inline-start'`, `'inline-end'`, or block |
|
|
29
29
|
| `imageSize` | `string` (optional) | Card image size |
|
|
30
30
|
| `showImageDescription` | `boolean` (optional) | Whether to show image description in cards |
|
|
31
31
|
| `datasource` | `any` (optional) | Datasource for card variant |
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
All other inputs come from the project's field input contract (see prerequisite skill).
|
|
34
|
+
|
|
35
|
+
## Implementation Structure
|
|
34
36
|
|
|
35
37
|
Follow this exact structure. Includes localization metadata derivation (same pattern as Dropdown).
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
showImageDescription?: boolean;
|
|
53
|
-
datasource?: any;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default function RadioButtons(props: RadioButtonsProps) {
|
|
57
|
-
// 1. Registry lookups
|
|
58
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
59
|
-
const SelectableCard = getComponentFromRegistry('SelectableCard');
|
|
60
|
-
|
|
61
|
-
// 2. Destructure props
|
|
62
|
-
const {
|
|
63
|
-
getPConnect, label, value = '', readOnly, validatemessage,
|
|
64
|
-
helperText, status, required, inline, displayMode, hideLabel,
|
|
65
|
-
fieldMetadata, variant, hideFieldLabels, additionalProps,
|
|
66
|
-
datasource, imagePosition, imageSize, showImageDescription,
|
|
67
|
-
} = props;
|
|
68
|
-
|
|
69
|
-
// 3. State
|
|
70
|
-
const [theSelectedButton, setSelectedButton] = useState(value);
|
|
71
|
-
|
|
72
|
-
// 4. PConnect setup
|
|
73
|
-
const thePConn = getPConnect();
|
|
74
|
-
const theConfigProps = thePConn.getConfigProps();
|
|
75
|
-
const actionsApi = thePConn.getActionsApi();
|
|
76
|
-
const propName = (thePConn.getStateProps() as any).value;
|
|
77
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
78
|
-
const className = thePConn.getCaseInfo().getClassName();
|
|
79
|
-
|
|
80
|
-
// 5. Localization keys (same pattern as Dropdown)
|
|
81
|
-
let configProperty = (thePConn.getRawMetadata() as any)?.config?.value || '';
|
|
82
|
-
configProperty = configProperty.startsWith('@P') ? configProperty.substring(3) : configProperty;
|
|
83
|
-
configProperty = configProperty.startsWith('.') ? configProperty.substring(1) : configProperty;
|
|
84
|
-
const metaData = Array.isArray(fieldMetadata)
|
|
85
|
-
? fieldMetadata.filter(f => f?.classID === className)[0] : fieldMetadata;
|
|
86
|
-
let displayName = metaData?.datasource?.propertyForDisplayText;
|
|
87
|
-
displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
|
|
88
|
-
const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
|
|
89
|
-
const localeClass = localeContext === 'datapage' ? '@baseclass' : className;
|
|
90
|
-
const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : configProperty;
|
|
91
|
-
const localePath = localeContext === 'datapage' ? displayName : localeName;
|
|
92
|
-
|
|
93
|
-
// 6. Load options (synchronous)
|
|
94
|
-
const theOptions = Utils.getOptionList(theConfigProps, thePConn.getDataObject(''));
|
|
95
|
-
|
|
96
|
-
// 7. useEffect: sync selected from value — deps: [value]
|
|
97
|
-
useEffect(() => { setSelectedButton(value); }, [value]);
|
|
98
|
-
|
|
99
|
-
// 8. Display mode returns (with localization)
|
|
100
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
101
|
-
return <FieldValueList name={hideLabel ? '' : label}
|
|
102
|
-
value={thePConn.getLocalizedValue(value, localePath,
|
|
103
|
-
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))} />;
|
|
104
|
-
}
|
|
105
|
-
if (displayMode === 'STACKED_LARGE_VAL') { /* same with variant="stacked" */ }
|
|
106
|
-
|
|
107
|
-
// 9. Event handlers
|
|
108
|
-
const handleChange = (event) => {
|
|
109
|
-
handleEvent(actionsApi, 'changeNblur', propName, event.target.value);
|
|
110
|
-
};
|
|
111
|
-
const handleBlur = (event) => {
|
|
112
|
-
thePConn.getValidationApi().validate(event.target.value, '');
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
// 10. Card variant return (variant === 'card')
|
|
116
|
-
// → heading + grid + SelectableCard with type='radio'
|
|
117
|
-
|
|
118
|
-
// 11. Standard variant return
|
|
119
|
-
// FormControl > FormLabel > RadioGroup(row={inline}) >
|
|
120
|
-
// FormControlLabel per option (localized label) >
|
|
121
|
-
// FormHelperText
|
|
122
|
-
return <RadioGroupWidget ... />;
|
|
123
|
-
}
|
|
124
|
-
```
|
|
39
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `FieldValueList` and `SelectableCard`), the project's event-commit utility, and the project's utility helpers (for loading option lists). Define the input contract as an extension of the project's field input contract, adding `inline`, and optional `fieldMetadata`, `variant`, `hideFieldLabels`, `additionalProps`, `imagePosition`, `imageSize`, `showImageDescription`, and `datasource` fields.
|
|
40
|
+
|
|
41
|
+
**Main Component Logic** — steps in order:
|
|
42
|
+
|
|
43
|
+
1. **Registry lookups** — resolve `FieldValueList` and `SelectableCard` via the project's component registry.
|
|
44
|
+
2. **Receive inputs** — `getPConnect`, `label`, `value` (default `''`), `readOnly`, `validatemessage`, `helperText`, `status`, `required`, `inline`, `displayMode`, `hideLabel`, `fieldMetadata`, `variant`, `hideFieldLabels`, `additionalProps`, `datasource`, `imagePosition`, `imageSize`, `showImageDescription`.
|
|
45
|
+
3. **Local state** — `theSelectedButton` initialized from `value`.
|
|
46
|
+
4. **PConnect setup** — obtain the PConnect instance, its config inputs via `thePConn.getConfigProps()`, actions API, bound property name, `helperTextToDisplay = validatemessage || helperText`, and `className` via `thePConn.getCaseInfo().getClassName()`.
|
|
47
|
+
5. **Localization keys** (same pattern as Dropdown) — derive `configProperty` from the raw metadata config value (default `''`), stripping a leading `@P` prefix and then a leading `.`; derive `metaData`, `displayName`, `localeContext`, `localeClass`, `localeName`, and `localePath` the same way Dropdown does, except `localeName` falls back to `configProperty` (instead of `refName`) for the associated case.
|
|
48
|
+
6. **Load options synchronously** — load the option list via the project's utility helper using the component's config inputs and the PConnect data object (no async fetching).
|
|
49
|
+
7. **Sync effect** — a lifecycle effect watching `value` updates `theSelectedButton`.
|
|
50
|
+
8. **Display mode returns (with localization)** — `DISPLAY_ONLY` and `STACKED_LARGE_VAL` (the latter with a stacked variant) both return `FieldValueList` with `value` set to the localized display label via `thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))`.
|
|
51
|
+
9. **Event handlers** — the change handler commits immediately via the project's event-commit utility with event type `'changeNblur'`, the property name, and the selected value; the blur handler calls `thePConn.getValidationApi().validate(event.target.value, '')`.
|
|
52
|
+
10. **Card variant return** (`variant === 'card'`) — a heading plus a CSS grid wrapper containing a `SelectableCard` configured with `type='radio'`; see the Behavioral Contract "Card" section for the full input wiring.
|
|
53
|
+
11. **Standard variant return** — a form control containing a group label, a radio group (rendered as a horizontal row when `inline` is true) with one radio option per entry (each labeled with its localized text), and helper text below.
|
|
125
54
|
|
|
126
55
|
## Behavioral Contract
|
|
127
56
|
|
|
128
|
-
1. **Local state:** Maintain `theSelectedButton` (string). Initialize from `value`
|
|
129
|
-
2. **Options:** Load options
|
|
130
|
-
3. **On change:** Commit via
|
|
57
|
+
1. **Local state:** Maintain `theSelectedButton` (string). Initialize from the `value` input. A lifecycle effect watching `value` updates `theSelectedButton`.
|
|
58
|
+
2. **Options:** Load options via the project's utility helper — returns an array of `{key: string, value: string}` objects.
|
|
59
|
+
3. **On change:** Commit via the project's event-commit utility with event type `'changeNblur'`, the property name, and the selected value.
|
|
131
60
|
4. **On blur:** Validate via `pConn.getValidationApi().validate(event.target.value, '')`. Second arg is empty string (optional parameter).
|
|
132
|
-
5. **Inline layout:**
|
|
133
|
-
6. **Read-only:** Disable radio inputs (set `disabled` to `readOnly` value) — do NOT use a separate read-only component.
|
|
61
|
+
5. **Inline layout:** Render the radio group as a horizontal row when `inline` is true.
|
|
62
|
+
6. **Read-only:** Disable radio inputs (set `disabled` to the `readOnly` value) — do NOT use a separate read-only component.
|
|
134
63
|
7. **Localization:** Option labels are localized via `pConn.getLocalizedValue(option.value, localePath, localeRuleName)`.
|
|
135
64
|
8. **Localization keys derivation:**
|
|
136
|
-
- Strip `@P ` prefix and leading `.` from `configProperty` (from
|
|
65
|
+
- Strip `@P ` prefix and leading `.` from `configProperty` (from the raw metadata).
|
|
137
66
|
- `localeContext`: `'datapage'` if `fieldMetadata.datasource.tableType === 'DataPage'`, else `'associated'`.
|
|
138
67
|
- `localeClass`: `'@baseclass'` for datapage, else `className`.
|
|
139
68
|
- `localeName`: datapage name or property name.
|
|
@@ -141,89 +70,53 @@ export default function RadioButtons(props: RadioButtonsProps) {
|
|
|
141
70
|
|
|
142
71
|
### Variant: Standard (default)
|
|
143
72
|
|
|
144
|
-
Render a radio group with
|
|
73
|
+
Render a radio group with a form control, group label, radio group container, and individual radio option labels:
|
|
145
74
|
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
- Each `
|
|
149
|
-
-
|
|
150
|
-
- `
|
|
75
|
+
- Group label: the `label` input
|
|
76
|
+
- Radio group: value bound to `theSelectedButton`, change handler, blur handler wired only when not read-only, row layout when `inline` is true
|
|
77
|
+
- Each radio option: `value` set to `option.key`, label set to the localized `option.value`, radio control disabled when `readOnly` is true
|
|
78
|
+
- Helper text below for `helperTextToDisplay`
|
|
79
|
+
- Error state on the form control when `status === 'error'`
|
|
151
80
|
|
|
152
81
|
### Variant: Card (`variant === 'card'`)
|
|
153
82
|
|
|
154
|
-
Render a heading
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
onChange={handleChange}
|
|
167
|
-
image={{ imagePosition, imageSize, showImageDescription, imageField, imageDescription }}
|
|
168
|
-
setIsRadioCardSelected={displayMode !== 'DISPLAY_ONLY' ? setSelectedButton : undefined}
|
|
169
|
-
hideFieldLabels={hideFieldLabels}
|
|
170
|
-
additionalProps={additionalProps}
|
|
171
|
-
getPConnect={getPConnect}
|
|
172
|
-
/>
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
- `imageField`: `stateProps.image?.split('.').pop()`
|
|
178
|
-
- `imageDescription`: `stateProps.imageDescription?.split('.').pop()`
|
|
83
|
+
Render a heading with the `label`, then delegate to `SelectableCard`: a wrapping container with the heading (no top/bottom margin) followed by a CSS grid container (columns `repeat(auto-fit, minmax(min(200px, 100%), 1fr))`, gap `1rem`) holding a single `SelectableCard` configured with `type='radio'`, `dataSource` set to `datasource`, `recordKey` set to the last segment of the state's `value` path, `cardLabel` set to the last segment of the state's `primaryField` path, `radioBtnValue` set to `value`, `onChange` set to the change handler, an `image` config object (`imagePosition`, `imageSize`, `showImageDescription`, `imageField`, `imageDescription` — each derived by taking the last segment of the respective state path), `setIsRadioCardSelected` set to the state updater unless `displayMode === 'DISPLAY_ONLY'` (in which case `undefined`), `hideFieldLabels`, `additionalProps`, and `getPConnect`.
|
|
84
|
+
|
|
85
|
+
**Critical: state prop key mapping for the `image` config object:**
|
|
86
|
+
|
|
87
|
+
| SelectableCard image prop | Derived from state prop key | Transformation |
|
|
88
|
+
| ------------------------- | --------------------------- | ------------------------------- |
|
|
89
|
+
| `imageField` | `image` | Take the last segment after `.` |
|
|
90
|
+
| `imageDescription` | `imageDescription` | Take the last segment after `.` |
|
|
91
|
+
|
|
92
|
+
The state prop key for the image property path is **`image`** (NOT `imageField`). The `imageField` name only refers to the prop passed INTO SelectableCard — it is derived by extracting the last dot-separated segment from the state prop whose key is `image`. For example, if `stateProps.image` is `'.PhoneImage'`, then `imageField` becomes `'PhoneImage'`.
|
|
93
|
+
|
|
94
|
+
Similarly, `recordKey` is derived from `stateProps.value` (last segment), and `cardLabel` from `stateProps.primaryField` (last segment).
|
|
179
95
|
|
|
180
96
|
## Display Mode Rendering
|
|
181
97
|
|
|
182
98
|
Both modes render the localized display label of the selected option:
|
|
183
99
|
|
|
184
|
-
- **`DISPLAY_ONLY`:**
|
|
185
|
-
- **`STACKED_LARGE_VAL`:**
|
|
100
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to `label` (or empty when `hideLabel` is true) and `value` set to the localized value.
|
|
101
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
186
102
|
|
|
187
|
-
Where
|
|
103
|
+
Where the localized value is obtained via `pConn.getLocalizedValue(value, localePath, localeRuleName)`.
|
|
188
104
|
|
|
189
105
|
## Visual Specifications
|
|
190
106
|
|
|
191
107
|
### Standard Variant
|
|
192
108
|
|
|
193
|
-
| Property | Value
|
|
194
|
-
| ------------------- |
|
|
195
|
-
| Layout | Vertical stack (or horizontal row when `inline=true`)
|
|
196
|
-
| Radio indicator | Circle button with filled inner circle when selected
|
|
197
|
-
| Label | Label text to the right of the radio button (
|
|
198
|
-
| Group label |
|
|
199
|
-
| Error state | Group border or text in red
|
|
200
|
-
| Helper text | Below the group
|
|
201
|
-
| Disabled (readOnly) | Greyed-out radio buttons, not-allowed cursor
|
|
202
|
-
|
|
203
|
-
**
|
|
204
|
-
|
|
205
|
-
```css
|
|
206
|
-
.radio-group {
|
|
207
|
-
display: flex;
|
|
208
|
-
flex-direction: column;
|
|
209
|
-
gap: 4px;
|
|
210
|
-
}
|
|
211
|
-
.radio-group.inline {
|
|
212
|
-
flex-direction: row;
|
|
213
|
-
flex-wrap: wrap;
|
|
214
|
-
gap: 8px;
|
|
215
|
-
}
|
|
216
|
-
.radio-label {
|
|
217
|
-
display: flex;
|
|
218
|
-
align-items: center;
|
|
219
|
-
gap: 8px;
|
|
220
|
-
cursor: pointer;
|
|
221
|
-
}
|
|
222
|
-
input[type='radio']:disabled {
|
|
223
|
-
opacity: 0.38;
|
|
224
|
-
cursor: default;
|
|
225
|
-
}
|
|
226
|
-
```
|
|
109
|
+
| Property | Value |
|
|
110
|
+
| ------------------- | ----------------------------------------------------------- |
|
|
111
|
+
| Layout | Vertical stack (or horizontal row when `inline=true`) |
|
|
112
|
+
| Radio indicator | Circle button with filled inner circle when selected |
|
|
113
|
+
| Label | Label text to the right of the radio button (end placement) |
|
|
114
|
+
| Group label | Legend/label above the group |
|
|
115
|
+
| Error state | Group border or text in red |
|
|
116
|
+
| Helper text | Below the group |
|
|
117
|
+
| Disabled (readOnly) | Greyed-out radio buttons, not-allowed cursor |
|
|
118
|
+
|
|
119
|
+
**Visual-only styling notes:** The radio group is a flex column with a small gap by default; the inline variant switches to a wrapping flex row with a slightly larger gap. Each radio label row is a flex container with centered items, a small gap, and a pointer cursor. Disabled radio inputs are shown at reduced opacity with a default (not-allowed-style) cursor.
|
|
227
120
|
|
|
228
121
|
### Card Variant
|
|
229
122
|
|
|
@@ -231,30 +124,30 @@ input[type='radio']:disabled {
|
|
|
231
124
|
| -------- | ----------------------------------------------------------------------- |
|
|
232
125
|
| Layout | CSS Grid: `repeat(auto-fit, minmax(min(200px, 100%), 1fr))`, gap `1rem` |
|
|
233
126
|
| Card | Elevated card with click handler that activates the radio |
|
|
234
|
-
| Heading |
|
|
127
|
+
| Heading | Heading element with no top/bottom margin above grid |
|
|
235
128
|
|
|
236
129
|
## Edge Cases & Special Logic
|
|
237
130
|
|
|
238
|
-
-
|
|
239
|
-
- `theSelectedButton` tracks the selected key locally and syncs from `value`
|
|
240
|
-
- Card variant uses
|
|
131
|
+
- Options are loaded synchronously via the project's utility helper on every render — no async fetching.
|
|
132
|
+
- `theSelectedButton` tracks the selected key locally and syncs from the `value` input via a lifecycle effect.
|
|
133
|
+
- Card variant uses a state update callback to inform parent when a radio card is selected.
|
|
241
134
|
|
|
242
135
|
## Dependencies
|
|
243
136
|
|
|
244
|
-
-
|
|
245
|
-
-
|
|
246
|
-
- `
|
|
247
|
-
- `
|
|
137
|
+
- The project's utility helpers — for loading option lists.
|
|
138
|
+
- The project's event-commit utility.
|
|
139
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
140
|
+
- The project's component registry, resolving `SelectableCard` — for card variant.
|
|
248
141
|
|
|
249
142
|
## Design System Mapping
|
|
250
143
|
|
|
251
144
|
**UI control type:** Radio button group (single selection).
|
|
252
145
|
|
|
253
|
-
|
|
146
|
+
When implementing in a specific design system, map the following:
|
|
254
147
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
148
|
+
- **Radio group** → use the DS's radio group component with individual radio options
|
|
149
|
+
- **Inline layout** → render as a horizontal row when `inline` is true
|
|
150
|
+
- **Card variant** → delegate to the `SelectableCard` component in a CSS grid
|
|
151
|
+
- **Group wrapper** → use the DS's form control with legend/label, error state, and helper text
|
|
152
|
+
- **Option labels** → localize via `pConn.getLocalizedValue()` before display
|
|
153
|
+
- **Read-only** → disable radio inputs (do NOT use a separate read-only component)
|