@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
|
Currency input field with locale-aware symbol, decimal separator, and thousands separator. Supports ISO currency codes.
|
|
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,169 +14,75 @@ Renders a numeric input formatted as a currency value. Displays the correct curr
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `Currency`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Decimal-Currency`
|
|
17
|
-
- **Registration key:** `Currency` (in
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
|
|
|
22
|
-
| ----------------- | ------------------- | ------- |
|
|
23
|
-
| `currencyISOCode` | `string` (optional) | `'USD'` | ISO 4217 currency code (e.g., `'USD'`, `'EUR'`, `'GBP'`)
|
|
24
|
-
| `allowDecimals` | `boolean` | — | Whether to allow decimal input. If `false`,
|
|
25
|
-
|
|
26
|
-
All other
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// ── Component ────────────────────────────────────────────────
|
|
51
|
-
export default function Currency(props: CurrencyProps) {
|
|
52
|
-
// 1. Registry lookups
|
|
53
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
54
|
-
|
|
55
|
-
// 2. Destructure props
|
|
56
|
-
const {
|
|
57
|
-
getPConnect, label, required, disabled, value = '',
|
|
58
|
-
validatemessage, status, readOnly, testId,
|
|
59
|
-
helperText, displayMode, hideLabel,
|
|
60
|
-
currencyISOCode = 'USD', placeholder, allowDecimals,
|
|
61
|
-
} = props;
|
|
62
|
-
|
|
63
|
-
// 3. PConnect setup
|
|
64
|
-
const pConn = getPConnect();
|
|
65
|
-
const actions = pConn.getActionsApi();
|
|
66
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
67
|
-
|
|
68
|
-
// 4. Derived values
|
|
69
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
70
|
-
const testProps: any = { 'data-test-id': testId };
|
|
71
|
-
|
|
72
|
-
// 5. State
|
|
73
|
-
const [values, setValues] = useState(value.toString());
|
|
74
|
-
|
|
75
|
-
// 6. useEffect: sync from store — deps: [value]
|
|
76
|
-
useEffect(() => { setValues(value.toString()); }, [value]);
|
|
77
|
-
|
|
78
|
-
// 7. Currency symbol lookup
|
|
79
|
-
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
80
|
-
const theCurrSym = theSymbols.theCurrencySymbol;
|
|
81
|
-
const theCurrDec = theSymbols.theDecimalIndicator;
|
|
82
|
-
const theCurrSep = theSymbols.theDigitGroupSeparator;
|
|
83
|
-
|
|
84
|
-
// 8. Formatted value for display modes (computed eagerly, before display mode check)
|
|
85
|
-
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
86
|
-
const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
|
|
87
|
-
|
|
88
|
-
// 9. Read-only prop object
|
|
89
|
-
let readOnlyProp = {};
|
|
90
|
-
if (readOnly) {
|
|
91
|
-
readOnlyProp = { readOnly: true };
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// 10. Currency format config object
|
|
95
|
-
const currencyProp = {
|
|
96
|
-
prefix: theCurrSym,
|
|
97
|
-
decimalSeparator: theCurrDec,
|
|
98
|
-
thousandSeparator: theCurrSep,
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// 11. Display mode returns
|
|
102
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
103
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
|
|
104
|
-
}
|
|
105
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
106
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant="stacked" />;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// 12. Event handlers
|
|
110
|
-
function currOnBlur() {
|
|
111
|
-
handleEvent(actions, 'changeNblur', propName, values);
|
|
112
|
-
}
|
|
113
|
-
const handleChange = (val) => { setValues(val.value); };
|
|
114
|
-
|
|
115
|
-
// 13. Main render — numeric format input
|
|
116
|
-
// Key props to pass to your numeric format component:
|
|
117
|
-
// - valueIsNumericString: true
|
|
118
|
-
// - value: values
|
|
119
|
-
// - ...currencyProp (prefix, decimalSeparator, thousandSeparator)
|
|
120
|
-
// - decimalScale: allowDecimals !== false ? 2 : 0
|
|
121
|
-
// - fixedDecimalScale: allowDecimals
|
|
122
|
-
// - onValueChange: (val) => handleChange(val)
|
|
123
|
-
// - onBlur: !readOnly ? currOnBlur : undefined
|
|
124
|
-
// - variant: readOnly ? 'standard' : 'outlined'
|
|
125
|
-
// - label, helperText: helperTextToDisplay, placeholder: placeholder ?? ''
|
|
126
|
-
// - required, disabled, error: status === 'error'
|
|
127
|
-
// - inputProps: { ...readOnlyProp, inputProps: { ...testProps } }
|
|
128
|
-
return <NumericFormatInput ... />;
|
|
129
|
-
}
|
|
130
|
-
```
|
|
17
|
+
- **Registration key:** `Currency` (in the project's component map)
|
|
18
|
+
|
|
19
|
+
## Inputs (component-specific)
|
|
20
|
+
|
|
21
|
+
| Name | Type | Default | Description |
|
|
22
|
+
| ----------------- | ------------------- | ------- | -------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `currencyISOCode` | `string` (optional) | `'USD'` | ISO 4217 currency code (e.g., `'USD'`, `'EUR'`, `'GBP'`) |
|
|
24
|
+
| `allowDecimals` | `boolean` | — | Whether to allow decimal input. If `false`, decimal scale is 0. If `true`, fixed 2 decimal places shown. |
|
|
25
|
+
|
|
26
|
+
All other inputs come from the project's field input contract (see prerequisite skill).
|
|
27
|
+
|
|
28
|
+
## Implementation Structure
|
|
29
|
+
|
|
30
|
+
Follow this exact structure. Replace the numeric-format input with an equivalent from your chosen design system / numeric format library.
|
|
31
|
+
|
|
32
|
+
**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 symbol/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 an optional `currencyISOCode` and a required `allowDecimals` boolean.
|
|
33
|
+
|
|
34
|
+
**Main Component Logic** — steps in order:
|
|
35
|
+
|
|
36
|
+
1. **Registry lookup** — resolve `FieldValueList` via the project's component registry.
|
|
37
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required`, `disabled`, `value` (default `''`), `validatemessage`, `status`, `readOnly`, `testId`, `helperText`, `displayMode`, `hideLabel`, `currencyISOCode` (default `'USD'`), `placeholder`, `allowDecimals`.
|
|
38
|
+
3. **PConnect setup** — obtain the PConnect instance, its actions API, and the bound property name.
|
|
39
|
+
4. **Derived values** — `helperTextToDisplay = validatemessage || helperText` and a test-id attribute built from `testId`.
|
|
40
|
+
5. **Local state** — `values` initialized from `value.toString()`.
|
|
41
|
+
6. **Sync from store** — a lifecycle effect watching `value` updates `values` (as a string) whenever it changes.
|
|
42
|
+
7. **Currency symbol lookup** — derive the currency symbol, decimal indicator, and digit group separator via the project's currency utility helpers using `currencyISOCode`.
|
|
43
|
+
8. **Formatted value for display modes** — 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.
|
|
44
|
+
9. **Read-only flag** — build a read-only configuration, set to mark the input read-only only when `readOnly` is true.
|
|
45
|
+
10. **Currency format configuration** — build a configuration object bundling the currency symbol as prefix, the decimal indicator as decimal separator, and the digit group separator as thousands separator.
|
|
46
|
+
11. **Display mode returns** — `DISPLAY_ONLY` and `STACKED_LARGE_VAL` both return `FieldValueList` using the formatted value, the latter with a stacked variant.
|
|
47
|
+
12. **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.
|
|
48
|
+
13. **Render** — a numeric-format input configured with: value-is-numeric-string flag, current `values`, the currency format configuration spread (prefix, decimal separator, thousands separator), decimal scale set to `2` when `allowDecimals !== false` else `0`, fixed decimal scale set to `allowDecimals`, the value-change handler, the blur handler wired only when not read-only, an outlined style when editable or flat/borderless style when read-only, `label`, `helperText: helperTextToDisplay`, `placeholder: placeholder ?? ''`, `required`, `disabled`, an error state when `status === 'error'`, and the read-only/test-id attributes applied to the underlying input element.
|
|
131
49
|
|
|
132
50
|
## Behavioral Contract
|
|
133
51
|
|
|
134
52
|
1. **Local state:** Maintain `values` (string). Initialize from `value.toString()`.
|
|
135
|
-
2. **Sync from store:**
|
|
53
|
+
2. **Sync from store:** A lifecycle effect watching `value` updates `values` (converted to string).
|
|
136
54
|
3. **Helper text:** `helperTextToDisplay = validatemessage || helperText`.
|
|
137
|
-
4. **Test ID
|
|
138
|
-
5. **Currency symbols:** Derive from `
|
|
139
|
-
- Returns
|
|
55
|
+
4. **Test ID:** Build a test-id attribute from `testId` — passed on the inner input element.
|
|
56
|
+
5. **Currency symbols:** Derive from the project's currency utility helpers using `currencyISOCode`:
|
|
57
|
+
- Returns the currency symbol, decimal indicator, and digit group separator.
|
|
140
58
|
- Default (USD): `$`, `.`, `,`.
|
|
141
|
-
6. **Formatted value:** Computed eagerly (before display mode check)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
9. **Numeric format props (merged at render):**
|
|
156
|
-
- `valueIsNumericString: true`
|
|
157
|
-
- `value: values` (local state string)
|
|
158
|
-
- `...currencyProp` (spread prefix + separators)
|
|
159
|
-
- `decimalScale: allowDecimals !== false ? 2 : 0`
|
|
160
|
-
- `fixedDecimalScale: allowDecimals`
|
|
161
|
-
- `onValueChange: (val) => setValues(val.value)`
|
|
162
|
-
- `onBlur: !readOnly ? currOnBlur : undefined`
|
|
163
|
-
- `variant: readOnly ? 'standard' : 'outlined'`
|
|
164
|
-
- Input slot/props: `{ ...readOnlyProp, inputProps: { ...testProps } }`
|
|
165
|
-
10. **On value change:** `setValues(val.value)` — raw numeric string from the format library's callback object.
|
|
166
|
-
11. **On blur:** `handleEvent(actions, 'changeNblur', propName, values)` — commits local state to store.
|
|
59
|
+
6. **Formatted value:** Computed eagerly (before display mode check) using the project's formatting helper with the component's type name as the format key and the currency options.
|
|
60
|
+
7. **Read-only flag:** Mark the input read-only only when `readOnly` is true.
|
|
61
|
+
8. **Currency format configuration:** Bundle the currency symbol as prefix, decimal indicator as decimal separator, and digit group separator as thousands separator.
|
|
62
|
+
9. **Numeric format configuration (merged at render):**
|
|
63
|
+
- Value-is-numeric-string: true
|
|
64
|
+
- Value: `values` (local state string)
|
|
65
|
+
- Currency format configuration spread (prefix + separators)
|
|
66
|
+
- Decimal scale: `allowDecimals !== false ? 2 : 0`
|
|
67
|
+
- Fixed decimal scale: `allowDecimals`
|
|
68
|
+
- Value-change handler: updates `values` with the raw numeric string
|
|
69
|
+
- Blur handler: wired only when not read-only
|
|
70
|
+
- Visual style: outlined when editable, flat/borderless when read-only
|
|
71
|
+
10. **On value change:** Update `values` with the raw numeric string from the format library's callback object.
|
|
72
|
+
11. **On blur:** Commit local state to store via the project's event-commit utility with event type `'changeNblur'`, the property name, and `values`.
|
|
167
73
|
|
|
168
74
|
## Display Mode Rendering
|
|
169
75
|
|
|
170
|
-
Format the value before display using
|
|
76
|
+
Format the value before display using the project's formatting helper with the currency options derived from `currencyISOCode`:
|
|
171
77
|
|
|
172
|
-
- **`DISPLAY_ONLY`:**
|
|
173
|
-
- **`STACKED_LARGE_VAL`:**
|
|
78
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to `label` (or empty when `hideLabel` is true) and `value` set to the formatted value.
|
|
79
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
174
80
|
|
|
175
|
-
The
|
|
81
|
+
The formatted value uses the locale and currency from `currencyISOCode` to produce a localized string (e.g., `$1,234.56`).
|
|
176
82
|
|
|
177
83
|
## Read-Only Rendering
|
|
178
84
|
|
|
179
|
-
Keep the numeric format input but set
|
|
85
|
+
Keep the numeric format input but set the read-only attribute on the input element. Switch the visual style to flat/borderless. The blur handler is omitted.
|
|
180
86
|
|
|
181
87
|
## Visual Specifications
|
|
182
88
|
|
|
@@ -184,32 +90,32 @@ Keep the numeric format input but set `readOnly: true` on the input element. Swi
|
|
|
184
90
|
| -------------- | ---------------------------- | --------------- |
|
|
185
91
|
| Width | 100% | 100% |
|
|
186
92
|
| Size | Small | Small |
|
|
187
|
-
| Variant | Outlined |
|
|
93
|
+
| Variant | Outlined | Flat/borderless |
|
|
188
94
|
| Prefix | Currency symbol (e.g., `$`) | Currency symbol |
|
|
189
95
|
| Alignment | Left-aligned text | Left-aligned |
|
|
190
96
|
| Decimal places | 2 (when `allowDecimals`) | 2 |
|
|
191
97
|
| Error state | Red border + red helper text | — |
|
|
192
|
-
| Placeholder | From `placeholder`
|
|
98
|
+
| Placeholder | From the `placeholder` input | — |
|
|
193
99
|
|
|
194
100
|
## Edge Cases & Special Logic
|
|
195
101
|
|
|
196
102
|
- **EUR uses `nl-NL` locale:** When `currencyISOCode === 'EUR'`, use NL locale for symbol/separator lookup.
|
|
197
103
|
- **Fallback:** If `currencyISOCode` lookup fails, fall back to USD (`$`, `.`, `,`).
|
|
198
|
-
- **`allowDecimals` vs
|
|
104
|
+
- **`allowDecimals` vs fixed decimal scale:** The fixed decimal scale flag is set directly to `allowDecimals` (boolean). Decimal scale uses `allowDecimals !== false ? 2 : 0` (note: `!== false` means undefined/missing also gives 2 decimals).
|
|
199
105
|
- The input stores the raw numeric string (e.g., `'1234.56'`) in state and in the Pega store — not the formatted display string.
|
|
200
|
-
-
|
|
201
|
-
-
|
|
106
|
+
- The formatted value is computed eagerly (before display mode check) using `pConn.getComponentName()?.toLowerCase()` as the format type — this resolves to `'currency'`.
|
|
107
|
+
- The test-id attribute is passed on the inner input element, not on the outer wrapper.
|
|
202
108
|
- `placeholder` defaults to `''` if undefined: `placeholder ?? ''`.
|
|
203
|
-
-
|
|
109
|
+
- Visual style switches between outlined (editable) and flat/borderless (read-only) — this is design-system specific but the visual intent is: bordered input vs flat/borderless.
|
|
204
110
|
|
|
205
111
|
## Dependencies
|
|
206
112
|
|
|
207
|
-
- A numeric formatting library
|
|
208
|
-
- `format()
|
|
209
|
-
-
|
|
210
|
-
-
|
|
211
|
-
-
|
|
212
|
-
- `
|
|
113
|
+
- A numeric formatting library — handles locale-aware separators, prefix, and decimal scale.
|
|
114
|
+
- 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.
|
|
115
|
+
- The project's currency utility helpers — for currency symbol, decimal indicator, and digit group separator lookup.
|
|
116
|
+
- The project's currency options helper — for formatting options based on ISO code.
|
|
117
|
+
- The project's event-commit utility.
|
|
118
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
213
119
|
|
|
214
120
|
**For CSS-only / design-system-agnostic implementations:**
|
|
215
121
|
|
|
@@ -220,11 +126,11 @@ Keep the numeric format input but set `readOnly: true` on the input element. Swi
|
|
|
220
126
|
|
|
221
127
|
**UI control type:** Currency / numeric formatted input with prefix symbol.
|
|
222
128
|
|
|
223
|
-
|
|
129
|
+
When implementing in a specific design system, map the following:
|
|
224
130
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
131
|
+
- **Numeric format input** → use a numeric masking library compatible with the project's framework, or implement custom input masking
|
|
132
|
+
- **Currency prefix** → the currency symbol derived from the ISO code
|
|
133
|
+
- **Decimal/thousands separators** → derive from the currency utility helpers
|
|
134
|
+
- **Decimal scale** → 2 when decimals allowed, 0 otherwise
|
|
135
|
+
- **Read-only** → flat/borderless style with read-only attribute
|
|
136
|
+
- **Error state** → the DS's error/danger visual state
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Date picker field with locale-aware date format string, 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,162 +14,68 @@ Renders a date picker input. Stores dates as `YYYY-MM-DD` strings. Displays date
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `Date`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Date`
|
|
17
|
-
- **Registration key:** `Date` (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// ── Props interface ──────────────────────────────────────────
|
|
49
|
-
interface DateProps extends PConnFieldProps {}
|
|
50
|
-
|
|
51
|
-
// ── Component ────────────────────────────────────────────────
|
|
52
|
-
export default function Date(props: DateProps) {
|
|
53
|
-
// 1. Registry lookups
|
|
54
|
-
const TextInput = getComponentFromRegistry('TextInput');
|
|
55
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
56
|
-
|
|
57
|
-
// 2. Destructure props
|
|
58
|
-
const {
|
|
59
|
-
getPConnect, label, required, disabled, value,
|
|
60
|
-
validatemessage, status, readOnly, testId,
|
|
61
|
-
helperText, displayMode, hideLabel,
|
|
62
|
-
} = props;
|
|
63
|
-
|
|
64
|
-
// 3. State — initialize from value prop (null if empty)
|
|
65
|
-
const [dateValue, setDateValue] = useState<Dayjs | null>(
|
|
66
|
-
value ? dayjs(value) : null
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
// 4. PConnect setup
|
|
70
|
-
const pConn = getPConnect();
|
|
71
|
-
const actions = pConn.getActionsApi();
|
|
72
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
73
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
74
|
-
|
|
75
|
-
// 5. Date format info (mutate default with locale-specific values)
|
|
76
|
-
const dateFormatInfo = dateFormatInfoDefault;
|
|
77
|
-
const theDateFormat = getDateFormatInfo();
|
|
78
|
-
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
79
|
-
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
80
|
-
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
81
|
-
|
|
82
|
-
// 6. useEffect: sync from store — deps: [value]
|
|
83
|
-
useEffect(() => { setDateValue(dayjs(value)); }, [value]);
|
|
84
|
-
|
|
85
|
-
// 7. Display mode returns
|
|
86
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
87
|
-
const formattedDate = format(props.value, 'date', {
|
|
88
|
-
format: dateFormatInfo.dateFormatString,
|
|
89
|
-
});
|
|
90
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;
|
|
91
|
-
}
|
|
92
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
93
|
-
const formattedDate = format(props.value, 'date', {
|
|
94
|
-
format: dateFormatInfo.dateFormatString,
|
|
95
|
-
});
|
|
96
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant="stacked" />;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// 8. Read-only return (BEFORE event handlers)
|
|
100
|
-
if (readOnly) {
|
|
101
|
-
return <TextInput {...props} />;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// 9. Test ID prop
|
|
105
|
-
const testProps: any = { 'data-test-id': testId };
|
|
106
|
-
|
|
107
|
-
// 10. handleChange — only commits valid dates
|
|
108
|
-
const handleChange = (date) => {
|
|
109
|
-
if (date && date.isValid()) {
|
|
110
|
-
setDateValue(date);
|
|
111
|
-
handleEvent(actions, 'changeNblur', propName, getFormattedDate(date));
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
// 11. Main render — date picker
|
|
116
|
-
// Key props:
|
|
117
|
-
// - label, disabled, value: dateValue
|
|
118
|
-
// - format: dateFormatInfo.dateFormatString
|
|
119
|
-
// - onChange: handleChange
|
|
120
|
-
// - textField slot: required, variant: 'outlined', size: 'small',
|
|
121
|
-
// placeholder: dateFormatInfo.dateFormatStringLC,
|
|
122
|
-
// error: status === 'error', helperText: helperTextToDisplay,
|
|
123
|
-
// InputProps: { ...testProps }
|
|
124
|
-
return <DatePickerWidget ... />;
|
|
125
|
-
}
|
|
126
|
-
```
|
|
17
|
+
- **Registration key:** `Date` (in the project's component map)
|
|
18
|
+
|
|
19
|
+
> **Important naming note:** The component's export name should avoid conflicts with the platform's built-in `Date` global (e.g., use `DateField` as the import alias). Register it under the key `Date` in the project's component map.
|
|
20
|
+
|
|
21
|
+
## Inputs (component-specific)
|
|
22
|
+
|
|
23
|
+
No inputs beyond the project's field input contract (see prerequisite skill).
|
|
24
|
+
|
|
25
|
+
## Implementation Structure
|
|
26
|
+
|
|
27
|
+
Follow this exact structure. Replace the date-picker widget with an equivalent from your chosen design system.
|
|
28
|
+
|
|
29
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `TextInput` and `FieldValueList`), the project's event-commit utility, the project's formatting helpers (for display-mode value formatting), and the project's date-format utility (for locale-aware format strings). It also uses a date manipulation library (for parsing/formatting/validation) and a date picker UI component (for the calendar popup). Define the input contract as the project's field input contract with no additional fields.
|
|
30
|
+
|
|
31
|
+
**Helper function (top-level, outside the component):** `getFormattedDate(date)` returns the date as a `YYYY-MM-DD` string suitable for posting to the server, built from the date object's year, month (converted from 0-indexed to 1-indexed and zero-padded), and day (zero-padded).
|
|
32
|
+
|
|
33
|
+
**Main Component Logic** — steps in order:
|
|
34
|
+
|
|
35
|
+
1. **Registry lookups** — resolve `TextInput` and `FieldValueList` via the project's component registry.
|
|
36
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required`, `disabled`, `value`, `validatemessage`, `status`, `readOnly`, `testId`, `helperText`, `displayMode`, `hideLabel`.
|
|
37
|
+
3. **Local state** — `dateValue` typed as a date object or null, initialized from `value` (parsed via the date library) or `null` when `value` is empty.
|
|
38
|
+
4. **PConnect setup** — obtain the PConnect instance, its actions API, and the bound property name; compute `helperTextToDisplay = validatemessage || helperText`.
|
|
39
|
+
5. **Date format info** — start from the project's default date-format info and mutate its `dateFormatString`, `dateFormatStringLC`, and `dateFormatMask` properties with the locale-specific values returned by the project's date-format utility.
|
|
40
|
+
6. **Sync from store** — a lifecycle effect watching `value` updates `dateValue` (parsed via the date library) whenever it changes.
|
|
41
|
+
7. **Display mode returns** — for both `DISPLAY_ONLY` and `STACKED_LARGE_VAL`, compute the formatted date using the project's formatting helper with format type `'date'` and options `{ format: dateFormatInfo.dateFormatString }`, then return `FieldValueList` with that value (the latter with a stacked variant).
|
|
42
|
+
8. **Read-only return (before event handlers)** — when `readOnly` is true, render the `TextInput` component with all inputs passed through directly (full delegation).
|
|
43
|
+
9. **Test ID** — build a test-id attribute from `testId`.
|
|
44
|
+
10. **Change handler — only commits valid dates** — given a selected date: if it is valid, update local state and immediately commit via the project's event-commit utility with event type `'changeNblur'`, the property name, and the formatted `YYYY-MM-DD` string from `getFormattedDate(date)`; invalid or incomplete dates are ignored entirely (no state update, no commit).
|
|
45
|
+
11. **Render** — a date picker configured with: `label`, `disabled`, current `dateValue`, display format set to the locale-aware date format string, the change handler, and a nested text-field slot configured with `required`, an outlined style, small size, placeholder set to the lowercase format string (e.g., `mm/dd/yyyy`), an error state when `status === 'error'`, `helperText: helperTextToDisplay`, and the test-id attribute applied to the input element.
|
|
127
46
|
|
|
128
47
|
## Behavioral Contract
|
|
129
48
|
|
|
130
|
-
1. **Local state:** Maintain `dateValue` as a
|
|
131
|
-
2. **Sync from store:**
|
|
49
|
+
1. **Local state:** Maintain `dateValue` as a date object or null. Initialize: `value ? parse(value) : null`.
|
|
50
|
+
2. **Sync from store:** A lifecycle effect watching `value` updates `dateValue` (parsed via the date library).
|
|
132
51
|
3. **Helper text:** `helperTextToDisplay = validatemessage || helperText`.
|
|
133
|
-
4. **Date format info:** Start from
|
|
134
|
-
```
|
|
135
|
-
const dateFormatInfo = dateFormatInfoDefault;
|
|
136
|
-
const theDateFormat = getDateFormatInfo();
|
|
137
|
-
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
138
|
-
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
139
|
-
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
140
|
-
```
|
|
52
|
+
4. **Date format info:** Start from the project's default date-format info, then **mutate** its properties with locale-specific values from the project's date-format utility — specifically, copy the fresh `dateFormatString`, `dateFormatStringLC`, and `dateFormatMask` from the freshly-computed locale info onto the shared default object.
|
|
141
53
|
5. **On change (valid date selected):**
|
|
142
|
-
- Guard:
|
|
143
|
-
- Update state
|
|
54
|
+
- Guard: only proceed if the date is valid — skip invalid/incomplete dates.
|
|
55
|
+
- Update state with the selected date.
|
|
144
56
|
- Format to `YYYY-MM-DD` using `getFormattedDate(date)` (see Helper Function below).
|
|
145
|
-
- Commit immediately
|
|
146
|
-
6. **Read-only:** Return early
|
|
147
|
-
7. **Placeholder:** Use
|
|
148
|
-
8. **Test ID:** Build
|
|
57
|
+
- Commit immediately via the project's event-commit utility with event type `'changeNblur'`, the property name, and the formatted date.
|
|
58
|
+
6. **Read-only:** Return early by delegating to the `TextInput` component.
|
|
59
|
+
7. **Placeholder:** Use the lowercase format string from the date-format info (e.g., `'mm/dd/yyyy'`).
|
|
60
|
+
8. **Test ID:** Build a test-id attribute from `testId` and pass via the text field slot's input element.
|
|
149
61
|
|
|
150
62
|
## Helper Function
|
|
151
63
|
|
|
152
|
-
Top-level pure function (outside the component)
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
function getFormattedDate(date) {
|
|
156
|
-
return `${date.$y.toString()}-${(date.$M + 1).toString().padStart(2, '0')}-${date.$D.toString().padStart(2, '0')}`;
|
|
157
|
-
}
|
|
158
|
-
```
|
|
64
|
+
Top-level pure function (outside the component), named `getFormattedDate(date)`. It builds a `YYYY-MM-DD` string using the date object's internal properties: the year as-is, the month incremented by one (since it's 0-indexed) and zero-padded to two digits, and the day zero-padded to two digits, joined with hyphens.
|
|
159
65
|
|
|
160
|
-
**Note:**
|
|
66
|
+
**Note:** If using a different date library, replace with equivalent accessors for year, month (0-indexed), and day.
|
|
161
67
|
|
|
162
68
|
## Display Mode Rendering
|
|
163
69
|
|
|
164
|
-
Format the value before display using
|
|
70
|
+
Format the value before display using the project's formatting helper with format type `'date'` and options `{ format: dateFormatInfo.dateFormatString }`:
|
|
165
71
|
|
|
166
|
-
- **`DISPLAY_ONLY`:**
|
|
167
|
-
- **`STACKED_LARGE_VAL`:**
|
|
168
|
-
- Both modes compute
|
|
72
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to `label` (or empty when `hideLabel` is true) and `value` set to the formatted date.
|
|
73
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
74
|
+
- Both modes compute the formatted date from the raw `value` input (not local state).
|
|
169
75
|
|
|
170
76
|
## Read-Only Rendering
|
|
171
77
|
|
|
172
|
-
Delegate to `TextInput
|
|
78
|
+
Delegate to `TextInput`, passing all inputs through. The raw `YYYY-MM-DD` string is displayed as-is (or formatted by `TextInput`'s read-only rendering).
|
|
173
79
|
|
|
174
80
|
## Visual Specifications
|
|
175
81
|
|
|
@@ -190,32 +96,31 @@ Delegate to `TextInput`: `return <TextInput {...props} />`. The raw `YYYY-MM-DD`
|
|
|
190
96
|
|
|
191
97
|
- Commit on **change** (when a valid date is selected), not on blur — this differs from text inputs.
|
|
192
98
|
- Always store value as `YYYY-MM-DD` regardless of display format.
|
|
193
|
-
- Invalid/incomplete dates (e.g., partially typed) are ignored — only commit when
|
|
194
|
-
- Locale format info is derived at render time from
|
|
195
|
-
- **Render ordering:** display modes → readOnly return →
|
|
196
|
-
-
|
|
197
|
-
- `getFormattedDate` accesses
|
|
99
|
+
- Invalid/incomplete dates (e.g., partially typed) are ignored — only commit when the date is valid.
|
|
100
|
+
- Locale format info is derived at render time from the project's date-format utility — this reads the Pega environment locale.
|
|
101
|
+
- **Render ordering:** display modes → readOnly return → test-id → change handler → main render. The readOnly check comes BEFORE handler definitions.
|
|
102
|
+
- The default date-format info object is mutated in place (not spread-copied) — this is the existing pattern, maintain it.
|
|
103
|
+
- `getFormattedDate` accesses date library internals for year, month (0-indexed), day — if using a different date library, adapt the accessors.
|
|
198
104
|
|
|
199
105
|
## Dependencies
|
|
200
106
|
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
-
|
|
205
|
-
- `format()
|
|
206
|
-
-
|
|
207
|
-
- `
|
|
208
|
-
- `
|
|
107
|
+
- A date manipulation library (for parsing, formatting, validity checking).
|
|
108
|
+
- A date picker UI component (for the calendar popup).
|
|
109
|
+
- The project's date-format utility — for locale-aware format string.
|
|
110
|
+
- The project's default date-format info — default fallback.
|
|
111
|
+
- 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.
|
|
112
|
+
- The project's event-commit utility.
|
|
113
|
+
- The project's component registry, resolving `TextInput` — for read-only delegation.
|
|
114
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
209
115
|
|
|
210
116
|
## Design System Mapping
|
|
211
117
|
|
|
212
118
|
**UI control type:** Date picker with calendar popup.
|
|
213
119
|
|
|
214
|
-
|
|
120
|
+
When implementing in a specific design system, map the following:
|
|
215
121
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
| Chakra UI | Third-party date picker or `<input type="date">` |
|
|
122
|
+
- **Date picker** → use the DS's date picker component or a compatible third-party date picker
|
|
123
|
+
- **Date format** → pass the locale-aware format string from the project's date-format utility
|
|
124
|
+
- **Placeholder** → the lowercase version of the format string
|
|
125
|
+
- **Read-only mode** → delegate to the `TextInput` component
|
|
126
|
+
- **Commit behavior** → commit on valid date selection (not on blur)
|