UNPKG

@nexusui/components

Version:

These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.

2 lines (1 loc) 2.48 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@mui/material/Typography"),t=require("@mui/icons-material/FolderOpen"),s=require("@mui/icons-material/StickyNote2Outlined"),a=require("@mui/icons-material/KeyboardBackspaceOutlined"),i=require("@mui/icons-material/EditNote"),o=require("@mui/material/ListItem"),n=require("@mui/material/ListItemText"),l=require("@mui/material/useMediaQuery"),c=require("clsx"),d=require("./ProjectSidebar.styles.js"),u=require("../locales/index.js"),m=require("./locale.json.js"),p=require("../Drawer/Drawer.container.js"),x=require("../Drawer/components/DrawerHeader/DrawerHeader.container.js"),j=require("../Drawer/components/DrawerContent/DrawerContent.container.js"),f=require("../Drawer/components/DrawerSection/DrawerSection.container.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=y(r),w=y(t),q=y(s),D=y(a),b=y(i),S=y(o),N=y(n),$=y(l),g=y(c);const T="NexusProjectSidebar";exports.DrawerWidth=256,exports.HeaderHeight=56,exports.ProjectSidebarComponents=r=>{const{open:t=!0,menuItems:s,projectsTitle:a,projects:i=[],emptyText:o,onMenuToggle:n,...l}=r,c=u.useTranslate(m.default),y=$.default("(max-width:900px)");return e.jsxs(p.Drawer,{open:t,width:y?1:256,...l,className:`${T}-root`,children:[y&&n&&e.jsx(x.DrawerHeader,{sx:[d.styles.header,{height:"56px"}],label:c("back"),icon:e.jsx(D.default,{}),onIconClick:n,className:`${T}-header`,"data-testid":`${T}-header`}),e.jsxs(j.DrawerContent,{sx:[d.styles.content,{height:y?"calc(100% - 56px)":1}],className:`${T}-content`,children:[(!s||s.length>0)&&e.jsx(f.DrawerSection,{sx:d.styles.section,dense:!0,items:s||[{nodeId:"projects",label:c("projects"),icon:e.jsx(w.default,{fontSize:"small"})},{nodeId:"documents",label:c("documents"),icon:e.jsx(q.default,{fontSize:"small"})},{nodeId:"drafts",label:c("drafts"),icon:e.jsx(b.default,{fontSize:"small"})}],divider:!0,className:`${T}-section`}),e.jsx(f.DrawerSection,{sx:[d.styles.section,d.styles.scrollable],dense:!0,header:e.jsx(h.default,{sx:d.styles.title,variant:"caption",className:g.default(`${T}-sectionTitle`,`${T}-section-title`),children:a||c("projectsTitle")}),items:i,className:`${T}-section`,children:0===i.length&&e.jsx(S.default,{className:g.default(`${T}-sectionEmpty`,`${T}-section-empty`),children:e.jsx(N.default,{primary:o||c("emptyProjects"),primaryTypographyProps:{color:"text.disabled"}})})})]})]})},exports.prefix=T;