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