'use client'; import React, { ComponentPropsWithRef, useEffect, useImperativeHandle, useRef } from 'react'; import styled from 'styled-components'; export type CustomSelectInputProps = ComponentPropsWithRef<'input'> & { visible: boolean; onBlur: (event: React.FocusEvent) => void; onFocus: (event: React.FocusEvent) => void; }; const StyledInput = styled.input` position: fixed; top: -10000px; left: -10000px; opacity: 0; z-index: -1; width: 0; height: 0; padding: 0; font-size: 0; border: none; `; export const CustomSelectInput = React.forwardRef(({ visible, id, name, onBlur, onFocus, }, inputRef) => { const ref = useRef(null); useImperativeHandle(inputRef, () => ref.current); useEffect(() => { if (visible) { ref.current?.focus(); } }, [visible]); return ( ); }); CustomSelectInput.displayName = 'CustomSelectInput';