@mui/x-date-pickers 7.10.0 → 7.11.1

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 (72) hide show
  1. package/AdapterDayjs/AdapterDayjs.js +4 -3
  2. package/CHANGELOG.md +169 -0
  3. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +4 -4
  4. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +2 -3
  5. package/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
  6. package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +1 -1
  7. package/PickersLayout/PickersLayout.d.ts +4 -4
  8. package/PickersLayout/PickersLayout.js +2 -4
  9. package/PickersLayout/PickersLayout.types.d.ts +0 -4
  10. package/PickersTextField/PickersInput/pickersInputClasses.d.ts +1 -1
  11. package/TimeClock/Clock.js +21 -32
  12. package/TimeClock/clockClasses.d.ts +2 -0
  13. package/TimeClock/clockClasses.js +1 -1
  14. package/index.js +1 -1
  15. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
  16. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +2 -2
  17. package/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.d.ts +9 -1
  18. package/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
  19. package/internals/hooks/useField/useField.js +3 -1
  20. package/internals/hooks/useField/useFieldV6TextField.js +3 -2
  21. package/internals/hooks/useField/useFieldV7TextField.js +1 -1
  22. package/internals/hooks/usePicker/usePicker.js +2 -3
  23. package/internals/index.d.ts +1 -1
  24. package/internals/index.js +1 -1
  25. package/internals/utils/warning.d.ts +2 -4
  26. package/internals/utils/warning.js +17 -24
  27. package/locales/index.d.ts +1 -0
  28. package/locales/index.js +1 -0
  29. package/locales/koKR.js +14 -16
  30. package/locales/nnNO.d.ts +80 -0
  31. package/locales/nnNO.js +73 -0
  32. package/locales/ruRU.js +15 -18
  33. package/models/pickers.d.ts +1 -1
  34. package/modern/AdapterDayjs/AdapterDayjs.js +4 -3
  35. package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +2 -3
  36. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
  37. package/modern/PickersLayout/PickersLayout.js +2 -4
  38. package/modern/TimeClock/Clock.js +21 -32
  39. package/modern/TimeClock/clockClasses.js +1 -1
  40. package/modern/index.js +1 -1
  41. package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
  42. package/modern/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
  43. package/modern/internals/hooks/useField/useField.js +3 -1
  44. package/modern/internals/hooks/useField/useFieldV6TextField.js +3 -2
  45. package/modern/internals/hooks/useField/useFieldV7TextField.js +1 -1
  46. package/modern/internals/hooks/usePicker/usePicker.js +2 -3
  47. package/modern/internals/index.js +1 -1
  48. package/modern/internals/utils/warning.js +17 -24
  49. package/modern/locales/index.js +1 -0
  50. package/modern/locales/koKR.js +14 -16
  51. package/modern/locales/nnNO.js +73 -0
  52. package/modern/locales/ruRU.js +15 -18
  53. package/node/AdapterDayjs/AdapterDayjs.js +3 -2
  54. package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +3 -4
  55. package/node/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
  56. package/node/PickersLayout/PickersLayout.js +2 -4
  57. package/node/TimeClock/Clock.js +21 -32
  58. package/node/TimeClock/clockClasses.js +1 -1
  59. package/node/index.js +1 -1
  60. package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
  61. package/node/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
  62. package/node/internals/hooks/useField/useField.js +3 -1
  63. package/node/internals/hooks/useField/useFieldV6TextField.js +3 -2
  64. package/node/internals/hooks/useField/useFieldV7TextField.js +1 -1
  65. package/node/internals/hooks/usePicker/usePicker.js +1 -2
  66. package/node/internals/index.js +6 -12
  67. package/node/internals/utils/warning.js +19 -27
  68. package/node/locales/index.js +11 -0
  69. package/node/locales/koKR.js +14 -16
  70. package/node/locales/nnNO.js +79 -0
  71. package/node/locales/ruRU.js +15 -18
  72. package/package.json +4 -4
@@ -6,12 +6,11 @@ import customParseFormatPlugin from 'dayjs/plugin/customParseFormat';
6
6
  import localizedFormatPlugin from 'dayjs/plugin/localizedFormat';
7
7
  import isBetweenPlugin from 'dayjs/plugin/isBetween';
8
8
  import advancedFormatPlugin from 'dayjs/plugin/advancedFormat';
9
- import { buildWarning } from '../internals/utils/warning';
9
+ import { warnOnce } from '../internals/utils/warning';
10
10
  defaultDayjs.extend(localizedFormatPlugin);
11
11
  defaultDayjs.extend(weekOfYearPlugin);
