@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
|
@@ -224,6 +224,10 @@ MobileDateTimePicker.propTypes = {
|
|
|
224
224
|
* @default 3
|
|
225
225
|
*/
|
|
226
226
|
monthsPerRow: PropTypes.oneOf([3, 4]),
|
|
227
|
+
/**
|
|
228
|
+
* Name attribute used by the `input` element in the Field.
|
|
229
|
+
*/
|
|
230
|
+
name: PropTypes.string,
|
|
227
231
|
/**
|
|
228
232
|
* Callback fired when the value is accepted.
|
|
229
233
|
* @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.
|
|
@@ -322,7 +326,7 @@ MobileDateTimePicker.propTypes = {
|
|
|
322
326
|
* 4. If `null` is provided, no section will be selected
|
|
323
327
|
* If not provided, the selected sections will be handled internally.
|
|
324
328
|
*/
|
|
325
|
-
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number, PropTypes.shape({
|
|
329
|
+
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number, PropTypes.shape({
|
|
326
330
|
endIndex: PropTypes.number.isRequired,
|
|
327
331
|
startIndex: PropTypes.number.isRequired
|
|
328
332
|
})]),
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BaseDateTimePickerProps,
|
|
1
|
+
import { UseMobilePickerSlots, ExportedUseMobilePickerSlotProps, MobileOnlyPickerProps } from '../internals/hooks/useMobilePicker';
|
|
2
|
+
import { BaseDateTimePickerProps, BaseDateTimePickerSlots, BaseDateTimePickerSlotProps } from '../DateTimePicker/shared';
|
|
3
3
|
import { MakeOptional } from '../internals/models/helpers';
|
|
4
4
|
import { DateOrTimeView } from '../models';
|
|
5
5
|
import { DateOrTimeViewWithMeridiem } from '../internals/models';
|
|
6
|
-
export interface
|
|
6
|
+
export interface MobileDateTimePickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem = DateOrTimeView> extends BaseDateTimePickerSlots<TDate>, MakeOptional<UseMobilePickerSlots<TDate, TView>, 'field'> {
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface MobileDateTimePickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem = DateOrTimeView> extends BaseDateTimePickerSlotProps<TDate>, ExportedUseMobilePickerSlotProps<TDate, TView> {
|
|
9
9
|
}
|
|
10
10
|
export interface MobileDateTimePickerProps<TDate, TView extends DateOrTimeViewWithMeridiem = DateOrTimeView> extends BaseDateTimePickerProps<TDate, TView>, MobileOnlyPickerProps<TDate> {
|
|
11
11
|
/**
|
|
12
12
|
* Overridable component slots.
|
|
13
13
|
* @default {}
|
|
14
14
|
*/
|
|
15
|
-
slots?:
|
|
15
|
+
slots?: MobileDateTimePickerSlots<TDate, TView>;
|
|
16
16
|
/**
|
|
17
17
|
* The props used for each component slot.
|
|
18
18
|
* @default {}
|
|
19
19
|
*/
|
|
20
|
-
slotProps?:
|
|
20
|
+
slotProps?: MobileDateTimePickerSlotProps<TDate, TView>;
|
|
21
21
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { MobileDateTimePicker } from './MobileDateTimePicker';
|
|
2
|
-
export type { MobileDateTimePickerProps,
|
|
2
|
+
export type { MobileDateTimePickerProps, MobileDateTimePickerSlots, MobileDateTimePickerSlotProps, } from './MobileDateTimePicker.types';
|
|
@@ -168,6 +168,10 @@ MobileTimePicker.propTypes = {
|
|
|
168
168
|
* @default 1
|
|
169
169
|
*/
|
|
170
170
|
minutesStep: PropTypes.number,
|
|
171
|
+
/**
|
|
172
|
+
* Name attribute used by the `input` element in the Field.
|
|
173
|
+
*/
|
|
174
|
+
name: PropTypes.string,
|
|
171
175
|
/**
|
|
172
176
|
* Callback fired when the value is accepted.
|
|
173
177
|
* @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.
|
|
@@ -248,7 +252,7 @@ MobileTimePicker.propTypes = {
|
|
|
248
252
|
* 4. If `null` is provided, no section will be selected
|
|
249
253
|
* If not provided, the selected sections will be handled internally.
|
|
250
254
|
*/
|
|
251
|
-
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number, PropTypes.shape({
|
|
255
|
+
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number, PropTypes.shape({
|
|
252
256
|
endIndex: PropTypes.number.isRequired,
|
|
253
257
|
startIndex: PropTypes.number.isRequired
|
|
254
258
|
})]),
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BaseTimePickerProps,
|
|
1
|
+
import { UseMobilePickerSlots, ExportedUseMobilePickerSlotProps, MobileOnlyPickerProps } from '../internals/hooks/useMobilePicker';
|
|
2
|
+
import { BaseTimePickerProps, BaseTimePickerSlots, BaseTimePickerSlotProps } from '../TimePicker/shared';
|
|
3
3
|
import { MakeOptional } from '../internals/models/helpers';
|
|
4
4
|
import { TimeView } from '../models';
|
|
5
5
|
import { TimeViewWithMeridiem } from '../internals/models';
|
|
6
|
-
export interface
|
|
6
|
+
export interface MobileTimePickerSlots<TDate, TView extends TimeViewWithMeridiem = TimeView> extends BaseTimePickerSlots<TDate>, MakeOptional<UseMobilePickerSlots<TDate, TView>, 'field'> {
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface MobileTimePickerSlotProps<TDate, TView extends TimeViewWithMeridiem = TimeView> extends BaseTimePickerSlotProps, ExportedUseMobilePickerSlotProps<TDate, TView> {
|
|
9
9
|
}
|
|
10
10
|
export interface MobileTimePickerProps<TDate, TView extends TimeViewWithMeridiem = TimeView> extends BaseTimePickerProps<TDate, TView>, MobileOnlyPickerProps<TDate> {
|
|
11
11
|
/**
|
|
12
12
|
* Overridable component slots.
|
|
13
13
|
* @default {}
|
|
14
14
|
*/
|
|
15
|
-
slots?:
|
|
15
|
+
slots?: MobileTimePickerSlots<TDate, TView>;
|
|
16
16
|
/**
|
|
17
17
|
* The props used for each component slot.
|
|
18
18
|
* @default {}
|
|
19
19
|
*/
|
|
20
|
-
slotProps?:
|
|
20
|
+
slotProps?: MobileTimePickerSlotProps<TDate, TView>;
|
|
21
21
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { MobileTimePicker } from './MobileTimePicker';
|
|
2
|
-
export type { MobileTimePickerProps,
|
|
2
|
+
export type { MobileTimePickerProps, MobileTimePickerSlots, MobileTimePickerSlotProps, } from './MobileTimePicker.types';
|
|
@@ -17,14 +17,14 @@ export interface ExportedMultiSectionDigitalClockProps<TDate> extends ExportedBa
|
|
|
17
17
|
}
|
|
18
18
|
export interface MultiSectionDigitalClockViewProps<TValue> extends Pick<MultiSectionDigitalClockSectionProps<TValue>, 'onChange' | 'items'> {
|
|
19
19
|
}
|
|
20
|
-
export interface
|
|
20
|
+
export interface MultiSectionDigitalClockSlots {
|
|
21
21
|
/**
|
|
22
22
|
* Component responsible for rendering a single multi section digital clock section item.
|
|
23
23
|
* @default MenuItem from '@mui/material'
|
|
24
24
|
*/
|
|
25
25
|
digitalClockSectionItem?: React.ElementType;
|
|
26
26
|
}
|
|
27
|
-
export interface
|
|
27
|
+
export interface MultiSectionDigitalClockSlotProps {
|
|
28
28
|
digitalClockSectionItem?: SlotComponentProps<typeof MenuItem, {}, Record<string, any>>;
|
|
29
29
|
}
|
|
30
30
|
export interface MultiSectionDigitalClockProps<TDate> extends ExportedMultiSectionDigitalClockProps<TDate>, BaseClockProps<TDate, TimeViewWithMeridiem> {
|
|
@@ -36,10 +36,10 @@ export interface MultiSectionDigitalClockProps<TDate> extends ExportedMultiSecti
|
|
|
36
36
|
* Overrideable component slots.
|
|
37
37
|
* @default {}
|
|
38
38
|
*/
|
|
39
|
-
slots?:
|
|
39
|
+
slots?: MultiSectionDigitalClockSlots;
|
|
40
40
|
/**
|
|
41
41
|
* The props used for each component slot.
|
|
42
42
|
* @default {}
|
|
43
43
|
*/
|
|
44
|
-
slotProps?:
|
|
44
|
+
slotProps?: MultiSectionDigitalClockSlotProps;
|
|
45
45
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MultiSectionDigitalClockSectionClasses } from './multiSectionDigitalClockSectionClasses';
|
|
3
|
-
import type { MultiSectionDigitalClockOption,
|
|
3
|
+
import type { MultiSectionDigitalClockOption, MultiSectionDigitalClockSlots, MultiSectionDigitalClockSlotProps } from './MultiSectionDigitalClock.types';
|
|
4
4
|
export interface ExportedMultiSectionDigitalClockSectionProps {
|
|
5
5
|
className?: string;
|
|
6
6
|
classes?: Partial<MultiSectionDigitalClockSectionClasses>;
|
|
7
|
-
slots?:
|
|
8
|
-
slotProps?:
|
|
7
|
+
slots?: MultiSectionDigitalClockSlots;
|
|
8
|
+
slotProps?: MultiSectionDigitalClockSlotProps;
|
|
9
9
|
}
|
|
10
10
|
export interface MultiSectionDigitalClockSectionProps<TValue> extends ExportedMultiSectionDigitalClockSectionProps {
|
|
11
11
|
autoFocus?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { MultiSectionDigitalClock } from './MultiSectionDigitalClock';
|
|
2
|
-
export type { MultiSectionDigitalClockProps,
|
|
2
|
+
export type { MultiSectionDigitalClockProps, MultiSectionDigitalClockSlots, MultiSectionDigitalClockSlotProps, } from './MultiSectionDigitalClock.types';
|
|
3
3
|
export { multiSectionDigitalClockSectionClasses } from './multiSectionDigitalClockSectionClasses';
|
|
4
4
|
export type { MultiSectionDigitalClockSectionClasses, MultiSectionDigitalClockSectionClassKey, } from './multiSectionDigitalClockSectionClasses';
|
|
5
5
|
export type { ExportedMultiSectionDigitalClockSectionProps } from './MultiSectionDigitalClockSection';
|
|
@@ -3,12 +3,12 @@ import { SlotComponentProps } from '@mui/base/utils';
|
|
|
3
3
|
import IconButton from '@mui/material/IconButton';
|
|
4
4
|
import SvgIcon from '@mui/material/SvgIcon';
|
|
5
5
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
6
|
-
import { ExportedPickersArrowSwitcherProps,
|
|
6
|
+
import { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps } from '../internals/components/PickersArrowSwitcher';
|
|
7
7
|
import { MonthValidationOptions } from '../internals/hooks/date-helpers-hooks';
|
|
8
8
|
import { DateView } from '../models/views';
|
|
9
9
|
import { SlideDirection } from '../DateCalendar/PickersSlideTransition';
|
|
10
10
|
import { PickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
|
|
11
|
-
export interface
|
|
11
|
+
export interface PickersCalendarHeaderSlots extends PickersArrowSwitcherSlots {
|
|
12
12
|
/**
|
|
13
13
|
* Button displayed to switch between different calendar views.
|
|
14
14
|
* @default IconButton
|
|
@@ -20,24 +20,24 @@ export interface PickersCalendarHeaderSlotsComponent extends PickersArrowSwitche
|
|
|
20
20
|
*/
|
|
21
21
|
switchViewIcon?: React.ElementType;
|
|
22
22
|
}
|
|
23
|
-
export interface
|
|
23
|
+
export interface PickersCalendarHeaderSlotPropsOverrides {
|
|
24
24
|
}
|
|
25
25
|
export type PickersCalendarHeaderOwnerState<TDate> = PickersCalendarHeaderProps<TDate>;
|
|
26
|
-
export interface
|
|
27
|
-
switchViewButton?: SlotComponentProps<typeof IconButton,
|
|
28
|
-
switchViewIcon?: SlotComponentProps<typeof SvgIcon,
|
|
26
|
+
export interface PickersCalendarHeaderSlotProps<TDate> extends PickersArrowSwitcherSlotProps {
|
|
27
|
+
switchViewButton?: SlotComponentProps<typeof IconButton, PickersCalendarHeaderSlotPropsOverrides, PickersCalendarHeaderOwnerState<TDate>>;
|
|
28
|
+
switchViewIcon?: SlotComponentProps<typeof SvgIcon, PickersCalendarHeaderSlotPropsOverrides, undefined>;
|
|
29
29
|
}
|
|
30
30
|
export interface PickersCalendarHeaderProps<TDate> extends ExportedPickersArrowSwitcherProps, MonthValidationOptions<TDate> {
|
|
31
31
|
/**
|
|
32
32
|
* Overridable component slots.
|
|
33
33
|
* @default {}
|
|
34
34
|
*/
|
|
35
|
-
slots?:
|
|
35
|
+
slots?: PickersCalendarHeaderSlots;
|
|
36
36
|
/**
|
|
37
37
|
* The props used for each component slot.
|
|
38
38
|
* @default {}
|
|
39
39
|
*/
|
|
40
|
-
slotProps?:
|
|
40
|
+
slotProps?: PickersCalendarHeaderSlotProps<TDate>;
|
|
41
41
|
currentMonth: TDate;
|
|
42
42
|
disabled?: boolean;
|
|
43
43
|
views: readonly DateView[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { pickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
|
|
2
2
|
export type { PickersCalendarHeaderClassKey, PickersCalendarHeaderClasses, } from './pickersCalendarHeaderClasses';
|
|
3
3
|
export { PickersCalendarHeader } from './PickersCalendarHeader';
|
|
4
|
-
export type { PickersCalendarHeaderProps,
|
|
4
|
+
export type { PickersCalendarHeaderProps, PickersCalendarHeaderSlots, PickersCalendarHeaderSlotProps, ExportedPickersCalendarHeaderProps, } from './PickersCalendarHeader.types';
|
|
@@ -8,7 +8,7 @@ import { UsePickerLayoutPropsResponseLayoutProps } from '../internals/hooks/useP
|
|
|
8
8
|
import { PickersLayoutClasses } from './pickersLayoutClasses';
|
|
9
9
|
import { DateOrTimeViewWithMeridiem, WrapperVariant } from '../internals/models/common';
|
|
10
10
|
import { PickersShortcutsProps } from '../PickersShortcuts';
|
|
11
|
-
export interface
|
|
11
|
+
export interface ExportedPickersLayoutSlots<TValue, TDate, TView extends DateOrTimeViewWithMeridiem> {
|
|
12
12
|
/**
|
|
13
13
|
* Custom component for the action bar, it is placed below the picker views.
|
|
14
14
|
* @default PickersActionBar
|
|
@@ -31,7 +31,7 @@ interface PickersLayoutActionBarOwnerState<TValue, TDate, TView extends DateOrTi
|
|
|
31
31
|
interface PickersShortcutsOwnerState<TValue> extends PickersShortcutsProps<TValue> {
|
|
32
32
|
wrapperVariant: WrapperVariant;
|
|
33
33
|
}
|
|
34
|
-
export interface
|
|
34
|
+
export interface ExportedPickersLayoutSlotProps<TValue, TDate, TView extends DateOrTimeViewWithMeridiem> {
|
|
35
35
|
/**
|
|
36
36
|
* Props passed down to the action bar component.
|
|
37
37
|
*/
|
|
@@ -45,7 +45,7 @@ export interface ExportedPickersLayoutSlotsComponentsProps<TValue, TDate, TView
|
|
|
45
45
|
*/
|
|
46
46
|
layout?: Partial<PickersLayoutProps<TValue, TDate, TView>>;
|
|
47
47
|
}
|
|
48
|
-
export interface
|
|
48
|
+
export interface PickersLayoutSlots<TValue, TDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<TValue, TDate, TView> {
|
|
49
49
|
/**
|
|
50
50
|
* Tabs enabling toggling between views.
|
|
51
51
|
*/
|
|
@@ -56,7 +56,7 @@ export interface PickersLayoutSlotsComponent<TValue, TDate, TView extends DateOr
|
|
|
56
56
|
*/
|
|
57
57
|
toolbar?: React.JSXElementConstructor<BaseToolbarProps<TValue, TView>>;
|
|
58
58
|
}
|
|
59
|
-
export interface
|
|
59
|
+
export interface PickersLayoutSlotProps<TValue, TDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<TValue, TDate, TView> {
|
|
60
60
|
/**
|
|
61
61
|
* Props passed down to the tabs component.
|
|
62
62
|
*/
|
|
@@ -80,12 +80,12 @@ export interface PickersLayoutProps<TValue, TDate, TView extends DateOrTimeViewW
|
|
|
80
80
|
* Overridable component slots.
|
|
81
81
|
* @default {}
|
|
82
82
|
*/
|
|
83
|
-
slots?:
|
|
83
|
+
slots?: PickersLayoutSlots<TValue, TDate, TView>;
|
|
84
84
|
/**
|
|
85
85
|
* The props used for each component slot.
|
|
86
86
|
* @default {}
|
|
87
87
|
*/
|
|
88
|
-
slotProps?:
|
|
88
|
+
slotProps?: PickersLayoutSlotProps<TValue, TDate, TView>;
|
|
89
89
|
}
|
|
90
90
|
export interface SubComponents {
|
|
91
91
|
toolbar: React.ReactNode;
|
package/PickersLayout/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { PickersLayout, PickersLayoutRoot, PickersLayoutContentWrapper } from './PickersLayout';
|
|
2
|
-
export type { PickersLayoutProps,
|
|
2
|
+
export type { PickersLayoutProps, PickersLayoutSlots, PickersLayoutSlotProps, ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, } from './PickersLayout.types';
|
|
3
3
|
export { default as usePickerLayout } from './usePickerLayout';
|
|
4
4
|
export { pickersLayoutClasses } from './pickersLayoutClasses';
|
|
5
5
|
export type { PickersLayoutClassKey } from './pickersLayoutClasses';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PickersSectionListProps } from './PickersSectionList.types';
|
|
3
|
+
export declare const PickersSectionListRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
4
|
+
export declare const PickersSectionListSection: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof React.ClassAttributes<HTMLSpanElement> | keyof React.HTMLAttributes<HTMLSpanElement>>, {}>;
|
|
5
|
+
export declare const PickersSectionListSectionSeparator: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof React.ClassAttributes<HTMLSpanElement> | keyof React.HTMLAttributes<HTMLSpanElement>>, {}>;
|
|
6
|
+
export declare const PickersSectionListSectionContent: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof React.ClassAttributes<HTMLSpanElement> | keyof React.HTMLAttributes<HTMLSpanElement>>, {}>;
|
|
7
|
+
type PickersSectionListComponent = ((props: PickersSectionListProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
8
|
+
propTypes?: any;
|
|
9
|
+
};
|
|
10
|
+
declare const PickersSectionList: PickersSectionListComponent;
|
|
11
|
+
export { PickersSectionList };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["slots", "slotProps", "elements", "sectionListRef"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import styled from '@mui/system/styled';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
8
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
10
|
+
import { getPickersSectionListUtilityClass, pickersSectionListClasses } from './pickersSectionListClasses';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export const PickersSectionListRoot = styled('div', {
|
|
14
|
+
name: 'MuiPickersSectionList',
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: (props, styles) => styles.root
|
|
17
|
+
})({
|
|
18
|
+
direction: 'ltr /*! @noflip */',
|
|
19
|
+
outline: 'none'
|
|
20
|
+
});
|
|
21
|
+
export const PickersSectionListSection = styled('span', {
|
|
22
|
+
name: 'MuiPickersSectionList',
|
|
23
|
+
slot: 'Section',
|
|
24
|
+
overridesResolver: (props, styles) => styles.section
|
|
25
|
+
})({});
|
|
26
|
+
export const PickersSectionListSectionSeparator = styled('span', {
|
|
27
|
+
name: 'MuiPickersSectionList',
|
|
28
|
+
slot: 'SectionSeparator',
|
|
29
|
+
overridesResolver: (props, styles) => styles.sectionSeparator
|
|
30
|
+
})({
|
|
31
|
+
whiteSpace: 'pre'
|
|
32
|
+
});
|
|
33
|
+
export const PickersSectionListSectionContent = styled('span', {
|
|
34
|
+
name: 'MuiPickersSectionList',
|
|
35
|
+
slot: 'SectionContent',
|
|
36
|
+
overridesResolver: (props, styles) => styles.sectionContent
|
|
37
|
+
})({
|
|
38
|
+
outline: 'none'
|
|
39
|
+
});
|
|
40
|
+
const useUtilityClasses = ownerState => {
|
|
41
|
+
const {
|
|
42
|
+
classes
|
|
43
|
+
} = ownerState;
|
|
44
|
+
const slots = {
|
|
45
|
+
root: ['root'],
|
|
46
|
+
section: ['section'],
|
|
47
|
+
sectionContent: ['sectionContent']
|
|
48
|
+
};
|
|
49
|
+
return composeClasses(slots, getPickersSectionListUtilityClass, classes);
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Demos:
|
|
53
|
+
*
|
|
54
|
+
* - [Custom field](https://mui.com/x/react-date-pickers/custom-field/)
|
|
55
|
+
*
|
|
56
|
+
* API:
|
|
57
|
+
*
|
|
58
|
+
* - [PickersSectionList API](https://mui.com/x/api/date-pickers/pickers-section-list/)
|
|
59
|
+
*/
|
|
60
|
+
function PickersSection(props) {
|
|
61
|
+
var _slots$section, _slots$sectionContent, _slots$sectionSeparat;
|
|
62
|
+
const {
|
|
63
|
+
slots,
|
|
64
|
+
slotProps,
|
|
65
|
+
element,
|
|
66
|
+
classes
|
|
67
|
+
} = props;
|
|
68
|
+
const Section = (_slots$section = slots == null ? void 0 : slots.section) != null ? _slots$section : PickersSectionListSection;
|
|
69
|
+
const sectionProps = useSlotProps({
|
|
70
|
+
elementType: Section,
|
|
71
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.section,
|
|
72
|
+
externalForwardedProps: element.container,
|
|
73
|
+
className: classes.section,
|
|
74
|
+
ownerState: {}
|
|
75
|
+
});
|
|
76
|
+
const SectionContent = (_slots$sectionContent = slots == null ? void 0 : slots.sectionContent) != null ? _slots$sectionContent : PickersSectionListSectionContent;
|
|
77
|
+
const sectionContentProps = useSlotProps({
|
|
78
|
+
elementType: SectionContent,
|
|
79
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.sectionContent,
|
|
80
|
+
externalForwardedProps: element.content,
|
|
81
|
+
additionalProps: {
|
|
82
|
+
suppressContentEditableWarning: true
|
|
83
|
+
},
|
|
84
|
+
className: classes.sectionContent,
|
|
85
|
+
ownerState: {}
|
|
86
|
+
});
|
|
87
|
+
const SectionSeparator = (_slots$sectionSeparat = slots == null ? void 0 : slots.sectionSeparator) != null ? _slots$sectionSeparat : PickersSectionListSectionSeparator;
|
|
88
|
+
const sectionSeparatorBeforeProps = useSlotProps({
|
|
89
|
+
elementType: SectionSeparator,
|
|
90
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.sectionSeparator,
|
|
91
|
+
externalForwardedProps: element.before,
|
|
92
|
+
ownerState: {
|
|
93
|
+
position: 'before'
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const sectionSeparatorAfterProps = useSlotProps({
|
|
97
|
+
elementType: SectionSeparator,
|
|
98
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.sectionSeparator,
|
|
99
|
+
externalForwardedProps: element.after,
|
|
100
|
+
ownerState: {
|
|
101
|
+
position: 'after'
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return /*#__PURE__*/_jsxs(Section, _extends({}, sectionProps, {
|
|
105
|
+
children: [/*#__PURE__*/_jsx(SectionSeparator, _extends({}, sectionSeparatorBeforeProps)), /*#__PURE__*/_jsx(SectionContent, _extends({}, sectionContentProps)), /*#__PURE__*/_jsx(SectionSeparator, _extends({}, sectionSeparatorAfterProps))]
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
const PickersSectionList = /*#__PURE__*/React.forwardRef(function PickersSectionList(props, ref) {
|
|
109
|
+
var _slots$root;
|
|
110
|
+
const {
|
|
111
|
+
slots,
|
|
112
|
+
slotProps,
|
|
113
|
+
elements,
|
|
114
|
+
sectionListRef
|
|
115
|
+
} = props,
|
|
116
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
117
|
+
const classes = useUtilityClasses(props);
|
|
118
|
+
const rootRef = React.useRef(null);
|
|
119
|
+
const handleRootRef = useForkRef(ref, rootRef);
|
|
120
|
+
const getRoot = methodName => {
|
|
121
|
+
if (!rootRef.current) {
|
|
122
|
+
throw new Error(`MUI: Cannot call sectionListRef.${methodName} before the mount of the component`);
|
|
123
|
+
}
|
|
124
|
+
return rootRef.current;
|
|
125
|
+
};
|
|
126
|
+
React.useImperativeHandle(sectionListRef, () => ({
|
|
127
|
+
getRoot() {
|
|
128
|
+
return getRoot('getRoot');
|
|
129
|
+
},
|
|
130
|
+
getSectionContainer(index) {
|
|
131
|
+
const root = getRoot('getSectionContainer');
|
|
132
|
+
return root.querySelector(`.${pickersSectionListClasses.section}[data-sectionindex="${index}"]`);
|
|
133
|
+
},
|
|
134
|
+
getSectionContent(index) {
|
|
135
|
+
const root = getRoot('getSectionContent');
|
|
136
|
+
return root.querySelector(`.${pickersSectionListClasses.section}[data-sectionindex="${index}"] .${pickersSectionListClasses.sectionContent}`);
|
|
137
|
+
},
|
|
138
|
+
getSectionIndexFromDOMElement(element) {
|
|
139
|
+
const root = getRoot('getSectionIndexFromDOMElement');
|
|
140
|
+
if (element == null || !root.contains(element)) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
let sectionContainer = null;
|
|
144
|
+
if (element.classList.contains(pickersSectionListClasses.section)) {
|
|
145
|
+
sectionContainer = element;
|
|
146
|
+
} else if (element.classList.contains(pickersSectionListClasses.sectionContent)) {
|
|
147
|
+
sectionContainer = element.parentElement;
|
|
148
|
+
}
|
|
149
|
+
if (sectionContainer == null) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
return Number(sectionContainer.dataset.sectionindex);
|
|
153
|
+
}
|
|
154
|
+
}));
|
|
155
|
+
const Root = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : PickersSectionListRoot;
|
|
156
|
+
const rootProps = useSlotProps({
|
|
157
|
+
elementType: Root,
|
|
158
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.root,
|
|
159
|
+
externalForwardedProps: other,
|
|
160
|
+
additionalProps: {
|
|
161
|
+
ref: handleRootRef,
|
|
162
|
+
suppressContentEditableWarning: true
|
|
163
|
+
},
|
|
164
|
+
className: classes.root,
|
|
165
|
+
ownerState: {}
|
|
166
|
+
});
|
|
167
|
+
return /*#__PURE__*/_jsx(Root, _extends({}, rootProps, {
|
|
168
|
+
children: rootProps.contentEditable ? elements.map(({
|
|
169
|
+
content,
|
|
170
|
+
before,
|
|
171
|
+
after
|
|
172
|
+
}) => `${before.children}${content.children}${after.children}`).join('') : /*#__PURE__*/_jsx(React.Fragment, {
|
|
173
|
+
children: elements.map((element, elementIndex) => /*#__PURE__*/_jsx(PickersSection, {
|
|
174
|
+
slots: slots,
|
|
175
|
+
slotProps: slotProps,
|
|
176
|
+
element: element,
|
|
177
|
+
classes: classes
|
|
178
|
+
}, elementIndex))
|
|
179
|
+
})
|
|
180
|
+
}));
|
|
181
|
+
});
|
|
182
|
+
process.env.NODE_ENV !== "production" ? PickersSectionList.propTypes = {
|
|
183
|
+
// ----------------------------- Warning --------------------------------
|
|
184
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
185
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
186
|
+
// ----------------------------------------------------------------------
|
|
187
|
+
/**
|
|
188
|
+
* Override or extend the styles applied to the component.
|
|
189
|
+
*/
|
|
190
|
+
classes: PropTypes.object,
|
|
191
|
+
/**
|
|
192
|
+
* If true, the whole element is editable.
|
|
193
|
+
* Useful when all the sections are selected.
|
|
194
|
+
*/
|
|
195
|
+
contentEditable: PropTypes.bool.isRequired,
|
|
196
|
+
/**
|
|
197
|
+
* The elements to render.
|
|
198
|
+
* Each element contains the prop to edit a section of the value.
|
|
199
|
+
*/
|
|
200
|
+
elements: PropTypes.arrayOf(PropTypes.shape({
|
|
201
|
+
after: PropTypes.object.isRequired,
|
|
202
|
+
before: PropTypes.object.isRequired,
|
|
203
|
+
container: PropTypes.object.isRequired,
|
|
204
|
+
content: PropTypes.object.isRequired
|
|
205
|
+
})).isRequired,
|
|
206
|
+
sectionListRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
207
|
+
current: PropTypes.shape({
|
|
208
|
+
getRoot: PropTypes.func.isRequired,
|
|
209
|
+
getSectionContainer: PropTypes.func.isRequired,
|
|
210
|
+
getSectionContent: PropTypes.func.isRequired,
|
|
211
|
+
getSectionIndexFromDOMElement: PropTypes.func.isRequired
|
|
212
|
+
})
|
|
213
|
+
})]),
|
|
214
|
+
/**
|
|
215
|
+
* The props used for each component slot.
|
|
216
|
+
*/
|
|
217
|
+
slotProps: PropTypes.object,
|
|
218
|
+
/**
|
|
219
|
+
* Overridable component slots.
|
|
220
|
+
*/
|
|
221
|
+
slots: PropTypes.object
|
|
222
|
+
} : void 0;
|
|
223
|
+
export { PickersSectionList };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
|
+
import { PickersSectionListClasses } from './pickersSectionListClasses';
|
|
4
|
+
export interface PickersSectionListSlots {
|
|
5
|
+
root: React.ElementType;
|
|
6
|
+
section: React.ElementType;
|
|
7
|
+
sectionSeparator: React.ElementType;
|
|
8
|
+
sectionContent: React.ElementType;
|
|
9
|
+
}
|
|
10
|
+
export interface PickersSectionListSlotProps {
|
|
11
|
+
root?: SlotComponentProps<'div', {}, {}>;
|
|
12
|
+
section?: SlotComponentProps<'span', {}, {}>;
|
|
13
|
+
sectionSeparator?: SlotComponentProps<'span', {}, {
|
|
14
|
+
position: 'before' | 'after';
|
|
15
|
+
}>;
|
|
16
|
+
sectionContent?: SlotComponentProps<'span', {}, {}>;
|
|
17
|
+
}
|
|
18
|
+
export interface PickersSectionElement {
|
|
19
|
+
container: React.HTMLAttributes<HTMLSpanElement>;
|
|
20
|
+
content: React.HTMLAttributes<HTMLSpanElement>;
|
|
21
|
+
before: React.HTMLAttributes<HTMLSpanElement>;
|
|
22
|
+
after: React.HTMLAttributes<HTMLSpanElement>;
|
|
23
|
+
}
|
|
24
|
+
export interface PickersSectionListRef {
|
|
25
|
+
getRoot: () => HTMLElement;
|
|
26
|
+
getSectionContainer: (sectionIndex: number) => HTMLElement;
|
|
27
|
+
getSectionContent: (sectionIndex: number) => HTMLElement;
|
|
28
|
+
getSectionIndexFromDOMElement: (element: Element | null | undefined) => number | null;
|
|
29
|
+
}
|
|
30
|
+
export interface ExportedPickersSectionListProps extends Pick<React.HTMLAttributes<HTMLDivElement>, 'tabIndex'> {
|
|
31
|
+
/**
|
|
32
|
+
* The elements to render.
|
|
33
|
+
* Each element contains the prop to edit a section of the value.
|
|
34
|
+
*/
|
|
35
|
+
elements: PickersSectionElement[];
|
|
36
|
+
sectionListRef: React.Ref<PickersSectionListRef>;
|
|
37
|
+
/**
|
|
38
|
+
* If true, the whole element is editable.
|
|
39
|
+
* Useful when all the sections are selected.
|
|
40
|
+
*/
|
|
41
|
+
contentEditable: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface PickersSectionListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'contentEditable'>, ExportedPickersSectionListProps {
|
|
44
|
+
/**
|
|
45
|
+
* Overridable component slots.
|
|
46
|
+
*/
|
|
47
|
+
slots?: PickersSectionListSlots;
|
|
48
|
+
/**
|
|
49
|
+
* The props used for each component slot.
|
|
50
|
+
*/
|
|
51
|
+
slotProps?: PickersSectionListSlotProps;
|
|
52
|
+
/**
|
|
53
|
+
* Override or extend the styles applied to the component.
|
|
54
|
+
*/
|
|
55
|
+
classes?: Partial<PickersSectionListClasses>;
|
|
56
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { PickersSectionList as Unstable_PickersSectionList, PickersSectionListRoot as Unstable_PickersSectionListRoot, PickersSectionListSection as Unstable_PickersSectionListSection, PickersSectionListSectionSeparator as Unstable_PickersSectionListSectionSeparator, PickersSectionListSectionContent as Unstable_PickersSectionListSectionContent, } from './PickersSectionList';
|
|
2
|
+
export type { PickersSectionListProps, PickersSectionElement, PickersSectionListRef, PickersSectionListSlots, PickersSectionListSlotProps, ExportedPickersSectionListProps, } from './PickersSectionList.types';
|
|
3
|
+
export { getPickersSectionListUtilityClass, pickersSectionListClasses, } from './pickersSectionListClasses';
|
|
4
|
+
export type { PickersSectionListClasses, PickersSectionListClassKey, } from './pickersSectionListClasses';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { PickersSectionList as Unstable_PickersSectionList, PickersSectionListRoot as Unstable_PickersSectionListRoot, PickersSectionListSection as Unstable_PickersSectionListSection, PickersSectionListSectionSeparator as Unstable_PickersSectionListSectionSeparator, PickersSectionListSectionContent as Unstable_PickersSectionListSectionContent } from './PickersSectionList';
|
|
2
|
+
export { getPickersSectionListUtilityClass, pickersSectionListClasses } from './pickersSectionListClasses';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface PickersSectionListClasses {
|
|
2
|
+
/** Styles applied to the root element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the container of a section. */
|
|
5
|
+
section: string;
|
|
6
|
+
/** Styles applied to the content of a section. */
|
|
7
|
+
sectionContent: string;
|
|
8
|
+
}
|
|
9
|
+
export type PickersSectionListClassKey = keyof PickersSectionListClasses;
|
|
10
|
+
export declare function getPickersSectionListUtilityClass(slot: string): string;
|
|
11
|
+
export declare const pickersSectionListClasses: Record<keyof PickersSectionListClasses, string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
+
export function getPickersSectionListUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiPickersSectionList', slot);
|
|
5
|
+
}
|
|
6
|
+
export const pickersSectionListClasses = generateUtilityClasses('MuiPickersSectionList', ['root', 'section', 'sectionContent']);
|
|
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import { useDatePickerDefaultizedProps } from '../DatePicker/shared';
|
|
5
5
|
import { renderDateViewCalendar } from '../dateViewRenderers';
|
|
6
6
|
import { useStaticPicker } from '../internals/hooks/useStaticPicker';
|
|
7
|
-
import { validateDate } from '../internals';
|
|
7
|
+
import { validateDate } from '../internals/utils/validation/validateDate';
|
|
8
8
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
9
9
|
/**
|
|
10
10
|
* Demos:
|