@mui/x-date-pickers 8.0.0-alpha.0 → 8.0.0-alpha.2
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/AdapterMoment/AdapterMoment.js +10 -0
- package/CHANGELOG.md +651 -6
- package/DateCalendar/DateCalendar.js +1 -0
- package/DateCalendar/DateCalendar.types.d.ts +2 -1
- package/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/DateCalendar/PickersSlideTransition.js +12 -5
- package/DateCalendar/useCalendarState.d.ts +6 -4
- package/DateField/DateField.js +5 -4
- package/DateField/DateField.types.d.ts +10 -9
- package/DatePicker/DatePicker.types.d.ts +3 -3
- package/DatePicker/DatePickerToolbar.d.ts +3 -2
- package/DatePicker/DatePickerToolbar.js +0 -12
- package/DatePicker/shared.d.ts +6 -5
- package/DateTimeField/DateTimeField.js +5 -4
- package/DateTimeField/DateTimeField.types.d.ts +10 -10
- package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
- package/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/DateTimePicker/DateTimePickerToolbar.d.ts +3 -4
- package/DateTimePicker/DateTimePickerToolbar.js +6 -15
- package/DateTimePicker/shared.d.ts +6 -6
- package/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +2 -1
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -33
- package/DigitalClock/DigitalClock.js +1 -0
- package/MonthCalendar/MonthCalendar.js +1 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +6 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +4 -4
- package/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -4
- package/PickersLayout/PickersLayout.d.ts +7 -5
- package/PickersLayout/PickersLayout.js +22 -39
- package/PickersLayout/PickersLayout.types.d.ts +14 -15
- package/PickersLayout/usePickerLayout.d.ts +5 -4
- package/PickersLayout/usePickerLayout.js +20 -17
- package/PickersShortcuts/PickersShortcuts.d.ts +7 -6
- package/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/PickersTextField/PickersTextField.js +2 -2
- package/README.md +9 -6
- package/TimeClock/Clock.js +1 -0
- package/TimeClock/TimeClock.js +1 -0
- package/TimeField/TimeField.js +5 -4
- package/TimeField/TimeField.types.d.ts +10 -10
- package/TimePicker/TimePicker.types.d.ts +3 -3
- package/TimePicker/TimePickerToolbar.d.ts +2 -3
- package/TimePicker/TimePickerToolbar.js +6 -15
- package/TimePicker/shared.d.ts +6 -6
- package/YearCalendar/YearCalendar.js +1 -0
- package/hooks/useParsedFormat.d.ts +2 -2
- package/hooks/useParsedFormat.js +1 -1
- package/hooks/useSplitFieldProps.d.ts +3 -3
- package/index.js +1 -1
- package/internals/components/PickerProvider.d.ts +26 -0
- package/internals/components/PickerProvider.js +3 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +11 -8
- package/internals/components/PickersToolbar.d.ts +3 -3
- package/internals/components/PickersToolbar.js +2 -4
- package/internals/hooks/useClockReferenceDate.d.ts +2 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -14
- package/internals/hooks/useField/useField.d.ts +3 -3
- package/internals/hooks/useField/useField.types.d.ts +46 -46
- package/internals/hooks/useField/useField.utils.d.ts +4 -3
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +6 -5
- package/internals/hooks/useField/useFieldState.d.ts +9 -8
- package/internals/hooks/useField/useFieldState.js +1 -1
- package/internals/hooks/useField/useFieldV6TextField.d.ts +4 -3
- package/internals/hooks/useField/useFieldV7TextField.js +2 -1
- package/internals/hooks/useFieldOwnerState.d.ts +6 -0
- package/internals/hooks/useFieldOwnerState.js +12 -0
- package/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +11 -11
- package/internals/hooks/usePicker/usePicker.d.ts +3 -3
- package/internals/hooks/usePicker/usePicker.js +10 -19
- package/internals/hooks/usePicker/usePicker.types.d.ts +8 -8
- package/internals/hooks/usePicker/usePickerProvider.d.ts +21 -6
- package/internals/hooks/usePicker/usePickerProvider.js +61 -5
- package/internals/hooks/usePicker/usePickerValue.d.ts +3 -2
- package/internals/hooks/usePicker/usePickerValue.js +18 -7
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +32 -30
- package/internals/hooks/usePicker/usePickerViews.d.ts +11 -10
- package/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -6
- package/internals/hooks/useValueWithTimezone.d.ts +20 -15
- package/internals/hooks/useValueWithTimezone.js +13 -1
- package/internals/hooks/useViews.d.ts +5 -5
- package/internals/index.d.ts +5 -3
- package/internals/index.js +1 -0
- package/internals/models/common.d.ts +2 -1
- package/internals/models/fields.d.ts +6 -1
- package/internals/models/pickers.d.ts +1 -0
- package/internals/models/pickers.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +4 -3
- package/internals/models/props/time.d.ts +2 -1
- package/internals/models/props/toolbar.d.ts +2 -2
- package/internals/models/value.d.ts +9 -0
- package/internals/utils/date-utils.d.ts +3 -3
- package/internals/utils/valueManagers.d.ts +4 -3
- package/locales/nlNL.js +7 -7
- package/models/adapters.d.ts +4 -4
- package/models/common.d.ts +1 -0
- package/models/fields.d.ts +19 -6
- package/models/pickers.d.ts +18 -0
- package/models/validation.d.ts +2 -1
- package/modern/AdapterMoment/AdapterMoment.js +10 -0
- package/modern/DateCalendar/DateCalendar.js +1 -0
- package/modern/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/modern/DateCalendar/PickersSlideTransition.js +12 -5
- package/modern/DateField/DateField.js +5 -4
- package/modern/DatePicker/DatePickerToolbar.js +0 -12
- package/modern/DateTimeField/DateTimeField.js +5 -4
- package/modern/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/modern/DateTimePicker/DateTimePickerToolbar.js +6 -15
- package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -33
- package/modern/DigitalClock/DigitalClock.js +1 -0
- package/modern/MonthCalendar/MonthCalendar.js +1 -0
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/modern/PickersLayout/PickersLayout.js +22 -39
- package/modern/PickersLayout/usePickerLayout.js +20 -17
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/modern/PickersTextField/PickersTextField.js +2 -2
- package/modern/TimeClock/Clock.js +1 -0
- package/modern/TimeClock/TimeClock.js +1 -0
- package/modern/TimeField/TimeField.js +5 -4
- package/modern/TimePicker/TimePickerToolbar.js +6 -15
- package/modern/YearCalendar/YearCalendar.js +1 -0
- package/modern/hooks/useParsedFormat.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerProvider.js +3 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/modern/internals/components/PickersToolbar.js +2 -4
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
- package/modern/internals/hooks/useField/useFieldState.js +1 -1
- package/modern/internals/hooks/useField/useFieldV7TextField.js +2 -1
- package/modern/internals/hooks/useFieldOwnerState.js +12 -0
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
- package/modern/internals/hooks/usePicker/usePicker.js +10 -19
- package/modern/internals/hooks/usePicker/usePickerProvider.js +61 -5
- package/modern/internals/hooks/usePicker/usePickerValue.js +18 -7
- package/modern/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
- package/modern/internals/hooks/useValueWithTimezone.js +13 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/models/pickers.js +1 -0
- package/modern/locales/nlNL.js +7 -7
- package/modern/validation/useValidation.js +1 -1
- package/modern/validation/validateDate.js +8 -0
- package/modern/validation/validateDateTime.js +8 -0
- package/modern/validation/validateTime.js +8 -0
- package/node/AdapterMoment/AdapterMoment.js +10 -0
- package/node/DateCalendar/DateCalendar.js +1 -0
- package/node/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/node/DateCalendar/PickersSlideTransition.js +12 -5
- package/node/DateField/DateField.js +5 -4
- package/node/DatePicker/DatePickerToolbar.js +0 -12
- package/node/DateTimeField/DateTimeField.js +5 -4
- package/node/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/node/DateTimePicker/DateTimePickerToolbar.js +6 -15
- package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -34
- package/node/DigitalClock/DigitalClock.js +1 -0
- package/node/MonthCalendar/MonthCalendar.js +1 -0
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/node/PickersLayout/PickersLayout.js +22 -39
- package/node/PickersLayout/usePickerLayout.js +20 -17
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/node/PickersTextField/PickersTextField.js +2 -2
- package/node/TimeClock/Clock.js +1 -0
- package/node/TimeClock/TimeClock.js +1 -0
- package/node/TimeField/TimeField.js +5 -4
- package/node/TimePicker/TimePickerToolbar.js +6 -15
- package/node/YearCalendar/YearCalendar.js +1 -0
- package/node/hooks/useParsedFormat.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickerProvider.js +3 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/node/internals/components/PickersToolbar.js +2 -4
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
- package/node/internals/hooks/useField/useFieldState.js +1 -1
- package/node/internals/hooks/useField/useFieldV7TextField.js +2 -1
- package/node/internals/hooks/useFieldOwnerState.js +20 -0
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
- package/node/internals/hooks/usePicker/usePicker.js +11 -19
- package/node/internals/hooks/usePicker/usePickerProvider.js +64 -5
- package/node/internals/hooks/usePicker/usePickerValue.js +18 -6
- package/node/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
- package/node/internals/hooks/useValueWithTimezone.js +13 -1
- package/node/internals/index.js +7 -0
- package/node/internals/models/pickers.js +5 -0
- package/node/locales/nlNL.js +7 -7
- package/node/validation/useValidation.js +1 -1
- package/node/validation/validateDate.js +8 -0
- package/node/validation/validateDateTime.js +8 -0
- package/node/validation/validateTime.js +8 -0
- package/package.json +4 -4
- package/themeAugmentation/overrides.d.ts +1 -1
- package/themeAugmentation/props.d.ts +3 -2
- package/validation/useValidation.d.ts +7 -6
- package/validation/useValidation.js +1 -1
- package/validation/validateDate.d.ts +12 -3
- package/validation/validateDate.js +8 -0
- package/validation/validateDateTime.d.ts +12 -4
- package/validation/validateDateTime.js +8 -0
- package/validation/validateTime.d.ts +12 -3
- package/validation/validateTime.js +8 -0
- package/internals/hooks/useIsLandscape.d.ts +0 -4
- package/internals/hooks/useIsLandscape.js +0 -35
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +0 -33
- package/internals/hooks/usePicker/usePickerLayoutProps.js +0 -34
- package/internals/hooks/usePicker/usePickerOwnerState.d.ts +0 -10
- package/internals/hooks/usePicker/usePickerOwnerState.js +0 -16
- package/modern/internals/hooks/useIsLandscape.js +0 -35
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +0 -34
- package/modern/internals/hooks/usePicker/usePickerOwnerState.js +0 -16
- package/node/internals/hooks/useIsLandscape.js +0 -43
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +0 -41
- package/node/internals/hooks/usePicker/usePickerOwnerState.js +0 -23
|
@@ -13,6 +13,7 @@ import { useTimeField } from "./useTimeField.js";
|
|
|
13
13
|
import { useClearableField } from "../hooks/index.js";
|
|
14
14
|
import { PickersTextField } from "../PickersTextField/index.js";
|
|
15
15
|
import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
|
|
16
|
+
import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
/**
|
|
18
19
|
* Demos:
|
|
@@ -36,7 +37,7 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, inRe
|
|
|
36
37
|
inputProps
|
|
37
38
|
} = themeProps,
|
|
38
39
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
39
|
-
const ownerState = themeProps;
|
|
40
|
+
const ownerState = useFieldOwnerState(themeProps);
|
|
40
41
|
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
|
|
41
42
|
const textFieldProps = useSlotProps({
|
|
42
43
|
elementType: TextField,
|
|
@@ -268,10 +269,10 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
268
269
|
*/
|
|
269
270
|
shouldDisableTime: PropTypes.func,
|
|
270
271
|
/**
|
|
271
|
-
* If `true`, the format will respect the leading zeroes (
|
|
272
|
-
* If `false`, the format will always add leading zeroes (
|
|
272
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
273
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
273
274
|
*
|
|
274
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
275
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
275
276
|
*
|
|
276
277
|
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
277
278
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "view", "onViewChange", "views", "
|
|
5
|
+
const _excluded = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "view", "onViewChange", "views", "className"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -18,6 +18,7 @@ import { useUtils } from "../internals/hooks/useUtils.js";
|
|
|
18
18
|
import { useMeridiemMode } from "../internals/hooks/date-helpers-hooks.js";
|
|
19
19
|
import { getTimePickerToolbarUtilityClass, timePickerToolbarClasses } from "./timePickerToolbarClasses.js";
|
|
20
20
|
import { formatMeridiem } from "../internals/utils/date-utils.js";
|
|
21
|
+
import { usePickerContext } from "../hooks/index.js";
|
|
21
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
23
|
const useUtilityClasses = ownerState => {
|
|
23
24
|
const {
|
|
@@ -128,14 +129,16 @@ function TimePickerToolbar(inProps) {
|
|
|
128
129
|
view,
|
|
129
130
|
onViewChange,
|
|
130
131
|
views,
|
|
131
|
-
disabled,
|
|
132
|
-
readOnly,
|
|
133
132
|
className
|
|
134
133
|
} = props,
|
|
135
134
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
136
135
|
const utils = useUtils();
|
|
137
136
|
const translations = usePickerTranslations();
|
|
138
137
|
const isRtl = useRtl();
|
|
138
|
+
const {
|
|
139
|
+
disabled,
|
|
140
|
+
readOnly
|
|
141
|
+
} = usePickerContext();
|
|
139
142
|
const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes('hours'));
|
|
140
143
|
const {
|
|
141
144
|
meridiemMode,
|
|
@@ -216,12 +219,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
|
|
216
219
|
*/
|
|
217
220
|
classes: PropTypes.object,
|
|
218
221
|
className: PropTypes.string,
|
|
219
|
-
/**
|
|
220
|
-
* If `true`, the component is disabled.
|
|
221
|
-
* When disabled, the value cannot be changed and no interaction is possible.
|
|
222
|
-
* @default false
|
|
223
|
-
*/
|
|
224
|
-
disabled: PropTypes.bool,
|
|
225
222
|
/**
|
|
226
223
|
* If `true`, show the toolbar even in desktop mode.
|
|
227
224
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -235,12 +232,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
|
|
235
232
|
* @param {TView} view The view to open
|
|
236
233
|
*/
|
|
237
234
|
onViewChange: PropTypes.func.isRequired,
|
|
238
|
-
/**
|
|
239
|
-
* If `true`, the component is read-only.
|
|
240
|
-
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
241
|
-
* @default false
|
|
242
|
-
*/
|
|
243
|
-
readOnly: PropTypes.bool,
|
|
244
235
|
/**
|
|
245
236
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
246
237
|
*/
|
|
@@ -8,7 +8,7 @@ import { getLocalizedDigits } from "../internals/hooks/useField/useField.utils.j
|
|
|
8
8
|
import { usePickerTranslations } from "./usePickerTranslations.js";
|
|
9
9
|
/**
|
|
10
10
|
* Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
|
|
11
|
-
* This format is localized (
|
|
11
|
+
* This format is localized (for example `AAAA` for the year with the French locale) and cannot be parsed by your date library.
|
|
12
12
|
* @param {object} The parameters needed to build the placeholder.
|
|
13
13
|
* @param {string} params.format Format of the date to use.
|
|
14
14
|
* @param {'dense' | 'spacious'} params.formatDensity Density of the format (setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character).
|
package/modern/index.js
CHANGED
|
@@ -7,7 +7,9 @@ export const PickerPrivateContext = /*#__PURE__*/React.createContext({
|
|
|
7
7
|
isPickerDisabled: false,
|
|
8
8
|
isPickerReadOnly: false,
|
|
9
9
|
isPickerValueEmpty: false,
|
|
10
|
-
isPickerOpen: false
|
|
10
|
+
isPickerOpen: false,
|
|
11
|
+
pickerVariant: 'desktop',
|
|
12
|
+
pickerOrientation: 'portrait'
|
|
11
13
|
}
|
|
12
14
|
});
|
|
13
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["children", "className", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel", "labelId"],
|
|
3
|
+
const _excluded = ["children", "className", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel", "labelId", "classes"],
|
|
4
4
|
_excluded2 = ["ownerState"],
|
|
5
5
|
_excluded3 = ["ownerState"];
|
|
6
6
|
import * as React from 'react';
|
|
@@ -13,6 +13,7 @@ import useSlotProps from '@mui/utils/useSlotProps';
|
|
|
13
13
|
import IconButton from '@mui/material/IconButton';
|
|
14
14
|
import { ArrowLeftIcon, ArrowRightIcon } from "../../../icons/index.js";
|
|
15
15
|
import { getPickersArrowSwitcherUtilityClass } from "./pickersArrowSwitcherClasses.js";
|
|
16
|
+
import { usePickerPrivateContext } from "../../hooks/usePickerPrivateContext.js";
|
|
16
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
const PickersArrowSwitcherRoot = styled('div', {
|
|
18
19
|
name: 'MuiPickersArrowSwitcher',
|
|
@@ -44,10 +45,7 @@ const PickersArrowSwitcherButton = styled(IconButton, {
|
|
|
44
45
|
}
|
|
45
46
|
}]
|
|
46
47
|
});
|
|
47
|
-
const useUtilityClasses =
|
|
48
|
-
const {
|
|
49
|
-
classes
|
|
50
|
-
} = ownerState;
|
|
48
|
+
const useUtilityClasses = classes => {
|
|
51
49
|
const slots = {
|
|
52
50
|
root: ['root'],
|
|
53
51
|
spacer: ['spacer'],
|
|
@@ -78,11 +76,14 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
78
76
|
isPreviousHidden,
|
|
79
77
|
onGoToPrevious,
|
|
80
78
|
previousLabel,
|
|
81
|
-
labelId
|
|
79
|
+
labelId,
|
|
80
|
+
classes: classesProp
|
|
82
81
|
} = props,
|
|
83
82
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
84
|
-
const
|
|
85
|
-
|
|
83
|
+
const {
|
|
84
|
+
ownerState
|
|
85
|
+
} = usePickerPrivateContext();
|
|
86
|
+
const classes = useUtilityClasses(classesProp);
|
|
86
87
|
const nextProps = {
|
|
87
88
|
isDisabled: isNextDisabled,
|
|
88
89
|
isHidden: isNextHidden,
|
|
@@ -108,7 +109,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
108
109
|
onClick: previousProps.goTo
|
|
109
110
|
},
|
|
110
111
|
ownerState: _extends({}, ownerState, {
|
|
111
|
-
hidden: previousProps.isHidden
|
|
112
|
+
hidden: previousProps.isHidden ?? false
|
|
112
113
|
}),
|
|
113
114
|
className: clsx(classes.button, classes.previousIconButton)
|
|
114
115
|
});
|
|
@@ -125,7 +126,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
125
126
|
onClick: nextProps.goTo
|
|
126
127
|
},
|
|
127
128
|
ownerState: _extends({}, ownerState, {
|
|
128
|
-
hidden: nextProps.isHidden
|
|
129
|
+
hidden: nextProps.isHidden ?? false
|
|
129
130
|
}),
|
|
130
131
|
className: clsx(classes.button, classes.nextIconButton)
|
|
131
132
|
});
|
|
@@ -10,13 +10,11 @@ import { getPickersToolbarUtilityClass } from "./pickersToolbarClasses.js";
|
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
const useUtilityClasses = ownerState => {
|
|
12
12
|
const {
|
|
13
|
-
classes
|
|
14
|
-
isLandscape
|
|
13
|
+
classes
|
|
15
14
|
} = ownerState;
|
|
16
15
|
const slots = {
|
|
17
16
|
root: ['root'],
|
|
18
|
-
content: ['content']
|
|
19
|
-
penIconButton: ['penIconButton', isLandscape && 'penIconButtonLandscape']
|
|
17
|
+
content: ['content']
|
|
20
18
|
};
|
|
21
19
|
return composeClasses(slots, getPickersToolbarUtilityClass, classes);
|
|
22
20
|
};
|
|
@@ -67,7 +67,7 @@ export const useDesktopPicker = _ref => {
|
|
|
67
67
|
localeText,
|
|
68
68
|
autoFocusView: true,
|
|
69
69
|
additionalViewProps: {},
|
|
70
|
-
|
|
70
|
+
variant: 'desktop'
|
|
71
71
|
}));
|
|
72
72
|
const InputAdornment = slots.inputAdornment ?? MuiInputAdornment;
|
|
73
73
|
const _useSlotProps = useSlotProps({
|
|
@@ -41,6 +41,7 @@ export const useFieldState = params => {
|
|
|
41
41
|
timezone: timezoneProp,
|
|
42
42
|
value: valueProp,
|
|
43
43
|
defaultValue,
|
|
44
|
+
referenceDate: referenceDateProp,
|
|
44
45
|
onChange,
|
|
45
46
|
valueManager
|
|
46
47
|
});
|
|
@@ -63,7 +64,6 @@ export const useFieldState = params => {
|
|
|
63
64
|
const stateWithoutReferenceDate = {
|
|
64
65
|
sections,
|
|
65
66
|
value: valueFromTheOutside,
|
|
66
|
-
referenceValue: valueManager.emptyValue,
|
|
67
67
|
tempValueStrAndroid: null
|
|
68
68
|
};
|
|
69
69
|
const granularity = getSectionTypeGranularity(sections);
|
|
@@ -198,8 +198,9 @@ export const useFieldV7TextField = params => {
|
|
|
198
198
|
if (focused || !sectionListRef.current) {
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
+
const activeElement = getActiveElement(document);
|
|
201
202
|
setFocused(true);
|
|
202
|
-
const isFocusInsideASection = sectionListRef.current.getSectionIndexFromDOMElement(
|
|
203
|
+
const isFocusInsideASection = sectionListRef.current.getSectionIndexFromDOMElement(activeElement) != null;
|
|
203
204
|
if (!isFocusInsideASection) {
|
|
204
205
|
setSelectedSections(sectionOrder.startIndex);
|
|
205
206
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { usePickerPrivateContext } from "./usePickerPrivateContext.js";
|
|
4
|
+
export function useFieldOwnerState(parameters) {
|
|
5
|
+
const {
|
|
6
|
+
ownerState: pickerOwnerState
|
|
7
|
+
} = usePickerPrivateContext();
|
|
8
|
+
return React.useMemo(() => _extends({}, pickerOwnerState, {
|
|
9
|
+
isFieldDisabled: parameters.disabled ?? false,
|
|
10
|
+
isFieldReadOnly: parameters.readOnly ?? false
|
|
11
|
+
}), [pickerOwnerState, parameters.disabled, parameters.readOnly]);
|
|
12
|
+
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
2
3
|
import { usePickerValue } from "./usePickerValue.js";
|
|
3
4
|
import { usePickerViews } from "./usePickerViews.js";
|
|
4
|
-
import { usePickerLayoutProps } from "./usePickerLayoutProps.js";
|
|
5
|
-
import { usePickerOwnerState } from "./usePickerOwnerState.js";
|
|
6
5
|
import { usePickerProvider } from "./usePickerProvider.js";
|
|
7
6
|
export const usePicker = ({
|
|
8
7
|
props,
|
|
9
8
|
valueManager,
|
|
10
9
|
valueType,
|
|
11
|
-
|
|
10
|
+
variant,
|
|
12
11
|
additionalViewProps,
|
|
13
12
|
validator,
|
|
14
13
|
autoFocusView,
|
|
@@ -25,7 +24,7 @@ export const usePicker = ({
|
|
|
25
24
|
props,
|
|
26
25
|
valueManager,
|
|
27
26
|
valueType,
|
|
28
|
-
|
|
27
|
+
variant,
|
|
29
28
|
validator
|
|
30
29
|
});
|
|
31
30
|
const pickerViewsResponse = usePickerViews({
|
|
@@ -36,21 +35,13 @@ export const usePicker = ({
|
|
|
36
35
|
propsFromPickerValue: pickerValueResponse.viewProps,
|
|
37
36
|
rendererInterceptor
|
|
38
37
|
});
|
|
39
|
-
const pickerLayoutResponse = usePickerLayoutProps({
|
|
40
|
-
props,
|
|
41
|
-
wrapperVariant,
|
|
42
|
-
propsFromPickerValue: pickerValueResponse.layoutProps,
|
|
43
|
-
propsFromPickerViews: pickerViewsResponse.layoutProps
|
|
44
|
-
});
|
|
45
|
-
const pickerOwnerState = usePickerOwnerState({
|
|
46
|
-
props,
|
|
47
|
-
pickerValueResponse,
|
|
48
|
-
valueManager
|
|
49
|
-
});
|
|
50
38
|
const providerProps = usePickerProvider({
|
|
39
|
+
props,
|
|
51
40
|
pickerValueResponse,
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
localeText,
|
|
42
|
+
valueManager,
|
|
43
|
+
variant,
|
|
44
|
+
views: pickerViewsResponse.views
|
|
54
45
|
});
|
|
55
46
|
return {
|
|
56
47
|
// Picker value
|
|
@@ -62,10 +53,10 @@ export const usePicker = ({
|
|
|
62
53
|
hasUIView: pickerViewsResponse.hasUIView,
|
|
63
54
|
shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
|
|
64
55
|
// Picker layout
|
|
65
|
-
layoutProps:
|
|
56
|
+
layoutProps: _extends({}, pickerViewsResponse.layoutProps, pickerValueResponse.layoutProps),
|
|
66
57
|
// Picker provider
|
|
67
58
|
providerProps,
|
|
68
59
|
// Picker owner state
|
|
69
|
-
ownerState:
|
|
60
|
+
ownerState: providerProps.privateContextValue.ownerState
|
|
70
61
|
};
|
|
71
62
|
};
|
|
@@ -1,15 +1,66 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
3
|
+
import { useUtils } from "../useUtils.js";
|
|
4
|
+
import { arrayIncludes } from "../../utils/utils.js";
|
|
5
|
+
function getOrientation() {
|
|
6
|
+
if (typeof window === 'undefined') {
|
|
7
|
+
return 'portrait';
|
|
8
|
+
}
|
|
9
|
+
if (window.screen && window.screen.orientation && window.screen.orientation.angle) {
|
|
10
|
+
return Math.abs(window.screen.orientation.angle) === 90 ? 'landscape' : 'portrait';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Support IOS safari
|
|
14
|
+
if (window.orientation) {
|
|
15
|
+
return Math.abs(Number(window.orientation)) === 90 ? 'landscape' : 'portrait';
|
|
16
|
+
}
|
|
17
|
+
return 'portrait';
|
|
18
|
+
}
|
|
19
|
+
export const usePickerOrientation = (views, customOrientation) => {
|
|
20
|
+
const [orientation, setOrientation] = React.useState(getOrientation);
|
|
21
|
+
useEnhancedEffect(() => {
|
|
22
|
+
const eventHandler = () => {
|
|
23
|
+
setOrientation(getOrientation());
|
|
24
|
+
};
|
|
25
|
+
window.addEventListener('orientationchange', eventHandler);
|
|
26
|
+
return () => {
|
|
27
|
+
window.removeEventListener('orientationchange', eventHandler);
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
if (arrayIncludes(views, ['hours', 'minutes', 'seconds'])) {
|
|
31
|
+
// could not display 13:34:44 in landscape mode
|
|
32
|
+
return 'portrait';
|
|
33
|
+
}
|
|
34
|
+
return customOrientation ?? orientation;
|
|
35
|
+
};
|
|
2
36
|
export function usePickerProvider(parameters) {
|
|
3
37
|
const {
|
|
38
|
+
props,
|
|
4
39
|
pickerValueResponse,
|
|
5
|
-
|
|
6
|
-
localeText
|
|
40
|
+
valueManager,
|
|
41
|
+
localeText,
|
|
42
|
+
variant,
|
|
43
|
+
views
|
|
7
44
|
} = parameters;
|
|
45
|
+
const utils = useUtils();
|
|
46
|
+
const orientation = usePickerOrientation(views, props.orientation);
|
|
47
|
+
const ownerState = React.useMemo(() => ({
|
|
48
|
+
isPickerValueEmpty: valueManager.areValuesEqual(utils, pickerValueResponse.viewProps.value, valueManager.emptyValue),
|
|
49
|
+
isPickerOpen: pickerValueResponse.open,
|
|
50
|
+
isPickerDisabled: props.disabled ?? false,
|
|
51
|
+
isPickerReadOnly: props.readOnly ?? false,
|
|
52
|
+
pickerOrientation: orientation,
|
|
53
|
+
pickerVariant: variant
|
|
54
|
+
}), [utils, valueManager, pickerValueResponse.viewProps.value, pickerValueResponse.open, orientation, variant, props.disabled, props.readOnly]);
|
|
8
55
|
const contextValue = React.useMemo(() => ({
|
|
9
56
|
onOpen: pickerValueResponse.actions.onOpen,
|
|
10
57
|
onClose: pickerValueResponse.actions.onClose,
|
|
11
|
-
open: pickerValueResponse.open
|
|
12
|
-
|
|
58
|
+
open: pickerValueResponse.open,
|
|
59
|
+
disabled: props.disabled ?? false,
|
|
60
|
+
readOnly: props.readOnly ?? false,
|
|
61
|
+
variant,
|
|
62
|
+
orientation
|
|
63
|
+
}), [pickerValueResponse.actions.onOpen, pickerValueResponse.actions.onClose, pickerValueResponse.open, variant, orientation, props.disabled, props.readOnly]);
|
|
13
64
|
const privateContextValue = React.useMemo(() => ({
|
|
14
65
|
ownerState
|
|
15
66
|
}), [ownerState]);
|
|
@@ -18,4 +69,9 @@ export function usePickerProvider(parameters) {
|
|
|
18
69
|
contextValue,
|
|
19
70
|
privateContextValue
|
|
20
71
|
};
|
|
21
|
-
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Props used to create the private context.
|
|
76
|
+
* Those props are exposed on all the pickers.
|
|
77
|
+
*/
|
|
@@ -5,7 +5,6 @@ import { useOpenState } from "../useOpenState.js";
|
|
|
5
5
|
import { useLocalizationContext, useUtils } from "../useUtils.js";
|
|
6
6
|
import { useValidation } from "../../../validation/index.js";
|
|
7
7
|
import { useValueWithTimezone } from "../useValueWithTimezone.js";
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* Decide if the new value should be published
|
|
11
10
|
* The published value will be passed to `onChange` if defined.
|
|
@@ -113,7 +112,7 @@ export const usePickerValue = ({
|
|
|
113
112
|
props,
|
|
114
113
|
valueManager,
|
|
115
114
|
valueType,
|
|
116
|
-
|
|
115
|
+
variant,
|
|
117
116
|
validator
|
|
118
117
|
}) => {
|
|
119
118
|
const {
|
|
@@ -121,8 +120,9 @@ export const usePickerValue = ({
|
|
|
121
120
|
onChange,
|
|
122
121
|
value: inValueWithoutRenderTimezone,
|
|
123
122
|
defaultValue: inDefaultValue,
|
|
124
|
-
closeOnSelect =
|
|
125
|
-
timezone: timezoneProp
|
|
123
|
+
closeOnSelect = variant === 'desktop',
|
|
124
|
+
timezone: timezoneProp,
|
|
125
|
+
referenceDate
|
|
126
126
|
} = props;
|
|
127
127
|
const {
|
|
128
128
|
current: defaultValue
|
|
@@ -130,6 +130,7 @@ export const usePickerValue = ({
|
|
|
130
130
|
const {
|
|
131
131
|
current: isControlled
|
|
132
132
|
} = React.useRef(inValueWithoutRenderTimezone !== undefined);
|
|
133
|
+
const [previousTimezoneProp, setPreviousTimezoneProp] = React.useState(timezoneProp);
|
|
133
134
|
|
|
134
135
|
/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
|
|
135
136
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -160,6 +161,7 @@ export const usePickerValue = ({
|
|
|
160
161
|
timezone: timezoneProp,
|
|
161
162
|
value: inValueWithoutRenderTimezone,
|
|
162
163
|
defaultValue,
|
|
164
|
+
referenceDate,
|
|
163
165
|
onChange,
|
|
164
166
|
valueManager
|
|
165
167
|
});
|
|
@@ -176,10 +178,19 @@ export const usePickerValue = ({
|
|
|
176
178
|
draft: initialValue,
|
|
177
179
|
lastPublishedValue: initialValue,
|
|
178
180
|
lastCommittedValue: initialValue,
|
|
179
|
-
lastControlledValue:
|
|
181
|
+
lastControlledValue: inValueWithoutRenderTimezone,
|
|
180
182
|
hasBeenModifiedSinceMount: false
|
|
181
183
|
};
|
|
182
184
|
});
|
|
185
|
+
const timezoneFromDraftValue = valueManager.getTimezone(utils, dateState.draft);
|
|
186
|
+
if (previousTimezoneProp !== timezoneProp) {
|
|
187
|
+
setPreviousTimezoneProp(timezoneProp);
|
|
188
|
+
if (timezoneProp && timezoneFromDraftValue && timezoneProp !== timezoneFromDraftValue) {
|
|
189
|
+
setDateState(prev => _extends({}, prev, {
|
|
190
|
+
draft: valueManager.setTimezone(utils, timezoneProp, prev.draft)
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
183
194
|
const {
|
|
184
195
|
getValidationErrorForNewValue
|
|
185
196
|
} = useValidation({
|
|
@@ -229,10 +240,10 @@ export const usePickerValue = ({
|
|
|
229
240
|
setIsOpen(false);
|
|
230
241
|
}
|
|
231
242
|
});
|
|
232
|
-
if (
|
|
243
|
+
if (dateState.lastControlledValue !== inValueWithoutRenderTimezone) {
|
|
233
244
|
const isUpdateComingFromPicker = valueManager.areValuesEqual(utils, dateState.draft, inValueWithTimezoneToRender);
|
|
234
245
|
setDateState(prev => _extends({}, prev, {
|
|
235
|
-
lastControlledValue:
|
|
246
|
+
lastControlledValue: inValueWithoutRenderTimezone
|
|
236
247
|
}, isUpdateComingFromPicker ? {} : {
|
|
237
248
|
lastCommittedValue: inValueWithTimezoneToRender,
|
|
238
249
|
lastPublishedValue: inValueWithTimezoneToRender,
|
|
@@ -48,7 +48,7 @@ export const useStaticPicker = _ref => {
|
|
|
48
48
|
fieldRef: undefined,
|
|
49
49
|
localeText,
|
|
50
50
|
additionalViewProps: {},
|
|
51
|
-
|
|
51
|
+
variant: displayStaticWrapperAs
|
|
52
52
|
}));
|
|
53
53
|
const Layout = slots?.layout ?? PickerStaticLayout;
|
|
54
54
|
const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
|
|
@@ -11,6 +11,7 @@ export const useValueWithTimezone = ({
|
|
|
11
11
|
timezone: timezoneProp,
|
|
12
12
|
value: valueProp,
|
|
13
13
|
defaultValue,
|
|
14
|
+
referenceDate,
|
|
14
15
|
onChange,
|
|
15
16
|
valueManager
|
|
16
17
|
}) => {
|
|
@@ -24,7 +25,16 @@ export const useValueWithTimezone = ({
|
|
|
24
25
|
}
|
|
25
26
|
return valueManager.setTimezone(utils, inputTimezone, newValue);
|
|
26
27
|
});
|
|
27
|
-
|
|
28
|
+
let timezoneToRender;
|
|
29
|
+
if (timezoneProp) {
|
|
30
|
+
timezoneToRender = timezoneProp;
|
|
31
|
+
} else if (inputTimezone) {
|
|
32
|
+
timezoneToRender = inputTimezone;
|
|
33
|
+
} else if (referenceDate) {
|
|
34
|
+
timezoneToRender = utils.getTimezone(referenceDate);
|
|
35
|
+
} else {
|
|
36
|
+
timezoneToRender = 'default';
|
|
37
|
+
}
|
|
28
38
|
const valueWithTimezoneToRender = React.useMemo(() => valueManager.setTimezone(utils, timezoneToRender, inputValue), [valueManager, utils, timezoneToRender, inputValue]);
|
|
29
39
|
const handleValueChange = useEventCallback((newValue, ...otherParams) => {
|
|
30
40
|
const newValueWithInputTimezone = setInputTimezone(newValue);
|
|
@@ -45,6 +55,7 @@ export const useControlledValueWithTimezone = ({
|
|
|
45
55
|
timezone: timezoneProp,
|
|
46
56
|
value: valueProp,
|
|
47
57
|
defaultValue,
|
|
58
|
+
referenceDate,
|
|
48
59
|
onChange: onChangeProp,
|
|
49
60
|
valueManager
|
|
50
61
|
}) => {
|
|
@@ -62,6 +73,7 @@ export const useControlledValueWithTimezone = ({
|
|
|
62
73
|
timezone: timezoneProp,
|
|
63
74
|
value: valueWithInputTimezone,
|
|
64
75
|
defaultValue: undefined,
|
|
76
|
+
referenceDate,
|
|
65
77
|
onChange,
|
|
66
78
|
valueManager
|
|
67
79
|
});
|
|
@@ -12,6 +12,7 @@ export { PickersToolbarButton } from "./components/PickersToolbarButton.js";
|
|
|
12
12
|
export { DAY_MARGIN, DIALOG_WIDTH, VIEW_HEIGHT } from "./constants/dimensions.js";
|
|
13
13
|
export { useControlledValueWithTimezone } from "./hooks/useValueWithTimezone.js";
|
|
14
14
|
export { useField, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./hooks/useField/index.js";
|
|
15
|
+
export { useFieldOwnerState } from "./hooks/useFieldOwnerState.js";
|
|
15
16
|
export { usePicker } from "./hooks/usePicker/index.js";
|
|
16
17
|
export { usePickerPrivateContext } from "./hooks/usePickerPrivateContext.js";
|
|
17
18
|
export { useStaticPicker } from "./hooks/useStaticPicker/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/modern/locales/nlNL.js
CHANGED
|
@@ -16,10 +16,10 @@ const nlNLPickers = {
|
|
|
16
16
|
// DateRange labels
|
|
17
17
|
start: 'Start',
|
|
18
18
|
end: 'Einde',
|
|
19
|
-
startDate: '
|
|
20
|
-
startTime: '
|
|
21
|
-
endDate: '
|
|
22
|
-
endTime: '
|
|
19
|
+
startDate: 'Startdatum',
|
|
20
|
+
startTime: 'Starttijd',
|
|
21
|
+
endDate: 'Einddatum',
|
|
22
|
+
endTime: 'Eindtijd',
|
|
23
23
|
// Action bar
|
|
24
24
|
cancelButtonLabel: 'Annuleren',
|
|
25
25
|
clearButtonLabel: 'Resetten',
|
|
@@ -50,11 +50,11 @@ const nlNLPickers = {
|
|
|
50
50
|
timeTableLabel: 'kies tijd',
|
|
51
51
|
dateTableLabel: 'kies datum',
|
|
52
52
|
// Field section placeholders
|
|
53
|
-
fieldYearPlaceholder: params => '
|
|
53
|
+
fieldYearPlaceholder: params => 'J'.repeat(params.digitAmount),
|
|
54
54
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
55
55
|
fieldDayPlaceholder: () => 'DD',
|
|
56
56
|
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
57
|
-
fieldHoursPlaceholder: () => '
|
|
57
|
+
fieldHoursPlaceholder: () => 'uu',
|
|
58
58
|
fieldMinutesPlaceholder: () => 'mm',
|
|
59
59
|
fieldSecondsPlaceholder: () => 'ss',
|
|
60
60
|
fieldMeridiemPlaceholder: () => 'aa',
|
|
@@ -68,6 +68,6 @@ const nlNLPickers = {
|
|
|
68
68
|
seconds: 'Seconden',
|
|
69
69
|
meridiem: 'Middag',
|
|
70
70
|
// Common
|
|
71
|
-
empty: '
|
|
71
|
+
empty: 'Leeg'
|
|
72
72
|
};
|
|
73
73
|
export const nlNL = getPickersLocalization(nlNLPickers);
|
|
@@ -5,7 +5,7 @@ import useEventCallback from '@mui/utils/useEventCallback';
|
|
|
5
5
|
import { useLocalizationContext } from "../internals/hooks/useUtils.js";
|
|
6
6
|
/**
|
|
7
7
|
* Utility hook to check if a given value is valid based on the provided validation props.
|
|
8
|
-
* @template TValue The value type. It will be
|
|
8
|
+
* @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.
|
|
9
9
|
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
10
10
|
* @param {UseValidationOptions<TValue, TError, TValidationProps>} options The options to configure the hook.
|
|
11
11
|
* @param {TValue} options.value The value to validate.
|
|
@@ -5,6 +5,14 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
|
5
5
|
* Validation props used by the Date Picker, Date Field and Date Calendar components.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Validation props as received by the validateDate method.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Name of the props that should be defaulted before being passed to the validateDate method.
|
|
14
|
+
*/
|
|
15
|
+
|
|
8
16
|
export const validateDate = ({
|
|
9
17
|
props,
|
|
10
18
|
value,
|
|
@@ -6,6 +6,14 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
|
6
6
|
* Validation props used by the Date Time Picker and Date Time Field components.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Validation props as received by the validateDateTime method.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Name of the props that should be defaulted before being passed to the validateDateTime method.
|
|
15
|
+
*/
|
|
16
|
+
|
|
9
17
|
export const validateDateTime = ({
|
|
10
18
|
adapter,
|
|
11
19
|
value,
|