rc-textarea
Advanced tools
Comparing version 1.6.3 to 1.7.0
@@ -36,2 +36,3 @@ import type { BaseInputProps, CommonInputProps, InputProps } from 'rc-input/lib/interface'; | ||
blur: () => void; | ||
nativeElement: HTMLElement; | ||
}; |
import * as React from 'react'; | ||
import type { ResizableTextAreaRef } from './interface'; | ||
declare const ResizableTextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "onResize" | "value"> & { | ||
declare const ResizableTextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "value" | "onResize"> & { | ||
value?: string | number | bigint | readonly string[]; | ||
@@ -5,0 +5,0 @@ prefixCls?: string; |
import React from 'react'; | ||
import type { TextAreaRef } from './interface'; | ||
declare const TextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "onResize" | "value"> & { | ||
declare const TextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "value" | "onResize"> & { | ||
value?: string | number | bigint | readonly string[]; | ||
@@ -5,0 +5,0 @@ prefixCls?: string; |
@@ -7,3 +7,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
var _excluded = ["defaultValue", "value", "onFocus", "onBlur", "onChange", "allowClear", "maxLength", "onCompositionStart", "onCompositionEnd", "suffix", "prefixCls", "showCount", "count", "className", "style", "disabled", "hidden", "classNames", "styles", "onResize"]; | ||
var _excluded = ["defaultValue", "value", "onFocus", "onBlur", "onChange", "allowClear", "maxLength", "onCompositionStart", "onCompositionEnd", "suffix", "prefixCls", "showCount", "count", "className", "style", "disabled", "hidden", "classNames", "styles", "onResize", "readOnly"]; | ||
import clsx from 'classnames'; | ||
@@ -17,3 +17,3 @@ import { BaseInput } from 'rc-input'; | ||
var TextArea = /*#__PURE__*/React.forwardRef(function (_ref, ref) { | ||
var _countConfig$max, _clsx; | ||
var _countConfig$max; | ||
var defaultValue = _ref.defaultValue, | ||
@@ -40,2 +40,3 @@ customValue = _ref.value, | ||
onResize = _ref.onResize, | ||
readOnly = _ref.readOnly, | ||
rest = _objectWithoutProperties(_ref, _excluded); | ||
@@ -61,2 +62,3 @@ var _useMergedState = useMergedState(defaultValue, { | ||
// =============================== Ref ================================ | ||
var holderRef = useRef(null); | ||
var resizableTextAreaRef = useRef(null); | ||
@@ -71,2 +73,3 @@ var getTextArea = function getTextArea() { | ||
useImperativeHandle(ref, function () { | ||
var _holderRef$current; | ||
return { | ||
@@ -77,3 +80,4 @@ resizableTextArea: resizableTextAreaRef.current, | ||
getTextArea().blur(); | ||
} | ||
}, | ||
nativeElement: ((_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.nativeElement) || getTextArea() | ||
}; | ||
@@ -185,2 +189,3 @@ }); | ||
return /*#__PURE__*/React.createElement(BaseInput, { | ||
ref: holderRef, | ||
value: formatValue, | ||
@@ -192,3 +197,3 @@ allowClear: allowClear, | ||
classNames: _objectSpread(_objectSpread({}, classNames), {}, { | ||
affixWrapper: clsx(classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, (_clsx = {}, _defineProperty(_clsx, "".concat(prefixCls, "-show-count"), showCount), _defineProperty(_clsx, "".concat(prefixCls, "-textarea-allow-clear"), allowClear), _clsx)) | ||
affixWrapper: clsx(classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-show-count"), showCount), "".concat(prefixCls, "-textarea-allow-clear"), allowClear)) | ||
}), | ||
@@ -206,3 +211,4 @@ disabled: disabled, | ||
}, | ||
hidden: hidden | ||
hidden: hidden, | ||
readOnly: readOnly | ||
}, /*#__PURE__*/React.createElement(ResizableTextArea, _extends({}, rest, { | ||
@@ -223,5 +229,6 @@ maxLength: maxLength, | ||
onResize: handleResize, | ||
ref: resizableTextAreaRef | ||
ref: resizableTextAreaRef, | ||
readOnly: readOnly | ||
}))); | ||
}); | ||
export default TextArea; |
@@ -36,2 +36,3 @@ import type { BaseInputProps, CommonInputProps, InputProps } from 'rc-input/lib/interface'; | ||
blur: () => void; | ||
nativeElement: HTMLElement; | ||
}; |
import * as React from 'react'; | ||
import type { ResizableTextAreaRef } from './interface'; | ||
declare const ResizableTextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "onResize" | "value"> & { | ||
declare const ResizableTextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "value" | "onResize"> & { | ||
value?: string | number | bigint | readonly string[]; | ||
@@ -5,0 +5,0 @@ prefixCls?: string; |
import React from 'react'; | ||
import type { TextAreaRef } from './interface'; | ||
declare const TextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "onResize" | "value"> & { | ||
declare const TextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "value" | "onResize"> & { | ||
value?: string | number | bigint | readonly string[]; | ||
@@ -5,0 +5,0 @@ prefixCls?: string; |
@@ -22,7 +22,7 @@ "use strict"; | ||
var _ResizableTextArea = _interopRequireDefault(require("./ResizableTextArea")); | ||
var _excluded = ["defaultValue", "value", "onFocus", "onBlur", "onChange", "allowClear", "maxLength", "onCompositionStart", "onCompositionEnd", "suffix", "prefixCls", "showCount", "count", "className", "style", "disabled", "hidden", "classNames", "styles", "onResize"]; | ||
var _excluded = ["defaultValue", "value", "onFocus", "onBlur", "onChange", "allowClear", "maxLength", "onCompositionStart", "onCompositionEnd", "suffix", "prefixCls", "showCount", "count", "className", "style", "disabled", "hidden", "classNames", "styles", "onResize", "readOnly"]; | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var TextArea = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) { | ||
var _countConfig$max, _clsx; | ||
var _countConfig$max; | ||
var defaultValue = _ref.defaultValue, | ||
@@ -49,2 +49,3 @@ customValue = _ref.value, | ||
onResize = _ref.onResize, | ||
readOnly = _ref.readOnly, | ||
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded); | ||
@@ -70,2 +71,3 @@ var _useMergedState = (0, _useMergedState3.default)(defaultValue, { | ||
// =============================== Ref ================================ | ||
var holderRef = (0, _react.useRef)(null); | ||
var resizableTextAreaRef = (0, _react.useRef)(null); | ||
@@ -80,2 +82,3 @@ var getTextArea = function getTextArea() { | ||
(0, _react.useImperativeHandle)(ref, function () { | ||
var _holderRef$current; | ||
return { | ||
@@ -86,3 +89,4 @@ resizableTextArea: resizableTextAreaRef.current, | ||
getTextArea().blur(); | ||
} | ||
}, | ||
nativeElement: ((_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.nativeElement) || getTextArea() | ||
}; | ||
@@ -194,2 +198,3 @@ }); | ||
return /*#__PURE__*/_react.default.createElement(_rcInput.BaseInput, { | ||
ref: holderRef, | ||
value: formatValue, | ||
@@ -201,3 +206,3 @@ allowClear: allowClear, | ||
classNames: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, classNames), {}, { | ||
affixWrapper: (0, _classnames.default)(classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, (_clsx = {}, (0, _defineProperty2.default)(_clsx, "".concat(prefixCls, "-show-count"), showCount), (0, _defineProperty2.default)(_clsx, "".concat(prefixCls, "-textarea-allow-clear"), allowClear), _clsx)) | ||
affixWrapper: (0, _classnames.default)(classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(prefixCls, "-show-count"), showCount), "".concat(prefixCls, "-textarea-allow-clear"), allowClear)) | ||
}), | ||
@@ -215,3 +220,4 @@ disabled: disabled, | ||
}, | ||
hidden: hidden | ||
hidden: hidden, | ||
readOnly: readOnly | ||
}, /*#__PURE__*/_react.default.createElement(_ResizableTextArea.default, (0, _extends2.default)({}, rest, { | ||
@@ -232,5 +238,6 @@ maxLength: maxLength, | ||
onResize: handleResize, | ||
ref: resizableTextAreaRef | ||
ref: resizableTextAreaRef, | ||
readOnly: readOnly | ||
}))); | ||
}); | ||
var _default = exports.default = TextArea; |
{ | ||
"name": "rc-textarea", | ||
"version": "1.6.3", | ||
"version": "1.7.0", | ||
"description": "Pretty Textarea react component used in used in ant.design", | ||
@@ -48,3 +48,3 @@ "keywords": [ | ||
"classnames": "^2.2.1", | ||
"rc-input": "~1.4.0", | ||
"rc-input": "~1.5.0", | ||
"rc-resize-observer": "^1.0.0", | ||
@@ -56,3 +56,3 @@ "rc-util": "^5.27.0" | ||
"@testing-library/jest-dom": "^5.16.5", | ||
"@testing-library/react": "^13.3.0", | ||
"@testing-library/react": "^15.0.0", | ||
"@types/classnames": "^2.2.9", | ||
@@ -59,0 +59,0 @@ "@types/react": "^18.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62526
1261
+ Addedrc-input@1.5.1(transitive)
- Removedrc-input@1.4.5(transitive)
Updatedrc-input@~1.5.0