@pareto-engineering/design-system 4.2.1-alpha.0 → 4.2.3

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 (73) hide show
  1. package/dist/cjs/a/XMLEditor/XMLEditor.js +3 -15
  2. package/dist/cjs/f/FormInput/FormInput.js +6 -0
  3. package/dist/cjs/f/common/utils/index.js +8 -1
  4. package/dist/cjs/f/common/utils/validators.js +17 -0
  5. package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +3 -2
  6. package/dist/cjs/f/fields/EditorInput/EditorInput.js +2 -15
  7. package/dist/cjs/f/fields/EditorInput/common/StopPropagationPlugin.js +2 -7
  8. package/dist/cjs/f/fields/FileUpload/FileUpload.js +228 -0
  9. package/dist/cjs/f/fields/FileUpload/common/FilePreview/FilePreview.js +90 -0
  10. package/dist/cjs/f/fields/FileUpload/common/FilePreview/index.js +13 -0
  11. package/dist/cjs/f/fields/FileUpload/common/FilePreview/styles.scss +92 -0
  12. package/dist/cjs/f/fields/FileUpload/common/index.js +12 -0
  13. package/dist/cjs/f/fields/FileUpload/fileUploadOptions.js +31 -0
  14. package/dist/cjs/f/fields/FileUpload/index.js +20 -0
  15. package/dist/cjs/f/fields/FileUpload/styles.scss +73 -0
  16. package/dist/cjs/f/fields/SelectInput/common/Menu/Menu.js +1 -1
  17. package/dist/cjs/f/fields/SelectInput/common/Multiple/Multiple.js +1 -1
  18. package/dist/cjs/f/fields/SelectInput/styles.scss +1 -1
  19. package/dist/cjs/f/fields/index.js +14 -1
  20. package/dist/cjs/g/FormBuilder/common/Builder/common/InputBuilder/InputBuilder.js +34 -7
  21. package/dist/cjs/g/FormBuilder/common/Builder/common/InputBuilder/styles.scss +11 -0
  22. package/dist/cjs/g/FormBuilder/common/Renderer/Renderer.js +9 -3
  23. package/dist/cjs/g/FormBuilder/common/Renderer/common/Section/Section.js +2 -2
  24. package/dist/es/a/XMLEditor/XMLEditor.js +3 -15
  25. package/dist/es/f/FormInput/FormInput.js +7 -1
  26. package/dist/es/f/common/utils/index.js +2 -1
  27. package/dist/es/f/common/utils/validators.js +10 -0
  28. package/dist/es/f/fields/ChoicesInput/common/Choice/Choice.js +3 -2
  29. package/dist/es/f/fields/EditorInput/EditorInput.js +2 -15
  30. package/dist/es/f/fields/EditorInput/common/StopPropagationPlugin.js +2 -6
  31. package/dist/es/f/fields/FileUpload/FileUpload.js +218 -0
  32. package/dist/es/f/fields/FileUpload/common/FilePreview/FilePreview.js +80 -0
  33. package/dist/es/f/fields/FileUpload/common/FilePreview/index.js +2 -0
  34. package/dist/es/f/fields/FileUpload/common/FilePreview/styles.scss +92 -0
  35. package/dist/es/f/fields/FileUpload/common/index.js +2 -0
  36. package/dist/es/f/fields/FileUpload/fileUploadOptions.js +25 -0
  37. package/dist/es/f/fields/FileUpload/index.js +3 -0
  38. package/dist/es/f/fields/FileUpload/styles.scss +73 -0
  39. package/dist/es/f/fields/SelectInput/common/Menu/Menu.js +1 -1
  40. package/dist/es/f/fields/SelectInput/common/Multiple/Multiple.js +1 -1
  41. package/dist/es/f/fields/SelectInput/styles.scss +1 -1
  42. package/dist/es/f/fields/index.js +2 -1
  43. package/dist/es/g/FormBuilder/common/Builder/common/InputBuilder/InputBuilder.js +35 -8
  44. package/dist/es/g/FormBuilder/common/Builder/common/InputBuilder/styles.scss +11 -0
  45. package/dist/es/g/FormBuilder/common/Renderer/Renderer.js +9 -3
  46. package/dist/es/g/FormBuilder/common/Renderer/common/Section/Section.js +2 -1
  47. package/package.json +4 -4
  48. package/src/stories/f/FileUpload.stories.jsx +55 -0
  49. package/src/stories/g/FormBuilder.stories.jsx +19 -97
  50. package/src/ui/a/XMLEditor/XMLEditor.jsx +1 -15
  51. package/src/ui/f/FormInput/FormInput.jsx +11 -0
  52. package/src/ui/f/common/utils/index.js +1 -0
  53. package/src/ui/f/common/utils/validators.js +10 -0
  54. package/src/ui/f/fields/ChoicesInput/common/Choice/Choice.jsx +2 -0
  55. package/src/ui/f/fields/EditorInput/EditorInput.jsx +1 -15
  56. package/src/ui/f/fields/EditorInput/common/StopPropagationPlugin.jsx +2 -6
  57. package/src/ui/f/fields/FileUpload/FileUpload.jsx +277 -0
  58. package/src/ui/f/fields/FileUpload/common/FilePreview/FilePreview.jsx +115 -0
  59. package/src/ui/f/fields/FileUpload/common/FilePreview/index.js +2 -0
  60. package/src/ui/f/fields/FileUpload/common/FilePreview/styles.scss +92 -0
  61. package/src/ui/f/fields/FileUpload/common/index.js +2 -0
  62. package/src/ui/f/fields/FileUpload/fileUploadOptions.js +32 -0
  63. package/src/ui/f/fields/FileUpload/index.js +3 -0
  64. package/src/ui/f/fields/FileUpload/styles.scss +73 -0
  65. package/src/ui/f/fields/SelectInput/common/Menu/Menu.jsx +1 -0
  66. package/src/ui/f/fields/SelectInput/common/Multiple/Multiple.jsx +1 -1
  67. package/src/ui/f/fields/SelectInput/styles.scss +1 -1
  68. package/src/ui/f/fields/index.js +1 -0
  69. package/src/ui/g/FormBuilder/common/Builder/common/InputBuilder/InputBuilder.jsx +53 -11
  70. package/src/ui/g/FormBuilder/common/Builder/common/InputBuilder/styles.scss +11 -0
  71. package/src/ui/g/FormBuilder/common/Renderer/Renderer.jsx +13 -3
  72. package/src/ui/g/FormBuilder/common/Renderer/common/Section/Section.jsx +7 -2
  73. package/tests/__snapshots__/Storyshots.test.js.snap +163 -159
