<commit_before>import React, { useState, ReactNode } from 'react';
import { generateUID, usePopperAnchor, DropdownButton, Dropdown } from 'react-components';

interface LockableDropdownProps {
    onClose: () => void;
    onLock: (lock: boolean) => void;
}

interface Props {
    content?: ReactNode;
    children: (props: LockableDropdownProps) => ReactNode;
    autoClose?: boolean;
    [rest: string]: any;
}

const HeaderDropdown = ({ content, children, autoClose, ...rest }: Props) => {
    const [uid] = useState(generateUID('dropdown'));
    const [lock, setLock] = useState(false);

    const { anchorRef, isOpen, toggle, close } = usePopperAnchor();

    return (
        <>
            <DropdownButton {...rest} buttonRef={anchorRef} isOpen={isOpen} onClick={toggle} caretClassName={null}>
                {content}
            </DropdownButton>
            <Dropdown
                id={uid}
                originalPlacement="bottom"
                availablePlacements={['bottom', 'top']}
                autoClose={autoClose}
                autoCloseOutside={!lock}
                isOpen={isOpen}
                anchorRef={anchorRef}
                onClose={close}
            >
                {children({ onClose: close, onLock: setLock })}
            </Dropdown>
        </>
    );
};

export default HeaderDropdown;<commit_msg>Remove unneeded caret prop on HeaderDropdown<commit_after>import React, { useState, ReactNode } from 'react';
import { generateUID, usePopperAnchor, DropdownButton, Dropdown } from 'react-components';

interface LockableDropdownProps {
    onClose: () => void;
    onLock: (lock: boolean) => void;
}

interface Props {
    content?: ReactNode;
    children: (props: LockableDropdownProps) => ReactNode;
    autoClose?: boolean;
    [rest: string]: any;
}

const HeaderDropdown = ({ content, children, autoClose, ...rest }: Props) => {
    const [uid] = useState(generateUID('dropdown'));
    const [lock, setLock] = useState(false);

    const { anchorRef, isOpen, toggle, close } = usePopperAnchor();

    return (
        <>
            <DropdownButton {...rest} buttonRef={anchorRef} isOpen={isOpen} onClick={toggle}>
                {content}
            </DropdownButton>
            <Dropdown
                id={uid}
                originalPlacement="bottom"
                availablePlacements={['bottom', 'top']}
                autoClose={autoClose}
                autoCloseOutside={!lock}
                isOpen={isOpen}
                anchorRef={anchorRef}
                onClose={close}
            >
                {children({ onClose: close, onLock: setLock })}
            </Dropdown>
        </>
    );
};

export default HeaderDropdown;
{'fraction_non_alphanumeric': 0.1288298265042451, 'fraction_numerical': 0.0, 'mean_word_length': 2.317013463892289, 'pattern_counts': {'":': 0, '<': 15, '<?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': '4442580', 'n_tokens_mistral': 763, 'n_tokens_neox': 734, 'n_words': 167}