Socket
Socket
Sign inDemoInstall

react-textarea-autosize

Package Overview
Dependencies
Maintainers
4
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-textarea-autosize - npm Package Compare versions

Comparing version 7.0.3 to 7.0.4

15

dist/react-textarea-autosize.js

@@ -56,2 +56,4 @@ (function (global, factory) {

var _isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
function createCommonjsModule(fn, module) {

@@ -841,3 +843,3 @@ return module = { exports: {} }, fn(module, module.exports), module.exports;

var isIE = !!document.documentElement.currentStyle;
var isIE = _isBrowser ? !!document.documentElement.currentStyle : false;
var HIDDEN_TEXTAREA_STYLE = {

@@ -856,3 +858,3 @@ 'min-height': '0',

var computedStyleCache = {};
var hiddenTextarea = document.createElement('textarea');
var hiddenTextarea = (_isBrowser) && document.createElement('textarea');

@@ -865,3 +867,3 @@ var forceHiddenStyles = function forceHiddenStyles(node) {

{
if (_isBrowser) {
forceHiddenStyles(hiddenTextarea);

@@ -1012,3 +1014,3 @@ }

var _ref = window.requestAnimationFrame ? [window.requestAnimationFrame.bind(window), window.cancelAnimationFrame.bind(window)] : [setTimeout, clearTimeout],
var _ref = (_isBrowser) && window.requestAnimationFrame ? [window.requestAnimationFrame.bind(window), window.cancelAnimationFrame.bind(window)] : [setTimeout, clearTimeout],
onNextFrame = _ref[0],

@@ -1048,2 +1050,7 @@ clearNextFrameAction = _ref[1];

if (!_this._ref) {
callback();
return;
}
var nodeHeight = calculateNodeHeight(_this._ref, _this._uid, _this.props.useCacheForDOMMeasurements, _this.props.minRows, _this.props.maxRows);

@@ -1050,0 +1057,0 @@

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t(e.TextareaAutosize={},e.React)}(this,function(e,i){"use strict";function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}i=i&&i.hasOwnProperty("default")?i.default:i;var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;!function(){try{if(!Object.assign)return;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return;var r={};"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join("")}catch(e){return}}();var o="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",h=Object.freeze({default:o,__moduleExports:o}),u=h?o:h;function p(){}var d,l=function(){function e(e,t,n,r,o,i){if(i!==u){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}var n={array:e.isRequired=e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=p,n.PropTypes=n},c=Object.freeze({default:l,__moduleExports:l}),f=c&&l||c,g=(function(e){e.exports=f()}(d={exports:{}},d.exports),!!document.documentElement.currentStyle),m={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},b=["letter-spacing","line-height","font-family","font-weight","font-size","font-style","tab-size","text-rendering","text-transform","width","text-indent","padding-top","padding-right","padding-bottom","padding-left","border-top-width","border-right-width","border-bottom-width","border-left-width","box-sizing"],y={},v=document.createElement("textarea"),w=function(t){Object.keys(m).forEach(function(e){t.style.setProperty(e,m[e],"important")})};function _(e,t,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=null),void 0===o&&(o=null),null===v.parentNode&&document.body.appendChild(v);var i=function(e,t,n){void 0===n&&(n=!1);if(n&&y[t])return y[t];var r=window.getComputedStyle(e);if(null===r)return null;var o=b.reduce(function(e,t){return e[t]=r.getPropertyValue(t),e},{}),i=o["box-sizing"];if(""===i)return null;g&&"border-box"===i&&(o.width=parseFloat(o.width)+parseFloat(r["border-right-width"])+parseFloat(r["border-left-width"])+parseFloat(r["padding-right"])+parseFloat(r["padding-left"])+"px");var a={sizingStyle:o,paddingSize:parseFloat(o["padding-bottom"])+parseFloat(o["padding-top"]),borderSize:parseFloat(o["border-bottom-width"])+parseFloat(o["border-top-width"]),boxSizing:i};n&&(y[t]=a);return a}(e,t,n);if(null===i)return null;var a=i.paddingSize,s=i.borderSize,h=i.boxSizing,u=i.sizingStyle;Object.keys(u).forEach(function(e){v.style[e]=u[e]}),w(v),v.value=e.value||e.placeholder||"x";var p=-1/0,d=1/0,l=v.scrollHeight;"border-box"===h?l+=s:"content-box"===h&&(l-=a),v.value="x";var c=v.scrollHeight-a,f=Math.floor(l/c);return null!==r&&(p=c*r,"border-box"===h&&(p=p+a+s),l=Math.max(p,l)),null!==o&&(d=c*o,"border-box"===h&&(d=d+a+s),l=Math.min(d,l)),{height:l,minHeight:p,maxHeight:d,rowCount:Math.floor(l/c),valueRowCount:f}}w(v);var x=function(){},O=window.requestAnimationFrame?[window.requestAnimationFrame,window.cancelAnimationFrame]:[setTimeout,clearTimeout],z=O[0],C=O[1],j=0,R=function(t){var e,n;function r(e){var a;return(a=t.call(this,e)||this)._onRef=function(e){a._ref=e,a.props.inputRef(e)},a._onChange=function(e){a._controlled||a._resizeComponent(),a.props.onChange(e,s(s(a)))},a._resizeComponent=function(e){void 0===e&&(e=x);var t=_(a._ref,a._uid,a.props.useCacheForDOMMeasurements,a.props.minRows,a.props.maxRows);if(null!==t){var n=t.height,r=t.minHeight,o=t.maxHeight,i=t.valueRowCount;a.rowCount=t.rowCount,a.valueRowCount=i,a.state.height===n&&a.state.minHeight===r&&a.state.maxHeight===o?e():a.setState({height:n,minHeight:r,maxHeight:o},e)}else e()},a.state={height:e.style&&e.style.height||0,minHeight:-1/0,maxHeight:1/0},a._uid=j++,a._controlled=void 0!==e.value,a._resizeLock=!1,a}(e=r).prototype=Object.create((n=t).prototype),(e.prototype.constructor=e).__proto__=n;var o=r.prototype;return o.render=function(){var e=this.props,t=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])<0&&(o[n]=e[n]);return o}(e,["inputRef","maxRows","minRows","onHeightChange","useCacheForDOMMeasurements"]);return t.style=a({},t.style,{height:this.state.height}),Math.max(t.style.maxHeight||1/0,this.state.maxHeight)<this.state.height&&(t.style.overflow="hidden"),i.createElement("textarea",a({},t,{onChange:this._onChange,ref:this._onRef}))},o.componentDidMount=function(){var e=this;this._resizeComponent(),this._resizeListener=function(){e._resizeLock||(e._resizeLock=!0,e._resizeComponent(function(){e._resizeLock=!1}))},window.addEventListener("resize",this._resizeListener)},o.componentDidUpdate=function(e,t){var n=this;e!==this.props&&(C(this._rafId),this._rafId=z(function(){n._resizeComponent()})),this.state.height!==t.height&&this.props.onHeightChange(this.state.height,this)},o.componentWillUnmount=function(){C(this._rafId),window.removeEventListener("resize",this._resizeListener),delete y[this._uid]},r}(i.Component);R.defaultProps={inputRef:x,onChange:x,onHeightChange:x,useCacheForDOMMeasurements:!1},e.default=R,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t(e.TextareaAutosize={},e.React)}(this,function(e,i){"use strict";function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}i=i&&i.hasOwnProperty("default")?i.default:i;var t="undefined"!=typeof window&&"undefined"!=typeof document;var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;!function(){try{if(!Object.assign)return;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return;var o={};"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),Object.keys(Object.assign({},o)).join("")}catch(e){return}}();var h="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",u=Object.freeze({default:h,__moduleExports:h}),p=u?h:u;function d(){}var l,c=function(){function e(e,t,n,o,r,i){if(i!==p){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}var n={array:e.isRequired=e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=d,n.PropTypes=n},f=Object.freeze({default:c,__moduleExports:c}),g=f&&c||f,m=(function(e){e.exports=g()}(l={exports:{}},l.exports),!!t&&!!document.documentElement.currentStyle),b={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},y=["letter-spacing","line-height","font-family","font-weight","font-size","font-style","tab-size","text-rendering","text-transform","width","text-indent","padding-top","padding-right","padding-bottom","padding-left","border-top-width","border-right-width","border-bottom-width","border-left-width","box-sizing"],v={},w=t&&document.createElement("textarea"),_=function(t){Object.keys(b).forEach(function(e){t.style.setProperty(e,b[e],"important")})};function x(e,t,n,o,r){void 0===n&&(n=!1),void 0===o&&(o=null),void 0===r&&(r=null),null===w.parentNode&&document.body.appendChild(w);var i=function(e,t,n){void 0===n&&(n=!1);if(n&&v[t])return v[t];var o=window.getComputedStyle(e);if(null===o)return null;var r=y.reduce(function(e,t){return e[t]=o.getPropertyValue(t),e},{}),i=r["box-sizing"];if(""===i)return null;m&&"border-box"===i&&(r.width=parseFloat(r.width)+parseFloat(o["border-right-width"])+parseFloat(o["border-left-width"])+parseFloat(o["padding-right"])+parseFloat(o["padding-left"])+"px");var a={sizingStyle:r,paddingSize:parseFloat(r["padding-bottom"])+parseFloat(r["padding-top"]),borderSize:parseFloat(r["border-bottom-width"])+parseFloat(r["border-top-width"]),boxSizing:i};n&&(v[t]=a);return a}(e,t,n);if(null===i)return null;var a=i.paddingSize,s=i.borderSize,h=i.boxSizing,u=i.sizingStyle;Object.keys(u).forEach(function(e){w.style[e]=u[e]}),_(w),w.value=e.value||e.placeholder||"x";var p=-1/0,d=1/0,l=w.scrollHeight;"border-box"===h?l+=s:"content-box"===h&&(l-=a),w.value="x";var c=w.scrollHeight-a,f=Math.floor(l/c);return null!==o&&(p=c*o,"border-box"===h&&(p=p+a+s),l=Math.max(p,l)),null!==r&&(d=c*r,"border-box"===h&&(d=d+a+s),l=Math.min(d,l)),{height:l,minHeight:p,maxHeight:d,rowCount:Math.floor(l/c),valueRowCount:f}}t&&_(w);var O=function(){},z=t&&window.requestAnimationFrame?[window.requestAnimationFrame,window.cancelAnimationFrame]:[setTimeout,clearTimeout],C=z[0],j=z[1],R=0,H=function(t){var e,n;function o(e){var a;return(a=t.call(this,e)||this)._onRef=function(e){a._ref=e,a.props.inputRef(e)},a._onChange=function(e){a._controlled||a._resizeComponent(),a.props.onChange(e,s(s(a)))},a._resizeComponent=function(e){if(void 0===e&&(e=O),a._ref){var t=x(a._ref,a._uid,a.props.useCacheForDOMMeasurements,a.props.minRows,a.props.maxRows);if(null!==t){var n=t.height,o=t.minHeight,r=t.maxHeight,i=t.valueRowCount;a.rowCount=t.rowCount,a.valueRowCount=i,a.state.height===n&&a.state.minHeight===o&&a.state.maxHeight===r?e():a.setState({height:n,minHeight:o,maxHeight:r},e)}else e()}else e()},a.state={height:e.style&&e.style.height||0,minHeight:-1/0,maxHeight:1/0},a._uid=R++,a._controlled=void 0!==e.value,a._resizeLock=!1,a}(e=o).prototype=Object.create((n=t).prototype),(e.prototype.constructor=e).__proto__=n;var r=o.prototype;return r.render=function(){var e=this.props,t=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])<0&&(r[n]=e[n]);return r}(e,["inputRef","maxRows","minRows","onHeightChange","useCacheForDOMMeasurements"]);return t.style=a({},t.style,{height:this.state.height}),Math.max(t.style.maxHeight||1/0,this.state.maxHeight)<this.state.height&&(t.style.overflow="hidden"),i.createElement("textarea",a({},t,{onChange:this._onChange,ref:this._onRef}))},r.componentDidMount=function(){var e=this;this._resizeComponent(),this._resizeListener=function(){e._resizeLock||(e._resizeLock=!0,e._resizeComponent(function(){e._resizeLock=!1}))},window.addEventListener("resize",this._resizeListener)},r.componentDidUpdate=function(e,t){var n=this;e!==this.props&&(j(this._rafId),this._rafId=C(function(){n._resizeComponent()})),this.state.height!==t.height&&this.props.onHeightChange(this.state.height,this)},r.componentWillUnmount=function(){j(this._rafId),window.removeEventListener("resize",this._resizeListener),delete v[this._uid]},o}(i.Component);H.defaultProps={inputRef:O,onChange:O,onHeightChange:O,useCacheForDOMMeasurements:!1},e.default=H,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "react-textarea-autosize",
"description": "textarea component for React which grows with content",
"version": "7.0.3",
"version": "7.0.4",
"keywords": "autosize, grow, react, react-component, textarea",

@@ -25,9 +25,9 @@ "repository": "andreypopp/react-textarea-autosize",

"lint": "eslint src",
"update:size": "npm run build && node scripts/update-size.js && git add README.md",
"update:size": "cross-env ROLLUP_BUILDS=browser npm run build && node scripts/update-size.js && git add README.md",
"prepare": "npm run build",
"precommit": "lint-staged && npm run update:size",
"prerelease": "npm run lint",
"release:patch": "npm run prerelease && npm version patch && npm publish && git push --follow-tags",
"release:minor": "npm run prerelease && npm version minor && npm publish && git push --follow-tags",
"release:major": "npm run prerelease && npm version major && npm publish && git push --follow-tags"
"preversion": "npm run lint",
"release:patch": "npm version patch && npm publish && git push --follow-tags",
"release:minor": "npm version minor && npm publish && git push --follow-tags",
"release:major": "npm version major && npm publish && git push --follow-tags"
},

@@ -34,0 +34,0 @@ "peerDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc