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