@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
|
@@ -7,19 +7,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useFieldRootProps = useFieldRootProps;
|
|
8
8
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
9
9
|
var _useTimeout = _interopRequireDefault(require("@mui/utils/useTimeout"));
|
|
10
|
-
var _useFieldRootHandleKeyDown = require("./useFieldRootHandleKeyDown");
|
|
11
10
|
var _utils = require("../../utils/utils");
|
|
12
11
|
var _syncSelectionToDOM = require("./syncSelectionToDOM");
|
|
12
|
+
var _usePickerAdapter = require("../../../hooks/usePickerAdapter");
|
|
13
|
+
var _useField = require("./useField.utils");
|
|
13
14
|
/**
|
|
14
15
|
* Generate the props to pass to the root element of the field.
|
|
15
|
-
* It is not used by the non-accessible DOM structure (with an <input /> element for editing).
|
|
16
|
-
* It should be used in the MUI accessible DOM structure and the Base UI implementation.
|
|
17
16
|
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
18
17
|
* @returns {UseFieldRootPropsReturnValue} The props to forward to the root element of the field.
|
|
19
18
|
*/
|
|
20
19
|
function useFieldRootProps(parameters) {
|
|
21
20
|
const {
|
|
22
|
-
manager
|
|
21
|
+
manager: {
|
|
22
|
+
internal_fieldValueManager: fieldValueManager
|
|
23
|
+
},
|
|
23
24
|
focused,
|
|
24
25
|
setFocused,
|
|
25
26
|
domGetters,
|
|
@@ -29,25 +30,118 @@ function useFieldRootProps(parameters) {
|
|
|
29
30
|
stateResponse: {
|
|
30
31
|
// States and derived states
|
|
31
32
|
parsedSelectedSections,
|
|
33
|
+
sectionsValueBoundaries,
|
|
32
34
|
sectionOrder,
|
|
33
35
|
state,
|
|
36
|
+
value,
|
|
37
|
+
activeSectionIndex,
|
|
38
|
+
localizedDigits,
|
|
39
|
+
timezone,
|
|
34
40
|
// Methods to update the states
|
|
35
41
|
clearValue,
|
|
42
|
+
clearActiveSection,
|
|
36
43
|
setCharacterQuery,
|
|
37
44
|
setSelectedSections,
|
|
38
|
-
updateValueFromValueStr
|
|
45
|
+
updateValueFromValueStr,
|
|
46
|
+
updateSectionValue
|
|
39
47
|
},
|
|
40
48
|
internalPropsWithDefaults: {
|
|
41
49
|
disabled = false,
|
|
42
|
-
readOnly = false
|
|
50
|
+
readOnly = false,
|
|
51
|
+
minutesStep
|
|
43
52
|
}
|
|
44
53
|
} = parameters;
|
|
54
|
+
const adapter = (0, _usePickerAdapter.usePickerAdapter)();
|
|
55
|
+
const handleKeyDown = (0, _useEventCallback.default)(event => {
|
|
56
|
+
if (disabled) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
45
59
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
// eslint-disable-next-line default-case
|
|
61
|
+
switch (true) {
|
|
62
|
+
// Select all
|
|
63
|
+
case (event.ctrlKey || event.metaKey) && String.fromCharCode(event.keyCode) === 'A' && !event.shiftKey && !event.altKey:
|
|
64
|
+
{
|
|
65
|
+
// prevent default to make sure that the next line "select all" while updating
|
|
66
|
+
// the internal state at the same time.
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
setSelectedSections('all');
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Move selection to next section
|
|
73
|
+
case event.key === 'ArrowRight':
|
|
74
|
+
{
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
if (parsedSelectedSections == null) {
|
|
77
|
+
setSelectedSections(sectionOrder.startIndex);
|
|
78
|
+
} else if (parsedSelectedSections === 'all') {
|
|
79
|
+
setSelectedSections(sectionOrder.endIndex);
|
|
80
|
+
} else {
|
|
81
|
+
const nextSectionIndex = sectionOrder.neighbors[parsedSelectedSections].rightIndex;
|
|
82
|
+
if (nextSectionIndex !== null) {
|
|
83
|
+
setSelectedSections(nextSectionIndex);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Move selection to previous section
|
|
90
|
+
case event.key === 'ArrowLeft':
|
|
91
|
+
{
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
if (parsedSelectedSections == null) {
|
|
94
|
+
setSelectedSections(sectionOrder.endIndex);
|
|
95
|
+
} else if (parsedSelectedSections === 'all') {
|
|
96
|
+
setSelectedSections(sectionOrder.startIndex);
|
|
97
|
+
} else {
|
|
98
|
+
const nextSectionIndex = sectionOrder.neighbors[parsedSelectedSections].leftIndex;
|
|
99
|
+
if (nextSectionIndex !== null) {
|
|
100
|
+
setSelectedSections(nextSectionIndex);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Reset the value of the selected section
|
|
107
|
+
case event.key === 'Delete':
|
|
108
|
+
{
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
if (readOnly) {
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
if (parsedSelectedSections == null || parsedSelectedSections === 'all') {
|
|
114
|
+
clearValue();
|
|
115
|
+
} else {
|
|
116
|
+
clearActiveSection();
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Increment / decrement the selected section value
|
|
122
|
+
case ['ArrowUp', 'ArrowDown', 'Home', 'End', 'PageUp', 'PageDown'].includes(event.key):
|
|
123
|
+
{
|
|
124
|
+
event.preventDefault();
|
|
125
|
+
if (readOnly || activeSectionIndex == null) {
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// if all sections are selected, mark the currently editing one as selected
|
|
130
|
+
if (parsedSelectedSections === 'all') {
|
|
131
|
+
setSelectedSections(activeSectionIndex);
|
|
132
|
+
}
|
|
133
|
+
const activeSection = state.sections[activeSectionIndex];
|
|
134
|
+
const newSectionValue = adjustSectionValue(adapter, timezone, activeSection, event.key, sectionsValueBoundaries, localizedDigits, fieldValueManager.getDateFromSection(value, activeSection), {
|
|
135
|
+
minutesStep
|
|
136
|
+
});
|
|
137
|
+
updateSectionValue({
|
|
138
|
+
section: activeSection,
|
|
139
|
+
newSectionValue,
|
|
140
|
+
shouldGoToNextSection: false
|
|
141
|
+
});
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
51
145
|
});
|
|
52
146
|
const containerClickTimeout = (0, _useTimeout.default)();
|
|
53
147
|
const handleClick = (0, _useEventCallback.default)(event => {
|
|
@@ -154,4 +248,82 @@ function useFieldRootProps(parameters) {
|
|
|
154
248
|
contentEditable: parsedSelectedSections === 'all',
|
|
155
249
|
tabIndex: internalPropsWithDefaults.disabled || parsedSelectedSections === 0 ? -1 : 0 // TODO: Try to set to undefined when there is a section selected.
|
|
156
250
|
};
|
|
251
|
+
}
|
|
252
|
+
function getDeltaFromKeyCode(keyCode) {
|
|
253
|
+
switch (keyCode) {
|
|
254
|
+
case 'ArrowUp':
|
|
255
|
+
return 1;
|
|
256
|
+
case 'ArrowDown':
|
|
257
|
+
return -1;
|
|
258
|
+
case 'PageUp':
|
|
259
|
+
return 5;
|
|
260
|
+
case 'PageDown':
|
|
261
|
+
return -5;
|
|
262
|
+
default:
|
|
263
|
+
return 0;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function adjustSectionValue(adapter, timezone, section, keyCode, sectionsValueBoundaries, localizedDigits, activeDate, stepsAttributes) {
|
|
267
|
+
const delta = getDeltaFromKeyCode(keyCode);
|
|
268
|
+
const isStart = keyCode === 'Home';
|
|
269
|
+
const isEnd = keyCode === 'End';
|
|
270
|
+
const shouldSetAbsolute = section.value === '' || isStart || isEnd;
|
|
271
|
+
const adjustDigitSection = () => {
|
|
272
|
+
const sectionBoundaries = sectionsValueBoundaries[section.type]({
|
|
273
|
+
currentDate: activeDate,
|
|
274
|
+
format: section.format,
|
|
275
|
+
contentType: section.contentType
|
|
276
|
+
});
|
|
277
|
+
const getCleanValue = value => (0, _useField.cleanDigitSectionValue)(adapter, value, sectionBoundaries, localizedDigits, section);
|
|
278
|
+
const step = section.type === 'minutes' && stepsAttributes?.minutesStep ? stepsAttributes.minutesStep : 1;
|
|
279
|
+
let newSectionValueNumber;
|
|
280
|
+
if (shouldSetAbsolute) {
|
|
281
|
+
if (section.type === 'year' && !isEnd && !isStart) {
|
|
282
|
+
return adapter.formatByString(adapter.date(undefined, timezone), section.format);
|
|
283
|
+
}
|
|
284
|
+
if (delta > 0 || isStart) {
|
|
285
|
+
newSectionValueNumber = sectionBoundaries.minimum;
|
|
286
|
+
} else {
|
|
287
|
+
newSectionValueNumber = sectionBoundaries.maximum;
|
|
288
|
+
}
|
|
289
|
+
} else {
|
|
290
|
+
const currentSectionValue = parseInt((0, _useField.removeLocalizedDigits)(section.value, localizedDigits), 10);
|
|
291
|
+
newSectionValueNumber = currentSectionValue + delta * step;
|
|
292
|
+
}
|
|
293
|
+
if (newSectionValueNumber % step !== 0) {
|
|
294
|
+
if (delta < 0 || isStart) {
|
|
295
|
+
newSectionValueNumber += step - (step + newSectionValueNumber) % step; // for JS -3 % 5 = -3 (should be 2)
|
|
296
|
+
}
|
|
297
|
+
if (delta > 0 || isEnd) {
|
|
298
|
+
newSectionValueNumber -= newSectionValueNumber % step;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (newSectionValueNumber > sectionBoundaries.maximum) {
|
|
302
|
+
return getCleanValue(sectionBoundaries.minimum + (newSectionValueNumber - sectionBoundaries.maximum - 1) % (sectionBoundaries.maximum - sectionBoundaries.minimum + 1));
|
|
303
|
+
}
|
|
304
|
+
if (newSectionValueNumber < sectionBoundaries.minimum) {
|
|
305
|
+
return getCleanValue(sectionBoundaries.maximum - (sectionBoundaries.minimum - newSectionValueNumber - 1) % (sectionBoundaries.maximum - sectionBoundaries.minimum + 1));
|
|
306
|
+
}
|
|
307
|
+
return getCleanValue(newSectionValueNumber);
|
|
308
|
+
};
|
|
309
|
+
const adjustLetterSection = () => {
|
|
310
|
+
const options = (0, _useField.getLetterEditingOptions)(adapter, timezone, section.type, section.format);
|
|
311
|
+
if (options.length === 0) {
|
|
312
|
+
return section.value;
|
|
313
|
+
}
|
|
314
|
+
if (shouldSetAbsolute) {
|
|
315
|
+
if (delta > 0 || isStart) {
|
|
316
|
+
return options[0];
|
|
317
|
+
}
|
|
318
|
+
return options[options.length - 1];
|
|
319
|
+
}
|
|
320
|
+
const currentOptionIndex = options.indexOf(section.value);
|
|
321
|
+
const newOptionIndex = (currentOptionIndex + delta) % options.length;
|
|
322
|
+
const clampedIndex = (newOptionIndex + options.length) % options.length;
|
|
323
|
+
return options[clampedIndex];
|
|
324
|
+
};
|
|
325
|
+
if (section.contentType === 'digit' || section.contentType === 'digit-with-letter') {
|
|
326
|
+
return adjustDigitSection();
|
|
327
|
+
}
|
|
328
|
+
return adjustLetterSection();
|
|
157
329
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
2
2
|
import useTimeout from '@mui/utils/useTimeout';
|
|
3
|
-
import { useFieldRootHandleKeyDown } from "./useFieldRootHandleKeyDown.mjs";
|
|
4
3
|
import { getActiveElement } from "../../utils/utils.mjs";
|
|
5
4
|
import { syncSelectionToDOM } from "./syncSelectionToDOM.mjs";
|
|
5
|
+
import { usePickerAdapter } from "../../../hooks/usePickerAdapter.mjs";
|
|
6
|
+
import { cleanDigitSectionValue, getLetterEditingOptions, removeLocalizedDigits } from "./useField.utils.mjs";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Generate the props to pass to the root element of the field.
|
|
9
|
-
* It is not used by the non-accessible DOM structure (with an <input /> element for editing).
|
|
10
|
-
* It should be used in the MUI accessible DOM structure and the Base UI implementation.
|
|
11
10
|
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
12
11
|
* @returns {UseFieldRootPropsReturnValue} The props to forward to the root element of the field.
|
|
13
12
|
*/
|
|
14
13
|
export function useFieldRootProps(parameters) {
|
|
15
14
|
const {
|
|
16
|
-
manager
|
|
15
|
+
manager: {
|
|
16
|
+
internal_fieldValueManager: fieldValueManager
|
|
17
|
+
},
|
|
17
18
|
focused,
|
|
18
19
|
setFocused,
|
|
19
20
|
domGetters,
|
|
@@ -23,25 +24,118 @@ export function useFieldRootProps(parameters) {
|
|
|
23
24
|
stateResponse: {
|
|
24
25
|
// States and derived states
|
|
25
26
|
parsedSelectedSections,
|
|
27
|
+
sectionsValueBoundaries,
|
|
26
28
|
sectionOrder,
|
|
27
29
|
state,
|
|
30
|
+
value,
|
|
31
|
+
activeSectionIndex,
|
|
32
|
+
localizedDigits,
|
|
33
|
+
timezone,
|
|
28
34
|
// Methods to update the states
|
|
29
35
|
clearValue,
|
|
36
|
+
clearActiveSection,
|
|
30
37
|
setCharacterQuery,
|
|
31
38
|
setSelectedSections,
|
|
32
|
-
updateValueFromValueStr
|
|
39
|
+
updateValueFromValueStr,
|
|
40
|
+
updateSectionValue
|
|
33
41
|
},
|
|
34
42
|
internalPropsWithDefaults: {
|
|
35
43
|
disabled = false,
|
|
36
|
-
readOnly = false
|
|
44
|
+
readOnly = false,
|
|
45
|
+
minutesStep
|
|
37
46
|
}
|
|
38
47
|
} = parameters;
|
|
48
|
+
const adapter = usePickerAdapter();
|
|
49
|
+
const handleKeyDown = useEventCallback(event => {
|
|
50
|
+
if (disabled) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
39
53
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
// eslint-disable-next-line default-case
|
|
55
|
+
switch (true) {
|
|
56
|
+
// Select all
|
|
57
|
+
case (event.ctrlKey || event.metaKey) && String.fromCharCode(event.keyCode) === 'A' && !event.shiftKey && !event.altKey:
|
|
58
|
+
{
|
|
59
|
+
// prevent default to make sure that the next line "select all" while updating
|
|
60
|
+
// the internal state at the same time.
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
setSelectedSections('all');
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Move selection to next section
|
|
67
|
+
case event.key === 'ArrowRight':
|
|
68
|
+
{
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
if (parsedSelectedSections == null) {
|
|
71
|
+
setSelectedSections(sectionOrder.startIndex);
|
|
72
|
+
} else if (parsedSelectedSections === 'all') {
|
|
73
|
+
setSelectedSections(sectionOrder.endIndex);
|
|
74
|
+
} else {
|
|
75
|
+
const nextSectionIndex = sectionOrder.neighbors[parsedSelectedSections].rightIndex;
|
|
76
|
+
if (nextSectionIndex !== null) {
|
|
77
|
+
setSelectedSections(nextSectionIndex);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Move selection to previous section
|
|
84
|
+
case event.key === 'ArrowLeft':
|
|
85
|
+
{
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
if (parsedSelectedSections == null) {
|
|
88
|
+
setSelectedSections(sectionOrder.endIndex);
|
|
89
|
+
} else if (parsedSelectedSections === 'all') {
|
|
90
|
+
setSelectedSections(sectionOrder.startIndex);
|
|
91
|
+
} else {
|
|
92
|
+
const nextSectionIndex = sectionOrder.neighbors[parsedSelectedSections].leftIndex;
|
|
93
|
+
if (nextSectionIndex !== null) {
|
|
94
|
+
setSelectedSections(nextSectionIndex);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Reset the value of the selected section
|
|
101
|
+
case event.key === 'Delete':
|
|
102
|
+
{
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
if (readOnly) {
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
if (parsedSelectedSections == null || parsedSelectedSections === 'all') {
|
|
108
|
+
clearValue();
|
|
109
|
+
} else {
|
|
110
|
+
clearActiveSection();
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Increment / decrement the selected section value
|
|
116
|
+
case ['ArrowUp', 'ArrowDown', 'Home', 'End', 'PageUp', 'PageDown'].includes(event.key):
|
|
117
|
+
{
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
if (readOnly || activeSectionIndex == null) {
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// if all sections are selected, mark the currently editing one as selected
|
|
124
|
+
if (parsedSelectedSections === 'all') {
|
|
125
|
+
setSelectedSections(activeSectionIndex);
|
|
126
|
+
}
|
|
127
|
+
const activeSection = state.sections[activeSectionIndex];
|
|
128
|
+
const newSectionValue = adjustSectionValue(adapter, timezone, activeSection, event.key, sectionsValueBoundaries, localizedDigits, fieldValueManager.getDateFromSection(value, activeSection), {
|
|
129
|
+
minutesStep
|
|
130
|
+
});
|
|
131
|
+
updateSectionValue({
|
|
132
|
+
section: activeSection,
|
|
133
|
+
newSectionValue,
|
|
134
|
+
shouldGoToNextSection: false
|
|
135
|
+
});
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
45
139
|
});
|
|
46
140
|
const containerClickTimeout = useTimeout();
|
|
47
141
|
const handleClick = useEventCallback(event => {
|
|
@@ -148,4 +242,82 @@ export function useFieldRootProps(parameters) {
|
|
|
148
242
|
contentEditable: parsedSelectedSections === 'all',
|
|
149
243
|
tabIndex: internalPropsWithDefaults.disabled || parsedSelectedSections === 0 ? -1 : 0 // TODO: Try to set to undefined when there is a section selected.
|
|
150
244
|
};
|
|
245
|
+
}
|
|
246
|
+
function getDeltaFromKeyCode(keyCode) {
|
|
247
|
+
switch (keyCode) {
|
|
248
|
+
case 'ArrowUp':
|
|
249
|
+
return 1;
|
|
250
|
+
case 'ArrowDown':
|
|
251
|
+
return -1;
|
|
252
|
+
case 'PageUp':
|
|
253
|
+
return 5;
|
|
254
|
+
case 'PageDown':
|
|
255
|
+
return -5;
|
|
256
|
+
default:
|
|
257
|
+
return 0;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function adjustSectionValue(adapter, timezone, section, keyCode, sectionsValueBoundaries, localizedDigits, activeDate, stepsAttributes) {
|
|
261
|
+
const delta = getDeltaFromKeyCode(keyCode);
|
|
262
|
+
const isStart = keyCode === 'Home';
|
|
263
|
+
const isEnd = keyCode === 'End';
|
|
264
|
+
const shouldSetAbsolute = section.value === '' || isStart || isEnd;
|
|
265
|
+
const adjustDigitSection = () => {
|
|
266
|
+
const sectionBoundaries = sectionsValueBoundaries[section.type]({
|
|
267
|
+
currentDate: activeDate,
|
|
268
|
+
format: section.format,
|
|
269
|
+
contentType: section.contentType
|
|
270
|
+
});
|
|
271
|
+
const getCleanValue = value => cleanDigitSectionValue(adapter, value, sectionBoundaries, localizedDigits, section);
|
|
272
|
+
const step = section.type === 'minutes' && stepsAttributes?.minutesStep ? stepsAttributes.minutesStep : 1;
|
|
273
|
+
let newSectionValueNumber;
|
|
274
|
+
if (shouldSetAbsolute) {
|
|
275
|
+
if (section.type === 'year' && !isEnd && !isStart) {
|
|
276
|
+
return adapter.formatByString(adapter.date(undefined, timezone), section.format);
|
|
277
|
+
}
|
|
278
|
+
if (delta > 0 || isStart) {
|
|
279
|
+
newSectionValueNumber = sectionBoundaries.minimum;
|
|
280
|
+
} else {
|
|
281
|
+
newSectionValueNumber = sectionBoundaries.maximum;
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
const currentSectionValue = parseInt(removeLocalizedDigits(section.value, localizedDigits), 10);
|
|
285
|
+
newSectionValueNumber = currentSectionValue + delta * step;
|
|
286
|
+
}
|
|
287
|
+
if (newSectionValueNumber % step !== 0) {
|
|
288
|
+
if (delta < 0 || isStart) {
|
|
289
|
+
newSectionValueNumber += step - (step + newSectionValueNumber) % step; // for JS -3 % 5 = -3 (should be 2)
|
|
290
|
+
}
|
|
291
|
+
if (delta > 0 || isEnd) {
|
|
292
|
+
newSectionValueNumber -= newSectionValueNumber % step;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (newSectionValueNumber > sectionBoundaries.maximum) {
|
|
296
|
+
return getCleanValue(sectionBoundaries.minimum + (newSectionValueNumber - sectionBoundaries.maximum - 1) % (sectionBoundaries.maximum - sectionBoundaries.minimum + 1));
|
|
297
|
+
}
|
|
298
|
+
if (newSectionValueNumber < sectionBoundaries.minimum) {
|
|
299
|
+
return getCleanValue(sectionBoundaries.maximum - (sectionBoundaries.minimum - newSectionValueNumber - 1) % (sectionBoundaries.maximum - sectionBoundaries.minimum + 1));
|
|
300
|
+
}
|
|
301
|
+
return getCleanValue(newSectionValueNumber);
|
|
302
|
+
};
|
|
303
|
+
const adjustLetterSection = () => {
|
|
304
|
+
const options = getLetterEditingOptions(adapter, timezone, section.type, section.format);
|
|
305
|
+
if (options.length === 0) {
|
|
306
|
+
return section.value;
|
|
307
|
+
}
|
|
308
|
+
if (shouldSetAbsolute) {
|
|
309
|
+
if (delta > 0 || isStart) {
|
|
310
|
+
return options[0];
|
|
311
|
+
}
|
|
312
|
+
return options[options.length - 1];
|
|
313
|
+
}
|
|
314
|
+
const currentOptionIndex = options.indexOf(section.value);
|
|
315
|
+
const newOptionIndex = (currentOptionIndex + delta) % options.length;
|
|
316
|
+
const clampedIndex = (newOptionIndex + options.length) % options.length;
|
|
317
|
+
return options[clampedIndex];
|
|
318
|
+
};
|
|
319
|
+
if (section.contentType === 'digit' || section.contentType === 'digit-with-letter') {
|
|
320
|
+
return adjustDigitSection();
|
|
321
|
+
}
|
|
322
|
+
return adjustLetterSection();
|
|
151
323
|
}
|
|
@@ -3,15 +3,13 @@ import { UseFieldStateReturnValue } from "./useFieldState.mjs";
|
|
|
3
3
|
import { UseFieldInternalProps } from "./useField.types.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* Generate the props to pass to the container element of each section of the field.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
9
|
-
* @returns {UseFieldRootPropsReturnValue} The props to forward to the container element of each section of the field.
|
|
6
|
+
* @param {UseFieldSectionContainerPropsParameters} parameters The parameters of the hook.
|
|
7
|
+
* @returns {UseFieldSectionContainerPropsReturnValue} The props to forward to the container element of each section of the field.
|
|
10
8
|
*/
|
|
11
9
|
export declare function useFieldSectionContainerProps(parameters: UseFieldSectionContainerPropsParameters): UseFieldSectionContainerPropsReturnValue;
|
|
12
10
|
interface UseFieldSectionContainerPropsParameters {
|
|
13
11
|
stateResponse: UseFieldStateReturnValue<any>;
|
|
14
|
-
internalPropsWithDefaults: UseFieldInternalProps<any, any
|
|
12
|
+
internalPropsWithDefaults: UseFieldInternalProps<any, any>;
|
|
15
13
|
}
|
|
16
14
|
type UseFieldSectionContainerPropsReturnValue = (sectionIndex: number) => React.HTMLAttributes<HTMLSpanElement>;
|
|
17
15
|
export {};
|
|
@@ -3,15 +3,13 @@ import { UseFieldStateReturnValue } from "./useFieldState.js";
|
|
|
3
3
|
import { UseFieldInternalProps } from "./useField.types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Generate the props to pass to the container element of each section of the field.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
9
|
-
* @returns {UseFieldRootPropsReturnValue} The props to forward to the container element of each section of the field.
|
|
6
|
+
* @param {UseFieldSectionContainerPropsParameters} parameters The parameters of the hook.
|
|
7
|
+
* @returns {UseFieldSectionContainerPropsReturnValue} The props to forward to the container element of each section of the field.
|
|
10
8
|
*/
|
|
11
9
|
export declare function useFieldSectionContainerProps(parameters: UseFieldSectionContainerPropsParameters): UseFieldSectionContainerPropsReturnValue;
|
|
12
10
|
interface UseFieldSectionContainerPropsParameters {
|
|
13
11
|
stateResponse: UseFieldStateReturnValue<any>;
|
|
14
|
-
internalPropsWithDefaults: UseFieldInternalProps<any, any
|
|
12
|
+
internalPropsWithDefaults: UseFieldInternalProps<any, any>;
|
|
15
13
|
}
|
|
16
14
|
type UseFieldSectionContainerPropsReturnValue = (sectionIndex: number) => React.HTMLAttributes<HTMLSpanElement>;
|
|
17
15
|
export {};
|
|
@@ -8,10 +8,8 @@ exports.useFieldSectionContainerProps = useFieldSectionContainerProps;
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
/**
|
|
10
10
|
* Generate the props to pass to the container element of each section of the field.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
14
|
-
* @returns {UseFieldRootPropsReturnValue} The props to forward to the container element of each section of the field.
|
|
11
|
+
* @param {UseFieldSectionContainerPropsParameters} parameters The parameters of the hook.
|
|
12
|
+
* @returns {UseFieldSectionContainerPropsReturnValue} The props to forward to the container element of each section of the field.
|
|
15
13
|
*/
|
|
16
14
|
function useFieldSectionContainerProps(parameters) {
|
|
17
15
|
const {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Generate the props to pass to the container element of each section of the field.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
7
|
-
* @returns {UseFieldRootPropsReturnValue} The props to forward to the container element of each section of the field.
|
|
4
|
+
* @param {UseFieldSectionContainerPropsParameters} parameters The parameters of the hook.
|
|
5
|
+
* @returns {UseFieldSectionContainerPropsReturnValue} The props to forward to the container element of each section of the field.
|
|
8
6
|
*/
|
|
9
7
|
export function useFieldSectionContainerProps(parameters) {
|
|
10
8
|
const {
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { UseFieldStateReturnValue } from "./useFieldState.mjs";
|
|
2
|
-
import { FieldSection
|
|
2
|
+
import { FieldSection } from "../../../models/index.mjs";
|
|
3
3
|
import { UseFieldDOMGetters, UseFieldInternalProps } from "./useField.types.mjs";
|
|
4
4
|
import { UseFieldCharacterEditingReturnValue } from "./useFieldCharacterEditing.mjs";
|
|
5
|
+
import { PickerAnyManager } from "../../models/index.mjs";
|
|
5
6
|
import { PickersSectionElement } from "../../../PickersSectionList/index.mjs";
|
|
6
7
|
/**
|
|
7
8
|
* Generate the props to pass to the content element of each section of the field.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
11
|
-
* @returns {UseFieldRootPropsReturnValue} The props to forward to the content element of each section of the field.
|
|
9
|
+
* @param {UseFieldSectionContentPropsParameters} parameters The parameters of the hook.
|
|
10
|
+
* @returns {UseFieldSectionContentPropsReturnValue} The props to forward to the content element of each section of the field.
|
|
12
11
|
*/
|
|
13
12
|
export declare function useFieldSectionContentProps(parameters: UseFieldSectionContentPropsParameters): UseFieldSectionContentPropsReturnValue;
|
|
14
13
|
interface UseFieldSectionContentPropsParameters {
|
|
15
|
-
manager:
|
|
14
|
+
manager: PickerAnyManager;
|
|
16
15
|
stateResponse: UseFieldStateReturnValue<any>;
|
|
17
16
|
applyCharacterEditing: UseFieldCharacterEditingReturnValue;
|
|
18
|
-
internalPropsWithDefaults: UseFieldInternalProps<any, any
|
|
17
|
+
internalPropsWithDefaults: UseFieldInternalProps<any, any>;
|
|
19
18
|
domGetters: UseFieldDOMGetters;
|
|
20
19
|
focused: boolean;
|
|
21
20
|
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { UseFieldStateReturnValue } from "./useFieldState.js";
|
|
2
|
-
import { FieldSection
|
|
2
|
+
import { FieldSection } from "../../../models/index.js";
|
|
3
3
|
import { UseFieldDOMGetters, UseFieldInternalProps } from "./useField.types.js";
|
|
4
4
|
import { UseFieldCharacterEditingReturnValue } from "./useFieldCharacterEditing.js";
|
|
5
|
+
import { PickerAnyManager } from "../../models/index.js";
|
|
5
6
|
import { PickersSectionElement } from "../../../PickersSectionList/index.js";
|
|
6
7
|
/**
|
|
7
8
|
* Generate the props to pass to the content element of each section of the field.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
11
|
-
* @returns {UseFieldRootPropsReturnValue} The props to forward to the content element of each section of the field.
|
|
9
|
+
* @param {UseFieldSectionContentPropsParameters} parameters The parameters of the hook.
|
|
10
|
+
* @returns {UseFieldSectionContentPropsReturnValue} The props to forward to the content element of each section of the field.
|
|
12
11
|
*/
|
|
13
12
|
export declare function useFieldSectionContentProps(parameters: UseFieldSectionContentPropsParameters): UseFieldSectionContentPropsReturnValue;
|
|
14
13
|
interface UseFieldSectionContentPropsParameters {
|
|
15
|
-
manager:
|
|
14
|
+
manager: PickerAnyManager;
|
|
16
15
|
stateResponse: UseFieldStateReturnValue<any>;
|
|
17
16
|
applyCharacterEditing: UseFieldCharacterEditingReturnValue;
|
|
18
|
-
internalPropsWithDefaults: UseFieldInternalProps<any, any
|
|
17
|
+
internalPropsWithDefaults: UseFieldInternalProps<any, any>;
|
|
19
18
|
domGetters: UseFieldDOMGetters;
|
|
20
19
|
focused: boolean;
|
|
21
20
|
}
|
|
@@ -12,10 +12,8 @@ var _hooks = require("../../../hooks");
|
|
|
12
12
|
var _syncSelectionToDOM = require("./syncSelectionToDOM");
|
|
13
13
|
/**
|
|
14
14
|
* Generate the props to pass to the content element of each section of the field.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
18
|
-
* @returns {UseFieldRootPropsReturnValue} The props to forward to the content element of each section of the field.
|
|
15
|
+
* @param {UseFieldSectionContentPropsParameters} parameters The parameters of the hook.
|
|
16
|
+
* @returns {UseFieldSectionContentPropsReturnValue} The props to forward to the content element of each section of the field.
|
|
19
17
|
*/
|
|
20
18
|
function useFieldSectionContentProps(parameters) {
|
|
21
19
|
const adapter = (0, _hooks.usePickerAdapter)();
|
|
@@ -4,10 +4,8 @@ import { usePickerAdapter, usePickerTranslations } from "../../../hooks/index.mj
|
|
|
4
4
|
import { syncSelectionToDOM } from "./syncSelectionToDOM.mjs";
|
|
5
5
|
/**
|
|
6
6
|
* Generate the props to pass to the content element of each section of the field.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @param {UseFieldRootPropsParameters} parameters The parameters of the hook.
|
|
10
|
-
* @returns {UseFieldRootPropsReturnValue} The props to forward to the content element of each section of the field.
|
|
7
|
+
* @param {UseFieldSectionContentPropsParameters} parameters The parameters of the hook.
|
|
8
|
+
* @returns {UseFieldSectionContentPropsReturnValue} The props to forward to the content element of each section of the field.
|
|
11
9
|
*/
|
|
12
10
|
export function useFieldSectionContentProps(parameters) {
|
|
13
11
|
const adapter = usePickerAdapter();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UseFieldInternalProps, UseFieldState, FieldParsedSelectedSections, FieldSectionsValueBoundaries, SectionOrdering, UseFieldForwardedProps, CharacterEditingQuery } from "./useField.types.mjs";
|
|
2
2
|
import { FieldSelectedSections, PickersTimezone, InferFieldSection, PickerManager } from "../../../models/index.mjs";
|
|
3
3
|
import { PickerValidValue } from "../../models/index.mjs";
|
|
4
|
-
export declare const useFieldState: <TValue extends PickerValidValue,
|
|
5
|
-
interface UseFieldStateParameters<TValue extends PickerValidValue,
|
|
6
|
-
manager: PickerManager<TValue,
|
|
7
|
-
internalPropsWithDefaults: UseFieldInternalProps<TValue,
|
|
4
|
+
export declare const useFieldState: <TValue extends PickerValidValue, TError, TValidationProps extends {}, TForwardedProps extends UseFieldForwardedProps>(parameters: UseFieldStateParameters<TValue, TError, TValidationProps, TForwardedProps>) => UseFieldStateReturnValue<TValue>;
|
|
5
|
+
interface UseFieldStateParameters<TValue extends PickerValidValue, TError, TValidationProps extends {}, TForwardedProps extends UseFieldForwardedProps> {
|
|
6
|
+
manager: PickerManager<TValue, TError, TValidationProps, any>;
|
|
7
|
+
internalPropsWithDefaults: UseFieldInternalProps<TValue, TError> & TValidationProps;
|
|
8
8
|
forwardedProps: TForwardedProps;
|
|
9
9
|
}
|
|
10
10
|
export interface UpdateSectionValueParameters<TValue extends PickerValidValue> {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UseFieldInternalProps, UseFieldState, FieldParsedSelectedSections, FieldSectionsValueBoundaries, SectionOrdering, UseFieldForwardedProps, CharacterEditingQuery } from "./useField.types.js";
|
|
2
2
|
import { FieldSelectedSections, PickersTimezone, InferFieldSection, PickerManager } from "../../../models/index.js";
|
|
3
3
|
import { PickerValidValue } from "../../models/index.js";
|
|
4
|
-
export declare const useFieldState: <TValue extends PickerValidValue,
|
|
5
|
-
interface UseFieldStateParameters<TValue extends PickerValidValue,
|
|
6
|
-
manager: PickerManager<TValue,
|
|
7
|
-
internalPropsWithDefaults: UseFieldInternalProps<TValue,
|
|
4
|
+
export declare const useFieldState: <TValue extends PickerValidValue, TError, TValidationProps extends {}, TForwardedProps extends UseFieldForwardedProps>(parameters: UseFieldStateParameters<TValue, TError, TValidationProps, TForwardedProps>) => UseFieldStateReturnValue<TValue>;
|
|
5
|
+
interface UseFieldStateParameters<TValue extends PickerValidValue, TError, TValidationProps extends {}, TForwardedProps extends UseFieldForwardedProps> {
|
|
6
|
+
manager: PickerManager<TValue, TError, TValidationProps, any>;
|
|
7
|
+
internalPropsWithDefaults: UseFieldInternalProps<TValue, TError> & TValidationProps;
|
|
8
8
|
forwardedProps: TForwardedProps;
|
|
9
9
|
}
|
|
10
10
|
export interface UpdateSectionValueParameters<TValue extends PickerValidValue> {
|