iguazio.dashboard-react-controls 2.2.19 → 2.2.21

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 (47) hide show
  1. package/dist/components/Backdrop/Backdrop.js +1 -1
  2. package/dist/components/Button/Button.js +4 -6
  3. package/dist/components/ConfirmDialog/ConfirmDialog.js +1 -1
  4. package/dist/components/FormCheckBox/FormCheckBox.js +4 -5
  5. package/dist/components/FormChipCell/FormChip/FormChip.js +1 -1
  6. package/dist/components/FormChipCell/FormChip/formChip.scss +6 -0
  7. package/dist/components/FormChipCell/FormChipCell.js +4 -5
  8. package/dist/components/FormChipCell/FormChipCellView.js +16 -11
  9. package/dist/components/FormChipCell/HiddenChipsBlock/HiddenChipsBlock.js +5 -6
  10. package/dist/components/FormChipCell/NewChipForm/NewChipForm.js +11 -18
  11. package/dist/components/FormChipCell/NewChipInput/NewChipInput.js +1 -1
  12. package/dist/components/FormChipCell/formChipCell.util.js +1 -2
  13. package/dist/components/FormCombobox/FormCombobox.js +12 -13
  14. package/dist/components/FormInput/FormInput.js +18 -21
  15. package/dist/components/FormInput/InputNumberButtons/InputNumberButtons.js +1 -1
  16. package/dist/components/FormKeyValueTable/FormKeyValueTable.js +5 -6
  17. package/dist/components/FormOnChange/FormOnChange.js +1 -1
  18. package/dist/components/FormRadio/FormRadio.js +3 -3
  19. package/dist/components/FormSelect/FormSelect.js +11 -12
  20. package/dist/components/FormSelect/FormSelect.test.js +6 -6
  21. package/dist/components/FormTextarea/FormTextarea.js +4 -5
  22. package/dist/components/FormToggle/FormToggle.js +4 -4
  23. package/dist/components/Modal/Modal.js +2 -2
  24. package/dist/components/PopUpDialog/PopUpDialog.js +8 -10
  25. package/dist/components/RoundedIcon/RoundedIcon.js +1 -1
  26. package/dist/components/Tip/Tip.js +6 -6
  27. package/dist/components/Tip/Tip.test.js +3 -3
  28. package/dist/components/Tooltip/Tooltip.js +9 -11
  29. package/dist/components/TooltipTemplate/ProducerTooltipTemplate.js +1 -1
  30. package/dist/components/TooltipTemplate/TextTooltipTemplate.js +1 -1
  31. package/dist/components/Wizard/Wizard.js +5 -5
  32. package/dist/components/Wizard/WizardSteps/WizardSteps.js +1 -1
  33. package/dist/components/index.js +1 -1
  34. package/dist/elements/FormActionButton/FormActionButton.js +2 -2
  35. package/dist/elements/FormRowActions/FormRowActions.js +5 -6
  36. package/dist/elements/OptionsMenu/OptionsMenu.js +2 -2
  37. package/dist/elements/SelectOption/SelectOption.js +4 -5
  38. package/dist/elements/SelectOption/SelectOption.test.js +5 -5
  39. package/dist/elements/ValidationTemplate/ValidationTemplate.js +1 -1
  40. package/dist/elements/index.js +1 -1
  41. package/dist/hooks/useChipCell.hook.js +6 -10
  42. package/dist/hooks/useFormTable.hook.js +25 -40
  43. package/dist/hooks/useHiddenChipsBlock.hook.js +9 -9
  44. package/dist/types.js +1 -1
  45. package/dist/utils/generateChipsList.util.js +1 -1
  46. package/dist/utils/validation.util.js +6 -6
  47. package/package.json +1 -1
