import React, { forwardRef, useId, useState } from "react"; import classNames from "@calcom/lib/classNames"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Skeleton } from "../../.."; import { X } from "../../icon"; import { HintsOrErrors } from "./HintOrErrors"; import { Label } from "./Label"; import type { InputFieldProps, InputProps } from "./types"; export const Input = forwardRef(function Input( { isFullWidth = true, ...props }, ref ) { return ( ); }); type AddonProps = { children: React.ReactNode; isFilled?: boolean; className?: string; error?: boolean; }; const Addon = ({ isFilled, children, className, error }: AddonProps) => (
{children}
); export const InputField = forwardRef(function InputField(props, ref) { const id = useId(); const { t: _t, isLocaleReady, i18n } = useLocale(); const t = props.t || _t; const name = props.name || ""; const { label = t(name), labelProps, labelClassName, disabled, LockedIcon, placeholder = isLocaleReady && i18n.exists(name + "_placeholder") ? t(name + "_placeholder") : "", className, addOnLeading, addOnSuffix, addOnFilled = true, addOnClassname, inputIsFullWidth, hint, type, hintErrors, labelSrOnly, containerClassName, readOnly, showAsteriskIndicator, // eslint-disable-next-line @typescript-eslint/no-unused-vars t: __t, ...passThrough } = props; const [inputValue, setInputValue] = useState(""); return (
{!!name && ( {label} {showAsteriskIndicator && !readOnly && passThrough.required ? ( * ) : null} {LockedIcon} )} {addOnLeading || addOnSuffix ? (
{addOnLeading && ( {addOnLeading} )} { setInputValue(e.target.value); props.onChange && props.onChange(e); }, value: inputValue, })} disabled={readOnly || disabled} ref={ref} /> {addOnSuffix && ( {addOnSuffix} )} {type === "search" && inputValue?.toString().length > 0 && ( { setInputValue(""); props.onChange && props.onChange(e as unknown as React.ChangeEvent); }} /> )}
) : ( )} {hint &&
{hint}
}
); }); export const TextField = forwardRef(function TextField(props, ref) { return ; });