@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,100 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
4
|
-
import { CSSTransition, TransitionGroup } from 'react-transition-group';
|
|
5
|
-
|
|
6
|
-
export type SlideDirection = 'right' | 'left';
|
|
7
|
-
interface SlideTransitionProps {
|
|
8
|
-
transKey: React.Key;
|
|
9
|
-
className?: string;
|
|
10
|
-
slideDirection: SlideDirection;
|
|
11
|
-
children: React.ReactChild;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const animationDuration = 350;
|
|
15
|
-
export const useStyles = makeStyles(
|
|
16
|
-
theme => {
|
|
17
|
-
const slideTransition = theme.transitions.create('transform', {
|
|
18
|
-
duration: animationDuration,
|
|
19
|
-
easing: 'cubic-bezier(0.35, 0.8, 0.4, 1)',
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
transitionContainer: {
|
|
24
|
-
display: 'block',
|
|
25
|
-
position: 'relative',
|
|
26
|
-
'& > *': {
|
|
27
|
-
position: 'absolute',
|
|
28
|
-
top: 0,
|
|
29
|
-
right: 0,
|
|
30
|
-
left: 0,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
'slideEnter-left': {
|
|
34
|
-
willChange: 'transform',
|
|
35
|
-
transform: 'translate(100%)',
|
|
36
|
-
},
|
|
37
|
-
'slideEnter-right': {
|
|
38
|
-
willChange: 'transform',
|
|
39
|
-
transform: 'translate(-100%)',
|
|
40
|
-
},
|
|
41
|
-
slideEnterActive: {
|
|
42
|
-
transform: 'translate(0%)',
|
|
43
|
-
transition: slideTransition,
|
|
44
|
-
},
|
|
45
|
-
slideExit: {
|
|
46
|
-
transform: 'translate(0%)',
|
|
47
|
-
},
|
|
48
|
-
'slideExitActiveLeft-left': {
|
|
49
|
-
willChange: 'transform',
|
|
50
|
-
transform: 'translate(-200%)',
|
|
51
|
-
transition: slideTransition,
|
|
52
|
-
},
|
|
53
|
-
'slideExitActiveLeft-right': {
|
|
54
|
-
willChange: 'transform',
|
|
55
|
-
transform: 'translate(200%)',
|
|
56
|
-
transition: slideTransition,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
{ name: 'MuiPickersSlideTransition' }
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const SlideTransition: React.SFC<SlideTransitionProps> = ({
|
|
64
|
-
children,
|
|
65
|
-
transKey,
|
|
66
|
-
slideDirection,
|
|
67
|
-
className = null,
|
|
68
|
-
}) => {
|
|
69
|
-
const classes = useStyles();
|
|
70
|
-
const transitionClasses = {
|
|
71
|
-
exit: classes.slideExit,
|
|
72
|
-
enterActive: classes.slideEnterActive,
|
|
73
|
-
// @ts-ignore
|
|
74
|
-
enter: classes['slideEnter-' + slideDirection],
|
|
75
|
-
// @ts-ignore
|
|
76
|
-
exitActive: classes['slideExitActiveLeft-' + slideDirection],
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<TransitionGroup
|
|
81
|
-
className={clsx(classes.transitionContainer, className)}
|
|
82
|
-
childFactory={element =>
|
|
83
|
-
React.cloneElement(element, {
|
|
84
|
-
classNames: transitionClasses,
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
>
|
|
88
|
-
<CSSTransition
|
|
89
|
-
mountOnEnter
|
|
90
|
-
unmountOnExit
|
|
91
|
-
key={transKey + slideDirection}
|
|
92
|
-
timeout={animationDuration}
|
|
93
|
-
classNames={transitionClasses}
|
|
94
|
-
children={children}
|
|
95
|
-
/>
|
|
96
|
-
</TransitionGroup>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default SlideTransition;
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
|
-
import ClockPointer from './ClockPointer';
|
|
4
|
-
import ClockType, { ClockViewType } from '../../constants/ClockType';
|
|
5
|
-
import { getHours, getMinutes } from '../../_helpers/time-utils';
|
|
6
|
-
import { withStyles, createStyles, WithStyles, Theme } from '@material-ui/core/styles';
|
|
7
|
-
|
|
8
|
-
export interface ClockProps extends WithStyles<typeof styles> {
|
|
9
|
-
type: ClockViewType;
|
|
10
|
-
value: number;
|
|
11
|
-
onChange: (value: number, isFinish?: boolean) => void;
|
|
12
|
-
ampm?: boolean;
|
|
13
|
-
minutesStep?: number;
|
|
14
|
-
children: React.ReactElement<any>[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class Clock extends React.Component<ClockProps> {
|
|
18
|
-
public static propTypes: any = {
|
|
19
|
-
type: PropTypes.oneOf(Object.keys(ClockType).map(key => ClockType[key as any])).isRequired,
|
|
20
|
-
value: PropTypes.number.isRequired,
|
|
21
|
-
onChange: PropTypes.func.isRequired,
|
|
22
|
-
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
23
|
-
ampm: PropTypes.bool,
|
|
24
|
-
minutesStep: PropTypes.number,
|
|
25
|
-
innerRef: PropTypes.any,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
public static defaultProps = {
|
|
29
|
-
ampm: false,
|
|
30
|
-
minutesStep: 1,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
public isMoving = false;
|
|
34
|
-
|
|
35
|
-
public setTime(e: any, isFinish = false) {
|
|
36
|
-
let { offsetX, offsetY } = e;
|
|
37
|
-
|
|
38
|
-
if (typeof offsetX === 'undefined') {
|
|
39
|
-
const rect = e.target.getBoundingClientRect();
|
|
40
|
-
|
|
41
|
-
offsetX = e.changedTouches[0].clientX - rect.left;
|
|
42
|
-
offsetY = e.changedTouches[0].clientY - rect.top;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const value =
|
|
46
|
-
this.props.type === ClockType.SECONDS || this.props.type === ClockType.MINUTES
|
|
47
|
-
? getMinutes(offsetX, offsetY, this.props.minutesStep)
|
|
48
|
-
: getHours(offsetX, offsetY, Boolean(this.props.ampm));
|
|
49
|
-
|
|
50
|
-
this.props.onChange(value, isFinish);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public handleTouchMove = (e: React.TouchEvent) => {
|
|
54
|
-
this.isMoving = true;
|
|
55
|
-
this.setTime(e);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
public handleTouchEnd = (e: React.TouchEvent) => {
|
|
59
|
-
if (this.isMoving) {
|
|
60
|
-
this.setTime(e, true);
|
|
61
|
-
this.isMoving = false;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
public handleMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
66
|
-
e.preventDefault();
|
|
67
|
-
e.stopPropagation();
|
|
68
|
-
// MouseEvent.which is deprecated, but MouseEvent.buttons is not supported in Safari
|
|
69
|
-
const isButtonPressed =
|
|
70
|
-
typeof e.buttons === 'undefined' ? e.nativeEvent.which === 1 : e.buttons === 1;
|
|
71
|
-
|
|
72
|
-
if (isButtonPressed) {
|
|
73
|
-
this.setTime(e.nativeEvent, false);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
public handleMouseUp = (e: React.MouseEvent) => {
|
|
78
|
-
if (this.isMoving) {
|
|
79
|
-
this.isMoving = false;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
this.setTime(e.nativeEvent, true);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
public hasSelected = () => {
|
|
86
|
-
const { type, value } = this.props;
|
|
87
|
-
|
|
88
|
-
if (type === ClockType.HOURS) {
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return value % 5 === 0;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
public render() {
|
|
96
|
-
const { classes, value, children, type, ampm } = this.props;
|
|
97
|
-
|
|
98
|
-
const isPointerInner = !ampm && type === ClockType.HOURS && (value < 1 || value > 12);
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<div className={classes.container}>
|
|
102
|
-
<div className={classes.clock}>
|
|
103
|
-
<div
|
|
104
|
-
role="menu"
|
|
105
|
-
tabIndex={-1}
|
|
106
|
-
className={classes.squareMask}
|
|
107
|
-
onTouchMove={this.handleTouchMove}
|
|
108
|
-
onTouchEnd={this.handleTouchEnd}
|
|
109
|
-
onMouseUp={this.handleMouseUp}
|
|
110
|
-
onMouseMove={this.handleMove}
|
|
111
|
-
/>
|
|
112
|
-
|
|
113
|
-
<div className={classes.pin} />
|
|
114
|
-
|
|
115
|
-
<ClockPointer
|
|
116
|
-
type={type}
|
|
117
|
-
value={value}
|
|
118
|
-
isInner={isPointerInner}
|
|
119
|
-
hasSelected={this.hasSelected()}
|
|
120
|
-
/>
|
|
121
|
-
|
|
122
|
-
{children}
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export const styles = (theme: Theme) =>
|
|
130
|
-
createStyles({
|
|
131
|
-
container: {
|
|
132
|
-
display: 'flex',
|
|
133
|
-
justifyContent: 'center',
|
|
134
|
-
alignItems: 'flex-end',
|
|
135
|
-
margin: `${theme.spacing(2)}px 0 ${theme.spacing(1)}px`,
|
|
136
|
-
},
|
|
137
|
-
clock: {
|
|
138
|
-
backgroundColor: 'rgba(0,0,0,.07)',
|
|
139
|
-
borderRadius: '50%',
|
|
140
|
-
height: 260,
|
|
141
|
-
width: 260,
|
|
142
|
-
position: 'relative',
|
|
143
|
-
pointerEvents: 'none',
|
|
144
|
-
zIndex: 1,
|
|
145
|
-
},
|
|
146
|
-
squareMask: {
|
|
147
|
-
width: '100%',
|
|
148
|
-
height: '100%',
|
|
149
|
-
position: 'absolute',
|
|
150
|
-
pointerEvents: 'auto',
|
|
151
|
-
outline: 'none',
|
|
152
|
-
touchActions: 'none',
|
|
153
|
-
userSelect: 'none',
|
|
154
|
-
'&:active': {
|
|
155
|
-
cursor: 'move',
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
pin: {
|
|
159
|
-
width: 6,
|
|
160
|
-
height: 6,
|
|
161
|
-
borderRadius: '50%',
|
|
162
|
-
backgroundColor: theme.palette.primary.main,
|
|
163
|
-
position: 'absolute',
|
|
164
|
-
top: '50%',
|
|
165
|
-
left: '50%',
|
|
166
|
-
transform: 'translate(-50%, -50%)',
|
|
167
|
-
},
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
export default withStyles(styles, {
|
|
171
|
-
name: 'MuiPickersClock',
|
|
172
|
-
})(Clock as React.ComponentType<ClockProps>);
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import Typography from '@material-ui/core/Typography';
|
|
4
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
5
|
-
|
|
6
|
-
const positions: Record<number, [number, number]> = {
|
|
7
|
-
0: [0, 40],
|
|
8
|
-
1: [55, 19.6],
|
|
9
|
-
2: [94.4, 59.5],
|
|
10
|
-
3: [109, 114],
|
|
11
|
-
4: [94.4, 168.5],
|
|
12
|
-
5: [54.5, 208.4],
|
|
13
|
-
6: [0, 223],
|
|
14
|
-
7: [-54.5, 208.4],
|
|
15
|
-
8: [-94.4, 168.5],
|
|
16
|
-
9: [-109, 114],
|
|
17
|
-
10: [-94.4, 59.5],
|
|
18
|
-
11: [-54.5, 19.6],
|
|
19
|
-
12: [0, 5],
|
|
20
|
-
13: [36.9, 49.9],
|
|
21
|
-
14: [64, 77],
|
|
22
|
-
15: [74, 114],
|
|
23
|
-
16: [64, 151],
|
|
24
|
-
17: [37, 178],
|
|
25
|
-
18: [0, 188],
|
|
26
|
-
19: [-37, 178],
|
|
27
|
-
20: [-64, 151],
|
|
28
|
-
21: [-74, 114],
|
|
29
|
-
22: [-64, 77],
|
|
30
|
-
23: [-37, 50],
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export interface ClockNumberProps {
|
|
34
|
-
index: number;
|
|
35
|
-
label: string;
|
|
36
|
-
selected: boolean;
|
|
37
|
-
isInner?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const useStyles = makeStyles(
|
|
41
|
-
theme => {
|
|
42
|
-
const size = theme.spacing(4);
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
clockNumber: {
|
|
46
|
-
width: size,
|
|
47
|
-
height: 32,
|
|
48
|
-
userSelect: 'none',
|
|
49
|
-
position: 'absolute',
|
|
50
|
-
left: `calc(50% - ${size / 2}px)`,
|
|
51
|
-
display: 'inline-flex',
|
|
52
|
-
justifyContent: 'center',
|
|
53
|
-
alignItems: 'center',
|
|
54
|
-
borderRadius: '50%',
|
|
55
|
-
color:
|
|
56
|
-
theme.palette.type === 'light' ? theme.palette.text.primary : theme.palette.text.hint,
|
|
57
|
-
},
|
|
58
|
-
clockNumberSelected: {
|
|
59
|
-
color: theme.palette.primary.contrastText,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
{ name: 'MuiPickersClockNumber' }
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
export const ClockNumber: React.FC<ClockNumberProps> = ({ selected, label, index, isInner }) => {
|
|
67
|
-
const classes = useStyles();
|
|
68
|
-
const className = clsx(classes.clockNumber, {
|
|
69
|
-
[classes.clockNumberSelected]: selected,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const transformStyle = React.useMemo(() => {
|
|
73
|
-
const position = positions[index];
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
transform: `translate(${position[0]}px, ${position[1]}px`,
|
|
77
|
-
};
|
|
78
|
-
}, [index]);
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<Typography
|
|
82
|
-
component="span"
|
|
83
|
-
className={className}
|
|
84
|
-
variant={isInner ? 'body2' : 'body1'}
|
|
85
|
-
style={transformStyle}
|
|
86
|
-
children={label}
|
|
87
|
-
/>
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default ClockNumber;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import ClockNumber from './ClockNumber';
|
|
3
|
-
import { IUtils } from '@date-io/core/IUtils';
|
|
4
|
-
import { MaterialUiPickersDate } from '../../typings/date';
|
|
5
|
-
|
|
6
|
-
export const getHourNumbers = ({
|
|
7
|
-
ampm,
|
|
8
|
-
utils,
|
|
9
|
-
date,
|
|
10
|
-
}: {
|
|
11
|
-
ampm: boolean;
|
|
12
|
-
utils: IUtils<MaterialUiPickersDate>;
|
|
13
|
-
date: MaterialUiPickersDate;
|
|
14
|
-
}) => {
|
|
15
|
-
const currentHours = utils.getHours(date);
|
|
16
|
-
|
|
17
|
-
const hourNumbers: JSX.Element[] = [];
|
|
18
|
-
const startHour = ampm ? 1 : 0;
|
|
19
|
-
const endHour = ampm ? 12 : 23;
|
|
20
|
-
|
|
21
|
-
const isSelected = (hour: number) => {
|
|
22
|
-
if (ampm) {
|
|
23
|
-
if (hour === 12) {
|
|
24
|
-
return currentHours === 12 || currentHours === 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return currentHours === hour || currentHours - 12 === hour;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return currentHours === hour;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
for (let hour = startHour; hour <= endHour; hour += 1) {
|
|
34
|
-
let label = hour.toString();
|
|
35
|
-
|
|
36
|
-
if (hour === 0) {
|
|
37
|
-
label = '00';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const props = {
|
|
41
|
-
index: hour,
|
|
42
|
-
label: utils.formatNumber(label),
|
|
43
|
-
selected: isSelected(hour),
|
|
44
|
-
isInner: !ampm && (hour === 0 || hour > 12),
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
hourNumbers.push(<ClockNumber key={hour} {...props} />);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return hourNumbers;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const getMinutesNumbers = ({
|
|
54
|
-
value,
|
|
55
|
-
utils,
|
|
56
|
-
}: {
|
|
57
|
-
value: number;
|
|
58
|
-
utils: IUtils<MaterialUiPickersDate>;
|
|
59
|
-
}) => {
|
|
60
|
-
const f = utils.formatNumber;
|
|
61
|
-
|
|
62
|
-
return [
|
|
63
|
-
<ClockNumber label={f('00')} selected={value === 0} index={12} key={12} />,
|
|
64
|
-
<ClockNumber label={f('05')} selected={value === 5} index={1} key={1} />,
|
|
65
|
-
<ClockNumber label={f('10')} selected={value === 10} index={2} key={2} />,
|
|
66
|
-
<ClockNumber label={f('15')} selected={value === 15} index={3} key={3} />,
|
|
67
|
-
<ClockNumber label={f('20')} selected={value === 20} index={4} key={4} />,
|
|
68
|
-
<ClockNumber label={f('25')} selected={value === 25} index={5} key={5} />,
|
|
69
|
-
<ClockNumber label={f('30')} selected={value === 30} index={6} key={6} />,
|
|
70
|
-
<ClockNumber label={f('35')} selected={value === 35} index={7} key={7} />,
|
|
71
|
-
<ClockNumber label={f('40')} selected={value === 40} index={8} key={8} />,
|
|
72
|
-
<ClockNumber label={f('45')} selected={value === 45} index={9} key={9} />,
|
|
73
|
-
<ClockNumber label={f('50')} selected={value === 50} index={10} key={10} />,
|
|
74
|
-
<ClockNumber label={f('55')} selected={value === 55} index={11} key={11} />,
|
|
75
|
-
];
|
|
76
|
-
};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import ClockType, { ClockViewType } from '../../constants/ClockType';
|
|
4
|
-
import { Theme } from '@material-ui/core';
|
|
5
|
-
import { withStyles, createStyles, WithStyles } from '@material-ui/core/styles';
|
|
6
|
-
|
|
7
|
-
export interface ClockPointerProps extends WithStyles<typeof styles> {
|
|
8
|
-
value: number;
|
|
9
|
-
hasSelected: boolean;
|
|
10
|
-
isInner: boolean;
|
|
11
|
-
type: ClockViewType;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class ClockPointer extends React.Component<ClockPointerProps> {
|
|
15
|
-
public static getDerivedStateFromProps = (
|
|
16
|
-
nextProps: ClockPointerProps,
|
|
17
|
-
state: ClockPointer['state']
|
|
18
|
-
) => {
|
|
19
|
-
if (nextProps.type !== state.previousType) {
|
|
20
|
-
return {
|
|
21
|
-
toAnimateTransform: true,
|
|
22
|
-
previousType: nextProps.type,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
toAnimateTransform: false,
|
|
28
|
-
previousType: nextProps.type,
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
public state = {
|
|
33
|
-
toAnimateTransform: false,
|
|
34
|
-
previousType: undefined,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
public getAngleStyle = () => {
|
|
38
|
-
const { value, isInner, type } = this.props;
|
|
39
|
-
|
|
40
|
-
const max = type === ClockType.HOURS ? 12 : 60;
|
|
41
|
-
let angle = (360 / max) * value;
|
|
42
|
-
|
|
43
|
-
if (type === ClockType.HOURS && value > 12) {
|
|
44
|
-
angle -= 360; // round up angle to max 360 degrees
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
height: isInner ? '26%' : '40%',
|
|
49
|
-
transform: `rotateZ(${angle}deg)`,
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
public render() {
|
|
54
|
-
const { classes, hasSelected } = this.props;
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div
|
|
58
|
-
style={this.getAngleStyle()}
|
|
59
|
-
className={clsx(classes.pointer, {
|
|
60
|
-
[classes.animateTransform]: this.state.toAnimateTransform,
|
|
61
|
-
})}
|
|
62
|
-
>
|
|
63
|
-
<div
|
|
64
|
-
className={clsx(classes.thumb, {
|
|
65
|
-
[classes.noPoint]: hasSelected,
|
|
66
|
-
})}
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export const styles = (theme: Theme) =>
|
|
74
|
-
createStyles({
|
|
75
|
-
pointer: {
|
|
76
|
-
width: 2,
|
|
77
|
-
backgroundColor: theme.palette.primary.main,
|
|
78
|
-
position: 'absolute',
|
|
79
|
-
left: 'calc(50% - 1px)',
|
|
80
|
-
bottom: '50%',
|
|
81
|
-
transformOrigin: 'center bottom 0px',
|
|
82
|
-
},
|
|
83
|
-
animateTransform: {
|
|
84
|
-
transition: theme.transitions.create(['transform', 'height']),
|
|
85
|
-
},
|
|
86
|
-
thumb: {
|
|
87
|
-
width: 4,
|
|
88
|
-
height: 4,
|
|
89
|
-
backgroundColor: theme.palette.primary.contrastText,
|
|
90
|
-
borderRadius: '100%',
|
|
91
|
-
position: 'absolute',
|
|
92
|
-
top: -21,
|
|
93
|
-
left: -15,
|
|
94
|
-
border: `14px solid ${theme.palette.primary.main}`,
|
|
95
|
-
boxSizing: 'content-box',
|
|
96
|
-
},
|
|
97
|
-
noPoint: {
|
|
98
|
-
backgroundColor: theme.palette.primary.main,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
export default withStyles(styles, {
|
|
103
|
-
name: 'MuiPickersClockPointer',
|
|
104
|
-
})(ClockPointer as React.ComponentType<ClockPointerProps>);
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
|
-
import Clock from './Clock';
|
|
4
|
-
import ClockType, { ClockViewType } from '../../constants/ClockType';
|
|
5
|
-
import { useUtils } from '../../_shared/hooks/useUtils';
|
|
6
|
-
import { MaterialUiPickersDate } from '../../typings/date';
|
|
7
|
-
import { getHourNumbers, getMinutesNumbers } from './ClockNumbers';
|
|
8
|
-
import { convertToMeridiem, getMeridiem } from '../../_helpers/time-utils';
|
|
9
|
-
|
|
10
|
-
export interface TimePickerViewProps {
|
|
11
|
-
/** TimePicker value */
|
|
12
|
-
date: MaterialUiPickersDate;
|
|
13
|
-
/** Clock type */
|
|
14
|
-
type: ClockViewType;
|
|
15
|
-
/** 12h/24h clock mode */
|
|
16
|
-
ampm?: boolean;
|
|
17
|
-
/** Minutes step */
|
|
18
|
-
minutesStep?: number;
|
|
19
|
-
/** On hour change */
|
|
20
|
-
onHourChange: (date: MaterialUiPickersDate, isFinish?: boolean) => void;
|
|
21
|
-
/** On minutes change */
|
|
22
|
-
onMinutesChange: (date: MaterialUiPickersDate, isFinish?: boolean) => void;
|
|
23
|
-
/** On seconds change */
|
|
24
|
-
onSecondsChange: (date: MaterialUiPickersDate, isFinish?: boolean) => void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const TimePickerView: React.FC<TimePickerViewProps> = ({
|
|
28
|
-
type,
|
|
29
|
-
onHourChange,
|
|
30
|
-
onMinutesChange,
|
|
31
|
-
onSecondsChange,
|
|
32
|
-
ampm,
|
|
33
|
-
date,
|
|
34
|
-
minutesStep,
|
|
35
|
-
}) => {
|
|
36
|
-
const utils = useUtils();
|
|
37
|
-
const viewProps = React.useMemo(() => {
|
|
38
|
-
switch (type) {
|
|
39
|
-
case ClockType.HOURS:
|
|
40
|
-
return {
|
|
41
|
-
value: utils.getHours(date),
|
|
42
|
-
children: getHourNumbers({ date, utils, ampm: Boolean(ampm) }),
|
|
43
|
-
onChange: (value: number, isFinish?: boolean) => {
|
|
44
|
-
const currentMeridiem = getMeridiem(date, utils);
|
|
45
|
-
const updatedTimeWithMeridiem = convertToMeridiem(
|
|
46
|
-
utils.setHours(date, value),
|
|
47
|
-
currentMeridiem,
|
|
48
|
-
Boolean(ampm),
|
|
49
|
-
utils
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
onHourChange(updatedTimeWithMeridiem, isFinish);
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
case ClockType.MINUTES:
|
|
57
|
-
const minutesValue = utils.getMinutes(date);
|
|
58
|
-
return {
|
|
59
|
-
value: minutesValue,
|
|
60
|
-
children: getMinutesNumbers({ value: minutesValue, utils }),
|
|
61
|
-
onChange: (value: number, isFinish?: boolean) => {
|
|
62
|
-
const updatedTime = utils.setMinutes(date, value);
|
|
63
|
-
|
|
64
|
-
onMinutesChange(updatedTime, isFinish);
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
case ClockType.SECONDS:
|
|
69
|
-
const secondsValue = utils.getSeconds(date);
|
|
70
|
-
return {
|
|
71
|
-
value: secondsValue,
|
|
72
|
-
children: getMinutesNumbers({ value: secondsValue, utils }),
|
|
73
|
-
onChange: (value: number, isFinish?: boolean) => {
|
|
74
|
-
const updatedTime = utils.setSeconds(date, value);
|
|
75
|
-
|
|
76
|
-
onSecondsChange(updatedTime, isFinish);
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
default:
|
|
81
|
-
throw new Error('You must provide the type for TimePickerView');
|
|
82
|
-
}
|
|
83
|
-
}, [ampm, date, onHourChange, onMinutesChange, onSecondsChange, type, utils]);
|
|
84
|
-
|
|
85
|
-
return <Clock type={type} ampm={ampm} minutesStep={minutesStep} {...viewProps} />;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
TimePickerView.displayName = 'TimePickerView';
|
|
89
|
-
|
|
90
|
-
TimePickerView.propTypes = {
|
|
91
|
-
date: PropTypes.object.isRequired,
|
|
92
|
-
onHourChange: PropTypes.func.isRequired,
|
|
93
|
-
onMinutesChange: PropTypes.func.isRequired,
|
|
94
|
-
onSecondsChange: PropTypes.func.isRequired,
|
|
95
|
-
ampm: PropTypes.bool,
|
|
96
|
-
minutesStep: PropTypes.number,
|
|
97
|
-
type: PropTypes.oneOf(Object.keys(ClockType).map(key => ClockType[key as any])).isRequired,
|
|
98
|
-
} as any;
|
|
99
|
-
|
|
100
|
-
TimePickerView.defaultProps = {
|
|
101
|
-
ampm: true,
|
|
102
|
-
minutesStep: 1,
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export default React.memo(TimePickerView);
|