@elliemae/ds-left-navigation 2.4.2-rc.12 → 2.4.2-rc.15
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/common/getItemBackgroundStyle.js +12 -1
- package/cjs/common/getLeftBorderStyle.js +15 -1
- package/cjs/common/getScrollbarStyle.js +24 -1
- package/cjs/configs/useLeftNavConfig.js +0 -1
- package/cjs/configs/useLeftNavItems.js +3 -8
- package/cjs/exported-related/ItemRenderer/index.js +2 -2
- package/cjs/exported-related/ItemRenderer/styled.js +13 -2
- package/cjs/exported-related/ItemRenderer/usePropsWithDefaults.js +1 -1
- package/cjs/hooks/useKeyboardNavigation.js +1 -3
- package/cjs/hooks/useSelectFirstBodyItem.js +2 -8
- package/cjs/outOfTheBox/ItemControlledDrilldown/index.js +1 -3
- package/cjs/outOfTheBox/ItemHeader/index.js +14 -6
- package/cjs/outOfTheBox/ItemLink/index.js +12 -2
- package/cjs/outOfTheBox/ItemSubmenu/index.js +14 -6
- package/cjs/outOfTheBox/ItemUncontrolledDrilldown/index.js +1 -4
- package/cjs/parts/LeftNavContent/styled.js +11 -3
- package/cjs/parts/LeftNavContentWithScrollbar/index.js +2 -3
- package/cjs/parts/LeftNavFooterItem/index.js +1 -1
- package/esm/common/getItemBackgroundStyle.js +12 -1
- package/esm/common/getLeftBorderStyle.js +15 -1
- package/esm/common/getScrollbarStyle.js +24 -1
- package/esm/configs/useLeftNavConfig.js +0 -1
- package/esm/configs/useLeftNavItems.js +3 -8
- package/esm/exported-related/ItemRenderer/index.js +2 -2
- package/esm/exported-related/ItemRenderer/styled.js +13 -2
- package/esm/exported-related/ItemRenderer/usePropsWithDefaults.js +1 -1
- package/esm/hooks/useKeyboardNavigation.js +1 -3
- package/esm/hooks/useSelectFirstBodyItem.js +2 -8
- package/esm/outOfTheBox/ItemControlledDrilldown/index.js +1 -3
- package/esm/outOfTheBox/ItemHeader/index.js +14 -6
- package/esm/outOfTheBox/ItemLink/index.js +12 -2
- package/esm/outOfTheBox/ItemSubmenu/index.js +14 -6
- package/esm/outOfTheBox/ItemUncontrolledDrilldown/index.js +1 -4
- package/esm/parts/LeftNavContent/styled.js +11 -3
- package/esm/parts/LeftNavContentWithScrollbar/index.js +0 -1
- package/esm/parts/LeftNavFooterItem/index.js +1 -1
- package/package.json +6 -6
|
@@ -2,7 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const commonItemBackgroundStyle = (color, hoverColor, activeColor) =>
|
|
5
|
+
const commonItemBackgroundStyle = (color, hoverColor, activeColor) => `
|
|
6
|
+
|
|
7
|
+
background: ${color};
|
|
8
|
+
|
|
9
|
+
:hover {
|
|
10
|
+
background: ${hoverColor};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:active {
|
|
14
|
+
background: ${activeColor};
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
6
17
|
|
|
7
18
|
const getItemBackgroundStyle = props => {
|
|
8
19
|
if (props.selected && !props.opened) return commonItemBackgroundStyle(props.theme.colors.brand[200], props.theme.colors.brand[200], props.theme.colors.brand[200]);
|
|
@@ -2,7 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const commonLeftBorderStyle = (color, hoverColor, activeColor) =>
|
|
5
|
+
const commonLeftBorderStyle = (color, hoverColor, activeColor) => `
|
|
6
|
+
|
|
7
|
+
-webkit-box-shadow: inset 4px 0 0 0 ${color};
|
|
8
|
+
box-shadow: inset 4px 0 0 0 ${color};
|
|
9
|
+
|
|
10
|
+
:hover {
|
|
11
|
+
-webkit-box-shadow: inset 4px 0 0 0 ${hoverColor};
|
|
12
|
+
box-shadow: inset 4px 0 0 0 ${hoverColor};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:active {
|
|
16
|
+
-webkit-box-shadow: inset 4px 0 0 0 ${activeColor};
|
|
17
|
+
box-shadow: inset 4px 0 0 0 ${activeColor};
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
6
20
|
|
|
7
21
|
const getLeftBorderStyle = props => {
|
|
8
22
|
if (props.selected || props.selectedParent) return commonLeftBorderStyle(props.theme.colors.brand[400], props.theme.colors.brand[400], props.theme.colors.brand[400]);
|
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const getScrolbarStyle = () =>
|
|
5
|
+
const getScrolbarStyle = () => `
|
|
6
|
+
::-webkit-scrollbar {
|
|
7
|
+
width: 14px;
|
|
8
|
+
}
|
|
9
|
+
::-webkit-scrollbar-thumb {
|
|
10
|
+
height: 6px;
|
|
11
|
+
border: 4px solid rgba(0, 0, 0, 0);
|
|
12
|
+
|
|
13
|
+
background-clip: padding-box;
|
|
14
|
+
|
|
15
|
+
background-color: rgba(105, 116, 137, 0.5);
|
|
16
|
+
|
|
17
|
+
border-radius: 7px;
|
|
18
|
+
-webkit-border-radius: 7px;
|
|
19
|
+
}
|
|
20
|
+
::-webkit-scrollbar-button {
|
|
21
|
+
width: 0;
|
|
22
|
+
height: 0;
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
::-webkit-scrollbar-corner {
|
|
26
|
+
background-color: transparent;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
6
29
|
|
|
7
30
|
exports.getScrolbarStyle = getScrolbarStyle;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var useLeftNavItems = require('./useLeftNavItems.js');
|
|
8
7
|
var useLeftNavSmoothExpand = require('./useLeftNavSmoothExpand.js');
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
7
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
8
|
var React = require('react');
|
|
10
9
|
var constants = require('../exported-related/constants.js');
|
|
11
10
|
require('@babel/runtime/helpers/jsx');
|
|
@@ -23,21 +22,17 @@ const notFocuseableItems = [constants.ITEM_TYPES.LEFT_NAV_ITEM_SEPARATOR, consta
|
|
|
23
22
|
const walkItems = (items, openedDrilldowns, callback) => {
|
|
24
23
|
items.forEach(item => {
|
|
25
24
|
if (typeof item.type === 'string') {
|
|
26
|
-
var _item$itemOpts$items, _item$itemOpts, _item$itemOpts2, _item$itemOpts$items2, _item$itemOpts3;
|
|
27
|
-
|
|
28
25
|
// Out of the box item
|
|
29
26
|
if (notFocuseableItems.includes(item.type)) return; // not focuseable
|
|
30
27
|
|
|
31
28
|
callback(item.dsId); // If it's an opened uncontrolled drilldown
|
|
32
29
|
|
|
33
|
-
if (item.type === constants.ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN && openedDrilldowns.includes(item.dsId)) walkItems(
|
|
30
|
+
if (item.type === constants.ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN && openedDrilldowns.includes(item.dsId)) walkItems(item.itemOpts?.items ?? [], openedDrilldowns, callback); // If it's an opened controlled drilldown
|
|
34
31
|
|
|
35
|
-
if (item.type === constants.ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN &&
|
|
32
|
+
if (item.type === constants.ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN && item.itemOpts?.isOpened) walkItems(item.itemOpts?.items ?? [], openedDrilldowns, callback);
|
|
36
33
|
} else {
|
|
37
|
-
var _item$itemOpts4;
|
|
38
|
-
|
|
39
34
|
// Custom item
|
|
40
|
-
if (!
|
|
35
|
+
if (!item.itemOpts?.focuseable) return; // not focuseable specified
|
|
41
36
|
|
|
42
37
|
callback(item.dsId);
|
|
43
38
|
}
|
|
@@ -84,7 +84,7 @@ const ItemRenderer = props => {
|
|
|
84
84
|
}, void 0, /*#__PURE__*/jsxRuntime.jsx(styled.StyledItem, {
|
|
85
85
|
ref: visibleItemsRefs.current[dsId],
|
|
86
86
|
pt: paddingTop,
|
|
87
|
-
pl: indent === undefined ? 'xxxs' :
|
|
87
|
+
pl: indent === undefined ? 'xxxs' : `${indent}px`,
|
|
88
88
|
minHeight: minHeight,
|
|
89
89
|
shadowStyle: shadowStyle(opened, item.type),
|
|
90
90
|
alignItems: "flex-start",
|
|
@@ -118,7 +118,7 @@ const ItemRenderer = props => {
|
|
|
118
118
|
marginLeft: opened ? '16px' : '0px',
|
|
119
119
|
marginRight: borderBottomMr,
|
|
120
120
|
height: '1px',
|
|
121
|
-
width:
|
|
121
|
+
width: `calc(100% - ${borderBottomMr} - ${opened ? '16px' : '0px'})`,
|
|
122
122
|
backgroundColor: '#E0E3E8'
|
|
123
123
|
}
|
|
124
124
|
})), subitems]
|
|
@@ -13,7 +13,16 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
13
13
|
/* eslint-disable indent */
|
|
14
14
|
const borderOutside = function (color) {
|
|
15
15
|
let weight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
16
|
-
return
|
|
16
|
+
return `&:before {
|
|
17
|
+
content: '';
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
right: 0;
|
|
22
|
+
bottom: 0;
|
|
23
|
+
border: ${weight}px solid ${color};
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}`;
|
|
17
26
|
};
|
|
18
27
|
const StyledItemWrapper = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
19
28
|
componentId: "sc-11wzgfh-0"
|
|
@@ -51,7 +60,9 @@ const StyledItem = /*#__PURE__*/styled__default["default"](Grid__default["defaul
|
|
|
51
60
|
theme
|
|
52
61
|
} = _ref3;
|
|
53
62
|
return selectable ? theme.colors.brand[200] : 'white';
|
|
54
|
-
}, props => props.shadowStyle(props.theme), props => props.tabIndex !== -1 ?
|
|
63
|
+
}, props => props.shadowStyle(props.theme), props => props.tabIndex !== -1 ? `:focus {
|
|
64
|
+
${borderOutside(props.theme.colors.brand[700])}
|
|
65
|
+
}` : '');
|
|
55
66
|
|
|
56
67
|
exports.StyledItem = StyledItem;
|
|
57
68
|
exports.StyledItemWrapper = StyledItemWrapper;
|
|
@@ -44,7 +44,7 @@ const usePropsWithDefaults = props => {
|
|
|
44
44
|
minHeight: '48px',
|
|
45
45
|
paddingTop: '12px',
|
|
46
46
|
subitems: [],
|
|
47
|
-
shadowStyle: (opened, type) => theme =>
|
|
47
|
+
shadowStyle: (opened, type) => theme => `box-shadow: ${opened || !itemWithoutShadows.includes(type) ? 'inset 4px 0 0 0 #52A6EC' : 'inset 4px 0 0 0 white'}`,
|
|
48
48
|
hasBorderBottom: false,
|
|
49
49
|
borderBottomMr: '0px'
|
|
50
50
|
}, props), {}, {
|
|
@@ -51,9 +51,7 @@ const useKeyboardNavigation = _ref => {
|
|
|
51
51
|
setSelectedItem(nextDsId);
|
|
52
52
|
}, [setFocusedItem, setSelectedItem]);
|
|
53
53
|
React.useLayoutEffect(() => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (dsId === focusedItem) (_visibleItemsRefs$cur = visibleItemsRefs.current[dsId]) === null || _visibleItemsRefs$cur === void 0 ? void 0 : (_visibleItemsRefs$cur2 = _visibleItemsRefs$cur.current) === null || _visibleItemsRefs$cur2 === void 0 ? void 0 : _visibleItemsRefs$cur2.focus();
|
|
54
|
+
if (dsId === focusedItem) visibleItemsRefs.current[dsId]?.current?.focus();
|
|
57
55
|
}, [dsId, focusedItem, visibleItemsRefs]);
|
|
58
56
|
const onKeyDown = React.useCallback(e => {
|
|
59
57
|
const {
|
|
@@ -17,20 +17,14 @@ const isSelectableOutOfTheBox = elem => typeof elem.type === 'string' && elem.ty
|
|
|
17
17
|
|
|
18
18
|
const isSelectableCustom = elem => elem.itemOpts.selectable;
|
|
19
19
|
|
|
20
|
-
const isItemInsideTheTree = (item, itemID) =>
|
|
21
|
-
var _item$itemOpts, _item$itemOpts$items;
|
|
22
|
-
|
|
23
|
-
return item.dsId === itemID || !!(item !== null && item !== void 0 && (_item$itemOpts = item.itemOpts) !== null && _item$itemOpts !== void 0 && (_item$itemOpts$items = _item$itemOpts.items) !== null && _item$itemOpts$items !== void 0 && _item$itemOpts$items.some(it => isItemInsideTheTree(it, itemID)));
|
|
24
|
-
};
|
|
20
|
+
const isItemInsideTheTree = (item, itemID) => item.dsId === itemID || !!item?.itemOpts?.items?.some(it => isItemInsideTheTree(it, itemID));
|
|
25
21
|
|
|
26
22
|
const useSelectFirstBodyItem = (items, openedItem, selectedItem, setSelectedItem, disableDefaultSelection) => {
|
|
27
23
|
React.useEffect(() => {
|
|
28
24
|
if (!disableDefaultSelection && items && items.length && openedItem) {
|
|
29
|
-
var _items$index$dsId;
|
|
30
|
-
|
|
31
25
|
const index = items.findIndex(elem => isSelectableOutOfTheBox(elem) || isSelectableCustom(elem));
|
|
32
26
|
const isItemInside = items.some(it => isItemInsideTheTree(it, selectedItem));
|
|
33
|
-
if (isItemInside) setSelectedItem(selectedItem);else if (index !== -1) setSelectedItem(
|
|
27
|
+
if (isItemInside) setSelectedItem(selectedItem);else if (index !== -1) setSelectedItem(items[index].dsId ?? '');
|
|
34
28
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
29
|
|
|
36
30
|
}, [openedItem, setSelectedItem, disableDefaultSelection]);
|
|
@@ -50,10 +50,8 @@ const OutOfTheBoxMapSubitem = props => {
|
|
|
50
50
|
} = props;
|
|
51
51
|
|
|
52
52
|
if (typeof type === 'string' && !!outOfTheBoxSubitemsComponents[type]) {
|
|
53
|
-
var _item$itemOpts$indent, _item$itemOpts;
|
|
54
|
-
|
|
55
53
|
const OutOfTheBoxComponent = outOfTheBoxSubitemsComponents[type];
|
|
56
|
-
const currentIndent =
|
|
54
|
+
const currentIndent = item.itemOpts?.indent ?? 0;
|
|
57
55
|
|
|
58
56
|
const newItem = _objectSpread(_objectSpread({}, item), {}, {
|
|
59
57
|
itemOpts: _objectSpread(_objectSpread({}, item.itemOpts), {}, {
|
|
@@ -29,11 +29,19 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
29
29
|
|
|
30
30
|
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; }
|
|
31
31
|
|
|
32
|
-
const notOpenedShadowStyle = isSelected => theme =>
|
|
32
|
+
const notOpenedShadowStyle = isSelected => theme => `
|
|
33
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : 'transparent'};
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
:hover {
|
|
36
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : theme.colors.brand[300]};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:active {
|
|
40
|
+
box-shadow: inset 4px 0 0 0 ${theme.colors.brand[400]};
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
36
43
|
|
|
44
|
+
const ItemHeader = props => {
|
|
37
45
|
const {
|
|
38
46
|
item,
|
|
39
47
|
item: {
|
|
@@ -62,9 +70,9 @@ const ItemHeader = props => {
|
|
|
62
70
|
} = props;
|
|
63
71
|
const labelOverflow = itemLabelOverflow || leftNavLabelOverflow;
|
|
64
72
|
const opened = openedItem === dsId;
|
|
65
|
-
const ariaLabel =
|
|
73
|
+
const ariaLabel = item.itemOpts.ariaLabel ?? (typeof label === 'string' ? label : 'menuitem');
|
|
66
74
|
const isSelected = selectedItem === dsId || selectedParent === dsId;
|
|
67
|
-
const shadowStyle = React.useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected)(theme) :
|
|
75
|
+
const shadowStyle = React.useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected)(theme) : `box-shadow: inset 4px 0 0 0 #52A6EC`, [isSelected, openedItem]);
|
|
68
76
|
return /*#__PURE__*/_jsx__default["default"](index.ItemRenderer, {
|
|
69
77
|
item: _objectSpread(_objectSpread({}, item), {}, {
|
|
70
78
|
itemOpts: _objectSpread(_objectSpread({
|
|
@@ -98,7 +106,7 @@ const ItemHeader = props => {
|
|
|
98
106
|
setFocusedItem(constants.CHEVRON_BACK_DS_ID);
|
|
99
107
|
},
|
|
100
108
|
role: "button",
|
|
101
|
-
"aria-label":
|
|
109
|
+
"aria-label": `Close ${ariaLabel}`
|
|
102
110
|
}), /*#__PURE__*/_jsx__default["default"](CollapsedComponent, {
|
|
103
111
|
item: item,
|
|
104
112
|
ctx: ctx
|
|
@@ -28,7 +28,17 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
28
28
|
|
|
29
29
|
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; }
|
|
30
30
|
|
|
31
|
-
const notOpenedShadowStyle = isSelected => theme =>
|
|
31
|
+
const notOpenedShadowStyle = isSelected => theme => `
|
|
32
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : 'transparent'};
|
|
33
|
+
|
|
34
|
+
:hover {
|
|
35
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : theme.colors.brand[300]};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:active {
|
|
39
|
+
box-shadow: inset 4px 0 0 0 ${theme.colors.brand[400]};
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
32
42
|
|
|
33
43
|
const ItemLink = props => {
|
|
34
44
|
const {
|
|
@@ -55,7 +65,7 @@ const ItemLink = props => {
|
|
|
55
65
|
} = props;
|
|
56
66
|
const labelOverflow = itemLabelOverflow || leftNavLabelOverflow;
|
|
57
67
|
const isSelected = selectedItem === dsId || selectedParent === dsId;
|
|
58
|
-
const shadowStyle = React.useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected)(theme) :
|
|
68
|
+
const shadowStyle = React.useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected)(theme) : `box-shadow: inset 4px 0 0 0 #52A6EC`, [isSelected, openedItem]);
|
|
59
69
|
return /*#__PURE__*/_jsx__default["default"](index.ItemRenderer, {
|
|
60
70
|
item: _objectSpread(_objectSpread({}, item), {}, {
|
|
61
71
|
itemOpts: _objectSpread(_objectSpread({
|
|
@@ -29,11 +29,19 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
29
29
|
|
|
30
30
|
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; }
|
|
31
31
|
|
|
32
|
-
const notOpenedShadowStyle = isSelected => theme =>
|
|
32
|
+
const notOpenedShadowStyle = isSelected => theme => `
|
|
33
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : 'transparent'};
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
:hover {
|
|
36
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : theme.colors.brand[300]};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:active {
|
|
40
|
+
box-shadow: inset 4px 0 0 0 ${theme.colors.brand[400]};
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
36
43
|
|
|
44
|
+
const ItemSubmenu = props => {
|
|
37
45
|
const {
|
|
38
46
|
item,
|
|
39
47
|
item: {
|
|
@@ -63,8 +71,8 @@ const ItemSubmenu = props => {
|
|
|
63
71
|
const labelOverflow = itemLabelOverflow || leftNavLabelOverflow;
|
|
64
72
|
const opened = openedItem === dsId;
|
|
65
73
|
const isSelected = selectedItem === dsId;
|
|
66
|
-
const shadowStyle = React.useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected || selectedParent === dsId)(theme) :
|
|
67
|
-
const ariaLabel =
|
|
74
|
+
const shadowStyle = React.useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected || selectedParent === dsId)(theme) : `box-shadow: inset 4px 0 0 0 #52A6EC`, [dsId, isSelected, openedItem, selectedParent]);
|
|
75
|
+
const ariaLabel = item.itemOpts.ariaLabel ?? (typeof label === 'string' ? label : 'menuitem');
|
|
68
76
|
return /*#__PURE__*/_jsx__default["default"](index.ItemRenderer, {
|
|
69
77
|
item: _objectSpread(_objectSpread({}, item), {}, {
|
|
70
78
|
itemOpts: _objectSpread(_objectSpread({}, item.itemOpts), {}, {
|
|
@@ -97,7 +105,7 @@ const ItemSubmenu = props => {
|
|
|
97
105
|
setFocusedItem(constants.CHEVRON_BACK_DS_ID);
|
|
98
106
|
},
|
|
99
107
|
role: "button",
|
|
100
|
-
"aria-label":
|
|
108
|
+
"aria-label": `Close ${ariaLabel}`
|
|
101
109
|
}), /*#__PURE__*/_jsx__default["default"](CollapsedComponent, {
|
|
102
110
|
item: item,
|
|
103
111
|
ctx: ctx
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
7
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
9
8
|
require('core-js/modules/esnext.iterator.map.js');
|
|
10
9
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
@@ -52,10 +51,8 @@ const OutOfTheBoxMapSubitem = props => {
|
|
|
52
51
|
} = props;
|
|
53
52
|
|
|
54
53
|
if (typeof type === 'string' && !!outOfTheBoxSubitemsComponents[type]) {
|
|
55
|
-
var _item$itemOpts$indent, _item$itemOpts;
|
|
56
|
-
|
|
57
54
|
const OutOfTheBoxComponent = outOfTheBoxSubitemsComponents[type];
|
|
58
|
-
const currentIndent =
|
|
55
|
+
const currentIndent = item.itemOpts?.indent ?? 0;
|
|
59
56
|
|
|
60
57
|
const newItem = _objectSpread(_objectSpread({}, item), {}, {
|
|
61
58
|
itemOpts: _objectSpread(_objectSpread({}, item.itemOpts), {}, {
|
|
@@ -16,10 +16,18 @@ const getLeftShadowStyles = _ref => {
|
|
|
16
16
|
} = _ref;
|
|
17
17
|
|
|
18
18
|
if (!selected && !selectedParent) {
|
|
19
|
-
return
|
|
19
|
+
return `
|
|
20
|
+
box-shadow: inset 4px 0 0 0 transparent;
|
|
21
|
+
:hover {
|
|
22
|
+
box-shadow: inset 4px 0 0 0 ${theme.colors.brand[300]};
|
|
23
|
+
}
|
|
24
|
+
:active {
|
|
25
|
+
box-shadow: inset 4px 0 0 0 ${theme.colors.brand[400]};
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
|
-
return
|
|
30
|
+
return `box-shadow: inset 4px 0 0 0 ${theme.colors.brand[400]};`;
|
|
23
31
|
};
|
|
24
32
|
|
|
25
33
|
const StyledLeftNavExpandAnimationWrapper = /*#__PURE__*/styled__default["default"].nav.withConfig({
|
|
@@ -27,7 +35,7 @@ const StyledLeftNavExpandAnimationWrapper = /*#__PURE__*/styled__default["defaul
|
|
|
27
35
|
})(["width:", ";transition:width ", " 350ms;box-shadow:-1px 0 0 0 ", ";border:1px solid ", ";overflow:hidden;height:100%;position:relative;"], props => props.expanded ? props.expandedWidth : '48px', props => props.expanded ? 'ease-out' : 'ease-in', props => props.theme.colors.neutral[100], props => props.theme.colors.neutral[100]);
|
|
28
36
|
const StyledLeftNavAreasContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
29
37
|
componentId: "sc-1hvvtkb-1"
|
|
30
|
-
})(["position:absolute;width:", ";height:100%;display:grid;grid-template-columns:1fr;grid-template-rows:auto 1fr auto;grid-template-areas:'left-nav-header' 'left-nav-body' 'left-nav-footer';"], props => props.expanded ?
|
|
38
|
+
})(["position:absolute;width:", ";height:100%;display:grid;grid-template-columns:1fr;grid-template-rows:auto 1fr auto;grid-template-areas:'left-nav-header' 'left-nav-body' 'left-nav-footer';"], props => props.expanded ? `calc(${props.expandedWidth} - 2px)` : '46px');
|
|
31
39
|
const StyledLeftNavHeaderArea = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
32
40
|
componentId: "sc-1hvvtkb-2"
|
|
33
41
|
})(["grid-area:left-nav-header;", ""], getLeftShadowStyles);
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
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');
|
|
13
12
|
var React = require('react');
|
|
14
13
|
require('overlayscrollbars/css/OverlayScrollbars.css');
|
|
15
14
|
var OverlayScrollbars = require('overlayscrollbars');
|
|
@@ -64,7 +64,7 @@ const LeftNavFooterItem = props => {
|
|
|
64
64
|
onFocus: () => setFocusedItem(id),
|
|
65
65
|
"data-testid": "leftnav-item-container",
|
|
66
66
|
role: "menuitem",
|
|
67
|
-
"aria-label": expandedForAnimation ?
|
|
67
|
+
"aria-label": expandedForAnimation ? `Footer, ${footerLabel}` : `Expand left navigation`,
|
|
68
68
|
children: !expandedForAnimation ? /*#__PURE__*/_jsx__default["default"](dsIcons.MenuExpand, {
|
|
69
69
|
size: "m",
|
|
70
70
|
color: ['brand-primary', 800],
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
const commonItemBackgroundStyle = (color, hoverColor, activeColor) =>
|
|
1
|
+
const commonItemBackgroundStyle = (color, hoverColor, activeColor) => `
|
|
2
|
+
|
|
3
|
+
background: ${color};
|
|
4
|
+
|
|
5
|
+
:hover {
|
|
6
|
+
background: ${hoverColor};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:active {
|
|
10
|
+
background: ${activeColor};
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
2
13
|
|
|
3
14
|
const getItemBackgroundStyle = props => {
|
|
4
15
|
if (props.selected && !props.opened) return commonItemBackgroundStyle(props.theme.colors.brand[200], props.theme.colors.brand[200], props.theme.colors.brand[200]);
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
const commonLeftBorderStyle = (color, hoverColor, activeColor) =>
|
|
1
|
+
const commonLeftBorderStyle = (color, hoverColor, activeColor) => `
|
|
2
|
+
|
|
3
|
+
-webkit-box-shadow: inset 4px 0 0 0 ${color};
|
|
4
|
+
box-shadow: inset 4px 0 0 0 ${color};
|
|
5
|
+
|
|
6
|
+
:hover {
|
|
7
|
+
-webkit-box-shadow: inset 4px 0 0 0 ${hoverColor};
|
|
8
|
+
box-shadow: inset 4px 0 0 0 ${hoverColor};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:active {
|
|
12
|
+
-webkit-box-shadow: inset 4px 0 0 0 ${activeColor};
|
|
13
|
+
box-shadow: inset 4px 0 0 0 ${activeColor};
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
2
16
|
|
|
3
17
|
const getLeftBorderStyle = props => {
|
|
4
18
|
if (props.selected || props.selectedParent) return commonLeftBorderStyle(props.theme.colors.brand[400], props.theme.colors.brand[400], props.theme.colors.brand[400]);
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
const getScrolbarStyle = () =>
|
|
1
|
+
const getScrolbarStyle = () => `
|
|
2
|
+
::-webkit-scrollbar {
|
|
3
|
+
width: 14px;
|
|
4
|
+
}
|
|
5
|
+
::-webkit-scrollbar-thumb {
|
|
6
|
+
height: 6px;
|
|
7
|
+
border: 4px solid rgba(0, 0, 0, 0);
|
|
8
|
+
|
|
9
|
+
background-clip: padding-box;
|
|
10
|
+
|
|
11
|
+
background-color: rgba(105, 116, 137, 0.5);
|
|
12
|
+
|
|
13
|
+
border-radius: 7px;
|
|
14
|
+
-webkit-border-radius: 7px;
|
|
15
|
+
}
|
|
16
|
+
::-webkit-scrollbar-button {
|
|
17
|
+
width: 0;
|
|
18
|
+
height: 0;
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
::-webkit-scrollbar-corner {
|
|
22
|
+
background-color: transparent;
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
2
25
|
|
|
3
26
|
export { getScrolbarStyle };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
3
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
4
|
import { useMemo, useRef, createRef } from 'react';
|
|
6
5
|
import { ITEM_TYPES, FOOTER_DS_ID } from '../exported-related/constants.js';
|
|
7
6
|
import '@babel/runtime/helpers/esm/jsx';
|
|
@@ -19,21 +18,17 @@ const notFocuseableItems = [ITEM_TYPES.LEFT_NAV_ITEM_SEPARATOR, ITEM_TYPES.LEFT_
|
|
|
19
18
|
const walkItems = (items, openedDrilldowns, callback) => {
|
|
20
19
|
items.forEach(item => {
|
|
21
20
|
if (typeof item.type === 'string') {
|
|
22
|
-
var _item$itemOpts$items, _item$itemOpts, _item$itemOpts2, _item$itemOpts$items2, _item$itemOpts3;
|
|
23
|
-
|
|
24
21
|
// Out of the box item
|
|
25
22
|
if (notFocuseableItems.includes(item.type)) return; // not focuseable
|
|
26
23
|
|
|
27
24
|
callback(item.dsId); // If it's an opened uncontrolled drilldown
|
|
28
25
|
|
|
29
|
-
if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN && openedDrilldowns.includes(item.dsId)) walkItems(
|
|
26
|
+
if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN && openedDrilldowns.includes(item.dsId)) walkItems(item.itemOpts?.items ?? [], openedDrilldowns, callback); // If it's an opened controlled drilldown
|
|
30
27
|
|
|
31
|
-
if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN &&
|
|
28
|
+
if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN && item.itemOpts?.isOpened) walkItems(item.itemOpts?.items ?? [], openedDrilldowns, callback);
|
|
32
29
|
} else {
|
|
33
|
-
var _item$itemOpts4;
|
|
34
|
-
|
|
35
30
|
// Custom item
|
|
36
|
-
if (!
|
|
31
|
+
if (!item.itemOpts?.focuseable) return; // not focuseable specified
|
|
37
32
|
|
|
38
33
|
callback(item.dsId);
|
|
39
34
|
}
|
|
@@ -75,7 +75,7 @@ const ItemRenderer = props => {
|
|
|
75
75
|
}, void 0, /*#__PURE__*/jsx(StyledItem, {
|
|
76
76
|
ref: visibleItemsRefs.current[dsId],
|
|
77
77
|
pt: paddingTop,
|
|
78
|
-
pl: indent === undefined ? 'xxxs' :
|
|
78
|
+
pl: indent === undefined ? 'xxxs' : `${indent}px`,
|
|
79
79
|
minHeight: minHeight,
|
|
80
80
|
shadowStyle: shadowStyle(opened, item.type),
|
|
81
81
|
alignItems: "flex-start",
|
|
@@ -109,7 +109,7 @@ const ItemRenderer = props => {
|
|
|
109
109
|
marginLeft: opened ? '16px' : '0px',
|
|
110
110
|
marginRight: borderBottomMr,
|
|
111
111
|
height: '1px',
|
|
112
|
-
width:
|
|
112
|
+
width: `calc(100% - ${borderBottomMr} - ${opened ? '16px' : '0px'})`,
|
|
113
113
|
backgroundColor: '#E0E3E8'
|
|
114
114
|
}
|
|
115
115
|
})), subitems]
|
|
@@ -4,7 +4,16 @@ import styled from 'styled-components';
|
|
|
4
4
|
/* eslint-disable indent */
|
|
5
5
|
const borderOutside = function (color) {
|
|
6
6
|
let weight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
7
|
-
return
|
|
7
|
+
return `&:before {
|
|
8
|
+
content: '';
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
right: 0;
|
|
13
|
+
bottom: 0;
|
|
14
|
+
border: ${weight}px solid ${color};
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
}`;
|
|
8
17
|
};
|
|
9
18
|
const StyledItemWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
10
19
|
componentId: "sc-11wzgfh-0"
|
|
@@ -42,6 +51,8 @@ const StyledItem = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
42
51
|
theme
|
|
43
52
|
} = _ref3;
|
|
44
53
|
return selectable ? theme.colors.brand[200] : 'white';
|
|
45
|
-
}, props => props.shadowStyle(props.theme), props => props.tabIndex !== -1 ?
|
|
54
|
+
}, props => props.shadowStyle(props.theme), props => props.tabIndex !== -1 ? `:focus {
|
|
55
|
+
${borderOutside(props.theme.colors.brand[700])}
|
|
56
|
+
}` : '');
|
|
46
57
|
|
|
47
58
|
export { StyledItem, StyledItemWrapper, borderOutside };
|
|
@@ -36,7 +36,7 @@ const usePropsWithDefaults = props => {
|
|
|
36
36
|
minHeight: '48px',
|
|
37
37
|
paddingTop: '12px',
|
|
38
38
|
subitems: [],
|
|
39
|
-
shadowStyle: (opened, type) => theme =>
|
|
39
|
+
shadowStyle: (opened, type) => theme => `box-shadow: ${opened || !itemWithoutShadows.includes(type) ? 'inset 4px 0 0 0 #52A6EC' : 'inset 4px 0 0 0 white'}`,
|
|
40
40
|
hasBorderBottom: false,
|
|
41
41
|
borderBottomMr: '0px'
|
|
42
42
|
}, props), {}, {
|
|
@@ -47,9 +47,7 @@ const useKeyboardNavigation = _ref => {
|
|
|
47
47
|
setSelectedItem(nextDsId);
|
|
48
48
|
}, [setFocusedItem, setSelectedItem]);
|
|
49
49
|
useLayoutEffect(() => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (dsId === focusedItem) (_visibleItemsRefs$cur = visibleItemsRefs.current[dsId]) === null || _visibleItemsRefs$cur === void 0 ? void 0 : (_visibleItemsRefs$cur2 = _visibleItemsRefs$cur.current) === null || _visibleItemsRefs$cur2 === void 0 ? void 0 : _visibleItemsRefs$cur2.focus();
|
|
50
|
+
if (dsId === focusedItem) visibleItemsRefs.current[dsId]?.current?.focus();
|
|
53
51
|
}, [dsId, focusedItem, visibleItemsRefs]);
|
|
54
52
|
const onKeyDown = useCallback(e => {
|
|
55
53
|
const {
|
|
@@ -13,20 +13,14 @@ const isSelectableOutOfTheBox = elem => typeof elem.type === 'string' && elem.ty
|
|
|
13
13
|
|
|
14
14
|
const isSelectableCustom = elem => elem.itemOpts.selectable;
|
|
15
15
|
|
|
16
|
-
const isItemInsideTheTree = (item, itemID) =>
|
|
17
|
-
var _item$itemOpts, _item$itemOpts$items;
|
|
18
|
-
|
|
19
|
-
return item.dsId === itemID || !!(item !== null && item !== void 0 && (_item$itemOpts = item.itemOpts) !== null && _item$itemOpts !== void 0 && (_item$itemOpts$items = _item$itemOpts.items) !== null && _item$itemOpts$items !== void 0 && _item$itemOpts$items.some(it => isItemInsideTheTree(it, itemID)));
|
|
20
|
-
};
|
|
16
|
+
const isItemInsideTheTree = (item, itemID) => item.dsId === itemID || !!item?.itemOpts?.items?.some(it => isItemInsideTheTree(it, itemID));
|
|
21
17
|
|
|
22
18
|
const useSelectFirstBodyItem = (items, openedItem, selectedItem, setSelectedItem, disableDefaultSelection) => {
|
|
23
19
|
useEffect(() => {
|
|
24
20
|
if (!disableDefaultSelection && items && items.length && openedItem) {
|
|
25
|
-
var _items$index$dsId;
|
|
26
|
-
|
|
27
21
|
const index = items.findIndex(elem => isSelectableOutOfTheBox(elem) || isSelectableCustom(elem));
|
|
28
22
|
const isItemInside = items.some(it => isItemInsideTheTree(it, selectedItem));
|
|
29
|
-
if (isItemInside) setSelectedItem(selectedItem);else if (index !== -1) setSelectedItem(
|
|
23
|
+
if (isItemInside) setSelectedItem(selectedItem);else if (index !== -1) setSelectedItem(items[index].dsId ?? '');
|
|
30
24
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
25
|
|
|
32
26
|
}, [openedItem, setSelectedItem, disableDefaultSelection]);
|
|
@@ -40,10 +40,8 @@ const OutOfTheBoxMapSubitem = props => {
|
|
|
40
40
|
} = props;
|
|
41
41
|
|
|
42
42
|
if (typeof type === 'string' && !!outOfTheBoxSubitemsComponents[type]) {
|
|
43
|
-
var _item$itemOpts$indent, _item$itemOpts;
|
|
44
|
-
|
|
45
43
|
const OutOfTheBoxComponent = outOfTheBoxSubitemsComponents[type];
|
|
46
|
-
const currentIndent =
|
|
44
|
+
const currentIndent = item.itemOpts?.indent ?? 0;
|
|
47
45
|
|
|
48
46
|
const newItem = _objectSpread(_objectSpread({}, item), {}, {
|
|
49
47
|
itemOpts: _objectSpread(_objectSpread({}, item.itemOpts), {}, {
|
|
@@ -19,11 +19,19 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
19
19
|
|
|
20
20
|
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(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; }
|
|
21
21
|
|
|
22
|
-
const notOpenedShadowStyle = isSelected => theme =>
|
|
22
|
+
const notOpenedShadowStyle = isSelected => theme => `
|
|
23
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : 'transparent'};
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
:hover {
|
|
26
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : theme.colors.brand[300]};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:active {
|
|
30
|
+
box-shadow: inset 4px 0 0 0 ${theme.colors.brand[400]};
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
26
33
|
|
|
34
|
+
const ItemHeader = props => {
|
|
27
35
|
const {
|
|
28
36
|
item,
|
|
29
37
|
item: {
|
|
@@ -52,9 +60,9 @@ const ItemHeader = props => {
|
|
|
52
60
|
} = props;
|
|
53
61
|
const labelOverflow = itemLabelOverflow || leftNavLabelOverflow;
|
|
54
62
|
const opened = openedItem === dsId;
|
|
55
|
-
const ariaLabel =
|
|
63
|
+
const ariaLabel = item.itemOpts.ariaLabel ?? (typeof label === 'string' ? label : 'menuitem');
|
|
56
64
|
const isSelected = selectedItem === dsId || selectedParent === dsId;
|
|
57
|
-
const shadowStyle = useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected)(theme) :
|
|
65
|
+
const shadowStyle = useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected)(theme) : `box-shadow: inset 4px 0 0 0 #52A6EC`, [isSelected, openedItem]);
|
|
58
66
|
return /*#__PURE__*/_jsx(ItemRenderer, {
|
|
59
67
|
item: _objectSpread(_objectSpread({}, item), {}, {
|
|
60
68
|
itemOpts: _objectSpread(_objectSpread({
|
|
@@ -88,7 +96,7 @@ const ItemHeader = props => {
|
|
|
88
96
|
setFocusedItem(CHEVRON_BACK_DS_ID);
|
|
89
97
|
},
|
|
90
98
|
role: "button",
|
|
91
|
-
"aria-label":
|
|
99
|
+
"aria-label": `Close ${ariaLabel}`
|
|
92
100
|
}), /*#__PURE__*/_jsx(CollapsedComponent, {
|
|
93
101
|
item: item,
|
|
94
102
|
ctx: ctx
|
|
@@ -18,7 +18,17 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
18
18
|
|
|
19
19
|
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(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; }
|
|
20
20
|
|
|
21
|
-
const notOpenedShadowStyle = isSelected => theme =>
|
|
21
|
+
const notOpenedShadowStyle = isSelected => theme => `
|
|
22
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : 'transparent'};
|
|
23
|
+
|
|
24
|
+
:hover {
|
|
25
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : theme.colors.brand[300]};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:active {
|
|
29
|
+
box-shadow: inset 4px 0 0 0 ${theme.colors.brand[400]};
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
22
32
|
|
|
23
33
|
const ItemLink = props => {
|
|
24
34
|
const {
|
|
@@ -45,7 +55,7 @@ const ItemLink = props => {
|
|
|
45
55
|
} = props;
|
|
46
56
|
const labelOverflow = itemLabelOverflow || leftNavLabelOverflow;
|
|
47
57
|
const isSelected = selectedItem === dsId || selectedParent === dsId;
|
|
48
|
-
const shadowStyle = useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected)(theme) :
|
|
58
|
+
const shadowStyle = useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected)(theme) : `box-shadow: inset 4px 0 0 0 #52A6EC`, [isSelected, openedItem]);
|
|
49
59
|
return /*#__PURE__*/_jsx(ItemRenderer, {
|
|
50
60
|
item: _objectSpread(_objectSpread({}, item), {}, {
|
|
51
61
|
itemOpts: _objectSpread(_objectSpread({
|
|
@@ -19,11 +19,19 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
19
19
|
|
|
20
20
|
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(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; }
|
|
21
21
|
|
|
22
|
-
const notOpenedShadowStyle = isSelected => theme =>
|
|
22
|
+
const notOpenedShadowStyle = isSelected => theme => `
|
|
23
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : 'transparent'};
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
:hover {
|
|
26
|
+
box-shadow: inset 4px 0 0 0 ${isSelected ? theme.colors.brand[400] : theme.colors.brand[300]};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:active {
|
|
30
|
+
box-shadow: inset 4px 0 0 0 ${theme.colors.brand[400]};
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
26
33
|
|
|
34
|
+
const ItemSubmenu = props => {
|
|
27
35
|
const {
|
|
28
36
|
item,
|
|
29
37
|
item: {
|
|
@@ -53,8 +61,8 @@ const ItemSubmenu = props => {
|
|
|
53
61
|
const labelOverflow = itemLabelOverflow || leftNavLabelOverflow;
|
|
54
62
|
const opened = openedItem === dsId;
|
|
55
63
|
const isSelected = selectedItem === dsId;
|
|
56
|
-
const shadowStyle = useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected || selectedParent === dsId)(theme) :
|
|
57
|
-
const ariaLabel =
|
|
64
|
+
const shadowStyle = useCallback(opened => theme => !opened ? notOpenedShadowStyle(isSelected || selectedParent === dsId)(theme) : `box-shadow: inset 4px 0 0 0 #52A6EC`, [dsId, isSelected, openedItem, selectedParent]);
|
|
65
|
+
const ariaLabel = item.itemOpts.ariaLabel ?? (typeof label === 'string' ? label : 'menuitem');
|
|
58
66
|
return /*#__PURE__*/_jsx(ItemRenderer, {
|
|
59
67
|
item: _objectSpread(_objectSpread({}, item), {}, {
|
|
60
68
|
itemOpts: _objectSpread(_objectSpread({}, item.itemOpts), {}, {
|
|
@@ -87,7 +95,7 @@ const ItemSubmenu = props => {
|
|
|
87
95
|
setFocusedItem(CHEVRON_BACK_DS_ID);
|
|
88
96
|
},
|
|
89
97
|
role: "button",
|
|
90
|
-
"aria-label":
|
|
98
|
+
"aria-label": `Close ${ariaLabel}`
|
|
91
99
|
}), /*#__PURE__*/_jsx(CollapsedComponent, {
|
|
92
100
|
item: item,
|
|
93
101
|
ctx: ctx
|
|
@@ -2,7 +2,6 @@ import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
|
2
2
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
3
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
4
4
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
5
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
6
5
|
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
7
6
|
import 'core-js/modules/esnext.iterator.map.js';
|
|
8
7
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
@@ -42,10 +41,8 @@ const OutOfTheBoxMapSubitem = props => {
|
|
|
42
41
|
} = props;
|
|
43
42
|
|
|
44
43
|
if (typeof type === 'string' && !!outOfTheBoxSubitemsComponents[type]) {
|
|
45
|
-
var _item$itemOpts$indent, _item$itemOpts;
|
|
46
|
-
|
|
47
44
|
const OutOfTheBoxComponent = outOfTheBoxSubitemsComponents[type];
|
|
48
|
-
const currentIndent =
|
|
45
|
+
const currentIndent = item.itemOpts?.indent ?? 0;
|
|
49
46
|
|
|
50
47
|
const newItem = _objectSpread(_objectSpread({}, item), {}, {
|
|
51
48
|
itemOpts: _objectSpread(_objectSpread({}, item.itemOpts), {}, {
|
|
@@ -8,10 +8,18 @@ const getLeftShadowStyles = _ref => {
|
|
|
8
8
|
} = _ref;
|
|
9
9
|
|
|
10
10
|
if (!selected && !selectedParent) {
|
|
11
|
-
return
|
|
11
|
+
return `
|
|
12
|
+
box-shadow: inset 4px 0 0 0 transparent;
|
|
13
|
+
:hover {
|
|
14
|
+
box-shadow: inset 4px 0 0 0 ${theme.colors.brand[300]};
|
|
15
|
+
}
|
|
16
|
+
:active {
|
|
17
|
+
box-shadow: inset 4px 0 0 0 ${theme.colors.brand[400]};
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
12
20
|
}
|
|
13
21
|
|
|
14
|
-
return
|
|
22
|
+
return `box-shadow: inset 4px 0 0 0 ${theme.colors.brand[400]};`;
|
|
15
23
|
};
|
|
16
24
|
|
|
17
25
|
const StyledLeftNavExpandAnimationWrapper = /*#__PURE__*/styled.nav.withConfig({
|
|
@@ -19,7 +27,7 @@ const StyledLeftNavExpandAnimationWrapper = /*#__PURE__*/styled.nav.withConfig({
|
|
|
19
27
|
})(["width:", ";transition:width ", " 350ms;box-shadow:-1px 0 0 0 ", ";border:1px solid ", ";overflow:hidden;height:100%;position:relative;"], props => props.expanded ? props.expandedWidth : '48px', props => props.expanded ? 'ease-out' : 'ease-in', props => props.theme.colors.neutral[100], props => props.theme.colors.neutral[100]);
|
|
20
28
|
const StyledLeftNavAreasContainer = /*#__PURE__*/styled.div.withConfig({
|
|
21
29
|
componentId: "sc-1hvvtkb-1"
|
|
22
|
-
})(["position:absolute;width:", ";height:100%;display:grid;grid-template-columns:1fr;grid-template-rows:auto 1fr auto;grid-template-areas:'left-nav-header' 'left-nav-body' 'left-nav-footer';"], props => props.expanded ?
|
|
30
|
+
})(["position:absolute;width:", ";height:100%;display:grid;grid-template-columns:1fr;grid-template-rows:auto 1fr auto;grid-template-areas:'left-nav-header' 'left-nav-body' 'left-nav-footer';"], props => props.expanded ? `calc(${props.expandedWidth} - 2px)` : '46px');
|
|
23
31
|
const StyledLeftNavHeaderArea = /*#__PURE__*/styled.div.withConfig({
|
|
24
32
|
componentId: "sc-1hvvtkb-2"
|
|
25
33
|
})(["grid-area:left-nav-header;", ""], getLeftShadowStyles);
|
|
@@ -5,7 +5,6 @@ import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
|
5
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
8
|
import { useState, useRef, useEffect } from 'react';
|
|
10
9
|
import 'overlayscrollbars/css/OverlayScrollbars.css';
|
|
11
10
|
import OverlayScrollbars from 'overlayscrollbars';
|
|
@@ -55,7 +55,7 @@ const LeftNavFooterItem = props => {
|
|
|
55
55
|
onFocus: () => setFocusedItem(id),
|
|
56
56
|
"data-testid": "leftnav-item-container",
|
|
57
57
|
role: "menuitem",
|
|
58
|
-
"aria-label": expandedForAnimation ?
|
|
58
|
+
"aria-label": expandedForAnimation ? `Footer, ${footerLabel}` : `Expand left navigation`,
|
|
59
59
|
children: !expandedForAnimation ? /*#__PURE__*/_jsx(MenuExpand, {
|
|
60
60
|
size: "m",
|
|
61
61
|
color: ['brand-primary', 800],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-left-navigation",
|
|
3
|
-
"version": "2.4.2-rc.
|
|
3
|
+
"version": "2.4.2-rc.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Left Navigation",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -233,11 +233,11 @@
|
|
|
233
233
|
"generateSubmodules": true
|
|
234
234
|
},
|
|
235
235
|
"dependencies": {
|
|
236
|
-
"@elliemae/ds-circular-progress-indicator": "2.4.2-rc.
|
|
237
|
-
"@elliemae/ds-grid": "2.4.2-rc.
|
|
238
|
-
"@elliemae/ds-icons": "2.4.2-rc.
|
|
239
|
-
"@elliemae/ds-system": "2.4.2-rc.
|
|
240
|
-
"@elliemae/ds-truncated-tooltip-text": "2.4.2-rc.
|
|
236
|
+
"@elliemae/ds-circular-progress-indicator": "2.4.2-rc.15",
|
|
237
|
+
"@elliemae/ds-grid": "2.4.2-rc.15",
|
|
238
|
+
"@elliemae/ds-icons": "2.4.2-rc.15",
|
|
239
|
+
"@elliemae/ds-system": "2.4.2-rc.15",
|
|
240
|
+
"@elliemae/ds-truncated-tooltip-text": "2.4.2-rc.15",
|
|
241
241
|
"overlayscrollbars": "1.13.1",
|
|
242
242
|
"prop-types": "~15.7.2",
|
|
243
243
|
"react-desc": "~4.1.3"
|