@pareto-engineering/design-system 4.2.1 → 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 (55) hide show
  1. package/dist/cjs/f/FormInput/FormInput.js +6 -0
  2. package/dist/cjs/f/common/utils/index.js +8 -1
  3. package/dist/cjs/f/common/utils/validators.js +17 -0
  4. package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +3 -2
  5. package/dist/cjs/f/fields/FileUpload/FileUpload.js +228 -0
  6. package/dist/cjs/f/fields/FileUpload/common/FilePreview/FilePreview.js +90 -0
  7. package/dist/cjs/f/fields/FileUpload/common/FilePreview/index.js +13 -0
  8. package/dist/cjs/f/fields/FileUpload/common/FilePreview/styles.scss +92 -0
  9. package/dist/cjs/f/fields/FileUpload/common/index.js +12 -0
  10. package/dist/cjs/f/fields/FileUpload/fileUploadOptions.js +31 -0
  11. package/dist/cjs/f/fields/FileUpload/index.js +20 -0
  12. package/dist/cjs/f/fields/FileUpload/styles.scss +73 -0
  13. package/dist/cjs/f/fields/index.js +14 -1
  14. package/dist/cjs/g/FormBuilder/common/Builder/common/InputBuilder/InputBuilder.js +34 -7
  15. package/dist/cjs/g/FormBuilder/common/Builder/common/InputBuilder/styles.scss +11 -0
  16. package/dist/cjs/g/FormBuilder/common/Renderer/Renderer.js +9 -3
  17. package/dist/cjs/g/FormBuilder/common/Renderer/common/Section/Section.js +2 -2
  18. package/dist/es/f/FormInput/FormInput.js +7 -1
  19. package/dist/es/f/common/utils/index.js +2 -1
  20. package/dist/es/f/common/utils/validators.js +10 -0
  21. package/dist/es/f/fields/ChoicesInput/common/Choice/Choice.js +3 -2
  22. package/dist/es/f/fields/FileUpload/FileUpload.js +218 -0
  23. package/dist/es/f/fields/FileUpload/common/FilePreview/FilePreview.js +80 -0
  24. package/dist/es/f/fields/FileUpload/common/FilePreview/index.js +2 -0
  25. package/dist/es/f/fields/FileUpload/common/FilePreview/styles.scss +92 -0
  26. package/dist/es/f/fields/FileUpload/common/index.js +2 -0
  27. package/dist/es/f/fields/FileUpload/fileUploadOptions.js +25 -0
  28. package/dist/es/f/fields/FileUpload/index.js +3 -0
  29. package/dist/es/f/fields/FileUpload/styles.scss +73 -0
  30. package/dist/es/f/fields/index.js +2 -1
  31. package/dist/es/g/FormBuilder/common/Builder/common/InputBuilder/InputBuilder.js +35 -8
  32. package/dist/es/g/FormBuilder/common/Builder/common/InputBuilder/styles.scss +11 -0
  33. package/dist/es/g/FormBuilder/common/Renderer/Renderer.js +9 -3
  34. package/dist/es/g/FormBuilder/common/Renderer/common/Section/Section.js +2 -1
  35. package/package.json +3 -3
  36. package/src/stories/f/FileUpload.stories.jsx +55 -0
  37. package/src/stories/g/FormBuilder.stories.jsx +19 -97
  38. package/src/ui/f/FormInput/FormInput.jsx +11 -0
  39. package/src/ui/f/common/utils/index.js +1 -0
  40. package/src/ui/f/common/utils/validators.js +10 -0
  41. package/src/ui/f/fields/ChoicesInput/common/Choice/Choice.jsx +2 -0
  42. package/src/ui/f/fields/FileUpload/FileUpload.jsx +277 -0
  43. package/src/ui/f/fields/FileUpload/common/FilePreview/FilePreview.jsx +115 -0
  44. package/src/ui/f/fields/FileUpload/common/FilePreview/index.js +2 -0
  45. package/src/ui/f/fields/FileUpload/common/FilePreview/styles.scss +92 -0
  46. package/src/ui/f/fields/FileUpload/common/index.js +2 -0
  47. package/src/ui/f/fields/FileUpload/fileUploadOptions.js +32 -0
  48. package/src/ui/f/fields/FileUpload/index.js +3 -0
  49. package/src/ui/f/fields/FileUpload/styles.scss +73 -0
  50. package/src/ui/f/fields/index.js +1 -0
  51. package/src/ui/g/FormBuilder/common/Builder/common/InputBuilder/InputBuilder.jsx +53 -11
  52. package/src/ui/g/FormBuilder/common/Builder/common/InputBuilder/styles.scss +11 -0
  53. package/src/ui/g/FormBuilder/common/Renderer/Renderer.jsx +13 -3
  54. package/src/ui/g/FormBuilder/common/Renderer/common/Section/Section.jsx +7 -2
  55. package/tests/__snapshots__/Storyshots.test.js.snap +163 -159
