@@ -12,13 +12,13 @@ import {
1212 squashAtomCommandFailure ,
1313} from "@t3tools/client-runtime/state/runtime" ;
1414import type { EnvironmentId , OrchestrationV2ProjectedTurnItem } from "@t3tools/contracts" ;
15- import { CheckIcon , LockIcon , MinusIcon , ShieldCheckIcon } from "lucide-react" ;
15+ import { CheckIcon , EyeIcon , EyeOffIcon , LockIcon , MinusIcon , ShieldCheckIcon } from "lucide-react" ;
1616import { useId , useRef , useState , type FormEvent } from "react" ;
1717
1818import { serverEnvironment } from "../../state/server" ;
1919import { useAtomCommand } from "../../state/use-atom-command" ;
2020import { Button } from "../ui/button" ;
21- import { Input } from "../ui/input" ;
21+ import { InputGroup , InputGroupAddon , InputGroupInput } from "../ui/input-group " ;
2222import { WorkLogRow } from "./WorkLog" ;
2323
2424export function SecretRequestCard ( props : {
@@ -65,6 +65,7 @@ function PendingSecretRequestForm(props: {
6565 reportDefect : false ,
6666 } ) ;
6767 const [ secret , setSecret ] = useState ( "" ) ;
68+ const [ revealed , setRevealed ] = useState ( false ) ;
6869 const [ submitting , setSubmitting ] = useState ( false ) ;
6970 const [ error , setError ] = useState < string | null > ( null ) ;
7071 // Enter and click can both submit before a render.
@@ -84,6 +85,7 @@ function PendingSecretRequestForm(props: {
8485 } ) ;
8586 if ( result . _tag === "Success" ) {
8687 setSecret ( "" ) ;
88+ setRevealed ( false ) ;
8789 return ;
8890 }
8991 if ( ! isAtomCommandInterrupted ( result ) ) {
@@ -122,25 +124,39 @@ function PendingSecretRequestForm(props: {
122124 </ div >
123125 < div className = "flex min-w-0 items-center gap-2" >
124126 < div className = "min-w-0 flex-1" >
125- < Input
126- id = { inputId }
127- // Password fields prompt to save credentials; this secret is not a login.
128- type = "text"
129- className = "[-webkit-text-security:disc]"
130- autoComplete = "off"
131- autoCorrect = "off"
132- autoCapitalize = "off"
133- spellCheck = { false }
134- data-1p-ignore
135- data-lpignore = "true"
136- data-bwignore
137- placeholder = { item . placeholder ?? SECRET_REQUEST_DEFAULT_PLACEHOLDER }
138- value = { secret }
139- disabled = { submitting }
140- aria-invalid = { error !== null || undefined }
141- aria-describedby = { error !== null ? `${ privacyId } ${ errorId } ` : privacyId }
142- onChange = { ( event ) => setSecret ( event . currentTarget . value ) }
143- />
127+ < InputGroup >
128+ < InputGroupInput
129+ id = { inputId }
130+ type = { revealed ? "text" : "password" }
131+ autoComplete = "off"
132+ autoCorrect = "off"
133+ autoCapitalize = "off"
134+ spellCheck = { false }
135+ data-1p-ignore
136+ data-lpignore = "true"
137+ data-bwignore
138+ placeholder = { item . placeholder ?? SECRET_REQUEST_DEFAULT_PLACEHOLDER }
139+ value = { secret }
140+ disabled = { submitting }
141+ aria-invalid = { error !== null || undefined }
142+ aria-describedby = { error !== null ? `${ privacyId } ${ errorId } ` : privacyId }
143+ onChange = { ( event ) => setSecret ( event . currentTarget . value ) }
144+ />
145+ < InputGroupAddon align = "inline-end" >
146+ < Button
147+ type = "button"
148+ size = "icon-xs"
149+ variant = "ghost-muted"
150+ aria-label = { revealed ? "Hide secret" : "Show secret" }
151+ aria-controls = { inputId }
152+ aria-pressed = { revealed }
153+ disabled = { submitting }
154+ onClick = { ( ) => setRevealed ( ( current ) => ! current ) }
155+ >
156+ { revealed ? < EyeOffIcon /> : < EyeIcon /> }
157+ </ Button >
158+ </ InputGroupAddon >
159+ </ InputGroup >
144160 </ div >
145161 < Button type = "submit" disabled = { submitting || secret . trim ( ) . length === 0 } >
146162 Save securely
0 commit comments