intelicoreact 1.4.84 → 1.4.85

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.
@@ -68,6 +68,7 @@ const FileLoaderDescription = _ref => {
68
68
  accordionListContent = [],
69
69
  maxFilesCount = 10,
70
70
  isWithoutAccordion,
71
+ error: outerError,
71
72
  ...props
72
73
  } = _ref;
73
74
  const uniqueFileLoaderDescriptionId = "".concat(id || testId || fieldKey || "component-".concat(_utils.uuid === null || _utils.uuid === void 0 ? void 0 : (0, _utils.uuid)()));
@@ -85,9 +86,11 @@ const FileLoaderDescription = _ref => {
85
86
  const handle = {
86
87
  checkOverflow: function (fields) {
87
88
  let error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
89
+ let outerError = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
88
90
  return fields.length < maxFilesCount ? [...fields, {
89
91
  ...(0, _utils.clone)(uploadTriggerStucture),
90
- error
92
+ error,
93
+ outerError
91
94
  }] : fields;
92
95
  },
93
96
  applyFields: newFields => {
@@ -136,6 +139,9 @@ const FileLoaderDescription = _ref => {
136
139
  }
137
140
  }
138
141
  };
142
+ (0, _react.useEffect)(() => {
143
+ setFields(handle.checkOverflow(fields.filter(item => item.id !== UPLOAD_TRIGGER_KEY), null, outerError));
144
+ }, [outerError]);
139
145
  return /*#__PURE__*/_react.default.createElement("div", {
140
146
  id: uniqueFileLoaderDescriptionId,
141
147
  testId: uniqueFileLoaderDescriptionId,
@@ -156,12 +162,9 @@ const FileLoaderDescription = _ref => {
156
162
  return /*#__PURE__*/_react.default.createElement(_FileLoaderLocal.default, {
157
163
  className: "".concat(RC, "__list-item"),
158
164
  key: field.id,
159
- id: "loader-".concat(uniqueFileLoaderDescriptionId, "-field-").concat(field.id)
160
- // key={`${fieldKey ?? Date.now()}/${field.id}`}
161
- // fieldKey={`${fieldKey ?? Date.now()}/${field.id}`}
162
- // id={field.id}
163
- ,
165
+ id: "loader-".concat(uniqueFileLoaderDescriptionId, "-field-").concat(field.id),
164
166
  error: field.error,
167
+ outerError: field.outerError,
165
168
  label: "Upload document",
166
169
  accept: field.accept,
167
170
  value: field.value,
@@ -19,6 +19,7 @@ const FileLoaderLocal = _ref => {
19
19
  fieldKey,
20
20
  label,
21
21
  error,
22
+ outerError,
22
23
  isRequired,
23
24
  accept,
24
25
  onChange,
@@ -90,7 +91,9 @@ const FileLoaderLocal = _ref => {
90
91
  };
91
92
  return /*#__PURE__*/_react.default.createElement("div", {
92
93
  "data-testid": "input--file-loader-local--key-".concat(testId),
93
- className: (0, _classnames.default)("file-loader-local", className)
94
+ className: (0, _classnames.default)("file-loader-local", className, {
95
+ ['file-loader-local_outer-error']: !!outerError
96
+ })
94
97
  }, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
95
98
  onChange: handle.change,
96
99
  className: "file-loader-local__file-input",
@@ -117,7 +120,9 @@ const FileLoaderLocal = _ref => {
117
120
  className: "file-loader-local__label-text"
118
121
  }, value || label), error && /*#__PURE__*/_react.default.createElement("span", {
119
122
  className: "file-loader-local__error"
120
- }, error))), value && !isNoTrashIcon && /*#__PURE__*/_react.default.createElement(_reactFeather.Trash2, {
123
+ }, error), typeof outerError === 'string' && /*#__PURE__*/_react.default.createElement("span", {
124
+ className: "file-loader-local__error"
125
+ }, outerError))), value && !isNoTrashIcon && /*#__PURE__*/_react.default.createElement(_reactFeather.Trash2, {
121
126
  className: "file-loader-local__trash-icon",
122
127
  onClick: () => onChange({
123
128
  id,
@@ -11,6 +11,10 @@
11
11
  background-color: #ffffff;
12
12
  box-shadow: 0px 2px 8px rgb(39 73 113 / 15%);
13
13
 
14
+ &_outer-error {
15
+ border: 1px solid #fa564c;
16
+ }
17
+
14
18
  &__top-label {
15
19
  margin-bottom: 16px;
16
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.4.84",
3
+ "version": "1.4.85",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [