intelicoreact 1.1.8 → 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"));
|
|
@@ -50,13 +52,18 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
50
52
|
return file.size > maxItemSizeBytes;
|
|
51
53
|
};
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
//
|
|
55
|
-
var
|
|
56
|
-
|
|
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
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
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
|
+
}
|
|
60
67
|
|
|
61
68
|
var checkExtension = function checkExtension(valueExtension) {
|
|
62
69
|
return accept.includes(valueExtension);
|
|
@@ -64,9 +71,11 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
64
71
|
|
|
65
72
|
var handle = {
|
|
66
73
|
change: function change(e) {
|
|
74
|
+
var _e$target, _e$target$files;
|
|
75
|
+
|
|
67
76
|
var name = getFileName(e.target.value);
|
|
68
|
-
var valueExtension = name.match(/[^\.]+$/)[0];
|
|
69
|
-
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];
|
|
70
79
|
|
|
71
80
|
if (isFileSizeOutOfLimit(e.target.files[0])) {
|
|
72
81
|
onChange({
|
|
@@ -89,7 +98,7 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
89
98
|
valueExtension: valueExtension,
|
|
90
99
|
e: e,
|
|
91
100
|
file: file,
|
|
92
|
-
error:
|
|
101
|
+
error: getUniqueExtensionsList(allowedExtensions)
|
|
93
102
|
});
|
|
94
103
|
} else onChange({
|
|
95
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 = {
|