@mui/x-date-pickers-pro
Version:
The Pro plan edition of the MUI X Date and Time Picker components.
52 lines • 1.79 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { useThemeProps } from '@mui/material/styles';
import { applyDefaultViewProps, resolveTimeViewsResponse, useApplyDefaultValuesToDateTimeValidationProps } from '@mui/x-date-pickers/internals';
import { usePickerAdapter } from '@mui/x-date-pickers/hooks';
import { DateTimeRangePickerToolbar } from "./DateTimeRangePickerToolbar.js";
import { DateTimeRangePickerTabs } from "./DateTimeRangePickerTabs.js";
export function useDateTimeRangePickerDefaultizedProps(props, name) {
const adapter = usePickerAdapter();
const themeProps = useThemeProps({
props,
name
});
const validationProps = useApplyDefaultValuesToDateTimeValidationProps(themeProps);
const ampm = themeProps.ampm ?? adapter.is12HourCycleInCurrentLocale();
const {
openTo,
views: defaultViews
} = applyDefaultViewProps({
views: themeProps.views,
openTo: themeProps.openTo,
defaultViews: ['day', 'hours', 'minutes'],
defaultOpenTo: 'day'
});
const {
shouldRenderTimeInASingleColumn,
thresholdToRenderTimeInASingleColumn,
views,
timeSteps
} = resolveTimeViewsResponse({
thresholdToRenderTimeInASingleColumn: themeProps.thresholdToRenderTimeInASingleColumn,
ampm,
timeSteps: themeProps.timeSteps,
views: defaultViews
});
return _extends({}, themeProps, validationProps, {
timeSteps,
openTo,
shouldRenderTimeInASingleColumn,
thresholdToRenderTimeInASingleColumn,
views,
ampm,
slots: _extends({
tabs: DateTimeRangePickerTabs,
toolbar: DateTimeRangePickerToolbar
}, themeProps.slots),
slotProps: _extends({}, themeProps.slotProps, {
toolbar: _extends({}, themeProps.slotProps?.toolbar, {
ampm
})
})
});
}