!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={9314:(e,t,r)=>{r.d(t,{default:()=>b});var o=r(6031),n=r.n(o),l=r(2462),a=r.n(l),u=r(2015),i=r.n(u),s=r(9825),p=r.n(s),d=r(8619),c=r(3294);const m=["name","label","maxLength","required"],f=e=>{var t;let{name:r,label:o,maxLength:l,required:u=!1}=e,s=a()(e,m);const[p,f]=(0,c.useField)(r),b=(null===(t=p.value)||void 0===t?void 0:t.length)||0;let v="";return o&&(v=u?`${o} *`:o),i().createElement(d.Box,null,i().createElement(d.TextField,n()({name:r,label:v},p,{onBlur:p.onBlur,margin:"normal",error:f.touched&&Boolean(f.error),helperText:f.touched&&f.error,slotProps:{htmlInput:{maxLength:l}}},s)),l&&i().createElement(d.Typography,{sx:{fontSize:"1.2rem",color:"#00000099",pl:2}},l-b+" characters left"))};f.propTypes={name:p().string.isRequired,label:p().string,maxLength:p().number,required:p().bool};const b=f},3209:(e,t,r)=>{r.d(t,{o_:()=>o});const o=1048576},6031:e=>{e.exports=require("@babel/runtime/helpers/extends")},2462:e=>{e.exports=require("@babel/runtime/helpers/objectWithoutProperties")},8619:e=>{e.exports=require("@mui/material")},3294:e=>{e.exports=require("formik")},9825:e=>{e.exports=require("prop-types")},2015:e=>{e.exports=require("react")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,r),l.exports}(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})}})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var o={};r.r(o),r.d(o,{default:()=>y});var n=r(6031),l=r.n(n),a=r(2462),u=r.n(a),i=r(2015),s=r.n(i),p=r(9825),d=r.n(p),c=r(8619),m=r(3294),f=r(9314),b=r(3209);const v=["name","label"],x=["e","E","+","-",".",","],g=e=>{let{name:t,label:r}=e,o=u()(e,v);const[n,a,p]=(0,m.useField)(t),[d,g]=(0,i.useState)(!1),y=null===a.initialValue?null:0;return s().createElement(f.default,l()({name:t,label:r,type:"number",value:(()=>d?"":null==n.value||0===n.value?0===n.value?0:"":(e=>Math.floor(e/b.o_))(n.value))(),onChange:e=>{const t=e.target.value;if(""===t)return g(!0),void p.setValue(y);g(!1);const r=Number(t)*b.o_;p.setValue(r)},slotProps:{input:{endAdornment:s().createElement(c.InputAdornment,{position:"end"},"MB")},htmlInput:{min:0,inputMode:"numeric",step:1}},onKeyDown:e=>{if(x.includes(e.key))return e.preventDefault(),void e.stopPropagation();"0"!==e.key||""!==e.target.value&&"0"!==e.target.value||(e.preventDefault(),e.stopPropagation())}},o))};g.propTypes={name:d().string.isRequired,label:d().string.isRequired};const y=g;return o})()));
//# sourceMappingURL=file-size-field.js.map