@mona-health/react-input-mask
Advanced tools
Comparing version 3.0.1 to 3.0.2
{ | ||
"name": "@mona-health/react-input-mask", | ||
"description": "(yet another) Masked input component for React", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"homepage": "https://github.com/mona-health/react-input-mask", | ||
@@ -9,3 +9,3 @@ "license": "MIT", | ||
"contributors": [ | ||
"Ian Channing <ian.channing@mona.health>" | ||
"Ian Channing <ian_channing@hotmail.com>" | ||
], | ||
@@ -26,3 +26,6 @@ "keywords": [ | ||
"@babel/core": "^7.8.3", | ||
"@babel/eslint-parser": "^7.23.10", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/plugin-proposal-private-methods": "^7.18.6", | ||
"@babel/plugin-proposal-private-property-in-object": "^7.21.11", | ||
"@babel/plugin-transform-modules-commonjs": "^7.8.3", | ||
@@ -34,4 +37,8 @@ "@babel/plugin-transform-proto-to-assign": "^7.8.3", | ||
"@babel/register": "^7.8.3", | ||
"babel-eslint": "^10.0.3", | ||
"babel-loader": "^8.0.6", | ||
"@rollup/plugin-babel": "^6.0.4", | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-replace": "^5.0.5", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"babel-loader": "^9.1.3", | ||
"babel-plugin-dev-expression": "^0.2.2", | ||
@@ -42,35 +49,32 @@ "babel-plugin-minify-dead-code-elimination": "^0.5.1", | ||
"console-polyfill": "^0.3.0", | ||
"cross-env": "^5.2.1", | ||
"eslint": "^6.8.0", | ||
"eslint-config-airbnb": "^18.0.1", | ||
"eslint-config-prettier": "^6.9.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.57.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.20.0", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-react": "^7.18.0", | ||
"eslint-plugin-react-hooks": "^1.7.0", | ||
"html-webpack-plugin": "^3.2.0", | ||
"husky": "^3.1.0", | ||
"karma": "^4.4.1", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"html-webpack-plugin": "^5.6.0", | ||
"husky": "^9.0.11", | ||
"karma": "^6.4.3", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-webpack": "^4.0.2", | ||
"lint-staged": "^9.5.0", | ||
"mocha": "^6.2.2", | ||
"prettier": "^1.19.1", | ||
"puppeteer": "^1.20.0", | ||
"karma-mocha": "^2.0.1", | ||
"karma-webpack": "^5.0.1", | ||
"lint-staged": "^15.2.2", | ||
"mocha": "^10.3.0", | ||
"prettier": "^3.2.5", | ||
"puppeteer": "^22.3.0", | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"rollup": "^1.29.0", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-replace": "^2.2.0", | ||
"rollup-plugin-size-snapshot": "^0.10.0", | ||
"rollup-plugin-terser": "^5.2.0", | ||
"webpack": "^4.41.5", | ||
"webpack-cli": "^3.3.10", | ||
"webpack-dev-server": "^3.10.1" | ||
"rimraf": "^5.0.5", | ||
"rollup": "^4.12.0", | ||
"typescript": "^5.3.3", | ||
"webpack": "^5.90.3", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-dev-server": "^5.0.2" | ||
}, | ||
"main": "index.js", | ||
"types": "./dist/index.js", | ||
"files": [ | ||
@@ -83,7 +87,2 @@ "lib", | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"scripts": { | ||
@@ -93,3 +92,3 @@ "clean": "rimraf lib dist", | ||
"start": "cross-env BABEL_ENV=test NODE_ENV=development webpack-dev-server", | ||
"prepare": "npm run lint && npm test && npm run clean && npm run build", | ||
"prepare": "husky && npm run lint && npm test && npm run clean && npm run types", | ||
"lint": "eslint ./src ./tests ./*.js", | ||
@@ -100,3 +99,4 @@ "lint-fix": "eslint --fix ./src ./tests ./*.js", | ||
"test:server-render": "cross-env BABEL_ENV=test mocha --require @babel/register ./tests/server-render", | ||
"test:build": "cross-env BABEL_ENV=test mocha --require @babel/register ./tests/build" | ||
"test:build": "cross-env BABEL_ENV=test mocha --require @babel/register ./tests/build", | ||
"types": "tsc" | ||
}, | ||
@@ -103,0 +103,0 @@ "repository": { |
@@ -6,2 +6,3 @@ # @mona-health/react-input-mask | ||
--> | ||
[![npm version](https://img.shields.io/npm/v/@mona-health/react-input-mask.svg?style=flat)](https://www.npmjs.com/package/@mona-health/react-input-mask) | ||
@@ -31,4 +32,4 @@ | ||
```jsx | ||
import React from 'react' | ||
import InputMask from '@mona-health/react-input-mask' | ||
import React from "react"; | ||
import InputMask from "@mona-health/react-input-mask"; | ||
@@ -122,3 +123,3 @@ function DateInput(props) { | ||
let { value } = nextState; | ||
if (value.endsWith('/')) { | ||
if (value.endsWith("/")) { | ||
value = value.slice(0, -1); | ||
@@ -129,3 +130,3 @@ } | ||
...nextState, | ||
value | ||
value, | ||
}; | ||
@@ -150,5 +151,5 @@ } | ||
```jsx | ||
import React from 'react'; | ||
import InputMask from '@mona-health/react-input-mask'; | ||
import MaterialInput from '@material-ui/core/Input'; | ||
import React from "react"; | ||
import InputMask from "@mona-health/react-input-mask"; | ||
import MaterialInput from "@material-ui/core/Input"; | ||
@@ -178,27 +179,26 @@ // Will work fine | ||
```jsx | ||
const FunctionalInputComponent = React.forwardRef((props, ref) => { | ||
return ( | ||
<input ref={ref} {...props} /> | ||
); | ||
}); | ||
``` | ||
```jsx | ||
const FunctionalInputComponent = React.forwardRef((props, ref) => { | ||
return <input ref={ref} {...props} />; | ||
}); | ||
``` | ||
2. a class component that is wrapped in a function component that implements `React.forwardRef` (`innerRef` can be called anything as long as it's not `ref`) | ||
```jsx | ||
class InnerClassInputComponent extends React.Component { | ||
render() { | ||
const { innerRef, ...restProps } = this.props; | ||
return ( | ||
<div> | ||
<input ref={innerRef} {...restProps} /> | ||
</div> | ||
); | ||
} | ||
} | ||
```jsx | ||
class InnerClassInputComponent extends React.Component { | ||
render() { | ||
const { innerRef, ...restProps } = this.props; | ||
return ( | ||
<div> | ||
<input ref={innerRef} {...restProps} /> | ||
</div> | ||
); | ||
} | ||
} | ||
const ClassInputComponent = React.forwardRef((props, ref) => { | ||
return <InnerClassInputComponent innerRef={ref} {...props} />; | ||
}); | ||
``` | ||
const ClassInputComponent = React.forwardRef((props, ref) => { | ||
return <InnerClassInputComponent innerRef={ref} {...props} />; | ||
}); | ||
``` | ||
@@ -224,6 +224,3 @@ For more information see the [Material UI Composition guide - caveat with Refs](https://mui.com/material-ui/guides/composition/#caveat-with-refs). | ||
```js | ||
cy.get('input') | ||
.focus() | ||
.type('12345') | ||
.should('have.value', '12/34/5___'); // expected <input> to have value 12/34/5___, but the value was 23/45/____ | ||
cy.get("input").focus().type("12345").should("have.value", "12/34/5___"); // expected <input> to have value 12/34/5___, but the value was 23/45/____ | ||
``` | ||
@@ -238,18 +235,13 @@ | ||
// type() is an action command and focuses input anyway | ||
cy.get('input') | ||
.type('12345') | ||
.should('have.value', '12/34/5___') | ||
cy.get("input").type("12345").should("have.value", "12/34/5___"); | ||
// Use click() instead of focus() | ||
cy.get('input') | ||
.click() | ||
.type('12345') | ||
.should('have.value', '12/34/5___') | ||
cy.get("input").click().type("12345").should("have.value", "12/34/5___"); | ||
// Or wait a little after focus() | ||
cy.get('input') | ||
cy.get("input") | ||
.focus() | ||
.wait(50) | ||
.type('12345') | ||
.should('have.value', '12/34/5___'); | ||
.type("12345") | ||
.should("have.value", "12/34/5___"); | ||
``` | ||
@@ -259,3 +251,3 @@ | ||
Running `npm install` runs `lint`, `test`, `clean` and `build` scripts too. | ||
Running `npm install` runs `lint`, `test`, `clean`, `types` and `build` scripts too. | ||
@@ -262,0 +254,0 @@ Set the `CHROME_BIN` environment variable which is the path to the Chrome binary to prevent karma errors in `npm run test`. |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
24
0
1
19978
50
99
1
250
1