@@ -0,0 +1,80 @@
1
+ /* @pareto-engineering/generator-front 1.1.1-alpha.2 */
2
+ import * as React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import styleNames from '@pareto-engineering/bem/exports';
5
+
6
+ // Local Definitions
7
+
8
+ import "./styles.scss";
9
+ import { ProgressBar } from "../../../../../a";
10
+ import { Button } from "../../../../../b";
11
+ import { fileUploadOptions } from "../../fileUploadOptions";
12
+ const baseClassName = styleNames.base;
13
+ const componentClassName = 'file-preview';
14
+ const getFileType = file => {
15
+ const mimeType = file.type;
16
+ const extension = file.name.split('.').pop().toLowerCase();
17
+ const fileType = fileUploadOptions.find(option => option.value.includes(mimeType) || option.value.includes(extension));
18
+ return fileType ? fileType.key : 'unknown';
19
+ };
20
+
21
+ /**
22
+ * This is the component description.
23
+ */
24
+ const FilePreview = ({
25
+ id,
26
+ className: userClassName,
27
+ style,
28
+ file,
29
+ disabled,
30
+ handleDelete
31
+ // ...otherProps
32
+ }) => {
33
+ const type = getFileType(file);
34
+ return /*#__PURE__*/React.createElement("div", {
35
+ id: id,
36
+ className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
37
+ style: style
38
+ }, /*#__PURE__*/React.createElement("div", {
39
+ className: "identity"
40
+ }, /*#__PURE__*/React.createElement("span", {
41
+ className: ['type', type.toLowerCase()].filter(e => e).join(' ')
42
+ }, type), /*#__PURE__*/React.createElement("span", {
43
+ title: file.name,
44
+ className: "name"
45
+ }, file.name), /*#__PURE__*/React.createElement(Button, {
46
+ isCompact: true,
47
+ isSimple: true,
48
+ onClick: handleDelete
49
+ }, /*#__PURE__*/React.createElement("span", {
50
+ className: "icon x-ui-icons c-x"
51
+ }, "Y"))), !disabled && /*#__PURE__*/React.createElement("div", {
52
+ className: "progress-status"
53
+ }, /*#__PURE__*/React.createElement("div", {
54
+ className: "status"
55
+ }, /*#__PURE__*/React.createElement("span", {
56
+ className: "icon"
57
+ }, "I"), /*#__PURE__*/React.createElement("span", null, "Uploaded")), /*#__PURE__*/React.createElement(ProgressBar, {
58
+ color: "green",
59
+ progress: 100,
60
+ height: "3px"
61
+ })));
62
+ };
63
+ FilePreview.propTypes = {
64
+ /**
65
+ * The HTML id for this element
66
+ */
67
+ id: PropTypes.string,
68
+ /**
69
+ * The HTML class names for this element
70
+ */
71
+ className: PropTypes.string,
72
+ /**
73
+ * The React-written, css properties for this element.
74
+ */
75
+ style: PropTypes.objectOf(PropTypes.string)
76
+ };
77
+ FilePreview.defaultProps = {
78
+ // someProp:false
79
+ };
80
+ export default FilePreview;
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.1.1-alpha.2 */
2
+ export { default as FilePreview } from "./FilePreview";
@@ -0,0 +1,92 @@
1
+ /* @pareto-engineering/generator-front 1.1.1-alpha.2 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+
5
+ $default-padding: 1rem;
6
+ $files-per-row: 3;
7
+ $total-gaps: $files-per-row - 1;
8
+ $combined-gap: calc(var(--gap) * $total-gaps);
9
+ $width-without-gaps: calc(100% - $combined-gap);
10
+ $default-file-width: calc($width-without-gaps / $files-per-row);
11
+
12
+ .#{bem.$base}.file-preview {
13
+ border: var(--theme-default-border-style) var(--ui-lines);
14
+ border-radius: calc(var(--theme-default-border-radius) / 2);
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: calc(var(--gap) / 4);
18
+ padding: $default-padding;
19
+ width: $default-file-width;
20
+
21
+ > .identity {
22
+ align-items: center;
23
+ display: flex;
24
+ gap: calc(var(--gap) / 2);
25
+
26
+ > .type {
27
+ padding-block: calc($default-padding / 4);
28
+ padding-inline: calc($default-padding / 2);
29
+
30
+ // TODO: update the colors to use variables. These are colors from the new DS
31
+ &.pdf {
32
+ background-color: #fdead7;
33
+ color: #b93814;
34
+ }
35
+
36
+ &.file {
37
+ background-color: #eef2f6;
38
+ color: #364151;
39
+ }
40
+
41
+ &.txt {
42
+ background-color: #d1dfff;
43
+ color: #004eeb;
44
+ }
45
+
46
+
47
+ &.vid {
48
+ background-color: #ebe9fe;
49
+ color: #5a25dc;
50
+ }
51
+
52
+ &.img {
53
+ background-color: #cbfbef;
54
+ color: #107569;
55
+ }
56
+
57
+ &.aud {
58
+ background-color: #fef7c3;
59
+ color: #a15c08;
60
+ }
61
+ }
62
+
63
+ > .name {
64
+ overflow: hidden;
65
+ text-overflow: ellipsis;
66
+ white-space: nowrap;
67
+ }
68
+
69
+ > .#{bem.$base}.button {
70
+ cursor: pointer;
71
+ margin-left: auto;
72
+ }
73
+ }
74
+
75
+ > .progress-status {
76
+ > .status {
77
+ align-items: center;
78
+ // TODO handle as a prop
79
+ color: var(--green);
80
+ display: flex;
81
+ gap: calc(var(--gap) / 2);
82
+
83
+ > .icon {
84
+ background-color: var(--green);
85
+ border-radius: 50%;
86
+ color: var(--on-green);
87
+ font-size: calc(var(--s-2) * 1rem);
88
+ padding: calc($default-padding / 4);
89
+ }
90
+ }
91
+ }
92
+ }
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.1.1-alpha.2 */
2
+ export { FilePreview } from "./FilePreview";
@@ -0,0 +1,25 @@
1
+ export const fileUploadOptions = [{
2
+ key: 'FILE',
3
+ value: '.doc,.docx,.odt,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text',
4
+ label: 'Documents'
5
+ }, {
6
+ key: 'TXT',
7
+ value: '.xls,.xlsx,.ods,.csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet,text/csv',
8
+ label: 'Spreadsheets'
9
+ }, {
10
+ key: 'PDF',
11
+ value: '.pdf,application/pdf',
12
+ label: 'PDF'
13
+ }, {
14
+ key: 'VID',
15
+ value: '.mp4,.ogg,.webm,video/mp4,video/ogg,video/webm',
16
+ label: 'Videos'
17
+ }, {
18
+ key: 'IMG',
19
+ value: '.png,.jpeg,.jpg,.gif,.webp,image/png,image/jpeg,image/gif,image/webp',
20
+ label: 'Images'
21
+ }, {
22
+ key: 'AUD',
23
+ value: '.mp3,.ogg,.wav,audio/mpeg,audio/ogg,audio/wav',
24
+ label: 'Audio'
25
+ }];
@@ -0,0 +1,3 @@
1
+ /* @pareto-engineering/generator-front 1.1.1-alpha.2 */
2
+ export { default as FileUpload } from "./FileUpload";
3
+ export { fileUploadOptions } from "./fileUploadOptions";
@@ -0,0 +1,73 @@
1
+ /* @pareto-engineering/generator-front 1.1.1-alpha.2 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+
5
+ $default-padding: 1rem;
6
+ $default-margin: 1rem;
7
+
8
+ .#{bem.$base}.file-upload {
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: var(--gap);
12
+
13
+
14
+ > p {
15
+ color: var(--y);
16
+ margin: 0;
17
+ }
18
+
19
+ > .#{bem.$base}.description {
20
+ height: auto;
21
+ }
22
+
23
+ > .#{bem.$base}.form-label {
24
+ align-items: center;
25
+ border: var(--theme-default-border-style) var(--ui-lines);
26
+ border-radius: calc(var(--theme-default-border-radius) / 2);
27
+ color: var(--heading);
28
+ cursor: pointer;
29
+ display: flex;
30
+ gap: calc(var(--gap) / 2);
31
+ padding: $default-padding;
32
+ width: fit-content;
33
+
34
+ &:has(>input:disabled) {
35
+ --icon-color: var(--hard-disabled);
36
+ color: var(--hard-disabled);
37
+ cursor: not-allowed;
38
+ }
39
+
40
+ &:has(>input:not(:disabled)) {
41
+ &:hover,
42
+ &:active {
43
+ border: var(--theme-hover-input-border);
44
+ }
45
+ }
46
+
47
+ > .ai-icon {
48
+ color: var(--icon-color, var(--interactive));
49
+ font-size: calc(var(--s2) * 1rem);
50
+ }
51
+
52
+ > input[type="file"] {
53
+ display: none;
54
+ }
55
+ }
56
+
57
+ > .attached-files {
58
+ display: flex;
59
+ gap: var(--gap);
60
+
61
+ > p {
62
+ margin: 0;
63
+ }
64
+
65
+ > .files {
66
+ align-items: center;
67
+ display: flex;
68
+ flex-wrap: wrap;
69
+ gap: var(--gap);
70
+ width: 100%;
71
+ }
72
+ }
73
+ }
@@ -32,7 +32,7 @@ const Menu = /*#__PURE__*/React.forwardRef(({
32
32
  item,
33
33
  index
34
34
  }), {
35
- className: ['item', highlightedIndex === index && styleNames.modifierActive].filter(Boolean).join(' ')
35
+ className: ['item', item.disabled && styleNames.modifierDisabled, highlightedIndex === index && styleNames.modifierActive].filter(Boolean).join(' ')
36
36
  }), /*#__PURE__*/React.createElement("p", null, item.label)))));
