@elliemae/ds-left-navigation 2.2.0-alpha.4 → 3.0.0-next.2
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/cjs/LeftNavigation.js +27 -49
- package/cjs/LeftNavigationContext.js +18 -44
- package/cjs/common/getItemBackgroundStyle.js +8 -47
- package/cjs/common/getLeftBorderStyle.js +8 -50
- package/cjs/common/getScrollbarStyle.js +4 -55
- package/cjs/common/index.js +13 -30
- package/cjs/configs/index.js +10 -38
- package/cjs/configs/useLeftNavConfig.js +76 -76
- package/cjs/configs/useLeftNavItems.js +64 -66
- package/cjs/configs/useLeftNavSmoothExpand.js +25 -43
- package/cjs/exported-related/ChevronItem/index.js +27 -42
- package/cjs/exported-related/Icon/index.js +34 -51
- package/cjs/exported-related/ItemRenderer/index.js +94 -99
- package/cjs/exported-related/ItemRenderer/styled.js +51 -83
- package/cjs/exported-related/ItemRenderer/usePropsWithDefaults.js +45 -57
- package/cjs/exported-related/Notifications/index.js +61 -81
- package/cjs/exported-related/OpenWindowItem/index.js +32 -49
- package/cjs/exported-related/constants.js +25 -53
- package/cjs/exported-related/index.js +23 -33
- package/cjs/hooks/index.js +13 -30
- package/cjs/hooks/useExpandableOnClickHandler.js +26 -55
- package/cjs/hooks/useKeyboardNavigation.js +54 -62
- package/cjs/hooks/useOpenableOnClickHandler.js +26 -55
- package/cjs/hooks/useSelectFirstBodyItem.js +34 -47
- package/cjs/index.d.js +2 -27
- package/cjs/index.js +30 -41
- package/cjs/outOfTheBox/ItemControlledDrilldown/index.js +103 -97
- package/cjs/outOfTheBox/ItemControlledDrilldown/styled.js +27 -49
- package/cjs/outOfTheBox/ItemHeader/index.js +93 -95
- package/cjs/outOfTheBox/ItemHeader/styled.js +22 -49
- package/cjs/outOfTheBox/ItemLink/index.js +67 -75
- package/cjs/outOfTheBox/ItemLink/styled.js +17 -41
- package/cjs/outOfTheBox/ItemSection/index.js +63 -59
- package/cjs/outOfTheBox/ItemSection/styled.js +23 -53
- package/cjs/outOfTheBox/ItemSeparator/index.js +45 -56
- package/cjs/outOfTheBox/ItemSubmenu/index.js +92 -95
- package/cjs/outOfTheBox/ItemSubmenu/styled.js +22 -49
- package/cjs/outOfTheBox/ItemTextLabel/index.js +52 -51
- package/cjs/outOfTheBox/ItemTextLabel/styled.js +23 -43
- package/cjs/outOfTheBox/ItemUncontrolledDrilldown/index.js +113 -107
- package/cjs/outOfTheBox/ItemUncontrolledDrilldown/styled.js +27 -49
- package/cjs/outOfTheBox/ItemWithDate/index.js +54 -59
- package/cjs/outOfTheBox/ItemWithDate/styled.js +27 -49
- package/cjs/outOfTheBox/index.js +50 -65
- package/cjs/parts/LeftNavContent/index.js +71 -75
- package/cjs/parts/LeftNavContent/styled.js +50 -110
- package/cjs/parts/LeftNavContentWithScrollbar/index.js +79 -89
- package/cjs/parts/LeftNavFooterItem/index.js +80 -97
- package/cjs/parts/LeftNavFooterItem/styled.js +34 -89
- package/cjs/parts/LeftNavLoading/index.js +33 -51
- package/cjs/parts/OutOfTheBoxMapItem.js +46 -49
- package/cjs/prop-types.js +39 -58
- package/esm/LeftNavigation.js +15 -17
- package/esm/LeftNavigationContext.js +11 -15
- package/esm/common/getItemBackgroundStyle.js +6 -20
- package/esm/common/getLeftBorderStyle.js +6 -23
- package/esm/common/getScrollbarStyle.js +2 -28
- package/esm/common/index.js +3 -5
- package/esm/configs/index.js +2 -9
- package/esm/configs/useLeftNavConfig.js +67 -47
- package/esm/configs/useLeftNavItems.js +55 -33
- package/esm/configs/useLeftNavSmoothExpand.js +16 -14
- package/esm/exported-related/ChevronItem/index.js +18 -13
- package/esm/exported-related/Icon/index.js +24 -21
- package/esm/exported-related/ItemRenderer/index.js +80 -65
- package/esm/exported-related/ItemRenderer/styled.js +42 -56
- package/esm/exported-related/ItemRenderer/usePropsWithDefaults.js +36 -27
- package/esm/exported-related/Notifications/index.js +50 -57
- package/esm/exported-related/OpenWindowItem/index.js +22 -20
- package/esm/exported-related/constants.js +17 -24
- package/esm/exported-related/index.js +6 -8
- package/esm/hooks/index.js +3 -5
- package/esm/hooks/useExpandableOnClickHandler.js +22 -26
- package/esm/hooks/useKeyboardNavigation.js +47 -30
- package/esm/hooks/useOpenableOnClickHandler.js +22 -26
- package/esm/hooks/useSelectFirstBodyItem.js +30 -18
- package/esm/index.d.js +1 -2
- package/esm/index.js +8 -12
- package/esm/outOfTheBox/ItemControlledDrilldown/index.js +87 -62
- package/esm/outOfTheBox/ItemControlledDrilldown/styled.js +17 -20
- package/esm/outOfTheBox/ItemHeader/index.js +82 -65
- package/esm/outOfTheBox/ItemHeader/styled.js +12 -20
- package/esm/outOfTheBox/ItemLink/index.js +57 -46
- package/esm/outOfTheBox/ItemLink/styled.js +8 -12
- package/esm/outOfTheBox/ItemSection/index.js +53 -30
- package/esm/outOfTheBox/ItemSection/styled.js +13 -24
- package/esm/outOfTheBox/ItemSeparator/index.js +35 -27
- package/esm/outOfTheBox/ItemSubmenu/index.js +81 -65
- package/esm/outOfTheBox/ItemSubmenu/styled.js +12 -20
- package/esm/outOfTheBox/ItemTextLabel/index.js +43 -22
- package/esm/outOfTheBox/ItemTextLabel/styled.js +14 -14
- package/esm/outOfTheBox/ItemUncontrolledDrilldown/index.js +95 -70
- package/esm/outOfTheBox/ItemUncontrolledDrilldown/styled.js +17 -20
- package/esm/outOfTheBox/ItemWithDate/index.js +44 -30
- package/esm/outOfTheBox/ItemWithDate/styled.js +17 -20
- package/esm/outOfTheBox/index.js +34 -25
- package/esm/parts/LeftNavContent/index.js +64 -54
- package/esm/parts/LeftNavContent/styled.js +36 -81
- package/esm/parts/LeftNavContentWithScrollbar/index.js +64 -56
- package/esm/parts/LeftNavFooterItem/index.js +68 -73
- package/esm/parts/LeftNavFooterItem/styled.js +24 -63
- package/esm/parts/LeftNavLoading/index.js +22 -22
- package/esm/parts/OutOfTheBoxMapItem.js +35 -19
- package/esm/prop-types.js +29 -26
- package/package.json +6 -6
- package/types/LeftNavigationContext.d.ts +4 -4
- package/types/configs/useLeftNavSmoothExpand.d.ts +3 -3
- package/types/hooks/useSelectFirstBodyItem.d.ts +1 -1
- package/types/index.d.d.ts +5 -2
- package/cjs/LeftNavigation.js.map +0 -7
- package/cjs/LeftNavigationContext.js.map +0 -7
- package/cjs/common/getItemBackgroundStyle.js.map +0 -7
- package/cjs/common/getLeftBorderStyle.js.map +0 -7
- package/cjs/common/getScrollbarStyle.js.map +0 -7
- package/cjs/common/index.js.map +0 -7
- package/cjs/configs/index.js.map +0 -7
- package/cjs/configs/useLeftNavConfig.js.map +0 -7
- package/cjs/configs/useLeftNavItems.js.map +0 -7
- package/cjs/configs/useLeftNavSmoothExpand.js.map +0 -7
- package/cjs/exported-related/ChevronItem/index.js.map +0 -7
- package/cjs/exported-related/Icon/index.js.map +0 -7
- package/cjs/exported-related/ItemRenderer/index.js.map +0 -7
- package/cjs/exported-related/ItemRenderer/styled.js.map +0 -7
- package/cjs/exported-related/ItemRenderer/usePropsWithDefaults.js.map +0 -7
- package/cjs/exported-related/Notifications/index.js.map +0 -7
- package/cjs/exported-related/OpenWindowItem/index.js.map +0 -7
- package/cjs/exported-related/constants.js.map +0 -7
- package/cjs/exported-related/index.js.map +0 -7
- package/cjs/hooks/index.js.map +0 -7
- package/cjs/hooks/useExpandableOnClickHandler.js.map +0 -7
- package/cjs/hooks/useKeyboardNavigation.js.map +0 -7
- package/cjs/hooks/useOpenableOnClickHandler.js.map +0 -7
- package/cjs/hooks/useSelectFirstBodyItem.js.map +0 -7
- package/cjs/index.d.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/outOfTheBox/ItemControlledDrilldown/index.js.map +0 -7
- package/cjs/outOfTheBox/ItemControlledDrilldown/styled.js.map +0 -7
- package/cjs/outOfTheBox/ItemHeader/index.js.map +0 -7
- package/cjs/outOfTheBox/ItemHeader/styled.js.map +0 -7
- package/cjs/outOfTheBox/ItemLink/index.js.map +0 -7
- package/cjs/outOfTheBox/ItemLink/styled.js.map +0 -7
- package/cjs/outOfTheBox/ItemSection/index.js.map +0 -7
- package/cjs/outOfTheBox/ItemSection/styled.js.map +0 -7
- package/cjs/outOfTheBox/ItemSeparator/index.js.map +0 -7
- package/cjs/outOfTheBox/ItemSubmenu/index.js.map +0 -7
- package/cjs/outOfTheBox/ItemSubmenu/styled.js.map +0 -7
- package/cjs/outOfTheBox/ItemTextLabel/index.js.map +0 -7
- package/cjs/outOfTheBox/ItemTextLabel/styled.js.map +0 -7
- package/cjs/outOfTheBox/ItemUncontrolledDrilldown/index.js.map +0 -7
- package/cjs/outOfTheBox/ItemUncontrolledDrilldown/styled.js.map +0 -7
- package/cjs/outOfTheBox/ItemWithDate/index.js.map +0 -7
- package/cjs/outOfTheBox/ItemWithDate/styled.js.map +0 -7
- package/cjs/outOfTheBox/index.js.map +0 -7
- package/cjs/parts/LeftNavContent/index.js.map +0 -7
- package/cjs/parts/LeftNavContent/styled.js.map +0 -7
- package/cjs/parts/LeftNavContentWithScrollbar/index.js.map +0 -7
- package/cjs/parts/LeftNavFooterItem/index.js.map +0 -7
- package/cjs/parts/LeftNavFooterItem/styled.js.map +0 -7
- package/cjs/parts/LeftNavLoading/index.js.map +0 -7
- package/cjs/parts/OutOfTheBoxMapItem.js.map +0 -7
- package/cjs/prop-types.js.map +0 -7
- package/esm/LeftNavigation.js.map +0 -7
- package/esm/LeftNavigationContext.js.map +0 -7
- package/esm/common/getItemBackgroundStyle.js.map +0 -7
- package/esm/common/getLeftBorderStyle.js.map +0 -7
- package/esm/common/getScrollbarStyle.js.map +0 -7
- package/esm/common/index.js.map +0 -7
- package/esm/configs/index.js.map +0 -7
- package/esm/configs/useLeftNavConfig.js.map +0 -7
- package/esm/configs/useLeftNavItems.js.map +0 -7
- package/esm/configs/useLeftNavSmoothExpand.js.map +0 -7
- package/esm/exported-related/ChevronItem/index.js.map +0 -7
- package/esm/exported-related/Icon/index.js.map +0 -7
- package/esm/exported-related/ItemRenderer/index.js.map +0 -7
- package/esm/exported-related/ItemRenderer/styled.js.map +0 -7
- package/esm/exported-related/ItemRenderer/usePropsWithDefaults.js.map +0 -7
- package/esm/exported-related/Notifications/index.js.map +0 -7
- package/esm/exported-related/OpenWindowItem/index.js.map +0 -7
- package/esm/exported-related/constants.js.map +0 -7
- package/esm/exported-related/index.js.map +0 -7
- package/esm/hooks/index.js.map +0 -7
- package/esm/hooks/useExpandableOnClickHandler.js.map +0 -7
- package/esm/hooks/useKeyboardNavigation.js.map +0 -7
- package/esm/hooks/useOpenableOnClickHandler.js.map +0 -7
- package/esm/hooks/useSelectFirstBodyItem.js.map +0 -7
- package/esm/index.d.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/outOfTheBox/ItemControlledDrilldown/index.js.map +0 -7
- package/esm/outOfTheBox/ItemControlledDrilldown/styled.js.map +0 -7
- package/esm/outOfTheBox/ItemHeader/index.js.map +0 -7
- package/esm/outOfTheBox/ItemHeader/styled.js.map +0 -7
- package/esm/outOfTheBox/ItemLink/index.js.map +0 -7
- package/esm/outOfTheBox/ItemLink/styled.js.map +0 -7
- package/esm/outOfTheBox/ItemSection/index.js.map +0 -7
- package/esm/outOfTheBox/ItemSection/styled.js.map +0 -7
- package/esm/outOfTheBox/ItemSeparator/index.js.map +0 -7
- package/esm/outOfTheBox/ItemSubmenu/index.js.map +0 -7
- package/esm/outOfTheBox/ItemSubmenu/styled.js.map +0 -7
- package/esm/outOfTheBox/ItemTextLabel/index.js.map +0 -7
- package/esm/outOfTheBox/ItemTextLabel/styled.js.map +0 -7
- package/esm/outOfTheBox/ItemUncontrolledDrilldown/index.js.map +0 -7
- package/esm/outOfTheBox/ItemUncontrolledDrilldown/styled.js.map +0 -7
- package/esm/outOfTheBox/ItemWithDate/index.js.map +0 -7
- package/esm/outOfTheBox/ItemWithDate/styled.js.map +0 -7
- package/esm/outOfTheBox/index.js.map +0 -7
- package/esm/parts/LeftNavContent/index.js.map +0 -7
- package/esm/parts/LeftNavContent/styled.js.map +0 -7
- package/esm/parts/LeftNavContentWithScrollbar/index.js.map +0 -7
- package/esm/parts/LeftNavFooterItem/index.js.map +0 -7
- package/esm/parts/LeftNavFooterItem/styled.js.map +0 -7
- package/esm/parts/LeftNavLoading/index.js.map +0 -7
- package/esm/parts/OutOfTheBoxMapItem.js.map +0 -7
- package/esm/prop-types.js.map +0 -7
|
@@ -1,55 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var OutOfTheBoxMapItem_exports = {};
|
|
29
|
-
__export(OutOfTheBoxMapItem_exports, {
|
|
30
|
-
OutOfTheBoxMapItem: () => OutOfTheBoxMapItem
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_outOfTheBox = require("../outOfTheBox");
|
|
35
|
-
var import_LeftNavigationContext = require("../LeftNavigationContext");
|
|
36
|
-
const OutOfTheBoxMapItem = (props) => {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
|
+
var React = require('react');
|
|
13
|
+
var index = require('../outOfTheBox/index.js');
|
|
14
|
+
var LeftNavigationContext = require('../LeftNavigationContext.js');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
19
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
|
+
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
+
const OutOfTheBoxMapItem = props => {
|
|
37
26
|
const {
|
|
38
27
|
item,
|
|
39
|
-
item: {
|
|
28
|
+
item: {
|
|
29
|
+
type,
|
|
30
|
+
Component
|
|
31
|
+
}
|
|
40
32
|
} = props;
|
|
41
|
-
const ctx =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
const ctx = React__default["default"].useContext(LeftNavigationContext.LeftNavContext);
|
|
34
|
+
|
|
35
|
+
if (typeof type === 'string' && !!index.outOfTheBoxComponents[type]) {
|
|
36
|
+
const OutOfTheBoxComponent = index.outOfTheBoxComponents[type];
|
|
37
|
+
return /*#__PURE__*/_jsx__default["default"](OutOfTheBoxComponent, {
|
|
38
|
+
item: _objectSpread({
|
|
39
|
+
itemOpts: {}
|
|
40
|
+
}, item),
|
|
41
|
+
ctx: ctx
|
|
47
42
|
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
} // we expect an error to be threw if Component is not defined and type is not a valid out-of-the-box...
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
return /*#__PURE__*/_jsx__default["default"](Component, {
|
|
47
|
+
item: item,
|
|
48
|
+
ctx: ctx
|
|
52
49
|
});
|
|
53
50
|
};
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
|
|
52
|
+
exports.OutOfTheBoxMapItem = OutOfTheBoxMapItem;
|
package/cjs/prop-types.js
CHANGED
|
@@ -1,66 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var prop_types_exports = {};
|
|
29
|
-
__export(prop_types_exports, {
|
|
30
|
-
LeftNavItemOptionsSchema: () => LeftNavItemOptionsSchema,
|
|
31
|
-
LeftNavItemPropsSchema: () => LeftNavItemPropsSchema,
|
|
32
|
-
leftNavItemProps: () => leftNavItemProps,
|
|
33
|
-
leftNavigationProps: () => leftNavigationProps
|
|
34
|
-
});
|
|
35
|
-
var React = __toESM(require("react"));
|
|
36
|
-
var import_react_desc = require("react-desc");
|
|
37
|
-
var import_outOfTheBox = require("./outOfTheBox");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var reactDesc = require('react-desc');
|
|
6
|
+
var index = require('./outOfTheBox/index.js');
|
|
7
|
+
|
|
38
8
|
const leftNavItemProps = {
|
|
39
|
-
type:
|
|
40
|
-
dsId:
|
|
41
|
-
Component:
|
|
42
|
-
CollapsedComponent:
|
|
43
|
-
itemOpts:
|
|
9
|
+
type: reactDesc.PropTypes.oneOf(index.outOfTheBoxTypes).description('out of the box types'),
|
|
10
|
+
dsId: reactDesc.PropTypes.string.description('unique identifier for the left nav item'),
|
|
11
|
+
Component: reactDesc.PropTypes.func.description("A custom component, receives the item as prop. This is used only when type is not defined or doesn't matches any out-of-the-box"),
|
|
12
|
+
CollapsedComponent: reactDesc.PropTypes.func.description('A component which is renderer when the left-nav is collapsed'),
|
|
13
|
+
itemOpts: reactDesc.PropTypes.object.description('Item options')
|
|
44
14
|
};
|
|
45
15
|
const leftNavigationProps = {
|
|
46
|
-
containerProps:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
16
|
+
containerProps: reactDesc.PropTypes.shape({
|
|
17
|
+
expandedWidth: reactDesc.PropTypes.string
|
|
18
|
+
}).description('Set of Properties attached to the main container').defaultValue({
|
|
19
|
+
expandedWidth: '240px'
|
|
20
|
+
}),
|
|
21
|
+
expanded: reactDesc.PropTypes.bool.description('Whether to show the left navigation expanded or collapsed').defaultValue(false),
|
|
22
|
+
loading: reactDesc.PropTypes.bool.description('Whether the left-nav is loading').defaultValue(false),
|
|
23
|
+
tabIndex: reactDesc.PropTypes.number.description('Tab index').defaultValue(0),
|
|
24
|
+
openedItem: reactDesc.PropTypes.string.description('The id of the left navigation item you want to be opened').defaultValue(null),
|
|
25
|
+
footerLabel: reactDesc.PropTypes.string.description('The label to show in the footer item'),
|
|
26
|
+
onFooterExpand: reactDesc.PropTypes.func.description('The function to call when the left-nav is opened via the footer'),
|
|
27
|
+
onFooterClose: reactDesc.PropTypes.func.description('The function to call when the left-nav is closed via the footer'),
|
|
28
|
+
onSelectedChange: reactDesc.PropTypes.func.description('A callback which triggers when the selected item changes').defaultValue(() => null),
|
|
29
|
+
onFocusChange: reactDesc.PropTypes.func.description('A callback which triggers when the focused item changes').defaultValue(() => null),
|
|
30
|
+
items: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.object).description('The array of items you want to render inside the left nav').defaultValue([]),
|
|
31
|
+
disableDefaultSelection: reactDesc.PropTypes.bool.description('Whether you do not want to automatically select the first body item').defaultValue(false)
|
|
58
32
|
};
|
|
33
|
+
|
|
59
34
|
const LeftNavItemProps = () => null;
|
|
60
|
-
|
|
35
|
+
|
|
36
|
+
const LeftNavItemPropsSchema = reactDesc.describe(LeftNavItemProps);
|
|
61
37
|
LeftNavItemPropsSchema.propTypes = leftNavItemProps;
|
|
38
|
+
|
|
62
39
|
const LeftNavItemOptions = () => null;
|
|
63
|
-
|
|
40
|
+
|
|
41
|
+
const LeftNavItemOptionsSchema = reactDesc.describe(LeftNavItemOptions);
|
|
64
42
|
LeftNavItemOptionsSchema.propTypes = leftNavItemProps;
|
|
65
|
-
|
|
66
|
-
|
|
43
|
+
|
|
44
|
+
exports.LeftNavItemOptionsSchema = LeftNavItemOptionsSchema;
|
|
45
|
+
exports.LeftNavItemPropsSchema = LeftNavItemPropsSchema;
|
|
46
|
+
exports.leftNavItemProps = leftNavItemProps;
|
|
47
|
+
exports.leftNavigationProps = leftNavigationProps;
|
package/esm/LeftNavigation.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { describe } from
|
|
4
|
-
import { leftNavigationProps } from
|
|
5
|
-
import
|
|
6
|
-
import { useLeftNavConfig } from
|
|
7
|
-
import LeftNavContent from
|
|
8
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { describe } from 'react-desc';
|
|
4
|
+
import { leftNavigationProps } from './prop-types.js';
|
|
5
|
+
import { LeftNavContext, defaultProps } from './LeftNavigationContext.js';
|
|
6
|
+
import { useLeftNavConfig } from './configs/useLeftNavConfig.js';
|
|
7
|
+
import LeftNavContent from './parts/LeftNavContent/index.js';
|
|
8
|
+
|
|
9
|
+
var _LeftNavContent;
|
|
10
|
+
const LeftNavigation = props => {
|
|
9
11
|
const leftNavConfig = useLeftNavConfig(props);
|
|
10
|
-
return
|
|
12
|
+
return /*#__PURE__*/_jsx(LeftNavContext.Provider, {
|
|
11
13
|
value: leftNavConfig
|
|
12
|
-
},
|
|
14
|
+
}, void 0, _LeftNavContent || (_LeftNavContent = /*#__PURE__*/_jsx(LeftNavContent, {})));
|
|
13
15
|
};
|
|
14
|
-
LeftNavigation.propTypes = leftNavigationProps;
|
|
15
16
|
LeftNavigation.defaultProps = defaultProps;
|
|
16
|
-
const LeftNavigationWithSchema = describe(LeftNavigation).description(
|
|
17
|
+
const LeftNavigationWithSchema = describe(LeftNavigation).description('Left Navigation');
|
|
17
18
|
LeftNavigationWithSchema.propTypes = leftNavigationProps;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
LeftNavigationWithSchema
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=LeftNavigation.js.map
|
|
19
|
+
|
|
20
|
+
export { LeftNavigation, LeftNavigationWithSchema };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
3
|
const defaultProps = {
|
|
4
|
-
expandedWidth:
|
|
4
|
+
expandedWidth: '240px',
|
|
5
5
|
tabIndex: 0,
|
|
6
6
|
loading: false,
|
|
7
7
|
expanded: false,
|
|
8
8
|
openedItem: null,
|
|
9
|
-
footerLabel:
|
|
9
|
+
footerLabel: '',
|
|
10
10
|
onSelectedChange: () => null,
|
|
11
11
|
onFocusChange: () => null,
|
|
12
12
|
onFooterExpand: () => null,
|
|
13
13
|
onFooterClose: () => null,
|
|
14
14
|
items: [],
|
|
15
|
-
labelOverflow:
|
|
15
|
+
labelOverflow: 'wrap',
|
|
16
16
|
onItemClick: () => null
|
|
17
17
|
};
|
|
18
18
|
const defaultContext = {
|
|
@@ -25,14 +25,10 @@ const defaultContext = {
|
|
|
25
25
|
openedDrilldowns: [],
|
|
26
26
|
setOpenedDrilldowns: () => null,
|
|
27
27
|
visibleItems: [],
|
|
28
|
-
visibleItemsRefs: {
|
|
28
|
+
visibleItemsRefs: {
|
|
29
|
+
current: {}
|
|
30
|
+
}
|
|
29
31
|
};
|
|
30
|
-
const LeftNavContext = createContext(defaultContext);
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
LeftNavContext,
|
|
34
|
-
LeftNavigationContext_default as default,
|
|
35
|
-
defaultContext,
|
|
36
|
-
defaultProps
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=LeftNavigationContext.js.map
|
|
32
|
+
const LeftNavContext = /*#__PURE__*/createContext(defaultContext);
|
|
33
|
+
|
|
34
|
+
export { LeftNavContext, LeftNavContext as default, defaultContext, defaultProps };
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
const commonItemBackgroundStyle = (color, hoverColor, activeColor) => `
|
|
1
|
+
const commonItemBackgroundStyle = (color, hoverColor, activeColor) => "\n\n background: ".concat(color, ";\n\n :hover {\n background: ").concat(hoverColor, ";\n }\n\n :active {\n background: ").concat(activeColor, ";\n }\n");
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
background: ${hoverColor};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
:active {
|
|
11
|
-
background: ${activeColor};
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
const getItemBackgroundStyle = (props) => {
|
|
15
|
-
if (props.selected && !props.opened)
|
|
16
|
-
return commonItemBackgroundStyle(props.theme.colors.brand[200], props.theme.colors.brand[200], props.theme.colors.brand[200]);
|
|
17
|
-
return commonItemBackgroundStyle(props.theme.colors.neutral["000"], props.theme.colors.neutral["080"], props.theme.colors.brand[200]);
|
|
3
|
+
const getItemBackgroundStyle = props => {
|
|
4
|
+
if (props.selected && !props.opened) return commonItemBackgroundStyle(props.theme.colors.brand[200], props.theme.colors.brand[200], props.theme.colors.brand[200]);
|
|
5
|
+
return commonItemBackgroundStyle(props.theme.colors.neutral['000'], props.theme.colors.neutral['080'], props.theme.colors.brand[200]);
|
|
18
6
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=getItemBackgroundStyle.js.map
|
|
7
|
+
|
|
8
|
+
export { getItemBackgroundStyle };
|
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
const commonLeftBorderStyle = (color, hoverColor, activeColor) => `
|
|
1
|
+
const commonLeftBorderStyle = (color, hoverColor, activeColor) => "\n\n -webkit-box-shadow: inset 4px 0 0 0 ".concat(color, ";\n box-shadow: inset 4px 0 0 0 ").concat(color, ";\n\n :hover {\n -webkit-box-shadow: inset 4px 0 0 0 ").concat(hoverColor, ";\n box-shadow: inset 4px 0 0 0 ").concat(hoverColor, ";\n }\n\n :active {\n -webkit-box-shadow: inset 4px 0 0 0 ").concat(activeColor, ";\n box-shadow: inset 4px 0 0 0 ").concat(activeColor, ";\n }\n");
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
:hover {
|
|
8
|
-
-webkit-box-shadow: inset 4px 0 0 0 ${hoverColor};
|
|
9
|
-
box-shadow: inset 4px 0 0 0 ${hoverColor};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
:active {
|
|
13
|
-
-webkit-box-shadow: inset 4px 0 0 0 ${activeColor};
|
|
14
|
-
box-shadow: inset 4px 0 0 0 ${activeColor};
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
const getLeftBorderStyle = (props) => {
|
|
18
|
-
if (props.selected || props.selectedParent)
|
|
19
|
-
return commonLeftBorderStyle(props.theme.colors.brand[400], props.theme.colors.brand[400], props.theme.colors.brand[400]);
|
|
20
|
-
return commonLeftBorderStyle(props.theme.colors.neutral["000"], props.theme.colors.brand[300], props.theme.colors.brand[400]);
|
|
3
|
+
const getLeftBorderStyle = props => {
|
|
4
|
+
if (props.selected || props.selectedParent) return commonLeftBorderStyle(props.theme.colors.brand[400], props.theme.colors.brand[400], props.theme.colors.brand[400]);
|
|
5
|
+
return commonLeftBorderStyle(props.theme.colors.neutral['000'], props.theme.colors.brand[300], props.theme.colors.brand[400]);
|
|
21
6
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=getLeftBorderStyle.js.map
|
|
7
|
+
|
|
8
|
+
export { getLeftBorderStyle };
|
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
const getScrolbarStyle = () => `
|
|
3
|
-
::-webkit-scrollbar {
|
|
4
|
-
width: 14px;
|
|
5
|
-
}
|
|
6
|
-
::-webkit-scrollbar-thumb {
|
|
7
|
-
height: 6px;
|
|
8
|
-
border: 4px solid rgba(0, 0, 0, 0);
|
|
1
|
+
const getScrolbarStyle = () => "\n ::-webkit-scrollbar {\n width: 14px;\n }\n ::-webkit-scrollbar-thumb {\n height: 6px;\n border: 4px solid rgba(0, 0, 0, 0);\n\n background-clip: padding-box;\n\n background-color: rgba(105, 116, 137, 0.5);\n\n border-radius: 7px;\n -webkit-border-radius: 7px;\n }\n ::-webkit-scrollbar-button {\n width: 0;\n height: 0;\n display: none;\n }\n ::-webkit-scrollbar-corner {\n background-color: transparent;\n }\n";
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
background-color: rgba(105, 116, 137, 0.5);
|
|
13
|
-
|
|
14
|
-
border-radius: 7px;
|
|
15
|
-
-webkit-border-radius: 7px;
|
|
16
|
-
}
|
|
17
|
-
::-webkit-scrollbar-button {
|
|
18
|
-
width: 0;
|
|
19
|
-
height: 0;
|
|
20
|
-
display: none;
|
|
21
|
-
}
|
|
22
|
-
::-webkit-scrollbar-corner {
|
|
23
|
-
background-color: transparent;
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
export {
|
|
27
|
-
getScrolbarStyle
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=getScrollbarStyle.js.map
|
|
3
|
+
export { getScrolbarStyle };
|
package/esm/common/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export * from "./getScrollbarStyle";
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { getItemBackgroundStyle } from './getItemBackgroundStyle.js';
|
|
2
|
+
export { getLeftBorderStyle } from './getLeftBorderStyle.js';
|
|
3
|
+
export { getScrolbarStyle } from './getScrollbarStyle.js';
|
package/esm/configs/index.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { useLeftNavConfig as useLeftNavConfig2 } from "./useLeftNavConfig";
|
|
4
|
-
var configs_default = useLeftNavConfig;
|
|
5
|
-
export {
|
|
6
|
-
configs_default as default,
|
|
7
|
-
useLeftNavConfig2 as useLeftNavConfig
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { useLeftNavConfig } from './useLeftNavConfig.js';
|
|
2
|
+
export { useLeftNavConfig as default, useLeftNavConfig } from './useLeftNavConfig.js';
|
|
@@ -1,73 +1,93 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import useLeftNavItems from
|
|
4
|
-
import { useLeftNavSmoothExpand } from
|
|
5
|
-
import { useSelectFirstBodyItem } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useLeftNavItems } from './useLeftNavItems.js';
|
|
4
|
+
import { useLeftNavSmoothExpand } from './useLeftNavSmoothExpand.js';
|
|
5
|
+
import { useSelectFirstBodyItem } from '../hooks/useSelectFirstBodyItem.js';
|
|
6
|
+
|
|
7
|
+
const useLeftNavConfig = props => {
|
|
8
|
+
const {
|
|
9
|
+
expanded,
|
|
10
|
+
openedItem,
|
|
11
|
+
onSelectedChange,
|
|
12
|
+
onFocusChange,
|
|
13
|
+
items
|
|
14
|
+
} = props; // -----------------------------------------------------------------------------
|
|
15
|
+
// ************************** ------------ **************************
|
|
16
|
+
// * INTERNAL STATE *
|
|
17
|
+
// ************************** ------------ **************************
|
|
18
|
+
// Selection related
|
|
19
|
+
|
|
20
|
+
const [selectedItem, setSelectedItem] = React.useState(null);
|
|
21
|
+
const [selectedParent, setSelectedParent] = React.useState(null); // Focus related
|
|
22
|
+
|
|
23
|
+
const [focusedItem, setFocusedItem] = React.useState(null); // Opened uncontrolled drilldowns
|
|
24
|
+
|
|
25
|
+
const [openedDrilldowns, setOpenedDrilldowns] = React.useState([]); // -----------------------------------------------------------------------------
|
|
26
|
+
// ************************** ------------ **************************
|
|
27
|
+
// * EXPAND ANIMATION *
|
|
28
|
+
// ************************** ------------ **************************
|
|
29
|
+
|
|
30
|
+
const [expandedForAnimation, setExpandedForAnimation] = React.useState(expanded);
|
|
31
|
+
const timeoutRef = React.useRef(null);
|
|
32
|
+
const smoothExpandOpts = React.useMemo(() => ({
|
|
16
33
|
expandedForAnimation,
|
|
17
34
|
timeoutRef,
|
|
18
35
|
setExpandedForAnimation
|
|
19
36
|
}), [expandedForAnimation, timeoutRef, setExpandedForAnimation]);
|
|
20
|
-
useLeftNavSmoothExpand(props, smoothExpandOpts);
|
|
21
|
-
|
|
37
|
+
useLeftNavSmoothExpand(props, smoothExpandOpts); // -----------------------------------------------------------------------------
|
|
38
|
+
// ************************** ------------ **************************
|
|
39
|
+
// * SIDE EFFECTS *
|
|
40
|
+
// ************************** ------------ **************************
|
|
41
|
+
|
|
42
|
+
React.useEffect(() => {
|
|
22
43
|
onSelectedChange(selectedItem);
|
|
23
44
|
}, [selectedItem, onSelectedChange]);
|
|
24
|
-
|
|
25
|
-
if (
|
|
26
|
-
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
if (props.actionRef && props.actionRef.current) {
|
|
47
|
+
props.actionRef.current.setFocusedItem = setFocusedItem;
|
|
48
|
+
}
|
|
49
|
+
}, [props.actionRef]);
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (openedItem !== null) setSelectedParent(openedItem);
|
|
27
52
|
}, [openedItem]);
|
|
28
|
-
|
|
53
|
+
React.useEffect(() => {
|
|
29
54
|
onFocusChange(focusedItem);
|
|
30
55
|
}, [focusedItem, onFocusChange]);
|
|
31
|
-
useSelectFirstBodyItem(items, openedItem, props.selectedItem !==
|
|
32
|
-
|
|
56
|
+
useSelectFirstBodyItem(items, openedItem, props.selectedItem !== undefined ? props.selectedItem : selectedItem, setSelectedItem, props.disableDefaultSelection); // -----------------------------------------------------------------------------
|
|
57
|
+
// ************************** ------------ **************************
|
|
58
|
+
// * ITEMS MANAGEMENT *
|
|
59
|
+
// ************************** ------------ **************************
|
|
60
|
+
|
|
61
|
+
const leftNavItemsProps = React.useMemo(() => ({
|
|
33
62
|
headerItem: props.HeaderComponent,
|
|
34
63
|
bodyHeaderItem: props.BodyHeaderComponent,
|
|
35
64
|
items: props.items,
|
|
36
65
|
openedDrilldowns
|
|
37
|
-
}), [props.HeaderComponent, props.BodyHeaderComponent, props.items, openedDrilldowns]);
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
leftNavProps: props,
|
|
41
|
-
expandedForAnimation,
|
|
42
|
-
selectedItem: props.selectedItem !== void 0 ? props.selectedItem : selectedItem,
|
|
43
|
-
setSelectedItem,
|
|
44
|
-
selectedParent: props.selectedParent !== void 0 ? props.selectedParent : selectedParent,
|
|
45
|
-
setSelectedParent,
|
|
46
|
-
focusedItem,
|
|
47
|
-
setFocusedItem,
|
|
48
|
-
openedDrilldowns,
|
|
49
|
-
setOpenedDrilldowns,
|
|
66
|
+
}), [props.HeaderComponent, props.BodyHeaderComponent, props.items, openedDrilldowns]); // We need to know the current visible items since we have drilldowns
|
|
67
|
+
|
|
68
|
+
const {
|
|
50
69
|
visibleItems,
|
|
51
70
|
visibleItemsRefs
|
|
52
|
-
})
|
|
53
|
-
|
|
71
|
+
} = useLeftNavItems(leftNavItemsProps); // -----------------------------------------------------------------------------
|
|
72
|
+
// ************************** ------------ **************************
|
|
73
|
+
// * LEFTNAV CONFIG *
|
|
74
|
+
// ************************** ------------ **************************
|
|
75
|
+
|
|
76
|
+
const finalConfig = React.useMemo(() => ({
|
|
77
|
+
leftNavProps: props,
|
|
54
78
|
expandedForAnimation,
|
|
55
|
-
selectedItem,
|
|
79
|
+
selectedItem: props.selectedItem !== undefined ? props.selectedItem : selectedItem,
|
|
56
80
|
setSelectedItem,
|
|
81
|
+
selectedParent: props.selectedParent !== undefined ? props.selectedParent : selectedParent,
|
|
57
82
|
setSelectedParent,
|
|
58
|
-
selectedParent,
|
|
59
83
|
focusedItem,
|
|
60
84
|
setFocusedItem,
|
|
61
85
|
openedDrilldowns,
|
|
62
86
|
setOpenedDrilldowns,
|
|
63
87
|
visibleItems,
|
|
64
88
|
visibleItemsRefs
|
|
65
|
-
]);
|
|
89
|
+
}), [props, expandedForAnimation, selectedItem, setSelectedItem, setSelectedParent, selectedParent, focusedItem, setFocusedItem, openedDrilldowns, setOpenedDrilldowns, visibleItems, visibleItemsRefs]);
|
|
66
90
|
return finalConfig;
|
|
67
91
|
};
|
|
68
|
-
|
|
69
|
-
export {
|
|
70
|
-
useLeftNavConfig_default as default,
|
|
71
|
-
useLeftNavConfig
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=useLeftNavConfig.js.map
|
|
92
|
+
|
|
93
|
+
export { useLeftNavConfig as default, useLeftNavConfig };
|