Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-input

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-input - npm Package Compare versions

Comparing version 1.6.0 to 1.6.1

6

es/BaseInput.js

@@ -61,5 +61,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";

if (hasAffix) {
var _clsx2;
// ================== Clear Icon ================== //
var clearIcon = null;
if (allowClear) {
var _clsx;
var needClear = !disabled && !readOnly && value;

@@ -79,3 +81,3 @@ var clearIconCls = "".concat(prefixCls, "-clear-icon");

},
className: clsx(clearIconCls, _defineProperty(_defineProperty({}, "".concat(clearIconCls, "-hidden"), !needClear), "".concat(clearIconCls, "-has-suffix"), !!suffix)),
className: clsx(clearIconCls, (_clsx = {}, _defineProperty(_clsx, "".concat(clearIconCls, "-hidden"), !needClear), _defineProperty(_clsx, "".concat(clearIconCls, "-has-suffix"), !!suffix), _clsx)),
role: "button",

@@ -86,3 +88,3 @@ tabIndex: -1

var affixWrapperPrefixCls = "".concat(prefixCls, "-affix-wrapper");
var affixWrapperCls = clsx(affixWrapperPrefixCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-disabled"), disabled), "".concat(affixWrapperPrefixCls, "-disabled"), disabled), "".concat(affixWrapperPrefixCls, "-focused"), focused), "".concat(affixWrapperPrefixCls, "-readonly"), readOnly), "".concat(affixWrapperPrefixCls, "-input-with-clear-btn"), suffix && allowClear && value), classes === null || classes === void 0 ? void 0 : classes.affixWrapper, classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, classNames === null || classNames === void 0 ? void 0 : classNames.variant);
var affixWrapperCls = clsx(affixWrapperPrefixCls, (_clsx2 = {}, _defineProperty(_clsx2, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_clsx2, "".concat(affixWrapperPrefixCls, "-disabled"), disabled), _defineProperty(_clsx2, "".concat(affixWrapperPrefixCls, "-focused"), focused), _defineProperty(_clsx2, "".concat(affixWrapperPrefixCls, "-readonly"), readOnly), _defineProperty(_clsx2, "".concat(affixWrapperPrefixCls, "-input-with-clear-btn"), suffix && allowClear && value), _clsx2), classes === null || classes === void 0 ? void 0 : classes.affixWrapper, classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, classNames === null || classNames === void 0 ? void 0 : classNames.variant);
var suffixNode = (suffix || allowClear) && /*#__PURE__*/React.createElement("span", {

@@ -89,0 +91,0 @@ className: clsx("".concat(prefixCls, "-suffix"), classNames === null || classNames === void 0 ? void 0 : classNames.suffix),

@@ -7,3 +7,3 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";

import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["autoComplete", "onChange", "onFocus", "onBlur", "onPressEnter", "onKeyDown", "prefixCls", "disabled", "htmlSize", "className", "maxLength", "suffix", "showCount", "count", "type", "classes", "classNames", "styles", "onCompositionStart", "onCompositionEnd"];
var _excluded = ["autoComplete", "onChange", "onFocus", "onBlur", "onPressEnter", "onKeyDown", "onKeyUp", "prefixCls", "disabled", "htmlSize", "className", "maxLength", "suffix", "showCount", "count", "type", "classes", "classNames", "styles", "onCompositionStart", "onCompositionEnd"];
import clsx from 'classnames';

@@ -23,2 +23,3 @@ import useMergedState from "rc-util/es/hooks/useMergedState";

onKeyDown = props.onKeyDown,
onKeyUp = props.onKeyUp,
_props$prefixCls = props.prefixCls,

@@ -46,2 +47,3 @@ prefixCls = _props$prefixCls === void 0 ? 'rc-input' : _props$prefixCls,

var compositionRef = useRef(false);
var keyLockRef = useRef(false);
var inputRef = useRef(null);

@@ -141,7 +143,14 @@ var holderRef = useRef(null);

var handleKeyDown = function handleKeyDown(e) {
if (onPressEnter && e.key === 'Enter') {
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
if (onPressEnter && e.key === 'Enter' && !keyLockRef.current) {
keyLockRef.current = true;
onPressEnter(e);
}
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
};
var handleKeyUp = function handleKeyUp(e) {
onKeyUp === null || onKeyUp === void 0 || onKeyUp(e);
if (e.key === 'Enter') {
keyLockRef.current = false;
}
};
var handleFocus = function handleFocus(e) {

@@ -178,2 +187,3 @@ setFocused(true);

onKeyDown: handleKeyDown,
onKeyUp: handleKeyUp,
className: clsx(prefixCls, _defineProperty({}, "".concat(prefixCls, "-disabled"), disabled), classNames === null || classNames === void 0 ? void 0 : classNames.input),

@@ -180,0 +190,0 @@ style: styles === null || styles === void 0 ? void 0 : styles.input,

@@ -71,5 +71,7 @@ "use strict";

if (hasAffix) {
var _clsx2;
// ================== Clear Icon ================== //
var clearIcon = null;
if (allowClear) {
var _clsx;
var needClear = !disabled && !readOnly && value;

@@ -89,3 +91,3 @@ var clearIconCls = "".concat(prefixCls, "-clear-icon");

},
className: (0, _classnames.default)(clearIconCls, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(clearIconCls, "-hidden"), !needClear), "".concat(clearIconCls, "-has-suffix"), !!suffix)),
className: (0, _classnames.default)(clearIconCls, (_clsx = {}, (0, _defineProperty2.default)(_clsx, "".concat(clearIconCls, "-hidden"), !needClear), (0, _defineProperty2.default)(_clsx, "".concat(clearIconCls, "-has-suffix"), !!suffix), _clsx)),
role: "button",

@@ -96,3 +98,3 @@ tabIndex: -1

var affixWrapperPrefixCls = "".concat(prefixCls, "-affix-wrapper");
var affixWrapperCls = (0, _classnames.default)(affixWrapperPrefixCls, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(prefixCls, "-disabled"), disabled), "".concat(affixWrapperPrefixCls, "-disabled"), disabled), "".concat(affixWrapperPrefixCls, "-focused"), focused), "".concat(affixWrapperPrefixCls, "-readonly"), readOnly), "".concat(affixWrapperPrefixCls, "-input-with-clear-btn"), suffix && allowClear && value), classes === null || classes === void 0 ? void 0 : classes.affixWrapper, classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, classNames === null || classNames === void 0 ? void 0 : classNames.variant);
var affixWrapperCls = (0, _classnames.default)(affixWrapperPrefixCls, (_clsx2 = {}, (0, _defineProperty2.default)(_clsx2, "".concat(prefixCls, "-disabled"), disabled), (0, _defineProperty2.default)(_clsx2, "".concat(affixWrapperPrefixCls, "-disabled"), disabled), (0, _defineProperty2.default)(_clsx2, "".concat(affixWrapperPrefixCls, "-focused"), focused), (0, _defineProperty2.default)(_clsx2, "".concat(affixWrapperPrefixCls, "-readonly"), readOnly), (0, _defineProperty2.default)(_clsx2, "".concat(affixWrapperPrefixCls, "-input-with-clear-btn"), suffix && allowClear && value), _clsx2), classes === null || classes === void 0 ? void 0 : classes.affixWrapper, classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, classNames === null || classNames === void 0 ? void 0 : classNames.variant);
var suffixNode = (suffix || allowClear) && /*#__PURE__*/_react.default.createElement("span", {

@@ -99,0 +101,0 @@ className: (0, _classnames.default)("".concat(prefixCls, "-suffix"), classNames === null || classNames === void 0 ? void 0 : classNames.suffix),

@@ -22,3 +22,3 @@ "use strict";

var _commonUtils = require("./utils/commonUtils");
var _excluded = ["autoComplete", "onChange", "onFocus", "onBlur", "onPressEnter", "onKeyDown", "prefixCls", "disabled", "htmlSize", "className", "maxLength", "suffix", "showCount", "count", "type", "classes", "classNames", "styles", "onCompositionStart", "onCompositionEnd"];
var _excluded = ["autoComplete", "onChange", "onFocus", "onBlur", "onPressEnter", "onKeyDown", "onKeyUp", "prefixCls", "disabled", "htmlSize", "className", "maxLength", "suffix", "showCount", "count", "type", "classes", "classNames", "styles", "onCompositionStart", "onCompositionEnd"];
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); }

