iguazio.dashboard-react-controls 0.0.7 → 0.0.8

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.
@@ -92,7 +92,7 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
92
92
  required = _ref.required,
93
93
  suggestionList = _ref.suggestionList,
94
94
  tip = _ref.tip,
95
- validationRules = _ref.validationRules,
95
+ rules = _ref.validationRules,
96
96
  validator = _ref.validator,
97
97
  withoutBorder = _ref.withoutBorder,
98
98
  inputProps = _objectWithoutProperties(_ref, _excluded);
@@ -120,10 +120,15 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
120
120
  _useState8 = _slicedToArray(_useState7, 1),
121
121
  validationPattern = _useState8[0];
122
122
 
123
- var _useState9 = (0, _react.useState)(false),
123
+ var _useState9 = (0, _react.useState)(rules),
124
124
  _useState10 = _slicedToArray(_useState9, 2),
125
- showValidationRules = _useState10[0],
126
- setShowValidationRules = _useState10[1];
125
+ validationRules = _useState10[0],
126
+ setValidationRules = _useState10[1];
127
+
128
+ var _useState11 = (0, _react.useState)(false),
129
+ _useState12 = _slicedToArray(_useState11, 2),
130
+ showValidationRules = _useState12[0],
131
+ setShowValidationRules = _useState12[1];
127
132
 
128
133
  var wrapperRef = (0, _react.useRef)();
129
134
  (_ref2 = ref) !== null && _ref2 !== void 0 ? _ref2 : ref = wrapperRef;
@@ -131,8 +136,8 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
131
136
  (0, _useDetectOutsideClick.useDetectOutsideClick)(ref, function () {
132
137
  return setShowValidationRules(false);
133
138
  });
134
- var inputClassNames = (0, _classnames.default)('form-field__input', className, "form-field__input-".concat(density), isInvalid && 'form-field__input-invalid', // isInvalid && 'input_rules-invalid',
135
- withoutBorder && 'without-border');
139
+ var formFieldClassNames = (0, _classnames.default)('form-field', className);
140
+ var inputWrapperClassNames = (0, _classnames.default)('form-field__wrapper', "form-field__wrapper-".concat(density), disabled && 'form-field__wrapper-disabled', isInvalid && 'form-field__wrapper-invalid', withoutBorder && 'without-border');
136
141
  var labelClassNames = (0, _classnames.default)('form-field__label', disabled && 'form-field__label-disabled');
137
142
  (0, _react.useEffect)(function () {
138
143
  setTypedValue(String(input.value)); // convert from number to string
@@ -155,8 +160,8 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
155
160
  }
156
161
  }, [focused]);
157
162
 
158
- var getValidationRules = function getValidationRules(rules) {
159
- return rules.map(function (_ref3) {
163
+ var getValidationRules = function getValidationRules() {
164
+ return validationRules.map(function (_ref3) {
160
165
  var _ref3$isValid = _ref3.isValid,
161
166
  isValid = _ref3$isValid === void 0 ? false : _ref3$isValid,
162
167
  label = _ref3.label,
@@ -173,7 +178,7 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
173
178
 
174
179
  input.onBlur(event);
175
180
 
176
- if (!event.relatedTarget || !((_event$relatedTarget = event.relatedTarget) !== null && _event$relatedTarget !== void 0 && _event$relatedTarget.closest('.suggestion-list'))) {
181
+ if (!event.relatedTarget || !((_event$relatedTarget = event.relatedTarget) !== null && _event$relatedTarget !== void 0 && _event$relatedTarget.closest('.form-field__suggestion-list'))) {
177
182
  setIsFocused(false);
178
183
  onBlur && onBlur(event);
179
184
  }
@@ -206,18 +211,39 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
206
211
  setShowValidationRules(!showValidationRules);
207
212
  };
208
213
 
214
+ (0, _react.useEffect)(function () {
215
+ setValidationRules(function (prevState) {
216
+ return prevState.map(function (rule) {
217
+ return _objectSpread(_objectSpread({}, rule), {}, {
218
+ isValid: !meta.error || !Array.isArray(meta.error) ? true : !meta.error.some(function (err) {
219
+ return err.name === rule.name;
220
+ })
221
+ });
222
+ });
223
+ });
224
+ }, [meta.error]);
225
+
209
226
  var validateField = function validateField(value) {
210
227
  var valueToValidate = value !== null && value !== void 0 ? value : '';
211
228
  var validationError = null;
212
229
 
213
- if (!(0, _lodash.isEmpty)(validationRules)) {
214
- var _checkPatternsValidit = (0, _validationService.checkPatternsValidity)(validationRules, valueToValidate),
230
+ if (!(0, _lodash.isEmpty)(validationRules) && valueToValidate !== typedValue) {
231
+ var _checkPatternsValidit = (0, _validationService.checkPatternsValidity)(rules, valueToValidate),
215
232
  _checkPatternsValidit2 = _slicedToArray(_checkPatternsValidit, 2),
216
233
  newRules = _checkPatternsValidit2[0],
217
234
  isValidField = _checkPatternsValidit2[1];
218
235
 
236
+ var invalidRules = newRules.filter(function (rule) {
237
+ return !rule.isValid;
238
+ });
239
+
219
240
  if (!isValidField) {
220
- validationError = newRules;
241
+ validationError = invalidRules.map(function (rule) {
242
+ return {
243
+ name: rule.name,
244
+ label: rule.label
245
+ };
246
+ });
221
247
  }
222
248
 
223
249
  if (isValidField && showValidationRules || required && valueToValidate === '') {
@@ -261,7 +287,7 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
261
287
  meta = _ref4.meta;
262
288
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
263
289
  ref: ref,
264
- className: "form-field",
290
+ className: formFieldClassNames,
265
291
  children: [label && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
266
292
  className: labelClassNames,
267
293
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
@@ -291,22 +317,24 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
291
317
  })
292
318
  })]
293
319
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
294
- className: "form-field__wrapper",
295
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
296
- "data-testid": "input",
297
- id: input.name,
298
- className: inputClassNames,
299
- ref: inputRef,
300
- required: isInvalid
301
- }, _objectSpread(_objectSpread({
302
- disabled: disabled,
303
- pattern: pattern
304
- }, inputProps), input)), {}, {
305
- autoComplete: (_inputProps$autocompl = inputProps.autocomplete) !== null && _inputProps$autocompl !== void 0 ? _inputProps$autocompl : 'off',
306
- onChange: handleInputChange,
307
- onBlur: handleInputBlur,
308
- onFocus: handleInputFocus
309
- })), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
320
+ className: inputWrapperClassNames,
321
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
322
+ className: "form-field__control",
323
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
324
+ "data-testid": "input",
325
+ id: input.name,
326
+ ref: inputRef,
327
+ required: isInvalid || required
328
+ }, _objectSpread(_objectSpread({
329
+ disabled: disabled,
330
+ pattern: pattern
331
+ }, inputProps), input)), {}, {
332
+ autoComplete: (_inputProps$autocompl = inputProps.autocomplete) !== null && _inputProps$autocompl !== void 0 ? _inputProps$autocompl : 'off',
333
+ onChange: handleInputChange,
334
+ onBlur: handleInputBlur,
335
+ onFocus: handleInputFocus
336
+ }))
337
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
310
338
  className: "form-field__icons",
