@@ -51,6 +51,8 @@ const DatePickerRange = ({
5151 end_date_id,
5252 start_date_placeholder_text = 'Start Date' ,
5353 end_date_placeholder_text = 'End Date' ,
54+ with_portal = false ,
55+ with_full_screen_portal = false ,
5456} : DatePickerRangeProps ) => {
5557 const [ internalStartDate , setInternalStartDate ] = useState (
5658 strAsDate ( start_date )
@@ -102,6 +104,7 @@ const DatePickerRange = ({
102104 const startInputRef = useRef < HTMLInputElement | null > ( null ) ;
103105 const endInputRef = useRef < HTMLInputElement | null > ( null ) ;
104106 const calendarRef = useRef < CalendarHandle > ( null ) ;
107+ const hasPortal = with_portal || with_full_screen_portal ;
105108
106109 useEffect ( ( ) => {
107110 setInternalStartDate ( strAsDate ( start_date ) ) ;
@@ -333,7 +336,7 @@ const DatePickerRange = ({
333336 id = { start_date_id || accessibleId }
334337 inputClassName = "dash-datepicker-input dash-datepicker-start-date"
335338 value = { startInputValue }
336- onChange = { e => setStartInputValue ( e . target . value ) }
339+ onChange = { e => setStartInputValue ( e . target ? .value ) }
337340 onKeyDown = { handleStartInputKeyDown }
338341 onFocus = { ( ) => {
339342 if ( isCalendarOpen ) {
@@ -354,7 +357,7 @@ const DatePickerRange = ({
354357 id = { end_date_id || accessibleId + '-end-date' }
355358 inputClassName = "dash-datepicker-input dash-datepicker-end-date"
356359 value = { endInputValue }
357- onChange = { e => setEndInputValue ( e . target . value ) }
360+ onChange = { e => setEndInputValue ( e . target ? .value ) }
358361 onKeyDown = { handleEndInputKeyDown }
359362 onFocus = { ( ) => {
360363 if ( isCalendarOpen ) {
@@ -381,12 +384,21 @@ const DatePickerRange = ({
381384
382385 < Popover . Portal container = { containerRef . current } >
383386 < Popover . Content
384- className = "dash-datepicker-content"
385- align = "start"
386- sideOffset = { 5 }
387- collisionBoundary = { containerRef . current ?. closest (
388- '#_dash-app-content'
389- ) }
387+ className = { `dash-datepicker-content${
388+ hasPortal ? ' dash-datepicker-portal' : ''
389+ } ${
390+ with_full_screen_portal
391+ ? ' dash-datepicker-fullscreen'
392+ : ''
393+ } `}
394+ align = { hasPortal ? 'center' : 'start' }
395+ sideOffset = { hasPortal ? 0 : 5 }
396+ avoidCollisions = { ! hasPortal }
397+ onInteractOutside = {
398+ with_full_screen_portal
399+ ? e => e . preventDefault ( )
400+ : undefined
401+ }
390402 onOpenAutoFocus = { e => e . preventDefault ( ) }
391403 onCloseAutoFocus = { e => {
392404 e . preventDefault ( ) ;
@@ -407,6 +419,15 @@ const DatePickerRange = ({
407419 }
408420 } }
409421 >
422+ { with_full_screen_portal && (
423+ < button
424+ className = "dash-datepicker-close-button"
425+ onClick = { ( ) => setIsCalendarOpen ( false ) }
426+ aria-label = "Close calendar"
427+ >
428+ < Cross1Icon />
429+ </ button >
430+ ) }
410431 < Calendar
411432 ref = { calendarRef }
412433 initialVisibleDate = { initialCalendarDate }
0 commit comments