intelicoreact 1.1.9 → 1.1.10
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.
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
|
|
12
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -17,12 +19,6 @@ var _utils = require("../../../Functions/utils");
|
|
|
17
19
|
|
|
18
20
|
require("./FileLoaderLocal.scss");
|
|
19
21
|
|
|
20
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
21
|
-
|
|
22
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
-
|
|
24
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
-
|
|
26
22
|
var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
27
23
|
var groupId = _ref.groupId,
|
|
28
24
|
id = _ref.id,
|
|
@@ -56,38 +52,18 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
56
52
|
return file.size > maxItemSizeBytes;
|
|
57
53
|
};
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var _iterator = _createForOfIteratorHelper(parts),
|
|
66
|
-
_step;
|
|
67
|
-
|
|
68
|
-
try {
|
|
69
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
70
|
-
var part = _step.value;
|
|
71
|
-
|
|
72
|
-
if (part.includes('.')) {
|
|
73
|
-
var extension = part.substring(part.lastIndexOf('.'));
|
|
74
|
-
|
|
75
|
-
if (!extensions.includes(extension)) {
|
|
76
|
-
extensions.push(extension);
|
|
77
|
-
newParts.push(part);
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
newParts.push(part);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
} catch (err) {
|
|
84
|
-
_iterator.e(err);
|
|
85
|
-
} finally {
|
|
86
|
-
_iterator.f();
|
|
87
|
-
}
|
|
55
|
+
function getUniqueExtensionsList(extList) {
|
|
56
|
+
// Split the extensions list into an array
|
|
57
|
+
var extArray = extList === null || extList === void 0 ? void 0 : extList.split(',').map(function (ext) {
|
|
58
|
+
return ext.trim().toUpperCase();
|
|
59
|
+
}); // Remove duplicates using a Set
|
|
88
60
|
|
|
89
|
-
|
|
90
|
-
|
|
61
|
+
var uniqueExts = (0, _toConsumableArray2.default)(new Set(extArray)); // Join the unique extensions into a string
|
|
62
|
+
|
|
63
|
+
var uniqueExtString = uniqueExts.join(', '); // Return the final message
|
|
64
|
+
|
|
65
|
+
return "Only ".concat(uniqueExtString, " are allowed");
|
|
66
|
+
}
|
|
91
67
|
|
|
92
68
|
var checkExtension = function checkExtension(valueExtension) {
|
|
93
69
|
return accept.includes(valueExtension);
|
|
@@ -95,9 +71,11 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
95
71
|
|
|
96
72
|
var handle = {
|
|
97
73
|
change: function change(e) {
|
|
74
|
+
var _e$target, _e$target$files;
|
|
75
|
+
|
|
98
76
|
var name = getFileName(e.target.value);
|
|
99
|
-
var valueExtension = name.match(/[^\.]+$/)[0];
|
|
100
|
-
var file = e.target.files[0];
|
|
77
|
+
var valueExtension = name === null || name === void 0 ? void 0 : name.match(/[^\.]+$/)[0];
|
|
78
|
+
var file = (_e$target = e.target) === null || _e$target === void 0 ? void 0 : (_e$target$files = _e$target.files) === null || _e$target$files === void 0 ? void 0 : _e$target$files[0];
|
|
101
79
|
|
|
102
80
|
if (isFileSizeOutOfLimit(e.target.files[0])) {
|
|
103
81
|
onChange({
|
|
@@ -120,7 +98,7 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
120
98
|
valueExtension: valueExtension,
|
|
121
99
|
e: e,
|
|
122
100
|
file: file,
|
|
123
|
-
error:
|
|
101
|
+
error: getUniqueExtensionsList(allowedExtensions)
|
|
124
102
|
});
|
|
125
103
|
} else onChange({
|
|
126
104
|
id: id,
|
|
@@ -25,6 +25,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
25
25
|
|
|
26
26
|
var Icons = _interopRequireWildcard(require("react-feather"));
|
|
27
27
|
|
|
28
|
+
var _index = require("../../../Constants/index.constants");
|
|
29
|
+
|
|
28
30
|
require("./NavLine.scss");
|
|
29
31
|
|
|
30
32
|
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); }
|
|
@@ -51,6 +53,8 @@ var NavLine = function NavLine(_ref) {
|
|
|
51
53
|
children = _ref.children,
|
|
52
54
|
isLocal = _ref.isLocal,
|
|
53
55
|
mode = _ref.mode,
|
|
56
|
+
isNavigateByKeys = _ref.isNavigateByKeys,
|
|
57
|
+
isTabLoading = _ref.isTabLoading,
|
|
54
58
|
_ref$scrollMode = _ref.scrollMode,
|
|
55
59
|
scrollMode = _ref$scrollMode === void 0 ? false : _ref$scrollMode;
|
|
56
60
|
|
|
@@ -228,6 +232,35 @@ var NavLine = function NavLine(_ref) {
|
|
|
228
232
|
onChange(item.tabId);
|
|
229
233
|
};
|
|
230
234
|
|
|
235
|
+
var navigateByKeys = function navigateByKeys(event) {
|
|
236
|
+
var _items$find;
|
|
237
|
+
|
|
238
|
+
var activeTabId = items === null || items === void 0 ? void 0 : (_items$find = items.find(function (item) {
|
|
239
|
+
return item.tabId === activeTab;
|
|
240
|
+
})) === null || _items$find === void 0 ? void 0 : _items$find.id;
|
|
241
|
+
var nextTab = items === null || items === void 0 ? void 0 : items.find(function (item) {
|
|
242
|
+
return item.id === activeTabId + 1;
|
|
243
|
+
});
|
|
244
|
+
var prevTab = items === null || items === void 0 ? void 0 : items.find(function (item) {
|
|
245
|
+
return item.id === activeTabId - 1;
|
|
246
|
+
});
|
|
247
|
+
var lastTabIndex = (items === null || items === void 0 ? void 0 : items.indexOf(items === null || items === void 0 ? void 0 : items.at(-1))) + 1;
|
|
248
|
+
|
|
249
|
+
if (event.keyCode === _index.KEYBOARD_KEY_CODES.ARROW_RIGHT && !event.repeat && activeTabId < lastTabIndex) {
|
|
250
|
+
onChange(nextTab === null || nextTab === void 0 ? void 0 : nextTab.tabId);
|
|
251
|
+
} else if (event.keyCode === _index.KEYBOARD_KEY_CODES.ARROW_LEFT && !event.repeat && activeTabId > 1) {
|
|
252
|
+
onChange(prevTab === null || prevTab === void 0 ? void 0 : prevTab.tabId);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
(0, _react.useEffect)(function () {
|
|
257
|
+
if (isNavigateByKeys && !isTabLoading) {
|
|
258
|
+
document.addEventListener('keydown', navigateByKeys);
|
|
259
|
+
return function () {
|
|
260
|
+
return document.removeEventListener('keydown', navigateByKeys);
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}, [activeTab, isTabLoading]);
|
|
231
264
|
(0, _react.useEffect)(function () {
|
|
232
265
|
var _wrapperRef$current;
|
|
233
266
|
|
|
@@ -8,107 +8,116 @@ var _default = {
|
|
|
8
8
|
activeTab: '',
|
|
9
9
|
initialTab: '',
|
|
10
10
|
variant: 'simple',
|
|
11
|
+
isNavigateByKeys: true,
|
|
11
12
|
items: [{
|
|
13
|
+
id: 0,
|
|
12
14
|
tabId: '',
|
|
13
15
|
label: 'All Industries'
|
|
14
16
|
}, {
|
|
15
|
-
|
|
17
|
+
id: 1,
|
|
18
|
+
tabId: 1,
|
|
16
19
|
label: 'Doors'
|
|
17
20
|
}, {
|
|
18
|
-
|
|
21
|
+
id: 2,
|
|
22
|
+
tabId: 2,
|
|
19
23
|
label: 'Flooring'
|
|
20
24
|
}, {
|
|
21
|
-
|
|
25
|
+
id: 3,
|
|
26
|
+
tabId: 3,
|
|
22
27
|
label: 'Home Automation'
|
|
23
28
|
}, {
|
|
24
|
-
|
|
29
|
+
id: 4,
|
|
30
|
+
tabId: 4,
|
|
25
31
|
label: 'HVAC'
|
|
26
32
|
}, {
|
|
27
|
-
|
|
33
|
+
id: 5,
|
|
34
|
+
tabId: 5,
|
|
28
35
|
label: 'Pools and Spas'
|
|
29
36
|
}, {
|
|
30
|
-
|
|
37
|
+
id: 6,
|
|
38
|
+
tabId: 6,
|
|
31
39
|
label: 'Roofing'
|
|
32
40
|
}, {
|
|
33
|
-
|
|
41
|
+
id: 7,
|
|
42
|
+
tabId: 7,
|
|
34
43
|
label: 'Solar systems'
|
|
35
44
|
}, {
|
|
36
|
-
tabId:
|
|
45
|
+
tabId: 8,
|
|
37
46
|
label: 'Termite tenting'
|
|
38
47
|
}, {
|
|
39
|
-
tabId:
|
|
48
|
+
tabId: 9,
|
|
40
49
|
label: 'Water filtration'
|
|
41
50
|
}, {
|
|
42
|
-
tabId:
|
|
51
|
+
tabId: 10,
|
|
43
52
|
label: 'Water heaters'
|
|
44
53
|
}, {
|
|
45
|
-
tabId:
|
|
54
|
+
tabId: 11,
|
|
46
55
|
label: 'Windows'
|
|
47
56
|
}, {
|
|
48
|
-
tabId:
|
|
57
|
+
tabId: 12,
|
|
49
58
|
label: 'Audiology'
|
|
50
59
|
}, {
|
|
51
|
-
tabId:
|
|
60
|
+
tabId: 13,
|
|
52
61
|
label: 'Chiropractic'
|
|
53
62
|
}, {
|
|
54
|
-
tabId:
|
|
63
|
+
tabId: 14,
|
|
55
64
|
label: 'Cosmetic Surgery'
|
|
56
65
|
}, {
|
|
57
|
-
tabId:
|
|
66
|
+
tabId: 15,
|
|
58
67
|
label: 'Dental'
|
|
59
68
|
}, {
|
|
60
|
-
tabId:
|
|
69
|
+
tabId: 16,
|
|
61
70
|
label: 'Dermatology'
|
|
62
71
|
}, {
|
|
63
|
-
tabId:
|
|
72
|
+
tabId: 17,
|
|
64
73
|
label: 'Medical Devices'
|
|
65
74
|
}, {
|
|
66
|
-
tabId:
|
|
75
|
+
tabId: 18,
|
|
67
76
|
label: 'Non-invasive Cosmetics'
|
|
68
77
|
}, {
|
|
69
|
-
tabId:
|
|
78
|
+
tabId: 19,
|
|
70
79
|
label: 'Optometry'
|
|
71
80
|
}, {
|
|
72
|
-
tabId:
|
|
81
|
+
tabId: 20,
|
|
73
82
|
label: 'Vision'
|
|
74
83
|
}, {
|
|
75
|
-
tabId:
|
|
84
|
+
tabId: 21,
|
|
76
85
|
label: 'Weight Loss'
|
|
77
86
|
}, {
|
|
78
|
-
tabId:
|
|
87
|
+
tabId: 22,
|
|
79
88
|
label: 'Appliances'
|
|
80
89
|
}, {
|
|
81
|
-
tabId:
|
|
90
|
+
tabId: 23,
|
|
82
91
|
label: 'Electronics'
|
|
83
92
|
}, {
|
|
84
|
-
tabId:
|
|
93
|
+
tabId: 24,
|
|
85
94
|
label: 'Furniture'
|
|
86
95
|
}, {
|
|
87
|
-
tabId:
|
|
96
|
+
tabId: 25,
|
|
88
97
|
label: 'Mattress'
|
|
89
98
|
}, {
|
|
90
|
-
tabId:
|
|
99
|
+
tabId: 26,
|
|
91
100
|
label: 'Jewelry'
|
|
92
101
|
}, {
|
|
93
|
-
tabId:
|
|
102
|
+
tabId: 27,
|
|
94
103
|
label: 'Dog Training'
|
|
95
104
|
}, {
|
|
96
|
-
tabId:
|
|
105
|
+
tabId: 28,
|
|
97
106
|
label: 'Pet Retail'
|
|
98
107
|
}, {
|
|
99
|
-
tabId:
|
|
108
|
+
tabId: 29,
|
|
100
109
|
label: 'Veterinary'
|
|
101
110
|
}, {
|
|
102
|
-
tabId:
|
|
111
|
+
tabId: 30,
|
|
103
112
|
label: 'Coaching'
|
|
104
113
|
}, {
|
|
105
|
-
tabId:
|
|
114
|
+
tabId: 31,
|
|
106
115
|
label: 'Funeral'
|
|
107
116
|
}, {
|
|
108
|
-
tabId:
|
|
117
|
+
tabId: 32,
|
|
109
118
|
label: 'Legal'
|
|
110
119
|
}, {
|
|
111
|
-
tabId:
|
|
120
|
+
tabId: 33,
|
|
112
121
|
label: 'Tax resolution'
|
|
113
122
|
}]
|
|
114
123
|
};
|
|
@@ -16,7 +16,9 @@ var DEFAULT_COLORS = ['#D9C1FF', '#FFBAF0', '#FFB8CE', '#FFC3A2', '#FFDB7C', '#F
|
|
|
16
16
|
exports.DEFAULT_COLORS = DEFAULT_COLORS;
|
|
17
17
|
var KEYBOARD_KEY_CODES = {
|
|
18
18
|
Backspace: 8,
|
|
19
|
-
Delete: 46
|
|
19
|
+
Delete: 46,
|
|
20
|
+
ARROW_LEFT: 37,
|
|
21
|
+
ARROW_RIGHT: 39
|
|
20
22
|
};
|
|
21
23
|
exports.KEYBOARD_KEY_CODES = KEYBOARD_KEY_CODES;
|
|
22
24
|
var OS = {
|