@pega/custom-dx-components 0.25.6 → 0.25.8

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 (191) hide show
  1. package/package.json +2 -1
  2. package/src/tasks/build-jest-assets/index.js +2 -2
  3. package/src/tasks/create/templates/Constellation/Field/Boolean/config.json.mustache +25 -0
  4. package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +25 -0
  5. package/src/tasks/create/templates/Constellation/Field/DateTime/config.json.mustache +25 -0
  6. package/src/tasks/create/templates/Constellation/Field/Decimal/config.json.mustache +25 -0
  7. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/config.json.mustache +25 -0
  8. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/config.json.mustache +25 -0
  9. package/src/tasks/create/templates/Constellation/Field/Integer/config.json.mustache +25 -0
  10. package/src/tasks/create/templates/Constellation/Field/Picklist/config.json.mustache +25 -0
  11. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/config.json.mustache +25 -0
  12. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/config.json.mustache +25 -0
  13. package/src/tasks/create/templates/Constellation/Field/Text-Email/config.json.mustache +25 -0
  14. package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +25 -0
  15. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +25 -0
  16. package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +25 -0
  17. package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +25 -0
  18. package/src/tasks/create/templates/Constellation/Field/TimeofDay/config.json.mustache +25 -0
  19. package/src/tasks/init/template/package.json.mustache +1 -1
  20. package/tests/assets/library/components/create/Pega_DXIL_MyTestText/demo.test.tsx +19 -0
  21. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +25 -0
  22. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyBoolean/demo.test.tsx +19 -0
  23. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +5 -4
  24. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.test.tsx +28 -0
  25. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +25 -0
  26. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCurrency/demo.test.tsx +23 -0
  27. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +25 -0
  28. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
  29. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/demo.test.tsx +52 -0
  30. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +25 -0
  31. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +3 -2
  32. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.test.tsx +72 -0
  33. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +25 -0
  34. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDecimal/demo.test.tsx +21 -0
  35. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +4 -3
  36. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.test.tsx +47 -0
  37. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +25 -0
  38. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyEmail/demo.test.tsx +20 -0
  39. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyForm/demo.test.tsx +40 -0
  40. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
  41. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.test.tsx +27 -0
  42. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +25 -0
  43. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyInteger/demo.test.tsx +18 -0
  44. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +6 -2
  45. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/demo.test.tsx +24 -0
  46. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +4 -3
  47. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.test.tsx +29 -0
  48. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +4 -2
  49. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.test.tsx +36 -0
  50. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +4 -1
  51. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +25 -0
  52. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyParagraph/demo.test.tsx +21 -0
  53. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +25 -0
  54. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPercentage/demo.test.tsx +18 -0
  55. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +25 -0
  56. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPhone/demo.test.tsx +23 -0
  57. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +25 -0
  58. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/demo.test.tsx +25 -0
  59. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +25 -0
  60. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/demo.test.tsx +29 -0
  61. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +25 -0
  62. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/demo.test.tsx +33 -0
  63. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyText/demo.test.tsx +19 -0
  64. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +25 -0
  65. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTextInput/demo.test.tsx +20 -0
  66. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +25 -0
  67. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/demo.test.tsx +33 -0
  68. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
  69. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.test.tsx +58 -0
  70. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/demo.test.tsx +56 -0
  71. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +25 -0
  72. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyURL/demo.test.tsx +20 -0
  73. package/tests/assets/original/components/create/Pega_DXIL_MyTestText/demo.test.tsx +19 -0
  74. package/tests/assets/original/components/create/shared/Avatar.tsx +76 -0
  75. package/tests/assets/original/components/create/shared/Operator.tsx +215 -0
  76. package/tests/assets/original/components/create/shared/PConnProps.d.ts +46 -0
  77. package/tests/assets/original/components/create/shared/create-nonce.ts +6 -0
  78. package/tests/assets/original/components/create/shared/suggestions-handler.ts +9 -0
  79. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +25 -0
  80. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyBoolean/demo.test.tsx +19 -0
  81. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +5 -4
  82. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.test.tsx +28 -0
  83. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +25 -0
  84. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCurrency/demo.test.tsx +23 -0
  85. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +25 -0
  86. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
  87. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/demo.test.tsx +52 -0
  88. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +25 -0
  89. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +3 -2
  90. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.test.tsx +72 -0
  91. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +25 -0
  92. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDecimal/demo.test.tsx +21 -0
  93. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +4 -3
  94. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.test.tsx +47 -0
  95. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +25 -0
  96. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyEmail/demo.test.tsx +20 -0
  97. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyForm/demo.test.tsx +40 -0
  98. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
  99. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.test.tsx +27 -0
  100. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +25 -0
  101. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyInteger/demo.test.tsx +18 -0
  102. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +6 -2
  103. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/demo.test.tsx +24 -0
  104. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +4 -3
  105. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.test.tsx +29 -0
  106. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +4 -2
  107. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.test.tsx +36 -0
  108. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +4 -1
  109. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +25 -0
  110. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyParagraph/demo.test.tsx +21 -0
  111. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +25 -0
  112. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPercentage/demo.test.tsx +18 -0
  113. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +25 -0
  114. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPhone/demo.test.tsx +23 -0
  115. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +25 -0
  116. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/demo.test.tsx +25 -0
  117. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +25 -0
  118. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/demo.test.tsx +29 -0
  119. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +25 -0
  120. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/demo.test.tsx +33 -0
  121. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyText/demo.test.tsx +19 -0
  122. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +25 -0
  123. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTextInput/demo.test.tsx +20 -0
  124. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +25 -0
  125. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/demo.test.tsx +33 -0
  126. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
  127. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.test.tsx +58 -0
  128. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/demo.test.tsx +56 -0
  129. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +25 -0
  130. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyURL/demo.test.tsx +20 -0
  131. package/tests/assets/original/components/createAll/Constellation/shared/Avatar.tsx +76 -0
  132. package/tests/assets/original/components/createAll/Constellation/shared/Operator.tsx +215 -0
  133. package/tests/assets/original/components/createAll/Constellation/shared/PConnProps.d.ts +46 -0
  134. package/tests/assets/original/components/createAll/Constellation/shared/create-nonce.ts +6 -0
  135. package/tests/assets/original/components/createAll/Constellation/shared/suggestions-handler.ts +9 -0
  136. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyBoolean/config.json +25 -0
  137. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyBoolean/demo.test.tsx +19 -0
  138. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/demo.stories.tsx +5 -4
  139. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/demo.test.tsx +28 -0
  140. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCurrency/config.json +25 -0
  141. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCurrency/demo.test.tsx +23 -0
  142. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/config.json +25 -0
  143. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
  144. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/demo.test.tsx +52 -0
  145. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/config.json +25 -0
  146. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/demo.stories.tsx +3 -2
  147. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/demo.test.tsx +72 -0
  148. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDecimal/config.json +25 -0
  149. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDecimal/demo.test.tsx +21 -0
  150. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +4 -3
  151. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.test.tsx +47 -0
  152. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyEmail/config.json +25 -0
  153. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyEmail/demo.test.tsx +20 -0
  154. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyForm/demo.test.tsx +40 -0
  155. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +3 -2
  156. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/demo.test.tsx +27 -0
  157. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyInteger/config.json +25 -0
  158. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyInteger/demo.test.tsx +18 -0
  159. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +6 -2
  160. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.test.tsx +24 -0
  161. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +4 -3
  162. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/demo.test.tsx +19 -0
  163. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +4 -2
  164. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.test.tsx +36 -0
  165. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyParagraph/config.json +25 -0
  166. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyParagraph/demo.test.tsx +21 -0
  167. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPercentage/config.json +25 -0
  168. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPercentage/demo.test.tsx +18 -0
  169. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPhone/config.json +25 -0
  170. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPhone/demo.test.tsx +23 -0
  171. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/config.json +25 -0
  172. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/demo.test.tsx +25 -0
  173. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/config.json +25 -0
  174. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/demo.test.tsx +29 -0
  175. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/config.json +25 -0
  176. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/demo.test.tsx +33 -0
  177. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyText/demo.test.tsx +19 -0
  178. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTextInput/config.json +25 -0
  179. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTextInput/demo.test.tsx +20 -0
  180. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/config.json +25 -0
  181. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/demo.test.tsx +33 -0
  182. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
  183. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.test.tsx +58 -0
  184. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/demo.test.tsx +56 -0
  185. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyURL/config.json +25 -0
  186. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyURL/demo.test.tsx +20 -0
  187. package/tests/assets/original/components/createAll/Launchpad/shared/Avatar.tsx +76 -0
  188. package/tests/assets/original/components/createAll/Launchpad/shared/Operator.tsx +215 -0
  189. package/tests/assets/original/components/createAll/Launchpad/shared/PConnProps.d.ts +46 -0
  190. package/tests/assets/original/components/createAll/Launchpad/shared/create-nonce.ts +6 -0
  191. package/tests/assets/original/components/createAll/Launchpad/shared/suggestions-handler.ts +9 -0
