<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import styles from './input-group.scss';

function InputGroup({className, children, addon, id, ...props}) {
    props.className = cx(styles['input-group'], className);

    return (
        <div {...props} >
            <span className={styles['input-group-addon']} id={id}>{addon}</span>
            {children}
        </div>
    );
}

InputGroup.propTypes = {
    children: PropTypes.node,
    className: PropTypes.string,
    addon: PropTypes.node,
    id: PropTypes.string
};

export default InputGroup;<commit_msg>Allow defining addon position for InputGroups<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import styles from './input-group.scss';

function InputGroup({className, children, addon, addonPosition, id, ...props}) {
    props.className = cx(styles['input-group'], className);

    if (addonPosition === undefined || addonPosition === 'left') {
        return (
            <div {...props} >
                <span className={styles['input-group-addon']} id={id}>{addon}</span>
                {children}
            </div>
        );
    } else if (addonPosition === 'right') {
        return (
            <div {...props} >
                {children}
                <span className={styles['input-group-addon']} id={id}>{addon}</span>
            </div>
        );
    }
}

const ADDON_POSITIONS = [
    'left',
    'right'
];

InputGroup.propTypes = {
    children: PropTypes.node,
    className: PropTypes.string,
    addon: PropTypes.node,
    addonPosition: PropTypes.oneOf(ADDON_POSITIONS),
    id: PropTypes.string
};

export default InputGroup;
{'fraction_non_alphanumeric': 0.15092165898617513, 'fraction_numerical': 0.0, 'mean_word_length': 2.71948608137045, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3136181', 'n_tokens_mistral': 510, 'n_tokens_neox': 513, 'n_words': 118}