From 06f429cf26cc77eef749c5ec52d4858daa87265d Mon Sep 17 00:00:00 2001 From: Ryan Zec Date: Wed, 1 Jun 2016 14:34:06 -0400 Subject: [PATCH 1/6] adding back in the allowCreate functionality --- examples/src/app.js | 2 + examples/src/components/AllowCreate.js | 61 ++++++++++++++++++++++++++ src/Option.js | 25 ++++++----- src/Select.js | 27 ++++++++++-- test/Select-test.js | 29 +++--------- 5 files changed, 106 insertions(+), 38 deletions(-) create mode 100644 examples/src/components/AllowCreate.js diff --git a/examples/src/app.js b/examples/src/app.js index bfda0ce816..628f34b60f 100644 --- a/examples/src/app.js +++ b/examples/src/app.js @@ -12,6 +12,7 @@ import Multiselect from './components/Multiselect'; import NumericSelect from './components/NumericSelect'; import Virtualized from './components/Virtualized'; import States from './components/States'; +import AllowCreate from './components/AllowCreate'; ReactDOM.render(
@@ -26,6 +27,7 @@ ReactDOM.render( {/* */} +
, document.getElementById('example') ); diff --git a/examples/src/components/AllowCreate.js b/examples/src/components/AllowCreate.js new file mode 100644 index 0000000000..4cab93a320 --- /dev/null +++ b/examples/src/components/AllowCreate.js @@ -0,0 +1,61 @@ +import React from 'react'; +import Select from 'react-select'; + +const 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 AllowCreate = React.createClass({ + displayName: 'AllowCreate', + + propTypes: { + allowCreate: React.PropTypes.bool, + label: React.PropTypes.string, + }, + + getInitialState () { + return { + disabled: false, + crazy: false, + options: FLAVOURS, + value: [], + }; + }, + + onLabelClick (data, event) { + console.log(data, event); + }, + + handleSelectChange (value){ + this.setState({ value }); + }, + + renderHint () { + return ( +
Create options in tag mode
+ ); + }, + + render () { + return ( +
+

{this.props.label}

+