Socket
Socket
Sign inDemoInstall

react-textarea-autosize

Package Overview
Dependencies
Maintainers
2
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 3.3.1 to 4.0.0

CHANGELOG.md

169

lib/TextareaAutosize.js

@@ -1,25 +0,18 @@

/**
* <TextareaAutosize />
*/
'use strict';
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
var _class, _temp; /**
* <TextareaAutosize />
*/
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = require('react');

@@ -33,65 +26,23 @@

var emptyFunction = function emptyFunction() {};
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var TextareaAutosize = (function (_React$Component) {
_inherits(TextareaAutosize, _React$Component);
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
_createClass(TextareaAutosize, null, [{
key: 'propTypes',
value: {
/**
* Current textarea value.
*/
value: _react2['default'].PropTypes.string,
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Callback on value change.
*/
onChange: _react2['default'].PropTypes.func,
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
/**
* Callback on height changes.
*/
onHeightChange: _react2['default'].PropTypes.func,
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* Try to cache DOM measurements performed by component so that we don't
* touch DOM when it's not needed.
*
* This optimization doesn't work if we dynamically style <textarea />
* component.
*/
useCacheForDOMMeasurements: _react2['default'].PropTypes.bool,
var emptyFunction = function emptyFunction() {};
/**
* Minimal numbder of rows to show.
*/
rows: _react2['default'].PropTypes.number,
var TextareaAutosize = (_temp = _class = function (_React$Component) {
_inherits(TextareaAutosize, _React$Component);
/**
* Alias for `rows`.
*/
minRows: _react2['default'].PropTypes.number,
/**
* Maximum number of rows to show.
*/
maxRows: _react2['default'].PropTypes.number
},
enumerable: true
}, {
key: 'defaultProps',
value: {
onChange: emptyFunction,
onHeightChange: emptyFunction,
useCacheForDOMMeasurements: false
},
enumerable: true
}]);
function TextareaAutosize(props) {
_classCallCheck(this, TextareaAutosize);
_get(Object.getPrototypeOf(TextareaAutosize.prototype), 'constructor', this).call(this, props);
this.state = {
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(TextareaAutosize).call(this, props));
_this.state = {
height: null,

@@ -101,7 +52,8 @@ minHeight: -Infinity,

};
this._onNextFrameActionId = null;
this._rootDOMNode = null;
this._onChange = this._onChange.bind(this);
this._resizeComponent = this._resizeComponent.bind(this);
this._onRootDOMNode = this._onRootDOMNode.bind(this);
_this._onNextFrameActionId = null;
_this._rootDOMNode = null;
_this._onChange = _this._onChange.bind(_this);
_this._resizeComponent = _this._resizeComponent.bind(_this);
_this._onRootDOMNode = _this._onRootDOMNode.bind(_this);
return _this;
}

@@ -114,8 +66,7 @@

var valueLink = _props.valueLink;
var onChange = _props.onChange;
var props = _objectWithoutProperties(_props, ['valueLink', 'onChange']);
var props = _objectWithoutProperties(_props, ['valueLink']);
props = _extends({}, props);
if (typeof valueLink === 'object') {
if ((typeof valueLink === 'undefined' ? 'undefined' : _typeof(valueLink)) === 'object') {
props.value = this.props.valueLink.value;

@@ -130,3 +81,3 @@ }

}
return _react2['default'].createElement('textarea', _extends({}, props, {
return _react2.default.createElement('textarea', _extends({}, props, {
onChange: this._onChange,

@@ -196,3 +147,3 @@ ref: this._onRootDOMNode

this.setState((0, _calculateNodeHeight2['default'])(this._rootDOMNode, useCacheForDOMMeasurements, this.props.rows || this.props.minRows, this.props.maxRows));
this.setState((0, _calculateNodeHeight2.default)(this._rootDOMNode, useCacheForDOMMeasurements, this.props.rows || this.props.minRows, this.props.maxRows));
}

@@ -203,5 +154,7 @@

*/
}, {
key: 'focus',
/**

@@ -217,2 +170,3 @@ * Put focus on a <textarea /> DOM element.

*/
}, {

@@ -227,3 +181,3 @@ key: 'blur',

return this._rootDOMNode.value;
},
}

@@ -233,2 +187,3 @@ /**

*/
,
set: function set(val) {

@@ -241,2 +196,3 @@ this._rootDOMNode.value = val;

*/
}, {

@@ -246,3 +202,3 @@ key: 'selectionStart',

return this._rootDOMNode.selectionStart;
},
}

@@ -252,2 +208,3 @@ /**

*/
,
set: function set(selectionStart) {

@@ -260,2 +217,3 @@ this._rootDOMNode.selectionStart = selectionStart;

*/
}, {

@@ -265,3 +223,3 @@ key: 'selectionEnd',

return this._rootDOMNode.selectionEnd;
},
}

@@ -271,2 +229,3 @@ /**

*/
,
set: function set(selectionEnd) {

@@ -278,6 +237,49 @@ this._rootDOMNode.selectionEnd = selectionEnd;

return TextareaAutosize;
})(_react2['default'].Component);
}(_react2.default.Component), _class.propTypes = {
/**
* Current textarea value.
*/
value: _react2.default.PropTypes.string,
exports['default'] = TextareaAutosize;
/**
* Callback on value change.
*/
onChange: _react2.default.PropTypes.func,
/**
* Callback on height changes.
*/
onHeightChange: _react2.default.PropTypes.func,
/**
* Try to cache DOM measurements performed by component so that we don't
* touch DOM when it's not needed.
*
* This optimization doesn't work if we dynamically style <textarea />
* component.
*/
useCacheForDOMMeasurements: _react2.default.PropTypes.bool,
/**
* Minimal numbder of rows to show.
*/
rows: _react2.default.PropTypes.number,
/**
* Alias for `rows`.
*/
minRows: _react2.default.PropTypes.number,
/**
* Maximum number of rows to show.
*/
maxRows: _react2.default.PropTypes.number
}, _class.defaultProps = {
onChange: emptyFunction,
onHeightChange: emptyFunction,
useCacheForDOMMeasurements: false
}, _temp);
exports.default = TextareaAutosize;
function onNextFrame(cb) {

@@ -297,2 +299,1 @@ if (window.requestAnimationFrame) {

}
module.exports = exports['default'];
{
"name": "react-textarea-autosize",
"description": "textarea component for React which grows with content",
"version": "3.3.1",
"version": "4.0.0",
"author": {

@@ -11,2 +11,10 @@ "name": "Andrey Popp",

"homepage": "https://github.com/andreypopp/react-textarea-autosize",
"eslintConfig": {
"extends": "prometheusresearch"
},
"babel": {
"presets": [
"prometheusresearch"
]
},
"keywords": [

@@ -22,3 +30,3 @@ "react",

"peerDependencies": {
"react": "^0.14.0"
"react": ">=0.14.0 <16.0.0"
},

@@ -30,9 +38,9 @@ "repository": {

"devDependencies": {
"react": "^0.14.0",
"babel": "^5.1.0",
"babel-eslint": "^3.0.1",
"eslint": "^0.19.0",
"eslint-plugin-react": "^2.1.0"
"babel-cli": "^6.7.5",
"babel-preset-prometheusresearch": "^0.1.0",
"eslint": "^2.7.0",
"eslint-config-prometheusresearch": "^0.2.0",
"react": "^15.0.0"
},
"dependencies": {}
}

Sorry, the diff of this file is not supported yet

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