'use client' import type { TextFieldClientComponent } from 'payload' import { useState } from 'react' export const MaskedField: TextFieldClientComponent = (props: any) => { const { field, path, value: propValue, setValue: propSetValue, onChange: propOnChange } = props || {} const [internalValue, setInternalValue] = useState(propValue ?? '') const [revealed, setRevealed] = useState(false) const label = typeof field?.label === 'string' ? field.label : (field?.name ?? path) const handleChange = (e: React.ChangeEvent) => { const newVal = e.target.value setInternalValue(newVal) if (typeof propSetValue === 'function') { propSetValue(newVal) } if (typeof propOnChange === 'function') { propOnChange(e) } } const currentValue = propValue !== undefined ? propValue : internalValue return (
{label && }
) } export default MaskedField