@mui/x-date-pickers 7.9.0 → 7.11.0
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 +159 -0
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +4 -4
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +2 -3
- package/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +1 -1
- package/PickersLayout/PickersLayout.d.ts +4 -4
- package/PickersLayout/PickersLayout.js +2 -4
- package/PickersLayout/PickersLayout.types.d.ts +0 -4
- package/PickersTextField/PickersInput/pickersInputClasses.d.ts +1 -1
- package/TimeClock/Clock.js +21 -32
- package/TimeClock/clockClasses.d.ts +2 -0
- package/TimeClock/clockClasses.js +1 -1
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +2 -2
- package/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.d.ts +9 -1
- package/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
- package/internals/hooks/useField/useFieldV6TextField.js +10 -9
- package/internals/hooks/useField/useFieldV7TextField.js +1 -4
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/internals/utils/date-time-utils.d.ts +1 -1
- package/locales/koKR.js +14 -16
- package/locales/ruRU.js +15 -18
- package/models/pickers.d.ts +1 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +2 -3
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/modern/PickersLayout/PickersLayout.js +2 -4
- package/modern/TimeClock/Clock.js +21 -32
- package/modern/TimeClock/clockClasses.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
- package/modern/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
- package/modern/internals/hooks/useField/useFieldV6TextField.js +10 -9
- package/modern/internals/hooks/useField/useFieldV7TextField.js +1 -4
- package/modern/internals/index.js +1 -1
- package/modern/locales/koKR.js +14 -16
- package/modern/locales/ruRU.js +15 -18
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +3 -4
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/node/PickersLayout/PickersLayout.js +2 -4
- package/node/TimeClock/Clock.js +21 -32
- package/node/TimeClock/clockClasses.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
- package/node/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
- package/node/internals/hooks/useField/useFieldV6TextField.js +10 -9
- package/node/internals/hooks/useField/useFieldV7TextField.js +1 -4
- package/node/internals/index.js +6 -0
- package/node/locales/koKR.js +14 -16
- package/node/locales/ruRU.js +15 -18
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,165 @@
|
|
|
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.0
|
|
7
|
+
|
|
8
|
+
_Jul 18, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎨 Add [color legend](https://mui.com/x/react-charts/legend/#color-legend) for charts (#13700) @alexfauquette
|
|
13
|
+
- 🌍 Improve Korean (ko-KR) locale on the Date and Time Pickers
|
|
14
|
+
- 🌍 Improve Russian (ru-RU) locale on the Date and Time Pickers and Data Grid
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
- 📚 Documentation improvements
|
|
17
|
+
|
|
18
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
19
|
+
|
|
20
|
+
### Data Grid
|
|
21
|
+
|
|
22
|
+
#### `@mui/x-data-grid@7.11.0`
|
|
23
|
+
|
|
24
|
+
- [DataGrid] Expose `gridEditRowsStateSelector` (#13877) @romgrk
|
|
25
|
+
- [DataGrid] Fix `columnResizeStop` event not emitted when column is not resized (#13307) @mateuseap
|
|
26
|
+
- [DataGrid] Fix delete filter inconsistent behavior (#13353) @oukunan
|
|
27
|
+
- [DataGrid] Enable flip on preferences panel (#13803) @romgrk
|
|
28
|
+
- [DataGrid] Support `date` and `datetime-local` input types in `GridFilterInputMultipleValue` type (#13411) @karudedios
|
|
29
|
+
- [l10n] Improve Russian (ru-RU) locale (#13735) @diro-atk
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid-pro@7.11.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
32
|
+
|
|
33
|
+
Same changes as in `@mui/x-data-grid@7.11.0`.
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-data-grid-premium@7.11.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
36
|
+
|
|
37
|
+
Same changes as in `@mui/x-data-grid-pro@7.11.0`.
|
|
38
|
+
|
|
39
|
+
### Date and Time Pickers
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-date-pickers@7.11.0`
|
|
42
|
+
|
|
43
|
+
- [l10n] Improve Korean (ko-KR) locale (#13651) @100pearlcent
|
|
44
|
+
- [l10n] Improve Russian (ru-RU) locale (#13871) @Inv1x
|
|
45
|
+
- [pickers] Add more conformance tests improving API docs precision (#13800) @LukasTy
|
|
46
|
+
- [TimePicker] Add `Mui-selected` class to `TimeClock` meridiem buttons (#13848) @LukasTy
|
|
47
|
+
|
|
48
|
+
#### `@mui/x-date-pickers-pro@7.11.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
49
|
+
|
|
50
|
+
Same changes as in `@mui/x-date-pickers@7.11.0`, plus:
|
|
51
|
+
|
|
52
|
+
- [DateRangePicker] Fix `name` prop propagation regression (#13821) @LukasTy
|
|
53
|
+
|
|
54
|
+
### Charts
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-charts@7.11.0`
|
|
57
|
+
|
|
58
|
+
- [charts] Create color legend (#13700) @alexfauquette
|
|
59
|
+
- [charts] Defaultize axis on top level `useChartContainerProps` (#13817) @JCQuintas
|
|
60
|
+
- [charts] Fix charts not passing `className` to root element (#13647) @JCQuintas
|
|
61
|
+
- [charts] Generate API documentation for pro components (#13822) @alexfauquette
|
|
62
|
+
- [charts] Improve zoomed highlight behaviour (unreleased) (#13868) @JCQuintas
|
|
63
|
+
- [charts] Allow zoom on Y axis and add zoom options to configure zooming behaviour (unreleased) (#13726) @JCQuintas
|
|
64
|
+
- [charts] Disable animations while zooming (unreleased) (#13807) @JCQuintas
|
|
65
|
+
|
|
66
|
+
### Tree View
|
|
67
|
+
|
|
68
|
+
#### `@mui/x-tree-view@7.11.0`
|
|
69
|
+
|
|
70
|
+
- [TreeView] Extract some logic outside of the `useTreeView` hook (#13845) @flaviendelangle
|
|
71
|
+
|
|
72
|
+
### Docs
|
|
73
|
+
|
|
74
|
+
- [docs] Add warning about `process.env.NODE_ENV` in production (#13869) @cherniavskii
|
|
75
|
+
- [docs] Allow controlling the demo form from the example (#13796) @JCQuintas
|
|
76
|
+
- [docs] Clarify Pickers clearable behavior not working on mobile (#13786) @lnhrdt
|
|
77
|
+
- [docs] Improve the documentation of the picker's `onChange` and `onAccept` props (#13543) @flaviendelangle
|
|
78
|
+
- [docs] Replace company name with project name @oliviertassinari
|
|
79
|
+
- [docs] Sort Pickers & Charts API slots alphabetically (#13843) @LukasTy
|
|
80
|
+
|
|
81
|
+
### Core
|
|
82
|
+
|
|
83
|
+
- [core] Add MUI Internal `renovate` group (#13846) @LukasTy
|
|
84
|
+
- [core] Link GitHub issue for `import/prefer-default-export` rule @oliviertassinari
|
|
85
|
+
- [core] Normalize `...other` and test imports in charts (#13844) @JCQuintas
|
|
86
|
+
- [core] Normalize rest / other to match the most common used @oliviertassinari
|
|
87
|
+
- [code-infra] Follow `next` tag for `@mui/docs` package bumps (#13813) @LukasTy
|
|
88
|
+
- [code-infra] Use specific version for `@mui/docs` dependency (#13760) @LukasTy
|
|
89
|
+
- [internals] Move `EventManager` to `@mui/x-internals` package (#13815) @flaviendelangle
|
|
90
|
+
|
|
91
|
+
## 7.10.0
|
|
92
|
+
|
|
93
|
+
_Jul 11, 2024_
|
|
94
|
+
|
|
95
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
96
|
+
|
|
97
|
+
- 🎁 Add selectors to support showing child row count in footer in the Data Grid
|
|
98
|
+
- ✨ New APIs for retrieving current item tree and item's children IDs in the Tree View
|
|
99
|
+
- 🌍 Improve Spanish (es-ES) locale on the Data Grid
|
|
100
|
+
- 🐞 Bugfixes
|
|
101
|
+
- 📚 Documentation improvements
|
|
102
|
+
|
|
103
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
104
|
+
|
|
105
|
+
### Data Grid
|
|
106
|
+
|
|
107
|
+
#### `@mui/x-data-grid@7.10.0`
|
|
108
|
+
|
|
109
|
+
- [DataGrid] Add selectors to support showing child row count in footer (#13725) @KenanYusuf
|
|
110
|
+
- [DataGrid] Fix incorrect panels position when using a toolbar (#13474) @oukunan
|
|
111
|
+
- [DataGrid] Set default variant to `'standard'` in `GridFilterInputMultipleValue` (#13129) @tarunrajput
|
|
112
|
+
- [DataGrid] Use `readonly` on more array props (#13331) @pcorpet
|
|
113
|
+
- [l10n] Improve Spanish (es-ES) locale (#13772) @joserealdev
|
|
114
|
+
|
|
115
|
+
#### `@mui/x-data-grid-pro@7.10.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
116
|
+
|
|
117
|
+
Same changes as in `@mui/x-data-grid@7.10.0`, plus:
|
|
118
|
+
|
|
119
|
+
- [DataGridPro] Keep bottom pinned row at the bottom (#13313) @romgrk
|
|
120
|
+
|
|
121
|
+
#### `@mui/x-data-grid-premium@7.10.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
122
|
+
|
|
123
|
+
Same changes as in `@mui/x-data-grid-pro@7.10.0`.
|
|
124
|
+
|
|
125
|
+
### Date and Time Pickers
|
|
126
|
+
|
|
127
|
+
#### `@mui/x-date-pickers@7.10.0`
|
|
128
|
+
|
|
129
|
+
- [fields] Prevent infinite recursion when ensuring selection (#13779) @LukasTy
|
|
130
|
+
- [fields] Unify fields behavior regardless of the `readOnly` flag (#13688) @LukasTy
|
|
131
|
+
|
|
132
|
+
#### `@mui/x-date-pickers-pro@7.10.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
133
|
+
|
|
134
|
+
Same changes as in `@mui/x-date-pickers@7.10.0`, plus:
|
|
135
|
+
|
|
136
|
+
- [DateRangePicker] Fix `calendarHeader` slot props propagation (#13780) @LukasTy
|
|
137
|
+
- [DateTimeRangePicker] Resolve `format` from given `views` (#13743) @LukasTy
|
|
138
|
+
|
|
139
|
+
### Charts
|
|
140
|
+
|
|
141
|
+
#### `@mui/x-charts@7.10.0`
|
|
142
|
+
|
|
143
|
+
- [charts] Fix displaying area of a `LineChart` when using the `log` scale (#13791) @alexfauquette
|
|
144
|
+
- [charts] Use correct click handler prop on pie chart `OnSeriesItemClick` documentation (#13761) @tonyhallett
|
|
145
|
+
|
|
146
|
+
### Tree View
|
|
147
|
+
|
|
148
|
+
#### `@mui/x-tree-view@7.10.0`
|
|
149
|
+
|
|
150
|
+
- [TreeView] Add `getItemTree` and `getItemOrderedChildrenIds` methods to the public API (#13804) @flaviendelangle
|
|
151
|
+
- [TreeView] Add utility function to check if an optional plugin is present (#13788) @flaviendelangle
|
|
152
|
+
|
|
153
|
+
### Docs
|
|
154
|
+
|
|
155
|
+
- [docs] Add missing default `loading` prop value (#13604) @oliviertassinari
|
|
156
|
+
- [docs] Add the `DateTimeRangePicker` to the "Commonly used components" demo (#13775) @flaviendelangle
|
|
157
|
+
- [docs] Fix Pickers customization playground overflow (#13742) @LukasTy
|
|
158
|
+
- [docs] Move Pickers dialog guidelines to accessibility page (#13778) @arthurbalduini
|
|
159
|
+
|
|
160
|
+
### Core
|
|
161
|
+
|
|
162
|
+
- [core] Sort `DATA_GRID_PROPS_DEFAULT_VALUES` alphabetically (#13783) @oliviertassinari
|
|
163
|
+
- [test] Fix split infinitive use in tests @oliviertassinari
|
|
164
|
+
|
|
6
165
|
## 7.9.0
|
|
7
166
|
|
|
8
167
|
_Jul 5, 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
|
|
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
|
|
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,
|
|
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
|
*/
|
package/TimeClock/Clock.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
|
|
146
|
+
}) => _extends({}, meridiemButtonCommonStyles(theme, 'pm'), {
|
|
147
|
+
// keeping it here to make TS happy
|
|
143
148
|
position: 'absolute',
|
|
144
|
-
|
|
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
|
@@ -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
|
|
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
|
|
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,
|
|
71
|
-
rightArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides,
|
|
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']);
|
|
@@ -36,6 +36,7 @@ export const addPositionPropertiesToSections = (sections, localizedDigits, isRtl
|
|
|
36
36
|
export const useFieldV6TextField = params => {
|
|
37
37
|
const isRtl = useRtl();
|
|
38
38
|
const focusTimeoutRef = React.useRef();
|
|
39
|
+
const selectionSyncTimeoutRef = React.useRef();
|
|
39
40
|
const {
|
|
40
41
|
forwardedProps: {
|
|
41
42
|
onFocus,
|
|
@@ -103,10 +104,14 @@ export const useFieldV6TextField = params => {
|
|
|
103
104
|
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
+
clearTimeout(selectionSyncTimeoutRef.current);
|
|
108
|
+
selectionSyncTimeoutRef.current = setTimeout(() => {
|
|
107
109
|
// handle case when the selection is not updated correctly
|
|
108
110
|
// could happen on Android
|
|
109
|
-
if (inputRef.current && inputRef.current === getActiveElement(document) &&
|
|
111
|
+
if (inputRef.current && inputRef.current === getActiveElement(document) &&
|
|
112
|
+
// The section might loose all selection, where `selectionStart === selectionEnd`
|
|
113
|
+
// https://github.com/mui/mui-x/pull/13652
|
|
114
|
+
inputRef.current.selectionStart === inputRef.current.selectionEnd && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
|
|
110
115
|
interactions.syncSelectionToDOM();
|
|
111
116
|
}
|
|
112
117
|
});
|
|
@@ -118,8 +123,7 @@ export const useFieldV6TextField = params => {
|
|
|
118
123
|
getActiveSectionIndexFromDOM: () => {
|
|
119
124
|
const browserStartIndex = inputRef.current.selectionStart ?? 0;
|
|
120
125
|
const browserEndIndex = inputRef.current.selectionEnd ?? 0;
|
|
121
|
-
|
|
122
|
-
if (browserStartIndex === 0 && browserEndIndex === 0 || isInputReadOnly) {
|
|
126
|
+
if (browserStartIndex === 0 && browserEndIndex === 0) {
|
|
123
127
|
return null;
|
|
124
128
|
}
|
|
125
129
|
const nextSectionIndex = browserStartIndex <= sections[0].startInInput ? 1 // Special case if browser index is in invisible characters at the beginning.
|
|
@@ -134,10 +138,6 @@ export const useFieldV6TextField = params => {
|
|
|
134
138
|
isFieldFocused: () => inputRef.current === getActiveElement(document)
|
|
135
139
|
}), [inputRef, parsedSelectedSections, sections, setSelectedSections]);
|
|
136
140
|
const syncSelectionFromDOM = () => {
|
|
137
|
-
if (readOnly) {
|
|
138
|
-
setSelectedSections(null);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
141
|
const browserStartIndex = inputRef.current.selectionStart ?? 0;
|
|
142
142
|
let nextSectionIndex;
|
|
143
143
|
if (browserStartIndex <= sections[0].startInInput) {
|
|
@@ -162,7 +162,7 @@ export const useFieldV6TextField = params => {
|
|
|
162
162
|
if (!input || input !== inputRef.current) {
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
|
-
if (activeSectionIndex != null
|
|
165
|
+
if (activeSectionIndex != null) {
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
if (
|
|
@@ -296,6 +296,7 @@ export const useFieldV6TextField = params => {
|
|
|
296
296
|
}
|
|
297
297
|
return () => {
|
|
298
298
|
clearTimeout(focusTimeoutRef.current);
|
|
299
|
+
clearTimeout(selectionSyncTimeoutRef.current);
|
|
299
300
|
};
|
|
300
301
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
301
302
|
|
|
@@ -221,7 +221,7 @@ export const useFieldV7TextField = params => {
|
|
|
221
221
|
const getInputContainerClickHandler = useEventCallback(sectionIndex => event => {
|
|
222
222
|
// The click event on the clear button would propagate to the input, trigger this handler and result in a wrong section selection.
|
|
223
223
|
// We avoid this by checking if the call to this function is actually intended, or a side effect.
|
|
224
|
-
if (event.isDefaultPrevented()
|
|
224
|
+
if (event.isDefaultPrevented()) {
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
setSelectedSections(sectionIndex);
|
|
@@ -231,9 +231,6 @@ export const useFieldV7TextField = params => {
|
|
|
231
231
|
event.preventDefault();
|
|
232
232
|
});
|
|
233
233
|
const getInputContentFocusHandler = useEventCallback(sectionIndex => () => {
|
|
234
|
-
if (readOnly) {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
234
|
setSelectedSections(sectionIndex);
|
|
238
235
|
});
|
|
239
236
|
const handleInputContentPaste = useEventCallback(event => {
|
package/internals/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export type { WrapperVariant, TimeViewWithMeridiem, DateOrTimeViewWithMeridiem,
|
|
|
48
48
|
export type { BaseDateValidationProps, BaseTimeValidationProps, TimeValidationProps, MonthValidationProps, YearValidationProps, DayValidationProps, DateTimeValidationProps, } from './models/validation';
|
|
49
49
|
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
50
50
|
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem, } from './utils/date-utils';
|
|
51
|
-
export { resolveTimeViewsResponse } from './utils/date-time-utils';
|
|
51
|
+
export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
|
|
52
52
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
53
53
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
54
54
|
export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, } from './utils/utils';
|
package/internals/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export { useValidation } from './hooks/useValidation';
|
|
|
19
19
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
|
|
20
20
|
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
21
21
|
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem } from './utils/date-utils';
|
|
22
|
-
export { resolveTimeViewsResponse } from './utils/date-time-utils';
|
|
22
|
+
export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
|
|
23
23
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
24
24
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
25
25
|
export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './utils/utils';
|
|
@@ -4,7 +4,7 @@ import { DesktopOnlyTimePickerProps } from '../models/props/clock';
|
|
|
4
4
|
import { DefaultizedProps } from '../models/helpers';
|
|
5
5
|
export declare const resolveDateTimeFormat: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, { views, format, ...other }: {
|
|
6
6
|
format?: string;
|
|
7
|
-
views: readonly
|
|
7
|
+
views: readonly DateOrTimeViewWithMeridiem[];
|
|
8
8
|
ampm: boolean;
|
|
9
9
|
}) => string;
|
|
10
10
|
interface DefaultizedTimeViewsProps<TDate extends PickerValidDate, TView = DateOrTimeView> extends DefaultizedProps<DesktopOnlyTimePickerProps<TDate>, 'ampm'> {
|