@mui/x-date-pickers 8.0.0-alpha.1 → 8.0.0-alpha.3
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/AdapterMoment/AdapterMoment.js +10 -0
- package/CHANGELOG.md +330 -7
- package/DateCalendar/DateCalendar.types.d.ts +2 -1
- package/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/DateCalendar/PickersSlideTransition.js +12 -5
- package/DateCalendar/useCalendarState.d.ts +6 -4
- package/DateField/DateField.js +5 -4
- package/DateField/DateField.types.d.ts +10 -9
- package/DatePicker/DatePicker.types.d.ts +3 -3
- package/DatePicker/DatePickerToolbar.d.ts +3 -2
- package/DatePicker/shared.d.ts +6 -5
- package/DateTimeField/DateTimeField.js +5 -4
- package/DateTimeField/DateTimeField.types.d.ts +10 -10
- package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
- package/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/DateTimePicker/DateTimePickerToolbar.d.ts +2 -3
- package/DateTimePicker/shared.d.ts +6 -6
- package/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +2 -1
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -21
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +6 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +4 -4
- package/PickersActionBar/PickersActionBar.js +8 -1
- package/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -4
- package/PickersLayout/PickersLayout.d.ts +7 -5
- package/PickersLayout/PickersLayout.js +22 -27
- package/PickersLayout/PickersLayout.types.d.ts +14 -15
- package/PickersLayout/usePickerLayout.d.ts +5 -4
- package/PickersLayout/usePickerLayout.js +19 -12
- package/PickersShortcuts/PickersShortcuts.d.ts +7 -6
- package/PickersShortcuts/PickersShortcuts.js +8 -1
- package/README.md +7 -4
- package/TimeField/TimeField.js +5 -4
- package/TimeField/TimeField.types.d.ts +10 -10
- package/TimePicker/TimePicker.types.d.ts +3 -3
- package/TimePicker/TimePickerToolbar.d.ts +2 -3
- package/TimePicker/shared.d.ts +6 -6
- package/hooks/useParsedFormat.d.ts +2 -2
- package/hooks/useParsedFormat.js +1 -1
- package/index.js +1 -1
- package/internals/components/PickerProvider.d.ts +2 -15
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +11 -8
- package/internals/components/PickersToolbar.d.ts +3 -3
- package/internals/hooks/useClockReferenceDate.d.ts +2 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -14
- package/internals/hooks/useField/useField.d.ts +3 -3
- package/internals/hooks/useField/useField.types.d.ts +45 -45
- package/internals/hooks/useField/useField.utils.d.ts +4 -3
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +6 -5
- package/internals/hooks/useField/useFieldState.d.ts +9 -8
- package/internals/hooks/useField/useFieldState.js +0 -1
- package/internals/hooks/useField/useFieldV6TextField.d.ts +4 -3
- package/internals/hooks/useFieldOwnerState.d.ts +6 -0
- package/internals/hooks/useFieldOwnerState.js +12 -0
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +11 -11
- package/internals/hooks/useOpenState.d.ts +3 -2
- package/internals/hooks/useOpenState.js +10 -9
- package/internals/hooks/usePicker/usePicker.d.ts +3 -3
- package/internals/hooks/usePicker/usePicker.js +4 -10
- package/internals/hooks/usePicker/usePicker.types.d.ts +7 -7
- package/internals/hooks/usePicker/usePickerProvider.d.ts +5 -6
- package/internals/hooks/usePicker/usePickerProvider.js +8 -10
- package/internals/hooks/usePicker/usePickerValue.d.ts +3 -2
- package/internals/hooks/usePicker/usePickerValue.js +22 -12
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +51 -24
- package/internals/hooks/usePicker/usePickerViews.d.ts +10 -10
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -6
- package/internals/hooks/useValueWithTimezone.d.ts +5 -4
- package/internals/hooks/useViews.d.ts +5 -5
- package/internals/index.d.ts +4 -2
- package/internals/index.js +1 -0
- package/internals/models/fields.d.ts +6 -1
- package/internals/models/pickers.d.ts +1 -0
- package/internals/models/pickers.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +4 -3
- package/internals/models/props/time.d.ts +2 -1
- package/internals/models/props/toolbar.d.ts +2 -1
- package/internals/models/value.d.ts +9 -0
- package/internals/utils/date-utils.d.ts +1 -1
- package/internals/utils/valueManagers.d.ts +4 -3
- package/locales/nlNL.js +7 -7
- package/models/adapters.d.ts +4 -4
- package/models/fields.d.ts +19 -5
- package/models/validation.d.ts +2 -1
- package/modern/AdapterMoment/AdapterMoment.js +10 -0
- package/modern/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/modern/DateCalendar/PickersSlideTransition.js +12 -5
- package/modern/DateField/DateField.js +5 -4
- package/modern/DateTimeField/DateTimeField.js +5 -4
- package/modern/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -21
- package/modern/PickersActionBar/PickersActionBar.js +8 -1
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/modern/PickersLayout/PickersLayout.js +22 -27
- package/modern/PickersLayout/usePickerLayout.js +19 -12
- package/modern/PickersShortcuts/PickersShortcuts.js +8 -1
- package/modern/TimeField/TimeField.js +5 -4
- package/modern/hooks/useParsedFormat.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/modern/internals/hooks/useField/useFieldState.js +0 -1
- package/modern/internals/hooks/useFieldOwnerState.js +12 -0
- package/modern/internals/hooks/useOpenState.js +10 -9
- package/modern/internals/hooks/usePicker/usePicker.js +4 -10
- package/modern/internals/hooks/usePicker/usePickerProvider.js +8 -10
- package/modern/internals/hooks/usePicker/usePickerValue.js +22 -12
- package/modern/internals/index.js +1 -0
- package/modern/internals/models/pickers.js +1 -0
- package/modern/locales/nlNL.js +7 -7
- package/modern/validation/useValidation.js +1 -1
- package/modern/validation/validateDate.js +8 -0
- package/modern/validation/validateDateTime.js +8 -0
- package/modern/validation/validateTime.js +8 -0
- package/node/AdapterMoment/AdapterMoment.js +10 -0
- package/node/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/node/DateCalendar/PickersSlideTransition.js +12 -5
- package/node/DateField/DateField.js +5 -4
- package/node/DateTimeField/DateTimeField.js +5 -4
- package/node/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -22
- package/node/PickersActionBar/PickersActionBar.js +8 -1
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/node/PickersLayout/PickersLayout.js +22 -27
- package/node/PickersLayout/usePickerLayout.js +19 -12
- package/node/PickersShortcuts/PickersShortcuts.js +8 -1
- package/node/TimeField/TimeField.js +5 -4
- package/node/hooks/useParsedFormat.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/node/internals/hooks/useField/useFieldState.js +0 -1
- package/node/internals/hooks/useFieldOwnerState.js +20 -0
- package/node/internals/hooks/useOpenState.js +10 -9
- package/node/internals/hooks/usePicker/usePicker.js +5 -10
- package/node/internals/hooks/usePicker/usePickerProvider.js +9 -11
- package/node/internals/hooks/usePicker/usePickerValue.js +22 -11
- package/node/internals/index.js +7 -0
- package/node/internals/models/pickers.js +5 -0
- package/node/locales/nlNL.js +7 -7
- package/node/validation/useValidation.js +1 -1
- package/node/validation/validateDate.js +8 -0
- package/node/validation/validateDateTime.js +8 -0
- package/node/validation/validateTime.js +8 -0
- package/package.json +2 -2
- package/themeAugmentation/overrides.d.ts +1 -1
- package/themeAugmentation/props.d.ts +3 -2
- package/validation/useValidation.d.ts +7 -6
- package/validation/useValidation.js +1 -1
- package/validation/validateDate.d.ts +12 -3
- package/validation/validateDate.js +8 -0
- package/validation/validateDateTime.d.ts +12 -4
- package/validation/validateDateTime.js +8 -0
- package/validation/validateTime.d.ts +12 -3
- package/validation/validateTime.js +8 -0
- package/internals/hooks/useIsLandscape.d.ts +0 -4
- package/internals/hooks/useIsLandscape.js +0 -35
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +0 -32
- package/internals/hooks/usePicker/usePickerLayoutProps.js +0 -31
- package/modern/internals/hooks/useIsLandscape.js +0 -35
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +0 -31
- package/node/internals/hooks/useIsLandscape.js +0 -43
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +0 -38
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
2
3
|
import { usePickerValue } from "./usePickerValue.js";
|
|
3
4
|
import { usePickerViews } from "./usePickerViews.js";
|
|
4
|
-
import { usePickerLayoutProps } from "./usePickerLayoutProps.js";
|
|
5
5
|
import { usePickerProvider } from "./usePickerProvider.js";
|
|
6
6
|
export const usePicker = ({
|
|
7
7
|
props,
|
|
@@ -35,19 +35,13 @@ export const usePicker = ({
|
|
|
35
35
|
propsFromPickerValue: pickerValueResponse.viewProps,
|
|
36
36
|
rendererInterceptor
|
|
37
37
|
});
|
|
38
|
-
const pickerLayoutResponse = usePickerLayoutProps({
|
|
39
|
-
props,
|
|
40
|
-
variant,
|
|
41
|
-
propsFromPickerValue: pickerValueResponse.layoutProps,
|
|
42
|
-
propsFromPickerViews: pickerViewsResponse.layoutProps
|
|
43
|
-
});
|
|
44
38
|
const providerProps = usePickerProvider({
|
|
45
39
|
props,
|
|
46
|
-
pickerValueResponse,
|
|
47
40
|
localeText,
|
|
48
41
|
valueManager,
|
|
49
42
|
variant,
|
|
50
|
-
views: pickerViewsResponse.views
|
|
43
|
+
views: pickerViewsResponse.views,
|
|
44
|
+
paramsFromUsePickerValue: pickerValueResponse.provider
|
|
51
45
|
});
|
|
52
46
|
return {
|
|
53
47
|
// Picker value
|
|
@@ -59,7 +53,7 @@ export const usePicker = ({
|
|
|
59
53
|
hasUIView: pickerViewsResponse.hasUIView,
|
|
60
54
|
shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
|
|
61
55
|
// Picker layout
|
|
62
|
-
layoutProps:
|
|
56
|
+
layoutProps: _extends({}, pickerViewsResponse.layoutProps, pickerValueResponse.layoutProps),
|
|
63
57
|
// Picker provider
|
|
64
58
|
providerProps,
|
|
65
59
|
// Picker owner state
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
3
4
|
import { useUtils } from "../useUtils.js";
|
|
@@ -36,31 +37,28 @@ export const usePickerOrientation = (views, customOrientation) => {
|
|
|
36
37
|
export function usePickerProvider(parameters) {
|
|
37
38
|
const {
|
|
38
39
|
props,
|
|
39
|
-
pickerValueResponse,
|
|
40
40
|
valueManager,
|
|
41
41
|
localeText,
|
|
42
42
|
variant,
|
|
43
|
-
views
|
|
43
|
+
views,
|
|
44
|
+
paramsFromUsePickerValue
|
|
44
45
|
} = parameters;
|
|
45
46
|
const utils = useUtils();
|
|
46
47
|
const orientation = usePickerOrientation(views, props.orientation);
|
|
47
48
|
const ownerState = React.useMemo(() => ({
|
|
48
|
-
isPickerValueEmpty: valueManager.areValuesEqual(utils,
|
|
49
|
-
isPickerOpen:
|
|
49
|
+
isPickerValueEmpty: valueManager.areValuesEqual(utils, paramsFromUsePickerValue.value, valueManager.emptyValue),
|
|
50
|
+
isPickerOpen: paramsFromUsePickerValue.contextValue.open,
|
|
50
51
|
isPickerDisabled: props.disabled ?? false,
|
|
51
52
|
isPickerReadOnly: props.readOnly ?? false,
|
|
52
53
|
pickerOrientation: orientation,
|
|
53
54
|
pickerVariant: variant
|
|
54
|
-
}), [utils, valueManager,
|
|
55
|
-
const contextValue = React.useMemo(() => ({
|
|
56
|
-
onOpen: pickerValueResponse.actions.onOpen,
|
|
57
|
-
onClose: pickerValueResponse.actions.onClose,
|
|
58
|
-
open: pickerValueResponse.open,
|
|
55
|
+
}), [utils, valueManager, paramsFromUsePickerValue.value, paramsFromUsePickerValue.contextValue.open, orientation, variant, props.disabled, props.readOnly]);
|
|
56
|
+
const contextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.contextValue, {
|
|
59
57
|
disabled: props.disabled ?? false,
|
|
60
58
|
readOnly: props.readOnly ?? false,
|
|
61
59
|
variant,
|
|
62
60
|
orientation
|
|
63
|
-
}), [
|
|
61
|
+
}), [paramsFromUsePickerValue.contextValue, variant, orientation, props.disabled, props.readOnly]);
|
|
64
62
|
const privateContextValue = React.useMemo(() => ({
|
|
65
63
|
ownerState
|
|
66
64
|
}), [ownerState]);
|
|
@@ -5,7 +5,6 @@ import { useOpenState } from "../useOpenState.js";
|
|
|
5
5
|
import { useLocalizationContext, useUtils } from "../useUtils.js";
|
|
6
6
|
import { useValidation } from "../../../validation/index.js";
|
|
7
7
|
import { useValueWithTimezone } from "../useValueWithTimezone.js";
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* Decide if the new value should be published
|
|
11
10
|
* The published value will be passed to `onChange` if defined.
|
|
@@ -151,8 +150,8 @@ export const usePickerValue = ({
|
|
|
151
150
|
const utils = useUtils();
|
|
152
151
|
const adapter = useLocalizationContext();
|
|
153
152
|
const {
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
open,
|
|
154
|
+
setOpen
|
|
156
155
|
} = useOpenState(props);
|
|
157
156
|
const {
|
|
158
157
|
timezone,
|
|
@@ -238,7 +237,7 @@ export const usePickerValue = ({
|
|
|
238
237
|
onAccept(action.value, getContext());
|
|
239
238
|
}
|
|
240
239
|
if (shouldClose) {
|
|
241
|
-
|
|
240
|
+
setOpen(false);
|
|
242
241
|
}
|
|
243
242
|
});
|
|
244
243
|
if (dateState.lastControlledValue !== inValueWithoutRenderTimezone) {
|
|
@@ -289,11 +288,11 @@ export const usePickerValue = ({
|
|
|
289
288
|
});
|
|
290
289
|
const handleOpen = useEventCallback(event => {
|
|
291
290
|
event.preventDefault();
|
|
292
|
-
|
|
291
|
+
setOpen(true);
|
|
293
292
|
});
|
|
294
293
|
const handleClose = useEventCallback(event => {
|
|
295
294
|
event?.preventDefault();
|
|
296
|
-
|
|
295
|
+
setOpen(false);
|
|
297
296
|
});
|
|
298
297
|
const handleChange = useEventCallback((newValue, selectionState = 'partial') => updateDate({
|
|
299
298
|
name: 'setValueFromView',
|
|
@@ -324,12 +323,12 @@ export const usePickerValue = ({
|
|
|
324
323
|
value: dateState.draft,
|
|
325
324
|
onChange: handleChangeFromField
|
|
326
325
|
};
|
|
327
|
-
const
|
|
326
|
+
const valueWithoutError = React.useMemo(() => valueManager.cleanValue(utils, dateState.draft), [utils, valueManager, dateState.draft]);
|
|
328
327
|
const viewResponse = {
|
|
329
|
-
value:
|
|
328
|
+
value: valueWithoutError,
|
|
330
329
|
onChange: handleChange,
|
|
331
330
|
onClose: handleClose,
|
|
332
|
-
open
|
|
331
|
+
open
|
|
333
332
|
};
|
|
334
333
|
const isValid = testedValue => {
|
|
335
334
|
const error = validator({
|
|
@@ -341,16 +340,27 @@ export const usePickerValue = ({
|
|
|
341
340
|
return !valueManager.hasError(error);
|
|
342
341
|
};
|
|
343
342
|
const layoutResponse = _extends({}, actions, {
|
|
344
|
-
value:
|
|
343
|
+
value: valueWithoutError,
|
|
345
344
|
onChange: handleChange,
|
|
346
345
|
onSelectShortcut: handleSelectShortcut,
|
|
347
346
|
isValid
|
|
348
347
|
});
|
|
348
|
+
const contextValue = React.useMemo(() => {
|
|
349
|
+
return {
|
|
350
|
+
open,
|
|
351
|
+
setOpen
|
|
352
|
+
};
|
|
353
|
+
}, [open, setOpen]);
|
|
354
|
+
const providerParams = {
|
|
355
|
+
value: valueWithoutError,
|
|
356
|
+
contextValue
|
|
357
|
+
};
|
|
349
358
|
return {
|
|
350
|
-
open
|
|
359
|
+
open,
|
|
351
360
|
fieldProps: fieldResponse,
|
|
352
361
|
viewProps: viewResponse,
|
|
353
362
|
layoutProps: layoutResponse,
|
|
354
|
-
actions
|
|
363
|
+
actions,
|
|
364
|
+
provider: providerParams
|
|
355
365
|
};
|
|
356
366
|
};
|
|
@@ -12,6 +12,7 @@ export { PickersToolbarButton } from "./components/PickersToolbarButton.js";
|
|
|
12
12
|
export { DAY_MARGIN, DIALOG_WIDTH, VIEW_HEIGHT } from "./constants/dimensions.js";
|
|
13
13
|
export { useControlledValueWithTimezone } from "./hooks/useValueWithTimezone.js";
|
|
14
14
|
export { useField, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./hooks/useField/index.js";
|
|
15
|
+
export { useFieldOwnerState } from "./hooks/useFieldOwnerState.js";
|
|
15
16
|
export { usePicker } from "./hooks/usePicker/index.js";
|
|
16
17
|
export { usePickerPrivateContext } from "./hooks/usePickerPrivateContext.js";
|
|
17
18
|
export { useStaticPicker } from "./hooks/useStaticPicker/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/modern/locales/nlNL.js
CHANGED
|
@@ -16,10 +16,10 @@ const nlNLPickers = {
|
|
|
16
16
|
// DateRange labels
|
|
17
17
|
start: 'Start',
|
|
18
18
|
end: 'Einde',
|
|
19
|
-
startDate: '
|
|
20
|
-
startTime: '
|
|
21
|
-
endDate: '
|
|
22
|
-
endTime: '
|
|
19
|
+
startDate: 'Startdatum',
|
|
20
|
+
startTime: 'Starttijd',
|
|
21
|
+
endDate: 'Einddatum',
|
|
22
|
+
endTime: 'Eindtijd',
|
|
23
23
|
// Action bar
|
|
24
24
|
cancelButtonLabel: 'Annuleren',
|
|
25
25
|
clearButtonLabel: 'Resetten',
|
|
@@ -50,11 +50,11 @@ const nlNLPickers = {
|
|
|
50
50
|
timeTableLabel: 'kies tijd',
|
|
51
51
|
dateTableLabel: 'kies datum',
|
|
52
52
|
// Field section placeholders
|
|
53
|
-
fieldYearPlaceholder: params => '
|
|
53
|
+
fieldYearPlaceholder: params => 'J'.repeat(params.digitAmount),
|
|
54
54
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
55
55
|
fieldDayPlaceholder: () => 'DD',
|
|
56
56
|
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
57
|
-
fieldHoursPlaceholder: () => '
|
|
57
|
+
fieldHoursPlaceholder: () => 'uu',
|
|
58
58
|
fieldMinutesPlaceholder: () => 'mm',
|
|
59
59
|
fieldSecondsPlaceholder: () => 'ss',
|
|
60
60
|
fieldMeridiemPlaceholder: () => 'aa',
|
|
@@ -68,6 +68,6 @@ const nlNLPickers = {
|
|
|
68
68
|
seconds: 'Seconden',
|
|
69
69
|
meridiem: 'Middag',
|
|
70
70
|
// Common
|
|
71
|
-
empty: '
|
|
71
|
+
empty: 'Leeg'
|
|
72
72
|
};
|
|
73
73
|
export const nlNL = getPickersLocalization(nlNLPickers);
|
|
@@ -5,7 +5,7 @@ import useEventCallback from '@mui/utils/useEventCallback';
|
|
|
5
5
|
import { useLocalizationContext } from "../internals/hooks/useUtils.js";
|
|
6
6
|
/**
|
|
7
7
|
* Utility hook to check if a given value is valid based on the provided validation props.
|
|
8
|
-
* @template TValue The value type. It will be
|
|
8
|
+
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
9
9
|
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
10
10
|
* @param {UseValidationOptions<TValue, TError, TValidationProps>} options The options to configure the hook.
|
|
11
11
|
* @param {TValue} options.value The value to validate.
|
|
@@ -5,6 +5,14 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
|
5
5
|
* Validation props used by the Date Picker, Date Field and Date Calendar components.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Validation props as received by the validateDate method.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Name of the props that should be defaulted before being passed to the validateDate method.
|
|
14
|
+
*/
|
|
15
|
+
|
|
8
16
|
export const validateDate = ({
|
|
9
17
|
props,
|
|
10
18
|
value,
|
|
@@ -6,6 +6,14 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
|
6
6
|
* Validation props used by the Date Time Picker and Date Time Field components.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Validation props as received by the validateDateTime method.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Name of the props that should be defaulted before being passed to the validateDateTime method.
|
|
15
|
+
*/
|
|
16
|
+
|
|
9
17
|
export const validateDateTime = ({
|
|
10
18
|
adapter,
|
|
11
19
|
value,
|
|
@@ -5,6 +5,14 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
|
5
5
|
* Validation props used by the Time Picker, Time Field and Clock components.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Validation props as received by the validateTime method.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Name of the props that should be defaulted before being passed to the validateTime method.
|
|
14
|
+
*/
|
|
15
|
+
|
|
8
16
|
export const validateTime = ({
|
|
9
17
|
adapter,
|
|
10
18
|
value,
|
|
@@ -438,12 +438,22 @@ class AdapterMoment {
|
|
|
438
438
|
const end = this.endOfWeek(this.endOfMonth(value));
|
|
439
439
|
let count = 0;
|
|
440
440
|
let current = start;
|
|
441
|
+
let currentDayOfYear = current.get('dayOfYear');
|
|
441
442
|
const nestedWeeks = [];
|
|
442
443
|
while (current.isBefore(end)) {
|
|
443
444
|
const weekNumber = Math.floor(count / 7);
|
|
444
445
|
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
|
445
446
|
nestedWeeks[weekNumber].push(current);
|
|
447
|
+
const prevDayOfYear = currentDayOfYear;
|
|
446
448
|
current = this.addDays(current, 1);
|
|
449
|
+
currentDayOfYear = current.get('dayOfYear');
|
|
450
|
+
|
|
451
|
+
// If there is a TZ change at midnight, adding 1 day may only increase the date by 23 hours to 11pm
|
|
452
|
+
// To fix, bump the date into the next day (add 12 hours) and then revert to the start of the day
|
|
453
|
+
// See https://github.com/moment/moment/issues/4743#issuecomment-811306874 for context.
|
|
454
|
+
if (prevDayOfYear === currentDayOfYear) {
|
|
455
|
+
current = current.add(12, 'h').startOf('day');
|
|
456
|
+
}
|
|
447
457
|
count += 1;
|
|
448
458
|
}
|
|
449
459
|
return nestedWeeks;
|
|
@@ -14,10 +14,7 @@ var _styles = require("@mui/material/styles");
|
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
15
|
var _pickersFadeTransitionGroupClasses = require("./pickersFadeTransitionGroupClasses");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const useUtilityClasses =
|
|
18
|
-
const {
|
|
19
|
-
classes
|
|
20
|
-
} = ownerState;
|
|
17
|
+
const useUtilityClasses = classes => {
|
|
21
18
|
const slots = {
|
|
22
19
|
root: ['root']
|
|
23
20
|
};
|
|
@@ -44,9 +41,10 @@ function PickersFadeTransitionGroup(inProps) {
|
|
|
44
41
|
children,
|
|
45
42
|
className,
|
|
46
43
|
reduceAnimations,
|
|
47
|
-
transKey
|
|
44
|
+
transKey,
|
|
45
|
+
classes: classesProp
|
|
48
46
|
} = props;
|
|
49
|
-
const classes = useUtilityClasses(
|
|
47
|
+
const classes = useUtilityClasses(classesProp);
|
|
50
48
|
const theme = (0, _styles.useTheme)();
|
|
51
49
|
if (reduceAnimations) {
|
|
52
50
|
return children;
|
|
@@ -14,11 +14,11 @@ var _styles = require("@mui/material/styles");
|
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
15
|
var _reactTransitionGroup = require("react-transition-group");
|
|
16
16
|
var _pickersSlideTransitionClasses = require("./pickersSlideTransitionClasses");
|
|
17
|
+
var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
19
|
const _excluded = ["children", "className", "reduceAnimations", "slideDirection", "transKey", "classes"];
|
|
19
|
-
const useUtilityClasses = ownerState => {
|
|
20
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
20
21
|
const {
|
|
21
|
-
classes,
|
|
22
22
|
slideDirection
|
|
23
23
|
} = ownerState;
|
|
24
24
|
const slots = {
|
|
@@ -107,11 +107,18 @@ function PickersSlideTransition(inProps) {
|
|
|
107
107
|
children,
|
|
108
108
|
className,
|
|
109
109
|
reduceAnimations,
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
slideDirection,
|
|
111
|
+
transKey,
|
|
112
|
+
classes: classesProp
|
|
112
113
|
} = props,
|
|
113
114
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
114
|
-
const
|
|
115
|
+
const {
|
|
116
|
+
ownerState: pickerOwnerState
|
|
117
|
+
} = (0, _usePickerPrivateContext.usePickerPrivateContext)();
|
|
118
|
+
const ownerState = (0, _extends2.default)({}, pickerOwnerState, {
|
|
119
|
+
slideDirection
|
|
120
|
+
});
|
|
121
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
115
122
|
const theme = (0, _styles.useTheme)();
|
|
116
123
|
if (reduceAnimations) {
|
|
117
124
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -19,6 +19,7 @@ var _useDateField = require("./useDateField");
|
|
|
19
19
|
var _hooks = require("../hooks");
|
|
20
20
|
var _PickersTextField = require("../PickersTextField");
|
|
21
21
|
var _convertFieldResponseIntoMuiTextFieldProps = require("../internals/utils/convertFieldResponseIntoMuiTextFieldProps");
|
|
22
|
+
var _useFieldOwnerState = require("../internals/hooks/useFieldOwnerState");
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
24
|
const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
|
|
24
25
|
/**
|
|
@@ -43,7 +44,7 @@ const DateField = exports.DateField = /*#__PURE__*/React.forwardRef(function Dat
|
|
|
43
44
|
inputProps
|
|
44
45
|
} = themeProps,
|
|
45
46
|
other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
|
|
46
|
-
const ownerState = themeProps;
|
|
47
|
+
const ownerState = (0, _useFieldOwnerState.useFieldOwnerState)(themeProps);
|
|
47
48
|
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? _TextField.default : _PickersTextField.PickersTextField);
|
|
48
49
|
const textFieldProps = (0, _useSlotProps.default)({
|
|
49
50
|
elementType: TextField,
|
|
@@ -274,10 +275,10 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
274
275
|
*/
|
|
275
276
|
shouldDisableYear: _propTypes.default.func,
|
|
276
277
|
/**
|
|
277
|
-
* If `true`, the format will respect the leading zeroes (
|
|
278
|
-
* If `false`, the format will always add leading zeroes (
|
|
278
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
279
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
279
280
|
*
|
|
280
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
281
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
281
282
|
*
|
|
282
283
|
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
283
284
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -19,6 +19,7 @@ var _useDateTimeField = require("./useDateTimeField");
|
|
|
19
19
|
var _hooks = require("../hooks");
|
|
20
20
|
var _PickersTextField = require("../PickersTextField");
|
|
21
21
|
var _convertFieldResponseIntoMuiTextFieldProps = require("../internals/utils/convertFieldResponseIntoMuiTextFieldProps");
|
|
22
|
+
var _useFieldOwnerState = require("../internals/hooks/useFieldOwnerState");
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
24
|
const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
|
|
24
25
|
/**
|
|
@@ -43,7 +44,7 @@ const DateTimeField = exports.DateTimeField = /*#__PURE__*/React.forwardRef(func
|
|
|
43
44
|
inputProps
|
|
44
45
|
} = themeProps,
|
|
45
46
|
other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
|
|
46
|
-
const ownerState = themeProps;
|
|
47
|
+
const ownerState = (0, _useFieldOwnerState.useFieldOwnerState)(themeProps);
|
|
47
48
|
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? _TextField.default : _PickersTextField.PickersTextField);
|
|
48
49
|
const textFieldProps = (0, _useSlotProps.default)({
|
|
49
50
|
elementType: TextField,
|
|
@@ -314,10 +315,10 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
314
315
|
*/
|
|
315
316
|
shouldDisableYear: _propTypes.default.func,
|
|
316
317
|
/**
|
|
317
|
-
* If `true`, the format will respect the leading zeroes (
|
|
318
|
-
* If `false`, the format will always add leading zeroes (
|
|
318
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
319
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
319
320
|
*
|
|
320
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
321
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
321
322
|
*
|
|
322
323
|
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
323
324
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -18,6 +18,7 @@ var _icons = require("../icons");
|
|
|
18
18
|
var _usePickerTranslations = require("../hooks/usePickerTranslations");
|
|
19
19
|
var _dateTimePickerTabsClasses = require("./dateTimePickerTabsClasses");
|
|
20
20
|
var _dateUtils = require("../internals/utils/date-utils");
|
|
21
|
+
var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
|
|
21
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
23
|
const viewToTab = view => {
|
|
23
24
|
if ((0, _dateUtils.isDatePickerView)(view)) {
|
|
@@ -31,10 +32,7 @@ const tabToView = tab => {
|
|
|
31
32
|
}
|
|
32
33
|
return 'hours';
|
|
33
34
|
};
|
|
34
|
-
const useUtilityClasses =
|
|
35
|
-
const {
|
|
36
|
-
classes
|
|
37
|
-
} = ownerState;
|
|
35
|
+
const useUtilityClasses = classes => {
|
|
38
36
|
const slots = {
|
|
39
37
|
root: ['root']
|
|
40
38
|
};
|
|
@@ -79,10 +77,14 @@ const DateTimePickerTabs = exports.DateTimePickerTabs = function DateTimePickerT
|
|
|
79
77
|
view,
|
|
80
78
|
hidden = typeof window === 'undefined' || window.innerHeight < 667,
|
|
81
79
|
className,
|
|
80
|
+
classes: classesProp,
|
|
82
81
|
sx
|
|
83
82
|
} = props;
|
|
84
83
|
const translations = (0, _usePickerTranslations.usePickerTranslations)();
|
|
85
|
-
const
|
|
84
|
+
const {
|
|
85
|
+
ownerState
|
|
86
|
+
} = (0, _usePickerPrivateContext.usePickerPrivateContext)();
|
|
87
|
+
const classes = useUtilityClasses(classesProp);
|
|
86
88
|
const handleChange = (event, value) => {
|
|
87
89
|
onViewChange(tabToView(value));
|
|
88
90
|
};
|
|
@@ -90,7 +92,7 @@ const DateTimePickerTabs = exports.DateTimePickerTabs = function DateTimePickerT
|
|
|
90
92
|
return null;
|
|
91
93
|
}
|
|
92
94
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DateTimePickerTabsRoot, {
|
|
93
|
-
ownerState:
|
|
95
|
+
ownerState: ownerState,
|
|
94
96
|
variant: "fullWidth",
|
|
95
97
|
value: viewToTab(view),
|
|
96
98
|
onChange: handleChange,
|
|
@@ -18,11 +18,8 @@ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"
|
|
|
18
18
|
var _dimensions = require("../internals/constants/dimensions");
|
|
19
19
|
var _dayCalendarSkeletonClasses = require("./dayCalendarSkeletonClasses");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
const _excluded = ["className"];
|
|
22
|
-
const useUtilityClasses =
|
|
23
|
-
const {
|
|
24
|
-
classes
|
|
25
|
-
} = ownerState;
|
|
21
|
+
const _excluded = ["className", "classes"];
|
|
22
|
+
const useUtilityClasses = classes => {
|
|
26
23
|
const slots = {
|
|
27
24
|
root: ['root'],
|
|
28
25
|
week: ['week'],
|
|
@@ -52,14 +49,9 @@ const DayCalendarSkeletonDay = (0, _styles.styled)(_Skeleton.default, {
|
|
|
52
49
|
overridesResolver: (props, styles) => styles.daySkeleton
|
|
53
50
|
})({
|
|
54
51
|
margin: `0 ${_dimensions.DAY_MARGIN}px`,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
style: {
|
|
60
|
-
visibility: 'hidden'
|
|
61
|
-
}
|
|
62
|
-
}]
|
|
52
|
+
'&[data-day-in-month="0"]': {
|
|
53
|
+
visibility: 'hidden'
|
|
54
|
+
}
|
|
63
55
|
});
|
|
64
56
|
const monthMap = [[0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0]];
|
|
65
57
|
|
|
@@ -78,23 +70,22 @@ function DayCalendarSkeleton(inProps) {
|
|
|
78
70
|
name: 'MuiDayCalendarSkeleton'
|
|
79
71
|
});
|
|
80
72
|
const {
|
|
81
|
-
className
|
|
73
|
+
className,
|
|
74
|
+
classes: classesProp
|
|
82
75
|
} = props,
|
|
83
76
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
84
|
-
const classes = useUtilityClasses(
|
|
77
|
+
const classes = useUtilityClasses(classesProp);
|
|
85
78
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(DayCalendarSkeletonRoot, (0, _extends2.default)({
|
|
86
79
|
className: (0, _clsx.default)(classes.root, className)
|
|
87
80
|
}, other, {
|
|
88
81
|
children: monthMap.map((week, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(DayCalendarSkeletonWeek, {
|
|
89
82
|
className: classes.week,
|
|
90
|
-
children: week.map((
|
|
83
|
+
children: week.map((dayInMonth, index2) => /*#__PURE__*/(0, _jsxRuntime.jsx)(DayCalendarSkeletonDay, {
|
|
91
84
|
variant: "circular",
|
|
92
85
|
width: _dimensions.DAY_SIZE,
|
|
93
86
|
height: _dimensions.DAY_SIZE,
|
|
94
87
|
className: classes.daySkeleton,
|
|
95
|
-
|
|
96
|
-
day
|
|
97
|
-
}
|
|
88
|
+
"data-day-in-month": dayInMonth
|
|
98
89
|
}, index2))
|
|
99
90
|
}, index))
|
|
100
91
|
}));
|
|
@@ -1,41 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.DesktopDateTimePickerLayout = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
9
|
var React = _interopRequireWildcard(require("react"));
|
|
11
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
11
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
|
-
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
14
12
|
var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
|
|
15
13
|
var _PickersLayout = require("../PickersLayout");
|
|
14
|
+
var _usePickerContext = require("../hooks/usePickerContext");
|
|
16
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
16
|
/**
|
|
18
17
|
* @ignore - internal component.
|
|
19
18
|
*/
|
|
20
19
|
const DesktopDateTimePickerLayout = exports.DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function DesktopDateTimePickerLayout(props, ref) {
|
|
21
|
-
const isRtl = (0, _RtlProvider.useRtl)();
|
|
22
20
|
const {
|
|
23
21
|
toolbar,
|
|
24
22
|
tabs,
|
|
25
23
|
content,
|
|
26
24
|
actionBar,
|
|
27
|
-
shortcuts
|
|
25
|
+
shortcuts,
|
|
26
|
+
ownerState
|
|
28
27
|
} = (0, _PickersLayout.usePickerLayout)(props);
|
|
28
|
+
const {
|
|
29
|
+
orientation
|
|
30
|
+
} = (0, _usePickerContext.usePickerContext)();
|
|
29
31
|
const {
|
|
30
32
|
sx,
|
|
31
33
|
className,
|
|
32
|
-
isLandscape,
|
|
33
34
|
classes
|
|
34
35
|
} = props;
|
|
35
36
|
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
36
|
-
const ownerState = (0, _extends2.default)({}, props, {
|
|
37
|
-
isRtl
|
|
38
|
-
});
|
|
39
37
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PickersLayout.PickersLayoutRoot, {
|
|
40
38
|
ref: ref,
|
|
41
39
|
className: (0, _clsx.default)(_PickersLayout.pickersLayoutClasses.root, classes?.root, className),
|
|
@@ -49,8 +47,9 @@ const DesktopDateTimePickerLayout = exports.DesktopDateTimePickerLayout = /*#__P
|
|
|
49
47
|
}
|
|
50
48
|
}, ...(Array.isArray(sx) ? sx : [sx])],
|
|
51
49
|
ownerState: ownerState,
|
|
52
|
-
children: [
|
|
50
|
+
children: [orientation === 'landscape' ? shortcuts : toolbar, orientation === 'landscape' ? toolbar : shortcuts, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PickersLayout.PickersLayoutContentWrapper, {
|
|
53
51
|
className: (0, _clsx.default)(_PickersLayout.pickersLayoutClasses.contentWrapper, classes?.contentWrapper),
|
|
52
|
+
ownerState: ownerState,
|
|
54
53
|
sx: {
|
|
55
54
|
display: 'grid'
|
|
56
55
|
},
|
|
@@ -74,11 +73,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
|
|
|
74
73
|
*/
|
|
75
74
|
classes: _propTypes.default.object,
|
|
76
75
|
className: _propTypes.default.string,
|
|
77
|
-
isLandscape: _propTypes.default.bool.isRequired,
|
|
78
|
-
/**
|
|
79
|
-
* `true` if the application is in right-to-left direction.
|
|
80
|
-
*/
|
|
81
|
-
isRtl: _propTypes.default.bool.isRequired,
|
|
82
76
|
isValid: _propTypes.default.func.isRequired,
|
|
83
77
|
onAccept: _propTypes.default.func.isRequired,
|
|
84
78
|
onCancel: _propTypes.default.func.isRequired,
|
|
@@ -90,10 +84,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
|
|
|
90
84
|
onSelectShortcut: _propTypes.default.func.isRequired,
|
|
91
85
|
onSetToday: _propTypes.default.func.isRequired,
|
|
92
86
|
onViewChange: _propTypes.default.func.isRequired,
|
|
93
|
-
/**
|
|
94
|
-
* Force rendering in particular orientation.
|
|
95
|
-
*/
|
|
96
|
-
orientation: _propTypes.default.oneOf(['landscape', 'portrait']),
|
|
97
87
|
/**
|
|
98
88
|
* The props used for each component slot.
|
|
99
89
|
* @default {}
|
|
@@ -108,8 +98,7 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
|
|
|
108
98
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
109
99
|
*/
|
|
110
100
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
111
|
-
value: _propTypes.default.
|
|
101
|
+
value: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.object), _propTypes.default.object]),
|
|
112
102
|
view: _propTypes.default.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
|
|
113
|
-
views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
|
|
114
|
-
wrapperVariant: _propTypes.default.oneOf(['desktop', 'mobile'])
|
|
103
|
+
views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
|
|
115
104
|
} : void 0;
|
|
@@ -11,11 +11,18 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
14
15
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
15
16
|
var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
|
|
16
17
|
var _usePickerTranslations = require("../hooks/usePickerTranslations");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
19
|
const _excluded = ["onAccept", "onClear", "onCancel", "onSetToday", "actions"];
|
|
20
|
+
const PickersActionBarRoot = (0, _styles.styled)(_DialogActions.default, {
|
|
21
|
+
name: 'MuiPickersLayout',
|
|
22
|
+
slot: 'ActionBar',
|
|
23
|
+
overridesResolver: (_, styles) => styles.actionBar
|
|
24
|
+
})({});
|
|
25
|
+
|
|
19
26
|
/**
|
|
20
27
|
* Demos:
|
|
21
28
|
*
|
|
@@ -65,7 +72,7 @@ function PickersActionBar(props) {
|
|
|
65
72
|
return null;
|
|
66
73
|
}
|
|
67
74
|
});
|
|
68
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
75
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersActionBarRoot, (0, _extends2.default)({}, other, {
|
|
69
76
|
children: buttons
|
|
70
77
|
}));
|
|
71
78
|
}
|