@@ -0,0 +1,33 @@
1
+ // import { expect, test } from '@jest/globals';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { composeStories } from '@storybook/react';
4
+ import '@testing-library/jest-dom';
5
+
6
+ import * as DemoStories from './demo.stories';
7
+
8
+ const { BasePegaDxilMyTimeOfDay } = composeStories(DemoStories);
9
+
10
+ test('renders PegaDxilMyTimeOfDay', async () => {
11
+ render(<BasePegaDxilMyTimeOfDay/>);
12
+ expect(await screen.findByText('TimeOfDay Label')).toBeVisible();
13
+ expect(await screen.findByText('TimeOfDay helper text')).toBeVisible();
14
+
15
+ // const dateElement = screen.getByRole('textbox');
16
+ // for some odd reason, checking the full string of "USD 0.00" doesn't pass
17
+ // expect(currencyElement).toHaveValue('USD 0.00');
18
+
19
+ const myHour = (screen.getByTestId(':time-input:control-hour') as HTMLInputElement);
20
+ expect(myHour.value).toContain('01');
21
+ expect(myHour).toHaveAttribute('placeholder', 'hh');
22
+
23
+ const myMinute = (screen.getByTestId(':time-input:control-minute') as HTMLInputElement);
24
+ expect(myMinute.value).toContain('30');
25
+ expect(myMinute).toHaveAttribute('placeholder', 'mm');
26
+
27
+ const myPeriod = (screen.getByTestId(':time-input:control-period') as HTMLSelectElement).value;
28
+ expect(myPeriod).toContain('PM');
29
+
30
+ // no clear button
31
+
32
+ // pressing time button, reveals a <div> that has no ID, so can't test for it.
33
+ });
@@ -20,7 +20,7 @@ export default meta;
20
20
  type Story = StoryObj<typeof PegaDxilMyTwoColumnDetails>;
