import React from 'react';

import Body from '../api-components/Body.js';

class BodyInput extends React.Component {
  constructor(props) {
    super(props);
    this.state = { text: props.body };
    this.onInputChange = this.onInputChange.bind(this);
  }

  onInputChange(evt) {
    this.setState({ text: evt.target.value });
  }

  render() {
    const { namespace, ...others } = this.props;

    return (
      <div>
        <input
          type='text'
          value={this.state.text}
          onChange={this.onInputChange}
        />
        <Body
          {...others}
          namespace={namespace}
          body={this.state.text}
        />
      </div>
    );
  }
}

BodyInput.propTypes = {
  body: React.PropTypes.string,
  namespace: React.PropTypes.string,
};

BodyInput.defaultProps = {
  body: '',
  namespace: 'default',
};

export default BodyInput;

@@ -5,16 +5,31 @@
 rt React
+, %7B Component %7D
  from 'r
@@ -33,19 +33,74 @@
  'react'
-;
 %0A%0A
+import SearchActions from '../../actions/SearchActions'%0A
 import B
@@ -116,12 +116,11 @@
 '../
-api-
+../
 comp
@@ -134,13 +134,108 @@
 Body
-.js';
+'%0Aimport PageActions from '../../actions/PageActions'%0Aimport PageStore from '../../stores/PageStore'
 %0A%0Acl
@@ -256,22 +256,16 @@
 extends 
-React.
 Componen
@@ -307,17 +307,16 @@
 r(props)
-;
 %0A    thi
@@ -343,15 +343,14 @@
 ops.
-body
+text
  %7D
-;
 %0A   
@@ -353,29 +353,24 @@
 %0A    this.on
-Input
 Change = thi
@@ -369,29 +369,24 @@
 ge = this.on
-Input
 Change.bind(
@@ -390,17 +390,16 @@
 nd(this)
-;
 %0A  %7D%0A%0A  
@@ -400,21 +400,16 @@
  %7D%0A%0A  on
-Input
 Change(e
@@ -414,24 +414,312 @@
 (evt) %7B%0A    
+const text = evt.target.value%0A    if (text.length === 0 %7C%7C !this.state.text.startsWith(text.slice(0, 3))) %7B%0A      SearchActions.resetTracking()%0A    %7D%0A    if (text !== this.state.text && PageStore.get(this.props.namespace) !== 1) %7B%0A      PageActions.set(this.props.namespace, 1)%0A    %7D%0A    
 this.setStat
@@ -730,30 +730,11 @@
 text
-: evt.target.value
  %7D)
-;
 %0A  %7D
@@ -756,15 +756,118 @@
     
-const %7B
+// Take out text to prevent it going into others%0A    const %7B text: _, minLength, prefixBoosts, containsBoosts,
  nam
@@ -898,18 +898,16 @@
 is.props
-;%0A
 %0A    ret
@@ -942,30 +942,74 @@
 nput
-%0A          type='text'
+ type=%22text%22 onChange=%7Bthis.onChange%7D %7B...others%7D /%3E%0A        %3CBody
 %0A   
@@ -1015,21 +1015,20 @@
         
-value
+text
 =%7Bthis.s
@@ -1052,148 +1052,140 @@
     
-onChange=%7Bthis.onInputChange%7D%0A        /%3E%0A        %3CBody%0A          %7B...others%7D%0A          namespace=%7Bnamespace%7D%0A          body=%7Bthis.state.text
+minLength=%7BminLength%7D%0A          prefixBoosts=%7BprefixBoosts%7D%0A          containsBoosts=%7BcontainsBoosts%7D%0A          namespace=%7Bnamespace
 %7D%0A  
@@ -1211,17 +1211,16 @@
 v%3E%0A    )
-;
 %0A  %7D%0A%7D%0A%0A
@@ -1249,36 +1249,166 @@
 %7B%0A  
-body: React.PropTypes.string
+text: React.PropTypes.string.isRequired,%0A  minLength: React.PropTypes.number,%0A  prefixBoosts: React.PropTypes.object,%0A  containsBoosts: React.PropTypes.object
 ,%0A  
@@ -1443,17 +1443,16 @@
 tring,%0A%7D
-;
 %0A%0ABodyIn
@@ -1478,16 +1478,74 @@
 %7B%0A  
-body: ''
+text: '',%0A  minLength: 3,%0A  prefixBoosts: %7B%7D,%0A  containsBoosts: %7B%7D
 ,%0A  
@@ -1567,17 +1567,16 @@
 ault',%0A%7D
-;
 %0A%0Aexport

Update BodyInput to reflect changes in the SDK