import e from"@babel/runtime/helpers/slicedToArray";import{memo as t,useState as n}from"react";import o from"classnames";import a from"prop-types";import{makeStyles as i,Dialog as l,DialogTitle as r,Tooltip as c,IconButton as d,DialogContent as s,TableContainer as p,Table as u,TableHead as b,TableRow as g,TableCell as m,TableBody as h,Radio as f,DialogActions as k,Button as x}from"@material-ui/core";import y from"@material-ui/icons/Close";import{getUnitDisplay as C}from"../../../../../utils/index.js";import{jsxs as v,jsx as N}from"react/jsx-runtime";var S=i((function(e){return{dialogTitle:{background:function(t){return t.isMobile?e.palette.background.b5:e.palette.background.b9}},titleWrapper:{flex:1,display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:20},title:{fontWeight:400},closeIconButton:{fontSize:20,padding:4,"&:hover $closeIcon":{color:e.palette.action.active}},closeIcon:{color:e.palette.primary.text6},dialogContent:{display:"flex",overflow:"hidden",background:function(t){return t.isMobile?e.palette.background.b5:e.palette.background.b9}},dialogActions:{paddingTop:8,paddingBottom:40,background:function(t){return t.isMobile?e.palette.background.b5:e.palette.background.b9}},tableContainer:{flex:1,overflow:"auto","&::-webkit-scrollbar-corner":{background:"rgba(0, 0, 0, 0)"}},headerCell:{padding:"8px 5px",background:function(t){return t.isMobile?e.palette.background.b5:e.palette.background.b9},color:e.palette.primary.text7,fontWeight:500,fontSize:"12px",lineHeight:"14px",verticalAlign:"middle",borderTop:"1px solid #5c5c5c",maxWidth:"100px"},cell:{padding:"0 8px",fontSize:"14px",lineHeight:"20px",background:function(t){return t.isMobile?e.palette.background.b5:e.palette.background.b9}},actionHeadCell:{zIndex:12},actionCell:{position:"sticky",left:0,zIndex:2},shadow:{position:"sticky",zIndex:10,height:0,border:0,padding:0,margin:0,"&::after":{content:"' '",pointerEvents:"none",position:"absolute",height:"16px",left:0,right:0}},topShadow:{top:"48px","&::after":{background:function(t){var n=t.isMobile;return"linear-gradient(0deg, rgba(65, 65, 65, 0) 0%, ".concat(n?e.palette.background.b5:e.palette.background.b9," 100%)")}}},bottomShadow:{bottom:"16px","&::after":{background:function(t){var n=t.isMobile;return"linear-gradient(180deg, rgba(65, 65, 65, 0) 0%, ".concat(n?e.palette.background.b5:e.palette.background.b9," 100%)")}}}}}));function w(t){var a=t.isMobile,i=t.data,w=t.columns,I=t.onClose,M=t.onSelect,z=S({isMobile:a}),T=n(-1),W=e(T,2),A=W[0],q=W[1];return v(l,{open:!0,maxWidth:"lg",onBackdropClick:I,onEscapeKeyDown:I,fullScreen:a,children:[N(r,{className:z.dialogTitle,children:v("div",{className:z.titleWrapper,children:[N("span",{className:z.title,children:"AutoComplete Items"}),N(c,{title:"Close",children:N(d,{"data-not-migrated-muiiconbutton":!0,"aria-label":"close",className:z.closeIconButton,onClick:I,children:N(y,{className:z.closeIcon})})})]})}),N(s,{className:z.dialogContent,children:N(p,{className:z.tableContainer,children:v(u,{stickyHeader:!0,size:"small","aria-label":"autocomplete items",children:[N(b,{children:v(g,{children:[N(m,{className:o(z.headerCell,z.actionHeadCell),children:"Action"}),w.map((function(e,t){return v(m,{className:z.headerCell,style:{minWidth:e.width},align:t===w.length-1?"right":"left",children:[e.label," ",e.unitType&&"(".concat(C(e.unitType),")")]},e.key)}))]})}),v(h,{children:[i.length>0&&N(g,{children:N(m,{colSpan:"100%",className:o(z.shadow,z.topShadow)})}),i.map((function(e,t){return v(g,{children:[N(m,{className:o(z.cell,z.actionCell),children:N(f,{color:"primary",checked:t===A,onChange:function(){return function(e){q(e)}(t)},value:t})}),w.map((function(t,n){return N(m,{className:z.cell,align:n===w.length-1?"right":"left",children:e[t.key]},t.key)}))]},t)})),i.length>0&&N(g,{children:N(m,{colSpan:"100%",className:o(z.shadow,z.bottomShadow)})})]})]})})}),v(k,{className:z.dialogActions,children:[N(x,{onClick:I,color:"primary",children:"Cancel"}),N(x,{variant:"contained",color:"primary",disabled:A<0,onClick:function(){M(i[A])},children:"Select"})]})]})}w.propTypes={isMobile:a.bool.isRequired,data:a.arrayOf(a.shape({})).isRequired,columns:a.arrayOf(a.shape({})).isRequired,onClose:a.func.isRequired,onSelect:a.func.isRequired};var I=t(w);export{I as default};
//# sourceMappingURL=AutoCompleteDialog.js.map
