"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),l=require("classnames"),a=require("prop-types"),n=require("@material-ui/core"),o=require("@material-ui/icons/Close"),i=require("../../../../../utils/index.js"),r=require("react/jsx-runtime");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=c(e),d=c(l),u=c(a),b=c(o),p=n.makeStyles((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 l=t.isMobile;return"linear-gradient(0deg, rgba(65, 65, 65, 0) 0%, ".concat(l?e.palette.background.b5:e.palette.background.b9," 100%)")}}},bottomShadow:{bottom:"16px","&::after":{background:function(t){var l=t.isMobile;return"linear-gradient(180deg, rgba(65, 65, 65, 0) 0%, ".concat(l?e.palette.background.b5:e.palette.background.b9," 100%)")}}}}}));function g(e){var l=e.isMobile,a=e.data,o=e.columns,c=e.onClose,u=e.onSelect,g=p({isMobile:l}),h=t.useState(-1),f=s.default(h,2),x=f[0],m=f[1];return r.jsxs(n.Dialog,{open:!0,maxWidth:"lg",onBackdropClick:c,onEscapeKeyDown:c,fullScreen:l,children:[r.jsx(n.DialogTitle,{className:g.dialogTitle,children:r.jsxs("div",{className:g.titleWrapper,children:[r.jsx("span",{className:g.title,children:"AutoComplete Items"}),r.jsx(n.Tooltip,{title:"Close",children:r.jsx(n.IconButton,{"data-not-migrated-muiiconbutton":!0,"aria-label":"close",className:g.closeIconButton,onClick:c,children:r.jsx(b.default,{className:g.closeIcon})})})]})}),r.jsx(n.DialogContent,{className:g.dialogContent,children:r.jsx(n.TableContainer,{className:g.tableContainer,children:r.jsxs(n.Table,{stickyHeader:!0,size:"small","aria-label":"autocomplete items",children:[r.jsx(n.TableHead,{children:r.jsxs(n.TableRow,{children:[r.jsx(n.TableCell,{className:d.default(g.headerCell,g.actionHeadCell),children:"Action"}),o.map((function(e,t){return r.jsxs(n.TableCell,{className:g.headerCell,style:{minWidth:e.width},align:t===o.length-1?"right":"left",children:[e.label," ",e.unitType&&"(".concat(i.getUnitDisplay(e.unitType),")")]},e.key)}))]})}),r.jsxs(n.TableBody,{children:[a.length>0&&r.jsx(n.TableRow,{children:r.jsx(n.TableCell,{colSpan:"100%",className:d.default(g.shadow,g.topShadow)})}),a.map((function(e,t){return r.jsxs(n.TableRow,{children:[r.jsx(n.TableCell,{className:d.default(g.cell,g.actionCell),children:r.jsx(n.Radio,{color:"primary",checked:t===x,onChange:function(){return function(e){m(e)}(t)},value:t})}),o.map((function(t,l){return r.jsx(n.TableCell,{className:g.cell,align:l===o.length-1?"right":"left",children:e[t.key]},t.key)}))]},t)})),a.length>0&&r.jsx(n.TableRow,{children:r.jsx(n.TableCell,{colSpan:"100%",className:d.default(g.shadow,g.bottomShadow)})})]})]})})}),r.jsxs(n.DialogActions,{className:g.dialogActions,children:[r.jsx(n.Button,{onClick:c,color:"primary",children:"Cancel"}),r.jsx(n.Button,{variant:"contained",color:"primary",disabled:x<0,onClick:function(){u(a[x])},children:"Select"})]})]})}g.propTypes={isMobile:u.default.bool.isRequired,data:u.default.arrayOf(u.default.shape({})).isRequired,columns:u.default.arrayOf(u.default.shape({})).isRequired,onClose:u.default.func.isRequired,onSelect:u.default.func.isRequired};var h=t.memo(g);module.exports=h;
//# sourceMappingURL=AutoCompleteDialog.js.map
