Skip to content

Commit

Permalink
Merge pull request #1 from JedWatson/master
Browse files Browse the repository at this point in the history
Update from upstream
  • Loading branch information
bvaughn committed Apr 29, 2016
2 parents 1492b1e + 4420eaf commit b15bb5a
Show file tree
Hide file tree
Showing 29 changed files with 10,725 additions and 4,766 deletions.
24 changes: 24 additions & 0 deletions HISTORY.md
@@ -1,8 +1,32 @@
# React-Select

## v1.0.0-beta13 / 2016-05-30

* added; `inputRenderer` prop, allows you to override the input component, thanks [Sean Burke](https://github.com/leftmostcat)
* added; `openOnFocus` prop, causes the menu to always open when the select control is focused, thanks [HuysentruytRuben](https://github.com/HuysentruytRuben)
* added; `react-virtualised-select` HOC example, thanks [Brian Vaughn](https://github.com/bvaughn)
* added; `tabSelectsValue` prop can be set to false to prevent selection of focused option when tab is pressed, thanks [Byron Anderson](https://github.com/byronanderson)
* added; ability to override `resetValue` when clearing the control, thanks [Alexander Luberg](https://github.com/LubergAlexander)
* added; input can be updated with `onInputChange`, thanks [Brett DeWoody](https://github.com/brettdewoody)
* added; Styles for .is-selected class, thanks [Danny Herran](https://github.com/dherran)
* fixed; `noResultsText` prop type is now `stringOrNode` for Async component, thanks [Michael Groeneman](https://github.com/mgroeneman)
* fixed; `onInputChange` is wrapped by Async component, thanks [Eric O'Connell](https://github.com/drd)
* fixed; `scrollMenuIntoView` behaviour in IE10, thanks [Ivan Jager](https://github.com/aij)
* fixed; isEqualNode replaced with strict equality check, thanks [Alexandre Balhier](https://github.com/abalhier)
* fixed; issue with value object not being passed to `handleRequired`, thanks [Andrew Hite](https://github.com/andyhite)
* fixed; the menu-outer container is no longer rendered when it does not contain anything, thanks [Kuan](https://github.com/khankuan)
* improved; better support for IE8 in styles, thanks [Rockallite Wulf](https://github.com/rockallite)

## v1.0.0-beta12 / 2016-04-02

* added; `menuRenderer` method and example for effeciently rendering thousands of options, thanks [Brian Vaughn](https://github.com/bvaughn)
* added; `optionClassName` prop, thanks [Max Tyler](https://github.com/iam4x)

## v1.0.0-beta11 / 2016-03-09

* updated dependencies to allow use with React 15.x
* changed; multiple selected values are now submitted using multiple inputs, thanks [Trinh Hoang Nhu](https://github.com/james4388)
* added; `joinValues` prop to revert the above change and submit multiple values in a single field with the delimiter

## v1.0.0-beta10 / 2016-02-23

Expand Down
34 changes: 27 additions & 7 deletions README.md
Expand Up @@ -85,8 +85,9 @@ function logChange(val) {
You can enable multi-value selection by setting `multi={true}`. In this mode:

* Selected options will be removed from the dropdown menu
* The values of the selected items are joined using the `delimiter` property to create the input value
* A simple value, if provided, will be split using the `delimiter` property
* 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
* 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.
Expand Down Expand Up @@ -251,22 +252,39 @@ menuRenderer({ focusedOption, focusOption, labelKey, options, selectValue, value

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.

```js
function cleanInput(inputValue) {
// Strip all non-number characters from the input
return inputValue.replace(/[^0-9]/g, "");
}

<Select
name="form-field-name"
onInputChange={cleanInput}
/>
```

### Further options


Property | Type | Default | Description
:-----------------------|:--------------|:--------------|:--------------------------------
addLabelText | string | 'Add "{label}"?' | text to display when `allowCreate` is true
autosize | bool | true | If enabled, the input will expand as the length of its value increases
autoBlur | bool | false | Blurs the input element after a selection has been made. Handy for lowering the keyboard on mobile devices
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
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
cache | bool | true | enables the options cache for `asyncOptions` (default: `true`)
className | string | undefined | className for the outer element
clearable | bool | true | should it be possible to reset value
clearAllText | string | 'Clear all' | title for the "clear" control when `multi` is true
clearValueText | string | 'Clear value' | title for the "clear" control
resetValue | any | null | value to use when you clear the control
delimiter | string | ',' | delimiter to use to join multiple values
disabled | bool | false | whether the Select is disabled or not
filterOption | func | undefined | method to filter a single option: `function(option, filterString)`
Expand All @@ -279,7 +297,6 @@ Check out the demo site for a more complete example of this.
loadOptions | func | undefined | function that returns a promise or calls a callback with the options: `function(input, [callback])`
matchPos | string | 'any' | (any, start) match the start or entire string when filtering
matchProp | string | 'any' | (any, label, value) which option property to filter on
scrollMenuIntoView | bool | true | whether the viewport will shift to display the entire menu when engaged
menuBuffer | number | 0 | buffer of px between the base of the dropdown and the viewport to shift if menu doesnt fit in viewport
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
Expand All @@ -289,17 +306,20 @@ Check out the demo site for a more complete example of this.
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 () {}`
onFocus | func | undefined | onFocus handler: `function(event) {}`
onInputChange | func | undefined | onInputChange handler: `function(inputValue) {}`
onValueClick | func | undefined | onClick handler for value labels: `function (value, event) {}`
onOpen | func | undefined | handler for when the menu opens: `function () {}`
onClose | func | undefined | handler for when the menu closes: `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)
optionRenderer | func | undefined | function which returns a custom way to render the options in the menu
options | array | undefined | array of options
placeholder | string\|node | 'Select ...' | field placeholder, displayed when there's no value
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
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
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -4,7 +4,7 @@
"dist/react-select.min.js",
"dist/react-select.min.css"
],
"version": "1.0.0-beta11",
"version": "1.0.0-beta13",
"homepage": "https://github.com/JedWatson/react-select",
"authors": [
"Jed Watson"
Expand Down
41 changes: 30 additions & 11 deletions dist/react-select.css
Expand Up @@ -64,7 +64,7 @@
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0 3px rgba(0, 126, 255, 0.1);
}
.Select-placeholder,
:not(.Select--multi) > .Select-control .Select-value {
.Select--single > .Select-control .Select-value {
bottom: 0;
color: #aaa;
left: 0;
Expand All @@ -79,19 +79,19 @@
text-overflow: ellipsis;
white-space: nowrap;
}
.has-value:not(.Select--multi) > .Select-control > .Select-value .Select-value-label,
.has-value.is-pseudo-focused:not(.Select--multi) > .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:not(.Select--multi) > .Select-control > .Select-value a.Select-value-label,
.has-value.is-pseudo-focused:not(.Select--multi) > .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:not(.Select--multi) > .Select-control > .Select-value a.Select-value-label:hover,
.has-value.is-pseudo-focused:not(.Select--multi) > .Select-control > .Select-value a.Select-value-label:hover,
.has-value:not(.Select--multi) > .Select-control > .Select-value a.Select-value-label:focus,
.has-value.is-pseudo-focused:not(.Select--multi) > .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 All @@ -103,17 +103,20 @@
vertical-align: middle;
}
.Select-input > input {
width: 100%;
background: none transparent;
border: 0 none;
box-shadow: none;
cursor: default;
display: inline-block;
font-family: inherit;
font-size: inherit;
height: 34px;
margin: 0;
outline: none;
padding: 0;
line-height: 14px;
/* For IE 8 compatibility */
padding: 8px 0 12px;
/* For IE 8 compatibility */
-webkit-appearance: none;
}
.is-focused .Select-input > input {
Expand Down Expand Up @@ -239,7 +242,15 @@
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
.Select-option.is-selected {
background-color: #f5faff;
/* Fallback color for IE 8 */
background-color: rgba(0, 126, 255, 0.04);
color: #333;
}
.Select-option.is-focused {
background-color: #ebf5ff;
/* Fallback color for IE 8 */
background-color: rgba(0, 126, 255, 0.08);
color: #333;
}
Expand All @@ -263,6 +274,8 @@
margin-left: 5px;
}
.Select--multi .Select-value {
background-color: #ebf5ff;
/* Fallback color for IE 8 */
background-color: rgba(0, 126, 255, 0.08);
border-radius: 2px;
border: 1px solid rgba(0, 126, 255, 0.24);
Expand Down Expand Up @@ -297,15 +310,21 @@
cursor: pointer;
border-bottom-left-radius: 2px;
border-top-left-radius: 2px;
border-right: 1px solid #c2e0ff;
/* Fallback color for IE 8 */
border-right: 1px solid rgba(0, 126, 255, 0.24);
padding: 1px 5px 3px;
}
.Select--multi .Select-value-icon:hover,
.Select--multi .Select-value-icon:focus {
background-color: #d8eafd;
/* Fallback color for IE 8 */
background-color: rgba(0, 113, 230, 0.08);
color: #0071e6;
}
.Select--multi .Select-value-icon:active {
background-color: #c2e0ff;
/* Fallback color for IE 8 */
background-color: rgba(0, 126, 255, 0.24);
}
.Select--multi.is-disabled .Select-value {
Expand Down

0 comments on commit b15bb5a

Please sign in to comment.