@@ -58,21 +58,28 @@ export function AIChatInput(props: {
5858
5959 return (
6060 < Input
61+ data-testid = "ai-chat-input"
62+ name = "ai-chat-input"
6163 multiline
62- label = "Assistant input"
64+ label = "Assistant chat input"
6365 placeholder = { tString ( language , 'ai_chat_input_placeholder' ) }
6466 onChange = { handleInput }
6567 onSubmit = { ( ) => onSubmit ( value ) }
6668 value = { value }
67- leading = "magnifying-glass"
6869 submitButton = { {
6970 label : tString ( language , 'send' ) ,
7071 } }
72+ className = "animate-blur-in-slow bg-tint-base/9 backdrop-blur-lg contrast-more:bg-tint-base"
73+ rows = { 1 }
7174 keyboardShortcut = {
72- < div className = "peer-focus:hidden" >
73- < KeyboardShortcut keys = { [ 'mod' , 'i' ] } className = "bg-tint-base" />
74- </ div >
75+ ! value && ! disabled && ! loading ? (
76+ < div className = "group-focus-within/input:hidden" >
77+ < KeyboardShortcut keys = { [ 'mod' , 'i' ] } className = "bg-tint-base" />
78+ </ div >
79+ ) : undefined
7580 }
81+ disabled = { disabled || loading }
82+ aria-busy = { loading }
7683 ref = { inputRef }
7784 trailing = {
7885 < HoverCardRoot openDelay = { 500 } >
@@ -102,7 +109,7 @@ export function AIChatInput(props: {
102109 </ div >
103110 </ HoverCard >
104111 < HoverCardTrigger >
105- < div className = "-ml-2 flex cursor-help items-center gap-1 circular-corners:rounded-2xl rounded-corners:rounded-md px-2.5 py-1.5 text-tint/7 text-xs transition-all hover:bg-tint" >
112+ < div className = "flex cursor-help items-center gap-1 circular-corners:rounded-2xl rounded-corners:rounded-md px-2.5 py-1.5 text-tint/7 text-xs transition-all hover:bg-tint" >
106113 < span className = "-ml-1 circular-corners:rounded-2xl rounded-corners:rounded-sm bg-tint-11/7 px-1 py-0.5 font-mono font-semibold text-[0.65rem] text-contrast-tint-11 leading-none" >
107114 { t ( language , 'ai_chat_context_badge' ) }
108115 </ span > { ' ' }
@@ -115,103 +122,5 @@ export function AIChatInput(props: {
115122 </ HoverCardRoot >
116123 }
117124 />
118- // <div className="depth-subtle:has-[textarea:focus]:-translate-y-px relative flex animate-blur-in-slow flex-col overflow-hidden circular-corners:rounded-3xl rounded-corners:rounded-xl bg-tint-base/9 depth-subtle:shadow-sm shadow-tint/6 ring-1 ring-tint-subtle backdrop-blur-lg transition-all depth-subtle:has-[textarea:focus]:shadow-lg has-[textarea:focus]:shadow-primary-subtle has-[textarea:focus]:ring-2 has-[textarea:focus]:ring-primary-hover contrast-more:bg-tint-base dark:shadow-tint-1">
119- // {/* <textarea
120- // ref={inputRef}
121- // disabled={disabled || loading}
122- // data-loading={loading}
123- // data-testid="ai-chat-input"
124- // className={tcls(
125- // 'resize-none',
126- // 'focus:outline-hidden',
127- // 'focus:ring-0',
128- // 'w-full',
129- // 'px-3',
130- // 'py-3',
131- // 'pb-12',
132- // 'h-auto',
133- // 'bg-transparent',
134- // 'peer',
135- // 'max-h-64',
136- // 'placeholder:text-tint/8',
137- // 'transition-colors',
138- // 'disabled:bg-tint-subtle',
139- // 'delay-300',
140- // 'disabled:delay-0',
141- // 'disabled:cursor-not-allowed',
142- // 'data-[loading=true]:cursor-progress',
143- // 'data-[loading=true]:opacity-50'
144- // )}
145- // value={value}
146- // rows={1}
147- // placeholder={tString(language, 'ai_chat_input_placeholder')}
148- // onChange={handleInput}
149- // onKeyDown={(event) => {
150- // if (event.key === 'Escape') {
151- // event.preventDefault();
152- // event.currentTarget.blur();
153- // return;
154- // }
155-
156- // if (event.key === 'Enter' && !event.shiftKey && value.trim()) {
157- // event.preventDefault();
158- // event.currentTarget.style.height = 'auto';
159- // onSubmit(value);
160- // }
161- // }}
162- // /> */ }
163- // {/* {!disabled ? (
164- // <div className="absolute top-2.5 right-3 animate-[fadeIn_0.2s_0.5s_ease-in-out_both] peer-focus:hidden">
165- // <KeyboardShortcut keys={['mod', 'i']} className="bg-tint-base" />
166- // </div>
167- // ) : null} */ }
168- // <div className="absolute inset-x-0 bottom-0 flex items-center gap-2 px-2 py-2">
169- // <HoverCardRoot openDelay={500}>
170- // <HoverCard
171- // className="max-w-xs bg-tint p-2 text-sm text-tint"
172- // arrow={{ className: 'fill-tint-3' }}
173- // >
174- // <div className="flex flex-col gap-3 p-2">
175- // <p className="font-semibold">
176- // {t(language, 'ai_chat_context_description')}
177- // </p>
178- // <ul className="flex flex-col gap-2">
179- // <li className="flex items-center gap-2">
180- // <Icon icon="memo" className="size-3.5 opacity-7" />
181- // {t(language, 'ai_chat_context_pages_youve_read')}
182- // </li>
183- // <li className="flex items-center gap-2">
184- // <Icon icon="user" className="size-3.5 opacity-7" />
185- // {t(language, 'ai_chat_context_info_provided_by_the_site')}
186- // </li>
187- // <li className="flex items-center gap-2">
188- // <Icon icon="message-question" className="size-3.5 opacity-7" />
189- // {t(language, 'ai_chat_context_previous_messages')}
190- // </li>
191- // </ul>
192- // <p>{t(language, 'ai_chat_context_disclaimer')}</p>
193- // </div>
194- // </HoverCard>
195- // <HoverCardTrigger>
196- // <div className="flex cursor-help items-center gap-1 circular-corners:rounded-2xl rounded-corners:rounded-md px-2.5 py-1.5 text-tint/7 text-xs transition-all hover:bg-tint">
197- // <span className="-ml-1 circular-corners:rounded-2xl rounded-corners:rounded-sm bg-tint-11/7 px-1 py-0.5 font-mono font-semibold text-[0.65rem] text-contrast-tint-11 leading-none">
198- // {t(language, 'ai_chat_context_badge')}
199- // </span>{' '}
200- // <span className="leading-none">
201- // {t(language, 'ai_chat_context_title')}
202- // </span>
203- // <Icon icon="question-circle" className="size-3 shrink-0" />
204- // </div>
205- // </HoverCardTrigger>
206- // </HoverCardRoot>
207- // <Button
208- // label={tString(language, 'send')}
209- // size="medium"
210- // className="ml-auto"
211- // disabled={disabled || !value.trim()}
212- // onClick={() => onSubmit(value)}
213- // />
214- // </div>
215- // </div>
216125 ) ;
217126}
0 commit comments