@mui/x-date-pickers-pro 8.0.0-alpha.0 → 8.0.0-alpha.2
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 +651 -6
- package/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/DateRangePicker/DateRangePicker.types.d.ts +2 -2
- package/DateRangePicker/DateRangePickerToolbar.js +0 -12
- package/DateRangePicker/shared.d.ts +3 -2
- package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +2 -2
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +8 -7
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +2 -2
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -16
- package/DateTimeRangePicker/shared.d.ts +4 -3
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -12
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +12 -10
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -12
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +11 -9
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -12
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +11 -9
- package/README.md +9 -6
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +5 -5
- package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +11 -10
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +5 -5
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +11 -10
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -5
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +10 -9
- package/index.js +1 -1
- package/internals/hooks/models/useRangePicker.d.ts +1 -2
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +14 -4
- package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +14 -13
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +17 -18
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +15 -5
- package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +6 -7
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/internals/hooks/useRangePosition.d.ts +3 -2
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -1
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +1 -2
- package/internals/models/dateTimeRange.d.ts +2 -2
- package/internals/models/fields.d.ts +6 -6
- package/internals/models/timeRange.d.ts +2 -2
- package/internals/utils/date-fields-utils.d.ts +6 -6
- package/internals/utils/date-range-manager.d.ts +2 -1
- package/internals/utils/date-range-manager.js +11 -9
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/valueManagers.d.ts +4 -3
- package/models/dateRange.d.ts +3 -3
- package/models/fields.d.ts +6 -9
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/models/range.d.ts +0 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/modern/DateRangePicker/DateRangePickerToolbar.js +0 -12
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +8 -7
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -16
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -12
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -12
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -12
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +5 -5
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +5 -5
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -5
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +14 -4
- package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +17 -18
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +15 -5
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -1
- package/modern/internals/utils/date-range-manager.js +11 -9
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/models/index.js +2 -1
- package/modern/validation/validateDateRange.js +8 -0
- package/modern/validation/validateDateTimeRange.js +4 -0
- package/modern/validation/validateTimeRange.js +8 -0
- package/node/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/node/DateRangePicker/DateRangePickerToolbar.js +0 -12
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -6
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +5 -15
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +9 -11
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +9 -11
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +9 -11
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
- package/node/index.js +1 -1
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +14 -4
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +17 -18
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +15 -5
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -1
- package/node/internals/utils/date-range-manager.js +11 -9
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/validation/validateDateRange.js +8 -0
- package/node/validation/validateDateTimeRange.js +4 -0
- package/node/validation/validateTimeRange.js +8 -0
- package/package.json +6 -6
- package/validation/validateDateRange.d.ts +9 -1
- package/validation/validateDateRange.js +8 -0
- package/validation/validateDateTimeRange.d.ts +6 -2
- package/validation/validateDateTimeRange.js +4 -0
- package/validation/validateTimeRange.d.ts +9 -1
- package/validation/validateTimeRange.js +8 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BasePickerProps, UsePickerParams, ExportedBaseToolbarProps, StaticOnlyPickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
3
3
|
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
|
|
4
|
-
import { RangeFieldSection } from '../../../models';
|
|
5
4
|
import { UseRangePositionProps } from '../useRangePosition';
|
|
6
5
|
export interface UseStaticRangePickerSlots<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<PickerRangeValue, TView> {
|
|
7
6
|
}
|
|
@@ -22,7 +21,7 @@ export interface UseStaticRangePickerProps<TView extends DateOrTimeViewWithMerid
|
|
|
22
21
|
*/
|
|
23
22
|
slotProps?: UseStaticRangePickerSlotProps<TView>;
|
|
24
23
|
}
|
|
25
|
-
export interface UseStaticRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerRangeValue, TView,
|
|
24
|
+
export interface UseStaticRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerRangeValue, TView, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
|
|
26
25
|
props: TExternalProps;
|
|
27
26
|
/**
|
|
28
27
|
* Ref to pass to the root element
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
2
|
import { UseFieldInternalProps, DateOrTimeViewWithMeridiem, AmPmProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
3
|
-
import { DateTimeRangeValidationError,
|
|
3
|
+
import { DateTimeRangeValidationError, RangeFieldSeparatorProps } from '../../models';
|
|
4
4
|
import { ExportedValidateDateTimeRangeProps } from '../../validation/validateDateTimeRange';
|
|
5
|
-
export interface UseDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<PickerRangeValue,
|
|
5
|
+
export interface UseDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, 'unstableFieldRef'>, 'format'>, RangeFieldSeparatorProps, ExportedValidateDateTimeRangeProps, AmPmProps {
|
|
6
6
|
}
|
|
7
7
|
export type DateTimeRangePickerView = Exclude<DateOrTimeViewWithMeridiem, 'month' | 'year'>;
|
|
8
8
|
export type DateTimeRangePickerViewExternal = Exclude<DateTimeRangePickerView, 'meridiem'>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { SxProps } from '@mui/material/styles';
|
|
2
2
|
import { SlotComponentProps } from '@mui/utils';
|
|
3
3
|
import { MakeRequired } from '@mui/x-internals/types';
|
|
4
|
-
import { UseFieldInternalProps } from '@mui/x-date-pickers/internals';
|
|
5
|
-
import {
|
|
4
|
+
import { PickerRangeValue, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { FieldOwnerState } from '@mui/x-date-pickers/models';
|
|
6
6
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
7
7
|
import type { MultiInputFieldRefs, MultiInputFieldSlotRootProps, RangeFieldSeparatorProps, RangePosition } from '../../models';
|
|
8
8
|
/**
|
|
9
9
|
* Props the multi input field can receive when used inside a picker.
|
|
10
10
|
* Only contains what the MUI components are passing to the field, not what users can pass using the `props.slotProps.field`.
|
|
11
11
|
*/
|
|
12
|
-
export interface BaseMultiInputFieldProps<
|
|
12
|
+
export interface BaseMultiInputFieldProps<TEnableAccessibleFieldDOMStructure extends boolean, TError> extends MakeRequired<Pick<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, TError>, 'readOnly' | 'disabled' | 'format' | 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange' | 'timezone' | 'autoFocus' | 'value' | 'onChange'>, 'format' | 'value' | 'onChange' | 'timezone'>, RangeFieldSeparatorProps, MultiInputFieldRefs {
|
|
13
13
|
className: string | undefined;
|
|
14
14
|
sx: SxProps<any> | undefined;
|
|
15
15
|
slots?: {
|
|
@@ -18,9 +18,9 @@ export interface BaseMultiInputFieldProps<TValue, TSection extends FieldSection,
|
|
|
18
18
|
textField?: React.ElementType;
|
|
19
19
|
};
|
|
20
20
|
slotProps?: {
|
|
21
|
-
root?: SlotComponentProps<React.ElementType<MultiInputFieldSlotRootProps>, {},
|
|
22
|
-
textField?: SlotComponentProps<typeof PickersTextField, {}, {
|
|
21
|
+
root?: SlotComponentProps<React.ElementType<MultiInputFieldSlotRootProps>, {}, FieldOwnerState>;
|
|
22
|
+
textField?: SlotComponentProps<typeof PickersTextField, {}, FieldOwnerState & {
|
|
23
23
|
position?: RangePosition;
|
|
24
|
-
}
|
|
24
|
+
}>;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
2
|
import { UseFieldInternalProps, AmPmProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
3
|
-
import { TimeRangeValidationError,
|
|
3
|
+
import { TimeRangeValidationError, RangeFieldSeparatorProps } from '../../models';
|
|
4
4
|
import type { ExportedValidateTimeRangeProps } from '../../validation/validateTimeRange';
|
|
5
|
-
export interface UseTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<PickerRangeValue,
|
|
5
|
+
export interface UseTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, 'unstableFieldRef'>, 'format'>, RangeFieldSeparatorProps, ExportedValidateTimeRangeProps, AmPmProps {
|
|
6
6
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const splitDateRangeSections: (sections:
|
|
3
|
-
startDate:
|
|
4
|
-
endDate:
|
|
1
|
+
import { FieldRangeSection } from '@mui/x-date-pickers/internals';
|
|
2
|
+
export declare const splitDateRangeSections: (sections: FieldRangeSection[]) => {
|
|
3
|
+
startDate: FieldRangeSection[];
|
|
4
|
+
endDate: FieldRangeSection[];
|
|
5
5
|
};
|
|
6
|
-
export declare const removeLastSeparator: (dateSections:
|
|
6
|
+
export declare const removeLastSeparator: (dateSections: FieldRangeSection[]) => (FieldRangeSection | {
|
|
7
7
|
separator: null;
|
|
8
|
-
dateName: import("
|
|
8
|
+
dateName: import("@mui/x-date-pickers/internals").RangePosition;
|
|
9
9
|
value: string;
|
|
10
10
|
format: string;
|
|
11
11
|
maxLength: number | null;
|
|
@@ -13,11 +13,12 @@ interface CalculateRangeChangeOptions {
|
|
|
13
13
|
*/
|
|
14
14
|
allowRangeFlip?: boolean;
|
|
15
15
|
shouldMergeDateAndTime?: boolean;
|
|
16
|
+
referenceDate?: PickerValidDate;
|
|
16
17
|
}
|
|
17
18
|
interface CalculateRangeChangeResponse {
|
|
18
19
|
nextSelection: RangePosition;
|
|
19
20
|
newRange: PickerRangeValue;
|
|
20
21
|
}
|
|
21
|
-
export declare function calculateRangeChange({ utils, range, newDate: selectedDate, rangePosition, allowRangeFlip, shouldMergeDateAndTime, }: CalculateRangeChangeOptions): CalculateRangeChangeResponse;
|
|
22
|
+
export declare function calculateRangeChange({ utils, range, newDate: selectedDate, rangePosition, allowRangeFlip, shouldMergeDateAndTime, referenceDate, }: CalculateRangeChangeOptions): CalculateRangeChangeResponse;
|
|
22
23
|
export declare function calculateRangePreview(options: CalculateRangeChangeOptions): PickerRangeValue;
|
|
23
24
|
export {};
|
|
@@ -5,7 +5,8 @@ export function calculateRangeChange({
|
|
|
5
5
|
newDate: selectedDate,
|
|
6
6
|
rangePosition,
|
|
7
7
|
allowRangeFlip = false,
|
|
8
|
-
shouldMergeDateAndTime = false
|
|
8
|
+
shouldMergeDateAndTime = false,
|
|
9
|
+
referenceDate
|
|
9
10
|
}) {
|
|
10
11
|
const [start, end] = range;
|
|
11
12
|
if (shouldMergeDateAndTime && selectedDate) {
|
|
@@ -17,29 +18,30 @@ export function calculateRangeChange({
|
|
|
17
18
|
selectedDate = mergeDateAndTime(utils, selectedDate, end);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
const newSelectedDate = referenceDate && selectedDate && shouldMergeDateAndTime ? mergeDateAndTime(utils, selectedDate, referenceDate) : selectedDate;
|
|
20
22
|
if (rangePosition === 'start') {
|
|
21
23
|
const truthyResult = allowRangeFlip ? {
|
|
22
24
|
nextSelection: 'start',
|
|
23
|
-
newRange: [end,
|
|
25
|
+
newRange: [end, newSelectedDate]
|
|
24
26
|
} : {
|
|
25
27
|
nextSelection: 'end',
|
|
26
|
-
newRange: [
|
|
28
|
+
newRange: [newSelectedDate, null]
|
|
27
29
|
};
|
|
28
|
-
return Boolean(end) && utils.isAfter(
|
|
30
|
+
return Boolean(end) && utils.isAfter(newSelectedDate, end) ? truthyResult : {
|
|
29
31
|
nextSelection: 'end',
|
|
30
|
-
newRange: [
|
|
32
|
+
newRange: [newSelectedDate, end]
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
const truthyResult = allowRangeFlip ? {
|
|
34
36
|
nextSelection: 'end',
|
|
35
|
-
newRange: [
|
|
37
|
+
newRange: [newSelectedDate, start]
|
|
36
38
|
} : {
|
|
37
39
|
nextSelection: 'end',
|
|
38
|
-
newRange: [
|
|
40
|
+
newRange: [newSelectedDate, null]
|
|
39
41
|
};
|
|
40
|
-
return Boolean(start) && utils.isBeforeDay(
|
|
42
|
+
return Boolean(start) && utils.isBeforeDay(newSelectedDate, start) ? truthyResult : {
|
|
41
43
|
nextSelection: 'start',
|
|
42
|
-
newRange: [start,
|
|
44
|
+
newRange: [start, newSelectedDate]
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
export function calculateRangePreview(options) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczMjgzNDgwMDAwMA==";
|
|
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
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { PickerValueManager, FieldValueManager, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
2
|
-
import type { DateRangeValidationError, DateTimeRangeValidationError, TimeRangeValidationError
|
|
3
|
-
|
|
2
|
+
import type { DateRangeValidationError, DateTimeRangeValidationError, TimeRangeValidationError } from '../../models';
|
|
3
|
+
type RangePickerValueManager<TError extends DateRangeValidationError | TimeRangeValidationError | DateTimeRangeValidationError = any> = PickerValueManager<PickerRangeValue, TError>;
|
|
4
4
|
export declare const rangeValueManager: RangePickerValueManager;
|
|
5
5
|
export declare const getRangeFieldValueManager: ({ dateSeparator, }: {
|
|
6
6
|
dateSeparator: string | undefined;
|
|
7
|
-
}) => FieldValueManager<PickerRangeValue
|
|
7
|
+
}) => FieldValueManager<PickerRangeValue>;
|
|
8
|
+
export {};
|
package/models/dateRange.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { PickerRangeValue, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
|
|
3
|
+
import { RangeFieldSeparatorProps } from './fields';
|
|
4
4
|
import { DateRangeValidationError } from './validation';
|
|
5
5
|
import type { ExportedValidateDateRangeProps } from '../validation/validateDateRange';
|
|
6
|
-
export interface UseDateRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<PickerRangeValue,
|
|
6
|
+
export interface UseDateRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>, 'unstableFieldRef'>, 'format'>, RangeFieldSeparatorProps, ExportedValidateDateRangeProps {
|
|
7
7
|
}
|
package/models/fields.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { UseFieldResponse, FormProps } from '@mui/x-date-pickers/internals';
|
|
3
|
-
import { FieldRef,
|
|
2
|
+
import { UseFieldResponse, FormProps, PickerValue, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
3
|
+
import { FieldRef, PickerFieldSlotProps } from '@mui/x-date-pickers/models';
|
|
4
4
|
import { UseClearableFieldResponse } from '@mui/x-date-pickers/hooks';
|
|
5
|
-
|
|
6
|
-
export interface RangeFieldSection extends FieldSection {
|
|
7
|
-
dateName: RangePosition;
|
|
8
|
-
}
|
|
5
|
+
export type { FieldRangeSection } from '@mui/x-date-pickers/internals';
|
|
9
6
|
export type FieldType = 'single-input' | 'multi-input';
|
|
10
7
|
/**
|
|
11
8
|
* Props the `textField` slot of the multi input field can receive when used inside a picker.
|
|
@@ -30,8 +27,8 @@ export interface MultiInputFieldSlotRootProps {
|
|
|
30
27
|
onBlur?: React.FocusEventHandler;
|
|
31
28
|
}
|
|
32
29
|
export interface MultiInputFieldRefs {
|
|
33
|
-
unstableStartFieldRef?: React.Ref<FieldRef<
|
|
34
|
-
unstableEndFieldRef?: React.Ref<FieldRef<
|
|
30
|
+
unstableStartFieldRef?: React.Ref<FieldRef<PickerValue>>;
|
|
31
|
+
unstableEndFieldRef?: React.Ref<FieldRef<PickerValue>>;
|
|
35
32
|
}
|
|
36
33
|
export interface RangeFieldSeparatorProps {
|
|
37
34
|
/**
|
|
@@ -43,7 +40,7 @@ export interface RangeFieldSeparatorProps {
|
|
|
43
40
|
/**
|
|
44
41
|
* Props the `slotProps.field` of a range picker component can receive.
|
|
45
42
|
*/
|
|
46
|
-
export type PickerRangeFieldSlotProps<
|
|
43
|
+
export type PickerRangeFieldSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> = PickerFieldSlotProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure> & RangeFieldSeparatorProps;
|
|
47
44
|
/**
|
|
48
45
|
* Props the text field receives when used with a multi input picker.
|
|
49
46
|
* Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.textField`.
|
package/models/index.d.ts
CHANGED
package/models/index.js
CHANGED
package/models/range.d.ts
CHANGED
|
@@ -169,6 +169,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
169
169
|
name: 'DateRangeCalendar',
|
|
170
170
|
timezone: timezoneProp,
|
|
171
171
|
value: valueProp,
|
|
172
|
+
referenceDate,
|
|
172
173
|
defaultValue,
|
|
173
174
|
onChange,
|
|
174
175
|
valueManager: rangeValueManager
|
|
@@ -210,7 +211,8 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
210
211
|
range: value,
|
|
211
212
|
rangePosition,
|
|
212
213
|
allowRangeFlip,
|
|
213
|
-
shouldMergeDateAndTime: true
|
|
214
|
+
shouldMergeDateAndTime: true,
|
|
215
|
+
referenceDate
|
|
214
216
|
});
|
|
215
217
|
const isNextSectionAvailable = availableRangePositions.includes(nextSelection);
|
|
216
218
|
if (isNextSectionAvailable) {
|
|
@@ -99,12 +99,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
99
99
|
*/
|
|
100
100
|
classes: PropTypes.object,
|
|
101
101
|
className: PropTypes.string,
|
|
102
|
-
/**
|
|
103
|
-
* If `true`, the component is disabled.
|
|
104
|
-
* When disabled, the value cannot be changed and no interaction is possible.
|
|
105
|
-
* @default false
|
|
106
|
-
*/
|
|
107
|
-
disabled: PropTypes.bool,
|
|
108
102
|
/**
|
|
109
103
|
* If `true`, show the toolbar even in desktop mode.
|
|
110
104
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -118,12 +112,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
118
112
|
*/
|
|
119
113
|
onViewChange: PropTypes.func.isRequired,
|
|
120
114
|
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
121
|
-
/**
|
|
122
|
-
* If `true`, the component is read-only.
|
|
123
|
-
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
124
|
-
* @default false
|
|
125
|
-
*/
|
|
126
|
-
readOnly: PropTypes.bool,
|
|
127
115
|
/**
|
|
128
116
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
129
117
|
*/
|
|
@@ -7,7 +7,7 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
8
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
9
9
|
import { TimeIcon, DateRangeIcon, ArrowLeftIcon, ArrowRightIcon } from '@mui/x-date-pickers/icons';
|
|
10
|
-
import { isDatePickerView } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { isDatePickerView, usePickerPrivateContext } from '@mui/x-date-pickers/internals';
|
|
11
11
|
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
12
12
|
import IconButton from '@mui/material/IconButton';
|
|
13
13
|
import Button from '@mui/material/Button';
|
|
@@ -25,10 +25,7 @@ const tabToView = tab => {
|
|
|
25
25
|
}
|
|
26
26
|
return 'hours';
|
|
27
27
|
};
|
|
28
|
-
const useUtilityClasses =
|
|
29
|
-
const {
|
|
30
|
-
classes
|
|
31
|
-
} = ownerState;
|
|
28
|
+
const useUtilityClasses = classes => {
|
|
32
29
|
const slots = {
|
|
33
30
|
root: ['root'],
|
|
34
31
|
tabButton: ['tabButton'],
|
|
@@ -79,10 +76,14 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
79
76
|
rangePosition,
|
|
80
77
|
onRangePositionChange,
|
|
81
78
|
className,
|
|
79
|
+
classes: classesProp,
|
|
82
80
|
sx
|
|
83
81
|
} = props;
|
|
84
82
|
const translations = usePickerTranslations();
|
|
85
|
-
const
|
|
83
|
+
const {
|
|
84
|
+
ownerState
|
|
85
|
+
} = usePickerPrivateContext();
|
|
86
|
+
const classes = useUtilityClasses(classesProp);
|
|
86
87
|
const value = React.useMemo(() => viewToTab(view, rangePosition), [view, rangePosition]);
|
|
87
88
|
const isPreviousHidden = value === 'start-date';
|
|
88
89
|
const isNextHidden = value === 'end-time';
|
|
@@ -121,7 +122,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
121
122
|
return null;
|
|
122
123
|
}
|
|
123
124
|
return /*#__PURE__*/_jsxs(DateTimeRangePickerTabsRoot, {
|
|
124
|
-
ownerState:
|
|
125
|
+
ownerState: ownerState,
|
|
125
126
|
className: clsx(classes.root, className),
|
|
126
127
|
sx: sx,
|
|
127
128
|
children: [!isPreviousHidden ? /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "
|
|
5
|
+
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "hidden", "toolbarFormat", "toolbarPlaceholder", "titleId", "sx"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
10
10
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
11
|
import { useUtils } from '@mui/x-date-pickers/internals';
|
|
12
|
-
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
12
|
+
import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
13
13
|
import { DateTimePickerToolbar } from '@mui/x-date-pickers/DateTimePicker';
|
|
14
14
|
import { getDateTimeRangePickerToolbarUtilityClass } from "./dateTimeRangePickerToolbarClasses.js";
|
|
15
15
|
import { calculateRangeChange } from "../internals/utils/date-range-manager.js";
|
|
@@ -86,8 +86,6 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
86
86
|
isLandscape,
|
|
87
87
|
views,
|
|
88
88
|
ampm,
|
|
89
|
-
disabled,
|
|
90
|
-
readOnly,
|
|
91
89
|
hidden,
|
|
92
90
|
toolbarFormat,
|
|
93
91
|
toolbarPlaceholder,
|
|
@@ -95,6 +93,10 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
95
93
|
sx
|
|
96
94
|
} = props,
|
|
97
95
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
96
|
+
const {
|
|
97
|
+
disabled,
|
|
98
|
+
readOnly
|
|
99
|
+
} = usePickerContext();
|
|
98
100
|
const commonToolbarProps = {
|
|
99
101
|
isLandscape,
|
|
100
102
|
views,
|
|
@@ -183,12 +185,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
183
185
|
*/
|
|
184
186
|
classes: PropTypes.object,
|
|
185
187
|
className: PropTypes.string,
|
|
186
|
-
/**
|
|
187
|
-
* If `true`, the component is disabled.
|
|
188
|
-
* When disabled, the value cannot be changed and no interaction is possible.
|
|
189
|
-
* @default false
|
|
190
|
-
*/
|
|
191
|
-
disabled: PropTypes.bool,
|
|
192
188
|
/**
|
|
193
189
|
* If `true`, show the toolbar even in desktop mode.
|
|
194
190
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -204,12 +200,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
204
200
|
*/
|
|
205
201
|
onViewChange: PropTypes.func.isRequired,
|
|
206
202
|
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
207
|
-
/**
|
|
208
|
-
* If `true`, the component is read-only.
|
|
209
|
-
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
210
|
-
* @default false
|
|
211
|
-
*/
|
|
212
|
-
readOnly: PropTypes.bool,
|
|
213
203
|
/**
|
|
214
204
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
215
205
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className"];
|
|
5
|
+
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -12,17 +12,14 @@ import Typography from '@mui/material/Typography';
|
|
|
12
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
13
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
14
14
|
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
15
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
15
|
+
import { convertFieldResponseIntoMuiTextFieldProps, useFieldOwnerState } from '@mui/x-date-pickers/internals';
|
|
16
16
|
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
17
17
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
18
18
|
import { useMultiInputDateRangeField } from "../internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js";
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export const multiInputDateRangeFieldClasses = generateUtilityClasses('MuiMultiInputDateRangeField', ['root', 'separator']);
|
|
21
21
|
export const getMultiInputDateRangeFieldUtilityClass = slot => generateUtilityClass('MuiMultiInputDateRangeField', slot);
|
|
22
|
-
const useUtilityClasses =
|
|
23
|
-
const {
|
|
24
|
-
classes
|
|
25
|
-
} = ownerState;
|
|
22
|
+
const useUtilityClasses = classes => {
|
|
26
23
|
const slots = {
|
|
27
24
|
root: ['root'],
|
|
28
25
|
separator: ['separator']
|
|
@@ -70,11 +67,12 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
70
67
|
slotProps,
|
|
71
68
|
unstableStartFieldRef,
|
|
72
69
|
unstableEndFieldRef,
|
|
73
|
-
className
|
|
70
|
+
className,
|
|
71
|
+
classes: classesProp
|
|
74
72
|
} = forwardedProps,
|
|
75
73
|
otherForwardedProps = _objectWithoutPropertiesLoose(forwardedProps, _excluded);
|
|
76
|
-
const ownerState =
|
|
77
|
-
const classes = useUtilityClasses(
|
|
74
|
+
const ownerState = useFieldOwnerState(internalProps);
|
|
75
|
+
const classes = useUtilityClasses(classesProp);
|
|
78
76
|
const Root = slots?.root ?? MultiInputDateRangeFieldRoot;
|
|
79
77
|
const rootProps = useSlotProps({
|
|
80
78
|
elementType: Root,
|
|
@@ -258,10 +256,10 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
258
256
|
*/
|
|
259
257
|
shouldDisableDate: PropTypes.func,
|
|
260
258
|
/**
|
|
261
|
-
* If `true`, the format will respect the leading zeroes (
|
|
262
|
-
* If `false`, the format will always add leading zeroes (
|
|
259
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
260
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
263
261
|
*
|
|
264
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
262
|
+
* 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`.
|
|
265
263
|
*
|
|
266
264
|
* 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.
|
|
267
265
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className"];
|
|
5
|
+
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -12,17 +12,14 @@ import Typography from '@mui/material/Typography';
|
|
|
12
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
13
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
14
14
|
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
15
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
15
|
+
import { convertFieldResponseIntoMuiTextFieldProps, useFieldOwnerState } from '@mui/x-date-pickers/internals';
|
|
16
16
|
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
17
17
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
18
18
|
import { useMultiInputDateTimeRangeField } from "../internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js";
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export const multiInputDateTimeRangeFieldClasses = generateUtilityClasses('MuiMultiInputDateTimeRangeField', ['root', 'separator']);
|
|
21
21
|
export const getMultiInputDateTimeRangeFieldUtilityClass = slot => generateUtilityClass('MuiMultiInputDateTimeRangeField', slot);
|
|
22
|
-
const useUtilityClasses =
|
|
23
|
-
const {
|
|
24
|
-
classes
|
|
25
|
-
} = ownerState;
|
|
22
|
+
const useUtilityClasses = classes => {
|
|
26
23
|
const slots = {
|
|
27
24
|
root: ['root'],
|
|
28
25
|
separator: ['separator']
|
|
@@ -70,11 +67,12 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
|
|
|
70
67
|
slotProps,
|
|
71
68
|
unstableStartFieldRef,
|
|
72
69
|
unstableEndFieldRef,
|
|
73
|
-
className
|
|
70
|
+
className,
|
|
71
|
+
classes: classesProp
|
|
74
72
|
} = forwardedProps,
|
|
75
73
|
otherForwardedProps = _objectWithoutPropertiesLoose(forwardedProps, _excluded);
|
|
76
|
-
const ownerState = themeProps;
|
|
77
|
-
const classes = useUtilityClasses(
|
|
74
|
+
const ownerState = useFieldOwnerState(themeProps);
|
|
75
|
+
const classes = useUtilityClasses(classesProp);
|
|
78
76
|
const Root = slots?.root ?? MultiInputDateTimeRangeFieldRoot;
|
|
79
77
|
const rootProps = useSlotProps({
|
|
80
78
|
elementType: Root,
|
|
@@ -298,10 +296,10 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
298
296
|
*/
|
|
299
297
|
shouldDisableTime: PropTypes.func,
|
|
300
298
|
/**
|
|
301
|
-
* If `true`, the format will respect the leading zeroes (
|
|
302
|
-
* If `false`, the format will always add leading zeroes (
|
|
299
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
300
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
303
301
|
*
|
|
304
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
302
|
+
* 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`.
|
|
305
303
|
*
|
|
306
304
|
* 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.
|
|
307
305
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className"];
|
|
5
|
+
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
@@ -12,17 +12,14 @@ import Typography from '@mui/material/Typography';
|
|
|
12
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
13
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
14
14
|
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
15
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
15
|
+
import { convertFieldResponseIntoMuiTextFieldProps, useFieldOwnerState } from '@mui/x-date-pickers/internals';
|
|
16
16
|
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
17
17
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
18
18
|
import { useMultiInputTimeRangeField } from "../internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js";
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export const multiInputTimeRangeFieldClasses = generateUtilityClasses('MuiMultiInputTimeRangeField', ['root', 'separator']);
|
|
21
21
|
export const getMultiInputTimeRangeFieldUtilityClass = slot => generateUtilityClass('MuiMultiInputTimeRangeField', slot);
|
|
22
|
-
const useUtilityClasses =
|
|
23
|
-
const {
|
|
24
|
-
classes
|
|
25
|
-
} = ownerState;
|
|
22
|
+
const useUtilityClasses = classes => {
|
|
26
23
|
const slots = {
|
|
27
24
|
root: ['root'],
|
|
28
25
|
separator: ['separator']
|
|
@@ -70,11 +67,12 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
70
67
|
slotProps,
|
|
71
68
|
unstableStartFieldRef,
|
|
72
69
|
unstableEndFieldRef,
|
|
73
|
-
className
|
|
70
|
+
className,
|
|
71
|
+
classes: classesProp
|
|
74
72
|
} = forwardedProps,
|
|
75
73
|
otherForwardedProps = _objectWithoutPropertiesLoose(forwardedProps, _excluded);
|
|
76
|
-
const ownerState = themeProps;
|
|
77
|
-
const classes = useUtilityClasses(
|
|
74
|
+
const ownerState = useFieldOwnerState(themeProps);
|
|
75
|
+
const classes = useUtilityClasses(classesProp);
|
|
78
76
|
const Root = slots?.root ?? MultiInputTimeRangeFieldRoot;
|
|
79
77
|
const rootProps = useSlotProps({
|
|
80
78
|
elementType: Root,
|
|
@@ -270,10 +268,10 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
270
268
|
*/
|
|
271
269
|
shouldDisableTime: PropTypes.func,
|
|
272
270
|
/**
|
|
273
|
-
* If `true`, the format will respect the leading zeroes (
|
|
274
|
-
* If `false`, the format will always add leading zeroes (
|
|
271
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
272
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
275
273
|
*
|
|
276
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
274
|
+
* 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`.
|
|
277
275
|
*
|
|
278
276
|
* 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.
|
|
279
277
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -10,7 +10,7 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
10
10
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
11
11
|
import { refType } from '@mui/utils';
|
|
12
12
|
import { useClearableField } from '@mui/x-date-pickers/hooks';
|
|
13
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
13
|
+
import { convertFieldResponseIntoMuiTextFieldProps, useFieldOwnerState } from '@mui/x-date-pickers/internals';
|
|
14
14
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
15
15
|
import { useSingleInputDateRangeField } from "./useSingleInputDateRangeField.js";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -36,7 +36,7 @@ const SingleInputDateRangeField = /*#__PURE__*/React.forwardRef(function SingleI
|
|
|
36
36
|
inputProps
|
|
37
37
|
} = themeProps,
|
|
38
38
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
39
|
-
const ownerState = themeProps;
|
|
39
|
+
const ownerState = useFieldOwnerState(themeProps);
|
|
40
40
|
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
|
|
41
41
|
const textFieldProps = useSlotProps({
|
|
42
42
|
elementType: TextField,
|
|
@@ -262,10 +262,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
262
262
|
*/
|
|
263
263
|
shouldDisableDate: PropTypes.func,
|
|
264
264
|
/**
|
|
265
|
-
* If `true`, the format will respect the leading zeroes (
|
|
266
|
-
* If `false`, the format will always add leading zeroes (
|
|
265
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
266
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
267
267
|
*
|
|
268
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
268
|
+
* 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`.
|
|
269
269
|
*
|
|
270
270
|
* 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.
|
|
271
271
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|