<commit_before>import * as React from 'react';
import classNames from 'classnames';

interface IProps {
    checked: boolean;
    label: {
        text: string,
        side?: 'left' | 'right', // defaults to 'right'
    };
    disabled?: boolean;
    onChange(nextValue: boolean): void;
}

export class Checkbox extends React.Component<IProps> {
    constructor(props: IProps) {
        super(props);
        this.handleChange = this.handleChange.bind(this);
        this.handleLabel = this.handleLabel.bind(this);
    }

    handleChange() {
        if (!this.props.disabled) {
            this.props.onChange(!this.props.checked);
        }
    }

    handleLabel() {
        const classes = classNames({
            'sd-label--disabled': this.props.disabled,
            'label--active': this.props.checked,
        });

        return <label className={classes} onClick={this.handleChange}>{this.props.label.text}</label>;
    }

    render() {
        return (
            <span className='sd-check-new__wrapper' label-position={this.props.label.side === 'left' ? 'left' : null}>
                {this.props.label.side === 'left' ? this.handleLabel() : null}
                <span className={'sd-check-new' +
                    (this.props.disabled ? (this.props.checked ? ' sd-check-new--disabled checked' : ' sd-check-new--disabled') :
                        (this.props.checked ? ' checked' : ''))}
                    onClick={this.handleChange}></span>
                {!this.props.label.side ? this.handleLabel() : null}
            </span>
        );
    }
}<commit_msg>react(feat): updated not required label for checkbox component<commit_after>import * as React from 'react';
import classNames from 'classnames';

interface IProps {
    checked: boolean;
    label?: {
        text: string,
        side?: 'left' | 'right', // defaults to 'right'
    };
    disabled?: boolean;
    onChange(nextValue: boolean): void;
}

export class Checkbox extends React.Component<IProps> {
    constructor(props: IProps) {
        super(props);
        this.handleChange = this.handleChange.bind(this);
        this.handleLabel = this.handleLabel.bind(this);
    }

    handleChange() {
        if (!this.props.disabled) {
            this.props.onChange(!this.props.checked);
        }
    }

    handleLabel(text: string) {
        const classes = classNames({
            'sd-label--disabled': this.props.disabled,
            'label--active': this.props.checked,
        });

        return <label className={classes} onClick={this.handleChange}>{text}</label>;
    }

    render() {
        return (
            <span className='sd-check-new__wrapper' label-position={this.props.label ? (this.props.label.side === 'left' ? 'left' : null) : null}>
                {this.props.label ? (this.props.label.side === 'left' ? this.handleLabel(this.props.label.text) : null) : null}
                <span className={'sd-check-new' +
                    (this.props.disabled ? (this.props.checked ? ' sd-check-new--disabled checked' : ' sd-check-new--disabled') :
                        (this.props.checked ? ' checked' : ''))}
                    onClick={this.handleChange}></span>
                {this.props.label? (!this.props.label.side ? this.handleLabel(this.props.label.text) : null) : null}
            </span>
        );
    }
}
{'fraction_non_alphanumeric': 0.15209580838323353, 'fraction_numerical': 0.0, 'mean_word_length': 2.1728395061728394, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '5309604', 'n_tokens_mistral': 965, 'n_tokens_neox': 948, 'n_words': 176}