37
37
  Menu.propTypes = {
38
38
  /**
@@ -127,7 +127,7 @@ const Multiple = ({
127
127
  case useCombobox.stateChangeTypes.InputKeyDownEnter:
128
128
  case useCombobox.stateChangeTypes.ItemClick:
129
129
  case useCombobox.stateChangeTypes.InputBlur:
130
- if (selectedItem) {
130
+ if (selectedItem && !selectedItem?.disabled) {
131
131
  setSearchInputValue('');
132
132
  addSelectedItem(selectedItem);
133
133
  }
@@ -122,7 +122,7 @@ $default-gap: var(--gap);
122
122
  margin: 0;
123
123
  }
124
124
 
125
- &.#{bem.$modifier-active} {
125
+ &.#{bem.$modifier-active}:not(.disabled) {
126
126
  background-color: var(--y);
127
127
 
128
128
  > p {
@@ -8,4 +8,5 @@ export { QuerySelect } from "./QuerySelect";
8
8
  export { Checkbox } from "./Checkbox";
9
9
  export { QueryChoices } from "./QueryChoices";
10
10
  export { LinkInput } from "./LinkInput";
11
- export { EditorInput } from "./EditorInput";
11
+ export { EditorInput } from "./EditorInput";
12
+ export { FileUpload, fileUploadOptions } from "./FileUpload";
@@ -4,7 +4,7 @@ import { useState } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { FieldArray, useFormikContext } from 'formik';
6
6
  import styleNames from '@pareto-engineering/bem/exports';
7
- import { SelectInput, TextInput } from "../../../../../../f";
7
+ import { ChoicesInput, SelectInput, TextInput, integerAndGreaterThanZero, fileUploadOptions } from "../../../../../../f";
8
8
  import { ToggleSwitch } from "../../../../../../a";
9
9
  import "./styles.scss";
10
10
 
@@ -13,6 +13,9 @@ import "./styles.scss";
13
13
  import { ActionsContainer } from "../ActionsContainer";
14
14
  const baseClassName = styleNames.base;
15
15
  const componentClassName = 'input-builder';
16
+ const getToggleSwitchStyles = condition => condition ? {
17
+ '--slider-background-color': 'var(--disabled)'
18
+ } : {};
16
19
 
17
20
  /**
18
21
  * This is the component description.
@@ -35,11 +38,6 @@ const InputBuilder = ({
35
38
  const handleToggleRequired = () => {
36
39
  setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.required`, !input?.required);
37
40
  };
38
- const toggleSwitchStyles = {
39
- ...(!input?.required ? {
40
- '--slider-background-color': 'var(--disabled)'
41
- } : {})
42
- };
43
41
  const [hasDescription, setHasDescription] = useState(false);
44
42
 
45
43
  // TODO: handle nav logic
@@ -59,6 +57,10 @@ const InputBuilder = ({
59
57
  } = e.target;
60
58
  setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.options.${optionIndex}.label`, value);
61
59
  };
60
+ const isFile = input?.type === 'file';
61
+ const handleToggleShowSpecificFileTypes = () => {
62
+ setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.showSpecificFileTypes`, !input.showSpecificFileTypes);
63
+ };
62
64
  return /*#__PURE__*/React.createElement("div", {
63
65
  id: id,
64
66
  className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
@@ -92,6 +94,9 @@ const InputBuilder = ({
92
94
  }, {
93
95
  value: 'choices',
94
96
  label: 'Radio buttons'
97
+ }, {
98
+ value: 'file',
99
+ label: 'File upload'
95
100
  }]
96
101
  }), /*#__PURE__*/React.createElement("div", {
97
102
  className: "controls"
@@ -107,7 +112,7 @@ const InputBuilder = ({
107
112
  }, "Required"), /*#__PURE__*/React.createElement(ToggleSwitch, {
108
113
  handleOnChange: handleToggleRequired,
109
114
  checked: input?.required,
110
- style: toggleSwitchStyles,
115
+ style: getToggleSwitchStyles(!input?.required),
111
116
  inputId: `sections_${sectionIndex}_inputs.${inputIndex}_toggle`
112
117
  })), /*#__PURE__*/React.createElement(ActionsContainer, null, /*#__PURE__*/React.createElement("p", null, "Show"), /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", {
113
118
  className: `option ${hasDescription ? 'with-check-mark' : ''}`
@@ -168,7 +173,29 @@ const InputBuilder = ({
168
173
  className: "icon"
169
174
  }, "+")), /*#__PURE__*/React.createElement("span", {
170
175
  className: "text x-paragraph c-x"
171
- }, "Add Option"))))));
176
+ }, "Add Option")))), isFile && /*#__PURE__*/React.createElement("div", {
177
+ className: "input-file-options"
178
+ }, /*#__PURE__*/React.createElement(TextInput, {
179
+ label: "Maximum number of files",
180
+ name: `sections.${sectionIndex}.inputs.${inputIndex}.maxCount`,
181
+ placeholder: "1",
182
+ type: "number",
183
+ min: "0",
184
+ validate: integerAndGreaterThanZero
185
+ }), /*#__PURE__*/React.createElement("div", {
186
+ className: "specific-file-types"
187
+ }, /*#__PURE__*/React.createElement(ToggleSwitch, {
188
+ handleOnChange: handleToggleShowSpecificFileTypes,
189
+ checked: input?.showSpecificFileTypes,
190
+ style: getToggleSwitchStyles(!input?.showSpecificFileTypes),
191
+ inputId: `sections_${sectionIndex}_inputs.${inputIndex}_show_specific_file_types`
192
+ }), /*#__PURE__*/React.createElement("span", {
193
+ className: "s0"
194
+ }, "Allow only specific file types")), input?.showSpecificFileTypes && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ChoicesInput, {
195
+ name: `sections.${sectionIndex}.inputs.${inputIndex}.accept`,
196
+ options: fileUploadOptions,
197
+ multiple: true
198
+ })))));
172
199
  };
