import e from"prop-types";import{SortableHandle as r,SortableElement as i,SortableContainer as a,arrayMove as t}from"react-sortable-hoc";import{makeStyles as o,Checkbox as n,Typography as l}from"@material-ui/core";import d from"@material-ui/icons/DragIndicator";import{jsx as s,jsxs as c}from"react/jsx-runtime";var m=o({draggableList:{borderNottom:"1px solid #e0e0e0",listStyle:"none",padding:"0"},draggableListItem:{cursor:"pointer",borderTop:"1px solid #e0e0e0",lineHeight:"1rem",zIndex:1500,display:"flex",alignItems:"center","&:hover $draggableListItemDraghandle":{opacity:1}},draggableListItemCheckBox:{padding:"8px"},draggableListItemDraghandle:{color:"#777",opacity:0}}),g=r((function(){return s(d,{className:"c-draggable-list__item_draghandle",fontSize:"small"})})),u=i((function(e){var r=e.item,i=e.onClick,a=m();return c("li",{className:a.draggableListItem,children:[s(g,{}),s(n,{className:a.draggableListItemCheckBox,color:"primary",checked:r.show,onClick:function(){return i(r)}}),s(l,{variant:"body2",children:r.customLabel||r.label||r})]})})),p=a((function(e){var r=e.items,i=e.onClick,a=m();return s("ul",{className:a.draggableList,children:r.map((function(e,r){return s(u,{index:r,item:e,onClick:i,disabled:e.disabled},e.label)}))})}));function b(e){var r=e.items,i=e.onSort,a=e.onClick;return s(p,{useDragHandle:!0,items:r,onSortEnd:function(e){var a=e.oldIndex,o=e.newIndex,n=t(r,a,o);i(n)},onClick:a})}b.propTypes={items:e.arrayOf(e.shape({})).isRequired,onSort:e.func.isRequired,onClick:e.func.isRequired};export{b as default};
