import n from"@babel/runtime/helpers/slicedToArray";import{useState as t,useRef as r,useEffect as e}from"react";function o(o){var l=o.startIcon,u=o.endIcon,f=o.onFocus,i=o.onBlur,s=o.value,a=o.InputProps,d=t(),c=n(d,2),m=c[0],p=c[1],v=t(),h=n(v,2),g=h[0],b=h[1],A=t("string"==typeof s&&0!==s.length||"number"==typeof s&&0!==String(s).length||!(null==a||!a.startAdornment)||!1),I=n(A,2),y=I[0],B=I[1],F=r(null),L=r(null);e((function(){var n,t;p(null===(n=F.current)||void 0===n?void 0:n.offsetWidth),b(null===(t=L.current)||void 0===t?void 0:t.offsetWidth)}),[l,u]);return{shrink:y,onInputFocus:function(n){B(!0),f&&f(n)},onInputBlur:function(n){0!==n.target.value.length||null!=a&&a.startAdornment||B(!1),i&&i(n)},startLabelOffset:m,endLabelOffset:g,startAdornmentRef:F,endAdornmentRef:L}}export{o as useCustomShrink};
//# sourceMappingURL=index.js.map
