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

react-imask

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-imask - npm Package Compare versions

Comparing version 7.3.1-alpha.0 to 7.4.0

27

dist/react-imask.js

@@ -65,5 +65,4 @@ (function (global, factory) {

function IMaskMixin(ComposedComponent) {
const MaskedComponent = class extends React__default.default.Component {
static displayName;
static propTypes;
var _Class;
const MaskedComponent = (_Class = class MaskedComponent extends React__default.default.Component {
constructor(props) {

@@ -90,3 +89,4 @@ super(props);

if ('value' in props && props.value !== undefined) {
if (this.element?.isContentEditable && this.element.tagName !== 'INPUT' && this.element.tagName !== 'TEXTAREA') this.element.textContent = props.value;else this.element.value = props.value;
var _this$element;
if ((_this$element = this.element) != null && _this$element.isContentEditable && this.element.tagName !== 'INPUT' && this.element.tagName !== 'TEXTAREA') this.element.textContent = props.value;else this.element.value = props.value;
}

@@ -162,5 +162,5 @@ }

}
};
}, _Class.displayName = void 0, _Class.propTypes = void 0, _Class);
const nestedComponentName = ComposedComponent.displayName || ComposedComponent.name || 'Component';
MaskedComponent.displayName = `IMask(${nestedComponentName})`;
MaskedComponent.displayName = "IMask(" + nestedComponentName + ")";
MaskedComponent.propTypes = MASK_PROPS;

@@ -203,4 +203,5 @@ return React__default.default.forwardRef((props, ref) => React__default.default.createElement(MaskedComponent, {

const _destroyMask = React.useCallback(() => {
var _maskRef$current;
if (!initialized) return;
maskRef.current?.destroy();
(_maskRef$current = maskRef.current) == null || _maskRef$current.destroy();
maskRef.current = null;

@@ -219,11 +220,11 @@ }, []);

setValue(m.value);
onAccept?.(m.value, m, event);
onAccept == null || onAccept(m.value, m, event);
}, [onAccept]);
const _onComplete = React.useCallback(event => maskRef.current && onComplete?.(maskRef.current.value, maskRef.current, event), [onComplete]);
const _onComplete = React.useCallback(event => maskRef.current && (onComplete == null ? void 0 : onComplete(maskRef.current.value, maskRef.current, event)), [onComplete]);
React.useEffect(() => {
const el = ref.current;
if (!el || !opts?.mask) return _destroyMask();
if (!el || !(opts != null && opts.mask)) return _destroyMask();
const mask = maskRef.current;
if (!mask) {
if (el && opts?.mask) {
if (el && opts != null && opts.mask) {
maskRef.current = IMask__default.default(el, opts);

@@ -233,3 +234,3 @@ _onAccept();

} else {
mask?.updateOptions(opts); // TODO fix no idea
mask == null || mask.updateOptions(opts); // TODO fix no idea
}

@@ -294,3 +295,3 @@ setInitialized(Boolean(maskRef.current));

Object.defineProperty(exports, 'IMask', {
Object.defineProperty(exports, "IMask", {
enumerable: true,

@@ -297,0 +298,0 @@ get: function () { return IMask__default.default; }

@@ -17,4 +17,5 @@ import IMask from 'imask/esm/imask';

const _destroyMask = useCallback(() => {
var _maskRef$current;
if (!initialized) return;
maskRef.current?.destroy();
(_maskRef$current = maskRef.current) == null || _maskRef$current.destroy();
maskRef.current = null;

@@ -33,11 +34,11 @@ }, []);

setValue(m.value);
onAccept?.(m.value, m, event);
onAccept == null || onAccept(m.value, m, event);
}, [onAccept]);
const _onComplete = useCallback(event => maskRef.current && onComplete?.(maskRef.current.value, maskRef.current, event), [onComplete]);
const _onComplete = useCallback(event => maskRef.current && (onComplete == null ? void 0 : onComplete(maskRef.current.value, maskRef.current, event)), [onComplete]);
useEffect(() => {
const el = ref.current;
if (!el || !opts?.mask) return _destroyMask();
if (!el || !(opts != null && opts.mask)) return _destroyMask();
const mask = maskRef.current;
if (!mask) {
if (el && opts?.mask) {
if (el && opts != null && opts.mask) {
maskRef.current = IMask(el, opts);

@@ -47,3 +48,3 @@ _onAccept();

} else {
mask?.updateOptions(opts); // TODO fix no idea
mask == null || mask.updateOptions(opts); // TODO fix no idea
}

@@ -50,0 +51,0 @@ setInitialized(Boolean(maskRef.current));

@@ -19,3 +19,3 @@ import React from 'react';

[x: string]: unknown;
}>, "ref"> & Partial<Pick<import("../../imask/esm").MaskedNumber, "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "eager" | "skipInvalid" | "min" | "max" | "radix" | "thousandsSeparator" | "mapToRadix" | "scale" | "normalizeZeros" | "padFractionalZeros">> & {
}>, "ref"> & Partial<Pick<import("../../imask/esm").MaskedNumber, "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "eager" | "skipInvalid" | "min" | "max" | "autofix" | "radix" | "thousandsSeparator" | "mapToRadix" | "scale" | "normalizeZeros" | "padFractionalZeros">> & {
ref?: React.Ref<React.ComponentType<IMaskInputProps<HTMLInputElement>>> | undefined;

@@ -26,3 +26,3 @@ }, "ref"> | Omit<import("./mixin").ReactElementProps<HTMLInputElement> & Omit<import("./mixin").ReactMaskProps<HTMLInputElement, {

mask: typeof import("../../imask/esm").MaskedNumber;
} & Omit<Partial<Pick<import("../../imask/esm").MaskedNumber, "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "eager" | "skipInvalid" | "min" | "max" | "radix" | "thousandsSeparator" | "mapToRadix" | "scale" | "normalizeZeros" | "padFractionalZeros">>, "mask"> & {
} & Omit<Partial<Pick<import("../../imask/esm").MaskedNumber, "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "eager" | "skipInvalid" | "min" | "max" | "autofix" | "radix" | "thousandsSeparator" | "mapToRadix" | "scale" | "normalizeZeros" | "padFractionalZeros">>, "mask"> & {
ref?: React.Ref<React.ComponentType<IMaskInputProps<HTMLInputElement>>> | undefined;

@@ -99,3 +99,3 @@ }, "ref"> | Omit<import("./mixin").ReactElementProps<HTMLInputElement> & Omit<import("./mixin").ReactMaskProps<HTMLInputElement, {

mask: import("../../imask/esm").MaskedNumber;
} & Omit<Partial<Pick<import("../../imask/esm").MaskedNumber, "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "eager" | "skipInvalid" | "min" | "max" | "radix" | "thousandsSeparator" | "mapToRadix" | "scale" | "normalizeZeros" | "padFractionalZeros">>, "mask"> & {
} & Omit<Partial<Pick<import("../../imask/esm").MaskedNumber, "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "eager" | "skipInvalid" | "min" | "max" | "autofix" | "radix" | "thousandsSeparator" | "mapToRadix" | "scale" | "normalizeZeros" | "padFractionalZeros">>, "mask"> & {
ref?: React.Ref<React.ComponentType<IMaskInputProps<HTMLInputElement>>> | undefined;

@@ -102,0 +102,0 @@ }, "ref"> | Omit<import("./mixin").ReactElementProps<HTMLInputElement> & Omit<import("./mixin").ReactMaskProps<HTMLInputElement, {

@@ -57,5 +57,4 @@ import React from 'react';

function IMaskMixin(ComposedComponent) {
const MaskedComponent = class extends React.Component {
static displayName;
static propTypes;
var _Class;
const MaskedComponent = (_Class = class MaskedComponent extends React.Component {
constructor(props) {

@@ -82,3 +81,4 @@ super(props);

if ('value' in props && props.value !== undefined) {
if (this.element?.isContentEditable && this.element.tagName !== 'INPUT' && this.element.tagName !== 'TEXTAREA') this.element.textContent = props.value;else this.element.value = props.value;
var _this$element;
if ((_this$element = this.element) != null && _this$element.isContentEditable && this.element.tagName !== 'INPUT' && this.element.tagName !== 'TEXTAREA') this.element.textContent = props.value;else this.element.value = props.value;
}

@@ -154,5 +154,5 @@ }

}
};
}, _Class.displayName = void 0, _Class.propTypes = void 0, _Class);
const nestedComponentName = ComposedComponent.displayName || ComposedComponent.name || 'Component';
MaskedComponent.displayName = `IMask(${nestedComponentName})`;
MaskedComponent.displayName = "IMask(" + nestedComponentName + ")";
MaskedComponent.propTypes = MASK_PROPS;

@@ -159,0 +159,0 @@ return React.forwardRef((props, ref) => React.createElement(MaskedComponent, {

{
"name": "react-imask",
"version": "7.3.1-alpha.0",
"version": "7.4.0",
"license": "MIT",

@@ -64,3 +64,3 @@ "author": "Alexey Kryazhev",

"dependencies": {
"imask": "^7.3.0",
"imask": "^7.4.0",
"prop-types": "^15.8.1"

@@ -74,6 +74,6 @@ },

},
"gitHead": "b22cdb0908b11ebd14a29550fe95b6ba800919c1",
"gitHead": "1208991c5c42b7791fb64a84bda24129eb830a48",
"devDependencies": {
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.17",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"react": "^18.2.0",

@@ -80,0 +80,0 @@ "react-dom": "^18.2.0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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