intelicoreact 1.0.32 → 1.0.33
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.
|
@@ -21,22 +21,25 @@ var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
|
21
21
|
|
|
22
22
|
require("./InputColor.scss");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["value", "className", "symbolsLimit", "onChange", "withHexFormat", "initialHexOfColorBlock", "testId"];
|
|
24
|
+
var _excluded = ["value", "className", "symbolsLimit", "onChange", "withHexFormat", "initialHexOfColorBlock", "testId", "withDelete"];
|
|
25
25
|
|
|
26
26
|
var InputColor = function InputColor(_ref) {
|
|
27
27
|
var value = _ref.value,
|
|
28
28
|
className = _ref.className,
|
|
29
|
-
symbolsLimit = _ref.symbolsLimit,
|
|
29
|
+
_ref$symbolsLimit = _ref.symbolsLimit,
|
|
30
|
+
symbolsLimit = _ref$symbolsLimit === void 0 ? 7 : _ref$symbolsLimit,
|
|
30
31
|
onChange = _ref.onChange,
|
|
31
32
|
_ref$withHexFormat = _ref.withHexFormat,
|
|
32
33
|
withHexFormat = _ref$withHexFormat === void 0 ? {
|
|
33
|
-
withSharp:
|
|
34
|
+
withSharp: false,
|
|
34
35
|
isTurnOn: true
|
|
35
36
|
} : _ref$withHexFormat,
|
|
36
37
|
_ref$initialHexOfColo = _ref.initialHexOfColorBlock,
|
|
37
|
-
initialHexOfColorBlock = _ref$initialHexOfColo === void 0 ? '
|
|
38
|
+
initialHexOfColorBlock = _ref$initialHexOfColo === void 0 ? '#9AA0B9' : _ref$initialHexOfColo,
|
|
38
39
|
_ref$testId = _ref.testId,
|
|
39
|
-
testId = _ref$testId === void 0 ? '
|
|
40
|
+
testId = _ref$testId === void 0 ? '' : _ref$testId,
|
|
41
|
+
_ref$withDelete = _ref.withDelete,
|
|
42
|
+
withDelete = _ref$withDelete === void 0 ? true : _ref$withDelete,
|
|
40
43
|
args = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
41
44
|
// HANDLES
|
|
42
45
|
var handle = {
|
|
@@ -60,11 +63,12 @@ var InputColor = function InputColor(_ref) {
|
|
|
60
63
|
}
|
|
61
64
|
}), /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({}, args, {
|
|
62
65
|
value: value,
|
|
66
|
+
withDelete: withDelete,
|
|
63
67
|
onChange: handle.change,
|
|
64
68
|
symbolsLimit: symbolsLimit || 7,
|
|
69
|
+
testId: "inputColor--key-".concat(testId),
|
|
65
70
|
className: (0, _classnames.default)('input inputColor__input'),
|
|
66
|
-
type: "text"
|
|
67
|
-
testId: testId
|
|
71
|
+
type: "text"
|
|
68
72
|
})));
|
|
69
73
|
};
|
|
70
74
|
|
|
@@ -36,13 +36,12 @@ var InputColor = function InputColor(_ref) {
|
|
|
36
36
|
value = _ref.value,
|
|
37
37
|
_ref$withHttpsPrefix = _ref.withHttpsPrefix,
|
|
38
38
|
withHttpsPrefix = _ref$withHttpsPrefix === void 0 ? {
|
|
39
|
-
isTurnOn:
|
|
40
|
-
isSecure:
|
|
41
|
-
isBorderErrorWithEmptyHost: false
|
|
39
|
+
isTurnOn: true,
|
|
40
|
+
isSecure: true
|
|
42
41
|
} : _ref$withHttpsPrefix,
|
|
43
42
|
onRedirect = _ref.onRedirect,
|
|
44
43
|
_ref$testId = _ref.testId,
|
|
45
|
-
testId = _ref$testId === void 0 ? '
|
|
44
|
+
testId = _ref$testId === void 0 ? '' : _ref$testId,
|
|
46
45
|
onChange = _ref.onChange,
|
|
47
46
|
withDelete = _ref.withDelete,
|
|
48
47
|
args = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -54,17 +53,6 @@ var InputColor = function InputColor(_ref) {
|
|
|
54
53
|
var inputRef = (0, _react.useRef)(null);
|
|
55
54
|
var handle = {
|
|
56
55
|
redirect: function redirect() {
|
|
57
|
-
var _ref3 = withHttpsPrefix || {},
|
|
58
|
-
isBorderErrorWithEmptyHost = _ref3.isBorderErrorWithEmptyHost,
|
|
59
|
-
isSecure = _ref3.isSecure,
|
|
60
|
-
isPrefix = _ref3.isTurnOn;
|
|
61
|
-
|
|
62
|
-
if (isPrefix && isBorderErrorWithEmptyHost) {
|
|
63
|
-
if (isSecure && (value === null || value === void 0 ? void 0 : value.length) <= 8 || !isSecure && (value === null || value === void 0 ? void 0 : value.length) <= 7) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
56
|
window.open("http".concat(isSecure ? 's' : '', "://").concat(value.replace(/https?:\/\/?/g, '')), '_blank');
|
|
69
57
|
onRedirect === null || onRedirect === void 0 ? void 0 : onRedirect();
|
|
70
58
|
},
|
|
@@ -93,7 +81,7 @@ var InputColor = function InputColor(_ref) {
|
|
|
93
81
|
})
|
|
94
82
|
}, isPrefix && /*#__PURE__*/_react.default.createElement("div", {
|
|
95
83
|
className: (0, _classnames.default)('inputColor__prefix')
|
|
96
|
-
}, isSecure ? 'https://' : 'http://'), /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({}, args, {
|
|
84
|
+
}, isSecure && (value === null || value === void 0 ? void 0 : value.length) > 0 && 'https://', !isSecure && (value === null || value === void 0 ? void 0 : value.length) > 0 && 'http://'), /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({}, args, {
|
|
97
85
|
withDelete: withDelete,
|
|
98
86
|
value: value,
|
|
99
87
|
onChange: handle.change,
|
|
@@ -102,8 +90,8 @@ var InputColor = function InputColor(_ref) {
|
|
|
102
90
|
autoComplete: "url",
|
|
103
91
|
ref: inputRef,
|
|
104
92
|
className: (0, _classnames.default)({
|
|
105
|
-
'prefix-gutter--secured': isPrefix && isSecure,
|
|
106
|
-
'prefix-gutter--no-secured': isPrefix && !isSecure
|
|
93
|
+
'prefix-gutter--secured': isPrefix && isSecure && (value === null || value === void 0 ? void 0 : value.length) > 0,
|
|
94
|
+
'prefix-gutter--no-secured': isPrefix && !isSecure && (value === null || value === void 0 ? void 0 : value.length) > 0
|
|
107
95
|
})
|
|
108
96
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
109
97
|
onClick: function onClick() {
|