iguazio.dashboard-react-controls 1.9.2 → 2.0.0

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 (56) hide show
  1. package/dist/components/Backdrop/Backdrop.js +7 -7
  2. package/dist/components/Button/Button.js +20 -26
  3. package/dist/components/ConfirmDialog/ConfirmDialog.js +18 -17
  4. package/dist/components/FormCheckBox/FormCheckBox.js +28 -32
  5. package/dist/components/FormChipCell/FormChip/FormChip.js +46 -50
  6. package/dist/components/FormChipCell/FormChipCell.js +122 -142
  7. package/dist/components/FormChipCell/FormChipCellView.js +44 -47
  8. package/dist/components/FormChipCell/HiddenChipsBlock/HiddenChipsBlock.js +23 -20
  9. package/dist/components/FormChipCell/NewChipForm/NewChipForm.js +129 -152
  10. package/dist/components/FormChipCell/NewChipInput/NewChipInput.js +24 -27
  11. package/dist/components/FormChipCell/formChipCell.util.js +6 -16
  12. package/dist/components/FormCombobox/FormCombobox.js +134 -195
  13. package/dist/components/FormInput/FormInput.js +134 -212
  14. package/dist/components/FormInput/InputNumberButtons/InputNumberButtons.js +15 -14
  15. package/dist/components/FormKeyValueTable/FormKeyValueTable.js +72 -72
  16. package/dist/components/FormRadio/FormRadio.js +21 -25
  17. package/dist/components/FormSelect/FormSelect.js +98 -126
  18. package/dist/components/FormSelect/FormSelect.test.js +56 -60
  19. package/dist/components/FormTextarea/FormTextarea.js +55 -71
  20. package/dist/components/FormToggle/FormToggle.js +25 -29
  21. package/dist/components/Modal/Modal.js +17 -18
  22. package/dist/components/PopUpDialog/PopUpDialog.js +53 -63
  23. package/dist/components/RoundedIcon/RoundedIcon.js +14 -13
  24. package/dist/components/Tip/Tip.js +58 -64
  25. package/dist/components/Tip/Tip.test.js +41 -64
  26. package/dist/components/Tooltip/Tooltip.js +75 -89
  27. package/dist/components/TooltipTemplate/ProducerTooltipTemplate.js +6 -5
  28. package/dist/components/TooltipTemplate/TextTooltipTemplate.js +10 -10
  29. package/dist/components/Wizard/Wizard.js +73 -107
  30. package/dist/components/Wizard/WizardSteps/WizardSteps.js +19 -20
  31. package/dist/components/index.js +18 -18
  32. package/dist/constants.js +26 -44
  33. package/dist/elements/FormActionButton/FormActionButton.js +12 -13
  34. package/dist/elements/FormRowActions/FormRowActions.js +19 -22
  35. package/dist/elements/OptionsMenu/OptionsMenu.js +10 -8
  36. package/dist/elements/SelectOption/SelectOption.js +14 -13
  37. package/dist/elements/SelectOption/SelectOption.test.js +39 -47
  38. package/dist/elements/ValidationTemplate/ValidationTemplate.js +7 -6
  39. package/dist/elements/index.js +5 -5
  40. package/dist/hooks/index.js +5 -5
  41. package/dist/hooks/useChipCell.hook.js +66 -85
  42. package/dist/hooks/useDebounce.hook.js +22 -24
  43. package/dist/hooks/useDetectOutsideClick.hook.js +4 -4
  44. package/dist/hooks/useFormTable.hook.js +99 -112
  45. package/dist/hooks/useHiddenChipsBlock.hook.js +40 -55
  46. package/dist/index.js +2 -3
  47. package/dist/scss/borders.scss +6 -0
  48. package/dist/scss/mixins.scss +32 -0
  49. package/dist/types.js +43 -67
  50. package/dist/utils/common.util.js +19 -23
  51. package/dist/utils/form.util.js +33 -39
  52. package/dist/utils/generateChipsList.util.js +7 -7
  53. package/dist/utils/getFirstScrollableParent.util.js +4 -10
  54. package/dist/utils/math.util.js +3 -3
  55. package/dist/utils/validation.util.js +74 -131
  56. package/package.json +34 -34
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -24,132 +23,89 @@ var _exclamationMark = require("../../images/exclamation-mark.svg");
24
23
  require("./formCombobox.scss");
