How to use react-text-mask - 5 common examples

To help you get started, we’ve selected a few react-text-mask 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 codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / component / location-new / inputs / masked-text-field.js View on Github external
* Copyright (c) Codice Foundation
 *
 * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
 * General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details. A copy of the GNU Lesser General Public License
 * is distributed along with this program and can be found at
 * .
 *
 **/
const React = require('react')
const Group = require('../../../react-component/group/index.js')
const MaskedInput = require('react-text-mask').default
const CustomElements = require('../../../js/CustomElements.js')
const Component = CustomElements.registerReact('text-field')

class MaskedTextField extends React.Component {
  render() {
    // eslint-disable-next-line no-unused-vars
    const { label, addon, onChange, value = '', ...args } = this.props
    return (
      
        
          {label != null ? (
            <span>
              {label}
              &nbsp;
            </span>
          ) : null}
github catho / quantum / components / TextMask / TextMask.jsx View on Github external
render() {
    const { children, text, mask } = this.props;
    const input = text || children;

    return mask ? conformToMask(input, mask).conformedValue : input;
  }
}
github redgeoff / mson-react / src / mson / fields / text-field.js View on Github external
_conformToMask(value, mask) {
    var conformed = conformToMask(value, mask, {
      guide: false
    });
    return conformed.conformedValue;
  }
github htmlburger / carbon-fields / assets / js / fields / validators / masked.js View on Github external
export function handler(field) {
	const { mask, value, maskPlaceholder } = field;
	const result = conformToMask(value, mask, { placeholderChar: maskPlaceholder });
	if ( result.conformedValue.indexOf(maskPlaceholder) > -1 ) {
		return carbonFieldsL10n.field.wrongMask;
	}

	return null;
}

react-text-mask

React input component that accepts mask pattern

Unlicense
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis