import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import React,{useEffect}from"react";import classNames from"classnames";import{Handle,Remove}from"./components";import styles from"./Item.module.scss";export const Item=React.memo(React.forwardRef((({color:e,dragOverlay:s,dragging:a,disabled:l,fadeIn:t,handle:r,handleProps:o,height:n,index:i,listeners:d,onRemove:c,renderItem:m,sorting:y,style:g,transition:f,transform:x,value:v,wrapperStyle:p,...u},j)=>(useEffect((()=>{if(s)return document.body.style.cursor="grabbing",()=>{document.body.style.cursor=""}}),[s]),m?m({dragOverlay:Boolean(s),dragging:Boolean(a),sorting:Boolean(y),index:i,fadeIn:Boolean(t),listeners:d,ref:j,style:g,transform:x,transition:f,value:v}):_jsx("li",{className:classNames(styles.Wrapper,t&&styles.fadeIn,y&&styles.sorting,s&&styles.dragOverlay),style:{...p,transition:[f,p?.transition].filter(Boolean).join(", "),"--translate-x":x?`${Math.round(x.x)}px`:void 0,"--translate-y":x?`${Math.round(x.y)}px`:void 0,"--scale-x":x?.scaleX?`${x.scaleX}`:void 0,"--scale-y":x?.scaleY?`${x.scaleY}`:void 0,"--index":i,"--color":e},ref:j,children:_jsxs("div",{className:classNames(styles.Item,a&&styles.dragging,r&&styles.withHandle,s&&styles.dragOverlay,l&&styles.disabled,e&&styles.color),style:g,"data-cypress":"draggable-item",...r?void 0:d,...u,tabIndex:r?void 0:0,children:[v,_jsxs("span",{className:styles.Actions,children:[c?_jsx(Remove,{className:styles.Remove,onClick:c}):null,r?_jsx(Handle,{...o,...d}):null]})]})})))));