173
200
  InputBuilder.propTypes = {
174
201
  /**
@@ -137,6 +137,17 @@ $default-list-width: var(--action-button-width, 18rem);
137
137
  }
138
138
  }
139
139
  }
140
+
141
+ > .input-file-options {
142
+ display: flex;
143
+ flex-direction: column;
144
+ gap: var(--gap);
145
+ margin-bottom: $default-margin;
146
+
147
+ > .specific-file-types {
148
+ display: flex;
149
+ }
150
+ }
140
151
  }
141
152
  }
142
153
 
@@ -17,9 +17,14 @@ const reconstructFormDataWithValues = (formData, values) => {
17
17
  const newData = {
18
18
  ...formData
19
19
  };
20
- Object.keys(values).forEach(key => {
20
+ Object.keys(values).forEach(async key => {
21
21
  const [sectionIdx, inputIdx] = key.match(/\d+/g).map(Number);
22
- newData.sections[sectionIdx].inputs[inputIdx].value = values[key];
22
+ if (key.includes('files')) {
23
+ const files = values[key].map(file => URL.createObjectURL(file));
24
+ newData.sections[sectionIdx].inputs[inputIdx].files = files;
25
+ } else {
26
+ newData.sections[sectionIdx].inputs[inputIdx].value = values[key];
27
+ }
23
28
  });
24
29
  return newData;
25
30
  };
@@ -118,7 +123,8 @@ const Renderer = ({
118
123
  return /*#__PURE__*/React.createElement(Form, null, updatedFormData.sections.map((section, sectionIndex) => sectionIndex === currentSectionIndex && /*#__PURE__*/React.createElement(Section, _extends({
119
124
  key: `${section.title}`
120
125
  }, section, {
121
- readOnly: readOnly
126
+ readOnly: readOnly,
127
+ setUpdatedFormData: setUpdatedFormData
122
128
  }))), /*#__PURE__*/React.createElement("div", {
123
129
  className: "navigator-container"
124
130
  }, /*#__PURE__*/React.createElement(Button, {
@@ -1,4 +1,5 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ /* eslint-disable no-alert */
2
3
  /* @pareto-engineering/generator-front 1.1.1-alpha.2 */
3
4
  import * as React from 'react';
4
5
  import PropTypes from 'prop-types';
@@ -32,7 +33,7 @@ const Section = ({
32
33
  }, title), /*#__PURE__*/React.createElement(ExpandableLexicalPreview, {
33
34
  nodes: description,
34
35
  name: "instructions"
35
- }), inputs.map(input => /*#__PURE__*/React.createElement(FormInput, _extends({
36
+ }), inputs?.map(input => /*#__PURE__*/React.createElement(FormInput, _extends({
36
37
  key: input.name
37
38
  }, input, {
38
39
  disabled: readOnly
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "4.2.1-alpha.0",
3
+ "version": "4.2.3",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -59,8 +59,8 @@
59
59
  "@lexical/selection": "0.12.2",
60
60
  "@lexical/table": "0.12.2",
61
61
  "@lexical/utils": "0.12.2",
62
- "@pareto-engineering/assets": "^4.2.1-alpha.0",
63
- "@pareto-engineering/bem": "^4.0.0",
62
+ "@pareto-engineering/assets": "^4.2.3",
63
+ "@pareto-engineering/bem": "^4.2.1",
64
64
  "@pareto-engineering/styles": "^4.2.0",
65
65
  "@pareto-engineering/utils": "^4.0.0",
66
66
  "codemirror": "^6.0.1",
@@ -82,5 +82,5 @@
82
82
  "relay-test-utils": "^15.0.0"
83
83
  },
84
84
  "browserslist": "> 2%",
85
- "gitHead": "959e968b733eab6cfef5dca5f8239084afbe2652"
85
+ "gitHead": "77c5790a1e998600f0f61931a8fcbd2177f53efc"
86
86
  }
@@ -0,0 +1,55 @@
1
+ /* @pareto-engineering/generator-front 1.1.1-alpha.2 */
2
+ import * as React from 'react'
3
+
4
+ import { Formik, Form } from 'formik'
5
+
6
+ import { FileUpload } from 'ui'
7
+
8
+ export default {
9
+ title :'f/fields/FileUpload',
10
+ component :FileUpload,
11
+ subcomponents:{
12
+ // Item:FileUpload.Item
13
+ },
14
+ decorators:[
15
+ (storyfn) => (
16
+ <Formik
17
+ initialValues={{ files: [] }}
18
+ >
19
+ <Form>
20
+ { storyfn() }
21
+ </Form>
22
+ </Formik>
23
+ ),
24
+ ],
25
+ argTypes:{
26
+ backgroundColor:{ control: 'color' },
27
+ },
28
+ }
29
+
30
+ export const Base = {
31
+ args:{
32
+ name :'section_0_input_0',
33
+ label :'The file upload ',
34
+ type :'file',
35
+ description:'',
36
+ accept :[
37
+ '.mp4,.ogg,.webm,video/mp4,video/ogg,video/webm',
38
+ '.pdf,application/pdf',
39
+ ],
40
+ },
41
+ }
42
+
43
+ export const Multiple = {
44
+ args:{
45
+ ...Base.args,
46
+ multiple:true,
47
+ },
48
+ }
49
+
50
+ export const WithLimitedCount = {
51
+ args:{
52
+ ...Base.args,
53
+ maxCount:2,
54
+ },
55
+ }