21
21
 
22
22
  if (!window.PCore) {
23
- window.PCore = {};
23
+ window.PCore = {} as any;
24
24
  }
25
25
 
26
26
  window.PCore.getLocaleUtils = () => {
@@ -28,7 +28,7 @@ window.PCore.getLocaleUtils = () => {
28
28
  getLocaleValue: (value: any) => {
29
29
  return value;
30
30
  }
31
- };
31
+ } as any;
32
32
  };
33
33
 
34
34
  window.PCore.getUserApi = () => {
@@ -38,7 +38,7 @@ window.PCore.getUserApi = () => {
38
38
  resolve(operatorDetails);
39
39
  });
40
40
  }
41
- };
41
+ } as any;
42
42
  };
43
43
 
44
44
  const Region = (props: any) => {
@@ -0,0 +1,58 @@
1
+ // import { expect, test } from '@jest/globals';
2
+ import { fireEvent, render, screen } from '@testing-library/react';
3
+ import { composeStories } from '@storybook/react';
4
+ import '@testing-library/jest-dom';
5
+
6
+ import * as DemoStories from './demo.stories';
7
+
8
+
9
+
10
+ const { BasePegaDxilMyTwoColumnDetails } = composeStories(DemoStories);
11
+
12
+ test('renders PegaDxilMyTwoColumnDetails', async () => {
13
+ render(<BasePegaDxilMyTwoColumnDetails />);
14
+ expect(await screen.findByText('Details Region template')).toBeVisible();
15
+ expect(await screen.findByText('Work Status')).toBeVisible();
16
+ expect(await screen.findByText('Case ID')).toBeVisible();
17
+ expect(await screen.findByText('Create date/time')).toBeVisible();
18
+ expect(await screen.findByText('Create Operator')).toBeVisible();
19
+
20
+ // expect(await screen.findByText('New')).toBeVisible();
21
+
22
+ expect(await screen.findByText('M-1002')).toBeVisible();
23
+ expect(await screen.findByText('December 11, 2022 at 8:06:27 PM')).toBeVisible();
24
+
25
+ // 2 columns of same
26
+ const SLADeadline = await screen.findAllByText('SLA Deadline');
27
+ expect(SLADeadline).toHaveLength(2);
28
+
29
+ const SLAGoal = await screen.findAllByText('SLA Goal');
30
+ expect(SLAGoal).toHaveLength(2);
31
+
32
+ const SLAStartTime = await screen.findAllByText('SLA Start Time');
33
+ expect(SLAStartTime).toHaveLength(2);
34
+
35
+ const Deadline = await screen.findAllByText('Deadline');
36
+ expect(Deadline).toHaveLength(2);
37
+
38
+ const Goal = await screen.findAllByText('Goal');
39
+ expect(Goal).toHaveLength(2);
40
+
41
+ const StartTime = await screen.findAllByText('Start Time');
42
+ expect(StartTime).toHaveLength(2);
43
+
44
+ const frenchBefore = screen.queryByText('french DigV2');
45
+ expect(frenchBefore).not.toBeInTheDocument();
46
+
47
+ // admin button
48
+ const adminButton = screen.getByRole('button');
49
+ fireEvent.click(adminButton);
50
+
51
+ const frenchArr = await screen.findAllByText('french DigV2');
52
+ expect(frenchArr[0]).toBeVisible();
53
+ expect(frenchArr[1]).toBeVisible();
54
+
55
+
56
+
57
+
58
+ });
@@ -0,0 +1,56 @@
1
+ // import { expect, test } from '@jest/globals';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { composeStories } from '@storybook/react';
4
+ import '@testing-library/jest-dom';
5
+
6
+ import * as DemoStories from './demo.stories';
7
+
8
+ const { BasePegaDxilMyTwoColumnForm } = composeStories(DemoStories);
9
+
10
+ test('renders PegaDxilMyTwoColumnForm', async () => {
11
+ render(<BasePegaDxilMyTwoColumnForm />);
12
+ expect(await screen.findByText('Form Region template')).toBeVisible();
13
+
14
+ // labels
15
+ expect(await screen.findByText('First Name')).toBeVisible();
16
+ expect(await screen.findByText('Middle Name')).toBeVisible();
17
+ expect(await screen.findByText('Last Name')).toBeVisible();
18
+ expect(await screen.findByText('Email')).toBeVisible();
19
+ expect(await screen.findByText('Phone Number')).toBeVisible();
20
+ expect(await screen.findByText('Service Date')).toBeVisible();
21
+
22
+ const inputElements = screen.getAllByTestId(':input:control');
23
+ expect((inputElements[0] as HTMLInputElement).value).toBe('John');
24
+ expect((inputElements[1] as HTMLInputElement).value).toBe('');
25
+ expect((inputElements[2] as HTMLInputElement).value).toBe('Doe');
26
+ expect((inputElements[3] as HTMLInputElement).value).toBe('John@doe.com');
27
+
28
+ const myPhone = (screen.getByTestId(':phone-input:control') as HTMLInputElement).value;
29
+ expect(myPhone).toContain('(639) 797-5093');
30
+
31
+ const myClearMonth = (screen.getByTestId(':date-input:control-month') as HTMLInputElement).value;
32
+ expect(myClearMonth).toContain('01');
33
+
34
+ const myClearDay = (screen.getByTestId(':date-input:control-day') as HTMLInputElement).value;
35
+ expect(myClearDay).toContain('25');
36
+
37
+ const myClearYear = (screen.getByTestId(':date-input:control-year') as HTMLInputElement).value;
38
+ expect(myClearYear).toContain('2023');
39
+
40
+ // verify 2 columns
41
+ const fieldSet = screen.getByRole('group');
42
+
43
+ // <fieldset>
44
+ // <legend></legend>
45
+ // <div>
46
+ // <div>
47
+ // <div> 2 divs (columns) </div>
48
+ // </div>
49
+ // </div>
50
+ // </fieldset>
51
+
52
+ // eslint-disable-next-line testing-library/no-node-access
53
+ expect(fieldSet.children[1].children[0].children[0].children).toHaveLength(2);
54
+
55
+
56
+ });
@@ -17,6 +17,31 @@
17
17
  "format": "TEXT",
18
18
  "required": true
19
19
  },
