Skip to content

Commit 13aee42

Browse files
author
Trevor Burnham
committed
Merge tag 'v1.0.0-rc.3' into update-to-upstream-rc.3
Release v1.0.0-rc.3
2 parents 25413b4 + 63a59dc commit 13aee42

37 files changed

+3045
-1814
lines changed

.editorconfig

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
1010
indent_style = tab
11+
translate_tabs_to_spaces = false
1112

1213
[*.json]
1314
indent_style = space

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/* binary
2+
examples/dist/* binary
3+
lib/* binary

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ bower_components
2323

2424
# Other
2525
.DS_Store
26+
27+
yarn.lock

CHANGES.md

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Multiple values are now submitted in multiple form fields, which results in an a
1919
## New Select.Async Component
2020

2121
`loadingPlaceholder` prop
22-
`autoload` changed to `minimumInput` and now controls the minimum input to load options
2322
`cacheAsyncResults` -> `cache` (new external cache support) - defaults to true
2423

2524
## Fixes & Other Changes

HISTORY.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
## v1.0.0-beta14.patch1 / 2016-07-25
2-
3-
* (react-select-plus) On dropdown open, scroll to element above focused option
4-
instead of scrolling all the way to the top of the option group.
5-
61
## v1.0.0-rc / 2016-09-04
72

83
* fixed; reset value to `[]` when `multi=true`, thanks [Michael Williamson](https://github.com/mwilliamson)
@@ -15,6 +10,11 @@ instead of scrolling all the way to the top of the option group.
1510
* added; `onCloseResetsInput` prop, thanks [Frankie](https://github.com/frankievx)
1611
* added; `Creatable` component, replaces pre-1.0 `allowCreate` prop, thanks [Brian Vaughn](https://github.com/bvaughn)
1712

13+
## v1.0.0-beta14.patch1 / 2016-07-25
14+
15+
* (react-select-plus) On dropdown open, scroll to element above focused option
16+
instead of scrolling all the way to the top of the option group.
17+
1818
## v1.0.0-beta14 / 2016-07-17
1919

2020
* fixed; `react-input-autosize` has been udpated to `1.1.0`, which includes fixes for the new warnings that React 15.2 logs

README.md

+23-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
React-Select-Plus
2-
=================
32

43
A Select control for [React](http://facebook.github.io/react/index.html) based on [JedWatson/React-Select](https://github.com/JedWatson/react-select/).
54

@@ -86,6 +85,12 @@ function logChange(val) {
8685
/>
8786
```
8887

88+
### Custom classNames
89+
90+
You can provide a custom `className` prop to the `<Select>` component, which will be added to the base `.Select` className for the outer container.
91+
92+
The built-in Options renderer also support custom classNames, just add a `className` property to objects in the `options` array.
93+
8994
### Multiselect options
9095

9196
You can enable multi-value selection by setting `multi={true}`. In this mode:
@@ -95,7 +100,7 @@ You can enable multi-value selection by setting `multi={true}`. In this mode:
95100
* The values of the selected items are joined using the `delimiter` prop to create the input value when `joinValues` is true
96101
* A simple value, if provided, will be split using the `delimiter` prop
97102
* The `onChange` event provides an array of selected options _or_ a comma-separated string of values (eg `"1,2,3"`) if `simpleValue` is true
98-
* 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. *NOTE:* `allowCreate` is not implemented in `1.0.0-beta`, if you need this option please stay on `0.9.x`.
103+
* By default, only options in the `options` array can be selected. Use the `Creatable` Component (which wraps `Select`) to allow new options to be created if they do not already exist. Hitting comma (','), ENTER or TAB will add a new option. Versions `0.9.x` and below provided a boolean attribute on the `Select` Component (`allowCreate`) to achieve the same functionality. It is no longer available starting with version `1.0.0`.
99104
* By default, selected options can be cleared. To disable the possibility of clearing a particular option, add `clearableValue: false` to that option:
100105
```javascript
101106
var options = [
@@ -213,8 +218,8 @@ Property | Type | Description
213218
`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` |
214219
`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` |
215220
`newOptionCreator` | function | Factory to create new option. Expected signature: `({ label: string, labelKey: string, valueKey: string }): Object` |
216-
`promptTextCreator` | function | Creates prompt/placeholder option text. Expected signature: `(filterText: string): string`
217-
`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` |
221+
`onNewOptionClick` | function | new option click handler, it calls when new option has been selected. `function(option) {}` |
222+
`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 default. Expected signature: `({ keyCode: number }): boolean` |
218223
`promptTextCreator` | function | Factory for overriding default option creator prompt label. By default it will read 'Create option "{label}"'. Expected signature: `(label: String): String` |
219224

220225
### Combining Async and Creatable
@@ -242,16 +247,18 @@ You can control how options are filtered with the following properties:
242247
* `matchPos`: `"start"` or `"any"`: whether to match the text entered at the start or any position in the option value
243248
* `matchProp`: `"label"`, `"value"` or `"any"`: whether to match the value, label or both values of each option when filtering
244249
* `ignoreCase`: `Boolean`: whether to ignore case or match the text exactly when filtering
250+
* `ignoreAccents`: `Boolean`: whether to ignore accents on characters like ø or å
245251

246252
`matchProp` and `matchPos` both default to `"any"`.
247253
`ignoreCase` defaults to `true`.
254+
`ignoreAccents` defaults to `true`.
248255

249256
#### Advanced filters
250257

251258
You can also completely replace the method used to filter either a single option, or the entire options array (allowing custom sort mechanisms, etc.)
252259

253-
* `filterOption`: `function(Object option, String filter)` returns `Boolean`. Will override `matchPos`, `matchProp` and `ignoreCase` options.
254-
* `filterOptions`: `function(Array options, String filter, Array currentValues)` returns `Array filteredOptions`. Will override `filterOption`, `matchPos`, `matchProp` and `ignoreCase` options.
260+
* `filterOption`: `function(Object option, String filter)` returns `Boolean`. Will override `matchPos`, `matchProp`, `ignoreCase` and `ignoreAccents` options.
261+
* `filterOptions`: `function(Array options, String filter, Array currentValues)` returns `Array filteredOptions`. Will override `filterOption`, `matchPos`, `matchProp`, `ignoreCase` and `ignoreAccents` options.
255262

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

@@ -278,6 +285,9 @@ The custom `menuRenderer` property accepts the following named parameters:
278285
| focusedOption | `Object` | The currently focused option; should be visible in the menu by default. |
279286
| focusOption | `Function` | Callback to focus a new option; receives the option as a parameter. |
280287
| labelKey | `String` | Option labels are accessible with this string key. |
288+
| optionClassName | `String` | The className that gets used for options |
289+
| optionComponent | `ReactClass` | The react component that gets used for rendering an option |
290+
| optionRenderer | `Function` | The function that gets used to render the content of an option |
281291
| options | `Array<Object>` | Ordered array of options to render. |
282292
| selectValue | `Function` | Callback to select a new option; receives the option as a parameter. |
283293
| valueArray | `Array<Object>` | Array of currently selected options. |
@@ -328,22 +338,26 @@ function onInputKeyDown(event) {
328338
Property | Type | Default | Description
329339
:-----------------------|:--------------|:--------------|:--------------------------------
330340
addLabelText | string | 'Add "{label}"?' | text to display when `allowCreate` is true
331-
arrowRenderer | func | undefined | Renders a custom drop-down arrow to be shown in the right-hand side of the select: `arrowRenderer({ onMouseDown })`
341+
arrowRenderer | func | undefined | Renders a custom drop-down arrow to be shown in the right-hand side of the select: `arrowRenderer({ onMouseDown, isOpen })`
332342
autoBlur | bool | false | Blurs the input element after a selection has been made. Handy for lowering the keyboard on mobile devices
333343
autofocus | bool | undefined | autofocus the component on mount
334344
autoload | bool | true | whether to auto-load the default async options set
335345
autosize | bool | true | If enabled, the input will expand as the length of its value increases
336346
backspaceRemoves | bool | true | whether pressing backspace removes the last item when there is no input value
347+
backspaceToRemoveMessage | string | 'Press backspace to remove {last label}' | prompt shown in input when at least one option in a multiselect is shown, set to '' to clear
337348
cache | bool | true | enables the options cache for `asyncOptions` (default: `true`)
338349
className | string | undefined | className for the outer element
339350
clearable | bool | true | should it be possible to reset value
340351
clearAllText | string | 'Clear all' | title for the "clear" control when `multi` is true
352+
clearRenderer | func | undefined | Renders a custom clear to be shown in the right-hand side of the select when clearable true: `clearRenderer()`
341353
clearValueText | string | 'Clear value' | title for the "clear" control
342354
resetValue | any | null | value to use when you clear the control
355+
deleteRemoves | bool | true | whether pressing delete key removes the last item when there is no input value
343356
delimiter | string | ',' | delimiter to use to join multiple values
344357
disabled | bool | false | whether the Select is disabled or not
345358
filterOption | func | undefined | method to filter a single option: `function(option, filterString)`
346359
filterOptions | func | undefined | method to filter the options array: `function([options], filterString, [values])`
360+
ignoreAccents | bool | true | whether to strip accents when filtering
347361
ignoreCase | bool | true | whether to perform case-insensitive filtering
348362
inputProps | object | {} | custom attributes for the Input (in the Select-control) e.g: `{'data-foo': 'bar'}`
349363
isLoading | bool | false | whether the Select is loading externally or not (such as options being loaded)
@@ -356,12 +370,12 @@ function onInputKeyDown(event) {
356370
menuRenderer | func | undefined | Renders a custom menu with options; accepts the following named parameters: `menuRenderer({ focusedOption, focusOption, options, selectValue, valueArray })`
357371
multi | bool | undefined | multi-value input
358372
name | string | undefined | field name, for hidden `<input />` tag
359-
noResultsText | string | 'No results found' | placeholder displayed when there are no matching search results or a falsy value to hide it
373+
noResultsText | string | 'No results found' | placeholder displayed when there are no matching search results or a falsy value to hide it (can also be a react component)
360374
onBlur | func | undefined | onBlur handler: `function(event) {}`
361375
onBlurResetsInput | bool | true | whether to clear input on blur or not
362376
onChange | func | undefined | onChange handler: `function(newValue) {}`
363377
onClose | func | undefined | handler for when the menu closes: `function () {}`
364-
onCloseResetInput | bool | true | whether to clear input when closing the menu through the arrow
378+
onCloseResetsInput | bool | true | whether to clear input when closing the menu through the arrow
365379
onFocus | func | undefined | onFocus handler: `function(event) {}`
366380
onInputChange | func | undefined | onInputChange handler: `function(inputValue) {}`
367381
onInputKeyDown | func | undefined | input keyDown handler; call `event.preventDefault()` to override default `Select` behavior: `function(event) {}`
@@ -374,7 +388,6 @@ function onInputKeyDown(event) {
374388
renderInvalidValues | bool | false | if a `value` does not match any `options`, render it anyway
375389
scrollMenuIntoView | bool | true | whether the viewport will shift to display the entire menu when engaged
376390
searchable | bool | true | whether to enable searching feature or not
377-
searchingText | string | 'Searching...' | message to display whilst options are loading via asyncOptions, or when `isLoading` is true
378391
searchPromptText | string\|node | 'Type to search' | label to prompt for search input
379392
tabSelectsValue | bool | true | whether to select the currently focused value when the `[tab]` key is pressed
380393
value | any | undefined | initial field value

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dist/react-select-plus.min.js",
55
"dist/react-select-plus.min.css"
66
],
7-
"version": "1.0.0-rc.1.patch4",
7+
"version": "1.0.0-rc.3",
88
"homepage": "https://github.com/HubSpot/react-select-plus",
99
"authors": [
1010
"Trevor Burnham"

dist/react-select-plus.css

+4-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
background: #fff;
5757
border-color: #b3b3b3 #ccc #d9d9d9;
5858
}
59-
.is-open > .Select-control > .Select-arrow {
59+
.is-open > .Select-control .Select-arrow {
60+
top: -2px;
6061
border-color: transparent transparent #999;
6162
border-width: 0 5px 5px;
6263
}
@@ -193,6 +194,7 @@
193194
display: inline-block;
194195
height: 0;
195196
width: 0;
197+
position: relative;
196198
}
197199
.is-open .Select-arrow,
198200
.Select-arrow-zone:hover > .Select-arrow {
@@ -208,6 +210,7 @@
208210
margin: -1px;
209211
clip: rect(0, 0, 0, 0);
210212
overflow: hidden;
213+
float: left;
211214
}
212215
@-webkit-keyframes Select-animation-fadeIn {
213216
from {

0 commit comments

Comments
 (0)