@@ -9,7 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _reactTransitionGroup = require("react-transition-group");
10
10
  require("./Backdrop.scss");
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  /*
14
14
  Copyright 2022 Iguazio Systems Ltd.
15
15
  Licensed under the Apache License, Version 2.0 (the "License") with
@@ -13,7 +13,7 @@ var _types = require("../../types");
13
13
  var _constants = require("../../constants");
14
14
  require("./Button.scss");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
17
  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); }
18
18
  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; }
19
19
  /*
@@ -45,21 +45,19 @@ const Button = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
45
45
  variant = _constants.TERTIARY_BUTTON,
46
46
  ...restProps
47
47
  } = _ref;
48
- const buttonClassName = (0, _classnames.default)('btn', "btn-".concat(variant), "btn-".concat(density), className);
48
+ const buttonClassName = (0, _classnames.default)('btn', `btn-${variant}`, `btn-${density}`, className);
49
49
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
50
50
  ...restProps,
51
51
  className: buttonClassName,
52
52
  ref: ref,
53
53
  "data-testid": id,
54
- children: [icon && iconPosition === 'left' && icon, tooltip ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
54
+ children: [icon && iconPosition === 'left' && icon, (tooltip || label) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
55
55
  template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
56
- text: tooltip
56
+ text: tooltip || label
57
57
  }),
58
58
  children: label && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
59
59
  children: label
60
60
  })
61
- }) : label && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
62
- children: label
63
61
  }), icon && iconPosition === 'right' && icon]
64
62
  });
65
63
  });
@@ -12,7 +12,7 @@ var _PopUpDialog = _interopRequireDefault(require("../PopUpDialog/PopUpDialog"))
12
12
  var _types = require("../../types");
13
13
  require("./confirmDialog.scss");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
16
  /*
17
17
  Copyright 2022 Iguazio Systems Ltd.
18
18
  Licensed under the Apache License, Version 2.0 (the "License") with
@@ -10,7 +10,7 @@ var _reactFinalForm = require("react-final-form");
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  require("./formCheckBox.scss");
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
14
  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); }
15
15
  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; }
16
16
  /*
@@ -48,7 +48,6 @@ const FormCheckBox = _ref => {
48
48
  value: inputProps.value,
49
49
  type: "checkbox",
50
50
  children: _ref2 => {
51
- var _inputProps$value, _inputProps$value2;
52
51
  let {
53
52
  input
54
53
  } = _ref2;
@@ -59,13 +58,13 @@ const FormCheckBox = _ref => {
59
58
  ref: inputRef,
60
59
  className: (0, _classnames.default)(input.checked ? 'checked' : 'unchecked'),
61
60
  type: "checkbox",
62
- "data-testid": name ? "".concat(name, "-form-checkbox") : 'form-checkbox',
63
- id: (_inputProps$value = inputProps.value) !== null && _inputProps$value !== void 0 ? _inputProps$value : name,
61
+ "data-testid": name ? `${name}-form-checkbox` : 'form-checkbox',
62
+ id: inputProps.value ?? name,
64
63
  ...input,
65
64
  ...inputProps,
66
65
  value: String(input.checked)
67
66
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
68
- htmlFor: (_inputProps$value2 = inputProps.value) !== null && _inputProps$value2 !== void 0 ? _inputProps$value2 : name,
67
+ htmlFor: inputProps.value ?? name,
69
68
  className: labelClassNames,
70
69
  children: [label ? label : '', children]
71
70
  })]
@@ -10,7 +10,7 @@ var _NewChipForm = _interopRequireDefault(require("../NewChipForm/NewChipForm"))
10
10
  var _types = require("../../../types");
11
11
  require("./formChip.scss");
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
14
  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); }
15
15
  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; }
16
16
  /*
@@ -19,6 +19,12 @@
19
19
  &__content {
20
20
  display: flex;
21
21
  align-items: center;
22
+
23
+ &-item {
24
+ flex: 1 1 50%;
25
+ max-width: fit-content;
26
+ align-self: flex-start;
27
+ }
22
28
  }
23
29
 
24
30
  &__delimiter {
@@ -18,7 +18,7 @@ var _formChipCell = require("./formChipCell.util");
18
18
  var _hooks = require("../../hooks");
19
19
  require("./formChipCell.scss");
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
22
  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); }
23
23
  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; }
24
24
  /*
@@ -100,8 +100,7 @@ const FormChipCell = _ref => {
100
100
  });
101
101
  }, [initialValues, name, formState]);
102
102
  const handleAddNewChip = (0, _react.useCallback)((event, fields) => {
103
- var _fields$value;
104
- const fieldsLength = ((_fields$value = fields.value) === null || _fields$value === void 0 ? void 0 : _fields$value.length) || 0;
103
+ const fieldsLength = fields.value?.length || 0;
105
104
  if (!editConfig.isEdit && !editConfig.chipIndex) {
106
105
  formState.form.mutators.push(name, {
107
106
  id: fieldsLength + new Date(),
@@ -134,7 +133,7 @@ const FormChipCell = _ref => {
134
133
  key,
135
134
  value
136
135
  } = fields.value[editConfig.chipIndex];
137
- const isChipNotEmpty = !!(key !== null && key !== void 0 && key.trim() && value !== null && value !== void 0 && value.trim());
136
+ const isChipNotEmpty = !!(key?.trim() && value?.trim());
138
137
  if (nameEvent === _constants.CLICK) {
139
138
  if (!isChipNotEmpty) {
140
139
  handleRemoveChip(event, fields, editConfig.chipIndex, isOutsideClick);
@@ -287,7 +286,7 @@ const FormChipCell = _ref => {
287
286
  };
288
287
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
289
288
  className: chipsClassName,
290
- "data-testid": "".concat(name, "-chips"),
289
+ "data-testid": `${name}-chips`,
291
290
  children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
292
291
  className: "chips__label",
293
292
  children: label
@@ -18,7 +18,7 @@ var _common = require("../../utils/common.util");
18
18
  var _formChipCell = require("./formChipCell.util");
19
19
  var _add = require("../../images/add.svg");
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
22
  /*
23
23
  Copyright 2022 Iguazio Systems Ltd.
24
24
  Licensed under the Apache License, Version 2.0 (the "License") with
@@ -70,9 +70,9 @@ const FormChipCellView = /*#__PURE__*/_react.default.forwardRef((_ref, _ref2) =>
70
70
  hiddenChipsCounterRef,
71
71
  hiddenChipsPopUpRef
72
72
  } = _ref2;
