import { forwardRef, type MouseEvent } from "react"; import clsx from "clsx"; import CloseIcon from "@mui/icons-material/Close"; import CalendarMonthIcon from "@mui/icons-material/CalendarMonth"; import SettingsIcon from "@mui/icons-material/Settings"; import RdsInput from "../../raaghu-elements/rds-input/rds-input"; interface CustomInputWithClearProps { value?: string; onClick?: () => void; placeholder?: string; isDisabled?: boolean; showClearDate?: boolean; clearDate?: () => void; changeIcon?: string; openCustomPicker?: () => void; } export const CustomInputWithClear = forwardRef( ( { value, onClick, placeholder, isDisabled, showClearDate, clearDate, changeIcon, openCustomPicker, }, ref ) => { const handleTriggerClick = (e: MouseEvent) => { e.stopPropagation(); if (isDisabled) return; if (typeof openCustomPicker === "function") { openCustomPicker(); } else if (typeof onClick === "function") { onClick(); } }; const isEmpty = !value || value === ""; return (
{showClearDate && value && ( )}
); } ); CustomInputWithClear.displayName = "CustomInputWithClear";