react-textarea-autosize
Advanced tools
Comparing version 8.0.0 to 8.0.1
# react-textarea-autosize | ||
## 8.0.1 | ||
### Patch Changes | ||
- [`2307033`](https://github.com/Andarist/react-textarea-autosize/commit/230703341e366ad861e3a24e20f1d9fd6f9ced47) [#266](https://github.com/Andarist/react-textarea-autosize/pull/266) Thanks [@vlazh](https://github.com/vlazh)! - Fixed a regression with calculating too high height for textareas with `box-sizing: border-box;`. | ||
* [`1d1bba2`](https://github.com/Andarist/react-textarea-autosize/commit/1d1bba23140a7948b34a1cb9678802c71744b0f4) [#265](https://github.com/Andarist/react-textarea-autosize/pull/265) Thanks [@SimenB](https://github.com/SimenB)! - Exported `TextareaAutosizeProps` type for convenience. | ||
- [`da960f4`](https://github.com/Andarist/react-textarea-autosize/commit/da960f46084f3b584506f3513b77958d5265fcad) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with internal cache not being populated correctly when using `cacheMeasurements` prop. | ||
## 8.0.0 | ||
### Major Changes | ||
@@ -5,0 +16,0 @@ |
@@ -5,3 +5,3 @@ import * as React from 'react'; | ||
}; | ||
declare type Props = JSX.IntrinsicElements['textarea'] & { | ||
export declare type TextareaAutosizeProps = JSX.IntrinsicElements['textarea'] & { | ||
maxRows?: number; | ||
@@ -13,3 +13,3 @@ minRows?: number; | ||
}; | ||
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "style" | "color" | "translate" | "cacheMeasurements" | "maxRows" | "minRows" | "onChange" | "onHeightChange" | "key" | "autoComplete" | "autoFocus" | "cols" | "dirName" | "disabled" | "form" | "maxLength" | "minLength" | "name" | "placeholder" | "readOnly" | "required" | "rows" | "value" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "tabIndex" | "title" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLTextAreaElement>>; | ||
declare const _default: React.ForwardRefExoticComponent<Pick<TextareaAutosizeProps, "style" | "color" | "translate" | "cacheMeasurements" | "maxRows" | "minRows" | "onChange" | "onHeightChange" | "key" | "autoComplete" | "autoFocus" | "cols" | "dirName" | "disabled" | "form" | "maxLength" | "minLength" | "name" | "placeholder" | "readOnly" | "required" | "rows" | "value" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "tabIndex" | "title" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLTextAreaElement>>; | ||
export default _default; |
@@ -33,3 +33,3 @@ 'use strict'; | ||
var getContentHeight = function getContentHeight(node, sizingData) { | ||
var getHeight = function getHeight(node, sizingData) { | ||
var height = node.scrollHeight; | ||
@@ -76,6 +76,6 @@ | ||
hiddenTextarea.value = value; | ||
var height = getContentHeight(hiddenTextarea, sizingData); // measure height of a textarea with a single row | ||
var height = getHeight(hiddenTextarea, sizingData); // measure height of a textarea with a single row | ||
hiddenTextarea.value = 'x'; | ||
var rowHeight = getContentHeight(hiddenTextarea, sizingData); | ||
var rowHeight = hiddenTextarea.scrollHeight - paddingSize; | ||
var minHeight = rowHeight * minRows; | ||
@@ -188,2 +188,3 @@ | ||
measurementsCacheRef.current = nodeSizingData; | ||
var height = calculateNodeHeight(nodeSizingData, node.value || node.placeholder || 'x', minRows, maxRows); | ||
@@ -190,0 +191,0 @@ |
@@ -27,3 +27,3 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
var getContentHeight = function getContentHeight(node, sizingData) { | ||
var getHeight = function getHeight(node, sizingData) { | ||
var height = node.scrollHeight; | ||
@@ -70,6 +70,6 @@ | ||
hiddenTextarea.value = value; | ||
var height = getContentHeight(hiddenTextarea, sizingData); // measure height of a textarea with a single row | ||
var height = getHeight(hiddenTextarea, sizingData); // measure height of a textarea with a single row | ||
hiddenTextarea.value = 'x'; | ||
var rowHeight = getContentHeight(hiddenTextarea, sizingData); | ||
var rowHeight = hiddenTextarea.scrollHeight - paddingSize; | ||
var minHeight = rowHeight * minRows; | ||
@@ -182,2 +182,3 @@ | ||
measurementsCacheRef.current = nodeSizingData; | ||
var height = calculateNodeHeight(nodeSizingData, node.value || node.placeholder || 'x', minRows, maxRows); | ||
@@ -184,0 +185,0 @@ |
@@ -33,3 +33,3 @@ 'use strict'; | ||
var getContentHeight = function getContentHeight(node, sizingData) { | ||
var getHeight = function getHeight(node, sizingData) { | ||
var height = node.scrollHeight; | ||
@@ -76,6 +76,6 @@ | ||
hiddenTextarea.value = value; | ||
var height = getContentHeight(hiddenTextarea, sizingData); // measure height of a textarea with a single row | ||
var height = getHeight(hiddenTextarea, sizingData); // measure height of a textarea with a single row | ||
hiddenTextarea.value = 'x'; | ||
var rowHeight = getContentHeight(hiddenTextarea, sizingData); | ||
var rowHeight = hiddenTextarea.scrollHeight - paddingSize; | ||
var minHeight = rowHeight * minRows; | ||
@@ -188,2 +188,3 @@ | ||
measurementsCacheRef.current = nodeSizingData; | ||
var height = calculateNodeHeight(nodeSizingData, node.value || node.placeholder || 'x', minRows, maxRows); | ||
@@ -190,0 +191,0 @@ |
@@ -25,3 +25,3 @@ "use strict"; | ||
})); | ||
}, hiddenTextarea = null, getContentHeight = function(node, sizingData) { | ||
}, hiddenTextarea = null, getHeight = function(node, sizingData) { | ||
var height = node.scrollHeight; | ||
@@ -40,5 +40,5 @@ return "border-box" === sizingData.sizingStyle.boxSizing ? height + sizingData.borderSize : height - sizingData.paddingSize; | ||
})), forceHiddenStyles(hiddenTextarea), hiddenTextarea.value = value; | ||
var height = getContentHeight(hiddenTextarea, sizingData); | ||
var height = getHeight(hiddenTextarea, sizingData); | ||
hiddenTextarea.value = "x"; | ||
var rowHeight = getContentHeight(hiddenTextarea, sizingData), minHeight = rowHeight * minRows; | ||
var rowHeight = hiddenTextarea.scrollHeight - paddingSize, minHeight = rowHeight * minRows; | ||
"border-box" === boxSizing && (minHeight = minHeight + paddingSize + borderSize), | ||
@@ -79,2 +79,3 @@ height = Math.max(minHeight, height); | ||
if (nodeSizingData) { | ||
measurementsCacheRef.current = nodeSizingData; | ||
var height = calculateNodeHeight(nodeSizingData, node.value || node.placeholder || "x", minRows, maxRows); | ||
@@ -81,0 +82,0 @@ heightRef.current !== height && (heightRef.current = height, node.style.height = height + "px", |
@@ -27,3 +27,3 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
var getContentHeight = function getContentHeight(node, sizingData) { | ||
var getHeight = function getHeight(node, sizingData) { | ||
var height = node.scrollHeight; | ||
@@ -70,6 +70,6 @@ | ||
hiddenTextarea.value = value; | ||
var height = getContentHeight(hiddenTextarea, sizingData); // measure height of a textarea with a single row | ||
var height = getHeight(hiddenTextarea, sizingData); // measure height of a textarea with a single row | ||
hiddenTextarea.value = 'x'; | ||
var rowHeight = getContentHeight(hiddenTextarea, sizingData); | ||
var rowHeight = hiddenTextarea.scrollHeight - paddingSize; | ||
var minHeight = rowHeight * minRows; | ||
@@ -182,2 +182,3 @@ | ||
measurementsCacheRef.current = nodeSizingData; | ||
var height = calculateNodeHeight(nodeSizingData, node.value || node.placeholder || 'x', minRows, maxRows); | ||
@@ -184,0 +185,0 @@ |
{ | ||
"name": "react-textarea-autosize", | ||
"description": "textarea component for React which grows with content", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"keywords": [ | ||
@@ -12,3 +12,6 @@ "autosize", | ||
], | ||
"repository": "andreypopp/react-textarea-autosize", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Andarist/react-textarea-autosize.git" | ||
}, | ||
"license": "MIT", | ||
@@ -57,2 +60,3 @@ "main": "dist/react-textarea-autosize.cjs.js", | ||
"@babel/preset-typescript": "^7.8.3", | ||
"@changesets/changelog-github": "^0.2.6", | ||
"@changesets/cli": "^2.5.2", | ||
@@ -59,0 +63,0 @@ "@preconstruct/cli": "^1.1.7", |
@@ -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.68KB</span> (minified & gzipped). | ||
around <span class="weight">1.3KB</span> (minified & gzipped). | ||
@@ -34,3 +34,3 @@ This module supports IE9 and above. | ||
https://andreypopp.github.io/react-textarea-autosize/ | ||
https://andarist.github.io/react-textarea-autosize/ | ||
@@ -37,0 +37,0 @@ ## Props |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
49651
832
5
0
30