@elliemae/ds-left-navigation 2.0.0-alpha.1 → 2.0.0-alpha.13

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.
Files changed (120) hide show
  1. package/cjs/LeftNavigation.js +2 -2
  2. package/cjs/LeftNavigationContext.js +1 -5
  3. package/cjs/common/getItemBackgroundStyle.js +1 -12
  4. package/cjs/common/getLeftBorderStyle.js +3 -17
  5. package/cjs/common/getScrollbarStyle.js +1 -24
  6. package/cjs/common/index.js +0 -2
  7. package/cjs/configs/index.js +1 -1
  8. package/cjs/configs/useLeftNavConfig.js +24 -31
  9. package/cjs/configs/useLeftNavItems.js +12 -12
  10. package/cjs/configs/useLeftNavSmoothExpand.js +3 -3
  11. package/cjs/exported-related/ChevronItem/index.js +9 -5
  12. package/cjs/exported-related/Icon/index.js +7 -2
  13. package/cjs/exported-related/ItemRenderer/index.js +17 -14
  14. package/cjs/exported-related/ItemRenderer/styled.js +29 -29
  15. package/cjs/exported-related/ItemRenderer/usePropsWithDefaults.js +12 -4
  16. package/cjs/exported-related/Notifications/index.js +43 -43
  17. package/cjs/exported-related/OpenWindowItem/index.js +9 -5
  18. package/cjs/hooks/useExpandableOnClickHandler.js +7 -6
  19. package/cjs/hooks/useKeyboardNavigation.js +7 -7
  20. package/cjs/hooks/useOpenableOnClickHandler.js +8 -7
  21. package/cjs/hooks/useSelectFirstBodyItem.js +14 -4
  22. package/cjs/index.js +1 -2
  23. package/cjs/outOfTheBox/ItemControlledDrilldown/index.js +32 -31
  24. package/cjs/outOfTheBox/ItemControlledDrilldown/styled.js +9 -6
  25. package/cjs/outOfTheBox/ItemHeader/index.js +35 -26
  26. package/cjs/outOfTheBox/ItemHeader/styled.js +4 -5
  27. package/cjs/outOfTheBox/ItemLink/index.js +26 -32
  28. package/cjs/outOfTheBox/ItemLink/styled.js +1 -1
  29. package/cjs/outOfTheBox/ItemSection/index.js +16 -13
  30. package/cjs/outOfTheBox/ItemSection/styled.js +3 -3
  31. package/cjs/outOfTheBox/ItemSeparator/index.js +10 -10
  32. package/cjs/outOfTheBox/ItemSubmenu/index.js +28 -36
  33. package/cjs/outOfTheBox/ItemSubmenu/styled.js +4 -5
  34. package/cjs/outOfTheBox/ItemTextLabel/index.js +15 -13
  35. package/cjs/outOfTheBox/ItemTextLabel/styled.js +8 -5
  36. package/cjs/outOfTheBox/ItemUncontrolledDrilldown/index.js +29 -29
  37. package/cjs/outOfTheBox/ItemUncontrolledDrilldown/styled.js +9 -6
  38. package/cjs/outOfTheBox/ItemWithDate/index.js +17 -16
  39. package/cjs/outOfTheBox/ItemWithDate/styled.js +9 -6
  40. package/cjs/outOfTheBox/index.js +6 -6
  41. package/cjs/parts/LeftNavContent/index.js +17 -14
  42. package/cjs/parts/LeftNavContent/styled.js +18 -23
  43. package/cjs/parts/LeftNavContentWithScrollbar/index.js +30 -22
  44. package/cjs/parts/LeftNavFooterItem/index.js +13 -21
  45. package/cjs/parts/LeftNavFooterItem/styled.js +9 -10
  46. package/cjs/parts/LeftNavLoading/index.js +14 -11
  47. package/cjs/parts/OutOfTheBoxMapItem.js +9 -4
  48. package/cjs/prop-types.js +2 -1
  49. package/esm/LeftNavigationContext.js +0 -4
  50. package/esm/common/getItemBackgroundStyle.js +1 -12
  51. package/esm/common/getLeftBorderStyle.js +3 -17
  52. package/esm/common/getScrollbarStyle.js +1 -24
  53. package/esm/common/index.js +0 -1
  54. package/esm/configs/useLeftNavConfig.js +14 -21
  55. package/esm/configs/useLeftNavItems.js +11 -11
  56. package/esm/exported-related/ChevronItem/index.js +7 -2
  57. package/esm/exported-related/Icon/index.js +5 -0
  58. package/esm/exported-related/ItemRenderer/index.js +13 -10
  59. package/esm/exported-related/ItemRenderer/styled.js +27 -28
  60. package/esm/exported-related/ItemRenderer/usePropsWithDefaults.js +11 -3
  61. package/esm/exported-related/Notifications/index.js +41 -37
  62. package/esm/exported-related/OpenWindowItem/index.js +7 -2
  63. package/esm/hooks/useExpandableOnClickHandler.js +7 -6
  64. package/esm/hooks/useKeyboardNavigation.js +7 -7
  65. package/esm/hooks/useOpenableOnClickHandler.js +8 -7
  66. package/esm/hooks/useSelectFirstBodyItem.js +14 -4
  67. package/esm/index.js +0 -1
  68. package/esm/outOfTheBox/ItemControlledDrilldown/index.js +17 -14
  69. package/esm/outOfTheBox/ItemControlledDrilldown/styled.js +7 -4
  70. package/esm/outOfTheBox/ItemHeader/index.js +24 -15
  71. package/esm/outOfTheBox/ItemHeader/styled.js +3 -3
  72. package/esm/outOfTheBox/ItemLink/index.js +18 -24
  73. package/esm/outOfTheBox/ItemSection/index.js +11 -8
  74. package/esm/outOfTheBox/ItemSeparator/index.js +6 -6
  75. package/esm/outOfTheBox/ItemSubmenu/index.js +17 -25
  76. package/esm/outOfTheBox/ItemSubmenu/styled.js +3 -3
  77. package/esm/outOfTheBox/ItemTextLabel/index.js +11 -9
  78. package/esm/outOfTheBox/ItemTextLabel/styled.js +7 -4
  79. package/esm/outOfTheBox/ItemUncontrolledDrilldown/index.js +15 -13
  80. package/esm/outOfTheBox/ItemUncontrolledDrilldown/styled.js +7 -4
  81. package/esm/outOfTheBox/ItemWithDate/index.js +9 -8
  82. package/esm/outOfTheBox/ItemWithDate/styled.js +7 -4
  83. package/esm/outOfTheBox/index.js +6 -6
  84. package/esm/parts/LeftNavContent/index.js +5 -2
  85. package/esm/parts/LeftNavContent/styled.js +11 -16
  86. package/esm/parts/LeftNavContentWithScrollbar/index.js +16 -8
  87. package/esm/parts/LeftNavFooterItem/index.js +4 -11
  88. package/esm/parts/LeftNavFooterItem/styled.js +3 -4
  89. package/esm/parts/LeftNavLoading/index.js +13 -10
  90. package/esm/parts/OutOfTheBoxMapItem.js +5 -0
  91. package/esm/prop-types.js +2 -1
  92. package/package.json +12 -16
  93. package/types/LeftNavigation.d.ts +46 -11
  94. package/types/LeftNavigationContext.d.ts +0 -4
  95. package/types/common/index.d.ts +0 -1
  96. package/types/exported-related/ItemRenderer/styled.d.ts +3 -2
  97. package/types/hooks/useKeyboardNavigation.d.ts +1 -1
  98. package/types/hooks/useSelectFirstBodyItem.d.ts +1 -1
  99. package/types/index.d.d.ts +9 -2
  100. package/types/index.d.ts +1 -2
  101. package/types/outOfTheBox/ItemControlledDrilldown/styled.d.ts +2 -2
  102. package/types/outOfTheBox/ItemHeader/styled.d.ts +2 -2
  103. package/types/outOfTheBox/ItemLink/styled.d.ts +1 -1
  104. package/types/outOfTheBox/ItemSection/styled.d.ts +3 -3
  105. package/types/outOfTheBox/ItemSubmenu/styled.d.ts +2 -2
  106. package/types/outOfTheBox/ItemTextLabel/styled.d.ts +1 -1
  107. package/types/outOfTheBox/ItemUncontrolledDrilldown/styled.d.ts +2 -2
  108. package/types/outOfTheBox/ItemWithDate/styled.d.ts +2 -2
  109. package/types/parts/LeftNavContent/styled.d.ts +7 -11
  110. package/types/parts/LeftNavContentWithScrollbar/index.d.ts +1 -0
  111. package/types/parts/LeftNavFooterItem/styled.d.ts +10 -6
  112. package/types/prop-types.d.ts +87 -18
  113. package/cjs/common/getFocusedByKeyboardStyle.js +0 -23
  114. package/cjs/configs/useGlobalKeyListeners.js +0 -31
  115. package/cjs/package.json +0 -4
  116. package/esm/common/getFocusedByKeyboardStyle.js +0 -19
  117. package/esm/configs/useGlobalKeyListeners.js +0 -22
  118. package/esm/package.json +0 -4
  119. package/types/common/getFocusedByKeyboardStyle.d.ts +0 -4
  120. package/types/configs/useGlobalKeyListeners.d.ts +0 -6
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var React = require('react');
7
- var MenuExpand = require('@elliemae/ds-icons/MenuExpand');
7
+ var dsIcons = require('@elliemae/ds-icons');
8
8
  var Grid = require('@elliemae/ds-grid');
