@mui/x-date-pickers 8.0.0-alpha.7 → 8.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +551 -3
- package/DateCalendar/DayCalendar.js +2 -0
- package/DateField/DateField.js +26 -31
- package/DateField/DateField.types.d.ts +6 -15
- package/DateField/useDateField.d.ts +1 -1
- package/DateField/useDateField.js +2 -1
- package/DateTimeField/DateTimeField.js +26 -31
- package/DateTimeField/DateTimeField.types.d.ts +6 -15
- package/DateTimeField/useDateTimeField.d.ts +1 -1
- package/DateTimeField/useDateTimeField.js +2 -1
- package/DesktopDatePicker/DesktopDatePicker.js +0 -11
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -12
- package/DesktopTimePicker/DesktopTimePicker.js +1 -12
- package/MobileDatePicker/MobileDatePicker.js +0 -9
- package/MobileDateTimePicker/MobileDateTimePicker.js +0 -9
- package/MobileTimePicker/MobileTimePicker.js +0 -9
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +2 -0
- package/PickersCalendarHeader/PickersCalendarHeader.js +2 -0
- package/TimeClock/ClockPointer.js +2 -0
- package/TimeField/TimeField.js +25 -30
- package/TimeField/TimeField.types.d.ts +6 -15
- package/TimeField/useTimeField.d.ts +1 -1
- package/TimeField/useTimeField.js +2 -1
- package/hooks/useParsedFormat.d.ts +8 -6
- package/hooks/useParsedFormat.js +10 -12
- package/hooks/usePickerActionsContext.d.ts +1 -1
- package/hooks/usePickerContext.d.ts +4 -2
- package/hooks/usePickerContext.js +2 -1
- package/hooks/useSplitFieldProps.d.ts +12 -3
- package/hooks/useSplitFieldProps.js +8 -3
- package/index.js +1 -1
- package/internals/components/PickerFieldUI.d.ts +132 -0
- package/internals/components/PickerFieldUI.js +306 -0
- package/internals/components/PickerProvider.d.ts +25 -4
- package/internals/components/PickerProvider.js +11 -6
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -94
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +8 -31
- package/internals/hooks/useField/index.d.ts +3 -1
- package/internals/hooks/useField/index.js +3 -2
- package/internals/hooks/useField/useField.d.ts +1 -10
- package/internals/hooks/useField/useField.js +16 -19
- package/internals/hooks/useField/useField.types.d.ts +11 -4
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +15 -0
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +46 -0
- package/internals/hooks/useField/useFieldV6TextField.js +3 -0
- package/internals/hooks/useField/useFieldV7TextField.js +6 -3
- package/internals/hooks/useFieldOwnerState.d.ts +1 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.js +20 -49
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +6 -14
- package/internals/hooks/useNullablePickerContext.d.ts +5 -0
- package/internals/hooks/useNullablePickerContext.js +10 -0
- package/internals/hooks/usePicker/usePicker.d.ts +1 -2
- package/internals/hooks/usePicker/usePicker.js +0 -3
- package/internals/hooks/usePicker/usePicker.types.d.ts +2 -3
- package/internals/hooks/usePicker/usePickerProvider.d.ts +8 -2
- package/internals/hooks/usePicker/usePickerProvider.js +22 -2
- package/internals/hooks/usePicker/usePickerValue.js +5 -11
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +5 -2
- package/internals/hooks/useUtils.d.ts +4 -3
- package/internals/index.d.ts +6 -3
- package/internals/index.js +1 -1
- package/internals/models/fields.d.ts +3 -16
- package/internals/models/manager.d.ts +3 -0
- package/internals/models/props/basePickerProps.d.ts +0 -12
- package/locales/utils/getPickersLocalization.d.ts +0 -7
- package/locales/utils/getPickersLocalization.js +0 -13
- package/managers/index.d.ts +3 -3
- package/managers/useDateManager.d.ts +1 -1
- package/managers/useDateManager.js +9 -1
- package/managers/useDateTimeManager.d.ts +1 -1
- package/managers/useDateTimeManager.js +9 -1
- package/managers/useTimeManager.d.ts +1 -1
- package/managers/useTimeManager.js +9 -1
- package/models/fields.d.ts +4 -4
- package/models/manager.d.ts +12 -3
- package/modern/DateCalendar/DayCalendar.js +2 -0
- package/modern/DateField/DateField.js +26 -31
- package/modern/DateField/useDateField.js +2 -1
- package/modern/DateTimeField/DateTimeField.js +26 -31
- package/modern/DateTimeField/useDateTimeField.js +2 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -11
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -12
- package/modern/DesktopTimePicker/DesktopTimePicker.js +1 -12
- package/modern/MobileDatePicker/MobileDatePicker.js +0 -9
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -9
- package/modern/MobileTimePicker/MobileTimePicker.js +0 -9
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +2 -0
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +2 -0
- package/modern/TimeClock/ClockPointer.js +2 -0
- package/modern/TimeField/TimeField.js +25 -30
- package/modern/TimeField/useTimeField.js +2 -1
- package/modern/hooks/useParsedFormat.js +10 -12
- package/modern/hooks/usePickerContext.js +2 -1
- package/modern/hooks/useSplitFieldProps.js +8 -3
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerFieldUI.js +306 -0
- package/modern/internals/components/PickerProvider.js +11 -6
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -94
- package/modern/internals/hooks/useField/index.js +3 -2
- package/modern/internals/hooks/useField/useField.js +16 -19
- package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +46 -0
- package/modern/internals/hooks/useField/useFieldV6TextField.js +3 -0
- package/modern/internals/hooks/useField/useFieldV7TextField.js +6 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +20 -49
- package/modern/internals/hooks/useNullablePickerContext.js +10 -0
- package/modern/internals/hooks/usePicker/usePicker.js +0 -3
- package/modern/internals/hooks/usePicker/usePickerProvider.js +22 -2
- package/modern/internals/hooks/usePicker/usePickerValue.js +5 -11
- package/modern/internals/index.js +1 -1
- package/modern/locales/utils/getPickersLocalization.js +0 -13
- package/modern/managers/useDateManager.js +9 -1
- package/modern/managers/useDateTimeManager.js +9 -1
- package/modern/managers/useTimeManager.js +9 -1
- package/node/DateCalendar/DayCalendar.js +1 -0
- package/node/DateField/DateField.js +26 -31
- package/node/DateField/useDateField.js +2 -1
- package/node/DateTimeField/DateTimeField.js +26 -31
- package/node/DateTimeField/useDateTimeField.js +2 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +0 -11
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -12
- package/node/DesktopTimePicker/DesktopTimePicker.js +1 -12
- package/node/MobileDatePicker/MobileDatePicker.js +0 -9
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -9
- package/node/MobileTimePicker/MobileTimePicker.js +0 -9
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +1 -0
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +2 -0
- package/node/TimeClock/ClockPointer.js +1 -0
- package/node/TimeField/TimeField.js +25 -30
- package/node/TimeField/useTimeField.js +2 -1
- package/node/hooks/useParsedFormat.js +10 -12
- package/node/hooks/usePickerContext.js +4 -3
- package/node/hooks/useSplitFieldProps.js +7 -2
- package/node/index.js +1 -1
- package/node/internals/components/PickerFieldUI.js +318 -0
- package/node/internals/components/PickerProvider.js +13 -8
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +23 -96
- package/node/internals/hooks/useField/index.js +3 -2
- package/node/internals/hooks/useField/useField.js +17 -21
- package/node/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +55 -0
- package/node/internals/hooks/useField/useFieldV6TextField.js +3 -0
- package/node/internals/hooks/useField/useFieldV7TextField.js +6 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +20 -49
- package/node/internals/hooks/useNullablePickerContext.js +16 -0
- package/node/internals/hooks/usePicker/usePicker.js +0 -3
- package/node/internals/hooks/usePicker/usePickerProvider.js +22 -2
- package/node/internals/hooks/usePicker/usePickerValue.js +5 -11
- package/node/internals/index.js +21 -3
- package/node/locales/utils/getPickersLocalization.js +2 -16
- package/node/managers/useDateManager.js +9 -1
- package/node/managers/useDateTimeManager.js +9 -1
- package/node/managers/useTimeManager.js +9 -1
- package/package.json +2 -2
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +0 -3
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -44
- package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -44
- package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -52
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["props"
|
|
4
|
-
_excluded2 = ["ownerState"],
|
|
5
|
-
_excluded3 = ["ownerState"];
|
|
3
|
+
const _excluded = ["props"];
|
|
6
4
|
import * as React from 'react';
|
|
7
5
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
8
|
-
import MuiInputAdornment from '@mui/material/InputAdornment';
|
|
9
|
-
import IconButton from '@mui/material/IconButton';
|
|
10
6
|
import useForkRef from '@mui/utils/useForkRef';
|
|
11
7
|
import useId from '@mui/utils/useId';
|
|
12
8
|
import { PickersPopper } from "../../components/PickersPopper.js";
|
|
13
9
|
import { usePicker } from "../usePicker/index.js";
|
|
14
10
|
import { PickersLayout } from "../../../PickersLayout/index.js";
|
|
15
11
|
import { PickerProvider } from "../../components/PickerProvider.js";
|
|
12
|
+
import { PickerFieldUIContextProvider } from "../../components/PickerFieldUI.js";
|
|
16
13
|
|
|
17
14
|
/**
|
|
18
15
|
* Hook managing all the single-date desktop pickers:
|
|
@@ -23,8 +20,7 @@ import { PickerProvider } from "../../components/PickerProvider.js";
|
|
|
23
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
21
|
export const useDesktopPicker = _ref => {
|
|
25
22
|
let {
|
|
26
|
-
props
|
|
27
|
-
getOpenDialogAriaText
|
|
23
|
+
props
|
|
28
24
|
} = _ref,
|
|
29
25
|
pickerParams = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
30
26
|
const {
|
|
@@ -32,31 +28,21 @@ export const useDesktopPicker = _ref => {
|
|
|
32
28
|
slotProps: innerSlotProps,
|
|
33
29
|
className,
|
|
34
30
|
sx,
|
|
35
|
-
format,
|
|
36
|
-
formatDensity,
|
|
37
|
-
enableAccessibleFieldDOMStructure,
|
|
38
|
-
selectedSections,
|
|
39
|
-
onSelectedSectionsChange,
|
|
40
|
-
timezone,
|
|
41
31
|
name,
|
|
42
32
|
label,
|
|
43
33
|
inputRef,
|
|
44
34
|
readOnly,
|
|
45
|
-
disabled,
|
|
46
35
|
autoFocus,
|
|
47
36
|
localeText,
|
|
48
37
|
reduceAnimations
|
|
49
38
|
} = props;
|
|
50
|
-
const containerRef = React.useRef(null);
|
|
51
39
|
const fieldRef = React.useRef(null);
|
|
52
40
|
const labelId = useId();
|
|
53
41
|
const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
|
|
54
42
|
const {
|
|
55
|
-
hasUIView,
|
|
56
43
|
providerProps,
|
|
57
44
|
renderCurrentView,
|
|
58
45
|
shouldRestoreFocus,
|
|
59
|
-
fieldProps: pickerFieldProps,
|
|
60
46
|
ownerState
|
|
61
47
|
} = usePicker(_extends({}, pickerParams, {
|
|
62
48
|
props,
|
|
@@ -65,39 +51,6 @@ export const useDesktopPicker = _ref => {
|
|
|
65
51
|
autoFocusView: true,
|
|
66
52
|
variant: 'desktop'
|
|
67
53
|
}));
|
|
68
|
-
const InputAdornment = slots.inputAdornment ?? MuiInputAdornment;
|
|
69
|
-
const _useSlotProps = useSlotProps({
|
|
70
|
-
elementType: InputAdornment,
|
|
71
|
-
externalSlotProps: innerSlotProps?.inputAdornment,
|
|
72
|
-
additionalProps: {
|
|
73
|
-
position: 'end'
|
|
74
|
-
},
|
|
75
|
-
ownerState
|
|
76
|
-
}),
|
|
77
|
-
inputAdornmentProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
|
78
|
-
const OpenPickerButton = slots.openPickerButton ?? IconButton;
|
|
79
|
-
const _useSlotProps2 = useSlotProps({
|
|
80
|
-
elementType: OpenPickerButton,
|
|
81
|
-
externalSlotProps: innerSlotProps?.openPickerButton,
|
|
82
|
-
additionalProps: {
|
|
83
|
-
disabled: disabled || readOnly,
|
|
84
|
-
// This direct access to `providerProps` will go away in https://github.com/mui/mui-x/pull/15671
|
|
85
|
-
onClick: event => {
|
|
86
|
-
event.preventDefault();
|
|
87
|
-
providerProps.contextValue.setOpen(prevOpen => !prevOpen);
|
|
88
|
-
},
|
|
89
|
-
'aria-label': getOpenDialogAriaText(pickerFieldProps.value),
|
|
90
|
-
edge: inputAdornmentProps.position
|
|
91
|
-
},
|
|
92
|
-
ownerState
|
|
93
|
-
}),
|
|
94
|
-
openPickerButtonProps = _objectWithoutPropertiesLoose(_useSlotProps2, _excluded3);
|
|
95
|
-
const OpenPickerIcon = slots.openPickerIcon;
|
|
96
|
-
const openPickerIconProps = useSlotProps({
|
|
97
|
-
elementType: OpenPickerIcon,
|
|
98
|
-
externalSlotProps: innerSlotProps?.openPickerIcon,
|
|
99
|
-
ownerState
|
|
100
|
-
});
|
|
101
54
|
const Field = slots.field;
|
|
102
55
|
const fieldProps = useSlotProps({
|
|
103
56
|
elementType: Field,
|
|
@@ -105,17 +58,7 @@ export const useDesktopPicker = _ref => {
|
|
|
105
58
|
additionalProps: _extends({
|
|
106
59
|
// Internal props
|
|
107
60
|
readOnly,
|
|
108
|
-
|
|
109
|
-
format,
|
|
110
|
-
formatDensity,
|
|
111
|
-
enableAccessibleFieldDOMStructure,
|
|
112
|
-
selectedSections,
|
|
113
|
-
onSelectedSectionsChange,
|
|
114
|
-
timezone,
|
|
115
|
-
autoFocus: autoFocus && !props.open
|
|
116
|
-
}, pickerFieldProps, {
|
|
117
|
-
// onChange and value
|
|
118
|
-
|
|
61
|
+
autoFocus: autoFocus && !props.open,
|
|
119
62
|
// Forwarded props
|
|
120
63
|
className,
|
|
121
64
|
sx,
|
|
@@ -129,24 +72,6 @@ export const useDesktopPicker = _ref => {
|
|
|
129
72
|
}),
|
|
130
73
|
ownerState
|
|
131
74
|
});
|
|
132
|
-
|
|
133
|
-
// TODO: Move to `useSlotProps` when https://github.com/mui/material-ui/pull/35088 will be merged
|
|
134
|
-
if (hasUIView) {
|
|
135
|
-
fieldProps.InputProps = _extends({}, fieldProps.InputProps, {
|
|
136
|
-
ref: containerRef
|
|
137
|
-
}, !props.disableOpenPicker && {
|
|
138
|
-
[`${inputAdornmentProps.position}Adornment`]: /*#__PURE__*/_jsx(InputAdornment, _extends({}, inputAdornmentProps, {
|
|
139
|
-
children: /*#__PURE__*/_jsx(OpenPickerButton, _extends({}, openPickerButtonProps, {
|
|
140
|
-
children: /*#__PURE__*/_jsx(OpenPickerIcon, _extends({}, openPickerIconProps))
|
|
141
|
-
}))
|
|
142
|
-
}))
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
const slotsForField = _extends({
|
|
146
|
-
textField: slots.textField,
|
|
147
|
-
clearIcon: slots.clearIcon,
|
|
148
|
-
clearButton: slots.clearButton
|
|
149
|
-
}, fieldProps.slots);
|
|
150
75
|
const Layout = slots.layout ?? PickersLayout;
|
|
151
76
|
let labelledById = labelId;
|
|
152
77
|
if (isToolbarHidden) {
|
|
@@ -165,25 +90,27 @@ export const useDesktopPicker = _ref => {
|
|
|
165
90
|
}, innerSlotProps?.popper)
|
|
166
91
|
});
|
|
167
92
|
const handleFieldRef = useForkRef(fieldRef, fieldProps.unstableFieldRef);
|
|
168
|
-
const renderPicker = () => /*#__PURE__*/
|
|
169
|
-
children:
|
|
170
|
-
slots: slotsForField,
|
|
171
|
-
slotProps: slotProps,
|
|
172
|
-
unstableFieldRef: handleFieldRef
|
|
173
|
-
})), /*#__PURE__*/_jsx(PickersPopper, {
|
|
174
|
-
role: "dialog",
|
|
175
|
-
placement: "bottom-start",
|
|
176
|
-
anchorEl: containerRef.current,
|
|
93
|
+
const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
|
|
94
|
+
children: /*#__PURE__*/_jsxs(PickerFieldUIContextProvider, {
|
|
177
95
|
slots: slots,
|
|
178
96
|
slotProps: slotProps,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
97
|
+
children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps, {
|
|
98
|
+
unstableFieldRef: handleFieldRef
|
|
99
|
+
})), /*#__PURE__*/_jsx(PickersPopper, {
|
|
100
|
+
role: "dialog",
|
|
101
|
+
placement: "bottom-start",
|
|
102
|
+
anchorEl: providerProps.contextValue.triggerRef.current,
|
|
182
103
|
slots: slots,
|
|
183
104
|
slotProps: slotProps,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
105
|
+
shouldRestoreFocus: shouldRestoreFocus,
|
|
106
|
+
reduceAnimations: reduceAnimations,
|
|
107
|
+
children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
|
|
108
|
+
slots: slots,
|
|
109
|
+
slotProps: slotProps,
|
|
110
|
+
children: renderCurrentView()
|
|
111
|
+
}))
|
|
112
|
+
})]
|
|
113
|
+
})
|
|
187
114
|
}));
|
|
188
115
|
return {
|
|
189
116
|
renderPicker
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { useField
|
|
2
|
-
export { createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./useField.utils.js";
|
|
1
|
+
export { useField } from "./useField.js";
|
|
2
|
+
export { createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./useField.utils.js";
|
|
3
|
+
export { useFieldInternalPropsWithDefaults } from "./useFieldInternalPropsWithDefaults.js";
|
|
@@ -10,22 +10,6 @@ import { useFieldState } from "./useFieldState.js";
|
|
|
10
10
|
import { useFieldCharacterEditing } from "./useFieldCharacterEditing.js";
|
|
11
11
|
import { useFieldV7TextField } from "./useFieldV7TextField.js";
|
|
12
12
|
import { useFieldV6TextField } from "./useFieldV6TextField.js";
|
|
13
|
-
/**
|
|
14
|
-
* Applies the default values to the field internal props.
|
|
15
|
-
* This is a temporary hook that will be removed during a follow up when `useField` will receive the internal props without the defaults.
|
|
16
|
-
* It is only here to allow the migration to be done in smaller steps.
|
|
17
|
-
*/
|
|
18
|
-
export const useFieldInternalPropsWithDefaults = ({
|
|
19
|
-
manager,
|
|
20
|
-
internalProps
|
|
21
|
-
}) => {
|
|
22
|
-
const localizationContext = useLocalizationContext();
|
|
23
|
-
return React.useMemo(() => {
|
|
24
|
-
return manager.internal_applyDefaultsToFieldInternalProps(_extends({}, localizationContext, {
|
|
25
|
-
internalProps
|
|
26
|
-
}));
|
|
27
|
-
}, [manager, internalProps, localizationContext]);
|
|
28
|
-
};
|
|
29
13
|
export const useField = params => {
|
|
30
14
|
const utils = useUtils();
|
|
31
15
|
const {
|
|
@@ -35,7 +19,8 @@ export const useField = params => {
|
|
|
35
19
|
minutesStep,
|
|
36
20
|
enableAccessibleFieldDOMStructure = true,
|
|
37
21
|
disabled = false,
|
|
38
|
-
readOnly = false
|
|
22
|
+
readOnly = false,
|
|
23
|
+
autoFocus = false
|
|
39
24
|
},
|
|
40
25
|
forwardedProps: {
|
|
41
26
|
onKeyDown,
|
|
@@ -45,7 +30,8 @@ export const useField = params => {
|
|
|
45
30
|
},
|
|
46
31
|
fieldValueManager,
|
|
47
32
|
valueManager,
|
|
48
|
-
validator
|
|
33
|
+
validator,
|
|
34
|
+
getOpenPickerButtonAriaLabel: getOpenDialogAriaText
|
|
49
35
|
} = params;
|
|
50
36
|
const isRtl = useRtl();
|
|
51
37
|
const stateResponse = useFieldState(params);
|
|
@@ -157,6 +143,11 @@ export const useField = params => {
|
|
|
157
143
|
if (readOnly || activeSectionIndex == null) {
|
|
158
144
|
break;
|
|
159
145
|
}
|
|
146
|
+
|
|
147
|
+
// if all sections are selected, mark the currently editing one as selected
|
|
148
|
+
if (parsedSelectedSections === 'all') {
|
|
149
|
+
setSelectedSections(activeSectionIndex);
|
|
150
|
+
}
|
|
160
151
|
const activeSection = state.sections[activeSectionIndex];
|
|
161
152
|
const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
|
|
162
153
|
const newSectionValue = adjustSectionValue(utils, timezone, activeSection, event.key, sectionsValueBoundaries, localizedDigits, activeDateManager.date, {
|
|
@@ -232,9 +223,15 @@ export const useField = params => {
|
|
|
232
223
|
error: inputError,
|
|
233
224
|
clearable: Boolean(clearable && !areAllSectionsEmpty && !readOnly && !disabled)
|
|
234
225
|
};
|
|
226
|
+
const localizationContext = useLocalizationContext();
|
|
227
|
+
const openPickerAriaLabel = React.useMemo(() => getOpenDialogAriaText(_extends({}, localizationContext, {
|
|
228
|
+
value: state.value
|
|
229
|
+
})), [getOpenDialogAriaText, state.value, localizationContext]);
|
|
235
230
|
const commonAdditionalProps = {
|
|
236
231
|
disabled,
|
|
237
|
-
readOnly
|
|
232
|
+
readOnly,
|
|
233
|
+
autoFocus,
|
|
234
|
+
openPickerAriaLabel
|
|
238
235
|
};
|
|
239
236
|
return _extends({}, params.forwardedProps, commonForwardedProps, commonAdditionalProps, returnedValue);
|
|
240
237
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useLocalizationContext } from "../useUtils.js";
|
|
4
|
+
import { useNullablePickerContext } from "../useNullablePickerContext.js";
|
|
5
|
+
export const PickerFieldPrivateContext = /*#__PURE__*/React.createContext(null);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Applies the default values to the field internal props.
|
|
9
|
+
* This is a temporary hook that will be removed during a follow up when `useField` will receive the internal props without the defaults.
|
|
10
|
+
* It is only here to allow the migration to be done in smaller steps.
|
|
11
|
+
*/
|
|
12
|
+
export function useFieldInternalPropsWithDefaults({
|
|
13
|
+
manager,
|
|
14
|
+
internalProps
|
|
15
|
+
}) {
|
|
16
|
+
const localizationContext = useLocalizationContext();
|
|
17
|
+
const pickerContext = useNullablePickerContext();
|
|
18
|
+
const fieldPrivateContext = React.useContext(PickerFieldPrivateContext);
|
|
19
|
+
const setValue = pickerContext?.setValue;
|
|
20
|
+
const handleChangeFromPicker = React.useCallback((newValue, ctx) => {
|
|
21
|
+
return setValue?.(newValue, {
|
|
22
|
+
validationError: ctx.validationError
|
|
23
|
+
});
|
|
24
|
+
}, [setValue]);
|
|
25
|
+
return React.useMemo(() => {
|
|
26
|
+
let internalPropsWithDefaultsFromContext = internalProps;
|
|
27
|
+
// If one of the context is null,
|
|
28
|
+
// Then the field is used as a standalone component and the other context will be null as well.
|
|
29
|
+
if (fieldPrivateContext != null && pickerContext != null) {
|
|
30
|
+
internalPropsWithDefaultsFromContext = _extends({
|
|
31
|
+
value: pickerContext.value,
|
|
32
|
+
onChange: handleChangeFromPicker,
|
|
33
|
+
timezone: pickerContext.timezone,
|
|
34
|
+
disabled: pickerContext.disabled,
|
|
35
|
+
format: pickerContext.fieldFormat,
|
|
36
|
+
formatDensity: fieldPrivateContext.formatDensity,
|
|
37
|
+
enableAccessibleFieldDOMStructure: fieldPrivateContext.enableAccessibleFieldDOMStructure,
|
|
38
|
+
selectedSections: fieldPrivateContext.selectedSections,
|
|
39
|
+
onSelectedSectionsChange: fieldPrivateContext.onSelectedSectionsChange
|
|
40
|
+
}, internalProps);
|
|
41
|
+
}
|
|
42
|
+
return manager.internal_applyDefaultsToFieldInternalProps(_extends({}, localizationContext, {
|
|
43
|
+
internalProps: internalPropsWithDefaultsFromContext
|
|
44
|
+
}));
|
|
45
|
+
}, [manager, localizationContext, pickerContext, fieldPrivateContext, internalProps, handleChangeFromPicker]);
|
|
46
|
+
}
|
|
@@ -237,6 +237,9 @@ export const useFieldV6TextField = params => {
|
|
|
237
237
|
const shouldUseEventData = eventData && eventData.length > 1;
|
|
238
238
|
const valueStr = shouldUseEventData ? eventData : targetValue;
|
|
239
239
|
const cleanValueStr = cleanString(valueStr);
|
|
240
|
+
if (parsedSelectedSections === 'all') {
|
|
241
|
+
setSelectedSections(activeSectionIndex);
|
|
242
|
+
}
|
|
240
243
|
|
|
241
244
|
// If no section is selected or eventData should be used, we just try to parse the new value
|
|
242
245
|
// This line is mostly triggered by imperative code / application tests.
|
|
@@ -11,7 +11,8 @@ export const useFieldV7TextField = params => {
|
|
|
11
11
|
const {
|
|
12
12
|
internalProps: {
|
|
13
13
|
disabled,
|
|
14
|
-
readOnly = false
|
|
14
|
+
readOnly = false,
|
|
15
|
+
autoFocus = false
|
|
15
16
|
},
|
|
16
17
|
forwardedProps: {
|
|
17
18
|
sectionListRef: inSectionListRef,
|
|
@@ -20,8 +21,7 @@ export const useFieldV7TextField = params => {
|
|
|
20
21
|
onFocus,
|
|
21
22
|
onInput,
|
|
22
23
|
onPaste,
|
|
23
|
-
focused: focusedProp
|
|
24
|
-
autoFocus = false
|
|
24
|
+
focused: focusedProp
|
|
25
25
|
},
|
|
26
26
|
fieldValueManager,
|
|
27
27
|
applyCharacterEditing,
|
|
@@ -176,6 +176,9 @@ export const useFieldV7TextField = params => {
|
|
|
176
176
|
} else if (keyPressed.length > 1) {
|
|
177
177
|
updateValueFromValueStr(keyPressed);
|
|
178
178
|
} else {
|
|
179
|
+
if (parsedSelectedSections === 'all') {
|
|
180
|
+
setSelectedSections(0);
|
|
181
|
+
}
|
|
179
182
|
applyCharacterEditing({
|
|
180
183
|
keyPressed,
|
|
181
184
|
sectionIndex: 0
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["props"
|
|
3
|
+
const _excluded = ["props"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
6
6
|
import useForkRef from '@mui/utils/useForkRef';
|
|
7
7
|
import useId from '@mui/utils/useId';
|
|
8
8
|
import { PickersModalDialog } from "../../components/PickersModalDialog.js";
|
|
9
9
|
import { usePicker } from "../usePicker/index.js";
|
|
10
|
-
import { onSpaceOrEnter } from "../../utils/utils.js";
|
|
11
10
|
import { PickersLayout } from "../../../PickersLayout/index.js";
|
|
12
11
|
import { PickerProvider } from "../../components/PickerProvider.js";
|
|
12
|
+
import { PickerFieldUIContextProvider } from "../../components/PickerFieldUI.js";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Hook managing all the single-date mobile pickers:
|
|
@@ -20,8 +20,7 @@ import { PickerProvider } from "../../components/PickerProvider.js";
|
|
|
20
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
21
|
export const useMobilePicker = _ref => {
|
|
22
22
|
let {
|
|
23
|
-
props
|
|
24
|
-
getOpenDialogAriaText
|
|
23
|
+
props
|
|
25
24
|
} = _ref,
|
|
26
25
|
pickerParams = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
27
26
|
const {
|
|
@@ -29,17 +28,11 @@ export const useMobilePicker = _ref => {
|
|
|
29
28
|
slotProps: innerSlotProps,
|
|
30
29
|
className,
|
|
31
30
|
sx,
|
|
32
|
-
format,
|
|
33
|
-
formatDensity,
|
|
34
|
-
enableAccessibleFieldDOMStructure,
|
|
35
|
-
selectedSections,
|
|
36
|
-
onSelectedSectionsChange,
|
|
37
|
-
timezone,
|
|
38
31
|
name,
|
|
39
32
|
label,
|
|
40
33
|
inputRef,
|
|
41
34
|
readOnly,
|
|
42
|
-
|
|
35
|
+
autoFocus,
|
|
43
36
|
localeText
|
|
44
37
|
} = props;
|
|
45
38
|
const fieldRef = React.useRef(null);
|
|
@@ -48,7 +41,6 @@ export const useMobilePicker = _ref => {
|
|
|
48
41
|
const {
|
|
49
42
|
providerProps,
|
|
50
43
|
renderCurrentView,
|
|
51
|
-
fieldProps: pickerFieldProps,
|
|
52
44
|
ownerState
|
|
53
45
|
} = usePicker(_extends({}, pickerParams, {
|
|
54
46
|
props,
|
|
@@ -63,44 +55,21 @@ export const useMobilePicker = _ref => {
|
|
|
63
55
|
externalSlotProps: innerSlotProps?.field,
|
|
64
56
|
additionalProps: _extends({
|
|
65
57
|
// Internal props
|
|
66
|
-
readOnly
|
|
67
|
-
|
|
68
|
-
format,
|
|
69
|
-
formatDensity,
|
|
70
|
-
enableAccessibleFieldDOMStructure,
|
|
71
|
-
selectedSections,
|
|
72
|
-
onSelectedSectionsChange,
|
|
73
|
-
timezone
|
|
74
|
-
}, pickerFieldProps, {
|
|
75
|
-
// onChange and value
|
|
76
|
-
|
|
58
|
+
readOnly,
|
|
59
|
+
autoFocus: autoFocus && !props.open,
|
|
77
60
|
// Forwarded props
|
|
78
61
|
className,
|
|
79
62
|
sx,
|
|
80
63
|
label,
|
|
81
|
-
name
|
|
64
|
+
name,
|
|
65
|
+
focused: providerProps.contextValue.open ? true : undefined
|
|
82
66
|
}, isToolbarHidden && {
|
|
83
67
|
id: labelId
|
|
84
|
-
}, !(disabled || readOnly) && {
|
|
85
|
-
// These direct access to `providerProps` will go away in https://github.com/mui/mui-x/pull/15671
|
|
86
|
-
onClick: event => {
|
|
87
|
-
event.preventDefault();
|
|
88
|
-
providerProps.contextValue.setOpen(true);
|
|
89
|
-
},
|
|
90
|
-
onKeyDown: onSpaceOrEnter(() => providerProps.contextValue.setOpen(true))
|
|
91
68
|
}, !!inputRef && {
|
|
92
69
|
inputRef
|
|
93
70
|
}),
|
|
94
71
|
ownerState
|
|
95
72
|
});
|
|
96
|
-
|
|
97
|
-
// TODO: Move to `useSlotProps` when https://github.com/mui/material-ui/pull/35088 will be merged
|
|
98
|
-
fieldProps.inputProps = _extends({}, fieldProps.inputProps, {
|
|
99
|
-
'aria-label': getOpenDialogAriaText(pickerFieldProps.value)
|
|
100
|
-
});
|
|
101
|
-
const slotsForField = _extends({
|
|
102
|
-
textField: slots.textField
|
|
103
|
-
}, fieldProps.slots);
|
|
104
73
|
const Layout = slots.layout ?? PickersLayout;
|
|
105
74
|
let labelledById = labelId;
|
|
106
75
|
if (isToolbarHidden) {
|
|
@@ -119,20 +88,22 @@ export const useMobilePicker = _ref => {
|
|
|
119
88
|
}, innerSlotProps?.mobilePaper)
|
|
120
89
|
});
|
|
121
90
|
const handleFieldRef = useForkRef(fieldRef, fieldProps.unstableFieldRef);
|
|
122
|
-
const renderPicker = () => /*#__PURE__*/
|
|
123
|
-
children:
|
|
124
|
-
slots: slotsForField,
|
|
125
|
-
slotProps: slotProps,
|
|
126
|
-
unstableFieldRef: handleFieldRef
|
|
127
|
-
})), /*#__PURE__*/_jsx(PickersModalDialog, {
|
|
91
|
+
const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
|
|
92
|
+
children: /*#__PURE__*/_jsxs(PickerFieldUIContextProvider, {
|
|
128
93
|
slots: slots,
|
|
129
94
|
slotProps: slotProps,
|
|
130
|
-
children: /*#__PURE__*/_jsx(
|
|
95
|
+
children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps, {
|
|
96
|
+
unstableFieldRef: handleFieldRef
|
|
97
|
+
})), /*#__PURE__*/_jsx(PickersModalDialog, {
|
|
131
98
|
slots: slots,
|
|
132
99
|
slotProps: slotProps,
|
|
133
|
-
children:
|
|
134
|
-
|
|
135
|
-
|
|
100
|
+
children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
|
|
101
|
+
slots: slots,
|
|
102
|
+
slotProps: slotProps,
|
|
103
|
+
children: renderCurrentView()
|
|
104
|
+
}))
|
|
105
|
+
})]
|
|
106
|
+
})
|
|
136
107
|
}));
|
|
137
108
|
return {
|
|
138
109
|
renderPicker
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { PickerContext } from "../../hooks/usePickerContext.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the context passed by the picker that wraps the current component.
|
|
8
|
+
* If the context is not found, returns `null`.
|
|
9
|
+
*/
|
|
10
|
+
export const useNullablePickerContext = () => React.useContext(PickerContext);
|
|
@@ -40,11 +40,8 @@ export const usePicker = ({
|
|
|
40
40
|
paramsFromUsePickerViews: pickerViewsResponse.provider
|
|
41
41
|
});
|
|
42
42
|
return {
|
|
43
|
-
// Picker value
|
|
44
|
-
fieldProps: pickerValueResponse.fieldProps,
|
|
45
43
|
// Picker views
|
|
46
44
|
renderCurrentView: pickerViewsResponse.renderCurrentView,
|
|
47
|
-
hasUIView: pickerViewsResponse.provider.hasUIView,
|
|
48
45
|
shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
|
|
49
46
|
// Picker provider
|
|
50
47
|
providerProps,
|
|
@@ -45,6 +45,7 @@ export function usePickerProvider(parameters) {
|
|
|
45
45
|
} = parameters;
|
|
46
46
|
const utils = useUtils();
|
|
47
47
|
const orientation = usePickerOrientation(paramsFromUsePickerViews.views, props.orientation);
|
|
48
|
+
const triggerRef = React.useRef(null);
|
|
48
49
|
const ownerState = React.useMemo(() => ({
|
|
49
50
|
isPickerValueEmpty: valueManager.areValuesEqual(utils, paramsFromUsePickerValue.value, valueManager.emptyValue),
|
|
50
51
|
isPickerOpen: paramsFromUsePickerValue.contextValue.open,
|
|
@@ -53,21 +54,40 @@ export function usePickerProvider(parameters) {
|
|
|
53
54
|
pickerOrientation: orientation,
|
|
54
55
|
pickerVariant: variant
|
|
55
56
|
}), [utils, valueManager, paramsFromUsePickerValue.value, paramsFromUsePickerValue.contextValue.open, orientation, variant, props.disabled, props.readOnly]);
|
|
57
|
+
const triggerStatus = React.useMemo(() => {
|
|
58
|
+
if (props.disableOpenPicker || !paramsFromUsePickerViews.hasUIView) {
|
|
59
|
+
return 'hidden';
|
|
60
|
+
}
|
|
61
|
+
if (props.disabled || props.readOnly) {
|
|
62
|
+
return 'disabled';
|
|
63
|
+
}
|
|
64
|
+
return 'enabled';
|
|
65
|
+
}, [props.disableOpenPicker, paramsFromUsePickerViews.hasUIView, props.disabled, props.readOnly]);
|
|
56
66
|
const contextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.contextValue, paramsFromUsePickerViews.contextValue, {
|
|
57
67
|
disabled: props.disabled ?? false,
|
|
58
68
|
readOnly: props.readOnly ?? false,
|
|
59
69
|
variant,
|
|
60
|
-
orientation
|
|
61
|
-
|
|
70
|
+
orientation,
|
|
71
|
+
triggerRef,
|
|
72
|
+
triggerStatus,
|
|
73
|
+
fieldFormat: props.format ?? ''
|
|
74
|
+
}), [paramsFromUsePickerValue.contextValue, paramsFromUsePickerViews.contextValue, variant, orientation, props.disabled, props.readOnly, triggerRef, triggerStatus, props.format]);
|
|
62
75
|
const privateContextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.privateContextValue, {
|
|
63
76
|
ownerState
|
|
64
77
|
}), [paramsFromUsePickerValue, ownerState]);
|
|
65
78
|
const actionsContextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.actionsContextValue, paramsFromUsePickerViews.actionsContextValue), [paramsFromUsePickerValue.actionsContextValue, paramsFromUsePickerViews.actionsContextValue]);
|
|
79
|
+
const fieldPrivateContextValue = React.useMemo(() => ({
|
|
80
|
+
formatDensity: props.formatDensity,
|
|
81
|
+
enableAccessibleFieldDOMStructure: props.enableAccessibleFieldDOMStructure,
|
|
82
|
+
selectedSections: props.selectedSections,
|
|
83
|
+
onSelectedSectionsChange: props.onSelectedSectionsChange
|
|
84
|
+
}), [props.formatDensity, props.enableAccessibleFieldDOMStructure, props.selectedSections, props.onSelectedSectionsChange]);
|
|
66
85
|
return {
|
|
67
86
|
localeText,
|
|
68
87
|
contextValue,
|
|
69
88
|
privateContextValue,
|
|
70
89
|
actionsContextValue,
|
|
90
|
+
fieldPrivateContextValue,
|
|
71
91
|
isValidContextValue: paramsFromUsePickerValue.isValidContextValue
|
|
72
92
|
};
|
|
73
93
|
}
|
|
@@ -176,12 +176,6 @@ export const usePickerValue = ({
|
|
|
176
176
|
skipPublicationIfPristine: true
|
|
177
177
|
});
|
|
178
178
|
});
|
|
179
|
-
const fieldResponse = {
|
|
180
|
-
value: dateState.draft,
|
|
181
|
-
onChange: (newValue, context) => setValue(newValue, {
|
|
182
|
-
validationError: context.validationError
|
|
183
|
-
})
|
|
184
|
-
};
|
|
185
179
|
const setValueFromView = useEventCallback((newValue, selectionState = 'partial') => {
|
|
186
180
|
// TODO: Expose a new method (private?) like `setView` that only updates the draft value.
|
|
187
181
|
if (selectionState === 'shallow') {
|
|
@@ -210,21 +204,21 @@ export const usePickerValue = ({
|
|
|
210
204
|
cancelValueChanges
|
|
211
205
|
}), [setValue, setOpen, clearValue, setValueToToday, acceptValueChanges, cancelValueChanges]);
|
|
212
206
|
const contextValue = React.useMemo(() => _extends({}, actionsContextValue, {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
207
|
+
value: dateState.draft,
|
|
208
|
+
timezone,
|
|
209
|
+
open
|
|
210
|
+
}), [actionsContextValue, timezone, open, dateState.draft]);
|
|
216
211
|
const privateContextValue = React.useMemo(() => ({
|
|
217
212
|
dismissViews
|
|
218
213
|
}), [dismissViews]);
|
|
219
214
|
const providerParams = {
|
|
220
|
-
value:
|
|
215
|
+
value: dateState.draft,
|
|
221
216
|
contextValue,
|
|
222
217
|
actionsContextValue,
|
|
223
218
|
privateContextValue,
|
|
224
219
|
isValidContextValue: isValid
|
|
225
220
|
};
|
|
226
221
|
return {
|
|
227
|
-
fieldProps: fieldResponse,
|
|
228
222
|
viewProps: viewResponse,
|
|
229
223
|
provider: providerParams
|
|
230
224
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { PickersArrowSwitcher } from "./components/PickersArrowSwitcher/PickersArrowSwitcher.js";
|
|
2
|
+
export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps } from "./components/PickerFieldUI.js";
|
|
2
3
|
export { PickerProvider } from "./components/PickerProvider.js";
|
|
3
4
|
export { PickersModalDialog } from "./components/PickersModalDialog.js";
|
|
4
5
|
export { PickersPopper } from "./components/PickersPopper.js";
|
|
@@ -20,7 +21,6 @@ export { useToolbarOwnerState } from "./hooks/useToolbarOwnerState.js";
|
|
|
20
21
|
export { useLocalizationContext, useDefaultDates, useUtils, useNow } from "./hooks/useUtils.js";
|
|
21
22
|
export { useViews } from "./hooks/useViews.js";
|
|
22
23
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from "./hooks/date-helpers-hooks.js";
|
|
23
|
-
export { convertFieldResponseIntoMuiTextFieldProps } from "./utils/convertFieldResponseIntoMuiTextFieldProps.js";
|
|
24
24
|
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem } from "./utils/date-utils.js";
|
|
25
25
|
export { resolveTimeViewsResponse, resolveDateTimeFormat } from "./utils/date-time-utils.js";
|
|
26
26
|
export { getDefaultReferenceDate } from "./utils/getDefaultReferenceDate.js";
|
|
@@ -9,17 +9,4 @@ export const getPickersLocalization = pickersTranslations => {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
};
|
|
13
|
-
export const buildGetOpenDialogAriaText = params => {
|
|
14
|
-
const {
|
|
15
|
-
utils,
|
|
16
|
-
formatKey,
|
|
17
|
-
contextTranslation,
|
|
18
|
-
propsTranslation
|
|
19
|
-
} = params;
|
|
20
|
-
return value => {
|
|
21
|
-
const formattedValue = utils.isValid(value) ? utils.format(value, formatKey) : null;
|
|
22
|
-
const translation = propsTranslation ?? contextTranslation;
|
|
23
|
-
return translation(formattedValue);
|
|
24
|
-
};
|
|
25
12
|
};
|
|
@@ -23,7 +23,15 @@ export function useDateManager(parameters = {}) {
|
|
|
23
23
|
defaultDates,
|
|
24
24
|
utils,
|
|
25
25
|
internalProps
|
|
26
|
-
}))
|
|
26
|
+
})),
|
|
27
|
+
internal_getOpenPickerButtonAriaLabel: ({
|
|
28
|
+
value,
|
|
29
|
+
utils,
|
|
30
|
+
localeText
|
|
31
|
+
}) => {
|
|
32
|
+
const formattedValue = utils.isValid(value) ? utils.format(value, 'fullDate') : null;
|
|
33
|
+
return localeText.openDatePickerDialogue(formattedValue);
|
|
34
|
+
}
|
|
27
35
|
}), [enableAccessibleFieldDOMStructure]);
|
|
28
36
|
}
|
|
29
37
|
|
|
@@ -23,7 +23,15 @@ export function useDateTimeManager(parameters = {}) {
|
|
|
23
23
|
internalProps,
|
|
24
24
|
utils,
|
|
25
25
|
defaultDates
|
|
26
|
-
}))
|
|
26
|
+
})),
|
|
27
|
+
internal_getOpenPickerButtonAriaLabel: ({
|
|
28
|
+
value,
|
|
29
|
+
utils,
|
|
30
|
+
localeText
|
|
31
|
+
}) => {
|
|
32
|
+
const formattedValue = utils.isValid(value) ? utils.format(value, 'fullDate') : null;
|
|
33
|
+
return localeText.openDatePickerDialogue(formattedValue);
|
|
34
|
+
}
|
|
27
35
|
}), [enableAccessibleFieldDOMStructure]);
|
|
28
36
|
}
|
|
29
37
|
|