ab-ui-library 1.39.0-alpha.2 → 1.39.0-alpha.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.
@@ -62,6 +62,8 @@ var MultiTextareaWithChips = function MultiTextareaWithChips(_ref) {
62
62
  typeAndEnterPlaceholderText = _ref$typeAndEnterPlac === void 0 ? 'Type and press Enter...' : _ref$typeAndEnterPlac,
63
63
  _ref$noOptionsPlaceho = _ref.noOptionsPlaceholderText,
64
64
  noOptionsPlaceholderText = _ref$noOptionsPlaceho === void 0 ? 'No more options available' : _ref$noOptionsPlaceho,
65
+ _ref$fieldName = _ref.fieldName,
66
+ fieldName = _ref$fieldName === void 0 ? 'skills' : _ref$fieldName,
65
67
  formProps = _ref.formProps;
66
68
  var _useState = useState(''),
67
69
  _useState2 = _slicedToArray(_useState, 2),
@@ -101,9 +103,9 @@ var MultiTextareaWithChips = function MultiTextareaWithChips(_ref) {
101
103
  }, [chips]);
102
104
  useEffect(function () {
103
105
  if (isUserInteraction.current && formProps !== null && formProps !== void 0 && formProps.setFieldValue) {
104
- formProps.setFieldValue('skills', localChips);
106
+ formProps.setFieldValue(fieldName, localChips);
105
107
  }
106
- }, [localChips]);
108
+ }, [localChips, fieldName]);
107
109
  var handleKeyDown = function handleKeyDown(e) {
108
110
  if (disabled) return;
109
111
  if (e.key === 'Enter') {
@@ -171,7 +173,7 @@ var MultiTextareaWithChips = function MultiTextareaWithChips(_ref) {
171
173
  var validChips = newChips.filter(function (chip) {
172
174
  return typeof chip === 'string';
173
175
  });
174
- setValue('skills', validChips);
176
+ setValue(fieldName, validChips);
175
177
  }
176
178
  setChipError('');
177
179
  };
@@ -195,7 +197,7 @@ var MultiTextareaWithChips = function MultiTextareaWithChips(_ref) {
195
197
  var validChips = _newChips.filter(function (chip) {
196
198
  return typeof chip === 'string';
197
199
  });
198
- setValue('skills', validChips);
200
+ setValue(fieldName, validChips);
199
201
  }
200
202
  setInputValue('');
201
203
  setShowDropdown(false);
@@ -214,7 +216,7 @@ var MultiTextareaWithChips = function MultiTextareaWithChips(_ref) {
214
216
  var _validChips = newChips.filter(function (chip) {
215
217
  return typeof chip === 'string';
216
218
  });
217
- setValue('skills', _validChips);
219
+ setValue(fieldName, _validChips);
218
220
  }
219
221
  setInputValue('');
220
222
  setShowDropdown(false);
@@ -239,13 +241,13 @@ var MultiTextareaWithChips = function MultiTextareaWithChips(_ref) {
239
241
  var newChips = [].concat(_toConsumableArray(localChips), [item]);
240
242
  setLocalChips(newChips);
241
243
  if (formProps !== null && formProps !== void 0 && formProps.setFieldValue) {
242
- formProps.setFieldValue('skills', newChips);
244
+ formProps.setFieldValue(fieldName, newChips);
243
245
  }
244
246
  if (setValue) {
245
247
  var validChips = newChips.filter(function (chip) {
246
248
  return !chip.hasError;
247
249
  });
248
- setValue('skills', validChips);
250
+ setValue(fieldName, validChips);
249
251
  }
250
252
  } catch (e) {
251
253
  var message = chipValidationErrorMessage || e.message || 'Invalid value';
@@ -258,13 +260,13 @@ var MultiTextareaWithChips = function MultiTextareaWithChips(_ref) {
258
260
  var _newChips2 = [].concat(_toConsumableArray(localChips), [_item]);
259
261
  setLocalChips(_newChips2);
260
262
  if (formProps !== null && formProps !== void 0 && formProps.setFieldValue) {
261
- formProps === null || formProps === void 0 || formProps.setFieldValue('skills', _newChips2);
263
+ formProps === null || formProps === void 0 || formProps.setFieldValue(fieldName, _newChips2);
262
264
  }
263
265
  if (setValue) {
264
266
  var _validChips2 = _newChips2.filter(function (chip) {
265
267
  return !chip.hasError;
266
268
  });
267
- setValue('skills', _validChips2);
269
+ setValue(fieldName, _validChips2);
268
270
  }
269
271
  } else {
270
272
  setChipError(message);
@@ -275,7 +277,7 @@ var MultiTextareaWithChips = function MultiTextareaWithChips(_ref) {
275
277
  var _newChips3 = [].concat(_toConsumableArray(localChips), [value]);
276
278
  setLocalChips(_newChips3);
277
279
  if (setValue) {
278
- setValue('skills', _newChips3);
280
+ setValue(fieldName, _newChips3);
279
281
  }
280
282
  }
281
283
  setInputValue('');
@@ -27,6 +27,7 @@ export interface TMultiTextareaWithChipsProps extends IFormCompProps {
27
27
  typeAndEnterPlaceholderText?: string;
28
28
  noOptionsPlaceholderText?: string;
29
29
  autoFormIntegration?: boolean;
30
+ fieldName?: string;
30
31
  formProps?: {
31
32
  setFieldValue?: (fieldName: string, value: TFormValue, shouldValidate?: {
32
33
  shouldValidate: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-ui-library",
3
- "version": "1.39.0-alpha.2",
3
+ "version": "1.39.0-alpha.3",
4
4
  "description": "UI library for AM",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",