import e from"prop-types";import{withStyles as t,FormControl as a,InputLabel as s,Select as r,MenuItem as n,CircularProgress as i}from"@material-ui/core";import l from"../TruncatedText/index.js";import{useAssetSelectData as p}from"./effects/index.js";import{jsxs as d,jsx as u}from"react/jsx-runtime";var o="DC_SingleAssetEditor",c=function(e){var t=e.appKey,c=e.label,m=e.currentValue,h=e.defaultValue,y=e.isNullable,f=e.onChange,g=e.classes,v=e.parentAssetId,A=e.assetType,T=e.parentAssetType,b=p({appKey:t,assetId:m,assetType:A,parentAssetId:v,parentAssetType:T}),I=b.assets,N=b.loading,x=m||h;return d("div",{children:[d(a,{disabled:N,children:[!y&&u(s,{shrink:!!x,children:c}),d(r,{"data-testid":e["data-testid"],value:x,onChange:function(e){return f(e.target.value)},className:g.select,MenuProps:{className:g.selectMenu},children:[y&&u(n,{"data-testid":"".concat(o,"_noActiveAssetMenuItem"),value:h,className:g.menuItem,children:"No active asset"},"empty item"),I.map((function(e){var t=(null==e?void 0:e.name)||"";return u(n,{"data-testid":"".concat(o,"_option_").concat(t,"MenuItem"),value:Number(e.id),className:g.menuItem,children:u(l,{children:t})},e.id)}))]})]}),N&&u(i,{"data-testid":"".concat(o,"_CircularProgress"),size:20,className:g.progress})]})};c.propTypes={classes:e.shape({}).isRequired,appType:e.shape({constants:e.shape({})}),currentValue:e.oneOfType([e.number,e.string]),defaultValue:e.any,onChange:e.func.isRequired,label:e.string,isNullable:e.bool,parentAssetId:e.number,parentAssetType:e.string,assetType:e.string.isRequired,"data-testid":e.string,appKey:e.string},c.defaultProps={label:"Choose An Asset",currentValue:"",defaultValue:"",appType:void 0,isNullable:!1,parentAssetId:void 0,parentAssetType:void 0,"data-testid":"".concat(o,"_autoComplete"),appKey:null};var m=t({progress:{margin:"0 15px"},select:{width:350},selectMenu:{maxHeight:350},menuItem:{width:350}})(c);export{o as PAGE_NAME,m as default};
//# sourceMappingURL=SingleAssetEditor.js.map