73
- const buttonAddClassNames = (0, _classnames.default)('button-add', chipOptions.background && "button-add-background_".concat(chipOptions.background), chipOptions.borderColor && "button-add-border_".concat(chipOptions.borderColor), chipOptions.font && "button-add-font_".concat(chipOptions.font), chipOptions.density && "button-add-density_".concat(chipOptions.density));
73
+ const buttonAddClassNames = (0, _classnames.default)('button-add', chipOptions.background && `button-add-background_${chipOptions.background}`, chipOptions.borderColor && `button-add-border_${chipOptions.borderColor}`, chipOptions.font && `button-add-font_${chipOptions.font}`, chipOptions.density && `button-add-density_${chipOptions.density}`);
74
74
  const wrapperClassNames = (0, _classnames.default)('chips-wrapper', isEditable && 'fixed-max-width');
75
- const chipClassNames = (0, _classnames.default)('chip', 'chip__content', isEditable && 'data-ellipsis', shortChips && 'chip_short', chips.hiddenChips && 'chip_hidden', chipOptions.density && "chip-density_".concat(chipOptions.density), chipOptions.borderRadius && "chip-border_".concat(chipOptions.borderRadius), chipOptions.background && "chip-background_".concat(chipOptions.background), chipOptions.borderColor && "chip-border_".concat(chipOptions.borderColor), chipOptions.font && "chip-font_".concat(chipOptions.font), isEditable && 'editable', (showChips || isEditable) && 'chip_visible');
75
+ const chipClassNames = (0, _classnames.default)('chip', 'chip__content', isEditable && 'data-ellipsis', shortChips && 'chip_short', chips.hiddenChips && 'chip_hidden', chipOptions.density && `chip-density_${chipOptions.density}`, chipOptions.borderRadius && `chip-border_${chipOptions.borderRadius}`, chipOptions.background && `chip-background_${chipOptions.background}`, chipOptions.borderColor && `chip-border_${chipOptions.borderColor}`, chipOptions.font && `chip-font_${chipOptions.font}`, isEditable && 'editable', (showChips || isEditable) && 'chip_visible');
76
76
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
77
77
  name: name,
