@pega/dx-component-builder-sdk 0.1.2 → 0.1.4

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 (25) hide show
  1. package/package.json +1 -1
  2. package/src/constants.js +24 -4
  3. package/src/tasks/create/templates/SDK-React/Field/Date/demo.stories.jsx.mustache +15 -11
  4. package/src/tasks/create/templates/SDK-React/Field/Date/index.tsx.mustache +28 -28
  5. package/src/tasks/create/templates/SDK-React/Field/Date/mock.stories.js.mustache +13 -0
  6. package/src/tasks/create/templates/SDK-React/Field/DateTime/demo.stories.jsx.mustache +14 -11
  7. package/src/tasks/create/templates/SDK-React/Field/DateTime/index.tsx.mustache +24 -24
  8. package/src/tasks/create/templates/SDK-React/Field/DateTime/mock.stories.js.mustache +12 -0
  9. package/src/tasks/create/templates/SDK-React/Field/Text/demo.stories.jsx.mustache +14 -25
  10. package/src/tasks/create/templates/SDK-React/Field/Text/mock.stories.js.mustache +13 -0
  11. package/src/tasks/create/templates/SDK-React/Field/Text-Email/demo.stories.jsx.mustache +15 -27
  12. package/src/tasks/create/templates/SDK-React/Field/Text-Email/mock.stories.js.mustache +13 -0
  13. package/src/tasks/create/templates/SDK-React/Field/Text-Input/demo.stories.jsx.mustache +11 -26
  14. package/src/tasks/create/templates/SDK-React/Field/Text-Input/mock.stories.js.mustache +20 -0
  15. package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/demo.stories.jsx.mustache +15 -24
  16. package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/mock.stories.js.mustache +20 -0
  17. package/src/tasks/create/templates/SDK-React/Field/Text-Phone/demo.stories.jsx.mustache +15 -26
  18. package/src/tasks/create/templates/SDK-React/Field/Text-Phone/mock.stories.js.mustache +31 -0
  19. package/src/tasks/create/templates/SDK-React/Field/Text-URL/demo.stories.jsx.mustache +14 -25
  20. package/src/tasks/create/templates/SDK-React/Field/Text-URL/mock.stories.js.mustache +13 -0
  21. package/src/tasks/create/templates/SDK-React/Field/TimeofDay/demo.stories.jsx.mustache +15 -11
  22. package/src/tasks/create/templates/SDK-React/Field/TimeofDay/index.tsx.mustache +23 -22
  23. package/src/tasks/create/templates/SDK-React/Field/TimeofDay/mock.stories.js.mustache +12 -0
  24. package/src/tasks/create/templates/SDK-React/Widget/PAGE/demo.stories.jsx.mustache +29 -0
  25. package/src/tasks/create/templates/SDK-React/Widget/PAGE/mock.stories.js.mustache +23 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/dx-component-builder-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
package/src/constants.js CHANGED
@@ -221,7 +221,7 @@ export const COMPONENT_SCHEMA = {
221
221
  },
222
222
  {
223
223
  name: 'Phone',
224
- value: 'Phopne'
224
+ value: 'Phone'
225
225
  },
