This repository was archived by the owner on Jul 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from schneidmaster/react-bootstrap-1
Support react-bootstrap 1.0
- Loading branch information
Showing
15 changed files
with
4,858 additions
and
2,383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,9 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true | ||
}, | ||
"extends": ["eslint:recommended", "plugin:react/recommended"], | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"plugins": [ | ||
"react" | ||
"extends": [ | ||
"standard", | ||
"standard-react", | ||
"prettier/standard", | ||
"plugin:prettier/recommended" | ||
], | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"object-curly-spacing": [ | ||
"error", | ||
"always" | ||
] | ||
} | ||
"parser": "babel-eslint" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
coverage/ | ||
lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ["@babel/preset-env", "@babel/preset-react"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { FormGroup, ControlLabel } from 'react-bootstrap'; | ||
import MaskedFormControl from '../src'; | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import { Form } from "react-bootstrap"; | ||
import MaskedFormControl from "../src"; | ||
|
||
const Example = () => { | ||
return ( | ||
<div className='container'> | ||
<div className="container"> | ||
<h1>Example</h1> | ||
|
||
<FormGroup> | ||
<ControlLabel>Phone Number</ControlLabel> | ||
<MaskedFormControl type='text' name='phoneNumber' mask='111-111-1111' /> | ||
</FormGroup> | ||
<Form> | ||
<Form.Group> | ||
<Form.Label>Phone Number</Form.Label> | ||
<MaskedFormControl | ||
type="text" | ||
name="phoneNumber" | ||
mask="111-111-1111" | ||
/> | ||
</Form.Group> | ||
</Form> | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
const rootDiv = document.createElement('div'); | ||
const rootDiv = document.createElement("div"); | ||
document.body.appendChild(rootDiv); | ||
ReactDOM.render(<Example />, rootDiv); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const HtmlWebpackPlugin = require("html-webpack-plugin"); | ||
const HtmlWebpackIncludeAssetsPlugin = require("html-webpack-include-assets-plugin"); | ||
|
||
module.exports = { | ||
entry: "./example/index.js", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
use: "babel-loader", | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin(), | ||
new HtmlWebpackIncludeAssetsPlugin({ | ||
assets: [ | ||
"https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css", | ||
], | ||
append: true, | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
collectCoverage: true, | ||
collectCoverageFrom: ["**/src/**/*.js"], | ||
transform: { | ||
"^.+\\.js?$": "babel-jest", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,7 @@ | ||
import React from 'react'; | ||
import React from "react"; | ||
import MaskedInput from "react-maskedinput"; | ||
import { FormControl } from "react-bootstrap"; | ||
|
||
import MaskedInput from 'react-maskedinput'; | ||
import { FormControl } from 'react-bootstrap'; | ||
|
||
export default class MaskedFormControl extends FormControl { | ||
render() { | ||
const props = Object.assign({}, this.props, { componentClass: MaskedInput }); | ||
|
||
return React.createElement(FormControl, props); | ||
} | ||
export default function MaskedFormControl(props) { | ||
return <FormControl as={MaskedInput} {...props} />; | ||
} | ||
|
||
// FormControl has a componentClass prop which | ||
// MaskedFormControl always overrides to be a | ||
// MaskedInput. | ||
delete MaskedFormControl.propTypes.componentClass; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Component passes complex props through to FormControl and MaskedInput 1`] = ` | ||
<MaskedFormControl | ||
bsClass="my-form-control" | ||
bsSize="large" | ||
componentClass="input" | ||
id="my-id" | ||
inputRef={[Function]} | ||
mask="111-111-1111" | ||
placeholder="555-555-5555" | ||
size={10} | ||
> | ||
<FormControl | ||
bsClass="my-form-control" | ||
bsSize="large" | ||
componentClass={[Function]} | ||
<div> | ||
<input | ||
bsclass="my-form-control" | ||
bssize="large" | ||
class="form-control form-control-10" | ||
id="my-id" | ||
inputRef={[Function]} | ||
mask="111-111-1111" | ||
maxlength="12" | ||
placeholder="555-555-5555" | ||
size={10} | ||
> | ||
<MaskedInput | ||
className="my-form-control input-lg" | ||
id="my-id" | ||
mask="111-111-1111" | ||
placeholder="555-555-5555" | ||
size={10} | ||
type={undefined} | ||
value="" | ||
> | ||
<input | ||
className="my-form-control input-lg" | ||
id="my-id" | ||
mask="111-111-1111" | ||
maxLength={12} | ||
onChange={[Function]} | ||
onKeyDown={[Function]} | ||
onKeyPress={[Function]} | ||
onPaste={[Function]} | ||
placeholder="555-555-5555" | ||
size={10} | ||
type={undefined} | ||
value="" | ||
/> | ||
</MaskedInput> | ||
</FormControl> | ||
</MaskedFormControl> | ||
size="12" | ||
value="" | ||
/> | ||
</div> | ||
`; | ||
|
||
exports[`Component renders correctly with basic props 1`] = ` | ||
<MaskedFormControl | ||
bsClass="form-control" | ||
componentClass="input" | ||
mask="111-111-1111" | ||
> | ||
<FormControl | ||
bsClass="form-control" | ||
componentClass={[Function]} | ||
<div> | ||
<input | ||
class="form-control" | ||
mask="111-111-1111" | ||
> | ||
<MaskedInput | ||
className="form-control" | ||
id={undefined} | ||
mask="111-111-1111" | ||
type={undefined} | ||
value="" | ||
> | ||
<input | ||
className="form-control" | ||
id={undefined} | ||
mask="111-111-1111" | ||
maxLength={12} | ||
onChange={[Function]} | ||
onKeyDown={[Function]} | ||
onKeyPress={[Function]} | ||
onPaste={[Function]} | ||
placeholder="___-___-____" | ||
size={12} | ||
type={undefined} | ||
value="" | ||
/> | ||
</MaskedInput> | ||
</FormControl> | ||
</MaskedFormControl> | ||
maxlength="12" | ||
placeholder="___-___-____" | ||
size="12" | ||
value="" | ||
/> | ||
</div> | ||
`; |
Oops, something went wrong.