@symply.io/basic-components 1.1.0-beta.1 → 1.1.1-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.
- package/README.md +1 -0
- package/Sidebar/SidebarItem.js +4 -6
- package/Sidebar/SidebarItemsGroup.js +2 -2
- package/Sidebar/index.js +2 -2
- package/Sidebar/types.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -258,6 +258,7 @@ import BasicTable, { useTable } from '@symply.io/basic-components/BasicTable';
|
|
258
258
|
| footers | Array\<FooterProps> | [] | false | The cells for the footer. (from the hook) |
|
259
259
|
| onRowClick | func | | false | The function for row clicking. |
|
260
260
|
| noDataText | string | 'No Data!' | false | The text when no data rendered. |
|
261
|
+
| rowHeight | string \| number | 60 | false | The height of each row. |
|
261
262
|
| rows | Array<RowProps\> | | true | The rows for the table. (from the hook) |
|
262
263
|
|
263
264
|
|
package/Sidebar/SidebarItem.js
CHANGED
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
|
|
9
9
|
};
|
10
10
|
return __assign.apply(this, arguments);
|
11
11
|
};
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
13
13
|
import colorAlpha from "color-alpha";
|
14
14
|
import Chip from "@mui/material/Chip";
|
15
15
|
import ListItem from "@mui/material/ListItem";
|
@@ -20,7 +20,7 @@ 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 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, _b = props.showIconOnly, showIconOnly = _b === void 0 ? false : _b, onClick = props.onClick;
|
24
24
|
var theme = useTheme();
|
25
25
|
return (_jsxs(ListItem, __assign({ button: true, onClick: onClick, disabled: lock, sx: {
|
26
26
|
paddingLeft: isSub ? theme.spacing(4) : undefined,
|
@@ -47,15 +47,13 @@ function SidebarItem(props) {
|
|
47
47
|
opacity: active ? "1" : undefined,
|
48
48
|
fontWeight: active ? 600 : undefined
|
49
49
|
}
|
50
|
-
}, primary: name }), lock && (_jsx(LockIcon, { fontSize: "small", color: "error", sx: {
|
51
|
-
fontSize: "1rem"
|
52
|
-
}, "data-nw": "".concat(name, "_lock") })), beta && (_jsx(Chip, { label: "BETA", color: "primary", size: "small", sx: {
|
50
|
+
}, primary: name }), lock && !showIconOnly ? (_jsx(LockIcon, { fontSize: "small", color: "error", sx: { fontSize: "1rem" } })) : (_jsx(_Fragment, {})), beta && !showIconOnly ? (_jsx(Chip, { label: "BETA", color: "primary", size: "small", sx: {
|
53
51
|
borderRadius: theme.spacing(0.5),
|
54
52
|
backgroundColor: betaTagColor,
|
55
53
|
color: "white",
|
56
54
|
height: theme.spacing(2.5),
|
57
55
|
fontSize: theme.spacing(1.25),
|
58
56
|
padding: theme.spacing(0, 0.75)
|
59
|
-
} })), hasChildren && (expand ? _jsx(ExpandMoreIcon, {}) : _jsx(ChevronRightIcon, {}))] })));
|
57
|
+
} })) : (_jsx(_Fragment, {})), hasChildren && !showIconOnly ? (expand ? (_jsx(ExpandMoreIcon, {})) : (_jsx(ChevronRightIcon, {}))) : (_jsx(_Fragment, {}))] })));
|
60
58
|
}
|
61
59
|
export default SidebarItem;
|
@@ -18,7 +18,7 @@ import useTheme from "@mui/material/styles/useTheme";
|
|
18
18
|
import SidebarItem from "./SidebarItem";
|
19
19
|
import SidebarLink from "./SidebarLink";
|
20
20
|
function SidebarItemsGroup(props) {
|
21
|
-
var item = props.item;
|
21
|
+
var item = props.item, showIconOnly = props.showIconOnly;
|
22
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 () {
|
@@ -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, { 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)); }) })) })))] }));
|
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, showIconOnly: showIconOnly, 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, showIconOnly: showIconOnly, isSub: true })); } }), c.name)); }) })) })))] }));
|
36
36
|
}
|
37
37
|
export default memo(SidebarItemsGroup);
|
package/Sidebar/index.js
CHANGED
@@ -18,11 +18,11 @@ import SidebarItem from "./SidebarItem";
|
|
18
18
|
import SidebarItemsGroup from "./SidebarItemsGroup";
|
19
19
|
import SidebarLink from "./SidebarLink";
|
20
20
|
function Sidebar(props) {
|
21
|
-
var items = props.items, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
21
|
+
var items = props.items, showIconOnly = props.showIconOnly, 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
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));
|
25
|
+
return children ? (_jsx(SidebarItemsGroup, { item: i, showIconOnly: showIconOnly }, 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, showIconOnly: showIconOnly, titleForLock: titleForLock, active: prop.match !== null, betaTagColor: betaTagColor }, name)); } }), name));
|
26
26
|
}) }) })));
|
27
27
|
}
|
28
28
|
export default Sidebar;
|
package/Sidebar/types.d.ts
CHANGED
@@ -14,6 +14,7 @@ export interface SidebarBaseProps extends SidebarItemBaseProps {
|
|
14
14
|
}
|
15
15
|
export interface SidebarProps {
|
16
16
|
items: Array<SidebarBaseProps>;
|
17
|
+
showIconOnly?: boolean;
|
17
18
|
primaryColor?: CSSProperties["color"];
|
18
19
|
secondaryColor?: CSSProperties["color"];
|
19
20
|
}
|
@@ -22,6 +23,7 @@ export interface SidebarItemProps extends Omit<SidebarItemBaseProps, "path"> {
|
|
22
23
|
expand?: boolean;
|
23
24
|
isSub?: boolean;
|
24
25
|
hasChildren?: boolean;
|
26
|
+
showIconOnly?: boolean;
|
25
27
|
onClick?: () => void;
|
26
28
|
}
|
27
29
|
export interface SidebarLinkProps extends SidebarItemProps {
|
@@ -29,4 +31,5 @@ export interface SidebarLinkProps extends SidebarItemProps {
|
|
29
31
|
}
|
30
32
|
export interface SidebarItemsGroupProps {
|
31
33
|
item: SidebarBaseProps;
|
34
|
+
showIconOnly?: boolean;
|
32
35
|
}
|