44 FloatingFocusManager ,
55 FloatingPortal ,
66 offset ,
7+ shift ,
78 useClick ,
89 useDismiss ,
910 useFloating ,
@@ -18,7 +19,7 @@ import { et } from 'react-day-picker/locale';
1819import { UnknownType } from '../../../types/commonTypes' ;
1920import { Calendar } from '../../content/calendar/calendar' ;
2021import MultiValueField , { MultiValueFieldProps } from '../multi-value-field/multi-value-field' ;
21- import TextField , { TextFieldForwardRef , TextFieldProps } from '../textfield/textfield' ;
22+ import TextField , { TextFieldProps } from '../textfield/textfield' ;
2223import styles from './date-field.module.scss' ;
2324
2425const CALENDAR_OFFSET = 4 ;
@@ -284,7 +285,7 @@ export const DateField: React.FC<DateFieldProps> = ({
284285 open,
285286 onOpenChange : setOpen ,
286287 placement : calendarTrigger === 'input' ? 'bottom-start' : 'bottom-end' ,
287- middleware : [ offset ( CALENDAR_OFFSET ) , flip ( ) ] ,
288+ middleware : [ offset ( CALENDAR_OFFSET ) , flip ( ) , shift ( ) ] ,
288289 whileElementsMounted : autoUpdate ,
289290 } ) ;
290291
@@ -387,25 +388,17 @@ export const DateField: React.FC<DateFieldProps> = ({
387388 if ( shouldDisableMonth ) disabledMatchers . push ( ( date : Date ) => shouldDisableMonth ( date ) ) ;
388389 if ( shouldDisableYear ) disabledMatchers . push ( ( date : Date ) => shouldDisableYear ( date ) ) ;
389390
390- const textFieldRef = React . useRef < TextFieldForwardRef > ( null ) ;
391-
392- useEffect ( ( ) => {
393- if ( textFieldRef . current ?. input ) {
394- refs . setReference ( textFieldRef . current . input ) ;
395- }
396- } , [ refs ] ) ;
397-
398391 return (
399392 < >
400393 < div
401394 className = { cn ( styles [ 'tedi-date-field__container' ] , className ) }
402395 { ...interactions . getReferenceProps ( ) }
403396 aria-haspopup = "dialog"
397+ ref = { refs . setReference }
404398 >
405399 { mode === 'multiple' ? (
406400 < MultiValueField
407401 { ...( inputProps as MultiValueFieldProps ) }
408- ref = { textFieldRef }
409402 id = { id }
410403 label = { label }
411404 readOnly = { readOnly ?? ( parseDate ? false : enableCalendar ) }
@@ -430,7 +423,6 @@ export const DateField: React.FC<DateFieldProps> = ({
430423 ) : (
431424 < TextField
432425 { ...( inputProps as TextFieldProps ) }
433- ref = { textFieldRef }
434426 id = { id }
435427 label = { label }
436428 readOnly = { readOnly ?? ( parseDate ? false : enableCalendar ) }
0 commit comments