@symply.io/basic-components 1.0.8 → 1.0.9-beta.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.
@@ -20,9 +20,9 @@ import useTheme from "@mui/material/styles/useTheme";
20
20
  import ChevronRightIcon from "@mui/icons-material/ChevronRight";
21
21
  import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
22
22
  function SidebarItem(props) {
23
- var icon = props.icon, name = props.name, active = props.active, expand = props.expand, lock = props.lock, beta = props.beta, isSub = props.isSub, hasChildren = props.hasChildren, _a = props.betaTagColor, betaTagColor = _a === void 0 ? "#00A2A9" : _a, onClick = props.onClick;
23
+ var id = props.id, icon = props.icon, name = props.name, active = props.active, expand = props.expand, lock = props.lock, beta = props.beta, isSub = props.isSub, hasChildren = props.hasChildren, _a = props.betaTagColor, betaTagColor = _a === void 0 ? "#00A2A9" : _a, onClick = props.onClick;
24
24
  var theme = useTheme();
25
- return (_jsxs(ListItem, __assign({ button: true, onClick: onClick, disabled: lock, sx: {
25
+ return (_jsxs(ListItem, __assign({ id: id, button: true, onClick: onClick, disabled: lock, sx: {
26
26
  paddingLeft: isSub ? theme.spacing(4) : undefined,
27
27
  display: "flex",
28
28
  width: "100%",
@@ -19,7 +19,7 @@ import SidebarItem from "./SidebarItem";
19
19
  import SidebarLink from "./SidebarLink";
20
20
  function SidebarItemsGroup(props) {
21
21
  var item = props.item;
22
- var name = item.name, path = item.path, icon = item.icon, children = item.children, lock = item.lock, beta = item.beta, titleForLock = item.titleForLock, betaTagColor = item.betaTagColor;
22
+ var id = item.id, name = item.name, path = item.path, icon = item.icon, children = item.children, lock = item.lock, beta = item.beta, titleForLock = item.titleForLock, betaTagColor = item.betaTagColor;
23
23
  var pathname = useLocation().pathname;
24
24
  var match = useMemo(function () {
25
25
  return pathname.includes(path);
@@ -32,6 +32,6 @@ function SidebarItemsGroup(props) {
32
32
  setExpand(match);
33
33
  }, [match]);
34
34
  var theme = useTheme();
35
- return (_jsxs(_Fragment, { children: [_jsx(List, __assign({ component: "div", disablePadding: true }, { children: _jsx(SidebarItem, { active: false, name: name, icon: icon, lock: lock, beta: beta, expand: expand, hasChildren: true, betaTagColor: betaTagColor, onClick: onToggleExpand }) })), children && (_jsx(Collapse, __assign({ in: expand, timeout: "auto" }, { children: _jsx(List, __assign({ component: "div", disablePadding: true }, { children: children.map(function (c) { return (_jsx(Match, __assign({ path: c.path }, { children: function (prop) { return (_jsx(SidebarLink, { name: c.name, path: c.path, icon: c.icon, lock: c.lock, beta: c.beta, titleForLock: titleForLock, active: prop.match !== null, betaTagColor: c.betaTagColor, isSub: true })); } }), c.name)); }) })) })))] }));
35
+ return (_jsxs(_Fragment, { children: [_jsx(List, __assign({ component: "div", disablePadding: true }, { children: _jsx(SidebarItem, { id: id, active: false, name: name, icon: icon, lock: lock, beta: beta, expand: expand, hasChildren: true, betaTagColor: betaTagColor, onClick: onToggleExpand }) })), children && (_jsx(Collapse, __assign({ in: expand, timeout: "auto" }, { children: _jsx(List, __assign({ component: "div", disablePadding: true }, { children: children.map(function (c) { return (_jsx(Match, __assign({ path: c.path }, { children: function (prop) { return (_jsx(SidebarLink, { id: c.id, name: c.name, path: c.path, icon: c.icon, lock: c.lock, beta: c.beta, titleForLock: titleForLock, active: prop.match !== null, betaTagColor: c.betaTagColor, isSub: true })); } }), c.name)); }) })) })))] }));
36
36
  }
37
37
  export default memo(SidebarItemsGroup);
package/Sidebar/index.js CHANGED
@@ -21,8 +21,8 @@ function Sidebar(props) {
21
21
  var items = props.items, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
22
22
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
23
23
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(List, { children: items.map(function (i) {
24
- var children = i.children, path = i.path, icon = i.icon, name = i.name, lock = i.lock, beta = i.beta, titleForLock = i.titleForLock, betaTagColor = i.betaTagColor;
25
- return children ? (_jsx(SidebarItemsGroup, { item: i }, name)) : (_jsx(Match, __assign({ path: path === "/" ? path : path.concat("/*") }, { children: function (prop) { return (_jsx(SidebarLink, { name: name, path: path, icon: icon, lock: lock, beta: beta, titleForLock: titleForLock, active: prop.match !== null, betaTagColor: betaTagColor }, name)); } }), name));
24
+ var id = i.id, children = i.children, path = i.path, icon = i.icon, name = i.name, lock = i.lock, beta = i.beta, titleForLock = i.titleForLock, betaTagColor = i.betaTagColor;
25
+ return children ? (_jsx(SidebarItemsGroup, { item: i }, name)) : (_jsx(Match, __assign({ path: path === "/" ? path : path.concat("/*") }, { children: function (prop) { return (_jsx(SidebarLink, { id: id, name: name, path: path, icon: icon, lock: lock, beta: beta, titleForLock: titleForLock, active: prop.match !== null, betaTagColor: betaTagColor }, name)); } }), name));
26
26
  }) }) })));
27
27
  }
28
28
  export default Sidebar;
@@ -1,5 +1,6 @@
1
1
  import { CSSProperties, ReactElement } from "react";
2
2
  export interface SidebarItemBaseProps {
3
+ id?: string;
3
4
  path: string;
4
5
  name: string;
5
6
  lock?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.0.8",
3
+ "version": "1.0.9-beta.1",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",