[MM-56606] Upgrade to "@floating-ui/react" for date_picker component (#25978)

Этот коммит содержится в:
M-ZubairAhmed
2024-01-24 04:29:52 +00:00
коммит произвёл GitHub
родитель 028ad7d33f
Коммит df79ebed79
2 изменённых файлов: 5 добавлений и 6 удалений

Просмотреть файл

@@ -26,7 +26,6 @@ import Constants, {A11yCustomEventTypes} from 'utils/constants';
import type {A11yFocusEventDetail} from 'utils/constants'; import type {A11yFocusEventDetail} from 'utils/constants';
import {isKeyPressed} from 'utils/keyboard'; import {isKeyPressed} from 'utils/keyboard';
import {getCurrentMomentForTimezone} from 'utils/timezone'; import {getCurrentMomentForTimezone} from 'utils/timezone';
import {localizeMessage} from 'utils/utils';
const CUSTOM_STATUS_TIME_PICKER_INTERVALS_IN_MINUTES = 30; const CUSTOM_STATUS_TIME_PICKER_INTERVALS_IN_MINUTES = 30;
@@ -172,7 +171,7 @@ const DateTimeInputContainer: React.FC<Props> = (props: Props) => {
id='customStatus__calendar-input' id='customStatus__calendar-input'
readOnly={true} readOnly={true}
className='dateTime__calendar-input' className='dateTime__calendar-input'
label={localizeMessage('dnd_custom_time_picker_modal.date', 'Date')} label={formatMessage({id: 'dnd_custom_time_picker_modal.date', defaultMessage: 'Date'})}
onClick={() => handlePopperOpenState(true)} onClick={() => handlePopperOpenState(true)}
tabIndex={-1} tabIndex={-1}
inputPrefix={inputIcon} inputPrefix={inputIcon}

Просмотреть файл

@@ -10,7 +10,7 @@ import {
useInteractions, useInteractions,
FloatingFocusManager, FloatingFocusManager,
useDismiss, useDismiss,
} from '@floating-ui/react-dom-interactions'; } from '@floating-ui/react';
import type {Locale} from 'date-fns'; import type {Locale} from 'date-fns';
import React, {useCallback, useEffect, useState} from 'react'; import React, {useCallback, useEffect, useState} from 'react';
import {DayPicker} from 'react-day-picker'; import {DayPicker} from 'react-day-picker';
@@ -31,7 +31,7 @@ type Props = {
const DatePicker = ({children, datePickerProps, isPopperOpen, handlePopperOpenState, locale}: Props) => { const DatePicker = ({children, datePickerProps, isPopperOpen, handlePopperOpenState, locale}: Props) => {
const [loadedLocales, setLoadedLocales] = useState<Record<string, Locale>>({}); const [loadedLocales, setLoadedLocales] = useState<Record<string, Locale>>({});
const {x, y, reference, floating, strategy, context} = useFloating({ const {x, y, strategy, context, refs: {setReference, setFloating}} = useFloating({
open: isPopperOpen, open: isPopperOpen,
onOpenChange: () => handlePopperOpenState(false), onOpenChange: () => handlePopperOpenState(false),
placement: 'bottom-start', placement: 'bottom-start',
@@ -69,7 +69,7 @@ const DatePicker = ({children, datePickerProps, isPopperOpen, handlePopperOpenSt
return ( return (
<div> <div>
<div <div
ref={reference} ref={setReference}
{...getReferenceProps()} {...getReferenceProps()}
> >
{children} {children}
@@ -81,7 +81,7 @@ const DatePicker = ({children, datePickerProps, isPopperOpen, handlePopperOpenSt
initialFocus={-1} initialFocus={-1}
> >
<div <div
ref={floating} ref={setFloating}
style={{ style={{
position: strategy, position: strategy,
top: y ?? 0, top: y ?? 0,