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) 1.41 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@mui/material/Drawer"),n=require("react"),r=require("./DrawerContext.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=a(t);const s="NexusDrawer";exports.CONDENSED_WITHOUT_LABEL_WIDTH=56,exports.CONDENSED_WITH_LABEL_WIDTH=64,exports.DrawerComponent=t=>{const{width:a=320,open:o,variant:d="persistent",condensed:u=!1,showCondensedLabel:p=!0,selectedNodeId:c,onNavItemClick:l,defaultExpanded:x=[],expanded:v,onNavItemExpanded:w,sx:D,...f}=t,g=[{"& > .MuiPaper-root":{width:u?1+(p?64:56):a,overflowX:"hidden",transition:e=>`${e.transitions.create(["width"],{easing:u?e.transitions.easing.sharp:e.transitions.easing.easeOut,duration:u?e.transitions.duration.leavingScreen:e.transitions.duration.enteringScreen})}, \n ${e.transitions.create(["transform"],{easing:o?e.transitions.easing.easeOut:e.transitions.easing.sharp,duration:o?e.transitions.duration.enteringScreen:e.transitions.duration.leavingScreen})} !important`}},...Array.isArray(D)?D:[D]],[N,h]=n.useState(x);return e.jsx(r.DrawerContext.Provider,{value:{condensed:u,showCondensedLabel:p,selectedNodeId:c,onNavItemClick:l,expanded:v??N,setExpanded:e=>{h(e),w?.(e)}},children:e.jsx(i.default,{sx:g,open:o,variant:d,...f,"data-testid":`${s}-root`,ModalProps:{keepMounted:!0}})})},exports.prefix=s;