import type { TextInputProps } from "$/types/InputTypes"; import clsx from "clsx"; import { useId } from "react"; export default function PhoneInput({ id, className, inputClassName, labelClassName, name, maxLength, spellCheck, placeholder, value, onChange, onKeyDown, disabled }: Readonly){ const componentId = useId(); const activeId = id ?? componentId; //TODO: Figure out how to setup phone number return (
onChange?.(e.target.value)} onKeyDown={onKeyDown} disabled={disabled} spellCheck={spellCheck} />
); } /* function formatPhoneNumber(phoneNumber: string): string { const chars: string[] = []; // Separate the string into individual characters for(let cnt = 0;cnt < phoneNumber.length;++cnt){ chars.push(phoneNumber.charAt(cnt)); } // Add _ for any chars that don't exist for(let cnt = chars.length;cnt < 10;++cnt){ chars.push("_"); } // Put the values into the correct format return "(" + chars.slice(0, 3).join() + ") " + chars.slice(3, 6).join() + "-" + chars.slice(6).join(); } */