@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.
Files changed (266) hide show
  1. package/README.md +10 -3
  2. package/dist/index.js +764 -165
  3. package/package.json +1 -1
  4. package/templates/react-native-sdk-reference/.claude/settings.json +5 -0
  5. package/templates/react-native-sdk-reference/.prettierignore +17 -0
  6. package/templates/react-native-sdk-reference/.vscode/extensions.json +1 -0
  7. package/templates/react-native-sdk-reference/.vscode/settings.json +7 -0
  8. package/templates/react-native-sdk-reference/AGENTS.md +3 -0
  9. package/templates/react-native-sdk-reference/CLAUDE.md +1 -0
  10. package/templates/react-native-sdk-reference/README.md +56 -0
  11. package/templates/react-native-sdk-reference/app.json +40 -5
  12. package/templates/react-native-sdk-reference/assets/expo.icon/Assets/expo-symbol 2.svg +3 -0
  13. package/templates/react-native-sdk-reference/assets/expo.icon/Assets/grid.png +0 -0
  14. package/templates/react-native-sdk-reference/assets/expo.icon/icon.json +35 -0
  15. package/templates/react-native-sdk-reference/assets/icons/bell.png +0 -0
  16. package/templates/react-native-sdk-reference/assets/icons/clock.png +0 -0
  17. package/templates/react-native-sdk-reference/assets/icons/cross.png +0 -0
  18. package/templates/react-native-sdk-reference/assets/icons/donut.png +0 -0
  19. package/templates/react-native-sdk-reference/assets/icons/gear.png +0 -0
  20. package/templates/react-native-sdk-reference/assets/icons/globe.png +0 -0
  21. package/templates/react-native-sdk-reference/assets/icons/internet.png +0 -0
  22. package/templates/react-native-sdk-reference/assets/icons/music.png +0 -0
  23. package/templates/react-native-sdk-reference/assets/icons/right-arrow.png +0 -0
  24. package/templates/react-native-sdk-reference/assets/icons/speed.png +0 -0
  25. package/templates/react-native-sdk-reference/assets/images/MediaCo.png +0 -0
  26. package/templates/react-native-sdk-reference/assets/images/adaptive-icon.png +0 -0
  27. package/templates/react-native-sdk-reference/assets/images/android-icon-background.png +0 -0
  28. package/templates/react-native-sdk-reference/assets/images/android-icon-foreground.png +0 -0
  29. package/templates/react-native-sdk-reference/assets/images/android-icon-monochrome.png +0 -0
  30. package/templates/react-native-sdk-reference/assets/images/expo-badge-white.png +0 -0
  31. package/templates/react-native-sdk-reference/assets/images/expo-badge.png +0 -0
  32. package/templates/react-native-sdk-reference/assets/images/expo-logo.png +0 -0
  33. package/templates/react-native-sdk-reference/assets/images/favicon.png +0 -0
  34. package/templates/react-native-sdk-reference/assets/images/icon.png +0 -0
  35. package/templates/react-native-sdk-reference/assets/images/logo-glow.png +0 -0
  36. package/templates/react-native-sdk-reference/assets/images/partial-react-logo.png +0 -0
  37. package/templates/react-native-sdk-reference/assets/images/react-logo.png +0 -0
  38. package/templates/react-native-sdk-reference/assets/images/react-logo@2x.png +0 -0
  39. package/templates/react-native-sdk-reference/assets/images/react-logo@3x.png +0 -0
  40. package/templates/react-native-sdk-reference/assets/images/splash-icon.png +0 -0
  41. package/templates/react-native-sdk-reference/assets/images/tutorial-web.png +0 -0
  42. package/templates/react-native-sdk-reference/eslint.config.mjs +68 -0
  43. package/templates/react-native-sdk-reference/package.json +59 -14
  44. package/templates/react-native-sdk-reference/pega-constellationjs-0.26.3.tgz +0 -0
  45. package/templates/react-native-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
  46. package/templates/react-native-sdk-reference/pega-sdk-types-0.1.0.tgz +0 -0
  47. package/templates/react-native-sdk-reference/sdk-config.json +31 -9
  48. package/templates/react-native-sdk-reference/src/app/_layout.tsx +38 -0
  49. package/templates/react-native-sdk-reference/src/app/home/_layout.tsx +39 -0
  50. package/templates/react-native-sdk-reference/src/app/home/contact.tsx +11 -0
  51. package/templates/react-native-sdk-reference/src/app/home/index.tsx +36 -0
  52. package/templates/react-native-sdk-reference/src/app/home/shop.tsx +11 -0
  53. package/templates/react-native-sdk-reference/src/app/home/your-services.tsx +11 -0
  54. package/templates/react-native-sdk-reference/src/app/index.tsx +72 -0
  55. package/templates/react-native-sdk-reference/src/app/workarea.tsx +135 -0
  56. package/templates/react-native-sdk-reference/src/bridge/Context/StoreContext.ts +4 -0
  57. package/templates/react-native-sdk-reference/src/bridge/RootComponent.tsx +12 -0
  58. package/templates/react-native-sdk-reference/src/bridge/react_pconnect.jsx +334 -0
  59. package/templates/react-native-sdk-reference/src/components/common/DisplayField.tsx +29 -0
  60. package/templates/react-native-sdk-reference/src/components/common/FormFieldWrapper.tsx +5 -0
  61. package/templates/react-native-sdk-reference/src/components/common/HelperText.tsx +11 -0
  62. package/templates/react-native-sdk-reference/src/components/common/LabelText.tsx +22 -0
  63. package/templates/react-native-sdk-reference/src/components/common/inputTheme.ts +17 -0
  64. package/templates/react-native-sdk-reference/src/components/design-system/AutoComplete.tsx +126 -0
  65. package/templates/react-native-sdk-reference/src/components/design-system/FieldGroup.tsx +72 -0
  66. package/templates/react-native-sdk-reference/src/components/design-system/Radio.tsx +61 -0
  67. package/templates/react-native-sdk-reference/src/components/field/AutoComplete/AutoComplete.tsx +196 -0
  68. package/templates/react-native-sdk-reference/src/components/field/AutoComplete/index.tsx +1 -0
  69. package/templates/react-native-sdk-reference/src/components/field/Checkbox/Checkbox.tsx +89 -0
  70. package/templates/react-native-sdk-reference/src/components/field/Checkbox/index.tsx +1 -0
  71. package/templates/react-native-sdk-reference/src/components/field/Currency/Currency.tsx +84 -0
  72. package/templates/react-native-sdk-reference/src/components/field/Currency/index.tsx +1 -0
  73. package/templates/react-native-sdk-reference/src/components/field/Date/Date.tsx +94 -0
  74. package/templates/react-native-sdk-reference/src/components/field/Date/index.tsx +1 -0
  75. package/templates/react-native-sdk-reference/src/components/field/Dropdown/Dropdown.tsx +211 -0
  76. package/templates/react-native-sdk-reference/src/components/field/Dropdown/index.tsx +1 -0
  77. package/templates/react-native-sdk-reference/src/components/field/Email/Email.tsx +81 -0
  78. package/templates/react-native-sdk-reference/src/components/field/Email/index.tsx +1 -0
  79. package/templates/react-native-sdk-reference/src/components/field/Group/Group.tsx +47 -0
  80. package/templates/react-native-sdk-reference/src/components/field/Group/index.tsx +1 -0
  81. package/templates/react-native-sdk-reference/src/components/field/Integer/Integer.tsx +84 -0
  82. package/templates/react-native-sdk-reference/src/components/field/Integer/index.tsx +1 -0
  83. package/templates/react-native-sdk-reference/src/components/field/Phone/Phone.tsx +85 -0
  84. package/templates/react-native-sdk-reference/src/components/field/Phone/index.ts +1 -0
  85. package/templates/react-native-sdk-reference/src/components/field/RadioButtons/RadioButtons.tsx +118 -0
  86. package/templates/react-native-sdk-reference/src/components/field/RadioButtons/index.ts +1 -0
  87. package/templates/react-native-sdk-reference/src/components/field/TextArea/TextArea.tsx +86 -0
  88. package/templates/react-native-sdk-reference/src/components/field/TextArea/index.tsx +1 -0
  89. package/templates/react-native-sdk-reference/src/components/field/TextInput/TextInput.tsx +84 -0
  90. package/templates/react-native-sdk-reference/src/components/field/TextInput/index.tsx +1 -0
  91. package/templates/react-native-sdk-reference/src/components/field/URL/URL.tsx +86 -0
  92. package/templates/react-native-sdk-reference/src/components/field/URL/index.tsx +1 -0
  93. package/templates/react-native-sdk-reference/src/components/helpers/data_page.ts +20 -0
  94. package/templates/react-native-sdk-reference/src/components/helpers/event-utils.ts +20 -0
  95. package/templates/react-native-sdk-reference/src/components/helpers/instructions-utils.ts +57 -0
  96. package/templates/react-native-sdk-reference/src/components/helpers/state-utils.tsx +46 -0
  97. package/templates/react-native-sdk-reference/src/components/helpers/template-utils.ts +75 -0
  98. package/templates/react-native-sdk-reference/src/components/helpers/utils.ts +339 -0
  99. package/templates/react-native-sdk-reference/src/components/infra/ActionButtons/ActionButtons.tsx +63 -0
  100. package/templates/react-native-sdk-reference/src/components/infra/ActionButtons/index.tsx +1 -0
  101. package/templates/react-native-sdk-reference/src/components/infra/Assignment/Assignment.tsx +348 -0
  102. package/templates/react-native-sdk-reference/src/components/infra/Assignment/index.tsx +1 -0
  103. package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/AssignmentCard.tsx +56 -0
  104. package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/index.tsx +1 -0
  105. package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/FlowContainer.tsx +57 -0
  106. package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/helpers.ts +137 -0
  107. package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/index.tsx +1 -0
  108. package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/RootContainer.tsx +52 -0
  109. package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/index.tsx +1 -0
  110. package/templates/react-native-sdk-reference/src/components/infra/Containers/SimpleView/helper.ts +128 -0
  111. package/templates/react-native-sdk-reference/src/components/infra/Containers/SimpleView/index.tsx +59 -0
  112. package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/ViewContainer.tsx +31 -0
  113. package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/helper.ts +39 -0
  114. package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/index.ts +1 -0
  115. package/templates/react-native-sdk-reference/src/components/infra/Containers/helper.ts +9 -0
  116. package/templates/react-native-sdk-reference/src/components/infra/ErrorBoundary/ErrorBoundary.tsx +53 -0
  117. package/templates/react-native-sdk-reference/src/components/infra/ErrorBoundary/index.tsx +1 -0
  118. package/templates/react-native-sdk-reference/src/components/infra/MultiStep/MultiStep.tsx +24 -0
  119. package/templates/react-native-sdk-reference/src/components/infra/MultiStep/index.ts +1 -0
  120. package/templates/react-native-sdk-reference/src/components/infra/Reference/Reference.tsx +68 -0
  121. package/templates/react-native-sdk-reference/src/components/infra/Reference/index.tsx +1 -0
  122. package/templates/react-native-sdk-reference/src/components/infra/Reference/utils.ts +16 -0
  123. package/templates/react-native-sdk-reference/src/components/infra/Region/Region.tsx +10 -0
  124. package/templates/react-native-sdk-reference/src/components/infra/Region/index.tsx +1 -0
  125. package/templates/react-native-sdk-reference/src/components/infra/View/View.tsx +49 -0
  126. package/templates/react-native-sdk-reference/src/components/template/DefaultForm/DefaultForm.tsx +38 -0
  127. package/templates/react-native-sdk-reference/src/components/template/DefaultForm/index.tsx +1 -0
  128. package/templates/react-native-sdk-reference/src/components/template/DefaultForm/utils/index.ts +28 -0
  129. package/templates/react-native-sdk-reference/src/components/template/Details/Details.tsx +82 -0
  130. package/templates/react-native-sdk-reference/src/components/template/Details/index.tsx +1 -0
  131. package/templates/react-native-sdk-reference/src/components/template/OneColumn/OneColumn.tsx +29 -0
  132. package/templates/react-native-sdk-reference/src/components/template/OneColumn/index.tsx +1 -0
  133. package/templates/react-native-sdk-reference/src/context/LoaderContext.tsx +42 -0
  134. package/templates/react-native-sdk-reference/src/mediaco/AdvBanner.tsx +62 -0
  135. package/templates/react-native-sdk-reference/src/mediaco/Header.tsx +60 -0
  136. package/templates/react-native-sdk-reference/src/mediaco/HomeScreen.tsx +78 -0
  137. package/templates/react-native-sdk-reference/src/mediaco/QuickActions.tsx +68 -0
  138. package/templates/react-native-sdk-reference/src/mediaco/ResolutionScreen.tsx +48 -0
  139. package/templates/react-native-sdk-reference/src/mediaco/SafeArea.tsx +11 -0
  140. package/templates/react-native-sdk-reference/src/mediaco/TabBar.tsx +102 -0
  141. package/templates/react-native-sdk-reference/src/mediaco/YourServices.tsx +90 -0
  142. package/templates/react-native-sdk-reference/src/sdk-pega-component-map.ts +64 -0
  143. package/templates/react-native-sdk-reference/src/types/PConnProps.d.ts +41 -0
  144. package/templates/react-native-sdk-reference/src/utils/auth.ts +62 -0
  145. package/templates/react-native-sdk-reference/src/utils/init-pcore.ts +37 -0
  146. package/templates/react-native-sdk-reference/src/utils/pcore-polyfills.ts +66 -0
  147. package/templates/react-native-sdk-reference/tsconfig.json +9 -8
  148. package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +171 -0
  149. package/templates/react-sdk-reference/.ai-common/agents/implementation-expert.md +25 -26
  150. package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions-embedded.md +119 -0
  151. package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions.md +70 -121
  152. package/templates/react-sdk-reference/.ai-common/instructions/component-map.md +7 -19
  153. package/templates/react-sdk-reference/.ai-common/instructions/dse-component.md +10 -40
  154. package/templates/react-sdk-reference/.ai-common/instructions/embedded-component.md +134 -0
  155. package/templates/react-sdk-reference/.ai-common/instructions/field-component.md +15 -43
  156. package/templates/react-sdk-reference/.ai-common/instructions/template-component.md +11 -63
  157. package/templates/react-sdk-reference/.ai-common/instructions/widget-component.md +12 -57
  158. package/templates/react-sdk-reference/.ai-common/prompts/add-component.md +45 -71
  159. package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +98 -0
  160. package/templates/react-sdk-reference/.ai-common/prompts/embedded-component-manifest.md +155 -0
  161. package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +67 -237
  162. package/templates/react-sdk-reference/.ai-common/prompts/generate-dse-components.md +26 -77
  163. package/templates/react-sdk-reference/.ai-common/prompts/generate-embedded-components.md +315 -0
  164. package/templates/react-sdk-reference/.ai-common/prompts/generate-field-components.md +31 -80
  165. package/templates/react-sdk-reference/.ai-common/prompts/generate-template-components.md +43 -99
  166. package/templates/react-sdk-reference/.ai-common/prompts/generate-widget-components.md +33 -83
  167. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/AlertBanner.md +60 -74
  168. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Banner.md +64 -84
  169. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/CaseSummaryFields.md +76 -109
  170. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/DetailsFields.md +84 -101
  171. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldGroup.md +62 -87
  172. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldGroupList.md +56 -76
  173. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldValueList.md +61 -85
  174. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Operator.md +84 -107
  175. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Pulse.md +36 -44
  176. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/RichTextEditor.md +125 -189
  177. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/WssQuickCreate.md +34 -50
  178. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension.md +57 -179
  179. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/analyze-customer-repo.md +130 -0
  180. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/authenticate.md +311 -0
  181. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/run-and-verify-integration.md +156 -0
  182. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/wire-integration.md +476 -0
  183. package/templates/react-sdk-reference/.ai-common/skills/field-components.md +120 -242
  184. package/templates/react-sdk-reference/.ai-common/skills/field-skills/AutoComplete.md +71 -212
  185. package/templates/react-sdk-reference/.ai-common/skills/field-skills/CancelAlert.md +47 -209
  186. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Checkbox.md +90 -259
  187. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Currency.md +75 -169
  188. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Date.md +65 -160
  189. package/templates/react-sdk-reference/.ai-common/skills/field-skills/DateTime.md +59 -157
  190. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Decimal.md +55 -134
  191. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Dropdown.md +61 -185
  192. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Email.md +60 -138
  193. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Group.md +40 -99
  194. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Integer.md +44 -111
  195. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Location.md +57 -165
  196. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Multiselect.md +41 -122
  197. package/templates/react-sdk-reference/.ai-common/skills/field-skills/ObjectReference.md +32 -130
  198. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Percentage.md +48 -112
  199. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Phone.md +43 -153
  200. package/templates/react-sdk-reference/.ai-common/skills/field-skills/RadioButtons.md +76 -183
  201. package/templates/react-sdk-reference/.ai-common/skills/field-skills/RichText.md +59 -176
  202. package/templates/react-sdk-reference/.ai-common/skills/field-skills/ScalarList.md +30 -123
  203. package/templates/react-sdk-reference/.ai-common/skills/field-skills/SelectableCard.md +47 -178
  204. package/templates/react-sdk-reference/.ai-common/skills/field-skills/SemanticLink.md +31 -117
  205. package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextArea.md +51 -106
  206. package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextContent.md +22 -75
  207. package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextInput.md +54 -116
  208. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Time.md +46 -100
  209. package/templates/react-sdk-reference/.ai-common/skills/field-skills/URL.md +44 -93
  210. package/templates/react-sdk-reference/.ai-common/skills/field-skills/UserReference.md +40 -167
  211. package/templates/react-sdk-reference/.ai-common/skills/infra-components.md +165 -0
  212. package/templates/react-sdk-reference/.ai-common/skills/infra-skills/ActionButtons.md +122 -0
  213. package/templates/react-sdk-reference/.ai-common/skills/infra-skills/MultiStep.md +178 -0
  214. package/templates/react-sdk-reference/.ai-common/skills/infra-skills/Stages.md +140 -0
  215. package/templates/react-sdk-reference/.ai-common/skills/template-components.md +74 -228
  216. package/templates/react-sdk-reference/.ai-common/skills/template-skills/AdvancedSearch.md +66 -167
  217. package/templates/react-sdk-reference/.ai-common/skills/template-skills/AppShell.md +57 -170
  218. package/templates/react-sdk-reference/.ai-common/skills/template-skills/BannerPage.md +41 -76
  219. package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseSummary.md +53 -109
  220. package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseView.md +86 -289
  221. package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseViewActionsMenu.md +60 -185
  222. package/templates/react-sdk-reference/.ai-common/skills/template-skills/Confirmation.md +66 -115
  223. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DataReference.md +33 -68
  224. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DefaultForm.md +53 -133
  225. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DefaultPage.md +39 -82
  226. package/templates/react-sdk-reference/.ai-common/skills/template-skills/Details.md +38 -91
  227. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsSubTabs.md +47 -101
  228. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsThreeColumn.md +27 -34
  229. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsTwoColumn.md +25 -40
  230. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DynamicTabs.md +34 -104
  231. package/templates/react-sdk-reference/.ai-common/skills/template-skills/FieldGroupTemplate.md +46 -147
  232. package/templates/react-sdk-reference/.ai-common/skills/template-skills/HierarchicalForm.md +139 -100
  233. package/templates/react-sdk-reference/.ai-common/skills/template-skills/InlineDashboard.md +43 -82
  234. package/templates/react-sdk-reference/.ai-common/skills/template-skills/InlineDashboardPage.md +47 -80
  235. package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListPage.md +16 -29
  236. package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListView.md +43 -228
  237. package/templates/react-sdk-reference/.ai-common/skills/template-skills/MultiReferenceReadOnly.md +20 -65
  238. package/templates/react-sdk-reference/.ai-common/skills/template-skills/NarrowWide.md +49 -97
  239. package/templates/react-sdk-reference/.ai-common/skills/template-skills/OneColumn.md +37 -71
  240. package/templates/react-sdk-reference/.ai-common/skills/template-skills/PromotedFilters.md +58 -148
  241. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SelfServiceCaseView.md +82 -107
  242. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SimpleTable.md +21 -60
  243. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SingleReferenceReadOnly.md +43 -100
  244. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SubTabs.md +36 -76
  245. package/templates/react-sdk-reference/.ai-common/skills/template-skills/TwoColumn.md +41 -90
  246. package/templates/react-sdk-reference/.ai-common/skills/template-skills/WideNarrow.md +36 -43
  247. package/templates/react-sdk-reference/.ai-common/skills/template-skills/WssNavBar.md +25 -115
  248. package/templates/react-sdk-reference/.ai-common/skills/widget-components.md +38 -174
  249. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/AppAnnouncement.md +30 -57
  250. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/Attachment.md +55 -101
  251. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/CaseHistory.md +38 -121
  252. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/FileUtility.md +37 -98
  253. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/Followers.md +18 -33
  254. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/QuickCreate.md +26 -91
  255. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/SummaryItem.md +28 -120
  256. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/ToDo.md +41 -272
  257. package/templates/react-sdk-reference/package.json +1 -1
  258. package/templates/react-sdk-reference/pega-auth-0.2.44.tgz +0 -0
  259. package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
  260. package/templates/react-sdk-reference/src/components/helpers/formatters/index.ts +13 -3
  261. package/templates/react-native-sdk-reference/.github/AGENTS.md +0 -23
  262. package/templates/react-native-sdk-reference/.github/copilot-instructions.md +0 -40
  263. package/templates/react-native-sdk-reference/.github/skills/pega-sdk-component.md +0 -48
  264. package/templates/react-native-sdk-reference/App.tsx +0 -49
  265. package/templates/react-native-sdk-reference/expo-env.d.ts +0 -3
  266. 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, props interface, display modes, event handling, and registration patterns common to ALL field components.
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 `component-map.ts`)
18
-
19
- ## Props (component-specific)
20
-
21
- No props beyond `PConnFieldProps`. Import type as:
22
-
23
- ```typescript
24
- import type { PConnFieldProps } from '@pega/sdk-react';
25
- ```
26
-
27
- ## Component Skeleton
28
-
29
- Follow this exact structure. Replace `<DateTimePickerWidget>` with equivalents from your chosen design system.
30
-
31
- ```typescript
32
- import { useEffect, useState } from 'react';
33
- import dayjs, { Dayjs } from 'dayjs';
34
- import DateFormatter from '../../helpers/formatters/Date';
35
- import handleEvent from '../../helpers/event-utils';
36
- import { format } from '../../helpers/formatters';
37
- import { dateFormatInfoDefault, getDateFormatInfo } from '../../helpers/date-format-utils';
38
- import { getComponentFromRegistry } from '@pega/sdk-react';
39
- import type { PConnFieldProps } from '@pega/sdk-react';
40
-
41
- interface DateTimeProps extends PConnFieldProps {}
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:** `useEffect` with deps **`[value]`** → `setDateValue(dayjs(DateFormatter.convertToTimezone(value, { timezone })))`.
140
- 5. **Date/time format:** Mutate `dateFormatInfoDefault` with locale values from `getDateFormatInfo()` (same pattern as Date component). Combined format: `` `${dateFormatString} hh:mm a` ``.
141
- 6. **Minutes step:** `minutesStep={5}` — time picker snaps to 5-minute increments.
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
- const timeZoneDateTime = (dayjs as any).tz(date.format('YYYY-MM-DDTHH:mm:ss'), timezone)
146
- const changeValue = timeZoneDateTime?.isValid() ? timeZoneDateTime.toISOString() : ''
147
- ```
148
- - Update state: `setDateValue(timeZoneDateTime)`.
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 `format(value, 'datetime', { format: \`${dateFormatString} hh:mm a\` })`:
62
+ Format using the project's formatting helper with format type `'datetime'` and options `{ format: '<dateFormatString> hh:mm a' }`:
157
63
 
