@mui/x-date-pickers 7.0.0-beta.6 → 7.0.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/AdapterDateFns/AdapterDateFns.js +1 -1
- package/AdapterDateFnsBase/AdapterDateFnsBase.js +1 -2
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +2 -4
- package/AdapterDateFnsV3/AdapterDateFnsV3.js +1 -1
- package/AdapterDayjs/AdapterDayjs.js +2 -4
- package/AdapterLuxon/AdapterLuxon.js +12 -9
- package/AdapterMoment/AdapterMoment.js +5 -6
- package/CHANGELOG.md +311 -12
- package/DateCalendar/DateCalendar.js +14 -16
- package/DateCalendar/DayCalendar.js +7 -7
- package/DateField/DateField.js +3 -4
- package/DatePicker/DatePicker.js +1 -1
- package/DatePicker/shared.d.ts +2 -1
- package/DatePicker/shared.js +3 -5
- package/DateTimeField/DateTimeField.js +3 -4
- package/DateTimePicker/DateTimePicker.js +1 -1
- package/DateTimePicker/DateTimePickerToolbar.js +1 -1
- package/DateTimePicker/shared.d.ts +2 -1
- package/DateTimePicker/shared.js +11 -13
- package/DesktopDatePicker/DesktopDatePicker.js +7 -11
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +72 -37
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +12 -0
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +101 -0
- package/DesktopDateTimePicker/index.d.ts +1 -0
- package/DesktopDateTimePicker/index.js +2 -1
- package/DesktopTimePicker/DesktopTimePicker.js +8 -12
- package/DigitalClock/DigitalClock.js +2 -3
- package/LocalizationProvider/LocalizationProvider.js +1 -2
- package/MobileDatePicker/MobileDatePicker.js +6 -10
- package/MobileDateTimePicker/MobileDateTimePicker.js +8 -12
- package/MobileTimePicker/MobileTimePicker.js +6 -10
- package/MonthCalendar/MonthCalendar.js +4 -4
- package/MonthCalendar/PickersMonth.js +1 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -5
- package/PickersActionBar/PickersActionBar.js +1 -1
- package/PickersCalendarHeader/PickersCalendarHeader.d.ts +1 -1
- package/PickersCalendarHeader/PickersCalendarHeader.js +4 -5
- package/PickersLayout/usePickerLayout.js +8 -9
- package/PickersSectionList/PickersSectionList.js +9 -11
- package/PickersTextField/PickersFilledInput/PickersFilledInput.js +2 -3
- package/PickersTextField/PickersInput/PickersInput.js +1 -1
- package/PickersTextField/PickersInputBase/PickersInputBase.js +4 -5
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +2 -2
- package/README.md +1 -1
- package/StaticDatePicker/StaticDatePicker.js +4 -5
- package/StaticDateTimePicker/StaticDateTimePicker.js +6 -7
- package/StaticTimePicker/StaticTimePicker.js +3 -4
- package/TimeClock/TimeClock.js +1 -1
- package/TimeField/TimeField.js +2 -3
- package/TimePicker/shared.d.ts +2 -1
- package/TimePicker/shared.js +5 -7
- package/YearCalendar/YearCalendar.js +5 -6
- package/hooks/useClearableField.js +6 -7
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +8 -9
- package/internals/components/PickersModalDialog.js +6 -7
- package/internals/components/PickersPopper.js +13 -16
- package/internals/components/PickersToolbar.js +9 -12
- package/internals/hooks/date-helpers-hooks.js +1 -1
- package/internals/hooks/defaultizedFieldProps.js +15 -18
- package/internals/hooks/useClockReferenceDate.js +1 -1
- package/internals/hooks/useDesktopPicker/index.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +11 -12
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +2 -2
- package/internals/hooks/useField/buildSectionsFromFormat.js +35 -31
- package/internals/hooks/useField/useField.js +2 -2
- package/internals/hooks/useField/useField.utils.js +4 -7
- package/internals/hooks/useField/useFieldCharacterEditing.js +1 -2
- package/internals/hooks/useField/useFieldState.js +1 -1
- package/internals/hooks/useField/useFieldV6TextField.js +9 -15
- package/internals/hooks/useField/useFieldV7TextField.js +11 -13
- package/internals/hooks/useMobilePicker/useMobilePicker.js +7 -8
- package/internals/hooks/useOpenState.js +1 -1
- package/internals/hooks/usePicker/index.d.ts +1 -0
- package/internals/hooks/usePicker/usePickerViews.d.ts +4 -2
- package/internals/hooks/usePicker/usePickerViews.js +1 -2
- package/internals/hooks/useStaticPicker/useStaticPicker.js +13 -17
- package/internals/hooks/useValueWithTimezone.js +5 -6
- package/internals/hooks/useViews.js +3 -4
- package/internals/index.d.ts +1 -1
- package/internals/models/validation.d.ts +1 -1
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +3 -3
- package/internals/utils/date-time-utils.js +2 -5
- package/internals/utils/date-utils.d.ts +1 -1
- package/internals/utils/date-utils.js +8 -8
- package/internals/utils/fields.js +1 -1
- package/internals/utils/getDefaultReferenceDate.js +2 -6
- package/internals/utils/views.js +1 -1
- package/locales/csCZ.js +1 -4
- package/locales/daDK.js +1 -4
- package/locales/deDE.js +1 -4
- package/locales/huHU.js +1 -4
- package/locales/jaJP.js +16 -23
- package/locales/roRO.js +1 -4
- package/locales/skSK.js +1 -4
- package/modern/AdapterLuxon/AdapterLuxon.js +9 -4
- package/modern/DateCalendar/DateCalendar.js +1 -1
- package/modern/DateCalendar/DayCalendar.js +2 -1
- package/modern/DateField/DateField.js +1 -1
- package/modern/DatePicker/DatePicker.js +1 -1
- package/modern/DateTimeField/DateTimeField.js +1 -1
- package/modern/DateTimePicker/DateTimePicker.js +1 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +64 -25
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +101 -0
- package/modern/DesktopDateTimePicker/index.js +2 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +1 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -1
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersPopper.js +1 -1
- package/modern/internals/hooks/useField/buildSectionsFromFormat.js +34 -30
- package/modern/internals/hooks/useField/useFieldV7TextField.js +3 -3
- package/modern/internals/hooks/useOpenState.js +1 -1
- package/modern/internals/utils/date-utils.js +8 -8
- package/modern/internals/utils/fields.js +1 -1
- package/modern/locales/jaJP.js +15 -19
- package/node/AdapterLuxon/AdapterLuxon.js +9 -4
- package/node/DateCalendar/DateCalendar.js +1 -1
- package/node/DateCalendar/DayCalendar.js +2 -1
- package/node/DateField/DateField.js +1 -1
- package/node/DatePicker/DatePicker.js +1 -1
- package/node/DateTimeField/DateTimeField.js +1 -1
- package/node/DateTimePicker/DateTimePicker.js +1 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +63 -25
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +108 -0
- package/node/DesktopDateTimePicker/index.js +8 -1
- package/node/MobileDatePicker/MobileDatePicker.js +1 -1
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/node/StaticDatePicker/StaticDatePicker.js +1 -1
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersPopper.js +1 -1
- package/node/internals/hooks/useField/buildSectionsFromFormat.js +34 -30
- package/node/internals/hooks/useField/useFieldV7TextField.js +3 -3
- package/node/internals/hooks/useOpenState.js +1 -1
- package/node/internals/utils/date-utils.js +9 -9
- package/node/internals/utils/fields.js +1 -1
- package/node/locales/jaJP.js +15 -19
- package/package.json +5 -5
- package/timeViewRenderers/timeViewRenderers.js +1 -1
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +0 -15
- package/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -163
- package/dateTimeViewRenderers/index.d.ts +0 -2
- package/dateTimeViewRenderers/index.js +0 -1
- package/dateTimeViewRenderers/package.json +0 -6
- package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -162
- package/modern/dateTimeViewRenderers/index.js +0 -1
- package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -171
- package/node/dateTimeViewRenderers/index.js +0 -12
|
@@ -133,7 +133,6 @@ const PickersCalendarWeek = styled('div', {
|
|
|
133
133
|
justifyContent: 'center'
|
|
134
134
|
});
|
|
135
135
|
function WrappedDay(_ref) {
|
|
136
|
-
var _slots$day;
|
|
137
136
|
let {
|
|
138
137
|
parentProps,
|
|
139
138
|
day,
|
|
@@ -158,11 +157,11 @@ function WrappedDay(_ref) {
|
|
|
158
157
|
const isFocusableDay = focusableDay !== null && utils.isSameDay(day, focusableDay);
|
|
159
158
|
const isSelected = selectedDays.some(selectedDay => utils.isSameDay(selectedDay, day));
|
|
160
159
|
const isToday = utils.isSameDay(day, now);
|
|
161
|
-
const Day =
|
|
160
|
+
const Day = slots?.day ?? PickersDay;
|
|
162
161
|
// We don't want to pass to ownerState down, to avoid re-rendering all the day whenever a prop changes.
|
|
163
162
|
const _useSlotProps = useSlotProps({
|
|
164
163
|
elementType: Day,
|
|
165
|
-
externalSlotProps: slotProps
|
|
164
|
+
externalSlotProps: slotProps?.day,
|
|
166
165
|
additionalProps: _extends({
|
|
167
166
|
disableHighlightToday,
|
|
168
167
|
showDaysOutsideCurrentMonth,
|
|
@@ -268,7 +267,7 @@ export function DayCalendar(inProps) {
|
|
|
268
267
|
name: 'DayCalendar',
|
|
269
268
|
state: 'hasFocus',
|
|
270
269
|
controlled: hasFocus,
|
|
271
|
-
default: autoFocus
|
|
270
|
+
default: autoFocus ?? false
|
|
272
271
|
});
|
|
273
272
|
const [internalFocusedDay, setInternalFocusedDay] = React.useState(() => focusedDay || now);
|
|
274
273
|
const handleDaySelect = useEventCallback(day => {
|
|
@@ -281,7 +280,7 @@ export function DayCalendar(inProps) {
|
|
|
281
280
|
if (!isDateDisabled(day)) {
|
|
282
281
|
onFocusedDayChange(day);
|
|
283
282
|
setInternalFocusedDay(day);
|
|
284
|
-
onFocusedViewChange
|
|
283
|
+
onFocusedViewChange?.(true);
|
|
285
284
|
setInternalHasFocus(true);
|
|
286
285
|
}
|
|
287
286
|
};
|
|
@@ -350,14 +349,15 @@ export function DayCalendar(inProps) {
|
|
|
350
349
|
const handleFocus = useEventCallback((event, day) => focusDay(day));
|
|
351
350
|
const handleBlur = useEventCallback((event, day) => {
|
|
352
351
|
if (internalHasFocus && utils.isSameDay(internalFocusedDay, day)) {
|
|
353
|
-
onFocusedViewChange
|
|
352
|
+
onFocusedViewChange?.(false);
|
|
354
353
|
}
|
|
355
354
|
});
|
|
356
355
|
const currentMonthNumber = utils.getMonth(currentMonth);
|
|
356
|
+
const currentYearNumber = utils.getYear(currentMonth);
|
|
357
357
|
const validSelectedDays = React.useMemo(() => selectedDays.filter(day => !!day).map(day => utils.startOfDay(day)), [utils, selectedDays]);
|
|
358
358
|
|
|
359
359
|
// need a new ref whenever the `key` of the transition changes: https://reactcommunity.org/react-transition-group/transition/#Transition-prop-nodeRef.
|
|
360
|
-
const transitionKey = currentMonthNumber
|
|
360
|
+
const transitionKey = `${currentYearNumber}-${currentMonthNumber}`;
|
|
361
361
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
362
362
|
const slideNodeRef = React.useMemo(() => /*#__PURE__*/React.createRef(), [transitionKey]);
|
|
363
363
|
const startOfCurrentWeek = utils.startOfWeek(now);
|
package/DateField/DateField.js
CHANGED
|
@@ -23,7 +23,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
23
23
|
* - [DateField API](https://mui.com/x/api/date-pickers/date-field/)
|
|
24
24
|
*/
|
|
25
25
|
const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, inRef) {
|
|
26
|
-
var _slots$textField;
|
|
27
26
|
const themeProps = useThemeProps({
|
|
28
27
|
props: inProps,
|
|
29
28
|
name: 'MuiDateField'
|
|
@@ -36,10 +35,10 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, inRe
|
|
|
36
35
|
} = themeProps,
|
|
37
36
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
38
37
|
const ownerState = themeProps;
|
|
39
|
-
const TextField =
|
|
38
|
+
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure ? PickersTextField : MuiTextField);
|
|
40
39
|
const textFieldProps = useSlotProps({
|
|
41
40
|
elementType: TextField,
|
|
42
|
-
externalSlotProps: slotProps
|
|
41
|
+
externalSlotProps: slotProps?.textField,
|
|
43
42
|
externalForwardedProps: other,
|
|
44
43
|
additionalProps: {
|
|
45
44
|
ref: inRef
|
|
@@ -242,7 +241,7 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
242
241
|
/**
|
|
243
242
|
* Disable specific date.
|
|
244
243
|
*
|
|
245
|
-
* Warning: This function can be called multiple times (
|
|
244
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
246
245
|
*
|
|
247
246
|
* @template TDate
|
|
248
247
|
* @param {TDate} day The date to test.
|
package/DatePicker/DatePicker.js
CHANGED
|
@@ -266,7 +266,7 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
266
266
|
/**
|
|
267
267
|
* Disable specific date.
|
|
268
268
|
*
|
|
269
|
-
* Warning: This function can be called multiple times (
|
|
269
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
270
270
|
*
|
|
271
271
|
* @template TDate
|
|
272
272
|
* @param {TDate} day The date to test.
|
package/DatePicker/shared.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface BaseDatePickerSlots<TDate extends PickerValidDate> extends Date
|
|
|
18
18
|
export interface BaseDatePickerSlotProps<TDate extends PickerValidDate> extends DateCalendarSlotProps<TDate> {
|
|
19
19
|
toolbar?: ExportedDatePickerToolbarProps;
|
|
20
20
|
}
|
|
21
|
+
export type DatePickerViewRenderers<TDate extends PickerValidDate, TView extends DateView, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<TDate | null, TView, DateViewRendererProps<TDate, TView>, TAdditionalProps>;
|
|
21
22
|
export interface BaseDatePickerProps<TDate extends PickerValidDate> extends BasePickerInputProps<TDate | null, TDate, DateView, DateValidationError>, ExportedDateCalendarProps<TDate> {
|
|
22
23
|
/**
|
|
23
24
|
* Overridable component slots.
|
|
@@ -34,7 +35,7 @@ export interface BaseDatePickerProps<TDate extends PickerValidDate> extends Base
|
|
|
34
35
|
* If `null`, the section will only have field editing.
|
|
35
36
|
* If `undefined`, internally defined view will be the used.
|
|
36
37
|
*/
|
|
37
|
-
viewRenderers?: Partial<
|
|
38
|
+
viewRenderers?: Partial<DatePickerViewRenderers<TDate, DateView>>;
|
|
38
39
|
}
|
|
39
40
|
type UseDatePickerDefaultizedProps<TDate extends PickerValidDate, Props extends BaseDatePickerProps<TDate>> = LocalizedComponent<TDate, DefaultizedProps<Props, 'views' | 'openTo' | keyof BaseDateValidationProps<TDate>>>;
|
|
40
41
|
export declare function useDatePickerDefaultizedProps<TDate extends PickerValidDate, Props extends BaseDatePickerProps<TDate>>(props: Props, name: string): UseDatePickerDefaultizedProps<TDate, Props>;
|
package/DatePicker/shared.js
CHANGED
|
@@ -6,7 +6,6 @@ import { applyDefaultViewProps } from '../internals/utils/views';
|
|
|
6
6
|
import { applyDefaultDate } from '../internals/utils/date-utils';
|
|
7
7
|
import { DatePickerToolbar } from './DatePickerToolbar';
|
|
8
8
|
export function useDatePickerDefaultizedProps(props, name) {
|
|
9
|
-
var _themeProps$disableFu, _themeProps$disablePa;
|
|
10
9
|
const utils = useUtils();
|
|
11
10
|
const defaultDates = useDefaultDates();
|
|
12
11
|
const themeProps = useThemeProps({
|
|
@@ -14,8 +13,7 @@ export function useDatePickerDefaultizedProps(props, name) {
|
|
|
14
13
|
name
|
|
15
14
|
});
|
|
16
15
|
const localeText = React.useMemo(() => {
|
|
17
|
-
|
|
18
|
-
if (((_themeProps$localeTex = themeProps.localeText) == null ? void 0 : _themeProps$localeTex.toolbarTitle) == null) {
|
|
16
|
+
if (themeProps.localeText?.toolbarTitle == null) {
|
|
19
17
|
return themeProps.localeText;
|
|
20
18
|
}
|
|
21
19
|
return _extends({}, themeProps.localeText, {
|
|
@@ -30,8 +28,8 @@ export function useDatePickerDefaultizedProps(props, name) {
|
|
|
30
28
|
defaultViews: ['year', 'day'],
|
|
31
29
|
defaultOpenTo: 'day'
|
|
32
30
|
}), {
|
|
33
|
-
disableFuture:
|
|
34
|
-
disablePast:
|
|
31
|
+
disableFuture: themeProps.disableFuture ?? false,
|
|
32
|
+
disablePast: themeProps.disablePast ?? false,
|
|
35
33
|
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
|
|
36
34
|
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
|
|
37
35
|
slots: _extends({
|
|
@@ -23,7 +23,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
23
23
|
* - [DateTimeField API](https://mui.com/x/api/date-pickers/date-time-field/)
|
|
24
24
|
*/
|
|
25
25
|
const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inProps, inRef) {
|
|
26
|
-
var _slots$textField;
|
|
27
26
|
const themeProps = useThemeProps({
|
|
28
27
|
props: inProps,
|
|
29
28
|
name: 'MuiDateTimeField'
|
|
@@ -36,10 +35,10 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
|
|
|
36
35
|
} = themeProps,
|
|
37
36
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
38
37
|
const ownerState = themeProps;
|
|
39
|
-
const TextField =
|
|
38
|
+
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure ? PickersTextField : MuiTextField);
|
|
40
39
|
const textFieldProps = useSlotProps({
|
|
41
40
|
elementType: TextField,
|
|
42
|
-
externalSlotProps: slotProps
|
|
41
|
+
externalSlotProps: slotProps?.textField,
|
|
43
42
|
externalForwardedProps: other,
|
|
44
43
|
ownerState,
|
|
45
44
|
additionalProps: {
|
|
@@ -275,7 +274,7 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
275
274
|
/**
|
|
276
275
|
* Disable specific date.
|
|
277
276
|
*
|
|
278
|
-
* Warning: This function can be called multiple times (
|
|
277
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
279
278
|
*
|
|
280
279
|
* @template TDate
|
|
281
280
|
* @param {TDate} day The date to test.
|
|
@@ -304,7 +304,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
304
304
|
/**
|
|
305
305
|
* Disable specific date.
|
|
306
306
|
*
|
|
307
|
-
* Warning: This function can be called multiple times (
|
|
307
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
308
308
|
*
|
|
309
309
|
* @template TDate
|
|
310
310
|
* @param {TDate} day The date to test.
|
|
@@ -208,7 +208,7 @@ function DateTimePickerToolbar(inProps) {
|
|
|
208
208
|
const classes = useUtilityClasses(_extends({}, ownerState, {
|
|
209
209
|
theme
|
|
210
210
|
}));
|
|
211
|
-
const toolbarTitle = inToolbarTitle
|
|
211
|
+
const toolbarTitle = inToolbarTitle ?? localeText.dateTimePickerToolbarTitle;
|
|
212
212
|
const formatHours = time => ampm ? utils.format(time, 'hours12h') : utils.format(time, 'hours24h');
|
|
213
213
|
const dateText = React.useMemo(() => {
|
|
214
214
|
if (!value) {
|
|
@@ -35,6 +35,7 @@ export interface BaseDateTimePickerSlotProps<TDate extends PickerValidDate> exte
|
|
|
35
35
|
*/
|
|
36
36
|
toolbar?: ExportedDateTimePickerToolbarProps;
|
|
37
37
|
}
|
|
38
|
+
export type DateTimePickerViewRenderers<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<TDate | null, TView, Omit<DateViewRendererProps<TDate, TView>, 'slots' | 'slotProps'> & Omit<TimeViewRendererProps<TimeViewWithMeridiem, BaseClockProps<TDate, TimeViewWithMeridiem>>, 'slots' | 'slotProps'>, TAdditionalProps>;
|
|
38
39
|
export interface BaseDateTimePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends BasePickerInputProps<TDate | null, TDate, TView, DateTimeValidationError>, Omit<ExportedDateCalendarProps<TDate>, 'onViewChange'>, ExportedBaseClockProps<TDate>, DateTimeValidationProps<TDate> {
|
|
39
40
|
/**
|
|
40
41
|
* Display ampm controls under the clock (instead of in the toolbar).
|
|
@@ -56,7 +57,7 @@ export interface BaseDateTimePickerProps<TDate extends PickerValidDate, TView ex
|
|
|
56
57
|
* If `null`, the section will only have field editing.
|
|
57
58
|
* If `undefined`, internally defined view will be the used.
|
|
58
59
|
*/
|
|
59
|
-
viewRenderers?: Partial<
|
|
60
|
+
viewRenderers?: Partial<DateTimePickerViewRenderers<TDate, TView>>;
|
|
60
61
|
}
|
|
61
62
|
type UseDateTimePickerDefaultizedProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, Props extends BaseDateTimePickerProps<TDate, TView>> = LocalizedComponent<TDate, DefaultizedProps<Props, 'views' | 'openTo' | 'orientation' | 'ampm' | keyof BaseDateValidationProps<TDate> | keyof BaseTimeValidationProps>>;
|
|
62
63
|
export declare function useDateTimePickerDefaultizedProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, Props extends BaseDateTimePickerProps<TDate, TView>>(props: Props, name: string): UseDateTimePickerDefaultizedProps<TDate, TView, Props>;
|
package/DateTimePicker/shared.js
CHANGED
|
@@ -7,17 +7,15 @@ import { DateTimePickerTabs } from './DateTimePickerTabs';
|
|
|
7
7
|
import { DateTimePickerToolbar } from './DateTimePickerToolbar';
|
|
8
8
|
import { applyDefaultViewProps } from '../internals/utils/views';
|
|
9
9
|
export function useDateTimePickerDefaultizedProps(props, name) {
|
|
10
|
-
var _themeProps$ampm, _themeProps$orientati, _themeProps$disableIg, _themeProps$disableFu, _themeProps$disablePa, _themeProps$minDateTi, _themeProps$maxDateTi, _themeProps$minDateTi2, _themeProps$maxDateTi2, _themeProps$slotProps;
|
|
11
10
|
const utils = useUtils();
|
|
12
11
|
const defaultDates = useDefaultDates();
|
|
13
12
|
const themeProps = useThemeProps({
|
|
14
13
|
props,
|
|
15
14
|
name
|
|
16
15
|
});
|
|
17
|
-
const ampm =
|
|
16
|
+
const ampm = themeProps.ampm ?? utils.is12HourCycleInCurrentLocale();
|
|
18
17
|
const localeText = React.useMemo(() => {
|
|
19
|
-
|
|
20
|
-
if (((_themeProps$localeTex = themeProps.localeText) == null ? void 0 : _themeProps$localeTex.toolbarTitle) == null) {
|
|
18
|
+
if (themeProps.localeText?.toolbarTitle == null) {
|
|
21
19
|
return themeProps.localeText;
|
|
22
20
|
}
|
|
23
21
|
return _extends({}, themeProps.localeText, {
|
|
@@ -32,17 +30,17 @@ export function useDateTimePickerDefaultizedProps(props, name) {
|
|
|
32
30
|
}), {
|
|
33
31
|
ampm,
|
|
34
32
|
localeText,
|
|
35
|
-
orientation:
|
|
33
|
+
orientation: themeProps.orientation ?? 'portrait',
|
|
36
34
|
// TODO: Remove from public API
|
|
37
|
-
disableIgnoringDatePartForTimeValidation:
|
|
35
|
+
disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
|
|
38
36
|
// allow time clock to correctly check time validity: https://github.com/mui/mui-x/issues/8520
|
|
39
37
|
themeProps.disablePast || themeProps.disableFuture),
|
|
40
|
-
disableFuture:
|
|
41
|
-
disablePast:
|
|
42
|
-
minDate: applyDefaultDate(utils,
|
|
43
|
-
maxDate: applyDefaultDate(utils,
|
|
44
|
-
minTime:
|
|
45
|
-
maxTime:
|
|
38
|
+
disableFuture: themeProps.disableFuture ?? false,
|
|
39
|
+
disablePast: themeProps.disablePast ?? false,
|
|
40
|
+
minDate: applyDefaultDate(utils, themeProps.minDateTime ?? themeProps.minDate, defaultDates.minDate),
|
|
41
|
+
maxDate: applyDefaultDate(utils, themeProps.maxDateTime ?? themeProps.maxDate, defaultDates.maxDate),
|
|
42
|
+
minTime: themeProps.minDateTime ?? themeProps.minTime,
|
|
43
|
+
maxTime: themeProps.maxDateTime ?? themeProps.maxTime,
|
|
46
44
|
slots: _extends({
|
|
47
45
|
toolbar: DateTimePickerToolbar,
|
|
48
46
|
tabs: DateTimePickerTabs
|
|
@@ -50,7 +48,7 @@ export function useDateTimePickerDefaultizedProps(props, name) {
|
|
|
50
48
|
slotProps: _extends({}, themeProps.slotProps, {
|
|
51
49
|
toolbar: _extends({
|
|
52
50
|
ampm
|
|
53
|
-
},
|
|
51
|
+
}, themeProps.slotProps?.toolbar)
|
|
54
52
|
})
|
|
55
53
|
});
|
|
56
54
|
}
|
|
@@ -24,7 +24,6 @@ import { resolveDateFormat } from '../internals/utils/date-utils';
|
|
|
24
24
|
* - [DesktopDatePicker API](https://mui.com/x/api/date-pickers/desktop-date-picker/)
|
|
25
25
|
*/
|
|
26
26
|
const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePicker(inProps, ref) {
|
|
27
|
-
var _defaultizedProps$yea, _defaultizedProps$slo2, _props$localeText$ope, _props$localeText;
|
|
28
27
|
const localeText = useLocaleText();
|
|
29
28
|
const utils = useUtils();
|
|
30
29
|
|
|
@@ -40,21 +39,18 @@ const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePick
|
|
|
40
39
|
const props = _extends({}, defaultizedProps, {
|
|
41
40
|
viewRenderers,
|
|
42
41
|
format: resolveDateFormat(utils, defaultizedProps, false),
|
|
43
|
-
yearsPerRow:
|
|
42
|
+
yearsPerRow: defaultizedProps.yearsPerRow ?? 4,
|
|
44
43
|
slots: _extends({
|
|
45
44
|
openPickerIcon: CalendarIcon,
|
|
46
45
|
field: DateField
|
|
47
46
|
}, defaultizedProps.slots),
|
|
48
47
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
49
|
-
field: ownerState => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
ref
|
|
53
|
-
});
|
|
54
|
-
},
|
|
48
|
+
field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
|
|
49
|
+
ref
|
|
50
|
+
}),
|
|
55
51
|
toolbar: _extends({
|
|
56
52
|
hidden: true
|
|
57
|
-
},
|
|
53
|
+
}, defaultizedProps.slotProps?.toolbar)
|
|
58
54
|
})
|
|
59
55
|
});
|
|
60
56
|
const {
|
|
@@ -63,7 +59,7 @@ const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePick
|
|
|
63
59
|
props,
|
|
64
60
|
valueManager: singleItemValueManager,
|
|
65
61
|
valueType: 'date',
|
|
66
|
-
getOpenDialogAriaText:
|
|
62
|
+
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ?? localeText.openDatePickerDialogue,
|
|
67
63
|
validator: validateDate
|
|
68
64
|
});
|
|
69
65
|
return renderPicker();
|
|
@@ -285,7 +281,7 @@ DesktopDatePicker.propTypes = {
|
|
|
285
281
|
/**
|
|
286
282
|
* Disable specific date.
|
|
287
283
|
*
|
|
288
|
-
* Warning: This function can be called multiple times (
|
|
284
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
289
285
|
*
|
|
290
286
|
* @template TDate
|
|
291
287
|
* @param {TDate} day The date to test.
|
|
@@ -1,19 +1,64 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["openTo", "focusedView", "timeViewsCount"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
5
7
|
import { refType } from '@mui/utils';
|
|
8
|
+
import Divider from '@mui/material/Divider';
|
|
6
9
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
7
10
|
import { DateTimeField } from '../DateTimeField';
|
|
8
11
|
import { useDateTimePickerDefaultizedProps } from '../DateTimePicker/shared';
|
|
9
12
|
import { renderDateViewCalendar } from '../dateViewRenderers/dateViewRenderers';
|
|
10
|
-
import { renderDesktopDateTimeView } from '../dateTimeViewRenderers';
|
|
11
13
|
import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
|
|
12
14
|
import { validateDateTime } from '../internals/utils/validation/validateDateTime';
|
|
13
15
|
import { CalendarIcon } from '../icons';
|
|
14
16
|
import { useDesktopPicker } from '../internals/hooks/useDesktopPicker';
|
|
15
17
|
import { extractValidationProps } from '../internals/utils/validation/extractValidationProps';
|
|
16
18
|
import { resolveDateTimeFormat, resolveTimeViewsResponse } from '../internals/utils/date-time-utils';
|
|
19
|
+
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '../timeViewRenderers';
|
|
20
|
+
import { VIEW_HEIGHT, isDatePickerView, isInternalTimeView } from '../internals';
|
|
21
|
+
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '../MultiSectionDigitalClock';
|
|
22
|
+
import { digitalClockClasses } from '../DigitalClock';
|
|
23
|
+
import { DesktopDateTimePickerLayout } from './DesktopDateTimePickerLayout';
|
|
24
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
|
|
27
|
+
const {
|
|
28
|
+
openTo,
|
|
29
|
+
focusedView,
|
|
30
|
+
timeViewsCount
|
|
31
|
+
} = rendererProps,
|
|
32
|
+
otherProps = _objectWithoutPropertiesLoose(rendererProps, _excluded);
|
|
33
|
+
const finalProps = _extends({}, otherProps, {
|
|
34
|
+
focusedView: null,
|
|
35
|
+
sx: [{
|
|
36
|
+
[`&.${multiSectionDigitalClockClasses.root}`]: {
|
|
37
|
+
borderBottom: 0
|
|
38
|
+
},
|
|
39
|
+
[`&.${multiSectionDigitalClockClasses.root}, .${multiSectionDigitalClockSectionClasses.root}, &.${digitalClockClasses.root}`]: {
|
|
40
|
+
maxHeight: VIEW_HEIGHT
|
|
41
|
+
}
|
|
42
|
+
}]
|
|
43
|
+
});
|
|
44
|
+
const isTimeViewActive = isInternalTimeView(popperView);
|
|
45
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
46
|
+
children: [inViewRenderers[!isTimeViewActive ? popperView : 'day']?.(_extends({}, rendererProps, {
|
|
47
|
+
view: !isTimeViewActive ? popperView : 'day',
|
|
48
|
+
focusedView: focusedView && isDatePickerView(focusedView) ? focusedView : null,
|
|
49
|
+
views: rendererProps.views.filter(isDatePickerView)
|
|
50
|
+
})), timeViewsCount > 0 && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
51
|
+
children: [/*#__PURE__*/_jsx(Divider, {
|
|
52
|
+
orientation: "vertical"
|
|
53
|
+
}), inViewRenderers[isTimeViewActive ? popperView : 'hours']?.(_extends({}, finalProps, {
|
|
54
|
+
view: isTimeViewActive ? popperView : 'hours',
|
|
55
|
+
focusedView: focusedView && isInternalTimeView(focusedView) ? focusedView : null,
|
|
56
|
+
openTo: isInternalTimeView(openTo) ? openTo : 'hours',
|
|
57
|
+
views: rendererProps.views.filter(isInternalTimeView)
|
|
58
|
+
}))]
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
};
|
|
17
62
|
/**
|
|
18
63
|
* Demos:
|
|
19
64
|
*
|
|
@@ -25,7 +70,6 @@ import { resolveDateTimeFormat, resolveTimeViewsResponse } from '../internals/ut
|
|
|
25
70
|
* - [DesktopDateTimePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-picker/)
|
|
26
71
|
*/
|
|
27
72
|
const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimePicker(inProps, ref) {
|
|
28
|
-
var _defaultizedProps$amp, _defaultizedProps$yea, _defaultizedProps$slo2, _defaultizedProps$slo3, _defaultizedProps$slo4, _props$localeText$ope, _props$localeText;
|
|
29
73
|
const localeText = useLocaleText();
|
|
30
74
|
const utils = useUtils();
|
|
31
75
|
|
|
@@ -34,65 +78,55 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
|
|
|
34
78
|
const {
|
|
35
79
|
shouldRenderTimeInASingleColumn,
|
|
36
80
|
thresholdToRenderTimeInASingleColumn,
|
|
37
|
-
views,
|
|
81
|
+
views: resolvedViews,
|
|
38
82
|
timeSteps
|
|
39
83
|
} = resolveTimeViewsResponse(defaultizedProps);
|
|
40
|
-
const
|
|
41
|
-
const viewRenderers =
|
|
42
|
-
// we can only ensure the expected two-column layout if none of the renderers are overridden
|
|
43
|
-
shouldUseNewRenderer ? {
|
|
44
|
-
day: renderDesktopDateTimeView,
|
|
45
|
-
month: renderDesktopDateTimeView,
|
|
46
|
-
year: renderDesktopDateTimeView,
|
|
47
|
-
hours: renderDesktopDateTimeView,
|
|
48
|
-
minutes: renderDesktopDateTimeView,
|
|
49
|
-
seconds: renderDesktopDateTimeView,
|
|
50
|
-
meridiem: renderDesktopDateTimeView
|
|
51
|
-
} : _extends({
|
|
84
|
+
const renderTimeView = shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
|
|
85
|
+
const viewRenderers = _extends({
|
|
52
86
|
day: renderDateViewCalendar,
|
|
53
87
|
month: renderDateViewCalendar,
|
|
54
88
|
year: renderDateViewCalendar,
|
|
55
|
-
hours:
|
|
56
|
-
minutes:
|
|
57
|
-
seconds:
|
|
58
|
-
meridiem:
|
|
89
|
+
hours: renderTimeView,
|
|
90
|
+
minutes: renderTimeView,
|
|
91
|
+
seconds: renderTimeView,
|
|
92
|
+
meridiem: renderTimeView
|
|
59
93
|
}, defaultizedProps.viewRenderers);
|
|
60
|
-
const ampmInClock =
|
|
61
|
-
//
|
|
62
|
-
const
|
|
94
|
+
const ampmInClock = defaultizedProps.ampmInClock ?? true;
|
|
95
|
+
// Need to avoid adding the `meridiem` view when unexpected renderer is specified
|
|
96
|
+
const shouldHoursRendererContainMeridiemView = viewRenderers.hours?.name === renderMultiSectionDigitalClockTimeView.name;
|
|
97
|
+
const views = !shouldHoursRendererContainMeridiemView ? resolvedViews.filter(view => view !== 'meridiem') : resolvedViews;
|
|
98
|
+
const actionBarActions = shouldRenderTimeInASingleColumn ? [] : ['accept'];
|
|
63
99
|
|
|
64
100
|
// Props with the default values specific to the desktop variant
|
|
65
101
|
const props = _extends({}, defaultizedProps, {
|
|
66
102
|
viewRenderers,
|
|
67
103
|
format: resolveDateTimeFormat(utils, defaultizedProps),
|
|
68
104
|
views,
|
|
69
|
-
yearsPerRow:
|
|
105
|
+
yearsPerRow: defaultizedProps.yearsPerRow ?? 4,
|
|
70
106
|
ampmInClock,
|
|
71
107
|
timeSteps,
|
|
72
108
|
thresholdToRenderTimeInASingleColumn,
|
|
73
109
|
shouldRenderTimeInASingleColumn,
|
|
74
110
|
slots: _extends({
|
|
75
111
|
field: DateTimeField,
|
|
112
|
+
layout: DesktopDateTimePickerLayout,
|
|
76
113
|
openPickerIcon: CalendarIcon
|
|
77
114
|
}, defaultizedProps.slots),
|
|
78
115
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
79
|
-
field: ownerState => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
ref
|
|
83
|
-
});
|
|
84
|
-
},
|
|
116
|
+
field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
|
|
117
|
+
ref
|
|
118
|
+
}),
|
|
85
119
|
toolbar: _extends({
|
|
86
120
|
hidden: true,
|
|
87
121
|
ampmInClock,
|
|
88
|
-
toolbarVariant:
|
|
89
|
-
},
|
|
122
|
+
toolbarVariant: 'desktop'
|
|
123
|
+
}, defaultizedProps.slotProps?.toolbar),
|
|
90
124
|
tabs: _extends({
|
|
91
125
|
hidden: true
|
|
92
|
-
},
|
|
93
|
-
actionBar: _extends({
|
|
126
|
+
}, defaultizedProps.slotProps?.tabs),
|
|
127
|
+
actionBar: ownerState => _extends({
|
|
94
128
|
actions: actionBarActions
|
|
95
|
-
}, (
|
|
129
|
+
}, resolveComponentProps(defaultizedProps.slotProps?.actionBar, ownerState))
|
|
96
130
|
})
|
|
97
131
|
});
|
|
98
132
|
const {
|
|
@@ -101,8 +135,9 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
|
|
|
101
135
|
props,
|
|
102
136
|
valueManager: singleItemValueManager,
|
|
103
137
|
valueType: 'date-time',
|
|
104
|
-
getOpenDialogAriaText:
|
|
105
|
-
validator: validateDateTime
|
|
138
|
+
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ?? localeText.openDatePickerDialogue,
|
|
139
|
+
validator: validateDateTime,
|
|
140
|
+
rendererInterceptor
|
|
106
141
|
});
|
|
107
142
|
return renderPicker();
|
|
108
143
|
});
|
|
@@ -361,7 +396,7 @@ DesktopDateTimePicker.propTypes = {
|
|
|
361
396
|
/**
|
|
362
397
|
* Disable specific date.
|
|
363
398
|
*
|
|
364
|
-
* Warning: This function can be called multiple times (
|
|
399
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
365
400
|
*
|
|
366
401
|
* @template TDate
|
|
367
402
|
* @param {TDate} day The date to test.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PickersLayoutProps } from '../PickersLayout';
|
|
3
|
+
import { PickerValidDate } from '../models';
|
|
4
|
+
import { DateOrTimeViewWithMeridiem } from '../internals';
|
|
5
|
+
/**
|
|
6
|
+
* @ignore - internal component.
|
|
7
|
+
*/
|
|
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
|
+
}
|
|
12
|
+
export { DesktopDateTimePickerLayout };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import Divider from '@mui/material/Divider';
|
|
5
|
+
import { PickersLayoutContentWrapper, PickersLayoutRoot, pickersLayoutClasses, usePickerLayout } from '../PickersLayout';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
/**
|
|
9
|
+
* @ignore - internal component.
|
|
10
|
+
*/
|
|
11
|
+
function DesktopDateTimePickerLayout(props) {
|
|
12
|
+
const {
|
|
13
|
+
toolbar,
|
|
14
|
+
tabs,
|
|
15
|
+
content,
|
|
16
|
+
actionBar,
|
|
17
|
+
shortcuts
|
|
18
|
+
} = usePickerLayout(props);
|
|
19
|
+
const {
|
|
20
|
+
sx,
|
|
21
|
+
className,
|
|
22
|
+
isLandscape,
|
|
23
|
+
ref
|
|
24
|
+
} = props;
|
|
25
|
+
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
26
|
+
return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
|
|
27
|
+
ref: ref,
|
|
28
|
+
className: clsx(className, pickersLayoutClasses.root),
|
|
29
|
+
sx: [{
|
|
30
|
+
[`& .${pickersLayoutClasses.tabs}`]: {
|
|
31
|
+
gridRow: 4,
|
|
32
|
+
gridColumn: '1 / 4'
|
|
33
|
+
},
|
|
34
|
+
[`& .${pickersLayoutClasses.actionBar}`]: {
|
|
35
|
+
gridRow: 5
|
|
36
|
+
}
|
|
37
|
+
}, ...(Array.isArray(sx) ? sx : [sx])],
|
|
38
|
+
ownerState: props,
|
|
39
|
+
children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/_jsxs(PickersLayoutContentWrapper, {
|
|
40
|
+
className: pickersLayoutClasses.contentWrapper,
|
|
41
|
+
sx: {
|
|
42
|
+
display: 'grid'
|
|
43
|
+
},
|
|
44
|
+
children: [content, tabs, isActionBarVisible && /*#__PURE__*/_jsx(Divider, {
|
|
45
|
+
sx: {
|
|
46
|
+
gridRow: 3,
|
|
47
|
+
gridColumn: '1 / 4'
|
|
48
|
+
}
|
|
49
|
+
})]
|
|
50
|
+
}), actionBar]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes = {
|
|
54
|
+
// ----------------------------- Warning --------------------------------
|
|
55
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
56
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
57
|
+
// ----------------------------------------------------------------------
|
|
58
|
+
children: PropTypes.node,
|
|
59
|
+
/**
|
|
60
|
+
* Override or extend the styles applied to the component.
|
|
61
|
+
*/
|
|
62
|
+
classes: PropTypes.object,
|
|
63
|
+
className: PropTypes.string,
|
|
64
|
+
disabled: PropTypes.bool,
|
|
65
|
+
isLandscape: PropTypes.bool.isRequired,
|
|
66
|
+
isValid: PropTypes.func.isRequired,
|
|
67
|
+
onAccept: PropTypes.func.isRequired,
|
|
68
|
+
onCancel: PropTypes.func.isRequired,
|
|
69
|
+
onChange: PropTypes.func.isRequired,
|
|
70
|
+
onClear: PropTypes.func.isRequired,
|
|
71
|
+
onClose: PropTypes.func.isRequired,
|
|
72
|
+
onDismiss: PropTypes.func.isRequired,
|
|
73
|
+
onOpen: PropTypes.func.isRequired,
|
|
74
|
+
onSelectShortcut: PropTypes.func.isRequired,
|
|
75
|
+
onSetToday: PropTypes.func.isRequired,
|
|
76
|
+
onViewChange: PropTypes.func.isRequired,
|
|
77
|
+
/**
|
|
78
|
+
* Force rendering in particular orientation.
|
|
79
|
+
*/
|
|
80
|
+
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
81
|
+
readOnly: PropTypes.bool,
|
|
82
|
+
/**
|
|
83
|
+
* The props used for each component slot.
|
|
84
|
+
* @default {}
|
|
85
|
+
*/
|
|
86
|
+
slotProps: PropTypes.object,
|
|
87
|
+
/**
|
|
88
|
+
* Overridable component slots.
|
|
89
|
+
* @default {}
|
|
90
|
+
*/
|
|
91
|
+
slots: PropTypes.object,
|
|
92
|
+
/**
|
|
93
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
94
|
+
*/
|
|
95
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
96
|
+
value: PropTypes.any,
|
|
97
|
+
view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
|
|
98
|
+
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired,
|
|
99
|
+
wrapperVariant: PropTypes.oneOf(['desktop', 'mobile'])
|
|
100
|
+
} : void 0;
|
|
101
|
+
export { DesktopDateTimePickerLayout };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { DesktopDateTimePicker } from './DesktopDateTimePicker';
|
|
2
|
+
export { DesktopDateTimePickerLayout } from './DesktopDateTimePickerLayout';
|
|
2
3
|
export type { DesktopDateTimePickerProps, DesktopDateTimePickerSlots, DesktopDateTimePickerSlotProps, } from './DesktopDateTimePicker.types';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { DesktopDateTimePicker } from './DesktopDateTimePicker';
|
|
1
|
+
export { DesktopDateTimePicker } from './DesktopDateTimePicker';
|
|
2
|
+
export { DesktopDateTimePickerLayout } from './DesktopDateTimePickerLayout';
|