311
339
  children: [isInvalid && !Array.isArray(meta.error) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
312
340
  className: "form-field__warning",
@@ -315,7 +343,7 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
315
343
  warning: true
316
344
  }),
317
345
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_invalid.ReactComponent, {})
318
- }), isInvalid && Array.isArray(meta.error) && !(0, _lodash.isEmpty)(meta.error) && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
346
+ }), isInvalid && Array.isArray(meta.error) && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
319
347
  className: "form-field__warning",
320
348
  onClick: toggleValidationRulesMenu,
321
349
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_warning.ReactComponent, {})
@@ -329,7 +357,7 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
329
357
  })]
330
358
  })]
331
359
  }), (suggestionList === null || suggestionList === void 0 ? void 0 : suggestionList.length) > 0 && isFocused && /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
332
- className: "suggestion-list",
360
+ className: "form-field__suggestion-list",
333
361
  children: suggestionList.map(function (item, index) {
334
362
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
335
363
  className: "suggestion-item",
@@ -344,10 +372,10 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
344
372
  }
345
373
  }, "".concat(item).concat(index));
346
374
  })
347
- }), isInvalid && Array.isArray(meta.error) && !(0, _lodash.isEmpty)(meta.error) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_OptionsMenu.default, {
375
+ }), !(0, _lodash.isEmpty)(validationRules) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_OptionsMenu.default, {
348
376
  show: showValidationRules,
349
- parentElement: ref,
350
- children: getValidationRules(meta.error)
377
+ ref: ref,
378
+ children: getValidationRules()
351
379
  })]
352
380
  });
353
381
  }
@@ -3,30 +3,10 @@
3
3
  @import '../../scss/shadows';
4
4
  @import '../../scss/mixins';
5
5
 
6
- .form-field {
7
- position: relative;
8
- display: block;
9
- width: 100%;
6
+ @include formField;
10
7
 
8
+ .form-field {
11
9
  &__label {
12
- margin-bottom: 5px;
13
- color: $topaz;
14
- font-size: 12px;
15
- text-transform: capitalize;
16
- background-color: transparent;
17
-
18
- &-mandatory {
19
- color: $amaranth;
20
- }
21
-
22
- &-disabled {
23
- color: $spunPearl;
24
-
25
- .form-field__label-mandatory {
26
- color: $spunPearl;
27
- }
28
- }
29
-
30
10
  &-icon {
31
11
  display: inline-flex;
32
12
  margin-left: 3px;
@@ -51,11 +31,11 @@
51
31
  }
52
32
  }
53
33
 
54
- &__input {
55
- padding-left: 16px;
56
- padding-right: 30px;
57
-
58
- @include fieldWrapper;
34
+ input {
35
+ border: 0;
36
+ color: inherit;
37
+ padding: 0;
38
+ width: 100%;
59
39
 
60
40
  &::placeholder {
61
41
  color: $spunPearl;
@@ -81,66 +61,13 @@
81
61
  color: $spunPearl;
82
62
  }
83
63
 
84
- &-invalid {
85
- border: $errorBorder;
86
- padding-right: 50px;
87
- }
88
-
89
- &.without-border {
90
- border-color: transparent;
91
- }
92
-
93
- &:read-only:not(:disabled) {
94
- border-color: transparent;
95
- padding: 0;
96
- }
97
-
98
64
  &:disabled {
99
- color: $spunPearl;
65
+ background: transparent;
100
66
  cursor: not-allowed;
101
67
  }
102
-
103
- &-dense {
104
- padding-top: 12px;
105
- padding-bottom: 12px;
106
- }
107
-
108
- &-normal {
109
- padding-top: 14px;
110
- padding-bottom: 14px;
111
- }
112
-
113
- &-medium {
114
- padding-top: 16px;
115
- padding-bottom: 16px;
116
- }
117
-
118
- &-chunky {
119
- padding-top: 18px;
120
- padding-bottom: 18px;
121
- }
122
68
  }
123
69
 
124
- &__icons {
125
- display: flex;
126
- align-items: center;
127
- position: absolute;
128
- top: 50%;
129
- right: 10px;
130
- transform: translateY(-50%);
131
-
132
- & > * {
133
- display: flex;
134
- align-items: center;
135
- cursor: pointer;
136
-
137
- &:not(:first-child) {
138
- margin-left: 8px;
139
- }
140
- }
141
- }
142
-
143
- .suggestion-list {
70
+ &__suggestion-list {
144
71
  position: absolute;
145
72
  top: 100%;
146
73
  left: 0;
@@ -162,8 +89,4 @@
162
89
  }
163
90
  }
164
91
  }
165
-
166
- &__wrapper {
167
- position: relative;
168
- }
169
92
  }
@@ -41,6 +41,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
41
41
 
42
42
  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; }
