@mui/x-date-pickers 9.0.0-rc.0 → 9.0.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +328 -6892
  2. package/DateField/DateField.js +0 -24
  3. package/DateField/DateField.mjs +0 -24
  4. package/DateTimeField/DateTimeField.js +0 -24
  5. package/DateTimeField/DateTimeField.mjs +0 -24
  6. package/LocalizationProvider/LocalizationProvider.d.mts +0 -6
  7. package/LocalizationProvider/LocalizationProvider.d.ts +0 -6
  8. package/LocalizationProvider/LocalizationProvider.js +1 -10
  9. package/LocalizationProvider/LocalizationProvider.mjs +0 -9
  10. package/LocalizationProvider/index.d.mts +1 -1
  11. package/LocalizationProvider/index.d.ts +1 -1
  12. package/LocalizationProvider/index.js +0 -6
  13. package/LocalizationProvider/index.mjs +1 -1
  14. package/PickersTextField/PickersFilledInput/PickersFilledInput.js +14 -19
  15. package/PickersTextField/PickersFilledInput/PickersFilledInput.mjs +14 -19
  16. package/PickersTextField/PickersInput/PickersInput.js +12 -17
  17. package/PickersTextField/PickersInput/PickersInput.mjs +12 -17
  18. package/PickersTextField/PickersInputBase/PickersInputBase.js +16 -12
  19. package/PickersTextField/PickersInputBase/PickersInputBase.mjs +16 -12
  20. package/PickersTextField/PickersInputBase/PickersInputBase.types.d.mts +34 -17
  21. package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +34 -17
  22. package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +10 -14
  23. package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.mjs +10 -14
  24. package/PickersTextField/PickersTextField.js +68 -55
  25. package/PickersTextField/PickersTextField.mjs +68 -55
  26. package/PickersTextField/PickersTextField.types.d.mts +52 -40
  27. package/PickersTextField/PickersTextField.types.d.ts +52 -40
  28. package/PickersTextField/index.d.mts +1 -1
  29. package/PickersTextField/index.d.ts +1 -1
  30. package/TimeField/TimeField.js +1 -25
  31. package/TimeField/TimeField.mjs +1 -25
  32. package/index.js +1 -1
  33. package/index.mjs +1 -1
  34. package/internals/components/PickerFieldUI.d.mts +4 -20
  35. package/internals/components/PickerFieldUI.d.ts +4 -20
  36. package/internals/components/PickerFieldUI.js +57 -49
  37. package/internals/components/PickerFieldUI.mjs +57 -49
  38. package/internals/hooks/useField/useField.js +15 -2
  39. package/internals/hooks/useField/useField.mjs +15 -2
  40. package/internals/hooks/useField/useField.utils.js +3 -9
  41. package/internals/hooks/useField/useField.utils.mjs +3 -9
  42. package/models/fields.d.mts +1 -1
  43. package/models/fields.d.ts +1 -1
  44. package/package.json +125 -125
@@ -3,10 +3,57 @@ import { FormControlProps } from '@mui/material/FormControl';
3
3
  import { FormHelperTextProps } from '@mui/material/FormHelperText';
4
4
  import { InputLabelProps } from '@mui/material/InputLabel';
5
5
  import { TextFieldVariants } from '@mui/material/TextField';
6
- import { PickersInputPropsUsedByField } from "./PickersInputBase/PickersInputBase.types.js";
6
+ import { PickersInputBaseProps, PickersInputPropsUsedByField } from "./PickersInputBase/PickersInputBase.types.js";
7
7
  import type { PickersInputProps } from "./PickersInput/index.js";
8
8
  import type { PickersOutlinedInputProps } from "./PickersOutlinedInput/index.js";
9
9
  import type { PickersFilledInputProps } from "./PickersFilledInput/index.js";
