Skip to content

Commit a869db1

Browse files
authored
[DateTimePicker] Use Digital Clock in all component variants (#16678)
1 parent 8af0c85 commit a869db1

File tree

22 files changed

+340
-146
lines changed

22 files changed

+340
-146
lines changed

docs/data/date-pickers/date-time-picker/date-time-picker.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ materialDesign: https://m2.material.io/components/date-pickers
1717

1818
## Component composition
1919

20-
The component is built using the `DateTimeField` for the keyboard editing, the `DateCalendar` for the date view editing, the `DigitalClock` for the desktop view editing, and the `TimeClock` for the mobile time view editing.
20+
The component is built using the `DateTimeField` for the keyboard editing, the `DateCalendar` for the date view editing and `DigitalClock` for the time view editing.
2121

2222
Check-out their documentation page for more information:
2323

2424
- [Date Field](/x/react-date-pickers/date-field/)
2525
- [Date Calendar](/x/react-date-pickers/date-calendar/)
2626
- [Digital Clock](/x/react-date-pickers/digital-clock/)
27-
- [Time Clock](/x/react-date-pickers/time-clock/)
2827

2928
You can check the available props of the combined component on the dedicated [API page](/x/api/date-pickers/date-time-picker/#props).
3029
Some [DateTimeField props](/x/api/date-pickers/date-time-field/#props) are not available on the Picker component, you can use `slotProps.field` to pass them to the field.

docs/pages/x/api/date-pickers/mobile-date-time-picker.json

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"openTo": {
9393
"type": {
9494
"name": "enum",
95-
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
95+
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'meridiem'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
9696
}
9797
},
9898
"orientation": {
@@ -155,6 +155,7 @@
155155
}
156156
},
157157
"showDaysOutsideCurrentMonth": { "type": { "name": "bool" }, "default": "false" },
158+
"skipDisabled": { "type": { "name": "bool" }, "default": "false" },
158159
"slotProps": { "type": { "name": "object" }, "default": "{}" },
159160
"slots": {
160161
"type": { "name": "object" },
@@ -168,6 +169,14 @@
168169
},
169170
"additionalInfo": { "sx": true }
170171
},
172+
"thresholdToRenderTimeInASingleColumn": { "type": { "name": "number" }, "default": "24" },
173+
"timeSteps": {
174+
"type": {
175+
"name": "shape",
176+
"description": "{ hours?: number, minutes?: number, seconds?: number }"
177+
},
178+
"default": "{ hours: 1, minutes: 5, seconds: 5 }"
179+
},
171180
"timezone": {
172181
"type": { "name": "string" },
173182
"default": "The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.",
@@ -180,13 +189,13 @@
180189
"view": {
181190
"type": {
182191
"name": "enum",
183-
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
192+
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'meridiem'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
184193
}
185194
},
186195
"viewRenderers": {
187196
"type": {
188197
"name": "shape",
189-
"description": "{ day?: func, hours?: func, minutes?: func, month?: func, seconds?: func, year?: func }"
198+
"description": "{ day?: func, hours?: func, meridiem?: func, minutes?: func, month?: func, seconds?: func, year?: func }"
190199
}
191200
},
192201
"views": {
@@ -247,6 +256,18 @@
247256
"default": "PickersModalDialogRoot",
248257
"class": null
249258
},
259+
{
260+
"name": "digitalClockItem",
261+
"description": "Component responsible for rendering a single digital clock item.",
262+
"default": "MenuItem from '@mui/material'",
263+
"class": null
264+
},
265+
{
266+
"name": "digitalClockSectionItem",
267+
"description": "Component responsible for rendering a single multi section digital clock section item.",
268+
"default": "MenuItem from '@mui/material'",
269+
"class": null
270+
},
250271
{
251272
"name": "field",
252273
"description": "Component used to enter the date with the keyboard.",

docs/pages/x/api/date-pickers/static-date-time-picker.json

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"openTo": {
8282
"type": {
8383
"name": "enum",
84-
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
84+
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'meridiem'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
8585
}
8686
},
8787
"orientation": {
@@ -138,6 +138,7 @@
138138
}
139139
},
140140
"showDaysOutsideCurrentMonth": { "type": { "name": "bool" }, "default": "false" },
141+
"skipDisabled": { "type": { "name": "bool" }, "default": "false" },
141142
"slotProps": { "type": { "name": "object" }, "default": "{}" },
142143
"slots": {
143144
"type": { "name": "object" },
@@ -151,6 +152,14 @@
151152
},
152153
"additionalInfo": { "sx": true }
153154
},
155+
"thresholdToRenderTimeInASingleColumn": { "type": { "name": "number" }, "default": "24" },
156+
"timeSteps": {
157+
"type": {
158+
"name": "shape",
159+
"description": "{ hours?: number, minutes?: number, seconds?: number }"
160+
},
161+
"default": "{ hours: 1, minutes: 5, seconds: 5 }"
162+
},
154163
"timezone": {
155164
"type": { "name": "string" },
156165
"default": "The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.",
@@ -163,13 +172,13 @@
163172
"view": {
164173
"type": {
165174
"name": "enum",
166-
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
175+
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'meridiem'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
167176
}
168177
},
169178
"viewRenderers": {
170179
"type": {
171180
"name": "shape",
172-
"description": "{ day?: func, hours?: func, minutes?: func, month?: func, seconds?: func, year?: func }"
181+
"description": "{ day?: func, hours?: func, meridiem?: func, minutes?: func, month?: func, seconds?: func, year?: func }"
173182
}
174183
},
175184
"views": {
@@ -212,6 +221,18 @@
212221
"default": "PickersDay",
213222
"class": null
214223
},
224+
{
225+
"name": "digitalClockItem",
226+
"description": "Component responsible for rendering a single digital clock item.",
227+
"default": "MenuItem from '@mui/material'",
228+
"class": null
229+
},
230+
{
231+
"name": "digitalClockSectionItem",
232+
"description": "Component responsible for rendering a single multi section digital clock section item.",
233+
"default": "MenuItem from '@mui/material'",
234+
"class": null
235+
},
215236
{
216237
"name": "layout",
217238
"description": "Custom component for wrapping the layout.\nIt wraps the toolbar, views, action bar, and shortcuts.",

docs/translations/api-docs/date-pickers/mobile-date-time-picker/mobile-date-time-picker.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,20 @@
172172
"showDaysOutsideCurrentMonth": {
173173
"description": "If <code>true</code>, days outside the current month are rendered:<br>- if <code>fixedWeekNumber</code> is defined, renders days to have the weeks requested.<br>- if <code>fixedWeekNumber</code> is not defined, renders day to fill the first and last week of the current month.<br>- ignored if <code>calendars</code> equals more than <code>1</code> on range pickers."
174174
},
175+
"skipDisabled": {
176+
"description": "If <code>true</code>, disabled digital clock items will not be rendered."
177+
},
175178
"slotProps": { "description": "The props used for each component slot." },
176179
"slots": { "description": "Overridable component slots." },
177180
"sx": {
178181
"description": "The system prop that allows defining system overrides as well as additional CSS styles."
179182
},
183+
"thresholdToRenderTimeInASingleColumn": {
184+
"description": "Amount of time options below or at which the single column time renderer is used."
185+
},
186+
"timeSteps": {
187+
"description": "The time steps between two time unit options. For example, if <code>timeStep.minutes = 8</code>, then the available minute options will be <code>[0, 8, 16, 24, 32, 40, 48, 56]</code>. When single column time renderer is used, only <code>timeStep.minutes</code> will be used."
188+
},
180189
"timezone": {
181190
"description": "Choose which timezone to use for the value. Example: &quot;default&quot;, &quot;system&quot;, &quot;UTC&quot;, &quot;America/New_York&quot;. If you pass values from other timezones to some props, they will be converted to this timezone before being used.",
182191
"seeMoreText": "See the {{link}} for more details."
@@ -202,6 +211,8 @@
202211
"clearIcon": "Icon to display inside the clear button.",
203212
"day": "Custom component for day. Check the <a href=\"https://mui.com/x/api/date-pickers/pickers-day/\">PickersDay</a> component.",
204213
"dialog": "Custom component for the dialog inside which the views are rendered on mobile.",
214+
"digitalClockItem": "Component responsible for rendering a single digital clock item.",
215+
"digitalClockSectionItem": "Component responsible for rendering a single multi section digital clock section item.",
205216
"field": "Component used to enter the date with the keyboard.",
206217
"inputAdornment": "Component displayed on the start or end input adornment used to open the picker on desktop.",
207218
"layout": "Custom component for wrapping the layout. It wraps the toolbar, views, action bar, and shortcuts.",

docs/translations/api-docs/date-pickers/static-date-time-picker/static-date-time-picker.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,20 @@
147147
"showDaysOutsideCurrentMonth": {
148148
"description": "If <code>true</code>, days outside the current month are rendered:<br>- if <code>fixedWeekNumber</code> is defined, renders days to have the weeks requested.<br>- if <code>fixedWeekNumber</code> is not defined, renders day to fill the first and last week of the current month.<br>- ignored if <code>calendars</code> equals more than <code>1</code> on range pickers."
149149
},
150+
"skipDisabled": {
151+
"description": "If <code>true</code>, disabled digital clock items will not be rendered."
152+
},
150153
"slotProps": { "description": "The props used for each component slot." },
151154
"slots": { "description": "Overridable component slots." },
152155
"sx": {
153156
"description": "The system prop that allows defining system overrides as well as additional CSS styles."
154157
},
158+
"thresholdToRenderTimeInASingleColumn": {
159+
"description": "Amount of time options below or at which the single column time renderer is used."
160+
},
161+
"timeSteps": {
162+
"description": "The time steps between two time unit options. For example, if <code>timeStep.minutes = 8</code>, then the available minute options will be <code>[0, 8, 16, 24, 32, 40, 48, 56]</code>. When single column time renderer is used, only <code>timeStep.minutes</code> will be used."
163+
},
155164
"timezone": {
156165
"description": "Choose which timezone to use for the value. Example: &quot;default&quot;, &quot;system&quot;, &quot;UTC&quot;, &quot;America/New_York&quot;. If you pass values from other timezones to some props, they will be converted to this timezone before being used.",
157166
"seeMoreText": "See the {{link}} for more details."
@@ -174,6 +183,8 @@
174183
"actionBar": "Custom component for the action bar, it is placed below the picker views.",
175184
"calendarHeader": "Custom component for calendar header. Check the <a href=\"https://mui.com/x/api/date-pickers/pickers-calendar-header/\">PickersCalendarHeader</a> component.",
176185
"day": "Custom component for day. Check the <a href=\"https://mui.com/x/api/date-pickers/pickers-day/\">PickersDay</a> component.",
186+
"digitalClockItem": "Component responsible for rendering a single digital clock item.",
187+
"digitalClockSectionItem": "Component responsible for rendering a single multi section digital clock section item.",
177188
"layout": "Custom component for wrapping the layout. It wraps the toolbar, views, action bar, and shortcuts.",
178189
"leftArrowIcon": "Icon displayed in the left view switch button.",
179190
"monthButton": "Button displayed to render a single month in the <code>month</code> view.",

packages/x-date-pickers-pro/src/DateTimeRangePicker/shared.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
BasePickerInputProps,
1010
PickerViewRendererLookup,
1111
BaseClockProps,
12-
DesktopOnlyTimePickerProps,
12+
DigitalTimePickerProps,
1313
applyDefaultViewProps,
1414
TimeViewWithMeridiem,
1515
resolveTimeViewsResponse,
@@ -94,7 +94,7 @@ export interface BaseDateTimeRangePickerProps
9494
>,
9595
ExportedDateRangeCalendarProps,
9696
ExportedValidateDateTimeRangeProps,
97-
DesktopOnlyTimePickerProps,
97+
DigitalTimePickerProps,
9898
Partial<
9999
Pick<UseViewsOptions<PickerRangeValue, DateTimeRangePickerViewExternal>, 'openTo' | 'views'>
100100
> {

packages/x-date-pickers/src/DateTimePicker/DateTimePicker.types.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
DesktopDateTimePickerSlots,
44
DesktopDateTimePickerSlotProps,
55
} from '../DesktopDateTimePicker';
6-
import { BaseSingleInputFieldProps, DateOrTimeViewWithMeridiem } from '../internals/models';
6+
import { BaseSingleInputFieldProps } from '../internals/models';
77
import {
88
MobileDateTimePickerProps,
99
MobileDateTimePickerSlots,
@@ -23,10 +23,7 @@ export interface DateTimePickerSlotProps<TEnableAccessibleFieldDOMStructure exte
2323
export interface DateTimePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true>
2424
extends DesktopDateTimePickerProps<TEnableAccessibleFieldDOMStructure>,
2525
ExportedYearCalendarProps,
26-
Omit<
27-
MobileDateTimePickerProps<DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure>,
28-
'views'
29-
> {
26+
Omit<MobileDateTimePickerProps<TEnableAccessibleFieldDOMStructure>, 'views'> {
3027
/**
3128
* CSS media query when `Mobile` mode will be changed to `Desktop`.
3229
* @default '@media (pointer: fine)'

packages/x-date-pickers/src/DateTimePicker/DateTimePickerToolbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const DateTimePickerToolbarRoot = styled(PickersToolbar, {
8282
props: { toolbarVariant: 'desktop' },
8383
style: {
8484
borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`,
85-
[`& .${pickersToolbarClasses.content} .${pickersToolbarTextClasses.selected}`]: {
85+
[`& .${pickersToolbarClasses.content} .${pickersToolbarTextClasses.root}[data-selected]`]: {
8686
color: (theme.vars || theme).palette.primary.main,
8787
fontWeight: theme.typography.fontWeightBold,
8888
},

0 commit comments

Comments
 (0)