226
226
  {
227
227
  name: 'Radio Buttons',
@@ -299,6 +299,10 @@ export const COMPONENT_SCHEMA = {
299
299
  name: 'Assignment Card',
300
300
  value: 'AssignmentCard'
301
301
  },
302
+ {
303
+ name: 'Attachment',
304
+ value: 'Attachment'
305
+ },
302
306
  {
303
307
  name: 'Dashboard Filter',
304
308
  value: 'DashboardFilter'
@@ -309,7 +313,7 @@ export const COMPONENT_SCHEMA = {
309
313
  },
310
314
  {
311
315
  name: 'Error Boundry',
312
- value: 'ErroBoundry'
316
+ value: 'ErrorBoundry'
313
317
  },
314
318
  {
315
319
  name: 'Multi Step',
@@ -389,9 +393,17 @@ export const COMPONENT_SCHEMA = {
389
393
  name: 'Inline Dashboard',
390
394
  value: 'InlineDashboard'
391
395
  },
396
+ {
397
+ name: 'Inline Dashboard Page',
398
+ value: 'InlineDashboardPage'
399
+ },
392
400
  {
393
401
  name: 'List Page',
394
- value: 'List Page'
402
+ value: 'ListPage'
403
+ },
404
+ {
405
+ name: 'List View',
406
+ value: 'ListView'
395
407
  },
396
408
  {
397
409
  name: 'Multi Reference - ReadOnly',
@@ -431,7 +443,15 @@ export const COMPONENT_SCHEMA = {
431
443
  },
432
444
  {
433
445
  name: 'Simple Table',
434
- value: 'SimpleTable'
446
+ value: 'SimpleTable/SimpleTable'
447
+ },
448
+ {
449
+ name: 'Simple Table Manual',
450
+ value: 'SimpleTable/SimpleTableManual'
451
+ },
452
+ {
453
+ name: 'Simple Table Select',
454
+ value: 'SimpleTable/SimpleTableSelect'
435
455
  },
436
456
  {
437
457
  name: 'Single Reference - ReadOnly',
@@ -1,5 +1,7 @@
1
1
  import { useState } from 'react';
2
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
2
+ import { withKnobs } from '@storybook/addon-knobs';
3
+
4
+ import { configProps, stateProps } from './mock.stories';
3
5
 
4
6
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
5
7
 
@@ -10,30 +12,32 @@ export default {
10
12
  };
11
13
 
12
14
  export const Base{{COMPONENT_CLASS_NAME}} = () => {
13
- const [value, setValue] = useState('test value');
15
+ const [value, setValue] = useState(configProps.value);
14
16
 
15
17
  const props = {
18
+ value,
19
+ label: configProps.label,
20
+ hideLabel: configProps.hideLabel,
21
+ displayMode: configProps.displayMode,
22
+
16
23
  getPConnect: () => {
17
24
  return {
18
25
  getActionsApi: () => {
19
26
  return {
20
27
  updateFieldValue: (propName, theValue) => {
21
28
  setValue(theValue);
22
- }
29
+ },
30
+ triggerFieldChange: () => {/* nothing */}
23
31
  };
24
32
  },
25
33
  getStateProps: () => {
26
- return { value: '.name' };
34
+ return stateProps;
27
35
  }
28
36
  };
29
37
  },
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')
38
+ onChange: date => {
39
+ setValue(date.value);
40
+ }
37
41
  };
38
42
 
39
43
  return (
@@ -1,15 +1,13 @@
1
- /* eslint-disable react/no-unused-prop-types */
2
1
  import React from 'react';
3
- import { KeyboardDatePicker } from '@material-ui/pickers';
2
+ import { KeyboardDatePicker, MuiPickersUtilsProvider } from '@material-ui/pickers';
3
+ import DayjsUtils from '@date-io/dayjs';
4
4
  import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
5
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
6
  import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
7
7
  import PropTypes from 'prop-types';
8
8
 
9
-
10
9
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
11
10
 
12
-
13
11
  // Duplicated runtime code from React SDK
14
12
 
15
13
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
@@ -65,30 +63,32 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
65
63
 
66
64
  return (
67
65
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
68
- <KeyboardDatePicker
69
- disableToolbar
70
- variant='inline'
71
- inputVariant='outlined'
72
- placeholder='mm/dd/yyyy'
73
- fullWidth
74
- autoOk
75
- required={required}
76
- disabled={disabled}
77
- format='MM/DD/YYYY'
78
- mask='__/__/____'
79
- error={status === 'error'}
80
- helperText={helperTextToDisplay}
81
- size='small'
82
- label={label}
83
- value={value || null}
84
- onChange={handleChange}
85
- onBlur={onBlur}
86
- onAccept={handleAccept}
87
- {{! pick new delimiteres for mustache }}
88
- {{=<% %>=}}
89
- InputProps={{ ...testProp }}
90
- <%={{ }}=%> {{! revert delimiteres for mustache }}
91
- />
66
+ <MuiPickersUtilsProvider utils={DayjsUtils}>
67
+ <KeyboardDatePicker
68
+ disableToolbar
69
+ variant='inline'
70
+ inputVariant='outlined'
71
+ placeholder='mm/dd/yyyy'
72
+ fullWidth
73
+ autoOk
74
+ required={required}
75
+ disabled={disabled}
76
+ format='MM/DD/YYYY'
77
+ mask='__/__/____'
78
+ error={status === 'error'}
79
+ helperText={helperTextToDisplay}
80
+ size='small'
81
+ label={label}
82
+ value={value || null}
83
+ onChange={handleChange}
84
+ onBlur={onBlur}
85
+ onAccept={handleAccept}
86
+ {{! pick new delimiteres for mustache }}
87
+ {{=<% %>=}}
88
+ InputProps={{ ...testProp }}
89
+ <%={{ }}=%> {{! revert delimiteres for mustache }}
90
+ />
91
+ </MuiPickersUtilsProvider>
92
92
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
93
93
  );
94
94
  }
@@ -0,0 +1,13 @@
1
+ export const configProps = {
2
+ "value": "",
3
+ "label": "Date Sample",
4
+ "helperText": "Date Helper Text",
5
+ "testId": "date-12345678",
6
+ "hasSuggestions": false
7
+ }
8
+
9
+
10
+ export const stateProps = {
11
+ "value": ".DateSample",
12
+ "hasSuggestions": false
13
+ }
@@ -1,5 +1,7 @@
1
1
  import { useState } from 'react';
2
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
2
+ import { withKnobs } from '@storybook/addon-knobs';
3
+
4
+ import { configProps, stateProps } from './mock.stories';
3
5
 
4
6
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
5
7
 
@@ -10,30 +12,31 @@ export default {
10
12
  };
11
13
 
12
14
  export const Base{{COMPONENT_CLASS_NAME}} = () => {
13
- const [value, setValue] = useState('test value');
15
+ const [value, setValue] = useState(configProps.value);
14
16
 
15
17
  const props = {
18
+ value,
19
+ label: configProps.label,
20
+ hideLabel: configProps.hideLabel,
21
+ displayMode: configProps.displayMode,
16
22
  getPConnect: () => {
17
23
  return {
18
24
  getActionsApi: () => {
19
25
  return {
20
26
  updateFieldValue: (propName, theValue) => {
21
27
  setValue(theValue);
22
- }
28
+ },
29
+ triggerFieldChange: () => {/* nothing */}
23
30
  };
24
31
  },
25
32
  getStateProps: () => {
26
- return { value: '.name' };
33
+ return stateProps;
27
34
  }
28
35
  };
29
36
  },
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')
37
+ onChange: dateTime => {
38
+ setValue(dateTime.value);
39
+ }
37
40
  };
38
41
 
39
42
  return (
@@ -1,15 +1,13 @@
1
- /* eslint-disable react/no-unused-prop-types */
2
1
  import React from 'react';
3
- import { KeyboardDateTimePicker } from '@material-ui/pickers';
2
+ import { KeyboardDateTimePicker, MuiPickersUtilsProvider } from '@material-ui/pickers';
3
+ import DayjsUtils from '@date-io/dayjs';
4
4
  import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
5
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
6
  import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
7
7
  import PropTypes from 'prop-types';
8
8
 
9
-
10
9
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
11
10
 
12
-
13
11
  // Duplicated runtime code from React SDK
14
12
 
15
13
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
@@ -59,26 +57,28 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
59
57
 
60
58
  return (
61
59
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
62
- <KeyboardDateTimePicker
63
- variant='inline'
64
- inputVariant='outlined'
65
- fullWidth
66
- autoOk
67
- required={required}
68
- disabled={disabled}
69
- placeholder='mm/dd/yyyy hh:mm am'
70
- format='MM/DD/YYYY hh:mm a'
71
- mask='__/__/____ __:__ _m'
72
- minutesStep={5}
73
- error={status === 'error'}
74
- helperText={helperTextToDisplay}
75
- size='small'
76
- label={label}
77
- value={value || null}
78
- onChange={handleChange}
79
- onAccept={handleAccept}
80
- data-test-id={testId}
81
- />
60
+ <MuiPickersUtilsProvider utils={DayjsUtils}>
61
+ <KeyboardDateTimePicker
62
+ variant='inline'
63
+ inputVariant='outlined'
64
+ fullWidth
65
+ autoOk
66
+ required={required}
67
+ disabled={disabled}
68
+ placeholder='mm/dd/yyyy hh:mm am'
69
+ format='MM/DD/YYYY hh:mm a'
70
+ mask='__/__/____ __:__ _m'
71
+ minutesStep={5}
72
+ error={status === 'error'}
73
+ helperText={helperTextToDisplay}
74
+ size='small'
75
+ label={label}
76
+ value={value || null}
77
+ onChange={handleChange}
78
+ onAccept={handleAccept}
79
+ data-test-id={testId}
80
+ />
81
+ </MuiPickersUtilsProvider>
82
82
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
83
83
  );
84
84
  }
@@ -0,0 +1,12 @@
1
+ export const configProps = {
2
+ "value": "",
3
+ "label": "Date Time Sample",
4
+ "helperText": "Date Time Helper Text",
5
+ "testId": "datetime-12345678",
6
+ "hasSuggestions": false
7
+ };
8
+
9
+ export const stateProps = {
10
+ "value": ".DateTimeSample",
11
+ "hasSuggestions": false
12
+ };
@@ -1,7 +1,6 @@
1
- import { useState } from 'react';
2
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
3
-
4
1
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
2
+ import { withKnobs } from '@storybook/addon-knobs';
3
+ import { configProps } from './mock.stories';
5
4
 
6
5
  export default {
7
6
  title: '{{COMPONENT_CLASS_NAME}}',
@@ -10,30 +9,20 @@ export default {
10
9
  };
11
10
 
12
11
  export const Base{{COMPONENT_CLASS_NAME}} = () => {
13
- const [value, setValue] = useState('test value');
14
12
 
15
13
  const props = {
16
- getPConnect: () => {
17
- return {
18
- getActionsApi: () => {
19
- return {
20
- updateFieldValue: (propName, theValue) => {
21
- setValue(theValue);
22
- }
23
- };
24
- },
25
- getStateProps: () => {
26
- return { value: '.name' };
27
- }
28
- };
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')
14
+ value: configProps.value,
15
+ placeholder: configProps.placeholder,
16
+ label: configProps.label,
17
+ testId: configProps.testId,
18
+ hasSuggestions: configProps.hasSuggestions,
19
+ helperText: configProps.helperText,
20
+ disabled: configProps.disabled,
21
+ required: configProps.required,
22
+ readOnly: configProps.readOnly,
23
+ displayMode: configProps.displayMode,
24
+ onchange: () => { return configProps.value; },
25
+ onBlur: () => { return configProps.value; }
37
26
  };
38
27
 
39
28
  return (
@@ -0,0 +1,13 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export const configProps = {
3
+ value: '',
4
+ label: 'Text Sample',
5
+ placeholder: 'Text Placeholder',
6
+ helperText: 'Text Helper Text',
7
+ testId: 'Text-12345678',
8
+ hasSuggestions: false,
9
+ disabled: false,
10
+ readOnly: false,
11
+ required: false,
12
+ displayMode: ''
13
+ };
@@ -1,7 +1,6 @@
1
- import { useState } from 'react';
2
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
3
-
4
1
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
2
+ import { withKnobs } from '@storybook/addon-knobs';
3
+ import { configProps } from './mock.stories';
5
4
 
6
5
  export default {
7
6
  title: '{{COMPONENT_CLASS_NAME}}',
@@ -10,32 +9,21 @@ export default {
10
9
  };
11
10
 
12
11
  export const Base{{COMPONENT_CLASS_NAME}} = () => {
13
- const [value, setValue] = useState('test value');
14
-
12
+
15
13
  const props = {
16
- getPConnect: () => {
17
- return {
18
- getActionsApi: () => {
19
- return {
20
- updateFieldValue: (propName, theValue) => {
21
- setValue(theValue);
22
- }
23
- };
24
- },
25
- getStateProps: () => {
26
- return { value: '.name' };
27
- }
28
- };
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')
14
+ value: configProps.value,
15
+ placeholder: configProps.placeholder,
16
+ label: configProps.label,
17
+ testId: configProps.testId,
18
+ hasSuggestions: configProps.hasSuggestions,
19
+ helperText: configProps.helperText,
20
+ disabled: configProps.disabled,
21
+ required: configProps.required,
22
+ readOnly: configProps.readOnly,
23
+ displayMode: configProps.displayMode,
24
+ onchange: () => { return configProps.value; },
25
+ onBlur: () => { return configProps.value; }
37
26
  };
38
-
39
27
  return (
40
28
  <>
41
29
  <{{COMPONENT_CLASS_NAME}} {...props} />
@@ -0,0 +1,13 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export const configProps = {
3
+ value: '',
4
+ label: 'Email Sample',
5
+ placeholder: 'Email Placeholder',
6
+ helperText: 'Email Helper Text',
7
+ testId: 'email-12345678',
8
+ hasSuggestions: false,
9
+ readOnly: false,
10
+ required: false,
11
+ disabled: false,
12
+ displayMode: ''
13
+ };
@@ -1,7 +1,6 @@
1
- import { useState } from 'react';
2
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
3
-
4
1
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
2
+ import { withKnobs } from '@storybook/addon-knobs';
3
+ import { configProps, fieldMetadata } from './mock.stories';
5
4
 
6
5
  export default {
7
6
  title: '{{COMPONENT_CLASS_NAME}}',
@@ -10,30 +9,16 @@ export default {
10
9
  };
11
10
 
12
11
  export const Base{{COMPONENT_CLASS_NAME}} = () => {
13
- const [value, setValue] = useState('test value');
14
-
15
12
  const props = {
16
- getPConnect: () => {
17
- return {
18
- getActionsApi: () => {
19
- return {
20
- updateFieldValue: (propName, theValue) => {
21
- setValue(theValue);
22
- }
23
- };
24
- },
25
- getStateProps: () => {
26
- return { value: '.name' };
27
- }
28
- };
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')
13
+ value: configProps.value,
14
+ placeholder: configProps.placeholder,
15
+ label: configProps.label,
16
+ helperText: configProps.helperText,
17
+ testId: configProps.testId,
18
+ hasSuggestions: configProps.hasSuggestions,
19
+ fieldMetadata,
20
+ onchange: () => { return configProps.value; },
21
+ onBlur: () => { return configProps.value; }
37
22
  };
38
23
 
39
24
  return (
@@ -0,0 +1,20 @@
1
+ export const configProps = {
2
+ value: '',
3
+ label: 'TextInput Sample',
4
+ placeholder: 'TextInput Placeholder',
5
+ helperText: 'TextInput Helper Text',
6
+ testId: 'TextInput-12345678',
7
+ hasSuggestions: false,
8
+ required: false,
9
+ disabled: false,
10
+ readOnly: false,
11
+ displayMode: ''
12
+ };
13
+
14
+ export const fieldMetadata = {
15
+ classID: 'DIXL-MediaCo-Work-NewService',
16
+ type: 'Text',
17
+ maxLength: 256,
18
+ displayAs: 'pxTextInput',
19
+ label: 'TextInput Sample'
20
+ };
@@ -1,7 +1,7 @@
1
- import { useState } from 'react';
2
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
3
1
 
4
2
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
3
+ import { configProps, fieldMetadata } from './mock.stories';
4
+ import { withKnobs } from '@storybook/addon-knobs';
5
5
 
6
6
  export default {
7
7
  title: '{{COMPONENT_CLASS_NAME}}',
@@ -10,30 +10,21 @@ export default {
10
10
  };
11
11
 
12
12
  export const Base{{COMPONENT_CLASS_NAME}} = () => {
13
- const [value, setValue] = useState('test value');
14
13
 
15
14
  const props = {
16
- getPConnect: () => {
17
- return {
18
- getActionsApi: () => {
19
- return {
20
- updateFieldValue: (propName, theValue) => {
21
- setValue(theValue);
22
- }
23
- };
24
- },
25
- getStateProps: () => {
26
- return { value: '.name' };
27
- }
28
- };
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')
15
+ value: configProps.value,
16
+ placeholder: configProps.placeholder,
17
+ label: configProps.label,
18
+ testId: configProps.testId,
19
+ hasSuggestions: configProps.hasSuggestions,
20
+ helperText: configProps.helperText,
21
+ disabled: configProps.disabled,
22
+ required: configProps.required,
23
+ readOnly: configProps.readOnly,
24
+ displayMode: configProps.displayMode,
25
+ fieldMetadata,
26
+ onchange: () => { return configProps.value; },
27
+ onBlur: () => { return configProps.value; }
37
28
  };
38
29
 
39
30
  return (
@@ -0,0 +1,20 @@
1
+ export const configProps = {
2
+ value: '',
3
+ label: 'Paragraph Sample',
4
+ placeholder: 'Paragraph Placeholder',
5
+ helperText: 'Paragraph Helper Text',
6
+ testId: 'paragraph-12345678',
7
+ hasSuggestions: false,
8
+ required: false,
9
+ disabled: false,
10
+ readOnly: false,
11
+ displayMode: ''
12
+ };
13
+
14
+ export const fieldMetadata = {
15
+ classID: 'DIXL-MediaCo-Work-NewService',
16
+ type: 'Text',
17
+ displayAs: 'pxTextArea',
18
+ label: 'Paragraph sample',
19
+ maxLength: 256
20
+ };
@@ -1,7 +1,6 @@
1
- import { useState } from 'react';
2
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
3
-
4
1
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
2
+ import { withKnobs } from '@storybook/addon-knobs';
3
+ import { configProps } from './mock.stories';
5
4
 
6
5
  export default {
7
6
  title: '{{COMPONENT_CLASS_NAME}}',
@@ -10,30 +9,20 @@ export default {
10
9
  };
11
10
 
12
11
  export const Base{{COMPONENT_CLASS_NAME}} = () => {
13
- const [value, setValue] = useState('test value');
14
-
12
+
15
13
  const props = {
16
- getPConnect: () => {
17
- return {
18
- getActionsApi: () => {
19
- return {
20
- updateFieldValue: (propName, theValue) => {
21
- setValue(theValue);
22
- }
23
- };
24
- },
25
- getStateProps: () => {
26
- return { value: '.name' };
27
- }
28
- };
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')
14
+ value: configProps.value,
15
+ placeholder: configProps.placeholder,
16
+ label: configProps.label,
17
+ testId: configProps.testId,
18
+ hasSuggestions: configProps.hasSuggestions,
19
+ helperText: configProps.helperText,
20
+ disabled: configProps.disabled,
21
+ required: configProps.required,
22
+ readOnly: configProps.readOnly,
23
+ displayMode: configProps.displayMode,
24
+ onchange: () => { return configProps.value; },
25
+ onBlur: () => { return configProps.value; }
37
26
  };
38
27
 
39
28
  return (
@@ -0,0 +1,31 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export const configProps = {
3
+ value: '',
4
+ label: 'Phone Sample',
5
+ datasource: {
6
+ source: [
7
+ {
8
+ value: '+1'
9
+ },
10
+ {
11
+ value: '+91'
12
+ },
13
+ {
14
+ value: '+48'
15
+ },
16
+ {
17
+ value: '+44'
18
+ }
19
+ ],
20
+ fields: {}
21
+ },
22
+ showCountryCode: true,
23
+ placeholder: 'Phone Placeholder',
24
+ helperText: 'Phone Helper Text',
25
+ testId: 'phone-12345678',
26
+ hasSuggestions: false,
27
+ required: false,
28
+ disabled: false,
29
+ readOnly: false,
30
+ displayMode: ''
31
+ };
@@ -1,7 +1,6 @@
1
- import { useState } from 'react';
2
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
3
-
1
+ import { withKnobs } from '@storybook/addon-knobs';
4
2
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
3
+ import { configProps } from './mock.stories';
5
4
 
6
5
  export default {
7
6
  title: '{{COMPONENT_CLASS_NAME}}',
@@ -10,30 +9,20 @@ export default {
10
9
  };
11
10
 
12
11
  export const Base{{COMPONENT_CLASS_NAME}} = () => {
13
- const [value, setValue] = useState('test value');
14
12
 
15
13
  const props = {
16
- getPConnect: () => {
17
- return {
18
- getActionsApi: () => {
19
- return {
20
- updateFieldValue: (propName, theValue) => {
21
- setValue(theValue);
22
- }
23
- };
24
- },
25
- getStateProps: () => {
26
- return { value: '.name' };
27
- }
28
- };
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')
14
+ value: configProps.value,
15
+ placeholder: configProps.placeholder,
16
+ label: configProps.label,
17
+ testId: configProps.testId,
18
+ hasSuggestions: configProps.hasSuggestions,
19
+ helperText: configProps.helperText,
20
+ disabled: configProps.disabled,
21
+ required: configProps.required,
22
+ readOnly: configProps.readOnly,
23
+ displayMode: configProps.displayMode,
24
+ onchange: () => { return configProps.value; },
25
+ onBlur: ( return configProps.value; ) => {}
37
26
  };
38
27
 
39
28
  return (
@@ -0,0 +1,13 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export const configProps = {
3
+ value: '',
4
+ label: 'URL Sample',
5
+ placeholder: 'URL Placeholder',
6
+ helperText: 'URL Helper Text',
7
+ testId: 'url-12345678',
8
+ hasSuggestions: false,
9
+ required: false,
10
+ disabled: false,
11
+ readOnly: false,
12
+ displayMode: ''
13
+ };
@@ -1,5 +1,7 @@
1
1
  import { useState } from 'react';
2
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
2
+ import { withKnobs } from '@storybook/addon-knobs';
3
+
4
+ import { configProps, stateProps } from './mock.stories';
3
5
 
4
6
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
5
7
 
@@ -10,30 +12,32 @@ export default {
10
12
  };
11
13
 
12
14
  export const Base{{COMPONENT_CLASS_NAME}} = () => {
13
- const [value, setValue] = useState('test value');
15
+ const [value, setValue] = useState(configProps.value);
14
16
 
15
17
  const props = {
18
+ value,
19
+ label: configProps.label,
20
+ hideLabel: configProps.hideLabel,
21
+ displayMode: configProps.displayMode,
22
+
16
23
  getPConnect: () => {
17
24
  return {
18
25
  getActionsApi: () => {
19
26
  return {
20
27
  updateFieldValue: (propName, theValue) => {
21
28
  setValue(theValue);
22
- }
29
+ },
30
+ triggerFieldChange: () => {/* nothing */}
23
31
  };
24
32
  },
25
33
  getStateProps: () => {
26
- return { value: '.name' };
34
+ return stateProps;
27
35
  }
28
36
  };
29
37
  },
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')
38
+ onChange: time => {
39
+ setValue(time.value);
40
+ }
37
41
  };
38
42
 
39
43
  return (
@@ -1,7 +1,7 @@
1
- /* eslint-disable react/no-unused-prop-types */
2
1
  import React from 'react';
3
2
  import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
4
- import { KeyboardTimePicker } from '@material-ui/pickers';
3
+ import { KeyboardTimePicker, MuiPickersUtilsProvider } from '@material-ui/pickers';
4
+ import DayjsUtils from '@date-io/dayjs';
5
5
  import dayjs from 'dayjs';
6
6
  import AccessTimeIcon from '@material-ui/icons/AccessTime';
7
7
  import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtensions/FieldValueList';
@@ -9,7 +9,6 @@ import PropTypes from 'prop-types';
9
9
 
10
10
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
11
11
 
12
-
13
12
  // Duplicated runtime code from React SDK
14
13
 
15
14
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
@@ -58,25 +57,27 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
58
57
 
59
58
  return (
60
59
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
61
- <KeyboardTimePicker
62
- variant='inline'
63
- inputVariant='outlined'
64
- placeholder='hh:mm am'
65
- keyboardIcon={<AccessTimeIcon />}
66
- fullWidth
67
- required={required}
68
- disabled={disabled}
69
- error={status === 'error'}
70
- helperText={helperTextToDisplay}
71
- minutesStep={5}
72
- size='small'
73
- label={label}
74
- autoOk
75
- mask='__:__ _m'
76
- format='hh:mm a'
77
- value={timeValue}
78
- onChange={handleChange}
79
- />
60
+ <MuiPickersUtilsProvider utils={DayjsUtils}>
61
+ <KeyboardTimePicker
62
+ variant='inline'
63
+ inputVariant='outlined'
64
+ placeholder='hh:mm am'
65
+ keyboardIcon={<AccessTimeIcon />}
66
+ fullWidth
67
+ required={required}
68
+ disabled={disabled}
69
+ error={status === 'error'}
70
+ helperText={helperTextToDisplay}
71
+ minutesStep={5}
72
+ size='small'
73
+ label={label}
74
+ autoOk
75
+ mask='__:__ _m'
76
+ format='hh:mm a'
77
+ value={timeValue}
78
+ onChange={handleChange}
79
+ />
80
+ </MuiPickersUtilsProvider>
80
81
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
81
82
  );
82
83
  }
@@ -0,0 +1,12 @@
1
+ export const configProps = {
2
+ "value": "",
3
+ "label": "Time Sample",
4
+ "helperText": "Time Helper Text",
5
+ "testId": "time-12345678",
6
+ "hasSuggestions": false
7
+ };
8
+
9
+ export const stateProps = {
10
+ "value": ".TimeSample",
11
+ "hasSuggestions": false
12
+ };
@@ -0,0 +1,29 @@
1
+ import { withKnobs } from '@storybook/addon-knobs';
2
+
3
+ import {{COMPONENT_CLASS_NAME}} from './index.tsx';
4
+
5
+ import { configProps } from './mock.stories';
6
+
7
+ export default {
8
+ title: '{{COMPONENT_CLASS_NAME}}',
9
+ decorators: [withKnobs],
10
+ component: {{COMPONENT_CLASS_NAME}}
11
+ };
12
+
13
+ export const Base{{COMPONENT_CLASS_NAME}} = () => {
14
+
15
+ const props = {
16
+ label: configProps.label,
17
+ header: configProps.header,
18
+ description: configProps.description,
19
+ image: configProps.image,
20
+ datasource: configProps.datasource,
21
+ whatsnewlink: configProps.whatsnewlink
22
+ };
23
+
24
+ return (
25
+ <>
26
+ <{{COMPONENT_CLASS_NAME}} {...props} />
27
+ </>
28
+ );
29
+ };
@@ -0,0 +1,23 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export const configProps = {
3
+ label: 'App announcement',
4
+ header: 'Announcements',
5
+ description: 'Welcome to MediaCo Application for testing SDK frameworks.',
6
+ whatsnewlink: 'https://design.pega.com',
7
+ image:
8
+ 'data:image/svg xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8 PC9zdmc ',
9
+ datasource: {
10
+ source: [
11
+ {
12
+ name: 'New React based UI rendering'
13
+ },
14
+ {
15
+ name: 'Support for followers and recents'
16
+ },
17
+ {
18
+ name: 'New authoring experience'
19
+ }
20
+ ],
21
+ fields: {}
22
+ }
23
+ };