intelicoreact 1.1.25 → 1.1.26
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.
|
@@ -19,12 +19,16 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
21
|
|
|
22
|
+
var _Alert = _interopRequireDefault(require("../../UI/Alert/Alert"));
|
|
23
|
+
|
|
22
24
|
require("./FileLoaderLocalGroup.scss");
|
|
23
25
|
|
|
24
26
|
var _FileLoaderLocal = _interopRequireDefault(require("../FileLoaderLocal/FileLoaderLocal"));
|
|
25
27
|
|
|
26
28
|
var _utils = require("../../../Functions/utils");
|
|
27
29
|
|
|
30
|
+
var _reactFeather = require("react-feather");
|
|
31
|
+
|
|
28
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
33
|
|
|
30
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -43,7 +47,8 @@ var FileLoaderLocalGroup = function FileLoaderLocalGroup(_ref) {
|
|
|
43
47
|
onChange = _ref.onChange,
|
|
44
48
|
_ref$labelPrefix = _ref.labelPrefix,
|
|
45
49
|
labelPrefix = _ref$labelPrefix === void 0 ? DEFAULT_LABEL_PREFIX : _ref$labelPrefix,
|
|
46
|
-
testId = _ref.testId
|
|
50
|
+
testId = _ref.testId,
|
|
51
|
+
alertText = _ref.alertText;
|
|
47
52
|
|
|
48
53
|
var _useState = (0, _react.useState)((0, _utils.clone)(groupsArray)),
|
|
49
54
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -144,53 +149,51 @@ var FileLoaderLocalGroup = function FileLoaderLocalGroup(_ref) {
|
|
|
144
149
|
}
|
|
145
150
|
};
|
|
146
151
|
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
var uniqueExts = (0, _utils.getUniqueFileExtensions)(group === null || group === void 0 ? void 0 : (_group$accept = group.accept) === null || _group$accept === void 0 ? void 0 : _group$accept.replace(/\./g, ''));
|
|
151
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
152
|
-
className: "file-loader-local__top-label"
|
|
153
|
-
}, labelPrefix, " ", group === null || group === void 0 ? void 0 : group.groupTitleDescription, ' ', /*#__PURE__*/_react.default.createElement("span", {
|
|
154
|
-
className: "file-loader-local__top-label-extension"
|
|
155
|
-
}, "(", uniqueExts, "):"));
|
|
152
|
+
var getUniqueExts = function getUniqueExts(acceptExts) {
|
|
153
|
+
return (0, _utils.getUniqueFileExtensions)(acceptExts === null || acceptExts === void 0 ? void 0 : acceptExts.replace(/\./g, ''));
|
|
156
154
|
};
|
|
157
155
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
var _group$files3;
|
|
161
|
-
|
|
162
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
163
|
-
key: group.groupId,
|
|
164
|
-
className: (0, _classnames.default)('file-loader-local__groups', className)
|
|
165
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
166
|
-
className: "file-loader-local__groups-label"
|
|
167
|
-
}, renderLabel(group)), /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
-
"data-testid": "input--group-file-loader--key-".concat(testId || (group === null || group === void 0 ? void 0 : group.groupId)),
|
|
169
|
-
className: "file-loader-local__groups-item"
|
|
170
|
-
}, group === null || group === void 0 ? void 0 : (_group$files3 = group.files) === null || _group$files3 === void 0 ? void 0 : _group$files3.map(function (file) {
|
|
171
|
-
var _group$files4, _group$files5;
|
|
172
|
-
|
|
173
|
-
return /*#__PURE__*/_react.default.createElement(_FileLoaderLocal.default, {
|
|
174
|
-
groupId: group === null || group === void 0 ? void 0 : group.groupId,
|
|
175
|
-
key: file === null || file === void 0 ? void 0 : file.id,
|
|
176
|
-
id: file === null || file === void 0 ? void 0 : file.id,
|
|
177
|
-
testId: "".concat(group === null || group === void 0 ? void 0 : group.groupId, "-").concat(file === null || file === void 0 ? void 0 : file.id),
|
|
178
|
-
error: file === null || file === void 0 ? void 0 : file.error,
|
|
179
|
-
label: "Upload document",
|
|
180
|
-
accept: file === null || file === void 0 ? void 0 : file.accept,
|
|
181
|
-
value: file === null || file === void 0 ? void 0 : file.value,
|
|
182
|
-
maxItemSizeBytes: file === null || file === void 0 ? void 0 : file.maxItemSizeBytes,
|
|
183
|
-
onChange: function onChange(value) {
|
|
184
|
-
return handle.change(value, file === null || file === void 0 ? void 0 : file.id);
|
|
185
|
-
},
|
|
186
|
-
isRequired: ((_group$files4 = group.files) === null || _group$files4 === void 0 ? void 0 : _group$files4.length) <= 1 || false,
|
|
187
|
-
isNoTrashIcon: ((_group$files5 = group.files) === null || _group$files5 === void 0 ? void 0 : _group$files5.length) <= 1 && !isSingleGroup
|
|
188
|
-
});
|
|
189
|
-
})));
|
|
190
|
-
});
|
|
191
|
-
};
|
|
156
|
+
return groups === null || groups === void 0 ? void 0 : groups.map(function (group) {
|
|
157
|
+
var _group$files3;
|
|
192
158
|
|
|
193
|
-
|
|
159
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
160
|
+
key: group.groupId,
|
|
161
|
+
className: (0, _classnames.default)('file-loader-local-groups', className)
|
|
162
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
163
|
+
className: "file-loader-local-groups__label"
|
|
164
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
165
|
+
className: "file-loader-local-groups__label-text"
|
|
166
|
+
}, labelPrefix, " ", group === null || group === void 0 ? void 0 : group.groupTitleDescription, ' ', /*#__PURE__*/_react.default.createElement("span", {
|
|
167
|
+
className: "file-loader-local-groups__label-extension"
|
|
168
|
+
}, "(", getUniqueExts(group === null || group === void 0 ? void 0 : group.accept), "):"))), (group === null || group === void 0 ? void 0 : group.alertText) && /*#__PURE__*/_react.default.createElement(_Alert.default, {
|
|
169
|
+
className: "file-loader-local-groups__alert",
|
|
170
|
+
noDismiss: true,
|
|
171
|
+
icon: /*#__PURE__*/_react.default.createElement(_reactFeather.Info, null),
|
|
172
|
+
message: group === null || group === void 0 ? void 0 : group.alertText
|
|
173
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
174
|
+
"data-testid": "input--group-file-loader--key-".concat(testId || (group === null || group === void 0 ? void 0 : group.groupId)),
|
|
175
|
+
className: "file-loader-local-groups__item"
|
|
176
|
+
}, group === null || group === void 0 ? void 0 : (_group$files3 = group.files) === null || _group$files3 === void 0 ? void 0 : _group$files3.map(function (file, index) {
|
|
177
|
+
var _group$files4, _group$files5;
|
|
178
|
+
|
|
179
|
+
return /*#__PURE__*/_react.default.createElement(_FileLoaderLocal.default, {
|
|
180
|
+
groupId: group === null || group === void 0 ? void 0 : group.groupId,
|
|
181
|
+
key: (file === null || file === void 0 ? void 0 : file.id) || index,
|
|
182
|
+
id: (file === null || file === void 0 ? void 0 : file.id) || index,
|
|
183
|
+
testId: "".concat(group === null || group === void 0 ? void 0 : group.groupId, "-").concat(file === null || file === void 0 ? void 0 : file.id),
|
|
184
|
+
error: file === null || file === void 0 ? void 0 : file.error,
|
|
185
|
+
label: "Upload document",
|
|
186
|
+
accept: file === null || file === void 0 ? void 0 : file.accept,
|
|
187
|
+
value: file === null || file === void 0 ? void 0 : file.value,
|
|
188
|
+
maxItemSizeBytes: file === null || file === void 0 ? void 0 : file.maxItemSizeBytes,
|
|
189
|
+
onChange: function onChange(value) {
|
|
190
|
+
return handle.change(value, file === null || file === void 0 ? void 0 : file.id);
|
|
191
|
+
},
|
|
192
|
+
isRequired: ((_group$files4 = group.files) === null || _group$files4 === void 0 ? void 0 : _group$files4.length) <= 1 || false,
|
|
193
|
+
isNoTrashIcon: ((_group$files5 = group.files) === null || _group$files5 === void 0 ? void 0 : _group$files5.length) <= 1 && !isSingleGroup
|
|
194
|
+
});
|
|
195
|
+
})));
|
|
196
|
+
});
|
|
194
197
|
};
|
|
195
198
|
|
|
196
199
|
var _default = FileLoaderLocalGroup;
|
|
@@ -2,12 +2,12 @@ $gap-s: 8px;
|
|
|
2
2
|
$gap-m: 16px;
|
|
3
3
|
$gap-l: 24px;
|
|
4
4
|
|
|
5
|
-
.file-loader-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
.file-loader-local-groups {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
row-gap: $gap-m;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
&__item {
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
gap: $gap-s;
|