File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -301,13 +301,11 @@ export const SecretCreatePage = ({
301301 const value = formData [ field . key as keyof FormData ] as string ;
302302 const hasError =
303303 field . key === "value" && validationError === "Value is required" ;
304- // Display masked value when not active
305- const maskedValue = "*" . repeat ( value . length ) ;
306304 return (
307305 < FormTextInput
308306 key = { field . key }
309307 label = { field . label }
310- value = { isActive ? value : maskedValue }
308+ value = { value }
311309 onChange = { ( newValue ) => {
312310 setFormData ( { ...formData , [ field . key ] : newValue } ) ;
313311 if ( validationError ) {
@@ -318,6 +316,7 @@ export const SecretCreatePage = ({
318316 isActive = { isActive }
319317 placeholder = "Enter secret value"
320318 error = { hasError ? validationError : undefined }
319+ mask = "*"
321320 />
322321 ) ;
323322 }
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ export interface FormTextInputProps {
1616 error ?: string ;
1717 /** Called when Enter is pressed in the text input */
1818 onSubmit ?: ( ) => void ;
19+ /** Character to mask input with (e.g., "*" for passwords) */
20+ mask ?: string ;
1921}
2022
2123export const FormTextInput = ( {
@@ -26,7 +28,11 @@ export const FormTextInput = ({
2628 placeholder,
2729 error,
2830 onSubmit,
31+ mask,
2932} : FormTextInputProps ) => {
33+ // Display value: use mask character if provided
34+ const displayValue = mask && value ? mask . repeat ( value . length ) : value ;
35+
3036 return (
3137 < FormField label = { label } isActive = { isActive } error = { error } >
3238 { isActive ? (
@@ -35,10 +41,11 @@ export const FormTextInput = ({
3541 onChange = { onChange }
3642 placeholder = { placeholder }
3743 onSubmit = { onSubmit }
44+ mask = { mask }
3845 />
3946 ) : (
4047 < Text color = { error ? colors . error : colors . text } >
41- { value || "(empty)" }
48+ { displayValue || "(empty)" }
4249 </ Text >
4350 ) }
4451 </ FormField >
You can’t perform that action at this time.
0 commit comments