How to use imask - 10 common examples

To help you get started, we’ve selected a few imask examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uNmAnNeR / imaskjs / packages / react-imask / src / imask.mixin.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import IMask from 'imask';

const MASK_PROPS = {
  // common
  mask: PropTypes.oneOfType([
    PropTypes.array,
    PropTypes.func,
    PropTypes.string,
    PropTypes.instanceOf(RegExp),
    PropTypes.oneOf([Date, Number, IMask.Masked]),
    PropTypes.instanceOf(IMask.Masked),
  ]),
  value: PropTypes.any,
  unmask: PropTypes.oneOfType([
    PropTypes.bool,
    PropTypes.oneOf(['typed']),
  ]),
  prepare: PropTypes.func,
  validate: PropTypes.func,
  commit: PropTypes.func,
  overwrite: PropTypes.bool,

  // events
  onAccept: PropTypes.func,
  onComplete: PropTypes.func,
github uNmAnNeR / imaskjs / packages / react-imask / src / imask.mixin.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import IMask from 'imask';

const MASK_PROPS = {
  // common
  mask: PropTypes.oneOfType([
    PropTypes.array,
    PropTypes.func,
    PropTypes.string,
    PropTypes.instanceOf(RegExp),
    PropTypes.oneOf([Date, Number, IMask.Masked]),
    PropTypes.instanceOf(IMask.Masked),
  ]),
  value: PropTypes.any,
  unmask: PropTypes.oneOfType([
    PropTypes.bool,
    PropTypes.oneOf(['typed']),
  ]),
  prepare: PropTypes.func,
  validate: PropTypes.func,
  commit: PropTypes.func,
  overwrite: PropTypes.bool,

  // events
  onAccept: PropTypes.func,
  onComplete: PropTypes.func,

  // pattern
github stone-payments / emerald-web-framework / packages / emd-basic-field / src / helpers / maskMaker.js View on Github external
import iMask from 'imask';

// This monkey patch fixes the way iMask detects if an input is currently
// active since, in our case, we must look for the shadowRoot.activeElement
// and not the document.activeElement.

Object.defineProperty(iMask.HTMLMaskElement.prototype, 'isActive', {
  get () {
    const rootElement = this.input.getRootNode
      ? this.input.getRootNode() || document
      : document;

    return this.input === rootElement.activeElement;
  }
});

export const maskMaker = config => domEl => iMask(domEl, config);
github SUI-Components / sui-components / components / atom / input / src / inputs / MaskInput / index.js View on Github external
componentDidMount () {
    const {mask} = this.props
    this.mask = new IMask(this.field, mask)
  }
github uNmAnNeR / imaskjs / packages / angular-imask / src / imask.directive.ts View on Github external
private initMask () {
    this.maskRef = IMask(this.element, this.imask as Opts)
      .on('accept', this._onAccept.bind(this))
      .on('complete', this._onComplete.bind(this));
  }
github SUI-Components / sui-components / components / atom / input / src / Mask / index.js View on Github external
componentDidMount() {
    const {mask} = this.props
    this.mask = new IMask(this.field, mask)
  }
github uNmAnNeR / imaskjs / packages / vue-imask / src / imask.directive.js View on Github external
function initMask (el, opts) {
  el.maskRef = new IMask(el, opts)
    .on('accept', () => fireEvent(el, 'accept', el.maskRef))
    .on('complete', () => fireEvent(el, 'complete', el.maskRef));
}
github uNmAnNeR / imaskjs / packages / react-imask / src / imask.mixin.js View on Github external
initMask (maskOptions=this._extractMaskOptionsFromProps({...this.props})) {
      this.maskRef = new IMask(this.element, maskOptions)
        .on('accept', this._onAccept.bind(this))
        .on('complete', this._onComplete.bind(this));

      this.maskValue = this.props.value;
    }

imask

vanilla javascript input mask

MIT
Latest version published 7 months ago

Package Health Score

81 / 100
Full package analysis