@mui/x-date-pickers 8.0.0-alpha.6 → 8.0.0-alpha.8
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/AdapterDateFns/AdapterDateFns.d.ts +2 -4
- package/AdapterDateFns/AdapterDateFns.js +49 -47
- package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +1 -1
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +2 -4
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +48 -46
- package/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.d.ts → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts} +2 -2
- package/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +45 -52
- package/AdapterDateFnsJalaliV2/index.d.ts +1 -0
- package/AdapterDateFnsJalaliV2/index.js +1 -0
- package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/package.json +1 -1
- package/{AdapterDateFnsV3/AdapterDateFnsV3.d.ts → AdapterDateFnsV2/AdapterDateFnsV2.d.ts} +2 -2
- package/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js} +46 -54
- package/AdapterDateFnsV2/index.d.ts +1 -0
- package/AdapterDateFnsV2/index.js +1 -0
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/package.json +1 -1
- package/AdapterDayjs/AdapterDayjs.d.ts +1 -1
- package/AdapterLuxon/AdapterLuxon.d.ts +1 -1
- package/AdapterMoment/AdapterMoment.d.ts +1 -1
- package/CHANGELOG.md +242 -1
- package/DateCalendar/DateCalendar.js +1 -1
- package/DateCalendar/PickersFadeTransitionGroup.d.ts +1 -1
- package/DateCalendar/PickersSlideTransition.d.ts +1 -1
- 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 +14 -11
- package/DatePicker/DatePicker.js +1 -1
- package/DatePicker/DatePicker.types.d.ts +5 -0
- package/DatePicker/DatePickerToolbar.d.ts +1 -2
- package/DatePicker/DatePickerToolbar.js +7 -11
- package/DatePicker/shared.d.ts +1 -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 +14 -11
- package/DateTimePicker/DateTimePicker.js +2 -2
- package/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/DateTimePicker/DateTimePickerToolbar.d.ts +6 -2
- package/DateTimePicker/DateTimePickerToolbar.js +36 -31
- package/DateTimePicker/shared.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +9 -14
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +5 -0
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +14 -22
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
- package/DesktopTimePicker/DesktopTimePicker.js +4 -19
- package/MobileDatePicker/MobileDatePicker.js +2 -11
- package/MobileDateTimePicker/MobileDateTimePicker.js +2 -11
- package/MobileTimePicker/MobileTimePicker.js +2 -11
- package/PickersActionBar/PickersActionBar.d.ts +6 -3
- package/PickersActionBar/PickersActionBar.js +6 -3
- package/PickersLayout/PickersLayout.js +1 -5
- package/PickersLayout/PickersLayout.types.d.ts +2 -3
- package/PickersLayout/usePickerLayout.js +12 -31
- package/PickersShortcuts/PickersShortcuts.d.ts +2 -5
- package/PickersShortcuts/PickersShortcuts.js +13 -10
- package/PickersShortcuts/index.d.ts +1 -1
- package/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
- package/PickersTextField/PickersTextField.js +1 -1
- 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 +14 -11
- package/TimePicker/TimePicker.js +2 -2
- package/TimePicker/TimePickerToolbar.d.ts +1 -2
- package/TimePicker/TimePickerToolbar.js +20 -18
- package/TimePicker/shared.d.ts +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- package/hooks/useIsValidValue.d.ts +7 -0
- package/hooks/useIsValidValue.js +11 -0
- package/hooks/useParsedFormat.d.ts +8 -6
- package/hooks/useParsedFormat.js +10 -12
- package/hooks/usePickerActionsContext.d.ts +3 -1
- package/hooks/usePickerActionsContext.js +0 -1
- package/hooks/usePickerContext.d.ts +5 -3
- package/hooks/usePickerContext.js +3 -2
- package/hooks/useSplitFieldProps.d.ts +12 -3
- package/hooks/useSplitFieldProps.js +8 -3
- package/index.d.ts +1 -0
- package/index.js +3 -2
- package/internals/components/PickerFieldUI.d.ts +132 -0
- package/internals/components/PickerFieldUI.js +306 -0
- package/internals/components/PickerProvider.d.ts +34 -12
- package/internals/components/PickerProvider.js +14 -4
- package/internals/components/PickersToolbar.d.ts +2 -3
- package/internals/components/PickersToolbar.js +1 -1
- package/internals/hooks/date-helpers-hooks.js +4 -3
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -96
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +10 -33
- package/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/internals/hooks/useField/index.d.ts +2 -0
- package/internals/hooks/useField/index.js +2 -1
- package/internals/hooks/useField/useField.js +12 -4
- package/internals/hooks/useField/useField.types.d.ts +11 -4
- package/internals/hooks/useField/useField.utils.js +2 -2
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +15 -0
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +46 -0
- package/internals/hooks/useField/useFieldState.js +2 -2
- package/internals/hooks/useField/useFieldV6TextField.js +2 -2
- package/internals/hooks/useField/useFieldV7TextField.js +3 -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 -51
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +8 -16
- package/internals/hooks/useNullablePickerContext.d.ts +5 -0
- package/internals/hooks/useNullablePickerContext.js +10 -0
- package/internals/hooks/useOpenState.js +3 -2
- package/internals/hooks/usePicker/usePicker.d.ts +1 -2
- package/internals/hooks/usePicker/usePicker.js +0 -9
- package/internals/hooks/usePicker/usePicker.types.d.ts +7 -9
- package/internals/hooks/usePicker/usePickerProvider.d.ts +12 -6
- package/internals/hooks/usePicker/usePickerProvider.js +26 -4
- package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +62 -185
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +52 -55
- package/internals/hooks/usePicker/usePickerViews.d.ts +27 -23
- package/internals/hooks/usePicker/usePickerViews.js +17 -11
- package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +2 -2
- package/internals/hooks/useUtils.d.ts +4 -3
- package/internals/hooks/useUtils.js +1 -1
- package/internals/index.d.ts +11 -6
- package/internals/index.js +6 -4
- package/internals/models/fields.d.ts +3 -16
- package/internals/models/index.d.ts +1 -0
- package/internals/models/index.js +2 -1
- package/internals/models/manager.d.ts +15 -0
- package/internals/models/manager.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +2 -14
- package/internals/models/props/toolbar.d.ts +1 -5
- package/internals/utils/date-utils.js +1 -1
- package/internals/utils/valueManagers.js +4 -4
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/nbNO.js +15 -19
- package/locales/utils/getPickersLocalization.d.ts +0 -7
- package/locales/utils/getPickersLocalization.js +0 -13
- package/locales/zhTW.d.ts +80 -0
- package/locales/zhTW.js +73 -0
- package/managers/index.d.ts +6 -0
- package/managers/index.js +3 -0
- package/managers/package.json +6 -0
- package/managers/useDateManager.d.ts +27 -0
- package/managers/useDateManager.js +55 -0
- package/managers/useDateTimeManager.d.ts +28 -0
- package/managers/useDateTimeManager.js +60 -0
- package/managers/useTimeManager.d.ts +28 -0
- package/managers/useTimeManager.js +51 -0
- package/models/adapters.d.ts +1 -1
- package/models/fields.d.ts +4 -4
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/models/manager.d.ts +87 -0
- package/models/manager.js +1 -0
- package/models/pickers.d.ts +7 -0
- package/modern/AdapterDateFns/AdapterDateFns.js +49 -47
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +48 -46
- package/modern/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +45 -52
- package/modern/AdapterDateFnsJalaliV2/index.js +1 -0
- package/modern/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js} +46 -54
- package/modern/AdapterDateFnsV2/index.js +1 -0
- package/modern/DateCalendar/DateCalendar.js +1 -1
- package/modern/DateField/DateField.js +26 -31
- package/modern/DateField/useDateField.js +14 -11
- package/modern/DatePicker/DatePicker.js +1 -1
- package/modern/DatePicker/DatePickerToolbar.js +7 -11
- package/modern/DateTimeField/DateTimeField.js +26 -31
- package/modern/DateTimeField/useDateTimeField.js +14 -11
- package/modern/DateTimePicker/DateTimePicker.js +2 -2
- package/modern/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/modern/DateTimePicker/DateTimePickerToolbar.js +36 -31
- package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -14
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +14 -22
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
- package/modern/DesktopTimePicker/DesktopTimePicker.js +4 -19
- package/modern/MobileDatePicker/MobileDatePicker.js +2 -11
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -11
- package/modern/MobileTimePicker/MobileTimePicker.js +2 -11
- package/modern/PickersActionBar/PickersActionBar.js +6 -3
- package/modern/PickersLayout/PickersLayout.js +1 -5
- package/modern/PickersLayout/usePickerLayout.js +12 -31
- package/modern/PickersShortcuts/PickersShortcuts.js +13 -10
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
- package/modern/PickersTextField/PickersTextField.js +1 -1
- package/modern/TimeField/TimeField.js +25 -30
- package/modern/TimeField/useTimeField.js +14 -11
- package/modern/TimePicker/TimePicker.js +2 -2
- package/modern/TimePicker/TimePickerToolbar.js +20 -18
- package/modern/hooks/index.js +2 -1
- package/modern/hooks/useIsValidValue.js +11 -0
- package/modern/hooks/useParsedFormat.js +10 -12
- package/modern/hooks/usePickerActionsContext.js +0 -1
- package/modern/hooks/usePickerContext.js +3 -2
- package/modern/hooks/useSplitFieldProps.js +8 -3
- package/modern/index.js +3 -2
- package/modern/internals/components/PickerFieldUI.js +306 -0
- package/modern/internals/components/PickerProvider.js +14 -4
- package/modern/internals/components/PickersToolbar.js +1 -1
- package/modern/internals/hooks/date-helpers-hooks.js +4 -3
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -96
- package/modern/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/modern/internals/hooks/useField/index.js +2 -1
- package/modern/internals/hooks/useField/useField.js +12 -4
- package/modern/internals/hooks/useField/useField.utils.js +2 -2
- package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +46 -0
- package/modern/internals/hooks/useField/useFieldState.js +2 -2
- package/modern/internals/hooks/useField/useFieldV6TextField.js +2 -2
- package/modern/internals/hooks/useField/useFieldV7TextField.js +3 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +20 -51
- package/modern/internals/hooks/useNullablePickerContext.js +10 -0
- package/modern/internals/hooks/useOpenState.js +3 -2
- package/modern/internals/hooks/usePicker/usePicker.js +0 -9
- package/modern/internals/hooks/usePicker/usePickerProvider.js +26 -4
- package/modern/internals/hooks/usePicker/usePickerValue.js +62 -185
- package/modern/internals/hooks/usePicker/usePickerViews.js +17 -11
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
- package/modern/internals/hooks/useUtils.js +1 -1
- package/modern/internals/index.js +6 -4
- package/modern/internals/models/index.js +2 -1
- package/modern/internals/models/manager.js +1 -0
- package/modern/internals/utils/date-utils.js +1 -1
- package/modern/internals/utils/valueManagers.js +4 -4
- package/modern/locales/index.js +1 -0
- package/modern/locales/nbNO.js +15 -19
- package/modern/locales/utils/getPickersLocalization.js +0 -13
- package/modern/locales/zhTW.js +73 -0
- package/modern/managers/index.js +3 -0
- package/modern/managers/useDateManager.js +55 -0
- package/modern/managers/useDateTimeManager.js +60 -0
- package/modern/managers/useTimeManager.js +51 -0
- package/modern/models/index.js +1 -0
- package/modern/models/manager.js +1 -0
- package/node/AdapterDateFns/AdapterDateFns.js +97 -97
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +97 -96
- package/node/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +94 -101
- package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/node/AdapterDateFnsV2/AdapterDateFnsV2.js +291 -0
- package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/node/DateCalendar/DateCalendar.js +1 -1
- package/node/DateField/DateField.js +26 -31
- package/node/DateField/useDateField.js +13 -10
- package/node/DatePicker/DatePicker.js +1 -1
- package/node/DatePicker/DatePickerToolbar.js +7 -11
- package/node/DateTimeField/DateTimeField.js +26 -31
- package/node/DateTimeField/useDateTimeField.js +13 -10
- package/node/DateTimePicker/DateTimePicker.js +2 -2
- package/node/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/node/DateTimePicker/DateTimePickerToolbar.js +36 -31
- package/node/DesktopDatePicker/DesktopDatePicker.js +9 -14
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +14 -22
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
- package/node/DesktopTimePicker/DesktopTimePicker.js +4 -19
- package/node/MobileDatePicker/MobileDatePicker.js +2 -11
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -11
- package/node/MobileTimePicker/MobileTimePicker.js +2 -11
- package/node/PickersActionBar/PickersActionBar.js +8 -5
- package/node/PickersLayout/PickersLayout.js +1 -5
- package/node/PickersLayout/usePickerLayout.js +16 -35
- package/node/PickersShortcuts/PickersShortcuts.js +13 -10
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
- package/node/PickersTextField/PickersTextField.js +1 -1
- package/node/TimeField/TimeField.js +25 -30
- package/node/TimeField/useTimeField.js +13 -10
- package/node/TimePicker/TimePicker.js +2 -2
- package/node/TimePicker/TimePickerToolbar.js +20 -18
- package/node/hooks/index.js +8 -1
- package/node/hooks/useIsValidValue.js +18 -0
- package/node/hooks/useParsedFormat.js +10 -12
- package/node/hooks/usePickerContext.js +5 -4
- package/node/hooks/useSplitFieldProps.js +7 -2
- package/node/index.js +13 -1
- package/node/internals/components/PickerFieldUI.js +318 -0
- package/node/internals/components/PickerProvider.js +16 -6
- package/node/internals/components/PickersToolbar.js +1 -1
- package/node/internals/hooks/date-helpers-hooks.js +4 -3
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +23 -98
- package/node/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/node/internals/hooks/useField/index.js +8 -1
- package/node/internals/hooks/useField/useField.js +11 -3
- package/node/internals/hooks/useField/useField.utils.js +2 -2
- package/node/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +55 -0
- package/node/internals/hooks/useField/useFieldState.js +2 -2
- package/node/internals/hooks/useField/useFieldV6TextField.js +2 -2
- package/node/internals/hooks/useField/useFieldV7TextField.js +3 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +20 -51
- package/node/internals/hooks/useNullablePickerContext.js +16 -0
- package/node/internals/hooks/useOpenState.js +4 -2
- package/node/internals/hooks/usePicker/usePicker.js +0 -10
- package/node/internals/hooks/usePicker/usePickerProvider.js +26 -4
- package/node/internals/hooks/usePicker/usePickerValue.js +62 -185
- package/node/internals/hooks/usePicker/usePickerViews.js +17 -12
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
- package/node/internals/hooks/useUtils.js +1 -1
- package/node/internals/index.js +45 -19
- package/node/internals/models/index.js +11 -0
- package/node/internals/models/manager.js +5 -0
- package/node/internals/utils/date-utils.js +1 -1
- package/node/internals/utils/valueManagers.js +4 -4
- package/node/locales/index.js +11 -0
- package/node/locales/nbNO.js +15 -19
- package/node/locales/utils/getPickersLocalization.js +2 -16
- package/node/locales/zhTW.js +79 -0
- package/node/managers/index.js +26 -0
- package/node/managers/useDateManager.js +63 -0
- package/node/managers/useDateTimeManager.js +68 -0
- package/node/managers/useTimeManager.js +59 -0
- package/node/models/index.js +11 -0
- package/node/models/manager.js +5 -0
- package/package.json +3 -3
- package/themeAugmentation/props.d.ts +1 -1
- package/validation/extractValidationProps.d.ts +1 -1
- package/AdapterDateFnsJalaliV3/index.d.ts +0 -1
- package/AdapterDateFnsJalaliV3/index.js +0 -1
- package/AdapterDateFnsV3/index.d.ts +0 -1
- package/AdapterDateFnsV3/index.js +0 -1
- package/internals/hooks/defaultizedFieldProps.d.ts +0 -18
- package/internals/hooks/defaultizedFieldProps.js +0 -40
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +0 -3
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -44
- package/modern/AdapterDateFnsJalaliV3/index.js +0 -1
- package/modern/AdapterDateFnsV3/index.js +0 -1
- package/modern/internals/hooks/defaultizedFieldProps.js +0 -40
- package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -44
- package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -299
- package/node/internals/hooks/defaultizedFieldProps.js +0 -50
- package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -52
|
@@ -7,19 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.TimeField = void 0;
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
11
|
var React = _interopRequireWildcard(require("react"));
|
|
13
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
-
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
15
13
|
var _styles = require("@mui/material/styles");
|
|
16
|
-
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
17
14
|
var _utils = require("@mui/utils");
|
|
18
15
|
var _useTimeField = require("./useTimeField");
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var _convertFieldResponseIntoMuiTextFieldProps = require("../internals/utils/convertFieldResponseIntoMuiTextFieldProps");
|
|
22
|
-
var _useFieldOwnerState = require("../internals/hooks/useFieldOwnerState");
|
|
16
|
+
var _PickerFieldUI = require("../internals/components/PickerFieldUI");
|
|
17
|
+
var _icons = require("../icons");
|
|
23
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
19
|
const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
|
|
25
20
|
/**
|
|
@@ -39,33 +34,21 @@ const TimeField = exports.TimeField = /*#__PURE__*/React.forwardRef(function Tim
|
|
|
39
34
|
});
|
|
40
35
|
const {
|
|
41
36
|
slots,
|
|
42
|
-
slotProps
|
|
43
|
-
InputProps,
|
|
44
|
-
inputProps
|
|
37
|
+
slotProps
|
|
45
38
|
} = themeProps,
|
|
46
39
|
other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
externalSlotProps: slotProps?.textField,
|
|
52
|
-
externalForwardedProps: other,
|
|
53
|
-
ownerState,
|
|
54
|
-
additionalProps: {
|
|
55
|
-
ref: inRef
|
|
56
|
-
}
|
|
40
|
+
const textFieldProps = (0, _PickerFieldUI.useFieldTextFieldProps)({
|
|
41
|
+
slotProps,
|
|
42
|
+
ref: inRef,
|
|
43
|
+
externalForwardedProps: other
|
|
57
44
|
});
|
|
58
|
-
|
|
59
|
-
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
60
|
-
textFieldProps.inputProps = (0, _extends2.default)({}, inputProps, textFieldProps.inputProps);
|
|
61
|
-
textFieldProps.InputProps = (0, _extends2.default)({}, InputProps, textFieldProps.InputProps);
|
|
62
45
|
const fieldResponse = (0, _useTimeField.useTimeField)(textFieldProps);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
|
|
47
|
+
slots: slots,
|
|
48
|
+
slotProps: slotProps,
|
|
49
|
+
fieldResponse: fieldResponse,
|
|
50
|
+
defaultOpenPickerIcon: _icons.ClockIcon
|
|
51
|
+
});
|
|
69
52
|
});
|
|
70
53
|
process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
71
54
|
// ----------------------------- Warning --------------------------------
|
|
@@ -88,6 +71,12 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
88
71
|
* @default false
|
|
89
72
|
*/
|
|
90
73
|
clearable: _propTypes.default.bool,
|
|
74
|
+
/**
|
|
75
|
+
* The position at which the clear button is placed.
|
|
76
|
+
* If the field is not clearable, the button is not rendered.
|
|
77
|
+
* @default 'end'
|
|
78
|
+
*/
|
|
79
|
+
clearButtonPosition: _propTypes.default.oneOf(['end', 'start']),
|
|
91
80
|
/**
|
|
92
81
|
* The color of the component.
|
|
93
82
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -241,6 +230,12 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
241
230
|
* @param {FieldSelectedSections} newValue The new selected sections.
|
|
242
231
|
*/
|
|
243
232
|
onSelectedSectionsChange: _propTypes.default.func,
|
|
233
|
+
/**
|
|
234
|
+
* The position at which the opening button is placed.
|
|
235
|
+
* If there is no picker to open, the button is not rendered
|
|
236
|
+
* @default 'end'
|
|
237
|
+
*/
|
|
238
|
+
openPickerButtonPosition: _propTypes.default.oneOf(['end', 'start']),
|
|
244
239
|
/**
|
|
245
240
|
* If `true`, the component is read-only.
|
|
246
241
|
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
@@ -5,24 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.useTimeField = void 0;
|
|
8
|
-
var _valueManagers = require("../internals/utils/valueManagers");
|
|
9
8
|
var _useField = require("../internals/hooks/useField");
|
|
10
|
-
var _validation = require("../validation");
|
|
11
9
|
var _hooks = require("../hooks");
|
|
12
|
-
var
|
|
13
|
-
const useTimeField =
|
|
14
|
-
const
|
|
10
|
+
var _managers = require("../managers");
|
|
11
|
+
const useTimeField = props => {
|
|
12
|
+
const manager = (0, _managers.useTimeManager)(props);
|
|
15
13
|
const {
|
|
16
14
|
forwardedProps,
|
|
17
15
|
internalProps
|
|
18
16
|
} = (0, _hooks.useSplitFieldProps)(props, 'time');
|
|
17
|
+
const internalPropsWithDefaults = (0, _useField.useFieldInternalPropsWithDefaults)({
|
|
18
|
+
manager,
|
|
19
|
+
internalProps
|
|
20
|
+
});
|
|
19
21
|
return (0, _useField.useField)({
|
|
20
22
|
forwardedProps,
|
|
21
|
-
internalProps,
|
|
22
|
-
valueManager:
|
|
23
|
-
fieldValueManager:
|
|
24
|
-
validator:
|
|
25
|
-
valueType:
|
|
23
|
+
internalProps: internalPropsWithDefaults,
|
|
24
|
+
valueManager: manager.internal_valueManager,
|
|
25
|
+
fieldValueManager: manager.internal_fieldValueManager,
|
|
26
|
+
validator: manager.validator,
|
|
27
|
+
valueType: manager.valueType,
|
|
28
|
+
getOpenPickerButtonAriaLabel: manager.internal_getOpenPickerButtonAriaLabel
|
|
26
29
|
});
|
|
27
30
|
};
|
|
28
31
|
exports.useTimeField = useTimeField;
|
|
@@ -76,8 +76,8 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
76
76
|
autoFocus: _propTypes.default.bool,
|
|
77
77
|
className: _propTypes.default.string,
|
|
78
78
|
/**
|
|
79
|
-
* If `true`, the
|
|
80
|
-
* @default
|
|
79
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
80
|
+
* @default false
|
|
81
81
|
*/
|
|
82
82
|
closeOnSelect: _propTypes.default.bool,
|
|
83
83
|
/**
|
|
@@ -26,7 +26,7 @@ var _dateUtils = require("../internals/utils/date-utils");
|
|
|
26
26
|
var _hooks = require("../hooks");
|
|
27
27
|
var _useToolbarOwnerState = require("../internals/hooks/useToolbarOwnerState");
|
|
28
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
-
const _excluded = ["ampm", "ampmInClock", "
|
|
29
|
+
const _excluded = ["ampm", "ampmInClock", "className", "classes"];
|
|
30
30
|
const useUtilityClasses = (classes, ownerState) => {
|
|
31
31
|
const {
|
|
32
32
|
pickerOrientation,
|
|
@@ -129,9 +129,6 @@ function TimePickerToolbar(inProps) {
|
|
|
129
129
|
const {
|
|
130
130
|
ampm,
|
|
131
131
|
ampmInClock,
|
|
132
|
-
value,
|
|
133
|
-
isLandscape,
|
|
134
|
-
onChange,
|
|
135
132
|
className,
|
|
136
133
|
classes: classesProp
|
|
137
134
|
} = props,
|
|
@@ -141,18 +138,27 @@ function TimePickerToolbar(inProps) {
|
|
|
141
138
|
const ownerState = (0, _useToolbarOwnerState.useToolbarOwnerState)();
|
|
142
139
|
const classes = useUtilityClasses(classesProp, ownerState);
|
|
143
140
|
const {
|
|
141
|
+
value,
|
|
142
|
+
setValue,
|
|
144
143
|
disabled,
|
|
145
144
|
readOnly,
|
|
146
145
|
view,
|
|
147
|
-
|
|
146
|
+
setView,
|
|
148
147
|
views
|
|
149
148
|
} = (0, _hooks.usePickerContext)();
|
|
150
149
|
const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes('hours'));
|
|
151
150
|
const {
|
|
152
151
|
meridiemMode,
|
|
153
152
|
handleMeridiemChange
|
|
154
|
-
} = (0, _dateHelpersHooks.useMeridiemMode)(value, ampm,
|
|
155
|
-
|
|
153
|
+
} = (0, _dateHelpersHooks.useMeridiemMode)(value, ampm, newValue => setValue(newValue, {
|
|
154
|
+
changeImportance: 'set'
|
|
155
|
+
}));
|
|
156
|
+
const formatSection = format => {
|
|
157
|
+
if (!utils.isValid(value)) {
|
|
158
|
+
return '--';
|
|
159
|
+
}
|
|
160
|
+
return utils.format(value, format);
|
|
161
|
+
};
|
|
156
162
|
const separator = /*#__PURE__*/(0, _jsxRuntime.jsx)(TimePickerToolbarSeparator, {
|
|
157
163
|
tabIndex: -1,
|
|
158
164
|
value: ":",
|
|
@@ -163,7 +169,6 @@ function TimePickerToolbar(inProps) {
|
|
|
163
169
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(TimePickerToolbarRoot, (0, _extends2.default)({
|
|
164
170
|
landscapeDirection: "row",
|
|
165
171
|
toolbarTitle: translations.timePickerToolbarTitle,
|
|
166
|
-
isLandscape: isLandscape,
|
|
167
172
|
ownerState: ownerState,
|
|
168
173
|
className: (0, _clsx.default)(classes.root, className)
|
|
169
174
|
}, other, {
|
|
@@ -173,20 +178,20 @@ function TimePickerToolbar(inProps) {
|
|
|
173
178
|
children: [(0, _utils.arrayIncludes)(views, 'hours') && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersToolbarButton.PickersToolbarButton, {
|
|
174
179
|
tabIndex: -1,
|
|
175
180
|
variant: "h3",
|
|
176
|
-
onClick: () =>
|
|
181
|
+
onClick: () => setView('hours'),
|
|
177
182
|
selected: view === 'hours',
|
|
178
|
-
value:
|
|
183
|
+
value: formatSection(ampm ? 'hours12h' : 'hours24h')
|
|
179
184
|
}), (0, _utils.arrayIncludes)(views, ['hours', 'minutes']) && separator, (0, _utils.arrayIncludes)(views, 'minutes') && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersToolbarButton.PickersToolbarButton, {
|
|
180
185
|
tabIndex: -1,
|
|
181
186
|
variant: "h3",
|
|
182
|
-
onClick: () =>
|
|
187
|
+
onClick: () => setView('minutes'),
|
|
183
188
|
selected: view === 'minutes',
|
|
184
|
-
value:
|
|
189
|
+
value: formatSection('minutes')
|
|
185
190
|
}), (0, _utils.arrayIncludes)(views, ['minutes', 'seconds']) && separator, (0, _utils.arrayIncludes)(views, 'seconds') && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersToolbarButton.PickersToolbarButton, {
|
|
186
191
|
variant: "h3",
|
|
187
|
-
onClick: () =>
|
|
192
|
+
onClick: () => setView('seconds'),
|
|
188
193
|
selected: view === 'seconds',
|
|
189
|
-
value:
|
|
194
|
+
value: formatSection('seconds')
|
|
190
195
|
})]
|
|
191
196
|
}), showAmPmControl && /*#__PURE__*/(0, _jsxRuntime.jsxs)(TimePickerToolbarAmPmSelection, {
|
|
192
197
|
className: classes.ampmSelection,
|
|
@@ -228,8 +233,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
|
|
228
233
|
* @default `true` for Desktop, `false` for Mobile.
|
|
229
234
|
*/
|
|
230
235
|
hidden: _propTypes.default.bool,
|
|
231
|
-
isLandscape: _propTypes.default.bool.isRequired,
|
|
232
|
-
onChange: _propTypes.default.func.isRequired,
|
|
233
236
|
/**
|
|
234
237
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
235
238
|
*/
|
|
@@ -243,6 +246,5 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
|
|
243
246
|
* Toolbar value placeholder—it is displayed when the value is empty.
|
|
244
247
|
* @default "––"
|
|
245
248
|
*/
|
|
246
|
-
toolbarPlaceholder: _propTypes.default.node
|
|
247
|
-
value: _propTypes.default.object
|
|
249
|
+
toolbarPlaceholder: _propTypes.default.node
|
|
248
250
|
} : void 0;
|
package/node/hooks/index.js
CHANGED
|
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "useClearableField", {
|
|
|
9
9
|
return _useClearableField.useClearableField;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "useIsValidValue", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _useIsValidValue.useIsValidValue;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(exports, "useParsedFormat", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
get: function () {
|
|
@@ -44,4 +50,5 @@ var _usePickerTranslations = require("./usePickerTranslations");
|
|
|
44
50
|
var _useSplitFieldProps = require("./useSplitFieldProps");
|
|
45
51
|
var _useParsedFormat = require("./useParsedFormat");
|
|
46
52
|
var _usePickerContext = require("./usePickerContext");
|
|
47
|
-
var _usePickerActionsContext = require("./usePickerActionsContext");
|
|
53
|
+
var _usePickerActionsContext = require("./usePickerActionsContext");
|
|
54
|
+
var _useIsValidValue = require("./useIsValidValue");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.IsValidValueContext = void 0;
|
|
9
|
+
exports.useIsValidValue = useIsValidValue;
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
const IsValidValueContext = exports.IsValidValueContext = /*#__PURE__*/React.createContext(() => true);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns a function to check if a value is valid according to the validation props passed to the parent picker.
|
|
15
|
+
*/
|
|
16
|
+
function useIsValidValue() {
|
|
17
|
+
return React.useContext(IsValidValueContext);
|
|
18
|
+
}
|
|
@@ -12,32 +12,30 @@ var _useUtils = require("../internals/hooks/useUtils");
|
|
|
12
12
|
var _buildSectionsFromFormat = require("../internals/hooks/useField/buildSectionsFromFormat");
|
|
13
13
|
var _useField = require("../internals/hooks/useField/useField.utils");
|
|
14
14
|
var _usePickerTranslations = require("./usePickerTranslations");
|
|
15
|
+
var _useNullablePickerContext = require("../internals/hooks/useNullablePickerContext");
|
|
15
16
|
/**
|
|
16
17
|
* Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
|
|
17
18
|
* This format is localized (for example `AAAA` for the year with the French locale) and cannot be parsed by your date library.
|
|
18
19
|
* @param {object} The parameters needed to build the placeholder.
|
|
19
|
-
* @param {string} params.format Format
|
|
20
|
-
* @param {'dense' | 'spacious'} params.formatDensity Density of the format (setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character).
|
|
21
|
-
* @param {boolean} params.shouldRespectLeadingZeros If `true`, the format will respect the leading zeroes, if `false`, the format will always add leading zeroes.
|
|
20
|
+
* @param {string} params.format Format to parse.
|
|
22
21
|
* @returns
|
|
23
22
|
*/
|
|
24
|
-
const useParsedFormat = parameters => {
|
|
25
|
-
const
|
|
26
|
-
format,
|
|
27
|
-
formatDensity = 'dense',
|
|
28
|
-
shouldRespectLeadingZeros = false
|
|
29
|
-
} = parameters;
|
|
23
|
+
const useParsedFormat = (parameters = {}) => {
|
|
24
|
+
const pickerContext = (0, _useNullablePickerContext.useNullablePickerContext)();
|
|
30
25
|
const utils = (0, _useUtils.useUtils)();
|
|
31
26
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
32
27
|
const translations = (0, _usePickerTranslations.usePickerTranslations)();
|
|
33
28
|
const localizedDigits = React.useMemo(() => (0, _useField.getLocalizedDigits)(utils), [utils]);
|
|
29
|
+
const {
|
|
30
|
+
format = pickerContext?.fieldFormat ?? utils.formats.fullDate
|
|
31
|
+
} = parameters;
|
|
34
32
|
return React.useMemo(() => {
|
|
35
33
|
const sections = (0, _buildSectionsFromFormat.buildSectionsFromFormat)({
|
|
36
34
|
utils,
|
|
37
35
|
format,
|
|
38
|
-
formatDensity,
|
|
36
|
+
formatDensity: 'dense',
|
|
39
37
|
isRtl,
|
|
40
|
-
shouldRespectLeadingZeros,
|
|
38
|
+
shouldRespectLeadingZeros: true,
|
|
41
39
|
localeText: translations,
|
|
42
40
|
localizedDigits,
|
|
43
41
|
date: null,
|
|
@@ -45,6 +43,6 @@ const useParsedFormat = parameters => {
|
|
|
45
43
|
enableAccessibleFieldDOMStructure: false
|
|
46
44
|
});
|
|
47
45
|
return sections.map(section => `${section.startSeparator}${section.placeholder}${section.endSeparator}`).join('');
|
|
48
|
-
}, [utils, isRtl, translations, localizedDigits, format
|
|
46
|
+
}, [utils, isRtl, translations, localizedDigits, format]);
|
|
49
47
|
};
|
|
50
48
|
exports.useParsedFormat = useParsedFormat;
|
|
@@ -5,16 +5,17 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.usePickerContext = void 0;
|
|
8
|
+
exports.usePickerContext = exports.PickerContext = void 0;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
|
|
10
|
+
const PickerContext = exports.PickerContext = /*#__PURE__*/React.createContext(null);
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* Returns the context passed by the picker that wraps the current component.
|
|
13
14
|
*/
|
|
14
15
|
const usePickerContext = () => {
|
|
15
|
-
const value = React.useContext(
|
|
16
|
+
const value = React.useContext(PickerContext);
|
|
16
17
|
if (value == null) {
|
|
17
|
-
throw new Error(
|
|
18
|
+
throw new Error('MUI X: The `usePickerContext` hook can only be called inside the context of a picker component');
|
|
18
19
|
}
|
|
19
20
|
return value;
|
|
20
21
|
};
|
|
@@ -10,13 +10,13 @@ exports.useSplitFieldProps = void 0;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _extractValidationProps = require("../validation/extractValidationProps");
|
|
13
|
-
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator'];
|
|
13
|
+
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'unstableStartFieldRef', 'unstableEndFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator', 'autoFocus'];
|
|
14
14
|
/**
|
|
15
15
|
* Split the props received by the field component into:
|
|
16
16
|
* - `internalProps` which are used by the various hooks called by the field component.
|
|
17
17
|
* - `forwardedProps` which are passed to the underlying component.
|
|
18
18
|
* Note that some forwarded props might be used by the hooks as well.
|
|
19
|
-
* For instance, hooks like `useDateField` need props like `
|
|
19
|
+
* For instance, hooks like `useDateField` need props like `onKeyDown` to merge the default event handler and the one provided by the application.
|
|
20
20
|
* @template TProps, TValueType
|
|
21
21
|
* @param {TProps} props The props received by the field component.
|
|
22
22
|
* @param {TValueType} valueType The type of the field value ('date', 'time', or 'date-time').
|
|
@@ -48,4 +48,9 @@ const useSplitFieldProps = (props, valueType) => {
|
|
|
48
48
|
};
|
|
49
49
|
}, [props, valueType]);
|
|
50
50
|
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Extract the internal props from the props received by the field component.
|
|
54
|
+
* This makes sure that the internal props not defined in the props are not present in the result.
|
|
55
|
+
*/
|
|
51
56
|
exports.useSplitFieldProps = useSplitFieldProps;
|
package/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers v8.0.0-alpha.
|
|
2
|
+
* @mui/x-date-pickers v8.0.0-alpha.8
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -463,4 +463,16 @@ Object.keys(_validation).forEach(function (key) {
|
|
|
463
463
|
return _validation[key];
|
|
464
464
|
}
|
|
465
465
|
});
|
|
466
|
+
});
|
|
467
|
+
var _managers = require("./managers");
|
|
468
|
+
Object.keys(_managers).forEach(function (key) {
|
|
469
|
+
if (key === "default" || key === "__esModule") return;
|
|
470
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
471
|
+
if (key in exports && exports[key] === _managers[key]) return;
|
|
472
|
+
Object.defineProperty(exports, key, {
|
|
473
|
+
enumerable: true,
|
|
474
|
+
get: function () {
|
|
475
|
+
return _managers[key];
|
|
476
|
+
}
|
|
477
|
+
});
|
|
466
478
|
});
|