@pega/custom-dx-components 0.0.1 → 0.23.1

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 (223) hide show
  1. package/.vscode/extensions.json +1 -1
  2. package/README.md +6 -189
  3. package/package.json +34 -32
  4. package/src/auth.js +608 -0
  5. package/src/cli.js +42 -0
  6. package/src/constants.js +122 -8
  7. package/src/tasks/authenticate/helper.js +91 -8
  8. package/src/tasks/authenticate/index.js +169 -49
  9. package/src/tasks/build/helper.js +122 -0
  10. package/src/tasks/build/index.js +54 -0
  11. package/src/tasks/build-all/helper.js +70 -0
  12. package/src/tasks/build-all/index.js +79 -0
  13. package/src/tasks/{publish/bundle → bundle}/builder/index.js +49 -5
  14. package/src/tasks/{publish/bundle → bundle}/builder/webpack.config.js +5 -3
  15. package/src/tasks/{publish/bundle → bundle}/index.js +2 -2
  16. package/src/tasks/create/index.js +87 -64
  17. package/src/tasks/create/templates/Constellation/Field/Boolean/Boolean.js.mustache +38 -0
  18. package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +26 -0
  19. package/src/tasks/create/templates/Constellation/Field/Boolean/config.json.mustache +145 -0
  20. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +61 -0
  21. package/src/tasks/create/templates/Constellation/Field/Boolean/event-utils.js.mustache +18 -0
  22. package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +170 -0
  23. package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +21 -0
  24. package/src/tasks/create/templates/Constellation/Field/Boolean/styles.js.mustache +7 -0
  25. package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +61 -0
  26. package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +41 -0
  27. package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +195 -0
  28. package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +439 -0
  29. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +73 -0
  30. package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +256 -0
  31. package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +23 -0
  32. package/src/tasks/create/templates/Constellation/Field/Date/styles.js.mustache +7 -0
  33. package/src/tasks/create/templates/Constellation/Field/Date/suggestions-handler.js +10 -0
  34. package/src/tasks/create/templates/Constellation/Field/DateTime/config.json.mustache +256 -0
  35. package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +92 -0
  36. package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.js.mustache +287 -0
  37. package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +328 -0
  38. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +73 -0
  39. package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +254 -0
  40. package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +23 -0
  41. package/src/tasks/create/templates/Constellation/Field/DateTime/styles.js.mustache +7 -0
  42. package/src/tasks/create/templates/Constellation/Field/DateTime/suggestions-handler.js +10 -0
  43. package/src/tasks/create/templates/Constellation/Field/Decimal/config.json.mustache +278 -0
  44. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +49 -0
  45. package/src/tasks/create/templates/Constellation/Field/Decimal/event-utils.js.mustache +18 -0
  46. package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +273 -0
  47. package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +21 -0
  48. package/src/tasks/create/templates/Constellation/Field/Decimal/styles.js.mustache +7 -0
  49. package/src/tasks/create/templates/Constellation/Field/Decimal/suggestions-handler.js +10 -0
  50. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/config.json.mustache +291 -0
  51. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +53 -0
  52. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/event-utils.js.mustache +18 -0
  53. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +299 -0
  54. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +23 -0
  55. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/styles.js.mustache +7 -0
  56. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/suggestions-handler.js +10 -0
  57. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/config.json.mustache +93 -0
  58. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +49 -0
  59. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/event-utils.js.mustache +18 -0
  60. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +281 -0
  61. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +21 -0
  62. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/styles.js.mustache +7 -0
  63. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/suggestions-handler.js +10 -0
  64. package/src/tasks/create/templates/Constellation/Field/Integer/config.json.mustache +347 -0
  65. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +49 -0
  66. package/src/tasks/create/templates/Constellation/Field/Integer/event-utils.js.mustache +18 -0
  67. package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +336 -0
  68. package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +21 -0
  69. package/src/tasks/create/templates/Constellation/Field/Integer/styles.js.mustache +7 -0
  70. package/src/tasks/create/templates/Constellation/Field/Integer/suggestions-handler.js +10 -0
  71. package/src/tasks/create/templates/Constellation/Field/Picklist/config.json.mustache +114 -0
  72. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +78 -0
  73. package/src/tasks/create/templates/Constellation/Field/Picklist/event-utils.js.mustache +18 -0
  74. package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +351 -0
  75. package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +67 -0
  76. package/src/tasks/create/templates/Constellation/Field/Picklist/styles.js.mustache +7 -0
  77. package/src/tasks/create/templates/Constellation/Field/Picklist/suggestions-handler.js +10 -0
  78. package/src/tasks/create/{template → templates/Constellation/Field/Text}/config.json.mustache +14 -5
  79. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +51 -0
  80. package/src/tasks/create/{template → templates/Constellation/Field/Text}/index.jsx.mustache +5 -0
  81. package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +13 -0
  82. package/src/tasks/create/templates/Constellation/Field/Text/styles.js.mustache +7 -0
  83. package/src/tasks/create/templates/Constellation/Field/Text-Email/config.json.mustache +111 -0
  84. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +48 -0
  85. package/src/tasks/create/templates/Constellation/Field/Text-Email/event-utils.js.mustache +18 -0
  86. package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +231 -0
  87. package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +22 -0
  88. package/src/tasks/create/templates/Constellation/Field/Text-Email/styles.js.mustache +7 -0
  89. package/src/tasks/create/templates/Constellation/Field/Text-Email/suggestions-handler.js +10 -0
  90. package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.jsx +26 -0
  91. package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +111 -0
  92. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +48 -0
  93. package/src/tasks/create/templates/Constellation/Field/Text-Input/event-utils.js.mustache +18 -0
  94. package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +239 -0
  95. package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +21 -0
  96. package/src/tasks/create/templates/Constellation/Field/Text-Input/styles.js.mustache +7 -0
  97. package/src/tasks/create/templates/Constellation/Field/Text-Input/suggestions-handler.js +10 -0
  98. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +111 -0
  99. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +48 -0
  100. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/event-utils.js.mustache +18 -0
  101. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +231 -0
  102. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +20 -0
  103. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/styles.js.mustache +7 -0
  104. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/suggestions-handler.js +10 -0
  105. package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +123 -0
  106. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +46 -0
  107. package/src/tasks/create/templates/Constellation/Field/Text-Phone/event-utils.js.mustache +18 -0
  108. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +267 -0
  109. package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +37 -0
  110. package/src/tasks/create/templates/Constellation/Field/Text-Phone/styles.js.mustache +7 -0
  111. package/src/tasks/create/templates/Constellation/Field/Text-Phone/suggestions-handler.js +10 -0
  112. package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +237 -0
  113. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +46 -0
  114. package/src/tasks/create/templates/Constellation/Field/Text-URL/event-utils.js.mustache +18 -0
  115. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +232 -0
  116. package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +22 -0
  117. package/src/tasks/create/templates/Constellation/Field/Text-URL/styles.js.mustache +7 -0
  118. package/src/tasks/create/templates/Constellation/Field/Text-URL/suggestions-handler.js +10 -0
  119. package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.jsx.mustache +173 -0
  120. package/src/tasks/create/templates/Constellation/Field/TimeOfDay/config.json.mustache +185 -0
  121. package/src/tasks/create/templates/Constellation/Field/TimeOfDay/demo.stories.jsx.mustache +57 -0
  122. package/src/tasks/create/templates/Constellation/Field/TimeOfDay/index.jsx.mustache +213 -0
  123. package/src/tasks/create/templates/Constellation/Field/TimeOfDay/mock.stories.js.mustache +20 -0
  124. package/src/tasks/create/templates/Constellation/Field/TimeOfDay/styles.js.mustache +7 -0
  125. package/src/tasks/create/templates/Constellation/Field/TimeOfDay/suggestions-handler.js +10 -0
  126. package/src/tasks/create/templates/Constellation/Field/TimeOfDay/time-of-day.js.mustache +287 -0
  127. package/src/tasks/create/templates/Constellation/Template/DETAILS/OneColumnDetails.svg +22 -0
  128. package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.jsx.mustache +26 -0
  129. package/src/tasks/create/templates/Constellation/Template/DETAILS/config.json.mustache +35 -0
  130. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +132 -0
  131. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +86 -0
  132. package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +189 -0
  133. package/src/tasks/create/templates/Constellation/Template/DETAILS/styles.js.mustache +7 -0
  134. package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +152 -0
  135. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +26 -0
  136. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/TwoColumnDetails.svg +28 -0
  137. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/config.json.mustache +42 -0
  138. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +136 -0
  139. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +86 -0
  140. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +230 -0
  141. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/styles.js.mustache +7 -0
  142. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +155 -0
  143. package/src/tasks/create/templates/Constellation/Template/FORM/DefaultForm.svg +29 -0
  144. package/src/tasks/create/templates/Constellation/Template/FORM/config.json.mustache +45 -0
  145. package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +169 -0
  146. package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +45 -0
  147. package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +137 -0
  148. package/src/tasks/create/templates/Constellation/Template/FORM/styles.js.mustache +7 -0
  149. package/src/tasks/create/templates/Constellation/Template/FORM-region/TwoColumn.svg +38 -0
  150. package/src/tasks/create/templates/Constellation/Template/FORM-region/config.json.mustache +27 -0
  151. package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +178 -0
  152. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +48 -0
  153. package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +143 -0
  154. package/src/tasks/create/templates/Constellation/Template/FORM-region/styles.js.mustache +7 -0
  155. package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.jsx.mustache +35 -0
  156. package/src/tasks/create/templates/Constellation/Template/PAGE/OneColumnPage.svg +36 -0
  157. package/src/tasks/create/templates/Constellation/Template/PAGE/config.json.mustache +32 -0
  158. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +102 -0
  159. package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +70 -0
  160. package/src/tasks/create/templates/Constellation/Template/PAGE/localizations.json.mustache +4 -0
  161. package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +94 -0
  162. package/src/tasks/create/templates/Constellation/Template/PAGE/styles.js.mustache +7 -0
  163. package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +229 -0
  164. package/src/tasks/create/templates/Constellation/Widget/CASE/OneColumnPage.svg +36 -0
  165. package/src/tasks/create/templates/Constellation/Widget/CASE/config.json.mustache +23 -0
  166. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +78 -0
  167. package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +76 -0
  168. package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +390 -0
  169. package/src/tasks/create/{template → templates/Constellation/Widget/CASE}/styles.js.mustache +1 -1
  170. package/src/tasks/create/templates/Constellation/Widget/PAGE/OneColumnPage.svg +36 -0
  171. package/src/tasks/create/templates/Constellation/Widget/PAGE/config.json.mustache +59 -0
  172. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +30 -0
  173. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +48 -0
  174. package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +23 -0
  175. package/src/tasks/create/templates/Constellation/Widget/PAGE/styles.js.mustache +7 -0
  176. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.jsx.mustache +75 -0
  177. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/OneColumnPage.svg +36 -0
  178. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Operator.jsx.mustache +240 -0
  179. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/config.json.mustache +66 -0
  180. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +68 -0
  181. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +110 -0
  182. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +51 -0
  183. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/styles.js.mustache +7 -0
  184. package/src/tasks/create-all/index.js +398 -0
  185. package/src/tasks/delete/helper.js +6 -4
  186. package/src/tasks/delete/index.js +4 -0
  187. package/src/tasks/delete-all/helper.js +153 -0
  188. package/src/tasks/delete-all/index.js +49 -0
  189. package/src/tasks/generate-ai/aiPrompt.txt.mustache +121 -0
  190. package/src/tasks/generate-ai/helper.js +184 -0
  191. package/src/tasks/generate-ai/index.js +33 -0
  192. package/src/tasks/index.js +7 -0
  193. package/src/tasks/init/index.js +9 -3
  194. package/src/tasks/init/template/.eslintignore +8 -0
  195. package/src/tasks/init/template/.eslintrc.json +186 -5
  196. package/src/tasks/init/template/.vscode/extensions.json +1 -1
  197. package/src/tasks/init/template/README.md +80 -61
  198. package/src/tasks/init/template/keys/DX-ComponentDev.zip +0 -0
  199. package/src/tasks/init/template/keys/dxcb.crt +32 -0
  200. package/src/tasks/init/template/keys/dxcb.key +51 -0
  201. package/src/tasks/init/template/package.json.mustache +44 -21
  202. package/src/tasks/init/template/tasks.config.json +19 -5
  203. package/src/tasks/init/template/templateNPMRC.txt +8 -0
  204. package/src/tasks/linter/index.js +46 -0
  205. package/src/tasks/list/helper.js +19 -6
  206. package/src/tasks/list/index.js +4 -0
  207. package/src/tasks/publish/helper.js +13 -4
  208. package/src/tasks/publish/index.js +14 -1
  209. package/src/tasks/publish-all/helper.js +154 -0
  210. package/src/tasks/publish-all/index.js +95 -0
  211. package/src/tasks/rename/index.js +314 -0
  212. package/src/tasks/validator/index.js +291 -18
  213. package/src/util.js +247 -6
  214. package/src/tasks/create/template/demo.stories.jsx.mustache +0 -44
  215. package/src/tasks/init/template/src/components/MBTAList/MBTAList.stories.tsx +0 -10
  216. package/src/tasks/init/template/src/components/MBTAList/MBTAList.tsx +0 -122
  217. package/src/tasks/init/template/src/components/MBTAList/icons/accessible.icon.tsx +0 -14
  218. package/src/tasks/init/template/src/components/MBTAList/icons/bus.icon.tsx +0 -13
  219. package/src/tasks/init/template/src/components/MBTAList/icons/mbta.icon.tsx +0 -10
  220. package/src/tasks/init/template/src/components/MBTAList/icons/subway.icon.tsx +0 -14
  221. package/src/tasks/init/template/src/components/MBTAList/index.ts +0 -2
  222. /package/src/tasks/{publish/bundle → bundle}/builder/modules.js +0 -0
  223. /package/src/tasks/{publish/bundle → bundle}/builder/paths.js +0 -0
