intelicoreact 0.1.29 → 0.1.32
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/AdvancedStatus/AdvancedStatus.js +5 -3
- package/dist/Atomic/FormElements/Input/Input.js +70 -42
- package/dist/Atomic/FormElements/Input/Input.stories.js +7 -1
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +8 -6
- package/dist/Atomic/FormElements/Spinner/Spinner.js +7 -3
- package/dist/Molecular/Datepicker/components/Calendar.js +2 -2
- package/package.json +1 -1
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
10
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
13
|
|
|
12
14
|
var _TextSwitcher = _interopRequireDefault(require("../TextSwitcher/TextSwitcher"));
|
|
@@ -24,18 +26,18 @@ var AdvancedStatus = function AdvancedStatus(_ref) {
|
|
|
24
26
|
isPrimary = _ref.isPrimary,
|
|
25
27
|
primaryStatusText = _ref.primaryStatusText;
|
|
26
28
|
var isUndefined = value === undefined || value === null;
|
|
27
|
-
return /*#__PURE__*/
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
28
30
|
className: (0, _classnames.default)('advanced-status', {
|
|
29
31
|
'advanced-status_undefined': isUndefined,
|
|
30
32
|
'advanced-status_disabled': disabled
|
|
31
33
|
})
|
|
32
|
-
}, /*#__PURE__*/
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement(_TextSwitcher.default, {
|
|
33
35
|
onChange: onChange,
|
|
34
36
|
isIncluded: value,
|
|
35
37
|
inactiveText: inactiveText,
|
|
36
38
|
activeText: activeText,
|
|
37
39
|
className: "advanced-status__switcher"
|
|
38
|
-
}), isPrimary && /*#__PURE__*/
|
|
40
|
+
}), isPrimary && /*#__PURE__*/_react.default.createElement(_Status.default, {
|
|
39
41
|
className: "advanced-status__status",
|
|
40
42
|
status: "warning"
|
|
41
43
|
}, primaryStatusText));
|
|
@@ -37,10 +37,16 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
37
37
|
|
|
38
38
|
var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
39
39
|
var isSelect = _ref.isSelect,
|
|
40
|
-
onChange = _ref.onChange,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
_ref$onChange = _ref.onChange,
|
|
41
|
+
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
42
|
+
_ref$onBlur = _ref.onBlur,
|
|
43
|
+
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
|
|
44
|
+
_ref$onFocus = _ref.onFocus,
|
|
45
|
+
onFocus = _ref$onFocus === void 0 ? function () {} : _ref$onFocus,
|
|
46
|
+
_ref$onKeyUp = _ref.onKeyUp,
|
|
47
|
+
onKeyUp = _ref$onKeyUp === void 0 ? function () {} : _ref$onKeyUp,
|
|
48
|
+
_ref$onKeyDown = _ref.onKeyDown,
|
|
49
|
+
onKeyDown = _ref$onKeyDown === void 0 ? function () {} : _ref$onKeyDown,
|
|
44
50
|
isNotBlinkErrors = _ref.isNotBlinkErrors,
|
|
45
51
|
isPriceInput = _ref.isPriceInput,
|
|
46
52
|
onlyNumbers = _ref.onlyNumbers,
|
|
@@ -64,7 +70,9 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
64
70
|
_ref$isFocusDefault = _ref.isFocusDefault,
|
|
65
71
|
isFocusDefault = _ref$isFocusDefault === void 0 ? false : _ref$isFocusDefault,
|
|
66
72
|
_ref$isNotValidateASC = _ref.isNotValidateASCII,
|
|
67
|
-
isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC
|
|
73
|
+
isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC,
|
|
74
|
+
_ref$isNumericMobileK = _ref.isNumericMobileKeyboard,
|
|
75
|
+
isNumericMobileKeyboard = _ref$isNumericMobileK === void 0 ? false : _ref$isNumericMobileK;
|
|
68
76
|
var DEFAULT_BLINK_TIME = 100; // STATES
|
|
69
77
|
|
|
70
78
|
var _useState = (0, _react.useState)(false),
|
|
@@ -98,13 +106,18 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
98
106
|
onInputHover = _useState10[0],
|
|
99
107
|
setOnInputHover = _useState10[1];
|
|
100
108
|
|
|
109
|
+
var _useState11 = (0, _react.useState)(value),
|
|
110
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
111
|
+
prevValue = _useState12[0],
|
|
112
|
+
setPreviousValue = _useState12[1];
|
|
113
|
+
|
|
101
114
|
var isUseBitDepthPoints = !!onlyNumbers && isPriceInput;
|
|
102
115
|
var isUseErrorsBlink = !isNotBlinkErrors && !mask; // HANDLES
|
|
103
116
|
|
|
104
117
|
var handle = {
|
|
105
118
|
change: function change(e) {
|
|
106
119
|
var inputValue = e.target ? e.target.value : e;
|
|
107
|
-
if (type === 'text' && !isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
120
|
+
if ((type === 'text' || type === 'email') && !isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
108
121
|
if (symbolsLimit && inputValue.length > +symbolsLimit) inputValue = inputValue.substring(0, +symbolsLimit);
|
|
109
122
|
if (onlyNumbers && isOnlyString || isOnlyString) inputValue = (0, _fieldValueFormatters.formatToLetters)(inputValue, softStringMode);else if (onlyNumbers) inputValue = (0, _fieldValueFormatters.filterNumeric)(inputValue, onlyNumbers);
|
|
110
123
|
onChange(inputValue.toString());
|
|
@@ -116,7 +129,7 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
116
129
|
focus: function focus(e) {
|
|
117
130
|
setIsFocused(true);
|
|
118
131
|
if (onlyNumbers) onChange((0, _fieldValueFormatters.formatToRemoveComa)(value));
|
|
119
|
-
|
|
132
|
+
onFocus(e);
|
|
120
133
|
},
|
|
121
134
|
blur: function blur(e) {
|
|
122
135
|
setIsFocused(false);
|
|
@@ -127,12 +140,17 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
127
140
|
if (onlyNumbers || isUseBitDepthPoints) onChange(value);
|
|
128
141
|
if (onBlur) onBlur(e);
|
|
129
142
|
},
|
|
143
|
+
keyDown: function keyDown(e) {
|
|
144
|
+
var _e$target;
|
|
145
|
+
|
|
146
|
+
setPreviousValue(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
|
|
147
|
+
onKeyDown(e.keyCode, e);
|
|
148
|
+
},
|
|
130
149
|
keyUp: function keyUp(e) {
|
|
131
150
|
if (isUseErrorsBlink) {
|
|
132
|
-
var
|
|
151
|
+
var changedValue = '' + (value !== null && value !== void 0 ? value : ''); // const previousValue = '' + (previousValueRef.current ?? '');
|
|
133
152
|
|
|
134
|
-
var
|
|
135
|
-
var previousValue = '' + ((_previousValueRef$cur = previousValueRef.current) !== null && _previousValueRef$cur !== void 0 ? _previousValueRef$cur : '');
|
|
153
|
+
var previousValue = '' + prevValue;
|
|
136
154
|
var short = previousValue.length <= changedValue.length ? previousValue : changedValue;
|
|
137
155
|
var long = previousValue.length > changedValue.length ? previousValue : changedValue;
|
|
138
156
|
var infoAboutDifferencesSameness = short.split('').reduce(function (acc, symbol, idx) {
|
|
@@ -148,32 +166,63 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
148
166
|
});
|
|
149
167
|
var samePart = infoAboutDifferencesSameness.same.join('');
|
|
150
168
|
var differencesLength = infoAboutDifferencesSameness.differences.length;
|
|
151
|
-
var currentSet = changedValue.replace(samePart, '');
|
|
169
|
+
var currentSet = changedValue.replace(samePart, ''); /// ????????????????
|
|
170
|
+
// const getNext = (inputPartToAdd, correctedSamePart) => {
|
|
171
|
+
// const partToAdd = inputPartToAdd || currentSet;
|
|
172
|
+
// const currentSamePart = correctedSamePart || samePart;
|
|
173
|
+
// return changedValue.includes(e.key) && e.key !== changedValue[changedValue.length - 1]
|
|
174
|
+
// ? currentSamePart + (partToAdd[0] || '')
|
|
175
|
+
// : changedValue;
|
|
176
|
+
// };
|
|
177
|
+
/// ????????????????
|
|
178
|
+
|
|
179
|
+
if (!_index.KEYBOARD_SERVICE_KEYS.includes(e.key) && changedValue === previousValue) {
|
|
180
|
+
setIsAttemptToChange(!(!differencesLength && e.key === currentSet));
|
|
181
|
+
} /// ????????????????
|
|
182
|
+
// if (!previousValueRef.current || KEYBOARD_SERVICE_KEYS.includes(e.key)) previousValueRef.current = getNext();
|
|
183
|
+
// else if (changedValue === samePart) previousValueRef.current = getNext(changedValue, changedValue.slice(0, -1));
|
|
184
|
+
// else previousValueRef.current = getNext();
|
|
185
|
+
/// ????????????????
|
|
152
186
|
|
|
153
|
-
var getNext = function getNext(inputPartToAdd, correctedSamePart) {
|
|
154
|
-
var partToAdd = inputPartToAdd || currentSet;
|
|
155
|
-
var currentSamePart = correctedSamePart || samePart;
|
|
156
|
-
return changedValue.includes(e.key) && e.key !== changedValue[changedValue.length - 1] ? currentSamePart + (partToAdd[0] || '') : changedValue;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
if (!_index.KEYBOARD_SERVICE_KEYS.includes(e.key) && changedValue === previousValue) setIsAttemptToChange(!(!differencesLength && e.key === changedValue[changedValue.length - 2]));
|
|
160
|
-
if (!previousValueRef.current || _index.KEYBOARD_SERVICE_KEYS.includes(e.key)) previousValueRef.current = getNext();else if (changedValue === samePart) previousValueRef.current = getNext(changedValue, changedValue.slice(0, -1));else previousValueRef.current = getNext();
|
|
161
187
|
}
|
|
162
188
|
|
|
163
|
-
|
|
189
|
+
onKeyUp(e.keyCode, e);
|
|
164
190
|
}
|
|
165
191
|
};
|
|
192
|
+
(0, _react.useEffect)(function () {
|
|
193
|
+
var _inputRef$current, _inputRef$current$foc;
|
|
194
|
+
|
|
195
|
+
if (isEditing) inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : (_inputRef$current$foc = _inputRef$current.focus) === null || _inputRef$current$foc === void 0 ? void 0 : _inputRef$current$foc.call(_inputRef$current);
|
|
196
|
+
}, [isEditing, isFocused]);
|
|
197
|
+
(0, _react.useEffect)(function () {
|
|
198
|
+
setEditing(isSelect !== null && isSelect !== void 0 ? isSelect : false);
|
|
199
|
+
}, [isSelect]);
|
|
200
|
+
(0, _react.useEffect)(function () {
|
|
201
|
+
if (isUseErrorsBlink && isAttemptToChange) {
|
|
202
|
+
setIsAttemptToChange(null);
|
|
203
|
+
setIsToHighlightError(true);
|
|
204
|
+
setTimeout(function () {
|
|
205
|
+
setIsToHighlightError(false);
|
|
206
|
+
}, blinkTime || DEFAULT_BLINK_TIME);
|
|
207
|
+
}
|
|
208
|
+
}, [isAttemptToChange]);
|
|
209
|
+
(0, _react.useEffect)(function () {
|
|
210
|
+
if (inputRef !== null && inputRef !== void 0 && inputRef.current && typeof isFocusDefault === 'boolean') setIsFocused(isFocusDefault);
|
|
211
|
+
setEditing(isFocusDefault);
|
|
212
|
+
}, [inputRef, isFocusDefault]);
|
|
166
213
|
|
|
167
214
|
function renderInput() {
|
|
168
215
|
var uniProps = _objectSpread(_objectSpread({
|
|
169
216
|
className: "input ".concat(className),
|
|
170
217
|
placeholder: placeholder,
|
|
171
218
|
value: value || '',
|
|
219
|
+
inputmode: isNumericMobileKeyboard ? "numeric" : "text",
|
|
172
220
|
disabled: disabled,
|
|
173
221
|
onChange: handle.change,
|
|
174
222
|
onFocus: handle.focus,
|
|
175
223
|
onBlur: handle.blur,
|
|
176
|
-
onKeyUp: handle.keyUp
|
|
224
|
+
onKeyUp: handle.keyUp,
|
|
225
|
+
onKeyDown: handle.keyDown
|
|
177
226
|
}, maskChar ? {
|
|
178
227
|
maskChar: maskChar
|
|
179
228
|
} : {}), formatChars ? {
|
|
@@ -193,27 +242,6 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
193
242
|
}));
|
|
194
243
|
}
|
|
195
244
|
|
|
196
|
-
(0, _react.useEffect)(function () {
|
|
197
|
-
var _inputRef$current, _inputRef$current$foc;
|
|
198
|
-
|
|
199
|
-
if (isEditing) inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : (_inputRef$current$foc = _inputRef$current.focus) === null || _inputRef$current$foc === void 0 ? void 0 : _inputRef$current$foc.call(_inputRef$current);
|
|
200
|
-
}, [isEditing, isFocused]);
|
|
201
|
-
(0, _react.useEffect)(function () {
|
|
202
|
-
setEditing(isSelect !== null && isSelect !== void 0 ? isSelect : false);
|
|
203
|
-
}, [isSelect]);
|
|
204
|
-
(0, _react.useEffect)(function () {
|
|
205
|
-
if (isUseErrorsBlink && isAttemptToChange) {
|
|
206
|
-
setIsAttemptToChange(null);
|
|
207
|
-
setIsToHighlightError(true);
|
|
208
|
-
setTimeout(function () {
|
|
209
|
-
setIsToHighlightError(false);
|
|
210
|
-
}, blinkTime || DEFAULT_BLINK_TIME);
|
|
211
|
-
}
|
|
212
|
-
}, [isAttemptToChange]);
|
|
213
|
-
(0, _react.useEffect)(function () {
|
|
214
|
-
if (inputRef !== null && inputRef !== void 0 && inputRef.current && typeof isFocusDefault === 'boolean') setIsFocused(isFocusDefault);
|
|
215
|
-
setEditing(isFocusDefault);
|
|
216
|
-
}, [inputRef, isFocusDefault]);
|
|
217
245
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
218
246
|
className: (0, _classnames.default)("input__wrap", (0, _defineProperty2.default)({}, "input__wrap_focus", isFocused), (0, _defineProperty2.default)({}, "input__wrap_error", error || isToHighlightError), (0, _defineProperty2.default)({}, "input__wrap_disabled", disabled)),
|
|
219
247
|
onMouseEnter: function onMouseEnter() {
|
|
@@ -88,6 +88,11 @@ var _default = {
|
|
|
88
88
|
},
|
|
89
89
|
onKeyUp: {
|
|
90
90
|
description: 'custom callback on keyup, returns event keyCode'
|
|
91
|
+
},
|
|
92
|
+
isNumericMobileKeyboard: {
|
|
93
|
+
description: 'Enable Mobile Numeric Keyboard',
|
|
94
|
+
type: 'boolean',
|
|
95
|
+
default: false
|
|
91
96
|
}
|
|
92
97
|
}
|
|
93
98
|
};
|
|
@@ -129,5 +134,6 @@ InputTemplate.args = {
|
|
|
129
134
|
withDelete: true,
|
|
130
135
|
symbolsLimit: 255,
|
|
131
136
|
placeholder: 'Placeholder',
|
|
132
|
-
icon: /*#__PURE__*/_react.default.createElement(_reactFeather.User, null)
|
|
137
|
+
icon: /*#__PURE__*/_react.default.createElement(_reactFeather.User, null),
|
|
138
|
+
isNumericMobileKeyboard: false
|
|
133
139
|
};
|
|
@@ -9,6 +9,8 @@ exports.default = exports.RangeListCell = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
12
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
15
|
|
|
14
16
|
var _fi = require("react-icons/fi");
|
|
@@ -20,7 +22,7 @@ var RangeListCell = function RangeListCell(_ref) {
|
|
|
20
22
|
idx = _ref.idx,
|
|
21
23
|
className = _ref.className,
|
|
22
24
|
onClick = _ref.onClick;
|
|
23
|
-
return /*#__PURE__*/
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
24
26
|
className: (0, _classnames.default)("".concat(RC, "__cell"), className, (0, _defineProperty2.default)({}, "".concat(RC, "__cell-").concat(idx), idx)),
|
|
25
27
|
onClick: onClick
|
|
26
28
|
}, children);
|
|
@@ -33,21 +35,21 @@ var RangeListRow = function RangeListRow(_ref2) {
|
|
|
33
35
|
to = _ref2.to,
|
|
34
36
|
idx = _ref2.idx,
|
|
35
37
|
actionClick = _ref2.actionClick;
|
|
36
|
-
return /*#__PURE__*/
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
37
39
|
className: (0, _classnames.default)("".concat(RC, "__row"), "".concat(RC, "__values"), (0, _defineProperty2.default)({}, "".concat(RC, "__values_first-value"), idx === 0))
|
|
38
|
-
}, /*#__PURE__*/
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(RangeListCell, {
|
|
39
41
|
idx: 1,
|
|
40
42
|
className: "".concat(RC, "__cell-value")
|
|
41
|
-
}, from), /*#__PURE__*/
|
|
43
|
+
}, from), /*#__PURE__*/_react.default.createElement(RangeListCell, {
|
|
42
44
|
idx: 2,
|
|
43
45
|
className: "".concat(RC, "__cell-value")
|
|
44
|
-
}, to), /*#__PURE__*/
|
|
46
|
+
}, to), /*#__PURE__*/_react.default.createElement(RangeListCell, {
|
|
45
47
|
idx: 3,
|
|
46
48
|
className: "".concat(RC, "__cell-action"),
|
|
47
49
|
onClick: function onClick() {
|
|
48
50
|
return actionClick(idx);
|
|
49
51
|
}
|
|
50
|
-
}, /*#__PURE__*/
|
|
52
|
+
}, /*#__PURE__*/_react.default.createElement(_fi.FiTrash2, null)));
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
var _default = RangeListRow;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.default = void 0;
|
|
7
9
|
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
8
12
|
require("./Spinner.scss");
|
|
9
13
|
|
|
10
14
|
var Spinner = function Spinner(_ref) {
|
|
11
15
|
var _ref$little = _ref.little,
|
|
12
16
|
little = _ref$little === void 0 ? false : _ref$little;
|
|
13
|
-
return /*#__PURE__*/
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
14
18
|
className: "loader-box ".concat(little ? 'j8' : 'j5')
|
|
15
|
-
}, /*#__PURE__*/
|
|
19
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
16
20
|
className: "lds-ring ".concat(little ? 'lds-ring_little' : '')
|
|
17
|
-
}, /*#__PURE__*/
|
|
21
|
+
}, /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null)));
|
|
18
22
|
};
|
|
19
23
|
|
|
20
24
|
var _default = Spinner;
|
|
@@ -13,12 +13,12 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
13
13
|
|
|
14
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
15
|
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
16
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
19
|
|
|
18
20
|
var _moment = _interopRequireDefault(require("moment"));
|
|
19
21
|
|
|
20
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
-
|
|
22
22
|
var Icon = _interopRequireWildcard(require("react-feather"));
|
|
23
23
|
|
|
24
24
|
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); }
|