@@ -97,6 +97,12 @@ const FormInput = _ref => {
97
97
  disabled: disabled
98
98
  }, otherProps));
99
99
  }
100
+ if (type === 'file') {
101
+ return /*#__PURE__*/React.createElement(_fields.FileUpload, _extends({
102
+ className: newClassName,
103
+ disabled: disabled
104
+ }, otherProps));
105
+ }
100
106
  if (extraTypes?.[type]) {
101
107
  const Component = extraTypes[type];
102
108
  return /*#__PURE__*/React.createElement(Component, _extends({
@@ -3,10 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "integerAndGreaterThanZero", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _validators.integerAndGreaterThanZero;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "lookUpInputValueFromFetchedOptions", {
7
13
  enumerable: true,
8
14
  get: function () {
9
15
  return _lookUpInputValueFromFetchedOptions.lookUpInputValueFromFetchedOptions;
10
16
  }
11
17
  });
12
- var _lookUpInputValueFromFetchedOptions = require("./lookUpInputValueFromFetchedOptions");
18
+ var _lookUpInputValueFromFetchedOptions = require("./lookUpInputValueFromFetchedOptions");
19
+ var _validators = require("./validators");
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.integerAndGreaterThanZero = void 0;
7
+ const integerAndGreaterThanZero = value => {
8
+ let error = '';
9
+ if (value && value <= 0 || value === 0) {
10
+ error = 'Value must be greator than zero.';
11
+ }
12
+ if (value && value % 1 !== 0) {
13
+ error = 'You must enter a whole number.';
14
+ }
15
+ return error;
16
+ };
17
+ exports.integerAndGreaterThanZero = integerAndGreaterThanZero;
@@ -30,7 +30,8 @@ const Choice = _ref => {
30
30
  value,
31
31
  multiple,
32
32
  validate,
33
- disabled
33
+ disabled,
34
+ ...otherProps
34
35
  } = _ref;
35
36
  const type = multiple ? 'checkbox' : 'radio';
36
37
  const [field] = (0, _formik.useField)({
@@ -46,7 +47,7 @@ const Choice = _ref => {
46
47
  type: type,
47
48
  id: id,
48
49
  name: name
49
- }, field, {
50
+ }, field, otherProps, {
50
51
  value: value,
51
52
  disabled: disabled
52
53
  })), /*#__PURE__*/React.createElement("label", {
@@ -0,0 +1,228 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _formik = require("formik");
10
+ var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
11
+ require("./styles.scss");
12
+ var _common = require("./common");
13
+ var _common2 = require("../../common");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
+ /* @pareto-engineering/generator-front 1.1.1-alpha.2 */
18
+
19
+ // Local Definitions
20
+
21
+ const baseClassName = _exports.default.base;
22
+ const componentClassName = 'file-upload';
23
+
24
+ /**
25
+ * This is the component description.
26
+ */
27
+ const FileUpload = _ref => {
28
+ let {
29
+ id,
30
+ className: userClassName,
31
+ style,
32
+ label,
33
+ description,
34
+ accept,
35
+ multiple,
36
+ name,
37
+ disabled,
38
+ maxCount,
39
+ maxCountError,
40
+ maxSize,
41
+ maxSizeError,
42
+ onChange,
43
+ onDelete,
44
+ // TODO: TBD when connecting with BE
45
+ // onPreview,
46
+ // progress,
47
+ // percent,
48
+ // uploadStatus,
49
+ filePreviewAlignment,
50
+ optional,
51
+ labelColor,
52
+ color
53
+ // ...otherProps
54
+ } = _ref;
55
+ const [field,, helpers] = (0, _formik.useField)({
56
+ name
57
+ });
58
+ const {
59
+ value
60
+ } = field;
61
+ const {
62
+ setError,
63
+ setValue,
64
+ setTouched
65
+ } = helpers;
66
+ const handleChange = event => {
67
+ setTouched(true, false);
68
+ const newFiles = Array.from(event.currentTarget.files);
69
+ const currentFiles = value || [];
70
+ const currentCount = currentFiles.length + newFiles.length;
71
+ if (maxCount && currentCount > maxCount) {
72
+ setError(maxCountError || `Maximum of ${maxCount} files allowed`);
73
+ return;
74
+ }
75
+ const duplicateFiles = newFiles.filter(newFile => currentFiles.some(currentFile => currentFile.name === newFile.name));
76
+ if (duplicateFiles.length > 0) {
77
+ setError('You cannot upload the same file twice.');
78
+ return;
79
+ }
80
+ if (maxSize) {
81
+ const oversizedFiles = newFiles.filter(file => file.size > maxSize);
82
+ if (oversizedFiles.length > 0) {
83
+ setError(maxSizeError || `File size exceeds the limit of ${maxSize} bytes`);
84
+ return;
85
+ }
86
+ }
87
+ const updatedFiles = [...currentFiles, ...newFiles];
88
+ setValue(updatedFiles);
89
+ onChange?.(updatedFiles);
90
+
91
+ // eslint-disable-next-line no-param-reassign
92
+ event.target.value = null;
93
+ };
94
+ const handleDelete = fileIndex => {
95
+ const updatedFiles = value.filter((_, i) => i !== fileIndex);
96
+ setValue(updatedFiles);
97
+ onDelete?.(fileIndex);
98
+ };
99
+ const acceptOptions = Array.isArray(accept) ? accept?.join(',') : accept;
100
+ return /*#__PURE__*/React.createElement("div", {
101
+ id: id,
102
+ className: [baseClassName, componentClassName, userClassName, `preview-${filePreviewAlignment}`, `y-${color}`].filter(e => e).join(' '),
103
+ style: style
104
+ }, /*#__PURE__*/React.createElement("p", null, label), /*#__PURE__*/React.createElement(_common2.FormDescription, {
105
+ className: "s-1",
106
+ description: description,
107
+ name: name
108
+ }), !disabled && /*#__PURE__*/React.createElement(_common2.FormLabel, {
109
+ name: name,
110
+ color: labelColor,
111
+ optional: optional
112
+ }, /*#__PURE__*/React.createElement("input", {
113
+ id: name,
114
+ className: "file",
115
+ type: "file",
116
+ accept: acceptOptions,
117
+ multiple: multiple || maxCount && maxCount > 0,
118
+ disabled: disabled,
119
+ onChange: handleChange
120
+ }), /*#__PURE__*/React.createElement("span", {
121
+ className: "ai-icon"
122
+ }, "U"), /*#__PURE__*/React.createElement("span", null, "Attach file")), value?.length > 0 && /*#__PURE__*/React.createElement("div", {
123
+ className: "attached-files"
124
+ }, /*#__PURE__*/React.createElement("p", null, "Attached files:"), /*#__PURE__*/React.createElement("div", {
125
+ className: "files"
126
+ }, value.map((file, indx) => /*#__PURE__*/React.createElement(_common.FilePreview, {
127
+ file: file,
128
+ key: file.name,
129
+ disabled: disabled,
130
+ handleDelete: () => handleDelete(indx)
131
+ })))));
132
+ };
133
+ FileUpload.propTypes = {
134
+ /**
135
+ * The HTML id for this element
136
+ */
137
+ id: _propTypes.default.string,
138
+ /**
139
+ * The HTML class names for this element
140
+ */
141
+ className: _propTypes.default.string,
142
+ /**
143
+ * The React-written, css properties for this element.
144
+ */
145
+ style: _propTypes.default.objectOf(_propTypes.default.string),
146
+ /**
147
+ * The label text for the file input
148
+ */
149
+ label: _propTypes.default.string,
150
+ /**
151
+ * The description text below the label
152
+ */
153
+ description: _propTypes.default.string,
154
+ /**
155
+ * The color of the text
156
+ */
157
+ color: _propTypes.default.string,
158
+ /**
159
+ * The accepted file types (e.g., 'image/*')
160
+ */
161
+ accept: _propTypes.default.string,
162
+ /**
163
+ * Whether to allow multiple file uploads
164
+ */
165
+ multiple: _propTypes.default.bool,
166
+ /**
167
+ * The name attribute for the input
168
+ */
169
+ name: _propTypes.default.string.isRequired,
170
+ /**
171
+ * Whether the the input should be disabled
172
+ */
173
+ disabled: _propTypes.default.bool,
174
+ /**
175
+ * The maximum number of files allowed
176
+ */
177
+ maxCount: _propTypes.default.number,
178
+ /**
179
+ * The error message when max count is exceeded
180
+ */
181
+ maxCountError: _propTypes.default.string,
182
+ /**
183
+ * The maximum size of files allowed (in bytes)
184
+ */
185
+ maxSize: _propTypes.default.number,
186
+ /**
187
+ * The error message when file size exceeds max size
188
+ */
189
+ maxSizeError: _propTypes.default.string,
190
+ /**
191
+ * The upload progress value (0-100)
192
+ */
193
+ // progress:PropTypes.number,
194
+
195
+ /**
196
+ * The function to handle file change events
197
+ */
198
+ onChange: _propTypes.default.func,
199
+ /**
200
+ * The function to handle file delete events
201
+ */
202
+ onDelete: _propTypes.default.func,
203
+ /**
204
+ * The function to handle file download events
205
+ */
206
+ // onDownload:PropTypes.func,
207
+
208
+ /**
209
+ * The function to handle file preview events
210
+ */
211
+ // onPreview:PropTypes.func,
212
+
213
+ /**
214
+ * The upload status of the file if being sent to an external service (e.g., 'uploading', 'done')
215
+ */
216
+ // uploadStatus:PropTypes.oneOf(['uploading', 'done', 'failed']),
217
+
218
+ /**
219
+ * The alignment for file previews WRT the upload input
220
+ */
221
+ filePreviewAlignment: _propTypes.default.oneOf(['left', 'right', 'top', 'bottom'])
222
+ };
223
+ FileUpload.defaultProps = {
224
+ disabled: false,
225
+ color: 'paragraph',
226
+ filePreviewAlignment: 'bottom'
227
+ };
228
+ var _default = exports.default = FileUpload;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
10
+ require("./styles.scss");
11
+ var _a = require("../../../../../a");
12
+ var _b = require("../../../../../b");
13
+ var _fileUploadOptions = require("../../fileUploadOptions");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
+ /* @pareto-engineering/generator-front 1.1.1-alpha.2 */
18
+
19
+ // Local Definitions
20
+
21
+ const baseClassName = _exports.default.base;
22
+ const componentClassName = 'file-preview';
23
+ const getFileType = file => {
24
+ const mimeType = file.type;
25
+ const extension = file.name.split('.').pop().toLowerCase();
26
+ const fileType = _fileUploadOptions.fileUploadOptions.find(option => option.value.includes(mimeType) || option.value.includes(extension));
27
+ return fileType ? fileType.key : 'unknown';
28
+ };
29
+
30
+ /**
31
+ * This is the component description.
32
+ */
33
+ const FilePreview = _ref => {
34
+ let {
35
+ id,
36
+ className: userClassName,
37
+ style,
38
+ file,
39
+ disabled,
40
+ handleDelete
41
+ // ...otherProps
42
+ } = _ref;
43
+ const type = getFileType(file);
44
+ return /*#__PURE__*/React.createElement("div", {
45
+ id: id,
46
+ className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
47
+ style: style
48
+ }, /*#__PURE__*/React.createElement("div", {
49
+ className: "identity"
50
+ }, /*#__PURE__*/React.createElement("span", {
51
+ className: ['type', type.toLowerCase()].filter(e => e).join(' ')
52
+ }, type), /*#__PURE__*/React.createElement("span", {
53
+ title: file.name,
54
+ className: "name"
55
+ }, file.name), /*#__PURE__*/React.createElement(_b.Button, {
56
+ isCompact: true,
57
+ isSimple: true,
58
+ onClick: handleDelete
59
+ }, /*#__PURE__*/React.createElement("span", {
60
+ className: "icon x-ui-icons c-x"
61
+ }, "Y"))), !disabled && /*#__PURE__*/React.createElement("div", {
62
+ className: "progress-status"
63
+ }, /*#__PURE__*/React.createElement("div", {
64
+ className: "status"
65
+ }, /*#__PURE__*/React.createElement("span", {
66
+ className: "icon"
67
+ }, "I"), /*#__PURE__*/React.createElement("span", null, "Uploaded")), /*#__PURE__*/React.createElement(_a.ProgressBar, {
68
+ color: "green",
69
+ progress: 100,
70
+ height: "3px"
71
+ })));
72
+ };
73
+ FilePreview.propTypes = {
74
+ /**
75
+ * The HTML id for this element
76
+ */
77
+ id: _propTypes.default.string,
78
+ /**
79
+ * The HTML class names for this element
80
+ */
81
+ className: _propTypes.default.string,
82
+ /**
83
+ * The React-written, css properties for this element.
84
+ */
85
+ style: _propTypes.default.objectOf(_propTypes.default.string)
86
+ };
87
+ FilePreview.defaultProps = {
88
+ // someProp:false
89
+ };
90
+ var _default = exports.default = FilePreview;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "FilePreview", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _FilePreview.default;
10
+ }
11
+ });
12
+ var _FilePreview = _interopRequireDefault(require("./FilePreview"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -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,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "FilePreview", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _FilePreview.FilePreview;
10
+ }
11
+ });
12
+ var _FilePreview = require("./FilePreview");
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fileUploadOptions = void 0;
7
+ const fileUploadOptions = exports.fileUploadOptions = [{
8
+ key: 'FILE',
9
+ value: '.doc,.docx,.odt,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text',
10
+ label: 'Documents'
11
+ }, {
12
+ key: 'TXT',
13
+ value: '.xls,.xlsx,.ods,.csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet,text/csv',
14
+ label: 'Spreadsheets'
15
+ }, {
16
+ key: 'PDF',
17
+ value: '.pdf,application/pdf',
18
+ label: 'PDF'
19
+ }, {
20
+ key: 'VID',
21
+ value: '.mp4,.ogg,.webm,video/mp4,video/ogg,video/webm',
22
+ label: 'Videos'
23
+ }, {
24
+ key: 'IMG',
25
+ value: '.png,.jpeg,.jpg,.gif,.webp,image/png,image/jpeg,image/gif,image/webp',
26
+ label: 'Images'
27
+ }, {
28
+ key: 'AUD',
29
+ value: '.mp3,.ogg,.wav,audio/mpeg,audio/ogg,audio/wav',
30
+ label: 'Audio'
31
+ }];
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "FileUpload", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _FileUpload.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "fileUploadOptions", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _fileUploadOptions.fileUploadOptions;
16
+ }
17
+ });
18
+ var _FileUpload = _interopRequireDefault(require("./FileUpload"));
19
+ var _fileUploadOptions = require("./fileUploadOptions");
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -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
+ }
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "EditorInput", {
21
21
  return _EditorInput.EditorInput;
22
22
  }
23
23
  });
24
+ Object.defineProperty(exports, "FileUpload", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _FileUpload.FileUpload;
28
+ }
29
+ });
24
30
  Object.defineProperty(exports, "LinkInput", {
25
31
  enumerable: true,
26
32
  get: function () {
@@ -69,6 +75,12 @@ Object.defineProperty(exports, "TextareaInput", {
69
75
  return _TextareaInput.TextareaInput;
70
76
  }
71
77
  });
78
+ Object.defineProperty(exports, "fileUploadOptions", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _FileUpload.fileUploadOptions;
82
+ }
83
+ });
72
84
  var _TextInput = require("./TextInput");
73
85
  var _SelectInput = require("./SelectInput");
74
86
  var _ChoicesInput = require("./ChoicesInput");
@@ -79,4 +91,5 @@ var _QuerySelect = require("./QuerySelect");
79
91
  var _Checkbox = require("./Checkbox");
80
92
  var _QueryChoices = require("./QueryChoices");
81
93
  var _LinkInput = require("./LinkInput");
82
- var _EditorInput = require("./EditorInput");
94
+ var _EditorInput = require("./EditorInput");
95
+ var _FileUpload = require("./FileUpload");