react-country-region-selector
Advanced tools
Comparing version 1.2.3 to 1.3.0
@@ -23,7 +23,7 @@ import React from 'react'; | ||
value={this.getCountryValue(0)} | ||
onChange={(val) => this.selectCountry(0, val)}/> | ||
onChange={(val) => this.selectCountry(0, val)} /> | ||
<RegionDropdown | ||
country={this.getCountryValue(0)} | ||
value={this.getRegionValue(0)} | ||
onChange={(val) => this.selectRegion(0, val)}/> | ||
onChange={(val) => this.selectRegion(0, val)} /> | ||
</div> | ||
@@ -30,0 +30,0 @@ ); |
@@ -95,2 +95,3 @@ 'use strict'; | ||
var _onChange = _props3.onChange; | ||
var _onBlur = _props3.onBlur; | ||
var disabled = _props3.disabled; | ||
@@ -104,2 +105,5 @@ | ||
}, | ||
onBlur: function onBlur(e) { | ||
return _onBlur(e); | ||
}, | ||
disabled: disabled | ||
@@ -134,2 +138,3 @@ }; | ||
onChange: _propTypes2['default'].func, | ||
onBlur: _propTypes2['default'].func, | ||
labelType: _propTypes2['default'].oneOf([C.DISPLAY_TYPE_FULL, C.DISPLAY_TYPE_SHORT]), | ||
@@ -149,2 +154,3 @@ valueType: _propTypes2['default'].oneOf([C.DISPLAY_TYPE_FULL, C.DISPLAY_TYPE_SHORT]), | ||
onChange: function onChange() {}, | ||
onBlur: function onBlur() {}, | ||
labelType: C.DISPLAY_TYPE_FULL, | ||
@@ -201,3 +207,3 @@ valueType: C.DISPLAY_TYPE_FULL, | ||
// in a valid country | ||
if (!regions) { | ||
if (!regions || regions.length === 0) { | ||
console.error('Error. Unknown country passed: ' + country + '. If you\'re passing a country shortcode, be sure to include countryValueType="short" on the RegionDropdown'); | ||
@@ -273,2 +279,3 @@ return []; | ||
var _onChange2 = _props6.onChange; | ||
var _onBlur2 = _props6.onBlur; | ||
var id = _props6.id; | ||
@@ -287,2 +294,5 @@ var name = _props6.name; | ||
}, | ||
onBlur: function onBlur(e) { | ||
return _onBlur2(e); | ||
}, | ||
disabled: isDisabled | ||
@@ -319,2 +329,3 @@ }; | ||
onChange: _propTypes2['default'].func, | ||
onBlur: _propTypes2['default'].func, | ||
labelType: _propTypes2['default'].string, | ||
@@ -335,2 +346,3 @@ valueType: _propTypes2['default'].string, | ||
onChange: function onChange() {}, | ||
onBlur: function onBlur() {}, | ||
countryValueType: C.DISPLAY_TYPE_FULL, | ||
@@ -337,0 +349,0 @@ labelType: C.DISPLAY_TYPE_FULL, |
{ | ||
"name": "react-country-region-selector", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"description": "CountryDropdown and RegionDropdown React components for your forms.", | ||
@@ -5,0 +5,0 @@ "main": "lib/rcrs.js", |
@@ -197,2 +197,3 @@ # React-Country-Region-Selector | ||
| onChange | Yes | `-` | `function` | Callback that gets called when the user selects a country. Use this to store the value in whatever store you're using (or just the parent component state). | | ||
| onBlur | No | `-` | `function` | Callback that gets called when the user blurs off the country field. | | ||
| name | No | `"rcrs-country"` | `string` | The name attribute of the generated select box. | | ||
@@ -216,2 +217,3 @@ | id | No | `""` | `string` | The ID of the generated select box. Not added by default. | | ||
| onChange | Yes | - | `function` | Callback that gets called when the user selects a region. Use this to store the value in whatever store you're using (or just the parent component state). | | ||
| onBlur | No | - | `function` | Callback that gets called when the user blurs off the region field. | | ||
| name | No | `"rcrs-region"` | `string` | The name attribute of the generated select box. | | ||
@@ -240,2 +242,3 @@ | id | No | `""` | `string` | The ID of the generated select box. Not added by default. | | ||
### Gulp commands | ||
@@ -257,2 +260,3 @@ | ||
- `1.3.0` - Mar 20, 2018. Bug fix for invalid country, [@n-david](https://github.com/n-david)! onBlur event added. | ||
- `1.2.3` - Nov 7, 2017. Country data updates. React moved to peer dependency, thanks [@iamdey](https://github.com/iamdey)! | ||
@@ -259,0 +263,0 @@ - `1.2.2` - Oct 4, 2017 - Update to pass event on change. Thanks [@robertnealan](https://github.com/robertnealan)! |
@@ -44,3 +44,3 @@ import React from 'react'; | ||
render () { | ||
const { name, id, classes, value, onChange, disabled } = this.props; | ||
const { name, id, classes, value, onChange, onBlur, disabled } = this.props; | ||
const attrs = { | ||
@@ -50,2 +50,3 @@ name, | ||
onChange: (e) => onChange(e.target.value, e), | ||
onBlur: (e) => onBlur(e), | ||
disabled | ||
@@ -76,2 +77,3 @@ }; | ||
onChange: PropTypes.func, | ||
onBlur: PropTypes.func, | ||
labelType: PropTypes.oneOf([C.DISPLAY_TYPE_FULL, C.DISPLAY_TYPE_SHORT]), | ||
@@ -91,2 +93,3 @@ valueType: PropTypes.oneOf([C.DISPLAY_TYPE_FULL, C.DISPLAY_TYPE_SHORT]), | ||
onChange: () => {}, | ||
onBlur: () => {}, | ||
labelType: C.DISPLAY_TYPE_FULL, | ||
@@ -135,3 +138,3 @@ valueType: C.DISPLAY_TYPE_FULL, | ||
// in a valid country | ||
if (!regions) { | ||
if (!regions || regions.length === 0) { | ||
console.error('Error. Unknown country passed: ' + country + '. If you\'re passing a country shortcode, be sure to include countryValueType="short" on the RegionDropdown'); | ||
@@ -169,3 +172,3 @@ return []; | ||
render () { | ||
const { value, country, onChange, id, name, classes, disabled, disableWhenEmpty } = this.props; | ||
const { value, country, onChange, onBlur, id, name, classes, disabled, disableWhenEmpty } = this.props; | ||
const isDisabled = disabled || (disableWhenEmpty && country == ''); | ||
@@ -176,2 +179,3 @@ const attrs = { | ||
onChange: (e) => onChange(e.target.value, e), | ||
onBlur: (e) => onBlur(e), | ||
disabled: isDisabled | ||
@@ -204,2 +208,3 @@ }; | ||
onChange: PropTypes.func, | ||
onBlur: PropTypes.func, | ||
labelType: PropTypes.string, | ||
@@ -220,2 +225,3 @@ valueType: PropTypes.string, | ||
onChange: () => {}, | ||
onBlur: () => {}, | ||
countryValueType: C.DISPLAY_TYPE_FULL, | ||
@@ -222,0 +228,0 @@ labelType: C.DISPLAY_TYPE_FULL, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
3
272
81
0
3711764
31
38610