import e from"@babel/runtime/helpers/defineProperty";import o from"prop-types";import i from"classnames";import{makeStyles as t,Tooltip as r}from"@material-ui/core";import n from"@material-ui/icons/AddCircle";import l from"@material-ui/icons/ExpandLess";import a from"@material-ui/icons/ExpandMore";import s from"../IconButton/index.js";import{jsxs as c,jsx as d}from"react/jsx-runtime";import p from"./components/FolderIcon.js";function m(e,o){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);o&&(t=t.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),i.push.apply(i,t)}return i}function f(o){for(var i=1;i<arguments.length;i++){var t=null!=arguments[i]?arguments[i]:{};i%2?m(Object(t),!0).forEach((function(i){e(o,i,t[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(t,e))}))}return o}var u=t((function(e){return{folderMenuItem:{alignItems:"center",backgroundColor:e.palette.background.b8,color:"#FFFFFF",cursor:"pointer",display:"flex",fontSize:"0.875rem",fontWeight:"500",height:36,justifyContent:"space-between",paddingLeft:48,paddingRight:4,position:"relative",width:"100%",boxSizing:"border-box","&:hover":{backgroundColor:"rgba(3, 188, 212, 0.07)"},"&:hover svg":{visibility:"visible"},"&:hover $addIcon":{visibility:"visible"},"&:hover $toggleIcon":{visibility:"visible"}},addIcon:{visibility:"hidden"},toggleIcon:{visibility:"hidden"},folderMenuItemSelected:{backgroundColor:"rgba(3, 188, 212, 0.15) !important","&::before":{left:0,height:"100%",width:4,backgroundColor:e.palette.primary.main,position:"absolute",content:'""',borderRadius:"4px 0 0 4px"}},addCircleIcon:{visibility:"hidden"},actions:{display:"flex",alignItems:"center"},folderIcon:{position:"absolute",left:24,top:8},folderName:{overflow:"hidden",marginRight:4,height:"36px",lineHeight:"36px",whiteSpace:"nowrap",textOverflow:"ellipsis",userSelect:"none"}}})),b=function(o){var t=o.folderColor,m=o.isCreatable,b=o.isOpen,g=o.isSelected,h=o.name,v=o.onAdd,y=o.onClick,O=o.onToggle,C=u();return c("div",{className:i(C.folderMenuItem,e({},C.folderMenuItemSelected,g)),onClick:y,children:[d(p,{color:t,isOpen:b,className:C.folderIcon}),d("div",{className:C.folderName,children:h}),c("div",{className:C.actions,children:[m&&d(r,{title:"Add Page",placement:"bottom-end",children:d(s,{className:C.addIcon,size:"small",onClick:function(e){e.stopPropagation(),v()},children:d(n,{fontSize:"small"})})}),d(s,{className:C.toggleIcon,size:"small",onClick:function(e){e.stopPropagation(),O()},children:d((function(e){return d(r,{title:b?"Collapse":"Expand",placement:"bottom-end",children:d(b?l:a,f({},e))})}),{fontSize:"small"})})]})]})};b.propTypes={folderColor:o.string.isRequired,isCreatable:o.bool,isOpen:o.bool,isSelected:o.bool,name:o.string.isRequired,onAdd:o.func.isRequired,onClick:o.func.isRequired,onToggle:o.func.isRequired},b.defaultProps={isCreatable:!1,isOpen:!1,isSelected:!1};export{b as default};
