!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 n=r(6031),o=r.n(n),a=r(2462),i=r.n(a),l=r(2015),u=r.n(l),s=r(9825),p=r.n(s),c=r(8619),m=r(3294);const d=["name","label","maxLength","required"],f=e=>{var t;let{name:r,label:n,maxLength:a,required:l=!1}=e,s=i()(e,d);const[p,f]=(0,m.useField)(r),b=(null===(t=p.value)||void 0===t?void 0:t.length)||0;let y="";return n&&(y=l?`${n} *`:n),u().createElement(c.Box,null,u().createElement(c.TextField,o()({name:r,label:y},p,{onBlur:p.onBlur,margin:"normal",error:f.touched&&Boolean(f.error),helperText:f.touched&&f.error,slotProps:{htmlInput:{maxLength:a}}},s)),a&&u().createElement(c.Typography,{sx:{fontSize:"1.2rem",color:"#00000099",pl:2}},a-b+" characters left"))};f.propTypes={name:p().string.isRequired,label:p().string,maxLength:p().number,required:p().bool};const b=f},1116:e=>{e.exports=require("@babel/runtime/helpers/defineProperty")},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(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.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 n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(()=>{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 n={};r.r(n),r.d(n,{default:()=>O});var o=r(6031),a=r.n(o),i=r(1116),l=r.n(i),u=r(2462),s=r.n(u),p=r(2015),c=r.n(p),m=r(9825),d=r.n(m),f=r(3294),b=r(9314);const y=["name","min","max"];function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?x(Object(r),!0).forEach((function(t){l()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const v=["e","E","+","-"],h=e=>{let{name:t,min:r,max:n}=e,o=s()(e,y);const[,,i]=(0,f.useField)(t);return c().createElement(b.default,a()({name:t,type:"number",onKeyDown:e=>{v.includes(e.key)&&(e.nativeEvent.preventDefault(),e.nativeEvent.stopImmediatePropagation())},onChange:e=>{const t=parseInt(e.target.value,10),o=r??0;if(isNaN(t))return e.target.value=o,void i.setValue(o);const a=n?Math.min(Math.max(t,o),n):Math.max(t,o);e.target.value=a,i.setValue(a)},slotProps:{htmlInput:g({min:r??0},n?{max:n}:{})}},o))};h.propTypes={name:d().string.isRequired,label:d().string};const O=h;return n})()));
//# sourceMappingURL=quantity-field.js.map