<commit_before>var React = require('react');
var cloneWithProps = require('react/lib/cloneWithProps');
var cx = require('classnames');

var mergeClasses = require('./utils/mergeClasses.js');

var isBoolean = function (data) {
    return (data === true || data === false);
};

var DropdownTrigger = require('./DropdownTrigger.js');
var DropdownContent = require('./DropdownContent.js');

var Dropdown = React.createClass({
    getInitialState: function(){
        return {
            active: false
        };
    },
    componentDidMount: function () {
        window.addEventListener( 'click', this._onWindowClick );
    },
    componentWillUnmount: function () {
        window.removeEventListener( 'click', this._onWindowClick );
    },
    render: function () {
        // create component classes
        var active = this.isActive();
        var classnames_string = this.props.classNames;
        var dropdown_classes_object = mergeClasses({
            dropdown: true,
            'dropdown--active': active
        }, classnames_string);
        var dropdown_classes = cx(dropdown_classes_object);
        // prepare child elements
        var children = React.Children.map( this.props.children, function( child ){
            if( child.type === DropdownTrigger ){
                child = cloneWithProps( child, {
                    ref: 'trigger',
                    onClick: this._onToggleClick
                });
            }
            return child;
        }, this);
        return React.createElement('div', {
            className: dropdown_classes
        }, children);
    },
    isActive: function(){
        return isBoolean(this.props.active) ?
            this.props.active :
            this.state.active;
    },
    hide: function(){
        this.setState({<commit_msg>use a prop that actually exists<commit_after>var React = require('react');
var cloneWithProps = require('react/lib/cloneWithProps');
var cx = require('classnames');

var mergeClasses = require('./utils/mergeClasses.js');

var isBoolean = function (data) {
    return (data === true || data === false);
};

var DropdownTrigger = require('./DropdownTrigger.js');
var DropdownContent = require('./DropdownContent.js');

var Dropdown = React.createClass({
    getInitialState: function(){
        return {
            active: false
        };
    },
    componentDidMount: function () {
        window.addEventListener( 'click', this._onWindowClick );
    },
    componentWillUnmount: function () {
        window.removeEventListener( 'click', this._onWindowClick );
    },
    render: function () {
        // create component classes
        var active = this.isActive();
        var classname = this.props.className || '';
        var dropdown_classes_object = mergeClasses({
            dropdown: true,
            'dropdown--active': active
        }, classname);
        var dropdown_classes = cx(dropdown_classes_object);
        // prepare child elements
        var children = React.Children.map( this.props.children, function( child ){
            if( child.type === DropdownTrigger ){
                child = cloneWithProps( child, {
                    ref: 'trigger',
                    onClick: this._onToggleClick
                });
            }
            return child;
        }, this);
        return React.createElement('div', {
            className: dropdown_classes
        }, children);
    },
    isActive: function(){
        return isBoolean(this.props.active) ?
            this.props.active :
            this.state.active;
    },
    hide: function(){
        this.setState({
{'fraction_non_alphanumeric': 0.12218828103304638, 'fraction_numerical': 0.0, 'mean_word_length': 2.204626334519573, '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': '7342500', 'n_tokens_mistral': 906, 'n_tokens_neox': 895, 'n_words': 210}