@pega/custom-dx-components 2.0.14 → 2.0.16

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 (118) hide show
  1. package/README.md +3 -3
  2. package/package.json +2 -2
  3. package/src/cli.js +0 -18
  4. package/src/tasks/authenticate/index.js +1 -3
  5. package/src/tasks/create/index.js +3 -6
  6. package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +1 -1
  7. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +18 -29
  8. package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +2 -1
  9. package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +67 -179
  10. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +16 -39
  11. package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +1 -3
  12. package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +1 -0
  13. package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js.mustache → date-utils.js} +0 -1
  14. package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +0 -1
  15. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +15 -39
  16. package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +0 -2
  17. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +17 -22
  18. package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +1 -2
  19. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +17 -25
  20. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +4 -3
  21. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -22
  22. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +2 -8
  23. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +17 -22
  24. package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +1 -2
  25. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +14 -42
  26. package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +1 -44
  27. package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -0
  28. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +16 -21
  29. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +16 -20
  30. package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +2 -44
  31. package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +43 -0
  32. package/src/tasks/create/templates/Constellation/{Template/DETAILS/StatusWork.jsx.mustache → Field/Text-Input/StatusWork.js} +1 -0
  33. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +17 -21
  34. package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +3 -46
  35. package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +43 -0
  36. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +17 -21
  37. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +2 -44
  38. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +43 -0
  39. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +17 -19
  40. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +2 -46
  41. package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +43 -0
  42. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +17 -19
  43. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +3 -174
  44. package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +172 -0
  45. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +16 -24
  46. package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +0 -1
  47. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +29 -14
  48. package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +77 -3
  49. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +29 -14
  50. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +74 -3
  51. package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +10 -6
  52. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +8 -10
  53. package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.jsx.mustache → GetNextWork.js.mustache} +0 -6
  54. package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +7 -9
  55. package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +1 -4
  56. package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +0 -1
  57. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +8 -8
  58. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.jsx.mustache → Avatar.js.mustache} +0 -2
  59. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.jsx.mustache → Operator.js.mustache} +1 -2
  60. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
  61. package/src/tasks/delete/helper.js +0 -4
  62. package/src/tasks/delete/index.js +0 -4
  63. package/src/tasks/index.js +0 -3
  64. package/src/tasks/init/index.js +1 -1
  65. package/src/tasks/init/template/.eslintrc.json +5 -186
  66. package/src/tasks/init/template/package.json.mustache +4 -19
  67. package/src/tasks/init/template/tasks.config.json +0 -1
  68. package/src/tasks/list/index.js +0 -4
  69. package/src/tasks/{bundle → publish/bundle}/builder/index.js +0 -0
  70. package/src/tasks/{bundle → publish/bundle}/builder/modules.js +0 -0
  71. package/src/tasks/{bundle → publish/bundle}/builder/paths.js +0 -0
  72. package/src/tasks/{bundle → publish/bundle}/builder/webpack.config.js +2 -0
  73. package/src/tasks/{bundle → publish/bundle}/index.js +2 -2
  74. package/src/tasks/publish/index.js +1 -14
  75. package/src/util.js +0 -10
  76. package/src/tasks/build/helper.js +0 -123
  77. package/src/tasks/build/index.js +0 -54
  78. package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +0 -21
  79. package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +0 -61
  80. package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +0 -41
  81. package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +0 -23
  82. package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +0 -23
  83. package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +0 -21
  84. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +0 -23
  85. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +0 -21
  86. package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +0 -21
  87. package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +0 -67
  88. package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +0 -13
  89. package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +0 -22
  90. package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.jsx +0 -26
  91. package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +0 -21
  92. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +0 -20
  93. package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +0 -37
  94. package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +0 -22
  95. package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +0 -20
  96. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +0 -110
  97. package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +0 -179
  98. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +0 -26
  99. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +0 -118
  100. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +0 -215
  101. package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +0 -89
  102. package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +0 -125
  103. package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +0 -92
  104. package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +0 -125
  105. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +0 -102
  106. package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +0 -94
  107. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +0 -78
  108. package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +0 -389
  109. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +0 -30
  110. package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +0 -22
  111. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +0 -68
  112. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +0 -51
  113. package/src/tasks/delete-all/helper.js +0 -175
  114. package/src/tasks/delete-all/index.js +0 -49
  115. package/src/tasks/init/template/.eslintignore +0 -8
  116. package/src/tasks/linter/index.js +0 -46
  117. package/src/tasks/publish-all/helper.js +0 -139
  118. package/src/tasks/publish-all/index.js +0 -84
