Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sgaestel authored Feb 1, 2017
2 parents 919c952 + 63a59dc commit 98e11d0
Show file tree
Hide file tree
Showing 28 changed files with 13,736 additions and 13,573 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ bower_components

# Other
.DS_Store

yarn.lock
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ function logChange(val) {
/>
```

### Custom classNames

You can provide a custom `className` prop to the `<Select>` component, which will be added to the base `.Select` className for the outer container.

The built-in Options renderer also support custom classNames, just add a `className` property to objects in the `options` array.

### Multiselect options

You can enable multi-value selection by setting `multi={true}`. In this mode:
Expand Down Expand Up @@ -250,16 +256,18 @@ You can control how options are filtered with the following properties:
* `matchPos`: `"start"` or `"any"`: whether to match the text entered at the start or any position in the option value
* `matchProp`: `"label"`, `"value"` or `"any"`: whether to match the value, label or both values of each option when filtering
* `ignoreCase`: `Boolean`: whether to ignore case or match the text exactly when filtering
* `ignoreAccents`: `Boolean`: whether to ignore accents on characters like ø or å

`matchProp` and `matchPos` both default to `"any"`.
`ignoreCase` defaults to `true`.
`ignoreAccents` defaults to `true`.

#### Advanced filters

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

* `filterOption`: `function(Object option, String filter)` returns `Boolean`. Will override `matchPos`, `matchProp` and `ignoreCase` options.
* `filterOptions`: `function(Array options, String filter, Array currentValues)` returns `Array filteredOptions`. Will override `filterOption`, `matchPos`, `matchProp` and `ignoreCase` options.
* `filterOption`: `function(Object option, String filter)` returns `Boolean`. Will override `matchPos`, `matchProp`, `ignoreCase` and `ignoreAccents` options.
* `filterOptions`: `function(Array options, String filter, Array currentValues)` returns `Array filteredOptions`. Will override `filterOption`, `matchPos`, `matchProp`, `ignoreCase` and `ignoreAccents` options.

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

Expand Down Expand Up @@ -339,7 +347,7 @@ function onInputKeyDown(event) {
Property | Type | Default | Description
:-----------------------|:--------------|:--------------|:--------------------------------
addLabelText | string | 'Add "{label}"?' | text to display when `allowCreate` is true
arrowRenderer | func | undefined | Renders a custom drop-down arrow to be shown in the right-hand side of the select: `arrowRenderer({ onMouseDown })`
arrowRenderer | func | undefined | Renders a custom drop-down arrow to be shown in the right-hand side of the select: `arrowRenderer({ onMouseDown, isOpen })`
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 All @@ -350,13 +358,15 @@ function onInputKeyDown(event) {
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
clearRenderer | func | undefined | Renders a custom clear to be shown in the right-hand side of the select when clearable true: `clearRenderer()`
clearValueText | string | 'Clear value' | title for the "clear" control
resetValue | any | null | value to use when you clear the control
deleteRemoves | bool | true | whether pressing delete key removes the last item when there is no input value
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)`
filterOptions | func | undefined | method to filter the options array: `function([options], filterString, [values])`
ignoreAccents | bool | true | whether to strip accents when filtering
ignoreCase | bool | true | whether to perform case-insensitive filtering
inputProps | object | {} | custom attributes for the Input (in the Select-control) e.g: `{'data-foo': 'bar'}`
isLoading | bool | false | whether the Select is loading externally or not (such as options being loaded)
Expand All @@ -369,7 +379,7 @@ function onInputKeyDown(event) {
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
noResultsText | string | 'No results found' | placeholder displayed when there are no matching search results or a falsy value to hide it
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)
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) {}`
Expand Down
5 changes: 4 additions & 1 deletion dist/react-select.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
background: #fff;
border-color: #b3b3b3 #ccc #d9d9d9;
}
.is-open > .Select-control > .Select-arrow {
.is-open > .Select-control .Select-arrow {
top: -2px;
border-color: transparent transparent #999;
border-width: 0 5px 5px;
}
Expand Down Expand Up @@ -195,6 +196,7 @@
display: inline-block;
height: 0;
width: 0;
position: relative;
}
.is-open .Select-arrow,
.Select-arrow-zone:hover > .Select-arrow {
Expand All @@ -210,6 +212,7 @@
margin: -1px;
clip: rect(0, 0, 0, 0);
overflow: hidden;
float: left;
}
@-webkit-keyframes Select-animation-fadeIn {
from {
Expand Down
Loading

0 comments on commit 98e11d0

Please sign in to comment.