From cb6b80dd420282bdd370e211b83834cbbc027828 Mon Sep 17 00:00:00 2001
From: "Goel, Naman"
Date: Fri, 18 Dec 2015 23:32:13 -0800
Subject: [PATCH 1/2] partial build migration
---
.babelrc | 7 +
.gitignore | 9 +
dist/react-select.css | 334 -
dist/react-select.js | 1084 -
dist/react-select.min.css | 1 -
dist/react-select.min.js | 1 -
examples/dist/.gitignore | 5 -
examples/dist/app.js | 1346 --
examples/dist/bundle.js | 1075 -
examples/dist/common.js | 18970 ------------------
examples/dist/example.css | 511 -
examples/dist/index.html | 54 -
examples/dist/standalone.html | 48 -
examples/dist/standalone.js | 1084 -
examples/src/app.js | 3 +-
examples/src/components/Contributors.js | 2 +-
examples/src/components/CustomComponents.js | 2 +-
examples/src/components/CustomRender.js | 11 +-
examples/src/components/Multiselect.js | 2 +-
examples/src/components/NumericSelect.js | 2 +-
examples/src/components/States.js | 2 +-
examples/src/index.html | 2 -
examples/src/standalone.html | 48 -
lib/Async.js | 42 +-
lib/Option.js | 28 +-
lib/Select.js | 232 +-
lib/Value.js | 29 +-
package.json | 26 +-
src/Option.js | 4 +-
src/Select.js | 17 +-
30 files changed, 223 insertions(+), 24758 deletions(-)
create mode 100644 .babelrc
delete mode 100644 dist/react-select.css
delete mode 100644 dist/react-select.js
delete mode 100644 dist/react-select.min.css
delete mode 100644 dist/react-select.min.js
delete mode 100644 examples/dist/.gitignore
delete mode 100644 examples/dist/app.js
delete mode 100644 examples/dist/bundle.js
delete mode 100644 examples/dist/common.js
delete mode 100644 examples/dist/example.css
delete mode 100644 examples/dist/index.html
delete mode 100644 examples/dist/standalone.html
delete mode 100644 examples/dist/standalone.js
delete mode 100644 examples/src/standalone.html
diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000000..03af0a5f29
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,7 @@
+{
+ "presets": ["es2015", "react"],
+ "plugins": ["transform-strict-mode"],
+ "ignore": [
+ "**/__test__/**/*"
+ ]
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 30afeefb53..ae54c2f5b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,12 @@ bower_components
# Other
.DS_Store
+
+# Build files
+lib/
+dist/
+
+# example builds
+examples/src/example.css
+examples/src/bundle.js
+examples/src/example.css.map
\ No newline at end of file
diff --git a/dist/react-select.css b/dist/react-select.css
deleted file mode 100644
index 154eadc3c3..0000000000
--- a/dist/react-select.css
+++ /dev/null
@@ -1,334 +0,0 @@
-/**
- * React Select
- * ============
- * Created by Jed Watson and Joss Mackison for KeystoneJS, http://www.keystonejs.com/
- * https://twitter.com/jedwatson https://twitter.com/jossmackison https://twitter.com/keystonejs
- * MIT License: https://github.com/keystonejs/react-select
-*/
-.Select {
- position: relative;
-}
-.Select,
-.Select div,
-.Select input,
-.Select span {
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
-.Select.is-disabled > .Select-control {
- background-color: #f9f9f9;
-}
-.Select.is-disabled > .Select-control:hover {
- box-shadow: none;
-}
-.Select.is-disabled .Select-arrow-zone {
- cursor: default;
- pointer-events: none;
-}
-.Select-control {
- background-color: #fff;
- border-color: #d9d9d9 #ccc #b3b3b3;
- border-radius: 4px;
- border: 1px solid #ccc;
- color: #333;
- cursor: default;
- display: table;
- height: 36px;
- outline: none;
- overflow: hidden;
- position: relative;
- width: 100%;
-}
-.Select-control:hover {
- box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
-}
-.is-searchable.is-open > .Select-control {
- cursor: text;
-}
-.is-open > .Select-control {
- border-bottom-right-radius: 0;
- border-bottom-left-radius: 0;
- background: #fff;
- border-color: #b3b3b3 #ccc #d9d9d9;
-}
-.is-open > .Select-control > .Select-arrow {
- border-color: transparent transparent #999;
- border-width: 0 5px 5px;
-}
-.is-searchable.is-focused:not(.is-open) > .Select-control {
- cursor: text;
-}
-.is-focused:not(.is-open) > .Select-control {
- border-color: #007eff;
- 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 {
- bottom: 0;
- color: #aaa;
- left: 0;
- line-height: 34px;
- padding-left: 10px;
- padding-right: 10px;
- position: absolute;
- right: 0;
- top: 0;
- max-width: 100%;
- overflow: hidden;
- 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 {
- 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 {
- 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 {
- color: #007eff;
- outline: none;
- text-decoration: underline;
-}
-.Select-input {
- height: 34px;
- padding-left: 10px;
- padding-right: 10px;
- vertical-align: middle;
-}
-.Select-input > input {
- 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;
- -webkit-appearance: none;
-}
-.is-focused .Select-input > input {
- cursor: text;
-}
-.has-value.is-pseudo-focused .Select-input {
- opacity: 0;
-}
-.Select-control:not(.is-searchable) > .Select-input {
- outline: none;
-}
-.Select-loading-zone {
- cursor: pointer;
- display: table-cell;
- position: relative;
- text-align: center;
- vertical-align: middle;
- width: 16px;
-}
-.Select-loading {
- -webkit-animation: Select-animation-spin 400ms infinite linear;
- -o-animation: Select-animation-spin 400ms infinite linear;
- animation: Select-animation-spin 400ms infinite linear;
- width: 16px;
- height: 16px;
- box-sizing: border-box;
- border-radius: 50%;
- border: 2px solid #ccc;
- border-right-color: #333;
- display: inline-block;
- position: relative;
- vertical-align: middle;
-}
-.Select-clear-zone {
- -webkit-animation: Select-animation-fadeIn 200ms;
- -o-animation: Select-animation-fadeIn 200ms;
- animation: Select-animation-fadeIn 200ms;
- color: #999;
- cursor: pointer;
- display: table-cell;
- position: relative;
- text-align: center;
- vertical-align: middle;
- width: 17px;
-}
-.Select-clear-zone:hover {
- color: #D0021B;
-}
-.Select-clear {
- display: inline-block;
- font-size: 18px;
- line-height: 1;
-}
-.Select--multi .Select-clear-zone {
- width: 17px;
-}
-.Select-arrow-zone {
- cursor: pointer;
- display: table-cell;
- position: relative;
- text-align: center;
- vertical-align: middle;
- width: 25px;
- padding-right: 5px;
-}
-.Select-arrow {
- border-color: #999 transparent transparent;
- border-style: solid;
- border-width: 5px 5px 2.5px;
- display: inline-block;
- height: 0;
- width: 0;
-}
-.is-open .Select-arrow,
-.Select-arrow-zone:hover > .Select-arrow {
- border-top-color: #666;
-}
-@-webkit-keyframes Select-animation-fadeIn {
- from {
- opacity: 0;
- }
- to {
- opacity: 1;
- }
-}
-@keyframes Select-animation-fadeIn {
- from {
- opacity: 0;
- }
- to {
- opacity: 1;
- }
-}
-.Select-menu-outer {
- border-bottom-right-radius: 4px;
- border-bottom-left-radius: 4px;
- background-color: #fff;
- border: 1px solid #ccc;
- border-top-color: #e6e6e6;
- box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
- box-sizing: border-box;
- margin-top: -1px;
- max-height: 200px;
- position: absolute;
- top: 100%;
- width: 100%;
- z-index: 1;
- -webkit-overflow-scrolling: touch;
-}
-.Select-menu {
- max-height: 198px;
- overflow-y: auto;
-}
-.Select-option {
- box-sizing: border-box;
- background-color: #fff;
- color: #666666;
- cursor: pointer;
- display: block;
- padding: 8px 10px;
-}
-.Select-option:last-child {
- border-bottom-right-radius: 4px;
- border-bottom-left-radius: 4px;
-}
-.Select-option.is-focused {
- background-color: rgba(0, 126, 255, 0.08);
- color: #333;
-}
-.Select-option.is-disabled {
- color: #cccccc;
- cursor: default;
-}
-.Select-noresults {
- box-sizing: border-box;
- color: #999999;
- cursor: default;
- display: block;
- padding: 8px 10px;
-}
-.Select--multi .Select-input {
- vertical-align: middle;
- margin-left: 10px;
- padding: 0;
-}
-.Select--multi.has-value .Select-input {
- margin-left: 5px;
-}
-.Select--multi .Select-value {
- background-color: rgba(0, 126, 255, 0.08);
- border-radius: 2px;
- border: 1px solid rgba(0, 126, 255, 0.24);
- color: #007eff;
- display: inline-block;
- font-size: 0.9em;
- line-height: 1.4;
- margin-left: 5px;
- margin-top: 5px;
- vertical-align: top;
-}
-.Select--multi .Select-value-icon,
-.Select--multi .Select-value-label {
- display: inline-block;
- vertical-align: middle;
-}
-.Select--multi .Select-value-label {
- border-bottom-right-radius: 2px;
- border-top-right-radius: 2px;
- cursor: default;
- padding: 2px 5px;
-}
-.Select--multi a.Select-value-label {
- color: #007eff;
- cursor: pointer;
- text-decoration: none;
-}
-.Select--multi a.Select-value-label:hover {
- text-decoration: underline;
-}
-.Select--multi .Select-value-icon {
- cursor: pointer;
- border-bottom-left-radius: 2px;
- border-top-left-radius: 2px;
- 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: rgba(0, 113, 230, 0.08);
- color: #0071e6;
-}
-.Select--multi .Select-value-icon:active {
- background-color: rgba(0, 126, 255, 0.24);
-}
-.Select--multi.is-disabled .Select-value {
- background-color: #fcfcfc;
- border: 1px solid #e3e3e3;
- color: #333;
-}
-.Select--multi.is-disabled .Select-value-icon {
- cursor: not-allowed;
- border-right: 1px solid #e3e3e3;
-}
-.Select--multi.is-disabled .Select-value-icon:hover,
-.Select--multi.is-disabled .Select-value-icon:focus,
-.Select--multi.is-disabled .Select-value-icon:active {
- background-color: #fcfcfc;
-}
-@keyframes Select-animation-spin {
- to {
- transform: rotate(1turn);
- }
-}
-@-webkit-keyframes Select-animation-spin {
- to {
- -webkit-transform: rotate(1turn);
- }
-}
diff --git a/dist/react-select.js b/dist/react-select.js
deleted file mode 100644
index 5375f65d45..0000000000
--- a/dist/react-select.js
+++ /dev/null
@@ -1,1084 +0,0 @@
-(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Select = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0; --i) {
- var cacheKey = input.slice(0, i);
- if (cache[cacheKey] && (input === cacheKey || cache[cacheKey].complete)) {
- return cache[cacheKey];
- }
- }
-}
-
-function thenPromise(promise, callback) {
- if (!promise || typeof promise.then !== 'function') return;
- return promise.then(function (data) {
- callback(null, data);
- }, function (err) {
- callback(err);
- });
-}
-
-var Async = _react2['default'].createClass({
- displayName: 'Async',
-
- propTypes: {
- cache: _react2['default'].PropTypes.any, // object to use to cache results, can be null to disable cache
- loadOptions: _react2['default'].PropTypes.func.isRequired, // function to call to load options asynchronously
- ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering (shared with Select)
- ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering (shared with Select)
- isLoading: _react2['default'].PropTypes.bool, // overrides the isLoading state when set to true
- loadingPlaceholder: _react2['default'].PropTypes.string, // replaces the placeholder while options are loading
- minimumInput: _react2['default'].PropTypes.number, // the minimum number of characters that trigger loadOptions
- noResultsText: _react2['default'].PropTypes.string, // placeholder displayed when there are no matching search results (shared with Select)
- placeholder: _react2['default'].PropTypes.oneOfType([// field placeholder, displayed when there's no value (shared with Select)
- _react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
- searchingText: _react2['default'].PropTypes.string, // message to display while options are loading
- searchPromptText: _react2['default'].PropTypes.string },
- // label to prompt for search input
- getDefaultProps: function getDefaultProps() {
- return {
- cache: true,
- ignoreAccents: true,
- ignoreCase: true,
- loadingPlaceholder: 'Loading...',
- minimumInput: 0,
- searchingText: 'Searching...',
- searchPromptText: 'Type to search'
- };
- },
- getInitialState: function getInitialState() {
- return {
- cache: initCache(this.props.cache),
- isLoading: false,
- options: []
- };
- },
- componentWillMount: function componentWillMount() {
- this._lastInput = '';
- },
- componentDidMount: function componentDidMount() {
- this.loadOptions('');
- },
- componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
- if (nextProps.cache !== this.props.cache) {
- this.setState({
- cache: initCache(nextProps.cache)
- });
- }
- },
- resetState: function resetState() {
- this._currentRequestId = -1;
- this.setState({
- isLoading: false,
- options: []
- });
- },
- getResponseHandler: function getResponseHandler(input) {
- var _this = this;
-
- var _requestId = this._currentRequestId = requestId++;
- return function (err, data) {
- if (err) throw err;
- if (!_this.isMounted()) return;
- updateCache(_this.state.cache, input, data);
- if (_requestId !== _this._currentRequestId) return;
- _this.setState({
- isLoading: false,
- options: data && data.options || []
- });
- };
- },
- loadOptions: function loadOptions(input) {
- if (this.props.ignoreAccents) input = (0, _utilsStripDiacritics2['default'])(input);
- if (this.props.ignoreCase) input = input.toLowerCase();
- this._lastInput = input;
- if (input.length < this.props.minimumInput) {
- return this.resetState();
- }
- var cacheResult = getFromCache(this.state.cache, input);
- if (cacheResult) {
- return this.setState({
- options: cacheResult.options
- });
- }
- this.setState({
- isLoading: true
- });
- var responseHandler = this.getResponseHandler(input);
- return thenPromise(this.props.loadOptions(input, responseHandler), responseHandler);
- },
- render: function render() {
- var noResultsText = this.props.noResultsText;
- var _state = this.state;
- var isLoading = _state.isLoading;
- var options = _state.options;
-
- if (this.props.isLoading) isLoading = true;
- var placeholder = isLoading ? this.props.loadingPlaceholder : this.props.placeholder;
- if (!options.length) {
- if (this._lastInput.length < this.props.minimumInput) noResultsText = this.props.searchPromptText;
- if (isLoading) noResultsText = this.props.searchingText;
- }
- return _react2['default'].createElement(_Select2['default'], _extends({}, this.props, {
- isLoading: isLoading,
- noResultsText: noResultsText,
- onInputChange: this.loadOptions,
- options: options,
- placeholder: placeholder
- }));
- }
-});
-
-module.exports = Async;
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./Select":3,"./utils/stripDiacritics":5}],2:[function(require,module,exports){
-(function (global){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
-
-var _react2 = _interopRequireDefault(_react);
-
-var _classnames = (typeof window !== "undefined" ? window['classNames'] : typeof global !== "undefined" ? global['classNames'] : null);
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var Option = _react2['default'].createClass({
- displayName: 'Option',
-
- propTypes: {
- className: _react2['default'].PropTypes.string, // className (based on mouse position)
- isDisabled: _react2['default'].PropTypes.bool, // the option is disabled
- isFocused: _react2['default'].PropTypes.bool, // the option is focused
- isSelected: _react2['default'].PropTypes.bool, // the option is selected
- onSelect: _react2['default'].PropTypes.func, // method to handle click on option element
- onFocus: _react2['default'].PropTypes.func, // method to handle mouseEnter on option element
- onUnfocus: _react2['default'].PropTypes.func, // method to handle mouseLeave on option element
- option: _react2['default'].PropTypes.object.isRequired },
- // object that is base for that option
- blockEvent: function blockEvent(event) {
- event.preventDefault();
- event.stopPropagation();
- if (event.target.tagName !== 'A' || !('href' in event.target)) {
- return;
- }
- if (event.target.target) {
- window.open(event.target.href, event.target.target);
- } else {
- window.location.href = event.target.href;
- }
- },
- handleMouseDown: function handleMouseDown(event) {
- event.preventDefault();
- event.stopPropagation();
- this.props.onSelect(this.props.option, event);
- },
- handleMouseEnter: function handleMouseEnter(event) {
- this.props.onFocus(this.props.option, event);
- },
- handleMouseMove: function handleMouseMove(event) {
- if (this.props.focused) return;
- this.props.onFocus(this.props.option, event);
- },
- render: function render() {
- var option = this.props.option;
-
- var className = (0, _classnames2['default'])(this.props.className, option.className);
-
- return option.disabled ? _react2['default'].createElement(
- 'div',
- { className: className,
- onMouseDown: this.blockEvent,
- onClick: this.blockEvent },
- this.props.children
- ) : _react2['default'].createElement(
- 'div',
- { className: className,
- style: option.style,
- onMouseDown: this.handleMouseDown,
- onMouseEnter: this.handleMouseEnter,
- onMouseMove: this.handleMouseMove,
- title: option.title },
- this.props.children
- );
- }
-});
-
-module.exports = Option;
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],3:[function(require,module,exports){
-(function (global){
-'use strict';
-
-Object.defineProperty(exports, '__esModule', {
- value: true
-});
-
-var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactDom = (typeof window !== "undefined" ? window['ReactDOM'] : typeof global !== "undefined" ? global['ReactDOM'] : null);
-
-var _reactDom2 = _interopRequireDefault(_reactDom);
-
-var _reactInputAutosize = (typeof window !== "undefined" ? window['AutosizeInput'] : typeof global !== "undefined" ? global['AutosizeInput'] : null);
-
-var _reactInputAutosize2 = _interopRequireDefault(_reactInputAutosize);
-
-var _classnames = (typeof window !== "undefined" ? window['classNames'] : typeof global !== "undefined" ? global['classNames'] : null);
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var _utilsStripDiacritics = require('./utils/stripDiacritics');
-
-var _utilsStripDiacritics2 = _interopRequireDefault(_utilsStripDiacritics);
-
-var _Async = require('./Async');
-
-var _Async2 = _interopRequireDefault(_Async);
-
-var _Option = require('./Option');
-
-var _Option2 = _interopRequireDefault(_Option);
-
-var _Value = require('./Value');
-
-var _Value2 = _interopRequireDefault(_Value);
-
-function stringifyValue(value) {
- if (typeof value === 'object') {
- return JSON.stringify(value);
- } else {
- return value;
- }
-}
-
-var Select = _react2['default'].createClass({
-
- statics: { Async: _Async2['default'] },
-
- displayName: 'Select',
-
- propTypes: {
- addLabelText: _react2['default'].PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input
- allowCreate: _react2['default'].PropTypes.bool, // whether to allow creation of new entries
- autofocus: _react2['default'].PropTypes.bool, // autofocus the component on mount
- backspaceRemoves: _react2['default'].PropTypes.bool, // whether backspace removes an item if there is no text input
- className: _react2['default'].PropTypes.string, // className for the outer element
- clearAllText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // title for the "clear" control when multi: true
- clearValueText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // title for the "clear" control
- clearable: _react2['default'].PropTypes.bool, // should it be possible to reset value
- delimiter: _react2['default'].PropTypes.string, // delimiter to use to join multiple values for the hidden field value
- disabled: _react2['default'].PropTypes.bool, // whether the Select is disabled or not
- escapeClearsValue: _react2['default'].PropTypes.bool, // whether escape clears the value when the menu is closed
- filterOption: _react2['default'].PropTypes.func, // method to filter a single option (option, filterString)
- filterOptions: _react2['default'].PropTypes.any, // boolean to enable default filtering or function to filter the options array ([options], filterString, [values])
- ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering
- ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering
- inputProps: _react2['default'].PropTypes.object, // custom attributes for the Input
- isLoading: _react2['default'].PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
- labelKey: _react2['default'].PropTypes.string, // path of the label value in option objects
- matchPos: _react2['default'].PropTypes.string, // (any|start) match the start or entire string when filtering
- matchProp: _react2['default'].PropTypes.string, // (any|label|value) which option property to filter on
- scrollMenuIntoView: _react2['default'].PropTypes.bool, // boolean to enable the viewport to shift so that the full menu fully visible when engaged
- menuBuffer: _react2['default'].PropTypes.number, // optional buffer (in px) between the bottom of the viewport and the bottom of the menu
- menuStyle: _react2['default'].PropTypes.object, // optional style to apply to the menu
- menuContainerStyle: _react2['default'].PropTypes.object, // optional style to apply to the menu container
- multi: _react2['default'].PropTypes.bool, // multi-value input
- name: _react2['default'].PropTypes.string, // generates a hidden tag with this field name for html forms
- newOptionCreator: _react2['default'].PropTypes.func, // factory to create new options when allowCreate set
- noResultsText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // placeholder displayed when there are no matching search results
- onBlur: _react2['default'].PropTypes.func, // onBlur handler: function (event) {}
- onChange: _react2['default'].PropTypes.func, // onChange handler: function (newValue) {}
- onFocus: _react2['default'].PropTypes.func, // onFocus handler: function (event) {}
- onInputChange: _react2['default'].PropTypes.func, // onInputChange handler: function (inputValue) {}
- onValueClick: _react2['default'].PropTypes.func, // onClick handler for value labels: function (value, event) {}
- onMenuScrollToBottom: _react2['default'].PropTypes.func, // fires when the menu is scrolled to the bottom; can be used to paginate options
- optionComponent: _react2['default'].PropTypes.func, // option component to render in dropdown
- optionRenderer: _react2['default'].PropTypes.func, // optionRenderer: function (option) {}
- options: _react2['default'].PropTypes.array, // array of options
- placeholder: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // field placeholder, displayed when there's no value
- searchable: _react2['default'].PropTypes.bool, // whether to enable searching feature or not
- simpleValue: _react2['default'].PropTypes.bool, // pass the value to onChange as a simple value (legacy pre 1.0 mode), defaults to false
- style: _react2['default'].PropTypes.object, // optional style to apply to the control
- tabIndex: _react2['default'].PropTypes.string, // optional tab index of the control
- value: _react2['default'].PropTypes.any, // initial field value
- valueComponent: _react2['default'].PropTypes.func, // value component to render
- valueKey: _react2['default'].PropTypes.string, // path of the label value in option objects
- valueRenderer: _react2['default'].PropTypes.func, // valueRenderer: function (option) {}
- wrapperStyle: _react2['default'].PropTypes.object },
-
- // optional style to apply to the component wrapper
- getDefaultProps: function getDefaultProps() {
- return {
- addLabelText: 'Add "{label}"?',
- allowCreate: false,
- backspaceRemoves: true,
- clearAllText: 'Clear all',
- clearValueText: 'Clear value',
- clearable: true,
- delimiter: ',',
- disabled: false,
- escapeClearsValue: true,
- filterOptions: true,
- ignoreAccents: true,
- ignoreCase: true,
- inputProps: {},
- isLoading: false,
- labelKey: 'label',
- matchPos: 'any',
- matchProp: 'any',
- scrollMenuIntoView: true,
- menuBuffer: 0,
- multi: false,
- noResultsText: 'No results found',
- optionComponent: _Option2['default'],
- placeholder: 'Select...',
- searchable: true,
- simpleValue: false,
- valueComponent: _Value2['default'],
- valueKey: 'value'
- };
- },
-
- getInitialState: function getInitialState() {
- return {
- inputValue: '',
- isFocused: false,
- isLoading: false,
- isOpen: false,
- isPseudoFocused: false
- };
- },
-
- componentDidMount: function componentDidMount() {
- if (this.props.autofocus) {
- this.focus();
- }
- },
-
- componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
- if (prevState.inputValue !== this.state.inputValue && this.props.onInputChange) {
- this.props.onInputChange(this.state.inputValue);
- }
- if (this._scrollToFocusedOptionOnUpdate && this.refs.focused && this.refs.menu) {
- this._scrollToFocusedOptionOnUpdate = false;
- var focusedDOM = _reactDom2['default'].findDOMNode(this.refs.focused);
- var menuDOM = _reactDom2['default'].findDOMNode(this.refs.menu);
- var focusedRect = focusedDOM.getBoundingClientRect();
- var menuRect = menuDOM.getBoundingClientRect();
- if (focusedRect.bottom > menuRect.bottom || focusedRect.top < menuRect.top) {
- menuDOM.scrollTop = focusedDOM.offsetTop + focusedDOM.clientHeight - menuDOM.offsetHeight;
- }
- }
- if (this.props.scrollMenuIntoView && this.refs.menuContainer) {
- var menuContainerRect = this.refs.menuContainer.getBoundingClientRect();
- if (window.innerHeight < menuContainerRect.bottom + this.props.menuBuffer) {
- window.scrollTo(0, window.scrollY + menuContainerRect.bottom + this.props.menuBuffer - window.innerHeight);
- }
- }
- },
-
- focus: function focus() {
- if (!this.refs.input) return;
- this.refs.input.focus();
- },
-
- handleMouseDown: function handleMouseDown(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, or if the component is disabled, ignore it.
- if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
- return;
- }
-
- // prevent default event handlers
- event.stopPropagation();
- event.preventDefault();
-
- // for the non-searchable select, toggle the menu
- if (!this.props.searchable) {
- this.focus();
- return this.setState({
- isOpen: !this.state.isOpen
- });
- }
-
- if (this.state.isFocused) {
- // if the input is focused, ensure the menu is open
- this.setState({
- isOpen: true,
- isPseudoFocused: false
- });
- } else {
- // otherwise, focus the input and open the menu
- this._openAfterFocus = true;
- this.focus();
- }
- },
-
- handleMouseDownOnArrow: function handleMouseDownOnArrow(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, or if the component is disabled, ignore it.
- if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- // If the menu isn't open, let the event bubble to the main handleMouseDown
- if (!this.state.isOpen) {
- return;
- }
- // prevent default event handlers
- event.stopPropagation();
- event.preventDefault();
- // close the menu
- this.closeMenu();
- },
-
- closeMenu: function closeMenu() {
- this.setState({
- isOpen: false,
- isPseudoFocused: this.state.isFocused && !this.props.multi,
- inputValue: ''
- });
- },
-
- handleInputFocus: function handleInputFocus(event) {
- var isOpen = this.state.isOpen || this._openAfterFocus;
- if (this.props.onFocus) {
- this.props.onFocus(event);
- }
- this.setState({
- isFocused: true,
- isOpen: isOpen
- });
- this._openAfterFocus = false;
- },
-
- handleInputBlur: function handleInputBlur(event) {
- if (this.refs.menu && document.activeElement.isEqualNode(this.refs.menu)) {
- return;
- }
-
- if (this.props.onBlur) {
- this.props.onBlur(event);
- }
- this.setState({
- inputValue: '',
- isFocused: false,
- isOpen: false,
- isPseudoFocused: false
- });
- },
-
- handleInputChange: function handleInputChange(event) {
- this.setState({
- isOpen: true,
- isPseudoFocused: false,
- inputValue: event.target.value
- });
- },
-
- handleKeyDown: function handleKeyDown(event) {
- if (this.props.disabled) return;
- switch (event.keyCode) {
- case 8:
- // backspace
- if (!this.state.inputValue && this.props.backspaceRemoves) {
- event.preventDefault();
- this.popValue();
- }
- return;
- case 9:
- // tab
- if (event.shiftKey || !this.state.isOpen) {
- return;
- }
- this.selectFocusedOption();
- break;
- case 13:
- // enter
- if (!this.state.isOpen) return;
- this.selectFocusedOption();
- break;
- case 27:
- // escape
- if (this.state.isOpen) {
- this.closeMenu();
- } else if (this.props.clearable && this.props.escapeClearsValue) {
- this.clearValue(event);
- }
- break;
- case 38:
- // up
- this.focusPreviousOption();
- break;
- case 40:
- // down
- this.focusNextOption();
- break;
- // case 188: // ,
- // if (this.props.allowCreate && this.props.multi) {
- // event.preventDefault();
- // event.stopPropagation();
- // this.selectFocusedOption();
- // } else {
- // return;
- // }
- // break;
- default:
- return;
- }
- event.preventDefault();
- },
-
- handleValueClick: function handleValueClick(option, event) {
- if (!this.props.onValueClick) return;
- this.props.onValueClick(option, event);
- },
-
- handleMenuScroll: function handleMenuScroll(event) {
- if (!this.props.onMenuScrollToBottom) return;
- var target = event.target;
-
- if (target.scrollHeight > target.offsetHeight && !(target.scrollHeight - target.offsetHeight - target.scrollTop)) {
- this.props.onMenuScrollToBottom();
- }
- },
-
- getOptionLabel: function getOptionLabel(op) {
- return op[this.props.labelKey];
- },
-
- getValueArray: function getValueArray() {
- var value = this.props.value;
- if (this.props.multi) {
- if (typeof value === 'string') value = value.split(this.props.delimiter);
- if (!Array.isArray(value)) {
- if (value === null || value === undefined) return [];
- value = [value];
- }
- return value.map(this.expandValue).filter(function (i) {
- return i;
- });
- }
- var expandedValue = this.expandValue(value);
- return expandedValue ? [expandedValue] : [];
- },
-
- expandValue: function expandValue(value) {
- if (typeof value !== 'string' && typeof value !== 'number') return value;
- var _props = this.props;
- var options = _props.options;
- var valueKey = _props.valueKey;
-
- if (!options) return;
- for (var i = 0; i < options.length; i++) {
- if (options[i][valueKey] === value) return options[i];
- }
- },
-
- setValue: function setValue(value) {
- var _this = this;
-
- if (!this.props.onChange) return;
- if (this.props.simpleValue && value) {
- value = this.props.multi ? value.map(function (i) {
- return i[_this.props.valueKey];
- }).join(this.props.delimiter) : value[this.props.valueKey];
- }
- this.props.onChange(value);
- },
-
- selectValue: function selectValue(value) {
- if (this.props.multi) {
- this.addValue(value);
- this.setState({
- inputValue: ''
- });
- } else {
- this.setValue(value);
- this.setState({
- isOpen: false,
- inputValue: '',
- isPseudoFocused: this.state.isFocused
- });
- }
- },
-
- addValue: function addValue(value) {
- var valueArray = this.getValueArray();
- this.setValue(valueArray.concat(value));
- },
-
- popValue: function popValue() {
- var valueArray = this.getValueArray();
- if (!valueArray.length) return;
- if (valueArray[valueArray.length - 1].clearableValue === false) return;
- this.setValue(valueArray.slice(0, valueArray.length - 1));
- },
-
- removeValue: function removeValue(value) {
- var valueArray = this.getValueArray();
- this.setValue(valueArray.filter(function (i) {
- return i !== value;
- }));
- this.focus();
- },
-
- clearValue: function clearValue(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, ignore it.
- if (event && event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- event.stopPropagation();
- event.preventDefault();
- this.setValue(null);
- this.setState({
- isOpen: false,
- inputValue: ''
- }, this.focus);
- },
-
- focusOption: function focusOption(option) {
- this.setState({
- focusedOption: option
- });
- },
-
- focusNextOption: function focusNextOption() {
- this.focusAdjacentOption('next');
- },
-
- focusPreviousOption: function focusPreviousOption() {
- this.focusAdjacentOption('previous');
- },
-
- focusAdjacentOption: function focusAdjacentOption(dir) {
- var options = this._visibleOptions.filter(function (i) {
- return !i.disabled;
- });
- this._scrollToFocusedOptionOnUpdate = true;
- if (!this.state.isOpen) {
- this.setState({
- isOpen: true,
- inputValue: '',
- focusedOption: this._focusedOption || options[dir === 'next' ? 0 : options.length - 1]
- });
- return;
- }
- if (!options.length) return;
- var focusedIndex = -1;
- for (var i = 0; i < options.length; i++) {
- if (this._focusedOption === options[i]) {
- focusedIndex = i;
- break;
- }
- }
- var focusedOption = options[0];
- if (dir === 'next' && focusedIndex > -1 && focusedIndex < options.length - 1) {
- focusedOption = options[focusedIndex + 1];
- } else if (dir === 'previous') {
- if (focusedIndex > 0) {
- focusedOption = options[focusedIndex - 1];
- } else {
- focusedOption = options[options.length - 1];
- }
- }
- this.setState({
- focusedOption: focusedOption
- });
- },
-
- selectFocusedOption: function selectFocusedOption() {
- // if (this.props.allowCreate && !this.state.focusedOption) {
- // return this.selectValue(this.state.inputValue);
- // }
- if (this._focusedOption) {
- return this.selectValue(this._focusedOption);
- }
- },
-
- renderLoading: function renderLoading() {
- if (!this.props.isLoading) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-loading-zone', 'aria-hidden': 'true' },
- _react2['default'].createElement('span', { className: 'Select-loading' })
- );
- },
-
- renderValue: function renderValue(valueArray, isOpen) {
- var _this2 = this;
-
- var renderLabel = this.props.valueRenderer || this.getOptionLabel;
- var ValueComponent = this.props.valueComponent;
- if (!valueArray.length) {
- return !this.state.inputValue ? _react2['default'].createElement(
- 'div',
- { className: 'Select-placeholder' },
- this.props.placeholder
- ) : null;
- }
- var onClick = this.props.onValueClick ? this.handleValueClick : null;
- if (this.props.multi) {
- return valueArray.map(function (value, i) {
- return _react2['default'].createElement(
- ValueComponent,
- {
- disabled: _this2.props.disabled || value.clearableValue === false,
- key: 'value-' + i + '-' + value[_this2.props.valueKey],
- onClick: onClick,
- onRemove: _this2.removeValue,
- value: value
- },
- renderLabel(value)
- );
- });
- } else if (!this.state.inputValue) {
- if (isOpen) onClick = null;
- return _react2['default'].createElement(
- ValueComponent,
- {
- disabled: this.props.disabled,
- onClick: onClick,
- value: valueArray[0]
- },
- renderLabel(valueArray[0])
- );
- }
- },
-
- renderInput: function renderInput(valueArray) {
- var className = (0, _classnames2['default'])('Select-input', this.props.inputProps.className);
- if (this.props.disabled || !this.props.searchable) {
- return _react2['default'].createElement('div', _extends({}, this.props.inputProps, {
- className: className,
- tabIndex: this.props.tabIndex || 0,
- onBlur: this.handleInputBlur,
- onFocus: this.handleInputFocus,
- ref: 'input',
- style: { border: 0, width: 1, display: 'inline-block' } }));
- }
- return _react2['default'].createElement(_reactInputAutosize2['default'], _extends({}, this.props.inputProps, {
- className: className,
- tabIndex: this.props.tabIndex,
- onBlur: this.handleInputBlur,
- onChange: this.handleInputChange,
- onFocus: this.handleInputFocus,
- minWidth: '5',
- ref: 'input',
- value: this.state.inputValue
- }));
- },
-
- renderClear: function renderClear() {
- if (!this.props.clearable || !this.props.value || this.props.multi && !this.props.value.length || this.props.disabled || this.props.isLoading) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-clear-zone', title: this.props.multi ? this.props.clearAllText : this.props.clearValueText, 'aria-label': this.props.multi ? this.props.clearAllText : this.props.clearValueText, onMouseDown: this.clearValue, onTouchEnd: this.clearValue },
- _react2['default'].createElement('span', { className: 'Select-clear', dangerouslySetInnerHTML: { __html: '×' } })
- );
- },
-
- renderArrow: function renderArrow() {
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-arrow-zone', onMouseDown: this.handleMouseDownOnArrow },
- _react2['default'].createElement('span', { className: 'Select-arrow', onMouseDown: this.handleMouseDownOnArrow })
- );
- },
-
- filterOptions: function filterOptions(excludeOptions) {
- var _this3 = this;
-
- var filterValue = this.state.inputValue;
- var options = this.props.options || [];
- if (typeof this.props.filterOptions === 'function') {
- return this.props.filterOptions.call(this, options, filterValue, excludeOptions);
- } else if (this.props.filterOptions) {
- if (this.props.ignoreAccents) {
- filterValue = (0, _utilsStripDiacritics2['default'])(filterValue);
- }
- if (this.props.ignoreCase) {
- filterValue = filterValue.toLowerCase();
- }
- if (excludeOptions) excludeOptions = excludeOptions.map(function (i) {
- return i[_this3.props.valueKey];
- });
- return options.filter(function (option) {
- if (excludeOptions && excludeOptions.indexOf(option[_this3.props.valueKey]) > -1) return false;
- if (_this3.props.filterOption) return _this3.props.filterOption.call(_this3, option, filterValue);
- if (!filterValue) return true;
- var valueTest = String(option[_this3.props.valueKey]);
- var labelTest = String(option[_this3.props.labelKey]);
- if (_this3.props.ignoreAccents) {
- if (_this3.props.matchProp !== 'label') valueTest = (0, _utilsStripDiacritics2['default'])(valueTest);
- if (_this3.props.matchProp !== 'value') labelTest = (0, _utilsStripDiacritics2['default'])(labelTest);
- }
- if (_this3.props.ignoreCase) {
- if (_this3.props.matchProp !== 'label') valueTest = valueTest.toLowerCase();
- if (_this3.props.matchProp !== 'value') labelTest = labelTest.toLowerCase();
- }
- return _this3.props.matchPos === 'start' ? _this3.props.matchProp !== 'label' && valueTest.substr(0, filterValue.length) === filterValue || _this3.props.matchProp !== 'value' && labelTest.substr(0, filterValue.length) === filterValue : _this3.props.matchProp !== 'label' && valueTest.indexOf(filterValue) >= 0 || _this3.props.matchProp !== 'value' && labelTest.indexOf(filterValue) >= 0;
- });
- } else {
- return options;
- }
- },
-
- renderMenu: function renderMenu(options, valueArray, focusedOption) {
- var _this4 = this;
-
- if (options && options.length) {
- var _ret = (function () {
- var Option = _this4.props.optionComponent;
- var renderLabel = _this4.props.optionRenderer || _this4.getOptionLabel;
- return {
- v: options.map(function (option, i) {
- var isSelected = valueArray && valueArray.indexOf(option) > -1;
- var isFocused = option === focusedOption;
- var optionRef = isFocused ? 'focused' : null;
- var optionClass = (0, _classnames2['default'])({
- 'Select-option': true,
- 'is-selected': isSelected,
- 'is-focused': isFocused,
- 'is-disabled': option.disabled
- });
- return _react2['default'].createElement(
- Option,
- {
- className: optionClass,
- isDisabled: option.disabled,
- isFocused: isFocused,
- key: 'option-' + i + '-' + option[_this4.props.valueKey],
- onSelect: _this4.selectValue,
- onFocus: _this4.focusOption,
- option: option,
- isSelected: isSelected,
- ref: optionRef
- },
- renderLabel(option)
- );
- })
- };
- })();
-
- if (typeof _ret === 'object') return _ret.v;
- } else {
- return _react2['default'].createElement(
- 'div',
- { className: 'Select-noresults' },
- this.props.noResultsText
- );
- }
- },
-
- renderHiddenField: function renderHiddenField(valueArray) {
- var _this5 = this;
-
- if (!this.props.name) return;
- var value = valueArray.map(function (i) {
- return stringifyValue(i[_this5.props.valueKey]);
- }).join(this.props.delimiter);
- return _react2['default'].createElement('input', { type: 'hidden', ref: 'value', name: this.props.name, value: value, disabled: this.props.disabled });
- },
-
- getFocusableOption: function getFocusableOption(selectedOption) {
- var options = this._visibleOptions;
- if (!options.length) return;
- var focusedOption = this.state.focusedOption || selectedOption;
- if (focusedOption && options.indexOf(focusedOption) > -1) return focusedOption;
- for (var i = 0; i < options.length; i++) {
- if (!options[i].disabled) return options[i];
- }
- },
-
- render: function render() {
- var valueArray = this.getValueArray();
- var options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
- var isOpen = this.state.isOpen;
- if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
- var focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
- var className = (0, _classnames2['default'])('Select', this.props.className, {
- 'Select--multi': this.props.multi,
- 'is-disabled': this.props.disabled,
- 'is-focused': this.state.isFocused,
- 'is-loading': this.props.isLoading,
- 'is-open': isOpen,
- 'is-pseudo-focused': this.state.isPseudoFocused,
- 'is-searchable': this.props.searchable,
- 'has-value': valueArray.length
- });
- return _react2['default'].createElement(
- 'div',
- { ref: 'wrapper', className: className, style: this.props.wrapperStyle },
- this.renderHiddenField(valueArray),
- _react2['default'].createElement(
- 'div',
- { ref: 'control', className: 'Select-control', style: this.props.style, onKeyDown: this.handleKeyDown, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
- this.renderValue(valueArray, isOpen),
- this.renderInput(valueArray),
- this.renderLoading(),
- this.renderClear(),
- this.renderArrow()
- ),
- isOpen ? _react2['default'].createElement(
- 'div',
- { ref: 'menuContainer', className: 'Select-menu-outer', style: this.props.menuContainerStyle },
- _react2['default'].createElement(
- 'div',
- { ref: 'menu', className: 'Select-menu', style: this.props.menuStyle, onScroll: this.handleMenuScroll, onMouseDown: this.handleMouseDownOnMenu },
- this.renderMenu(options, !this.props.multi ? valueArray : null, focusedOption)
- )
- ) : null
- );
- }
-
-});
-
-exports['default'] = Select;
-module.exports = exports['default'];
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./Async":1,"./Option":2,"./Value":4,"./utils/stripDiacritics":5}],4:[function(require,module,exports){
-(function (global){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
-
-var _react2 = _interopRequireDefault(_react);
-
-var _classnames = (typeof window !== "undefined" ? window['classNames'] : typeof global !== "undefined" ? global['classNames'] : null);
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var Value = _react2['default'].createClass({
-
- displayName: 'Value',
-
- propTypes: {
- disabled: _react2['default'].PropTypes.bool, // disabled prop passed to ReactSelect
- onClick: _react2['default'].PropTypes.func, // method to handle click on value label
- onRemove: _react2['default'].PropTypes.func, // method to handle removal of the value
- value: _react2['default'].PropTypes.object.isRequired },
-
- // the option object for this value
- handleMouseDown: function handleMouseDown(event) {
- if (event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- if (this.props.onClick) {
- event.stopPropagation();
- this.props.onClick(this.props.value, event);
- return;
- }
- if (this.props.value.href) {
- event.stopPropagation();
- }
- },
-
- onRemove: function onRemove(event) {
- event.preventDefault();
- event.stopPropagation();
- this.props.onRemove(this.props.value);
- },
-
- renderRemoveIcon: function renderRemoveIcon() {
- if (this.props.disabled || !this.props.onRemove) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-value-icon',
- onMouseDown: this.onRemove,
- onTouchEnd: this.onRemove },
- '×'
- );
- },
-
- renderLabel: function renderLabel() {
- var className = 'Select-value-label';
- return this.props.onClick || this.props.value.href ? _react2['default'].createElement(
- 'a',
- { className: className, href: this.props.value.href, target: this.props.value.target, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
- this.props.children
- ) : _react2['default'].createElement(
- 'span',
- { className: className },
- this.props.children
- );
- },
-
- render: function render() {
- return _react2['default'].createElement(
- 'div',
- { className: (0, _classnames2['default'])('Select-value', this.props.value.className),
- style: this.props.value.style,
- title: this.props.value.title
- },
- this.renderRemoveIcon(),
- this.renderLabel()
- );
- }
-
-});
-
-module.exports = Value;
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],5:[function(require,module,exports){
-'use strict';
-
-var map = [{ 'base': 'A', 'letters': /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g }, { 'base': 'AA', 'letters': /[\uA732]/g }, { 'base': 'AE', 'letters': /[\u00C6\u01FC\u01E2]/g }, { 'base': 'AO', 'letters': /[\uA734]/g }, { 'base': 'AU', 'letters': /[\uA736]/g }, { 'base': 'AV', 'letters': /[\uA738\uA73A]/g }, { 'base': 'AY', 'letters': /[\uA73C]/g }, { 'base': 'B', 'letters': /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g }, { 'base': 'C', 'letters': /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g }, { 'base': 'D', 'letters': /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g }, { 'base': 'DZ', 'letters': /[\u01F1\u01C4]/g }, { 'base': 'Dz', 'letters': /[\u01F2\u01C5]/g }, { 'base': 'E', 'letters': /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g }, { 'base': 'F', 'letters': /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g }, { 'base': 'G', 'letters': /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g }, { 'base': 'H', 'letters': /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g }, { 'base': 'I', 'letters': /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g }, { 'base': 'J', 'letters': /[\u004A\u24BF\uFF2A\u0134\u0248]/g }, { 'base': 'K', 'letters': /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g }, { 'base': 'L', 'letters': /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g }, { 'base': 'LJ', 'letters': /[\u01C7]/g }, { 'base': 'Lj', 'letters': /[\u01C8]/g }, { 'base': 'M', 'letters': /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g }, { 'base': 'N', 'letters': /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g }, { 'base': 'NJ', 'letters': /[\u01CA]/g }, { 'base': 'Nj', 'letters': /[\u01CB]/g }, { 'base': 'O', 'letters': /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g }, { 'base': 'OI', 'letters': /[\u01A2]/g }, { 'base': 'OO', 'letters': /[\uA74E]/g }, { 'base': 'OU', 'letters': /[\u0222]/g }, { 'base': 'P', 'letters': /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g }, { 'base': 'Q', 'letters': /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g }, { 'base': 'R', 'letters': /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g }, { 'base': 'S', 'letters': /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g }, { 'base': 'T', 'letters': /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g }, { 'base': 'TZ', 'letters': /[\uA728]/g }, { 'base': 'U', 'letters': /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g }, { 'base': 'V', 'letters': /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g }, { 'base': 'VY', 'letters': /[\uA760]/g }, { 'base': 'W', 'letters': /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g }, { 'base': 'X', 'letters': /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g }, { 'base': 'Y', 'letters': /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g }, { 'base': 'Z', 'letters': /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g }, { 'base': 'a', 'letters': /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g }, { 'base': 'aa', 'letters': /[\uA733]/g }, { 'base': 'ae', 'letters': /[\u00E6\u01FD\u01E3]/g }, { 'base': 'ao', 'letters': /[\uA735]/g }, { 'base': 'au', 'letters': /[\uA737]/g }, { 'base': 'av', 'letters': /[\uA739\uA73B]/g }, { 'base': 'ay', 'letters': /[\uA73D]/g }, { 'base': 'b', 'letters': /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g }, { 'base': 'c', 'letters': /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g }, { 'base': 'd', 'letters': /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g }, { 'base': 'dz', 'letters': /[\u01F3\u01C6]/g }, { 'base': 'e', 'letters': /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g }, { 'base': 'f', 'letters': /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g }, { 'base': 'g', 'letters': /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g }, { 'base': 'h', 'letters': /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g }, { 'base': 'hv', 'letters': /[\u0195]/g }, { 'base': 'i', 'letters': /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g }, { 'base': 'j', 'letters': /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g }, { 'base': 'k', 'letters': /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g }, { 'base': 'l', 'letters': /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g }, { 'base': 'lj', 'letters': /[\u01C9]/g }, { 'base': 'm', 'letters': /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g }, { 'base': 'n', 'letters': /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g }, { 'base': 'nj', 'letters': /[\u01CC]/g }, { 'base': 'o', 'letters': /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g }, { 'base': 'oi', 'letters': /[\u01A3]/g }, { 'base': 'ou', 'letters': /[\u0223]/g }, { 'base': 'oo', 'letters': /[\uA74F]/g }, { 'base': 'p', 'letters': /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g }, { 'base': 'q', 'letters': /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g }, { 'base': 'r', 'letters': /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g }, { 'base': 's', 'letters': /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g }, { 'base': 't', 'letters': /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g }, { 'base': 'tz', 'letters': /[\uA729]/g }, { 'base': 'u', 'letters': /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g }, { 'base': 'v', 'letters': /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g }, { 'base': 'vy', 'letters': /[\uA761]/g }, { 'base': 'w', 'letters': /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g }, { 'base': 'x', 'letters': /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g }, { 'base': 'y', 'letters': /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g }, { 'base': 'z', 'letters': /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g }];
-
-module.exports = function stripDiacritics(str) {
- for (var i = 0; i < map.length; i++) {
- str = str.replace(map[i].letters, map[i].base);
- }
- return str;
-};
-
-},{}]},{},[3])(3)
-});
\ No newline at end of file
diff --git a/dist/react-select.min.css b/dist/react-select.min.css
deleted file mode 100644
index f882afeaf7..0000000000
--- a/dist/react-select.min.css
+++ /dev/null
@@ -1 +0,0 @@
-.Select,.Select-control{position:relative}.Select-arrow-zone,.Select-clear-zone,.Select-loading-zone{text-align:center;cursor:pointer}.Select,.Select div,.Select input,.Select span{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.Select.is-disabled>.Select-control{background-color:#f9f9f9}.Select.is-disabled>.Select-control:hover{box-shadow:none}.Select.is-disabled .Select-arrow-zone{cursor:default;pointer-events:none}.Select-control{background-color:#fff;border-radius:4px;border:1px solid #ccc;color:#333;cursor:default;display:table;height:36px;outline:0;overflow:hidden;width:100%}.is-searchable.is-focused:not(.is-open)>.Select-control,.is-searchable.is-open>.Select-control{cursor:text}.Select-control:hover{box-shadow:0 1px 0 rgba(0,0,0,.06)}.is-open>.Select-control{border-bottom-right-radius:0;border-bottom-left-radius:0;background:#fff;border-color:#b3b3b3 #ccc #d9d9d9}.is-open>.Select-control>.Select-arrow{border-color:transparent transparent #999;border-width:0 5px 5px}.is-focused:not(.is-open)>.Select-control{border-color:#007eff;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 0 3px rgba(0,126,255,.1)}.Select-placeholder,:not(.Select--multi)>.Select-control .Select-value{bottom:0;color:#aaa;left:0;line-height:34px;padding-left:10px;padding-right:10px;position:absolute;right:0;top:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Select-arrow-zone,.Select-clear-zone,.Select-loading,.Select-loading-zone{position:relative;vertical-align:middle}.has-value.is-pseudo-focused:not(.Select--multi)>.Select-control>.Select-value .Select-value-label,.has-value:not(.Select--multi)>.Select-control>.Select-value .Select-value-label{color:#333}.has-value.is-pseudo-focused:not(.Select--multi)>.Select-control>.Select-value a.Select-value-label,.has-value:not(.Select--multi)>.Select-control>.Select-value a.Select-value-label{cursor:pointer;text-decoration:none}.has-value.is-pseudo-focused: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:hover,.has-value:not(.Select--multi)>.Select-control>.Select-value a.Select-value-label:focus,.has-value:not(.Select--multi)>.Select-control>.Select-value a.Select-value-label:hover{color:#007eff;outline:0;text-decoration:underline}.Select-input{height:34px;padding-left:10px;padding-right:10px;vertical-align:middle}.Select-input>input{background:none;border:0;box-shadow:none;cursor:default;display:inline-block;font-family:inherit;font-size:inherit;height:34px;margin:0;outline:0;padding:0;-webkit-appearance:none}.is-focused .Select-input>input{cursor:text}.has-value.is-pseudo-focused .Select-input{opacity:0}.Select-control:not(.is-searchable)>.Select-input{outline:0}.Select-loading-zone{display:table-cell;width:16px}.Select-loading{-webkit-animation:Select-animation-spin .4s infinite linear;-o-animation:Select-animation-spin .4s infinite linear;animation:Select-animation-spin .4s infinite linear;width:16px;height:16px;box-sizing:border-box;border-radius:50%;border:2px solid #ccc;border-right-color:#333;display:inline-block}.Select-clear-zone{-webkit-animation:Select-animation-fadeIn .2s;-o-animation:Select-animation-fadeIn .2s;animation:Select-animation-fadeIn .2s;color:#999;display:table-cell;width:17px}.Select-clear-zone:hover{color:#D0021B}.Select-clear{display:inline-block;font-size:18px;line-height:1}.Select--multi .Select-clear-zone{width:17px}.Select-arrow-zone{display:table-cell;width:25px;padding-right:5px}.Select-arrow{border-color:#999 transparent transparent;border-style:solid;border-width:5px 5px 2.5px;display:inline-block;height:0;width:0}.Select-noresults,.Select-option{box-sizing:border-box;display:block;padding:8px 10px}.Select-arrow-zone:hover>.Select-arrow,.is-open .Select-arrow{border-top-color:#666}@-webkit-keyframes Select-animation-fadeIn{from{opacity:0}to{opacity:1}}@keyframes Select-animation-fadeIn{from{opacity:0}to{opacity:1}}.Select-menu-outer{border-bottom-right-radius:4px;border-bottom-left-radius:4px;background-color:#fff;border:1px solid #ccc;border-top-color:#e6e6e6;box-shadow:0 1px 0 rgba(0,0,0,.06);box-sizing:border-box;margin-top:-1px;max-height:200px;position:absolute;top:100%;width:100%;z-index:1;-webkit-overflow-scrolling:touch}.Select-menu{max-height:198px;overflow-y:auto}.Select-option{background-color:#fff;color:#666;cursor:pointer}.Select-option:last-child{border-bottom-right-radius:4px;border-bottom-left-radius:4px}.Select-option.is-focused{background-color:rgba(0,126,255,.08);color:#333}.Select-option.is-disabled{color:#ccc;cursor:default}.Select-noresults{color:#999;cursor:default}.Select--multi .Select-input{vertical-align:middle;margin-left:10px;padding:0}.Select--multi.has-value .Select-input{margin-left:5px}.Select--multi .Select-value{background-color:rgba(0,126,255,.08);border-radius:2px;border:1px solid rgba(0,126,255,.24);color:#007eff;display:inline-block;font-size:.9em;line-height:1.4;margin-left:5px;margin-top:5px;vertical-align:top}.Select--multi .Select-value-icon,.Select--multi .Select-value-label{display:inline-block;vertical-align:middle}.Select--multi .Select-value-label{border-bottom-right-radius:2px;border-top-right-radius:2px;cursor:default;padding:2px 5px}.Select--multi a.Select-value-label{color:#007eff;cursor:pointer;text-decoration:none}.Select--multi a.Select-value-label:hover{text-decoration:underline}.Select--multi .Select-value-icon{cursor:pointer;border-bottom-left-radius:2px;border-top-left-radius:2px;border-right:1px solid rgba(0,126,255,.24);padding:1px 5px 3px}.Select--multi .Select-value-icon:focus,.Select--multi .Select-value-icon:hover{background-color:rgba(0,113,230,.08);color:#0071e6}.Select--multi .Select-value-icon:active{background-color:rgba(0,126,255,.24)}.Select--multi.is-disabled .Select-value{background-color:#fcfcfc;border:1px solid #e3e3e3;color:#333}.Select--multi.is-disabled .Select-value-icon{cursor:not-allowed;border-right:1px solid #e3e3e3}.Select--multi.is-disabled .Select-value-icon:active,.Select--multi.is-disabled .Select-value-icon:focus,.Select--multi.is-disabled .Select-value-icon:hover{background-color:#fcfcfc}@keyframes Select-animation-spin{to{transform:rotate(1turn)}}@-webkit-keyframes Select-animation-spin{to{-webkit-transform:rotate(1turn)}}
\ No newline at end of file
diff --git a/dist/react-select.min.js b/dist/react-select.min.js
deleted file mode 100644
index a9935d11ca..0000000000
--- a/dist/react-select.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var u;u="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,u.Select=e()}}(function(){return function e(u,t,s){function o(r,i){if(!t[r]){if(!u[r]){var a="function"==typeof require&&require;if(!i&&a)return a(r,!0);if(n)return n(r,!0);var l=new Error("Cannot find module '"+r+"'");throw l.code="MODULE_NOT_FOUND",l}var p=t[r]={exports:{}};u[r][0].call(p.exports,function(e){var t=u[r][1][e];return o(t?t:e)},p,p.exports,e,u,t,s)}return t[r].exports}for(var n="function"==typeof require&&require,r=0;r=0;--t){var s=u.slice(0,t);if(e[s]&&(u===s||e[s].complete))return e[s]}}function i(e,u){return e&&"function"==typeof e.then?e.then(function(e){u(null,e)},function(e){u(e)}):void 0}var a=Object.assign||function(e){for(var u=1;un.bottom||o.topu.offsetHeight&&!(u.scrollHeight-u.offsetHeight-u.scrollTop)&&this.props.onMenuScrollToBottom()}},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(){var e=this.props.value;if(this.props.multi){if("string"==typeof e&&(e=e.split(this.props.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(this.expandValue).filter(function(e){return e})}var u=this.expandValue(e);return u?[u]:[]},expandValue:function(e){if("string"!=typeof e&&"number"!=typeof e)return e;var u=this.props,t=u.options,s=u.valueKey;if(t)for(var o=0;o-1&&t0?u[t-1]:u[u.length-1]),this.setState({focusedOption:o})}},selectFocusedOption:function(){return this._focusedOption?this.selectValue(this._focusedOption):void 0},renderLoading:function(){return this.props.isLoading?a["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},a["default"].createElement("span",{className:"Select-loading"})):void 0},renderValue:function(e,u){var t=this,s=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:a["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var n=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,u){return a["default"].createElement(o,{disabled:t.props.disabled||e.clearableValue===!1,key:"value-"+u+"-"+e[t.props.valueKey],onClick:n,onRemove:t.removeValue,value:e},s(e))}):this.state.inputValue?void 0:(u&&(n=null),a["default"].createElement(o,{disabled:this.props.disabled,onClick:n,value:e[0]},s(e[0])))},renderInput:function(e){var u=(0,h["default"])("Select-input",this.props.inputProps.className);return this.props.disabled||!this.props.searchable?a["default"].createElement("div",r({},this.props.inputProps,{className:u,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:"input",style:{border:0,width:1,display:"inline-block"}})):a["default"].createElement(c["default"],r({},this.props.inputProps,{className:u,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,minWidth:"5",ref:"input",value:this.state.inputValue}))},renderClear:function(){return!this.props.clearable||!this.props.value||this.props.multi&&!this.props.value.length||this.props.disabled||this.props.isLoading?void 0:a["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchEnd:this.clearValue},a["default"].createElement("span",{className:"Select-clear",dangerouslySetInnerHTML:{__html:"×"}}))},renderArrow:function(){return a["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:this.handleMouseDownOnArrow},a["default"].createElement("span",{className:"Select-arrow",onMouseDown:this.handleMouseDownOnArrow}))},filterOptions:function(e){var u=this,t=this.state.inputValue,s=this.props.options||[];return"function"==typeof this.props.filterOptions?this.props.filterOptions.call(this,s,t,e):this.props.filterOptions?(this.props.ignoreAccents&&(t=(0,g["default"])(t)),this.props.ignoreCase&&(t=t.toLowerCase()),e&&(e=e.map(function(e){return e[u.props.valueKey]})),s.filter(function(s){if(e&&e.indexOf(s[u.props.valueKey])>-1)return!1;if(u.props.filterOption)return u.props.filterOption.call(u,s,t);if(!t)return!0;var o=String(s[u.props.valueKey]),n=String(s[u.props.labelKey]);return u.props.ignoreAccents&&("label"!==u.props.matchProp&&(o=(0,g["default"])(o)),"value"!==u.props.matchProp&&(n=(0,g["default"])(n))),u.props.ignoreCase&&("label"!==u.props.matchProp&&(o=o.toLowerCase()),"value"!==u.props.matchProp&&(n=n.toLowerCase())),"start"===u.props.matchPos?"label"!==u.props.matchProp&&o.substr(0,t.length)===t||"value"!==u.props.matchProp&&n.substr(0,t.length)===t:"label"!==u.props.matchProp&&o.indexOf(t)>=0||"value"!==u.props.matchProp&&n.indexOf(t)>=0})):s},renderMenu:function(e,u,t){var s=this;if(!e||!e.length)return a["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText);var o=function(){var o=s.props.optionComponent,n=s.props.optionRenderer||s.getOptionLabel;return{v:e.map(function(e,r){var i=u&&u.indexOf(e)>-1,l=e===t,p=l?"focused":null,d=(0,h["default"])({"Select-option":!0,"is-selected":i,"is-focused":l,"is-disabled":e.disabled});return a["default"].createElement(o,{className:d,isDisabled:e.disabled,isFocused:l,key:"option-"+r+"-"+e[s.props.valueKey],onSelect:s.selectValue,onFocus:s.focusOption,option:e,isSelected:i,ref:p},n(e))})}}();return"object"==typeof o?o.v:void 0},renderHiddenField:function(e){var u=this;if(this.props.name){var t=e.map(function(e){return n(e[u.props.valueKey])}).join(this.props.delimiter);return a["default"].createElement("input",{type:"hidden",ref:"value",name:this.props.name,value:t,disabled:this.props.disabled})}},getFocusableOption:function(e){var u=this._visibleOptions;if(u.length){var t=this.state.focusedOption||e;if(t&&u.indexOf(t)>-1)return t;for(var s=0;s
-*/
-
-},{"./components/Contributors":2,"./components/CustomComponents":3,"./components/CustomRender":4,"./components/Multiselect":5,"./components/NumericSelect":6,"./components/States":7,"react":undefined,"react-dom":undefined,"react-select":undefined}],2:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var CONTRIBUTORS = require('../data/contributors');
-var MAX_CONTRIBUTORS = 6;
-var ASYNC_DELAY = 500;
-
-var Contributors = _react2['default'].createClass({
- displayName: 'Contributors',
- propTypes: {
- label: _react2['default'].PropTypes.string
- },
- getInitialState: function getInitialState() {
- return {
- multi: true,
- value: [CONTRIBUTORS[0]]
- };
- },
- onChange: function onChange(value) {
- this.setState({
- value: value
- });
- },
- switchToMulti: function switchToMulti() {
- this.setState({
- multi: true,
- value: [this.state.value]
- });
- },
- switchToSingle: function switchToSingle() {
- this.setState({
- multi: false,
- value: this.state.value[0]
- });
- },
- getContributors: function getContributors(input, callback) {
- input = input.toLowerCase();
- var options = CONTRIBUTORS.filter(function (i) {
- return i.github.substr(0, input.length) === input;
- });
- var data = {
- options: options.slice(0, MAX_CONTRIBUTORS),
- complete: options.length <= MAX_CONTRIBUTORS
- };
- setTimeout(function () {
- callback(null, data);
- }, ASYNC_DELAY);
- },
- gotoContributor: function gotoContributor(value, event) {
- window.open('https://github.com/' + value.github);
- },
- render: function render() {
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'].Async, { multi: this.state.multi, value: this.state.value, onChange: this.onChange, onValueClick: this.gotoContributor, valueKey: 'github', labelKey: 'name', loadOptions: this.getContributors }),
- _react2['default'].createElement(
- 'div',
- { className: 'checkbox-list' },
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'radio', className: 'checkbox-control', checked: this.state.multi, onChange: this.switchToMulti }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Multiselect'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'radio', className: 'checkbox-control', checked: !this.state.multi, onChange: this.switchToSingle }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Single Value'
- )
- )
- ),
- _react2['default'].createElement(
- 'div',
- { className: 'hint' },
- 'This example implements custom label and value properties, async options and opens the github profiles in a new window when values are clicked'
- )
- );
- }
-});
-
-module.exports = Contributors;
-
-},{"../data/contributors":8,"react":undefined,"react-select":undefined}],3:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var _reactGravatar = require('react-gravatar');
-
-var _reactGravatar2 = _interopRequireDefault(_reactGravatar);
-
-var USERS = require('../data/users');
-var GRAVATAR_SIZE = 15;
-
-var GravatarOption = _react2['default'].createClass({
- displayName: 'GravatarOption',
-
- propTypes: {
- className: _react2['default'].PropTypes.string,
- isDisabled: _react2['default'].PropTypes.bool,
- isFocused: _react2['default'].PropTypes.bool,
- isSelected: _react2['default'].PropTypes.bool,
- onSelect: _react2['default'].PropTypes.func,
- onFocus: _react2['default'].PropTypes.func,
- onUnfocus: _react2['default'].PropTypes.func,
- option: _react2['default'].PropTypes.object.isRequired
- },
- handleMouseDown: function handleMouseDown(event) {
- event.preventDefault();
- event.stopPropagation();
- this.props.onSelect(this.props.option, event);
- },
- handleMouseEnter: function handleMouseEnter(event) {
- this.props.onFocus(this.props.option, event);
- },
- handleMouseMove: function handleMouseMove(event) {
- if (this.props.focused) return;
- this.props.onFocus(this.props.option, event);
- },
- handleMouseLeave: function handleMouseLeave(event) {
- this.props.onUnfocus(this.props.option, event);
- },
- render: function render() {
- var gravatarStyle = {
- borderRadius: 3,
- display: 'inline-block',
- marginRight: 10,
- position: 'relative',
- top: -2,
- verticalAlign: 'middle'
- };
- return _react2['default'].createElement(
- 'div',
- { className: this.props.className,
- onMouseDown: this.handleMouseDown,
- onMouseEnter: this.handleMouseEnter,
- onMouseMove: this.handleMouseMove,
- onMouseLeave: this.handleMouseLeave,
- title: this.props.option.title },
- _react2['default'].createElement(_reactGravatar2['default'], { email: this.props.option.email, size: GRAVATAR_SIZE, style: gravatarStyle }),
- this.props.children
- );
- }
-});
-
-var GravatarValue = _react2['default'].createClass({
- displayName: 'GravatarValue',
-
- propTypes: {
- placeholder: _react2['default'].PropTypes.string,
- value: _react2['default'].PropTypes.object
- },
- render: function render() {
- var gravatarStyle = {
- borderRadius: 3,
- display: 'inline-block',
- marginRight: 10,
- position: 'relative',
- top: -2,
- verticalAlign: 'middle'
- };
- return _react2['default'].createElement(
- 'div',
- { className: 'Select-value', title: this.props.value.title },
- _react2['default'].createElement(
- 'span',
- { className: 'Select-value-label' },
- _react2['default'].createElement(_reactGravatar2['default'], { email: this.props.value.email, size: GRAVATAR_SIZE, style: gravatarStyle }),
- this.props.children
- )
- );
- }
-});
-
-var UsersField = _react2['default'].createClass({
- displayName: 'UsersField',
-
- propTypes: {
- hint: _react2['default'].PropTypes.string,
- label: _react2['default'].PropTypes.string
- },
- getInitialState: function getInitialState() {
- return {};
- },
- setValue: function setValue(value) {
- this.setState({ value: value });
- },
- render: function render() {
- var placeholder = _react2['default'].createElement(
- 'span',
- null,
- '☺ Select User'
- );
-
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'], {
- onChange: this.setValue,
- optionComponent: GravatarOption,
- options: USERS,
- placeholder: placeholder,
- value: this.state.value,
- valueComponent: GravatarValue
- }),
- _react2['default'].createElement(
- 'div',
- { className: 'hint' },
- 'This example implements custom Option and Value components to render a Gravatar image for each user based on their email. It also demonstrates rendering HTML elements as the placeholder.'
- )
- );
- }
-});
-
-module.exports = UsersField;
-
-},{"../data/users":10,"react":undefined,"react-gravatar":14,"react-select":undefined}],4:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var DisabledUpsellOptions = _react2['default'].createClass({
- displayName: 'DisabledUpsellOptions',
- propTypes: {
- label: _react2['default'].PropTypes.string
- },
- getInitialState: function getInitialState() {
- return {};
- },
- setValue: function setValue(value) {
- this.setState({ value: value });
- console.log('Support level selected:', value.label);
- },
- renderLink: function renderLink() {
- return _react2['default'].createElement(
- 'a',
- { style: { marginLeft: 5 }, href: '/upgrade', target: '_blank' },
- 'Upgrade here!'
- );
- },
- renderOption: function renderOption(option) {
- return _react2['default'].createElement(
- 'span',
- { style: { color: option.color } },
- option.label,
- ' ',
- option.link
- );
- },
- renderValue: function renderValue(option) {
- return _react2['default'].createElement(
- 'strong',
- { style: { color: option.color } },
- option.label
- );
- },
- render: function render() {
- var options = [{ label: 'Basic customer support', value: 'basic', color: '#E31864' }, { label: 'Premium customer support', value: 'premium', color: '#6216A3' }, { label: 'Pro customer support', value: 'pro', disabled: true, link: this.renderLink() }];
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'], {
- placeholder: 'Select your support level',
- options: options,
- optionRenderer: this.renderOption,
- onChange: this.setValue,
- value: this.state.value,
- valueRenderer: this.renderValue
- }),
- _react2['default'].createElement(
- 'div',
- { className: 'hint' },
- 'This demonstates custom render methods and links in disabled options'
- )
- );
- }
-});
-module.exports = DisabledUpsellOptions;
-
-},{"react":undefined,"react-select":undefined}],5:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var FLAVOURS = [{ label: 'Chocolate', value: 'chocolate' }, { label: 'Vanilla', value: 'vanilla' }, { label: 'Strawberry', value: 'strawberry' }, { label: 'Caramel', value: 'caramel' }, { label: 'Cookies and Cream', value: 'cookiescream' }, { label: 'Peppermint', value: 'peppermint' }];
-
-var WHY_WOULD_YOU = [{ label: 'Chocolate (are you crazy?)', value: 'chocolate', disabled: true }].concat(FLAVOURS.slice(1));
-
-var MultiSelectField = _react2['default'].createClass({
- displayName: 'MultiSelectField',
- propTypes: {
- label: _react2['default'].PropTypes.string
- },
- getInitialState: function getInitialState() {
- return {
- disabled: false,
- crazy: false,
- options: FLAVOURS,
- value: []
- };
- },
- handleSelectChange: function handleSelectChange(value) {
- console.log('You\'ve selected:', value);
- this.setState({ value: value });
- },
- toggleDisabled: function toggleDisabled(e) {
- this.setState({ disabled: e.target.checked });
- },
- toggleChocolate: function toggleChocolate(e) {
- var crazy = e.target.checked;
- this.setState({
- crazy: crazy,
- options: crazy ? WHY_WOULD_YOU : FLAVOURS
- });
- },
- render: function render() {
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'], { multi: true, simpleValue: true, disabled: this.state.disabled, value: this.state.value, placeholder: 'Select your favourite(s)', options: this.state.options, onChange: this.handleSelectChange }),
- _react2['default'].createElement(
- 'div',
- { className: 'checkbox-list' },
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.disabled, onChange: this.toggleDisabled }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Disable the control'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.crazy, onChange: this.toggleChocolate }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'I don\'t like Chocolate (disabled the option)'
- )
- )
- )
- );
- }
-});
-
-module.exports = MultiSelectField;
-
-},{"react":undefined,"react-select":undefined}],6:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var ValuesAsNumbersField = _react2['default'].createClass({
- displayName: 'ValuesAsNumbersField',
- propTypes: {
- label: _react2['default'].PropTypes.string
- },
- getInitialState: function getInitialState() {
- return {
- options: [{ value: 10, label: 'Ten' }, { value: 11, label: 'Eleven' }, { value: 12, label: 'Twelve' }, { value: 23, label: 'Twenty-three' }, { value: 24, label: 'Twenty-four' }],
- matchPos: 'any',
- matchValue: true,
- matchLabel: true,
- value: null,
- multi: false
- };
- },
- onChangeMatchStart: function onChangeMatchStart(event) {
- this.setState({
- matchPos: event.target.checked ? 'start' : 'any'
- });
- },
- onChangeMatchValue: function onChangeMatchValue(event) {
- this.setState({
- matchValue: event.target.checked
- });
- },
- onChangeMatchLabel: function onChangeMatchLabel(event) {
- this.setState({
- matchLabel: event.target.checked
- });
- },
- onChange: function onChange(value) {
- this.setState({ value: value });
- console.log('Numeric Select value changed to', value);
- },
- onChangeMulti: function onChangeMulti(event) {
- this.setState({
- multi: event.target.checked
- });
- },
- render: function render() {
- var matchProp = 'any';
- if (this.state.matchLabel && !this.state.matchValue) {
- matchProp = 'label';
- }
- if (!this.state.matchLabel && this.state.matchValue) {
- matchProp = 'value';
- }
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'], {
- matchPos: this.state.matchPos,
- matchProp: matchProp,
- multi: this.state.multi,
- onChange: this.onChange,
- options: this.state.options,
- simpleValue: true,
- value: this.state.value
- }),
- _react2['default'].createElement(
- 'div',
- { className: 'checkbox-list' },
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.multi, onChange: this.onChangeMulti }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Multi-Select'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.matchValue, onChange: this.onChangeMatchValue }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Match value only'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.matchLabel, onChange: this.onChangeMatchLabel }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Match label only'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.matchPos === 'start', onChange: this.onChangeMatchStart }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Only include matches from the start of the string'
- )
- )
- ),
- _react2['default'].createElement(
- 'div',
- { className: 'hint' },
- 'This example uses simple numeric values'
- )
- );
- }
-});
-
-module.exports = ValuesAsNumbersField;
-
-},{"react":undefined,"react-select":undefined}],7:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var STATES = require('../data/states');
-
-var StatesField = _react2['default'].createClass({
- displayName: 'StatesField',
- propTypes: {
- label: _react2['default'].PropTypes.string,
- searchable: _react2['default'].PropTypes.bool
- },
- getDefaultProps: function getDefaultProps() {
- return {
- label: 'States:',
- searchable: true
- };
- },
- getInitialState: function getInitialState() {
- return {
- country: 'AU',
- disabled: false,
- searchable: this.props.searchable,
- selectValue: 'new-south-wales',
- clearable: true
- };
- },
- switchCountry: function switchCountry(e) {
- var newCountry = e.target.value;
- console.log('Country changed to ' + newCountry);
- this.setState({
- country: newCountry,
- selectValue: null
- });
- },
- updateValue: function updateValue(newValue) {
- console.log('State changed to ' + newValue);
- this.setState({
- selectValue: newValue
- });
- },
- focusStateSelect: function focusStateSelect() {
- this.refs.stateSelect.focus();
- },
- toggleCheckbox: function toggleCheckbox(e) {
- var newState = {};
- newState[e.target.name] = e.target.checked;
- this.setState(newState);
- },
- render: function render() {
- var options = STATES[this.state.country];
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'], { ref: 'stateSelect', autofocus: true, options: options, simpleValue: true, clearable: this.state.clearable, name: 'selected-state', disabled: this.state.disabled, value: this.state.selectValue, onChange: this.updateValue, searchable: this.state.searchable }),
- _react2['default'].createElement(
- 'div',
- { style: { marginTop: 14 } },
- _react2['default'].createElement(
- 'button',
- { type: 'button', onClick: this.focusStateSelect },
- 'Focus Select'
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox', style: { marginLeft: 10 } },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', name: 'searchable', checked: this.state.searchable, onChange: this.toggleCheckbox }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Searchable'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox', style: { marginLeft: 10 } },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', name: 'disabled', checked: this.state.disabled, onChange: this.toggleCheckbox }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Disabled'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox', style: { marginLeft: 10 } },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', name: 'clearable', checked: this.state.clearable, onChange: this.toggleCheckbox }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Clearable'
- )
- )
- ),
- _react2['default'].createElement(
- 'div',
- { className: 'checkbox-list' },
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'radio', className: 'checkbox-control', checked: this.state.country === 'AU', value: 'AU', onChange: this.switchCountry }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Australia'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'radio', className: 'checkbox-control', checked: this.state.country === 'US', value: 'US', onChange: this.switchCountry }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'United States'
- )
- )
- )
- );
- }
-});
-
-module.exports = StatesField;
-
-},{"../data/states":9,"react":undefined,"react-select":undefined}],8:[function(require,module,exports){
-'use strict';
-
-module.exports = [{ github: 'jedwatson', name: 'Jed Watson' }, { github: 'bruderstein', name: 'Dave Brotherstone' }, { github: 'jossmac', name: 'Joss Mackison' }, { github: 'jniechcial', name: 'Jakub Niechciał' }, { github: 'craigdallimore', name: 'Craig Dallimore' }, { github: 'julen', name: 'Julen Ruiz Aizpuru' }, { github: 'dcousens', name: 'Daniel Cousens' }, { github: 'jgautsch', name: 'Jon Gautsch' }, { github: 'dmitry-smirnov', name: 'Dmitry Smirnov' }];
-
-},{}],9:[function(require,module,exports){
-'use strict';
-
-exports.AU = [{ value: 'australian-capital-territory', label: 'Australian Capital Territory', className: 'State-ACT' }, { value: 'new-south-wales', label: 'New South Wales', className: 'State-NSW' }, { value: 'victoria', label: 'Victoria', className: 'State-Vic' }, { value: 'queensland', label: 'Queensland', className: 'State-Qld' }, { value: 'western-australia', label: 'Western Australia', className: 'State-WA' }, { value: 'south-australia', label: 'South Australia', className: 'State-SA' }, { value: 'tasmania', label: 'Tasmania', className: 'State-Tas' }, { value: 'northern-territory', label: 'Northern Territory', className: 'State-NT' }];
-
-exports.US = [{ value: 'AL', label: 'Alabama', disabled: true }, { value: 'AK', label: 'Alaska' }, { value: 'AS', label: 'American Samoa' }, { value: 'AZ', label: 'Arizona' }, { value: 'AR', label: 'Arkansas' }, { value: 'CA', label: 'California' }, { value: 'CO', label: 'Colorado' }, { value: 'CT', label: 'Connecticut' }, { value: 'DE', label: 'Delaware' }, { value: 'DC', label: 'District Of Columbia' }, { value: 'FM', label: 'Federated States Of Micronesia' }, { value: 'FL', label: 'Florida' }, { value: 'GA', label: 'Georgia' }, { value: 'GU', label: 'Guam' }, { value: 'HI', label: 'Hawaii' }, { value: 'ID', label: 'Idaho' }, { value: 'IL', label: 'Illinois' }, { value: 'IN', label: 'Indiana' }, { value: 'IA', label: 'Iowa' }, { value: 'KS', label: 'Kansas' }, { value: 'KY', label: 'Kentucky' }, { value: 'LA', label: 'Louisiana' }, { value: 'ME', label: 'Maine' }, { value: 'MH', label: 'Marshall Islands' }, { value: 'MD', label: 'Maryland' }, { value: 'MA', label: 'Massachusetts' }, { value: 'MI', label: 'Michigan' }, { value: 'MN', label: 'Minnesota' }, { value: 'MS', label: 'Mississippi' }, { value: 'MO', label: 'Missouri' }, { value: 'MT', label: 'Montana' }, { value: 'NE', label: 'Nebraska' }, { value: 'NV', label: 'Nevada' }, { value: 'NH', label: 'New Hampshire' }, { value: 'NJ', label: 'New Jersey' }, { value: 'NM', label: 'New Mexico' }, { value: 'NY', label: 'New York' }, { value: 'NC', label: 'North Carolina' }, { value: 'ND', label: 'North Dakota' }, { value: 'MP', label: 'Northern Mariana Islands' }, { value: 'OH', label: 'Ohio' }, { value: 'OK', label: 'Oklahoma' }, { value: 'OR', label: 'Oregon' }, { value: 'PW', label: 'Palau' }, { value: 'PA', label: 'Pennsylvania' }, { value: 'PR', label: 'Puerto Rico' }, { value: 'RI', label: 'Rhode Island' }, { value: 'SC', label: 'South Carolina' }, { value: 'SD', label: 'South Dakota' }, { value: 'TN', label: 'Tennessee' }, { value: 'TX', label: 'Texas' }, { value: 'UT', label: 'Utah' }, { value: 'VT', label: 'Vermont' }, { value: 'VI', label: 'Virgin Islands' }, { value: 'VA', label: 'Virginia' }, { value: 'WA', label: 'Washington' }, { value: 'WV', label: 'West Virginia' }, { value: 'WI', label: 'Wisconsin' }, { value: 'WY', label: 'Wyoming' }];
-
-},{}],10:[function(require,module,exports){
-'use strict';
-
-module.exports = [{ value: 'John Smith', label: 'John Smith', email: 'john@smith.com' }, { value: 'Merry Jane', label: 'Merry Jane', email: 'merry@jane.com' }, { value: 'Stan Hoper', label: 'Stan Hoper', email: 'stan@hoper.com' }];
-
-},{}],11:[function(require,module,exports){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-'use strict';
-
-// If obj.hasOwnProperty has been overridden, then calling
-// obj.hasOwnProperty(prop) will break.
-// See: https://github.com/joyent/node/issues/1707
-function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
-}
-
-module.exports = function(qs, sep, eq, options) {
- sep = sep || '&';
- eq = eq || '=';
- var obj = {};
-
- if (typeof qs !== 'string' || qs.length === 0) {
- return obj;
- }
-
- var regexp = /\+/g;
- qs = qs.split(sep);
-
- var maxKeys = 1000;
- if (options && typeof options.maxKeys === 'number') {
- maxKeys = options.maxKeys;
- }
-
- var len = qs.length;
- // maxKeys <= 0 means that we should not limit keys count
- if (maxKeys > 0 && len > maxKeys) {
- len = maxKeys;
- }
-
- for (var i = 0; i < len; ++i) {
- var x = qs[i].replace(regexp, '%20'),
- idx = x.indexOf(eq),
- kstr, vstr, k, v;
-
- if (idx >= 0) {
- kstr = x.substr(0, idx);
- vstr = x.substr(idx + 1);
- } else {
- kstr = x;
- vstr = '';
- }
-
- k = decodeURIComponent(kstr);
- v = decodeURIComponent(vstr);
-
- if (!hasOwnProperty(obj, k)) {
- obj[k] = v;
- } else if (isArray(obj[k])) {
- obj[k].push(v);
- } else {
- obj[k] = [obj[k], v];
- }
- }
-
- return obj;
-};
-
-var isArray = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === '[object Array]';
-};
-
-},{}],12:[function(require,module,exports){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-'use strict';
-
-var stringifyPrimitive = function(v) {
- switch (typeof v) {
- case 'string':
- return v;
-
- case 'boolean':
- return v ? 'true' : 'false';
-
- case 'number':
- return isFinite(v) ? v : '';
-
- default:
- return '';
- }
-};
-
-module.exports = function(obj, sep, eq, name) {
- sep = sep || '&';
- eq = eq || '=';
- if (obj === null) {
- obj = undefined;
- }
-
- if (typeof obj === 'object') {
- return map(objectKeys(obj), function(k) {
- var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
- if (isArray(obj[k])) {
- return map(obj[k], function(v) {
- return ks + encodeURIComponent(stringifyPrimitive(v));
- }).join(sep);
- } else {
- return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
- }
- }).join(sep);
-
- }
-
- if (!name) return '';
- return encodeURIComponent(stringifyPrimitive(name)) + eq +
- encodeURIComponent(stringifyPrimitive(obj));
-};
-
-var isArray = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === '[object Array]';
-};
-
-function map (xs, f) {
- if (xs.map) return xs.map(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- res.push(f(xs[i], i));
- }
- return res;
-}
-
-var objectKeys = Object.keys || function (obj) {
- var res = [];
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
- }
- return res;
-};
-
-},{}],13:[function(require,module,exports){
-'use strict';
-
-exports.decode = exports.parse = require('./decode');
-exports.encode = exports.stringify = require('./encode');
-
-},{"./decode":11,"./encode":12}],14:[function(require,module,exports){
-// Generated by CoffeeScript 1.10.0
-var React, isRetina, md5, querystring;
-
-React = require('react');
-
-md5 = require('md5');
-
-querystring = require('querystring');
-
-isRetina = require('is-retina');
-
-module.exports = React.createClass({
- displayName: 'Gravatar',
- propTypes: {
- email: React.PropTypes.string,
- md5: React.PropTypes.string,
- size: React.PropTypes.number,
- rating: React.PropTypes.string,
- https: React.PropTypes.bool,
- "default": React.PropTypes.string,
- className: React.PropTypes.string
- },
- getDefaultProps: function() {
- return {
- size: 50,
- rating: 'g',
- https: false,
- "default": "retro",
- className: ""
- };
- },
- render: function() {
- var base, hash, modernBrowser, query, retinaQuery, retinaSrc, src;
- base = this.props.https ? "https://secure.gravatar.com/avatar/" : 'http://www.gravatar.com/avatar/';
- query = querystring.stringify({
- s: this.props.size,
- r: this.props.rating,
- d: this.props["default"]
- });
- retinaQuery = querystring.stringify({
- s: this.props.size * 2,
- r: this.props.rating,
- d: this.props["default"]
- });
- if (this.props.md5) {
- hash = this.props.md5;
- } else if (this.props.email) {
- hash = md5(this.props.email);
- } else {
- console.warn('Gravatar image can not be fetched. Either the "email" or "md5" prop must be specified.');
- return React.createElement("script", null);
- }
- src = base + hash + "?" + query;
- retinaSrc = base + hash + "?" + retinaQuery;
- modernBrowser = true;
- if (typeof window !== "undefined" && window !== null) {
- modernBrowser = 'srcset' in document.createElement('img');
- }
- if (!modernBrowser && isRetina()) {
- return React.createElement("img", {
- "style": this.props.style,
- "className": "react-gravatar " + this.props.className,
- "src": retinaSrc,
- "height": this.props.size,
- "width": this.props.size
- });
- } else {
- return React.createElement("img", {
- "style": this.props.style,
- "className": "react-gravatar " + this.props.className,
- "src": src,
- "srcSet": retinaSrc + " 2x",
- "height": this.props.size,
- "width": this.props.size
- });
- }
- }
-});
-
-},{"is-retina":15,"md5":16,"querystring":13,"react":undefined}],15:[function(require,module,exports){
-module.exports = function() {
- var mediaQuery;
- if (typeof window !== "undefined" && window !== null) {
- mediaQuery = "(-webkit-min-device-pixel-ratio: 1.25), (min--moz-device-pixel-ratio: 1.25), (-o-min-device-pixel-ratio: 5/4), (min-resolution: 1.25dppx)";
- if (window.devicePixelRatio > 1.25) {
- return true;
- }
- if (window.matchMedia && window.matchMedia(mediaQuery).matches) {
- return true;
- }
- }
- return false;
-};
-
-},{}],16:[function(require,module,exports){
-(function(){
- var crypt = require('crypt'),
- utf8 = require('charenc').utf8,
- isBuffer = require('is-buffer'),
- bin = require('charenc').bin,
-
- // The core
- md5 = function (message, options) {
- // Convert to byte array
- if (message.constructor == String)
- if (options && options.encoding === 'binary')
- message = bin.stringToBytes(message);
- else
- message = utf8.stringToBytes(message);
- else if (isBuffer(message))
- message = Array.prototype.slice.call(message, 0);
- else if (!Array.isArray(message))
- message = message.toString();
- // else, assume byte array already
-
- var m = crypt.bytesToWords(message),
- l = message.length * 8,
- a = 1732584193,
- b = -271733879,
- c = -1732584194,
- d = 271733878;
-
- // Swap endian
- for (var i = 0; i < m.length; i++) {
- m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
- ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
- }
-
- // Padding
- m[l >>> 5] |= 0x80 << (l % 32);
- m[(((l + 64) >>> 9) << 4) + 14] = l;
-
- // Method shortcuts
- var FF = md5._ff,
- GG = md5._gg,
- HH = md5._hh,
- II = md5._ii;
-
- for (var i = 0; i < m.length; i += 16) {
-
- var aa = a,
- bb = b,
- cc = c,
- dd = d;
-
- a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
- d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
- c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
- b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
- a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
- d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
- c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
- b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
- a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
- d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
- c = FF(c, d, a, b, m[i+10], 17, -42063);
- b = FF(b, c, d, a, m[i+11], 22, -1990404162);
- a = FF(a, b, c, d, m[i+12], 7, 1804603682);
- d = FF(d, a, b, c, m[i+13], 12, -40341101);
- c = FF(c, d, a, b, m[i+14], 17, -1502002290);
- b = FF(b, c, d, a, m[i+15], 22, 1236535329);
-
- a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
- d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
- c = GG(c, d, a, b, m[i+11], 14, 643717713);
- b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
- a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
- d = GG(d, a, b, c, m[i+10], 9, 38016083);
- c = GG(c, d, a, b, m[i+15], 14, -660478335);
- b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
- a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
- d = GG(d, a, b, c, m[i+14], 9, -1019803690);
- c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
- b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
- a = GG(a, b, c, d, m[i+13], 5, -1444681467);
- d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
- c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
- b = GG(b, c, d, a, m[i+12], 20, -1926607734);
-
- a = HH(a, b, c, d, m[i+ 5], 4, -378558);
- d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
- c = HH(c, d, a, b, m[i+11], 16, 1839030562);
- b = HH(b, c, d, a, m[i+14], 23, -35309556);
- a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
- d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
- c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
- b = HH(b, c, d, a, m[i+10], 23, -1094730640);
- a = HH(a, b, c, d, m[i+13], 4, 681279174);
- d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
- c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
- b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
- a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
- d = HH(d, a, b, c, m[i+12], 11, -421815835);
- c = HH(c, d, a, b, m[i+15], 16, 530742520);
- b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
-
- a = II(a, b, c, d, m[i+ 0], 6, -198630844);
- d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
- c = II(c, d, a, b, m[i+14], 15, -1416354905);
- b = II(b, c, d, a, m[i+ 5], 21, -57434055);
- a = II(a, b, c, d, m[i+12], 6, 1700485571);
- d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
- c = II(c, d, a, b, m[i+10], 15, -1051523);
- b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
- a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
- d = II(d, a, b, c, m[i+15], 10, -30611744);
- c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
- b = II(b, c, d, a, m[i+13], 21, 1309151649);
- a = II(a, b, c, d, m[i+ 4], 6, -145523070);
- d = II(d, a, b, c, m[i+11], 10, -1120210379);
- c = II(c, d, a, b, m[i+ 2], 15, 718787259);
- b = II(b, c, d, a, m[i+ 9], 21, -343485551);
-
- a = (a + aa) >>> 0;
- b = (b + bb) >>> 0;
- c = (c + cc) >>> 0;
- d = (d + dd) >>> 0;
- }
-
- return crypt.endian([a, b, c, d]);
- };
-
- // Auxiliary functions
- md5._ff = function (a, b, c, d, x, s, t) {
- var n = a + (b & c | ~b & d) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
- md5._gg = function (a, b, c, d, x, s, t) {
- var n = a + (b & d | c & ~d) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
- md5._hh = function (a, b, c, d, x, s, t) {
- var n = a + (b ^ c ^ d) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
- md5._ii = function (a, b, c, d, x, s, t) {
- var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
-
- // Package private blocksize
- md5._blocksize = 16;
- md5._digestsize = 16;
-
- module.exports = function (message, options) {
- if(typeof message == 'undefined')
- return;
-
- var digestbytes = crypt.wordsToBytes(md5(message, options));
- return options && options.asBytes ? digestbytes :
- options && options.asString ? bin.bytesToString(digestbytes) :
- crypt.bytesToHex(digestbytes);
- };
-
-})();
-
-},{"charenc":17,"crypt":18,"is-buffer":19}],17:[function(require,module,exports){
-var charenc = {
- // UTF-8 encoding
- utf8: {
- // Convert a string to a byte array
- stringToBytes: function(str) {
- return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
- },
-
- // Convert a byte array to a string
- bytesToString: function(bytes) {
- return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
- }
- },
-
- // Binary encoding
- bin: {
- // Convert a string to a byte array
- stringToBytes: function(str) {
- for (var bytes = [], i = 0; i < str.length; i++)
- bytes.push(str.charCodeAt(i) & 0xFF);
- return bytes;
- },
-
- // Convert a byte array to a string
- bytesToString: function(bytes) {
- for (var str = [], i = 0; i < bytes.length; i++)
- str.push(String.fromCharCode(bytes[i]));
- return str.join('');
- }
- }
-};
-
-module.exports = charenc;
-
-},{}],18:[function(require,module,exports){
-(function() {
- var base64map
- = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
-
- crypt = {
- // Bit-wise rotation left
- rotl: function(n, b) {
- return (n << b) | (n >>> (32 - b));
- },
-
- // Bit-wise rotation right
- rotr: function(n, b) {
- return (n << (32 - b)) | (n >>> b);
- },
-
- // Swap big-endian to little-endian and vice versa
- endian: function(n) {
- // If number given, swap endian
- if (n.constructor == Number) {
- return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
- }
-
- // Else, assume array and swap all items
- for (var i = 0; i < n.length; i++)
- n[i] = crypt.endian(n[i]);
- return n;
- },
-
- // Generate an array of any length of random bytes
- randomBytes: function(n) {
- for (var bytes = []; n > 0; n--)
- bytes.push(Math.floor(Math.random() * 256));
- return bytes;
- },
-
- // Convert a byte array to big-endian 32-bit words
- bytesToWords: function(bytes) {
- for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
- words[b >>> 5] |= bytes[i] << (24 - b % 32);
- return words;
- },
-
- // Convert big-endian 32-bit words to a byte array
- wordsToBytes: function(words) {
- for (var bytes = [], b = 0; b < words.length * 32; b += 8)
- bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
- return bytes;
- },
-
- // Convert a byte array to a hex string
- bytesToHex: function(bytes) {
- for (var hex = [], i = 0; i < bytes.length; i++) {
- hex.push((bytes[i] >>> 4).toString(16));
- hex.push((bytes[i] & 0xF).toString(16));
- }
- return hex.join('');
- },
-
- // Convert a hex string to a byte array
- hexToBytes: function(hex) {
- for (var bytes = [], c = 0; c < hex.length; c += 2)
- bytes.push(parseInt(hex.substr(c, 2), 16));
- return bytes;
- },
-
- // Convert a byte array to a base-64 string
- bytesToBase64: function(bytes) {
- for (var base64 = [], i = 0; i < bytes.length; i += 3) {
- var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
- for (var j = 0; j < 4; j++)
- if (i * 8 + j * 6 <= bytes.length * 8)
- base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
- else
- base64.push('=');
- }
- return base64.join('');
- },
-
- // Convert a base-64 string to a byte array
- base64ToBytes: function(base64) {
- // Remove non-base-64 characters
- base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
-
- for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
- imod4 = ++i % 4) {
- if (imod4 == 0) continue;
- bytes.push(((base64map.indexOf(base64.charAt(i - 1))
- & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
- | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
- }
- return bytes;
- }
- };
-
- module.exports = crypt;
-})();
-
-},{}],19:[function(require,module,exports){
-/**
- * Determine if an object is Buffer
- *
- * Author: Feross Aboukhadijeh
- * License: MIT
- *
- * `npm install is-buffer`
- */
-
-module.exports = function (obj) {
- return !!(
- obj != null &&
- obj.constructor &&
- typeof obj.constructor.isBuffer === 'function' &&
- obj.constructor.isBuffer(obj)
- )
-}
-
-},{}]},{},[1]);
diff --git a/examples/dist/bundle.js b/examples/dist/bundle.js
deleted file mode 100644
index 164c32afc9..0000000000
--- a/examples/dist/bundle.js
+++ /dev/null
@@ -1,1075 +0,0 @@
-require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0; --i) {
- var cacheKey = input.slice(0, i);
- if (cache[cacheKey] && (input === cacheKey || cache[cacheKey].complete)) {
- return cache[cacheKey];
- }
- }
-}
-
-function thenPromise(promise, callback) {
- if (!promise || typeof promise.then !== 'function') return;
- return promise.then(function (data) {
- callback(null, data);
- }, function (err) {
- callback(err);
- });
-}
-
-var Async = _react2['default'].createClass({
- displayName: 'Async',
-
- propTypes: {
- cache: _react2['default'].PropTypes.any, // object to use to cache results, can be null to disable cache
- loadOptions: _react2['default'].PropTypes.func.isRequired, // function to call to load options asynchronously
- ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering (shared with Select)
- ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering (shared with Select)
- isLoading: _react2['default'].PropTypes.bool, // overrides the isLoading state when set to true
- loadingPlaceholder: _react2['default'].PropTypes.string, // replaces the placeholder while options are loading
- minimumInput: _react2['default'].PropTypes.number, // the minimum number of characters that trigger loadOptions
- noResultsText: _react2['default'].PropTypes.string, // placeholder displayed when there are no matching search results (shared with Select)
- placeholder: _react2['default'].PropTypes.oneOfType([// field placeholder, displayed when there's no value (shared with Select)
- _react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
- searchingText: _react2['default'].PropTypes.string, // message to display while options are loading
- searchPromptText: _react2['default'].PropTypes.string },
- // label to prompt for search input
- getDefaultProps: function getDefaultProps() {
- return {
- cache: true,
- ignoreAccents: true,
- ignoreCase: true,
- loadingPlaceholder: 'Loading...',
- minimumInput: 0,
- searchingText: 'Searching...',
- searchPromptText: 'Type to search'
- };
- },
- getInitialState: function getInitialState() {
- return {
- cache: initCache(this.props.cache),
- isLoading: false,
- options: []
- };
- },
- componentWillMount: function componentWillMount() {
- this._lastInput = '';
- },
- componentDidMount: function componentDidMount() {
- this.loadOptions('');
- },
- componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
- if (nextProps.cache !== this.props.cache) {
- this.setState({
- cache: initCache(nextProps.cache)
- });
- }
- },
- resetState: function resetState() {
- this._currentRequestId = -1;
- this.setState({
- isLoading: false,
- options: []
- });
- },
- getResponseHandler: function getResponseHandler(input) {
- var _this = this;
-
- var _requestId = this._currentRequestId = requestId++;
- return function (err, data) {
- if (err) throw err;
- if (!_this.isMounted()) return;
- updateCache(_this.state.cache, input, data);
- if (_requestId !== _this._currentRequestId) return;
- _this.setState({
- isLoading: false,
- options: data && data.options || []
- });
- };
- },
- loadOptions: function loadOptions(input) {
- if (this.props.ignoreAccents) input = (0, _utilsStripDiacritics2['default'])(input);
- if (this.props.ignoreCase) input = input.toLowerCase();
- this._lastInput = input;
- if (input.length < this.props.minimumInput) {
- return this.resetState();
- }
- var cacheResult = getFromCache(this.state.cache, input);
- if (cacheResult) {
- return this.setState({
- options: cacheResult.options
- });
- }
- this.setState({
- isLoading: true
- });
- var responseHandler = this.getResponseHandler(input);
- return thenPromise(this.props.loadOptions(input, responseHandler), responseHandler);
- },
- render: function render() {
- var noResultsText = this.props.noResultsText;
- var _state = this.state;
- var isLoading = _state.isLoading;
- var options = _state.options;
-
- if (this.props.isLoading) isLoading = true;
- var placeholder = isLoading ? this.props.loadingPlaceholder : this.props.placeholder;
- if (!options.length) {
- if (this._lastInput.length < this.props.minimumInput) noResultsText = this.props.searchPromptText;
- if (isLoading) noResultsText = this.props.searchingText;
- }
- return _react2['default'].createElement(_Select2['default'], _extends({}, this.props, {
- isLoading: isLoading,
- noResultsText: noResultsText,
- onInputChange: this.loadOptions,
- options: options,
- placeholder: placeholder
- }));
- }
-});
-
-module.exports = Async;
-
-},{"./Select":"react-select","./utils/stripDiacritics":4,"react":undefined}],2:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _classnames = require('classnames');
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var Option = _react2['default'].createClass({
- displayName: 'Option',
-
- propTypes: {
- className: _react2['default'].PropTypes.string, // className (based on mouse position)
- isDisabled: _react2['default'].PropTypes.bool, // the option is disabled
- isFocused: _react2['default'].PropTypes.bool, // the option is focused
- isSelected: _react2['default'].PropTypes.bool, // the option is selected
- onSelect: _react2['default'].PropTypes.func, // method to handle click on option element
- onFocus: _react2['default'].PropTypes.func, // method to handle mouseEnter on option element
- onUnfocus: _react2['default'].PropTypes.func, // method to handle mouseLeave on option element
- option: _react2['default'].PropTypes.object.isRequired },
- // object that is base for that option
- blockEvent: function blockEvent(event) {
- event.preventDefault();
- event.stopPropagation();
- if (event.target.tagName !== 'A' || !('href' in event.target)) {
- return;
- }
- if (event.target.target) {
- window.open(event.target.href, event.target.target);
- } else {
- window.location.href = event.target.href;
- }
- },
- handleMouseDown: function handleMouseDown(event) {
- event.preventDefault();
- event.stopPropagation();
- this.props.onSelect(this.props.option, event);
- },
- handleMouseEnter: function handleMouseEnter(event) {
- this.props.onFocus(this.props.option, event);
- },
- handleMouseMove: function handleMouseMove(event) {
- if (this.props.focused) return;
- this.props.onFocus(this.props.option, event);
- },
- render: function render() {
- var option = this.props.option;
-
- var className = (0, _classnames2['default'])(this.props.className, option.className);
-
- return option.disabled ? _react2['default'].createElement(
- 'div',
- { className: className,
- onMouseDown: this.blockEvent,
- onClick: this.blockEvent },
- this.props.children
- ) : _react2['default'].createElement(
- 'div',
- { className: className,
- style: option.style,
- onMouseDown: this.handleMouseDown,
- onMouseEnter: this.handleMouseEnter,
- onMouseMove: this.handleMouseMove,
- title: option.title },
- this.props.children
- );
- }
-});
-
-module.exports = Option;
-
-},{"classnames":undefined,"react":undefined}],3:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _classnames = require('classnames');
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var Value = _react2['default'].createClass({
-
- displayName: 'Value',
-
- propTypes: {
- disabled: _react2['default'].PropTypes.bool, // disabled prop passed to ReactSelect
- onClick: _react2['default'].PropTypes.func, // method to handle click on value label
- onRemove: _react2['default'].PropTypes.func, // method to handle removal of the value
- value: _react2['default'].PropTypes.object.isRequired },
-
- // the option object for this value
- handleMouseDown: function handleMouseDown(event) {
- if (event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- if (this.props.onClick) {
- event.stopPropagation();
- this.props.onClick(this.props.value, event);
- return;
- }
- if (this.props.value.href) {
- event.stopPropagation();
- }
- },
-
- onRemove: function onRemove(event) {
- event.preventDefault();
- event.stopPropagation();
- this.props.onRemove(this.props.value);
- },
-
- renderRemoveIcon: function renderRemoveIcon() {
- if (this.props.disabled || !this.props.onRemove) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-value-icon',
- onMouseDown: this.onRemove,
- onTouchEnd: this.onRemove },
- '×'
- );
- },
-
- renderLabel: function renderLabel() {
- var className = 'Select-value-label';
- return this.props.onClick || this.props.value.href ? _react2['default'].createElement(
- 'a',
- { className: className, href: this.props.value.href, target: this.props.value.target, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
- this.props.children
- ) : _react2['default'].createElement(
- 'span',
- { className: className },
- this.props.children
- );
- },
-
- render: function render() {
- return _react2['default'].createElement(
- 'div',
- { className: (0, _classnames2['default'])('Select-value', this.props.value.className),
- style: this.props.value.style,
- title: this.props.value.title
- },
- this.renderRemoveIcon(),
- this.renderLabel()
- );
- }
-
-});
-
-module.exports = Value;
-
-},{"classnames":undefined,"react":undefined}],4:[function(require,module,exports){
-'use strict';
-
-var map = [{ 'base': 'A', 'letters': /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g }, { 'base': 'AA', 'letters': /[\uA732]/g }, { 'base': 'AE', 'letters': /[\u00C6\u01FC\u01E2]/g }, { 'base': 'AO', 'letters': /[\uA734]/g }, { 'base': 'AU', 'letters': /[\uA736]/g }, { 'base': 'AV', 'letters': /[\uA738\uA73A]/g }, { 'base': 'AY', 'letters': /[\uA73C]/g }, { 'base': 'B', 'letters': /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g }, { 'base': 'C', 'letters': /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g }, { 'base': 'D', 'letters': /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g }, { 'base': 'DZ', 'letters': /[\u01F1\u01C4]/g }, { 'base': 'Dz', 'letters': /[\u01F2\u01C5]/g }, { 'base': 'E', 'letters': /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g }, { 'base': 'F', 'letters': /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g }, { 'base': 'G', 'letters': /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g }, { 'base': 'H', 'letters': /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g }, { 'base': 'I', 'letters': /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g }, { 'base': 'J', 'letters': /[\u004A\u24BF\uFF2A\u0134\u0248]/g }, { 'base': 'K', 'letters': /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g }, { 'base': 'L', 'letters': /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g }, { 'base': 'LJ', 'letters': /[\u01C7]/g }, { 'base': 'Lj', 'letters': /[\u01C8]/g }, { 'base': 'M', 'letters': /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g }, { 'base': 'N', 'letters': /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g }, { 'base': 'NJ', 'letters': /[\u01CA]/g }, { 'base': 'Nj', 'letters': /[\u01CB]/g }, { 'base': 'O', 'letters': /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g }, { 'base': 'OI', 'letters': /[\u01A2]/g }, { 'base': 'OO', 'letters': /[\uA74E]/g }, { 'base': 'OU', 'letters': /[\u0222]/g }, { 'base': 'P', 'letters': /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g }, { 'base': 'Q', 'letters': /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g }, { 'base': 'R', 'letters': /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g }, { 'base': 'S', 'letters': /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g }, { 'base': 'T', 'letters': /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g }, { 'base': 'TZ', 'letters': /[\uA728]/g }, { 'base': 'U', 'letters': /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g }, { 'base': 'V', 'letters': /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g }, { 'base': 'VY', 'letters': /[\uA760]/g }, { 'base': 'W', 'letters': /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g }, { 'base': 'X', 'letters': /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g }, { 'base': 'Y', 'letters': /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g }, { 'base': 'Z', 'letters': /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g }, { 'base': 'a', 'letters': /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g }, { 'base': 'aa', 'letters': /[\uA733]/g }, { 'base': 'ae', 'letters': /[\u00E6\u01FD\u01E3]/g }, { 'base': 'ao', 'letters': /[\uA735]/g }, { 'base': 'au', 'letters': /[\uA737]/g }, { 'base': 'av', 'letters': /[\uA739\uA73B]/g }, { 'base': 'ay', 'letters': /[\uA73D]/g }, { 'base': 'b', 'letters': /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g }, { 'base': 'c', 'letters': /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g }, { 'base': 'd', 'letters': /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g }, { 'base': 'dz', 'letters': /[\u01F3\u01C6]/g }, { 'base': 'e', 'letters': /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g }, { 'base': 'f', 'letters': /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g }, { 'base': 'g', 'letters': /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g }, { 'base': 'h', 'letters': /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g }, { 'base': 'hv', 'letters': /[\u0195]/g }, { 'base': 'i', 'letters': /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g }, { 'base': 'j', 'letters': /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g }, { 'base': 'k', 'letters': /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g }, { 'base': 'l', 'letters': /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g }, { 'base': 'lj', 'letters': /[\u01C9]/g }, { 'base': 'm', 'letters': /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g }, { 'base': 'n', 'letters': /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g }, { 'base': 'nj', 'letters': /[\u01CC]/g }, { 'base': 'o', 'letters': /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g }, { 'base': 'oi', 'letters': /[\u01A3]/g }, { 'base': 'ou', 'letters': /[\u0223]/g }, { 'base': 'oo', 'letters': /[\uA74F]/g }, { 'base': 'p', 'letters': /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g }, { 'base': 'q', 'letters': /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g }, { 'base': 'r', 'letters': /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g }, { 'base': 's', 'letters': /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g }, { 'base': 't', 'letters': /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g }, { 'base': 'tz', 'letters': /[\uA729]/g }, { 'base': 'u', 'letters': /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g }, { 'base': 'v', 'letters': /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g }, { 'base': 'vy', 'letters': /[\uA761]/g }, { 'base': 'w', 'letters': /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g }, { 'base': 'x', 'letters': /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g }, { 'base': 'y', 'letters': /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g }, { 'base': 'z', 'letters': /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g }];
-
-module.exports = function stripDiacritics(str) {
- for (var i = 0; i < map.length; i++) {
- str = str.replace(map[i].letters, map[i].base);
- }
- return str;
-};
-
-},{}],"react-select":[function(require,module,exports){
-'use strict';
-
-Object.defineProperty(exports, '__esModule', {
- value: true
-});
-
-var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactDom = require('react-dom');
-
-var _reactDom2 = _interopRequireDefault(_reactDom);
-
-var _reactInputAutosize = require('react-input-autosize');
-
-var _reactInputAutosize2 = _interopRequireDefault(_reactInputAutosize);
-
-var _classnames = require('classnames');
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var _utilsStripDiacritics = require('./utils/stripDiacritics');
-
-var _utilsStripDiacritics2 = _interopRequireDefault(_utilsStripDiacritics);
-
-var _Async = require('./Async');
-
-var _Async2 = _interopRequireDefault(_Async);
-
-var _Option = require('./Option');
-
-var _Option2 = _interopRequireDefault(_Option);
-
-var _Value = require('./Value');
-
-var _Value2 = _interopRequireDefault(_Value);
-
-function stringifyValue(value) {
- if (typeof value === 'object') {
- return JSON.stringify(value);
- } else {
- return value;
- }
-}
-
-var Select = _react2['default'].createClass({
-
- statics: { Async: _Async2['default'] },
-
- displayName: 'Select',
-
- propTypes: {
- addLabelText: _react2['default'].PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input
- allowCreate: _react2['default'].PropTypes.bool, // whether to allow creation of new entries
- autofocus: _react2['default'].PropTypes.bool, // autofocus the component on mount
- backspaceRemoves: _react2['default'].PropTypes.bool, // whether backspace removes an item if there is no text input
- className: _react2['default'].PropTypes.string, // className for the outer element
- clearAllText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // title for the "clear" control when multi: true
- clearValueText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // title for the "clear" control
- clearable: _react2['default'].PropTypes.bool, // should it be possible to reset value
- delimiter: _react2['default'].PropTypes.string, // delimiter to use to join multiple values for the hidden field value
- disabled: _react2['default'].PropTypes.bool, // whether the Select is disabled or not
- escapeClearsValue: _react2['default'].PropTypes.bool, // whether escape clears the value when the menu is closed
- filterOption: _react2['default'].PropTypes.func, // method to filter a single option (option, filterString)
- filterOptions: _react2['default'].PropTypes.any, // boolean to enable default filtering or function to filter the options array ([options], filterString, [values])
- ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering
- ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering
- inputProps: _react2['default'].PropTypes.object, // custom attributes for the Input
- isLoading: _react2['default'].PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
- labelKey: _react2['default'].PropTypes.string, // path of the label value in option objects
- matchPos: _react2['default'].PropTypes.string, // (any|start) match the start or entire string when filtering
- matchProp: _react2['default'].PropTypes.string, // (any|label|value) which option property to filter on
- scrollMenuIntoView: _react2['default'].PropTypes.bool, // boolean to enable the viewport to shift so that the full menu fully visible when engaged
- menuBuffer: _react2['default'].PropTypes.number, // optional buffer (in px) between the bottom of the viewport and the bottom of the menu
- menuStyle: _react2['default'].PropTypes.object, // optional style to apply to the menu
- menuContainerStyle: _react2['default'].PropTypes.object, // optional style to apply to the menu container
- multi: _react2['default'].PropTypes.bool, // multi-value input
- name: _react2['default'].PropTypes.string, // generates a hidden tag with this field name for html forms
- newOptionCreator: _react2['default'].PropTypes.func, // factory to create new options when allowCreate set
- noResultsText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // placeholder displayed when there are no matching search results
- onBlur: _react2['default'].PropTypes.func, // onBlur handler: function (event) {}
- onChange: _react2['default'].PropTypes.func, // onChange handler: function (newValue) {}
- onFocus: _react2['default'].PropTypes.func, // onFocus handler: function (event) {}
- onInputChange: _react2['default'].PropTypes.func, // onInputChange handler: function (inputValue) {}
- onValueClick: _react2['default'].PropTypes.func, // onClick handler for value labels: function (value, event) {}
- onMenuScrollToBottom: _react2['default'].PropTypes.func, // fires when the menu is scrolled to the bottom; can be used to paginate options
- optionComponent: _react2['default'].PropTypes.func, // option component to render in dropdown
- optionRenderer: _react2['default'].PropTypes.func, // optionRenderer: function (option) {}
- options: _react2['default'].PropTypes.array, // array of options
- placeholder: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // field placeholder, displayed when there's no value
- searchable: _react2['default'].PropTypes.bool, // whether to enable searching feature or not
- simpleValue: _react2['default'].PropTypes.bool, // pass the value to onChange as a simple value (legacy pre 1.0 mode), defaults to false
- style: _react2['default'].PropTypes.object, // optional style to apply to the control
- tabIndex: _react2['default'].PropTypes.string, // optional tab index of the control
- value: _react2['default'].PropTypes.any, // initial field value
- valueComponent: _react2['default'].PropTypes.func, // value component to render
- valueKey: _react2['default'].PropTypes.string, // path of the label value in option objects
- valueRenderer: _react2['default'].PropTypes.func, // valueRenderer: function (option) {}
- wrapperStyle: _react2['default'].PropTypes.object },
-
- // optional style to apply to the component wrapper
- getDefaultProps: function getDefaultProps() {
- return {
- addLabelText: 'Add "{label}"?',
- allowCreate: false,
- backspaceRemoves: true,
- clearAllText: 'Clear all',
- clearValueText: 'Clear value',
- clearable: true,
- delimiter: ',',
- disabled: false,
- escapeClearsValue: true,
- filterOptions: true,
- ignoreAccents: true,
- ignoreCase: true,
- inputProps: {},
- isLoading: false,
- labelKey: 'label',
- matchPos: 'any',
- matchProp: 'any',
- scrollMenuIntoView: true,
- menuBuffer: 0,
- multi: false,
- noResultsText: 'No results found',
- optionComponent: _Option2['default'],
- placeholder: 'Select...',
- searchable: true,
- simpleValue: false,
- valueComponent: _Value2['default'],
- valueKey: 'value'
- };
- },
-
- getInitialState: function getInitialState() {
- return {
- inputValue: '',
- isFocused: false,
- isLoading: false,
- isOpen: false,
- isPseudoFocused: false
- };
- },
-
- componentDidMount: function componentDidMount() {
- if (this.props.autofocus) {
- this.focus();
- }
- },
-
- componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
- if (prevState.inputValue !== this.state.inputValue && this.props.onInputChange) {
- this.props.onInputChange(this.state.inputValue);
- }
- if (this._scrollToFocusedOptionOnUpdate && this.refs.focused && this.refs.menu) {
- this._scrollToFocusedOptionOnUpdate = false;
- var focusedDOM = _reactDom2['default'].findDOMNode(this.refs.focused);
- var menuDOM = _reactDom2['default'].findDOMNode(this.refs.menu);
- var focusedRect = focusedDOM.getBoundingClientRect();
- var menuRect = menuDOM.getBoundingClientRect();
- if (focusedRect.bottom > menuRect.bottom || focusedRect.top < menuRect.top) {
- menuDOM.scrollTop = focusedDOM.offsetTop + focusedDOM.clientHeight - menuDOM.offsetHeight;
- }
- }
- if (this.props.scrollMenuIntoView && this.refs.menuContainer) {
- var menuContainerRect = this.refs.menuContainer.getBoundingClientRect();
- if (window.innerHeight < menuContainerRect.bottom + this.props.menuBuffer) {
- window.scrollTo(0, window.scrollY + menuContainerRect.bottom + this.props.menuBuffer - window.innerHeight);
- }
- }
- },
-
- focus: function focus() {
- if (!this.refs.input) return;
- this.refs.input.focus();
- },
-
- handleMouseDown: function handleMouseDown(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, or if the component is disabled, ignore it.
- if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
- return;
- }
-
- // prevent default event handlers
- event.stopPropagation();
- event.preventDefault();
-
- // for the non-searchable select, toggle the menu
- if (!this.props.searchable) {
- this.focus();
- return this.setState({
- isOpen: !this.state.isOpen
- });
- }
-
- if (this.state.isFocused) {
- // if the input is focused, ensure the menu is open
- this.setState({
- isOpen: true,
- isPseudoFocused: false
- });
- } else {
- // otherwise, focus the input and open the menu
- this._openAfterFocus = true;
- this.focus();
- }
- },
-
- handleMouseDownOnArrow: function handleMouseDownOnArrow(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, or if the component is disabled, ignore it.
- if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- // If the menu isn't open, let the event bubble to the main handleMouseDown
- if (!this.state.isOpen) {
- return;
- }
- // prevent default event handlers
- event.stopPropagation();
- event.preventDefault();
- // close the menu
- this.closeMenu();
- },
-
- closeMenu: function closeMenu() {
- this.setState({
- isOpen: false,
- isPseudoFocused: this.state.isFocused && !this.props.multi,
- inputValue: ''
- });
- },
-
- handleInputFocus: function handleInputFocus(event) {
- var isOpen = this.state.isOpen || this._openAfterFocus;
- if (this.props.onFocus) {
- this.props.onFocus(event);
- }
- this.setState({
- isFocused: true,
- isOpen: isOpen
- });
- this._openAfterFocus = false;
- },
-
- handleInputBlur: function handleInputBlur(event) {
- if (this.refs.menu && document.activeElement.isEqualNode(this.refs.menu)) {
- return;
- }
-
- if (this.props.onBlur) {
- this.props.onBlur(event);
- }
- this.setState({
- inputValue: '',
- isFocused: false,
- isOpen: false,
- isPseudoFocused: false
- });
- },
-
- handleInputChange: function handleInputChange(event) {
- this.setState({
- isOpen: true,
- isPseudoFocused: false,
- inputValue: event.target.value
- });
- },
-
- handleKeyDown: function handleKeyDown(event) {
- if (this.props.disabled) return;
- switch (event.keyCode) {
- case 8:
- // backspace
- if (!this.state.inputValue && this.props.backspaceRemoves) {
- event.preventDefault();
- this.popValue();
- }
- return;
- case 9:
- // tab
- if (event.shiftKey || !this.state.isOpen) {
- return;
- }
- this.selectFocusedOption();
- break;
- case 13:
- // enter
- if (!this.state.isOpen) return;
- this.selectFocusedOption();
- break;
- case 27:
- // escape
- if (this.state.isOpen) {
- this.closeMenu();
- } else if (this.props.clearable && this.props.escapeClearsValue) {
- this.clearValue(event);
- }
- break;
- case 38:
- // up
- this.focusPreviousOption();
- break;
- case 40:
- // down
- this.focusNextOption();
- break;
- // case 188: // ,
- // if (this.props.allowCreate && this.props.multi) {
- // event.preventDefault();
- // event.stopPropagation();
- // this.selectFocusedOption();
- // } else {
- // return;
- // }
- // break;
- default:
- return;
- }
- event.preventDefault();
- },
-
- handleValueClick: function handleValueClick(option, event) {
- if (!this.props.onValueClick) return;
- this.props.onValueClick(option, event);
- },
-
- handleMenuScroll: function handleMenuScroll(event) {
- if (!this.props.onMenuScrollToBottom) return;
- var target = event.target;
-
- if (target.scrollHeight > target.offsetHeight && !(target.scrollHeight - target.offsetHeight - target.scrollTop)) {
- this.props.onMenuScrollToBottom();
- }
- },
-
- getOptionLabel: function getOptionLabel(op) {
- return op[this.props.labelKey];
- },
-
- getValueArray: function getValueArray() {
- var value = this.props.value;
- if (this.props.multi) {
- if (typeof value === 'string') value = value.split(this.props.delimiter);
- if (!Array.isArray(value)) {
- if (value === null || value === undefined) return [];
- value = [value];
- }
- return value.map(this.expandValue).filter(function (i) {
- return i;
- });
- }
- var expandedValue = this.expandValue(value);
- return expandedValue ? [expandedValue] : [];
- },
-
- expandValue: function expandValue(value) {
- if (typeof value !== 'string' && typeof value !== 'number') return value;
- var _props = this.props;
- var options = _props.options;
- var valueKey = _props.valueKey;
-
- if (!options) return;
- for (var i = 0; i < options.length; i++) {
- if (options[i][valueKey] === value) return options[i];
- }
- },
-
- setValue: function setValue(value) {
- var _this = this;
-
- if (!this.props.onChange) return;
- if (this.props.simpleValue && value) {
- value = this.props.multi ? value.map(function (i) {
- return i[_this.props.valueKey];
- }).join(this.props.delimiter) : value[this.props.valueKey];
- }
- this.props.onChange(value);
- },
-
- selectValue: function selectValue(value) {
- if (this.props.multi) {
- this.addValue(value);
- this.setState({
- inputValue: ''
- });
- } else {
- this.setValue(value);
- this.setState({
- isOpen: false,
- inputValue: '',
- isPseudoFocused: this.state.isFocused
- });
- }
- },
-
- addValue: function addValue(value) {
- var valueArray = this.getValueArray();
- this.setValue(valueArray.concat(value));
- },
-
- popValue: function popValue() {
- var valueArray = this.getValueArray();
- if (!valueArray.length) return;
- if (valueArray[valueArray.length - 1].clearableValue === false) return;
- this.setValue(valueArray.slice(0, valueArray.length - 1));
- },
-
- removeValue: function removeValue(value) {
- var valueArray = this.getValueArray();
- this.setValue(valueArray.filter(function (i) {
- return i !== value;
- }));
- this.focus();
- },
-
- clearValue: function clearValue(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, ignore it.
- if (event && event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- event.stopPropagation();
- event.preventDefault();
- this.setValue(null);
- this.setState({
- isOpen: false,
- inputValue: ''
- }, this.focus);
- },
-
- focusOption: function focusOption(option) {
- this.setState({
- focusedOption: option
- });
- },
-
- focusNextOption: function focusNextOption() {
- this.focusAdjacentOption('next');
- },
-
- focusPreviousOption: function focusPreviousOption() {
- this.focusAdjacentOption('previous');
- },
-
- focusAdjacentOption: function focusAdjacentOption(dir) {
- var options = this._visibleOptions.filter(function (i) {
- return !i.disabled;
- });
- this._scrollToFocusedOptionOnUpdate = true;
- if (!this.state.isOpen) {
- this.setState({
- isOpen: true,
- inputValue: '',
- focusedOption: this._focusedOption || options[dir === 'next' ? 0 : options.length - 1]
- });
- return;
- }
- if (!options.length) return;
- var focusedIndex = -1;
- for (var i = 0; i < options.length; i++) {
- if (this._focusedOption === options[i]) {
- focusedIndex = i;
- break;
- }
- }
- var focusedOption = options[0];
- if (dir === 'next' && focusedIndex > -1 && focusedIndex < options.length - 1) {
- focusedOption = options[focusedIndex + 1];
- } else if (dir === 'previous') {
- if (focusedIndex > 0) {
- focusedOption = options[focusedIndex - 1];
- } else {
- focusedOption = options[options.length - 1];
- }
- }
- this.setState({
- focusedOption: focusedOption
- });
- },
-
- selectFocusedOption: function selectFocusedOption() {
- // if (this.props.allowCreate && !this.state.focusedOption) {
- // return this.selectValue(this.state.inputValue);
- // }
- if (this._focusedOption) {
- return this.selectValue(this._focusedOption);
- }
- },
-
- renderLoading: function renderLoading() {
- if (!this.props.isLoading) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-loading-zone', 'aria-hidden': 'true' },
- _react2['default'].createElement('span', { className: 'Select-loading' })
- );
- },
-
- renderValue: function renderValue(valueArray, isOpen) {
- var _this2 = this;
-
- var renderLabel = this.props.valueRenderer || this.getOptionLabel;
- var ValueComponent = this.props.valueComponent;
- if (!valueArray.length) {
- return !this.state.inputValue ? _react2['default'].createElement(
- 'div',
- { className: 'Select-placeholder' },
- this.props.placeholder
- ) : null;
- }
- var onClick = this.props.onValueClick ? this.handleValueClick : null;
- if (this.props.multi) {
- return valueArray.map(function (value, i) {
- return _react2['default'].createElement(
- ValueComponent,
- {
- disabled: _this2.props.disabled || value.clearableValue === false,
- key: 'value-' + i + '-' + value[_this2.props.valueKey],
- onClick: onClick,
- onRemove: _this2.removeValue,
- value: value
- },
- renderLabel(value)
- );
- });
- } else if (!this.state.inputValue) {
- if (isOpen) onClick = null;
- return _react2['default'].createElement(
- ValueComponent,
- {
- disabled: this.props.disabled,
- onClick: onClick,
- value: valueArray[0]
- },
- renderLabel(valueArray[0])
- );
- }
- },
-
- renderInput: function renderInput(valueArray) {
- var className = (0, _classnames2['default'])('Select-input', this.props.inputProps.className);
- if (this.props.disabled || !this.props.searchable) {
- return _react2['default'].createElement('div', _extends({}, this.props.inputProps, {
- className: className,
- tabIndex: this.props.tabIndex || 0,
- onBlur: this.handleInputBlur,
- onFocus: this.handleInputFocus,
- ref: 'input',
- style: { border: 0, width: 1, display: 'inline-block' } }));
- }
- return _react2['default'].createElement(_reactInputAutosize2['default'], _extends({}, this.props.inputProps, {
- className: className,
- tabIndex: this.props.tabIndex,
- onBlur: this.handleInputBlur,
- onChange: this.handleInputChange,
- onFocus: this.handleInputFocus,
- minWidth: '5',
- ref: 'input',
- value: this.state.inputValue
- }));
- },
-
- renderClear: function renderClear() {
- if (!this.props.clearable || !this.props.value || this.props.multi && !this.props.value.length || this.props.disabled || this.props.isLoading) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-clear-zone', title: this.props.multi ? this.props.clearAllText : this.props.clearValueText, 'aria-label': this.props.multi ? this.props.clearAllText : this.props.clearValueText, onMouseDown: this.clearValue, onTouchEnd: this.clearValue },
- _react2['default'].createElement('span', { className: 'Select-clear', dangerouslySetInnerHTML: { __html: '×' } })
- );
- },
-
- renderArrow: function renderArrow() {
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-arrow-zone', onMouseDown: this.handleMouseDownOnArrow },
- _react2['default'].createElement('span', { className: 'Select-arrow', onMouseDown: this.handleMouseDownOnArrow })
- );
- },
-
- filterOptions: function filterOptions(excludeOptions) {
- var _this3 = this;
-
- var filterValue = this.state.inputValue;
- var options = this.props.options || [];
- if (typeof this.props.filterOptions === 'function') {
- return this.props.filterOptions.call(this, options, filterValue, excludeOptions);
- } else if (this.props.filterOptions) {
- if (this.props.ignoreAccents) {
- filterValue = (0, _utilsStripDiacritics2['default'])(filterValue);
- }
- if (this.props.ignoreCase) {
- filterValue = filterValue.toLowerCase();
- }
- if (excludeOptions) excludeOptions = excludeOptions.map(function (i) {
- return i[_this3.props.valueKey];
- });
- return options.filter(function (option) {
- if (excludeOptions && excludeOptions.indexOf(option[_this3.props.valueKey]) > -1) return false;
- if (_this3.props.filterOption) return _this3.props.filterOption.call(_this3, option, filterValue);
- if (!filterValue) return true;
- var valueTest = String(option[_this3.props.valueKey]);
- var labelTest = String(option[_this3.props.labelKey]);
- if (_this3.props.ignoreAccents) {
- if (_this3.props.matchProp !== 'label') valueTest = (0, _utilsStripDiacritics2['default'])(valueTest);
- if (_this3.props.matchProp !== 'value') labelTest = (0, _utilsStripDiacritics2['default'])(labelTest);
- }
- if (_this3.props.ignoreCase) {
- if (_this3.props.matchProp !== 'label') valueTest = valueTest.toLowerCase();
- if (_this3.props.matchProp !== 'value') labelTest = labelTest.toLowerCase();
- }
- return _this3.props.matchPos === 'start' ? _this3.props.matchProp !== 'label' && valueTest.substr(0, filterValue.length) === filterValue || _this3.props.matchProp !== 'value' && labelTest.substr(0, filterValue.length) === filterValue : _this3.props.matchProp !== 'label' && valueTest.indexOf(filterValue) >= 0 || _this3.props.matchProp !== 'value' && labelTest.indexOf(filterValue) >= 0;
- });
- } else {
- return options;
- }
- },
-
- renderMenu: function renderMenu(options, valueArray, focusedOption) {
- var _this4 = this;
-
- if (options && options.length) {
- var _ret = (function () {
- var Option = _this4.props.optionComponent;
- var renderLabel = _this4.props.optionRenderer || _this4.getOptionLabel;
- return {
- v: options.map(function (option, i) {
- var isSelected = valueArray && valueArray.indexOf(option) > -1;
- var isFocused = option === focusedOption;
- var optionRef = isFocused ? 'focused' : null;
- var optionClass = (0, _classnames2['default'])({
- 'Select-option': true,
- 'is-selected': isSelected,
- 'is-focused': isFocused,
- 'is-disabled': option.disabled
- });
- return _react2['default'].createElement(
- Option,
- {
- className: optionClass,
- isDisabled: option.disabled,
- isFocused: isFocused,
- key: 'option-' + i + '-' + option[_this4.props.valueKey],
- onSelect: _this4.selectValue,
- onFocus: _this4.focusOption,
- option: option,
- isSelected: isSelected,
- ref: optionRef
- },
- renderLabel(option)
- );
- })
- };
- })();
-
- if (typeof _ret === 'object') return _ret.v;
- } else {
- return _react2['default'].createElement(
- 'div',
- { className: 'Select-noresults' },
- this.props.noResultsText
- );
- }
- },
-
- renderHiddenField: function renderHiddenField(valueArray) {
- var _this5 = this;
-
- if (!this.props.name) return;
- var value = valueArray.map(function (i) {
- return stringifyValue(i[_this5.props.valueKey]);
- }).join(this.props.delimiter);
- return _react2['default'].createElement('input', { type: 'hidden', ref: 'value', name: this.props.name, value: value, disabled: this.props.disabled });
- },
-
- getFocusableOption: function getFocusableOption(selectedOption) {
- var options = this._visibleOptions;
- if (!options.length) return;
- var focusedOption = this.state.focusedOption || selectedOption;
- if (focusedOption && options.indexOf(focusedOption) > -1) return focusedOption;
- for (var i = 0; i < options.length; i++) {
- if (!options[i].disabled) return options[i];
- }
- },
-
- render: function render() {
- var valueArray = this.getValueArray();
- var options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
- var isOpen = this.state.isOpen;
- if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
- var focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
- var className = (0, _classnames2['default'])('Select', this.props.className, {
- 'Select--multi': this.props.multi,
- 'is-disabled': this.props.disabled,
- 'is-focused': this.state.isFocused,
- 'is-loading': this.props.isLoading,
- 'is-open': isOpen,
- 'is-pseudo-focused': this.state.isPseudoFocused,
- 'is-searchable': this.props.searchable,
- 'has-value': valueArray.length
- });
- return _react2['default'].createElement(
- 'div',
- { ref: 'wrapper', className: className, style: this.props.wrapperStyle },
- this.renderHiddenField(valueArray),
- _react2['default'].createElement(
- 'div',
- { ref: 'control', className: 'Select-control', style: this.props.style, onKeyDown: this.handleKeyDown, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
- this.renderValue(valueArray, isOpen),
- this.renderInput(valueArray),
- this.renderLoading(),
- this.renderClear(),
- this.renderArrow()
- ),
- isOpen ? _react2['default'].createElement(
- 'div',
- { ref: 'menuContainer', className: 'Select-menu-outer', style: this.props.menuContainerStyle },
- _react2['default'].createElement(
- 'div',
- { ref: 'menu', className: 'Select-menu', style: this.props.menuStyle, onScroll: this.handleMenuScroll, onMouseDown: this.handleMouseDownOnMenu },
- this.renderMenu(options, !this.props.multi ? valueArray : null, focusedOption)
- )
- ) : null
- );
- }
-
-});
-
-exports['default'] = Select;
-module.exports = exports['default'];
-
-},{"./Async":1,"./Option":2,"./Value":3,"./utils/stripDiacritics":4,"classnames":undefined,"react":undefined,"react-dom":undefined,"react-input-autosize":undefined}]},{},[]);
diff --git a/examples/dist/common.js b/examples/dist/common.js
deleted file mode 100644
index c93ecd2d55..0000000000
--- a/examples/dist/common.js
+++ /dev/null
@@ -1,18970 +0,0 @@
-require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 8 && documentMode <= 11);
-
-/**
- * Opera <= 12 includes TextEvent in window, but does not fire
- * text input events. Rely on keypress instead.
- */
-function isPresto() {
- var opera = window.opera;
- return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
-}
-
-var SPACEBAR_CODE = 32;
-var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
-
-var topLevelTypes = EventConstants.topLevelTypes;
-
-// Events and their corresponding property names.
-var eventTypes = {
- beforeInput: {
- phasedRegistrationNames: {
- bubbled: keyOf({ onBeforeInput: null }),
- captured: keyOf({ onBeforeInputCapture: null })
- },
- dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
- },
- compositionEnd: {
- phasedRegistrationNames: {
- bubbled: keyOf({ onCompositionEnd: null }),
- captured: keyOf({ onCompositionEndCapture: null })
- },
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
- },
- compositionStart: {
- phasedRegistrationNames: {
- bubbled: keyOf({ onCompositionStart: null }),
- captured: keyOf({ onCompositionStartCapture: null })
- },
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
- },
- compositionUpdate: {
- phasedRegistrationNames: {
- bubbled: keyOf({ onCompositionUpdate: null }),
- captured: keyOf({ onCompositionUpdateCapture: null })
- },
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
- }
-};
-
-// Track whether we've ever handled a keypress on the space key.
-var hasSpaceKeypress = false;
-
-/**
- * Return whether a native keypress event is assumed to be a command.
- * This is required because Firefox fires `keypress` events for key commands
- * (cut, copy, select-all, etc.) even though no character is inserted.
- */
-function isKeypressCommand(nativeEvent) {
- return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
- // ctrlKey && altKey is equivalent to AltGr, and is not a command.
- !(nativeEvent.ctrlKey && nativeEvent.altKey);
-}
-
-/**
- * Translate native top level events into event types.
- *
- * @param {string} topLevelType
- * @return {object}
- */
-function getCompositionEventType(topLevelType) {
- switch (topLevelType) {
- case topLevelTypes.topCompositionStart:
- return eventTypes.compositionStart;
- case topLevelTypes.topCompositionEnd:
- return eventTypes.compositionEnd;
- case topLevelTypes.topCompositionUpdate:
- return eventTypes.compositionUpdate;
- }
-}
-
-/**
- * Does our fallback best-guess model think this event signifies that
- * composition has begun?
- *
- * @param {string} topLevelType
- * @param {object} nativeEvent
- * @return {boolean}
- */
-function isFallbackCompositionStart(topLevelType, nativeEvent) {
- return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
-}
-
-/**
- * Does our fallback mode think that this event is the end of composition?
- *
- * @param {string} topLevelType
- * @param {object} nativeEvent
- * @return {boolean}
- */
-function isFallbackCompositionEnd(topLevelType, nativeEvent) {
- switch (topLevelType) {
- case topLevelTypes.topKeyUp:
- // Command keys insert or clear IME input.
- return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
- case topLevelTypes.topKeyDown:
- // Expect IME keyCode on each keydown. If we get any other
- // code we must have exited earlier.
- return nativeEvent.keyCode !== START_KEYCODE;
- case topLevelTypes.topKeyPress:
- case topLevelTypes.topMouseDown:
- case topLevelTypes.topBlur:
- // Events are not possible without cancelling IME.
- return true;
- default:
- return false;
- }
-}
-
-/**
- * Google Input Tools provides composition data via a CustomEvent,
- * with the `data` property populated in the `detail` object. If this
- * is available on the event object, use it. If not, this is a plain
- * composition event and we have nothing special to extract.
- *
- * @param {object} nativeEvent
- * @return {?string}
- */
-function getDataFromCustomEvent(nativeEvent) {
- var detail = nativeEvent.detail;
- if (typeof detail === 'object' && 'data' in detail) {
- return detail.data;
- }
- return null;
-}
-
-// Track the current IME composition fallback object, if any.
-var currentComposition = null;
-
-/**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {?object} A SyntheticCompositionEvent.
- */
-function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
- var eventType;
- var fallbackData;
-
- if (canUseCompositionEvent) {
- eventType = getCompositionEventType(topLevelType);
- } else if (!currentComposition) {
- if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
- eventType = eventTypes.compositionStart;
- }
- } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
- eventType = eventTypes.compositionEnd;
- }
-
- if (!eventType) {
- return null;
- }
-
- if (useFallbackCompositionData) {
- // The current composition is stored statically and must not be
- // overwritten while composition continues.
- if (!currentComposition && eventType === eventTypes.compositionStart) {
- currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
- } else if (eventType === eventTypes.compositionEnd) {
- if (currentComposition) {
- fallbackData = currentComposition.getData();
- }
- }
- }
-
- var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
-
- if (fallbackData) {
- // Inject data generated from fallback path into the synthetic event.
- // This matches the property of native CompositionEventInterface.
- event.data = fallbackData;
- } else {
- var customData = getDataFromCustomEvent(nativeEvent);
- if (customData !== null) {
- event.data = customData;
- }
- }
-
- EventPropagators.accumulateTwoPhaseDispatches(event);
- return event;
-}
-
-/**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {object} nativeEvent Native browser event.
- * @return {?string} The string corresponding to this `beforeInput` event.
- */
-function getNativeBeforeInputChars(topLevelType, nativeEvent) {
- switch (topLevelType) {
- case topLevelTypes.topCompositionEnd:
- return getDataFromCustomEvent(nativeEvent);
- case topLevelTypes.topKeyPress:
- /**
- * If native `textInput` events are available, our goal is to make
- * use of them. However, there is a special case: the spacebar key.
- * In Webkit, preventing default on a spacebar `textInput` event
- * cancels character insertion, but it *also* causes the browser
- * to fall back to its default spacebar behavior of scrolling the
- * page.
- *
- * Tracking at:
- * https://code.google.com/p/chromium/issues/detail?id=355103
- *
- * To avoid this issue, use the keypress event as if no `textInput`
- * event is available.
- */
- var which = nativeEvent.which;
- if (which !== SPACEBAR_CODE) {
- return null;
- }
-
- hasSpaceKeypress = true;
- return SPACEBAR_CHAR;
-
- case topLevelTypes.topTextInput:
- // Record the characters to be added to the DOM.
- var chars = nativeEvent.data;
-
- // If it's a spacebar character, assume that we have already handled
- // it at the keypress level and bail immediately. Android Chrome
- // doesn't give us keycodes, so we need to blacklist it.
- if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
- return null;
- }
-
- return chars;
-
- default:
- // For other native event types, do nothing.
- return null;
- }
-}
-
-/**
- * For browsers that do not provide the `textInput` event, extract the
- * appropriate string to use for SyntheticInputEvent.
- *
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {object} nativeEvent Native browser event.
- * @return {?string} The fallback string for this `beforeInput` event.
- */
-function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
- // If we are currently composing (IME) and using a fallback to do so,
- // try to extract the composed characters from the fallback object.
- if (currentComposition) {
- if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
- var chars = currentComposition.getData();
- FallbackCompositionState.release(currentComposition);
- currentComposition = null;
- return chars;
- }
- return null;
- }
-
- switch (topLevelType) {
- case topLevelTypes.topPaste:
- // If a paste event occurs after a keypress, throw out the input
- // chars. Paste events should not lead to BeforeInput events.
- return null;
- case topLevelTypes.topKeyPress:
- /**
- * As of v27, Firefox may fire keypress events even when no character
- * will be inserted. A few possibilities:
- *
- * - `which` is `0`. Arrow keys, Esc key, etc.
- *
- * - `which` is the pressed key code, but no char is available.
- * Ex: 'AltGr + d` in Polish. There is no modified character for
- * this key combination and no character is inserted into the
- * document, but FF fires the keypress for char code `100` anyway.
- * No `input` event will occur.
- *
- * - `which` is the pressed key code, but a command combination is
- * being used. Ex: `Cmd+C`. No character is inserted, and no
- * `input` event will occur.
- */
- if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
- return String.fromCharCode(nativeEvent.which);
- }
- return null;
- case topLevelTypes.topCompositionEnd:
- return useFallbackCompositionData ? null : nativeEvent.data;
- default:
- return null;
- }
-}
-
-/**
- * Extract a SyntheticInputEvent for `beforeInput`, based on either native
- * `textInput` or fallback behavior.
- *
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {?object} A SyntheticInputEvent.
- */
-function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
- var chars;
-
- if (canUseTextInputEvent) {
- chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
- } else {
- chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
- }
-
- // If no characters are being inserted, no BeforeInput event should
- // be fired.
- if (!chars) {
- return null;
- }
-
- var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
-
- event.data = chars;
- EventPropagators.accumulateTwoPhaseDispatches(event);
- return event;
-}
-
-/**
- * Create an `onBeforeInput` event to match
- * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
- *
- * This event plugin is based on the native `textInput` event
- * available in Chrome, Safari, Opera, and IE. This event fires after
- * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
- *
- * `beforeInput` is spec'd but not implemented in any browsers, and
- * the `input` event does not provide any useful information about what has
- * actually been added, contrary to the spec. Thus, `textInput` is the best
- * available event to identify the characters that have actually been inserted
- * into the target node.
- *
- * This plugin is also responsible for emitting `composition` events, thus
- * allowing us to share composition fallback code for both `beforeInput` and
- * `composition` event types.
- */
-var BeforeInputEventPlugin = {
-
- eventTypes: eventTypes,
-
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
- return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
- }
-};
-
-module.exports = BeforeInputEventPlugin;
-},{"./EventConstants":14,"./EventPropagators":18,"./FallbackCompositionState":19,"./SyntheticCompositionEvent":90,"./SyntheticInputEvent":94,"fbjs/lib/ExecutionEnvironment":130,"fbjs/lib/keyOf":148}],3:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CSSProperty
- */
-
-'use strict';
-
-/**
- * CSS properties which accept numbers but are not in units of "px".
- */
-var isUnitlessNumber = {
- animationIterationCount: true,
- boxFlex: true,
- boxFlexGroup: true,
- boxOrdinalGroup: true,
- columnCount: true,
- flex: true,
- flexGrow: true,
- flexPositive: true,
- flexShrink: true,
- flexNegative: true,
- flexOrder: true,
- fontWeight: true,
- lineClamp: true,
- lineHeight: true,
- opacity: true,
- order: true,
- orphans: true,
- tabSize: true,
- widows: true,
- zIndex: true,
- zoom: true,
-
- // SVG-related properties
- fillOpacity: true,
- stopOpacity: true,
- strokeDashoffset: true,
- strokeOpacity: true,
- strokeWidth: true
-};
-
-/**
- * @param {string} prefix vendor-specific prefix, eg: Webkit
- * @param {string} key style name, eg: transitionDuration
- * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
- * WebkitTransitionDuration
- */
-function prefixKey(prefix, key) {
- return prefix + key.charAt(0).toUpperCase() + key.substring(1);
-}
-
-/**
- * Support style names that may come passed in prefixed by adding permutations
- * of vendor prefixes.
- */
-var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
-
-// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
-// infinite loop, because it iterates over the newly added props too.
-Object.keys(isUnitlessNumber).forEach(function (prop) {
- prefixes.forEach(function (prefix) {
- isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
- });
-});
-
-/**
- * Most style properties can be unset by doing .style[prop] = '' but IE8
- * doesn't like doing that with shorthand properties so for the properties that
- * IE8 breaks on, which are listed here, we instead unset each of the
- * individual properties. See http://bugs.jquery.com/ticket/12385.
- * The 4-value 'clock' properties like margin, padding, border-width seem to
- * behave without any problems. Curiously, list-style works too without any
- * special prodding.
- */
-var shorthandPropertyExpansions = {
- background: {
- backgroundAttachment: true,
- backgroundColor: true,
- backgroundImage: true,
- backgroundPositionX: true,
- backgroundPositionY: true,
- backgroundRepeat: true
- },
- backgroundPosition: {
- backgroundPositionX: true,
- backgroundPositionY: true
- },
- border: {
- borderWidth: true,
- borderStyle: true,
- borderColor: true
- },
- borderBottom: {
- borderBottomWidth: true,
- borderBottomStyle: true,
- borderBottomColor: true
- },
- borderLeft: {
- borderLeftWidth: true,
- borderLeftStyle: true,
- borderLeftColor: true
- },
- borderRight: {
- borderRightWidth: true,
- borderRightStyle: true,
- borderRightColor: true
- },
- borderTop: {
- borderTopWidth: true,
- borderTopStyle: true,
- borderTopColor: true
- },
- font: {
- fontStyle: true,
- fontVariant: true,
- fontWeight: true,
- fontSize: true,
- lineHeight: true,
- fontFamily: true
- },
- outline: {
- outlineWidth: true,
- outlineStyle: true,
- outlineColor: true
- }
-};
-
-var CSSProperty = {
- isUnitlessNumber: isUnitlessNumber,
- shorthandPropertyExpansions: shorthandPropertyExpansions
-};
-
-module.exports = CSSProperty;
-},{}],4:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CSSPropertyOperations
- * @typechecks static-only
- */
-
-'use strict';
-
-var CSSProperty = require('./CSSProperty');
-var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
-var ReactPerf = require('./ReactPerf');
-
-var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
-var dangerousStyleValue = require('./dangerousStyleValue');
-var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
-var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
-var warning = require('fbjs/lib/warning');
-
-var processStyleName = memoizeStringOnly(function (styleName) {
- return hyphenateStyleName(styleName);
-});
-
-var hasShorthandPropertyBug = false;
-var styleFloatAccessor = 'cssFloat';
-if (ExecutionEnvironment.canUseDOM) {
- var tempStyle = document.createElement('div').style;
- try {
- // IE8 throws "Invalid argument." if resetting shorthand style properties.
- tempStyle.font = '';
- } catch (e) {
- hasShorthandPropertyBug = true;
- }
- // IE8 only supports accessing cssFloat (standard) as styleFloat
- if (document.documentElement.style.cssFloat === undefined) {
- styleFloatAccessor = 'styleFloat';
- }
-}
-
-if ("production" !== 'production') {
- // 'msTransform' is correct, but the other prefixes should be capitalized
- var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
-
- // style values shouldn't contain a semicolon
- var badStyleValueWithSemicolonPattern = /;\s*$/;
-
- var warnedStyleNames = {};
- var warnedStyleValues = {};
-
- var warnHyphenatedStyleName = function (name) {
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
- return;
- }
-
- warnedStyleNames[name] = true;
- "production" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
- };
-
- var warnBadVendoredStyleName = function (name) {
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
- return;
- }
-
- warnedStyleNames[name] = true;
- "production" !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
- };
-
- var warnStyleValueWithSemicolon = function (name, value) {
- if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
- return;
- }
-
- warnedStyleValues[value] = true;
- "production" !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
- };
-
- /**
- * @param {string} name
- * @param {*} value
- */
- var warnValidStyle = function (name, value) {
- if (name.indexOf('-') > -1) {
- warnHyphenatedStyleName(name);
- } else if (badVendoredStyleNamePattern.test(name)) {
- warnBadVendoredStyleName(name);
- } else if (badStyleValueWithSemicolonPattern.test(value)) {
- warnStyleValueWithSemicolon(name, value);
- }
- };
-}
-
-/**
- * Operations for dealing with CSS properties.
- */
-var CSSPropertyOperations = {
-
- /**
- * Serializes a mapping of style properties for use as inline styles:
- *
- * > createMarkupForStyles({width: '200px', height: 0})
- * "width:200px;height:0;"
- *
- * Undefined values are ignored so that declarative programming is easier.
- * The result should be HTML-escaped before insertion into the DOM.
- *
- * @param {object} styles
- * @return {?string}
- */
- createMarkupForStyles: function (styles) {
- var serialized = '';
- for (var styleName in styles) {
- if (!styles.hasOwnProperty(styleName)) {
- continue;
- }
- var styleValue = styles[styleName];
- if ("production" !== 'production') {
- warnValidStyle(styleName, styleValue);
- }
- if (styleValue != null) {
- serialized += processStyleName(styleName) + ':';
- serialized += dangerousStyleValue(styleName, styleValue) + ';';
- }
- }
- return serialized || null;
- },
-
- /**
- * Sets the value for multiple styles on a node. If a value is specified as
- * '' (empty string), the corresponding style property will be unset.
- *
- * @param {DOMElement} node
- * @param {object} styles
- */
- setValueForStyles: function (node, styles) {
- var style = node.style;
- for (var styleName in styles) {
- if (!styles.hasOwnProperty(styleName)) {
- continue;
- }
- if ("production" !== 'production') {
- warnValidStyle(styleName, styles[styleName]);
- }
- var styleValue = dangerousStyleValue(styleName, styles[styleName]);
- if (styleName === 'float') {
- styleName = styleFloatAccessor;
- }
- if (styleValue) {
- style[styleName] = styleValue;
- } else {
- var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
- if (expansion) {
- // Shorthand property that IE8 won't like unsetting, so unset each
- // component to placate it
- for (var individualStyleName in expansion) {
- style[individualStyleName] = '';
- }
- } else {
- style[styleName] = '';
- }
- }
- }
- }
-
-};
-
-ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
- setValueForStyles: 'setValueForStyles'
-});
-
-module.exports = CSSPropertyOperations;
-},{"./CSSProperty":3,"./ReactPerf":71,"./dangerousStyleValue":105,"fbjs/lib/ExecutionEnvironment":130,"fbjs/lib/camelizeStyleName":132,"fbjs/lib/hyphenateStyleName":143,"fbjs/lib/memoizeStringOnly":150,"fbjs/lib/warning":155}],5:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CallbackQueue
- */
-
-'use strict';
-
-var PooledClass = require('./PooledClass');
-
-var assign = require('./Object.assign');
-var invariant = require('fbjs/lib/invariant');
-
-/**
- * A specialized pseudo-event module to help keep track of components waiting to
- * be notified when their DOM representations are available for use.
- *
- * This implements `PooledClass`, so you should never need to instantiate this.
- * Instead, use `CallbackQueue.getPooled()`.
- *
- * @class ReactMountReady
- * @implements PooledClass
- * @internal
- */
-function CallbackQueue() {
- this._callbacks = null;
- this._contexts = null;
-}
-
-assign(CallbackQueue.prototype, {
-
- /**
- * Enqueues a callback to be invoked when `notifyAll` is invoked.
- *
- * @param {function} callback Invoked when `notifyAll` is invoked.
- * @param {?object} context Context to call `callback` with.
- * @internal
- */
- enqueue: function (callback, context) {
- this._callbacks = this._callbacks || [];
- this._contexts = this._contexts || [];
- this._callbacks.push(callback);
- this._contexts.push(context);
- },
-
- /**
- * Invokes all enqueued callbacks and clears the queue. This is invoked after
- * the DOM representation of a component has been created or updated.
- *
- * @internal
- */
- notifyAll: function () {
- var callbacks = this._callbacks;
- var contexts = this._contexts;
- if (callbacks) {
- !(callbacks.length === contexts.length) ? "production" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
- this._callbacks = null;
- this._contexts = null;
- for (var i = 0; i < callbacks.length; i++) {
- callbacks[i].call(contexts[i]);
- }
- callbacks.length = 0;
- contexts.length = 0;
- }
- },
-
- /**
- * Resets the internal queue.
- *
- * @internal
- */
- reset: function () {
- this._callbacks = null;
- this._contexts = null;
- },
-
- /**
- * `PooledClass` looks for this.
- */
- destructor: function () {
- this.reset();
- }
-
-});
-
-PooledClass.addPoolingTo(CallbackQueue);
-
-module.exports = CallbackQueue;
-},{"./Object.assign":22,"./PooledClass":23,"fbjs/lib/invariant":144}],6:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ChangeEventPlugin
- */
-
-'use strict';
-
-var EventConstants = require('./EventConstants');
-var EventPluginHub = require('./EventPluginHub');
-var EventPropagators = require('./EventPropagators');
-var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
-var ReactUpdates = require('./ReactUpdates');
-var SyntheticEvent = require('./SyntheticEvent');
-
-var getEventTarget = require('./getEventTarget');
-var isEventSupported = require('./isEventSupported');
-var isTextInputElement = require('./isTextInputElement');
-var keyOf = require('fbjs/lib/keyOf');
-
-var topLevelTypes = EventConstants.topLevelTypes;
-
-var eventTypes = {
- change: {
- phasedRegistrationNames: {
- bubbled: keyOf({ onChange: null }),
- captured: keyOf({ onChangeCapture: null })
- },
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
- }
-};
-
-/**
- * For IE shims
- */
-var activeElement = null;
-var activeElementID = null;
-var activeElementValue = null;
-var activeElementValueProp = null;
-
-/**
- * SECTION: handle `change` event
- */
-function shouldUseChangeEvent(elem) {
- var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
- return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
-}
-
-var doesChangeEventBubble = false;
-if (ExecutionEnvironment.canUseDOM) {
- // See `handleChange` comment below
- doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
-}
-
-function manualDispatchChangeEvent(nativeEvent) {
- var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
- EventPropagators.accumulateTwoPhaseDispatches(event);
-
- // If change and propertychange bubbled, we'd just bind to it like all the
- // other events and have it go through ReactBrowserEventEmitter. Since it
- // doesn't, we manually listen for the events and so we have to enqueue and
- // process the abstract event manually.
- //
- // Batching is necessary here in order to ensure that all event handlers run
- // before the next rerender (including event handlers attached to ancestor
- // elements instead of directly on the input). Without this, controlled
- // components don't work properly in conjunction with event bubbling because
- // the component is rerendered and the value reverted before all the event
- // handlers can run. See https://github.com/facebook/react/issues/708.
- ReactUpdates.batchedUpdates(runEventInBatch, event);
-}
-
-function runEventInBatch(event) {
- EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue(false);
-}
-
-function startWatchingForChangeEventIE8(target, targetID) {
- activeElement = target;
- activeElementID = targetID;
- activeElement.attachEvent('onchange', manualDispatchChangeEvent);
-}
-
-function stopWatchingForChangeEventIE8() {
- if (!activeElement) {
- return;
- }
- activeElement.detachEvent('onchange', manualDispatchChangeEvent);
- activeElement = null;
- activeElementID = null;
-}
-
-function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topChange) {
- return topLevelTargetID;
- }
-}
-function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topFocus) {
- // stopWatching() should be a noop here but we call it just in case we
- // missed a blur event somehow.
- stopWatchingForChangeEventIE8();
- startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
- } else if (topLevelType === topLevelTypes.topBlur) {
- stopWatchingForChangeEventIE8();
- }
-}
-
-/**
- * SECTION: handle `input` event
- */
-var isInputEventSupported = false;
-if (ExecutionEnvironment.canUseDOM) {
- // IE9 claims to support the input event but fails to trigger it when
- // deleting text, so we ignore its input events
- isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
-}
-
-/**
- * (For old IE.) Replacement getter/setter for the `value` property that gets
- * set on the active element.
- */
-var newValueProp = {
- get: function () {
- return activeElementValueProp.get.call(this);
- },
- set: function (val) {
- // Cast to a string so we can do equality checks.
- activeElementValue = '' + val;
- activeElementValueProp.set.call(this, val);
- }
-};
-
-/**
- * (For old IE.) Starts tracking propertychange events on the passed-in element
- * and override the value property so that we can distinguish user events from
- * value changes in JS.
- */
-function startWatchingForValueChange(target, targetID) {
- activeElement = target;
- activeElementID = targetID;
- activeElementValue = target.value;
- activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
-
- // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
- // on DOM elements
- Object.defineProperty(activeElement, 'value', newValueProp);
- activeElement.attachEvent('onpropertychange', handlePropertyChange);
-}
-
-/**
- * (For old IE.) Removes the event listeners from the currently-tracked element,
- * if any exists.
- */
-function stopWatchingForValueChange() {
- if (!activeElement) {
- return;
- }
-
- // delete restores the original property definition
- delete activeElement.value;
- activeElement.detachEvent('onpropertychange', handlePropertyChange);
-
- activeElement = null;
- activeElementID = null;
- activeElementValue = null;
- activeElementValueProp = null;
-}
-
-/**
- * (For old IE.) Handles a propertychange event, sending a `change` event if
- * the value of the active element has changed.
- */
-function handlePropertyChange(nativeEvent) {
- if (nativeEvent.propertyName !== 'value') {
- return;
- }
- var value = nativeEvent.srcElement.value;
- if (value === activeElementValue) {
- return;
- }
- activeElementValue = value;
-
- manualDispatchChangeEvent(nativeEvent);
-}
-
-/**
- * If a `change` event should be fired, returns the target's ID.
- */
-function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topInput) {
- // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
- // what we want so fall through here and trigger an abstract event
- return topLevelTargetID;
- }
-}
-
-// For IE8 and IE9.
-function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topFocus) {
- // In IE8, we can capture almost all .value changes by adding a
- // propertychange handler and looking for events with propertyName
- // equal to 'value'
- // In IE9, propertychange fires for most input events but is buggy and
- // doesn't fire when text is deleted, but conveniently, selectionchange
- // appears to fire in all of the remaining cases so we catch those and
- // forward the event if the value has changed
- // In either case, we don't want to call the event handler if the value
- // is changed from JS so we redefine a setter for `.value` that updates
- // our activeElementValue variable, allowing us to ignore those changes
- //
- // stopWatching() should be a noop here but we call it just in case we
- // missed a blur event somehow.
- stopWatchingForValueChange();
- startWatchingForValueChange(topLevelTarget, topLevelTargetID);
- } else if (topLevelType === topLevelTypes.topBlur) {
- stopWatchingForValueChange();
- }
-}
-
-// For IE8 and IE9.
-function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
- // On the selectionchange event, the target is just document which isn't
- // helpful for us so just check activeElement instead.
- //
- // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
- // propertychange on the first input event after setting `value` from a
- // script and fires only keydown, keypress, keyup. Catching keyup usually
- // gets it and catching keydown lets us fire an event for the first
- // keystroke if user does a key repeat (it'll be a little delayed: right
- // before the second keystroke). Other input methods (e.g., paste) seem to
- // fire selectionchange normally.
- if (activeElement && activeElement.value !== activeElementValue) {
- activeElementValue = activeElement.value;
- return activeElementID;
- }
- }
-}
-
-/**
- * SECTION: handle `click` event
- */
-function shouldUseClickEvent(elem) {
- // Use the `click` event to detect changes to checkbox and radio inputs.
- // This approach works across all browsers, whereas `change` does not fire
- // until `blur` in IE8.
- return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
-}
-
-function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topClick) {
- return topLevelTargetID;
- }
-}
-
-/**
- * This plugin creates an `onChange` event that normalizes change events
- * across form elements. This event fires at a time when it's possible to
- * change the element's value without seeing a flicker.
- *
- * Supported elements are:
- * - input (see `isTextInputElement`)
- * - textarea
- * - select
- */
-var ChangeEventPlugin = {
-
- eventTypes: eventTypes,
-
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
-
- var getTargetIDFunc, handleEventFunc;
- if (shouldUseChangeEvent(topLevelTarget)) {
- if (doesChangeEventBubble) {
- getTargetIDFunc = getTargetIDForChangeEvent;
- } else {
- handleEventFunc = handleEventsForChangeEventIE8;
- }
- } else if (isTextInputElement(topLevelTarget)) {
- if (isInputEventSupported) {
- getTargetIDFunc = getTargetIDForInputEvent;
- } else {
- getTargetIDFunc = getTargetIDForInputEventIE;
- handleEventFunc = handleEventsForInputEventIE;
- }
- } else if (shouldUseClickEvent(topLevelTarget)) {
- getTargetIDFunc = getTargetIDForClickEvent;
- }
-
- if (getTargetIDFunc) {
- var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
- if (targetID) {
- var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
- event.type = 'change';
- EventPropagators.accumulateTwoPhaseDispatches(event);
- return event;
- }
- }
-
- if (handleEventFunc) {
- handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
- }
- }
-
-};
-
-module.exports = ChangeEventPlugin;
-},{"./EventConstants":14,"./EventPluginHub":15,"./EventPropagators":18,"./ReactUpdates":83,"./SyntheticEvent":92,"./getEventTarget":114,"./isEventSupported":119,"./isTextInputElement":120,"fbjs/lib/ExecutionEnvironment":130,"fbjs/lib/keyOf":148}],7:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ClientReactRootIndex
- * @typechecks
- */
-
-'use strict';
-
-var nextReactRootIndex = 0;
-
-var ClientReactRootIndex = {
- createReactRootIndex: function () {
- return nextReactRootIndex++;
- }
-};
-
-module.exports = ClientReactRootIndex;
-},{}],8:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule DOMChildrenOperations
- * @typechecks static-only
- */
-
-'use strict';
-
-var Danger = require('./Danger');
-var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
-var ReactPerf = require('./ReactPerf');
-
-var setInnerHTML = require('./setInnerHTML');
-var setTextContent = require('./setTextContent');
-var invariant = require('fbjs/lib/invariant');
-
-/**
- * Inserts `childNode` as a child of `parentNode` at the `index`.
- *
- * @param {DOMElement} parentNode Parent node in which to insert.
- * @param {DOMElement} childNode Child node to insert.
- * @param {number} index Index at which to insert the child.
- * @internal
- */
-function insertChildAt(parentNode, childNode, index) {
- // By exploiting arrays returning `undefined` for an undefined index, we can
- // rely exclusively on `insertBefore(node, null)` instead of also using
- // `appendChild(node)`. However, using `undefined` is not allowed by all
- // browsers so we must replace it with `null`.
-
- // fix render order error in safari
- // IE8 will throw error when index out of list size.
- var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
-
- parentNode.insertBefore(childNode, beforeChild);
-}
-
-/**
- * Operations for updating with DOM children.
- */
-var DOMChildrenOperations = {
-
- dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
-
- updateTextContent: setTextContent,
-
- /**
- * Updates a component's children by processing a series of updates. The
- * update configurations are each expected to have a `parentNode` property.
- *
- * @param {array
-
-
React Select
-
Standalone bulid
-
For usage without babel / browserify / webpack
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/dist/standalone.html b/examples/dist/standalone.html
deleted file mode 100644
index 14b76ce39d..0000000000
--- a/examples/dist/standalone.html
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
React-Select Example
-
-
-
diff --git a/examples/dist/standalone.js b/examples/dist/standalone.js
deleted file mode 100644
index 5375f65d45..0000000000
--- a/examples/dist/standalone.js
+++ /dev/null
@@ -1,1084 +0,0 @@
-(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Select = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0; --i) {
- var cacheKey = input.slice(0, i);
- if (cache[cacheKey] && (input === cacheKey || cache[cacheKey].complete)) {
- return cache[cacheKey];
- }
- }
-}
-
-function thenPromise(promise, callback) {
- if (!promise || typeof promise.then !== 'function') return;
- return promise.then(function (data) {
- callback(null, data);
- }, function (err) {
- callback(err);
- });
-}
-
-var Async = _react2['default'].createClass({
- displayName: 'Async',
-
- propTypes: {
- cache: _react2['default'].PropTypes.any, // object to use to cache results, can be null to disable cache
- loadOptions: _react2['default'].PropTypes.func.isRequired, // function to call to load options asynchronously
- ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering (shared with Select)
- ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering (shared with Select)
- isLoading: _react2['default'].PropTypes.bool, // overrides the isLoading state when set to true
- loadingPlaceholder: _react2['default'].PropTypes.string, // replaces the placeholder while options are loading
- minimumInput: _react2['default'].PropTypes.number, // the minimum number of characters that trigger loadOptions
- noResultsText: _react2['default'].PropTypes.string, // placeholder displayed when there are no matching search results (shared with Select)
- placeholder: _react2['default'].PropTypes.oneOfType([// field placeholder, displayed when there's no value (shared with Select)
- _react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
- searchingText: _react2['default'].PropTypes.string, // message to display while options are loading
- searchPromptText: _react2['default'].PropTypes.string },
- // label to prompt for search input
- getDefaultProps: function getDefaultProps() {
- return {
- cache: true,
- ignoreAccents: true,
- ignoreCase: true,
- loadingPlaceholder: 'Loading...',
- minimumInput: 0,
- searchingText: 'Searching...',
- searchPromptText: 'Type to search'
- };
- },
- getInitialState: function getInitialState() {
- return {
- cache: initCache(this.props.cache),
- isLoading: false,
- options: []
- };
- },
- componentWillMount: function componentWillMount() {
- this._lastInput = '';
- },
- componentDidMount: function componentDidMount() {
- this.loadOptions('');
- },
- componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
- if (nextProps.cache !== this.props.cache) {
- this.setState({
- cache: initCache(nextProps.cache)
- });
- }
- },
- resetState: function resetState() {
- this._currentRequestId = -1;
- this.setState({
- isLoading: false,
- options: []
- });
- },
- getResponseHandler: function getResponseHandler(input) {
- var _this = this;
-
- var _requestId = this._currentRequestId = requestId++;
- return function (err, data) {
- if (err) throw err;
- if (!_this.isMounted()) return;
- updateCache(_this.state.cache, input, data);
- if (_requestId !== _this._currentRequestId) return;
- _this.setState({
- isLoading: false,
- options: data && data.options || []
- });
- };
- },
- loadOptions: function loadOptions(input) {
- if (this.props.ignoreAccents) input = (0, _utilsStripDiacritics2['default'])(input);
- if (this.props.ignoreCase) input = input.toLowerCase();
- this._lastInput = input;
- if (input.length < this.props.minimumInput) {
- return this.resetState();
- }
- var cacheResult = getFromCache(this.state.cache, input);
- if (cacheResult) {
- return this.setState({
- options: cacheResult.options
- });
- }
- this.setState({
- isLoading: true
- });
- var responseHandler = this.getResponseHandler(input);
- return thenPromise(this.props.loadOptions(input, responseHandler), responseHandler);
- },
- render: function render() {
- var noResultsText = this.props.noResultsText;
- var _state = this.state;
- var isLoading = _state.isLoading;
- var options = _state.options;
-
- if (this.props.isLoading) isLoading = true;
- var placeholder = isLoading ? this.props.loadingPlaceholder : this.props.placeholder;
- if (!options.length) {
- if (this._lastInput.length < this.props.minimumInput) noResultsText = this.props.searchPromptText;
- if (isLoading) noResultsText = this.props.searchingText;
- }
- return _react2['default'].createElement(_Select2['default'], _extends({}, this.props, {
- isLoading: isLoading,
- noResultsText: noResultsText,
- onInputChange: this.loadOptions,
- options: options,
- placeholder: placeholder
- }));
- }
-});
-
-module.exports = Async;
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./Select":3,"./utils/stripDiacritics":5}],2:[function(require,module,exports){
-(function (global){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
-
-var _react2 = _interopRequireDefault(_react);
-
-var _classnames = (typeof window !== "undefined" ? window['classNames'] : typeof global !== "undefined" ? global['classNames'] : null);
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var Option = _react2['default'].createClass({
- displayName: 'Option',
-
- propTypes: {
- className: _react2['default'].PropTypes.string, // className (based on mouse position)
- isDisabled: _react2['default'].PropTypes.bool, // the option is disabled
- isFocused: _react2['default'].PropTypes.bool, // the option is focused
- isSelected: _react2['default'].PropTypes.bool, // the option is selected
- onSelect: _react2['default'].PropTypes.func, // method to handle click on option element
- onFocus: _react2['default'].PropTypes.func, // method to handle mouseEnter on option element
- onUnfocus: _react2['default'].PropTypes.func, // method to handle mouseLeave on option element
- option: _react2['default'].PropTypes.object.isRequired },
- // object that is base for that option
- blockEvent: function blockEvent(event) {
- event.preventDefault();
- event.stopPropagation();
- if (event.target.tagName !== 'A' || !('href' in event.target)) {
- return;
- }
- if (event.target.target) {
- window.open(event.target.href, event.target.target);
- } else {
- window.location.href = event.target.href;
- }
- },
- handleMouseDown: function handleMouseDown(event) {
- event.preventDefault();
- event.stopPropagation();
- this.props.onSelect(this.props.option, event);
- },
- handleMouseEnter: function handleMouseEnter(event) {
- this.props.onFocus(this.props.option, event);
- },
- handleMouseMove: function handleMouseMove(event) {
- if (this.props.focused) return;
- this.props.onFocus(this.props.option, event);
- },
- render: function render() {
- var option = this.props.option;
-
- var className = (0, _classnames2['default'])(this.props.className, option.className);
-
- return option.disabled ? _react2['default'].createElement(
- 'div',
- { className: className,
- onMouseDown: this.blockEvent,
- onClick: this.blockEvent },
- this.props.children
- ) : _react2['default'].createElement(
- 'div',
- { className: className,
- style: option.style,
- onMouseDown: this.handleMouseDown,
- onMouseEnter: this.handleMouseEnter,
- onMouseMove: this.handleMouseMove,
- title: option.title },
- this.props.children
- );
- }
-});
-
-module.exports = Option;
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],3:[function(require,module,exports){
-(function (global){
-'use strict';
-
-Object.defineProperty(exports, '__esModule', {
- value: true
-});
-
-var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactDom = (typeof window !== "undefined" ? window['ReactDOM'] : typeof global !== "undefined" ? global['ReactDOM'] : null);
-
-var _reactDom2 = _interopRequireDefault(_reactDom);
-
-var _reactInputAutosize = (typeof window !== "undefined" ? window['AutosizeInput'] : typeof global !== "undefined" ? global['AutosizeInput'] : null);
-
-var _reactInputAutosize2 = _interopRequireDefault(_reactInputAutosize);
-
-var _classnames = (typeof window !== "undefined" ? window['classNames'] : typeof global !== "undefined" ? global['classNames'] : null);
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var _utilsStripDiacritics = require('./utils/stripDiacritics');
-
-var _utilsStripDiacritics2 = _interopRequireDefault(_utilsStripDiacritics);
-
-var _Async = require('./Async');
-
-var _Async2 = _interopRequireDefault(_Async);
-
-var _Option = require('./Option');
-
-var _Option2 = _interopRequireDefault(_Option);
-
-var _Value = require('./Value');
-
-var _Value2 = _interopRequireDefault(_Value);
-
-function stringifyValue(value) {
- if (typeof value === 'object') {
- return JSON.stringify(value);
- } else {
- return value;
- }
-}
-
-var Select = _react2['default'].createClass({
-
- statics: { Async: _Async2['default'] },
-
- displayName: 'Select',
-
- propTypes: {
- addLabelText: _react2['default'].PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input
- allowCreate: _react2['default'].PropTypes.bool, // whether to allow creation of new entries
- autofocus: _react2['default'].PropTypes.bool, // autofocus the component on mount
- backspaceRemoves: _react2['default'].PropTypes.bool, // whether backspace removes an item if there is no text input
- className: _react2['default'].PropTypes.string, // className for the outer element
- clearAllText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // title for the "clear" control when multi: true
- clearValueText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // title for the "clear" control
- clearable: _react2['default'].PropTypes.bool, // should it be possible to reset value
- delimiter: _react2['default'].PropTypes.string, // delimiter to use to join multiple values for the hidden field value
- disabled: _react2['default'].PropTypes.bool, // whether the Select is disabled or not
- escapeClearsValue: _react2['default'].PropTypes.bool, // whether escape clears the value when the menu is closed
- filterOption: _react2['default'].PropTypes.func, // method to filter a single option (option, filterString)
- filterOptions: _react2['default'].PropTypes.any, // boolean to enable default filtering or function to filter the options array ([options], filterString, [values])
- ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering
- ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering
- inputProps: _react2['default'].PropTypes.object, // custom attributes for the Input
- isLoading: _react2['default'].PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
- labelKey: _react2['default'].PropTypes.string, // path of the label value in option objects
- matchPos: _react2['default'].PropTypes.string, // (any|start) match the start or entire string when filtering
- matchProp: _react2['default'].PropTypes.string, // (any|label|value) which option property to filter on
- scrollMenuIntoView: _react2['default'].PropTypes.bool, // boolean to enable the viewport to shift so that the full menu fully visible when engaged
- menuBuffer: _react2['default'].PropTypes.number, // optional buffer (in px) between the bottom of the viewport and the bottom of the menu
- menuStyle: _react2['default'].PropTypes.object, // optional style to apply to the menu
- menuContainerStyle: _react2['default'].PropTypes.object, // optional style to apply to the menu container
- multi: _react2['default'].PropTypes.bool, // multi-value input
- name: _react2['default'].PropTypes.string, // generates a hidden tag with this field name for html forms
- newOptionCreator: _react2['default'].PropTypes.func, // factory to create new options when allowCreate set
- noResultsText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // placeholder displayed when there are no matching search results
- onBlur: _react2['default'].PropTypes.func, // onBlur handler: function (event) {}
- onChange: _react2['default'].PropTypes.func, // onChange handler: function (newValue) {}
- onFocus: _react2['default'].PropTypes.func, // onFocus handler: function (event) {}
- onInputChange: _react2['default'].PropTypes.func, // onInputChange handler: function (inputValue) {}
- onValueClick: _react2['default'].PropTypes.func, // onClick handler for value labels: function (value, event) {}
- onMenuScrollToBottom: _react2['default'].PropTypes.func, // fires when the menu is scrolled to the bottom; can be used to paginate options
- optionComponent: _react2['default'].PropTypes.func, // option component to render in dropdown
- optionRenderer: _react2['default'].PropTypes.func, // optionRenderer: function (option) {}
- options: _react2['default'].PropTypes.array, // array of options
- placeholder: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // field placeholder, displayed when there's no value
- searchable: _react2['default'].PropTypes.bool, // whether to enable searching feature or not
- simpleValue: _react2['default'].PropTypes.bool, // pass the value to onChange as a simple value (legacy pre 1.0 mode), defaults to false
- style: _react2['default'].PropTypes.object, // optional style to apply to the control
- tabIndex: _react2['default'].PropTypes.string, // optional tab index of the control
- value: _react2['default'].PropTypes.any, // initial field value
- valueComponent: _react2['default'].PropTypes.func, // value component to render
- valueKey: _react2['default'].PropTypes.string, // path of the label value in option objects
- valueRenderer: _react2['default'].PropTypes.func, // valueRenderer: function (option) {}
- wrapperStyle: _react2['default'].PropTypes.object },
-
- // optional style to apply to the component wrapper
- getDefaultProps: function getDefaultProps() {
- return {
- addLabelText: 'Add "{label}"?',
- allowCreate: false,
- backspaceRemoves: true,
- clearAllText: 'Clear all',
- clearValueText: 'Clear value',
- clearable: true,
- delimiter: ',',
- disabled: false,
- escapeClearsValue: true,
- filterOptions: true,
- ignoreAccents: true,
- ignoreCase: true,
- inputProps: {},
- isLoading: false,
- labelKey: 'label',
- matchPos: 'any',
- matchProp: 'any',
- scrollMenuIntoView: true,
- menuBuffer: 0,
- multi: false,
- noResultsText: 'No results found',
- optionComponent: _Option2['default'],
- placeholder: 'Select...',
- searchable: true,
- simpleValue: false,
- valueComponent: _Value2['default'],
- valueKey: 'value'
- };
- },
-
- getInitialState: function getInitialState() {
- return {
- inputValue: '',
- isFocused: false,
- isLoading: false,
- isOpen: false,
- isPseudoFocused: false
- };
- },
-
- componentDidMount: function componentDidMount() {
- if (this.props.autofocus) {
- this.focus();
- }
- },
-
- componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
- if (prevState.inputValue !== this.state.inputValue && this.props.onInputChange) {
- this.props.onInputChange(this.state.inputValue);
- }
- if (this._scrollToFocusedOptionOnUpdate && this.refs.focused && this.refs.menu) {
- this._scrollToFocusedOptionOnUpdate = false;
- var focusedDOM = _reactDom2['default'].findDOMNode(this.refs.focused);
- var menuDOM = _reactDom2['default'].findDOMNode(this.refs.menu);
- var focusedRect = focusedDOM.getBoundingClientRect();
- var menuRect = menuDOM.getBoundingClientRect();
- if (focusedRect.bottom > menuRect.bottom || focusedRect.top < menuRect.top) {
- menuDOM.scrollTop = focusedDOM.offsetTop + focusedDOM.clientHeight - menuDOM.offsetHeight;
- }
- }
- if (this.props.scrollMenuIntoView && this.refs.menuContainer) {
- var menuContainerRect = this.refs.menuContainer.getBoundingClientRect();
- if (window.innerHeight < menuContainerRect.bottom + this.props.menuBuffer) {
- window.scrollTo(0, window.scrollY + menuContainerRect.bottom + this.props.menuBuffer - window.innerHeight);
- }
- }
- },
-
- focus: function focus() {
- if (!this.refs.input) return;
- this.refs.input.focus();
- },
-
- handleMouseDown: function handleMouseDown(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, or if the component is disabled, ignore it.
- if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
- return;
- }
-
- // prevent default event handlers
- event.stopPropagation();
- event.preventDefault();
-
- // for the non-searchable select, toggle the menu
- if (!this.props.searchable) {
- this.focus();
- return this.setState({
- isOpen: !this.state.isOpen
- });
- }
-
- if (this.state.isFocused) {
- // if the input is focused, ensure the menu is open
- this.setState({
- isOpen: true,
- isPseudoFocused: false
- });
- } else {
- // otherwise, focus the input and open the menu
- this._openAfterFocus = true;
- this.focus();
- }
- },
-
- handleMouseDownOnArrow: function handleMouseDownOnArrow(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, or if the component is disabled, ignore it.
- if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- // If the menu isn't open, let the event bubble to the main handleMouseDown
- if (!this.state.isOpen) {
- return;
- }
- // prevent default event handlers
- event.stopPropagation();
- event.preventDefault();
- // close the menu
- this.closeMenu();
- },
-
- closeMenu: function closeMenu() {
- this.setState({
- isOpen: false,
- isPseudoFocused: this.state.isFocused && !this.props.multi,
- inputValue: ''
- });
- },
-
- handleInputFocus: function handleInputFocus(event) {
- var isOpen = this.state.isOpen || this._openAfterFocus;
- if (this.props.onFocus) {
- this.props.onFocus(event);
- }
- this.setState({
- isFocused: true,
- isOpen: isOpen
- });
- this._openAfterFocus = false;
- },
-
- handleInputBlur: function handleInputBlur(event) {
- if (this.refs.menu && document.activeElement.isEqualNode(this.refs.menu)) {
- return;
- }
-
- if (this.props.onBlur) {
- this.props.onBlur(event);
- }
- this.setState({
- inputValue: '',
- isFocused: false,
- isOpen: false,
- isPseudoFocused: false
- });
- },
-
- handleInputChange: function handleInputChange(event) {
- this.setState({
- isOpen: true,
- isPseudoFocused: false,
- inputValue: event.target.value
- });
- },
-
- handleKeyDown: function handleKeyDown(event) {
- if (this.props.disabled) return;
- switch (event.keyCode) {
- case 8:
- // backspace
- if (!this.state.inputValue && this.props.backspaceRemoves) {
- event.preventDefault();
- this.popValue();
- }
- return;
- case 9:
- // tab
- if (event.shiftKey || !this.state.isOpen) {
- return;
- }
- this.selectFocusedOption();
- break;
- case 13:
- // enter
- if (!this.state.isOpen) return;
- this.selectFocusedOption();
- break;
- case 27:
- // escape
- if (this.state.isOpen) {
- this.closeMenu();
- } else if (this.props.clearable && this.props.escapeClearsValue) {
- this.clearValue(event);
- }
- break;
- case 38:
- // up
- this.focusPreviousOption();
- break;
- case 40:
- // down
- this.focusNextOption();
- break;
- // case 188: // ,
- // if (this.props.allowCreate && this.props.multi) {
- // event.preventDefault();
- // event.stopPropagation();
- // this.selectFocusedOption();
- // } else {
- // return;
- // }
- // break;
- default:
- return;
- }
- event.preventDefault();
- },
-
- handleValueClick: function handleValueClick(option, event) {
- if (!this.props.onValueClick) return;
- this.props.onValueClick(option, event);
- },
-
- handleMenuScroll: function handleMenuScroll(event) {
- if (!this.props.onMenuScrollToBottom) return;
- var target = event.target;
-
- if (target.scrollHeight > target.offsetHeight && !(target.scrollHeight - target.offsetHeight - target.scrollTop)) {
- this.props.onMenuScrollToBottom();
- }
- },
-
- getOptionLabel: function getOptionLabel(op) {
- return op[this.props.labelKey];
- },
-
- getValueArray: function getValueArray() {
- var value = this.props.value;
- if (this.props.multi) {
- if (typeof value === 'string') value = value.split(this.props.delimiter);
- if (!Array.isArray(value)) {
- if (value === null || value === undefined) return [];
- value = [value];
- }
- return value.map(this.expandValue).filter(function (i) {
- return i;
- });
- }
- var expandedValue = this.expandValue(value);
- return expandedValue ? [expandedValue] : [];
- },
-
- expandValue: function expandValue(value) {
- if (typeof value !== 'string' && typeof value !== 'number') return value;
- var _props = this.props;
- var options = _props.options;
- var valueKey = _props.valueKey;
-
- if (!options) return;
- for (var i = 0; i < options.length; i++) {
- if (options[i][valueKey] === value) return options[i];
- }
- },
-
- setValue: function setValue(value) {
- var _this = this;
-
- if (!this.props.onChange) return;
- if (this.props.simpleValue && value) {
- value = this.props.multi ? value.map(function (i) {
- return i[_this.props.valueKey];
- }).join(this.props.delimiter) : value[this.props.valueKey];
- }
- this.props.onChange(value);
- },
-
- selectValue: function selectValue(value) {
- if (this.props.multi) {
- this.addValue(value);
- this.setState({
- inputValue: ''
- });
- } else {
- this.setValue(value);
- this.setState({
- isOpen: false,
- inputValue: '',
- isPseudoFocused: this.state.isFocused
- });
- }
- },
-
- addValue: function addValue(value) {
- var valueArray = this.getValueArray();
- this.setValue(valueArray.concat(value));
- },
-
- popValue: function popValue() {
- var valueArray = this.getValueArray();
- if (!valueArray.length) return;
- if (valueArray[valueArray.length - 1].clearableValue === false) return;
- this.setValue(valueArray.slice(0, valueArray.length - 1));
- },
-
- removeValue: function removeValue(value) {
- var valueArray = this.getValueArray();
- this.setValue(valueArray.filter(function (i) {
- return i !== value;
- }));
- this.focus();
- },
-
- clearValue: function clearValue(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, ignore it.
- if (event && event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- event.stopPropagation();
- event.preventDefault();
- this.setValue(null);
- this.setState({
- isOpen: false,
- inputValue: ''
- }, this.focus);
- },
-
- focusOption: function focusOption(option) {
- this.setState({
- focusedOption: option
- });
- },
-
- focusNextOption: function focusNextOption() {
- this.focusAdjacentOption('next');
- },
-
- focusPreviousOption: function focusPreviousOption() {
- this.focusAdjacentOption('previous');
- },
-
- focusAdjacentOption: function focusAdjacentOption(dir) {
- var options = this._visibleOptions.filter(function (i) {
- return !i.disabled;
- });
- this._scrollToFocusedOptionOnUpdate = true;
- if (!this.state.isOpen) {
- this.setState({
- isOpen: true,
- inputValue: '',
- focusedOption: this._focusedOption || options[dir === 'next' ? 0 : options.length - 1]
- });
- return;
- }
- if (!options.length) return;
- var focusedIndex = -1;
- for (var i = 0; i < options.length; i++) {
- if (this._focusedOption === options[i]) {
- focusedIndex = i;
- break;
- }
- }
- var focusedOption = options[0];
- if (dir === 'next' && focusedIndex > -1 && focusedIndex < options.length - 1) {
- focusedOption = options[focusedIndex + 1];
- } else if (dir === 'previous') {
- if (focusedIndex > 0) {
- focusedOption = options[focusedIndex - 1];
- } else {
- focusedOption = options[options.length - 1];
- }
- }
- this.setState({
- focusedOption: focusedOption
- });
- },
-
- selectFocusedOption: function selectFocusedOption() {
- // if (this.props.allowCreate && !this.state.focusedOption) {
- // return this.selectValue(this.state.inputValue);
- // }
- if (this._focusedOption) {
- return this.selectValue(this._focusedOption);
- }
- },
-
- renderLoading: function renderLoading() {
- if (!this.props.isLoading) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-loading-zone', 'aria-hidden': 'true' },
- _react2['default'].createElement('span', { className: 'Select-loading' })
- );
- },
-
- renderValue: function renderValue(valueArray, isOpen) {
- var _this2 = this;
-
- var renderLabel = this.props.valueRenderer || this.getOptionLabel;
- var ValueComponent = this.props.valueComponent;
- if (!valueArray.length) {
- return !this.state.inputValue ? _react2['default'].createElement(
- 'div',
- { className: 'Select-placeholder' },
- this.props.placeholder
- ) : null;
- }
- var onClick = this.props.onValueClick ? this.handleValueClick : null;
- if (this.props.multi) {
- return valueArray.map(function (value, i) {
- return _react2['default'].createElement(
- ValueComponent,
- {
- disabled: _this2.props.disabled || value.clearableValue === false,
- key: 'value-' + i + '-' + value[_this2.props.valueKey],
- onClick: onClick,
- onRemove: _this2.removeValue,
- value: value
- },
- renderLabel(value)
- );
- });
- } else if (!this.state.inputValue) {
- if (isOpen) onClick = null;
- return _react2['default'].createElement(
- ValueComponent,
- {
- disabled: this.props.disabled,
- onClick: onClick,
- value: valueArray[0]
- },
- renderLabel(valueArray[0])
- );
- }
- },
-
- renderInput: function renderInput(valueArray) {
- var className = (0, _classnames2['default'])('Select-input', this.props.inputProps.className);
- if (this.props.disabled || !this.props.searchable) {
- return _react2['default'].createElement('div', _extends({}, this.props.inputProps, {
- className: className,
- tabIndex: this.props.tabIndex || 0,
- onBlur: this.handleInputBlur,
- onFocus: this.handleInputFocus,
- ref: 'input',
- style: { border: 0, width: 1, display: 'inline-block' } }));
- }
- return _react2['default'].createElement(_reactInputAutosize2['default'], _extends({}, this.props.inputProps, {
- className: className,
- tabIndex: this.props.tabIndex,
- onBlur: this.handleInputBlur,
- onChange: this.handleInputChange,
- onFocus: this.handleInputFocus,
- minWidth: '5',
- ref: 'input',
- value: this.state.inputValue
- }));
- },
-
- renderClear: function renderClear() {
- if (!this.props.clearable || !this.props.value || this.props.multi && !this.props.value.length || this.props.disabled || this.props.isLoading) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-clear-zone', title: this.props.multi ? this.props.clearAllText : this.props.clearValueText, 'aria-label': this.props.multi ? this.props.clearAllText : this.props.clearValueText, onMouseDown: this.clearValue, onTouchEnd: this.clearValue },
- _react2['default'].createElement('span', { className: 'Select-clear', dangerouslySetInnerHTML: { __html: '×' } })
- );
- },
-
- renderArrow: function renderArrow() {
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-arrow-zone', onMouseDown: this.handleMouseDownOnArrow },
- _react2['default'].createElement('span', { className: 'Select-arrow', onMouseDown: this.handleMouseDownOnArrow })
- );
- },
-
- filterOptions: function filterOptions(excludeOptions) {
- var _this3 = this;
-
- var filterValue = this.state.inputValue;
- var options = this.props.options || [];
- if (typeof this.props.filterOptions === 'function') {
- return this.props.filterOptions.call(this, options, filterValue, excludeOptions);
- } else if (this.props.filterOptions) {
- if (this.props.ignoreAccents) {
- filterValue = (0, _utilsStripDiacritics2['default'])(filterValue);
- }
- if (this.props.ignoreCase) {
- filterValue = filterValue.toLowerCase();
- }
- if (excludeOptions) excludeOptions = excludeOptions.map(function (i) {
- return i[_this3.props.valueKey];
- });
- return options.filter(function (option) {
- if (excludeOptions && excludeOptions.indexOf(option[_this3.props.valueKey]) > -1) return false;
- if (_this3.props.filterOption) return _this3.props.filterOption.call(_this3, option, filterValue);
- if (!filterValue) return true;
- var valueTest = String(option[_this3.props.valueKey]);
- var labelTest = String(option[_this3.props.labelKey]);
- if (_this3.props.ignoreAccents) {
- if (_this3.props.matchProp !== 'label') valueTest = (0, _utilsStripDiacritics2['default'])(valueTest);
- if (_this3.props.matchProp !== 'value') labelTest = (0, _utilsStripDiacritics2['default'])(labelTest);
- }
- if (_this3.props.ignoreCase) {
- if (_this3.props.matchProp !== 'label') valueTest = valueTest.toLowerCase();
- if (_this3.props.matchProp !== 'value') labelTest = labelTest.toLowerCase();
- }
- return _this3.props.matchPos === 'start' ? _this3.props.matchProp !== 'label' && valueTest.substr(0, filterValue.length) === filterValue || _this3.props.matchProp !== 'value' && labelTest.substr(0, filterValue.length) === filterValue : _this3.props.matchProp !== 'label' && valueTest.indexOf(filterValue) >= 0 || _this3.props.matchProp !== 'value' && labelTest.indexOf(filterValue) >= 0;
- });
- } else {
- return options;
- }
- },
-
- renderMenu: function renderMenu(options, valueArray, focusedOption) {
- var _this4 = this;
-
- if (options && options.length) {
- var _ret = (function () {
- var Option = _this4.props.optionComponent;
- var renderLabel = _this4.props.optionRenderer || _this4.getOptionLabel;
- return {
- v: options.map(function (option, i) {
- var isSelected = valueArray && valueArray.indexOf(option) > -1;
- var isFocused = option === focusedOption;
- var optionRef = isFocused ? 'focused' : null;
- var optionClass = (0, _classnames2['default'])({
- 'Select-option': true,
- 'is-selected': isSelected,
- 'is-focused': isFocused,
- 'is-disabled': option.disabled
- });
- return _react2['default'].createElement(
- Option,
- {
- className: optionClass,
- isDisabled: option.disabled,
- isFocused: isFocused,
- key: 'option-' + i + '-' + option[_this4.props.valueKey],
- onSelect: _this4.selectValue,
- onFocus: _this4.focusOption,
- option: option,
- isSelected: isSelected,
- ref: optionRef
- },
- renderLabel(option)
- );
- })
- };
- })();
-
- if (typeof _ret === 'object') return _ret.v;
- } else {
- return _react2['default'].createElement(
- 'div',
- { className: 'Select-noresults' },
- this.props.noResultsText
- );
- }
- },
-
- renderHiddenField: function renderHiddenField(valueArray) {
- var _this5 = this;
-
- if (!this.props.name) return;
- var value = valueArray.map(function (i) {
- return stringifyValue(i[_this5.props.valueKey]);
- }).join(this.props.delimiter);
- return _react2['default'].createElement('input', { type: 'hidden', ref: 'value', name: this.props.name, value: value, disabled: this.props.disabled });
- },
-
- getFocusableOption: function getFocusableOption(selectedOption) {
- var options = this._visibleOptions;
- if (!options.length) return;
- var focusedOption = this.state.focusedOption || selectedOption;
- if (focusedOption && options.indexOf(focusedOption) > -1) return focusedOption;
- for (var i = 0; i < options.length; i++) {
- if (!options[i].disabled) return options[i];
- }
- },
-
- render: function render() {
- var valueArray = this.getValueArray();
- var options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
- var isOpen = this.state.isOpen;
- if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
- var focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
- var className = (0, _classnames2['default'])('Select', this.props.className, {
- 'Select--multi': this.props.multi,
- 'is-disabled': this.props.disabled,
- 'is-focused': this.state.isFocused,
- 'is-loading': this.props.isLoading,
- 'is-open': isOpen,
- 'is-pseudo-focused': this.state.isPseudoFocused,
- 'is-searchable': this.props.searchable,
- 'has-value': valueArray.length
- });
- return _react2['default'].createElement(
- 'div',
- { ref: 'wrapper', className: className, style: this.props.wrapperStyle },
- this.renderHiddenField(valueArray),
- _react2['default'].createElement(
- 'div',
- { ref: 'control', className: 'Select-control', style: this.props.style, onKeyDown: this.handleKeyDown, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
- this.renderValue(valueArray, isOpen),
- this.renderInput(valueArray),
- this.renderLoading(),
- this.renderClear(),
- this.renderArrow()
- ),
- isOpen ? _react2['default'].createElement(
- 'div',
- { ref: 'menuContainer', className: 'Select-menu-outer', style: this.props.menuContainerStyle },
- _react2['default'].createElement(
- 'div',
- { ref: 'menu', className: 'Select-menu', style: this.props.menuStyle, onScroll: this.handleMenuScroll, onMouseDown: this.handleMouseDownOnMenu },
- this.renderMenu(options, !this.props.multi ? valueArray : null, focusedOption)
- )
- ) : null
- );
- }
-
-});
-
-exports['default'] = Select;
-module.exports = exports['default'];
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./Async":1,"./Option":2,"./Value":4,"./utils/stripDiacritics":5}],4:[function(require,module,exports){
-(function (global){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
-
-var _react2 = _interopRequireDefault(_react);
-
-var _classnames = (typeof window !== "undefined" ? window['classNames'] : typeof global !== "undefined" ? global['classNames'] : null);
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var Value = _react2['default'].createClass({
-
- displayName: 'Value',
-
- propTypes: {
- disabled: _react2['default'].PropTypes.bool, // disabled prop passed to ReactSelect
- onClick: _react2['default'].PropTypes.func, // method to handle click on value label
- onRemove: _react2['default'].PropTypes.func, // method to handle removal of the value
- value: _react2['default'].PropTypes.object.isRequired },
-
- // the option object for this value
- handleMouseDown: function handleMouseDown(event) {
- if (event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- if (this.props.onClick) {
- event.stopPropagation();
- this.props.onClick(this.props.value, event);
- return;
- }
- if (this.props.value.href) {
- event.stopPropagation();
- }
- },
-
- onRemove: function onRemove(event) {
- event.preventDefault();
- event.stopPropagation();
- this.props.onRemove(this.props.value);
- },
-
- renderRemoveIcon: function renderRemoveIcon() {
- if (this.props.disabled || !this.props.onRemove) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-value-icon',
- onMouseDown: this.onRemove,
- onTouchEnd: this.onRemove },
- '×'
- );
- },
-
- renderLabel: function renderLabel() {
- var className = 'Select-value-label';
- return this.props.onClick || this.props.value.href ? _react2['default'].createElement(
- 'a',
- { className: className, href: this.props.value.href, target: this.props.value.target, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
- this.props.children
- ) : _react2['default'].createElement(
- 'span',
- { className: className },
- this.props.children
- );
- },
-
- render: function render() {
- return _react2['default'].createElement(
- 'div',
- { className: (0, _classnames2['default'])('Select-value', this.props.value.className),
- style: this.props.value.style,
- title: this.props.value.title
- },
- this.renderRemoveIcon(),
- this.renderLabel()
- );
- }
-
-});
-
-module.exports = Value;
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],5:[function(require,module,exports){
-'use strict';
-
-var map = [{ 'base': 'A', 'letters': /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g }, { 'base': 'AA', 'letters': /[\uA732]/g }, { 'base': 'AE', 'letters': /[\u00C6\u01FC\u01E2]/g }, { 'base': 'AO', 'letters': /[\uA734]/g }, { 'base': 'AU', 'letters': /[\uA736]/g }, { 'base': 'AV', 'letters': /[\uA738\uA73A]/g }, { 'base': 'AY', 'letters': /[\uA73C]/g }, { 'base': 'B', 'letters': /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g }, { 'base': 'C', 'letters': /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g }, { 'base': 'D', 'letters': /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g }, { 'base': 'DZ', 'letters': /[\u01F1\u01C4]/g }, { 'base': 'Dz', 'letters': /[\u01F2\u01C5]/g }, { 'base': 'E', 'letters': /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g }, { 'base': 'F', 'letters': /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g }, { 'base': 'G', 'letters': /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g }, { 'base': 'H', 'letters': /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g }, { 'base': 'I', 'letters': /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g }, { 'base': 'J', 'letters': /[\u004A\u24BF\uFF2A\u0134\u0248]/g }, { 'base': 'K', 'letters': /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g }, { 'base': 'L', 'letters': /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g }, { 'base': 'LJ', 'letters': /[\u01C7]/g }, { 'base': 'Lj', 'letters': /[\u01C8]/g }, { 'base': 'M', 'letters': /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g }, { 'base': 'N', 'letters': /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g }, { 'base': 'NJ', 'letters': /[\u01CA]/g }, { 'base': 'Nj', 'letters': /[\u01CB]/g }, { 'base': 'O', 'letters': /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g }, { 'base': 'OI', 'letters': /[\u01A2]/g }, { 'base': 'OO', 'letters': /[\uA74E]/g }, { 'base': 'OU', 'letters': /[\u0222]/g }, { 'base': 'P', 'letters': /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g }, { 'base': 'Q', 'letters': /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g }, { 'base': 'R', 'letters': /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g }, { 'base': 'S', 'letters': /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g }, { 'base': 'T', 'letters': /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g }, { 'base': 'TZ', 'letters': /[\uA728]/g }, { 'base': 'U', 'letters': /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g }, { 'base': 'V', 'letters': /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g }, { 'base': 'VY', 'letters': /[\uA760]/g }, { 'base': 'W', 'letters': /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g }, { 'base': 'X', 'letters': /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g }, { 'base': 'Y', 'letters': /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g }, { 'base': 'Z', 'letters': /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g }, { 'base': 'a', 'letters': /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g }, { 'base': 'aa', 'letters': /[\uA733]/g }, { 'base': 'ae', 'letters': /[\u00E6\u01FD\u01E3]/g }, { 'base': 'ao', 'letters': /[\uA735]/g }, { 'base': 'au', 'letters': /[\uA737]/g }, { 'base': 'av', 'letters': /[\uA739\uA73B]/g }, { 'base': 'ay', 'letters': /[\uA73D]/g }, { 'base': 'b', 'letters': /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g }, { 'base': 'c', 'letters': /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g }, { 'base': 'd', 'letters': /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g }, { 'base': 'dz', 'letters': /[\u01F3\u01C6]/g }, { 'base': 'e', 'letters': /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g }, { 'base': 'f', 'letters': /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g }, { 'base': 'g', 'letters': /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g }, { 'base': 'h', 'letters': /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g }, { 'base': 'hv', 'letters': /[\u0195]/g }, { 'base': 'i', 'letters': /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g }, { 'base': 'j', 'letters': /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g }, { 'base': 'k', 'letters': /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g }, { 'base': 'l', 'letters': /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g }, { 'base': 'lj', 'letters': /[\u01C9]/g }, { 'base': 'm', 'letters': /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g }, { 'base': 'n', 'letters': /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g }, { 'base': 'nj', 'letters': /[\u01CC]/g }, { 'base': 'o', 'letters': /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g }, { 'base': 'oi', 'letters': /[\u01A3]/g }, { 'base': 'ou', 'letters': /[\u0223]/g }, { 'base': 'oo', 'letters': /[\uA74F]/g }, { 'base': 'p', 'letters': /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g }, { 'base': 'q', 'letters': /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g }, { 'base': 'r', 'letters': /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g }, { 'base': 's', 'letters': /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g }, { 'base': 't', 'letters': /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g }, { 'base': 'tz', 'letters': /[\uA729]/g }, { 'base': 'u', 'letters': /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g }, { 'base': 'v', 'letters': /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g }, { 'base': 'vy', 'letters': /[\uA761]/g }, { 'base': 'w', 'letters': /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g }, { 'base': 'x', 'letters': /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g }, { 'base': 'y', 'letters': /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g }, { 'base': 'z', 'letters': /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g }];
-
-module.exports = function stripDiacritics(str) {
- for (var i = 0; i < map.length; i++) {
- str = str.replace(map[i].letters, map[i].base);
- }
- return str;
-};
-
-},{}]},{},[3])(3)
-});
\ No newline at end of file
diff --git a/examples/src/app.js b/examples/src/app.js
index b9e0c193b3..676c02b74d 100644
--- a/examples/src/app.js
+++ b/examples/src/app.js
@@ -1,8 +1,9 @@
/* eslint react/prop-types: 0 */
import React from 'react';
+global.React = React;
import ReactDOM from 'react-dom';
-import Select from 'react-select';
+import Select from '../../src/Select';
import Contributors from './components/Contributors';
import CustomComponents from './components/CustomComponents';
diff --git a/examples/src/components/Contributors.js b/examples/src/components/Contributors.js
index 9aac1e5882..9662837982 100644
--- a/examples/src/components/Contributors.js
+++ b/examples/src/components/Contributors.js
@@ -1,5 +1,5 @@
import React from 'react';
-import Select from 'react-select';
+import Select from '../../../src/Select';
const CONTRIBUTORS = require('../data/contributors');
const MAX_CONTRIBUTORS = 6;
diff --git a/examples/src/components/CustomComponents.js b/examples/src/components/CustomComponents.js
index 031cc12513..c98545634e 100644
--- a/examples/src/components/CustomComponents.js
+++ b/examples/src/components/CustomComponents.js
@@ -1,5 +1,5 @@
import React from 'react';
-import Select from 'react-select';
+import Select from '../../../src/Select';
import Gravatar from 'react-gravatar';
const USERS = require('../data/users');
diff --git a/examples/src/components/CustomRender.js b/examples/src/components/CustomRender.js
index 7f96b6e885..4377d69146 100644
--- a/examples/src/components/CustomRender.js
+++ b/examples/src/components/CustomRender.js
@@ -1,5 +1,6 @@
import React from 'react';
-import Select from 'react-select';
+import Select from '../../../src/Select';
+import OptionComponent from '../../../src/Option';
var DisabledUpsellOptions = React.createClass({
displayName: 'DisabledUpsellOptions',
@@ -30,15 +31,19 @@ var DisabledUpsellOptions = React.createClass({
];
return (
+ HELLO WORLD
{this.props.label}
+ >
+
+ {this.renderOption}
+
+
This demonstates custom render methods and links in disabled options
);
diff --git a/examples/src/components/Multiselect.js b/examples/src/components/Multiselect.js
index 3142e75ef9..9e85ad1ffb 100644
--- a/examples/src/components/Multiselect.js
+++ b/examples/src/components/Multiselect.js
@@ -1,5 +1,5 @@
import React from 'react';
-import Select from 'react-select';
+import Select from '../../../src/Select';
const FLAVOURS = [
{ label: 'Chocolate', value: 'chocolate' },
diff --git a/examples/src/components/NumericSelect.js b/examples/src/components/NumericSelect.js
index 8c4a902b7e..b3f5ac5e79 100644
--- a/examples/src/components/NumericSelect.js
+++ b/examples/src/components/NumericSelect.js
@@ -1,5 +1,5 @@
import React from 'react';
-import Select from 'react-select';
+import Select from '../../../src/Select';
var ValuesAsNumbersField = React.createClass({
displayName: 'ValuesAsNumbersField',
diff --git a/examples/src/components/States.js b/examples/src/components/States.js
index 8103c2eb90..1008d0f83f 100644
--- a/examples/src/components/States.js
+++ b/examples/src/components/States.js
@@ -1,5 +1,5 @@
import React from 'react';
-import Select from 'react-select';
+import Select from '../../../src/Select';
const STATES = require('../data/states');
diff --git a/examples/src/index.html b/examples/src/index.html
index a826d4cf81..d5f8d4064e 100644
--- a/examples/src/index.html
+++ b/examples/src/index.html
@@ -47,8 +47,6 @@ React Select
-
-
diff --git a/examples/src/standalone.html b/examples/src/standalone.html
deleted file mode 100644
index 14b76ce39d..0000000000
--- a/examples/src/standalone.html
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
- React-Select Example
-
-
-
-
-
React Select
-
Standalone bulid
-
For usage without babel / browserify / webpack
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/Async.js b/lib/Async.js
index 7ebd375894..2dc7292631 100644
--- a/lib/Async.js
+++ b/lib/Async.js
@@ -2,8 +2,6 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -12,14 +10,18 @@ var _Select = require('./Select');
var _Select2 = _interopRequireDefault(_Select);
-var _utilsStripDiacritics = require('./utils/stripDiacritics');
+var _stripDiacritics = require('./utils/stripDiacritics');
+
+var _stripDiacritics2 = _interopRequireDefault(_stripDiacritics);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-var _utilsStripDiacritics2 = _interopRequireDefault(_utilsStripDiacritics);
+function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
var requestId = 0;
function initCache(cache) {
- if (cache && typeof cache !== 'object') {
+ if (cache && (typeof cache === 'undefined' ? 'undefined' : _typeof(cache)) !== 'object') {
cache = {};
}
return cache ? cache : null;
@@ -49,22 +51,22 @@ function thenPromise(promise, callback) {
});
}
-var Async = _react2['default'].createClass({
+var Async = _react2.default.createClass({
displayName: 'Async',
propTypes: {
- cache: _react2['default'].PropTypes.any, // object to use to cache results, can be null to disable cache
- loadOptions: _react2['default'].PropTypes.func.isRequired, // function to call to load options asynchronously
- ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering (shared with Select)
- ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering (shared with Select)
- isLoading: _react2['default'].PropTypes.bool, // overrides the isLoading state when set to true
- loadingPlaceholder: _react2['default'].PropTypes.string, // replaces the placeholder while options are loading
- minimumInput: _react2['default'].PropTypes.number, // the minimum number of characters that trigger loadOptions
- noResultsText: _react2['default'].PropTypes.string, // placeholder displayed when there are no matching search results (shared with Select)
- placeholder: _react2['default'].PropTypes.oneOfType([// field placeholder, displayed when there's no value (shared with Select)
- _react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
- searchingText: _react2['default'].PropTypes.string, // message to display while options are loading
- searchPromptText: _react2['default'].PropTypes.string },
+ cache: _react2.default.PropTypes.any, // object to use to cache results, can be null to disable cache
+ loadOptions: _react2.default.PropTypes.func.isRequired, // function to call to load options asynchronously
+ ignoreAccents: _react2.default.PropTypes.bool, // whether to strip diacritics when filtering (shared with Select)
+ ignoreCase: _react2.default.PropTypes.bool, // whether to perform case-insensitive filtering (shared with Select)
+ isLoading: _react2.default.PropTypes.bool, // overrides the isLoading state when set to true
+ loadingPlaceholder: _react2.default.PropTypes.string, // replaces the placeholder while options are loading
+ minimumInput: _react2.default.PropTypes.number, // the minimum number of characters that trigger loadOptions
+ noResultsText: _react2.default.PropTypes.string, // placeholder displayed when there are no matching search results (shared with Select)
+ placeholder: _react2.default.PropTypes.oneOfType([// field placeholder, displayed when there's no value (shared with Select)
+ _react2.default.PropTypes.string, _react2.default.PropTypes.node]),
+ searchingText: _react2.default.PropTypes.string, // message to display while options are loading
+ searchPromptText: _react2.default.PropTypes.string },
// label to prompt for search input
getDefaultProps: function getDefaultProps() {
return {
@@ -120,7 +122,7 @@ var Async = _react2['default'].createClass({
};
},
loadOptions: function loadOptions(input) {
- if (this.props.ignoreAccents) input = (0, _utilsStripDiacritics2['default'])(input);
+ if (this.props.ignoreAccents) input = (0, _stripDiacritics2.default)(input);
if (this.props.ignoreCase) input = input.toLowerCase();
this._lastInput = input;
if (input.length < this.props.minimumInput) {
@@ -150,7 +152,7 @@ var Async = _react2['default'].createClass({
if (this._lastInput.length < this.props.minimumInput) noResultsText = this.props.searchPromptText;
if (isLoading) noResultsText = this.props.searchingText;
}
- return _react2['default'].createElement(_Select2['default'], _extends({}, this.props, {
+ return _react2.default.createElement(_Select2.default, _extends({}, this.props, {
isLoading: isLoading,
noResultsText: noResultsText,
onInputChange: this.loadOptions,
diff --git a/lib/Option.js b/lib/Option.js
index c5a9a6e7be..3fbdb900a2 100644
--- a/lib/Option.js
+++ b/lib/Option.js
@@ -1,7 +1,5 @@
'use strict';
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -10,18 +8,20 @@ var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
-var Option = _react2['default'].createClass({
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var Option = _react2.default.createClass({
displayName: 'Option',
propTypes: {
- className: _react2['default'].PropTypes.string, // className (based on mouse position)
- isDisabled: _react2['default'].PropTypes.bool, // the option is disabled
- isFocused: _react2['default'].PropTypes.bool, // the option is focused
- isSelected: _react2['default'].PropTypes.bool, // the option is selected
- onSelect: _react2['default'].PropTypes.func, // method to handle click on option element
- onFocus: _react2['default'].PropTypes.func, // method to handle mouseEnter on option element
- onUnfocus: _react2['default'].PropTypes.func, // method to handle mouseLeave on option element
- option: _react2['default'].PropTypes.object.isRequired },
+ className: _react2.default.PropTypes.string, // className (based on mouse position)
+ isDisabled: _react2.default.PropTypes.bool, // the option is disabled
+ isFocused: _react2.default.PropTypes.bool, // the option is focused
+ isSelected: _react2.default.PropTypes.bool, // the option is selected
+ onFocus: _react2.default.PropTypes.func, // method to handle mouseEnter on option element
+ onSelect: _react2.default.PropTypes.func, // method to handle click on option element
+ onUnfocus: _react2.default.PropTypes.func, // method to handle mouseLeave on option element
+ option: _react2.default.PropTypes.object },
// object that is base for that option
blockEvent: function blockEvent(event) {
event.preventDefault();
@@ -50,15 +50,15 @@ var Option = _react2['default'].createClass({
render: function render() {
var option = this.props.option;
- var className = (0, _classnames2['default'])(this.props.className, option.className);
+ var className = (0, _classnames2.default)(this.props.className, option.className);
- return option.disabled ? _react2['default'].createElement(
+ return option.disabled ? _react2.default.createElement(
'div',
{ className: className,
onMouseDown: this.blockEvent,
onClick: this.blockEvent },
this.props.children
- ) : _react2['default'].createElement(
+ ) : _react2.default.createElement(
'div',
{ className: className,
style: option.style,
diff --git a/lib/Select.js b/lib/Select.js
index 29b1dfe4ae..05a66d1f0e 100644
--- a/lib/Select.js
+++ b/lib/Select.js
@@ -1,12 +1,10 @@
'use strict';
-Object.defineProperty(exports, '__esModule', {
- value: true
-});
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
var _react = require('react');
@@ -24,9 +22,9 @@ var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
-var _utilsStripDiacritics = require('./utils/stripDiacritics');
+var _stripDiacritics = require('./utils/stripDiacritics');
-var _utilsStripDiacritics2 = _interopRequireDefault(_utilsStripDiacritics);
+var _stripDiacritics2 = _interopRequireDefault(_stripDiacritics);
var _Async = require('./Async');
@@ -40,68 +38,72 @@ var _Value = require('./Value');
var _Value2 = _interopRequireDefault(_Value);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
+
function stringifyValue(value) {
- if (typeof value === 'object') {
+ if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
return JSON.stringify(value);
} else {
return value;
}
}
-var Select = _react2['default'].createClass({
+var Select = _react2.default.createClass({
- statics: { Async: _Async2['default'] },
+ statics: { Async: _Async2.default },
displayName: 'Select',
propTypes: {
- addLabelText: _react2['default'].PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input
- allowCreate: _react2['default'].PropTypes.bool, // whether to allow creation of new entries
- autofocus: _react2['default'].PropTypes.bool, // autofocus the component on mount
- backspaceRemoves: _react2['default'].PropTypes.bool, // whether backspace removes an item if there is no text input
- className: _react2['default'].PropTypes.string, // className for the outer element
- clearAllText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // title for the "clear" control when multi: true
- clearValueText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // title for the "clear" control
- clearable: _react2['default'].PropTypes.bool, // should it be possible to reset value
- delimiter: _react2['default'].PropTypes.string, // delimiter to use to join multiple values for the hidden field value
- disabled: _react2['default'].PropTypes.bool, // whether the Select is disabled or not
- escapeClearsValue: _react2['default'].PropTypes.bool, // whether escape clears the value when the menu is closed
- filterOption: _react2['default'].PropTypes.func, // method to filter a single option (option, filterString)
- filterOptions: _react2['default'].PropTypes.any, // boolean to enable default filtering or function to filter the options array ([options], filterString, [values])
- ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering
- ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering
- inputProps: _react2['default'].PropTypes.object, // custom attributes for the Input
- isLoading: _react2['default'].PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
- labelKey: _react2['default'].PropTypes.string, // path of the label value in option objects
- matchPos: _react2['default'].PropTypes.string, // (any|start) match the start or entire string when filtering
- matchProp: _react2['default'].PropTypes.string, // (any|label|value) which option property to filter on
- scrollMenuIntoView: _react2['default'].PropTypes.bool, // boolean to enable the viewport to shift so that the full menu fully visible when engaged
- menuBuffer: _react2['default'].PropTypes.number, // optional buffer (in px) between the bottom of the viewport and the bottom of the menu
- menuStyle: _react2['default'].PropTypes.object, // optional style to apply to the menu
- menuContainerStyle: _react2['default'].PropTypes.object, // optional style to apply to the menu container
- multi: _react2['default'].PropTypes.bool, // multi-value input
- name: _react2['default'].PropTypes.string, // generates a hidden tag with this field name for html forms
- newOptionCreator: _react2['default'].PropTypes.func, // factory to create new options when allowCreate set
- noResultsText: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // placeholder displayed when there are no matching search results
- onBlur: _react2['default'].PropTypes.func, // onBlur handler: function (event) {}
- onChange: _react2['default'].PropTypes.func, // onChange handler: function (newValue) {}
- onFocus: _react2['default'].PropTypes.func, // onFocus handler: function (event) {}
- onInputChange: _react2['default'].PropTypes.func, // onInputChange handler: function (inputValue) {}
- onValueClick: _react2['default'].PropTypes.func, // onClick handler for value labels: function (value, event) {}
- onMenuScrollToBottom: _react2['default'].PropTypes.func, // fires when the menu is scrolled to the bottom; can be used to paginate options
- optionComponent: _react2['default'].PropTypes.func, // option component to render in dropdown
- optionRenderer: _react2['default'].PropTypes.func, // optionRenderer: function (option) {}
- options: _react2['default'].PropTypes.array, // array of options
- placeholder: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]), // field placeholder, displayed when there's no value
- searchable: _react2['default'].PropTypes.bool, // whether to enable searching feature or not
- simpleValue: _react2['default'].PropTypes.bool, // pass the value to onChange as a simple value (legacy pre 1.0 mode), defaults to false
- style: _react2['default'].PropTypes.object, // optional style to apply to the control
- tabIndex: _react2['default'].PropTypes.string, // optional tab index of the control
- value: _react2['default'].PropTypes.any, // initial field value
- valueComponent: _react2['default'].PropTypes.func, // value component to render
- valueKey: _react2['default'].PropTypes.string, // path of the label value in option objects
- valueRenderer: _react2['default'].PropTypes.func, // valueRenderer: function (option) {}
- wrapperStyle: _react2['default'].PropTypes.object },
+ addLabelText: _react2.default.PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input
+ allowCreate: _react2.default.PropTypes.bool, // whether to allow creation of new entries
+ autofocus: _react2.default.PropTypes.bool, // autofocus the component on mount
+ backspaceRemoves: _react2.default.PropTypes.bool, // whether backspace removes an item if there is no text input
+ className: _react2.default.PropTypes.string, // className for the outer element
+ clearAllText: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.node]), // title for the "clear" control when multi: true
+ clearValueText: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.node]), // title for the "clear" control
+ clearable: _react2.default.PropTypes.bool, // should it be possible to reset value
+ delimiter: _react2.default.PropTypes.string, // delimiter to use to join multiple values for the hidden field value
+ disabled: _react2.default.PropTypes.bool, // whether the Select is disabled or not
+ escapeClearsValue: _react2.default.PropTypes.bool, // whether escape clears the value when the menu is closed
+ filterOption: _react2.default.PropTypes.func, // method to filter a single option (option, filterString)
+ filterOptions: _react2.default.PropTypes.any, // boolean to enable default filtering or function to filter the options array ([options], filterString, [values])
+ ignoreAccents: _react2.default.PropTypes.bool, // whether to strip diacritics when filtering
+ ignoreCase: _react2.default.PropTypes.bool, // whether to perform case-insensitive filtering
+ inputProps: _react2.default.PropTypes.object, // custom attributes for the Input
+ isLoading: _react2.default.PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
+ labelKey: _react2.default.PropTypes.string, // path of the label value in option objects
+ matchPos: _react2.default.PropTypes.string, // (any|start) match the start or entire string when filtering
+ matchProp: _react2.default.PropTypes.string, // (any|label|value) which option property to filter on
+ scrollMenuIntoView: _react2.default.PropTypes.bool, // boolean to enable the viewport to shift so that the full menu fully visible when engaged
+ menuBuffer: _react2.default.PropTypes.number, // optional buffer (in px) between the bottom of the viewport and the bottom of the menu
+ menuStyle: _react2.default.PropTypes.object, // optional style to apply to the menu
+ menuContainerStyle: _react2.default.PropTypes.object, // optional style to apply to the menu container
+ multi: _react2.default.PropTypes.bool, // multi-value input
+ name: _react2.default.PropTypes.string, // generates a hidden tag with this field name for html forms
+ newOptionCreator: _react2.default.PropTypes.func, // factory to create new options when allowCreate set
+ noResultsText: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.node]), // placeholder displayed when there are no matching search results
+ onBlur: _react2.default.PropTypes.func, // onBlur handler: function (event) {}
+ onChange: _react2.default.PropTypes.func, // onChange handler: function (newValue) {}
+ onFocus: _react2.default.PropTypes.func, // onFocus handler: function (event) {}
+ onInputChange: _react2.default.PropTypes.func, // onInputChange handler: function (inputValue) {}
+ onValueClick: _react2.default.PropTypes.func, // onClick handler for value labels: function (value, event) {}
+ onMenuScrollToBottom: _react2.default.PropTypes.func, // fires when the menu is scrolled to the bottom; can be used to paginate options
+ optionComponent: _react2.default.PropTypes.func, // option component to render in dropdown
+ optionRenderer: _react2.default.PropTypes.func, // optionRenderer: function (option) {}
+ options: _react2.default.PropTypes.array, // array of options
+ placeholder: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.node]), // field placeholder, displayed when there's no value
+ searchable: _react2.default.PropTypes.bool, // whether to enable searching feature or not
+ simpleValue: _react2.default.PropTypes.bool, // pass the value to onChange as a simple value (legacy pre 1.0 mode), defaults to false
+ style: _react2.default.PropTypes.object, // optional style to apply to the control
+ tabIndex: _react2.default.PropTypes.string, // optional tab index of the control
+ value: _react2.default.PropTypes.any, // initial field value
+ valueComponent: _react2.default.PropTypes.func, // value component to render
+ valueKey: _react2.default.PropTypes.string, // path of the label value in option objects
+ valueRenderer: _react2.default.PropTypes.func, // valueRenderer: function (option) {}
+ wrapperStyle: _react2.default.PropTypes.object },
// optional style to apply to the component wrapper
getDefaultProps: function getDefaultProps() {
@@ -127,15 +129,14 @@ var Select = _react2['default'].createClass({
menuBuffer: 0,
multi: false,
noResultsText: 'No results found',
- optionComponent: _Option2['default'],
+ optionComponent: _Option2.default,
placeholder: 'Select...',
searchable: true,
simpleValue: false,
- valueComponent: _Value2['default'],
+ valueComponent: _Value2.default,
valueKey: 'value'
};
},
-
getInitialState: function getInitialState() {
return {
inputValue: '',
@@ -145,21 +146,19 @@ var Select = _react2['default'].createClass({
isPseudoFocused: false
};
},
-
componentDidMount: function componentDidMount() {
if (this.props.autofocus) {
this.focus();
}
},
-
componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
if (prevState.inputValue !== this.state.inputValue && this.props.onInputChange) {
this.props.onInputChange(this.state.inputValue);
}
if (this._scrollToFocusedOptionOnUpdate && this.refs.focused && this.refs.menu) {
this._scrollToFocusedOptionOnUpdate = false;
- var focusedDOM = _reactDom2['default'].findDOMNode(this.refs.focused);
- var menuDOM = _reactDom2['default'].findDOMNode(this.refs.menu);
+ var focusedDOM = _reactDom2.default.findDOMNode(this.refs.focused);
+ var menuDOM = _reactDom2.default.findDOMNode(this.refs.menu);
var focusedRect = focusedDOM.getBoundingClientRect();
var menuRect = menuDOM.getBoundingClientRect();
if (focusedRect.bottom > menuRect.bottom || focusedRect.top < menuRect.top) {
@@ -173,12 +172,10 @@ var Select = _react2['default'].createClass({
}
}
},
-
focus: function focus() {
if (!this.refs.input) return;
this.refs.input.focus();
},
-
handleMouseDown: function handleMouseDown(event) {
// if the event was triggered by a mousedown and not the primary
// button, or if the component is disabled, ignore it.
@@ -210,7 +207,6 @@ var Select = _react2['default'].createClass({
this.focus();
}
},
-
handleMouseDownOnArrow: function handleMouseDownOnArrow(event) {
// if the event was triggered by a mousedown and not the primary
// button, or if the component is disabled, ignore it.
@@ -227,7 +223,6 @@ var Select = _react2['default'].createClass({
// close the menu
this.closeMenu();
},
-
closeMenu: function closeMenu() {
this.setState({
isOpen: false,
@@ -235,7 +230,6 @@ var Select = _react2['default'].createClass({
inputValue: ''
});
},
-
handleInputFocus: function handleInputFocus(event) {
var isOpen = this.state.isOpen || this._openAfterFocus;
if (this.props.onFocus) {
@@ -247,7 +241,6 @@ var Select = _react2['default'].createClass({
});
this._openAfterFocus = false;
},
-
handleInputBlur: function handleInputBlur(event) {
if (this.refs.menu && document.activeElement.isEqualNode(this.refs.menu)) {
return;
@@ -263,7 +256,6 @@ var Select = _react2['default'].createClass({
isPseudoFocused: false
});
},
-
handleInputChange: function handleInputChange(event) {
this.setState({
isOpen: true,
@@ -271,7 +263,6 @@ var Select = _react2['default'].createClass({
inputValue: event.target.value
});
},
-
handleKeyDown: function handleKeyDown(event) {
if (this.props.disabled) return;
switch (event.keyCode) {
@@ -324,12 +315,10 @@ var Select = _react2['default'].createClass({
}
event.preventDefault();
},
-
handleValueClick: function handleValueClick(option, event) {
if (!this.props.onValueClick) return;
this.props.onValueClick(option, event);
},
-
handleMenuScroll: function handleMenuScroll(event) {
if (!this.props.onMenuScrollToBottom) return;
var target = event.target;
@@ -338,11 +327,9 @@ var Select = _react2['default'].createClass({
this.props.onMenuScrollToBottom();
}
},
-
getOptionLabel: function getOptionLabel(op) {
return op[this.props.labelKey];
},
-
getValueArray: function getValueArray() {
var value = this.props.value;
if (this.props.multi) {
@@ -358,7 +345,6 @@ var Select = _react2['default'].createClass({
var expandedValue = this.expandValue(value);
return expandedValue ? [expandedValue] : [];
},
-
expandValue: function expandValue(value) {
if (typeof value !== 'string' && typeof value !== 'number') return value;
var _props = this.props;
@@ -370,7 +356,6 @@ var Select = _react2['default'].createClass({
if (options[i][valueKey] === value) return options[i];
}
},
-
setValue: function setValue(value) {
var _this = this;
@@ -382,7 +367,6 @@ var Select = _react2['default'].createClass({
}
this.props.onChange(value);
},
-
selectValue: function selectValue(value) {
if (this.props.multi) {
this.addValue(value);
@@ -398,19 +382,16 @@ var Select = _react2['default'].createClass({
});
}
},
-
addValue: function addValue(value) {
var valueArray = this.getValueArray();
this.setValue(valueArray.concat(value));
},
-
popValue: function popValue() {
var valueArray = this.getValueArray();
if (!valueArray.length) return;
if (valueArray[valueArray.length - 1].clearableValue === false) return;
this.setValue(valueArray.slice(0, valueArray.length - 1));
},
-
removeValue: function removeValue(value) {
var valueArray = this.getValueArray();
this.setValue(valueArray.filter(function (i) {
@@ -418,7 +399,6 @@ var Select = _react2['default'].createClass({
}));
this.focus();
},
-
clearValue: function clearValue(event) {
// if the event was triggered by a mousedown and not the primary
// button, ignore it.
@@ -433,21 +413,17 @@ var Select = _react2['default'].createClass({
inputValue: ''
}, this.focus);
},
-
focusOption: function focusOption(option) {
this.setState({
focusedOption: option
});
},
-
focusNextOption: function focusNextOption() {
this.focusAdjacentOption('next');
},
-
focusPreviousOption: function focusPreviousOption() {
this.focusAdjacentOption('previous');
},
-
focusAdjacentOption: function focusAdjacentOption(dir) {
var options = this._visibleOptions.filter(function (i) {
return !i.disabled;
@@ -483,7 +459,6 @@ var Select = _react2['default'].createClass({
focusedOption: focusedOption
});
},
-
selectFocusedOption: function selectFocusedOption() {
// if (this.props.allowCreate && !this.state.focusedOption) {
// return this.selectValue(this.state.inputValue);
@@ -492,23 +467,21 @@ var Select = _react2['default'].createClass({
return this.selectValue(this._focusedOption);
}
},
-
renderLoading: function renderLoading() {
if (!this.props.isLoading) return;
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'span',
{ className: 'Select-loading-zone', 'aria-hidden': 'true' },
- _react2['default'].createElement('span', { className: 'Select-loading' })
+ _react2.default.createElement('span', { className: 'Select-loading' })
);
},
-
renderValue: function renderValue(valueArray, isOpen) {
var _this2 = this;
var renderLabel = this.props.valueRenderer || this.getOptionLabel;
var ValueComponent = this.props.valueComponent;
if (!valueArray.length) {
- return !this.state.inputValue ? _react2['default'].createElement(
+ return !this.state.inputValue ? _react2.default.createElement(
'div',
{ className: 'Select-placeholder' },
this.props.placeholder
@@ -517,7 +490,7 @@ var Select = _react2['default'].createClass({
var onClick = this.props.onValueClick ? this.handleValueClick : null;
if (this.props.multi) {
return valueArray.map(function (value, i) {
- return _react2['default'].createElement(
+ return _react2.default.createElement(
ValueComponent,
{
disabled: _this2.props.disabled || value.clearableValue === false,
@@ -531,7 +504,7 @@ var Select = _react2['default'].createClass({
});
} else if (!this.state.inputValue) {
if (isOpen) onClick = null;
- return _react2['default'].createElement(
+ return _react2.default.createElement(
ValueComponent,
{
disabled: this.props.disabled,
@@ -542,11 +515,10 @@ var Select = _react2['default'].createClass({
);
}
},
-
renderInput: function renderInput(valueArray) {
- var className = (0, _classnames2['default'])('Select-input', this.props.inputProps.className);
+ var className = (0, _classnames2.default)('Select-input', this.props.inputProps.className);
if (this.props.disabled || !this.props.searchable) {
- return _react2['default'].createElement('div', _extends({}, this.props.inputProps, {
+ return _react2.default.createElement('div', _extends({}, this.props.inputProps, {
className: className,
tabIndex: this.props.tabIndex || 0,
onBlur: this.handleInputBlur,
@@ -554,7 +526,7 @@ var Select = _react2['default'].createClass({
ref: 'input',
style: { border: 0, width: 1, display: 'inline-block' } }));
}
- return _react2['default'].createElement(_reactInputAutosize2['default'], _extends({}, this.props.inputProps, {
+ return _react2.default.createElement(_reactInputAutosize2.default, _extends({}, this.props.inputProps, {
className: className,
tabIndex: this.props.tabIndex,
onBlur: this.handleInputBlur,
@@ -565,24 +537,21 @@ var Select = _react2['default'].createClass({
value: this.state.inputValue
}));
},
-
renderClear: function renderClear() {
if (!this.props.clearable || !this.props.value || this.props.multi && !this.props.value.length || this.props.disabled || this.props.isLoading) return;
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'span',
{ className: 'Select-clear-zone', title: this.props.multi ? this.props.clearAllText : this.props.clearValueText, 'aria-label': this.props.multi ? this.props.clearAllText : this.props.clearValueText, onMouseDown: this.clearValue, onTouchEnd: this.clearValue },
- _react2['default'].createElement('span', { className: 'Select-clear', dangerouslySetInnerHTML: { __html: '×' } })
+ _react2.default.createElement('span', { className: 'Select-clear', dangerouslySetInnerHTML: { __html: '×' } })
);
},
-
renderArrow: function renderArrow() {
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'span',
{ className: 'Select-arrow-zone', onMouseDown: this.handleMouseDownOnArrow },
- _react2['default'].createElement('span', { className: 'Select-arrow', onMouseDown: this.handleMouseDownOnArrow })
+ _react2.default.createElement('span', { className: 'Select-arrow', onMouseDown: this.handleMouseDownOnArrow })
);
},
-
filterOptions: function filterOptions(excludeOptions) {
var _this3 = this;
@@ -592,7 +561,7 @@ var Select = _react2['default'].createClass({
return this.props.filterOptions.call(this, options, filterValue, excludeOptions);
} else if (this.props.filterOptions) {
if (this.props.ignoreAccents) {
- filterValue = (0, _utilsStripDiacritics2['default'])(filterValue);
+ filterValue = (0, _stripDiacritics2.default)(filterValue);
}
if (this.props.ignoreCase) {
filterValue = filterValue.toLowerCase();
@@ -607,8 +576,8 @@ var Select = _react2['default'].createClass({
var valueTest = String(option[_this3.props.valueKey]);
var labelTest = String(option[_this3.props.labelKey]);
if (_this3.props.ignoreAccents) {
- if (_this3.props.matchProp !== 'label') valueTest = (0, _utilsStripDiacritics2['default'])(valueTest);
- if (_this3.props.matchProp !== 'value') labelTest = (0, _utilsStripDiacritics2['default'])(labelTest);
+ if (_this3.props.matchProp !== 'label') valueTest = (0, _stripDiacritics2.default)(valueTest);
+ if (_this3.props.matchProp !== 'value') labelTest = (0, _stripDiacritics2.default)(labelTest);
}
if (_this3.props.ignoreCase) {
if (_this3.props.matchProp !== 'label') valueTest = valueTest.toLowerCase();
@@ -620,26 +589,40 @@ var Select = _react2['default'].createClass({
return options;
}
},
-
+ findPropChild: function findPropChild(propType) {
+ debugger;
+ switch (propType) {
+ case 'optionRenderer':
+ return (Array.isArray(this.props.children) ? this.props.children : [this.props.children]).filter(function (child) {
+ return child.type === _Option2.default || child.type.displayName === 'Option';
+ }).map(function (optionComponent) {
+ return Array.isArray(optionComponent.props.children) ? optionComponent.props.children[0] : optionComponent.props.children;
+ }).filter(function (optionChild) {
+ return typeof optionChild === 'function';
+ })[0];
+ default:
+ return null;
+ }
+ },
renderMenu: function renderMenu(options, valueArray, focusedOption) {
var _this4 = this;
if (options && options.length) {
var _ret = (function () {
var Option = _this4.props.optionComponent;
- var renderLabel = _this4.props.optionRenderer || _this4.getOptionLabel;
+ var renderLabel = _this4.props.optionRenderer || _this4.findPropChild('optionRenderer') || _this4.getOptionLabel;
return {
v: options.map(function (option, i) {
var isSelected = valueArray && valueArray.indexOf(option) > -1;
var isFocused = option === focusedOption;
var optionRef = isFocused ? 'focused' : null;
- var optionClass = (0, _classnames2['default'])({
+ var optionClass = (0, _classnames2.default)({
'Select-option': true,
'is-selected': isSelected,
'is-focused': isFocused,
'is-disabled': option.disabled
});
- return _react2['default'].createElement(
+ return _react2.default.createElement(
Option,
{
className: optionClass,
@@ -658,16 +641,15 @@ var Select = _react2['default'].createClass({
};
})();
- if (typeof _ret === 'object') return _ret.v;
+ if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
} else {
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'div',
{ className: 'Select-noresults' },
this.props.noResultsText
);
}
},
-
renderHiddenField: function renderHiddenField(valueArray) {
var _this5 = this;
@@ -675,9 +657,8 @@ var Select = _react2['default'].createClass({
var value = valueArray.map(function (i) {
return stringifyValue(i[_this5.props.valueKey]);
}).join(this.props.delimiter);
- return _react2['default'].createElement('input', { type: 'hidden', ref: 'value', name: this.props.name, value: value, disabled: this.props.disabled });
+ return _react2.default.createElement('input', { type: 'hidden', ref: 'value', name: this.props.name, value: value, disabled: this.props.disabled });
},
-
getFocusableOption: function getFocusableOption(selectedOption) {
var options = this._visibleOptions;
if (!options.length) return;
@@ -687,14 +668,13 @@ var Select = _react2['default'].createClass({
if (!options[i].disabled) return options[i];
}
},
-
render: function render() {
var valueArray = this.getValueArray();
var options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
var isOpen = this.state.isOpen;
if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
var focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
- var className = (0, _classnames2['default'])('Select', this.props.className, {
+ var className = (0, _classnames2.default)('Select', this.props.className, {
'Select--multi': this.props.multi,
'is-disabled': this.props.disabled,
'is-focused': this.state.isFocused,
@@ -704,11 +684,11 @@ var Select = _react2['default'].createClass({
'is-searchable': this.props.searchable,
'has-value': valueArray.length
});
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'div',
{ ref: 'wrapper', className: className, style: this.props.wrapperStyle },
this.renderHiddenField(valueArray),
- _react2['default'].createElement(
+ _react2.default.createElement(
'div',
{ ref: 'control', className: 'Select-control', style: this.props.style, onKeyDown: this.handleKeyDown, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
this.renderValue(valueArray, isOpen),
@@ -717,10 +697,10 @@ var Select = _react2['default'].createClass({
this.renderClear(),
this.renderArrow()
),
- isOpen ? _react2['default'].createElement(
+ isOpen ? _react2.default.createElement(
'div',
{ ref: 'menuContainer', className: 'Select-menu-outer', style: this.props.menuContainerStyle },
- _react2['default'].createElement(
+ _react2.default.createElement(
'div',
{ ref: 'menu', className: 'Select-menu', style: this.props.menuStyle, onScroll: this.handleMenuScroll, onMouseDown: this.handleMouseDownOnMenu },
this.renderMenu(options, !this.props.multi ? valueArray : null, focusedOption)
@@ -728,8 +708,6 @@ var Select = _react2['default'].createClass({
) : null
);
}
-
});
-exports['default'] = Select;
-module.exports = exports['default'];
\ No newline at end of file
+exports.default = Select;
\ No newline at end of file
diff --git a/lib/Value.js b/lib/Value.js
index 1b1288df9c..38b26f40c4 100644
--- a/lib/Value.js
+++ b/lib/Value.js
@@ -1,7 +1,5 @@
'use strict';
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@@ -10,15 +8,17 @@ var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
-var Value = _react2['default'].createClass({
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var Value = _react2.default.createClass({
displayName: 'Value',
propTypes: {
- disabled: _react2['default'].PropTypes.bool, // disabled prop passed to ReactSelect
- onClick: _react2['default'].PropTypes.func, // method to handle click on value label
- onRemove: _react2['default'].PropTypes.func, // method to handle removal of the value
- value: _react2['default'].PropTypes.object.isRequired },
+ disabled: _react2.default.PropTypes.bool, // disabled prop passed to ReactSelect
+ onClick: _react2.default.PropTypes.func, // method to handle click on value label
+ onRemove: _react2.default.PropTypes.func, // method to handle removal of the value
+ value: _react2.default.PropTypes.object.isRequired },
// the option object for this value
handleMouseDown: function handleMouseDown(event) {
@@ -34,16 +34,14 @@ var Value = _react2['default'].createClass({
event.stopPropagation();
}
},
-
onRemove: function onRemove(event) {
event.preventDefault();
event.stopPropagation();
this.props.onRemove(this.props.value);
},
-
renderRemoveIcon: function renderRemoveIcon() {
if (this.props.disabled || !this.props.onRemove) return;
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'span',
{ className: 'Select-value-icon',
onMouseDown: this.onRemove,
@@ -51,24 +49,22 @@ var Value = _react2['default'].createClass({
'×'
);
},
-
renderLabel: function renderLabel() {
var className = 'Select-value-label';
- return this.props.onClick || this.props.value.href ? _react2['default'].createElement(
+ return this.props.onClick || this.props.value.href ? _react2.default.createElement(
'a',
{ className: className, href: this.props.value.href, target: this.props.value.target, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
this.props.children
- ) : _react2['default'].createElement(
+ ) : _react2.default.createElement(
'span',
{ className: className },
this.props.children
);
},
-
render: function render() {
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'div',
- { className: (0, _classnames2['default'])('Select-value', this.props.value.className),
+ { className: (0, _classnames2.default)('Select-value', this.props.value.className),
style: this.props.value.style,
title: this.props.value.title
},
@@ -76,7 +72,6 @@ var Value = _react2['default'].createClass({
this.renderLabel()
);
}
-
});
module.exports = Value;
\ No newline at end of file
diff --git a/package.json b/package.json
index 5ee32327b5..ccae24b442 100644
--- a/package.json
+++ b/package.json
@@ -15,16 +15,25 @@
"react-input-autosize": "^0.6.5"
},
"devDependencies": {
- "babel": "^5.8.23",
- "babel-eslint": "^4.1.3",
+ "autoless": "^0.1.7",
+ "babel": "^6.3.13",
+ "babel-cli": "^6.3.17",
+ "babel-eslint": "^5.0.0-beta6",
+ "babel-plugin-transform-strict-mode": "^6.3.13",
+ "babel-preset-es2015": "^6.3.13",
+ "babel-preset-react": "^6.3.13",
+ "babelify": "^7.2.0",
+ "browserify": "^12.0.1",
"chai": "^3.4.1",
"coveralls": "^2.11.4",
- "eslint": "^1.10.2",
+ "eslint": "^1.10.3",
"eslint-plugin-react": "^3.10.0",
"gulp": "^3.9.0",
"istanbul": "^0.4.1",
"jsdom": "^7.1.0",
+ "less": "^2.5.3",
"mocha": "^2.3.4",
+ "npm-run-all": "^1.4.0",
"react": "^0.14.0",
"react-addons-test-utils": "^0.14.0",
"react-component-gulp-tasks": "^0.7.7",
@@ -34,7 +43,8 @@
"unexpected": "^10.3.1",
"unexpected-dom": "^3.0.2",
"unexpected-react": "^0.3.2",
- "unexpected-sinon": "^9.0.4"
+ "unexpected-sinon": "^9.0.4",
+ "watchify": "^3.6.1"
},
"peerDependencies": {
"react": "^0.14.0",
@@ -47,6 +57,14 @@
"react-input-autosize": "global:AutosizeInput"
},
"scripts": {
+ "build:example:js": "browserify -t babelify --debug examples/src/app.js -o examples/src/bundle.js",
+ "build:example:less": "autoless --no-watch --no-sound --no-notify --source-map --compile-imports --autoprefix 'last 2 versions' examples/src/ -o examples/src/example.css",
+ "watch:example:js": "watchify -v -t babelify --debug examples/src/app.js -o examples/src/bundle.js",
+ "watch:example:less": "autoless --no-sound --no-notify --source-map --compile-imports --autoprefix 'last 2 versions' examples/src/ -o examples/src/example.css",
+ "build:example": "npm-run-all -p build:example:*",
+ "watch:example": "npm-run-all -p watch:example:*",
+ "build:js": "babel src/ -d lib",
+ "watch:js": "babel src/ -wd lib",
"build": "gulp clean && NODE_ENV=production gulp build",
"bump": "gulp bump",
"bump:major": "gulp bump:major",
diff --git a/src/Option.js b/src/Option.js
index 595c571359..d9b946b2c4 100644
--- a/src/Option.js
+++ b/src/Option.js
@@ -7,10 +7,10 @@ const Option = React.createClass({
isDisabled: React.PropTypes.bool, // the option is disabled
isFocused: React.PropTypes.bool, // the option is focused
isSelected: React.PropTypes.bool, // the option is selected
+ onFocus: React.PropTypes.func, // method to handle mouseEnter on option element
onSelect: React.PropTypes.func, // method to handle click on option element
- onFocus: React.PropTypes.func, // method to handle mouseEnter on option element
onUnfocus: React.PropTypes.func, // method to handle mouseLeave on option element
- option: React.PropTypes.object.isRequired, // object that is base for that option
+ option: React.PropTypes.object, // object that is base for that option
},
blockEvent (event) {
event.preventDefault();
diff --git a/src/Select.js b/src/Select.js
index 157b03a53d..e4bd333ad1 100644
--- a/src/Select.js
+++ b/src/Select.js
@@ -583,10 +583,23 @@ const Select = React.createClass({
}
},
- renderMenu (options, valueArray, focusedOption) {
+ findPropChild(propType){
+ debugger;
+ switch(propType){
+ case 'optionRenderer':
+ return (Array.isArray(this.props.children) ? this.props.children : [this.props.children])
+ .filter(child => child.type === Option || child.type.displayName === 'Option')
+ .map(optionComponent => Array.isArray(optionComponent.props.children) ? optionComponent.props.children[0] : optionComponent.props.children)
+ .filter(optionChild => typeof optionChild === 'function')[0];
+ default:
+ return null;
+ }
+ },
+
+ renderMenu(options, valueArray, focusedOption) {
if (options && options.length) {
let Option = this.props.optionComponent;
- let renderLabel = this.props.optionRenderer || this.getOptionLabel;
+ let renderLabel = this.props.optionRenderer || this.findPropChild('optionRenderer') || this.getOptionLabel;
return options.map((option, i) => {
let isSelected = valueArray && valueArray.indexOf(option) > -1;
let isFocused = option === focusedOption;
From cf504d93c7b5c4bc0b383632a5a833530d547d95 Mon Sep 17 00:00:00 2001
From: "Goel, Naman"
Date: Wed, 2 Mar 2016 00:02:11 -0800
Subject: [PATCH 2/2] refactor menu to its own component
---
examples/dist/app.js | 1348 ---
examples/dist/bundle.js | 1246 ---
examples/dist/common.js | 18987 --------------------------------
examples/dist/index.html | 54 -
examples/dist/standalone.html | 48 -
examples/dist/standalone.js | 1255 ---
lib/Async.js | 16 +-
lib/Option.js | 11 +-
lib/Select.js | 181 +-
lib/Value.js | 19 +-
package.json | 6 +-
src/Menu.js | 127 +
src/Option.js | 1 +
src/Select.js | 74 +-
14 files changed, 287 insertions(+), 23086 deletions(-)
delete mode 100644 examples/dist/app.js
delete mode 100644 examples/dist/bundle.js
delete mode 100644 examples/dist/common.js
delete mode 100644 examples/dist/index.html
delete mode 100644 examples/dist/standalone.html
delete mode 100644 examples/dist/standalone.js
create mode 100644 src/Menu.js
diff --git a/examples/dist/app.js b/examples/dist/app.js
deleted file mode 100644
index a5f78f004c..0000000000
--- a/examples/dist/app.js
+++ /dev/null
@@ -1,1348 +0,0 @@
-require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o
-*/
-
-},{"./components/Contributors":2,"./components/CustomComponents":3,"./components/CustomRender":4,"./components/Multiselect":5,"./components/NumericSelect":6,"./components/States":7,"react":undefined,"react-dom":undefined,"react-select":undefined}],2:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var CONTRIBUTORS = require('../data/contributors');
-var MAX_CONTRIBUTORS = 6;
-var ASYNC_DELAY = 500;
-
-var Contributors = _react2['default'].createClass({
- displayName: 'Contributors',
- propTypes: {
- label: _react2['default'].PropTypes.string
- },
- getInitialState: function getInitialState() {
- return {
- multi: true,
- value: [CONTRIBUTORS[0]]
- };
- },
- onChange: function onChange(value) {
- this.setState({
- value: value
- });
- },
- switchToMulti: function switchToMulti() {
- this.setState({
- multi: true,
- value: [this.state.value]
- });
- },
- switchToSingle: function switchToSingle() {
- this.setState({
- multi: false,
- value: this.state.value[0]
- });
- },
- getContributors: function getContributors(input, callback) {
- input = input.toLowerCase();
- var options = CONTRIBUTORS.filter(function (i) {
- return i.github.substr(0, input.length) === input;
- });
- var data = {
- options: options.slice(0, MAX_CONTRIBUTORS),
- complete: options.length <= MAX_CONTRIBUTORS
- };
- setTimeout(function () {
- callback(null, data);
- }, ASYNC_DELAY);
- },
- gotoContributor: function gotoContributor(value, event) {
- window.open('https://github.com/' + value.github);
- },
- render: function render() {
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'].Async, { multi: this.state.multi, value: this.state.value, onChange: this.onChange, onValueClick: this.gotoContributor, valueKey: 'github', labelKey: 'name', loadOptions: this.getContributors }),
- _react2['default'].createElement(
- 'div',
- { className: 'checkbox-list' },
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'radio', className: 'checkbox-control', checked: this.state.multi, onChange: this.switchToMulti }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Multiselect'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'radio', className: 'checkbox-control', checked: !this.state.multi, onChange: this.switchToSingle }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Single Value'
- )
- )
- ),
- _react2['default'].createElement(
- 'div',
- { className: 'hint' },
- 'This example implements custom label and value properties, async options and opens the github profiles in a new window when values are clicked'
- )
- );
- }
-});
-
-module.exports = Contributors;
-
-},{"../data/contributors":8,"react":undefined,"react-select":undefined}],3:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var _reactGravatar = require('react-gravatar');
-
-var _reactGravatar2 = _interopRequireDefault(_reactGravatar);
-
-var USERS = require('../data/users');
-var GRAVATAR_SIZE = 15;
-
-var GravatarOption = _react2['default'].createClass({
- displayName: 'GravatarOption',
-
- propTypes: {
- children: _react2['default'].PropTypes.node,
- className: _react2['default'].PropTypes.string,
- isDisabled: _react2['default'].PropTypes.bool,
- isFocused: _react2['default'].PropTypes.bool,
- isSelected: _react2['default'].PropTypes.bool,
- onFocus: _react2['default'].PropTypes.func,
- onSelect: _react2['default'].PropTypes.func,
- onUnfocus: _react2['default'].PropTypes.func,
- option: _react2['default'].PropTypes.object.isRequired
- },
- handleMouseDown: function handleMouseDown(event) {
- event.preventDefault();
- event.stopPropagation();
- this.props.onSelect(this.props.option, event);
- },
- handleMouseEnter: function handleMouseEnter(event) {
- this.props.onFocus(this.props.option, event);
- },
- handleMouseMove: function handleMouseMove(event) {
- if (this.props.isFocused) return;
- this.props.onFocus(this.props.option, event);
- },
- handleMouseLeave: function handleMouseLeave(event) {
- this.props.onUnfocus(this.props.option, event);
- },
- render: function render() {
- var gravatarStyle = {
- borderRadius: 3,
- display: 'inline-block',
- marginRight: 10,
- position: 'relative',
- top: -2,
- verticalAlign: 'middle'
- };
- return _react2['default'].createElement(
- 'div',
- { className: this.props.className,
- onMouseDown: this.handleMouseDown,
- onMouseEnter: this.handleMouseEnter,
- onMouseMove: this.handleMouseMove,
- onMouseLeave: this.handleMouseLeave,
- title: this.props.option.title },
- _react2['default'].createElement(_reactGravatar2['default'], { email: this.props.option.email, size: GRAVATAR_SIZE, style: gravatarStyle }),
- this.props.children
- );
- }
-});
-
-var GravatarValue = _react2['default'].createClass({
- displayName: 'GravatarValue',
-
- propTypes: {
- children: _react2['default'].PropTypes.node,
- placeholder: _react2['default'].PropTypes.string,
- value: _react2['default'].PropTypes.object
- },
- render: function render() {
- var gravatarStyle = {
- borderRadius: 3,
- display: 'inline-block',
- marginRight: 10,
- position: 'relative',
- top: -2,
- verticalAlign: 'middle'
- };
- return _react2['default'].createElement(
- 'div',
- { className: 'Select-value', title: this.props.value.title },
- _react2['default'].createElement(
- 'span',
- { className: 'Select-value-label' },
- _react2['default'].createElement(_reactGravatar2['default'], { email: this.props.value.email, size: GRAVATAR_SIZE, style: gravatarStyle }),
- this.props.children
- )
- );
- }
-});
-
-var UsersField = _react2['default'].createClass({
- displayName: 'UsersField',
-
- propTypes: {
- hint: _react2['default'].PropTypes.string,
- label: _react2['default'].PropTypes.string
- },
- getInitialState: function getInitialState() {
- return {};
- },
- setValue: function setValue(value) {
- this.setState({ value: value });
- },
- render: function render() {
- var placeholder = _react2['default'].createElement(
- 'span',
- null,
- '☺ Select User'
- );
-
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'], {
- onChange: this.setValue,
- optionComponent: GravatarOption,
- options: USERS,
- placeholder: placeholder,
- value: this.state.value,
- valueComponent: GravatarValue
- }),
- _react2['default'].createElement(
- 'div',
- { className: 'hint' },
- 'This example implements custom Option and Value components to render a Gravatar image for each user based on their email. It also demonstrates rendering HTML elements as the placeholder.'
- )
- );
- }
-});
-
-module.exports = UsersField;
-
-},{"../data/users":10,"react":undefined,"react-gravatar":14,"react-select":undefined}],4:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var DisabledUpsellOptions = _react2['default'].createClass({
- displayName: 'DisabledUpsellOptions',
- propTypes: {
- label: _react2['default'].PropTypes.string
- },
- getInitialState: function getInitialState() {
- return {};
- },
- setValue: function setValue(value) {
- this.setState({ value: value });
- console.log('Support level selected:', value.label);
- },
- renderLink: function renderLink() {
- return _react2['default'].createElement(
- 'a',
- { style: { marginLeft: 5 }, href: '/upgrade', target: '_blank' },
- 'Upgrade here!'
- );
- },
- renderOption: function renderOption(option) {
- return _react2['default'].createElement(
- 'span',
- { style: { color: option.color } },
- option.label,
- ' ',
- option.link
- );
- },
- renderValue: function renderValue(option) {
- return _react2['default'].createElement(
- 'strong',
- { style: { color: option.color } },
- option.label
- );
- },
- render: function render() {
- var options = [{ label: 'Basic customer support', value: 'basic', color: '#E31864' }, { label: 'Premium customer support', value: 'premium', color: '#6216A3' }, { label: 'Pro customer support', value: 'pro', disabled: true, link: this.renderLink() }];
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'], {
- placeholder: 'Select your support level',
- options: options,
- optionRenderer: this.renderOption,
- onChange: this.setValue,
- value: this.state.value,
- valueRenderer: this.renderValue
- }),
- _react2['default'].createElement(
- 'div',
- { className: 'hint' },
- 'This demonstates custom render methods and links in disabled options'
- )
- );
- }
-});
-module.exports = DisabledUpsellOptions;
-
-},{"react":undefined,"react-select":undefined}],5:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var FLAVOURS = [{ label: 'Chocolate', value: 'chocolate' }, { label: 'Vanilla', value: 'vanilla' }, { label: 'Strawberry', value: 'strawberry' }, { label: 'Caramel', value: 'caramel' }, { label: 'Cookies and Cream', value: 'cookiescream' }, { label: 'Peppermint', value: 'peppermint' }];
-
-var WHY_WOULD_YOU = [{ label: 'Chocolate (are you crazy?)', value: 'chocolate', disabled: true }].concat(FLAVOURS.slice(1));
-
-var MultiSelectField = _react2['default'].createClass({
- displayName: 'MultiSelectField',
- propTypes: {
- label: _react2['default'].PropTypes.string
- },
- getInitialState: function getInitialState() {
- return {
- disabled: false,
- crazy: false,
- options: FLAVOURS,
- value: []
- };
- },
- handleSelectChange: function handleSelectChange(value) {
- console.log('You\'ve selected:', value);
- this.setState({ value: value });
- },
- toggleDisabled: function toggleDisabled(e) {
- this.setState({ disabled: e.target.checked });
- },
- toggleChocolate: function toggleChocolate(e) {
- var crazy = e.target.checked;
- this.setState({
- crazy: crazy,
- options: crazy ? WHY_WOULD_YOU : FLAVOURS
- });
- },
- render: function render() {
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'], { multi: true, simpleValue: true, disabled: this.state.disabled, value: this.state.value, placeholder: 'Select your favourite(s)', options: this.state.options, onChange: this.handleSelectChange }),
- _react2['default'].createElement(
- 'div',
- { className: 'checkbox-list' },
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.disabled, onChange: this.toggleDisabled }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Disable the control'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.crazy, onChange: this.toggleChocolate }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'I don\'t like Chocolate (disabled the option)'
- )
- )
- )
- );
- }
-});
-
-module.exports = MultiSelectField;
-
-},{"react":undefined,"react-select":undefined}],6:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var ValuesAsNumbersField = _react2['default'].createClass({
- displayName: 'ValuesAsNumbersField',
- propTypes: {
- label: _react2['default'].PropTypes.string
- },
- getInitialState: function getInitialState() {
- return {
- options: [{ value: 10, label: 'Ten' }, { value: 11, label: 'Eleven' }, { value: 12, label: 'Twelve' }, { value: 23, label: 'Twenty-three' }, { value: 24, label: 'Twenty-four' }],
- matchPos: 'any',
- matchValue: true,
- matchLabel: true,
- value: null,
- multi: false
- };
- },
- onChangeMatchStart: function onChangeMatchStart(event) {
- this.setState({
- matchPos: event.target.checked ? 'start' : 'any'
- });
- },
- onChangeMatchValue: function onChangeMatchValue(event) {
- this.setState({
- matchValue: event.target.checked
- });
- },
- onChangeMatchLabel: function onChangeMatchLabel(event) {
- this.setState({
- matchLabel: event.target.checked
- });
- },
- onChange: function onChange(value) {
- this.setState({ value: value });
- console.log('Numeric Select value changed to', value);
- },
- onChangeMulti: function onChangeMulti(event) {
- this.setState({
- multi: event.target.checked
- });
- },
- render: function render() {
- var matchProp = 'any';
- if (this.state.matchLabel && !this.state.matchValue) {
- matchProp = 'label';
- }
- if (!this.state.matchLabel && this.state.matchValue) {
- matchProp = 'value';
- }
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'], {
- matchPos: this.state.matchPos,
- matchProp: matchProp,
- multi: this.state.multi,
- onChange: this.onChange,
- options: this.state.options,
- simpleValue: true,
- value: this.state.value
- }),
- _react2['default'].createElement(
- 'div',
- { className: 'checkbox-list' },
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.multi, onChange: this.onChangeMulti }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Multi-Select'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.matchValue, onChange: this.onChangeMatchValue }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Match value only'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.matchLabel, onChange: this.onChangeMatchLabel }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Match label only'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', checked: this.state.matchPos === 'start', onChange: this.onChangeMatchStart }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Only include matches from the start of the string'
- )
- )
- ),
- _react2['default'].createElement(
- 'div',
- { className: 'hint' },
- 'This example uses simple numeric values'
- )
- );
- }
-});
-
-module.exports = ValuesAsNumbersField;
-
-},{"react":undefined,"react-select":undefined}],7:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactSelect = require('react-select');
-
-var _reactSelect2 = _interopRequireDefault(_reactSelect);
-
-var STATES = require('../data/states');
-
-var StatesField = _react2['default'].createClass({
- displayName: 'StatesField',
- propTypes: {
- label: _react2['default'].PropTypes.string,
- searchable: _react2['default'].PropTypes.bool
- },
- getDefaultProps: function getDefaultProps() {
- return {
- label: 'States:',
- searchable: true
- };
- },
- getInitialState: function getInitialState() {
- return {
- country: 'AU',
- disabled: false,
- searchable: this.props.searchable,
- selectValue: 'new-south-wales',
- clearable: true
- };
- },
- switchCountry: function switchCountry(e) {
- var newCountry = e.target.value;
- console.log('Country changed to ' + newCountry);
- this.setState({
- country: newCountry,
- selectValue: null
- });
- },
- updateValue: function updateValue(newValue) {
- console.log('State changed to ' + newValue);
- this.setState({
- selectValue: newValue
- });
- },
- focusStateSelect: function focusStateSelect() {
- this.refs.stateSelect.focus();
- },
- toggleCheckbox: function toggleCheckbox(e) {
- var newState = {};
- newState[e.target.name] = e.target.checked;
- this.setState(newState);
- },
- render: function render() {
- var options = STATES[this.state.country];
- return _react2['default'].createElement(
- 'div',
- { className: 'section' },
- _react2['default'].createElement(
- 'h3',
- { className: 'section-heading' },
- this.props.label
- ),
- _react2['default'].createElement(_reactSelect2['default'], { ref: 'stateSelect', autofocus: true, options: options, simpleValue: true, clearable: this.state.clearable, name: 'selected-state', disabled: this.state.disabled, value: this.state.selectValue, onChange: this.updateValue, searchable: this.state.searchable }),
- _react2['default'].createElement(
- 'div',
- { style: { marginTop: 14 } },
- _react2['default'].createElement(
- 'button',
- { type: 'button', onClick: this.focusStateSelect },
- 'Focus Select'
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox', style: { marginLeft: 10 } },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', name: 'searchable', checked: this.state.searchable, onChange: this.toggleCheckbox }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Searchable'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox', style: { marginLeft: 10 } },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', name: 'disabled', checked: this.state.disabled, onChange: this.toggleCheckbox }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Disabled'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox', style: { marginLeft: 10 } },
- _react2['default'].createElement('input', { type: 'checkbox', className: 'checkbox-control', name: 'clearable', checked: this.state.clearable, onChange: this.toggleCheckbox }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Clearable'
- )
- )
- ),
- _react2['default'].createElement(
- 'div',
- { className: 'checkbox-list' },
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'radio', className: 'checkbox-control', checked: this.state.country === 'AU', value: 'AU', onChange: this.switchCountry }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'Australia'
- )
- ),
- _react2['default'].createElement(
- 'label',
- { className: 'checkbox' },
- _react2['default'].createElement('input', { type: 'radio', className: 'checkbox-control', checked: this.state.country === 'US', value: 'US', onChange: this.switchCountry }),
- _react2['default'].createElement(
- 'span',
- { className: 'checkbox-label' },
- 'United States'
- )
- )
- )
- );
- }
-});
-
-module.exports = StatesField;
-
-},{"../data/states":9,"react":undefined,"react-select":undefined}],8:[function(require,module,exports){
-'use strict';
-
-module.exports = [{ github: 'jedwatson', name: 'Jed Watson' }, { github: 'bruderstein', name: 'Dave Brotherstone' }, { github: 'jossmac', name: 'Joss Mackison' }, { github: 'jniechcial', name: 'Jakub Niechciał' }, { github: 'craigdallimore', name: 'Craig Dallimore' }, { github: 'julen', name: 'Julen Ruiz Aizpuru' }, { github: 'dcousens', name: 'Daniel Cousens' }, { github: 'jgautsch', name: 'Jon Gautsch' }, { github: 'dmitry-smirnov', name: 'Dmitry Smirnov' }];
-
-},{}],9:[function(require,module,exports){
-'use strict';
-
-exports.AU = [{ value: 'australian-capital-territory', label: 'Australian Capital Territory', className: 'State-ACT' }, { value: 'new-south-wales', label: 'New South Wales', className: 'State-NSW' }, { value: 'victoria', label: 'Victoria', className: 'State-Vic' }, { value: 'queensland', label: 'Queensland', className: 'State-Qld' }, { value: 'western-australia', label: 'Western Australia', className: 'State-WA' }, { value: 'south-australia', label: 'South Australia', className: 'State-SA' }, { value: 'tasmania', label: 'Tasmania', className: 'State-Tas' }, { value: 'northern-territory', label: 'Northern Territory', className: 'State-NT' }];
-
-exports.US = [{ value: 'AL', label: 'Alabama', disabled: true }, { value: 'AK', label: 'Alaska' }, { value: 'AS', label: 'American Samoa' }, { value: 'AZ', label: 'Arizona' }, { value: 'AR', label: 'Arkansas' }, { value: 'CA', label: 'California' }, { value: 'CO', label: 'Colorado' }, { value: 'CT', label: 'Connecticut' }, { value: 'DE', label: 'Delaware' }, { value: 'DC', label: 'District Of Columbia' }, { value: 'FM', label: 'Federated States Of Micronesia' }, { value: 'FL', label: 'Florida' }, { value: 'GA', label: 'Georgia' }, { value: 'GU', label: 'Guam' }, { value: 'HI', label: 'Hawaii' }, { value: 'ID', label: 'Idaho' }, { value: 'IL', label: 'Illinois' }, { value: 'IN', label: 'Indiana' }, { value: 'IA', label: 'Iowa' }, { value: 'KS', label: 'Kansas' }, { value: 'KY', label: 'Kentucky' }, { value: 'LA', label: 'Louisiana' }, { value: 'ME', label: 'Maine' }, { value: 'MH', label: 'Marshall Islands' }, { value: 'MD', label: 'Maryland' }, { value: 'MA', label: 'Massachusetts' }, { value: 'MI', label: 'Michigan' }, { value: 'MN', label: 'Minnesota' }, { value: 'MS', label: 'Mississippi' }, { value: 'MO', label: 'Missouri' }, { value: 'MT', label: 'Montana' }, { value: 'NE', label: 'Nebraska' }, { value: 'NV', label: 'Nevada' }, { value: 'NH', label: 'New Hampshire' }, { value: 'NJ', label: 'New Jersey' }, { value: 'NM', label: 'New Mexico' }, { value: 'NY', label: 'New York' }, { value: 'NC', label: 'North Carolina' }, { value: 'ND', label: 'North Dakota' }, { value: 'MP', label: 'Northern Mariana Islands' }, { value: 'OH', label: 'Ohio' }, { value: 'OK', label: 'Oklahoma' }, { value: 'OR', label: 'Oregon' }, { value: 'PW', label: 'Palau' }, { value: 'PA', label: 'Pennsylvania' }, { value: 'PR', label: 'Puerto Rico' }, { value: 'RI', label: 'Rhode Island' }, { value: 'SC', label: 'South Carolina' }, { value: 'SD', label: 'South Dakota' }, { value: 'TN', label: 'Tennessee' }, { value: 'TX', label: 'Texas' }, { value: 'UT', label: 'Utah' }, { value: 'VT', label: 'Vermont' }, { value: 'VI', label: 'Virgin Islands' }, { value: 'VA', label: 'Virginia' }, { value: 'WA', label: 'Washington' }, { value: 'WV', label: 'West Virginia' }, { value: 'WI', label: 'Wisconsin' }, { value: 'WY', label: 'Wyoming' }];
-
-},{}],10:[function(require,module,exports){
-'use strict';
-
-module.exports = [{ value: 'John Smith', label: 'John Smith', email: 'john@smith.com' }, { value: 'Merry Jane', label: 'Merry Jane', email: 'merry@jane.com' }, { value: 'Stan Hoper', label: 'Stan Hoper', email: 'stan@hoper.com' }];
-
-},{}],11:[function(require,module,exports){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-'use strict';
-
-// If obj.hasOwnProperty has been overridden, then calling
-// obj.hasOwnProperty(prop) will break.
-// See: https://github.com/joyent/node/issues/1707
-function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
-}
-
-module.exports = function(qs, sep, eq, options) {
- sep = sep || '&';
- eq = eq || '=';
- var obj = {};
-
- if (typeof qs !== 'string' || qs.length === 0) {
- return obj;
- }
-
- var regexp = /\+/g;
- qs = qs.split(sep);
-
- var maxKeys = 1000;
- if (options && typeof options.maxKeys === 'number') {
- maxKeys = options.maxKeys;
- }
-
- var len = qs.length;
- // maxKeys <= 0 means that we should not limit keys count
- if (maxKeys > 0 && len > maxKeys) {
- len = maxKeys;
- }
-
- for (var i = 0; i < len; ++i) {
- var x = qs[i].replace(regexp, '%20'),
- idx = x.indexOf(eq),
- kstr, vstr, k, v;
-
- if (idx >= 0) {
- kstr = x.substr(0, idx);
- vstr = x.substr(idx + 1);
- } else {
- kstr = x;
- vstr = '';
- }
-
- k = decodeURIComponent(kstr);
- v = decodeURIComponent(vstr);
-
- if (!hasOwnProperty(obj, k)) {
- obj[k] = v;
- } else if (isArray(obj[k])) {
- obj[k].push(v);
- } else {
- obj[k] = [obj[k], v];
- }
- }
-
- return obj;
-};
-
-var isArray = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === '[object Array]';
-};
-
-},{}],12:[function(require,module,exports){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-'use strict';
-
-var stringifyPrimitive = function(v) {
- switch (typeof v) {
- case 'string':
- return v;
-
- case 'boolean':
- return v ? 'true' : 'false';
-
- case 'number':
- return isFinite(v) ? v : '';
-
- default:
- return '';
- }
-};
-
-module.exports = function(obj, sep, eq, name) {
- sep = sep || '&';
- eq = eq || '=';
- if (obj === null) {
- obj = undefined;
- }
-
- if (typeof obj === 'object') {
- return map(objectKeys(obj), function(k) {
- var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
- if (isArray(obj[k])) {
- return map(obj[k], function(v) {
- return ks + encodeURIComponent(stringifyPrimitive(v));
- }).join(sep);
- } else {
- return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
- }
- }).join(sep);
-
- }
-
- if (!name) return '';
- return encodeURIComponent(stringifyPrimitive(name)) + eq +
- encodeURIComponent(stringifyPrimitive(obj));
-};
-
-var isArray = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === '[object Array]';
-};
-
-function map (xs, f) {
- if (xs.map) return xs.map(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- res.push(f(xs[i], i));
- }
- return res;
-}
-
-var objectKeys = Object.keys || function (obj) {
- var res = [];
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
- }
- return res;
-};
-
-},{}],13:[function(require,module,exports){
-'use strict';
-
-exports.decode = exports.parse = require('./decode');
-exports.encode = exports.stringify = require('./encode');
-
-},{"./decode":11,"./encode":12}],14:[function(require,module,exports){
-// Generated by CoffeeScript 1.10.0
-var React, isRetina, md5, querystring;
-
-React = require('react');
-
-md5 = require('md5');
-
-querystring = require('querystring');
-
-isRetina = require('is-retina');
-
-module.exports = React.createClass({
- displayName: 'Gravatar',
- propTypes: {
- email: React.PropTypes.string,
- md5: React.PropTypes.string,
- size: React.PropTypes.number,
- rating: React.PropTypes.string,
- https: React.PropTypes.bool,
- "default": React.PropTypes.string,
- className: React.PropTypes.string
- },
- getDefaultProps: function() {
- return {
- size: 50,
- rating: 'g',
- https: false,
- "default": "retro",
- className: ""
- };
- },
- render: function() {
- var base, hash, modernBrowser, query, retinaQuery, retinaSrc, src;
- base = this.props.https ? "https://secure.gravatar.com/avatar/" : 'http://www.gravatar.com/avatar/';
- query = querystring.stringify({
- s: this.props.size,
- r: this.props.rating,
- d: this.props["default"]
- });
- retinaQuery = querystring.stringify({
- s: this.props.size * 2,
- r: this.props.rating,
- d: this.props["default"]
- });
- if (this.props.md5) {
- hash = this.props.md5;
- } else if (this.props.email) {
- hash = md5(this.props.email);
- } else {
- console.warn('Gravatar image can not be fetched. Either the "email" or "md5" prop must be specified.');
- return React.createElement("script", null);
- }
- src = base + hash + "?" + query;
- retinaSrc = base + hash + "?" + retinaQuery;
- modernBrowser = true;
- if (typeof window !== "undefined" && window !== null) {
- modernBrowser = 'srcset' in document.createElement('img');
- }
- if (!modernBrowser && isRetina()) {
- return React.createElement("img", React.__spread({
- "style": this.props.style,
- "className": "react-gravatar " + this.props.className,
- "src": retinaSrc,
- "height": this.props.size,
- "width": this.props.size
- }, this.props));
- } else {
- return React.createElement("img", React.__spread({
- "style": this.props.style,
- "className": "react-gravatar " + this.props.className,
- "src": src,
- "srcSet": retinaSrc + " 2x",
- "height": this.props.size,
- "width": this.props.size
- }, this.props));
- }
- }
-});
-
-},{"is-retina":15,"md5":16,"querystring":13,"react":undefined}],15:[function(require,module,exports){
-module.exports = function() {
- var mediaQuery;
- if (typeof window !== "undefined" && window !== null) {
- mediaQuery = "(-webkit-min-device-pixel-ratio: 1.25), (min--moz-device-pixel-ratio: 1.25), (-o-min-device-pixel-ratio: 5/4), (min-resolution: 1.25dppx)";
- if (window.devicePixelRatio > 1.25) {
- return true;
- }
- if (window.matchMedia && window.matchMedia(mediaQuery).matches) {
- return true;
- }
- }
- return false;
-};
-
-},{}],16:[function(require,module,exports){
-(function(){
- var crypt = require('crypt'),
- utf8 = require('charenc').utf8,
- isBuffer = require('is-buffer'),
- bin = require('charenc').bin,
-
- // The core
- md5 = function (message, options) {
- // Convert to byte array
- if (message.constructor == String)
- if (options && options.encoding === 'binary')
- message = bin.stringToBytes(message);
- else
- message = utf8.stringToBytes(message);
- else if (isBuffer(message))
- message = Array.prototype.slice.call(message, 0);
- else if (!Array.isArray(message))
- message = message.toString();
- // else, assume byte array already
-
- var m = crypt.bytesToWords(message),
- l = message.length * 8,
- a = 1732584193,
- b = -271733879,
- c = -1732584194,
- d = 271733878;
-
- // Swap endian
- for (var i = 0; i < m.length; i++) {
- m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
- ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
- }
-
- // Padding
- m[l >>> 5] |= 0x80 << (l % 32);
- m[(((l + 64) >>> 9) << 4) + 14] = l;
-
- // Method shortcuts
- var FF = md5._ff,
- GG = md5._gg,
- HH = md5._hh,
- II = md5._ii;
-
- for (var i = 0; i < m.length; i += 16) {
-
- var aa = a,
- bb = b,
- cc = c,
- dd = d;
-
- a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
- d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
- c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
- b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
- a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
- d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
- c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
- b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
- a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
- d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
- c = FF(c, d, a, b, m[i+10], 17, -42063);
- b = FF(b, c, d, a, m[i+11], 22, -1990404162);
- a = FF(a, b, c, d, m[i+12], 7, 1804603682);
- d = FF(d, a, b, c, m[i+13], 12, -40341101);
- c = FF(c, d, a, b, m[i+14], 17, -1502002290);
- b = FF(b, c, d, a, m[i+15], 22, 1236535329);
-
- a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
- d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
- c = GG(c, d, a, b, m[i+11], 14, 643717713);
- b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
- a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
- d = GG(d, a, b, c, m[i+10], 9, 38016083);
- c = GG(c, d, a, b, m[i+15], 14, -660478335);
- b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
- a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
- d = GG(d, a, b, c, m[i+14], 9, -1019803690);
- c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
- b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
- a = GG(a, b, c, d, m[i+13], 5, -1444681467);
- d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
- c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
- b = GG(b, c, d, a, m[i+12], 20, -1926607734);
-
- a = HH(a, b, c, d, m[i+ 5], 4, -378558);
- d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
- c = HH(c, d, a, b, m[i+11], 16, 1839030562);
- b = HH(b, c, d, a, m[i+14], 23, -35309556);
- a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
- d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
- c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
- b = HH(b, c, d, a, m[i+10], 23, -1094730640);
- a = HH(a, b, c, d, m[i+13], 4, 681279174);
- d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
- c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
- b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
- a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
- d = HH(d, a, b, c, m[i+12], 11, -421815835);
- c = HH(c, d, a, b, m[i+15], 16, 530742520);
- b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
-
- a = II(a, b, c, d, m[i+ 0], 6, -198630844);
- d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
- c = II(c, d, a, b, m[i+14], 15, -1416354905);
- b = II(b, c, d, a, m[i+ 5], 21, -57434055);
- a = II(a, b, c, d, m[i+12], 6, 1700485571);
- d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
- c = II(c, d, a, b, m[i+10], 15, -1051523);
- b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
- a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
- d = II(d, a, b, c, m[i+15], 10, -30611744);
- c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
- b = II(b, c, d, a, m[i+13], 21, 1309151649);
- a = II(a, b, c, d, m[i+ 4], 6, -145523070);
- d = II(d, a, b, c, m[i+11], 10, -1120210379);
- c = II(c, d, a, b, m[i+ 2], 15, 718787259);
- b = II(b, c, d, a, m[i+ 9], 21, -343485551);
-
- a = (a + aa) >>> 0;
- b = (b + bb) >>> 0;
- c = (c + cc) >>> 0;
- d = (d + dd) >>> 0;
- }
-
- return crypt.endian([a, b, c, d]);
- };
-
- // Auxiliary functions
- md5._ff = function (a, b, c, d, x, s, t) {
- var n = a + (b & c | ~b & d) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
- md5._gg = function (a, b, c, d, x, s, t) {
- var n = a + (b & d | c & ~d) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
- md5._hh = function (a, b, c, d, x, s, t) {
- var n = a + (b ^ c ^ d) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
- md5._ii = function (a, b, c, d, x, s, t) {
- var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- };
-
- // Package private blocksize
- md5._blocksize = 16;
- md5._digestsize = 16;
-
- module.exports = function (message, options) {
- if(typeof message == 'undefined')
- return;
-
- var digestbytes = crypt.wordsToBytes(md5(message, options));
- return options && options.asBytes ? digestbytes :
- options && options.asString ? bin.bytesToString(digestbytes) :
- crypt.bytesToHex(digestbytes);
- };
-
-})();
-
-},{"charenc":17,"crypt":18,"is-buffer":19}],17:[function(require,module,exports){
-var charenc = {
- // UTF-8 encoding
- utf8: {
- // Convert a string to a byte array
- stringToBytes: function(str) {
- return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
- },
-
- // Convert a byte array to a string
- bytesToString: function(bytes) {
- return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
- }
- },
-
- // Binary encoding
- bin: {
- // Convert a string to a byte array
- stringToBytes: function(str) {
- for (var bytes = [], i = 0; i < str.length; i++)
- bytes.push(str.charCodeAt(i) & 0xFF);
- return bytes;
- },
-
- // Convert a byte array to a string
- bytesToString: function(bytes) {
- for (var str = [], i = 0; i < bytes.length; i++)
- str.push(String.fromCharCode(bytes[i]));
- return str.join('');
- }
- }
-};
-
-module.exports = charenc;
-
-},{}],18:[function(require,module,exports){
-(function() {
- var base64map
- = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
-
- crypt = {
- // Bit-wise rotation left
- rotl: function(n, b) {
- return (n << b) | (n >>> (32 - b));
- },
-
- // Bit-wise rotation right
- rotr: function(n, b) {
- return (n << (32 - b)) | (n >>> b);
- },
-
- // Swap big-endian to little-endian and vice versa
- endian: function(n) {
- // If number given, swap endian
- if (n.constructor == Number) {
- return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
- }
-
- // Else, assume array and swap all items
- for (var i = 0; i < n.length; i++)
- n[i] = crypt.endian(n[i]);
- return n;
- },
-
- // Generate an array of any length of random bytes
- randomBytes: function(n) {
- for (var bytes = []; n > 0; n--)
- bytes.push(Math.floor(Math.random() * 256));
- return bytes;
- },
-
- // Convert a byte array to big-endian 32-bit words
- bytesToWords: function(bytes) {
- for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
- words[b >>> 5] |= bytes[i] << (24 - b % 32);
- return words;
- },
-
- // Convert big-endian 32-bit words to a byte array
- wordsToBytes: function(words) {
- for (var bytes = [], b = 0; b < words.length * 32; b += 8)
- bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
- return bytes;
- },
-
- // Convert a byte array to a hex string
- bytesToHex: function(bytes) {
- for (var hex = [], i = 0; i < bytes.length; i++) {
- hex.push((bytes[i] >>> 4).toString(16));
- hex.push((bytes[i] & 0xF).toString(16));
- }
- return hex.join('');
- },
-
- // Convert a hex string to a byte array
- hexToBytes: function(hex) {
- for (var bytes = [], c = 0; c < hex.length; c += 2)
- bytes.push(parseInt(hex.substr(c, 2), 16));
- return bytes;
- },
-
- // Convert a byte array to a base-64 string
- bytesToBase64: function(bytes) {
- for (var base64 = [], i = 0; i < bytes.length; i += 3) {
- var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
- for (var j = 0; j < 4; j++)
- if (i * 8 + j * 6 <= bytes.length * 8)
- base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
- else
- base64.push('=');
- }
- return base64.join('');
- },
-
- // Convert a base-64 string to a byte array
- base64ToBytes: function(base64) {
- // Remove non-base-64 characters
- base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
-
- for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
- imod4 = ++i % 4) {
- if (imod4 == 0) continue;
- bytes.push(((base64map.indexOf(base64.charAt(i - 1))
- & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
- | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
- }
- return bytes;
- }
- };
-
- module.exports = crypt;
-})();
-
-},{}],19:[function(require,module,exports){
-/**
- * Determine if an object is Buffer
- *
- * Author: Feross Aboukhadijeh
- * License: MIT
- *
- * `npm install is-buffer`
- */
-
-module.exports = function (obj) {
- return !!(
- obj != null &&
- obj.constructor &&
- typeof obj.constructor.isBuffer === 'function' &&
- obj.constructor.isBuffer(obj)
- )
-}
-
-},{}]},{},[1]);
diff --git a/examples/dist/bundle.js b/examples/dist/bundle.js
deleted file mode 100644
index e7955badc0..0000000000
--- a/examples/dist/bundle.js
+++ /dev/null
@@ -1,1246 +0,0 @@
-require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0; --i) {
- var cacheKey = input.slice(0, i);
- if (cache[cacheKey] && (input === cacheKey || cache[cacheKey].complete)) {
- return cache[cacheKey];
- }
- }
-}
-
-function thenPromise(promise, callback) {
- if (!promise || typeof promise.then !== 'function') return;
- return promise.then(function (data) {
- callback(null, data);
- }, function (err) {
- callback(err);
- });
-}
-
-var stringOrNode = _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]);
-
-var Async = _react2['default'].createClass({
- displayName: 'Async',
-
- propTypes: {
- cache: _react2['default'].PropTypes.any, // object to use to cache results, can be null to disable cache
- ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering (shared with Select)
- ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering (shared with Select)
- isLoading: _react2['default'].PropTypes.bool, // overrides the isLoading state when set to true
- loadOptions: _react2['default'].PropTypes.func.isRequired, // function to call to load options asynchronously
- loadingPlaceholder: _react2['default'].PropTypes.string, // replaces the placeholder while options are loading
- minimumInput: _react2['default'].PropTypes.number, // the minimum number of characters that trigger loadOptions
- noResultsText: _react2['default'].PropTypes.string, // placeholder displayed when there are no matching search results (shared with Select)
- placeholder: stringOrNode, // field placeholder, displayed when there's no value (shared with Select)
- searchPromptText: _react2['default'].PropTypes.string, // label to prompt for search input
- searchingText: _react2['default'].PropTypes.string },
- // message to display while options are loading
- getDefaultProps: function getDefaultProps() {
- return {
- cache: true,
- ignoreAccents: true,
- ignoreCase: true,
- loadingPlaceholder: 'Loading...',
- minimumInput: 0,
- searchingText: 'Searching...',
- searchPromptText: 'Type to search'
- };
- },
- getInitialState: function getInitialState() {
- return {
- cache: initCache(this.props.cache),
- isLoading: false,
- options: []
- };
- },
- componentWillMount: function componentWillMount() {
- this._lastInput = '';
- },
- componentDidMount: function componentDidMount() {
- this.loadOptions('');
- },
- componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
- if (nextProps.cache !== this.props.cache) {
- this.setState({
- cache: initCache(nextProps.cache)
- });
- }
- },
- focus: function focus() {
- this.refs.select.focus();
- },
- resetState: function resetState() {
- this._currentRequestId = -1;
- this.setState({
- isLoading: false,
- options: []
- });
- },
- getResponseHandler: function getResponseHandler(input) {
- var _this = this;
-
- var _requestId = this._currentRequestId = requestId++;
- return function (err, data) {
- if (err) throw err;
- if (!_this.isMounted()) return;
- updateCache(_this.state.cache, input, data);
- if (_requestId !== _this._currentRequestId) return;
- _this.setState({
- isLoading: false,
- options: data && data.options || []
- });
- };
- },
- loadOptions: function loadOptions(input) {
- if (this.props.ignoreAccents) input = (0, _utilsStripDiacritics2['default'])(input);
- if (this.props.ignoreCase) input = input.toLowerCase();
- this._lastInput = input;
- if (input.length < this.props.minimumInput) {
- return this.resetState();
- }
- var cacheResult = getFromCache(this.state.cache, input);
- if (cacheResult) {
- return this.setState({
- options: cacheResult.options
- });
- }
- this.setState({
- isLoading: true
- });
- var responseHandler = this.getResponseHandler(input);
- return thenPromise(this.props.loadOptions(input, responseHandler), responseHandler);
- },
- render: function render() {
- var noResultsText = this.props.noResultsText;
- var _state = this.state;
- var isLoading = _state.isLoading;
- var options = _state.options;
-
- if (this.props.isLoading) isLoading = true;
- var placeholder = isLoading ? this.props.loadingPlaceholder : this.props.placeholder;
- if (!options.length) {
- if (this._lastInput.length < this.props.minimumInput) noResultsText = this.props.searchPromptText;
- if (isLoading) noResultsText = this.props.searchingText;
- }
- return _react2['default'].createElement(_Select2['default'], _extends({}, this.props, {
- ref: 'select',
- isLoading: isLoading,
- noResultsText: noResultsText,
- onInputChange: this.loadOptions,
- options: options,
- placeholder: placeholder
- }));
- }
-});
-
-module.exports = Async;
-
-},{"./Select":"react-select","./utils/stripDiacritics":4,"react":undefined}],2:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _classnames = require('classnames');
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var Option = _react2['default'].createClass({
- displayName: 'Option',
-
- propTypes: {
- children: _react2['default'].PropTypes.node,
- className: _react2['default'].PropTypes.string, // className (based on mouse position)
- isDisabled: _react2['default'].PropTypes.bool, // the option is disabled
- isFocused: _react2['default'].PropTypes.bool, // the option is focused
- isSelected: _react2['default'].PropTypes.bool, // the option is selected
- onFocus: _react2['default'].PropTypes.func, // method to handle mouseEnter on option element
- onSelect: _react2['default'].PropTypes.func, // method to handle click on option element
- onUnfocus: _react2['default'].PropTypes.func, // method to handle mouseLeave on option element
- option: _react2['default'].PropTypes.object.isRequired },
- // object that is base for that option
- blockEvent: function blockEvent(event) {
- event.preventDefault();
- event.stopPropagation();
- if (event.target.tagName !== 'A' || !('href' in event.target)) {
- return;
- }
- if (event.target.target) {
- window.open(event.target.href, event.target.target);
- } else {
- window.location.href = event.target.href;
- }
- },
-
- handleMouseDown: function handleMouseDown(event) {
- event.preventDefault();
- event.stopPropagation();
- this.props.onSelect(this.props.option, event);
- },
-
- handleMouseEnter: function handleMouseEnter(event) {
- this.onFocus(event);
- },
-
- handleMouseMove: function handleMouseMove(event) {
- this.onFocus(event);
- },
-
- handleTouchEnd: function handleTouchEnd(event) {
- // Check if the view is being dragged, In this case
- // we don't want to fire the click event (because the user only wants to scroll)
- if (this.dragging) return;
-
- this.handleMouseDown(event);
- },
-
- handleTouchMove: function handleTouchMove(event) {
- // Set a flag that the view is being dragged
- this.dragging = true;
- },
-
- handleTouchStart: function handleTouchStart(event) {
- // Set a flag that the view is not being dragged
- this.dragging = false;
- },
-
- onFocus: function onFocus(event) {
- if (!this.props.isFocused) {
- this.props.onFocus(this.props.option, event);
- }
- },
- render: function render() {
- var option = this.props.option;
-
- var className = (0, _classnames2['default'])(this.props.className, option.className);
-
- return option.disabled ? _react2['default'].createElement(
- 'div',
- { className: className,
- onMouseDown: this.blockEvent,
- onClick: this.blockEvent },
- this.props.children
- ) : _react2['default'].createElement(
- 'div',
- { className: className,
- style: option.style,
- onMouseDown: this.handleMouseDown,
- onMouseEnter: this.handleMouseEnter,
- onMouseMove: this.handleMouseMove,
- onTouchStart: this.handleTouchStart,
- onTouchMove: this.handleTouchMove,
- onTouchEnd: this.handleTouchEnd,
- title: option.title },
- this.props.children
- );
- }
-});
-
-module.exports = Option;
-
-},{"classnames":undefined,"react":undefined}],3:[function(require,module,exports){
-'use strict';
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _classnames = require('classnames');
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var Value = _react2['default'].createClass({
-
- displayName: 'Value',
-
- propTypes: {
- children: _react2['default'].PropTypes.node,
- disabled: _react2['default'].PropTypes.bool, // disabled prop passed to ReactSelect
- onClick: _react2['default'].PropTypes.func, // method to handle click on value label
- onRemove: _react2['default'].PropTypes.func, // method to handle removal of the value
- value: _react2['default'].PropTypes.object.isRequired },
-
- // the option object for this value
- handleMouseDown: function handleMouseDown(event) {
- if (event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- if (this.props.onClick) {
- event.stopPropagation();
- this.props.onClick(this.props.value, event);
- return;
- }
- if (this.props.value.href) {
- event.stopPropagation();
- }
- },
-
- onRemove: function onRemove(event) {
- event.preventDefault();
- event.stopPropagation();
- this.props.onRemove(this.props.value);
- },
-
- handleTouchEndRemove: function handleTouchEndRemove(event) {
- // Check if the view is being dragged, In this case
- // we don't want to fire the click event (because the user only wants to scroll)
- if (this.dragging) return;
-
- // Fire the mouse events
- this.onRemove(event);
- },
-
- handleTouchMove: function handleTouchMove(event) {
- // Set a flag that the view is being dragged
- this.dragging = true;
- },
-
- handleTouchStart: function handleTouchStart(event) {
- // Set a flag that the view is not being dragged
- this.dragging = false;
- },
-
- renderRemoveIcon: function renderRemoveIcon() {
- if (this.props.disabled || !this.props.onRemove) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-value-icon',
- onMouseDown: this.onRemove,
- onTouchEnd: this.handleTouchEndRemove,
- onTouchStart: this.handleTouchStart,
- onTouchMove: this.handleTouchMove },
- '×'
- );
- },
-
- renderLabel: function renderLabel() {
- var className = 'Select-value-label';
- return this.props.onClick || this.props.value.href ? _react2['default'].createElement(
- 'a',
- { className: className, href: this.props.value.href, target: this.props.value.target, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
- this.props.children
- ) : _react2['default'].createElement(
- 'span',
- { className: className },
- this.props.children
- );
- },
-
- render: function render() {
- return _react2['default'].createElement(
- 'div',
- { className: (0, _classnames2['default'])('Select-value', this.props.value.className),
- style: this.props.value.style,
- title: this.props.value.title
- },
- this.renderRemoveIcon(),
- this.renderLabel()
- );
- }
-
-});
-
-module.exports = Value;
-
-},{"classnames":undefined,"react":undefined}],4:[function(require,module,exports){
-'use strict';
-
-var map = [{ 'base': 'A', 'letters': /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g }, { 'base': 'AA', 'letters': /[\uA732]/g }, { 'base': 'AE', 'letters': /[\u00C6\u01FC\u01E2]/g }, { 'base': 'AO', 'letters': /[\uA734]/g }, { 'base': 'AU', 'letters': /[\uA736]/g }, { 'base': 'AV', 'letters': /[\uA738\uA73A]/g }, { 'base': 'AY', 'letters': /[\uA73C]/g }, { 'base': 'B', 'letters': /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g }, { 'base': 'C', 'letters': /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g }, { 'base': 'D', 'letters': /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g }, { 'base': 'DZ', 'letters': /[\u01F1\u01C4]/g }, { 'base': 'Dz', 'letters': /[\u01F2\u01C5]/g }, { 'base': 'E', 'letters': /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g }, { 'base': 'F', 'letters': /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g }, { 'base': 'G', 'letters': /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g }, { 'base': 'H', 'letters': /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g }, { 'base': 'I', 'letters': /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g }, { 'base': 'J', 'letters': /[\u004A\u24BF\uFF2A\u0134\u0248]/g }, { 'base': 'K', 'letters': /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g }, { 'base': 'L', 'letters': /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g }, { 'base': 'LJ', 'letters': /[\u01C7]/g }, { 'base': 'Lj', 'letters': /[\u01C8]/g }, { 'base': 'M', 'letters': /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g }, { 'base': 'N', 'letters': /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g }, { 'base': 'NJ', 'letters': /[\u01CA]/g }, { 'base': 'Nj', 'letters': /[\u01CB]/g }, { 'base': 'O', 'letters': /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g }, { 'base': 'OI', 'letters': /[\u01A2]/g }, { 'base': 'OO', 'letters': /[\uA74E]/g }, { 'base': 'OU', 'letters': /[\u0222]/g }, { 'base': 'P', 'letters': /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g }, { 'base': 'Q', 'letters': /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g }, { 'base': 'R', 'letters': /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g }, { 'base': 'S', 'letters': /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g }, { 'base': 'T', 'letters': /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g }, { 'base': 'TZ', 'letters': /[\uA728]/g }, { 'base': 'U', 'letters': /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g }, { 'base': 'V', 'letters': /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g }, { 'base': 'VY', 'letters': /[\uA760]/g }, { 'base': 'W', 'letters': /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g }, { 'base': 'X', 'letters': /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g }, { 'base': 'Y', 'letters': /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g }, { 'base': 'Z', 'letters': /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g }, { 'base': 'a', 'letters': /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g }, { 'base': 'aa', 'letters': /[\uA733]/g }, { 'base': 'ae', 'letters': /[\u00E6\u01FD\u01E3]/g }, { 'base': 'ao', 'letters': /[\uA735]/g }, { 'base': 'au', 'letters': /[\uA737]/g }, { 'base': 'av', 'letters': /[\uA739\uA73B]/g }, { 'base': 'ay', 'letters': /[\uA73D]/g }, { 'base': 'b', 'letters': /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g }, { 'base': 'c', 'letters': /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g }, { 'base': 'd', 'letters': /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g }, { 'base': 'dz', 'letters': /[\u01F3\u01C6]/g }, { 'base': 'e', 'letters': /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g }, { 'base': 'f', 'letters': /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g }, { 'base': 'g', 'letters': /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g }, { 'base': 'h', 'letters': /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g }, { 'base': 'hv', 'letters': /[\u0195]/g }, { 'base': 'i', 'letters': /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g }, { 'base': 'j', 'letters': /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g }, { 'base': 'k', 'letters': /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g }, { 'base': 'l', 'letters': /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g }, { 'base': 'lj', 'letters': /[\u01C9]/g }, { 'base': 'm', 'letters': /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g }, { 'base': 'n', 'letters': /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g }, { 'base': 'nj', 'letters': /[\u01CC]/g }, { 'base': 'o', 'letters': /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g }, { 'base': 'oi', 'letters': /[\u01A3]/g }, { 'base': 'ou', 'letters': /[\u0223]/g }, { 'base': 'oo', 'letters': /[\uA74F]/g }, { 'base': 'p', 'letters': /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g }, { 'base': 'q', 'letters': /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g }, { 'base': 'r', 'letters': /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g }, { 'base': 's', 'letters': /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g }, { 'base': 't', 'letters': /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g }, { 'base': 'tz', 'letters': /[\uA729]/g }, { 'base': 'u', 'letters': /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g }, { 'base': 'v', 'letters': /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g }, { 'base': 'vy', 'letters': /[\uA761]/g }, { 'base': 'w', 'letters': /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g }, { 'base': 'x', 'letters': /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g }, { 'base': 'y', 'letters': /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g }, { 'base': 'z', 'letters': /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g }];
-
-module.exports = function stripDiacritics(str) {
- for (var i = 0; i < map.length; i++) {
- str = str.replace(map[i].letters, map[i].base);
- }
- return str;
-};
-
-},{}],"react-select":[function(require,module,exports){
-'use strict';
-
-Object.defineProperty(exports, '__esModule', {
- value: true
-});
-
-var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-var _react = require('react');
-
-var _react2 = _interopRequireDefault(_react);
-
-var _reactDom = require('react-dom');
-
-var _reactDom2 = _interopRequireDefault(_reactDom);
-
-var _reactInputAutosize = require('react-input-autosize');
-
-var _reactInputAutosize2 = _interopRequireDefault(_reactInputAutosize);
-
-var _classnames = require('classnames');
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var _utilsStripDiacritics = require('./utils/stripDiacritics');
-
-var _utilsStripDiacritics2 = _interopRequireDefault(_utilsStripDiacritics);
-
-var _Async = require('./Async');
-
-var _Async2 = _interopRequireDefault(_Async);
-
-var _Option = require('./Option');
-
-var _Option2 = _interopRequireDefault(_Option);
-
-var _Value = require('./Value');
-
-var _Value2 = _interopRequireDefault(_Value);
-
-function stringifyValue(value) {
- if (typeof value === 'object') {
- return JSON.stringify(value);
- } else {
- return value;
- }
-}
-
-var stringOrNode = _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]);
-
-var Select = _react2['default'].createClass({
-
- displayName: 'Select',
-
- propTypes: {
- addLabelText: _react2['default'].PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input
- allowCreate: _react2['default'].PropTypes.bool, // whether to allow creation of new entries
- autoBlur: _react2['default'].PropTypes.bool,
- autofocus: _react2['default'].PropTypes.bool, // autofocus the component on mount
- backspaceRemoves: _react2['default'].PropTypes.bool, // whether backspace removes an item if there is no text input
- className: _react2['default'].PropTypes.string, // className for the outer element
- clearAllText: stringOrNode, // title for the "clear" control when multi: true
- clearValueText: stringOrNode, // title for the "clear" control
- clearable: _react2['default'].PropTypes.bool, // should it be possible to reset value
- delimiter: _react2['default'].PropTypes.string, // delimiter to use to join multiple values for the hidden field value
- disabled: _react2['default'].PropTypes.bool, // whether the Select is disabled or not
- escapeClearsValue: _react2['default'].PropTypes.bool, // whether escape clears the value when the menu is closed
- filterOption: _react2['default'].PropTypes.func, // method to filter a single option (option, filterString)
- filterOptions: _react2['default'].PropTypes.any, // boolean to enable default filtering or function to filter the options array ([options], filterString, [values])
- ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering
- ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering
- inputProps: _react2['default'].PropTypes.object, // custom attributes for the Input
- isLoading: _react2['default'].PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
- labelKey: _react2['default'].PropTypes.string, // path of the label value in option objects
- matchPos: _react2['default'].PropTypes.string, // (any|start) match the start or entire string when filtering
- matchProp: _react2['default'].PropTypes.string, // (any|label|value) which option property to filter on
- menuBuffer: _react2['default'].PropTypes.number, // optional buffer (in px) between the bottom of the viewport and the bottom of the menu
- menuContainerStyle: _react2['default'].PropTypes.object, // optional style to apply to the menu container
- menuStyle: _react2['default'].PropTypes.object, // optional style to apply to the menu
- multi: _react2['default'].PropTypes.bool, // multi-value input
- name: _react2['default'].PropTypes.string, // generates a hidden tag with this field name for html forms
- newOptionCreator: _react2['default'].PropTypes.func, // factory to create new options when allowCreate set
- noResultsText: stringOrNode, // placeholder displayed when there are no matching search results
- onBlur: _react2['default'].PropTypes.func, // onBlur handler: function (event) {}
- onBlurResetsInput: _react2['default'].PropTypes.bool, // whether input is cleared on blur
- onChange: _react2['default'].PropTypes.func, // onChange handler: function (newValue) {}
- onClose: _react2['default'].PropTypes.func, // fires when the menu is closed
- onFocus: _react2['default'].PropTypes.func, // onFocus handler: function (event) {}
- onInputChange: _react2['default'].PropTypes.func, // onInputChange handler: function (inputValue) {}
- onMenuScrollToBottom: _react2['default'].PropTypes.func, // fires when the menu is scrolled to the bottom; can be used to paginate options
- onOpen: _react2['default'].PropTypes.func, // fires when the menu is opened
- onValueClick: _react2['default'].PropTypes.func, // onClick handler for value labels: function (value, event) {}
- optionComponent: _react2['default'].PropTypes.func, // option component to render in dropdown
- optionRenderer: _react2['default'].PropTypes.func, // optionRenderer: function (option) {}
- options: _react2['default'].PropTypes.array, // array of options
- placeholder: stringOrNode, // field placeholder, displayed when there's no value
- required: _react2['default'].PropTypes.bool, // applies HTML5 required attribute when needed
- scrollMenuIntoView: _react2['default'].PropTypes.bool, // boolean to enable the viewport to shift so that the full menu fully visible when engaged
- searchable: _react2['default'].PropTypes.bool, // whether to enable searching feature or not
- simpleValue: _react2['default'].PropTypes.bool, // pass the value to onChange as a simple value (legacy pre 1.0 mode), defaults to false
- style: _react2['default'].PropTypes.object, // optional style to apply to the control
- tabIndex: _react2['default'].PropTypes.string, // optional tab index of the control
- value: _react2['default'].PropTypes.any, // initial field value
- valueComponent: _react2['default'].PropTypes.func, // value component to render
- valueKey: _react2['default'].PropTypes.string, // path of the label value in option objects
- valueRenderer: _react2['default'].PropTypes.func, // valueRenderer: function (option) {}
- wrapperStyle: _react2['default'].PropTypes.object },
-
- // optional style to apply to the component wrapper
- statics: { Async: _Async2['default'] },
-
- getDefaultProps: function getDefaultProps() {
- return {
- addLabelText: 'Add "{label}"?',
- allowCreate: false,
- backspaceRemoves: true,
- clearable: true,
- clearAllText: 'Clear all',
- clearValueText: 'Clear value',
- delimiter: ',',
- disabled: false,
- escapeClearsValue: true,
- filterOptions: true,
- ignoreAccents: true,
- ignoreCase: true,
- inputProps: {},
- isLoading: false,
- labelKey: 'label',
- matchPos: 'any',
- matchProp: 'any',
- menuBuffer: 0,
- multi: false,
- noResultsText: 'No results found',
- onBlurResetsInput: true,
- optionComponent: _Option2['default'],
- placeholder: 'Select...',
- required: false,
- scrollMenuIntoView: true,
- searchable: true,
- simpleValue: false,
- valueComponent: _Value2['default'],
- valueKey: 'value'
- };
- },
-
- getInitialState: function getInitialState() {
- return {
- inputValue: '',
- isFocused: false,
- isLoading: false,
- isOpen: false,
- isPseudoFocused: false,
- required: this.props.required && this.handleRequired(this.props.value, this.props.multi)
- };
- },
-
- componentDidMount: function componentDidMount() {
- if (this.props.autofocus) {
- this.focus();
- }
- },
-
- componentWillUpdate: function componentWillUpdate(nextProps, nextState) {
- if (nextState.isOpen !== this.state.isOpen) {
- var handler = nextState.isOpen ? nextProps.onOpen : nextProps.onClose;
- handler && handler();
- }
- },
-
- componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
- // focus to the selected option
- if (this.refs.menu && this.refs.focused && this.state.isOpen && !this.hasScrolledToOption) {
- var focusedOptionNode = _reactDom2['default'].findDOMNode(this.refs.focused);
- var menuNode = _reactDom2['default'].findDOMNode(this.refs.menu);
- menuNode.scrollTop = focusedOptionNode.offsetTop;
- this.hasScrolledToOption = true;
- } else if (!this.state.isOpen) {
- this.hasScrolledToOption = false;
- }
-
- if (prevState.inputValue !== this.state.inputValue && this.props.onInputChange) {
- this.props.onInputChange(this.state.inputValue);
- }
- if (this._scrollToFocusedOptionOnUpdate && this.refs.focused && this.refs.menu) {
- this._scrollToFocusedOptionOnUpdate = false;
- var focusedDOM = _reactDom2['default'].findDOMNode(this.refs.focused);
- var menuDOM = _reactDom2['default'].findDOMNode(this.refs.menu);
- var focusedRect = focusedDOM.getBoundingClientRect();
- var menuRect = menuDOM.getBoundingClientRect();
- if (focusedRect.bottom > menuRect.bottom || focusedRect.top < menuRect.top) {
- menuDOM.scrollTop = focusedDOM.offsetTop + focusedDOM.clientHeight - menuDOM.offsetHeight;
- }
- }
- if (this.props.scrollMenuIntoView && this.refs.menuContainer) {
- var menuContainerRect = this.refs.menuContainer.getBoundingClientRect();
- if (window.innerHeight < menuContainerRect.bottom + this.props.menuBuffer) {
- window.scrollTo(0, window.scrollY + menuContainerRect.bottom + this.props.menuBuffer - window.innerHeight);
- }
- }
- if (prevProps.disabled !== this.props.disabled) {
- this.setState({ isFocused: false }); // eslint-disable-line react/no-did-update-set-state
- }
- },
-
- focus: function focus() {
- if (!this.refs.input) return;
- this.refs.input.focus();
- },
-
- blurInput: function blurInput() {
- if (!this.refs.input) return;
- this.refs.input.blur();
- },
-
- handleTouchMove: function handleTouchMove(event) {
- // Set a flag that the view is being dragged
- this.dragging = true;
- },
-
- handleTouchStart: function handleTouchStart(event) {
- // Set a flag that the view is not being dragged
- this.dragging = false;
- },
-
- handleTouchEnd: function handleTouchEnd(event) {
- // Check if the view is being dragged, In this case
- // we don't want to fire the click event (because the user only wants to scroll)
- if (this.dragging) return;
-
- // Fire the mouse events
- this.handleMouseDown(event);
- },
-
- handleTouchEndClearValue: function handleTouchEndClearValue(event) {
- // Check if the view is being dragged, In this case
- // we don't want to fire the click event (because the user only wants to scroll)
- if (this.dragging) return;
-
- // Clear the value
- this.clearValue(event);
- },
-
- handleMouseDown: function handleMouseDown(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, or if the component is disabled, ignore it.
- if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
- return;
- }
-
- // prevent default event handlers
- event.stopPropagation();
- event.preventDefault();
-
- // for the non-searchable select, toggle the menu
- if (!this.props.searchable) {
- this.focus();
- return this.setState({
- isOpen: !this.state.isOpen
- });
- }
-
- if (this.state.isFocused) {
- // if the input is focused, ensure the menu is open
- this.setState({
- isOpen: true,
- isPseudoFocused: false
- });
- } else {
- // otherwise, focus the input and open the menu
- this._openAfterFocus = true;
- this.focus();
- }
- },
-
- handleMouseDownOnArrow: function handleMouseDownOnArrow(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, or if the component is disabled, ignore it.
- if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- // If the menu isn't open, let the event bubble to the main handleMouseDown
- if (!this.state.isOpen) {
- return;
- }
- // prevent default event handlers
- event.stopPropagation();
- event.preventDefault();
- // close the menu
- this.closeMenu();
- },
-
- handleMouseDownOnMenu: function handleMouseDownOnMenu(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, or if the component is disabled, ignore it.
- if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- event.stopPropagation();
- event.preventDefault();
-
- this._openAfterFocus = true;
- this.focus();
- },
-
- closeMenu: function closeMenu() {
- this.setState({
- isOpen: false,
- isPseudoFocused: this.state.isFocused && !this.props.multi,
- inputValue: ''
- });
- this.hasScrolledToOption = false;
- },
-
- handleInputFocus: function handleInputFocus(event) {
- var isOpen = this.state.isOpen || this._openAfterFocus;
- if (this.props.onFocus) {
- this.props.onFocus(event);
- }
- this.setState({
- isFocused: true,
- isOpen: isOpen
- });
- this._openAfterFocus = false;
- },
-
- handleInputBlur: function handleInputBlur(event) {
- if (this.refs.menu && document.activeElement.isEqualNode(this.refs.menu)) {
- return;
- }
-
- if (this.props.onBlur) {
- this.props.onBlur(event);
- }
- var onBlurredState = {
- isFocused: false,
- isOpen: false,
- isPseudoFocused: false
- };
- if (this.props.onBlurResetsInput) {
- onBlurredState.inputValue = '';
- }
- this.setState(onBlurredState);
- },
-
- handleInputChange: function handleInputChange(event) {
- this.setState({
- isOpen: true,
- isPseudoFocused: false,
- inputValue: event.target.value
- });
- },
-
- handleKeyDown: function handleKeyDown(event) {
- if (this.props.disabled) return;
- switch (event.keyCode) {
- case 8:
- // backspace
- if (!this.state.inputValue && this.props.backspaceRemoves) {
- event.preventDefault();
- this.popValue();
- }
- return;
- case 9:
- // tab
- if (event.shiftKey || !this.state.isOpen) {
- return;
- }
- this.selectFocusedOption();
- break;
- case 13:
- // enter
- if (!this.state.isOpen) return;
- event.stopPropagation();
- this.selectFocusedOption();
- break;
- case 27:
- // escape
- if (this.state.isOpen) {
- this.closeMenu();
- } else if (this.props.clearable && this.props.escapeClearsValue) {
- this.clearValue(event);
- }
- break;
- case 38:
- // up
- this.focusPreviousOption();
- break;
- case 40:
- // down
- this.focusNextOption();
- break;
- // case 188: // ,
- // if (this.props.allowCreate && this.props.multi) {
- // event.preventDefault();
- // event.stopPropagation();
- // this.selectFocusedOption();
- // } else {
- // return;
- // }
- // break;
- default:
- return;
- }
- event.preventDefault();
- },
-
- handleValueClick: function handleValueClick(option, event) {
- if (!this.props.onValueClick) return;
- this.props.onValueClick(option, event);
- },
-
- handleMenuScroll: function handleMenuScroll(event) {
- if (!this.props.onMenuScrollToBottom) return;
- var target = event.target;
-
- if (target.scrollHeight > target.offsetHeight && !(target.scrollHeight - target.offsetHeight - target.scrollTop)) {
- this.props.onMenuScrollToBottom();
- }
- },
-
- handleRequired: function handleRequired(value, multi) {
- if (!value) return true;
- return multi ? value.length === 0 : Object.keys(value).length === 0;
- },
-
- getOptionLabel: function getOptionLabel(op) {
- return op[this.props.labelKey];
- },
-
- getValueArray: function getValueArray() {
- var value = this.props.value;
- if (this.props.multi) {
- if (typeof value === 'string') value = value.split(this.props.delimiter);
- if (!Array.isArray(value)) {
- if (value === null || value === undefined) return [];
- value = [value];
- }
- return value.map(this.expandValue).filter(function (i) {
- return i;
- });
- }
- var expandedValue = this.expandValue(value);
- return expandedValue ? [expandedValue] : [];
- },
-
- expandValue: function expandValue(value) {
- if (typeof value !== 'string' && typeof value !== 'number') return value;
- var _props = this.props;
- var options = _props.options;
- var valueKey = _props.valueKey;
-
- if (!options) return;
- for (var i = 0; i < options.length; i++) {
- if (options[i][valueKey] === value) return options[i];
- }
- },
-
- setValue: function setValue(value) {
- var _this = this;
-
- if (this.props.autoBlur) {
- this.blurInput();
- }
- if (!this.props.onChange) return;
- if (this.props.required) {
- var required = this.handleRequired(value, this.props.multi);
- this.setState({ required: required });
- }
- if (this.props.simpleValue && value) {
- value = this.props.multi ? value.map(function (i) {
- return i[_this.props.valueKey];
- }).join(this.props.delimiter) : value[this.props.valueKey];
- }
- this.props.onChange(value);
- },
-
- selectValue: function selectValue(value) {
- this.hasScrolledToOption = false;
- if (this.props.multi) {
- this.addValue(value);
- this.setState({
- inputValue: ''
- });
- } else {
- this.setValue(value);
- this.setState({
- isOpen: false,
- inputValue: '',
- isPseudoFocused: this.state.isFocused
- });
- }
- },
-
- addValue: function addValue(value) {
- var valueArray = this.getValueArray();
- this.setValue(valueArray.concat(value));
- },
-
- popValue: function popValue() {
- var valueArray = this.getValueArray();
- if (!valueArray.length) return;
- if (valueArray[valueArray.length - 1].clearableValue === false) return;
- this.setValue(valueArray.slice(0, valueArray.length - 1));
- },
-
- removeValue: function removeValue(value) {
- var valueArray = this.getValueArray();
- this.setValue(valueArray.filter(function (i) {
- return i !== value;
- }));
- this.focus();
- },
-
- clearValue: function clearValue(event) {
- // if the event was triggered by a mousedown and not the primary
- // button, ignore it.
- if (event && event.type === 'mousedown' && event.button !== 0) {
- return;
- }
- event.stopPropagation();
- event.preventDefault();
- this.setValue(null);
- this.setState({
- isOpen: false,
- inputValue: ''
- }, this.focus);
- },
-
- focusOption: function focusOption(option) {
- this.setState({
- focusedOption: option
- });
- },
-
- focusNextOption: function focusNextOption() {
- this.focusAdjacentOption('next');
- },
-
- focusPreviousOption: function focusPreviousOption() {
- this.focusAdjacentOption('previous');
- },
-
- focusAdjacentOption: function focusAdjacentOption(dir) {
- var options = this._visibleOptions.filter(function (i) {
- return !i.disabled;
- });
- this._scrollToFocusedOptionOnUpdate = true;
- if (!this.state.isOpen) {
- this.setState({
- isOpen: true,
- inputValue: '',
- focusedOption: this._focusedOption || options[dir === 'next' ? 0 : options.length - 1]
- });
- return;
- }
- if (!options.length) return;
- var focusedIndex = -1;
- for (var i = 0; i < options.length; i++) {
- if (this._focusedOption === options[i]) {
- focusedIndex = i;
- break;
- }
- }
- var focusedOption = options[0];
- if (dir === 'next' && focusedIndex > -1 && focusedIndex < options.length - 1) {
- focusedOption = options[focusedIndex + 1];
- } else if (dir === 'previous') {
- if (focusedIndex > 0) {
- focusedOption = options[focusedIndex - 1];
- } else {
- focusedOption = options[options.length - 1];
- }
- }
- this.setState({
- focusedOption: focusedOption
- });
- },
-
- selectFocusedOption: function selectFocusedOption() {
- // if (this.props.allowCreate && !this.state.focusedOption) {
- // return this.selectValue(this.state.inputValue);
- // }
- if (this._focusedOption) {
- return this.selectValue(this._focusedOption);
- }
- },
-
- renderLoading: function renderLoading() {
- if (!this.props.isLoading) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-loading-zone', 'aria-hidden': 'true' },
- _react2['default'].createElement('span', { className: 'Select-loading' })
- );
- },
-
- renderValue: function renderValue(valueArray, isOpen) {
- var _this2 = this;
-
- var renderLabel = this.props.valueRenderer || this.getOptionLabel;
- var ValueComponent = this.props.valueComponent;
- if (!valueArray.length) {
- return !this.state.inputValue ? _react2['default'].createElement(
- 'div',
- { className: 'Select-placeholder' },
- this.props.placeholder
- ) : null;
- }
- var onClick = this.props.onValueClick ? this.handleValueClick : null;
- if (this.props.multi) {
- return valueArray.map(function (value, i) {
- return _react2['default'].createElement(
- ValueComponent,
- {
- disabled: _this2.props.disabled || value.clearableValue === false,
- key: 'value-' + i + '-' + value[_this2.props.valueKey],
- onClick: onClick,
- onRemove: _this2.removeValue,
- value: value
- },
- renderLabel(value)
- );
- });
- } else if (!this.state.inputValue) {
- if (isOpen) onClick = null;
- return _react2['default'].createElement(
- ValueComponent,
- {
- disabled: this.props.disabled,
- onClick: onClick,
- value: valueArray[0]
- },
- renderLabel(valueArray[0])
- );
- }
- },
-
- renderInput: function renderInput(valueArray) {
- var className = (0, _classnames2['default'])('Select-input', this.props.inputProps.className);
- if (this.props.disabled || !this.props.searchable) {
- return _react2['default'].createElement('div', _extends({}, this.props.inputProps, {
- className: className,
- tabIndex: this.props.tabIndex || 0,
- onBlur: this.handleInputBlur,
- onFocus: this.handleInputFocus,
- ref: 'input',
- style: { border: 0, width: 1, display: 'inline-block' } }));
- }
- return _react2['default'].createElement(_reactInputAutosize2['default'], _extends({}, this.props.inputProps, {
- className: className,
- tabIndex: this.props.tabIndex,
- onBlur: this.handleInputBlur,
- onChange: this.handleInputChange,
- onFocus: this.handleInputFocus,
- minWidth: '5',
- ref: 'input',
- required: this.state.required,
- value: this.state.inputValue
- }));
- },
-
- renderClear: function renderClear() {
- if (!this.props.clearable || !this.props.value || this.props.multi && !this.props.value.length || this.props.disabled || this.props.isLoading) return;
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-clear-zone', title: this.props.multi ? this.props.clearAllText : this.props.clearValueText,
- 'aria-label': this.props.multi ? this.props.clearAllText : this.props.clearValueText,
- onMouseDown: this.clearValue,
- onTouchStart: this.handleTouchStart,
- onTouchMove: this.handleTouchMove,
- onTouchEnd: this.handleTouchEndClearValue },
- _react2['default'].createElement('span', { className: 'Select-clear', dangerouslySetInnerHTML: { __html: '×' } })
- );
- },
-
- renderArrow: function renderArrow() {
- return _react2['default'].createElement(
- 'span',
- { className: 'Select-arrow-zone', onMouseDown: this.handleMouseDownOnArrow },
- _react2['default'].createElement('span', { className: 'Select-arrow', onMouseDown: this.handleMouseDownOnArrow })
- );
- },
-
- filterOptions: function filterOptions(excludeOptions) {
- var _this3 = this;
-
- var filterValue = this.state.inputValue;
- var options = this.props.options || [];
- if (typeof this.props.filterOptions === 'function') {
- return this.props.filterOptions.call(this, options, filterValue, excludeOptions);
- } else if (this.props.filterOptions) {
- if (this.props.ignoreAccents) {
- filterValue = (0, _utilsStripDiacritics2['default'])(filterValue);
- }
- if (this.props.ignoreCase) {
- filterValue = filterValue.toLowerCase();
- }
- if (excludeOptions) excludeOptions = excludeOptions.map(function (i) {
- return i[_this3.props.valueKey];
- });
- return options.filter(function (option) {
- if (excludeOptions && excludeOptions.indexOf(option[_this3.props.valueKey]) > -1) return false;
- if (_this3.props.filterOption) return _this3.props.filterOption.call(_this3, option, filterValue);
- if (!filterValue) return true;
- var valueTest = String(option[_this3.props.valueKey]);
- var labelTest = String(option[_this3.props.labelKey]);
- if (_this3.props.ignoreAccents) {
- if (_this3.props.matchProp !== 'label') valueTest = (0, _utilsStripDiacritics2['default'])(valueTest);
- if (_this3.props.matchProp !== 'value') labelTest = (0, _utilsStripDiacritics2['default'])(labelTest);
- }
- if (_this3.props.ignoreCase) {
- if (_this3.props.matchProp !== 'label') valueTest = valueTest.toLowerCase();
- if (_this3.props.matchProp !== 'value') labelTest = labelTest.toLowerCase();
- }
- return _this3.props.matchPos === 'start' ? _this3.props.matchProp !== 'label' && valueTest.substr(0, filterValue.length) === filterValue || _this3.props.matchProp !== 'value' && labelTest.substr(0, filterValue.length) === filterValue : _this3.props.matchProp !== 'label' && valueTest.indexOf(filterValue) >= 0 || _this3.props.matchProp !== 'value' && labelTest.indexOf(filterValue) >= 0;
- });
- } else {
- return options;
- }
- },
-
- renderMenu: function renderMenu(options, valueArray, focusedOption) {
- var _this4 = this;
-
- if (options && options.length) {
- var _ret = (function () {
- var Option = _this4.props.optionComponent;
- var renderLabel = _this4.props.optionRenderer || _this4.getOptionLabel;
-
- return {
- v: options.map(function (option, i) {
- var isSelected = valueArray && valueArray.indexOf(option) > -1;
- var isFocused = option === focusedOption;
- var optionRef = isFocused ? 'focused' : null;
- var optionClass = (0, _classnames2['default'])({
- 'Select-option': true,
- 'is-selected': isSelected,
- 'is-focused': isFocused,
- 'is-disabled': option.disabled
- });
-
- return _react2['default'].createElement(
- Option,
- {
- className: optionClass,
- isDisabled: option.disabled,
- isFocused: isFocused,
- key: 'option-' + i + '-' + option[_this4.props.valueKey],
- onSelect: _this4.selectValue,
- onFocus: _this4.focusOption,
- option: option,
- isSelected: isSelected,
- ref: optionRef
- },
- renderLabel(option)
- );
- })
- };
- })();
-
- if (typeof _ret === 'object') return _ret.v;
- } else if (this.props.noResultsText) {
- return _react2['default'].createElement(
- 'div',
- { className: 'Select-noresults' },
- this.props.noResultsText
- );
- } else {
- return null;
- }
- },
-
- renderHiddenField: function renderHiddenField(valueArray) {
- var _this5 = this;
-
- if (!this.props.name) return;
- var value = valueArray.map(function (i) {
- return stringifyValue(i[_this5.props.valueKey]);
- }).join(this.props.delimiter);
- return _react2['default'].createElement('input', { type: 'hidden', ref: 'value', name: this.props.name, value: value, disabled: this.props.disabled });
- },
-
- getFocusableOption: function getFocusableOption(selectedOption) {
- var options = this._visibleOptions;
- if (!options.length) return;
- var focusedOption = this.state.focusedOption || selectedOption;
- if (focusedOption && options.indexOf(focusedOption) > -1) return focusedOption;
- for (var i = 0; i < options.length; i++) {
- if (!options[i].disabled) return options[i];
- }
- },
-
- render: function render() {
- var valueArray = this.getValueArray();
- var options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
- var isOpen = this.state.isOpen;
- if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
- var focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
- var className = (0, _classnames2['default'])('Select', this.props.className, {
- 'Select--multi': this.props.multi,
- 'is-disabled': this.props.disabled,
- 'is-focused': this.state.isFocused,
- 'is-loading': this.props.isLoading,
- 'is-open': isOpen,
- 'is-pseudo-focused': this.state.isPseudoFocused,
- 'is-searchable': this.props.searchable,
- 'has-value': valueArray.length
- });
- return _react2['default'].createElement(
- 'div',
- { ref: 'wrapper', className: className, style: this.props.wrapperStyle },
- this.renderHiddenField(valueArray),
- _react2['default'].createElement(
- 'div',
- { ref: 'control',
- className: 'Select-control',
- style: this.props.style,
- onKeyDown: this.handleKeyDown,
- onMouseDown: this.handleMouseDown,
- onTouchEnd: this.handleTouchEnd,
- onTouchStart: this.handleTouchStart,
- onTouchMove: this.handleTouchMove },
- this.renderValue(valueArray, isOpen),
- this.renderInput(valueArray),
- this.renderLoading(),
- this.renderClear(),
- this.renderArrow()
- ),
- isOpen ? _react2['default'].createElement(
- 'div',
- { ref: 'menuContainer', className: 'Select-menu-outer', style: this.props.menuContainerStyle },
- _react2['default'].createElement(
- 'div',
- { ref: 'menu', className: 'Select-menu',
- style: this.props.menuStyle,
- onScroll: this.handleMenuScroll,
- onMouseDown: this.handleMouseDownOnMenu },
- this.renderMenu(options, !this.props.multi ? valueArray : null, focusedOption)
- )
- ) : null
- );
- }
-
-});
-
-exports['default'] = Select;
-module.exports = exports['default'];
-
-},{"./Async":1,"./Option":2,"./Value":3,"./utils/stripDiacritics":4,"classnames":undefined,"react":undefined,"react-dom":undefined,"react-input-autosize":undefined}]},{},[]);
diff --git a/examples/dist/common.js b/examples/dist/common.js
deleted file mode 100644
index 5f915e7c0e..0000000000
--- a/examples/dist/common.js
+++ /dev/null
@@ -1,18987 +0,0 @@
-require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 8 && documentMode <= 11);
-
-/**
- * Opera <= 12 includes TextEvent in window, but does not fire
- * text input events. Rely on keypress instead.
- */
-function isPresto() {
- var opera = window.opera;
- return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
-}
-
-var SPACEBAR_CODE = 32;
-var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
-
-var topLevelTypes = EventConstants.topLevelTypes;
-
-// Events and their corresponding property names.
-var eventTypes = {
- beforeInput: {
- phasedRegistrationNames: {
- bubbled: keyOf({ onBeforeInput: null }),
- captured: keyOf({ onBeforeInputCapture: null })
- },
- dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
- },
- compositionEnd: {
- phasedRegistrationNames: {
- bubbled: keyOf({ onCompositionEnd: null }),
- captured: keyOf({ onCompositionEndCapture: null })
- },
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
- },
- compositionStart: {
- phasedRegistrationNames: {
- bubbled: keyOf({ onCompositionStart: null }),
- captured: keyOf({ onCompositionStartCapture: null })
- },
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
- },
- compositionUpdate: {
- phasedRegistrationNames: {
- bubbled: keyOf({ onCompositionUpdate: null }),
- captured: keyOf({ onCompositionUpdateCapture: null })
- },
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
- }
-};
-
-// Track whether we've ever handled a keypress on the space key.
-var hasSpaceKeypress = false;
-
-/**
- * Return whether a native keypress event is assumed to be a command.
- * This is required because Firefox fires `keypress` events for key commands
- * (cut, copy, select-all, etc.) even though no character is inserted.
- */
-function isKeypressCommand(nativeEvent) {
- return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
- // ctrlKey && altKey is equivalent to AltGr, and is not a command.
- !(nativeEvent.ctrlKey && nativeEvent.altKey);
-}
-
-/**
- * Translate native top level events into event types.
- *
- * @param {string} topLevelType
- * @return {object}
- */
-function getCompositionEventType(topLevelType) {
- switch (topLevelType) {
- case topLevelTypes.topCompositionStart:
- return eventTypes.compositionStart;
- case topLevelTypes.topCompositionEnd:
- return eventTypes.compositionEnd;
- case topLevelTypes.topCompositionUpdate:
- return eventTypes.compositionUpdate;
- }
-}
-
-/**
- * Does our fallback best-guess model think this event signifies that
- * composition has begun?
- *
- * @param {string} topLevelType
- * @param {object} nativeEvent
- * @return {boolean}
- */
-function isFallbackCompositionStart(topLevelType, nativeEvent) {
- return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
-}
-
-/**
- * Does our fallback mode think that this event is the end of composition?
- *
- * @param {string} topLevelType
- * @param {object} nativeEvent
- * @return {boolean}
- */
-function isFallbackCompositionEnd(topLevelType, nativeEvent) {
- switch (topLevelType) {
- case topLevelTypes.topKeyUp:
- // Command keys insert or clear IME input.
- return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
- case topLevelTypes.topKeyDown:
- // Expect IME keyCode on each keydown. If we get any other
- // code we must have exited earlier.
- return nativeEvent.keyCode !== START_KEYCODE;
- case topLevelTypes.topKeyPress:
- case topLevelTypes.topMouseDown:
- case topLevelTypes.topBlur:
- // Events are not possible without cancelling IME.
- return true;
- default:
- return false;
- }
-}
-
-/**
- * Google Input Tools provides composition data via a CustomEvent,
- * with the `data` property populated in the `detail` object. If this
- * is available on the event object, use it. If not, this is a plain
- * composition event and we have nothing special to extract.
- *
- * @param {object} nativeEvent
- * @return {?string}
- */
-function getDataFromCustomEvent(nativeEvent) {
- var detail = nativeEvent.detail;
- if (typeof detail === 'object' && 'data' in detail) {
- return detail.data;
- }
- return null;
-}
-
-// Track the current IME composition fallback object, if any.
-var currentComposition = null;
-
-/**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {?object} A SyntheticCompositionEvent.
- */
-function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
- var eventType;
- var fallbackData;
-
- if (canUseCompositionEvent) {
- eventType = getCompositionEventType(topLevelType);
- } else if (!currentComposition) {
- if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
- eventType = eventTypes.compositionStart;
- }
- } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
- eventType = eventTypes.compositionEnd;
- }
-
- if (!eventType) {
- return null;
- }
-
- if (useFallbackCompositionData) {
- // The current composition is stored statically and must not be
- // overwritten while composition continues.
- if (!currentComposition && eventType === eventTypes.compositionStart) {
- currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
- } else if (eventType === eventTypes.compositionEnd) {
- if (currentComposition) {
- fallbackData = currentComposition.getData();
- }
- }
- }
-
- var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
-
- if (fallbackData) {
- // Inject data generated from fallback path into the synthetic event.
- // This matches the property of native CompositionEventInterface.
- event.data = fallbackData;
- } else {
- var customData = getDataFromCustomEvent(nativeEvent);
- if (customData !== null) {
- event.data = customData;
- }
- }
-
- EventPropagators.accumulateTwoPhaseDispatches(event);
- return event;
-}
-
-/**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {object} nativeEvent Native browser event.
- * @return {?string} The string corresponding to this `beforeInput` event.
- */
-function getNativeBeforeInputChars(topLevelType, nativeEvent) {
- switch (topLevelType) {
- case topLevelTypes.topCompositionEnd:
- return getDataFromCustomEvent(nativeEvent);
- case topLevelTypes.topKeyPress:
- /**
- * If native `textInput` events are available, our goal is to make
- * use of them. However, there is a special case: the spacebar key.
- * In Webkit, preventing default on a spacebar `textInput` event
- * cancels character insertion, but it *also* causes the browser
- * to fall back to its default spacebar behavior of scrolling the
- * page.
- *
- * Tracking at:
- * https://code.google.com/p/chromium/issues/detail?id=355103
- *
- * To avoid this issue, use the keypress event as if no `textInput`
- * event is available.
- */
- var which = nativeEvent.which;
- if (which !== SPACEBAR_CODE) {
- return null;
- }
-
- hasSpaceKeypress = true;
- return SPACEBAR_CHAR;
-
- case topLevelTypes.topTextInput:
- // Record the characters to be added to the DOM.
- var chars = nativeEvent.data;
-
- // If it's a spacebar character, assume that we have already handled
- // it at the keypress level and bail immediately. Android Chrome
- // doesn't give us keycodes, so we need to blacklist it.
- if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
- return null;
- }
-
- return chars;
-
- default:
- // For other native event types, do nothing.
- return null;
- }
-}
-
-/**
- * For browsers that do not provide the `textInput` event, extract the
- * appropriate string to use for SyntheticInputEvent.
- *
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {object} nativeEvent Native browser event.
- * @return {?string} The fallback string for this `beforeInput` event.
- */
-function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
- // If we are currently composing (IME) and using a fallback to do so,
- // try to extract the composed characters from the fallback object.
- if (currentComposition) {
- if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
- var chars = currentComposition.getData();
- FallbackCompositionState.release(currentComposition);
- currentComposition = null;
- return chars;
- }
- return null;
- }
-
- switch (topLevelType) {
- case topLevelTypes.topPaste:
- // If a paste event occurs after a keypress, throw out the input
- // chars. Paste events should not lead to BeforeInput events.
- return null;
- case topLevelTypes.topKeyPress:
- /**
- * As of v27, Firefox may fire keypress events even when no character
- * will be inserted. A few possibilities:
- *
- * - `which` is `0`. Arrow keys, Esc key, etc.
- *
- * - `which` is the pressed key code, but no char is available.
- * Ex: 'AltGr + d` in Polish. There is no modified character for
- * this key combination and no character is inserted into the
- * document, but FF fires the keypress for char code `100` anyway.
- * No `input` event will occur.
- *
- * - `which` is the pressed key code, but a command combination is
- * being used. Ex: `Cmd+C`. No character is inserted, and no
- * `input` event will occur.
- */
- if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
- return String.fromCharCode(nativeEvent.which);
- }
- return null;
- case topLevelTypes.topCompositionEnd:
- return useFallbackCompositionData ? null : nativeEvent.data;
- default:
- return null;
- }
-}
-
-/**
- * Extract a SyntheticInputEvent for `beforeInput`, based on either native
- * `textInput` or fallback behavior.
- *
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {?object} A SyntheticInputEvent.
- */
-function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
- var chars;
-
- if (canUseTextInputEvent) {
- chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
- } else {
- chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
- }
-
- // If no characters are being inserted, no BeforeInput event should
- // be fired.
- if (!chars) {
- return null;
- }
-
- var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
-
- event.data = chars;
- EventPropagators.accumulateTwoPhaseDispatches(event);
- return event;
-}
-
-/**
- * Create an `onBeforeInput` event to match
- * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
- *
- * This event plugin is based on the native `textInput` event
- * available in Chrome, Safari, Opera, and IE. This event fires after
- * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
- *
- * `beforeInput` is spec'd but not implemented in any browsers, and
- * the `input` event does not provide any useful information about what has
- * actually been added, contrary to the spec. Thus, `textInput` is the best
- * available event to identify the characters that have actually been inserted
- * into the target node.
- *
- * This plugin is also responsible for emitting `composition` events, thus
- * allowing us to share composition fallback code for both `beforeInput` and
- * `composition` event types.
- */
-var BeforeInputEventPlugin = {
-
- eventTypes: eventTypes,
-
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
- return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
- }
-};
-
-module.exports = BeforeInputEventPlugin;
-},{"./EventConstants":14,"./EventPropagators":18,"./FallbackCompositionState":19,"./SyntheticCompositionEvent":90,"./SyntheticInputEvent":94,"fbjs/lib/ExecutionEnvironment":130,"fbjs/lib/keyOf":148}],3:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CSSProperty
- */
-
-'use strict';
-
-/**
- * CSS properties which accept numbers but are not in units of "px".
- */
-var isUnitlessNumber = {
- animationIterationCount: true,
- boxFlex: true,
- boxFlexGroup: true,
- boxOrdinalGroup: true,
- columnCount: true,
- flex: true,
- flexGrow: true,
- flexPositive: true,
- flexShrink: true,
- flexNegative: true,
- flexOrder: true,
- fontWeight: true,
- lineClamp: true,
- lineHeight: true,
- opacity: true,
- order: true,
- orphans: true,
- tabSize: true,
- widows: true,
- zIndex: true,
- zoom: true,
-
- // SVG-related properties
- fillOpacity: true,
- stopOpacity: true,
- strokeDashoffset: true,
- strokeOpacity: true,
- strokeWidth: true
-};
-
-/**
- * @param {string} prefix vendor-specific prefix, eg: Webkit
- * @param {string} key style name, eg: transitionDuration
- * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
- * WebkitTransitionDuration
- */
-function prefixKey(prefix, key) {
- return prefix + key.charAt(0).toUpperCase() + key.substring(1);
-}
-
-/**
- * Support style names that may come passed in prefixed by adding permutations
- * of vendor prefixes.
- */
-var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
-
-// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
-// infinite loop, because it iterates over the newly added props too.
-Object.keys(isUnitlessNumber).forEach(function (prop) {
- prefixes.forEach(function (prefix) {
- isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
- });
-});
-
-/**
- * Most style properties can be unset by doing .style[prop] = '' but IE8
- * doesn't like doing that with shorthand properties so for the properties that
- * IE8 breaks on, which are listed here, we instead unset each of the
- * individual properties. See http://bugs.jquery.com/ticket/12385.
- * The 4-value 'clock' properties like margin, padding, border-width seem to
- * behave without any problems. Curiously, list-style works too without any
- * special prodding.
- */
-var shorthandPropertyExpansions = {
- background: {
- backgroundAttachment: true,
- backgroundColor: true,
- backgroundImage: true,
- backgroundPositionX: true,
- backgroundPositionY: true,
- backgroundRepeat: true
- },
- backgroundPosition: {
- backgroundPositionX: true,
- backgroundPositionY: true
- },
- border: {
- borderWidth: true,
- borderStyle: true,
- borderColor: true
- },
- borderBottom: {
- borderBottomWidth: true,
- borderBottomStyle: true,
- borderBottomColor: true
- },
- borderLeft: {
- borderLeftWidth: true,
- borderLeftStyle: true,
- borderLeftColor: true
- },
- borderRight: {
- borderRightWidth: true,
- borderRightStyle: true,
- borderRightColor: true
- },
- borderTop: {
- borderTopWidth: true,
- borderTopStyle: true,
- borderTopColor: true
- },
- font: {
- fontStyle: true,
- fontVariant: true,
- fontWeight: true,
- fontSize: true,
- lineHeight: true,
- fontFamily: true
- },
- outline: {
- outlineWidth: true,
- outlineStyle: true,
- outlineColor: true
- }
-};
-
-var CSSProperty = {
- isUnitlessNumber: isUnitlessNumber,
- shorthandPropertyExpansions: shorthandPropertyExpansions
-};
-
-module.exports = CSSProperty;
-},{}],4:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CSSPropertyOperations
- * @typechecks static-only
- */
-
-'use strict';
-
-var CSSProperty = require('./CSSProperty');
-var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
-var ReactPerf = require('./ReactPerf');
-
-var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
-var dangerousStyleValue = require('./dangerousStyleValue');
-var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
-var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
-var warning = require('fbjs/lib/warning');
-
-var processStyleName = memoizeStringOnly(function (styleName) {
- return hyphenateStyleName(styleName);
-});
-
-var hasShorthandPropertyBug = false;
-var styleFloatAccessor = 'cssFloat';
-if (ExecutionEnvironment.canUseDOM) {
- var tempStyle = document.createElement('div').style;
- try {
- // IE8 throws "Invalid argument." if resetting shorthand style properties.
- tempStyle.font = '';
- } catch (e) {
- hasShorthandPropertyBug = true;
- }
- // IE8 only supports accessing cssFloat (standard) as styleFloat
- if (document.documentElement.style.cssFloat === undefined) {
- styleFloatAccessor = 'styleFloat';
- }
-}
-
-if ("production" !== 'production') {
- // 'msTransform' is correct, but the other prefixes should be capitalized
- var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
-
- // style values shouldn't contain a semicolon
- var badStyleValueWithSemicolonPattern = /;\s*$/;
-
- var warnedStyleNames = {};
- var warnedStyleValues = {};
-
- var warnHyphenatedStyleName = function (name) {
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
- return;
- }
-
- warnedStyleNames[name] = true;
- "production" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
- };
-
- var warnBadVendoredStyleName = function (name) {
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
- return;
- }
-
- warnedStyleNames[name] = true;
- "production" !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
- };
-
- var warnStyleValueWithSemicolon = function (name, value) {
- if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
- return;
- }
-
- warnedStyleValues[value] = true;
- "production" !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
- };
-
- /**
- * @param {string} name
- * @param {*} value
- */
- var warnValidStyle = function (name, value) {
- if (name.indexOf('-') > -1) {
- warnHyphenatedStyleName(name);
- } else if (badVendoredStyleNamePattern.test(name)) {
- warnBadVendoredStyleName(name);
- } else if (badStyleValueWithSemicolonPattern.test(value)) {
- warnStyleValueWithSemicolon(name, value);
- }
- };
-}
-
-/**
- * Operations for dealing with CSS properties.
- */
-var CSSPropertyOperations = {
-
- /**
- * Serializes a mapping of style properties for use as inline styles:
- *
- * > createMarkupForStyles({width: '200px', height: 0})
- * "width:200px;height:0;"
- *
- * Undefined values are ignored so that declarative programming is easier.
- * The result should be HTML-escaped before insertion into the DOM.
- *
- * @param {object} styles
- * @return {?string}
- */
- createMarkupForStyles: function (styles) {
- var serialized = '';
- for (var styleName in styles) {
- if (!styles.hasOwnProperty(styleName)) {
- continue;
- }
- var styleValue = styles[styleName];
- if ("production" !== 'production') {
- warnValidStyle(styleName, styleValue);
- }
- if (styleValue != null) {
- serialized += processStyleName(styleName) + ':';
- serialized += dangerousStyleValue(styleName, styleValue) + ';';
- }
- }
- return serialized || null;
- },
-
- /**
- * Sets the value for multiple styles on a node. If a value is specified as
- * '' (empty string), the corresponding style property will be unset.
- *
- * @param {DOMElement} node
- * @param {object} styles
- */
- setValueForStyles: function (node, styles) {
- var style = node.style;
- for (var styleName in styles) {
- if (!styles.hasOwnProperty(styleName)) {
- continue;
- }
- if ("production" !== 'production') {
- warnValidStyle(styleName, styles[styleName]);
- }
- var styleValue = dangerousStyleValue(styleName, styles[styleName]);
- if (styleName === 'float') {
- styleName = styleFloatAccessor;
- }
- if (styleValue) {
- style[styleName] = styleValue;
- } else {
- var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
- if (expansion) {
- // Shorthand property that IE8 won't like unsetting, so unset each
- // component to placate it
- for (var individualStyleName in expansion) {
- style[individualStyleName] = '';
- }
- } else {
- style[styleName] = '';
- }
- }
- }
- }
-
-};
-
-ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
- setValueForStyles: 'setValueForStyles'
-});
-
-module.exports = CSSPropertyOperations;
-},{"./CSSProperty":3,"./ReactPerf":71,"./dangerousStyleValue":105,"fbjs/lib/ExecutionEnvironment":130,"fbjs/lib/camelizeStyleName":132,"fbjs/lib/hyphenateStyleName":143,"fbjs/lib/memoizeStringOnly":150,"fbjs/lib/warning":155}],5:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CallbackQueue
- */
-
-'use strict';
-
-var PooledClass = require('./PooledClass');
-
-var assign = require('./Object.assign');
-var invariant = require('fbjs/lib/invariant');
-
-/**
- * A specialized pseudo-event module to help keep track of components waiting to
- * be notified when their DOM representations are available for use.
- *
- * This implements `PooledClass`, so you should never need to instantiate this.
- * Instead, use `CallbackQueue.getPooled()`.
- *
- * @class ReactMountReady
- * @implements PooledClass
- * @internal
- */
-function CallbackQueue() {
- this._callbacks = null;
- this._contexts = null;
-}
-
-assign(CallbackQueue.prototype, {
-
- /**
- * Enqueues a callback to be invoked when `notifyAll` is invoked.
- *
- * @param {function} callback Invoked when `notifyAll` is invoked.
- * @param {?object} context Context to call `callback` with.
- * @internal
- */
- enqueue: function (callback, context) {
- this._callbacks = this._callbacks || [];
- this._contexts = this._contexts || [];
- this._callbacks.push(callback);
- this._contexts.push(context);
- },
-
- /**
- * Invokes all enqueued callbacks and clears the queue. This is invoked after
- * the DOM representation of a component has been created or updated.
- *
- * @internal
- */
- notifyAll: function () {
- var callbacks = this._callbacks;
- var contexts = this._contexts;
- if (callbacks) {
- !(callbacks.length === contexts.length) ? "production" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
- this._callbacks = null;
- this._contexts = null;
- for (var i = 0; i < callbacks.length; i++) {
- callbacks[i].call(contexts[i]);
- }
- callbacks.length = 0;
- contexts.length = 0;
- }
- },
-
- /**
- * Resets the internal queue.
- *
- * @internal
- */
- reset: function () {
- this._callbacks = null;
- this._contexts = null;
- },
-
- /**
- * `PooledClass` looks for this.
- */
- destructor: function () {
- this.reset();
- }
-
-});
-
-PooledClass.addPoolingTo(CallbackQueue);
-
-module.exports = CallbackQueue;
-},{"./Object.assign":22,"./PooledClass":23,"fbjs/lib/invariant":144}],6:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ChangeEventPlugin
- */
-
-'use strict';
-
-var EventConstants = require('./EventConstants');
-var EventPluginHub = require('./EventPluginHub');
-var EventPropagators = require('./EventPropagators');
-var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
-var ReactUpdates = require('./ReactUpdates');
-var SyntheticEvent = require('./SyntheticEvent');
-
-var getEventTarget = require('./getEventTarget');
-var isEventSupported = require('./isEventSupported');
-var isTextInputElement = require('./isTextInputElement');
-var keyOf = require('fbjs/lib/keyOf');
-
-var topLevelTypes = EventConstants.topLevelTypes;
-
-var eventTypes = {
- change: {
- phasedRegistrationNames: {
- bubbled: keyOf({ onChange: null }),
- captured: keyOf({ onChangeCapture: null })
- },
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
- }
-};
-
-/**
- * For IE shims
- */
-var activeElement = null;
-var activeElementID = null;
-var activeElementValue = null;
-var activeElementValueProp = null;
-
-/**
- * SECTION: handle `change` event
- */
-function shouldUseChangeEvent(elem) {
- var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
- return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
-}
-
-var doesChangeEventBubble = false;
-if (ExecutionEnvironment.canUseDOM) {
- // See `handleChange` comment below
- doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
-}
-
-function manualDispatchChangeEvent(nativeEvent) {
- var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
- EventPropagators.accumulateTwoPhaseDispatches(event);
-
- // If change and propertychange bubbled, we'd just bind to it like all the
- // other events and have it go through ReactBrowserEventEmitter. Since it
- // doesn't, we manually listen for the events and so we have to enqueue and
- // process the abstract event manually.
- //
- // Batching is necessary here in order to ensure that all event handlers run
- // before the next rerender (including event handlers attached to ancestor
- // elements instead of directly on the input). Without this, controlled
- // components don't work properly in conjunction with event bubbling because
- // the component is rerendered and the value reverted before all the event
- // handlers can run. See https://github.com/facebook/react/issues/708.
- ReactUpdates.batchedUpdates(runEventInBatch, event);
-}
-
-function runEventInBatch(event) {
- EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue(false);
-}
-
-function startWatchingForChangeEventIE8(target, targetID) {
- activeElement = target;
- activeElementID = targetID;
- activeElement.attachEvent('onchange', manualDispatchChangeEvent);
-}
-
-function stopWatchingForChangeEventIE8() {
- if (!activeElement) {
- return;
- }
- activeElement.detachEvent('onchange', manualDispatchChangeEvent);
- activeElement = null;
- activeElementID = null;
-}
-
-function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topChange) {
- return topLevelTargetID;
- }
-}
-function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topFocus) {
- // stopWatching() should be a noop here but we call it just in case we
- // missed a blur event somehow.
- stopWatchingForChangeEventIE8();
- startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
- } else if (topLevelType === topLevelTypes.topBlur) {
- stopWatchingForChangeEventIE8();
- }
-}
-
-/**
- * SECTION: handle `input` event
- */
-var isInputEventSupported = false;
-if (ExecutionEnvironment.canUseDOM) {
- // IE9 claims to support the input event but fails to trigger it when
- // deleting text, so we ignore its input events
- isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
-}
-
-/**
- * (For old IE.) Replacement getter/setter for the `value` property that gets
- * set on the active element.
- */
-var newValueProp = {
- get: function () {
- return activeElementValueProp.get.call(this);
- },
- set: function (val) {
- // Cast to a string so we can do equality checks.
- activeElementValue = '' + val;
- activeElementValueProp.set.call(this, val);
- }
-};
-
-/**
- * (For old IE.) Starts tracking propertychange events on the passed-in element
- * and override the value property so that we can distinguish user events from
- * value changes in JS.
- */
-function startWatchingForValueChange(target, targetID) {
- activeElement = target;
- activeElementID = targetID;
- activeElementValue = target.value;
- activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
-
- // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
- // on DOM elements
- Object.defineProperty(activeElement, 'value', newValueProp);
- activeElement.attachEvent('onpropertychange', handlePropertyChange);
-}
-
-/**
- * (For old IE.) Removes the event listeners from the currently-tracked element,
- * if any exists.
- */
-function stopWatchingForValueChange() {
- if (!activeElement) {
- return;
- }
-
- // delete restores the original property definition
- delete activeElement.value;
- activeElement.detachEvent('onpropertychange', handlePropertyChange);
-
- activeElement = null;
- activeElementID = null;
- activeElementValue = null;
- activeElementValueProp = null;
-}
-
-/**
- * (For old IE.) Handles a propertychange event, sending a `change` event if
- * the value of the active element has changed.
- */
-function handlePropertyChange(nativeEvent) {
- if (nativeEvent.propertyName !== 'value') {
- return;
- }
- var value = nativeEvent.srcElement.value;
- if (value === activeElementValue) {
- return;
- }
- activeElementValue = value;
-
- manualDispatchChangeEvent(nativeEvent);
-}
-
-/**
- * If a `change` event should be fired, returns the target's ID.
- */
-function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topInput) {
- // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
- // what we want so fall through here and trigger an abstract event
- return topLevelTargetID;
- }
-}
-
-// For IE8 and IE9.
-function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topFocus) {
- // In IE8, we can capture almost all .value changes by adding a
- // propertychange handler and looking for events with propertyName
- // equal to 'value'
- // In IE9, propertychange fires for most input events but is buggy and
- // doesn't fire when text is deleted, but conveniently, selectionchange
- // appears to fire in all of the remaining cases so we catch those and
- // forward the event if the value has changed
- // In either case, we don't want to call the event handler if the value
- // is changed from JS so we redefine a setter for `.value` that updates
- // our activeElementValue variable, allowing us to ignore those changes
- //
- // stopWatching() should be a noop here but we call it just in case we
- // missed a blur event somehow.
- stopWatchingForValueChange();
- startWatchingForValueChange(topLevelTarget, topLevelTargetID);
- } else if (topLevelType === topLevelTypes.topBlur) {
- stopWatchingForValueChange();
- }
-}
-
-// For IE8 and IE9.
-function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
- // On the selectionchange event, the target is just document which isn't
- // helpful for us so just check activeElement instead.
- //
- // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
- // propertychange on the first input event after setting `value` from a
- // script and fires only keydown, keypress, keyup. Catching keyup usually
- // gets it and catching keydown lets us fire an event for the first
- // keystroke if user does a key repeat (it'll be a little delayed: right
- // before the second keystroke). Other input methods (e.g., paste) seem to
- // fire selectionchange normally.
- if (activeElement && activeElement.value !== activeElementValue) {
- activeElementValue = activeElement.value;
- return activeElementID;
- }
- }
-}
-
-/**
- * SECTION: handle `click` event
- */
-function shouldUseClickEvent(elem) {
- // Use the `click` event to detect changes to checkbox and radio inputs.
- // This approach works across all browsers, whereas `change` does not fire
- // until `blur` in IE8.
- return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
-}
-
-function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
- if (topLevelType === topLevelTypes.topClick) {
- return topLevelTargetID;
- }
-}
-
-/**
- * This plugin creates an `onChange` event that normalizes change events
- * across form elements. This event fires at a time when it's possible to
- * change the element's value without seeing a flicker.
- *
- * Supported elements are:
- * - input (see `isTextInputElement`)
- * - textarea
- * - select
- */
-var ChangeEventPlugin = {
-
- eventTypes: eventTypes,
-
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
-
- var getTargetIDFunc, handleEventFunc;
- if (shouldUseChangeEvent(topLevelTarget)) {
- if (doesChangeEventBubble) {
- getTargetIDFunc = getTargetIDForChangeEvent;
- } else {
- handleEventFunc = handleEventsForChangeEventIE8;
- }
- } else if (isTextInputElement(topLevelTarget)) {
- if (isInputEventSupported) {
- getTargetIDFunc = getTargetIDForInputEvent;
- } else {
- getTargetIDFunc = getTargetIDForInputEventIE;
- handleEventFunc = handleEventsForInputEventIE;
- }
- } else if (shouldUseClickEvent(topLevelTarget)) {
- getTargetIDFunc = getTargetIDForClickEvent;
- }
-
- if (getTargetIDFunc) {
- var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
- if (targetID) {
- var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
- event.type = 'change';
- EventPropagators.accumulateTwoPhaseDispatches(event);
- return event;
- }
- }
-
- if (handleEventFunc) {
- handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
- }
- }
-
-};
-
-module.exports = ChangeEventPlugin;
-},{"./EventConstants":14,"./EventPluginHub":15,"./EventPropagators":18,"./ReactUpdates":83,"./SyntheticEvent":92,"./getEventTarget":114,"./isEventSupported":119,"./isTextInputElement":120,"fbjs/lib/ExecutionEnvironment":130,"fbjs/lib/keyOf":148}],7:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ClientReactRootIndex
- * @typechecks
- */
-
-'use strict';
-
-var nextReactRootIndex = 0;
-
-var ClientReactRootIndex = {
- createReactRootIndex: function () {
- return nextReactRootIndex++;
- }
-};
-
-module.exports = ClientReactRootIndex;
-},{}],8:[function(require,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule DOMChildrenOperations
- * @typechecks static-only
- */
-
-'use strict';
-
-var Danger = require('./Danger');
-var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
-var ReactPerf = require('./ReactPerf');
-
-var setInnerHTML = require('./setInnerHTML');
-var setTextContent = require('./setTextContent');
-var invariant = require('fbjs/lib/invariant');
-
-/**
- * Inserts `childNode` as a child of `parentNode` at the `index`.
- *
- * @param {DOMElement} parentNode Parent node in which to insert.
- * @param {DOMElement} childNode Child node to insert.
- * @param {number} index Index at which to insert the child.
- * @internal
- */
-function insertChildAt(parentNode, childNode, index) {
- // By exploiting arrays returning `undefined` for an undefined index, we can
- // rely exclusively on `insertBefore(node, null)` instead of also using
- // `appendChild(node)`. However, using `undefined` is not allowed by all
- // browsers so we must replace it with `null`.
-
- // fix render order error in safari
- // IE8 will throw error when index out of list size.
- var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
-
- parentNode.insertBefore(childNode, beforeChild);
-}
-
-/**
- * Operations for updating with DOM children.
- */
-var DOMChildrenOperations = {
-
- dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
-
- updateTextContent: setTextContent,
-
- /**
- * Updates a component's children by processing a series of updates. The
- * update configurations are each expected to have a `parentNode` property.
- *
- * @param {array