@@ -0,0 +1,21 @@
1
+ export const configProps = {
2
+ value: true,
3
+ label: 'Boolean label',
4
+ helperText: 'Test helper text',
5
+ caption: 'Boolean caption',
6
+ validatemessage: '',
7
+ hideLabel: false,
8
+ testId: '12345678',
9
+ additionalProps: {},
10
+ displayMode: '',
11
+ variant: '',
12
+ trueLabel: 'True',
13
+ falseLabel: 'False',
14
+ disabled: false,
15
+ readOnly: false,
16
+ required: true
17
+ };
18
+
19
+ export const stateProps = {
20
+ value: '.Test'
21
+ };
@@ -0,0 +1,7 @@
1
+ import styled, { css } from 'styled-components';
2
+
3
+ export default styled.div(() => {
4
+ return css`
5
+ margin: 0px 0px;
6
+ `;
7
+ });
@@ -0,0 +1,61 @@
1
+ import dayjs from 'dayjs';
2
+ import relativeTime from 'dayjs/plugin/relativeTime';
3
+ import localizedFormat from 'dayjs/plugin/localizedFormat';
4
+ import utc from 'dayjs/plugin/utc';
5
+ import tzone from 'dayjs/plugin/timezone';
6
+
7
+ dayjs.extend(relativeTime);
8
+ dayjs.extend(localizedFormat);
9
+ dayjs.extend(utc);
10
+ dayjs.extend(tzone);
11
+
12
+ const types = ['fromNow', 'customFormat'];
13
+
14
+
15
+
16
+ // value should be in ISO 8601 format.
17
+ function DateFormatter(
18
+ value,
19
+ { type = types[1], format = "DD/MM/YYYY", timezone } = {}
20
+ ) {
21
+ if (!value) return value;
22
+ switch (type) {
23
+ case types[1]:
24
+ if (timezone) return dayjs(value).tz(timezone).format(format);
25
+ return dayjs(value).format(format);
26
+ case types[0]:
27
+ return dayjs(value).from(dayjs());
28
+ default:
29
+ return value;
30
+ }
31
+ }
32
+
33
+ // value should be in hh:mm:ss format (00:00:00 - 23:59:59).
34
+ function TimeFormatter(value, options) {
35
+ if (!value) return value;
36
+ const { locale = "en-US" } = options;
37
+ const timeOnlyRegex = /^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$/;
38
+ if (value.length === 8 && timeOnlyRegex.test(value)) {
39
+ const tempDate = new Date();
40
+ const hours = parseInt(value.substr(0, 2), 10);
41
+ const minutes = parseInt(value.substr(3, 2), 10);
42
+ const seconds = parseInt(value.substr(6, 2), 10);
43
+ tempDate.setHours(hours);
44
+ tempDate.setMinutes(minutes);
45
+ tempDate.setSeconds(seconds);
46
+ return tempDate.toLocaleTimeString(locale);
47
+ }
48
+ return DateFormatter(value, options);
49
+ }
50
+
51
+ export default {
52
+ Date: (value, options) => DateFormatter(value, { type: 'customFormat', ...options }),
53
+ 'Date-Time-Default': (value, options) =>
54
+ DateFormatter(value, { ...options, type: 'customFormat', format: 'lll' }),
55
+ 'Time-Default': (value, options) =>
56
+ TimeFormatter(value, {
57
+ ...options,
58
+ type: 'customFormat',
59
+ format: 'hh:mm A'
60
+ })
61
+ };
@@ -0,0 +1,41 @@
1
+ import { FieldValueList } from '@pega/cosmos-react-core';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import { format } from './date.js';
5
+
6
+ export default function FormattedText(props) {
7
+ const { formatType, label, value, testId, hideLabel, variant, additionalProps } = props;
8
+
9
+ let text = value;
10
+
11
+ text = format(text, formatType, additionalProps);
12
+
13
+ const fields = [
14
+ {
15
+ id: label.toLowerCase(),
16
+ name: hideLabel ? '' : label,
17
+ value: text
18
+ }
19
+ ];
20
+ return <FieldValueList variant={variant} fields={fields} data-testid={testId} />;
21
+ }
22
+
23
+ FormattedText.defaultProps = {
24
+ formatType: 'none',
25
+ variant: 'stacked',
26
+ value: undefined,
27
+ label: '',
28
+ testId: null,
29
+ hideLabel: false,
30
+ additionalProps: {}
31
+ };
32
+
33
+ FormattedText.propTypes = {
34
+ formatType: PropTypes.string,
35
+ variant: PropTypes.oneOf(['inline', 'stacked']),
36
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
37
+ label: PropTypes.string,
38
+ testId: PropTypes.string,
39
+ additionalProps: PropTypes.objectOf(PropTypes.any),
40
+ hideLabel: PropTypes.bool
41
+ };
@@ -0,0 +1,195 @@
1
+ {
2
+ "name": "{{COMPONENT_KEY}}",
3
+ "label": "{{COMPONENT_LABEL}}",
4
+ "description": "{{DESCRIPTION}}",
5
+ "organization": "{{ORGANIZATION}}",
6
+ "version": "{{VERSION}}",
7
+ "library": "{{LIBRARY}}",
8
+ "allowedApplications": {{{ALLOWEDAPPS}}},
9
+ "componentKey": "{{COMPONENT_KEY}}",
10
+ "type": "{{TYPE}}",
11
+ "subtype": {{{SUB_TYPE}}},
12
+ "icon": "images/pz-date-time-active.svg",
13
+ "properties": [
14
+ {
15
+ "name": "label",
16
+ "label": "Field label",
17
+ "format": "TEXT",
18
+ "required": true
19
+ },
20
+ {
21
+ "name": "readOnly",
22
+ "label": "Edit mode",
23
+ "format": "READONLY"
24
+ },
25
+ {
26
+ "label": "Column settings",
27
+ "format": "GROUP",
28
+ "visibility": "@VIEWTYPE == 'MultiRecordDisplayAsTable'",
29
+ "properties": [
30
+ {
31
+ "name": "columnWidth",
32
+ "label": "Column width",
33
+ "format": "SELECT",
34
+ "source": [
35
+ {
36
+ "key": "auto",
37
+ "value": "Auto"
38
+ },
39
+ {
40
+ "key": "custom",
41
+ "value": "Custom"
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "width",
47
+ "label": "Width (px)",
48
+ "format": "NUMBER",
49
+ "visibility": "$this.columnWidth == 'custom'"
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "label": "Input settings",
55
+ "format": "GROUP",
56
+ "visibility": "(!readOnly = true)",
57
+ "properties": [
58
+ {
59
+ "format": "LABEL",
60
+ "label": "Year range",
61
+ "variant": "secondary"
62
+ },
63
+ {
64
+ "format": "INLINE",
65
+ "elements": [
66
+ {
67
+ "key": "next",
68
+ "format": "LABEL",
69
+ "label": "Next",
70
+ "variant": "secondary"
71
+ },
72
+ {
73
+ "key": "nextYears",
74
+ "format": "NUMBER",
75
+ "label": "",
76
+ "name": "nextYearRange",
77
+ "min": 0
78
+ },
79
+ {
80
+ "key": "year",
81
+ "format": "LABEL",
82
+ "label": "years",
83
+ "variant": "secondary"
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "format": "INLINE",
89
+ "elements": [
90
+ {
91
+ "key": "previous",
92
+ "format": "LABEL",
93
+ "label": "Previous",
94
+ "variant": "secondary"
95
+ },
96
+ {
97
+ "key": "previousYears",
98
+ "format": "NUMBER",
99
+ "label": "",
100
+ "name": "previousYearRange",
101
+ "min": 0
102
+ },
103
+ {
104
+ "key": "year",
105
+ "format": "LABEL",
106
+ "label": "years",
107
+ "variant": "secondary"
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ "name": "showWeekNumber",
113
+ "label": "Display week numbers on calendar",
114
+ "format": "BOOLEAN"
115
+ },
116
+ {
117
+ "name": "helperText",
118
+ "label": "Helper text",
119
+ "format": "TEXT"
120
+ }
121
+ ]
122
+ },
123
+ {
124
+ "label": "Read-only settings",
125
+ "format": "GROUP",
126
+ "properties": [
127
+ {
128
+ "name": "showAsFormattedText",
129
+ "label": "Show as formatted text",
130
+ "format": "BOOLEAN"
131
+ },
132
+ {
133
+ "format": "SELECT",
134
+ "name": "formatter",
135
+ "label": "Format",
136
+ "defaultValue": "defaultDate",
137
+ "source": [
138
+ {
139
+ "key": "defaultDate",
140
+ "value": "Default"
141
+ },
142
+ {
143
+ "key": "DateTime-Long",
144
+ "value": "Date Time"
145
+ },
146
+ {
147
+ "key": "DateTime-Since",
148
+ "value": "Since"
149
+ }
150
+ ]
151
+ }
152
+ ]
153
+ },
154
+ {
155
+ "label": "Conditions",
156
+ "format": "GROUP",
157
+ "properties": [
158
+ {
159
+ "name": "required",
160
+ "label": "Required",
161
+ "format": "REQUIRED",
162
+ "visibility": "(!readOnly = true)"
163
+ },
164
+ {
165
+ "name": "disabled",
166
+ "label": "Disabled",
167
+ "format": "DISABLED",
168
+ "visibility": "(!readOnly = true)"
169
+ },
170
+ {
171
+ "name": "visibility",
172
+ "label": "Visibility",
173
+ "format": "VISIBILITY"
174
+ }
175
+ ]
176
+ },
177
+ {
178
+ "label": "Advanced",
179
+ "format": "GROUP",
180
+ "collapsible": true,
181
+ "properties": [
182
+ {
183
+ "name": "testId",
184
+ "label": "Test ID",
185
+ "format": "TEXT",
186
+ "ignorePattern": "[^-_\\p{N}\\p{L}]",
187
+ "includeAnnotations": false
188
+ }
189
+ ]
190
+ }
191
+ ],
192
+ "defaultConfig": {
193
+ "label": "@L $this.label"
194
+ }
195
+ }