43
43
 
44
+ 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; }
45
+
46
+ 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; }
47
+
48
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
49
+
44
50
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
45
51
 
46
52
  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."); }
@@ -71,33 +77,64 @@ var FormSelect = function FormSelect(_ref) {
71
77
  withSelectedIcon = _ref.withSelectedIcon;
72
78
 
73
79
  var _useField = (0, _reactFinalForm.useField)(name),
74
- input = _useField.input;
75
-
76
- var selectRef = (0, _react.useRef)();
80
+ input = _useField.input,
81
+ meta = _useField.meta;
77
82
 
78
83
  var _useState = (0, _react.useState)(false),
79
84
  _useState2 = _slicedToArray(_useState, 2),
80
- isConfirmDialogOpen = _useState2[0],
81
- setConfirmDialogOpen = _useState2[1];
85
+ isInvalid = _useState2[0],
86
+ setIsInvalid = _useState2[1];
82
87
 
83
88
  var _useState3 = (0, _react.useState)(false),
84
89
  _useState4 = _slicedToArray(_useState3, 2),
85
- isOpen = _useState4[0],
86
- setOpen = _useState4[1];
90
+ isConfirmDialogOpen = _useState4[0],
91
+ setConfirmDialogOpen = _useState4[1];
87
92
 
88
- var _useState5 = (0, _react.useState)(''),
93
+ var _useState5 = (0, _react.useState)(false),
89
94
  _useState6 = _slicedToArray(_useState5, 2),
90
- searchValue = _useState6[0],
91
- setSearchValue = _useState6[1];
95
+ isOpen = _useState6[0],
96
+ setOpen = _useState6[1];
97
+
98
+ var _useState7 = (0, _react.useState)(''),
99
+ _useState8 = _slicedToArray(_useState7, 2),
100
+ searchValue = _useState8[0],
101
+ setSearchValue = _useState8[1];
102
+
103
+ var selectRef = (0, _react.useRef)();
92
104
 
93
105
  var _ref2 = (selectRef === null || selectRef === void 0 ? void 0 : (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.getBoundingClientRect()) || {},
94
106
  dropdownWidth = _ref2.width;
95
107
 
96
- var selectClassName = (0, _classnames.default)('form-field__select', "form-field__select-".concat(density), isOpen && 'form-field__select-active', withoutBorder && 'without-border', disabled && 'form-field__select-disabled');
108
+ var selectWrapperClassNames = (0, _classnames.default)('form-field__wrapper', "form-field__wrapper-".concat(density), disabled && 'form-field__wrapper-disabled', isOpen && 'form-field__wrapper-active', isInvalid && 'form-field__wrapper-invalid', withoutBorder && 'without-border');
97
109
  var selectLabelClassName = (0, _classnames.default)('form-field__label', disabled && 'form-field__label-disabled');
98
110
  var selectedOption = options.find(function (option) {
99
111
  return option.id === input.value;
100
112
  });
113
+ (0, _react.useEffect)(function () {
114
+ setIsInvalid(meta.invalid && (meta.validating || meta.modified || meta.submitFailed && meta.touched));
115
+ }, [meta.invalid, meta.modified, meta.submitFailed, meta.touched, meta.validating]);
116
+ var openMenu = (0, _react.useCallback)(function () {
117
+ if (!isOpen) {
118
+ setOpen(true);
119
+ input.onFocus(new Event('focus'));
120
+ }
121
+ }, [input, isOpen]);
122
+ var closeMenu = (0, _react.useCallback)(function () {
123
+ if (isOpen) {
124
+ setOpen(false);
125
+ input.onBlur(new Event('blur'));
126
+ }
127
+ }, [input, isOpen]);
128
+ var clickHandler = (0, _react.useCallback)(function (event) {
129
+ if (selectRef.current !== event.target.closest('.form-field')) {
130
+ closeMenu();
131
+ }
132
+ }, [closeMenu]);
133
+ var handleScroll = (0, _react.useCallback)(function (event) {
134
+ if (!event.target.closest('.options-list__body')) {
135
+ closeMenu();
136
+ }
137
+ }, [closeMenu]);
101
138
  (0, _react.useEffect)(function () {
102
139
  if (isOpen) {
103
140
  window.addEventListener('scroll', handleScroll, true);
@@ -108,32 +145,24 @@ var FormSelect = function FormSelect(_ref) {
108
145
  window.removeEventListener('click', clickHandler);
109
146
  window.removeEventListener('scroll', handleScroll, true);
110
147
  };
111
- }, [isOpen]);
112
-
113
- var clickHandler = function clickHandler(event) {
114
- if (selectRef.current !== event.target.closest('.form-field')) {
115
- setOpen(false);
116
- }
117
- };
118
-
119
- var handleScroll = function handleScroll(event) {
120
- if (!event.target.closest('.select__body')) {
121
- setOpen(false);
122
- }
123
- };
148
+ }, [clickHandler, handleScroll, isOpen]);
124
149
 
125
150
  var toggleOpen = function toggleOpen() {
126
- !disabled && setOpen(!isOpen);
151
+ if (isOpen) {
152
+ closeMenu();
153
+ } else {
154
+ !disabled && openMenu();
155
+ }
127
156
  };
128
157
 
129
158
  var handleCloseSelectBody = (0, _react.useCallback)(function (event) {
130
159
  event.stopPropagation();
131
160
 
132
- if (!event.target.classList.contains('disabled') && !event.target.closest('.select__search')) {
133
- setOpen(false);
161
+ if (!event.target.classList.contains('disabled') && !event.target.closest('.options-list__search')) {
162
+ closeMenu();
134
163
  setSearchValue('');
135
164
  }
136
- }, []);
165
+ }, [closeMenu]);
137
166
 
