intelicoreact 0.3.27 → 0.3.29

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.
@@ -81,7 +81,9 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
81
81
  isCropFirstNool = _ref$isCropFirstNool === void 0 ? false : _ref$isCropFirstNool,
82
82
  _ref$testId = _ref.testId,
83
83
  testId = _ref$testId === void 0 ? 'input' : _ref$testId,
84
- action = _ref.action;
84
+ action = _ref.action,
85
+ _ref$isUseAutoSelect = _ref.isUseAutoSelect,
86
+ isUseAutoSelect = _ref$isUseAutoSelect === void 0 ? true : _ref$isUseAutoSelect;
85
87
  var DEFAULT_BLINK_TIME = 100; // STATES
86
88
 
87
89
  var _useState = (0, _react.useState)(false),
@@ -263,7 +265,11 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
263
265
  }, uniProps, {
264
266
  ref: inputRef,
265
267
  type: isPriceInput ? 'text' : type,
266
- autoComplete: autocomplete
268
+ autoComplete: autocomplete,
269
+ onFocus: function onFocus() {
270
+ if (isUseAutoSelect) inputRef.current.select();
271
+ if (uniProps.onFocus) uniProps.onFocus.apply(uniProps, arguments);
272
+ }
267
273
  }));
268
274
  }
269
275
 
