├── .babelrc ├── .gitignore ├── .npmignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── circle.yml ├── index.html ├── karma.conf.js ├── package.json ├── source ├── TestUtils.js ├── VirtualizedSelect │ ├── VirtualizedSelect.example.css │ ├── VirtualizedSelect.example.js │ ├── VirtualizedSelect.js │ └── index.js ├── demo │ ├── Application.css │ ├── Application.js │ ├── data │ │ ├── cities.js │ │ ├── countries.js │ │ └── names.js │ └── favicon.png ├── index.js ├── styles.css └── tests.js ├── styles.css ├── webpack.config.demo.js ├── webpack.config.dev.js ├── webpack.config.umd.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "commonjs": { 4 | "presets": [ 5 | "es2015", 6 | "react", 7 | "stage-0" 8 | ] 9 | }, 10 | "development": { 11 | "plugins": [ 12 | "typecheck", 13 | [ 14 | "react-transform", 15 | { 16 | "transforms": [ 17 | { 18 | "transform": "react-transform-hmr", 19 | "imports": [ 20 | "react" 21 | ], 22 | "locals": [ 23 | "module" 24 | ] 25 | }, 26 | { 27 | "transform": "react-transform-catch-errors", 28 | "imports": [ 29 | "react", 30 | "redbox-react" 31 | ] 32 | } 33 | ] 34 | } 35 | ] 36 | ], 37 | "presets": [ 38 | "es2015", 39 | "react", 40 | "stage-0" 41 | ] 42 | }, 43 | "es": { 44 | "plugins": [ 45 | "transform-runtime" 46 | ], 47 | "presets": [ 48 | "es2015-rollup", 49 | "react", 50 | "stage-0" 51 | ] 52 | }, 53 | "production": { 54 | "comments": false, 55 | "plugins": [ 56 | "transform-react-inline-elements", 57 | "transform-runtime" 58 | ], 59 | "presets": [ 60 | "es2015", 61 | "react", 62 | "stage-0" 63 | ] 64 | }, 65 | "test": { 66 | "comments": false, 67 | "plugins": [ 68 | "__coverage__" 69 | ], 70 | "presets": [ 71 | "es2015", 72 | "react", 73 | "stage-0" 74 | ] 75 | } 76 | }, 77 | "plugins": [ 78 | "transform-decorators-legacy" 79 | ] 80 | } 81 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | npm-debug.log 4 | build 5 | coverage 6 | dist 7 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | build 2 | coverage 3 | docs 4 | source 5 | .* 6 | *.md 7 | circle.yml 8 | index.html 9 | karma.conf.js 10 | webpack.config.*.js 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Changelog 2 | ------------ 3 | 4 | ##### 3.1.3 5 | * Added `cursor: pointer` style by defalut to select options. 6 | 7 | ##### 3.1.2 8 | * (Nothing.) 9 | 10 | ##### 3.1.1 11 | * Added missing `valueKey` to custom option renderer params. 12 | 13 | ##### 3.1.0 14 | * Default option renderer supports a `className` property on options. 15 | 16 | ##### 3.0.1 17 | * Revert v2.4.2, https://github.com/bvaughn/react-virtualized-select/issues/57#issuecomment-297742641 18 | 19 | ##### 3.0.0 20 | * Same as v2.4.2 but with an updated external dependency versions (eg react-virtualized 8.x to 9.x, new prop-types lib, react alpha 16, etc). 21 | 22 | ##### 2.4.2 23 | * Backwards compat bugfix for `require('...').default` usecase (see issue #57). 24 | 25 | ##### 2.4.1 26 | * 🎉 UMD build fixed to properly set `window.VirtualizedSelect` ([@armed](https://github.com/armed) - [#56](https://github.com/bvaughn/react-virtualized-select/pull/56)) 27 | 28 | ##### 2.4.0 29 | * 🎉 Support option `title` attribute ([@targumon](https://github.com/targumon) - [#46](https://github.com/bvaughn/react-virtualized-select/pull/46)) 30 | 31 | ##### 2.3.0 32 | * 🎉 `focus` method added to `VirtualizedSelect` ([@Syynth](https://github.com/Syynth) - [#41](https://github.com/bvaughn/react-virtualized-select/pull/41)) 33 | 34 | ##### 2.2.0 35 | * 🎉 Default option renderer highlights selected option in bold ([@the-spyke](https://github.com/the-spyke) - [#40](https://github.com/bvaughn/react-virtualized-select/pull/40)) 36 | 37 | ##### 2.1.1 38 | Added a workaround for a bug in `Creatable` (react-select 1.0.0-rc2). 39 | Clicking on the placeholder item now successfully creates new options. 40 | See issue #33. 41 | 42 | ##### 2.1.0 43 | Added `listProps` prop to enable pass-through of additional, custom properties to the underlying react-virtualized `List`. 44 | 45 | ##### 2.0.2 46 | Dramatically reduced library size by limiting the parts of react-virtualized that are imported. 47 | 48 | ##### 2.0.1 49 | Utilizes `babel-plugin-transform-runtime` to remove `babelHelpers` from the built dist. 50 | This enables support without requiring the `babel-external-helpers` plugin in application code. 51 | 52 | ##### 2.0.0 53 | Updates to `react-virtualized` 8.x release. 54 | Read more about version 8 changes [here](https://github.com/bvaughn/react-virtualized/issues/386). 55 | 56 | Contains no new user-facing functionality but requires a major update due to the updated `optionRenderer` interface. 57 | Renderers will now receive 2 additional named properties: `key` and `style`. 58 | Both should be passed through to the top-level element of their rendered response. 59 | For example: 60 | 61 | ```jsx 62 | // react-virtualized-select 1.x 63 | function optionRendererBefore ({ option, ...rest }) { 64 | return ( 65 |
66 | {option.name} 67 |
68 | ) 69 | } 70 | 71 | // react-virtualized-select 2.x 72 | function optionRendererAfter ({ key, option, style, ...rest }) { 73 | return ( 74 |
78 | {option.name} 79 |
80 | ) 81 | } 82 | ``` 83 | 84 | ##### 1.4.0 85 | Added `selectComponent` option to enable users to choose a sepecific select HOC (eg `Select.Creatable`). 86 | 87 | ##### 1.3.0 88 | Added support for `disabled` attribute in options array. 89 | 90 | ##### 1.2.0 91 | Added support for async options (`Select.Async`) via new `async` boolean property. 92 | 93 | ##### 1.1.1 94 | Fixed a regression for non-function `optionHeight` values. 95 | 96 | ##### 1.1.0 97 | Supports dynamic option heights via `optionHeight` as a function. 98 | Function should implement the following signature: `({ option: Object }): number` 99 | 100 | ##### 1.0.0 101 | First major release; interface now stable. 102 | 103 | ##### 0.0.4 104 | Dependency bump for React 15.0 now that it has been released. 105 | 106 | ##### 0.0.3 107 | Finalized props signature of `VirtualizedSelect`; changed `rowRenderer` to `optionRenderer` to better align with `react-select` terminology. 108 | 109 | ##### 0.0.2 110 | Moved `react-select` and `react-virtualized` from `peerDependencies` to `dependencies` block. 111 | Updated CommonJS/ES module build to export `VirtualizedSelect` as a default. 112 | 113 | ##### 0.0.1 114 | Initial release. 115 | 116 | ##### 0.0.0 117 | Reserved NPM package name. 118 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | [Bug Reports](#bugs) | [Features Requests](#features) | [Submitting Pull Requests](#pull-requests) | [Running Local Demo](#running-local-demo) | [Running Tests](#running-tests) 2 | 3 | # Contributing to this project 4 | 5 | Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved. 6 | 7 | Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. 8 | In return, they should reciprocate that respect in addressing your issue or assessing patches and features. 9 | 10 | ## Using the issue tracker 11 | 12 | The issue tracker is the preferred channel for bug reports but please respect the following restrictions: 13 | 14 | * Please **do not** use the issue tracker for personal support requests. Use a site like Stack Overflow. 15 | * Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others. 16 | 17 | 18 | ## Bug reports 19 | 20 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 21 | Good bug reports are extremely helpful - thank you! 22 | 23 | Guidelines for bug reports: 24 | 25 | 1. **Use the GitHub issue search** — check if the issue has already been reported. 26 | 2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or development branch in the repository. 27 | 3. **Isolate the problem** — create a [reduced test case](http://css-tricks.com/reduced-test-cases/) and a live example (using a site like [Plunker](http://plnkr.co/)). 28 | 29 | A good bug report shouldn't leave others needing to chase you up for more information. 30 | Please try to be as detailed as possible in your report. 31 | Which versions of formFor and Angular are you using? 32 | What steps will reproduce the issue? What browser(s) and OS experience the problem? 33 | What would you expect to be the outcome? 34 | All these details will help people to fix any potential bugs. 35 | 36 | Example: 37 | 38 | > Short and descriptive example bug report title 39 | > 40 | > A summary of the issue and the browser/OS environment in which it occurs. 41 | > If suitable, include the steps required to reproduce the bug. 42 | > 43 | > 1. This is the first step 44 | > 2. This is the second step 45 | > 3. Further steps, etc. 46 | > 47 | > `` - a link to the reduced test case 48 | > 49 | > Any other information you want to share that is relevant to the issue being reported. 50 | > This might include the lines of code that you have identified as causing the bug, 51 | > and potential solutions (and your opinions on their merits). 52 | 53 | 54 | 55 | ## Feature requests 56 | 57 | Feature requests are welcome. 58 | But take a moment to find out whether your idea fits with the scope and aims of the project. 59 | It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. 60 | Please provide as much detail and context as possible. 61 | 62 | 63 | 64 | ## Pull requests 65 | 66 | Good pull requests - patches, improvements, new features - are a fantastic help. 67 | They should remain focused in scope and avoid containing unrelated commits. 68 | 69 | **Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), 70 | otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project. 71 | 72 | Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). 73 | 74 | Follow this process if you'd like your work considered for inclusion in the project: 75 | 76 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, and configure the remotes: 77 | 78 | ```bash 79 | # Clone your fork of the repo into the current directory 80 | git clone https://github.com//react-virtualized-select 81 | # Navigate to the newly cloned directory 82 | cd react-virtualized-select 83 | # Assign the original repo to a remote called "upstream" 84 | git remote add upstream https://github.com/bvaughn/react-virtualized-select 85 | ``` 86 | 87 | 2. If you cloned a while ago, get the latest changes from upstream: 88 | 89 | ```bash 90 | git checkout master 91 | git pull upstream master 92 | ``` 93 | 94 | 3. Create a new topic branch (off the main project development branch) to 95 | contain your feature, change, or fix: 96 | 97 | ```bash 98 | git checkout -b 99 | ``` 100 | 101 | 4. Commit your changes in logical chunks. 102 | Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 103 | or your code is unlikely be merged into the main project. 104 | Use Git's [interactive rebase](https://help.github.com/articles/interactive-rebase) 105 | feature to tidy up your commits before making them public. 106 | 107 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 108 | 109 | ```bash 110 | git pull [--rebase] upstream master 111 | ``` 112 | 113 | 6. Push your topic branch up to your fork: 114 | 115 | ```bash 116 | git push origin 117 | ``` 118 | 119 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 120 | with a clear title and description. 121 | 122 | **IMPORTANT**: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by this project (MIT). 123 | 124 | 125 | ## Running Local Demo 126 | 127 | You can run the local demo with NPM like so: 128 | 129 | ```bash 130 | cd 131 | npm start 132 | ``` 133 | 134 | The local app will then be available at http://localhost:3001 135 | 136 | 137 | ## Running Tests 138 | 139 | All unit tests must pass before a pull request will be approved. 140 | You can run unit tests with NPM like so: 141 | 142 | ```bash 143 | cd 144 | npm test 145 | ``` 146 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Brian Vaughn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### This component is no longer supported 2 | 3 | Hello! This package is built on [react-virtualized](https://github.com/bvaughn/react-virtualized) (a library that I no longer support) and vesion 1.0 of [react-select](https://github.com/JedWatson/react-select) (which is no longer the current version). As such, I've decided to stop supporting this package. GitHub issues and pull requests may be ignored. 4 | 5 | If you are interested in taking over maintenance of this package, please send me an email (see my GitHub profile) and I'd be happy to add you as a collaborator. 6 | 7 | # React Virtualized Select 8 | 9 | ![NPM version](https://img.shields.io/npm/v/react-virtualized-select.svg?style=flat) 10 | ![NPM license](https://img.shields.io/npm/l/react-virtualized-select.svg?style=flat) 11 | ![NPM total downloads](https://img.shields.io/npm/dt/react-virtualized-select.svg?style=flat) 12 | ![NPM monthly downloads](https://img.shields.io/npm/dm/react-virtualized-select.svg?style=flat) 13 | [![PayPal donate button](https://img.shields.io/badge/paypal-donate-lightgray.svg?style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5CVMYQKVPZC72) 14 | [![Patreon donate button](https://img.shields.io/badge/patreon-donate%20once-lightgray.svg?style=flat)](https://www.patreon.com/user?u=2979769) 15 | 16 | ### Demos available here: http://bvaughn.github.io/react-virtualized-select/ 17 | 18 | ![react-virtualized-select example](https://cloud.githubusercontent.com/assets/29597/14285960/46d733a6-fb02-11e5-884a-e349eb462704.gif) 19 | 20 | ## Getting started 21 | 22 | Install `react-virtualized-select` using npm. 23 | 24 | ```shell 25 | npm install react-virtualized-select --save 26 | ``` 27 | 28 | ES6, CommonJS, and UMD builds are available with each distribution. 29 | For example: 30 | 31 | ```js 32 | // Make sure to import default styles. 33 | // This only needs to be done once; probably during bootstrapping process. 34 | import 'react-select/dist/react-select.css' 35 | import 'react-virtualized-select/styles.css' 36 | 37 | // Then import the virtualized Select HOC 38 | import VirtualizedSelect from 'react-virtualized-select' 39 | ``` 40 | 41 | Alternately you can load a global-friendly UMD build: 42 | 43 | ```html 44 | 45 | 46 | 47 | 48 | 49 | ``` 50 | 51 | ## Example 52 | 53 | _react-select-virtualized_ works just like _react-select_. You pass it an array of options, along with almost any other parameters supported by the [`Select` component](https://github.com/JedWatson/react-select/#usage). 54 | 55 | [Try this example in Code Sandbox.](https://codesandbox.io/s/91p80x10zp) 56 | 57 | ```js 58 | // Import default styles. 59 | // This only needs to be done once; probably during bootstrapping process. 60 | import "react-select/dist/react-select.css"; 61 | import "react-virtualized-select/styles.css"; 62 | 63 | import React from "react"; 64 | import ReactDOM from "react-dom"; 65 | import Select from "react-virtualized-select"; 66 | 67 | // Dummy array of test values. 68 | const options = Array.from(new Array(1000), (_, index) => ({ 69 | label: `Item ${index}`, 70 | value: index 71 | })); 72 | 73 | ReactDOM.render( 74 | this.setState({ multi: event.target.checked })} 77 | type='checkbox' 78 | /> 79 | Multi-select? 80 | 81 | 82 |
  • 83 | 92 |
  • 93 |
  • 94 | 103 |
  • 104 |
  • 105 | 114 |
  • 115 | 116 | 117 |

    118 | Custom Option Renderer 119 |

    120 | 121 |
    122 | Displays a list of world countries using a custom option renderer. 123 |
    124 | 125 | this.setState({ selectedCountry })} 128 | optionRenderer={CountryOptionRenderer} 129 | optionHeight={40} 130 | options={countryData} 131 | simpleValue 132 | value={selectedCountry} 133 | valueKey='code' 134 | /> 135 | 136 |

    137 | Dynamic Height Options 138 |

    139 | 140 |
    141 | Displays option-group headers that are sized different than regular options. 142 | Demonstrates how to use dynamic option heights feature. 143 |
    144 | 145 | this.setState({ selectedName })} 148 | onInputChange={() => this._customOptionHeightsSelect && this._customOptionHeightsSelect.recomputeOptionHeights()} 149 | optionHeight={({ option }) => option.type === 'header' ? 25 : 35} 150 | optionRenderer={NameOptionRenderer} 151 | options={nameData} 152 | ref={(ref) => this._customOptionHeightsSelect = ref} 153 | searchable={searchable} 154 | simpleValue 155 | value={selectedName} 156 | valueKey='name' 157 | /> 158 | 159 |

    160 | Async Options 161 |

    162 | 163 |
    164 | Displays an async Select component wired up to search for GitHub users. 165 |
    166 | 167 | this.setState({ selectedGithubUser })} 174 | onValueClick={this._goToGithubUser} 175 | options={githubUsers} 176 | value={selectedGithubUser} 177 | valueKey='id' 178 | /> 179 | 180 |

    181 | Creatable Options 182 |

    183 | 184 |
    185 | Displays a Select.Creatable component that enables users to create their own options. 186 |
    187 | 188 | this.setState({ selectedCreatable })} 192 | optionHeight={40} 193 | options={creatableOptions} 194 | selectComponent={Creatable} 195 | simpleValue 196 | value={selectedCreatable} 197 | valueKey='value' 198 | /> 199 | 200 | ) 201 | } 202 | 203 | _goToGithubUser (value) { 204 | window.open(value.html_url) 205 | } 206 | 207 | _loadGithubUsers (input) { 208 | return fetch(`https://api.github.com/search/users?q=${input}`) 209 | .then((response) => response.json()) 210 | .then((json) => { 211 | const githubUsers = json.items 212 | 213 | this.setState({ githubUsers }) 214 | 215 | return { options: githubUsers } 216 | }) 217 | } 218 | } 219 | 220 | function CountryOptionRenderer ({ focusedOption, focusedOptionIndex, focusOption, key, labelKey, option, options, selectValue, style, valueArray, valueKey }) { 221 | const flagImageUrl = `https://cdn.rawgit.com/hjnilsson/country-flags/9e827754/svg/${option.code.toLowerCase()}.svg` 222 | 223 | const classNames = [styles.countryOption] 224 | if (option === focusedOption) { 225 | classNames.push(styles.countryOptionFocused) 226 | } 227 | if (valueArray.indexOf(option) >= 0) { 228 | classNames.push(styles.countryOptionSelected) 229 | } 230 | 231 | return ( 232 |
    selectValue(option)} 236 | onMouseEnter={() => focusOption(option)} 237 | style={style} 238 | > 239 | 242 | 246 |
    247 | ) 248 | } 249 | 250 | function NameOptionRenderer ({ focusedOption, focusedOptionIndex, focusOption, key, labelKey, option, optionIndex, options, selectValue, style, valueArray, valueKey }) { 251 | const classNames = [styles.nameOption] 252 | 253 | if (option.type === 'header') { 254 | classNames.push(styles.nameHeader) 255 | 256 | return ( 257 |
    262 | {option.name} 263 |
    264 | ) 265 | } else { 266 | if (option === focusedOption) { 267 | classNames.push(styles.nameOptionFocused) 268 | } 269 | if (valueArray.indexOf(option) >= 0) { 270 | classNames.push(styles.nameOptionSelected) 271 | } 272 | 273 | return ( 274 |
    selectValue(option)} 278 | onMouseEnter={() => focusOption(option)} 279 | style={style} 280 | > 281 | {option.name} 282 |
    283 | ) 284 | } 285 | } 286 | -------------------------------------------------------------------------------- /source/VirtualizedSelect/VirtualizedSelect.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | import PropTypes from 'prop-types' 3 | import React, { Component } from 'react' 4 | import Select from 'react-select' 5 | 6 | // Import directly to avoid Webpack bundling the parts of react-virtualized that we are not using 7 | import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer' 8 | import List from 'react-virtualized/dist/commonjs/List' 9 | 10 | export default class VirtualizedSelect extends Component { 11 | 12 | static propTypes = { 13 | async: PropTypes.bool, 14 | listProps: PropTypes.object, 15 | maxHeight: PropTypes.number, 16 | optionHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), 17 | optionRenderer: PropTypes.func, 18 | selectComponent: PropTypes.func 19 | }; 20 | 21 | static defaultProps = { 22 | async: false, 23 | maxHeight: 200, 24 | optionHeight: 35 25 | }; 26 | 27 | constructor (props, context) { 28 | super(props, context) 29 | 30 | this._renderMenu = this._renderMenu.bind(this) 31 | this._optionRenderer = this._optionRenderer.bind(this) 32 | this._setListRef = this._setListRef.bind(this) 33 | this._setSelectRef = this._setSelectRef.bind(this) 34 | } 35 | 36 | /** See List#recomputeRowHeights */ 37 | recomputeOptionHeights (index = 0) { 38 | if (this._listRef) { 39 | this._listRef.recomputeRowHeights(index) 40 | } 41 | } 42 | 43 | /** See Select#focus (in react-select) */ 44 | focus () { 45 | if (this._selectRef) { 46 | return this._selectRef.focus() 47 | } 48 | } 49 | 50 | render () { 51 | const SelectComponent = this._getSelectComponent() 52 | 53 | return ( 54 | 60 | ) 61 | } 62 | 63 | // See https://github.com/JedWatson/react-select/#effeciently-rendering-large-lists-with-windowing 64 | _renderMenu ({ focusedOption, focusOption, labelKey, onSelect, options, selectValue, valueArray, valueKey }) { 65 | const { listProps, optionRenderer } = this.props 66 | const focusedOptionIndex = options.indexOf(focusedOption) 67 | const height = this._calculateListHeight({ options }) 68 | const innerRowRenderer = optionRenderer || this._optionRenderer 69 | 70 | // react-select 1.0.0-rc2 passes duplicate `onSelect` and `selectValue` props to `menuRenderer` 71 | // The `Creatable` HOC only overrides `onSelect` which breaks an edge-case 72 | // In order to support creating items via clicking on the placeholder option, 73 | // We need to ensure that the specified `onSelect` handle is the one we use. 74 | // See issue #33 75 | 76 | function wrappedRowRenderer ({ index, key, style }) { 77 | const option = options[index] 78 | 79 | return innerRowRenderer({ 80 | focusedOption, 81 | focusedOptionIndex, 82 | focusOption, 83 | key, 84 | labelKey, 85 | onSelect, 86 | option, 87 | optionIndex: index, 88 | options, 89 | selectValue: onSelect, 90 | style, 91 | valueArray, 92 | valueKey 93 | }) 94 | } 95 | 96 | return ( 97 | 98 | {({ width }) => ( 99 | this._getOptionHeight({ 105 | option: options[index] 106 | })} 107 | rowRenderer={wrappedRowRenderer} 108 | scrollToIndex={focusedOptionIndex} 109 | width={width} 110 | {...listProps} 111 | /> 112 | )} 113 | 114 | ) 115 | } 116 | 117 | _calculateListHeight ({ options }) { 118 | const { maxHeight } = this.props 119 | 120 | let height = 0 121 | 122 | for (let optionIndex = 0; optionIndex < options.length; optionIndex++) { 123 | let option = options[optionIndex] 124 | 125 | height += this._getOptionHeight({ option }) 126 | 127 | if (height > maxHeight) { 128 | return maxHeight 129 | } 130 | } 131 | 132 | return height 133 | } 134 | 135 | _getOptionHeight ({ option }) { 136 | const { optionHeight } = this.props 137 | 138 | return optionHeight instanceof Function 139 | ? optionHeight({ option }) 140 | : optionHeight 141 | } 142 | 143 | _getSelectComponent () { 144 | const { async, selectComponent } = this.props 145 | 146 | if (selectComponent) { 147 | return selectComponent 148 | } else if (async) { 149 | return Select.Async 150 | } else { 151 | return Select 152 | } 153 | } 154 | 155 | _optionRenderer ({ focusedOption, focusOption, key, labelKey, option, selectValue, style, valueArray }) { 156 | const className = ['VirtualizedSelectOption'] 157 | 158 | if (option === focusedOption) { 159 | className.push('VirtualizedSelectFocusedOption') 160 | } 161 | 162 | if (option.disabled) { 163 | className.push('VirtualizedSelectDisabledOption') 164 | } 165 | 166 | if (valueArray && valueArray.indexOf(option) >= 0) { 167 | className.push('VirtualizedSelectSelectedOption') 168 | } 169 | 170 | if (option.className) { 171 | className.push(option.className) 172 | } 173 | 174 | const events = option.disabled 175 | ? {} 176 | : { 177 | onClick: () => selectValue(option), 178 | onMouseEnter: () => focusOption(option) 179 | } 180 | 181 | return ( 182 |
    189 | {option[labelKey]} 190 |
    191 | ) 192 | } 193 | 194 | _setListRef (ref) { 195 | this._listRef = ref 196 | } 197 | 198 | _setSelectRef (ref) { 199 | this._selectRef = ref 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /source/VirtualizedSelect/index.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | export default from './VirtualizedSelect' 3 | -------------------------------------------------------------------------------- /source/demo/Application.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; 3 | font-size: 14px; 4 | margin: 0; 5 | padding: 0; 6 | } 7 | 8 | * { 9 | box-sizing: border-box; 10 | } 11 | 12 | a { 13 | color: #2196f3; 14 | } 15 | a:hover { 16 | text-decoration: none; 17 | } 18 | 19 | .header { 20 | background-color: #2196f3; 21 | color: rgba(255, 255, 255, .85); 22 | margin: 0; 23 | padding: 1rem 0; 24 | } 25 | 26 | .subHeader { 27 | background-color: rgba(0, 126, 255, 0.1); 28 | padding: 1rem; 29 | } 30 | 31 | h1 { 32 | color: #fff; 33 | } 34 | 35 | .container { 36 | width: 800px; 37 | max-width: 100%; 38 | margin: .5rem auto 0; 39 | padding: 0 1rem; 40 | } 41 | .container:first-of-type { 42 | margin-top: 0; 43 | } 44 | 45 | .headerLink { 46 | color: #fff; 47 | } 48 | -------------------------------------------------------------------------------- /source/demo/Application.js: -------------------------------------------------------------------------------- 1 | // Polyfill a full ES6 environment 2 | import 'babel-polyfill' 3 | 4 | import React, { Component } from 'react' 5 | import ReactDOM from 'react-dom' 6 | import VirtualizedSelectExample from '../VirtualizedSelect/VirtualizedSelect.example' 7 | import cityData from './data/cities.js' 8 | import countryData from './data/countries.js' 9 | import nameData from './data/names.js' 10 | import styles from './Application.css' 11 | import '../../styles.css' 12 | 13 | class Application extends Component { 14 | render () { 15 | return ( 16 |
    17 |
    18 |

    19 | React Virtualized Select 20 |

    21 | 22 |
    23 | Enjoy drop-down menus powered by @JedWatson's react-select and 24 | efficient windowing brought to you by @bvaughn's react-virtualized. 25 |
    26 | 27 |
    28 | Docs and code on GitHub. 29 |
    30 |
    31 | 32 |
    33 | 38 |
    39 |
    40 | ) 41 | } 42 | } 43 | 44 | ReactDOM.render( 45 | , 46 | document.getElementById('root') 47 | ) 48 | 49 | // Import and attach the favicon 50 | document.querySelector('[rel="shortcut icon"]').href = require('file!./favicon.png') 51 | -------------------------------------------------------------------------------- /source/demo/data/cities.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { name: 'Abilene' }, 3 | { name: 'Addison' }, 4 | { name: 'Akron' }, 5 | { name: 'Alameda' }, 6 | { name: 'Albany' }, 7 | { name: 'Albuquerque' }, 8 | { name: 'Alexandria' }, 9 | { name: 'Alhambra' }, 10 | { name: 'Aliso Viejo' }, 11 | { name: 'Allen' }, 12 | { name: 'Allentown' }, 13 | { name: 'Alpharetta' }, 14 | { name: 'Altamonte Springs' }, 15 | { name: 'Altoona' }, 16 | { name: 'Amarillo' }, 17 | { name: 'Ames' }, 18 | { name: 'Anaheim' }, 19 | { name: 'Anchorage' }, 20 | { name: 'Anderson' }, 21 | { name: 'Ankeny' }, 22 | { name: 'Ann Arbor' }, 23 | { name: 'Annapolis' }, 24 | { name: 'Antioch' }, 25 | { name: 'Apache Junction' }, 26 | { name: 'Apex' }, 27 | { name: 'Apopka' }, 28 | { name: 'Apple Valley' }, 29 | { name: 'Appleton' }, 30 | { name: 'Arcadia' }, 31 | { name: 'Arlington' }, 32 | { name: 'Arlington Heights' }, 33 | { name: 'Arvada' }, 34 | { name: 'Asheville' }, 35 | { name: 'Athens-Clarke County' }, 36 | { name: 'Atlanta' }, 37 | { name: 'Atlantic City' }, 38 | { name: 'Attleboro' }, 39 | { name: 'Auburn' }, 40 | { name: 'Augusta-Richmond County' }, 41 | { name: 'Aurora' }, 42 | { name: 'Austin' }, 43 | { name: 'Aventura' }, 44 | { name: 'Avondale' }, 45 | { name: 'Azusa' }, 46 | { name: 'Bakersfield' }, 47 | { name: 'Baldwin Park' }, 48 | { name: 'Baltimore' }, 49 | { name: 'Barnstable Town' }, 50 | { name: 'Bartlett' }, 51 | { name: 'Baton Rouge' }, 52 | { name: 'Battle Creek' }, 53 | { name: 'Bayonne' }, 54 | { name: 'Baytown' }, 55 | { name: 'Beaumont' }, 56 | { name: 'Beavercreek' }, 57 | { name: 'Beaverton' }, 58 | { name: 'Bedford' }, 59 | { name: 'Bell Gardens' }, 60 | { name: 'Belleville' }, 61 | { name: 'Bellevue' }, 62 | { name: 'Bellflower' }, 63 | { name: 'Bellingham' }, 64 | { name: 'Beloit' }, 65 | { name: 'Bend' }, 66 | { name: 'Bentonville' }, 67 | { name: 'Berkeley' }, 68 | { name: 'Berwyn' }, 69 | { name: 'Bethlehem' }, 70 | { name: 'Beverly' }, 71 | { name: 'Billings' }, 72 | { name: 'Biloxi' }, 73 | { name: 'Binghamton' }, 74 | { name: 'Birmingham' }, 75 | { name: 'Bismarck' }, 76 | { name: 'Blacksburg' }, 77 | { name: 'Blaine' }, 78 | { name: 'Bloomington' }, 79 | { name: 'Blue Springs' }, 80 | { name: 'Boca Raton' }, 81 | { name: 'Boise City' }, 82 | { name: 'Bolingbrook' }, 83 | { name: 'Bonita Springs' }, 84 | { name: 'Bossier City' }, 85 | { name: 'Boston' }, 86 | { name: 'Boulder' }, 87 | { name: 'Bountiful' }, 88 | { name: 'Bowie' }, 89 | { name: 'Bowling Green' }, 90 | { name: 'Boynton Beach' }, 91 | { name: 'Bozeman' }, 92 | { name: 'Bradenton' }, 93 | { name: 'Brea' }, 94 | { name: 'Bremerton' }, 95 | { name: 'Brentwood' }, 96 | { name: 'Bridgeport' }, 97 | { name: 'Bristol' }, 98 | { name: 'Brockton' }, 99 | { name: 'Broken Arrow' }, 100 | { name: 'Brookfield' }, 101 | { name: 'Brookhaven' }, 102 | { name: 'Brooklyn Park' }, 103 | { name: 'Broomfield' }, 104 | { name: 'Brownsville' }, 105 | { name: 'Bryan' }, 106 | { name: 'Buckeye' }, 107 | { name: 'Buena Park' }, 108 | { name: 'Buffalo' }, 109 | { name: 'Buffalo Grove' }, 110 | { name: 'Bullhead City' }, 111 | { name: 'Burbank' }, 112 | { name: 'Burien' }, 113 | { name: 'Burleson' }, 114 | { name: 'Burlington' }, 115 | { name: 'Burnsville' }, 116 | { name: 'Caldwell' }, 117 | { name: 'Calexico' }, 118 | { name: 'Calumet City' }, 119 | { name: 'Camarillo' }, 120 | { name: 'Cambridge' }, 121 | { name: 'Camden' }, 122 | { name: 'Campbell' }, 123 | { name: 'Canton' }, 124 | { name: 'Cape Coral' }, 125 | { name: 'Cape Girardeau' }, 126 | { name: 'Carlsbad' }, 127 | { name: 'Carmel' }, 128 | { name: 'Carol Stream' }, 129 | { name: 'Carpentersville' }, 130 | { name: 'Carrollton' }, 131 | { name: 'Carson' }, 132 | { name: 'Carson City' }, 133 | { name: 'Cary' }, 134 | { name: 'Casa Grande' }, 135 | { name: 'Casper' }, 136 | { name: 'Castle Rock' }, 137 | { name: 'Cathedral City' }, 138 | { name: 'Cedar Falls' }, 139 | { name: 'Cedar Hill' }, 140 | { name: 'Cedar Park' }, 141 | { name: 'Cedar Rapids' }, 142 | { name: 'Centennial' }, 143 | { name: 'Ceres' }, 144 | { name: 'Cerritos' }, 145 | { name: 'Champaign' }, 146 | { name: 'Chandler' }, 147 | { name: 'Chapel Hill' }, 148 | { name: 'Charleston' }, 149 | { name: 'Charlotte' }, 150 | { name: 'Charlottesville' }, 151 | { name: 'Chattanooga' }, 152 | { name: 'Chelsea' }, 153 | { name: 'Chesapeake' }, 154 | { name: 'Chesterfield' }, 155 | { name: 'Cheyenne' }, 156 | { name: 'Chicago' }, 157 | { name: 'Chico' }, 158 | { name: 'Chicopee' }, 159 | { name: 'Chino' }, 160 | { name: 'Chino Hills' }, 161 | { name: 'Chula Vista' }, 162 | { name: 'Cicero' }, 163 | { name: 'Cincinnati' }, 164 | { name: 'Citrus Heights' }, 165 | { name: 'Clarksville' }, 166 | { name: 'Clearwater' }, 167 | { name: 'Cleveland' }, 168 | { name: 'Cleveland Heights' }, 169 | { name: 'Clifton' }, 170 | { name: 'Clovis' }, 171 | { name: 'Coachella' }, 172 | { name: 'Coconut Creek' }, 173 | { name: "Coeur d'Alene" }, 174 | { name: 'College Station' }, 175 | { name: 'Collierville' }, 176 | { name: 'Colorado Springs' }, 177 | { name: 'Colton' }, 178 | { name: 'Columbia' }, 179 | { name: 'Columbus' }, 180 | { name: 'Commerce City' }, 181 | { name: 'Compton' }, 182 | { name: 'Concord' }, 183 | { name: 'Conroe' }, 184 | { name: 'Conway' }, 185 | { name: 'Coon Rapids' }, 186 | { name: 'Coppell' }, 187 | { name: 'Coral Gables' }, 188 | { name: 'Coral Springs' }, 189 | { name: 'Corona' }, 190 | { name: 'Corpus Christi' }, 191 | { name: 'Corvallis' }, 192 | { name: 'Costa Mesa' }, 193 | { name: 'Council Bluffs' }, 194 | { name: 'Covina' }, 195 | { name: 'Covington' }, 196 | { name: 'Cranston' }, 197 | { name: 'Crystal Lake' }, 198 | { name: 'Culver City' }, 199 | { name: 'Cupertino' }, 200 | { name: 'Cutler Bay' }, 201 | { name: 'Cuyahoga Falls' }, 202 | { name: 'Cypress' }, 203 | { name: 'Dallas' }, 204 | { name: 'Daly City' }, 205 | { name: 'Danbury' }, 206 | { name: 'Danville' }, 207 | { name: 'Davenport' }, 208 | { name: 'Davie' }, 209 | { name: 'Davis' }, 210 | { name: 'Dayton' }, 211 | { name: 'Daytona Beach' }, 212 | { name: 'DeKalb' }, 213 | { name: 'DeSoto' }, 214 | { name: 'Dearborn' }, 215 | { name: 'Dearborn Heights' }, 216 | { name: 'Decatur' }, 217 | { name: 'Deerfield Beach' }, 218 | { name: 'Delano' }, 219 | { name: 'Delray Beach' }, 220 | { name: 'Deltona' }, 221 | { name: 'Denton' }, 222 | { name: 'Denver' }, 223 | { name: 'Des Moines' }, 224 | { name: 'Des Plaines' }, 225 | { name: 'Detroit' }, 226 | { name: 'Diamond Bar' }, 227 | { name: 'Doral' }, 228 | { name: 'Dothan' }, 229 | { name: 'Dover' }, 230 | { name: 'Downers Grove' }, 231 | { name: 'Downey' }, 232 | { name: 'Draper' }, 233 | { name: 'Dublin' }, 234 | { name: 'Dubuque' }, 235 | { name: 'Duluth' }, 236 | { name: 'Duncanville' }, 237 | { name: 'Dunwoody' }, 238 | { name: 'Durham' }, 239 | { name: 'Eagan' }, 240 | { name: 'East Lansing' }, 241 | { name: 'East Orange' }, 242 | { name: 'East Providence' }, 243 | { name: 'Eastvale' }, 244 | { name: 'Eau Claire' }, 245 | { name: 'Eden Prairie' }, 246 | { name: 'Edina' }, 247 | { name: 'Edinburg' }, 248 | { name: 'Edmond' }, 249 | { name: 'Edmonds' }, 250 | { name: 'El Cajon' }, 251 | { name: 'El Centro' }, 252 | { name: 'El Monte' }, 253 | { name: 'El Paso' }, 254 | { name: 'Elgin' }, 255 | { name: 'Elizabeth' }, 256 | { name: 'Elk Grove' }, 257 | { name: 'Elkhart' }, 258 | { name: 'Elmhurst' }, 259 | { name: 'Elyria' }, 260 | { name: 'Encinitas' }, 261 | { name: 'Enid' }, 262 | { name: 'Erie' }, 263 | { name: 'Escondido' }, 264 | { name: 'Euclid' }, 265 | { name: 'Eugene' }, 266 | { name: 'Euless' }, 267 | { name: 'Evanston' }, 268 | { name: 'Evansville' }, 269 | { name: 'Everett' }, 270 | { name: 'Fairfield' }, 271 | { name: 'Fall River' }, 272 | { name: 'Fargo' }, 273 | { name: 'Farmington' }, 274 | { name: 'Farmington Hills' }, 275 | { name: 'Fayetteville' }, 276 | { name: 'Federal Way' }, 277 | { name: 'Findlay' }, 278 | { name: 'Fishers' }, 279 | { name: 'Fitchburg' }, 280 | { name: 'Flagstaff' }, 281 | { name: 'Flint' }, 282 | { name: 'Florence' }, 283 | { name: 'Florissant' }, 284 | { name: 'Flower Mound' }, 285 | { name: 'Folsom' }, 286 | { name: 'Fond du Lac' }, 287 | { name: 'Fontana' }, 288 | { name: 'Fort Collins' }, 289 | { name: 'Fort Lauderdale' }, 290 | { name: 'Fort Myers' }, 291 | { name: 'Fort Pierce' }, 292 | { name: 'Fort Smith' }, 293 | { name: 'Fort Wayne' }, 294 | { name: 'Fort Worth' }, 295 | { name: 'Fountain Valley' }, 296 | { name: 'Franklin' }, 297 | { name: 'Frederick' }, 298 | { name: 'Freeport' }, 299 | { name: 'Fremont' }, 300 | { name: 'Fresno' }, 301 | { name: 'Friendswood' }, 302 | { name: 'Frisco' }, 303 | { name: 'Fullerton' }, 304 | { name: 'Gainesville' }, 305 | { name: 'Gaithersburg' }, 306 | { name: 'Galveston' }, 307 | { name: 'Garden Grove' }, 308 | { name: 'Gardena' }, 309 | { name: 'Garland' }, 310 | { name: 'Gary' }, 311 | { name: 'Gastonia' }, 312 | { name: 'Georgetown' }, 313 | { name: 'Germantown' }, 314 | { name: 'Gilbert' }, 315 | { name: 'Gilroy' }, 316 | { name: 'Glendale' }, 317 | { name: 'Glendora' }, 318 | { name: 'Glenview' }, 319 | { name: 'Goodyear' }, 320 | { name: 'Goose Creek' }, 321 | { name: 'Grand Forks' }, 322 | { name: 'Grand Island' }, 323 | { name: 'Grand Junction' }, 324 | { name: 'Grand Prairie' }, 325 | { name: 'Grand Rapids' }, 326 | { name: 'Grapevine' }, 327 | { name: 'Great Falls' }, 328 | { name: 'Greeley' }, 329 | { name: 'Green Bay' }, 330 | { name: 'Greenacres' }, 331 | { name: 'Greenfield' }, 332 | { name: 'Greensboro' }, 333 | { name: 'Greenville' }, 334 | { name: 'Greenwood' }, 335 | { name: 'Gresham' }, 336 | { name: 'Grove City' }, 337 | { name: 'Gulfport' }, 338 | { name: 'Hackensack' }, 339 | { name: 'Hagerstown' }, 340 | { name: 'Hallandale Beach' }, 341 | { name: 'Haltom City' }, 342 | { name: 'Hamilton' }, 343 | { name: 'Hammond' }, 344 | { name: 'Hampton' }, 345 | { name: 'Hanford' }, 346 | { name: 'Hanover Park' }, 347 | { name: 'Harlingen' }, 348 | { name: 'Harrisburg' }, 349 | { name: 'Harrisonburg' }, 350 | { name: 'Hartford' }, 351 | { name: 'Hattiesburg' }, 352 | { name: 'Haverhill' }, 353 | { name: 'Hawthorne' }, 354 | { name: 'Hayward' }, 355 | { name: 'Hemet' }, 356 | { name: 'Hempstead' }, 357 | { name: 'Henderson' }, 358 | { name: 'Hendersonville' }, 359 | { name: 'Hesperia' }, 360 | { name: 'Hialeah' }, 361 | { name: 'Hickory' }, 362 | { name: 'High Point' }, 363 | { name: 'Highland' }, 364 | { name: 'Hillsboro' }, 365 | { name: 'Hilton Head Island' }, 366 | { name: 'Hoboken' }, 367 | { name: 'Hoffman Estates' }, 368 | { name: 'Hollywood' }, 369 | { name: 'Holyoke' }, 370 | { name: 'Homestead' }, 371 | { name: 'Honolulu' }, 372 | { name: 'Hoover' }, 373 | { name: 'Houston' }, 374 | { name: 'Huber Heights' }, 375 | { name: 'Huntersville' }, 376 | { name: 'Huntington' }, 377 | { name: 'Huntington Beach' }, 378 | { name: 'Huntington Park' }, 379 | { name: 'Huntsville' }, 380 | { name: 'Hurst' }, 381 | { name: 'Hutchinson' }, 382 | { name: 'Idaho Falls' }, 383 | { name: 'Independence' }, 384 | { name: 'Indianapolis' }, 385 | { name: 'Indio' }, 386 | { name: 'Inglewood' }, 387 | { name: 'Iowa City' }, 388 | { name: 'Irvine' }, 389 | { name: 'Irving' }, 390 | { name: 'Jackson' }, 391 | { name: 'Jacksonville' }, 392 | { name: 'Janesville' }, 393 | { name: 'Jefferson City' }, 394 | { name: 'Jeffersonville' }, 395 | { name: 'Jersey City' }, 396 | { name: 'Johns Creek' }, 397 | { name: 'Johnson City' }, 398 | { name: 'Joliet' }, 399 | { name: 'Jonesboro' }, 400 | { name: 'Joplin' }, 401 | { name: 'Jupiter' }, 402 | { name: 'Jurupa Valley' }, 403 | { name: 'Kalamazoo' }, 404 | { name: 'Kannapolis' }, 405 | { name: 'Kansas City' }, 406 | { name: 'Kearny' }, 407 | { name: 'Keizer' }, 408 | { name: 'Keller' }, 409 | { name: 'Kenner' }, 410 | { name: 'Kennewick' }, 411 | { name: 'Kenosha' }, 412 | { name: 'Kent' }, 413 | { name: 'Kentwood' }, 414 | { name: 'Kettering' }, 415 | { name: 'Killeen' }, 416 | { name: 'Kingsport' }, 417 | { name: 'Kirkland' }, 418 | { name: 'Kissimmee' }, 419 | { name: 'Knoxville' }, 420 | { name: 'Kokomo' }, 421 | { name: 'La Crosse' }, 422 | { name: 'La Habra' }, 423 | { name: 'La Mesa' }, 424 | { name: 'La Mirada' }, 425 | { name: 'La Puente' }, 426 | { name: 'La Quinta' }, 427 | { name: 'Lacey' }, 428 | { name: 'Lafayette' }, 429 | { name: 'Laguna Niguel' }, 430 | { name: 'Lake Charles' }, 431 | { name: 'Lake Elsinore' }, 432 | { name: 'Lake Forest' }, 433 | { name: 'Lake Havasu City' }, 434 | { name: 'Lake Oswego' }, 435 | { name: 'Lakeland' }, 436 | { name: 'Lakeville' }, 437 | { name: 'Lakewood' }, 438 | { name: 'Lancaster' }, 439 | { name: 'Lansing' }, 440 | { name: 'Laredo' }, 441 | { name: 'Largo' }, 442 | { name: 'Las Cruces' }, 443 | { name: 'Las Vegas' }, 444 | { name: 'Lauderhill' }, 445 | { name: 'Lawrence' }, 446 | { name: 'Lawton' }, 447 | { name: 'Layton' }, 448 | { name: 'League City' }, 449 | { name: "Lee's Summit" }, 450 | { name: 'Leesburg' }, 451 | { name: 'Lehi' }, 452 | { name: 'Lenexa' }, 453 | { name: 'Leominster' }, 454 | { name: 'Lewisville' }, 455 | { name: 'Lexington-Fayette' }, 456 | { name: 'Lima' }, 457 | { name: 'Lincoln' }, 458 | { name: 'Lincoln Park' }, 459 | { name: 'Linden' }, 460 | { name: 'Little Rock' }, 461 | { name: 'Littleton' }, 462 | { name: 'Livermore' }, 463 | { name: 'Livonia' }, 464 | { name: 'Lodi' }, 465 | { name: 'Logan' }, 466 | { name: 'Lombard' }, 467 | { name: 'Lompoc' }, 468 | { name: 'Long Beach' }, 469 | { name: 'Longmont' }, 470 | { name: 'Longview' }, 471 | { name: 'Lorain' }, 472 | { name: 'Los Angeles' }, 473 | { name: 'Louisville/Jefferson County' }, 474 | { name: 'Loveland' }, 475 | { name: 'Lowell' }, 476 | { name: 'Lubbock' }, 477 | { name: 'Lynchburg' }, 478 | { name: 'Lynn' }, 479 | { name: 'Lynwood' }, 480 | { name: 'Macon' }, 481 | { name: 'Madera' }, 482 | { name: 'Madison' }, 483 | { name: 'Malden' }, 484 | { name: 'Manassas' }, 485 | { name: 'Manchester' }, 486 | { name: 'Manhattan' }, 487 | { name: 'Mankato' }, 488 | { name: 'Mansfield' }, 489 | { name: 'Manteca' }, 490 | { name: 'Maple Grove' }, 491 | { name: 'Maplewood' }, 492 | { name: 'Marana' }, 493 | { name: 'Margate' }, 494 | { name: 'Maricopa' }, 495 | { name: 'Marietta' }, 496 | { name: 'Marlborough' }, 497 | { name: 'Martinez' }, 498 | { name: 'Marysville' }, 499 | { name: 'McAllen' }, 500 | { name: 'McKinney' }, 501 | { name: 'Medford' }, 502 | { name: 'Melbourne' }, 503 | { name: 'Memphis' }, 504 | { name: 'Menifee' }, 505 | { name: 'Mentor' }, 506 | { name: 'Merced' }, 507 | { name: 'Meriden' }, 508 | { name: 'Meridian' }, 509 | { name: 'Mesa' }, 510 | { name: 'Mesquite' }, 511 | { name: 'Methuen' }, 512 | { name: 'Miami' }, 513 | { name: 'Miami Beach' }, 514 | { name: 'Miami Gardens' }, 515 | { name: 'Middletown' }, 516 | { name: 'Midland' }, 517 | { name: 'Midwest City' }, 518 | { name: 'Milford' }, 519 | { name: 'Milpitas' }, 520 | { name: 'Milwaukee' }, 521 | { name: 'Minneapolis' }, 522 | { name: 'Minnetonka' }, 523 | { name: 'Minot' }, 524 | { name: 'Miramar' }, 525 | { name: 'Mishawaka' }, 526 | { name: 'Mission' }, 527 | { name: 'Mission Viejo' }, 528 | { name: 'Missoula' }, 529 | { name: 'Missouri City' }, 530 | { name: 'Mobile' }, 531 | { name: 'Modesto' }, 532 | { name: 'Moline' }, 533 | { name: 'Monroe' }, 534 | { name: 'Monrovia' }, 535 | { name: 'Montclair' }, 536 | { name: 'Montebello' }, 537 | { name: 'Monterey Park' }, 538 | { name: 'Montgomery' }, 539 | { name: 'Moore' }, 540 | { name: 'Moorhead' }, 541 | { name: 'Moreno Valley' }, 542 | { name: 'Morgan Hill' }, 543 | { name: 'Mount Pleasant' }, 544 | { name: 'Mount Prospect' }, 545 | { name: 'Mount Vernon' }, 546 | { name: 'Mountain View' }, 547 | { name: 'Muncie' }, 548 | { name: 'Murfreesboro' }, 549 | { name: 'Murray' }, 550 | { name: 'Murrieta' }, 551 | { name: 'Muskegon' }, 552 | { name: 'Muskogee' }, 553 | { name: 'Nampa' }, 554 | { name: 'Napa' }, 555 | { name: 'Naperville' }, 556 | { name: 'Nashua' }, 557 | { name: 'Nashville-Davidson' }, 558 | { name: 'National City' }, 559 | { name: 'New Bedford' }, 560 | { name: 'New Berlin' }, 561 | { name: 'New Braunfels' }, 562 | { name: 'New Britain' }, 563 | { name: 'New Brunswick' }, 564 | { name: 'New Haven' }, 565 | { name: 'New Orleans' }, 566 | { name: 'New Rochelle' }, 567 | { name: 'New York' }, 568 | { name: 'Newark' }, 569 | { name: 'Newport Beach' }, 570 | { name: 'Newport News' }, 571 | { name: 'Newton' }, 572 | { name: 'Niagara Falls' }, 573 | { name: 'Noblesville' }, 574 | { name: 'Norfolk' }, 575 | { name: 'Normal' }, 576 | { name: 'Norman' }, 577 | { name: 'North Charleston' }, 578 | { name: 'North Las Vegas' }, 579 | { name: 'North Lauderdale' }, 580 | { name: 'North Little Rock' }, 581 | { name: 'North Miami' }, 582 | { name: 'North Miami Beach' }, 583 | { name: 'North Port' }, 584 | { name: 'North Richland Hills' }, 585 | { name: 'Northglenn' }, 586 | { name: 'Norwalk' }, 587 | { name: 'Norwich' }, 588 | { name: 'Novato' }, 589 | { name: 'Novi' }, 590 | { name: "O'Fallon" }, 591 | { name: 'Oak Lawn' }, 592 | { name: 'Oak Park' }, 593 | { name: 'Oakland' }, 594 | { name: 'Oakland Park' }, 595 | { name: 'Oakley' }, 596 | { name: 'Ocala' }, 597 | { name: 'Oceanside' }, 598 | { name: 'Ocoee' }, 599 | { name: 'Odessa' }, 600 | { name: 'Ogden' }, 601 | { name: 'Oklahoma City' }, 602 | { name: 'Olathe' }, 603 | { name: 'Olympia' }, 604 | { name: 'Omaha' }, 605 | { name: 'Ontario' }, 606 | { name: 'Orange' }, 607 | { name: 'Orem' }, 608 | { name: 'Orland Park' }, 609 | { name: 'Orlando' }, 610 | { name: 'Ormond Beach' }, 611 | { name: 'Oro Valley' }, 612 | { name: 'Oshkosh' }, 613 | { name: 'Overland Park' }, 614 | { name: 'Owensboro' }, 615 | { name: 'Oxnard' }, 616 | { name: 'Pacifica' }, 617 | { name: 'Palatine' }, 618 | { name: 'Palm Bay' }, 619 | { name: 'Palm Beach Gardens' }, 620 | { name: 'Palm Coast' }, 621 | { name: 'Palm Desert' }, 622 | { name: 'Palm Springs' }, 623 | { name: 'Palmdale' }, 624 | { name: 'Palo Alto' }, 625 | { name: 'Panama City' }, 626 | { name: 'Paramount' }, 627 | { name: 'Park Ridge' }, 628 | { name: 'Parker' }, 629 | { name: 'Parma' }, 630 | { name: 'Pasadena' }, 631 | { name: 'Pasco' }, 632 | { name: 'Passaic' }, 633 | { name: 'Paterson' }, 634 | { name: 'Pawtucket' }, 635 | { name: 'Peabody' }, 636 | { name: 'Peachtree Corners' }, 637 | { name: 'Pearland' }, 638 | { name: 'Pembroke Pines' }, 639 | { name: 'Pensacola' }, 640 | { name: 'Peoria' }, 641 | { name: 'Perris' }, 642 | { name: 'Perth Amboy' }, 643 | { name: 'Petaluma' }, 644 | { name: 'Pflugerville' }, 645 | { name: 'Pharr' }, 646 | { name: 'Phenix City' }, 647 | { name: 'Philadelphia' }, 648 | { name: 'Phoenix' }, 649 | { name: 'Pico Rivera' }, 650 | { name: 'Pine Bluff' }, 651 | { name: 'Pinellas Park' }, 652 | { name: 'Pittsburg' }, 653 | { name: 'Pittsburgh' }, 654 | { name: 'Pittsfield' }, 655 | { name: 'Placentia' }, 656 | { name: 'Plainfield' }, 657 | { name: 'Plano' }, 658 | { name: 'Plantation' }, 659 | { name: 'Pleasanton' }, 660 | { name: 'Plymouth' }, 661 | { name: 'Pocatello' }, 662 | { name: 'Pomona' }, 663 | { name: 'Pompano Beach' }, 664 | { name: 'Pontiac' }, 665 | { name: 'Port Arthur' }, 666 | { name: 'Port Orange' }, 667 | { name: 'Port St. Lucie' }, 668 | { name: 'Portage' }, 669 | { name: 'Porterville' }, 670 | { name: 'Portland' }, 671 | { name: 'Portsmouth' }, 672 | { name: 'Poway' }, 673 | { name: 'Prescott' }, 674 | { name: 'Prescott Valley' }, 675 | { name: 'Providence' }, 676 | { name: 'Provo' }, 677 | { name: 'Pueblo' }, 678 | { name: 'Puyallup' }, 679 | { name: 'Quincy' }, 680 | { name: 'Racine' }, 681 | { name: 'Raleigh' }, 682 | { name: 'Rancho Cordova' }, 683 | { name: 'Rancho Cucamonga' }, 684 | { name: 'Rancho Palos Verdes' }, 685 | { name: 'Rancho Santa Margarita' }, 686 | { name: 'Rapid City' }, 687 | { name: 'Reading' }, 688 | { name: 'Redding' }, 689 | { name: 'Redlands' }, 690 | { name: 'Redmond' }, 691 | { name: 'Redondo Beach' }, 692 | { name: 'Redwood City' }, 693 | { name: 'Reno' }, 694 | { name: 'Renton' }, 695 | { name: 'Revere' }, 696 | { name: 'Rialto' }, 697 | { name: 'Richardson' }, 698 | { name: 'Richland' }, 699 | { name: 'Richmond' }, 700 | { name: 'Rio Rancho' }, 701 | { name: 'Riverside' }, 702 | { name: 'Riverton' }, 703 | { name: 'Roanoke' }, 704 | { name: 'Rochester' }, 705 | { name: 'Rochester Hills' }, 706 | { name: 'Rock Hill' }, 707 | { name: 'Rock Island' }, 708 | { name: 'Rockford' }, 709 | { name: 'Rocklin' }, 710 | { name: 'Rockville' }, 711 | { name: 'Rockwall' }, 712 | { name: 'Rocky Mount' }, 713 | { name: 'Rogers' }, 714 | { name: 'Rohnert Park' }, 715 | { name: 'Romeoville' }, 716 | { name: 'Rosemead' }, 717 | { name: 'Roseville' }, 718 | { name: 'Roswell' }, 719 | { name: 'Round Rock' }, 720 | { name: 'Rowlett' }, 721 | { name: 'Roy' }, 722 | { name: 'Royal Oak' }, 723 | { name: 'Sacramento' }, 724 | { name: 'Saginaw' }, 725 | { name: 'Salem' }, 726 | { name: 'Salina' }, 727 | { name: 'Salinas' }, 728 | { name: 'Salt Lake City' }, 729 | { name: 'Sammamish' }, 730 | { name: 'San Angelo' }, 731 | { name: 'San Antonio' }, 732 | { name: 'San Bernardino' }, 733 | { name: 'San Bruno' }, 734 | { name: 'San Buenaventura (Ventura)' }, 735 | { name: 'San Clemente' }, 736 | { name: 'San Diego' }, 737 | { name: 'San Francisco' }, 738 | { name: 'San Gabriel' }, 739 | { name: 'San Jacinto' }, 740 | { name: 'San Jose' }, 741 | { name: 'San Leandro' }, 742 | { name: 'San Luis Obispo' }, 743 | { name: 'San Marcos' }, 744 | { name: 'San Mateo' }, 745 | { name: 'San Rafael' }, 746 | { name: 'San Ramon' }, 747 | { name: 'Sandy' }, 748 | { name: 'Sandy Springs' }, 749 | { name: 'Sanford' }, 750 | { name: 'Santa Ana' }, 751 | { name: 'Santa Barbara' }, 752 | { name: 'Santa Clara' }, 753 | { name: 'Santa Clarita' }, 754 | { name: 'Santa Cruz' }, 755 | { name: 'Santa Fe' }, 756 | { name: 'Santa Maria' }, 757 | { name: 'Santa Monica' }, 758 | { name: 'Santa Rosa' }, 759 | { name: 'Santee' }, 760 | { name: 'Sarasota' }, 761 | { name: 'Savannah' }, 762 | { name: 'Sayreville' }, 763 | { name: 'Schaumburg' }, 764 | { name: 'Schenectady' }, 765 | { name: 'Scottsdale' }, 766 | { name: 'Scranton' }, 767 | { name: 'Seattle' }, 768 | { name: 'Shakopee' }, 769 | { name: 'Shawnee' }, 770 | { name: 'Sheboygan' }, 771 | { name: 'Shelton' }, 772 | { name: 'Sherman' }, 773 | { name: 'Shoreline' }, 774 | { name: 'Shreveport' }, 775 | { name: 'Sierra Vista' }, 776 | { name: 'Simi Valley' }, 777 | { name: 'Sioux City' }, 778 | { name: 'Sioux Falls' }, 779 | { name: 'Skokie' }, 780 | { name: 'Smyrna' }, 781 | { name: 'Somerville' }, 782 | { name: 'South Bend' }, 783 | { name: 'South Gate' }, 784 | { name: 'South Jordan' }, 785 | { name: 'South San Francisco' }, 786 | { name: 'Southaven' }, 787 | { name: 'Southfield' }, 788 | { name: 'Spanish Fork' }, 789 | { name: 'Sparks' }, 790 | { name: 'Spartanburg' }, 791 | { name: 'Spokane' }, 792 | { name: 'Spokane Valley' }, 793 | { name: 'Springdale' }, 794 | { name: 'Springfield' }, 795 | { name: 'St. Charles' }, 796 | { name: 'St. Clair Shores' }, 797 | { name: 'St. Cloud' }, 798 | { name: 'St. George' }, 799 | { name: 'St. Joseph' }, 800 | { name: 'St. Louis' }, 801 | { name: 'St. Louis Park' }, 802 | { name: 'St. Paul' }, 803 | { name: 'St. Peters' }, 804 | { name: 'St. Petersburg' }, 805 | { name: 'Stamford' }, 806 | { name: 'Stanton' }, 807 | { name: 'State College' }, 808 | { name: 'Sterling Heights' }, 809 | { name: 'Stillwater' }, 810 | { name: 'Stockton' }, 811 | { name: 'Streamwood' }, 812 | { name: 'Strongsville' }, 813 | { name: 'Suffolk' }, 814 | { name: 'Sugar Land' }, 815 | { name: 'Summerville' }, 816 | { name: 'Sumter' }, 817 | { name: 'Sunnyvale' }, 818 | { name: 'Sunrise' }, 819 | { name: 'Surprise' }, 820 | { name: 'Syracuse' }, 821 | { name: 'Tacoma' }, 822 | { name: 'Tallahassee' }, 823 | { name: 'Tamarac' }, 824 | { name: 'Tampa' }, 825 | { name: 'Taunton' }, 826 | { name: 'Taylor' }, 827 | { name: 'Taylorsville' }, 828 | { name: 'Temecula' }, 829 | { name: 'Tempe' }, 830 | { name: 'Temple' }, 831 | { name: 'Terre Haute' }, 832 | { name: 'Texarkana' }, 833 | { name: 'Texas City' }, 834 | { name: 'The Colony' }, 835 | { name: 'Thornton' }, 836 | { name: 'Thousand Oaks' }, 837 | { name: 'Tigard' }, 838 | { name: 'Tinley Park' }, 839 | { name: 'Titusville' }, 840 | { name: 'Toledo' }, 841 | { name: 'Topeka' }, 842 | { name: 'Torrance' }, 843 | { name: 'Tracy' }, 844 | { name: 'Trenton' }, 845 | { name: 'Troy' }, 846 | { name: 'Tucson' }, 847 | { name: 'Tulare' }, 848 | { name: 'Tulsa' }, 849 | { name: 'Turlock' }, 850 | { name: 'Tuscaloosa' }, 851 | { name: 'Tustin' }, 852 | { name: 'Twin Falls' }, 853 | { name: 'Tyler' }, 854 | { name: 'Union City' }, 855 | { name: 'Upland' }, 856 | { name: 'Urbana' }, 857 | { name: 'Urbandale' }, 858 | { name: 'Utica' }, 859 | { name: 'Vacaville' }, 860 | { name: 'Valdosta' }, 861 | { name: 'Vallejo' }, 862 | { name: 'Valley Stream' }, 863 | { name: 'Vancouver' }, 864 | { name: 'Victoria' }, 865 | { name: 'Victorville' }, 866 | { name: 'Vineland' }, 867 | { name: 'Virginia Beach' }, 868 | { name: 'Visalia' }, 869 | { name: 'Vista' }, 870 | { name: 'Waco' }, 871 | { name: 'Walnut Creek' }, 872 | { name: 'Waltham' }, 873 | { name: 'Warner Robins' }, 874 | { name: 'Warren' }, 875 | { name: 'Warwick' }, 876 | { name: 'Washington' }, 877 | { name: 'Waterbury' }, 878 | { name: 'Waterloo' }, 879 | { name: 'Watsonville' }, 880 | { name: 'Waukegan' }, 881 | { name: 'Waukesha' }, 882 | { name: 'Wausau' }, 883 | { name: 'Wauwatosa' }, 884 | { name: 'Wellington' }, 885 | { name: 'Weslaco' }, 886 | { name: 'West Allis' }, 887 | { name: 'West Covina' }, 888 | { name: 'West Des Moines' }, 889 | { name: 'West Haven' }, 890 | { name: 'West Jordan' }, 891 | { name: 'West New York' }, 892 | { name: 'West Palm Beach' }, 893 | { name: 'West Sacramento' }, 894 | { name: 'West Valley City' }, 895 | { name: 'Westerville' }, 896 | { name: 'Westfield' }, 897 | { name: 'Westland' }, 898 | { name: 'Westminster' }, 899 | { name: 'Weston' }, 900 | { name: 'Weymouth Town' }, 901 | { name: 'Wheaton' }, 902 | { name: 'Wheeling' }, 903 | { name: 'White Plains' }, 904 | { name: 'Whittier' }, 905 | { name: 'Wichita' }, 906 | { name: 'Wichita Falls' }, 907 | { name: 'Wilkes-Barre' }, 908 | { name: 'Wilmington' }, 909 | { name: 'Wilson' }, 910 | { name: 'Winston-Salem' }, 911 | { name: 'Winter Garden' }, 912 | { name: 'Woburn' }, 913 | { name: 'Woodbury' }, 914 | { name: 'Woodland' }, 915 | { name: 'Woonsocket' }, 916 | { name: 'Worcester' }, 917 | { name: 'Wylie' }, 918 | { name: 'Wyoming' }, 919 | { name: 'Yakima', disabled: true }, 920 | { name: 'Yonkers', disabled: true }, 921 | { name: 'Yorba Linda', disabled: true }, 922 | { name: 'York', disabled: true }, 923 | { name: 'Youngstown', disabled: true }, 924 | { name: 'Yuba City', disabled: true }, 925 | { name: 'Yucaipa', disabled: true }, 926 | { name: 'Yuma', disabled: true } 927 | ] 928 | -------------------------------------------------------------------------------- /source/demo/data/countries.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { code: 'AD', name: 'Andorra' }, 3 | { code: 'AE', name: 'United Arab Emirates' }, 4 | { code: 'AF', name: 'Afghanistan' }, 5 | { code: 'AG', name: 'Antigua and Barbuda' }, 6 | { code: 'AI', name: 'Anguilla' }, 7 | { code: 'AL', name: 'Albania' }, 8 | { code: 'AM', name: 'Armenia' }, 9 | { code: 'AO', name: 'Angola' }, 10 | { code: 'AR', name: 'Argentina' }, 11 | { code: 'AS', name: 'American Samoa' }, 12 | { code: 'AT', name: 'Austria' }, 13 | { code: 'AU', name: 'Australia' }, 14 | { code: 'AW', name: 'Aruba' }, 15 | { code: 'AX', name: '\u00c5land Islands' }, 16 | { code: 'AZ', name: 'Azerbaijan' }, 17 | { code: 'BA', name: 'Bosnia and Herzegovina' }, 18 | { code: 'BB', name: 'Barbados' }, 19 | { code: 'BD', name: 'Bangladesh' }, 20 | { code: 'BE', name: 'Belgium' }, 21 | { code: 'BF', name: 'Burkina Faso' }, 22 | { code: 'BG', name: 'Bulgaria' }, 23 | { code: 'BH', name: 'Bahrain' }, 24 | { code: 'BI', name: 'Burundi' }, 25 | { code: 'BJ', name: 'Benin' }, 26 | { code: 'BM', name: 'Bermuda' }, 27 | { code: 'BN', name: 'Brunei Darussalam' }, 28 | { code: 'BO', name: 'Bolivia, Plurinational State of' }, 29 | { code: 'BR', name: 'Brazil' }, 30 | { code: 'BS', name: 'Bahamas' }, 31 | { code: 'BT', name: 'Bhutan' }, 32 | { code: 'BW', name: 'Botswana' }, 33 | { code: 'BY', name: 'Belarus' }, 34 | { code: 'BZ', name: 'Belize' }, 35 | { code: 'CA', name: 'Canada' }, 36 | { code: 'CC', name: 'Cocos (Keeling) Islands' }, 37 | { code: 'CD', name: 'Congo, the Democratic Republic of the' }, 38 | { code: 'CF', name: 'Central African Republic' }, 39 | { code: 'CG', name: 'Congo' }, 40 | { code: 'CH', name: 'Switzerland' }, 41 | { code: 'CI', name: 'C\u00f4te d\'Ivoire' }, 42 | { code: 'CK', name: 'Cook Islands' }, 43 | { code: 'CL', name: 'Chile' }, 44 | { code: 'CM', name: 'Cameroon' }, 45 | { code: 'CN', name: 'China' }, 46 | { code: 'CO', name: 'Colombia' }, 47 | { code: 'CR', name: 'Costa Rica' }, 48 | { code: 'CU', name: 'Cuba' }, 49 | { code: 'CV', name: 'Cape Verde' }, 50 | { code: 'CW', name: 'Cura\u00e7ao' }, 51 | { code: 'CX', name: 'Christmas Island' }, 52 | { code: 'CY', name: 'Cyprus' }, 53 | { code: 'CZ', name: 'Czech Republic' }, 54 | { code: 'DE', name: 'Germany' }, 55 | { code: 'DJ', name: 'Djibouti' }, 56 | { code: 'DK', name: 'Denmark' }, 57 | { code: 'DM', name: 'Dominica' }, 58 | { code: 'DO', name: 'Dominican Republic' }, 59 | { code: 'DZ', name: 'Algeria' }, 60 | { code: 'EC', name: 'Ecuador' }, 61 | { code: 'EE', name: 'Estonia' }, 62 | { code: 'EG', name: 'Egypt' }, 63 | { code: 'ER', name: 'Eritrea' }, 64 | { code: 'ES', name: 'Spain' }, 65 | { code: 'ET', name: 'Ethiopia' }, 66 | { code: 'FI', name: 'Finland' }, 67 | { code: 'FJ', name: 'Fiji' }, 68 | { code: 'FK', name: 'Falkland Islands (Malvinas)' }, 69 | { code: 'FM', name: 'Micronesia, Federated States of' }, 70 | { code: 'FO', name: 'Faroe Islands' }, 71 | { code: 'FR', name: 'France' }, 72 | { code: 'GA', name: 'Gabon' }, 73 | { code: 'GB', name: 'United Kingdom' }, 74 | { code: 'GD', name: 'Grenada' }, 75 | { code: 'GE', name: 'Georgia' }, 76 | { code: 'GG', name: 'Guernsey' }, 77 | { code: 'GH', name: 'Ghana' }, 78 | { code: 'GI', name: 'Gibraltar' }, 79 | { code: 'GL', name: 'Greenland' }, 80 | { code: 'GM', name: 'Gambia' }, 81 | { code: 'GN', name: 'Guinea' }, 82 | { code: 'GQ', name: 'Equatorial Guinea' }, 83 | { code: 'GR', name: 'Greece' }, 84 | { code: 'GS', name: 'South Georgia and the South Sandwich Islands' }, 85 | { code: 'GT', name: 'Guatemala' }, 86 | { code: 'GU', name: 'Guam' }, 87 | { code: 'GW', name: 'Guinea-Bissau' }, 88 | { code: 'GY', name: 'Guyana' }, 89 | { code: 'HK', name: 'Hong Kong' }, 90 | { code: 'HN', name: 'Honduras' }, 91 | { code: 'HR', name: 'Croatia' }, 92 | { code: 'HT', name: 'Haiti' }, 93 | { code: 'HU', name: 'Hungary' }, 94 | { code: 'ID', name: 'Indonesia' }, 95 | { code: 'IE', name: 'Ireland' }, 96 | { code: 'IL', name: 'Israel' }, 97 | { code: 'IM', name: 'Isle of Man' }, 98 | { code: 'IN', name: 'India' }, 99 | { code: 'IO', name: 'British Indian Ocean Territory' }, 100 | { code: 'IQ', name: 'Iraq' }, 101 | { code: 'IR', name: 'Iran, Islamic Republic of' }, 102 | { code: 'IS', name: 'Iceland' }, 103 | { code: 'IT', name: 'Italy' }, 104 | { code: 'JE', name: 'Jersey' }, 105 | { code: 'JM', name: 'Jamaica' }, 106 | { code: 'JO', name: 'Jordan' }, 107 | { code: 'JP', name: 'Japan' }, 108 | { code: 'KE', name: 'Kenya' }, 109 | { code: 'KG', name: 'Kyrgyzstan' }, 110 | { code: 'KH', name: 'Cambodia' }, 111 | { code: 'KI', name: 'Kiribati' }, 112 | { code: 'KM', name: 'Comoros' }, 113 | { code: 'KN', name: 'Saint Kitts and Nevis' }, 114 | { code: 'KP', name: 'Korea, Democratic People\'s Republic of' }, 115 | { code: 'KR', name: 'Korea, Republic of' }, 116 | { code: 'KW', name: 'Kuwait' }, 117 | { code: 'KY', name: 'Cayman Islands' }, 118 | { code: 'KZ', name: 'Kazakhstan' }, 119 | { code: 'LA', name: 'Lao People\'s Democratic Republic' }, 120 | { code: 'LB', name: 'Lebanon' }, 121 | { code: 'LC', name: 'Saint Lucia' }, 122 | { code: 'LI', name: 'Liechtenstein' }, 123 | { code: 'LK', name: 'Sri Lanka' }, 124 | { code: 'LR', name: 'Liberia' }, 125 | { code: 'LS', name: 'Lesotho' }, 126 | { code: 'LT', name: 'Lithuania' }, 127 | { code: 'LU', name: 'Luxembourg' }, 128 | { code: 'LV', name: 'Latvia' }, 129 | { code: 'LY', name: 'Libya' }, 130 | { code: 'MA', name: 'Morocco' }, 131 | { code: 'MC', name: 'Monaco' }, 132 | { code: 'MD', name: 'Moldova, Republic of' }, 133 | { code: 'ME', name: 'Montenegro' }, 134 | { code: 'MG', name: 'Madagascar' }, 135 | { code: 'MH', name: 'Marshall Islands' }, 136 | { code: 'MK', name: 'Macedonia, the former Yugoslav Republic of' }, 137 | { code: 'ML', name: 'Mali' }, 138 | { code: 'MM', name: 'Myanmar' }, 139 | { code: 'MN', name: 'Mongolia' }, 140 | { code: 'MO', name: 'Macao' }, 141 | { code: 'MP', name: 'Northern Mariana Islands' }, 142 | { code: 'MZ', name: 'Martinique' }, 143 | { code: 'MR', name: 'Mauritania' }, 144 | { code: 'MS', name: 'Montserrat' }, 145 | { code: 'MT', name: 'Malta' }, 146 | { code: 'MU', name: 'Mauritius' }, 147 | { code: 'MV', name: 'Maldives' }, 148 | { code: 'MW', name: 'Malawi' }, 149 | { code: 'MX', name: 'Mexico' }, 150 | { code: 'MY', name: 'Malaysia' }, 151 | { code: 'MZ', name: 'Mozambique' }, 152 | { code: 'NA', name: 'Namibia' }, 153 | { code: 'NC', name: 'New Caledonia' }, 154 | { code: 'NE', name: 'Niger' }, 155 | { code: 'NF', name: 'Norfolk Island' }, 156 | { code: 'NG', name: 'Nigeria' }, 157 | { code: 'NI', name: 'Nicaragua' }, 158 | { code: 'NL', name: 'Netherlands' }, 159 | { code: 'NO', name: 'Norway' }, 160 | { code: 'NP', name: 'Nepal' }, 161 | { code: 'NR', name: 'Nauru' }, 162 | { code: 'NU', name: 'Niue' }, 163 | { code: 'NZ', name: 'New Zealand' }, 164 | { code: 'OM', name: 'Oman' }, 165 | { code: 'PA', name: 'Panama' }, 166 | { code: 'PE', name: 'Peru' }, 167 | { code: 'PF', name: 'French Polynesia' }, 168 | { code: 'PS', name: 'Palestine' }, 169 | { code: 'PG', name: 'Papua New Guinea' }, 170 | { code: 'PH', name: 'Philippines' }, 171 | { code: 'PK', name: 'Pakistan' }, 172 | { code: 'PL', name: 'Poland' }, 173 | { code: 'PN', name: 'Pitcairn' }, 174 | { code: 'PR', name: 'Puerto Rico' }, 175 | { code: 'PT', name: 'Portugal' }, 176 | { code: 'PW', name: 'Palau' }, 177 | { code: 'PY', name: 'Paraguay' }, 178 | { code: 'QA', name: 'Qatar' }, 179 | { code: 'RE', name: 'Réunion' }, 180 | { code: 'RO', name: 'Romania' }, 181 | { code: 'RS', name: 'Serbia' }, 182 | { code: 'RU', name: 'Russian Federation' }, 183 | { code: 'RW', name: 'Rwanda' }, 184 | { code: 'SA', name: 'Saudi Arabia' }, 185 | { code: 'SB', name: 'Solomon Islands' }, 186 | { code: 'SC', name: 'Seychelles' }, 187 | { code: 'SD', name: 'Sudan' }, 188 | { code: 'SE', name: 'Sweden' }, 189 | { code: 'SG', name: 'Singapore' }, 190 | { code: 'SH', name: 'Saint Helena, Ascension and Tristan da Cunha' }, 191 | { code: 'SI', name: 'Slovenia' }, 192 | { code: 'SK', name: 'Slovakia' }, 193 | { code: 'SL', name: 'Sierra Leone' }, 194 | { code: 'SM', name: 'San Marino' }, 195 | { code: 'SN', name: 'Senegal' }, 196 | { code: 'SO', name: 'Somalia' }, 197 | { code: 'SR', name: 'Suriname' }, 198 | { code: 'SS', name: 'South Sudan' }, 199 | { code: 'ST', name: 'Sao Tome and Principe' }, 200 | { code: 'SV', name: 'El Salvador' }, 201 | { code: 'SX', name: 'Sint Maarten (Dutch part)' }, 202 | { code: 'SY', name: 'Syrian Arab Republic' }, 203 | { code: 'SZ', name: 'Swaziland' }, 204 | { code: 'TC', name: 'Turks and Caicos Islands' }, 205 | { code: 'TD', name: 'Chad' }, 206 | { code: 'TF', name: 'French Southern Territories' }, 207 | { code: 'TG', name: 'Togo' }, 208 | { code: 'TH', name: 'Thailand' }, 209 | { code: 'TJ', name: 'Tajikistan' }, 210 | { code: 'TK', name: 'Tokelau' }, 211 | { code: 'TL', name: 'Timor-Leste' }, 212 | { code: 'TM', name: 'Turkmenistan' }, 213 | { code: 'TN', name: 'Tunisia' }, 214 | { code: 'TO', name: 'Tonga' }, 215 | { code: 'TR', name: 'Turkey' }, 216 | { code: 'TT', name: 'Trinidad and Tobago' }, 217 | { code: 'TV', name: 'Tuvalu' }, 218 | { code: 'TZ', name: 'Tanzania, United Republic of' }, 219 | { code: 'TW', name: 'Taiwan, Provice of China' }, 220 | { code: 'UA', name: 'Ukraine' }, 221 | { code: 'UG', name: 'Uganda' }, 222 | { code: 'US', name: 'United States' }, 223 | { code: 'UY', name: 'Uruguay' }, 224 | { code: 'UZ', name: 'Uzbekistan' }, 225 | { code: 'VA', name: 'Holy See (Vatican City State)' }, 226 | { code: 'VC', name: 'Saint Vincent and the Grenadines' }, 227 | { code: 'VE', name: 'Venezuela, Bolivarian Republic of' }, 228 | { code: 'VG', name: 'Virgin Islands, British' }, 229 | { code: 'VI', name: 'Virgin Islands, U.S.' }, 230 | { code: 'VN', name: 'Viet Nam' }, 231 | { code: 'VU', name: 'Vanuatu' }, 232 | { code: 'WS', name: 'Samoa' }, 233 | { code: 'YE', name: 'Yemen' }, 234 | { code: 'ZA', name: 'South Africa' }, 235 | { code: 'ZM', name: 'Zambia' }, 236 | { code: 'ZW', name: 'Zimbabwe' } 237 | ] 238 | -------------------------------------------------------------------------------- /source/demo/data/names.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { name: 'Girl names', type: 'header' }, 3 | { name: 'Amelia', type: 'name' }, 4 | { name: 'Olivia', type: 'name' }, 5 | { name: 'Emily', type: 'name' }, 6 | { name: 'Jessica', type: 'name' }, 7 | { name: 'Sophie', type: 'name' }, 8 | { name: 'Lily', type: 'name' }, 9 | { name: 'Mia', type: 'name' }, 10 | { name: 'Ava', type: 'name' }, 11 | { name: 'Isla', type: 'name' }, 12 | { name: 'Ruby', type: 'name' }, 13 | { name: 'Boy names', type: 'header' }, 14 | { name: 'Harry', type: 'name' }, 15 | { name: 'Jack', type: 'name' }, 16 | { name: 'Charlie', type: 'name' }, 17 | { name: 'Oliver', type: 'name' }, 18 | { name: 'Alfie', type: 'name' }, 19 | { name: 'Riley', type: 'name' }, 20 | { name: 'Jacob', type: 'name' }, 21 | { name: 'James', type: 'name' }, 22 | { name: 'Thomas', type: 'name' }, 23 | { name: 'Ethan', type: 'name' } 24 | ] 25 | -------------------------------------------------------------------------------- /source/demo/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bvaughn/react-virtualized-select/aa47a7f43bb7574acbd47ab1483e737d66979b6a/source/demo/favicon.png -------------------------------------------------------------------------------- /source/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | export default from './VirtualizedSelect' 3 | -------------------------------------------------------------------------------- /source/styles.css: -------------------------------------------------------------------------------- 1 | .VirtualSelectGrid { 2 | z-index: 1; 3 | } 4 | 5 | .VirtualizedSelectOption { 6 | display: -webkit-box; 7 | display: -ms-flexbox; 8 | display: flex; 9 | -webkit-box-align: center; 10 | -ms-flex-align: center; 11 | align-items: center; 12 | padding: 0 .5rem; 13 | cursor: pointer; 14 | } 15 | .VirtualizedSelectFocusedOption { 16 | background-color: rgba(0, 126, 255, 0.1); 17 | } 18 | .VirtualizedSelectDisabledOption { 19 | opacity: 0.5; 20 | } 21 | .VirtualizedSelectSelectedOption { 22 | font-weight: bold; 23 | } 24 | -------------------------------------------------------------------------------- /source/tests.js: -------------------------------------------------------------------------------- 1 | // Overwrite global.Promise with Bluebird 2 | // Replace the scheduler with setImmediate so we can write sync tests 3 | import Bluebird from 'bluebird' 4 | Bluebird.setScheduler(fn => { 5 | global.setImmediate(fn) 6 | }) 7 | global.Promise = Bluebird 8 | 9 | // Reference: https://babeljs.io/docs/usage/polyfill/ 10 | // Reference: https://github.com/zloirock/core-js 11 | // Polyfill a full ES6 environment 12 | import 'babel-polyfill' 13 | 14 | // Reference: https://github.com/webpack/karma-webpack#alternative-usage 15 | const tests = require.context('.', true, /\.test\.(js|jsx)$/) 16 | tests.keys().forEach(tests) 17 | -------------------------------------------------------------------------------- /styles.css: -------------------------------------------------------------------------------- 1 | .VirtualSelectGrid { 2 | z-index: 1; 3 | } 4 | 5 | .VirtualizedSelectOption { 6 | display: -webkit-box; 7 | display: -ms-flexbox; 8 | display: flex; 9 | -webkit-box-align: center; 10 | -ms-flex-align: center; 11 | align-items: center; 12 | padding: 0 .5rem; 13 | cursor: pointer; 14 | } 15 | .VirtualizedSelectFocusedOption { 16 | background-color: rgba(0, 126, 255, 0.1); 17 | } 18 | .VirtualizedSelectDisabledOption { 19 | opacity: 0.5; 20 | } 21 | .VirtualizedSelectSelectedOption { 22 | font-weight: bold; 23 | } 24 | -------------------------------------------------------------------------------- /webpack.config.demo.js: -------------------------------------------------------------------------------- 1 | const HtmlWebpackPlugin = require('html-webpack-plugin') 2 | const autoprefixer = require('autoprefixer') 3 | const path = require('path') 4 | const webpack = require('webpack') 5 | 6 | module.exports = { 7 | devtool: 'source-map', 8 | entry: { 9 | demo: './source/demo/Application' 10 | }, 11 | output: { 12 | path: 'build', 13 | filename: 'static/[name].js' 14 | }, 15 | plugins: [ 16 | new HtmlWebpackPlugin({ 17 | filename: 'index.html', 18 | inject: true, 19 | template: './index.html' 20 | }), 21 | new webpack.DefinePlugin({ 22 | 'process.env': { 23 | 'NODE_ENV': JSON.stringify('production') 24 | } 25 | }) 26 | ], 27 | module: { 28 | loaders: [ 29 | { 30 | test: /\.js$/, 31 | loaders: ['babel'], 32 | include: path.join(__dirname, 'source') 33 | }, 34 | { 35 | test: /\.css$/, 36 | loaders: ['style', 'css?modules&importLoaders=1', 'postcss'], 37 | include: path.join(__dirname, 'source') 38 | }, 39 | { 40 | test: /\.css$/, 41 | loaders: ['style', 'css?importLoaders=1'], 42 | include: path.join(__dirname, 'styles.css') 43 | } 44 | ] 45 | }, 46 | postcss: function () { 47 | return [autoprefixer] 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /webpack.config.dev.js: -------------------------------------------------------------------------------- 1 | const HtmlWebpackPlugin = require('html-webpack-plugin') 2 | const autoprefixer = require('autoprefixer') 3 | const path = require('path') 4 | const webpack = require('webpack') 5 | 6 | module.exports = { 7 | devtool: 'eval', 8 | entry: { 9 | demo: './source/demo/Application' 10 | }, 11 | output: { 12 | path: 'build', 13 | filename: '/static/[name].js' 14 | }, 15 | plugins: [ 16 | new HtmlWebpackPlugin({ 17 | filename: 'index.html', 18 | inject: true, 19 | template: './index.html' 20 | }), 21 | new webpack.NoErrorsPlugin(), 22 | new webpack.optimize.UglifyJsPlugin() 23 | ], 24 | module: { 25 | loaders: [ 26 | { 27 | test: /\.js$/, 28 | loaders: ['babel'], 29 | include: path.join(__dirname, 'source') 30 | }, 31 | { 32 | test: /\.css$/, 33 | loaders: ['style', 'css?modules&importLoaders=1', 'postcss'], 34 | include: path.join(__dirname, 'source') 35 | }, 36 | { 37 | test: /\.css$/, 38 | loaders: ['style', 'css?importLoaders=1'], 39 | include: path.join(__dirname, 'styles.css') 40 | } 41 | ] 42 | }, 43 | postcss: function () { 44 | return [autoprefixer] 45 | }, 46 | devServer: { 47 | contentBase: 'build', 48 | port: 3002 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /webpack.config.umd.js: -------------------------------------------------------------------------------- 1 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 2 | const path = require('path') 3 | const webpack = require('webpack') 4 | 5 | module.exports = { 6 | devtool: 'source-map', 7 | entry: { 8 | 'react-virtualized-select': './source/index.js' 9 | }, 10 | output: { 11 | path: 'dist/umd', 12 | filename: '[name].js', 13 | libraryTarget: 'umd', 14 | library: 'VirtualizedSelect' 15 | }, 16 | externals: { 17 | react: { 18 | commonjs: 'react', 19 | commonjs2: 'react', 20 | amd: 'react', 21 | root: 'React' 22 | }, 23 | 'react-dom': { 24 | commonjs: 'react-dom', 25 | commonjs2: 'react-dom', 26 | amd: 'react-dom', 27 | root: 'ReactDOM' 28 | } 29 | }, 30 | plugins: [ 31 | new ExtractTextPlugin('../styles.css', { 32 | allChunks: false, 33 | beautify: true, 34 | mangle: false 35 | }), 36 | new webpack.optimize.UglifyJsPlugin({ 37 | beautify: true, 38 | comments: true, 39 | mangle: false 40 | }) 41 | ], 42 | module: { 43 | loaders: [ 44 | { 45 | test: /\.js$/, 46 | loaders: ['babel'], 47 | include: path.join(__dirname, 'source') 48 | }, 49 | { 50 | test: /\.css$/, 51 | loader: ExtractTextPlugin.extract('css-loader!autoprefixer-loader?{browsers:["last 2 version", "Firefox 15"]}'), 52 | include: path.join(__dirname, 'source') 53 | 54 | } 55 | ] 56 | } 57 | } 58 | --------------------------------------------------------------------------------