Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
28d3505
Clarify behavior in NumericSelect example
jakeboone02 Apr 29, 2016
b15bb5a
Merge pull request #1 from JedWatson/master
bvaughn Apr 29, 2016
eb5a457
Updated README to mention react-virtualized-select HOC
bvaughn Apr 29, 2016
d9db18e
Remove unnecessary onUnfocus
gojohnnygo May 1, 2016
23b9225
Merge pull request #926 from gojohnnygo/master
JedWatson May 1, 2016
5e393c0
Support for react components in searchPromptText
hellaeon May 2, 2016
b21f70e
Merge pull request #930 from hellaeon/search-prompt
JedWatson May 2, 2016
4e1bd34
Fix MIT License
ilkome May 2, 2016
bf102e0
Fix missing border of multi-select values on IE8
rockallite May 3, 2016
07147af
Adding the fix for missing border inside table to LESS
jackhsu978 May 4, 2016
5df5fa2
Async options with Promises - Promise object bug
VladimirPal May 6, 2016
03533ac
Fixed a bug where searchingText was not being shown when a refined se…
tonydecat May 6, 2016
7ea312e
Fix a focus bug on iOS
tonydecat May 6, 2016
a87e5b9
Merge pull request #943 from tonydecat/autofocus-ios-fix
JedWatson May 7, 2016
a1d6c01
Merge pull request #941 from VladimirPal/async_promise_bug
JedWatson May 7, 2016
13538cf
Merge pull request #942 from tonydecat/async-loading-bug
JedWatson May 7, 2016
7348612
Merge pull request #931 from ilkome/master
JedWatson May 7, 2016
e478a47
Make input act mmore natively
gojohnnygo May 8, 2016
07e86dc
Merge pull request #946 from gojohnnygo/master
JedWatson May 9, 2016
71b20e5
Merge pull request #938 from jackhsu978/patch-1
JedWatson May 9, 2016
c1624b8
Merge pull request #935 from rockallite/hotfix/fix-ie8-missing-border
JedWatson May 9, 2016
fbf1064
Merge pull request #925 from bvaughn/master
JedWatson May 9, 2016
26ba951
Merge pull request #924 from jakeboone02/patch-1
JedWatson May 9, 2016
5661196
Corrected documentation error about :onChange signature for multi-sel…
bvaughn May 15, 2016
710bae6
Updated additional `onChange` reference in README
bvaughn May 15, 2016
50b011a
Update Select.js
damienleroux May 16, 2016
95f839f
Adds unit (px) to minWidth attribute
May 18, 2016
6b9cd7a
Merge pull request #969 from ianwitherow/fix-820
JedWatson May 19, 2016
aa57a93
Merge pull request #961 from damienleroux/patch-1
JedWatson May 19, 2016
4b5572e
Fixed React error if onChange callback causes a root component to unm…
May 20, 2016
1d012fc
Add support for assistive technologies
bruderstein May 9, 2016
3a2e9aa
Merge pull request #988 from bruderstein/add-aria-support
JedWatson May 26, 2016
ec2b733
Merge pull request #979 from Xesued/master
JedWatson May 26, 2016
1a6bb41
Resolves loadOptions promise to return input
May 27, 2016
74e0f08
Fixes loadOptions to return promise with input
May 27, 2016
fc85589
Update README with autofocus prop
choonkending May 30, 2016
01bb88a
Merge pull request #995 from choonkending/master
JedWatson May 31, 2016
0381c75
Merge pull request #992 from lobsteropteryx/promise-bug-984
JedWatson May 31, 2016
58b8815
making sure the backspaceToRemoveMessage is not displayed if the back…
Jun 1, 2016
f2be81e
Adding Home, End, Page Up/Down support. #1001
blackjk3 Jun 2, 2016
e90c2b9
Added more detailed instructions about how to include styles CSS
bvaughn Jun 3, 2016
fa032e2
Updated README UMD script links
bvaughn Jun 3, 2016
b3035cc
Added ISSUE_TEMPLATE with link to Plunker
bvaughn Jun 3, 2016
8ea872f
Changed link to Plunker template to pass query param to auto-show pre…
bvaughn Jun 3, 2016
39a74a0
Prevent getFocusableOptionIndex from returning a disabled option.
Jun 3, 2016
241b6ca
Update the Readme.md
EduardoCHenrique Jun 7, 2016
eefa843
Updating build
JedWatson Jun 8, 2016
ad945db
Merge pull request #1014 from EduardoCHenrique/patch-1
JedWatson Jun 8, 2016
ae9dfbb
Close opened menu if disabled becomes true
Jun 10, 2016
a397aa9
Merge pull request #1021 from jsnmoon/master
JedWatson Jun 11, 2016
d8b508c
Merge pull request #1008 from brianspowers/disabled-options-1006
JedWatson Jun 11, 2016
38b6f16
Merge pull request #1003 from blackjk3/pg_up_down_1001
JedWatson Jun 11, 2016
8373ca4
Merge pull request #1000 from ryanzec/backspace-message-fix
JedWatson Jun 11, 2016
50cc051
Loosened the test for :activeElement in handleInputBlur() to prevent …
bvaughn Jun 17, 2016
781fd43
Merge pull request #1035 from JedWatson/handleInputBlur
bvaughn Jun 17, 2016
c9c7c9e
Merge remote-tracking branch 'upstream/master' into update-to-upstrea…
Jun 22, 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
9 changes: 9 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Thanks for using react-select!

