intelicoreact 1.0.77 → 1.0.79

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.
@@ -86,6 +86,7 @@ var Dropdown = function Dropdown(_ref) {
86
86
 
87
87
  var dropdownRef = (0, _react.useRef)(null);
88
88
  var dropdownListRef = (0, _react.useRef)(null);
89
+ var searchInputRef = (0, _react.useRef)(null);
89
90
 
90
91
  var _useState7 = (0, _react.useState)(null),
91
92
  _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
@@ -149,7 +150,6 @@ var Dropdown = function Dropdown(_ref) {
149
150
 
150
151
  var onChangeHandler = function onChangeHandler(item) {
151
152
  setIsOpen(false);
152
- setSearchValue(null);
153
153
  onChange(item.value);
154
154
  }; // decorator
155
155
 
@@ -364,16 +364,17 @@ var Dropdown = function Dropdown(_ref) {
364
364
  (0, _react.useLayoutEffect)(function () {
365
365
  window.addEventListener('resize', setListContainerStyles);
366
366
  window.addEventListener('mousewheel', closeList);
367
+ window.addEventListener('touchmove', closeList);
367
368
  return function () {
368
369
  window.removeEventListener('resize', setListContainerStyles);
369
370
  window.removeEventListener('mousewheel', closeList);
371
+ window.removeEventListener('touchmove', closeList);
370
372
  };
371
373
  }, [getListContainer]);
372
374
  (0, _react.useEffect)(function () {
373
375
  setListContainerStyles();
374
376
  }, [isOpen, searchValue]);
375
377
  (0, _react.useEffect)(function () {
376
- if (!value) setSearchValue(null);
377
378
  document.addEventListener('click', handleClickOutside, true);
378
379
  return function () {
379
380
  return document.removeEventListener('click', handleClickOutside, true);
@@ -402,7 +403,12 @@ var Dropdown = function Dropdown(_ref) {
402
403
  };
403
404
 
404
405
  (0, _react.useEffect)(function () {
405
- if (isOpen && isSearching) setSearchValue(selectedLabel);
406
+ if (isOpen && isSearching) {
407
+ setSearchValue(selectedLabel);
408
+ setTimeout(function () {
409
+ return searchInputRef.current.select();
410
+ }, 1);
411
+ }
406
412
  }, [isSearching]);
407
413
  var postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(function (option) {
408
414
  return option.value === value;
@@ -429,26 +435,28 @@ var Dropdown = function Dropdown(_ref) {
429
435
  return !isFocusedByClick ? setIsOpen(true) : null;
430
436
  }
431
437
  }, isSearchable ? /*#__PURE__*/_react.default.createElement("input", {
438
+ ref: searchInputRef,
432
439
  className: "".concat(RC, "__input"),
433
440
  value: isSearching ? searchValue !== null && searchValue !== void 0 ? searchValue : '' : selectedLabel || '',
434
441
  onChange: function onChange(e) {
435
- console.log({
436
- searchValue: searchValue,
437
- selectedLabel: selectedLabel
438
- });
439
- setIsSearching(true);
440
- onSearchHandler(e.target.value);
442
+ return onSearchHandler(e.target.value);
441
443
  },
442
444
  placeholder: placeholder,
443
445
  onFocus: function onFocus(e) {
444
- e.target.select();
446
+ if (!isOpen) {
447
+ e.preventDefault();
448
+ e.stopPropagation();
449
+ e.target.blur();
450
+ return;
451
+ } else {
452
+ setIsSearching(true);
453
+ }
445
454
  },
446
455
  onBlur: function onBlur() {
447
- setSearchValue(null);
448
- setIsSearching(false);
456
+ return setIsSearching(false);
449
457
  },
450
458
  onClick: function onClick() {
451
- return setIsOpen(!isOpen);
459
+ if (!isOpen) setIsOpen(true);
452
460
  }
453
461
  }) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
454
462
  className: "text"
@@ -43,7 +43,6 @@
43
43
  justify-content: space-between;
44
44
 
45
45
  box-sizing: border-box;
46
- width: fit-content;
47
46
  height: 100%;
48
47
 
49
48
  text-decoration: none;
@@ -21,17 +21,14 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
21
21
  error = _ref.error,
22
22
  isRequired = _ref.isRequired,
23
23
  accept = _ref.accept,
24
- onChange = _ref.onChange,
24
+ _onChange = _ref.onChange,
25
25
  className = _ref.className,
26
26
  value = _ref.value,
27
27
  isNoTrashIcon = _ref.isNoTrashIcon;
28
28
 
29
29
  var getFileName = function getFileName(value) {
30
30
  var result = value.match(/[^\\]+$/);
31
- return onChange({
32
- value: result[0],
33
- id: id
34
- });
31
+ return result[0];
35
32
  };
36
33
 
37
34
  var renderRequiredLabel = function renderRequiredLabel() {
@@ -48,7 +45,11 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
48
45
  className: (0, _classnames.default)('file-loader-local', className)
49
46
  }, /*#__PURE__*/_react.default.createElement("input", {
50
47
  onChange: function onChange(e) {
51
- return getFileName(e.target.value);
48
+ return _onChange({
49
+ name: getFileName(e.target.value),
50
+ e: e,
51
+ id: id
52
+ });
52
53
  },
53
54
  className: "file-loader-local__file-input",
54
55
  id: "file-input-".concat(id),
@@ -76,7 +77,7 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
76
77
  }, error))), value && !isNoTrashIcon && /*#__PURE__*/_react.default.createElement(_reactFeather.Trash2, {
77
78
  className: "file-loader-local__trash-icon",
78
79
  onClick: function onClick() {
79
- return onChange({
80
+ return _onChange({
80
81
  id: id
81
82
  });
82
83
  }
@@ -87,7 +87,8 @@ var InputDateRange = function InputDateRange(props) {
87
87
  isCompare = _useState4[0],
88
88
  setIsCompare = _useState4[1];
89
89
 
90
- var ref = !isUseAbs ? (0, _dependencies.useClickOutside)(toggleOff) : (0, _react.useRef)(null);
90
+ var dropdownContainers = document.getElementsByClassName('dropdown__container');
91
+ var ref = !isUseAbs ? (0, _dependencies.useClickOutside)(toggleOff, dropdownContainers) : (0, _react.useRef)(null);
91
92
  var internalContainerRef = (0, _react.useRef)(null);
92
93
 
93
94
  var handleChange = function handleChange(input) {
@@ -31,9 +31,23 @@ var useClickOutside = function useClickOutside(hideComponent, additionalComponen
31
31
  var ref = (0, _react.useRef)(null);
32
32
 
33
33
  var checkCondition = function checkCondition(target) {
34
- var _ref$current, _ref$current2;
34
+ if (additionalComponent) {
35
+ if (additionalComponent !== null && additionalComponent !== void 0 && additionalComponent.length) {
36
+ var _ref$current, _Array$from;
35
37
 
36
- return additionalComponent ? !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(target)) && !(additionalComponent !== null && additionalComponent !== void 0 && additionalComponent.contains(target)) : !((_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.contains(target));
38
+ return !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(target)) && !((_Array$from = Array.from(additionalComponent)) !== null && _Array$from !== void 0 && _Array$from.some(function (item) {
39
+ return item === null || item === void 0 ? void 0 : item.contains(target);
40
+ }));
41
+ } else {
42
+ var _ref$current2;
43
+
44
+ return !((_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.contains(target)) && !(additionalComponent !== null && additionalComponent !== void 0 && additionalComponent.contains(target));
45
+ }
46
+ } else {
47
+ var _ref$current3;
48
+
49
+ return !((_ref$current3 = ref.current) !== null && _ref$current3 !== void 0 && _ref$current3.contains(target));
50
+ }
37
51
  };
38
52
 
39
53
  var handleClickOutside = (0, _react.useCallback)(function (_ref) {
@@ -422,10 +422,11 @@ function InputMask2() {
422
422
  };
423
423
 
424
424
  var onKeyDown = function onKeyDown(e) {
425
- var _getCharByIndex2, _getCharByIndex4;
425
+ var _getCharByIndex2;
426
426
 
427
427
  onKeyDownProp === null || onKeyDownProp === void 0 ? void 0 : onKeyDownProp(e);
428
- var keyCode = e.keyCode;
428
+ var keyCode = e.keyCode,
429
+ key = e.key;
429
430
  var cursor = e.target.selectionStart;
430
431
 
431
432
  if (keyCode === 36) {
@@ -449,26 +450,50 @@ function InputMask2() {
449
450
  return;
450
451
  }
451
452
 
452
- if (keyCode === 8 && (_getCharByIndex4 = getCharByIndex(cursor - 1)) !== null && _getCharByIndex4 !== void 0 && _getCharByIndex4.isSpecialSymbol) {
453
- e.preventDefault();
454
- e.stopPropagation();
453
+ if (keyCode === 8) {
454
+ var _getCharByIndex4;
455
+
456
+ if ((_getCharByIndex4 = getCharByIndex(cursor - 1)) !== null && _getCharByIndex4 !== void 0 && _getCharByIndex4.isSpecialSymbol) {
457
+ e.preventDefault();
458
+ e.stopPropagation();
455
459
 
456
- while ((_getCharByIndex5 = getCharByIndex(cursor - 1)) !== null && _getCharByIndex5 !== void 0 && _getCharByIndex5.isSpecialSymbol && cursor > 0) {
457
- var _getCharByIndex5;
460
+ while ((_getCharByIndex5 = getCharByIndex(cursor - 1)) !== null && _getCharByIndex5 !== void 0 && _getCharByIndex5.isSpecialSymbol && cursor > 0) {
461
+ var _getCharByIndex5;
458
462
 
459
- --cursor;
463
+ --cursor;
464
+ }
465
+
466
+ setCursor(cursor);
467
+ return;
468
+ } else {
469
+ if (cursor >= 1) setCursor(cursor - 1);
470
+ return;
460
471
  }
472
+ }
461
473
 
474
+ if (keyCode === 46) {
462
475
  setCursor(cursor);
463
476
  return;
464
477
  }
465
478
 
466
- if (keyCode === 46) {
467
- setCursor(cursor);
479
+ if (cursor > maxEditableIndex) {
480
+ setCursor(maxEditableIndex);
468
481
  return;
469
482
  }
470
483
 
471
- if (cursor > maxEditableIndex) setCursor(maxEditableIndex);
484
+ if (isValidChar({
485
+ char: key,
486
+ i: cursor,
487
+ disableErrors: true
488
+ })) {
489
+ while ((_getCharByIndex6 = getCharByIndex(cursor + 1)) !== null && _getCharByIndex6 !== void 0 && _getCharByIndex6.isSpecialSymbol && cursor < maxEditableIndex) {
490
+ var _getCharByIndex6;
491
+
492
+ ++cursor;
493
+ }
494
+
495
+ setCursor(cursor + 1);
496
+ }
472
497
  };
473
498
 
474
499
  var onKeyUp = function onKeyUp(e) {
@@ -55,6 +55,8 @@ var RangeList = function RangeList(props) {
55
55
  error = props.error,
56
56
  defaultErrorText = props.defaultErrorText,
57
57
  nullValueText = props.nullValueText,
58
+ _props$isOnlyOneRow = props.isOnlyOneRow,
59
+ isOnlyOneRow = _props$isOnlyOneRow === void 0 ? false : _props$isOnlyOneRow,
58
60
  testId = props.testId;
59
61
  var NULL_VALUE_TEXT = nullValueText !== null && nullValueText !== void 0 ? nullValueText : 'No data';
60
62
 
@@ -76,6 +78,7 @@ var RangeList = function RangeList(props) {
76
78
  var inputFromRef = (0, _react.useRef)(null);
77
79
  var inputToRef = (0, _react.useRef)(null);
78
80
  var isValidRange = !!(state !== null && state !== void 0 && state.from && state !== null && state !== void 0 && state.to && +(state === null || state === void 0 ? void 0 : state.from) <= +(state === null || state === void 0 ? void 0 : state.to));
81
+ var isShowRow = isOnlyOneRow && (value === null || value === void 0 ? void 0 : value.length) === 0 || !isOnlyOneRow;
79
82
  var handle = {
80
83
  inputsChange: function inputsChange(val, prop) {
81
84
  return setState(_objectSpread(_objectSpread({}, state), {}, (0, _defineProperty2.default)({}, prop, val)));
@@ -126,6 +129,60 @@ var RangeList = function RangeList(props) {
126
129
  if (code === 13) inputToRef.current.blur();
127
130
  }
128
131
  };
132
+
133
+ var renderInputsAndAddButtonRow = function renderInputsAndAddButtonRow() {
134
+ return /*#__PURE__*/_react.default.createElement("div", {
135
+ className: (0, _classnames.default)("".concat(RC, "__row"), "".concat(RC, "__inputs"))
136
+ }, /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
137
+ className: "".concat(RC, "__cell-input")
138
+ }, /*#__PURE__*/_react.default.createElement(_Input.default, {
139
+ testId: "range-list".concat(testId && "--".concat(testId), "-from"),
140
+ ref: inputFromRef,
141
+ onlyNumbers: isFloatValues ? {
142
+ type: 'float',
143
+ decimalPlaces: decimalPlaces || 0
144
+ } : {
145
+ type: 'int'
146
+ },
147
+ value: state.from,
148
+ onBlur: function onBlur(e) {
149
+ return handle.rangeValidation(e, 'from');
150
+ },
151
+ onChange: function onChange(val) {
152
+ return handle.inputsChange(val, 'from');
153
+ },
154
+ onKeyUp: function onKeyUp(code) {
155
+ return handle.onKeyUpFromInput(code);
156
+ }
157
+ })), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
158
+ className: "".concat(RC, "__cell-input")
159
+ }, /*#__PURE__*/_react.default.createElement(_Input.default, {
160
+ testId: "range-list".concat(testId && "--".concat(testId), "-to"),
161
+ ref: inputToRef,
162
+ onlyNumbers: isFloatValues ? {
163
+ type: 'float',
164
+ decimalPlaces: decimalPlaces || 0
165
+ } : {
166
+ type: 'int'
167
+ },
168
+ value: state.to,
169
+ onBlur: function onBlur(e) {
170
+ return handle.rangeValidation(e, 'to');
171
+ },
172
+ onChange: function onChange(val) {
173
+ return handle.inputsChange(val, 'to');
174
+ },
175
+ onKeyUp: function onKeyUp(code) {
176
+ return handle.onKeyUpToInput(code);
177
+ }
178
+ })), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
179
+ className: "".concat(RC, "__cell-button")
180
+ }, /*#__PURE__*/_react.default.createElement(_Button.default, {
181
+ testId: "range-list".concat(testId && "--".concat(testId), "-button"),
182
+ onClick: handle.addRange
183
+ }, "Add")));
184
+ };
185
+
129
186
  return /*#__PURE__*/_react.default.createElement("div", {
130
187
  className: (0, _classnames.default)(RC, className, (0, _defineProperty2.default)({}, "".concat(RC, "_disabled"), disabled))
131
188
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -134,56 +191,7 @@ var RangeList = function RangeList(props) {
134
191
  className: "".concat(RC, "__cell-label")
135
192
  }, "From"), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
136
193
  className: "".concat(RC, "__cell-label")
137
- }, "To")), /*#__PURE__*/_react.default.createElement("div", {
138
- className: (0, _classnames.default)("".concat(RC, "__row"), "".concat(RC, "__inputs"))
139
- }, /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
140
- className: "".concat(RC, "__cell-input")
141
- }, /*#__PURE__*/_react.default.createElement(_Input.default, {
142
- testId: "range-list".concat(testId && "--".concat(testId), "-from"),
143
- ref: inputFromRef,
144
- onlyNumbers: isFloatValues ? {
145
- type: 'float',
146
- decimalPlaces: decimalPlaces || 0
147
- } : {
148
- type: 'int'
149
- },
150
- value: state.from,
151
- onBlur: function onBlur(e) {
152
- return handle.rangeValidation(e, 'from');
153
- },
154
- onChange: function onChange(val) {
155
- return handle.inputsChange(val, 'from');
156
- },
157
- onKeyUp: function onKeyUp(code) {
158
- return handle.onKeyUpFromInput(code);
159
- }
160
- })), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
161
- className: "".concat(RC, "__cell-input")
162
- }, /*#__PURE__*/_react.default.createElement(_Input.default, {
163
- testId: "range-list".concat(testId && "--".concat(testId), "-to"),
164
- ref: inputToRef,
165
- onlyNumbers: isFloatValues ? {
166
- type: 'float',
167
- decimalPlaces: decimalPlaces || 0
168
- } : {
169
- type: 'int'
170
- },
171
- value: state.to,
172
- onBlur: function onBlur(e) {
173
- return handle.rangeValidation(e, 'to');
174
- },
175
- onChange: function onChange(val) {
176
- return handle.inputsChange(val, 'to');
177
- },
178
- onKeyUp: function onKeyUp(code) {
179
- return handle.onKeyUpToInput(code);
180
- }
181
- })), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
182
- className: "".concat(RC, "__cell-button")
183
- }, /*#__PURE__*/_react.default.createElement(_Button.default, {
184
- testId: "range-list".concat(testId && "--".concat(testId), "-button"),
185
- onClick: handle.addRange
186
- }, "Add"))), (innerError || outerError || error) && /*#__PURE__*/_react.default.createElement("span", {
194
+ }, "To")), isShowRow && renderInputsAndAddButtonRow(), (innerError || outerError || error) && /*#__PURE__*/_react.default.createElement("span", {
187
195
  className: "".concat(RC, "__error")
188
196
  }, innerError || error || outerError), !(value !== null && value !== void 0 && value.length) && /*#__PURE__*/_react.default.createElement("div", {
189
197
  className: (0, _classnames.default)("".concat(RC, "__row"), "".concat(RC, "__values"), "".concat(RC, "__null-value"))
@@ -196,7 +196,9 @@ var TieredCheckboxes = function TieredCheckboxes(_ref) {
196
196
  var disabled = _ref4.disabled;
197
197
  return disabled === true;
198
198
  }) || parent.disabled
199
- }), renderInner(parent));
199
+ }), /*#__PURE__*/_react.default.createElement("div", {
200
+ className: (0, _classnames.default)("".concat(RC, "__parent__children"))
201
+ }, renderInner(parent)));
200
202
  }));
