intelicoreact 1.0.32 → 1.0.34
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/InputColor/InputColor.js +16 -10
- package/dist/Atomic/FormElements/InputLink/InputLink.js +6 -18
- package/dist/Atomic/UI/NavLine/NavLine.js +4 -0
- package/dist/Atomic/UI/NavLine/NavLine.scss +4 -0
- package/dist/Functions/fieldValueFormatters.js +2 -1
- package/package.json +1 -1
|
@@ -21,31 +21,36 @@ 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
|
+
var withSharp = withHexFormat.withSharp,
|
|
45
|
+
isHex = withHexFormat.isTurnOn; // HANDLES
|
|
46
|
+
|
|
42
47
|
var handle = {
|
|
43
48
|
change: function change(e) {
|
|
44
49
|
var inputValue = e !== null && e !== void 0 && e.target ? e.target.value : e;
|
|
45
50
|
inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
46
|
-
if (
|
|
51
|
+
if (isHex) inputValue = (0, _fieldValueFormatters.formatToHex)({
|
|
47
52
|
inputValue: inputValue,
|
|
48
|
-
withSharp:
|
|
53
|
+
withSharp: withSharp
|
|
49
54
|
});
|
|
50
55
|
if (symbolsLimit && inputValue.length > +symbolsLimit) inputValue = inputValue.substring(0, +symbolsLimit);
|
|
51
56
|
onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
|
|
@@ -60,11 +65,12 @@ var InputColor = function InputColor(_ref) {
|
|
|
60
65
|
}
|
|
61
66
|
}), /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({}, args, {
|
|
62
67
|
value: value,
|
|
68
|
+
withDelete: withDelete,
|
|
63
69
|
onChange: handle.change,
|
|
64
70
|
symbolsLimit: symbolsLimit || 7,
|
|
71
|
+
testId: "inputColor--key-".concat(testId),
|
|
65
72
|
className: (0, _classnames.default)('input inputColor__input'),
|
|
66
|
-
type: "text"
|
|
67
|
-
testId: testId
|
|
73
|
+
type: "text"
|
|
68
74
|
})));
|
|
69
75
|
};
|
|
70
76
|
|
|
@@ -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() {
|
|
@@ -301,6 +301,8 @@ var NavLine = function NavLine(_ref) {
|
|
|
301
301
|
active: activeTab === item.tabId
|
|
302
302
|
}, {
|
|
303
303
|
disabled: item.disabled || mode === 'create' && item.tabId !== 'general'
|
|
304
|
+
}, {
|
|
305
|
+
'nav-line__item--hidden': item.isHidden
|
|
304
306
|
}),
|
|
305
307
|
ref: checkedRef(ref)
|
|
306
308
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -324,6 +326,8 @@ var NavLine = function NavLine(_ref) {
|
|
|
324
326
|
active: activeTab === item.tabId
|
|
325
327
|
}, {
|
|
326
328
|
disabled: item.disabled || mode === 'create' && item.tabId !== 'general'
|
|
329
|
+
}, {
|
|
330
|
+
'nav-line__item--hidden': item.isHidden
|
|
327
331
|
}),
|
|
328
332
|
ref: checkedRef(ref)
|
|
329
333
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -236,7 +236,8 @@ var formatToHex = function formatToHex(_ref2) {
|
|
|
236
236
|
var inputValue = _ref2.inputValue,
|
|
237
237
|
withSharp = _ref2.withSharp;
|
|
238
238
|
var value = getSafelyValue(inputValue);
|
|
239
|
-
|
|
239
|
+
if (withSharp) return "#".concat(value.replace(/[^a-f0-9]/gi, ''));
|
|
240
|
+
return "".concat(value.replace(/[^#a-f0-9]/gi, ''));
|
|
240
241
|
};
|
|
241
242
|
/**
|
|
242
243
|
* It takes a string and returns a string with all white space removed
|