@@ -1,5 +1,6 @@
1
+ import { useState } from 'react';
1
2
  import { withKnobs, text, boolean } from '@storybook/addon-knobs';
2
- import { configProps, stateProps } from './mock.stories';
3
+
3
4
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
4
5
 
5
6
  export default {
@@ -8,55 +9,31 @@ export default {
8
9
  component: {{COMPONENT_CLASS_NAME}}
9
10
  };
10
11
 
11
- if (!window.PCore) {
12
- window.PCore = {};
13
- }
14
-
15
- window.PCore.getEnvironmentInfo = () => {
16
- return {
17
- getLocale: () => {
18
- return 'en-GB';
19
- }
20
- };
21
- };
22
-
23
12
  export const base{{COMPONENT_CLASS_NAME}} = () => {
13
+ const [value, setValue] = useState('test value');
14
+
24
15
  const props = {
25
16
  getPConnect: () => {
26
17
  return {
27
18
  getActionsApi: () => {
28
19
  return {
29
- updateFieldValue: () => {},
30
- triggerFieldChange: () => {}
20
+ updateFieldValue: (propName, value) => {
21
+ setValue(value);
22
+ }
31
23
  };
32
24
  },
33
25
  getStateProps: () => {
34
- return stateProps;
35
- },
36
- getConfigProps: () => {
37
- return configProps;
38
- },
39
- ignoreSuggestion: () => {},
40
- clearErrorMessages: () => {}
26
+ return { value: '.name' };
27
+ }
41
28
  };
42
29
  },
43
- value: configProps.value,
44
- validatemessage: configProps.validatemessage,
45
- label: configProps.label,
46
- hideLabel: configProps.hideLabel,
47
- helperText: configProps.helperText,
48
- nextYearRange: configProps.nextYearRange,
49
- previousYearRange: configProps.previousYearRange,
50
- showWeekNumber: configProps.showWeekNumber,
51
- testId: configProps.testId,
52
- showAsFormattedText: configProps.showAsFormattedText,
53
- additionalProps: configProps.additionalProps,
54
- displayMode: configProps.displayMode,
55
- variant: configProps.variant,
56
- hasSuggestions: configProps.hasSuggestions,
57
- disabled: configProps.disabled,
58
- readOnly: configProps.readOnly,
59
- required: configProps.required
30
+ value,
31
+ placeholder: text('Placeholder', 'Test placeholder'),
32
+ disabled: boolean('Disabled', false),
33
+ readOnly: boolean('Disabled', false),
34
+ required: boolean('Disabled', false),
35
+ label: text('Label', 'Sample Label'),
36
+ testId: text('Test id', 'text-12344566')
60
37
  };
61
38
 
62
39
  return (
@@ -1,8 +1,6 @@
1
- /* eslint-disable no-undef */
2
1
  import { useEffect, useState } from 'react';
3
- import { DateInput, FieldValueList, DateTimeDisplay, Text, } from '@pega/cosmos-react-core';
2
+ import { DateInput, FieldValueList, DateTimeDisplay, Text } from '@pega/cosmos-react-core';
4
3
  import PropTypes from 'prop-types';
5
- import FormattedText from "./FormattedText.jsx";
6
4
 
7
5
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
8
6
 
@@ -47,6 +47,7 @@ function TimeFormatter(value, options) {
47
47
  }
48
48
 
49
49
  export const DateTimeShortFormatter = (value, options) => {
50
+ //export function DateTimeShortFormatter(value, options) {
50
51
  return DateFormatter(value, {
51
52
  ...options,
52
53
  type: "customFormat",
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  import dayjs from "dayjs";
3
2
 
4
3
  const relativeTime = require("dayjs/plugin/relativeTime");
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  import dayjs from 'dayjs';
3
2
 
4
3
  const relativeTime = require('dayjs/plugin/relativeTime');
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
2
  import { withKnobs, text, boolean } from '@storybook/addon-knobs';
3
- import { configProps, stateProps } from './mock.stories';
3
+
4
4
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
5
5
 
6
6
  export default {
@@ -9,55 +9,31 @@ export default {
9
9
  component: {{COMPONENT_CLASS_NAME}}
10
10
  };
11
11
 
12
- if (!window.PCore) {
13
- window.PCore = {};
14
- }
15
-
16
- window.PCore.getEnvironmentInfo = () => {
17
- return {
18
- getTimeZone: () => {
19
- return '';
20
- }
21
- };
22
- };
23
-
24
12
  export const base{{COMPONENT_CLASS_NAME}} = () => {
13
+ const [value, setValue] = useState('test value');
14
+
25
15
  const props = {
26
16
  getPConnect: () => {
27
17
  return {
28
18
  getActionsApi: () => {
29
19
  return {
30
- updateFieldValue: () => {},
31
- triggerFieldChange: () => {}
20
+ updateFieldValue: (propName, value) => {
21
+ setValue(value);
22
+ }
32
23
  };
33
24
  },
34
25
  getStateProps: () => {
35
- return stateProps;
36
- },
37
- getConfigProps: () => {
38
- return configProps;
39
- },
40
- ignoreSuggestion: () => {},
41
- clearErrorMessages: () => {}
26
+ return { value: '.name' };
27
+ }
42
28
  };
43
29
  },
44
- value: configProps.value,
45
- validatemessage: configProps.validatemessage,
46
- label: configProps.label,
47
- hideLabel: configProps.hideLabel,
48
- helperText: configProps.helperText,
49
- withSeconds: configProps.withSeconds,
50
- nextYearRange: configProps.nextYearRange,
51
- previousYearRange: configProps.previousYearRange,
52
- showWeekNumber: configProps.showWeekNumber,
53
- testId: configProps.testId,
54
- additionalProps: configProps.additionalProps,
55
- displayMode: configProps.displayMode,
56
- variant: configProps.variant,
57
- hasSuggestions: configProps.hasSuggestions,
58
- disabled: configProps.disabled,
59
- readOnly: configProps.readOnly,
60
- required: configProps.required
30
+ value,
31
+ placeholder: text('Placeholder', 'Test placeholder'),
32
+ disabled: boolean('Disabled', false),
33
+ readOnly: boolean('Disabled', false),
34
+ required: boolean('Disabled', false),
35
+ label: text('Label', 'Sample Label'),
36
+ testId: text('Test id', 'text-12344566')
61
37
  };
62
38
 
63
39
  return (
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  import { useEffect, useState } from 'react';
3
2
  import { DateTimeInput, FieldValueList, DateTimeDisplay, Text } from "@pega/cosmos-react-core";
4
3
  import PropTypes from "prop-types";
@@ -247,7 +246,6 @@ const {{COMPONENT_CLASS_NAME}} = props => {
247
246
  displayMode: PropTypes.string,
248
247
  variant: PropTypes.string,
249
248
  formatter: PropTypes.string,
250
- Format: PropType.string,
251
249
  hasSuggestions: PropTypes.bool
252
250
  };
253
251
 
@@ -1,6 +1,5 @@
1
- import { withKnobs } from '@storybook/addon-knobs';
2
-
3
- import { configProps, fieldMetadata, stateProps } from './mock.stories.js';
1
+ import { useState } from 'react';
2
+ import { withKnobs, text, boolean } from '@storybook/addon-knobs';
4
3
 
5
4
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
6
5
 
@@ -11,34 +10,30 @@ export default {
11
10
  };
12
11
 
13
12
  export const base{{COMPONENT_CLASS_NAME}} = () => {
13
+ const [value, setValue] = useState('test value');
14
14
 
15
15
  const props = {
16
- value: configProps.value,
17
- placeholder: configProps.placeholder,
18
- label: configProps.label,
19
- helperText: configProps.helperText,
20
- showGroupSeparators: configProps.showGroupSeparators,
21
- hasSuggestions: configProps.hasSuggestions,
22
- testId: configProps.testId,
23
- fieldMetadata: fieldMetadata,
24
-
25
16
  getPConnect: () => {
26
17
  return {
27
- getStateProps: () => {
28
- return stateProps;
29
- },
30
18
  getActionsApi: () => {
31
19
  return {
32
- updateFieldValue: () => {},
33
- triggerFieldChange: () => {}
20
+ updateFieldValue: (propName, value) => {
21
+ setValue(value);
22
+ }
34
23
  };
35
24
  },
36
- ignoreSuggestion: () => {},
37
- acceptSuggestion: () => {},
38
- setInheritedProps: () => {},
39
- resolveConfigProps: () => {}
25
+ getStateProps: () => {
26
+ return { value: '.name' };
27
+ }
40
28
  };
41
- }
29
+ },
30
+ value,
31
+ placeholder: text('Placeholder', 'Test placeholder'),
32
+ disabled: boolean('Disabled', false),
33
+ readOnly: boolean('Disabled', false),
34
+ required: boolean('Disabled', false),
35
+ label: text('Label', 'Sample Label'),
36
+ testId: text('Test id', 'text-12344566')
42
37
  };
43
38
 
44
39
  return (
@@ -233,7 +233,7 @@ const {{COMPONENT_CLASS_NAME}} = props => {
233
233
  variant: 'inline',
234
234
  currencyISOCode: 'USD',
235
235
  formatter: 'defaultDecimal',
236
- isoCodeSelection: 'constant',
236
+ isoCodeSelectiopn: 'constant',
237
237
  negative: 'minus-sign',
238
238
  notation: 'standard',
239
239
  currencyDisplay: 'symbol',
@@ -261,7 +261,6 @@ const {{COMPONENT_CLASS_NAME}} = props => {
261
261
  variant: PropTypes.string,
262
262
  currencyISOCode: PropTypes.string,
263
263
  formatter: PropTypes.string,
264
- isoCodeSelection: PropTypes.string,
265
264
  negative: PropTypes.string,
266
265
  notation: PropTypes.string,
267
266
  currencyDisplay: PropTypes.string,
@@ -1,6 +1,5 @@
1
- import { withKnobs } from '@storybook/addon-knobs';
2
-
3
- import { configProps, fieldMetadata, stateProps } from './mock.stories.js';
1
+ import { useState } from 'react';
2
+ import { withKnobs, text, boolean } from '@storybook/addon-knobs';
4
3
 
5
4
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
6
5
 
@@ -11,37 +10,30 @@ export default {
11
10
  };
12
11
 
13
12
  export const base{{COMPONENT_CLASS_NAME}} = () => {
13
+ const [value, setValue] = useState('test value');
14
14
 
15
15
  const props = {
16
- value: configProps.value,
17
- placeholder: configProps.placeholder,
18
- label: configProps.label,
19
- helperText: configProps.helperText,
20
- showGroupSeparators: configProps.showGroupSeparators,
21
- allowDecimals: configProps.allowDecimals,
22
- currencyISOCode: configProps.currencyISOCode,
23
- alwaysShowISOCode: configProps.alwaysShowISOCode,
24
- hasSuggestions: configProps.hasSuggestions,
25
- testId: configProps.testId,
26
- fieldMetadata: fieldMetadata,
27
-
28
16
  getPConnect: () => {
29
17
  return {
30
- getStateProps: () => {
31
- return stateProps;
32
- },
33
18
  getActionsApi: () => {
34
19
  return {
35
- updateFieldValue: () => {},
36
- triggerFieldChange: () => {}
20
+ updateFieldValue: (propName, value) => {
21
+ setValue(value);
22
+ }
37
23
  };
38
24
  },
39
- ignoreSuggestion: () => {},
40
- acceptSuggestion: () => {},
41
- setInheritedProps: () => {},
42
- resolveConfigProps: () => {}
25
+ getStateProps: () => {
26
+ return { value: '.name' };
27
+ }
43
28
  };
44
- }
29
+ },
30
+ value,
31
+ placeholder: text('Placeholder', 'Test placeholder'),
32
+ disabled: boolean('Disabled', false),
33
+ readOnly: boolean('Disabled', false),
34
+ required: boolean('Disabled', false),
35
+ label: text('Label', 'Sample Label'),
36
+ testId: text('Test id', 'text-12344566')
45
37
  };
46
38
 
47
39
  return (
@@ -5,6 +5,7 @@ import {
5
5
  NumberDisplay,
6
6
  FieldValueList,
7
7
  Text,
8
+ useConfiguration,
8
9
  useAfterInitialEffect
9
10
  } from '@pega/cosmos-react-core';
10
11
  import PropTypes from 'prop-types';
@@ -13,8 +14,6 @@ import PropTypes from 'prop-types';
13
14
  import handleEvent from './event-utils';
14
15
  import { suggestionsHandler } from './suggestions-handler';
15
16
 
16
- import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
17
-
18
17
  const formatValue = (value) => {
19
18
  if (!value && value !== 0) return '';
20
19
  const [integer, decimal = ''] = value.toString().split('.');
@@ -22,6 +21,9 @@ const formatValue = (value) => {
22
21
  };
23
22
 
24
23
 
24
+
25
+ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
26
+
25
27
  // Duplicated runtime code from Constellation Design System Component
26
28
 
27
29
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
@@ -273,7 +275,6 @@ const {{COMPONENT_CLASS_NAME}} = props => {
273
275
  decimalPrecision: PropTypes.number,
274
276
  allowDecimals: PropTypes.bool,
275
277
  currencyISOCode: PropTypes.string,
276
- isoCodeSelection: PropTypes.string,
277
278
  hideLabel: PropTypes.bool,
278
279
  getPConnect: PropTypes.func.isRequired,
279
280
  validatemessage: PropTypes.string,
@@ -1,6 +1,5 @@
1
- import { withKnobs } from '@storybook/addon-knobs';
2
-
3
- import { configProps, stateProps, fieldMetadata } from './mock.stories.js';
1
+ import { useState } from 'react';
2
+ import { withKnobs, text, boolean } from '@storybook/addon-knobs';
4
3
 
5
4
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
6
5
 
@@ -11,34 +10,30 @@ export default {
11
10
  };
12
11
 
13
12
  export const base{{COMPONENT_CLASS_NAME}} = () => {
13
+ const [value, setValue] = useState('test value');
14
14
 
15
15
  const props = {
16
- value: configProps.value,
17
- placeholder: configProps.placeholder,
18
- label: configProps.label,
19
- helperText: configProps.helperText,
20
- showGroupSeparators: configProps.showGroupSeparators,
21
- hasSuggestions: configProps.hasSuggestions,
22
- testId: configProps.testId,
23
- fieldMetadata: fieldMetadata,
24
-
25
16
  getPConnect: () => {
26
17
  return {
27
- getStateProps: () => {
28
- return stateProps;
29
- },
30
18
  getActionsApi: () => {
31
19
  return {
32
- updateFieldValue: () => {},
33
- triggerFieldChange: () => {}
20
+ updateFieldValue: (propName, value) => {
21
+ setValue(value);
22
+ }
34
23
  };
35
24
  },
36
- ignoreSuggestion: () => {},
37
- acceptSuggestion: () => {},
38
- setInheritedProps: () => {},
39
- resolveConfigProps: () => {}
25
+ getStateProps: () => {
26
+ return { value: '.name' };
27
+ }
40
28
  };
41
- }
29
+ },
30
+ value,
31
+ placeholder: text('Placeholder', 'Test placeholder'),
32
+ disabled: boolean('Disabled', false),
33
+ readOnly: boolean('Disabled', false),
34
+ required: boolean('Disabled', false),
35
+ label: text('Label', 'Sample Label'),
36
+ testId: text('Test id', 'text-12344566')
42
37
  };
43
38
 
44
39
  return (
@@ -1,14 +1,8 @@
1
1
  import { useState, useEffect, useRef } from 'react';
2
- import {
3
- NumberInput,
4
- NumberDisplay,
5
- CurrencyDisplay,
6
- FieldValueList,
7
- Text
8
- } from '@pega/cosmos-react-core';
2
+ import { NumberInput, NumberDisplay, CurrencyDisplay, FieldValueList, Text } from '@pega/cosmos-react-core';
9
3
  import PropTypes from 'prop-types';
10
4
 
11
- // includes in bundle
5
+ //inlcudes in bundle
12
6
  import handleEvent from './event-utils';
13
7
  import { suggestionsHandler } from './suggestions-handler';
14
8
 
@@ -1,6 +1,5 @@
1
- import { withKnobs } from '@storybook/addon-knobs';
2
-
3
- import { stateProps, configProps, fieldMetadata } from './mock.stories';
1
+ import { useState } from 'react';
2
+ import { withKnobs, text, boolean } from '@storybook/addon-knobs';
4
3
 
5
4
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
6
5
 
@@ -11,34 +10,30 @@ export default {
11
10
  };
12
11
 
13
12
  export const base{{COMPONENT_CLASS_NAME}} = () => {
13
+ const [value, setValue] = useState('test value');
14
14
 
15
15
  const props = {
16
- value: configProps.value,
17
- placeholder: configProps.placeholder,
18
- label: configProps.label,
19
- helperText: configProps.helperText,
20
- showGroupSeparators: configProps.showGroupSeparators,
21
- hasSuggestions: configProps.hasSuggestions,
22
- testId: configProps.testId,
23
- fieldMetadata: fieldMetadata,
24
-
25
16
  getPConnect: () => {
26
17
  return {
27
- getStateProps: () => {
28
- return stateProps;
29
- },
30
18
  getActionsApi: () => {
31
19
  return {
32
- updateFieldValue: () => {},
33
- triggerFieldChange: () => {}
20
+ updateFieldValue: (propName, value) => {
21
+ setValue(value);
22
+ }
34
23
  };
35
24
  },
36
- ignoreSuggestion: () => {},
37
- acceptSuggestion: () => {},
38
- setInheritedProps: () => {},
39
- resolveConfigProps: () => {}
25
+ getStateProps: () => {
26
+ return { value: '.name' };
27
+ }
40
28
  };
41
- }
29
+ },
30
+ value,
31
+ placeholder: text('Placeholder', 'Test placeholder'),
32
+ disabled: boolean('Disabled', false),
33
+ readOnly: boolean('Disabled', false),
34
+ required: boolean('Disabled', false),
35
+ label: text('Label', 'Sample Label'),
36
+ testId: text('Test id', 'text-12344566')
42
37
  };
43
38
 
44
39
  return (
@@ -323,10 +323,9 @@ const {{COMPONENT_CLASS_NAME}} = props => {
323
323
  variant: PropTypes.string,
324
324
  decimalPrecision: PropTypes.number,
325
325
  currencyISOCode: PropTypes.string,
326
- isoCodeSelection: PropTypes.string,
327
326
  formatter: PropTypes.string,
328
327
  negative: PropTypes.string,
329
- notation: PropTypes.string,
328
+ notations: PropTypes.string,
330
329
  currencyDisplay: PropTypes.string,
331
330
  currencyDecimalPrecision: PropTypes.string,
332
331
  isTableFormatter: PropTypes.bool,
@@ -1,7 +1,5 @@
1
1
  import { useState } from 'react';
2
- import { withKnobs } from '@storybook/addon-knobs';
3
-
4
- import { configProps, rawMetadata, fieldMetadata, stateProps } from './mock.stories.js';
2
+ import { withKnobs, text, boolean } from '@storybook/addon-knobs';
5
3
 
6
4
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
7
5
 
@@ -12,56 +10,30 @@ export default {
12
10
  };
13
11
 
14
12
  export const base{{COMPONENT_CLASS_NAME}} = () => {
15
- const [value, setValue] = useState(configProps.value);
13
+ const [value, setValue] = useState('test value');
16
14
 
17
15
  const props = {
18
- value,
19
- placeholder: configProps.placeholder,
20
- label: configProps.label,
21
- helperText: configProps.helperText,
22
- datasource: configProps.datasource,
23
- testId: configProps.testId,
24
- hasSuggestions: configProps.hasSuggestions,
25
- fieldMetadata: fieldMetadata,
26
-
27
16
  getPConnect: () => {
28
17
  return {
29
- getConfigProps: () => {
30
- return configProps;
31
- },
32
- getStateProps: () => {
33
- return stateProps;
34
- },
35
- getLocalizedValue: value => {
36
- return value;
37
- },
38
- getLocaleRuleNameFromKeys: (localeClass, localeContext, localeName) => {
39
- return `${localeClass}!${localeContext}!${localeName}`;
40
- },
41
- getCaseInfo: () => {
42
- return {
43
- getClassName: () => {
44
- return 'DIXL-MediaCo-Work-NewService';
45
- }
46
- };
47
- },
48
- getRawMetadata: () => {
49
- return rawMetadata;
50
- },
51
18
  getActionsApi: () => {
52
19
  return {
53
20
  updateFieldValue: (propName, value) => {
54
21
  setValue(value);
55
- },
56
- triggerFieldChange: () => {}
22
+ }
57
23
  };
58
24
  },
59
- ignoreSuggestion: () => {},
60
- acceptSuggestion: () => {},
61
- setInheritedProps: () => {},
62
- resolveConfigProps: () => {}
25
+ getStateProps: () => {
26
+ return { value: '.name' };
27
+ }
63
28
  };
64
- }
29
+ },
30
+ value,
31
+ placeholder: text('Placeholder', 'Test placeholder'),
32
+ disabled: boolean('Disabled', false),
33
+ readOnly: boolean('Disabled', false),
34
+ required: boolean('Disabled', false),
35
+ label: text('Label', 'Sample Label'),
36
+ testId: text('Test id', 'text-12344566')
65
37
  };
66
38
 
67
39
  return (
@@ -3,54 +3,11 @@ import { Select, Option, FieldValueList, Text } from '@pega/cosmos-react-core';
3
3
  import PropTypes from 'prop-types';
4
4
 
5
5
  // includes in bundle
6
+ import {formatExists,textFormatter} from "./picklist";
6
7
  import handleEvent from "./event-utils";
7
8
  import { suggestionsHandler } from './suggestions-handler';
8
9
 
9
10
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
10
- import {EmailDisplay, PhoneDisplay, URLDisplay } from "@pega/cosmos-react-core";
11
-
12
- export const formatExists = (formatterVal) => {
13
- const formatterValues = [
14
- "TextInput",
15
- "WorkStatus",
16
- "RichText",
17
- "Email",
18
- "Phone",
19
- "URL",
20
- "Operator"
21
- ];
22
- let isformatter = false;
23
- if (formatterValues.includes(formatterVal)) {
24
- isformatter = true;
25
- }
26
- return isformatter;
27
- };
28
-
29
-
30
- export const textFormatter = (formatter,value) => {
31
- let displayComponent = null;
32
- switch(formatter){
33
- case "TextInput" : {
34
- displayComponent = value;
35
- break;
36
- }
37
- case "Email" : {
38
- displayComponent = (<EmailDisplay value={value} displayText={value} variant="link" />);
39
- break;
40
- }
41
- case "Phone" : {
42
- displayComponent = (<PhoneDisplay value={value} variant="link" />);
43
- break;
44
- }
45
- case "URL" : {
46
- displayComponent = (<URLDisplay target="_blank" value={value} displayText={value} variant="link" />);
47
- break;
48
- }
49
- // no default
50
- }
51
- return displayComponent;
52
- };
53
-
54
11
 
55
12
  export const setDefaultValue = (dropdownOptions, pConnect, propName) => {
56
13
  // calculate the default option and set it to dropdown