From 3a43afc8810b1dc6893ded1a87b905bff122f5c7 Mon Sep 17 00:00:00 2001 From: Suzie Reahard Date: Fri, 30 Jun 2017 10:47:19 -0600 Subject: [PATCH] Fix duplicate proptypes in creatable --- dist/react-select.css | 375 - dist/react-select.js | 2333 --- dist/react-select.min.css | 1 - dist/react-select.min.js | 2 - examples/dist/.gitignore | 5 - examples/dist/app.js | 9833 ------------ examples/dist/bundle.js | 2314 --- examples/dist/common.js | 22578 ---------------------------- examples/dist/example.css | 555 - examples/dist/index.html | 56 - examples/dist/standalone.html | 48 - examples/dist/standalone.js | 2333 --- lib/Async.js | 265 - lib/AsyncCreatable.js | 55 - lib/Creatable.js | 330 - lib/Option.js | 117 - lib/Select.js | 1251 -- lib/Value.js | 114 - lib/utils/defaultArrowRenderer.js | 24 - lib/utils/defaultClearRenderer.js | 22 - lib/utils/defaultFilterOptions.js | 42 - lib/utils/defaultMenuRenderer.js | 61 - lib/utils/stripDiacritics.js | 10 - src/Creatable.js | 3 - 24 files changed, 42727 deletions(-) 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 lib/Async.js delete mode 100644 lib/AsyncCreatable.js delete mode 100644 lib/Creatable.js delete mode 100644 lib/Option.js delete mode 100644 lib/Select.js delete mode 100644 lib/Value.js delete mode 100644 lib/utils/defaultArrowRenderer.js delete mode 100644 lib/utils/defaultClearRenderer.js delete mode 100644 lib/utils/defaultFilterOptions.js delete mode 100644 lib/utils/defaultMenuRenderer.js delete mode 100644 lib/utils/stripDiacritics.js diff --git a/dist/react-select.css b/dist/react-select.css deleted file mode 100644 index 658cc59b11..0000000000 --- a/dist/react-select.css +++ /dev/null @@ -1,375 +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/JedWatson/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; - opacity: 0.35; -} -.Select-control { - background-color: #fff; - border-color: #d9d9d9 #ccc #b3b3b3; - border-radius: 4px; - border: 1px solid #ccc; - color: #333; - cursor: default; - display: table; - border-spacing: 0; - border-collapse: separate; - height: 36px; - outline: none; - overflow: hidden; - position: relative; - width: 100%; -} -.Select-control:hover { - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06); -} -.Select-control .Select-input:focus { - outline: none; -} -.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 { - top: -2px; - 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, -.Select--single > .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.Select--single > .Select-control .Select-value .Select-value-label, -.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value .Select-value-label { - color: #333; -} -.has-value.Select--single > .Select-control .Select-value a.Select-value-label, -.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label { - cursor: pointer; - text-decoration: none; -} -.has-value.Select--single > .Select-control .Select-value a.Select-value-label:hover, -.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label:hover, -.has-value.Select--single > .Select-control .Select-value a.Select-value-label:focus, -.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label:focus { - color: #007eff; - outline: none; - text-decoration: underline; -} -.Select-input { - height: 34px; - padding-left: 10px; - padding-right: 10px; - vertical-align: middle; -} -.Select-input > input { - width: 100%; - background: none transparent; - border: 0 none; - box-shadow: none; - cursor: default; - display: inline-block; - font-family: inherit; - font-size: inherit; - margin: 0; - outline: none; - line-height: 14px; - /* For IE 8 compatibility */ - padding: 8px 0 12px; - /* For IE 8 compatibility */ - -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; - position: relative; -} -.is-open .Select-arrow, -.Select-arrow-zone:hover > .Select-arrow { - border-top-color: #666; -} -.Select--multi .Select-multi-value-wrapper { - display: inline-block; -} -.Select .Select-aria-only { - display: inline-block; - height: 1px; - width: 1px; - margin: -1px; - clip: rect(0, 0, 0, 0); - overflow: hidden; - float: left; -} -@-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-selected { - background-color: #f5faff; - /* Fallback color for IE 8 */ - background-color: rgba(0, 126, 255, 0.04); - color: #333; -} -.Select-option.is-focused { - background-color: #ebf5ff; - /* Fallback color for IE 8 */ - background-color: rgba(0, 126, 255, 0.08); - color: #333; -} -.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: #ebf5ff; - /* Fallback color for IE 8 */ - background-color: rgba(0, 126, 255, 0.08); - border-radius: 2px; - border: 1px solid #c2e0ff; - /* Fallback color for IE 8 */ - 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 #c2e0ff; - /* Fallback color for IE 8 */ - border-right: 1px solid rgba(0, 126, 255, 0.24); - padding: 1px 5px 3px; -} -.Select--multi .Select-value-icon:hover, -.Select--multi .Select-value-icon:focus { - background-color: #d8eafd; - /* Fallback color for IE 8 */ - background-color: rgba(0, 113, 230, 0.08); - color: #0071e6; -} -.Select--multi .Select-value-icon:active { - background-color: #c2e0ff; - /* Fallback color for IE 8 */ - background-color: rgba(0, 126, 255, 0.24); -} -.Select--multi.is-disabled .Select-value { - 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 c837ecb83d..0000000000 --- a/dist/react-select.js +++ /dev/null @@ -1,2333 +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 _this2.props.value.length) { - _this2.clearOptions(); - } - _this2.props.onChange(newValues); - } - }; - - return children(_extends({}, this.props, props, { - isLoading: isLoading, - onInputChange: this._onInputChange - })); - } - }]); - - return Async; -})(_react.Component); - -exports['default'] = Async; - -Async.propTypes = propTypes; -Async.defaultProps = defaultProps; - -function defaultChildren(props) { - return _react2['default'].createElement(_Select2['default'], props); -} -module.exports = exports['default']; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./Select":5,"./utils/stripDiacritics":11,"prop-types":undefined}],2:[function(require,module,exports){ -(function (global){ -'use strict'; - -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 _createReactClass = require('create-react-class'); - -var _createReactClass2 = _interopRequireDefault(_createReactClass); - -var _Select = require('./Select'); - -var _Select2 = _interopRequireDefault(_Select); - -var AsyncCreatable = (0, _createReactClass2['default'])({ - displayName: 'AsyncCreatableSelect', - - focus: function focus() { - this.select.focus(); - }, - - render: function render() { - var _this = this; - - return _react2['default'].createElement( - _Select2['default'].Async, - this.props, - function (asyncProps) { - return _react2['default'].createElement( - _Select2['default'].Creatable, - _this.props, - function (creatableProps) { - return _react2['default'].createElement(_Select2['default'], _extends({}, asyncProps, creatableProps, { - onInputChange: function (input) { - creatableProps.onInputChange(input); - return asyncProps.onInputChange(input); - }, - ref: function (ref) { - _this.select = ref; - creatableProps.ref(ref); - asyncProps.ref(ref); - } - })); - } - ); - } - ); - } -}); - -module.exports = AsyncCreatable; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./Select":5,"create-react-class":undefined}],3:[function(require,module,exports){ -(function (global){ -'use strict'; - -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 }; } - -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - -var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null); - -var _react2 = _interopRequireDefault(_react); - -var _createReactClass = require('create-react-class'); - -var _createReactClass2 = _interopRequireDefault(_createReactClass); - -var _propTypes = require('prop-types'); - -var _propTypes2 = _interopRequireDefault(_propTypes); - -var _Select = require('./Select'); - -var _Select2 = _interopRequireDefault(_Select); - -var _utilsDefaultFilterOptions = require('./utils/defaultFilterOptions'); - -var _utilsDefaultFilterOptions2 = _interopRequireDefault(_utilsDefaultFilterOptions); - -var _utilsDefaultMenuRenderer = require('./utils/defaultMenuRenderer'); - -var _utilsDefaultMenuRenderer2 = _interopRequireDefault(_utilsDefaultMenuRenderer); - -var Creatable = (0, _createReactClass2['default'])({ - displayName: 'CreatableSelect', - - propTypes: { - // Child function responsible for creating the inner Select component - // This component can be used to compose HOCs (eg Creatable and Async) - // (props: Object): PropTypes.element - children: _propTypes2['default'].func, - - // See Select.propTypes.filterOptions - filterOptions: _propTypes2['default'].any, - - // Searches for any matching option within the set of options. - // This function prevents duplicate options from being created. - // ({ option: Object, options: Array, labelKey: string, valueKey: string }): boolean - isOptionUnique: _propTypes2['default'].func, - - // Determines if the current input text represents a valid option. - // ({ label: string }): boolean - isValidNewOption: _propTypes2['default'].func, - - // See Select.propTypes.menuRenderer - menuRenderer: _propTypes2['default'].any, - - // Factory to create new option. - // ({ label: string, labelKey: string, valueKey: string }): Object - newOptionCreator: _propTypes2['default'].func, - - // input change handler: function (inputValue) {} - onInputChange: _propTypes2['default'].func, - - // input keyDown handler: function (event) {} - onInputKeyDown: _propTypes2['default'].func, - - // new option click handler: function (option) {} - onNewOptionClick: _propTypes2['default'].func, - - // new option click handler: function (option) {} - onNewOptionClick: _react2['default'].PropTypes.func, - - // See Select.propTypes.options - options: _propTypes2['default'].array, - - // Creates prompt/placeholder option text. - // (filterText: string): string - promptTextCreator: _propTypes2['default'].func, - - // Decides if a keyDown event (eg its `keyCode`) should result in the creation of a new option. - shouldKeyDownEventCreateNewOption: _propTypes2['default'].func - }, - - // Default prop methods - statics: { - isOptionUnique: isOptionUnique, - isValidNewOption: isValidNewOption, - newOptionCreator: newOptionCreator, - promptTextCreator: promptTextCreator, - shouldKeyDownEventCreateNewOption: shouldKeyDownEventCreateNewOption - }, - - getDefaultProps: function getDefaultProps() { - return { - filterOptions: _utilsDefaultFilterOptions2['default'], - isOptionUnique: isOptionUnique, - isValidNewOption: isValidNewOption, - menuRenderer: _utilsDefaultMenuRenderer2['default'], - newOptionCreator: newOptionCreator, - promptTextCreator: promptTextCreator, - shouldKeyDownEventCreateNewOption: shouldKeyDownEventCreateNewOption - }; - }, - - createNewOption: function createNewOption() { - var _props = this.props; - var isValidNewOption = _props.isValidNewOption; - var newOptionCreator = _props.newOptionCreator; - var onNewOptionClick = _props.onNewOptionClick; - var _props$options = _props.options; - var options = _props$options === undefined ? [] : _props$options; - var shouldKeyDownEventCreateNewOption = _props.shouldKeyDownEventCreateNewOption; - - if (isValidNewOption({ label: this.inputValue })) { - var option = newOptionCreator({ label: this.inputValue, labelKey: this.labelKey, valueKey: this.valueKey }); - var _isOptionUnique = this.isOptionUnique({ option: option }); - - // Don't add the same option twice. - if (_isOptionUnique) { - if (onNewOptionClick) { - onNewOptionClick(option); - } else { - this.inputValue = ''; - options.unshift(option); - this.select.selectValue(option); - } - } - } - }, - - filterOptions: function filterOptions() { - var _props2 = this.props; - var filterOptions = _props2.filterOptions; - var isValidNewOption = _props2.isValidNewOption; - var options = _props2.options; - var promptTextCreator = _props2.promptTextCreator; - - // TRICKY Check currently selected options as well. - // Don't display a create-prompt for a value that's selected. - // This covers async edge-cases where a newly-created Option isn't yet in the async-loaded array. - var excludeOptions = arguments[2] || []; - - var filteredOptions = filterOptions.apply(undefined, arguments) || []; - - if (isValidNewOption({ label: this.inputValue })) { - var _newOptionCreator = this.props.newOptionCreator; - - var option = _newOptionCreator({ - label: this.inputValue, - labelKey: this.labelKey, - valueKey: this.valueKey - }); - - // TRICKY Compare to all options (not just filtered options) in case option has already been selected). - // For multi-selects, this would remove it from the filtered list. - var _isOptionUnique2 = this.isOptionUnique({ - option: option, - options: excludeOptions.concat(filteredOptions) - }); - - if (_isOptionUnique2) { - var _prompt = promptTextCreator(this.inputValue); - - this._createPlaceholderOption = _newOptionCreator({ - label: _prompt, - labelKey: this.labelKey, - valueKey: this.valueKey - }); - - filteredOptions.unshift(this._createPlaceholderOption); - } - } - - return filteredOptions; - }, - - isOptionUnique: function isOptionUnique(_ref2) { - var option = _ref2.option; - var options = _ref2.options; - var isOptionUnique = this.props.isOptionUnique; - - options = options || this.select.filterOptions(); - - return isOptionUnique({ - labelKey: this.labelKey, - option: option, - options: options, - valueKey: this.valueKey - }); - }, - - menuRenderer: function menuRenderer(params) { - var menuRenderer = this.props.menuRenderer; - - return menuRenderer(_extends({}, params, { - onSelect: this.onOptionSelect, - selectValue: this.onOptionSelect - })); - }, - - onInputChange: function onInputChange(input) { - var onInputChange = this.props.onInputChange; - - if (onInputChange) { - onInputChange(input); - } - // This value may be needed in between Select mounts (when this.select is null) - this.inputValue = input; - }, - - onInputKeyDown: function onInputKeyDown(event) { - var _props3 = this.props; - var shouldKeyDownEventCreateNewOption = _props3.shouldKeyDownEventCreateNewOption; - var onInputKeyDown = _props3.onInputKeyDown; - - var focusedOption = this.select.getFocusedOption(); - - if (focusedOption && focusedOption === this._createPlaceholderOption && shouldKeyDownEventCreateNewOption({ keyCode: event.keyCode })) { - this.createNewOption(); - - // Prevent decorated Select from doing anything additional with this keyDown event - event.preventDefault(); - } else if (onInputKeyDown) { - onInputKeyDown(event); - } - }, - - onOptionSelect: function onOptionSelect(option, event) { - if (option === this._createPlaceholderOption) { - this.createNewOption(); - } else { - this.select.selectValue(option); - } - }, - - focus: function focus() { - this.select.focus(); - }, - - render: function render() { - var _this = this; - - var _props4 = this.props; - var newOptionCreator = _props4.newOptionCreator; - var shouldKeyDownEventCreateNewOption = _props4.shouldKeyDownEventCreateNewOption; - - var restProps = _objectWithoutProperties(_props4, ['newOptionCreator', 'shouldKeyDownEventCreateNewOption']); - - var children = this.props.children; - - // We can't use destructuring default values to set the children, - // because it won't apply work if `children` is null. A falsy check is - // more reliable in real world use-cases. - if (!children) { - children = defaultChildren; - } - - var props = _extends({}, restProps, { - allowCreate: true, - filterOptions: this.filterOptions, - menuRenderer: this.menuRenderer, - onInputChange: this.onInputChange, - onInputKeyDown: this.onInputKeyDown, - ref: function ref(_ref) { - _this.select = _ref; - - // These values may be needed in between Select mounts (when this.select is null) - if (_ref) { - _this.labelKey = _ref.props.labelKey; - _this.valueKey = _ref.props.valueKey; - } - } - }); - - return children(props); - } -}); - -function defaultChildren(props) { - return _react2['default'].createElement(_Select2['default'], props); -}; - -function isOptionUnique(_ref3) { - var option = _ref3.option; - var options = _ref3.options; - var labelKey = _ref3.labelKey; - var valueKey = _ref3.valueKey; - - return options.filter(function (existingOption) { - return existingOption[labelKey] === option[labelKey] || existingOption[valueKey] === option[valueKey]; - }).length === 0; -}; - -function isValidNewOption(_ref4) { - var label = _ref4.label; - - return !!label; -}; - -function newOptionCreator(_ref5) { - var label = _ref5.label; - var labelKey = _ref5.labelKey; - var valueKey = _ref5.valueKey; - - var option = {}; - option[valueKey] = label; - option[labelKey] = label; - option.className = 'Select-create-option-placeholder'; - return option; -}; - -function promptTextCreator(label) { - return 'Create option "' + label + '"'; -} - -function shouldKeyDownEventCreateNewOption(_ref6) { - var keyCode = _ref6.keyCode; - - switch (keyCode) { - case 9: // TAB - case 13: // ENTER - case 188: - // COMMA - return true; - } - - return false; -}; - -module.exports = Creatable; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./Select":5,"./utils/defaultFilterOptions":9,"./utils/defaultMenuRenderer":10,"create-react-class":undefined,"prop-types":undefined}],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 _createReactClass = require('create-react-class'); - -var _createReactClass2 = _interopRequireDefault(_createReactClass); - -var _propTypes = require('prop-types'); - -var _propTypes2 = _interopRequireDefault(_propTypes); - -var _classnames = (typeof window !== "undefined" ? window['classNames'] : typeof global !== "undefined" ? global['classNames'] : null); - -var _classnames2 = _interopRequireDefault(_classnames); - -var Option = (0, _createReactClass2['default'])({ - propTypes: { - children: _propTypes2['default'].node, - className: _propTypes2['default'].string, // className (based on mouse position) - instancePrefix: _propTypes2['default'].string.isRequired, // unique prefix for the ids (used for aria) - isDisabled: _propTypes2['default'].bool, // the option is disabled - isFocused: _propTypes2['default'].bool, // the option is focused - isSelected: _propTypes2['default'].bool, // the option is selected - onFocus: _propTypes2['default'].func, // method to handle mouseEnter on option element - onSelect: _propTypes2['default'].func, // method to handle click on option element - onUnfocus: _propTypes2['default'].func, // method to handle mouseLeave on option element - option: _propTypes2['default'].object.isRequired, // object that is base for that option - optionIndex: _propTypes2['default'].number }, - // index of the option, used to generate unique ids for aria - 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 _props = this.props; - var option = _props.option; - var instancePrefix = _props.instancePrefix; - var optionIndex = _props.optionIndex; - - 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, - role: 'option', - onMouseDown: this.handleMouseDown, - onMouseEnter: this.handleMouseEnter, - onMouseMove: this.handleMouseMove, - onTouchStart: this.handleTouchStart, - onTouchMove: this.handleTouchMove, - onTouchEnd: this.handleTouchEnd, - id: instancePrefix + '-option-' + optionIndex, - title: option.title }, - this.props.children - ); - } -}); - -module.exports = Option; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"create-react-class":undefined,"prop-types":undefined}],5:[function(require,module,exports){ -(function (global){ -/*! - Copyright (c) 2016 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/react-select -*/ - -'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 }; } - -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null); - -var _react2 = _interopRequireDefault(_react); - -var _createReactClass = require('create-react-class'); - -var _createReactClass2 = _interopRequireDefault(_createReactClass); - -var _propTypes = require('prop-types'); - -var _propTypes2 = _interopRequireDefault(_propTypes); - -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 _utilsDefaultArrowRenderer = require('./utils/defaultArrowRenderer'); - -var _utilsDefaultArrowRenderer2 = _interopRequireDefault(_utilsDefaultArrowRenderer); - -var _utilsDefaultFilterOptions = require('./utils/defaultFilterOptions'); - -var _utilsDefaultFilterOptions2 = _interopRequireDefault(_utilsDefaultFilterOptions); - -var _utilsDefaultMenuRenderer = require('./utils/defaultMenuRenderer'); - -var _utilsDefaultMenuRenderer2 = _interopRequireDefault(_utilsDefaultMenuRenderer); - -var _utilsDefaultClearRenderer = require('./utils/defaultClearRenderer'); - -var _utilsDefaultClearRenderer2 = _interopRequireDefault(_utilsDefaultClearRenderer); - -var _Async = require('./Async'); - -var _Async2 = _interopRequireDefault(_Async); - -var _AsyncCreatable = require('./AsyncCreatable'); - -var _AsyncCreatable2 = _interopRequireDefault(_AsyncCreatable); - -var _Creatable = require('./Creatable'); - -var _Creatable2 = _interopRequireDefault(_Creatable); - -var _Option = require('./Option'); - -var _Option2 = _interopRequireDefault(_Option); - -var _Value = require('./Value'); - -var _Value2 = _interopRequireDefault(_Value); - -function stringifyValue(value) { - var valueType = typeof value; - if (valueType === 'string') { - return value; - } else if (valueType === 'object') { - return JSON.stringify(value); - } else if (valueType === 'number' || valueType === 'boolean') { - return String(value); - } else { - return ''; - } -} - -var stringOrNode = _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].node]); - -var instanceId = 1; - -var Select = (0, _createReactClass2['default'])({ - - displayName: 'Select', - - propTypes: { - addLabelText: _propTypes2['default'].string, // placeholder displayed when you want to add a label on a multi-value input - 'aria-describedby': _propTypes2['default'].string, // HTML ID(s) of element(s) that should be used to describe this input (for assistive tech) - 'aria-label': _propTypes2['default'].string, // Aria label (for assistive tech) - 'aria-labelledby': _propTypes2['default'].string, // HTML ID of an element that should be used as the label (for assistive tech) - arrowRenderer: _propTypes2['default'].func, // Create drop-down caret element - autoBlur: _propTypes2['default'].bool, // automatically blur the component when an option is selected - autofocus: _propTypes2['default'].bool, // autofocus the component on mount - autosize: _propTypes2['default'].bool, // whether to enable autosizing or not - backspaceRemoves: _propTypes2['default'].bool, // whether backspace removes an item if there is no text input - backspaceToRemoveMessage: _propTypes2['default'].string, // Message to use for screenreaders to press backspace to remove the current item - {label} is replaced with the item label - className: _propTypes2['default'].string, // className for the outer element - clearAllText: stringOrNode, // title for the "clear" control when multi: true - clearRenderer: _propTypes2['default'].func, // create clearable x element - clearValueText: stringOrNode, // title for the "clear" control - clearable: _propTypes2['default'].bool, // should it be possible to reset value - deleteRemoves: _propTypes2['default'].bool, // whether backspace removes an item if there is no text input - delimiter: _propTypes2['default'].string, // delimiter to use to join multiple values for the hidden field value - disabled: _propTypes2['default'].bool, // whether the Select is disabled or not - escapeClearsValue: _propTypes2['default'].bool, // whether escape clears the value when the menu is closed - filterOption: _propTypes2['default'].func, // method to filter a single option (option, filterString) - filterOptions: _propTypes2['default'].any, // boolean to enable default filtering or function to filter the options array ([options], filterString, [values]) - ignoreAccents: _propTypes2['default'].bool, // whether to strip diacritics when filtering - ignoreCase: _propTypes2['default'].bool, // whether to perform case-insensitive filtering - inputProps: _propTypes2['default'].object, // custom attributes for the Input - inputRenderer: _propTypes2['default'].func, // returns a custom input component - instanceId: _propTypes2['default'].string, // set the components instanceId - isAlwaysOpen: _propTypes2['default'].bool, // never close the select - isLoading: _propTypes2['default'].bool, // whether the Select is loading externally or not (such as options being loaded) - joinValues: _propTypes2['default'].bool, // joins multiple values into a single form field with the delimiter (legacy mode) - labelKey: _propTypes2['default'].string, // path of the label value in option objects - matchPos: _propTypes2['default'].string, // (any|start) match the start or entire string when filtering - matchProp: _propTypes2['default'].string, // (any|label|value) which option property to filter on - menuBuffer: _propTypes2['default'].number, // optional buffer (in px) between the bottom of the viewport and the bottom of the menu - menuContainerStyle: _propTypes2['default'].object, // optional style to apply to the menu container - menuRenderer: _propTypes2['default'].func, // renders a custom menu with options - menuStyle: _propTypes2['default'].object, // optional style to apply to the menu - multi: _propTypes2['default'].bool, // multi-value input - name: _propTypes2['default'].string, // generates a hidden tag with this field name for html forms - noResultsText: stringOrNode, // placeholder displayed when there are no matching search results - onBlur: _propTypes2['default'].func, // onBlur handler: function (event) {} - onBlurResetsInput: _propTypes2['default'].bool, // whether input is cleared on blur - onChange: _propTypes2['default'].func, // onChange handler: function (newValue) {} - onClose: _propTypes2['default'].func, // fires when the menu is closed - onCloseResetsInput: _propTypes2['default'].bool, // whether input is cleared when menu is closed through the arrow - onFocus: _propTypes2['default'].func, // onFocus handler: function (event) {} - onInputChange: _propTypes2['default'].func, // onInputChange handler: function (inputValue) {} - onInputKeyDown: _propTypes2['default'].func, // input keyDown handler: function (event) {} - onMenuScrollToBottom: _propTypes2['default'].func, // fires when the menu is scrolled to the bottom; can be used to paginate options - onOpen: _propTypes2['default'].func, // fires when the menu is opened - onValueClick: _propTypes2['default'].func, // onClick handler for value labels: function (value, event) {} - openAfterFocus: _propTypes2['default'].bool, // boolean to enable opening dropdown when focused - openOnFocus: _propTypes2['default'].bool, // always open options menu on focus - optionClassName: _propTypes2['default'].string, // additional class(es) to apply to the