iguazio.dashboard-react-controls 2.2.4 → 2.2.5

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.
@@ -122,13 +122,14 @@ const FormChipCell = _ref => {
122
122
  });
123
123
  event && event.preventDefault();
124
124
  }, [editConfig.isEdit, editConfig.chipIndex, showHiddenChips, formState.form.mutators, name, delimiter, setShowHiddenChips]);
125
- const handleRemoveChip = (0, _react.useCallback)((event, fields, chipIndex) => {
125
+ const handleRemoveChip = (0, _react.useCallback)(function (event, fields, chipIndex) {
126
+ let isOutsideClick = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
126
127
  checkChipsList(_lodash.default.chain(formState).get(['values', name]).filter((_, index) => index !== chipIndex).value());
127
128
  fields.remove(chipIndex);
128
129
  onExitEditModeCallback && onExitEditModeCallback();
129
- event && event.stopPropagation();
130
+ event && !isOutsideClick && event.stopPropagation();
130
131
  }, [checkChipsList, formState, name, onExitEditModeCallback]);
131
- const handleEditChip = (0, _react.useCallback)((event, fields, nameEvent) => {
132
+ const handleEditChip = (0, _react.useCallback)((event, fields, nameEvent, isOutsideClick) => {
132
133
  const {
133
134
  key,
134
135
  value
@@ -136,7 +137,7 @@ const FormChipCell = _ref => {
136
137
  const isChipNotEmpty = !!(key !== null && key !== void 0 && key.trim() && value !== null && value !== void 0 && value.trim());
137
138
  if (nameEvent === _constants.CLICK) {
138
139
  if (!isChipNotEmpty) {
139
- handleRemoveChip(event, fields, editConfig.chipIndex);
140
+ handleRemoveChip(event, fields, editConfig.chipIndex, isOutsideClick);
140
141
  }
141
142
  setEditConfig({
142
143
  chipIndex: null,
@@ -114,7 +114,7 @@ const FormChipCellView = /*#__PURE__*/_react.default.forwardRef((_ref, _ref2) =>
114
114
  chipIndex: index,
115
115
  chipOptions: chipOptions,
116
116
  editConfig: editConfig,
117
- handleEditChip: (event, nameEvent) => handleEditChip(event, fields, nameEvent),
117
+ handleEditChip: (event, nameEvent, isOutsideClick) => handleEditChip(event, fields, nameEvent, isOutsideClick),
118
118
  handleRemoveChip: (event, index) => handleRemoveChip(event, fields, index),
119
119
  handleToEditMode: handleToEditMode,
120
120
  isEditable: isEditable,
@@ -128,7 +128,7 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
128
128
  var _event$path, _event$composedPath;
129
129
  const elementPath = (_event$path = event.path) !== null && _event$path !== void 0 ? _event$path : (_event$composedPath = event.composedPath) === null || _event$composedPath === void 0 ? void 0 : _event$composedPath.call(event);
130
130
  if (!elementPath.includes(refInputContainer.current)) {
131
- onChange(event, _constants.CLICK);
131
+ onChange(event, _constants.CLICK, true);
132
132
  window.getSelection().removeAllRanges();
133
133
  } else {
134
134
  event.stopPropagation();
@@ -206,7 +206,7 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
206
206
  };
207
207
  });
208
208
  }
209
- }, [maxWidthInput, refInputKey, refInputValue, keyName]);
209
+ }, [keyName, minWidthInput, maxWidthInput, minWidthValueInput]);
210
210
  (0, _react.useLayoutEffect)(() => {
211
211
  if (editConfig.chipIndex === chipIndex) {
212
212
  setSelectedInput(editConfig.isKeyFocused ? 'key' : editConfig.isValueFocused ? 'value' : null);
@@ -55,7 +55,6 @@ const NewChipInput = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
55
55
  "data-testid": "input",
56
56
  ref: ref,
57
57
  type: "text",
58
- id: input.name,
59
58
  ...inputProps,
60
59
  ...input,
61
60
  onChange: handleInputChange,
@@ -59,7 +59,7 @@ const FormTextarea = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
59
59
  } = (0, _reactFinalForm.useField)(name);
60
60
  const [isInvalid, setIsInvalid] = (0, _react.useState)(false);
61
61
  const [textAreaCount, setTextAreaCount] = (0, _react.useState)(input.value.length);
62
- const textAreaRef = /*#__PURE__*/_react.default.createRef();
62
+ const textAreaRef = (0, _react.useRef)();
63
63
  const formFieldClassNames = (0, _classnames.default)('form-field-textarea', className);
64
64
  const labelClassNames = (0, _classnames.default)('form-field__label', disabled && 'form-field__label-disabled');
65
65
  const textAreaClassNames = (0, _classnames.default)('form-field__wrapper', disabled && 'form-field__wrapper-disabled', isInvalid && 'form-field__wrapper-invalid', withoutBorder && 'without-border');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iguazio.dashboard-react-controls",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",