158
- - **`DISPLAY_ONLY`:** `<FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} />`.
159
- - **`STACKED_LARGE_VAL`:** `<FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} variant='stacked' />`.
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 as `format(props.value, 'datetime')` then pass to `TextInput`:
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 `timeZoneDateTime.isValid()` is false, commit an empty string `''`.
89
+ - If the timezone-aware date instance is invalid, commit an empty string `''`.
188
90
  - Commits on **change** (picker selection), not on blur.
189
- - `dayjs.tz` requires `dayjs-timezone` plugin.
91
+ - The date library's timezone plugin is required for timezone-aware conversions.
190
92
 
191
93
  ## Dependencies
192
94
 
193
- - Date manipulation library with timezone support (e.g., `dayjs` + `dayjs/plugin/timezone`).
194
- - `DateFormatter.convertToTimezone(value, { timezone })` from `../../helpers/formatters/Date` — converts stored UTC value to display timezone.
195
- - `format()` from `../../helpers/formatters` — for display mode formatting.
196
- - `getDateFormatInfo()` from `../../helpers/date-format-utils` — for locale date format string.
197
- - Date-time picker UI component (e.g., `@mui/x-date-pickers/DateTimePicker`).
198
- - `handleEvent` from `../../helpers/event-utils`.
199
- - `getComponentFromRegistry('TextInput')` for read-only.
200
- - `getComponentFromRegistry('FieldValueList')` for display modes.
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
- Listed design systems are examples only.
108
+ When implementing in a specific design system, map the following:
207
109
 