9
9
  var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
10
10
  var styled = require('./styled.js');
@@ -16,7 +16,6 @@ var jsxRuntime = require('react/jsx-runtime');
16
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
17
 
18
18
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
19
- var MenuExpand__default = /*#__PURE__*/_interopDefaultLegacy(MenuExpand);
20
19
  var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
21
20
 
22
21
  var _StyledSeparator;
@@ -33,9 +32,7 @@ const LeftNavFooterItem = props => {
33
32
  },
34
33
  expandedForAnimation,
35
34
  setSelectedItem,
36
- focusedItem,
37
35
  setFocusedItem,
38
- focusedByKey,
39
36
  visibleItemsRefs
40
37
  } = React.useContext(LeftNavigationContext.LeftNavContext);
41
38
  const id = constants.FOOTER_DS_ID;
@@ -51,9 +48,9 @@ const LeftNavFooterItem = props => {
51
48
  },
52
49
  onClick: handleOnClick
53
50
  });
54
- return /*#__PURE__*/_jsx__default['default'](styled.StyledFooterMenu, {
51
+ return /*#__PURE__*/_jsx__default["default"](styled.StyledFooterMenu, {
55
52
  "data-testid": "leftnav-container"
56
- }, id, /*#__PURE__*/_jsx__default['default'](styled.StyledItemWrapper, {}, void 0, /*#__PURE__*/jsxRuntime.jsx(styled.StyledItem, {
53
+ }, id, /*#__PURE__*/_jsx__default["default"](styled.StyledItemWrapper, {}, void 0, /*#__PURE__*/jsxRuntime.jsx(styled.StyledItem, {
57
54
  ref: visibleItemsRefs.current[id],
58
55
  tabIndex: expandedForAnimation ? -1 : 0,
59
56
  expanded: expandedForAnimation,
@@ -64,41 +61,36 @@ const LeftNavFooterItem = props => {
64
61
  cols: expandedForAnimation ? ['auto', '1fr', 'auto'] : ['38px'],
65
62
  onClick: expandedForAnimation ? () => null : handleOnClick,
66
63
  onKeyDown: onKeyDown,
67
- focused: focusedItem === id,
68
- focusedByKey: focusedByKey,
69
64
  onFocus: () => setFocusedItem(id),
70
65
  "data-testid": "leftnav-item-container",
71
66
  role: "menuitem",
72
- "aria-label": expandedForAnimation ? `Footer, ${footerLabel}` : `Expand left navigation`,
73
- children: !expandedForAnimation ? /*#__PURE__*/_jsx__default['default'](MenuExpand__default['default'], {
67
+ "aria-label": expandedForAnimation ? "Footer, ".concat(footerLabel) : "Expand left navigation",
68
+ children: !expandedForAnimation ? /*#__PURE__*/_jsx__default["default"](dsIcons.MenuExpand, {
74
69
  size: "m",
75
70
  color: ['brand-primary', 800],
76
71
  "data-testid": "leftnav-footer-btn"
77
72
  }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
78
- children: [/*#__PURE__*/_jsx__default['default'](styled.StyledLabel, {
73
+ children: [/*#__PURE__*/_jsx__default["default"](styled.StyledLabel, {
79
74
  mt: "5px",
80
75
  mr: "12px",
81
76
  mb: "16px",
82
77
  "data-testid": "leftnav-itemlabel",
83
- labelOverflow: labelOverflow
84
- }, void 0, labelOverflow === 'truncate' ? /*#__PURE__*/_jsx__default['default'](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
78
+ labelOverflow: labelOverflow,
79
+ "aria-live": "polite"
80
+ }, void 0, labelOverflow === 'truncate' ? /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
85
81
  value: footerLabel,
86
82
  placement: "bottom-start"
87
- }) : footerLabel), _StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx__default['default'](styled.StyledSeparator, {
83
+ }) : footerLabel), _StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx__default["default"](styled.StyledSeparator, {
88
84
  mt: "xxxs"
89
- })), /*#__PURE__*/_jsx__default['default'](Grid__default['default'], {
85
+ })), /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
90
86
  m: "0 12px"
91
- }, void 0, /*#__PURE__*/_jsx__default['default'](styled.StyledMenuCollapse, {
87
+ }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledMenuCollapse, {
92
88
  size: "m",
93
89
  color: ['brand-primary', 800],
94
90
  onClick: e => {
95
- if (openedItem) setSelectedItem(openedItem);
96
91
  e.stopPropagation();
97
92
  handleOnClick(e);
98
93
  },
99
- onKeyDown: e => {
100
- if (['Space', 'Enter'].includes(e.code) && openedItem) setSelectedItem(openedItem);
101
- },
102
94
  "data-testid": "leftnav-footer-btn",
103
95
  tabIndex: 0,
104
96
  onFocus: e => {
@@ -113,4 +105,4 @@ const LeftNavFooterItem = props => {
113
105
  };
114
106
 
115
107
  exports.LeftNavFooterItem = LeftNavFooterItem;
116
- exports['default'] = LeftNavFooterItem;
108
+ exports["default"] = LeftNavFooterItem;
@@ -3,9 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var styled = require('styled-components');
6
- var dsBasic = require('@elliemae/ds-basic');
6
+ var Grid = require('@elliemae/ds-grid');
7
7
  var dsIcons = require('@elliemae/ds-icons');
8
- var getFocusedByKeyboardStyle = require('../../common/getFocusedByKeyboardStyle.js');
9
8
  var getItemBackgroundStyle = require('../../common/getItemBackgroundStyle.js');
10
9
  var getLeftBorderStyle = require('../../common/getLeftBorderStyle.js');
11
10
 
@@ -13,24 +12,24 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
13
12
 
14
13
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
15
14
 
16
- const StyledFooterMenu = /*#__PURE__*/styled__default['default'](dsBasic.Grid).withConfig({
15
+ const StyledFooterMenu = /*#__PURE__*/styled__default["default"](Grid.Grid).withConfig({
17
16
  componentId: "sc-1mcbjxr-0"
18
17
  })(["width:100%;margin-top:auto;background:", ";", " border-top:1px solid ", ";"], props => props.theme.colors.neutral['000'], getLeftBorderStyle.getLeftBorderStyle, props => props.theme.colors.neutral[100]);
19
- const StyledItemWrapper = /*#__PURE__*/styled__default['default'](dsBasic.Grid).withConfig({
18
+ const StyledItemWrapper = /*#__PURE__*/styled__default["default"](Grid.Grid).withConfig({
20
19
  componentId: "sc-1mcbjxr-1"
21
20
  })(["position:relative;padding-left:", ";"], props => props.theme.space.xxxs);
22
- const StyledItem = /*#__PURE__*/styled__default['default'](dsBasic.Grid).withConfig({
21
+ const StyledItem = /*#__PURE__*/styled__default["default"](Grid.Grid).withConfig({
23
22
  componentId: "sc-1mcbjxr-2"
24
- })(["min-height:48px;cursor:", ";", " outline:none;", ""], props => props.expanded ? 'auto' : 'pointer', getItemBackgroundStyle.getItemBackgroundStyle, getFocusedByKeyboardStyle.getFocusedByKeyboardBorderStyle);
25
- const StyledLabel = /*#__PURE__*/styled__default['default'](dsBasic.Grid).withConfig({
23
+ })(["min-height:48px;cursor:", ";", " outline:none;:focus{&:before{content:'';position:absolute;height:100%;width:100%;top:0;left:0px;border:2px solid ", ";pointer-events:none;}}"], props => props.expanded ? 'auto' : 'pointer', getItemBackgroundStyle.getItemBackgroundStyle, props => props.theme.colors.brand[600]);
24
+ const StyledLabel = /*#__PURE__*/styled__default["default"](Grid.Grid).withConfig({
26
25
  componentId: "sc-1mcbjxr-3"
27
26
  })(["font-size:11px;color:", ";line-height:14px;word-break:", ";"], props => props.theme.colors.neutral[500], props => props.labelOverflow === 'wrapAll' ? 'break-all' : 'normal');
28
- const StyledSeparator = /*#__PURE__*/styled__default['default'](dsBasic.Grid).withConfig({
27
+ const StyledSeparator = /*#__PURE__*/styled__default["default"](Grid.Grid).withConfig({
29
28
  componentId: "sc-1mcbjxr-4"
30
29
  })(["height:16px;width:1px;background-color:", ";"], props => props.theme.colors.neutral[100]);
31
- const StyledMenuCollapse = /*#__PURE__*/styled__default['default'](dsIcons.MenuCollapse).withConfig({
30
+ const StyledMenuCollapse = /*#__PURE__*/styled__default["default"](dsIcons.MenuCollapse).withConfig({
32
31
  componentId: "sc-1mcbjxr-5"
33
- })(["cursor:pointer;:focus{outline:1px solid ", ";}"], props => props.theme.colors.brand[800]);
32
+ })(["cursor:pointer;:focus{outline:2px solid ", ";}"], props => props.theme.colors.brand[700]);
34
33
 
35
34
  exports.StyledFooterMenu = StyledFooterMenu;
36
35
  exports.StyledItem = StyledItem;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  require('react');
7
- var DSCircularProgressIndicator = require('@elliemae/ds-basic/CircularProgressIndicator');
7
+ var DSCircularProgressIndicator = require('@elliemae/ds-circular-progress-indicator');
8
8
  var Grid = require('@elliemae/ds-grid');
9
9
  var styled = require('styled-components');
10
10
 
@@ -15,17 +15,20 @@ var DSCircularProgressIndicator__default = /*#__PURE__*/_interopDefaultLegacy(DS
15
15
  var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
16
16
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
17
17
 
18
- const StyledLoaderWrapper = /*#__PURE__*/styled__default['default'](Grid__default['default']).withConfig({
18
+ const StyledLoaderWrapper = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
19
19
  componentId: "sc-mqgtxd-0"
20
20
  })(["grid-area:left-nav-body;height:100%;place-items:center;z-index:0;background-color:white;"]);
21
- const LeftNavLoading = ({
22
- expanded
23
- }) => /*#__PURE__*/_jsx__default['default'](StyledLoaderWrapper, {}, void 0, /*#__PURE__*/_jsx__default['default'](DSCircularProgressIndicator__default['default'], {
24
- size: expanded ? 'xl' : 'm',
25
- loading: true,
26
- showLabel: expanded,
27
- waiting: false,
28
- showTooltip: !expanded
29
- }));
21
+ const LeftNavLoading = _ref => {
22
+ let {
23
+ expanded
24
+ } = _ref;
25
+ return /*#__PURE__*/_jsx__default["default"](StyledLoaderWrapper, {}, void 0, /*#__PURE__*/_jsx__default["default"](DSCircularProgressIndicator__default["default"], {
26
+ size: expanded ? 'xl' : 'm',
27
+ loading: true,
28
+ showLabel: expanded,
29
+ waiting: false,
30
+ showTooltip: !expanded
31
+ }));
32
+ };
30
33
 
31
34
  exports.LeftNavLoading = LeftNavLoading;
@@ -2,6 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ require('core-js/modules/esnext.async-iterator.filter.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.filter.js');
8
+ require('core-js/modules/esnext.async-iterator.for-each.js');
9
+ require('core-js/modules/esnext.iterator.for-each.js');
5
10
  var _jsx = require('@babel/runtime/helpers/jsx');
6
11
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
12
  var React = require('react');
@@ -16,7 +21,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
16
21
 
17
22
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
18
23
 
19
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
24
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
20
25
  const OutOfTheBoxMapItem = props => {
21
26
  const {
22
27
  item,
@@ -25,11 +30,11 @@ const OutOfTheBoxMapItem = props => {
25
30
  Component
26
31
  }
27
32
  } = props;
28
- const ctx = React__default['default'].useContext(LeftNavigationContext.LeftNavContext);
33
+ const ctx = React__default["default"].useContext(LeftNavigationContext.LeftNavContext);
29
34
 
30
35
  if (typeof type === 'string' && !!index.outOfTheBoxComponents[type]) {
31
36
  const OutOfTheBoxComponent = index.outOfTheBoxComponents[type];
32
- return /*#__PURE__*/_jsx__default['default'](OutOfTheBoxComponent, {
37
+ return /*#__PURE__*/_jsx__default["default"](OutOfTheBoxComponent, {
33
38
  item: _objectSpread({
34
39
  itemOpts: {}
35
40
  }, item),
@@ -38,7 +43,7 @@ const OutOfTheBoxMapItem = props => {
38
43
  } // we expect an error to be threw if Component is not defined and type is not a valid out-of-the-box...
39
44
 
40
45
 
41
- return /*#__PURE__*/_jsx__default['default'](Component, {
46
+ return /*#__PURE__*/_jsx__default["default"](Component, {
42
47
  item: item,
43
48
  ctx: ctx
44
49
  });
package/cjs/prop-types.js CHANGED
@@ -27,7 +27,8 @@ const leftNavigationProps = {
27
27
  onFooterClose: reactDesc.PropTypes.func.description('The function to call when the left-nav is closed via the footer'),
28
28
  onSelectedChange: reactDesc.PropTypes.func.description('A callback which triggers when the selected item changes').defaultValue(() => null),
29
29
  onFocusChange: reactDesc.PropTypes.func.description('A callback which triggers when the focused item changes').defaultValue(() => null),
30
- items: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.object).description('The array of items you want to render inside the left nav').defaultValue([])
30
+ items: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.object).description('The array of items you want to render inside the left nav').defaultValue([]),
31
+ disableDefaultSelection: reactDesc.PropTypes.bool.description('Whether you do not want to automatically select the first body item').defaultValue(false)
31
32
  };
32
33
 
33
34
  const LeftNavItemProps = () => null;
@@ -19,12 +19,8 @@ const defaultContext = {
19
19
  leftNavProps: defaultProps,
20
20
  selectedItem: null,
21
21
  setSelectedItem: () => null,
22
- selectedSubitem: null,
23
- setSelectedSubitem: () => null,
24
22
  focusedItem: null,
25
23
  setFocusedItem: () => null,
26
- focusedByKey: false,
27
- setFocusedByKey: () => null,
28
24
  expandedForAnimation: true,
29
25
  openedDrilldowns: [],
30
26
  setOpenedDrilldowns: () => null,
@@ -1,15 +1,4 @@
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
- `;
1
+ const commonItemBackgroundStyle = (color, hoverColor, activeColor) => "\n\n background: ".concat(color, ";\n\n :hover {\n background: ").concat(hoverColor, ";\n }\n\n :active {\n background: ").concat(activeColor, ";\n }\n");
13
2
 
14
3
  const getItemBackgroundStyle = props => {
15
4
  if (props.selected && !props.opened) return commonItemBackgroundStyle(props.theme.colors.brand[200], props.theme.colors.brand[200], props.theme.colors.brand[200]);
@@ -1,22 +1,8 @@
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
- `;
1
+ const commonLeftBorderStyle = (color, hoverColor, activeColor) => "\n\n -webkit-box-shadow: inset 4px 0 0 0 ".concat(color, ";\n box-shadow: inset 4px 0 0 0 ").concat(color, ";\n\n :hover {\n -webkit-box-shadow: inset 4px 0 0 0 ").concat(hoverColor, ";\n box-shadow: inset 4px 0 0 0 ").concat(hoverColor, ";\n }\n\n :active {\n -webkit-box-shadow: inset 4px 0 0 0 ").concat(activeColor, ";\n box-shadow: inset 4px 0 0 0 ").concat(activeColor, ";\n }\n");
16
2
 
17
3
  const getLeftBorderStyle = props => {
18
- if (props.selected) return commonLeftBorderStyle(props.theme.colors.brand[400], props.theme.colors.brand[400], props.theme.colors.brand[400]);
19
- return commonLeftBorderStyle(props.theme.colors.neutral['000'], props.theme.colors.neutral[300], props.theme.colors.brand[400]);
4
+ if (props.selected || props.selectedParent) return commonLeftBorderStyle(props.theme.colors.brand[400], props.theme.colors.brand[400], props.theme.colors.brand[400]);
5
+ return commonLeftBorderStyle(props.theme.colors.neutral['000'], props.theme.colors.brand[300], props.theme.colors.brand[400]);
20
6
  };
21
7
 
22
8
  export { getLeftBorderStyle };
@@ -1,26 +1,3 @@
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
- `;
1
+ const getScrolbarStyle = () => "\n ::-webkit-scrollbar {\n width: 14px;\n }\n ::-webkit-scrollbar-thumb {\n height: 6px;\n border: 4px solid rgba(0, 0, 0, 0);\n\n background-clip: padding-box;\n\n background-color: rgba(105, 116, 137, 0.5);\n\n border-radius: 7px;\n -webkit-border-radius: 7px;\n }\n ::-webkit-scrollbar-button {\n width: 0;\n height: 0;\n display: none;\n }\n ::-webkit-scrollbar-corner {\n background-color: transparent;\n }\n";
25
2
 
26
3
  export { getScrolbarStyle };
@@ -1,4 +1,3 @@
1
- export { getFocusedByKeyboardBorderStyle } from './getFocusedByKeyboardStyle.js';
2
1
  export { getItemBackgroundStyle } from './getItemBackgroundStyle.js';
3
2
  export { getLeftBorderStyle } from './getLeftBorderStyle.js';
4
3
  export { getScrolbarStyle } from './getScrollbarStyle.js';
@@ -1,5 +1,5 @@
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
1
2
  import React from 'react';
2
- import { useGlobalKeyListeners } from './useGlobalKeyListeners.js';
3
3
  import { useLeftNavItems } from './useLeftNavItems.js';
4
4
  import { useLeftNavSmoothExpand } from './useLeftNavSmoothExpand.js';
5
5
  import { useSelectFirstBodyItem } from '../hooks/useSelectFirstBodyItem.js';
@@ -18,10 +18,10 @@ const useLeftNavConfig = props => {
18
18
  // Selection related
19
19
 
20
20
  const [selectedItem, setSelectedItem] = React.useState(null);
21
- const [selectedSubitem, setSelectedSubitem] = React.useState(null); // Focus related
21
+ React.useState(null);
22
+ const [selectedParent, setSelectedParent] = React.useState(null); // Focus related
22
23
 
23
- const [focusedItem, setFocusedItem] = React.useState(null);
24
- const [focusedByKey, setFocusedByKey] = React.useState(true); // Opened uncontrolled drilldowns
24
+ const [focusedItem, setFocusedItem] = React.useState(null); // Opened uncontrolled drilldowns
25
25
 
26
26
  const [openedDrilldowns, setOpenedDrilldowns] = React.useState([]); // -----------------------------------------------------------------------------
27
27
  // ************************** ------------ **************************
@@ -37,24 +37,19 @@ const useLeftNavConfig = props => {
37
37
  }), [expandedForAnimation, timeoutRef, setExpandedForAnimation]);
38
38
  useLeftNavSmoothExpand(props, smoothExpandOpts); // -----------------------------------------------------------------------------
39
39
  // ************************** ------------ **************************
40
- // * KEYBOARD *
41
- // ************************** ------------ **************************
42
-
43
- const globalKeyOpts = React.useMemo(() => ({
44
- setFocusedByKey
45
- }), [setFocusedByKey]);
46
- useGlobalKeyListeners(globalKeyOpts); // -----------------------------------------------------------------------------
47
- // ************************** ------------ **************************
48
40
  // * SIDE EFFECTS *
49
41
  // ************************** ------------ **************************
50
42
 
51
43
  React.useEffect(() => {
52
44
  onSelectedChange(selectedItem);
53
45
  }, [selectedItem, onSelectedChange]);
46
+ React.useEffect(() => {
47
+ if (openedItem !== null) setSelectedParent(openedItem);
48
+ }, [openedItem]);
54
49
  React.useEffect(() => {
55
50
  onFocusChange(focusedItem);
56
- }, [focusedItem, setFocusedItem]);
57
- useSelectFirstBodyItem(items, openedItem, setSelectedItem); // -----------------------------------------------------------------------------
51
+ }, [focusedItem, onFocusChange]);
52
+ useSelectFirstBodyItem(items, openedItem, props.selectedItem !== undefined ? props.selectedItem : selectedItem, setSelectedItem, props.disableDefaultSelection); // -----------------------------------------------------------------------------
58
53
  // ************************** ------------ **************************
59
54
  // * ITEMS MANAGEMENT *
60
55
  // ************************** ------------ **************************
@@ -64,7 +59,7 @@ const useLeftNavConfig = props => {
64
59
  bodyHeaderItem: props.BodyHeaderComponent,
65
60
  items: props.items,
66
61
  openedDrilldowns
67
- }), [props.items, openedDrilldowns]); // We need to know the current visible items since we have drilldowns
62
+ }), [props.HeaderComponent, props.BodyHeaderComponent, props.items, openedDrilldowns]); // We need to know the current visible items since we have drilldowns
68
63
 
69
64
  const {
70
65
  visibleItems,
@@ -77,19 +72,17 @@ const useLeftNavConfig = props => {
77
72
  const finalConfig = React.useMemo(() => ({
78
73
  leftNavProps: props,
79
74
  expandedForAnimation,
80
- selectedItem,
75
+ selectedItem: props.selectedItem !== undefined ? props.selectedItem : selectedItem,
81
76
  setSelectedItem,
82
- selectedSubitem,
83
- setSelectedSubitem,
77
+ selectedParent: props.selectedParent !== undefined ? props.selectedParent : selectedParent,
78
+ setSelectedParent,
84
79
  focusedItem,
85
80
  setFocusedItem,
86
- focusedByKey,
87
- setFocusedByKey,
88
81
  openedDrilldowns,
89
82
  setOpenedDrilldowns,
90
83
  visibleItems,
91
84
  visibleItemsRefs
92
- }), [props, props.items, expandedForAnimation, selectedItem, setSelectedItem, selectedSubitem, setSelectedSubitem, focusedItem, setFocusedItem, focusedByKey, setFocusedByKey, openedDrilldowns, setOpenedDrilldowns, visibleItems, visibleItemsRefs]);
85
+ }), [props, expandedForAnimation, selectedItem, setSelectedItem, setSelectedParent, selectedParent, focusedItem, setFocusedItem, openedDrilldowns, setOpenedDrilldowns, visibleItems, visibleItemsRefs]);
93
86
  return finalConfig;
94
87
  };
95
88
 
@@ -1,34 +1,34 @@
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';
1
5
  import { useMemo, useRef, createRef } from 'react';
2
6
  import { ITEM_TYPES, FOOTER_DS_ID } from '../exported-related/constants.js';
3
7
  import '@babel/runtime/helpers/esm/jsx';
4
8
  import '@elliemae/ds-grid';
5
9
  import 'styled-components';
10
+ import 'core-js/modules/esnext.async-iterator.filter.js';
11
+ import 'core-js/modules/esnext.iterator.filter.js';
6
12
  import '@babel/runtime/helpers/esm/defineProperty';
7
13
  import 'react/jsx-runtime';
8
- import '@elliemae/ds-icons/ChevronSmallRight';
9
- import '@elliemae/ds-icons/Notifications';
10
- import '@elliemae/ds-icons/ExceptionsSmallFill';
11
- import '@elliemae/ds-icons/AlertsSmallFill';
12
- import '@elliemae/ds-icons/MessagesSmallFill';
13
- import '@elliemae/ds-icons/OpenWindow';
14
+ import '@elliemae/ds-icons';
14
15
 
15
- /* eslint-disable complexity */
16
16
  const notFocuseableItems = [ITEM_TYPES.LEFT_NAV_ITEM_SEPARATOR, ITEM_TYPES.LEFT_NAV_ITEM_SECTION]; // Walks the array of items
17
17
  // Drilldowns are tree-like structures
18
18
 
19
19
  const walkItems = (items, openedDrilldowns, callback) => {
20
20
  items.forEach(item => {
21
21
  if (typeof item.type === 'string') {
22
- var _item$itemOpts, _item$itemOpts2, _item$itemOpts3;
22
+ var _item$itemOpts$items, _item$itemOpts, _item$itemOpts2, _item$itemOpts$items2, _item$itemOpts3;
23
23
 
24
24
  // Out of the box item
25
25
  if (notFocuseableItems.includes(item.type)) return; // not focuseable
26
26
 
27
27
  callback(item.dsId); // If it's an opened uncontrolled drilldown
28
28
 
29
- if (item.type === ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN && openedDrilldowns.includes(item.dsId)) walkItems(((_item$itemOpts = item.itemOpts) === null || _item$itemOpts === void 0 ? void 0 : _item$itemOpts.items) ?? [], openedDrilldowns, callback); // If it's an opened controlled drilldown
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
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$itemOpts3 = item.itemOpts) === null || _item$itemOpts3 === void 0 ? void 0 : _item$itemOpts3.items) ?? [], openedDrilldowns, callback);
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);
32
32
  } else {
33
33
  var _item$itemOpts4;
34
34
 
@@ -62,7 +62,7 @@ const useLeftNavItems = props => {
62
62
  });
63
63
  visibleItemsArray.push(FOOTER_DS_ID);
64
64
  return visibleItemsArray;
65
- }, [props]);
65
+ }, [items, openedDrilldowns]);
66
66
  visibleItems.forEach(dsId => {
67
67
  if (!(dsId in visibleItemsRefs.current)) visibleItemsRefs.current[dsId] = /*#__PURE__*/createRef();
68
68
  });
@@ -1,12 +1,17 @@
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';
1
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
7
  import 'react';
3
- import ChevronRight from '@elliemae/ds-icons/ChevronSmallRight';
8
+ import { ChevronSmallRight } from '@elliemae/ds-icons';
4
9
  import { jsx } from 'react/jsx-runtime';
5
10
 
6
11
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7
12
 
8
13
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
9
- const ChevronItem = props => /*#__PURE__*/jsx(ChevronRight, _objectSpread({
14
+ const ChevronItem = props => /*#__PURE__*/jsx(ChevronSmallRight, _objectSpread({
10
15
  size: "m",
11
16
  color: ['brand-primary', 800]
12
17
  }, props));
@@ -1,3 +1,8 @@
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';
1
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
7
  import 'react';
3
8
  import styled from 'styled-components';
@@ -19,7 +19,9 @@ const ItemRenderer = props => {
19
19
  indent,
20
20
  ariaLabel,
21
21
  ariaRole,
22
- ariaExpanded
22
+ ariaLive,
23
+ ariaExpanded,
24
+ ariaDescribedBy
23
25
  },
24
26
  CollapsedComponent
25
27
  },
@@ -39,10 +41,9 @@ const ItemRenderer = props => {
39
41
  openedItem
40
42
  },
41
43
  expandedForAnimation,
42
- focusedByKey,
44
+ selectedParent,
43
45
  selectedItem,
44
46
  setSelectedItem,
45
- focusedItem,
46
47
  setFocusedItem,
47
48
  visibleItemsRefs
48
49
  } = ctx;
@@ -62,7 +63,6 @@ const ItemRenderer = props => {
62
63
  });
63
64
  const cols = useMemo(() => expandedForAnimation ? ['auto', '1fr', 'auto'] : ['38px'], [expandedForAnimation]);
64
65
  const isSelected = useMemo(() => selectedItem === dsId, [selectedItem, dsId]);
65
- const isFocused = useMemo(() => focusedItem === dsId, [focusedItem, dsId]);
66
66
 
67
67
  if (!expandedForAnimation && !CollapsedComponent) {
68
68
  return null;
@@ -70,30 +70,33 @@ const ItemRenderer = props => {
70
70
 
71
71
  return /*#__PURE__*/jsxs(Fragment, {
72
72
  children: [/*#__PURE__*/_jsx(StyledItemWrapper, {
73
- shadowStyle: shadowStyle,
73
+ shadowStyle: shadowStyle(opened, item.type),
74
74
  "data-testid": "leftnav-item-wrapper"
75
75
  }, void 0, /*#__PURE__*/jsx(StyledItem, {
76
76
  ref: visibleItemsRefs.current[dsId],
77
77
  pt: paddingTop,
78
- pl: indent === undefined ? 'xxxs' : `${indent}px`,
78
+ pl: indent === undefined ? 'xxxs' : "".concat(indent, "px"),
79
79
  minHeight: minHeight,
80
- shadowStyle: shadowStyle,
80
+ shadowStyle: shadowStyle(opened, item.type),
81
81
  alignItems: "flex-start",
82
82
  cols: cols,
83
83
  onClick: !opened ? handleOnClick : () => null,
84
84
  onKeyDown: onKeyDown,
85
85
  selectable: selectable,
86
86
  selected: isSelected,
87
+ selectedParent: selectedParent === dsId,
87
88
  opened: opened,
88
- focused: isFocused,
89
- focusedByKey: focusedByKey,
90
89
  onFocus: handleFocus,
91
90
  "data-testid": "leftnav-item-container",
92
91
  tabIndex: focuseable ? 0 : -1,
92
+ "aria-describedby": ariaDescribedBy,
93
93
  "aria-expanded": ariaExpanded,
94
94
  role: ariaRole,
95
+ "data-selected": isSelected,
96
+ "data-selectedparent": selectedParent === dsId,
95
97
  "aria-label": ariaLabel,
96
98
  "aria-hidden": !focuseable,
99
+ "aria-live": ariaLive,
97
100
  children: !expandedForAnimation ? /*#__PURE__*/_jsx(Grid, {
98
101
  "data-testid": "leftnav-leftcomponent",
99
102
  justifyContent: "center"
@@ -106,7 +109,7 @@ const ItemRenderer = props => {
106
109
  marginLeft: opened ? '16px' : '0px',
107
110
  marginRight: borderBottomMr,
108
111
  height: '1px',
109
- width: `calc(100% - ${borderBottomMr} - ${opened ? '16px' : '0px'})`,
112
+ width: "calc(100% - ".concat(borderBottomMr, " - ").concat(opened ? '16px' : '0px', ")"),
110
113
  backgroundColor: '#E0E3E8'
111
114
  }
112
115
  })), subitems]