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.98 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@mui/icons-material/CheckCircle"),r=require("@mui/icons-material/Circle"),i=require("@mui/material/ListItem"),a=require("@mui/material/ListItemButton"),s=require("@mui/material/ListItemIcon"),o=require("@mui/material/ListItemText"),d=require("@mui/material/Stack"),l=require("@mui/material/Typography");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=n(t),m=n(r),u=n(i),x=n(a),p=n(s),f=n(o),y=n(d),b=n(l);const h="NexusTaskItem",j=t=>{switch(t){case"complete":return e.jsx(c.default,{"data-testid":`${h}-completeIcon`,color:"success",sx:{fontSize:32}});case"unavailable":return e.jsx(m.default,{"data-testid":`${h}-unavailableIcon`,sx:{fontSize:16,color:"text.disabled"}});default:return e.jsx(m.default,{"data-testid":`${h}-availableIcon`,sx:{fontSize:16,color:"primary.main"}})}},$=({primary:t,primaryModifier:r,sx:i,...a})=>e.jsxs(y.default,{"data-testid":`${h}-primaryStack`,className:`${h}-primaryStack`,sx:[{flexDirection:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"}},...Array.isArray(i)?i:[i]],...a,children:["string"==typeof t?e.jsx(b.default,{"data-testid":`${h}-primary`,className:`${h}-primary`,variant:"body2",children:t}):t,r&&("string"==typeof r?e.jsx(b.default,{"data-testid":`${h}-primaryModifier`,className:`${h}-primaryModifier`,variant:"caption",fontWeight:700,sx:{ml:{xs:0,sm:2}},children:r}):r)]});exports.TaskItem=t=>{const{primary:r,secondary:i,primaryModifier:a,status:s,action:o,nesting:d="none",sx:l,...n}=t,c="none"!==d,m=e.jsxs(e.Fragment,{children:[s&&e.jsx(p.default,{"data-testid":`${h}-icon`,className:`${h}-icon`,sx:{minWidth:32,mr:4,justifyContent:"center"},children:j(s)}),e.jsx(f.default,{disableTypography:!0,primary:e.jsx($,{primary:r,primaryModifier:a,sx:{color:n.disabled?"text.disabled":"text.primary"}}),secondary:i&&("string"==typeof i?e.jsx(b.default,{"data-testid":`${h}-secondary`,className:`${h}-secondary`,variant:"caption",display:"block",color:n.disabled?"text.disabled":"text.secondary",children:i}):i)})]}),y=(e=>({ml:e?16:0,mb:4,border:"1px solid",borderColor:"divider",borderRadius:2,position:"relative","&.Mui-disabled":{opacity:1,color:"text.disabled"},"&:last-child":{mb:0}}))(c),v=(e=>({width:"unset","&:before":{content:'""',position:"absolute",width:32,height:"calc(50% + 17px)",borderLeft:"1px solid",borderBottom:"1px solid",borderColor:"divider",borderBottomLeftRadius:"last-child"===e?8:0,left:-32,bottom:"50%"},"&:after":"last-child"!==e?{content:'""',position:"absolute",width:0,height:"calc(50% + 1px)",borderLeft:"1px solid",borderColor:"divider",left:-32,top:"50%"}:{}}))(d);return t.onClick?e.jsxs(x.default,{"data-testid":`${h}-root`,className:`${h}-root`,sx:[y,c?v:{},...Array.isArray(l)?l:[l]],...n,children:[m,o]}):e.jsxs(u.default,{"data-testid":`${h}-root`,className:`${h}-root`,sx:[y,c?v:{},...Array.isArray(l)?l:[l]],...n,children:[m,o]})};