Socket
Socket
Sign inDemoInstall

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.4.5 to 1.5.0

8

es/BaseInput.d.ts

@@ -1,4 +0,8 @@

import type { FC } from 'react';
import React from 'react';
import type { BaseInputProps } from './interface';
declare const BaseInput: FC<BaseInputProps>;
export interface HolderRef {
/** Provider holder ref. Will return `null` if not wrap anything */
nativeElement: HTMLElement | null;
}
declare const BaseInput: React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<HolderRef>>;
export default BaseInput;

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

import { hasAddon, hasPrefixSuffix } from "./utils/commonUtils";
var BaseInput = function BaseInput(props) {
var BaseInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
var _element$props, _element$props2;

@@ -51,2 +51,10 @@ var inputEl = props.inputElement,

// ======================== Ref ======================== //
var groupRef = useRef(null);
React.useImperativeHandle(ref, function () {
return {
nativeElement: groupRef.current || containerRef.current
};
});
// ================== Prefix & Suffix ================== //

@@ -104,3 +112,4 @@ if (hasAffix) {

element = /*#__PURE__*/React.createElement(GroupWrapperComponent, {
className: mergedGroupClassName
className: mergedGroupClassName,
ref: groupRef
}, /*#__PURE__*/React.createElement(WrapperComponent, {

@@ -121,3 +130,3 @@ className: mergedWrapperClassName

});
};
});
export default BaseInput;

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

var inputRef = useRef(null);
var holderRef = useRef(null);
var focus = function focus(option) {

@@ -75,2 +76,3 @@ if (inputRef.current) {

useImperativeHandle(ref, function () {
var _holderRef$current;
return {

@@ -90,3 +92,4 @@ focus: focus,

},
input: inputRef.current
input: inputRef.current,
nativeElement: ((_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.nativeElement) || inputRef.current
};

@@ -93,0 +96,0 @@ });

@@ -100,2 +100,3 @@ import type { CSSProperties, InputHTMLAttributes, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react';

input: HTMLInputElement | null;
nativeElement: HTMLElement | null;
}

@@ -102,0 +103,0 @@ export interface ChangeEventInfo {

@@ -1,4 +0,8 @@

import type { FC } from 'react';
import React from 'react';
import type { BaseInputProps } from './interface';
declare const BaseInput: FC<BaseInputProps>;
export interface HolderRef {
/** Provider holder ref. Will return `null` if not wrap anything */
nativeElement: HTMLElement | null;
}
declare const BaseInput: React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<HolderRef>>;
export default BaseInput;

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

function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(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 BaseInput = function BaseInput(props) {
var BaseInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
var _element$props, _element$props2;

@@ -61,2 +61,10 @@ var inputEl = props.inputElement,

// ======================== Ref ======================== //
var groupRef = (0, _react.useRef)(null);
_react.default.useImperativeHandle(ref, function () {
return {
nativeElement: groupRef.current || containerRef.current
};
});
// ================== Prefix & Suffix ================== //

@@ -114,3 +122,4 @@ if (hasAffix) {

element = /*#__PURE__*/_react.default.createElement(GroupWrapperComponent, {
className: mergedGroupClassName
className: mergedGroupClassName,
ref: groupRef
}, /*#__PURE__*/_react.default.createElement(WrapperComponent, {

@@ -131,3 +140,3 @@ className: mergedWrapperClassName

});
};
});
var _default = exports.default = BaseInput;

@@ -55,2 +55,3 @@ "use strict";

var inputRef = (0, _react.useRef)(null);
var holderRef = (0, _react.useRef)(null);
var focus = function focus(option) {

@@ -85,2 +86,3 @@ if (inputRef.current) {

(0, _react.useImperativeHandle)(ref, function () {
var _holderRef$current;
return {

@@ -100,3 +102,4 @@ focus: focus,

},
input: inputRef.current
input: inputRef.current,
nativeElement: ((_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.nativeElement) || inputRef.current
};

@@ -103,0 +106,0 @@ });

@@ -100,2 +100,3 @@ import type { CSSProperties, InputHTMLAttributes, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react';

input: HTMLInputElement | null;
nativeElement: HTMLElement | null;
}

@@ -102,0 +103,0 @@ export interface ChangeEventInfo {

{
"name": "rc-input",
"version": "1.4.5",
"version": "1.5.0",
"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