If you are reporting an error please include a test case that demonstrates the issue you're reporting!
This is very helpful to maintainers in order to help us see the issue you're seeing.

Here is a Plunker you can fork that has react-select loaded and supports JSX syntax:
https://plnkr.co/edit/HTmtER9AMNcPoWhXV707?p=preview

You may also find the [online Babel tool](https://babeljs.io/repl/) quite helpful if you wish to use ES6/ES7 syntax not yet supported by the browser you are using.
69 changes: 29 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,25 @@ The easiest way to use React-Select is to install it from NPM and include it in
npm install react-select-plus --save
```

You can also use the standalone build by including `dist/react-select.js` and `dist/react-select.css` in your page. If you use this, make sure you have already included the following dependencies:
At this point you can import react-select and its styles in your application as follows:

* [React](http://facebook.github.io/react/)
* [classNames](http://jedwatson.github.io/classnames/)
* [react-input-autosize](https://github.com/JedWatson/react-input-autosize)
```js
import Select from 'react-select-plus';

// Be sure to include styles at some point, probably during your bootstrapping
import 'react-select/dist/react-select-plus.css';
```

You can also use the standalone build by including `react-select-plus.js` and `react-select-plus.css` in your page. (If you do this though you'll also need to include the dependencies.) For example:
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://npmcdn.com/classnames/index.js"></script>
<script src="https://npmcdn.com/react-input-autosize/dist/react-input-autosize.js"></script>
<script src="https://npmcdn.com/react-select-plus/dist/react-select-plus.js"></script>

<link rel="stylesheet" href="https://npmcdn.com/react-select-plus/dist/react-select-plus.css">
```


## Usage
Expand All @@ -52,7 +66,7 @@ Options should be provided as an `Array` of `Object`s, each with a `value` and `

The `value` property of each option should be set to either a string or a number.

When the value is changed, `onChange(newValue, [selectedOptions])` will fire.
When the value is changed, `onChange(selectedValueOrValues)` will fire.

```javascript
var Select = require('react-select-plus');
Expand Down Expand Up @@ -82,8 +96,7 @@ You can enable multi-value selection by setting `multi={true}`. In this mode:
* The selected values are submitted in multiple `<input type="hidden">` fields, use `joinValues` to submit joined values in a single field instead
* The values of the selected items are joined using the `delimiter` prop to create the input value when `joinValues` is true
* A simple value, if provided, will be split using the `delimiter` prop
* The `onChange` event provides an array of the selected options as the second argument
* The first argument to `onChange` is always a string, regardless of whether the values of the selected options are numbers or strings
* The `onChange` event provides an array of selected options _or_ a comma-separated string of values (eg `"1,2,3"`) if `simpleValue` is true
* By default, only options in the `options` array can be selected. Setting `allowCreate` to true allows new options to be created if they do not already exist.
* By default, selected options can be cleared. To disable the possibility of clearing a particular option, add `clearableValue: false` to that option:
```javascript
Expand Down Expand Up @@ -204,6 +217,12 @@ For multi-select inputs, when providing a custom `filterOptions` method, remembe

The `menuRenderer` property can be used to override the default drop-down list of options.
This should be done when the list is large (hundreds or thousands of items) for faster rendering.
Windowing libraries like [`react-virtualized`](https://github.com/bvaughn/react-virtualized) can then be used to more efficiently render the drop-down menu like so.
The easiest way to do this is with the [`react-virtualized-select`](https://github.com/bvaughn/react-virtualized-select/) HOC.
This component decorates a `Select` and uses the react-virtualized `VirtualScroll` component to render options.
Demo and documentation for this component are available [here](https://bvaughn.github.io/react-virtualized-select/).

You can also specify your own custom renderer.
The custom `menuRenderer` property accepts the following named parameters:

| Parameter | Type | Description |
Expand All @@ -215,37 +234,6 @@ The custom `menuRenderer` property accepts the following named parameters:
| selectValue | `Function` | Callback to select a new option; receives the option as a parameter. |
| valueArray | `Array<Object>` | Array of currently selected options. |

Windowing libraries like [`react-virtualized`](https://github.com/bvaughn/react-virtualized) can then be used to more efficiently render the drop-down menu like so:

```js
menuRenderer({ focusedOption, focusOption, labelKey, options, selectValue, valueArray }) {
const focusedOptionIndex = options.indexOf(focusedOption);
const option = options[index];
const isFocusedOption = option === focusedOption;

return (
<VirtualScroll
ref="VirtualScroll"
height={200}
rowHeight={35}
rowRenderer={(index) => (
<div
onMouseOver={() => focusOption(option)}
onClick={() => selectValue(option)}
>
{option[labelKey]}
</div>
)}
rowsCount={options.length}
scrollToIndex={focusedOptionIndex}
width={200}
/>
)
}
```

Check out the demo site for a more complete example of this.

### Updating input values with onInputChange

You can manipulate the input using the onInputChange and returning a new value.
Expand All @@ -270,6 +258,7 @@ function cleanInput(inputValue) {
addLabelText | string | 'Add "{label}"?' | text to display when `allowCreate` is true
allowCreate | bool | false | allow new options to be created in multi mode (displays an "Add \<option> ?" item when a value not already in the `options` array is entered)
autoBlur | bool | false | Blurs the input element after a selection has been made. Handy for lowering the keyboard on mobile devices
autofocus | bool | undefined | autofocus the component on mount
autoload | bool | true | whether to auto-load the default async options set
autosize | bool | true | If enabled, the input will expand as the length of its value increases
backspaceRemoves | bool | true | whether pressing backspace removes the last item when there is no input value
Expand Down Expand Up @@ -313,11 +302,11 @@ function cleanInput(inputValue) {
scrollMenuIntoView | bool | true | whether the viewport will shift to display the entire menu when engaged
searchable | bool | true | whether to enable searching feature or not
searchingText | string | 'Searching...' | message to display whilst options are loading via asyncOptions, or when `isLoading` is true
searchPromptText | string | 'Type to search' | label to prompt for search input
searchPromptText | string\|node | 'Type to search' | label to prompt for search input
tabSelectsValue | bool | true | whether to select the currently focused value when the `[tab]` key is pressed
value | any | undefined | initial field value
valueKey | string | 'value' | the option property to use for the value
valueRenderer | func | undefined | function which returns a custom way to render the value selected
valueRenderer | func | undefined | function which returns a custom way to render the value selected `function (option) {}`

### Methods

Expand Down
31 changes: 23 additions & 8 deletions dist/react-select-plus.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
color: #333;
cursor: default;
display: table;
border-spacing: 0;
border-collapse: separate;
height: 36px;
outline: none;
overflow: hidden;
Expand Down Expand Up @@ -77,19 +79,19 @@
text-overflow: ellipsis;
white-space: nowrap;
}
.has-value.Select--single > .Select-control > .Select-value .Select-value-label,
.has-value.is-pseudo-focused.Select--single > .Select-control > .Select-value .Select-value-label {
.has-value.Select--single > .Select-control .Select-value .Select-value-label,
.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value .Select-value-label {
color: #333;
}
.has-value.Select--single > .Select-control > .Select-value a.Select-value-label,
.has-value.is-pseudo-focused.Select--single > .Select-control > .Select-value a.Select-value-label {
.has-value.Select--single > .Select-control .Select-value a.Select-value-label,
.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label {
cursor: pointer;
text-decoration: none;
}
.has-value.Select--single > .Select-control > .Select-value a.Select-value-label:hover,
.has-value.is-pseudo-focused.Select--single > .Select-control > .Select-value a.Select-value-label:hover,
.has-value.Select--single > .Select-control > .Select-value a.Select-value-label:focus,
.has-value.is-pseudo-focused.Select--single > .Select-control > .Select-value a.Select-value-label:focus {
.has-value.Select--single > .Select-control .Select-value a.Select-value-label:hover,
.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label:hover,
.has-value.Select--single > .Select-control .Select-value a.Select-value-label:focus,
.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label:focus {
color: #007eff;
outline: none;
text-decoration: underline;
Expand Down Expand Up @@ -192,6 +194,17 @@
.Select-arrow-zone:hover > .Select-arrow {
border-top-color: #666;
}
.Select--multi .Select-multi-value-wrapper {
display: inline-block;
}
.Select .Select-aria-only {
display: inline-block;
height: 1px;
width: 1px;
margin: -1px;
clip: rect(0, 0, 0, 0);
overflow: hidden;
}
@-webkit-keyframes Select-animation-fadeIn {
from {
opacity: 0;
Expand Down Expand Up @@ -289,6 +302,8 @@
/* Fallback color for IE 8 */
background-color: rgba(0, 126, 255, 0.08);
border-radius: 2px;
border: 1px solid #c2e0ff;
/* Fallback color for IE 8 */
border: 1px solid rgba(0, 126, 255, 0.24);
color: #007eff;
display: inline-block;
Expand Down
Loading