201
203
  };
202
204
 
@@ -1,6 +1,10 @@
1
1
  .tiered-checkboxes {
2
2
  &__parents {
3
3
  margin-bottom: 25px;
4
+
5
+ & > label {
6
+ display: inline-flex;
7
+ }
4
8
  }
5
9
 
6
10
  &__children {
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ require("./Box.scss");
15
+
16
+ // global
17
+ // styles
18
+ var directionVariants = {
19
+ column: 'column',
20
+ row: 'row'
21
+ };
22
+ var sizes = {
23
+ none: 'none',
24
+ xs: 'xs',
25
+ s: 's',
26
+ m: 'm',
27
+ l: 'l',
28
+ xl: 'xl'
29
+ };
30
+
31
+ var Box = function Box(_ref) {
32
+ var children = _ref.children,
33
+ _ref$paddingVariant = _ref.paddingVariant,
34
+ paddingVariant = _ref$paddingVariant === void 0 ? sizes.m : _ref$paddingVariant,
35
+ _ref$radiiVariant = _ref.radiiVariant,
36
+ radiiVariant = _ref$radiiVariant === void 0 ? sizes.s : _ref$radiiVariant,
37
+ _ref$direction = _ref.direction,
38
+ direction = _ref$direction === void 0 ? directionVariants.column : _ref$direction,
39
+ className = _ref.className;
40
+ var styles = {
41
+ flexDirection: direction
42
+ };
43
+ return /*#__PURE__*/_react.default.createElement("div", {
44
+ style: styles,
45
+ className: (0, _classnames.default)('box', "box--padding-".concat(paddingVariant), "box--radii-".concat(radiiVariant), className, {
46
+ df: direction === directionVariants.row,
47
+ 'dfc-jc': direction === directionVariants.column
48
+ })
49
+ }, children);
50
+ };
51
+
52
+ var _default = Box;
53
+ exports.default = _default;
@@ -0,0 +1,58 @@
1
+ @import '../../../scss/_vars';
2
+
3
+ .box {
4
+ box-sizing: border-box;
5
+ height: fit-content;
6
+
7
+ border: 1px solid #E1E8F1;
8
+
9
+ &--radii-none {
10
+ border-radius: 0;
11
+ }
12
+
13
+
14
+ &--radii-xs {
15
+ border-radius: $radii-xs;
16
+ }
17
+
18
+ &--radii-s {
19
+ border-radius: $radii-s;
20
+ }
21
+
22
+ &--radii-m {
23
+ border-radius: $radii-m;
24
+ }
25
+
26
+ &--radii-l {
27
+ border-radius: $radii-l;
28
+ }
29
+
30
+ &--radii-xl {
31
+ border-radius: $radii-xl;
32
+ }
33
+
34
+ &--padding-none {
35
+ padding: 0;
36
+ }
37
+
38
+
39
+ &--padding-xs {
40
+ padding: $spacing-xs;
41
+ }
42
+
43
+ &--padding-s {
44
+ padding: $spacing-s;
45
+ }
46
+
47
+ &--padding-m {
48
+ padding: $spacing-m;
49
+ }
50
+
51
+ &--padding-l {
52
+ padding: $spacing-l;
53
+ }
54
+
55
+ &--padding-xl {
56
+ padding: $spacing-xl;
57
+ }
58
+ }
@@ -2,6 +2,19 @@
2
2
  //@import "anme/scss/anme-vars";
3
3
  @import "~anme/scss/anme-vars";
4
4
 
5
+ $radii-xs: 4px;
6
+ $radii-s: 8px;
7
+ $radii-m: 16px;
8
+ $radii-l: 24px;
9
+ $radii-xl: 32px;
10
+
11
+
12
+ $spacing-xs: 4px;
13
+ $spacing-s: 8px;
14
+ $spacing-m: 16px;
15
+ $spacing-l: 24px;
16
+ $spacing-xl: 32px;
17
+
5
18
  /* THEME COLORS */
6
19
 
7
20
  $color--secondary: #F06D8D;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.0.77",
3
+ "version": "1.0.79",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [