UNPKG

@lanaco/lnc-react-ui

Version:

React component library

31 lines (27 loc) 2.47 kB
"use strict";const r=require("react/jsx-runtime"),a=require("react"),d=require("./emotion-styled.browser.esm-DwHBgTPn.cjs"),k=require("./Icon.cjs"),N=require("./DropdownMenu.cjs"),q=require("./DropdownItem.cjs"),_=require("./index-Bg5OOQN0.cjs"),z=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),C="_Action_bw0a9_5",R={Action:C},$=a.forwardRef(({active:e,className:n,cursor:t,style:l,...c},o)=>r.jsx("button",{ref:o,...c,className:_.classNames(R.Action,n),tabIndex:0,style:{...l,cursor:t,"--fill":e==null?void 0:e.fill,"--background":e==null?void 0:e.background}})),p=a.forwardRef((e,n)=>r.jsx($,{ref:n,cursor:"grab","data-cypress":"draggable-handle",...e,children:r.jsx("svg",{viewBox:"0 0 20 20",width:"12",children:r.jsx("path",{d:"M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z"})})})),K=d.styled.div` height: 100%; width: 100%; padding: ${e=>`18px 20px 18px ${e.handle==!0?"10px":"20px"}`}; position: relative; word-wrap: break-word; white-space: pre-wrap; word-break: break-word; display: flex; gap: 8px; & .card-action-lnc { position: absolute; right: 10px; cursor: pointer; } & > .kanban-card-content { ${e=>e.clickable&&"cursor: pointer;"} } `,B=d.styled.div` display: flex; & > *:first-of-type:not(:last-of-type) { opacity: 0; } & > *:first-of-type:not(:last-of-type):focus-visible { opacity: 1; } `,m=a.memo(a.forwardRef(({containerId:e,item:n,handle:t=!0,handleProps:l,actionsMenu:c=!1,actions:o=[],onDetails:i,color:u="primary",size:x="small",className:b="",style:f={},children:h,...w},A)=>{const y=z.useTheme();return r.jsxs(K,{ref:A,handle:t,theme:y,className:b,style:f,clickable:!!i,...w,children:[t&&r.jsx(B,{className:"Actions",children:r.jsx(p,{...l})}),c&&r.jsx(N,{className:"card-action-lnc",horizontalAlignment:"right",verticalAlignment:"bottom",color:u,size:x,control:r.jsx(k,{color:"neutral",className:"card-action-lnc",icon:"ellipsis-v"}),children:o==null?void 0:o.map((s,g)=>{if((s==null?void 0:s.show)!=!1)return r.jsx(q,{icon:s.icon,disabled:s.enable==!1,onClick:j=>s.onAction(j,n,e),children:s.name},g)})}),r.jsx("div",{className:"kanban-card-content-lnc",onClick:s=>{i&&i(s,n,e)},children:h})]})}));m.displayName="KANBAN_CARD";exports.Handle=p;exports.KanbanCard=m;