20
+ {
21
+ "name": "labelOption",
22
+ "label": "Field label",
23
+ "format": "SELECT",
24
+ "defaultValue": "custom",
25
+ "visibility": "@PLATFORMNAME != 'launchpad'",
26
+ "source": [
27
+ {
28
+ "key": "default",
29
+ "value": "Default"
30
+ },
31
+ {
32
+ "key": "custom",
33
+ "value": "Custom"
34
+ }
35
+ ]
36
+ },
37
+ {
38
+ "name": "label",
39
+ "label": "Custom field label",
40
+ "format": "VALUEINPUT",
41
+ "required": true,
42
+ "ruleType": "Paragraph",
43
+ "visibility": "@PLATFORMNAME != 'launchpad'"
44
+ },
20
45
  {
21
46
  "name": "readOnly",
22
47
  "label": "Edit mode",
@@ -0,0 +1,20 @@
1
+ // import { expect, test } from '@jest/globals';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { composeStories } from '@storybook/react';
4
+ import '@testing-library/jest-dom';
5
+
6
+ import * as DemoStories from './demo.stories';
7
+
8
+ const { BasePegaDxilMyUrl } = composeStories(DemoStories);
9
+
10
+ test('renders PegaDxilMyUrl', async () => {
11
+ render(<BasePegaDxilMyUrl />);
12
+ expect(await screen.findByText('URL Sample')).toBeVisible();
13
+ expect(await screen.findByText('URL Helper Text')).toBeVisible();
14
+
15
+
16
+ const urlElement = (screen.getByTestId('url-12345678') as HTMLInputElement);
17
+ expect(urlElement.value).toBe('');
18
+
19
+ expect(urlElement).toHaveAttribute('placeholder', 'URL Placeholder');
20
+ });
@@ -0,0 +1,76 @@
1
+ /* eslint-disable react-hooks/rules-of-hooks */
2
+ import React from 'react';
3
+ import { useEffect, useState } from 'react';
4
+ import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
5
+ import type { PConnFieldProps } from './PConnProps';
6
+
7
+
8
+ // interface for props
9
+ interface PegaDxilMyDetailsAvatarProps extends PConnFieldProps {
10
+ // If any, enter additional props that only exist on TextInput here
11
+ metaObj: any;
12
+ showStatus: boolean;
13
+
14
+ }
15
+
16
+ function Avatar(props: PegaDxilMyDetailsAvatarProps) {
17
+ const { metaObj, showStatus = false } = props;
18
+ const [imageBlobUrl, setImageBlobUrl] = useState(null);
19
+ let userName: string;
20
+ let userIdentifier: string;
21
+
22
+ // TODO Below if conditions can be removed once we have apis to get worklist/mywork info
23
+ // This is non CaseView case (Dashboard, MyWork etc)
24
+ if (!metaObj) {
25
+ userName = PCore.getEnvironmentInfo().getOperatorName() ?? "";
26
+ userIdentifier = PCore.getEnvironmentInfo().getOperatorIdentifier() ?? "";
27
+ } else {
28
+ userName = metaObj.name;
29
+ userIdentifier = metaObj.ID;
30
+ }
31
+ if (!userName && userIdentifier) {
32
+ userName = userIdentifier;
33
+ }
34
+
35
+ useEffect(() => {
36
+ const imageKey = !metaObj ? PCore.getEnvironmentInfo().getOperatorImageInsKey() : metaObj.image;
37
+ if (imageKey) {
38
+ PCore.getAssetLoader()
39
+ .getSvcImage(imageKey)
40
+ .then((blob) => window.URL.createObjectURL(blob))
41
+ .then((imagePath) => setImageBlobUrl(imagePath as React.SetStateAction<any>));
42
+ }
43
+ }, [metaObj]);
44
+
45
+ if (showStatus) {
46
+ const currentState = PCore.getMessagingServiceManager().getUserPresence().getUserState(userIdentifier);
47
+ const [userState, setUserState]: any = useState(currentState === 'online' ? 'active' : 'inactive');
48
+
49
+ const handleUserStateChange = ({ state }: any) => {
50
+ setUserState(state === 'online' ? 'active' : 'inactive');
51
+ };
52
+
53
+ useEffect(() => {
54
+ const subId = PCore.getMessagingServiceManager()
55
+ .getUserPresence()
56
+ .subscribe(userIdentifier, handleUserStateChange, '');
57
+
58
+ return function cleanup() {
59
+ PCore.getMessagingServiceManager().getUserPresence().unsubscribe(userIdentifier, subId);
60
+ };
61
+ }, [userIdentifier, handleUserStateChange]);
62
+
63
+ return <CosmosAvatar name={userName} imageSrc={imageBlobUrl as React.SetStateAction<any>} status={userState} />;
64
+ }
65
+
66
+ // Do not render when userName does not exists
67
+ // TODO : In CNR case, pxRequestor is not available, please remove this condition once it populates
68
+ if (!userName) {
69
+ return null;
70
+ }
71
+
72
+ return <CosmosAvatar name={userName} imageSrc={imageBlobUrl as React.SetStateAction<any>} />;
73
+ }
74
+
75
+
76
+ export default withConfiguration(Avatar);
@@ -0,0 +1,215 @@
1
+ // @ts-nocheck
2
+ import { useState, useEffect, Fragment } from 'react';
3
+ import {
4
+ Link,
5
+ Button,
6
+ Popover,
7
+ useOuterEvent,
8
+ useElement,
9
+ Progress,
10
+ FormField,
11
+ useTheme,
12
+ withConfiguration
13
+ } from '@pega/cosmos-react-core';
14
+ import { Glimpse } from '@pega/cosmos-react-work';
15
+ import { EmailDisplay } from '@pega/cosmos-react-core';
16
+
17
+ import type { PConnFieldProps } from './PConnProps';
18
+
19
+ import Avatar from './Avatar';
20
+
21
+
22
+ // interface for props
23
+ interface PegaDxilMyDetailsOperatorProps extends PConnFieldProps {
24
+ // If any, enter additional props that only exist on TextInput here
25
+ name: string;
26
+ id: string;
27
+ label: string;
28
+ metaObj: any;
29
+ externalUser: any;
30
+ }
31
+
32
+ let pTarget = null;
33
+
34
+ function Operator(props: PegaDxilMyDetailsOperatorProps) {
35
+ const { id, name, label, testId, helperText, externalUser, metaObj } = props;
36
+ const [isOpen, setIsOpen] = useState(false);
37
+ const [isLoading, setIsLoading] = useState(true);
38
+ const [popoverEl, setPopoverEl] = useElement(null);
39
+ const [popoverContent, setpopoverContent] = useState(null);
40
+ const theme: any = useTheme();
41
+
42
+ /* If the id has changed, we need to reset the popover */
43
+ useEffect(() => {
44
+ pTarget = null;
45
+ }, [id]);
46
+
47
+
48
+
49
+ const OperatorPreview = () => {
50
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
51
+ const localeCategory = 'Operator';
52
+ setpopoverContent(
53
+ <Progress variant='ring' message={localizedVal('Loading operator...', localeCategory)} placement='local' />
54
+ );
55
+ if (externalUser && externalUser.classID !== 'Data-Party-Operator') {
56
+ const fields = [
57
+ {
58
+ id: 'pyFirstName',
59
+ name: localizedVal('Name', localeCategory),
60
+ value: externalUser.name
61
+ },
62
+ {
63
+ id: 'pyEmail1',
64
+ name: localizedVal('Email', localeCategory),
65
+ value:
66
+ externalUser.email !== '' ? <Link href={`mailto:${externalUser.email}`}>{externalUser.email}</Link> : ''
67
+ },
68
+ {
69
+ id: 'pyPhoneNumber',
70
+ name: localizedVal('Phone', localeCategory),
71
+ value: externalUser.phone !== '' ? <Link href={`tel:${externalUser.phone}`}>{externalUser.phone}</Link> : ''
72
+ }
73
+ ];
74
+ setIsLoading(false);
75
+ setpopoverContent(
76
+ <Glimpse
77
+ visual={
78
+ <Avatar
79
+ metaObj={{
80
+ name: externalUser.name
81
+ }}
82
+ />
83
+ }
84
+ primary={externalUser.name}
85
+ secondary={[externalUser.position]}
86
+ fields={fields}
87
+ target={pTarget}
88
+ />
89
+ );
90
+ } else {
91
+ return PCore.getUserApi()
92
+ .getOperatorDetails(id, true)
93
+ .then(res => {
94
+ if (res.data?.pyOperatorInfo) {
95
+ const fields = [];
96
+ const data = res.data;
97
+ if (data.pyOperatorInfo && data.pyOperatorInfo.pyUserName) {
98
+ fields.push({
99
+ id: 'Name',
100
+ name: localizedVal('Name', localeCategory),
101
+ value: data.pyOperatorInfo.pyUserName
102
+ });
103
+ }
104
+ if (data.pyOperatorInfo && data.pyOperatorInfo.pyEmailAddress) {
105
+ fields.push({
106
+ id: 'Email',
107
+ name: localizedVal('Email address', localeCategory),
108
+ value: <EmailDisplay value={data.pyOperatorInfo.pyEmailAddress} />
109
+ });
110
+ }
111
+ const opAvatar = (
112
+ <Avatar
113
+ metaObj={{
114
+ image: '',
115
+ name: data.pyOperatorInfo.pyUserName
116
+ }}
117
+ />
118
+ );
119
+
120
+ setIsLoading(false);
121
+ setpopoverContent(
122
+ <Glimpse
123
+ heading={{
124
+ primary: data.pyOperatorInfo.pyUserName,
125
+ secondary: data.pyOperatorInfo.pyEmailAddress,
126
+ visual: opAvatar
127
+ }}
128
+ fields={fields}
129
+ target={pTarget}
130
+ onDismiss={() => {pTarget = null;}}
131
+ />
132
+ );
133
+ }
134
+ });
135
+ }
136
+ };
137
+
138
+
139
+ const clickAction = (e: any) => {
140
+
141
+ setIsOpen(!isOpen);
142
+ if (pTarget === null) {
143
+ pTarget = e.currentTarget;
144
+ OperatorPreview();
145
+ }
146
+ };
147
+
148
+ const hidePopover = () => {
149
+ if (isOpen) {
150
+ setIsOpen(false);
151
+ }
152
+ };
153
+
154
+ useOuterEvent('mousedown', [popoverEl], hidePopover); // Call the method on clicking outside these elements
155
+
156
+ const hideOnEscape = (e: any) => {
157
+ if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed
158
+ };
159
+
160
+ const comp = (
161
+ <Fragment>
162
+ {metaObj ? (
163
+ <Button
164
+ variant='text'
165
+ aria-haspopup
166
+ aria-expanded={isOpen}
167
+ onClick={clickAction}
168
+ onKeyDown={hideOnEscape}
169
+ data-test-id={testId}
170
+ style={label !== null ? { width: 'max-content', height: theme.components.input.height } : undefined}
171
+ >
172
+ <Avatar {...props} />
173
+ </Button>
174
+ ) : (
175
+ <Button
176
+ variant='link'
177
+ aria-haspopup
178
+ aria-expanded={isOpen}
179
+ onClick={clickAction}
180
+ onKeyDown={hideOnEscape}
181
+ data-test-id={testId}
182
+ style={label !== null ? { width: 'max-content', height: theme.components.input.height } : undefined}
183
+ >
184
+ {name}
185
+ </Button>
186
+ )}
187
+
188
+ {isOpen && (
189
+ <Popover
190
+ ref={setPopoverEl}
191
+ groupId='operator'
192
+ target={pTarget}
193
+ placement='bottom-start'
194
+ style={isLoading ? { position: 'relative', width: '10rem', minHeight: '4rem' } : undefined}
195
+ strategy='fixed'
196
+ >
197
+ {popoverContent}
198
+ </Popover>
199
+ )}
200
+ </Fragment>
201
+ );
202
+
203
+ if (label !== null) {
204
+ return (
205
+ <FormField label={label} info={helperText}>
206
+ {comp}
207
+ </FormField>
208
+ );
209
+ }
210
+
211
+ return comp;
212
+ };
213
+
214
+
215
+ export default withConfiguration(Operator);
@@ -0,0 +1,46 @@
1
+ import {PConnect } from '@pega/pcore-pconnect-typedefs';
2
+
3
+ // PConnProps.d.ts
4
+ // This gives us a place to have each component (which is most DX Components) that is
5
+ // expected to have a getPConnect extend its props (from BaseProps)
6
+ // such that every component will be expected to have a getPConnect() function
7
+ // that returns a PConnect object. (new/better way of doing .propTypes).
8
+ // This PConnProps can be extended to include other props that we know are in every component
9
+ export interface PConnProps {
10
+ // getPConnect should exist for every C11n component. (add @ts-ignore in special cases where it isn't)
11
+ getPConnect: () => typeof PConnect;
12
+
13
+ // Allow any/all other key/value pairs in the BaseProps for now
14
+ // TODO: refine which other props are always expected for various component
15
+ // types and consider further interface "subclassing". For example, we may
16
+ // want to create a "BasePropsForm" that gives guidance on required, readonly, etc.
17
+ // and any other props that every Form component expects.
18
+ // For example, see the PConnFieldProps below.
19
+ // NOTE: if you uncomment the line below, the PConnProps type will allow
20
+ // otherwise undefined types to appear. This can be helpful for debugging
21
+ // or when adding new components whose types aren't yet known.
22
+ // [key: string]: any;
23
+ }
24
+
25
+
26
+ // PConnFieldProps extends PConnProps to bring in the common properties that are
27
+ // associated with most field components (ex: Dropdown, TextInput, etc.) in the
28
+ // components/field directory
29
+ export interface PConnFieldProps extends PConnProps {
30
+ label: string,
31
+ required: boolean,
32
+ disabled: boolean,
33
+ value: any,
34
+ validatemessage: string,
35
+ status?: string,
36
+ onChange?: any,
37
+ onBlur?: any,
38
+ readOnly: boolean,
39
+ testId: string,
40
+ helperText: string,
41
+ displayMode?: string,
42
+ hideLabel: boolean,
43
+ placeholder?: string,
44
+ fieldMetadata?: any,
45
+ additionalProps?: any
46
+ }
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -0,0 +1,9 @@
1
+ export const suggestionsHandler = (accepted: boolean, pConn: any, setStatus: any) => {
2
+ if (accepted) {
3
+ pConn.acceptSuggestion();
4
+ setStatus('success');
5
+ } else {
6
+ pConn.ignoreSuggestion();
7
+ setStatus(undefined);
8
+ }
9
+ };