From 2826c89389616a86c8dba8b16367ac00506ce893 Mon Sep 17 00:00:00 2001 From: Evan Brodie Date: Sun, 16 Jul 2017 17:24:50 -0400 Subject: [PATCH 1/4] exports prop types for Select component --- src/Select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Select.js b/src/Select.js index 14818e0302..5751ed370a 100644 --- a/src/Select.js +++ b/src/Select.js @@ -1041,7 +1041,7 @@ class Select extends React.Component { } }; -Select.propTypes = { +export const selectPropTypes = Select.propTypes = { addLabelText: PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input 'aria-describedby': PropTypes.string, // HTML ID(s) of element(s) that should be used to describe this input (for assistive tech) 'aria-label': PropTypes.string, // Aria label (for assistive tech) From 7a8bc5b5eeed8883a959200b88807f97fab5b203 Mon Sep 17 00:00:00 2001 From: Evan Brodie Date: Sun, 16 Jul 2017 17:40:31 -0400 Subject: [PATCH 2/4] adds .nvmrc, setting the project's Node version to latest v4 --- .nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..57c4b30bba --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +4.8.4 From f9b4439c59d55ff64f1830e5dbae5dfde6f7c8b3 Mon Sep 17 00:00:00 2001 From: Evan Brodie Date: Sun, 16 Jul 2017 23:45:25 -0400 Subject: [PATCH 3/4] extract SelectPropTypes into its own file and default export Due to how the ES6 code is being transpiled, the exports statement in the Select component lib file were breaking tests. --- src/Select.js | 81 ++------------------------------ src/index.js | 4 +- src/propTypes/SelectPropTypes.js | 81 ++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 79 deletions(-) create mode 100644 src/propTypes/SelectPropTypes.js diff --git a/src/Select.js b/src/Select.js index 5751ed370a..cc8e3365b1 100644 --- a/src/Select.js +++ b/src/Select.js @@ -5,7 +5,6 @@ */ import React from 'react'; -import PropTypes from 'prop-types'; import ReactDOM from 'react-dom'; import AutosizeInput from 'react-input-autosize'; import classNames from 'classnames'; @@ -18,6 +17,8 @@ import defaultClearRenderer from './utils/defaultClearRenderer'; import Option from './Option'; import Value from './Value'; +import SelectPropTypes from './propTypes/SelectPropTypes'; + function stringifyValue (value) { const valueType = typeof value; if (valueType === 'string') { @@ -31,11 +32,6 @@ function stringifyValue (value) { } } -const stringOrNode = PropTypes.oneOfType([ - PropTypes.string, - PropTypes.node -]); - let instanceId = 1; class Select extends React.Component { @@ -1041,78 +1037,7 @@ class Select extends React.Component { } }; -export const selectPropTypes = Select.propTypes = { - addLabelText: PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input - 'aria-describedby': PropTypes.string, // HTML ID(s) of element(s) that should be used to describe this input (for assistive tech) - 'aria-label': PropTypes.string, // Aria label (for assistive tech) - 'aria-labelledby': PropTypes.string, // HTML ID of an element that should be used as the label (for assistive tech) - arrowRenderer: PropTypes.func, // Create drop-down caret element - autoBlur: PropTypes.bool, // automatically blur the component when an option is selected - autofocus: PropTypes.bool, // autofocus the component on mount - autosize: PropTypes.bool, // whether to enable autosizing or not - backspaceRemoves: PropTypes.bool, // whether backspace removes an item if there is no text input - backspaceToRemoveMessage: PropTypes.string, // Message to use for screenreaders to press backspace to remove the current item - {label} is replaced with the item label - className: PropTypes.string, // className for the outer element - clearAllText: stringOrNode, // title for the "clear" control when multi: true - clearRenderer: PropTypes.func, // create clearable x element - clearValueText: stringOrNode, // title for the "clear" control - clearable: PropTypes.bool, // should it be possible to reset value - deleteRemoves: PropTypes.bool, // whether backspace removes an item if there is no text input - delimiter: PropTypes.string, // delimiter to use to join multiple values for the hidden field value - disabled: PropTypes.bool, // whether the Select is disabled or not - escapeClearsValue: PropTypes.bool, // whether escape clears the value when the menu is closed - filterOption: PropTypes.func, // method to filter a single option (option, filterString) - filterOptions: PropTypes.any, // boolean to enable default filtering or function to filter the options array ([options], filterString, [values]) - ignoreAccents: PropTypes.bool, // whether to strip diacritics when filtering - ignoreCase: PropTypes.bool, // whether to perform case-insensitive filtering - inputProps: PropTypes.object, // custom attributes for the Input - inputRenderer: PropTypes.func, // returns a custom input component - instanceId: PropTypes.string, // set the components instanceId - isLoading: PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded) - joinValues: PropTypes.bool, // joins multiple values into a single form field with the delimiter (legacy mode) - labelKey: PropTypes.string, // path of the label value in option objects - matchPos: PropTypes.string, // (any|start) match the start or entire string when filtering - matchProp: PropTypes.string, // (any|label|value) which option property to filter on - menuBuffer: PropTypes.number, // optional buffer (in px) between the bottom of the viewport and the bottom of the menu - menuContainerStyle: PropTypes.object, // optional style to apply to the menu container - menuRenderer: PropTypes.func, // renders a custom menu with options - menuStyle: PropTypes.object, // optional style to apply to the menu - multi: PropTypes.bool, // multi-value input - name: PropTypes.string, // generates a hidden tag with this field name for html forms - noResultsText: stringOrNode, // placeholder displayed when there are no matching search results - onBlur: PropTypes.func, // onBlur handler: function (event) {} - onBlurResetsInput: PropTypes.bool, // whether input is cleared on blur - onChange: PropTypes.func, // onChange handler: function (newValue) {} - onClose: PropTypes.func, // fires when the menu is closed - onCloseResetsInput: PropTypes.bool, // whether input is cleared when menu is closed through the arrow - onFocus: PropTypes.func, // onFocus handler: function (event) {} - onInputChange: PropTypes.func, // onInputChange handler: function (inputValue) {} - onInputKeyDown: PropTypes.func, // input keyDown handler: function (event) {} - onMenuScrollToBottom: PropTypes.func, // fires when the menu is scrolled to the bottom; can be used to paginate options - onOpen: PropTypes.func, // fires when the menu is opened - onValueClick: PropTypes.func, // onClick handler for value labels: function (value, event) {} - openAfterFocus: PropTypes.bool, // boolean to enable opening dropdown when focused - openOnFocus: PropTypes.bool, // always open options menu on focus - optionClassName: PropTypes.string, // additional class(es) to apply to the