intelicoreact 0.2.99 → 0.3.2
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.
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +10 -8
- package/dist/Atomic/FormElements/Input/Input.js +1 -1
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +3 -1
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +1 -1
- package/dist/Atomic/FormElements/InputMask/InputMask.js +1 -1
- package/dist/Atomic/FormElements/InputMask/functions.js +3 -1
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +1 -1
- package/dist/Atomic/FormElements/InputMask2/functions.js +3 -1
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +1 -1
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +3 -1
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +22 -9
- package/dist/Atomic/FormElements/RangeList/RangeList.js +9 -6
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +1 -7
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +3 -1
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +7 -3
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +4 -1
- package/dist/Atomic/FormElements/Textarea/Textarea.js +6 -5
- package/dist/Atomic/UI/Button/Button.js +1 -1
- package/dist/Atomic/UI/Modal/Modal.js +1 -1
- package/dist/Atomic/UI/Price/Price.js +1 -1
- package/dist/Classes/AbortableFetch.js +3 -1
- package/dist/Functions/fieldValueFormatters.js +21 -15
- package/dist/Functions/useLocationParams.js +3 -1
- package/dist/Functions/usePasswordChecker.js +4 -4
- package/package.json +1 -1
|
@@ -30,30 +30,32 @@ var CheckboxesLine = function CheckboxesLine(props) {
|
|
|
30
30
|
value = _ref.value,
|
|
31
31
|
disabled = _ref.disabled,
|
|
32
32
|
isPositionColumn = _ref.isPositionColumn,
|
|
33
|
-
className = _ref.className
|
|
33
|
+
className = _ref.className,
|
|
34
|
+
testId = _ref.testId;
|
|
34
35
|
|
|
35
|
-
var handleChange = function handleChange(val, id
|
|
36
|
-
onChange(val ? [].concat((0, _toConsumableArray2.default)(value), [id]) : (0, _toConsumableArray2.default)(value.filter(function (el) {
|
|
36
|
+
var handleChange = function handleChange(val, id) {
|
|
37
|
+
onChange(val ? [].concat((0, _toConsumableArray2.default)(value), [id]) : (0, _toConsumableArray2.default)(value === null || value === void 0 ? void 0 : value.filter(function (el) {
|
|
37
38
|
return el !== id;
|
|
38
39
|
})));
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
42
43
|
className: (0, _classnames.default)(RC, (0, _defineProperty2.default)({}, "".concat(RC, "_column"), isPositionColumn), className)
|
|
43
|
-
}, (items === null || items === void 0 ? void 0 : items.map(function (item
|
|
44
|
+
}, (items === null || items === void 0 ? void 0 : items.map(function (item) {
|
|
44
45
|
var _value$includes;
|
|
45
46
|
|
|
46
|
-
return /*#__PURE__*/_react.default.createElement(_CheckboxInput.default,
|
|
47
|
+
return /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
48
|
+
testId: (item === null || item === void 0 ? void 0 : item.testId) || testId,
|
|
47
49
|
id: item.id,
|
|
48
50
|
className: "".concat(RC, "__checkbox-input"),
|
|
49
51
|
key: item.label,
|
|
50
52
|
label: item.label,
|
|
51
53
|
value: (value === null || value === void 0 ? void 0 : (_value$includes = value.includes) === null || _value$includes === void 0 ? void 0 : _value$includes.call(value, item.id)) || false,
|
|
52
|
-
disabled: disabled,
|
|
53
54
|
onChange: function onChange(val, e) {
|
|
54
55
|
return handleChange(val, item.id, e);
|
|
55
|
-
}
|
|
56
|
-
|
|
56
|
+
},
|
|
57
|
+
disabled: disabled || item.disabled
|
|
58
|
+
});
|
|
57
59
|
})) || null);
|
|
58
60
|
};
|
|
59
61
|
|
|
@@ -173,7 +173,7 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
173
173
|
});
|
|
174
174
|
var samePart = infoAboutDifferencesSameness.same.join('');
|
|
175
175
|
var differencesLength = infoAboutDifferencesSameness.differences.length;
|
|
176
|
-
var currentSet = changedValue.replace(samePart, '');
|
|
176
|
+
var currentSet = changedValue === null || changedValue === void 0 ? void 0 : changedValue.replace(samePart, '');
|
|
177
177
|
if (!_index.KEYBOARD_SERVICE_KEYS.includes(e.key) && changedValue === previousValue) setIsAttemptToChange(!(!differencesLength && e.key === currentSet));
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -113,7 +113,9 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
var onKeyUp = function onKeyUp(e) {
|
|
116
|
-
var
|
|
116
|
+
var _e$target$value;
|
|
117
|
+
|
|
118
|
+
var isValidLenght = ((_e$target$value = e.target.value) === null || _e$target$value === void 0 ? void 0 : _e$target$value.replace(/[^0-9]/g, '').length) === 8;
|
|
117
119
|
|
|
118
120
|
if ([9, 13].includes(e.keyCode)) {
|
|
119
121
|
setIsOpened(true);
|
|
@@ -41,7 +41,7 @@ var padTime = function padTime(time) {
|
|
|
41
41
|
|
|
42
42
|
var handleDateInputOnChange = function handleDateInputOnChange(value) {
|
|
43
43
|
var replace = function replace(val) {
|
|
44
|
-
return val.replace(/[^0-9\/]/g, '');
|
|
44
|
+
return val === null || val === void 0 ? void 0 : val.replace(/[^0-9\/]/g, '');
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
var input = replace(value);
|
|
@@ -430,7 +430,7 @@ function InputMask() {
|
|
|
430
430
|
maskChar = _ref9.maskChar;
|
|
431
431
|
return char === '' ? getPlaceholderCharByIndex(i) || maskChar : char;
|
|
432
432
|
}).join('');
|
|
433
|
-
return replaceSpace ? result.replace(/\u00A0/g, ' ') : result;
|
|
433
|
+
return replaceSpace ? result === null || result === void 0 ? void 0 : result.replace(/\u00A0/g, ' ') : result;
|
|
434
434
|
};
|
|
435
435
|
|
|
436
436
|
var getClearInnerValueAsString = function getClearInnerValueAsString() {
|
|
@@ -8,6 +8,8 @@ exports.voidFn = exports.selectElementContents = exports.resetSelectionText = ex
|
|
|
8
8
|
var _config = require("./config");
|
|
9
9
|
|
|
10
10
|
var getSelectionText = function getSelectionText() {
|
|
11
|
+
var _text;
|
|
12
|
+
|
|
11
13
|
var text = '';
|
|
12
14
|
|
|
13
15
|
if (window.getSelection) {
|
|
@@ -16,7 +18,7 @@ var getSelectionText = function getSelectionText() {
|
|
|
16
18
|
text = document.selection.createRange().text;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
return text.replace(/\n/g, '');
|
|
21
|
+
return (_text = text) === null || _text === void 0 ? void 0 : _text.replace(/\n/g, '');
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
exports.getSelectionText = getSelectionText;
|
|
@@ -369,7 +369,7 @@ function InputMask2() {
|
|
|
369
369
|
maskChar = _ref8.maskChar;
|
|
370
370
|
return char === '' ? getPlaceholderCharByIndex(i) || maskChar : char;
|
|
371
371
|
}).join('');
|
|
372
|
-
return replaceSpace ? result.replace(/\u00A0/g, ' ') : result;
|
|
372
|
+
return replaceSpace ? result === null || result === void 0 ? void 0 : result.replace(/\u00A0/g, ' ') : result;
|
|
373
373
|
};
|
|
374
374
|
|
|
375
375
|
var getClearInnerValueAsString = function getClearInnerValueAsString() {
|
|
@@ -8,6 +8,8 @@ exports.voidFn = exports.selectElementContents = exports.resetSelectionText = ex
|
|
|
8
8
|
var _config = require("./config");
|
|
9
9
|
|
|
10
10
|
var getSelectionText = function getSelectionText() {
|
|
11
|
+
var _text;
|
|
12
|
+
|
|
11
13
|
var text = '';
|
|
12
14
|
|
|
13
15
|
if (window.getSelection) {
|
|
@@ -16,7 +18,7 @@ var getSelectionText = function getSelectionText() {
|
|
|
16
18
|
text = document.selection.createRange().text;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
return text.replace(/\n/g, '');
|
|
21
|
+
return (_text = text) === null || _text === void 0 ? void 0 : _text.replace(/\n/g, '');
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
exports.getSelectionText = getSelectionText;
|
|
@@ -183,7 +183,7 @@ var NumericInput = function NumericInput(_ref) {
|
|
|
183
183
|
});
|
|
184
184
|
var samePart = infoAboutDifferencesSameness.same.join('');
|
|
185
185
|
var differencesLength = infoAboutDifferencesSameness.differences.length;
|
|
186
|
-
var currentSet = changedValue.replace(samePart, '');
|
|
186
|
+
var currentSet = changedValue === null || changedValue === void 0 ? void 0 : changedValue.replace(samePart, '');
|
|
187
187
|
if (!_index.KEYBOARD_SERVICE_KEYS.includes(e.key) && changedValue === previousValue) setIsAttemptToChange(!(!differencesLength && e.key === currentSet));
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -56,7 +56,9 @@ var RangeInputs = function RangeInputs(_ref) {
|
|
|
56
56
|
label = _ref$label === void 0 ? '' : _ref$label,
|
|
57
57
|
_ref$isPrice = _ref.isPrice,
|
|
58
58
|
isPrice = _ref$isPrice === void 0 ? false : _ref$isPrice,
|
|
59
|
-
testId = _ref.testId
|
|
59
|
+
testId = _ref.testId,
|
|
60
|
+
_ref$withZero = _ref.withZero,
|
|
61
|
+
withZero = _ref$withZero === void 0 ? false : _ref$withZero;
|
|
60
62
|
|
|
61
63
|
var _useState = (0, _react.useState)({
|
|
62
64
|
from: '',
|
|
@@ -70,11 +72,22 @@ var RangeInputs = function RangeInputs(_ref) {
|
|
|
70
72
|
var inputToRef = (0, _react.useRef)(null);
|
|
71
73
|
|
|
72
74
|
var isValidRange = function isValidRange(from, to) {
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
var
|
|
77
|
-
|
|
75
|
+
var _from$toString, _to$toString;
|
|
76
|
+
|
|
77
|
+
var replaceNotDigitFrom = from === null || from === void 0 ? void 0 : (_from$toString = from.toString()) === null || _from$toString === void 0 ? void 0 : _from$toString.replace(/[^\d]/g, '');
|
|
78
|
+
var replaceNotDigitFromTo = to === null || to === void 0 ? void 0 : (_to$toString = to.toString()) === null || _to$toString === void 0 ? void 0 : _to$toString.replace(/[^\d]/g, '');
|
|
79
|
+
var correctFrom;
|
|
80
|
+
var correctTo;
|
|
81
|
+
|
|
82
|
+
if (!withZero) {
|
|
83
|
+
correctFrom = parseInt(replaceNotDigitFrom);
|
|
84
|
+
correctTo = parseInt(replaceNotDigitFromTo);
|
|
85
|
+
} else {
|
|
86
|
+
correctFrom = replaceNotDigitFrom;
|
|
87
|
+
correctTo = replaceNotDigitFromTo;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return !!(correctFrom && correctTo && correctFrom <= correctTo);
|
|
78
91
|
};
|
|
79
92
|
|
|
80
93
|
var valueFormatter = function valueFormatter(value) {
|
|
@@ -88,18 +101,18 @@ var RangeInputs = function RangeInputs(_ref) {
|
|
|
88
101
|
var rangeValidation = function rangeValidation(e, key) {
|
|
89
102
|
var oppositeKey = key === 'from' ? 'to' : 'from';
|
|
90
103
|
|
|
91
|
-
if (!(valueObj !== null && valueObj !== void 0 && valueObj.from) && !(valueObj !== null && valueObj !== void 0 && valueObj.to)
|
|
104
|
+
if (!withZero && !(valueObj !== null && valueObj !== void 0 && valueObj.from) && !(valueObj !== null && valueObj !== void 0 && valueObj.to)) {
|
|
92
105
|
setError({
|
|
93
106
|
from: '',
|
|
94
107
|
to: ''
|
|
95
108
|
});
|
|
96
109
|
setInnerError === null || setInnerError === void 0 ? void 0 : setInnerError('');
|
|
97
110
|
return e;
|
|
98
|
-
} else if (!
|
|
111
|
+
} else if (!withZero && !valueObj[oppositeKey]) {
|
|
99
112
|
var mustToFocus = key === 'from' ? inputToRef.current : inputFromRef.current;
|
|
100
113
|
mustToFocus.focus();
|
|
101
114
|
} else if (!isValidRange(valueObj === null || valueObj === void 0 ? void 0 : valueObj.from, valueObj === null || valueObj === void 0 ? void 0 : valueObj.to)) {
|
|
102
|
-
if (!(valueObj !== null && valueObj !== void 0 && valueObj.from)
|
|
115
|
+
if (!(valueObj !== null && valueObj !== void 0 && valueObj.from)) setError(_objectSpread(_objectSpread({}, error), {}, {
|
|
103
116
|
from: 'Invalid range'
|
|
104
117
|
}));else setError(_objectSpread(_objectSpread({}, error), {}, {
|
|
105
118
|
to: 'Invalid range'
|
|
@@ -54,7 +54,8 @@ var RangeList = function RangeList(props) {
|
|
|
54
54
|
decimalPlaces = props.decimalPlaces,
|
|
55
55
|
error = props.error,
|
|
56
56
|
defaultErrorText = props.defaultErrorText,
|
|
57
|
-
nullValueText = props.nullValueText
|
|
57
|
+
nullValueText = props.nullValueText,
|
|
58
|
+
testId = props.testId;
|
|
58
59
|
var NULL_VALUE_TEXT = nullValueText !== null && nullValueText !== void 0 ? nullValueText : 'No data';
|
|
59
60
|
|
|
60
61
|
var _useState = (0, _react.useState)(DEFAULT_STATE),
|
|
@@ -113,6 +114,8 @@ var RangeList = function RangeList(props) {
|
|
|
113
114
|
setInnerError('');
|
|
114
115
|
if (validateErrors) setOuterError(validateErrors(+state.from, +state.to));
|
|
115
116
|
}
|
|
117
|
+
|
|
118
|
+
return null;
|
|
116
119
|
},
|
|
117
120
|
onKeyUpFromInput: function onKeyUpFromInput(code) {
|
|
118
121
|
if (code === 13) {
|
|
@@ -136,7 +139,7 @@ var RangeList = function RangeList(props) {
|
|
|
136
139
|
}, /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
|
|
137
140
|
className: "".concat(RC, "__cell-input")
|
|
138
141
|
}, /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
139
|
-
testId: "range-list-from",
|
|
142
|
+
testId: "range-list".concat(testId && "--".concat(testId), "-from"),
|
|
140
143
|
ref: inputFromRef,
|
|
141
144
|
onlyNumbers: isFloatValues ? {
|
|
142
145
|
type: 'float',
|
|
@@ -151,13 +154,13 @@ var RangeList = function RangeList(props) {
|
|
|
151
154
|
onChange: function onChange(val) {
|
|
152
155
|
return handle.inputsChange(val, 'from');
|
|
153
156
|
},
|
|
154
|
-
onKeyUp: function onKeyUp(code
|
|
157
|
+
onKeyUp: function onKeyUp(code) {
|
|
155
158
|
return handle.onKeyUpFromInput(code);
|
|
156
159
|
}
|
|
157
160
|
})), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
|
|
158
161
|
className: "".concat(RC, "__cell-input")
|
|
159
162
|
}, /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
160
|
-
testId: "range-list-to",
|
|
163
|
+
testId: "range-list".concat(testId && "--".concat(testId), "-to"),
|
|
161
164
|
ref: inputToRef,
|
|
162
165
|
onlyNumbers: isFloatValues ? {
|
|
163
166
|
type: 'float',
|
|
@@ -172,13 +175,13 @@ var RangeList = function RangeList(props) {
|
|
|
172
175
|
onChange: function onChange(val) {
|
|
173
176
|
return handle.inputsChange(val, 'to');
|
|
174
177
|
},
|
|
175
|
-
onKeyUp: function onKeyUp(code
|
|
178
|
+
onKeyUp: function onKeyUp(code) {
|
|
176
179
|
return handle.onKeyUpToInput(code);
|
|
177
180
|
}
|
|
178
181
|
})), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
|
|
179
182
|
className: "".concat(RC, "__cell-button")
|
|
180
183
|
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
181
|
-
testId: "range-list-button",
|
|
184
|
+
testId: "range-list".concat(testId && "--".concat(testId), "-button"),
|
|
182
185
|
onClick: handle.addRange
|
|
183
186
|
}, "Add"))), (innerError || outerError || error) && /*#__PURE__*/_react.default.createElement("span", {
|
|
184
187
|
className: "".concat(RC, "__error")
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -11,7 +9,7 @@ exports.default = void 0;
|
|
|
11
9
|
|
|
12
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
11
|
|
|
14
|
-
var _react =
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
13
|
|
|
16
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
15
|
|
|
@@ -19,10 +17,6 @@ var _Switcher = _interopRequireDefault(require("../Switcher/Switcher"));
|
|
|
19
17
|
|
|
20
18
|
require("./SwitcherHide.scss");
|
|
21
19
|
|
|
22
|
-
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); }
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
26
20
|
var RC = 'switcher-hide';
|
|
27
21
|
|
|
28
22
|
var SwitcherHide = function SwitcherHide(_ref) {
|
|
@@ -37,7 +37,8 @@ var SwitcherRangeList = function SwitcherRangeList(props) {
|
|
|
37
37
|
_props$setIsActive = props.setIsActive,
|
|
38
38
|
setIsActive = _props$setIsActive === void 0 ? function () {} : _props$setIsActive,
|
|
39
39
|
_props$onChange = props.onChange,
|
|
40
|
-
onChange = _props$onChange === void 0 ? function () {} : _props$onChange
|
|
40
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
41
|
+
testId = props.testId;
|
|
41
42
|
return /*#__PURE__*/_react.default.createElement(_SwitcherHide.default, {
|
|
42
43
|
isActive: isActive,
|
|
43
44
|
onChange: setIsActive,
|
|
@@ -50,6 +51,7 @@ var SwitcherRangeList = function SwitcherRangeList(props) {
|
|
|
50
51
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
51
52
|
className: "switcher-range-list__row"
|
|
52
53
|
}, /*#__PURE__*/_react.default.createElement(_RangeList.default, {
|
|
54
|
+
testId: testId,
|
|
53
55
|
className: "".concat(RC, "__range-list"),
|
|
54
56
|
value: value,
|
|
55
57
|
onChange: onChange,
|
|
@@ -39,12 +39,14 @@ var SwitcherTextarea = function SwitcherTextarea(_ref) {
|
|
|
39
39
|
_ref$setText = _ref.setText,
|
|
40
40
|
setText = _ref$setText === void 0 ? function () {} : _ref$setText,
|
|
41
41
|
_ref$activeText = _ref.activeText,
|
|
42
|
-
activeText = _ref$activeText === void 0 ?
|
|
42
|
+
activeText = _ref$activeText === void 0 ? 'is' : _ref$activeText,
|
|
43
43
|
_ref$inactiveText = _ref.inactiveText,
|
|
44
|
-
inactiveText = _ref$inactiveText === void 0 ?
|
|
44
|
+
inactiveText = _ref$inactiveText === void 0 ? 'is not' : _ref$inactiveText,
|
|
45
45
|
placeholder = _ref.placeholder,
|
|
46
|
-
disabled = _ref.disabled
|
|
46
|
+
disabled = _ref.disabled,
|
|
47
|
+
testId = _ref.testId;
|
|
47
48
|
return /*#__PURE__*/_react.default.createElement(_SwitcherHide.default, {
|
|
49
|
+
testId: testId,
|
|
48
50
|
isActive: isActive,
|
|
49
51
|
onChange: setIsActive,
|
|
50
52
|
label: label,
|
|
@@ -55,6 +57,7 @@ var SwitcherTextarea = function SwitcherTextarea(_ref) {
|
|
|
55
57
|
}, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
56
58
|
className: "".concat(RC, "__wrap switcher-hide__content")
|
|
57
59
|
}, /*#__PURE__*/_react.default.createElement(_TextSwitcher.default, {
|
|
60
|
+
testId: testId,
|
|
58
61
|
activeText: activeText,
|
|
59
62
|
inactiveText: inactiveText,
|
|
60
63
|
isActive: isIncluded !== null && isIncluded !== void 0 ? isIncluded : true,
|
|
@@ -68,6 +71,7 @@ var SwitcherTextarea = function SwitcherTextarea(_ref) {
|
|
|
68
71
|
},
|
|
69
72
|
className: "".concat(RC, "__btn")
|
|
70
73
|
}, "Clear")), /*#__PURE__*/_react.default.createElement(_Textarea.default, {
|
|
74
|
+
testId: testId,
|
|
71
75
|
value: text,
|
|
72
76
|
placeholder: placeholder,
|
|
73
77
|
onChange: function onChange(value) {
|
|
@@ -27,9 +27,12 @@ var TextSwitcher = function TextSwitcher(_ref) {
|
|
|
27
27
|
_ref$activeText = _ref.activeText,
|
|
28
28
|
activeText = _ref$activeText === void 0 ? 'is' : _ref$activeText,
|
|
29
29
|
_ref$inactiveText = _ref.inactiveText,
|
|
30
|
-
inactiveText = _ref$inactiveText === void 0 ? 'is not' : _ref$inactiveText
|
|
30
|
+
inactiveText = _ref$inactiveText === void 0 ? 'is not' : _ref$inactiveText,
|
|
31
|
+
_ref$testId = _ref.testId,
|
|
32
|
+
testId = _ref$testId === void 0 ? '' : _ref$testId;
|
|
31
33
|
var isUndefined = isActive === undefined || isActive === null;
|
|
32
34
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
35
|
+
testId: testId,
|
|
33
36
|
className: (0, _classnames.default)(RC, (_cn = {}, (0, _defineProperty2.default)(_cn, "".concat(RC, "_active"), isActive), (0, _defineProperty2.default)(_cn, "".concat(RC, "_disabled"), disabled), _cn), className),
|
|
34
37
|
onClick: function onClick() {
|
|
35
38
|
return onChange(!isActive);
|
|
@@ -11,8 +11,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
|
|
14
|
-
var _Label = _interopRequireDefault(require("../Label/Label"));
|
|
15
|
-
|
|
16
14
|
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
17
15
|
|
|
18
16
|
require("./Textarea.scss");
|
|
@@ -26,10 +24,12 @@ var Textarea = function Textarea(_ref) {
|
|
|
26
24
|
disabled = _ref.disabled,
|
|
27
25
|
className = _ref.className,
|
|
28
26
|
_ref$isNotValidateASC = _ref.isNotValidateASCII,
|
|
29
|
-
isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC
|
|
27
|
+
isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC,
|
|
28
|
+
_ref$testId = _ref.testId,
|
|
29
|
+
testId = _ref$testId === void 0 ? '' : _ref$testId;
|
|
30
30
|
var handle = {
|
|
31
|
-
change: function change(
|
|
32
|
-
var inputValue =
|
|
31
|
+
change: function change(val) {
|
|
32
|
+
var inputValue = val;
|
|
33
33
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
34
34
|
onChange(inputValue);
|
|
35
35
|
}
|
|
@@ -37,6 +37,7 @@ var Textarea = function Textarea(_ref) {
|
|
|
37
37
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
38
38
|
className: (0, _classnames.default)("".concat(RC), className)
|
|
39
39
|
}, /*#__PURE__*/_react.default.createElement("textarea", {
|
|
40
|
+
testId: "textarea-".concat(testId),
|
|
40
41
|
className: "".concat(RC, "__textarea"),
|
|
41
42
|
value: value,
|
|
42
43
|
onChange: function onChange(e) {
|
|
@@ -37,7 +37,7 @@ var Button = function Button(_ref) {
|
|
|
37
37
|
variant = _ref$variant === void 0 ? 'primary' : _ref$variant;
|
|
38
38
|
var noRenderIcon = noIcon || variant === 'ellipse-apply' || variant === 'ellipse-cancel';
|
|
39
39
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
40
|
-
"data-testid": "button--".concat(testId, "--").concat((label === null || label === void 0 ? void 0 : label.replace(/\s/g, '-')) || variant),
|
|
40
|
+
"data-testid": "button".concat(testId && "--".concat(testId), "--").concat((label === null || label === void 0 ? void 0 : label.replace(/\s/g, '-')) || variant),
|
|
41
41
|
tabIndex: tabIndex,
|
|
42
42
|
style: style,
|
|
43
43
|
className: (0, _classnames.default)(className, RC, (_cn = {}, (0, _defineProperty2.default)(_cn, "".concat(RC, "_").concat(variant), variant), (0, _defineProperty2.default)(_cn, 'button_icon-left', icon && !isIconRight), (0, _defineProperty2.default)(_cn, 'button_icon-right', icon && isIconRight), _cn)),
|
|
@@ -92,7 +92,7 @@ var Modal = function Modal(_ref) {
|
|
|
92
92
|
style: {
|
|
93
93
|
zIndex: zIndex
|
|
94
94
|
},
|
|
95
|
-
"data-testid": "modal--".concat(title || '', "--container"),
|
|
95
|
+
"data-testid": "modal--".concat(title === null || title === void 0 ? void 0 : title.replace(/\s/gi, '-'), "--container"),
|
|
96
96
|
className: "modal-box j5"
|
|
97
97
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
98
98
|
"data-testid": 'modal-closeOverlay',
|
|
@@ -16,7 +16,7 @@ var Price = function Price(_ref) {
|
|
|
16
16
|
unitAfter = _ref.unitAfter,
|
|
17
17
|
className = _ref.className;
|
|
18
18
|
if (value === undefined || value === null) return null;
|
|
19
|
-
var formatted = Number(value.toString().replace(/[+*?$^(,)]/g, '')).toLocaleString('en-US');
|
|
19
|
+
var formatted = Number(value === null || value === void 0 ? void 0 : value.toString().replace(/[+*?$^(,)]/g, '')).toLocaleString('en-US');
|
|
20
20
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
21
21
|
"data-testid": 'test-price',
|
|
22
22
|
className: "price ".concat(className)
|
|
@@ -343,7 +343,9 @@ var AbortableFetch = /*#__PURE__*/function () {
|
|
|
343
343
|
}, {
|
|
344
344
|
key: "getQueryArray",
|
|
345
345
|
value: function getQueryArray(value) {
|
|
346
|
-
|
|
346
|
+
var _value$replace;
|
|
347
|
+
|
|
348
|
+
if (typeof value === 'string') return value === null || value === void 0 ? void 0 : (_value$replace = value.replace(/\?/g, '')) === null || _value$replace === void 0 ? void 0 : _value$replace.split('&');else if (Array.isArray(value)) return value;else if ((0, _typeof2.default)(value) === 'object' && value !== null) return Object.keys(value).filter(function (key) {
|
|
347
349
|
return value[key];
|
|
348
350
|
}).map(function (key) {
|
|
349
351
|
return "".concat(key, "=").concat(value[key]);
|
|
@@ -23,13 +23,15 @@ exports.formatOnlyNumbers = formatOnlyNumbers;
|
|
|
23
23
|
|
|
24
24
|
var formatDollarSign = function formatDollarSign(inputValue) {
|
|
25
25
|
var value = inputValue !== null && inputValue !== void 0 ? inputValue : '';
|
|
26
|
-
return value ? "$".concat(value.toString().replace(/\$/g, '')) : '';
|
|
26
|
+
return value ? "$".concat(value === null || value === void 0 ? void 0 : value.toString().replace(/\$/g, '')) : '';
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
exports.formatDollarSign = formatDollarSign;
|
|
30
30
|
|
|
31
31
|
var formatToRemoveComa = function formatToRemoveComa(value) {
|
|
32
|
-
|
|
32
|
+
var _ref;
|
|
33
|
+
|
|
34
|
+
return (_ref = value ? value === null || value === void 0 ? void 0 : value.toString() : '') === null || _ref === void 0 ? void 0 : _ref.toString().replace(/,/g, '');
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
exports.formatToRemoveComa = formatToRemoveComa;
|
|
@@ -58,10 +60,12 @@ var formatToPriceInputAndDollarSymbol = function formatToPriceInputAndDollarSymb
|
|
|
58
60
|
exports.formatToPriceInputAndDollarSymbol = formatToPriceInputAndDollarSymbol;
|
|
59
61
|
|
|
60
62
|
var formatToTwoDigitAfterDot = function formatToTwoDigitAfterDot(inputValue) {
|
|
63
|
+
var _arr$join;
|
|
64
|
+
|
|
61
65
|
var value = !!inputValue ? inputValue.toString() : '';
|
|
62
66
|
var arr = value.split('.');
|
|
63
67
|
var intPart = arr.shift();
|
|
64
|
-
var decimalPart = arr.join('').replace(/\s/g, '').slice(0, 2);
|
|
68
|
+
var decimalPart = (_arr$join = arr.join('')) === null || _arr$join === void 0 ? void 0 : _arr$join.replace(/\s/g, '').slice(0, 2);
|
|
65
69
|
return intPart + (decimalPart.length ? '.' + decimalPart : '');
|
|
66
70
|
};
|
|
67
71
|
|
|
@@ -100,13 +104,13 @@ var formatNumberValueToMask = function formatNumberValueToMask(inputValue, setti
|
|
|
100
104
|
|
|
101
105
|
var safelyInputValue = typeof inputValue !== 'string' ? (inputValue === null || inputValue === void 0 ? void 0 : (_inputValue$toString = inputValue.toString) === null || _inputValue$toString === void 0 ? void 0 : _inputValue$toString.call(inputValue)) || '' : inputValue; // default valueSymbol === 'n', default mask === 'nnn-nnn-nnnn'
|
|
102
106
|
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
mask =
|
|
106
|
-
|
|
107
|
-
valueSymbol =
|
|
108
|
-
|
|
109
|
-
isReturnAdvanced =
|
|
107
|
+
var _ref2 = settings || {},
|
|
108
|
+
_ref2$mask = _ref2.mask,
|
|
109
|
+
mask = _ref2$mask === void 0 ? 'XXX-XXX-XXXX' : _ref2$mask,
|
|
110
|
+
_ref2$valueSymbol = _ref2.valueSymbol,
|
|
111
|
+
valueSymbol = _ref2$valueSymbol === void 0 ? 'X' : _ref2$valueSymbol,
|
|
112
|
+
_ref2$isReturnAdvance = _ref2.isReturnAdvanced,
|
|
113
|
+
isReturnAdvanced = _ref2$isReturnAdvance === void 0 ? false : _ref2$isReturnAdvance;
|
|
110
114
|
|
|
111
115
|
var processing = mask.split('').reduce(function (acc, item) {
|
|
112
116
|
if (acc.value.length) ++acc.cursorPosition;
|
|
@@ -129,6 +133,8 @@ var formatNumberValueToMask = function formatNumberValueToMask(inputValue, setti
|
|
|
129
133
|
exports.formatNumberValueToMask = formatNumberValueToMask;
|
|
130
134
|
|
|
131
135
|
var filterFloat = function filterFloat(inputValue) {
|
|
136
|
+
var _ref3;
|
|
137
|
+
|
|
132
138
|
var decimalPlaces = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
133
139
|
var value = !!inputValue ? inputValue.toString() : '';
|
|
134
140
|
|
|
@@ -137,7 +143,7 @@ var filterFloat = function filterFloat(inputValue) {
|
|
|
137
143
|
};
|
|
138
144
|
|
|
139
145
|
if (value.length === 1 && (value[0] === '.' || value[0] === ',')) return '0.';
|
|
140
|
-
var output = ('' + value).replace(/,/g, '.');
|
|
146
|
+
var output = (_ref3 = '' + value) === null || _ref3 === void 0 ? void 0 : _ref3.replace(/,/g, '.');
|
|
141
147
|
if (value.length > 1 && value[0] === '0' && value[1] !== '.' && value[0] !== ',') output = value.slice(1);
|
|
142
148
|
var previousValue = '' + output.slice(0, -1);
|
|
143
149
|
var lastSym = '' + output.slice(-1);
|
|
@@ -161,10 +167,10 @@ var filterPhone = function filterPhone(value) {
|
|
|
161
167
|
exports.filterPhone = filterPhone;
|
|
162
168
|
|
|
163
169
|
var filterNumeric = function filterNumeric(value, settings) {
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
type =
|
|
167
|
-
decimalPlaces =
|
|
170
|
+
var _ref4 = settings || {},
|
|
171
|
+
_ref4$type = _ref4.type,
|
|
172
|
+
type = _ref4$type === void 0 ? 'float' : _ref4$type,
|
|
173
|
+
decimalPlaces = _ref4.decimalPlaces;
|
|
168
174
|
|
|
169
175
|
var executor = type === 'float' ? filterFloat : formatOnlyNumbers;
|
|
170
176
|
return executor(!!value ? value.toString() : '', decimalPlaces);
|
|
@@ -25,7 +25,9 @@ function useLocationParams() {
|
|
|
25
25
|
|
|
26
26
|
(0, _react.useEffect)(function () {
|
|
27
27
|
setParams(function (state) {
|
|
28
|
-
var
|
|
28
|
+
var _window$location$sear;
|
|
29
|
+
|
|
30
|
+
var arr = (_window$location$sear = window.location.search) === null || _window$location$sear === void 0 ? void 0 : _window$location$sear.replace('?', '').split('&');
|
|
29
31
|
return _objectSpread(_objectSpread({}, state), arr.reduce(function (obj, item) {
|
|
30
32
|
var keyVal = item.split('=');
|
|
31
33
|
var key = keyVal[0];
|
|
@@ -118,9 +118,9 @@ function usePasswordChecker() {
|
|
|
118
118
|
className: "password-checker__header"
|
|
119
119
|
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
120
120
|
className: "password-checker__header-label"
|
|
121
|
-
}, " Password must: "),
|
|
121
|
+
}, " Password must: "), ' '), ' ', /*#__PURE__*/_react.default.createElement("div", {
|
|
122
122
|
className: "password-checker__body"
|
|
123
|
-
},
|
|
123
|
+
}, ' ', checkRules.map(function (_ref) {
|
|
124
124
|
var icon = _ref.icon,
|
|
125
125
|
text = _ref.text,
|
|
126
126
|
isMatch = _ref.isMatch;
|
|
@@ -130,8 +130,8 @@ function usePasswordChecker() {
|
|
|
130
130
|
className: "password-checker__body-item__icon"
|
|
131
131
|
}, " ", icon, " "), " ", /*#__PURE__*/_react.default.createElement("div", {
|
|
132
132
|
className: "password-checker__body-item__text"
|
|
133
|
-
}, " ", text, " "),
|
|
134
|
-
}),
|
|
133
|
+
}, " ", text, " "), ' ');
|
|
134
|
+
}), ' '), ' ');
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
return {
|