@mui/x-date-pickers 7.0.0-alpha.4 → 7.0.0-alpha.6
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 +342 -0
- package/DateCalendar/DateCalendar.types.d.ts +6 -6
- package/DateCalendar/DayCalendar.d.ts +4 -4
- package/DateCalendar/index.d.ts +1 -1
- package/DateField/DateField.js +17 -50
- package/DateField/DateField.types.d.ts +5 -9
- package/DateField/useDateField.d.ts +2 -2
- package/DateField/useDateField.js +1 -5
- package/DatePicker/DatePicker.js +5 -1
- package/DatePicker/DatePicker.types.d.ts +6 -6
- package/DatePicker/index.d.ts +1 -1
- package/DatePicker/shared.d.ts +6 -6
- package/DateTimeField/DateTimeField.js +17 -50
- package/DateTimeField/DateTimeField.types.d.ts +5 -9
- package/DateTimeField/useDateTimeField.d.ts +2 -2
- package/DateTimeField/useDateTimeField.js +1 -5
- package/DateTimePicker/DateTimePicker.js +5 -1
- package/DateTimePicker/DateTimePicker.types.d.ts +6 -6
- package/DateTimePicker/index.d.ts +1 -1
- package/DateTimePicker/shared.d.ts +6 -6
- package/DesktopDatePicker/DesktopDatePicker.js +7 -2
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +6 -6
- package/DesktopDatePicker/index.d.ts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +8 -8
- package/DesktopDateTimePicker/index.d.ts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +8 -8
- package/DesktopTimePicker/index.d.ts +1 -1
- package/DigitalClock/DigitalClock.types.d.ts +4 -4
- package/DigitalClock/index.d.ts +1 -1
- package/MobileDatePicker/MobileDatePicker.js +7 -2
- package/MobileDatePicker/MobileDatePicker.types.d.ts +6 -6
- package/MobileDatePicker/index.d.ts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +6 -6
- package/MobileDateTimePicker/index.d.ts +1 -1
- package/MobileTimePicker/MobileTimePicker.js +5 -1
- package/MobileTimePicker/MobileTimePicker.types.d.ts +6 -6
- package/MobileTimePicker/index.d.ts +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +4 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +3 -3
- package/MultiSectionDigitalClock/index.d.ts +1 -1
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +8 -8
- package/PickersCalendarHeader/index.d.ts +1 -1
- package/PickersLayout/PickersLayout.types.d.ts +6 -6
- package/PickersLayout/index.d.ts +1 -1
- package/PickersSectionList/PickersSectionList.d.ts +11 -0
- package/PickersSectionList/PickersSectionList.js +223 -0
- package/PickersSectionList/PickersSectionList.types.d.ts +56 -0
- package/PickersSectionList/index.d.ts +4 -0
- package/PickersSectionList/index.js +2 -0
- package/PickersSectionList/package.json +6 -0
- package/PickersSectionList/pickersSectionListClasses.d.ts +11 -0
- package/PickersSectionList/pickersSectionListClasses.js +6 -0
- package/StaticDatePicker/StaticDatePicker.js +1 -1
- package/StaticDatePicker/StaticDatePicker.types.d.ts +7 -7
- package/StaticDatePicker/index.d.ts +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +7 -7
- package/StaticDateTimePicker/index.d.ts +1 -1
- package/StaticTimePicker/StaticTimePicker.types.d.ts +7 -7
- package/StaticTimePicker/index.d.ts +1 -1
- package/TimeClock/TimeClock.types.d.ts +5 -5
- package/TimeClock/index.d.ts +1 -1
- package/TimeField/TimeField.js +17 -50
- package/TimeField/TimeField.types.d.ts +5 -9
- package/TimeField/useTimeField.d.ts +2 -2
- package/TimeField/useTimeField.js +1 -5
- package/TimePicker/TimePicker.js +5 -1
- package/TimePicker/TimePicker.types.d.ts +6 -6
- package/TimePicker/index.d.ts +1 -1
- package/TimePicker/shared.d.ts +5 -5
- package/hooks/index.d.ts +1 -0
- package/hooks/useClearableField.d.ts +32 -20
- package/hooks/useClearableField.js +32 -33
- package/index.d.ts +1 -0
- package/index.js +4 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +9 -9
- package/internals/components/PickersArrowSwitcher/index.d.ts +3 -1
- package/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/internals/components/{PickersTextField → PickersInput}/Outline.d.ts +1 -0
- package/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
- package/internals/components/PickersInput/PickersFilledInput.d.ts +3 -0
- package/internals/components/PickersInput/PickersFilledInput.js +166 -0
- package/internals/components/PickersInput/PickersInput.d.ts +15 -0
- package/internals/components/{PickersTextField → PickersInput}/PickersInput.js +78 -106
- package/internals/components/PickersInput/PickersInput.types.d.ts +60 -0
- package/internals/components/PickersInput/PickersOutlinedInput.d.ts +3 -0
- package/internals/components/PickersInput/PickersOutlinedInput.js +117 -0
- package/internals/components/PickersInput/PickersStandardInput.d.ts +3 -0
- package/internals/components/PickersInput/PickersStandardInput.js +123 -0
- package/internals/components/PickersInput/index.d.ts +4 -0
- package/internals/components/PickersInput/index.js +3 -0
- package/internals/components/PickersInput/pickersInputClasses.d.ts +84 -0
- package/internals/components/PickersInput/pickersInputClasses.js +18 -0
- package/internals/components/PickersModalDialog.d.ts +4 -4
- package/internals/components/PickersPopper.d.ts +4 -4
- package/internals/components/PickersTextField/PickersTextField.d.ts +1 -2
- package/internals/components/PickersTextField/PickersTextField.js +15 -6
- package/internals/components/PickersTextField/PickersTextField.types.d.ts +46 -3
- package/internals/components/PickersTextField/pickersTextFieldClasses.d.ts +0 -31
- package/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
- package/internals/hooks/useDesktopPicker/index.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +8 -8
- package/internals/hooks/useField/index.d.ts +1 -1
- package/internals/hooks/useField/useField.js +11 -4
- package/internals/hooks/useField/useField.types.d.ts +4 -24
- package/internals/hooks/useField/useField.utils.js +24 -4
- package/internals/hooks/useField/useFieldState.js +7 -3
- package/internals/hooks/useMobilePicker/index.d.ts +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -7
- package/internals/hooks/useStaticPicker/index.d.ts +1 -1
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -5
- package/internals/index.d.ts +7 -6
- package/internals/index.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +4 -0
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +3 -0
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +26 -0
- package/legacy/DateField/DateField.js +19 -47
- package/legacy/DateField/useDateField.js +1 -4
- package/legacy/DatePicker/DatePicker.js +5 -1
- package/legacy/DateTimeField/DateTimeField.js +19 -47
- package/legacy/DateTimeField/useDateTimeField.js +1 -4
- package/legacy/DateTimePicker/DateTimePicker.js +5 -1
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +7 -2
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +7 -2
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/legacy/MobileTimePicker/MobileTimePicker.js +5 -1
- package/legacy/PickersSectionList/PickersSectionList.js +230 -0
- package/legacy/PickersSectionList/index.js +2 -0
- package/legacy/PickersSectionList/pickersSectionListClasses.js +6 -0
- package/legacy/StaticDatePicker/StaticDatePicker.js +1 -1
- package/legacy/TimeField/TimeField.js +19 -47
- package/legacy/TimeField/useTimeField.js +1 -4
- package/legacy/TimePicker/TimePicker.js +5 -1
- package/legacy/hooks/useClearableField.js +30 -32
- package/legacy/index.js +4 -1
- package/legacy/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/legacy/internals/components/{PickersTextField → PickersInput}/Outline.js +40 -22
- package/legacy/internals/components/PickersInput/PickersFilledInput.js +161 -0
- package/legacy/internals/components/{PickersTextField → PickersInput}/PickersInput.js +75 -90
- package/legacy/internals/components/PickersInput/PickersInput.types.js +1 -0
- package/legacy/internals/components/PickersInput/PickersOutlinedInput.js +110 -0
- package/legacy/internals/components/PickersInput/PickersStandardInput.js +117 -0
- package/legacy/internals/components/PickersInput/index.js +3 -0
- package/legacy/internals/components/PickersInput/pickersInputClasses.js +18 -0
- package/legacy/internals/components/PickersTextField/PickersTextField.js +16 -7
- package/legacy/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/legacy/internals/hooks/useField/useField.js +12 -5
- package/legacy/internals/hooks/useField/useField.utils.js +26 -4
- package/legacy/internals/hooks/useField/useFieldState.js +7 -3
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +24 -0
- package/legacy/locales/ruRU.js +1 -2
- package/locales/ruRU.js +1 -2
- package/models/fields.d.ts +2 -1
- package/modern/DateField/DateField.js +17 -50
- package/modern/DateField/useDateField.js +1 -5
- package/modern/DatePicker/DatePicker.js +5 -1
- package/modern/DateTimeField/DateTimeField.js +17 -50
- package/modern/DateTimeField/useDateTimeField.js +1 -5
- package/modern/DateTimePicker/DateTimePicker.js +5 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +7 -2
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/modern/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +7 -2
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/modern/MobileTimePicker/MobileTimePicker.js +5 -1
- package/modern/PickersSectionList/PickersSectionList.js +221 -0
- package/modern/PickersSectionList/PickersSectionList.types.js +1 -0
- package/modern/PickersSectionList/index.js +2 -0
- package/modern/PickersSectionList/pickersSectionListClasses.js +6 -0
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -1
- package/modern/TimeField/TimeField.js +17 -50
- package/modern/TimeField/useTimeField.js +1 -5
- package/modern/TimePicker/TimePicker.js +5 -1
- package/modern/hooks/useClearableField.js +32 -33
- package/modern/index.js +4 -1
- package/modern/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/modern/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
- package/modern/internals/components/PickersInput/PickersFilledInput.js +165 -0
- package/modern/internals/components/{PickersTextField → PickersInput}/PickersInput.js +78 -106
- package/modern/internals/components/PickersInput/PickersInput.types.js +1 -0
- package/modern/internals/components/PickersInput/PickersOutlinedInput.js +117 -0
- package/modern/internals/components/PickersInput/PickersStandardInput.js +123 -0
- package/modern/internals/components/PickersInput/index.js +3 -0
- package/modern/internals/components/PickersInput/pickersInputClasses.js +18 -0
- package/modern/internals/components/PickersTextField/PickersTextField.js +15 -6
- package/modern/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/modern/internals/hooks/useField/useField.js +11 -4
- package/modern/internals/hooks/useField/useField.utils.js +24 -4
- package/modern/internals/hooks/useField/useFieldState.js +7 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +26 -0
- package/modern/locales/ruRU.js +1 -2
- package/node/DateField/DateField.js +18 -51
- package/node/DateField/useDateField.js +1 -5
- package/node/DatePicker/DatePicker.js +5 -1
- package/node/DateTimeField/DateTimeField.js +18 -51
- package/node/DateTimeField/useDateTimeField.js +1 -5
- package/node/DateTimePicker/DateTimePicker.js +5 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +10 -5
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/node/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/node/MobileDatePicker/MobileDatePicker.js +10 -5
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/node/MobileTimePicker/MobileTimePicker.js +5 -1
- package/node/PickersSectionList/PickersSectionList.js +228 -0
- package/node/PickersSectionList/index.js +49 -0
- package/node/PickersSectionList/pickersSectionListClasses.js +14 -0
- package/node/StaticDatePicker/StaticDatePicker.js +2 -2
- package/node/TimeField/TimeField.js +18 -51
- package/node/TimeField/useTimeField.js +1 -5
- package/node/TimePicker/TimePicker.js +5 -1
- package/node/hooks/useClearableField.js +33 -34
- package/node/index.js +13 -1
- package/node/internals/components/PickersArrowSwitcher/index.js +14 -1
- package/node/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
- package/node/internals/components/PickersInput/PickersFilledInput.js +174 -0
- package/node/internals/components/{PickersTextField → PickersInput}/PickersInput.js +80 -108
- package/node/internals/components/PickersInput/PickersInput.types.js +5 -0
- package/node/internals/components/PickersInput/PickersOutlinedInput.js +125 -0
- package/node/internals/components/PickersInput/PickersStandardInput.js +132 -0
- package/node/internals/components/PickersInput/index.js +32 -0
- package/node/internals/components/PickersInput/pickersInputClasses.js +29 -0
- package/node/internals/components/PickersTextField/PickersTextField.js +15 -6
- package/node/internals/components/PickersTextField/pickersTextFieldClasses.js +6 -9
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/node/internals/hooks/useField/useField.js +11 -4
- package/node/internals/hooks/useField/useField.utils.js +24 -4
- package/node/internals/hooks/useField/useFieldState.js +7 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/node/internals/index.js +7 -0
- package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +34 -0
- package/node/locales/ruRU.js +1 -2
- package/package.json +5 -5
- package/themeAugmentation/overrides.d.ts +5 -7
- package/themeAugmentation/props.d.ts +6 -8
- package/internals/components/PickersTextField/PickersInput.d.ts +0 -3
- package/internals/components/PickersTextField/PickersInput.types.d.ts +0 -45
- /package/{internals/components/PickersTextField/PickersInput.types.js → PickersSectionList/PickersSectionList.types.js} +0 -0
- /package/{legacy/internals/components/PickersTextField → internals/components/PickersInput}/PickersInput.types.js +0 -0
- /package/{modern/internals/components/PickersTextField/PickersInput.types.js → legacy/PickersSectionList/PickersSectionList.types.js} +0 -0
- /package/node/{internals/components/PickersTextField/PickersInput.types.js → PickersSectionList/PickersSectionList.types.js} +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseDatePickerProps,
|
|
2
|
-
import { StaticOnlyPickerProps,
|
|
3
|
-
import { MakeOptional } from '../internals';
|
|
1
|
+
import { BaseDatePickerProps, BaseDatePickerSlots, BaseDatePickerSlotProps } from '../DatePicker/shared';
|
|
2
|
+
import { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps } from '../internals/hooks/useStaticPicker';
|
|
3
|
+
import { MakeOptional } from '../internals/models/helpers';
|
|
4
4
|
import { DateView } from '../models';
|
|
5
|
-
export interface
|
|
5
|
+
export interface StaticDatePickerSlots<TDate> extends BaseDatePickerSlots<TDate>, UseStaticPickerSlots<TDate, DateView> {
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface StaticDatePickerSlotProps<TDate> extends BaseDatePickerSlotProps<TDate>, UseStaticPickerSlotProps<TDate, DateView> {
|
|
8
8
|
}
|
|
9
9
|
export interface StaticDatePickerProps<TDate> extends BaseDatePickerProps<TDate>, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
|
|
10
10
|
/**
|
|
11
11
|
* Overridable component slots.
|
|
12
12
|
* @default {}
|
|
13
13
|
*/
|
|
14
|
-
slots?:
|
|
14
|
+
slots?: StaticDatePickerSlots<TDate>;
|
|
15
15
|
/**
|
|
16
16
|
* The props used for each component slot.
|
|
17
17
|
* @default {}
|
|
18
18
|
*/
|
|
19
|
-
slotProps?:
|
|
19
|
+
slotProps?: StaticDatePickerSlotProps<TDate>;
|
|
20
20
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { StaticDatePicker } from './StaticDatePicker';
|
|
2
|
-
export type { StaticDatePickerProps,
|
|
2
|
+
export type { StaticDatePickerProps, StaticDatePickerSlots, StaticDatePickerSlotProps, } from './StaticDatePicker.types';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseDateTimePickerProps,
|
|
2
|
-
import { StaticOnlyPickerProps,
|
|
3
|
-
import { MakeOptional } from '../internals';
|
|
1
|
+
import { BaseDateTimePickerProps, BaseDateTimePickerSlots, BaseDateTimePickerSlotProps } from '../DateTimePicker/shared';
|
|
2
|
+
import { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps } from '../internals/hooks/useStaticPicker';
|
|
3
|
+
import { MakeOptional } from '../internals/models/helpers';
|
|
4
4
|
import { DateOrTimeView } from '../models';
|
|
5
|
-
export interface
|
|
5
|
+
export interface StaticDateTimePickerSlots<TDate> extends BaseDateTimePickerSlots<TDate>, UseStaticPickerSlots<TDate, DateOrTimeView> {
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface StaticDateTimePickerSlotProps<TDate> extends BaseDateTimePickerSlotProps<TDate>, UseStaticPickerSlotProps<TDate, DateOrTimeView> {
|
|
8
8
|
}
|
|
9
9
|
export interface StaticDateTimePickerProps<TDate> extends BaseDateTimePickerProps<TDate, DateOrTimeView>, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
|
|
10
10
|
/**
|
|
11
11
|
* Overridable component slots.
|
|
12
12
|
* @default {}
|
|
13
13
|
*/
|
|
14
|
-
slots?:
|
|
14
|
+
slots?: StaticDateTimePickerSlots<TDate>;
|
|
15
15
|
/**
|
|
16
16
|
* The props used for each component slot.
|
|
17
17
|
* @default {}
|
|
18
18
|
*/
|
|
19
|
-
slotProps?:
|
|
19
|
+
slotProps?: StaticDateTimePickerSlotProps<TDate>;
|
|
20
20
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { StaticDateTimePicker } from './StaticDateTimePicker';
|
|
2
|
-
export type { StaticDateTimePickerProps,
|
|
2
|
+
export type { StaticDateTimePickerProps, StaticDateTimePickerSlots, StaticDateTimePickerSlotProps, } from './StaticDateTimePicker.types';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseTimePickerProps,
|
|
2
|
-
import { StaticOnlyPickerProps,
|
|
3
|
-
import { MakeOptional } from '../internals';
|
|
1
|
+
import { BaseTimePickerProps, BaseTimePickerSlots, BaseTimePickerSlotProps } from '../TimePicker/shared';
|
|
2
|
+
import { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps } from '../internals/hooks/useStaticPicker';
|
|
3
|
+
import { MakeOptional } from '../internals/models/helpers';
|
|
4
4
|
import { TimeView } from '../models';
|
|
5
|
-
export interface
|
|
5
|
+
export interface StaticTimePickerSlots<TDate> extends BaseTimePickerSlots<TDate>, UseStaticPickerSlots<TDate, TimeView> {
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface StaticTimePickerSlotProps<TDate> extends BaseTimePickerSlotProps, UseStaticPickerSlotProps<TDate, TimeView> {
|
|
8
8
|
}
|
|
9
9
|
export interface StaticTimePickerProps<TDate> extends BaseTimePickerProps<TDate, TimeView>, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
|
|
10
10
|
/**
|
|
11
11
|
* Overridable component slots.
|
|
12
12
|
* @default {}
|
|
13
13
|
*/
|
|
14
|
-
slots?:
|
|
14
|
+
slots?: StaticTimePickerSlots<TDate>;
|
|
15
15
|
/**
|
|
16
16
|
* The props used for each component slot.
|
|
17
17
|
* @default {}
|
|
18
18
|
*/
|
|
19
|
-
slotProps?:
|
|
19
|
+
slotProps?: StaticTimePickerSlotProps<TDate>;
|
|
20
20
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { StaticTimePicker } from './StaticTimePicker';
|
|
2
|
-
export type { StaticTimePickerProps,
|
|
2
|
+
export type { StaticTimePickerProps, StaticTimePickerSlots, StaticTimePickerSlotProps, } from './StaticTimePicker.types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TimeClockClasses } from './timeClockClasses';
|
|
2
|
-
import {
|
|
2
|
+
import { PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps } from '../internals/components/PickersArrowSwitcher';
|
|
3
3
|
import { BaseClockProps, ExportedBaseClockProps } from '../internals/models/props/clock';
|
|
4
4
|
import { TimeView } from '../models';
|
|
5
5
|
import { TimeViewWithMeridiem } from '../internals/models';
|
|
@@ -10,9 +10,9 @@ export interface ExportedTimeClockProps<TDate> extends ExportedBaseClockProps<TD
|
|
|
10
10
|
*/
|
|
11
11
|
ampmInClock?: boolean;
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
13
|
+
export interface TimeClockSlots extends PickersArrowSwitcherSlots {
|
|
14
14
|
}
|
|
15
|
-
export interface
|
|
15
|
+
export interface TimeClockSlotProps extends PickersArrowSwitcherSlotProps {
|
|
16
16
|
}
|
|
17
17
|
export interface TimeClockProps<TDate, TView extends TimeViewWithMeridiem = TimeView> extends ExportedTimeClockProps<TDate>, BaseClockProps<TDate, TView> {
|
|
18
18
|
/**
|
|
@@ -23,11 +23,11 @@ export interface TimeClockProps<TDate, TView extends TimeViewWithMeridiem = Time
|
|
|
23
23
|
* Overridable component slots.
|
|
24
24
|
* @default {}
|
|
25
25
|
*/
|
|
26
|
-
slots?:
|
|
26
|
+
slots?: TimeClockSlots;
|
|
27
27
|
/**
|
|
28
28
|
* The props used for each component slot.
|
|
29
29
|
* @default {}
|
|
30
30
|
*/
|
|
31
|
-
slotProps?:
|
|
31
|
+
slotProps?: TimeClockSlotProps;
|
|
32
32
|
showViewSwitcher?: boolean;
|
|
33
33
|
}
|
package/TimeClock/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { TimeClock } from './TimeClock';
|
|
2
|
-
export type { TimeClockProps,
|
|
2
|
+
export type { TimeClockProps, TimeClockSlots, TimeClockSlotProps } from './TimeClock.types';
|
|
3
3
|
export { clockClasses } from './clockClasses';
|
|
4
4
|
export type { ClockClasses, ClockClassKey } from './clockClasses';
|
|
5
5
|
export type { ClockProps } from './Clock';
|
package/TimeField/TimeField.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["slots", "slotProps", "InputProps", "inputProps"]
|
|
4
|
-
_excluded2 = ["inputRef"],
|
|
5
|
-
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
|
|
3
|
+
const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
|
|
6
4
|
import * as React from 'react';
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
8
6
|
import MuiTextField from '@mui/material/TextField';
|
|
@@ -11,6 +9,7 @@ import { useSlotProps } from '@mui/base/utils';
|
|
|
11
9
|
import { refType } from '@mui/utils';
|
|
12
10
|
import { useTimeField } from './useTimeField';
|
|
13
11
|
import { useClearableField } from '../hooks';
|
|
12
|
+
import { convertFieldResponseIntoMuiTextFieldProps } from '../internals/utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
/**
|
|
16
15
|
* Demos:
|
|
@@ -22,7 +21,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
22
21
|
*
|
|
23
22
|
* - [TimeField API](https://mui.com/x/api/date-pickers/time-field/)
|
|
24
23
|
*/
|
|
25
|
-
const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps,
|
|
24
|
+
const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, inRef) {
|
|
26
25
|
var _slots$textField;
|
|
27
26
|
const themeProps = useThemeProps({
|
|
28
27
|
props: inProps,
|
|
@@ -37,58 +36,26 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, ref)
|
|
|
37
36
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
38
37
|
const ownerState = themeProps;
|
|
39
38
|
const TextField = (_slots$textField = slots == null ? void 0 : slots.textField) != null ? _slots$textField : MuiTextField;
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
textFieldProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
|
39
|
+
const textFieldProps = useSlotProps({
|
|
40
|
+
elementType: TextField,
|
|
41
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.textField,
|
|
42
|
+
externalForwardedProps: other,
|
|
43
|
+
ownerState,
|
|
44
|
+
additionalProps: {
|
|
45
|
+
ref: inRef
|
|
46
|
+
}
|
|
47
|
+
});
|
|
50
48
|
|
|
51
49
|
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
52
50
|
textFieldProps.inputProps = _extends({}, inputProps, textFieldProps.inputProps);
|
|
53
51
|
textFieldProps.InputProps = _extends({}, InputProps, textFieldProps.InputProps);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}),
|
|
58
|
-
{
|
|
59
|
-
ref: inputRef,
|
|
60
|
-
onPaste,
|
|
61
|
-
onKeyDown,
|
|
62
|
-
inputMode,
|
|
63
|
-
readOnly,
|
|
64
|
-
clearable,
|
|
65
|
-
onClear
|
|
66
|
-
} = _useTimeField,
|
|
67
|
-
fieldProps = _objectWithoutPropertiesLoose(_useTimeField, _excluded3);
|
|
68
|
-
const {
|
|
69
|
-
InputProps: ProcessedInputProps,
|
|
70
|
-
fieldProps: processedFieldProps
|
|
71
|
-
} = useClearableField({
|
|
72
|
-
onClear,
|
|
73
|
-
clearable,
|
|
74
|
-
fieldProps,
|
|
75
|
-
InputProps: fieldProps.InputProps,
|
|
52
|
+
const fieldResponse = useTimeField(textFieldProps);
|
|
53
|
+
const convertedFieldResponse = convertFieldResponseIntoMuiTextFieldProps(fieldResponse);
|
|
54
|
+
const processedFieldProps = useClearableField(_extends({}, convertedFieldResponse, {
|
|
76
55
|
slots,
|
|
77
56
|
slotProps
|
|
78
|
-
});
|
|
79
|
-
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
80
|
-
ref: ref
|
|
81
|
-
}, processedFieldProps, {
|
|
82
|
-
InputProps: _extends({}, ProcessedInputProps, {
|
|
83
|
-
readOnly
|
|
84
|
-
}),
|
|
85
|
-
inputProps: _extends({}, fieldProps.inputProps, {
|
|
86
|
-
inputMode,
|
|
87
|
-
onPaste,
|
|
88
|
-
onKeyDown,
|
|
89
|
-
ref: inputRef
|
|
90
|
-
})
|
|
91
57
|
}));
|
|
58
|
+
return /*#__PURE__*/_jsx(TextField, _extends({}, processedFieldProps));
|
|
92
59
|
});
|
|
93
60
|
process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
94
61
|
// ----------------------------- Warning --------------------------------
|
|
@@ -283,7 +250,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
283
250
|
* 4. If `null` is provided, no section will be selected
|
|
284
251
|
* If not provided, the selected sections will be handled internally.
|
|
285
252
|
*/
|
|
286
|
-
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number, PropTypes.shape({
|
|
253
|
+
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number, PropTypes.shape({
|
|
287
254
|
endIndex: PropTypes.number.isRequired,
|
|
288
255
|
startIndex: PropTypes.number.isRequired
|
|
289
256
|
})]),
|
|
@@ -6,11 +6,7 @@ import { DefaultizedProps, MakeOptional } from '../internals/models/helpers';
|
|
|
6
6
|
import { BaseTimeValidationProps, TimeValidationProps } from '../internals/models/validation';
|
|
7
7
|
import { FieldsTextFieldProps } from '../internals/models/fields';
|
|
8
8
|
import { FieldSection, TimeValidationError } from '../models';
|
|
9
|
-
import {
|
|
10
|
-
export interface UseTimeFieldParams<TDate, TChildProps extends {}> {
|
|
11
|
-
props: UseTimeFieldComponentProps<TDate, TChildProps>;
|
|
12
|
-
inputRef?: React.Ref<HTMLInputElement>;
|
|
13
|
-
}
|
|
9
|
+
import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '../hooks/useClearableField';
|
|
14
10
|
export interface UseTimeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<TDate | null, TDate, FieldSection, TimeValidationError>, 'format'>, TimeValidationProps<TDate>, BaseTimeValidationProps {
|
|
15
11
|
/**
|
|
16
12
|
* 12h/24h view for hour selection clock.
|
|
@@ -25,15 +21,15 @@ export interface TimeFieldProps<TDate> extends UseTimeFieldComponentProps<TDate,
|
|
|
25
21
|
* Overridable component slots.
|
|
26
22
|
* @default {}
|
|
27
23
|
*/
|
|
28
|
-
slots?:
|
|
24
|
+
slots?: TimeFieldSlots;
|
|
29
25
|
/**
|
|
30
26
|
* The props used for each component slot.
|
|
31
27
|
* @default {}
|
|
32
28
|
*/
|
|
33
|
-
slotProps?:
|
|
29
|
+
slotProps?: TimeFieldSlotProps<TDate>;
|
|
34
30
|
}
|
|
35
31
|
export type TimeFieldOwnerState<TDate> = TimeFieldProps<TDate>;
|
|
36
|
-
export interface
|
|
32
|
+
export interface TimeFieldSlots extends UseClearableFieldSlots {
|
|
37
33
|
/**
|
|
38
34
|
* Form control with an input to render the value.
|
|
39
35
|
* Receives the same props as `@mui/material/TextField`.
|
|
@@ -41,6 +37,6 @@ export interface TimeFieldSlotsComponent extends FieldSlotsComponents {
|
|
|
41
37
|
*/
|
|
42
38
|
textField?: React.ElementType;
|
|
43
39
|
}
|
|
44
|
-
export interface
|
|
40
|
+
export interface TimeFieldSlotProps<TDate> extends UseClearableFieldSlotProps {
|
|
45
41
|
textField?: SlotComponentProps<typeof TextField, {}, TimeFieldOwnerState<TDate>>;
|
|
46
42
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UseTimeFieldProps,
|
|
2
|
-
export declare const useTimeField: <TDate, TChildProps extends {}>(
|
|
1
|
+
import { UseTimeFieldProps, UseTimeFieldComponentProps } from './TimeField.types';
|
|
2
|
+
export declare const useTimeField: <TDate, TChildProps extends {}>(inProps: UseTimeFieldComponentProps<TDate, TChildProps>) => import("../internals/hooks/useField").UseFieldResponse<Omit<TChildProps & Omit<UseTimeFieldProps<TDate>, "format" | keyof import("../internals").BaseTimeValidationProps> & Required<Pick<UseTimeFieldProps<TDate>, "format" | keyof import("../internals").BaseTimeValidationProps>>, keyof UseTimeFieldProps<any>>>;
|
|
@@ -15,17 +15,13 @@ const useDefaultizedTimeField = props => {
|
|
|
15
15
|
format: (_props$format = props.format) != null ? _props$format : defaultFormat
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
export const useTimeField =
|
|
19
|
-
props: inProps,
|
|
20
|
-
inputRef
|
|
21
|
-
}) => {
|
|
18
|
+
export const useTimeField = inProps => {
|
|
22
19
|
const props = useDefaultizedTimeField(inProps);
|
|
23
20
|
const {
|
|
24
21
|
forwardedProps,
|
|
25
22
|
internalProps
|
|
26
23
|
} = splitFieldInternalAndForwardedProps(props, 'time');
|
|
27
24
|
return useField({
|
|
28
|
-
inputRef,
|
|
29
25
|
forwardedProps,
|
|
30
26
|
internalProps,
|
|
31
27
|
valueManager: singleItemValueManager,
|
package/TimePicker/TimePicker.js
CHANGED
|
@@ -149,6 +149,10 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
149
149
|
* @default 1
|
|
150
150
|
*/
|
|
151
151
|
minutesStep: PropTypes.number,
|
|
152
|
+
/**
|
|
153
|
+
* Name attribute used by the `input` element in the Field.
|
|
154
|
+
*/
|
|
155
|
+
name: PropTypes.string,
|
|
152
156
|
/**
|
|
153
157
|
* Callback fired when the value is accepted.
|
|
154
158
|
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
@@ -229,7 +233,7 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
229
233
|
* 4. If `null` is provided, no section will be selected
|
|
230
234
|
* If not provided, the selected sections will be handled internally.
|
|
231
235
|
*/
|
|
232
|
-
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number, PropTypes.shape({
|
|
236
|
+
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number, PropTypes.shape({
|
|
233
237
|
endIndex: PropTypes.number.isRequired,
|
|
234
238
|
startIndex: PropTypes.number.isRequired
|
|
235
239
|
})]),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DesktopTimePickerProps,
|
|
1
|
+
import { DesktopTimePickerProps, DesktopTimePickerSlots, DesktopTimePickerSlotProps } from '../DesktopTimePicker';
|
|
2
2
|
import { TimeViewWithMeridiem } from '../internals/models';
|
|
3
|
-
import { MobileTimePickerProps,
|
|
4
|
-
export interface
|
|
3
|
+
import { MobileTimePickerProps, MobileTimePickerSlots, MobileTimePickerSlotProps } from '../MobileTimePicker';
|
|
4
|
+
export interface TimePickerSlots<TDate> extends DesktopTimePickerSlots<TDate>, MobileTimePickerSlots<TDate, TimeViewWithMeridiem> {
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface TimePickerSlotProps<TDate> extends DesktopTimePickerSlotProps<TDate>, MobileTimePickerSlotProps<TDate, TimeViewWithMeridiem> {
|
|
7
7
|
}
|
|
8
8
|
export interface TimePickerProps<TDate> extends DesktopTimePickerProps<TDate>, Omit<MobileTimePickerProps<TDate, TimeViewWithMeridiem>, 'views'> {
|
|
9
9
|
/**
|
|
@@ -16,10 +16,10 @@ export interface TimePickerProps<TDate> extends DesktopTimePickerProps<TDate>, O
|
|
|
16
16
|
* Overridable component slots.
|
|
17
17
|
* @default {}
|
|
18
18
|
*/
|
|
19
|
-
slots?:
|
|
19
|
+
slots?: TimePickerSlots<TDate>;
|
|
20
20
|
/**
|
|
21
21
|
* The props used for each component slot.
|
|
22
22
|
* @default {}
|
|
23
23
|
*/
|
|
24
|
-
slotProps?:
|
|
24
|
+
slotProps?: TimePickerSlotProps<TDate>;
|
|
25
25
|
}
|
package/TimePicker/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { TimePicker } from './TimePicker';
|
|
2
|
-
export type { TimePickerProps,
|
|
2
|
+
export type { TimePickerProps, TimePickerSlots, TimePickerSlotProps } from './TimePicker.types';
|
|
3
3
|
export { TimePickerToolbar } from './TimePickerToolbar';
|
|
4
4
|
export type { TimePickerToolbarProps } from './TimePickerToolbar';
|
|
5
5
|
export { timePickerToolbarClasses } from './timePickerToolbarClasses';
|
package/TimePicker/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DefaultizedProps } from '../internals/models/helpers';
|
|
3
|
-
import {
|
|
3
|
+
import { TimeClockSlots, TimeClockSlotProps } from '../TimeClock/TimeClock.types';
|
|
4
4
|
import { BasePickerInputProps } from '../internals/models/props/basePickerProps';
|
|
5
5
|
import { BaseTimeValidationProps } from '../internals/models/validation';
|
|
6
6
|
import { LocalizedComponent } from '../locales/utils/pickersLocaleTextApi';
|
|
@@ -10,14 +10,14 @@ import { PickerViewRendererLookup } from '../internals/hooks/usePicker/usePicker
|
|
|
10
10
|
import { TimeViewRendererProps } from '../timeViewRenderers';
|
|
11
11
|
import { BaseClockProps, ExportedBaseClockProps } from '../internals/models/props/clock';
|
|
12
12
|
import { TimeViewWithMeridiem } from '../internals/models';
|
|
13
|
-
export interface
|
|
13
|
+
export interface BaseTimePickerSlots<TDate> extends TimeClockSlots {
|
|
14
14
|
/**
|
|
15
15
|
* Custom component for the toolbar rendered above the views.
|
|
16
16
|
* @default TimePickerToolbar
|
|
17
17
|
*/
|
|
18
18
|
toolbar?: React.JSXElementConstructor<TimePickerToolbarProps<TDate>>;
|
|
19
19
|
}
|
|
20
|
-
export interface
|
|
20
|
+
export interface BaseTimePickerSlotProps extends TimeClockSlotProps {
|
|
21
21
|
toolbar?: ExportedTimePickerToolbarProps;
|
|
22
22
|
}
|
|
23
23
|
export interface BaseTimePickerProps<TDate, TView extends TimeViewWithMeridiem> extends BasePickerInputProps<TDate | null, TDate, TView, TimeValidationError>, ExportedBaseClockProps<TDate> {
|
|
@@ -30,12 +30,12 @@ export interface BaseTimePickerProps<TDate, TView extends TimeViewWithMeridiem>
|
|
|
30
30
|
* Overridable component slots.
|
|
31
31
|
* @default {}
|
|
32
32
|
*/
|
|
33
|
-
slots?:
|
|
33
|
+
slots?: BaseTimePickerSlots<TDate>;
|
|
34
34
|
/**
|
|
35
35
|
* The props used for each component slot.
|
|
36
36
|
* @default {}
|
|
37
37
|
*/
|
|
38
|
-
slotProps?:
|
|
38
|
+
slotProps?: BaseTimePickerSlotProps;
|
|
39
39
|
/**
|
|
40
40
|
* Define custom view renderers for each section.
|
|
41
41
|
* If `null`, the section will only have field editing.
|
package/hooks/index.d.ts
CHANGED
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
|
+
import MuiIconButton from '@mui/material/IconButton';
|
|
4
|
+
import { SxProps } from '@mui/system';
|
|
5
|
+
import { ClearIcon } from '../icons';
|
|
6
|
+
export interface ExportedUseClearableFieldProps {
|
|
7
|
+
clearable?: boolean;
|
|
8
|
+
onClear?: React.MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
}
|
|
10
|
+
export interface UseClearableFieldSlots {
|
|
11
|
+
/**
|
|
12
|
+
* Icon to display inside the clear button.
|
|
13
|
+
* @default ClearIcon
|
|
14
|
+
*/
|
|
15
|
+
clearIcon?: React.ElementType;
|
|
16
|
+
/**
|
|
17
|
+
* Button to clear the value.
|
|
18
|
+
* @default IconButton
|
|
19
|
+
*/
|
|
20
|
+
clearButton?: React.ElementType;
|
|
21
|
+
}
|
|
22
|
+
export interface UseClearableFieldSlotProps {
|
|
23
|
+
clearIcon?: SlotComponentProps<typeof ClearIcon, {}, {}>;
|
|
24
|
+
clearButton?: SlotComponentProps<typeof MuiIconButton, {}, {}>;
|
|
25
|
+
}
|
|
26
|
+
interface UseClearableFieldProps extends ExportedUseClearableFieldProps {
|
|
27
|
+
InputProps?: {
|
|
28
|
+
endAdornment?: React.ReactNode;
|
|
12
29
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
InputProps: TInputProps & {
|
|
19
|
-
endAdornment: string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
20
|
-
};
|
|
21
|
-
fieldProps: TFieldProps;
|
|
22
|
-
};
|
|
30
|
+
sx?: SxProps<any>;
|
|
31
|
+
slots?: UseClearableFieldSlots;
|
|
32
|
+
slotProps?: UseClearableFieldSlotProps;
|
|
33
|
+
}
|
|
34
|
+
export declare const useClearableField: <TFieldProps extends UseClearableFieldProps>(props: TFieldProps) => Omit<TFieldProps, "slotProps" | "slots" | "onClear" | "clearable">;
|
|
23
35
|
export {};
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["clearable", "onClear", "InputProps", "sx", "slots", "slotProps"],
|
|
4
|
+
_excluded2 = ["ownerState"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import { useSlotProps } from '@mui/base/utils';
|
|
6
7
|
import MuiIconButton from '@mui/material/IconButton';
|
|
7
8
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
8
9
|
import { ClearIcon } from '../icons';
|
|
9
|
-
import { useLocaleText } from '../internals';
|
|
10
|
+
import { useLocaleText } from '../internals/hooks/useUtils';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
export const useClearableField =
|
|
13
|
-
clearable,
|
|
14
|
-
fieldProps: forwardedFieldProps,
|
|
15
|
-
InputProps: ForwardedInputProps,
|
|
16
|
-
onClear,
|
|
17
|
-
slots,
|
|
18
|
-
slotProps
|
|
19
|
-
}) => {
|
|
13
|
+
export const useClearableField = props => {
|
|
20
14
|
var _slots$clearButton, _slots$clearIcon;
|
|
21
15
|
const localeText = useLocaleText();
|
|
16
|
+
const {
|
|
17
|
+
clearable,
|
|
18
|
+
onClear,
|
|
19
|
+
InputProps,
|
|
20
|
+
sx,
|
|
21
|
+
slots,
|
|
22
|
+
slotProps
|
|
23
|
+
} = props,
|
|
24
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
25
|
const IconButton = (_slots$clearButton = slots == null ? void 0 : slots.clearButton) != null ? _slots$clearButton : MuiIconButton;
|
|
23
26
|
// The spread is here to avoid this bug mui/material-ui#34056
|
|
24
27
|
const _useSlotProps = useSlotProps({
|
|
@@ -30,30 +33,30 @@ export const useClearableField = ({
|
|
|
30
33
|
title: localeText.fieldClearLabel
|
|
31
34
|
}
|
|
32
35
|
}),
|
|
33
|
-
iconButtonProps = _objectWithoutPropertiesLoose(_useSlotProps,
|
|
36
|
+
iconButtonProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
|
34
37
|
const EndClearIcon = (_slots$clearIcon = slots == null ? void 0 : slots.clearIcon) != null ? _slots$clearIcon : ClearIcon;
|
|
35
38
|
const endClearIconProps = useSlotProps({
|
|
36
39
|
elementType: EndClearIcon,
|
|
37
40
|
externalSlotProps: slotProps == null ? void 0 : slotProps.clearIcon,
|
|
38
41
|
ownerState: {}
|
|
39
42
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
return _extends({}, other, {
|
|
44
|
+
InputProps: _extends({}, InputProps, {
|
|
45
|
+
endAdornment: clearable ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
46
|
+
children: [/*#__PURE__*/_jsx(InputAdornment, {
|
|
47
|
+
position: "end",
|
|
48
|
+
sx: {
|
|
49
|
+
marginRight: InputProps != null && InputProps.endAdornment ? -1 : -1.5
|
|
50
|
+
},
|
|
51
|
+
children: /*#__PURE__*/_jsx(IconButton, _extends({}, iconButtonProps, {
|
|
52
|
+
onClick: onClear,
|
|
53
|
+
children: /*#__PURE__*/_jsx(EndClearIcon, _extends({
|
|
54
|
+
fontSize: "small"
|
|
55
|
+
}, endClearIconProps))
|
|
56
|
+
}))
|
|
57
|
+
}), InputProps == null ? void 0 : InputProps.endAdornment]
|
|
58
|
+
}) : InputProps == null ? void 0 : InputProps.endAdornment
|
|
59
|
+
}),
|
|
57
60
|
sx: [{
|
|
58
61
|
'& .clearButton': {
|
|
59
62
|
opacity: 1
|
|
@@ -68,10 +71,6 @@ export const useClearableField = ({
|
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
|
-
}, ...(Array.isArray(
|
|
74
|
+
}, ...(Array.isArray(sx) ? sx : [sx])]
|
|
72
75
|
});
|
|
73
|
-
return {
|
|
74
|
-
InputProps,
|
|
75
|
-
fieldProps
|
|
76
|
-
};
|
|
77
76
|
};
|
package/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from './PickersLayout';
|
|
|
29
29
|
export * from './PickersActionBar';
|
|
30
30
|
export * from './PickersShortcuts';
|
|
31
31
|
export * from './PickersCalendarHeader';
|
|
32
|
+
export * from './PickersSectionList';
|
|
32
33
|
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
33
34
|
export * from './models';
|
|
34
35
|
export * from './icons';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers v7.0.0-alpha.
|
|
2
|
+
* @mui/x-date-pickers v7.0.0-alpha.6
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -49,6 +49,9 @@ export * from './PickersShortcuts';
|
|
|
49
49
|
|
|
50
50
|
// Other slots
|
|
51
51
|
export * from './PickersCalendarHeader';
|
|
52
|
+
|
|
53
|
+
// Field utilities
|
|
54
|
+
export * from './PickersSectionList';
|
|
52
55
|
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
53
56
|
export * from './models';
|
|
54
57
|
export * from './icons';
|