Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
0d3dec6
Add onCloseResetsInput to the readme to understand usage
frankievx Jul 18, 2016
f515711
Implement onCloseResetsInput feature
frankievx Jul 18, 2016
a40af0e
Add tests to cover new onCloseResetsInput feature
frankievx Jul 18, 2016
90dfe43
Run Build
frankievx Jul 18, 2016
8bbd0b7
Added an optional instance id property
Jul 19, 2016
f9d1c35
Update Select.js
nhducit Jul 20, 2016
1743118
Apply less changes to scss versions
pbrant Jul 21, 2016
be6a2b4
replace blacklist dependency by using the spread operator
jochenberger Jul 22, 2016
20c0fe7
Merge pull request #1113 from ccap/update-scss-stylesheets
JedWatson Jul 24, 2016
4dd253a
Merge pull request #1115 from jochenberger/master
JedWatson Jul 24, 2016
87bf6c3
update npm badge
Jul 25, 2016
e19bce3
Merge pull request #1119 from kentcdodds/patch-1
JedWatson Jul 26, 2016
107ce1a
Updated solution to incorporate @JedWatson's suggestion
Jul 27, 2016
9874b89
Merge remote-tracking branch 'JedWatson/master' into enhancement/Serv…
Jul 27, 2016
e8bcab8
Use preferred callback refs
gojohnnygo Jul 28, 2016
38ca948
Additional test coverage for onBlur
gojohnnygo Jul 28, 2016
15ba7d2
Add ref tests
gojohnnygo Jul 29, 2016
adc82bd
fix value check in renderClear
hanwencheng Aug 5, 2016
ee69b98
Remove unused `isLoading` entry in getInitialState
ForbesLindesay Aug 20, 2016
189c0e2
Adding Supported by Thinkmill badge
JedWatson Aug 21, 2016
c76f001
Fix link to Thinkmill
mxstbr Aug 21, 2016
9a50bd0
Merge pull request #1164 from mxstbr/patch-1
JedWatson Aug 21, 2016
d5af3aa
Fix tests that click `clear`
mwilliamson Aug 28, 2016
27938a0
Default reset value to [] when multi=true
mwilliamson Aug 28, 2016
9de9f2d
Merge pull request #1177 from mwilliamson/multi-default-reset-value
JedWatson Aug 28, 2016
a069b0c
Fix typo, change "1" -> "i"
nhducit Aug 29, 2016
a8d5757
Merge remote-tracking branch 'JedWatson/master' into enhancement/Serv…
Aug 29, 2016
9e5c90c
Merge pull request #1108 from nhducit/master
JedWatson Aug 30, 2016
a21714c
Updating bower dependency react-select-autosize to ^1.1.0, fixes #1167
JedWatson Aug 30, 2016
b6f1d88
Ensuring stringifyValue returns a string, closes #1155
JedWatson Aug 30, 2016
36869b2
Updating dependencies
JedWatson Aug 30, 2016
9f7689f
Merge pull request #1163 from ForbesLindesay/patch-1
JedWatson Aug 30, 2016
d7e4d11
Merge pull request #1146 from hanwencheng/master
JedWatson Aug 30, 2016
7122ec9
Patching fix from #1146 to src/Select
JedWatson Aug 30, 2016
3cef09d
Merge pull request #1124 from gojohnnygo/RefCallback
JedWatson Aug 30, 2016
6e67933
Merge pull request #1105 from JevinAnderson/enhancement/Server-Side-r…
JedWatson Aug 30, 2016
2ff2a6e
Merge pull request #1101 from frankievx/master
JedWatson Aug 30, 2016
e94b91f
Fixing breaking issue rendering a single label
JedWatson Aug 30, 2016
c25d846
All but one test passing
mikehazell Sep 1, 2016
e44cfaf
Replace npmcdn.com with unpkg.com
npmcdn-to-unpkg-bot Sep 1, 2016
51b8395
Merge pull request #1184 from npmcdn-to-unpkg-bot/npmcdn-to-unpkg
JedWatson Sep 2, 2016
f4496df
Merge pull request #1183 from mikehazell/fixing-tests
JedWatson Sep 2, 2016
4241f6c
Handle touch outside to dismiss
jooj123 Sep 3, 2016
5001083
Made it only trigger one event for multiple selects on the screen
jooj123 Sep 3, 2016
7fe723f
Implement allowCreate and newOptionCreator
bvaughn Sep 4, 2016
fc74cc6
Converted Creatable function props to use named params
bvaughn Sep 4, 2016
5a058e5
Merge pull request #1187 from JedWatson/custom-create-option
bvaughn Sep 4, 2016
f651932
Added a section to the README for filtering large options lists
bvaughn Sep 4, 2016
04eaad2
Added onInputKeyDown Select prop to README
bvaughn Sep 4, 2016
00dd299
Decreased opacity for down arrow in disabled state
bvaughn Sep 4, 2016
9267932
Added test
jooj123 Sep 4, 2016
15d6373
Merge pull request #1189 from jooj123/patch/handle-touch-outside
JedWatson Sep 4, 2016
675da97
Updating Changelog
JedWatson Sep 4, 2016
1f0d249
Updating readme for new rc
JedWatson Sep 4, 2016
de38468
Disabling invalid test with explanation
JedWatson Sep 4, 2016
82bf7e5
Updating build
JedWatson Sep 4, 2016
3e4ebfc
v1.0.0-rc.1
JedWatson Sep 4, 2016
f08f7b9
Merge tag 'v1.0.0-rc.1' into update-to-upstream-rc.1
Oct 7, 2016
dc47801
Fix setting option ref when focused.
piecyk Sep 13, 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
12 changes: 12 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
* (react-select-plus) On dropdown open, scroll to element above focused option
instead of scrolling all the way to the top of the option group.