@@ -62,6 +62,8 @@ function InputMask() {
62
62
  isClearable = _ref.isClearable,
63
63
  isCaseSensitive = _ref.isCaseSensitive,
64
64
  adaptTextCase = _ref.adaptTextCase,
65
+ _ref$isUseAutoSelect = _ref.isUseAutoSelect,
66
+ isUseAutoSelect = _ref$isUseAutoSelect === void 0 ? true : _ref$isUseAutoSelect,
65
67
  icon = _ref.icon,
66
68
  showIcon = _ref.showIcon,
67
69
  isIconLeft = _ref.isIconLeft,
@@ -1358,8 +1360,9 @@ function InputMask() {
1358
1360
  onClick: function onClick(e) {
1359
1361
  return onCharClick(e, i);
1360
1362
  },
1361
- onFocus: function onFocus(e) {
1362
- return _onFocus(e, i);
1363
+ onFocus: function onFocus() {
1364
+ if (isUseAutoSelect) inputRef.current.select();
1365
+ if (_onFocus) _onFocus.apply(void 0, arguments);
1363
1366
  },
1364
1367
  onBlur: onBlur,
1365
1368
  onKeyPress: cancelDefaultAction,
@@ -58,6 +58,8 @@ function InputMask2() {
58
58
  isClearable = _ref.isClearable,
59
59
  isCaseSensitive = _ref.isCaseSensitive,
60
60
  adaptTextCase = _ref.adaptTextCase,
61
+ _ref$isUseAutoSelect = _ref.isUseAutoSelect,
62
+ isUseAutoSelect = _ref$isUseAutoSelect === void 0 ? true : _ref$isUseAutoSelect,
61
63
  icon = _ref.icon,
62
64
  showIcon = _ref.showIcon,
63
65
  isIconLeft = _ref.isIconLeft,
@@ -503,7 +505,7 @@ function InputMask2() {
503
505
  setErrorMessage(null);
504
506
  };
505
507
 
506
- var onFocus = function onFocus(e) {
508
+ var _onFocus = function onFocus(e) {
507
509
  setFocused(true);
508
510
  onFocusProp();
509
511
  };
@@ -649,7 +651,10 @@ function InputMask2() {
649
651
  };
650
652
 
651
653
  var renderInput = function renderInput() {
652
- return /*#__PURE__*/_react.default.createElement("input", {
654
+ var _ref12, _ref13;
655
+
656
+ return /*#__PURE__*/_react.default.createElement("input", (0, _defineProperty2.default)({
657
+ name: (_ref12 = (_ref13 = name !== null && name !== void 0 ? name : key) !== null && _ref13 !== void 0 ? _ref13 : testId) !== null && _ref12 !== void 0 ? _ref12 : '',
653
658
  "data-testid": testId,
654
659
  className: "input-mask_input ".concat(className),
655
660
  ref: inputRef,
@@ -657,11 +662,14 @@ function InputMask2() {
657
662
  onChange: handleChange,
658
663
  onKeyDown: onKeyDown,
659
664
  onKeyUp: onKeyUp,
660
- onFocus: onFocus,
665
+ onFocus: _onFocus,
661
666
  onBlur: onBlur,
662
667
  onClick: onClick,
663
668
  autoComplete: autocomplete
664
- });
669
+ }, "onFocus", function onFocus() {
670
+ if (isUseAutoSelect) inputRef.current.select();
671
+ if (_onFocus) _onFocus.apply(void 0, arguments);
672
+ }));
665
673
  };
666
674
 
667
675
  var render = function render() {
@@ -74,7 +74,9 @@ var NumericInput = function NumericInput(_ref) {
74
74
  _ref$isFocusDefault = _ref.isFocusDefault,
75
75
  isFocusDefault = _ref$isFocusDefault === void 0 ? false : _ref$isFocusDefault,
76
76
  _ref$isNotRenderButto = _ref.isNotRenderButtons,
77
- isNotRenderButtons = _ref$isNotRenderButto === void 0 ? false : _ref$isNotRenderButto;
77
+ isNotRenderButtons = _ref$isNotRenderButto === void 0 ? false : _ref$isNotRenderButto,
78
+ _ref$isUseAutoSelect = _ref.isUseAutoSelect,
79
+ isUseAutoSelect = _ref$isUseAutoSelect === void 0 ? true : _ref$isUseAutoSelect;
78
80
  var DEFAULT_BLINK_TIME = 200; //REFS
79
81
 
80
82
  var inputRef = (0, _react.useRef)(null);
@@ -289,7 +291,11 @@ var NumericInput = function NumericInput(_ref) {
289
291
  "data-testid": "input--".concat(testId),
290
292
  value: (0, _fieldValueFormatters.formatToAddBitDepthPoints)((0, _fieldValueFormatters.formatToRemoveComa)(value)),
291
293
  ref: inputRef,
292
- type: "text"
294
+ type: "text",
295
+ onFocus: function onFocus() {
296
+ if (isUseAutoSelect) inputRef.current.select();
297
+ if (uniProps.onFocus) uniProps.onFocus.apply(uniProps, arguments);
298
+ }
293
299
  })), !isNotRenderButtons ? /*#__PURE__*/_react.default.createElement("div", {
294
300
  className: "input__nums"
295
301
  }, /*#__PURE__*/_react.default.createElement("button", {
@@ -91,7 +91,8 @@ var UserContacts = function UserContacts(props) {
91
91
  }) : [])) : mainContactsStructure;
92
92
  var mainContactsCount = mainContactsStructure.length;
93
93
  var otherContactsCount = (otherContacts === null || otherContacts === void 0 ? void 0 : otherContacts.length) || 0;
94
- var isContact = !!mainContactsCount;
94
+ var isContacts = !!mainContactsCount || !!otherContactsCount;
95
+ var isMainContacts = !!mainContactsCount;
95
96
  var mainRef = (0, _react.useRef)(null);
96
97
  var firstRef = (0, _react.useRef)(null);
97
98
  var secondRef = (0, _react.useRef)(null);
@@ -178,18 +179,18 @@ var UserContacts = function UserContacts(props) {
178
179
  target: "_blank",
179
180
  rel: "noreferrer",
180
181
  className: getClasses(true)
181
- }, isIconMode ? getIcon(firstKey) : "".concat(props[firstKey]).concat(props[secondKey] || isContact ? getSeparator() : '')), !!props[secondKey] && /*#__PURE__*/_react.default.createElement("a", {
182
+ }, isIconMode ? getIcon(firstKey) : "".concat(props[firstKey]).concat(props[secondKey] || isContacts ? getSeparator() : '')), !!props[secondKey] && /*#__PURE__*/_react.default.createElement("a", {
182
183
  ref: secondRef,
183
184
  href: "".concat(getProtocol(secondKey)).concat(props[secondKey].trim()),
184
185
  target: "_blank",
185
186
  rel: "noreferrer",
186
187
  className: getClasses()
187
- }, isIconMode ? getIcon(secondKey) : "".concat(props[secondKey]).concat(isContact ? getSeparator() : '')), isContact && /*#__PURE__*/_react.default.createElement("span", {
188
+ }, isIconMode ? getIcon(secondKey) : "".concat(props[secondKey]).concat(isContacts ? getSeparator() : '')), isContacts && /*#__PURE__*/_react.default.createElement("span", {
188
189
  ref: contactsRef,
189
190
  className: (0, _classnames.default)('no-wrap', "".concat(RC, "__contacts"))
190
- }, mainContactsStructure.map(function (contact) {
191
+ }, isMainContacts ? mainContactsStructure.map(function (contact) {
191
192
  return "".concat(contact).concat(getSeparator('main'));
192
- }), generalizingWord && !isNotRenderGeneralizingWord ? " ".concat(Lng(generalizingWord)) : '', !!otherContacts && !!(otherContacts !== null && otherContacts !== void 0 && otherContacts.length) && !isOtherTogetherMainContacts ? getSeparator() : '', !!otherContacts && !!(otherContacts !== null && otherContacts !== void 0 && otherContacts.length) && !isOtherTogetherMainContacts ? otherContacts === null || otherContacts === void 0 ? void 0 : (_otherContacts$map2 = otherContacts.map) === null || _otherContacts$map2 === void 0 ? void 0 : _otherContacts$map2.call(otherContacts, function (contact) {
193
+ }) : null, isMainContacts && generalizingWord && !isNotRenderGeneralizingWord ? " ".concat(Lng(generalizingWord)) : '', isMainContacts && !!otherContacts && !!(otherContacts !== null && otherContacts !== void 0 && otherContacts.length) && !isOtherTogetherMainContacts ? getSeparator() : '', !!otherContacts && !!(otherContacts !== null && otherContacts !== void 0 && otherContacts.length) && !isOtherTogetherMainContacts ? otherContacts === null || otherContacts === void 0 ? void 0 : (_otherContacts$map2 = otherContacts.map) === null || _otherContacts$map2 === void 0 ? void 0 : _otherContacts$map2.call(otherContacts, function (contact) {
193
194
  return "".concat(contact).concat(getSeparator('other'));
194
195
  }) : null));
195
196
  };
@@ -0,0 +1,62 @@
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 _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var DEFAULT_ANIMATION_DURATION = 200;
15
+ var AnimatedHandler = /*#__PURE__*/(0, _createClass2.default)(function AnimatedHandler(params) {
16
+ (0, _classCallCheck2.default)(this, AnimatedHandler);
17
+
18
+ var _ref = params || {},
19
+ _ref$type = _ref.type,
20
+ type = _ref$type === void 0 ? '' : _ref$type,
21
+ animationTarget = _ref.animationTarget,
22
+ animation = _ref.animation,
23
+ settings = _ref.settings,
24
+ hendler = _ref.hendler;
25
+
26
+ if (!animationTarget || !hendler) throw new Error('Bad input!');
27
+
28
+ var _ref2 = animation || {},
29
+ keyframes = _ref2.keyframes,
30
+ delay = _ref2.delay,
31
+ direction = _ref2.direction,
32
+ duration = _ref2.duration,
33
+ easing = _ref2.easing,
34
+ endDelay = _ref2.endDelay,
35
+ fill = _ref2.fill,
36
+ iterationStart = _ref2.iterationStart,
37
+ iterations = _ref2.iterations; // eslint-disable-next-line no-constructor-return
38
+
39
+
40
+ return function () {
41
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
42
+ args[_key] = arguments[_key];
43
+ }
44
+
45
+ var keyframesToUse = Array.isArray(keyframes) ? keyframes : [{
46
+ height: "".concat(animationTarget.clientHeight, "px"),
47
+ opacity: 1
48
+ }, {
49
+ height: '0',
50
+ opacity: 0
51
+ }];
52
+ var durationToUse = duration || DEFAULT_ANIMATION_DURATION;
53
+ animationTarget.animate(keyframesToUse, animation);
54
+ return new Promise(function (res) {
55
+ setTimeout(function () {
56
+ return res(hendler ? hendler.apply(void 0, args) : undefined);
57
+ }, durationToUse);
58
+ });
59
+ };
60
+ });
61
+ var _default = AnimatedHandler;
62
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "0.3.27",
3
+ "version": "0.3.29",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [