Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
e111d71
Migrate build process to nwb
bpugh Feb 14, 2016
c093bf1
fixed so masked input works with chrome auto-fill and on paste
Oct 21, 2015
266ece1
Use eslint instead of jshint
bpugh Feb 14, 2016
199e190
Update Readme with new build process
bpugh Feb 14, 2016
4b8790d
Update to nwb 0.8.0
bpugh Mar 7, 2016
1af8458
Merge pull request #31 from bpugh/nwb
iamdustan Mar 8, 2016
6424953
Remove unused files
bpugh Mar 8, 2016
89c76ec
Merge pull request #34 from bpugh/file-cleanup
iamdustan Mar 8, 2016
eff2ae6
Prepare for 3.1.1
iamdustan Mar 9, 2016
7496600
3.1.1
iamdustan Mar 9, 2016
8003924
Update demo to build with nwb
bpugh Mar 10, 2016
6a5f75d
Merge pull request #37 from bpugh/update-demo
iamdustan Mar 10, 2016
898a14a
Updating React and ReactDOM dependencies to v15; allowing minor and p…
Apr 8, 2016
fc712ea
Merge pull request #44 from thathenderson/update-to-react-15
iamdustan Apr 11, 2016
36eb948
v3.1.1 changelist
iamdustan Apr 11, 2016
cd97d3e
3.1.2
iamdustan Apr 11, 2016
47f45f6
Update nwb dependency to 0.9.x
bpugh Apr 30, 2016
6fe8e7e
Merge pull request #50 from bpugh/update-nwb
iamdustan May 2, 2016
d9ac7a0
Call this.props.onChange only if it's defined (#39)
ar7n May 2, 2016
1c698bc
v3.1.3
iamdustan May 2, 2016
61e395b
Init tests (#51)
iamdustan May 2, 2016
d78f89b
Proxy focus and blur methos (#52)
vslinko May 20, 2016
aee2ccf
Add support for updating the `mask`. Fixes #8
martyphee May 24, 2016
00511e5
Merge pull request #53 from martyphee/fix-mask-changes
jquense May 24, 2016
ed48086
v3.2.0
jquense May 24, 2016
bab325f
Fix issue #61, remove react warning (#62)
Heymdall Jul 20, 2016
fc42440
flint on posttest. fix lint (#63)
iamdustan Jul 20, 2016
65dd7b6
3.2.1
iamdustan Jul 20, 2016
4da17a8
3.2.2
iamdustan Jul 22, 2016
b2b37ca
update new patterns before new values to prevent leftover placeholder…
hunterc Jul 27, 2016
a2ba36f
3.2.3
iamdustan Jul 27, 2016
9367fe0
add conditional for mask and value changing at same time (#66)
hunterc Aug 9, 2016
f690087
3.2.4
iamdustan Aug 9, 2016
eda4e4c
Use onBeforeInput so Chrome for Android works. Fix #19 (#47)
Aug 29, 2016
50d0da3
v3.3.0-beta.1
iamdustan Aug 29, 2016
ae57dc2
Replace npmcdn.com with unpkg.com (#68)
npmcdn-to-unpkg-bot Aug 31, 2016
3898d50
v3.3.0
iamdustan Oct 10, 2016
ebb9d75
removed react internals
alexeybondarenko Nov 2, 2016
8b5629a
lint fix
alexeybondarenko Nov 2, 2016
8da370c
fixed by eslint
alexeybondarenko Nov 2, 2016
e39c44f
Issue #73: remove react internals (#74)
iamdustan Nov 14, 2016
821048e
Make smokescreen test resilient to 15.4 error message change
iamdustan Nov 22, 2016
ad934c3
3.3.1
iamdustan Nov 22, 2016
fa0b07e
Can't enter more than one character in Edge browser (#79)
Dec 1, 2016
d6155cd
3.3.2
iamdustan Dec 1, 2016
55c1b76
v3.3.2 changelog
iamdustan Dec 1, 2016
e37eba9
3.3.3
iamdustan Dec 1, 2016
e31d323
Changelog: fix typo (#81)
avindra Dec 12, 2016
ffae092
Silence React 15.4 invalid property warnings (#80)
nathanstitt Dec 12, 2016
16990c1
add check for navigator (#83)
aesopwolf Dec 15, 2016
8f3701d
3.3.4
iamdustan Dec 15, 2016
643e7ee
Merge remote-tracking branch 'upstream/master' into fix-paste-autofill
aesopwolf Dec 16, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": ["standard", "standard-react"],
"rules": {
"brace-style": [2, "stroustrup", {"allowSingleLine": true}],
"eqeqeq": [2, "smart"],
"jsx-quotes": [2, "prefer-double"],
"react/prop-types": 0,
"react/self-closing-comp": 0,
"react/wrap-multilines": 0,
"space-before-function-paren": 0
},
"parser": "babel-eslint"
}
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
lib/
node_modules/
/coverage
/demo/dist
/es6
/lib
/node_modules
/umd
npm-debug.log
24 changes: 0 additions & 24 deletions .jshintrc

This file was deleted.

7 changes: 0 additions & 7 deletions .npmignore

This file was deleted.

5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- "4"
- "5"
script: npm test
25 changes: 24 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
## 3.1.0 / 2015-10-23
## 3.3.2 / 2016-12-01

* Fix for both Android and MS Edge input entering

## 3.2.0 / 2016-05-24

* Allow dynamic pattern updating [[martyphee][martyphee]]

## 3.1.3 / 2016-05-02

* Don’t call `onChange` function if undefined.
* Update nwb to 0.9.x

## 3.1.2 / 2016-04-11

* Support for React 15.x.x

## 3.1.1 / 2016-03-09

* Convert tooling to use [nwb](https://github.com/insin/nwb/) [[bpugh]][[bpugh]]
* Publish `dist` files

## 3.1.0 / 2016-02-11

* Added support for `value` behaving as a controlled component.

Expand Down Expand Up @@ -46,3 +68,4 @@ Initial release features:

[jquense]: https://github.com/jquense
[muffinresearch]: https://github.com/muffinresearch
[martyphee]: https://github.com/martyphee
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Prerequisites

[Node.js](http://nodejs.org/) must be installed.

## Installation

* Running `npm install` in the components's root directory will install everything you need for development.

## Demo Development Server

* `npm start` will run a development server with the component's demo app at [http://localhost:3000](http://localhost:3000) with hot module reloading.

## Running Tests

* `npm test` will run the tests once.
* `npm run test:watch` will run the tests on every change.

## Building

* `npm run build` will build the component for publishing to npm and also bundle the demo app.

* `npm run clean` will delete built resources.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ npm install react-maskedinput --save

The browser bundle exposes a global `MaskedInput` variable and expects to find a global `React` (>= 0.14.0) variable to work with.

You can find it in the [/dist directory](https://github.com/insin/react-maskedinput/tree/master/dist).
* [react-maskedinput.js](https://unpkg.com/react-maskedinput/umd/react-maskedinput.js) (development version)
* [react-maskedinput.min.js](https://unpkg.com/react-maskedinput/umd/react-maskedinput.min.js) (compressed production version)

## Usage

Expand Down
103 changes: 36 additions & 67 deletions demo/index.html → demo/src/index.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,18 @@
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>react-maskedinput Demo</title>
<script src="http://fb.me/react-0.14.0.js"></script>
<script src="http://fb.me/react-dom-0.14.0.js"></script>
<script src="http://fb.me/JSXTransformer-0.13.3.js"></script>
<script src="../dist/react-maskedinput.js"></script>
<style>
body {
box-sizing: border-box;
width: 550px;
margin: 1em auto;
padding: 0 1em;
font-family: sans-serif;
}
code {
font-size: 1.3em;
}
h1 {
font-size: 3em;
text-align: center;
margin-top: 0;
}
p.lead {
font-weight: bold;
text-align: center;
}
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #222;
}
.form-field {
margin-bottom: .5em;
}
label {
display: inline-block;
width: 7em;
text-align: right;
margin-right: .75em;
}
input {
border: none;
font-size: 1.5em;
}
footer {
text-align: center;
}
</style>
</head>
<body>
<div id="app"></div>
<script type="text/jsx;harmony=true">void function() { 'use strict'
import './style.css'

import React from 'react'
import {render} from 'react-dom'

var PATTERNS = [
import MaskedInput from '../../src'

const PATTERNS = [
'1111 1111',
'111 111',
'11 11',
'1 1'
]

var App = React.createClass({
const App = React.createClass({
getInitialState() {
return {
card: '',
Expand All @@ -72,12 +23,14 @@
leading: '',
custom: '',
changing: '',
pattern: '1111 1111'
phone: '',
pattern: '1111 1111',
cardPattern: '1111 1111 1111 1111'
}
},

_onChange(e) {
var stateChange = {}
const stateChange = {}
stateChange[e.target.name] = e.target.value
this.setState(stateChange)
},
Expand All @@ -86,9 +39,19 @@
this.setState({pattern: e.target.value})
},

_onCardChange(e) {
if(/^3[47]/.test(e.target.value)) {
this.setState({cardPattern: "1111 111111 11111"})
} else {
this.setState({cardPattern: '1111 1111 1111 1111'})
}
},

render() {
return <div className="App">
<h1><code>&lt;<a href="https://github.com/insin/react-maskedinput">MaskedInput</a>/&gt;</code></h1>
<h1>
<code>&lt;<a href="https://github.com/insin/react-maskedinput">MaskedInput</a>/&gt;</code>
</h1>
<p className="lead">A React component which creates a masked <code>&lt;input/&gt;</code></p>
<div className="form-field">
<label htmlFor="card">Card Number:</label>
Expand All @@ -112,6 +75,10 @@ <h1><code>&lt;<a href="https://github.com/insin/react-maskedinput">MaskedInput</
<label htmlFor="plate">License Plate:</label>
<MaskedInput mask="AAA 1111" name="plate" id="plate" onChange={this._onChange} placeholder="ABC 1234"/>
</div>
<div className="form-field">
<label htmlFor="phone">Phone Number:</label>
<MaskedInput mask="(111) 111-1111" name="phone" id="phone" onChange={this._onChange} placeholder="(999) 999-9999"/>
</div>
<p>Mask placeholder characters can be escaped with a leading <code>\</code> to use them as static contents:</p>
<div className="form-field">
<label htmlFor="escaped">Escaped:</label>
Expand All @@ -130,9 +97,14 @@ <h1><code>&lt;<a href="https://github.com/insin/react-maskedinput">MaskedInput</
<div className="form-field">
<label htmlFor="pattern">Pattern:</label>
<select onChange={this._changePattern}>
{PATTERNS.map(pattern => <option value={pattern}>{pattern}</option>)}
{PATTERNS.map(pattern => <option value={pattern} key={pattern}>{pattern}</option>)}
</select>
</div>
<p>Dynamically changing the pattern as the user types:</p>
<div className="form-field">
<label htmlFor="changing">Credit Card:</label>
<MaskedInput mask={this.state.cardPattern} name="creditCard" id="creditCard" onChange={this._onCardChange}/>
</div>
<p>Custom format character (W=[a-zA-Z0-9_], transformed to uppercase) and placeholder character (en space):</p>
<div className="form-field">
<label htmlFor="custom">Custom:</label>
Expand All @@ -146,7 +118,7 @@ <h1><code>&lt;<a href="https://github.com/insin/react-maskedinput">MaskedInput</
}
})

var CustomInput = React.createClass({
const CustomInput = React.createClass({
render() {
return <MaskedInput
mask="1111-WW-11"
Expand All @@ -156,15 +128,12 @@ <h1><code>&lt;<a href="https://github.com/insin/react-maskedinput">MaskedInput</
{...this.props}
formatCharacters={{
'W': {
validate(char) { return /\w/.test(char ) },
validate(char) { return /\w/.test(char) },
transform(char) { return char.toUpperCase() }
}
}
}/>
}
})

ReactDOM.render(<App/>, document.getElementById('app'))

}()</script>
</body>
render(<App/>, document.getElementById('demo'))
41 changes: 41 additions & 0 deletions demo/src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
body {
box-sizing: border-box;
width: 550px;
margin: 1em auto;
padding: 0 1em;
font-family: sans-serif;
}
code {
font-size: 1.3em;
}
h1 {
font-size: 3em;
text-align: center;
margin-top: 0;
}
p.lead {
font-weight: bold;
text-align: center;
}
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #222;
}
.form-field {
margin-bottom: .5em;
}
label {
display: inline-block;
width: 7em;
text-align: right;
margin-right: .75em;
}
input {
border: none;
font-size: 1.5em;
}
footer {
text-align: center;
}
Loading