78
78
  validate: validateFields,
@@ -91,20 +91,25 @@ const FormChipCellView = /*#__PURE__*/_react.default.forwardRef((_ref, _ref2) =>
91
91
  className: wrapperClassNames,
92
92
  ref: chipsWrapperRef,
93
93
  children: [fields.map((contentItem, index) => {
94
- var _chips$visibleChips;
95
94
  const chipData = fields.value[index];
96
- return index < ((_chips$visibleChips = chips.visibleChips) === null || _chips$visibleChips === void 0 ? void 0 : _chips$visibleChips.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
95
+ return index < chips.visibleChips?.length && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
97
96
  className: "chip-block",
98
97
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
99
98
  hidden: editConfig.isEdit && !chipData.tooltip,
100
99
  template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
101
100
  text: chipData.tooltip || /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
102
101
  className: "chip__content",
103
- children: [chipData.key, !chipData.isKeyOnly && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
102
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
103
+ className: "chip__content-item",
104
+ children: chipData.key
105
+ }), !chipData.isKeyOnly && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
104
106
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
105
107
  className: "chip__delimiter",
106
108
  children: chipData.delimiter ? chipData.delimiter : ':'
107
- }), chipData.value]
109
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
110
+ className: "chip__content-item",
111
+ children: chipData.value
112
+ })]
108
113
  })]
109
114
  })
110
115
  }),
@@ -117,13 +122,13 @@ const FormChipCellView = /*#__PURE__*/_react.default.forwardRef((_ref, _ref2) =>
117
122
  handleRemoveChip: (event, index) => handleRemoveChip(event, fields, index),
118
123
  handleToEditMode: handleToEditMode,
119
124
  isEditable: isEditable,
120
- keyName: "".concat(contentItem, ".key"),
125
+ keyName: `${contentItem}.key`,
121
126
  meta: meta,
122
127
  ref: chipsCellRef,
123
128
  setChipsSizes: setChipsSizes,
124
129
  setEditConfig: setEditConfig,
125
130
  validationRules: validationRules,
126
- valueName: "".concat(contentItem, ".value")
131
+ valueName: `${contentItem}.value`
127
132
  })
128
133
  }, chipData.id)
129
134
  }, chipData.id);
@@ -141,12 +146,12 @@ const FormChipCellView = /*#__PURE__*/_react.default.forwardRef((_ref, _ref2) =>
141
146
  textOverflowEllipsis: true
142
147
  }), chips.hiddenChipsNumber && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
143
148
  ref: hiddenChipsCounterRef,
144
- className: "".concat(chipClassNames, " chips_button"),
149
+ className: `${chipClassNames} chips_button`,
145
150
  onClick: handleShowElements,
146
151
  children: chips.hiddenChipsNumber
147
152
  })]
148
153
  }), isEditable && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
149
- "data-testid": "".concat(name, "-add-chip"),
154
+ "data-testid": `${name}-add-chip`,
150
155
  className: buttonAddClassNames,
151
156
  onClick: e => handleAddNewChip(e, fields),
152
157
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_add.ReactComponent, {})
@@ -13,7 +13,7 @@ var _TextTooltipTemplate = _interopRequireDefault(require("../../TooltipTemplate
13
13
  var _types = require("../../../types");
14
14
  var _hooks = require("../../../hooks");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
17
  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); }
18
18
  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; }
