grep-components 1.27.0-GREPF-2165.1 → 1.27.0-GREPF-2104.1

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.
@@ -4,6 +4,7 @@ export interface SidebarProps {
4
4
  currentPageId?: number;
5
5
  pages: NavigationProps[];
6
6
  onPageClick: (page: NavigationProps) => any;
7
+ expandAndClick?: boolean;
7
8
  }
8
- declare const Sidebar: ({ pages, onPageClick, currentPageId }: SidebarProps) => JSX.Element;
9
+ declare const Sidebar: ({ pages, onPageClick, currentPageId, expandAndClick }: SidebarProps) => JSX.Element;
9
10
  export default Sidebar;
@@ -12,3 +12,9 @@ export declare const Standard: {
12
12
  name: string;
13
13
  };
14
14
  };
15
+ export declare const ExpandAndClick: {
16
+ (): JSX.Element;
17
+ story: {
18
+ name: string;
19
+ };
20
+ };
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import { useTheme } from '@mui/material/styles';
12
12
  import { useHistory, NavLink, Prompt } from 'react-router-dom';
13
13
  import MenuIcon from '@mui/icons-material/Menu';
14
14
  import IconExpand from '@mui/icons-material/ExpandMore';
15
- import { ArrowForward, Info, ExpandMore, ExpandLess, Menu as Menu$1 } from '@mui/icons-material';
15
+ import { ArrowForward, Info, ExpandLess, ExpandMore, Menu as Menu$1 } from '@mui/icons-material';
16
16
  import ListItemIcon$1 from '@mui/material/ListItemIcon';
17
17
  import MoreVert from '@mui/icons-material/MoreVert';
18
18
  import { useDispatch, connect, Provider as Provider$1, useSelector } from 'react-redux';
@@ -4727,7 +4727,7 @@ var useStyles$6 = makeStyles()(function (_a, _props, classes) {
4727
4727
  });
4728
4728
 
4729
4729
  var Sidebar = function (_a) {
4730
- var pages = _a.pages, onPageClick = _a.onPageClick, currentPageId = _a.currentPageId;
4730
+ var pages = _a.pages, onPageClick = _a.onPageClick, currentPageId = _a.currentPageId, expandAndClick = _a.expandAndClick;
4731
4731
  var _b = __read(React.useState([]), 2), expanded = _b[0], setExpanded = _b[1];
4732
4732
  var classes = useStyles$6().classes;
4733
4733
  React.useEffect(function () {
@@ -4746,7 +4746,13 @@ var Sidebar = function (_a) {
4746
4746
  }
4747
4747
  };
4748
4748
  var handleClick = function (page) {
4749
- page.children ? toggleExpand(page.id) : onPageClick(page);
4749
+ if (expandAndClick) {
4750
+ toggleExpand(page.id);
4751
+ onPageClick(page);
4752
+ }
4753
+ else {
4754
+ page.children ? toggleExpand(page.id) : onPageClick(page);
4755
+ }
4750
4756
  };
4751
4757
  var renderItem = function (page) { return (React.createElement(React.Fragment, null,
4752
4758
  page.linkIcon && (React.createElement(ListItemIcon, { className: classes.icon }, page.linkIcon)),
@@ -4757,7 +4763,7 @@ var Sidebar = function (_a) {
4757
4763
  return (React.createElement("div", { key: page.id },
4758
4764
  React.createElement(ListItem$1, { key: page.id, tabIndex: 0, className: classes.item, onClick: function () { return handleClick(page); }, onKeyPress: keyboard.onActivation(function () { return handleClick(page); }) },
4759
4765
  renderItem(page),
4760
- page.children ? (expanded.includes(page.id) ? (React.createElement(ExpandMore, null)) : (React.createElement(ExpandLess, null))) : null),
4766
+ page.children ? (expanded.includes(page.id) ? (React.createElement(ExpandLess, null)) : (React.createElement(ExpandMore, null))) : null),
4761
4767
  React.createElement(Collapse, { in: expanded.includes(page.id), timeout: "auto", unmountOnExit: true },
4762
4768
  React.createElement(List$1, { disablePadding: true }, (_a = page.children) === null || _a === void 0 ? void 0 : _a.map(function (child) { return (React.createElement(ListItem$1, { key: child.id, style: { paddingLeft: '30px' }, tabIndex: 0, className: classes.item, onClick: function () { return handleClick(child); }, onKeyPress: keyboard.onActivation(function () { return handleClick(child); }) }, renderItem(child))); })))));
4763
4769
  }))));