12
12
  defaultDayjs.extend(isBetweenPlugin);
13
13
  defaultDayjs.extend(advancedFormatPlugin);
14
- const localeNotFoundWarning = buildWarning(['Your locale has not been found.', 'Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale', "Or you forget to import the locale from 'dayjs/locale/{localeUsed}'", 'fallback on English locale']);
15
14
  const formatTokenMap = {
16
15
  // Year
17
16
  YY: 'year',
@@ -234,7 +233,9 @@ export class AdapterDayjs {
234
233
  const locale = this.locale || 'en';
235
234
  let localeObject = locales[locale];
236
235
  if (localeObject === undefined) {
237
- localeNotFoundWarning();
236
+ if (process.env.NODE_ENV !== 'production') {
237
+ warnOnce(['MUI X: Your locale has not been found.', 'Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale.', "Or you forget to import the locale from 'dayjs/locale/{localeUsed}'", 'fallback on English locale.']);
238
+ }
238
239
  localeObject = locales.en;
239
240
  }
240
241
  return localeObject.formats;
package/CHANGELOG.md CHANGED
@@ -3,6 +3,175 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.11.1
7
+
8
+ _Jul 25, 2024_
9
+
10
+ We'd like to offer a big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🔎 Allow `Zoom` to be controllable for charts (#13858) @JCQuintas
13
+ - 🌍 Add Icelandic (is-IS) and Norwegian Nynorsk (nn-NO) locales on the Data Grid
14
+ - 🌍 Improve Norwegian Bokmål (nb-NO) and German (de-DE) locales on the Data Grid
15
+ - 🌍 Add Norwegian Nynorsk (nn-NO) locale on the Date and Time Pickers
16
+ - 🐞 Bugfixes
17
+ - 📚 Documentation improvements
18
+
19
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
20
+
21
+ ### Data Grid
22
+
23
+ #### `@mui/x-data-grid@7.11.1`
24
+
25
+ - [DataGrid] Remove dead code in internal `GridPreferencesPanel` (#13934) @k-rajat19
26
+ - [DataGrid] Do not miss to escape formulas in CSV export (#13888) @arminmeh
27
+ - [l10n] Add Icelandic (is-IS) locale (#13283) @magnimarels
28
+ - [l10n] Add Norwegian nynorsk (nn-NO) locale and improve Norwegian bokmål (nb-NO) locale (#13588) @AnderzL7
29
+ - [l10n] Improve German (de-DE) locale (#13910) @lhilgert9
30
+
31
+ #### `@mui/x-data-grid-pro@7.11.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
32
+
33
+ Same changes as in `@mui/x-data-grid@7.11.1`.
34
+
35
+ #### `@mui/x-data-grid-premium@7.11.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
36
+
37
+ Same changes as in `@mui/x-data-grid-pro@7.11.1`, plus:
38
+
39
+ - [DataGridPremium] Pass the `api` object to events (#13893) @pcorpet
40
+ - [DataGridPremium] Fix paste to selected cells (#13967) @romgrk
41
+
42
+ ### Date and Time Pickers
43
+
44
+ #### `@mui/x-date-pickers@7.11.1`
45
+
46
+ - [fields] Prevent keyboard editing when disabled (#13900) @arthurbalduini
47
+ - [l10n] Add Norwegian Nynorsk (nn-NO) locale (#13946) @AnderzL7
48
+
49
+ #### `@mui/x-date-pickers-pro@7.11.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
50
+
51
+ Same changes as in `@mui/x-date-pickers@7.11.1`.
52
+
53
+ ### Charts
54
+
55
+ #### `@mui/x-charts@7.11.1`
56
+
57
+ - [charts] Add `ownerState` function to `slotProps` typing when available (#13965) @alexfauquette
58
+ - [charts] Allow `Zoom` to be controllable (#13858) @JCQuintas
59
+ - [charts] Deprecate `xAxisKey` /`zAxisKey` in favor of `xAxisId`/`zAxisId` (#13940) @alexfauquette
60
+ - [charts] Hide empty arcs in the PieChart (#13897) @alexfauquette
61
+ - [charts] Limit the trigger of exit charts (#13682) @alexfauquette
62
+
63
+ ### Tree View
64
+
65
+ #### `@mui/x-tree-view@7.11.1`
66
+
67
+ - [TreeView] Allow the plugins to enrich the props passed to the item slots (#13953) @flaviendelangle
68
+
69
+ ### Docs
70
+
71
+ - [docs] Bump pnpm priority as a package manager (#13894) @oliviertassinari
72
+ - [docs] Explicitly mark charts pro as not released (#13905) @alexfauquette
73
+ - [docs] Fix dot consistency a11y table @oliviertassinari
74
+ - [docs] Fix some typos in charts docs (#13906) @cratiu222
75
+ - [docs] Fix spelling (#13902) @nnsW3
76
+ - [docs] Improve error message when moving between plans (#13874) @oliviertassinari
77
+ - [docs] Update `SparkLineChart` reference not being correctly capitalised (#13960) @duckboy81
78
+ - [docs] Fix scroll demos disorientation (#13909) @oliviertassinari
79
+
80
+ ### Core
81
+
82
+ - [core] Add `@mui/material-nextjs` to `MUI Core` renovate group (#13966) @LukasTy
83
+ - [core] Remove warning message in production (#13911) @oliviertassinari
84
+ - [code-infra] Reuse `useReactVersion` script from the monorepo (#13710) @cherniavskii
85
+ - [infra] Adds order id validation action (#13957) @michelengelen
86
+ - [infra] Fix order id validator action (#13971) @michelengelen
87
+ - [infra] Fix regex in order id validation (#13976) @michelengelen
88
+ - [infra] Issue template improvement (#13954) @michelengelen
89
+
90
+ ## 7.11.0
91
+
92
+ _Jul 18, 2024_
93
+
94
+ We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
95
+
96
+ - 🎨 Add [color legend](https://mui.com/x/react-charts/legend/#color-legend) for charts (#13700) @alexfauquette
97
+ - 🌍 Improve Korean (ko-KR) locale on the Date and Time Pickers
98
+ - 🌍 Improve Russian (ru-RU) locale on the Date and Time Pickers and Data Grid
99
+ - 🐞 Bugfixes
100
+ - 📚 Documentation improvements
101
+
102
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
103
+
104
+ ### Data Grid
105
+
106
+ #### `@mui/x-data-grid@7.11.0`
107
+
108
+ - [DataGrid] Expose `gridEditRowsStateSelector` (#13877) @romgrk
109
+ - [DataGrid] Fix `columnResizeStop` event not emitted when column is not resized (#13307) @mateuseap
110
+ - [DataGrid] Fix delete filter inconsistent behavior (#13353) @oukunan
111
+ - [DataGrid] Enable flip on preferences panel (#13803) @romgrk
112
+ - [DataGrid] Support `date` and `datetime-local` input types in `GridFilterInputMultipleValue` type (#13411) @karudedios
113
+ - [l10n] Improve Russian (ru-RU) locale (#13735) @diro-atk
114
+
115
+ #### `@mui/x-data-grid-pro@7.11.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
116
+
117
+ Same changes as in `@mui/x-data-grid@7.11.0`.
118
+
119
+ #### `@mui/x-data-grid-premium@7.11.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
120
+
121
+ Same changes as in `@mui/x-data-grid-pro@7.11.0`.
122
+
123
+ ### Date and Time Pickers
124
+
125
+ #### `@mui/x-date-pickers@7.11.0`
126
+
127
+ - [l10n] Improve Korean (ko-KR) locale (#13651) @100pearlcent
128
+ - [l10n] Improve Russian (ru-RU) locale (#13871) @Inv1x
129
+ - [pickers] Add more conformance tests improving API docs precision (#13800) @LukasTy
130
+ - [TimePicker] Add `Mui-selected` class to `TimeClock` meridiem buttons (#13848) @LukasTy
131
+
132
+ #### `@mui/x-date-pickers-pro@7.11.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
133
+
134
+ Same changes as in `@mui/x-date-pickers@7.11.0`, plus:
135
+
136
+ - [DateRangePicker] Fix `name` prop propagation regression (#13821) @LukasTy
137
+
138
+ ### Charts
139
+
140
+ #### `@mui/x-charts@7.11.0`
141
+
142
+ - [charts] Create color legend (#13700) @alexfauquette
143
+ - [charts] Defaultize axis on top level `useChartContainerProps` (#13817) @JCQuintas
144
+ - [charts] Fix charts not passing `className` to root element (#13647) @JCQuintas
145
+ - [charts] Generate API documentation for pro components (#13822) @alexfauquette
146
+ - [charts] Improve zoomed highlight behaviour (unreleased) (#13868) @JCQuintas
147
+ - [charts] Allow zoom on Y axis and add zoom options to configure zooming behaviour (unreleased) (#13726) @JCQuintas
148
+ - [charts] Disable animations while zooming (unreleased) (#13807) @JCQuintas
149
+
150
+ ### Tree View
151
+
152
+ #### `@mui/x-tree-view@7.11.0`
153
+
154
+ - [TreeView] Extract some logic outside of the `useTreeView` hook (#13845) @flaviendelangle
155
+
156
+ ### Docs
157
+
158
+ - [docs] Add warning about `process.env.NODE_ENV` in production (#13869) @cherniavskii
159
+ - [docs] Allow controlling the demo form from the example (#13796) @JCQuintas
160
+ - [docs] Clarify Pickers clearable behavior not working on mobile (#13786) @lnhrdt
161
+ - [docs] Improve the documentation of the picker's `onChange` and `onAccept` props (#13543) @flaviendelangle
162
+ - [docs] Replace company name with project name @oliviertassinari
163
+ - [docs] Sort Pickers & Charts API slots alphabetically (#13843) @LukasTy
164
+
165
+ ### Core
166
+
167
+ - [core] Add MUI Internal `renovate` group (#13846) @LukasTy
168
+ - [core] Link GitHub issue for `import/prefer-default-export` rule @oliviertassinari
169
+ - [core] Normalize `...other` and test imports in charts (#13844) @JCQuintas
170
+ - [core] Normalize rest / other to match the most common used @oliviertassinari
171
+ - [code-infra] Follow `next` tag for `@mui/docs` package bumps (#13813) @LukasTy
172
+ - [code-infra] Use specific version for `@mui/docs` dependency (#13760) @LukasTy
173
+ - [internals] Move `EventManager` to `@mui/x-internals` package (#13815) @flaviendelangle
174
+
6
175
  ## 7.10.0
7
176
 
8
177
  _Jul 11, 2024_
@@ -2,11 +2,11 @@ import * as React from 'react';
2
2
  import { PickersLayoutProps } from '../PickersLayout';
3
3
  import { PickerValidDate } from '../models';
4
4
  import { DateOrTimeViewWithMeridiem } from '../internals/models/common';
5
+ type DesktopDateTimePickerLayoutComponent = (<TValue, TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TDate, TView> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
6
+ propTypes?: any;
7
+ };
5
8
  /**
6
9
  * @ignore - internal component.
7
10
  */
8
- declare function DesktopDateTimePickerLayout<TValue, TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TDate, TView>): React.JSX.Element;
9
- declare namespace DesktopDateTimePickerLayout {
10
- var propTypes: any;
11
- }
11
+ declare const DesktopDateTimePickerLayout: DesktopDateTimePickerLayoutComponent;
12
12
  export { DesktopDateTimePickerLayout };
@@ -9,7 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  /**
10
10
  * @ignore - internal component.
11
11
  */
12
- function DesktopDateTimePickerLayout(props) {
12
+ const DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function DesktopDateTimePickerLayout(props, ref) {
13
13
  const isRtl = useRtl();
14
14
  const {
15
15
  toolbar,
@@ -22,7 +22,6 @@ function DesktopDateTimePickerLayout(props) {
22
22
  sx,
23
23
  className,
24
24
  isLandscape,
25
- ref,
26
25
  classes
27
26
  } = props;
28
27
  const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
@@ -55,7 +54,7 @@ function DesktopDateTimePickerLayout(props) {
55
54
  })]
56
55
  }), actionBar]
57
56
  });
58
- }
57
+ });
59
58
  process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes = {
60
59
  // ----------------------------- Warning --------------------------------
61
60
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -152,7 +152,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
152
152
  const _useSlotProps = useSlotProps({
153
153
  elementType: SwitchViewIcon,
154
154
  externalSlotProps: slotProps?.switchViewIcon,
155
- ownerState: undefined,
155
+ ownerState,
156
156
  className: classes.switchViewIcon
157
157
  }),
158
158
  switchViewIconProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
@@ -25,7 +25,7 @@ export interface PickersCalendarHeaderSlotPropsOverrides {
25
25
  export type PickersCalendarHeaderOwnerState<TDate extends PickerValidDate> = PickersCalendarHeaderProps<TDate>;
26
26
  export interface PickersCalendarHeaderSlotProps<TDate extends PickerValidDate> extends PickersArrowSwitcherSlotProps {
27
27
  switchViewButton?: SlotComponentProps<typeof IconButton, PickersCalendarHeaderSlotPropsOverrides, PickersCalendarHeaderOwnerState<TDate>>;
28
- switchViewIcon?: SlotComponentProps<typeof SvgIcon, PickersCalendarHeaderSlotPropsOverrides, undefined>;
28
+ switchViewIcon?: SlotComponentProps<typeof SvgIcon, PickersCalendarHeaderSlotPropsOverrides, PickersCalendarHeaderOwnerState<TDate>>;
29
29
  }
30
30
  export interface PickersCalendarHeaderProps<TDate extends PickerValidDate> extends ExportedPickersArrowSwitcherProps, MonthValidationOptions<TDate> {
31
31
  /**
@@ -6,6 +6,9 @@ export declare const PickersLayoutRoot: import("@emotion/styled").StyledComponen
6
6
  ownerState: PickersLayoutProps<any, any, any>;
7
7
  }, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
8
8
  export declare const PickersLayoutContentWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
9
+ type PickersLayoutComponent = (<TValue, TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TDate, TView> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
10
+ propTypes?: any;
11
+ };
9
12
  /**
10
13
  * Demos:
11
14
  *
@@ -15,8 +18,5 @@ export declare const PickersLayoutContentWrapper: import("@emotion/styled").Styl
15
18
  *
16
19
  * - [PickersLayout API](https://mui.com/x/api/date-pickers/pickers-layout/)
17
20
  */
18
- declare const PickersLayout: {
19
- <TValue, TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem>(inProps: PickersLayoutProps<TValue, TDate, TView>): React.JSX.Element;
20
- propTypes: any;
21
- };
21
+ declare const PickersLayout: PickersLayoutComponent;
22
22
  export { PickersLayout };
@@ -89,7 +89,6 @@ export const PickersLayoutContentWrapper = styled('div', {
89
89
  display: 'flex',
90
90
  flexDirection: 'column'
91
91
  });
92
-
93
92
  /**
94
93
  * Demos:
95
94
  *
@@ -99,7 +98,7 @@ export const PickersLayoutContentWrapper = styled('div', {
99
98
  *
100
99
  * - [PickersLayout API](https://mui.com/x/api/date-pickers/pickers-layout/)
101
100
  */
102
- const PickersLayout = function PickersLayout(inProps) {
101
+ const PickersLayout = /*#__PURE__*/React.forwardRef(function PickersLayout(inProps, ref) {
103
102
  const props = useThemeProps({
104
103
  props: inProps,
105
104
  name: 'MuiPickersLayout'
@@ -115,7 +114,6 @@ const PickersLayout = function PickersLayout(inProps) {
115
114
  sx,
116
115
  className,
117
116
  isLandscape,
118
- ref,
119
117
  wrapperVariant
120
118
  } = props;
121
119
  const classes = useUtilityClasses(props);
@@ -133,7 +131,7 @@ const PickersLayout = function PickersLayout(inProps) {
133
131
  })
134
132
  }), actionBar]
135
133
  });
136
- };
134
+ });
137
135
  process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
138
136
  // ----------------------------- Warning --------------------------------
139
137
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -76,10 +76,6 @@ export interface PickersLayoutProps<TValue, TDate extends PickerValidDate, TView
76
76
  * The system prop that allows defining system overrides as well as additional CSS styles.
77
77
  */
78
78
  sx?: SxProps<Theme>;
79
- /**
80
- * Ref to pass to the root element
81
- */
82
- ref?: React.Ref<HTMLDivElement>;
83
79
  /**
84
80
  * Override or extend the styles applied to the component.
85
81
  */
@@ -10,8 +10,8 @@ export declare const pickersInputClasses: {
10
10
  input: string;
11
11
  readOnly: string;
12
12
  error: string;
13
- focused: string;
14
13
  root: string;
14
+ focused: string;
15
15
  adornedStart: string;
16
16
  adornedEnd: string;
17
17
  notchedOutline: string;
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import * as React from 'react';
2
3
  import clsx from 'clsx';
3
4
  import IconButton from '@mui/material/IconButton';
@@ -13,7 +14,8 @@ import { formatMeridiem } from '../internals/utils/date-utils';
13
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
15
  const useUtilityClasses = ownerState => {
15
16
  const {
16
- classes
17
+ classes,
18
+ meridiemMode
17
19
  } = ownerState;
18
20
  const slots = {
19
21
  root: ['root'],
@@ -21,8 +23,8 @@ const useUtilityClasses = ownerState => {
21
23
  wrapper: ['wrapper'],
22
24
  squareMask: ['squareMask'],
23
25
  pin: ['pin'],
24
- amButton: ['amButton'],
25
- pmButton: ['pmButton'],
26
+ amButton: ['amButton', meridiemMode === 'am' && 'selected'],
27
+ pmButton: ['pmButton', meridiemMode === 'pm' && 'selected'],
26
28
  meridiemText: ['meridiemText']
27
29
  };
28
30
  return composeClasses(slots, getClockUtilityClass, classes);
@@ -105,23 +107,15 @@ const ClockPin = styled('div', {
105
107
  left: '50%',
106
108
  transform: 'translate(-50%, -50%)'
107
109
  }));
108
- const ClockAmButton = styled(IconButton, {
109
- name: 'MuiClock',
110
- slot: 'AmButton',
111
- overridesResolver: (_, styles) => styles.amButton
112
- })(({
113
- theme
114
- }) => ({
110
+ const meridiemButtonCommonStyles = (theme, meridiemMode) => ({
115
111
  zIndex: 1,
116
- position: 'absolute',
117
112
  bottom: 8,
118
- left: 8,
119
113
  paddingLeft: 4,
120
114
  paddingRight: 4,
121
115
  width: CLOCK_HOUR_WIDTH,
122
116
  variants: [{
123
117
  props: {
124
- meridiemMode: 'am'
118
+ meridiemMode
125
119
  },
126
120
  style: {
127
121
  backgroundColor: (theme.vars || theme).palette.primary.main,
@@ -131,6 +125,17 @@ const ClockAmButton = styled(IconButton, {
131
125
  }
132
126
  }
133
127
  }]
128
+ });
129
+ const ClockAmButton = styled(IconButton, {
130
+ name: 'MuiClock',
131
+ slot: 'AmButton',
132
+ overridesResolver: (_, styles) => styles.amButton
133
+ })(({
134
+ theme
135
+ }) => _extends({}, meridiemButtonCommonStyles(theme, 'am'), {
136
+ // keeping it here to make TS happy
137
+ position: 'absolute',
138
+ left: 8
134
139
  }));
135
140
  const ClockPmButton = styled(IconButton, {
136
141
  name: 'MuiClock',
@@ -138,26 +143,10 @@ const ClockPmButton = styled(IconButton, {
138
143
  overridesResolver: (_, styles) => styles.pmButton
139
144
  })(({
140
145
  theme
141
- }) => ({
142
- zIndex: 1,
146
+ }) => _extends({}, meridiemButtonCommonStyles(theme, 'pm'), {
147
+ // keeping it here to make TS happy
143
148
  position: 'absolute',
144
- bottom: 8,
145
- right: 8,
146
- paddingLeft: 4,
147
- paddingRight: 4,
148
- width: CLOCK_HOUR_WIDTH,
149
- variants: [{
150
- props: {
151
- meridiemMode: 'pm'
152
- },
153
- style: {
154
- backgroundColor: (theme.vars || theme).palette.primary.main,
155
- color: (theme.vars || theme).palette.primary.contrastText,
156
- '&:hover': {
157
- backgroundColor: (theme.vars || theme).palette.primary.light
158
- }
159
- }
160
- }]
149
+ right: 8
161
150
  }));
162
151
  const ClockMeridiemText = styled(Typography, {
163
152
  name: 'MuiClock',
@@ -15,6 +15,8 @@ export interface ClockClasses {
15
15
  pmButton: string;
16
16
  /** Styles applied to the meridiem typography element. */
17
17
  meridiemText: string;
18
+ /** Styles applied to the selected meridiem button element */
19
+ selected: string;
18
20
  }
19
21
  export type ClockClassKey = keyof ClockClasses;
20
22
  export declare function getClockUtilityClass(slot: string): string;
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClass as generateUtilityClass, unstable_generat
2
2
  export function getClockUtilityClass(slot) {
3
3
  return generateUtilityClass('MuiClock', slot);
4
4
  }
5
- export const clockClasses = generateUtilityClasses('MuiClock', ['root', 'clock', 'wrapper', 'squareMask', 'pin', 'amButton', 'pmButton', 'meridiemText']);
5
+ export const clockClasses = generateUtilityClasses('MuiClock', ['root', 'clock', 'wrapper', 'squareMask', 'pin', 'amButton', 'pmButton', 'meridiemText', 'selected']);
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.10.0
2
+ * @mui/x-date-pickers v7.11.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -51,7 +51,11 @@ const useUtilityClasses = ownerState => {
51
51
  const slots = {
52
52
  root: ['root'],
53
53
  spacer: ['spacer'],
54
- button: ['button']
54
+ button: ['button'],
55
+ previousIconButton: ['previousIconButton'],
56
+ nextIconButton: ['nextIconButton'],
57
+ leftArrowIcon: ['leftArrowIcon'],
58
+ rightArrowIcon: ['rightArrowIcon']
55
59
  };
56
60
  return composeClasses(slots, getPickersArrowSwitcherUtilityClass, classes);
57
61
  };
@@ -106,7 +110,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
106
110
  ownerState: _extends({}, ownerState, {
107
111
  hidden: previousProps.isHidden
108
112
  }),
109
- className: classes.button
113
+ className: clsx(classes.button, classes.previousIconButton)
110
114
  });
111
115
  const NextIconButton = slots?.nextIconButton ?? PickersArrowSwitcherButton;
112
116
  const nextIconButtonProps = useSlotProps({
@@ -123,7 +127,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
123
127
  ownerState: _extends({}, ownerState, {
124
128
  hidden: nextProps.isHidden
125
129
  }),
126
- className: classes.button
130
+ className: clsx(classes.button, classes.nextIconButton)
127
131
  });
128
132
  const LeftArrowIcon = slots?.leftArrowIcon ?? ArrowLeftIcon;
129
133
  // The spread is here to avoid this bug mui/material-ui#34056
@@ -133,7 +137,8 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
133
137
  additionalProps: {
134
138
  fontSize: 'inherit'
135
139
  },
136
- ownerState: undefined
140
+ ownerState,
141
+ className: classes.leftArrowIcon
137
142
  }),
138
143
  leftArrowIconProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
139
144
  const RightArrowIcon = slots?.rightArrowIcon ?? ArrowRightIcon;
@@ -144,7 +149,8 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
144
149
  additionalProps: {
145
150
  fontSize: 'inherit'
146
151
  },
147
- ownerState: undefined
152
+ ownerState,
153
+ className: classes.rightArrowIcon
148
154
  }),
149
155
  rightArrowIconProps = _objectWithoutPropertiesLoose(_useSlotProps2, _excluded3);
150
156
  return /*#__PURE__*/_jsxs(PickersArrowSwitcherRoot, _extends({
@@ -67,6 +67,6 @@ export interface PickersArrowSwitcherButtonSlotOwnerState extends PickersArrowSw
67
67
  export interface PickersArrowSwitcherSlotProps {
68
68
  previousIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherButtonSlotOwnerState>;
69
69
  nextIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherButtonSlotOwnerState>;
70
- leftArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, undefined>;
71
- rightArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, undefined>;
70
+ leftArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherButtonSlotOwnerState>;
71
+ rightArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherButtonSlotOwnerState>;
72
72
  }
@@ -5,7 +5,15 @@ export interface PickersArrowSwitcherClasses {
5
5
  spacer: string;
6
6
  /** Styles applied to the button element. */
7
7
  button: string;
8
+ /** Styles applied to the previous icon button element. */
9
+ previousIconButton: string;
10
+ /** Styles applied to the next icon button element. */
11
+ nextIconButton: string;
12
+ /** Styles applied to the left icon element. */
13
+ leftArrowIcon: string;
14
+ /** Styles applied to the right icon element. */
15
+ rightArrowIcon: string;
8
16
  }
9
17
  export type PickersArrowSwitcherClassKey = keyof PickersArrowSwitcherClasses;
10
18
  export declare function getPickersArrowSwitcherUtilityClass(slot: string): string;
11
- export declare const pickersArrowSwitcherClasses: Record<"button" | "root" | "spacer", string>;
19
+ export declare const pickersArrowSwitcherClasses: Record<"button" | "root" | "spacer" | "previousIconButton" | "nextIconButton" | "leftArrowIcon" | "rightArrowIcon", string>;
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClass as generateUtilityClass, unstable_generat
2
2
  export function getPickersArrowSwitcherUtilityClass(slot) {
3
3
  return generateUtilityClass('MuiPickersArrowSwitcher', slot);
4
4
  }
5
- export const pickersArrowSwitcherClasses = generateUtilityClasses('MuiPickersArrowSwitcher', ['root', 'spacer', 'button']);
5
+ export const pickersArrowSwitcherClasses = generateUtilityClasses('MuiPickersArrowSwitcher', ['root', 'spacer', 'button', 'previousIconButton', 'nextIconButton', 'leftArrowIcon', 'rightArrowIcon']);
@@ -69,7 +69,9 @@ export const useField = params => {
69
69
  }));
70
70
  const handleContainerKeyDown = useEventCallback(event => {
71
71
  onKeyDown?.(event);
72
-
72
+ if (disabled) {
73
+ return;
74
+ }
73
75
  // eslint-disable-next-line default-case
74
76
  switch (true) {
75
77
  // Select all
@@ -47,7 +47,8 @@ export const useFieldV6TextField = params => {
47
47
  placeholder: inPlaceholder
48
48
  },
49
49
  internalProps: {
50
- readOnly = false
50
+ readOnly = false,
51
+ disabled = false
51
52
  },
52
53
  parsedSelectedSections,
53
54
  activeSectionIndex,
@@ -188,7 +189,7 @@ export const useFieldV6TextField = params => {
188
189
 
189
190
  // prevent default to avoid the input `onChange` handler being called
190
191
  event.preventDefault();
191
- if (readOnly) {
192
+ if (readOnly || disabled) {
192
193
  return;
193
194
  }
194
195
  const pastedValue = event.clipboardData.getData('text');
@@ -236,7 +236,7 @@ export const useFieldV7TextField = params => {
236
236
  const handleInputContentPaste = useEventCallback(event => {
237
237
  // prevent default to avoid the input `onInput` handler being called
238
238
  event.preventDefault();
239
- if (readOnly || typeof parsedSelectedSections !== 'number') {
239
+ if (readOnly || disabled || typeof parsedSelectedSections !== 'number') {
240
240
  return;
241
241
  }
242
242
  const activeSection = state.sections[parsedSelectedSections];
@@ -1,8 +1,7 @@
1
1
  import { usePickerValue } from './usePickerValue';
2
2
  import { usePickerViews } from './usePickerViews';
3
3
  import { usePickerLayoutProps } from './usePickerLayoutProps';
4
- import { buildWarning } from '../../utils/warning';
5
- const warnRenderInputIsDefined = buildWarning(['The `renderInput` prop has been removed in version 6.0 of the Date and Time Pickers.', 'You can replace it with the `textField` component slot in most cases.', 'For more information, please have a look at the migration guide (https://mui.com/x/migration/migration-pickers-v5/#input-renderer-required-in-v5).']);
4
+ import { warnOnce } from '../../utils/warning';
6
5
  export const usePicker = ({
7
6
  props,
8
7
  valueManager,
@@ -16,7 +15,7 @@ export const usePicker = ({
16
15
  }) => {
17
16
  if (process.env.NODE_ENV !== 'production') {
18
17
  if (props.renderInput != null) {
19
- warnRenderInputIsDefined();
18
+ warnOnce(['MUI X: The `renderInput` prop has been removed in version 6.0 of the Date and Time Pickers.', 'You can replace it with the `textField` component slot in most cases.', 'For more information, please have a look at the migration guide (https://mui.com/x/migration/migration-pickers-v5/#input-renderer-required-in-v5).']);
20
19
  }
21
20
  }
22
21
  const pickerValueResponse = usePickerValue({
@@ -59,7 +59,7 @@ export { validateDate } from './utils/validation/validateDate';
59
59
  export { validateDateTime } from './utils/validation/validateDateTime';
60
60
  export { validateTime } from './utils/validation/validateTime';
61
61
  export { applyDefaultViewProps } from './utils/views';
62
- export { buildDeprecatedPropsWarning, buildWarning } from './utils/warning';
62
+ export { warnOnce } from './utils/warning';
63
63
  export { DayCalendar } from '../DateCalendar/DayCalendar';
64
64
  export type { DayCalendarProps, DayCalendarSlots, DayCalendarSlotProps, ExportedDayCalendarProps, } from '../DateCalendar/DayCalendar';
65
65
  export type { ExportedDateCalendarProps } from '../DateCalendar/DateCalendar.types';
@@ -30,7 +30,7 @@ export { validateDate } from './utils/validation/validateDate';
30
30
  export { validateDateTime } from './utils/validation/validateDateTime';
31
31
  export { validateTime } from './utils/validation/validateTime';
32
32
  export { applyDefaultViewProps } from './utils/views';
33
- export { buildDeprecatedPropsWarning, buildWarning } from './utils/warning';
33
+ export { warnOnce } from './utils/warning';
34
34
  export { DayCalendar } from '../DateCalendar/DayCalendar';
35
35
  export { useCalendarState } from '../DateCalendar/useCalendarState';
36
36
  export { isInternalTimeView, isTimeView } from './utils/time-utils';
@@ -1,4 +1,2 @@
1
- export declare const buildDeprecatedPropsWarning: (message: string | string[]) => (deprecatedProps: {
2
- [key: string]: any;
3
- }) => void;
4
- export declare const buildWarning: (message: string | string[], gravity?: "warning" | "error") => () => void;
1
+ export declare function warnOnce(message: string | string[], gravity?: 'warning' | 'error'): void;
2
+ export declare function clearWarningsCache(): void;