intelicoreact 0.1.85 → 0.1.88
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/CheckboxInput/CheckboxInput.scss +4 -1
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +16 -4
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +45 -78
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.scss +2 -2
- package/dist/Atomic/UI/NavLine/NavLine.js +183 -9
- package/dist/Atomic/UI/NavLine/NavLine.scss +57 -0
- package/dist/Atomic/UI/NavLine/Tabs.js +115 -0
- package/dist/Functions/utils.js +11 -3
- package/package.json +2 -2
|
@@ -74,10 +74,11 @@
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
input[type="checkbox" i] {
|
|
77
|
-
&:indeterminate {
|
|
77
|
+
&:indeterminate + span {
|
|
78
78
|
display: block;
|
|
79
79
|
width: 100%;
|
|
80
80
|
height: 100%;
|
|
81
|
+
|
|
81
82
|
&:after {
|
|
82
83
|
content: "";
|
|
83
84
|
position: absolute;
|
|
@@ -89,6 +90,8 @@
|
|
|
89
90
|
width: 100%;
|
|
90
91
|
height: 100%;
|
|
91
92
|
background-color: #6b81dd;
|
|
93
|
+
transform: rotate(0deg);
|
|
94
|
+
border: none;
|
|
92
95
|
}
|
|
93
96
|
&:before {
|
|
94
97
|
content: "";
|
|
@@ -51,6 +51,11 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
51
51
|
isOpened = _useState2[0],
|
|
52
52
|
setIsOpened = _useState2[1];
|
|
53
53
|
|
|
54
|
+
var _useState3 = (0, _react.useState)(false),
|
|
55
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
56
|
+
isOpenedByOnFocus = _useState4[0],
|
|
57
|
+
setOpenedByOnFocus = _useState4[1];
|
|
58
|
+
|
|
54
59
|
var calendarRef = (0, _react.useRef)(null);
|
|
55
60
|
var formatedMinDate = (0, _momentTimezone.default)(minDate, format).format(format) !== 'Invalid date' ? (0, _momentTimezone.default)(minDate, format).format(format) : null;
|
|
56
61
|
var formatedMaxDate = (0, _momentTimezone.default)(maxDate, format).format(format) !== 'Invalid date' ? (0, _momentTimezone.default)(maxDate, format).format(format) : null;
|
|
@@ -74,6 +79,10 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
74
79
|
return (0, _momentTimezone.default)(new Date()).format('L');
|
|
75
80
|
};
|
|
76
81
|
|
|
82
|
+
(0, _react.useEffect)(function () {
|
|
83
|
+
if (!isOpened) setOpenedByOnFocus(false);
|
|
84
|
+
}, [isOpened]);
|
|
85
|
+
|
|
77
86
|
var handleBlur = function handleBlur(e) {
|
|
78
87
|
var value = e.target.value;
|
|
79
88
|
if ((0, _momentTimezone.default)(value, format).format(format) === 'Invalid date') onChange('');else if ((0, _momentTimezone.default)(value, format).startOf('day').isBefore(momentMinDate, 'days')) onChange(formatedMinDate);else if ((0, _momentTimezone.default)(value, format).endOf('day').isAfter(momentMaxDate, 'days')) onChange(formatedMaxDate);else onChange((0, _momentTimezone.default)(value, format).format(format));
|
|
@@ -92,13 +101,16 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
92
101
|
return changeInputValue(e.target.value);
|
|
93
102
|
},
|
|
94
103
|
className: "calendar-dropdown",
|
|
95
|
-
onFocus: function onFocus() {
|
|
96
|
-
|
|
104
|
+
onFocus: function onFocus(e) {
|
|
105
|
+
setOpenedByOnFocus(true);
|
|
106
|
+
setIsOpened(true);
|
|
97
107
|
},
|
|
98
108
|
onBlur: !isOpened ? handleBlur : function () {},
|
|
99
109
|
onKeyUp: function onKeyUp(e) {
|
|
100
|
-
if (
|
|
101
|
-
|
|
110
|
+
if (!isOpenedByOnFocus) {
|
|
111
|
+
if (e.key === 'Enter') e.target.blur();
|
|
112
|
+
setIsOpened(false);
|
|
113
|
+
}
|
|
102
114
|
}
|
|
103
115
|
}), isOpened ? /*#__PURE__*/_react.default.createElement(_Calendar.default, {
|
|
104
116
|
date: getCalendarValue(value),
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -11,104 +9,73 @@ exports.default = void 0;
|
|
|
11
9
|
|
|
12
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
11
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
13
|
|
|
18
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
15
|
|
|
20
16
|
var _CheckboxInput = _interopRequireDefault(require("../CheckboxInput/CheckboxInput"));
|
|
21
17
|
|
|
22
|
-
var _utils = require("../../../Functions/utils");
|
|
23
|
-
|
|
24
18
|
require("./TieredCheckboxes.scss");
|
|
25
19
|
|
|
26
|
-
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); }
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
-
|
|
30
20
|
var TieredCheckboxes = function TieredCheckboxes(_ref) {
|
|
31
21
|
var items = _ref.items,
|
|
32
|
-
className = _ref.className
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var _useState5 = (0, _react.useState)([]),
|
|
45
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
46
|
-
checkedItems = _useState6[0],
|
|
47
|
-
setCheckedItems = _useState6[1];
|
|
48
|
-
|
|
49
|
-
var _useState7 = (0, _react.useState)(false),
|
|
50
|
-
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
51
|
-
isThirdStatement = _useState8[0],
|
|
52
|
-
setIsThirdStatement = _useState8[1];
|
|
53
|
-
|
|
54
|
-
var onChange = (0, _utils.handleObjectChange)(setData, function () {
|
|
55
|
-
return setData((0, _toConsumableArray2.default)(data));
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
var handleArrayChange = function handleArrayChange(e, index, childIndex) {
|
|
59
|
-
// change children checkboxes
|
|
60
|
-
if (childIndex || childIndex === 0) {
|
|
61
|
-
data[index].children[childIndex].value = e;
|
|
62
|
-
|
|
63
|
-
if (data[index].children.filter(function (item) {
|
|
64
|
-
return item.value === true;
|
|
65
|
-
}).length === data[index].children.length) {
|
|
66
|
-
data[index].value = true;
|
|
67
|
-
setIsThirdStatement(false);
|
|
68
|
-
} else if (data[index].children.filter(function (item) {
|
|
69
|
-
return item.value === true;
|
|
70
|
-
}).length === 0) {
|
|
71
|
-
setIsThirdStatement(false);
|
|
72
|
-
} else {
|
|
73
|
-
setIsThirdStatement(true);
|
|
74
|
-
data[index].value = false;
|
|
75
|
-
} // change parent checkboxes
|
|
76
|
-
|
|
77
|
-
} else {
|
|
78
|
-
data[index].children.forEach(function (elem) {
|
|
79
|
-
elem.value = e;
|
|
22
|
+
className = _ref.className,
|
|
23
|
+
onChange = _ref.onChange;
|
|
24
|
+
var handle = {
|
|
25
|
+
changeParent: function changeParent(value, key) {
|
|
26
|
+
var parent = items.find(function (item) {
|
|
27
|
+
return item.key === key;
|
|
28
|
+
});
|
|
29
|
+
parent.value = value;
|
|
30
|
+
if (value) parent.children.forEach(function (item) {
|
|
31
|
+
return item.value = true;
|
|
32
|
+
});else parent.children.forEach(function (item) {
|
|
33
|
+
return item.value = false;
|
|
80
34
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
35
|
+
onChange((0, _toConsumableArray2.default)(items));
|
|
36
|
+
},
|
|
37
|
+
changeChild: function changeChild(value, key, parentKey) {
|
|
38
|
+
var parent = items.find(function (item) {
|
|
39
|
+
return item.key === parentKey;
|
|
40
|
+
});
|
|
41
|
+
parent.children.find(function (item) {
|
|
42
|
+
return item.key === key;
|
|
43
|
+
}).value = value;
|
|
44
|
+
if (parent.children.every(function (item) {
|
|
45
|
+
return item.value;
|
|
46
|
+
})) parent.value = true;else parent.value = false;
|
|
47
|
+
onChange((0, _toConsumableArray2.default)(items));
|
|
48
|
+
},
|
|
49
|
+
isAllChecked: function isAllChecked(item) {
|
|
50
|
+
return (item === null || item === void 0 ? void 0 : item.children.some(function (item) {
|
|
51
|
+
return item.value;
|
|
52
|
+
})) && !(item !== null && item !== void 0 && item.children.every(function (item) {
|
|
53
|
+
return item.value;
|
|
54
|
+
}));
|
|
85
55
|
}
|
|
86
|
-
|
|
87
|
-
onChange(data);
|
|
88
56
|
};
|
|
89
|
-
|
|
90
57
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
91
58
|
className: (0, _classnames.default)('tiered-checkboxes', className)
|
|
92
|
-
},
|
|
59
|
+
}, items.map(function (parent) {
|
|
93
60
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
-
key: parent.
|
|
95
|
-
className: "tiered-
|
|
61
|
+
key: parent.key,
|
|
62
|
+
className: "tiered-checkboxes__parents"
|
|
96
63
|
}, /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
97
|
-
|
|
64
|
+
isStark: handle.isAllChecked(parent),
|
|
98
65
|
label: parent.label,
|
|
99
|
-
value:
|
|
100
|
-
onChange: function onChange(
|
|
101
|
-
return
|
|
66
|
+
value: parent.value,
|
|
67
|
+
onChange: function onChange(value) {
|
|
68
|
+
return handle.changeParent(value, parent.key);
|
|
102
69
|
}
|
|
103
|
-
}), parent.children && parent.children.map(function (child
|
|
70
|
+
}), parent.children && parent.children.map(function (child) {
|
|
104
71
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
105
|
-
key: child.
|
|
106
|
-
className: "tiered-
|
|
72
|
+
key: child.key,
|
|
73
|
+
className: "tiered-checkboxes__children"
|
|
107
74
|
}, /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
108
75
|
label: child.label,
|
|
109
76
|
value: child.value,
|
|
110
|
-
onChange: function onChange(
|
|
111
|
-
return
|
|
77
|
+
onChange: function onChange(value) {
|
|
78
|
+
return handle.changeChild(value, child.key, parent.key);
|
|
112
79
|
}
|
|
113
80
|
}));
|
|
114
81
|
}));
|
|
@@ -9,7 +9,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
17
|
|
|
14
18
|
var _reactRouterDom = require("react-router-dom");
|
|
15
19
|
|
|
@@ -19,10 +23,16 @@ var Icons = _interopRequireWildcard(require("react-feather"));
|
|
|
19
23
|
|
|
20
24
|
require("./NavLine.scss");
|
|
21
25
|
|
|
26
|
+
var _utils = require("../../../Functions/utils");
|
|
27
|
+
|
|
22
28
|
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); }
|
|
23
29
|
|
|
24
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
31
|
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
35
|
+
|
|
26
36
|
var NavLine = function NavLine(_ref) {
|
|
27
37
|
var root = _ref.root,
|
|
28
38
|
activeTab = _ref.activeTab,
|
|
@@ -32,16 +42,175 @@ var NavLine = function NavLine(_ref) {
|
|
|
32
42
|
items = _ref.items,
|
|
33
43
|
children = _ref.children,
|
|
34
44
|
isLocal = _ref.isLocal,
|
|
35
|
-
mode = _ref.mode
|
|
45
|
+
mode = _ref.mode,
|
|
46
|
+
_ref$scrollMode = _ref.scrollMode,
|
|
47
|
+
scrollMode = _ref$scrollMode === void 0 ? false : _ref$scrollMode;
|
|
48
|
+
|
|
49
|
+
var _useState = (0, _react.useState)([]),
|
|
50
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
51
|
+
navLineItems = _useState2[0],
|
|
52
|
+
setNavLineItems = _useState2[1];
|
|
53
|
+
|
|
54
|
+
var wrapperRef = (0, _react.useRef)(null);
|
|
55
|
+
var wrapperInnerRef = (0, _react.useRef)(null);
|
|
56
|
+
|
|
57
|
+
var _useState3 = (0, _react.useState)(0),
|
|
58
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
59
|
+
wrapperRefWidth = _useState4[0],
|
|
60
|
+
setWrapperRefWidth = _useState4[1];
|
|
61
|
+
|
|
62
|
+
var _useState5 = (0, _react.useState)(0),
|
|
63
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
64
|
+
totalScrolledItems = _useState6[0],
|
|
65
|
+
setTotalScrolledItems = _useState6[1];
|
|
66
|
+
|
|
67
|
+
var _useState7 = (0, _react.useState)(0),
|
|
68
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
69
|
+
scrollLeft = _useState8[0],
|
|
70
|
+
setScrollLeft = _useState8[1];
|
|
71
|
+
|
|
72
|
+
var _useState9 = (0, _react.useState)(0),
|
|
73
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
74
|
+
navLineItemsTotalWidth = _useState10[0],
|
|
75
|
+
setNavLineItemsTotalWidth = _useState10[1];
|
|
76
|
+
|
|
77
|
+
var _useState11 = (0, _react.useState)(0),
|
|
78
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
79
|
+
navLineFirstItemOffset = _useState12[0],
|
|
80
|
+
setNavLineFirstItemOffset = _useState12[1];
|
|
81
|
+
|
|
82
|
+
var getVisibleNavLineItems = function getVisibleNavLineItems() {
|
|
83
|
+
var wrapperInner = wrapperInnerRef === null || wrapperInnerRef === void 0 ? void 0 : wrapperInnerRef.current;
|
|
84
|
+
var wrapperInnerProps = wrapperInner.getBoundingClientRect();
|
|
85
|
+
return navLineItems === null || navLineItems === void 0 ? void 0 : navLineItems.filter(function (item) {
|
|
86
|
+
var ref = item.ref,
|
|
87
|
+
label = item.label;
|
|
88
|
+
var element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
89
|
+
if (!element) return false;
|
|
90
|
+
|
|
91
|
+
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
92
|
+
x = _element$getBoundingC.x;
|
|
93
|
+
|
|
94
|
+
return x - wrapperInnerProps.x >= 0 && x - wrapperInnerProps.x <= wrapperRefWidth;
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var getUnvisibleLeftSideNavLineItems = function getUnvisibleLeftSideNavLineItems() {
|
|
99
|
+
var wrapperInner = wrapperInnerRef === null || wrapperInnerRef === void 0 ? void 0 : wrapperInnerRef.current;
|
|
100
|
+
var wrapperInnerProps = wrapperInner.getBoundingClientRect();
|
|
101
|
+
return navLineItems === null || navLineItems === void 0 ? void 0 : navLineItems.filter(function (item) {
|
|
102
|
+
var ref = item.ref,
|
|
103
|
+
label = item.label;
|
|
104
|
+
var element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
105
|
+
if (!element) return false;
|
|
106
|
+
|
|
107
|
+
var _element$getBoundingC2 = element.getBoundingClientRect(),
|
|
108
|
+
x = _element$getBoundingC2.x;
|
|
109
|
+
|
|
110
|
+
return x - wrapperInnerProps.x <= 0;
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
var scroll = function scroll() {
|
|
115
|
+
var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
116
|
+
var wrapperInner = wrapperInnerRef === null || wrapperInnerRef === void 0 ? void 0 : wrapperInnerRef.current;
|
|
117
|
+
var wrapperInnerProps = wrapperInner.getBoundingClientRect();
|
|
118
|
+
var leftOffset = wrapperInner.scrollLeft;
|
|
119
|
+
setTotalScrolledItems(function (state) {
|
|
120
|
+
return offset > 0 ? ++state : --state;
|
|
121
|
+
});
|
|
122
|
+
setScrollLeft(leftOffset + offset);
|
|
123
|
+
wrapperInner === null || wrapperInner === void 0 ? void 0 : wrapperInner.scrollBy({
|
|
124
|
+
left: offset,
|
|
125
|
+
behavior: 'smooth'
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
var scrollToPrevItem = function scrollToPrevItem() {
|
|
130
|
+
var _prevItem$ref, _prevItem$ref$current;
|
|
131
|
+
|
|
132
|
+
var wrapperInner = wrapperInnerRef === null || wrapperInnerRef === void 0 ? void 0 : wrapperInnerRef.current;
|
|
133
|
+
var navLineUnvisibleItems = getUnvisibleLeftSideNavLineItems();
|
|
134
|
+
|
|
135
|
+
var _navLineUnvisibleItem = navLineUnvisibleItems.reverse(),
|
|
136
|
+
_navLineUnvisibleItem2 = (0, _slicedToArray2.default)(_navLineUnvisibleItem, 1),
|
|
137
|
+
prevItem = _navLineUnvisibleItem2[0];
|
|
138
|
+
|
|
139
|
+
var wrapperInnerProps = wrapperInner.getBoundingClientRect();
|
|
140
|
+
var prevItemProps = prevItem === null || prevItem === void 0 ? void 0 : (_prevItem$ref = prevItem.ref) === null || _prevItem$ref === void 0 ? void 0 : (_prevItem$ref$current = _prevItem$ref.current) === null || _prevItem$ref$current === void 0 ? void 0 : _prevItem$ref$current.getBoundingClientRect();
|
|
141
|
+
var scrollOffset = (prevItemProps === null || prevItemProps === void 0 ? void 0 : prevItemProps.x) - (wrapperInnerProps === null || wrapperInnerProps === void 0 ? void 0 : wrapperInnerProps.x);
|
|
142
|
+
scroll(scrollOffset);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
var scrollToNextItem = function scrollToNextItem() {
|
|
146
|
+
var _firstVisibleItem$ref, _firstVisibleItem$ref2, _secondVisibleItem$re, _secondVisibleItem$re2;
|
|
147
|
+
|
|
148
|
+
var wrapperInner = wrapperInnerRef === null || wrapperInnerRef === void 0 ? void 0 : wrapperInnerRef.current;
|
|
149
|
+
var navLineVisibleItems = getVisibleNavLineItems();
|
|
150
|
+
|
|
151
|
+
var _navLineVisibleItems = (0, _slicedToArray2.default)(navLineVisibleItems, 2),
|
|
152
|
+
firstVisibleItem = _navLineVisibleItems[0],
|
|
153
|
+
secondVisibleItem = _navLineVisibleItems[1];
|
|
154
|
+
|
|
155
|
+
var wrapperInnerProps = wrapperInner.getBoundingClientRect();
|
|
156
|
+
var firstVisibleItemProps = firstVisibleItem === null || firstVisibleItem === void 0 ? void 0 : (_firstVisibleItem$ref = firstVisibleItem.ref) === null || _firstVisibleItem$ref === void 0 ? void 0 : (_firstVisibleItem$ref2 = _firstVisibleItem$ref.current) === null || _firstVisibleItem$ref2 === void 0 ? void 0 : _firstVisibleItem$ref2.getBoundingClientRect();
|
|
157
|
+
var secondVisibleItemProps = secondVisibleItem === null || secondVisibleItem === void 0 ? void 0 : (_secondVisibleItem$re = secondVisibleItem.ref) === null || _secondVisibleItem$re === void 0 ? void 0 : (_secondVisibleItem$re2 = _secondVisibleItem$re.current) === null || _secondVisibleItem$re2 === void 0 ? void 0 : _secondVisibleItem$re2.getBoundingClientRect();
|
|
158
|
+
var scrollOffset = secondVisibleItemProps.x - wrapperInnerProps.x;
|
|
159
|
+
scroll(scrollOffset);
|
|
160
|
+
}; // Count Total NavLine Items Width
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
(0, _react.useEffect)(function () {
|
|
164
|
+
var _navLineItems$0$ref$c, _navLineItems$, _navLineItems$$ref, _navLineItems$$ref$cu;
|
|
165
|
+
|
|
166
|
+
setNavLineItemsTotalWidth(function () {
|
|
167
|
+
return navLineItems.reduce(function (totalWidth, item) {
|
|
168
|
+
var _item$ref;
|
|
169
|
+
|
|
170
|
+
var element = item === null || item === void 0 ? void 0 : (_item$ref = item.ref) === null || _item$ref === void 0 ? void 0 : _item$ref.current;
|
|
171
|
+
|
|
172
|
+
if (element) {
|
|
173
|
+
var _element$getBoundingC3;
|
|
174
|
+
|
|
175
|
+
totalWidth += element === null || element === void 0 ? void 0 : (_element$getBoundingC3 = element.getBoundingClientRect()) === null || _element$getBoundingC3 === void 0 ? void 0 : _element$getBoundingC3.width;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return totalWidth;
|
|
179
|
+
}, 0);
|
|
180
|
+
});
|
|
181
|
+
setNavLineFirstItemOffset((_navLineItems$0$ref$c = (_navLineItems$ = navLineItems[0]) === null || _navLineItems$ === void 0 ? void 0 : (_navLineItems$$ref = _navLineItems$.ref) === null || _navLineItems$$ref === void 0 ? void 0 : (_navLineItems$$ref$cu = _navLineItems$$ref.current) === null || _navLineItems$$ref$cu === void 0 ? void 0 : _navLineItems$$ref$cu.getBoundingClientRect().x) !== null && _navLineItems$0$ref$c !== void 0 ? _navLineItems$0$ref$c : 0);
|
|
182
|
+
}, [navLineItems === null || navLineItems === void 0 ? void 0 : navLineItems.length]); // Count Wrapper Width
|
|
183
|
+
|
|
184
|
+
(0, _react.useEffect)(function () {
|
|
185
|
+
var _wrapperRef$current$g, _wrapperRef$current, _wrapperRef$current$g2;
|
|
186
|
+
|
|
187
|
+
setWrapperRefWidth((_wrapperRef$current$g = wrapperRef === null || wrapperRef === void 0 ? void 0 : (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : (_wrapperRef$current$g2 = _wrapperRef$current.getBoundingClientRect()) === null || _wrapperRef$current$g2 === void 0 ? void 0 : _wrapperRef$current$g2.width) !== null && _wrapperRef$current$g !== void 0 ? _wrapperRef$current$g : 0);
|
|
188
|
+
}, [wrapperRef]); //Init NavLine Items
|
|
189
|
+
|
|
190
|
+
(0, _react.useEffect)(function () {
|
|
191
|
+
setNavLineItems(items.map(function (item) {
|
|
192
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
193
|
+
ref: /*#__PURE__*/(0, _react.createRef)()
|
|
194
|
+
});
|
|
195
|
+
}));
|
|
196
|
+
}, [items]);
|
|
36
197
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
37
198
|
className: (0, _classnames.default)({
|
|
38
199
|
'nav-line': !variant
|
|
39
200
|
}, {
|
|
40
201
|
'nav-line--simple': variant === 'simple'
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
className
|
|
44
|
-
|
|
202
|
+
}, {
|
|
203
|
+
'nav-line--scroll-mode': scrollMode
|
|
204
|
+
}, className),
|
|
205
|
+
ref: scrollMode ? wrapperRef : null
|
|
206
|
+
}, scrollMode && totalScrolledItems > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
207
|
+
className: "nav-line--simple__arrow nav-line--simple__arrow--prev",
|
|
208
|
+
onClick: scrollToPrevItem
|
|
209
|
+
}, /*#__PURE__*/_react.default.createElement(Icons.ChevronLeft, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
210
|
+
className: "".concat(variant === 'simple' ? 'nav-line--simple__inner' : 'nav-line__inner'),
|
|
211
|
+
ref: scrollMode ? wrapperInnerRef : null
|
|
212
|
+
}, navLineItems.map(function (item) {
|
|
213
|
+
var ref = item.ref;
|
|
45
214
|
var Icon = Icons[item === null || item === void 0 ? void 0 : item.icon];
|
|
46
215
|
return isLocal ? /*#__PURE__*/_react.default.createElement("span", {
|
|
47
216
|
onClick: function onClick() {
|
|
@@ -56,7 +225,8 @@ var NavLine = function NavLine(_ref) {
|
|
|
56
225
|
active: activeTab === item.tabId
|
|
57
226
|
}, {
|
|
58
227
|
disabled: item.disabled || mode === 'create' && item.tabId !== 'general'
|
|
59
|
-
})
|
|
228
|
+
}),
|
|
229
|
+
ref: (0, _utils.checkedRef)(ref)
|
|
60
230
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
61
231
|
className: "j4"
|
|
62
232
|
}, item.icon && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -78,7 +248,8 @@ var NavLine = function NavLine(_ref) {
|
|
|
78
248
|
active: activeTab === item.tabId
|
|
79
249
|
}, {
|
|
80
250
|
disabled: item.disabled || mode === 'create' && item.tabId !== 'general'
|
|
81
|
-
})
|
|
251
|
+
}),
|
|
252
|
+
ref: (0, _utils.checkedRef)(ref)
|
|
82
253
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
83
254
|
className: "j4"
|
|
84
255
|
}, item.icon && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -90,7 +261,10 @@ var NavLine = function NavLine(_ref) {
|
|
|
90
261
|
}, item.label), item.count !== undefined ? /*#__PURE__*/_react.default.createElement("span", {
|
|
91
262
|
className: "nav-line--count ml5"
|
|
92
263
|
}, "(", item.count || 0, ")") : null));
|
|
93
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
264
|
+
})), scrollMode && navLineItemsTotalWidth > wrapperRefWidth && scrollLeft + wrapperRefWidth < navLineItemsTotalWidth && /*#__PURE__*/_react.default.createElement("div", {
|
|
265
|
+
className: "nav-line--simple__arrow nav-line--simple__arrow--next",
|
|
266
|
+
onClick: scrollToNextItem
|
|
267
|
+
}, /*#__PURE__*/_react.default.createElement(Icons.ChevronRight, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
94
268
|
className: "nav-line__body"
|
|
95
269
|
}, children));
|
|
96
270
|
};
|
|
@@ -54,10 +54,26 @@
|
|
|
54
54
|
margin-left: -32px;
|
|
55
55
|
margin-right: -32px;
|
|
56
56
|
background-color: #f7fafc;
|
|
57
|
+
position: relative;
|
|
58
|
+
bottom: 0px;
|
|
57
59
|
&:empty {
|
|
58
60
|
padding: 0 32px;
|
|
59
61
|
}
|
|
60
62
|
}
|
|
63
|
+
|
|
64
|
+
&--scroll-mode{
|
|
65
|
+
position: relative;
|
|
66
|
+
|
|
67
|
+
.nav-line--simple__inner{
|
|
68
|
+
flex-wrap: nowrap;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.nav-line--simple__item {
|
|
73
|
+
flex-wrap: nowrap;
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
61
77
|
}
|
|
62
78
|
|
|
63
79
|
.nav-line--simple {
|
|
@@ -107,12 +123,52 @@
|
|
|
107
123
|
opacity: 100%;
|
|
108
124
|
|
|
109
125
|
&::after {
|
|
126
|
+
left: 0;
|
|
110
127
|
width: 100%;
|
|
111
128
|
opacity: 1;
|
|
112
129
|
}
|
|
113
130
|
}
|
|
114
131
|
}
|
|
115
132
|
|
|
133
|
+
&__arrow {
|
|
134
|
+
position: absolute;
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
height: 39px;
|
|
138
|
+
width: 36px;
|
|
139
|
+
background: #fff;
|
|
140
|
+
color:#424242;
|
|
141
|
+
box-sizing: border-box;
|
|
142
|
+
transition: all 0.5s;
|
|
143
|
+
z-index: 2;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
|
|
146
|
+
&:hover {
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&--prev{
|
|
151
|
+
left: 0;
|
|
152
|
+
top: 0;
|
|
153
|
+
border-radius: 8px 0 0 8px;
|
|
154
|
+
transform: translate(-100%, -2px);
|
|
155
|
+
box-shadow: 10px 0px 10px -5px #dddddd;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&--next{
|
|
159
|
+
right: 0;
|
|
160
|
+
top: 0;
|
|
161
|
+
border-radius: 0 8px 8px 0;
|
|
162
|
+
transform: translate(100%, -2px);
|
|
163
|
+
box-shadow: -10px 0px 10px -5px #dddddd;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
svg {
|
|
167
|
+
width: 24px;
|
|
168
|
+
height: 24px;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
116
172
|
&__body {
|
|
117
173
|
padding: 15px 10px;
|
|
118
174
|
font-size: 13px;
|
|
@@ -126,3 +182,4 @@
|
|
|
126
182
|
.post-log-tab__body {
|
|
127
183
|
background-color: #f7fafc;
|
|
128
184
|
}
|
|
185
|
+
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
"activeTab": "",
|
|
9
|
+
"initialTab": "",
|
|
10
|
+
"variant": "simple",
|
|
11
|
+
"items": [{
|
|
12
|
+
"tabId": "",
|
|
13
|
+
"label": "All Industries"
|
|
14
|
+
}, {
|
|
15
|
+
"tabId": 0,
|
|
16
|
+
"label": "Doors"
|
|
17
|
+
}, {
|
|
18
|
+
"tabId": 1,
|
|
19
|
+
"label": "Flooring"
|
|
20
|
+
}, {
|
|
21
|
+
"tabId": 2,
|
|
22
|
+
"label": "Home Automation"
|
|
23
|
+
}, {
|
|
24
|
+
"tabId": 3,
|
|
25
|
+
"label": "HVAC"
|
|
26
|
+
}, {
|
|
27
|
+
"tabId": 4,
|
|
28
|
+
"label": "Pools and Spas"
|
|
29
|
+
}, {
|
|
30
|
+
"tabId": 5,
|
|
31
|
+
"label": "Roofing"
|
|
32
|
+
}, {
|
|
33
|
+
"tabId": 6,
|
|
34
|
+
"label": "Solar systems"
|
|
35
|
+
}, {
|
|
36
|
+
"tabId": 7,
|
|
37
|
+
"label": "Termite tenting"
|
|
38
|
+
}, {
|
|
39
|
+
"tabId": 8,
|
|
40
|
+
"label": "Water filtration"
|
|
41
|
+
}, {
|
|
42
|
+
"tabId": 9,
|
|
43
|
+
"label": "Water heaters"
|
|
44
|
+
}, {
|
|
45
|
+
"tabId": 10,
|
|
46
|
+
"label": "Windows"
|
|
47
|
+
}, {
|
|
48
|
+
"tabId": 11,
|
|
49
|
+
"label": "Audiology"
|
|
50
|
+
}, {
|
|
51
|
+
"tabId": 12,
|
|
52
|
+
"label": "Chiropractic"
|
|
53
|
+
}, {
|
|
54
|
+
"tabId": 13,
|
|
55
|
+
"label": "Cosmetic Surgery"
|
|
56
|
+
}, {
|
|
57
|
+
"tabId": 14,
|
|
58
|
+
"label": "Dental"
|
|
59
|
+
}, {
|
|
60
|
+
"tabId": 15,
|
|
61
|
+
"label": "Dermatology"
|
|
62
|
+
}, {
|
|
63
|
+
"tabId": 16,
|
|
64
|
+
"label": "Medical Devices"
|
|
65
|
+
}, {
|
|
66
|
+
"tabId": 17,
|
|
67
|
+
"label": "Non-invasive Cosmetics"
|
|
68
|
+
}, {
|
|
69
|
+
"tabId": 18,
|
|
70
|
+
"label": "Optometry"
|
|
71
|
+
}, {
|
|
72
|
+
"tabId": 19,
|
|
73
|
+
"label": "Vision"
|
|
74
|
+
}, {
|
|
75
|
+
"tabId": 20,
|
|
76
|
+
"label": "Weight Loss"
|
|
77
|
+
}, {
|
|
78
|
+
"tabId": 21,
|
|
79
|
+
"label": "Appliances"
|
|
80
|
+
}, {
|
|
81
|
+
"tabId": 22,
|
|
82
|
+
"label": "Electronics"
|
|
83
|
+
}, {
|
|
84
|
+
"tabId": 23,
|
|
85
|
+
"label": "Furniture"
|
|
86
|
+
}, {
|
|
87
|
+
"tabId": 24,
|
|
88
|
+
"label": "Mattress"
|
|
89
|
+
}, {
|
|
90
|
+
"tabId": 25,
|
|
91
|
+
"label": "Jewelry"
|
|
92
|
+
}, {
|
|
93
|
+
"tabId": 26,
|
|
94
|
+
"label": "Dog Training"
|
|
95
|
+
}, {
|
|
96
|
+
"tabId": 27,
|
|
97
|
+
"label": "Pet Retail"
|
|
98
|
+
}, {
|
|
99
|
+
"tabId": 28,
|
|
100
|
+
"label": "Veterinary"
|
|
101
|
+
}, {
|
|
102
|
+
"tabId": 29,
|
|
103
|
+
"label": "Coaching"
|
|
104
|
+
}, {
|
|
105
|
+
"tabId": 30,
|
|
106
|
+
"label": "Funeral"
|
|
107
|
+
}, {
|
|
108
|
+
"tabId": 31,
|
|
109
|
+
"label": "Legal"
|
|
110
|
+
}, {
|
|
111
|
+
"tabId": 32,
|
|
112
|
+
"label": "Tax resolution"
|
|
113
|
+
}]
|
|
114
|
+
};
|
|
115
|
+
exports.default = _default;
|
package/dist/Functions/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.firstLetterCapital = exports.changeMeta = exports.addBitDepthPoints = exports.throttle = exports.debounce = exports.getColorById = exports.getStyles = exports.logout = exports.useOutsideToggle = exports.handleObjectChange = void 0;
|
|
8
|
+
exports.checkedRef = exports.firstLetterCapital = exports.changeMeta = exports.addBitDepthPoints = exports.throttle = exports.debounce = exports.getColorById = exports.getStyles = exports.logout = exports.useOutsideToggle = exports.handleObjectChange = void 0;
|
|
9
9
|
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
|
|
@@ -151,7 +151,7 @@ var changeMeta = function changeMeta(key) {
|
|
|
151
151
|
return i.key === key;
|
|
152
152
|
});
|
|
153
153
|
document.title = (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : defaultMeta === null || defaultMeta === void 0 ? void 0 : defaultMeta.title;
|
|
154
|
-
document.description
|
|
154
|
+
document.querySelector('meta[name="description"]').setAttribute("content", (_item$description = item === null || item === void 0 ? void 0 : item.description) !== null && _item$description !== void 0 ? _item$description : defaultMeta === null || defaultMeta === void 0 ? void 0 : defaultMeta.description);
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
157
|
|
|
@@ -161,4 +161,12 @@ var firstLetterCapital = function firstLetterCapital(str) {
|
|
|
161
161
|
return "".concat(str.charAt(0).toUpperCase()).concat(str.slice(1));
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
exports.firstLetterCapital = firstLetterCapital;
|
|
164
|
+
exports.firstLetterCapital = firstLetterCapital;
|
|
165
|
+
|
|
166
|
+
var checkedRef = function checkedRef(ref) {
|
|
167
|
+
return ref ? typeof ref === 'function' ? function (node) {
|
|
168
|
+
return ref(node, key);
|
|
169
|
+
} : ref : null;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
exports.checkedRef = checkedRef;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intelicoreact",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.88",
|
|
4
|
+
"description": "feature/FIN-1814 | Fix Bugs, correct changeMeta func ",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist/*",
|