@circle-vibe/shared 1.1.37 → 1.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/92.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_circle_vibe_shared=this.webpackChunk_circle_vibe_shared||[]).push([[92],{92:(e,t,n)=>{function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(null,arguments)}n.r(t),n.d(t,{default:()=>y});var i=n(155),o=n.n(i),a=i.useLayoutEffect,u=function(e,t){"function"!=typeof e?e.current=t:e(t)},d={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},c=function(e){Object.keys(d).forEach((function(t){e.style.setProperty(t,d[t],"important")}))},l=null,f=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize};var s=function(){},h=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],g=!!document.documentElement.currentStyle,p=function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,r=(n=t,h.reduce((function(e,t){return e[t]=n[t],e}),{})),i=r.boxSizing;return""===i?null:(g&&"border-box"===i&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px"),{sizingStyle:r,paddingSize:parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),borderSize:parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth)})};function b(e,t,n){var r,u,d=(r=n,u=o().useRef(r),a((function(){u.current=r})),u);i.useLayoutEffect((function(){var n=function(e){return d.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}}),[])}var v=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],m=function(e,t){var n=e.cacheMeasurements,a=e.maxRows,d=e.minRows,h=e.onChange,g=void 0===h?s:h,m=e.onHeightChange,y=void 0===m?s:m,x=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,v),w=void 0!==x.value,S=i.useRef(null),z=function(e,t){var n=o().useRef();return o().useCallback((function(r){e.current=r,n.current&&u(n.current,null),n.current=t,t&&u(t,r)}),[t])}(S,t),R=i.useRef(0),F=i.useRef(),C=function(){var e=S.current,t=n&&F.current?F.current:p(e);if(t){F.current=t;var r=function(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=1/0),l||((l=document.createElement("textarea")).setAttribute("tabindex","-1"),l.setAttribute("aria-hidden","true"),c(l)),null===l.parentNode&&document.body.appendChild(l);var i=e.paddingSize,o=e.borderSize,a=e.sizingStyle,u=a.boxSizing;Object.keys(a).forEach((function(e){var t=e;l.style[t]=a[t]})),c(l),l.value=t;var d=f(l,e);l.value=t,d=f(l,e),l.value="x";var s=l.scrollHeight-i,h=s*n;"border-box"===u&&(h=h+i+o),d=Math.max(h,d);var g=s*r;return"border-box"===u&&(g=g+i+o),[d=Math.min(g,d),s]}(t,e.value||e.placeholder||"x",d,a),i=r[0],o=r[1];R.current!==i&&(R.current=i,e.style.setProperty("height",i+"px","important"),y(i,{rowHeight:o}))}};return i.useLayoutEffect(C),function(e,t){b(document.body,"reset",(function(n){e.current.form===n.target&&t(n)}))}(S,(function(){if(!w){var e=S.current.value;requestAnimationFrame((function(){var t=S.current;t&&e!==t.value&&C()}))}})),b(window,"resize",C),function(e){b(document.fonts,"loadingdone",e)}(C),i.createElement("textarea",r({},x,{onChange:function(e){w||C(),g(e)},ref:z}))},y=i.forwardRef(m)}}]);