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.4 to 7.1.0-0

18

dist/react-textarea-autosize.cjs.browser.js

@@ -220,11 +220,4 @@ 'use strict';

var noop = function noop() {}; // IE11 has a problem with eval source maps, can be reproduced with:
// eval('"use strict"; var onNextFrame = window.cancelAnimationFrame; onNextFrame(4);')
// so we bind window as context in dev modes
var noop = function noop() {};
var _ref = window.requestAnimationFrame ? process.env.NODE_ENV !== 'development' ? [window.requestAnimationFrame, window.cancelAnimationFrame] : [window.requestAnimationFrame.bind(window), window.cancelAnimationFrame.bind(window)] : [setTimeout, clearTimeout],
onNextFrame = _ref[0],
clearNextFrameAction = _ref[1];
var uid = 0;

@@ -350,10 +343,4 @@

_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
var _this3 = this;
if (prevProps !== this.props) {
clearNextFrameAction(this._rafId); // cant shorthen the callback because requestAnimationFrame calls it with current time
this._rafId = onNextFrame(function () {
_this3._resizeComponent();
});
this._resizeComponent();
}

@@ -367,3 +354,2 @@

_proto.componentWillUnmount = function componentWillUnmount() {
clearNextFrameAction(this._rafId);
window.removeEventListener('resize', this._resizeListener);

@@ -370,0 +356,0 @@ purgeCache(this._uid);

@@ -222,11 +222,4 @@ 'use strict';

var noop = function noop() {}; // IE11 has a problem with eval source maps, can be reproduced with:
// eval('"use strict"; var onNextFrame = window.cancelAnimationFrame; onNextFrame(4);')
// so we bind window as context in dev modes
var noop = function noop() {};
var _ref = (_isBrowser) && window.requestAnimationFrame ? process.env.NODE_ENV !== 'development' ? [window.requestAnimationFrame, window.cancelAnimationFrame] : [window.requestAnimationFrame.bind(window), window.cancelAnimationFrame.bind(window)] : [setTimeout, clearTimeout],
onNextFrame = _ref[0],
clearNextFrameAction = _ref[1];
var uid = 0;

@@ -357,10 +350,4 @@

_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
var _this3 = this;
if (prevProps !== this.props) {
clearNextFrameAction(this._rafId); // cant shorthen the callback because requestAnimationFrame calls it with current time
this._rafId = onNextFrame(function () {
_this3._resizeComponent();
});
this._resizeComponent();
}

@@ -374,3 +361,2 @@

_proto.componentWillUnmount = function componentWillUnmount() {
clearNextFrameAction(this._rafId);
window.removeEventListener('resize', this._resizeListener);

@@ -377,0 +363,0 @@ purgeCache(this._uid);

@@ -214,11 +214,4 @@ import React from 'react';

var noop = function noop() {}; // IE11 has a problem with eval source maps, can be reproduced with:
// eval('"use strict"; var onNextFrame = window.cancelAnimationFrame; onNextFrame(4);')
// so we bind window as context in dev modes
var noop = function noop() {};
var _ref = window.requestAnimationFrame ? process.env.NODE_ENV !== 'development' ? [window.requestAnimationFrame, window.cancelAnimationFrame] : [window.requestAnimationFrame.bind(window), window.cancelAnimationFrame.bind(window)] : [setTimeout, clearTimeout],
onNextFrame = _ref[0],
clearNextFrameAction = _ref[1];
var uid = 0;

@@ -344,10 +337,4 @@

_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
var _this3 = this;
if (prevProps !== this.props) {
clearNextFrameAction(this._rafId); // cant shorthen the callback because requestAnimationFrame calls it with current time
this._rafId = onNextFrame(function () {
_this3._resizeComponent();
});
this._resizeComponent();
}

@@ -361,3 +348,2 @@

_proto.componentWillUnmount = function componentWillUnmount() {
clearNextFrameAction(this._rafId);
window.removeEventListener('resize', this._resizeListener);

@@ -364,0 +350,0 @@ purgeCache(this._uid);

@@ -216,11 +216,4 @@ import React from 'react';

var noop = function noop() {}; // IE11 has a problem with eval source maps, can be reproduced with:
// eval('"use strict"; var onNextFrame = window.cancelAnimationFrame; onNextFrame(4);')
// so we bind window as context in dev modes
var noop = function noop() {};
var _ref = (_isBrowser) && window.requestAnimationFrame ? process.env.NODE_ENV !== 'development' ? [window.requestAnimationFrame, window.cancelAnimationFrame] : [window.requestAnimationFrame.bind(window), window.cancelAnimationFrame.bind(window)] : [setTimeout, clearTimeout],
onNextFrame = _ref[0],
clearNextFrameAction = _ref[1];
var uid = 0;

@@ -351,10 +344,4 @@

_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
var _this3 = this;
if (prevProps !== this.props) {
clearNextFrameAction(this._rafId); // cant shorthen the callback because requestAnimationFrame calls it with current time
this._rafId = onNextFrame(function () {
_this3._resizeComponent();
});
this._resizeComponent();
}

@@ -368,3 +355,2 @@

_proto.componentWillUnmount = function componentWillUnmount() {
clearNextFrameAction(this._rafId);
window.removeEventListener('resize', this._resizeListener);

@@ -371,0 +357,0 @@ purgeCache(this._uid);

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

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

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

var _isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
var isIE = _isBrowser ? !!document.documentElement.currentStyle : false;

@@ -1007,11 +1007,4 @@ var HIDDEN_TEXTAREA_STYLE = {

var noop = function noop() {}; // IE11 has a problem with eval source maps, can be reproduced with:
// eval('"use strict"; var onNextFrame = window.cancelAnimationFrame; onNextFrame(4);')
// so we bind window as context in dev modes
var noop = function noop() {};
var _ref = (_isBrowser) && window.requestAnimationFrame ? [window.requestAnimationFrame.bind(window), window.cancelAnimationFrame.bind(window)] : [setTimeout, clearTimeout],
onNextFrame = _ref[0],
clearNextFrameAction = _ref[1];
var uid = 0;

@@ -1142,10 +1135,4 @@

_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
var _this3 = this;
if (prevProps !== this.props) {
clearNextFrameAction(this._rafId); // cant shorthen the callback because requestAnimationFrame calls it with current time
this._rafId = onNextFrame(function () {
_this3._resizeComponent();
});
this._resizeComponent();
}

@@ -1159,3 +1146,2 @@

_proto.componentWillUnmount = function componentWillUnmount() {
clearNextFrameAction(this._rafId);
window.removeEventListener('resize', this._resizeListener);

@@ -1162,0 +1148,0 @@ purgeCache(this._uid);

2

dist/react-textarea-autosize.min.js

@@ -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 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})});
!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=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=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 r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",h=Object.freeze({default:r,__moduleExports:r}),p=h?r:h;function u(){}var d,l=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=u,n.PropTypes=n},c=Object.freeze({default:l,__moduleExports:l}),f=c&&l||c,g=(function(e){e.exports=f()}(d={exports:{}},d.exports),"undefined"!=typeof window&&"undefined"!=typeof document),m=!!g&&!!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={},_=g&&document.createElement("textarea"),w=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===_.parentNode&&document.body.appendChild(_);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,p=i.sizingStyle;Object.keys(p).forEach(function(e){_.style[e]=p[e]}),w(_),_.value=e.value||e.placeholder||"x";var u=-1/0,d=1/0,l=_.scrollHeight;"border-box"===h?l+=s:"content-box"===h&&(l-=a),_.value="x";var c=_.scrollHeight-a,f=Math.floor(l/c);return null!==o&&(u=c*o,"border-box"===h&&(u=u+a+s),l=Math.max(u,l)),null!==r&&(d=c*r,"border-box"===h&&(d=d+a+s),l=Math.min(d,l)),{height:l,minHeight:u,maxHeight:d,rowCount:Math.floor(l/c),valueRowCount:f}}g&&w(_);var O=function(){},z=0,C=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=z++,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){e!==this.props&&this._resizeComponent(),this.state.height!==t.height&&this.props.onHeightChange(this.state.height,this)},r.componentWillUnmount=function(){window.removeEventListener("resize",this._resizeListener),delete v[this._uid]},o}(i.Component);C.defaultProps={inputRef:O,onChange:O,onHeightChange:O,useCacheForDOMMeasurements:!1},e.default=C,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "react-textarea-autosize",
"description": "textarea component for React which grows with content",
"version": "7.0.4",
"version": "7.1.0-0",
"keywords": "autosize, grow, react, react-component, textarea",

@@ -6,0 +6,0 @@ "repository": "andreypopp/react-textarea-autosize",

@@ -9,3 +9,3 @@ [![npm version](https://img.shields.io/npm/v/react-textarea-autosize.svg)](https://www.npmjs.com/package/react-textarea-autosize)

[jQuery Autosize](http://www.jacklmoore.com/autosize/)! Weighs
<span class="weight">1.87 KB</span> (minified & gzipped).
<span class="weight">1.79 KB</span> (minified & gzipped).

@@ -12,0 +12,0 @@ This module supports IE9 and above.

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