Socket
Socket
Sign inDemoInstall

react-input-mask

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-input-mask - npm Package Compare versions

Comparing version 0.3.3 to 0.4.0

32

build/InputElement.js

@@ -339,14 +339,20 @@ "use strict";

return {
value = this.getStringValue(value);
var state = {
mask: mask.mask,
permanents: mask.permanents,
value: this.getStringValue(value),
maskChar: "maskChar" in this.props ? this.props.maskChar : this.defaultMaskChar
};
state.value = this.props.alwaysShowMask ? this.formatValue(value, state) : value;
return state;
},
componentWillMount: function componentWillMount() {
if (this.state.mask && this.state.value) {
this.setState({
value: this.formatValue(this.state.value)
});
var _state = this.state;
var mask = _state.mask;
var value = _state.value;
if (mask && value) {
this.setState({ value: value });
}

@@ -370,3 +376,3 @@ },

}
if (mask.mask && (newValue || this.isFocused())) {
if (mask.mask && (newValue || nextProps.alwaysShowMask || this.isFocused())) {
newValue = this.formatValue(newValue, state);

@@ -457,6 +463,6 @@ }

var caretPos = this.getCaretPos();
var _state = this.state;
var value = _state.value;
var mask = _state.mask;
var maskChar = _state.maskChar;
var _state2 = this.state;
var value = _state2.value;
var mask = _state2.mask;
var maskChar = _state2.maskChar;

@@ -543,3 +549,3 @@ var maskLen = mask.length;

onBlur: function onBlur(event) {
if (this.isEmpty(this.state.value)) {
if (!this.props.alwaysShowMask && this.isEmpty(this.state.value)) {
event.target.value = "";

@@ -612,3 +618,3 @@ this.setState({

fileName: "../../../InputElement.js",
lineNumber: 592
lineNumber: 595
}

@@ -615,0 +621,0 @@ }));

@@ -325,14 +325,17 @@ // https://github.com/sanniassin/react-input-mask

return {
value = this.getStringValue(value);
var state = {
mask: mask.mask,
permanents: mask.permanents,
value: this.getStringValue(value),
maskChar: "maskChar" in this.props ? this.props.maskChar : this.defaultMaskChar
};
state.value = this.props.alwaysShowMask ? this.formatValue(value, state) : value;
return state;
},
componentWillMount: function() {
if (this.state.mask && this.state.value) {
this.setState({
value: this.formatValue(this.state.value)
});
var { mask, value } = this.state;
if (mask && value) {
this.setState({ value });
}

@@ -358,3 +361,3 @@ },

}
if (mask.mask && (newValue || this.isFocused())) {
if (mask.mask && (newValue || nextProps.alwaysShowMask || this.isFocused())) {
newValue = this.formatValue(newValue, state);

@@ -531,3 +534,3 @@ }

onBlur: function(event) {
if (this.isEmpty(this.state.value)) {
if (!this.props.alwaysShowMask && this.isEmpty(this.state.value)) {
event.target.value = "";

@@ -534,0 +537,0 @@ this.setState({

{
"name": "react-input-mask",
"description": "Masked input component for React",
"version": "0.3.3",
"version": "0.4.0",
"homepage": "https://github.com/sanniassin/react-input-mask",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -22,2 +22,6 @@ # react-input-mask

### `alwaysShowMask` : `boolean`
Show mask even in empty input without focus.
## Example

@@ -24,0 +28,0 @@ ```js

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