Socket
Socket
Sign inDemoInstall

react-textarea-autosize

Package Overview
Dependencies
2
Maintainers
4
Versions
98
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.6 to 5.0.7

2

dist/react-textarea-autosize.js

@@ -27,3 +27,3 @@ (function (global, factory) {

var SIZING_STYLE = ['letter-spacing', 'line-height', 'font-family', 'font-weight', 'font-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'];
var SIZING_STYLE = ['letter-spacing', 'line-height', 'font-family', 'font-weight', 'font-size', 'font-style', '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'];

@@ -30,0 +30,0 @@ var computedStyleCache = {};

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):e.TextareaAutosize=t(e.React,e.PropTypes)}(this,function(e,t){"use strict";function n(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;null===a.parentNode&&document.body.appendChild(a);var u=o(e,t,n);if(null===u)return null;var h=u.paddingSize,d=u.borderSize,l=u.boxSizing,p=u.sizingStyle;Object.keys(p).forEach(function(e){a.style[e]=p[e]}),Object.keys(s).forEach(function(e){a.style.setProperty(e,s[e],"important")}),a.value=e.value||e.placeholder||"x";var c=-1/0,f=1/0,g=a.scrollHeight;"border-box"===l?g+=d:"content-box"===l&&(g-=h),a.value="x";var m=a.scrollHeight-h;return null===i&&null===r||(null!==i&&(c=m*i,"border-box"===l&&(c=c+h+d),g=Math.max(c,g)),null!==r&&(f=m*r,"border-box"===l&&(f=f+h+d),g=Math.min(f,g))),{height:g,minHeight:c,maxHeight:f,rowCount:Math.floor(g/m)}}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(n&&h[t])return h[t];var o=window.getComputedStyle(e);if(null===o)return null;var i=u.reduce(function(e,t){return e[t]=o.getPropertyValue(t),e},{}),a=i["box-sizing"];r&&"border-box"===a&&(i.width=parseFloat(i.width)+parseFloat(o["border-right-width"])+parseFloat(o["border-left-width"])+parseFloat(o["padding-right"])+parseFloat(o["padding-left"])+"px");var s=parseFloat(i["padding-bottom"])+parseFloat(i["padding-top"]),d=parseFloat(i["border-bottom-width"])+parseFloat(i["border-top-width"]),l={sizingStyle:i,paddingSize:s,borderSize:d,boxSizing:a};return n&&(h[t]=l),l}e="default"in e?e.default:e,t="default"in t?t.default:t;var i="undefined"!=typeof window&&"undefined"!=typeof document,r=!!i&&!!document.documentElement.currentStyle,a=i&&document.createElement("textarea"),s={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},u=["letter-spacing","line-height","font-family","font-weight","font-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"],h={},d=function(e){return delete h[e]},l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(){return++e}}(),p=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},c=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},f=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},g=function(e,t){var n={};for(var o in e)0>t.indexOf(o)&&Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},m=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},b=function(){},y=i&&window.requestAnimationFrame?[window.requestAnimationFrame,window.cancelAnimationFrame]:[setTimeout,clearTimeout],v=y[0],w=y[1],x=function(t){function o(e){p(this,o);var i=m(this,t.call(this,e));return i._resizeLock=!1,i._onRootDOMNode=function(e){i._rootDOMNode=e,i.props.inputRef&&i.props.inputRef(e)},i._onChange=function(e){i._controlled||i._resizeComponent(),i.props.onChange(e)},i._resizeComponent=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b;if(void 0===i._rootDOMNode)return void e();var t=n(i._rootDOMNode,i._uid,i.props.useCacheForDOMMeasurements,i.props.minRows,i.props.maxRows);if(null===t)return void e();var o=t.height,r=t.minHeight,a=t.maxHeight;if(i.rowCount=t.rowCount,i.state.height!==o||i.state.minHeight!==r||i.state.maxHeight!==a)return void i.setState({height:o,minHeight:r,maxHeight:a},e);e()},i.state={height:e.style&&e.style.height||0,minHeight:-1/0,maxHeight:1/0},i._uid=l(),i._controlled="string"==typeof e.value,i}return f(o,t),o.prototype.render=function(){var t=this.props,n=g(t,["minRows","maxRows","onHeightChange","useCacheForDOMMeasurements","inputRef"]);return n.style=c({},n.style,{height:this.state.height}),this.state.height>Math.max(n.style.maxHeight||1/0,this.state.maxHeight)&&(n.style.overflow="hidden"),e.createElement("textarea",c({},n,{onChange:this._onChange,ref:this._onRootDOMNode}))},o.prototype.componentDidMount=function(){var e=this;this._resizeComponent(),this._resizeListener=function(){e._resizeLock||(e._resizeLock=!0,e._resizeComponent(function(){return e._resizeLock=!1}))},window.addEventListener("resize",this._resizeListener)},o.prototype.componentWillReceiveProps=function(){var e=this;this._clearNextFrame(),this._onNextFrameActionId=v(function(){return e._resizeComponent()})},o.prototype.componentDidUpdate=function(e,t){this.state.height!==t.height&&this.props.onHeightChange(this.state.height,this)},o.prototype.componentWillUnmount=function(){this._clearNextFrame(),window.removeEventListener("resize",this._resizeListener),d(this._uid)},o.prototype._clearNextFrame=function(){w(this._onNextFrameActionId)},o}(e.Component);return x.propTypes={value:t.string,onChange:t.func,onHeightChange:t.func,useCacheForDOMMeasurements:t.bool,minRows:t.number,maxRows:t.number,inputRef:t.func},x.defaultProps={onChange:b,onHeightChange:b,useCacheForDOMMeasurements:!1},x});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):e.TextareaAutosize=t(e.React,e.PropTypes)}(this,function(e,t){"use strict";function n(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;null===a.parentNode&&document.body.appendChild(a);var u=o(e,t,n);if(null===u)return null;var h=u.paddingSize,l=u.borderSize,d=u.boxSizing,p=u.sizingStyle;Object.keys(p).forEach(function(e){a.style[e]=p[e]}),Object.keys(s).forEach(function(e){a.style.setProperty(e,s[e],"important")}),a.value=e.value||e.placeholder||"x";var c=-1/0,f=1/0,g=a.scrollHeight;"border-box"===d?g+=l:"content-box"===d&&(g-=h),a.value="x";var m=a.scrollHeight-h;return null===i&&null===r||(null!==i&&(c=m*i,"border-box"===d&&(c=c+h+l),g=Math.max(c,g)),null!==r&&(f=m*r,"border-box"===d&&(f=f+h+l),g=Math.min(f,g))),{height:g,minHeight:c,maxHeight:f,rowCount:Math.floor(g/m)}}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(n&&h[t])return h[t];var o=window.getComputedStyle(e);if(null===o)return null;var i=u.reduce(function(e,t){return e[t]=o.getPropertyValue(t),e},{}),a=i["box-sizing"];r&&"border-box"===a&&(i.width=parseFloat(i.width)+parseFloat(o["border-right-width"])+parseFloat(o["border-left-width"])+parseFloat(o["padding-right"])+parseFloat(o["padding-left"])+"px");var s=parseFloat(i["padding-bottom"])+parseFloat(i["padding-top"]),l=parseFloat(i["border-bottom-width"])+parseFloat(i["border-top-width"]),d={sizingStyle:i,paddingSize:s,borderSize:l,boxSizing:a};return n&&(h[t]=d),d}e="default"in e?e.default:e,t="default"in t?t.default:t;var i="undefined"!=typeof window&&"undefined"!=typeof document,r=!!i&&!!document.documentElement.currentStyle,a=i&&document.createElement("textarea"),s={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},u=["letter-spacing","line-height","font-family","font-weight","font-size","font-style","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"],h={},l=function(e){return delete h[e]},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(){return++e}}(),p=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},c=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},f=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},g=function(e,t){var n={};for(var o in e)0>t.indexOf(o)&&Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},m=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},y=function(){},b=i&&window.requestAnimationFrame?[window.requestAnimationFrame,window.cancelAnimationFrame]:[setTimeout,clearTimeout],v=b[0],w=b[1],x=function(t){function o(e){p(this,o);var i=m(this,t.call(this,e));return i._resizeLock=!1,i._onRootDOMNode=function(e){i._rootDOMNode=e,i.props.inputRef&&i.props.inputRef(e)},i._onChange=function(e){i._controlled||i._resizeComponent(),i.props.onChange(e)},i._resizeComponent=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;if(void 0===i._rootDOMNode)return void e();var t=n(i._rootDOMNode,i._uid,i.props.useCacheForDOMMeasurements,i.props.minRows,i.props.maxRows);if(null===t)return void e();var o=t.height,r=t.minHeight,a=t.maxHeight;if(i.rowCount=t.rowCount,i.state.height!==o||i.state.minHeight!==r||i.state.maxHeight!==a)return void i.setState({height:o,minHeight:r,maxHeight:a},e);e()},i.state={height:e.style&&e.style.height||0,minHeight:-1/0,maxHeight:1/0},i._uid=d(),i._controlled="string"==typeof e.value,i}return f(o,t),o.prototype.render=function(){var t=this.props,n=g(t,["minRows","maxRows","onHeightChange","useCacheForDOMMeasurements","inputRef"]);return n.style=c({},n.style,{height:this.state.height}),this.state.height>Math.max(n.style.maxHeight||1/0,this.state.maxHeight)&&(n.style.overflow="hidden"),e.createElement("textarea",c({},n,{onChange:this._onChange,ref:this._onRootDOMNode}))},o.prototype.componentDidMount=function(){var e=this;this._resizeComponent(),this._resizeListener=function(){e._resizeLock||(e._resizeLock=!0,e._resizeComponent(function(){return e._resizeLock=!1}))},window.addEventListener("resize",this._resizeListener)},o.prototype.componentWillReceiveProps=function(){var e=this;this._clearNextFrame(),this._onNextFrameActionId=v(function(){return e._resizeComponent()})},o.prototype.componentDidUpdate=function(e,t){this.state.height!==t.height&&this.props.onHeightChange(this.state.height,this)},o.prototype.componentWillUnmount=function(){this._clearNextFrame(),window.removeEventListener("resize",this._resizeListener),l(this._uid)},o.prototype._clearNextFrame=function(){w(this._onNextFrameActionId)},o}(e.Component);return x.propTypes={value:t.string,onChange:t.func,onHeightChange:t.func,useCacheForDOMMeasurements:t.bool,minRows:t.number,maxRows:t.number,inputRef:t.func},x.defaultProps={onChange:y,onHeightChange:y,useCacheForDOMMeasurements:!1},x});