138
167
  var handleSelectOptionClick = function handleSelectOptionClick(selectedOption, option) {
139
168
  if (selectedOption !== input.value) {
@@ -149,7 +178,6 @@ var FormSelect = function FormSelect(_ref) {
149
178
 
150
179
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
151
180
  name: name,
152
- component: "select",
153
181
  validate: required,
154
182
  children: function children(_ref3) {
155
183
  var input = _ref3.input,
@@ -170,18 +198,21 @@ var FormSelect = function FormSelect(_ref) {
170
198
  })
171
199
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
172
200
  "data-testid": "select-header",
173
- className: "form-field__wrapper",
174
- children: [!hideSelectedOption && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
175
- "data-testid": "selected-option",
176
- className: selectClassName,
177
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
178
- className: "form-field__select-value",
179
- children: input.value && (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label)
180
- }), (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.subLabel) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
181
- "data-testid": "select-subLabel",
182
- className: "sub-label",
183
- children: selectedOption.subLabel
184
- })]
201
+ className: selectWrapperClassNames,
202
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
203
+ className: "form-field__control",
204
+ children: !hideSelectedOption && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
205
+ "data-testid": "selected-option",
206
+ className: "form-field__select",
207
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
208
+ className: "form-field__select-value",
209
+ children: input.value && (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label)
210
+ }), (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.subLabel) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
211
+ "data-testid": "select-subLabel",
212
+ className: "form-field__select-sub_label",
213
+ children: selectedOption.subLabel
214
+ })]
215
+ })
185
216
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
186
217
  className: "form-field__icons",
187
218
  children: [input.value && selectedItemAction && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
@@ -204,8 +235,10 @@ var FormSelect = function FormSelect(_ref) {
204
235
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
205
236
  children: selectedItemAction.icon
206
237
  })
207
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdown.ReactComponent, {
208
- className: "form-field__caret"
238
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
239
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdown.ReactComponent, {
240
+ className: "form-field__caret"
241
+ })
209
242
  })]
210
243
  })]
211
244
  }), isConfirmDialogOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfirmDialog.default, {
@@ -230,7 +263,7 @@ var FormSelect = function FormSelect(_ref) {
230
263
  header: selectedItemAction.confirm.title,
231
264
  message: selectedItemAction.confirm.message
232
265
  }), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PopUpDialog.default, {
233
- className: "select__options-list",
266
+ className: "form-field__select__options-list",
234
267
  customPosition: {
235
268
  element: selectRef,
236
269
  position: 'bottom-right'
@@ -240,10 +273,10 @@ var FormSelect = function FormSelect(_ref) {
240
273
  },
241
274
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
242
275
  "data-testid": "select-body",
243
- className: "select__body",
276
+ className: "options-list__body",
244
277
  onClick: handleCloseSelectBody,
245
278
  children: [search && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
246
- className: "select__search",
279
+ className: "options-list__search",
247
280
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
248
281
  type: "text",
249
282
  placeholder: "Search...",
@@ -266,7 +299,9 @@ var FormSelect = function FormSelect(_ref) {
266
299
  }, option.id);
267
300
  })]
268
301
  })
269
- })]
302
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({}, input), {}, {
303
+ type: "hidden"
304
+ }))]
270
305
  });
271
306
  }
272
307
  });
@@ -283,7 +318,7 @@ FormSelect.defaultProps = {
283
318
  search: false,
284
319
  selectType: '',
285
320
  withoutBorder: false,
286
- withSelectedIcon: false
321
+ withSelectedIcon: true
287
322
  };
