<commit_before>import React, { Component, PropTypes } from 'react';
import styles from '../Chat.css';
import TextareaAutosize from 'react-textarea-autosize';
import UserMenu from './UserMenu';

export default class ChatInput extends Component {
  static propTypes = {
    onMessage: PropTypes.func
  };
  componentDidMount = () => {
    let node = document.getElementsByTagName('ul')[0];
    node.style.visibility = 'hidden';
  };
  hideMenu = (e) => {
    let node = document.getElementsByTagName('ul')[0];
    let iconMenu = document.getElementById('iconMenu');
    if (node.style.visibility === 'hidden') {
      iconMenu.className = 'icon-keyboard-arrow-up';
      node.style.visibility = 'visible';
    } else {
      iconMenu.className = 'icon-keyboard-arrow-down';
      node.style.visibility = 'hidden';
    }
  };
  render() {
    const onMessage = this.props.onMessage;
    return (<div className={styles.chatInpContainer}>
        <div className={styles.chatOptions} onClick={this.hideMenu}>
          <UserMenu/>
          <div id="iconMenu" className="icon-keyboard-arrow-down"></div>
        </div>
        <TextareaAutosize className={styles.usermsg} autoFocus onKeyPress={
      function(e) {
        if (e.nativeEvent.keyCode !== 13 || e.shiftKey) return;
        e.preventDefault();
        const input = e.target;
        const txt = input.value;
        if (txt === '') return;
        onMessage({ txt: txt }, function success() {
          input.value = '';
        });
      }
      }/>
      </div>
    );
  }
}<commit_msg>Close menu when it's hovered over with timeout<commit_after>import React, { Component, PropTypes } from 'react';
import styles from '../Chat.css';
import TextareaAutosize from 'react-textarea-autosize';
import UserMenu from './UserMenu';

export default class ChatInput extends Component {
  static propTypes = {
    onMessage: PropTypes.func
  };
  componentDidMount = () => {
    let node = document.getElementsByTagName('ul')[0];
    node.style.visibility = 'hidden';
  };
  hideMenu = (e) => {
    const node = document.getElementsByTagName('ul')[0];
    const iconMenu = document.getElementById('iconMenu');
    let menuTimer = 0;
    if (node.style.visibility === 'hidden') {
      iconMenu.className = 'icon-keyboard-arrow-up';
      node.style.visibility = 'visible';

      e.currentTarget.addEventListener('mouseleave', function() {
        menuTimer = setTimeout(function() {
          iconMenu.className = 'icon-keyboard-arrow-down';
          node.style.visibility = 'hidden';
        }, 2000);
      });

      e.currentTarget.addEventListener('mouseenter', function() {
        clearTimeout(menuTimer);
      });
    } else {
      iconMenu.className = 'icon-keyboard-arrow-down';
      node.style.visibility = 'hidden';
    }
  };
  render() {
    const onMessage = this.props.onMessage;
    return (<div className={styles.chatInpContainer}>
        <div className={styles.chatOptions} onClick={this.hideMenu}>
          <UserMenu/>
          <div id="iconMenu" className="icon-keyboard-arrow-down"></div>
        </div>
        <TextareaAutosize className={styles.usermsg} autoFocus onKeyPress={
      function(e) {
        if (e.nativeEvent.keyCode !== 13 || e.shiftKey) return;
        e.preventDefault();
        const input = e.target;
        const txt = input.value;
        if (txt === '') return;
        onMessage({ txt: txt }, function success() {
          input.value = '';
        });
      }
      }/>
      </div>
    );
  }
}
{'fraction_non_alphanumeric': 0.1475456621004566, 'fraction_numerical': 0.0037100456621004564, 'mean_word_length': 2.7406616862326576, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4122729', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1020, 'n_words': 214}