intelicoreact 1.1.77 → 1.1.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.
@@ -23,6 +23,8 @@ var _useDebounce = require("../../../Functions/useDebounce");
23
23
 
24
24
  var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
25
25
 
26
+ var _utils = require("../../../Functions/utils");
27
+
26
28
  var _Spinner = _interopRequireDefault(require("../../Layout/Spinner/Spinner"));
27
29
 
28
30
  require("./DropdownLiveSearch.scss");
@@ -32,9 +34,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
32
34
  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; }
33
35
 
34
36
  var RC = 'dropdown-live-search';
35
- var notReact = {
36
- searchValue: ''
37
- };
38
37
 
39
38
  var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
40
39
  var value = _ref.value,
@@ -80,20 +79,26 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
80
79
  searchValue = _useState6[0],
81
80
  setSV = _useState6[1];
82
81
 
83
- var setSearchValue = function setSearchValue(val) {
84
- setSV(val);
85
- notReact.searchValue = val;
86
- };
82
+ var _useState7 = (0, _react.useState)(options),
83
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
84
+ previousOptions = _useState8[0],
85
+ setPreviousOptions = _useState8[1];
87
86
 
88
87
  var dropdownLiveSearchRef = (0, _react.useRef)(null);
89
88
  var dropdownListBoxRef = (0, _react.useRef)(null);
90
89
  var dropdownListRef = (0, _react.useRef)(null);
91
90
  var searchInputRef = (0, _react.useRef)(null);
91
+ var searchValueRef = (0, _react.useRef)(labelByValue);
92
92
 
93
- var _useState7 = (0, _react.useState)(false),
94
- _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
95
- isFocusedByClick = _useState8[0],
96
- setIsFocusedByClick = _useState8[1];
93
+ var setSearchValue = function setSearchValue(val) {
94
+ setSV(val);
95
+ searchValueRef.current = val;
96
+ };
97
+
98
+ var _useState9 = (0, _react.useState)(false),
99
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
100
+ isFocusedByClick = _useState10[0],
101
+ setIsFocusedByClick = _useState10[1];
97
102
 
98
103
  var debouncedSearchTerm = (0, _useDebounce.useDebounce)({
99
104
  searchValue: searchValue,
@@ -245,8 +250,8 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
245
250
  }, [dropdownLiveSearchRef, isOpen]);
246
251
  var doScrollCallback = (0, _react.useCallback)(function (e) {
247
252
  if (doRequest && typeof doRequest === 'function') {
248
- if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
249
- doRequest(notReact.searchValue, true);
253
+ if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight && (0, _utils.compare)(options, previousOptions)) {
254
+ doRequest(searchValueRef.current, true);
250
255
  }
251
256
  }
252
257
  }, [options]);
@@ -261,6 +266,9 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
261
266
  removeEventListener('scroll', doScrollCallback);
262
267
  };
263
268
  }, [isOpen, dropdownListRef]);
