"use strict";var e=require("react"),t=require("prop-types"),r=require("./utils.js"),u=require("react/jsx-runtime");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=n(t);function d(t){var n=t.children,a=t.truncatedText,d=t.separator,i=t.maxWidth,l=t.onTruncate,c=e.useRef();return e.useEffect((function(){var e=c.current,t=e.scrollWidth,u=e.innerText;l(t>i?r.getTruncatedText({maxWidth:i,separator:d,text:n,currentWidth:t,textLength:null==u?void 0:u.length}):null)}),[n]),u.jsx("div",{ref:c,children:a||n})}d.propTypes={children:a.default.oneOfType([a.default.node,a.default.string]).isRequired,truncatedText:a.default.string,onTruncate:a.default.func,separator:a.default.string,maxWidth:a.default.number},d.defaultProps={onTruncate:null,truncatedText:null,separator:" ... ",maxWidth:null},module.exports=d;
//# sourceMappingURL=MiddleTruncate.js.map