10
+ export interface PickersTextFieldSlots {
11
+ /**
12
+ * The component used for the root slot.
13
+ * @default FormControl
14
+ */
15
+ root?: React.ElementType;
16
+ /**
17
+ * The component used for the input slot.
18
+ * Defaults to one of `PickersInput`, `PickersFilledInput`, `PickersOutlinedInput` based on `variant`.
19
+ * @default PickersOutlinedInput
20
+ */
21
+ input?: React.ElementType;
22
+ /**
23
+ * The component used for the input label slot.
24
+ * @default InputLabel
25
+ */
26
+ inputLabel?: React.ElementType;
27
+ /**
28
+ * The component rendered as the underlying hidden `<input>` element.
29
+ * @default PickersInputBaseInput
30
+ */
31
+ htmlInput?: React.ElementType;
32
+ /**
33
+ * The component used for the form helper text slot.
34
+ * @default FormHelperText
35
+ */
36
+ formHelperText?: React.ElementType;
37
+ }
38
+ export interface PickersTextFieldSlotProps<InputPropsType extends PickersInputBaseProps> {
39
+ root?: Partial<FormControlProps>;
40
+ input?: Partial<InputPropsType>;
41
+ inputLabel?: Partial<InputLabelProps>;
42
+ htmlInput?: React.ComponentPropsWithRef<'input'>;
43
+ formHelperText?: Partial<FormHelperTextProps>;
44
+ }
45
+ export interface PickersTextFieldSlotsAndSlotProps<InputPropsType extends PickersInputBaseProps> {
46
+ /**
47
+ * The components used for each slot inside.
48
+ * @default {}
49
+ */
50
+ slots?: PickersTextFieldSlots;
51
+ /**
52
+ * The props used for each component slot.
53
+ * @default {}
54
+ */
55
+ slotProps?: PickersTextFieldSlotProps<InputPropsType>;
56
+ }
10
57
  interface PickersTextFieldPropsUsedByField {
11
58
  onFocus: React.FocusEventHandler<HTMLDivElement>;
12
59
  onBlur: React.FocusEventHandler<HTMLDivElement>;
@@ -17,67 +64,32 @@ interface PickersTextFieldPropsUsedByField {
17
64
  */
18
65
  error: boolean;
19
66
  }
20
- export interface PickersBaseTextFieldProps extends PickersInputPropsUsedByField, PickersTextFieldPropsUsedByField, Omit<FormControlProps, keyof PickersInputPropsUsedByField | keyof PickersTextFieldPropsUsedByField> {
21
- /**
22
- * Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
23
- * @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
24
- */
25
- FormHelperTextProps?: Partial<FormHelperTextProps>;
26
- /**
27
- * Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
28
- * Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
29
- * @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
30
- */
31
- InputLabelProps?: Partial<InputLabelProps>;
67
+ export interface PickersBaseTextFieldProps extends PickersInputPropsUsedByField, PickersTextFieldPropsUsedByField, Omit<FormControlProps, keyof PickersInputPropsUsedByField | keyof PickersTextFieldPropsUsedByField | 'slots' | 'slotProps'> {
32
68
  /**
33
69
  * The helper text content.
34
70
  */
35
71
  helperText?: React.ReactNode;
36
72
  }
37
- export interface PickersStandardTextFieldProps extends PickersBaseTextFieldProps {
73
+ export interface PickersStandardTextFieldProps extends PickersBaseTextFieldProps, PickersTextFieldSlotsAndSlotProps<PickersInputProps> {
38
74
  /**
39
75
  * The variant to use.
40
76
  * @default 'outlined'
41
77
  */
42
78
  variant?: 'standard';
43
- /**
44
- * Props applied to the Input element.
45
- * It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
46
- * [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
47
- * component depending on the `variant` prop value.
48
- * @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
49
- */
50
- InputProps?: Partial<PickersInputProps>;
51
79
  }
52
- export interface PickersOutlinedTextFieldProps extends PickersBaseTextFieldProps {
80
+ export interface PickersOutlinedTextFieldProps extends PickersBaseTextFieldProps, PickersTextFieldSlotsAndSlotProps<PickersOutlinedInputProps> {
53
81
  /**
54
82
  * The variant to use.
55
83
  * @default 'outlined'
56
84
  */
57
85
  variant?: 'outlined';
58
- /**
59
- * Props applied to the Input element.
60
- * It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
61
- * [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
62
- * component depending on the `variant` prop value.
63
- * @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
64
- */
65
- InputProps?: Partial<PickersOutlinedInputProps>;
66
86
  }
67
- export interface PickersFilledTextFieldProps extends PickersBaseTextFieldProps {
87
+ export interface PickersFilledTextFieldProps extends PickersBaseTextFieldProps, PickersTextFieldSlotsAndSlotProps<PickersFilledInputProps> {
68
88
  /**
69
89
  * The variant to use.
70
90
  * @default 'outlined'
71
91
  */
72
92
  variant?: 'filled';
73
- /**
74
- * Props applied to the Input element.
75
- * It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
76
- * [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
77
- * component depending on the `variant` prop value.
78
- * @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
79
- */
80
- InputProps?: Partial<PickersFilledInputProps>;
81
93
  }
82
94
  export type PickersTextFieldProps<Variant extends TextFieldVariants = TextFieldVariants> = Variant extends 'filled' ? PickersFilledTextFieldProps : Variant extends 'standard' ? PickersStandardTextFieldProps : PickersOutlinedTextFieldProps;
83
95
  export {};
@@ -1,5 +1,5 @@
1
1
  export { PickersTextField } from "./PickersTextField.mjs";
2
- export type { PickersTextFieldProps } from "./PickersTextField.types.mjs";
2
+ export type { PickersTextFieldProps, PickersTextFieldSlots, PickersTextFieldSlotProps } from "./PickersTextField.types.mjs";
3
3
  export { pickersTextFieldClasses, getPickersTextFieldUtilityClass } from "./pickersTextFieldClasses.mjs";
4
4
  export type { PickersTextFieldClasses, PickersTextFieldClassKey } from "./pickersTextFieldClasses.mjs";
5
5
  export * from "./PickersInput/index.mjs";
@@ -1,5 +1,5 @@
1
1
  export { PickersTextField } from "./PickersTextField.js";
2
- export type { PickersTextFieldProps } from "./PickersTextField.types.js";
2
+ export type { PickersTextFieldProps, PickersTextFieldSlots, PickersTextFieldSlotProps } from "./PickersTextField.types.js";
3
3
  export { pickersTextFieldClasses, getPickersTextFieldUtilityClass } from "./pickersTextFieldClasses.js";
4
4
  export type { PickersTextFieldClasses, PickersTextFieldClassKey } from "./pickersTextFieldClasses.js";
5
5
  export * from "./PickersInput/index.js";
@@ -16,7 +16,7 @@ var _useTimeField = require("./useTimeField");
16
16
  var _PickerFieldUI = require("../internals/components/PickerFieldUI");
17
17
  var _icons = require("../icons");
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
- const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
19
+ const _excluded = ["slots", "slotProps"];
20
20
  /**
21
21
  * Demos:
22
22
  *
@@ -147,11 +147,6 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
147
147
  * @default "dense"
148
148
  */
149
149
  formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
150
- /**
151
- * Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
152
- * @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
153
- */
154
- FormHelperTextProps: _propTypes.default.object,
155
150
  /**
156
151
  * If `true`, the input will take up the full width of its container.
157
152
  * @default false
@@ -172,25 +167,6 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
172
167
  * The id of the `input` element.
173
168
  */
174
169
  id: _propTypes.default.string,
175
- /**
176
- * Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
177
- * Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
178
- * @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
179
- */
180
- InputLabelProps: _propTypes.default.object,
181
- /**
182
- * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
183
- * @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
184
- */
185
- inputProps: _propTypes.default.object,
186
- /**
187
- * Props applied to the Input element.
188
- * It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
189
- * [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
190
- * component depending on the `variant` prop value.
191
- * @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
192
- */
193
- InputProps: _propTypes.default.object,
194
170
  /**
195
171
  * Pass a ref to the `input` element.
196
172
  */
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
- const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
4
+ const _excluded = ["slots", "slotProps"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { useThemeProps } from '@mui/material/styles';
@@ -140,11 +140,6 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
140
140
  * @default "dense"
141
141
  */
142
142
  formatDensity: PropTypes.oneOf(['dense', 'spacious']),
143
- /**
144
- * Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
145
- * @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
146
- */
147
- FormHelperTextProps: PropTypes.object,
148
143
  /**
149
144
  * If `true`, the input will take up the full width of its container.
150
145
  * @default false
@@ -165,25 +160,6 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
165
160
  * The id of the `input` element.
166
161
  */
167
162
  id: PropTypes.string,
168
- /**
169
- * Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
170
- * Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
171
- * @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
172
- */
173
- InputLabelProps: PropTypes.object,
174
- /**
175
- * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
176
- * @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
177
- */
178
- inputProps: PropTypes.object,
179
- /**
180
- * Props applied to the Input element.
181
- * It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
182
- * [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
183
- * component depending on the `variant` prop value.
184
- * @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
185
- */
186
- InputProps: PropTypes.object,
187
163
  /**
188
164
  * Pass a ref to the `input` element.
189
165
  */
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v9.0.0-rc.0
2
+ * @mui/x-date-pickers v9.0.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v9.0.0-rc.0
2
+ * @mui/x-date-pickers v9.0.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -11,14 +11,7 @@ export declare const cleanFieldResponse: <TFieldResponse extends MakeOptional<Us
11
11
  [key: string]: any;
12
12
  }>, "onClear" | "clearable">>(fieldResponse: TFieldResponse) => ExportedPickerFieldUIProps & {
13
13
  openPickerAriaLabel: string;
14
- textFieldProps: Partial<PickersTextFieldProps> & {
15
- inputProps?: Record<string, any>;
16
- InputProps?: Record<string, any>;
17
- slotProps?: {
18
- input?: Record<string, any>;
19
- htmlInput?: Record<string, any>;
20
- };
21
- };
14
+ textFieldProps: Partial<PickersTextFieldProps>;
22
15
  };
23
16
  export declare const PickerFieldUIContext: React.Context<PickerFieldUIContextValue>;
24
17
  /**
@@ -93,12 +86,7 @@ export interface PickerFieldUISlotsFromContext extends PickerFieldUISlots {
93
86
  openPickerIcon?: React.ElementType;
94
87
  }
95
88
  export interface PickerFieldUISlotProps {
96
- textField?: SlotComponentPropsFromProps<PickersTextFieldProps & {
97
- slotProps?: {
98
- input?: Record<string, any>;
99
- htmlInput?: Record<string, any>;
100
- };
101
- }, {}, FieldOwnerState>;
89
+ textField?: SlotComponentPropsFromProps<PickersTextFieldProps, {}, FieldOwnerState>;
102
90
  inputAdornment?: SlotComponentPropsFromProps<InputAdornmentProps, {}, FieldInputAdornmentOwnerState>;
103
91
  clearIcon?: SlotComponentPropsFromProps<SvgIconProps, {}, FieldOwnerState>;
104
92
  clearButton?: SlotComponentPropsFromProps<IconButtonProps, {}, FieldOwnerState>;
@@ -118,13 +106,9 @@ interface PickerFieldUIContextValue {
118
106
  export declare function mergeSlotProps<TProps extends {}, TOwnerState extends FieldOwnerState>(slotPropsA: SlotComponentPropsFromProps<TProps, {}, TOwnerState> | undefined, slotPropsB: SlotComponentPropsFromProps<TProps, {}, TOwnerState> | undefined): Partial<TProps> | ((ownerState: TOwnerState) => {}) | undefined;
119
107
  /**
120
108
  * The `textField` slot props cannot be handled inside `PickerFieldUI` because it would be a breaking change to not pass the enriched props to `useField`.
121
- * Once the non-accessible DOM structure will be removed, we will be able to remove the `textField` slot and clean this logic.
122
- * TODO: Address with the needed support for the `textField` slotProps given the change of minimum version of MUI.
109
+ * TODO v10: Remove the `textField` slot and clean this logic up.
123
110
  */
124
- export declare function useFieldTextFieldProps<TProps extends UseFieldOwnerStateParameters & {
125
- inputProps?: {};
126
- InputProps?: {};
127
- }>(parameters: UseFieldTextFieldPropsParameters): TProps;
111
+ export declare function useFieldTextFieldProps<TProps extends UseFieldOwnerStateParameters>(parameters: UseFieldTextFieldPropsParameters): TProps;
128
112
  interface UseFieldTextFieldPropsParameters {
129
113
  slotProps: {
130
114
  textField?: PickerFieldUISlotProps['textField'];
@@ -11,14 +11,7 @@ export declare const cleanFieldResponse: <TFieldResponse extends MakeOptional<Us
11
11
  [key: string]: any;
12
12
  }>, "onClear" | "clearable">>(fieldResponse: TFieldResponse) => ExportedPickerFieldUIProps & {
13
13
  openPickerAriaLabel: string;
14
- textFieldProps: Partial<PickersTextFieldProps> & {
15
- inputProps?: Record<string, any>;
16
- InputProps?: Record<string, any>;
17
- slotProps?: {
18
- input?: Record<string, any>;
19
- htmlInput?: Record<string, any>;
20
- };
21
- };
14
+ textFieldProps: Partial<PickersTextFieldProps>;
22
15
  };
23
16
  export declare const PickerFieldUIContext: React.Context<PickerFieldUIContextValue>;
24
17
  /**
@@ -93,12 +86,7 @@ export interface PickerFieldUISlotsFromContext extends PickerFieldUISlots {
93
86
  openPickerIcon?: React.ElementType;
94
87
  }
95
88
  export interface PickerFieldUISlotProps {
96
- textField?: SlotComponentPropsFromProps<PickersTextFieldProps & {
97
- slotProps?: {
98
- input?: Record<string, any>;
99
- htmlInput?: Record<string, any>;
100
- };
101
- }, {}, FieldOwnerState>;
89
+ textField?: SlotComponentPropsFromProps<PickersTextFieldProps, {}, FieldOwnerState>;
102
90
  inputAdornment?: SlotComponentPropsFromProps<InputAdornmentProps, {}, FieldInputAdornmentOwnerState>;
103
91
  clearIcon?: SlotComponentPropsFromProps<SvgIconProps, {}, FieldOwnerState>;
104
92
  clearButton?: SlotComponentPropsFromProps<IconButtonProps, {}, FieldOwnerState>;
@@ -118,13 +106,9 @@ interface PickerFieldUIContextValue {
118
106
  export declare function mergeSlotProps<TProps extends {}, TOwnerState extends FieldOwnerState>(slotPropsA: SlotComponentPropsFromProps<TProps, {}, TOwnerState> | undefined, slotPropsB: SlotComponentPropsFromProps<TProps, {}, TOwnerState> | undefined): Partial<TProps> | ((ownerState: TOwnerState) => {}) | undefined;
119
107
  /**
120
108
  * The `textField` slot props cannot be handled inside `PickerFieldUI` because it would be a breaking change to not pass the enriched props to `useField`.
121
- * Once the non-accessible DOM structure will be removed, we will be able to remove the `textField` slot and clean this logic.
122
- * TODO: Address with the needed support for the `textField` slotProps given the change of minimum version of MUI.
109
+ * TODO v10: Remove the `textField` slot and clean this logic up.
123
110
  */
124
- export declare function useFieldTextFieldProps<TProps extends UseFieldOwnerStateParameters & {
125
- inputProps?: {};
126
- InputProps?: {};
127
- }>(parameters: UseFieldTextFieldPropsParameters): TProps;
111
+ export declare function useFieldTextFieldProps<TProps extends UseFieldOwnerStateParameters>(parameters: UseFieldTextFieldPropsParameters): TProps;
128
112
  interface UseFieldTextFieldPropsParameters {
129
113
  slotProps: {
130
114
  textField?: PickerFieldUISlotProps['textField'];
@@ -21,47 +21,55 @@ var _resolveComponentProps = _interopRequireDefault(require("@mui/utils/resolveC
21
21
  var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
22
22
  var _InputAdornment = _interopRequireDefault(require("@mui/material/InputAdornment"));
23
23
  var _useSlotProps5 = _interopRequireDefault(require("@mui/utils/useSlotProps"));
24
+ var _warning = require("@mui/x-internals/warning");
24
25
  var _useFieldOwnerState = require("../hooks/useFieldOwnerState");
25
26
  var _hooks = require("../../hooks");
26
27
  var _icons = require("../../icons");
27
28
  var _useNullablePickerContext = require("../hooks/useNullablePickerContext");
28
29
  var _PickersTextField = require("../../PickersTextField");
29
30
  var _jsxRuntime = require("react/jsx-runtime");
30
- const _excluded = ["InputProps", "readOnly", "onClear", "clearable", "clearButtonPosition", "openPickerButtonPosition", "openPickerAriaLabel"],
31
+ const _excluded = ["readOnly", "onClear", "clearable", "clearButtonPosition", "openPickerButtonPosition", "openPickerAriaLabel", "InputProps", "inputProps", "InputLabelProps", "FormHelperTextProps"],
31
32
  _excluded2 = ["ownerState"],
32
33
  _excluded3 = ["ownerState"],
33
34
  _excluded4 = ["ownerState"],
34
35
  _excluded5 = ["ownerState"],
35
- _excluded6 = ["InputProps", "inputProps"];
36
- const noop = () => {};
36
+ _excluded6 = ["InputProps", "inputProps", "InputLabelProps", "FormHelperTextProps"];
37
37
  const cleanFieldResponse = fieldResponse => {
38
- const {
39
- InputProps,
38
+ const _ref = fieldResponse,
39
+ {
40
40
  readOnly,
41
41
  onClear,
42
42
  clearable,
43
43
  clearButtonPosition,
44
44
  openPickerButtonPosition,
45
- openPickerAriaLabel
46
- } = fieldResponse,
47
- other = (0, _objectWithoutPropertiesLoose2.default)(fieldResponse, _excluded);
48
- const mergedInputProps = other?.slotProps?.input ? mergeSlotProps(other?.slotProps?.input, InputProps) : noop;
45
+ openPickerAriaLabel,
46
+ // TODO v10: remove
47
+ // Explicitly discard legacy props that are no longer supported on `PickersTextField`.
48
+ // Without this, any leftover values would silently leak into `...other` and end up spread
49
+ // as unknown attributes on the underlying form control.
50
+ InputProps: legacyInputProps,
51
+ inputProps: legacyHtmlInputProps,
52
+ InputLabelProps: legacyInputLabelProps,
53
+ FormHelperTextProps: legacyFormHelperTextProps
54
+ } = _ref,
55
+ other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
56
+ if (process.env.NODE_ENV !== 'production') {
57
+ if (legacyInputProps || legacyHtmlInputProps || legacyInputLabelProps || legacyFormHelperTextProps) {
58
+ (0, _warning.warnOnce)(['MUI X: The `InputProps`, `inputProps`, `InputLabelProps` and `FormHelperTextProps` props are no longer supported on Picker / Field components.', 'They have been silently dropped because they would otherwise be forwarded as unknown attributes on the underlying form control.', 'Use the `slotProps` shape instead (`slotProps.input`, `slotProps.htmlInput`, `slotProps.inputLabel`, `slotProps.formHelperText`).', 'See https://mui.com/x/migration/migration-pickers-v8/#textfield-props for migration details.']);
59
+ }
60
+ }
49
61
  return {
50
62
  clearable,
51
63
  onClear,
52
64
  clearButtonPosition,
53
65
  openPickerButtonPosition,
54
66
  openPickerAriaLabel,
55
- textFieldProps: (0, _extends2.default)({}, other, other?.slotProps?.input || other?.slotProps?.htmlInput ? {
67
+ textFieldProps: (0, _extends2.default)({}, other, {
56
68
  slotProps: (0, _extends2.default)({}, other?.slotProps, {
57
- input: ownerState => (0, _extends2.default)({}, (0, _resolveComponentProps.default)(mergedInputProps, ownerState), {
69
+ input: (0, _extends2.default)({}, other?.slotProps?.input, {
58
70
  readOnly
59
71
  })
60
72
  })
61
- } : {
62
- InputProps: (0, _extends2.default)({}, InputProps ?? {}, {
63
- readOnly
64
- })
65
73
  })
66
74
  };
67
75
  };
@@ -178,13 +186,14 @@ function PickerFieldUI(props) {
178
186
  ownerState
179
187
  });
180
188
  textFieldProps.ref = (0, _useForkRef.default)(textFieldProps.ref, pickerContext?.rootRef);
181
- const additionalTextFieldInputProps = {};
182
- const textFieldInputProps = (0, _resolveComponentProps.default)(textFieldProps?.slotProps?.input ?? textFieldProps.InputProps, ownerState);
189
+ const externalInputSlotProps = textFieldProps.slotProps?.input;
190
+ const additionalInputSlotProps = {};
191
+ const forkedInputRef = (0, _useForkRef.default)(externalInputSlotProps?.ref, pickerContext?.triggerRef);
183
192
  if (pickerContext) {
184
- additionalTextFieldInputProps.ref = pickerContext.triggerRef;
193
+ additionalInputSlotProps.ref = forkedInputRef;
185
194
  }
186
- if (!textFieldInputProps?.startAdornment && (clearButtonPosition === 'start' || openPickerButtonPosition === 'start')) {
187
- additionalTextFieldInputProps.startAdornment = /*#__PURE__*/(0, _jsxRuntime.jsxs)(InputAdornment, (0, _extends2.default)({}, startInputAdornmentProps, {
195
+ if (!externalInputSlotProps?.startAdornment && (clearButtonPosition === 'start' || openPickerButtonPosition === 'start')) {
196
+ additionalInputSlotProps.startAdornment = /*#__PURE__*/(0, _jsxRuntime.jsxs)(InputAdornment, (0, _extends2.default)({}, startInputAdornmentProps, {
188
197
  children: [openPickerButtonPosition === 'start' && /*#__PURE__*/(0, _jsxRuntime.jsx)(OpenPickerButton, (0, _extends2.default)({}, openPickerButtonProps, {
189
198
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(OpenPickerIcon, (0, _extends2.default)({}, openPickerIconProps))
190
199
  })), clearButtonPosition === 'start' && /*#__PURE__*/(0, _jsxRuntime.jsx)(ClearButton, (0, _extends2.default)({}, clearButtonProps, {
@@ -192,8 +201,8 @@ function PickerFieldUI(props) {
192
201
  }))]
193
202
  }));
194
203
  }
195
- if (!textFieldInputProps?.endAdornment && (clearButtonPosition === 'end' || openPickerButtonPosition === 'end')) {
196
- additionalTextFieldInputProps.endAdornment = /*#__PURE__*/(0, _jsxRuntime.jsxs)(InputAdornment, (0, _extends2.default)({}, endInputAdornmentProps, {
204
+ if (!externalInputSlotProps?.endAdornment && (clearButtonPosition === 'end' || openPickerButtonPosition === 'end')) {
205
+ additionalInputSlotProps.endAdornment = /*#__PURE__*/(0, _jsxRuntime.jsxs)(InputAdornment, (0, _extends2.default)({}, endInputAdornmentProps, {
197
206
  children: [clearButtonPosition === 'end' && /*#__PURE__*/(0, _jsxRuntime.jsx)(ClearButton, (0, _extends2.default)({}, clearButtonProps, {
198
207
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ClearIcon, (0, _extends2.default)({}, clearIconProps))
199
208
  })), openPickerButtonPosition === 'end' && /*#__PURE__*/(0, _jsxRuntime.jsx)(OpenPickerButton, (0, _extends2.default)({}, openPickerButtonProps, {
@@ -202,8 +211,8 @@ function PickerFieldUI(props) {
202
211
  }));
203
212
  }
204
213
  // handle the case of showing custom `inputAdornment` for Field components
205
- if (!additionalTextFieldInputProps?.endAdornment && !additionalTextFieldInputProps?.startAdornment && pickerFieldUIContext.slots.inputAdornment) {
206
- additionalTextFieldInputProps.endAdornment = /*#__PURE__*/(0, _jsxRuntime.jsx)(InputAdornment, (0, _extends2.default)({}, endInputAdornmentProps));
214
+ if (!additionalInputSlotProps.endAdornment && !additionalInputSlotProps.startAdornment && pickerFieldUIContext.slots.inputAdornment) {
215
+ additionalInputSlotProps.endAdornment = /*#__PURE__*/(0, _jsxRuntime.jsx)(InputAdornment, (0, _extends2.default)({}, endInputAdornmentProps));
207
216
  }
208
217
  if (clearButtonPosition != null) {
209
218
  textFieldProps.sx = [{
@@ -222,19 +231,10 @@ function PickerFieldUI(props) {
222
231
  }
223
232
  }, ...(Array.isArray(textFieldProps.sx) ? textFieldProps.sx : [textFieldProps.sx])];
224
233
  }
225
- const resolvedTextFieldInputProps = textFieldProps?.slotProps?.input ? (0, _resolveComponentProps.default)(mergeSlotProps(textFieldInputProps, additionalTextFieldInputProps), ownerState) : (0, _extends2.default)({}, textFieldInputProps, additionalTextFieldInputProps);
226
-
227
- // We need to resolve the `inputProps` since we are messing with those props in this component.
228
- textFieldProps.inputProps = textFieldProps?.slotProps?.htmlInput ? (0, _resolveComponentProps.default)(textFieldProps.slotProps.htmlInput, ownerState) : textFieldProps.inputProps;
229
-
230
- // Remove the `input` slotProps to avoid them overriding the manually resolved `InputProps`.
231
- // `slotProps` would take precedence over `InputProps`.
232
- delete textFieldProps?.slotProps?.input;
233
- // Remove the `slotProps` on `PickersTextField` as they are not supported.
234
- delete textFieldProps?.slotProps;
235
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({}, textFieldProps, {
236
- InputProps: resolvedTextFieldInputProps
237
- }));
234
+ textFieldProps.slotProps = (0, _extends2.default)({}, textFieldProps.slotProps, {
235
+ input: (0, _extends2.default)({}, externalInputSlotProps, additionalInputSlotProps)
236
+ });
237
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({}, textFieldProps));
238
238
  }
239
239
  function mergeSlotProps(slotPropsA, slotPropsB) {
240
240
  if (!slotPropsA) {
@@ -250,8 +250,7 @@ function mergeSlotProps(slotPropsA, slotPropsB) {
250
250
 
251
251
  /**
252
252
  * The `textField` slot props cannot be handled inside `PickerFieldUI` because it would be a breaking change to not pass the enriched props to `useField`.
253
- * Once the non-accessible DOM structure will be removed, we will be able to remove the `textField` slot and clean this logic.
254
- * TODO: Address with the needed support for the `textField` slotProps given the change of minimum version of MUI.
253
+ * TODO v10: Remove the `textField` slot and clean this logic up.
255
254
  */
256
255
  function useFieldTextFieldProps(parameters) {
257
256
  const {
@@ -262,15 +261,28 @@ function useFieldTextFieldProps(parameters) {
262
261
  const pickerFieldUIContext = React.useContext(PickerFieldUIContext);
263
262
  const pickerContext = (0, _useNullablePickerContext.useNullablePickerContext)();
264
263
  const ownerState = (0, _useFieldOwnerState.useFieldOwnerState)(externalForwardedProps);
265
- const {
266
- InputProps,
267
- inputProps
268
- } = externalForwardedProps,
269
- otherExternalForwardedProps = (0, _objectWithoutPropertiesLoose2.default)(externalForwardedProps, _excluded6);
264
+
265
+ // TODO v10: remove
266
+ // Strip the legacy `InputProps` / `inputProps` / `InputLabelProps` / `FormHelperTextProps`
267
+ // before they reach `PickersTextField`, which would silently ignore them. JS users without
268
+ // TypeScript checks would otherwise see their configuration vanish.
269
+ const _ref2 = externalForwardedProps ?? {},
270
+ {
271
+ InputProps: legacyInputProps,
272
+ inputProps: legacyHtmlInputProps,
273
+ InputLabelProps: legacyInputLabelProps,
274
+ FormHelperTextProps: legacyFormHelperTextProps
275
+ } = _ref2,
276
+ sanitizedExternalForwardedProps = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded6);
277
+ if (process.env.NODE_ENV !== 'production') {
278
+ if (legacyInputProps || legacyHtmlInputProps || legacyInputLabelProps || legacyFormHelperTextProps) {
279
+ (0, _warning.warnOnce)(['MUI X: Field components no longer accept the `InputProps`, `inputProps`, `InputLabelProps` and `FormHelperTextProps` props.', 'They have been dropped to avoid leaking unknown attributes onto the underlying form control.', 'Use the nested `slotProps.textField.slotProps.{input,htmlInput,inputLabel,formHelperText}` shape instead.']);
280
+ }
281
+ }
270
282
  const textFieldProps = (0, _useSlotProps5.default)({
271
283
  elementType: _PickersTextField.PickersTextField,
272
284
  externalSlotProps: mergeSlotProps(pickerFieldUIContext.slotProps.textField, slotProps?.textField),
273
- externalForwardedProps: otherExternalForwardedProps,
285
+ externalForwardedProps: sanitizedExternalForwardedProps,
274
286
  additionalProps: {
275
287
  ref,
276
288
  sx: pickerContext?.rootSx,
@@ -316,10 +328,6 @@ function useFieldTextFieldProps(parameters) {
316
328
  }
317
329
  };
318
330
  }
319
-
320
- // TODO: Remove when mui/material-ui#35088 will be merged
321
- textFieldProps.inputProps = (0, _extends2.default)({}, inputProps, textFieldProps.inputProps);
322
- textFieldProps.InputProps = (0, _extends2.default)({}, InputProps, textFieldProps.InputProps);
323
331
  return textFieldProps;
324
332
  }
325
333
  function PickerFieldUIContextProvider(props) {