@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,53 +1,75 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
+
import { useMemo, useRef, createRef } from 'react';
|
|
6
|
+
import { ITEM_TYPES, FOOTER_DS_ID } from '../exported-related/constants.js';
|
|
7
|
+
import '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import '@elliemae/ds-grid';
|
|
9
|
+
import 'styled-components';
|
|
10
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
11
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
12
|
+
import '@babel/runtime/helpers/esm/defineProperty';
|
|
13
|
+
import 'react/jsx-runtime';
|
|
14
|
+
import '@elliemae/ds-icons';
|
|
15
|
+
|
|
16
|
+
const notFocuseableItems = [ITEM_TYPES.LEFT_NAV_ITEM_SEPARATOR, ITEM_TYPES.LEFT_NAV_ITEM_SECTION]; // Walks the array of items
|
|
17
|
+
// Drilldowns are tree-like structures
|
|
18
|
+
|
|
6
19
|
const walkItems = (items, openedDrilldowns, callback) => {
|
|
7
|
-
items.forEach(
|
|
8
|
-
if (typeof item.type ===
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (item.type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
items.forEach(item => {
|
|
21
|
+
if (typeof item.type === 'string') {
|
|
22
|
+
var _item$itemOpts$items, _item$itemOpts, _item$itemOpts2, _item$itemOpts$items2, _item$itemOpts3;
|
|
23
|
+
|
|
24
|
+
// Out of the box item
|
|
25
|
+
if (notFocuseableItems.includes(item.type)) return; // not focuseable
|
|
26
|
+
|
|
27
|
+
callback(item.dsId); // If it's an opened uncontrolled drilldown
|
|
28
|
+
|
|
29
|
+
if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN && openedDrilldowns.includes(item.dsId)) walkItems((_item$itemOpts$items = (_item$itemOpts = item.itemOpts) === null || _item$itemOpts === void 0 ? void 0 : _item$itemOpts.items) !== null && _item$itemOpts$items !== void 0 ? _item$itemOpts$items : [], openedDrilldowns, callback); // If it's an opened controlled drilldown
|
|
30
|
+
|
|
31
|
+
if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN && (_item$itemOpts2 = item.itemOpts) !== null && _item$itemOpts2 !== void 0 && _item$itemOpts2.isOpened) walkItems((_item$itemOpts$items2 = (_item$itemOpts3 = item.itemOpts) === null || _item$itemOpts3 === void 0 ? void 0 : _item$itemOpts3.items) !== null && _item$itemOpts$items2 !== void 0 ? _item$itemOpts$items2 : [], openedDrilldowns, callback);
|
|
16
32
|
} else {
|
|
17
|
-
|
|
18
|
-
|
|
33
|
+
var _item$itemOpts4;
|
|
34
|
+
|
|
35
|
+
// Custom item
|
|
36
|
+
if (!((_item$itemOpts4 = item.itemOpts) !== null && _item$itemOpts4 !== void 0 && _item$itemOpts4.focuseable)) return; // not focuseable specified
|
|
37
|
+
|
|
19
38
|
callback(item.dsId);
|
|
20
39
|
}
|
|
21
40
|
});
|
|
22
41
|
};
|
|
23
|
-
|
|
24
|
-
|
|
42
|
+
|
|
43
|
+
const useLeftNavItems = props => {
|
|
44
|
+
const {
|
|
45
|
+
headerItem,
|
|
46
|
+
bodyHeaderItem,
|
|
47
|
+
items: bodyItems,
|
|
48
|
+
openedDrilldowns
|
|
49
|
+
} = props; // Place the header and body header items into the array of items
|
|
50
|
+
|
|
25
51
|
const items = useMemo(() => {
|
|
26
52
|
const itemsArray = [...bodyItems];
|
|
27
|
-
if (bodyHeaderItem)
|
|
28
|
-
|
|
29
|
-
if (headerItem)
|
|
30
|
-
itemsArray.unshift(headerItem);
|
|
53
|
+
if (bodyHeaderItem) itemsArray.unshift(bodyHeaderItem);
|
|
54
|
+
if (headerItem) itemsArray.unshift(headerItem);
|
|
31
55
|
return itemsArray;
|
|
32
56
|
}, [headerItem, bodyHeaderItem, bodyItems]);
|
|
33
57
|
const visibleItemsRefs = useRef({});
|
|
34
58
|
const visibleItems = useMemo(() => {
|
|
35
59
|
const visibleItemsArray = [];
|
|
36
|
-
walkItems(items, openedDrilldowns,
|
|
60
|
+
walkItems(items, openedDrilldowns, dsId => {
|
|
37
61
|
visibleItemsArray.push(dsId);
|
|
38
62
|
});
|
|
39
63
|
visibleItemsArray.push(FOOTER_DS_ID);
|
|
40
64
|
return visibleItemsArray;
|
|
41
65
|
}, [items, openedDrilldowns]);
|
|
42
|
-
visibleItems.forEach(
|
|
43
|
-
if (!(dsId in visibleItemsRefs.current))
|
|
44
|
-
visibleItemsRefs.current[dsId] = createRef();
|
|
66
|
+
visibleItems.forEach(dsId => {
|
|
67
|
+
if (!(dsId in visibleItemsRefs.current)) visibleItemsRefs.current[dsId] = /*#__PURE__*/createRef();
|
|
45
68
|
});
|
|
46
|
-
return {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
useLeftNavItems_default as default,
|
|
51
|
-
useLeftNavItems
|
|
69
|
+
return {
|
|
70
|
+
visibleItems,
|
|
71
|
+
visibleItemsRefs
|
|
72
|
+
};
|
|
52
73
|
};
|
|
53
|
-
|
|
74
|
+
|
|
75
|
+
export { useLeftNavItems as default, useLeftNavItems };
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
3
|
const useLeftNavSmoothExpand = (props, smoothExpandOpts) => {
|
|
4
|
-
const {
|
|
4
|
+
const {
|
|
5
|
+
expanded
|
|
6
|
+
} = props;
|
|
5
7
|
const {
|
|
6
8
|
expandedForAnimation,
|
|
7
9
|
timeoutRef,
|
|
8
10
|
setExpandedForAnimation
|
|
9
11
|
} = smoothExpandOpts;
|
|
10
|
-
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
// If expanded changes, we need to smoothly transition to the non-expanded state
|
|
14
|
+
// so we need to wait for 350ms
|
|
11
15
|
if (!expanded && expandedForAnimation) {
|
|
12
|
-
clearTimeout(timeoutRef.current);
|
|
16
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
13
17
|
timeoutRef.current = setTimeout(() => setExpandedForAnimation(false), 350);
|
|
14
|
-
} else if (expanded)
|
|
15
|
-
|
|
18
|
+
} else if (expanded) setExpandedForAnimation(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
|
+
|
|
16
20
|
}, [expanded]);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export {
|
|
21
|
-
useLeftNavSmoothExpand_default as default,
|
|
22
|
-
useLeftNavSmoothExpand
|
|
21
|
+
React.useEffect(() => () => {
|
|
22
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
23
|
+
}, [timeoutRef]);
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
+
|
|
26
|
+
export { useLeftNavSmoothExpand as default, useLeftNavSmoothExpand };
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'react';
|
|
8
|
+
import { ChevronSmallRight } from '@elliemae/ds-icons';
|
|
9
|
+
import { jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
const ChevronItem = props => /*#__PURE__*/jsx(ChevronSmallRight, _objectSpread({
|
|
5
15
|
size: "m",
|
|
6
|
-
color: [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
ChevronItem,
|
|
12
|
-
ChevronItem_default as default
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
16
|
+
color: ['brand-primary', 800]
|
|
17
|
+
}, props));
|
|
18
|
+
|
|
19
|
+
export { ChevronItem, ChevronItem as default };
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'react';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
const AugmentedIcon = Icon => styled(Icon).withConfig({
|
|
16
|
+
componentId: "sc-1eek2uh-0"
|
|
17
|
+
})(["cursor:pointer;outline:0;:focus,:active{outline:1px solid #1e79c2;}"]);
|
|
18
|
+
|
|
19
|
+
const Icon = IconComponent => props => {
|
|
14
20
|
const StyledComponent = AugmentedIcon(IconComponent);
|
|
15
|
-
return
|
|
16
|
-
color: [
|
|
17
|
-
tabIndex: 0
|
|
18
|
-
|
|
19
|
-
});
|
|
21
|
+
return /*#__PURE__*/jsx(StyledComponent, _objectSpread({
|
|
22
|
+
color: ['brand-primary', 800],
|
|
23
|
+
tabIndex: 0
|
|
24
|
+
}, props));
|
|
20
25
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
26
|
+
|
|
27
|
+
export { Icon };
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import Grid from
|
|
4
|
-
import { StyledItemWrapper, StyledItem } from
|
|
5
|
-
import { LeftNavContext } from
|
|
6
|
-
import { usePropsWithDefaults } from
|
|
7
|
-
import { useKeyboardNavigation } from
|
|
8
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import { useContext, useCallback, useMemo } from 'react';
|
|
3
|
+
import Grid from '@elliemae/ds-grid';
|
|
4
|
+
import { StyledItemWrapper, StyledItem } from './styled.js';
|
|
5
|
+
import { LeftNavContext } from '../../LeftNavigationContext.js';
|
|
6
|
+
import { usePropsWithDefaults } from './usePropsWithDefaults.js';
|
|
7
|
+
import { useKeyboardNavigation } from '../../hooks/useKeyboardNavigation.js';
|
|
8
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
const ItemRenderer = props => {
|
|
9
11
|
const propsWithDefault = usePropsWithDefaults(props);
|
|
10
12
|
const {
|
|
11
13
|
item,
|
|
12
14
|
item: {
|
|
13
15
|
dsId,
|
|
14
|
-
itemOpts: {
|
|
16
|
+
itemOpts: {
|
|
17
|
+
selectable,
|
|
18
|
+
focuseable,
|
|
19
|
+
indent,
|
|
20
|
+
ariaLabel,
|
|
21
|
+
ariaRole,
|
|
22
|
+
ariaLive,
|
|
23
|
+
ariaExpanded,
|
|
24
|
+
ariaDescribedBy
|
|
25
|
+
},
|
|
15
26
|
CollapsedComponent
|
|
16
27
|
},
|
|
17
28
|
subitems,
|
|
@@ -25,7 +36,10 @@ const ItemRenderer = (props) => {
|
|
|
25
36
|
} = propsWithDefault;
|
|
26
37
|
const ctx = useContext(LeftNavContext);
|
|
27
38
|
const {
|
|
28
|
-
leftNavProps: {
|
|
39
|
+
leftNavProps: {
|
|
40
|
+
onItemClick,
|
|
41
|
+
openedItem
|
|
42
|
+
},
|
|
29
43
|
expandedForAnimation,
|
|
30
44
|
selectedParent,
|
|
31
45
|
selectedItem,
|
|
@@ -34,71 +48,72 @@ const ItemRenderer = (props) => {
|
|
|
34
48
|
visibleItemsRefs
|
|
35
49
|
} = ctx;
|
|
36
50
|
const opened = dsId === openedItem;
|
|
37
|
-
const handleOnClick = useCallback(
|
|
38
|
-
if (onClick)
|
|
39
|
-
|
|
51
|
+
const handleOnClick = useCallback(e => {
|
|
52
|
+
if (onClick) onClick(); // used by uncontrolled drilldowns
|
|
53
|
+
|
|
40
54
|
onItemClick(item, e);
|
|
41
|
-
if (selectable)
|
|
42
|
-
setSelectedItem(item.dsId);
|
|
55
|
+
if (selectable) setSelectedItem(item.dsId);
|
|
43
56
|
}, [onItemClick, item, setSelectedItem, selectable, onClick]);
|
|
44
57
|
const handleFocus = useCallback(() => {
|
|
45
|
-
if (focuseable)
|
|
46
|
-
setFocusedItem(dsId);
|
|
58
|
+
if (focuseable) setFocusedItem(dsId);
|
|
47
59
|
}, [dsId, setFocusedItem, focuseable]);
|
|
48
60
|
const onKeyDown = useKeyboardNavigation({
|
|
49
61
|
item,
|
|
50
62
|
onClick: handleOnClick
|
|
51
63
|
});
|
|
52
|
-
const cols = useMemo(() => expandedForAnimation ? [
|
|
64
|
+
const cols = useMemo(() => expandedForAnimation ? ['auto', '1fr', 'auto'] : ['38px'], [expandedForAnimation]);
|
|
53
65
|
const isSelected = useMemo(() => selectedItem === dsId, [selectedItem, dsId]);
|
|
66
|
+
|
|
54
67
|
if (!expandedForAnimation && !CollapsedComponent) {
|
|
55
68
|
return null;
|
|
56
69
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
70
|
+
|
|
71
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
72
|
+
children: [/*#__PURE__*/_jsx(StyledItemWrapper, {
|
|
73
|
+
shadowStyle: shadowStyle(opened, item.type),
|
|
74
|
+
"data-testid": "leftnav-item-wrapper"
|
|
75
|
+
}, void 0, /*#__PURE__*/jsx(StyledItem, {
|
|
76
|
+
ref: visibleItemsRefs.current[dsId],
|
|
77
|
+
pt: paddingTop,
|
|
78
|
+
pl: indent === undefined ? 'xxxs' : "".concat(indent, "px"),
|
|
79
|
+
minHeight: minHeight,
|
|
80
|
+
shadowStyle: shadowStyle(opened, item.type),
|
|
81
|
+
alignItems: "flex-start",
|
|
82
|
+
cols: cols,
|
|
83
|
+
onClick: !opened ? handleOnClick : () => null,
|
|
84
|
+
onKeyDown: onKeyDown,
|
|
85
|
+
selectable: selectable,
|
|
86
|
+
selected: isSelected,
|
|
87
|
+
selectedParent: selectedParent === dsId,
|
|
88
|
+
opened: opened,
|
|
89
|
+
onFocus: handleFocus,
|
|
90
|
+
"data-testid": "leftnav-item-container",
|
|
91
|
+
tabIndex: focuseable ? 0 : -1,
|
|
92
|
+
"aria-describedby": ariaDescribedBy,
|
|
93
|
+
"aria-expanded": ariaExpanded,
|
|
94
|
+
role: ariaRole,
|
|
95
|
+
"data-selected": isSelected,
|
|
96
|
+
"data-selectedparent": selectedParent === dsId,
|
|
97
|
+
"aria-label": ariaLabel,
|
|
98
|
+
"aria-hidden": !focuseable,
|
|
99
|
+
"aria-live": ariaLive,
|
|
100
|
+
children: !expandedForAnimation ? /*#__PURE__*/_jsx(Grid, {
|
|
101
|
+
"data-testid": "leftnav-leftcomponent",
|
|
102
|
+
justifyContent: "center"
|
|
103
|
+
}, void 0, /*#__PURE__*/_jsx(CollapsedComponent, {
|
|
104
|
+
item: item,
|
|
105
|
+
ctx: ctx
|
|
106
|
+
})) : children
|
|
107
|
+
}), hasBorderBottom && /*#__PURE__*/_jsx("div", {
|
|
108
|
+
style: {
|
|
109
|
+
marginLeft: opened ? '16px' : '0px',
|
|
110
|
+
marginRight: borderBottomMr,
|
|
111
|
+
height: '1px',
|
|
112
|
+
width: "calc(100% - ".concat(borderBottomMr, " - ").concat(opened ? '16px' : '0px', ")"),
|
|
113
|
+
backgroundColor: '#E0E3E8'
|
|
114
|
+
}
|
|
115
|
+
})), subitems]
|
|
116
|
+
});
|
|
103
117
|
};
|
|
104
|
-
|
|
118
|
+
|
|
119
|
+
export { ItemRenderer };
|
|
@@ -1,61 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
const borderOutside = (color, weight = 2) => `&:before {
|
|
5
|
-
content: '';
|
|
6
|
-
position: absolute;
|
|
7
|
-
top: 0;
|
|
8
|
-
left: 0;
|
|
9
|
-
right: 0;
|
|
10
|
-
bottom: 0;
|
|
11
|
-
border: ${weight}px solid ${color};
|
|
12
|
-
pointer-events: none;
|
|
13
|
-
}`;
|
|
14
|
-
const StyledItemWrapper = styled(Grid)`
|
|
15
|
-
position: relative;
|
|
16
|
-
${(props) => props.shadowStyle(props.theme)}
|
|
17
|
-
`;
|
|
18
|
-
const getItemBackground = ({ selectable, opened, selected, theme }) => {
|
|
19
|
-
if (!selectable)
|
|
20
|
-
return "white";
|
|
21
|
-
if (selected && !opened)
|
|
22
|
-
return theme.colors.brand[200];
|
|
23
|
-
return theme.colors.neutral["000"];
|
|
24
|
-
};
|
|
25
|
-
const getItemHoverBackground = ({ selectable, opened, selected, theme }) => {
|
|
26
|
-
if (!selectable)
|
|
27
|
-
return "white";
|
|
28
|
-
if (selected && !opened)
|
|
29
|
-
return theme.colors.brand[200];
|
|
30
|
-
return theme.colors.brand["200"];
|
|
31
|
-
};
|
|
32
|
-
const StyledItem = styled(Grid)`
|
|
33
|
-
cursor: ${(props) => props.selectable && !props.opened ? "pointer" : "auto"};
|
|
34
|
-
min-height: ${(props) => props.minHeight};
|
|
35
|
-
|
|
36
|
-
background: ${getItemBackground};
|
|
37
|
-
|
|
38
|
-
${(props) => props.selected && !props.opened ? borderOutside(props.theme.colors.brand[500], 1) : ""}
|
|
1
|
+
import Grid from '@elliemae/ds-grid';
|
|
2
|
+
import styled from 'styled-components';
|
|
39
3
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
4
|
+
/* eslint-disable indent */
|
|
5
|
+
const borderOutside = function (color) {
|
|
6
|
+
let weight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
7
|
+
return "&:before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: ".concat(weight, "px solid ").concat(color, ";\n pointer-events: none;\n}");
|
|
8
|
+
};
|
|
9
|
+
const StyledItemWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
10
|
+
componentId: "sc-11wzgfh-0"
|
|
11
|
+
})(["position:relative;", ""], props => props.shadowStyle(props.theme));
|
|
43
12
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
13
|
+
const getItemBackground = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
selectable,
|
|
16
|
+
opened,
|
|
17
|
+
selected,
|
|
18
|
+
theme
|
|
19
|
+
} = _ref;
|
|
20
|
+
if (!selectable) return 'white';
|
|
21
|
+
if (selected && !opened) return theme.colors.brand[200];
|
|
22
|
+
return theme.colors.neutral['000'];
|
|
23
|
+
};
|
|
47
24
|
|
|
48
|
-
|
|
25
|
+
const getItemHoverBackground = _ref2 => {
|
|
26
|
+
let {
|
|
27
|
+
selectable,
|
|
28
|
+
opened,
|
|
29
|
+
selected,
|
|
30
|
+
theme
|
|
31
|
+
} = _ref2;
|
|
32
|
+
if (!selectable) return 'white';
|
|
33
|
+
if (selected && !opened) return theme.colors.brand[200];
|
|
34
|
+
return theme.colors.brand['200'];
|
|
35
|
+
};
|
|
49
36
|
|
|
50
|
-
|
|
37
|
+
const StyledItem = /*#__PURE__*/styled(Grid).withConfig({
|
|
38
|
+
componentId: "sc-11wzgfh-1"
|
|
39
|
+
})(["cursor:", ";min-height:", ";background:", ";", ":hover{background:", ";}:active{background:", ";}", ";outline:none;", ""], props => props.selectable && !props.opened ? 'pointer' : 'auto', props => props.minHeight, getItemBackground, props => props.selected && !props.opened ? borderOutside(props.theme.colors.brand[500], 1) : '', getItemHoverBackground, _ref3 => {
|
|
40
|
+
let {
|
|
41
|
+
selectable,
|
|
42
|
+
theme
|
|
43
|
+
} = _ref3;
|
|
44
|
+
return selectable ? theme.colors.brand[200] : 'white';
|
|
45
|
+
}, props => props.shadowStyle(props.theme), props => props.tabIndex !== -1 ? ":focus {\n ".concat(borderOutside(props.theme.colors.brand[700]), "\n }") : '');
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
${borderOutside(props.theme.colors.brand[700])}
|
|
54
|
-
}` : ""}
|
|
55
|
-
`;
|
|
56
|
-
export {
|
|
57
|
-
StyledItem,
|
|
58
|
-
StyledItemWrapper,
|
|
59
|
-
borderOutside
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=styled.js.map
|
|
47
|
+
export { StyledItem, StyledItemWrapper, borderOutside };
|
|
@@ -1,40 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
3
12
|
const itemDefaultProps = {
|
|
4
|
-
label:
|
|
5
|
-
labelOverflow:
|
|
13
|
+
label: '',
|
|
14
|
+
labelOverflow: 'truncate',
|
|
6
15
|
selectable: true,
|
|
7
16
|
focuseable: true,
|
|
8
17
|
openable: false,
|
|
9
18
|
closable: false,
|
|
10
|
-
ariaLabel:
|
|
11
|
-
ariaRole:
|
|
12
|
-
ariaLive:
|
|
13
|
-
ariaExpanded:
|
|
14
|
-
ariaDescribedBy:
|
|
19
|
+
ariaLabel: '',
|
|
20
|
+
ariaRole: 'menuitem',
|
|
21
|
+
ariaLive: 'off',
|
|
22
|
+
ariaExpanded: undefined,
|
|
23
|
+
ariaDescribedBy: undefined
|
|
15
24
|
};
|
|
16
|
-
const itemWithoutShadows = [
|
|
17
|
-
|
|
25
|
+
const itemWithoutShadows = ['ds-left-nav-item-header', 'ds-left-nav-item-link', 'ds-left-nav-item-submenu']; // Make use Item props with defaults
|
|
26
|
+
|
|
27
|
+
const usePropsWithDefaults = props => {
|
|
18
28
|
const propsWithDefault = useMemo(() => {
|
|
19
|
-
const itemWithDefaults = {
|
|
20
|
-
CollapsedComponent: () => null
|
|
21
|
-
|
|
22
|
-
itemOpts: {
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
const itemWithDefaults = _objectSpread(_objectSpread({
|
|
30
|
+
CollapsedComponent: () => null
|
|
31
|
+
}, props.item), {}, {
|
|
32
|
+
itemOpts: _objectSpread(_objectSpread({}, itemDefaultProps), props.item.itemOpts)
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return _objectSpread(_objectSpread({
|
|
36
|
+
minHeight: '48px',
|
|
37
|
+
paddingTop: '12px',
|
|
27
38
|
subitems: [],
|
|
28
|
-
shadowStyle: (opened, type) =>
|
|
39
|
+
shadowStyle: (opened, type) => theme => "box-shadow: ".concat(opened || !itemWithoutShadows.includes(type) ? 'inset 4px 0 0 0 #52A6EC' : 'inset 4px 0 0 0 white'),
|
|
29
40
|
hasBorderBottom: false,
|
|
30
|
-
borderBottomMr:
|
|
31
|
-
|
|
41
|
+
borderBottomMr: '0px'
|
|
42
|
+
}, props), {}, {
|
|
32
43
|
item: itemWithDefaults
|
|
33
|
-
};
|
|
44
|
+
});
|
|
34
45
|
}, [props]);
|
|
35
46
|
return propsWithDefault;
|
|
36
47
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=usePropsWithDefaults.js.map
|
|
48
|
+
|
|
49
|
+
export { usePropsWithDefaults };
|