@@ -39,6 +39,8 @@ export type PromptInputV2Props = {
3939 borderUnderlay ?: boolean
4040 class ?: string
4141 modelControl ?: JSX . Element
42+ attachKeybind ?: string [ ]
43+ attachShortcut ?: string
4244}
4345
4446export function PromptInputV2 ( props : PromptInputV2Props ) {
@@ -197,9 +199,9 @@ export function PromptInputV2(props: PromptInputV2Props) {
197199 < PromptInputV2AddMenu
198200 disabled = { state . mode === "shell" }
199201 title = "Add images and files"
200- keybind = { [ "Mod" , "U" ] }
202+ keybind = { props . attachKeybind ?? [ "Mod" , "U" ] }
201203 attachLabel = "Images and files"
202- attachShortcut = "Mod+U"
204+ attachShortcut = { props . attachShortcut ?? "Mod+U" }
203205 commandsLabel = "Commands"
204206 contextLabel = "Context"
205207 shellLabel = "Shell command"
@@ -233,7 +235,11 @@ export function PromptInputV2(props: PromptInputV2Props) {
233235 < Show when = { view . variant } >
234236 { ( control ) => (
235237 < Show when = { control ( ) . options ( ) . length > 1 } >
236- < PromptInputV2ConfiguredSelect title = "Choose model variant" control = { control ( ) } />
238+ < PromptInputV2ConfiguredSelect
239+ title = "Choose model variant"
240+ keybind = { [ "Shift" , "Mod" , "D" ] }
241+ control = { control ( ) }
242+ />
237243 </ Show >
238244 ) }
239245 </ Show >
@@ -512,7 +518,7 @@ function PromptInputV2ConfiguredSelect(props: {
512518 return (
513519 < PromptInputV2Select
514520 title = { props . title }
515- keybind = { props . keybind }
521+ keybind = { props . control . keybind ?. ( ) ?? props . keybind }
516522 options = { props . control . options ( ) }
517523 current = { current ( ) }
518524 currentIcon = {
@@ -536,36 +542,45 @@ export function PromptInputV2Select(props: {
536542 onSelect : ( id : string ) => void
537543} ) {
538544 return (
539- < MenuV2 gutter = { 6 } modal = { false } placement = "top-start" onOpenChange = { props . onOpenChange } >
540- < MenuV2 . Trigger
541- as = { ButtonV2 }
542- variant = "ghost-muted"
543- size = "normal"
544- class = { `max-w-[220px] justify-start ![font-weight:440] ${ props . class ?? "" } ` }
545- title = { keybindTitle ( props . title , props . keybind ) }
546- >
547- { props . currentIcon }
548- < span class = "truncate capitalize leading-5" >
549- { props . options . find ( ( option ) => option . id === props . current ) ?. label ?? props . current }
550- </ span >
551- < span class = "-ml-0.5 -mr-1 flex shrink-0" >
552- < IconV2 name = "chevron-down" />
553- </ span >
554- </ MenuV2 . Trigger >
555- < MenuV2 . Portal >
556- < MenuV2 . Content >
557- < MenuV2 . RadioGroup value = { props . current } onChange = { props . onSelect } >
558- < For each = { props . options } >
559- { ( option ) => (
560- < MenuV2 . RadioItem value = { option . id } class = "capitalize" closeOnSelect >
561- { option . label }
562- </ MenuV2 . RadioItem >
563- ) }
564- </ For >
565- </ MenuV2 . RadioGroup >
566- </ MenuV2 . Content >
567- </ MenuV2 . Portal >
568- </ MenuV2 >
545+ < TooltipV2
546+ placement = "top"
547+ value = {
548+ < >
549+ { props . title }
550+ < KeybindV2 keys = { props . keybind ?? [ ] } variant = "neutral" />
551+ </ >
552+ }
553+ >
554+ < MenuV2 gutter = { 6 } modal = { false } placement = "top-start" onOpenChange = { props . onOpenChange } >
555+ < MenuV2 . Trigger
556+ as = { ButtonV2 }
557+ variant = "ghost-muted"
558+ size = "normal"
559+ class = { `max-w-[220px] justify-start ![font-weight:440] ${ props . class ?? "" } ` }
560+ >
561+ { props . currentIcon }
562+ < span class = "truncate capitalize leading-5" >
563+ { props . options . find ( ( option ) => option . id === props . current ) ?. label ?? props . current }
564+ </ span >
565+ < span class = "-ml-0.5 -mr-1 flex shrink-0" >
566+ < IconV2 name = "chevron-down" />
567+ </ span >
568+ </ MenuV2 . Trigger >
569+ < MenuV2 . Portal >
570+ < MenuV2 . Content >
571+ < MenuV2 . RadioGroup value = { props . current } onChange = { props . onSelect } >
572+ < For each = { props . options } >
573+ { ( option ) => (
574+ < MenuV2 . RadioItem value = { option . id } class = "capitalize" closeOnSelect >
575+ { option . label }
576+ </ MenuV2 . RadioItem >
577+ ) }
578+ </ For >
579+ </ MenuV2 . RadioGroup >
580+ </ MenuV2 . Content >
581+ </ MenuV2 . Portal >
582+ </ MenuV2 >
583+ </ TooltipV2 >
569584 )
570585}
571586
@@ -688,8 +703,3 @@ function PromptInputV2SuggestionIcon(props: { item: PromptInputV2Suggestion }) {
688703 />
689704 )
690705}
691-
692- function keybindTitle ( label : string , keybind ?: string [ ] ) {
693- if ( ! keybind ?. length ) return label
694- return `${ label } (${ keybind . join ( "+" ) } )`
695- }
0 commit comments