@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
|
Composite field that dynamically renders a child component (Dropdown, AutoComplete, or SemanticLink) for referencing another Pega case or data object. Supports editable-in-review mode with direct case update.
|
|
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 @@ Does NOT render a UI control directly. Instead, it reads the raw metadata to det
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `ObjectReference`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Reference`
|
|
17
|
-
- **Registration key:** `ObjectReference` (in
|
|
17
|
+
- **Registration key:** `ObjectReference` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
>
|
|
21
|
+
> Overrides the field input contract by omitting `value` — no direct `value` input.
|
|
22
22
|
|
|
23
23
|
| Prop | Type | Default | Description |
|
|
24
24
|
| ------------------------------------ | --------- | ------- | ---------------------------------------------------------------- |
|
|
@@ -33,79 +33,20 @@ Does NOT render a UI control directly. Instead, it reads the raw metadata to det
|
|
|
33
33
|
| `showPromotedFilters` | `boolean` | `false` | Show promoted filters in child |
|
|
34
34
|
| `additionalFields` | `any` | — | Additional fields for read-only display |
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Implementation Structure
|
|
37
37
|
|
|
38
38
|
This is a composite/orchestrator component — it does NOT render its own UI control. It creates a child component (Dropdown, AutoComplete, SemanticLink, or SingleReferenceReadonly) via `getPConnect().createComponent()`.
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
targetObjectType: any;
|
|
51
|
-
mode: string;
|
|
52
|
-
parameters: object;
|
|
53
|
-
hideLabel: boolean;
|
|
54
|
-
inline: boolean;
|
|
55
|
-
showPromotedFilters: boolean;
|
|
56
|
-
additionalFields: any;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default function ObjectReference(props: ObjectReferenceProps) {
|
|
60
|
-
// 1. Destructure props
|
|
61
|
-
const {
|
|
62
|
-
getPConnect, displayMode,
|
|
63
|
-
allowAndPersistChangesInReviewMode: editableInReview = false,
|
|
64
|
-
targetObjectType, mode = '', parameters,
|
|
65
|
-
hideLabel = false, inline = false,
|
|
66
|
-
showPromotedFilters = false, additionalFields,
|
|
67
|
-
} = props;
|
|
68
|
-
|
|
69
|
-
// 2. Registry lookup
|
|
70
|
-
const SingleReferenceReadonly = getComponentFromRegistry('SingleReferenceReadOnly');
|
|
71
|
-
|
|
72
|
-
// 3. Setup
|
|
73
|
-
const pConn = getPConnect();
|
|
74
|
-
const referenceType = targetObjectType === 'case' ? 'Case' : 'Data';
|
|
75
|
-
const rawViewMetadata = pConn.getRawMetadata();
|
|
76
|
-
const refFieldMetadata = pConn.getFieldMetadata(
|
|
77
|
-
rawViewMetadata?.config?.value?.split('.', 2)[1]
|
|
78
|
-
);
|
|
79
|
-
const propsToUse = { ...pConn.getInheritedProps(), ...props };
|
|
80
|
-
const isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
|
|
81
|
-
const canBeChangedInReviewMode = editableInReview &&
|
|
82
|
-
['Autocomplete', 'Dropdown'].includes(rawViewMetadata.config.componentType);
|
|
83
|
-
|
|
84
|
-
// 4. onRecordChange handler — see Behavioral Contract
|
|
85
|
-
const onRecordChange = (event) => { /* ... */ };
|
|
86
|
-
|
|
87
|
-
// 5. recreatedFirstChild (useMemo) — the main logic
|
|
88
|
-
// Decision tree:
|
|
89
|
-
// a) SemanticLink && !canBeChangedInReviewMode → createComponent('SemanticLink', ...)
|
|
90
|
-
// b) isDisplayModeEnabled && !canBeChangedInReviewMode → <SingleReferenceReadonly ... />
|
|
91
|
-
// c) Editable: generateColumns, set deferDatasource, build fieldMetaData,
|
|
92
|
-
// createComponent(type, { config with datasourceMetadata, onRecordChange, ... })
|
|
93
|
-
const recreatedFirstChild = useMemo(() => { /* ... */ }, [
|
|
94
|
-
rawViewMetadata.config?.datasource?.source,
|
|
95
|
-
parameters,
|
|
96
|
-
propsToUse.required,
|
|
97
|
-
propsToUse.disabled,
|
|
98
|
-
getPConnect().getPageReference(),
|
|
99
|
-
]);
|
|
100
|
-
|
|
101
|
-
// 6. Return — minimal grid wrapper
|
|
102
|
-
return (
|
|
103
|
-
<GridContainer>
|
|
104
|
-
<GridItem>{recreatedFirstChild}</GridItem>
|
|
105
|
-
</GridContainer>
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
```
|
|
40
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `SingleReferenceReadOnly`) and local utility helpers (`SELECTION_MODE`, `generateColumns`, `getDataRelationshipContextFromKey`). Define the input contract by overriding the project's field input contract to omit `value`, and adding `getPConnect`, `displayMode`, `allowAndPersistChangesInReviewMode`, `targetObjectType`, `mode`, `parameters`, `hideLabel`, `inline`, `showPromotedFilters`, and `additionalFields`.
|
|
41
|
+
|
|
42
|
+
**Main Component Logic** — steps in order:
|
|
43
|
+
|
|
44
|
+
1. **Receive inputs** — `getPConnect`, `displayMode`, alias `allowAndPersistChangesInReviewMode` to `editableInReview` (default `false`), `targetObjectType`, `mode` (default `''`), `parameters`, `hideLabel` (default `false`), `inline` (default `false`), `showPromotedFilters` (default `false`), `additionalFields`.
|
|
45
|
+
2. **Registry lookup** — resolve `SingleReferenceReadonly` (registry key `'SingleReferenceReadOnly'`) via the project's component registry.
|
|
46
|
+
3. **Setup** — `pConn`; `referenceType` set to `'Case'` when `targetObjectType === 'case'`, else `'Data'`; `rawViewMetadata` via `pConn.getRawMetadata()`; `refFieldMetadata` via `pConn.getFieldMetadata()` on the second segment of the raw metadata's config value path; `propsToUse` merging `pConn.getInheritedProps()` with the component inputs; `isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY'`; `canBeChangedInReviewMode` true when `editableInReview` is set and the raw metadata's `config.componentType` is `'Autocomplete'` or `'Dropdown'`.
|
|
47
|
+
4. **`onRecordChange` handler** — see the Behavioral Contract section below for its full logic.
|
|
48
|
+
5. **`recreatedFirstChild`** (memoized computation) — the main decision-tree logic: (a) when the component type is `SemanticLink` and not editable-in-review, create a `SemanticLink` child via `createComponent`; (b) when in display mode and not editable-in-review, render `SingleReferenceReadonly`; (c) otherwise (editable), call `generateColumns`, set `deferDatasource`, build `fieldMetaData`, and create the appropriate child (`Dropdown` or `AutoComplete`) via `createComponent` with a config object carrying the datasource metadata, `onRecordChange`, and related inputs. Dependencies: `rawViewMetadata.config?.datasource?.source`, `parameters`, `propsToUse.required`, `propsToUse.disabled`, `getPConnect().getPageReference()`.
|
|
49
|
+
6. **Return** — a minimal grid wrapper containing `recreatedFirstChild`.
|
|
109
50
|
|
|
110
51
|
## Behavioral Contract
|
|
111
52
|
|
|
@@ -114,7 +55,7 @@ export default function ObjectReference(props: ObjectReferenceProps) {
|
|
|
114
55
|
1. `referenceType = targetObjectType === 'case' ? 'Case' : 'Data'`
|
|
115
56
|
2. `rawViewMetadata = pConn.getRawMetadata()` — the raw component metadata from Pega config
|
|
116
57
|
3. `refFieldMetadata = pConn.getFieldMetadata(rawViewMetadata?.config?.value?.split('.', 2)[1])`
|
|
117
|
-
4. `propsToUse = { ...pConn.getInheritedProps(), ...
|
|
58
|
+
4. `propsToUse = { ...pConn.getInheritedProps(), ...componentInputs }` — merged inherited + local inputs
|
|
118
59
|
5. `isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY'`
|
|
119
60
|
6. `canBeChangedInReviewMode = editableInReview && ['Autocomplete', 'Dropdown'].includes(rawViewMetadata.config.componentType)`
|
|
120
61
|
|
|
@@ -146,33 +87,9 @@ Render `<SingleReferenceReadonly>` with config from `rawViewMetadata.config`, pa
|
|
|
146
87
|
- `rawViewMetadata.config.showPromotedFilters = showPromotedFilters`
|
|
147
88
|
- If `!canBeChangedInReviewMode`: set `rawViewMetadata.config.displayMode = displayMode`
|
|
148
89
|
|
|
149
|
-
3. **Build fieldMetaData:**
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
fieldMetaData = { datasourceMetadata: { datasource: { parameters: {} } } }
|
|
153
|
-
```
|
|
154
|
-
- Set `propertyForDisplayText` from `datasource.fields.text` (strip `@P ` prefix)
|
|
155
|
-
- Set `propertyForValue` from `datasource.fields.value` (strip `@P ` prefix)
|
|
156
|
-
- Set `name` from `referenceList`
|
|
157
|
-
- If `rawViewMetadata.config.parameters`: assign `parameters` prop
|
|
158
|
-
|
|
159
|
-
4. **Create child component:**
|
|
160
|
-
```
|
|
161
|
-
getPConnect().createComponent({
|
|
162
|
-
type, // 'Dropdown' or 'AutoComplete'
|
|
163
|
-
config: {
|
|
164
|
-
...rawViewMetadata.config,
|
|
165
|
-
descriptors: mode === SELECTION_MODE.SINGLE ? refFieldMetadata?.descriptors : null,
|
|
166
|
-
datasourceMetadata: fieldMetaData.datasourceMetadata,
|
|
167
|
-
required, visibility, disabled, label, parameters, readOnly: false,
|
|
168
|
-
localeReference, referenceType (for single mode only),
|
|
169
|
-
contextClass: targetObjectClass,
|
|
170
|
-
primaryField: displayField,
|
|
171
|
-
dataRelationshipContext,
|
|
172
|
-
hideLabel, onRecordChange, inline
|
|
173
|
-
}
|
|
174
|
-
})
|
|
175
|
-
```
|
|
90
|
+
3. **Build fieldMetaData:** Start from an object shaped as `{ datasourceMetadata: { datasource: { parameters: {} } } }`. Set `propertyForDisplayText` from `datasource.fields.text` (with any leading `@P ` prefix stripped). Set `propertyForValue` from `datasource.fields.value` (with any leading `@P ` prefix stripped). Set `name` from `referenceList`. If `rawViewMetadata.config.parameters` is present, assign it to the `parameters` property.
|
|
91
|
+
|
|
92
|
+
4. **Create child component:** Call `getPConnect().createComponent()` with `type` set to `'Dropdown'` or `'AutoComplete'`, and a `config` object spreading `rawViewMetadata.config` plus: `descriptors` (from `refFieldMetadata?.descriptors` when `mode === SELECTION_MODE.SINGLE`, otherwise `null`), `datasourceMetadata` (from `fieldMetaData.datasourceMetadata`), `required`, `visibility`, `disabled`, `label`, `parameters`, `readOnly: false`, `localeReference`, `referenceType` (for single mode only), `contextClass` (the target object class), `primaryField` (the display field), `dataRelationshipContext`, `hideLabel`, `onRecordChange`, and `inline`.
|
|
176
93
|
|
|
177
94
|
### `onRecordChange` handler
|
|
178
95
|
|
|
@@ -190,7 +107,7 @@ Called when user selects a new value in editable/editable-in-review mode:
|
|
|
190
107
|
|
|
191
108
|
### Memoization
|
|
192
109
|
|
|
193
|
-
`recreatedFirstChild` is memoized
|
|
110
|
+
`recreatedFirstChild` is a memoized computation — dependencies: `rawViewMetadata.config?.datasource?.source`, `parameters`, `propsToUse.required`, `propsToUse.disabled`, `getPConnect().getPageReference()`.
|
|
194
111
|
|
|
195
112
|
## Display Mode Rendering
|
|
196
113
|
|
|
@@ -198,50 +115,35 @@ Display mode is passed through to the child component — the child (Dropdown, A
|
|
|
198
115
|
|
|
199
116
|
## Visual Specifications
|
|
200
117
|
|
|
201
|
-
ObjectReference itself renders a minimal grid container:
|
|
202
|
-
|
|
203
|
-
```
|
|
204
|
-
<Grid container>
|
|
205
|
-
<Grid>{recreatedFirstChild}</Grid>
|
|
206
|
-
</Grid>
|
|
207
|
-
```
|
|
118
|
+
ObjectReference itself renders a minimal grid container: a grid wrapping a single grid item that holds `recreatedFirstChild`.
|
|
208
119
|
|
|
209
120
|
The visual appearance is entirely determined by the child component being rendered. No additional styling is applied by `ObjectReference` itself.
|
|
210
121
|
|
|
211
|
-
**
|
|
212
|
-
|
|
213
|
-
```css
|
|
214
|
-
.object-reference-container {
|
|
215
|
-
display: grid;
|
|
216
|
-
width: 100%;
|
|
217
|
-
}
|
|
218
|
-
```
|
|
122
|
+
**Visual-only styling notes:** The outer container uses a full-width grid layout with a single column.
|
|
219
123
|
|
|
220
124
|
## Edge Cases & Special Logic
|
|
221
125
|
|
|
222
126
|
- **`generateColumns`**: a utility from `./utils` that populates `rawViewMetadata.config` with proper column definitions for the child Dropdown/AutoComplete.
|
|
223
127
|
- **`getDataRelationshipContextFromKey`**: extracts the relationship context from a field key (also from `./utils`).
|
|
224
128
|
- `rawViewMetadata.config` is mutated in place before being passed to `createComponent` — this is intentional but means the component re-creates the child on relevant prop changes.
|
|
225
|
-
- For `SemanticLink` type, the child is created via `createComponent`, not rendered as a direct
|
|
129
|
+
- For `SemanticLink` type, the child is created via `createComponent`, not rendered as a direct element.
|
|
226
130
|
- `SELECTION_MODE.SINGLE` and `SELECTION_MODE.MULTI` constants from `./utils`.
|
|
227
131
|
|
|
228
132
|
## Dependencies
|
|
229
133
|
|
|
230
|
-
- `SELECTION_MODE`, `generateColumns`, `getDataRelationshipContextFromKey
|
|
231
|
-
- `
|
|
134
|
+
- Local utility helpers: `SELECTION_MODE`, `generateColumns`, `getDataRelationshipContextFromKey`.
|
|
135
|
+
- The project's component registry, resolving `SingleReferenceReadOnly` — for display-only non-SemanticLink.
|
|
232
136
|
- `PCore.getCaseUtils()`, `PCore.getAnnotationUtils()`, `PCore.getContainerUtils()` — for editable-in-review updates.
|
|
233
|
-
-
|
|
234
|
-
- No `handleEvent` — selection handling is done by the child component via `onRecordChange`.
|
|
137
|
+
- No event-commit utility — selection handling is done by the child component via `onRecordChange`.
|
|
235
138
|
|
|
236
139
|
## Design System Mapping
|
|
237
140
|
|
|
238
141
|
**UI control type:** Composite wrapper — renders Dropdown, AutoComplete, SemanticLink, or SingleReferenceReadonly. No dedicated UI control.
|
|
239
142
|
|
|
240
|
-
|
|
143
|
+
When implementing in a specific design system, map the following:
|
|
241
144
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
| `displayMode='DISPLAY_ONLY'` (non-editable-in-review) | `SingleReferenceReadonly` component |
|
|
145
|
+
- **Editable Dropdown/AutoComplete** → child created via `getPConnect().createComponent()` with datasource metadata
|
|
146
|
+
- **SemanticLink** → child created via `createComponent` with case reference config
|
|
147
|
+
- **Display-only** → render `SingleReferenceReadonly` from the project's component registry
|
|
148
|
+
- **Editable-in-review** → allow editing with direct case update via `PCore.getCaseUtils()`
|
|
149
|
+
- **Grid wrapper** → use a simple container to hold the `recreatedFirstChild`
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Percentage numeric input with a `%` suffix and locale-aware decimal/thousands separators.
|
|
4
4
|
|
|
5
|
-
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture,
|
|
5
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, input contract, display modes, event handling, and registration patterns common to ALL field components.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -14,123 +14,60 @@ Renders a numeric input for percentage values. Always appends a `%` suffix in th
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `Percentage`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Decimal-Percentage`
|
|
17
|
-
- **Registration key:** `Percentage` (in
|
|
17
|
+
- **Registration key:** `Percentage` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
|
|
|
21
|
+
| Name | Type | Default | Description |
|
|
22
22
|
| --------------------- | ------------------- | ------- | ------------------------------------------------------------------------------------------------ |
|
|
23
23
|
| `currencyISOCode` | `string` (optional) | `'USD'` | ISO code used for locale-aware decimal/thousands separator lookup only (not for currency symbol) |
|
|
24
24
|
| `showGroupSeparators` | `string` (optional) | — | Whether to show thousands separators (passed as string, truthy check applies) |
|
|
25
25
|
| `decimalPrecision` | `number` (optional) | — | Number of decimal places |
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// 2. Destructure props
|
|
50
|
-
const {
|
|
51
|
-
getPConnect, label, required, disabled, value = '',
|
|
52
|
-
validatemessage, status, readOnly, currencyISOCode = 'USD',
|
|
53
|
-
testId, helperText, displayMode, hideLabel, placeholder,
|
|
54
|
-
showGroupSeparators, decimalPrecision,
|
|
55
|
-
} = props;
|
|
56
|
-
|
|
57
|
-
// 3. State
|
|
58
|
-
const [values, setValues] = useState(value.toString());
|
|
59
|
-
|
|
60
|
-
// 4. PConnect setup
|
|
61
|
-
const pConn = getPConnect();
|
|
62
|
-
const actions = pConn.getActionsApi();
|
|
63
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
64
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
65
|
-
|
|
66
|
-
// 5. Formatted value (computed eagerly, before display mode check)
|
|
67
|
-
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
68
|
-
const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
|
|
69
|
-
|
|
70
|
-
// 6. useEffect: sync from store — deps: [value]
|
|
71
|
-
useEffect(() => { setValues(value.toString()); }, [value]);
|
|
72
|
-
|
|
73
|
-
// 7. Read-only prop
|
|
74
|
-
let readOnlyProp = {};
|
|
75
|
-
if (readOnly) readOnlyProp = { readOnly: true };
|
|
76
|
-
|
|
77
|
-
// 8. Display mode returns
|
|
78
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
79
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
|
|
80
|
-
}
|
|
81
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
82
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant="stacked" />;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// 9. Test ID + separators (computed AFTER display mode check in actual code)
|
|
86
|
-
const testProps: any = { 'data-test-id': testId };
|
|
87
|
-
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
88
|
-
const theCurrDec = theSymbols.theDecimalIndicator;
|
|
89
|
-
const theCurrSep = theSymbols.theDigitGroupSeparator;
|
|
90
|
-
|
|
91
|
-
// 10. Event handlers
|
|
92
|
-
function PercentageOnBlur() { handleEvent(actions, 'changeNblur', propName, values); }
|
|
93
|
-
const handleChange = (val) => { setValues(val.value); };
|
|
94
|
-
|
|
95
|
-
// 11. Main render — numeric format input with % suffix
|
|
96
|
-
// Key props:
|
|
97
|
-
// - valueIsNumericString: true, fullWidth: true
|
|
98
|
-
// - value: values, suffix: '%'
|
|
99
|
-
// - variant: readOnly ? 'standard' : 'outlined'
|
|
100
|
-
// - decimalSeparator: theCurrDec
|
|
101
|
-
// - thousandSeparator: showGroupSeparators ? theCurrSep : ''
|
|
102
|
-
// - decimalScale: decimalPrecision
|
|
103
|
-
// - onValueChange, onBlur: !readOnly ? PercentageOnBlur : undefined
|
|
104
|
-
// - label, helperText: helperTextToDisplay, placeholder: placeholder ?? ''
|
|
105
|
-
// - required, disabled, error: status === 'error', size: 'small'
|
|
106
|
-
// - slotProps: { input: { ...readOnlyProp, inputProps: { ...testProps } } }
|
|
107
|
-
return <NumericFormatInput ... />;
|
|
108
|
-
}
|
|
109
|
-
```
|
|
27
|
+
All other inputs come from the project's field input contract (see prerequisite skill).
|
|
28
|
+
|
|
29
|
+
## Implementation Structure
|
|
30
|
+
|
|
31
|
+
Nearly identical to Currency but with a `%` suffix instead of a prefix, and no fixed decimal scale.
|
|
32
|
+
|
|
33
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `FieldValueList`), the project's event-commit utility, the project's currency utility helpers (for decimal/separator lookup), and the project's formatting helpers (for display-mode value formatting). It also uses a numeric-format masking library for locale-aware input display. Define the input contract as an extension of the project's field input contract, adding optional `currencyISOCode`, `showGroupSeparators`, and `decimalPrecision` fields.
|
|
34
|
+
|
|
35
|
+
**Main Component Logic** — steps in order:
|
|
36
|
+
|
|
37
|
+
1. **Registry lookup** — resolve `FieldValueList` via the project's component registry.
|
|
38
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required`, `disabled`, `value` (default `''`), `validatemessage`, `status`, `readOnly`, `currencyISOCode` (default `'USD'`), `testId`, `helperText`, `displayMode`, `hideLabel`, `placeholder`, `showGroupSeparators`, `decimalPrecision`.
|
|
39
|
+
3. **Local state** — `values` initialized from `value.toString()`.
|
|
40
|
+
4. **PConnect setup** — obtain the PConnect instance, its actions API, and the bound property name; compute `helperTextToDisplay = validatemessage || helperText`.
|
|
41
|
+
5. **Formatted value** — computed eagerly, before the display-mode check: obtain the currency formatting options via the project's currency options helper, then compute the formatted value using the project's formatting helper with the component's type name (from `pConn.getComponentName()?.toLowerCase()`) as the format key and the currency options.
|
|
42
|
+
6. **Sync from store** — a lifecycle effect watching `value` updates `values` (as a string) whenever it changes.
|
|
43
|
+
7. **Read-only flag** — build a read-only configuration, set to mark the input read-only only when `readOnly` is true.
|
|
44
|
+
8. **Display mode returns** — `DISPLAY_ONLY` and `STACKED_LARGE_VAL` both return `FieldValueList` using the formatted value, the latter with a stacked variant.
|
|
45
|
+
9. **Test ID and separators** — computed after the display-mode check: build a test-id attribute from `testId`; derive the decimal indicator and digit group separator via the project's currency utility helpers using `currencyISOCode`.
|
|
46
|
+
10. **Event handlers** — the blur handler commits via the project's event-commit utility with event type `'changeNblur'`, the property name, and `values`; the value-change handler updates `values` with the raw numeric string from the masking library's callback.
|
|
47
|
+
11. **Render** — a numeric-format input configured with: value-is-numeric-string flag, full width, current `values`, suffix `'%'`, an outlined style when editable or flat/borderless style when read-only, decimal separator set to the locale-derived decimal indicator, thousands separator set to the locale-derived group separator only when `showGroupSeparators` is truthy (otherwise empty string), decimal scale set to `decimalPrecision`, the value-change handler, the blur handler wired only when not read-only, `label`, `helperText: helperTextToDisplay`, `placeholder: placeholder ?? ''`, `required`, `disabled`, an error state when `status === 'error'`, small size, and the read-only/test-id attributes applied to the underlying input element.
|
|
110
48
|
|
|
111
49
|
## Behavioral Contract
|
|
112
50
|
|
|
113
51
|
1. **Local state:** Maintain `values` (string). Initialize from `value.toString()`.
|
|
114
|
-
2. **Sync from store:**
|
|
115
|
-
3. **Separators:** Derive
|
|
52
|
+
2. **Sync from store:** A lifecycle effect watching `value` updates `values` (converted to string).
|
|
53
|
+
3. **Separators:** Derive the decimal separator and thousands separator from locale lookup using `currencyISOCode` (same as Currency/Decimal). Apply the thousands separator only when `showGroupSeparators` is truthy.
|
|
116
54
|
4. **Suffix:** Always append `%` suffix to the numeric input.
|
|
117
|
-
5. **Decimal scale:** Use `decimalPrecision`
|
|
55
|
+
5. **Decimal scale:** Use the `decimalPrecision` input.
|
|
118
56
|
6. **No prefix:** Unlike Currency, no prefix symbol.
|
|
119
57
|
7. **On value change:** Update local `values` state with the raw numeric string.
|
|
120
|
-
8. **On blur:** Commit via
|
|
121
|
-
9. **Read-only:** Set
|
|
58
|
+
8. **On blur:** Commit via the project's event-commit utility with event type `'changeNblur'`, the property name, and `values`.
|
|
59
|
+
9. **Read-only:** Set the read-only attribute on the input. Flat/borderless style. Blur handler omitted.
|
|
122
60
|
|
|
123
61
|
## Display Mode Rendering
|
|
124
62
|
|
|
125
|
-
Format the value using the
|
|
63
|
+
Format the value using the project's formatting helper with the component's type name as the format key before display:
|
|
126
64
|
|
|
127
|
-
- `
|
|
128
|
-
- **`
|
|
129
|
-
- **`STACKED_LARGE_VAL`:** `<FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />`.
|
|
65
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to `label` (or empty when `hideLabel` is true) and `value` set to the formatted value.
|
|
66
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
130
67
|
|
|
131
68
|
## Read-Only Rendering
|
|
132
69
|
|
|
133
|
-
Keep numeric format input with
|
|
70
|
+
Keep the numeric format input with the read-only attribute and `%` suffix still visible. Flat/borderless style.
|
|
134
71
|
|
|
135
72
|
## Visual Specifications
|
|
136
73
|
|
|
@@ -139,11 +76,11 @@ Keep numeric format input with `readOnly: true` and `%` suffix still visible. Fl
|
|
|
139
76
|
| Width | 100% |
|
|
140
77
|
| Size | Small |
|
|
141
78
|
| Variant editable | Outlined |
|
|
142
|
-
| Variant read-only |
|
|
79
|
+
| Variant read-only | Flat/borderless |
|
|
143
80
|
| Suffix | `%` (always shown after the value) |
|
|
144
81
|
| Thousands separator | Only when `showGroupSeparators` is truthy |
|
|
145
82
|
| Decimal scale | `decimalPrecision` |
|
|
146
|
-
| Placeholder | From `placeholder`
|
|
83
|
+
| Placeholder | From the `placeholder` input |
|
|
147
84
|
| Error state | Red border + red helper text |
|
|
148
85
|
|
|
149
86
|
**CSS-only notes:** Achieve the `%` suffix by wrapping the input in a relative container and absolutely positioning a `%` label at the right side, or using an input with a `::after` pseudo-element technique.
|
|
@@ -156,22 +93,21 @@ Keep numeric format input with `readOnly: true` and `%` suffix still visible. Fl
|
|
|
156
93
|
|
|
157
94
|
## Dependencies
|
|
158
95
|
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
- `format()
|
|
163
|
-
-
|
|
164
|
-
- `
|
|
96
|
+
- A numeric formatting library — handles locale-aware separators, suffix, and decimal scale.
|
|
97
|
+
- The project's currency utility helpers — for decimal indicator and digit group separator lookup.
|
|
98
|
+
- The project's currency options helper — for formatting options.
|
|
99
|
+
- The project's formatting helpers — specifically the named `format` export (not a method on the default export). Use it as a standalone function, not as a property of the default-exported object.
|
|
100
|
+
- The project's event-commit utility.
|
|
101
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
165
102
|
|
|
166
103
|
## Design System Mapping
|
|
167
104
|
|
|
168
105
|
**UI control type:** Percentage numeric input with `%` suffix.
|
|
169
106
|
|
|
170
|
-
|
|
107
|
+
When implementing in a specific design system, map the following:
|
|
171
108
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
| Chakra UI | `<NumberInput>` + `<InputRightAddon>%</InputRightAddon>` |
|
|
109
|
+
- **Numeric format input** → use a numeric masking library compatible with the project's framework, or implement custom input masking
|
|
110
|
+
- **`%` suffix** → use the DS's input suffix/adornment slot, or absolutely position a `%` label
|
|
111
|
+
- **Decimal/thousands separators** → derive from the currency utility helpers based on the ISO code
|
|
112
|
+
- **Read-only** → flat/borderless style with read-only attribute, suffix still visible
|
|
113
|
+
- **Error state** → the DS's error/danger visual state
|