<commit_before>import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';

class DropDown extends React.Component {
  constructor(props) {
    super(props);
    this.toggleDropDown = this.toggleDropDown.bind(this);
    this.handleDocumentClick = this.handleDocumentClick.bind(this);
  }

  componentWillMount() {
    this.props.container.addEventListener('click', this.handleDocumentClick, false);
  }

  componentWillUnmount() {
    this.props.container.removeEventListener('click', this.handleDocumentClick, false);
  }

  handleDocumentClick(event) {
    // If this dropdown is open, and it's not an element within this dropdown being clicked,
    // then the user clicked elsewhere and we should invoke the click handler to toggle this
    // dropdown to closed.
    if (this.props.isOpen && !this.dropdownDiv.contains(event.target)) {
      this.props.clickHandler();
    }
  }

  toggleDropDown() {<commit_msg>Update document click-handler<commit_after>import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';

class DropDown extends React.Component {
  constructor(props) {
    super(props);
    this.toggleDropDown = this.toggleDropDown.bind(this);
    this.handleDocumentClick = this.handleDocumentClick.bind(this);
  }

  componentWillMount() {
    this.props.container.addEventListener('click', this.handleDocumentClick, false);
  }

  componentWillUnmount() {
    this.props.container.removeEventListener('click', this.handleDocumentClick, false);
  }

  handleDocumentClick(event) {
    // If this dropdown is open, and it's not an element within this dropdown being clicked,
    // then the user clicked elsewhere and we should invoke the click handler to toggle this
    // dropdown to closed.
    if (this.props.isOpen && !this.dropdownDiv.contains(event.target)) {
      this.props.toggleDropDown();
    }
  }

  toggleDropDown() {
{'fraction_non_alphanumeric': 0.10610766045548654, 'fraction_numerical': 0.0, 'mean_word_length': 4.168449197860962, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '656041', 'n_tokens_mistral': 536, 'n_tokens_neox': 521, 'n_words': 140}