@docsvision/material-ui-pickers 3.2.0-beta.3 → 3.2.0-beta.30
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/{build/DatePicker → DatePicker}/DatePicker.d.ts +2 -2
- package/{build/DatePicker → DatePicker}/DatePicker.js +1 -1
- package/{build/DatePicker → DatePicker}/DatePickerToolbar.js +3 -3
- package/{build/DateTimePicker → DateTimePicker}/DateTimePicker.d.ts +2 -2
- package/{build/DateTimePicker → DateTimePicker}/DateTimePicker.js +3 -3
- package/{build/DateTimePicker → DateTimePicker}/DateTimePickerToolbar.js +4 -4
- package/{build/MuiPickersUtilsProvider.d.ts → MuiPickersUtilsProvider.d.ts} +1 -1
- package/{build/MuiPickersUtilsProvider.js → MuiPickersUtilsProvider.js} +11 -5
- package/{build/Picker → Picker}/Picker.d.ts +5 -3
- package/{build/Picker → Picker}/Picker.js +15 -12
- package/{build/Picker → Picker}/WrappedKeyboardPicker.js +2 -2
- package/{build/Picker → Picker}/WrappedPurePicker.js +4 -3
- package/{build/README.md → README.md} +1 -1
- package/Rifm/Rifm.d.ts +17 -0
- package/Rifm/Rifm.js +166 -0
- package/{build/TimePicker → TimePicker}/TimePicker.d.ts +4 -2
- package/{build/TimePicker → TimePicker}/TimePicker.js +3 -3
- package/{build/TimePicker → TimePicker}/TimePickerToolbar.js +3 -3
- package/{build/_helpers → _helpers}/date-utils.d.ts +2 -2
- package/{build/_helpers → _helpers}/date-utils.js +3 -3
- package/_helpers/text-field-helper.d.ts +32 -0
- package/_helpers/text-field-helper.js +144 -0
- package/{build/_helpers → _helpers}/time-utils.d.ts +2 -2
- package/{build/_shared → _shared}/KeyboardDateInput.d.ts +5 -0
- package/{build/_shared → _shared}/KeyboardDateInput.js +29 -5
- package/{build/_shared → _shared}/ModalDialog.d.ts +2 -2
- package/{build/_shared → _shared}/PureDateInput.js +1 -1
- package/{build/_shared → _shared}/ToolbarButton.d.ts +2 -2
- package/{build/_shared → _shared}/WithUtils.d.ts +1 -1
- package/{build/_shared → _shared}/hooks/useIsLandscape.js +1 -1
- package/{build/_shared → _shared}/hooks/useKeyboardPickerState.d.ts +1 -1
- package/{build/_shared → _shared}/hooks/useKeyboardPickerState.js +3 -3
- package/{build/_shared → _shared}/hooks/usePickerState.d.ts +1 -1
- package/{build/_shared → _shared}/hooks/usePickerState.js +2 -3
- package/{build/_shared → _shared}/hooks/useUtils.d.ts +2 -2
- package/{build/constants → constants}/prop-types.js +2 -2
- package/{build/dist → dist}/material-ui-pickers.esm.js +1467 -837
- package/dist/material-ui-pickers.esm.js.map +1 -0
- package/{build/dist → dist}/material-ui-pickers.js +1483 -853
- package/dist/material-ui-pickers.js.map +1 -0
- package/{build/dist → dist}/material-ui-pickers.umd.js +29819 -22160
- package/dist/material-ui-pickers.umd.min.js +1 -0
- package/{build/index.d.ts → index.d.ts} +11 -11
- package/package.json +14 -88
- package/{build/typings → typings}/BasePicker.d.ts +2 -0
- package/{build/typings → typings}/overrides.d.ts +2 -2
- package/{build/views → views}/Calendar/Calendar.js +4 -3
- package/{build/views → views}/Calendar/CalendarHeader.js +1 -1
- package/{build/views → views}/Clock/Clock.d.ts +1 -1
- package/{build/views → views}/Clock/Clock.js +1 -1
- package/{build/views → views}/Clock/ClockNumbers.d.ts +2 -2
- package/{build/views → views}/Clock/ClockPointer.d.ts +1 -1
- package/{build/views → views}/Clock/ClockView.js +1 -1
- package/{build/views → views}/Month/MonthView.js +1 -1
- package/{build/views → views}/Year/YearView.js +2 -2
- package/.size-snapshot.json +0 -26
- package/build/_helpers/text-field-helper.d.ts +0 -32
- package/build/_helpers/text-field-helper.js +0 -88
- package/build/dist/material-ui-pickers.esm.js.map +0 -1
- package/build/dist/material-ui-pickers.js.map +0 -1
- package/build/dist/material-ui-pickers.umd.min.js +0 -1
- package/build/package.json +0 -63
- package/copy.js +0 -58
- package/coverage/clover.xml +0 -1589
- package/coverage/coverage-final.json +0 -57
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -79
- package/coverage/lcov-report/index.html +0 -279
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -170
- package/coverage/lcov-report/src/DatePicker/DatePicker.tsx.html +0 -342
- package/coverage/lcov-report/src/DatePicker/DatePickerToolbar.tsx.html +0 -294
- package/coverage/lcov-report/src/DatePicker/index.html +0 -123
- package/coverage/lcov-report/src/DatePicker/index.ts.html +0 -90
- package/coverage/lcov-report/src/DateTimePicker/DateTimePicker.tsx.html +0 -285
- package/coverage/lcov-report/src/DateTimePicker/DateTimePickerTabs.tsx.html +0 -327
- package/coverage/lcov-report/src/DateTimePicker/DateTimePickerToolbar.tsx.html +0 -438
- package/coverage/lcov-report/src/DateTimePicker/index.html +0 -123
- package/coverage/lcov-report/src/MuiPickersUtilsProvider.tsx.html +0 -186
- package/coverage/lcov-report/src/Picker/Picker.tsx.html +0 -873
- package/coverage/lcov-report/src/Picker/WrappedKeyboardPicker.tsx.html +0 -465
- package/coverage/lcov-report/src/Picker/WrappedPurePicker.tsx.html +0 -435
- package/coverage/lcov-report/src/Picker/index.html +0 -123
- package/coverage/lcov-report/src/TimePicker/TimePicker.tsx.html +0 -270
- package/coverage/lcov-report/src/TimePicker/TimePickerToolbar.tsx.html +0 -609
- package/coverage/lcov-report/src/TimePicker/index.html +0 -110
- package/coverage/lcov-report/src/_helpers/date-utils.ts.html +0 -345
- package/coverage/lcov-report/src/_helpers/index.html +0 -136
- package/coverage/lcov-report/src/_helpers/text-field-helper.ts.html +0 -564
- package/coverage/lcov-report/src/_helpers/time-utils.ts.html +0 -318
- package/coverage/lcov-report/src/_helpers/utils.ts.html +0 -93
- package/coverage/lcov-report/src/_shared/KeyboardDateInput.tsx.html +0 -438
- package/coverage/lcov-report/src/_shared/ModalDialog.tsx.html +0 -411
- package/coverage/lcov-report/src/_shared/PickerToolbar.tsx.html +0 -225
- package/coverage/lcov-report/src/_shared/PureDateInput.tsx.html +0 -204
- package/coverage/lcov-report/src/_shared/ToolbarButton.tsx.html +0 -258
- package/coverage/lcov-report/src/_shared/ToolbarText.tsx.html +0 -216
- package/coverage/lcov-report/src/_shared/WithUtils.tsx.html +0 -126
- package/coverage/lcov-report/src/_shared/hooks/index.html +0 -175
- package/coverage/lcov-report/src/_shared/hooks/useIsLandscape.tsx.html +0 -150
- package/coverage/lcov-report/src/_shared/hooks/useKeyDown.ts.html +0 -171
- package/coverage/lcov-report/src/_shared/hooks/useKeyboardPickerState.ts.html +0 -285
- package/coverage/lcov-report/src/_shared/hooks/useOpenState.ts.html +0 -135
- package/coverage/lcov-report/src/_shared/hooks/usePickerState.ts.html +0 -474
- package/coverage/lcov-report/src/_shared/hooks/useUtils.ts.html +0 -129
- package/coverage/lcov-report/src/_shared/hooks/useViews.tsx.html +0 -162
- package/coverage/lcov-report/src/_shared/icons/ArrowLeftIcon.tsx.html +0 -102
- package/coverage/lcov-report/src/_shared/icons/ArrowRightIcon.tsx.html +0 -102
- package/coverage/lcov-report/src/_shared/icons/DateRangeIcon.tsx.html +0 -102
- package/coverage/lcov-report/src/_shared/icons/KeyboardIcon.tsx.html +0 -102
- package/coverage/lcov-report/src/_shared/icons/TimeIcon.tsx.html +0 -105
- package/coverage/lcov-report/src/_shared/icons/index.html +0 -149
- package/coverage/lcov-report/src/_shared/index.html +0 -175
- package/coverage/lcov-report/src/constants/ClockType.ts.html +0 -102
- package/coverage/lcov-report/src/constants/dimensions.ts.html +0 -84
- package/coverage/lcov-report/src/constants/index.html +0 -123
- package/coverage/lcov-report/src/constants/prop-types.ts.html +0 -180
- package/coverage/lcov-report/src/index.html +0 -97
- package/coverage/lcov-report/src/views/Calendar/Calendar.tsx.html +0 -1149
- package/coverage/lcov-report/src/views/Calendar/CalendarHeader.tsx.html +0 -492
- package/coverage/lcov-report/src/views/Calendar/Day.tsx.html +0 -360
- package/coverage/lcov-report/src/views/Calendar/DayWrapper.tsx.html +0 -168
- package/coverage/lcov-report/src/views/Calendar/SlideTransition.tsx.html +0 -369
- package/coverage/lcov-report/src/views/Calendar/index.html +0 -149
- package/coverage/lcov-report/src/views/Clock/Clock.tsx.html +0 -585
- package/coverage/lcov-report/src/views/Clock/ClockNumber.tsx.html +0 -342
- package/coverage/lcov-report/src/views/Clock/ClockNumbers.tsx.html +0 -297
- package/coverage/lcov-report/src/views/Clock/ClockPointer.tsx.html +0 -381
- package/coverage/lcov-report/src/views/Clock/ClockView.tsx.html +0 -384
- package/coverage/lcov-report/src/views/Clock/index.html +0 -149
- package/coverage/lcov-report/src/views/Month/Month.tsx.html +0 -297
- package/coverage/lcov-report/src/views/Month/MonthView.tsx.html +0 -351
- package/coverage/lcov-report/src/views/Month/index.html +0 -110
- package/coverage/lcov-report/src/views/Year/Year.tsx.html +0 -300
- package/coverage/lcov-report/src/views/Year/YearView.tsx.html +0 -342
- package/coverage/lcov-report/src/views/Year/index.html +0 -110
- package/coverage/lcov-report/src/wrappers/InlineWrapper.tsx.html +0 -309
- package/coverage/lcov-report/src/wrappers/ModalWrapper.tsx.html +0 -408
- package/coverage/lcov-report/src/wrappers/StaticWrapper.tsx.html +0 -135
- package/coverage/lcov-report/src/wrappers/Wrapper.tsx.html +0 -294
- package/coverage/lcov-report/src/wrappers/index.html +0 -136
- package/coverage/lcov.info +0 -2815
- package/remove-prop-types.js +0 -37
- package/rollup.config.js +0 -143
- package/src/DatePicker/DatePicker.tsx +0 -91
- package/src/DatePicker/DatePickerToolbar.tsx +0 -75
- package/src/DatePicker/index.ts +0 -7
- package/src/DateTimePicker/DateTimePicker.tsx +0 -72
- package/src/DateTimePicker/DateTimePickerTabs.tsx +0 -86
- package/src/DateTimePicker/DateTimePickerToolbar.tsx +0 -123
- package/src/DateTimePicker/index.ts +0 -7
- package/src/MuiPickersUtilsProvider.tsx +0 -39
- package/src/Picker/Picker.tsx +0 -268
- package/src/Picker/WrappedKeyboardPicker.tsx +0 -132
- package/src/Picker/WrappedPurePicker.tsx +0 -124
- package/src/TimePicker/TimePicker.tsx +0 -67
- package/src/TimePicker/TimePickerToolbar.tsx +0 -180
- package/src/TimePicker/index.tsx +0 -7
- package/src/__tests__/DatePicker/Calendar.test.tsx +0 -51
- package/src/__tests__/DatePicker/Month.test.tsx +0 -36
- package/src/__tests__/DatePicker/MonthSelection.test.tsx +0 -37
- package/src/__tests__/MuiPickersUtilsProvider.test.tsx +0 -21
- package/src/__tests__/TimePicker/Clock.test.tsx +0 -68
- package/src/__tests__/_helpers/date-utils.test.tsx +0 -197
- package/src/__tests__/_helpers/text-field-helper.test.tsx +0 -34
- package/src/__tests__/_shared/ModalDialog.test.tsx +0 -109
- package/src/__tests__/e2e/DatePicker.test.tsx +0 -233
- package/src/__tests__/e2e/DatePickerProps.test.tsx +0 -18
- package/src/__tests__/e2e/DatePickerRoot.test.tsx +0 -154
- package/src/__tests__/e2e/DateTimePicker.test.tsx +0 -86
- package/src/__tests__/e2e/DateTimePickerRoot.test.tsx +0 -72
- package/src/__tests__/e2e/KeyboardDatePicker.test.tsx +0 -140
- package/src/__tests__/e2e/KeyboardDateTimePicker.test.tsx +0 -48
- package/src/__tests__/e2e/Theme.test.tsx +0 -30
- package/src/__tests__/e2e/TimePicker.test.tsx +0 -121
- package/src/__tests__/e2e/commands.tsx +0 -8
- package/src/__tests__/setup.js +0 -26
- package/src/__tests__/test-utils.tsx +0 -45
- package/src/__tests__/tsconfig.json +0 -5
- package/src/_helpers/date-utils.ts +0 -92
- package/src/_helpers/text-field-helper.ts +0 -165
- package/src/_helpers/time-utils.ts +0 -83
- package/src/_helpers/utils.ts +0 -8
- package/src/_shared/KeyboardDateInput.tsx +0 -123
- package/src/_shared/ModalDialog.tsx +0 -114
- package/src/_shared/PickerToolbar.tsx +0 -52
- package/src/_shared/PureDateInput.tsx +0 -45
- package/src/_shared/ToolbarButton.tsx +0 -63
- package/src/_shared/ToolbarText.tsx +0 -49
- package/src/_shared/WithUtils.tsx +0 -19
- package/src/_shared/hooks/useIsLandscape.tsx +0 -27
- package/src/_shared/hooks/useKeyDown.ts +0 -34
- package/src/_shared/hooks/useKeyboardPickerState.ts +0 -72
- package/src/_shared/hooks/useOpenState.ts +0 -22
- package/src/_shared/hooks/usePickerState.ts +0 -135
- package/src/_shared/hooks/useUtils.ts +0 -20
- package/src/_shared/hooks/useViews.tsx +0 -31
- package/src/_shared/icons/ArrowLeftIcon.tsx +0 -11
- package/src/_shared/icons/ArrowRightIcon.tsx +0 -11
- package/src/_shared/icons/DateRangeIcon.tsx +0 -11
- package/src/_shared/icons/KeyboardIcon.tsx +0 -11
- package/src/_shared/icons/TimeIcon.tsx +0 -12
- package/src/constants/ClockType.ts +0 -11
- package/src/constants/dimensions.ts +0 -5
- package/src/constants/prop-types.ts +0 -37
- package/src/index.ts +0 -48
- package/src/typings/BasePicker.tsx +0 -58
- package/src/typings/date.ts +0 -3
- package/src/typings/extendMui.ts +0 -10
- package/src/typings/overrides.ts +0 -54
- package/src/views/Calendar/Calendar.tsx +0 -360
- package/src/views/Calendar/CalendarHeader.tsx +0 -141
- package/src/views/Calendar/Day.tsx +0 -97
- package/src/views/Calendar/DayWrapper.tsx +0 -33
- package/src/views/Calendar/SlideTransition.tsx +0 -100
- package/src/views/Clock/Clock.tsx +0 -172
- package/src/views/Clock/ClockNumber.tsx +0 -91
- package/src/views/Clock/ClockNumbers.tsx +0 -76
- package/src/views/Clock/ClockPointer.tsx +0 -104
- package/src/views/Clock/ClockView.tsx +0 -105
- package/src/views/Month/Month.tsx +0 -76
- package/src/views/Month/MonthView.tsx +0 -94
- package/src/views/Year/Year.tsx +0 -77
- package/src/views/Year/YearView.tsx +0 -91
- package/src/wrappers/InlineWrapper.tsx +0 -80
- package/src/wrappers/ModalWrapper.tsx +0 -113
- package/src/wrappers/StaticWrapper.tsx +0 -22
- package/src/wrappers/Wrapper.tsx +0 -75
- package/tsconfig.json +0 -21
- package/typings.d.ts +0 -6
- /package/{build/DatePicker → DatePicker}/DatePickerToolbar.d.ts +0 -0
- /package/{build/DatePicker → DatePicker}/index.d.ts +0 -0
- /package/{build/DatePicker → DatePicker}/index.js +0 -0
- /package/{build/DateTimePicker → DateTimePicker}/DateTimePickerTabs.d.ts +0 -0
- /package/{build/DateTimePicker → DateTimePicker}/DateTimePickerTabs.js +0 -0
- /package/{build/DateTimePicker → DateTimePicker}/DateTimePickerToolbar.d.ts +0 -0
- /package/{build/DateTimePicker → DateTimePicker}/index.d.ts +0 -0
- /package/{build/DateTimePicker → DateTimePicker}/index.js +0 -0
- /package/{build/Picker → Picker}/WrappedKeyboardPicker.d.ts +0 -0
- /package/{build/Picker → Picker}/WrappedPurePicker.d.ts +0 -0
- /package/{build/TimePicker → TimePicker}/TimePickerToolbar.d.ts +0 -0
- /package/{build/TimePicker → TimePicker}/index.d.ts +0 -0
- /package/{build/TimePicker → TimePicker}/index.js +0 -0
- /package/{build/_helpers → _helpers}/time-utils.js +0 -0
- /package/{build/_helpers → _helpers}/utils.d.ts +0 -0
- /package/{build/_helpers → _helpers}/utils.js +0 -0
- /package/{build/_shared → _shared}/ModalDialog.js +0 -0
- /package/{build/_shared → _shared}/PickerToolbar.d.ts +0 -0
- /package/{build/_shared → _shared}/PickerToolbar.js +0 -0
- /package/{build/_shared → _shared}/PureDateInput.d.ts +0 -0
- /package/{build/_shared → _shared}/ToolbarButton.js +0 -0
- /package/{build/_shared → _shared}/ToolbarText.d.ts +0 -0
- /package/{build/_shared → _shared}/ToolbarText.js +0 -0
- /package/{build/_shared → _shared}/WithUtils.js +0 -0
- /package/{build/_shared → _shared}/hooks/useIsLandscape.d.ts +0 -0
- /package/{build/_shared → _shared}/hooks/useKeyDown.d.ts +0 -0
- /package/{build/_shared → _shared}/hooks/useKeyDown.js +0 -0
- /package/{build/_shared → _shared}/hooks/useOpenState.d.ts +0 -0
- /package/{build/_shared → _shared}/hooks/useOpenState.js +0 -0
- /package/{build/_shared → _shared}/hooks/useUtils.js +0 -0
- /package/{build/_shared → _shared}/hooks/useViews.d.ts +0 -0
- /package/{build/_shared → _shared}/hooks/useViews.js +0 -0
- /package/{build/_shared → _shared}/icons/ArrowLeftIcon.d.ts +0 -0
- /package/{build/_shared → _shared}/icons/ArrowLeftIcon.js +0 -0
- /package/{build/_shared → _shared}/icons/ArrowRightIcon.d.ts +0 -0
- /package/{build/_shared → _shared}/icons/ArrowRightIcon.js +0 -0
- /package/{build/_shared → _shared}/icons/DateRangeIcon.d.ts +0 -0
- /package/{build/_shared → _shared}/icons/DateRangeIcon.js +0 -0
- /package/{build/_shared → _shared}/icons/KeyboardIcon.d.ts +0 -0
- /package/{build/_shared → _shared}/icons/KeyboardIcon.js +0 -0
- /package/{build/_shared → _shared}/icons/TimeIcon.d.ts +0 -0
- /package/{build/_shared → _shared}/icons/TimeIcon.js +0 -0
- /package/{build/constants → constants}/ClockType.d.ts +0 -0
- /package/{build/constants → constants}/ClockType.js +0 -0
- /package/{build/constants → constants}/dimensions.d.ts +0 -0
- /package/{build/constants → constants}/dimensions.js +0 -0
- /package/{build/constants → constants}/prop-types.d.ts +0 -0
- /package/{build/index.js → index.js} +0 -0
- /package/{build/typings → typings}/BasePicker.js +0 -0
- /package/{build/typings → typings}/date.d.ts +0 -0
- /package/{build/typings → typings}/date.js +0 -0
- /package/{build/typings → typings}/extendMui.d.ts +0 -0
- /package/{build/typings → typings}/extendMui.js +0 -0
- /package/{build/typings → typings}/overrides.js +0 -0
- /package/{build/views → views}/Calendar/Calendar.d.ts +0 -0
- /package/{build/views → views}/Calendar/CalendarHeader.d.ts +0 -0
- /package/{build/views → views}/Calendar/Day.d.ts +0 -0
- /package/{build/views → views}/Calendar/Day.js +0 -0
- /package/{build/views → views}/Calendar/DayWrapper.d.ts +0 -0
- /package/{build/views → views}/Calendar/DayWrapper.js +0 -0
- /package/{build/views → views}/Calendar/SlideTransition.d.ts +0 -0
- /package/{build/views → views}/Calendar/SlideTransition.js +0 -0
- /package/{build/views → views}/Clock/ClockNumber.d.ts +0 -0
- /package/{build/views → views}/Clock/ClockNumber.js +0 -0
- /package/{build/views → views}/Clock/ClockNumbers.js +0 -0
- /package/{build/views → views}/Clock/ClockPointer.js +0 -0
- /package/{build/views → views}/Clock/ClockView.d.ts +0 -0
- /package/{build/views → views}/Month/Month.d.ts +0 -0
- /package/{build/views → views}/Month/Month.js +0 -0
- /package/{build/views → views}/Month/MonthView.d.ts +0 -0
- /package/{build/views → views}/Year/Year.d.ts +0 -0
- /package/{build/views → views}/Year/Year.js +0 -0
- /package/{build/views → views}/Year/YearView.d.ts +0 -0
- /package/{build/wrappers → wrappers}/InlineWrapper.d.ts +0 -0
- /package/{build/wrappers → wrappers}/InlineWrapper.js +0 -0
- /package/{build/wrappers → wrappers}/ModalWrapper.d.ts +0 -0
- /package/{build/wrappers → wrappers}/ModalWrapper.js +0 -0
- /package/{build/wrappers → wrappers}/StaticWrapper.d.ts +0 -0
- /package/{build/wrappers → wrappers}/StaticWrapper.js +0 -0
- /package/{build/wrappers → wrappers}/Wrapper.d.ts +0 -0
- /package/{build/wrappers → wrappers}/Wrapper.js +0 -0
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
|
-
import Day from './Day';
|
|
4
|
-
import DayWrapper from './DayWrapper';
|
|
5
|
-
import CalendarHeader from './CalendarHeader';
|
|
6
|
-
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
7
|
-
import SlideTransition, { SlideDirection } from './SlideTransition';
|
|
8
|
-
import { Theme } from '@material-ui/core';
|
|
9
|
-
import { MaterialUiPickersDate } from '../../typings/date';
|
|
10
|
-
import { runKeyHandler } from '../../_shared/hooks/useKeyDown';
|
|
11
|
-
import { IconButtonProps } from '@material-ui/core/IconButton';
|
|
12
|
-
import { withStyles, WithStyles } from '@material-ui/core/styles';
|
|
13
|
-
import { findClosestEnabledDate } from '../../_helpers/date-utils';
|
|
14
|
-
import { withUtils, WithUtilsProps } from '../../_shared/WithUtils';
|
|
15
|
-
|
|
16
|
-
export interface OutterCalendarProps {
|
|
17
|
-
/** Left arrow icon */
|
|
18
|
-
leftArrowIcon?: React.ReactNode;
|
|
19
|
-
/** Right arrow icon */
|
|
20
|
-
rightArrowIcon?: React.ReactNode;
|
|
21
|
-
/** Custom renderer for day */
|
|
22
|
-
renderDay?: (
|
|
23
|
-
day: MaterialUiPickersDate,
|
|
24
|
-
selectedDate: MaterialUiPickersDate,
|
|
25
|
-
dayInCurrentMonth: boolean,
|
|
26
|
-
dayComponent: JSX.Element
|
|
27
|
-
) => JSX.Element;
|
|
28
|
-
/**
|
|
29
|
-
* Enables keyboard listener for moving between days in calendar
|
|
30
|
-
* @default true
|
|
31
|
-
*/
|
|
32
|
-
allowKeyboardControl?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Props to pass to left arrow button
|
|
35
|
-
* @type {Partial<IconButtonProps>}
|
|
36
|
-
*/
|
|
37
|
-
leftArrowButtonProps?: Partial<IconButtonProps>;
|
|
38
|
-
/**
|
|
39
|
-
* Props to pass to right arrow button
|
|
40
|
-
* @type {Partial<IconButtonProps>}
|
|
41
|
-
*/
|
|
42
|
-
rightArrowButtonProps?: Partial<IconButtonProps>;
|
|
43
|
-
/** Disable specific date */
|
|
44
|
-
shouldDisableDate?: (day: MaterialUiPickersDate) => boolean;
|
|
45
|
-
/** Callback firing on month change. Return promise to render spinner till it will not be resolved */
|
|
46
|
-
onMonthChange?: (date: MaterialUiPickersDate) => void | Promise<void>;
|
|
47
|
-
/** Custom loading indicator */
|
|
48
|
-
loadingIndicator?: JSX.Element;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface CalendarProps
|
|
52
|
-
extends OutterCalendarProps,
|
|
53
|
-
WithUtilsProps,
|
|
54
|
-
WithStyles<typeof styles, true> {
|
|
55
|
-
/** Calendar Date */
|
|
56
|
-
date: MaterialUiPickersDate;
|
|
57
|
-
/** Calendar onChange */
|
|
58
|
-
onChange: (date: MaterialUiPickersDate, isFinish?: boolean) => void;
|
|
59
|
-
/** Min date */
|
|
60
|
-
minDate?: MaterialUiPickersDate;
|
|
61
|
-
/** Max date */
|
|
62
|
-
maxDate?: MaterialUiPickersDate;
|
|
63
|
-
/** Disable past dates */
|
|
64
|
-
disablePast?: boolean;
|
|
65
|
-
/** Disable future dates */
|
|
66
|
-
disableFuture?: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface CalendarState {
|
|
70
|
-
slideDirection: SlideDirection;
|
|
71
|
-
currentMonth: MaterialUiPickersDate;
|
|
72
|
-
lastDate?: MaterialUiPickersDate;
|
|
73
|
-
loadingQueue: number;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const KeyDownListener = ({ onKeyDown }: { onKeyDown: (e: KeyboardEvent) => void }) => {
|
|
77
|
-
React.useEffect(() => {
|
|
78
|
-
window.addEventListener('keydown', onKeyDown);
|
|
79
|
-
return () => {
|
|
80
|
-
window.removeEventListener('keydown', onKeyDown);
|
|
81
|
-
};
|
|
82
|
-
}, [onKeyDown]);
|
|
83
|
-
|
|
84
|
-
return null;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export class Calendar extends React.Component<CalendarProps, CalendarState> {
|
|
88
|
-
static propTypes: any = {
|
|
89
|
-
renderDay: PropTypes.func,
|
|
90
|
-
shouldDisableDate: PropTypes.func,
|
|
91
|
-
allowKeyboardControl: PropTypes.bool,
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
static defaultProps: Partial<CalendarProps> = {
|
|
95
|
-
minDate: new Date('1900-01-01'),
|
|
96
|
-
maxDate: new Date('2100-01-01'),
|
|
97
|
-
disablePast: false,
|
|
98
|
-
disableFuture: false,
|
|
99
|
-
allowKeyboardControl: true,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
static getDerivedStateFromProps(nextProps: CalendarProps, state: CalendarState) {
|
|
103
|
-
const { utils, date: nextDate } = nextProps;
|
|
104
|
-
|
|
105
|
-
if (!utils.isEqual(nextDate, state.lastDate)) {
|
|
106
|
-
const nextMonth = utils.getMonth(nextDate);
|
|
107
|
-
const lastDate = state.lastDate || nextDate;
|
|
108
|
-
const lastMonth = utils.getMonth(lastDate);
|
|
109
|
-
|
|
110
|
-
return {
|
|
111
|
-
lastDate: nextDate,
|
|
112
|
-
currentMonth: nextProps.utils.startOfMonth(nextDate),
|
|
113
|
-
// prettier-ignore
|
|
114
|
-
slideDirection: nextMonth === lastMonth
|
|
115
|
-
? state.slideDirection
|
|
116
|
-
: utils.isAfterDay(nextDate, lastDate)
|
|
117
|
-
? 'left'
|
|
118
|
-
: 'right'
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
state: CalendarState = {
|
|
126
|
-
slideDirection: 'left',
|
|
127
|
-
currentMonth: this.props.utils.startOfMonth(this.props.date),
|
|
128
|
-
loadingQueue: 0,
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
componentDidMount() {
|
|
132
|
-
const { date, minDate, maxDate, utils, disablePast, disableFuture } = this.props;
|
|
133
|
-
|
|
134
|
-
if (this.shouldDisableDate(date)) {
|
|
135
|
-
const closestEnabledDate = findClosestEnabledDate({
|
|
136
|
-
date,
|
|
137
|
-
utils,
|
|
138
|
-
minDate: utils.date(minDate),
|
|
139
|
-
maxDate: utils.date(maxDate),
|
|
140
|
-
disablePast: Boolean(disablePast),
|
|
141
|
-
disableFuture: Boolean(disableFuture),
|
|
142
|
-
shouldDisableDate: this.shouldDisableDate,
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
this.handleDaySelect(closestEnabledDate, false);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
private pushToLoadingQueue = () => {
|
|
150
|
-
const loadingQueue = this.state.loadingQueue + 1;
|
|
151
|
-
this.setState({ loadingQueue });
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
private popFromLoadingQueue = () => {
|
|
155
|
-
let loadingQueue = this.state.loadingQueue;
|
|
156
|
-
loadingQueue = loadingQueue <= 0 ? 0 : loadingQueue - 1;
|
|
157
|
-
this.setState({ loadingQueue });
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
handleChangeMonth = (newMonth: MaterialUiPickersDate, slideDirection: SlideDirection) => {
|
|
161
|
-
this.setState({ currentMonth: newMonth, slideDirection });
|
|
162
|
-
|
|
163
|
-
if (this.props.onMonthChange) {
|
|
164
|
-
const returnVal = this.props.onMonthChange(newMonth);
|
|
165
|
-
if (returnVal) {
|
|
166
|
-
this.pushToLoadingQueue();
|
|
167
|
-
returnVal.then(() => {
|
|
168
|
-
this.popFromLoadingQueue();
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
validateMinMaxDate = (day: MaterialUiPickersDate) => {
|
|
175
|
-
const { minDate, maxDate, utils, disableFuture, disablePast } = this.props;
|
|
176
|
-
const now = utils.date();
|
|
177
|
-
|
|
178
|
-
return Boolean(
|
|
179
|
-
(disableFuture && utils.isAfterDay(day, now)) ||
|
|
180
|
-
(disablePast && utils.isBeforeDay(day, now)) ||
|
|
181
|
-
(minDate && utils.isBeforeDay(day, utils.date(minDate))) ||
|
|
182
|
-
(maxDate && utils.isAfterDay(day, utils.date(maxDate)))
|
|
183
|
-
);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
shouldDisablePrevMonth = () => {
|
|
187
|
-
const { utils, disablePast, minDate } = this.props;
|
|
188
|
-
|
|
189
|
-
const now = utils.date();
|
|
190
|
-
const firstEnabledMonth = utils.startOfMonth(
|
|
191
|
-
disablePast && utils.isAfter(now, utils.date(minDate)) ? now : utils.date(minDate)
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
return !utils.isBefore(firstEnabledMonth, this.state.currentMonth);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
shouldDisableNextMonth = () => {
|
|
198
|
-
const { utils, disableFuture, maxDate } = this.props;
|
|
199
|
-
|
|
200
|
-
const now = utils.date();
|
|
201
|
-
const lastEnabledMonth = utils.startOfMonth(
|
|
202
|
-
disableFuture && utils.isBefore(now, utils.date(maxDate)) ? now : utils.date(maxDate)
|
|
203
|
-
);
|
|
204
|
-
|
|
205
|
-
return !utils.isAfter(lastEnabledMonth, this.state.currentMonth);
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
shouldDisableDate = (day: MaterialUiPickersDate) => {
|
|
209
|
-
const { shouldDisableDate } = this.props;
|
|
210
|
-
|
|
211
|
-
return this.validateMinMaxDate(day) || Boolean(shouldDisableDate && shouldDisableDate(day));
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
handleDaySelect = (day: MaterialUiPickersDate, isFinish = true) => {
|
|
215
|
-
const { date, utils } = this.props;
|
|
216
|
-
|
|
217
|
-
this.props.onChange(utils.mergeDateAndTime(day, date), isFinish);
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
moveToDay = (day: MaterialUiPickersDate) => {
|
|
221
|
-
const { utils } = this.props;
|
|
222
|
-
|
|
223
|
-
if (day && !this.shouldDisableDate(day)) {
|
|
224
|
-
if (utils.getMonth(day) !== utils.getMonth(this.state.currentMonth)) {
|
|
225
|
-
this.handleChangeMonth(utils.startOfMonth(day), 'left');
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
this.handleDaySelect(day, false);
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
handleKeyDown = (event: KeyboardEvent) => {
|
|
233
|
-
const { theme, date, utils } = this.props;
|
|
234
|
-
|
|
235
|
-
runKeyHandler(event, {
|
|
236
|
-
ArrowUp: () => this.moveToDay(utils.addDays(date, -7)),
|
|
237
|
-
ArrowDown: () => this.moveToDay(utils.addDays(date, 7)),
|
|
238
|
-
ArrowLeft: () => this.moveToDay(utils.addDays(date, theme.direction === 'ltr' ? -1 : 1)),
|
|
239
|
-
ArrowRight: () => this.moveToDay(utils.addDays(date, theme.direction === 'ltr' ? 1 : -1)),
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
private renderWeeks = () => {
|
|
244
|
-
const { utils, classes } = this.props;
|
|
245
|
-
const weeks = utils.getWeekArray(this.state.currentMonth);
|
|
246
|
-
|
|
247
|
-
return weeks.map(week => (
|
|
248
|
-
<div key={`week-${week[0]!.toString()}`} className={classes.week}>
|
|
249
|
-
{this.renderDays(week)}
|
|
250
|
-
</div>
|
|
251
|
-
));
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
private renderDays = (week: MaterialUiPickersDate[]) => {
|
|
255
|
-
const { date, renderDay, utils } = this.props;
|
|
256
|
-
|
|
257
|
-
const now = utils.date();
|
|
258
|
-
const selectedDate = utils.startOfDay(date);
|
|
259
|
-
const currentMonthNumber = utils.getMonth(this.state.currentMonth);
|
|
260
|
-
|
|
261
|
-
return week.map(day => {
|
|
262
|
-
const disabled = this.shouldDisableDate(day);
|
|
263
|
-
const isDayInCurrentMonth = utils.getMonth(day) === currentMonthNumber;
|
|
264
|
-
|
|
265
|
-
let dayComponent = (
|
|
266
|
-
<Day
|
|
267
|
-
disabled={disabled}
|
|
268
|
-
current={utils.isSameDay(day, now)}
|
|
269
|
-
hidden={!isDayInCurrentMonth}
|
|
270
|
-
selected={utils.isSameDay(selectedDate, day)}
|
|
271
|
-
>
|
|
272
|
-
{utils.getDayText(day)}
|
|
273
|
-
</Day>
|
|
274
|
-
);
|
|
275
|
-
|
|
276
|
-
if (renderDay) {
|
|
277
|
-
dayComponent = renderDay(day, selectedDate, isDayInCurrentMonth, dayComponent);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return (
|
|
281
|
-
<DayWrapper
|
|
282
|
-
value={day}
|
|
283
|
-
key={day!.toString()}
|
|
284
|
-
disabled={disabled}
|
|
285
|
-
dayInCurrentMonth={isDayInCurrentMonth}
|
|
286
|
-
onSelect={this.handleDaySelect}
|
|
287
|
-
>
|
|
288
|
-
{dayComponent}
|
|
289
|
-
</DayWrapper>
|
|
290
|
-
);
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
render() {
|
|
295
|
-
const { currentMonth, slideDirection } = this.state;
|
|
296
|
-
const {
|
|
297
|
-
classes,
|
|
298
|
-
allowKeyboardControl,
|
|
299
|
-
leftArrowButtonProps,
|
|
300
|
-
leftArrowIcon,
|
|
301
|
-
rightArrowButtonProps,
|
|
302
|
-
rightArrowIcon,
|
|
303
|
-
loadingIndicator,
|
|
304
|
-
} = this.props;
|
|
305
|
-
const loadingElement = loadingIndicator ? loadingIndicator : <CircularProgress />;
|
|
306
|
-
|
|
307
|
-
return (
|
|
308
|
-
<React.Fragment>
|
|
309
|
-
{allowKeyboardControl && <KeyDownListener onKeyDown={this.handleKeyDown} />}
|
|
310
|
-
|
|
311
|
-
<CalendarHeader
|
|
312
|
-
currentMonth={currentMonth!}
|
|
313
|
-
slideDirection={slideDirection}
|
|
314
|
-
onMonthChange={this.handleChangeMonth}
|
|
315
|
-
leftArrowIcon={leftArrowIcon}
|
|
316
|
-
leftArrowButtonProps={leftArrowButtonProps}
|
|
317
|
-
rightArrowIcon={rightArrowIcon}
|
|
318
|
-
rightArrowButtonProps={rightArrowButtonProps}
|
|
319
|
-
disablePrevMonth={this.shouldDisablePrevMonth()}
|
|
320
|
-
disableNextMonth={this.shouldDisableNextMonth()}
|
|
321
|
-
/>
|
|
322
|
-
|
|
323
|
-
<SlideTransition
|
|
324
|
-
slideDirection={slideDirection}
|
|
325
|
-
transKey={currentMonth!.toString()}
|
|
326
|
-
className={classes.transitionContainer}
|
|
327
|
-
>
|
|
328
|
-
<>
|
|
329
|
-
{(this.state.loadingQueue > 0 && (
|
|
330
|
-
<div className={classes.progressContainer}>{loadingElement}</div>
|
|
331
|
-
)) || <div>{this.renderWeeks()}</div>}
|
|
332
|
-
</>
|
|
333
|
-
</SlideTransition>
|
|
334
|
-
</React.Fragment>
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
export const styles = (theme: Theme) => ({
|
|
340
|
-
transitionContainer: {
|
|
341
|
-
minHeight: 36 * 6,
|
|
342
|
-
marginTop: theme.spacing(1.5),
|
|
343
|
-
},
|
|
344
|
-
progressContainer: {
|
|
345
|
-
width: '100%',
|
|
346
|
-
height: '100%',
|
|
347
|
-
display: 'flex',
|
|
348
|
-
justifyContent: 'center',
|
|
349
|
-
alignItems: 'center',
|
|
350
|
-
},
|
|
351
|
-
week: {
|
|
352
|
-
display: 'flex',
|
|
353
|
-
justifyContent: 'center',
|
|
354
|
-
},
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
export default withStyles(styles, {
|
|
358
|
-
name: 'MuiPickersCalendar',
|
|
359
|
-
withTheme: true,
|
|
360
|
-
})(withUtils()(Calendar));
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
|
-
import Typography from '@material-ui/core/Typography';
|
|
4
|
-
import SlideTransition, { SlideDirection } from './SlideTransition';
|
|
5
|
-
import IconButton, { IconButtonProps } from '@material-ui/core/IconButton';
|
|
6
|
-
import { DateType } from '@date-io/type';
|
|
7
|
-
import { useUtils } from '../../_shared/hooks/useUtils';
|
|
8
|
-
import { MaterialUiPickersDate } from '../../typings/date';
|
|
9
|
-
import { makeStyles, useTheme } from '@material-ui/core/styles';
|
|
10
|
-
import { ArrowLeftIcon } from '../../_shared/icons/ArrowLeftIcon';
|
|
11
|
-
import { ArrowRightIcon } from '../../_shared/icons/ArrowRightIcon';
|
|
12
|
-
|
|
13
|
-
export interface CalendarHeaderProps {
|
|
14
|
-
currentMonth: DateType;
|
|
15
|
-
leftArrowIcon?: React.ReactNode;
|
|
16
|
-
rightArrowIcon?: React.ReactNode;
|
|
17
|
-
leftArrowButtonProps?: Partial<IconButtonProps>;
|
|
18
|
-
rightArrowButtonProps?: Partial<IconButtonProps>;
|
|
19
|
-
disablePrevMonth?: boolean;
|
|
20
|
-
disableNextMonth?: boolean;
|
|
21
|
-
slideDirection: SlideDirection;
|
|
22
|
-
onMonthChange: (date: MaterialUiPickersDate, direction: SlideDirection) => void | Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const useStyles = makeStyles(
|
|
26
|
-
theme => ({
|
|
27
|
-
switchHeader: {
|
|
28
|
-
display: 'flex',
|
|
29
|
-
justifyContent: 'space-between',
|
|
30
|
-
alignItems: 'center',
|
|
31
|
-
marginTop: theme.spacing(0.5),
|
|
32
|
-
marginBottom: theme.spacing(1),
|
|
33
|
-
},
|
|
34
|
-
transitionContainer: {
|
|
35
|
-
width: '100%',
|
|
36
|
-
overflow: 'hidden',
|
|
37
|
-
height: 23,
|
|
38
|
-
},
|
|
39
|
-
iconButton: {
|
|
40
|
-
zIndex: 1,
|
|
41
|
-
backgroundColor: theme.palette.background.paper,
|
|
42
|
-
},
|
|
43
|
-
daysHeader: {
|
|
44
|
-
display: 'flex',
|
|
45
|
-
justifyContent: 'center',
|
|
46
|
-
alignItems: 'center',
|
|
47
|
-
maxHeight: 16,
|
|
48
|
-
},
|
|
49
|
-
dayLabel: {
|
|
50
|
-
width: 36,
|
|
51
|
-
margin: '0 2px',
|
|
52
|
-
textAlign: 'center',
|
|
53
|
-
color: theme.palette.text.hint,
|
|
54
|
-
},
|
|
55
|
-
}),
|
|
56
|
-
{ name: 'MuiPickersCalendarHeader' }
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
export const CalendarHeader: React.SFC<CalendarHeaderProps> = ({
|
|
60
|
-
currentMonth,
|
|
61
|
-
onMonthChange,
|
|
62
|
-
leftArrowIcon,
|
|
63
|
-
rightArrowIcon,
|
|
64
|
-
leftArrowButtonProps,
|
|
65
|
-
rightArrowButtonProps,
|
|
66
|
-
disablePrevMonth,
|
|
67
|
-
disableNextMonth,
|
|
68
|
-
slideDirection,
|
|
69
|
-
}) => {
|
|
70
|
-
const utils = useUtils();
|
|
71
|
-
const classes = useStyles();
|
|
72
|
-
const theme = useTheme();
|
|
73
|
-
const rtl = theme.direction === 'rtl';
|
|
74
|
-
|
|
75
|
-
const selectNextMonth = () => onMonthChange(utils.getNextMonth(currentMonth), 'left');
|
|
76
|
-
const selectPreviousMonth = () => onMonthChange(utils.getPreviousMonth(currentMonth), 'right');
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<div>
|
|
80
|
-
<div className={classes.switchHeader}>
|
|
81
|
-
<IconButton
|
|
82
|
-
{...leftArrowButtonProps}
|
|
83
|
-
disabled={disablePrevMonth}
|
|
84
|
-
onClick={selectPreviousMonth}
|
|
85
|
-
className={classes.iconButton}
|
|
86
|
-
>
|
|
87
|
-
{rtl ? rightArrowIcon : leftArrowIcon}
|
|
88
|
-
</IconButton>
|
|
89
|
-
|
|
90
|
-
<SlideTransition
|
|
91
|
-
slideDirection={slideDirection}
|
|
92
|
-
transKey={currentMonth.toString()}
|
|
93
|
-
className={classes.transitionContainer}
|
|
94
|
-
>
|
|
95
|
-
<Typography align="center" variant="body1">
|
|
96
|
-
{utils.getCalendarHeaderText(currentMonth)}
|
|
97
|
-
</Typography>
|
|
98
|
-
</SlideTransition>
|
|
99
|
-
|
|
100
|
-
<IconButton
|
|
101
|
-
{...rightArrowButtonProps}
|
|
102
|
-
disabled={disableNextMonth}
|
|
103
|
-
onClick={selectNextMonth}
|
|
104
|
-
className={classes.iconButton}
|
|
105
|
-
>
|
|
106
|
-
{rtl ? leftArrowIcon : rightArrowIcon}
|
|
107
|
-
</IconButton>
|
|
108
|
-
</div>
|
|
109
|
-
|
|
110
|
-
<div className={classes.daysHeader}>
|
|
111
|
-
{utils.getWeekdays().map((day, index) => (
|
|
112
|
-
<Typography
|
|
113
|
-
key={index} // eslint-disable-line react/no-array-index-key
|
|
114
|
-
variant="caption"
|
|
115
|
-
className={classes.dayLabel}
|
|
116
|
-
>
|
|
117
|
-
{day}
|
|
118
|
-
</Typography>
|
|
119
|
-
))}
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
CalendarHeader.displayName = 'CalendarHeader';
|
|
126
|
-
|
|
127
|
-
CalendarHeader.propTypes = {
|
|
128
|
-
leftArrowIcon: PropTypes.node,
|
|
129
|
-
rightArrowIcon: PropTypes.node,
|
|
130
|
-
disablePrevMonth: PropTypes.bool,
|
|
131
|
-
disableNextMonth: PropTypes.bool,
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
CalendarHeader.defaultProps = {
|
|
135
|
-
leftArrowIcon: <ArrowLeftIcon />,
|
|
136
|
-
rightArrowIcon: <ArrowRightIcon />,
|
|
137
|
-
disablePrevMonth: false,
|
|
138
|
-
disableNextMonth: false,
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export default CalendarHeader;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import IconButton from '@material-ui/core/IconButton';
|
|
5
|
-
import Typography from '@material-ui/core/Typography';
|
|
6
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
7
|
-
|
|
8
|
-
export const useStyles = makeStyles(
|
|
9
|
-
theme => ({
|
|
10
|
-
day: {
|
|
11
|
-
width: 36,
|
|
12
|
-
height: 36,
|
|
13
|
-
fontSize: theme.typography.caption.fontSize,
|
|
14
|
-
margin: '0 2px',
|
|
15
|
-
color: theme.palette.text.primary,
|
|
16
|
-
fontWeight: theme.typography.fontWeightMedium,
|
|
17
|
-
padding: 0,
|
|
18
|
-
},
|
|
19
|
-
hidden: {
|
|
20
|
-
opacity: 0,
|
|
21
|
-
pointerEvents: 'none',
|
|
22
|
-
},
|
|
23
|
-
current: {
|
|
24
|
-
color: theme.palette.primary.main,
|
|
25
|
-
fontWeight: 600,
|
|
26
|
-
},
|
|
27
|
-
daySelected: {
|
|
28
|
-
color: theme.palette.primary.contrastText,
|
|
29
|
-
backgroundColor: theme.palette.primary.main,
|
|
30
|
-
fontWeight: theme.typography.fontWeightMedium,
|
|
31
|
-
'&:hover': {
|
|
32
|
-
backgroundColor: theme.palette.primary.main,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
dayDisabled: {
|
|
36
|
-
pointerEvents: 'none',
|
|
37
|
-
color: theme.palette.text.hint,
|
|
38
|
-
},
|
|
39
|
-
}),
|
|
40
|
-
{ name: 'MuiPickersDay' }
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
export interface DayProps {
|
|
44
|
-
/** Day text */
|
|
45
|
-
children: React.ReactNode;
|
|
46
|
-
/** Is today */
|
|
47
|
-
current?: boolean;
|
|
48
|
-
/** Disabled? */
|
|
49
|
-
disabled?: boolean;
|
|
50
|
-
/** Hidden? */
|
|
51
|
-
hidden?: boolean;
|
|
52
|
-
/** Selected? */
|
|
53
|
-
selected?: boolean;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export const Day: React.FC<DayProps> = ({
|
|
57
|
-
children,
|
|
58
|
-
disabled,
|
|
59
|
-
hidden,
|
|
60
|
-
current,
|
|
61
|
-
selected,
|
|
62
|
-
...other
|
|
63
|
-
}) => {
|
|
64
|
-
const classes = useStyles();
|
|
65
|
-
const className = clsx(classes.day, {
|
|
66
|
-
[classes.hidden]: hidden,
|
|
67
|
-
[classes.current]: current,
|
|
68
|
-
[classes.daySelected]: selected,
|
|
69
|
-
[classes.dayDisabled]: disabled,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<IconButton className={className} tabIndex={hidden || disabled ? -1 : 0} {...other}>
|
|
74
|
-
<Typography variant="body2" color="inherit">
|
|
75
|
-
{children}
|
|
76
|
-
</Typography>
|
|
77
|
-
</IconButton>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
Day.displayName = 'Day';
|
|
82
|
-
|
|
83
|
-
Day.propTypes = {
|
|
84
|
-
current: PropTypes.bool,
|
|
85
|
-
disabled: PropTypes.bool,
|
|
86
|
-
hidden: PropTypes.bool,
|
|
87
|
-
selected: PropTypes.bool,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
Day.defaultProps = {
|
|
91
|
-
disabled: false,
|
|
92
|
-
hidden: false,
|
|
93
|
-
current: false,
|
|
94
|
-
selected: false,
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export default Day;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface DayWrapperProps {
|
|
4
|
-
value: any;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
dayInCurrentMonth?: boolean;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
onSelect: (value: any) => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const DayWrapper: React.FC<DayWrapperProps> = ({
|
|
12
|
-
children,
|
|
13
|
-
value,
|
|
14
|
-
disabled,
|
|
15
|
-
onSelect,
|
|
16
|
-
dayInCurrentMonth,
|
|
17
|
-
...other
|
|
18
|
-
}) => {
|
|
19
|
-
const handleClick = React.useCallback(() => onSelect(value), [onSelect, value]);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<div
|
|
23
|
-
role="presentation"
|
|
24
|
-
onClick={dayInCurrentMonth && !disabled ? handleClick : undefined}
|
|
25
|
-
onKeyPress={dayInCurrentMonth && !disabled ? handleClick : undefined}
|
|
26
|
-
{...other}
|
|
27
|
-
>
|
|
28
|
-
{children}
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default DayWrapper;
|