@mui/lab 5.0.0-alpha.75 → 5.0.0-alpha.78
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/AdapterDateFns/index.d.ts +1 -1
- package/AdapterDateFns/index.js +1 -1
- package/AdapterDayjs/index.d.ts +1 -1
- package/AdapterDayjs/index.js +1 -1
- package/AdapterLuxon/index.d.ts +1 -1
- package/AdapterLuxon/index.js +1 -1
- package/AdapterMoment/index.d.ts +1 -1
- package/AdapterMoment/index.js +1 -1
- package/CHANGELOG.md +210 -32
- package/CalendarPicker/index.d.ts +2 -5
- package/CalendarPicker/index.js +1 -1
- package/CalendarPickerSkeleton/index.d.ts +2 -3
- package/CalendarPickerSkeleton/index.js +1 -1
- package/ClockPicker/index.d.ts +2 -5
- package/ClockPicker/index.js +1 -2
- package/DatePicker/index.d.ts +2 -2
- package/DatePicker/index.js +1 -2
- package/DateRangePicker/DateRangePicker.d.ts +11 -65
- package/DateRangePicker/DateRangePicker.js +14 -512
- package/DateRangePicker/index.d.ts +2 -3
- package/DateRangePicker/index.js +2 -2
- package/DateRangePickerDay/DateRangePickerDay.d.ts +13 -79
- package/DateRangePickerDay/DateRangePickerDay.js +17 -240
- package/DateRangePickerDay/index.d.ts +2 -2
- package/DateRangePickerDay/index.js +2 -2
- package/DateTimePicker/index.d.ts +2 -2
- package/DateTimePicker/index.js +1 -2
- package/DesktopDatePicker/index.d.ts +2 -2
- package/DesktopDatePicker/index.js +1 -2
- package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +10 -64
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +13 -477
- package/DesktopDateRangePicker/index.d.ts +2 -2
- package/DesktopDateRangePicker/index.js +2 -2
- package/DesktopDateTimePicker/index.d.ts +2 -2
- package/DesktopDateTimePicker/index.js +1 -2
- package/DesktopTimePicker/index.d.ts +2 -2
- package/DesktopTimePicker/index.js +1 -2
- package/LoadingButton/LoadingButton.d.ts +3 -3
- package/LoadingButton/loadingButtonClasses.d.ts +22 -22
- package/LocalizationProvider/index.d.ts +2 -2
- package/LocalizationProvider/index.js +1 -2
- package/Masonry/Masonry.d.ts +2 -2
- package/Masonry/masonryClasses.d.ts +8 -8
- package/MobileDatePicker/index.d.ts +2 -2
- package/MobileDatePicker/index.js +1 -2
- package/MobileDateRangePicker/MobileDateRangePicker.d.ts +10 -64
- package/MobileDateRangePicker/MobileDateRangePicker.js +13 -487
- package/MobileDateRangePicker/index.d.ts +2 -2
- package/MobileDateRangePicker/index.js +2 -2
- package/MobileDateTimePicker/index.d.ts +2 -2
- package/MobileDateTimePicker/index.js +1 -2
- package/MobileTimePicker/index.d.ts +2 -2
- package/MobileTimePicker/index.js +1 -2
- package/MonthPicker/index.d.ts +2 -3
- package/MonthPicker/index.js +1 -1
- package/PickersDay/index.d.ts +2 -4
- package/PickersDay/index.js +1 -2
- package/StaticDatePicker/index.d.ts +2 -2
- package/StaticDatePicker/index.js +1 -2
- package/StaticDateRangePicker/StaticDateRangePicker.d.ts +10 -67
- package/StaticDateRangePicker/StaticDateRangePicker.js +13 -443
- package/StaticDateRangePicker/index.d.ts +2 -2
- package/StaticDateRangePicker/index.js +2 -2
- package/StaticDateTimePicker/index.d.ts +2 -2
- package/StaticDateTimePicker/index.js +1 -2
- package/StaticTimePicker/index.d.ts +2 -2
- package/StaticTimePicker/index.js +1 -2
- package/TabContext/TabContext.d.ts +2 -2
- package/TabList/TabList.d.ts +3 -3
- package/TabPanel/TabPanel.d.ts +2 -2
- package/TabPanel/tabPanelClasses.d.ts +8 -8
- package/TimePicker/index.d.ts +2 -2
- package/TimePicker/index.js +1 -2
- package/Timeline/Timeline.d.ts +59 -59
- package/Timeline/Timeline.js +2 -2
- package/Timeline/TimelineContext.d.ts +6 -6
- package/Timeline/index.d.ts +5 -5
- package/Timeline/timelineClasses.d.ts +3 -3
- package/TimelineConnector/TimelineConnector.d.ts +2 -2
- package/TimelineConnector/timelineConnectorClasses.d.ts +8 -8
- package/TimelineContent/TimelineContent.d.ts +3 -3
- package/TimelineContent/timelineContentClasses.d.ts +14 -14
- package/TimelineDot/TimelineDot.d.ts +2 -2
- package/TimelineDot/timelineDotClasses.d.ts +24 -24
- package/TimelineItem/TimelineItem.d.ts +2 -2
- package/TimelineItem/timelineItemClasses.d.ts +16 -16
- package/TimelineOppositeContent/TimelineOppositeContent.d.ts +3 -3
- package/TimelineOppositeContent/timelineOppositeContentClasses.d.ts +14 -14
- package/TimelineSeparator/TimelineSeparator.d.ts +2 -2
- package/TimelineSeparator/timelineSeparatorClasses.d.ts +8 -8
- package/TreeItem/TreeItem.d.ts +3 -3
- package/TreeItem/TreeItem.js +1 -1
- package/TreeItem/treeItemClasses.d.ts +24 -24
- package/TreeView/TreeView.d.ts +2 -2
- package/TreeView/treeViewClasses.d.ts +8 -8
- package/YearPicker/index.d.ts +2 -5
- package/YearPicker/index.js +1 -3
- package/index.js +1 -1
- package/internal/svg-icons/ArrowDropDown.d.ts +7 -7
- package/internal/svg-icons/ArrowLeft.d.ts +7 -7
- package/internal/svg-icons/ArrowRight.d.ts +7 -7
- package/internal/svg-icons/Calendar.d.ts +7 -7
- package/internal/svg-icons/Clock.d.ts +7 -7
- package/internal/svg-icons/DateRange.d.ts +7 -7
- package/internal/svg-icons/Pen.d.ts +7 -7
- package/internal/svg-icons/Time.d.ts +7 -7
- package/legacy/AdapterDateFns/index.js +1 -1
- package/legacy/AdapterDayjs/index.js +1 -1
- package/legacy/AdapterLuxon/index.js +1 -1
- package/legacy/AdapterMoment/index.js +1 -1
- package/legacy/CalendarPicker/index.js +1 -1
- package/legacy/CalendarPickerSkeleton/index.js +1 -1
- package/legacy/ClockPicker/index.js +1 -2
- package/legacy/DatePicker/index.js +1 -2
- package/legacy/DateRangePicker/DateRangePicker.js +13 -517
- package/legacy/DateRangePicker/index.js +2 -2
- package/legacy/DateRangePickerDay/DateRangePickerDay.js +17 -245
- package/legacy/DateRangePickerDay/index.js +2 -2
- package/legacy/DateTimePicker/index.js +1 -2
- package/legacy/DesktopDatePicker/index.js +1 -2
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +12 -482
- package/legacy/DesktopDateRangePicker/index.js +2 -2
- package/legacy/DesktopDateTimePicker/index.js +1 -2
- package/legacy/DesktopTimePicker/index.js +1 -2
- package/legacy/LocalizationProvider/index.js +1 -2
- package/legacy/MobileDatePicker/index.js +1 -2
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +12 -492
- package/legacy/MobileDateRangePicker/index.js +2 -2
- package/legacy/MobileDateTimePicker/index.js +1 -2
- package/legacy/MobileTimePicker/index.js +1 -2
- package/legacy/MonthPicker/index.js +1 -1
- package/legacy/PickersDay/index.js +1 -2
- package/legacy/StaticDatePicker/index.js +1 -2
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +12 -449
- package/legacy/StaticDateRangePicker/index.js +2 -2
- package/legacy/StaticDateTimePicker/index.js +1 -2
- package/legacy/StaticTimePicker/index.js +1 -2
- package/legacy/TimePicker/index.js +1 -2
- package/legacy/Timeline/Timeline.js +2 -2
- package/legacy/TreeItem/TreeItem.js +1 -1
- package/legacy/YearPicker/index.js +1 -3
- package/legacy/index.js +1 -1
- package/modern/AdapterDateFns/index.js +1 -1
- package/modern/AdapterDayjs/index.js +1 -1
- package/modern/AdapterLuxon/index.js +1 -1
- package/modern/AdapterMoment/index.js +1 -1
- package/modern/CalendarPicker/index.js +1 -1
- package/modern/CalendarPickerSkeleton/index.js +1 -1
- package/modern/ClockPicker/index.js +1 -2
- package/modern/DatePicker/index.js +1 -2
- package/modern/DateRangePicker/DateRangePicker.js +14 -512
- package/modern/DateRangePicker/index.js +2 -2
- package/modern/DateRangePickerDay/DateRangePickerDay.js +17 -240
- package/modern/DateRangePickerDay/index.js +2 -2
- package/modern/DateTimePicker/index.js +1 -2
- package/modern/DesktopDatePicker/index.js +1 -2
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +13 -477
- package/modern/DesktopDateRangePicker/index.js +2 -2
- package/modern/DesktopDateTimePicker/index.js +1 -2
- package/modern/DesktopTimePicker/index.js +1 -2
- package/modern/LocalizationProvider/index.js +1 -2
- package/modern/MobileDatePicker/index.js +1 -2
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +13 -487
- package/modern/MobileDateRangePicker/index.js +2 -2
- package/modern/MobileDateTimePicker/index.js +1 -2
- package/modern/MobileTimePicker/index.js +1 -2
- package/modern/MonthPicker/index.js +1 -1
- package/modern/PickersDay/index.js +1 -2
- package/modern/StaticDatePicker/index.js +1 -2
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +13 -443
- package/modern/StaticDateRangePicker/index.js +2 -2
- package/modern/StaticDateTimePicker/index.js +1 -2
- package/modern/StaticTimePicker/index.js +1 -2
- package/modern/TimePicker/index.js +1 -2
- package/modern/Timeline/Timeline.js +2 -2
- package/modern/TreeItem/TreeItem.js +1 -1
- package/modern/YearPicker/index.js +1 -3
- package/modern/index.js +1 -1
- package/node/AdapterDateFns/index.js +2 -4
- package/node/AdapterDayjs/index.js +2 -4
- package/node/AdapterLuxon/index.js +2 -4
- package/node/AdapterMoment/index.js +2 -4
- package/node/CalendarPicker/index.js +2 -6
- package/node/CalendarPickerSkeleton/index.js +2 -6
- package/node/ClockPicker/index.js +2 -6
- package/node/DatePicker/index.js +2 -19
- package/node/DateRangePicker/DateRangePicker.js +14 -517
- package/node/DateRangePickerDay/DateRangePickerDay.js +20 -254
- package/node/DateTimePicker/index.js +2 -19
- package/node/DesktopDatePicker/index.js +2 -19
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +13 -482
- package/node/DesktopDateTimePicker/index.js +2 -19
- package/node/DesktopTimePicker/index.js +2 -19
- package/node/LocalizationProvider/index.js +2 -19
- package/node/MobileDatePicker/index.js +2 -19
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +13 -492
- package/node/MobileDateTimePicker/index.js +2 -19
- package/node/MobileTimePicker/index.js +2 -19
- package/node/MonthPicker/index.js +2 -6
- package/node/PickersDay/index.js +2 -6
- package/node/StaticDatePicker/index.js +2 -19
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +13 -447
- package/node/StaticDateTimePicker/index.js +2 -19
- package/node/StaticTimePicker/index.js +2 -19
- package/node/TimePicker/index.js +2 -19
- package/node/Timeline/Timeline.js +2 -2
- package/node/TreeItem/TreeItem.js +1 -1
- package/node/YearPicker/index.js +9 -26
- package/node/index.js +1 -1
- package/package.json +9 -12
- package/themeAugmentation/components.d.ts +0 -50
- package/themeAugmentation/index.d.ts +2 -0
- package/themeAugmentation/overrides.d.ts +0 -16
- package/themeAugmentation/props.d.ts +0 -36
- package/CalendarPicker/CalendarPicker.d.ts +0 -106
- package/CalendarPicker/CalendarPicker.js +0 -344
- package/CalendarPicker/PickersCalendar.d.ts +0 -47
- package/CalendarPicker/PickersCalendar.js +0 -145
- package/CalendarPicker/PickersCalendarHeader.d.ts +0 -43
- package/CalendarPicker/PickersCalendarHeader.js +0 -165
- package/CalendarPicker/PickersFadeTransitionGroup.d.ts +0 -12
- package/CalendarPicker/PickersFadeTransitionGroup.js +0 -44
- package/CalendarPicker/PickersSlideTransition.d.ts +0 -16
- package/CalendarPicker/PickersSlideTransition.js +0 -103
- package/CalendarPicker/shared.d.ts +0 -1
- package/CalendarPicker/shared.js +0 -1
- package/CalendarPicker/useCalendarState.d.ts +0 -32
- package/CalendarPicker/useCalendarState.js +0 -110
- package/CalendarPickerSkeleton/CalendarPickerSkeleton.d.ts +0 -41
- package/CalendarPickerSkeleton/CalendarPickerSkeleton.js +0 -149
- package/ClockPicker/Clock.d.ts +0 -28
- package/ClockPicker/Clock.js +0 -267
- package/ClockPicker/ClockNumber.d.ts +0 -19
- package/ClockPicker/ClockNumber.js +0 -72
- package/ClockPicker/ClockNumbers.d.ts +0 -24
- package/ClockPicker/ClockNumbers.js +0 -80
- package/ClockPicker/ClockPicker.d.ts +0 -121
- package/ClockPicker/ClockPicker.js +0 -398
- package/ClockPicker/ClockPickerStandalone.d.ts +0 -28
- package/ClockPicker/ClockPickerStandalone.js +0 -47
- package/ClockPicker/ClockPointer.d.ts +0 -23
- package/ClockPicker/ClockPointer.js +0 -103
- package/ClockPicker/shared.d.ts +0 -5
- package/ClockPicker/shared.js +0 -57
- package/DatePicker/DatePicker.d.ts +0 -27
- package/DatePicker/DatePicker.js +0 -469
- package/DatePicker/DatePickerToolbar.d.ts +0 -23
- package/DatePicker/DatePickerToolbar.js +0 -82
- package/DatePicker/shared.d.ts +0 -45
- package/DatePicker/shared.js +0 -54
- package/DateRangePicker/DateRangePickerInput.d.ts +0 -35
- package/DateRangePicker/DateRangePickerInput.js +0 -132
- package/DateRangePicker/DateRangePickerToolbar.d.ts +0 -15
- package/DateRangePicker/DateRangePickerToolbar.js +0 -65
- package/DateRangePicker/DateRangePickerView.d.ts +0 -44
- package/DateRangePicker/DateRangePickerView.js +0 -177
- package/DateRangePicker/DateRangePickerViewDesktop.d.ts +0 -29
- package/DateRangePicker/DateRangePickerViewDesktop.js +0 -159
- package/DateRangePicker/DateRangePickerViewMobile.d.ts +0 -17
- package/DateRangePicker/DateRangePickerViewMobile.js +0 -62
- package/DateRangePicker/RangeTypes.d.ts +0 -8
- package/DateRangePicker/RangeTypes.js +0 -1
- package/DateRangePicker/date-range-manager.d.ts +0 -14
- package/DateRangePicker/date-range-manager.js +0 -43
- package/DateTimePicker/DateTimePicker.d.ts +0 -27
- package/DateTimePicker/DateTimePicker.js +0 -547
- package/DateTimePicker/DateTimePickerTabs.d.ts +0 -13
- package/DateTimePicker/DateTimePickerTabs.js +0 -87
- package/DateTimePicker/DateTimePickerToolbar.d.ts +0 -7
- package/DateTimePicker/DateTimePickerToolbar.js +0 -139
- package/DateTimePicker/shared.d.ts +0 -67
- package/DateTimePicker/shared.js +0 -58
- package/DesktopDatePicker/DesktopDatePicker.d.ts +0 -20
- package/DesktopDatePicker/DesktopDatePicker.js +0 -444
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +0 -20
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -518
- package/DesktopTimePicker/DesktopTimePicker.d.ts +0 -20
- package/DesktopTimePicker/DesktopTimePicker.js +0 -366
- package/LocalizationProvider/LocalizationProvider.d.ts +0 -35
- package/LocalizationProvider/LocalizationProvider.js +0 -108
- package/MobileDatePicker/MobileDatePicker.d.ts +0 -20
- package/MobileDatePicker/MobileDatePicker.js +0 -449
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +0 -20
- package/MobileDateTimePicker/MobileDateTimePicker.js +0 -529
- package/MobileTimePicker/MobileTimePicker.d.ts +0 -20
- package/MobileTimePicker/MobileTimePicker.js +0 -377
- package/MonthPicker/MonthPicker.d.ts +0 -53
- package/MonthPicker/MonthPicker.js +0 -182
- package/MonthPicker/PickersMonth.d.ts +0 -15
- package/MonthPicker/PickersMonth.js +0 -72
- package/PickersDay/PickersDay.d.ts +0 -93
- package/PickersDay/PickersDay.js +0 -396
- package/StaticDatePicker/StaticDatePicker.d.ts +0 -25
- package/StaticDatePicker/StaticDatePicker.js +0 -406
- package/StaticDateTimePicker/StaticDateTimePicker.d.ts +0 -25
- package/StaticDateTimePicker/StaticDateTimePicker.js +0 -486
- package/StaticTimePicker/StaticTimePicker.d.ts +0 -25
- package/StaticTimePicker/StaticTimePicker.js +0 -333
- package/TimePicker/TimePicker.d.ts +0 -27
- package/TimePicker/TimePicker.js +0 -395
- package/TimePicker/TimePickerToolbar.d.ts +0 -23
- package/TimePicker/TimePickerToolbar.js +0 -172
- package/TimePicker/shared.d.ts +0 -36
- package/TimePicker/shared.js +0 -45
- package/YearPicker/PickersYear.d.ts +0 -27
- package/YearPicker/PickersYear.js +0 -112
- package/YearPicker/YearPicker.d.ts +0 -44
- package/YearPicker/YearPicker.js +0 -251
- package/YearPicker/yearPickerClasses.d.ts +0 -3
- package/YearPicker/yearPickerClasses.js +0 -6
- package/internal/pickers/KeyboardDateInput.d.ts +0 -4
- package/internal/pickers/KeyboardDateInput.js +0 -59
- package/internal/pickers/Picker/Picker.d.ts +0 -33
- package/internal/pickers/Picker/Picker.js +0 -130
- package/internal/pickers/Picker/PickerView.d.ts +0 -3
- package/internal/pickers/Picker/PickerView.js +0 -11
- package/internal/pickers/PickersArrowSwitcher.d.ts +0 -41
- package/internal/pickers/PickersArrowSwitcher.js +0 -91
- package/internal/pickers/PickersModalDialog.d.ts +0 -47
- package/internal/pickers/PickersModalDialog.js +0 -78
- package/internal/pickers/PickersPopper.d.ts +0 -44
- package/internal/pickers/PickersPopper.js +0 -267
- package/internal/pickers/PickersToolbar.d.ts +0 -14
- package/internal/pickers/PickersToolbar.js +0 -88
- package/internal/pickers/PickersToolbarButton.d.ts +0 -13
- package/internal/pickers/PickersToolbarButton.js +0 -39
- package/internal/pickers/PickersToolbarText.d.ts +0 -8
- package/internal/pickers/PickersToolbarText.js +0 -36
- package/internal/pickers/PureDateInput.d.ts +0 -80
- package/internal/pickers/PureDateInput.js +0 -51
- package/internal/pickers/constants/dimensions.d.ts +0 -4
- package/internal/pickers/constants/dimensions.js +0 -4
- package/internal/pickers/constants/prop-types.d.ts +0 -1
- package/internal/pickers/constants/prop-types.js +0 -1
- package/internal/pickers/date-time-utils.d.ts +0 -8
- package/internal/pickers/date-time-utils.js +0 -28
- package/internal/pickers/date-utils.d.ts +0 -52
- package/internal/pickers/date-utils.js +0 -138
- package/internal/pickers/hooks/date-helpers-hooks.d.ts +0 -16
- package/internal/pickers/hooks/date-helpers-hooks.js +0 -37
- package/internal/pickers/hooks/useIsLandscape.d.ts +0 -4
- package/internal/pickers/hooks/useIsLandscape.js +0 -43
- package/internal/pickers/hooks/useMaskedInput.d.ts +0 -7
- package/internal/pickers/hooks/useMaskedInput.js +0 -93
- package/internal/pickers/hooks/useOpenState.d.ts +0 -10
- package/internal/pickers/hooks/useOpenState.js +0 -38
- package/internal/pickers/hooks/usePickerState.d.ts +0 -38
- package/internal/pickers/hooks/usePickerState.js +0 -117
- package/internal/pickers/hooks/useUtils.d.ts +0 -7
- package/internal/pickers/hooks/useUtils.js +0 -25
- package/internal/pickers/hooks/useValidation.d.ts +0 -23
- package/internal/pickers/hooks/useValidation.js +0 -44
- package/internal/pickers/hooks/useViews.d.ts +0 -19
- package/internal/pickers/hooks/useViews.js +0 -50
- package/internal/pickers/test-utils.js +0 -91
- package/internal/pickers/text-field-helper.d.ts +0 -11
- package/internal/pickers/text-field-helper.js +0 -66
- package/internal/pickers/time-utils.d.ts +0 -33
- package/internal/pickers/time-utils.js +0 -68
- package/internal/pickers/typings/BasePicker.d.ts +0 -95
- package/internal/pickers/typings/BasePicker.js +0 -1
- package/internal/pickers/typings/Views.d.ts +0 -1
- package/internal/pickers/typings/Views.js +0 -1
- package/internal/pickers/typings/helpers.d.ts +0 -9
- package/internal/pickers/typings/helpers.js +0 -1
- package/internal/pickers/utils.d.ts +0 -7
- package/internal/pickers/utils.js +0 -36
- package/internal/pickers/wrappers/DesktopTooltipWrapper.d.ts +0 -4
- package/internal/pickers/wrappers/DesktopTooltipWrapper.js +0 -55
- package/internal/pickers/wrappers/DesktopWrapper.d.ts +0 -16
- package/internal/pickers/wrappers/DesktopWrapper.js +0 -45
- package/internal/pickers/wrappers/MobileWrapper.d.ts +0 -14
- package/internal/pickers/wrappers/MobileWrapper.js +0 -50
- package/internal/pickers/wrappers/PickerStaticWrapper.d.ts +0 -21
- package/internal/pickers/wrappers/PickerStaticWrapper.js +0 -63
- package/internal/pickers/wrappers/ResponsiveWrapper.d.ts +0 -23
- package/internal/pickers/wrappers/ResponsiveWrapper.js +0 -44
- package/internal/pickers/wrappers/WrapperProps.d.ts +0 -13
- package/internal/pickers/wrappers/WrapperProps.js +0 -1
- package/internal/pickers/wrappers/WrapperVariantContext.d.ts +0 -11
- package/internal/pickers/wrappers/WrapperVariantContext.js +0 -12
- package/legacy/CalendarPicker/CalendarPicker.js +0 -355
- package/legacy/CalendarPicker/PickersCalendar.js +0 -159
- package/legacy/CalendarPicker/PickersCalendarHeader.js +0 -176
- package/legacy/CalendarPicker/PickersFadeTransitionGroup.js +0 -44
- package/legacy/CalendarPicker/PickersSlideTransition.js +0 -98
- package/legacy/CalendarPicker/shared.js +0 -1
- package/legacy/CalendarPicker/useCalendarState.js +0 -118
- package/legacy/CalendarPickerSkeleton/CalendarPickerSkeleton.js +0 -155
- package/legacy/ClockPicker/Clock.js +0 -273
- package/legacy/ClockPicker/ClockNumber.js +0 -71
- package/legacy/ClockPicker/ClockNumbers.js +0 -83
- package/legacy/ClockPicker/ClockPicker.js +0 -437
- package/legacy/ClockPicker/ClockPickerStandalone.js +0 -49
- package/legacy/ClockPicker/ClockPointer.js +0 -130
- package/legacy/ClockPicker/shared.js +0 -61
- package/legacy/DatePicker/DatePicker.js +0 -467
- package/legacy/DatePicker/DatePickerToolbar.js +0 -82
- package/legacy/DatePicker/shared.js +0 -57
- package/legacy/DateRangePicker/DateRangePickerInput.js +0 -144
- package/legacy/DateRangePicker/DateRangePickerToolbar.js +0 -73
- package/legacy/DateRangePicker/DateRangePickerView.js +0 -181
- package/legacy/DateRangePicker/DateRangePickerViewDesktop.js +0 -174
- package/legacy/DateRangePicker/DateRangePickerViewMobile.js +0 -64
- package/legacy/DateRangePicker/RangeTypes.js +0 -1
- package/legacy/DateRangePicker/date-range-manager.js +0 -51
- package/legacy/DateTimePicker/DateTimePicker.js +0 -545
- package/legacy/DateTimePicker/DateTimePickerTabs.js +0 -88
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +0 -151
- package/legacy/DateTimePicker/shared.js +0 -58
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -446
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -520
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -368
- package/legacy/LocalizationProvider/LocalizationProvider.js +0 -108
- package/legacy/MobileDatePicker/MobileDatePicker.js +0 -452
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -532
- package/legacy/MobileTimePicker/MobileTimePicker.js +0 -380
- package/legacy/MonthPicker/MonthPicker.js +0 -179
- package/legacy/MonthPicker/PickersMonth.js +0 -70
- package/legacy/PickersDay/PickersDay.js +0 -399
- package/legacy/StaticDatePicker/StaticDatePicker.js +0 -410
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -490
- package/legacy/StaticTimePicker/StaticTimePicker.js +0 -336
- package/legacy/TimePicker/TimePicker.js +0 -393
- package/legacy/TimePicker/TimePickerToolbar.js +0 -179
- package/legacy/TimePicker/shared.js +0 -44
- package/legacy/YearPicker/PickersYear.js +0 -115
- package/legacy/YearPicker/YearPicker.js +0 -254
- package/legacy/YearPicker/yearPickerClasses.js +0 -6
- package/legacy/internal/pickers/KeyboardDateInput.js +0 -57
- package/legacy/internal/pickers/Picker/Picker.js +0 -141
- package/legacy/internal/pickers/Picker/PickerView.js +0 -11
- package/legacy/internal/pickers/PickersArrowSwitcher.js +0 -92
- package/legacy/internal/pickers/PickersModalDialog.js +0 -85
- package/legacy/internal/pickers/PickersPopper.js +0 -280
- package/legacy/internal/pickers/PickersToolbar.js +0 -92
- package/legacy/internal/pickers/PickersToolbarButton.js +0 -36
- package/legacy/internal/pickers/PickersToolbarText.js +0 -34
- package/legacy/internal/pickers/PureDateInput.js +0 -53
- package/legacy/internal/pickers/constants/dimensions.js +0 -4
- package/legacy/internal/pickers/constants/prop-types.js +0 -1
- package/legacy/internal/pickers/date-time-utils.js +0 -25
- package/legacy/internal/pickers/date-utils.js +0 -143
- package/legacy/internal/pickers/hooks/date-helpers-hooks.js +0 -35
- package/legacy/internal/pickers/hooks/useIsLandscape.js +0 -46
- package/legacy/internal/pickers/hooks/useMaskedInput.js +0 -105
- package/legacy/internal/pickers/hooks/useOpenState.js +0 -41
- package/legacy/internal/pickers/hooks/usePickerState.js +0 -143
- package/legacy/internal/pickers/hooks/useUtils.js +0 -25
- package/legacy/internal/pickers/hooks/useValidation.js +0 -43
- package/legacy/internal/pickers/hooks/useViews.js +0 -55
- package/legacy/internal/pickers/test-utils.js +0 -112
- package/legacy/internal/pickers/text-field-helper.js +0 -68
- package/legacy/internal/pickers/time-utils.js +0 -69
- package/legacy/internal/pickers/typings/BasePicker.js +0 -1
- package/legacy/internal/pickers/typings/Views.js +0 -1
- package/legacy/internal/pickers/typings/helpers.js +0 -1
- package/legacy/internal/pickers/utils.js +0 -52
- package/legacy/internal/pickers/wrappers/DesktopTooltipWrapper.js +0 -53
- package/legacy/internal/pickers/wrappers/DesktopWrapper.js +0 -43
- package/legacy/internal/pickers/wrappers/MobileWrapper.js +0 -47
- package/legacy/internal/pickers/wrappers/PickerStaticWrapper.js +0 -61
- package/legacy/internal/pickers/wrappers/ResponsiveWrapper.js +0 -42
- package/legacy/internal/pickers/wrappers/WrapperProps.js +0 -1
- package/legacy/internal/pickers/wrappers/WrapperVariantContext.js +0 -12
- package/modern/CalendarPicker/CalendarPicker.js +0 -344
- package/modern/CalendarPicker/PickersCalendar.js +0 -145
- package/modern/CalendarPicker/PickersCalendarHeader.js +0 -165
- package/modern/CalendarPicker/PickersFadeTransitionGroup.js +0 -44
- package/modern/CalendarPicker/PickersSlideTransition.js +0 -103
- package/modern/CalendarPicker/shared.js +0 -1
- package/modern/CalendarPicker/useCalendarState.js +0 -108
- package/modern/CalendarPickerSkeleton/CalendarPickerSkeleton.js +0 -149
- package/modern/ClockPicker/Clock.js +0 -267
- package/modern/ClockPicker/ClockNumber.js +0 -72
- package/modern/ClockPicker/ClockNumbers.js +0 -80
- package/modern/ClockPicker/ClockPicker.js +0 -398
- package/modern/ClockPicker/ClockPickerStandalone.js +0 -47
- package/modern/ClockPicker/ClockPointer.js +0 -103
- package/modern/ClockPicker/shared.js +0 -57
- package/modern/DatePicker/DatePicker.js +0 -469
- package/modern/DatePicker/DatePickerToolbar.js +0 -82
- package/modern/DatePicker/shared.js +0 -54
- package/modern/DateRangePicker/DateRangePickerInput.js +0 -128
- package/modern/DateRangePicker/DateRangePickerToolbar.js +0 -65
- package/modern/DateRangePicker/DateRangePickerView.js +0 -177
- package/modern/DateRangePicker/DateRangePickerViewDesktop.js +0 -159
- package/modern/DateRangePicker/DateRangePickerViewMobile.js +0 -62
- package/modern/DateRangePicker/RangeTypes.js +0 -1
- package/modern/DateRangePicker/date-range-manager.js +0 -43
- package/modern/DateTimePicker/DateTimePicker.js +0 -547
- package/modern/DateTimePicker/DateTimePickerTabs.js +0 -87
- package/modern/DateTimePicker/DateTimePickerToolbar.js +0 -139
- package/modern/DateTimePicker/shared.js +0 -58
- package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -444
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -518
- package/modern/DesktopTimePicker/DesktopTimePicker.js +0 -366
- package/modern/LocalizationProvider/LocalizationProvider.js +0 -108
- package/modern/MobileDatePicker/MobileDatePicker.js +0 -449
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -529
- package/modern/MobileTimePicker/MobileTimePicker.js +0 -377
- package/modern/MonthPicker/MonthPicker.js +0 -182
- package/modern/MonthPicker/PickersMonth.js +0 -72
- package/modern/PickersDay/PickersDay.js +0 -396
- package/modern/StaticDatePicker/StaticDatePicker.js +0 -406
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -486
- package/modern/StaticTimePicker/StaticTimePicker.js +0 -333
- package/modern/TimePicker/TimePicker.js +0 -395
- package/modern/TimePicker/TimePickerToolbar.js +0 -172
- package/modern/TimePicker/shared.js +0 -45
- package/modern/YearPicker/PickersYear.js +0 -112
- package/modern/YearPicker/YearPicker.js +0 -251
- package/modern/YearPicker/yearPickerClasses.js +0 -6
- package/modern/internal/pickers/KeyboardDateInput.js +0 -59
- package/modern/internal/pickers/Picker/Picker.js +0 -130
- package/modern/internal/pickers/Picker/PickerView.js +0 -11
- package/modern/internal/pickers/PickersArrowSwitcher.js +0 -91
- package/modern/internal/pickers/PickersModalDialog.js +0 -78
- package/modern/internal/pickers/PickersPopper.js +0 -267
- package/modern/internal/pickers/PickersToolbar.js +0 -88
- package/modern/internal/pickers/PickersToolbarButton.js +0 -39
- package/modern/internal/pickers/PickersToolbarText.js +0 -36
- package/modern/internal/pickers/PureDateInput.js +0 -51
- package/modern/internal/pickers/constants/dimensions.js +0 -4
- package/modern/internal/pickers/constants/prop-types.js +0 -1
- package/modern/internal/pickers/date-time-utils.js +0 -28
- package/modern/internal/pickers/date-utils.js +0 -138
- package/modern/internal/pickers/hooks/date-helpers-hooks.js +0 -37
- package/modern/internal/pickers/hooks/useIsLandscape.js +0 -43
- package/modern/internal/pickers/hooks/useMaskedInput.js +0 -93
- package/modern/internal/pickers/hooks/useOpenState.js +0 -38
- package/modern/internal/pickers/hooks/usePickerState.js +0 -117
- package/modern/internal/pickers/hooks/useUtils.js +0 -25
- package/modern/internal/pickers/hooks/useValidation.js +0 -44
- package/modern/internal/pickers/hooks/useViews.js +0 -48
- package/modern/internal/pickers/test-utils.js +0 -91
- package/modern/internal/pickers/text-field-helper.js +0 -66
- package/modern/internal/pickers/time-utils.js +0 -68
- package/modern/internal/pickers/typings/BasePicker.js +0 -1
- package/modern/internal/pickers/typings/Views.js +0 -1
- package/modern/internal/pickers/typings/helpers.js +0 -1
- package/modern/internal/pickers/utils.js +0 -36
- package/modern/internal/pickers/wrappers/DesktopTooltipWrapper.js +0 -53
- package/modern/internal/pickers/wrappers/DesktopWrapper.js +0 -45
- package/modern/internal/pickers/wrappers/MobileWrapper.js +0 -50
- package/modern/internal/pickers/wrappers/PickerStaticWrapper.js +0 -63
- package/modern/internal/pickers/wrappers/ResponsiveWrapper.js +0 -44
- package/modern/internal/pickers/wrappers/WrapperProps.js +0 -1
- package/modern/internal/pickers/wrappers/WrapperVariantContext.js +0 -12
- package/node/CalendarPicker/CalendarPicker.js +0 -377
- package/node/CalendarPicker/PickersCalendar.js +0 -166
- package/node/CalendarPicker/PickersCalendarHeader.js +0 -189
- package/node/CalendarPicker/PickersFadeTransitionGroup.js +0 -65
- package/node/CalendarPicker/PickersSlideTransition.js +0 -127
- package/node/CalendarPicker/shared.js +0 -5
- package/node/CalendarPicker/useCalendarState.js +0 -131
- package/node/CalendarPickerSkeleton/CalendarPickerSkeleton.js +0 -177
- package/node/ClockPicker/Clock.js +0 -290
- package/node/ClockPicker/ClockNumber.js +0 -95
- package/node/ClockPicker/ClockNumbers.js +0 -100
- package/node/ClockPicker/ClockPicker.js +0 -428
- package/node/ClockPicker/ClockPickerStandalone.js +0 -68
- package/node/ClockPicker/ClockPointer.js +0 -123
- package/node/ClockPicker/shared.js +0 -70
- package/node/DatePicker/DatePicker.js +0 -490
- package/node/DatePicker/DatePickerToolbar.js +0 -106
- package/node/DatePicker/shared.js +0 -73
- package/node/DateRangePicker/DateRangePickerInput.js +0 -155
- package/node/DateRangePicker/DateRangePickerToolbar.js +0 -86
- package/node/DateRangePicker/DateRangePickerView.js +0 -205
- package/node/DateRangePicker/DateRangePickerViewDesktop.js +0 -184
- package/node/DateRangePicker/DateRangePickerViewMobile.js +0 -84
- package/node/DateRangePicker/RangeTypes.js +0 -5
- package/node/DateRangePicker/date-range-manager.js +0 -52
- package/node/DateTimePicker/DateTimePicker.js +0 -568
- package/node/DateTimePicker/DateTimePickerTabs.js +0 -106
- package/node/DateTimePicker/DateTimePickerToolbar.js +0 -163
- package/node/DateTimePicker/shared.js +0 -72
- package/node/DesktopDatePicker/DesktopDatePicker.js +0 -469
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -543
- package/node/DesktopTimePicker/DesktopTimePicker.js +0 -391
- package/node/LocalizationProvider/LocalizationProvider.js +0 -126
- package/node/MobileDatePicker/MobileDatePicker.js +0 -475
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -555
- package/node/MobileTimePicker/MobileTimePicker.js +0 -403
- package/node/MonthPicker/MonthPicker.js +0 -209
- package/node/MonthPicker/PickersMonth.js +0 -96
- package/node/PickersDay/PickersDay.js +0 -429
- package/node/StaticDatePicker/StaticDatePicker.js +0 -431
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -511
- package/node/StaticTimePicker/StaticTimePicker.js +0 -357
- package/node/TimePicker/TimePicker.js +0 -416
- package/node/TimePicker/TimePickerToolbar.js +0 -200
- package/node/TimePicker/shared.js +0 -59
- package/node/YearPicker/PickersYear.js +0 -136
- package/node/YearPicker/YearPicker.js +0 -275
- package/node/YearPicker/yearPickerClasses.js +0 -17
- package/node/internal/pickers/KeyboardDateInput.js +0 -85
- package/node/internal/pickers/Picker/Picker.js +0 -156
- package/node/internal/pickers/Picker/PickerView.js +0 -21
- package/node/internal/pickers/PickersArrowSwitcher.js +0 -113
- package/node/internal/pickers/PickersModalDialog.js +0 -100
- package/node/internal/pickers/PickersPopper.js +0 -291
- package/node/internal/pickers/PickersToolbar.js +0 -112
- package/node/internal/pickers/PickersToolbarButton.js +0 -60
- package/node/internal/pickers/PickersToolbarText.js +0 -58
- package/node/internal/pickers/PureDateInput.js +0 -70
- package/node/internal/pickers/constants/dimensions.js +0 -14
- package/node/internal/pickers/constants/prop-types.js +0 -5
- package/node/internal/pickers/date-time-utils.js +0 -40
- package/node/internal/pickers/date-utils.js +0 -170
- package/node/internal/pickers/hooks/date-helpers-hooks.js +0 -55
- package/node/internal/pickers/hooks/useIsLandscape.js +0 -59
- package/node/internal/pickers/hooks/useMaskedInput.js +0 -115
- package/node/internal/pickers/hooks/useOpenState.js +0 -53
- package/node/internal/pickers/hooks/usePickerState.js +0 -134
- package/node/internal/pickers/hooks/useUtils.js +0 -42
- package/node/internal/pickers/hooks/useValidation.js +0 -65
- package/node/internal/pickers/hooks/useViews.js +0 -64
- package/node/internal/pickers/test-utils.js +0 -122
- package/node/internal/pickers/text-field-helper.js +0 -86
- package/node/internal/pickers/time-utils.js +0 -92
- package/node/internal/pickers/typings/BasePicker.js +0 -5
- package/node/internal/pickers/typings/Views.js +0 -5
- package/node/internal/pickers/typings/helpers.js +0 -5
- package/node/internal/pickers/utils.js +0 -58
- package/node/internal/pickers/wrappers/DesktopTooltipWrapper.js +0 -74
- package/node/internal/pickers/wrappers/DesktopWrapper.js +0 -63
- package/node/internal/pickers/wrappers/MobileWrapper.js +0 -68
- package/node/internal/pickers/wrappers/PickerStaticWrapper.js +0 -88
- package/node/internal/pickers/wrappers/ResponsiveWrapper.js +0 -64
- package/node/internal/pickers/wrappers/WrapperProps.js +0 -5
- package/node/internal/pickers/wrappers/WrapperVariantContext.js +0 -25
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useRifm } from 'rifm';
|
|
4
|
-
import { useUtils } from './useUtils';
|
|
5
|
-
import { createDelegatedEventHandler } from '../utils';
|
|
6
|
-
import { maskedDateFormatter, getDisplayDate, checkMaskIsValidForCurrentFormat } from '../text-field-helper';
|
|
7
|
-
export function useMaskedInput({
|
|
8
|
-
acceptRegex = /[\d]/gi,
|
|
9
|
-
disabled,
|
|
10
|
-
disableMaskedInput,
|
|
11
|
-
ignoreInvalidInputs,
|
|
12
|
-
inputFormat,
|
|
13
|
-
inputProps,
|
|
14
|
-
label,
|
|
15
|
-
mask,
|
|
16
|
-
onChange,
|
|
17
|
-
rawValue,
|
|
18
|
-
readOnly,
|
|
19
|
-
rifmFormatter,
|
|
20
|
-
TextFieldProps,
|
|
21
|
-
validationError
|
|
22
|
-
}) {
|
|
23
|
-
const utils = useUtils();
|
|
24
|
-
const [isFocused, setIsFocused] = React.useState(false);
|
|
25
|
-
const formatHelperText = utils.getFormatHelperText(inputFormat);
|
|
26
|
-
const shouldUseMaskedInput = React.useMemo(() => {
|
|
27
|
-
// formatting of dates is a quite slow thing, so do not make useless .format calls
|
|
28
|
-
if (!mask || disableMaskedInput) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return checkMaskIsValidForCurrentFormat(mask, inputFormat, acceptRegex, utils);
|
|
33
|
-
}, [acceptRegex, disableMaskedInput, inputFormat, mask, utils]);
|
|
34
|
-
const formatter = React.useMemo(() => shouldUseMaskedInput && mask ? maskedDateFormatter(mask, acceptRegex) : st => st, [acceptRegex, mask, shouldUseMaskedInput]); // TODO: Implement with controlled vs unctrolled `rawValue`
|
|
35
|
-
|
|
36
|
-
const currentInputValue = getDisplayDate(utils, rawValue, inputFormat);
|
|
37
|
-
const [innerInputValue, setInnerInputValue] = React.useState(currentInputValue);
|
|
38
|
-
const previousInputValueRef = React.useRef(currentInputValue);
|
|
39
|
-
React.useEffect(() => {
|
|
40
|
-
previousInputValueRef.current = currentInputValue;
|
|
41
|
-
}, [currentInputValue]);
|
|
42
|
-
const notTyping = !isFocused;
|
|
43
|
-
const valueChanged = previousInputValueRef.current !== currentInputValue; // Update the input value only if the value changed outside of typing
|
|
44
|
-
|
|
45
|
-
if (notTyping && valueChanged && (rawValue === null || utils.isValid(rawValue))) {
|
|
46
|
-
if (currentInputValue !== innerInputValue) {
|
|
47
|
-
setInnerInputValue(currentInputValue);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const handleChange = text => {
|
|
52
|
-
const finalString = text === '' || text === mask ? '' : text;
|
|
53
|
-
setInnerInputValue(finalString);
|
|
54
|
-
const date = finalString === null ? null : utils.parse(finalString, inputFormat);
|
|
55
|
-
|
|
56
|
-
if (ignoreInvalidInputs && !utils.isValid(date)) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
onChange(date, finalString || undefined);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const rifmProps = useRifm({
|
|
64
|
-
value: innerInputValue,
|
|
65
|
-
onChange: handleChange,
|
|
66
|
-
format: rifmFormatter || formatter
|
|
67
|
-
});
|
|
68
|
-
const inputStateArgs = shouldUseMaskedInput ? rifmProps : {
|
|
69
|
-
value: innerInputValue,
|
|
70
|
-
onChange: event => {
|
|
71
|
-
handleChange(event.currentTarget.value);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
return _extends({
|
|
75
|
-
label,
|
|
76
|
-
disabled,
|
|
77
|
-
error: validationError,
|
|
78
|
-
inputProps: _extends({}, inputStateArgs, {
|
|
79
|
-
disabled,
|
|
80
|
-
placeholder: formatHelperText,
|
|
81
|
-
readOnly,
|
|
82
|
-
type: shouldUseMaskedInput ? 'tel' : 'text'
|
|
83
|
-
}, inputProps, {
|
|
84
|
-
onFocus: createDelegatedEventHandler(() => {
|
|
85
|
-
setIsFocused(true);
|
|
86
|
-
}, inputProps == null ? void 0 : inputProps.onFocus),
|
|
87
|
-
onBlur: createDelegatedEventHandler(() => {
|
|
88
|
-
setIsFocused(false);
|
|
89
|
-
}, inputProps == null ? void 0 : inputProps.onBlur)
|
|
90
|
-
})
|
|
91
|
-
}, TextFieldProps);
|
|
92
|
-
}
|
|
93
|
-
export default useMaskedInput;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface OpenStateProps {
|
|
2
|
-
open?: boolean;
|
|
3
|
-
onOpen?: () => void;
|
|
4
|
-
onClose?: () => void;
|
|
5
|
-
}
|
|
6
|
-
export declare function useOpenState({ open, onOpen, onClose }: OpenStateProps): {
|
|
7
|
-
isOpen: boolean;
|
|
8
|
-
setIsOpen: (newIsOpen: boolean) => void;
|
|
9
|
-
};
|
|
10
|
-
export default useOpenState;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export function useOpenState({
|
|
3
|
-
open,
|
|
4
|
-
onOpen,
|
|
5
|
-
onClose
|
|
6
|
-
}) {
|
|
7
|
-
const isControllingOpenProp = React.useRef(typeof open === 'boolean').current;
|
|
8
|
-
const [openState, setIsOpenState] = React.useState(false); // It is required to update inner state in useEffect in order to avoid situation when
|
|
9
|
-
// Our component is not mounted yet, but `open` state is set to `true` (e.g. initially opened)
|
|
10
|
-
|
|
11
|
-
React.useEffect(() => {
|
|
12
|
-
if (isControllingOpenProp) {
|
|
13
|
-
if (typeof open !== 'boolean') {
|
|
14
|
-
throw new Error('You must not mix controlling and uncontrolled mode for `open` prop');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
setIsOpenState(open);
|
|
18
|
-
}
|
|
19
|
-
}, [isControllingOpenProp, open]);
|
|
20
|
-
const setIsOpen = React.useCallback(newIsOpen => {
|
|
21
|
-
if (!isControllingOpenProp) {
|
|
22
|
-
setIsOpenState(newIsOpen);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (newIsOpen && onOpen) {
|
|
26
|
-
onOpen();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (!newIsOpen && onClose) {
|
|
30
|
-
onClose();
|
|
31
|
-
}
|
|
32
|
-
}, [isControllingOpenProp, onOpen, onClose]);
|
|
33
|
-
return {
|
|
34
|
-
isOpen: openState,
|
|
35
|
-
setIsOpen
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export default useOpenState;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { WrapperVariant } from '../wrappers/WrapperVariantContext';
|
|
2
|
-
import { MuiPickersAdapter } from './useUtils';
|
|
3
|
-
export interface PickerStateValueManager<TInputValue, TDateValue> {
|
|
4
|
-
areValuesEqual: (utils: MuiPickersAdapter, valueLeft: TDateValue, valueRight: TDateValue) => boolean;
|
|
5
|
-
emptyValue: TDateValue;
|
|
6
|
-
parseInput: (utils: MuiPickersAdapter, value: TInputValue) => TDateValue;
|
|
7
|
-
}
|
|
8
|
-
export declare type PickerSelectionState = 'partial' | 'shallow' | 'finish';
|
|
9
|
-
export interface PickerStateProps<TInput, TDateValue> {
|
|
10
|
-
disableCloseOnSelect?: boolean;
|
|
11
|
-
open?: boolean;
|
|
12
|
-
onAccept?: (date: TDateValue) => void;
|
|
13
|
-
onChange: (date: TDateValue, keyboardInputValue?: string) => void;
|
|
14
|
-
onClose?: () => void;
|
|
15
|
-
onOpen?: () => void;
|
|
16
|
-
value: TInput;
|
|
17
|
-
}
|
|
18
|
-
export declare function usePickerState<TInput, TDateValue>(props: PickerStateProps<TInput, TDateValue>, valueManager: PickerStateValueManager<TInput, TDateValue>): {
|
|
19
|
-
pickerProps: {
|
|
20
|
-
date: TDateValue;
|
|
21
|
-
isMobileKeyboardViewOpen: boolean;
|
|
22
|
-
toggleMobileKeyboardView: () => void;
|
|
23
|
-
onDateChange: (newDate: TDateValue, wrapperVariant: WrapperVariant, selectionState?: PickerSelectionState) => void;
|
|
24
|
-
};
|
|
25
|
-
inputProps: {
|
|
26
|
-
onChange: (date: TDateValue, keyboardInputValue?: string | undefined) => void;
|
|
27
|
-
open: boolean;
|
|
28
|
-
rawValue: TInput;
|
|
29
|
-
openPicker: () => void;
|
|
30
|
-
};
|
|
31
|
-
wrapperProps: {
|
|
32
|
-
open: boolean;
|
|
33
|
-
onClear: () => void;
|
|
34
|
-
onAccept: () => void;
|
|
35
|
-
onDismiss: () => void;
|
|
36
|
-
onSetToday: () => void;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useOpenState } from './useOpenState';
|
|
4
|
-
import { useUtils } from './useUtils';
|
|
5
|
-
export function usePickerState(props, valueManager) {
|
|
6
|
-
const {
|
|
7
|
-
disableCloseOnSelect,
|
|
8
|
-
onAccept,
|
|
9
|
-
onChange,
|
|
10
|
-
value
|
|
11
|
-
} = props;
|
|
12
|
-
const utils = useUtils();
|
|
13
|
-
const {
|
|
14
|
-
isOpen,
|
|
15
|
-
setIsOpen
|
|
16
|
-
} = useOpenState(props);
|
|
17
|
-
|
|
18
|
-
function initDraftableDate(date) {
|
|
19
|
-
return {
|
|
20
|
-
committed: date,
|
|
21
|
-
draft: date
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const parsedDateValue = valueManager.parseInput(utils, value);
|
|
26
|
-
const [draftState, dispatch] = React.useReducer((state, action) => {
|
|
27
|
-
switch (action.type) {
|
|
28
|
-
case 'reset':
|
|
29
|
-
return initDraftableDate(action.payload);
|
|
30
|
-
|
|
31
|
-
case 'update':
|
|
32
|
-
return _extends({}, state, {
|
|
33
|
-
draft: action.payload
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
default:
|
|
37
|
-
return state;
|
|
38
|
-
}
|
|
39
|
-
}, parsedDateValue, initDraftableDate);
|
|
40
|
-
|
|
41
|
-
if (!valueManager.areValuesEqual(utils, draftState.committed, parsedDateValue)) {
|
|
42
|
-
dispatch({
|
|
43
|
-
type: 'reset',
|
|
44
|
-
payload: parsedDateValue
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const [initialDate, setInitialDate] = React.useState(draftState.committed); // Mobile keyboard view is a special case.
|
|
49
|
-
// When it's open picker should work like closed, cause we are just showing text field
|
|
50
|
-
|
|
51
|
-
const [isMobileKeyboardViewOpen, setMobileKeyboardViewOpen] = React.useState(false);
|
|
52
|
-
const acceptDate = React.useCallback((acceptedDate, needClosePicker) => {
|
|
53
|
-
onChange(acceptedDate);
|
|
54
|
-
|
|
55
|
-
if (needClosePicker) {
|
|
56
|
-
setIsOpen(false);
|
|
57
|
-
setInitialDate(acceptedDate);
|
|
58
|
-
|
|
59
|
-
if (onAccept) {
|
|
60
|
-
onAccept(acceptedDate);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}, [onAccept, onChange, setIsOpen]);
|
|
64
|
-
const wrapperProps = React.useMemo(() => ({
|
|
65
|
-
open: isOpen,
|
|
66
|
-
onClear: () => acceptDate(valueManager.emptyValue, true),
|
|
67
|
-
onAccept: () => acceptDate(draftState.draft, true),
|
|
68
|
-
onDismiss: () => acceptDate(initialDate, true),
|
|
69
|
-
onSetToday: () => {
|
|
70
|
-
const now = utils.date();
|
|
71
|
-
dispatch({
|
|
72
|
-
type: 'update',
|
|
73
|
-
payload: now
|
|
74
|
-
});
|
|
75
|
-
acceptDate(now, !disableCloseOnSelect);
|
|
76
|
-
}
|
|
77
|
-
}), [acceptDate, disableCloseOnSelect, isOpen, utils, draftState.draft, valueManager.emptyValue, initialDate]);
|
|
78
|
-
const pickerProps = React.useMemo(() => ({
|
|
79
|
-
date: draftState.draft,
|
|
80
|
-
isMobileKeyboardViewOpen,
|
|
81
|
-
toggleMobileKeyboardView: () => setMobileKeyboardViewOpen(!isMobileKeyboardViewOpen),
|
|
82
|
-
onDateChange: (newDate, wrapperVariant, selectionState = 'partial') => {
|
|
83
|
-
dispatch({
|
|
84
|
-
type: 'update',
|
|
85
|
-
payload: newDate
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
if (selectionState === 'partial') {
|
|
89
|
-
acceptDate(newDate, false);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (selectionState === 'finish') {
|
|
93
|
-
const shouldCloseOnSelect = !(disableCloseOnSelect != null ? disableCloseOnSelect : wrapperVariant === 'mobile');
|
|
94
|
-
acceptDate(newDate, shouldCloseOnSelect);
|
|
95
|
-
} // if selectionState === "shallow" do nothing (we already update the draft state)
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
}), [acceptDate, disableCloseOnSelect, isMobileKeyboardViewOpen, draftState.draft]);
|
|
99
|
-
const inputProps = React.useMemo(() => ({
|
|
100
|
-
onChange,
|
|
101
|
-
open: isOpen,
|
|
102
|
-
rawValue: value,
|
|
103
|
-
openPicker: () => setIsOpen(true)
|
|
104
|
-
}), [onChange, isOpen, value, setIsOpen]);
|
|
105
|
-
const pickerState = {
|
|
106
|
-
pickerProps,
|
|
107
|
-
inputProps,
|
|
108
|
-
wrapperProps
|
|
109
|
-
};
|
|
110
|
-
React.useDebugValue(pickerState, () => ({
|
|
111
|
-
MuiPickerState: {
|
|
112
|
-
pickerDraft: draftState,
|
|
113
|
-
other: pickerState
|
|
114
|
-
}
|
|
115
|
-
}));
|
|
116
|
-
return pickerState;
|
|
117
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare type MuiPickersAdapter<TDate = unknown> = import('../../../LocalizationProvider').MuiPickersAdapter<TDate>;
|
|
2
|
-
export declare function useUtils<T = unknown>(): import("../../../LocalizationProvider").MuiPickersAdapter<T>;
|
|
3
|
-
export declare function useDefaultDates<T>(): {
|
|
4
|
-
minDate: T;
|
|
5
|
-
maxDate: T;
|
|
6
|
-
};
|
|
7
|
-
export declare function useNow<TDate = unknown>(): TDate;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { MuiPickersAdapterContext } from '../../../LocalizationProvider'; // Required for babel https://github.com/vercel/next.js/issues/7882. Replace with `export type` in future
|
|
4
|
-
|
|
5
|
-
function useLocalizationContext() {
|
|
6
|
-
const localization = React.useContext(MuiPickersAdapterContext);
|
|
7
|
-
|
|
8
|
-
if (localization === null) {
|
|
9
|
-
throw new Error(process.env.NODE_ENV !== "production" ? `Can not find utils in context. It looks like you forgot to wrap your component in LocalizationProvider, or pass dateAdapter prop directly.` : _formatMuiErrorMessage(13));
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return localization;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function useUtils() {
|
|
16
|
-
return useLocalizationContext().utils;
|
|
17
|
-
}
|
|
18
|
-
export function useDefaultDates() {
|
|
19
|
-
return useLocalizationContext().defaultDates;
|
|
20
|
-
}
|
|
21
|
-
export function useNow() {
|
|
22
|
-
const utils = useUtils();
|
|
23
|
-
const now = React.useRef(utils.date());
|
|
24
|
-
return now.current;
|
|
25
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { DateValidationProps, RangeInput } from '../date-utils';
|
|
2
|
-
import { DateTimeValidationProps } from '../date-time-utils';
|
|
3
|
-
import { TimeValidationProps } from '../time-utils';
|
|
4
|
-
export interface ValidationProps<TError, TDateValue> {
|
|
5
|
-
/**
|
|
6
|
-
* Callback that fired when input value or new `value` prop validation returns **new** validation error (or value is valid after error).
|
|
7
|
-
* In case of validation error detected `reason` prop return non-null value and `TextField` must be displayed in `error` state.
|
|
8
|
-
* This can be used to render appropriate form error.
|
|
9
|
-
*
|
|
10
|
-
* [Read the guide](https://next.material-ui-pickers.dev/guides/forms) about form integration and error displaying.
|
|
11
|
-
* @DateIOType
|
|
12
|
-
*/
|
|
13
|
-
onError?: (reason: TError, value: TDateValue) => void;
|
|
14
|
-
value: TDateValue;
|
|
15
|
-
}
|
|
16
|
-
export declare type TimeValidationError = import('../time-utils').TimeValidationError;
|
|
17
|
-
export declare function useTimeValidation<TDate>(props: TimeValidationProps<TDate> & ValidationProps<TimeValidationError, TDate>): TimeValidationError;
|
|
18
|
-
export declare type DateValidationError = import('../date-utils').DateValidationError;
|
|
19
|
-
export declare function useDateValidation<TDate>(props: DateValidationProps<TDate> & ValidationProps<DateValidationError, TDate>): DateValidationError;
|
|
20
|
-
export declare type DateTimeValidationError = import('../date-time-utils').DateTimeValidationError;
|
|
21
|
-
export declare function useDateTimeValidation<TDate>(props: DateTimeValidationProps<TDate> & ValidationProps<DateTimeValidationError, TDate>): DateTimeValidationError;
|
|
22
|
-
export declare type DateRangeValidationError = import('../date-utils').DateRangeValidationError;
|
|
23
|
-
export declare function useDateRangeValidation<TDate>(props: DateValidationProps<TDate> & ValidationProps<DateRangeValidationError, RangeInput<TDate>>): DateRangeValidationError;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useUtils } from './useUtils';
|
|
3
|
-
import { validateDate, validateDateRange } from '../date-utils';
|
|
4
|
-
import { validateDateTime } from '../date-time-utils';
|
|
5
|
-
import { validateTime } from '../time-utils';
|
|
6
|
-
|
|
7
|
-
function isSameDateOrTimeError(a, b) {
|
|
8
|
-
return a === b;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function isSameDateRangeError(a, b) {
|
|
12
|
-
return b !== null && a[1] === b[1] && a[0] === b[0];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function useValidation(props, validate, isSameError = isSameDateOrTimeError) {
|
|
16
|
-
const {
|
|
17
|
-
value,
|
|
18
|
-
onError
|
|
19
|
-
} = props;
|
|
20
|
-
const utils = useUtils();
|
|
21
|
-
const previousValidationErrorRef = React.useRef(null);
|
|
22
|
-
const validationError = validate(utils, value, props);
|
|
23
|
-
React.useEffect(() => {
|
|
24
|
-
if (onError && !isSameError(validationError, previousValidationErrorRef.current)) {
|
|
25
|
-
onError(validationError, value);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
previousValidationErrorRef.current = validationError;
|
|
29
|
-
}, [isSameError, onError, previousValidationErrorRef, validationError, value]);
|
|
30
|
-
return validationError;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function useTimeValidation(props) {
|
|
34
|
-
return useValidation(props, validateTime, isSameDateOrTimeError);
|
|
35
|
-
}
|
|
36
|
-
export function useDateValidation(props) {
|
|
37
|
-
return useValidation(props, validateDate, isSameDateOrTimeError);
|
|
38
|
-
}
|
|
39
|
-
export function useDateTimeValidation(props) {
|
|
40
|
-
return useValidation(props, validateDateTime, isSameDateOrTimeError);
|
|
41
|
-
}
|
|
42
|
-
export function useDateRangeValidation(props) {
|
|
43
|
-
return useValidation(props, validateDateRange, isSameDateRangeError);
|
|
44
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { PickerSelectionState } from './usePickerState';
|
|
2
|
-
import { AllAvailableViews } from '../typings/Views';
|
|
3
|
-
export declare type PickerOnChangeFn<TDate> = (date: TDate | null, selectionState?: PickerSelectionState) => void;
|
|
4
|
-
interface UseViewsOptions<TDate, View extends AllAvailableViews> {
|
|
5
|
-
onChange: PickerOnChangeFn<TDate>;
|
|
6
|
-
onViewChange?: (newView: View) => void;
|
|
7
|
-
openTo?: View;
|
|
8
|
-
view: View | undefined;
|
|
9
|
-
views: readonly View[];
|
|
10
|
-
}
|
|
11
|
-
export declare function useViews<TDate, View extends AllAvailableViews>({ onChange, onViewChange, openTo, view, views, }: UseViewsOptions<TDate, View>): {
|
|
12
|
-
handleChangeAndOpenNext: (date: TDate, currentViewSelectionState?: PickerSelectionState | undefined) => void;
|
|
13
|
-
nextView: View;
|
|
14
|
-
previousView: View;
|
|
15
|
-
openNext: () => void;
|
|
16
|
-
openView: View;
|
|
17
|
-
setOpenView: (newView: View) => void;
|
|
18
|
-
};
|
|
19
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useControlled } from '@mui/material/utils';
|
|
3
|
-
import { arrayIncludes } from '../utils';
|
|
4
|
-
export function useViews({
|
|
5
|
-
onChange,
|
|
6
|
-
onViewChange,
|
|
7
|
-
openTo,
|
|
8
|
-
view,
|
|
9
|
-
views
|
|
10
|
-
}) {
|
|
11
|
-
var _views, _views2;
|
|
12
|
-
|
|
13
|
-
const [openView, setOpenView] = useControlled({
|
|
14
|
-
name: 'Picker',
|
|
15
|
-
state: 'view',
|
|
16
|
-
controlled: view,
|
|
17
|
-
default: openTo && arrayIncludes(views, openTo) ? openTo : views[0]
|
|
18
|
-
});
|
|
19
|
-
const previousView = (_views = views[views.indexOf(openView) - 1]) != null ? _views : null;
|
|
20
|
-
const nextView = (_views2 = views[views.indexOf(openView) + 1]) != null ? _views2 : null;
|
|
21
|
-
const changeView = React.useCallback(newView => {
|
|
22
|
-
setOpenView(newView);
|
|
23
|
-
|
|
24
|
-
if (onViewChange) {
|
|
25
|
-
onViewChange(newView);
|
|
26
|
-
}
|
|
27
|
-
}, [setOpenView, onViewChange]);
|
|
28
|
-
const openNext = React.useCallback(() => {
|
|
29
|
-
if (nextView) {
|
|
30
|
-
changeView(nextView);
|
|
31
|
-
}
|
|
32
|
-
}, [nextView, changeView]);
|
|
33
|
-
const handleChangeAndOpenNext = React.useCallback((date, currentViewSelectionState) => {
|
|
34
|
-
const isSelectionFinishedOnCurrentView = currentViewSelectionState === 'finish';
|
|
35
|
-
const globalSelectionState = isSelectionFinishedOnCurrentView && Boolean(nextView) ? 'partial' : currentViewSelectionState;
|
|
36
|
-
onChange(date, globalSelectionState);
|
|
37
|
-
|
|
38
|
-
if (isSelectionFinishedOnCurrentView) {
|
|
39
|
-
openNext();
|
|
40
|
-
}
|
|
41
|
-
}, [nextView, onChange, openNext]);
|
|
42
|
-
return {
|
|
43
|
-
handleChangeAndOpenNext,
|
|
44
|
-
nextView,
|
|
45
|
-
previousView,
|
|
46
|
-
openNext,
|
|
47
|
-
openView,
|
|
48
|
-
setOpenView: changeView
|
|
49
|
-
};
|
|
50
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["locale"];
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { parseISO } from 'date-fns';
|
|
6
|
-
import { createRenderer, fireEvent, screen } from 'test/utils';
|
|
7
|
-
import AdapterDateFns from '@mui/lab/AdapterDateFns';
|
|
8
|
-
import LocalizationProvider from '@mui/lab/LocalizationProvider'; // TODO make possible to pass here any utils using cli
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Wrapper around `@date-io/date-fns` that resolves https://github.com/dmtrKovalenko/date-io/issues/479.
|
|
12
|
-
* We're not using `adapter.date` in the implementation which means the implementation is safe.
|
|
13
|
-
* But we do use it in tests where usage of ISO dates without timezone is problematic
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
export class AdapterClassToUse extends AdapterDateFns {
|
|
18
|
-
constructor(...args) {
|
|
19
|
-
super(...args);
|
|
20
|
-
|
|
21
|
-
this.date = value => {
|
|
22
|
-
if (typeof value === 'string') {
|
|
23
|
-
return parseISO(value);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (typeof value === 'undefined') {
|
|
27
|
-
return new Date();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (value === null) {
|
|
31
|
-
// @ts-expect-error AdapterDateFns#date says it returns NotNullable but that's not true
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return new Date(value);
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
export const adapterToUse = new AdapterClassToUse();
|
|
41
|
-
export const FakeTransitionComponent = /*#__PURE__*/React.forwardRef(function FakeTransitionComponent({
|
|
42
|
-
children
|
|
43
|
-
}, ref) {
|
|
44
|
-
// set tabIndex in case it is used as a child of <TrapFocus />
|
|
45
|
-
return /*#__PURE__*/_jsx("div", {
|
|
46
|
-
ref: ref,
|
|
47
|
-
tabIndex: -1,
|
|
48
|
-
children: children
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
export function wrapPickerMount(mount) {
|
|
52
|
-
return node => mount( /*#__PURE__*/_jsx(LocalizationProvider, {
|
|
53
|
-
dateAdapter: AdapterClassToUse,
|
|
54
|
-
children: node
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
export function createPickerRenderer(_ref = {}) {
|
|
58
|
-
let {
|
|
59
|
-
locale
|
|
60
|
-
} = _ref,
|
|
61
|
-
createRendererOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
clock,
|
|
65
|
-
render: clientRender
|
|
66
|
-
} = createRenderer(createRendererOptions);
|
|
67
|
-
|
|
68
|
-
function Wrapper({
|
|
69
|
-
children
|
|
70
|
-
}) {
|
|
71
|
-
return /*#__PURE__*/_jsx(LocalizationProvider, {
|
|
72
|
-
locale: locale,
|
|
73
|
-
dateAdapter: AdapterClassToUse,
|
|
74
|
-
children: children
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return {
|
|
79
|
-
clock,
|
|
80
|
-
|
|
81
|
-
render(node, options) {
|
|
82
|
-
return clientRender(node, _extends({}, options, {
|
|
83
|
-
wrapper: Wrapper
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
export function openMobilePicker() {
|
|
90
|
-
fireEvent.click(screen.getByRole('textbox'));
|
|
91
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ParseableDate } from './constants/prop-types';
|
|
2
|
-
import { MuiPickersAdapter } from './hooks/useUtils';
|
|
3
|
-
export declare function getTextFieldAriaText<TDate>(rawValue: ParseableDate<TDate>, utils: MuiPickersAdapter<TDate>): string;
|
|
4
|
-
export declare const getDisplayDate: <TDate>(utils: MuiPickersAdapter<TDate>, value: ParseableDate<TDate>, inputFormat: string) => string;
|
|
5
|
-
export declare function pick12hOr24hFormat(userFormat: string | undefined, ampm: boolean | undefined, formats: {
|
|
6
|
-
localized: string;
|
|
7
|
-
'12h': string;
|
|
8
|
-
'24h': string;
|
|
9
|
-
}): string;
|
|
10
|
-
export declare function checkMaskIsValidForCurrentFormat(mask: string, format: string, acceptRegex: RegExp, utils: MuiPickersAdapter): boolean;
|
|
11
|
-
export declare const maskedDateFormatter: (mask: string, acceptRegexp: RegExp) => (value: string) => string;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export function getTextFieldAriaText(rawValue, utils) {
|
|
2
|
-
// TODO: should `isValid` narrow `TDate | null` to `NonNullable<TDate>`?
|
|
3
|
-
// Either we allow `TDate | null` to be valid and guard against calling `formatByString` with `null`.
|
|
4
|
-
// Or we ensure `formatByString` is callable with `null`.
|
|
5
|
-
return rawValue && utils.isValid(utils.date(rawValue)) ? `Choose date, selected date is ${utils.format(utils.date(rawValue), 'fullDate')}` : 'Choose date';
|
|
6
|
-
}
|
|
7
|
-
export const getDisplayDate = (utils, value, inputFormat) => {
|
|
8
|
-
const date = utils.date(value);
|
|
9
|
-
const isEmpty = value === null;
|
|
10
|
-
|
|
11
|
-
if (isEmpty) {
|
|
12
|
-
return '';
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return utils.isValid(date) ? utils.formatByString( // TODO: should `isValid` narrow `TDate | null` to `NonNullable<TDate>`?
|
|
16
|
-
// Either we allow `TDate | null` to be valid and guard against calling `formatByString` with `null`.
|
|
17
|
-
// Or we ensure `formatByString` is callable with `null`.
|
|
18
|
-
date, inputFormat) : '';
|
|
19
|
-
};
|
|
20
|
-
export function pick12hOr24hFormat(userFormat, ampm, formats) {
|
|
21
|
-
if (userFormat) {
|
|
22
|
-
return userFormat;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (typeof ampm === 'undefined') {
|
|
26
|
-
return formats.localized;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return ampm ? formats['12h'] : formats['24h'];
|
|
30
|
-
}
|
|
31
|
-
const MASK_USER_INPUT_SYMBOL = '_';
|
|
32
|
-
const staticDateWith2DigitTokens = '2019-11-21T22:30:00.000';
|
|
33
|
-
const staticDateWith1DigitTokens = '2019-01-01T09:00:00.000';
|
|
34
|
-
export function checkMaskIsValidForCurrentFormat(mask, format, acceptRegex, utils) {
|
|
35
|
-
const formattedDateWith1Digit = utils.formatByString(utils.date(staticDateWith1DigitTokens), format);
|
|
36
|
-
const inferredFormatPatternWith1Digits = formattedDateWith1Digit.replace(acceptRegex, MASK_USER_INPUT_SYMBOL);
|
|
37
|
-
const inferredFormatPatternWith2Digits = utils.formatByString(utils.date(staticDateWith2DigitTokens), format).replace(acceptRegex, '_');
|
|
38
|
-
const isMaskValid = inferredFormatPatternWith2Digits === mask && inferredFormatPatternWith1Digits === mask;
|
|
39
|
-
|
|
40
|
-
if (!isMaskValid && utils.lib !== 'luxon' && process.env.NODE_ENV !== 'production') {
|
|
41
|
-
console.warn(`The mask "${mask}" you passed is not valid for the format used ${format}. Falling down to uncontrolled not-masked input.`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return isMaskValid;
|
|
45
|
-
}
|
|
46
|
-
export const maskedDateFormatter = (mask, acceptRegexp) => value => {
|
|
47
|
-
return value.split('').map((char, i) => {
|
|
48
|
-
acceptRegexp.lastIndex = 0;
|
|
49
|
-
|
|
50
|
-
if (i > mask.length - 1) {
|
|
51
|
-
return '';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const maskChar = mask[i];
|
|
55
|
-
const nextMaskChar = mask[i + 1];
|
|
56
|
-
const acceptedChar = acceptRegexp.test(char) ? char : '';
|
|
57
|
-
const formattedChar = maskChar === MASK_USER_INPUT_SYMBOL ? acceptedChar : maskChar + acceptedChar;
|
|
58
|
-
|
|
59
|
-
if (i === value.length - 1 && nextMaskChar && nextMaskChar !== MASK_USER_INPUT_SYMBOL) {
|
|
60
|
-
// when cursor at the end of mask part (e.g. month) prerender next symbol "21" -> "21/"
|
|
61
|
-
return formattedChar ? formattedChar + nextMaskChar : '';
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return formattedChar;
|
|
65
|
-
}).join('');
|
|
66
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ParseableDate } from './constants/prop-types';
|
|
2
|
-
import { MuiPickersAdapter } from './hooks/useUtils';
|
|
3
|
-
declare type Meridiem = 'am' | 'pm' | null;
|
|
4
|
-
export declare const getMeridiem: (date: unknown, utils: MuiPickersAdapter<unknown>) => Meridiem;
|
|
5
|
-
export declare const convertValueToMeridiem: (value: number, meridiem: Meridiem, ampm: boolean) => number;
|
|
6
|
-
export declare const convertToMeridiem: <TDate>(time: TDate, meridiem: 'am' | 'pm', ampm: boolean, utils: MuiPickersAdapter<TDate>) => TDate;
|
|
7
|
-
export declare function getSecondsInDay(date: unknown, utils: MuiPickersAdapter): number;
|
|
8
|
-
export declare const createIsAfterIgnoreDatePart: (disableIgnoringDatePartForTimeValidation: boolean, utils: MuiPickersAdapter<unknown>) => (dateLeft: unknown, dateRight: unknown) => boolean;
|
|
9
|
-
export interface TimeValidationProps<TDate> {
|
|
10
|
-
/**
|
|
11
|
-
* Min time acceptable time.
|
|
12
|
-
* For input validation date part of passed object will be ignored if `disableIgnoringDatePartForTimeValidation` not specified.
|
|
13
|
-
*/
|
|
14
|
-
minTime?: TDate;
|
|
15
|
-
/**
|
|
16
|
-
* Max time acceptable time.
|
|
17
|
-
* For input validation date part of passed object will be ignored if `disableIgnoringDatePartForTimeValidation` not specified.
|
|
18
|
-
*/
|
|
19
|
-
maxTime?: TDate;
|
|
20
|
-
/**
|
|
21
|
-
* Dynamically check if time is disabled or not.
|
|
22
|
-
* If returns `false` appropriate time point will ot be acceptable.
|
|
23
|
-
*/
|
|
24
|
-
shouldDisableTime?: (timeValue: number, clockType: 'hours' | 'minutes' | 'seconds') => boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Do not ignore date part when validating min/max time.
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
disableIgnoringDatePartForTimeValidation?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export declare const validateTime: <TDate>(utils: MuiPickersAdapter<unknown>, value: ParseableDate<TDate>, { minTime, maxTime, shouldDisableTime, disableIgnoringDatePartForTimeValidation, }: TimeValidationProps<TDate>) => "invalidDate" | "minTime" | "maxTime" | "shouldDisableTime-hours" | "shouldDisableTime-minutes" | "shouldDisableTime-seconds" | null;
|
|
32
|
-
export declare type TimeValidationError = ReturnType<typeof validateTime>;
|
|
33
|
-
export {};
|