Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct peer dependencies #63

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 0 additions & 14 deletions dist/index.html

This file was deleted.

42 changes: 17 additions & 25 deletions dist/index.js

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"file-loader": "^0.8.5",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"react-dom": "^15.1.0",
"react-dom": "^16.0.0",
"react-hot-loader": "^1.3.0",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
Expand All @@ -42,14 +42,11 @@
"webpack-merge": "^0.13.0"
},
"dependencies": {
"classnames": "^2.1.5"
"classnames": "^2.2.5"
},
"peerDependencies": {
"lodash": "^4.11.1",
"peerDependencies": {
"lodash": "^4.11.1",
"react": "^15.6.1",
"prop-types": "^15.5.10"
}
"lodash": "^4.17.4",
"prop-types": "^15.5.10",
"react": "^16.0.0"
}
}
47 changes: 31 additions & 16 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,13 @@ class ReactPhoneInput extends React.Component {
// let's insert a dashed line in between preffered countries and the rest
countryDropDownList.splice(this.state.preferredCountries.length, 0, dashedLi);

const dropDownClasses = classNames({
'country-list': true,
'hide': !this.state.showDropDown
});
const dropDownClasses = classNames(
{
'country-list': true,
'hide': !this.state.showDropDown
},
this.props.classNames.countryList,
);

return (
<ul ref="flagDropdownList" className={dropDownClasses}>
Expand All @@ -488,20 +491,26 @@ class ReactPhoneInput extends React.Component {
"arrow": true,
"up": this.state.showDropDown
});
let inputClasses = classNames({
"form-control": true,
"invalid-number": !this.props.isValid(this.state.formattedNumber.replace(/\D/g, ''))
});
let inputClasses = classNames(
{
"form-control": true,
"invalid-number": !this.props.isValid(this.state.formattedNumber.replace(/\D/g, ''))
},
this.props.classNames.input,
);

let flagViewClasses = classNames({
"flag-dropdown": true,
"open-dropdown": this.state.showDropDown
});
let flagViewClasses = classNames(
{
"flag-dropdown": true,
"open-dropdown": this.state.showDropDown
},
this.props.classNames.flagView,
);

let inputFlagClasses = `flag ${this.state.selectedCountry.iso2}`;

return (
<div className={classNames('react-tel-input', this.props.classNames, this.props.className)}>
<div className={classNames('react-tel-input', this.props.classNames.root, this.props.className)}>
<input
placeholder="+1 (702) 123-4567"
onChange={this.handleInput}
Expand All @@ -517,7 +526,12 @@ class ReactPhoneInput extends React.Component {
<div ref="flagDropDownButton" className={flagViewClasses} onKeyDown={this.handleKeydown} >
<div ref='selectedFlag'
onClick={this.handleFlagDropdownClick}
className='selected-flag'
className={
classNames(
'selected-flag',
this.props.classNames.selectedFlag
)
}
title={`${this.state.selectedCountry.name}: + ${this.state.selectedCountry.dialCode}`}>
<div className={inputFlagClasses}>
<div className={arrowClasses}></div>
Expand Down Expand Up @@ -574,7 +588,8 @@ ReactPhoneInput.defaultProps = {
defaultCountry: allCountries[0].iso2,
isValid: isNumberValid,
flagsImagePath: './flags.png',
onEnterKeyPress: function () {}
onEnterKeyPress: function () {},
classNames: {},
};

ReactPhoneInput.propTypes = {
Expand All @@ -584,7 +599,7 @@ ReactPhoneInput.propTypes = {
onlyCountries: PropTypes.arrayOf(PropTypes.string),
preferredCountries: PropTypes.arrayOf(PropTypes.string),
onChange: PropTypes.func,
classNames: PropTypes.string,
classNames: PropTypes.object,
className: PropTypes.string,
onBlur: PropTypes.func,
onFocus: PropTypes.func,
Expand Down
4 changes: 2 additions & 2 deletions src/react-phone-input-style.less
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@
input[type=tel] {
position: relative;
z-index: 0;
margin-top: 0 !important;
margin-bottom: 0 !important;
margin-top: 0;
margin-bottom: 0;
padding-left: 44px;
margin-left: 0;
background: #FFFFFF;
Expand Down