269
+ (0, _react.useEffect)(function () {
270
+ setPreviousOptions(options);
271
+ }, [options]);
264
272
  return /*#__PURE__*/_react.default.createElement("div", {
265
273
  className: (0, _classnames.default)(RC, className, disabled),
266
274
  ref: dropdownLiveSearchRef
@@ -130,7 +130,7 @@ var Modal = function Modal(_ref2) {
130
130
  }, !noHeader && /*#__PURE__*/_react.default.createElement(_ModalTitle.default, {
131
131
  variant: variant,
132
132
  isForced: forced,
133
- onClose: closeModal,
133
+ onClose: handle.decline,
134
134
  noHeaderCloseBtn: noHeaderCloseBtn
135
135
  }, /*#__PURE__*/_react.default.createElement("span", null, renderModalTitle({
136
136
  mode: mode,
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MASK_PRESET = void 0;
7
+
8
+ /**
9
+ * @param type: 'inputMask',
10
+ * @param maskPattern: 'DD.DD.DDDD',
11
+ * @param maskPatternPlaceholder: 'MM.DD.YYYY',
12
+ * @param usePatternPlaceholder: true,
13
+ * @param isNumericMobileKeyboard: true,
14
+ * @param blinkErrors: true,
15
+ * @param showErrors: false,
16
+ * @param autocomplete: 'bday',
17
+ * @param focusSelector: 'input',
18
+ */
19
+ var DATE_PRESET = {
20
+ type: 'inputMask',
21
+ maskPattern: 'DD.DD.DDDD',
22
+ maskPatternPlaceholder: 'MM.DD.YYYY',
23
+ usePatternPlaceholder: true,
24
+ isNumericMobileKeyboard: true,
25
+ blinkErrors: true,
26
+ showErrors: false,
27
+ autocomplete: 'bday',
28
+ focusSelector: 'input'
29
+ };
30
+ /**
31
+ * @param type: 'inputMask',
32
+ * @param maskPattern: 'DDDDD',
33
+ * @param maskPlaceholder: 'X',
34
+ * @param isNumericMobileKeyboard: true,
35
+ * @param blinkErrors: true,
36
+ * @param showErrors: false,
37
+ * @param focusSelector: 'input',
38
+ * @param autocomplete: 'postal-code',
39
+ * @param rules: 'fieldZip'
40
+ */
41
+
42
+ var ZIP_PRESET = {
43
+ type: 'inputMask',
44
+ focusSelector: 'input',
45
+ maskPattern: 'DDDDD',
46
+ maskPlaceholder: 'X',
47
+ isNumericMobileKeyboard: true,
48
+ blinkErrors: true,
49
+ showErrors: false,
50
+ autocomplete: 'postal-code',
51
+ rules: 'fieldZip'
52
+ };
53
+ /**
54
+ * @param type: 'inputMask',
55
+ * @param maskPattern: 'DDDDDDDDD',
56
+ * @param maskPlaceholder: 'X',
57
+ * @param isNumericMobileKeyboard: true,
58
+ * @param blinkErrors: true,
59
+ * @param showErrors: false,
60
+ * @param focusSelector: 'input',
61
+ */
62
+
63
+ var SSN_PRESET = {
64
+ type: 'inputMask',
65
+ maskPattern: 'DDDDDDDDD',
66
+ maskPlaceholder: 'X',
67
+ focusSelector: 'input',
68
+ isNumericMobileKeyboard: true,
69
+ blinkErrors: true,
70
+ showErrors: false
71
+ };
72
+ /**
73
+ * @param type: 'inputMask',
74
+ * @param maskPattern: 'DDD-DDD-DDDD',
75
+ * @param maskPlaceholder: 'X',
76
+ * @param isNumericMobileKeyboard: true,
77
+ * @param blinkErrors: true,
78
+ * @param showErrors: false,
79
+ * @param focusSelector: 'input',
80
+ * @param autocomplete: 'tel-national',
81
+ */
82
+
83
+ var MOBILE_PHONE_PRESET = {
84
+ type: 'inputMask',
85
+ maskPattern: 'DDD-DDD-DDDD',
86
+ maskPlaceholder: 'X',
87
+ focusSelector: 'input',
88
+ isNumericMobileKeyboard: true,
89
+ blinkErrors: true,
90
+ showErrors: false,
91
+ autocomplete: 'tel-national'
92
+ };
93
+ /**
94
+ * @param type: 'inputMask3',
95
+ * @param maskPattern: 'DDDD',
96
+ * @param maskPlaceholder: 'X',
97
+ * @param isNumericMobileKeyboard: true,
98
+ * @param blinkErrors: true,
99
+ * @param showErrors: false,
100
+ */
101
+
102
+ var SHORT_SSN_PRESET = {
103
+ type: 'inputMask3',
104
+ maskPattern: 'DDDD',
105
+ maskPlaceholder: 'X',
106
+ focusSelector: 'input',
107
+ isNumericMobileKeyboard: true,
108
+ blinkErrors: true,
109
+ showErrors: false
110
+ };
111
+ /**
112
+ * @param type: 'inputMask',
113
+ * @param maskPattern: 'DDDDDDDDD',
114
+ * @param maskPlaceholder: 'X',
115
+ * @param isNumericMobileKeyboard: true,
116
+ * @param blinkErrors: true,
117
+ * @param showErrors: false,
118
+ */
119
+
120
+ var ABA_PRESET = {
121
+ type: 'inputMask',
122
+ maskPattern: 'DDDDDDDDD',
123
+ maskPlaceholder: 'X',
124
+ isNumericMobileKeyboard: true,
125
+ blinkErrors: true,
126
+ showErrors: false
127
+ };
128
+ /**
129
+ * @param type: 'inputMask',
130
+ * @param maskPattern: 'MM/YY',
131
+ * @param maskPatternPlaceholder: 'MM/YY',
132
+ * @param usePatternPlaceholder: true,
133
+ * @param isNumericMobileKeyboard: true,
134
+ * @param blinkErrors: true,
135
+ * @param showErrors: false,
136
+ * @param focusSelector: 'input',
137
+ */
138
+
139
+ var CC_EXPIRATION_DATE = {
140
+ type: 'inputMask',
141
+ maskPattern: 'MM/YY',
142
+ maskPatternPlaceholder: 'MM/YY',
143
+ usePatternPlaceholder: true,
144
+ isNumericMobileKeyboard: true,
145
+ blinkErrors: true,
146
+ showErrors: false,
147
+ focusSelector: 'input'
148
+ };
149
+ /**
150
+ * @param type: 'inputMask',
151
+ * @param maskPattern: 'DDDDDDDDDD',
152
+ * @param maskPlaceholder: 'X',
153
+ * @param isNumericMobileKeyboard: true,
154
+ * @param blinkErrors: true,
155
+ * @param showErrors: false,
156
+ */
157
+
158
+ var BANK_ACCOUNT = {
159
+ type: 'inputMask',
160
+ maskPattern: 'DDDDDDDDDD',
161
+ maskPlaceholder: 'X',
162
+ isNumericMobileKeyboard: true,
163
+ blinkErrors: true,
164
+ showErrors: false
165
+ };
166
+ var MASK_PRESET = {
167
+ BANK_ACCOUNT: BANK_ACCOUNT,
168
+ CC_EXPIRATION_DATE: CC_EXPIRATION_DATE,
169
+ DATE_PRESET: DATE_PRESET,
170
+ ZIP_PRESET: ZIP_PRESET,
171
+ SSN_PRESET: SSN_PRESET,
172
+ MOBILE_PHONE_PRESET: MOBILE_PHONE_PRESET,
173
+ SHORT_SSN_PRESET: SHORT_SSN_PRESET,
174
+ ABA_PRESET: ABA_PRESET
175
+ };
176
+ exports.MASK_PRESET = MASK_PRESET;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.INPUT_PRESET = void 0;
7
+
8
+ /**
9
+ * @name fieldChangesMiddleware
10
+ * @description Обрабатывает входящую строку, удаляет все символы, которые не являются
11
+ * алфавитными, дефисами, апострофами или пробелами.
12
+ * Удаляет недопустимые символы в начале и конце строки.
13
+ *
14
+ * @param {string} value - Входная строка для обработки.
15
+ * @returns {string} - Обработанная строка.
16
+ */
17
+ var NAME_SYMBOLS_EXCLUDER = {
18
+ processString: function processString(value) {
19
+ var invalidCharacters = new RegExp(/[^a-zA-Z-'`\s]/g);
20
+ var invalidFirstAndLastCharacters = new RegExp(/^[`\-'\s]+|[`\-'\s]+$/g);
21
+ var safeValue = getSafelyValue(value);
22
+ return safeValue.replace(invalidCharacters, '').replace(invalidFirstAndLastCharacters, '');
23
+ }
24
+ };
25
+ /**
26
+ * @name fieldChangesMiddleware
27
+ * @description Обрабатывает входную строку, удаляет все неалфавитные символы, заменяет двойные дефисы на одинарные
28
+ * и удаляет все дефисы в начале или конце строки.
29
+ * @param {string} value - входная строка для обработки
30
+ * @returns {string} обработанная строка
31
+ */
32
+
33
+ var ONLY_STRING_AND_DASH = {
34
+ fieldChangesMiddleware: function fieldChangesMiddleware(value) {
35
+ var nonAlphabeticAndNotSingleDash = new RegExp(/[^a-zA-Z-]|--/gi);
36
+ var consecutiveDashes = new RegExp(/-+/g);
37
+ var sanitizedInput = getSafelyValue(value);
38
+ return sanitizedInput.replace(nonAlphabeticAndNotSingleDash, '').replace(consecutiveDashes, '-');
39
+ }
40
+ };
41
+ var INPUT_PRESET = {
42
+ NAME_SYMBOLS_EXCLUDER: NAME_SYMBOLS_EXCLUDER,
43
+ ONLY_STRING_AND_DASH: ONLY_STRING_AND_DASH
44
+ };
45
+ exports.INPUT_PRESET = INPUT_PRESET;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.1.77",
3
+ "version": "1.1.79",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [