@mui/x-date-pickers 9.0.0-alpha.4 → 9.0.0
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/AdapterDateFnsBase/AdapterDateFnsBase.mjs +1 -1
- package/AdapterDayjs/AdapterDayjs.mjs +1 -1
- package/AdapterLuxon/AdapterLuxon.mjs +1 -1
- package/AdapterMoment/AdapterMoment.mjs +1 -1
- package/AdapterMomentHijri/AdapterMomentHijri.mjs +1 -1
- package/AdapterMomentJalaali/AdapterMomentJalaali.mjs +1 -1
- package/CHANGELOG.md +374 -2
- package/DateCalendar/DateCalendar.js +1 -1
- package/DateCalendar/DateCalendar.mjs +1 -1
- package/DateCalendar/DayCalendar.d.mts +7 -7
- package/DateCalendar/DayCalendar.d.ts +7 -7
- package/DateCalendar/DayCalendar.js +23 -25
- package/DateCalendar/DayCalendar.mjs +23 -25
- package/DateField/DateField.d.mts +1 -1
- package/DateField/DateField.d.ts +1 -1
- package/DateField/DateField.js +22 -28
- package/DateField/DateField.mjs +22 -28
- package/DateField/DateField.types.d.mts +3 -3
- package/DateField/DateField.types.d.ts +3 -3
- package/DateField/useDateField.d.mts +1 -1
- package/DateField/useDateField.d.ts +1 -1
- package/DateField/useDateField.js +1 -1
- package/DateField/useDateField.mjs +1 -1
- package/DatePicker/DatePicker.d.mts +1 -1
- package/DatePicker/DatePicker.d.ts +1 -1
- package/DatePicker/DatePicker.js +1 -5
- package/DatePicker/DatePicker.mjs +1 -5
- package/DatePicker/DatePicker.types.d.mts +3 -3
- package/DatePicker/DatePicker.types.d.ts +3 -3
- package/DateTimeField/DateTimeField.d.mts +1 -1
- package/DateTimeField/DateTimeField.d.ts +1 -1
- package/DateTimeField/DateTimeField.js +22 -28
- package/DateTimeField/DateTimeField.mjs +22 -28
- package/DateTimeField/DateTimeField.types.d.mts +2 -2
- package/DateTimeField/DateTimeField.types.d.ts +2 -2
- package/DateTimeField/useDateTimeField.d.mts +1 -1
- package/DateTimeField/useDateTimeField.d.ts +1 -1
- package/DateTimeField/useDateTimeField.js +1 -1
- package/DateTimeField/useDateTimeField.mjs +1 -1
- package/DateTimePicker/DateTimePicker.d.mts +1 -1
- package/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/DateTimePicker/DateTimePicker.js +1 -5
- package/DateTimePicker/DateTimePicker.mjs +1 -5
- package/DateTimePicker/DateTimePicker.types.d.mts +3 -3
- package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
- package/DesktopDatePicker/DesktopDatePicker.d.mts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +1 -5
- package/DesktopDatePicker/DesktopDatePicker.mjs +1 -5
- package/DesktopDatePicker/DesktopDatePicker.types.d.mts +3 -3
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +3 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.mts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -5
- package/DesktopDateTimePicker/DesktopDateTimePicker.mjs +1 -5
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.mts +3 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +3 -3
- package/DesktopTimePicker/DesktopTimePicker.d.mts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.js +0 -4
- package/DesktopTimePicker/DesktopTimePicker.mjs +0 -4
- package/DesktopTimePicker/DesktopTimePicker.types.d.mts +3 -3
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +3 -3
- package/DigitalClock/DigitalClock.d.mts +1 -1
- package/DigitalClock/DigitalClock.d.ts +1 -1
- package/DigitalClock/DigitalClock.js +2 -2
- package/DigitalClock/DigitalClock.mjs +3 -3
- package/LocalizationProvider/LocalizationProvider.d.mts +0 -6
- package/LocalizationProvider/LocalizationProvider.d.ts +0 -6
- package/LocalizationProvider/LocalizationProvider.js +1 -10
- package/LocalizationProvider/LocalizationProvider.mjs +0 -9
- package/LocalizationProvider/index.d.mts +1 -1
- package/LocalizationProvider/index.d.ts +1 -1
- package/LocalizationProvider/index.js +0 -6
- package/LocalizationProvider/index.mjs +1 -1
- package/MobileDatePicker/MobileDatePicker.d.mts +1 -1
- package/MobileDatePicker/MobileDatePicker.d.ts +1 -1
- package/MobileDatePicker/MobileDatePicker.js +1 -5
- package/MobileDatePicker/MobileDatePicker.mjs +1 -5
- package/MobileDatePicker/MobileDatePicker.types.d.mts +3 -3
- package/MobileDatePicker/MobileDatePicker.types.d.ts +3 -3
- package/MobileDateTimePicker/MobileDateTimePicker.d.mts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +1 -5
- package/MobileDateTimePicker/MobileDateTimePicker.mjs +1 -5
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.mts +3 -3
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +3 -3
- package/MobileTimePicker/MobileTimePicker.d.mts +1 -1
- package/MobileTimePicker/MobileTimePicker.d.ts +1 -1
- package/MobileTimePicker/MobileTimePicker.js +0 -4
- package/MobileTimePicker/MobileTimePicker.mjs +0 -4
- package/MobileTimePicker/MobileTimePicker.types.d.mts +3 -3
- package/MobileTimePicker/MobileTimePicker.types.d.ts +3 -3
- package/MonthCalendar/MonthCalendarButton.js +2 -2
- package/MonthCalendar/MonthCalendarButton.mjs +3 -3
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +2 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.mjs +3 -3
- package/PickerDay/PickerDay.d.mts +14 -0
- package/PickerDay/PickerDay.d.ts +14 -0
- package/{PickerDay2/PickerDay2.js → PickerDay/PickerDay.js} +110 -45
- package/{PickerDay2/PickerDay2.mjs → PickerDay/PickerDay.mjs} +110 -45
- package/PickerDay/PickerDay.types.d.mts +137 -0
- package/PickerDay/PickerDay.types.d.ts +137 -0
- package/PickerDay/index.d.mts +4 -0
- package/PickerDay/index.d.ts +4 -0
- package/PickerDay/index.js +25 -0
- package/PickerDay/index.mjs +2 -0
- package/{PickerDay2/pickerDay2Classes.d.mts → PickerDay/pickerDayClasses.d.mts} +4 -4
- package/{PickerDay2/pickerDay2Classes.d.ts → PickerDay/pickerDayClasses.d.ts} +4 -4
- package/PickerDay/pickerDayClasses.js +14 -0
- package/PickerDay/pickerDayClasses.mjs +6 -0
- package/PickersTextField/PickersFilledInput/PickersFilledInput.js +37 -16
- package/PickersTextField/PickersFilledInput/PickersFilledInput.mjs +37 -16
- package/PickersTextField/PickersInput/PickersInput.js +35 -14
- package/PickersTextField/PickersInput/PickersInput.mjs +35 -14
- package/PickersTextField/PickersInputBase/PickersInputBase.js +38 -8
- package/PickersTextField/PickersInputBase/PickersInputBase.mjs +38 -8
- package/PickersTextField/PickersInputBase/PickersInputBase.types.d.mts +56 -13
- package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +56 -13
- package/PickersTextField/PickersOutlinedInput/Outline.js +1 -1
- package/PickersTextField/PickersOutlinedInput/Outline.mjs +1 -1
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +33 -11
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.mjs +33 -11
- package/PickersTextField/PickersTextField.js +92 -39
- package/PickersTextField/PickersTextField.mjs +92 -39
- package/PickersTextField/PickersTextField.types.d.mts +56 -28
- package/PickersTextField/PickersTextField.types.d.ts +56 -28
- package/PickersTextField/index.d.mts +1 -1
- package/PickersTextField/index.d.ts +1 -1
- package/StaticDatePicker/StaticDatePicker.js +1 -1
- package/StaticDatePicker/StaticDatePicker.mjs +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.mjs +1 -1
- package/TimeField/TimeField.d.mts +1 -1
- package/TimeField/TimeField.d.ts +1 -1
- package/TimeField/TimeField.js +23 -29
- package/TimeField/TimeField.mjs +23 -29
- package/TimeField/TimeField.types.d.mts +2 -2
- package/TimeField/TimeField.types.d.ts +2 -2
- package/TimeField/useTimeField.d.mts +1 -1
- package/TimeField/useTimeField.d.ts +1 -1
- package/TimePicker/TimePicker.d.mts +1 -1
- package/TimePicker/TimePicker.d.ts +1 -1
- package/TimePicker/TimePicker.js +0 -4
- package/TimePicker/TimePicker.mjs +0 -4
- package/TimePicker/TimePicker.types.d.mts +3 -3
- package/TimePicker/TimePicker.types.d.ts +3 -3
- package/YearCalendar/YearCalendarButton.js +2 -2
- package/YearCalendar/YearCalendarButton.mjs +3 -3
- package/hooks/useParsedFormat.js +5 -7
- package/hooks/useParsedFormat.mjs +5 -7
- package/hooks/useSplitFieldProps.d.mts +1 -1
- package/hooks/useSplitFieldProps.d.ts +1 -1
- package/hooks/useSplitFieldProps.js +1 -1
- package/hooks/useSplitFieldProps.mjs +1 -1
- package/index.d.mts +1 -2
- package/index.d.ts +1 -2
- package/index.js +2 -14
- package/index.mjs +2 -3
- package/internals/components/PickerFieldUI.d.mts +11 -17
- package/internals/components/PickerFieldUI.d.ts +11 -17
- package/internals/components/PickerFieldUI.js +65 -114
- package/internals/components/PickerFieldUI.mjs +65 -114
- package/internals/components/PickerPopper/PickerPopper.js +3 -0
- package/internals/components/PickerPopper/PickerPopper.mjs +3 -0
- package/internals/components/PickersToolbar.js +3 -1
- package/internals/components/PickersToolbar.mjs +3 -1
- package/internals/demo/DemoContainer.js +6 -8
- package/internals/demo/DemoContainer.mjs +6 -8
- package/internals/hooks/PickerDay.types.d.mts +12 -0
- package/internals/hooks/PickerDay.types.d.ts +12 -0
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.mts +2 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +2 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.mts +6 -6
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +6 -6
- package/internals/hooks/useField/buildSectionsFromFormat.d.mts +0 -1
- package/internals/hooks/useField/buildSectionsFromFormat.d.ts +0 -1
- package/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/internals/hooks/useField/buildSectionsFromFormat.mjs +1 -1
- package/internals/hooks/useField/index.d.mts +1 -1
- package/internals/hooks/useField/index.d.ts +1 -1
- package/internals/hooks/useField/index.js +2 -8
- package/internals/hooks/useField/index.mjs +1 -1
- package/internals/hooks/useField/useField.d.mts +2 -2
- package/internals/hooks/useField/useField.d.ts +2 -2
- package/internals/hooks/useField/useField.js +265 -8
- package/internals/hooks/useField/useField.mjs +264 -8
- package/internals/hooks/useField/useField.types.d.mts +11 -50
- package/internals/hooks/useField/useField.types.d.ts +11 -50
- package/internals/hooks/useField/useField.utils.d.mts +2 -3
- package/internals/hooks/useField/useField.utils.d.ts +2 -3
- package/internals/hooks/useField/useField.utils.js +8 -65
- package/internals/hooks/useField/useField.utils.mjs +6 -62
- package/internals/hooks/useField/useFieldHiddenInputProps.d.mts +2 -4
- package/internals/hooks/useField/useFieldHiddenInputProps.d.ts +2 -4
- package/internals/hooks/useField/useFieldHiddenInputProps.js +1 -3
- package/internals/hooks/useField/useFieldHiddenInputProps.mjs +1 -3
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +0 -1
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.mjs +0 -1
- package/internals/hooks/useField/useFieldRootProps.d.mts +5 -5
- package/internals/hooks/useField/useFieldRootProps.d.ts +5 -5
- package/internals/hooks/useField/useFieldRootProps.js +183 -11
- package/internals/hooks/useField/useFieldRootProps.mjs +183 -11
- package/internals/hooks/useField/useFieldSectionContainerProps.d.mts +3 -5
- package/internals/hooks/useField/useFieldSectionContainerProps.d.ts +3 -5
- package/internals/hooks/useField/useFieldSectionContainerProps.js +2 -4
- package/internals/hooks/useField/useFieldSectionContainerProps.mjs +2 -4
- package/internals/hooks/useField/useFieldSectionContentProps.d.mts +6 -7
- package/internals/hooks/useField/useFieldSectionContentProps.d.ts +6 -7
- package/internals/hooks/useField/useFieldSectionContentProps.js +2 -4
- package/internals/hooks/useField/useFieldSectionContentProps.mjs +2 -4
- package/internals/hooks/useField/useFieldState.d.mts +4 -4
- package/internals/hooks/useField/useFieldState.d.ts +4 -4
- package/internals/hooks/useField/useFieldState.js +3 -6
- package/internals/hooks/useField/useFieldState.mjs +3 -6
- package/internals/hooks/useMobilePicker/useMobilePicker.d.mts +2 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +2 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.mts +6 -6
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +6 -6
- package/internals/hooks/useNullableFieldPrivateContext.d.mts +1 -1
- package/internals/hooks/useNullableFieldPrivateContext.d.ts +1 -1
- package/internals/hooks/usePicker/usePicker.js +1 -3
- package/internals/hooks/usePicker/usePicker.mjs +1 -3
- package/{PickersDay → internals/hooks}/usePickerDayOwnerState.d.mts +2 -3
- package/{PickersDay → internals/hooks}/usePickerDayOwnerState.d.ts +2 -3
- package/{PickersDay → internals/hooks}/usePickerDayOwnerState.js +3 -5
- package/{PickersDay → internals/hooks}/usePickerDayOwnerState.mjs +3 -5
- package/internals/index.d.mts +4 -4
- package/internals/index.d.ts +4 -4
- package/internals/index.js +9 -9
- package/internals/index.mjs +3 -3
- package/internals/models/manager.d.mts +3 -5
- package/internals/models/manager.d.ts +3 -5
- package/internals/utils/valueManagers.js +1 -2
- package/internals/utils/valueManagers.mjs +2 -3
- package/managers/index.d.mts +2 -2
- package/managers/index.d.ts +2 -2
- package/managers/useDateManager.d.mts +3 -6
- package/managers/useDateManager.d.ts +3 -6
- package/managers/useDateManager.js +2 -6
- package/managers/useDateManager.mjs +2 -6
- package/managers/useDateTimeManager.d.mts +3 -6
- package/managers/useDateTimeManager.d.ts +3 -6
- package/managers/useDateTimeManager.js +2 -6
- package/managers/useDateTimeManager.mjs +2 -6
- package/managers/useTimeManager.d.mts +4 -6
- package/managers/useTimeManager.d.ts +4 -6
- package/managers/useTimeManager.js +1 -3
- package/managers/useTimeManager.mjs +1 -3
- package/models/fields.d.mts +3 -4
- package/models/fields.d.ts +3 -4
- package/models/manager.d.mts +2 -8
- package/models/manager.d.ts +2 -8
- package/package.json +55 -69
- package/themeAugmentation/components.d.mts +4 -8
- package/themeAugmentation/components.d.ts +4 -8
- package/themeAugmentation/overrides.d.mts +2 -4
- package/themeAugmentation/overrides.d.ts +2 -4
- package/themeAugmentation/props.d.mts +5 -7
- package/themeAugmentation/props.d.ts +5 -7
- package/PickerDay2/PickerDay2.d.mts +0 -7
- package/PickerDay2/PickerDay2.d.ts +0 -7
- package/PickerDay2/PickerDay2.types.d.mts +0 -18
- package/PickerDay2/PickerDay2.types.d.ts +0 -18
- package/PickerDay2/index.d.mts +0 -4
- package/PickerDay2/index.d.ts +0 -4
- package/PickerDay2/index.js +0 -25
- package/PickerDay2/index.mjs +0 -2
- package/PickerDay2/pickerDay2Classes.js +0 -14
- package/PickerDay2/pickerDay2Classes.mjs +0 -6
- package/PickersDay/PickersDay.d.mts +0 -15
- package/PickersDay/PickersDay.d.ts +0 -15
- package/PickersDay/PickersDay.js +0 -384
- package/PickersDay/PickersDay.mjs +0 -377
- package/PickersDay/PickersDay.types.d.mts +0 -114
- package/PickersDay/PickersDay.types.d.ts +0 -114
- package/PickersDay/index.d.mts +0 -4
- package/PickersDay/index.d.ts +0 -4
- package/PickersDay/index.js +0 -25
- package/PickersDay/index.mjs +0 -2
- package/PickersDay/pickersDayClasses.d.mts +0 -19
- package/PickersDay/pickersDayClasses.d.ts +0 -19
- package/PickersDay/pickersDayClasses.js +0 -14
- package/PickersDay/pickersDayClasses.mjs +0 -6
- package/internals/hooks/useField/useFieldRootHandleKeyDown.d.mts +0 -16
- package/internals/hooks/useField/useFieldRootHandleKeyDown.d.ts +0 -16
- package/internals/hooks/useField/useFieldRootHandleKeyDown.js +0 -211
- package/internals/hooks/useField/useFieldRootHandleKeyDown.mjs +0 -205
- package/internals/hooks/useField/useFieldV6TextField.d.mts +0 -26
- package/internals/hooks/useField/useFieldV6TextField.d.ts +0 -26
- package/internals/hooks/useField/useFieldV6TextField.js +0 -422
- package/internals/hooks/useField/useFieldV6TextField.mjs +0 -413
- package/internals/hooks/useField/useFieldV7TextField.d.mts +0 -3
- package/internals/hooks/useField/useFieldV7TextField.d.ts +0 -3
- package/internals/hooks/useField/useFieldV7TextField.js +0 -272
- package/internals/hooks/useField/useFieldV7TextField.mjs +0 -264
- /package/{PickerDay2/PickerDay2.types.js → PickerDay/PickerDay.types.js} +0 -0
- /package/{PickerDay2/PickerDay2.types.mjs → PickerDay/PickerDay.types.mjs} +0 -0
- /package/{PickersDay/PickersDay.types.js → internals/hooks/PickerDay.types.js} +0 -0
- /package/{PickersDay/PickersDay.types.mjs → internals/hooks/PickerDay.types.mjs} +0 -0
|
@@ -3,12 +3,12 @@ import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapte
|
|
|
3
3
|
import { InternalPropNames } from "../../../hooks/useSplitFieldProps.mjs";
|
|
4
4
|
import type { PickersSectionElement, PickersSectionListRef } from "../../../PickersSectionList/index.mjs";
|
|
5
5
|
import { FormProps, InferNonNullablePickerValue, PickerRangeValue, PickerValidValue } from "../../models/index.mjs";
|
|
6
|
-
export interface UseFieldParameters<TValue extends PickerValidValue,
|
|
7
|
-
manager: PickerManager<TValue,
|
|
6
|
+
export interface UseFieldParameters<TValue extends PickerValidValue, TError, TValidationProps extends {}, TProps extends UseFieldProps> {
|
|
7
|
+
manager: PickerManager<TValue, TError, TValidationProps, any>;
|
|
8
8
|
props: TProps;
|
|
9
9
|
skipContextFieldRefAssignment?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export interface UseFieldInternalProps<TValue extends PickerValidValue,
|
|
11
|
+
export interface UseFieldInternalProps<TValue extends PickerValidValue, TError> extends TimezoneProps, FormProps, OnErrorProps<TValue, TError> {
|
|
12
12
|
/**
|
|
13
13
|
* The selected value.
|
|
14
14
|
* Used when the component is controlled.
|
|
@@ -76,10 +76,6 @@ export interface UseFieldInternalProps<TValue extends PickerValidValue, TEnableA
|
|
|
76
76
|
* The ref object used to imperatively interact with the field.
|
|
77
77
|
*/
|
|
78
78
|
fieldRef?: React.Ref<FieldRef<TValue>>;
|
|
79
|
-
/**
|
|
80
|
-
* @default true
|
|
81
|
-
*/
|
|
82
|
-
enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
|
|
83
79
|
/**
|
|
84
80
|
* If `true`, the `input` element is focused during the first mount.
|
|
85
81
|
* @default false
|
|
@@ -90,18 +86,7 @@ export interface UseFieldInternalProps<TValue extends PickerValidValue, TEnableA
|
|
|
90
86
|
*/
|
|
91
87
|
focused?: boolean;
|
|
92
88
|
}
|
|
93
|
-
export
|
|
94
|
-
clearable?: boolean;
|
|
95
|
-
error?: boolean;
|
|
96
|
-
placeholder?: string;
|
|
97
|
-
inputRef?: React.Ref<HTMLInputElement>;
|
|
98
|
-
onClick?: React.MouseEventHandler;
|
|
99
|
-
onFocus?: React.FocusEventHandler;
|
|
100
|
-
onKeyDown?: React.KeyboardEventHandler;
|
|
101
|
-
onBlur?: React.FocusEventHandler;
|
|
102
|
-
onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
|
|
103
|
-
onClear?: React.MouseEventHandler;
|
|
104
|
-
} : {
|
|
89
|
+
export interface UseFieldForwardedProps {
|
|
105
90
|
clearable?: boolean;
|
|
106
91
|
error?: boolean;
|
|
107
92
|
focused?: boolean;
|
|
@@ -113,25 +98,12 @@ export type UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure extends bo
|
|
|
113
98
|
onInput?: React.FormEventHandler<HTMLDivElement>;
|
|
114
99
|
onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
|
|
115
100
|
onClear?: React.MouseEventHandler;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* The aria label to set on the button that opens the Picker.
|
|
120
|
-
*/
|
|
121
|
-
openPickerAriaLabel: string;
|
|
122
|
-
enableAccessibleFieldDOMStructure: false;
|
|
123
|
-
focused: boolean | undefined;
|
|
124
|
-
inputMode: 'text' | 'numeric';
|
|
125
|
-
placeholder: string;
|
|
126
|
-
value: string;
|
|
127
|
-
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
128
|
-
autoComplete: 'off';
|
|
129
|
-
} : {
|
|
101
|
+
}
|
|
102
|
+
interface UseFieldAdditionalProps {
|
|
130
103
|
/**
|
|
131
104
|
* The aria label to set on the button that opens the Picker.
|
|
132
105
|
*/
|
|
133
106
|
openPickerAriaLabel: string;
|
|
134
|
-
enableAccessibleFieldDOMStructure: true;
|
|
135
107
|
elements: PickersSectionElement[];
|
|
136
108
|
tabIndex: number | undefined;
|
|
137
109
|
contentEditable: boolean;
|
|
@@ -139,8 +111,8 @@ type UseFieldAdditionalProps<TEnableAccessibleFieldDOMStructure extends boolean>
|
|
|
139
111
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
140
112
|
areAllSectionsEmpty: boolean;
|
|
141
113
|
focused: boolean;
|
|
142
|
-
}
|
|
143
|
-
export type UseFieldReturnValue<
|
|
114
|
+
}
|
|
115
|
+
export type UseFieldReturnValue<TProps extends {}> = Required<Pick<UseFieldInternalProps<any, any>, 'disabled' | 'readOnly' | 'autoFocus'>> & Required<UseFieldForwardedProps> & UseFieldAdditionalProps & Omit<TProps, InternalPropNames<PickerValueType>>;
|
|
144
116
|
export type FieldSectionValueBoundaries<SectionType extends FieldSectionType> = {
|
|
145
117
|
minimum: number;
|
|
146
118
|
maximum: number;
|
|
@@ -172,21 +144,12 @@ export interface FieldValueManager<TValue extends PickerValidValue> {
|
|
|
172
144
|
*/
|
|
173
145
|
getSectionsFromValue: (value: TValue, getSectionsFromDate: (date: PickerValidDate | null) => FieldSection[]) => InferFieldSection<TValue>[];
|
|
174
146
|
/**
|
|
175
|
-
* Creates the string value to render in the input based on the current section list.
|
|
147
|
+
* Creates the string value to render in the hidden input based on the current section list.
|
|
176
148
|
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
177
149
|
* @param {InferFieldSection<TValue>[]} sections The current section list.
|
|
178
|
-
* @param {string} localizedDigits The conversion table from localized to 0-9 digits.
|
|
179
|
-
* @param {boolean} isRtl `true` if the current orientation is "right to left"
|
|
180
150
|
* @returns {string} The string value to render in the input.
|
|
181
151
|
*/
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Creates the string value to render in the input based on the current section list.
|
|
185
|
-
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
186
|
-
* @param {InferFieldSection<TValue>[]} sections The current section list.
|
|
187
|
-
* @returns {string} The string value to render in the input.
|
|
188
|
-
*/
|
|
189
|
-
getV7HiddenInputValueFromSections: (sections: InferFieldSection<TValue>[]) => string;
|
|
152
|
+
getHiddenInputValueFromSections: (sections: InferFieldSection<TValue>[]) => string;
|
|
190
153
|
/**
|
|
191
154
|
* Parses a string version (most of the time coming from the input).
|
|
192
155
|
* This method should only be used when the change does not come from a single section.
|
|
@@ -316,9 +279,7 @@ export interface CharacterEditingQuery {
|
|
|
316
279
|
sectionIndex: number;
|
|
317
280
|
sectionType: FieldSectionType;
|
|
318
281
|
}
|
|
319
|
-
export type UseFieldProps
|
|
320
|
-
enableAccessibleFieldDOMStructure?: boolean;
|
|
321
|
-
};
|
|
282
|
+
export type UseFieldProps = UseFieldForwardedProps;
|
|
322
283
|
export interface UseFieldDOMGetters {
|
|
323
284
|
isReady: () => boolean;
|
|
324
285
|
getRoot: () => HTMLElement;
|
|
@@ -3,12 +3,12 @@ import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapte
|
|
|
3
3
|
import { InternalPropNames } from "../../../hooks/useSplitFieldProps.js";
|
|
4
4
|
import type { PickersSectionElement, PickersSectionListRef } from "../../../PickersSectionList/index.js";
|
|
5
5
|
import { FormProps, InferNonNullablePickerValue, PickerRangeValue, PickerValidValue } from "../../models/index.js";
|
|
6
|
-
export interface UseFieldParameters<TValue extends PickerValidValue,
|
|
7
|
-
manager: PickerManager<TValue,
|
|
6
|
+
export interface UseFieldParameters<TValue extends PickerValidValue, TError, TValidationProps extends {}, TProps extends UseFieldProps> {
|
|
7
|
+
manager: PickerManager<TValue, TError, TValidationProps, any>;
|
|
8
8
|
props: TProps;
|
|
9
9
|
skipContextFieldRefAssignment?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export interface UseFieldInternalProps<TValue extends PickerValidValue,
|
|
11
|
+
export interface UseFieldInternalProps<TValue extends PickerValidValue, TError> extends TimezoneProps, FormProps, OnErrorProps<TValue, TError> {
|
|
12
12
|
/**
|
|
13
13
|
* The selected value.
|
|
14
14
|
* Used when the component is controlled.
|
|
@@ -76,10 +76,6 @@ export interface UseFieldInternalProps<TValue extends PickerValidValue, TEnableA
|
|
|
76
76
|
* The ref object used to imperatively interact with the field.
|
|
77
77
|
*/
|
|
78
78
|
fieldRef?: React.Ref<FieldRef<TValue>>;
|
|
79
|
-
/**
|
|
80
|
-
* @default true
|
|
81
|
-
*/
|
|
82
|
-
enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
|
|
83
79
|
/**
|
|
84
80
|
* If `true`, the `input` element is focused during the first mount.
|
|
85
81
|
* @default false
|
|
@@ -90,18 +86,7 @@ export interface UseFieldInternalProps<TValue extends PickerValidValue, TEnableA
|
|
|
90
86
|
*/
|
|
91
87
|
focused?: boolean;
|
|
92
88
|
}
|
|
93
|
-
export
|
|
94
|
-
clearable?: boolean;
|
|
95
|
-
error?: boolean;
|
|
96
|
-
placeholder?: string;
|
|
97
|
-
inputRef?: React.Ref<HTMLInputElement>;
|
|
98
|
-
onClick?: React.MouseEventHandler;
|
|
99
|
-
onFocus?: React.FocusEventHandler;
|
|
100
|
-
onKeyDown?: React.KeyboardEventHandler;
|
|
101
|
-
onBlur?: React.FocusEventHandler;
|
|
102
|
-
onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
|
|
103
|
-
onClear?: React.MouseEventHandler;
|
|
104
|
-
} : {
|
|
89
|
+
export interface UseFieldForwardedProps {
|
|
105
90
|
clearable?: boolean;
|
|
106
91
|
error?: boolean;
|
|
107
92
|
focused?: boolean;
|
|
@@ -113,25 +98,12 @@ export type UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure extends bo
|
|
|
113
98
|
onInput?: React.FormEventHandler<HTMLDivElement>;
|
|
114
99
|
onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
|
|
115
100
|
onClear?: React.MouseEventHandler;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* The aria label to set on the button that opens the Picker.
|
|
120
|
-
*/
|
|
121
|
-
openPickerAriaLabel: string;
|
|
122
|
-
enableAccessibleFieldDOMStructure: false;
|
|
123
|
-
focused: boolean | undefined;
|
|
124
|
-
inputMode: 'text' | 'numeric';
|
|
125
|
-
placeholder: string;
|
|
126
|
-
value: string;
|
|
127
|
-
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
128
|
-
autoComplete: 'off';
|
|
129
|
-
} : {
|
|
101
|
+
}
|
|
102
|
+
interface UseFieldAdditionalProps {
|
|
130
103
|
/**
|
|
131
104
|
* The aria label to set on the button that opens the Picker.
|
|
132
105
|
*/
|
|
133
106
|
openPickerAriaLabel: string;
|
|
134
|
-
enableAccessibleFieldDOMStructure: true;
|
|
135
107
|
elements: PickersSectionElement[];
|
|
136
108
|
tabIndex: number | undefined;
|
|
137
109
|
contentEditable: boolean;
|
|
@@ -139,8 +111,8 @@ type UseFieldAdditionalProps<TEnableAccessibleFieldDOMStructure extends boolean>
|
|
|
139
111
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
140
112
|
areAllSectionsEmpty: boolean;
|
|
141
113
|
focused: boolean;
|
|
142
|
-
}
|
|
143
|
-
export type UseFieldReturnValue<
|
|
114
|
+
}
|
|
115
|
+
export type UseFieldReturnValue<TProps extends {}> = Required<Pick<UseFieldInternalProps<any, any>, 'disabled' | 'readOnly' | 'autoFocus'>> & Required<UseFieldForwardedProps> & UseFieldAdditionalProps & Omit<TProps, InternalPropNames<PickerValueType>>;
|
|
144
116
|
export type FieldSectionValueBoundaries<SectionType extends FieldSectionType> = {
|
|
145
117
|
minimum: number;
|
|
146
118
|
maximum: number;
|
|
@@ -172,21 +144,12 @@ export interface FieldValueManager<TValue extends PickerValidValue> {
|
|
|
172
144
|
*/
|
|
173
145
|
getSectionsFromValue: (value: TValue, getSectionsFromDate: (date: PickerValidDate | null) => FieldSection[]) => InferFieldSection<TValue>[];
|
|
174
146
|
/**
|
|
175
|
-
* Creates the string value to render in the input based on the current section list.
|
|
147
|
+
* Creates the string value to render in the hidden input based on the current section list.
|
|
176
148
|
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
177
149
|
* @param {InferFieldSection<TValue>[]} sections The current section list.
|
|
178
|
-
* @param {string} localizedDigits The conversion table from localized to 0-9 digits.
|
|
179
|
-
* @param {boolean} isRtl `true` if the current orientation is "right to left"
|
|
180
150
|
* @returns {string} The string value to render in the input.
|
|
181
151
|
*/
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Creates the string value to render in the input based on the current section list.
|
|
185
|
-
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
186
|
-
* @param {InferFieldSection<TValue>[]} sections The current section list.
|
|
187
|
-
* @returns {string} The string value to render in the input.
|
|
188
|
-
*/
|
|
189
|
-
getV7HiddenInputValueFromSections: (sections: InferFieldSection<TValue>[]) => string;
|
|
152
|
+
getHiddenInputValueFromSections: (sections: InferFieldSection<TValue>[]) => string;
|
|
190
153
|
/**
|
|
191
154
|
* Parses a string version (most of the time coming from the input).
|
|
192
155
|
* This method should only be used when the change does not come from a single section.
|
|
@@ -316,9 +279,7 @@ export interface CharacterEditingQuery {
|
|
|
316
279
|
sectionIndex: number;
|
|
317
280
|
sectionType: FieldSectionType;
|
|
318
281
|
}
|
|
319
|
-
export type UseFieldProps
|
|
320
|
-
enableAccessibleFieldDOMStructure?: boolean;
|
|
321
|
-
};
|
|
282
|
+
export type UseFieldProps = UseFieldForwardedProps;
|
|
322
283
|
export interface UseFieldDOMGetters {
|
|
323
284
|
isReady: () => boolean;
|
|
324
285
|
getRoot: () => HTMLElement;
|
|
@@ -26,11 +26,10 @@ export declare const doesSectionFormatHaveLeadingZeros: (adapter: MuiPickersAdap
|
|
|
26
26
|
* To make sure that the parsing works, we are building a format and a date without any separator.
|
|
27
27
|
*/
|
|
28
28
|
export declare const getDateFromDateSections: (adapter: MuiPickersAdapter, sections: FieldSection[], localizedDigits: string[]) => PickerValidDate;
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const createDateStrForV6InputFromSections: (sections: FieldSection[], localizedDigits: string[], isRtl: boolean) => string;
|
|
29
|
+
export declare const createDateStrForHiddenInputFromSections: (sections: FieldSection[]) => string;
|
|
31
30
|
export declare const getSectionsBoundaries: (adapter: MuiPickersAdapter, localizedDigits: string[], timezone: PickersTimezone) => FieldSectionsValueBoundaries;
|
|
32
31
|
export declare const validateSections: <TValue extends PickerValidValue>(sections: InferFieldSection<TValue>[], valueType: PickerValueType) => void;
|
|
33
32
|
export declare const mergeDateIntoReferenceDate: (adapter: MuiPickersAdapter, dateToTransferFrom: PickerValidDate, sections: FieldSection[], referenceDate: PickerValidDate, shouldLimitToEditedSections: boolean) => PickerValidDate;
|
|
34
33
|
export declare const isAndroid: () => boolean;
|
|
35
|
-
export declare const getSectionOrder: (sections: FieldSection[]
|
|
34
|
+
export declare const getSectionOrder: (sections: FieldSection[]) => SectionOrdering;
|
|
36
35
|
export declare const parseSelectedSections: (selectedSections: FieldSelectedSections, sections: FieldSection[]) => FieldParsedSelectedSections;
|
|
@@ -26,11 +26,10 @@ export declare const doesSectionFormatHaveLeadingZeros: (adapter: MuiPickersAdap
|
|
|
26
26
|
* To make sure that the parsing works, we are building a format and a date without any separator.
|
|
27
27
|
*/
|
|
28
28
|
export declare const getDateFromDateSections: (adapter: MuiPickersAdapter, sections: FieldSection[], localizedDigits: string[]) => PickerValidDate;
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const createDateStrForV6InputFromSections: (sections: FieldSection[], localizedDigits: string[], isRtl: boolean) => string;
|
|
29
|
+
export declare const createDateStrForHiddenInputFromSections: (sections: FieldSection[]) => string;
|
|
31
30
|
export declare const getSectionsBoundaries: (adapter: MuiPickersAdapter, localizedDigits: string[], timezone: PickersTimezone) => FieldSectionsValueBoundaries;
|
|
32
31
|
export declare const validateSections: <TValue extends PickerValidValue>(sections: InferFieldSection<TValue>[], valueType: PickerValueType) => void;
|
|
33
32
|
export declare const mergeDateIntoReferenceDate: (adapter: MuiPickersAdapter, dateToTransferFrom: PickerValidDate, sections: FieldSection[], referenceDate: PickerValidDate, shouldLimitToEditedSections: boolean) => PickerValidDate;
|
|
34
33
|
export declare const isAndroid: () => boolean;
|
|
35
|
-
export declare const getSectionOrder: (sections: FieldSection[]
|
|
34
|
+
export declare const getSectionOrder: (sections: FieldSection[]) => SectionOrdering;
|
|
36
35
|
export declare const parseSelectedSections: (selectedSections: FieldSelectedSections, sections: FieldSection[]) => FieldParsedSelectedSections;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.validateSections = exports.removeLocalizedDigits = exports.parseSelectedSections = exports.mergeDateIntoReferenceDate = exports.isStringNumber = exports.isAndroid = exports.getSectionsBoundaries = exports.getSectionVisibleValue = exports.getSectionOrder = exports.getLocalizedDigits = exports.getLetterEditingOptions = exports.getDaysInWeekStr = exports.getDateSectionConfigFromFormatToken = exports.getDateFromDateSections = exports.doesSectionFormatHaveLeadingZeros = exports.
|
|
7
|
+
exports.validateSections = exports.removeLocalizedDigits = exports.parseSelectedSections = exports.mergeDateIntoReferenceDate = exports.isStringNumber = exports.isAndroid = exports.getSectionsBoundaries = exports.getSectionVisibleValue = exports.getSectionOrder = exports.getLocalizedDigits = exports.getLetterEditingOptions = exports.getDaysInWeekStr = exports.getDateSectionConfigFromFormatToken = exports.getDateFromDateSections = exports.doesSectionFormatHaveLeadingZeros = exports.createDateStrForHiddenInputFromSections = exports.cleanLeadingZeros = exports.cleanDigitSectionValue = exports.changeSectionValueFormat = exports.applyLocalizedDigits = exports.FORMAT_SECONDS_NO_LEADING_ZEROS = void 0;
|
|
8
8
|
var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
|
|
9
9
|
var _dateUtils = require("../../utils/date-utils");
|
|
10
10
|
const getDateSectionConfigFromFormatToken = (adapter, formatToken) => {
|
|
@@ -242,28 +242,10 @@ const getDateFromDateSections = (adapter, sections, localizedDigits) => {
|
|
|
242
242
|
return adapter.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
|
|
243
243
|
};
|
|
244
244
|
exports.getDateFromDateSections = getDateFromDateSections;
|
|
245
|
-
const
|
|
245
|
+
const createDateStrForHiddenInputFromSections = sections => sections.map(section => {
|
|
246
246
|
return `${section.startSeparator}${section.value || section.placeholder}${section.endSeparator}`;
|
|
247
247
|
}).join('');
|
|
248
|
-
exports.
|
|
249
|
-
const createDateStrForV6InputFromSections = (sections, localizedDigits, isRtl) => {
|
|
250
|
-
const formattedSections = sections.map(section => {
|
|
251
|
-
const dateValue = getSectionVisibleValue(section, isRtl ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
252
|
-
return `${section.startSeparator}${dateValue}${section.endSeparator}`;
|
|
253
|
-
});
|
|
254
|
-
const dateStr = formattedSections.join('');
|
|
255
|
-
if (!isRtl) {
|
|
256
|
-
return dateStr;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// \u2066: start left-to-right isolation
|
|
260
|
-
// \u2067: start right-to-left isolation
|
|
261
|
-
// \u2068: start first strong character isolation
|
|
262
|
-
// \u2069: pop isolation
|
|
263
|
-
// wrap into an isolated group such that separators can split the string in smaller ones by adding \u2069\u2068
|
|
264
|
-
return `\u2066${dateStr}\u2069`;
|
|
265
|
-
};
|
|
266
|
-
exports.createDateStrForV6InputFromSections = createDateStrForV6InputFromSections;
|
|
248
|
+
exports.createDateStrForHiddenInputFromSections = createDateStrForHiddenInputFromSections;
|
|
267
249
|
const getSectionsBoundaries = (adapter, localizedDigits, timezone) => {
|
|
268
250
|
const today = adapter.date(undefined, timezone);
|
|
269
251
|
const endOfYear = adapter.endOfYear(today);
|
|
@@ -453,51 +435,12 @@ const mergeDateIntoReferenceDate = (adapter, dateToTransferFrom, sections, refer
|
|
|
453
435
|
}, referenceDate);
|
|
454
436
|
exports.mergeDateIntoReferenceDate = mergeDateIntoReferenceDate;
|
|
455
437
|
const isAndroid = () => navigator.userAgent.toLowerCase().includes('android');
|
|
456
|
-
|
|
457
|
-
// TODO v9: Remove
|
|
458
438
|
exports.isAndroid = isAndroid;
|
|
459
|
-
const getSectionOrder =
|
|
439
|
+
const getSectionOrder = sections => {
|
|
460
440
|
const neighbors = {};
|
|
461
|
-
if (!shouldApplyRTL) {
|
|
462
|
-
sections.forEach((_, index) => {
|
|
463
|
-
const leftIndex = index === 0 ? null : index - 1;
|
|
464
|
-
const rightIndex = index === sections.length - 1 ? null : index + 1;
|
|
465
|
-
neighbors[index] = {
|
|
466
|
-
leftIndex,
|
|
467
|
-
rightIndex
|
|
468
|
-
};
|
|
469
|
-
});
|
|
470
|
-
return {
|
|
471
|
-
neighbors,
|
|
472
|
-
startIndex: 0,
|
|
473
|
-
endIndex: sections.length - 1
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
const rtl2ltr = {};
|
|
477
|
-
const ltr2rtl = {};
|
|
478
|
-
let groupedSectionsStart = 0;
|
|
479
|
-
let groupedSectionsEnd = 0;
|
|
480
|
-
let RTLIndex = sections.length - 1;
|
|
481
|
-
while (RTLIndex >= 0) {
|
|
482
|
-
groupedSectionsEnd = sections.findIndex(
|
|
483
|
-
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
|
484
|
-
(section, index) => index >= groupedSectionsStart && section.endSeparator?.includes(' ') &&
|
|
485
|
-
// Special case where the spaces were not there in the initial input
|
|
486
|
-
section.endSeparator !== ' / ');
|
|
487
|
-
if (groupedSectionsEnd === -1) {
|
|
488
|
-
groupedSectionsEnd = sections.length - 1;
|
|
489
|
-
}
|
|
490
|
-
for (let i = groupedSectionsEnd; i >= groupedSectionsStart; i -= 1) {
|
|
491
|
-
ltr2rtl[i] = RTLIndex;
|
|
492
|
-
rtl2ltr[RTLIndex] = i;
|
|
493
|
-
RTLIndex -= 1;
|
|
494
|
-
}
|
|
495
|
-
groupedSectionsStart = groupedSectionsEnd + 1;
|
|
496
|
-
}
|
|
497
441
|
sections.forEach((_, index) => {
|
|
498
|
-
const
|
|
499
|
-
const
|
|
500
|
-
const rightIndex = rtlIndex === sections.length - 1 ? null : rtl2ltr[rtlIndex + 1];
|
|
442
|
+
const leftIndex = index === 0 ? null : index - 1;
|
|
443
|
+
const rightIndex = index === sections.length - 1 ? null : index + 1;
|
|
501
444
|
neighbors[index] = {
|
|
502
445
|
leftIndex,
|
|
503
446
|
rightIndex
|
|
@@ -505,8 +448,8 @@ const getSectionOrder = (sections, shouldApplyRTL) => {
|
|
|
505
448
|
});
|
|
506
449
|
return {
|
|
507
450
|
neighbors,
|
|
508
|
-
startIndex:
|
|
509
|
-
endIndex:
|
|
451
|
+
startIndex: 0,
|
|
452
|
+
endIndex: sections.length - 1
|
|
510
453
|
};
|
|
511
454
|
};
|
|
512
455
|
exports.getSectionOrder = getSectionOrder;
|
|
@@ -222,26 +222,9 @@ export const getDateFromDateSections = (adapter, sections, localizedDigits) => {
|
|
|
222
222
|
const dateWithoutSeparatorStr = sectionValues.join(' ');
|
|
223
223
|
return adapter.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
|
|
224
224
|
};
|
|
225
|
-
export const
|
|
225
|
+
export const createDateStrForHiddenInputFromSections = sections => sections.map(section => {
|
|
226
226
|
return `${section.startSeparator}${section.value || section.placeholder}${section.endSeparator}`;
|
|
227
227
|
}).join('');
|
|
228
|
-
export const createDateStrForV6InputFromSections = (sections, localizedDigits, isRtl) => {
|
|
229
|
-
const formattedSections = sections.map(section => {
|
|
230
|
-
const dateValue = getSectionVisibleValue(section, isRtl ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
231
|
-
return `${section.startSeparator}${dateValue}${section.endSeparator}`;
|
|
232
|
-
});
|
|
233
|
-
const dateStr = formattedSections.join('');
|
|
234
|
-
if (!isRtl) {
|
|
235
|
-
return dateStr;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// \u2066: start left-to-right isolation
|
|
239
|
-
// \u2067: start right-to-left isolation
|
|
240
|
-
// \u2068: start first strong character isolation
|
|
241
|
-
// \u2069: pop isolation
|
|
242
|
-
// wrap into an isolated group such that separators can split the string in smaller ones by adding \u2069\u2068
|
|
243
|
-
return `\u2066${dateStr}\u2069`;
|
|
244
|
-
};
|
|
245
228
|
export const getSectionsBoundaries = (adapter, localizedDigits, timezone) => {
|
|
246
229
|
const today = adapter.date(undefined, timezone);
|
|
247
230
|
const endOfYear = adapter.endOfYear(today);
|
|
@@ -428,50 +411,11 @@ export const mergeDateIntoReferenceDate = (adapter, dateToTransferFrom, sections
|
|
|
428
411
|
return mergedDate;
|
|
429
412
|
}, referenceDate);
|
|
430
413
|
export const isAndroid = () => navigator.userAgent.toLowerCase().includes('android');
|
|
431
|
-
|
|
432
|
-
// TODO v9: Remove
|
|
433
|
-
export const getSectionOrder = (sections, shouldApplyRTL) => {
|
|
414
|
+
export const getSectionOrder = sections => {
|
|
434
415
|
const neighbors = {};
|
|
435
|
-
if (!shouldApplyRTL) {
|
|
436
|
-
sections.forEach((_, index) => {
|
|
437
|
-
const leftIndex = index === 0 ? null : index - 1;
|
|
438
|
-
const rightIndex = index === sections.length - 1 ? null : index + 1;
|
|
439
|
-
neighbors[index] = {
|
|
440
|
-
leftIndex,
|
|
441
|
-
rightIndex
|
|
442
|
-
};
|
|
443
|
-
});
|
|
444
|
-
return {
|
|
445
|
-
neighbors,
|
|
446
|
-
startIndex: 0,
|
|
447
|
-
endIndex: sections.length - 1
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
const rtl2ltr = {};
|
|
451
|
-
const ltr2rtl = {};
|
|
452
|
-
let groupedSectionsStart = 0;
|
|
453
|
-
let groupedSectionsEnd = 0;
|
|
454
|
-
let RTLIndex = sections.length - 1;
|
|
455
|
-
while (RTLIndex >= 0) {
|
|
456
|
-
groupedSectionsEnd = sections.findIndex(
|
|
457
|
-
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
|
458
|
-
(section, index) => index >= groupedSectionsStart && section.endSeparator?.includes(' ') &&
|
|
459
|
-
// Special case where the spaces were not there in the initial input
|
|
460
|
-
section.endSeparator !== ' / ');
|
|
461
|
-
if (groupedSectionsEnd === -1) {
|
|
462
|
-
groupedSectionsEnd = sections.length - 1;
|
|
463
|
-
}
|
|
464
|
-
for (let i = groupedSectionsEnd; i >= groupedSectionsStart; i -= 1) {
|
|
465
|
-
ltr2rtl[i] = RTLIndex;
|
|
466
|
-
rtl2ltr[RTLIndex] = i;
|
|
467
|
-
RTLIndex -= 1;
|
|
468
|
-
}
|
|
469
|
-
groupedSectionsStart = groupedSectionsEnd + 1;
|
|
470
|
-
}
|
|
471
416
|
sections.forEach((_, index) => {
|
|
472
|
-
const
|
|
473
|
-
const
|
|
474
|
-
const rightIndex = rtlIndex === sections.length - 1 ? null : rtl2ltr[rtlIndex + 1];
|
|
417
|
+
const leftIndex = index === 0 ? null : index - 1;
|
|
418
|
+
const rightIndex = index === sections.length - 1 ? null : index + 1;
|
|
475
419
|
neighbors[index] = {
|
|
476
420
|
leftIndex,
|
|
477
421
|
rightIndex
|
|
@@ -479,8 +423,8 @@ export const getSectionOrder = (sections, shouldApplyRTL) => {
|
|
|
479
423
|
});
|
|
480
424
|
return {
|
|
481
425
|
neighbors,
|
|
482
|
-
startIndex:
|
|
483
|
-
endIndex:
|
|
426
|
+
startIndex: 0,
|
|
427
|
+
endIndex: sections.length - 1
|
|
484
428
|
};
|
|
485
429
|
};
|
|
486
430
|
export const parseSelectedSections = (selectedSections, sections) => {
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PickerAnyManager } from "../../models/manager.mjs";
|
|
3
3
|
import { UseFieldStateReturnValue } from "./useFieldState.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* Generate the props to pass to the hidden input element of the field.
|
|
6
|
-
* It is not used by the non-accessible DOM structure (with an <input /> element for editing).
|
|
7
|
-
* It should be used in the MUI accessible DOM structure and the Base UI implementation.
|
|
8
6
|
* @param {UseFieldHiddenInputPropsParameters} parameters The parameters of the hook.
|
|
9
7
|
* @returns {UseFieldHiddenInputPropsReturnValue} The props to forward to the hidden input element of the field.
|
|
10
8
|
*/
|
|
11
9
|
export declare function useFieldHiddenInputProps(parameters: UseFieldHiddenInputPropsParameters): UseFieldHiddenInputPropsReturnValue;
|
|
12
10
|
interface UseFieldHiddenInputPropsParameters {
|
|
13
|
-
manager:
|
|
11
|
+
manager: PickerAnyManager;
|
|
14
12
|
stateResponse: UseFieldStateReturnValue<any>;
|
|
15
13
|
}
|
|
16
14
|
interface UseFieldHiddenInputPropsReturnValue {
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PickerAnyManager } from "../../models/manager.js";
|
|
3
3
|
import { UseFieldStateReturnValue } from "./useFieldState.js";
|
|
4
4
|
/**
|
|
5
5
|
* Generate the props to pass to the hidden input element of the field.
|
|
6
|
-
* It is not used by the non-accessible DOM structure (with an <input /> element for editing).
|
|
7
|
-
* It should be used in the MUI accessible DOM structure and the Base UI implementation.
|
|
8
6
|
* @param {UseFieldHiddenInputPropsParameters} parameters The parameters of the hook.
|
|
9
7
|
* @returns {UseFieldHiddenInputPropsReturnValue} The props to forward to the hidden input element of the field.
|
|
10
8
|
*/
|
|
11
9
|
export declare function useFieldHiddenInputProps(parameters: UseFieldHiddenInputPropsParameters): UseFieldHiddenInputPropsReturnValue;
|
|
12
10
|
interface UseFieldHiddenInputPropsParameters {
|
|
13
|
-
manager:
|
|
11
|
+
manager: PickerAnyManager;
|
|
14
12
|
stateResponse: UseFieldStateReturnValue<any>;
|
|
15
13
|
}
|
|
16
14
|
interface UseFieldHiddenInputPropsReturnValue {
|
|
@@ -10,8 +10,6 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
11
11
|
/**
|
|
12
12
|
* Generate the props to pass to the hidden input element of the field.
|
|
13
|
-
* It is not used by the non-accessible DOM structure (with an <input /> element for editing).
|
|
14
|
-
* It should be used in the MUI accessible DOM structure and the Base UI implementation.
|
|
15
13
|
* @param {UseFieldHiddenInputPropsParameters} parameters The parameters of the hook.
|
|
16
14
|
* @returns {UseFieldHiddenInputPropsReturnValue} The props to forward to the hidden input element of the field.
|
|
17
15
|
*/
|
|
@@ -31,7 +29,7 @@ function useFieldHiddenInputProps(parameters) {
|
|
|
31
29
|
const handleChange = (0, _useEventCallback.default)(event => {
|
|
32
30
|
updateValueFromValueStr(event.target.value);
|
|
33
31
|
});
|
|
34
|
-
const valueStr = React.useMemo(() => areAllSectionsEmpty ? '' : fieldValueManager.
|
|
32
|
+
const valueStr = React.useMemo(() => areAllSectionsEmpty ? '' : fieldValueManager.getHiddenInputValueFromSections(state.sections), [areAllSectionsEmpty, state.sections, fieldValueManager]);
|
|
35
33
|
return {
|
|
36
34
|
value: valueStr,
|
|
37
35
|
onChange: handleChange
|
|
@@ -2,8 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
3
|
/**
|
|
4
4
|
* Generate the props to pass to the hidden input element of the field.
|
|
5
|
-
* It is not used by the non-accessible DOM structure (with an <input /> element for editing).
|
|
6
|
-
* It should be used in the MUI accessible DOM structure and the Base UI implementation.
|
|
7
5
|
* @param {UseFieldHiddenInputPropsParameters} parameters The parameters of the hook.
|
|
8
6
|
* @returns {UseFieldHiddenInputPropsReturnValue} The props to forward to the hidden input element of the field.
|
|
9
7
|
*/
|
|
@@ -23,7 +21,7 @@ export function useFieldHiddenInputProps(parameters) {
|
|
|
23
21
|
const handleChange = useEventCallback(event => {
|
|
24
22
|
updateValueFromValueStr(event.target.value);
|
|
25
23
|
});
|
|
26
|
-
const valueStr = React.useMemo(() => areAllSectionsEmpty ? '' : fieldValueManager.
|
|
24
|
+
const valueStr = React.useMemo(() => areAllSectionsEmpty ? '' : fieldValueManager.getHiddenInputValueFromSections(state.sections), [areAllSectionsEmpty, state.sections, fieldValueManager]);
|
|
27
25
|
return {
|
|
28
26
|
value: valueStr,
|
|
29
27
|
onChange: handleChange
|
|
@@ -48,7 +48,6 @@ function useFieldInternalPropsWithDefaults(parameters) {
|
|
|
48
48
|
focused: pickerContext.open ? true : undefined,
|
|
49
49
|
format: pickerContext.fieldFormat,
|
|
50
50
|
formatDensity: fieldPrivateContext.formatDensity,
|
|
51
|
-
enableAccessibleFieldDOMStructure: fieldPrivateContext.enableAccessibleFieldDOMStructure,
|
|
52
51
|
selectedSections: fieldPrivateContext.selectedSections,
|
|
53
52
|
onSelectedSectionsChange: fieldPrivateContext.onSelectedSectionsChange,
|
|
54
53
|
fieldRef: handleFieldRef
|
|
@@ -41,7 +41,6 @@ export function useFieldInternalPropsWithDefaults(parameters) {
|
|
|
41
41
|
focused: pickerContext.open ? true : undefined,
|
|
42
42
|
format: pickerContext.fieldFormat,
|
|
43
43
|
formatDensity: fieldPrivateContext.formatDensity,
|
|
44
|
-
enableAccessibleFieldDOMStructure: fieldPrivateContext.enableAccessibleFieldDOMStructure,
|
|
45
44
|
selectedSections: fieldPrivateContext.selectedSections,
|
|
46
45
|
onSelectedSectionsChange: fieldPrivateContext.onSelectedSectionsChange,
|
|
47
46
|
fieldRef: handleFieldRef
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { PickerManager } from "../../../models/index.mjs";
|
|
2
1
|
import { UseFieldDOMGetters, UseFieldInternalProps } from "./useField.types.mjs";
|
|
3
2
|
import { UseFieldStateReturnValue } from "./useFieldState.mjs";
|
|
4
3
|
import { UseFieldCharacterEditingReturnValue } from "./useFieldCharacterEditing.mjs";
|
|
4
|
+
import { PickerAnyManager } from "../../models/index.mjs";
|
|
5
5
|
/**
|
|
6
6
|
* Generate the props to pass to the root element of the field.
|
|
7
|
-
* It is not used by the non-accessible DOM structure (with an <input /> element for editing).
|
|
8
|
-
* It should be used in the MUI accessible DOM structure and the Base UI implementation.
|
|
9
7
|
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
10
8
|
* @returns {UseFieldRootPropsReturnValue} The props to forward to the root element of the field.
|
|
11
9
|
*/
|
|
12
10
|
export declare function useFieldRootProps(parameters: UseFieldRootPropsParameters): UseFieldRootPropsReturnValue;
|
|
13
11
|
interface UseFieldRootPropsParameters {
|
|
14
|
-
manager:
|
|
12
|
+
manager: PickerAnyManager;
|
|
15
13
|
stateResponse: UseFieldStateReturnValue<any>;
|
|
16
14
|
applyCharacterEditing: UseFieldCharacterEditingReturnValue;
|
|
17
|
-
internalPropsWithDefaults: UseFieldInternalProps<any, any
|
|
15
|
+
internalPropsWithDefaults: UseFieldInternalProps<any, any> & {
|
|
16
|
+
minutesStep?: number;
|
|
17
|
+
};
|
|
18
18
|
domGetters: UseFieldDOMGetters;
|
|
19
19
|
focused: boolean;
|
|
20
20
|
setFocused: (focused: boolean) => void;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { PickerManager } from "../../../models/index.js";
|
|
2
1
|
import { UseFieldDOMGetters, UseFieldInternalProps } from "./useField.types.js";
|
|
3
2
|
import { UseFieldStateReturnValue } from "./useFieldState.js";
|
|
4
3
|
import { UseFieldCharacterEditingReturnValue } from "./useFieldCharacterEditing.js";
|
|
4
|
+
import { PickerAnyManager } from "../../models/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Generate the props to pass to the root element of the field.
|
|
7
|
-
* It is not used by the non-accessible DOM structure (with an <input /> element for editing).
|
|
8
|
-
* It should be used in the MUI accessible DOM structure and the Base UI implementation.
|
|
9
7
|
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
10
8
|
* @returns {UseFieldRootPropsReturnValue} The props to forward to the root element of the field.
|
|
11
9
|
*/
|
|
12
10
|
export declare function useFieldRootProps(parameters: UseFieldRootPropsParameters): UseFieldRootPropsReturnValue;
|
|
13
11
|
interface UseFieldRootPropsParameters {
|
|
14
|
-
manager:
|
|
12
|
+
manager: PickerAnyManager;
|
|
15
13
|
stateResponse: UseFieldStateReturnValue<any>;
|
|
16
14
|
applyCharacterEditing: UseFieldCharacterEditingReturnValue;
|
|
17
|
-
internalPropsWithDefaults: UseFieldInternalProps<any, any
|
|
15
|
+
internalPropsWithDefaults: UseFieldInternalProps<any, any> & {
|
|
16
|
+
minutesStep?: number;
|
|
17
|
+
};
|
|
18
18
|
domGetters: UseFieldDOMGetters;
|
|
19
19
|
focused: boolean;
|
|
20
20
|
setFocused: (focused: boolean) => void;
|