# coffeekraken-s-input-mask-component

> Provide a simple efficient webcomponent wrapper around the amazing imaskjs library

Latest version **1.0.2** (published 2019-01-02) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install coffeekraken-s-input-mask-component
pnpm add coffeekraken-s-input-mask-component
yarn add coffeekraken-s-input-mask-component
bun add coffeekraken-s-input-mask-component
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-01-02 |
| First published | 2018-09-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 1.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Coffeekraken |
| Maintainers | coffeekraken |
| Keywords | input, mask, imaskjs, webcomponent, component, html, sugar, coffee, kraken, coffeekraken |

## Links

- npm: https://www.npmjs.com/package/coffeekraken-s-input-mask-component
- Repository: https://github.com/coffeekraken/s-input-mask-component
- Homepage: http://coffeekraken.io
- Issues: https://github.com/coffeekraken/s-input-mask-component/issues
- npm.io page: https://npm.io/package/coffeekraken-s-input-mask-component

## Dependencies (5)

- [imask](https://npm.io/package/imask.md) ^3.4.0
- [coffeekraken-sugar](https://npm.io/package/coffeekraken-sugar.md) ^1.0.34
- [coffeekraken-s-form-component](https://npm.io/package/coffeekraken-s-form-component.md) ^1.0.3
- [coffeekraken-s-button-component](https://npm.io/package/coffeekraken-s-button-component.md) ^1.0.1
- [coffeekraken-s-validator-component](https://npm.io/package/coffeekraken-s-validator-component.md) ^1.0.6

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-01-02
- 1.0.1 — 2018-09-06
- 1.0.0 — 2018-09-06

## README

# Coffeekraken s-input-mask-component <img src=".resources/coffeekraken-logo.jpg" height="25px" />

<p>
	<!-- <a href="https://travis-ci.org/coffeekraken/s-input-mask-component">
		<img src="https://img.shields.io/travis/coffeekraken/s-input-mask-component.svg?style=flat-square" />
	</a> -->
	<a href="https://www.npmjs.com/package/coffeekraken-s-input-mask-component">
		<img src="https://img.shields.io/npm/v/coffeekraken-s-input-mask-component.svg?style=flat-square" />
	</a>
	<a href="https://github.com/coffeekraken/s-input-mask-component/blob/master/LICENSE.txt">
		<img src="https://img.shields.io/npm/l/coffeekraken-s-input-mask-component.svg?style=flat-square" />
	</a>
	<!-- <a href="https://github.com/coffeekraken/s-input-mask-component">
		<img src="https://img.shields.io/npm/dt/coffeekraken-s-input-mask-component.svg?style=flat-square" />
	</a>
	<a href="https://github.com/coffeekraken/s-input-mask-component">
		<img src="https://img.shields.io/github/forks/coffeekraken/s-input-mask-component.svg?style=social&label=Fork&style=flat-square" />
	</a>
	<a href="https://github.com/coffeekraken/s-input-mask-component">
		<img src="https://img.shields.io/github/stars/coffeekraken/s-input-mask-component.svg?style=social&label=Star&style=flat-square" />
	</a> -->
	<a href="https://twitter.com/coffeekrakenio">
		<img src="https://img.shields.io/twitter/url/http/coffeekrakenio.svg?style=social&style=flat-square" />
	</a>
	<a href="http://coffeekraken.io">
		<img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=flat-square&label=coffeekraken.io&colorB=f2bc2b&style=flat-square" />
	</a>
</p>

Provide a simple efficient webcomponent wrapper around the amazing [imaskjs](https://github.com/uNmAnNeR/imaskjs) library

[![View demo](http://components.coffeekraken.io/assets/img/view-demo.png)](http://components.coffeekraken.io/app/s-input-mask-component)

## Table of content

1. **[Demo](http://components.coffeekraken.io/app/s-input-mask-component)**
2. [Install](#readme-install)
3. [Get Started](#readme-get-started)
4. [Javascript API](doc/js)
5. [Register new masks](#readme-new-masks)
6. [Default masks](#readme-default-masks)
7. [Sugar Web Components Documentation](https://github.com/coffeekraken/sugar/blob/master/doc/webcomponent.md)
8. [Browsers support](#readme-browsers-support)
9. [Code linting](#readme-code-linting)
10. [Contribute](#readme-contribute)
11. [Who are Coffeekraken?](#readme-who-are-coffeekraken)
12. [Licence](#readme-license)

<a name="readme-install"></a>
## Install

```
npm install coffeekraken-s-input-mask-component --save
```

<a name="readme-get-started"></a>
## Get Started

First, import the component into your javascript file like so:

```js
import SInputMaskComponent from 'coffeekraken-s-input-mask-component'
```

Then simply use it inside your html like so:

```html
<input type="text" name="cool-input" required>
<s-input-mask for="cool-input" mask="(0) 000 000 000"></s-input-mask>
```

<a name="readme-new-masks"></a>
## Register new masks

To register a new named mask, here's how to do it:

```js
import SInputMaskComponent from 'coffeekraken-s-input-mask-component'
SInputMaskComponent.registerMask('my-cool-mask', {
  // some imaskjs options here...
  mask: '(0) 000 000 000',
  lazy: false
  // etc...
})
```

> See [imaskjs](https://github.com/uNmAnNeR/imaskjs) documentation

Then simply use it like so:

```html
<input type="text" name="cool-input" required />
<s-input-mask for="cool-input" mask="my-cool-mask"></s-input-mask>
```

<a name="readme-default-masks"></a>
## Default available masks

Their's some default masks available. Here's the list:

- `date:yyyy.mm.dd`
- `date:yyyy-mm-dd`
- `date:yyyy/mm/dd`
- `date:dd.mm.yyyy`
- `date:dd-mm-yyyy`
- `date:dd/mm/yyyy`
- `date:mm.dd.yyyy`
- `date:mm-dd-yyyy`
- `date:mm/dd/yyyy`
- `credit-card:number`
- `credit-card:code`
- `credit-card:date`

<a id="readme-browsers-support"></a>
## Browsers support

| <img src="https://raw.githubusercontent.com/godban/browsers-support-badges/master/src/images/edge.png" alt="IE / Edge" width="16px" height="16px" /></br>IE / Edge | <img src="https://raw.githubusercontent.com/godban/browsers-support-badges/master/src/images/firefox.png" alt="Firefox" width="16px" height="16px" /></br>Firefox | <img src="https://raw.githubusercontent.com/godban/browsers-support-badges/master/src/images/chrome.png" alt="Chrome" width="16px" height="16px" /></br>Chrome | <img src="https://raw.githubusercontent.com/godban/browsers-support-badges/master/src/images/safari.png" alt="Safari" width="16px" height="16px" /></br>Safari |
| --------- | --------- | --------- | --------- |
| IE11+ | last 2 versions| last 2 versions| last 2 versions

> As browsers are automatically updated, we will keep as reference the last two versions of each but this component can work on older ones as well.

> The webcomponent API (custom elements, shadowDOM, etc...) is not supported in some older browsers like IE10, etc... In order to make them work, you will need to integrate the [corresponding polyfill](https://www.webcomponents.org/polyfills).

<a id="readme-code-linting"></a>
##  Code linting

This package uses some code linting rules. Here's the list:

1. [StandardJS](https://standardjs.com/) for javascript files
2. [Stylelint](https://github.com/stylelint/stylelint) with [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard) for `scss` files

> Your commits will not been accepted if the code style is not respected!

<a id="readme-contribute"></a>
## Contribute

This is an open source project and will ever be! You are more that welcomed to contribute to his development and make it more awesome every day.
To do so, you have several possibilities:

1. [Share the love ❤️](https://github.com/Coffeekraken/coffeekraken/blob/master/contribute.md#contribute-share-the-love)
2. [Declare issues](https://github.com/Coffeekraken/coffeekraken/blob/master/contribute.md#contribute-declare-issues)
3. [Fix issues](https://github.com/Coffeekraken/coffeekraken/blob/master/contribute.md#contribute-fix-issues)
4. [Add features](https://github.com/Coffeekraken/coffeekraken/blob/master/contribute.md#contribute-add-features)
5. [Build web component](https://github.com/Coffeekraken/coffeekraken/blob/master/contribute.md#contribute-build-web-component)

<a id="readme-who-are-coffeekraken"></a>
## Who are Coffeekraken

We try to be **some cool guys** that build **some cool tools** to make our (and yours hopefully) **every day life better**.  

#### [More on who we are](https://github.com/Coffeekraken/coffeekraken/blob/master/who-are-we.md)

<a id="readme-license"></a>
## License

The code is available under the [MIT license](LICENSE.txt). This mean that you can use, modify, or do whatever you want with it. This mean also that it is shipped to you for free, so don't be a hater and if you find some issues, etc... feel free to [contribute](https://github.com/Coffeekraken/coffeekraken/blob/master/contribute.md) instead of sharing your frustrations on social networks like an asshole...

---
_Source: https://npm.io/package/coffeekraken-s-input-mask-component · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