@@ -33,2 +33,3 @@ 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; }

onKeyDown = props.onKeyDown,
onKeyUp = props.onKeyUp,
_props$prefixCls = props.prefixCls,

@@ -56,2 +57,3 @@ prefixCls = _props$prefixCls === void 0 ? 'rc-input' : _props$prefixCls,

var compositionRef = (0, _react.useRef)(false);
var keyLockRef = (0, _react.useRef)(false);
var inputRef = (0, _react.useRef)(null);

@@ -151,7 +153,14 @@ var holderRef = (0, _react.useRef)(null);

var handleKeyDown = function handleKeyDown(e) {
if (onPressEnter && e.key === 'Enter') {
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
if (onPressEnter && e.key === 'Enter' && !keyLockRef.current) {
keyLockRef.current = true;
onPressEnter(e);
}
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
};
var handleKeyUp = function handleKeyUp(e) {
onKeyUp === null || onKeyUp === void 0 || onKeyUp(e);
if (e.key === 'Enter') {
keyLockRef.current = false;
}
};
var handleFocus = function handleFocus(e) {

@@ -188,2 +197,3 @@ setFocused(true);

onKeyDown: handleKeyDown,
onKeyUp: handleKeyUp,
className: (0, _classnames.default)(prefixCls, (0, _defineProperty2.default)({}, "".concat(prefixCls, "-disabled"), disabled), classNames === null || classNames === void 0 ? void 0 : classNames.input),

@@ -190,0 +200,0 @@ style: styles === null || styles === void 0 ? void 0 : styles.input,

{
"name": "rc-input",
"version": "1.6.0",
"version": "1.6.1",
"description": "React input component",

@@ -5,0 +5,0 @@ "keywords": [

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