@elliemae/ds-left-navigation 2.2.0 → 2.3.0-alpha.3
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 +49 -27
- package/cjs/LeftNavigation.js.map +7 -0
- package/cjs/LeftNavigationContext.js +44 -18
- package/cjs/LeftNavigationContext.js.map +7 -0
- package/cjs/common/getItemBackgroundStyle.js +47 -8
- package/cjs/common/getItemBackgroundStyle.js.map +7 -0
- package/cjs/common/getLeftBorderStyle.js +50 -8
- package/cjs/common/getLeftBorderStyle.js.map +7 -0
- package/cjs/common/getScrollbarStyle.js +55 -4
- package/cjs/common/getScrollbarStyle.js.map +7 -0
- package/cjs/common/index.js +30 -13
- package/cjs/common/index.js.map +7 -0
- package/cjs/configs/index.js +38 -10
- package/cjs/configs/index.js.map +7 -0
- package/cjs/configs/useLeftNavConfig.js +80 -72
- package/cjs/configs/useLeftNavConfig.js.map +7 -0
- package/cjs/configs/useLeftNavItems.js +66 -64
- package/cjs/configs/useLeftNavItems.js.map +7 -0
- package/cjs/configs/useLeftNavSmoothExpand.js +48 -27
- package/cjs/configs/useLeftNavSmoothExpand.js.map +7 -0
- package/cjs/exported-related/ChevronItem/index.js +42 -27
- package/cjs/exported-related/ChevronItem/index.js.map +7 -0
- package/cjs/exported-related/Icon/index.js +51 -34
- package/cjs/exported-related/Icon/index.js.map +7 -0
- package/cjs/exported-related/ItemRenderer/index.js +99 -94
- package/cjs/exported-related/ItemRenderer/index.js.map +7 -0
- package/cjs/exported-related/ItemRenderer/styled.js +83 -51
- package/cjs/exported-related/ItemRenderer/styled.js.map +7 -0
- package/cjs/exported-related/ItemRenderer/usePropsWithDefaults.js +57 -45
- package/cjs/exported-related/ItemRenderer/usePropsWithDefaults.js.map +7 -0
- package/cjs/exported-related/Notifications/index.js +81 -61
- package/cjs/exported-related/Notifications/index.js.map +7 -0
- package/cjs/exported-related/OpenWindowItem/index.js +49 -32
- package/cjs/exported-related/OpenWindowItem/index.js.map +7 -0
- package/cjs/exported-related/constants.js +53 -25
- package/cjs/exported-related/constants.js.map +7 -0
- package/cjs/exported-related/index.js +33 -23
- package/cjs/exported-related/index.js.map +7 -0
- package/cjs/hooks/index.js +30 -13
- package/cjs/hooks/index.js.map +7 -0
- package/cjs/hooks/useExpandableOnClickHandler.js +55 -26
- package/cjs/hooks/useExpandableOnClickHandler.js.map +7 -0
- package/cjs/hooks/useKeyboardNavigation.js +62 -54
- package/cjs/hooks/useKeyboardNavigation.js.map +7 -0
- package/cjs/hooks/useOpenableOnClickHandler.js +55 -26
- package/cjs/hooks/useOpenableOnClickHandler.js.map +7 -0
- package/cjs/hooks/useSelectFirstBodyItem.js +46 -30
- package/cjs/hooks/useSelectFirstBodyItem.js.map +7 -0
- package/cjs/index.d.js +27 -2
- package/cjs/index.d.js.map +7 -0
- package/cjs/index.js +41 -30
- package/cjs/index.js.map +7 -0
- package/cjs/outOfTheBox/ItemControlledDrilldown/index.js +97 -103
- package/cjs/outOfTheBox/ItemControlledDrilldown/index.js.map +7 -0
- package/cjs/outOfTheBox/ItemControlledDrilldown/styled.js +49 -27
- package/cjs/outOfTheBox/ItemControlledDrilldown/styled.js.map +7 -0
- package/cjs/outOfTheBox/ItemHeader/index.js +96 -91
- package/cjs/outOfTheBox/ItemHeader/index.js.map +7 -0
- package/cjs/outOfTheBox/ItemHeader/styled.js +49 -22
- package/cjs/outOfTheBox/ItemHeader/styled.js.map +7 -0
- package/cjs/outOfTheBox/ItemLink/index.js +76 -65
- package/cjs/outOfTheBox/ItemLink/index.js.map +7 -0
- package/cjs/outOfTheBox/ItemLink/styled.js +41 -17
- package/cjs/outOfTheBox/ItemLink/styled.js.map +7 -0
- package/cjs/outOfTheBox/ItemSection/index.js +59 -63
- package/cjs/outOfTheBox/ItemSection/index.js.map +7 -0
- package/cjs/outOfTheBox/ItemSection/styled.js +53 -23
- package/cjs/outOfTheBox/ItemSection/styled.js.map +7 -0
- package/cjs/outOfTheBox/ItemSeparator/index.js +56 -45
- package/cjs/outOfTheBox/ItemSeparator/index.js.map +7 -0
- package/cjs/outOfTheBox/ItemSubmenu/index.js +96 -90
- package/cjs/outOfTheBox/ItemSubmenu/index.js.map +7 -0
- package/cjs/outOfTheBox/ItemSubmenu/styled.js +49 -22
- package/cjs/outOfTheBox/ItemSubmenu/styled.js.map +7 -0
- package/cjs/outOfTheBox/ItemTextLabel/index.js +51 -52
- package/cjs/outOfTheBox/ItemTextLabel/index.js.map +7 -0
- package/cjs/outOfTheBox/ItemTextLabel/styled.js +43 -23
- package/cjs/outOfTheBox/ItemTextLabel/styled.js.map +7 -0
- package/cjs/outOfTheBox/ItemUncontrolledDrilldown/index.js +107 -113
- package/cjs/outOfTheBox/ItemUncontrolledDrilldown/index.js.map +7 -0
- package/cjs/outOfTheBox/ItemUncontrolledDrilldown/styled.js +49 -27
- package/cjs/outOfTheBox/ItemUncontrolledDrilldown/styled.js.map +7 -0
- package/cjs/outOfTheBox/ItemWithDate/index.js +59 -54
- package/cjs/outOfTheBox/ItemWithDate/index.js.map +7 -0
- package/cjs/outOfTheBox/ItemWithDate/styled.js +49 -27
- package/cjs/outOfTheBox/ItemWithDate/styled.js.map +7 -0
- package/cjs/outOfTheBox/index.js +65 -50
- package/cjs/outOfTheBox/index.js.map +7 -0
- package/cjs/parts/LeftNavContent/index.js +75 -71
- package/cjs/parts/LeftNavContent/index.js.map +7 -0
- package/cjs/parts/LeftNavContent/styled.js +110 -50
- package/cjs/parts/LeftNavContent/styled.js.map +7 -0
- package/cjs/parts/LeftNavContentWithScrollbar/index.js +89 -79
- package/cjs/parts/LeftNavContentWithScrollbar/index.js.map +7 -0
- package/cjs/parts/LeftNavFooterItem/index.js +97 -80
- package/cjs/parts/LeftNavFooterItem/index.js.map +7 -0
- package/cjs/parts/LeftNavFooterItem/styled.js +89 -34
- package/cjs/parts/LeftNavFooterItem/styled.js.map +7 -0
- package/cjs/parts/LeftNavLoading/index.js +51 -33
- package/cjs/parts/LeftNavLoading/index.js.map +7 -0
- package/cjs/parts/OutOfTheBoxMapItem.js +49 -46
- package/cjs/parts/OutOfTheBoxMapItem.js.map +7 -0
- package/cjs/prop-types.js +58 -39
- package/cjs/prop-types.js.map +7 -0
- package/esm/LeftNavigation.js +17 -15
- package/esm/LeftNavigation.js.map +7 -0
- package/esm/LeftNavigationContext.js +15 -11
- package/esm/LeftNavigationContext.js.map +7 -0
- package/esm/common/getItemBackgroundStyle.js +20 -6
- package/esm/common/getItemBackgroundStyle.js.map +7 -0
- package/esm/common/getLeftBorderStyle.js +23 -6
- package/esm/common/getLeftBorderStyle.js.map +7 -0
- package/esm/common/getScrollbarStyle.js +28 -2
- package/esm/common/getScrollbarStyle.js.map +7 -0
- package/esm/common/index.js +5 -3
- package/esm/common/index.js.map +7 -0
- package/esm/configs/index.js +9 -2
- package/esm/configs/index.js.map +7 -0
- package/esm/configs/useLeftNavConfig.js +51 -63
- package/esm/configs/useLeftNavConfig.js.map +7 -0
- package/esm/configs/useLeftNavItems.js +33 -55
- package/esm/configs/useLeftNavItems.js.map +7 -0
- package/esm/configs/useLeftNavSmoothExpand.js +19 -18
- package/esm/configs/useLeftNavSmoothExpand.js.map +7 -0
- package/esm/exported-related/ChevronItem/index.js +13 -18
- package/esm/exported-related/ChevronItem/index.js.map +7 -0
- package/esm/exported-related/Icon/index.js +21 -24
- package/esm/exported-related/Icon/index.js.map +7 -0
- package/esm/exported-related/ItemRenderer/index.js +65 -80
- package/esm/exported-related/ItemRenderer/index.js.map +7 -0
- package/esm/exported-related/ItemRenderer/styled.js +56 -42
- package/esm/exported-related/ItemRenderer/styled.js.map +7 -0
- package/esm/exported-related/ItemRenderer/usePropsWithDefaults.js +27 -36
- package/esm/exported-related/ItemRenderer/usePropsWithDefaults.js.map +7 -0
- package/esm/exported-related/Notifications/index.js +57 -50
- package/esm/exported-related/Notifications/index.js.map +7 -0
- package/esm/exported-related/OpenWindowItem/index.js +20 -22
- package/esm/exported-related/OpenWindowItem/index.js.map +7 -0
- package/esm/exported-related/constants.js +24 -17
- package/esm/exported-related/constants.js.map +7 -0
- package/esm/exported-related/index.js +8 -6
- package/esm/exported-related/index.js.map +7 -0
- package/esm/hooks/index.js +5 -3
- package/esm/hooks/index.js.map +7 -0
- package/esm/hooks/useExpandableOnClickHandler.js +26 -22
- package/esm/hooks/useExpandableOnClickHandler.js.map +7 -0
- package/esm/hooks/useKeyboardNavigation.js +30 -47
- package/esm/hooks/useKeyboardNavigation.js.map +7 -0
- package/esm/hooks/useOpenableOnClickHandler.js +26 -22
- package/esm/hooks/useOpenableOnClickHandler.js.map +7 -0
- package/esm/hooks/useSelectFirstBodyItem.js +17 -26
- package/esm/hooks/useSelectFirstBodyItem.js.map +7 -0
- package/esm/index.d.js +2 -1
- package/esm/index.d.js.map +7 -0
- package/esm/index.js +12 -8
- package/esm/index.js.map +7 -0
- package/esm/outOfTheBox/ItemControlledDrilldown/index.js +62 -87
- package/esm/outOfTheBox/ItemControlledDrilldown/index.js.map +7 -0
- package/esm/outOfTheBox/ItemControlledDrilldown/styled.js +20 -17
- package/esm/outOfTheBox/ItemControlledDrilldown/styled.js.map +7 -0
- package/esm/outOfTheBox/ItemHeader/index.js +66 -80
- package/esm/outOfTheBox/ItemHeader/index.js.map +7 -0
- package/esm/outOfTheBox/ItemHeader/styled.js +20 -12
- package/esm/outOfTheBox/ItemHeader/styled.js.map +7 -0
- package/esm/outOfTheBox/ItemLink/index.js +47 -55
- package/esm/outOfTheBox/ItemLink/index.js.map +7 -0
- package/esm/outOfTheBox/ItemLink/styled.js +12 -8
- package/esm/outOfTheBox/ItemLink/styled.js.map +7 -0
- package/esm/outOfTheBox/ItemSection/index.js +30 -53
- package/esm/outOfTheBox/ItemSection/index.js.map +7 -0
- package/esm/outOfTheBox/ItemSection/styled.js +24 -13
- package/esm/outOfTheBox/ItemSection/styled.js.map +7 -0
- package/esm/outOfTheBox/ItemSeparator/index.js +27 -35
- package/esm/outOfTheBox/ItemSeparator/index.js.map +7 -0
- package/esm/outOfTheBox/ItemSubmenu/index.js +66 -79
- package/esm/outOfTheBox/ItemSubmenu/index.js.map +7 -0
- package/esm/outOfTheBox/ItemSubmenu/styled.js +20 -12
- package/esm/outOfTheBox/ItemSubmenu/styled.js.map +7 -0
- package/esm/outOfTheBox/ItemTextLabel/index.js +22 -43
- package/esm/outOfTheBox/ItemTextLabel/index.js.map +7 -0
- package/esm/outOfTheBox/ItemTextLabel/styled.js +14 -14
- package/esm/outOfTheBox/ItemTextLabel/styled.js.map +7 -0
- package/esm/outOfTheBox/ItemUncontrolledDrilldown/index.js +70 -95
- package/esm/outOfTheBox/ItemUncontrolledDrilldown/index.js.map +7 -0
- package/esm/outOfTheBox/ItemUncontrolledDrilldown/styled.js +20 -17
- package/esm/outOfTheBox/ItemUncontrolledDrilldown/styled.js.map +7 -0
- package/esm/outOfTheBox/ItemWithDate/index.js +30 -44
- package/esm/outOfTheBox/ItemWithDate/index.js.map +7 -0
- package/esm/outOfTheBox/ItemWithDate/styled.js +20 -17
- package/esm/outOfTheBox/ItemWithDate/styled.js.map +7 -0
- package/esm/outOfTheBox/index.js +25 -34
- package/esm/outOfTheBox/index.js.map +7 -0
- package/esm/parts/LeftNavContent/index.js +54 -64
- package/esm/parts/LeftNavContent/index.js.map +7 -0
- package/esm/parts/LeftNavContent/styled.js +81 -36
- package/esm/parts/LeftNavContent/styled.js.map +7 -0
- package/esm/parts/LeftNavContentWithScrollbar/index.js +56 -64
- package/esm/parts/LeftNavContentWithScrollbar/index.js.map +7 -0
- package/esm/parts/LeftNavFooterItem/index.js +73 -68
- package/esm/parts/LeftNavFooterItem/index.js.map +7 -0
- package/esm/parts/LeftNavFooterItem/styled.js +63 -24
- package/esm/parts/LeftNavFooterItem/styled.js.map +7 -0
- package/esm/parts/LeftNavLoading/index.js +22 -22
- package/esm/parts/LeftNavLoading/index.js.map +7 -0
- package/esm/parts/OutOfTheBoxMapItem.js +19 -35
- package/esm/parts/OutOfTheBoxMapItem.js.map +7 -0
- package/esm/prop-types.js +26 -29
- package/esm/prop-types.js.map +7 -0
- 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
|
@@ -1,89 +1,77 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useLeftNavSmoothExpand } from
|
|
5
|
-
import { useSelectFirstBodyItem } from
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// ************************** ------------ **************************
|
|
16
|
-
// * INTERNAL STATE *
|
|
17
|
-
// ************************** ------------ **************************
|
|
18
|
-
// Selection related
|
|
19
|
-
|
|
20
|
-
const [selectedItem, setSelectedItem] = React.useState(null);
|
|
21
|
-
React.useState(null);
|
|
22
|
-
const [selectedParent, setSelectedParent] = React.useState(null); // Focus related
|
|
23
|
-
|
|
24
|
-
const [focusedItem, setFocusedItem] = React.useState(null); // Opened uncontrolled drilldowns
|
|
25
|
-
|
|
26
|
-
const [openedDrilldowns, setOpenedDrilldowns] = React.useState([]); // -----------------------------------------------------------------------------
|
|
27
|
-
// ************************** ------------ **************************
|
|
28
|
-
// * EXPAND ANIMATION *
|
|
29
|
-
// ************************** ------------ **************************
|
|
30
|
-
|
|
31
|
-
const [expandedForAnimation, setExpandedForAnimation] = React.useState(expanded);
|
|
32
|
-
const timeoutRef = React.useRef(null);
|
|
33
|
-
const smoothExpandOpts = React.useMemo(() => ({
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import useLeftNavItems from "./useLeftNavItems";
|
|
4
|
+
import { useLeftNavSmoothExpand } from "./useLeftNavSmoothExpand";
|
|
5
|
+
import { useSelectFirstBodyItem } from "../hooks/useSelectFirstBodyItem";
|
|
6
|
+
const useLeftNavConfig = (props) => {
|
|
7
|
+
const { expanded, openedItem, onSelectedChange, onFocusChange, items } = props;
|
|
8
|
+
const [selectedItem, setSelectedItem] = React2.useState(null);
|
|
9
|
+
const [selectedParent, setSelectedParent] = React2.useState(null);
|
|
10
|
+
const [focusedItem, setFocusedItem] = React2.useState(null);
|
|
11
|
+
const [openedDrilldowns, setOpenedDrilldowns] = React2.useState([]);
|
|
12
|
+
const [expandedForAnimation, setExpandedForAnimation] = React2.useState(expanded);
|
|
13
|
+
const timeoutRef = React2.useRef(null);
|
|
14
|
+
const smoothExpandOpts = React2.useMemo(() => ({
|
|
34
15
|
expandedForAnimation,
|
|
35
16
|
timeoutRef,
|
|
36
17
|
setExpandedForAnimation
|
|
37
18
|
}), [expandedForAnimation, timeoutRef, setExpandedForAnimation]);
|
|
38
|
-
useLeftNavSmoothExpand(props, smoothExpandOpts);
|
|
39
|
-
|
|
40
|
-
// * SIDE EFFECTS *
|
|
41
|
-
// ************************** ------------ **************************
|
|
42
|
-
|
|
43
|
-
React.useEffect(() => {
|
|
19
|
+
useLeftNavSmoothExpand(props, smoothExpandOpts);
|
|
20
|
+
React2.useEffect(() => {
|
|
44
21
|
onSelectedChange(selectedItem);
|
|
45
22
|
}, [selectedItem, onSelectedChange]);
|
|
46
|
-
|
|
47
|
-
if (
|
|
23
|
+
React2.useEffect(() => {
|
|
24
|
+
if (props.actionRef && props.actionRef.current) {
|
|
25
|
+
props.actionRef.current.setFocusedItem = setFocusedItem;
|
|
26
|
+
}
|
|
27
|
+
}, [props.actionRef]);
|
|
28
|
+
React2.useEffect(() => {
|
|
29
|
+
if (openedItem !== null)
|
|
30
|
+
setSelectedParent(openedItem);
|
|
48
31
|
}, [openedItem]);
|
|
49
|
-
|
|
32
|
+
React2.useEffect(() => {
|
|
50
33
|
onFocusChange(focusedItem);
|
|
51
34
|
}, [focusedItem, onFocusChange]);
|
|
52
|
-
useSelectFirstBodyItem(items, openedItem, props.selectedItem !==
|
|
53
|
-
|
|
54
|
-
// * ITEMS MANAGEMENT *
|
|
55
|
-
// ************************** ------------ **************************
|
|
56
|
-
|
|
57
|
-
const leftNavItemsProps = React.useMemo(() => ({
|
|
35
|
+
useSelectFirstBodyItem(items, openedItem, props.selectedItem !== void 0 ? props.selectedItem : selectedItem, setSelectedItem, props.disableDefaultSelection);
|
|
36
|
+
const leftNavItemsProps = React2.useMemo(() => ({
|
|
58
37
|
headerItem: props.HeaderComponent,
|
|
59
38
|
bodyHeaderItem: props.BodyHeaderComponent,
|
|
60
39
|
items: props.items,
|
|
61
40
|
openedDrilldowns
|
|
62
|
-
}), [props.HeaderComponent, props.BodyHeaderComponent, props.items, openedDrilldowns]);
|
|
63
|
-
|
|
64
|
-
const {
|
|
41
|
+
}), [props.HeaderComponent, props.BodyHeaderComponent, props.items, openedDrilldowns]);
|
|
42
|
+
const { visibleItems, visibleItemsRefs } = useLeftNavItems(leftNavItemsProps);
|
|
43
|
+
const finalConfig = React2.useMemo(() => ({
|
|
44
|
+
leftNavProps: props,
|
|
45
|
+
expandedForAnimation,
|
|
46
|
+
selectedItem: props.selectedItem !== void 0 ? props.selectedItem : selectedItem,
|
|
47
|
+
setSelectedItem,
|
|
48
|
+
selectedParent: props.selectedParent !== void 0 ? props.selectedParent : selectedParent,
|
|
49
|
+
setSelectedParent,
|
|
50
|
+
focusedItem,
|
|
51
|
+
setFocusedItem,
|
|
52
|
+
openedDrilldowns,
|
|
53
|
+
setOpenedDrilldowns,
|
|
65
54
|
visibleItems,
|
|
66
55
|
visibleItemsRefs
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// * LEFTNAV CONFIG *
|
|
70
|
-
// ************************** ------------ **************************
|
|
71
|
-
|
|
72
|
-
const finalConfig = React.useMemo(() => ({
|
|
73
|
-
leftNavProps: props,
|
|
56
|
+
}), [
|
|
57
|
+
props,
|
|
74
58
|
expandedForAnimation,
|
|
75
|
-
selectedItem
|
|
59
|
+
selectedItem,
|
|
76
60
|
setSelectedItem,
|
|
77
|
-
selectedParent: props.selectedParent !== undefined ? props.selectedParent : selectedParent,
|
|
78
61
|
setSelectedParent,
|
|
62
|
+
selectedParent,
|
|
79
63
|
focusedItem,
|
|
80
64
|
setFocusedItem,
|
|
81
65
|
openedDrilldowns,
|
|
82
66
|
setOpenedDrilldowns,
|
|
83
67
|
visibleItems,
|
|
84
68
|
visibleItemsRefs
|
|
85
|
-
|
|
69
|
+
]);
|
|
86
70
|
return finalConfig;
|
|
87
71
|
};
|
|
88
|
-
|
|
89
|
-
export {
|
|
72
|
+
var useLeftNavConfig_default = useLeftNavConfig;
|
|
73
|
+
export {
|
|
74
|
+
useLeftNavConfig_default as default,
|
|
75
|
+
useLeftNavConfig
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=useLeftNavConfig.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/configs/useLeftNavConfig.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { LeftNavProps } from '../index.d';\nimport { ContextProps } from '../LeftNavigationContext';\nimport useLeftNavItems from './useLeftNavItems';\nimport { useLeftNavSmoothExpand } from './useLeftNavSmoothExpand';\nimport { useSelectFirstBodyItem } from '../hooks/useSelectFirstBodyItem';\n\nexport const useLeftNavConfig = (props: LeftNavProps): ContextProps => {\n const { expanded, openedItem, onSelectedChange, onFocusChange, items } = props;\n\n // -----------------------------------------------------------------------------\n // ************************** ------------ **************************\n // * INTERNAL STATE *\n // ************************** ------------ **************************\n // Selection related\n const [selectedItem, setSelectedItem] = React.useState<string | null>(null);\n const [selectedParent, setSelectedParent] = React.useState<string | null>(null);\n // Focus related\n const [focusedItem, setFocusedItem] = React.useState<string | null>(null);\n // Opened uncontrolled drilldowns\n const [openedDrilldowns, setOpenedDrilldowns] = React.useState<string[]>([]);\n\n // -----------------------------------------------------------------------------\n // ************************** ------------ **************************\n // * EXPAND ANIMATION *\n // ************************** ------------ **************************\n const [expandedForAnimation, setExpandedForAnimation] = React.useState(expanded);\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout>>(null);\n const smoothExpandOpts = React.useMemo(\n () => ({\n expandedForAnimation,\n timeoutRef,\n setExpandedForAnimation,\n }),\n [expandedForAnimation, timeoutRef, setExpandedForAnimation],\n );\n useLeftNavSmoothExpand(props, smoothExpandOpts);\n\n // -----------------------------------------------------------------------------\n // ************************** ------------ **************************\n // * SIDE EFFECTS *\n // ************************** ------------ **************************\n React.useEffect(() => {\n onSelectedChange(selectedItem);\n }, [selectedItem, onSelectedChange]);\n\n React.useEffect(() => {\n if (props.actionRef && props.actionRef.current) {\n props.actionRef.current.setFocusedItem = setFocusedItem;\n }\n }, [props.actionRef]);\n\n React.useEffect(() => {\n if (openedItem !== null) setSelectedParent(openedItem);\n }, [openedItem]);\n\n React.useEffect(() => {\n onFocusChange(focusedItem);\n }, [focusedItem, onFocusChange]);\n\n useSelectFirstBodyItem(\n items,\n openedItem,\n props.selectedItem !== undefined ? props.selectedItem : selectedItem,\n setSelectedItem,\n props.disableDefaultSelection,\n );\n\n // -----------------------------------------------------------------------------\n // ************************** ------------ **************************\n // * ITEMS MANAGEMENT *\n // ************************** ------------ **************************\n\n const leftNavItemsProps = React.useMemo(\n () => ({\n headerItem: props.HeaderComponent,\n bodyHeaderItem: props.BodyHeaderComponent,\n items: props.items,\n openedDrilldowns,\n }),\n [props.HeaderComponent, props.BodyHeaderComponent, props.items, openedDrilldowns],\n );\n\n // We need to know the current visible items since we have drilldowns\n const { visibleItems, visibleItemsRefs } = useLeftNavItems(leftNavItemsProps);\n\n // -----------------------------------------------------------------------------\n // ************************** ------------ **************************\n // * LEFTNAV CONFIG *\n // ************************** ------------ **************************\n const finalConfig = React.useMemo(\n () => ({\n leftNavProps: props,\n expandedForAnimation,\n selectedItem: props.selectedItem !== undefined ? props.selectedItem : selectedItem,\n setSelectedItem,\n selectedParent: props.selectedParent !== undefined ? props.selectedParent : selectedParent,\n setSelectedParent,\n focusedItem,\n setFocusedItem,\n openedDrilldowns,\n setOpenedDrilldowns,\n visibleItems,\n visibleItemsRefs,\n }),\n [\n props,\n expandedForAnimation,\n selectedItem,\n setSelectedItem,\n setSelectedParent,\n selectedParent,\n focusedItem,\n setFocusedItem,\n openedDrilldowns,\n setOpenedDrilldowns,\n visibleItems,\n visibleItemsRefs,\n ],\n );\n\n return finalConfig;\n};\n\nexport default useLeftNavConfig;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAGA;AACA;AACA;AAEO,MAAM,mBAAmB,CAAC,UAAsC;AACrE,QAAM,EAAE,UAAU,YAAY,kBAAkB,eAAe,UAAU;AAOzE,QAAM,CAAC,cAAc,mBAAmB,OAAM,SAAwB;AACtE,QAAM,CAAC,gBAAgB,qBAAqB,OAAM,SAAwB;AAE1E,QAAM,CAAC,aAAa,kBAAkB,OAAM,SAAwB;AAEpE,QAAM,CAAC,kBAAkB,uBAAuB,OAAM,SAAmB;AAMzE,QAAM,CAAC,sBAAsB,2BAA2B,OAAM,SAAS;AACvE,QAAM,aAAa,OAAM,OAAsC;AAC/D,QAAM,mBAAmB,OAAM,QAC7B,MAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MAEF,CAAC,sBAAsB,YAAY;AAErC,yBAAuB,OAAO;AAM9B,SAAM,UAAU,MAAM;AACpB,qBAAiB;AAAA,KAChB,CAAC,cAAc;AAElB,SAAM,UAAU,MAAM;AACpB,QAAI,MAAM,aAAa,MAAM,UAAU,SAAS;AAC9C,YAAM,UAAU,QAAQ,iBAAiB;AAAA;AAAA,KAE1C,CAAC,MAAM;AAEV,SAAM,UAAU,MAAM;AACpB,QAAI,eAAe;AAAM,wBAAkB;AAAA,KAC1C,CAAC;AAEJ,SAAM,UAAU,MAAM;AACpB,kBAAc;AAAA,KACb,CAAC,aAAa;AAEjB,yBACE,OACA,YACA,MAAM,iBAAiB,SAAY,MAAM,eAAe,cACxD,iBACA,MAAM;AAQR,QAAM,oBAAoB,OAAM,QAC9B,MAAO;AAAA,IACL,YAAY,MAAM;AAAA,IAClB,gBAAgB,MAAM;AAAA,IACtB,OAAO,MAAM;AAAA,IACb;AAAA,MAEF,CAAC,MAAM,iBAAiB,MAAM,qBAAqB,MAAM,OAAO;AAIlE,QAAM,EAAE,cAAc,qBAAqB,gBAAgB;AAM3D,QAAM,cAAc,OAAM,QACxB,MAAO;AAAA,IACL,cAAc;AAAA,IACd;AAAA,IACA,cAAc,MAAM,iBAAiB,SAAY,MAAM,eAAe;AAAA,IACtE;AAAA,IACA,gBAAgB,MAAM,mBAAmB,SAAY,MAAM,iBAAiB;AAAA,IAC5E;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAEF;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAIJ,SAAO;AAAA;AAGT,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,75 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
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
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createRef, useMemo, useRef } from "react";
|
|
3
|
+
import { ITEM_TYPES } from "../exported-related";
|
|
4
|
+
import { FOOTER_DS_ID } from "../exported-related/constants";
|
|
5
|
+
const notFocuseableItems = [ITEM_TYPES.LEFT_NAV_ITEM_SEPARATOR, ITEM_TYPES.LEFT_NAV_ITEM_SECTION];
|
|
19
6
|
const walkItems = (items, openedDrilldowns, callback) => {
|
|
20
|
-
items.forEach(item => {
|
|
21
|
-
if (typeof item.type ===
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
|
|
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);
|
|
7
|
+
items.forEach((item) => {
|
|
8
|
+
if (typeof item.type === "string") {
|
|
9
|
+
if (notFocuseableItems.includes(item.type))
|
|
10
|
+
return;
|
|
11
|
+
callback(item.dsId);
|
|
12
|
+
if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN && openedDrilldowns.includes(item.dsId))
|
|
13
|
+
walkItems(item.itemOpts?.items ?? [], openedDrilldowns, callback);
|
|
14
|
+
if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN && item.itemOpts?.isOpened)
|
|
15
|
+
walkItems(item.itemOpts?.items ?? [], openedDrilldowns, callback);
|
|
32
16
|
} else {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Custom item
|
|
36
|
-
if (!((_item$itemOpts4 = item.itemOpts) !== null && _item$itemOpts4 !== void 0 && _item$itemOpts4.focuseable)) return; // not focuseable specified
|
|
37
|
-
|
|
17
|
+
if (!item.itemOpts?.focuseable)
|
|
18
|
+
return;
|
|
38
19
|
callback(item.dsId);
|
|
39
20
|
}
|
|
40
21
|
});
|
|
41
22
|
};
|
|
42
|
-
|
|
43
|
-
const
|
|
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
|
-
|
|
23
|
+
const useLeftNavItems = (props) => {
|
|
24
|
+
const { headerItem, bodyHeaderItem, items: bodyItems, openedDrilldowns } = props;
|
|
51
25
|
const items = useMemo(() => {
|
|
52
26
|
const itemsArray = [...bodyItems];
|
|
53
|
-
if (bodyHeaderItem)
|
|
54
|
-
|
|
27
|
+
if (bodyHeaderItem)
|
|
28
|
+
itemsArray.unshift(bodyHeaderItem);
|
|
29
|
+
if (headerItem)
|
|
30
|
+
itemsArray.unshift(headerItem);
|
|
55
31
|
return itemsArray;
|
|
56
32
|
}, [headerItem, bodyHeaderItem, bodyItems]);
|
|
57
33
|
const visibleItemsRefs = useRef({});
|
|
58
34
|
const visibleItems = useMemo(() => {
|
|
59
35
|
const visibleItemsArray = [];
|
|
60
|
-
walkItems(items, openedDrilldowns, dsId => {
|
|
36
|
+
walkItems(items, openedDrilldowns, (dsId) => {
|
|
61
37
|
visibleItemsArray.push(dsId);
|
|
62
38
|
});
|
|
63
39
|
visibleItemsArray.push(FOOTER_DS_ID);
|
|
64
40
|
return visibleItemsArray;
|
|
65
41
|
}, [items, openedDrilldowns]);
|
|
66
|
-
visibleItems.forEach(dsId => {
|
|
67
|
-
if (!(dsId in visibleItemsRefs.current))
|
|
42
|
+
visibleItems.forEach((dsId) => {
|
|
43
|
+
if (!(dsId in visibleItemsRefs.current))
|
|
44
|
+
visibleItemsRefs.current[dsId] = createRef();
|
|
68
45
|
});
|
|
69
|
-
return {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
46
|
+
return { visibleItems, visibleItemsRefs };
|
|
47
|
+
};
|
|
48
|
+
var useLeftNavItems_default = useLeftNavItems;
|
|
49
|
+
export {
|
|
50
|
+
useLeftNavItems_default as default,
|
|
51
|
+
useLeftNavItems
|
|
73
52
|
};
|
|
74
|
-
|
|
75
|
-
export { useLeftNavItems as default, useLeftNavItems };
|
|
53
|
+
//# sourceMappingURL=useLeftNavItems.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/configs/useLeftNavItems.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { createRef, MutableRefObject, RefObject, useMemo, useRef } from 'react';\nimport { ITEM_TYPES } from '../exported-related';\nimport type { GenericItemItemProps } from '../index.d';\nimport { FOOTER_DS_ID } from '../exported-related/constants';\n\nconst notFocuseableItems = [ITEM_TYPES.LEFT_NAV_ITEM_SEPARATOR, ITEM_TYPES.LEFT_NAV_ITEM_SECTION];\n\n// Walks the array of items\n// Drilldowns are tree-like structures\nconst walkItems = (items: GenericItemItemProps[], openedDrilldowns: string[], callback: (dsId: string) => void) => {\n items.forEach((item) => {\n if (typeof item.type === 'string') {\n // Out of the box item\n if (notFocuseableItems.includes(item.type)) return; // not focuseable\n\n callback(item.dsId);\n\n // If it's an opened uncontrolled drilldown\n if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN && openedDrilldowns.includes(item.dsId))\n walkItems(item.itemOpts?.items ?? [], openedDrilldowns, callback);\n\n // If it's an opened controlled drilldown\n if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN && item.itemOpts?.isOpened)\n walkItems(item.itemOpts?.items ?? [], openedDrilldowns, callback);\n } else {\n // Custom item\n if (!item.itemOpts?.focuseable) return; // not focuseable specified\n callback(item.dsId);\n }\n });\n};\n\nexport const useLeftNavItems = (props: {\n headerItem: GenericItemItemProps;\n bodyHeaderItem: GenericItemItemProps;\n items: GenericItemItemProps[];\n openedDrilldowns: string[];\n}): {\n visibleItems: string[];\n visibleItemsRefs: MutableRefObject<Record<string, RefObject<HTMLElement>>>;\n} => {\n const { headerItem, bodyHeaderItem, items: bodyItems, openedDrilldowns } = props;\n\n // Place the header and body header items into the array of items\n const items = useMemo(() => {\n const itemsArray: GenericItemItemProps[] = [...bodyItems];\n if (bodyHeaderItem) itemsArray.unshift(bodyHeaderItem);\n if (headerItem) itemsArray.unshift(headerItem);\n return itemsArray;\n }, [headerItem, bodyHeaderItem, bodyItems]);\n\n const visibleItemsRefs = useRef<Record<string, RefObject<HTMLElement>>>({});\n\n const visibleItems: string[] = useMemo(() => {\n const visibleItemsArray: string[] = [];\n walkItems(items, openedDrilldowns, (dsId: string) => {\n visibleItemsArray.push(dsId);\n });\n visibleItemsArray.push(FOOTER_DS_ID);\n return visibleItemsArray;\n }, [items, openedDrilldowns]);\n\n visibleItems.forEach((dsId) => {\n if (!(dsId in visibleItemsRefs.current)) visibleItemsRefs.current[dsId] = createRef();\n });\n\n return { visibleItems, visibleItemsRefs };\n};\n\nexport default useLeftNavItems;\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AAEA;AAEA,MAAM,qBAAqB,CAAC,WAAW,yBAAyB,WAAW;AAI3E,MAAM,YAAY,CAAC,OAA+B,kBAA4B,aAAqC;AACjH,QAAM,QAAQ,CAAC,SAAS;AACtB,QAAI,OAAO,KAAK,SAAS,UAAU;AAEjC,UAAI,mBAAmB,SAAS,KAAK;AAAO;AAE5C,eAAS,KAAK;AAGd,UAAI,KAAK,SAAS,WAAW,wCAAwC,iBAAiB,SAAS,KAAK;AAClG,kBAAU,KAAK,UAAU,SAAS,IAAI,kBAAkB;AAG1D,UAAI,KAAK,SAAS,WAAW,sCAAsC,KAAK,UAAU;AAChF,kBAAU,KAAK,UAAU,SAAS,IAAI,kBAAkB;AAAA,WACrD;AAEL,UAAI,CAAC,KAAK,UAAU;AAAY;AAChC,eAAS,KAAK;AAAA;AAAA;AAAA;AAKb,MAAM,kBAAkB,CAAC,UAQ3B;AACH,QAAM,EAAE,YAAY,gBAAgB,OAAO,WAAW,qBAAqB;AAG3E,QAAM,QAAQ,QAAQ,MAAM;AAC1B,UAAM,aAAqC,CAAC,GAAG;AAC/C,QAAI;AAAgB,iBAAW,QAAQ;AACvC,QAAI;AAAY,iBAAW,QAAQ;AACnC,WAAO;AAAA,KACN,CAAC,YAAY,gBAAgB;AAEhC,QAAM,mBAAmB,OAA+C;AAExE,QAAM,eAAyB,QAAQ,MAAM;AAC3C,UAAM,oBAA8B;AACpC,cAAU,OAAO,kBAAkB,CAAC,SAAiB;AACnD,wBAAkB,KAAK;AAAA;AAEzB,sBAAkB,KAAK;AACvB,WAAO;AAAA,KACN,CAAC,OAAO;AAEX,eAAa,QAAQ,CAAC,SAAS;AAC7B,QAAI,CAAE,SAAQ,iBAAiB;AAAU,uBAAiB,QAAQ,QAAQ;AAAA;AAG5E,SAAO,EAAE,cAAc;AAAA;AAGzB,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
3
|
const useLeftNavSmoothExpand = (props, smoothExpandOpts) => {
|
|
4
|
-
const {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
expandedForAnimation,
|
|
9
|
-
timeoutRef,
|
|
10
|
-
setExpandedForAnimation
|
|
11
|
-
} = smoothExpandOpts;
|
|
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
|
|
4
|
+
const { expanded } = props;
|
|
5
|
+
const { expandedForAnimation, timeoutRef, setExpandedForAnimation } = smoothExpandOpts;
|
|
6
|
+
React2.useEffect(() => {
|
|
15
7
|
if (!expanded && expandedForAnimation) {
|
|
16
|
-
|
|
8
|
+
if (timeoutRef.current)
|
|
9
|
+
clearTimeout(timeoutRef.current);
|
|
17
10
|
timeoutRef.current = setTimeout(() => setExpandedForAnimation(false), 350);
|
|
18
|
-
} else if (expanded)
|
|
11
|
+
} else if (expanded)
|
|
12
|
+
setExpandedForAnimation(true);
|
|
19
13
|
}, [expanded]);
|
|
20
|
-
|
|
14
|
+
React2.useEffect(() => () => {
|
|
15
|
+
if (timeoutRef.current)
|
|
16
|
+
clearTimeout(timeoutRef.current);
|
|
17
|
+
}, [timeoutRef]);
|
|
18
|
+
};
|
|
19
|
+
var useLeftNavSmoothExpand_default = useLeftNavSmoothExpand;
|
|
20
|
+
export {
|
|
21
|
+
useLeftNavSmoothExpand_default as default,
|
|
22
|
+
useLeftNavSmoothExpand
|
|
21
23
|
};
|
|
22
|
-
|
|
23
|
-
export { useLeftNavSmoothExpand as default, useLeftNavSmoothExpand };
|
|
24
|
+
//# sourceMappingURL=useLeftNavSmoothExpand.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/configs/useLeftNavSmoothExpand.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { LeftNavProps } from '../index.d';\n\ninterface SmoothExpandOptsT {\n expandedForAnimation: boolean;\n timeoutRef: React.MutableRefObject<NodeJS.Timeout | null>;\n setExpandedForAnimation: React.Dispatch<React.SetStateAction<boolean>>;\n}\nexport const useLeftNavSmoothExpand = (props: LeftNavProps, smoothExpandOpts: SmoothExpandOptsT): void => {\n const { expanded } = props;\n const { expandedForAnimation, timeoutRef, setExpandedForAnimation } = smoothExpandOpts;\n\n React.useEffect(() => {\n // If expanded changes, we need to smoothly transition to the non-expanded state\n // so we need to wait for 350ms\n if (!expanded && expandedForAnimation) {\n if (timeoutRef.current) clearTimeout(timeoutRef.current);\n timeoutRef.current = setTimeout(() => setExpandedForAnimation(false), 350);\n } else if (expanded) setExpandedForAnimation(true);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [expanded]);\n\n React.useEffect(\n () => () => {\n if (timeoutRef.current) clearTimeout(timeoutRef.current);\n },\n [timeoutRef],\n );\n};\n\nexport default useLeftNavSmoothExpand;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAQO,MAAM,yBAAyB,CAAC,OAAqB,qBAA8C;AACxG,QAAM,EAAE,aAAa;AACrB,QAAM,EAAE,sBAAsB,YAAY,4BAA4B;AAEtE,SAAM,UAAU,MAAM;AAGpB,QAAI,CAAC,YAAY,sBAAsB;AACrC,UAAI,WAAW;AAAS,qBAAa,WAAW;AAChD,iBAAW,UAAU,WAAW,MAAM,wBAAwB,QAAQ;AAAA,eAC7D;AAAU,8BAAwB;AAAA,KAE5C,CAAC;AAEJ,SAAM,UACJ,MAAM,MAAM;AACV,QAAI,WAAW;AAAS,mBAAa,WAAW;AAAA,KAElD,CAAC;AAAA;AAIL,IAAO,iCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
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({
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { ChevronSmallRight } from "@elliemae/ds-icons";
|
|
4
|
+
const ChevronItem = (props) => /* @__PURE__ */ React2.createElement(ChevronSmallRight, {
|
|
15
5
|
size: "m",
|
|
16
|
-
color: [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
color: ["brand-primary", 800],
|
|
7
|
+
...props
|
|
8
|
+
});
|
|
9
|
+
var ChevronItem_default = ChevronItem;
|
|
10
|
+
export {
|
|
11
|
+
ChevronItem,
|
|
12
|
+
ChevronItem_default as default
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/exported-related/ChevronItem/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { ChevronSmallRight } from '@elliemae/ds-icons';\n\nexport const ChevronItem = (props: unknown): JSX.Element => (\n <ChevronSmallRight size=\"m\" color={['brand-primary', 800]} {...props} />\n);\n\nexport default ChevronItem;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEO,MAAM,cAAc,CAAC,UAC1B,qCAAC,mBAAD;AAAA,EAAmB,MAAK;AAAA,EAAI,OAAO,CAAC,iBAAiB;AAAA,KAAU;AAAA;AAGjE,IAAO,sBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
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';
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
const AugmentedIcon = (Icon2) => styled(Icon2)`
|
|
5
|
+
cursor: pointer;
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const Icon = IconComponent => props => {
|
|
7
|
+
outline: 0;
|
|
8
|
+
:focus,
|
|
9
|
+
:active {
|
|
10
|
+
outline: 1px solid #1e79c2;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
const Icon = (IconComponent) => (props) => {
|
|
20
14
|
const StyledComponent = AugmentedIcon(IconComponent);
|
|
21
|
-
return
|
|
22
|
-
color: [
|
|
23
|
-
tabIndex: 0
|
|
24
|
-
|
|
15
|
+
return /* @__PURE__ */ React2.createElement(StyledComponent, {
|
|
16
|
+
color: ["brand-primary", 800],
|
|
17
|
+
tabIndex: 0,
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
25
20
|
};
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
export {
|
|
22
|
+
Icon
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/exported-related/Icon/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport styled from 'styled-components';\n\nconst AugmentedIcon = (\n Icon: React.ComponentType<{ color: unknown; tabIndex: number }>,\n) => styled(Icon)`\n cursor: pointer;\n\n outline: 0;\n :focus,\n :active {\n outline: 1px solid #1e79c2;\n }\n`;\n\nexport const Icon = (\n IconComponent: React.ComponentType<{ color: unknown; tabIndex: number }>,\n) => (props: unknown): JSX.Element => {\n const StyledComponent = AugmentedIcon(IconComponent);\n return (\n <StyledComponent color={['brand-primary', 800]} tabIndex={0} {...props} />\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEA,MAAM,gBAAgB,CACpB,UACG,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUL,MAAM,OAAO,CAClB,kBACG,CAAC,UAAgC;AACpC,QAAM,kBAAkB,cAAc;AACtC,SACE,qCAAC,iBAAD;AAAA,IAAiB,OAAO,CAAC,iBAAiB;AAAA,IAAM,UAAU;AAAA,OAAO;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useContext,
|
|
3
|
-
import Grid from
|
|
4
|
-
import { StyledItemWrapper, StyledItem } from
|
|
5
|
-
import { LeftNavContext } from
|
|
6
|
-
import { usePropsWithDefaults } from
|
|
7
|
-
import { useKeyboardNavigation } from
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const ItemRenderer = props => {
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useContext, useMemo, useCallback } from "react";
|
|
3
|
+
import Grid from "@elliemae/ds-grid";
|
|
4
|
+
import { StyledItemWrapper, StyledItem } from "./styled";
|
|
5
|
+
import { LeftNavContext } from "../../LeftNavigationContext";
|
|
6
|
+
import { usePropsWithDefaults } from "./usePropsWithDefaults";
|
|
7
|
+
import { useKeyboardNavigation } from "../../hooks";
|
|
8
|
+
const ItemRenderer = (props) => {
|
|
11
9
|
const propsWithDefault = usePropsWithDefaults(props);
|
|
12
10
|
const {
|
|
13
11
|
item,
|
|
14
12
|
item: {
|
|
15
13
|
dsId,
|
|
16
|
-
itemOpts: {
|
|
17
|
-
selectable,
|
|
18
|
-
focuseable,
|
|
19
|
-
indent,
|
|
20
|
-
ariaLabel,
|
|
21
|
-
ariaRole,
|
|
22
|
-
ariaLive,
|
|
23
|
-
ariaExpanded,
|
|
24
|
-
ariaDescribedBy
|
|
25
|
-
},
|
|
14
|
+
itemOpts: { selectable, focuseable, indent, ariaLabel, ariaRole, ariaLive, ariaExpanded, ariaDescribedBy },
|
|
26
15
|
CollapsedComponent
|
|
27
16
|
},
|
|
28
17
|
subitems,
|
|
@@ -36,10 +25,7 @@ const ItemRenderer = props => {
|
|
|
36
25
|
} = propsWithDefault;
|
|
37
26
|
const ctx = useContext(LeftNavContext);
|
|
38
27
|
const {
|
|
39
|
-
leftNavProps: {
|
|
40
|
-
onItemClick,
|
|
41
|
-
openedItem
|
|
42
|
-
},
|
|
28
|
+
leftNavProps: { onItemClick, openedItem },
|
|
43
29
|
expandedForAnimation,
|
|
44
30
|
selectedParent,
|
|
45
31
|
selectedItem,
|
|
@@ -48,72 +34,71 @@ const ItemRenderer = props => {
|
|
|
48
34
|
visibleItemsRefs
|
|
49
35
|
} = ctx;
|
|
50
36
|
const opened = dsId === openedItem;
|
|
51
|
-
const handleOnClick = useCallback(e => {
|
|
52
|
-
if (onClick)
|
|
53
|
-
|
|
37
|
+
const handleOnClick = useCallback((e) => {
|
|
38
|
+
if (onClick)
|
|
39
|
+
onClick();
|
|
54
40
|
onItemClick(item, e);
|
|
55
|
-
if (selectable)
|
|
41
|
+
if (selectable)
|
|
42
|
+
setSelectedItem(item.dsId);
|
|
56
43
|
}, [onItemClick, item, setSelectedItem, selectable, onClick]);
|
|
57
44
|
const handleFocus = useCallback(() => {
|
|
58
|
-
if (focuseable)
|
|
45
|
+
if (focuseable)
|
|
46
|
+
setFocusedItem(dsId);
|
|
59
47
|
}, [dsId, setFocusedItem, focuseable]);
|
|
60
48
|
const onKeyDown = useKeyboardNavigation({
|
|
61
49
|
item,
|
|
62
50
|
onClick: handleOnClick
|
|
63
51
|
});
|
|
64
|
-
const cols = useMemo(() => expandedForAnimation ? [
|
|
52
|
+
const cols = useMemo(() => expandedForAnimation ? ["auto", "1fr", "auto"] : ["38px"], [expandedForAnimation]);
|
|
65
53
|
const isSelected = useMemo(() => selectedItem === dsId, [selectedItem, dsId]);
|
|
66
|
-
|
|
67
54
|
if (!expandedForAnimation && !CollapsedComponent) {
|
|
68
55
|
return null;
|
|
69
56
|
}
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
});
|
|
57
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StyledItemWrapper, {
|
|
58
|
+
shadowStyle: shadowStyle(opened, item.type),
|
|
59
|
+
"data-testid": "leftnav-item-wrapper"
|
|
60
|
+
}, /* @__PURE__ */ React2.createElement(StyledItem, {
|
|
61
|
+
ref: visibleItemsRefs.current[dsId],
|
|
62
|
+
pt: paddingTop,
|
|
63
|
+
pl: indent === void 0 ? "xxxs" : `${indent}px`,
|
|
64
|
+
minHeight,
|
|
65
|
+
shadowStyle: shadowStyle(opened, item.type),
|
|
66
|
+
alignItems: "flex-start",
|
|
67
|
+
cols,
|
|
68
|
+
onClick: !opened ? handleOnClick : () => null,
|
|
69
|
+
onKeyDown,
|
|
70
|
+
selectable,
|
|
71
|
+
selected: isSelected,
|
|
72
|
+
selectedParent: selectedParent === dsId,
|
|
73
|
+
opened,
|
|
74
|
+
onFocus: handleFocus,
|
|
75
|
+
"data-testid": "leftnav-item-container",
|
|
76
|
+
tabIndex: focuseable ? 0 : -1,
|
|
77
|
+
"aria-describedby": ariaDescribedBy,
|
|
78
|
+
"aria-expanded": ariaExpanded,
|
|
79
|
+
role: ariaRole,
|
|
80
|
+
"data-selected": isSelected,
|
|
81
|
+
"data-selectedparent": selectedParent === dsId,
|
|
82
|
+
"aria-label": ariaLabel,
|
|
83
|
+
"aria-hidden": !focuseable,
|
|
84
|
+
"aria-live": ariaLive
|
|
85
|
+
}, !expandedForAnimation ? /* @__PURE__ */ React2.createElement(Grid, {
|
|
86
|
+
"data-testid": "leftnav-leftcomponent",
|
|
87
|
+
justifyContent: "center"
|
|
88
|
+
}, /* @__PURE__ */ React2.createElement(CollapsedComponent, {
|
|
89
|
+
item,
|
|
90
|
+
ctx
|
|
91
|
+
})) : children), hasBorderBottom && /* @__PURE__ */ React2.createElement("div", {
|
|
92
|
+
style: {
|
|
93
|
+
marginLeft: opened ? "16px" : "0px",
|
|
94
|
+
marginRight: borderBottomMr,
|
|
95
|
+
height: "1px",
|
|
96
|
+
width: `calc(100% - ${borderBottomMr} - ${opened ? "16px" : "0px"})`,
|
|
97
|
+
backgroundColor: "#E0E3E8"
|
|
98
|
+
}
|
|
99
|
+
})), subitems);
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
ItemRenderer
|
|
117
103
|
};
|
|
118
|
-
|
|
119
|
-
export { ItemRenderer };
|
|
104
|
+
//# sourceMappingURL=index.js.map
|