288
323
  FormSelect.propTypes = {
289
324
  className: _propTypes.default.string,
@@ -1,303 +1,93 @@
1
1
  @import '../../scss/mixins';
2
2
  @import '../../scss/colors';
3
- @import '../../scss/borders';
4
3
  @import '../../scss/shadows';
5
4
 
6
- .form-field {
7
- position: relative;
8
- display: block;
9
- width: 100%;
10
-
11
- &__label {
12
- margin-bottom: 5px;
13
- color: $topaz;
14
- font-size: 12px;
15
- text-transform: capitalize;
16
- background-color: transparent;
17
-
18
- &-disabled {
19
- color: $spunPearl;
20
- }
21
- }
22
-
23
- &__select {
24
- padding-left: 16px;
25
- padding-right: 30px;
26
- cursor: pointer;
5
+ @include formField;
27
6
 
28
- @include fieldWrapper;
29
-
30
- &-active:not(.without-border) {
7
+ .form-field {
8
+ &__wrapper {
9
+ &-active {
31
10
  background: $alabaster;
32
11
  }
33
12
 
34
- &-disabled {
35
- color: $spunPearl;
36
- cursor: not-allowed;
13
+ .form-field__caret {
14
+ cursor: pointer;
37
15
  }
38
16
 
39
- &.without {
40
- &-border {
41
- border-color: transparent;
42
-
43
- .form-field__caret {
44
- display: none;
45
- }
17
+ &-disabled {
18
+ .form-field__caret {
19
+ cursor: not-allowed;
46
20
 
47
- &:hover {
48
- .form-field__caret {
49
- display: block;
50
- }
21
+ path {
22
+ fill: $spunPearl;
51
23
  }
52
24
  }
53
-
54
- &-label {
55
- padding-left: 16px;
56
- }
57
25
  }
58
26
 
59
- &-dense {
60
- padding-top: 12px;
61
- padding-bottom: 12px;
62
- }
63
-
64
- &-normal {
65
- padding-top: 14px;
66
- padding-bottom: 14px;
67
- }
27
+ &.without-border {
28
+ .form-field__caret {
29
+ display: none;
30
+ }
68
31
 
69
- &-medium {
70
- padding-top: 16px;
71
- padding-bottom: 16px;
32
+ &:hover {
33
+ .form-field__caret {
34
+ display: block;
35
+ }
36
+ }
72
37
  }
38
+ }
73
39
 
74
- &-chunky {
75
- padding-top: 18px;
76
- padding-bottom: 18px;
77
- }
40
+ &__select {
41
+ width: 100%;
78
42
 
79
43
  &-value {
80
44
  display: block;
81
- min-height: 18px;
45
+ overflow: hidden;
46
+ white-space: nowrap;
47
+ text-overflow: ellipsis;
82
48
  }
83
- }
84
- }
85
-
86
- // .select {
87
- // position: relative;
88
- // display: flex;
89
- // flex-flow: column;
90
- // flex: 1 0;
91
- // cursor: pointer;
92
-
93
- // @include fieldWrapper;
94
-
95
- // &__label {
96
- // margin-bottom: 5px;
97
- // color: $topaz;
98
- // font-size: 12px;
99
- // text-transform: capitalize;
100
- // background-color: transparent;
101
-
102
- // &-mandatory {
103
- // color: $amaranth;
104
- // }
105
-
106
- // &-disabled {
107
- // color: $spunPearl;
108
-
109
- // .form-field__label-mandatory {
110
- // color: $spunPearl;
111
- // }
112
- // }
113
- // }
114
-
115
- // &_active:not(.without-border) {
116
- // background: $alabaster;
117
- // }
118
49
 
119
- // &__caret {
120
- // position: absolute;
121
- // top: 50%;
122
- // right: 10px;
123
- // transform: translate(0%, -50%);
124
- // }
125
-
126
- // &.without {
127
- // &-border {
128
- // border: none;
129
-
130
- // .select__caret {
131
- // display: none;
132
- // }
133
-
134
- // &:hover {
135
- // .select__caret {
136
- // display: block;
137
- // }
138
- // }
139
- // }
140
-
141
- // &-label {
142
- // padding-left: 16px;
143
- // }
144
- // }
145
-
146
- // &__header {
147
- // position: relative;
148
- // display: flex;
149
- // align-items: center;
150
- // width: 100%;
151
- // height: 100%;
152
- // }
153
-
154
- // &__value {
155
- // min-width: 96px;
156
- // min-height: 1em;
157
- // padding-right: 50px;
158
- // overflow: hidden;
159
- // color: $mulledWine;
160
- // white-space: nowrap;
161
- // text-overflow: ellipsis;
162
-
163
- // &_floating {
164
- // position: relative;
165
- // top: 6px;
166
- // left: 16px;
167
- // }
168
- // }
169
-
170
- // &__label {
171
- // top: 15px;
172
- // left: 0;
173
- // padding: 0 5px 0 16px;
174
- // color: $topaz;
175
- // font-size: 15px;
176
- // text-transform: capitalize;
177
- // transition: 200ms ease;
178
-
179
- // &_floating {
180
- // position: absolute;
181
- // top: 0;
182
- // left: 0;
183
- // padding-top: 9px;
184
- // font-weight: 700;
185
- // font-size: 10px;
186
- // line-height: 12px;
187
- // letter-spacing: 0.5px;
188
- // transition: 200ms ease;
189
- // }
190
-
191
- // &_top {
192
- // position: absolute;
193
- // top: -20px;
194
- // left: 0;
195
- // padding: 0;
196
- // font-weight: bold;
197
- // font-size: 12px;
198
- // line-height: 15px;
199
-
200
- // & + .select__value {
201
- // padding-left: 15px;
202
- // }
203
- // }
204
- // }
205
-
206
- // &__options-list {
207
- // .pop-up-dialog {
208
- // width: 100%;
209
- // padding: 0;
210
-
211
- // &__header {
212
- // display: none;
213
- // }
214
- // }
215
- // }
216
-
217
- // &.disabled {
218
- // cursor: not-allowed;
219
-
220
- // .select__label,
221
- // .select__value {
222
- // color: $spunPearl;
223
- // }
224
- // }
225
-
226
- // .sub-label {
227
- // margin-left: 5px;
228
- // overflow: hidden;
229
- // color: $topaz;
230
- // white-space: nowrap;
231
- // text-overflow: ellipsis;
232
- // }
233
-
234
- // &__body {
235
- // width: 100%;
236
- // max-height: 250px;
237
- // overflow-y: auto;
238
- // color: $mulledWineTwo;
239
- // background-color: $white;
240
- // border: $primaryBorder;
241
- // border-radius: 2px;
242
- // box-shadow: $filterShadow;
243
- // }
244
-
245
- // &__search {
246
- // width: 100%;
247
-
248
- // input {
249
- // width: 100%;
250
- // padding: 10px;
251
- // border: none;
252
- // border-bottom: $primaryBorder;
253
- // }
254
- // }
255
-
256
- // .actions {
257
- // position: absolute;
258
- // right: 25px;
259
- // }
260
-
261
- // .disabled {
262
- // color: $spunPearl;
263
- // cursor: default;
264
- // user-select: none;
265
-
266
- // &:hover {
267
- // background-color: $white;
268
- // }
269
- // }
270
-
271
- // .pop-up-dialog__overlay {
272
- // top: 100%;
273
- // right: calc(100% + 10px);
274
- // }
275
-
276
- // &-dense {
277
- // height: 40px;
278
-
279
- // .select__label_floating {
280
- // padding-top: 6px;
281
- // }
282
- // }
283
-
284
- // &-normal {
285
- // height: 48px;
286
- // }
50
+ &-sub_label {
51
+ display: block;
52
+ margin-left: 5px;
53
+ overflow: hidden;
54
+ color: $topaz;
55
+ white-space: nowrap;
56
+ text-overflow: ellipsis;
57
+ }
287
58
 
288
- // &-medium {
289
- // height: 52px;
59
+ &__options-list {
60
+ .pop-up-dialog {
61
+ width: 100%;
62
+ padding: 0;
290
63
 
291
- // .select__label_floating {
292
- // padding-top: 11px;
293
- // }
294
- // }
64
+ &__header {
65
+ display: none;
66
+ }
67
+ }
68
+ .options-list {
69
+ &__body {
70
+ width: 100%;
71
+ max-height: 250px;
72
+ overflow-y: auto;
73
+ color: $mulledWineTwo;
74
+ background-color: $white;
75
+ border: $primaryBorder;
76
+ border-radius: 2px;
77
+ box-shadow: $filterShadow;
78
+ }
295
79
 
296
- // &-chunky {
297
- // height: 56px;
80
+ &__search {
81
+ width: 100%;
298
82
 
299
- // .select__label_floating {
300
- // padding-top: 13px;
301
- // }
302
- // }
303
- // }
83
+ input {
84
+ width: 100%;
85
+ padding: 10px;
86
+ border: none;
87
+ border-bottom: $primaryBorder;
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
@@ -11,8 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
- var _reactFinalForm = require("react-final-form");
15
-
16
14
  var _classnames = _interopRequireDefault(require("classnames"));
17
15
 
18
16
  var _Button = _interopRequireDefault(require("../Button/Button"));
@@ -61,7 +59,7 @@ var Wizard = function Wizard(_ref) {
61
59
  var children = _ref.children,
62
60
  className = _ref.className,
63
61
  confirmClose = _ref.confirmClose,
64
- initialValues = _ref.initialValues,
62
+ FormState = _ref.FormState,
65
63
  isWizardOpen = _ref.isWizardOpen,
66
64
  onWizardResolve = _ref.onWizardResolve,
67
65
  onWizardSubmit = _ref.onWizardSubmit,
@@ -115,7 +113,7 @@ var Wizard = function Wizard(_ref) {
115
113
  return setActiveStepNumber(idx);
116
114
  };
117
115
 
118
- var _handleOnClose = function handleOnClose(FormState) {
116
+ var handleOnClose = function handleOnClose() {
119
117
  if (confirmClose && FormState && FormState.dirty) {
120
118
  (0, _common.openPopUp)(_ConfirmDialog.default, {
121
119
  cancelButton: {
@@ -135,15 +133,19 @@ var Wizard = function Wizard(_ref) {
135
133
  }
136
134
  };
137
135
 
138
- var handleSubmit = function handleSubmit(values) {
139
- if (isLastStep) {
140
- onWizardSubmit(values);
141
- } else {
142
- goToNextStep();
136
+ var handleSubmit = function handleSubmit() {
137
+ FormState.handleSubmit();
138
+
139
+ if (FormState.valid) {
140
+ if (isLastStep) {
141
+ onWizardSubmit(FormState.values);
142
+ } else {
143
+ goToNextStep();
144
+ }
143
145
  }
144
146
  };
145
147
 
146
- var getDefaultActions = function getDefaultActions(FormState) {
148
+ var getDefaultActions = function getDefaultActions() {
147
149
  if (hasSteps) {
148
150
  return [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
149
151
  onClick: goToPreviousStep,
@@ -151,22 +153,20 @@ var Wizard = function Wizard(_ref) {
151
153
  label: "Back",
152
154
  type: "button"
153
155
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
154
- onClick: FormState.handleSubmit,
155
- disabled: FormState.submitting,
156
+ onClick: handleSubmit,
157
+ disabled: FormState.submitting || FormState.invalid && FormState.submitFailed,
156
158
  label: isLastStep ? submitButtonLabel : 'Next',
157
159
  type: "button",
158
160
  variant: _constants.SECONDARY_BUTTON
159
161
  })];
160
162
  } else {
161
163
  return [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
162
- onClick: function onClick() {
163
- return _handleOnClose(FormState);
164
- },
164
+ onClick: handleOnClose,
165
165
  label: "Cancel",
166
166
  type: "button"
167
167
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
168
- onClick: FormState.handleSubmit,
169
- disabled: FormState.submitting,
168
+ onClick: handleSubmit,
169
+ disabled: FormState.submitting || FormState.invalid && FormState.submitFailed,
170
170
  label: submitButtonLabel,
171
171
  type: "button",
172
172
  variant: _constants.SECONDARY_BUTTON
@@ -174,7 +174,7 @@ var Wizard = function Wizard(_ref) {
174
174
  }
175
175
  };
176
176
 
177
- var renderModalActions = function renderModalActions(FormState) {
177
+ var renderModalActions = function renderModalActions() {
178
178
  var _stepsConfig$activeSt;
179
179
 
180
180
  if ((_stepsConfig$activeSt = stepsConfig[activeStepNumber]) !== null && _stepsConfig$activeSt !== void 0 && _stepsConfig$activeSt.getActions) {
@@ -182,51 +182,37 @@ var Wizard = function Wizard(_ref) {
182
182
  FormState: FormState,
183
183
  goToNextStep: goToNextStep,
184
184
  goToPreviousStep: goToPreviousStep,
185
- handleOnClose: function handleOnClose() {
186
- return _handleOnClose(FormState);
187
- }
185
+ handleOnClose: handleOnClose,
186
+ handleSubmit: handleSubmit
188
187
  }).map(function (action) {
189
188
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread({}, action));
190
189
  });
191
190
  } else {
192
- return getDefaultActions(FormState);
191
+ return getDefaultActions();
193
192
  }
194
193
  };
195
194
 
196
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
197
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Form, {
198
- initialValues: initialValues,
199
- onSubmit: handleSubmit,
200
- children: function children(FormState) {
201
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Modal.default, {
202
- actions: renderModalActions(FormState),
203
- className: wizardClasses,
204
- onClose: function onClose() {
205
- return _handleOnClose(FormState);
206
- },
207
- show: isWizardOpen,
208
- size: size,
209
- title: title,
210
- children: [hasSteps && /*#__PURE__*/(0, _jsxRuntime.jsx)(_WizardSteps.default, {
211
- activeStepNumber: activeStepNumber,
212
- jumpToStep: jumpToStep,
213
- steps: stepsMenu
214
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
215
- className: "wizard-form__content",
216
- children: [activeStepTemplate, /*#__PURE__*/(0, _jsxRuntime.jsx)("pre", {
217
- children: JSON.stringify(FormState, null, 2)
218
- })]
219
- })]
220
- });
221
- }
222
- })
195
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Modal.default, {
196
+ actions: renderModalActions(),
197
+ className: wizardClasses,
198
+ onClose: handleOnClose,
199
+ show: isWizardOpen,
200
+ size: size,
201
+ title: title,
202
+ children: [hasSteps && /*#__PURE__*/(0, _jsxRuntime.jsx)(_WizardSteps.default, {
203
+ activeStepNumber: activeStepNumber,
204
+ jumpToStep: jumpToStep,
205
+ steps: stepsMenu
206
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
207
+ className: "wizard-form__content",
208
+ children: activeStepTemplate
209
+ })]
223
210
  });
224
211
  };
225
212
 
226
213
  Wizard.defaultProps = {
227
214
  className: '',
228
215
  confirmClose: false,
229
- initialValues: {},
230
216
  size: _constants.MODAL_MD,
231
217
  stepsConfig: [],
232
218
  submitButtonLabel: 'Submit'
@@ -234,7 +220,7 @@ Wizard.defaultProps = {
234
220
  Wizard.propsTypes = {
235
221
  className: _propTypes.default.string,
236
222
  confirmClose: _propTypes.default.bool,
237
- initialValues: _propTypes.default.object,
223
+ FormState: _propTypes.default.object.isRequired,
238
224
  isOpen: _propTypes.default.bool.isRequired,
239
225
  onResolve: _propTypes.default.func.isRequired,
240
226
  onSubmit: _propTypes.default.func.isRequired,
@@ -19,13 +19,12 @@ var _jsxRuntime = require("react/jsx-runtime");
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
- var OptionsMenu = function OptionsMenu(_ref) {
22
+ var OptionsMenu = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
23
23
  var children = _ref.children,
24
- parentElement = _ref.parentElement,
25
24
  show = _ref.show,
26
25
  timeout = _ref.timeout;
27
26
 
28
- var _ref2 = parentElement.current ? parentElement.current.getBoundingClientRect() : {},
27
+ var _ref2 = ref.current ? ref.current.getBoundingClientRect() : {},
29
28
  dropdownWidth = _ref2.width;
30
29
 
31
30
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
@@ -36,7 +35,7 @@ var OptionsMenu = function OptionsMenu(_ref) {
36
35
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PopUpDialog, {
37
36
  className: "options-menu",
38
37
  customPosition: {
39
- element: parentElement,
38
+ element: ref,
40
39
  position: 'bottom-right'
41
40
  },
42
41
  style: {
@@ -48,7 +47,7 @@ var OptionsMenu = function OptionsMenu(_ref) {
48
47
  })
49
48
  })
50
49
  });
51
- };
50
+ });
52
51
 
53
52
  OptionsMenu.defaultProps = {
54
53
  children: [],
@@ -81,7 +81,7 @@ var SelectOption = function SelectOption(_ref) {
81
81
  SelectOption.defaultProps = {
82
82
  onClick: function onClick() {},
83
83
  selectType: '',
84
- withSelectedIcon: false
84
+ withSelectedIcon: true
85
85
  };
86
86
  SelectOption.propTypes = {
87
87
  disabled: _propTypes.default.bool,
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "OptionsMenu", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _OptionsMenu.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "SelectOption", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _SelectOption.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "ValidationTemplate", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _ValidationTemplate.default;
22
+ }
23
+ });
24
+
25
+ var _OptionsMenu = _interopRequireDefault(require("./OptionsMenu/OptionsMenu"));
26
+
27
+ var _SelectOption = _interopRequireDefault(require("./SelectOption/SelectOption"));
28
+
29
+ var _ValidationTemplate = _interopRequireDefault(require("./ValidationTemplate/ValidationTemplate"));
30
+
31
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "useDetectOutsideClick", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _useDetectOutsideClick.useDetectOutsideClick;
10
+ }
11
+ });
12
+
13
+ var _useDetectOutsideClick = require("./useDetectOutsideClick");
package/dist/index.js CHANGED
@@ -5,12 +5,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.types = exports.hooks = exports.constants = exports.components = void 0;
8
+ exports.types = exports.hooks = exports.elements = exports.constants = exports.components = void 0;
9
9
 
10
10
  var components = _interopRequireWildcard(require("./components"));
11
11
 
12
12
  exports.components = components;
13
13
 
14
+ var constants = _interopRequireWildcard(require("./constants"));
15
+
16
+ exports.constants = constants;
17
+
18
+ var elements = _interopRequireWildcard(require("./elements"));
19
+
20
+ exports.elements = elements;
21
+
14
22
  var hooks = _interopRequireWildcard(require("./hooks"));
15
23
 
16
24
  exports.hooks = hooks;
@@ -19,10 +27,6 @@ var types = _interopRequireWildcard(require("./types"));
19
27
 
20
28
  exports.types = types;
21
29
 
22
- var constants = _interopRequireWildcard(require("./constants"));
23
-
24
- exports.constants = constants;
25
-
26
30
  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); }
27
31
 
28
32
  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; }
@@ -983,6 +983,10 @@
983
983
  }
984
984
 
985
985
  @mixin fieldWrapper {
986
+ display: flex;
987
+ flex: 1;
988
+ flex-flow: row nowrap;
989
+ align-items: center;
986
990
  position: relative;
987
991
  width: 100%;
988
992
  color: $primary;
@@ -990,3 +994,93 @@
990
994
  border: $primaryBorder;
991
995
  border-radius: 4px;
992
996
  }
997
+
998
+ @mixin formField {
999
+ .form-field {
1000
+ position: relative;
1001
+ display: flex;
1002
+ flex-flow: column nowrap;
1003
+ height: 100%;
1004
+ width: 100%;
1005
+
1006
+ &__label {
1007
+ margin-bottom: 5px;
1008
+ color: $topaz;
1009
+ font-size: 12px;
1010
+ text-align: left;
1011
+ text-transform: capitalize;
1012
+ background-color: transparent;
1013
+
1014
+ &-mandatory {
1015
+ color: $amaranth;
1016
+ }
1017
+
1018
+ &-disabled {
1019
+ color: $spunPearl;
1020
+
1021
+ .form-field__label-mandatory {
1022
+ color: $spunPearl;
1023
+ }
1024
+ }
1025
+ }
1026
+
1027
+ &__wrapper {
1028
+ @include fieldWrapper;
1029
+
1030
+ &-disabled {
1031
+ color: $spunPearl;
1032
+ cursor: not-allowed;
1033
+ }
1034
+
1035
+ &-invalid {
1036
+ border: $errorBorder;
1037
+ }
1038
+
1039
+ &.without-border {
1040
+ border-color: transparent;
1041
+ }
1042
+
1043
+ &-dense {
1044
+ padding-top: 12px;
1045
+ padding-bottom: 12px;
1046
+ }
1047
+
1048
+ &-normal {
1049
+ padding-top: 14px;
1050
+ padding-bottom: 14px;
1051
+ }
1052
+
1053
+ &-medium {
1054
+ padding-top: 16px;
1055
+ padding-bottom: 16px;
1056
+ }
1057
+
1058
+ &-chunky {
1059
+ padding-top: 18px;
1060
+ padding-bottom: 18px;
1061
+ }
1062
+ }
1063
+
1064
+ &__control {
1065
+ position: relative;
1066
+ display: flex;
1067
+ flex: 1;
1068
+ overflow: hidden;
1069
+ padding: 0 8px 0 16px;
1070
+ }
1071
+
1072
+ &__icons {
1073
+ display: flex;
1074
+ flex-shrink: 0;
1075
+ align-items: center;
1076
+ margin-right: 4px;
1077
+ min-height: 25px;
1078
+
1079
+ & > * {
1080
+ display: flex;
1081
+ align-items: center;
1082
+ padding: 0 4px;
1083
+ }
1084
+ }
1085
+ }
1086
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iguazio.dashboard-react-controls",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
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",
@@ -26,8 +26,8 @@
26
26
  "react-dom": "*",
27
27
  "react-modal-promise": "*",
28
28
  "react-transition-group": "*",
29
- "final-form": "^4.20.7",
30
- "react-final-form": "^6.5.9"
29
+ "final-form": "*",
30
+ "react-final-form": "*"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@babel/cli": "^7.17.6",