@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
|
Date and time picker with timezone conversion, 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,157 +14,59 @@ Renders a combined date and time picker. Stores values as ISO 8601 UTC strings.
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `DateTime`
|
|
16
16
|
- **Type / Subtype:** `Field` / `DateTime`
|
|
17
|
-
- **Registration key:** `DateTime` (in
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
No
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export default function DateTime(props: DateTimeProps) {
|
|
44
|
-
// 1. Registry lookups
|
|
45
|
-
const TextInput = getComponentFromRegistry('TextInput');
|
|
46
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
47
|
-
|
|
48
|
-
// 2. Destructure props
|
|
49
|
-
const {
|
|
50
|
-
getPConnect, label, required, disabled, value = '',
|
|
51
|
-
validatemessage, status, readOnly, testId,
|
|
52
|
-
helperText, displayMode, hideLabel,
|
|
53
|
-
} = props;
|
|
54
|
-
|
|
55
|
-
// 3. Timezone
|
|
56
|
-
const environmentInfo = PCore.getEnvironmentInfo();
|
|
57
|
-
const timezone = environmentInfo && environmentInfo.getTimeZone();
|
|
58
|
-
|
|
59
|
-
// 4. State — convert UTC value to environment timezone for display
|
|
60
|
-
const [dateValue, setDateValue] = useState<Dayjs | null>(
|
|
61
|
-
value ? dayjs(DateFormatter.convertToTimezone(value, { timezone })) : null
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
// 5. PConnect setup
|
|
65
|
-
const pConn = getPConnect();
|
|
66
|
-
const actions = pConn.getActionsApi();
|
|
67
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
68
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
69
|
-
|
|
70
|
-
// 6. Date format info (mutate default with locale values)
|
|
71
|
-
const dateFormatInfo = dateFormatInfoDefault;
|
|
72
|
-
const theDateFormat = getDateFormatInfo();
|
|
73
|
-
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
74
|
-
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
75
|
-
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
76
|
-
|
|
77
|
-
// 7. useEffect: sync from store — deps: [value]
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
setDateValue(dayjs(DateFormatter.convertToTimezone(value, { timezone })));
|
|
80
|
-
}, [value]);
|
|
81
|
-
|
|
82
|
-
// 8. Display mode returns
|
|
83
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
84
|
-
const formattedDateTime = format(props.value, 'datetime', {
|
|
85
|
-
format: `${dateFormatInfo.dateFormatString} hh:mm a`,
|
|
86
|
-
});
|
|
87
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} />;
|
|
88
|
-
}
|
|
89
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
90
|
-
const formattedDateTime = format(props.value, 'datetime', {
|
|
91
|
-
format: `${dateFormatInfo.dateFormatString} hh:mm a`,
|
|
92
|
-
});
|
|
93
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} variant="stacked" />;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// 9. Read-only return
|
|
97
|
-
if (readOnly) {
|
|
98
|
-
const formattedDateTime = format(props.value, 'datetime');
|
|
99
|
-
return <TextInput {...props} value={formattedDateTime} />;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// 10. Test ID prop
|
|
103
|
-
const testProps: any = { 'data-test-id': testId };
|
|
104
|
-
|
|
105
|
-
// 11. handleChange — convert to timezone-aware ISO, commit immediately
|
|
106
|
-
const handleChange = (date) => {
|
|
107
|
-
const timeZoneDateTime = (dayjs as any).tz(
|
|
108
|
-
date.format('YYYY-MM-DDTHH:mm:ss'), timezone
|
|
109
|
-
);
|
|
110
|
-
const changeValue = timeZoneDateTime?.isValid()
|
|
111
|
-
? timeZoneDateTime.toISOString() : '';
|
|
112
|
-
setDateValue(timeZoneDateTime);
|
|
113
|
-
handleEvent(actions, 'changeNblur', propName, changeValue);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// 12. Main render — datetime picker
|
|
117
|
-
// Key props:
|
|
118
|
-
// - disabled, label, value: dateValue
|
|
119
|
-
// - format: `${dateFormatInfo.dateFormatString} hh:mm a`
|
|
120
|
-
// - minutesStep: 5
|
|
121
|
-
// - onChange: handleChange
|
|
122
|
-
// - textField slot: variant 'outlined', required, size 'small',
|
|
123
|
-
// placeholder: `${dateFormatInfo.dateFormatStringLC} hh:mm a`,
|
|
124
|
-
// error: status === 'error', helperText: helperTextToDisplay,
|
|
125
|
-
// InputProps: { ...testProps }
|
|
126
|
-
return <DateTimePickerWidget ... />;
|
|
127
|
-
}
|
|
128
|
-
```
|
|
17
|
+
- **Registration key:** `DateTime` (in the project's component map)
|
|
18
|
+
|
|
19
|
+
## Inputs (component-specific)
|
|
20
|
+
|
|
21
|
+
No inputs beyond the project's field input contract (see prerequisite skill).
|
|
22
|
+
|
|
23
|
+
## Implementation Structure
|
|
24
|
+
|
|
25
|
+
Follow this exact structure. Replace the date-time picker widget with an equivalent from your chosen design system.
|
|
26
|
+
|
|
27
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `TextInput` and `FieldValueList`), the project's event-commit utility, a date-to-timezone conversion helper from the project's date formatter module, the project's formatting helpers, and the project's date-format utility (for locale-aware format strings). It also uses a date manipulation library with timezone support and a date-time picker UI component. Define the input contract as the project's field input contract with no additional fields.
|
|
28
|
+
|
|
29
|
+
**Main Component Logic** — steps in order:
|
|
30
|
+
|
|
31
|
+
1. **Registry lookups** — resolve `TextInput` and `FieldValueList` via the project's component registry.
|
|
32
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required`, `disabled`, `value` (default `''`), `validatemessage`, `status`, `readOnly`, `testId`, `helperText`, `displayMode`, `hideLabel`.
|
|
33
|
+
3. **Timezone** — read the environment timezone at render time via `PCore.getEnvironmentInfo().getTimeZone()`.
|
|
34
|
+
4. **Local state** — `dateValue` typed as a date object or null, initialized by converting `value` to the environment timezone via the project's date-to-timezone conversion helper and wrapping in the date library's parser (or `null` when `value` is empty).
|
|
35
|
+
5. **PConnect setup** — obtain the PConnect instance, its actions API, and the bound property name; compute `helperTextToDisplay = validatemessage || helperText`.
|
|
36
|
+
6. **Date format info** — start from the project's default date-format info and mutate its `dateFormatString`, `dateFormatStringLC`, and `dateFormatMask` properties with locale-specific values from the project's date-format utility (same pattern as the Date component).
|
|
37
|
+
7. **Sync from store** — a lifecycle effect watching `value` re-runs the same timezone conversion and updates `dateValue`.
|
|
38
|
+
8. **Display mode returns** — for both `DISPLAY_ONLY` and `STACKED_LARGE_VAL`, compute the formatted date-time using the project's formatting helper with format type `'datetime'` and options `{ format: '<dateFormatString> hh:mm a' }`, then return `FieldValueList` with that value (the latter with a stacked variant).
|
|
39
|
+
9. **Read-only return** — compute the formatted date-time using the project's formatting helper with format type `'datetime'` (no format option) and render the `TextInput` component with all inputs passed through, overriding `value` with the formatted string.
|
|
40
|
+
10. **Test ID** — build a test-id attribute from `testId`.
|
|
41
|
+
11. **Change handler — convert to timezone-aware ISO, commit immediately** — build a timezone-aware date instance from the selected date's `'YYYY-MM-DDTHH:mm:ss'` string and the environment timezone; if that instance is valid, convert it to an ISO string, otherwise use an empty string; update local state with the timezone-aware instance and immediately commit via the project's event-commit utility with event type `'changeNblur'`, the property name, and the ISO string.
|
|
42
|
+
12. **Render** — a datetime picker configured with: `disabled`, `label`, current `dateValue`, a combined format of the locale-aware date format string plus `' hh:mm a'`, minutes step of `5`, the change handler, and a nested text-field slot configured with an outlined style, `required`, small size, a combined placeholder of the lowercase date format plus `' hh:mm a'`, an error state when `status === 'error'`, `helperText: helperTextToDisplay`, and the test-id attribute applied to the input element.
|
|
129
43
|
|
|
130
44
|
## Behavioral Contract
|
|
131
45
|
|
|
132
|
-
1. **Timezone:** Read the environment timezone at render time
|
|
133
|
-
|
|
134
|
-
const environmentInfo = PCore.getEnvironmentInfo();
|
|
135
|
-
const timezone = environmentInfo && environmentInfo.getTimeZone();
|
|
136
|
-
```
|
|
137
|
-
2. **Local state:** Maintain `dateValue` as `Dayjs | null`. Initialize: `value ? dayjs(DateFormatter.convertToTimezone(value, { timezone })) : null`.
|
|
46
|
+
1. **Timezone:** Read the environment timezone at render time via `PCore.getEnvironmentInfo()` and its `getTimeZone()` accessor (guard against a missing environment info object).
|
|
47
|
+
2. **Local state:** Maintain `dateValue` as a date object or null. Initialize: convert `value` from UTC to the environment timezone using the project's date-to-timezone conversion helper, then parse with the date library (or `null` when `value` is empty).
|
|
138
48
|
3. **Helper text:** `helperTextToDisplay = validatemessage || helperText`.
|
|
139
|
-
4. **Sync from store:**
|
|
140
|
-
5. **Date/time format:** Mutate
|
|
141
|
-
6. **Minutes step:** `
|
|
49
|
+
4. **Sync from store:** A lifecycle effect watching `value` re-runs the timezone conversion and updates `dateValue`.
|
|
50
|
+
5. **Date/time format:** Mutate the default date-format info with locale values from the project's date-format utility (same pattern as Date component). Combined format: the date format string plus `' hh:mm a'`.
|
|
51
|
+
6. **Minutes step:** `5` — time picker snaps to 5-minute increments.
|
|
142
52
|
7. **On change:**
|
|
143
|
-
- Convert the selected date to timezone-aware ISO string:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
- Commit immediately: `handleEvent(actions, 'changeNblur', propName, changeValue)`.
|
|
150
|
-
8. **Read-only:** Format with `format(props.value, 'datetime')` (no format option), delegate to `TextInput`.
|
|
151
|
-
9. **Test ID:** `testProps = { 'data-test-id': testId }` — passed via `InputProps` on the text field slot.
|
|
152
|
-
10. **Render ordering:** display modes → readOnly → testProps → handleChange → main render.
|
|
53
|
+
- Convert the selected date to a timezone-aware ISO string: build a timezone-aware date instance from the date formatted as `'YYYY-MM-DDTHH:mm:ss'` and the environment timezone; if that instance is valid, convert to an ISO string, otherwise use an empty string.
|
|
54
|
+
- Update state with the timezone-aware date instance.
|
|
55
|
+
- Commit immediately via the project's event-commit utility with event type `'changeNblur'`, the property name, and the ISO string.
|
|
56
|
+
8. **Read-only:** Format with the project's formatting helper using format type `'datetime'` (no format option), then delegate to `TextInput` with the formatted string as the `value` override.
|
|
57
|
+
9. **Test ID:** Build a test-id attribute from `testId` and pass via the text field slot's input element.
|
|
58
|
+
10. **Render ordering:** display modes → readOnly → test-id → change handler → main render.
|
|
153
59
|
|
|
154
60
|
## Display Mode Rendering
|
|
155
61
|
|
|
156
|
-
Format using
|
|
62
|
+
Format using the project's formatting helper with format type `'datetime'` and options `{ format: '<dateFormatString> hh:mm a' }`:
|
|
157
63
|
|
|
158
|
-
- **`DISPLAY_ONLY`:**
|
|
159
|
-
- **`STACKED_LARGE_VAL`:**
|
|
64
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to `label` (or empty when `hideLabel` is true) and `value` set to the formatted date-time.
|
|
65
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
160
66
|
|
|
161
67
|
## Read-Only Rendering
|
|
162
68
|
|
|
163
|
-
Format value
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
return <TextInput {...props} value={formattedDateTime} />
|
|
167
|
-
```
|
|
69
|
+
Format value using the project's formatting helper with format type `'datetime'` (no format option), then pass it as the `value` override to `TextInput`, along with all other inputs.
|
|
168
70
|
|
|
169
71
|
## Visual Specifications
|
|
170
72
|
|
|
@@ -184,30 +86,30 @@ return <TextInput {...props} value={formattedDateTime} />
|
|
|
184
86
|
|
|
185
87
|
- All stored values are **UTC ISO 8601 strings** (e.g., `'2024-03-15T14:30:00.000Z'`).
|
|
186
88
|
- **Timezone conversion** is critical: always convert from UTC → environment timezone for display, and from environment timezone → UTC when committing.
|
|
187
|
-
- If
|
|
89
|
+
- If the timezone-aware date instance is invalid, commit an empty string `''`.
|
|
188
90
|
- Commits on **change** (picker selection), not on blur.
|
|
189
|
-
-
|
|
91
|
+
- The date library's timezone plugin is required for timezone-aware conversions.
|
|
190
92
|
|
|
191
93
|
## Dependencies
|
|
192
94
|
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
- `format()
|
|
196
|
-
-
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
-
- `
|
|
200
|
-
- `
|
|
95
|
+
- A date manipulation library with timezone support (e.g., the date library plus its timezone plugin).
|
|
96
|
+
- The project's date-to-timezone conversion helper — converts stored UTC value to display timezone.
|
|
97
|
+
- 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.
|
|
98
|
+
- The project's date-format utility — for locale date format string.
|
|
99
|
+
- A date-time picker UI component (for the combined calendar + time popup).
|
|
100
|
+
- The project's event-commit utility.
|
|
101
|
+
- The project's component registry, resolving `TextInput` — for read-only delegation.
|
|
102
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
201
103
|
|
|
202
104
|
## Design System Mapping
|
|
203
105
|
|
|
204
106
|
**UI control type:** Combined date and time picker with timezone awareness.
|
|
205
107
|
|
|
206
|
-
|
|
108
|
+
When implementing in a specific design system, map the following:
|
|
207
109
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
110
|
+
- **Date-time picker** → use the DS's combined date-time picker component or a compatible third-party picker
|
|
111
|
+
- **Date format** → pass the combined locale-aware format string (date portion plus `' hh:mm a'`)
|
|
112
|
+
- **Timezone conversion** → convert UTC ↔ environment timezone on read/write using the project's date-to-timezone helper
|
|
113
|
+
- **Minutes step** → configure the time picker to snap to 5-minute increments
|
|
114
|
+
- **Read-only mode** → format the value and delegate to `TextInput`
|
|
115
|
+
- **Commit behavior** → commit on valid selection (not on blur)
|
|
@@ -2,158 +2,80 @@
|
|
|
2
2
|
|
|
3
3
|
Decimal number input with configurable precision, group separators, and optional currency/percentage display formatting.
|
|
4
4
|
|
|
5
|
-
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture,
|
|
5
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, input contract, display modes, event handling, and registration patterns common to ALL field components.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Component Purpose
|
|
10
10
|
|
|
11
|
-
Renders a numeric input that accepts decimal values. Supports configurable decimal precision, optional thousands separator, and optional formatter override (`'Currency'` or `'Percentage'`). Differs from `Currency` in that it's more generic — it can display values as currency, percentage, or plain decimal based on a `formatter`
|
|
11
|
+
Renders a numeric input that accepts decimal values. Supports configurable decimal precision, optional thousands separator, and optional formatter override (`'Currency'` or `'Percentage'`). Differs from `Currency` in that it's more generic — it can display values as currency, percentage, or plain decimal based on a `formatter` input.
|
|
12
12
|
|
|
13
13
|
## Pega Metadata
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `Decimal`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Decimal`
|
|
17
|
-
- **Registration key:** `Decimal` (in
|
|
17
|
+
- **Registration key:** `Decimal` (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 for symbol/separator lookup (used when `formatter === 'Currency'`) |
|
|
24
24
|
| `decimalPrecision` | `number` (optional) | — | Number of decimal places to show |
|
|
25
25
|
| `showGroupSeparators` | `boolean` (optional) | — | Whether to show thousands separators |
|
|
26
26
|
| `formatter` | `string` (optional) | — | `'Currency'` or `'Percentage'` — changes display mode formatting and read-only prefix/suffix |
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
All other inputs come from the project's field input contract (see prerequisite skill).
|
|
29
|
+
|
|
30
|
+
## Implementation Structure
|
|
29
31
|
|
|
30
32
|
Follow this exact structure. Nearly identical to Currency but with configurable precision and conditional prefix/suffix.
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export default function Decimal(props: DecimalProps) {
|
|
48
|
-
// 1. Registry lookup
|
|
49
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
50
|
-
|
|
51
|
-
// 2. Destructure props
|
|
52
|
-
const {
|
|
53
|
-
getPConnect, label, required, disabled, value = '',
|
|
54
|
-
validatemessage, status, readOnly, helperText, displayMode,
|
|
55
|
-
hideLabel, currencyISOCode = 'USD', decimalPrecision,
|
|
56
|
-
showGroupSeparators, testId, placeholder, formatter,
|
|
57
|
-
} = props;
|
|
58
|
-
|
|
59
|
-
// 3. State
|
|
60
|
-
const [values, setValues] = useState(value.toString());
|
|
61
|
-
|
|
62
|
-
// 4. PConnect setup
|
|
63
|
-
const pConn = getPConnect();
|
|
64
|
-
const actions = pConn.getActionsApi();
|
|
65
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
66
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
67
|
-
|
|
68
|
-
// 5. Currency/decimal symbols
|
|
69
|
-
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
70
|
-
const theCurrDec = theSymbols.theDecimalIndicator;
|
|
71
|
-
const theCurrSep = theSymbols.theDigitGroupSeparator;
|
|
72
|
-
const theCurrSym = theSymbols.theCurrencySymbol;
|
|
73
|
-
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
74
|
-
|
|
75
|
-
// 6. useEffect: sync from store — deps: [value]
|
|
76
|
-
useEffect(() => { setValues(value.toString()); }, [value]);
|
|
77
|
-
|
|
78
|
-
// 7. Read-only prop
|
|
79
|
-
let readOnlyProp = {};
|
|
80
|
-
if (readOnly) readOnlyProp = { readOnly: true };
|
|
81
|
-
|
|
82
|
-
// 8. Formatted value (computed eagerly, before display mode check)
|
|
83
|
-
let formattedValue = '';
|
|
84
|
-
if (formatter === 'Currency') {
|
|
85
|
-
formattedValue = format(value, formatter.toLowerCase(), theCurrencyOptions);
|
|
86
|
-
} else {
|
|
87
|
-
formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// 9. Display mode returns
|
|
91
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
92
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
|
|
93
|
-
}
|
|
94
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
95
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant="stacked" />;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// 10. Test ID + event handlers
|
|
99
|
-
const testProps: any = { 'data-test-id': testId };
|
|
100
|
-
function decimalOnBlur() { handleEvent(actions, 'changeNblur', propName, values); }
|
|
101
|
-
const handleChange = (val) => { setValues(val.value); };
|
|
102
|
-
|
|
103
|
-
// 11. Main render — numeric format input
|
|
104
|
-
// Key props:
|
|
105
|
-
// - valueIsNumericString: true, fullWidth: true
|
|
106
|
-
// - value: values
|
|
107
|
-
// - variant: readOnly ? 'standard' : 'outlined'
|
|
108
|
-
// - prefix: readOnly && formatter === 'Currency' ? theCurrSym : ''
|
|
109
|
-
// - suffix: readOnly && formatter === 'Percentage' ? '%' : ''
|
|
110
|
-
// - decimalSeparator: theCurrDec
|
|
111
|
-
// - thousandSeparator: showGroupSeparators ? theCurrSep : ''
|
|
112
|
-
// - decimalScale: readOnly && formatter === 'Currency' ? undefined : decimalPrecision
|
|
113
|
-
// - onValueChange, onBlur: !readOnly ? decimalOnBlur : undefined
|
|
114
|
-
// - label, helperText: helperTextToDisplay, placeholder: placeholder ?? ''
|
|
115
|
-
// - required, disabled, error: status === 'error', size: 'small'
|
|
116
|
-
// - slotProps: { input: { ...readOnlyProp, inputProps: { ...testProps } } }
|
|
117
|
-
return <NumericFormatInput ... />;
|
|
118
|
-
}
|
|
119
|
-
```
|
|
34
|
+
**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/symbol lookup), and the project's formatting helpers (for display-mode value formatting). It also uses a numeric-format masking library that handles locale-aware decimal/thousands display within a text input. Define the input contract as an extension of the project's field input contract, adding optional `currencyISOCode`, `decimalPrecision`, `showGroupSeparators`, and `formatter` fields.
|
|
35
|
+
|
|
36
|
+
**Main Component Logic** — steps in order:
|
|
37
|
+
|
|
38
|
+
1. **Registry lookup** — resolve `FieldValueList` via the project's component registry.
|
|
39
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required`, `disabled`, `value` (default `''`), `validatemessage`, `status`, `readOnly`, `helperText`, `displayMode`, `hideLabel`, `currencyISOCode` (default `'USD'`), `decimalPrecision`, `showGroupSeparators`, `testId`, `placeholder`, `formatter`.
|
|
40
|
+
3. **Local state** — `values` initialized from `value.toString()`.
|
|
41
|
+
4. **PConnect setup** — obtain the PConnect instance, its actions API, and the bound property name; compute `helperTextToDisplay = validatemessage || helperText`.
|
|
42
|
+
5. **Currency/decimal symbols** — derive the decimal indicator, digit group separator, and currency symbol via the project's currency utility helpers using `currencyISOCode`, and obtain the currency formatting options object.
|
|
43
|
+
6. **Sync from store** — a lifecycle effect watching `value` updates `values` (as a string) whenever it changes.
|
|
44
|
+
7. **Read-only flag** — build a read-only configuration, set to mark the input read-only only when `readOnly` is true.
|
|
45
|
+
8. **Formatted value** — computed eagerly, before the display-mode check: if `formatter === 'Currency'`, compute the formatted value using the project's formatting helper with format key `'currency'` and the currency options; otherwise compute using the component's type name (from `pConn.getComponentName()?.toLowerCase()`) as the format key with the same currency options.
|
|
46
|
+
9. **Display mode returns** — `DISPLAY_ONLY` and `STACKED_LARGE_VAL` both return `FieldValueList` using the formatted value, the latter with a stacked variant.
|
|
47
|
+
10. **Test ID and event handlers** — build a test-id attribute from `testId`; 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
|
+
11. **Render** — a numeric-format input configured with: value-is-numeric-string flag, full width, current `values`, an outlined style when editable or flat/borderless style when read-only, prefix set to the currency symbol only when read-only AND `formatter === 'Currency'` (otherwise empty), suffix set to `'%'` only when read-only AND `formatter === 'Percentage'` (otherwise empty), 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 `undefined` when read-only AND `formatter === 'Currency'` (otherwise `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.
|
|
120
49
|
|
|
121
50
|
## Behavioral Contract
|
|
122
51
|
|
|
123
52
|
1. **Local state:** Maintain `values` (string). Initialize from `value.toString()`.
|
|
124
|
-
2. **Sync from store:**
|
|
53
|
+
2. **Sync from store:** A lifecycle effect watching `value` updates `values` (converted to string).
|
|
125
54
|
3. **Helper text:** `helperTextToDisplay = validatemessage || helperText`.
|
|
126
|
-
4. **Separators:** Derive
|
|
127
|
-
5. **Formatted value (computed eagerly):**
|
|
128
|
-
```
|
|
129
|
-
if (formatter === 'Currency') {
|
|
130
|
-
formattedValue = format(value, formatter.toLowerCase(), theCurrencyOptions);
|
|
131
|
-
} else {
|
|
132
|
-
formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
|
|
133
|
-
}
|
|
134
|
-
```
|
|
55
|
+
4. **Separators:** Derive the decimal indicator and digit group separator from the project's currency utility helpers using `currencyISOCode`. Apply the thousands separator only when `showGroupSeparators` is truthy (otherwise pass an empty string).
|
|
56
|
+
5. **Formatted value (computed eagerly):** When `formatter === 'Currency'`, compute the formatted value using the project's formatting helper with format key `'currency'` and the currency options; otherwise compute using the component's type name (from `pConn.getComponentName()?.toLowerCase()`) as the format key with the same options.
|
|
135
57
|
6. **Prefix/Suffix (read-only only):**
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
7. **Decimal scale:** `
|
|
139
|
-
8. **On value change:** `
|
|
140
|
-
9. **On blur:**
|
|
141
|
-
10. **Read-only:** Set
|
|
142
|
-
11. **Render ordering:** state →
|
|
58
|
+
- Prefix: the currency symbol when read-only AND `formatter === 'Currency'`, otherwise empty.
|
|
59
|
+
- Suffix: `'%'` when read-only AND `formatter === 'Percentage'`, otherwise empty.
|
|
60
|
+
7. **Decimal scale:** `undefined` when read-only AND `formatter === 'Currency'` (let the formatter decide), otherwise `decimalPrecision`.
|
|
61
|
+
8. **On value change:** Update `values` with the raw numeric string from the masking library's callback.
|
|
62
|
+
9. **On blur:** Commit via the project's event-commit utility with event type `'changeNblur'`, the property name, and `values`.
|
|
63
|
+
10. **Read-only:** Set the read-only attribute on the underlying input. Switch to a flat/borderless visual style. Omit the blur handler.
|
|
64
|
+
11. **Render ordering:** state → read-only flag → formatted value → display modes → test-id + handlers → main render.
|
|
143
65
|
|
|
144
66
|
## Display Mode Rendering
|
|
145
67
|
|
|
146
|
-
- **`DISPLAY_ONLY`:**
|
|
147
|
-
- **`STACKED_LARGE_VAL`:**
|
|
68
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to `label` (or empty when `hideLabel` is true) and `value` set to the formatted value.
|
|
69
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` the same way, with a stacked layout variant.
|
|
148
70
|
|
|
149
|
-
|
|
71
|
+
The formatted value is computed before the display-mode check:
|
|
150
72
|
|
|
151
73
|
- `formatter === 'Currency'` → currency-formatted string.
|
|
152
|
-
- Otherwise → decimal-formatted string using
|
|
74
|
+
- Otherwise → decimal-formatted string using the component's type name as the format key.
|
|
153
75
|
|
|
154
76
|
## Read-Only Rendering
|
|
155
77
|
|
|
156
|
-
Keep numeric
|
|
78
|
+
Keep the numeric-format input with the read-only attribute set. Apply prefix (currency symbol) or suffix (`%`) based on `formatter`. Use a flat/borderless visual style.
|
|
157
79
|
|
|
158
80
|
## Visual Specifications
|
|
159
81
|
|
|
@@ -161,38 +83,37 @@ Keep numeric format input with `readOnly: true`. Apply prefix (`$`) or suffix (`
|
|
|
161
83
|
| ------------------- | ------------------------------------ | ---------------------------------------------------- |
|
|
162
84
|
| Width | 100% | 100% |
|
|
163
85
|
| Size | Small | Small |
|
|
164
|
-
| Variant | Outlined |
|
|
86
|
+
| Variant | Outlined | Flat/borderless |
|
|
165
87
|
| Prefix | None (unless read-only Currency) | Currency symbol if `formatter='Currency'` |
|
|
166
88
|
| Suffix | None (unless read-only Percentage) | `%` if `formatter='Percentage'` |
|
|
167
89
|
| Thousands separator | Only when `showGroupSeparators=true` | Same |
|
|
168
90
|
| Decimal scale | From `decimalPrecision` | Undefined for Currency, `decimalPrecision` otherwise |
|
|
169
|
-
| Placeholder | From `placeholder`
|
|
91
|
+
| Placeholder | From the `placeholder` input | — |
|
|
170
92
|
|
|
171
93
|
## Edge Cases & Special Logic
|
|
172
94
|
|
|
173
|
-
- In read-only Currency mode,
|
|
174
|
-
- `thousandSeparator` defaults to
|
|
175
|
-
-
|
|
95
|
+
- In read-only Currency mode, decimal scale is set to `undefined` (let the formatter decide), not `decimalPrecision`.
|
|
96
|
+
- `thousandSeparator` defaults to empty string (disabled) unless `showGroupSeparators` is `true`.
|
|
97
|
+
- Prefix and suffix are only rendered in read-only mode — NOT in editable mode.
|
|
176
98
|
- The stored value is always a raw numeric string, not the formatted display string.
|
|
177
99
|
|
|
178
100
|
## Dependencies
|
|
179
101
|
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
- `format()
|
|
184
|
-
-
|
|
185
|
-
- `
|
|
102
|
+
- A numeric-format masking library (for locale-aware decimal/thousands display within a text input).
|
|
103
|
+
- The project's currency utility helpers — for decimal indicator, digit group separator, and currency symbol lookup.
|
|
104
|
+
- The project's currency options helper — for formatting options based on ISO code.
|
|
105
|
+
- 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.
|
|
106
|
+
- The project's event-commit utility.
|
|
107
|
+
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
186
108
|
|
|
187
109
|
## Design System Mapping
|
|
188
110
|
|
|
189
111
|
**UI control type:** Decimal / numeric formatted input.
|
|
190
112
|
|
|
191
|
-
|
|
113
|
+
When implementing in a specific design system, map the following:
|
|
192
114
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
| Chakra UI | `<NumberInput>` |
|
|
115
|
+
- **Numeric format input** → use a numeric masking library compatible with the project's framework, or implement custom input masking
|
|
116
|
+
- **Decimal/thousands separators** → derive from the currency utility helpers based on the ISO code
|
|
117
|
+
- **Read-only prefix/suffix** → conditionally display the currency symbol or `%` sign
|
|
118
|
+
- **Error state** → the DS's error/danger visual state
|
|
119
|
+
- **Flat/borderless style** → the DS's read-only/standard input variant
|