react-textarea-autosize
Advanced tools
Comparing version 5.2.1 to 6.0.0-0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('prop-types')) : | ||
typeof define === 'function' && define.amd ? define(['react', 'prop-types'], factory) : | ||
(global.TextareaAutosize = factory(global.React,global.PropTypes)); | ||
}(this, (function (React,PropTypes) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) : | ||
(factory((global.TextareaAutosize = {}),global.React)); | ||
}(this, (function (exports,React) { 'use strict'; | ||
React = React && React.hasOwnProperty('default') ? React['default'] : React; | ||
PropTypes = PropTypes && PropTypes.hasOwnProperty('default') ? PropTypes['default'] : PropTypes; | ||
@@ -34,2 +33,15 @@ function _extends() { | ||
var _sPO = Object.setPrototypeOf || function _sPO(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
var _construct = typeof Reflect === "object" && Reflect.construct || function _construct(Parent, args, Class) { | ||
var Constructor, | ||
a = [null]; | ||
a.push.apply(a, args); | ||
Constructor = Parent.bind.apply(Parent, a); | ||
return _sPO(new Constructor(), Class.prototype); | ||
}; | ||
function _objectWithoutProperties(source, excluded) { | ||
@@ -61,2 +73,849 @@ if (source == null) return {}; | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
*/ | ||
function makeEmptyFunction(arg) { | ||
return function () { | ||
return arg; | ||
}; | ||
} | ||
/** | ||
* This function accepts and discards inputs; it has no side effects. This is | ||
* primarily useful idiomatically for overridable function endpoints which | ||
* always need to be callable, since JS lacks a null-call idiom ala Cocoa. | ||
*/ | ||
var emptyFunction = function emptyFunction() {}; | ||
emptyFunction.thatReturns = makeEmptyFunction; | ||
emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | ||
emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | ||
emptyFunction.thatReturnsNull = makeEmptyFunction(null); | ||
emptyFunction.thatReturnsThis = function () { | ||
return this; | ||
}; | ||
emptyFunction.thatReturnsArgument = function (arg) { | ||
return arg; | ||
}; | ||
var emptyFunction_1 = emptyFunction; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
/** | ||
* Use invariant() to assert state which your program assumes to be true. | ||
* | ||
* Provide sprintf-style format (only %s is supported) and arguments | ||
* to provide information about what broke and what you were | ||
* expecting. | ||
* | ||
* The invariant message will be stripped in production, but the invariant | ||
* will remain to ensure logic does not differ in production. | ||
*/ | ||
var validateFormat = function validateFormat(format) {}; | ||
{ | ||
validateFormat = function validateFormat(format) { | ||
if (format === undefined) { | ||
throw new Error('invariant requires an error message argument'); | ||
} | ||
}; | ||
} | ||
function invariant(condition, format, a, b, c, d, e, f) { | ||
validateFormat(format); | ||
if (!condition) { | ||
var error; | ||
if (format === undefined) { | ||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | ||
} else { | ||
var args = [a, b, c, d, e, f]; | ||
var argIndex = 0; | ||
error = new Error(format.replace(/%s/g, function () { | ||
return args[argIndex++]; | ||
})); | ||
error.name = 'Invariant Violation'; | ||
} | ||
error.framesToPop = 1; // we don't care about invariant's own frame | ||
throw error; | ||
} | ||
} | ||
var invariant_1 = invariant; | ||
/** | ||
* Similar to invariant but only logs a warning if the condition is not met. | ||
* This can be used to log issues in development environments in critical | ||
* paths. Removing the logging code for production environments will keep the | ||
* same logic and follow the same code paths. | ||
*/ | ||
var warning = emptyFunction_1; | ||
{ | ||
var printWarning = function printWarning(format) { | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
var argIndex = 0; | ||
var message = 'Warning: ' + format.replace(/%s/g, function () { | ||
return args[argIndex++]; | ||
}); | ||
if (typeof console !== 'undefined') { | ||
console.error(message); | ||
} | ||
try { | ||
// --- Welcome to debugging React --- | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch (x) {} | ||
}; | ||
warning = function warning(condition, format) { | ||
if (format === undefined) { | ||
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | ||
} | ||
if (format.indexOf('Failed Composite propType: ') === 0) { | ||
return; // Ignore CompositeComponent proptype check. | ||
} | ||
if (!condition) { | ||
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
args[_key2 - 2] = arguments[_key2]; | ||
} | ||
printWarning.apply(undefined, [format].concat(args)); | ||
} | ||
}; | ||
} | ||
var warning_1 = warning; | ||
/* | ||
object-assign | ||
(c) Sindre Sorhus | ||
@license MIT | ||
*/ | ||
/* eslint-disable no-unused-vars */ | ||
var getOwnPropertySymbols = Object.getOwnPropertySymbols; | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
var propIsEnumerable = Object.prototype.propertyIsEnumerable; | ||
function toObject(val) { | ||
if (val === null || val === undefined) { | ||
throw new TypeError('Object.assign cannot be called with null or undefined'); | ||
} | ||
return Object(val); | ||
} | ||
function shouldUseNative() { | ||
try { | ||
if (!Object.assign) { | ||
return false; | ||
} | ||
// Detect buggy property enumeration order in older V8 versions. | ||
// https://bugs.chromium.org/p/v8/issues/detail?id=4118 | ||
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers | ||
test1[5] = 'de'; | ||
if (Object.getOwnPropertyNames(test1)[0] === '5') { | ||
return false; | ||
} | ||
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 | ||
var test2 = {}; | ||
for (var i = 0; i < 10; i++) { | ||
test2['_' + String.fromCharCode(i)] = i; | ||
} | ||
var order2 = Object.getOwnPropertyNames(test2).map(function (n) { | ||
return test2[n]; | ||
}); | ||
if (order2.join('') !== '0123456789') { | ||
return false; | ||
} | ||
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 | ||
var test3 = {}; | ||
'abcdefghijklmnopqrst'.split('').forEach(function (letter) { | ||
test3[letter] = letter; | ||
}); | ||
if (Object.keys(Object.assign({}, test3)).join('') !== | ||
'abcdefghijklmnopqrst') { | ||
return false; | ||
} | ||
return true; | ||
} catch (err) { | ||
// We don't expect any of the above to throw, but better to be safe. | ||
return false; | ||
} | ||
} | ||
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { | ||
var from; | ||
var to = toObject(target); | ||
var symbols; | ||
for (var s = 1; s < arguments.length; s++) { | ||
from = Object(arguments[s]); | ||
for (var key in from) { | ||
if (hasOwnProperty.call(from, key)) { | ||
to[key] = from[key]; | ||
} | ||
} | ||
if (getOwnPropertySymbols) { | ||
symbols = getOwnPropertySymbols(from); | ||
for (var i = 0; i < symbols.length; i++) { | ||
if (propIsEnumerable.call(from, symbols[i])) { | ||
to[symbols[i]] = from[symbols[i]]; | ||
} | ||
} | ||
} | ||
} | ||
return to; | ||
}; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
var ReactPropTypesSecret_1 = ReactPropTypesSecret; | ||
{ | ||
var invariant$1 = invariant_1; | ||
var warning$1 = warning_1; | ||
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1; | ||
var loggedTypeFailures = {}; | ||
} | ||
/** | ||
* Assert that the values match with the type specs. | ||
* Error messages are memorized and will only be shown once. | ||
* | ||
* @param {object} typeSpecs Map of name to a ReactPropType | ||
* @param {object} values Runtime values that need to be type-checked | ||
* @param {string} location e.g. "prop", "context", "child context" | ||
* @param {string} componentName Name of the component for error messages. | ||
* @param {?Function} getStack Returns the component stack. | ||
* @private | ||
*/ | ||
function checkPropTypes(typeSpecs, values, location, componentName, getStack) { | ||
{ | ||
for (var typeSpecName in typeSpecs) { | ||
if (typeSpecs.hasOwnProperty(typeSpecName)) { | ||
var error; | ||
// Prop type validation may throw. In case they do, we don't want to | ||
// fail the render phase where it didn't fail before. So we log it. | ||
// After these have been cleaned up, we'll let them throw. | ||
try { | ||
// This is intentionally an invariant that gets caught. It's the same | ||
// behavior as without this statement except with a better message. | ||
invariant$1(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); | ||
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1); | ||
} catch (ex) { | ||
error = ex; | ||
} | ||
warning$1(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); | ||
if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
// Only monitor this failure once because there tends to be a lot of the | ||
// same error. | ||
loggedTypeFailures[error.message] = true; | ||
var stack = getStack ? getStack() : ''; | ||
warning$1(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
var checkPropTypes_1 = checkPropTypes; | ||
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) { | ||
/* global Symbol */ | ||
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | ||
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | ||
/** | ||
* Returns the iterator method function contained on the iterable object. | ||
* | ||
* Be sure to invoke the function with the iterable as context: | ||
* | ||
* var iteratorFn = getIteratorFn(myIterable); | ||
* if (iteratorFn) { | ||
* var iterator = iteratorFn.call(myIterable); | ||
* ... | ||
* } | ||
* | ||
* @param {?object} maybeIterable | ||
* @return {?function} | ||
*/ | ||
function getIteratorFn(maybeIterable) { | ||
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | ||
if (typeof iteratorFn === 'function') { | ||
return iteratorFn; | ||
} | ||
} | ||
/** | ||
* Collection of methods that allow declaration and validation of props that are | ||
* supplied to React components. Example usage: | ||
* | ||
* var Props = require('ReactPropTypes'); | ||
* var MyArticle = React.createClass({ | ||
* propTypes: { | ||
* // An optional string prop named "description". | ||
* description: Props.string, | ||
* | ||
* // A required enum prop named "category". | ||
* category: Props.oneOf(['News','Photos']).isRequired, | ||
* | ||
* // A prop named "dialog" that requires an instance of Dialog. | ||
* dialog: Props.instanceOf(Dialog).isRequired | ||
* }, | ||
* render: function() { ... } | ||
* }); | ||
* | ||
* A more formal specification of how these methods are used: | ||
* | ||
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) | ||
* decl := ReactPropTypes.{type}(.isRequired)? | ||
* | ||
* Each and every declaration produces a function with the same signature. This | ||
* allows the creation of custom validation functions. For example: | ||
* | ||
* var MyLink = React.createClass({ | ||
* propTypes: { | ||
* // An optional string or URI prop named "href". | ||
* href: function(props, propName, componentName) { | ||
* var propValue = props[propName]; | ||
* if (propValue != null && typeof propValue !== 'string' && | ||
* !(propValue instanceof URI)) { | ||
* return new Error( | ||
* 'Expected a string or an URI for ' + propName + ' in ' + | ||
* componentName | ||
* ); | ||
* } | ||
* } | ||
* }, | ||
* render: function() {...} | ||
* }); | ||
* | ||
* @internal | ||
*/ | ||
var ANONYMOUS = '<<anonymous>>'; | ||
// Important! | ||
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`. | ||
var ReactPropTypes = { | ||
array: createPrimitiveTypeChecker('array'), | ||
bool: createPrimitiveTypeChecker('boolean'), | ||
func: createPrimitiveTypeChecker('function'), | ||
number: createPrimitiveTypeChecker('number'), | ||
object: createPrimitiveTypeChecker('object'), | ||
string: createPrimitiveTypeChecker('string'), | ||
symbol: createPrimitiveTypeChecker('symbol'), | ||
any: createAnyTypeChecker(), | ||
arrayOf: createArrayOfTypeChecker, | ||
element: createElementTypeChecker(), | ||
instanceOf: createInstanceTypeChecker, | ||
node: createNodeChecker(), | ||
objectOf: createObjectOfTypeChecker, | ||
oneOf: createEnumTypeChecker, | ||
oneOfType: createUnionTypeChecker, | ||
shape: createShapeTypeChecker, | ||
exact: createStrictShapeTypeChecker, | ||
}; | ||
/** | ||
* inlined Object.is polyfill to avoid requiring consumers ship their own | ||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | ||
*/ | ||
/*eslint-disable no-self-compare*/ | ||
function is(x, y) { | ||
// SameValue algorithm | ||
if (x === y) { | ||
// Steps 1-5, 7-10 | ||
// Steps 6.b-6.e: +0 != -0 | ||
return x !== 0 || 1 / x === 1 / y; | ||
} else { | ||
// Step 6.a: NaN == NaN | ||
return x !== x && y !== y; | ||
} | ||
} | ||
/*eslint-enable no-self-compare*/ | ||
/** | ||
* We use an Error-like object for backward compatibility as people may call | ||
* PropTypes directly and inspect their output. However, we don't use real | ||
* Errors anymore. We don't inspect their stack anyway, and creating them | ||
* is prohibitively expensive if they are created too often, such as what | ||
* happens in oneOfType() for any type before the one that matched. | ||
*/ | ||
function PropTypeError(message) { | ||
this.message = message; | ||
this.stack = ''; | ||
} | ||
// Make `instanceof Error` still work for returned errors. | ||
PropTypeError.prototype = Error.prototype; | ||
function createChainableTypeChecker(validate) { | ||
{ | ||
var manualPropTypeCallCache = {}; | ||
var manualPropTypeWarningCount = 0; | ||
} | ||
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { | ||
componentName = componentName || ANONYMOUS; | ||
propFullName = propFullName || propName; | ||
if (secret !== ReactPropTypesSecret_1) { | ||
if (throwOnDirectAccess) { | ||
// New behavior only for users of `prop-types` package | ||
invariant_1( | ||
false, | ||
'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' | ||
); | ||
} else if ("development" !== 'production' && typeof console !== 'undefined') { | ||
// Old behavior for people using React.PropTypes | ||
var cacheKey = componentName + ':' + propName; | ||
if ( | ||
!manualPropTypeCallCache[cacheKey] && | ||
// Avoid spamming the console because they are often not actionable except for lib authors | ||
manualPropTypeWarningCount < 3 | ||
) { | ||
warning_1( | ||
false, | ||
'You are manually calling a React.PropTypes validation ' + | ||
'function for the `%s` prop on `%s`. This is deprecated ' + | ||
'and will throw in the standalone `prop-types` package. ' + | ||
'You may be seeing this warning due to a third-party PropTypes ' + | ||
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', | ||
propFullName, | ||
componentName | ||
); | ||
manualPropTypeCallCache[cacheKey] = true; | ||
manualPropTypeWarningCount++; | ||
} | ||
} | ||
} | ||
if (props[propName] == null) { | ||
if (isRequired) { | ||
if (props[propName] === null) { | ||
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); | ||
} | ||
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); | ||
} | ||
return null; | ||
} else { | ||
return validate(props, propName, componentName, location, propFullName); | ||
} | ||
} | ||
var chainedCheckType = checkType.bind(null, false); | ||
chainedCheckType.isRequired = checkType.bind(null, true); | ||
return chainedCheckType; | ||
} | ||
function createPrimitiveTypeChecker(expectedType) { | ||
function validate(props, propName, componentName, location, propFullName, secret) { | ||
var propValue = props[propName]; | ||
var propType = getPropType(propValue); | ||
if (propType !== expectedType) { | ||
// `propValue` being instance of, say, date/regexp, pass the 'object' | ||
// check, but we can offer a more precise error message here rather than | ||
// 'of type `object`'. | ||
var preciseType = getPreciseType(propValue); | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createAnyTypeChecker() { | ||
return createChainableTypeChecker(emptyFunction_1.thatReturnsNull); | ||
} | ||
function createArrayOfTypeChecker(typeChecker) { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
if (typeof typeChecker !== 'function') { | ||
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); | ||
} | ||
var propValue = props[propName]; | ||
if (!Array.isArray(propValue)) { | ||
var propType = getPropType(propValue); | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); | ||
} | ||
for (var i = 0; i < propValue.length; i++) { | ||
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1); | ||
if (error instanceof Error) { | ||
return error; | ||
} | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createElementTypeChecker() { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
var propValue = props[propName]; | ||
if (!isValidElement(propValue)) { | ||
var propType = getPropType(propValue); | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createInstanceTypeChecker(expectedClass) { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
if (!(props[propName] instanceof expectedClass)) { | ||
var expectedClassName = expectedClass.name || ANONYMOUS; | ||
var actualClassName = getClassName(props[propName]); | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createEnumTypeChecker(expectedValues) { | ||
if (!Array.isArray(expectedValues)) { | ||
warning_1(false, 'Invalid argument supplied to oneOf, expected an instance of array.'); | ||
return emptyFunction_1.thatReturnsNull; | ||
} | ||
function validate(props, propName, componentName, location, propFullName) { | ||
var propValue = props[propName]; | ||
for (var i = 0; i < expectedValues.length; i++) { | ||
if (is(propValue, expectedValues[i])) { | ||
return null; | ||
} | ||
} | ||
var valuesString = JSON.stringify(expectedValues); | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createObjectOfTypeChecker(typeChecker) { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
if (typeof typeChecker !== 'function') { | ||
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); | ||
} | ||
var propValue = props[propName]; | ||
var propType = getPropType(propValue); | ||
if (propType !== 'object') { | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); | ||
} | ||
for (var key in propValue) { | ||
if (propValue.hasOwnProperty(key)) { | ||
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); | ||
if (error instanceof Error) { | ||
return error; | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createUnionTypeChecker(arrayOfTypeCheckers) { | ||
if (!Array.isArray(arrayOfTypeCheckers)) { | ||
warning_1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.'); | ||
return emptyFunction_1.thatReturnsNull; | ||
} | ||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
var checker = arrayOfTypeCheckers[i]; | ||
if (typeof checker !== 'function') { | ||
warning_1( | ||
false, | ||
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + | ||
'received %s at index %s.', | ||
getPostfixForTypeWarning(checker), | ||
i | ||
); | ||
return emptyFunction_1.thatReturnsNull; | ||
} | ||
} | ||
function validate(props, propName, componentName, location, propFullName) { | ||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
var checker = arrayOfTypeCheckers[i]; | ||
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) { | ||
return null; | ||
} | ||
} | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createNodeChecker() { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
if (!isNode(props[propName])) { | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createShapeTypeChecker(shapeTypes) { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
var propValue = props[propName]; | ||
var propType = getPropType(propValue); | ||
if (propType !== 'object') { | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | ||
} | ||
for (var key in shapeTypes) { | ||
var checker = shapeTypes[key]; | ||
if (!checker) { | ||
continue; | ||
} | ||
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); | ||
if (error) { | ||
return error; | ||
} | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createStrictShapeTypeChecker(shapeTypes) { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
var propValue = props[propName]; | ||
var propType = getPropType(propValue); | ||
if (propType !== 'object') { | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | ||
} | ||
// We need to check all keys in case some are required but missing from | ||
// props. | ||
var allKeys = objectAssign({}, props[propName], shapeTypes); | ||
for (var key in allKeys) { | ||
var checker = shapeTypes[key]; | ||
if (!checker) { | ||
return new PropTypeError( | ||
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + | ||
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') + | ||
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') | ||
); | ||
} | ||
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); | ||
if (error) { | ||
return error; | ||
} | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function isNode(propValue) { | ||
switch (typeof propValue) { | ||
case 'number': | ||
case 'string': | ||
case 'undefined': | ||
return true; | ||
case 'boolean': | ||
return !propValue; | ||
case 'object': | ||
if (Array.isArray(propValue)) { | ||
return propValue.every(isNode); | ||
} | ||
if (propValue === null || isValidElement(propValue)) { | ||
return true; | ||
} | ||
var iteratorFn = getIteratorFn(propValue); | ||
if (iteratorFn) { | ||
var iterator = iteratorFn.call(propValue); | ||
var step; | ||
if (iteratorFn !== propValue.entries) { | ||
while (!(step = iterator.next()).done) { | ||
if (!isNode(step.value)) { | ||
return false; | ||
} | ||
} | ||
} else { | ||
// Iterator will provide entry [k,v] tuples rather than values. | ||
while (!(step = iterator.next()).done) { | ||
var entry = step.value; | ||
if (entry) { | ||
if (!isNode(entry[1])) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
} else { | ||
return false; | ||
} | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
function isSymbol(propType, propValue) { | ||
// Native Symbol. | ||
if (propType === 'symbol') { | ||
return true; | ||
} | ||
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' | ||
if (propValue['@@toStringTag'] === 'Symbol') { | ||
return true; | ||
} | ||
// Fallback for non-spec compliant Symbols which are polyfilled. | ||
if (typeof Symbol === 'function' && propValue instanceof Symbol) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
// Equivalent of `typeof` but with special handling for array and regexp. | ||
function getPropType(propValue) { | ||
var propType = typeof propValue; | ||
if (Array.isArray(propValue)) { | ||
return 'array'; | ||
} | ||
if (propValue instanceof RegExp) { | ||
// Old webkits (at least until Android 4.0) return 'function' rather than | ||
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/ | ||
// passes PropTypes.object. | ||
return 'object'; | ||
} | ||
if (isSymbol(propType, propValue)) { | ||
return 'symbol'; | ||
} | ||
return propType; | ||
} | ||
// This handles more types than `getPropType`. Only used for error messages. | ||
// See `createPrimitiveTypeChecker`. | ||
function getPreciseType(propValue) { | ||
if (typeof propValue === 'undefined' || propValue === null) { | ||
return '' + propValue; | ||
} | ||
var propType = getPropType(propValue); | ||
if (propType === 'object') { | ||
if (propValue instanceof Date) { | ||
return 'date'; | ||
} else if (propValue instanceof RegExp) { | ||
return 'regexp'; | ||
} | ||
} | ||
return propType; | ||
} | ||
// Returns a string that is postfixed to a warning about an invalid type. | ||
// For example, "undefined" or "of type array" | ||
function getPostfixForTypeWarning(value) { | ||
var type = getPreciseType(value); | ||
switch (type) { | ||
case 'array': | ||
case 'object': | ||
return 'an ' + type; | ||
case 'boolean': | ||
case 'date': | ||
case 'regexp': | ||
return 'a ' + type; | ||
default: | ||
return type; | ||
} | ||
} | ||
// Returns class name of the object, if any. | ||
function getClassName(propValue) { | ||
if (!propValue.constructor || !propValue.constructor.name) { | ||
return ANONYMOUS; | ||
} | ||
return propValue.constructor.name; | ||
} | ||
ReactPropTypes.checkPropTypes = checkPropTypes_1; | ||
ReactPropTypes.PropTypes = ReactPropTypes; | ||
return ReactPropTypes; | ||
}; | ||
var propTypes = createCommonjsModule(function (module) { | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
{ | ||
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && | ||
Symbol.for && | ||
Symbol.for('react.element')) || | ||
0xeac7; | ||
var isValidElement = function(object) { | ||
return typeof object === 'object' && | ||
object !== null && | ||
object.$$typeof === REACT_ELEMENT_TYPE; | ||
}; | ||
// By explicitly using `prop-types` you are opting into new development behavior. | ||
// http://fb.me/prop-types-in-prod | ||
var throwOnDirectAccess = true; | ||
module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess); | ||
} | ||
}); | ||
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; | ||
@@ -318,2 +1177,3 @@ | ||
props = _objectWithoutProperties(_props, ["minRows", "maxRows", "onHeightChange", "useCacheForDOMMeasurements", "inputRef"]); | ||
props.style = _extends({}, props.style, { | ||
@@ -388,9 +1248,9 @@ height: this.state.height | ||
TextareaAutosize.propTypes = { | ||
value: PropTypes.string, | ||
onChange: PropTypes.func, | ||
onHeightChange: PropTypes.func, | ||
useCacheForDOMMeasurements: PropTypes.bool, | ||
minRows: PropTypes.number, | ||
maxRows: PropTypes.number, | ||
inputRef: PropTypes.func | ||
value: propTypes.string, | ||
onChange: propTypes.func, | ||
onHeightChange: propTypes.func, | ||
useCacheForDOMMeasurements: propTypes.bool, | ||
minRows: propTypes.number, | ||
maxRows: propTypes.number, | ||
inputRef: propTypes.func | ||
}; | ||
@@ -403,4 +1263,6 @@ TextareaAutosize.defaultProps = { | ||
return TextareaAutosize; | ||
exports['default'] = TextareaAutosize; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); |
@@ -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(){return(n=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}).apply(this,arguments)}e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t;var o="undefined"!=typeof window&&"undefined"!=typeof document,i=!!o&&!!document.documentElement.currentStyle,r=o&&document.createElement("textarea"),a={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},s=["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"],h={},u=function(e){return void 0===e&&(e=0),function(){return++e}}(),d=function(){},l=o&&window.requestAnimationFrame?[window.requestAnimationFrame,window.cancelAnimationFrame]:[setTimeout,clearTimeout],p=l[0],c=l[1],f=function(t){function o(e){var n;return n=t.call(this,e)||this,n._resizeLock=!1,n._onRootDOMNode=function(e){n._rootDOMNode=e,n.props.inputRef&&n.props.inputRef(e)},n._onChange=function(e){n._controlled||n._resizeComponent(),n.props.onChange(e)},n._resizeComponent=function(e){if(void 0===e&&(e=d),void 0!==n._rootDOMNode){var t=function(e,t,n,o,u){void 0===n&&(n=!1),void 0===o&&(o=null),void 0===u&&(u=null),null===r.parentNode&&document.body.appendChild(r);var d=function(e,t,n){if(void 0===n&&(n=!1),n&&h[t])return h[t];var o=window.getComputedStyle(e);if(null===o)return null;var r=s.reduce(function(e,t){return e[t]=o.getPropertyValue(t),e},{}),a=r["box-sizing"];i&&"border-box"===a&&(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 u={sizingStyle:r,paddingSize:parseFloat(r["padding-bottom"])+parseFloat(r["padding-top"]),borderSize:parseFloat(r["border-bottom-width"])+parseFloat(r["border-top-width"]),boxSizing:a};return n&&(h[t]=u),u}(e,t,n);if(null===d)return null;var l=d.paddingSize,p=d.borderSize,c=d.boxSizing,f=d.sizingStyle;Object.keys(f).forEach(function(e){r.style[e]=f[e]}),Object.keys(a).forEach(function(e){r.style.setProperty(e,a[e],"important")}),r.value=e.value||e.placeholder||"x";var g=-1/0,m=1/0,b=r.scrollHeight;"border-box"===c?b+=p:"content-box"===c&&(b-=l),r.value="x";var y=r.scrollHeight-l;return null===o&&null===u||(null!==o&&(g=y*o,"border-box"===c&&(g=g+l+p),b=Math.max(g,b)),null!==u&&(m=y*u,"border-box"===c&&(m=m+l+p),b=Math.min(m,b))),{height:b,minHeight:g,maxHeight:m,rowCount:Math.floor(b/y)}}(n._rootDOMNode,n._uid,n.props.useCacheForDOMMeasurements,n.props.minRows,n.props.maxRows);if(null!==t){var o=t.height,u=t.minHeight,l=t.maxHeight;n.rowCount=t.rowCount,n.state.height===o&&n.state.minHeight===u&&n.state.maxHeight===l?e():n.setState({height:o,minHeight:u,maxHeight:l},e)}else e()}else e()},n.state={height:e.style&&e.style.height||0,minHeight:-1/0,maxHeight:1/0},n._uid=u(),n._controlled="string"==typeof e.value,n}!function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(o,t);var l=o.prototype;return l.render=function(){var t=this.props,o=function(e,t){if(null==e)return{};var n,o,i={},r=Object.keys(e);for(o=0;r.length>o;o++)0>t.indexOf(n=r[o])&&(i[n]=e[n]);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;a.length>o;o++)0>t.indexOf(n=a[o])&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,["minRows","maxRows","onHeightChange","useCacheForDOMMeasurements","inputRef"]);o.style=n({},o.style,{height:this.state.height});var i=Math.max(o.style.maxHeight||1/0,this.state.maxHeight);return this.state.height>i&&(o.style.overflow="hidden"),e.createElement("textarea",n({},o,{onChange:this._onChange,ref:this._onRootDOMNode}))},l.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)},l.componentWillReceiveProps=function(){var e=this;this._clearNextFrame(),this._onNextFrameActionId=p(function(){return e._resizeComponent()})},l.componentDidUpdate=function(e,t){this.state.height!==t.height&&this.props.onHeightChange(this.state.height,this)},l.componentWillUnmount=function(){this._clearNextFrame(),window.removeEventListener("resize",this._resizeListener),function(e){delete h[e]}(this._uid)},l._clearNextFrame=function(){c(this._onNextFrameActionId)},o}(e.Component);return f.propTypes={value:t.string,onChange:t.func,onHeightChange:t.func,useCacheForDOMMeasurements:t.bool,minRows:t.number,maxRows:t.number,inputRef:t.func},f.defaultProps={onChange:d,onHeightChange:d,useCacheForDOMMeasurements:!1},f}); | ||
!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,t){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;arguments.length>t;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)}t=t&&t.hasOwnProperty("default")?t.default:t;var r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e};"object"==typeof Reflect&&Reflect;function o(e){return function(){return e}}var i=function(){};i.thatReturns=o,i.thatReturnsFalse=o(!1),i.thatReturnsTrue=o(!0),i.thatReturnsNull=o(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e};var a=i;var s=function(e,t,n,r,o,i,a,s){if(!e){var u;if(void 0===t)u=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,r,o,i,a,s],h=0;(u=Error(t.replace(/%s/g,function(){return p[h++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}},u=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;!function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;10>n;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}();var l,c="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",d=(function(e){e.exports=function(){function e(e,t,n,r,o,i){i!==c&&s(!1,"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")}function t(){return e}e.isRequired=e;var n={array: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=a,n.PropTypes=n,n}()}(l={exports:{}},l.exports),l.exports),f="undefined"!=typeof window&&"undefined"!=typeof document,m=!!f&&!!document.documentElement.currentStyle,g=f&&document.createElement("textarea"),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={};function _(e,t,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=null),void 0===o&&(o=null),null===g.parentNode&&document.body.appendChild(g);var i=function(e,t,n){void 0===n&&(n=!1);if(n&&v[t])return v[t];var r=window.getComputedStyle(e);if(null===r)return null;var o=y.reduce(function(e,t){return e[t]=r.getPropertyValue(t),e},{}),i=o["box-sizing"];m&&"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&&(v[t]=a);return a}(e,t,n);if(null===i)return null;var a=i.paddingSize,s=i.borderSize,u=i.boxSizing,p=i.sizingStyle;Object.keys(p).forEach(function(e){g.style[e]=p[e]}),Object.keys(b).forEach(function(e){g.style.setProperty(e,b[e],"important")}),g.value=e.value||e.placeholder||"x";var h=-1/0,l=1/0,c=g.scrollHeight;"border-box"===u?c+=s:"content-box"===u&&(c-=a),g.value="x";var d=g.scrollHeight-a;return null===r&&null===o||(null!==r&&(h=d*r,"border-box"===u&&(h=h+a+s),c=Math.max(h,c)),null!==o&&(l=d*o,"border-box"===u&&(l=l+a+s),c=Math.min(l,c))),{height:c,minHeight:h,maxHeight:l,rowCount:Math.floor(c/d)}}var w,x=(void 0===w&&(w=0),function(){return++w}),O=function(){},C=f&&window.requestAnimationFrame?[window.requestAnimationFrame,window.cancelAnimationFrame]:[setTimeout,clearTimeout],z=C[0],R=C[1],j=function(e){var r,o;function i(t){var n;return(n=e.call(this,t)||this)._resizeLock=!1,n._onRootDOMNode=function(e){n._rootDOMNode=e,n.props.inputRef&&n.props.inputRef(e)},n._onChange=function(e){n._controlled||n._resizeComponent(),n.props.onChange(e)},n._resizeComponent=function(e){if(void 0===e&&(e=O),void 0!==n._rootDOMNode){var t=_(n._rootDOMNode,n._uid,n.props.useCacheForDOMMeasurements,n.props.minRows,n.props.maxRows);if(null!==t){var r=t.height,o=t.minHeight,i=t.maxHeight;n.rowCount=t.rowCount,n.state.height===r&&n.state.minHeight===o&&n.state.maxHeight===i?e():n.setState({height:r,minHeight:o,maxHeight:i},e)}else e()}else e()},n.state={height:t.style&&t.style.height||0,minHeight:-1/0,maxHeight:1/0},n._uid=x(),n._controlled="string"==typeof t.value,n}(r=i).prototype=Object.create((o=e).prototype),r.prototype.constructor=r,r.__proto__=o;var a=i.prototype;return a.render=function(){var e=this.props,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;i.length>r;r++)0>t.indexOf(n=i[r])&&(o[n]=e[n]);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;a.length>r;r++)0>t.indexOf(n=a[r])&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,["minRows","maxRows","onHeightChange","useCacheForDOMMeasurements","inputRef"]);return r.style=n({},r.style,{height:this.state.height}),this.state.height>Math.max(r.style.maxHeight||1/0,this.state.maxHeight)&&(r.style.overflow="hidden"),t.createElement("textarea",n({},r,{onChange:this._onChange,ref:this._onRootDOMNode}))},a.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)},a.componentWillReceiveProps=function(){var e=this;this._clearNextFrame(),this._onNextFrameActionId=z(function(){return e._resizeComponent()})},a.componentDidUpdate=function(e,t){this.state.height!==t.height&&this.props.onHeightChange(this.state.height,this)},a.componentWillUnmount=function(){this._clearNextFrame(),window.removeEventListener("resize",this._resizeListener),delete v[this._uid]},a._clearNextFrame=function(){R(this._onNextFrameActionId)},i}(t.Component);j.propTypes={value:d.string,onChange:d.func,onHeightChange:d.func,useCacheForDOMMeasurements:d.bool,minRows:d.number,maxRows:d.number,inputRef:d.func},j.defaultProps={onChange:O,onHeightChange:O,useCacheForDOMMeasurements:!1},e.default=j,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "react-textarea-autosize", | ||
"description": "textarea component for React which grows with content", | ||
"version": "5.2.1", | ||
"version": "6.0.0-0", | ||
"keywords": "autosize, grow, react, react-component, textarea", | ||
"repository": "andreypopp/react-textarea-autosize", | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"module": "es/index.js", | ||
"jsnext:main": "es/index.js", | ||
"main": "dist/react-textarea-autosize.cjs.js", | ||
"module": "dist/react-textarea-autosize.es.js", | ||
"jsnext:main": "dist/react-textarea-autosize.es.js", | ||
"unpkg": "dist/react-textarea-autosize.min.js", | ||
@@ -15,10 +15,6 @@ "author": "Andrey Popp <8mayday@gmail.com> (httsps://andreypopp.com/)", | ||
"prebuild": "npm run clean", | ||
"build": "run-p build:**", | ||
"build:es": "cross-env BABEL_ENV=es rollup -c -i src/index.js -o es/index.js", | ||
"build:cjs": "cross-env BABEL_ENV=cjs rollup -c -i src/index.js -o lib/index.js", | ||
"build:umd:prod": "cross-env BABEL_ENV=es NODE_ENV=production rollup -c rollup.umd.config.js -i src/index.js -o dist/react-textarea-autosize.min.js", | ||
"build:umd:dev": "cross-env BABEL_ENV=es NODE_ENV=development rollup -c rollup.umd.config.js -i src/index.js -o dist/react-textarea-autosize.js", | ||
"build": "rollup -c", | ||
"docs:build": "cross-env BABEL_ENV=es NODE_ENV=development rollup -c example/rollup.config.js -i example/index.js -o example/bundle.js", | ||
"docs:publish": "npm run docs:build && cd example && rimraf .git && git init && git commit --allow-empty -m 'update docs' && git checkout -b gh-pages && touch .nojekyll && git add . && git commit -am 'update docs' && git push git@github.com:andreypopp/react-textarea-autosize gh-pages --force", | ||
"clean": "rimraf es && rimraf lib && rimraf dist", | ||
"clean": "rimraf dist", | ||
"lint": "eslint src", | ||
@@ -36,21 +32,20 @@ "prepare": "npm run build", | ||
"devDependencies": { | ||
"@babel/cli": "7.0.0-beta.31", | ||
"@babel/core": "7.0.0-beta.31", | ||
"@babel/plugin-proposal-class-properties": "7.0.0-beta.31", | ||
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.31", | ||
"@babel/preset-env": "7.0.0-beta.31", | ||
"@babel/preset-react": "7.0.0-beta.31", | ||
"@babel/core": "7.0.0-beta.40", | ||
"@babel/plugin-proposal-class-properties": "7.0.0-beta.40", | ||
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.40", | ||
"@babel/preset-env": "7.0.0-beta.40", | ||
"@babel/preset-react": "7.0.0-beta.40", | ||
"cross-env": "^5.0.1", | ||
"eslint": "^3.3.1", | ||
"eslint-config-prometheusresearch": "^0.2.0", | ||
"eslint-plugin-react": "^6.1.2", | ||
"eslint": "^4.12.0", | ||
"eslint-config-prometheusresearch": "^0.4.0", | ||
"eslint-plugin-react": "^7.5.1", | ||
"husky": "^0.14.3", | ||
"lint-staged": "^4.0.2", | ||
"npm-run-all": "^4.0.2", | ||
"prettier": "^1.8.1", | ||
"lint-staged": "^5.0.0", | ||
"prettier": "^1.8.2", | ||
"react": "^15.6.1", | ||
"react-dom": "^15.6.1", | ||
"rimraf": "^2.6.1", | ||
"rollup": "^0.51.0", | ||
"rollup-plugin-babel": "4.0.0-beta.0", | ||
"rollup": "^0.52.0", | ||
"rollup-plugin-babel": "4.0.0-beta.2", | ||
"rollup-plugin-commonjs": "^8.3.0", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
@@ -61,4 +56,2 @@ "rollup-plugin-replace": "^2.0.0", | ||
"files": [ | ||
"es", | ||
"lib", | ||
"dist" | ||
@@ -65,0 +58,0 @@ ], |
@@ -36,2 +36,19 @@ [![npm version](https://img.shields.io/npm/v/react-textarea-autosize.svg)](https://www.npmjs.com/package/react-textarea-autosize) | ||
### How to focus | ||
Get a ref to inner textarea: | ||
```js | ||
<Textarea inputRef={(tag) => this.textarea = tag} /> | ||
``` | ||
And then call a focus on that ref: | ||
```js | ||
this.textarea.focus() | ||
``` | ||
To autofocus: | ||
```js | ||
<Textarea autoFocus /> | ||
``` | ||
(all HTML attributes are passed to inner textarea) | ||
### How to test it with jest and react-test-renderer | ||
@@ -38,0 +55,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
77389
21
1757
83
3
1