25
24
  var _jsxRuntime = require("react/jsx-runtime");
26
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
- 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); }
28
- 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; }
29
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
30
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
31
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
32
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
33
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
34
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
35
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
36
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
37
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
38
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
39
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
40
- Copyright 2022 Iguazio Systems Ltd.
41
- Licensed under the Apache License, Version 2.0 (the "License") with
42
- an addition restriction as set forth herein. You may not use this
43
- file except in compliance with the License. You may obtain a copy of
44
- the License at http://www.apache.org/licenses/LICENSE-2.0.
45
- Unless required by applicable law or agreed to in writing, software
46
- distributed under the License is distributed on an "AS IS" BASIS,
47
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
48
- implied. See the License for the specific language governing
49
- permissions and limitations under the License.
50
- In addition, you may not use the software for any purposes that are
51
- illegal under applicable law, and the grant of the foregoing license
52
- under the Apache 2.0 license is conditioned upon your compliance with
53
- such restriction.
54
- */
55
- var FormCombobox = function FormCombobox(_ref) {
56
- var comboboxClassName = _ref.comboboxClassName,
57
- density = _ref.density,
58
- disabled = _ref.disabled,
59
- hideSearchInput = _ref.hideSearchInput,
60
- inputDefaultValue = _ref.inputDefaultValue,
61
- inputPlaceholder = _ref.inputPlaceholder,
62
- invalidText = _ref.invalidText,
63
- label = _ref.label,
64
- maxSuggestedMatches = _ref.maxSuggestedMatches,
65
- name = _ref.name,
66
- onBlur = _ref.onBlur,
67
- onChange = _ref.onChange,
68
- onFocus = _ref.onFocus,
69
- required = _ref.required,
70
- rules = _ref.rules,
71
- selectDefaultValue = _ref.selectDefaultValue,
72
- selectOptions = _ref.selectOptions,
73
- selectPlaceholder = _ref.selectPlaceholder,
74
- suggestionList = _ref.suggestionList,
75
- validator = _ref.validator,
76
- withoutBorder = _ref.withoutBorder;
77
- var _useField = (0, _reactFinalForm.useField)(name),
78
- input = _useField.input,
79
- meta = _useField.meta;
80
- var _useState = (0, _react.useState)(inputDefaultValue),
81
- _useState2 = _slicedToArray(_useState, 2),
82
- inputValue = _useState2[0],
83
- setInputValue = _useState2[1];
84
- var _useState3 = (0, _react.useState)(selectDefaultValue),
85
- _useState4 = _slicedToArray(_useState3, 2),
86
- selectValue = _useState4[0],
87
- setSelectValue = _useState4[1];
88
- var _useState5 = (0, _react.useState)({
89
- left: '0px'
90
- }),
91
- _useState6 = _slicedToArray(_useState5, 2),
92
- dropdownStyle = _useState6[0],
93
- setDropdownStyle = _useState6[1];
94
- var _useState7 = (0, _react.useState)(false),
95
- _useState8 = _slicedToArray(_useState7, 2),
96
- showSelectDropdown = _useState8[0],
97
- setShowSelectDropdown = _useState8[1];
98
- var _useState9 = (0, _react.useState)(false),
99
- _useState10 = _slicedToArray(_useState9, 2),
100
- showSuggestionList = _useState10[0],
101
- setShowSuggestionList = _useState10[1];
102
- var _useState11 = (0, _react.useState)(suggestionList),
103
- _useState12 = _slicedToArray(_useState11, 2),
104
- dropdownList = _useState12[0],
105
- setDropdownList = _useState12[1];
106
- var _useState13 = (0, _react.useState)(false),
107
- _useState14 = _slicedToArray(_useState13, 2),
108
- searchIsFocused = _useState14[0],
109
- setSearchIsFocused = _useState14[1];
110
- var _useState15 = (0, _react.useState)(false),
111
- _useState16 = _slicedToArray(_useState15, 2),
112
- isInvalid = _useState16[0],
113
- setIsInvalid = _useState16[1];
114
- var _useState17 = (0, _react.useState)(rules),
115
- _useState18 = _slicedToArray(_useState17, 2),
116
- validationRules = _useState18[0],
117
- setValidationRules = _useState18[1];
118
- var _useState19 = (0, _react.useState)(false),
119
- _useState20 = _slicedToArray(_useState19, 2),
120
- showValidationRules = _useState20[0],
121
- setShowValidationRules = _useState20[1];
122
- var comboboxRef = (0, _react.useRef)();
123
- var selectRef = (0, _react.useRef)();
124
- var inputRef = (0, _react.useRef)();
125
- var suggestionListRef = (0, _react.useRef)();
126
- (0, _hooks.useDetectOutsideClick)(comboboxRef, function () {
127
- return setShowValidationRules(false);
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
+ 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
+ /*
29
+ Copyright 2022 Iguazio Systems Ltd.
30
+ Licensed under the Apache License, Version 2.0 (the "License") with
31
+ an addition restriction as set forth herein. You may not use this
32
+ file except in compliance with the License. You may obtain a copy of
33
+ the License at http://www.apache.org/licenses/LICENSE-2.0.
34
+ Unless required by applicable law or agreed to in writing, software
35
+ distributed under the License is distributed on an "AS IS" BASIS,
36
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
37
+ implied. See the License for the specific language governing
38
+ permissions and limitations under the License.
39
+ In addition, you may not use the software for any purposes that are
40
+ illegal under applicable law, and the grant of the foregoing license
41
+ under the Apache 2.0 license is conditioned upon your compliance with
42
+ such restriction.
43
+ */
44
+
45
+ const FormCombobox = _ref => {
46
+ let {
47
+ comboboxClassName,
48
+ density,
49
+ disabled,
50
+ hideSearchInput,
51
+ inputDefaultValue,
52
+ inputPlaceholder,
53
+ invalidText,
54
+ label,
55
+ maxSuggestedMatches,
56
+ name,
57
+ onBlur,
58
+ onChange,
59
+ onFocus,
60
+ required,
61
+ rules,
62
+ selectDefaultValue,
63
+ selectOptions,
64
+ selectPlaceholder,
65
+ suggestionList,
66
+ validator,
67
+ withoutBorder
68
+ } = _ref;
69
+ const {
70
+ input,
71
+ meta
72
+ } = (0, _reactFinalForm.useField)(name);
73
+ const [inputValue, setInputValue] = (0, _react.useState)(inputDefaultValue);
74
+ const [selectValue, setSelectValue] = (0, _react.useState)(selectDefaultValue);
75
+ const [dropdownStyle, setDropdownStyle] = (0, _react.useState)({
76
+ left: '0px'
128
77
  });
129
- var labelClassNames = (0, _classnames.default)('form-field__label', disabled && 'form-field__label-disabled');
130
- var inputClassNames = (0, _classnames.default)('form-field-combobox__input', selectValue.id.length === 0 && 'form-field-combobox__input_hidden');
131
- (0, _react.useEffect)(function () {
132
- setValidationRules(function (prevState) {
133
- return prevState.map(function (rule) {
134
- return _objectSpread(_objectSpread({}, rule), {}, {
135
- isValid: !meta.error || !Array.isArray(meta.error) ? true : !meta.error.some(function (err) {
136
- return err.name === rule.name;
137
- })
138
- });
139
- });
140
- });
78
+ const [showSelectDropdown, setShowSelectDropdown] = (0, _react.useState)(false);
79
+ const [showSuggestionList, setShowSuggestionList] = (0, _react.useState)(false);
80
+ const [dropdownList, setDropdownList] = (0, _react.useState)(suggestionList);
81
+ const [searchIsFocused, setSearchIsFocused] = (0, _react.useState)(false);
82
+ const [isInvalid, setIsInvalid] = (0, _react.useState)(false);
83
+ const [validationRules, setValidationRules] = (0, _react.useState)(rules);
84
+ const [showValidationRules, setShowValidationRules] = (0, _react.useState)(false);
85
+ const comboboxRef = (0, _react.useRef)();
86
+ const selectRef = (0, _react.useRef)();
87
+ const inputRef = (0, _react.useRef)();
88
+ const suggestionListRef = (0, _react.useRef)();
89
+ (0, _hooks.useDetectOutsideClick)(comboboxRef, () => setShowValidationRules(false));
90
+ const labelClassNames = (0, _classnames.default)('form-field__label', disabled && 'form-field__label-disabled');
91
+ const inputClassNames = (0, _classnames.default)('form-field-combobox__input', selectValue.id.length === 0 && 'form-field-combobox__input_hidden');
92
+ (0, _react.useEffect)(() => {
93
+ setValidationRules(prevState => prevState.map(rule => ({
94
+ ...rule,
95
+ isValid: !meta.error || !Array.isArray(meta.error) ? true : !meta.error.some(err => err.name === rule.name)
96
+ })));
141
97
  }, [meta.error]);
142
- (0, _react.useEffect)(function () {
98
+ (0, _react.useEffect)(() => {
143
99
  if (!searchIsFocused) {
144
100
  if (JSON.stringify(dropdownList) !== JSON.stringify(suggestionList)) {
145
101
  setDropdownList(suggestionList);
146
102
  }
147
103
  }
148
104
  }, [dropdownList, suggestionList, searchIsFocused]);
149
- (0, _react.useEffect)(function () {
105
+ (0, _react.useEffect)(() => {
150
106
  setIsInvalid(meta.invalid && (meta.validating || meta.modified || meta.submitFailed && meta.touched));
151
107
  }, [meta.invalid, meta.modified, meta.submitFailed, meta.touched, meta.validating]);
152
- var handleOutsideClick = (0, _react.useCallback)(function (event) {
108
+ const handleOutsideClick = (0, _react.useCallback)(event => {
153
109
  if (comboboxRef.current && !comboboxRef.current.contains(event.target) && suggestionListRef.current && !suggestionListRef.current.contains(event.target)) {
154
110
  setSearchIsFocused(false);
155
111
  setShowSelectDropdown(false);
@@ -158,7 +114,7 @@ var FormCombobox = function FormCombobox(_ref) {
158
114
  onBlur && onBlur(input.value);
159
115
  }
160
116
  }, [input, onBlur]);
161
- var handleScroll = function handleScroll(event) {
117
+ const handleScroll = event => {
162
118
  if (comboboxRef.current && comboboxRef.current.contains(event.target)) return;
163
119
  if (!event.target.closest('.pop-up-dialog') && !event.target.classList.contains('form-field-combobox')) {
164
120
  setShowValidationRules(false);
@@ -167,34 +123,35 @@ var FormCombobox = function FormCombobox(_ref) {
167
123
  inputRef.current.blur();
168
124
  }
169
125
  };
170
- (0, _react.useEffect)(function () {
126
+ (0, _react.useEffect)(() => {
171
127
  window.addEventListener('click', handleOutsideClick);
172
- return function () {
128
+ return () => {
173
129
  window.removeEventListener('click', handleOutsideClick);
174
130
  };
175
131
  }, [handleOutsideClick]);
176
- (0, _react.useEffect)(function () {
132
+ (0, _react.useEffect)(() => {
177
133
  if (showValidationRules || showSelectDropdown || showSuggestionList) {
178
134
  window.addEventListener('scroll', handleScroll, true);
179
135
  }
180
- return function () {
136
+ return () => {
181
137
  window.removeEventListener('scroll', handleScroll, true);
182
138
  };
183
139
  }, [showSelectDropdown, showSuggestionList, showValidationRules]);
184
- var getValidationRules = function getValidationRules() {
185
- return validationRules.map(function (_ref2) {
186
- var _ref2$isValid = _ref2.isValid,
187
- isValid = _ref2$isValid === void 0 ? false : _ref2$isValid,
188
- label = _ref2.label,
189
- name = _ref2.name;
140
+ const getValidationRules = () => {
141
+ return validationRules.map(_ref2 => {
142
+ let {
143
+ isValid = false,
144
+ label,
145
+ name
146
+ } = _ref2;
190
147
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.ValidationTemplate, {
191
148
  valid: isValid,
192
149
  validationMessage: label
193
150
  }, name);
194
151
  });
195
152
  };
196
- var handleInputChange = function handleInputChange(event) {
197
- var target = event.target;
153
+ const handleInputChange = event => {
154
+ const target = event.target;
198
155
  setDropdownStyle({
199
156
  left: "".concat(target.selectionStart < 30 ? target.selectionStart : 30, "ch")
200
157
  });
@@ -208,7 +165,7 @@ var FormCombobox = function FormCombobox(_ref) {
208
165
  setShowSuggestionList(true);
209
166
  }
210
167
  };
211
- var handleSelectOptionClick = function handleSelectOptionClick(selectedOption, option) {
168
+ const handleSelectOptionClick = (selectedOption, option) => {
212
169
  if (selectedOption.id !== selectValue.id) {
213
170
  setSelectValue(selectedOption);
214
171
  input.onChange(selectedOption.id);
@@ -219,10 +176,10 @@ var FormCombobox = function FormCombobox(_ref) {
219
176
  inputRef.current.focus();
220
177
  }
221
178
  };
222
- var handleSuggestionListOptionClick = function handleSuggestionListOptionClick(option) {
223
- var inputValueItems = inputValue.split('/');
224
- var valueIndex = inputValueItems.length - 1;
225
- var formattedValue = option.customDelimiter ? inputValueItems[valueIndex].replace(new RegExp("".concat(option.customDelimiter, ".*")), '') + option.id : option.id;
179
+ const handleSuggestionListOptionClick = option => {
180
+ const inputValueItems = inputValue.split('/');
181
+ const valueIndex = inputValueItems.length - 1;
182
+ let formattedValue = option.customDelimiter ? inputValueItems[valueIndex].replace(new RegExp("".concat(option.customDelimiter, ".*")), '') + option.id : option.id;
226
183
  if (inputValueItems.length <= maxSuggestedMatches - 1) formattedValue += '/';
227
184
  inputValueItems[valueIndex] = formattedValue;
228
185
  if (searchIsFocused) {
@@ -239,7 +196,7 @@ var FormCombobox = function FormCombobox(_ref) {
239
196
  left: "".concat(inputRef.current.selectionStart < 30 ? inputRef.current.selectionStart : 30, "ch")
240
197
  });
241
198
  };
242
- var inputOnFocus = function inputOnFocus() {
199
+ const inputOnFocus = () => {
243
200
  onFocus && onFocus();
244
201
  input.onFocus(new Event('focus'));
245
202
  if (showSelectDropdown) {
@@ -247,15 +204,13 @@ var FormCombobox = function FormCombobox(_ref) {
247
204
  }
248
205
  setShowSuggestionList(true);
249
206
  };
250
- var suggestionListSearchChange = function suggestionListSearchChange(event) {
207
+ const suggestionListSearchChange = event => {
251
208
  event.persist();
252
- setDropdownList(function () {
253
- return suggestionList.filter(function (option) {
254
- return option.id.startsWith(event.target.value);
255
- });
256
- });
209
+ setDropdownList(() => suggestionList.filter(option => {
210
+ return option.id.startsWith(event.target.value);
211
+ }));
257
212
  };
258
- var toggleSelect = (0, _react.useCallback)(function () {
213
+ const toggleSelect = (0, _react.useCallback)(() => {
259
214
  if (showSelectDropdown) {
260
215
  setShowSelectDropdown(false);
261
216
  input.onBlur(new Event('blur'));
@@ -271,26 +226,19 @@ var FormCombobox = function FormCombobox(_ref) {
271
226
  onFocus && onFocus(input.value);
272
227
  }
273
228
  }, [input, onBlur, onFocus, showSelectDropdown]);
274
- var validateField = function validateField() {
275
- var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
276
- var allValues = arguments.length > 1 ? arguments[1] : undefined;
277
- var valueToValidate = value.startsWith(selectValue.id) ? value.substring(selectValue.id.length) : value !== null && value !== void 0 ? value : '';
278
- var validationError = null;
229
+ const validateField = function () {
230
+ let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
231
+ let allValues = arguments.length > 1 ? arguments[1] : undefined;
232
+ const valueToValidate = value.startsWith(selectValue.id) ? value.substring(selectValue.id.length) : value !== null && value !== void 0 ? value : '';
233
+ let validationError = null;
279
234
  if (!(0, _lodash.isEmpty)(validationRules)) {
280
- var _checkPatternsValidit = (0, _validation.checkPatternsValidity)(rules, valueToValidate),
281
- _checkPatternsValidit2 = _slicedToArray(_checkPatternsValidit, 2),
282
- newRules = _checkPatternsValidit2[0],
283
- isValidField = _checkPatternsValidit2[1];
284
- var invalidRules = newRules.filter(function (rule) {
285
- return !rule.isValid;
286
- });
235
+ const [newRules, isValidField] = (0, _validation.checkPatternsValidity)(rules, valueToValidate);
236
+ const invalidRules = newRules.filter(rule => !rule.isValid);
287
237
  if (!isValidField) {
288
- validationError = invalidRules.map(function (rule) {
289
- return {
290
- name: rule.name,
291
- label: rule.label
292
- };
293
- });
238
+ validationError = invalidRules.map(rule => ({
239
+ name: rule.name,
240
+ label: rule.label
241
+ }));
294
242
  }
295
243
  }
296
244
  if ((0, _lodash.isEmpty)(validationError)) {
@@ -311,23 +259,23 @@ var FormCombobox = function FormCombobox(_ref) {
311
259
  }
312
260
  return validationError;
313
261
  };
314
- var warningIconClick = function warningIconClick() {
315
- setShowValidationRules(function (state) {
316
- return !state;
317
- });
262
+ const warningIconClick = () => {
263
+ setShowValidationRules(state => !state);
318
264
  setShowSelectDropdown(false);
319
265
  };
320
- var comboboxClassNames = (0, _classnames.default)(comboboxClassName, 'form-field-combobox', 'form-field', isInvalid && 'form-field-combobox_invalid');
321
- var iconClassNames = (0, _classnames.default)(showSelectDropdown && 'form-field-combobox__icon_open', 'form-field-combobox__icon');
322
- var selectValueClassNames = (0, _classnames.default)(selectValue.className);
323
- var 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');
266
+ const comboboxClassNames = (0, _classnames.default)(comboboxClassName, 'form-field-combobox', 'form-field', isInvalid && 'form-field-combobox_invalid');
267
+ const iconClassNames = (0, _classnames.default)(showSelectDropdown && 'form-field-combobox__icon_open', 'form-field-combobox__icon');
268
+ const selectValueClassNames = (0, _classnames.default)(selectValue.className);
269
+ 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');
324
270
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
325
271
  name: name,
326
272
  validate: validateField,
327
- children: function children(_ref3) {
273
+ children: _ref3 => {
328
274
  var _meta$error$label, _meta$error;
329
- var input = _ref3.input,
330
- meta = _ref3.meta;
275
+ let {
276
+ input,
277
+ meta
278
+ } = _ref3;
331
279
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
332
280
  className: comboboxClassNames,
333
281
  ref: comboboxRef,
@@ -337,9 +285,7 @@ var FormCombobox = function FormCombobox(_ref) {
337
285
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
338
286
  "data-testid": "label",
339
287
  htmlFor: input.name,
340
- children: [label, (required || validationRules.find(function (rule) {
341
- return rule.name === 'required';
342
- })) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
288
+ children: [label, (required || validationRules.find(rule => rule.name === 'required')) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
343
289
  className: "form-field__label-mandatory",
344
290
  children: " *"
345
291
  })]
@@ -376,14 +322,12 @@ var FormCombobox = function FormCombobox(_ref) {
376
322
  className: "form-field-combobox__dropdown form-field-combobox__dropdown-select",
377
323
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
378
324
  className: "form-field-combobox__dropdown-list",
379
- children: selectOptions.map(function (option) {
325
+ children: selectOptions.map(option => {
380
326
  if (!option.hidden) {
381
- var selectOptionClassNames = (0, _classnames.default)('form-field-combobox__dropdown-list-option', option.className);
327
+ const selectOptionClassNames = (0, _classnames.default)('form-field-combobox__dropdown-list-option', option.className);
382
328
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
383
329
  className: selectOptionClassNames,
384
- onClick: function onClick() {
385
- return handleSelectOptionClick(option);
386
- },
330
+ onClick: () => handleSelectOptionClick(option),
387
331
  children: option.label
388
332
  }, option.id);
389
333
  }
@@ -408,7 +352,9 @@ var FormCombobox = function FormCombobox(_ref) {
408
352
  position: 'bottom-right'
409
353
  },
410
354
  className: "form-field-combobox__dropdown form-field-combobox__dropdown-suggestions",
411
- style: _objectSpread({}, dropdownStyle),
355
+ style: {
356
+ ...dropdownStyle
357
+ },
412
358
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
413
359
  ref: suggestionListRef,
414
360
  children: [!hideSearchInput && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -417,9 +363,7 @@ var FormCombobox = function FormCombobox(_ref) {
417
363
  "data-testid": name ? "".concat(name, "-form-combobox-search") : 'form-combobox-search',
418
364
  className: "form-field-combobox__search form-field__control",
419
365
  onChange: suggestionListSearchChange,
420
- onFocus: function onFocus() {
421
- return setSearchIsFocused(true);
422
- },
366
+ onFocus: () => setSearchIsFocused(true),
423
367
  placeholder: "Type to search",
424
368
  type: "text"
425
369
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_search.ReactComponent, {})]
@@ -428,15 +372,11 @@ var FormCombobox = function FormCombobox(_ref) {
428
372
  children: searchIsFocused && dropdownList.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
429
373
  className: "form-field-combobox__dropdown-list-option",
430
374
  children: "No data"
431
- }, "no data") : dropdownList.map(function (value) {
432
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
433
- className: "form-field-combobox__dropdown-list-option",
434
- onClick: function onClick() {
435
- return handleSuggestionListOptionClick(value);
436
- },
437
- children: value.label
438
- }, value.id);
439
- })
375
+ }, "no data") : dropdownList.map(value => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
376
+ className: "form-field-combobox__dropdown-list-option",
377
+ onClick: () => handleSuggestionListOptionClick(value),
378
+ children: value.label
379
+ }, value.id))
440
380
  })]
441
381
  })
442
382
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -510,5 +450,4 @@ FormCombobox.propTypes = {
510
450
  validator: _propTypes.default.func,
511
451
  withoutBorder: _propTypes.default.bool
512
452
  };
513
- var _default = FormCombobox;
514
- exports.default = _default;
453
+ var _default = exports.default = FormCombobox;