Input masking component for React. Made with attention to UX.

Overview

react-input-mask

Build Status npm version npm downloads

Input masking component for React. Made with attention to UX.

This is a development branch for version 3.0. For the latest stable version see v2 branch.

Demo

Table of Contents

Installation

npm install [email protected] --save

react-input-mask requires React 16.8.0 or later. If you need support for older versions, use version 2.

Usage

import React from "react"
import InputMask from "react-input-mask";

function DateInput(props) {
  return <InputMask mask="99/99/9999" onChange={props.onChange} value={props.value} />;
}

Properties

Name Type Default Description
mask {String|Array<String, RegExp>} Mask format
maskPlaceholder {String} _ Placeholder to cover unfilled parts of the mask
alwaysShowMask {Boolean} false Whether mask prefix and placeholder should be displayed when input is empty and has no focus
beforeMaskedStateChange {Function} Function to modify value and selection before applying mask
children {ReactElement} Custom render function for integration with other input components

mask

Mask format. Can be either a string or array of characters and regular expressions.

<InputMask mask="99/99/99" />

Simple masks can be defined as strings. The following characters will define mask format:

Character Allowed input
9 0-9
a a-z, A-Z
* 0-9, a-z, A-Z

Any format character can be escaped with a backslash.

More complex masks can be defined as an array of regular expressions and constant characters.

// Canadian postal code mask
const firstLetter = /(?!.*[DFIOQU])[A-VXY]/i;
const letter = /(?!.*[DFIOQU])[A-Z]/i;
const digit = /[0-9]/;
const mask = [firstLetter, digit, letter, " ", digit, letter, digit];
return <InputMask mask={mask} />;

maskPlaceholder

// Will be rendered as 12/--/--
<InputMask mask="99/99/99" maskPlaceholder="-" value="12" />

// Will be rendered as 12/mm/yy
<InputMask mask="99/99/99" maskPlaceholder="dd/mm/yy" value="12" />

// Will be rendered as 12/
<InputMask mask="99/99/99" maskPlaceholder={null} value="12" />

Character or string to cover unfilled parts of the mask. Default character is "_". If set to null or empty string, unfilled parts will be empty as in a regular input.

alwaysShowMask

If enabled, mask prefix and placeholder will be displayed even when input is empty and has no focus.

beforeMaskedStateChange

In case you need to customize masking behavior, you can provide beforeMaskedStateChange function to change masked value and cursor position before it's applied to the input.

It receieves an object with previousState, currentState and nextState properties. Each state is an object with value and selection properites where value is a string and selection is an object containing start and end positions of the selection.

  1. previousState: Input state before change. Only defined on change event.
  2. currentState: Current raw input state. Not defined during component render.
  3. nextState: Input state with applied mask. Contains value and selection fields.

Selection positions will be null if input isn't focused and during rendering.

beforeMaskedStateChange must return a new state with value and selection.

// Trim trailing slashes
function beforeMaskedStateChange({ nextState }) {
  let { value } = nextState;
  if (value.endsWith("/")) {
    value = value.slice(0, -1);
  }

  return {
    ...nextState,
    value
  };
}

return <InputMask mask="99/99/99" maskPlaceholder={null} beforeMaskedStateChange={beforeMaskedStateChange} />;

Please note that beforeMaskedStateChange executes more often than onChange and must be pure.

children

To use another component instead of regular <input /> provide it as children. The following properties, if used, should always be defined on the InputMask component itself: onChange, onMouseDown, onFocus, onBlur, value, disabled, readOnly.

import React from 'react';
import InputMask from 'react-input-mask';
import MaterialInput from '@material-ui/core/Input';

// Will work fine
function Input(props) {
  return (
    <InputMask mask="99/99/9999" value={props.value} onChange={props.onChange}>
      <MaterialInput type="tel" disableUnderline />
    </InputMask>
  );
}

// Will throw an error because InputMask's and children's onChange props aren't the same
function InvalidInput(props) {
  return (
    <InputMask mask="99/99/9999" value={props.value}>
      <MaterialInput type="tel" disableUnderline onChange={props.onChange} />
    </InputMask>
  );
}

Known Issues

Autofill

Browser's autofill requires either empty value in input or value which exactly matches beginning of the autofilled value. I.e. autofilled value "+1 (555) 123-4567" will work with "+1" or "+1 (5", but won't work with "+1 (___) ___-____" or "1 (555)". There are several possible solutions:

  1. Set maskChar to null and trim space after "+1" with beforeMaskedStateChange if no more digits are entered.
  2. Apply mask only if value is not empty. In general, this is the most reliable solution because we can't be sure about formatting in autofilled value.
  3. Use less formatting in the mask.

