@@ -64,6 +64,7 @@ import {
6464} from "#ui/native-menu.ts" ;
6565import uiStyles from "#ui/ui.module.css" ;
6666import { mergeProps , Tooltip , useRender } from "@base-ui/react" ;
67+ import { useMergedRefs } from "@base-ui/utils/useMergedRefs" ;
6768import {
6869 AbsorptionTarget ,
6970 Commit ,
@@ -265,8 +266,9 @@ const ItemRow: FC<
265266 {
266267 isSelected ?: boolean ;
267268 } & ComponentProps < "div" >
268- > = ( { className, isSelected, ...props } ) => {
269+ > = ( { className, isSelected, ref : refProp , ...props } ) => {
269270 const rowRef = useRef < HTMLDivElement | null > ( null ) ;
271+ const mergedRef = useMergedRefs ( rowRef , refProp ) ;
270272
271273 useLayoutEffect ( ( ) => {
272274 if ( ! isSelected ) return ;
@@ -279,7 +281,7 @@ const ItemRow: FC<
279281 return (
280282 < div
281283 { ...props }
282- ref = { rowRef }
284+ ref = { mergedRef }
283285 className = { classes ( className , styles . itemRow , isSelected && styles . itemRowSelected ) }
284286 />
285287 ) ;
@@ -830,34 +832,33 @@ const EditorHelp: FC<{
830832const InlineCommitMessageEditor : FC < {
831833 message : string ;
832834 onSubmit : ( value : string ) => void ;
833- onCancel : ( ) => void ;
835+ onExit : ( ) => void ;
834836 formRef ?: Ref < HTMLFormElement > ;
835- } > = ( { message, onSubmit, onCancel, formRef } ) => (
836- < form
837- ref = { formRef }
838- className = { styles . editorForm }
839- onSubmit = { ( event ) => {
840- event . preventDefault ( ) ;
841- const formData = new FormData ( event . currentTarget ) ;
842- onCancel ( ) ;
843- onSubmit ( formData . get ( "message" ) as string ) ;
844- } }
845- >
846- < textarea
847- ref = { ( el ) => {
848- if ( ! el ) return ;
849- el . focus ( ) ;
850- const cursorPosition = el . value . length ;
851- el . setSelectionRange ( cursorPosition , cursorPosition ) ;
852- } }
853- aria-label = "Commit message"
854- name = "message"
855- defaultValue = { message . trim ( ) }
856- className = { classes ( styles . editorInput , styles . editCommitMessageInput ) }
857- />
858- < EditorHelp bindings = { rewordCommitBindings } />
859- </ form >
860- ) ;
837+ } > = ( { message, onSubmit, onExit, formRef } ) => {
838+ const submit = ( event : React . SyntheticEvent < HTMLFormElement > ) => {
839+ event . preventDefault ( ) ;
840+ const formData = new FormData ( event . currentTarget ) ;
841+ onExit ( ) ;
842+ onSubmit ( formData . get ( "message" ) as string ) ;
843+ } ;
844+ return (
845+ < form ref = { formRef } className = { styles . editorForm } onSubmit = { submit } onBlur = { submit } >
846+ < textarea
847+ ref = { ( el ) => {
848+ if ( ! el ) return ;
849+ el . focus ( ) ;
850+ const cursorPosition = el . value . length ;
851+ el . setSelectionRange ( cursorPosition , cursorPosition ) ;
852+ } }
853+ aria-label = "Commit message"
854+ name = "message"
855+ defaultValue = { message . trim ( ) }
856+ className = { classes ( styles . editorInput , styles . editCommitMessageInput ) }
857+ />
858+ < EditorHelp bindings = { rewordCommitBindings } />
859+ </ form >
860+ ) ;
861+ } ;
861862
862863const CommitRow : FC <
863864 {
@@ -1007,7 +1008,7 @@ const CommitRow: FC<
10071008 formRef = { commitMessageFormRef }
10081009 message = { optimisticMessage }
10091010 onSubmit = { saveNewMessage }
1010- onCancel = { endEditing }
1011+ onExit = { endEditing }
10111012 />
10121013 ) : (
10131014 < >
@@ -1444,31 +1445,30 @@ const InlineBranchNameEditor: FC<{
14441445 onSubmit : ( value : string ) => void ;
14451446 onExit : ( ) => void ;
14461447 formRef ?: Ref < HTMLFormElement > ;
1447- } > = ( { branchName, onSubmit, onExit, formRef } ) => (
1448- < form
1449- ref = { formRef }
1450- className = { styles . editorForm }
1451- onSubmit = { ( event ) => {
1452- event . preventDefault ( ) ;
1453- const formData = new FormData ( event . currentTarget ) ;
1454- onExit ( ) ;
1455- onSubmit ( formData . get ( "branchName" ) as string ) ;
1456- } }
1457- >
1458- < input
1459- aria-label = "Branch name"
1460- ref = { ( el ) => {
1461- if ( ! el ) return ;
1462- el . focus ( ) ;
1463- el . select ( ) ;
1464- } }
1465- name = "branchName"
1466- defaultValue = { branchName }
1467- className = { classes ( styles . editorInput , styles . renameBranchInput ) }
1468- />
1469- < EditorHelp bindings = { renameBranchBindings } />
1470- </ form >
1471- ) ;
1448+ } > = ( { branchName, onSubmit, onExit, formRef } ) => {
1449+ const submit = ( event : React . SyntheticEvent < HTMLFormElement > ) => {
1450+ event . preventDefault ( ) ;
1451+ const formData = new FormData ( event . currentTarget ) ;
1452+ onExit ( ) ;
1453+ onSubmit ( formData . get ( "branchName" ) as string ) ;
1454+ } ;
1455+ return (
1456+ < form ref = { formRef } className = { styles . editorForm } onSubmit = { submit } onBlur = { submit } >
1457+ < input
1458+ aria-label = "Branch name"
1459+ ref = { ( el ) => {
1460+ if ( ! el ) return ;
1461+ el . focus ( ) ;
1462+ el . select ( ) ;
1463+ } }
1464+ name = "branchName"
1465+ defaultValue = { branchName }
1466+ className = { classes ( styles . editorInput , styles . renameBranchInput ) }
1467+ />
1468+ < EditorHelp bindings = { renameBranchBindings } />
1469+ </ form >
1470+ ) ;
1471+ } ;
14721472
14731473const SegmentRow : FC <
14741474 {
0 commit comments