@mui/x-date-pickers-pro 6.0.3 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +119 -0
- package/DateRangeCalendar/useDragRange.d.ts +1 -1
- package/DateRangePicker/DateRangePicker.js +12 -0
- package/DateRangePicker/DateRangePickerToolbar.d.ts +1 -1
- package/DateRangePicker/shared.d.ts +1 -1
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +12 -0
- package/MobileDateRangePicker/MobileDateRangePicker.js +12 -0
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -0
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +1 -1
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -0
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +1 -1
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -0
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +1 -1
- package/README.md +2 -2
- package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +1 -0
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -11
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +1 -0
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +27 -15
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +1 -0
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +27 -15
- package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +1 -1
- package/index.js +1 -1
- package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -1
- package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +32 -40
- package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +9 -29
- package/internal/hooks/useEnrichedRangePickerFieldProps.d.ts +53 -0
- package/internal/hooks/useEnrichedRangePickerFieldProps.js +202 -0
- package/internal/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -1
- package/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +36 -39
- package/internal/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +9 -28
- package/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -1
- package/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +1 -1
- package/internal/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +3 -3
- package/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +1 -1
- package/internal/hooks/useRangePosition.d.ts +4 -0
- package/internal/hooks/useRangePosition.js +16 -1
- package/internal/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -1
- package/internal/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +3 -2
- package/internal/hooks/validation/useDateRangeValidation.d.ts +2 -1
- package/internal/hooks/validation/useDateTimeRangeValidation.d.ts +2 -1
- package/internal/hooks/validation/useTimeRangeValidation.d.ts +2 -1
- package/internal/models/fields.d.ts +7 -2
- package/internal/models/index.d.ts +1 -0
- package/internal/models/index.js +2 -1
- package/internal/models/rangePickerProps.d.ts +17 -0
- package/internal/models/rangePickerProps.js +1 -0
- package/internal/utils/date-range-manager.d.ts +1 -1
- package/internal/utils/date-utils.d.ts +1 -1
- package/internal/utils/releaseInfo.js +1 -1
- package/internal/utils/valueManagers.d.ts +1 -1
- package/internal/utils/valueManagers.js +23 -21
- package/legacy/DateRangePicker/DateRangePicker.js +12 -0
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +12 -0
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +12 -0
- package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -0
- package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -0
- package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -0
- package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +20 -10
- package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +24 -14
- package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +24 -14
- package/legacy/index.js +1 -1
- package/legacy/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +32 -40
- package/legacy/internal/hooks/useEnrichedRangePickerFieldProps.js +200 -0
- package/legacy/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +36 -39
- package/legacy/internal/hooks/useRangePosition.js +16 -1
- package/legacy/internal/models/index.js +2 -1
- package/legacy/internal/models/rangePickerProps.js +1 -0
- package/legacy/internal/utils/releaseInfo.js +1 -1
- package/legacy/internal/utils/valueManagers.js +24 -22
- package/modern/DateRangePicker/DateRangePicker.js +12 -0
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +12 -0
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +12 -0
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -0
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -0
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -0
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -11
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +27 -15
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +27 -15
- package/modern/index.js +1 -1
- package/modern/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +30 -38
- package/modern/internal/hooks/useEnrichedRangePickerFieldProps.js +195 -0
- package/modern/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +35 -38
- package/modern/internal/hooks/useRangePosition.js +16 -1
- package/modern/internal/models/index.js +2 -1
- package/modern/internal/models/rangePickerProps.js +1 -0
- package/modern/internal/utils/releaseInfo.js +1 -1
- package/modern/internal/utils/valueManagers.js +23 -21
- package/node/DateRangePicker/DateRangePicker.js +12 -0
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +12 -0
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +12 -0
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -0
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -0
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -0
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -11
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +26 -14
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +26 -14
- package/node/index.js +1 -1
- package/node/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +29 -37
- package/node/internal/hooks/useEnrichedRangePickerFieldProps.js +205 -0
- package/node/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +34 -37
- package/node/internal/hooks/useRangePosition.js +18 -1
- package/node/internal/models/index.js +11 -0
- package/node/internal/models/rangePickerProps.js +5 -0
- package/node/internal/utils/releaseInfo.js +1 -1
- package/node/internal/utils/valueManagers.js +22 -20
- package/package.json +5 -5
- package/internal/hooks/useRangePickerInputProps.d.ts +0 -19
- package/internal/hooks/useRangePickerInputProps.js +0 -89
- package/legacy/internal/hooks/useRangePickerInputProps.js +0 -88
- package/modern/internal/hooks/useRangePickerInputProps.js +0 -86
- package/node/internal/hooks/useRangePickerInputProps.js +0 -96
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { UseMultiInputDateTimeRangeFieldDefaultizedProps, UseMultiInputDateTimeRangeFieldParams, UseMultiInputDateTimeRangeFieldProps } from '../../../MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types';
|
|
2
2
|
import type { UseMultiInputRangeFieldResponse } from './useMultiInputRangeField.types';
|
|
3
3
|
export declare const useDefaultizedDateTimeRangeFieldProps: <TDate, AdditionalProps extends {}>(props: UseMultiInputDateTimeRangeFieldProps<TDate>) => UseMultiInputDateTimeRangeFieldDefaultizedProps<TDate, AdditionalProps>;
|
|
4
|
-
export declare const useMultiInputDateTimeRangeField: <TDate,
|
|
4
|
+
export declare const useMultiInputDateTimeRangeField: <TDate, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, startInputRef, unstableStartFieldRef, endTextFieldProps, endInputRef, unstableEndFieldRef, }: UseMultiInputDateTimeRangeFieldParams<TDate, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TTextFieldSlotProps>;
|
|
@@ -2,12 +2,12 @@ import * as React from 'react';
|
|
|
2
2
|
import { FieldRef } from '@mui/x-date-pickers/models';
|
|
3
3
|
import { UseFieldResponse } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import { RangeFieldSection } from '../../models/fields';
|
|
5
|
-
export interface UseMultiInputRangeFieldParams<TSharedProps extends {},
|
|
5
|
+
export interface UseMultiInputRangeFieldParams<TSharedProps extends {}, TTextFieldSlotProps extends {}> {
|
|
6
6
|
sharedProps: TSharedProps;
|
|
7
|
-
startTextFieldProps:
|
|
7
|
+
startTextFieldProps: TTextFieldSlotProps;
|
|
8
8
|
startInputRef?: React.Ref<HTMLInputElement>;
|
|
9
9
|
unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
|
|
10
|
-
endTextFieldProps:
|
|
10
|
+
endTextFieldProps: TTextFieldSlotProps;
|
|
11
11
|
endInputRef?: React.Ref<HTMLInputElement>;
|
|
12
12
|
unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { UseMultiInputTimeRangeFieldDefaultizedProps, UseMultiInputTimeRangeFieldParams, UseMultiInputTimeRangeFieldProps } from '../../../MultiInputTimeRangeField/MultiInputTimeRangeField.types';
|
|
2
2
|
import type { UseMultiInputRangeFieldResponse } from './useMultiInputRangeField.types';
|
|
3
3
|
export declare const useDefaultizedTimeRangeFieldProps: <TDate, AdditionalProps extends {}>(props: UseMultiInputTimeRangeFieldProps<TDate>) => UseMultiInputTimeRangeFieldDefaultizedProps<TDate, AdditionalProps>;
|
|
4
|
-
export declare const useMultiInputTimeRangeField: <TDate,
|
|
4
|
+
export declare const useMultiInputTimeRangeField: <TDate, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, startInputRef, unstableStartFieldRef, endTextFieldProps, endInputRef, unstableEndFieldRef, }: UseMultiInputTimeRangeFieldParams<TDate, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TTextFieldSlotProps>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FieldRef } from '@mui/x-date-pickers/models';
|
|
1
3
|
import { RangePosition } from '../models/range';
|
|
4
|
+
import { RangeFieldSection } from '../models/fields';
|
|
2
5
|
export interface UseRangePositionProps {
|
|
3
6
|
/**
|
|
4
7
|
* The position in the currently edited date range.
|
|
@@ -20,5 +23,6 @@ export interface UseRangePositionProps {
|
|
|
20
23
|
export interface UseRangePositionResponse {
|
|
21
24
|
rangePosition: RangePosition;
|
|
22
25
|
onRangePositionChange: (newPosition: RangePosition) => void;
|
|
26
|
+
singleInputFieldRef: React.MutableRefObject<FieldRef<RangeFieldSection> | undefined>;
|
|
23
27
|
}
|
|
24
28
|
export declare const useRangePosition: (props: UseRangePositionProps) => UseRangePositionResponse;
|
|
@@ -1,20 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import useControlled from '@mui/utils/useControlled';
|
|
2
3
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
4
|
export const useRangePosition = props => {
|
|
4
5
|
var _props$defaultRangePo;
|
|
6
|
+
const singleInputFieldRef = React.useRef();
|
|
5
7
|
const [rangePosition, setRangePosition] = useControlled({
|
|
6
8
|
name: 'useRangePosition',
|
|
7
9
|
state: 'rangePosition',
|
|
8
10
|
controlled: props.rangePosition,
|
|
9
11
|
default: (_props$defaultRangePo = props.defaultRangePosition) != null ? _props$defaultRangePo : 'start'
|
|
10
12
|
});
|
|
13
|
+
|
|
14
|
+
// When using a single input field,
|
|
15
|
+
// we want to select the 1st section of the edited date when updating the range position.
|
|
16
|
+
const syncRangePositionWithSingleInputField = newRangePosition => {
|
|
17
|
+
if (singleInputFieldRef.current == null) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const sections = singleInputFieldRef.current.getSections();
|
|
21
|
+
const targetActiveSectionIndex = newRangePosition === 'start' ? 0 : sections.length / 2;
|
|
22
|
+
singleInputFieldRef.current.setSelectedSections(targetActiveSectionIndex);
|
|
23
|
+
};
|
|
11
24
|
const handleRangePositionChange = useEventCallback(newRangePosition => {
|
|
12
25
|
var _props$onRangePositio;
|
|
13
26
|
setRangePosition(newRangePosition);
|
|
14
27
|
(_props$onRangePositio = props.onRangePositionChange) == null ? void 0 : _props$onRangePositio.call(props, newRangePosition);
|
|
28
|
+
syncRangePositionWithSingleInputField(newRangePosition);
|
|
15
29
|
});
|
|
16
30
|
return {
|
|
17
31
|
rangePosition,
|
|
18
|
-
onRangePositionChange: handleRangePositionChange
|
|
32
|
+
onRangePositionChange: handleRangePositionChange,
|
|
33
|
+
singleInputFieldRef
|
|
19
34
|
};
|
|
20
35
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DateOrTimeView } from '@mui/x-date-pickers/
|
|
2
|
+
import { DateOrTimeView } from '@mui/x-date-pickers/models';
|
|
3
3
|
import { UseStaticRangePickerParams, UseStaticRangePickerProps } from './useStaticRangePicker.types';
|
|
4
4
|
/**
|
|
5
5
|
* Hook managing all the range static pickers:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { BasePickerProps, UsePickerParams, ExportedBaseToolbarProps, StaticOnlyPickerProps, UncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
|
|
3
|
+
import { ExportedPickersLayoutSlotsComponent, ExportedPickersLayoutSlotsComponentsProps } from '@mui/x-date-pickers/PickersLayout';
|
|
4
|
+
import { DateOrTimeView } from '@mui/x-date-pickers/models';
|
|
4
5
|
import { DateRange } from '../../models/range';
|
|
5
6
|
import { UseRangePositionProps } from '../useRangePosition';
|
|
6
7
|
import { RangeFieldSection } from '../../models/fields';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Validator,
|
|
1
|
+
import { Validator, BaseDateValidationProps } from '@mui/x-date-pickers/internals';
|
|
2
|
+
import { DateValidationError } from '@mui/x-date-pickers/models';
|
|
2
3
|
import { DateRange, DayRangeValidationProps } from '../../models';
|
|
3
4
|
export interface DateRangeComponentValidationProps<TDate> extends DayRangeValidationProps<TDate>, Required<BaseDateValidationProps<TDate>> {
|
|
4
5
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Validator,
|
|
1
|
+
import { Validator, BaseDateValidationProps, TimeValidationProps, ValidationProps } from '@mui/x-date-pickers/internals';
|
|
2
|
+
import { DateTimeValidationError } from '@mui/x-date-pickers/models';
|
|
2
3
|
import { DayRangeValidationProps } from '../../models/dateRange';
|
|
3
4
|
import { DateRange } from '../../models/range';
|
|
4
5
|
export interface DateTimeRangeComponentValidationProps<TDate> extends DayRangeValidationProps<TDate>, TimeValidationProps<TDate>, Required<BaseDateValidationProps<TDate>> {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Validator,
|
|
1
|
+
import { Validator, BaseTimeValidationProps, ValidationProps } from '@mui/x-date-pickers/internals';
|
|
2
|
+
import { TimeValidationError } from '@mui/x-date-pickers/models';
|
|
2
3
|
import { DateRange } from '../../models/range';
|
|
3
4
|
export interface TimeRangeComponentValidationProps extends Required<BaseTimeValidationProps> {
|
|
4
5
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
|
-
import { BaseFieldProps
|
|
3
|
+
import { BaseFieldProps } from '@mui/x-date-pickers/internals';
|
|
4
|
+
import { FieldSection } from '@mui/x-date-pickers/models';
|
|
4
5
|
export interface RangeFieldSection extends FieldSection {
|
|
5
6
|
dateName: 'start' | 'end';
|
|
6
7
|
}
|
|
@@ -28,7 +29,11 @@ export interface MultiInputFieldSlotRootProps {
|
|
|
28
29
|
* Only contains what the MUI component are passing to the field, not what users can pass using the `props.slotProps.field`.
|
|
29
30
|
*/
|
|
30
31
|
export interface BaseMultiInputFieldProps<TValue, TSection extends FieldSection, TError> extends BaseFieldProps<TValue, TSection, TError> {
|
|
31
|
-
slots?: {
|
|
32
|
+
slots?: {
|
|
33
|
+
root?: React.ElementType;
|
|
34
|
+
separator?: React.ElementType;
|
|
35
|
+
textField?: React.ElementType;
|
|
36
|
+
};
|
|
32
37
|
slotProps?: {
|
|
33
38
|
root?: SlotComponentProps<React.ElementType<MultiInputFieldSlotRootProps>, {}, Record<string, any>>;
|
|
34
39
|
textField?: SlotComponentProps<React.ElementType<MultiInputFieldSlotTextFieldProps>, {}, {
|
package/internal/models/index.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props common to all range non-static pickers.
|
|
4
|
+
* These props are handled by the headless wrappers.
|
|
5
|
+
*/
|
|
6
|
+
export interface BaseRangeNonStaticPickerProps {
|
|
7
|
+
/**
|
|
8
|
+
* The label content.
|
|
9
|
+
* Ignored if the field has several inputs.
|
|
10
|
+
*/
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Pass a ref to the `input` element.
|
|
14
|
+
* Ignored if the field has several inputs.
|
|
15
|
+
*/
|
|
16
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MuiPickersAdapter } from '@mui/x-date-pickers/
|
|
1
|
+
import { MuiPickersAdapter } from '@mui/x-date-pickers/models';
|
|
2
2
|
import { DateRange, RangePosition } from '../models/range';
|
|
3
3
|
interface CalculateRangeChangeOptions<TDate> {
|
|
4
4
|
utils: MuiPickersAdapter<TDate>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MuiPickersAdapter } from '@mui/x-date-pickers/
|
|
1
|
+
import { MuiPickersAdapter } from '@mui/x-date-pickers/models';
|
|
2
2
|
import { DateRange, NonEmptyDateRange } from '../models/range';
|
|
3
3
|
export declare const isRangeValid: <TDate>(utils: MuiPickersAdapter<TDate>, range: DateRange<TDate> | null) => range is NonEmptyDateRange<TDate>;
|
|
4
4
|
export declare const isWithinRange: <TDate>(utils: MuiPickersAdapter<TDate>, day: TDate, range: DateRange<TDate> | null) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY4MTA3NDAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -6,4 +6,4 @@ import type { DateTimeRangeValidationError } from '../hooks/validation/useDateTi
|
|
|
6
6
|
import { RangeFieldSection } from '../models/fields';
|
|
7
7
|
export type RangePickerValueManager<TValue = [any, any], TDate = any, TError extends DateRangeValidationError | TimeRangeValidationError | DateTimeRangeValidationError = any> = PickerValueManager<TValue, TDate, TError>;
|
|
8
8
|
export declare const rangeValueManager: RangePickerValueManager;
|
|
9
|
-
export declare const rangeFieldValueManager: FieldValueManager<DateRange<any>, any, RangeFieldSection
|
|
9
|
+
export declare const rangeFieldValueManager: FieldValueManager<DateRange<any>, any, RangeFieldSection>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { replaceInvalidDateByNull,
|
|
2
|
+
import { replaceInvalidDateByNull, addPositionPropertiesToSections, createDateStrForInputFromSections, areDatesEqual } from '@mui/x-date-pickers/internals';
|
|
3
3
|
import { splitDateRangeSections, removeLastSeparator } from './date-fields-utils';
|
|
4
4
|
export const rangeValueManager = {
|
|
5
5
|
emptyValue: [null, null],
|
|
@@ -7,6 +7,7 @@ export const rangeValueManager = {
|
|
|
7
7
|
cleanValue: (utils, value) => value.map(date => replaceInvalidDateByNull(utils, date)),
|
|
8
8
|
areValuesEqual: (utils, a, b) => areDatesEqual(utils, a[0], b[0]) && areDatesEqual(utils, a[1], b[1]),
|
|
9
9
|
isSameError: (a, b) => b !== null && a[1] === b[1] && a[0] === b[0],
|
|
10
|
+
hasError: error => error[0] != null || error[1] != null,
|
|
10
11
|
defaultErrorState: [null, null]
|
|
11
12
|
};
|
|
12
13
|
export const rangeFieldValueManager = {
|
|
@@ -24,17 +25,17 @@ export const rangeFieldValueManager = {
|
|
|
24
25
|
}
|
|
25
26
|
return [prevReferenceValue[1], value[1]];
|
|
26
27
|
},
|
|
27
|
-
getSectionsFromValue: (utils,
|
|
28
|
-
const
|
|
28
|
+
getSectionsFromValue: (utils, [start, end], fallbackSections, isRTL, getSectionsFromDate) => {
|
|
29
|
+
const separatedFallbackSections = fallbackSections == null ? {
|
|
29
30
|
startDate: null,
|
|
30
31
|
endDate: null
|
|
31
|
-
} : splitDateRangeSections(
|
|
32
|
-
const getSections = (newDate,
|
|
33
|
-
const shouldReUsePrevDateSections = !utils.isValid(newDate) && !!
|
|
32
|
+
} : splitDateRangeSections(fallbackSections);
|
|
33
|
+
const getSections = (newDate, fallbackDateSections, position) => {
|
|
34
|
+
const shouldReUsePrevDateSections = !utils.isValid(newDate) && !!fallbackDateSections;
|
|
34
35
|
if (shouldReUsePrevDateSections) {
|
|
35
|
-
return
|
|
36
|
+
return fallbackDateSections;
|
|
36
37
|
}
|
|
37
|
-
const sections =
|
|
38
|
+
const sections = getSectionsFromDate(newDate);
|
|
38
39
|
return sections.map((section, sectionIndex) => {
|
|
39
40
|
if (sectionIndex === sections.length - 1 && position === 'start') {
|
|
40
41
|
return _extends({}, section, {
|
|
@@ -47,16 +48,11 @@ export const rangeFieldValueManager = {
|
|
|
47
48
|
});
|
|
48
49
|
});
|
|
49
50
|
};
|
|
50
|
-
return addPositionPropertiesToSections([...getSections(start,
|
|
51
|
+
return addPositionPropertiesToSections([...getSections(start, separatedFallbackSections.startDate, 'start'), ...getSections(end, separatedFallbackSections.endDate, 'end')], isRTL);
|
|
51
52
|
},
|
|
52
|
-
getValueStrFromSections: sections => {
|
|
53
|
+
getValueStrFromSections: (sections, isRTL) => {
|
|
53
54
|
const dateRangeSections = splitDateRangeSections(sections);
|
|
54
|
-
return createDateStrForInputFromSections([...dateRangeSections.startDate, ...dateRangeSections.endDate]);
|
|
55
|
-
},
|
|
56
|
-
getActiveDateSections: (sections, activeSection) => {
|
|
57
|
-
const index = activeSection.dateName === 'start' ? 0 : 1;
|
|
58
|
-
const dateRangeSections = splitDateRangeSections(sections);
|
|
59
|
-
return index === 0 ? removeLastSeparator(dateRangeSections.startDate) : dateRangeSections.endDate;
|
|
55
|
+
return createDateStrForInputFromSections([...dateRangeSections.startDate, ...dateRangeSections.endDate], isRTL);
|
|
60
56
|
},
|
|
61
57
|
parseValueStr: (valueStr, referenceValue, parseDate) => {
|
|
62
58
|
// TODO: Improve because it would not work if the date format has `–` as a separator.
|
|
@@ -72,13 +68,19 @@ export const rangeFieldValueManager = {
|
|
|
72
68
|
const index = activeSection.dateName === 'start' ? 0 : 1;
|
|
73
69
|
const updateDateInRange = (newDate, prevDateRange) => index === 0 ? [newDate, prevDateRange[1]] : [prevDateRange[0], newDate];
|
|
74
70
|
return {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
date: state.value[index],
|
|
72
|
+
referenceDate: state.referenceValue[index],
|
|
73
|
+
getSections: sections => {
|
|
74
|
+
const dateRangeSections = splitDateRangeSections(sections);
|
|
75
|
+
if (index === 0) {
|
|
76
|
+
return removeLastSeparator(dateRangeSections.startDate);
|
|
77
|
+
}
|
|
78
|
+
return dateRangeSections.endDate;
|
|
79
|
+
},
|
|
80
|
+
getNewValuesFromNewActiveDate: newActiveDate => ({
|
|
78
81
|
value: updateDateInRange(newActiveDate, state.value),
|
|
79
82
|
referenceValue: newActiveDate == null || !utils.isValid(newActiveDate) ? state.referenceValue : updateDateInRange(newActiveDate, state.referenceValue)
|
|
80
83
|
})
|
|
81
84
|
};
|
|
82
|
-
}
|
|
83
|
-
hasError: error => error[0] != null || error[1] != null
|
|
85
|
+
}
|
|
84
86
|
};
|
|
@@ -146,6 +146,18 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
146
146
|
* Defaults to localized format based on the used `views`.
|
|
147
147
|
*/
|
|
148
148
|
format: PropTypes.string,
|
|
149
|
+
/**
|
|
150
|
+
* Pass a ref to the `input` element.
|
|
151
|
+
* Ignored if the field has several inputs.
|
|
152
|
+
*/
|
|
153
|
+
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
154
|
+
current: PropTypes.object
|
|
155
|
+
})]),
|
|
156
|
+
/**
|
|
157
|
+
* The label content.
|
|
158
|
+
* Ignored if the field has several inputs.
|
|
159
|
+
*/
|
|
160
|
+
label: PropTypes.node,
|
|
149
161
|
/**
|
|
150
162
|
* If `true`, calls `renderLoading` instead of rendering the day calendar.
|
|
151
163
|
* Can be used to preload information and show it in calendar.
|
|
@@ -154,6 +154,18 @@ DesktopDateRangePicker.propTypes = {
|
|
|
154
154
|
* Defaults to localized format based on the used `views`.
|
|
155
155
|
*/
|
|
156
156
|
format: PropTypes.string,
|
|
157
|
+
/**
|
|
158
|
+
* Pass a ref to the `input` element.
|
|
159
|
+
* Ignored if the field has several inputs.
|
|
160
|
+
*/
|
|
161
|
+
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
162
|
+
current: PropTypes.object
|
|
163
|
+
})]),
|
|
164
|
+
/**
|
|
165
|
+
* The label content.
|
|
166
|
+
* Ignored if the field has several inputs.
|
|
167
|
+
*/
|
|
168
|
+
label: PropTypes.node,
|
|
157
169
|
/**
|
|
158
170
|
* If `true`, calls `renderLoading` instead of rendering the day calendar.
|
|
159
171
|
* Can be used to preload information and show it in calendar.
|
|
@@ -159,6 +159,18 @@ MobileDateRangePicker.propTypes = {
|
|
|
159
159
|
* Defaults to localized format based on the used `views`.
|
|
160
160
|
*/
|
|
161
161
|
format: PropTypes.string,
|
|
162
|
+
/**
|
|
163
|
+
* Pass a ref to the `input` element.
|
|
164
|
+
* Ignored if the field has several inputs.
|
|
165
|
+
*/
|
|
166
|
+
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
167
|
+
current: PropTypes.object
|
|
168
|
+
})]),
|
|
169
|
+
/**
|
|
170
|
+
* The label content.
|
|
171
|
+
* Ignored if the field has several inputs.
|
|
172
|
+
*/
|
|
173
|
+
label: PropTypes.node,
|
|
162
174
|
/**
|
|
163
175
|
* If `true`, calls `renderLoading` instead of rendering the day calendar.
|
|
164
176
|
* Can be used to preload information and show it in calendar.
|
|
@@ -289,6 +289,16 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
289
289
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
290
290
|
unstableEndFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
291
291
|
unstableStartFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
292
|
+
/**
|
|
293
|
+
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
294
|
+
*
|
|
295
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
|
|
296
|
+
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
297
|
+
*
|
|
298
|
+
* To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
|
|
299
|
+
* @default false
|
|
300
|
+
*/
|
|
301
|
+
useFlexGap: PropTypes.bool,
|
|
292
302
|
/**
|
|
293
303
|
* The selected value.
|
|
294
304
|
* Used when the component is controlled.
|
|
@@ -355,6 +355,16 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
355
355
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
356
356
|
unstableEndFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
357
357
|
unstableStartFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
358
|
+
/**
|
|
359
|
+
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
360
|
+
*
|
|
361
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
|
|
362
|
+
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
363
|
+
*
|
|
364
|
+
* To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
|
|
365
|
+
* @default false
|
|
366
|
+
*/
|
|
367
|
+
useFlexGap: PropTypes.bool,
|
|
358
368
|
/**
|
|
359
369
|
* The selected value.
|
|
360
370
|
* Used when the component is controlled.
|
|
@@ -321,6 +321,16 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
321
321
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
322
322
|
unstableEndFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
323
323
|
unstableStartFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
324
|
+
/**
|
|
325
|
+
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
326
|
+
*
|
|
327
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
|
|
328
|
+
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
329
|
+
*
|
|
330
|
+
* To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
|
|
331
|
+
* @default false
|
|
332
|
+
*/
|
|
333
|
+
useFlexGap: PropTypes.bool,
|
|
324
334
|
/**
|
|
325
335
|
* The selected value.
|
|
326
336
|
* Used when the component is controlled.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["slots", "slotProps", "components", "componentsProps"],
|
|
4
|
-
_excluded2 = ["
|
|
3
|
+
var _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
|
|
4
|
+
_excluded2 = ["inputRef"],
|
|
5
|
+
_excluded3 = ["ref", "onPaste", "inputMode", "readOnly"];
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
8
|
import MuiTextField from '@mui/material/TextField';
|
|
@@ -19,24 +20,32 @@ var SingleInputDateRangeField = /*#__PURE__*/React.forwardRef(function SingleInp
|
|
|
19
20
|
slotProps = themeProps.slotProps,
|
|
20
21
|
components = themeProps.components,
|
|
21
22
|
componentsProps = themeProps.componentsProps,
|
|
23
|
+
InputProps = themeProps.InputProps,
|
|
24
|
+
inputProps = themeProps.inputProps,
|
|
22
25
|
other = _objectWithoutProperties(themeProps, _excluded);
|
|
23
26
|
var ownerState = themeProps;
|
|
24
27
|
var TextField = (_ref = (_slots$textField = slots == null ? void 0 : slots.textField) != null ? _slots$textField : components == null ? void 0 : components.TextField) != null ? _ref : MuiTextField;
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
var _useSlotProps = useSlotProps({
|
|
29
|
+
elementType: TextField,
|
|
30
|
+
externalSlotProps: (_slotProps$textField = slotProps == null ? void 0 : slotProps.textField) != null ? _slotProps$textField : componentsProps == null ? void 0 : componentsProps.textField,
|
|
31
|
+
externalForwardedProps: other,
|
|
32
|
+
ownerState: ownerState
|
|
33
|
+
}),
|
|
34
|
+
externalInputRef = _useSlotProps.inputRef,
|
|
35
|
+
textFieldProps = _objectWithoutProperties(_useSlotProps, _excluded2);
|
|
36
|
+
|
|
37
|
+
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
38
|
+
textFieldProps.inputProps = _extends({}, textFieldProps.inputProps, inputProps);
|
|
39
|
+
textFieldProps.InputProps = _extends({}, textFieldProps.InputProps, InputProps);
|
|
31
40
|
var _useSingleInputDateRa = useSingleInputDateRangeField({
|
|
32
41
|
props: textFieldProps,
|
|
33
|
-
inputRef:
|
|
42
|
+
inputRef: externalInputRef
|
|
34
43
|
}),
|
|
35
44
|
inputRef = _useSingleInputDateRa.ref,
|
|
36
45
|
onPaste = _useSingleInputDateRa.onPaste,
|
|
37
46
|
inputMode = _useSingleInputDateRa.inputMode,
|
|
38
47
|
readOnly = _useSingleInputDateRa.readOnly,
|
|
39
|
-
fieldProps = _objectWithoutProperties(_useSingleInputDateRa,
|
|
48
|
+
fieldProps = _objectWithoutProperties(_useSingleInputDateRa, _excluded3);
|
|
40
49
|
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
41
50
|
ref: ref
|
|
42
51
|
}, fieldProps, {
|
|
@@ -48,6 +57,7 @@ var SingleInputDateRangeField = /*#__PURE__*/React.forwardRef(function SingleInp
|
|
|
48
57
|
})
|
|
49
58
|
}));
|
|
50
59
|
});
|
|
60
|
+
SingleInputDateRangeField.fieldType = 'single-input';
|
|
51
61
|
process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
52
62
|
// ----------------------------- Warning --------------------------------
|
|
53
63
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["slots", "slotProps", "components", "componentsProps"],
|
|
4
|
-
_excluded2 = ["
|
|
3
|
+
var _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
|
|
4
|
+
_excluded2 = ["inputRef"],
|
|
5
|
+
_excluded3 = ["ref", "onPaste", "inputMode", "readOnly"];
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
|
-
import
|
|
8
|
+
import MuiTextField from '@mui/material/TextField';
|
|
8
9
|
import { useThemeProps } from '@mui/material/styles';
|
|
9
10
|
import { useSlotProps } from '@mui/base/utils';
|
|
10
11
|
import { useSingleInputDateTimeRangeField } from './useSingleInputDateTimeRangeField';
|
|
@@ -19,25 +20,33 @@ var SingleInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Singl
|
|
|
19
20
|
slotProps = themeProps.slotProps,
|
|
20
21
|
components = themeProps.components,
|
|
21
22
|
componentsProps = themeProps.componentsProps,
|
|
23
|
+
InputProps = themeProps.InputProps,
|
|
24
|
+
inputProps = themeProps.inputProps,
|
|
22
25
|
other = _objectWithoutProperties(themeProps, _excluded);
|
|
23
26
|
var ownerState = themeProps;
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
var TextField = (_ref = (_slots$textField = slots == null ? void 0 : slots.textField) != null ? _slots$textField : components == null ? void 0 : components.TextField) != null ? _ref : MuiTextField;
|
|
28
|
+
var _useSlotProps = useSlotProps({
|
|
29
|
+
elementType: TextField,
|
|
30
|
+
externalSlotProps: (_slotProps$textField = slotProps == null ? void 0 : slotProps.textField) != null ? _slotProps$textField : componentsProps == null ? void 0 : componentsProps.textField,
|
|
31
|
+
externalForwardedProps: other,
|
|
32
|
+
ownerState: ownerState
|
|
33
|
+
}),
|
|
34
|
+
externalInputRef = _useSlotProps.inputRef,
|
|
35
|
+
textFieldProps = _objectWithoutProperties(_useSlotProps, _excluded2);
|
|
36
|
+
|
|
37
|
+
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
38
|
+
textFieldProps.inputProps = _extends({}, textFieldProps.inputProps, inputProps);
|
|
39
|
+
textFieldProps.InputProps = _extends({}, textFieldProps.InputProps, InputProps);
|
|
31
40
|
var _useSingleInputDateTi = useSingleInputDateTimeRangeField({
|
|
32
|
-
props:
|
|
33
|
-
inputRef:
|
|
41
|
+
props: textFieldProps,
|
|
42
|
+
inputRef: externalInputRef
|
|
34
43
|
}),
|
|
35
44
|
inputRef = _useSingleInputDateTi.ref,
|
|
36
45
|
onPaste = _useSingleInputDateTi.onPaste,
|
|
37
46
|
inputMode = _useSingleInputDateTi.inputMode,
|
|
38
47
|
readOnly = _useSingleInputDateTi.readOnly,
|
|
39
|
-
fieldProps = _objectWithoutProperties(_useSingleInputDateTi,
|
|
40
|
-
return /*#__PURE__*/_jsx(
|
|
48
|
+
fieldProps = _objectWithoutProperties(_useSingleInputDateTi, _excluded3);
|
|
49
|
+
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
41
50
|
ref: ref
|
|
42
51
|
}, fieldProps, {
|
|
43
52
|
inputProps: _extends({}, fieldProps.inputProps, {
|
|
@@ -48,6 +57,7 @@ var SingleInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Singl
|
|
|
48
57
|
})
|
|
49
58
|
}));
|
|
50
59
|
});
|
|
60
|
+
SingleInputDateTimeRangeField.fieldType = 'single-input';
|
|
51
61
|
process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes = {
|
|
52
62
|
// ----------------------------- Warning --------------------------------
|
|
53
63
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["slots", "slotProps", "components", "componentsProps"],
|
|
4
|
-
_excluded2 = ["
|
|
3
|
+
var _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
|
|
4
|
+
_excluded2 = ["inputRef"],
|
|
5
|
+
_excluded3 = ["ref", "onPaste", "inputMode", "readOnly"];
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
|
-
import
|
|
8
|
+
import MuiTextField from '@mui/material/TextField';
|
|
8
9
|
import { useThemeProps } from '@mui/material/styles';
|
|
9
10
|
import { useSlotProps } from '@mui/base/utils';
|
|
10
11
|
import { useSingleInputTimeRangeField } from './useSingleInputTimeRangeField';
|
|
@@ -19,25 +20,33 @@ var SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleInp
|
|
|
19
20
|
slotProps = themeProps.slotProps,
|
|
20
21
|
components = themeProps.components,
|
|
21
22
|
componentsProps = themeProps.componentsProps,
|
|
23
|
+
InputProps = themeProps.InputProps,
|
|
24
|
+
inputProps = themeProps.inputProps,
|
|
22
25
|
other = _objectWithoutProperties(themeProps, _excluded);
|
|
23
26
|
var ownerState = themeProps;
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
var TextField = (_ref = (_slots$textField = slots == null ? void 0 : slots.textField) != null ? _slots$textField : components == null ? void 0 : components.TextField) != null ? _ref : MuiTextField;
|
|
28
|
+
var _useSlotProps = useSlotProps({
|
|
29
|
+
elementType: TextField,
|
|
30
|
+
externalSlotProps: (_slotProps$textField = slotProps == null ? void 0 : slotProps.textField) != null ? _slotProps$textField : componentsProps == null ? void 0 : componentsProps.textField,
|
|
31
|
+
externalForwardedProps: other,
|
|
32
|
+
ownerState: ownerState
|
|
33
|
+
}),
|
|
34
|
+
externalInputRef = _useSlotProps.inputRef,
|
|
35
|
+
textFieldProps = _objectWithoutProperties(_useSlotProps, _excluded2);
|
|
36
|
+
|
|
37
|
+
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
38
|
+
textFieldProps.inputProps = _extends({}, textFieldProps.inputProps, inputProps);
|
|
39
|
+
textFieldProps.InputProps = _extends({}, textFieldProps.InputProps, InputProps);
|
|
31
40
|
var _useSingleInputTimeRa = useSingleInputTimeRangeField({
|
|
32
|
-
props:
|
|
33
|
-
inputRef:
|
|
41
|
+
props: textFieldProps,
|
|
42
|
+
inputRef: externalInputRef
|
|
34
43
|
}),
|
|
35
44
|
inputRef = _useSingleInputTimeRa.ref,
|
|
36
45
|
onPaste = _useSingleInputTimeRa.onPaste,
|
|
37
46
|
inputMode = _useSingleInputTimeRa.inputMode,
|
|
38
47
|
readOnly = _useSingleInputTimeRa.readOnly,
|
|
39
|
-
fieldProps = _objectWithoutProperties(_useSingleInputTimeRa,
|
|
40
|
-
return /*#__PURE__*/_jsx(
|
|
48
|
+
fieldProps = _objectWithoutProperties(_useSingleInputTimeRa, _excluded3);
|
|
49
|
+
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
41
50
|
ref: ref
|
|
42
51
|
}, fieldProps, {
|
|
43
52
|
inputProps: _extends({}, fieldProps.inputProps, {
|
|
@@ -48,6 +57,7 @@ var SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleInp
|
|
|
48
57
|
})
|
|
49
58
|
}));
|
|
50
59
|
});
|
|
60
|
+
SingleInputTimeRangeField.fieldType = 'single-input';
|
|
51
61
|
process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
52
62
|
// ----------------------------- Warning --------------------------------
|
|
53
63
|
// | These PropTypes are generated from the TypeScript type definitions |
|
package/legacy/index.js
CHANGED