diff --git a/package-lock.json b/package-lock.json
index 5c9bf2ef7..1058f7c1d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2995,6 +2995,7 @@
"version": "15.6.2",
"resolved": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.6.2.tgz",
"integrity": "sha1-zx7RXxKq1/FO9fLf4F5sQvke8Co=",
+ "dev": true,
"requires": {
"fbjs": "0.8.16",
"loose-envify": "1.3.1",
@@ -10540,15 +10541,6 @@
"react-icon-base": "2.1.0"
}
},
- "react-input-autosize": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-1.2.0.tgz",
- "integrity": "sha1-hyQQcRWfdCEjiXaR2meW7DO1fQU=",
- "requires": {
- "create-react-class": "15.6.2",
- "prop-types": "15.6.0"
- }
- },
"react-inspector": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/react-inspector/-/react-inspector-2.2.0.tgz",
@@ -10589,14 +10581,23 @@
"dev": true
},
"react-select-plus": {
- "version": "1.0.0-rc.5",
- "resolved": "https://registry.npmjs.org/react-select-plus/-/react-select-plus-1.0.0-rc.5.tgz",
- "integrity": "sha1-AJQgY9gkxX+c8fyYxH3yxjB9z/k=",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/react-select-plus/-/react-select-plus-1.2.0.tgz",
+ "integrity": "sha512-IIvRMB7Od6YAdLVFef61Tdd6FWsi6Kc0qLlSRuR/GsgYwE7IeyRx88HJ95by4hJ8M7q2LWwIkXKMDSrAUrjwyw==",
"requires": {
"classnames": "2.2.5",
- "create-react-class": "15.6.2",
"prop-types": "15.6.0",
- "react-input-autosize": "1.2.0"
+ "react-input-autosize": "2.2.1"
+ },
+ "dependencies": {
+ "react-input-autosize": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-2.2.1.tgz",
+ "integrity": "sha512-3+K4CD13iE4lQQ2WlF8PuV5htfmTRLH6MDnfndHM6LuBRszuXnuyIfE7nhSKt8AzRBZ50bu0sAhkNMeS5pxQQA==",
+ "requires": {
+ "prop-types": "15.6.0"
+ }
+ }
}
},
"react-simple-di": {
diff --git a/package.json b/package.json
index 4102404be..dd725d2ce 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,7 @@
"lodash.noop": "^3.0.1",
"prop-types": "^15.5.10",
"react-fontawesome": "^1.4.0",
- "react-select-plus": "1.0.0-rc.5",
+ "react-select-plus": "1.2.0",
"react-text-mask": "~5.0.2",
"react-transition-group": "~1.1.3",
"reactstrap": "4.8.0",
diff --git a/src/components/Select.js b/src/components/Select.js
index 4b48736bf..0dc71e276 100644
--- a/src/components/Select.js
+++ b/src/components/Select.js
@@ -53,9 +53,14 @@ class Select extends React.Component {
render() {
const { className, multi, value, valueComponent, ...props } = this.props;
delete props.onChange; // don't pass onChange prop to react-select
- const SelectElement = this.props.loadOptions ? ReactSelect.Async :
- this.props.creatable ? ReactSelect.Creatable :
- ReactSelect;
+ let SelectElement = ReactSelect;
+ if (this.props.loadOptions && this.props.creatable) {
+ SelectElement = ReactSelect.AsyncCreatable;
+ } else if (this.props.loadOptions) {
+ SelectElement = ReactSelect.Async;
+ } else if (this.props.creatable) {
+ SelectElement = ReactSelect.Creatable;
+ }
const classNames = classnames(className, { 'select-async': this.props.loadOptions });
const valueComponentRenderer = valueComponent ? valueComponent :
multi ? SelectMultiValue :
diff --git a/src/components/Select.scss b/src/components/Select.scss
index 7ba9d3713..270644973 100644
--- a/src/components/Select.scss
+++ b/src/components/Select.scss
@@ -2,6 +2,7 @@
// Import and override react-select's SCSS variables to match BS4:
$select-input-height: 2.35rem !default;
$select-input-internal-height: 2.25rem !default;
+ $select-arrow-width: 0.35rem !default;
// Override react-select styles to match Saffron (TODO move to theme?)
$select-input-bg-disabled: #eceeef;
diff --git a/test/components/Select.spec.js b/test/components/Select.spec.js
index 25616c0e7..ec7a61745 100644
--- a/test/components/Select.spec.js
+++ b/test/components/Select.spec.js
@@ -117,4 +117,16 @@ describe('', () => {
component.focus();
sinon.assert.calledOnce(component.selectEl.focus);
});
+
+ it('should render AsyncCreatable if loadOptions and creatable', () => {
+ const getOptions = () => {};
+
+ const component = shallow();
+ assert.equal(component.type(), ReactSelect.AsyncCreatable);
+ });
+
+ it('should render Creatable if creatable', () => {
+ const component = shallow();
+ assert.equal(component.type(), ReactSelect.Creatable);
+ });
});