File size: 1,121 Bytes
3201ca6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | import { cn } from "#/utils/utils";
import { formControlInlineInputClassName } from "#/utils/form-control-classes";
interface DropdownInputProps {
placeholder?: string;
isDisabled: boolean;
getInputProps: (props?: object) => object;
/** When false, placeholder hint keeps upright type (e.g. backend selector). */
italicPlaceholder?: boolean;
fitContent?: boolean;
}
export function DropdownInput({
placeholder,
isDisabled,
getInputProps,
italicPlaceholder = true,
fitContent = false,
}: DropdownInputProps) {
return (
<input
{...getInputProps({
placeholder,
disabled: isDisabled,
className: cn(
"outline-none bg-transparent text-white not-italic",
fitContent
? "w-auto field-sizing-content whitespace-nowrap text-sm"
: "flex-1 min-w-0",
italicPlaceholder &&
"placeholder:italic placeholder:text-tertiary-alt",
!italicPlaceholder && "placeholder:text-tertiary-alt",
formControlInlineInputClassName,
"px-0 not-italic text-inherit",
),
})}
/>
);
}
|