19
19
  /*
@@ -51,21 +51,20 @@ const HiddenChipsBlock = /*#__PURE__*/_react.default.forwardRef((_ref, _ref2) =>
51
51
  const chipLabelClassNames = (0, _classnames.default)('chip__label', textOverflowEllipsis && 'data-ellipsis');
52
52
  const chipValueClassNames = (0, _classnames.default)('chip__value', textOverflowEllipsis && 'data-ellipsis', chipOptions.boldValue && 'chip-value_bold');
53
53
  const generateChipData = chip => {
54
- return chip.isKeyOnly ? chip.key : "".concat(chip.key).concat(chip.delimiter ? chip.delimiter : ':', " ").concat(chip.value);
54
+ return chip.isKeyOnly ? chip.key : `${chip.key}${chip.delimiter ? chip.delimiter : ':'} ${chip.value}`;
55
55
  };
56
56
  (0, _react.useEffect)(() => {
57
57
  if (chips.length === 0) {
58
58
  handleShowElements();
59
59
  }
60
60
  });
61
- return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
61
+ return /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
62
62
  ref: hiddenChipsPopUpRef,
63
63
  className: hiddenChipsBlockClassNames,
64
64
  onClick: event => event.stopPropagation(),
65
65
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
66
66
  className: "chip-block-hidden__scrollable-container",
67
- children: chips === null || chips === void 0 ? void 0 : chips.map(element => {
68
- var _element$delimiter;
67
+ children: chips?.map(element => {
69
68
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
70
69
  template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
71
70
  text: element.delimiter ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
@@ -86,7 +85,7 @@ const HiddenChipsBlock = /*#__PURE__*/_react.default.forwardRef((_ref, _ref2) =>
86
85
  }), element.value && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
87
86
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
88
87
  className: "chip__delimiter",
89
- children: (_element$delimiter = element.delimiter) !== null && _element$delimiter !== void 0 ? _element$delimiter : ':'
88
+ children: element.delimiter ?? ':'
90
89
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
91
90
  className: chipValueClassNames,
92
91
  children: element.value
@@ -17,7 +17,7 @@ var _formChipCell = require("../formChipCell.util");
17
17
  var _close = require("../../../images/close.svg");
18
18
  require("./newChipForm.scss");
19
19
  var _jsxRuntime = require("react/jsx-runtime");
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
21
  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); }
22
22
  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; }
23
23
  /*
@@ -67,8 +67,7 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
67
67
  const [validationRules, setValidationRules] = (0, _react.useState)(rules);
68
68
  const [showValidationRules, setShowValidationRules] = (0, _react.useState)(false);
69
69
  const maxWidthInput = (0, _react.useMemo)(() => {
70
- var _ref$current;
71
- return ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clientWidth) - 50;
70
+ return ref.current?.clientWidth - 50;
72
71
  }, [ref]);
73
72
  const {
74
73
  background,
@@ -87,7 +86,7 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
87
86
  const refInputValue = _react.default.useRef({});
88
87
  const refInputContainer = _react.default.useRef();
89
88
  const labelKeyClassName = (0, _classnames.default)(className, !editConfig.isKeyFocused && 'item_edited', !(0, _lodash.isEmpty)((0, _lodash.get)(meta, ['error', chipIndex, 'key'], [])) && !(0, _lodash.isEmpty)(chipData.key) && !chip.disabled && 'item_edited_invalid');
90
- const labelContainerClassName = (0, _classnames.default)('edit-chip-container', background && "edit-chip-container-background_".concat(background), borderColor && "edit-chip-container-border_".concat(borderColor), font && "edit-chip-container-font_".concat(font), density && "edit-chip-container-density_".concat(density), borderRadius && "edit-chip-container-border_".concat(borderRadius), (editConfig.isEdit || editConfig.isNewChip) && 'edit-chip-container_edited', chip.disabled && 'edit-chip-container_disabled edit-chip-container-font_disabled');
89
+ const labelContainerClassName = (0, _classnames.default)('edit-chip-container', background && `edit-chip-container-background_${background}`, borderColor && `edit-chip-container-border_${borderColor}`, font && `edit-chip-container-font_${font}`, density && `edit-chip-container-density_${density}`, borderRadius && `edit-chip-container-border_${borderRadius}`, (editConfig.isEdit || editConfig.isNewChip) && 'edit-chip-container_edited', chip.disabled && 'edit-chip-container_disabled edit-chip-container-font_disabled');
91
90
  const labelValueClassName = (0, _classnames.default)('input-label-value', !editConfig.isValueFocused && 'item_edited', !(0, _lodash.isEmpty)((0, _lodash.get)(meta, ['error', chipIndex, 'value'], [])) && !(0, _lodash.isEmpty)(chipData.value) && 'item_edited_invalid');
92
91
  const closeButtonClass = (0, _classnames.default)('item-icon-close', !chip.disabled && editConfig.chipIndex === chipIndex && isEditable && 'item-icon-close_invisible', !isEditable && 'item-icon-close_hidden');
93
92
  (0, _react.useLayoutEffect)(() => {
@@ -125,8 +124,7 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
125
124
  }, [editConfig.isKeyFocused, editConfig.isValueFocused, refInputKey, refInputValue, chipIndex, editConfig.chipIndex]);
126
125
  const outsideClick = (0, _react.useCallback)(event => {
127
126
  if (editConfig.chipIndex === chipIndex) {
128
- var _event$path, _event$composedPath;
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);
127
+ const elementPath = event.path ?? event.composedPath?.();
130
128
  if (!elementPath.includes(refInputContainer.current)) {
131
129
  onChange(event, _constants.CLICK, true);
132
130
  window.getSelection().removeAllRanges();
@@ -197,14 +195,11 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
197
195
  }));
198
196
  } else {
199
197
  const currentWidthValueInput = (0, _formChipCell.getTextWidth)(refInputValue.current);
200
- setChipData(prevState => {
201
- var _refInputValue$curren;
202
- return {
203
- ...prevState,
204
- value: refInputValue.current.value,
205
- valueFieldWidth: ((_refInputValue$curren = refInputValue.current.value) === null || _refInputValue$curren === void 0 ? void 0 : _refInputValue$curren.length) <= 1 ? minWidthValueInput : currentWidthValueInput >= maxWidthInput ? maxWidthInput : currentWidthValueInput > minWidthValueInput ? currentWidthValueInput + 2 : minWidthValueInput
206
- };
207
- });
198
+ setChipData(prevState => ({
199
+ ...prevState,
200
+ value: refInputValue.current.value,
201
+ valueFieldWidth: refInputValue.current.value?.length <= 1 ? minWidthValueInput : currentWidthValueInput >= maxWidthInput ? maxWidthInput : currentWidthValueInput > minWidthValueInput ? currentWidthValueInput + 2 : minWidthValueInput
202
+ }));
208
203
  }
209
204
  }, [keyName, minWidthInput, maxWidthInput, minWidthValueInput]);
210
205
  (0, _react.useLayoutEffect)(() => {
@@ -220,10 +215,9 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
220
215
  (0, _react.useEffect)(() => {
221
216
  if (meta.error) {
222
217
  setValidationRules(prevState => {
223
- var _prevState$selectedIn;
224
218
  return {
225
219
  ...prevState,
226
- [selectedInput]: (_prevState$selectedIn = prevState[selectedInput]) === null || _prevState$selectedIn === void 0 ? void 0 : _prevState$selectedIn.map(rule => {
220
+ [selectedInput]: prevState[selectedInput]?.map(rule => {
227
221
  return {
228
222
  ...rule,
229
223
  isValid: (0, _lodash.isEmpty)((0, _lodash.get)(meta, ['error', editConfig.chipIndex, selectedInput], [])) ? true : !meta.error[editConfig.chipIndex][selectedInput].some(err => err && err.name === rule.name)
@@ -235,8 +229,7 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
235
229
  }
236
230
  }, [meta, showValidationRules, selectedInput, editConfig.chipIndex]);
237
231
  const getValidationRules = (0, _react.useCallback)(() => {
238
- var _validationRules$sele;
239
- return (_validationRules$sele = validationRules[selectedInput]) === null || _validationRules$sele === void 0 ? void 0 : _validationRules$sele.map(_ref2 => {
232
+ return validationRules[selectedInput]?.map(_ref2 => {
240
233
  let {
241
234
  isValid = false,
242
235
  label,
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _reactFinalForm = require("react-final-form");
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  /*
13
13
  Copyright 2022 Iguazio Systems Ltd.
14
14
  Licensed under the Apache License, Version 2.0 (the "License") with
@@ -25,7 +25,6 @@ const uniquenessError = exports.uniquenessError = {
25
25
  label: 'Key must be unique'
26
26
  };
27
27
  const getTextWidth = elementWithText => {
28
- var _hiddenElement$offset;
29
28
  if (!elementWithText) {
30
29
  return 0;
31
30
  }
@@ -48,6 +47,6 @@ const getTextWidth = elementWithText => {
48
47
  document.body.append(hiddenElement);
49
48
  }
50
49
  hiddenElement.textContent = elementWithText.value;
51
- return (_hiddenElement$offset = hiddenElement.offsetWidth) !== null && _hiddenElement$offset !== void 0 ? _hiddenElement$offset : 0;
50
+ return hiddenElement.offsetWidth ?? 0;
52
51
  };
53
52
  exports.getTextWidth = getTextWidth;
@@ -22,7 +22,7 @@ var _warning = require("../../images/warning.svg");
22
22
  var _exclamationMark = require("../../images/exclamation-mark.svg");
23
23
  require("./formCombobox.scss");
24
24
  var _jsxRuntime = require("react/jsx-runtime");
25
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
26
26
  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); }
27
27
  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; }
28
28
  /*
@@ -157,13 +157,13 @@ const FormCombobox = _ref => {
157
157
  const handleInputChange = event => {
158
158
  const target = event.target;
159
159
  setDropdownStyle({
160
- left: "".concat(target.selectionStart < 30 ? target.selectionStart : 30, "ch")
160
+ left: `${target.selectionStart < 30 ? target.selectionStart : 30}ch`
161
161
  });
162
162
  if (searchIsFocused) {
163
163
  setSearchIsFocused(false);
164
164
  }
165
165
  setInputValue(target.value);
166
- input.onChange("".concat(selectValue.id).concat(target.value));
166
+ input.onChange(`${selectValue.id}${target.value}`);
167
167
  onChange && onChange(selectValue.id, target.value);
168
168
  if (dropdownList.length > 0) {
169
169
  setShowSuggestionList(true);
@@ -183,7 +183,7 @@ const FormCombobox = _ref => {
183
183
  const handleSuggestionListOptionClick = option => {
184
184
  const inputValueItems = inputValue.split('/');
185
185
  const valueIndex = inputValueItems.length - 1;
186
- let formattedValue = option.customDelimiter ? inputValueItems[valueIndex].replace(new RegExp("".concat(option.customDelimiter, ".*")), '') + option.id : option.id;
186
+ let formattedValue = option.customDelimiter ? inputValueItems[valueIndex].replace(new RegExp(`${option.customDelimiter}.*`), '') + option.id : option.id;
187
187
  if (inputValueItems.length <= maxSuggestedMatches - 1) formattedValue += '/';
188
188
  inputValueItems[valueIndex] = formattedValue;
189
189
  if (searchIsFocused) {
@@ -191,13 +191,13 @@ const FormCombobox = _ref => {
191
191
  }
192
192
  if (inputValueItems.join('/') !== inputValue) {
193
193
  setInputValue(inputValueItems.join('/'));
194
- input.onChange("".concat(selectValue.id).concat(inputValueItems.join('/')));
194
+ input.onChange(`${selectValue.id}${inputValueItems.join('/')}`);
195
195
  onChange && onChange(selectValue.id, inputValueItems.join('/'));
196
196
  }
197
197
  setShowSuggestionList(false);
198
198
  inputRef.current.focus();
199
199
  setDropdownStyle({
200
- left: "".concat(inputRef.current.selectionStart < 30 ? inputRef.current.selectionStart : 30, "ch")
200
+ left: `${inputRef.current.selectionStart < 30 ? inputRef.current.selectionStart : 30}ch`
201
201
  });
202
202
  };
203
203
  const inputOnFocus = () => {
@@ -233,7 +233,7 @@ const FormCombobox = _ref => {
233
233
  const validateField = function () {
234
234
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
235
235
  let allValues = arguments.length > 1 ? arguments[1] : undefined;
236
- const valueToValidate = value.startsWith(selectValue.id) ? value.substring(selectValue.id.length) : value !== null && value !== void 0 ? value : '';
236
+ const valueToValidate = value.startsWith(selectValue.id) ? value.substring(selectValue.id.length) : value ?? '';
237
237
  let validationError = null;
238
238
  if (!(0, _lodash.isEmpty)(validationRules)) {
239
239
  const [newRules, isValidField] = (0, _validation.checkPatternsValidity)(rules, valueToValidate);
@@ -270,12 +270,11 @@ const FormCombobox = _ref => {
270
270
  const comboboxClassNames = (0, _classnames.default)(comboboxClassName, 'form-field-combobox', 'form-field', isInvalid && 'form-field-combobox_invalid');
271
271
  const iconClassNames = (0, _classnames.default)(showSelectDropdown && 'form-field-combobox__icon_open', 'form-field-combobox__icon');
272
272
  const selectValueClassNames = (0, _classnames.default)(selectValue.className);
273
- const wrapperClassNames = (0, _classnames.default)('form-field__wrapper', "form-field__wrapper-".concat(density), disabled && 'form-field__wrapper-disabled', isInvalid && 'form-field__wrapper-invalid', withoutBorder && 'without-border');
273
+ const wrapperClassNames = (0, _classnames.default)('form-field__wrapper', `form-field__wrapper-${density}`, disabled && 'form-field__wrapper-disabled', isInvalid && 'form-field__wrapper-invalid', withoutBorder && 'without-border');
274
274
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
275
275
  name: name,
276
276
  validate: validateField,
277
277
  children: _ref3 => {
278
- var _meta$error$label, _meta$error;
279
278
  let {
280
279
  input,
281
280
  meta
@@ -283,7 +282,7 @@ const FormCombobox = _ref => {
283
282
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
284
283
  className: comboboxClassNames,
285
284
  ref: comboboxRef,
286
- "data-testid": name ? "".concat(name, "-form-combobox") : 'form-combobox',
285
+ "data-testid": name ? `${name}-form-combobox` : 'form-combobox',
287
286
  children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
288
287
  className: labelClassNames,
289
288
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
@@ -340,7 +339,7 @@ const FormCombobox = _ref => {
340
339
  })]
341
340
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
342
341
  className: inputClassNames,
343
- "data-testid": name ? "".concat(name, "-form-combobox-input") : 'form-combobox-input',
342
+ "data-testid": name ? `${name}-form-combobox-input` : 'form-combobox-input',
344
343
  id: input.name,
345
344
  onChange: handleInputChange,
346
345
  onFocus: inputOnFocus,
@@ -364,7 +363,7 @@ const FormCombobox = _ref => {
364
363
  children: [!hideSearchInput && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
365
364
  className: "form-field-combobox__search-wrapper",
366
365
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
367
- "data-testid": name ? "".concat(name, "-form-combobox-search") : 'form-combobox-search',
366
+ "data-testid": name ? `${name}-form-combobox-search` : 'form-combobox-search',
368
367
  className: "form-field-combobox__search form-field__control",
369
368
  onChange: suggestionListSearchChange,
370
369
  onFocus: () => setSearchIsFocused(true),
@@ -388,7 +387,7 @@ const FormCombobox = _ref => {
388
387
  children: [isInvalid && !Array.isArray(meta.error) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
389
388
  className: "form-field__warning",
390
389
  template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
391
- text: (_meta$error$label = (_meta$error = meta.error) === null || _meta$error === void 0 ? void 0 : _meta$error.label) !== null && _meta$error$label !== void 0 ? _meta$error$label : invalidText,
390
+ text: meta.error?.label ?? invalidText,
392
391
  warning: true
393
392
  }),
394
393
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_exclamationMark.ReactComponent, {})