import o from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useState as r,memo as i}from"react";import n from"prop-types";import t from"classnames";import{sortableHandle as a,SortableElement as s}from"react-sortable-hoc";import{makeStyles as l,Tooltip as p,IconButton as d}from"@material-ui/core";import m from"@material-ui/icons/DragIndicator";import u from"./Component.js";import{jsx as c,jsxs as b}from"react/jsx-runtime";var f=l((function(o){return{sortableComponent:{position:"relative","&:hover":{"& $dragButton":{display:"block"}},zIndex:"99999999 !important",background:function(e){return e.isSortable&&o.palette.background.b5},boxShadow:function(o){return o.isSortable&&"0px 0px 6px rgba(0, 0, 0, 0.5)"}},topComponent:{marginTop:"16px"},bottomComponent:{marginBottom:"8px"},dragInidicationHidden:{"&:hover":{"& $dragButton":{display:"none"}}},dragIndicatorWrapper:{position:"absolute",left:function(o){return o.isMobile?"8px":0},top:function(o){return o.isMobile?"20px":"8px"}},dragButton:{display:function(o){return o.isMobile?"block":"none"},padding:"8px",background:function(e){return e.isMobile?"none":o.palette.background.b9},"&:hover":{background:o.palette.background.b7,"& $dragIndicatorIcon":{color:o.palette.primary.text1}}},dragIndicatorIcon:{cursor:"pointer",color:o.palette.primary.text6,fontSize:"16px"}}})),g=a((function(o){var e=o.isMobile,r=f({isMobile:e});return c("div",{className:r.dragIndicatorWrapper,children:c(p,{title:e?"":"Click & Drag to reorder",children:c(d,{className:r.dragButton,children:c(m,{className:r.dragIndicatorIcon})})})})})),C=s((function(i){var n,a=i.component,s=i.isTopComponent,l=i.isLastCompnent,p=i.isSortable,d=i.sortableIndex,m=i.validate,C=i.onDelete,v=i.onSave,x=i.isMobile,R=i.viewColumnsPerRow,I=i.editColumnsPerRow,h=f({isMobile:x,isSortable:p}),q=r(!1),M=e(q,2),w=M[0],S=M[1];return b("div",{className:t(h.sortableComponent,(n={},o(n,h.topComponent,!x&&s),o(n,h.bottomComponent,!x&&l),o(n,h.dragInidicationHidden,!p&&-1!==d),n)),children:[!w&&c(g,{isMobile:x}),c(u,{isMobile:x,viewColumnsPerRow:R,editColumnsPerRow:I,component:a,validate:m,onSave:v,onDelete:C,onChangeEditing:S,isDragComponent:-1!==d})]})}));C.propTypes={isMobile:n.bool.isRequired,component:n.shape({}).isRequired,isTopComponent:n.bool.isRequired,isLastCompnent:n.bool.isRequired,isSortable:n.bool.isRequired,sortableIndex:n.number.isRequired,validate:n.func.isRequired,onDelete:n.func.isRequired,onSave:n.func.isRequired,viewColumnsPerRow:n.number.isRequired,editColumnsPerRow:n.number.isRequired};var v=i(C);export{v as default};
//# sourceMappingURL=SortableComponent.js.map