Please note that it might lead to worse user experience (should I enter +1 if input is empty?). You should choose what's more important to your users — smooth typing experience or autofill. Phone and ZIP code inputs are very likely to be autofilled and it's a good idea to care about it, while security confirmation code in two-factor authorization shouldn't care about autofill at all.

Cypress tests

The following sequence could fail

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/____

Since focus is not an action command, it behaves differently than the real user interaction and, therefore, less reliable.

There is a few possible workarounds

// Start typing without calling focus() explicitly.
// type() is an action command and focuses input anyway
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___");

// Or wait a little after focus()
cy.get("input")
  .focus()
  .wait(50)
  .type("12345")
  .should("have.value", "12/34/5___");

Thanks

Thanks to BrowserStack for the help with testing on real devices

Comments
  • Add esm output and ignore dist

    Add esm output and ignore dist

    Committing compiled files in git is usually not the best way to distribute library. For distributing umd files it would be more effecient to use cdn or services like unpkg.com. It's also better because pulling these files from git repo also requires user actions and own services so we just move this responsibility to npm (in case of unpkg).

    In this diff I removed dist directory from git to reduce confusion for contributors and make publishing less verbose.

    I moved all compiled files in dist directory and added umd prefix to not minified bundle. Also I added esm output. So dist directory now looks very nice and intuitive for consumers.

    react-input-mask.cjs.js
    react-input-mask.esm.js
    react-input-mask.min.js
    react-input-mask.umd.js
    
    opened by TrySound 25
  • Add render prop support

    Add render prop support

    import React from 'react';
    import InputMask from 'react-input-mask';
    import styled from 'styled-components';
    
    const StyledInput = styled.input`
      border-color: red;
    `;
    
    class Input extends React.Component {
      render() {
        return <InputMask mask="99999-9999" render={(ref, props) => <StyledInput innerRef={ref} {...props} />} />;
      }
    }
    

    I'm not familiar with test writting. Help is appreciated.

    opened by denisborovikov 21
  • Error for latest React (15.6.1)

    Error for latest React (15.6.1)

    Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    

    Problem seems to be related to this code chunk:

        return _react2.default.createElement('input', _extends({ ref: function ref(_ref) {
            return _this2.input = _ref;
          } }, props, { onFocus: _this2.onFocus, onBlur: _this2.onBlur }));
    
    opened by ixrock 20
  • Bugfix remove deprecated findDOMNode method

    Bugfix remove deprecated findDOMNode method

    Currently, we get such a warning:

    Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of InputElement which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node

    This problem happens because findDOMNode method deprecated. So we don't need to use it.

    This PR should solve this problem.

    image

    opened by Temirtator 19
  • Unmasked input value

    Unmasked input value

    Does there any ways to get unmasked input value? For example, with mask +7 (999) 999-99-99 in onChange event value of event.target.value variable is +7 (111) 123-12-12. Could I get just 1111231212?

    opened by drakmail 16
  • Caret moving to next to last position on Chrome android

    Caret moving to next to last position on Chrome android

    I have an issue with the component. When using it with a standard desktop web browser i don't have this issue. But on Android when the last character is entered (from the limit) the caret moves back 1 space.

    You can see it I made a screen capture on my phone.

    https://www.dropbox.com/s/2o2ltd35uca165b/2016_07_29_22_40_38_22_50_29_22_51_58_22_54_21_22_54_59.gif?dl=0

    opened by dusnoki 15
  • Inconsistent cursor positioning on focus

    Inconsistent cursor positioning on focus

    (See video here: http://recordit.co/Yx1bC0PVzQ)

    When focusing a field (either with masks always visible or not) the initial cursor positioning is not consistent. It is expected to be at the first available character position every time it gains focus, however about 70% of the time the cursor will jump to the end, either immediately or after a fractional delay. The video should show this clearly. I simply am taking care to do a single click off the field, and on the field.

    opened by pbarbiero 14
  • How to take masked formatted value in redux form?

    How to take masked formatted value in redux form?

    @sanniassin I was using it with redux form. The problem arises when I tried to take the same masked value as it was showing in textbox. I mean on form submit the value for 111111 111111 1111 goes like 111111111111111 while I want the same format that is showing in textbox that is 111111 111111 1111 . As ref is not working with redux form Field's so is there any way to take masked value?

    opened by Abhijeetjaiswalit 12
  • Copy/paste masking leaving extra characters

    Copy/paste masking leaving extra characters

    When you mask using '9999 9999 9999 9999' and use a maskChar of null, everything works as expected if you in put 4242 4242 4242 4242. Now, select all and paste a 15 digit number instead (as is the case with an Amex card) and the remaining 2 is left with the number.

    Expected result is that the original number would be completely removed and only the new, 15 digit number would be present.

    opened by reintroducing 11
  • Cannot read property 'start' of null

    Cannot read property 'start' of null

    We are using the version 1.2.2 and we tried to upgrade to the latest version. We got the following error: Cannot read property 'start' of null. Could you please help us?

    <InputMask type="tel" className="" autoComplete="tel-national" placeholder="(555) 555-0199" mask="(999) 999-9999" value= onBlur= onChange=/>

    opened by richardvaldiviesomacias 10
  • Issue with the latest React 15.1.0

    Issue with the latest React 15.1.0

    It was working fine with React 0.14.7, though it throws warning with React 15.1.0 when trying to change mask of the InputElement. Code to reproduce: <InputElement id="myid" className="myclass" name="myname" type="text" mask={this.state.mask} maskChar="_" />

    Warning message: InputElement is changing an uncontrolled input of type text to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://fb.me/react-controlled-components

    opened by ShotaMegre 10
  • Bump flat and mocha

    Bump flat and mocha

    Bumps flat to 5.0.2 and updates ancestor dependency mocha. These dependencies need to be updated together.

    Updates flat from 4.1.0 to 5.0.2

    Commits
    • e5ffd66 Release 5.0.2
    • fdb79d5 Update dependencies, refresh lockfile, format with standard.
    • e52185d Test against node 14 in CI.
    • 0189cb1 Avoid arrow function syntax.
    • f25d3a1 Release 5.0.1
    • 54cc7ad use standard formatting
    • 779816e drop dependencies
    • 2eea6d3 Bump lodash from 4.17.15 to 4.17.19
    • a61a554 Bump acorn from 7.1.0 to 7.4.0
    • 20ef0ef Fix prototype pollution on unflatten
    • Additional commits viewable in compare view
    Maintainer changes

    This version was pushed to npm by timoxley, a new releaser for flat since your current version.


    Updates mocha from 6.2.2 to 10.2.0

    Release notes

    Sourced from mocha's releases.

    v10.2.0

    10.2.0 / 2022-12-11

    :tada: Enhancements

    • #4945: API: add possibility to decorate ESM name before import (@​j0tunn)

    :bug: Fixes

    :book: Documentation

    v10.1.0

    10.1.0 / 2022-10-16

    :tada: Enhancements

    :nut_and_bolt: Other

    v10.0.0

    10.0.0 / 2022-05-01

    :boom: Breaking Changes

    :nut_and_bolt: Other

    ... (truncated)

    Changelog

    Sourced from mocha's changelog.

    10.2.0 / 2022-12-11

    :tada: Enhancements

    • #4945: API: add possibility to decorate ESM name before import (@​j0tunn)

    :bug: Fixes

    :book: Documentation

    10.1.0 / 2022-10-16

    :tada: Enhancements

    :nut_and_bolt: Other

    10.0.0 / 2022-05-01

    :boom: Breaking Changes

    :nut_and_bolt: Other

    ... (truncated)

    Commits
    Maintainer changes

    This version was pushed to npm by juergba, a new releaser for mocha since your current version.


    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Chrome credit card autocomplete cuts off 3 last digits

    Chrome credit card autocomplete cuts off 3 last digits

    Hi, i have input field for credit card autoComplete="cc-number" and the mask for it mask={'9999 9999 9999 9999'}. Typing in number or pasting it works very well, but chrome has feature to autocomplete stored card information. And in this case 3 last digits of card number got missing. It looks like this (console.log in beforeMaskedStateChange):

    currentstate.value -> nextstate.value
    1234123412341234 -> 1234 1234 1234 1234
    1234 1234 1234 1234 -> 1234 1234 1234 1234
    1234 1234 1234 1234 -> 1234 1234 1234 1234
    1234123412341234 -> 1234 1234 1234 1
    1234 1234 1234 1 -> 1234 1234 1234 1
    1234 1234 1234 1 -> 1234 1234 1234 1
    

    So it looks like last digits got missing because of 3 spaces added, but why beforeMaskedStateChange is called so many times, and while pasting 1234123412341234 from clipboard it works just well.

    opened by deflexor 0
  • Bump qs, body-parser and express

    Bump qs, body-parser and express

    Bumps qs, body-parser and express. These dependencies needed to be updated together. Updates qs from 6.7.0 to 6.11.0

    Changelog

    Sourced from qs's changelog.

    6.11.0

    • [New] [Fix] stringify: revert 0e903c0; add commaRoundTrip option (#442)
    • [readme] fix version badge

    6.10.5

    • [Fix] stringify: with arrayFormat: comma, properly include an explicit [] on a single-item array (#434)

    6.10.4

    • [Fix] stringify: with arrayFormat: comma, include an explicit [] on a single-item array (#441)
    • [meta] use npmignore to autogenerate an npmignore file
    • [Dev Deps] update eslint, @ljharb/eslint-config, aud, has-symbol, object-inspect, tape

    6.10.3

    • [Fix] parse: ignore __proto__ keys (#428)
    • [Robustness] stringify: avoid relying on a global undefined (#427)
    • [actions] reuse common workflows
    • [Dev Deps] update eslint, @ljharb/eslint-config, object-inspect, tape

    6.10.2

    • [Fix] stringify: actually fix cyclic references (#426)
    • [Fix] stringify: avoid encoding arrayformat comma when encodeValuesOnly = true (#424)
    • [readme] remove travis badge; add github actions/codecov badges; update URLs
    • [Docs] add note and links for coercing primitive values (#408)
    • [actions] update codecov uploader
    • [actions] update workflows
    • [Tests] clean up stringify tests slightly
    • [Dev Deps] update eslint, @ljharb/eslint-config, aud, object-inspect, safe-publish-latest, tape

    6.10.1

    • [Fix] stringify: avoid exception on repeated object values (#402)

    6.10.0

    • [New] stringify: throw on cycles, instead of an infinite loop (#395, #394, #393)
    • [New] parse: add allowSparse option for collapsing arrays with missing indices (#312)
    • [meta] fix README.md (#399)
    • [meta] only run npm run dist in publish, not install
    • [Dev Deps] update eslint, @ljharb/eslint-config, aud, has-symbols, tape
    • [Tests] fix tests on node v0.6
    • [Tests] use ljharb/actions/node/install instead of ljharb/actions/node/run
    • [Tests] Revert "[meta] ignore eclint transitive audit warning"

    6.9.7

    • [Fix] parse: ignore __proto__ keys (#428)
    • [Fix] stringify: avoid encoding arrayformat comma when encodeValuesOnly = true (#424)
    • [Robustness] stringify: avoid relying on a global undefined (#427)
    • [readme] remove travis badge; add github actions/codecov badges; update URLs
    • [Docs] add note and links for coercing primitive values (#408)
    • [Tests] clean up stringify tests slightly
    • [meta] fix README.md (#399)
    • Revert "[meta] ignore eclint transitive audit warning"

    ... (truncated)

    Commits
    • 56763c1 v6.11.0
    • ddd3e29 [readme] fix version badge
    • c313472 [New] [Fix] stringify: revert 0e903c0; add commaRoundTrip option
    • 95bc018 v6.10.5
    • 0e903c0 [Fix] stringify: with arrayFormat: comma, properly include an explicit `[...
    • ba9703c v6.10.4
    • 4e44019 [Fix] stringify: with arrayFormat: comma, include an explicit [] on a s...
    • 113b990 [Dev Deps] update object-inspect
    • c77f38f [Dev Deps] update eslint, @ljharb/eslint-config, aud, has-symbol, tape
    • 2cf45b2 [meta] use npmignore to autogenerate an npmignore file
    • Additional commits viewable in compare view

    Updates body-parser from 1.19.0 to 1.20.1

    Release notes

    Sourced from body-parser's releases.

    1.20.0

    1.19.2

    1.19.1

    Changelog

    Sourced from body-parser's changelog.

    1.20.1 / 2022-10-06

    1.20.0 / 2022-04-02

    1.19.2 / 2022-02-15

    1.19.1 / 2021-12-10

    Commits

    Updates express from 4.17.1 to 4.18.2

    Release notes

    Sourced from express's releases.

    4.18.2

    4.18.1

    • Fix hanging on large stack of sync routes

    4.18.0

    ... (truncated)

    Changelog

    Sourced from express's changelog.

    4.18.2 / 2022-10-08

    4.18.1 / 2022-04-29

    • Fix hanging on large stack of sync routes

    4.18.0 / 2022-04-25

    ... (truncated)

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump decode-uri-component from 0.2.0 to 0.2.2

    Bump decode-uri-component from 0.2.0 to 0.2.2

    Bumps decode-uri-component from 0.2.0 to 0.2.2.

    Release notes

    Sourced from decode-uri-component's releases.

    v0.2.2

    • Prevent overwriting previously decoded tokens 980e0bf

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.1...v0.2.2

    v0.2.1

    • Switch to GitHub workflows 76abc93
    • Fix issue where decode throws - fixes #6 746ca5d
    • Update license (#1) 486d7e2
    • Tidelift tasks a650457
    • Meta tweaks 66e1c28

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.1

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump engine.io and karma

    Bump engine.io and karma

    Bumps engine.io to 6.2.1 and updates ancestor dependency karma. These dependencies need to be updated together.

    Updates engine.io from 3.2.1 to 6.2.1

    Release notes

    Sourced from engine.io's releases.

    6.2.1

    :warning: This release contains an important security fix :warning:

    A malicious client could send a specially crafted HTTP request, triggering an uncaught exception and killing the Node.js process:

    Error: read ECONNRESET
        at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
    Emitted 'error' event on Socket instance at:
        at emitErrorNT (internal/streams/destroy.js:106:8)
        at emitErrorCloseNT (internal/streams/destroy.js:74:3)
        at processTicksAndRejections (internal/process/task_queues.js:80:21) {
      errno: -104,
      code: 'ECONNRESET',
      syscall: 'read'
    }
    

    Please upgrade as soon as possible.

    Bug Fixes

    • catch errors when destroying invalid upgrades (#658) (425e833)

    6.2.0

    Features

    • add the "maxPayload" field in the handshake details (088dcb4)

    So that clients in HTTP long-polling can decide how many packets they have to send to stay under the maxHttpBufferSize value.

    This is a backward compatible change which should not mandate a new major revision of the protocol (we stay in v4), as we only add a field in the JSON-encoded handshake data:

    0{"sid":"lv_VI97HAXpY6yYWAAAC","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000,"maxPayload":1000000}
    

    Links

    6.1.3

    Bug Fixes

    • typings: allow CorsOptionsDelegate as cors options (#641) (a463d26)
    • uws: properly handle chunked content (#642) (3367440)

    ... (truncated)

    Changelog

    Sourced from engine.io's changelog.

    6.2.1 (2022-11-20)

    :warning: This release contains an important security fix :warning:

    A malicious client could send a specially crafted HTTP request, triggering an uncaught exception and killing the Node.js process:

    Error: read ECONNRESET
        at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
    Emitted 'error' event on Socket instance at:
        at emitErrorNT (internal/streams/destroy.js:106:8)
        at emitErrorCloseNT (internal/streams/destroy.js:74:3)
        at processTicksAndRejections (internal/process/task_queues.js:80:21) {
      errno: -104,
      code: 'ECONNRESET',
      syscall: 'read'
    }
    

    Please upgrade as soon as possible.

    Bug Fixes

    • catch errors when destroying invalid upgrades (#658) (425e833)

    3.6.0 (2022-06-06)

    Bug Fixes

    Features

    • decrease the default value of maxHttpBufferSize (58e274c)

    This change reduces the default value from 100 mb to a more sane 1 mb.

    This helps protect the server against denial of service attacks by malicious clients sending huge amounts of data.

    See also: https://github.com/advisories/GHSA-j4f2-536g-r55m

    • increase the default value of pingTimeout (f55a79a)

    ... (truncated)

    Commits
    • 24b847b chore(release): 6.2.1
    • 425e833 fix: catch errors when destroying invalid upgrades (#658)
    • 99adb00 chore(deps): bump xmlhttprequest-ssl and engine.io-client in /examples/latenc...
    • d196f6a chore(deps): bump minimatch from 3.0.4 to 3.1.2 (#660)
    • 7c1270f chore(deps): bump nanoid from 3.1.25 to 3.3.1 (#659)
    • 535a01d ci: add Node.js 18 in the test matrix
    • 1b71a6f docs: remove "Vanilla JS" highlight from README (#656)
    • 917d1d2 refactor: replace deprecated String.prototype.substr() (#646)
    • 020801a chore: add changelog for version 3.6.0
    • ed1d6f9 test: make test script work on Windows (#643)
    • Additional commits viewable in compare view

    Updates karma from 4.4.1 to 6.4.1

    Release notes

    Sourced from karma's releases.

    v6.4.1

    6.4.1 (2022-09-19)

    Bug Fixes

    v6.4.0

    6.4.0 (2022-06-14)

    Features

    • support SRI verification of link tags (dc51a2e)
    • support SRI verification of script tags (6a54b1c)

    v6.3.20

    6.3.20 (2022-05-13)

    Bug Fixes

    • prefer IPv4 addresses when resolving domains (e17698f), closes #3730

    v6.3.19

    6.3.19 (2022-04-19)

    Bug Fixes

    • client: error out when opening a new tab fails (099b85e)

    v6.3.18

    6.3.18 (2022-04-13)

    Bug Fixes

    • deps: upgrade socket.io to v4.4.1 (52a30bb)

    v6.3.17

    6.3.17 (2022-02-28)

    Bug Fixes

    • deps: update colors to maintained version (#3763) (fca1884)

    v6.3.16

    ... (truncated)

    Changelog

    Sourced from karma's changelog.

    6.4.1 (2022-09-19)

    Bug Fixes

    6.4.0 (2022-06-14)

    Features

    • support SRI verification of link tags (dc51a2e)
    • support SRI verification of script tags (6a54b1c)

    6.3.20 (2022-05-13)

    Bug Fixes

    • prefer IPv4 addresses when resolving domains (e17698f), closes #3730

    6.3.19 (2022-04-19)

    Bug Fixes

    • client: error out when opening a new tab fails (099b85e)

    6.3.18 (2022-04-13)

    Bug Fixes

    • deps: upgrade socket.io to v4.4.1 (52a30bb)

    6.3.17 (2022-02-28)

    Bug Fixes

    • deps: update colors to maintained version (#3763) (fca1884)

    6.3.16 (2022-02-10)

    Bug Fixes

    • security: mitigate the "Open Redirect Vulnerability" (ff7edbb)

    ... (truncated)

    Commits
    • 0013121 chore(release): 6.4.1 [skip ci]
    • 63d86be fix: pass integrity value
    • 84f7cc3 chore(release): 6.4.0 [skip ci]
    • f2d0663 docs: add integrity parameter
    • dc51a2e feat: support SRI verification of link tags
    • 6a54b1c feat: support SRI verification of script tags
    • 5e71cf5 chore(release): 6.3.20 [skip ci]
    • e17698f fix: prefer IPv4 addresses when resolving domains
    • 60f4f79 build: add Node 16 and 18 to the CI matrix
    • 6ff5aaf chore(release): 6.3.19 [skip ci]
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump loader-utils and html-webpack-plugin

    Bump loader-utils and html-webpack-plugin

    Bumps loader-utils to 1.4.2 and updates ancestor dependency html-webpack-plugin. These dependencies need to be updated together.

    Updates loader-utils from 1.2.3 to 1.4.2

    Release notes

    Sourced from loader-utils's releases.

    v1.4.2

    1.4.2 (2022-11-11)

    Bug Fixes

    v1.4.1

    1.4.1 (2022-11-07)

    Bug Fixes

    v1.4.0

    1.4.0 (2020-02-19)

    Features

    • the resourceQuery is passed to the interpolateName method (#163) (cd0e428)

    v1.3.0

    1.3.0 (2020-02-19)

    Features

    • support the [query] template for the interpolatedName method (#162) (469eeba)
    Changelog

    Sourced from loader-utils's changelog.

    1.4.2 (2022-11-11)

    Bug Fixes

    1.4.1 (2022-11-07)

    Bug Fixes

    1.4.0 (2020-02-19)

    Features

    • the resourceQuery is passed to the interpolateName method (#163) (cd0e428)

    1.3.0 (2020-02-19)

    Features

    • support the [query] template for the interpolatedName method (#162) (469eeba)

    Commits

    Updates html-webpack-plugin from 3.2.0 to 5.5.0

    Changelog

    Sourced from html-webpack-plugin's changelog.

    5.5.0 (2021-10-25)

    Features

    • Support type=module via scriptLoading option (1e42625), closes #1663

    5.4.0 (2021-10-15)

    Features

    5.3.2 (2021-06-22)

    Bug Fixes

    • update lodash and pretty error (9c7fba0

    5.3.1 (2021-03-09)

    Bug Fixes

    • remove loader-utils from plugin core (82d0ee8)

    5.3.0 (2021-03-07)

    Features

    • allow to modify the interpolation options in webpack config (d654f5b)
    • drop loader-utils dependency (41d7a50)

    5.2.0 (2021-02-19)

    Features

    5.1.0 (2021-02-12)

    Features

    • omit html tag attribute with null/undefined/false value (aa6e78d), closes #1598

    5.0.0 (2021-02-03)

    ... (truncated)

    Commits
    • 873d75b chore(release): 5.5.0
    • ddeb774 chore: update examples
    • 1e42625 feat: Support type=module via scriptLoading option
    • 7d3645b Bump pretty-error to 4.0.0 to fix transitive vuln for ansi-regex CVE-2021-3807
    • 79be779 [chore] changes actions to run on pull_requests
    • b7e5859 [chore] fixes CI to avoid race conditions
    • 48131d3 chore(release): 5.4.0
    • 16a841a [chore] rebuild examples
    • 3bb7c17 Update index.js
    • e38ac97 Update index.js
    • Additional commits viewable in compare view
    Maintainer changes

    This version was pushed to npm by jantimon, a new releaser for html-webpack-plugin since your current version.


    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(2.0.4)
  • 2.0.4(Sep 1, 2018)

    • Fixed setting focus on unfocused input on mask change in Safari (Thanks to @ngryman, #154)
    • Fixed cursor jump on delayed mask or value change
    • Fixed broken compatibility with IE8
    Source code(tar.gz)
    Source code(zip)
  • 2.0.3(Aug 6, 2018)

  • 2.0.2(Jun 12, 2018)

  • 2.0.1(May 22, 2018)

  • 2.0.0(May 22, 2018)

    • Fixed compatibility with StrictMode in React 16.3 and future React releases (due to deprecation of componentWillReceiveProps)
    • Added beforeMaskedValueChange property to allow to implement custom masking logic
    • Added support for children function to render another component instead of regular input
    • Removed ES module to avoid confusion with default import in some environments
    • Dropped support for React 0.13
    • Minor fixes (look at the beta changelog for more details)
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0-beta.4(May 17, 2018)

  • 2.0.0-beta.3(May 15, 2018)

    • Fixed transition between masked and non-masked state
    • Added support for children function to render another component instead of regular input
    • Dropped support for React 0.13
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0-beta.2(May 11, 2018)

  • 2.0.0-beta.1(May 10, 2018)

  • 2.0.0-beta.0(May 10, 2018)

    • Fixed deprecation warning in future React 16.4 (replaced componentWillReceiveProps with componentDidUpdate)
    • Removed ES module to avoid confusion with default import in some environments
    • Added beforeMaskedValueChange property to allow to implement custom masking logic
    • Log error into console if maxLength property is defined on masked input (#128)
    • Fixed cimoatibility with IE8 (why drop legacy if it's easy to support)
    • Fixed cursor position after deleting range that includes mask prefix
    • Fixed cursor position on backspace over permanent character on platforms with broken keydown event
    • Fixed inconsistent behavior between typing and pasting the same character over mask prefix
    • A lot of refactoring (thanks to @TrySound)
    Source code(tar.gz)
    Source code(zip)
  • 1.2.2(Feb 12, 2018)

  • 1.2.1(Feb 9, 2018)

  • 1.2.0(Feb 8, 2018)

  • 1.1.2(Jan 15, 2018)

  • 1.1.1(Jan 12, 2018)

  • 1.1.0(Dec 14, 2017)

    • Prevent unintentional cursor move on focus (#108)
    • Fix paste over selected text (#106)
    • Fix paste into empty input without maskChar if pasted text didn't require formatting
    • Upgrade to Babel 7
    Source code(tar.gz)
    Source code(zip)
  • 1.0.7(Jul 24, 2017)

    • CommonJS import no longer requires default property (i.e. const InputMask = require('react-input-mask') instead of const InputMask = require('react-input-mask').default)
    Source code(tar.gz)
    Source code(zip)
  • 1.0.6(Jul 14, 2017)

  • 1.0.5(Jul 6, 2017)

  • 1.0.4(Jul 6, 2017)

  • 1.0.3(Jul 4, 2017)

  • 1.0.2(Jun 28, 2017)

  • 1.0.1(Jun 28, 2017)

  • 1.0.0(Jun 28, 2017)

    Refactoring.

    • Only actual changes are tracked now, so you can prevent them with call to preventDefault in onKeyDown or onPaste handlers.
    • Fix crash on unmount after onChange on Android (#89)
    • Call to onPaste handler if provided (#91)
    Source code(tar.gz)
    Source code(zip)
  • 0.9.1(Jun 11, 2017)

  • 0.9.0(Jun 9, 2017)

  • 0.8.2(Jun 8, 2017)

  • 0.8.1(Jun 6, 2017)

  • 0.8.0(Apr 13, 2017)

    Since this version support for React 0.12 is dropped.

    • Fixed deprecation warnings in React 15.5
    • Better compatibility with Windows Phone (#78)
    Source code(tar.gz)
    Source code(zip)
  • 0.7.9(Mar 30, 2017)

Owner
Nikita Lobachev
Nikita Lobachev
React Input Format & Mask, tiny (≈800b) component to transform any input component into formatted or masked input. Supports number, date, phone, currency, credit card, etc

RIFM - React Input Format & Mask Is a tiny (≈ 800b) component (and hook) to transform any input component into formatted or masked input. Demo Highlig

RealAdvisor 1.3k Dec 13, 2022
Masked input React component

MaskedInput A React component for input masking, built on top of inputmask-core. Live Demo Install npm npm install react-maskedinput --save Browser

Jonny Buchanan 721 Nov 30, 2022
React Currency Input Field Component

React Currency Input Field Component

Chun 357 Dec 30, 2022
Headless phone number input component for React. Because phone numbers are hard.

React Headless Phone Input A headless phone number input component built for usability. Phone numbers are hard. Users expect to be able to enter phone

Ben Aubin 26 Nov 16, 2022
A fully customizable, one-time password input component for the web built with React.

react-otp-input A fully customizable, one-time password input component for the web built with React. Live Demo CodeSandbox Installation To install th

Devfolio 402 Dec 30, 2022
React component that handles csv file input and its parsing

react-csv-reader React component that handles csv file input. It handles file input and returns its content as a matrix. Docs: nzambello.github.io/rea

Nicola Zambello 180 Dec 26, 2022
React component for international phone number input

react-phone-number-input International phone number input for React. See Demo Install npm install react-phone-number-input --save If you're not us

Nikolay 837 Dec 21, 2022
Time-input - A keyboard friendly react component for capturing time

time-input A keyboard friendly react component for capturing time features small UI surface area (just a form input) keyboard friendly (can type times

Alan Clarke 28 Jun 6, 2019
A fully customizable, one-time password input component for the web built with React

block-code A fully customizable, one-time password input component for the web built with React Live demo Highlights Easy to use Fully customizable Re

EUI Official 9 Sep 5, 2022
International phone number input component for react

Welcome to react-contact-number-input ?? International phone number input component for react Install npm install react-contact-number-input Author ??

Vaibhav Gurnani 15 Nov 9, 2022
A ReactJS component that allows for multiple text field input, built using the FluentUI library

A ReactJS component that allows for multiple text field input, built using the FluentUI library

Boia Alexandru 1 Sep 22, 2021
A ReactJS input component that manages multiple languages

React-translatable-input A ReactJS input component that manages multiple languages. $ npm install --save react-translatable-input Demo http://belkalab

Belka 26 Jun 17, 2022
A React Hook & Container to help with payment card input fields.

React Payment Inputs A React Hook & Container to help with payment card input fields. React Payment Inputs Demos Requirements Installation Usage With

medipass 303 Dec 22, 2022
Input mask for React, Angular, Ember, Vue, & plain JavaScript

⚠️ This library is not maintained. Pull-requests and issues are not monitored. Alternatives to text-mask include: https://github.com/uNmAnNeR/imaskjs

Text Mask 8.2k Jan 2, 2023
Input mask for React, Angular, Ember, Vue, & plain JavaScript

Text Mask is an input mask library. It can create input masks for phone, date, currency, zip code, percentage, email, and literally anything!

Text Mask 8.2k Jan 4, 2023
An input of type password implemented with React and TypeScript

An input of type password implemented with React and TypeScript

null 2 Nov 6, 2021
Numeric input control with step buttons for Semantic UI React

Numeric input control with step buttons for Semantic UI React

Petri Silen 11 Dec 14, 2022
React Individual Character Input Boxes

react-individual-character-input-boxes React Individual Character Input Boxes (RICIBs) are individual inputs that are separate from each other but fun

Danny Radden 26 Dec 13, 2022
Rewrite International Telephone Input in React.js

Rewrite International Telephone Input in React.js. (Looking for maintainers, and PRs & contributors are also welcomed!)

Patrick Wang 273 Nov 24, 2022