import e from"@babel/runtime/helpers/defineProperty";import{jsxs as r,Fragment as i,jsx as t}from"react/jsx-runtime";import{memo as o,useContext as a}from"react";import l from"classnames";import{noop as n}from"lodash";import{Divider as d}from"@material-ui/core";import m from"@material-ui/icons/DragIndicator";import{getUnitDisplay as s}from"../../../utils/index.js";import c from"../../IconButton/index.js";import u from"../RealTimeSidebarContext.js";import{useStyles as p}from"./RealTimeBoxStyles.js";var v=o((function(o){var v,f=o.item,h=void 0===f?null:f,g=o.isDraggable,x=void 0===g||g,B=o.dragHandle,T=void 0===B?n:B,N=o.itemSelected,b=void 0===N?null:N,C=o.classNames,D=p(),j=a(u),y=j.handleOpenCloseDialog,I=j.handleChangeParamToEdit,S=h?h.unitTo||s(h.unitType):null,R=h?{backgroundColor:h.color,marginRight:"transparent"===h.color?-2:4}:void 0;if(!h)return null;return r(i,{children:[t("div",{className:l(D.rtBox,null==C?void 0:C.item,(v={},e(v,D.rtBoxSelected,!!b),e(v,"notDraggable",!x),v)),"data-testid":"realtime_box",children:r(i,{children:[r("div",{className:D.rtBoxInner,onClick:function(){y(!0),I(h.key)},"data-testid":"".concat(h.name,"_edit_item"),children:[r("div",{className:l(D.rtBoxTitle,null==C?void 0:C.itemTitle),children:[t("div",{className:l(D.rtBoxTitleBorder,null==C?void 0:C.itemTitleBorder),style:R}),t("div",{children:h.name})]}),r("div",{className:l(D.rtBoxValue,null==C?void 0:C.itemValue),children:[h.value," ",t("span",{children:S})]})]}),x&&T(t("div",{className:D.rtBoxButtonContainer,"data-testid":"realTimeValuesItemDrag",children:t(c,{tooltipProps:{title:"Drag to Reorder"},children:t(m,{className:D.dragIcon,color:"error"})})}))]})}),x&&t(d,{className:l(D.divider,null==C?void 0:C.itemSeparator)})]})}));export{v as default};
//# sourceMappingURL=RealTimeBox.js.map
