@mui/x-date-pickers-pro 7.0.0-beta.2 → 7.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +298 -23
- package/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/DateRangeCalendar/DateRangeCalendar.types.d.ts +3 -0
- package/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/DateRangePicker/DateRangePicker.js +9 -9
- package/DateRangePicker/DateRangePicker.types.d.ts +3 -3
- package/DateRangePicker/DateRangePickerToolbar.d.ts +3 -0
- package/DateRangePicker/DateRangePickerToolbar.js +6 -0
- package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -1
- package/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
- package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +3 -3
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +3 -0
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
- package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +1 -1
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
- package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +3 -3
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +1 -1
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +3 -3
- package/MobileDateRangePicker/MobileDateRangePicker.d.ts +1 -1
- package/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
- package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +3 -3
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +1 -1
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +11 -12
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +3 -3
- package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +1 -1
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +11 -14
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +1 -1
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +12 -16
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +1 -1
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +12 -16
- package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +2 -2
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
- package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +11 -14
- package/SingleInputDateRangeField/index.d.ts +1 -1
- package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +2 -3
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -15
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +2 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +12 -15
- package/SingleInputDateTimeRangeField/index.d.ts +1 -1
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +2 -3
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -20
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +2 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +12 -15
- package/SingleInputTimeRangeField/index.d.ts +1 -1
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +2 -3
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -14
- package/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
- package/index.d.ts +0 -1
- package/index.js +2 -1
- package/internals/hooks/models/useRangePicker.d.ts +5 -5
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +5 -5
- package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +15 -15
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +37 -40
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -1
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +5 -5
- package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +21 -0
- package/internals/hooks/useMultiInputFieldSelectedSections.js +43 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -1
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +2 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
- package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +4 -4
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +2 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
- package/internals/hooks/useRangePosition.d.ts +2 -4
- package/internals/hooks/useRangePosition.js +3 -6
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +1 -2
- package/internals/models/dateRange.d.ts +3 -15
- package/internals/models/dateTimeRange.d.ts +4 -6
- package/internals/models/index.d.ts +0 -1
- package/internals/models/index.js +0 -1
- package/internals/models/timeRange.d.ts +3 -6
- package/internals/utils/date-fields-utils.d.ts +1 -5
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/valueManagers.d.ts +1 -2
- package/internals/utils/valueManagers.js +11 -6
- package/models/fields.d.ts +69 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/modern/DateRangePicker/DateRangePicker.js +9 -9
- package/modern/DateRangePicker/DateRangePickerToolbar.js +6 -0
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +11 -12
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -14
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -19
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -13
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
- package/modern/index.js +2 -1
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
- package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +34 -37
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
- package/modern/internals/hooks/useMultiInputFieldSelectedSections.js +40 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -30
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -24
- package/modern/internals/hooks/useRangePosition.js +3 -6
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
- package/modern/internals/models/index.js +0 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/internals/utils/valueManagers.js +11 -6
- package/modern/models/index.js +1 -0
- package/node/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/node/DateRangePicker/DateRangePicker.js +9 -9
- package/node/DateRangePicker/DateRangePickerToolbar.js +6 -0
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -14
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -16
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +15 -13
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -21
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -15
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
- package/node/index.js +1 -1
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +33 -36
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
- package/node/internals/hooks/useMultiInputFieldSelectedSections.js +50 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +16 -11
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
- package/node/internals/hooks/useRangePosition.js +3 -8
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
- package/node/internals/models/index.js +0 -11
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/internals/utils/valueManagers.js +10 -5
- package/node/models/index.js +11 -0
- package/package.json +5 -5
- package/themeAugmentation/props.d.ts +12 -12
- package/internals/models/fields.d.ts +0 -49
- package/legacy/AdapterDateFns/index.js +0 -1
- package/legacy/AdapterDateFnsJalali/index.js +0 -1
- package/legacy/AdapterDateFnsV3/index.js +0 -1
- package/legacy/AdapterDayjs/index.js +0 -1
- package/legacy/AdapterLuxon/index.js +0 -1
- package/legacy/AdapterMoment/index.js +0 -1
- package/legacy/AdapterMomentHijri/index.js +0 -1
- package/legacy/AdapterMomentJalaali/index.js +0 -1
- package/legacy/DateRangeCalendar/DateRangeCalendar.js +0 -764
- package/legacy/DateRangeCalendar/DateRangeCalendar.types.js +0 -1
- package/legacy/DateRangeCalendar/dateRangeCalendarClasses.js +0 -5
- package/legacy/DateRangeCalendar/index.js +0 -2
- package/legacy/DateRangeCalendar/useDragRange.js +0 -258
- package/legacy/DateRangePicker/DateRangePicker.js +0 -334
- package/legacy/DateRangePicker/DateRangePicker.types.js +0 -1
- package/legacy/DateRangePicker/DateRangePickerToolbar.js +0 -127
- package/legacy/DateRangePicker/dateRangePickerToolbarClasses.js +0 -5
- package/legacy/DateRangePicker/index.js +0 -3
- package/legacy/DateRangePicker/shared.js +0 -33
- package/legacy/DateRangePickerDay/DateRangePickerDay.js +0 -366
- package/legacy/DateRangePickerDay/dateRangePickerDayClasses.js +0 -5
- package/legacy/DateRangePickerDay/index.js +0 -2
- package/legacy/DateTimeRangePicker/DateTimeRangePicker.js +0 -413
- package/legacy/DateTimeRangePicker/DateTimeRangePicker.types.js +0 -1
- package/legacy/DateTimeRangePicker/DateTimeRangePickerTabs.js +0 -191
- package/legacy/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +0 -57
- package/legacy/DateTimeRangePicker/DateTimeRangePickerToolbar.js +0 -184
- package/legacy/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +0 -6
- package/legacy/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +0 -5
- package/legacy/DateTimeRangePicker/index.js +0 -5
- package/legacy/DateTimeRangePicker/shared.js +0 -54
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -343
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.types.js +0 -1
- package/legacy/DesktopDateRangePicker/index.js +0 -1
- package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +0 -491
- package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +0 -1
- package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -48
- package/legacy/DesktopDateTimeRangePicker/index.js +0 -1
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +0 -339
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.types.js +0 -1
- package/legacy/MobileDateRangePicker/index.js +0 -1
- package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +0 -484
- package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +0 -1
- package/legacy/MobileDateTimeRangePicker/index.js +0 -1
- package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +0 -316
- package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
- package/legacy/MultiInputDateRangeField/index.js +0 -2
- package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +0 -357
- package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
- package/legacy/MultiInputDateTimeRangeField/index.js +0 -2
- package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +0 -330
- package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
- package/legacy/MultiInputTimeRangeField/index.js +0 -2
- package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +0 -307
- package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.types.js +0 -1
- package/legacy/SingleInputDateRangeField/index.js +0 -2
- package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +0 -30
- package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +0 -348
- package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.js +0 -1
- package/legacy/SingleInputDateTimeRangeField/index.js +0 -2
- package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +0 -35
- package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +0 -321
- package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.types.js +0 -1
- package/legacy/SingleInputTimeRangeField/index.js +0 -2
- package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +0 -29
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +0 -276
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.types.js +0 -1
- package/legacy/StaticDateRangePicker/index.js +0 -1
- package/legacy/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -87
- package/legacy/dateRangeViewRenderers/index.js +0 -1
- package/legacy/index.js +0 -52
- package/legacy/internals/constants/dimensions.js +0 -5
- package/legacy/internals/hooks/models/index.js +0 -1
- package/legacy/internals/hooks/models/useRangePicker.js +0 -1
- package/legacy/internals/hooks/useDesktopRangePicker/index.js +0 -1
- package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +0 -154
- package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.js +0 -1
- package/legacy/internals/hooks/useEnrichedRangePickerFieldProps.js +0 -258
- package/legacy/internals/hooks/useMobileRangePicker/index.js +0 -1
- package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +0 -144
- package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.js +0 -1
- package/legacy/internals/hooks/useMultiInputRangeField/shared.js +0 -9
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -102
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -115
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -109
- package/legacy/internals/hooks/useRangePosition.js +0 -39
- package/legacy/internals/hooks/useStaticRangePicker/index.js +0 -1
- package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -76
- package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.js +0 -1
- package/legacy/internals/models/dateRange.js +0 -1
- package/legacy/internals/models/dateTimeRange.js +0 -1
- package/legacy/internals/models/index.js +0 -5
- package/legacy/internals/models/rangePickerProps.js +0 -1
- package/legacy/internals/models/timeRange.js +0 -1
- package/legacy/internals/utils/date-fields-utils.js +0 -26
- package/legacy/internals/utils/date-range-manager.js +0 -65
- package/legacy/internals/utils/date-utils.js +0 -12
- package/legacy/internals/utils/releaseInfo.js +0 -13
- package/legacy/internals/utils/validation/validateDateRange.js +0 -45
- package/legacy/internals/utils/validation/validateDateTimeRange.js +0 -45
- package/legacy/internals/utils/validation/validateTimeRange.js +0 -32
- package/legacy/internals/utils/valueManagers.js +0 -135
- package/legacy/locales/index.js +0 -1
- package/legacy/models/index.js +0 -3
- package/legacy/models/multiInputRangeFieldClasses.js +0 -1
- package/legacy/models/range.js +0 -1
- package/legacy/models/validation.js +0 -1
- package/legacy/themeAugmentation/index.js +0 -4
- package/modern/internals/models/fields.js +0 -1
- /package/{internals/models → models}/fields.js +0 -0
- /package/{legacy/internals → modern}/models/fields.js +0 -0
- /package/node/{internals/models → models}/fields.js +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
|
-
import {
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const useSingleInputDateTimeRangeField: <TDate extends PickerValidDate, TChildProps extends {}>(inProps: UseSingleInputDateTimeRangeFieldComponentProps<TDate, TChildProps>) => import("@mui/x-date-pickers/internals").UseFieldResponse<Omit<UseSingleInputDateTimeRangeFieldDefaultizedProps<TDate, TChildProps>, keyof UseSingleInputDateTimeRangeFieldProps<any>>>;
|
|
2
|
+
import { UseSingleInputDateTimeRangeFieldProps } from './SingleInputDateTimeRangeField.types';
|
|
3
|
+
export declare const useSingleInputDateTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps<any>> & Required<Pick<UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps<any>>>, keyof UseSingleInputDateTimeRangeFieldProps<any, any>>>;
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useUtils, useField, applyDefaultDate, useDefaultDates, splitFieldInternalAndForwardedProps } from '@mui/x-date-pickers/internals';
|
|
1
|
+
import { useField, splitFieldInternalAndForwardedProps, useDefaultizedDateTimeField } from '@mui/x-date-pickers/internals';
|
|
3
2
|
import { rangeValueManager, rangeFieldValueManager } from '../internals/utils/valueManagers';
|
|
4
3
|
import { validateDateTimeRange } from '../internals/utils/validation/validateDateTimeRange';
|
|
5
|
-
export const useDefaultizedTimeRangeFieldProps = props => {
|
|
6
|
-
var _props$ampm, _props$disablePast, _props$disableFuture, _props$format, _props$minDateTime, _props$maxDateTime, _props$minDateTime2, _props$maxDateTime2;
|
|
7
|
-
const utils = useUtils();
|
|
8
|
-
const defaultDates = useDefaultDates();
|
|
9
|
-
const ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
|
|
10
|
-
const defaultFormat = ampm ? utils.formats.keyboardDateTime12h : utils.formats.keyboardDateTime24h;
|
|
11
|
-
return _extends({}, props, {
|
|
12
|
-
disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
|
|
13
|
-
disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
|
|
14
|
-
format: (_props$format = props.format) != null ? _props$format : defaultFormat,
|
|
15
|
-
minDate: applyDefaultDate(utils, (_props$minDateTime = props.minDateTime) != null ? _props$minDateTime : props.minDate, defaultDates.minDate),
|
|
16
|
-
maxDate: applyDefaultDate(utils, (_props$maxDateTime = props.maxDateTime) != null ? _props$maxDateTime : props.maxDate, defaultDates.maxDate),
|
|
17
|
-
minTime: (_props$minDateTime2 = props.minDateTime) != null ? _props$minDateTime2 : props.minTime,
|
|
18
|
-
maxTime: (_props$maxDateTime2 = props.maxDateTime) != null ? _props$maxDateTime2 : props.maxTime,
|
|
19
|
-
disableIgnoringDatePartForTimeValidation: Boolean(props.minDateTime || props.maxDateTime)
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
4
|
export const useSingleInputDateTimeRangeField = inProps => {
|
|
23
|
-
const props =
|
|
5
|
+
const props = useDefaultizedDateTimeField(inProps);
|
|
24
6
|
const {
|
|
25
7
|
forwardedProps,
|
|
26
8
|
internalProps
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
3
|
import { SingleInputTimeRangeFieldProps } from './SingleInputTimeRangeField.types';
|
|
4
|
-
import { FieldType } from '../
|
|
5
|
-
type DateRangeFieldComponent = (<TDate extends PickerValidDate>(props: SingleInputTimeRangeFieldProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
4
|
+
import { FieldType } from '../models';
|
|
5
|
+
type DateRangeFieldComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: SingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
6
6
|
propTypes?: any;
|
|
7
7
|
fieldType?: FieldType;
|
|
8
8
|
};
|
|
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import MuiTextField from '@mui/material/TextField';
|
|
7
7
|
import { useClearableField } from '@mui/x-date-pickers/hooks';
|
|
8
8
|
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
9
|
+
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
9
10
|
import { useThemeProps } from '@mui/material/styles';
|
|
10
11
|
import { useSlotProps } from '@mui/base/utils';
|
|
11
12
|
import { refType } from '@mui/utils';
|
|
@@ -35,7 +36,7 @@ const SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleI
|
|
|
35
36
|
} = themeProps,
|
|
36
37
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
37
38
|
const ownerState = themeProps;
|
|
38
|
-
const TextField = (_slots$textField = slots == null ? void 0 : slots.textField) != null ? _slots$textField : MuiTextField;
|
|
39
|
+
const TextField = (_slots$textField = slots == null ? void 0 : slots.textField) != null ? _slots$textField : inProps.enableAccessibleFieldDOMStructure ? PickersTextField : MuiTextField;
|
|
39
40
|
const textFieldProps = useSlotProps({
|
|
40
41
|
elementType: TextField,
|
|
41
42
|
externalSlotProps: slotProps == null ? void 0 : slotProps.textField,
|
|
@@ -111,6 +112,10 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
111
112
|
* @default false
|
|
112
113
|
*/
|
|
113
114
|
disablePast: PropTypes.bool,
|
|
115
|
+
/**
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
enableAccessibleFieldDOMStructure: PropTypes.bool,
|
|
114
119
|
/**
|
|
115
120
|
* If `true`, the component is displayed in focused state.
|
|
116
121
|
*/
|
|
@@ -244,17 +249,14 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
244
249
|
required: PropTypes.bool,
|
|
245
250
|
/**
|
|
246
251
|
* The currently selected sections.
|
|
247
|
-
* This prop
|
|
252
|
+
* This prop accepts four formats:
|
|
248
253
|
* 1. If a number is provided, the section at this index will be selected.
|
|
249
|
-
* 2. If
|
|
250
|
-
* 3. If
|
|
251
|
-
* 4. If `null` is provided, no section will be selected
|
|
254
|
+
* 2. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
|
|
255
|
+
* 3. If `"all"` is provided, all the sections will be selected.
|
|
256
|
+
* 4. If `null` is provided, no section will be selected.
|
|
252
257
|
* If not provided, the selected sections will be handled internally.
|
|
253
258
|
*/
|
|
254
|
-
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number,
|
|
255
|
-
endIndex: PropTypes.number.isRequired,
|
|
256
|
-
startIndex: PropTypes.number.isRequired
|
|
257
|
-
})]),
|
|
259
|
+
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number]),
|
|
258
260
|
/**
|
|
259
261
|
* Disable specific time.
|
|
260
262
|
* @template TDate
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
3
|
import TextField from '@mui/material/TextField';
|
|
4
|
-
import {
|
|
5
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
6
|
-
import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks';
|
|
7
|
-
import {
|
|
8
|
-
|
|
4
|
+
import { UseFieldInternalProps } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { PickerValidDate, BuiltInFieldTextFieldProps } from '@mui/x-date-pickers/models';
|
|
6
|
+
import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks';
|
|
7
|
+
import { UseTimeRangeFieldProps } from '../internals/models';
|
|
8
|
+
import { DateRange, RangeFieldSection, TimeRangeValidationError } from '../models';
|
|
9
|
+
export interface UseSingleInputTimeRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends UseTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, ExportedUseClearableFieldProps, Pick<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, 'unstableFieldRef'> {
|
|
9
10
|
}
|
|
10
|
-
export type
|
|
11
|
-
export type UseSingleInputTimeRangeFieldComponentProps<TDate extends PickerValidDate, TChildProps extends {}> = Omit<TChildProps, keyof UseSingleInputTimeRangeFieldProps<TDate>> & UseSingleInputTimeRangeFieldProps<TDate>;
|
|
12
|
-
export interface SingleInputTimeRangeFieldProps<TDate extends PickerValidDate> extends UseSingleInputTimeRangeFieldComponentProps<TDate, FieldsTextFieldProps> {
|
|
11
|
+
export type SingleInputTimeRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false> = Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>> & UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure> & {
|
|
13
12
|
/**
|
|
14
13
|
* Overridable component slots.
|
|
15
14
|
* @default {}
|
|
@@ -19,17 +18,15 @@ export interface SingleInputTimeRangeFieldProps<TDate extends PickerValidDate> e
|
|
|
19
18
|
* The props used for each component slot.
|
|
20
19
|
* @default {}
|
|
21
20
|
*/
|
|
22
|
-
slotProps?: SingleInputTimeRangeFieldSlotProps<TDate>;
|
|
23
|
-
}
|
|
24
|
-
export type SingleInputTimeRangeFieldOwnerState<TDate extends PickerValidDate> = SingleInputTimeRangeFieldProps<TDate>;
|
|
21
|
+
slotProps?: SingleInputTimeRangeFieldSlotProps<TDate, TEnableAccessibleFieldDOMStructure>;
|
|
22
|
+
};
|
|
25
23
|
export interface SingleInputTimeRangeFieldSlots extends UseClearableFieldSlots {
|
|
26
24
|
/**
|
|
27
25
|
* Form control with an input to render the value.
|
|
28
|
-
*
|
|
29
|
-
* @default TextField from '@mui/material'
|
|
26
|
+
* @default TextField from '@mui/material' or PickersTextField if `enableAccessibleFieldDOMStructure` is `true`.
|
|
30
27
|
*/
|
|
31
28
|
textField?: React.ElementType;
|
|
32
29
|
}
|
|
33
|
-
export interface SingleInputTimeRangeFieldSlotProps<TDate extends PickerValidDate> extends UseClearableFieldSlotProps {
|
|
34
|
-
textField?: SlotComponentProps<typeof TextField, {},
|
|
30
|
+
export interface SingleInputTimeRangeFieldSlotProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends UseClearableFieldSlotProps {
|
|
31
|
+
textField?: SlotComponentProps<typeof TextField, {}, SingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>;
|
|
35
32
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { SingleInputTimeRangeField } from './SingleInputTimeRangeField';
|
|
2
2
|
export { useSingleInputTimeRangeField as unstable_useSingleInputTimeRangeField } from './useSingleInputTimeRangeField';
|
|
3
|
-
export type { UseSingleInputTimeRangeFieldProps,
|
|
3
|
+
export type { UseSingleInputTimeRangeFieldProps, SingleInputTimeRangeFieldProps, } from './SingleInputTimeRangeField.types';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
|
-
import {
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const useSingleInputTimeRangeField: <TDate extends PickerValidDate, TChildProps extends {}>(inProps: UseSingleInputTimeRangeFieldComponentProps<TDate, TChildProps>) => import("@mui/x-date-pickers/internals").UseFieldResponse<Omit<UseSingleInputTimeRangeFieldDefaultizedProps<TDate, TChildProps>, keyof UseSingleInputTimeRangeFieldProps<any>>>;
|
|
2
|
+
import { UseSingleInputTimeRangeFieldProps } from './SingleInputTimeRangeField.types';
|
|
3
|
+
export declare const useSingleInputTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps> & Required<Pick<UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps>>, keyof UseSingleInputTimeRangeFieldProps<any, any>>>;
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useUtils, useField, splitFieldInternalAndForwardedProps } from '@mui/x-date-pickers/internals';
|
|
1
|
+
import { useField, splitFieldInternalAndForwardedProps, useDefaultizedTimeField } from '@mui/x-date-pickers/internals';
|
|
3
2
|
import { rangeValueManager, rangeFieldValueManager } from '../internals/utils/valueManagers';
|
|
4
3
|
import { validateTimeRange } from '../internals/utils/validation/validateTimeRange';
|
|
5
|
-
export const useDefaultizedTimeRangeFieldProps = props => {
|
|
6
|
-
var _props$ampm, _props$disablePast, _props$disableFuture, _props$format;
|
|
7
|
-
const utils = useUtils();
|
|
8
|
-
const ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
|
|
9
|
-
const defaultFormat = ampm ? utils.formats.fullTime12h : utils.formats.fullTime24h;
|
|
10
|
-
return _extends({}, props, {
|
|
11
|
-
disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
|
|
12
|
-
disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
|
|
13
|
-
format: (_props$format = props.format) != null ? _props$format : defaultFormat
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
4
|
export const useSingleInputTimeRangeField = inProps => {
|
|
17
|
-
const props =
|
|
5
|
+
const props = useDefaultizedTimeField(inProps);
|
|
18
6
|
const {
|
|
19
7
|
forwardedProps,
|
|
20
8
|
internalProps
|
|
@@ -131,7 +131,6 @@ StaticDateRangePicker.propTypes = {
|
|
|
131
131
|
/**
|
|
132
132
|
* The day view will show as many weeks as needed after the end of the current month to match this value.
|
|
133
133
|
* Put it to 6 to have a fixed number of weeks in Gregorian calendars
|
|
134
|
-
* @default undefined
|
|
135
134
|
*/
|
|
136
135
|
fixedWeekNumber: PropTypes.number,
|
|
137
136
|
/**
|
package/index.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export * from './MultiInputDateTimeRangeField';
|
|
|
13
13
|
export * from './SingleInputDateRangeField';
|
|
14
14
|
export * from './SingleInputTimeRangeField';
|
|
15
15
|
export * from './SingleInputDateTimeRangeField';
|
|
16
|
-
export type { RangeFieldSection, BaseMultiInputFieldProps, MultiInputFieldSlotTextFieldProps, } from './internals/models/fields';
|
|
17
16
|
export * from './DateRangeCalendar';
|
|
18
17
|
export * from './DateRangePicker';
|
|
19
18
|
export * from './DesktopDateRangePicker';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers-pro v7.0.0-beta.
|
|
2
|
+
* @mui/x-date-pickers-pro v7.0.0-beta.4
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
@@ -21,6 +21,7 @@ export * from './MultiInputDateTimeRangeField';
|
|
|
21
21
|
export * from './SingleInputDateRangeField';
|
|
22
22
|
export * from './SingleInputTimeRangeField';
|
|
23
23
|
export * from './SingleInputDateTimeRangeField';
|
|
24
|
+
|
|
24
25
|
// Calendars
|
|
25
26
|
export * from './DateRangeCalendar';
|
|
26
27
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { UsePickerParams, BasePickerProps, ExportedBaseToolbarProps, UsePickerViewsProps, BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, DateOrTimeViewWithMeridiem, ExportedBaseTabsProps } from '@mui/x-date-pickers/internals';
|
|
2
2
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
3
|
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
|
|
4
|
-
import {
|
|
4
|
+
import { BaseRangeNonStaticPickerProps } from '../../models';
|
|
5
5
|
import { UseRangePositionProps, UseRangePositionResponse } from '../useRangePosition';
|
|
6
6
|
import { RangePickerFieldSlots, RangePickerFieldSlotProps } from '../useEnrichedRangePickerFieldProps';
|
|
7
|
-
import { DateRange } from '../../../models';
|
|
7
|
+
import { DateRange, RangeFieldSection } from '../../../models';
|
|
8
8
|
export interface UseRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<DateRange<TDate>, TDate, TView>, RangePickerFieldSlots {
|
|
9
9
|
}
|
|
10
|
-
export interface UseRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<DateRange<TDate>, TDate, TView>, RangePickerFieldSlotProps<TDate> {
|
|
10
|
+
export interface UseRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends ExportedPickersLayoutSlotProps<DateRange<TDate>, TDate, TView>, RangePickerFieldSlotProps<TDate, TEnableAccessibleFieldDOMStructure> {
|
|
11
11
|
tabs?: ExportedBaseTabsProps;
|
|
12
12
|
toolbar?: ExportedBaseToolbarProps;
|
|
13
13
|
}
|
|
14
|
-
export interface RangeOnlyPickerProps
|
|
14
|
+
export interface RangeOnlyPickerProps extends BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, BaseRangeNonStaticPickerProps, UseRangePositionProps {
|
|
15
15
|
}
|
|
16
|
-
export interface UseRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>, TAdditionalViewProps extends {}> extends RangeOnlyPickerProps
|
|
16
|
+
export interface UseRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>, TAdditionalViewProps extends {}> extends RangeOnlyPickerProps, BasePickerProps<DateRange<TDate>, TDate, TView, TError, TExternalProps, TAdditionalViewProps> {
|
|
17
17
|
}
|
|
18
18
|
export interface RangePickerAdditionalViewProps extends Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
|
|
19
19
|
}
|
|
@@ -2,6 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
3
3
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
4
|
import { UseDesktopRangePickerParams, UseDesktopRangePickerProps } from './useDesktopRangePicker.types';
|
|
5
|
-
export declare const useDesktopRangePicker: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ...pickerParams }: UseDesktopRangePickerParams<TDate, TView, TExternalProps>) => {
|
|
5
|
+
export declare const useDesktopRangePicker: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>>({ props, ...pickerParams }: UseDesktopRangePickerParams<TDate, TView, TEnableAccessibleFieldDOMStructure, TExternalProps>) => {
|
|
6
6
|
renderPicker: () => React.JSX.Element;
|
|
7
7
|
};
|
|
@@ -27,6 +27,9 @@ export const useDesktopRangePicker = _ref => {
|
|
|
27
27
|
sx,
|
|
28
28
|
format,
|
|
29
29
|
formatDensity,
|
|
30
|
+
enableAccessibleFieldDOMStructure,
|
|
31
|
+
selectedSections,
|
|
32
|
+
onSelectedSectionsChange,
|
|
30
33
|
timezone,
|
|
31
34
|
label,
|
|
32
35
|
inputRef,
|
|
@@ -41,12 +44,14 @@ export const useDesktopRangePicker = _ref => {
|
|
|
41
44
|
const fieldContainerRef = React.useRef(null);
|
|
42
45
|
const anchorRef = React.useRef(null);
|
|
43
46
|
const popperRef = React.useRef(null);
|
|
47
|
+
const startFieldRef = React.useRef(null);
|
|
48
|
+
const endFieldRef = React.useRef(null);
|
|
44
49
|
const initialView = React.useRef((_props$openTo = props.openTo) != null ? _props$openTo : null);
|
|
50
|
+
const fieldType = (_fieldType = slots.field.fieldType) != null ? _fieldType : 'multi-input';
|
|
45
51
|
const {
|
|
46
52
|
rangePosition,
|
|
47
|
-
onRangePositionChange
|
|
48
|
-
|
|
49
|
-
} = useRangePosition(props);
|
|
53
|
+
onRangePositionChange
|
|
54
|
+
} = useRangePosition(props, fieldType === 'single-input' ? startFieldRef : undefined);
|
|
50
55
|
const {
|
|
51
56
|
open,
|
|
52
57
|
actions,
|
|
@@ -58,6 +63,7 @@ export const useDesktopRangePicker = _ref => {
|
|
|
58
63
|
props,
|
|
59
64
|
wrapperVariant: 'desktop',
|
|
60
65
|
autoFocusView: false,
|
|
66
|
+
fieldRef: rangePosition === 'start' ? startFieldRef : endFieldRef,
|
|
61
67
|
additionalViewProps: {
|
|
62
68
|
rangePosition,
|
|
63
69
|
onRangePositionChange
|
|
@@ -79,7 +85,6 @@ export const useDesktopRangePicker = _ref => {
|
|
|
79
85
|
});
|
|
80
86
|
};
|
|
81
87
|
const Field = slots.field;
|
|
82
|
-
const fieldType = (_fieldType = Field.fieldType) != null ? _fieldType : 'multi-input';
|
|
83
88
|
const fieldProps = useSlotProps({
|
|
84
89
|
elementType: Field,
|
|
85
90
|
externalSlotProps: slotProps == null ? void 0 : slotProps.field,
|
|
@@ -90,13 +95,16 @@ export const useDesktopRangePicker = _ref => {
|
|
|
90
95
|
sx,
|
|
91
96
|
format,
|
|
92
97
|
formatDensity,
|
|
98
|
+
enableAccessibleFieldDOMStructure,
|
|
99
|
+
selectedSections,
|
|
100
|
+
onSelectedSectionsChange,
|
|
93
101
|
timezone,
|
|
94
102
|
autoFocus: autoFocus && !props.open,
|
|
95
103
|
ref: fieldContainerRef
|
|
96
|
-
},
|
|
104
|
+
}, inputRef ? {
|
|
97
105
|
inputRef,
|
|
98
106
|
name
|
|
99
|
-
}),
|
|
107
|
+
} : {}),
|
|
100
108
|
ownerState: props
|
|
101
109
|
});
|
|
102
110
|
const enrichedFieldProps = useEnrichedRangePickerFieldProps({
|
|
@@ -111,11 +119,12 @@ export const useDesktopRangePicker = _ref => {
|
|
|
111
119
|
onBlur: handleBlur,
|
|
112
120
|
rangePosition,
|
|
113
121
|
onRangePositionChange,
|
|
114
|
-
singleInputFieldRef,
|
|
115
122
|
pickerSlotProps: slotProps,
|
|
116
123
|
pickerSlots: slots,
|
|
117
124
|
fieldProps,
|
|
118
125
|
anchorRef,
|
|
126
|
+
startFieldRef,
|
|
127
|
+
endFieldRef,
|
|
119
128
|
currentView: layoutProps.view !== props.openTo ? layoutProps.view : undefined,
|
|
120
129
|
initialView: (_initialView$current = initialView.current) != null ? _initialView$current : undefined,
|
|
121
130
|
onViewChange: layoutProps.onViewChange
|
|
@@ -3,15 +3,15 @@ import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
|
3
3
|
import { RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
|
|
4
4
|
export interface UseDesktopRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TDate, TView>, PickersPopperSlots {
|
|
5
5
|
}
|
|
6
|
-
export interface UseDesktopRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlotProps<TDate, TView>, PickersPopperSlotProps {
|
|
6
|
+
export interface UseDesktopRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends UseRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>, PickersPopperSlotProps {
|
|
7
7
|
}
|
|
8
|
-
export interface DesktopRangeOnlyPickerProps
|
|
8
|
+
export interface DesktopRangeOnlyPickerProps extends RangeOnlyPickerProps {
|
|
9
9
|
/**
|
|
10
10
|
* If `true`, the start `input` element is focused during the first mount.
|
|
11
11
|
*/
|
|
12
12
|
autoFocus?: boolean;
|
|
13
13
|
}
|
|
14
|
-
export interface UseDesktopRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, DesktopRangePickerAdditionalViewProps> {
|
|
14
|
+
export interface UseDesktopRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, DesktopRangePickerAdditionalViewProps> {
|
|
15
15
|
/**
|
|
16
16
|
* Overridable component slots.
|
|
17
17
|
* @default {}
|
|
@@ -21,9 +21,9 @@ export interface UseDesktopRangePickerProps<TDate extends PickerValidDate, TView
|
|
|
21
21
|
* The props used for each component slot.
|
|
22
22
|
* @default {}
|
|
23
23
|
*/
|
|
24
|
-
slotProps?: UseDesktopRangePickerSlotProps<TDate, TView>;
|
|
24
|
+
slotProps?: UseDesktopRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>;
|
|
25
25
|
}
|
|
26
26
|
export interface DesktopRangePickerAdditionalViewProps extends RangePickerAdditionalViewProps {
|
|
27
27
|
}
|
|
28
|
-
export interface UseDesktopRangePickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, DesktopRangePickerAdditionalViewProps> {
|
|
28
|
+
export interface UseDesktopRangePickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, DesktopRangePickerAdditionalViewProps> {
|
|
29
29
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Stack, { StackProps } from '@mui/material/Stack';
|
|
3
3
|
import Typography, { TypographyProps } from '@mui/material/Typography';
|
|
4
|
-
import TextField
|
|
4
|
+
import TextField from '@mui/material/TextField';
|
|
5
5
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
6
|
-
import { BaseSingleInputFieldProps, PickerValidDate } from '@mui/x-date-pickers/models';
|
|
6
|
+
import { BaseSingleInputFieldProps, FieldRef, PickerValidDate } from '@mui/x-date-pickers/models';
|
|
7
7
|
import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks';
|
|
8
8
|
import { PickersInputLocaleText } from '@mui/x-date-pickers/locales';
|
|
9
|
-
import { BaseFieldProps, UsePickerResponse, WrapperVariant, UsePickerProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
10
|
-
import {
|
|
11
|
-
import { DateRange, RangePosition } from '../../models';
|
|
9
|
+
import { BaseFieldProps, UsePickerResponse, WrapperVariant, UsePickerProps, SlotComponentPropsFromProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { UseDateRangeFieldProps } from '../models';
|
|
11
|
+
import { BaseMultiInputFieldProps, RangeFieldSection, DateRange, RangePosition, FieldType } from '../../models';
|
|
12
12
|
import { UseRangePositionResponse } from './useRangePosition';
|
|
13
13
|
export interface RangePickerFieldSlots extends UseClearableFieldSlots {
|
|
14
14
|
field: React.ElementType;
|
|
@@ -25,35 +25,35 @@ export interface RangePickerFieldSlots extends UseClearableFieldSlots {
|
|
|
25
25
|
/**
|
|
26
26
|
* Form control with an input to render a date or time inside the default field.
|
|
27
27
|
* It is rendered twice: once for the start element and once for the end element.
|
|
28
|
-
*
|
|
29
|
-
* @default TextField from '@mui/material'
|
|
28
|
+
* @default TextField from '@mui/material' or PickersTextField if `enableAccessibleFieldDOMStructure` is `true`.
|
|
30
29
|
*/
|
|
31
|
-
textField?: React.ElementType
|
|
30
|
+
textField?: React.ElementType;
|
|
32
31
|
}
|
|
33
|
-
export interface RangePickerFieldSlotProps<TDate extends PickerValidDate> extends UseClearableFieldSlotProps {
|
|
34
|
-
field?:
|
|
32
|
+
export interface RangePickerFieldSlotProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends UseClearableFieldSlotProps {
|
|
33
|
+
field?: SlotComponentPropsFromProps<BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, unknown>, {}, UsePickerProps<DateRange<TDate>, TDate, any, any, any, any>>;
|
|
35
34
|
fieldRoot?: SlotComponentProps<typeof Stack, {}, Record<string, any>>;
|
|
36
35
|
fieldSeparator?: SlotComponentProps<typeof Typography, {}, Record<string, any>>;
|
|
37
|
-
textField?: SlotComponentProps<typeof TextField, {}, UseDateRangeFieldProps<TDate> & {
|
|
36
|
+
textField?: SlotComponentProps<typeof TextField, {}, UseDateRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure> & {
|
|
38
37
|
position?: RangePosition;
|
|
39
38
|
}>;
|
|
40
39
|
}
|
|
41
|
-
export interface UseEnrichedRangePickerFieldPropsParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, FieldProps extends BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError> = BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>> extends Pick<UsePickerResponse<DateRange<TDate>, TView, RangeFieldSection, any>, 'open' | 'actions'>, UseRangePositionResponse {
|
|
40
|
+
export interface UseEnrichedRangePickerFieldPropsParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, FieldProps extends BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError> = BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError>> extends Pick<UsePickerResponse<DateRange<TDate>, TView, RangeFieldSection, any>, 'open' | 'actions'>, UseRangePositionResponse {
|
|
42
41
|
wrapperVariant: WrapperVariant;
|
|
43
42
|
fieldType: FieldType;
|
|
44
43
|
readOnly?: boolean;
|
|
45
44
|
labelId?: string;
|
|
46
45
|
disableOpenPicker?: boolean;
|
|
47
46
|
onBlur?: () => void;
|
|
48
|
-
inputRef?: React.Ref<HTMLInputElement>;
|
|
49
47
|
label?: React.ReactNode;
|
|
50
48
|
localeText: PickersInputLocaleText<TDate> | undefined;
|
|
51
|
-
pickerSlotProps: RangePickerFieldSlotProps<TDate> | undefined;
|
|
49
|
+
pickerSlotProps: RangePickerFieldSlotProps<TDate, TEnableAccessibleFieldDOMStructure> | undefined;
|
|
52
50
|
pickerSlots: RangePickerFieldSlots | undefined;
|
|
53
51
|
fieldProps: FieldProps;
|
|
54
52
|
anchorRef?: React.Ref<HTMLDivElement>;
|
|
55
53
|
currentView?: TView | null;
|
|
56
54
|
initialView?: TView;
|
|
57
55
|
onViewChange?: (view: TView) => void;
|
|
56
|
+
startFieldRef: React.RefObject<FieldRef<RangeFieldSection>>;
|
|
57
|
+
endFieldRef: React.RefObject<FieldRef<RangeFieldSection>>;
|
|
58
58
|
}
|
|
59
|
-
export declare const useEnrichedRangePickerFieldProps: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError>(params: UseEnrichedRangePickerFieldPropsParams<TDate, TView, TError, BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>>) => BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError> | BaseSingleInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>;
|
|
59
|
+
export declare const useEnrichedRangePickerFieldProps: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError>(params: UseEnrichedRangePickerFieldPropsParams<TDate, TView, TEnableAccessibleFieldDOMStructure, TError, BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError>>) => BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError> | BaseSingleInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError>;
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
7
|
import useForkRef from '@mui/utils/useForkRef';
|
|
8
|
-
import { onSpaceOrEnter, useLocaleText
|
|
8
|
+
import { onSpaceOrEnter, useLocaleText } from '@mui/x-date-pickers/internals';
|
|
9
9
|
const useMultiInputFieldSlotProps = ({
|
|
10
10
|
wrapperVariant,
|
|
11
11
|
open,
|
|
@@ -23,35 +23,33 @@ const useMultiInputFieldSlotProps = ({
|
|
|
23
23
|
anchorRef,
|
|
24
24
|
currentView,
|
|
25
25
|
initialView,
|
|
26
|
-
onViewChange
|
|
26
|
+
onViewChange,
|
|
27
|
+
startFieldRef,
|
|
28
|
+
endFieldRef
|
|
27
29
|
}) => {
|
|
28
30
|
const localeText = useLocaleText();
|
|
29
|
-
const startRef = React.useRef(null);
|
|
30
|
-
const endRef = React.useRef(null);
|
|
31
|
-
const startFieldRef = React.useRef(null);
|
|
32
|
-
const endFieldRef = React.useRef(null);
|
|
33
31
|
const handleStartFieldRef = useForkRef(fieldProps.unstableStartFieldRef, startFieldRef);
|
|
34
|
-
const handleEndFieldRef = useForkRef(fieldProps.
|
|
32
|
+
const handleEndFieldRef = useForkRef(fieldProps.unstableEndFieldRef, endFieldRef);
|
|
35
33
|
const previousRangePosition = React.useRef(rangePosition);
|
|
36
34
|
React.useEffect(() => {
|
|
37
|
-
var
|
|
35
|
+
var _currentFieldRef$curr;
|
|
38
36
|
if (!open) {
|
|
39
37
|
return;
|
|
40
38
|
}
|
|
41
|
-
const currentRef = rangePosition === 'start' ? startRef : endRef;
|
|
42
|
-
(_currentRef$current = currentRef.current) == null || _currentRef$current.focus();
|
|
43
39
|
const currentFieldRef = rangePosition === 'start' ? startFieldRef : endFieldRef;
|
|
40
|
+
(_currentFieldRef$curr = currentFieldRef.current) == null || _currentFieldRef$curr.focusField();
|
|
44
41
|
if (!currentFieldRef.current || !currentView) {
|
|
45
42
|
// could happen when the user is switching between the inputs
|
|
46
43
|
previousRangePosition.current = rangePosition;
|
|
47
44
|
return;
|
|
48
45
|
}
|
|
46
|
+
|
|
49
47
|
// bring back focus to the field
|
|
50
48
|
currentFieldRef.current.setSelectedSections(
|
|
51
49
|
// use the current view or `0` when the range position has just been swapped
|
|
52
50
|
previousRangePosition.current === rangePosition ? currentView : 0);
|
|
53
51
|
previousRangePosition.current = rangePosition;
|
|
54
|
-
}, [rangePosition, open, currentView]);
|
|
52
|
+
}, [rangePosition, open, currentView, startFieldRef, endFieldRef]);
|
|
55
53
|
const openRangeStartSelection = event => {
|
|
56
54
|
event.stopPropagation();
|
|
57
55
|
onRangePositionChange('start');
|
|
@@ -90,12 +88,11 @@ const useMultiInputFieldSlotProps = ({
|
|
|
90
88
|
const slotProps = _extends({}, fieldProps.slotProps, {
|
|
91
89
|
textField: ownerState => {
|
|
92
90
|
const resolvedComponentProps = resolveComponentProps(pickerSlotProps == null ? void 0 : pickerSlotProps.textField, ownerState);
|
|
93
|
-
let
|
|
91
|
+
let textFieldProps;
|
|
94
92
|
let InputProps;
|
|
95
93
|
if (ownerState.position === 'start') {
|
|
96
94
|
var _inLocaleText$start;
|
|
97
|
-
|
|
98
|
-
inputRef: startRef,
|
|
95
|
+
textFieldProps = _extends({
|
|
99
96
|
label: (_inLocaleText$start = inLocaleText == null ? void 0 : inLocaleText.start) != null ? _inLocaleText$start : localeText.start,
|
|
100
97
|
onKeyDown: onSpaceOrEnter(openRangeStartSelection),
|
|
101
98
|
onFocus: handleFocusStart,
|
|
@@ -112,8 +109,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
112
109
|
}
|
|
113
110
|
} else {
|
|
114
111
|
var _inLocaleText$end;
|
|
115
|
-
|
|
116
|
-
inputRef: endRef,
|
|
112
|
+
textFieldProps = _extends({
|
|
117
113
|
label: (_inLocaleText$end = inLocaleText == null ? void 0 : inLocaleText.end) != null ? _inLocaleText$end : localeText.end,
|
|
118
114
|
onKeyDown: onSpaceOrEnter(openRangeEndSelection),
|
|
119
115
|
onFocus: handleFocusEnd,
|
|
@@ -127,7 +123,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
127
123
|
}
|
|
128
124
|
return _extends({}, labelId != null && {
|
|
129
125
|
id: `${labelId}-${ownerState.position}`
|
|
130
|
-
},
|
|
126
|
+
}, textFieldProps, resolveComponentProps(pickerSlotProps == null ? void 0 : pickerSlotProps.textField, ownerState), {
|
|
131
127
|
InputProps
|
|
132
128
|
});
|
|
133
129
|
},
|
|
@@ -141,12 +137,13 @@ const useMultiInputFieldSlotProps = ({
|
|
|
141
137
|
});
|
|
142
138
|
|
|
143
139
|
/* TODO: remove this when a clearable behavior for multiple input range fields is implemented */
|
|
144
|
-
const
|
|
140
|
+
const _ref = fieldProps,
|
|
141
|
+
restFieldProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
145
142
|
const enrichedFieldProps = _extends({}, restFieldProps, {
|
|
146
|
-
slots,
|
|
147
|
-
slotProps,
|
|
148
143
|
unstableStartFieldRef: handleStartFieldRef,
|
|
149
|
-
unstableEndFieldRef: handleEndFieldRef
|
|
144
|
+
unstableEndFieldRef: handleEndFieldRef,
|
|
145
|
+
slots,
|
|
146
|
+
slotProps
|
|
150
147
|
});
|
|
151
148
|
return enrichedFieldProps;
|
|
152
149
|
};
|
|
@@ -155,52 +152,53 @@ const useSingleInputFieldSlotProps = ({
|
|
|
155
152
|
open,
|
|
156
153
|
actions,
|
|
157
154
|
readOnly,
|
|
158
|
-
inputRef: inInputRef,
|
|
159
155
|
labelId,
|
|
160
156
|
disableOpenPicker,
|
|
161
157
|
label,
|
|
162
158
|
onBlur,
|
|
163
159
|
rangePosition,
|
|
164
160
|
onRangePositionChange,
|
|
165
|
-
|
|
161
|
+
startFieldRef,
|
|
162
|
+
endFieldRef,
|
|
166
163
|
pickerSlots,
|
|
167
164
|
pickerSlotProps,
|
|
168
165
|
fieldProps,
|
|
169
166
|
anchorRef,
|
|
170
167
|
currentView
|
|
171
168
|
}) => {
|
|
172
|
-
const
|
|
173
|
-
const handleInputRef = useForkRef(inInputRef, inputRef);
|
|
174
|
-
const handleFieldRef = useForkRef(fieldProps.unstableFieldRef, singleInputFieldRef);
|
|
169
|
+
const handleFieldRef = useForkRef(fieldProps.unstableFieldRef, startFieldRef, endFieldRef);
|
|
175
170
|
React.useEffect(() => {
|
|
176
|
-
|
|
177
|
-
if (!open) {
|
|
171
|
+
if (!open || !startFieldRef.current) {
|
|
178
172
|
return;
|
|
179
173
|
}
|
|
180
|
-
(
|
|
181
|
-
if (!singleInputFieldRef.current || !currentView) {
|
|
174
|
+
if (startFieldRef.current.isFieldFocused()) {
|
|
182
175
|
return;
|
|
183
176
|
}
|
|
184
|
-
|
|
177
|
+
|
|
185
178
|
// bring back focus to the field with the current view section selected
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
if (currentView) {
|
|
180
|
+
var _startFieldRef$curren;
|
|
181
|
+
const sections = startFieldRef.current.getSections().map(section => section.type);
|
|
182
|
+
const newSelectedSection = rangePosition === 'start' ? sections.indexOf(currentView) : sections.lastIndexOf(currentView);
|
|
183
|
+
(_startFieldRef$curren = startFieldRef.current) == null || _startFieldRef$curren.focusField(newSelectedSection);
|
|
184
|
+
}
|
|
185
|
+
}, [rangePosition, open, currentView, startFieldRef]);
|
|
188
186
|
const updateRangePosition = () => {
|
|
189
|
-
var
|
|
190
|
-
if (!
|
|
187
|
+
var _startFieldRef$curren2, _startFieldRef$curren3;
|
|
188
|
+
if (!((_startFieldRef$curren2 = startFieldRef.current) != null && _startFieldRef$curren2.isFieldFocused())) {
|
|
191
189
|
return;
|
|
192
190
|
}
|
|
193
|
-
const sections =
|
|
194
|
-
const activeSectionIndex = (
|
|
191
|
+
const sections = startFieldRef.current.getSections();
|
|
192
|
+
const activeSectionIndex = (_startFieldRef$curren3 = startFieldRef.current) == null ? void 0 : _startFieldRef$curren3.getActiveSectionIndex();
|
|
195
193
|
const domRangePosition = activeSectionIndex == null || activeSectionIndex < sections.length / 2 ? 'start' : 'end';
|
|
196
194
|
if (domRangePosition != null && domRangePosition !== rangePosition) {
|
|
197
195
|
onRangePositionChange(domRangePosition);
|
|
198
196
|
}
|
|
199
197
|
};
|
|
200
|
-
const handleSelectedSectionsChange = useEventCallback(
|
|
198
|
+
const handleSelectedSectionsChange = useEventCallback(selectedSection => {
|
|
201
199
|
var _fieldProps$onSelecte;
|
|
202
200
|
setTimeout(updateRangePosition);
|
|
203
|
-
(_fieldProps$onSelecte = fieldProps.onSelectedSectionsChange) == null || _fieldProps$onSelecte.call(fieldProps,
|
|
201
|
+
(_fieldProps$onSelecte = fieldProps.onSelectedSectionsChange) == null || _fieldProps$onSelecte.call(fieldProps, selectedSection);
|
|
204
202
|
});
|
|
205
203
|
const openPicker = event => {
|
|
206
204
|
event.stopPropagation();
|
|
@@ -223,7 +221,6 @@ const useSingleInputFieldSlotProps = ({
|
|
|
223
221
|
slotProps,
|
|
224
222
|
label,
|
|
225
223
|
unstableFieldRef: handleFieldRef,
|
|
226
|
-
inputRef: handleInputRef,
|
|
227
224
|
onKeyDown: onSpaceOrEnter(openPicker, fieldProps.onKeyDown),
|
|
228
225
|
onSelectedSectionsChange: handleSelectedSectionsChange,
|
|
229
226
|
onBlur,
|