@@ -17,3 +17,3 @@ import isBrowser from './isBrowser';

var SIZING_STYLE = ['letter-spacing', 'line-height', 'font-family', 'font-weight', 'font-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'];
var SIZING_STYLE = ['letter-spacing', 'line-height', 'font-family', 'font-weight', 'font-size', 'font-style', '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'];

@@ -20,0 +20,0 @@ var computedStyleCache = {};

@@ -28,3 +28,3 @@ 'use strict';

var SIZING_STYLE = ['letter-spacing', 'line-height', 'font-family', 'font-weight', 'font-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'];
var SIZING_STYLE = ['letter-spacing', 'line-height', 'font-family', 'font-weight', 'font-size', 'font-style', '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'];

@@ -31,0 +31,0 @@ var computedStyleCache = {};

{
"name": "react-textarea-autosize",
"description": "textarea component for React which grows with content",
"version": "5.0.6",
"version": "5.0.7",
"keywords": "autosize, grow, react, react-component, textarea",

@@ -23,4 +23,5 @@ "repository": "andreypopp/react-textarea-autosize",

"lint": "eslint src",
"prepare": "npm run build",
"precommit": "lint-staged",
"prerelease": "npm run lint && npm run build",
"prerelease": "npm run lint && npm run prepare",
"release:patch": "npm run prerelease && npm version patch && git push --follow-tags && npm publish",

@@ -45,3 +46,3 @@ "release:minor": "npm run prerelease && npm version minor && git push --follow-tags && npm publish",

"lint-staged": "^3.4.2",
"prettier": "^1.3.1",
"prettier": "^1.4.1",
"react": "^15.3.1",

@@ -48,0 +49,0 @@ "react-dom": "^15.3.1",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc