66 derivePendingUserInputProgress ,
77 type PendingUserInputDraftAnswer ,
88} from "../../pendingUserInput" ;
9- import { CheckIcon } from "lucide-react " ;
9+ import { Checkbox } from "../ui/checkbox " ;
1010import { Collapsible , CollapsiblePanel , CollapsibleTrigger } from "../ui/collapsible" ;
1111import { cn } from "~/lib/utils" ;
1212import { ComposerBanner } from "./ComposerBanner" ;
@@ -251,40 +251,34 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
251251 optimisticSingleSelect . optionValue === optionValue ;
252252 const isSelected =
253253 isOptimisticallySelected || draftSelectedOptions ?. [ index ] === true ;
254- const shortcutKey = index < 9 ? index + 1 : null ;
255254 const className = cn (
256- "group flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left outline-none transition-colors duration-150 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary/25" ,
257- isSelected
258- ? "bg-muted/55 text-foreground"
259- : "bg-transparent text-foreground/85 hover:bg-muted/30" ,
255+ "group flex w-full items-center gap-2.5 rounded-md bg-transparent px-2.5 py-2 text-left outline-none transition-colors duration-150 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary/25" ,
256+ isSelected ? "text-foreground" : "text-foreground/70 hover:bg-muted/30" ,
260257 ( disabled || isResponding ) && "opacity-50 cursor-not-allowed" ,
261258 ! disabled && ! isResponding && "cursor-pointer" ,
262259 ) ;
263260 const content = (
264261 < >
262+ { activeQuestion . multiSelect ? (
263+ < span className = "pointer-events-none flex" >
264+ < Checkbox checked = { isSelected } tabIndex = { - 1 } aria-hidden />
265+ </ span >
266+ ) : (
267+ < OptionRadio checked = { isSelected } />
268+ ) }
265269 < div className = "min-w-0 flex-1 flex flex-col gap-0.5" >
266270 < span className = "text-sm font-medium" > { option . label } </ span >
267271 { option . description && option . description !== option . label ? (
268272 < span className = "text-secondary-label text-2xs" > { option . description } </ span >
269273 ) : null }
270274 </ div >
271- { isSelected ? (
272- < CheckIcon className = "size-3.5 shrink-0 text-primary" />
273- ) : shortcutKey !== null ? (
274- < kbd
275- className = { cn (
276- "flex size-5 shrink-0 items-center justify-center text-3xs font-medium text-muted-foreground tabular-nums" ,
277- ) }
278- >
279- { shortcutKey }
280- </ kbd >
281- ) : null }
282275 </ >
283276 ) ;
284277 return (
285278 < button
286279 key = { `${ activeQuestion . id } :${ optionValue } ` }
287280 type = "button"
281+ aria-pressed = { isSelected }
288282 disabled = { disabled || isResponding }
289283 onClick = { ( ) => {
290284 handleOptionSelection ( activeQuestion . id , optionValue ) ;
@@ -302,3 +296,21 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
302296 </ Collapsible >
303297 ) ;
304298} ) ;
299+
300+ // Drawn with ui/radio-group's look instead of using its Radio: Radio only checks inside a
301+ // RadioGroup, whose arrow keys select options and would trip the single-select auto-advance.
302+ function OptionRadio ( { checked } : { checked : boolean } ) {
303+ return (
304+ < span
305+ aria-hidden
306+ className = { cn (
307+ "relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-full border border-input bg-background not-dark:bg-clip-padding sm:size-4 dark:bg-input/32" ,
308+ checked ? "shadow-none" : "shadow-xs/5" ,
309+ ) }
310+ >
311+ { checked ? (
312+ < span className = "-inset-px absolute flex items-center justify-center rounded-full bg-primary before:size-2 before:rounded-full before:bg-primary-foreground sm:before:size-1.5" />
313+ ) : null }
314+ </ span >
315+ ) ;
316+ }
0 commit comments