0.0.5 • Published 5 years ago

maskose-react v0.0.5

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

Table of contents

Requirements

This packages requires react@16.8 and react-dom@16.8. That's because it uses hooks under the hood, even though everything could be done with class-based components. If you need support for a version prior than the one with hooks, please open an issue.

Installation

yarn add maskose maskose-react

or with npm:

npm install maskose maskose-react

Components

MaskoseInput

Prop nameTypeDescription
maskMaskoseMaskThe mask to be used when masking the value.
maskedValuestringThe current masked value (the value in the input).
onMaskedValueChange(maskedValue: string) => voidCallback that will be called every time the masked value (input value) changes.

Examples

const priceMask = mkBoostMask(
  mkCreate([
    mkCharBoostRepeat(3)(mkCharNum()),
    mkCharToBePut('.'),
    mkCharBoostRepeat(2)(mkCharNum()),
  ])
)([
  mkMaskBoostRightToLeft()
]);

function Form() {
  const [price, setPrice] = useState('');

  return (
    <>
      <MaskoseInput
        mask={priceMask}
        maskedValue={price}
        onMaskedValueChange={setPrice}
      />
    </>
  );
}

Docs

If you're looking for the docs of the maskose lib, you can find them here.

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago