import clsx from "clsx" import React from "react" import styles from "./input.module.css" type Props = React.HTMLProps & { label?: string width?: number | string height?: number | string labelClassName?: string } // we have two special rules on top of the props: // if onChange or value is passed, we require both // if label is passed, we forbid aria-label and vice versa type InputProps = Omit & ( | { onChange: Props["onChange"] value: Props["value"] } // if onChange or value is passed, we require both | { onChange?: never value?: never } ) & ( | { label: Props["label"] "aria-label"?: never } // if label is passed, we forbid aria-label and vice versa | { label?: never "aria-label": Props["aria-label"] } ) // eslint-disable-next-line react/display-name const Input = React.forwardRef( ({ label, className, width, height, labelClassName, ...props }, ref) => { return (
{label && ( )}
) } ) export default Input