## v1.0.0-rc / 2016-09-04

* fixed; reset value to `[]` when `multi=true`, thanks [Michael Williamson](https://github.com/mwilliamson)
* added; pass index to `renderLabel` method, thanks [nhducit](https://github.com/nhducit)
* fixed; uncontrolled to controlled component warning in React 15.3
* fixed; props cleanup, thanks [Forbes Lindesay](https://github.com/ForbesLindesay)
* fixed; issue where a value of the number `0` would be assumed to be no value, thanks [Hanwen Cheng](https://github.com/hanwencheng)
* fixed; internal refs converted to callbacks instead of strings, thanks [Johnny Nguyen](https://github.com/gojohnnygo)
* added; optional `instanceId` prop for server-side rendering, thanks [Jevin Anderson](https://github.com/JevinAnderson)
* added; `onCloseResetsInput` prop, thanks [Frankie](https://github.com/frankievx)
* added; `Creatable` component, replaces pre-1.0 `allowCreate` prop, thanks [Brian Vaughn](https://github.com/bvaughn)

## v1.0.0-beta14 / 2016-07-17

* fixed; `react-input-autosize` has been udpated to `1.1.0`, which includes fixes for the new warnings that React 15.2 logs
Expand Down
69 changes: 60 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ React-Select-Plus
A Select control for [React](http://facebook.github.io/react/index.html) based on [JedWatson/React-Select](https://github.com/JedWatson/react-select/).


## New version 1.0.0-beta
## New version 1.0.0-rc

I've nearly completed a major rewrite of this component (see issue [#568](https://github.com/JedWatson/react-select/issues/568) for details and progress). The new code has been merged into `master`, and `react-select@1.0.0-beta` has been published to npm and bower.
I've nearly completed a major rewrite of this component (see issue [#568](https://github.com/JedWatson/react-select/issues/568) for details and progress). The new code has been merged into `master`, and `react-select@1.0.0-rc` has been published to npm and bower.

1.0.0 has some breaking changes. The documentation below still needs to be updated for the new API; notes on the changes can be found in [CHANGES.md](https://github.com/JedWatson/react-select/blob/master/CHANGES.md) and will be finalised into [HISTORY.md](https://github.com/JedWatson/react-select/blob/master/HISTORY.md) soon.

Our tests need some major updates to work with the new API (see [#571](https://github.com/JedWatson/react-select/issues/571)) and are causing the build to fail, but the component is stable and robust in actual usage.
1.0.0 has some breaking changes. The documentation is still being updated for the new API; notes on the changes can be found in [CHANGES.md](https://github.com/JedWatson/react-select/blob/master/CHANGES.md) and will be finalised into [HISTORY.md](https://github.com/JedWatson/react-select/blob/master/HISTORY.md) soon.

Testing, feedback and PRs for the new version are appreciated.

Expand Down Expand Up @@ -54,7 +52,7 @@ You can also use the standalone build by including `react-select-plus.js` and `r
<script src="https://unpkg.com/react-input-autosize/dist/react-input-autosize.js"></script>
<script src="https://unpkg.com/react-select-plus/dist/react-select-plus.js"></script>

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


Expand Down Expand Up @@ -193,6 +191,29 @@ var isLoadingExternally = true;
/>
```

### User-created tags

The `Creatable` component enables users to create new tags within react-select.
It decorates a `Select` and so it supports all of the default properties (eg single/multi mode, filtering, etc) in addition to a couple of custom ones (shown below).
The easiest way to use it is like so:

```js
import { Creatable } from 'react-select';

function render (selectProps) {
return <Creatable {...selectProps} />;
};
```

##### Creatable properties

Property | Type | Description
:---|:---|:---
`isOptionUnique` | function | Searches for any matching option within the set of options. This function prevents duplicate options from being created. By default this is a basic, case-sensitive comparison of label and value. Expected signature: `({ option: Object, options: Array, labelKey: string, valueKey: string }): boolean` |
`isValidNewOption` | function | Determines if the current input text represents a valid option. By default any non-empty string will be considered valid. Expected signature: `({ label: string }): boolean` |
`newOptionCreator` | function | Factory to create new option. Expected signature: `({ label: string, labelKey: string, valueKey: string }): Object` |
`shouldKeyDownEventCreateNewOption` | function | Decides if a keyDown event (eg its `keyCode`) should result in the creation of a new option. ENTER, TAB and comma keys create new options by dfeault. Expected signature: `({ keyCode: number }): boolean` |

### Filtering options

You can control how options are filtered with the following properties:
Expand All @@ -213,7 +234,13 @@ You can also completely replace the method used to filter either a single option

For multi-select inputs, when providing a custom `filterOptions` method, remember to exclude current values from the returned array of options.

#### Effeciently rendering large lists with windowing
#### Filtering large lists

The default `filterOptions` method scans the options array for matches each time the filter text changes.
This works well but can get slow as the options array grows to several hundred objects.
For larger options lists a custom filter function like [`react-select-fast-filter-options`](https://github.com/bvaughn/react-select-fast-filter-options) will produce better results.

### Effeciently rendering large lists with windowing

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.
Expand Down Expand Up @@ -250,13 +277,36 @@ function cleanInput(inputValue) {
/>
```

### Overriding default key-down behavior with onInputKeyDown

`Select` listens to `keyDown` events to select items, navigate drop-down list via arrow keys, etc.
You can extend or override this behavior by providing a `onInputKeyDown` callback.

```js
function onInputKeyDown(event) {
switch (event.keyCode) {
case 9: // TAB
// Extend default TAB behavior by doing something here
break;
case 13: // ENTER
// Override default ENTER behavior by doing stuff here and then preventing default
event.preventDefault();
break;
}
}

<Select
{...otherProps}
onInputKeyDown={onInputKeyDown}
/>
```

### Further options


Property | Type | Default | Description
:-----------------------|:--------------|:--------------|:--------------------------------
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) [NOTE: not available in 1.0.0-beta]
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
Expand Down Expand Up @@ -284,14 +334,15 @@ function cleanInput(inputValue) {
menuRenderer | func | undefined | Renders a custom menu with options; accepts the following named parameters: `menuRenderer({ focusedOption, focusOption, options, selectValue, valueArray })`
multi | bool | undefined | multi-value input
name | string | undefined | field name, for hidden `<input />` tag
newOptionCreator | func | undefined | factory to create new options when `allowCreate` is true [NOTE: not available in 1.0.0-beta]
noResultsText | string | 'No results found' | placeholder displayed when there are no matching search results or a falsy value to hide it
onBlur | func | undefined | onBlur handler: `function(event) {}`
onBlurResetsInput | bool | true | whether to clear input on blur or not
onChange | func | undefined | onChange handler: `function(newValue) {}`
onClose | func | undefined | handler for when the menu closes: `function () {}`
onCloseResetInput | bool | true | whether to clear input when closing the menu through the arrow
onFocus | func | undefined | onFocus handler: `function(event) {}`
onInputChange | func | undefined | onInputChange handler: `function(inputValue) {}`
onInputKeyDown | func | undefined | input keyDown handler; call `event.preventDefault()` to override default `Select` behavior: `function(event) {}`
onOpen | func | undefined | handler for when the menu opens: `function () {}`
onValueClick | func | undefined | onClick handler for value labels: `function (value, event) {}`
openOnFocus | bool | false | open the options menu when the input gets focus (requires searchable = true)
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dist/react-select-plus.min.js",
"dist/react-select-plus.min.css"
],
"version": "1.0.0-beta14.patch1",
"version": "1.0.0-rc.1",
"homepage": "https://github.com/HubSpot/react-select-plus",
"authors": [
"Trevor Burnham"
Expand All @@ -17,7 +17,7 @@
],
"dependencies": {
"classnames": "^2.2.0",
"react-input-autosize": "^0.6.5"
"react-input-autosize": "^1.1.0"
},
"keywords": [
"react",
Expand Down
1 change: 1 addition & 0 deletions dist/react-select-plus.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
.Select.is-disabled .Select-arrow-zone {
cursor: default;
pointer-events: none;
opacity: 0.35;
}
.Select-control {
background-color: #fff;
Expand Down
Loading