toggle-corp/react-store

View on GitHub
v2/Input/RawInput/index.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import React, { forwardRef } from 'react';
import { _cs } from '@togglecorp/fujs';

import styles from './styles.scss';

/*
# Breaking Change
- Remove elementRef prop, and use React.forwardRef
*/

interface Props extends Omit<React.HTMLProps<HTMLInputElement>, 'ref'> {
    className?: string;
}

function RawInput(props: Props, ref: React.Ref<HTMLInputElement>) {
    const {
        className: classNameFromProps,
        ...otherProps
    } = props;

    const className = _cs(
        classNameFromProps,
        styles.rawInput,
        'raw-input',
    );

    return (
        <input
            ref={ref}
            className={className}
            {...otherProps}
        />
    );
}

export default forwardRef(RawInput);