@mui/x-date-pickers 8.0.0-alpha.7 → 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/CHANGELOG.md +115 -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/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 +11 -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/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 -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/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/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 +11 -19
- package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +46 -0
- package/modern/internals/hooks/useField/useFieldV7TextField.js +3 -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/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/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 +12 -21
- package/node/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +55 -0
- package/node/internals/hooks/useField/useFieldV7TextField.js +3 -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
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,121 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.0.0-alpha.8
|
|
9
|
+
|
|
10
|
+
_Jan 16, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🍬 Improved design for Data Grid [Header filters](https://next.mui.com/x/react-data-grid/filtering/header-filters/)
|
|
15
|
+
|
|
16
|
+
<img width="100%" alt="Data Grid Header filters" src="https://github.com/user-attachments/assets/74a50cd9-7a55-41fc-a2b8-f8a0d5b9120e" />
|
|
17
|
+
|
|
18
|
+
- 🔄 Data Grid [Scroll restoration](https://next.mui.com/x/react-data-grid/scrolling/#scroll-restoration)
|
|
19
|
+
- 📊 Charts support server-side rendering under [some conditions](https://next.mui.com/x/react-charts/getting-started/#server-side-rendering)
|
|
20
|
+
- 🐞 Bugfixes
|
|
21
|
+
|
|
22
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
23
|
+
@lauri865.
|
|
24
|
+
Following are all team members who have contributed to this release:
|
|
25
|
+
@arminmeh, @romgrk, @samuelsycamore, @alexfauquette, @cherniavskii, @flaviendelangle, @JCQuintas, @KenanYusuf, @LukasTy, @michelengelen.
|
|
26
|
+
|
|
27
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
28
|
+
|
|
29
|
+
### Data Grid
|
|
30
|
+
|
|
31
|
+
#### Breaking changes
|
|
32
|
+
|
|
33
|
+
- The clear button in header filter cells has been moved to the header filter menu. Use `slotProps={{ headerFilterCell: { showClearIcon: true } }}` to restore the clear button in the cell.
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-data-grid@8.0.0-alpha.8`
|
|
36
|
+
|
|
37
|
+
- [DataGrid] Improve scrollbar deadzone with overlay scrollbars (#15961) @lauri865
|
|
38
|
+
- [DataGrid] Header filter design improvements (#15991) @KenanYusuf
|
|
39
|
+
- [DataGrid] Scroll restoration (#15623) @lauri865
|
|
40
|
+
- [DataGrid] Fix row, cell and header memoizations (#15666) @lauri865
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-data-grid-pro@8.0.0-alpha.8` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
43
|
+
|
|
44
|
+
Same changes as in `@mui/x-data-grid@8.0.0-alpha.8`, plus:
|
|
45
|
+
|
|
46
|
+
- [DataGridPro] Add test for column pinning with disabled column virtualization (#16176) @cherniavskii
|
|
47
|
+
- [DataGridPro] Fix width of right-pinned column group during resize (#16199) @cherniavskii
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-data-grid-premium@8.0.0-alpha.8` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
50
|
+
|
|
51
|
+
Same changes as in `@mui/x-data-grid-pro@8.0.0-alpha.8`.
|
|
52
|
+
|
|
53
|
+
### Date and Time Pickers
|
|
54
|
+
|
|
55
|
+
#### Breaking changes
|
|
56
|
+
|
|
57
|
+
- The field is now editable if rendered inside a mobile Picker — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#field-editing-on-mobile-pickers)
|
|
58
|
+
- The `useMultiInputDateRangeField`, `useMultiInputTimeRangeField`, and `useMultiInputDateTimeRangeField` hooks have been removed in favor of the new `useMultiInputRangeField` hook — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#usemultiinputdaterangefield)
|
|
59
|
+
- The component passed to the `field` slot no longer receives the `value`, `onChange`, `timezone`, `format`, `disabled`, `formatDensity`, `enableAccessibleFieldDOMStructure`, `selectedSections` and `onSelectedSectionsChange` props — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-field)
|
|
60
|
+
|
|
61
|
+
#### `@mui/x-date-pickers@8.0.0-alpha.8`
|
|
62
|
+
|
|
63
|
+
- [pickers] Let the field components handle their opening UI, and allow field editing on mobile pickers (#15671) @flaviendelangle
|
|
64
|
+
- [pickers] Remove code duplication for the multi input range fields (#15505) @flaviendelangle
|
|
65
|
+
- [pickers] Rename `onRangePositionChange` into `setRangePosition` in `usePickerRangePositionContext` (#16189) @flaviendelangle
|
|
66
|
+
- [pickers] Use context to pass props from the picker to the field (#16042) @flaviendelangle
|
|
67
|
+
|
|
68
|
+
#### `@mui/x-date-pickers-pro@8.0.0-alpha.8` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
69
|
+
|
|
70
|
+
Same changes as in `@mui/x-date-pickers@8.0.0-alpha.8`.
|
|
71
|
+
|
|
72
|
+
### Charts
|
|
73
|
+
|
|
74
|
+
#### Breaking changes
|
|
75
|
+
|
|
76
|
+
- Charts tooltip markers now have different styles for each chart type. The tooltip and legend marks are now the same.
|
|
77
|
+
- Duplicate axis id's across `x` and `y` axis now log a warning in dev mode. Axis ids should be unique to prevent internal issues.
|
|
78
|
+
|
|
79
|
+
#### `@mui/x-charts@8.0.0-alpha.8`
|
|
80
|
+
|
|
81
|
+
- [charts] Fix flaky charts tests (#16180) @JCQuintas
|
|
82
|
+
- [charts] Handle case where gradient stop `offset` could be `Infinite` (#16131) @JCQuintas
|
|
83
|
+
- [charts] Make `useChartGradientId` public (#16106) @JCQuintas
|
|
84
|
+
- [charts] Move z-axis to plugin (#16130) @alexfauquette
|
|
85
|
+
- [charts] Plot data at first render if `skipAnimation` is set to `true` (#16166) @alexfauquette
|
|
86
|
+
- [charts] Replace tooltip mark with style (#16117) @JCQuintas
|
|
87
|
+
- [charts] Support `rtl` for gradient legend (#16115) @JCQuintas
|
|
88
|
+
- [charts] Use plugin system for series and axes (#15865) @alexfauquette
|
|
89
|
+
|
|
90
|
+
#### `@mui/x-charts-pro@8.0.0-alpha.8` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
91
|
+
|
|
92
|
+
Same changes as in `@mui/x-charts@8.0.0-alpha.8`.
|
|
93
|
+
|
|
94
|
+
### Tree View
|
|
95
|
+
|
|
96
|
+
#### `@mui/x-tree-view@8.0.0-alpha.8`
|
|
97
|
+
|
|
98
|
+
No changes since `@mui/x-tree-view-pro@v8.0.0-alpha.7`.
|
|
99
|
+
|
|
100
|
+
#### `@mui/x-tree-view-pro@8.0.0-alpha.8` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
101
|
+
|
|
102
|
+
Same changes as in `@mui/x-tree-view@8.0.0-alpha.8`.
|
|
103
|
+
|
|
104
|
+
### Docs
|
|
105
|
+
|
|
106
|
+
- [docs] Add example for custom legend (#16169) @alexfauquette
|
|
107
|
+
- [docs] Add full custom field creation example (#15194) @flaviendelangle
|
|
108
|
+
- [docs] Copyedit the Data Grid cell selection page (#16099) @samuelsycamore
|
|
109
|
+
- [docs] Fix demo rendering issue on Codesandbox (#16118) @arminmeh
|
|
110
|
+
- [docs] Remove broken links (#16167) @alexfauquette
|
|
111
|
+
- [docs] Split the Data Grid editing page (#14931) @MBilalShafi
|
|
112
|
+
- [docs] Fix wrong props warnings (#16119) @JCQuintas
|
|
113
|
+
|
|
114
|
+
### Core
|
|
115
|
+
|
|
116
|
+
- [core] Type all references as `RefObject` (#16124) @arminmeh
|
|
117
|
+
- [code-infra] Refactor `react` and `react-dom` definitions to simplify dep resolving (#16160) @LukasTy
|
|
118
|
+
- [code-infra] Stop renovate from updating `date-fns-v2` (#16158) @LukasTy
|
|
119
|
+
- [infra] Improve cherry-pick action target list (#16184) @michelengelen
|
|
120
|
+
- [test] Fix flaky column pinning unit test (#16202) @cherniavskii
|
|
121
|
+
- [test] Fix flaky screenshot (#16182) @cherniavskii
|
|
122
|
+
|
|
8
123
|
## 8.0.0-alpha.7
|
|
9
124
|
|
|
10
125
|
_Jan 9, 2025_
|
package/DateField/DateField.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["slots", "slotProps"
|
|
4
|
+
const _excluded = ["slots", "slotProps"];
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
8
|
-
import MuiTextField from '@mui/material/TextField';
|
|
9
7
|
import { useThemeProps } from '@mui/material/styles';
|
|
10
|
-
import useSlotProps from '@mui/utils/useSlotProps';
|
|
11
8
|
import { refType } from '@mui/utils';
|
|
12
9
|
import { useDateField } from "./useDateField.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
|
|
16
|
-
import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
|
|
10
|
+
import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
|
|
11
|
+
import { CalendarIcon } from "../icons/index.js";
|
|
17
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
13
|
/**
|
|
19
14
|
* Demos:
|
|
@@ -32,33 +27,21 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, inRe
|
|
|
32
27
|
});
|
|
33
28
|
const {
|
|
34
29
|
slots,
|
|
35
|
-
slotProps
|
|
36
|
-
InputProps,
|
|
37
|
-
inputProps
|
|
30
|
+
slotProps
|
|
38
31
|
} = themeProps,
|
|
39
32
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
externalSlotProps: slotProps?.textField,
|
|
45
|
-
externalForwardedProps: other,
|
|
46
|
-
additionalProps: {
|
|
47
|
-
ref: inRef
|
|
48
|
-
},
|
|
49
|
-
ownerState
|
|
33
|
+
const textFieldProps = useFieldTextFieldProps({
|
|
34
|
+
slotProps,
|
|
35
|
+
ref: inRef,
|
|
36
|
+
externalForwardedProps: other
|
|
50
37
|
});
|
|
51
|
-
|
|
52
|
-
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
53
|
-
textFieldProps.inputProps = _extends({}, inputProps, textFieldProps.inputProps);
|
|
54
|
-
textFieldProps.InputProps = _extends({}, InputProps, textFieldProps.InputProps);
|
|
55
38
|
const fieldResponse = useDateField(textFieldProps);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
return /*#__PURE__*/_jsx(PickerFieldUI, {
|
|
40
|
+
slots: slots,
|
|
41
|
+
slotProps: slotProps,
|
|
42
|
+
fieldResponse: fieldResponse,
|
|
43
|
+
defaultOpenPickerIcon: CalendarIcon
|
|
44
|
+
});
|
|
62
45
|
});
|
|
63
46
|
process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
64
47
|
// ----------------------------- Warning --------------------------------
|
|
@@ -76,6 +59,12 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
76
59
|
* @default false
|
|
77
60
|
*/
|
|
78
61
|
clearable: PropTypes.bool,
|
|
62
|
+
/**
|
|
63
|
+
* The position at which the clear button is placed.
|
|
64
|
+
* If the field is not clearable, the button is not rendered.
|
|
65
|
+
* @default 'end'
|
|
66
|
+
*/
|
|
67
|
+
clearButtonPosition: PropTypes.oneOf(['end', 'start']),
|
|
79
68
|
/**
|
|
80
69
|
* The color of the component.
|
|
81
70
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -219,6 +208,12 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
219
208
|
* @param {FieldSelectedSections} newValue The new selected sections.
|
|
220
209
|
*/
|
|
221
210
|
onSelectedSectionsChange: PropTypes.func,
|
|
211
|
+
/**
|
|
212
|
+
* The position at which the opening button is placed.
|
|
213
|
+
* If there is no picker to open, the button is not rendered
|
|
214
|
+
* @default 'end'
|
|
215
|
+
*/
|
|
216
|
+
openPickerButtonPosition: PropTypes.oneOf(['end', 'start']),
|
|
222
217
|
/**
|
|
223
218
|
* If `true`, the component is read-only.
|
|
224
219
|
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { MakeOptional, SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
4
|
-
import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '../hooks/useClearableField';
|
|
5
|
-
import { DateValidationError, BuiltInFieldTextFieldProps, FieldOwnerState } from '../models';
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
|
+
import { DateValidationError, BuiltInFieldTextFieldProps } from '../models';
|
|
6
3
|
import { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
7
4
|
import { ExportedValidateDateProps } from '../validation/validateDate';
|
|
8
|
-
import { PickersTextFieldProps } from '../PickersTextField';
|
|
9
5
|
import { PickerValue } from '../internals/models';
|
|
10
|
-
|
|
6
|
+
import { ExportedPickerFieldUIProps, PickerFieldUISlotProps, PickerFieldUISlots } from '../internals/components/PickerFieldUI';
|
|
7
|
+
export interface UseDateFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateValidationError>, 'format'>, ExportedValidateDateProps, ExportedPickerFieldUIProps {
|
|
11
8
|
}
|
|
12
9
|
export type DateFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = UseDateFieldProps<TEnableAccessibleFieldDOMStructure> & Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseDateFieldProps<TEnableAccessibleFieldDOMStructure>> & {
|
|
13
10
|
/**
|
|
@@ -22,13 +19,7 @@ export type DateFieldProps<TEnableAccessibleFieldDOMStructure extends boolean =
|
|
|
22
19
|
slotProps?: DateFieldSlotProps;
|
|
23
20
|
};
|
|
24
21
|
export type DateFieldOwnerState<TEnableAccessibleFieldDOMStructure extends boolean> = DateFieldProps<TEnableAccessibleFieldDOMStructure>;
|
|
25
|
-
export interface DateFieldSlots extends
|
|
26
|
-
/**
|
|
27
|
-
* Form control with an input to render the value.
|
|
28
|
-
* @default <PickersTextField />, or <TextField /> from '@mui/material' if `enableAccessibleFieldDOMStructure` is `false`.
|
|
29
|
-
*/
|
|
30
|
-
textField?: React.ElementType;
|
|
22
|
+
export interface DateFieldSlots extends PickerFieldUISlots {
|
|
31
23
|
}
|
|
32
|
-
export interface DateFieldSlotProps extends
|
|
33
|
-
textField?: SlotComponentPropsFromProps<PickersTextFieldProps | TextFieldProps, {}, FieldOwnerState>;
|
|
24
|
+
export interface DateFieldSlotProps extends PickerFieldUISlotProps {
|
|
34
25
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseDateFieldProps } from './DateField.types';
|
|
2
|
-
export declare const useDateField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseDateFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "onChange" | "onError" | "format" | "timezone" | keyof import("../internals").BaseDateValidationProps | "shouldDisableYear" | "shouldDisableMonth" | "shouldDisableDate" | "referenceDate" | "formatDensity" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "enableAccessibleFieldDOMStructure" | "dateSeparator">>;
|
|
2
|
+
export declare const useDateField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseDateFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "autoFocus" | "onChange" | "onError" | "format" | "timezone" | keyof import("../internals").BaseDateValidationProps | "shouldDisableYear" | "shouldDisableMonth" | "shouldDisableDate" | "referenceDate" | "formatDensity" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "unstableStartFieldRef" | "unstableEndFieldRef" | "enableAccessibleFieldDOMStructure" | "dateSeparator">>;
|
|
@@ -19,6 +19,7 @@ export const useDateField = props => {
|
|
|
19
19
|
valueManager: manager.internal_valueManager,
|
|
20
20
|
fieldValueManager: manager.internal_fieldValueManager,
|
|
21
21
|
validator: manager.validator,
|
|
22
|
-
valueType: manager.valueType
|
|
22
|
+
valueType: manager.valueType,
|
|
23
|
+
getOpenPickerButtonAriaLabel: manager.internal_getOpenPickerButtonAriaLabel
|
|
23
24
|
});
|
|
24
25
|
};
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["slots", "slotProps"
|
|
4
|
+
const _excluded = ["slots", "slotProps"];
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
8
|
-
import MuiTextField from '@mui/material/TextField';
|
|
9
7
|
import { useThemeProps } from '@mui/material/styles';
|
|
10
|
-
import useSlotProps from '@mui/utils/useSlotProps';
|
|
11
8
|
import { refType } from '@mui/utils';
|
|
12
9
|
import { useDateTimeField } from "./useDateTimeField.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
|
|
16
|
-
import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
|
|
10
|
+
import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
|
|
11
|
+
import { CalendarIcon } from "../icons/index.js";
|
|
17
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
13
|
/**
|
|
19
14
|
* Demos:
|
|
@@ -32,33 +27,21 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
|
|
|
32
27
|
});
|
|
33
28
|
const {
|
|
34
29
|
slots,
|
|
35
|
-
slotProps
|
|
36
|
-
InputProps,
|
|
37
|
-
inputProps
|
|
30
|
+
slotProps
|
|
38
31
|
} = themeProps,
|
|
39
32
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
externalSlotProps: slotProps?.textField,
|
|
45
|
-
externalForwardedProps: other,
|
|
46
|
-
ownerState,
|
|
47
|
-
additionalProps: {
|
|
48
|
-
ref: inRef
|
|
49
|
-
}
|
|
33
|
+
const textFieldProps = useFieldTextFieldProps({
|
|
34
|
+
slotProps,
|
|
35
|
+
ref: inRef,
|
|
36
|
+
externalForwardedProps: other
|
|
50
37
|
});
|
|
51
|
-
|
|
52
|
-
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
53
|
-
textFieldProps.inputProps = _extends({}, inputProps, textFieldProps.inputProps);
|
|
54
|
-
textFieldProps.InputProps = _extends({}, InputProps, textFieldProps.InputProps);
|
|
55
38
|
const fieldResponse = useDateTimeField(textFieldProps);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
return /*#__PURE__*/_jsx(PickerFieldUI, {
|
|
40
|
+
slots: slots,
|
|
41
|
+
slotProps: slotProps,
|
|
42
|
+
fieldResponse: fieldResponse,
|
|
43
|
+
defaultOpenPickerIcon: CalendarIcon
|
|
44
|
+
});
|
|
62
45
|
});
|
|
63
46
|
process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
64
47
|
// ----------------------------- Warning --------------------------------
|
|
@@ -81,6 +64,12 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
81
64
|
* @default false
|
|
82
65
|
*/
|
|
83
66
|
clearable: PropTypes.bool,
|
|
67
|
+
/**
|
|
68
|
+
* The position at which the clear button is placed.
|
|
69
|
+
* If the field is not clearable, the button is not rendered.
|
|
70
|
+
* @default 'end'
|
|
71
|
+
*/
|
|
72
|
+
clearButtonPosition: PropTypes.oneOf(['end', 'start']),
|
|
84
73
|
/**
|
|
85
74
|
* The color of the component.
|
|
86
75
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -252,6 +241,12 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
252
241
|
* @param {FieldSelectedSections} newValue The new selected sections.
|
|
253
242
|
*/
|
|
254
243
|
onSelectedSectionsChange: PropTypes.func,
|
|
244
|
+
/**
|
|
245
|
+
* The position at which the opening button is placed.
|
|
246
|
+
* If there is no picker to open, the button is not rendered
|
|
247
|
+
* @default 'end'
|
|
248
|
+
*/
|
|
249
|
+
openPickerButtonPosition: PropTypes.oneOf(['end', 'start']),
|
|
255
250
|
/**
|
|
256
251
|
* If `true`, the component is read-only.
|
|
257
252
|
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
-
import { DateTimeValidationError, BuiltInFieldTextFieldProps, FieldOwnerState } from '../models';
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
|
+
import { DateTimeValidationError, BuiltInFieldTextFieldProps } from '../models';
|
|
5
3
|
import { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
6
|
-
import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '../hooks/useClearableField';
|
|
7
4
|
import { ExportedValidateDateTimeProps } from '../validation/validateDateTime';
|
|
8
5
|
import { AmPmProps } from '../internals/models/props/time';
|
|
9
6
|
import { PickerValue } from '../internals/models';
|
|
10
|
-
import {
|
|
11
|
-
export interface UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateTimeValidationError>, 'format'>, ExportedValidateDateTimeProps,
|
|
7
|
+
import { ExportedPickerFieldUIProps, PickerFieldUISlotProps, PickerFieldUISlots } from '../internals/components/PickerFieldUI';
|
|
8
|
+
export interface UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateTimeValidationError>, 'format'>, ExportedValidateDateTimeProps, ExportedPickerFieldUIProps, AmPmProps {
|
|
12
9
|
}
|
|
13
10
|
export type DateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure> & Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure>> & {
|
|
14
11
|
/**
|
|
@@ -22,13 +19,7 @@ export type DateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolea
|
|
|
22
19
|
*/
|
|
23
20
|
slotProps?: DateTimeFieldSlotProps;
|
|
24
21
|
};
|
|
25
|
-
export interface DateTimeFieldSlots extends
|
|
26
|
-
/**
|
|
27
|
-
* Form control with an input to render the value.
|
|
28
|
-
* @default <PickersTextField />, or <TextField /> from '@mui/material' if `enableAccessibleFieldDOMStructure` is `false`.
|
|
29
|
-
*/
|
|
30
|
-
textField?: React.ElementType;
|
|
22
|
+
export interface DateTimeFieldSlots extends PickerFieldUISlots {
|
|
31
23
|
}
|
|
32
|
-
export interface DateTimeFieldSlotProps extends
|
|
33
|
-
textField?: SlotComponentPropsFromProps<PickersTextFieldProps | TextFieldProps, {}, FieldOwnerState>;
|
|
24
|
+
export interface DateTimeFieldSlotProps extends PickerFieldUISlotProps {
|
|
34
25
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseDateTimeFieldProps } from './DateTimeField.types';
|
|
2
|
-
export declare const useDateTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "onChange" | "onError" | "format" | "ampm" | "disableFuture" | "disablePast" | "maxDate" | "minDate" | "timezone" | "shouldDisableYear" | "shouldDisableMonth" | "shouldDisableDate" | "minTime" | "maxTime" | "minutesStep" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "minDateTime" | "maxDateTime" | "referenceDate" | "formatDensity" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "enableAccessibleFieldDOMStructure" | "dateSeparator">>;
|
|
2
|
+
export declare const useDateTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "autoFocus" | "onChange" | "onError" | "format" | "ampm" | "disableFuture" | "disablePast" | "maxDate" | "minDate" | "timezone" | "shouldDisableYear" | "shouldDisableMonth" | "shouldDisableDate" | "minTime" | "maxTime" | "minutesStep" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "minDateTime" | "maxDateTime" | "referenceDate" | "formatDensity" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "unstableStartFieldRef" | "unstableEndFieldRef" | "enableAccessibleFieldDOMStructure" | "dateSeparator">>;
|
|
@@ -19,6 +19,7 @@ export const useDateTimeField = props => {
|
|
|
19
19
|
valueManager: manager.internal_valueManager,
|
|
20
20
|
fieldValueManager: manager.internal_fieldValueManager,
|
|
21
21
|
validator: manager.validator,
|
|
22
|
-
valueType: manager.valueType
|
|
22
|
+
valueType: manager.valueType,
|
|
23
|
+
getOpenPickerButtonAriaLabel: manager.internal_getOpenPickerButtonAriaLabel
|
|
23
24
|
});
|
|
24
25
|
};
|
|
@@ -7,15 +7,12 @@ import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
|
7
7
|
import { refType } from '@mui/utils';
|
|
8
8
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
9
9
|
import { useDatePickerDefaultizedProps } from "../DatePicker/shared.js";
|
|
10
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
11
10
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
12
11
|
import { validateDate, extractValidationProps } from "../validation/index.js";
|
|
13
12
|
import { useDesktopPicker } from "../internals/hooks/useDesktopPicker/index.js";
|
|
14
|
-
import { CalendarIcon } from "../icons/index.js";
|
|
15
13
|
import { DateField } from "../DateField/index.js";
|
|
16
14
|
import { renderDateViewCalendar } from "../dateViewRenderers/index.js";
|
|
17
15
|
import { resolveDateFormat } from "../internals/utils/date-utils.js";
|
|
18
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
19
16
|
const emptyActions = [];
|
|
20
17
|
|
|
21
18
|
/**
|
|
@@ -29,7 +26,6 @@ const emptyActions = [];
|
|
|
29
26
|
* - [DesktopDatePicker API](https://mui.com/x/api/date-pickers/desktop-date-picker/)
|
|
30
27
|
*/
|
|
31
28
|
const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePicker(inProps, ref) {
|
|
32
|
-
const translations = usePickerTranslations();
|
|
33
29
|
const utils = useUtils();
|
|
34
30
|
|
|
35
31
|
// Props with the default values common to all date pickers
|
|
@@ -47,7 +43,6 @@ const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePick
|
|
|
47
43
|
format: resolveDateFormat(utils, defaultizedProps, false),
|
|
48
44
|
yearsPerRow: defaultizedProps.yearsPerRow ?? 4,
|
|
49
45
|
slots: _extends({
|
|
50
|
-
openPickerIcon: CalendarIcon,
|
|
51
46
|
field: DateField
|
|
52
47
|
}, defaultizedProps.slots),
|
|
53
48
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
@@ -68,12 +63,6 @@ const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePick
|
|
|
68
63
|
props,
|
|
69
64
|
valueManager: singleItemValueManager,
|
|
70
65
|
valueType: 'date',
|
|
71
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
72
|
-
utils,
|
|
73
|
-
formatKey: 'fullDate',
|
|
74
|
-
contextTranslation: translations.openDatePickerDialogue,
|
|
75
|
-
propsTranslation: props.localeText?.openDatePickerDialogue
|
|
76
|
-
}),
|
|
77
66
|
validator: validateDate
|
|
78
67
|
});
|
|
79
68
|
return renderPicker();
|
|
@@ -12,10 +12,8 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
|
12
12
|
import { DateTimeField } from "../DateTimeField/index.js";
|
|
13
13
|
import { useDateTimePickerDefaultizedProps } from "../DateTimePicker/shared.js";
|
|
14
14
|
import { renderDateViewCalendar } from "../dateViewRenderers/dateViewRenderers.js";
|
|
15
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
16
15
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
17
16
|
import { validateDateTime, extractValidationProps } from "../validation/index.js";
|
|
18
|
-
import { CalendarIcon } from "../icons/index.js";
|
|
19
17
|
import { useDesktopPicker } from "../internals/hooks/useDesktopPicker/index.js";
|
|
20
18
|
import { resolveDateTimeFormat, resolveTimeViewsResponse } from "../internals/utils/date-time-utils.js";
|
|
21
19
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from "../timeViewRenderers/index.js";
|
|
@@ -25,7 +23,6 @@ import { DesktopDateTimePickerLayout } from "./DesktopDateTimePickerLayout.js";
|
|
|
25
23
|
import { VIEW_HEIGHT } from "../internals/constants/dimensions.js";
|
|
26
24
|
import { isInternalTimeView } from "../internals/utils/time-utils.js";
|
|
27
25
|
import { isDatePickerView } from "../internals/utils/date-utils.js";
|
|
28
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
29
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
27
|
const rendererInterceptor = function RendererInterceptor(props) {
|
|
31
28
|
const {
|
|
@@ -90,7 +87,6 @@ const rendererInterceptor = function RendererInterceptor(props) {
|
|
|
90
87
|
* - [DesktopDateTimePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-picker/)
|
|
91
88
|
*/
|
|
92
89
|
const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimePicker(inProps, ref) {
|
|
93
|
-
const translations = usePickerTranslations();
|
|
94
90
|
const utils = useUtils();
|
|
95
91
|
|
|
96
92
|
// Props with the default values common to all date time pickers
|
|
@@ -128,8 +124,7 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
|
|
|
128
124
|
shouldRenderTimeInASingleColumn,
|
|
129
125
|
slots: _extends({
|
|
130
126
|
field: DateTimeField,
|
|
131
|
-
layout: DesktopDateTimePickerLayout
|
|
132
|
-
openPickerIcon: CalendarIcon
|
|
127
|
+
layout: DesktopDateTimePickerLayout
|
|
133
128
|
}, defaultizedProps.slots),
|
|
134
129
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
135
130
|
field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
|
|
@@ -150,12 +145,6 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
|
|
|
150
145
|
props,
|
|
151
146
|
valueManager: singleItemValueManager,
|
|
152
147
|
valueType: 'date-time',
|
|
153
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
154
|
-
utils,
|
|
155
|
-
formatKey: 'fullDate',
|
|
156
|
-
contextTranslation: translations.openDatePickerDialogue,
|
|
157
|
-
propsTranslation: props.localeText?.openDatePickerDialogue
|
|
158
|
-
}),
|
|
159
148
|
validator: validateDateTime,
|
|
160
149
|
rendererInterceptor
|
|
161
150
|
});
|
|
@@ -8,15 +8,12 @@ import { refType } from '@mui/utils';
|
|
|
8
8
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
9
9
|
import { TimeField } from "../TimeField/index.js";
|
|
10
10
|
import { useTimePickerDefaultizedProps } from "../TimePicker/shared.js";
|
|
11
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
11
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
13
12
|
import { extractValidationProps, validateTime } from "../validation/index.js";
|
|
14
|
-
import { ClockIcon } from "../icons/index.js";
|
|
15
13
|
import { useDesktopPicker } from "../internals/hooks/useDesktopPicker/index.js";
|
|
16
14
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from "../timeViewRenderers/index.js";
|
|
17
15
|
import { resolveTimeFormat } from "../internals/utils/time-utils.js";
|
|
18
16
|
import { resolveTimeViewsResponse } from "../internals/utils/date-time-utils.js";
|
|
19
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
20
17
|
/**
|
|
21
18
|
* Demos:
|
|
22
19
|
*
|
|
@@ -28,7 +25,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
|
|
|
28
25
|
* - [DesktopTimePicker API](https://mui.com/x/api/date-pickers/desktop-time-picker/)
|
|
29
26
|
*/
|
|
30
27
|
const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePicker(inProps, ref) {
|
|
31
|
-
const translations = usePickerTranslations();
|
|
32
28
|
const utils = useUtils();
|
|
33
29
|
|
|
34
30
|
// Props with the default values common to all time pickers
|
|
@@ -60,8 +56,7 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
|
|
|
60
56
|
// Allows for easy view lifecycle management
|
|
61
57
|
views: shouldRenderTimeInASingleColumn ? ['hours'] : views,
|
|
62
58
|
slots: _extends({
|
|
63
|
-
field: TimeField
|
|
64
|
-
openPickerIcon: ClockIcon
|
|
59
|
+
field: TimeField
|
|
65
60
|
}, defaultizedProps.slots),
|
|
66
61
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
67
62
|
field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
|
|
@@ -79,12 +74,6 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
|
|
|
79
74
|
props,
|
|
80
75
|
valueManager: singleItemValueManager,
|
|
81
76
|
valueType: 'time',
|
|
82
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
83
|
-
utils,
|
|
84
|
-
formatKey: 'fullTime',
|
|
85
|
-
contextTranslation: translations.openTimePickerDialogue,
|
|
86
|
-
propsTranslation: props.localeText?.openTimePickerDialogue
|
|
87
|
-
}),
|
|
88
77
|
validator: validateTime
|
|
89
78
|
});
|
|
90
79
|
return renderPicker();
|
|
@@ -7,14 +7,12 @@ import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
|
7
7
|
import { refType } from '@mui/utils';
|
|
8
8
|
import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
|
|
9
9
|
import { useDatePickerDefaultizedProps } from "../DatePicker/shared.js";
|
|
10
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
11
10
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
12
11
|
import { extractValidationProps, validateDate } from "../validation/index.js";
|
|
13
12
|
import { DateField } from "../DateField/index.js";
|
|
14
13
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
15
14
|
import { renderDateViewCalendar } from "../dateViewRenderers/index.js";
|
|
16
15
|
import { resolveDateFormat } from "../internals/utils/date-utils.js";
|
|
17
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
18
16
|
/**
|
|
19
17
|
* Demos:
|
|
20
18
|
*
|
|
@@ -26,7 +24,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
|
|
|
26
24
|
* - [MobileDatePicker API](https://mui.com/x/api/date-pickers/mobile-date-picker/)
|
|
27
25
|
*/
|
|
28
26
|
const MobileDatePicker = /*#__PURE__*/React.forwardRef(function MobileDatePicker(inProps, ref) {
|
|
29
|
-
const translations = usePickerTranslations();
|
|
30
27
|
const utils = useUtils();
|
|
31
28
|
|
|
32
29
|
// Props with the default values common to all date pickers
|
|
@@ -59,12 +56,6 @@ const MobileDatePicker = /*#__PURE__*/React.forwardRef(function MobileDatePicker
|
|
|
59
56
|
props,
|
|
60
57
|
valueManager: singleItemValueManager,
|
|
61
58
|
valueType: 'date',
|
|
62
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
63
|
-
utils,
|
|
64
|
-
formatKey: 'fullDate',
|
|
65
|
-
contextTranslation: translations.openDatePickerDialogue,
|
|
66
|
-
propsTranslation: props.localeText?.openDatePickerDialogue
|
|
67
|
-
}),
|
|
68
59
|
validator: validateDate
|
|
69
60
|
});
|
|
70
61
|
return renderPicker();
|
|
@@ -8,14 +8,12 @@ import { refType } from '@mui/utils';
|
|
|
8
8
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
9
9
|
import { DateTimeField } from "../DateTimeField/index.js";
|
|
10
10
|
import { useDateTimePickerDefaultizedProps } from "../DateTimePicker/shared.js";
|
|
11
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
11
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
13
12
|
import { extractValidationProps, validateDateTime } from "../validation/index.js";
|
|
14
13
|
import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
|
|
15
14
|
import { renderDateViewCalendar } from "../dateViewRenderers/index.js";
|
|
16
15
|
import { renderTimeViewClock } from "../timeViewRenderers/index.js";
|
|
17
16
|
import { resolveDateTimeFormat } from "../internals/utils/date-time-utils.js";
|
|
18
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
19
17
|
/**
|
|
20
18
|
* Demos:
|
|
21
19
|
*
|
|
@@ -27,7 +25,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
|
|
|
27
25
|
* - [MobileDateTimePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-picker/)
|
|
28
26
|
*/
|
|
29
27
|
const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimePicker(inProps, ref) {
|
|
30
|
-
const translations = usePickerTranslations();
|
|
31
28
|
const utils = useUtils();
|
|
32
29
|
|
|
33
30
|
// Props with the default values common to all date time pickers
|
|
@@ -69,12 +66,6 @@ const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTi
|
|
|
69
66
|
props,
|
|
70
67
|
valueManager: singleItemValueManager,
|
|
71
68
|
valueType: 'date-time',
|
|
72
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
73
|
-
utils,
|
|
74
|
-
formatKey: 'fullDate',
|
|
75
|
-
contextTranslation: translations.openDatePickerDialogue,
|
|
76
|
-
propsTranslation: props.localeText?.openDatePickerDialogue
|
|
77
|
-
}),
|
|
78
69
|
validator: validateDateTime
|
|
79
70
|
});
|
|
80
71
|
return renderPicker();
|