208
- | Design System | Recommended Component |
209
- | ------------------ | ------------------------------------------------------------ |
210
- | Default (CSS only) | `<input type="datetime-local">` (no timezone control) |
211
- | MUI | `<DateTimePicker />` from `@mui/x-date-pickers` + `dayjs.tz` |
212
- | Ant Design | `<DatePicker showTime />` |
213
- | Chakra UI | Third-party datetime picker |
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, props interface, display modes, event handling, and registration patterns common to ALL field components.
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` prop.
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 `component-map.ts`)
17
+ - **Registration key:** `Decimal` (in the project's component map)
18
18
 
19
- ## Props (component-specific)
19
+ ## Inputs (component-specific)
20
20
 
21
- | Prop | Type | Default | Description |
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
- ## Component Skeleton
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
- ```typescript
33
- import { useEffect, useState } from 'react';
34
- import { getCurrencyCharacters, getCurrencyOptions } from '../Currency/currency-utils';
35
- import handleEvent from '../../helpers/event-utils';
36
- import { format } from '../../helpers/formatters';
37
- import { getComponentFromRegistry } from '@pega/sdk-react';
38
- import type { PConnFieldProps } from '@pega/sdk-react';
39
-
40
- interface DecimalProps extends PConnFieldProps {
41
- currencyISOCode?: string;
42
- decimalPrecision?: number;
43
- showGroupSeparators?: boolean;
44
- formatter?: string;
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:** `useEffect` with deps **`[value]`** → `setValues(value.toString())`.
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 `theCurrDec` and `theCurrSep` from `getCurrencyCharacters(currencyISOCode)`. Apply `thousandSeparator` only when `showGroupSeparators` is truthy (otherwise pass `''`).
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
- - `prefix`: `readOnly && formatter === 'Currency' ? theCurrSym : ''`
137
- - `suffix`: `readOnly && formatter === 'Percentage' ? '%' : ''`
138
- 7. **Decimal scale:** `readOnly && formatter === 'Currency' ? undefined : decimalPrecision`.
139
- 8. **On value change:** `setValues(val.value)` — raw numeric string.
140
- 9. **On blur:** `handleEvent(actions, 'changeNblur', propName, values)`.
141
- 10. **Read-only:** Set `readOnly: true` via `readOnlyProp`. Variant switches to `'standard'` (flat). `onBlur` omitted.
142
- 11. **Render ordering:** state → readOnlyProp → formattedValue → display modes → testProps + handlers → main render.
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`:** `<FieldValueList name={hideLabel ? '' : label} value={formattedValue} />`.
147
- - **`STACKED_LARGE_VAL`:** `<FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />`.
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
- `formattedValue` is computed before display-mode check:
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 `pConn.getComponentName()?.toLowerCase()` as format key.
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 format input with `readOnly: true`. Apply prefix (`$`) or suffix (`%`) based on `formatter`. Flat/borderless visual style.
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 | Standard (flat) |
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` prop | — |
91
+ | Placeholder | From the `placeholder` input | — |
170
92
 
171
93
  ## Edge Cases & Special Logic
172
94
 
173
- - In read-only Currency mode, `decimalScale` is set to `undefined` (let the formatter decide), not `decimalPrecision`.
174
- - `thousandSeparator` defaults to `''` (disabled) unless `showGroupSeparators` is `true`.
175
- - `prefix` and `suffix` are only rendered in read-only mode — NOT in editable mode.
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
- - Numeric formatting library (e.g., `react-number-format`'s `NumericFormat`).
181
- - `getCurrencyCharacters(currencyISOCode)` — for `theDecimalIndicator` and `theDigitGroupSeparator`.
182
- - `getCurrencyOptions(currencyISOCode)` — for `format()` options.
183
- - `format()` from `../../helpers/formatters`.
184
- - `handleEvent` from `../../helpers/event-utils`.
185
- - `getComponentFromRegistry('FieldValueList')` for display modes.
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
- Listed design systems are examples only.
113
+ When implementing in a specific design system, map the following:
192
114
 
193
- | Design System | Recommended Component |
194
- | ------------------ | ------------------------------------------------- |
195
- | Default (CSS only) | `<input type="text">` with custom numeric masking |
196
- | MUI | `NumericFormat` with `customInput={TextField}` |
197
- | Ant Design | `<InputNumber precision={decimalPrecision} />` |
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